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