@epam/ai-dial-conversation-input 1.1.0-dev.12 → 1.1.0-dev.121

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