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