@epam/ai-dial-conversation-input 1.2.0-dev.20 → 1.2.0-dev.28
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/Input/Input.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.js +572 -573
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, RESIZABLE_TEXTAREA_CLASS_NAME as r, RequestStatus as i, ResponseFormat as a, SELECT_LIST_MAX_HEIGHT_PX as o, buildCssVars as s, mergeClasses as c, useIsMobile as l } from "@epam/ai-dial-chat-shared";
|
|
2
2
|
import { BASE_ICON_SIZE as u, Button as d, CloseButton as f, DIAL_ICON_SIZE as p, DIAL_KIT_ICON_STROKE as m, Dropdown as h, ElementSize as g, ErrorText as _, GhostIconButton as v, Highlight as y, MenuItemMark as b, NeutralButton as x, Popup as S, PopupSize as C, PrimaryButton as w, PrimaryIconButton as T, RadioGroup as E, RadioGroupOrientation as D, Search as O, Skeleton as k, SkeletonVariant as ee, Slider as A, Spinner as te, StaticIconButton as j, Textarea as ne, TextareaResize as M, Tooltip as N } from "@epam/ai-dial-ui-kit";
|
|
3
|
-
import { IconArrowLeft as re, IconArrowNarrowRight as ie, IconCheck as
|
|
4
|
-
import { createElement as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { AttachmentTray as
|
|
3
|
+
import { IconArrowLeft as re, IconArrowNarrowRight as ie, IconCheck as P, IconChevronDown as F, IconChevronRight as ae, IconFile as oe, IconMicrophone as se, IconPaperclip as ce, IconPlayerStopFilled as I, IconPlaystationSquare as le, IconPlus as ue, IconSettings as de, IconTool as fe, IconX as pe } from "@tabler/icons-react";
|
|
4
|
+
import { createElement as me, memo as he, useCallback as L, useEffect as R, useImperativeHandle as ge, useLayoutEffect as _e, useMemo as z, useRef as B, useState as V } from "react";
|
|
5
|
+
import { createPortal as H } from "react-dom";
|
|
6
|
+
import { Fragment as U, jsx as W, jsxs as G } from "react/jsx-runtime";
|
|
7
|
+
import { AttachmentTray as ve, MAX_UPLOADS_PER_MINUTE as ye, generateAttachmentId as be, useClipboardPaste as xe } from "@epam/ai-dial-attachment-input";
|
|
8
8
|
//#region src/hooks/useBottomSheet.ts
|
|
9
|
-
var
|
|
10
|
-
|
|
9
|
+
var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", Ce = (e, t, n) => {
|
|
10
|
+
R(() => {
|
|
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]), R(() => {
|
|
17
17
|
if (e) return document.body.style.overflow = "hidden", () => {
|
|
18
18
|
document.body.style.overflow = "";
|
|
19
19
|
};
|
|
20
|
-
}, [e]),
|
|
20
|
+
}, [e]), R(() => {
|
|
21
21
|
if (!e || n?.current == null) return;
|
|
22
22
|
let t = n.current, r = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
23
|
-
(t.querySelector(
|
|
23
|
+
(t.querySelector(Se) ?? t).focus();
|
|
24
24
|
let i = (e) => {
|
|
25
25
|
if (e.key !== "Tab") return;
|
|
26
|
-
let n = Array.from(t.querySelectorAll(
|
|
26
|
+
let n = Array.from(t.querySelectorAll(Se));
|
|
27
27
|
if (n.length === 0) {
|
|
28
28
|
e.preventDefault(), t.focus();
|
|
29
29
|
return;
|
|
@@ -35,27 +35,27 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
35
35
|
document.removeEventListener("keydown", i), r?.focus();
|
|
36
36
|
};
|
|
37
37
|
}, [e, n]);
|
|
38
|
-
},
|
|
38
|
+
}, we = {
|
|
39
39
|
backdrop: "_backdrop_1d50f_9",
|
|
40
40
|
sheet: "_sheet_1d50f_13",
|
|
41
41
|
"slide-up": "_slide-up_1d50f_1",
|
|
42
42
|
title: "_title_1d50f_18",
|
|
43
43
|
divider: "_divider_1d50f_22"
|
|
44
|
-
},
|
|
45
|
-
let y =
|
|
46
|
-
if (
|
|
44
|
+
}, Te = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: a, "aria-label": o, style: l, titleClassName: u = "dial-body-semi-text", className: d, colors: h, children: _ }) => {
|
|
45
|
+
let y = B(null);
|
|
46
|
+
if (Ce(e, r, y), !e || typeof document > "u") return null;
|
|
47
47
|
let b = s({
|
|
48
48
|
"--ci-backdrop": h?.backdrop,
|
|
49
49
|
"--ci-sheet-bg": h?.sheetBg,
|
|
50
50
|
"--ci-sheet-text": h?.sheetText,
|
|
51
51
|
"--ci-sheet-divider": h?.divider
|
|
52
52
|
});
|
|
53
|
-
return
|
|
54
|
-
className: c(
|
|
53
|
+
return H(/* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("div", {
|
|
54
|
+
className: c(we.backdrop, "fixed inset-0 z-[55]"),
|
|
55
55
|
style: b,
|
|
56
56
|
onPointerDown: r,
|
|
57
57
|
"aria-hidden": !0
|
|
58
|
-
}), /* @__PURE__ */
|
|
58
|
+
}), /* @__PURE__ */ G("div", {
|
|
59
59
|
ref: y,
|
|
60
60
|
role: "dialog",
|
|
61
61
|
"aria-modal": !0,
|
|
@@ -65,14 +65,14 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
65
65
|
...b,
|
|
66
66
|
...l
|
|
67
67
|
},
|
|
68
|
-
className: c(
|
|
69
|
-
children: [t != null && /* @__PURE__ */
|
|
68
|
+
className: c(we.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col rounded-t-lg", d),
|
|
69
|
+
children: [t != null && /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G("div", {
|
|
70
70
|
className: "relative flex h-[60px] flex-shrink-0 items-center justify-center px-4",
|
|
71
71
|
children: [
|
|
72
|
-
i && /* @__PURE__ */
|
|
72
|
+
i && /* @__PURE__ */ W("div", {
|
|
73
73
|
className: "absolute start-4",
|
|
74
|
-
children: /* @__PURE__ */
|
|
75
|
-
icon: /* @__PURE__ */
|
|
74
|
+
children: /* @__PURE__ */ W(v, {
|
|
75
|
+
icon: /* @__PURE__ */ W(re, {
|
|
76
76
|
size: p.LG,
|
|
77
77
|
stroke: m,
|
|
78
78
|
className: "rtl:scale-x-[-1]"
|
|
@@ -81,41 +81,41 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
81
81
|
onClick: i
|
|
82
82
|
})
|
|
83
83
|
}),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
className: c(
|
|
84
|
+
/* @__PURE__ */ W("span", {
|
|
85
|
+
className: c(we.title, u),
|
|
86
86
|
children: t
|
|
87
87
|
}),
|
|
88
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ W("div", {
|
|
89
89
|
className: "absolute end-4 m-2",
|
|
90
|
-
children: /* @__PURE__ */
|
|
90
|
+
children: /* @__PURE__ */ W(f, {
|
|
91
91
|
ariaLabel: n,
|
|
92
92
|
onClose: r,
|
|
93
93
|
size: g.Standard
|
|
94
94
|
})
|
|
95
95
|
})
|
|
96
96
|
]
|
|
97
|
-
}), /* @__PURE__ */
|
|
97
|
+
}), /* @__PURE__ */ W("div", { className: c(we.divider, "h-px flex-shrink-0") })] }), /* @__PURE__ */ W("div", {
|
|
98
98
|
className: "overflow-y-auto",
|
|
99
99
|
children: _
|
|
100
100
|
})]
|
|
101
101
|
})] }), document.body);
|
|
102
|
-
},
|
|
102
|
+
}, Ee = async (e, t, n) => {
|
|
103
103
|
let r = 6e4 / t, i = [];
|
|
104
104
|
for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
|
|
105
105
|
await Promise.allSettled(i);
|
|
106
|
-
},
|
|
107
|
-
let [h, g] =
|
|
108
|
-
|
|
106
|
+
}, De = ({ initialAttachments: n, onUploadAttachment: r, onAttachmentsChange: a, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, pendingAttachments: l, onPendingAttachmentsConsumed: u, onExpandPastedText: d, maximumAttachmentsAmount: f, baseAttachmentsAmount: p = 0, onAttachmentsLimitExceeded: m }) => {
|
|
107
|
+
let [h, g] = V(n), _ = B(h);
|
|
108
|
+
R(() => {
|
|
109
109
|
_.current = h;
|
|
110
|
-
}, [h]),
|
|
110
|
+
}, [h]), R(() => () => {
|
|
111
111
|
_.current.forEach((e) => {
|
|
112
112
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
113
113
|
});
|
|
114
114
|
}, []);
|
|
115
|
-
let v =
|
|
115
|
+
let v = L((e) => e.map((e) => {
|
|
116
116
|
let n = e.type.startsWith("image/"), r = e.type.startsWith("audio/"), a = n ? URL.createObjectURL(e) : void 0, o = r ? URL.createObjectURL(e) : void 0;
|
|
117
117
|
return {
|
|
118
|
-
id:
|
|
118
|
+
id: be(),
|
|
119
119
|
name: e.name,
|
|
120
120
|
contentType: e.type,
|
|
121
121
|
file: e,
|
|
@@ -124,26 +124,26 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
124
124
|
previewUrl: a,
|
|
125
125
|
playUrl: o
|
|
126
126
|
};
|
|
127
|
-
}), []), y =
|
|
128
|
-
|
|
127
|
+
}), []), y = B(a);
|
|
128
|
+
R(() => {
|
|
129
129
|
y.current = a;
|
|
130
130
|
}, [a]);
|
|
131
|
-
let b =
|
|
131
|
+
let b = B(!0), x = L((e) => {
|
|
132
132
|
g((t) => {
|
|
133
133
|
let n = e(t);
|
|
134
134
|
return n === t ? t : n;
|
|
135
135
|
});
|
|
136
136
|
}, []);
|
|
137
|
-
|
|
137
|
+
R(() => {
|
|
138
138
|
if (b.current) {
|
|
139
139
|
b.current = !1;
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
142
|
y.current?.(h);
|
|
143
143
|
}, [h]);
|
|
144
|
-
let S =
|
|
144
|
+
let S = L((e) => {
|
|
145
145
|
g(e);
|
|
146
|
-
}, []), C =
|
|
146
|
+
}, []), C = L(async (t) => {
|
|
147
147
|
if (r) {
|
|
148
148
|
x((e) => e.map((e) => e.id === t.id ? {
|
|
149
149
|
...e,
|
|
@@ -166,7 +166,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
166
166
|
} : e));
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
}, [r, x]), w =
|
|
169
|
+
}, [r, x]), w = L((e, t = !0) => {
|
|
170
170
|
let n = new Set(_.current.map((e) => e.id)), r = e.filter((e) => !n.has(e.id));
|
|
171
171
|
if (r.length !== 0) {
|
|
172
172
|
if (f != null && f > 0 && Number.isFinite(f)) {
|
|
@@ -187,7 +187,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
187
187
|
status: i.Error,
|
|
188
188
|
errorReason: n
|
|
189
189
|
} : e));
|
|
190
|
-
}),
|
|
190
|
+
}), Ee(e, ye, C);
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
}, [
|
|
@@ -198,20 +198,20 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
198
198
|
C,
|
|
199
199
|
o
|
|
200
200
|
]);
|
|
201
|
-
|
|
201
|
+
R(() => {
|
|
202
202
|
s.length !== 0 && (w(v(s)), c?.());
|
|
203
203
|
}, [
|
|
204
204
|
w,
|
|
205
205
|
v,
|
|
206
206
|
c,
|
|
207
207
|
s
|
|
208
|
-
]),
|
|
208
|
+
]), R(() => {
|
|
209
209
|
l.length !== 0 && (w(l, !1), u?.());
|
|
210
210
|
}, [
|
|
211
211
|
w,
|
|
212
212
|
u,
|
|
213
213
|
l
|
|
214
|
-
]),
|
|
214
|
+
]), R(() => {
|
|
215
215
|
if (!o) return;
|
|
216
216
|
let t = !1, n = [], r = _.current.map((r) => {
|
|
217
217
|
if (r.status === i.Loading) return r;
|
|
@@ -238,7 +238,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
238
238
|
x,
|
|
239
239
|
C
|
|
240
240
|
]);
|
|
241
|
-
let T =
|
|
241
|
+
let T = L((e) => {
|
|
242
242
|
x((t) => {
|
|
243
243
|
let n = t.find((t) => t.id === e);
|
|
244
244
|
return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
|
|
@@ -250,11 +250,11 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
250
250
|
addAttachments: w,
|
|
251
251
|
resetAttachments: S,
|
|
252
252
|
handleRemove: T,
|
|
253
|
-
handleRetry:
|
|
253
|
+
handleRetry: L((e) => {
|
|
254
254
|
let t = h.find((t) => t.id === e);
|
|
255
255
|
t && C(t);
|
|
256
256
|
}, [h, C]),
|
|
257
|
-
handleExpand:
|
|
257
|
+
handleExpand: L(async (e) => {
|
|
258
258
|
let n = h.find((t) => t.id === e);
|
|
259
259
|
if (!n || n.type !== t.Pasted) return;
|
|
260
260
|
let r = await n.file.text();
|
|
@@ -266,46 +266,46 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
266
266
|
]),
|
|
267
267
|
hasBlockedAttachments: h.some((e) => e.status === i.Loading || e.status === i.Error)
|
|
268
268
|
};
|
|
269
|
-
},
|
|
269
|
+
}, Oe = (e, t) => {
|
|
270
270
|
if (!e.startsWith(t)) return !1;
|
|
271
271
|
let n = e.slice(t.length);
|
|
272
272
|
return !/\s/.test(n) && !n.includes(t);
|
|
273
|
-
},
|
|
274
|
-
let [n, r] =
|
|
273
|
+
}, ke = ({ config: e, message: t }) => {
|
|
274
|
+
let [n, r] = V(!1), [i, a] = V(!1), o = e != null && Oe(t, e.triggerPrefix) ? t.slice(e.triggerPrefix.length) : "", s = L((n, a, o) => {
|
|
275
275
|
if (e == null || a || t !== "" || i) return;
|
|
276
|
-
let s = n === e.triggerPrefix, c = o === "insertFromPaste" &&
|
|
276
|
+
let s = n === e.triggerPrefix, c = o === "insertFromPaste" && Oe(n, e.triggerPrefix);
|
|
277
277
|
(s || c) && r(!0);
|
|
278
278
|
}, [
|
|
279
279
|
e,
|
|
280
280
|
t,
|
|
281
281
|
i
|
|
282
282
|
]);
|
|
283
|
-
return
|
|
283
|
+
return R(() => {
|
|
284
284
|
if (e == null) {
|
|
285
285
|
r(!1), a(!1);
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
288
|
-
|
|
288
|
+
Oe(t, e.triggerPrefix) || (r(!1), a(!1));
|
|
289
289
|
}, [e, t]), {
|
|
290
290
|
isMenuOpen: n,
|
|
291
291
|
query: o,
|
|
292
|
-
dismiss:
|
|
292
|
+
dismiss: L(() => {
|
|
293
293
|
r(!1), a(!0);
|
|
294
294
|
}, []),
|
|
295
295
|
handleValueChange: s
|
|
296
296
|
};
|
|
297
|
-
},
|
|
298
|
-
let t =
|
|
297
|
+
}, Ae = (e, t) => !e.slice(0, t).includes("\n"), je = (e, t) => !e.slice(t).includes("\n"), Me = (e) => {
|
|
298
|
+
let t = B(e);
|
|
299
299
|
t.current = e;
|
|
300
|
-
let n =
|
|
300
|
+
let n = B(-1), r = B(""), i = L((e, i, a) => {
|
|
301
301
|
let o = t.current;
|
|
302
|
-
return !o || o.length === 0 ? null : e === "up" ? !
|
|
303
|
-
}, []), a =
|
|
302
|
+
return !o || o.length === 0 ? null : e === "up" ? !Ae(i, a) || n.current === 0 ? null : (n.current === -1 ? (r.current = i, n.current = o.length - 1) : --n.current, o[n.current]) : n.current === -1 || !je(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
|
|
303
|
+
}, []), a = L(() => {
|
|
304
304
|
n.current = -1, r.current = "";
|
|
305
|
-
}, []), o =
|
|
305
|
+
}, []), o = L(() => {
|
|
306
306
|
n.current = -1, r.current = "";
|
|
307
307
|
}, []);
|
|
308
|
-
return
|
|
308
|
+
return z(() => ({
|
|
309
309
|
navigate: i,
|
|
310
310
|
notifyChange: a,
|
|
311
311
|
reset: o
|
|
@@ -314,40 +314,40 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
314
314
|
a,
|
|
315
315
|
o
|
|
316
316
|
]);
|
|
317
|
-
},
|
|
318
|
-
let [n, r] =
|
|
319
|
-
return
|
|
317
|
+
}, Ne = ({ messageProp: e, messageRevision: t }) => {
|
|
318
|
+
let [n, r] = V(e), i = B(null);
|
|
319
|
+
return R(() => {
|
|
320
320
|
r(e);
|
|
321
321
|
}, [e, t]), {
|
|
322
322
|
message: n,
|
|
323
323
|
setMessage: r,
|
|
324
324
|
textareaRef: i
|
|
325
325
|
};
|
|
326
|
-
},
|
|
326
|
+
}, Pe = (e, t, n) => {
|
|
327
327
|
let r = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set;
|
|
328
328
|
r ? r.call(e, t) : e.value = t, e.setSelectionRange(n, n), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
329
|
-
},
|
|
330
|
-
let n = e?.revision, r =
|
|
329
|
+
}, Fe = ({ insertion: e, textareaRef: t }) => {
|
|
330
|
+
let n = e?.revision, r = B(e?.text);
|
|
331
331
|
r.current = e?.text;
|
|
332
|
-
let i =
|
|
333
|
-
|
|
332
|
+
let i = B(n);
|
|
333
|
+
R(() => {
|
|
334
334
|
if (n === i.current) return;
|
|
335
335
|
i.current = n;
|
|
336
336
|
let e = t.current, a = r.current;
|
|
337
337
|
if (!e || !a) return;
|
|
338
338
|
let { value: o, selectionStart: s, selectionEnd: c } = e, l = s ?? o.length, u = c ?? l;
|
|
339
|
-
e.focus(), !(typeof document.execCommand == "function" && document.execCommand("insertText", !1, a)) &&
|
|
339
|
+
e.focus(), !(typeof document.execCommand == "function" && document.execCommand("insertText", !1, a)) && Pe(e, `${o.slice(0, l)}${a}${o.slice(u)}`, l + a.length);
|
|
340
340
|
}, [n, t]);
|
|
341
|
-
},
|
|
341
|
+
}, Ie = /* @__PURE__ */ function(e) {
|
|
342
342
|
return e.Idle = "idle", e.Recording = "recording", e.Processing = "processing", e.Error = "error", e;
|
|
343
|
-
}({}),
|
|
343
|
+
}({}), Le = /* @__PURE__ */ function(e) {
|
|
344
344
|
return e.Dictation = "dictation", e.Attachment = "attachment", e;
|
|
345
|
-
}({}),
|
|
345
|
+
}({}), Re = [
|
|
346
346
|
"audio/webm;codecs=opus",
|
|
347
347
|
"audio/ogg;codecs=opus",
|
|
348
348
|
"audio/webm"
|
|
349
|
-
],
|
|
350
|
-
let [i, a] =
|
|
349
|
+
], ze = 100, Be = 100, Ve = .01, He = ({ onAttachAudio: e, onTranscribeAudio: t, onTranscript: n, errorLabel: r = "Voice input failed" }) => {
|
|
350
|
+
let [i, a] = V("idle"), [o, s] = V(null), c = B(null), l = B(null), u = B({
|
|
351
351
|
onAttachAudio: e,
|
|
352
352
|
onTranscribeAudio: t,
|
|
353
353
|
onTranscript: n,
|
|
@@ -359,7 +359,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
359
359
|
onTranscript: n,
|
|
360
360
|
errorLabel: r
|
|
361
361
|
};
|
|
362
|
-
let d =
|
|
362
|
+
let d = L((e = "dictation") => {
|
|
363
363
|
if (l.current) return;
|
|
364
364
|
let t = { controller: new AbortController() };
|
|
365
365
|
l.current = t, s(null), a("recording");
|
|
@@ -377,7 +377,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
377
377
|
n.aborted || (t.controller.abort(), l.current = null, s(e instanceof Error ? e.message : u.current.errorLabel), a("error"));
|
|
378
378
|
}, b = () => {
|
|
379
379
|
if (!i || n.aborted) return;
|
|
380
|
-
let e =
|
|
380
|
+
let e = Re.find((e) => MediaRecorder.isTypeSupported(e)), t = new MediaRecorder(i, e ? { mimeType: e } : void 0);
|
|
381
381
|
d = t;
|
|
382
382
|
let o = Date.now(), s = !1, l = !1, b = new Uint8Array(c.current?.fftSize ?? 256), x = async () => {
|
|
383
383
|
if (!(m || n.aborted)) {
|
|
@@ -385,7 +385,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
385
385
|
try {
|
|
386
386
|
let i = t.mimeType || e || "audio/webm", c = new Blob(h, { type: i });
|
|
387
387
|
h.length = 0, _();
|
|
388
|
-
let d = Date.now() - o >=
|
|
388
|
+
let d = Date.now() - o >= Be;
|
|
389
389
|
if (c.size && (!r || d && (!s || l))) {
|
|
390
390
|
let e = i.split(";")[0].split("/")[1] ?? "webm", t = new File([c], "voice-" + crypto.randomUUID() + "." + e, { type: i });
|
|
391
391
|
if (r) {
|
|
@@ -411,8 +411,8 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
411
411
|
e.getByteTimeDomainData(b), s = !0;
|
|
412
412
|
let t = 0;
|
|
413
413
|
for (let e of b) t += ((e - 128) / 128) ** 2;
|
|
414
|
-
Math.sqrt(t / b.length) >=
|
|
415
|
-
},
|
|
414
|
+
Math.sqrt(t / b.length) >= Ve && (l = !0, g());
|
|
415
|
+
}, ze));
|
|
416
416
|
};
|
|
417
417
|
t.stop = () => {
|
|
418
418
|
p || n.aborted || (p = !0, g(), a("processing"), d?.state === "recording" && d.stop());
|
|
@@ -430,10 +430,10 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
430
430
|
y(e);
|
|
431
431
|
}
|
|
432
432
|
})();
|
|
433
|
-
}, []), f =
|
|
433
|
+
}, []), f = L(() => l.current?.stop?.(), []), p = L(() => {
|
|
434
434
|
l.current?.controller.abort(), l.current = null, s(null), a("idle");
|
|
435
435
|
}, []);
|
|
436
|
-
return
|
|
436
|
+
return R(() => () => {
|
|
437
437
|
l.current?.controller.abort(), l.current = null;
|
|
438
438
|
}, []), {
|
|
439
439
|
state: i,
|
|
@@ -443,12 +443,12 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
443
443
|
stopRecording: f,
|
|
444
444
|
discardRecording: p
|
|
445
445
|
};
|
|
446
|
-
},
|
|
446
|
+
}, Ue = /* @__PURE__ */ function(e) {
|
|
447
447
|
return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
|
|
448
|
-
}({}),
|
|
448
|
+
}({}), We = {
|
|
449
449
|
item: "_item_1sr2n_1",
|
|
450
450
|
itemIcon: "_itemIcon_1sr2n_11"
|
|
451
|
-
},
|
|
451
|
+
}, Ge = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: a, className: o, titleClassName: l = "dial-body-semi-text", itemLabelClassName: u = "dial-small-text", btnTextClassName: f = "", colors: p }) => {
|
|
452
452
|
let m = (e) => {
|
|
453
453
|
e(), r();
|
|
454
454
|
}, h = s({
|
|
@@ -457,7 +457,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
457
457
|
"--ci-sheet-item-active": p?.itemActiveBg,
|
|
458
458
|
"--ci-sheet-icon": p?.itemIcon
|
|
459
459
|
});
|
|
460
|
-
return /* @__PURE__ */
|
|
460
|
+
return /* @__PURE__ */ W(Te, {
|
|
461
461
|
isOpen: e,
|
|
462
462
|
title: t,
|
|
463
463
|
closeLabel: n,
|
|
@@ -466,23 +466,23 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
466
466
|
className: o,
|
|
467
467
|
titleClassName: l,
|
|
468
468
|
colors: p?.shell,
|
|
469
|
-
children: /* @__PURE__ */
|
|
469
|
+
children: /* @__PURE__ */ W("ul", {
|
|
470
470
|
role: "list",
|
|
471
471
|
className: "flex flex-col",
|
|
472
472
|
style: h,
|
|
473
|
-
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */
|
|
473
|
+
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ W("li", { children: /* @__PURE__ */ W(d, {
|
|
474
474
|
type: "button",
|
|
475
|
-
className: c(
|
|
476
|
-
iconBefore: /* @__PURE__ */
|
|
477
|
-
className:
|
|
475
|
+
className: c(We.item, "w-full gap-3 px-4 py-[10px] text-start"),
|
|
476
|
+
iconBefore: /* @__PURE__ */ W("span", {
|
|
477
|
+
className: We.itemIcon,
|
|
478
478
|
children: n
|
|
479
479
|
}),
|
|
480
|
-
iconAfter: r ? /* @__PURE__ */
|
|
480
|
+
iconAfter: r ? /* @__PURE__ */ W("span", {
|
|
481
481
|
className: "ms-auto",
|
|
482
482
|
children: r
|
|
483
483
|
}) : null,
|
|
484
484
|
textClassName: f,
|
|
485
|
-
label: /* @__PURE__ */
|
|
485
|
+
label: /* @__PURE__ */ W("span", {
|
|
486
486
|
className: u,
|
|
487
487
|
children: t
|
|
488
488
|
}),
|
|
@@ -490,9 +490,9 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
490
490
|
}) }, e))
|
|
491
491
|
})
|
|
492
492
|
});
|
|
493
|
-
},
|
|
494
|
-
let [s, c] =
|
|
495
|
-
|
|
493
|
+
}, Ke = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
494
|
+
let [s, c] = V(t), [l, u] = V(n), [d, f] = V(r), p = B(o);
|
|
495
|
+
R(() => {
|
|
496
496
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
497
497
|
}, [
|
|
498
498
|
o,
|
|
@@ -509,7 +509,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
509
509
|
setResponseFormat: c,
|
|
510
510
|
setSystemPrompt: u,
|
|
511
511
|
setTemperature: f,
|
|
512
|
-
handleSubmit:
|
|
512
|
+
handleSubmit: L(() => {
|
|
513
513
|
if (!m) return;
|
|
514
514
|
let t = {};
|
|
515
515
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -523,17 +523,17 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
523
523
|
a
|
|
524
524
|
])
|
|
525
525
|
};
|
|
526
|
-
},
|
|
526
|
+
}, qe = { label: "_label_14i7c_1" }, Je = ({ features: e, responseFormat: t, systemPrompt: n, temperature: i, onResponseFormatChange: o, onSystemPromptChange: l, onTemperatureChange: u, responseFormatLabel: d = "Response format", responseFormatHint: f = "Applies to new and existing messages", responseFormatMarkdownLabel: p = "Markdown", responseFormatPlainTextLabel: m = "Plain text", systemPromptLabel: h = "System prompt", systemPromptTooltip: g = "Enter a prompt", temperatureLabel: _ = "Temperature", temperatureLabels: v = [
|
|
527
527
|
"Precise",
|
|
528
528
|
"Neutral",
|
|
529
529
|
"Creative"
|
|
530
530
|
], temperatureHint: y, labelClassName: b = "!dial-small-semi-text", colors: x }) => {
|
|
531
|
-
let S = s({ "--csf-label-text": x?.labelText }), C = c(b,
|
|
532
|
-
return /* @__PURE__ */
|
|
531
|
+
let S = s({ "--csf-label-text": x?.labelText }), C = c(b, qe.label, "gap-1");
|
|
532
|
+
return /* @__PURE__ */ G("div", {
|
|
533
533
|
className: "flex flex-col gap-4 px-6 pb-3",
|
|
534
534
|
style: S,
|
|
535
535
|
children: [
|
|
536
|
-
e.responseFormat && /* @__PURE__ */
|
|
536
|
+
e.responseFormat && /* @__PURE__ */ W(E, {
|
|
537
537
|
id: "response-format",
|
|
538
538
|
labelProps: {
|
|
539
539
|
label: d,
|
|
@@ -552,7 +552,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
552
552
|
}],
|
|
553
553
|
onChange: (e) => o(e)
|
|
554
554
|
}),
|
|
555
|
-
e.systemPrompt && /* @__PURE__ */
|
|
555
|
+
e.systemPrompt && /* @__PURE__ */ W(ne, {
|
|
556
556
|
value: n,
|
|
557
557
|
placeholder: g,
|
|
558
558
|
className: r,
|
|
@@ -563,7 +563,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
563
563
|
},
|
|
564
564
|
onChange: (e) => l(e ?? "")
|
|
565
565
|
}),
|
|
566
|
-
e.temperature && /* @__PURE__ */
|
|
566
|
+
e.temperature && /* @__PURE__ */ W(A, {
|
|
567
567
|
labelProps: {
|
|
568
568
|
label: _,
|
|
569
569
|
className: C,
|
|
@@ -579,8 +579,8 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
579
579
|
})
|
|
580
580
|
]
|
|
581
581
|
});
|
|
582
|
-
},
|
|
583
|
-
let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat: k, setSystemPrompt: ee, setTemperature: A, handleSubmit: te } =
|
|
582
|
+
}, K = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: o, initialResponseFormat: s, initialSystemPrompt: l, initialTemperature: u, onSave: d, title: f = "Chat settings", responseFormatLabel: p, responseFormatHint: m, responseFormatMarkdownLabel: h, responseFormatPlainTextLabel: g, systemPromptLabel: _, systemPromptTooltip: v, temperatureLabel: y, temperatureLabels: b, temperatureHint: x, saveLabel: S = "Apply changes", saveDisabledTooltip: C }) => {
|
|
583
|
+
let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat: k, setSystemPrompt: ee, setTemperature: A, handleSubmit: te } = Ke({
|
|
584
584
|
isOpen: e,
|
|
585
585
|
features: o,
|
|
586
586
|
initialResponseFormat: s,
|
|
@@ -589,7 +589,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
589
589
|
onSave: d,
|
|
590
590
|
onClose: r
|
|
591
591
|
});
|
|
592
|
-
return /* @__PURE__ */
|
|
592
|
+
return /* @__PURE__ */ G(Te, {
|
|
593
593
|
isOpen: e,
|
|
594
594
|
title: f,
|
|
595
595
|
closeLabel: i,
|
|
@@ -597,7 +597,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
597
597
|
onBack: t,
|
|
598
598
|
backLabel: n,
|
|
599
599
|
style: a,
|
|
600
|
-
children: [/* @__PURE__ */
|
|
600
|
+
children: [/* @__PURE__ */ W(Je, {
|
|
601
601
|
features: o,
|
|
602
602
|
responseFormat: T,
|
|
603
603
|
systemPrompt: E,
|
|
@@ -614,13 +614,13 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
614
614
|
temperatureLabel: y,
|
|
615
615
|
temperatureLabels: b,
|
|
616
616
|
temperatureHint: x
|
|
617
|
-
}), /* @__PURE__ */
|
|
617
|
+
}), /* @__PURE__ */ W("div", {
|
|
618
618
|
className: c("px-6 py-4 mobile:pb-8"),
|
|
619
|
-
children: /* @__PURE__ */
|
|
619
|
+
children: /* @__PURE__ */ W(N, {
|
|
620
620
|
tooltip: C,
|
|
621
621
|
hideTooltip: O || !C,
|
|
622
622
|
triggerClassName: "w-full",
|
|
623
|
-
children: /* @__PURE__ */
|
|
623
|
+
children: /* @__PURE__ */ W(w, {
|
|
624
624
|
label: S,
|
|
625
625
|
onClick: te,
|
|
626
626
|
disabled: !O,
|
|
@@ -629,8 +629,8 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
629
629
|
})
|
|
630
630
|
})]
|
|
631
631
|
});
|
|
632
|
-
},
|
|
633
|
-
let { responseFormat: b, systemPrompt: x, temperature: T, canSubmit: E, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit: ee } =
|
|
632
|
+
}, Ye = { modal: "_modal_kl0h0_1" }, Xe = ({ 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 = Ye.modal }) => {
|
|
633
|
+
let { responseFormat: b, systemPrompt: x, temperature: T, canSubmit: E, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit: ee } = Ke({
|
|
634
634
|
features: e,
|
|
635
635
|
initialResponseFormat: t,
|
|
636
636
|
initialSystemPrompt: n,
|
|
@@ -638,26 +638,26 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
638
638
|
onSave: i,
|
|
639
639
|
onClose: a
|
|
640
640
|
});
|
|
641
|
-
return /* @__PURE__ */
|
|
641
|
+
return /* @__PURE__ */ W(S, {
|
|
642
642
|
open: !0,
|
|
643
643
|
header: o,
|
|
644
644
|
titleClassName: s,
|
|
645
645
|
size: C.Sm,
|
|
646
646
|
onClose: a,
|
|
647
647
|
className: y,
|
|
648
|
-
footer: /* @__PURE__ */
|
|
648
|
+
footer: /* @__PURE__ */ W("div", {
|
|
649
649
|
className: "flex justify-end px-6 py-4",
|
|
650
|
-
children: /* @__PURE__ */
|
|
650
|
+
children: /* @__PURE__ */ W(N, {
|
|
651
651
|
tooltip: v,
|
|
652
652
|
hideTooltip: E || !v,
|
|
653
|
-
children: /* @__PURE__ */
|
|
653
|
+
children: /* @__PURE__ */ W(w, {
|
|
654
654
|
label: _,
|
|
655
655
|
onClick: ee,
|
|
656
656
|
disabled: !E
|
|
657
657
|
})
|
|
658
658
|
})
|
|
659
659
|
}),
|
|
660
|
-
children: /* @__PURE__ */
|
|
660
|
+
children: /* @__PURE__ */ W(Je, {
|
|
661
661
|
features: e,
|
|
662
662
|
responseFormat: b,
|
|
663
663
|
systemPrompt: x,
|
|
@@ -676,10 +676,10 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
676
676
|
temperatureHint: g
|
|
677
677
|
})
|
|
678
678
|
});
|
|
679
|
-
},
|
|
679
|
+
}, Ze = {
|
|
680
680
|
icon: "_icon_1fv6z_1",
|
|
681
681
|
selectedIcon: "_selectedIcon_1fv6z_5"
|
|
682
|
-
},
|
|
682
|
+
}, Qe = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: a, title: o = "Tools", items: l, onToolToggle: f, itemLabelClassName: p = "dial-small-text", colors: h }) => /* @__PURE__ */ W(Te, {
|
|
683
683
|
isOpen: e,
|
|
684
684
|
title: o,
|
|
685
685
|
closeLabel: i,
|
|
@@ -687,33 +687,33 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
687
687
|
onBack: t,
|
|
688
688
|
backLabel: n,
|
|
689
689
|
style: a,
|
|
690
|
-
children: /* @__PURE__ */
|
|
690
|
+
children: /* @__PURE__ */ W("ul", {
|
|
691
691
|
role: "menu",
|
|
692
692
|
className: "flex flex-col pb-4",
|
|
693
693
|
style: s({
|
|
694
694
|
"--tbs-icon-text": h?.iconText,
|
|
695
695
|
"--tbs-selected-icon-text": h?.selectedIconText
|
|
696
696
|
}),
|
|
697
|
-
children: l.map((e) => /* @__PURE__ */
|
|
697
|
+
children: l.map((e) => /* @__PURE__ */ W("li", {
|
|
698
698
|
role: "none",
|
|
699
|
-
children: /* @__PURE__ */
|
|
699
|
+
children: /* @__PURE__ */ W(d, {
|
|
700
700
|
type: "button",
|
|
701
701
|
role: "menuitemcheckbox",
|
|
702
702
|
"aria-checked": e.isSelected,
|
|
703
703
|
className: "w-full gap-3 px-4 py-[10px] text-start",
|
|
704
|
-
iconBefore: /* @__PURE__ */
|
|
705
|
-
className: c("flex items-center",
|
|
704
|
+
iconBefore: /* @__PURE__ */ W("span", {
|
|
705
|
+
className: c("flex items-center", Ze.icon),
|
|
706
706
|
children: e.icon
|
|
707
707
|
}),
|
|
708
|
-
iconAfter: e.isSelected ? /* @__PURE__ */
|
|
709
|
-
className: c("ms-auto",
|
|
710
|
-
children: /* @__PURE__ */
|
|
708
|
+
iconAfter: e.isSelected ? /* @__PURE__ */ W("span", {
|
|
709
|
+
className: c("ms-auto", Ze.selectedIcon),
|
|
710
|
+
children: /* @__PURE__ */ W(P, {
|
|
711
711
|
size: u,
|
|
712
712
|
"aria-hidden": !0,
|
|
713
713
|
stroke: m
|
|
714
714
|
})
|
|
715
715
|
}) : null,
|
|
716
|
-
label: /* @__PURE__ */
|
|
716
|
+
label: /* @__PURE__ */ W("span", {
|
|
717
717
|
className: p,
|
|
718
718
|
children: e.label
|
|
719
719
|
}),
|
|
@@ -721,19 +721,19 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
721
721
|
})
|
|
722
722
|
}, e.id))
|
|
723
723
|
})
|
|
724
|
-
}),
|
|
724
|
+
}), $e = {
|
|
725
725
|
toolIcon: "_toolIcon_ma5s5_1",
|
|
726
726
|
chevronIcon: "_chevronIcon_ma5s5_5"
|
|
727
|
-
},
|
|
728
|
-
let k = l(), [ee, A] =
|
|
727
|
+
}, et = ({ onAttachClick: e, onRecordVoice: t, recordVoiceLabel: n = "Record voice", attachLabel: r, addMenuTitle: i, menuTitle: o, menuCloseLabel: d, style: f, listClassName: _ = "w-[240px]", isDisabled: y = !1, chatSettings: x, extraMenuItems: S, toolsMenuItems: C = [], onToolToggle: w, toolsMenuTitle: T = "Tools", toolsBackLabel: E = "Back", menuOverlays: D, colors: O }) => {
|
|
728
|
+
let k = l(), [ee, A] = V(!1), [te, j] = V(!1), [ne, M] = V(!1), [N, re] = V(null), [ie, P] = V(!1), F = z(() => s({
|
|
729
729
|
"--aab-tool-icon": O?.toolIcon,
|
|
730
730
|
"--aab-chevron-icon": O?.chevronIcon
|
|
731
|
-
}), [O?.toolIcon, O?.chevronIcon]),
|
|
731
|
+
}), [O?.toolIcon, O?.chevronIcon]), oe = C.length > 0 && w != null, I = D != null && D.length > 0, le = z(() => C.map((e) => ({
|
|
732
732
|
key: e.id,
|
|
733
733
|
label: e.label,
|
|
734
|
-
icon: /* @__PURE__ */
|
|
735
|
-
style:
|
|
736
|
-
className: c("flex items-center",
|
|
734
|
+
icon: /* @__PURE__ */ W("span", {
|
|
735
|
+
style: F,
|
|
736
|
+
className: c("flex items-center", $e.toolIcon),
|
|
737
737
|
children: e.icon
|
|
738
738
|
}),
|
|
739
739
|
selectable: !0,
|
|
@@ -743,12 +743,12 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
743
743
|
})), [
|
|
744
744
|
C,
|
|
745
745
|
w,
|
|
746
|
-
|
|
747
|
-
]),
|
|
746
|
+
F
|
|
747
|
+
]), pe = z(() => [
|
|
748
748
|
...e == null ? [] : [{
|
|
749
749
|
key: "attach",
|
|
750
750
|
label: r,
|
|
751
|
-
icon: /* @__PURE__ */
|
|
751
|
+
icon: /* @__PURE__ */ W(ce, {
|
|
752
752
|
size: u,
|
|
753
753
|
"aria-hidden": !0,
|
|
754
754
|
stroke: m
|
|
@@ -756,10 +756,10 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
756
756
|
onClick: e
|
|
757
757
|
}],
|
|
758
758
|
...S ?? [],
|
|
759
|
-
...
|
|
759
|
+
...oe ? [{
|
|
760
760
|
key: "tools",
|
|
761
761
|
label: T,
|
|
762
|
-
icon: /* @__PURE__ */
|
|
762
|
+
icon: /* @__PURE__ */ W(fe, {
|
|
763
763
|
size: u,
|
|
764
764
|
"aria-hidden": !0,
|
|
765
765
|
stroke: m
|
|
@@ -767,13 +767,13 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
767
767
|
onClick: k ? () => {
|
|
768
768
|
M(!0), A(!1);
|
|
769
769
|
} : () => void 0,
|
|
770
|
-
...k ? { iconAfter: /* @__PURE__ */
|
|
770
|
+
...k ? { iconAfter: /* @__PURE__ */ W(ae, {
|
|
771
771
|
size: u,
|
|
772
772
|
stroke: m,
|
|
773
|
-
style:
|
|
774
|
-
className: c("rtl:scale-x-[-1]",
|
|
773
|
+
style: F,
|
|
774
|
+
className: c("rtl:scale-x-[-1]", $e.chevronIcon),
|
|
775
775
|
"aria-hidden": !0
|
|
776
|
-
}) } : { children:
|
|
776
|
+
}) } : { children: le }
|
|
777
777
|
}] : [],
|
|
778
778
|
...(D ?? []).map((e) => ({
|
|
779
779
|
key: e.key,
|
|
@@ -782,45 +782,45 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
782
782
|
onClick: k ? () => {
|
|
783
783
|
re(e.key), A(!1);
|
|
784
784
|
} : () => void 0,
|
|
785
|
-
...k ? { iconAfter: /* @__PURE__ */
|
|
785
|
+
...k ? { iconAfter: /* @__PURE__ */ W(ae, {
|
|
786
786
|
size: u,
|
|
787
787
|
stroke: m,
|
|
788
|
-
style:
|
|
789
|
-
className: c("rtl:scale-x-[-1]",
|
|
788
|
+
style: F,
|
|
789
|
+
className: c("rtl:scale-x-[-1]", $e.chevronIcon),
|
|
790
790
|
"aria-hidden": !0
|
|
791
791
|
}) } : {
|
|
792
792
|
children: [{
|
|
793
793
|
key: `${e.key}-panel`,
|
|
794
794
|
label: ""
|
|
795
795
|
}],
|
|
796
|
-
renderSubMenu: () => e.renderOverlay(() =>
|
|
796
|
+
renderSubMenu: () => e.renderOverlay(() => P(!1))
|
|
797
797
|
}
|
|
798
798
|
})),
|
|
799
799
|
...t == null ? [] : [{
|
|
800
800
|
key: "record-voice",
|
|
801
801
|
label: n,
|
|
802
|
-
icon: /* @__PURE__ */
|
|
802
|
+
icon: /* @__PURE__ */ W(se, {
|
|
803
803
|
size: u,
|
|
804
804
|
"aria-hidden": !0,
|
|
805
805
|
stroke: m
|
|
806
806
|
}),
|
|
807
807
|
onClick: () => {
|
|
808
|
-
A(!1),
|
|
808
|
+
A(!1), P(!1), t();
|
|
809
809
|
}
|
|
810
810
|
}],
|
|
811
811
|
...x == null ? [] : [{
|
|
812
812
|
key: "chat-settings",
|
|
813
813
|
label: x.menuItemLabel ?? "Chat settings",
|
|
814
|
-
icon: /* @__PURE__ */
|
|
814
|
+
icon: /* @__PURE__ */ W(de, {
|
|
815
815
|
size: u,
|
|
816
816
|
"aria-hidden": !0,
|
|
817
817
|
stroke: m
|
|
818
818
|
}),
|
|
819
|
-
iconAfter: k ? /* @__PURE__ */
|
|
819
|
+
iconAfter: k ? /* @__PURE__ */ W(ae, {
|
|
820
820
|
size: u,
|
|
821
821
|
stroke: m,
|
|
822
|
-
style:
|
|
823
|
-
className: c("rtl:scale-x-[-1]",
|
|
822
|
+
style: F,
|
|
823
|
+
className: c("rtl:scale-x-[-1]", $e.chevronIcon),
|
|
824
824
|
"aria-hidden": !0
|
|
825
825
|
}) : null,
|
|
826
826
|
onClick: () => j(!0)
|
|
@@ -833,22 +833,22 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
833
833
|
x,
|
|
834
834
|
S,
|
|
835
835
|
k,
|
|
836
|
-
|
|
836
|
+
oe,
|
|
837
837
|
T,
|
|
838
|
-
|
|
838
|
+
le,
|
|
839
839
|
D,
|
|
840
|
-
|
|
840
|
+
F
|
|
841
841
|
]);
|
|
842
|
-
if (
|
|
843
|
-
let
|
|
842
|
+
if (pe.length === 0) return null;
|
|
843
|
+
let me = /* @__PURE__ */ W(h, {
|
|
844
844
|
matchReferenceWidth: !1,
|
|
845
845
|
placement: "bottom-start",
|
|
846
846
|
listClassName: _,
|
|
847
|
-
items:
|
|
848
|
-
open:
|
|
849
|
-
onOpenChange:
|
|
850
|
-
children: /* @__PURE__ */
|
|
851
|
-
icon: /* @__PURE__ */
|
|
847
|
+
items: pe,
|
|
848
|
+
open: I ? ie : void 0,
|
|
849
|
+
onOpenChange: I ? P : void 0,
|
|
850
|
+
children: /* @__PURE__ */ W(v, {
|
|
851
|
+
icon: /* @__PURE__ */ W(ue, {
|
|
852
852
|
size: p.LG,
|
|
853
853
|
"aria-hidden": !0,
|
|
854
854
|
stroke: m
|
|
@@ -858,9 +858,9 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
858
858
|
disabled: y
|
|
859
859
|
})
|
|
860
860
|
});
|
|
861
|
-
return /* @__PURE__ */ U
|
|
862
|
-
/* @__PURE__ */
|
|
863
|
-
icon: /* @__PURE__ */
|
|
861
|
+
return /* @__PURE__ */ W(U, { children: k ? /* @__PURE__ */ G(U, { children: [
|
|
862
|
+
/* @__PURE__ */ W(v, {
|
|
863
|
+
icon: /* @__PURE__ */ W(ue, {
|
|
864
864
|
size: p.LG,
|
|
865
865
|
"aria-hidden": !0,
|
|
866
866
|
stroke: m
|
|
@@ -871,17 +871,17 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
871
871
|
disabled: y,
|
|
872
872
|
onClick: () => A(!0)
|
|
873
873
|
}),
|
|
874
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ W(Ge, {
|
|
875
875
|
isOpen: ee,
|
|
876
876
|
title: o,
|
|
877
877
|
closeLabel: d,
|
|
878
878
|
onClose: () => A(!1),
|
|
879
879
|
style: f,
|
|
880
|
-
items:
|
|
880
|
+
items: pe,
|
|
881
881
|
className: "pb-4",
|
|
882
882
|
btnTextClassName: "flex-1"
|
|
883
883
|
}),
|
|
884
|
-
|
|
884
|
+
oe && /* @__PURE__ */ W(Qe, {
|
|
885
885
|
isOpen: ne,
|
|
886
886
|
onBack: () => {
|
|
887
887
|
M(!1), A(!0);
|
|
@@ -894,7 +894,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
894
894
|
items: C,
|
|
895
895
|
onToolToggle: w
|
|
896
896
|
}),
|
|
897
|
-
D?.map((e) => /* @__PURE__ */
|
|
897
|
+
D?.map((e) => /* @__PURE__ */ W(Te, {
|
|
898
898
|
isOpen: N === e.key,
|
|
899
899
|
title: e.title,
|
|
900
900
|
closeLabel: d,
|
|
@@ -906,7 +906,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
906
906
|
style: f,
|
|
907
907
|
children: e.renderOverlay(() => re(null))
|
|
908
908
|
}, e.key)),
|
|
909
|
-
x != null && /* @__PURE__ */
|
|
909
|
+
x != null && /* @__PURE__ */ W(K, {
|
|
910
910
|
isOpen: te,
|
|
911
911
|
onBack: () => {
|
|
912
912
|
j(!1), A(!0);
|
|
@@ -933,7 +933,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
933
933
|
saveLabel: x.saveLabel,
|
|
934
934
|
saveDisabledTooltip: x.saveDisabledTooltip
|
|
935
935
|
})
|
|
936
|
-
] }) : /* @__PURE__ */
|
|
936
|
+
] }) : /* @__PURE__ */ G(U, { children: [me, x != null && te && /* @__PURE__ */ W(Xe, {
|
|
937
937
|
features: x.features,
|
|
938
938
|
initialResponseFormat: x.responseFormat ?? a.Markdown,
|
|
939
939
|
initialSystemPrompt: x.systemPrompt,
|
|
@@ -953,13 +953,13 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
953
953
|
saveLabel: x.saveLabel,
|
|
954
954
|
saveDisabledTooltip: x.saveDisabledTooltip
|
|
955
955
|
})] }) });
|
|
956
|
-
},
|
|
956
|
+
}, tt = {
|
|
957
957
|
chip: "_chip_ydmd8_1",
|
|
958
958
|
chipSelected: "_chipSelected_ydmd8_9",
|
|
959
959
|
chipIcon: "_chipIcon_ydmd8_16",
|
|
960
960
|
chipText: "_chipText_ydmd8_19",
|
|
961
961
|
chipClose: "_chipClose_ydmd8_22"
|
|
962
|
-
},
|
|
962
|
+
}, nt = (e) => `Remove ${e}`, rt = ({ items: e, onToolToggle: t, onToolDismiss: n, canRemove: r = !0, removeLabel: i = nt, typography: a, colors: o }) => e.length === 0 ? null : /* @__PURE__ */ W("div", {
|
|
963
963
|
className: "flex flex-wrap items-center gap-2",
|
|
964
964
|
style: s({
|
|
965
965
|
"--ci-chip-bg": o?.chipBg,
|
|
@@ -974,34 +974,34 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
974
974
|
"--ci-chip-close": o?.chipClose,
|
|
975
975
|
"--ci-chip-close-hover": o?.chipCloseHover
|
|
976
976
|
}),
|
|
977
|
-
children: e.map((e) => /* @__PURE__ */
|
|
978
|
-
className: c(
|
|
979
|
-
children: [/* @__PURE__ */
|
|
977
|
+
children: e.map((e) => /* @__PURE__ */ G("div", {
|
|
978
|
+
className: c(tt.chip, e.isSelected && tt.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 transition-colors", r ? "pe-1 ps-2" : "px-2"),
|
|
979
|
+
children: [/* @__PURE__ */ G("button", {
|
|
980
980
|
type: "button",
|
|
981
981
|
onClick: () => t(e.id),
|
|
982
982
|
"aria-pressed": e.isSelected,
|
|
983
983
|
className: "flex min-w-0 items-center gap-1.5",
|
|
984
|
-
children: [/* @__PURE__ */
|
|
985
|
-
className: c(
|
|
984
|
+
children: [/* @__PURE__ */ W("span", {
|
|
985
|
+
className: c(tt.chipIcon, "shrink-0"),
|
|
986
986
|
"aria-hidden": !0,
|
|
987
987
|
children: e.icon
|
|
988
|
-
}), /* @__PURE__ */
|
|
989
|
-
className: c(
|
|
988
|
+
}), /* @__PURE__ */ W("span", {
|
|
989
|
+
className: c(tt.chipText, a?.fontClassName || "dial-small-paragraph-text", "truncate"),
|
|
990
990
|
children: e.label
|
|
991
991
|
})]
|
|
992
|
-
}), r && /* @__PURE__ */
|
|
992
|
+
}), r && /* @__PURE__ */ W("button", {
|
|
993
993
|
type: "button",
|
|
994
994
|
onClick: () => n(e.id),
|
|
995
995
|
"aria-label": i(e.label),
|
|
996
|
-
className: c(
|
|
997
|
-
children: /* @__PURE__ */
|
|
996
|
+
className: c(tt.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
|
|
997
|
+
children: /* @__PURE__ */ W(pe, {
|
|
998
998
|
size: 12,
|
|
999
999
|
"aria-hidden": !0,
|
|
1000
1000
|
stroke: m
|
|
1001
1001
|
})
|
|
1002
1002
|
})]
|
|
1003
1003
|
}, e.id))
|
|
1004
|
-
}),
|
|
1004
|
+
}), q = {
|
|
1005
1005
|
wrapper: "_wrapper_q1jcl_2",
|
|
1006
1006
|
wrapperDisabled: "_wrapperDisabled_q1jcl_9",
|
|
1007
1007
|
textarea: "_textarea_q1jcl_13",
|
|
@@ -1012,34 +1012,34 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1012
1012
|
modelSelectorName: "_modelSelectorName_q1jcl_50",
|
|
1013
1013
|
modelSelectorVersion: "_modelSelectorVersion_q1jcl_53",
|
|
1014
1014
|
modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_q1jcl_62"
|
|
1015
|
-
},
|
|
1015
|
+
}, it = {
|
|
1016
1016
|
wrapperError: "_wrapperError_129ri_1",
|
|
1017
1017
|
waveformCanvas: "_waveformCanvas_129ri_5",
|
|
1018
1018
|
recordingDot: "_recordingDot_129ri_19",
|
|
1019
1019
|
"recording-pulse": "_recording-pulse_129ri_1"
|
|
1020
|
-
},
|
|
1021
|
-
let h =
|
|
1020
|
+
}, at = 3, ot = 4, st = 200, ct = ({ state: e, analyserNodeRef: t, errorMessage: n, onStop: r, onDiscard: i, attachButton: a, stopLabel: o = "Stop recording", discardLabel: s = "Discard recording", processingLabel: l = "Transcribing audio…", style: u, className: d, embedded: f = !1 }) => {
|
|
1021
|
+
let h = B(null), g = B(new Float32Array(st)), y = B(0), b = B(0), x = e === Ie.Recording, S = e === Ie.Error, C = e === Ie.Processing, w = L((e) => {
|
|
1022
1022
|
let t = e.getContext("2d");
|
|
1023
1023
|
if (!t) return;
|
|
1024
1024
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
1025
1025
|
let { width: n, height: r } = e;
|
|
1026
1026
|
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
1027
|
-
let i = Math.min(Math.max(1, Math.floor(n /
|
|
1027
|
+
let i = Math.min(Math.max(1, Math.floor(n / ot)), st - 1), a = y.current, o = b.current;
|
|
1028
1028
|
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
1029
1029
|
for (let e = 0; e <= i; e++) {
|
|
1030
|
-
let n = ((a - i + e) %
|
|
1031
|
-
t.fillRect(e *
|
|
1030
|
+
let n = ((a - i + e) % st + st) % st, o = g.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
1031
|
+
t.fillRect(e * ot, (r - c) / 2, at, c);
|
|
1032
1032
|
}
|
|
1033
1033
|
t.restore();
|
|
1034
1034
|
}, []);
|
|
1035
|
-
|
|
1035
|
+
R(() => {
|
|
1036
1036
|
if (!x) return;
|
|
1037
1037
|
let e = h.current;
|
|
1038
1038
|
if (!e) return;
|
|
1039
1039
|
g.current.fill(0), y.current = 0, b.current = 0;
|
|
1040
1040
|
let n, r = () => {
|
|
1041
|
-
if (b.current += 1, b.current >=
|
|
1042
|
-
b.current -=
|
|
1041
|
+
if (b.current += 1, b.current >= ot) {
|
|
1042
|
+
b.current -= ot;
|
|
1043
1043
|
let e = t.current;
|
|
1044
1044
|
if (e) {
|
|
1045
1045
|
let t = new Uint8Array(e.frequencyBinCount);
|
|
@@ -1049,7 +1049,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1049
1049
|
let r = (t[e] - 128) / 128;
|
|
1050
1050
|
n += r * r;
|
|
1051
1051
|
}
|
|
1052
|
-
g.current[y.current %
|
|
1052
|
+
g.current[y.current % st] = Math.sqrt(n / t.length), y.current++;
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
1055
|
w(e), n = requestAnimationFrame(r);
|
|
@@ -1061,7 +1061,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1061
1061
|
x,
|
|
1062
1062
|
t,
|
|
1063
1063
|
w
|
|
1064
|
-
]),
|
|
1064
|
+
]), R(() => {
|
|
1065
1065
|
let e = h.current;
|
|
1066
1066
|
if (!e) return;
|
|
1067
1067
|
let t = new ResizeObserver(() => {
|
|
@@ -1069,11 +1069,11 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1069
1069
|
});
|
|
1070
1070
|
return t.observe(e), () => t.disconnect();
|
|
1071
1071
|
}, [w]);
|
|
1072
|
-
let E = /* @__PURE__ */
|
|
1072
|
+
let E = /* @__PURE__ */ G("div", {
|
|
1073
1073
|
className: "flex flex-shrink-0 items-center justify-end gap-1",
|
|
1074
1074
|
children: [
|
|
1075
|
-
/* @__PURE__ */
|
|
1076
|
-
icon: /* @__PURE__ */
|
|
1075
|
+
/* @__PURE__ */ W(v, {
|
|
1076
|
+
icon: /* @__PURE__ */ W(pe, {
|
|
1077
1077
|
size: p.LG,
|
|
1078
1078
|
"aria-hidden": !0,
|
|
1079
1079
|
stroke: m
|
|
@@ -1082,8 +1082,8 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1082
1082
|
className: "mobile:min-h-11 mobile:min-w-11",
|
|
1083
1083
|
onClick: i
|
|
1084
1084
|
}),
|
|
1085
|
-
x && /* @__PURE__ */
|
|
1086
|
-
icon: /* @__PURE__ */
|
|
1085
|
+
x && /* @__PURE__ */ W(T, {
|
|
1086
|
+
icon: /* @__PURE__ */ W(I, {
|
|
1087
1087
|
size: p.LG,
|
|
1088
1088
|
"aria-hidden": !0
|
|
1089
1089
|
}),
|
|
@@ -1092,94 +1092,94 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1092
1092
|
"aria-label": o,
|
|
1093
1093
|
className: "mobile:min-h-11 mobile:min-w-11"
|
|
1094
1094
|
}),
|
|
1095
|
-
C && /* @__PURE__ */
|
|
1095
|
+
C && /* @__PURE__ */ W("span", {
|
|
1096
1096
|
className: "flex size-[40px] flex-shrink-0 items-center justify-center mobile:min-h-11 mobile:min-w-11",
|
|
1097
|
-
children: /* @__PURE__ */
|
|
1097
|
+
children: /* @__PURE__ */ W(te, {
|
|
1098
1098
|
size: 20,
|
|
1099
1099
|
ariaLabel: l
|
|
1100
1100
|
})
|
|
1101
1101
|
})
|
|
1102
1102
|
]
|
|
1103
1103
|
});
|
|
1104
|
-
return /* @__PURE__ */
|
|
1104
|
+
return /* @__PURE__ */ G("div", {
|
|
1105
1105
|
className: d,
|
|
1106
|
-
children: [/* @__PURE__ */
|
|
1106
|
+
children: [/* @__PURE__ */ G("div", {
|
|
1107
1107
|
style: u,
|
|
1108
|
-
className: c("flex w-full min-w-0 flex-col justify-center gap-2", !f &&
|
|
1109
|
-
children: [/* @__PURE__ */
|
|
1108
|
+
className: c("flex w-full min-w-0 flex-col justify-center gap-2", !f && q.wrapper, !f && "min-h-[64px] max-w-[748px] rounded-xl border px-3 shadow-md", S && it.wrapperError),
|
|
1109
|
+
children: [/* @__PURE__ */ G("div", {
|
|
1110
1110
|
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
1111
|
-
children: [x && /* @__PURE__ */
|
|
1112
|
-
className: c(
|
|
1111
|
+
children: [x && /* @__PURE__ */ W("span", {
|
|
1112
|
+
className: c(it.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
|
|
1113
1113
|
"aria-hidden": !0
|
|
1114
|
-
}), /* @__PURE__ */
|
|
1114
|
+
}), /* @__PURE__ */ W("canvas", {
|
|
1115
1115
|
ref: h,
|
|
1116
1116
|
height: 26,
|
|
1117
1117
|
"aria-hidden": !0,
|
|
1118
|
-
className: c(
|
|
1118
|
+
className: c(it.waveformCanvas, "h-[26px] min-w-0 flex-1")
|
|
1119
1119
|
})]
|
|
1120
|
-
}), /* @__PURE__ */
|
|
1120
|
+
}), /* @__PURE__ */ G("div", {
|
|
1121
1121
|
className: "flex items-center justify-between gap-2",
|
|
1122
|
-
children: [a ?? /* @__PURE__ */
|
|
1122
|
+
children: [a ?? /* @__PURE__ */ W("span", { "aria-hidden": !0 }), E]
|
|
1123
1123
|
})]
|
|
1124
|
-
}), S && n && /* @__PURE__ */
|
|
1124
|
+
}), S && n && /* @__PURE__ */ W("div", {
|
|
1125
1125
|
role: "alert",
|
|
1126
|
-
children: /* @__PURE__ */
|
|
1126
|
+
children: /* @__PURE__ */ W(_, {
|
|
1127
1127
|
text: n,
|
|
1128
1128
|
className: "mt-1 px-1"
|
|
1129
1129
|
})
|
|
1130
1130
|
})]
|
|
1131
1131
|
});
|
|
1132
|
-
},
|
|
1132
|
+
}, lt = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", sendTooltip: r }) => /* @__PURE__ */ W(T, {
|
|
1133
1133
|
"aria-label": n,
|
|
1134
1134
|
onClick: () => e?.(),
|
|
1135
1135
|
disabled: t,
|
|
1136
1136
|
tooltipProps: r ? { tooltip: r } : void 0,
|
|
1137
|
-
icon: /* @__PURE__ */
|
|
1137
|
+
icon: /* @__PURE__ */ W(ie, {
|
|
1138
1138
|
size: p.LG,
|
|
1139
1139
|
className: "rtl:scale-x-[-1]",
|
|
1140
1140
|
stroke: m
|
|
1141
1141
|
})
|
|
1142
|
-
}),
|
|
1143
|
-
icon: /* @__PURE__ */
|
|
1142
|
+
}), ut = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ W(j, {
|
|
1143
|
+
icon: /* @__PURE__ */ W(le, {
|
|
1144
1144
|
size: p.LG,
|
|
1145
1145
|
stroke: m
|
|
1146
1146
|
}),
|
|
1147
1147
|
onClick: () => e?.(),
|
|
1148
1148
|
"aria-label": t
|
|
1149
|
-
}),
|
|
1149
|
+
}), dt = ({ size: e = 20 }) => /* @__PURE__ */ W(k, {
|
|
1150
1150
|
variant: ee.Circular,
|
|
1151
1151
|
width: e,
|
|
1152
1152
|
height: e,
|
|
1153
1153
|
active: !0
|
|
1154
|
-
}),
|
|
1154
|
+
}), ft = ({ loadingLabel: e }) => /* @__PURE__ */ G("span", {
|
|
1155
1155
|
className: "flex min-w-0 flex-1 items-center",
|
|
1156
|
-
children: [/* @__PURE__ */
|
|
1156
|
+
children: [/* @__PURE__ */ W(k, {
|
|
1157
1157
|
variant: ee.Text,
|
|
1158
1158
|
width: "100%",
|
|
1159
1159
|
height: 16,
|
|
1160
1160
|
active: !0
|
|
1161
|
-
}), e && /* @__PURE__ */
|
|
1161
|
+
}), e && /* @__PURE__ */ W("span", {
|
|
1162
1162
|
className: "sr-only",
|
|
1163
1163
|
children: e
|
|
1164
1164
|
})]
|
|
1165
|
-
}),
|
|
1165
|
+
}), pt = ({ loadingLabel: e }) => /* @__PURE__ */ W("div", {
|
|
1166
1166
|
role: "status",
|
|
1167
1167
|
"aria-label": e,
|
|
1168
|
-
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */
|
|
1168
|
+
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ G("div", {
|
|
1169
1169
|
className: "flex h-11 items-center gap-3 px-4",
|
|
1170
1170
|
"aria-hidden": "true",
|
|
1171
|
-
children: [/* @__PURE__ */
|
|
1171
|
+
children: [/* @__PURE__ */ W(dt, {}), /* @__PURE__ */ W(ft, {})]
|
|
1172
1172
|
}, t))
|
|
1173
|
-
}),
|
|
1173
|
+
}), mt = (e) => e.displayName ?? e.id, ht = (e, t) => {
|
|
1174
1174
|
let n = t.trim().toLowerCase();
|
|
1175
|
-
return n ? e.filter((e) =>
|
|
1176
|
-
},
|
|
1175
|
+
return n ? e.filter((e) => mt(e).toLowerCase().includes(n)) : e;
|
|
1176
|
+
}, J = (e, t, r, i = 18, a) => /* @__PURE__ */ W(n, {
|
|
1177
1177
|
src: e,
|
|
1178
1178
|
size: i,
|
|
1179
1179
|
labels: { tooltip: a },
|
|
1180
1180
|
initialsName: r
|
|
1181
|
-
}),
|
|
1182
|
-
let [o, l] =
|
|
1181
|
+
}), Y = { searchHeader: "_searchHeader_1728o_1" }, gt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, searchHeaderClassName: i = Y.searchHeader, colors: a }) => {
|
|
1182
|
+
let [o, l] = V(""), u = z(() => e?.find((e) => e.id === t), [e, t]), d = r?.loading !== void 0, f = !d && !u && !!t, m = z(() => d ? /* @__PURE__ */ W(dt, { size: p.LG }) : J(u?.iconUrl, u?.type, u?.displayName ?? u?.id ?? "", p.LG, f ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
|
|
1183
1183
|
d,
|
|
1184
1184
|
u,
|
|
1185
1185
|
f,
|
|
@@ -1190,11 +1190,11 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1190
1190
|
selectorAriaLabel: h ? `${r?.ariaLabel ?? "Select model"}: ${h}` : r?.ariaLabel ?? "Select model",
|
|
1191
1191
|
selectedLabel: h,
|
|
1192
1192
|
selectedVersion: _,
|
|
1193
|
-
menuItems:
|
|
1193
|
+
menuItems: z(() => {
|
|
1194
1194
|
if (d) return Array.from({ length: 7 }, (e, t) => ({
|
|
1195
1195
|
key: `__loading-${t}`,
|
|
1196
|
-
icon: /* @__PURE__ */
|
|
1197
|
-
label: /* @__PURE__ */
|
|
1196
|
+
icon: /* @__PURE__ */ W(dt, {}),
|
|
1197
|
+
label: /* @__PURE__ */ W(ft, { loadingLabel: t === 0 ? r?.loading : void 0 }),
|
|
1198
1198
|
disabled: !0
|
|
1199
1199
|
}));
|
|
1200
1200
|
if (!e || e.length === 0) {
|
|
@@ -1205,14 +1205,14 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1205
1205
|
disabled: !0
|
|
1206
1206
|
}] : [];
|
|
1207
1207
|
}
|
|
1208
|
-
return
|
|
1208
|
+
return ht(e, o).map((e) => ({
|
|
1209
1209
|
key: e.id,
|
|
1210
|
-
label: /* @__PURE__ */
|
|
1211
|
-
text:
|
|
1210
|
+
label: /* @__PURE__ */ W(y, {
|
|
1211
|
+
text: mt(e),
|
|
1212
1212
|
query: o,
|
|
1213
1213
|
maxLines: 1
|
|
1214
1214
|
}),
|
|
1215
|
-
icon:
|
|
1215
|
+
icon: J(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
1216
1216
|
mark: b.Check,
|
|
1217
1217
|
checked: e.id === t,
|
|
1218
1218
|
onClick: () => n?.(e.id)
|
|
@@ -1225,10 +1225,10 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1225
1225
|
r,
|
|
1226
1226
|
n
|
|
1227
1227
|
]),
|
|
1228
|
-
menuHeader:
|
|
1228
|
+
menuHeader: z(() => !d && e && e.length > 0 ? /* @__PURE__ */ W("div", {
|
|
1229
1229
|
style: s({ "--ms-search-header-bg": a?.searchHeaderBackground }),
|
|
1230
1230
|
className: c("sticky top-0 z-10 pb-1 pe-2 pt-2", i),
|
|
1231
|
-
children: /* @__PURE__ */
|
|
1231
|
+
children: /* @__PURE__ */ W(O, {
|
|
1232
1232
|
value: o,
|
|
1233
1233
|
placeholder: r?.searchPlaceholder ?? "Search",
|
|
1234
1234
|
size: g.Small,
|
|
@@ -1247,8 +1247,8 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1247
1247
|
e || l("");
|
|
1248
1248
|
}
|
|
1249
1249
|
};
|
|
1250
|
-
},
|
|
1251
|
-
function
|
|
1250
|
+
}, _t = typeof window < "u" ? _e : R;
|
|
1251
|
+
function vt(e) {
|
|
1252
1252
|
if (e !== void 0) switch (typeof e) {
|
|
1253
1253
|
case "number": return e;
|
|
1254
1254
|
case "string":
|
|
@@ -1256,15 +1256,15 @@ function yt(e) {
|
|
|
1256
1256
|
break;
|
|
1257
1257
|
}
|
|
1258
1258
|
}
|
|
1259
|
-
function
|
|
1260
|
-
let { styleHeight: s, styleWidth: c } =
|
|
1261
|
-
styleHeight:
|
|
1262
|
-
styleWidth:
|
|
1263
|
-
}), [o?.height, o?.width]), [l, u] =
|
|
1259
|
+
function yt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
1260
|
+
let { styleHeight: s, styleWidth: c } = z(() => ({
|
|
1261
|
+
styleHeight: vt(o?.height),
|
|
1262
|
+
styleWidth: vt(o?.width)
|
|
1263
|
+
}), [o?.height, o?.width]), [l, u] = V({
|
|
1264
1264
|
height: t,
|
|
1265
1265
|
width: n
|
|
1266
1266
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
1267
|
-
return
|
|
1267
|
+
return _t(() => {
|
|
1268
1268
|
if (i === null || d) return;
|
|
1269
1269
|
let t = new ResizeObserver((e) => {
|
|
1270
1270
|
for (let t of e) {
|
|
@@ -1284,7 +1284,7 @@ function bt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1284
1284
|
i,
|
|
1285
1285
|
s,
|
|
1286
1286
|
c
|
|
1287
|
-
]),
|
|
1287
|
+
]), z(() => ({
|
|
1288
1288
|
height: s ?? l.height,
|
|
1289
1289
|
width: c ?? l.width
|
|
1290
1290
|
}), [
|
|
@@ -1293,23 +1293,23 @@ function bt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1293
1293
|
c
|
|
1294
1294
|
]);
|
|
1295
1295
|
}
|
|
1296
|
-
function
|
|
1297
|
-
let t =
|
|
1296
|
+
function bt(e) {
|
|
1297
|
+
let t = B(() => {
|
|
1298
1298
|
throw Error("Cannot call during render.");
|
|
1299
1299
|
});
|
|
1300
|
-
return
|
|
1300
|
+
return _t(() => {
|
|
1301
1301
|
t.current = e;
|
|
1302
|
-
}, [e]),
|
|
1302
|
+
}, [e]), L((e) => t.current?.(e), [t]);
|
|
1303
1303
|
}
|
|
1304
|
-
var
|
|
1304
|
+
var xt = null;
|
|
1305
1305
|
function X(e = !1) {
|
|
1306
|
-
if (
|
|
1306
|
+
if (xt === null || e) {
|
|
1307
1307
|
let e = document.createElement("div"), t = e.style;
|
|
1308
1308
|
t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
|
|
1309
1309
|
let n = document.createElement("div"), r = n.style;
|
|
1310
|
-
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ?
|
|
1310
|
+
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? xt = "positive-descending" : (e.scrollLeft = 1, xt = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), xt;
|
|
1311
1311
|
}
|
|
1312
|
-
return
|
|
1312
|
+
return xt;
|
|
1313
1313
|
}
|
|
1314
1314
|
function Z({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1315
1315
|
if (t === "horizontal" && n) switch (X()) {
|
|
@@ -1411,7 +1411,7 @@ function Et({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1411
1411
|
};
|
|
1412
1412
|
}
|
|
1413
1413
|
function Dt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1414
|
-
return
|
|
1414
|
+
return z(() => Et({
|
|
1415
1415
|
itemCount: e,
|
|
1416
1416
|
itemProps: t,
|
|
1417
1417
|
itemSize: n
|
|
@@ -1434,20 +1434,20 @@ function Ot({ containerSize: e, itemSize: t }) {
|
|
|
1434
1434
|
return n;
|
|
1435
1435
|
}
|
|
1436
1436
|
function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
|
|
1437
|
-
let { height: u = n, width: d = n } =
|
|
1437
|
+
let { height: u = n, width: d = n } = yt({
|
|
1438
1438
|
defaultHeight: r === "vertical" ? n : void 0,
|
|
1439
1439
|
defaultWidth: r === "horizontal" ? n : void 0,
|
|
1440
1440
|
element: e,
|
|
1441
1441
|
mode: r === "vertical" ? "only-height" : "only-width",
|
|
1442
1442
|
style: t
|
|
1443
|
-
}), f =
|
|
1443
|
+
}), f = B({
|
|
1444
1444
|
height: 0,
|
|
1445
1445
|
width: 0
|
|
1446
1446
|
}), p = r === "vertical" ? u : d, m = Ot({
|
|
1447
1447
|
containerSize: p,
|
|
1448
1448
|
itemSize: s
|
|
1449
1449
|
});
|
|
1450
|
-
|
|
1450
|
+
_e(() => {
|
|
1451
1451
|
if (typeof c == "function") {
|
|
1452
1452
|
let e = f.current;
|
|
1453
1453
|
(e.height !== u || e.width !== d) && (c({
|
|
@@ -1464,7 +1464,7 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1464
1464
|
itemCount: a,
|
|
1465
1465
|
itemProps: o,
|
|
1466
1466
|
itemSize: m
|
|
1467
|
-
}), g =
|
|
1467
|
+
}), g = L((e) => h.get(e), [h]), [_, v] = V(() => Tt({
|
|
1468
1468
|
cachedBounds: h,
|
|
1469
1469
|
containerScrollOffset: 0,
|
|
1470
1470
|
containerSize: p,
|
|
@@ -1475,7 +1475,7 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1475
1475
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1476
1476
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1477
1477
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1478
|
-
}, C =
|
|
1478
|
+
}, C = L(() => Ct({
|
|
1479
1479
|
cachedBounds: h,
|
|
1480
1480
|
itemCount: a,
|
|
1481
1481
|
itemSize: m
|
|
@@ -1483,7 +1483,7 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1483
1483
|
h,
|
|
1484
1484
|
a,
|
|
1485
1485
|
m
|
|
1486
|
-
]), w =
|
|
1486
|
+
]), w = L((t) => Tt({
|
|
1487
1487
|
cachedBounds: h,
|
|
1488
1488
|
containerScrollOffset: Z({
|
|
1489
1489
|
containerElement: e,
|
|
@@ -1503,13 +1503,13 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1503
1503
|
a,
|
|
1504
1504
|
l
|
|
1505
1505
|
]);
|
|
1506
|
-
return
|
|
1506
|
+
return _t(() => {
|
|
1507
1507
|
v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
|
|
1508
1508
|
}, [
|
|
1509
1509
|
e,
|
|
1510
1510
|
r,
|
|
1511
1511
|
w
|
|
1512
|
-
]),
|
|
1512
|
+
]), _t(() => {
|
|
1513
1513
|
if (!e) return;
|
|
1514
1514
|
let t = () => {
|
|
1515
1515
|
v((t) => {
|
|
@@ -1541,7 +1541,7 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1541
1541
|
]), {
|
|
1542
1542
|
getCellBounds: g,
|
|
1543
1543
|
getEstimatedSize: C,
|
|
1544
|
-
scrollToIndex:
|
|
1544
|
+
scrollToIndex: bt(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
|
|
1545
1545
|
let s = wt({
|
|
1546
1546
|
align: t,
|
|
1547
1547
|
cachedBounds: h,
|
|
@@ -1571,7 +1571,7 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1571
1571
|
};
|
|
1572
1572
|
}
|
|
1573
1573
|
function At(e) {
|
|
1574
|
-
return
|
|
1574
|
+
return z(() => e, Object.values(e));
|
|
1575
1575
|
}
|
|
1576
1576
|
function jt(e, t) {
|
|
1577
1577
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
@@ -1582,18 +1582,18 @@ function Mt(e) {
|
|
|
1582
1582
|
}
|
|
1583
1583
|
var Nt = "data-react-window-index";
|
|
1584
1584
|
function Pt({ 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 }) {
|
|
1585
|
-
let m = At(u), h =
|
|
1585
|
+
let m = At(u), h = z(() => he(s, jt), [s]), [g, _] = V(null), v = Mt(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = kt({
|
|
1586
1586
|
containerElement: g,
|
|
1587
1587
|
containerStyle: f,
|
|
1588
1588
|
defaultContainerSize: n,
|
|
1589
1589
|
direction: "vertical",
|
|
1590
1590
|
itemCount: c,
|
|
1591
1591
|
itemProps: m,
|
|
1592
|
-
itemSize:
|
|
1592
|
+
itemSize: z(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
|
|
1593
1593
|
onResize: i,
|
|
1594
1594
|
overscanCount: o
|
|
1595
1595
|
});
|
|
1596
|
-
|
|
1596
|
+
ge(r, () => ({
|
|
1597
1597
|
get element() {
|
|
1598
1598
|
return g;
|
|
1599
1599
|
},
|
|
@@ -1608,7 +1608,7 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1608
1608
|
top: r
|
|
1609
1609
|
});
|
|
1610
1610
|
}
|
|
1611
|
-
}), [g, x]),
|
|
1611
|
+
}), [g, x]), _t(() => {
|
|
1612
1612
|
if (!g) return;
|
|
1613
1613
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1614
1614
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
@@ -1622,7 +1622,7 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1622
1622
|
l,
|
|
1623
1623
|
S,
|
|
1624
1624
|
w
|
|
1625
|
-
]),
|
|
1625
|
+
]), R(() => {
|
|
1626
1626
|
S >= 0 && w >= 0 && a && a({
|
|
1627
1627
|
startIndex: C,
|
|
1628
1628
|
stopIndex: T
|
|
@@ -1637,11 +1637,11 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1637
1637
|
w,
|
|
1638
1638
|
T
|
|
1639
1639
|
]);
|
|
1640
|
-
let E =
|
|
1640
|
+
let E = z(() => {
|
|
1641
1641
|
let e = [];
|
|
1642
1642
|
if (c > 0) for (let t = S; t <= w; t++) {
|
|
1643
1643
|
let n = y(t);
|
|
1644
|
-
e.push(/* @__PURE__ */
|
|
1644
|
+
e.push(/* @__PURE__ */ me(h, {
|
|
1645
1645
|
...m,
|
|
1646
1646
|
ariaAttributes: {
|
|
1647
1647
|
"aria-posinset": t + 1,
|
|
@@ -1668,7 +1668,7 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1668
1668
|
m,
|
|
1669
1669
|
S,
|
|
1670
1670
|
w
|
|
1671
|
-
]), D = /* @__PURE__ */
|
|
1671
|
+
]), D = /* @__PURE__ */ W("div", {
|
|
1672
1672
|
"aria-hidden": !0,
|
|
1673
1673
|
style: {
|
|
1674
1674
|
height: b(),
|
|
@@ -1676,7 +1676,7 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1676
1676
|
zIndex: -1
|
|
1677
1677
|
}
|
|
1678
1678
|
});
|
|
1679
|
-
return
|
|
1679
|
+
return me(d, {
|
|
1680
1680
|
role: "list",
|
|
1681
1681
|
...p,
|
|
1682
1682
|
className: t,
|
|
@@ -1697,26 +1697,26 @@ var Ft = {
|
|
|
1697
1697
|
checkIcon: "_checkIcon_1tiyp_19",
|
|
1698
1698
|
stateLabel: "_stateLabel_1tiyp_23"
|
|
1699
1699
|
}, It = 44, Lt = 8, Rt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: o, onSelect: s }) => {
|
|
1700
|
-
let l = r[e], u =
|
|
1701
|
-
return /* @__PURE__ */
|
|
1700
|
+
let l = r[e], u = J(l.iconUrl, l.type, l.displayName ?? l.id, p.SM), f = l.id === i;
|
|
1701
|
+
return /* @__PURE__ */ W("div", {
|
|
1702
1702
|
style: t,
|
|
1703
1703
|
...n,
|
|
1704
|
-
children: /* @__PURE__ */
|
|
1704
|
+
children: /* @__PURE__ */ W(d, {
|
|
1705
1705
|
type: "button",
|
|
1706
1706
|
"aria-current": f ? "true" : void 0,
|
|
1707
1707
|
className: c(Ft.item, "h-full w-full gap-3 px-4"),
|
|
1708
|
-
iconBefore: /* @__PURE__ */
|
|
1708
|
+
iconBefore: /* @__PURE__ */ W("span", {
|
|
1709
1709
|
className: Ft.itemIcon,
|
|
1710
1710
|
children: u
|
|
1711
1711
|
}),
|
|
1712
|
-
label: /* @__PURE__ */
|
|
1712
|
+
label: /* @__PURE__ */ G("span", {
|
|
1713
1713
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
1714
|
-
children: [/* @__PURE__ */
|
|
1714
|
+
children: [/* @__PURE__ */ W(y, {
|
|
1715
1715
|
text: l.displayName ?? l.id,
|
|
1716
1716
|
query: o,
|
|
1717
1717
|
maxLines: 1,
|
|
1718
1718
|
className: c(a, "min-w-0 flex-1 text-start")
|
|
1719
|
-
}), f && /* @__PURE__ */
|
|
1719
|
+
}), f && /* @__PURE__ */ W(P, {
|
|
1720
1720
|
size: p.SM,
|
|
1721
1721
|
className: Ft.checkIcon,
|
|
1722
1722
|
"aria-hidden": !0,
|
|
@@ -1727,11 +1727,11 @@ var Ft = {
|
|
|
1727
1727
|
})
|
|
1728
1728
|
});
|
|
1729
1729
|
}, zt = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: a, selectedDeploymentId: o, onSelect: l, loadingLabel: u, errorLabel: d, emptyLabel: f, style: p, titleClassName: m = "dial-body-semi-text", labelClassName: h = "dial-small-text", colors: _ }) => {
|
|
1730
|
-
let [v, y] =
|
|
1731
|
-
|
|
1730
|
+
let [v, y] = V("");
|
|
1731
|
+
R(() => {
|
|
1732
1732
|
e || y("");
|
|
1733
1733
|
}, [e]);
|
|
1734
|
-
let b = a && a.length > 0, x = u !== void 0, S = !b && !x ? d ?? f : void 0, C = b ?
|
|
1734
|
+
let b = a && a.length > 0, x = u !== void 0, S = !b && !x ? d ?? f : void 0, C = b ? ht(a, v) : [], w = (e) => {
|
|
1735
1735
|
l(e), i();
|
|
1736
1736
|
}, T = s({
|
|
1737
1737
|
"--ci-sheet-divider": _?.divider,
|
|
@@ -1741,7 +1741,7 @@ var Ft = {
|
|
|
1741
1741
|
"--ci-sheet-icon": _?.itemIcon,
|
|
1742
1742
|
"--ci-check-icon": _?.checkIcon
|
|
1743
1743
|
});
|
|
1744
|
-
return /* @__PURE__ */
|
|
1744
|
+
return /* @__PURE__ */ W(Te, {
|
|
1745
1745
|
isOpen: e,
|
|
1746
1746
|
title: t,
|
|
1747
1747
|
closeLabel: n,
|
|
@@ -1750,22 +1750,22 @@ var Ft = {
|
|
|
1750
1750
|
titleClassName: m,
|
|
1751
1751
|
className: "max-h-[80dvh]",
|
|
1752
1752
|
colors: _?.shell,
|
|
1753
|
-
children: /* @__PURE__ */
|
|
1753
|
+
children: /* @__PURE__ */ G("div", {
|
|
1754
1754
|
className: "contents",
|
|
1755
1755
|
style: T,
|
|
1756
|
-
children: [b && !x && /* @__PURE__ */
|
|
1756
|
+
children: [b && !x && /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("div", {
|
|
1757
1757
|
className: "flex-shrink-0 px-4 py-[10px]",
|
|
1758
|
-
children: /* @__PURE__ */
|
|
1758
|
+
children: /* @__PURE__ */ W(O, {
|
|
1759
1759
|
value: v,
|
|
1760
1760
|
placeholder: r,
|
|
1761
1761
|
size: g.Standard,
|
|
1762
1762
|
onChange: (e) => y(e ?? "")
|
|
1763
1763
|
})
|
|
1764
|
-
}), /* @__PURE__ */
|
|
1764
|
+
}), /* @__PURE__ */ W("div", { className: c(Ft.divider, "h-px flex-shrink-0") })] }), x ? /* @__PURE__ */ W(pt, { loadingLabel: u }) : S ? /* @__PURE__ */ W("div", {
|
|
1765
1765
|
role: "list",
|
|
1766
1766
|
className: c(Ft.stateLabel, h, "px-4 py-4"),
|
|
1767
1767
|
children: S
|
|
1768
|
-
}) : /* @__PURE__ */
|
|
1768
|
+
}) : /* @__PURE__ */ W(Pt, {
|
|
1769
1769
|
role: "list",
|
|
1770
1770
|
className: "overflow-y-auto",
|
|
1771
1771
|
style: { height: Math.min(C.length, Lt) * It },
|
|
@@ -1783,23 +1783,23 @@ var Ft = {
|
|
|
1783
1783
|
})
|
|
1784
1784
|
});
|
|
1785
1785
|
}, Bt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, isStreaming: i, isMobile: a, isDisabled: s = !1, style: l, modelPickerOverlay: u, isPickerOpen: d, onPickerToggle: f, onPickerOpenChange: g }) => {
|
|
1786
|
-
let [_, y] =
|
|
1786
|
+
let [_, y] = V(!1), { selectorIcon: b, selectorAriaLabel: x, selectedLabel: S, selectedVersion: C, menuItems: w, menuHeader: T, onOpenChange: E } = gt({
|
|
1787
1787
|
deployments: e,
|
|
1788
1788
|
selectedDeploymentId: t,
|
|
1789
1789
|
onDeploymentChange: n,
|
|
1790
1790
|
modelSelectorLabels: r
|
|
1791
1791
|
});
|
|
1792
1792
|
if (!e) return null;
|
|
1793
|
-
let D = i || s ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, O = /* @__PURE__ */
|
|
1793
|
+
let D = i || s ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, O = /* @__PURE__ */ W(F, {
|
|
1794
1794
|
size: p.SM,
|
|
1795
|
-
className:
|
|
1795
|
+
className: q.modelSelectorCaret,
|
|
1796
1796
|
"aria-hidden": !0,
|
|
1797
1797
|
stroke: m
|
|
1798
1798
|
});
|
|
1799
|
-
return a ? /* @__PURE__ */
|
|
1799
|
+
return a ? /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(N, {
|
|
1800
1800
|
tooltip: S,
|
|
1801
|
-
children: /* @__PURE__ */
|
|
1802
|
-
icon: /* @__PURE__ */
|
|
1801
|
+
children: /* @__PURE__ */ W(v, {
|
|
1802
|
+
icon: /* @__PURE__ */ G("div", {
|
|
1803
1803
|
className: "flex items-center gap-1",
|
|
1804
1804
|
children: [b, O]
|
|
1805
1805
|
}),
|
|
@@ -1807,16 +1807,16 @@ var Ft = {
|
|
|
1807
1807
|
onClick: () => {
|
|
1808
1808
|
s || y(!0);
|
|
1809
1809
|
},
|
|
1810
|
-
className: c("w-[50px]",
|
|
1810
|
+
className: c("w-[50px]", q.modelSelectorButton, D)
|
|
1811
1811
|
})
|
|
1812
|
-
}), u ? /* @__PURE__ */
|
|
1812
|
+
}), u ? /* @__PURE__ */ W(Te, {
|
|
1813
1813
|
isOpen: _,
|
|
1814
1814
|
title: r?.ariaLabel ?? "Select model",
|
|
1815
1815
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1816
1816
|
onClose: () => y(!1),
|
|
1817
1817
|
style: l,
|
|
1818
1818
|
children: u(() => y(!1))
|
|
1819
|
-
}) : /* @__PURE__ */
|
|
1819
|
+
}) : /* @__PURE__ */ W(zt, {
|
|
1820
1820
|
isOpen: _,
|
|
1821
1821
|
title: r?.ariaLabel ?? "Select model",
|
|
1822
1822
|
closeLabel: r?.closeLabel ?? "Close",
|
|
@@ -1829,7 +1829,7 @@ var Ft = {
|
|
|
1829
1829
|
errorLabel: r?.error,
|
|
1830
1830
|
emptyLabel: r?.empty,
|
|
1831
1831
|
style: l
|
|
1832
|
-
})] }) : u ? /* @__PURE__ */
|
|
1832
|
+
})] }) : u ? /* @__PURE__ */ W(h, {
|
|
1833
1833
|
placement: "top-end",
|
|
1834
1834
|
matchReferenceWidth: !1,
|
|
1835
1835
|
open: d,
|
|
@@ -1838,25 +1838,25 @@ var Ft = {
|
|
|
1838
1838
|
outsideClosable: !0,
|
|
1839
1839
|
renderOverlay: () => u(() => g?.(!1)),
|
|
1840
1840
|
listClassName: "!w-[368px] !bg-layer-raised",
|
|
1841
|
-
children: /* @__PURE__ */
|
|
1841
|
+
children: /* @__PURE__ */ W(N, {
|
|
1842
1842
|
tooltip: C ? `${S} · ${C}` : S,
|
|
1843
|
-
children: /* @__PURE__ */
|
|
1843
|
+
children: /* @__PURE__ */ G("button", {
|
|
1844
1844
|
type: "button",
|
|
1845
1845
|
"aria-label": x,
|
|
1846
1846
|
"aria-disabled": s || void 0,
|
|
1847
|
-
className: c("flex min-w-0 items-center gap-1.5 rounded-full py-1.5 pe-2 ps-1.5",
|
|
1847
|
+
className: c("flex min-w-0 items-center gap-1.5 rounded-full py-1.5 pe-2 ps-1.5", q.modelSelectorButton, D, s && q.modelSelectorButtonDisabled),
|
|
1848
1848
|
onClick: () => {
|
|
1849
1849
|
!i && !s && f?.();
|
|
1850
1850
|
},
|
|
1851
1851
|
children: [
|
|
1852
1852
|
b,
|
|
1853
|
-
/* @__PURE__ */
|
|
1853
|
+
/* @__PURE__ */ G("span", {
|
|
1854
1854
|
className: "flex min-w-0 max-w-[180px] items-baseline gap-1",
|
|
1855
|
-
children: [/* @__PURE__ */
|
|
1856
|
-
className: c("dial-small-text max-w-[180px] shrink-0 truncate",
|
|
1855
|
+
children: [/* @__PURE__ */ W("span", {
|
|
1856
|
+
className: c("dial-small-text max-w-[180px] shrink-0 truncate", q.modelSelectorName),
|
|
1857
1857
|
children: S
|
|
1858
|
-
}), C && /* @__PURE__ */
|
|
1859
|
-
className: c("dial-tiny-text min-w-0 truncate",
|
|
1858
|
+
}), C && /* @__PURE__ */ W("span", {
|
|
1859
|
+
className: c("dial-tiny-text min-w-0 truncate", q.modelSelectorVersion),
|
|
1860
1860
|
children: C
|
|
1861
1861
|
})]
|
|
1862
1862
|
}),
|
|
@@ -1864,10 +1864,10 @@ var Ft = {
|
|
|
1864
1864
|
]
|
|
1865
1865
|
})
|
|
1866
1866
|
})
|
|
1867
|
-
}) : /* @__PURE__ */
|
|
1867
|
+
}) : /* @__PURE__ */ W("div", {
|
|
1868
1868
|
className: c(s && D),
|
|
1869
1869
|
"aria-disabled": s || void 0,
|
|
1870
|
-
children: /* @__PURE__ */
|
|
1870
|
+
children: /* @__PURE__ */ W(h, {
|
|
1871
1871
|
items: w,
|
|
1872
1872
|
menuHeader: T,
|
|
1873
1873
|
placement: "bottom-end",
|
|
@@ -1876,20 +1876,20 @@ var Ft = {
|
|
|
1876
1876
|
listClassName: "!w-[240px]",
|
|
1877
1877
|
disabled: s,
|
|
1878
1878
|
onOpenChange: s ? void 0 : E,
|
|
1879
|
-
children: /* @__PURE__ */
|
|
1879
|
+
children: /* @__PURE__ */ W(N, {
|
|
1880
1880
|
tooltip: S,
|
|
1881
|
-
children: /* @__PURE__ */
|
|
1881
|
+
children: /* @__PURE__ */ G("button", {
|
|
1882
1882
|
type: "button",
|
|
1883
1883
|
"aria-label": x,
|
|
1884
1884
|
"aria-disabled": s || void 0,
|
|
1885
|
-
className: c("flex items-center gap-1 rounded-full p-1.5",
|
|
1885
|
+
className: c("flex items-center gap-1 rounded-full p-1.5", q.modelSelectorButton, s && q.modelSelectorButtonDisabled),
|
|
1886
1886
|
children: [b, O]
|
|
1887
1887
|
})
|
|
1888
1888
|
})
|
|
1889
1889
|
})
|
|
1890
1890
|
});
|
|
1891
|
-
}, Vt = ({ message: e = "", messageRevision: t, textInsertion: n, onSend: r, onUploadAttachment: i, onStop: a, isStreaming: o = !1, onChange: d, onAttachmentsChange: f, placeholder: g = "Type a message...", ariaLabel: y, attachLabel: b = "Attach file", fileAccept: x, addMenuTitle: S = "Add", menuTitle: C = "Menu", menuCloseLabel: w = "Close", removeLabel: T, retryLabel: E, uploadingLabel: D, sendLabel: O, sendTooltip: k, stopLabel: ee, micLabel: A = "Dictate", recordVoiceLabel: te = "Record voice", stopRecordingLabel: j, discardRecordingLabel: ne, colors: M, typography: N, className: re, pendingDropFiles: ie = [], onDropFilesConsumed:
|
|
1892
|
-
let
|
|
1891
|
+
}, Vt = ({ message: e = "", messageRevision: t, textInsertion: n, onSend: r, onUploadAttachment: i, onStop: a, isStreaming: o = !1, onChange: d, onAttachmentsChange: f, placeholder: g = "Type a message...", ariaLabel: y, attachLabel: b = "Attach file", fileAccept: x, addMenuTitle: S = "Add", menuTitle: C = "Menu", menuCloseLabel: w = "Close", removeLabel: T, retryLabel: E, uploadingLabel: D, sendLabel: O, sendTooltip: k, stopLabel: ee, micLabel: A = "Dictate", recordVoiceLabel: te = "Record voice", stopRecordingLabel: j, discardRecordingLabel: ne, colors: M, typography: N, className: re, pendingDropFiles: ie = [], onDropFilesConsumed: P, pendingAttachments: F = [], onPendingAttachmentsConsumed: ae, pasteTextThreshold: ce = 4e3, maxMessageLength: I = 5e4, deployments: le, selectedDeploymentId: ue, onDeploymentChange: de, modelSelectorLabels: fe, initialAttachments: pe = [], hideAddButton: me = !1, hideAttachFile: he = !1, hideActionBar: ge = !1, renderFooterActions: _e, isInputDisabled: H = !1, isModelSelectorDisabled: ye = !1, isSendDisabled: be = !1, isAudioMessageSupported: Se = !1, isVoiceRecordingSupported: Ce = Se, onTranscribeAudio: we, transcribingLabel: Te, voiceErrorLabel: Ee, sendOnEnter: Oe = Ue.Enter, prefixAttachments: Ae = [], onRemovePrefixAttachment: je, chatSettings: Pe, toolsMenuItems: Re, onToolToggle: ze, canRemoveTools: Be = !0, toolsMenuTitle: Ve, toolsBackLabel: We, toolsChipLabels: Ge, menuOverlays: Ke, inlineStartSlot: qe, onInlineStartRemove: Je, commandMenu: K, autoFocus: Ye = !1, messageHistory: Xe, onDialFileSystemClick: Ze, dialFileSystemLabel: Qe, validateAttachment: $e, onAttachmentClick: tt, modelPickerOverlay: nt, maximumAttachmentsAmount: it, onAttachmentsLimitExceeded: at, isAttachmentsEnabled: ot = !0, isTextAttachmentsAllowed: st = !0, usageLimitsSlot: dt, onMessageTooLong: ft }) => {
|
|
1892
|
+
let pt = l(), [mt, ht] = V(!1), J = Me(Xe), Y = qe != null, [gt, _t] = V(null), [vt, yt] = V(0), bt = z(() => s({
|
|
1893
1893
|
"--ci-bg": M?.background,
|
|
1894
1894
|
"--ci-text": M?.text,
|
|
1895
1895
|
"--ci-border": M?.border,
|
|
@@ -1904,332 +1904,331 @@ var Ft = {
|
|
|
1904
1904
|
"--ci-voice-error": M?.voiceError,
|
|
1905
1905
|
"--ci-voice-waveform": M?.voiceWaveform,
|
|
1906
1906
|
"--ci-voice-accent": M?.voiceAccent,
|
|
1907
|
-
"--ci-first-line-indent":
|
|
1907
|
+
"--ci-first-line-indent": Y ? `calc(${vt}px + 4px)` : void 0
|
|
1908
1908
|
}), [
|
|
1909
1909
|
M,
|
|
1910
|
-
|
|
1910
|
+
Y,
|
|
1911
1911
|
vt
|
|
1912
|
-
]), xt =
|
|
1912
|
+
]), xt = z(() => Ze ? [{
|
|
1913
1913
|
key: "dial-fs",
|
|
1914
|
-
label:
|
|
1915
|
-
icon: /* @__PURE__ */
|
|
1914
|
+
label: Qe ?? "DIAL file system",
|
|
1915
|
+
icon: /* @__PURE__ */ W(oe, {
|
|
1916
1916
|
size: u,
|
|
1917
1917
|
"aria-hidden": !0,
|
|
1918
1918
|
stroke: m
|
|
1919
1919
|
}),
|
|
1920
|
-
onClick:
|
|
1921
|
-
}] : [], [
|
|
1920
|
+
onClick: Ze
|
|
1921
|
+
}] : [], [Ze, Qe]), { message: X, setMessage: Z, textareaRef: Q } = Ne({
|
|
1922
1922
|
messageProp: e,
|
|
1923
1923
|
messageRevision: t
|
|
1924
1924
|
});
|
|
1925
|
-
|
|
1925
|
+
Fe({
|
|
1926
1926
|
insertion: n,
|
|
1927
|
-
textareaRef:
|
|
1927
|
+
textareaRef: Q
|
|
1928
1928
|
});
|
|
1929
|
-
let { isMenuOpen:
|
|
1930
|
-
config:
|
|
1931
|
-
message:
|
|
1932
|
-
}),
|
|
1933
|
-
if (
|
|
1934
|
-
|
|
1935
|
-
let t = `${
|
|
1936
|
-
if (!
|
|
1937
|
-
let n =
|
|
1938
|
-
|
|
1929
|
+
let { isMenuOpen: St, query: Ct, dismiss: wt, handleValueChange: Tt } = ke({
|
|
1930
|
+
config: K,
|
|
1931
|
+
message: X
|
|
1932
|
+
}), Et = K?.emptyQueryHint != null, Dt = Et && St && Ct === "", Ot = L((e) => {
|
|
1933
|
+
if (K == null || (wt(), !e?.consumeQuery)) return;
|
|
1934
|
+
Q.current?.focus();
|
|
1935
|
+
let t = `${K.triggerPrefix}${Ct}`;
|
|
1936
|
+
if (!X.startsWith(t)) return;
|
|
1937
|
+
let n = X.slice(t.length);
|
|
1938
|
+
Z(n), J.notifyChange(), d?.(n);
|
|
1939
1939
|
}, [
|
|
1940
|
-
|
|
1940
|
+
K,
|
|
1941
|
+
wt,
|
|
1941
1942
|
Ct,
|
|
1942
|
-
St,
|
|
1943
|
-
Y,
|
|
1944
1943
|
X,
|
|
1945
|
-
|
|
1944
|
+
Z,
|
|
1945
|
+
J,
|
|
1946
1946
|
d,
|
|
1947
|
-
|
|
1947
|
+
Q
|
|
1948
1948
|
]);
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
let t = new ResizeObserver((e) => {
|
|
1949
|
+
R(() => {
|
|
1950
|
+
if (gt == null) return;
|
|
1951
|
+
let e = new ResizeObserver((e) => {
|
|
1953
1952
|
let t = e[0];
|
|
1954
1953
|
t != null && yt(t.contentRect.width);
|
|
1955
1954
|
});
|
|
1956
|
-
return
|
|
1957
|
-
}, [
|
|
1958
|
-
let { attachments:
|
|
1959
|
-
initialAttachments:
|
|
1955
|
+
return e.observe(gt), () => e.disconnect();
|
|
1956
|
+
}, [gt]);
|
|
1957
|
+
let { attachments: kt, buildAttachments: At, addAttachments: jt, resetAttachments: Mt, handleRemove: Nt, handleRetry: Pt, handleExpand: Ft, hasBlockedAttachments: It } = De({
|
|
1958
|
+
initialAttachments: pe,
|
|
1960
1959
|
onUploadAttachment: i,
|
|
1961
1960
|
onAttachmentsChange: f,
|
|
1962
|
-
validateAttachment:
|
|
1961
|
+
validateAttachment: $e,
|
|
1963
1962
|
pendingDropFiles: ie,
|
|
1964
|
-
onDropFilesConsumed:
|
|
1965
|
-
pendingAttachments:
|
|
1966
|
-
onPendingAttachmentsConsumed:
|
|
1967
|
-
onExpandPastedText:
|
|
1968
|
-
|
|
1969
|
-
}, [
|
|
1970
|
-
maximumAttachmentsAmount:
|
|
1971
|
-
baseAttachmentsAmount:
|
|
1972
|
-
onAttachmentsLimitExceeded:
|
|
1973
|
-
}),
|
|
1974
|
-
At(
|
|
1975
|
-
}, [
|
|
1976
|
-
|
|
1977
|
-
let [
|
|
1963
|
+
onDropFilesConsumed: P,
|
|
1964
|
+
pendingAttachments: F,
|
|
1965
|
+
onPendingAttachmentsConsumed: ae,
|
|
1966
|
+
onExpandPastedText: L((e) => {
|
|
1967
|
+
Z((t) => t ? `${t}\n${e}` : e);
|
|
1968
|
+
}, [Z]),
|
|
1969
|
+
maximumAttachmentsAmount: it,
|
|
1970
|
+
baseAttachmentsAmount: Ae.length,
|
|
1971
|
+
onAttachmentsLimitExceeded: at
|
|
1972
|
+
}), Lt = L((e) => {
|
|
1973
|
+
jt(At([e]));
|
|
1974
|
+
}, [jt, At]), Rt = B(!1), zt = B(X);
|
|
1975
|
+
zt.current = X;
|
|
1976
|
+
let [Vt, Ht] = V({
|
|
1978
1977
|
text: "",
|
|
1979
1978
|
revision: 0
|
|
1980
|
-
}), { state:
|
|
1981
|
-
onAttachAudio:
|
|
1982
|
-
onTranscribeAudio:
|
|
1983
|
-
onTranscript:
|
|
1979
|
+
}), { state: Ut, analyserNodeRef: Wt, errorMessage: Gt, startRecording: Kt, stopRecording: qt, discardRecording: Jt } = He({
|
|
1980
|
+
onAttachAudio: Lt,
|
|
1981
|
+
onTranscribeAudio: we,
|
|
1982
|
+
onTranscript: L((e) => {
|
|
1984
1983
|
let t = e.trim();
|
|
1985
1984
|
if (t) {
|
|
1986
|
-
let e =
|
|
1987
|
-
|
|
1985
|
+
let e = zt.current, n = `${e}${e && !/\s$/.test(e) ? " " : ""}${t}`;
|
|
1986
|
+
zt.current = n, Z(n), Ht((e) => ({
|
|
1988
1987
|
text: t,
|
|
1989
1988
|
revision: e.revision + 1
|
|
1990
|
-
})),
|
|
1989
|
+
})), J.notifyChange(), d?.(n);
|
|
1991
1990
|
}
|
|
1992
|
-
|
|
1991
|
+
Rt.current = !0;
|
|
1993
1992
|
}, [
|
|
1994
|
-
|
|
1995
|
-
|
|
1993
|
+
Z,
|
|
1994
|
+
J,
|
|
1996
1995
|
d
|
|
1997
1996
|
]),
|
|
1998
|
-
errorLabel:
|
|
1999
|
-
}), $ =
|
|
2000
|
-
|
|
2001
|
-
(
|
|
2002
|
-
}, [
|
|
2003
|
-
let
|
|
2004
|
-
if (!
|
|
1997
|
+
errorLabel: Ee
|
|
1998
|
+
}), $ = Ut === Ie.Recording || Ut === Ie.Processing;
|
|
1999
|
+
R(() => {
|
|
2000
|
+
(Ut === Ie.Error || Ut === Ie.Idle && Rt.current) && (Rt.current = !1, Q.current?.focus());
|
|
2001
|
+
}, [Ut, Q]);
|
|
2002
|
+
let Yt = B(null), Xt = B(null), Zt = ot && st, { handlePaste: Qt } = xe(jt, Zt ? ce : Infinity), $t = L((e) => {
|
|
2003
|
+
if (!Zt) {
|
|
2005
2004
|
let t = e.clipboardData.getData("text/plain");
|
|
2006
|
-
t.length >=
|
|
2005
|
+
t.length >= I && ft?.(t.length, I);
|
|
2007
2006
|
}
|
|
2008
|
-
|
|
2007
|
+
Qt(e);
|
|
2009
2008
|
}, [
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
]),
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
}, [(
|
|
2018
|
-
let
|
|
2019
|
-
let e =
|
|
2020
|
-
return
|
|
2009
|
+
Zt,
|
|
2010
|
+
I,
|
|
2011
|
+
ft,
|
|
2012
|
+
Qt
|
|
2013
|
+
]), en = (X.trim().length > 0 || kt.length > 0 || Y) && !It && !be && !$, [tn, nn] = V([]);
|
|
2014
|
+
R(() => {
|
|
2015
|
+
nn([]);
|
|
2016
|
+
}, [(Re ?? []).map((e) => e.id).join("|")]);
|
|
2017
|
+
let rn = z(() => {
|
|
2018
|
+
let e = Re ?? [];
|
|
2019
|
+
return Be ? e.filter((e) => e.isSelected || !tn.includes(e.id)) : e;
|
|
2021
2020
|
}, [
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
]),
|
|
2026
|
-
|
|
2027
|
-
}, [
|
|
2028
|
-
if (
|
|
2029
|
-
if (
|
|
2030
|
-
|
|
2021
|
+
Re,
|
|
2022
|
+
tn,
|
|
2023
|
+
Be
|
|
2024
|
+
]), an = L((e) => {
|
|
2025
|
+
nn((t) => t.includes(e) ? t : [...t, e]), Re?.find((t) => t.id === e)?.isSelected && ze?.(e);
|
|
2026
|
+
}, [Re, ze]), on = le === void 0 || ue != null, sn = Se && !o, cn = async () => {
|
|
2027
|
+
if (be || $) return;
|
|
2028
|
+
if (X.length >= I) {
|
|
2029
|
+
ft?.(X.length, I);
|
|
2031
2030
|
return;
|
|
2032
2031
|
}
|
|
2033
|
-
let e =
|
|
2034
|
-
|
|
2032
|
+
let e = X, t = kt;
|
|
2033
|
+
Z(""), J.reset();
|
|
2035
2034
|
try {
|
|
2036
2035
|
await r?.(e, t), t.forEach((e) => {
|
|
2037
2036
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
2038
|
-
}),
|
|
2037
|
+
}), Mt([]);
|
|
2039
2038
|
} catch {
|
|
2040
|
-
|
|
2039
|
+
Z(e), Mt(t);
|
|
2041
2040
|
}
|
|
2042
|
-
},
|
|
2041
|
+
}, ln = (e) => {
|
|
2043
2042
|
if (!$) {
|
|
2044
|
-
if (!e.nativeEvent.isComposing && !
|
|
2043
|
+
if (!e.nativeEvent.isComposing && !H && !o) {
|
|
2045
2044
|
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
2046
|
-
let t = e.currentTarget.selectionStart ?? 0, n =
|
|
2045
|
+
let t = e.currentTarget.selectionStart ?? 0, n = J.navigate(e.key === "ArrowUp" ? "up" : "down", X, t);
|
|
2047
2046
|
if (n !== null) {
|
|
2048
|
-
e.preventDefault(),
|
|
2047
|
+
e.preventDefault(), Z(n);
|
|
2049
2048
|
return;
|
|
2050
2049
|
}
|
|
2051
2050
|
}
|
|
2052
|
-
if (e.key === "Backspace" &&
|
|
2053
|
-
e.preventDefault(),
|
|
2051
|
+
if (e.key === "Backspace" && Y && Je != null && e.currentTarget.selectionStart === 0 && e.currentTarget.selectionEnd === 0) {
|
|
2052
|
+
e.preventDefault(), Je();
|
|
2054
2053
|
return;
|
|
2055
2054
|
}
|
|
2056
2055
|
}
|
|
2057
|
-
e.key === "Enter" && (
|
|
2056
|
+
e.key === "Enter" && (Oe === Ue.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !o && en && on && !H && cn());
|
|
2058
2057
|
}
|
|
2059
|
-
},
|
|
2058
|
+
}, un = (e) => {
|
|
2060
2059
|
let t = Array.from(e.target.files ?? []);
|
|
2061
2060
|
if (t.length === 0) return;
|
|
2062
|
-
let n =
|
|
2063
|
-
e.target.value = "",
|
|
2064
|
-
},
|
|
2065
|
-
className: c(
|
|
2066
|
-
ref:
|
|
2067
|
-
autoFocus:
|
|
2068
|
-
value:
|
|
2061
|
+
let n = At(t);
|
|
2062
|
+
e.target.value = "", jt(n);
|
|
2063
|
+
}, dn = /* @__PURE__ */ W("textarea", {
|
|
2064
|
+
className: c(q.textarea, Y && q.textareaIndented, N?.fontClassName || "dial-body-paragraph-text", "max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent outline-none [field-sizing:content]", "disabled:cursor-not-allowed"),
|
|
2065
|
+
ref: Q,
|
|
2066
|
+
autoFocus: Ye,
|
|
2067
|
+
value: X,
|
|
2069
2068
|
onChange: (e) => {
|
|
2070
|
-
|
|
2069
|
+
Z(e.target.value), J.notifyChange();
|
|
2071
2070
|
let t = e.nativeEvent instanceof InputEvent ? e.nativeEvent : void 0;
|
|
2072
|
-
|
|
2071
|
+
Tt(e.target.value, t?.isComposing ?? !1, t?.inputType), d?.(e.target.value);
|
|
2073
2072
|
},
|
|
2074
|
-
onKeyDown:
|
|
2075
|
-
onPaste:
|
|
2076
|
-
placeholder:
|
|
2073
|
+
onKeyDown: ln,
|
|
2074
|
+
onPaste: $t,
|
|
2075
|
+
placeholder: Y ? void 0 : g,
|
|
2077
2076
|
"aria-label": y,
|
|
2078
|
-
disabled:
|
|
2077
|
+
disabled: H,
|
|
2079
2078
|
readOnly: $,
|
|
2080
2079
|
rows: 1
|
|
2081
|
-
}),
|
|
2080
|
+
}), fn = K == null ? dn : /* @__PURE__ */ W(h, {
|
|
2082
2081
|
className: "w-full",
|
|
2083
|
-
open:
|
|
2082
|
+
open: St,
|
|
2084
2083
|
onOpenChange: (e) => {
|
|
2085
|
-
e ||
|
|
2084
|
+
e || wt();
|
|
2086
2085
|
},
|
|
2087
2086
|
placement: "top-start",
|
|
2088
2087
|
trigger: [],
|
|
2089
2088
|
initialFocus: -1,
|
|
2090
2089
|
matchReferenceWidth: !1,
|
|
2091
|
-
outsidePressIgnoreRef:
|
|
2090
|
+
outsidePressIgnoreRef: Q,
|
|
2092
2091
|
renderOverlay: () => {
|
|
2093
|
-
let e =
|
|
2094
|
-
query:
|
|
2095
|
-
close:
|
|
2092
|
+
let e = K.renderMenu({
|
|
2093
|
+
query: Ct,
|
|
2094
|
+
close: Ot
|
|
2096
2095
|
});
|
|
2097
|
-
return
|
|
2096
|
+
return K.menuLabel == null ? e : /* @__PURE__ */ W("div", {
|
|
2098
2097
|
role: "group",
|
|
2099
|
-
"aria-label":
|
|
2098
|
+
"aria-label": K.menuLabel,
|
|
2100
2099
|
children: e
|
|
2101
2100
|
});
|
|
2102
2101
|
},
|
|
2103
|
-
children:
|
|
2104
|
-
}),
|
|
2102
|
+
children: dn
|
|
2103
|
+
}), pn = Y || Et ? /* @__PURE__ */ G("div", {
|
|
2105
2104
|
className: "relative w-full",
|
|
2106
2105
|
children: [
|
|
2107
|
-
|
|
2106
|
+
Y && /* @__PURE__ */ W("div", {
|
|
2108
2107
|
ref: _t,
|
|
2109
2108
|
className: "absolute start-0 top-0",
|
|
2110
|
-
children:
|
|
2109
|
+
children: qe
|
|
2111
2110
|
}),
|
|
2112
|
-
|
|
2113
|
-
className: c(
|
|
2111
|
+
Dt && K != null && /* @__PURE__ */ G("span", {
|
|
2112
|
+
className: c(q.commandHint, "pointer-events-none absolute start-[var(--ci-first-line-indent,0px)] top-0", N?.fontClassName || "dial-body-paragraph-text"),
|
|
2114
2113
|
"aria-hidden": !0,
|
|
2115
|
-
children: [/* @__PURE__ */
|
|
2114
|
+
children: [/* @__PURE__ */ W("span", {
|
|
2116
2115
|
className: "invisible",
|
|
2117
|
-
children:
|
|
2118
|
-
}),
|
|
2116
|
+
children: K.triggerPrefix
|
|
2117
|
+
}), K.emptyQueryHint]
|
|
2119
2118
|
}),
|
|
2120
|
-
|
|
2119
|
+
fn
|
|
2121
2120
|
]
|
|
2122
|
-
}) :
|
|
2123
|
-
onAttachClick:
|
|
2121
|
+
}) : fn, mn = me ? void 0 : /* @__PURE__ */ W(et, {
|
|
2122
|
+
onAttachClick: he ? void 0 : () => Yt.current?.click(),
|
|
2124
2123
|
attachLabel: b,
|
|
2125
2124
|
addMenuTitle: S,
|
|
2126
2125
|
menuTitle: C,
|
|
2127
2126
|
menuCloseLabel: w,
|
|
2128
2127
|
style: bt,
|
|
2129
|
-
isDisabled:
|
|
2130
|
-
chatSettings:
|
|
2128
|
+
isDisabled: H || $,
|
|
2129
|
+
chatSettings: Pe,
|
|
2131
2130
|
extraMenuItems: xt,
|
|
2132
|
-
onRecordVoice:
|
|
2131
|
+
onRecordVoice: Ce && ot && !o && !$ ? () => Kt(Le.Attachment) : void 0,
|
|
2133
2132
|
recordVoiceLabel: te,
|
|
2134
|
-
toolsMenuItems:
|
|
2135
|
-
onToolToggle:
|
|
2136
|
-
toolsMenuTitle:
|
|
2137
|
-
toolsBackLabel:
|
|
2138
|
-
menuOverlays:
|
|
2133
|
+
toolsMenuItems: Be ? Re : void 0,
|
|
2134
|
+
onToolToggle: ze,
|
|
2135
|
+
toolsMenuTitle: Ve,
|
|
2136
|
+
toolsBackLabel: We,
|
|
2137
|
+
menuOverlays: Ke
|
|
2139
2138
|
});
|
|
2140
|
-
return /* @__PURE__ */
|
|
2141
|
-
ref:
|
|
2139
|
+
return /* @__PURE__ */ G("div", {
|
|
2140
|
+
ref: Xt,
|
|
2142
2141
|
style: bt,
|
|
2143
|
-
className: c(
|
|
2142
|
+
className: c(q.wrapper, H && q.wrapperDisabled, H && "cursor-not-allowed", "flex w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", "focus-within:outline focus-within:-outline-offset-1 active:outline active:-outline-offset-1", kt.length > 6 ? "py-4 ps-4" : "p-4", re),
|
|
2144
2143
|
children: [
|
|
2145
|
-
(
|
|
2146
|
-
attachments: [...
|
|
2144
|
+
(Ae.length > 0 || kt.length > 0) && /* @__PURE__ */ W(ve, {
|
|
2145
|
+
attachments: [...Ae, ...kt],
|
|
2147
2146
|
onRemove: (e) => {
|
|
2148
|
-
|
|
2147
|
+
Ae.some((t) => t.id === e) ? je?.(e) : Nt(e);
|
|
2149
2148
|
},
|
|
2150
|
-
onRetry:
|
|
2151
|
-
onExpand:
|
|
2149
|
+
onRetry: Pt,
|
|
2150
|
+
onExpand: Ft,
|
|
2152
2151
|
labels: {
|
|
2153
2152
|
removeLabel: T,
|
|
2154
2153
|
retryLabel: E,
|
|
2155
2154
|
uploadingLabel: D
|
|
2156
2155
|
},
|
|
2157
|
-
onAttachmentClick:
|
|
2158
|
-
let t = [...
|
|
2159
|
-
t != null &&
|
|
2156
|
+
onAttachmentClick: tt == null ? void 0 : (e) => {
|
|
2157
|
+
let t = [...Ae, ...kt].find((t) => t.id === e);
|
|
2158
|
+
t != null && tt(t);
|
|
2160
2159
|
}
|
|
2161
2160
|
}),
|
|
2162
|
-
!
|
|
2163
|
-
ref:
|
|
2161
|
+
!me && /* @__PURE__ */ W("input", {
|
|
2162
|
+
ref: Yt,
|
|
2164
2163
|
type: "file",
|
|
2165
2164
|
multiple: !0,
|
|
2166
2165
|
accept: x,
|
|
2167
2166
|
className: "sr-only",
|
|
2168
2167
|
"aria-hidden": !0,
|
|
2169
2168
|
tabIndex: -1,
|
|
2170
|
-
onChange:
|
|
2169
|
+
onChange: un
|
|
2171
2170
|
}),
|
|
2172
|
-
|
|
2173
|
-
text:
|
|
2171
|
+
Gt && /* @__PURE__ */ W(_, {
|
|
2172
|
+
text: Gt,
|
|
2174
2173
|
className: "min-w-0 break-words px-1"
|
|
2175
2174
|
}),
|
|
2176
|
-
$ && /* @__PURE__ */
|
|
2175
|
+
$ && /* @__PURE__ */ W(ct, {
|
|
2177
2176
|
embedded: !0,
|
|
2178
|
-
state:
|
|
2179
|
-
analyserNodeRef:
|
|
2180
|
-
errorMessage:
|
|
2181
|
-
onStop:
|
|
2182
|
-
onDiscard:
|
|
2183
|
-
attachButton:
|
|
2177
|
+
state: Ut,
|
|
2178
|
+
analyserNodeRef: Wt,
|
|
2179
|
+
errorMessage: Gt,
|
|
2180
|
+
onStop: qt,
|
|
2181
|
+
onDiscard: Jt,
|
|
2182
|
+
attachButton: mn,
|
|
2184
2183
|
stopLabel: j,
|
|
2185
2184
|
discardLabel: ne,
|
|
2186
|
-
processingLabel:
|
|
2185
|
+
processingLabel: Te
|
|
2187
2186
|
}),
|
|
2188
|
-
!$ &&
|
|
2189
|
-
!$ && !
|
|
2187
|
+
!$ && ge && pn,
|
|
2188
|
+
!$ && !ge && /* @__PURE__ */ G("div", {
|
|
2190
2189
|
className: "flex flex-wrap items-center gap-2",
|
|
2191
2190
|
children: [
|
|
2192
|
-
/* @__PURE__ */
|
|
2191
|
+
/* @__PURE__ */ W("div", {
|
|
2193
2192
|
className: "flex w-full min-w-0 items-center self-stretch",
|
|
2194
|
-
children:
|
|
2193
|
+
children: pn
|
|
2195
2194
|
}),
|
|
2196
|
-
|
|
2195
|
+
mn && /* @__PURE__ */ W("div", {
|
|
2197
2196
|
className: "flex",
|
|
2198
|
-
children:
|
|
2197
|
+
children: mn
|
|
2199
2198
|
}),
|
|
2200
|
-
|
|
2199
|
+
rn.length > 0 && ze != null && /* @__PURE__ */ W("div", {
|
|
2201
2200
|
className: "min-w-0 flex-1",
|
|
2202
|
-
children: /* @__PURE__ */
|
|
2203
|
-
items:
|
|
2204
|
-
onToolToggle:
|
|
2205
|
-
onToolDismiss:
|
|
2206
|
-
canRemove:
|
|
2207
|
-
removeLabel:
|
|
2201
|
+
children: /* @__PURE__ */ W(rt, {
|
|
2202
|
+
items: rn,
|
|
2203
|
+
onToolToggle: ze,
|
|
2204
|
+
onToolDismiss: an,
|
|
2205
|
+
canRemove: Be,
|
|
2206
|
+
removeLabel: Ge?.removeLabel
|
|
2208
2207
|
})
|
|
2209
2208
|
}),
|
|
2210
|
-
/* @__PURE__ */
|
|
2209
|
+
/* @__PURE__ */ W("div", {
|
|
2211
2210
|
className: "ms-auto flex flex-shrink-0 items-center gap-2",
|
|
2212
|
-
children:
|
|
2213
|
-
canSend:
|
|
2214
|
-
onSend:
|
|
2215
|
-
}) : /* @__PURE__ */
|
|
2216
|
-
|
|
2217
|
-
/* @__PURE__ */
|
|
2218
|
-
deployments:
|
|
2219
|
-
selectedDeploymentId:
|
|
2220
|
-
onDeploymentChange:
|
|
2221
|
-
modelSelectorLabels:
|
|
2211
|
+
children: _e ? _e({
|
|
2212
|
+
canSend: en,
|
|
2213
|
+
onSend: cn
|
|
2214
|
+
}) : /* @__PURE__ */ G(U, { children: [
|
|
2215
|
+
dt,
|
|
2216
|
+
/* @__PURE__ */ W(Bt, {
|
|
2217
|
+
deployments: le,
|
|
2218
|
+
selectedDeploymentId: ue,
|
|
2219
|
+
onDeploymentChange: de,
|
|
2220
|
+
modelSelectorLabels: fe,
|
|
2222
2221
|
isStreaming: o,
|
|
2223
|
-
isMobile:
|
|
2224
|
-
isDisabled:
|
|
2222
|
+
isMobile: pt,
|
|
2223
|
+
isDisabled: ye,
|
|
2225
2224
|
style: bt,
|
|
2226
|
-
modelPickerOverlay:
|
|
2227
|
-
isPickerOpen:
|
|
2228
|
-
onPickerToggle: () =>
|
|
2229
|
-
onPickerOpenChange:
|
|
2225
|
+
modelPickerOverlay: nt,
|
|
2226
|
+
isPickerOpen: mt,
|
|
2227
|
+
onPickerToggle: () => ht((e) => !e),
|
|
2228
|
+
onPickerOpenChange: ht
|
|
2230
2229
|
}),
|
|
2231
|
-
|
|
2232
|
-
icon: /* @__PURE__ */
|
|
2230
|
+
sn && /* @__PURE__ */ W(v, {
|
|
2231
|
+
icon: /* @__PURE__ */ W(se, {
|
|
2233
2232
|
size: p.LG,
|
|
2234
2233
|
stroke: m,
|
|
2235
2234
|
"aria-hidden": !0
|
|
@@ -2237,15 +2236,15 @@ var Ft = {
|
|
|
2237
2236
|
"aria-label": A,
|
|
2238
2237
|
tooltipProps: { tooltip: A },
|
|
2239
2238
|
className: "size-[40px] flex-shrink-0 mobile:min-h-11 mobile:min-w-11",
|
|
2240
|
-
onClick: () =>
|
|
2241
|
-
disabled:
|
|
2239
|
+
onClick: () => Kt(Le.Dictation),
|
|
2240
|
+
disabled: H || o
|
|
2242
2241
|
}),
|
|
2243
|
-
o && a ? /* @__PURE__ */
|
|
2242
|
+
o && a ? /* @__PURE__ */ W(ut, {
|
|
2244
2243
|
onStop: a,
|
|
2245
2244
|
ariaLabel: ee
|
|
2246
|
-
}) : !o && /* @__PURE__ */
|
|
2247
|
-
onSend:
|
|
2248
|
-
isDisabled: !
|
|
2245
|
+
}) : !o && /* @__PURE__ */ W(lt, {
|
|
2246
|
+
onSend: cn,
|
|
2247
|
+
isDisabled: !on || !en,
|
|
2249
2248
|
ariaLabel: O,
|
|
2250
2249
|
sendTooltip: k
|
|
2251
2250
|
})
|
|
@@ -2253,12 +2252,12 @@ var Ft = {
|
|
|
2253
2252
|
})
|
|
2254
2253
|
]
|
|
2255
2254
|
}),
|
|
2256
|
-
/* @__PURE__ */
|
|
2255
|
+
/* @__PURE__ */ W("span", {
|
|
2257
2256
|
className: "sr-only",
|
|
2258
2257
|
role: "status",
|
|
2259
2258
|
"aria-live": "polite",
|
|
2260
2259
|
"aria-atomic": "true",
|
|
2261
|
-
children: /* @__PURE__ */
|
|
2260
|
+
children: /* @__PURE__ */ W("span", { children: Vt.text }, Vt.revision)
|
|
2262
2261
|
})
|
|
2263
2262
|
]
|
|
2264
2263
|
});
|
|
@@ -2267,24 +2266,24 @@ var Ft = {
|
|
|
2267
2266
|
description: "_description_1icyo_5"
|
|
2268
2267
|
}, Ut = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, descriptionText: r, styles: i, className: a, inputClassName: o, isInputDisabled: l = !1, ...u }) => {
|
|
2269
2268
|
let { colors: d, typography: f } = i ?? {};
|
|
2270
|
-
return /* @__PURE__ */
|
|
2269
|
+
return /* @__PURE__ */ G("div", {
|
|
2271
2270
|
style: s({
|
|
2272
2271
|
"--ci-welcome-color": d?.welcomeText,
|
|
2273
2272
|
"--ci-description-color": d?.descriptionText
|
|
2274
2273
|
}),
|
|
2275
2274
|
className: c("relative flex w-full flex-col items-center gap-9 px-4 py-5 desktop:p-5", a),
|
|
2276
|
-
children: [n && /* @__PURE__ */
|
|
2275
|
+
children: [n && /* @__PURE__ */ G("div", {
|
|
2277
2276
|
className: "flex flex-col items-center gap-4 text-center",
|
|
2278
|
-
children: [/* @__PURE__ */
|
|
2277
|
+
children: [/* @__PURE__ */ W("h1", {
|
|
2279
2278
|
className: c(Ht.welcome, "m-0", f?.welcomeClassName || "dial-display2-text"),
|
|
2280
2279
|
children: n
|
|
2281
|
-
}), r && /* @__PURE__ */
|
|
2280
|
+
}), r && /* @__PURE__ */ W("p", {
|
|
2282
2281
|
className: c(Ht.description, "m-0 max-w-[540px]", f?.descriptionClassName || "dial-body-paragraph-text"),
|
|
2283
2282
|
children: r
|
|
2284
2283
|
})]
|
|
2285
|
-
}), /* @__PURE__ */
|
|
2284
|
+
}), /* @__PURE__ */ W("div", {
|
|
2286
2285
|
className: c("relative w-full", n ? "max-w-[700px]" : "max-w-[748px]"),
|
|
2287
|
-
children: /* @__PURE__ */
|
|
2286
|
+
children: /* @__PURE__ */ W(Vt, {
|
|
2288
2287
|
placeholder: t,
|
|
2289
2288
|
isStreaming: e,
|
|
2290
2289
|
isInputDisabled: l,
|
|
@@ -2295,56 +2294,56 @@ var Ft = {
|
|
|
2295
2294
|
})
|
|
2296
2295
|
})]
|
|
2297
2296
|
});
|
|
2298
|
-
}, Wt = ({ message: e, inlineStartSlot: t, onInlineStartRemove: n, initialAttachments: r = [], onCancel: a, onSave: o, onUploadAttachment: s, cancelLabel: l = "Cancel", saveLabel: d = "Save & Submit", ariaLabel: f, removeLabel: p, retryLabel: h, uploadingLabel: g, addMenuTitle: _ = "Add", attachLabel: v = "Attach file", menuTitle: y = "Menu", menuCloseLabel: b = "Close", className: S, pendingDropFiles: C, onDropFilesConsumed: T, validateAttachment: E, isAttachmentsEnabled: D, isTextAttachmentsAllowed: O, hideAttachFile: k = !1, fileAccept: ee, maximumAttachmentsAmount: A, onAttachmentsLimitExceeded: te, onDialFileSystemClick: j, dialFileSystemLabel: ne, pendingAttachments: M, onPendingAttachmentsConsumed: N, onAttachmentClick: re, pasteTextThreshold: ie, maxMessageLength:
|
|
2299
|
-
let
|
|
2300
|
-
|
|
2301
|
-
C?.length && (
|
|
2297
|
+
}, Wt = ({ message: e, inlineStartSlot: t, onInlineStartRemove: n, initialAttachments: r = [], onCancel: a, onSave: o, onUploadAttachment: s, cancelLabel: l = "Cancel", saveLabel: d = "Save & Submit", ariaLabel: f, removeLabel: p, retryLabel: h, uploadingLabel: g, addMenuTitle: _ = "Add", attachLabel: v = "Attach file", menuTitle: y = "Menu", menuCloseLabel: b = "Close", className: S, pendingDropFiles: C, onDropFilesConsumed: T, validateAttachment: E, isAttachmentsEnabled: D, isTextAttachmentsAllowed: O, hideAttachFile: k = !1, fileAccept: ee, maximumAttachmentsAmount: A, onAttachmentsLimitExceeded: te, onDialFileSystemClick: j, dialFileSystemLabel: ne, pendingAttachments: M, onPendingAttachmentsConsumed: N, onAttachmentClick: re, pasteTextThreshold: ie, maxMessageLength: P = 5e4, onMessageTooLong: F }) => {
|
|
2298
|
+
let ae = B(null), [se, ce] = V([]);
|
|
2299
|
+
R(() => {
|
|
2300
|
+
C?.length && (ce(C), T?.());
|
|
2302
2301
|
}, [C, T]);
|
|
2303
|
-
let [
|
|
2304
|
-
|
|
2305
|
-
},
|
|
2306
|
-
o(e,
|
|
2307
|
-
}, [
|
|
2308
|
-
if (
|
|
2309
|
-
if (
|
|
2310
|
-
|
|
2302
|
+
let [I, le] = V(e ?? ""), [ue, de] = V([]), [fe, pe] = V(r), me = ue.some((e) => e.status === i.Loading || e.status === i.Error), he = (I.trim().length > 0 || ue.length > 0 || fe.length > 0) && !me, ge = (e) => {
|
|
2303
|
+
pe((t) => t.filter((t) => t.id !== e));
|
|
2304
|
+
}, _e = L((e, t) => {
|
|
2305
|
+
o(e, fe, t);
|
|
2306
|
+
}, [fe, o]), H = () => {
|
|
2307
|
+
if (he) {
|
|
2308
|
+
if (I.length >= P) {
|
|
2309
|
+
F?.(I.length, P);
|
|
2311
2310
|
return;
|
|
2312
2311
|
}
|
|
2313
|
-
|
|
2312
|
+
_e(I, ue);
|
|
2314
2313
|
}
|
|
2315
|
-
},
|
|
2314
|
+
}, ve = L(() => ce([]), []), ye = L((e) => {
|
|
2316
2315
|
let t = Array.from(e.target.files ?? []);
|
|
2317
|
-
t.length !== 0 && (e.target.value = "",
|
|
2318
|
-
}, []),
|
|
2316
|
+
t.length !== 0 && (e.target.value = "", ce(t));
|
|
2317
|
+
}, []), be = z(() => j ? [{
|
|
2319
2318
|
key: "dial-fs",
|
|
2320
2319
|
label: ne ?? "DIAL file system",
|
|
2321
|
-
icon: /* @__PURE__ */
|
|
2320
|
+
icon: /* @__PURE__ */ W(oe, {
|
|
2322
2321
|
size: u,
|
|
2323
2322
|
"aria-hidden": !0,
|
|
2324
2323
|
stroke: m
|
|
2325
2324
|
}),
|
|
2326
2325
|
onClick: j
|
|
2327
2326
|
}] : [], [j, ne]);
|
|
2328
|
-
return /* @__PURE__ */
|
|
2327
|
+
return /* @__PURE__ */ G("div", {
|
|
2329
2328
|
className: c("flex w-full flex-col gap-2", S),
|
|
2330
|
-
children: [/* @__PURE__ */
|
|
2329
|
+
children: [/* @__PURE__ */ W(Vt, {
|
|
2331
2330
|
message: e,
|
|
2332
2331
|
inlineStartSlot: t,
|
|
2333
2332
|
onInlineStartRemove: n,
|
|
2334
2333
|
ariaLabel: f,
|
|
2335
2334
|
hideActionBar: !0,
|
|
2336
|
-
pendingDropFiles:
|
|
2337
|
-
onDropFilesConsumed:
|
|
2338
|
-
onSend:
|
|
2335
|
+
pendingDropFiles: se,
|
|
2336
|
+
onDropFilesConsumed: ve,
|
|
2337
|
+
onSend: _e,
|
|
2339
2338
|
onUploadAttachment: s,
|
|
2340
|
-
onChange:
|
|
2341
|
-
onAttachmentsChange:
|
|
2339
|
+
onChange: le,
|
|
2340
|
+
onAttachmentsChange: de,
|
|
2342
2341
|
removeLabel: p,
|
|
2343
2342
|
retryLabel: h,
|
|
2344
2343
|
uploadingLabel: g,
|
|
2345
2344
|
className: "max-w-full",
|
|
2346
|
-
prefixAttachments:
|
|
2347
|
-
onRemovePrefixAttachment:
|
|
2345
|
+
prefixAttachments: fe,
|
|
2346
|
+
onRemovePrefixAttachment: ge,
|
|
2348
2347
|
validateAttachment: E,
|
|
2349
2348
|
isAttachmentsEnabled: D,
|
|
2350
2349
|
isTextAttachmentsAllowed: O,
|
|
@@ -2354,42 +2353,42 @@ var Ft = {
|
|
|
2354
2353
|
onPendingAttachmentsConsumed: N,
|
|
2355
2354
|
onAttachmentClick: re,
|
|
2356
2355
|
pasteTextThreshold: ie,
|
|
2357
|
-
maxMessageLength:
|
|
2358
|
-
onMessageTooLong:
|
|
2359
|
-
}), /* @__PURE__ */
|
|
2356
|
+
maxMessageLength: P,
|
|
2357
|
+
onMessageTooLong: F
|
|
2358
|
+
}), /* @__PURE__ */ G("div", {
|
|
2360
2359
|
className: "flex items-center justify-between",
|
|
2361
|
-
children: [/* @__PURE__ */
|
|
2360
|
+
children: [/* @__PURE__ */ W("div", {
|
|
2362
2361
|
className: "flex",
|
|
2363
|
-
children: !k && /* @__PURE__ */
|
|
2364
|
-
ref:
|
|
2362
|
+
children: !k && /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("input", {
|
|
2363
|
+
ref: ae,
|
|
2365
2364
|
type: "file",
|
|
2366
2365
|
multiple: !0,
|
|
2367
2366
|
accept: ee,
|
|
2368
2367
|
className: "sr-only",
|
|
2369
2368
|
"aria-hidden": !0,
|
|
2370
2369
|
tabIndex: -1,
|
|
2371
|
-
onChange:
|
|
2372
|
-
}), /* @__PURE__ */
|
|
2373
|
-
onAttachClick: () =>
|
|
2370
|
+
onChange: ye
|
|
2371
|
+
}), /* @__PURE__ */ W(et, {
|
|
2372
|
+
onAttachClick: () => ae.current?.click(),
|
|
2374
2373
|
attachLabel: v,
|
|
2375
2374
|
addMenuTitle: _,
|
|
2376
2375
|
menuTitle: y,
|
|
2377
2376
|
menuCloseLabel: b,
|
|
2378
|
-
extraMenuItems:
|
|
2377
|
+
extraMenuItems: be
|
|
2379
2378
|
})] })
|
|
2380
|
-
}), /* @__PURE__ */
|
|
2379
|
+
}), /* @__PURE__ */ G("div", {
|
|
2381
2380
|
className: "flex gap-2",
|
|
2382
|
-
children: [/* @__PURE__ */
|
|
2381
|
+
children: [/* @__PURE__ */ W(x, {
|
|
2383
2382
|
label: l,
|
|
2384
2383
|
onClick: a
|
|
2385
|
-
}), /* @__PURE__ */
|
|
2384
|
+
}), /* @__PURE__ */ W(w, {
|
|
2386
2385
|
label: d,
|
|
2387
|
-
onClick:
|
|
2388
|
-
disabled: !
|
|
2386
|
+
onClick: H,
|
|
2387
|
+
disabled: !he
|
|
2389
2388
|
})]
|
|
2390
2389
|
})]
|
|
2391
2390
|
})]
|
|
2392
2391
|
});
|
|
2393
2392
|
};
|
|
2394
2393
|
//#endregion
|
|
2395
|
-
export {
|
|
2394
|
+
export { Te as BottomSheetShell, Xe as ChatSettingsModal, Ut as ConversationInput, Wt as EditMessageInput, Vt as Input, Ue as SendOnEnter };
|