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