@epam/ai-dial-conversation-input 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/AddAttachmentButton/AddAttachmentButton.d.ts.map +1 -1
- package/components/BottomSheetShell/BottomSheetShell.d.ts.map +1 -1
- package/components/EditMessageInput/EditMessageInput.d.ts.map +1 -1
- package/components/Input/Buttons/SendButton.d.ts.map +1 -1
- package/components/Input/Buttons/StopButton.d.ts.map +1 -1
- package/components/Input/Input.d.ts.map +1 -1
- package/components/Input/ModelSelectorControl.d.ts.map +1 -1
- package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts.map +1 -1
- package/components/ToolsBottomSheet/ToolsBottomSheet.d.ts.map +1 -1
- package/components/ToolsChips/ToolsChips.d.ts +54 -0
- package/components/ToolsChips/ToolsChips.d.ts.map +1 -0
- package/components/VoiceBar/VoiceBar.d.ts.map +1 -1
- package/hooks/useModelSelector.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.d.ts +0 -2
- package/index.d.ts.map +1 -1
- package/index.js +782 -776
- package/models/ConversationInput.d.ts +1 -1
- package/models/ConversationInput.d.ts.map +1 -1
- package/models/Input.d.ts +3 -5
- package/models/Input.d.ts.map +1 -1
- package/package.json +4 -4
- package/components/SelectedToolsChips/SelectedToolsChips.d.ts +0 -42
- package/components/SelectedToolsChips/SelectedToolsChips.d.ts.map +0 -1
package/index.js
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
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, CloseButton as u, DIAL_ICON_SIZE as d,
|
|
3
|
-
import { IconArrowLeft as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { createElement as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import {
|
|
2
|
+
import { BASE_ICON_SIZE as c, Button as l, CloseButton as u, DIAL_ICON_SIZE as d, DIAL_KIT_ICON_STROKE as f, DialDropdownIcon as p, DialSlider as m, Dropdown as h, ElementSize as g, ErrorText as _, GhostIconButton as v, Highlight as y, NeutralButton as b, Popup as x, PopupSize as S, PrimaryButton as C, PrimaryIconButton as w, RadioGroup as T, RadioGroupOrientation as E, Search as D, Skeleton as O, SkeletonVariant as k, StaticIconButton as A, Textarea as ee, Tooltip as j } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconArrowLeft as te, IconArrowNarrowRight as ne, IconCheck as M, IconChevronDown as re, IconChevronRight as N, IconFile as ie, IconMicrophone as ae, IconPaperclip as oe, IconPlayerStopFilled as P, IconPlaystationSquare as F, IconPlus as se, IconPrompt as ce, IconSettings as le, IconTool as ue, IconX as de } from "@tabler/icons-react";
|
|
4
|
+
import { createPortal as fe } from "react-dom";
|
|
5
|
+
import { createElement as I, memo as L, useCallback as R, useEffect as z, useImperativeHandle as pe, useLayoutEffect as me, useMemo as B, useRef as V, useState as H } from "react";
|
|
6
|
+
import { Fragment as U, jsx as W, jsxs as G } from "react/jsx-runtime";
|
|
7
|
+
import { AttachmentTray as he, MAX_UPLOADS_PER_MINUTE as ge, generateAttachmentId as _e, useClipboardPaste as ve } from "@epam/ai-dial-attachment-input";
|
|
8
8
|
//#region src/hooks/useBottomSheet.ts
|
|
9
|
-
var
|
|
10
|
-
|
|
9
|
+
var ye = (e, t) => {
|
|
10
|
+
z(() => {
|
|
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]), z(() => {
|
|
17
17
|
if (e) return document.body.style.overflow = "hidden", () => {
|
|
18
18
|
document.body.style.overflow = "";
|
|
19
19
|
};
|
|
20
20
|
}, [e]);
|
|
21
|
-
},
|
|
21
|
+
}, be = {
|
|
22
22
|
backdrop: "_backdrop_1d50f_9",
|
|
23
23
|
sheet: "_sheet_1d50f_13",
|
|
24
24
|
"slide-up": "_slide-up_1d50f_1",
|
|
25
25
|
title: "_title_1d50f_18",
|
|
26
26
|
divider: "_divider_1d50f_22"
|
|
27
|
-
},
|
|
28
|
-
if (
|
|
29
|
-
let
|
|
30
|
-
"--ci-backdrop":
|
|
31
|
-
"--ci-sheet-bg":
|
|
32
|
-
"--ci-sheet-text":
|
|
33
|
-
"--ci-sheet-divider":
|
|
27
|
+
}, K = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: s, "aria-label": c, style: l, titleClassName: p = "dial-body-semi-text", className: m, colors: h, children: _ }) => {
|
|
28
|
+
if (ye(e, r), !e || typeof document > "u") return null;
|
|
29
|
+
let y = a({
|
|
30
|
+
"--ci-backdrop": h?.backdrop,
|
|
31
|
+
"--ci-sheet-bg": h?.sheetBg,
|
|
32
|
+
"--ci-sheet-text": h?.sheetText,
|
|
33
|
+
"--ci-sheet-divider": h?.divider
|
|
34
34
|
});
|
|
35
|
-
return
|
|
36
|
-
className: o(
|
|
37
|
-
style:
|
|
35
|
+
return fe(/* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("div", {
|
|
36
|
+
className: o(be.backdrop, "fixed inset-0 z-[55]"),
|
|
37
|
+
style: y,
|
|
38
38
|
onPointerDown: r,
|
|
39
39
|
"aria-hidden": !0
|
|
40
|
-
}), /* @__PURE__ */
|
|
40
|
+
}), /* @__PURE__ */ G("div", {
|
|
41
41
|
role: "dialog",
|
|
42
42
|
"aria-modal": !0,
|
|
43
43
|
"aria-label": t ?? c,
|
|
44
44
|
style: {
|
|
45
|
-
...
|
|
45
|
+
...y,
|
|
46
46
|
...l
|
|
47
47
|
},
|
|
48
|
-
className: o(
|
|
49
|
-
children: [t != null && /* @__PURE__ */
|
|
48
|
+
className: o(be.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col rounded-t-lg", m),
|
|
49
|
+
children: [t != null && /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G("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__ */ W("div", {
|
|
53
53
|
className: "absolute start-4",
|
|
54
|
-
children: /* @__PURE__ */
|
|
55
|
-
icon: /* @__PURE__ */
|
|
54
|
+
children: /* @__PURE__ */ W(v, {
|
|
55
|
+
icon: /* @__PURE__ */ W(te, {
|
|
56
56
|
size: d.LG,
|
|
57
|
-
stroke:
|
|
57
|
+
stroke: f,
|
|
58
58
|
className: "rtl:scale-x-[-1]"
|
|
59
59
|
}),
|
|
60
60
|
"aria-label": s,
|
|
61
61
|
onClick: i
|
|
62
62
|
})
|
|
63
63
|
}),
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
className: o(
|
|
64
|
+
/* @__PURE__ */ W("span", {
|
|
65
|
+
className: o(be.title, p),
|
|
66
66
|
children: t
|
|
67
67
|
}),
|
|
68
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ W("div", {
|
|
69
69
|
className: "absolute end-4 m-2",
|
|
70
|
-
children: /* @__PURE__ */
|
|
70
|
+
children: /* @__PURE__ */ W(u, {
|
|
71
71
|
ariaLabel: n,
|
|
72
72
|
onClose: r,
|
|
73
|
-
size:
|
|
73
|
+
size: g.Standard
|
|
74
74
|
})
|
|
75
75
|
})
|
|
76
76
|
]
|
|
77
|
-
}), /* @__PURE__ */
|
|
77
|
+
}), /* @__PURE__ */ W("div", { className: o(be.divider, "h-px flex-shrink-0") })] }), /* @__PURE__ */ W("div", {
|
|
78
78
|
className: "overflow-y-auto",
|
|
79
|
-
children:
|
|
79
|
+
children: _
|
|
80
80
|
})]
|
|
81
81
|
})] }), document.body);
|
|
82
|
-
},
|
|
82
|
+
}, xe = 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
|
+
}, Se = ({ 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] = H(n), _ = V(h);
|
|
88
|
+
z(() => {
|
|
89
89
|
_.current = h;
|
|
90
|
-
}, [h]),
|
|
90
|
+
}, [h]), z(() => () => {
|
|
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 = R((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: _e(),
|
|
99
99
|
name: e.name,
|
|
100
100
|
contentType: e.type,
|
|
101
101
|
file: e,
|
|
@@ -104,26 +104,26 @@ var Se = (e, t) => {
|
|
|
104
104
|
previewUrl: a,
|
|
105
105
|
playUrl: o
|
|
106
106
|
};
|
|
107
|
-
}), []), y =
|
|
108
|
-
|
|
107
|
+
}), []), y = V(a);
|
|
108
|
+
z(() => {
|
|
109
109
|
y.current = a;
|
|
110
110
|
}, [a]);
|
|
111
|
-
let b =
|
|
111
|
+
let b = V(!0), x = R((e) => {
|
|
112
112
|
g((t) => {
|
|
113
113
|
let n = e(t);
|
|
114
114
|
return n === t ? t : n;
|
|
115
115
|
});
|
|
116
116
|
}, []);
|
|
117
|
-
|
|
117
|
+
z(() => {
|
|
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 = R((e) => {
|
|
125
125
|
g(e);
|
|
126
|
-
}, []), C =
|
|
126
|
+
}, []), C = R(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 Se = (e, t) => {
|
|
|
145
145
|
} : e));
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
}, [i, x]), w =
|
|
148
|
+
}, [i, x]), w = R((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 Se = (e, t) => {
|
|
|
166
166
|
status: r.Error,
|
|
167
167
|
errorReason: n
|
|
168
168
|
} : e));
|
|
169
|
-
}),
|
|
169
|
+
}), xe(e, ge, C);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
}, [
|
|
@@ -177,20 +177,20 @@ var Se = (e, t) => {
|
|
|
177
177
|
C,
|
|
178
178
|
o
|
|
179
179
|
]);
|
|
180
|
-
|
|
180
|
+
z(() => {
|
|
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
|
+
]), z(() => {
|
|
188
188
|
l.length !== 0 && (w(l, !1), u?.());
|
|
189
189
|
}, [
|
|
190
190
|
w,
|
|
191
191
|
u,
|
|
192
192
|
l
|
|
193
|
-
]),
|
|
193
|
+
]), z(() => {
|
|
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 Se = (e, t) => {
|
|
|
217
217
|
x,
|
|
218
218
|
C
|
|
219
219
|
]);
|
|
220
|
-
let T =
|
|
220
|
+
let T = R((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 Se = (e, t) => {
|
|
|
229
229
|
addAttachments: w,
|
|
230
230
|
resetAttachments: S,
|
|
231
231
|
handleRemove: T,
|
|
232
|
-
handleRetry:
|
|
232
|
+
handleRetry: R((e) => {
|
|
233
233
|
let t = h.find((t) => t.id === e);
|
|
234
234
|
t && C(t);
|
|
235
235
|
}, [h, C]),
|
|
236
|
-
handleExpand:
|
|
236
|
+
handleExpand: R(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 Se = (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
|
+
}, Ce = (e, t) => {
|
|
249
|
+
let [n, r] = H(e), [i, a] = H(!1), [o, s] = H(0);
|
|
250
|
+
return z(() => {
|
|
251
251
|
if (e) {
|
|
252
252
|
r(!0), a(!1), s((e) => e + 1);
|
|
253
253
|
return;
|
|
@@ -263,18 +263,18 @@ var Se = (e, t) => {
|
|
|
263
263
|
isExiting: i,
|
|
264
264
|
instanceKey: o
|
|
265
265
|
};
|
|
266
|
-
},
|
|
267
|
-
let t =
|
|
266
|
+
}, we = (e, t) => !e.slice(0, t).includes("\n"), Te = (e, t) => !e.slice(t).includes("\n"), Ee = (e) => {
|
|
267
|
+
let t = V(e);
|
|
268
268
|
t.current = e;
|
|
269
|
-
let n =
|
|
269
|
+
let n = V(-1), r = V(""), i = R((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" ? !we(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 || !Te(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
|
|
272
|
+
}, []), a = R(() => {
|
|
273
273
|
n.current = -1, r.current = "";
|
|
274
|
-
}, []), o =
|
|
274
|
+
}, []), o = R(() => {
|
|
275
275
|
n.current = -1, r.current = "";
|
|
276
276
|
}, []);
|
|
277
|
-
return
|
|
277
|
+
return B(() => ({
|
|
278
278
|
navigate: i,
|
|
279
279
|
notifyChange: a,
|
|
280
280
|
reset: o
|
|
@@ -283,13 +283,13 @@ var Se = (e, t) => {
|
|
|
283
283
|
a,
|
|
284
284
|
o
|
|
285
285
|
]);
|
|
286
|
-
},
|
|
287
|
-
let [n, r] =
|
|
288
|
-
return
|
|
286
|
+
}, De = ({ messageProp: e, messageRevision: t }) => {
|
|
287
|
+
let [n, r] = H(e), i = V(null), a = V(0), [o, s] = H(!1);
|
|
288
|
+
return z(() => {
|
|
289
289
|
r(e);
|
|
290
|
-
}, [e, t]),
|
|
290
|
+
}, [e, t]), z(() => {
|
|
291
291
|
i.current && (a.current = i.current.offsetHeight);
|
|
292
|
-
}, []),
|
|
292
|
+
}, []), me(() => {
|
|
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,18 +299,18 @@ var Se = (e, t) => {
|
|
|
299
299
|
textareaRef: i,
|
|
300
300
|
isMultiLine: o
|
|
301
301
|
};
|
|
302
|
-
},
|
|
302
|
+
}, Oe = /* @__PURE__ */ function(e) {
|
|
303
303
|
return e.Idle = "idle", e.Recording = "recording", e.Error = "error", e;
|
|
304
|
-
}({}),
|
|
304
|
+
}({}), ke = [
|
|
305
305
|
"audio/webm;codecs=opus",
|
|
306
306
|
"audio/ogg;codecs=opus",
|
|
307
307
|
"audio/webm"
|
|
308
|
-
],
|
|
309
|
-
let [t, n] =
|
|
308
|
+
], Ae = () => ke.find((e) => MediaRecorder.isTypeSupported(e)) ?? "", je = ({ onAttachAudio: e }) => {
|
|
309
|
+
let [t, n] = H("idle"), [r, i] = H(null), a = V(null), o = V(null), s = V(null), c = V(null), l = V([]), u = V(""), d = V(e);
|
|
310
310
|
d.current = e;
|
|
311
|
-
let f =
|
|
311
|
+
let f = R(() => {
|
|
312
312
|
a.current &&= (a.current.getTracks().forEach((e) => e.stop()), null), o.current &&= (o.current.close(), null), s.current = null, c.current = null;
|
|
313
|
-
}, []), p =
|
|
313
|
+
}, []), p = R(() => {
|
|
314
314
|
(async () => {
|
|
315
315
|
try {
|
|
316
316
|
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
@@ -319,7 +319,7 @@ var Se = (e, t) => {
|
|
|
319
319
|
o.current = t;
|
|
320
320
|
let r = t.createAnalyser();
|
|
321
321
|
r.fftSize = 256, s.current = r, t.createMediaStreamSource(e).connect(r);
|
|
322
|
-
let i =
|
|
322
|
+
let i = Ae();
|
|
323
323
|
u.current = i, l.current = [];
|
|
324
324
|
let d = new MediaRecorder(e, i ? { mimeType: i } : void 0);
|
|
325
325
|
c.current = d, d.ondataavailable = (e) => {
|
|
@@ -329,17 +329,17 @@ var Se = (e, t) => {
|
|
|
329
329
|
i(e instanceof Error ? e.message : "Microphone access denied"), n("error");
|
|
330
330
|
}
|
|
331
331
|
})();
|
|
332
|
-
}, []), m =
|
|
332
|
+
}, []), m = R(() => {
|
|
333
333
|
let e = c.current;
|
|
334
334
|
!e || e.state !== "recording" || (e.onstop = () => {
|
|
335
335
|
let e = u.current || "audio/webm", t = new Blob(l.current, { type: e }), r = e.split(";")[0].split("/")[1] ?? "webm", a = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, -1), o = new File([t], `voice-${a}.${r}`, { type: e });
|
|
336
336
|
d.current(o), f(), i(null), n("idle");
|
|
337
337
|
}, e.stop());
|
|
338
|
-
}, [f]), h =
|
|
338
|
+
}, [f]), h = R(() => {
|
|
339
339
|
let e = c.current;
|
|
340
340
|
e && e.state === "recording" && (e.ondataavailable = null, e.onstop = null, e.stop()), f(), i(null), n("idle");
|
|
341
341
|
}, [f]);
|
|
342
|
-
return
|
|
342
|
+
return z(() => () => {
|
|
343
343
|
f();
|
|
344
344
|
}, [f]), {
|
|
345
345
|
state: t,
|
|
@@ -349,12 +349,12 @@ var Se = (e, t) => {
|
|
|
349
349
|
stopRecording: m,
|
|
350
350
|
discardRecording: h
|
|
351
351
|
};
|
|
352
|
-
},
|
|
352
|
+
}, Me = /* @__PURE__ */ function(e) {
|
|
353
353
|
return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
|
|
354
|
-
}({}),
|
|
354
|
+
}({}), Ne = {
|
|
355
355
|
item: "_item_1sr2n_1",
|
|
356
356
|
itemIcon: "_itemIcon_1sr2n_11"
|
|
357
|
-
},
|
|
357
|
+
}, Pe = ({ 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 }) => {
|
|
358
358
|
let m = (e) => {
|
|
359
359
|
e(), r();
|
|
360
360
|
}, h = a({
|
|
@@ -363,7 +363,7 @@ var Se = (e, t) => {
|
|
|
363
363
|
"--ci-sheet-item-active": p?.itemActiveBg,
|
|
364
364
|
"--ci-sheet-icon": p?.itemIcon
|
|
365
365
|
});
|
|
366
|
-
return /* @__PURE__ */
|
|
366
|
+
return /* @__PURE__ */ W(K, {
|
|
367
367
|
isOpen: e,
|
|
368
368
|
title: t,
|
|
369
369
|
closeLabel: n,
|
|
@@ -372,23 +372,23 @@ var Se = (e, t) => {
|
|
|
372
372
|
className: c,
|
|
373
373
|
titleClassName: u,
|
|
374
374
|
colors: p?.shell,
|
|
375
|
-
children: /* @__PURE__ */
|
|
375
|
+
children: /* @__PURE__ */ W("ul", {
|
|
376
376
|
role: "list",
|
|
377
377
|
className: "flex flex-col",
|
|
378
378
|
style: h,
|
|
379
|
-
children: s.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */
|
|
379
|
+
children: s.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ W("li", { children: /* @__PURE__ */ W(l, {
|
|
380
380
|
type: "button",
|
|
381
|
-
className: o(
|
|
382
|
-
iconBefore: /* @__PURE__ */
|
|
383
|
-
className:
|
|
381
|
+
className: o(Ne.item, "w-full gap-3 px-4 py-[10px] text-start"),
|
|
382
|
+
iconBefore: /* @__PURE__ */ W("span", {
|
|
383
|
+
className: Ne.itemIcon,
|
|
384
384
|
children: n
|
|
385
385
|
}),
|
|
386
|
-
iconAfter: r ? /* @__PURE__ */
|
|
386
|
+
iconAfter: r ? /* @__PURE__ */ W("span", {
|
|
387
387
|
className: "ms-auto",
|
|
388
388
|
children: r
|
|
389
389
|
}) : null,
|
|
390
390
|
textClassName: f,
|
|
391
|
-
label: /* @__PURE__ */
|
|
391
|
+
label: /* @__PURE__ */ W("span", {
|
|
392
392
|
className: d,
|
|
393
393
|
children: t
|
|
394
394
|
}),
|
|
@@ -396,9 +396,9 @@ var Se = (e, t) => {
|
|
|
396
396
|
}) }, e))
|
|
397
397
|
})
|
|
398
398
|
});
|
|
399
|
-
},
|
|
400
|
-
let [s, c] =
|
|
401
|
-
|
|
399
|
+
}, Fe = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
400
|
+
let [s, c] = H(t), [l, u] = H(n), [d, f] = H(r), p = V(o);
|
|
401
|
+
z(() => {
|
|
402
402
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
403
403
|
}, [
|
|
404
404
|
o,
|
|
@@ -415,7 +415,7 @@ var Se = (e, t) => {
|
|
|
415
415
|
setResponseFormat: c,
|
|
416
416
|
setSystemPrompt: u,
|
|
417
417
|
setTemperature: f,
|
|
418
|
-
handleSubmit:
|
|
418
|
+
handleSubmit: R(() => {
|
|
419
419
|
if (!m) return;
|
|
420
420
|
let t = {};
|
|
421
421
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -429,17 +429,17 @@ var Se = (e, t) => {
|
|
|
429
429
|
a
|
|
430
430
|
])
|
|
431
431
|
};
|
|
432
|
-
},
|
|
432
|
+
}, Ie = { label: "_label_14i7c_1" }, Le = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: s, onSystemPromptChange: c, onTemperatureChange: l, responseFormatLabel: u = "Response format", responseFormatHint: d = "Applies to new and existing messages", responseFormatMarkdownLabel: f = "Markdown", responseFormatPlainTextLabel: p = "Plain text", systemPromptLabel: h = "System prompt", systemPromptTooltip: g = "Enter a prompt", temperatureLabel: _ = "Temperature", temperatureLabels: v = [
|
|
433
433
|
"Precise",
|
|
434
434
|
"Neutral",
|
|
435
435
|
"Creative"
|
|
436
436
|
], temperatureHint: y, labelClassName: b = "!dial-small-semi-text", colors: x }) => {
|
|
437
|
-
let S = a({ "--csf-label-text": x?.labelText }), C = o(b,
|
|
438
|
-
return /* @__PURE__ */
|
|
437
|
+
let S = a({ "--csf-label-text": x?.labelText }), C = o(b, Ie.label, "gap-1");
|
|
438
|
+
return /* @__PURE__ */ G("div", {
|
|
439
439
|
className: "flex flex-col gap-4 px-6 pb-3",
|
|
440
440
|
style: S,
|
|
441
441
|
children: [
|
|
442
|
-
e.responseFormat && /* @__PURE__ */
|
|
442
|
+
e.responseFormat && /* @__PURE__ */ W(T, {
|
|
443
443
|
id: "response-format",
|
|
444
444
|
labelProps: {
|
|
445
445
|
label: u,
|
|
@@ -447,18 +447,18 @@ var Se = (e, t) => {
|
|
|
447
447
|
caption: d
|
|
448
448
|
},
|
|
449
449
|
optionsClassName: "mb-2",
|
|
450
|
-
orientation:
|
|
450
|
+
orientation: E.Column,
|
|
451
451
|
value: t ?? i.Markdown,
|
|
452
452
|
items: [{
|
|
453
453
|
value: i.Markdown,
|
|
454
454
|
label: f
|
|
455
455
|
}, {
|
|
456
456
|
value: i.PlainText,
|
|
457
|
-
label:
|
|
457
|
+
label: p
|
|
458
458
|
}],
|
|
459
459
|
onChange: (e) => s(e)
|
|
460
460
|
}),
|
|
461
|
-
e.systemPrompt && /* @__PURE__ */
|
|
461
|
+
e.systemPrompt && /* @__PURE__ */ W(ee, {
|
|
462
462
|
value: n,
|
|
463
463
|
placeholder: g,
|
|
464
464
|
resize: !0,
|
|
@@ -468,7 +468,7 @@ var Se = (e, t) => {
|
|
|
468
468
|
},
|
|
469
469
|
onChange: (e) => c(e ?? "")
|
|
470
470
|
}),
|
|
471
|
-
e.temperature && /* @__PURE__ */
|
|
471
|
+
e.temperature && /* @__PURE__ */ W(m, {
|
|
472
472
|
labelProps: {
|
|
473
473
|
label: _,
|
|
474
474
|
className: C,
|
|
@@ -483,8 +483,8 @@ var Se = (e, t) => {
|
|
|
483
483
|
})
|
|
484
484
|
]
|
|
485
485
|
});
|
|
486
|
-
},
|
|
487
|
-
let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat: k, setSystemPrompt: A, setTemperature: ee, handleSubmit: te } =
|
|
486
|
+
}, Re = ({ 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 }) => {
|
|
487
|
+
let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat: k, setSystemPrompt: A, setTemperature: ee, handleSubmit: te } = Fe({
|
|
488
488
|
isOpen: e,
|
|
489
489
|
features: s,
|
|
490
490
|
initialResponseFormat: c,
|
|
@@ -493,7 +493,7 @@ var Se = (e, t) => {
|
|
|
493
493
|
onSave: d,
|
|
494
494
|
onClose: r
|
|
495
495
|
});
|
|
496
|
-
return /* @__PURE__ */ K
|
|
496
|
+
return /* @__PURE__ */ G(K, {
|
|
497
497
|
isOpen: e,
|
|
498
498
|
title: f,
|
|
499
499
|
closeLabel: i,
|
|
@@ -501,7 +501,7 @@ var Se = (e, t) => {
|
|
|
501
501
|
onBack: t,
|
|
502
502
|
backLabel: n,
|
|
503
503
|
style: a,
|
|
504
|
-
children: [/* @__PURE__ */
|
|
504
|
+
children: [/* @__PURE__ */ W(Le, {
|
|
505
505
|
features: s,
|
|
506
506
|
responseFormat: T,
|
|
507
507
|
systemPrompt: E,
|
|
@@ -518,14 +518,14 @@ var Se = (e, t) => {
|
|
|
518
518
|
temperatureLabel: y,
|
|
519
519
|
temperatureLabels: b,
|
|
520
520
|
temperatureHint: x
|
|
521
|
-
}), /* @__PURE__ */
|
|
521
|
+
}), /* @__PURE__ */ W("div", {
|
|
522
522
|
className: o("px-6 py-4 mobile:pb-8"),
|
|
523
|
-
children: /* @__PURE__ */
|
|
523
|
+
children: /* @__PURE__ */ W(j, {
|
|
524
524
|
tooltip: w,
|
|
525
525
|
hideTooltip: O || !w,
|
|
526
526
|
triggerClassName: "w-full",
|
|
527
|
-
children: /* @__PURE__ */
|
|
528
|
-
label:
|
|
527
|
+
children: /* @__PURE__ */ W(C, {
|
|
528
|
+
label: S,
|
|
529
529
|
onClick: te,
|
|
530
530
|
disabled: !O,
|
|
531
531
|
className: "w-full"
|
|
@@ -533,8 +533,8 @@ var Se = (e, t) => {
|
|
|
533
533
|
})
|
|
534
534
|
})]
|
|
535
535
|
});
|
|
536
|
-
},
|
|
537
|
-
let { responseFormat:
|
|
536
|
+
}, ze = { modal: "_modal_kl0h0_1" }, Be = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", titleClassName: s = "dial-h1-text", responseFormatLabel: c, responseFormatHint: l, responseFormatMarkdownLabel: u, responseFormatPlainTextLabel: d, systemPromptLabel: f, systemPromptTooltip: p, temperatureLabel: m, temperatureLabels: h, temperatureHint: g, saveLabel: _ = "Apply changes", saveDisabledTooltip: v, backgroundClassName: y = ze.modal }) => {
|
|
537
|
+
let { responseFormat: b, systemPrompt: w, temperature: T, canSubmit: E, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit: A } = Fe({
|
|
538
538
|
features: e,
|
|
539
539
|
initialResponseFormat: t,
|
|
540
540
|
initialSystemPrompt: n,
|
|
@@ -542,28 +542,28 @@ var Se = (e, t) => {
|
|
|
542
542
|
onSave: i,
|
|
543
543
|
onClose: a
|
|
544
544
|
});
|
|
545
|
-
return /* @__PURE__ */
|
|
545
|
+
return /* @__PURE__ */ W(x, {
|
|
546
546
|
open: !0,
|
|
547
547
|
header: o,
|
|
548
548
|
titleClassName: s,
|
|
549
|
-
size:
|
|
549
|
+
size: S.Sm,
|
|
550
550
|
onClose: a,
|
|
551
551
|
className: y,
|
|
552
|
-
footer: /* @__PURE__ */
|
|
552
|
+
footer: /* @__PURE__ */ W("div", {
|
|
553
553
|
className: "flex justify-end px-6 py-4",
|
|
554
|
-
children: /* @__PURE__ */
|
|
554
|
+
children: /* @__PURE__ */ W(j, {
|
|
555
555
|
tooltip: v,
|
|
556
556
|
hideTooltip: E || !v,
|
|
557
|
-
children: /* @__PURE__ */
|
|
557
|
+
children: /* @__PURE__ */ W(C, {
|
|
558
558
|
label: _,
|
|
559
559
|
onClick: A,
|
|
560
560
|
disabled: !E
|
|
561
561
|
})
|
|
562
562
|
})
|
|
563
563
|
}),
|
|
564
|
-
children: /* @__PURE__ */
|
|
564
|
+
children: /* @__PURE__ */ W(Le, {
|
|
565
565
|
features: e,
|
|
566
|
-
responseFormat:
|
|
566
|
+
responseFormat: b,
|
|
567
567
|
systemPrompt: w,
|
|
568
568
|
temperature: T,
|
|
569
569
|
onResponseFormatChange: D,
|
|
@@ -581,11 +581,11 @@ var Se = (e, t) => {
|
|
|
581
581
|
})
|
|
582
582
|
});
|
|
583
583
|
};
|
|
584
|
-
|
|
585
|
-
var
|
|
584
|
+
L(Be);
|
|
585
|
+
var Ve = {
|
|
586
586
|
icon: "_icon_1fv6z_1",
|
|
587
587
|
selectedIcon: "_selectedIcon_1fv6z_5"
|
|
588
|
-
},
|
|
588
|
+
}, He = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: s, title: u = "Tools", items: d, onToolToggle: p, itemLabelClassName: m = "dial-small-text", colors: h }) => /* @__PURE__ */ W(K, {
|
|
589
589
|
isOpen: e,
|
|
590
590
|
title: u,
|
|
591
591
|
closeLabel: i,
|
|
@@ -593,141 +593,147 @@ var We = {
|
|
|
593
593
|
onBack: t,
|
|
594
594
|
backLabel: n,
|
|
595
595
|
style: s,
|
|
596
|
-
children: /* @__PURE__ */
|
|
596
|
+
children: /* @__PURE__ */ W("ul", {
|
|
597
597
|
role: "menu",
|
|
598
598
|
className: "flex flex-col pb-4",
|
|
599
599
|
style: a({
|
|
600
|
-
"--tbs-icon-text":
|
|
601
|
-
"--tbs-selected-icon-text":
|
|
600
|
+
"--tbs-icon-text": h?.iconText,
|
|
601
|
+
"--tbs-selected-icon-text": h?.selectedIconText
|
|
602
602
|
}),
|
|
603
|
-
children: d.map((e) => /* @__PURE__ */
|
|
603
|
+
children: d.map((e) => /* @__PURE__ */ W("li", {
|
|
604
604
|
role: "none",
|
|
605
|
-
children: /* @__PURE__ */
|
|
605
|
+
children: /* @__PURE__ */ W(l, {
|
|
606
606
|
type: "button",
|
|
607
607
|
role: "menuitemcheckbox",
|
|
608
608
|
"aria-checked": e.isSelected,
|
|
609
609
|
className: "w-full gap-3 px-4 py-[10px] text-start",
|
|
610
|
-
iconBefore: /* @__PURE__ */
|
|
611
|
-
className: o("flex items-center",
|
|
610
|
+
iconBefore: /* @__PURE__ */ W("span", {
|
|
611
|
+
className: o("flex items-center", Ve.icon),
|
|
612
612
|
children: e.icon
|
|
613
613
|
}),
|
|
614
|
-
iconAfter: e.isSelected ? /* @__PURE__ */
|
|
615
|
-
className: o("ms-auto",
|
|
616
|
-
children: /* @__PURE__ */
|
|
614
|
+
iconAfter: e.isSelected ? /* @__PURE__ */ W("span", {
|
|
615
|
+
className: o("ms-auto", Ve.selectedIcon),
|
|
616
|
+
children: /* @__PURE__ */ W(M, {
|
|
617
617
|
size: c,
|
|
618
|
-
"aria-hidden": !0
|
|
618
|
+
"aria-hidden": !0,
|
|
619
|
+
stroke: f
|
|
619
620
|
})
|
|
620
621
|
}) : null,
|
|
621
|
-
label: /* @__PURE__ */
|
|
622
|
-
className:
|
|
622
|
+
label: /* @__PURE__ */ W("span", {
|
|
623
|
+
className: m,
|
|
623
624
|
children: e.label
|
|
624
625
|
}),
|
|
625
|
-
onClick: () =>
|
|
626
|
+
onClick: () => p(e.id)
|
|
626
627
|
})
|
|
627
628
|
}, e.id))
|
|
628
629
|
})
|
|
629
|
-
}),
|
|
630
|
+
}), Ue = {
|
|
630
631
|
selectedToolIcon: "_selectedToolIcon_r268y_1",
|
|
631
632
|
toolIcon: "_toolIcon_r268y_5",
|
|
632
633
|
chevronIcon: "_chevronIcon_r268y_9"
|
|
633
|
-
},
|
|
634
|
-
let
|
|
635
|
-
"--aab-selected-tool-icon":
|
|
636
|
-
"--aab-tool-icon":
|
|
637
|
-
"--aab-chevron-icon":
|
|
634
|
+
}, We = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, menuCloseLabel: l, style: u, listClassName: p = "w-[240px]", isDisabled: m = !1, chatSettings: _, extraMenuItems: y, toolsMenuItems: b = [], onToolToggle: x, toolsMenuTitle: S = "Tools", toolsBackLabel: C = "Back", promptsMenuOverlay: w, promptsMenuTitle: T = "Prompts", promptsBackLabel: E = "Back", colors: D }) => {
|
|
635
|
+
let O = s(), [k, A] = H(!1), [ee, j] = H(!1), [te, ne] = H(!1), [re, ie] = H(!1), [ae, P] = H(!1), F = B(() => a({
|
|
636
|
+
"--aab-selected-tool-icon": D?.selectedToolIcon,
|
|
637
|
+
"--aab-tool-icon": D?.toolIcon,
|
|
638
|
+
"--aab-chevron-icon": D?.chevronIcon
|
|
638
639
|
}), [
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
]),
|
|
640
|
+
D?.selectedToolIcon,
|
|
641
|
+
D?.toolIcon,
|
|
642
|
+
D?.chevronIcon
|
|
643
|
+
]), de = b.length > 0 && x != null, fe = B(() => b.map((e) => ({
|
|
643
644
|
key: e.id,
|
|
644
|
-
label: /* @__PURE__ */
|
|
645
|
+
label: /* @__PURE__ */ G("span", {
|
|
645
646
|
className: "flex flex-1 items-center gap-2",
|
|
646
|
-
children: [/* @__PURE__ */
|
|
647
|
+
children: [/* @__PURE__ */ W("span", {
|
|
647
648
|
className: "flex-1",
|
|
648
649
|
children: e.label
|
|
649
|
-
}), e.isSelected && /* @__PURE__ */
|
|
650
|
+
}), e.isSelected && /* @__PURE__ */ W(M, {
|
|
650
651
|
size: c,
|
|
651
652
|
style: F,
|
|
652
|
-
className:
|
|
653
|
-
"aria-hidden": !0
|
|
653
|
+
className: Ue.selectedToolIcon,
|
|
654
|
+
"aria-hidden": !0,
|
|
655
|
+
stroke: f
|
|
654
656
|
})]
|
|
655
657
|
}),
|
|
656
|
-
icon: /* @__PURE__ */
|
|
658
|
+
icon: /* @__PURE__ */ W("span", {
|
|
657
659
|
style: F,
|
|
658
|
-
className: o("flex items-center",
|
|
660
|
+
className: o("flex items-center", Ue.toolIcon),
|
|
659
661
|
children: e.icon
|
|
660
662
|
}),
|
|
661
|
-
onClick: () =>
|
|
663
|
+
onClick: () => x?.(e.id)
|
|
662
664
|
})), [
|
|
663
|
-
y,
|
|
664
665
|
b,
|
|
666
|
+
x,
|
|
665
667
|
F
|
|
666
|
-
]),
|
|
668
|
+
]), I = B(() => [
|
|
667
669
|
...e == null ? [] : [{
|
|
668
670
|
key: "attach",
|
|
669
671
|
label: t,
|
|
670
|
-
icon: /* @__PURE__ */
|
|
672
|
+
icon: /* @__PURE__ */ W(oe, {
|
|
671
673
|
size: c,
|
|
672
|
-
"aria-hidden": !0
|
|
674
|
+
"aria-hidden": !0,
|
|
675
|
+
stroke: f
|
|
673
676
|
}),
|
|
674
677
|
onClick: e
|
|
675
678
|
}],
|
|
676
|
-
...
|
|
677
|
-
...
|
|
679
|
+
...y ?? [],
|
|
680
|
+
...de ? [{
|
|
678
681
|
key: "tools",
|
|
679
|
-
label:
|
|
680
|
-
icon: /* @__PURE__ */
|
|
682
|
+
label: S,
|
|
683
|
+
icon: /* @__PURE__ */ W(ue, {
|
|
681
684
|
size: c,
|
|
682
|
-
"aria-hidden": !0
|
|
685
|
+
"aria-hidden": !0,
|
|
686
|
+
stroke: f
|
|
683
687
|
}),
|
|
684
|
-
onClick:
|
|
685
|
-
|
|
688
|
+
onClick: O ? () => {
|
|
689
|
+
ne(!0), A(!1);
|
|
686
690
|
} : () => void 0,
|
|
687
|
-
...
|
|
691
|
+
...O ? { iconAfter: /* @__PURE__ */ W(N, {
|
|
688
692
|
size: c,
|
|
689
|
-
stroke:
|
|
693
|
+
stroke: f,
|
|
690
694
|
style: F,
|
|
691
|
-
className: o("rtl:scale-x-[-1]",
|
|
695
|
+
className: o("rtl:scale-x-[-1]", Ue.chevronIcon),
|
|
692
696
|
"aria-hidden": !0
|
|
693
|
-
}) } : { children:
|
|
697
|
+
}) } : { children: fe }
|
|
694
698
|
}] : [],
|
|
695
|
-
...
|
|
699
|
+
...w == null ? [] : [{
|
|
696
700
|
key: "prompts",
|
|
697
|
-
label:
|
|
698
|
-
icon: /* @__PURE__ */
|
|
701
|
+
label: T,
|
|
702
|
+
icon: /* @__PURE__ */ W(ce, {
|
|
699
703
|
size: c,
|
|
700
|
-
"aria-hidden": !0
|
|
704
|
+
"aria-hidden": !0,
|
|
705
|
+
stroke: f
|
|
701
706
|
}),
|
|
702
|
-
onClick:
|
|
703
|
-
|
|
707
|
+
onClick: O ? () => {
|
|
708
|
+
ie(!0), A(!1);
|
|
704
709
|
} : () => void 0,
|
|
705
|
-
...
|
|
710
|
+
...O ? { iconAfter: /* @__PURE__ */ W(N, {
|
|
706
711
|
size: c,
|
|
707
|
-
stroke:
|
|
712
|
+
stroke: f,
|
|
708
713
|
style: F,
|
|
709
|
-
className: o("rtl:scale-x-[-1]",
|
|
714
|
+
className: o("rtl:scale-x-[-1]", Ue.chevronIcon),
|
|
710
715
|
"aria-hidden": !0
|
|
711
716
|
}) } : {
|
|
712
717
|
children: [{
|
|
713
718
|
key: "prompts-panel",
|
|
714
719
|
label: ""
|
|
715
720
|
}],
|
|
716
|
-
renderSubMenu: () =>
|
|
721
|
+
renderSubMenu: () => w(() => P(!1))
|
|
717
722
|
}
|
|
718
723
|
}],
|
|
719
|
-
...
|
|
724
|
+
..._ == null ? [] : [{
|
|
720
725
|
key: "chat-settings",
|
|
721
|
-
label:
|
|
722
|
-
icon: /* @__PURE__ */
|
|
726
|
+
label: _.menuItemLabel ?? "Chat settings",
|
|
727
|
+
icon: /* @__PURE__ */ W(le, {
|
|
723
728
|
size: c,
|
|
724
|
-
"aria-hidden": !0
|
|
729
|
+
"aria-hidden": !0,
|
|
730
|
+
stroke: f
|
|
725
731
|
}),
|
|
726
|
-
iconAfter:
|
|
732
|
+
iconAfter: O ? /* @__PURE__ */ W(N, {
|
|
727
733
|
size: c,
|
|
728
|
-
stroke:
|
|
734
|
+
stroke: f,
|
|
729
735
|
style: F,
|
|
730
|
-
className: o("rtl:scale-x-[-1]",
|
|
736
|
+
className: o("rtl:scale-x-[-1]", Ue.chevronIcon),
|
|
731
737
|
"aria-hidden": !0
|
|
732
738
|
}) : null,
|
|
733
739
|
onClick: () => j(!0)
|
|
@@ -735,228 +741,213 @@ var We = {
|
|
|
735
741
|
], [
|
|
736
742
|
t,
|
|
737
743
|
e,
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
C,
|
|
744
|
+
_,
|
|
745
|
+
y,
|
|
746
|
+
O,
|
|
747
|
+
de,
|
|
748
|
+
S,
|
|
749
|
+
fe,
|
|
745
750
|
w,
|
|
751
|
+
T,
|
|
746
752
|
F
|
|
747
753
|
]);
|
|
748
|
-
if (
|
|
749
|
-
let
|
|
754
|
+
if (I.length === 0) return null;
|
|
755
|
+
let L = /* @__PURE__ */ W(h, {
|
|
750
756
|
matchReferenceWidth: !1,
|
|
751
757
|
placement: "bottom-start",
|
|
752
|
-
listClassName:
|
|
753
|
-
items:
|
|
754
|
-
open:
|
|
755
|
-
onOpenChange:
|
|
756
|
-
children: /* @__PURE__ */
|
|
757
|
-
icon: /* @__PURE__ */
|
|
758
|
+
listClassName: p,
|
|
759
|
+
items: I,
|
|
760
|
+
open: w == null ? void 0 : ae,
|
|
761
|
+
onOpenChange: w == null ? void 0 : P,
|
|
762
|
+
children: /* @__PURE__ */ W(v, {
|
|
763
|
+
icon: /* @__PURE__ */ W(se, {
|
|
758
764
|
size: d.LG,
|
|
759
|
-
"aria-hidden": !0
|
|
765
|
+
"aria-hidden": !0,
|
|
766
|
+
stroke: f
|
|
760
767
|
}),
|
|
761
768
|
"aria-label": n,
|
|
762
769
|
tooltipProps: { tooltip: n },
|
|
763
|
-
disabled:
|
|
770
|
+
disabled: m
|
|
764
771
|
})
|
|
765
772
|
});
|
|
766
|
-
return /* @__PURE__ */
|
|
767
|
-
/* @__PURE__ */
|
|
768
|
-
icon: /* @__PURE__ */
|
|
773
|
+
return /* @__PURE__ */ W(U, { children: O ? /* @__PURE__ */ G(U, { children: [
|
|
774
|
+
/* @__PURE__ */ W(v, {
|
|
775
|
+
icon: /* @__PURE__ */ W(se, {
|
|
769
776
|
size: d.LG,
|
|
770
|
-
"aria-hidden": !0
|
|
777
|
+
"aria-hidden": !0,
|
|
778
|
+
stroke: f
|
|
771
779
|
}),
|
|
772
780
|
"aria-label": n,
|
|
773
|
-
size:
|
|
781
|
+
size: g.Large,
|
|
774
782
|
tooltipProps: { tooltip: n },
|
|
775
|
-
disabled:
|
|
776
|
-
onClick: () =>
|
|
783
|
+
disabled: m,
|
|
784
|
+
onClick: () => A(!0)
|
|
777
785
|
}),
|
|
778
|
-
/* @__PURE__ */
|
|
779
|
-
isOpen:
|
|
786
|
+
/* @__PURE__ */ W(Pe, {
|
|
787
|
+
isOpen: k,
|
|
780
788
|
title: r,
|
|
781
789
|
closeLabel: l,
|
|
782
|
-
onClose: () =>
|
|
790
|
+
onClose: () => A(!1),
|
|
783
791
|
style: u,
|
|
784
|
-
items:
|
|
792
|
+
items: I,
|
|
785
793
|
className: "pb-4",
|
|
786
794
|
btnTextClassName: "flex-1"
|
|
787
795
|
}),
|
|
788
|
-
|
|
789
|
-
isOpen:
|
|
796
|
+
de && /* @__PURE__ */ W(He, {
|
|
797
|
+
isOpen: te,
|
|
790
798
|
onBack: () => {
|
|
791
|
-
|
|
799
|
+
ne(!1), A(!0);
|
|
792
800
|
},
|
|
793
|
-
backLabel:
|
|
794
|
-
onClose: () =>
|
|
801
|
+
backLabel: C,
|
|
802
|
+
onClose: () => ne(!1),
|
|
795
803
|
closeLabel: l,
|
|
796
804
|
style: u,
|
|
797
|
-
title:
|
|
798
|
-
items:
|
|
799
|
-
onToolToggle:
|
|
805
|
+
title: S,
|
|
806
|
+
items: b,
|
|
807
|
+
onToolToggle: x
|
|
800
808
|
}),
|
|
801
|
-
|
|
802
|
-
isOpen:
|
|
803
|
-
title:
|
|
809
|
+
w != null && /* @__PURE__ */ W(K, {
|
|
810
|
+
isOpen: re,
|
|
811
|
+
title: T,
|
|
804
812
|
closeLabel: l,
|
|
805
813
|
onBack: () => {
|
|
806
|
-
|
|
814
|
+
ie(!1), A(!0);
|
|
807
815
|
},
|
|
808
|
-
backLabel:
|
|
809
|
-
onClose: () =>
|
|
816
|
+
backLabel: E,
|
|
817
|
+
onClose: () => ie(!1),
|
|
810
818
|
style: u,
|
|
811
|
-
children:
|
|
819
|
+
children: w(() => ie(!1))
|
|
812
820
|
}),
|
|
813
|
-
|
|
814
|
-
isOpen:
|
|
821
|
+
_ != null && /* @__PURE__ */ W(Re, {
|
|
822
|
+
isOpen: ee,
|
|
815
823
|
onBack: () => {
|
|
816
|
-
j(!1),
|
|
824
|
+
j(!1), A(!0);
|
|
817
825
|
},
|
|
818
|
-
backLabel:
|
|
826
|
+
backLabel: _.backLabel ?? "Back",
|
|
819
827
|
onClose: () => j(!1),
|
|
820
828
|
closeLabel: l,
|
|
821
829
|
style: u,
|
|
822
|
-
features:
|
|
823
|
-
initialResponseFormat:
|
|
824
|
-
initialSystemPrompt:
|
|
825
|
-
initialTemperature:
|
|
826
|
-
onSave:
|
|
827
|
-
title:
|
|
828
|
-
responseFormatLabel:
|
|
829
|
-
responseFormatHint:
|
|
830
|
-
responseFormatMarkdownLabel:
|
|
831
|
-
responseFormatPlainTextLabel:
|
|
832
|
-
systemPromptLabel:
|
|
833
|
-
systemPromptTooltip:
|
|
834
|
-
temperatureLabel:
|
|
835
|
-
temperatureLabels:
|
|
836
|
-
temperatureHint:
|
|
837
|
-
saveLabel:
|
|
838
|
-
saveDisabledTooltip:
|
|
830
|
+
features: _.features,
|
|
831
|
+
initialResponseFormat: _.responseFormat ?? i.Markdown,
|
|
832
|
+
initialSystemPrompt: _.systemPrompt,
|
|
833
|
+
initialTemperature: _.temperature,
|
|
834
|
+
onSave: _.onSave,
|
|
835
|
+
title: _.title,
|
|
836
|
+
responseFormatLabel: _.responseFormatLabel,
|
|
837
|
+
responseFormatHint: _.responseFormatHint,
|
|
838
|
+
responseFormatMarkdownLabel: _.responseFormatMarkdownLabel,
|
|
839
|
+
responseFormatPlainTextLabel: _.responseFormatPlainTextLabel,
|
|
840
|
+
systemPromptLabel: _.systemPromptLabel,
|
|
841
|
+
systemPromptTooltip: _.systemPromptTooltip,
|
|
842
|
+
temperatureLabel: _.temperatureLabel,
|
|
843
|
+
temperatureLabels: _.temperatureLabels,
|
|
844
|
+
temperatureHint: _.temperatureHint,
|
|
845
|
+
saveLabel: _.saveLabel,
|
|
846
|
+
saveDisabledTooltip: _.saveDisabledTooltip
|
|
839
847
|
})
|
|
840
|
-
] }) : /* @__PURE__ */
|
|
841
|
-
features:
|
|
842
|
-
initialResponseFormat:
|
|
843
|
-
initialSystemPrompt:
|
|
844
|
-
initialTemperature:
|
|
845
|
-
onSave:
|
|
848
|
+
] }) : /* @__PURE__ */ G(U, { children: [L, _ != null && ee && /* @__PURE__ */ W(Be, {
|
|
849
|
+
features: _.features,
|
|
850
|
+
initialResponseFormat: _.responseFormat ?? i.Markdown,
|
|
851
|
+
initialSystemPrompt: _.systemPrompt,
|
|
852
|
+
initialTemperature: _.temperature,
|
|
853
|
+
onSave: _.onSave,
|
|
846
854
|
onClose: () => j(!1),
|
|
847
|
-
title:
|
|
848
|
-
responseFormatLabel:
|
|
849
|
-
responseFormatHint:
|
|
850
|
-
responseFormatMarkdownLabel:
|
|
851
|
-
responseFormatPlainTextLabel:
|
|
852
|
-
systemPromptLabel:
|
|
853
|
-
systemPromptTooltip:
|
|
854
|
-
temperatureLabel:
|
|
855
|
-
temperatureLabels:
|
|
856
|
-
temperatureHint:
|
|
857
|
-
saveLabel:
|
|
858
|
-
saveDisabledTooltip:
|
|
855
|
+
title: _.title,
|
|
856
|
+
responseFormatLabel: _.responseFormatLabel,
|
|
857
|
+
responseFormatHint: _.responseFormatHint,
|
|
858
|
+
responseFormatMarkdownLabel: _.responseFormatMarkdownLabel,
|
|
859
|
+
responseFormatPlainTextLabel: _.responseFormatPlainTextLabel,
|
|
860
|
+
systemPromptLabel: _.systemPromptLabel,
|
|
861
|
+
systemPromptTooltip: _.systemPromptTooltip,
|
|
862
|
+
temperatureLabel: _.temperatureLabel,
|
|
863
|
+
temperatureLabels: _.temperatureLabels,
|
|
864
|
+
temperatureHint: _.temperatureHint,
|
|
865
|
+
saveLabel: _.saveLabel,
|
|
866
|
+
saveDisabledTooltip: _.saveDisabledTooltip
|
|
859
867
|
})] }) });
|
|
860
|
-
},
|
|
861
|
-
chip: "
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
"--ci-chip-bg":
|
|
870
|
-
"--ci-chip-border":
|
|
871
|
-
"--ci-chip-icon":
|
|
872
|
-
"--ci-chip-text":
|
|
873
|
-
"--ci-chip-
|
|
874
|
-
"--ci-chip-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
868
|
+
}, q = {
|
|
869
|
+
chip: "_chip_ydmd8_1",
|
|
870
|
+
chipSelected: "_chipSelected_ydmd8_9",
|
|
871
|
+
chipIcon: "_chipIcon_ydmd8_16",
|
|
872
|
+
chipText: "_chipText_ydmd8_19",
|
|
873
|
+
chipClose: "_chipClose_ydmd8_22"
|
|
874
|
+
}, Ge = (e) => `Remove ${e}`, Ke = ({ items: e, onToolToggle: t, onToolDismiss: n, removeLabel: r = Ge, typography: i, colors: s }) => e.length === 0 ? null : /* @__PURE__ */ W("div", {
|
|
875
|
+
className: "flex flex-wrap items-center gap-2",
|
|
876
|
+
style: a({
|
|
877
|
+
"--ci-chip-bg": s?.chipBg,
|
|
878
|
+
"--ci-chip-border": s?.chipBorder,
|
|
879
|
+
"--ci-chip-icon": s?.chipIcon,
|
|
880
|
+
"--ci-chip-text": s?.chipText,
|
|
881
|
+
"--ci-chip-hover-bg": s?.chipHoverBg,
|
|
882
|
+
"--ci-chip-selected-bg": s?.chipSelectedBg,
|
|
883
|
+
"--ci-chip-selected-border": s?.chipSelectedBorder,
|
|
884
|
+
"--ci-chip-selected-icon": s?.chipSelectedIcon,
|
|
885
|
+
"--ci-chip-selected-text": s?.chipSelectedText,
|
|
886
|
+
"--ci-chip-close": s?.chipClose,
|
|
887
|
+
"--ci-chip-close-hover": s?.chipCloseHover
|
|
888
|
+
}),
|
|
889
|
+
children: e.map((e) => /* @__PURE__ */ G("div", {
|
|
890
|
+
className: o(q.chip, e.isSelected && q.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 pe-1 ps-2 transition-colors"),
|
|
891
|
+
children: [/* @__PURE__ */ G("button", {
|
|
892
|
+
type: "button",
|
|
893
|
+
onClick: () => t(e.id),
|
|
894
|
+
"aria-pressed": e.isSelected,
|
|
895
|
+
className: "flex min-w-0 items-center gap-1.5",
|
|
896
|
+
children: [/* @__PURE__ */ W("span", {
|
|
897
|
+
className: o(q.chipIcon, "shrink-0"),
|
|
898
|
+
"aria-hidden": !0,
|
|
899
|
+
children: e.icon
|
|
900
|
+
}), /* @__PURE__ */ W("span", {
|
|
901
|
+
className: o(q.chipText, i?.fontClassName || "dial-small-paragraph-text", "truncate"),
|
|
902
|
+
children: e.label
|
|
903
|
+
})]
|
|
904
|
+
}), /* @__PURE__ */ W("button", {
|
|
905
|
+
type: "button",
|
|
906
|
+
onClick: () => n(e.id),
|
|
907
|
+
"aria-label": r(e.label),
|
|
908
|
+
className: o(q.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
|
|
909
|
+
children: /* @__PURE__ */ W(de, {
|
|
910
|
+
size: 12,
|
|
911
|
+
"aria-hidden": !0,
|
|
912
|
+
stroke: f
|
|
894
913
|
})
|
|
895
|
-
})
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
className: "flex flex-wrap items-center gap-2",
|
|
899
|
-
style: d,
|
|
900
|
-
children: u.map((e) => /* @__PURE__ */ K("div", {
|
|
901
|
-
className: o(J.chip, "flex items-center gap-1.5 rounded-full border py-1 pe-1 ps-2"),
|
|
902
|
-
children: [
|
|
903
|
-
/* @__PURE__ */ G("span", {
|
|
904
|
-
className: J.chipIcon,
|
|
905
|
-
"aria-hidden": !0,
|
|
906
|
-
children: e.icon
|
|
907
|
-
}),
|
|
908
|
-
/* @__PURE__ */ G("span", {
|
|
909
|
-
className: o(J.chipText, s?.fontClassName || "dial-small-paragraph-text"),
|
|
910
|
-
children: e.label
|
|
911
|
-
}),
|
|
912
|
-
/* @__PURE__ */ G("button", {
|
|
913
|
-
type: "button",
|
|
914
|
-
onClick: () => t(e.id),
|
|
915
|
-
className: o(J.chipClose, "flex items-center rounded p-0.5 transition-colors"),
|
|
916
|
-
"aria-label": i(e.label),
|
|
917
|
-
children: /* @__PURE__ */ G(I, {
|
|
918
|
-
size: 12,
|
|
919
|
-
"aria-hidden": !0
|
|
920
|
-
})
|
|
921
|
-
})
|
|
922
|
-
]
|
|
923
|
-
}, e.id))
|
|
924
|
-
});
|
|
925
|
-
}, Y = {
|
|
914
|
+
})]
|
|
915
|
+
}, e.id))
|
|
916
|
+
}), J = {
|
|
926
917
|
wrapper: "_wrapper_15jsc_1",
|
|
927
918
|
wrapperDisabled: "_wrapperDisabled_15jsc_8",
|
|
928
919
|
textarea: "_textarea_15jsc_13",
|
|
929
920
|
modelSelectorButton: "_modelSelectorButton_15jsc_24",
|
|
930
921
|
modelSelectorCaret: "_modelSelectorCaret_15jsc_24",
|
|
931
922
|
modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_15jsc_33"
|
|
932
|
-
},
|
|
923
|
+
}, qe = {
|
|
933
924
|
wrapperError: "_wrapperError_129ri_1",
|
|
934
925
|
waveformCanvas: "_waveformCanvas_129ri_5",
|
|
935
926
|
recordingDot: "_recordingDot_129ri_19",
|
|
936
927
|
"recording-pulse": "_recording-pulse_129ri_1"
|
|
937
|
-
},
|
|
938
|
-
let u =
|
|
928
|
+
}, Je = 3, Ye = 4, Y = 200, Xe = ({ state: e, analyserNodeRef: t, errorMessage: n, onStop: r, onDiscard: i, stopLabel: a = "Stop recording", discardLabel: s = "Discard recording", style: c, className: l }) => {
|
|
929
|
+
let u = V(null), p = V(new Float32Array(Y)), m = V(0), h = V(0), g = e === Oe.Recording, y = e === Oe.Error, b = R((e) => {
|
|
939
930
|
let t = e.getContext("2d");
|
|
940
931
|
if (!t) return;
|
|
941
932
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
942
933
|
let { width: n, height: r } = e;
|
|
943
934
|
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
944
|
-
let i = Math.min(Math.max(1, Math.floor(n /
|
|
935
|
+
let i = Math.min(Math.max(1, Math.floor(n / Ye)), Y - 1), a = m.current, o = h.current;
|
|
945
936
|
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
946
937
|
for (let e = 0; e <= i; e++) {
|
|
947
|
-
let n = ((a - i + e) %
|
|
948
|
-
t.fillRect(e *
|
|
938
|
+
let n = ((a - i + e) % Y + Y) % Y, o = p.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
939
|
+
t.fillRect(e * Ye, (r - c) / 2, Je, c);
|
|
949
940
|
}
|
|
950
941
|
t.restore();
|
|
951
942
|
}, []);
|
|
952
|
-
|
|
953
|
-
if (!
|
|
943
|
+
z(() => {
|
|
944
|
+
if (!g) return;
|
|
954
945
|
let e = u.current;
|
|
955
946
|
if (!e) return;
|
|
956
|
-
|
|
947
|
+
p.current.fill(0), m.current = 0, h.current = 0;
|
|
957
948
|
let n, r = () => {
|
|
958
|
-
if (
|
|
959
|
-
|
|
949
|
+
if (h.current += 1, h.current >= Ye) {
|
|
950
|
+
h.current -= Ye;
|
|
960
951
|
let e = t.current;
|
|
961
952
|
if (e) {
|
|
962
953
|
let t = new Uint8Array(e.frequencyBinCount);
|
|
@@ -966,37 +957,38 @@ var We = {
|
|
|
966
957
|
let r = (t[e] - 128) / 128;
|
|
967
958
|
n += r * r;
|
|
968
959
|
}
|
|
969
|
-
|
|
960
|
+
p.current[m.current % Y] = Math.sqrt(n / t.length), m.current++;
|
|
970
961
|
}
|
|
971
962
|
}
|
|
972
|
-
|
|
963
|
+
b(e), n = requestAnimationFrame(r);
|
|
973
964
|
};
|
|
974
965
|
return n = requestAnimationFrame(r), () => {
|
|
975
966
|
cancelAnimationFrame(n);
|
|
976
967
|
};
|
|
977
968
|
}, [
|
|
978
|
-
|
|
969
|
+
g,
|
|
979
970
|
t,
|
|
980
|
-
|
|
981
|
-
]),
|
|
971
|
+
b
|
|
972
|
+
]), z(() => {
|
|
982
973
|
let e = u.current;
|
|
983
974
|
if (!e) return;
|
|
984
975
|
let t = new ResizeObserver(() => {
|
|
985
|
-
|
|
976
|
+
b(e);
|
|
986
977
|
});
|
|
987
978
|
return t.observe(e), () => t.disconnect();
|
|
988
|
-
}, [
|
|
989
|
-
let
|
|
979
|
+
}, [b]);
|
|
980
|
+
let x = /* @__PURE__ */ G("div", {
|
|
990
981
|
className: "flex flex-shrink-0 items-center justify-end gap-1",
|
|
991
|
-
children: [/* @__PURE__ */
|
|
992
|
-
icon: /* @__PURE__ */
|
|
982
|
+
children: [/* @__PURE__ */ W(v, {
|
|
983
|
+
icon: /* @__PURE__ */ W(de, {
|
|
993
984
|
size: d.LG,
|
|
994
|
-
"aria-hidden": !0
|
|
985
|
+
"aria-hidden": !0,
|
|
986
|
+
stroke: f
|
|
995
987
|
}),
|
|
996
988
|
"aria-label": s,
|
|
997
989
|
onClick: i
|
|
998
|
-
}),
|
|
999
|
-
icon: /* @__PURE__ */
|
|
990
|
+
}), g && /* @__PURE__ */ W(w, {
|
|
991
|
+
icon: /* @__PURE__ */ W(P, {
|
|
1000
992
|
size: d.LG,
|
|
1001
993
|
"aria-hidden": !0
|
|
1002
994
|
}),
|
|
@@ -1004,92 +996,96 @@ var We = {
|
|
|
1004
996
|
"aria-label": a
|
|
1005
997
|
})]
|
|
1006
998
|
});
|
|
1007
|
-
return /* @__PURE__ */
|
|
999
|
+
return /* @__PURE__ */ G("div", {
|
|
1008
1000
|
className: l,
|
|
1009
|
-
children: [/* @__PURE__ */
|
|
1001
|
+
children: [/* @__PURE__ */ G("div", {
|
|
1010
1002
|
style: c,
|
|
1011
|
-
className: o(
|
|
1012
|
-
children: [/* @__PURE__ */
|
|
1003
|
+
className: o(J.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 && qe.wrapperError),
|
|
1004
|
+
children: [/* @__PURE__ */ G("div", {
|
|
1013
1005
|
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
1014
|
-
children: [
|
|
1015
|
-
className: o(
|
|
1006
|
+
children: [g && /* @__PURE__ */ W("span", {
|
|
1007
|
+
className: o(qe.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
|
|
1016
1008
|
"aria-hidden": !0
|
|
1017
|
-
}), /* @__PURE__ */
|
|
1009
|
+
}), /* @__PURE__ */ W("canvas", {
|
|
1018
1010
|
ref: u,
|
|
1019
1011
|
height: 32,
|
|
1020
|
-
className: o(
|
|
1012
|
+
className: o(qe.waveformCanvas, "h-8 min-w-0 flex-1 desktop:h-6")
|
|
1021
1013
|
})]
|
|
1022
|
-
}),
|
|
1023
|
-
}),
|
|
1014
|
+
}), x]
|
|
1015
|
+
}), y && n && /* @__PURE__ */ W(_, {
|
|
1024
1016
|
text: n,
|
|
1025
1017
|
className: "mt-1 px-1"
|
|
1026
1018
|
})]
|
|
1027
1019
|
});
|
|
1028
|
-
},
|
|
1020
|
+
}, Ze = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", isExiting: r = !1 }) => /* @__PURE__ */ W(w, {
|
|
1029
1021
|
"aria-label": n,
|
|
1030
1022
|
onClick: () => e?.(),
|
|
1031
1023
|
disabled: t,
|
|
1032
1024
|
"aria-hidden": r,
|
|
1033
|
-
icon: /* @__PURE__ */
|
|
1025
|
+
icon: /* @__PURE__ */ W(ne, {
|
|
1034
1026
|
size: d.LG,
|
|
1035
|
-
className: "rtl:scale-x-[-1]"
|
|
1027
|
+
className: "rtl:scale-x-[-1]",
|
|
1028
|
+
stroke: f
|
|
1036
1029
|
})
|
|
1037
|
-
}),
|
|
1038
|
-
icon: /* @__PURE__ */
|
|
1030
|
+
}), Qe = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ W(A, {
|
|
1031
|
+
icon: /* @__PURE__ */ W(F, {
|
|
1032
|
+
size: d.LG,
|
|
1033
|
+
stroke: f
|
|
1034
|
+
}),
|
|
1039
1035
|
onClick: () => e?.(),
|
|
1040
1036
|
"aria-label": t
|
|
1041
|
-
}),
|
|
1042
|
-
variant:
|
|
1037
|
+
}), $e = ({ size: e = 20 }) => /* @__PURE__ */ W(O, {
|
|
1038
|
+
variant: k.Circular,
|
|
1043
1039
|
width: e,
|
|
1044
1040
|
height: e,
|
|
1045
1041
|
active: !0
|
|
1046
|
-
}),
|
|
1042
|
+
}), et = ({ loadingLabel: e }) => /* @__PURE__ */ G("span", {
|
|
1047
1043
|
className: "flex min-w-0 flex-1 items-center",
|
|
1048
|
-
children: [/* @__PURE__ */
|
|
1049
|
-
variant:
|
|
1044
|
+
children: [/* @__PURE__ */ W(O, {
|
|
1045
|
+
variant: k.Text,
|
|
1050
1046
|
width: "100%",
|
|
1051
1047
|
height: 16,
|
|
1052
1048
|
active: !0
|
|
1053
|
-
}), e && /* @__PURE__ */
|
|
1049
|
+
}), e && /* @__PURE__ */ W("span", {
|
|
1054
1050
|
className: "sr-only",
|
|
1055
1051
|
children: e
|
|
1056
1052
|
})]
|
|
1057
|
-
}),
|
|
1053
|
+
}), tt = ({ loadingLabel: e }) => /* @__PURE__ */ W("div", {
|
|
1058
1054
|
role: "status",
|
|
1059
1055
|
"aria-label": e,
|
|
1060
|
-
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */
|
|
1056
|
+
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ G("div", {
|
|
1061
1057
|
className: "flex h-11 items-center gap-3 px-4",
|
|
1062
1058
|
"aria-hidden": "true",
|
|
1063
|
-
children: [/* @__PURE__ */
|
|
1059
|
+
children: [/* @__PURE__ */ W($e, {}), /* @__PURE__ */ W(et, {})]
|
|
1064
1060
|
}, t))
|
|
1065
|
-
}),
|
|
1061
|
+
}), X = (e) => e.displayName ?? e.id, Z = (e, t) => {
|
|
1066
1062
|
let n = t.trim().toLowerCase();
|
|
1067
|
-
return n ? e.filter((e) =>
|
|
1068
|
-
},
|
|
1063
|
+
return n ? e.filter((e) => X(e).toLowerCase().includes(n)) : e;
|
|
1064
|
+
}, nt = (e, t, r, i = 18, a) => /* @__PURE__ */ W(n, {
|
|
1069
1065
|
src: e,
|
|
1070
1066
|
size: i,
|
|
1071
1067
|
labels: { tooltip: a },
|
|
1072
1068
|
initialsName: r
|
|
1073
|
-
}),
|
|
1069
|
+
}), rt = {
|
|
1074
1070
|
searchHeader: "_searchHeader_1tt5t_1",
|
|
1075
1071
|
selectedItem: "_selectedItem_1tt5t_5",
|
|
1076
1072
|
selectedItemCheck: "_selectedItemCheck_1tt5t_9"
|
|
1077
|
-
},
|
|
1078
|
-
let [u,
|
|
1073
|
+
}, it = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, searchHeaderClassName: i = rt.searchHeader, selectedItemClassName: s = rt.selectedItem, selectedItemCheckClassName: c = rt.selectedItemCheck, colors: l }) => {
|
|
1074
|
+
let [u, p] = H(""), m = B(() => e?.find((e) => e.id === t), [e, t]), h = r?.loading !== void 0, _ = !h && !m && !!t, v = B(() => h ? /* @__PURE__ */ W($e, { size: d.LG }) : nt(m?.iconUrl, m?.type, m?.displayName ?? m?.id ?? "", d.LG, _ ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
|
|
1075
|
+
h,
|
|
1079
1076
|
m,
|
|
1080
|
-
|
|
1081
|
-
g,
|
|
1077
|
+
_,
|
|
1082
1078
|
r?.unavailableTooltip
|
|
1083
|
-
]),
|
|
1079
|
+
]), b = m?.displayName ?? m?.id;
|
|
1084
1080
|
return {
|
|
1085
|
-
selectorIcon:
|
|
1086
|
-
selectorAriaLabel:
|
|
1087
|
-
selectedLabel:
|
|
1088
|
-
menuItems:
|
|
1089
|
-
if (
|
|
1081
|
+
selectorIcon: v,
|
|
1082
|
+
selectorAriaLabel: b ? `${r?.ariaLabel ?? "Select model"}: ${b}` : r?.ariaLabel ?? "Select model",
|
|
1083
|
+
selectedLabel: b,
|
|
1084
|
+
menuItems: B(() => {
|
|
1085
|
+
if (h) return Array.from({ length: 7 }, (e, t) => ({
|
|
1090
1086
|
key: `__loading-${t}`,
|
|
1091
|
-
icon: /* @__PURE__ */
|
|
1092
|
-
label: /* @__PURE__ */
|
|
1087
|
+
icon: /* @__PURE__ */ W($e, {}),
|
|
1088
|
+
label: /* @__PURE__ */ W(et, { loadingLabel: t === 0 ? r?.loading : void 0 }),
|
|
1093
1089
|
disabled: !0
|
|
1094
1090
|
}));
|
|
1095
1091
|
if (!e || e.length === 0) {
|
|
@@ -1100,32 +1096,32 @@ var We = {
|
|
|
1100
1096
|
disabled: !0
|
|
1101
1097
|
}] : [];
|
|
1102
1098
|
}
|
|
1103
|
-
return
|
|
1099
|
+
return Z(e, u).map((e) => {
|
|
1104
1100
|
let r = e.id === t;
|
|
1105
1101
|
return {
|
|
1106
1102
|
key: e.id,
|
|
1107
|
-
label: /* @__PURE__ */
|
|
1103
|
+
label: /* @__PURE__ */ G("span", {
|
|
1108
1104
|
className: "flex w-full items-center justify-between gap-2",
|
|
1109
1105
|
style: a({ "--ms-selected-item-check": l?.selectedItemCheck }),
|
|
1110
|
-
children: [/* @__PURE__ */
|
|
1111
|
-
text:
|
|
1106
|
+
children: [/* @__PURE__ */ W(y, {
|
|
1107
|
+
text: X(e),
|
|
1112
1108
|
query: u,
|
|
1113
1109
|
maxLines: 1
|
|
1114
|
-
}), r && /* @__PURE__ */
|
|
1110
|
+
}), r && /* @__PURE__ */ W(M, {
|
|
1115
1111
|
size: d.SM,
|
|
1116
|
-
stroke:
|
|
1112
|
+
stroke: f,
|
|
1117
1113
|
className: c,
|
|
1118
1114
|
"aria-hidden": !0
|
|
1119
1115
|
})]
|
|
1120
1116
|
}),
|
|
1121
|
-
icon:
|
|
1117
|
+
icon: nt(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
1122
1118
|
onClick: () => n?.(e.id),
|
|
1123
1119
|
className: r ? s : void 0
|
|
1124
1120
|
};
|
|
1125
1121
|
});
|
|
1126
1122
|
}, [
|
|
1127
1123
|
e,
|
|
1128
|
-
|
|
1124
|
+
h,
|
|
1129
1125
|
u,
|
|
1130
1126
|
t,
|
|
1131
1127
|
r,
|
|
@@ -1134,30 +1130,30 @@ var We = {
|
|
|
1134
1130
|
c,
|
|
1135
1131
|
l?.selectedItemCheck
|
|
1136
1132
|
]),
|
|
1137
|
-
menuHeader:
|
|
1133
|
+
menuHeader: B(() => !h && e && e.length > 0 ? /* @__PURE__ */ W("div", {
|
|
1138
1134
|
style: a({ "--ms-search-header-bg": l?.searchHeaderBackground }),
|
|
1139
1135
|
className: o("sticky top-0 z-10 pb-1 pe-2 pt-2", i),
|
|
1140
|
-
children: /* @__PURE__ */
|
|
1136
|
+
children: /* @__PURE__ */ W(D, {
|
|
1141
1137
|
value: u,
|
|
1142
1138
|
placeholder: r?.searchPlaceholder ?? "Search",
|
|
1143
|
-
size:
|
|
1139
|
+
size: g.Small,
|
|
1144
1140
|
wrapperClassName: "border-0",
|
|
1145
|
-
onChange: (e) =>
|
|
1141
|
+
onChange: (e) => p(e ?? "")
|
|
1146
1142
|
})
|
|
1147
1143
|
}) : void 0, [
|
|
1148
1144
|
e,
|
|
1149
|
-
|
|
1145
|
+
h,
|
|
1150
1146
|
u,
|
|
1151
1147
|
r,
|
|
1152
1148
|
i,
|
|
1153
1149
|
l?.searchHeaderBackground
|
|
1154
1150
|
]),
|
|
1155
1151
|
onOpenChange: (e) => {
|
|
1156
|
-
e ||
|
|
1152
|
+
e || p("");
|
|
1157
1153
|
}
|
|
1158
1154
|
};
|
|
1159
|
-
},
|
|
1160
|
-
function
|
|
1155
|
+
}, Q = typeof window < "u" ? me : z;
|
|
1156
|
+
function at(e) {
|
|
1161
1157
|
if (e !== void 0) switch (typeof e) {
|
|
1162
1158
|
case "number": return e;
|
|
1163
1159
|
case "string":
|
|
@@ -1165,15 +1161,15 @@ function dt(e) {
|
|
|
1165
1161
|
break;
|
|
1166
1162
|
}
|
|
1167
1163
|
}
|
|
1168
|
-
function
|
|
1169
|
-
let { styleHeight: s, styleWidth: c } =
|
|
1170
|
-
styleHeight:
|
|
1171
|
-
styleWidth:
|
|
1172
|
-
}), [o?.height, o?.width]), [l, u] =
|
|
1164
|
+
function ot({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
1165
|
+
let { styleHeight: s, styleWidth: c } = B(() => ({
|
|
1166
|
+
styleHeight: at(o?.height),
|
|
1167
|
+
styleWidth: at(o?.width)
|
|
1168
|
+
}), [o?.height, o?.width]), [l, u] = H({
|
|
1173
1169
|
height: t,
|
|
1174
1170
|
width: n
|
|
1175
1171
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
1176
|
-
return
|
|
1172
|
+
return Q(() => {
|
|
1177
1173
|
if (i === null || d) return;
|
|
1178
1174
|
let t = new ResizeObserver((e) => {
|
|
1179
1175
|
for (let t of e) {
|
|
@@ -1193,7 +1189,7 @@ function ft({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1193
1189
|
i,
|
|
1194
1190
|
s,
|
|
1195
1191
|
c
|
|
1196
|
-
]),
|
|
1192
|
+
]), B(() => ({
|
|
1197
1193
|
height: s ?? l.height,
|
|
1198
1194
|
width: c ?? l.width
|
|
1199
1195
|
}), [
|
|
@@ -1202,26 +1198,26 @@ function ft({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1202
1198
|
c
|
|
1203
1199
|
]);
|
|
1204
1200
|
}
|
|
1205
|
-
function
|
|
1206
|
-
let t =
|
|
1201
|
+
function st(e) {
|
|
1202
|
+
let t = V(() => {
|
|
1207
1203
|
throw Error("Cannot call during render.");
|
|
1208
1204
|
});
|
|
1209
|
-
return
|
|
1205
|
+
return Q(() => {
|
|
1210
1206
|
t.current = e;
|
|
1211
|
-
}, [e]),
|
|
1207
|
+
}, [e]), R((e) => t.current?.(e), [t]);
|
|
1212
1208
|
}
|
|
1213
|
-
var
|
|
1214
|
-
function
|
|
1215
|
-
if (
|
|
1209
|
+
var ct = null;
|
|
1210
|
+
function lt(e = !1) {
|
|
1211
|
+
if (ct === null || e) {
|
|
1216
1212
|
let e = document.createElement("div"), t = e.style;
|
|
1217
1213
|
t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
|
|
1218
1214
|
let n = document.createElement("div"), r = n.style;
|
|
1219
|
-
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ?
|
|
1215
|
+
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? ct = "positive-descending" : (e.scrollLeft = 1, ct = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), ct;
|
|
1220
1216
|
}
|
|
1221
|
-
return
|
|
1217
|
+
return ct;
|
|
1222
1218
|
}
|
|
1223
|
-
function
|
|
1224
|
-
if (t === "horizontal" && n) switch (
|
|
1219
|
+
function ut({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1220
|
+
if (t === "horizontal" && n) switch (lt()) {
|
|
1225
1221
|
case "negative": return -r;
|
|
1226
1222
|
case "positive-descending":
|
|
1227
1223
|
if (e) {
|
|
@@ -1232,26 +1228,26 @@ function gt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
|
1232
1228
|
}
|
|
1233
1229
|
return r;
|
|
1234
1230
|
}
|
|
1235
|
-
function
|
|
1231
|
+
function $(e, t = "Assertion error") {
|
|
1236
1232
|
if (!e) throw console.error(t), Error(t);
|
|
1237
1233
|
}
|
|
1238
|
-
function
|
|
1234
|
+
function dt(e, t) {
|
|
1239
1235
|
if (e === t) return !0;
|
|
1240
|
-
if (!!e != !!t || (
|
|
1236
|
+
if (!!e != !!t || ($(e !== void 0), $(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1241
1237
|
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
1242
1238
|
return !0;
|
|
1243
1239
|
}
|
|
1244
|
-
function
|
|
1240
|
+
function ft({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
1245
1241
|
if (t === 0) return 0;
|
|
1246
1242
|
if (typeof n == "number") return t * n;
|
|
1247
1243
|
{
|
|
1248
1244
|
let n = e.get(e.size === 0 ? 0 : e.size - 1);
|
|
1249
|
-
return
|
|
1245
|
+
return $(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
|
|
1250
1246
|
}
|
|
1251
1247
|
}
|
|
1252
|
-
function
|
|
1248
|
+
function pt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
|
|
1253
1249
|
if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
|
|
1254
|
-
let s =
|
|
1250
|
+
let s = ft({
|
|
1255
1251
|
cachedBounds: t,
|
|
1256
1252
|
itemCount: r,
|
|
1257
1253
|
itemSize: i
|
|
@@ -1263,7 +1259,7 @@ function yt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, co
|
|
|
1263
1259
|
default: return a >= u && a <= l ? a : a < u ? u : l;
|
|
1264
1260
|
}
|
|
1265
1261
|
}
|
|
1266
|
-
function
|
|
1262
|
+
function mt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
|
|
1267
1263
|
let a = r - 1, o = 0, s = -1, c = 0, l = -1, u = 0;
|
|
1268
1264
|
for (; u < a;) {
|
|
1269
1265
|
let n = e.get(u);
|
|
@@ -1282,11 +1278,11 @@ function bt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemC
|
|
|
1282
1278
|
stopIndexOverscan: l
|
|
1283
1279
|
};
|
|
1284
1280
|
}
|
|
1285
|
-
function
|
|
1281
|
+
function ht({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1286
1282
|
let r = /* @__PURE__ */ new Map();
|
|
1287
1283
|
return {
|
|
1288
1284
|
get(i) {
|
|
1289
|
-
for (
|
|
1285
|
+
for ($(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
|
|
1290
1286
|
let e = r.size, a;
|
|
1291
1287
|
switch (typeof n) {
|
|
1292
1288
|
case "function":
|
|
@@ -1302,14 +1298,14 @@ function xt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1302
1298
|
});
|
|
1303
1299
|
else {
|
|
1304
1300
|
let t = r.get(e - 1);
|
|
1305
|
-
|
|
1301
|
+
$(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
|
|
1306
1302
|
scrollOffset: t.scrollOffset + t.size,
|
|
1307
1303
|
size: a
|
|
1308
1304
|
});
|
|
1309
1305
|
}
|
|
1310
1306
|
}
|
|
1311
1307
|
let a = r.get(i);
|
|
1312
|
-
return
|
|
1308
|
+
return $(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
|
|
1313
1309
|
},
|
|
1314
1310
|
set(e, t) {
|
|
1315
1311
|
r.set(e, t);
|
|
@@ -1319,8 +1315,8 @@ function xt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1319
1315
|
}
|
|
1320
1316
|
};
|
|
1321
1317
|
}
|
|
1322
|
-
function
|
|
1323
|
-
return
|
|
1318
|
+
function gt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1319
|
+
return B(() => ht({
|
|
1324
1320
|
itemCount: e,
|
|
1325
1321
|
itemProps: t,
|
|
1326
1322
|
itemSize: n
|
|
@@ -1330,11 +1326,11 @@ function St({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1330
1326
|
n
|
|
1331
1327
|
]);
|
|
1332
1328
|
}
|
|
1333
|
-
function
|
|
1329
|
+
function _t({ containerSize: e, itemSize: t }) {
|
|
1334
1330
|
let n;
|
|
1335
1331
|
switch (typeof t) {
|
|
1336
1332
|
case "string":
|
|
1337
|
-
|
|
1333
|
+
$(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), $(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
|
|
1338
1334
|
break;
|
|
1339
1335
|
default:
|
|
1340
1336
|
n = t;
|
|
@@ -1342,21 +1338,21 @@ function Ct({ containerSize: e, itemSize: t }) {
|
|
|
1342
1338
|
}
|
|
1343
1339
|
return n;
|
|
1344
1340
|
}
|
|
1345
|
-
function
|
|
1346
|
-
let { height: u = n, width: d = n } =
|
|
1341
|
+
function vt({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
|
|
1342
|
+
let { height: u = n, width: d = n } = ot({
|
|
1347
1343
|
defaultHeight: r === "vertical" ? n : void 0,
|
|
1348
1344
|
defaultWidth: r === "horizontal" ? n : void 0,
|
|
1349
1345
|
element: e,
|
|
1350
1346
|
mode: r === "vertical" ? "only-height" : "only-width",
|
|
1351
1347
|
style: t
|
|
1352
|
-
}), f =
|
|
1348
|
+
}), f = V({
|
|
1353
1349
|
height: 0,
|
|
1354
1350
|
width: 0
|
|
1355
|
-
}), p = r === "vertical" ? u : d, m =
|
|
1351
|
+
}), p = r === "vertical" ? u : d, m = _t({
|
|
1356
1352
|
containerSize: p,
|
|
1357
1353
|
itemSize: s
|
|
1358
1354
|
});
|
|
1359
|
-
|
|
1355
|
+
me(() => {
|
|
1360
1356
|
if (typeof c == "function") {
|
|
1361
1357
|
let e = f.current;
|
|
1362
1358
|
(e.height !== u || e.width !== d) && (c({
|
|
@@ -1369,11 +1365,11 @@ function wt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1369
1365
|
c,
|
|
1370
1366
|
d
|
|
1371
1367
|
]);
|
|
1372
|
-
let h =
|
|
1368
|
+
let h = gt({
|
|
1373
1369
|
itemCount: a,
|
|
1374
1370
|
itemProps: o,
|
|
1375
1371
|
itemSize: m
|
|
1376
|
-
}), g =
|
|
1372
|
+
}), g = R((e) => h.get(e), [h]), [_, v] = H(() => mt({
|
|
1377
1373
|
cachedBounds: h,
|
|
1378
1374
|
containerScrollOffset: 0,
|
|
1379
1375
|
containerSize: p,
|
|
@@ -1384,7 +1380,7 @@ function wt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1384
1380
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1385
1381
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1386
1382
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1387
|
-
}, C =
|
|
1383
|
+
}, C = R(() => ft({
|
|
1388
1384
|
cachedBounds: h,
|
|
1389
1385
|
itemCount: a,
|
|
1390
1386
|
itemSize: m
|
|
@@ -1392,9 +1388,9 @@ function wt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1392
1388
|
h,
|
|
1393
1389
|
a,
|
|
1394
1390
|
m
|
|
1395
|
-
]), w =
|
|
1391
|
+
]), w = R((t) => mt({
|
|
1396
1392
|
cachedBounds: h,
|
|
1397
|
-
containerScrollOffset:
|
|
1393
|
+
containerScrollOffset: ut({
|
|
1398
1394
|
containerElement: e,
|
|
1399
1395
|
direction: r,
|
|
1400
1396
|
isRtl: i,
|
|
@@ -1412,19 +1408,19 @@ function wt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1412
1408
|
a,
|
|
1413
1409
|
l
|
|
1414
1410
|
]);
|
|
1415
|
-
return
|
|
1411
|
+
return Q(() => {
|
|
1416
1412
|
v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
|
|
1417
1413
|
}, [
|
|
1418
1414
|
e,
|
|
1419
1415
|
r,
|
|
1420
1416
|
w
|
|
1421
|
-
]),
|
|
1417
|
+
]), Q(() => {
|
|
1422
1418
|
if (!e) return;
|
|
1423
1419
|
let t = () => {
|
|
1424
1420
|
v((t) => {
|
|
1425
|
-
let { scrollLeft: n, scrollTop: o } = e, s =
|
|
1421
|
+
let { scrollLeft: n, scrollTop: o } = e, s = mt({
|
|
1426
1422
|
cachedBounds: h,
|
|
1427
|
-
containerScrollOffset:
|
|
1423
|
+
containerScrollOffset: ut({
|
|
1428
1424
|
containerElement: e,
|
|
1429
1425
|
direction: r,
|
|
1430
1426
|
isRtl: i,
|
|
@@ -1434,7 +1430,7 @@ function wt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1434
1430
|
itemCount: a,
|
|
1435
1431
|
overscanCount: l
|
|
1436
1432
|
});
|
|
1437
|
-
return
|
|
1433
|
+
return dt(s, t) ? t : s;
|
|
1438
1434
|
});
|
|
1439
1435
|
};
|
|
1440
1436
|
return e.addEventListener("scroll", t), () => {
|
|
@@ -1450,8 +1446,8 @@ function wt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1450
1446
|
]), {
|
|
1451
1447
|
getCellBounds: g,
|
|
1452
1448
|
getEstimatedSize: C,
|
|
1453
|
-
scrollToIndex:
|
|
1454
|
-
let s =
|
|
1449
|
+
scrollToIndex: st(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
|
|
1450
|
+
let s = pt({
|
|
1455
1451
|
align: t,
|
|
1456
1452
|
cachedBounds: h,
|
|
1457
1453
|
containerScrollOffset: n,
|
|
@@ -1461,14 +1457,14 @@ function wt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1461
1457
|
itemSize: m
|
|
1462
1458
|
});
|
|
1463
1459
|
if (e) {
|
|
1464
|
-
if (s =
|
|
1460
|
+
if (s = ut({
|
|
1465
1461
|
containerElement: e,
|
|
1466
1462
|
direction: r,
|
|
1467
1463
|
isRtl: i,
|
|
1468
1464
|
scrollOffset: s
|
|
1469
1465
|
}), typeof e.scrollTo != "function") {
|
|
1470
1466
|
let e = w(s);
|
|
1471
|
-
|
|
1467
|
+
dt(_, e) || v(e);
|
|
1472
1468
|
}
|
|
1473
1469
|
return s;
|
|
1474
1470
|
}
|
|
@@ -1479,30 +1475,30 @@ function wt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1479
1475
|
stopIndexVisible: x
|
|
1480
1476
|
};
|
|
1481
1477
|
}
|
|
1482
|
-
function
|
|
1483
|
-
return
|
|
1478
|
+
function yt(e) {
|
|
1479
|
+
return B(() => e, Object.values(e));
|
|
1484
1480
|
}
|
|
1485
|
-
function
|
|
1481
|
+
function bt(e, t) {
|
|
1486
1482
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1487
|
-
return
|
|
1483
|
+
return dt(n, a) && dt(r, o) && dt(i, s);
|
|
1488
1484
|
}
|
|
1489
|
-
function
|
|
1485
|
+
function xt(e) {
|
|
1490
1486
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1491
1487
|
}
|
|
1492
|
-
var
|
|
1493
|
-
function
|
|
1494
|
-
let m =
|
|
1488
|
+
var St = "data-react-window-index";
|
|
1489
|
+
function Ct({ 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 }) {
|
|
1490
|
+
let m = yt(u), h = B(() => L(s, bt), [s]), [g, _] = H(null), v = xt(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = vt({
|
|
1495
1491
|
containerElement: g,
|
|
1496
1492
|
containerStyle: f,
|
|
1497
1493
|
defaultContainerSize: n,
|
|
1498
1494
|
direction: "vertical",
|
|
1499
1495
|
itemCount: c,
|
|
1500
1496
|
itemProps: m,
|
|
1501
|
-
itemSize:
|
|
1497
|
+
itemSize: B(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
|
|
1502
1498
|
onResize: i,
|
|
1503
1499
|
overscanCount: o
|
|
1504
1500
|
});
|
|
1505
|
-
|
|
1501
|
+
pe(r, () => ({
|
|
1506
1502
|
get element() {
|
|
1507
1503
|
return g;
|
|
1508
1504
|
},
|
|
@@ -1517,12 +1513,12 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1517
1513
|
top: r
|
|
1518
1514
|
});
|
|
1519
1515
|
}
|
|
1520
|
-
}), [g, x]),
|
|
1516
|
+
}), [g, x]), Q(() => {
|
|
1521
1517
|
if (!g) return;
|
|
1522
1518
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1523
1519
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
1524
1520
|
let n = `${S + t}`;
|
|
1525
|
-
return e.setAttribute(
|
|
1521
|
+
return e.setAttribute(St, n), !0;
|
|
1526
1522
|
});
|
|
1527
1523
|
if (v) return l.observeRowElements(e);
|
|
1528
1524
|
}, [
|
|
@@ -1531,7 +1527,7 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1531
1527
|
l,
|
|
1532
1528
|
S,
|
|
1533
1529
|
w
|
|
1534
|
-
]),
|
|
1530
|
+
]), z(() => {
|
|
1535
1531
|
S >= 0 && w >= 0 && a && a({
|
|
1536
1532
|
startIndex: C,
|
|
1537
1533
|
stopIndex: T
|
|
@@ -1546,11 +1542,11 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1546
1542
|
w,
|
|
1547
1543
|
T
|
|
1548
1544
|
]);
|
|
1549
|
-
let E =
|
|
1545
|
+
let E = B(() => {
|
|
1550
1546
|
let e = [];
|
|
1551
1547
|
if (c > 0) for (let t = S; t <= w; t++) {
|
|
1552
1548
|
let n = y(t);
|
|
1553
|
-
e.push(/* @__PURE__ */
|
|
1549
|
+
e.push(/* @__PURE__ */ I(h, {
|
|
1554
1550
|
...m,
|
|
1555
1551
|
ariaAttributes: {
|
|
1556
1552
|
"aria-posinset": t + 1,
|
|
@@ -1577,7 +1573,7 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1577
1573
|
m,
|
|
1578
1574
|
S,
|
|
1579
1575
|
w
|
|
1580
|
-
]), D = /* @__PURE__ */
|
|
1576
|
+
]), D = /* @__PURE__ */ W("div", {
|
|
1581
1577
|
"aria-hidden": !0,
|
|
1582
1578
|
style: {
|
|
1583
1579
|
height: b(),
|
|
@@ -1585,7 +1581,7 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1585
1581
|
zIndex: -1
|
|
1586
1582
|
}
|
|
1587
1583
|
});
|
|
1588
|
-
return
|
|
1584
|
+
return I(d, {
|
|
1589
1585
|
role: "list",
|
|
1590
1586
|
...p,
|
|
1591
1587
|
className: t,
|
|
@@ -1599,46 +1595,47 @@ function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1599
1595
|
}
|
|
1600
1596
|
}, E, e, D);
|
|
1601
1597
|
}
|
|
1602
|
-
var
|
|
1598
|
+
var wt = {
|
|
1603
1599
|
divider: "_divider_1tiyp_1",
|
|
1604
1600
|
item: "_item_1tiyp_5",
|
|
1605
1601
|
itemIcon: "_itemIcon_1tiyp_15",
|
|
1606
1602
|
checkIcon: "_checkIcon_1tiyp_19",
|
|
1607
1603
|
stateLabel: "_stateLabel_1tiyp_23"
|
|
1608
|
-
},
|
|
1609
|
-
let u = r[e],
|
|
1610
|
-
return /* @__PURE__ */
|
|
1604
|
+
}, Tt = 44, Et = 8, Dt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: s, onSelect: c }) => {
|
|
1605
|
+
let u = r[e], p = nt(u.iconUrl, u.type, u.displayName ?? u.id, d.SM), m = u.id === i;
|
|
1606
|
+
return /* @__PURE__ */ W("div", {
|
|
1611
1607
|
style: t,
|
|
1612
1608
|
...n,
|
|
1613
|
-
children: /* @__PURE__ */
|
|
1609
|
+
children: /* @__PURE__ */ W(l, {
|
|
1614
1610
|
type: "button",
|
|
1615
|
-
className: o(
|
|
1616
|
-
iconBefore: /* @__PURE__ */
|
|
1617
|
-
className:
|
|
1618
|
-
children:
|
|
1611
|
+
className: o(wt.item, "h-full w-full gap-3 px-4"),
|
|
1612
|
+
iconBefore: /* @__PURE__ */ W("span", {
|
|
1613
|
+
className: wt.itemIcon,
|
|
1614
|
+
children: p
|
|
1619
1615
|
}),
|
|
1620
|
-
label: /* @__PURE__ */
|
|
1616
|
+
label: /* @__PURE__ */ G("span", {
|
|
1621
1617
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
1622
|
-
children: [/* @__PURE__ */
|
|
1618
|
+
children: [/* @__PURE__ */ W(y, {
|
|
1623
1619
|
text: u.displayName ?? u.id,
|
|
1624
1620
|
query: s,
|
|
1625
1621
|
maxLines: 1,
|
|
1626
1622
|
className: o(a, "min-w-0 flex-1 text-start")
|
|
1627
|
-
}),
|
|
1623
|
+
}), m && /* @__PURE__ */ W(M, {
|
|
1628
1624
|
size: d.SM,
|
|
1629
|
-
className:
|
|
1630
|
-
"aria-hidden": !0
|
|
1625
|
+
className: wt.checkIcon,
|
|
1626
|
+
"aria-hidden": !0,
|
|
1627
|
+
stroke: f
|
|
1631
1628
|
})]
|
|
1632
1629
|
}),
|
|
1633
1630
|
onClick: () => c(u.id)
|
|
1634
1631
|
})
|
|
1635
1632
|
});
|
|
1636
|
-
},
|
|
1637
|
-
let [v, y] =
|
|
1638
|
-
|
|
1633
|
+
}, Ot = ({ 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: _ }) => {
|
|
1634
|
+
let [v, y] = H("");
|
|
1635
|
+
z(() => {
|
|
1639
1636
|
e || y("");
|
|
1640
1637
|
}, [e]);
|
|
1641
|
-
let b = s && s.length > 0, x = u !== void 0, S = !b && !x ? d ?? f : void 0, C = b ?
|
|
1638
|
+
let b = s && s.length > 0, x = u !== void 0, S = !b && !x ? d ?? f : void 0, C = b ? Z(s, v) : [], w = (e) => {
|
|
1642
1639
|
l(e), i();
|
|
1643
1640
|
}, T = a({
|
|
1644
1641
|
"--ci-sheet-divider": _?.divider,
|
|
@@ -1648,7 +1645,7 @@ var kt = {
|
|
|
1648
1645
|
"--ci-sheet-icon": _?.itemIcon,
|
|
1649
1646
|
"--ci-check-icon": _?.checkIcon
|
|
1650
1647
|
});
|
|
1651
|
-
return /* @__PURE__ */
|
|
1648
|
+
return /* @__PURE__ */ W(K, {
|
|
1652
1649
|
isOpen: e,
|
|
1653
1650
|
title: t,
|
|
1654
1651
|
closeLabel: n,
|
|
@@ -1657,77 +1654,78 @@ var kt = {
|
|
|
1657
1654
|
titleClassName: m,
|
|
1658
1655
|
className: "max-h-[80dvh]",
|
|
1659
1656
|
colors: _?.shell,
|
|
1660
|
-
children: /* @__PURE__ */
|
|
1657
|
+
children: /* @__PURE__ */ G("div", {
|
|
1661
1658
|
className: "contents",
|
|
1662
1659
|
style: T,
|
|
1663
|
-
children: [b && !x && /* @__PURE__ */
|
|
1660
|
+
children: [b && !x && /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("div", {
|
|
1664
1661
|
className: "flex-shrink-0 px-4 py-[10px]",
|
|
1665
|
-
children: /* @__PURE__ */
|
|
1662
|
+
children: /* @__PURE__ */ W(D, {
|
|
1666
1663
|
value: v,
|
|
1667
1664
|
placeholder: r,
|
|
1668
|
-
size:
|
|
1665
|
+
size: g.Standard,
|
|
1669
1666
|
onChange: (e) => y(e ?? "")
|
|
1670
1667
|
})
|
|
1671
|
-
}), /* @__PURE__ */
|
|
1668
|
+
}), /* @__PURE__ */ W("div", { className: o(wt.divider, "h-px flex-shrink-0") })] }), x ? /* @__PURE__ */ W(tt, { loadingLabel: u }) : S ? /* @__PURE__ */ W("div", {
|
|
1672
1669
|
role: "list",
|
|
1673
|
-
className: o(
|
|
1670
|
+
className: o(wt.stateLabel, h, "px-4 py-4"),
|
|
1674
1671
|
children: S
|
|
1675
|
-
}) : /* @__PURE__ */
|
|
1672
|
+
}) : /* @__PURE__ */ W(Ct, {
|
|
1676
1673
|
role: "list",
|
|
1677
1674
|
className: "overflow-y-auto",
|
|
1678
|
-
style: { height: Math.min(C.length,
|
|
1679
|
-
rowComponent:
|
|
1675
|
+
style: { height: Math.min(C.length, Et) * Tt },
|
|
1676
|
+
rowComponent: Dt,
|
|
1680
1677
|
rowCount: C.length,
|
|
1681
|
-
rowHeight:
|
|
1678
|
+
rowHeight: Tt,
|
|
1682
1679
|
rowProps: {
|
|
1683
1680
|
items: C,
|
|
1684
1681
|
selectedDeploymentId: c,
|
|
1685
|
-
labelClassName:
|
|
1682
|
+
labelClassName: h,
|
|
1686
1683
|
query: v,
|
|
1687
1684
|
onSelect: w
|
|
1688
1685
|
}
|
|
1689
1686
|
})]
|
|
1690
1687
|
})
|
|
1691
1688
|
});
|
|
1692
|
-
},
|
|
1693
|
-
let [
|
|
1689
|
+
}, kt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, isStreaming: i, isMobile: a, isDisabled: s = !1, style: c, modelPickerOverlay: l, isPickerOpen: u, onPickerToggle: m, onPickerOpenChange: _ }) => {
|
|
1690
|
+
let [y, b] = H(!1), { selectorIcon: x, selectorAriaLabel: S, selectedLabel: C, menuItems: w, menuHeader: T, onOpenChange: E } = it({
|
|
1694
1691
|
deployments: e,
|
|
1695
1692
|
selectedDeploymentId: t,
|
|
1696
1693
|
onDeploymentChange: n,
|
|
1697
1694
|
modelSelectorLabels: r
|
|
1698
1695
|
});
|
|
1699
1696
|
if (!e) return null;
|
|
1700
|
-
let
|
|
1697
|
+
let D = i || s ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, O = /* @__PURE__ */ W(re, {
|
|
1701
1698
|
size: d.SM,
|
|
1702
|
-
className:
|
|
1703
|
-
"aria-hidden": !0
|
|
1699
|
+
className: J.modelSelectorCaret,
|
|
1700
|
+
"aria-hidden": !0,
|
|
1701
|
+
stroke: f
|
|
1704
1702
|
});
|
|
1705
|
-
return a ? /* @__PURE__ */
|
|
1706
|
-
tooltip:
|
|
1707
|
-
children: /* @__PURE__ */
|
|
1708
|
-
icon: /* @__PURE__ */
|
|
1703
|
+
return a ? /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(j, {
|
|
1704
|
+
tooltip: C,
|
|
1705
|
+
children: /* @__PURE__ */ W(v, {
|
|
1706
|
+
icon: /* @__PURE__ */ G("div", {
|
|
1709
1707
|
className: "flex items-center gap-1",
|
|
1710
|
-
children: [
|
|
1708
|
+
children: [x, O]
|
|
1711
1709
|
}),
|
|
1712
|
-
"aria-label":
|
|
1710
|
+
"aria-label": S,
|
|
1713
1711
|
onClick: () => {
|
|
1714
|
-
s ||
|
|
1712
|
+
s || b(!0);
|
|
1715
1713
|
},
|
|
1716
|
-
className: o("w-[50px]",
|
|
1714
|
+
className: o("w-[50px]", J.modelSelectorButton, D)
|
|
1717
1715
|
})
|
|
1718
|
-
}), l ? /* @__PURE__ */
|
|
1719
|
-
isOpen:
|
|
1716
|
+
}), l ? /* @__PURE__ */ W(K, {
|
|
1717
|
+
isOpen: y,
|
|
1720
1718
|
title: r?.ariaLabel ?? "Select model",
|
|
1721
1719
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1722
|
-
onClose: () =>
|
|
1720
|
+
onClose: () => b(!1),
|
|
1723
1721
|
style: c,
|
|
1724
|
-
children: l(() =>
|
|
1725
|
-
}) : /* @__PURE__ */
|
|
1726
|
-
isOpen:
|
|
1722
|
+
children: l(() => b(!1))
|
|
1723
|
+
}) : /* @__PURE__ */ W(Ot, {
|
|
1724
|
+
isOpen: y,
|
|
1727
1725
|
title: r?.ariaLabel ?? "Select model",
|
|
1728
1726
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1729
1727
|
searchPlaceholder: r?.searchPlaceholder ?? "Search",
|
|
1730
|
-
onClose: () =>
|
|
1728
|
+
onClose: () => b(!1),
|
|
1731
1729
|
deployments: e,
|
|
1732
1730
|
selectedDeploymentId: t,
|
|
1733
1731
|
onSelect: (e) => n?.(e),
|
|
@@ -1735,283 +1733,290 @@ var kt = {
|
|
|
1735
1733
|
errorLabel: r?.error,
|
|
1736
1734
|
emptyLabel: r?.empty,
|
|
1737
1735
|
style: c
|
|
1738
|
-
})] }) : l ? /* @__PURE__ */
|
|
1736
|
+
})] }) : l ? /* @__PURE__ */ W(h, {
|
|
1739
1737
|
placement: "top-end",
|
|
1740
1738
|
matchReferenceWidth: !1,
|
|
1741
1739
|
open: u,
|
|
1742
|
-
onOpenChange:
|
|
1740
|
+
onOpenChange: _,
|
|
1743
1741
|
trigger: [],
|
|
1744
1742
|
outsideClosable: !0,
|
|
1745
|
-
renderOverlay: () => l(() =>
|
|
1743
|
+
renderOverlay: () => l(() => _?.(!1)),
|
|
1746
1744
|
listClassName: "!w-[368px] !bg-layer-raised",
|
|
1747
|
-
children: /* @__PURE__ */
|
|
1748
|
-
tooltip:
|
|
1749
|
-
children: /* @__PURE__ */
|
|
1745
|
+
children: /* @__PURE__ */ W(j, {
|
|
1746
|
+
tooltip: C,
|
|
1747
|
+
children: /* @__PURE__ */ G("button", {
|
|
1750
1748
|
type: "button",
|
|
1751
|
-
"aria-label":
|
|
1749
|
+
"aria-label": S,
|
|
1752
1750
|
"aria-disabled": s || void 0,
|
|
1753
|
-
className: o("flex items-center justify-center gap-1 rounded-full p-2",
|
|
1751
|
+
className: o("flex items-center justify-center gap-1 rounded-full p-2", J.modelSelectorButton, D, s && J.modelSelectorButtonDisabled),
|
|
1754
1752
|
onClick: () => {
|
|
1755
|
-
!i && !s &&
|
|
1753
|
+
!i && !s && m?.();
|
|
1756
1754
|
},
|
|
1757
|
-
children: [
|
|
1755
|
+
children: [x, O]
|
|
1758
1756
|
})
|
|
1759
1757
|
})
|
|
1760
|
-
}) : /* @__PURE__ */
|
|
1761
|
-
className: o(s &&
|
|
1758
|
+
}) : /* @__PURE__ */ W("div", {
|
|
1759
|
+
className: o(s && D),
|
|
1762
1760
|
"aria-disabled": s || void 0,
|
|
1763
|
-
children: /* @__PURE__ */
|
|
1764
|
-
tooltip:
|
|
1765
|
-
children: /* @__PURE__ */
|
|
1766
|
-
icon:
|
|
1767
|
-
ariaLabel:
|
|
1768
|
-
items:
|
|
1769
|
-
menuHeader:
|
|
1761
|
+
children: /* @__PURE__ */ W(j, {
|
|
1762
|
+
tooltip: C,
|
|
1763
|
+
children: /* @__PURE__ */ W(p, {
|
|
1764
|
+
icon: x,
|
|
1765
|
+
ariaLabel: S,
|
|
1766
|
+
items: w,
|
|
1767
|
+
menuHeader: T,
|
|
1770
1768
|
placement: "bottom-end",
|
|
1771
1769
|
matchReferenceWidth: !1,
|
|
1772
1770
|
listClassName: "!w-[240px] !max-h-80",
|
|
1773
|
-
onOpenChange: s ? void 0 :
|
|
1774
|
-
size:
|
|
1775
|
-
caretIcon:
|
|
1776
|
-
iconClassName: s ?
|
|
1777
|
-
buttonClassName: o("bg-transparent",
|
|
1771
|
+
onOpenChange: s ? void 0 : E,
|
|
1772
|
+
size: g.Standard,
|
|
1773
|
+
caretIcon: O,
|
|
1774
|
+
iconClassName: s ? D : void 0,
|
|
1775
|
+
buttonClassName: o("bg-transparent", J.modelSelectorButton, s && J.modelSelectorButtonDisabled)
|
|
1778
1776
|
})
|
|
1779
1777
|
})
|
|
1780
1778
|
});
|
|
1781
|
-
},
|
|
1782
|
-
let
|
|
1783
|
-
"--ci-bg":
|
|
1784
|
-
"--ci-text":
|
|
1785
|
-
"--ci-border":
|
|
1786
|
-
"--ci-border-focus":
|
|
1787
|
-
"--ci-placeholder":
|
|
1788
|
-
"--ci-text-disabled":
|
|
1789
|
-
"--ci-model-selector-caret-color":
|
|
1790
|
-
"--ci-model-selector-hover-bg":
|
|
1791
|
-
"--ci-model-selector-disabled-color":
|
|
1792
|
-
"--ci-voice-error":
|
|
1793
|
-
"--ci-voice-waveform":
|
|
1794
|
-
"--ci-voice-accent":
|
|
1795
|
-
}), [
|
|
1779
|
+
}, At = 160, jt = ({ message: e = "", messageRevision: t, onSend: n, onUploadAttachment: r, onStop: i, isStreaming: l = !1, onChange: u, onAttachmentsChange: p, placeholder: m = "Type a message...", ariaLabel: h, attachLabel: g = "Attach file", fileAccept: _, addMenuTitle: y = "Add", menuTitle: b = "Menu", menuCloseLabel: x = "Close", removeLabel: S, retryLabel: C, sendLabel: w, stopLabel: T, micLabel: E = "Record voice message", stopRecordingLabel: D, discardRecordingLabel: O, colors: k, typography: A, className: ee, pendingDropFiles: j = [], onDropFilesConsumed: te, pendingAttachments: ne = [], onPendingAttachmentsConsumed: M, pasteTextThreshold: re = 4e3, maxMessageLength: N = 5e4, deployments: oe, selectedDeploymentId: P, onDeploymentChange: F, modelSelectorLabels: se, initialAttachments: ce = [], isStacked: le = !1, hideAddButton: ue = !1, hideAttachFile: de = !1, hideActionBar: fe = !1, renderFooterActions: I, isInputDisabled: L = !1, isModelSelectorDisabled: pe = !1, isSendDisabled: me = !1, isAudioMessageSupported: ge = !1, sendOnEnter: _e = Me.Enter, prefixAttachments: ye = [], onRemovePrefixAttachment: be, chatSettings: K, toolsMenuItems: xe, onToolToggle: we, toolsMenuTitle: Te, toolsBackLabel: Oe, toolsChipLabels: ke, promptsMenuOverlay: Ae, promptsMenuTitle: Ne, promptsBackLabel: Pe, autoFocus: Fe = !1, messageHistory: Ie, onDialFileSystemClick: Le, dialFileSystemLabel: Re, validateAttachment: ze, onAttachmentClick: Be, modelPickerOverlay: Ve, maximumAttachmentsAmount: He, onAttachmentsLimitExceeded: Ue, isAttachmentsEnabled: q = !0, usageLimitsSlot: Ge, onMessageTooLong: qe }) => {
|
|
1780
|
+
let Je = s(), [Ye, Y] = H(!1), $e = Ee(Ie), et = B(() => a({
|
|
1781
|
+
"--ci-bg": k?.background,
|
|
1782
|
+
"--ci-text": k?.text,
|
|
1783
|
+
"--ci-border": k?.border,
|
|
1784
|
+
"--ci-border-focus": k?.borderFocus,
|
|
1785
|
+
"--ci-placeholder": k?.placeholder,
|
|
1786
|
+
"--ci-text-disabled": k?.textDisabled,
|
|
1787
|
+
"--ci-model-selector-caret-color": k?.modelSelectorCaret,
|
|
1788
|
+
"--ci-model-selector-hover-bg": k?.modelSelectorHoverBg,
|
|
1789
|
+
"--ci-model-selector-disabled-color": k?.modelSelectorDisabled,
|
|
1790
|
+
"--ci-voice-error": k?.voiceError,
|
|
1791
|
+
"--ci-voice-waveform": k?.voiceWaveform,
|
|
1792
|
+
"--ci-voice-accent": k?.voiceAccent
|
|
1793
|
+
}), [k]), tt = B(() => Le ? [{
|
|
1796
1794
|
key: "dial-fs",
|
|
1797
|
-
label:
|
|
1798
|
-
icon: /* @__PURE__ */
|
|
1795
|
+
label: Re ?? "DIAL file system",
|
|
1796
|
+
icon: /* @__PURE__ */ W(ie, {
|
|
1799
1797
|
size: c,
|
|
1800
|
-
"aria-hidden": !0
|
|
1798
|
+
"aria-hidden": !0,
|
|
1799
|
+
stroke: f
|
|
1801
1800
|
}),
|
|
1802
|
-
onClick:
|
|
1803
|
-
}] : [], [
|
|
1801
|
+
onClick: Le
|
|
1802
|
+
}] : [], [Le, Re]), { message: X, setMessage: Z, textareaRef: nt, isMultiLine: rt } = De({
|
|
1804
1803
|
messageProp: e,
|
|
1805
1804
|
messageRevision: t
|
|
1806
|
-
}), { attachments:
|
|
1807
|
-
initialAttachments:
|
|
1805
|
+
}), { attachments: it, buildAttachments: Q, addAttachments: at, resetAttachments: ot, handleRemove: st, handleRetry: ct, handleExpand: lt, hasBlockedAttachments: ut } = Se({
|
|
1806
|
+
initialAttachments: ce,
|
|
1808
1807
|
onUploadAttachment: r,
|
|
1809
|
-
onAttachmentsChange:
|
|
1810
|
-
validateAttachment:
|
|
1808
|
+
onAttachmentsChange: p,
|
|
1809
|
+
validateAttachment: ze,
|
|
1811
1810
|
pendingDropFiles: j,
|
|
1812
|
-
onDropFilesConsumed:
|
|
1813
|
-
pendingAttachments:
|
|
1811
|
+
onDropFilesConsumed: te,
|
|
1812
|
+
pendingAttachments: ne,
|
|
1814
1813
|
onPendingAttachmentsConsumed: M,
|
|
1815
|
-
onExpandPastedText:
|
|
1816
|
-
|
|
1817
|
-
}, [
|
|
1818
|
-
maximumAttachmentsAmount:
|
|
1819
|
-
baseAttachmentsAmount:
|
|
1820
|
-
onAttachmentsLimitExceeded:
|
|
1821
|
-
}), { state:
|
|
1822
|
-
|
|
1823
|
-
}, [
|
|
1824
|
-
if (!
|
|
1814
|
+
onExpandPastedText: R((e) => {
|
|
1815
|
+
Z((t) => t ? `${t}\n${e}` : e);
|
|
1816
|
+
}, [Z]),
|
|
1817
|
+
maximumAttachmentsAmount: He,
|
|
1818
|
+
baseAttachmentsAmount: ye.length,
|
|
1819
|
+
onAttachmentsLimitExceeded: Ue
|
|
1820
|
+
}), { state: $, analyserNodeRef: dt, errorMessage: ft, startRecording: pt, stopRecording: mt, discardRecording: ht } = je({ onAttachAudio: R((e) => {
|
|
1821
|
+
at(Q([e]));
|
|
1822
|
+
}, [at, Q]) }), gt = V(null), _t = V(null), { handlePaste: vt } = ve(at, q ? re : Infinity), yt = R((e) => {
|
|
1823
|
+
if (!q) {
|
|
1825
1824
|
let t = e.clipboardData.getData("text/plain");
|
|
1826
|
-
t.length >= N &&
|
|
1825
|
+
t.length >= N && qe?.(t.length, N);
|
|
1827
1826
|
}
|
|
1828
|
-
|
|
1827
|
+
vt(e);
|
|
1829
1828
|
}, [
|
|
1830
|
-
|
|
1829
|
+
q,
|
|
1831
1830
|
N,
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
]),
|
|
1835
|
-
|
|
1836
|
-
|
|
1831
|
+
qe,
|
|
1832
|
+
vt
|
|
1833
|
+
]), bt = X.trim().length > 0 || it.length > 0, xt = bt && !ut && !me, { shouldRender: St, isExiting: Ct, instanceKey: wt } = Ce(!l && bt, At), [Tt, Et] = H([]);
|
|
1834
|
+
z(() => {
|
|
1835
|
+
Et([]);
|
|
1836
|
+
}, [(xe ?? []).map((e) => e.id).join("|")]);
|
|
1837
|
+
let Dt = B(() => (xe ?? []).filter((e) => e.isSelected || !Tt.includes(e.id)), [xe, Tt]), Ot = R((e) => {
|
|
1838
|
+
Et((t) => t.includes(e) ? t : [...t, e]), xe?.find((t) => t.id === e)?.isSelected && we?.(e);
|
|
1839
|
+
}, [xe, we]), jt = Dt.length > 0 && we != null, Mt = le || X.includes("\n") || rt || jt, Nt = oe === void 0 || P != null, Pt = B(() => ge && !Ct && !l, [
|
|
1840
|
+
ge,
|
|
1841
|
+
Ct,
|
|
1837
1842
|
l
|
|
1838
|
-
]),
|
|
1839
|
-
if (
|
|
1840
|
-
if (!
|
|
1841
|
-
|
|
1843
|
+
]), Ft = async () => {
|
|
1844
|
+
if (me) return;
|
|
1845
|
+
if (!q && X.length >= N) {
|
|
1846
|
+
qe?.(X.length, N);
|
|
1842
1847
|
return;
|
|
1843
1848
|
}
|
|
1844
|
-
let e = X, t =
|
|
1845
|
-
|
|
1849
|
+
let e = X, t = it;
|
|
1850
|
+
Z(""), $e.reset();
|
|
1846
1851
|
try {
|
|
1847
1852
|
await n?.(e, t), t.forEach((e) => {
|
|
1848
1853
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
1849
|
-
}),
|
|
1854
|
+
}), ot([]);
|
|
1850
1855
|
} catch {
|
|
1851
|
-
|
|
1856
|
+
Z(e), ot(t);
|
|
1852
1857
|
}
|
|
1853
|
-
},
|
|
1854
|
-
if (!e.nativeEvent.isComposing && !
|
|
1855
|
-
let t = e.currentTarget.selectionStart ?? 0, n =
|
|
1858
|
+
}, It = (e) => {
|
|
1859
|
+
if (!e.nativeEvent.isComposing && !L && !l && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
1860
|
+
let t = e.currentTarget.selectionStart ?? 0, n = $e.navigate(e.key === "ArrowUp" ? "up" : "down", X, t);
|
|
1856
1861
|
if (n !== null) {
|
|
1857
|
-
e.preventDefault(),
|
|
1862
|
+
e.preventDefault(), Z(n);
|
|
1858
1863
|
return;
|
|
1859
1864
|
}
|
|
1860
1865
|
}
|
|
1861
|
-
e.key === "Enter" && (
|
|
1862
|
-
},
|
|
1866
|
+
e.key === "Enter" && (_e === Me.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !l && xt && Nt && !L && Ft());
|
|
1867
|
+
}, Lt = (e) => {
|
|
1863
1868
|
let t = Array.from(e.target.files ?? []);
|
|
1864
1869
|
if (t.length === 0) return;
|
|
1865
|
-
let n =
|
|
1866
|
-
e.target.value = "",
|
|
1870
|
+
let n = Q(t);
|
|
1871
|
+
e.target.value = "", at(n);
|
|
1867
1872
|
};
|
|
1868
|
-
if (
|
|
1869
|
-
state:
|
|
1873
|
+
if ($ !== "idle") return /* @__PURE__ */ W(Xe, {
|
|
1874
|
+
state: $,
|
|
1870
1875
|
analyserNodeRef: dt,
|
|
1871
1876
|
errorMessage: ft,
|
|
1872
1877
|
onStop: mt,
|
|
1873
1878
|
onDiscard: ht,
|
|
1874
|
-
stopLabel:
|
|
1875
|
-
discardLabel:
|
|
1876
|
-
style:
|
|
1877
|
-
className:
|
|
1879
|
+
stopLabel: D,
|
|
1880
|
+
discardLabel: O,
|
|
1881
|
+
style: et,
|
|
1882
|
+
className: ee
|
|
1878
1883
|
});
|
|
1879
|
-
let
|
|
1880
|
-
className: o(
|
|
1881
|
-
ref:
|
|
1882
|
-
autoFocus:
|
|
1884
|
+
let Rt = /* @__PURE__ */ W("textarea", {
|
|
1885
|
+
className: o(J.textarea, A?.fontClassName || "dial-body-paragraph-text", "max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent outline-none [field-sizing:content]"),
|
|
1886
|
+
ref: nt,
|
|
1887
|
+
autoFocus: Fe,
|
|
1883
1888
|
value: X,
|
|
1884
1889
|
onChange: (e) => {
|
|
1885
|
-
|
|
1890
|
+
Z(e.target.value), $e.notifyChange(), u?.(e.target.value);
|
|
1886
1891
|
},
|
|
1887
|
-
onKeyDown:
|
|
1888
|
-
onPaste:
|
|
1889
|
-
placeholder:
|
|
1890
|
-
"aria-label":
|
|
1891
|
-
disabled:
|
|
1892
|
+
onKeyDown: It,
|
|
1893
|
+
onPaste: yt,
|
|
1894
|
+
placeholder: m,
|
|
1895
|
+
"aria-label": h,
|
|
1896
|
+
disabled: L,
|
|
1892
1897
|
rows: 1
|
|
1893
1898
|
});
|
|
1894
|
-
return /* @__PURE__ */
|
|
1895
|
-
ref:
|
|
1896
|
-
style:
|
|
1897
|
-
className: o(
|
|
1898
|
-
children: [(
|
|
1899
|
-
attachments: [...
|
|
1899
|
+
return /* @__PURE__ */ G("div", {
|
|
1900
|
+
ref: _t,
|
|
1901
|
+
style: et,
|
|
1902
|
+
className: o(J.wrapper, L && J.wrapperDisabled, "flex min-h-[64px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border shadow-md", "focus-within:outline focus-within:-outline-offset-1 active:outline active:-outline-offset-1", it.length > 6 ? "py-3 ps-3" : "p-3", ee),
|
|
1903
|
+
children: [(ye.length > 0 || it.length > 0) && /* @__PURE__ */ W(he, {
|
|
1904
|
+
attachments: [...ye, ...it],
|
|
1900
1905
|
onRemove: (e) => {
|
|
1901
|
-
|
|
1906
|
+
ye.some((t) => t.id === e) ? be?.(e) : st(e);
|
|
1902
1907
|
},
|
|
1903
|
-
onRetry:
|
|
1904
|
-
onExpand:
|
|
1908
|
+
onRetry: ct,
|
|
1909
|
+
onExpand: lt,
|
|
1905
1910
|
labels: {
|
|
1906
|
-
removeLabel:
|
|
1907
|
-
retryLabel:
|
|
1911
|
+
removeLabel: S,
|
|
1912
|
+
retryLabel: C
|
|
1908
1913
|
},
|
|
1909
|
-
onAttachmentClick:
|
|
1910
|
-
let t = [...
|
|
1911
|
-
t != null &&
|
|
1914
|
+
onAttachmentClick: Be == null ? void 0 : (e) => {
|
|
1915
|
+
let t = [...ye, ...it].find((t) => t.id === e);
|
|
1916
|
+
t != null && Be(t);
|
|
1912
1917
|
}
|
|
1913
|
-
}),
|
|
1914
|
-
className: o("flex items-center gap-2",
|
|
1918
|
+
}), fe ? Mt && Rt : /* @__PURE__ */ G("div", {
|
|
1919
|
+
className: o("flex items-center gap-2", Mt ? "flex-wrap" : "flex-wrap desktop:flex-nowrap"),
|
|
1915
1920
|
children: [
|
|
1916
|
-
!
|
|
1917
|
-
className: o("flex", "order-2",
|
|
1918
|
-
children: [/* @__PURE__ */
|
|
1921
|
+
!ue && /* @__PURE__ */ G("div", {
|
|
1922
|
+
className: o("flex", "order-2", !Mt && "desktop:order-1"),
|
|
1923
|
+
children: [/* @__PURE__ */ W("input", {
|
|
1919
1924
|
ref: gt,
|
|
1920
1925
|
type: "file",
|
|
1921
1926
|
multiple: !0,
|
|
1922
|
-
accept:
|
|
1927
|
+
accept: _,
|
|
1923
1928
|
className: "sr-only",
|
|
1924
1929
|
"aria-hidden": !0,
|
|
1925
1930
|
tabIndex: -1,
|
|
1926
|
-
onChange:
|
|
1927
|
-
}), /* @__PURE__ */
|
|
1928
|
-
onAttachClick:
|
|
1929
|
-
attachLabel:
|
|
1930
|
-
addMenuTitle:
|
|
1931
|
-
menuTitle:
|
|
1932
|
-
menuCloseLabel:
|
|
1933
|
-
style:
|
|
1934
|
-
isDisabled:
|
|
1935
|
-
chatSettings:
|
|
1936
|
-
extraMenuItems:
|
|
1937
|
-
toolsMenuItems:
|
|
1938
|
-
onToolToggle:
|
|
1939
|
-
toolsMenuTitle:
|
|
1940
|
-
toolsBackLabel:
|
|
1941
|
-
promptsMenuOverlay:
|
|
1942
|
-
promptsMenuTitle:
|
|
1943
|
-
promptsBackLabel:
|
|
1931
|
+
onChange: Lt
|
|
1932
|
+
}), /* @__PURE__ */ W(We, {
|
|
1933
|
+
onAttachClick: de ? void 0 : () => gt.current?.click(),
|
|
1934
|
+
attachLabel: g,
|
|
1935
|
+
addMenuTitle: y,
|
|
1936
|
+
menuTitle: b,
|
|
1937
|
+
menuCloseLabel: x,
|
|
1938
|
+
style: et,
|
|
1939
|
+
isDisabled: L,
|
|
1940
|
+
chatSettings: K,
|
|
1941
|
+
extraMenuItems: tt,
|
|
1942
|
+
toolsMenuItems: xe,
|
|
1943
|
+
onToolToggle: we,
|
|
1944
|
+
toolsMenuTitle: Te,
|
|
1945
|
+
toolsBackLabel: Oe,
|
|
1946
|
+
promptsMenuOverlay: Ae,
|
|
1947
|
+
promptsMenuTitle: Ne,
|
|
1948
|
+
promptsBackLabel: Pe
|
|
1944
1949
|
})]
|
|
1945
1950
|
}),
|
|
1946
|
-
|
|
1951
|
+
Mt && Dt.length > 0 && we != null && /* @__PURE__ */ W("div", {
|
|
1947
1952
|
className: "order-3 min-w-0 flex-1",
|
|
1948
|
-
children: /* @__PURE__ */
|
|
1949
|
-
items:
|
|
1950
|
-
onToolToggle:
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
removeLabel: Ce?.removeLabel
|
|
1953
|
+
children: /* @__PURE__ */ W(Ke, {
|
|
1954
|
+
items: Dt,
|
|
1955
|
+
onToolToggle: we,
|
|
1956
|
+
onToolDismiss: Ot,
|
|
1957
|
+
removeLabel: ke?.removeLabel
|
|
1954
1958
|
})
|
|
1955
1959
|
}),
|
|
1956
|
-
/* @__PURE__ */
|
|
1957
|
-
className: o("order-1 flex w-full min-w-0 items-center self-stretch",
|
|
1958
|
-
children:
|
|
1960
|
+
/* @__PURE__ */ W("div", {
|
|
1961
|
+
className: o("order-1 flex w-full min-w-0 items-center self-stretch", !Mt && "desktop:order-2 desktop:w-auto desktop:flex-1"),
|
|
1962
|
+
children: Rt
|
|
1959
1963
|
}),
|
|
1960
|
-
/* @__PURE__ */
|
|
1961
|
-
className: o("flex flex-shrink-0 items-center gap-2",
|
|
1962
|
-
children: [
|
|
1963
|
-
canSend:
|
|
1964
|
-
onSend:
|
|
1965
|
-
}) : /* @__PURE__ */
|
|
1966
|
-
|
|
1967
|
-
/* @__PURE__ */
|
|
1968
|
-
deployments:
|
|
1964
|
+
/* @__PURE__ */ G("div", {
|
|
1965
|
+
className: o("flex flex-shrink-0 items-center gap-2", Mt && jt ? "order-4" : "order-3", "ms-auto", !Mt && "desktop:ms-0"),
|
|
1966
|
+
children: [I ? I({
|
|
1967
|
+
canSend: xt,
|
|
1968
|
+
onSend: Ft
|
|
1969
|
+
}) : /* @__PURE__ */ G(U, { children: [
|
|
1970
|
+
Ge,
|
|
1971
|
+
/* @__PURE__ */ W(kt, {
|
|
1972
|
+
deployments: oe,
|
|
1969
1973
|
selectedDeploymentId: P,
|
|
1970
1974
|
onDeploymentChange: F,
|
|
1971
|
-
modelSelectorLabels:
|
|
1975
|
+
modelSelectorLabels: se,
|
|
1972
1976
|
isStreaming: l,
|
|
1973
|
-
isMobile:
|
|
1974
|
-
isDisabled:
|
|
1975
|
-
style:
|
|
1976
|
-
modelPickerOverlay:
|
|
1977
|
-
isPickerOpen:
|
|
1978
|
-
onPickerToggle: () =>
|
|
1979
|
-
onPickerOpenChange:
|
|
1977
|
+
isMobile: Je,
|
|
1978
|
+
isDisabled: pe,
|
|
1979
|
+
style: et,
|
|
1980
|
+
modelPickerOverlay: Ve,
|
|
1981
|
+
isPickerOpen: Ye,
|
|
1982
|
+
onPickerToggle: () => Y((e) => !e),
|
|
1983
|
+
onPickerOpenChange: Y
|
|
1980
1984
|
}),
|
|
1981
|
-
l && i ? /* @__PURE__ */
|
|
1985
|
+
l && i ? /* @__PURE__ */ W(Qe, {
|
|
1982
1986
|
onStop: i,
|
|
1983
|
-
ariaLabel:
|
|
1984
|
-
}) : !l &&
|
|
1985
|
-
onSend:
|
|
1986
|
-
isDisabled: !
|
|
1987
|
-
ariaLabel:
|
|
1988
|
-
isExiting:
|
|
1989
|
-
},
|
|
1990
|
-
] }),
|
|
1991
|
-
icon: /* @__PURE__ */
|
|
1987
|
+
ariaLabel: T
|
|
1988
|
+
}) : !l && St && /* @__PURE__ */ W(Ze, {
|
|
1989
|
+
onSend: Ft,
|
|
1990
|
+
isDisabled: !Nt || ut || me,
|
|
1991
|
+
ariaLabel: w,
|
|
1992
|
+
isExiting: Ct
|
|
1993
|
+
}, wt)
|
|
1994
|
+
] }), Pt && /* @__PURE__ */ W(v, {
|
|
1995
|
+
icon: /* @__PURE__ */ W(ae, {
|
|
1992
1996
|
size: d.LG,
|
|
1997
|
+
stroke: f,
|
|
1993
1998
|
"aria-hidden": !0
|
|
1994
1999
|
}),
|
|
1995
|
-
"aria-label":
|
|
1996
|
-
className: "size-
|
|
2000
|
+
"aria-label": E,
|
|
2001
|
+
className: "size-[40px] flex-shrink-0",
|
|
1997
2002
|
onClick: pt,
|
|
1998
|
-
disabled:
|
|
2003
|
+
disabled: L || l
|
|
1999
2004
|
})]
|
|
2000
2005
|
})
|
|
2001
2006
|
]
|
|
2002
2007
|
})]
|
|
2003
2008
|
});
|
|
2004
|
-
},
|
|
2009
|
+
}, Mt = { welcome: "_welcome_n2ph8_1" }, Nt = ({ 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 }) => {
|
|
2005
2010
|
let { colors: u, typography: d } = r ?? {};
|
|
2006
|
-
return /* @__PURE__ */
|
|
2011
|
+
return /* @__PURE__ */ G("div", {
|
|
2007
2012
|
style: a({ "--ci-welcome-color": u?.welcomeText }),
|
|
2008
2013
|
className: o("relative flex w-full flex-col items-center gap-6 px-4 py-5 desktop:p-5", i),
|
|
2009
|
-
children: [n && /* @__PURE__ */
|
|
2010
|
-
className: o(
|
|
2014
|
+
children: [n && /* @__PURE__ */ W("h1", {
|
|
2015
|
+
className: o(Mt.welcome, "m-0 text-center", d?.welcomeClassName || "dial-display2-text"),
|
|
2011
2016
|
children: n
|
|
2012
|
-
}), /* @__PURE__ */
|
|
2017
|
+
}), /* @__PURE__ */ W("div", {
|
|
2013
2018
|
className: "relative w-full max-w-[748px]",
|
|
2014
|
-
children: /* @__PURE__ */
|
|
2019
|
+
children: /* @__PURE__ */ W(jt, {
|
|
2015
2020
|
placeholder: t,
|
|
2016
2021
|
isStreaming: e,
|
|
2017
2022
|
isInputDisabled: c,
|
|
@@ -2022,97 +2027,98 @@ var kt = {
|
|
|
2022
2027
|
})
|
|
2023
2028
|
})]
|
|
2024
2029
|
});
|
|
2025
|
-
},
|
|
2026
|
-
let N =
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
}, [
|
|
2030
|
-
let [P, F] =
|
|
2031
|
-
|
|
2032
|
-
},
|
|
2033
|
-
i(e,
|
|
2034
|
-
}, [
|
|
2035
|
-
if (
|
|
2036
|
-
if (!
|
|
2037
|
-
|
|
2030
|
+
}, Pt = ({ message: e, initialAttachments: t = [], onCancel: n, onSave: i, onUploadAttachment: a, cancelLabel: s = "Cancel", saveLabel: l = "Save & Submit", ariaLabel: u, removeLabel: d, retryLabel: p, addMenuTitle: m = "Add", attachLabel: h = "Attach file", menuTitle: g = "Menu", menuCloseLabel: _ = "Close", className: v, pendingDropFiles: y, onDropFilesConsumed: x, validateAttachment: S, isAttachmentsEnabled: w, hideAttachFile: T = !1, fileAccept: E, maximumAttachmentsAmount: D, onAttachmentsLimitExceeded: O, onDialFileSystemClick: k, dialFileSystemLabel: A, pendingAttachments: ee, onPendingAttachmentsConsumed: j, onAttachmentClick: te, pasteTextThreshold: ne, maxMessageLength: M = 5e4, onMessageTooLong: re }) => {
|
|
2031
|
+
let N = V(null), [ae, oe] = H([]);
|
|
2032
|
+
z(() => {
|
|
2033
|
+
y?.length && (oe(y), x?.());
|
|
2034
|
+
}, [y, x]);
|
|
2035
|
+
let [P, F] = H(e ?? ""), [se, ce] = H([]), [le, ue] = H(t), de = se.some((e) => e.status === r.Loading || e.status === r.Error), fe = (P.trim().length > 0 || se.length > 0 || le.length > 0) && !de, I = (e) => {
|
|
2036
|
+
ue((t) => t.filter((t) => t.id !== e));
|
|
2037
|
+
}, L = R((e, t) => {
|
|
2038
|
+
i(e, le, t);
|
|
2039
|
+
}, [le, i]), pe = () => {
|
|
2040
|
+
if (fe) {
|
|
2041
|
+
if (!w && P.length >= M) {
|
|
2042
|
+
re?.(P.length, M);
|
|
2038
2043
|
return;
|
|
2039
2044
|
}
|
|
2040
|
-
|
|
2045
|
+
L(P, se);
|
|
2041
2046
|
}
|
|
2042
|
-
},
|
|
2047
|
+
}, me = R(() => oe([]), []), he = R((e) => {
|
|
2043
2048
|
let t = Array.from(e.target.files ?? []);
|
|
2044
|
-
t.length !== 0 && (e.target.value = "",
|
|
2045
|
-
}, []),
|
|
2049
|
+
t.length !== 0 && (e.target.value = "", oe(t));
|
|
2050
|
+
}, []), ge = B(() => k ? [{
|
|
2046
2051
|
key: "dial-fs",
|
|
2047
|
-
label:
|
|
2048
|
-
icon: /* @__PURE__ */
|
|
2052
|
+
label: A ?? "DIAL file system",
|
|
2053
|
+
icon: /* @__PURE__ */ W(ie, {
|
|
2049
2054
|
size: c,
|
|
2050
|
-
"aria-hidden": !0
|
|
2055
|
+
"aria-hidden": !0,
|
|
2056
|
+
stroke: f
|
|
2051
2057
|
}),
|
|
2052
|
-
onClick:
|
|
2053
|
-
}] : [], [
|
|
2054
|
-
return /* @__PURE__ */
|
|
2055
|
-
className: o("flex w-full flex-col gap-2",
|
|
2056
|
-
children: [/* @__PURE__ */
|
|
2058
|
+
onClick: k
|
|
2059
|
+
}] : [], [k, A]);
|
|
2060
|
+
return /* @__PURE__ */ G("div", {
|
|
2061
|
+
className: o("flex w-full flex-col gap-2", v),
|
|
2062
|
+
children: [/* @__PURE__ */ W(jt, {
|
|
2057
2063
|
message: e,
|
|
2058
2064
|
ariaLabel: u,
|
|
2059
2065
|
isStacked: !0,
|
|
2060
2066
|
hideActionBar: !0,
|
|
2061
|
-
pendingDropFiles:
|
|
2062
|
-
onDropFilesConsumed:
|
|
2063
|
-
onSend:
|
|
2067
|
+
pendingDropFiles: ae,
|
|
2068
|
+
onDropFilesConsumed: me,
|
|
2069
|
+
onSend: L,
|
|
2064
2070
|
onUploadAttachment: a,
|
|
2065
2071
|
onChange: F,
|
|
2066
|
-
onAttachmentsChange:
|
|
2072
|
+
onAttachmentsChange: ce,
|
|
2067
2073
|
removeLabel: d,
|
|
2068
|
-
retryLabel:
|
|
2074
|
+
retryLabel: p,
|
|
2069
2075
|
className: "max-w-full",
|
|
2070
|
-
prefixAttachments:
|
|
2071
|
-
onRemovePrefixAttachment:
|
|
2072
|
-
validateAttachment:
|
|
2073
|
-
isAttachmentsEnabled:
|
|
2074
|
-
maximumAttachmentsAmount:
|
|
2075
|
-
onAttachmentsLimitExceeded:
|
|
2076
|
-
pendingAttachments:
|
|
2076
|
+
prefixAttachments: le,
|
|
2077
|
+
onRemovePrefixAttachment: I,
|
|
2078
|
+
validateAttachment: S,
|
|
2079
|
+
isAttachmentsEnabled: w,
|
|
2080
|
+
maximumAttachmentsAmount: D,
|
|
2081
|
+
onAttachmentsLimitExceeded: O,
|
|
2082
|
+
pendingAttachments: ee,
|
|
2077
2083
|
onPendingAttachmentsConsumed: j,
|
|
2078
|
-
onAttachmentClick:
|
|
2079
|
-
pasteTextThreshold:
|
|
2084
|
+
onAttachmentClick: te,
|
|
2085
|
+
pasteTextThreshold: ne,
|
|
2080
2086
|
maxMessageLength: M,
|
|
2081
|
-
onMessageTooLong:
|
|
2082
|
-
}), /* @__PURE__ */
|
|
2087
|
+
onMessageTooLong: re
|
|
2088
|
+
}), /* @__PURE__ */ G("div", {
|
|
2083
2089
|
className: "flex items-center justify-between",
|
|
2084
|
-
children: [/* @__PURE__ */
|
|
2090
|
+
children: [/* @__PURE__ */ W("div", {
|
|
2085
2091
|
className: "flex",
|
|
2086
|
-
children: !
|
|
2092
|
+
children: !T && /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("input", {
|
|
2087
2093
|
ref: N,
|
|
2088
2094
|
type: "file",
|
|
2089
2095
|
multiple: !0,
|
|
2090
|
-
accept:
|
|
2096
|
+
accept: E,
|
|
2091
2097
|
className: "sr-only",
|
|
2092
2098
|
"aria-hidden": !0,
|
|
2093
2099
|
tabIndex: -1,
|
|
2094
|
-
onChange:
|
|
2095
|
-
}), /* @__PURE__ */
|
|
2100
|
+
onChange: he
|
|
2101
|
+
}), /* @__PURE__ */ W(We, {
|
|
2096
2102
|
onAttachClick: () => N.current?.click(),
|
|
2097
|
-
attachLabel:
|
|
2098
|
-
addMenuTitle:
|
|
2099
|
-
menuTitle:
|
|
2100
|
-
menuCloseLabel:
|
|
2101
|
-
extraMenuItems:
|
|
2103
|
+
attachLabel: h,
|
|
2104
|
+
addMenuTitle: m,
|
|
2105
|
+
menuTitle: g,
|
|
2106
|
+
menuCloseLabel: _,
|
|
2107
|
+
extraMenuItems: ge
|
|
2102
2108
|
})] })
|
|
2103
|
-
}), /* @__PURE__ */
|
|
2109
|
+
}), /* @__PURE__ */ G("div", {
|
|
2104
2110
|
className: "flex gap-2",
|
|
2105
|
-
children: [/* @__PURE__ */
|
|
2111
|
+
children: [/* @__PURE__ */ W(b, {
|
|
2106
2112
|
label: s,
|
|
2107
2113
|
onClick: n
|
|
2108
|
-
}), /* @__PURE__ */
|
|
2114
|
+
}), /* @__PURE__ */ W(C, {
|
|
2109
2115
|
label: l,
|
|
2110
|
-
onClick:
|
|
2111
|
-
disabled: !
|
|
2116
|
+
onClick: pe,
|
|
2117
|
+
disabled: !fe
|
|
2112
2118
|
})]
|
|
2113
2119
|
})]
|
|
2114
2120
|
})]
|
|
2115
2121
|
});
|
|
2116
2122
|
};
|
|
2117
2123
|
//#endregion
|
|
2118
|
-
export {
|
|
2124
|
+
export { K as BottomSheetShell, Be as ChatSettingsModal, Nt as ConversationInput, Pt as EditMessageInput, jt as Input, Me as SendOnEnter };
|