@epam/ai-dial-conversation-input 1.0.0-rc.2 → 1.1.0-dev.101

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