@epam/ai-dial-conversation-input 1.2.0-dev.89 → 1.2.0-dev.93
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/ConversationInput/ConversationInput.d.ts.map +1 -1
- package/components/Input/Input.d.ts.map +1 -1
- package/components/Input/ModelSelectorControl.d.ts.map +1 -1
- package/constants/public-class-names.d.ts +8 -0
- package/constants/public-class-names.d.ts.map +1 -1
- package/index.js +381 -374
- package/models/ConversationInput.d.ts +19 -2
- package/models/ConversationInput.d.ts.map +1 -1
- package/models/Input.d.ts +18 -3
- package/models/Input.d.ts.map +1 -1
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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 re, Tooltip as M } from "@epam/ai-dial-ui-kit";
|
|
3
|
-
import { IconArrowLeft as ie, IconArrowNarrowRight as ae, IconCheck as N, IconChevronDown as P, IconChevronRight as oe, IconFile as se, IconMicrophone as ce, IconPaperclip as le, IconPlayerStopFilled as ue, IconPlaystationSquare as
|
|
3
|
+
import { IconArrowLeft as ie, IconArrowNarrowRight as ae, IconCheck as N, IconChevronDown as P, IconChevronRight as oe, IconFile as se, IconMicrophone as ce, IconPaperclip as le, IconPlayerStopFilled as ue, IconPlaystationSquare as de, IconPlus as F, IconSettings as fe, IconTool as pe, IconX as me } from "@tabler/icons-react";
|
|
4
4
|
import { createElement as he, memo as ge, useCallback as I, useEffect as L, useImperativeHandle as _e, useLayoutEffect as ve, useMemo as R, useRef as z, useState as B } from "react";
|
|
5
5
|
import { createPortal as ye } from "react-dom";
|
|
6
6
|
import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
|
|
7
|
-
import { AttachmentTray as be, MAX_UPLOADS_PER_MINUTE as xe, generateAttachmentId as
|
|
7
|
+
import { AttachmentTray as be, MAX_UPLOADS_PER_MINUTE as xe, generateAttachmentId as Se, useClipboardPaste as Ce } from "@epam/ai-dial-attachment-input";
|
|
8
8
|
//#region src/constants/public-class-names.ts
|
|
9
|
-
var
|
|
9
|
+
var W = {
|
|
10
10
|
wrapper: "dial-ci-wrapper",
|
|
11
11
|
actionRow: "dial-ci-action-row",
|
|
12
12
|
textareaWrap: "dial-ci-textarea-wrap",
|
|
@@ -14,11 +14,13 @@ var G = {
|
|
|
14
14
|
toolsChips: "dial-ci-tools-chips",
|
|
15
15
|
footerActions: "dial-ci-footer-actions",
|
|
16
16
|
modelSelectorButton: "dial-ci-model-selector-button",
|
|
17
|
+
modelSelectorIcon: "dial-ci-model-selector-icon",
|
|
18
|
+
modelSelectorCaret: "dial-ci-model-selector-caret",
|
|
17
19
|
modelMenu: "dial-ci-model-menu",
|
|
18
20
|
modelMenuSearch: "dial-ci-model-menu-search",
|
|
19
21
|
modelMenuItem: "dial-ci-model-menu-item",
|
|
20
22
|
modelMenuItemSelected: "dial-ci-model-menu-item-selected"
|
|
21
|
-
},
|
|
23
|
+
}, we = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", Te = (e, t, n) => {
|
|
22
24
|
L(() => {
|
|
23
25
|
if (!e) return;
|
|
24
26
|
let n = (e) => {
|
|
@@ -32,10 +34,10 @@ var G = {
|
|
|
32
34
|
}, [e]), L(() => {
|
|
33
35
|
if (!e || n?.current == null) return;
|
|
34
36
|
let t = n.current, r = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
35
|
-
(t.querySelector(
|
|
37
|
+
(t.querySelector(we) ?? t).focus();
|
|
36
38
|
let i = (e) => {
|
|
37
39
|
if (e.key !== "Tab") return;
|
|
38
|
-
let n = Array.from(t.querySelectorAll(
|
|
40
|
+
let n = Array.from(t.querySelectorAll(we));
|
|
39
41
|
if (n.length === 0) {
|
|
40
42
|
e.preventDefault(), t.focus();
|
|
41
43
|
return;
|
|
@@ -47,15 +49,15 @@ var G = {
|
|
|
47
49
|
document.removeEventListener("keydown", i), r?.focus();
|
|
48
50
|
};
|
|
49
51
|
}, [e, n]);
|
|
50
|
-
},
|
|
52
|
+
}, Ee = {
|
|
51
53
|
backdrop: "_backdrop_1d50f_9",
|
|
52
54
|
sheet: "_sheet_1d50f_13",
|
|
53
55
|
"slide-up": "_slide-up_1d50f_1",
|
|
54
56
|
title: "_title_1d50f_18",
|
|
55
57
|
divider: "_divider_1d50f_22"
|
|
56
|
-
},
|
|
58
|
+
}, G = ({ 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: _ }) => {
|
|
57
59
|
let y = z(null);
|
|
58
|
-
if (
|
|
60
|
+
if (Te(e, r, y), !e || typeof document > "u") return null;
|
|
59
61
|
let b = s({
|
|
60
62
|
"--ci-backdrop": h?.backdrop,
|
|
61
63
|
"--ci-sheet-bg": h?.sheetBg,
|
|
@@ -63,7 +65,7 @@ var G = {
|
|
|
63
65
|
"--ci-sheet-divider": h?.divider
|
|
64
66
|
});
|
|
65
67
|
return ye(/* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("div", {
|
|
66
|
-
className: c(
|
|
68
|
+
className: c(Ee.backdrop, "fixed inset-0 z-[55]"),
|
|
67
69
|
style: b,
|
|
68
70
|
onPointerDown: r,
|
|
69
71
|
"aria-hidden": !0
|
|
@@ -77,7 +79,7 @@ var G = {
|
|
|
77
79
|
...b,
|
|
78
80
|
...l
|
|
79
81
|
},
|
|
80
|
-
className: c(
|
|
82
|
+
className: c(Ee.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col rounded-t-lg", d),
|
|
81
83
|
children: [t != null && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ U("div", {
|
|
82
84
|
className: "relative flex h-[60px] flex-shrink-0 items-center justify-center px-4",
|
|
83
85
|
children: [
|
|
@@ -94,7 +96,7 @@ var G = {
|
|
|
94
96
|
})
|
|
95
97
|
}),
|
|
96
98
|
/* @__PURE__ */ H("span", {
|
|
97
|
-
className: c(
|
|
99
|
+
className: c(Ee.title, u),
|
|
98
100
|
children: t
|
|
99
101
|
}),
|
|
100
102
|
/* @__PURE__ */ H("div", {
|
|
@@ -106,16 +108,16 @@ var G = {
|
|
|
106
108
|
})
|
|
107
109
|
})
|
|
108
110
|
]
|
|
109
|
-
}), /* @__PURE__ */ H("div", { className: c(
|
|
111
|
+
}), /* @__PURE__ */ H("div", { className: c(Ee.divider, "h-px flex-shrink-0") })] }), /* @__PURE__ */ H("div", {
|
|
110
112
|
className: "overflow-y-auto",
|
|
111
113
|
children: _
|
|
112
114
|
})]
|
|
113
115
|
})] }), document.body);
|
|
114
|
-
},
|
|
116
|
+
}, De = async (e, t, n) => {
|
|
115
117
|
let r = 6e4 / t, i = [];
|
|
116
118
|
for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
|
|
117
119
|
await Promise.allSettled(i);
|
|
118
|
-
},
|
|
120
|
+
}, Oe = ({ initialAttachments: n, onUploadAttachment: r, onAttachmentsChange: a, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, pendingAttachments: l, onPendingAttachmentsConsumed: u, onExpandPastedText: d, maximumAttachmentsAmount: f, baseAttachmentsAmount: p = 0, onAttachmentsLimitExceeded: m }) => {
|
|
119
121
|
let [h, g] = B(n), _ = z(h);
|
|
120
122
|
L(() => {
|
|
121
123
|
_.current = h;
|
|
@@ -127,7 +129,7 @@ var G = {
|
|
|
127
129
|
let v = I((e) => e.map((e) => {
|
|
128
130
|
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;
|
|
129
131
|
return {
|
|
130
|
-
id:
|
|
132
|
+
id: Se(),
|
|
131
133
|
name: e.name,
|
|
132
134
|
contentType: e.type,
|
|
133
135
|
file: e,
|
|
@@ -199,7 +201,7 @@ var G = {
|
|
|
199
201
|
status: i.Error,
|
|
200
202
|
errorReason: n
|
|
201
203
|
} : e));
|
|
202
|
-
}),
|
|
204
|
+
}), De(e, xe, C);
|
|
203
205
|
}
|
|
204
206
|
}
|
|
205
207
|
}, [
|
|
@@ -278,14 +280,14 @@ var G = {
|
|
|
278
280
|
]),
|
|
279
281
|
hasBlockedAttachments: h.some((e) => e.status === i.Loading || e.status === i.Error)
|
|
280
282
|
};
|
|
281
|
-
},
|
|
283
|
+
}, ke = (e, t) => {
|
|
282
284
|
if (!e.startsWith(t)) return !1;
|
|
283
285
|
let n = e.slice(t.length);
|
|
284
286
|
return !/\s/.test(n) && !n.includes(t);
|
|
285
|
-
},
|
|
286
|
-
let [n, r] = B(!1), [i, a] = B(!1), o = e != null &&
|
|
287
|
+
}, Ae = ({ config: e, message: t }) => {
|
|
288
|
+
let [n, r] = B(!1), [i, a] = B(!1), o = e != null && ke(t, e.triggerPrefix) ? t.slice(e.triggerPrefix.length) : "", s = I((n, a, o) => {
|
|
287
289
|
if (e == null || a || t !== "" || i) return;
|
|
288
|
-
let s = n === e.triggerPrefix, c = o === "insertFromPaste" &&
|
|
290
|
+
let s = n === e.triggerPrefix, c = o === "insertFromPaste" && ke(n, e.triggerPrefix);
|
|
289
291
|
(s || c) && r(!0);
|
|
290
292
|
}, [
|
|
291
293
|
e,
|
|
@@ -297,7 +299,7 @@ var G = {
|
|
|
297
299
|
r(!1), a(!1);
|
|
298
300
|
return;
|
|
299
301
|
}
|
|
300
|
-
|
|
302
|
+
ke(t, e.triggerPrefix) || (r(!1), a(!1));
|
|
301
303
|
}, [e, t]), {
|
|
302
304
|
isMenuOpen: n,
|
|
303
305
|
query: o,
|
|
@@ -306,12 +308,12 @@ var G = {
|
|
|
306
308
|
}, []),
|
|
307
309
|
handleValueChange: s
|
|
308
310
|
};
|
|
309
|
-
},
|
|
311
|
+
}, je = (e, t) => !e.slice(0, t).includes("\n"), Me = (e, t) => !e.slice(t).includes("\n"), Ne = (e) => {
|
|
310
312
|
let t = z(e);
|
|
311
313
|
t.current = e;
|
|
312
314
|
let n = z(-1), r = z(""), i = I((e, i, a) => {
|
|
313
315
|
let o = t.current;
|
|
314
|
-
return !o || o.length === 0 ? null : e === "up" ? !
|
|
316
|
+
return !o || o.length === 0 ? null : e === "up" ? !je(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 || !Me(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
|
|
315
317
|
}, []), a = I(() => {
|
|
316
318
|
n.current = -1, r.current = "";
|
|
317
319
|
}, []), o = I(() => {
|
|
@@ -326,7 +328,7 @@ var G = {
|
|
|
326
328
|
a,
|
|
327
329
|
o
|
|
328
330
|
]);
|
|
329
|
-
},
|
|
331
|
+
}, Pe = ({ messageProp: e, messageRevision: t }) => {
|
|
330
332
|
let [n, r] = B(e), i = z(null);
|
|
331
333
|
return L(() => {
|
|
332
334
|
r(e);
|
|
@@ -335,10 +337,10 @@ var G = {
|
|
|
335
337
|
setMessage: r,
|
|
336
338
|
textareaRef: i
|
|
337
339
|
};
|
|
338
|
-
},
|
|
340
|
+
}, Fe = (e, t, n, r = n) => {
|
|
339
341
|
let i = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set;
|
|
340
342
|
i ? i.call(e, t) : e.value = t, e.setSelectionRange(n, r), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
341
|
-
},
|
|
343
|
+
}, Ie = (e) => e.key.toLowerCase() === "z" && (e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey, Le = ({ insertion: e, textareaRef: t }) => {
|
|
342
344
|
let n = e?.revision, r = z(e?.text);
|
|
343
345
|
r.current = e?.text;
|
|
344
346
|
let i = z(n), a = z(null);
|
|
@@ -352,7 +354,7 @@ var G = {
|
|
|
352
354
|
let { value: r, selectionStart: i, selectionEnd: o } = n, s = i ?? r.length, c = o ?? s;
|
|
353
355
|
if (n.focus(), a.current = null, typeof document.execCommand == "function" && document.execCommand("insertText", !1, e)) return;
|
|
354
356
|
let l = `${r.slice(0, s)}${e}${r.slice(c)}`;
|
|
355
|
-
|
|
357
|
+
Fe(n, l, s + e.length), a.current = {
|
|
356
358
|
insertedValue: l,
|
|
357
359
|
previousValue: r,
|
|
358
360
|
previousSelectionStart: s,
|
|
@@ -361,17 +363,17 @@ var G = {
|
|
|
361
363
|
});
|
|
362
364
|
}, [n, t]), { handleUndoKeyDown: (e) => {
|
|
363
365
|
let n = a.current, r = t.current;
|
|
364
|
-
return n == null || r == null || !
|
|
366
|
+
return n == null || r == null || !Ie(e) || (a.current = null, r.value !== n.insertedValue) ? !1 : (e.preventDefault(), Fe(r, n.previousValue, n.previousSelectionStart, n.previousSelectionEnd), !0);
|
|
365
367
|
} };
|
|
366
|
-
},
|
|
368
|
+
}, Re = /* @__PURE__ */ function(e) {
|
|
367
369
|
return e.Idle = "idle", e.Recording = "recording", e.Processing = "processing", e.Error = "error", e;
|
|
368
|
-
}({}),
|
|
370
|
+
}({}), ze = /* @__PURE__ */ function(e) {
|
|
369
371
|
return e.Dictation = "dictation", e.Attachment = "attachment", e;
|
|
370
|
-
}({}),
|
|
372
|
+
}({}), Be = [
|
|
371
373
|
"audio/webm;codecs=opus",
|
|
372
374
|
"audio/ogg;codecs=opus",
|
|
373
375
|
"audio/webm"
|
|
374
|
-
],
|
|
376
|
+
], Ve = 100, He = 100, Ue = .01, We = ({ onAttachAudio: e, onTranscribeAudio: t, onTranscript: n, errorLabel: r = "Voice input failed" }) => {
|
|
375
377
|
let [i, a] = B("idle"), [o, s] = B(null), c = z(null), l = z(null), u = z({
|
|
376
378
|
onAttachAudio: e,
|
|
377
379
|
onTranscribeAudio: t,
|
|
@@ -402,7 +404,7 @@ var G = {
|
|
|
402
404
|
n.aborted || (t.controller.abort(), l.current = null, s(e instanceof Error ? e.message : u.current.errorLabel), a("error"));
|
|
403
405
|
}, b = () => {
|
|
404
406
|
if (!i || n.aborted) return;
|
|
405
|
-
let e =
|
|
407
|
+
let e = Be.find((e) => MediaRecorder.isTypeSupported(e)), t = new MediaRecorder(i, e ? { mimeType: e } : void 0);
|
|
406
408
|
d = t;
|
|
407
409
|
let o = Date.now(), s = !1, l = !1, b = new Uint8Array(c.current?.fftSize ?? 256), x = async () => {
|
|
408
410
|
if (!(m || n.aborted)) {
|
|
@@ -410,7 +412,7 @@ var G = {
|
|
|
410
412
|
try {
|
|
411
413
|
let i = t.mimeType || e || "audio/webm", c = new Blob(h, { type: i });
|
|
412
414
|
h.length = 0, _();
|
|
413
|
-
let d = Date.now() - o >=
|
|
415
|
+
let d = Date.now() - o >= He;
|
|
414
416
|
if (c.size && (!r || d && (!s || l))) {
|
|
415
417
|
let e = i.split(";")[0].split("/")[1] ?? "webm", t = new File([c], "voice-" + crypto.randomUUID() + "." + e, { type: i });
|
|
416
418
|
if (r) {
|
|
@@ -436,8 +438,8 @@ var G = {
|
|
|
436
438
|
e.getByteTimeDomainData(b), s = !0;
|
|
437
439
|
let t = 0;
|
|
438
440
|
for (let e of b) t += ((e - 128) / 128) ** 2;
|
|
439
|
-
Math.sqrt(t / b.length) >=
|
|
440
|
-
},
|
|
441
|
+
Math.sqrt(t / b.length) >= Ue && (l = !0, g());
|
|
442
|
+
}, Ve));
|
|
441
443
|
};
|
|
442
444
|
t.stop = () => {
|
|
443
445
|
p || n.aborted || (p = !0, g(), a("processing"), d?.state === "recording" && d.stop());
|
|
@@ -468,14 +470,14 @@ var G = {
|
|
|
468
470
|
stopRecording: f,
|
|
469
471
|
discardRecording: p
|
|
470
472
|
};
|
|
471
|
-
},
|
|
473
|
+
}, Ge = /* @__PURE__ */ function(e) {
|
|
472
474
|
return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
|
|
473
|
-
}({}),
|
|
475
|
+
}({}), Ke = /* @__PURE__ */ function(e) {
|
|
474
476
|
return e.Stacked = "stacked", e.Inline = "inline", e;
|
|
475
|
-
}({}),
|
|
477
|
+
}({}), qe = {
|
|
476
478
|
item: "_item_1sr2n_1",
|
|
477
479
|
itemIcon: "_itemIcon_1sr2n_11"
|
|
478
|
-
},
|
|
480
|
+
}, Je = ({ 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 }) => {
|
|
479
481
|
let m = (e) => {
|
|
480
482
|
e(), r();
|
|
481
483
|
}, h = s({
|
|
@@ -484,7 +486,7 @@ var G = {
|
|
|
484
486
|
"--ci-sheet-item-active": p?.itemActiveBg,
|
|
485
487
|
"--ci-sheet-icon": p?.itemIcon
|
|
486
488
|
});
|
|
487
|
-
return /* @__PURE__ */ H(
|
|
489
|
+
return /* @__PURE__ */ H(G, {
|
|
488
490
|
isOpen: e,
|
|
489
491
|
title: t,
|
|
490
492
|
closeLabel: n,
|
|
@@ -499,9 +501,9 @@ var G = {
|
|
|
499
501
|
style: h,
|
|
500
502
|
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ H("li", { children: /* @__PURE__ */ H(d, {
|
|
501
503
|
type: "button",
|
|
502
|
-
className: c(
|
|
504
|
+
className: c(qe.item, "w-full gap-3 px-4 py-[10px] text-start"),
|
|
503
505
|
iconBefore: /* @__PURE__ */ H("span", {
|
|
504
|
-
className:
|
|
506
|
+
className: qe.itemIcon,
|
|
505
507
|
children: n
|
|
506
508
|
}),
|
|
507
509
|
iconAfter: r ? /* @__PURE__ */ H("span", {
|
|
@@ -517,7 +519,7 @@ var G = {
|
|
|
517
519
|
}) }, e))
|
|
518
520
|
})
|
|
519
521
|
});
|
|
520
|
-
},
|
|
522
|
+
}, Ye = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
521
523
|
let [s, c] = B(t), [l, u] = B(n), [d, f] = B(r), p = z(o);
|
|
522
524
|
L(() => {
|
|
523
525
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
@@ -550,12 +552,12 @@ var G = {
|
|
|
550
552
|
a
|
|
551
553
|
])
|
|
552
554
|
};
|
|
553
|
-
},
|
|
555
|
+
}, Xe = { label: "_label_14i7c_1" }, Ze = ({ 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 = [
|
|
554
556
|
"Precise",
|
|
555
557
|
"Neutral",
|
|
556
558
|
"Creative"
|
|
557
559
|
], temperatureHint: y, labelClassName: b = "!dial-small-semi-text", colors: x }) => {
|
|
558
|
-
let S = s({ "--csf-label-text": x?.labelText }), C = c(b,
|
|
560
|
+
let S = s({ "--csf-label-text": x?.labelText }), C = c(b, Xe.label, "gap-1");
|
|
559
561
|
return /* @__PURE__ */ U("div", {
|
|
560
562
|
className: "flex flex-col gap-4 px-6 pb-3",
|
|
561
563
|
style: S,
|
|
@@ -606,8 +608,8 @@ var G = {
|
|
|
606
608
|
})
|
|
607
609
|
]
|
|
608
610
|
});
|
|
609
|
-
},
|
|
610
|
-
let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat: k, setSystemPrompt: ee, setTemperature: A, handleSubmit: te } =
|
|
611
|
+
}, Qe = ({ 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 }) => {
|
|
612
|
+
let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat: k, setSystemPrompt: ee, setTemperature: A, handleSubmit: te } = Ye({
|
|
611
613
|
isOpen: e,
|
|
612
614
|
features: o,
|
|
613
615
|
initialResponseFormat: s,
|
|
@@ -616,7 +618,7 @@ var G = {
|
|
|
616
618
|
onSave: d,
|
|
617
619
|
onClose: r
|
|
618
620
|
});
|
|
619
|
-
return /* @__PURE__ */ U(
|
|
621
|
+
return /* @__PURE__ */ U(G, {
|
|
620
622
|
isOpen: e,
|
|
621
623
|
title: f,
|
|
622
624
|
closeLabel: i,
|
|
@@ -624,7 +626,7 @@ var G = {
|
|
|
624
626
|
onBack: t,
|
|
625
627
|
backLabel: n,
|
|
626
628
|
style: a,
|
|
627
|
-
children: [/* @__PURE__ */ H(
|
|
629
|
+
children: [/* @__PURE__ */ H(Ze, {
|
|
628
630
|
features: o,
|
|
629
631
|
responseFormat: T,
|
|
630
632
|
systemPrompt: E,
|
|
@@ -656,8 +658,8 @@ var G = {
|
|
|
656
658
|
})
|
|
657
659
|
})]
|
|
658
660
|
});
|
|
659
|
-
},
|
|
660
|
-
let { responseFormat: b, systemPrompt: x, temperature: T, canSubmit: E, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit: ee } =
|
|
661
|
+
}, $e = { modal: "_modal_kl0h0_1" }, et = ({ 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 = $e.modal }) => {
|
|
662
|
+
let { responseFormat: b, systemPrompt: x, temperature: T, canSubmit: E, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit: ee } = Ye({
|
|
661
663
|
features: e,
|
|
662
664
|
initialResponseFormat: t,
|
|
663
665
|
initialSystemPrompt: n,
|
|
@@ -684,7 +686,7 @@ var G = {
|
|
|
684
686
|
})
|
|
685
687
|
})
|
|
686
688
|
}),
|
|
687
|
-
children: /* @__PURE__ */ H(
|
|
689
|
+
children: /* @__PURE__ */ H(Ze, {
|
|
688
690
|
features: e,
|
|
689
691
|
responseFormat: b,
|
|
690
692
|
systemPrompt: x,
|
|
@@ -703,10 +705,10 @@ var G = {
|
|
|
703
705
|
temperatureHint: g
|
|
704
706
|
})
|
|
705
707
|
});
|
|
706
|
-
},
|
|
708
|
+
}, K = {
|
|
707
709
|
icon: "_icon_1fv6z_1",
|
|
708
710
|
selectedIcon: "_selectedIcon_1fv6z_5"
|
|
709
|
-
},
|
|
711
|
+
}, tt = ({ 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__ */ H(G, {
|
|
710
712
|
isOpen: e,
|
|
711
713
|
title: o,
|
|
712
714
|
closeLabel: i,
|
|
@@ -729,11 +731,11 @@ var G = {
|
|
|
729
731
|
"aria-checked": e.isSelected,
|
|
730
732
|
className: "w-full gap-3 px-4 py-[10px] text-start",
|
|
731
733
|
iconBefore: /* @__PURE__ */ H("span", {
|
|
732
|
-
className: c("flex items-center",
|
|
734
|
+
className: c("flex items-center", K.icon),
|
|
733
735
|
children: e.icon
|
|
734
736
|
}),
|
|
735
737
|
iconAfter: e.isSelected ? /* @__PURE__ */ H("span", {
|
|
736
|
-
className: c("ms-auto",
|
|
738
|
+
className: c("ms-auto", K.selectedIcon),
|
|
737
739
|
children: /* @__PURE__ */ H(N, {
|
|
738
740
|
size: u,
|
|
739
741
|
"aria-hidden": !0,
|
|
@@ -748,19 +750,19 @@ var G = {
|
|
|
748
750
|
})
|
|
749
751
|
}, e.id))
|
|
750
752
|
})
|
|
751
|
-
}),
|
|
753
|
+
}), nt = {
|
|
752
754
|
toolIcon: "_toolIcon_ma5s5_1",
|
|
753
755
|
chevronIcon: "_chevronIcon_ma5s5_5"
|
|
754
|
-
},
|
|
756
|
+
}, rt = ({ 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 }) => {
|
|
755
757
|
let k = l(), [ee, A] = B(!1), [te, j] = B(!1), [ne, re] = B(!1), [M, ie] = B(null), [ae, N] = B(!1), P = R(() => s({
|
|
756
758
|
"--aab-tool-icon": O?.toolIcon,
|
|
757
759
|
"--aab-chevron-icon": O?.chevronIcon
|
|
758
|
-
}), [O?.toolIcon, O?.chevronIcon]), se = C.length > 0 && w != null, ue = D != null && D.length > 0,
|
|
760
|
+
}), [O?.toolIcon, O?.chevronIcon]), se = C.length > 0 && w != null, ue = D != null && D.length > 0, de = R(() => C.map((e) => ({
|
|
759
761
|
key: e.id,
|
|
760
762
|
label: e.label,
|
|
761
763
|
icon: /* @__PURE__ */ H("span", {
|
|
762
764
|
style: P,
|
|
763
|
-
className: c("flex items-center",
|
|
765
|
+
className: c("flex items-center", nt.toolIcon),
|
|
764
766
|
children: e.icon
|
|
765
767
|
}),
|
|
766
768
|
selectable: !0,
|
|
@@ -798,9 +800,9 @@ var G = {
|
|
|
798
800
|
size: u,
|
|
799
801
|
stroke: m,
|
|
800
802
|
style: P,
|
|
801
|
-
className: c("rtl:scale-x-[-1]",
|
|
803
|
+
className: c("rtl:scale-x-[-1]", nt.chevronIcon),
|
|
802
804
|
"aria-hidden": !0
|
|
803
|
-
}) } : { children:
|
|
805
|
+
}) } : { children: de }
|
|
804
806
|
}] : [],
|
|
805
807
|
...(D ?? []).map((e) => ({
|
|
806
808
|
key: e.key,
|
|
@@ -813,7 +815,7 @@ var G = {
|
|
|
813
815
|
size: u,
|
|
814
816
|
stroke: m,
|
|
815
817
|
style: P,
|
|
816
|
-
className: c("rtl:scale-x-[-1]",
|
|
818
|
+
className: c("rtl:scale-x-[-1]", nt.chevronIcon),
|
|
817
819
|
"aria-hidden": !0
|
|
818
820
|
}) } : {
|
|
819
821
|
children: [{
|
|
@@ -847,7 +849,7 @@ var G = {
|
|
|
847
849
|
size: u,
|
|
848
850
|
stroke: m,
|
|
849
851
|
style: P,
|
|
850
|
-
className: c("rtl:scale-x-[-1]",
|
|
852
|
+
className: c("rtl:scale-x-[-1]", nt.chevronIcon),
|
|
851
853
|
"aria-hidden": !0
|
|
852
854
|
}) : null,
|
|
853
855
|
onClick: () => j(!0)
|
|
@@ -862,7 +864,7 @@ var G = {
|
|
|
862
864
|
k,
|
|
863
865
|
se,
|
|
864
866
|
T,
|
|
865
|
-
|
|
867
|
+
de,
|
|
866
868
|
D,
|
|
867
869
|
P
|
|
868
870
|
]);
|
|
@@ -875,7 +877,7 @@ var G = {
|
|
|
875
877
|
open: ue ? ae : void 0,
|
|
876
878
|
onOpenChange: ue ? N : void 0,
|
|
877
879
|
children: /* @__PURE__ */ H(v, {
|
|
878
|
-
icon: /* @__PURE__ */ H(
|
|
880
|
+
icon: /* @__PURE__ */ H(F, {
|
|
879
881
|
size: p.LG,
|
|
880
882
|
"aria-hidden": !0,
|
|
881
883
|
stroke: m
|
|
@@ -887,7 +889,7 @@ var G = {
|
|
|
887
889
|
});
|
|
888
890
|
return /* @__PURE__ */ H(V, { children: k ? /* @__PURE__ */ U(V, { children: [
|
|
889
891
|
/* @__PURE__ */ H(v, {
|
|
890
|
-
icon: /* @__PURE__ */ H(
|
|
892
|
+
icon: /* @__PURE__ */ H(F, {
|
|
891
893
|
size: p.LG,
|
|
892
894
|
"aria-hidden": !0,
|
|
893
895
|
stroke: m
|
|
@@ -898,7 +900,7 @@ var G = {
|
|
|
898
900
|
disabled: y,
|
|
899
901
|
onClick: () => A(!0)
|
|
900
902
|
}),
|
|
901
|
-
/* @__PURE__ */ H(
|
|
903
|
+
/* @__PURE__ */ H(Je, {
|
|
902
904
|
isOpen: ee,
|
|
903
905
|
title: o,
|
|
904
906
|
closeLabel: d,
|
|
@@ -908,7 +910,7 @@ var G = {
|
|
|
908
910
|
className: "pb-4",
|
|
909
911
|
btnTextClassName: "flex-1"
|
|
910
912
|
}),
|
|
911
|
-
se && /* @__PURE__ */ H(
|
|
913
|
+
se && /* @__PURE__ */ H(tt, {
|
|
912
914
|
isOpen: ne,
|
|
913
915
|
onBack: () => {
|
|
914
916
|
re(!1), A(!0);
|
|
@@ -921,7 +923,7 @@ var G = {
|
|
|
921
923
|
items: C,
|
|
922
924
|
onToolToggle: w
|
|
923
925
|
}),
|
|
924
|
-
D?.map((e) => /* @__PURE__ */ H(
|
|
926
|
+
D?.map((e) => /* @__PURE__ */ H(G, {
|
|
925
927
|
isOpen: M === e.key,
|
|
926
928
|
title: e.title,
|
|
927
929
|
closeLabel: d,
|
|
@@ -933,7 +935,7 @@ var G = {
|
|
|
933
935
|
style: f,
|
|
934
936
|
children: e.renderOverlay(() => ie(null))
|
|
935
937
|
}, e.key)),
|
|
936
|
-
x != null && /* @__PURE__ */ H(
|
|
938
|
+
x != null && /* @__PURE__ */ H(Qe, {
|
|
937
939
|
isOpen: te,
|
|
938
940
|
onBack: () => {
|
|
939
941
|
j(!1), A(!0);
|
|
@@ -960,7 +962,7 @@ var G = {
|
|
|
960
962
|
saveLabel: x.saveLabel,
|
|
961
963
|
saveDisabledTooltip: x.saveDisabledTooltip
|
|
962
964
|
})
|
|
963
|
-
] }) : /* @__PURE__ */ U(V, { children: [he, x != null && te && /* @__PURE__ */ H(
|
|
965
|
+
] }) : /* @__PURE__ */ U(V, { children: [he, x != null && te && /* @__PURE__ */ H(et, {
|
|
964
966
|
features: x.features,
|
|
965
967
|
initialResponseFormat: x.responseFormat ?? a.Markdown,
|
|
966
968
|
initialSystemPrompt: x.systemPrompt,
|
|
@@ -980,13 +982,13 @@ var G = {
|
|
|
980
982
|
saveLabel: x.saveLabel,
|
|
981
983
|
saveDisabledTooltip: x.saveDisabledTooltip
|
|
982
984
|
})] }) });
|
|
983
|
-
},
|
|
985
|
+
}, it = {
|
|
984
986
|
chip: "_chip_ydmd8_1",
|
|
985
987
|
chipSelected: "_chipSelected_ydmd8_9",
|
|
986
988
|
chipIcon: "_chipIcon_ydmd8_16",
|
|
987
989
|
chipText: "_chipText_ydmd8_19",
|
|
988
990
|
chipClose: "_chipClose_ydmd8_22"
|
|
989
|
-
},
|
|
991
|
+
}, at = (e) => `Remove ${e}`, ot = ({ items: e, onToolToggle: t, onToolDismiss: n, canRemove: r = !0, removeLabel: i = at, typography: a, colors: o }) => e.length === 0 ? null : /* @__PURE__ */ H("div", {
|
|
990
992
|
className: "flex flex-wrap items-center gap-2",
|
|
991
993
|
style: s({
|
|
992
994
|
"--ci-chip-bg": o?.chipBg,
|
|
@@ -1002,25 +1004,25 @@ var G = {
|
|
|
1002
1004
|
"--ci-chip-close-hover": o?.chipCloseHover
|
|
1003
1005
|
}),
|
|
1004
1006
|
children: e.map((e) => /* @__PURE__ */ U("div", {
|
|
1005
|
-
className: c(
|
|
1007
|
+
className: c(it.chip, e.isSelected && it.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 transition-colors", r ? "pe-1 ps-2" : "px-2"),
|
|
1006
1008
|
children: [/* @__PURE__ */ U("button", {
|
|
1007
1009
|
type: "button",
|
|
1008
1010
|
onClick: () => t(e.id),
|
|
1009
1011
|
"aria-pressed": e.isSelected,
|
|
1010
1012
|
className: "flex min-w-0 items-center gap-1.5",
|
|
1011
1013
|
children: [/* @__PURE__ */ H("span", {
|
|
1012
|
-
className: c(
|
|
1014
|
+
className: c(it.chipIcon, "shrink-0"),
|
|
1013
1015
|
"aria-hidden": !0,
|
|
1014
1016
|
children: e.icon
|
|
1015
1017
|
}), /* @__PURE__ */ H("span", {
|
|
1016
|
-
className: c(
|
|
1018
|
+
className: c(it.chipText, a?.fontClassName || "dial-small-paragraph-text", "truncate"),
|
|
1017
1019
|
children: e.label
|
|
1018
1020
|
})]
|
|
1019
1021
|
}), r && /* @__PURE__ */ H("button", {
|
|
1020
1022
|
type: "button",
|
|
1021
1023
|
onClick: () => n(e.id),
|
|
1022
1024
|
"aria-label": i(e.label),
|
|
1023
|
-
className: c(
|
|
1025
|
+
className: c(it.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
|
|
1024
1026
|
children: /* @__PURE__ */ H(me, {
|
|
1025
1027
|
size: 12,
|
|
1026
1028
|
"aria-hidden": !0,
|
|
@@ -1028,7 +1030,7 @@ var G = {
|
|
|
1028
1030
|
})
|
|
1029
1031
|
})]
|
|
1030
1032
|
}, e.id))
|
|
1031
|
-
}),
|
|
1033
|
+
}), q = {
|
|
1032
1034
|
wrapper: "_wrapper_q1jcl_2",
|
|
1033
1035
|
wrapperDisabled: "_wrapperDisabled_q1jcl_9",
|
|
1034
1036
|
textarea: "_textarea_q1jcl_13",
|
|
@@ -1039,23 +1041,23 @@ var G = {
|
|
|
1039
1041
|
modelSelectorName: "_modelSelectorName_q1jcl_50",
|
|
1040
1042
|
modelSelectorVersion: "_modelSelectorVersion_q1jcl_53",
|
|
1041
1043
|
modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_q1jcl_62"
|
|
1042
|
-
},
|
|
1044
|
+
}, st = {
|
|
1043
1045
|
wrapperError: "_wrapperError_129ri_1",
|
|
1044
1046
|
waveformCanvas: "_waveformCanvas_129ri_5",
|
|
1045
1047
|
recordingDot: "_recordingDot_129ri_19",
|
|
1046
1048
|
"recording-pulse": "_recording-pulse_129ri_1"
|
|
1047
|
-
},
|
|
1048
|
-
let h = z(null), g = z(new Float32Array(
|
|
1049
|
+
}, ct = 3, lt = 4, ut = 200, dt = ({ 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 }) => {
|
|
1050
|
+
let h = z(null), g = z(new Float32Array(ut)), y = z(0), b = z(0), x = e === Re.Recording, S = e === Re.Error, C = e === Re.Processing, w = I((e) => {
|
|
1049
1051
|
let t = e.getContext("2d");
|
|
1050
1052
|
if (!t) return;
|
|
1051
1053
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
1052
1054
|
let { width: n, height: r } = e;
|
|
1053
1055
|
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
1054
|
-
let i = Math.min(Math.max(1, Math.floor(n /
|
|
1056
|
+
let i = Math.min(Math.max(1, Math.floor(n / lt)), ut - 1), a = y.current, o = b.current;
|
|
1055
1057
|
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
1056
1058
|
for (let e = 0; e <= i; e++) {
|
|
1057
|
-
let n = ((a - i + e) %
|
|
1058
|
-
t.fillRect(e *
|
|
1059
|
+
let n = ((a - i + e) % ut + ut) % ut, o = g.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
1060
|
+
t.fillRect(e * lt, (r - c) / 2, ct, c);
|
|
1059
1061
|
}
|
|
1060
1062
|
t.restore();
|
|
1061
1063
|
}, []);
|
|
@@ -1065,8 +1067,8 @@ var G = {
|
|
|
1065
1067
|
if (!e) return;
|
|
1066
1068
|
g.current.fill(0), y.current = 0, b.current = 0;
|
|
1067
1069
|
let n, r = () => {
|
|
1068
|
-
if (b.current += 1, b.current >=
|
|
1069
|
-
b.current -=
|
|
1070
|
+
if (b.current += 1, b.current >= lt) {
|
|
1071
|
+
b.current -= lt;
|
|
1070
1072
|
let e = t.current;
|
|
1071
1073
|
if (e) {
|
|
1072
1074
|
let t = new Uint8Array(e.frequencyBinCount);
|
|
@@ -1076,7 +1078,7 @@ var G = {
|
|
|
1076
1078
|
let r = (t[e] - 128) / 128;
|
|
1077
1079
|
n += r * r;
|
|
1078
1080
|
}
|
|
1079
|
-
g.current[y.current %
|
|
1081
|
+
g.current[y.current % ut] = Math.sqrt(n / t.length), y.current++;
|
|
1080
1082
|
}
|
|
1081
1083
|
}
|
|
1082
1084
|
w(e), n = requestAnimationFrame(r);
|
|
@@ -1132,17 +1134,17 @@ var G = {
|
|
|
1132
1134
|
className: d,
|
|
1133
1135
|
children: [/* @__PURE__ */ U("div", {
|
|
1134
1136
|
style: u,
|
|
1135
|
-
className: c("flex w-full min-w-0 flex-col justify-center gap-2", !f &&
|
|
1137
|
+
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 && st.wrapperError),
|
|
1136
1138
|
children: [/* @__PURE__ */ U("div", {
|
|
1137
1139
|
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
1138
1140
|
children: [x && /* @__PURE__ */ H("span", {
|
|
1139
|
-
className: c(
|
|
1141
|
+
className: c(st.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
|
|
1140
1142
|
"aria-hidden": !0
|
|
1141
1143
|
}), /* @__PURE__ */ H("canvas", {
|
|
1142
1144
|
ref: h,
|
|
1143
1145
|
height: 26,
|
|
1144
1146
|
"aria-hidden": !0,
|
|
1145
|
-
className: c(
|
|
1147
|
+
className: c(st.waveformCanvas, "h-[26px] min-w-0 flex-1")
|
|
1146
1148
|
})]
|
|
1147
1149
|
}), /* @__PURE__ */ U("div", {
|
|
1148
1150
|
className: "flex items-center justify-between gap-2",
|
|
@@ -1156,7 +1158,7 @@ var G = {
|
|
|
1156
1158
|
})
|
|
1157
1159
|
})]
|
|
1158
1160
|
});
|
|
1159
|
-
},
|
|
1161
|
+
}, ft = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", sendTooltip: r }) => /* @__PURE__ */ H(T, {
|
|
1160
1162
|
"aria-label": n,
|
|
1161
1163
|
onClick: () => e?.(),
|
|
1162
1164
|
disabled: t,
|
|
@@ -1166,19 +1168,19 @@ var G = {
|
|
|
1166
1168
|
className: "rtl:scale-x-[-1]",
|
|
1167
1169
|
stroke: m
|
|
1168
1170
|
})
|
|
1169
|
-
}),
|
|
1170
|
-
icon: /* @__PURE__ */ H(
|
|
1171
|
+
}), pt = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ H(j, {
|
|
1172
|
+
icon: /* @__PURE__ */ H(de, {
|
|
1171
1173
|
size: p.LG,
|
|
1172
1174
|
stroke: m
|
|
1173
1175
|
}),
|
|
1174
1176
|
onClick: () => e?.(),
|
|
1175
1177
|
"aria-label": t
|
|
1176
|
-
}),
|
|
1178
|
+
}), mt = ({ size: e = 20 }) => /* @__PURE__ */ H(k, {
|
|
1177
1179
|
variant: ee.Circular,
|
|
1178
1180
|
width: e,
|
|
1179
1181
|
height: e,
|
|
1180
1182
|
active: !0
|
|
1181
|
-
}),
|
|
1183
|
+
}), ht = ({ loadingLabel: e }) => /* @__PURE__ */ U("span", {
|
|
1182
1184
|
className: "flex min-w-0 flex-1 items-center",
|
|
1183
1185
|
children: [/* @__PURE__ */ H(k, {
|
|
1184
1186
|
variant: ee.Text,
|
|
@@ -1189,24 +1191,24 @@ var G = {
|
|
|
1189
1191
|
className: "sr-only",
|
|
1190
1192
|
children: e
|
|
1191
1193
|
})]
|
|
1192
|
-
}),
|
|
1194
|
+
}), gt = ({ loadingLabel: e }) => /* @__PURE__ */ H("div", {
|
|
1193
1195
|
role: "status",
|
|
1194
1196
|
"aria-label": e,
|
|
1195
1197
|
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ U("div", {
|
|
1196
1198
|
className: "flex h-11 items-center gap-3 px-4",
|
|
1197
1199
|
"aria-hidden": "true",
|
|
1198
|
-
children: [/* @__PURE__ */ H(
|
|
1200
|
+
children: [/* @__PURE__ */ H(mt, {}), /* @__PURE__ */ H(ht, {})]
|
|
1199
1201
|
}, t))
|
|
1200
|
-
}),
|
|
1202
|
+
}), _t = (e) => e.displayName ?? e.id, vt = (e, t) => {
|
|
1201
1203
|
let n = t.trim().toLowerCase();
|
|
1202
|
-
return n ? e.filter((e) =>
|
|
1203
|
-
},
|
|
1204
|
+
return n ? e.filter((e) => _t(e).toLowerCase().includes(n)) : e;
|
|
1205
|
+
}, yt = (e, t, r, i = 18, a) => /* @__PURE__ */ H(n, {
|
|
1204
1206
|
src: e,
|
|
1205
1207
|
size: i,
|
|
1206
1208
|
labels: { tooltip: a },
|
|
1207
1209
|
initialsName: r
|
|
1208
|
-
}),
|
|
1209
|
-
let [o, l] = B(""), u = R(() => e?.find((e) => e.id === t), [e, t]), d = r?.loading !== void 0, f = !d && !u && !!t, m = R(() => d ? /* @__PURE__ */ H(
|
|
1210
|
+
}), bt = { searchHeader: "_searchHeader_1728o_1" }, xt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, searchHeaderClassName: i = bt.searchHeader, colors: a }) => {
|
|
1211
|
+
let [o, l] = B(""), u = R(() => e?.find((e) => e.id === t), [e, t]), d = r?.loading !== void 0, f = !d && !u && !!t, m = R(() => d ? /* @__PURE__ */ H(mt, { size: p.LG }) : yt(u?.iconUrl, u?.type, u?.displayName ?? u?.id ?? "", p.LG, f ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
|
|
1210
1212
|
d,
|
|
1211
1213
|
u,
|
|
1212
1214
|
f,
|
|
@@ -1220,8 +1222,8 @@ var G = {
|
|
|
1220
1222
|
menuItems: R(() => {
|
|
1221
1223
|
if (d) return Array.from({ length: 7 }, (e, t) => ({
|
|
1222
1224
|
key: `__loading-${t}`,
|
|
1223
|
-
icon: /* @__PURE__ */ H(
|
|
1224
|
-
label: /* @__PURE__ */ H(
|
|
1225
|
+
icon: /* @__PURE__ */ H(mt, {}),
|
|
1226
|
+
label: /* @__PURE__ */ H(ht, { loadingLabel: t === 0 ? r?.loading : void 0 }),
|
|
1225
1227
|
disabled: !0
|
|
1226
1228
|
}));
|
|
1227
1229
|
if (!e || e.length === 0) {
|
|
@@ -1232,17 +1234,17 @@ var G = {
|
|
|
1232
1234
|
disabled: !0
|
|
1233
1235
|
}] : [];
|
|
1234
1236
|
}
|
|
1235
|
-
return
|
|
1237
|
+
return vt(e, o).map((e) => ({
|
|
1236
1238
|
key: e.id,
|
|
1237
1239
|
label: /* @__PURE__ */ H(y, {
|
|
1238
|
-
text:
|
|
1240
|
+
text: _t(e),
|
|
1239
1241
|
query: o,
|
|
1240
1242
|
maxLines: 1
|
|
1241
1243
|
}),
|
|
1242
|
-
icon:
|
|
1244
|
+
icon: yt(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
1243
1245
|
mark: b.Check,
|
|
1244
1246
|
checked: e.id === t,
|
|
1245
|
-
className: c(
|
|
1247
|
+
className: c(W.modelMenuItem, e.id === t && W.modelMenuItemSelected),
|
|
1246
1248
|
onClick: () => n?.(e.id)
|
|
1247
1249
|
}));
|
|
1248
1250
|
}, [
|
|
@@ -1255,7 +1257,7 @@ var G = {
|
|
|
1255
1257
|
]),
|
|
1256
1258
|
menuHeader: R(() => !d && e && e.length > 0 ? /* @__PURE__ */ H("div", {
|
|
1257
1259
|
style: s({ "--ms-search-header-bg": a?.searchHeaderBackground }),
|
|
1258
|
-
className: c("sticky top-0 z-10 pb-1 pe-2 pt-2", i,
|
|
1260
|
+
className: c("sticky top-0 z-10 pb-1 pe-2 pt-2", i, W.modelMenuSearch),
|
|
1259
1261
|
children: /* @__PURE__ */ H(O, {
|
|
1260
1262
|
value: o,
|
|
1261
1263
|
placeholder: r?.searchPlaceholder ?? "Search",
|
|
@@ -1275,8 +1277,8 @@ var G = {
|
|
|
1275
1277
|
e || l("");
|
|
1276
1278
|
}
|
|
1277
1279
|
};
|
|
1278
|
-
},
|
|
1279
|
-
function
|
|
1280
|
+
}, J = typeof window < "u" ? ve : L;
|
|
1281
|
+
function Y(e) {
|
|
1280
1282
|
if (e !== void 0) switch (typeof e) {
|
|
1281
1283
|
case "number": return e;
|
|
1282
1284
|
case "string":
|
|
@@ -1286,13 +1288,13 @@ function xt(e) {
|
|
|
1286
1288
|
}
|
|
1287
1289
|
function St({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
1288
1290
|
let { styleHeight: s, styleWidth: c } = R(() => ({
|
|
1289
|
-
styleHeight:
|
|
1290
|
-
styleWidth:
|
|
1291
|
+
styleHeight: Y(o?.height),
|
|
1292
|
+
styleWidth: Y(o?.width)
|
|
1291
1293
|
}), [o?.height, o?.width]), [l, u] = B({
|
|
1292
1294
|
height: t,
|
|
1293
1295
|
width: n
|
|
1294
1296
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
1295
|
-
return
|
|
1297
|
+
return J(() => {
|
|
1296
1298
|
if (i === null || d) return;
|
|
1297
1299
|
let t = new ResizeObserver((e) => {
|
|
1298
1300
|
for (let t of e) {
|
|
@@ -1325,7 +1327,7 @@ function Ct(e) {
|
|
|
1325
1327
|
let t = z(() => {
|
|
1326
1328
|
throw Error("Cannot call during render.");
|
|
1327
1329
|
});
|
|
1328
|
-
return
|
|
1330
|
+
return J(() => {
|
|
1329
1331
|
t.current = e;
|
|
1330
1332
|
}, [e]), I((e) => t.current?.(e), [t]);
|
|
1331
1333
|
}
|
|
@@ -1339,7 +1341,7 @@ function Tt(e = !1) {
|
|
|
1339
1341
|
}
|
|
1340
1342
|
return wt;
|
|
1341
1343
|
}
|
|
1342
|
-
function
|
|
1344
|
+
function Et({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1343
1345
|
if (t === "horizontal" && n) switch (Tt()) {
|
|
1344
1346
|
case "negative": return -r;
|
|
1345
1347
|
case "positive-descending":
|
|
@@ -1351,26 +1353,26 @@ function X({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
|
1351
1353
|
}
|
|
1352
1354
|
return r;
|
|
1353
1355
|
}
|
|
1354
|
-
function
|
|
1356
|
+
function X(e, t = "Assertion error") {
|
|
1355
1357
|
if (!e) throw console.error(t), Error(t);
|
|
1356
1358
|
}
|
|
1357
|
-
function
|
|
1359
|
+
function Z(e, t) {
|
|
1358
1360
|
if (e === t) return !0;
|
|
1359
|
-
if (!!e != !!t || (
|
|
1361
|
+
if (!!e != !!t || (X(e !== void 0), X(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1360
1362
|
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
1361
1363
|
return !0;
|
|
1362
1364
|
}
|
|
1363
|
-
function
|
|
1365
|
+
function Q({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
1364
1366
|
if (t === 0) return 0;
|
|
1365
1367
|
if (typeof n == "number") return t * n;
|
|
1366
1368
|
{
|
|
1367
1369
|
let n = e.get(e.size === 0 ? 0 : e.size - 1);
|
|
1368
|
-
return
|
|
1370
|
+
return X(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
|
|
1369
1371
|
}
|
|
1370
1372
|
}
|
|
1371
1373
|
function Dt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
|
|
1372
1374
|
if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
|
|
1373
|
-
let s =
|
|
1375
|
+
let s = Q({
|
|
1374
1376
|
cachedBounds: t,
|
|
1375
1377
|
itemCount: r,
|
|
1376
1378
|
itemSize: i
|
|
@@ -1405,7 +1407,7 @@ function kt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1405
1407
|
let r = /* @__PURE__ */ new Map();
|
|
1406
1408
|
return {
|
|
1407
1409
|
get(i) {
|
|
1408
|
-
for (
|
|
1410
|
+
for (X(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
|
|
1409
1411
|
let e = r.size, a;
|
|
1410
1412
|
switch (typeof n) {
|
|
1411
1413
|
case "function":
|
|
@@ -1421,14 +1423,14 @@ function kt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1421
1423
|
});
|
|
1422
1424
|
else {
|
|
1423
1425
|
let t = r.get(e - 1);
|
|
1424
|
-
|
|
1426
|
+
X(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
|
|
1425
1427
|
scrollOffset: t.scrollOffset + t.size,
|
|
1426
1428
|
size: a
|
|
1427
1429
|
});
|
|
1428
1430
|
}
|
|
1429
1431
|
}
|
|
1430
1432
|
let a = r.get(i);
|
|
1431
|
-
return
|
|
1433
|
+
return X(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
|
|
1432
1434
|
},
|
|
1433
1435
|
set(e, t) {
|
|
1434
1436
|
r.set(e, t);
|
|
@@ -1453,7 +1455,7 @@ function jt({ containerSize: e, itemSize: t }) {
|
|
|
1453
1455
|
let n;
|
|
1454
1456
|
switch (typeof t) {
|
|
1455
1457
|
case "string":
|
|
1456
|
-
|
|
1458
|
+
X(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), X(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
|
|
1457
1459
|
break;
|
|
1458
1460
|
default:
|
|
1459
1461
|
n = t;
|
|
@@ -1503,7 +1505,7 @@ function Mt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1503
1505
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1504
1506
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1505
1507
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1506
|
-
}, C = I(() =>
|
|
1508
|
+
}, C = I(() => Q({
|
|
1507
1509
|
cachedBounds: h,
|
|
1508
1510
|
itemCount: a,
|
|
1509
1511
|
itemSize: m
|
|
@@ -1513,7 +1515,7 @@ function Mt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1513
1515
|
m
|
|
1514
1516
|
]), w = I((t) => Ot({
|
|
1515
1517
|
cachedBounds: h,
|
|
1516
|
-
containerScrollOffset:
|
|
1518
|
+
containerScrollOffset: Et({
|
|
1517
1519
|
containerElement: e,
|
|
1518
1520
|
direction: r,
|
|
1519
1521
|
isRtl: i,
|
|
@@ -1531,19 +1533,19 @@ function Mt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1531
1533
|
a,
|
|
1532
1534
|
l
|
|
1533
1535
|
]);
|
|
1534
|
-
return
|
|
1536
|
+
return J(() => {
|
|
1535
1537
|
v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
|
|
1536
1538
|
}, [
|
|
1537
1539
|
e,
|
|
1538
1540
|
r,
|
|
1539
1541
|
w
|
|
1540
|
-
]),
|
|
1542
|
+
]), J(() => {
|
|
1541
1543
|
if (!e) return;
|
|
1542
1544
|
let t = () => {
|
|
1543
1545
|
v((t) => {
|
|
1544
1546
|
let { scrollLeft: n, scrollTop: o } = e, s = Ot({
|
|
1545
1547
|
cachedBounds: h,
|
|
1546
|
-
containerScrollOffset:
|
|
1548
|
+
containerScrollOffset: Et({
|
|
1547
1549
|
containerElement: e,
|
|
1548
1550
|
direction: r,
|
|
1549
1551
|
isRtl: i,
|
|
@@ -1553,7 +1555,7 @@ function Mt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1553
1555
|
itemCount: a,
|
|
1554
1556
|
overscanCount: l
|
|
1555
1557
|
});
|
|
1556
|
-
return
|
|
1558
|
+
return Z(s, t) ? t : s;
|
|
1557
1559
|
});
|
|
1558
1560
|
};
|
|
1559
1561
|
return e.addEventListener("scroll", t), () => {
|
|
@@ -1580,14 +1582,14 @@ function Mt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1580
1582
|
itemSize: m
|
|
1581
1583
|
});
|
|
1582
1584
|
if (e) {
|
|
1583
|
-
if (s =
|
|
1585
|
+
if (s = Et({
|
|
1584
1586
|
containerElement: e,
|
|
1585
1587
|
direction: r,
|
|
1586
1588
|
isRtl: i,
|
|
1587
1589
|
scrollOffset: s
|
|
1588
1590
|
}), typeof e.scrollTo != "function") {
|
|
1589
1591
|
let e = w(s);
|
|
1590
|
-
|
|
1592
|
+
Z(_, e) || v(e);
|
|
1591
1593
|
}
|
|
1592
1594
|
return s;
|
|
1593
1595
|
}
|
|
@@ -1603,7 +1605,7 @@ function Nt(e) {
|
|
|
1603
1605
|
}
|
|
1604
1606
|
function Pt(e, t) {
|
|
1605
1607
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1606
|
-
return
|
|
1608
|
+
return Z(n, a) && Z(r, o) && Z(i, s);
|
|
1607
1609
|
}
|
|
1608
1610
|
function Ft(e) {
|
|
1609
1611
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
@@ -1636,7 +1638,7 @@ function Lt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1636
1638
|
top: r
|
|
1637
1639
|
});
|
|
1638
1640
|
}
|
|
1639
|
-
}), [g, x]),
|
|
1641
|
+
}), [g, x]), J(() => {
|
|
1640
1642
|
if (!g) return;
|
|
1641
1643
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1642
1644
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
@@ -1725,7 +1727,7 @@ var Rt = {
|
|
|
1725
1727
|
checkIcon: "_checkIcon_1tiyp_19",
|
|
1726
1728
|
stateLabel: "_stateLabel_1tiyp_23"
|
|
1727
1729
|
}, zt = 44, Bt = 8, Vt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: o, onSelect: s }) => {
|
|
1728
|
-
let l = r[e], u =
|
|
1730
|
+
let l = r[e], u = yt(l.iconUrl, l.type, l.displayName ?? l.id, p.SM), f = l.id === i;
|
|
1729
1731
|
return /* @__PURE__ */ H("div", {
|
|
1730
1732
|
style: t,
|
|
1731
1733
|
...n,
|
|
@@ -1759,7 +1761,7 @@ var Rt = {
|
|
|
1759
1761
|
L(() => {
|
|
1760
1762
|
e || y("");
|
|
1761
1763
|
}, [e]);
|
|
1762
|
-
let b = a && a.length > 0, x = u !== void 0, S = !b && !x ? d ?? f : void 0, C = b ?
|
|
1764
|
+
let b = a && a.length > 0, x = u !== void 0, S = !b && !x ? d ?? f : void 0, C = b ? vt(a, v) : [], w = (e) => {
|
|
1763
1765
|
l(e), i();
|
|
1764
1766
|
}, T = s({
|
|
1765
1767
|
"--ci-sheet-divider": _?.divider,
|
|
@@ -1769,14 +1771,14 @@ var Rt = {
|
|
|
1769
1771
|
"--ci-sheet-icon": _?.itemIcon,
|
|
1770
1772
|
"--ci-check-icon": _?.checkIcon
|
|
1771
1773
|
});
|
|
1772
|
-
return /* @__PURE__ */ H(
|
|
1774
|
+
return /* @__PURE__ */ H(G, {
|
|
1773
1775
|
isOpen: e,
|
|
1774
1776
|
title: t,
|
|
1775
1777
|
closeLabel: n,
|
|
1776
1778
|
onClose: i,
|
|
1777
1779
|
style: p,
|
|
1778
1780
|
titleClassName: m,
|
|
1779
|
-
className: c("max-h-[80dvh]",
|
|
1781
|
+
className: c("max-h-[80dvh]", W.modelMenu),
|
|
1780
1782
|
colors: _?.shell,
|
|
1781
1783
|
children: /* @__PURE__ */ U("div", {
|
|
1782
1784
|
className: "contents",
|
|
@@ -1789,7 +1791,7 @@ var Rt = {
|
|
|
1789
1791
|
size: g.Standard,
|
|
1790
1792
|
onChange: (e) => y(e ?? "")
|
|
1791
1793
|
})
|
|
1792
|
-
}), /* @__PURE__ */ H("div", { className: c(Rt.divider, "h-px flex-shrink-0") })] }), x ? /* @__PURE__ */ H(
|
|
1794
|
+
}), /* @__PURE__ */ H("div", { className: c(Rt.divider, "h-px flex-shrink-0") })] }), x ? /* @__PURE__ */ H(gt, { loadingLabel: u }) : S ? /* @__PURE__ */ H("div", {
|
|
1793
1795
|
role: "list",
|
|
1794
1796
|
className: c(Rt.stateLabel, h, "px-4 py-4"),
|
|
1795
1797
|
children: S
|
|
@@ -1811,7 +1813,7 @@ var Rt = {
|
|
|
1811
1813
|
})
|
|
1812
1814
|
});
|
|
1813
1815
|
}, Ut = ({ 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 }) => {
|
|
1814
|
-
let [_, y] = B(!1), { selectorIcon: b, selectorAriaLabel: x, selectedLabel: S, selectedVersion: C, menuItems: w, menuHeader: T, onOpenChange: E } =
|
|
1816
|
+
let [_, y] = B(!1), { selectorIcon: b, selectorAriaLabel: x, selectedLabel: S, selectedVersion: C, menuItems: w, menuHeader: T, onOpenChange: E } = xt({
|
|
1815
1817
|
deployments: e,
|
|
1816
1818
|
selectedDeploymentId: t,
|
|
1817
1819
|
onDeploymentChange: n,
|
|
@@ -1820,30 +1822,33 @@ var Rt = {
|
|
|
1820
1822
|
if (!e) return null;
|
|
1821
1823
|
let D = i || s ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, O = /* @__PURE__ */ H(P, {
|
|
1822
1824
|
size: p.SM,
|
|
1823
|
-
className:
|
|
1825
|
+
className: c(q.modelSelectorCaret, W.modelSelectorCaret),
|
|
1824
1826
|
"aria-hidden": !0,
|
|
1825
1827
|
stroke: m
|
|
1828
|
+
}), k = /* @__PURE__ */ H("span", {
|
|
1829
|
+
className: c("flex shrink-0 items-center", W.modelSelectorIcon),
|
|
1830
|
+
children: b
|
|
1826
1831
|
});
|
|
1827
1832
|
if (a) return /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(M, {
|
|
1828
1833
|
tooltip: S,
|
|
1829
1834
|
children: /* @__PURE__ */ H(v, {
|
|
1830
1835
|
icon: /* @__PURE__ */ U("div", {
|
|
1831
1836
|
className: "flex items-center gap-1",
|
|
1832
|
-
children: [
|
|
1837
|
+
children: [k, O]
|
|
1833
1838
|
}),
|
|
1834
1839
|
"aria-label": x,
|
|
1835
1840
|
onClick: () => {
|
|
1836
1841
|
s || y(!0);
|
|
1837
1842
|
},
|
|
1838
|
-
className: c("w-[50px]",
|
|
1843
|
+
className: c("w-[50px]", q.modelSelectorButton, D, W.modelSelectorButton)
|
|
1839
1844
|
})
|
|
1840
|
-
}), u ? /* @__PURE__ */ H(
|
|
1845
|
+
}), u ? /* @__PURE__ */ H(G, {
|
|
1841
1846
|
isOpen: _,
|
|
1842
1847
|
title: r?.ariaLabel ?? "Select model",
|
|
1843
1848
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1844
1849
|
onClose: () => y(!1),
|
|
1845
1850
|
style: l,
|
|
1846
|
-
className:
|
|
1851
|
+
className: W.modelMenu,
|
|
1847
1852
|
children: u(() => y(!1))
|
|
1848
1853
|
}) : /* @__PURE__ */ H(Ht, {
|
|
1849
1854
|
isOpen: _,
|
|
@@ -1869,26 +1874,26 @@ var Rt = {
|
|
|
1869
1874
|
trigger: [],
|
|
1870
1875
|
outsideClosable: !0,
|
|
1871
1876
|
renderOverlay: () => u(() => g?.(!1)),
|
|
1872
|
-
listClassName: c("!w-[368px] !bg-layer-raised",
|
|
1877
|
+
listClassName: c("!w-[368px] !bg-layer-raised", W.modelMenu),
|
|
1873
1878
|
children: /* @__PURE__ */ H(M, {
|
|
1874
1879
|
tooltip: e,
|
|
1875
1880
|
children: /* @__PURE__ */ U("button", {
|
|
1876
1881
|
type: "button",
|
|
1877
1882
|
"aria-label": x,
|
|
1878
1883
|
"aria-disabled": s || void 0,
|
|
1879
|
-
className: c("flex min-w-0 items-center gap-1.5 rounded-full py-1.5 pe-2 ps-1.5",
|
|
1884
|
+
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, W.modelSelectorButton),
|
|
1880
1885
|
onClick: () => {
|
|
1881
1886
|
!i && !s && f?.();
|
|
1882
1887
|
},
|
|
1883
1888
|
children: [
|
|
1884
|
-
|
|
1889
|
+
k,
|
|
1885
1890
|
/* @__PURE__ */ U("span", {
|
|
1886
1891
|
className: "flex min-w-0 max-w-[180px] items-baseline gap-1",
|
|
1887
1892
|
children: [/* @__PURE__ */ H("span", {
|
|
1888
|
-
className: c("dial-small-text max-w-[180px] shrink-0 truncate",
|
|
1893
|
+
className: c("dial-small-text max-w-[180px] shrink-0 truncate", q.modelSelectorName),
|
|
1889
1894
|
children: S
|
|
1890
1895
|
}), C && /* @__PURE__ */ H("span", {
|
|
1891
|
-
className: c("dial-tiny-text min-w-0 truncate",
|
|
1896
|
+
className: c("dial-tiny-text min-w-0 truncate", q.modelSelectorVersion),
|
|
1892
1897
|
children: C
|
|
1893
1898
|
})]
|
|
1894
1899
|
}),
|
|
@@ -1907,7 +1912,7 @@ var Rt = {
|
|
|
1907
1912
|
placement: "bottom-end",
|
|
1908
1913
|
matchReferenceWidth: !1,
|
|
1909
1914
|
maxDropdownHeight: o,
|
|
1910
|
-
listClassName: c("!w-[240px]",
|
|
1915
|
+
listClassName: c("!w-[240px]", W.modelMenu),
|
|
1911
1916
|
disabled: s,
|
|
1912
1917
|
onOpenChange: s ? void 0 : E,
|
|
1913
1918
|
children: /* @__PURE__ */ H(M, {
|
|
@@ -1916,14 +1921,14 @@ var Rt = {
|
|
|
1916
1921
|
type: "button",
|
|
1917
1922
|
"aria-label": x,
|
|
1918
1923
|
"aria-disabled": s || void 0,
|
|
1919
|
-
className: c("flex items-center gap-1 rounded-full p-1.5",
|
|
1920
|
-
children: [
|
|
1924
|
+
className: c("flex items-center gap-1 rounded-full p-1.5", q.modelSelectorButton, s && q.modelSelectorButtonDisabled, W.modelSelectorButton),
|
|
1925
|
+
children: [k, O]
|
|
1921
1926
|
})
|
|
1922
1927
|
})
|
|
1923
1928
|
})
|
|
1924
1929
|
});
|
|
1925
|
-
}, Wt = ({ 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, emptyMessageTooltip: ee, stopLabel: A, micLabel: te = "Dictate", recordVoiceLabel: j = "Record voice", stopRecordingLabel: ne, discardRecordingLabel: re, colors: M, typography: ie,
|
|
1926
|
-
let
|
|
1930
|
+
}, Wt = ({ 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, emptyMessageTooltip: ee, stopLabel: A, micLabel: te = "Dictate", recordVoiceLabel: j = "Record voice", stopRecordingLabel: ne, discardRecordingLabel: re, colors: M, typography: ie, attachmentTray: ae, className: N, pendingDropFiles: P = [], onDropFilesConsumed: oe, pendingAttachments: le = [], onPendingAttachmentsConsumed: ue, pasteTextThreshold: de = 4e3, maxMessageLength: F = 5e4, deployments: fe, selectedDeploymentId: pe, onDeploymentChange: me, modelSelectorLabels: he, initialAttachments: ge = [], hideAddButton: _e = !1, hideAttachFile: ve = !1, hideActionBar: ye = !1, actionRowLayout: xe = Ke.Stacked, isInlineActionRowAllowedBelowDesktop: Se = !1, renderFooterActions: we, isInputDisabled: Te = !1, isModelSelectorDisabled: Ee = !1, isSendDisabled: G = !1, isAudioMessageSupported: De = !1, isVoiceRecordingSupported: ke = De, onTranscribeAudio: je, transcribingLabel: Me, voiceErrorLabel: Fe, sendOnEnter: Ie = Ge.Enter, prefixAttachments: Be = [], onRemovePrefixAttachment: Ve, chatSettings: He, toolsMenuItems: Ue, onToolToggle: qe, canRemoveTools: Je = !0, toolsMenuTitle: Ye, toolsBackLabel: Xe, toolsChipLabels: Ze, menuOverlays: Qe, inlineStartSlot: $e, onInlineStartRemove: et, commandMenu: K, autoFocus: tt = !1, messageHistory: nt, onDialFileSystemClick: it, dialFileSystemLabel: at, validateAttachment: st, onAttachmentClick: ct, modelPickerOverlay: lt, maximumAttachmentsAmount: ut, onAttachmentsLimitExceeded: mt, isAttachmentsEnabled: ht = !0, isTextAttachmentsAllowed: gt = !0, usageLimitsSlot: _t, onMessageTooLong: vt }) => {
|
|
1931
|
+
let yt = l(), [bt, xt] = B(!1), J = Ne(nt), Y = $e != null, [St, Ct] = B(null), [wt, Tt] = B(0), Et = R(() => s({
|
|
1927
1932
|
"--ci-bg": M?.background,
|
|
1928
1933
|
"--ci-text": M?.text,
|
|
1929
1934
|
"--ci-border": M?.border,
|
|
@@ -1938,333 +1943,334 @@ var Rt = {
|
|
|
1938
1943
|
"--ci-voice-error": M?.voiceError,
|
|
1939
1944
|
"--ci-voice-waveform": M?.voiceWaveform,
|
|
1940
1945
|
"--ci-voice-accent": M?.voiceAccent,
|
|
1941
|
-
"--ci-first-line-indent": Y ? `calc(${
|
|
1946
|
+
"--ci-first-line-indent": Y ? `calc(${wt}px + 4px)` : void 0
|
|
1942
1947
|
}), [
|
|
1943
1948
|
M,
|
|
1944
1949
|
Y,
|
|
1945
|
-
|
|
1946
|
-
]),
|
|
1950
|
+
wt
|
|
1951
|
+
]), X = R(() => it ? [{
|
|
1947
1952
|
key: "dial-fs",
|
|
1948
|
-
label:
|
|
1953
|
+
label: at ?? "DIAL file system",
|
|
1949
1954
|
icon: /* @__PURE__ */ H(se, {
|
|
1950
1955
|
size: u,
|
|
1951
1956
|
"aria-hidden": !0,
|
|
1952
1957
|
stroke: m
|
|
1953
1958
|
}),
|
|
1954
|
-
onClick:
|
|
1955
|
-
}] : [], [
|
|
1959
|
+
onClick: it
|
|
1960
|
+
}] : [], [it, at]), { message: Z, setMessage: Q, textareaRef: Dt } = Pe({
|
|
1956
1961
|
messageProp: e,
|
|
1957
1962
|
messageRevision: t
|
|
1958
|
-
}), { handleUndoKeyDown:
|
|
1963
|
+
}), { handleUndoKeyDown: Ot } = Le({
|
|
1959
1964
|
insertion: n,
|
|
1960
|
-
textareaRef:
|
|
1961
|
-
}), { isMenuOpen:
|
|
1962
|
-
config:
|
|
1963
|
-
message:
|
|
1964
|
-
}),
|
|
1965
|
-
if (
|
|
1966
|
-
|
|
1967
|
-
let t = `${
|
|
1968
|
-
if (!
|
|
1969
|
-
let n =
|
|
1970
|
-
|
|
1965
|
+
textareaRef: Dt
|
|
1966
|
+
}), { isMenuOpen: kt, query: At, dismiss: jt, handleValueChange: Mt } = Ae({
|
|
1967
|
+
config: K,
|
|
1968
|
+
message: Z
|
|
1969
|
+
}), Nt = K?.emptyQueryHint != null, Pt = Nt && kt && At === "", Ft = I((e) => {
|
|
1970
|
+
if (K == null || (jt(), !e?.consumeQuery)) return;
|
|
1971
|
+
Dt.current?.focus();
|
|
1972
|
+
let t = `${K.triggerPrefix}${At}`;
|
|
1973
|
+
if (!Z.startsWith(t)) return;
|
|
1974
|
+
let n = Z.slice(t.length);
|
|
1975
|
+
Q(n), J.notifyChange(), d?.(n);
|
|
1971
1976
|
}, [
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
X,
|
|
1977
|
+
K,
|
|
1978
|
+
jt,
|
|
1979
|
+
At,
|
|
1976
1980
|
Z,
|
|
1977
|
-
|
|
1981
|
+
Q,
|
|
1982
|
+
J,
|
|
1978
1983
|
d,
|
|
1979
|
-
|
|
1984
|
+
Dt
|
|
1980
1985
|
]);
|
|
1981
1986
|
L(() => {
|
|
1982
|
-
if (
|
|
1987
|
+
if (St == null) return;
|
|
1983
1988
|
let e = new ResizeObserver((e) => {
|
|
1984
1989
|
let t = e[0];
|
|
1985
|
-
t != null &&
|
|
1990
|
+
t != null && Tt(t.contentRect.width);
|
|
1986
1991
|
});
|
|
1987
|
-
return e.observe(
|
|
1988
|
-
}, [
|
|
1989
|
-
let { attachments:
|
|
1990
|
-
initialAttachments:
|
|
1992
|
+
return e.observe(St), () => e.disconnect();
|
|
1993
|
+
}, [St]);
|
|
1994
|
+
let { attachments: It, buildAttachments: Lt, addAttachments: Rt, resetAttachments: zt, handleRemove: Bt, handleRetry: Vt, handleExpand: Ht, hasBlockedAttachments: Wt } = Oe({
|
|
1995
|
+
initialAttachments: ge,
|
|
1991
1996
|
onUploadAttachment: i,
|
|
1992
1997
|
onAttachmentsChange: f,
|
|
1993
|
-
validateAttachment:
|
|
1994
|
-
pendingDropFiles:
|
|
1995
|
-
onDropFilesConsumed:
|
|
1996
|
-
pendingAttachments:
|
|
1997
|
-
onPendingAttachmentsConsumed:
|
|
1998
|
+
validateAttachment: st,
|
|
1999
|
+
pendingDropFiles: P,
|
|
2000
|
+
onDropFilesConsumed: oe,
|
|
2001
|
+
pendingAttachments: le,
|
|
2002
|
+
onPendingAttachmentsConsumed: ue,
|
|
1998
2003
|
onExpandPastedText: I((e) => {
|
|
1999
|
-
|
|
2000
|
-
}, [
|
|
2001
|
-
maximumAttachmentsAmount:
|
|
2002
|
-
baseAttachmentsAmount:
|
|
2003
|
-
onAttachmentsLimitExceeded:
|
|
2004
|
-
}),
|
|
2005
|
-
|
|
2006
|
-
}, [
|
|
2007
|
-
|
|
2008
|
-
let [
|
|
2004
|
+
Q((t) => t ? `${t}\n${e}` : e);
|
|
2005
|
+
}, [Q]),
|
|
2006
|
+
maximumAttachmentsAmount: ut,
|
|
2007
|
+
baseAttachmentsAmount: Be.length,
|
|
2008
|
+
onAttachmentsLimitExceeded: mt
|
|
2009
|
+
}), Gt = I((e) => {
|
|
2010
|
+
Rt(Lt([e]));
|
|
2011
|
+
}, [Rt, Lt]), Kt = z(!1), qt = z(Z);
|
|
2012
|
+
qt.current = Z;
|
|
2013
|
+
let [Jt, Yt] = B({
|
|
2009
2014
|
text: "",
|
|
2010
2015
|
revision: 0
|
|
2011
|
-
}), { state:
|
|
2012
|
-
onAttachAudio:
|
|
2013
|
-
onTranscribeAudio:
|
|
2016
|
+
}), { state: Xt, analyserNodeRef: Zt, errorMessage: Qt, startRecording: $t, stopRecording: en, discardRecording: tn } = We({
|
|
2017
|
+
onAttachAudio: Gt,
|
|
2018
|
+
onTranscribeAudio: je,
|
|
2014
2019
|
onTranscript: I((e) => {
|
|
2015
2020
|
let t = e.trim();
|
|
2016
2021
|
if (t) {
|
|
2017
|
-
let e =
|
|
2018
|
-
|
|
2022
|
+
let e = qt.current, n = `${e}${e && !/\s$/.test(e) ? " " : ""}${t}`;
|
|
2023
|
+
qt.current = n, Q(n), Yt((e) => ({
|
|
2019
2024
|
text: t,
|
|
2020
2025
|
revision: e.revision + 1
|
|
2021
|
-
})),
|
|
2026
|
+
})), J.notifyChange(), d?.(n);
|
|
2022
2027
|
}
|
|
2023
|
-
|
|
2028
|
+
Kt.current = !0;
|
|
2024
2029
|
}, [
|
|
2025
|
-
|
|
2026
|
-
|
|
2030
|
+
Q,
|
|
2031
|
+
J,
|
|
2027
2032
|
d
|
|
2028
2033
|
]),
|
|
2029
|
-
errorLabel:
|
|
2030
|
-
}), $ =
|
|
2034
|
+
errorLabel: Fe
|
|
2035
|
+
}), $ = Xt === Re.Recording || Xt === Re.Processing;
|
|
2031
2036
|
L(() => {
|
|
2032
|
-
(
|
|
2033
|
-
}, [
|
|
2034
|
-
let
|
|
2035
|
-
if (!
|
|
2037
|
+
(Xt === Re.Error || Xt === Re.Idle && Kt.current) && (Kt.current = !1, Dt.current?.focus());
|
|
2038
|
+
}, [Xt, Dt]);
|
|
2039
|
+
let nn = z(null), rn = z(null), an = ht && gt, { handlePaste: on } = Ce(Rt, an ? de : Infinity), sn = I((e) => {
|
|
2040
|
+
if (!an) {
|
|
2036
2041
|
let t = e.clipboardData.getData("text/plain");
|
|
2037
|
-
t.length >= F &&
|
|
2042
|
+
t.length >= F && vt?.(t.length, F);
|
|
2038
2043
|
}
|
|
2039
|
-
|
|
2044
|
+
on(e);
|
|
2040
2045
|
}, [
|
|
2041
|
-
|
|
2046
|
+
an,
|
|
2042
2047
|
F,
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
]),
|
|
2048
|
+
vt,
|
|
2049
|
+
on
|
|
2050
|
+
]), cn = Z.trim().length > 0 || It.length > 0 || Y, ln = cn && !Wt && !G && !$, [un, dn] = B([]);
|
|
2046
2051
|
L(() => {
|
|
2047
|
-
|
|
2048
|
-
}, [(
|
|
2049
|
-
let
|
|
2050
|
-
let e =
|
|
2051
|
-
return
|
|
2052
|
+
dn([]);
|
|
2053
|
+
}, [(Ue ?? []).map((e) => e.id).join("|")]);
|
|
2054
|
+
let fn = R(() => {
|
|
2055
|
+
let e = Ue ?? [];
|
|
2056
|
+
return Je ? e.filter((e) => e.isSelected || !un.includes(e.id)) : e;
|
|
2052
2057
|
}, [
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
]),
|
|
2057
|
-
|
|
2058
|
-
}, [
|
|
2059
|
-
if (
|
|
2060
|
-
if (
|
|
2061
|
-
|
|
2058
|
+
Ue,
|
|
2059
|
+
un,
|
|
2060
|
+
Je
|
|
2061
|
+
]), pn = I((e) => {
|
|
2062
|
+
dn((t) => t.includes(e) ? t : [...t, e]), Ue?.find((t) => t.id === e)?.isSelected && qe?.(e);
|
|
2063
|
+
}, [Ue, qe]), mn = fe === void 0 || pe != null, hn = De && !o, gn = async () => {
|
|
2064
|
+
if (G || $) return;
|
|
2065
|
+
if (Z.length >= F) {
|
|
2066
|
+
vt?.(Z.length, F);
|
|
2062
2067
|
return;
|
|
2063
2068
|
}
|
|
2064
|
-
let e =
|
|
2065
|
-
|
|
2069
|
+
let e = Z, t = It;
|
|
2070
|
+
Q(""), J.reset();
|
|
2066
2071
|
try {
|
|
2067
2072
|
await r?.(e, t), t.forEach((e) => {
|
|
2068
2073
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
2069
|
-
}),
|
|
2074
|
+
}), zt([]);
|
|
2070
2075
|
} catch {
|
|
2071
|
-
|
|
2076
|
+
Q(e), zt(t);
|
|
2072
2077
|
}
|
|
2073
|
-
},
|
|
2074
|
-
if (!$ && !
|
|
2075
|
-
if (!e.nativeEvent.isComposing && !
|
|
2078
|
+
}, _n = (e) => {
|
|
2079
|
+
if (!$ && !Ot(e)) {
|
|
2080
|
+
if (!e.nativeEvent.isComposing && !Te && !o) {
|
|
2076
2081
|
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
2077
|
-
let t = e.currentTarget.selectionStart ?? 0, n =
|
|
2082
|
+
let t = e.currentTarget.selectionStart ?? 0, n = J.navigate(e.key === "ArrowUp" ? "up" : "down", Z, t);
|
|
2078
2083
|
if (n !== null) {
|
|
2079
|
-
e.preventDefault(),
|
|
2084
|
+
e.preventDefault(), Q(n);
|
|
2080
2085
|
return;
|
|
2081
2086
|
}
|
|
2082
2087
|
}
|
|
2083
|
-
if (e.key === "Backspace" && Y &&
|
|
2084
|
-
e.preventDefault(),
|
|
2088
|
+
if (e.key === "Backspace" && Y && et != null && e.currentTarget.selectionStart === 0 && e.currentTarget.selectionEnd === 0) {
|
|
2089
|
+
e.preventDefault(), et();
|
|
2085
2090
|
return;
|
|
2086
2091
|
}
|
|
2087
2092
|
}
|
|
2088
|
-
e.key === "Enter" && (
|
|
2093
|
+
e.key === "Enter" && (Ie === Ge.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !o && ln && mn && !Te && gn());
|
|
2089
2094
|
}
|
|
2090
|
-
},
|
|
2095
|
+
}, vn = (e) => {
|
|
2091
2096
|
let t = Array.from(e.target.files ?? []);
|
|
2092
2097
|
if (t.length === 0) return;
|
|
2093
|
-
let n =
|
|
2094
|
-
e.target.value = "",
|
|
2095
|
-
},
|
|
2096
|
-
className: c(
|
|
2097
|
-
ref:
|
|
2098
|
-
autoFocus:
|
|
2099
|
-
value:
|
|
2098
|
+
let n = Lt(t);
|
|
2099
|
+
e.target.value = "", Rt(n);
|
|
2100
|
+
}, yn = /* @__PURE__ */ H("textarea", {
|
|
2101
|
+
className: c(q.textarea, Y && q.textareaIndented, ie?.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"),
|
|
2102
|
+
ref: Dt,
|
|
2103
|
+
autoFocus: tt,
|
|
2104
|
+
value: Z,
|
|
2100
2105
|
onChange: (e) => {
|
|
2101
|
-
|
|
2106
|
+
Q(e.target.value), J.notifyChange();
|
|
2102
2107
|
let t = e.nativeEvent instanceof InputEvent ? e.nativeEvent : void 0;
|
|
2103
|
-
|
|
2108
|
+
Mt(e.target.value, t?.isComposing ?? !1, t?.inputType), d?.(e.target.value);
|
|
2104
2109
|
},
|
|
2105
|
-
onKeyDown:
|
|
2106
|
-
onPaste:
|
|
2110
|
+
onKeyDown: _n,
|
|
2111
|
+
onPaste: sn,
|
|
2107
2112
|
placeholder: Y ? void 0 : g,
|
|
2108
2113
|
"aria-label": y,
|
|
2109
|
-
disabled:
|
|
2114
|
+
disabled: Te,
|
|
2110
2115
|
readOnly: $,
|
|
2111
2116
|
rows: 1
|
|
2112
|
-
}),
|
|
2117
|
+
}), bn = K == null ? yn : /* @__PURE__ */ H(h, {
|
|
2113
2118
|
className: "w-full",
|
|
2114
|
-
open:
|
|
2119
|
+
open: kt,
|
|
2115
2120
|
onOpenChange: (e) => {
|
|
2116
|
-
e ||
|
|
2121
|
+
e || jt();
|
|
2117
2122
|
},
|
|
2118
2123
|
placement: "top-start",
|
|
2119
2124
|
trigger: [],
|
|
2120
2125
|
initialFocus: -1,
|
|
2121
2126
|
matchReferenceWidth: !1,
|
|
2122
|
-
outsidePressIgnoreRef:
|
|
2127
|
+
outsidePressIgnoreRef: Dt,
|
|
2123
2128
|
renderOverlay: () => {
|
|
2124
|
-
let e =
|
|
2125
|
-
query:
|
|
2126
|
-
close:
|
|
2129
|
+
let e = K.renderMenu({
|
|
2130
|
+
query: At,
|
|
2131
|
+
close: Ft
|
|
2127
2132
|
});
|
|
2128
|
-
return
|
|
2133
|
+
return K.menuLabel == null ? e : /* @__PURE__ */ H("div", {
|
|
2129
2134
|
role: "group",
|
|
2130
|
-
"aria-label":
|
|
2135
|
+
"aria-label": K.menuLabel,
|
|
2131
2136
|
children: e
|
|
2132
2137
|
});
|
|
2133
2138
|
},
|
|
2134
|
-
children:
|
|
2135
|
-
}),
|
|
2139
|
+
children: yn
|
|
2140
|
+
}), xn = Y || Nt ? /* @__PURE__ */ U("div", {
|
|
2136
2141
|
className: "relative w-full",
|
|
2137
2142
|
children: [
|
|
2138
2143
|
Y && /* @__PURE__ */ H("div", {
|
|
2139
|
-
ref:
|
|
2144
|
+
ref: Ct,
|
|
2140
2145
|
className: "absolute start-0 top-0",
|
|
2141
|
-
children:
|
|
2146
|
+
children: $e
|
|
2142
2147
|
}),
|
|
2143
|
-
|
|
2144
|
-
className: c(
|
|
2148
|
+
Pt && K != null && /* @__PURE__ */ U("span", {
|
|
2149
|
+
className: c(q.commandHint, "pointer-events-none absolute start-[var(--ci-first-line-indent,0px)] top-0", ie?.fontClassName || "dial-body-paragraph-text"),
|
|
2145
2150
|
"aria-hidden": !0,
|
|
2146
2151
|
children: [/* @__PURE__ */ H("span", {
|
|
2147
2152
|
className: "invisible",
|
|
2148
|
-
children:
|
|
2149
|
-
}),
|
|
2153
|
+
children: K.triggerPrefix
|
|
2154
|
+
}), K.emptyQueryHint]
|
|
2150
2155
|
}),
|
|
2151
|
-
|
|
2156
|
+
bn
|
|
2152
2157
|
]
|
|
2153
|
-
}) :
|
|
2154
|
-
onAttachClick:
|
|
2158
|
+
}) : bn, Sn = _e ? void 0 : /* @__PURE__ */ H(rt, {
|
|
2159
|
+
onAttachClick: ve ? void 0 : () => nn.current?.click(),
|
|
2155
2160
|
attachLabel: b,
|
|
2156
2161
|
addMenuTitle: S,
|
|
2157
2162
|
menuTitle: C,
|
|
2158
2163
|
menuCloseLabel: w,
|
|
2159
|
-
style:
|
|
2160
|
-
isDisabled:
|
|
2161
|
-
chatSettings:
|
|
2162
|
-
extraMenuItems:
|
|
2163
|
-
onRecordVoice:
|
|
2164
|
+
style: Et,
|
|
2165
|
+
isDisabled: Te || $,
|
|
2166
|
+
chatSettings: He,
|
|
2167
|
+
extraMenuItems: X,
|
|
2168
|
+
onRecordVoice: ke && ht && !o && !$ ? () => $t(ze.Attachment) : void 0,
|
|
2164
2169
|
recordVoiceLabel: j,
|
|
2165
|
-
toolsMenuItems:
|
|
2166
|
-
onToolToggle:
|
|
2167
|
-
toolsMenuTitle:
|
|
2168
|
-
toolsBackLabel:
|
|
2169
|
-
menuOverlays:
|
|
2170
|
-
}),
|
|
2171
|
-
className: c("flex",
|
|
2172
|
-
children:
|
|
2173
|
-
}),
|
|
2174
|
-
className: c("min-w-0 flex-1",
|
|
2175
|
-
children: /* @__PURE__ */ H(
|
|
2176
|
-
items:
|
|
2177
|
-
onToolToggle:
|
|
2178
|
-
onToolDismiss:
|
|
2179
|
-
canRemove:
|
|
2180
|
-
removeLabel:
|
|
2170
|
+
toolsMenuItems: Je ? Ue : void 0,
|
|
2171
|
+
onToolToggle: qe,
|
|
2172
|
+
toolsMenuTitle: Ye,
|
|
2173
|
+
toolsBackLabel: Xe,
|
|
2174
|
+
menuOverlays: Qe
|
|
2175
|
+
}), Cn = xe === Ke.Inline && (!yt || Se), wn = Sn && /* @__PURE__ */ H("div", {
|
|
2176
|
+
className: c("flex", W.addCluster),
|
|
2177
|
+
children: Sn
|
|
2178
|
+
}), Tn = fn.length > 0 && qe != null && /* @__PURE__ */ H("div", {
|
|
2179
|
+
className: c("min-w-0 flex-1", W.toolsChips),
|
|
2180
|
+
children: /* @__PURE__ */ H(ot, {
|
|
2181
|
+
items: fn,
|
|
2182
|
+
onToolToggle: qe,
|
|
2183
|
+
onToolDismiss: pn,
|
|
2184
|
+
canRemove: Je,
|
|
2185
|
+
removeLabel: Ze?.removeLabel
|
|
2181
2186
|
})
|
|
2182
2187
|
});
|
|
2183
2188
|
return /* @__PURE__ */ U("div", {
|
|
2184
|
-
ref:
|
|
2185
|
-
style:
|
|
2186
|
-
className: c(
|
|
2189
|
+
ref: rn,
|
|
2190
|
+
style: Et,
|
|
2191
|
+
className: c(q.wrapper, Te && q.wrapperDisabled, Te && "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", It.length > 6 ? "py-4 ps-4" : "p-4", N, W.wrapper),
|
|
2187
2192
|
children: [
|
|
2188
|
-
(
|
|
2189
|
-
attachments: [...
|
|
2193
|
+
(Be.length > 0 || It.length > 0) && /* @__PURE__ */ H(be, {
|
|
2194
|
+
attachments: [...Be, ...It],
|
|
2190
2195
|
onRemove: (e) => {
|
|
2191
|
-
|
|
2196
|
+
Be.some((t) => t.id === e) ? Ve?.(e) : Bt(e);
|
|
2192
2197
|
},
|
|
2193
|
-
onRetry:
|
|
2194
|
-
onExpand:
|
|
2198
|
+
onRetry: Vt,
|
|
2199
|
+
onExpand: Ht,
|
|
2195
2200
|
labels: {
|
|
2196
2201
|
removeLabel: T,
|
|
2197
2202
|
retryLabel: E,
|
|
2198
2203
|
uploadingLabel: D
|
|
2199
2204
|
},
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
t
|
|
2205
|
+
styles: ae,
|
|
2206
|
+
onAttachmentClick: ct == null ? void 0 : (e) => {
|
|
2207
|
+
let t = [...Be, ...It].find((t) => t.id === e);
|
|
2208
|
+
t != null && ct(t);
|
|
2203
2209
|
}
|
|
2204
2210
|
}),
|
|
2205
|
-
!
|
|
2206
|
-
ref:
|
|
2211
|
+
!_e && /* @__PURE__ */ H("input", {
|
|
2212
|
+
ref: nn,
|
|
2207
2213
|
type: "file",
|
|
2208
2214
|
multiple: !0,
|
|
2209
2215
|
accept: x,
|
|
2210
2216
|
className: "sr-only",
|
|
2211
2217
|
"aria-hidden": !0,
|
|
2212
2218
|
tabIndex: -1,
|
|
2213
|
-
onChange:
|
|
2219
|
+
onChange: vn
|
|
2214
2220
|
}),
|
|
2215
|
-
|
|
2216
|
-
text:
|
|
2221
|
+
Qt && /* @__PURE__ */ H(_, {
|
|
2222
|
+
text: Qt,
|
|
2217
2223
|
className: "min-w-0 break-words px-1"
|
|
2218
2224
|
}),
|
|
2219
|
-
$ && /* @__PURE__ */ H(
|
|
2225
|
+
$ && /* @__PURE__ */ H(dt, {
|
|
2220
2226
|
embedded: !0,
|
|
2221
|
-
state:
|
|
2222
|
-
analyserNodeRef:
|
|
2223
|
-
errorMessage:
|
|
2224
|
-
onStop:
|
|
2225
|
-
onDiscard:
|
|
2226
|
-
attachButton:
|
|
2227
|
+
state: Xt,
|
|
2228
|
+
analyserNodeRef: Zt,
|
|
2229
|
+
errorMessage: Qt,
|
|
2230
|
+
onStop: en,
|
|
2231
|
+
onDiscard: tn,
|
|
2232
|
+
attachButton: Sn,
|
|
2227
2233
|
stopLabel: ne,
|
|
2228
2234
|
discardLabel: re,
|
|
2229
|
-
processingLabel:
|
|
2235
|
+
processingLabel: Me
|
|
2230
2236
|
}),
|
|
2231
|
-
!$ &&
|
|
2232
|
-
!$ && !
|
|
2237
|
+
!$ && ye && xn,
|
|
2238
|
+
!$ && !ye && Cn && Tn && /* @__PURE__ */ H("div", {
|
|
2233
2239
|
className: "flex",
|
|
2234
|
-
children:
|
|
2240
|
+
children: Tn
|
|
2235
2241
|
}),
|
|
2236
|
-
!$ && !
|
|
2237
|
-
className: c("flex items-center gap-2",
|
|
2242
|
+
!$ && !ye && /* @__PURE__ */ U("div", {
|
|
2243
|
+
className: c("flex items-center gap-2", Cn ? "flex-nowrap" : "flex-wrap", W.actionRow),
|
|
2238
2244
|
children: [
|
|
2239
|
-
|
|
2245
|
+
Cn && wn,
|
|
2240
2246
|
/* @__PURE__ */ H("div", {
|
|
2241
|
-
className: c("flex min-w-0 items-center self-stretch",
|
|
2242
|
-
children:
|
|
2247
|
+
className: c("flex min-w-0 items-center self-stretch", Cn ? "flex-1" : "w-full", W.textareaWrap),
|
|
2248
|
+
children: xn
|
|
2243
2249
|
}),
|
|
2244
|
-
!
|
|
2245
|
-
!
|
|
2250
|
+
!Cn && wn,
|
|
2251
|
+
!Cn && Tn,
|
|
2246
2252
|
/* @__PURE__ */ H("div", {
|
|
2247
|
-
className: c("ms-auto flex flex-shrink-0 items-center gap-2",
|
|
2248
|
-
children:
|
|
2249
|
-
canSend:
|
|
2250
|
-
onSend:
|
|
2253
|
+
className: c("ms-auto flex flex-shrink-0 items-center gap-2", W.footerActions),
|
|
2254
|
+
children: we ? we({
|
|
2255
|
+
canSend: ln,
|
|
2256
|
+
onSend: gn
|
|
2251
2257
|
}) : /* @__PURE__ */ U(V, { children: [
|
|
2252
|
-
|
|
2258
|
+
_t,
|
|
2253
2259
|
/* @__PURE__ */ H(Ut, {
|
|
2254
|
-
deployments:
|
|
2255
|
-
selectedDeploymentId:
|
|
2256
|
-
onDeploymentChange:
|
|
2257
|
-
modelSelectorLabels:
|
|
2260
|
+
deployments: fe,
|
|
2261
|
+
selectedDeploymentId: pe,
|
|
2262
|
+
onDeploymentChange: me,
|
|
2263
|
+
modelSelectorLabels: he,
|
|
2258
2264
|
isStreaming: o,
|
|
2259
|
-
isMobile:
|
|
2260
|
-
isDisabled:
|
|
2261
|
-
style:
|
|
2262
|
-
modelPickerOverlay:
|
|
2263
|
-
isPickerOpen:
|
|
2264
|
-
onPickerToggle: () =>
|
|
2265
|
-
onPickerOpenChange:
|
|
2265
|
+
isMobile: yt,
|
|
2266
|
+
isDisabled: Ee,
|
|
2267
|
+
style: Et,
|
|
2268
|
+
modelPickerOverlay: lt,
|
|
2269
|
+
isPickerOpen: bt,
|
|
2270
|
+
onPickerToggle: () => xt((e) => !e),
|
|
2271
|
+
onPickerOpenChange: xt
|
|
2266
2272
|
}),
|
|
2267
|
-
|
|
2273
|
+
hn && /* @__PURE__ */ H(v, {
|
|
2268
2274
|
icon: /* @__PURE__ */ H(ce, {
|
|
2269
2275
|
size: p.LG,
|
|
2270
2276
|
stroke: m,
|
|
@@ -2273,17 +2279,17 @@ var Rt = {
|
|
|
2273
2279
|
"aria-label": te,
|
|
2274
2280
|
tooltipProps: { tooltip: te },
|
|
2275
2281
|
className: "size-[40px] flex-shrink-0 mobile:min-h-11 mobile:min-w-11",
|
|
2276
|
-
onClick: () =>
|
|
2277
|
-
disabled:
|
|
2282
|
+
onClick: () => $t(ze.Dictation),
|
|
2283
|
+
disabled: Te || o
|
|
2278
2284
|
}),
|
|
2279
|
-
o && a ? /* @__PURE__ */ H(
|
|
2285
|
+
o && a ? /* @__PURE__ */ H(pt, {
|
|
2280
2286
|
onStop: a,
|
|
2281
2287
|
ariaLabel: A
|
|
2282
|
-
}) : !o && /* @__PURE__ */ H(
|
|
2283
|
-
onSend:
|
|
2284
|
-
isDisabled: !
|
|
2288
|
+
}) : !o && /* @__PURE__ */ H(ft, {
|
|
2289
|
+
onSend: gn,
|
|
2290
|
+
isDisabled: !mn || !ln,
|
|
2285
2291
|
ariaLabel: O,
|
|
2286
|
-
sendTooltip:
|
|
2292
|
+
sendTooltip: cn ? k : ee ?? k
|
|
2287
2293
|
})
|
|
2288
2294
|
] })
|
|
2289
2295
|
})
|
|
@@ -2294,7 +2300,7 @@ var Rt = {
|
|
|
2294
2300
|
role: "status",
|
|
2295
2301
|
"aria-live": "polite",
|
|
2296
2302
|
"aria-atomic": "true",
|
|
2297
|
-
children: /* @__PURE__ */ H("span", { children:
|
|
2303
|
+
children: /* @__PURE__ */ H("span", { children: Jt.text }, Jt.revision)
|
|
2298
2304
|
})
|
|
2299
2305
|
]
|
|
2300
2306
|
});
|
|
@@ -2302,7 +2308,7 @@ var Rt = {
|
|
|
2302
2308
|
welcome: "_welcome_1icyo_1",
|
|
2303
2309
|
description: "_description_1icyo_5"
|
|
2304
2310
|
}, Kt = ({ 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 }) => {
|
|
2305
|
-
let { colors: d, typography: f } = i ?? {};
|
|
2311
|
+
let { colors: d, typography: f, attachmentTray: p } = i ?? {};
|
|
2306
2312
|
return /* @__PURE__ */ U("div", {
|
|
2307
2313
|
style: s({
|
|
2308
2314
|
"--ci-welcome-color": d?.welcomeText,
|
|
@@ -2327,7 +2333,8 @@ var Rt = {
|
|
|
2327
2333
|
...u,
|
|
2328
2334
|
className: o,
|
|
2329
2335
|
colors: d?.input,
|
|
2330
|
-
typography: f?.input
|
|
2336
|
+
typography: f?.input,
|
|
2337
|
+
attachmentTray: p
|
|
2331
2338
|
})
|
|
2332
2339
|
})]
|
|
2333
2340
|
});
|
|
@@ -2336,7 +2343,7 @@ var Rt = {
|
|
|
2336
2343
|
L(() => {
|
|
2337
2344
|
C?.length && (le(C), T?.());
|
|
2338
2345
|
}, [C, T]);
|
|
2339
|
-
let [ue,
|
|
2346
|
+
let [ue, de] = B(e ?? ""), [F, fe] = B([]), [pe, me] = B(r), he = F.some((e) => e.status === i.Loading || e.status === i.Error), ge = (ue.trim().length > 0 || F.length > 0 || pe.length > 0) && !he, _e = (e) => {
|
|
2340
2347
|
me((t) => t.filter((t) => t.id !== e));
|
|
2341
2348
|
}, ve = I((e, t) => {
|
|
2342
2349
|
o(e, pe, t);
|
|
@@ -2346,12 +2353,12 @@ var Rt = {
|
|
|
2346
2353
|
P?.(ue.length, N);
|
|
2347
2354
|
return;
|
|
2348
2355
|
}
|
|
2349
|
-
ve(ue,
|
|
2356
|
+
ve(ue, F);
|
|
2350
2357
|
}
|
|
2351
2358
|
}, be = I(() => le([]), []), xe = I((e) => {
|
|
2352
2359
|
let t = Array.from(e.target.files ?? []);
|
|
2353
2360
|
t.length !== 0 && (e.target.value = "", le(t));
|
|
2354
|
-
}, []),
|
|
2361
|
+
}, []), Se = R(() => j ? [{
|
|
2355
2362
|
key: "dial-fs",
|
|
2356
2363
|
label: ne ?? "DIAL file system",
|
|
2357
2364
|
icon: /* @__PURE__ */ H(se, {
|
|
@@ -2373,7 +2380,7 @@ var Rt = {
|
|
|
2373
2380
|
onDropFilesConsumed: be,
|
|
2374
2381
|
onSend: ve,
|
|
2375
2382
|
onUploadAttachment: s,
|
|
2376
|
-
onChange:
|
|
2383
|
+
onChange: de,
|
|
2377
2384
|
onAttachmentsChange: fe,
|
|
2378
2385
|
removeLabel: p,
|
|
2379
2386
|
retryLabel: h,
|
|
@@ -2405,13 +2412,13 @@ var Rt = {
|
|
|
2405
2412
|
"aria-hidden": !0,
|
|
2406
2413
|
tabIndex: -1,
|
|
2407
2414
|
onChange: xe
|
|
2408
|
-
}), /* @__PURE__ */ H(
|
|
2415
|
+
}), /* @__PURE__ */ H(rt, {
|
|
2409
2416
|
onAttachClick: () => oe.current?.click(),
|
|
2410
2417
|
attachLabel: v,
|
|
2411
2418
|
addMenuTitle: _,
|
|
2412
2419
|
menuTitle: y,
|
|
2413
2420
|
menuCloseLabel: b,
|
|
2414
|
-
extraMenuItems:
|
|
2421
|
+
extraMenuItems: Se
|
|
2415
2422
|
})] })
|
|
2416
2423
|
}), /* @__PURE__ */ U("div", {
|
|
2417
2424
|
className: "flex gap-2",
|
|
@@ -2428,4 +2435,4 @@ var Rt = {
|
|
|
2428
2435
|
});
|
|
2429
2436
|
};
|
|
2430
2437
|
//#endregion
|
|
2431
|
-
export {
|
|
2438
|
+
export { Ke as ActionRowLayout, G as BottomSheetShell, W as CONVERSATION_INPUT_CLASS, et as ChatSettingsModal, Kt as ConversationInput, qt as EditMessageInput, Wt as Input, Ge as SendOnEnter };
|