@epam/ai-dial-conversation-input 1.1.0-dev.78 → 1.1.0-dev.87
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/index.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
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, Button as l, DIAL_ICON_SIZE as u, DialCloseButton as d, DialDropdown as f, DialDropdownIcon as p, DialErrorText as m,
|
|
3
|
-
import { IconArrowLeft as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { createElement as P, memo 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, DialInput as h, DialPopup as g, DialRadioGroup as _, DialSearch as v, DialSkeleton as y, DialSkeletonVariant as b, DialSlider as x, DialTag as S, DialTooltip as C, ElementSize as w, GhostIconButton as T, Highlight as E, NeutralButton as D, PopupSize as O, PrimaryButton as k, PrimaryIconButton as A, RadioGroupOrientation as ee, StaticIconButton as te } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconArrowLeft as ne, IconArrowNarrowRight as re, IconCheck as ie, IconChevronDown as j, IconChevronRight as M, IconFile as ae, IconMicrophone as oe, IconPaperclip as se, IconPlayerStopFilled as ce, IconPlaystationSquare as le, IconPlus as N, 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 P, memo as F, useCallback as I, useEffect as L, useImperativeHandle as me, useLayoutEffect as he, useMemo as R, useRef as z, useState as B } from "react";
|
|
6
|
+
import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
|
|
7
|
+
import { AttachmentCard as ge, AttachmentGroup as _e, AttachmentTray as ve, AttachmentTray as ye, FileDndOverlay as be, MAX_UPLOADS_PER_MINUTE as xe, generateAttachmentId as Se, getAttachmentIcon as Ce, useClipboardPaste as we } from "@epam/ai-dial-attachment-input";
|
|
8
8
|
//#region src/hooks/useBottomSheet.ts
|
|
9
|
-
var
|
|
10
|
-
|
|
9
|
+
var Te = (e, t) => {
|
|
10
|
+
L(() => {
|
|
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]), L(() => {
|
|
17
17
|
if (e) return document.body.style.overflow = "hidden", () => {
|
|
18
18
|
document.body.style.overflow = "";
|
|
19
19
|
};
|
|
20
20
|
}, [e]);
|
|
21
|
-
},
|
|
21
|
+
}, Ee = {
|
|
22
22
|
backdrop: "_backdrop_qmzqj_9",
|
|
23
23
|
sheet: "_sheet_qmzqj_13",
|
|
24
24
|
"slide-up": "_slide-up_qmzqj_1",
|
|
25
25
|
title: "_title_qmzqj_18",
|
|
26
26
|
divider: "_divider_qmzqj_22"
|
|
27
|
-
}, W = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: s, "aria-label": c, style: l, titleClassName: f = "dial-body-semi-text", className: p, colors: m, children:
|
|
28
|
-
if (
|
|
29
|
-
let
|
|
27
|
+
}, W = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: s, "aria-label": c, style: l, titleClassName: f = "dial-body-semi-text", className: p, colors: m, children: h }) => {
|
|
28
|
+
if (Te(e, r), !e || typeof document > "u") return null;
|
|
29
|
+
let g = a({
|
|
30
30
|
"--ci-backdrop": m?.backdrop,
|
|
31
31
|
"--ci-sheet-bg": m?.sheetBg,
|
|
32
32
|
"--ci-sheet-text": m?.sheetText,
|
|
33
33
|
"--ci-sheet-divider": m?.divider
|
|
34
34
|
});
|
|
35
|
-
return
|
|
36
|
-
className: o(
|
|
37
|
-
style:
|
|
35
|
+
return pe(/* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("div", {
|
|
36
|
+
className: o(Ee.backdrop, "fixed inset-0 z-[55]"),
|
|
37
|
+
style: g,
|
|
38
38
|
onPointerDown: r,
|
|
39
39
|
"aria-hidden": !0
|
|
40
|
-
}), /* @__PURE__ */
|
|
40
|
+
}), /* @__PURE__ */ U("div", {
|
|
41
41
|
role: "dialog",
|
|
42
42
|
"aria-modal": !0,
|
|
43
43
|
"aria-label": t ?? c,
|
|
44
44
|
style: {
|
|
45
|
-
...
|
|
45
|
+
...g,
|
|
46
46
|
...l
|
|
47
47
|
},
|
|
48
|
-
className: o(
|
|
49
|
-
children: [t != null && /* @__PURE__ */
|
|
48
|
+
className: o(Ee.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col", p),
|
|
49
|
+
children: [t != null && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ U("div", {
|
|
50
50
|
className: "relative flex h-[60px] flex-shrink-0 items-center justify-center px-4",
|
|
51
51
|
children: [
|
|
52
|
-
i && /* @__PURE__ */
|
|
52
|
+
i && /* @__PURE__ */ H("div", {
|
|
53
53
|
className: "absolute start-4",
|
|
54
|
-
children: /* @__PURE__ */
|
|
55
|
-
icon: /* @__PURE__ */
|
|
54
|
+
children: /* @__PURE__ */ H(T, {
|
|
55
|
+
icon: /* @__PURE__ */ H(ne, {
|
|
56
56
|
size: u.LG,
|
|
57
57
|
stroke: 1.5,
|
|
58
58
|
className: "rtl:scale-x-[-1]"
|
|
@@ -61,41 +61,41 @@ var Ee = (e, t) => {
|
|
|
61
61
|
onClick: i
|
|
62
62
|
})
|
|
63
63
|
}),
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
className: o(
|
|
64
|
+
/* @__PURE__ */ H("span", {
|
|
65
|
+
className: o(Ee.title, f),
|
|
66
66
|
children: t
|
|
67
67
|
}),
|
|
68
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ H("div", {
|
|
69
69
|
className: "absolute end-4 m-2",
|
|
70
|
-
children: /* @__PURE__ */
|
|
70
|
+
children: /* @__PURE__ */ H(d, {
|
|
71
71
|
ariaLabel: n,
|
|
72
72
|
size: u.LG,
|
|
73
73
|
onClose: r
|
|
74
74
|
})
|
|
75
75
|
})
|
|
76
76
|
]
|
|
77
|
-
}), /* @__PURE__ */
|
|
77
|
+
}), /* @__PURE__ */ H("div", { className: o(Ee.divider, "h-px flex-shrink-0") })] }), /* @__PURE__ */ H("div", {
|
|
78
78
|
className: "overflow-y-auto",
|
|
79
|
-
children:
|
|
79
|
+
children: h
|
|
80
80
|
})]
|
|
81
81
|
})] }), document.body);
|
|
82
|
-
},
|
|
82
|
+
}, De = async (e, t, n) => {
|
|
83
83
|
let r = 6e4 / t, i = [];
|
|
84
84
|
for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
|
|
85
85
|
await Promise.allSettled(i);
|
|
86
|
-
},
|
|
87
|
-
let [h, g] =
|
|
88
|
-
|
|
86
|
+
}, Oe = ({ 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 }) => {
|
|
87
|
+
let [h, g] = B(n), _ = z(h);
|
|
88
|
+
L(() => {
|
|
89
89
|
_.current = h;
|
|
90
|
-
}, [h]),
|
|
90
|
+
}, [h]), L(() => () => {
|
|
91
91
|
_.current.forEach((e) => {
|
|
92
92
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
93
93
|
});
|
|
94
94
|
}, []);
|
|
95
|
-
let v =
|
|
95
|
+
let v = I((e) => e.map((e) => {
|
|
96
96
|
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;
|
|
97
97
|
return {
|
|
98
|
-
id:
|
|
98
|
+
id: Se(),
|
|
99
99
|
name: e.name,
|
|
100
100
|
contentType: e.type,
|
|
101
101
|
file: e,
|
|
@@ -104,26 +104,26 @@ var Ee = (e, t) => {
|
|
|
104
104
|
previewUrl: a,
|
|
105
105
|
playUrl: o
|
|
106
106
|
};
|
|
107
|
-
}), []), y =
|
|
108
|
-
|
|
107
|
+
}), []), y = z(a);
|
|
108
|
+
L(() => {
|
|
109
109
|
y.current = a;
|
|
110
110
|
}, [a]);
|
|
111
|
-
let b =
|
|
111
|
+
let b = z(!0), x = I((e) => {
|
|
112
112
|
g((t) => {
|
|
113
113
|
let n = e(t);
|
|
114
114
|
return n === t ? t : n;
|
|
115
115
|
});
|
|
116
116
|
}, []);
|
|
117
|
-
|
|
117
|
+
L(() => {
|
|
118
118
|
if (b.current) {
|
|
119
119
|
b.current = !1;
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
y.current?.(h);
|
|
123
123
|
}, [h]);
|
|
124
|
-
let S =
|
|
124
|
+
let S = I((e) => {
|
|
125
125
|
g(e);
|
|
126
|
-
}, []), C =
|
|
126
|
+
}, []), C = I(async (t) => {
|
|
127
127
|
if (i) {
|
|
128
128
|
x((e) => e.map((e) => e.id === t.id ? {
|
|
129
129
|
...e,
|
|
@@ -145,7 +145,7 @@ var Ee = (e, t) => {
|
|
|
145
145
|
} : e));
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
}, [i, x]), w =
|
|
148
|
+
}, [i, x]), w = I((e, t = !0) => {
|
|
149
149
|
let n = new Set(_.current.map((e) => e.id)), i = e.filter((e) => !n.has(e.id));
|
|
150
150
|
if (i.length !== 0) {
|
|
151
151
|
if (f != null && f > 0 && Number.isFinite(f)) {
|
|
@@ -166,7 +166,7 @@ var Ee = (e, t) => {
|
|
|
166
166
|
status: r.Error,
|
|
167
167
|
errorReason: n
|
|
168
168
|
} : e));
|
|
169
|
-
}),
|
|
169
|
+
}), De(e, xe, C);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
}, [
|
|
@@ -177,20 +177,20 @@ var Ee = (e, t) => {
|
|
|
177
177
|
C,
|
|
178
178
|
o
|
|
179
179
|
]);
|
|
180
|
-
|
|
180
|
+
L(() => {
|
|
181
181
|
s.length !== 0 && (w(v(s)), c?.());
|
|
182
182
|
}, [
|
|
183
183
|
w,
|
|
184
184
|
v,
|
|
185
185
|
c,
|
|
186
186
|
s
|
|
187
|
-
]),
|
|
187
|
+
]), L(() => {
|
|
188
188
|
l.length !== 0 && (w(l, !1), u?.());
|
|
189
189
|
}, [
|
|
190
190
|
w,
|
|
191
191
|
u,
|
|
192
192
|
l
|
|
193
|
-
]),
|
|
193
|
+
]), L(() => {
|
|
194
194
|
if (!o) return;
|
|
195
195
|
let t = !1, n = [], i = _.current.map((i) => {
|
|
196
196
|
if (i.status === r.Loading) return i;
|
|
@@ -217,7 +217,7 @@ var Ee = (e, t) => {
|
|
|
217
217
|
x,
|
|
218
218
|
C
|
|
219
219
|
]);
|
|
220
|
-
let T =
|
|
220
|
+
let T = I((e) => {
|
|
221
221
|
x((t) => {
|
|
222
222
|
let n = t.find((t) => t.id === e);
|
|
223
223
|
return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
|
|
@@ -229,11 +229,11 @@ var Ee = (e, t) => {
|
|
|
229
229
|
addAttachments: w,
|
|
230
230
|
resetAttachments: S,
|
|
231
231
|
handleRemove: T,
|
|
232
|
-
handleRetry:
|
|
232
|
+
handleRetry: I((e) => {
|
|
233
233
|
let t = h.find((t) => t.id === e);
|
|
234
234
|
t && C(t);
|
|
235
235
|
}, [h, C]),
|
|
236
|
-
handleExpand:
|
|
236
|
+
handleExpand: I(async (e) => {
|
|
237
237
|
let n = h.find((t) => t.id === e);
|
|
238
238
|
if (!n || n.type !== t.Pasted) return;
|
|
239
239
|
let r = await n.file.text();
|
|
@@ -245,9 +245,9 @@ var Ee = (e, t) => {
|
|
|
245
245
|
]),
|
|
246
246
|
hasBlockedAttachments: h.some((e) => e.status === r.Loading || e.status === r.Error)
|
|
247
247
|
};
|
|
248
|
-
},
|
|
249
|
-
let [n, r] =
|
|
250
|
-
return
|
|
248
|
+
}, ke = (e, t) => {
|
|
249
|
+
let [n, r] = B(e), [i, a] = B(!1), [o, s] = B(0);
|
|
250
|
+
return L(() => {
|
|
251
251
|
if (e) {
|
|
252
252
|
r(!0), a(!1), s((e) => e + 1);
|
|
253
253
|
return;
|
|
@@ -263,18 +263,18 @@ var Ee = (e, t) => {
|
|
|
263
263
|
isExiting: i,
|
|
264
264
|
instanceKey: o
|
|
265
265
|
};
|
|
266
|
-
},
|
|
267
|
-
let t =
|
|
266
|
+
}, Ae = (e, t) => !e.slice(0, t).includes("\n"), je = (e, t) => !e.slice(t).includes("\n"), Me = (e) => {
|
|
267
|
+
let t = z(e);
|
|
268
268
|
t.current = e;
|
|
269
|
-
let n =
|
|
269
|
+
let n = z(-1), r = z(""), i = I((e, i, a) => {
|
|
270
270
|
let o = t.current;
|
|
271
|
-
return !o || o.length === 0 ? null : e === "up" ? !
|
|
272
|
-
}, []), a =
|
|
271
|
+
return !o || o.length === 0 ? null : e === "up" ? !Ae(i, a) || n.current === 0 ? null : (n.current === -1 ? (r.current = i, n.current = o.length - 1) : --n.current, o[n.current]) : n.current === -1 || !je(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
|
|
272
|
+
}, []), a = I(() => {
|
|
273
273
|
n.current = -1, r.current = "";
|
|
274
|
-
}, []), o =
|
|
274
|
+
}, []), o = I(() => {
|
|
275
275
|
n.current = -1, r.current = "";
|
|
276
276
|
}, []);
|
|
277
|
-
return
|
|
277
|
+
return R(() => ({
|
|
278
278
|
navigate: i,
|
|
279
279
|
notifyChange: a,
|
|
280
280
|
reset: o
|
|
@@ -283,13 +283,13 @@ var Ee = (e, t) => {
|
|
|
283
283
|
a,
|
|
284
284
|
o
|
|
285
285
|
]);
|
|
286
|
-
},
|
|
287
|
-
let [n, r] =
|
|
288
|
-
return
|
|
286
|
+
}, Ne = ({ messageProp: e, messageRevision: t }) => {
|
|
287
|
+
let [n, r] = B(e), i = z(null), a = z(0), [o, s] = B(!1);
|
|
288
|
+
return L(() => {
|
|
289
289
|
r(e);
|
|
290
|
-
}, [e, t]),
|
|
290
|
+
}, [e, t]), L(() => {
|
|
291
291
|
i.current && (a.current = i.current.offsetHeight);
|
|
292
|
-
}, []),
|
|
292
|
+
}, []), he(() => {
|
|
293
293
|
if (!i.current || a.current === 0) return;
|
|
294
294
|
let e = i.current.offsetHeight > a.current;
|
|
295
295
|
s((t) => e ? !0 : n === "" ? !1 : t);
|
|
@@ -299,20 +299,20 @@ var Ee = (e, t) => {
|
|
|
299
299
|
textareaRef: i,
|
|
300
300
|
isMultiLine: o
|
|
301
301
|
};
|
|
302
|
-
},
|
|
302
|
+
}, Pe = /* @__PURE__ */ function(e) {
|
|
303
303
|
return e.Idle = "idle", e.Recording = "recording", e.Error = "error", e;
|
|
304
|
-
}({}),
|
|
304
|
+
}({}), Fe = [
|
|
305
305
|
"audio/webm;codecs=opus",
|
|
306
306
|
"audio/ogg;codecs=opus",
|
|
307
307
|
"audio/webm"
|
|
308
|
-
],
|
|
309
|
-
let [t, n] =
|
|
308
|
+
], Ie = () => Fe.find((e) => MediaRecorder.isTypeSupported(e)) ?? "", Le = ({ onAttachAudio: e }) => {
|
|
309
|
+
let [t, n] = B("idle"), [r, i] = B(null), [a, o] = B(0), s = z(null), c = z(null), l = z(null), u = z(null), d = z([]), f = z(""), p = z(null), m = z(e);
|
|
310
310
|
m.current = e;
|
|
311
|
-
let h =
|
|
311
|
+
let h = I(() => {
|
|
312
312
|
p.current != null && (clearInterval(p.current), p.current = null);
|
|
313
|
-
}, []), g =
|
|
313
|
+
}, []), g = I(() => {
|
|
314
314
|
h(), s.current &&= (s.current.getTracks().forEach((e) => e.stop()), null), c.current &&= (c.current.close(), null), l.current = null, u.current = null;
|
|
315
|
-
}, [h]), _ =
|
|
315
|
+
}, [h]), _ = I(() => {
|
|
316
316
|
(async () => {
|
|
317
317
|
try {
|
|
318
318
|
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
@@ -321,7 +321,7 @@ var Ee = (e, t) => {
|
|
|
321
321
|
c.current = t;
|
|
322
322
|
let r = t.createAnalyser();
|
|
323
323
|
r.fftSize = 256, l.current = r, t.createMediaStreamSource(e).connect(r);
|
|
324
|
-
let i =
|
|
324
|
+
let i = Ie();
|
|
325
325
|
f.current = i, d.current = [];
|
|
326
326
|
let a = new MediaRecorder(e, i ? { mimeType: i } : void 0);
|
|
327
327
|
u.current = a, a.ondataavailable = (e) => {
|
|
@@ -333,17 +333,17 @@ var Ee = (e, t) => {
|
|
|
333
333
|
i(e instanceof Error ? e.message : "Microphone access denied"), n("error");
|
|
334
334
|
}
|
|
335
335
|
})();
|
|
336
|
-
}, []), v =
|
|
336
|
+
}, []), v = I(() => {
|
|
337
337
|
let e = u.current;
|
|
338
338
|
!e || e.state !== "recording" || (h(), e.onstop = () => {
|
|
339
339
|
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 });
|
|
340
340
|
m.current(c), g(), o(0), i(null), n("idle");
|
|
341
341
|
}, e.stop());
|
|
342
|
-
}, [h, g]), y =
|
|
342
|
+
}, [h, g]), y = I(() => {
|
|
343
343
|
let e = u.current;
|
|
344
344
|
e && e.state === "recording" && (e.ondataavailable = null, e.onstop = null, e.stop()), g(), o(0), i(null), n("idle");
|
|
345
345
|
}, [g]);
|
|
346
|
-
return
|
|
346
|
+
return L(() => () => {
|
|
347
347
|
g();
|
|
348
348
|
}, [g]), {
|
|
349
349
|
state: t,
|
|
@@ -354,12 +354,12 @@ var Ee = (e, t) => {
|
|
|
354
354
|
stopRecording: v,
|
|
355
355
|
discardRecording: y
|
|
356
356
|
};
|
|
357
|
-
},
|
|
357
|
+
}, Re = /* @__PURE__ */ function(e) {
|
|
358
358
|
return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
|
|
359
|
-
}({}),
|
|
359
|
+
}({}), ze = {
|
|
360
360
|
item: "_item_l2r5m_1",
|
|
361
361
|
itemIcon: "_itemIcon_l2r5m_11"
|
|
362
|
-
},
|
|
362
|
+
}, Be = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: s, className: c, titleClassName: u = "dial-body-semi-text", itemLabelClassName: d = "dial-small-text", btnTextClassName: f = "", colors: p }) => {
|
|
363
363
|
let m = (e) => {
|
|
364
364
|
e(), r();
|
|
365
365
|
}, h = a({
|
|
@@ -368,7 +368,7 @@ var Ee = (e, t) => {
|
|
|
368
368
|
"--ci-sheet-item-active": p?.itemActiveBg,
|
|
369
369
|
"--ci-sheet-icon": p?.itemIcon
|
|
370
370
|
});
|
|
371
|
-
return /* @__PURE__ */
|
|
371
|
+
return /* @__PURE__ */ H(W, {
|
|
372
372
|
isOpen: e,
|
|
373
373
|
title: t,
|
|
374
374
|
closeLabel: n,
|
|
@@ -377,23 +377,23 @@ var Ee = (e, t) => {
|
|
|
377
377
|
className: c,
|
|
378
378
|
titleClassName: u,
|
|
379
379
|
colors: p?.shell,
|
|
380
|
-
children: /* @__PURE__ */
|
|
380
|
+
children: /* @__PURE__ */ H("ul", {
|
|
381
381
|
role: "list",
|
|
382
382
|
className: "flex flex-col",
|
|
383
383
|
style: h,
|
|
384
|
-
children: s.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */
|
|
384
|
+
children: s.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ H("li", { children: /* @__PURE__ */ H(l, {
|
|
385
385
|
type: "button",
|
|
386
|
-
className: o(
|
|
387
|
-
iconBefore: /* @__PURE__ */
|
|
388
|
-
className:
|
|
386
|
+
className: o(ze.item, "w-full gap-3 px-4 py-[10px] text-start"),
|
|
387
|
+
iconBefore: /* @__PURE__ */ H("span", {
|
|
388
|
+
className: ze.itemIcon,
|
|
389
389
|
children: n
|
|
390
390
|
}),
|
|
391
|
-
iconAfter: r ? /* @__PURE__ */
|
|
391
|
+
iconAfter: r ? /* @__PURE__ */ H("span", {
|
|
392
392
|
className: "ms-auto",
|
|
393
393
|
children: r
|
|
394
394
|
}) : null,
|
|
395
395
|
textClassName: f,
|
|
396
|
-
label: /* @__PURE__ */
|
|
396
|
+
label: /* @__PURE__ */ H("span", {
|
|
397
397
|
className: d,
|
|
398
398
|
children: t
|
|
399
399
|
}),
|
|
@@ -401,9 +401,9 @@ var Ee = (e, t) => {
|
|
|
401
401
|
}) }, e))
|
|
402
402
|
})
|
|
403
403
|
});
|
|
404
|
-
},
|
|
405
|
-
let [s, c] =
|
|
406
|
-
|
|
404
|
+
}, Ve = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
405
|
+
let [s, c] = B(t), [l, u] = B(n), [d, f] = B(r), p = z(o);
|
|
406
|
+
L(() => {
|
|
407
407
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
408
408
|
}, [
|
|
409
409
|
o,
|
|
@@ -420,7 +420,7 @@ var Ee = (e, t) => {
|
|
|
420
420
|
setResponseFormat: c,
|
|
421
421
|
setSystemPrompt: u,
|
|
422
422
|
setTemperature: f,
|
|
423
|
-
handleSubmit:
|
|
423
|
+
handleSubmit: I(() => {
|
|
424
424
|
if (!m) return;
|
|
425
425
|
let t = {};
|
|
426
426
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -434,18 +434,18 @@ var Ee = (e, t) => {
|
|
|
434
434
|
a
|
|
435
435
|
])
|
|
436
436
|
};
|
|
437
|
-
},
|
|
437
|
+
}, He = "!dial-small-semi-text !text-primary gap-1", Ue = ({ 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: g = [
|
|
438
438
|
"Precise",
|
|
439
439
|
"Neutral",
|
|
440
440
|
"Creative"
|
|
441
|
-
], temperatureHint:
|
|
441
|
+
], temperatureHint: v }) => /* @__PURE__ */ U("div", {
|
|
442
442
|
className: "flex flex-col gap-4 px-6 py-3",
|
|
443
443
|
children: [
|
|
444
|
-
e.responseFormat && /* @__PURE__ */
|
|
444
|
+
e.responseFormat && /* @__PURE__ */ H(_, {
|
|
445
445
|
fieldTitle: c,
|
|
446
|
-
labelClassName:
|
|
446
|
+
labelClassName: He,
|
|
447
447
|
elementId: "response-format",
|
|
448
|
-
orientation:
|
|
448
|
+
orientation: ee.Column,
|
|
449
449
|
activeRadioButton: t ?? i.Markdown,
|
|
450
450
|
labelDescription: l,
|
|
451
451
|
radioButtons: [{
|
|
@@ -457,31 +457,31 @@ var Ee = (e, t) => {
|
|
|
457
457
|
}],
|
|
458
458
|
onChange: (e) => a(e)
|
|
459
459
|
}),
|
|
460
|
-
e.systemPrompt && /* @__PURE__ */
|
|
460
|
+
e.systemPrompt && /* @__PURE__ */ H(h, {
|
|
461
461
|
value: n,
|
|
462
462
|
placeholder: p,
|
|
463
463
|
labelProps: {
|
|
464
|
-
className:
|
|
464
|
+
className: He,
|
|
465
465
|
label: f
|
|
466
466
|
},
|
|
467
467
|
onChange: (e) => o(e ?? "")
|
|
468
468
|
}),
|
|
469
|
-
e.temperature && /* @__PURE__ */
|
|
469
|
+
e.temperature && /* @__PURE__ */ H(x, {
|
|
470
470
|
labelProps: {
|
|
471
471
|
label: m,
|
|
472
|
-
className:
|
|
473
|
-
caption:
|
|
472
|
+
className: He,
|
|
473
|
+
caption: v
|
|
474
474
|
},
|
|
475
475
|
value: r,
|
|
476
476
|
min: 0,
|
|
477
477
|
max: 1,
|
|
478
478
|
step: .1,
|
|
479
|
-
labels:
|
|
479
|
+
labels: g,
|
|
480
480
|
onChange: s
|
|
481
481
|
})
|
|
482
482
|
]
|
|
483
|
-
}),
|
|
484
|
-
let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat:
|
|
483
|
+
}), We = ({ 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: w }) => {
|
|
484
|
+
let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat: A, setSystemPrompt: ee, setTemperature: te, handleSubmit: ne } = Ve({
|
|
485
485
|
isOpen: e,
|
|
486
486
|
features: s,
|
|
487
487
|
initialResponseFormat: c,
|
|
@@ -490,7 +490,7 @@ var Ee = (e, t) => {
|
|
|
490
490
|
onSave: d,
|
|
491
491
|
onClose: r
|
|
492
492
|
});
|
|
493
|
-
return /* @__PURE__ */
|
|
493
|
+
return /* @__PURE__ */ U(W, {
|
|
494
494
|
isOpen: e,
|
|
495
495
|
title: f,
|
|
496
496
|
closeLabel: i,
|
|
@@ -498,12 +498,12 @@ var Ee = (e, t) => {
|
|
|
498
498
|
onBack: t,
|
|
499
499
|
backLabel: n,
|
|
500
500
|
style: a,
|
|
501
|
-
children: [/* @__PURE__ */
|
|
501
|
+
children: [/* @__PURE__ */ H(Ue, {
|
|
502
502
|
features: s,
|
|
503
503
|
responseFormat: T,
|
|
504
504
|
systemPrompt: E,
|
|
505
505
|
temperature: D,
|
|
506
|
-
onResponseFormatChange:
|
|
506
|
+
onResponseFormatChange: A,
|
|
507
507
|
onSystemPromptChange: ee,
|
|
508
508
|
onTemperatureChange: te,
|
|
509
509
|
responseFormatLabel: p,
|
|
@@ -515,13 +515,13 @@ var Ee = (e, t) => {
|
|
|
515
515
|
temperatureLabel: y,
|
|
516
516
|
temperatureLabels: b,
|
|
517
517
|
temperatureHint: x
|
|
518
|
-
}), /* @__PURE__ */
|
|
518
|
+
}), /* @__PURE__ */ H("div", {
|
|
519
519
|
className: o("px-6 py-4 mobile:pb-8"),
|
|
520
|
-
children: /* @__PURE__ */
|
|
521
|
-
tooltip:
|
|
522
|
-
hideTooltip: O || !
|
|
520
|
+
children: /* @__PURE__ */ H(C, {
|
|
521
|
+
tooltip: w,
|
|
522
|
+
hideTooltip: O || !w,
|
|
523
523
|
triggerClassName: "w-full",
|
|
524
|
-
children: /* @__PURE__ */
|
|
524
|
+
children: /* @__PURE__ */ H(k, {
|
|
525
525
|
label: S,
|
|
526
526
|
onClick: ne,
|
|
527
527
|
disabled: !O,
|
|
@@ -530,8 +530,8 @@ var Ee = (e, t) => {
|
|
|
530
530
|
})
|
|
531
531
|
})]
|
|
532
532
|
});
|
|
533
|
-
},
|
|
534
|
-
let { responseFormat: y, systemPrompt: b, temperature: x, canSubmit: S, setResponseFormat:
|
|
533
|
+
}, Ge = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", responseFormatLabel: s, responseFormatHint: c, responseFormatMarkdownLabel: l, responseFormatPlainTextLabel: u, systemPromptLabel: d, systemPromptTooltip: f, temperatureLabel: p, temperatureLabels: m, temperatureHint: h, saveLabel: _ = "Apply changes", saveDisabledTooltip: v }) => {
|
|
534
|
+
let { responseFormat: y, systemPrompt: b, temperature: x, canSubmit: S, setResponseFormat: w, setSystemPrompt: T, setTemperature: E, handleSubmit: D } = Ve({
|
|
535
535
|
features: e,
|
|
536
536
|
initialResponseFormat: t,
|
|
537
537
|
initialSystemPrompt: n,
|
|
@@ -539,30 +539,30 @@ var Ee = (e, t) => {
|
|
|
539
539
|
onSave: i,
|
|
540
540
|
onClose: a
|
|
541
541
|
});
|
|
542
|
-
return /* @__PURE__ */
|
|
542
|
+
return /* @__PURE__ */ H(g, {
|
|
543
543
|
open: !0,
|
|
544
544
|
header: o,
|
|
545
|
-
size:
|
|
545
|
+
size: O.Sm,
|
|
546
546
|
onClose: a,
|
|
547
547
|
className: "!bg-layer-2",
|
|
548
|
-
footer: /* @__PURE__ */
|
|
548
|
+
footer: /* @__PURE__ */ H("div", {
|
|
549
549
|
className: "flex justify-end px-6 py-4",
|
|
550
|
-
children: /* @__PURE__ */
|
|
550
|
+
children: /* @__PURE__ */ H(C, {
|
|
551
551
|
tooltip: v,
|
|
552
552
|
hideTooltip: S || !v,
|
|
553
|
-
children: /* @__PURE__ */
|
|
554
|
-
label:
|
|
553
|
+
children: /* @__PURE__ */ H(k, {
|
|
554
|
+
label: _,
|
|
555
555
|
onClick: D,
|
|
556
556
|
disabled: !S
|
|
557
557
|
})
|
|
558
558
|
})
|
|
559
559
|
}),
|
|
560
|
-
children: /* @__PURE__ */
|
|
560
|
+
children: /* @__PURE__ */ H(Ue, {
|
|
561
561
|
features: e,
|
|
562
562
|
responseFormat: y,
|
|
563
563
|
systemPrompt: b,
|
|
564
564
|
temperature: x,
|
|
565
|
-
onResponseFormatChange:
|
|
565
|
+
onResponseFormatChange: w,
|
|
566
566
|
onSystemPromptChange: T,
|
|
567
567
|
onTemperatureChange: E,
|
|
568
568
|
responseFormatLabel: s,
|
|
@@ -577,10 +577,10 @@ var Ee = (e, t) => {
|
|
|
577
577
|
})
|
|
578
578
|
});
|
|
579
579
|
};
|
|
580
|
-
|
|
580
|
+
F(Ge);
|
|
581
581
|
//#endregion
|
|
582
582
|
//#region src/components/ToolsBottomSheet/ToolsBottomSheet.tsx
|
|
583
|
-
var
|
|
583
|
+
var Ke = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: a, title: o = "Tools", items: s, onToolToggle: u }) => /* @__PURE__ */ H(W, {
|
|
584
584
|
isOpen: e,
|
|
585
585
|
title: o,
|
|
586
586
|
closeLabel: i,
|
|
@@ -588,28 +588,28 @@ var qe = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
588
588
|
onBack: t,
|
|
589
589
|
backLabel: n,
|
|
590
590
|
style: a,
|
|
591
|
-
children: /* @__PURE__ */
|
|
591
|
+
children: /* @__PURE__ */ H("ul", {
|
|
592
592
|
role: "menu",
|
|
593
593
|
className: "flex flex-col pb-4",
|
|
594
|
-
children: s.map((e) => /* @__PURE__ */
|
|
594
|
+
children: s.map((e) => /* @__PURE__ */ H("li", {
|
|
595
595
|
role: "none",
|
|
596
|
-
children: /* @__PURE__ */
|
|
596
|
+
children: /* @__PURE__ */ H(l, {
|
|
597
597
|
type: "button",
|
|
598
598
|
role: "menuitemcheckbox",
|
|
599
599
|
"aria-checked": e.isSelected,
|
|
600
600
|
className: "w-full gap-3 px-4 py-[10px] text-start",
|
|
601
|
-
iconBefore: /* @__PURE__ */
|
|
601
|
+
iconBefore: /* @__PURE__ */ H("span", {
|
|
602
602
|
className: "flex items-center text-secondary",
|
|
603
603
|
children: e.icon
|
|
604
604
|
}),
|
|
605
|
-
iconAfter: e.isSelected ? /* @__PURE__ */
|
|
605
|
+
iconAfter: e.isSelected ? /* @__PURE__ */ H("span", {
|
|
606
606
|
className: "ms-auto text-accent-primary",
|
|
607
|
-
children: /* @__PURE__ */
|
|
607
|
+
children: /* @__PURE__ */ H(ie, {
|
|
608
608
|
size: c,
|
|
609
609
|
"aria-hidden": !0
|
|
610
610
|
})
|
|
611
611
|
}) : null,
|
|
612
|
-
label: /* @__PURE__ */
|
|
612
|
+
label: /* @__PURE__ */ H("span", {
|
|
613
613
|
className: "dial-small-text",
|
|
614
614
|
children: e.label
|
|
615
615
|
}),
|
|
@@ -617,180 +617,180 @@ var qe = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
617
617
|
})
|
|
618
618
|
}, e.id))
|
|
619
619
|
})
|
|
620
|
-
}),
|
|
621
|
-
let
|
|
620
|
+
}), qe = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, menuCloseLabel: a, style: o, listClassName: l = "cp-dropdown-overlay !w-[240px]", isDisabled: d = !1, chatSettings: p, extraMenuItems: m, toolsMenuItems: h = [], onToolToggle: g, toolsMenuTitle: _ = "Tools", toolsBackLabel: v = "Back" }) => {
|
|
621
|
+
let y = s(), [b, x] = B(!1), [S, C] = B(!1), [E, D] = B(!1), O = h.length > 0 && g != null, k = R(() => h.map((e) => ({
|
|
622
622
|
key: e.id,
|
|
623
|
-
label: /* @__PURE__ */
|
|
623
|
+
label: /* @__PURE__ */ U("span", {
|
|
624
624
|
className: "flex flex-1 items-center gap-2",
|
|
625
|
-
children: [/* @__PURE__ */
|
|
625
|
+
children: [/* @__PURE__ */ H("span", {
|
|
626
626
|
className: "flex-1",
|
|
627
627
|
children: e.label
|
|
628
|
-
}), e.isSelected && /* @__PURE__ */
|
|
628
|
+
}), e.isSelected && /* @__PURE__ */ H(ie, {
|
|
629
629
|
size: c,
|
|
630
|
-
className: "text-accent
|
|
630
|
+
className: "text-accent",
|
|
631
631
|
"aria-hidden": !0
|
|
632
632
|
})]
|
|
633
633
|
}),
|
|
634
|
-
icon: /* @__PURE__ */
|
|
634
|
+
icon: /* @__PURE__ */ H("span", {
|
|
635
635
|
className: "flex items-center text-secondary",
|
|
636
636
|
children: e.icon
|
|
637
637
|
}),
|
|
638
|
-
onClick: () =>
|
|
639
|
-
})), [
|
|
638
|
+
onClick: () => g?.(e.id)
|
|
639
|
+
})), [h, g]), A = R(() => [
|
|
640
640
|
...e == null ? [] : [{
|
|
641
641
|
key: "attach",
|
|
642
642
|
label: t,
|
|
643
|
-
icon: /* @__PURE__ */
|
|
643
|
+
icon: /* @__PURE__ */ H(se, {
|
|
644
644
|
size: c,
|
|
645
645
|
"aria-hidden": !0
|
|
646
646
|
}),
|
|
647
647
|
onClick: e
|
|
648
648
|
}],
|
|
649
|
-
...
|
|
649
|
+
...m ?? [],
|
|
650
650
|
...O ? [{
|
|
651
651
|
key: "tools",
|
|
652
|
-
label:
|
|
653
|
-
icon: /* @__PURE__ */
|
|
652
|
+
label: _,
|
|
653
|
+
icon: /* @__PURE__ */ H(de, {
|
|
654
654
|
size: c,
|
|
655
655
|
"aria-hidden": !0
|
|
656
656
|
}),
|
|
657
|
-
onClick:
|
|
658
|
-
D(!0),
|
|
657
|
+
onClick: y ? () => {
|
|
658
|
+
D(!0), x(!1);
|
|
659
659
|
} : () => void 0,
|
|
660
|
-
...
|
|
660
|
+
...y ? { iconAfter: /* @__PURE__ */ H(M, {
|
|
661
661
|
size: c,
|
|
662
662
|
stroke: 1.5,
|
|
663
663
|
className: "text-secondary rtl:scale-x-[-1]",
|
|
664
664
|
"aria-hidden": !0
|
|
665
665
|
}) } : { children: k }
|
|
666
666
|
}] : [],
|
|
667
|
-
...
|
|
667
|
+
...p == null ? [] : [{
|
|
668
668
|
key: "chat-settings",
|
|
669
|
-
label:
|
|
670
|
-
icon: /* @__PURE__ */
|
|
669
|
+
label: p.menuItemLabel ?? "Chat settings",
|
|
670
|
+
icon: /* @__PURE__ */ H(ue, {
|
|
671
671
|
size: c,
|
|
672
672
|
"aria-hidden": !0
|
|
673
673
|
}),
|
|
674
|
-
iconAfter:
|
|
674
|
+
iconAfter: y ? /* @__PURE__ */ H(M, {
|
|
675
675
|
size: c,
|
|
676
676
|
stroke: 1.5,
|
|
677
677
|
className: "text-secondary rtl:scale-x-[-1]",
|
|
678
678
|
"aria-hidden": !0
|
|
679
679
|
}) : null,
|
|
680
|
-
onClick: () =>
|
|
680
|
+
onClick: () => C(!0)
|
|
681
681
|
}]
|
|
682
682
|
], [
|
|
683
683
|
t,
|
|
684
684
|
e,
|
|
685
|
+
p,
|
|
685
686
|
m,
|
|
686
|
-
g,
|
|
687
|
-
x,
|
|
688
|
-
O,
|
|
689
687
|
y,
|
|
688
|
+
O,
|
|
689
|
+
_,
|
|
690
690
|
k
|
|
691
691
|
]);
|
|
692
|
-
return A.length === 0 ? null : /* @__PURE__ */ V
|
|
693
|
-
/* @__PURE__ */
|
|
694
|
-
icon: /* @__PURE__ */
|
|
692
|
+
return A.length === 0 ? null : /* @__PURE__ */ H(V, { children: y ? /* @__PURE__ */ U(V, { children: [
|
|
693
|
+
/* @__PURE__ */ H(T, {
|
|
694
|
+
icon: /* @__PURE__ */ H(N, {
|
|
695
695
|
size: u.LG,
|
|
696
696
|
"aria-hidden": !0
|
|
697
697
|
}),
|
|
698
698
|
"aria-label": n,
|
|
699
|
+
size: w.Large,
|
|
699
700
|
tooltipProps: { tooltip: n },
|
|
700
|
-
|
|
701
|
-
onClick: () =>
|
|
701
|
+
disabled: d,
|
|
702
|
+
onClick: () => x(!0)
|
|
702
703
|
}),
|
|
703
|
-
/* @__PURE__ */
|
|
704
|
-
isOpen:
|
|
704
|
+
/* @__PURE__ */ H(Be, {
|
|
705
|
+
isOpen: b,
|
|
705
706
|
title: r,
|
|
706
707
|
closeLabel: a,
|
|
707
|
-
onClose: () =>
|
|
708
|
-
style:
|
|
708
|
+
onClose: () => x(!1),
|
|
709
|
+
style: o,
|
|
709
710
|
items: A,
|
|
710
711
|
className: "pb-4",
|
|
711
712
|
btnTextClassName: "flex-1"
|
|
712
713
|
}),
|
|
713
|
-
O && /* @__PURE__ */
|
|
714
|
+
O && /* @__PURE__ */ H(Ke, {
|
|
714
715
|
isOpen: E,
|
|
715
716
|
onBack: () => {
|
|
716
|
-
D(!1),
|
|
717
|
+
D(!1), x(!0);
|
|
717
718
|
},
|
|
718
|
-
backLabel:
|
|
719
|
+
backLabel: v,
|
|
719
720
|
onClose: () => D(!1),
|
|
720
721
|
closeLabel: a,
|
|
721
|
-
style:
|
|
722
|
-
title:
|
|
723
|
-
items:
|
|
724
|
-
onToolToggle:
|
|
722
|
+
style: o,
|
|
723
|
+
title: _,
|
|
724
|
+
items: h,
|
|
725
|
+
onToolToggle: g
|
|
725
726
|
}),
|
|
726
|
-
|
|
727
|
-
isOpen:
|
|
727
|
+
p != null && /* @__PURE__ */ H(We, {
|
|
728
|
+
isOpen: S,
|
|
728
729
|
onBack: () => {
|
|
729
|
-
|
|
730
|
+
C(!1), x(!0);
|
|
730
731
|
},
|
|
731
|
-
backLabel:
|
|
732
|
-
onClose: () =>
|
|
732
|
+
backLabel: p.backLabel ?? "Back",
|
|
733
|
+
onClose: () => C(!1),
|
|
733
734
|
closeLabel: a,
|
|
734
|
-
style:
|
|
735
|
-
features:
|
|
736
|
-
initialResponseFormat:
|
|
737
|
-
initialSystemPrompt:
|
|
738
|
-
initialTemperature:
|
|
739
|
-
onSave:
|
|
740
|
-
title:
|
|
741
|
-
responseFormatLabel:
|
|
742
|
-
responseFormatHint:
|
|
743
|
-
responseFormatMarkdownLabel:
|
|
744
|
-
responseFormatPlainTextLabel:
|
|
745
|
-
systemPromptLabel:
|
|
746
|
-
systemPromptTooltip:
|
|
747
|
-
temperatureLabel:
|
|
748
|
-
temperatureLabels:
|
|
749
|
-
temperatureHint:
|
|
750
|
-
saveLabel:
|
|
751
|
-
saveDisabledTooltip:
|
|
735
|
+
style: o,
|
|
736
|
+
features: p.features,
|
|
737
|
+
initialResponseFormat: p.responseFormat ?? i.Markdown,
|
|
738
|
+
initialSystemPrompt: p.systemPrompt,
|
|
739
|
+
initialTemperature: p.temperature,
|
|
740
|
+
onSave: p.onSave,
|
|
741
|
+
title: p.title,
|
|
742
|
+
responseFormatLabel: p.responseFormatLabel,
|
|
743
|
+
responseFormatHint: p.responseFormatHint,
|
|
744
|
+
responseFormatMarkdownLabel: p.responseFormatMarkdownLabel,
|
|
745
|
+
responseFormatPlainTextLabel: p.responseFormatPlainTextLabel,
|
|
746
|
+
systemPromptLabel: p.systemPromptLabel,
|
|
747
|
+
systemPromptTooltip: p.systemPromptTooltip,
|
|
748
|
+
temperatureLabel: p.temperatureLabel,
|
|
749
|
+
temperatureLabels: p.temperatureLabels,
|
|
750
|
+
temperatureHint: p.temperatureHint,
|
|
751
|
+
saveLabel: p.saveLabel,
|
|
752
|
+
saveDisabledTooltip: p.saveDisabledTooltip
|
|
752
753
|
})
|
|
753
|
-
] }) : /* @__PURE__ */
|
|
754
|
+
] }) : /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(f, {
|
|
754
755
|
matchReferenceWidth: !1,
|
|
755
756
|
placement: "bottom-start",
|
|
756
|
-
listClassName:
|
|
757
|
+
listClassName: l,
|
|
757
758
|
items: A,
|
|
758
|
-
children: /* @__PURE__ */
|
|
759
|
-
icon: /* @__PURE__ */
|
|
759
|
+
children: /* @__PURE__ */ H(T, {
|
|
760
|
+
icon: /* @__PURE__ */ H(N, {
|
|
760
761
|
size: u.LG,
|
|
761
762
|
"aria-hidden": !0
|
|
762
763
|
}),
|
|
763
764
|
"aria-label": n,
|
|
764
765
|
tooltipProps: { tooltip: n },
|
|
765
|
-
|
|
766
|
-
disabled: p
|
|
766
|
+
disabled: d
|
|
767
767
|
})
|
|
768
|
-
}),
|
|
769
|
-
features:
|
|
770
|
-
initialResponseFormat:
|
|
771
|
-
initialSystemPrompt:
|
|
772
|
-
initialTemperature:
|
|
773
|
-
onSave:
|
|
774
|
-
onClose: () =>
|
|
775
|
-
title:
|
|
776
|
-
responseFormatLabel:
|
|
777
|
-
responseFormatHint:
|
|
778
|
-
responseFormatMarkdownLabel:
|
|
779
|
-
responseFormatPlainTextLabel:
|
|
780
|
-
systemPromptLabel:
|
|
781
|
-
systemPromptTooltip:
|
|
782
|
-
temperatureLabel:
|
|
783
|
-
temperatureLabels:
|
|
784
|
-
temperatureHint:
|
|
785
|
-
saveLabel:
|
|
786
|
-
saveDisabledTooltip:
|
|
768
|
+
}), p != null && S && /* @__PURE__ */ H(Ge, {
|
|
769
|
+
features: p.features,
|
|
770
|
+
initialResponseFormat: p.responseFormat ?? i.Markdown,
|
|
771
|
+
initialSystemPrompt: p.systemPrompt,
|
|
772
|
+
initialTemperature: p.temperature,
|
|
773
|
+
onSave: p.onSave,
|
|
774
|
+
onClose: () => C(!1),
|
|
775
|
+
title: p.title,
|
|
776
|
+
responseFormatLabel: p.responseFormatLabel,
|
|
777
|
+
responseFormatHint: p.responseFormatHint,
|
|
778
|
+
responseFormatMarkdownLabel: p.responseFormatMarkdownLabel,
|
|
779
|
+
responseFormatPlainTextLabel: p.responseFormatPlainTextLabel,
|
|
780
|
+
systemPromptLabel: p.systemPromptLabel,
|
|
781
|
+
systemPromptTooltip: p.systemPromptTooltip,
|
|
782
|
+
temperatureLabel: p.temperatureLabel,
|
|
783
|
+
temperatureLabels: p.temperatureLabels,
|
|
784
|
+
temperatureHint: p.temperatureHint,
|
|
785
|
+
saveLabel: p.saveLabel,
|
|
786
|
+
saveDisabledTooltip: p.saveDisabledTooltip
|
|
787
787
|
})] }) });
|
|
788
788
|
}, G = {
|
|
789
789
|
chip: "_chip_1gvzk_1",
|
|
790
790
|
chipIcon: "_chipIcon_1gvzk_6",
|
|
791
791
|
chipText: "_chipText_1gvzk_10",
|
|
792
792
|
chipClose: "_chipClose_1gvzk_14"
|
|
793
|
-
},
|
|
793
|
+
}, Je = (e) => `${e} tool${e === 1 ? "" : "s"}`, Ye = (e) => `Remove ${e}`, Xe = ({ items: e, onToolToggle: t, isMobile: n, countLabel: r = Je, removeLabel: i = Ye, typography: s, colors: l }) => {
|
|
794
794
|
let u = e.filter((e) => e.isSelected);
|
|
795
795
|
if (u.length === 0) return null;
|
|
796
796
|
let d = a({
|
|
@@ -802,47 +802,47 @@ var qe = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
802
802
|
"--ci-chip-close-hover": l?.chipCloseHover
|
|
803
803
|
});
|
|
804
804
|
if (n) {
|
|
805
|
-
let e = u.length === 1 ? u[0].icon : /* @__PURE__ */
|
|
805
|
+
let e = u.length === 1 ? u[0].icon : /* @__PURE__ */ H(de, {
|
|
806
806
|
size: c,
|
|
807
807
|
"aria-hidden": !0
|
|
808
808
|
});
|
|
809
|
-
return /* @__PURE__ */
|
|
809
|
+
return /* @__PURE__ */ H("div", {
|
|
810
810
|
className: "flex flex-wrap items-center gap-2",
|
|
811
811
|
style: d,
|
|
812
|
-
children: /* @__PURE__ */
|
|
812
|
+
children: /* @__PURE__ */ U("div", {
|
|
813
813
|
className: o(G.chip, "flex items-center gap-1.5 rounded-full border px-2 py-1"),
|
|
814
|
-
children: [/* @__PURE__ */
|
|
814
|
+
children: [/* @__PURE__ */ H("span", {
|
|
815
815
|
className: G.chipIcon,
|
|
816
816
|
"aria-hidden": !0,
|
|
817
817
|
children: e
|
|
818
|
-
}), /* @__PURE__ */
|
|
818
|
+
}), /* @__PURE__ */ H("span", {
|
|
819
819
|
className: o(G.chipText, s?.fontClassName || "dial-small-paragraph-text"),
|
|
820
820
|
children: r(u.length)
|
|
821
821
|
})]
|
|
822
822
|
})
|
|
823
823
|
});
|
|
824
824
|
}
|
|
825
|
-
return /* @__PURE__ */
|
|
825
|
+
return /* @__PURE__ */ H("div", {
|
|
826
826
|
className: "flex flex-wrap items-center gap-2",
|
|
827
827
|
style: d,
|
|
828
|
-
children: u.map((e) => /* @__PURE__ */
|
|
828
|
+
children: u.map((e) => /* @__PURE__ */ U("div", {
|
|
829
829
|
className: o(G.chip, "flex items-center gap-1.5 rounded-full border py-1 pe-1 ps-2"),
|
|
830
830
|
children: [
|
|
831
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ H("span", {
|
|
832
832
|
className: G.chipIcon,
|
|
833
833
|
"aria-hidden": !0,
|
|
834
834
|
children: e.icon
|
|
835
835
|
}),
|
|
836
|
-
/* @__PURE__ */
|
|
836
|
+
/* @__PURE__ */ H("span", {
|
|
837
837
|
className: o(G.chipText, s?.fontClassName || "dial-small-paragraph-text"),
|
|
838
838
|
children: e.label
|
|
839
839
|
}),
|
|
840
|
-
/* @__PURE__ */
|
|
840
|
+
/* @__PURE__ */ H("button", {
|
|
841
841
|
type: "button",
|
|
842
842
|
onClick: () => t(e.id),
|
|
843
843
|
className: o(G.chipClose, "flex items-center rounded p-0.5 transition-colors"),
|
|
844
844
|
"aria-label": i(e.label),
|
|
845
|
-
children: /* @__PURE__ */
|
|
845
|
+
children: /* @__PURE__ */ H(fe, {
|
|
846
846
|
size: 12,
|
|
847
847
|
"aria-hidden": !0
|
|
848
848
|
})
|
|
@@ -850,43 +850,43 @@ var qe = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
850
850
|
]
|
|
851
851
|
}, e.id))
|
|
852
852
|
});
|
|
853
|
-
},
|
|
853
|
+
}, K = {
|
|
854
854
|
wrapper: "_wrapper_4e8i8_1",
|
|
855
855
|
wrapperDisabled: "_wrapperDisabled_4e8i8_8",
|
|
856
856
|
textarea: "_textarea_4e8i8_13",
|
|
857
857
|
modelSelectorButton: "_modelSelectorButton_4e8i8_24",
|
|
858
858
|
modelSelectorCaret: "_modelSelectorCaret_4e8i8_24",
|
|
859
859
|
modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_4e8i8_33"
|
|
860
|
-
},
|
|
860
|
+
}, q = {
|
|
861
861
|
wrapperError: "_wrapperError_5wiyg_1",
|
|
862
862
|
waveformCanvas: "_waveformCanvas_5wiyg_5",
|
|
863
863
|
timer: "_timer_5wiyg_9",
|
|
864
864
|
stopRecordingIcon: "_stopRecordingIcon_5wiyg_15",
|
|
865
865
|
recordingDot: "_recordingDot_5wiyg_29",
|
|
866
866
|
"recording-pulse": "_recording-pulse_5wiyg_1"
|
|
867
|
-
},
|
|
868
|
-
let p =
|
|
867
|
+
}, J = 3, Ze = 4, Y = 200, X = (e) => `${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`, Qe = ({ 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 }) => {
|
|
868
|
+
let p = z(null), h = z(new Float32Array(Y)), g = z(0), _ = z(0), v = e === Pe.Recording, y = e === Pe.Error, b = I((e) => {
|
|
869
869
|
let t = e.getContext("2d");
|
|
870
870
|
if (!t) return;
|
|
871
871
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
872
872
|
let { width: n, height: r } = e;
|
|
873
873
|
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
874
|
-
let i = Math.min(Math.max(1, Math.floor(n /
|
|
874
|
+
let i = Math.min(Math.max(1, Math.floor(n / Ze)), Y - 1), a = g.current, o = _.current;
|
|
875
875
|
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
876
876
|
for (let e = 0; e <= i; e++) {
|
|
877
877
|
let n = ((a - i + e) % Y + Y) % Y, o = h.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
878
|
-
t.fillRect(e *
|
|
878
|
+
t.fillRect(e * Ze, (r - c) / 2, J, c);
|
|
879
879
|
}
|
|
880
880
|
t.restore();
|
|
881
881
|
}, []);
|
|
882
|
-
|
|
882
|
+
L(() => {
|
|
883
883
|
if (!v) return;
|
|
884
884
|
let e = p.current;
|
|
885
885
|
if (!e) return;
|
|
886
886
|
h.current.fill(0), g.current = 0, _.current = 0;
|
|
887
887
|
let n, r = () => {
|
|
888
|
-
if (_.current += 1, _.current >=
|
|
889
|
-
_.current -=
|
|
888
|
+
if (_.current += 1, _.current >= Ze) {
|
|
889
|
+
_.current -= Ze;
|
|
890
890
|
let e = t.current;
|
|
891
891
|
if (e) {
|
|
892
892
|
let t = new Uint8Array(e.frequencyBinCount);
|
|
@@ -908,7 +908,7 @@ var qe = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
908
908
|
v,
|
|
909
909
|
t,
|
|
910
910
|
b
|
|
911
|
-
]),
|
|
911
|
+
]), L(() => {
|
|
912
912
|
let e = p.current;
|
|
913
913
|
if (!e) return;
|
|
914
914
|
let t = new ResizeObserver(() => {
|
|
@@ -916,154 +916,154 @@ var qe = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
916
916
|
});
|
|
917
917
|
return t.observe(e), () => t.disconnect();
|
|
918
918
|
}, [b]);
|
|
919
|
-
let x = /* @__PURE__ */
|
|
919
|
+
let x = /* @__PURE__ */ U("div", {
|
|
920
920
|
className: "flex flex-shrink-0 items-center justify-end gap-1",
|
|
921
|
-
children: [/* @__PURE__ */
|
|
922
|
-
icon: /* @__PURE__ */
|
|
921
|
+
children: [/* @__PURE__ */ H(T, {
|
|
922
|
+
icon: /* @__PURE__ */ H(fe, {
|
|
923
923
|
size: u.LG,
|
|
924
924
|
"aria-hidden": !0
|
|
925
925
|
}),
|
|
926
926
|
"aria-label": c,
|
|
927
927
|
onClick: a
|
|
928
|
-
}), v && /* @__PURE__ */
|
|
929
|
-
icon: /* @__PURE__ */
|
|
928
|
+
}), v && /* @__PURE__ */ H(A, {
|
|
929
|
+
icon: /* @__PURE__ */ H(ce, { size: u.LG }),
|
|
930
930
|
onClick: () => i?.(),
|
|
931
931
|
"aria-label": s
|
|
932
932
|
})]
|
|
933
933
|
});
|
|
934
|
-
return /* @__PURE__ */
|
|
934
|
+
return /* @__PURE__ */ U("div", {
|
|
935
935
|
className: f,
|
|
936
|
-
children: [/* @__PURE__ */
|
|
936
|
+
children: [/* @__PURE__ */ U("div", {
|
|
937
937
|
style: d,
|
|
938
|
-
className: o(
|
|
939
|
-
children: [/* @__PURE__ */
|
|
938
|
+
className: o(K.wrapper, "flex min-h-[64px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border px-3 shadow-md desktop:flex-row desktop:items-center desktop:gap-2 desktop:py-2", y && q.wrapperError),
|
|
939
|
+
children: [/* @__PURE__ */ U("div", {
|
|
940
940
|
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
941
|
-
children: [v && /* @__PURE__ */
|
|
942
|
-
className: o(
|
|
941
|
+
children: [v && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("span", {
|
|
942
|
+
className: o(q.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
|
|
943
943
|
"aria-hidden": !0
|
|
944
|
-
}), /* @__PURE__ */
|
|
945
|
-
className: o(
|
|
944
|
+
}), /* @__PURE__ */ H("span", {
|
|
945
|
+
className: o(q.timer, "flex-shrink-0"),
|
|
946
946
|
"aria-label": l,
|
|
947
|
-
children:
|
|
948
|
-
})] }), /* @__PURE__ */
|
|
947
|
+
children: X(n)
|
|
948
|
+
})] }), /* @__PURE__ */ H("canvas", {
|
|
949
949
|
ref: p,
|
|
950
950
|
height: 32,
|
|
951
|
-
className: o(
|
|
951
|
+
className: o(q.waveformCanvas, "h-8 min-w-0 flex-1 desktop:h-6")
|
|
952
952
|
})]
|
|
953
953
|
}), x]
|
|
954
|
-
}), y && r && /* @__PURE__ */
|
|
954
|
+
}), y && r && /* @__PURE__ */ H(m, {
|
|
955
955
|
text: r,
|
|
956
956
|
className: "mt-1 px-1"
|
|
957
957
|
})]
|
|
958
958
|
});
|
|
959
|
-
},
|
|
959
|
+
}, $e = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", isExiting: r = !1 }) => /* @__PURE__ */ H(A, {
|
|
960
960
|
"aria-label": n,
|
|
961
961
|
onClick: () => e?.(),
|
|
962
962
|
disabled: t,
|
|
963
963
|
"aria-hidden": r,
|
|
964
|
-
icon: /* @__PURE__ */
|
|
964
|
+
icon: /* @__PURE__ */ H(re, {
|
|
965
965
|
size: u.LG,
|
|
966
966
|
className: "rtl:scale-x-[-1]"
|
|
967
967
|
})
|
|
968
|
-
}),
|
|
969
|
-
icon: /* @__PURE__ */
|
|
968
|
+
}), et = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ H(te, {
|
|
969
|
+
icon: /* @__PURE__ */ H(le, { size: u.LG }),
|
|
970
970
|
onClick: () => e?.(),
|
|
971
971
|
"aria-label": t
|
|
972
|
-
}),
|
|
972
|
+
}), tt = ({ gradientId: e = "gradient-check-icon" }) => /* @__PURE__ */ U("svg", {
|
|
973
973
|
width: u.SM,
|
|
974
974
|
height: u.SM,
|
|
975
975
|
viewBox: "0 0 24 24",
|
|
976
976
|
fill: "none",
|
|
977
977
|
"aria-hidden": !0,
|
|
978
|
-
children: [/* @__PURE__ */
|
|
978
|
+
children: [/* @__PURE__ */ H("defs", { children: /* @__PURE__ */ U("linearGradient", {
|
|
979
979
|
id: e,
|
|
980
980
|
x1: "0",
|
|
981
981
|
y1: "0",
|
|
982
982
|
x2: "24",
|
|
983
983
|
y2: "24",
|
|
984
984
|
gradientUnits: "userSpaceOnUse",
|
|
985
|
-
children: [/* @__PURE__ */
|
|
985
|
+
children: [/* @__PURE__ */ H("stop", {
|
|
986
986
|
offset: "0%",
|
|
987
987
|
stopColor: "#4b7be6"
|
|
988
|
-
}), /* @__PURE__ */
|
|
988
|
+
}), /* @__PURE__ */ H("stop", {
|
|
989
989
|
offset: "100%",
|
|
990
990
|
stopColor: "#9355f4"
|
|
991
991
|
})]
|
|
992
|
-
}) }), /* @__PURE__ */
|
|
992
|
+
}) }), /* @__PURE__ */ H("path", {
|
|
993
993
|
d: "M5 12l5 5L20 7",
|
|
994
994
|
stroke: `url(#${e})`,
|
|
995
995
|
strokeWidth: "2",
|
|
996
996
|
strokeLinecap: "round",
|
|
997
997
|
strokeLinejoin: "round"
|
|
998
998
|
})]
|
|
999
|
-
}),
|
|
999
|
+
}), nt = {
|
|
1000
1000
|
tabContainer: "_tabContainer_153ct_1",
|
|
1001
1001
|
tabActive: "_tabActive_153ct_13"
|
|
1002
1002
|
};
|
|
1003
|
-
|
|
1003
|
+
F(({ tabs: e, activeTabId: t, onTabChange: n, styles: r }) => {
|
|
1004
1004
|
let { tabClassName: i = "dial-tiny-semi-text" } = r?.typography ?? {};
|
|
1005
|
-
return /* @__PURE__ */
|
|
1005
|
+
return /* @__PURE__ */ H("div", {
|
|
1006
1006
|
className: "flex flex-nowrap gap-1",
|
|
1007
1007
|
role: "tablist",
|
|
1008
1008
|
children: e.map((e) => {
|
|
1009
1009
|
let r = t === e.id;
|
|
1010
|
-
return /* @__PURE__ */
|
|
1010
|
+
return /* @__PURE__ */ H("div", {
|
|
1011
1011
|
role: "tab",
|
|
1012
1012
|
"aria-selected": r,
|
|
1013
1013
|
className: "contents",
|
|
1014
|
-
children: /* @__PURE__ */
|
|
1014
|
+
children: /* @__PURE__ */ H(S, {
|
|
1015
1015
|
label: e.label,
|
|
1016
1016
|
selected: r,
|
|
1017
1017
|
onClick: () => n(e.id),
|
|
1018
|
-
className: o("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i,
|
|
1018
|
+
className: o("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i, nt.tabContainer, r && nt.tabActive)
|
|
1019
1019
|
})
|
|
1020
1020
|
}, e.id);
|
|
1021
1021
|
})
|
|
1022
1022
|
});
|
|
1023
1023
|
});
|
|
1024
|
-
var
|
|
1025
|
-
variant:
|
|
1024
|
+
var rt = ({ size: e = 20 }) => /* @__PURE__ */ H(y, {
|
|
1025
|
+
variant: b.Circular,
|
|
1026
1026
|
width: e,
|
|
1027
1027
|
height: e,
|
|
1028
1028
|
active: !0
|
|
1029
|
-
}),
|
|
1029
|
+
}), it = ({ loadingLabel: e }) => /* @__PURE__ */ U("span", {
|
|
1030
1030
|
className: "flex min-w-0 flex-1 items-center",
|
|
1031
|
-
children: [/* @__PURE__ */
|
|
1032
|
-
variant:
|
|
1031
|
+
children: [/* @__PURE__ */ H(y, {
|
|
1032
|
+
variant: b.Text,
|
|
1033
1033
|
width: "100%",
|
|
1034
1034
|
height: 16,
|
|
1035
1035
|
active: !0
|
|
1036
|
-
}), e && /* @__PURE__ */
|
|
1036
|
+
}), e && /* @__PURE__ */ H("span", {
|
|
1037
1037
|
className: "sr-only",
|
|
1038
1038
|
children: e
|
|
1039
1039
|
})]
|
|
1040
|
-
}),
|
|
1040
|
+
}), at = ({ loadingLabel: e }) => /* @__PURE__ */ H("div", {
|
|
1041
1041
|
role: "status",
|
|
1042
1042
|
"aria-label": e,
|
|
1043
|
-
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */
|
|
1043
|
+
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ U("div", {
|
|
1044
1044
|
className: "flex h-11 items-center gap-3 px-4",
|
|
1045
1045
|
"aria-hidden": "true",
|
|
1046
|
-
children: [/* @__PURE__ */
|
|
1046
|
+
children: [/* @__PURE__ */ H(rt, {}), /* @__PURE__ */ H(it, {})]
|
|
1047
1047
|
}, t))
|
|
1048
|
-
}),
|
|
1048
|
+
}), ot = (e) => e.displayName ?? e.id, st = (e, t) => {
|
|
1049
1049
|
let n = t.trim().toLowerCase();
|
|
1050
|
-
return n ? e.filter((e) =>
|
|
1051
|
-
},
|
|
1050
|
+
return n ? e.filter((e) => ot(e).toLowerCase().includes(n)) : e;
|
|
1051
|
+
}, ct = (e, t, r, i = 18, a) => /* @__PURE__ */ H(n, {
|
|
1052
1052
|
src: e,
|
|
1053
1053
|
size: i,
|
|
1054
1054
|
labels: { tooltip: a },
|
|
1055
1055
|
initialsName: r
|
|
1056
|
-
}),
|
|
1057
|
-
let [a, s] =
|
|
1056
|
+
}), lt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, searchHeaderClassName: i = "bg-layer-0" }) => {
|
|
1057
|
+
let [a, s] = B(""), c = R(() => e?.find((e) => e.id === t), [e, t]), l = r?.loading !== void 0, d = R(() => l ? /* @__PURE__ */ H(rt, { size: u.LG }) : ct(c?.iconUrl, c?.type, c?.displayName ?? c?.id ?? "", u.LG), [l, c]), f = c?.displayName ?? c?.id;
|
|
1058
1058
|
return {
|
|
1059
1059
|
selectorIcon: d,
|
|
1060
1060
|
selectorAriaLabel: f ? `${r?.ariaLabel ?? "Select model"}: ${f}` : r?.ariaLabel ?? "Select model",
|
|
1061
1061
|
selectedLabel: f,
|
|
1062
|
-
menuItems:
|
|
1062
|
+
menuItems: R(() => {
|
|
1063
1063
|
if (l) return Array.from({ length: 7 }, (e, t) => ({
|
|
1064
1064
|
key: `__loading-${t}`,
|
|
1065
|
-
icon: /* @__PURE__ */
|
|
1066
|
-
label: /* @__PURE__ */
|
|
1065
|
+
icon: /* @__PURE__ */ H(rt, {}),
|
|
1066
|
+
label: /* @__PURE__ */ H(it, { loadingLabel: t === 0 ? r?.loading : void 0 }),
|
|
1067
1067
|
disabled: !0
|
|
1068
1068
|
}));
|
|
1069
1069
|
if (!e || e.length === 0) {
|
|
@@ -1074,19 +1074,19 @@ var at = ({ size: e = 20 }) => /* @__PURE__ */ V(b, {
|
|
|
1074
1074
|
disabled: !0
|
|
1075
1075
|
}] : [];
|
|
1076
1076
|
}
|
|
1077
|
-
return
|
|
1077
|
+
return st(e, a).map((e) => {
|
|
1078
1078
|
let r = e.id === t;
|
|
1079
1079
|
return {
|
|
1080
1080
|
key: e.id,
|
|
1081
|
-
label: /* @__PURE__ */
|
|
1081
|
+
label: /* @__PURE__ */ U("span", {
|
|
1082
1082
|
className: "flex w-full items-center justify-between gap-2",
|
|
1083
|
-
children: [/* @__PURE__ */
|
|
1084
|
-
text:
|
|
1083
|
+
children: [/* @__PURE__ */ H(E, {
|
|
1084
|
+
text: ot(e),
|
|
1085
1085
|
query: a,
|
|
1086
1086
|
maxLines: 1
|
|
1087
|
-
}), r && /* @__PURE__ */
|
|
1087
|
+
}), r && /* @__PURE__ */ H(tt, { gradientId: "ms-check-grad" })]
|
|
1088
1088
|
}),
|
|
1089
|
-
icon:
|
|
1089
|
+
icon: ct(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
1090
1090
|
onClick: () => n?.(e.id),
|
|
1091
1091
|
className: r ? "bg-accent-primary-alpha" : void 0
|
|
1092
1092
|
};
|
|
@@ -1099,12 +1099,12 @@ var at = ({ size: e = 20 }) => /* @__PURE__ */ V(b, {
|
|
|
1099
1099
|
r,
|
|
1100
1100
|
n
|
|
1101
1101
|
]),
|
|
1102
|
-
menuHeader:
|
|
1102
|
+
menuHeader: R(() => !l && e && e.length > 0 ? /* @__PURE__ */ H("div", {
|
|
1103
1103
|
className: o("sticky top-0 z-10 pb-1 pe-2 pt-2", i),
|
|
1104
|
-
children: /* @__PURE__ */
|
|
1104
|
+
children: /* @__PURE__ */ H(v, {
|
|
1105
1105
|
value: a,
|
|
1106
1106
|
placeholder: r?.searchPlaceholder ?? "Search",
|
|
1107
|
-
size:
|
|
1107
|
+
size: w.Small,
|
|
1108
1108
|
wrapperClassName: "border-0",
|
|
1109
1109
|
onChange: s
|
|
1110
1110
|
})
|
|
@@ -1119,8 +1119,8 @@ var at = ({ size: e = 20 }) => /* @__PURE__ */ V(b, {
|
|
|
1119
1119
|
e || s("");
|
|
1120
1120
|
}
|
|
1121
1121
|
};
|
|
1122
|
-
},
|
|
1123
|
-
function
|
|
1122
|
+
}, ut = typeof window < "u" ? he : L;
|
|
1123
|
+
function dt(e) {
|
|
1124
1124
|
if (e !== void 0) switch (typeof e) {
|
|
1125
1125
|
case "number": return e;
|
|
1126
1126
|
case "string":
|
|
@@ -1128,15 +1128,15 @@ function pt(e) {
|
|
|
1128
1128
|
break;
|
|
1129
1129
|
}
|
|
1130
1130
|
}
|
|
1131
|
-
function
|
|
1132
|
-
let { styleHeight: s, styleWidth: c } =
|
|
1133
|
-
styleHeight:
|
|
1134
|
-
styleWidth:
|
|
1135
|
-
}), [o?.height, o?.width]), [l, u] =
|
|
1131
|
+
function ft({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
1132
|
+
let { styleHeight: s, styleWidth: c } = R(() => ({
|
|
1133
|
+
styleHeight: dt(o?.height),
|
|
1134
|
+
styleWidth: dt(o?.width)
|
|
1135
|
+
}), [o?.height, o?.width]), [l, u] = B({
|
|
1136
1136
|
height: t,
|
|
1137
1137
|
width: n
|
|
1138
1138
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
1139
|
-
return
|
|
1139
|
+
return ut(() => {
|
|
1140
1140
|
if (i === null || d) return;
|
|
1141
1141
|
let t = new ResizeObserver((e) => {
|
|
1142
1142
|
for (let t of e) {
|
|
@@ -1156,7 +1156,7 @@ function mt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1156
1156
|
i,
|
|
1157
1157
|
s,
|
|
1158
1158
|
c
|
|
1159
|
-
]),
|
|
1159
|
+
]), R(() => ({
|
|
1160
1160
|
height: s ?? l.height,
|
|
1161
1161
|
width: c ?? l.width
|
|
1162
1162
|
}), [
|
|
@@ -1165,26 +1165,26 @@ function mt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1165
1165
|
c
|
|
1166
1166
|
]);
|
|
1167
1167
|
}
|
|
1168
|
-
function
|
|
1169
|
-
let t =
|
|
1168
|
+
function pt(e) {
|
|
1169
|
+
let t = z(() => {
|
|
1170
1170
|
throw Error("Cannot call during render.");
|
|
1171
1171
|
});
|
|
1172
|
-
return
|
|
1172
|
+
return ut(() => {
|
|
1173
1173
|
t.current = e;
|
|
1174
|
-
}, [e]),
|
|
1174
|
+
}, [e]), I((e) => t.current?.(e), [t]);
|
|
1175
1175
|
}
|
|
1176
|
-
var
|
|
1177
|
-
function
|
|
1178
|
-
if (
|
|
1176
|
+
var mt = null;
|
|
1177
|
+
function ht(e = !1) {
|
|
1178
|
+
if (mt === null || e) {
|
|
1179
1179
|
let e = document.createElement("div"), t = e.style;
|
|
1180
1180
|
t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
|
|
1181
1181
|
let n = document.createElement("div"), r = n.style;
|
|
1182
|
-
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ?
|
|
1182
|
+
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? mt = "positive-descending" : (e.scrollLeft = 1, mt = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), mt;
|
|
1183
1183
|
}
|
|
1184
|
-
return
|
|
1184
|
+
return mt;
|
|
1185
1185
|
}
|
|
1186
|
-
function
|
|
1187
|
-
if (t === "horizontal" && n) switch (
|
|
1186
|
+
function gt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1187
|
+
if (t === "horizontal" && n) switch (ht()) {
|
|
1188
1188
|
case "negative": return -r;
|
|
1189
1189
|
case "positive-descending":
|
|
1190
1190
|
if (e) {
|
|
@@ -1198,7 +1198,7 @@ function _t({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
|
1198
1198
|
function Z(e, t = "Assertion error") {
|
|
1199
1199
|
if (!e) throw console.error(t), Error(t);
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1201
|
+
function _t(e, t) {
|
|
1202
1202
|
if (e === t) return !0;
|
|
1203
1203
|
if (!!e != !!t || (Z(e !== void 0), Z(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1204
1204
|
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
@@ -1283,7 +1283,7 @@ function xt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1283
1283
|
};
|
|
1284
1284
|
}
|
|
1285
1285
|
function St({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1286
|
-
return
|
|
1286
|
+
return R(() => xt({
|
|
1287
1287
|
itemCount: e,
|
|
1288
1288
|
itemProps: t,
|
|
1289
1289
|
itemSize: n
|
|
@@ -1293,7 +1293,7 @@ function St({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1293
1293
|
n
|
|
1294
1294
|
]);
|
|
1295
1295
|
}
|
|
1296
|
-
function
|
|
1296
|
+
function Ct({ containerSize: e, itemSize: t }) {
|
|
1297
1297
|
let n;
|
|
1298
1298
|
switch (typeof t) {
|
|
1299
1299
|
case "string":
|
|
@@ -1305,21 +1305,21 @@ function $({ containerSize: e, itemSize: t }) {
|
|
|
1305
1305
|
}
|
|
1306
1306
|
return n;
|
|
1307
1307
|
}
|
|
1308
|
-
function
|
|
1309
|
-
let { height: u = n, width: d = n } =
|
|
1308
|
+
function Q({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
|
|
1309
|
+
let { height: u = n, width: d = n } = ft({
|
|
1310
1310
|
defaultHeight: r === "vertical" ? n : void 0,
|
|
1311
1311
|
defaultWidth: r === "horizontal" ? n : void 0,
|
|
1312
1312
|
element: e,
|
|
1313
1313
|
mode: r === "vertical" ? "only-height" : "only-width",
|
|
1314
1314
|
style: t
|
|
1315
|
-
}), f =
|
|
1315
|
+
}), f = z({
|
|
1316
1316
|
height: 0,
|
|
1317
1317
|
width: 0
|
|
1318
|
-
}), p = r === "vertical" ? u : d, m =
|
|
1318
|
+
}), p = r === "vertical" ? u : d, m = Ct({
|
|
1319
1319
|
containerSize: p,
|
|
1320
1320
|
itemSize: s
|
|
1321
1321
|
});
|
|
1322
|
-
|
|
1322
|
+
he(() => {
|
|
1323
1323
|
if (typeof c == "function") {
|
|
1324
1324
|
let e = f.current;
|
|
1325
1325
|
(e.height !== u || e.width !== d) && (c({
|
|
@@ -1336,7 +1336,7 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1336
1336
|
itemCount: a,
|
|
1337
1337
|
itemProps: o,
|
|
1338
1338
|
itemSize: m
|
|
1339
|
-
}), g =
|
|
1339
|
+
}), g = I((e) => h.get(e), [h]), [_, v] = B(() => bt({
|
|
1340
1340
|
cachedBounds: h,
|
|
1341
1341
|
containerScrollOffset: 0,
|
|
1342
1342
|
containerSize: p,
|
|
@@ -1347,7 +1347,7 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1347
1347
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1348
1348
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1349
1349
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1350
|
-
}, C =
|
|
1350
|
+
}, C = I(() => vt({
|
|
1351
1351
|
cachedBounds: h,
|
|
1352
1352
|
itemCount: a,
|
|
1353
1353
|
itemSize: m
|
|
@@ -1355,9 +1355,9 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1355
1355
|
h,
|
|
1356
1356
|
a,
|
|
1357
1357
|
m
|
|
1358
|
-
]), w =
|
|
1358
|
+
]), w = I((t) => bt({
|
|
1359
1359
|
cachedBounds: h,
|
|
1360
|
-
containerScrollOffset:
|
|
1360
|
+
containerScrollOffset: gt({
|
|
1361
1361
|
containerElement: e,
|
|
1362
1362
|
direction: r,
|
|
1363
1363
|
isRtl: i,
|
|
@@ -1375,19 +1375,19 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1375
1375
|
a,
|
|
1376
1376
|
l
|
|
1377
1377
|
]);
|
|
1378
|
-
return
|
|
1378
|
+
return ut(() => {
|
|
1379
1379
|
v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
|
|
1380
1380
|
}, [
|
|
1381
1381
|
e,
|
|
1382
1382
|
r,
|
|
1383
1383
|
w
|
|
1384
|
-
]),
|
|
1384
|
+
]), ut(() => {
|
|
1385
1385
|
if (!e) return;
|
|
1386
1386
|
let t = () => {
|
|
1387
1387
|
v((t) => {
|
|
1388
1388
|
let { scrollLeft: n, scrollTop: o } = e, s = bt({
|
|
1389
1389
|
cachedBounds: h,
|
|
1390
|
-
containerScrollOffset:
|
|
1390
|
+
containerScrollOffset: gt({
|
|
1391
1391
|
containerElement: e,
|
|
1392
1392
|
direction: r,
|
|
1393
1393
|
isRtl: i,
|
|
@@ -1397,7 +1397,7 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1397
1397
|
itemCount: a,
|
|
1398
1398
|
overscanCount: l
|
|
1399
1399
|
});
|
|
1400
|
-
return
|
|
1400
|
+
return _t(s, t) ? t : s;
|
|
1401
1401
|
});
|
|
1402
1402
|
};
|
|
1403
1403
|
return e.addEventListener("scroll", t), () => {
|
|
@@ -1413,7 +1413,7 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1413
1413
|
]), {
|
|
1414
1414
|
getCellBounds: g,
|
|
1415
1415
|
getEstimatedSize: C,
|
|
1416
|
-
scrollToIndex:
|
|
1416
|
+
scrollToIndex: pt(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
|
|
1417
1417
|
let s = yt({
|
|
1418
1418
|
align: t,
|
|
1419
1419
|
cachedBounds: h,
|
|
@@ -1424,14 +1424,14 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1424
1424
|
itemSize: m
|
|
1425
1425
|
});
|
|
1426
1426
|
if (e) {
|
|
1427
|
-
if (s =
|
|
1427
|
+
if (s = gt({
|
|
1428
1428
|
containerElement: e,
|
|
1429
1429
|
direction: r,
|
|
1430
1430
|
isRtl: i,
|
|
1431
1431
|
scrollOffset: s
|
|
1432
1432
|
}), typeof e.scrollTo != "function") {
|
|
1433
1433
|
let e = w(s);
|
|
1434
|
-
|
|
1434
|
+
_t(_, e) || v(e);
|
|
1435
1435
|
}
|
|
1436
1436
|
return s;
|
|
1437
1437
|
}
|
|
@@ -1443,29 +1443,29 @@ function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1443
1443
|
};
|
|
1444
1444
|
}
|
|
1445
1445
|
function wt(e) {
|
|
1446
|
-
return
|
|
1446
|
+
return R(() => e, Object.values(e));
|
|
1447
1447
|
}
|
|
1448
1448
|
function Tt(e, t) {
|
|
1449
1449
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1450
|
-
return
|
|
1450
|
+
return _t(n, a) && _t(r, o) && _t(i, s);
|
|
1451
1451
|
}
|
|
1452
1452
|
function Et(e) {
|
|
1453
1453
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1454
1454
|
}
|
|
1455
1455
|
var Dt = "data-react-window-index";
|
|
1456
1456
|
function Ot({ 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 }) {
|
|
1457
|
-
let m = wt(u), h =
|
|
1457
|
+
let m = wt(u), h = R(() => F(s, Tt), [s]), [g, _] = B(null), v = Et(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = Q({
|
|
1458
1458
|
containerElement: g,
|
|
1459
1459
|
containerStyle: f,
|
|
1460
1460
|
defaultContainerSize: n,
|
|
1461
1461
|
direction: "vertical",
|
|
1462
1462
|
itemCount: c,
|
|
1463
1463
|
itemProps: m,
|
|
1464
|
-
itemSize:
|
|
1464
|
+
itemSize: R(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
|
|
1465
1465
|
onResize: i,
|
|
1466
1466
|
overscanCount: o
|
|
1467
1467
|
});
|
|
1468
|
-
|
|
1468
|
+
me(r, () => ({
|
|
1469
1469
|
get element() {
|
|
1470
1470
|
return g;
|
|
1471
1471
|
},
|
|
@@ -1480,7 +1480,7 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1480
1480
|
top: r
|
|
1481
1481
|
});
|
|
1482
1482
|
}
|
|
1483
|
-
}), [g, x]),
|
|
1483
|
+
}), [g, x]), ut(() => {
|
|
1484
1484
|
if (!g) return;
|
|
1485
1485
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1486
1486
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
@@ -1494,7 +1494,7 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1494
1494
|
l,
|
|
1495
1495
|
S,
|
|
1496
1496
|
w
|
|
1497
|
-
]),
|
|
1497
|
+
]), L(() => {
|
|
1498
1498
|
S >= 0 && w >= 0 && a && a({
|
|
1499
1499
|
startIndex: C,
|
|
1500
1500
|
stopIndex: T
|
|
@@ -1509,7 +1509,7 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1509
1509
|
w,
|
|
1510
1510
|
T
|
|
1511
1511
|
]);
|
|
1512
|
-
let E =
|
|
1512
|
+
let E = R(() => {
|
|
1513
1513
|
let e = [];
|
|
1514
1514
|
if (c > 0) for (let t = S; t <= w; t++) {
|
|
1515
1515
|
let n = y(t);
|
|
@@ -1540,7 +1540,7 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1540
1540
|
m,
|
|
1541
1541
|
S,
|
|
1542
1542
|
w
|
|
1543
|
-
]), D = /* @__PURE__ */
|
|
1543
|
+
]), D = /* @__PURE__ */ H("div", {
|
|
1544
1544
|
"aria-hidden": !0,
|
|
1545
1545
|
style: {
|
|
1546
1546
|
height: b(),
|
|
@@ -1562,46 +1562,46 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1562
1562
|
}
|
|
1563
1563
|
}, E, e, D);
|
|
1564
1564
|
}
|
|
1565
|
-
var
|
|
1565
|
+
var $ = {
|
|
1566
1566
|
divider: "_divider_13nxz_1",
|
|
1567
1567
|
item: "_item_13nxz_5",
|
|
1568
1568
|
itemIcon: "_itemIcon_13nxz_15",
|
|
1569
1569
|
checkIcon: "_checkIcon_13nxz_19",
|
|
1570
1570
|
stateLabel: "_stateLabel_13nxz_23"
|
|
1571
|
-
},
|
|
1572
|
-
let d = r[e], f =
|
|
1573
|
-
return /* @__PURE__ */
|
|
1571
|
+
}, kt = 44, At = 8, jt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: s, onSelect: c }) => {
|
|
1572
|
+
let d = r[e], f = ct(d.iconUrl, d.type, d.displayName ?? d.id, u.SM), p = d.id === i;
|
|
1573
|
+
return /* @__PURE__ */ H("div", {
|
|
1574
1574
|
style: t,
|
|
1575
1575
|
...n,
|
|
1576
|
-
children: /* @__PURE__ */
|
|
1576
|
+
children: /* @__PURE__ */ H(l, {
|
|
1577
1577
|
type: "button",
|
|
1578
|
-
className: o(
|
|
1579
|
-
iconBefore: /* @__PURE__ */
|
|
1580
|
-
className:
|
|
1578
|
+
className: o($.item, "h-full w-full gap-3 px-4"),
|
|
1579
|
+
iconBefore: /* @__PURE__ */ H("span", {
|
|
1580
|
+
className: $.itemIcon,
|
|
1581
1581
|
children: f
|
|
1582
1582
|
}),
|
|
1583
|
-
label: /* @__PURE__ */
|
|
1583
|
+
label: /* @__PURE__ */ U("span", {
|
|
1584
1584
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
1585
|
-
children: [/* @__PURE__ */
|
|
1585
|
+
children: [/* @__PURE__ */ H(E, {
|
|
1586
1586
|
text: d.displayName ?? d.id,
|
|
1587
1587
|
query: s,
|
|
1588
1588
|
maxLines: 1,
|
|
1589
1589
|
className: o(a, "min-w-0 flex-1 text-start")
|
|
1590
|
-
}), p && /* @__PURE__ */
|
|
1590
|
+
}), p && /* @__PURE__ */ H(ie, {
|
|
1591
1591
|
size: u.SM,
|
|
1592
|
-
className:
|
|
1592
|
+
className: $.checkIcon,
|
|
1593
1593
|
"aria-hidden": !0
|
|
1594
1594
|
})]
|
|
1595
1595
|
}),
|
|
1596
1596
|
onClick: () => c(d.id)
|
|
1597
1597
|
})
|
|
1598
1598
|
});
|
|
1599
|
-
},
|
|
1600
|
-
let [_,
|
|
1601
|
-
|
|
1602
|
-
e ||
|
|
1599
|
+
}, Mt = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: s, selectedDeploymentId: c, onSelect: l, loadingLabel: u, errorLabel: d, emptyLabel: f, style: p, titleClassName: m = "dial-body-semi-text", labelClassName: h = "dial-small-text", colors: g }) => {
|
|
1600
|
+
let [_, y] = B("");
|
|
1601
|
+
L(() => {
|
|
1602
|
+
e || y("");
|
|
1603
1603
|
}, [e]);
|
|
1604
|
-
let b = s && s.length > 0, x = u !== void 0, S = !b && !x ? d ?? f : void 0, C = b ?
|
|
1604
|
+
let b = s && s.length > 0, x = u !== void 0, S = !b && !x ? d ?? f : void 0, C = b ? st(s, _) : [], T = (e) => {
|
|
1605
1605
|
l(e), i();
|
|
1606
1606
|
}, E = a({
|
|
1607
1607
|
"--ci-sheet-divider": g?.divider,
|
|
@@ -1611,7 +1611,7 @@ var kt = {
|
|
|
1611
1611
|
"--ci-sheet-icon": g?.itemIcon,
|
|
1612
1612
|
"--ci-check-icon": g?.checkIcon
|
|
1613
1613
|
});
|
|
1614
|
-
return /* @__PURE__ */
|
|
1614
|
+
return /* @__PURE__ */ H(W, {
|
|
1615
1615
|
isOpen: e,
|
|
1616
1616
|
title: t,
|
|
1617
1617
|
closeLabel: n,
|
|
@@ -1620,55 +1620,55 @@ var kt = {
|
|
|
1620
1620
|
titleClassName: m,
|
|
1621
1621
|
className: "max-h-[80dvh]",
|
|
1622
1622
|
colors: g?.shell,
|
|
1623
|
-
children: /* @__PURE__ */
|
|
1623
|
+
children: /* @__PURE__ */ U("div", {
|
|
1624
1624
|
className: "contents",
|
|
1625
1625
|
style: E,
|
|
1626
|
-
children: [b && !x && /* @__PURE__ */
|
|
1626
|
+
children: [b && !x && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("div", {
|
|
1627
1627
|
className: "flex-shrink-0 px-4 py-[10px]",
|
|
1628
|
-
children: /* @__PURE__ */
|
|
1628
|
+
children: /* @__PURE__ */ H(v, {
|
|
1629
1629
|
value: _,
|
|
1630
1630
|
placeholder: r,
|
|
1631
|
-
size:
|
|
1632
|
-
onChange:
|
|
1631
|
+
size: w.Standard,
|
|
1632
|
+
onChange: y
|
|
1633
1633
|
})
|
|
1634
|
-
}), /* @__PURE__ */
|
|
1634
|
+
}), /* @__PURE__ */ H("div", { className: o($.divider, "h-px flex-shrink-0") })] }), x ? /* @__PURE__ */ H(at, { loadingLabel: u }) : S ? /* @__PURE__ */ H("div", {
|
|
1635
1635
|
role: "list",
|
|
1636
|
-
className: o(
|
|
1636
|
+
className: o($.stateLabel, h, "px-4 py-4"),
|
|
1637
1637
|
children: S
|
|
1638
|
-
}) : /* @__PURE__ */
|
|
1638
|
+
}) : /* @__PURE__ */ H(Ot, {
|
|
1639
1639
|
role: "list",
|
|
1640
1640
|
className: "overflow-y-auto",
|
|
1641
|
-
style: { height: Math.min(C.length,
|
|
1642
|
-
rowComponent:
|
|
1641
|
+
style: { height: Math.min(C.length, At) * kt },
|
|
1642
|
+
rowComponent: jt,
|
|
1643
1643
|
rowCount: C.length,
|
|
1644
|
-
rowHeight:
|
|
1644
|
+
rowHeight: kt,
|
|
1645
1645
|
rowProps: {
|
|
1646
1646
|
items: C,
|
|
1647
1647
|
selectedDeploymentId: c,
|
|
1648
1648
|
labelClassName: h,
|
|
1649
1649
|
query: _,
|
|
1650
|
-
onSelect:
|
|
1650
|
+
onSelect: T
|
|
1651
1651
|
}
|
|
1652
1652
|
})]
|
|
1653
1653
|
})
|
|
1654
1654
|
});
|
|
1655
|
-
},
|
|
1656
|
-
let [_, v] =
|
|
1655
|
+
}, Nt = ({ 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: h, onPickerOpenChange: g }) => {
|
|
1656
|
+
let [_, v] = B(!1), { selectorIcon: y, selectorAriaLabel: b, selectedLabel: x, menuItems: S, menuHeader: E, onOpenChange: D } = lt({
|
|
1657
1657
|
deployments: e,
|
|
1658
1658
|
selectedDeploymentId: t,
|
|
1659
1659
|
onDeploymentChange: n,
|
|
1660
1660
|
modelSelectorLabels: r
|
|
1661
1661
|
});
|
|
1662
1662
|
if (!e) return null;
|
|
1663
|
-
let O = i || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, k = /* @__PURE__ */
|
|
1663
|
+
let O = i || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, k = /* @__PURE__ */ H(j, {
|
|
1664
1664
|
size: u.SM,
|
|
1665
|
-
className:
|
|
1665
|
+
className: K.modelSelectorCaret,
|
|
1666
1666
|
"aria-hidden": !0
|
|
1667
1667
|
});
|
|
1668
|
-
return a ? /* @__PURE__ */
|
|
1668
|
+
return a ? /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(C, {
|
|
1669
1669
|
tooltip: x,
|
|
1670
|
-
children: /* @__PURE__ */
|
|
1671
|
-
icon: /* @__PURE__ */
|
|
1670
|
+
children: /* @__PURE__ */ H(T, {
|
|
1671
|
+
icon: /* @__PURE__ */ U("div", {
|
|
1672
1672
|
className: "flex items-center gap-1",
|
|
1673
1673
|
children: [y, k]
|
|
1674
1674
|
}),
|
|
@@ -1676,16 +1676,16 @@ var kt = {
|
|
|
1676
1676
|
onClick: () => {
|
|
1677
1677
|
c || v(!0);
|
|
1678
1678
|
},
|
|
1679
|
-
className: o(
|
|
1679
|
+
className: o(K.modelSelectorButton, O)
|
|
1680
1680
|
})
|
|
1681
|
-
}), d ? /* @__PURE__ */
|
|
1681
|
+
}), d ? /* @__PURE__ */ H(W, {
|
|
1682
1682
|
isOpen: _,
|
|
1683
1683
|
title: r?.ariaLabel ?? "Select model",
|
|
1684
1684
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1685
1685
|
onClose: () => v(!1),
|
|
1686
1686
|
style: l,
|
|
1687
1687
|
children: d(() => v(!1))
|
|
1688
|
-
}) : /* @__PURE__ */
|
|
1688
|
+
}) : /* @__PURE__ */ H(Mt, {
|
|
1689
1689
|
isOpen: _,
|
|
1690
1690
|
title: r?.ariaLabel ?? "Select model",
|
|
1691
1691
|
closeLabel: r?.closeLabel ?? "Close",
|
|
@@ -1698,7 +1698,7 @@ var kt = {
|
|
|
1698
1698
|
errorLabel: r?.error,
|
|
1699
1699
|
emptyLabel: r?.empty,
|
|
1700
1700
|
style: l
|
|
1701
|
-
})] }) : d ? /* @__PURE__ */
|
|
1701
|
+
})] }) : d ? /* @__PURE__ */ H(f, {
|
|
1702
1702
|
placement: "top-end",
|
|
1703
1703
|
matchReferenceWidth: !1,
|
|
1704
1704
|
open: m,
|
|
@@ -1707,41 +1707,41 @@ var kt = {
|
|
|
1707
1707
|
outsideClosable: !0,
|
|
1708
1708
|
renderOverlay: () => d(() => g?.(!1)),
|
|
1709
1709
|
listClassName: "cp-dropdown-overlay !w-[320px]",
|
|
1710
|
-
children: /* @__PURE__ */
|
|
1710
|
+
children: /* @__PURE__ */ H(C, {
|
|
1711
1711
|
tooltip: x,
|
|
1712
|
-
children: /* @__PURE__ */
|
|
1712
|
+
children: /* @__PURE__ */ U("button", {
|
|
1713
1713
|
type: "button",
|
|
1714
1714
|
"aria-label": b,
|
|
1715
|
-
className: o("flex items-center justify-center gap-1 rounded-full p-2",
|
|
1715
|
+
className: o("flex items-center justify-center gap-1 rounded-full p-2", K.modelSelectorButton, s || i || c ? O : void 0, (s || c) && K.modelSelectorButtonDisabled),
|
|
1716
1716
|
onClick: () => {
|
|
1717
1717
|
!s && !i && !c && h?.();
|
|
1718
1718
|
},
|
|
1719
1719
|
children: [y, k]
|
|
1720
1720
|
})
|
|
1721
1721
|
})
|
|
1722
|
-
}) : /* @__PURE__ */
|
|
1722
|
+
}) : /* @__PURE__ */ H("div", {
|
|
1723
1723
|
className: o(c && O),
|
|
1724
1724
|
"aria-disabled": c || void 0,
|
|
1725
|
-
children: /* @__PURE__ */
|
|
1725
|
+
children: /* @__PURE__ */ H(C, {
|
|
1726
1726
|
tooltip: x,
|
|
1727
|
-
children: /* @__PURE__ */
|
|
1727
|
+
children: /* @__PURE__ */ H(p, {
|
|
1728
1728
|
icon: y,
|
|
1729
1729
|
ariaLabel: b,
|
|
1730
1730
|
items: S,
|
|
1731
|
-
menuHeader:
|
|
1731
|
+
menuHeader: E,
|
|
1732
1732
|
placement: "bottom-end",
|
|
1733
1733
|
matchReferenceWidth: !1,
|
|
1734
1734
|
listClassName: "cp-dropdown-overlay !w-[240px] !max-h-80",
|
|
1735
1735
|
onOpenChange: c ? void 0 : D,
|
|
1736
|
-
size:
|
|
1736
|
+
size: w.Standard,
|
|
1737
1737
|
caretIcon: k,
|
|
1738
1738
|
iconClassName: s || c ? O : void 0,
|
|
1739
|
-
buttonClassName: o("bg-transparent",
|
|
1739
|
+
buttonClassName: o("bg-transparent", K.modelSelectorButton, (s || c) && O && K.modelSelectorButtonDisabled)
|
|
1740
1740
|
})
|
|
1741
1741
|
})
|
|
1742
1742
|
});
|
|
1743
|
-
},
|
|
1744
|
-
let We = s(), [Ge, Ke] =
|
|
1743
|
+
}, Pt = 160, Ft = ({ 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: h = "Attach file", fileAccept: g, addMenuTitle: _ = "Add", menuTitle: v = "Menu", menuCloseLabel: y = "Close", removeLabel: b, retryLabel: x, sendLabel: S, stopLabel: C, micLabel: w = "Record voice message", stopRecordingLabel: T, discardRecordingLabel: E, timerAriaLabel: D, colors: O, typography: k, className: A, pendingDropFiles: ee = [], onDropFilesConsumed: ne, pendingAttachments: re = [], onPendingAttachmentsConsumed: ie, pasteTextThreshold: j = 4e3, deployments: M, selectedDeploymentId: se, onDeploymentChange: ce, modelSelectorLabels: le, initialAttachments: N = [], isStacked: ue = !1, hideAddButton: de = !1, hideAttachFile: fe = !1, hideActionBar: pe = !1, renderFooterActions: P, isInputDisabled: F = !1, isModelSelectorDisabled: L = !1, isSendDisabled: me = !1, isAudioMessageSupported: he = !1, sendOnEnter: ge = Re.Enter, prefixAttachments: _e = [], onRemovePrefixAttachment: ve, chatSettings: be, toolsMenuItems: xe, onToolToggle: Se, toolsMenuTitle: Ce, toolsBackLabel: Te, toolsChipLabels: Ee, autoFocus: W = !1, messageHistory: De, onDialFileSystemClick: Ae, dialFileSystemLabel: je, validateAttachment: Pe, onAttachmentClick: Fe, modelPickerOverlay: Ie, maximumAttachmentsAmount: ze, onAttachmentsLimitExceeded: Be, isAttachmentsEnabled: Ve = !0, usageLimitsSlot: He, onMessageTooLong: Ue }) => {
|
|
1744
|
+
let We = s(), [Ge, Ke] = B(!1), G = Me(De), Je = R(() => a({
|
|
1745
1745
|
"--ci-bg": O?.background,
|
|
1746
1746
|
"--ci-text": O?.text,
|
|
1747
1747
|
"--ci-border": O?.border,
|
|
@@ -1754,159 +1754,159 @@ var kt = {
|
|
|
1754
1754
|
"--ci-voice-error": O?.voiceError,
|
|
1755
1755
|
"--ci-voice-waveform": O?.voiceWaveform,
|
|
1756
1756
|
"--ci-voice-accent": O?.voiceAccent
|
|
1757
|
-
}), [O]), Ye =
|
|
1757
|
+
}), [O]), Ye = R(() => Ae ? [{
|
|
1758
1758
|
key: "dial-fs",
|
|
1759
1759
|
label: je ?? "DIAL file system",
|
|
1760
|
-
icon: /* @__PURE__ */
|
|
1760
|
+
icon: /* @__PURE__ */ H(ae, {
|
|
1761
1761
|
size: c,
|
|
1762
1762
|
"aria-hidden": !0
|
|
1763
1763
|
}),
|
|
1764
|
-
onClick:
|
|
1765
|
-
}] : [], [
|
|
1764
|
+
onClick: Ae
|
|
1765
|
+
}] : [], [Ae, je]), { message: q, setMessage: J, textareaRef: Ze, isMultiLine: Y } = Ne({
|
|
1766
1766
|
messageProp: e,
|
|
1767
1767
|
messageRevision: t
|
|
1768
|
-
}), { attachments:
|
|
1768
|
+
}), { attachments: X, buildAttachments: tt, addAttachments: nt, resetAttachments: rt, handleRemove: it, handleRetry: at, handleExpand: ot, hasBlockedAttachments: st } = Oe({
|
|
1769
1769
|
initialAttachments: N,
|
|
1770
1770
|
onUploadAttachment: r,
|
|
1771
1771
|
onAttachmentsChange: f,
|
|
1772
|
-
validateAttachment:
|
|
1772
|
+
validateAttachment: Pe,
|
|
1773
1773
|
pendingDropFiles: ee,
|
|
1774
|
-
onDropFilesConsumed:
|
|
1774
|
+
onDropFilesConsumed: ne,
|
|
1775
1775
|
pendingAttachments: re,
|
|
1776
1776
|
onPendingAttachmentsConsumed: ie,
|
|
1777
|
-
onExpandPastedText:
|
|
1777
|
+
onExpandPastedText: I((e) => {
|
|
1778
1778
|
J((t) => t ? `${t}\n${e}` : e);
|
|
1779
1779
|
}, [J]),
|
|
1780
|
-
maximumAttachmentsAmount:
|
|
1781
|
-
baseAttachmentsAmount:
|
|
1780
|
+
maximumAttachmentsAmount: ze,
|
|
1781
|
+
baseAttachmentsAmount: _e.length,
|
|
1782
1782
|
onAttachmentsLimitExceeded: Be
|
|
1783
|
-
}), { state:
|
|
1784
|
-
|
|
1785
|
-
}, [
|
|
1783
|
+
}), { state: ct, analyserNodeRef: lt, elapsedSeconds: ut, errorMessage: dt, startRecording: ft, stopRecording: pt, discardRecording: mt } = Le({ onAttachAudio: I((e) => {
|
|
1784
|
+
nt(tt([e]));
|
|
1785
|
+
}, [nt, tt]) }), ht = z(null), gt = z(null), { handlePaste: Z } = we(nt, Ve ? j : Infinity), _t = I((e) => {
|
|
1786
1786
|
if (!Ve) {
|
|
1787
1787
|
let t = e.clipboardData.getData("text/plain");
|
|
1788
1788
|
t.length >= j && Ue?.(t.length, j);
|
|
1789
1789
|
}
|
|
1790
|
-
|
|
1790
|
+
Z(e);
|
|
1791
1791
|
}, [
|
|
1792
1792
|
Ve,
|
|
1793
1793
|
j,
|
|
1794
1794
|
Ue,
|
|
1795
|
-
|
|
1796
|
-
]),
|
|
1797
|
-
|
|
1798
|
-
|
|
1795
|
+
Z
|
|
1796
|
+
]), vt = q.trim().length > 0 || X.length > 0, yt = vt && !st && !me, { shouldRender: bt, isExiting: xt, instanceKey: St } = ke(!l && vt, Pt), Ct = (xe?.some((e) => e.isSelected) ?? !1) && Se != null, Q = ue || q.includes("\n") || Y || Ct, wt = M === void 0 || se != null, Tt = R(() => he && !xt && !l, [
|
|
1797
|
+
he,
|
|
1798
|
+
xt,
|
|
1799
1799
|
l
|
|
1800
|
-
]),
|
|
1801
|
-
if (
|
|
1802
|
-
if (!Ve &&
|
|
1803
|
-
Ue?.(
|
|
1800
|
+
]), Et = async () => {
|
|
1801
|
+
if (me) return;
|
|
1802
|
+
if (!Ve && q.length >= j) {
|
|
1803
|
+
Ue?.(q.length, j);
|
|
1804
1804
|
return;
|
|
1805
1805
|
}
|
|
1806
|
-
let e =
|
|
1807
|
-
J(""),
|
|
1806
|
+
let e = q, t = X;
|
|
1807
|
+
J(""), G.reset();
|
|
1808
1808
|
try {
|
|
1809
1809
|
await n?.(e, t), t.forEach((e) => {
|
|
1810
1810
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
1811
|
-
}),
|
|
1811
|
+
}), rt([]);
|
|
1812
1812
|
} catch {
|
|
1813
|
-
J(e),
|
|
1813
|
+
J(e), rt(t);
|
|
1814
1814
|
}
|
|
1815
|
-
},
|
|
1816
|
-
if (!e.nativeEvent.isComposing && !
|
|
1817
|
-
let t = e.currentTarget.selectionStart ?? 0, n =
|
|
1815
|
+
}, Dt = (e) => {
|
|
1816
|
+
if (!e.nativeEvent.isComposing && !F && !l && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
1817
|
+
let t = e.currentTarget.selectionStart ?? 0, n = G.navigate(e.key === "ArrowUp" ? "up" : "down", q, t);
|
|
1818
1818
|
if (n !== null) {
|
|
1819
1819
|
e.preventDefault(), J(n);
|
|
1820
1820
|
return;
|
|
1821
1821
|
}
|
|
1822
1822
|
}
|
|
1823
|
-
e.key === "Enter" && (
|
|
1824
|
-
},
|
|
1823
|
+
e.key === "Enter" && (ge === Re.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !l && yt && wt && !F && Et());
|
|
1824
|
+
}, Ot = (e) => {
|
|
1825
1825
|
let t = Array.from(e.target.files ?? []);
|
|
1826
1826
|
if (t.length === 0) return;
|
|
1827
|
-
let n =
|
|
1828
|
-
e.target.value = "",
|
|
1827
|
+
let n = tt(t);
|
|
1828
|
+
e.target.value = "", nt(n);
|
|
1829
1829
|
};
|
|
1830
|
-
if (
|
|
1831
|
-
state:
|
|
1832
|
-
analyserNodeRef:
|
|
1833
|
-
elapsedSeconds:
|
|
1834
|
-
errorMessage:
|
|
1835
|
-
onStop:
|
|
1836
|
-
onDiscard:
|
|
1830
|
+
if (ct !== "idle") return /* @__PURE__ */ H(Qe, {
|
|
1831
|
+
state: ct,
|
|
1832
|
+
analyserNodeRef: lt,
|
|
1833
|
+
elapsedSeconds: ut,
|
|
1834
|
+
errorMessage: dt,
|
|
1835
|
+
onStop: pt,
|
|
1836
|
+
onDiscard: mt,
|
|
1837
1837
|
stopLabel: T,
|
|
1838
1838
|
discardLabel: E,
|
|
1839
1839
|
timerLabel: D,
|
|
1840
|
-
style:
|
|
1840
|
+
style: Je,
|
|
1841
1841
|
className: A
|
|
1842
1842
|
});
|
|
1843
|
-
let
|
|
1844
|
-
className: o(
|
|
1843
|
+
let $ = /* @__PURE__ */ H("textarea", {
|
|
1844
|
+
className: o(K.textarea, k?.fontClassName || "dial-body-paragraph-text", "max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent outline-none [field-sizing:content]"),
|
|
1845
1845
|
ref: Ze,
|
|
1846
|
-
autoFocus:
|
|
1847
|
-
value:
|
|
1846
|
+
autoFocus: W,
|
|
1847
|
+
value: q,
|
|
1848
1848
|
onChange: (e) => {
|
|
1849
|
-
J(e.target.value),
|
|
1849
|
+
J(e.target.value), G.notifyChange(), d?.(e.target.value);
|
|
1850
1850
|
},
|
|
1851
|
-
onKeyDown:
|
|
1852
|
-
onPaste:
|
|
1851
|
+
onKeyDown: Dt,
|
|
1852
|
+
onPaste: _t,
|
|
1853
1853
|
placeholder: p,
|
|
1854
1854
|
"aria-label": m,
|
|
1855
|
-
disabled:
|
|
1855
|
+
disabled: F,
|
|
1856
1856
|
rows: 1
|
|
1857
1857
|
});
|
|
1858
|
-
return /* @__PURE__ */
|
|
1858
|
+
return /* @__PURE__ */ U("div", {
|
|
1859
1859
|
ref: gt,
|
|
1860
|
-
style:
|
|
1861
|
-
className: o(
|
|
1862
|
-
children: [(
|
|
1863
|
-
attachments: [...
|
|
1860
|
+
style: Je,
|
|
1861
|
+
className: o(K.wrapper, F && K.wrapperDisabled, "flex min-h-[64px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border shadow-md", X.length > 6 ? "py-3 ps-3" : "p-3", A),
|
|
1862
|
+
children: [(_e.length > 0 || X.length > 0) && /* @__PURE__ */ H(ye, {
|
|
1863
|
+
attachments: [..._e, ...X],
|
|
1864
1864
|
onRemove: (e) => {
|
|
1865
|
-
|
|
1865
|
+
_e.some((t) => t.id === e) ? ve?.(e) : it(e);
|
|
1866
1866
|
},
|
|
1867
|
-
onRetry:
|
|
1868
|
-
onExpand:
|
|
1867
|
+
onRetry: at,
|
|
1868
|
+
onExpand: ot,
|
|
1869
1869
|
labels: {
|
|
1870
1870
|
removeLabel: b,
|
|
1871
1871
|
retryLabel: x
|
|
1872
1872
|
},
|
|
1873
1873
|
onAttachmentClick: Fe == null ? void 0 : (e) => {
|
|
1874
|
-
let t = [...
|
|
1874
|
+
let t = [..._e, ...X].find((t) => t.id === e);
|
|
1875
1875
|
t != null && Fe(t);
|
|
1876
1876
|
}
|
|
1877
|
-
}), pe ?
|
|
1878
|
-
className: o("flex items-center gap-2",
|
|
1877
|
+
}), pe ? Q && $ : /* @__PURE__ */ U("div", {
|
|
1878
|
+
className: o("flex items-center gap-2", Q ? "flex-wrap" : "flex-wrap desktop:flex-nowrap"),
|
|
1879
1879
|
children: [
|
|
1880
|
-
!de && /* @__PURE__ */
|
|
1881
|
-
className: o("flex", "order-2",
|
|
1882
|
-
children: [/* @__PURE__ */
|
|
1883
|
-
ref:
|
|
1880
|
+
!de && /* @__PURE__ */ U("div", {
|
|
1881
|
+
className: o("flex", "order-2", !Q && "desktop:order-1"),
|
|
1882
|
+
children: [/* @__PURE__ */ H("input", {
|
|
1883
|
+
ref: ht,
|
|
1884
1884
|
type: "file",
|
|
1885
1885
|
multiple: !0,
|
|
1886
1886
|
accept: g,
|
|
1887
1887
|
className: "sr-only",
|
|
1888
1888
|
"aria-hidden": !0,
|
|
1889
1889
|
tabIndex: -1,
|
|
1890
|
-
onChange:
|
|
1891
|
-
}), /* @__PURE__ */
|
|
1892
|
-
onAttachClick: fe ? void 0 : () =>
|
|
1890
|
+
onChange: Ot
|
|
1891
|
+
}), /* @__PURE__ */ H(qe, {
|
|
1892
|
+
onAttachClick: fe ? void 0 : () => ht.current?.click(),
|
|
1893
1893
|
attachLabel: h,
|
|
1894
1894
|
addMenuTitle: _,
|
|
1895
1895
|
menuTitle: v,
|
|
1896
1896
|
menuCloseLabel: y,
|
|
1897
|
-
style:
|
|
1898
|
-
isDisabled:
|
|
1899
|
-
chatSettings:
|
|
1897
|
+
style: Je,
|
|
1898
|
+
isDisabled: F,
|
|
1899
|
+
chatSettings: be,
|
|
1900
1900
|
extraMenuItems: Ye,
|
|
1901
1901
|
toolsMenuItems: xe,
|
|
1902
1902
|
onToolToggle: Se,
|
|
1903
1903
|
toolsMenuTitle: Ce,
|
|
1904
|
-
toolsBackLabel:
|
|
1904
|
+
toolsBackLabel: Te
|
|
1905
1905
|
})]
|
|
1906
1906
|
}),
|
|
1907
|
-
|
|
1907
|
+
Q && Ct && /* @__PURE__ */ H("div", {
|
|
1908
1908
|
className: "order-3 min-w-0 flex-1",
|
|
1909
|
-
children: /* @__PURE__ */
|
|
1909
|
+
children: /* @__PURE__ */ H(Xe, {
|
|
1910
1910
|
items: xe ?? [],
|
|
1911
1911
|
onToolToggle: Se,
|
|
1912
1912
|
isMobile: We,
|
|
@@ -1914,66 +1914,66 @@ var kt = {
|
|
|
1914
1914
|
removeLabel: Ee?.removeLabel
|
|
1915
1915
|
})
|
|
1916
1916
|
}),
|
|
1917
|
-
/* @__PURE__ */ V("div", {
|
|
1918
|
-
className: o("order-1 flex w-full min-w-0 items-center self-stretch", !$ && "desktop:order-2 desktop:w-auto desktop:flex-1"),
|
|
1919
|
-
children: Ot
|
|
1920
|
-
}),
|
|
1921
1917
|
/* @__PURE__ */ H("div", {
|
|
1922
|
-
className: o("flex
|
|
1923
|
-
children:
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1918
|
+
className: o("order-1 flex w-full min-w-0 items-center self-stretch", !Q && "desktop:order-2 desktop:w-auto desktop:flex-1"),
|
|
1919
|
+
children: $
|
|
1920
|
+
}),
|
|
1921
|
+
/* @__PURE__ */ U("div", {
|
|
1922
|
+
className: o("flex flex-shrink-0 items-center gap-2", Q && Ct ? "order-4" : "order-3", "ms-auto", !Q && "desktop:ms-0"),
|
|
1923
|
+
children: [P ? P({
|
|
1924
|
+
canSend: yt,
|
|
1925
|
+
onSend: Et
|
|
1926
|
+
}) : /* @__PURE__ */ U(V, { children: [
|
|
1927
1927
|
He,
|
|
1928
|
-
/* @__PURE__ */
|
|
1929
|
-
deployments:
|
|
1930
|
-
selectedDeploymentId:
|
|
1928
|
+
/* @__PURE__ */ H(Nt, {
|
|
1929
|
+
deployments: M,
|
|
1930
|
+
selectedDeploymentId: se,
|
|
1931
1931
|
onDeploymentChange: ce,
|
|
1932
1932
|
modelSelectorLabels: le,
|
|
1933
1933
|
isStreaming: l,
|
|
1934
1934
|
isMobile: We,
|
|
1935
|
-
isInputDisabled:
|
|
1936
|
-
isDisabled:
|
|
1937
|
-
style:
|
|
1935
|
+
isInputDisabled: F,
|
|
1936
|
+
isDisabled: L,
|
|
1937
|
+
style: Je,
|
|
1938
1938
|
modelPickerOverlay: Ie,
|
|
1939
1939
|
isPickerOpen: Ge,
|
|
1940
1940
|
onPickerToggle: () => Ke((e) => !e),
|
|
1941
1941
|
onPickerOpenChange: Ke
|
|
1942
1942
|
}),
|
|
1943
|
-
l && i ? /* @__PURE__ */
|
|
1943
|
+
l && i ? /* @__PURE__ */ H(et, {
|
|
1944
1944
|
onStop: i,
|
|
1945
1945
|
ariaLabel: C
|
|
1946
|
-
}) : !l &&
|
|
1947
|
-
onSend:
|
|
1948
|
-
isDisabled: !
|
|
1946
|
+
}) : !l && bt && /* @__PURE__ */ H($e, {
|
|
1947
|
+
onSend: Et,
|
|
1948
|
+
isDisabled: !wt || st || me,
|
|
1949
1949
|
ariaLabel: S,
|
|
1950
|
-
isExiting:
|
|
1951
|
-
},
|
|
1952
|
-
] }),
|
|
1953
|
-
icon: /* @__PURE__ */
|
|
1950
|
+
isExiting: xt
|
|
1951
|
+
}, St)
|
|
1952
|
+
] }), Tt && /* @__PURE__ */ H(te, {
|
|
1953
|
+
icon: /* @__PURE__ */ H(oe, {
|
|
1954
1954
|
size: u.LG,
|
|
1955
1955
|
"aria-hidden": !0
|
|
1956
1956
|
}),
|
|
1957
1957
|
"aria-label": w,
|
|
1958
1958
|
className: "size-8 flex-shrink-0",
|
|
1959
|
-
onClick:
|
|
1960
|
-
disabled:
|
|
1959
|
+
onClick: ft,
|
|
1960
|
+
disabled: F || l
|
|
1961
1961
|
})]
|
|
1962
1962
|
})
|
|
1963
1963
|
]
|
|
1964
1964
|
})]
|
|
1965
1965
|
});
|
|
1966
|
-
},
|
|
1966
|
+
}, It = { welcome: "_welcome_n2ph8_1" }, Lt = ({ 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 }) => {
|
|
1967
1967
|
let { colors: u, typography: d } = r ?? {};
|
|
1968
|
-
return /* @__PURE__ */
|
|
1968
|
+
return /* @__PURE__ */ U("div", {
|
|
1969
1969
|
style: a({ "--ci-welcome-color": u?.welcomeText }),
|
|
1970
1970
|
className: o("relative flex w-full flex-col items-center gap-6 px-4 py-5 desktop:p-5", i),
|
|
1971
|
-
children: [n && /* @__PURE__ */
|
|
1972
|
-
className: o(
|
|
1971
|
+
children: [n && /* @__PURE__ */ H("h1", {
|
|
1972
|
+
className: o(It.welcome, "m-0 text-center", d?.welcomeClassName || "dial-display2-text"),
|
|
1973
1973
|
children: n
|
|
1974
|
-
}), /* @__PURE__ */
|
|
1974
|
+
}), /* @__PURE__ */ H("div", {
|
|
1975
1975
|
className: "relative w-full max-w-[748px]",
|
|
1976
|
-
children: /* @__PURE__ */
|
|
1976
|
+
children: /* @__PURE__ */ H(Ft, {
|
|
1977
1977
|
placeholder: t,
|
|
1978
1978
|
isStreaming: e,
|
|
1979
1979
|
isInputDisabled: c,
|
|
@@ -1984,45 +1984,45 @@ var kt = {
|
|
|
1984
1984
|
})
|
|
1985
1985
|
})]
|
|
1986
1986
|
});
|
|
1987
|
-
},
|
|
1988
|
-
let ie =
|
|
1989
|
-
|
|
1990
|
-
v?.length && (
|
|
1987
|
+
}, Rt = ({ 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, pasteTextThreshold: ne, onMessageTooLong: re }) => {
|
|
1988
|
+
let ie = z(null), [j, M] = B([]);
|
|
1989
|
+
L(() => {
|
|
1990
|
+
v?.length && (M(v), y?.());
|
|
1991
1991
|
}, [v, y]);
|
|
1992
|
-
let [
|
|
1992
|
+
let [oe, se] = B(e ?? ""), [ce, le] = B([]), [N, ue] = B(t), de = ce.some((e) => e.status === r.Loading || e.status === r.Error), fe = (oe.trim().length > 0 || ce.length > 0 || N.length > 0) && !de, pe = (e) => {
|
|
1993
1993
|
ue((t) => t.filter((t) => t.id !== e));
|
|
1994
|
-
},
|
|
1994
|
+
}, P = I((e, t) => {
|
|
1995
1995
|
i(e, N, t);
|
|
1996
|
-
}, [N, i]),
|
|
1996
|
+
}, [N, i]), F = () => {
|
|
1997
1997
|
if (fe) {
|
|
1998
|
-
if (!x &&
|
|
1999
|
-
re?.(
|
|
1998
|
+
if (!x && oe.length >= (ne ?? 4e3)) {
|
|
1999
|
+
re?.(oe.length, ne ?? 4e3);
|
|
2000
2000
|
return;
|
|
2001
2001
|
}
|
|
2002
|
-
|
|
2002
|
+
P(oe, ce);
|
|
2003
2003
|
}
|
|
2004
|
-
},
|
|
2004
|
+
}, me = I(() => M([]), []), he = I((e) => {
|
|
2005
2005
|
let t = Array.from(e.target.files ?? []);
|
|
2006
|
-
t.length !== 0 && (e.target.value = "",
|
|
2007
|
-
}, []),
|
|
2006
|
+
t.length !== 0 && (e.target.value = "", M(t));
|
|
2007
|
+
}, []), ge = R(() => E ? [{
|
|
2008
2008
|
key: "dial-fs",
|
|
2009
|
-
label:
|
|
2010
|
-
icon: /* @__PURE__ */
|
|
2009
|
+
label: O ?? "DIAL file system",
|
|
2010
|
+
icon: /* @__PURE__ */ H(ae, {
|
|
2011
2011
|
size: c,
|
|
2012
2012
|
"aria-hidden": !0
|
|
2013
2013
|
}),
|
|
2014
2014
|
onClick: E
|
|
2015
|
-
}] : [], [E,
|
|
2016
|
-
return /* @__PURE__ */
|
|
2015
|
+
}] : [], [E, O]);
|
|
2016
|
+
return /* @__PURE__ */ U("div", {
|
|
2017
2017
|
className: o("flex w-full flex-col gap-2", _),
|
|
2018
|
-
children: [/* @__PURE__ */
|
|
2018
|
+
children: [/* @__PURE__ */ H(Ft, {
|
|
2019
2019
|
message: e,
|
|
2020
2020
|
ariaLabel: u,
|
|
2021
2021
|
isStacked: !0,
|
|
2022
2022
|
hideActionBar: !0,
|
|
2023
2023
|
pendingDropFiles: j,
|
|
2024
|
-
onDropFilesConsumed:
|
|
2025
|
-
onSend:
|
|
2024
|
+
onDropFilesConsumed: me,
|
|
2025
|
+
onSend: P,
|
|
2026
2026
|
onUploadAttachment: a,
|
|
2027
2027
|
onChange: se,
|
|
2028
2028
|
onAttachmentsChange: le,
|
|
@@ -2035,16 +2035,16 @@ var kt = {
|
|
|
2035
2035
|
isAttachmentsEnabled: x,
|
|
2036
2036
|
maximumAttachmentsAmount: w,
|
|
2037
2037
|
onAttachmentsLimitExceeded: T,
|
|
2038
|
-
pendingAttachments:
|
|
2038
|
+
pendingAttachments: A,
|
|
2039
2039
|
onPendingAttachmentsConsumed: ee,
|
|
2040
2040
|
onAttachmentClick: te,
|
|
2041
2041
|
pasteTextThreshold: ne,
|
|
2042
2042
|
onMessageTooLong: re
|
|
2043
|
-
}), /* @__PURE__ */
|
|
2043
|
+
}), /* @__PURE__ */ U("div", {
|
|
2044
2044
|
className: "flex items-center justify-between",
|
|
2045
|
-
children: [/* @__PURE__ */
|
|
2045
|
+
children: [/* @__PURE__ */ H("div", {
|
|
2046
2046
|
className: "flex",
|
|
2047
|
-
children: !S && /* @__PURE__ */
|
|
2047
|
+
children: !S && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("input", {
|
|
2048
2048
|
ref: ie,
|
|
2049
2049
|
type: "file",
|
|
2050
2050
|
multiple: !0,
|
|
@@ -2052,23 +2052,23 @@ var kt = {
|
|
|
2052
2052
|
className: "sr-only",
|
|
2053
2053
|
"aria-hidden": !0,
|
|
2054
2054
|
tabIndex: -1,
|
|
2055
|
-
onChange:
|
|
2056
|
-
}), /* @__PURE__ */
|
|
2055
|
+
onChange: he
|
|
2056
|
+
}), /* @__PURE__ */ H(qe, {
|
|
2057
2057
|
onAttachClick: () => ie.current?.click(),
|
|
2058
2058
|
attachLabel: m,
|
|
2059
2059
|
addMenuTitle: p,
|
|
2060
2060
|
menuTitle: h,
|
|
2061
2061
|
menuCloseLabel: g,
|
|
2062
|
-
extraMenuItems:
|
|
2062
|
+
extraMenuItems: ge
|
|
2063
2063
|
})] })
|
|
2064
|
-
}), /* @__PURE__ */
|
|
2064
|
+
}), /* @__PURE__ */ U("div", {
|
|
2065
2065
|
className: "flex gap-2",
|
|
2066
|
-
children: [/* @__PURE__ */
|
|
2066
|
+
children: [/* @__PURE__ */ H(D, {
|
|
2067
2067
|
label: s,
|
|
2068
2068
|
onClick: n
|
|
2069
|
-
}), /* @__PURE__ */
|
|
2069
|
+
}), /* @__PURE__ */ H(k, {
|
|
2070
2070
|
label: l,
|
|
2071
|
-
onClick:
|
|
2071
|
+
onClick: F,
|
|
2072
2072
|
disabled: !fe
|
|
2073
2073
|
})]
|
|
2074
2074
|
})]
|
|
@@ -2076,4 +2076,4 @@ var kt = {
|
|
|
2076
2076
|
});
|
|
2077
2077
|
};
|
|
2078
2078
|
//#endregion
|
|
2079
|
-
export {
|
|
2079
|
+
export { ge as AttachmentCard, _e as AttachmentGroup, ve as AttachmentTray, W as BottomSheetShell, Ge as ChatSettingsModal, Lt as ConversationInput, Rt as EditMessageInput, be as FileDndOverlay, Ft as Input, Re as SendOnEnter, Ce as getAttachmentIcon };
|