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