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