@epam/ai-dial-conversation-input 1.2.0-dev.3 → 1.2.0-dev.300

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 (47) hide show
  1. package/components/AddAttachmentButton/AddAttachmentButton.d.ts +6 -0
  2. package/components/AddAttachmentButton/AddAttachmentButton.d.ts.map +1 -1
  3. package/components/BottomSheetShell/BottomSheetShell.d.ts +2 -2
  4. package/components/BottomSheetShell/BottomSheetShell.d.ts.map +1 -1
  5. package/components/ChatSettingsModal/ChatSettingsModal.d.ts.map +1 -1
  6. package/components/ConversationInput/ConversationInput.d.ts.map +1 -1
  7. package/components/EditMessageInput/EditMessageInput.d.ts.map +1 -1
  8. package/components/Input/Buttons/SendButton.d.ts +2 -0
  9. package/components/Input/Buttons/SendButton.d.ts.map +1 -1
  10. package/components/Input/Input.d.ts +2 -3
  11. package/components/Input/Input.d.ts.map +1 -1
  12. package/components/Input/ModelSelectorControl.d.ts +3 -1
  13. package/components/Input/ModelSelectorControl.d.ts.map +1 -1
  14. package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts +3 -0
  15. package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts.map +1 -1
  16. package/components/ToolsChips/ToolsChips.d.ts +11 -0
  17. package/components/ToolsChips/ToolsChips.d.ts.map +1 -1
  18. package/components/VoiceBar/VoiceBar.d.ts +1 -3
  19. package/components/VoiceBar/VoiceBar.d.ts.map +1 -1
  20. package/constants/public-class-names.d.ts +41 -0
  21. package/constants/public-class-names.d.ts.map +1 -0
  22. package/hooks/useAttachments.d.ts +8 -1
  23. package/hooks/useAttachments.d.ts.map +1 -1
  24. package/hooks/useCommandMenu/useCommandMenu.d.ts +35 -5
  25. package/hooks/useCommandMenu/useCommandMenu.d.ts.map +1 -1
  26. package/hooks/useComposerSeed.d.ts +32 -0
  27. package/hooks/useComposerSeed.d.ts.map +1 -0
  28. package/hooks/useMentionSelectionMirror.d.ts +22 -0
  29. package/hooks/useMentionSelectionMirror.d.ts.map +1 -0
  30. package/hooks/useModelSelector.d.ts +7 -13
  31. package/hooks/useModelSelector.d.ts.map +1 -1
  32. package/hooks/useTextInsertion.d.ts +25 -3
  33. package/hooks/useTextInsertion.d.ts.map +1 -1
  34. package/hooks/useVoiceRecorder.d.ts.map +1 -1
  35. package/index.css +2 -2
  36. package/index.d.ts +5 -2
  37. package/index.d.ts.map +1 -1
  38. package/index.js +1606 -1301
  39. package/models/ConversationInput.d.ts +115 -18
  40. package/models/ConversationInput.d.ts.map +1 -1
  41. package/models/Input.d.ts +219 -34
  42. package/models/Input.d.ts.map +1 -1
  43. package/package.json +4 -5
  44. package/utils/highlight-mirror.d.ts +17 -0
  45. package/utils/highlight-mirror.d.ts.map +1 -0
  46. package/hooks/useBottomSheet.d.ts +0 -9
  47. package/hooks/useBottomSheet.d.ts.map +0 -1
package/index.js CHANGED
@@ -1,308 +1,322 @@
1
- import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, RESIZABLE_TEXTAREA_CLASS_NAME as r, RequestStatus as i, ResponseFormat as a, SELECT_LIST_MAX_HEIGHT_PX as o, buildCssVars as s, mergeClasses as c, useIsMobile as l } from "@epam/ai-dial-chat-shared";
2
- import { BASE_ICON_SIZE as u, Button as d, CloseButton as f, DIAL_ICON_SIZE as p, DIAL_KIT_ICON_STROKE as m, Dropdown as h, ElementSize as g, ErrorText as _, GhostIconButton as v, Highlight as y, MenuItemMark as b, NeutralButton as x, Popup as S, PopupSize as C, PrimaryButton as w, PrimaryIconButton as T, RadioGroup as E, RadioGroupOrientation as D, Search as O, Skeleton as k, SkeletonVariant as ee, Slider as A, Spinner as te, StaticIconButton as j, Textarea as ne, TextareaResize as re, Tooltip as ie } from "@epam/ai-dial-ui-kit";
3
- import { IconArrowLeft as ae, IconArrowNarrowRight as oe, IconCheck as M, IconChevronDown as N, IconChevronRight as P, IconFile as se, IconMicrophone as ce, IconPaperclip as le, IconPlayerStopFilled as F, IconPlaystationSquare as ue, IconPlus as de, IconSettings as fe, IconTool as pe, IconX as me } from "@tabler/icons-react";
4
- import { createElement as he, memo as ge, useCallback as I, useEffect as L, useImperativeHandle as R, useLayoutEffect as _e, useMemo as z, useRef as B, useState as V } from "react";
5
- import { createPortal as ve } from "react-dom";
6
- import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
7
- import { AttachmentTray as ye, MAX_UPLOADS_PER_MINUTE as be, generateAttachmentId as xe, useClipboardPaste as Se } from "@epam/ai-dial-attachment-input";
8
- //#region src/hooks/useBottomSheet.ts
9
- var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", we = (e, t, n) => {
10
- L(() => {
11
- if (!e) return;
12
- let n = (e) => {
13
- e.key === "Escape" && t();
14
- };
15
- return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
16
- }, [e, t]), L(() => {
17
- if (e) return document.body.style.overflow = "hidden", () => {
18
- document.body.style.overflow = "";
19
- };
20
- }, [e]), L(() => {
21
- if (!e || n?.current == null) return;
22
- let t = n.current, r = document.activeElement instanceof HTMLElement ? document.activeElement : null;
23
- (t.querySelector(Ce) ?? t).focus();
24
- let i = (e) => {
25
- if (e.key !== "Tab") return;
26
- let n = Array.from(t.querySelectorAll(Ce));
27
- if (n.length === 0) {
28
- e.preventDefault(), t.focus();
29
- return;
30
- }
31
- let r = n[0], i = n[n.length - 1], a = document.activeElement, o = a === t || a === null || !t.contains(a);
32
- e.shiftKey ? (a === r || o) && (e.preventDefault(), i.focus()) : (a === i || o) && (e.preventDefault(), r.focus());
33
- };
34
- return document.addEventListener("keydown", i), () => {
35
- document.removeEventListener("keydown", i), r?.focus();
36
- };
37
- }, [e, n]);
38
- }, Te = {
39
- backdrop: "_backdrop_1d50f_9",
40
- sheet: "_sheet_1d50f_13",
41
- "slide-up": "_slide-up_1d50f_1",
42
- title: "_title_1d50f_18",
43
- divider: "_divider_1d50f_22"
44
- }, Ee = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: a, "aria-label": o, style: l, titleClassName: u = "dial-body-semi-text", className: d, colors: h, children: _ }) => {
45
- let y = B(null);
46
- if (we(e, r, y), !e || typeof document > "u") return null;
47
- let b = s({
48
- "--ci-backdrop": h?.backdrop,
49
- "--ci-sheet-bg": h?.sheetBg,
50
- "--ci-sheet-text": h?.sheetText,
51
- "--ci-sheet-divider": h?.divider
1
+ import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, MIME_TYPE_EXT_MAP as r, RESIZABLE_TEXTAREA_CLASS_NAME as i, RequestStatus as a, ResponseFormat as o, SELECT_LIST_MAX_HEIGHT_PX as s, buildCssVars as c, mergeClasses as l, normalizeMimeType as u, useIsMobile as d } from "@epam/ai-dial-chat-shared";
2
+ import { BASE_ICON_SIZE as f, BottomSheet as p, Button as m, ButtonVariant as h, DIAL_ICON_SIZE as g, DIAL_KIT_ICON_STROKE as _, Dropdown as v, ElementSize as y, ErrorText as b, GhostIconButton as x, Highlight as S, MenuItemMark as C, NeutralButton as w, NeutralIconButton as T, Popup as E, PopupSize as D, PrimaryButton as ee, PrimaryIconButton as O, RadioGroup as k, RadioGroupOrientation as A, Search as j, Skeleton as te, SkeletonVariant as ne, Slider as re, Spinner as ie, Textarea as ae, TextareaResize as oe, Tooltip as M } from "@epam/ai-dial-ui-kit";
3
+ import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
4
+ import { AttachmentTray as se, MAX_UPLOADS_PER_MINUTE as I, generateAttachmentId as ce, useClipboardPaste as le } from "@epam/ai-dial-attachment-input";
5
+ import { IconArrowNarrowRight as ue, IconCheck as de, IconChevronDown as fe, IconChevronRight as pe, IconFile as me, IconMicrophone as he, IconPaperclip as ge, IconPlayerStop as _e, IconPlus as ve, IconSettings as ye, IconTool as be, IconX as xe } from "@tabler/icons-react";
6
+ import { createElement as Se, forwardRef as Ce, memo as we, useCallback as L, useEffect as R, useId as Te, useImperativeHandle as Ee, useLayoutEffect as De, useMemo as z, useRef as B, useState as V } from "react";
7
+ //#region src/constants/public-class-names.ts
8
+ var H = {
9
+ wrapper: "dial-ci-wrapper",
10
+ actionRow: "dial-ci-action-row",
11
+ textareaWrap: "dial-ci-textarea-wrap",
12
+ addCluster: "dial-ci-add-cluster",
13
+ toolsChips: "dial-ci-tools-chips",
14
+ footerActions: "dial-ci-footer-actions",
15
+ modelSelectorButton: "dial-ci-model-selector-button",
16
+ modelSelectorIcon: "dial-ci-model-selector-icon",
17
+ modelSelectorCaret: "dial-ci-model-selector-caret",
18
+ modelMenu: "dial-ci-model-menu",
19
+ modelMenuSearch: "dial-ci-model-menu-search",
20
+ modelMenuItem: "dial-ci-model-menu-item",
21
+ modelMenuItemSelected: "dial-ci-model-menu-item-selected"
22
+ }, Oe = {
23
+ backdrop: "_backdrop_1ym62_8",
24
+ sheet: "_sheet_1ym62_12",
25
+ title: "_title_1ym62_16",
26
+ divider: "_divider_1ym62_20"
27
+ }, U = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: a, "aria-label": o, style: s, titleClassName: u = "dial-body-semi-text", className: d, colors: f, children: m }) => {
28
+ let h = c({
29
+ "--ci-backdrop": f?.backdrop,
30
+ "--ci-sheet-bg": f?.sheetBg,
31
+ "--ci-sheet-text": f?.sheetText,
32
+ "--ci-sheet-divider": f?.divider
52
33
  });
53
- return ve(/* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("div", {
54
- className: c(Te.backdrop, "fixed inset-0 z-[55]"),
55
- style: b,
56
- onPointerDown: r,
57
- "aria-hidden": !0
58
- }), /* @__PURE__ */ W("div", {
59
- ref: y,
60
- role: "dialog",
61
- "aria-modal": !0,
62
- "aria-label": t ?? o,
63
- tabIndex: -1,
34
+ return /* @__PURE__ */ P(p, {
35
+ open: e,
36
+ onClose: r,
37
+ title: t,
38
+ ariaLabel: o,
39
+ onBack: i,
40
+ backAriaLabel: a,
41
+ closeAriaLabel: n,
64
42
  style: {
65
- ...b,
66
- ...l
43
+ ...h,
44
+ ...s
67
45
  },
68
- className: c(Te.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col rounded-t-lg", d),
69
- children: [t != null && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ W("div", {
70
- className: "relative flex h-[60px] flex-shrink-0 items-center justify-center px-4",
71
- children: [
72
- i && /* @__PURE__ */ U("div", {
73
- className: "absolute start-4",
74
- children: /* @__PURE__ */ U(v, {
75
- icon: /* @__PURE__ */ U(ae, {
76
- size: p.LG,
77
- stroke: m,
78
- className: "rtl:scale-x-[-1]"
79
- }),
80
- "aria-label": a,
81
- onClick: i
82
- })
83
- }),
84
- /* @__PURE__ */ U("span", {
85
- className: c(Te.title, u),
86
- children: t
87
- }),
88
- /* @__PURE__ */ U("div", {
89
- className: "absolute end-4 m-2",
90
- children: /* @__PURE__ */ U(f, {
91
- ariaLabel: n,
92
- onClose: r,
93
- size: g.Standard
94
- })
95
- })
96
- ]
97
- }), /* @__PURE__ */ U("div", { className: c(Te.divider, "h-px flex-shrink-0") })] }), /* @__PURE__ */ U("div", {
98
- className: "overflow-y-auto",
99
- children: _
100
- })]
101
- })] }), document.body);
102
- }, De = async (e, t, n) => {
46
+ overlayStyle: h,
47
+ className: l(Oe.sheet, d),
48
+ overlayClassName: Oe.backdrop,
49
+ headerClassName: Oe.divider,
50
+ titleClassName: l(Oe.title, u),
51
+ children: m
52
+ });
53
+ }, ke = async (e, t, n) => {
103
54
  let r = 6e4 / t, i = [];
104
55
  for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
105
56
  await Promise.allSettled(i);
106
- }, 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 }) => {
107
- let [h, g] = V(n), _ = B(h);
108
- L(() => {
109
- _.current = h;
110
- }, [h]), L(() => () => {
111
- _.current.forEach((e) => {
57
+ }, Ae = ({ initialAttachments: n, onUploadAttachment: r, onAttachmentsChange: i, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, isDropDisabled: l = !1, pendingAttachments: u, onPendingAttachmentsConsumed: d, onExpandPastedText: f, maximumAttachmentsAmount: p, baseAttachmentsAmount: m = 0, onAttachmentsLimitExceeded: h }) => {
58
+ let [g, _] = V(n), v = B(g);
59
+ R(() => {
60
+ v.current = g;
61
+ }, [g]), R(() => () => {
62
+ v.current.forEach((e) => {
112
63
  e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
113
64
  });
114
65
  }, []);
115
- let v = I((e) => e.map((e) => {
116
- 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;
66
+ let y = L((e) => e.map((e) => {
67
+ let n = e.type.startsWith("image/"), r = e.type.startsWith("audio/"), i = n ? URL.createObjectURL(e) : void 0, o = r ? URL.createObjectURL(e) : void 0;
117
68
  return {
118
- id: xe(),
69
+ id: ce(),
119
70
  name: e.name,
120
71
  contentType: e.type,
121
72
  file: e,
122
73
  type: n ? t.Image : r ? t.Audio : t.File,
123
- status: i.Idle,
124
- previewUrl: a,
74
+ status: a.Idle,
75
+ previewUrl: i,
125
76
  playUrl: o
126
77
  };
127
- }), []), y = B(a);
128
- L(() => {
129
- y.current = a;
130
- }, [a]);
131
- let b = B(!0), x = I((e) => {
132
- g((t) => {
78
+ }), []), b = B(i);
79
+ R(() => {
80
+ b.current = i;
81
+ }, [i]);
82
+ let x = B(!0), S = L((e) => {
83
+ _((t) => {
133
84
  let n = e(t);
134
85
  return n === t ? t : n;
135
86
  });
136
87
  }, []);
137
- L(() => {
138
- if (b.current) {
139
- b.current = !1;
88
+ R(() => {
89
+ if (x.current) {
90
+ x.current = !1;
140
91
  return;
141
92
  }
142
- y.current?.(h);
143
- }, [h]);
144
- let S = I((e) => {
145
- g(e);
146
- }, []), C = I(async (t) => {
93
+ b.current?.(g);
94
+ }, [g]);
95
+ let C = L((e) => {
96
+ _(e);
97
+ }, []), w = L(async (t) => {
147
98
  if (r) {
148
- x((e) => e.map((e) => e.id === t.id ? {
99
+ S((e) => e.map((e) => e.id === t.id ? {
149
100
  ...e,
150
- status: i.Loading
101
+ status: a.Loading
151
102
  } : e));
152
103
  try {
153
104
  let { url: e, name: n } = await r(t);
154
- x((r) => r.map((r) => r.id === t.id ? {
105
+ S((r) => r.map((r) => r.id === t.id ? {
155
106
  ...r,
156
- status: i.Idle,
107
+ status: a.Idle,
157
108
  url: e,
158
109
  name: n
159
110
  } : r));
160
111
  } catch (n) {
161
112
  let r = typeof n == "object" && n && "errorReason" in n && Object.values(e).includes(n.errorReason) ? n.errorReason : void 0;
162
- x((e) => e.map((e) => e.id === t.id ? {
113
+ S((e) => e.map((e) => e.id === t.id ? {
163
114
  ...e,
164
- status: i.Error,
115
+ status: a.Error,
165
116
  ...r != null && { errorReason: r }
166
117
  } : e));
167
118
  }
168
119
  }
169
- }, [r, x]), w = I((e, t = !0) => {
170
- let n = new Set(_.current.map((e) => e.id)), r = e.filter((e) => !n.has(e.id));
120
+ }, [r, S]), T = L((e, t = !0) => {
121
+ let n = new Set(v.current.map((e) => e.id)), r = e.filter((e) => !n.has(e.id));
171
122
  if (r.length !== 0) {
172
- if (f != null && f > 0 && Number.isFinite(f)) {
173
- let e = p + _.current.length + r.length;
174
- if (e > f) {
123
+ if (p != null && p > 0 && Number.isFinite(p)) {
124
+ let e = m + v.current.length + r.length;
125
+ if (e > p) {
175
126
  r.forEach((e) => {
176
127
  e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
177
- }), m?.(e, f);
128
+ }), h?.(e, p);
178
129
  return;
179
130
  }
180
131
  }
181
- if (x((e) => [...e, ...r]), t) {
132
+ if (S((e) => [...e, ...r]), t) {
182
133
  let e = [];
183
134
  r.forEach((t) => {
184
135
  let n = o?.(t);
185
- n == null ? e.push(t) : x((e) => e.map((e) => e.id === t.id ? {
136
+ n == null ? e.push(t) : S((e) => e.map((e) => e.id === t.id ? {
186
137
  ...e,
187
- status: i.Error,
138
+ status: a.Error,
188
139
  errorReason: n
189
140
  } : e));
190
- }), De(e, be, C);
141
+ }), ke(e, I, w);
191
142
  }
192
143
  }
193
144
  }, [
194
- p,
195
- f,
196
145
  m,
197
- x,
198
- C,
146
+ p,
147
+ h,
148
+ S,
149
+ w,
199
150
  o
200
- ]);
201
- L(() => {
202
- s.length !== 0 && (w(v(s)), c?.());
151
+ ]), E = B(/* @__PURE__ */ new WeakSet());
152
+ R(() => {
153
+ if (s.length === 0) {
154
+ E.current = /* @__PURE__ */ new WeakSet();
155
+ return;
156
+ }
157
+ let e = s.filter((e) => !E.current.has(e));
158
+ e.length !== 0 && (e.forEach((e) => E.current.add(e)), l || T(y(e)), c?.());
203
159
  }, [
204
- w,
205
- v,
160
+ T,
161
+ y,
162
+ l,
206
163
  c,
207
164
  s
208
- ]), L(() => {
209
- l.length !== 0 && (w(l, !1), u?.());
165
+ ]), R(() => {
166
+ u.length !== 0 && (T(u, !1), d?.());
210
167
  }, [
211
- w,
212
- u,
213
- l
214
- ]), L(() => {
168
+ T,
169
+ d,
170
+ u
171
+ ]), R(() => {
215
172
  if (!o) return;
216
- let t = !1, n = [], r = _.current.map((r) => {
217
- if (r.status === i.Loading) return r;
218
- let a = o(r);
219
- if (a != null) return r.status === i.Error && r.errorReason === a ? r : (t = !0, {
173
+ let t = !1, n = [], r = v.current.map((r) => {
174
+ if (r.status === a.Loading) return r;
175
+ let i = o(r);
176
+ if (i != null) return r.status === a.Error && r.errorReason === i ? r : (t = !0, {
220
177
  ...r,
221
- status: i.Error,
222
- errorReason: a
178
+ status: a.Error,
179
+ errorReason: i
223
180
  });
224
- if (r.errorReason === e.UnsupportedType) {
181
+ if (r.errorReason === e.UnsupportedType || r.errorReason === e.FileTooLarge) {
225
182
  t = !0;
226
183
  let e = {
227
184
  ...r,
228
- status: i.Idle,
185
+ status: a.Idle,
229
186
  errorReason: void 0
230
187
  };
231
188
  return e.url ?? n.push(e), e;
232
189
  }
233
190
  return r;
234
191
  });
235
- t && x(() => r), n.forEach((e) => void C(e));
192
+ t && S(() => r), n.forEach((e) => void w(e));
236
193
  }, [
237
194
  o,
238
- x,
239
- C
195
+ S,
196
+ w
240
197
  ]);
241
- let T = I((e) => {
242
- x((t) => {
198
+ let D = L((e) => {
199
+ S((t) => {
243
200
  let n = t.find((t) => t.id === e);
244
201
  return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
245
202
  });
246
- }, [x]);
203
+ }, [S]);
247
204
  return {
248
- attachments: h,
249
- buildAttachments: v,
250
- addAttachments: w,
251
- resetAttachments: S,
252
- handleRemove: T,
253
- handleRetry: I((e) => {
254
- let t = h.find((t) => t.id === e);
255
- t && C(t);
256
- }, [h, C]),
257
- handleExpand: I(async (e) => {
258
- let n = h.find((t) => t.id === e);
205
+ attachments: g,
206
+ buildAttachments: y,
207
+ addAttachments: T,
208
+ resetAttachments: C,
209
+ handleRemove: D,
210
+ handleRetry: L((e) => {
211
+ let t = g.find((t) => t.id === e);
212
+ t && w(t);
213
+ }, [g, w]),
214
+ handleExpand: L(async (e) => {
215
+ let n = g.find((t) => t.id === e);
259
216
  if (!n || n.type !== t.Pasted) return;
260
217
  let r = await n.file.text();
261
- d?.(r), T(e);
218
+ f?.(r), D(e);
262
219
  }, [
263
- h,
264
- T,
265
- d
220
+ g,
221
+ D,
222
+ f
266
223
  ]),
267
- hasBlockedAttachments: h.some((e) => e.status === i.Loading || e.status === i.Error)
224
+ hasBlockedAttachments: g.some((e) => e.status === a.Loading || e.status === a.Error)
225
+ };
226
+ }, je = (e, t) => {
227
+ let n = t;
228
+ for (; n < e.length && !/\s/.test(e[n]);) n++;
229
+ return n;
230
+ }, Me = (e, t) => {
231
+ let n = t;
232
+ for (; n > 0 && !/\s/.test(e[n - 1]);) n--;
233
+ return {
234
+ start: n,
235
+ end: je(e, n)
268
236
  };
269
- }, ke = (e, t) => {
270
- if (!e.startsWith(t)) return !1;
271
- let n = e.slice(t.length);
272
- return !/\s/.test(n) && !n.includes(t);
273
- }, Ae = ({ config: e, message: t }) => {
274
- let [n, r] = V(!1), [i, a] = V(!1), o = e != null && ke(t, e.triggerPrefix) ? t.slice(e.triggerPrefix.length) : "", s = I((n, a, o) => {
275
- if (e == null || a || t !== "" || i) return;
276
- let s = n === e.triggerPrefix, c = o === "insertFromPaste" && ke(n, e.triggerPrefix);
277
- (s || c) && r(!0);
237
+ }, W = (e, t) => e.startsWith(t) && !e.slice(t.length).includes(t), Ne = "[role=\"option\"]:not([aria-disabled=\"true\"])", Pe = /* @__PURE__ */ function(e) {
238
+ return e.Next = "next", e.Previous = "previous", e;
239
+ }({}), Fe = ({ config: e, message: t }) => {
240
+ let [n, r] = V(!1), [i, a] = V(null), [o, s] = V(null), c = B(null);
241
+ c.current = i;
242
+ let l = e != null && i != null && i <= t.length ? (() => {
243
+ let n = t.slice(i, je(t, i));
244
+ return W(n, e.triggerPrefix) ? n.slice(e.triggerPrefix.length) : "";
245
+ })() : "", u = L((t, n, i) => {
246
+ if (e == null || i) return;
247
+ let { start: c, end: l } = Me(t, n), u = t.slice(c, l);
248
+ if (!W(u, e.triggerPrefix)) {
249
+ r(!1), s(null), a(null);
250
+ return;
251
+ }
252
+ if (a(c), u === e.triggerPrefix || o !== c) {
253
+ r(!0), s(null);
254
+ return;
255
+ }
256
+ r(!1);
257
+ }, [e, o]);
258
+ R(() => {
259
+ if (e == null) {
260
+ r(!1), s(null), a(null);
261
+ return;
262
+ }
263
+ let n = c.current;
264
+ if (n == null) return;
265
+ let i = Math.min(n, t.length);
266
+ W(t.slice(i, je(t, i)), e.triggerPrefix) || (r(!1), s(null), a(null));
267
+ }, [e, t]);
268
+ let d = L(() => {
269
+ r(!1), s(i);
270
+ }, [i]), f = L(() => {
271
+ r(!1);
272
+ }, []), p = L((n) => {
273
+ if (e == null) return;
274
+ let { start: i, end: s } = Me(t, n);
275
+ if (!W(t.slice(i, s), e.triggerPrefix)) {
276
+ a(null), r(!1);
277
+ return;
278
+ }
279
+ a(i), r(o !== i);
278
280
  }, [
279
281
  e,
280
282
  t,
281
- i
282
- ]);
283
- return L(() => {
284
- if (e == null) {
285
- r(!1), a(!1);
283
+ o
284
+ ]), m = Te(), h = B(null), [g, _] = V(null);
285
+ R(() => {
286
+ _(null);
287
+ }, [n, l]);
288
+ let v = L(() => Array.from(h.current?.querySelectorAll(Ne) ?? []), []), y = L((e) => {
289
+ let t = v();
290
+ if (t.length === 0) {
291
+ _(null);
286
292
  return;
287
293
  }
288
- ke(t, e.triggerPrefix) || (r(!1), a(!1));
289
- }, [e, t]), {
294
+ let n = t.findIndex((e) => e.id === g), r = t[e === "next" ? (n + 1) % t.length : (n <= 0 ? t.length : n) - 1];
295
+ _(r.id), r.scrollIntoView?.({ block: "nearest" });
296
+ }, [v, g]), b = L(() => v().find((e) => e.id === g) ?? null, [v, g]);
297
+ return {
290
298
  isMenuOpen: n,
291
- query: o,
292
- dismiss: I(() => {
293
- r(!1), a(!0);
294
- }, []),
295
- handleValueChange: s
299
+ query: l,
300
+ activeWordStart: i,
301
+ dismiss: d,
302
+ closeOnOutsidePress: f,
303
+ handleCaretMove: p,
304
+ handleValueChange: u,
305
+ listboxId: m,
306
+ overlayRef: h,
307
+ activeOptionId: n ? g : null,
308
+ moveActiveOption: y,
309
+ getActiveOption: b
296
310
  };
297
- }, je = (e, t) => !e.slice(0, t).includes("\n"), Me = (e, t) => !e.slice(t).includes("\n"), Ne = (e) => {
311
+ }, Ie = (e, t) => !e.slice(0, t).includes("\n"), Le = (e, t) => !e.slice(t).includes("\n"), Re = (e) => {
298
312
  let t = B(e);
299
313
  t.current = e;
300
- let n = B(-1), r = B(""), i = I((e, i, a) => {
314
+ let n = B(-1), r = B(""), i = L((e, i, a) => {
301
315
  let o = t.current;
302
- return !o || o.length === 0 ? null : e === "up" ? !je(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 || !Me(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
303
- }, []), a = I(() => {
316
+ return !o || o.length === 0 ? null : e === "up" ? !Ie(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 || !Le(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
317
+ }, []), a = L(() => {
304
318
  n.current = -1, r.current = "";
305
- }, []), o = I(() => {
319
+ }, []), o = L(() => {
306
320
  n.current = -1, r.current = "";
307
321
  }, []);
308
322
  return z(() => ({
@@ -314,185 +328,274 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
314
328
  a,
315
329
  o
316
330
  ]);
317
- }, Pe = ({ messageProp: e, messageRevision: t }) => {
331
+ }, ze = (e, t, n, r, i) => {
332
+ let a = [...t].sort((e, t) => e.start - t.start), o = [...n].sort((e, t) => e.offset - t.offset), s = [], c = 0, l = 0, u = (t, n) => {
333
+ if (n <= t) return;
334
+ let r = t;
335
+ o.filter((e) => e.offset >= t && e.offset <= n).forEach((t) => {
336
+ t.offset > r && s.push(/* @__PURE__ */ P("span", {
337
+ "aria-hidden": !0,
338
+ children: e.slice(r, t.offset)
339
+ }, `text-${l++}`)), s.push(t.node), r = t.offset;
340
+ }), r < n && s.push(/* @__PURE__ */ P("span", {
341
+ "aria-hidden": !0,
342
+ children: e.slice(r, n)
343
+ }, `text-${l++}`));
344
+ };
345
+ return a.forEach((t, n) => {
346
+ if (u(c, t.start), t.start + t.length <= c) return;
347
+ let a = e.slice(t.start, t.start + t.length);
348
+ s.push(t.render ? /* @__PURE__ */ P("span", {
349
+ className: "pointer-events-auto",
350
+ children: t.render()
351
+ }, `range-${n}`) : /* @__PURE__ */ P("span", {
352
+ "aria-hidden": !0,
353
+ className: t.isUnsupported ? i : r,
354
+ children: a
355
+ }, `range-${n}`)), c = Math.max(c, t.start + t.length);
356
+ }), u(c, e.length), s;
357
+ }, Be = (e, t) => {
358
+ let n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, { acceptNode: (e) => e.parentElement?.closest("[data-mirror-synthetic]") == null ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT }), r = 0;
359
+ for (let e = n.nextNode(); e != null; e = n.nextNode()) {
360
+ let n = e.textContent?.length ?? 0;
361
+ if (t <= r + n) return {
362
+ node: e,
363
+ offset: t - r
364
+ };
365
+ r += n;
366
+ }
367
+ return null;
368
+ }, Ve = (e, t, n) => {
369
+ let r = Be(e, t), i = Be(e, n);
370
+ if (r == null || i == null) return null;
371
+ let a = document.createRange();
372
+ return a.setStart(r.node, r.offset), a.setEnd(i.node, i.offset), a;
373
+ }, He = ({ textareaRef: e, message: t, isMirrorActive: n }) => {
374
+ let r = B(null), [i, a] = V([]), o = L(() => {
375
+ let t = e.current, i = r.current, o = t?.selectionStart, s = t?.selectionEnd;
376
+ if (!n || t == null || i == null || o == null || s == null || o === s) {
377
+ a((e) => e.length === 0 ? e : []);
378
+ return;
379
+ }
380
+ let c = Ve(i, o, s);
381
+ if (c == null) {
382
+ a((e) => e.length === 0 ? e : []);
383
+ return;
384
+ }
385
+ let l = i.getBoundingClientRect();
386
+ a(Array.from(c.getClientRects()).map((e) => new DOMRect(e.left - l.left, e.top - l.top, e.width, e.height)));
387
+ }, [n, e]);
388
+ return De(() => {
389
+ o();
390
+ }, [o, t]), R(() => {
391
+ if (!n) return;
392
+ let t = e.current;
393
+ if (t == null || typeof ResizeObserver > "u") return;
394
+ let r = new ResizeObserver(o);
395
+ return r.observe(t), () => r.disconnect();
396
+ }, [
397
+ n,
398
+ e,
399
+ o
400
+ ]), {
401
+ mirrorRef: r,
402
+ selectionRects: i,
403
+ updateSelectionRects: o
404
+ };
405
+ }, Ue = ({ messageProp: e, messageRevision: t }) => {
318
406
  let [n, r] = V(e), i = B(null);
319
- return L(() => {
407
+ return R(() => {
320
408
  r(e);
321
409
  }, [e, t]), {
322
410
  message: n,
323
411
  setMessage: r,
324
412
  textareaRef: i
325
413
  };
326
- }, Fe = (e, t, n) => {
327
- let r = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set;
328
- r ? r.call(e, t) : e.value = t, e.setSelectionRange(n, n), e.dispatchEvent(new Event("input", { bubbles: !0 }));
329
- }, Ie = ({ insertion: e, textareaRef: t }) => {
414
+ }, We = (e, t, n, r = n) => {
415
+ let i = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set;
416
+ i ? i.call(e, t) : e.value = t, e.setSelectionRange(n, r), e.dispatchEvent(new Event("input", { bubbles: !0 }));
417
+ }, Ge = (e) => e.key.toLowerCase() === "z" && (e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey, Ke = ({ insertion: e, textareaRef: t }) => {
330
418
  let n = e?.revision, r = B(e?.text);
331
419
  r.current = e?.text;
332
- let i = B(n);
333
- L(() => {
420
+ let i = B(n), a = B(null);
421
+ return R(() => {
334
422
  if (n === i.current) return;
335
423
  i.current = n;
336
- let e = t.current, a = r.current;
337
- if (!e || !a) return;
338
- let { value: o, selectionStart: s, selectionEnd: c } = e, l = s ?? o.length, u = c ?? l;
339
- e.focus(), !(typeof document.execCommand == "function" && document.execCommand("insertText", !1, a)) && Fe(e, `${o.slice(0, l)}${a}${o.slice(u)}`, l + a.length);
340
- }, [n, t]);
341
- }, Le = /* @__PURE__ */ function(e) {
424
+ let e = r.current;
425
+ !t.current || !e || queueMicrotask(() => {
426
+ let n = t.current;
427
+ if (!n) return;
428
+ let { value: r, selectionStart: i, selectionEnd: o } = n, s = i ?? r.length, c = o ?? s;
429
+ if (n.focus(), a.current = null, typeof document.execCommand == "function" && document.execCommand("insertText", !1, e)) return;
430
+ let l = `${r.slice(0, s)}${e}${r.slice(c)}`;
431
+ We(n, l, s + e.length), a.current = {
432
+ insertedValue: l,
433
+ previousValue: r,
434
+ previousSelectionStart: s,
435
+ previousSelectionEnd: c
436
+ };
437
+ });
438
+ }, [n, t]), { handleUndoKeyDown: (e) => {
439
+ let n = a.current, r = t.current;
440
+ return n == null || r == null || !Ge(e) || (a.current = null, r.value !== n.insertedValue) ? !1 : (e.preventDefault(), We(r, n.previousValue, n.previousSelectionStart, n.previousSelectionEnd), !0);
441
+ } };
442
+ }, qe = /* @__PURE__ */ function(e) {
342
443
  return e.Idle = "idle", e.Recording = "recording", e.Processing = "processing", e.Error = "error", e;
343
- }({}), Re = /* @__PURE__ */ function(e) {
444
+ }({}), Je = /* @__PURE__ */ function(e) {
344
445
  return e.Dictation = "dictation", e.Attachment = "attachment", e;
345
- }({}), ze = [
446
+ }({}), Ye = [
346
447
  "audio/webm;codecs=opus",
347
448
  "audio/ogg;codecs=opus",
348
449
  "audio/webm"
349
- ], Be = 100, Ve = 100, He = .01, Ue = ({ onAttachAudio: e, onTranscribeAudio: t, onTranscript: n, errorLabel: r = "Voice input failed" }) => {
350
- let [i, a] = V("idle"), [o, s] = V(null), c = B(null), l = B(null), u = B({
450
+ ], Xe = 100, Ze = 100, Qe = .01, $e = ({ onAttachAudio: e, onTranscribeAudio: t, onTranscript: n, errorLabel: i = "Voice input failed" }) => {
451
+ let [a, o] = V("idle"), [s, c] = V(null), l = B(null), d = B(null), f = B({
351
452
  onAttachAudio: e,
352
453
  onTranscribeAudio: t,
353
454
  onTranscript: n,
354
- errorLabel: r
455
+ errorLabel: i
355
456
  });
356
- u.current = {
457
+ f.current = {
357
458
  onAttachAudio: e,
358
459
  onTranscribeAudio: t,
359
460
  onTranscript: n,
360
- errorLabel: r
461
+ errorLabel: i
361
462
  };
362
- let d = I((e = "dictation") => {
363
- if (l.current) return;
463
+ let p = L((e = "dictation") => {
464
+ if (d.current) return;
364
465
  let t = { controller: new AbortController() };
365
- l.current = t, a("recording");
366
- let { signal: n } = t.controller, r = e === "dictation" ? u.current.onTranscribeAudio : void 0, i, o, d, f, p = !1, m = !1, h = [], g = () => {
367
- clearInterval(f), f = void 0;
368
- }, _ = () => {
369
- g(), d &&= (d.ondataavailable = null, d.onstop = null, d.onerror = null, d.state !== "inactive" && d.stop(), void 0), i?.getTracks().forEach((e) => e.stop()), i = void 0, o &&= (o.close(), void 0), l.current === t && (c.current = null);
466
+ d.current = t, c(null), o("recording");
467
+ let { signal: n } = t.controller, i = e === "dictation" ? f.current.onTranscribeAudio : void 0, a, s, p, m, h = !1, g = !1, _ = [], v = () => {
468
+ clearInterval(m), m = void 0;
469
+ }, y = () => {
470
+ v(), p &&= (p.ondataavailable = null, p.onstop = null, p.onerror = null, p.state !== "inactive" && p.stop(), void 0), a?.getTracks().forEach((e) => e.stop()), a = void 0, s &&= (s.close(), void 0), d.current === t && (l.current = null);
370
471
  };
371
472
  n.addEventListener("abort", () => {
372
- h.length = 0, _();
473
+ _.length = 0, y();
373
474
  }, { once: !0 });
374
- let v = () => {
375
- n.aborted || (_(), l.current = null, s(null), a("idle"));
376
- }, y = (e) => {
377
- n.aborted || (t.controller.abort(), s(e instanceof Error ? e.message : u.current.errorLabel), a("error"));
378
- }, b = () => {
379
- if (!i || n.aborted) return;
380
- let e = ze.find((e) => MediaRecorder.isTypeSupported(e)), t = new MediaRecorder(i, e ? { mimeType: e } : void 0);
381
- d = t;
382
- let o = Date.now(), s = !1, l = !1, b = new Uint8Array(c.current?.fftSize ?? 256), x = async () => {
383
- if (!(m || n.aborted)) {
384
- m = !0, p = !0;
475
+ let b = () => {
476
+ n.aborted || (y(), d.current = null, c(null), o("idle"));
477
+ }, x = (e) => {
478
+ n.aborted || (t.controller.abort(), d.current = null, c(e instanceof Error ? e.message : f.current.errorLabel), o("error"));
479
+ }, S = () => {
480
+ if (!a || n.aborted) return;
481
+ let e = Ye.find((e) => MediaRecorder.isTypeSupported(e)), t = new MediaRecorder(a, e ? { mimeType: e } : void 0);
482
+ p = t;
483
+ let s = Date.now(), c = !1, d = !1, S = new Uint8Array(l.current?.fftSize ?? 256), C = async () => {
484
+ if (!(g || n.aborted)) {
485
+ g = !0, h = !0;
385
486
  try {
386
- let i = t.mimeType || e || "audio/webm", c = new Blob(h, { type: i });
387
- h.length = 0, _();
388
- let d = Date.now() - o >= Ve;
389
- if (c.size && (!r || d && (!s || l))) {
390
- let e = i.split(";")[0].split("/")[1] ?? "webm", t = new File([c], "voice-" + crypto.randomUUID() + "." + e, { type: i });
391
- if (r) {
392
- a("processing");
393
- let e = await r(t, n);
487
+ let a = t.mimeType || e || "audio/webm", l = new Blob(_, { type: a });
488
+ _.length = 0, y();
489
+ let p = Date.now() - s >= Ze;
490
+ if (l.size && (!i || p && (!c || d))) {
491
+ let e = u(a), t = r[e] ?? e.split("/")[1] ?? "webm", s = new File([l], "voice-" + crypto.randomUUID() + "." + t, { type: a });
492
+ if (i) {
493
+ o("processing");
494
+ let e = await i(s, n);
394
495
  if (n.aborted) return;
395
- u.current.onTranscript?.(e);
396
- } else u.current.onAttachAudio(t);
397
- } else r && u.current.onTranscript?.("");
398
- v();
496
+ f.current.onTranscript?.(e);
497
+ } else f.current.onAttachAudio(s);
498
+ } else i && f.current.onTranscript?.("");
499
+ b();
399
500
  } catch (e) {
400
- y(e);
501
+ x(e);
401
502
  }
402
503
  }
403
504
  };
404
505
  t.ondataavailable = (e) => {
405
- e.data.size && h.push(e.data);
406
- }, t.onerror = () => y(Error(u.current.errorLabel)), t.onstop = () => {
407
- x();
408
- }, t.start(), r && (f = setInterval(() => {
409
- let e = c.current;
506
+ e.data.size && _.push(e.data);
507
+ }, t.onerror = () => x(Error(f.current.errorLabel)), t.onstop = () => {
508
+ C();
509
+ }, t.start(), i && (m = setInterval(() => {
510
+ let e = l.current;
410
511
  if (!e) return;
411
- e.getByteTimeDomainData(b), s = !0;
512
+ e.getByteTimeDomainData(S), c = !0;
412
513
  let t = 0;
413
- for (let e of b) t += ((e - 128) / 128) ** 2;
414
- Math.sqrt(t / b.length) >= He && (l = !0, g());
415
- }, Be));
514
+ for (let e of S) t += ((e - 128) / 128) ** 2;
515
+ Math.sqrt(t / S.length) >= Qe && (d = !0, v());
516
+ }, Xe));
416
517
  };
417
518
  t.stop = () => {
418
- p || n.aborted || (p = !0, g(), a("processing"), d?.state === "recording" && d.stop());
519
+ h || n.aborted || (h = !0, v(), o("processing"), p?.state === "recording" && p.stop());
419
520
  }, (async () => {
420
521
  try {
421
522
  let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
422
- if (n.aborted || p) {
423
- e.getTracks().forEach((e) => e.stop()), v();
523
+ if (n.aborted || h) {
524
+ e.getTracks().forEach((e) => e.stop()), b();
424
525
  return;
425
526
  }
426
- i = e, o = new AudioContext();
427
- let t = o.createAnalyser();
428
- t.fftSize = 256, c.current = t, o.createMediaStreamSource(i).connect(t), b(), a("recording");
527
+ a = e, s = new AudioContext();
528
+ let t = s.createAnalyser();
529
+ t.fftSize = 256, l.current = t, s.createMediaStreamSource(a).connect(t), S(), o("recording");
429
530
  } catch (e) {
430
- y(e);
531
+ x(e);
431
532
  }
432
533
  })();
433
- }, []), f = I(() => l.current?.stop?.(), []), p = I(() => {
434
- l.current?.controller.abort(), l.current = null, s(null), a("idle");
534
+ }, []), m = L(() => d.current?.stop?.(), []), h = L(() => {
535
+ d.current?.controller.abort(), d.current = null, c(null), o("idle");
435
536
  }, []);
436
- return L(() => () => {
437
- l.current?.controller.abort(), l.current = null;
537
+ return R(() => () => {
538
+ d.current?.controller.abort(), d.current = null;
438
539
  }, []), {
439
- state: i,
440
- analyserNodeRef: c,
441
- errorMessage: o,
442
- startRecording: d,
443
- stopRecording: f,
444
- discardRecording: p
540
+ state: a,
541
+ analyserNodeRef: l,
542
+ errorMessage: s,
543
+ startRecording: p,
544
+ stopRecording: m,
545
+ discardRecording: h
445
546
  };
446
- }, We = /* @__PURE__ */ function(e) {
547
+ }, et = /* @__PURE__ */ function(e) {
447
548
  return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
448
- }({}), Ge = {
549
+ }({}), tt = /* @__PURE__ */ function(e) {
550
+ return e.Stacked = "stacked", e.Inline = "inline", e;
551
+ }({}), nt = {
449
552
  item: "_item_1sr2n_1",
450
553
  itemIcon: "_itemIcon_1sr2n_11"
451
- }, Ke = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: a, className: o, titleClassName: l = "dial-body-semi-text", itemLabelClassName: u = "dial-small-text", btnTextClassName: f = "", colors: p }) => {
452
- let m = (e) => {
554
+ }, rt = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: a, className: o, titleClassName: s = "dial-body-semi-text", itemLabelClassName: u = "dial-small-text", btnTextClassName: d = "", colors: f }) => {
555
+ let p = (e) => {
453
556
  e(), r();
454
- }, h = s({
455
- "--ci-sheet-text": p?.itemText,
456
- "--ci-sheet-item-hover": p?.itemHoverBg,
457
- "--ci-sheet-item-active": p?.itemActiveBg,
458
- "--ci-sheet-icon": p?.itemIcon
557
+ }, h = c({
558
+ "--ci-sheet-text": f?.itemText,
559
+ "--ci-sheet-item-hover": f?.itemHoverBg,
560
+ "--ci-sheet-item-active": f?.itemActiveBg,
561
+ "--ci-sheet-icon": f?.itemIcon
459
562
  });
460
- return /* @__PURE__ */ U(Ee, {
563
+ return /* @__PURE__ */ P(U, {
461
564
  isOpen: e,
462
565
  title: t,
463
566
  closeLabel: n,
464
567
  onClose: r,
465
568
  style: i,
466
569
  className: o,
467
- titleClassName: l,
468
- colors: p?.shell,
469
- children: /* @__PURE__ */ U("ul", {
570
+ titleClassName: s,
571
+ colors: f?.shell,
572
+ children: /* @__PURE__ */ P("ul", {
470
573
  role: "list",
471
574
  className: "flex flex-col",
472
575
  style: h,
473
- children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ U("li", { children: /* @__PURE__ */ U(d, {
576
+ children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ P("li", { children: /* @__PURE__ */ P(m, {
474
577
  type: "button",
475
- className: c(Ge.item, "w-full gap-3 px-4 py-[10px] text-start"),
476
- iconBefore: /* @__PURE__ */ U("span", {
477
- className: Ge.itemIcon,
578
+ className: l(nt.item, "w-full gap-3 px-4 py-[10px] text-start"),
579
+ iconBefore: /* @__PURE__ */ P("span", {
580
+ className: nt.itemIcon,
478
581
  children: n
479
582
  }),
480
- iconAfter: r ? /* @__PURE__ */ U("span", {
583
+ iconAfter: r ? /* @__PURE__ */ P("span", {
481
584
  className: "ms-auto",
482
585
  children: r
483
586
  }) : null,
484
- textClassName: f,
485
- label: /* @__PURE__ */ U("span", {
587
+ textClassName: d,
588
+ label: /* @__PURE__ */ P("span", {
486
589
  className: u,
487
590
  children: t
488
591
  }),
489
- onClick: () => m(i)
592
+ onClick: () => p(i)
490
593
  }) }, e))
491
594
  })
492
595
  });
493
- }, qe = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
596
+ }, it = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
494
597
  let [s, c] = V(t), [l, u] = V(n), [d, f] = V(r), p = B(o);
495
- L(() => {
598
+ R(() => {
496
599
  o && !p.current && (c(t), u(n), f(r)), p.current = o;
497
600
  }, [
498
601
  o,
@@ -509,7 +612,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
509
612
  setResponseFormat: c,
510
613
  setSystemPrompt: u,
511
614
  setTemperature: f,
512
- handleSubmit: I(() => {
615
+ handleSubmit: L(() => {
513
616
  if (!m) return;
514
617
  let t = {};
515
618
  e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
@@ -523,17 +626,17 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
523
626
  a
524
627
  ])
525
628
  };
526
- }, G = { label: "_label_14i7c_1" }, Je = ({ features: e, responseFormat: t, systemPrompt: n, temperature: i, onResponseFormatChange: o, onSystemPromptChange: l, onTemperatureChange: u, responseFormatLabel: d = "Response format", responseFormatHint: f = "Applies to new and existing messages", responseFormatMarkdownLabel: p = "Markdown", responseFormatPlainTextLabel: m = "Plain text", systemPromptLabel: h = "System prompt", systemPromptTooltip: g = "Enter a prompt", temperatureLabel: _ = "Temperature", temperatureLabels: v = [
629
+ }, at = { label: "_label_14i7c_1" }, ot = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: a, onSystemPromptChange: s, onTemperatureChange: u, responseFormatLabel: d = "Response format", responseFormatHint: f = "Applies to new and existing messages", responseFormatMarkdownLabel: p = "Markdown", responseFormatPlainTextLabel: m = "Plain text", systemPromptLabel: h = "System prompt", systemPromptTooltip: g = "Enter a prompt", temperatureLabel: _ = "Temperature", temperatureLabels: v = [
527
630
  "Precise",
528
631
  "Neutral",
529
632
  "Creative"
530
633
  ], temperatureHint: y, labelClassName: b = "!dial-small-semi-text", colors: x }) => {
531
- let S = s({ "--csf-label-text": x?.labelText }), C = c(b, G.label, "gap-1");
532
- return /* @__PURE__ */ W("div", {
634
+ let S = c({ "--csf-label-text": x?.labelText }), C = l(b, at.label, "gap-1");
635
+ return /* @__PURE__ */ F("div", {
533
636
  className: "flex flex-col gap-4 px-6 pb-3",
534
637
  style: S,
535
638
  children: [
536
- e.responseFormat && /* @__PURE__ */ U(E, {
639
+ e.responseFormat && /* @__PURE__ */ P(k, {
537
640
  id: "response-format",
538
641
  labelProps: {
539
642
  label: d,
@@ -541,35 +644,35 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
541
644
  caption: f
542
645
  },
543
646
  optionsClassName: "mb-2",
544
- orientation: D.Column,
545
- value: t ?? a.Markdown,
647
+ orientation: A.Column,
648
+ value: t ?? o.Markdown,
546
649
  items: [{
547
- value: a.Markdown,
650
+ value: o.Markdown,
548
651
  label: p
549
652
  }, {
550
- value: a.PlainText,
653
+ value: o.PlainText,
551
654
  label: m
552
655
  }],
553
- onChange: (e) => o(e)
656
+ onChange: (e) => a(e)
554
657
  }),
555
- e.systemPrompt && /* @__PURE__ */ U(ne, {
658
+ e.systemPrompt && /* @__PURE__ */ P(ae, {
556
659
  value: n,
557
660
  placeholder: g,
558
- className: r,
559
- resize: re.Vertical,
661
+ className: i,
662
+ resize: oe.Vertical,
560
663
  labelProps: {
561
664
  className: C,
562
665
  label: h
563
666
  },
564
- onChange: (e) => l(e ?? "")
667
+ onChange: (e) => s(e ?? "")
565
668
  }),
566
- e.temperature && /* @__PURE__ */ U(A, {
669
+ e.temperature && /* @__PURE__ */ P(re, {
567
670
  labelProps: {
568
671
  label: _,
569
672
  className: C,
570
673
  caption: y
571
674
  },
572
- value: i,
675
+ value: r,
573
676
  min: 0,
574
677
  max: 1,
575
678
  step: .1,
@@ -579,17 +682,17 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
579
682
  })
580
683
  ]
581
684
  });
582
- }, Ye = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: o, initialResponseFormat: s, 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 }) => {
583
- let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat: k, setSystemPrompt: ee, setTemperature: A, handleSubmit: te } = qe({
685
+ }, st = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: o, initialResponseFormat: s, initialSystemPrompt: c, 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 }) => {
686
+ let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: O, setSystemPrompt: k, setTemperature: A, handleSubmit: j } = it({
584
687
  isOpen: e,
585
688
  features: o,
586
689
  initialResponseFormat: s,
587
- initialSystemPrompt: l,
690
+ initialSystemPrompt: c,
588
691
  initialTemperature: u,
589
692
  onSave: d,
590
693
  onClose: r
591
694
  });
592
- return /* @__PURE__ */ W(Ee, {
695
+ return /* @__PURE__ */ F(U, {
593
696
  isOpen: e,
594
697
  title: f,
595
698
  closeLabel: i,
@@ -597,13 +700,13 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
597
700
  onBack: t,
598
701
  backLabel: n,
599
702
  style: a,
600
- children: [/* @__PURE__ */ U(Je, {
703
+ children: [/* @__PURE__ */ P(ot, {
601
704
  features: o,
602
- responseFormat: T,
603
- systemPrompt: E,
604
- temperature: D,
605
- onResponseFormatChange: k,
606
- onSystemPromptChange: ee,
705
+ responseFormat: w,
706
+ systemPrompt: T,
707
+ temperature: E,
708
+ onResponseFormatChange: O,
709
+ onSystemPromptChange: k,
607
710
  onTemperatureChange: A,
608
711
  responseFormatLabel: p,
609
712
  responseFormatHint: m,
@@ -614,23 +717,23 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
614
717
  temperatureLabel: y,
615
718
  temperatureLabels: b,
616
719
  temperatureHint: x
617
- }), /* @__PURE__ */ U("div", {
618
- className: c("px-6 py-4 mobile:pb-8"),
619
- children: /* @__PURE__ */ U(ie, {
720
+ }), /* @__PURE__ */ P("div", {
721
+ className: l("px-6 py-4 mobile:pb-8"),
722
+ children: /* @__PURE__ */ P(M, {
620
723
  tooltip: C,
621
- hideTooltip: O || !C,
724
+ hideTooltip: D || !C,
622
725
  triggerClassName: "w-full",
623
- children: /* @__PURE__ */ U(w, {
726
+ children: /* @__PURE__ */ P(ee, {
624
727
  label: S,
625
- onClick: te,
626
- disabled: !O,
728
+ onClick: j,
729
+ disabled: !D,
627
730
  className: "w-full"
628
731
  })
629
732
  })
630
733
  })]
631
734
  });
632
- }, Xe = { modal: "_modal_kl0h0_1" }, Ze = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", titleClassName: s = "dial-h1-text", responseFormatLabel: c, responseFormatHint: l, responseFormatMarkdownLabel: u, responseFormatPlainTextLabel: d, systemPromptLabel: f, systemPromptTooltip: p, temperatureLabel: m, temperatureLabels: h, temperatureHint: g, saveLabel: _ = "Apply changes", saveDisabledTooltip: v, backgroundClassName: y = Xe.modal }) => {
633
- let { responseFormat: b, systemPrompt: x, temperature: T, canSubmit: E, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit: ee } = qe({
735
+ }, ct = { modal: "_modal_kl0h0_1" }, lt = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", titleClassName: s = "dial-h1-text", responseFormatLabel: c, responseFormatHint: l, responseFormatMarkdownLabel: u, responseFormatPlainTextLabel: d, systemPromptLabel: f, systemPromptTooltip: p, temperatureLabel: m, temperatureLabels: g, temperatureHint: _, saveLabel: v = "Apply changes", saveDisabledTooltip: y, backgroundClassName: b = ct.modal }) => {
736
+ let { responseFormat: x, systemPrompt: S, temperature: C, canSubmit: w, setResponseFormat: T, setSystemPrompt: ee, setTemperature: O, handleSubmit: k } = it({
634
737
  features: e,
635
738
  initialResponseFormat: t,
636
739
  initialSystemPrompt: n,
@@ -638,33 +741,31 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
638
741
  onSave: i,
639
742
  onClose: a
640
743
  });
641
- return /* @__PURE__ */ U(S, {
744
+ return /* @__PURE__ */ P(E, {
642
745
  open: !0,
643
746
  header: o,
644
747
  titleClassName: s,
645
- size: C.Sm,
748
+ size: D.Sm,
646
749
  onClose: a,
647
- className: y,
648
- footer: /* @__PURE__ */ U("div", {
649
- className: "flex justify-end px-6 py-4",
650
- children: /* @__PURE__ */ U(ie, {
651
- tooltip: v,
652
- hideTooltip: E || !v,
653
- children: /* @__PURE__ */ U(w, {
654
- label: _,
655
- onClick: ee,
656
- disabled: !E
657
- })
658
- })
659
- }),
660
- children: /* @__PURE__ */ U(Je, {
750
+ className: b,
751
+ mainButtons: [{
752
+ label: v,
753
+ variant: h.Primary,
754
+ onClick: k,
755
+ disabled: !w,
756
+ tooltipProps: y ? {
757
+ tooltip: y,
758
+ hideTooltip: w
759
+ } : void 0
760
+ }],
761
+ children: /* @__PURE__ */ P(ot, {
661
762
  features: e,
662
- responseFormat: b,
663
- systemPrompt: x,
664
- temperature: T,
665
- onResponseFormatChange: D,
666
- onSystemPromptChange: O,
667
- onTemperatureChange: k,
763
+ responseFormat: x,
764
+ systemPrompt: S,
765
+ temperature: C,
766
+ onResponseFormatChange: T,
767
+ onSystemPromptChange: ee,
768
+ onTemperatureChange: O,
668
769
  responseFormatLabel: c,
669
770
  responseFormatHint: l,
670
771
  responseFormatMarkdownLabel: u,
@@ -672,14 +773,14 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
672
773
  systemPromptLabel: f,
673
774
  systemPromptTooltip: p,
674
775
  temperatureLabel: m,
675
- temperatureLabels: h,
676
- temperatureHint: g
776
+ temperatureLabels: g,
777
+ temperatureHint: _
677
778
  })
678
779
  });
679
- }, Qe = {
780
+ }, ut = {
680
781
  icon: "_icon_1fv6z_1",
681
782
  selectedIcon: "_selectedIcon_1fv6z_5"
682
- }, $e = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: a, title: o = "Tools", items: l, onToolToggle: f, itemLabelClassName: p = "dial-small-text", colors: h }) => /* @__PURE__ */ U(Ee, {
783
+ }, dt = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: a, title: o = "Tools", items: s, onToolToggle: u, itemLabelClassName: d = "dial-small-text", colors: p }) => /* @__PURE__ */ P(U, {
683
784
  isOpen: e,
684
785
  title: o,
685
786
  closeLabel: i,
@@ -687,91 +788,91 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
687
788
  onBack: t,
688
789
  backLabel: n,
689
790
  style: a,
690
- children: /* @__PURE__ */ U("ul", {
791
+ children: /* @__PURE__ */ P("ul", {
691
792
  role: "menu",
692
793
  className: "flex flex-col pb-4",
693
- style: s({
694
- "--tbs-icon-text": h?.iconText,
695
- "--tbs-selected-icon-text": h?.selectedIconText
794
+ style: c({
795
+ "--tbs-icon-text": p?.iconText,
796
+ "--tbs-selected-icon-text": p?.selectedIconText
696
797
  }),
697
- children: l.map((e) => /* @__PURE__ */ U("li", {
798
+ children: s.map((e) => /* @__PURE__ */ P("li", {
698
799
  role: "none",
699
- children: /* @__PURE__ */ U(d, {
800
+ children: /* @__PURE__ */ P(m, {
700
801
  type: "button",
701
802
  role: "menuitemcheckbox",
702
803
  "aria-checked": e.isSelected,
703
804
  className: "w-full gap-3 px-4 py-[10px] text-start",
704
- iconBefore: /* @__PURE__ */ U("span", {
705
- className: c("flex items-center", Qe.icon),
805
+ iconBefore: /* @__PURE__ */ P("span", {
806
+ className: l("flex items-center", ut.icon),
706
807
  children: e.icon
707
808
  }),
708
- iconAfter: e.isSelected ? /* @__PURE__ */ U("span", {
709
- className: c("ms-auto", Qe.selectedIcon),
710
- children: /* @__PURE__ */ U(M, {
711
- size: u,
809
+ iconAfter: e.isSelected ? /* @__PURE__ */ P("span", {
810
+ className: l("ms-auto", ut.selectedIcon),
811
+ children: /* @__PURE__ */ P(de, {
812
+ size: f,
712
813
  "aria-hidden": !0,
713
- stroke: m
814
+ stroke: _
714
815
  })
715
816
  }) : null,
716
- label: /* @__PURE__ */ U("span", {
717
- className: p,
817
+ label: /* @__PURE__ */ P("span", {
818
+ className: d,
718
819
  children: e.label
719
820
  }),
720
- onClick: () => f(e.id)
821
+ onClick: () => u(e.id)
721
822
  })
722
823
  }, e.id))
723
824
  })
724
- }), et = {
825
+ }), ft = {
725
826
  toolIcon: "_toolIcon_ma5s5_1",
726
827
  chevronIcon: "_chevronIcon_ma5s5_5"
727
- }, tt = ({ onAttachClick: e, onRecordVoice: t, recordVoiceLabel: n = "Record voice", attachLabel: r, addMenuTitle: i, menuTitle: o, menuCloseLabel: d, style: f, listClassName: _ = "w-[240px]", isDisabled: y = !1, chatSettings: x, extraMenuItems: S, toolsMenuItems: C = [], onToolToggle: w, toolsMenuTitle: T = "Tools", toolsBackLabel: E = "Back", menuOverlays: D, colors: O }) => {
728
- let k = l(), [ee, A] = V(!1), [te, j] = V(!1), [ne, re] = V(!1), [ie, ae] = V(null), [oe, M] = V(!1), N = z(() => s({
828
+ }, pt = ({ onAttachClick: e, onRecordVoice: t, recordVoiceLabel: n = "Record voice", attachLabel: r, addMenuTitle: i, menuTitle: a, menuCloseLabel: s, style: u, listClassName: p = "w-[240px]", isDisabled: m = !1, chatSettings: h, extraMenuItems: b, toolsMenuItems: S = [], onToolToggle: w, toolsMenuTitle: T = "Tools", toolsBackLabel: E = "Back", menuOverlays: D, getCaretPosition: ee, colors: O }) => {
829
+ let k = d(), [A, j] = V(!1), [te, ne] = V(!1), [re, ie] = V(!1), [ae, oe] = V(null), [M, se] = V(!1), I = z(() => c({
729
830
  "--aab-tool-icon": O?.toolIcon,
730
831
  "--aab-chevron-icon": O?.chevronIcon
731
- }), [O?.toolIcon, O?.chevronIcon]), se = C.length > 0 && w != null, F = D != null && D.length > 0, ue = z(() => C.map((e) => ({
832
+ }), [O?.toolIcon, O?.chevronIcon]), ce = S.length > 0 && w != null, le = D != null && D.length > 0, ue = z(() => S.map((e) => ({
732
833
  key: e.id,
733
834
  label: e.label,
734
- icon: /* @__PURE__ */ U("span", {
735
- style: N,
736
- className: c("flex items-center", et.toolIcon),
835
+ icon: /* @__PURE__ */ P("span", {
836
+ style: I,
837
+ className: l("flex items-center", ft.toolIcon),
737
838
  children: e.icon
738
839
  }),
739
840
  selectable: !0,
740
- mark: b.Check,
841
+ mark: C.Check,
741
842
  checked: e.isSelected,
742
843
  onClick: () => w?.(e.id)
743
844
  })), [
744
- C,
845
+ S,
745
846
  w,
746
- N
747
- ]), me = z(() => [
847
+ I
848
+ ]), de = z(() => [
748
849
  ...e == null ? [] : [{
749
850
  key: "attach",
750
851
  label: r,
751
- icon: /* @__PURE__ */ U(le, {
752
- size: u,
852
+ icon: /* @__PURE__ */ P(ge, {
853
+ size: f,
753
854
  "aria-hidden": !0,
754
- stroke: m
855
+ stroke: _
755
856
  }),
756
857
  onClick: e
757
858
  }],
758
- ...S ?? [],
759
- ...se ? [{
859
+ ...b ?? [],
860
+ ...ce ? [{
760
861
  key: "tools",
761
862
  label: T,
762
- icon: /* @__PURE__ */ U(pe, {
763
- size: u,
863
+ icon: /* @__PURE__ */ P(be, {
864
+ size: f,
764
865
  "aria-hidden": !0,
765
- stroke: m
866
+ stroke: _
766
867
  }),
767
868
  onClick: k ? () => {
768
- re(!0), A(!1);
869
+ ie(!0), j(!1);
769
870
  } : () => void 0,
770
- ...k ? { iconAfter: /* @__PURE__ */ U(P, {
771
- size: u,
772
- stroke: m,
773
- style: N,
774
- className: c("rtl:scale-x-[-1]", et.chevronIcon),
871
+ ...k ? { iconAfter: /* @__PURE__ */ P(pe, {
872
+ size: f,
873
+ stroke: _,
874
+ style: I,
875
+ className: l("rtl:scale-x-[-1]", ft.chevronIcon),
775
876
  "aria-hidden": !0
776
877
  }) } : { children: ue }
777
878
  }] : [],
@@ -780,266 +881,291 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
780
881
  label: e.title,
781
882
  icon: e.icon,
782
883
  onClick: k ? () => {
783
- ae(e.key), A(!1);
884
+ oe(e.key), j(!1);
784
885
  } : () => void 0,
785
- ...k ? { iconAfter: /* @__PURE__ */ U(P, {
786
- size: u,
787
- stroke: m,
788
- style: N,
789
- className: c("rtl:scale-x-[-1]", et.chevronIcon),
886
+ ...k ? { iconAfter: /* @__PURE__ */ P(pe, {
887
+ size: f,
888
+ stroke: _,
889
+ style: I,
890
+ className: l("rtl:scale-x-[-1]", ft.chevronIcon),
790
891
  "aria-hidden": !0
791
892
  }) } : {
792
893
  children: [{
793
894
  key: `${e.key}-panel`,
794
895
  label: ""
795
896
  }],
796
- renderSubMenu: () => e.renderOverlay(() => M(!1))
897
+ renderSubMenu: () => e.renderOverlay(() => se(!1), ee?.() ?? 0)
797
898
  }
798
899
  })),
799
900
  ...t == null ? [] : [{
800
901
  key: "record-voice",
801
902
  label: n,
802
- icon: /* @__PURE__ */ U(ce, {
803
- size: u,
903
+ icon: /* @__PURE__ */ P(he, {
904
+ size: f,
804
905
  "aria-hidden": !0,
805
- stroke: m
906
+ stroke: _
806
907
  }),
807
908
  onClick: () => {
808
- A(!1), M(!1), t();
909
+ j(!1), se(!1), t();
809
910
  }
810
911
  }],
811
- ...x == null ? [] : [{
912
+ ...h == null ? [] : [{
812
913
  key: "chat-settings",
813
- label: x.menuItemLabel ?? "Chat settings",
814
- icon: /* @__PURE__ */ U(fe, {
815
- size: u,
914
+ label: h.menuItemLabel ?? "Chat settings",
915
+ icon: /* @__PURE__ */ P(ye, {
916
+ size: f,
816
917
  "aria-hidden": !0,
817
- stroke: m
918
+ stroke: _
818
919
  }),
819
- iconAfter: k ? /* @__PURE__ */ U(P, {
820
- size: u,
821
- stroke: m,
822
- style: N,
823
- className: c("rtl:scale-x-[-1]", et.chevronIcon),
920
+ iconAfter: k ? /* @__PURE__ */ P(pe, {
921
+ size: f,
922
+ stroke: _,
923
+ style: I,
924
+ className: l("rtl:scale-x-[-1]", ft.chevronIcon),
824
925
  "aria-hidden": !0
825
926
  }) : null,
826
- onClick: () => j(!0)
927
+ onClick: () => ne(!0)
827
928
  }]
828
929
  ], [
829
930
  r,
830
931
  e,
831
932
  t,
832
933
  n,
833
- x,
834
- S,
934
+ h,
935
+ b,
835
936
  k,
836
- se,
937
+ ce,
837
938
  T,
838
939
  ue,
839
940
  D,
840
- N
941
+ ee,
942
+ I
841
943
  ]);
842
- if (me.length === 0) return null;
843
- let he = /* @__PURE__ */ U(h, {
944
+ if (de.length === 0) return null;
945
+ let fe = /* @__PURE__ */ P(v, {
844
946
  matchReferenceWidth: !1,
845
947
  placement: "bottom-start",
846
- listClassName: _,
847
- items: me,
848
- open: F ? oe : void 0,
849
- onOpenChange: F ? M : void 0,
850
- children: /* @__PURE__ */ U(v, {
851
- icon: /* @__PURE__ */ U(de, {
852
- size: p.LG,
948
+ listClassName: p,
949
+ overlayContentClassName: "flex flex-col gap-1",
950
+ items: de,
951
+ disabled: m,
952
+ open: le ? M : void 0,
953
+ onOpenChange: le ? se : void 0,
954
+ children: /* @__PURE__ */ P(x, {
955
+ icon: /* @__PURE__ */ P(ve, {
956
+ size: g.LG,
853
957
  "aria-hidden": !0,
854
- stroke: m
958
+ stroke: _
855
959
  }),
856
960
  "aria-label": i,
857
961
  tooltipProps: { tooltip: i },
858
- disabled: y
962
+ disabled: m
859
963
  })
860
964
  });
861
- return /* @__PURE__ */ U(H, { children: k ? /* @__PURE__ */ W(H, { children: [
862
- /* @__PURE__ */ U(v, {
863
- icon: /* @__PURE__ */ U(de, {
864
- size: p.LG,
965
+ return /* @__PURE__ */ P(N, { children: k ? /* @__PURE__ */ F(N, { children: [
966
+ /* @__PURE__ */ P(x, {
967
+ icon: /* @__PURE__ */ P(ve, {
968
+ size: g.LG,
865
969
  "aria-hidden": !0,
866
- stroke: m
970
+ stroke: _
867
971
  }),
868
972
  "aria-label": i,
869
- size: g.Large,
973
+ size: y.Large,
870
974
  tooltipProps: { tooltip: i },
871
- disabled: y,
872
- onClick: () => A(!0)
975
+ disabled: m,
976
+ onClick: () => j(!0)
873
977
  }),
874
- /* @__PURE__ */ U(Ke, {
875
- isOpen: ee,
876
- title: o,
877
- closeLabel: d,
878
- onClose: () => A(!1),
879
- style: f,
880
- items: me,
978
+ /* @__PURE__ */ P(rt, {
979
+ isOpen: A,
980
+ title: a,
981
+ closeLabel: s,
982
+ onClose: () => j(!1),
983
+ style: u,
984
+ items: de,
881
985
  className: "pb-4",
882
986
  btnTextClassName: "flex-1"
883
987
  }),
884
- se && /* @__PURE__ */ U($e, {
885
- isOpen: ne,
988
+ ce && /* @__PURE__ */ P(dt, {
989
+ isOpen: re,
886
990
  onBack: () => {
887
- re(!1), A(!0);
991
+ ie(!1), j(!0);
888
992
  },
889
993
  backLabel: E,
890
- onClose: () => re(!1),
891
- closeLabel: d,
892
- style: f,
994
+ onClose: () => ie(!1),
995
+ closeLabel: s,
996
+ style: u,
893
997
  title: T,
894
- items: C,
998
+ items: S,
895
999
  onToolToggle: w
896
1000
  }),
897
- D?.map((e) => /* @__PURE__ */ U(Ee, {
898
- isOpen: ie === e.key,
1001
+ D?.map((e) => /* @__PURE__ */ P(U, {
1002
+ isOpen: ae === e.key,
899
1003
  title: e.title,
900
- closeLabel: d,
1004
+ closeLabel: s,
901
1005
  onBack: () => {
902
- ae(null), A(!0);
1006
+ oe(null), j(!0);
903
1007
  },
904
1008
  backLabel: e.backLabel ?? "Back",
905
- onClose: () => ae(null),
906
- style: f,
907
- children: e.renderOverlay(() => ae(null))
1009
+ onClose: () => oe(null),
1010
+ style: u,
1011
+ children: /* @__PURE__ */ P("div", {
1012
+ role: "menu",
1013
+ "aria-label": e.title,
1014
+ children: e.renderOverlay(() => oe(null), ee?.() ?? 0)
1015
+ })
908
1016
  }, e.key)),
909
- x != null && /* @__PURE__ */ U(Ye, {
1017
+ h != null && /* @__PURE__ */ P(st, {
910
1018
  isOpen: te,
911
1019
  onBack: () => {
912
- j(!1), A(!0);
1020
+ ne(!1), j(!0);
913
1021
  },
914
- backLabel: x.backLabel ?? "Back",
915
- onClose: () => j(!1),
916
- closeLabel: d,
917
- style: f,
918
- features: x.features,
919
- initialResponseFormat: x.responseFormat ?? a.Markdown,
920
- initialSystemPrompt: x.systemPrompt,
921
- initialTemperature: x.temperature,
922
- onSave: x.onSave,
923
- title: x.title,
924
- responseFormatLabel: x.responseFormatLabel,
925
- responseFormatHint: x.responseFormatHint,
926
- responseFormatMarkdownLabel: x.responseFormatMarkdownLabel,
927
- responseFormatPlainTextLabel: x.responseFormatPlainTextLabel,
928
- systemPromptLabel: x.systemPromptLabel,
929
- systemPromptTooltip: x.systemPromptTooltip,
930
- temperatureLabel: x.temperatureLabel,
931
- temperatureLabels: x.temperatureLabels,
932
- temperatureHint: x.temperatureHint,
933
- saveLabel: x.saveLabel,
934
- saveDisabledTooltip: x.saveDisabledTooltip
1022
+ backLabel: h.backLabel ?? "Back",
1023
+ onClose: () => ne(!1),
1024
+ closeLabel: s,
1025
+ style: u,
1026
+ features: h.features,
1027
+ initialResponseFormat: h.responseFormat ?? o.Markdown,
1028
+ initialSystemPrompt: h.systemPrompt,
1029
+ initialTemperature: h.temperature,
1030
+ onSave: h.onSave,
1031
+ title: h.title,
1032
+ responseFormatLabel: h.responseFormatLabel,
1033
+ responseFormatHint: h.responseFormatHint,
1034
+ responseFormatMarkdownLabel: h.responseFormatMarkdownLabel,
1035
+ responseFormatPlainTextLabel: h.responseFormatPlainTextLabel,
1036
+ systemPromptLabel: h.systemPromptLabel,
1037
+ systemPromptTooltip: h.systemPromptTooltip,
1038
+ temperatureLabel: h.temperatureLabel,
1039
+ temperatureLabels: h.temperatureLabels,
1040
+ temperatureHint: h.temperatureHint,
1041
+ saveLabel: h.saveLabel,
1042
+ saveDisabledTooltip: h.saveDisabledTooltip
935
1043
  })
936
- ] }) : /* @__PURE__ */ W(H, { children: [he, x != null && te && /* @__PURE__ */ U(Ze, {
937
- features: x.features,
938
- initialResponseFormat: x.responseFormat ?? a.Markdown,
939
- initialSystemPrompt: x.systemPrompt,
940
- initialTemperature: x.temperature,
941
- onSave: x.onSave,
942
- onClose: () => j(!1),
943
- title: x.title,
944
- responseFormatLabel: x.responseFormatLabel,
945
- responseFormatHint: x.responseFormatHint,
946
- responseFormatMarkdownLabel: x.responseFormatMarkdownLabel,
947
- responseFormatPlainTextLabel: x.responseFormatPlainTextLabel,
948
- systemPromptLabel: x.systemPromptLabel,
949
- systemPromptTooltip: x.systemPromptTooltip,
950
- temperatureLabel: x.temperatureLabel,
951
- temperatureLabels: x.temperatureLabels,
952
- temperatureHint: x.temperatureHint,
953
- saveLabel: x.saveLabel,
954
- saveDisabledTooltip: x.saveDisabledTooltip
1044
+ ] }) : /* @__PURE__ */ F(N, { children: [fe, h != null && te && /* @__PURE__ */ P(lt, {
1045
+ features: h.features,
1046
+ initialResponseFormat: h.responseFormat ?? o.Markdown,
1047
+ initialSystemPrompt: h.systemPrompt,
1048
+ initialTemperature: h.temperature,
1049
+ onSave: h.onSave,
1050
+ onClose: () => ne(!1),
1051
+ title: h.title,
1052
+ responseFormatLabel: h.responseFormatLabel,
1053
+ responseFormatHint: h.responseFormatHint,
1054
+ responseFormatMarkdownLabel: h.responseFormatMarkdownLabel,
1055
+ responseFormatPlainTextLabel: h.responseFormatPlainTextLabel,
1056
+ systemPromptLabel: h.systemPromptLabel,
1057
+ systemPromptTooltip: h.systemPromptTooltip,
1058
+ temperatureLabel: h.temperatureLabel,
1059
+ temperatureLabels: h.temperatureLabels,
1060
+ temperatureHint: h.temperatureHint,
1061
+ saveLabel: h.saveLabel,
1062
+ saveDisabledTooltip: h.saveDisabledTooltip
955
1063
  })] }) });
956
- }, nt = {
957
- chip: "_chip_ydmd8_1",
958
- chipSelected: "_chipSelected_ydmd8_9",
959
- chipIcon: "_chipIcon_ydmd8_16",
960
- chipText: "_chipText_ydmd8_19",
961
- chipClose: "_chipClose_ydmd8_22"
962
- }, rt = (e) => `Remove ${e}`, it = ({ items: e, onToolToggle: t, onToolDismiss: n, canRemove: r = !0, removeLabel: i = rt, typography: a, colors: o }) => e.length === 0 ? null : /* @__PURE__ */ U("div", {
963
- className: "flex flex-wrap items-center gap-2",
964
- style: s({
965
- "--ci-chip-bg": o?.chipBg,
966
- "--ci-chip-border": o?.chipBorder,
967
- "--ci-chip-icon": o?.chipIcon,
968
- "--ci-chip-text": o?.chipText,
969
- "--ci-chip-hover-bg": o?.chipHoverBg,
970
- "--ci-chip-selected-bg": o?.chipSelectedBg,
971
- "--ci-chip-selected-border": o?.chipSelectedBorder,
972
- "--ci-chip-selected-icon": o?.chipSelectedIcon,
973
- "--ci-chip-selected-text": o?.chipSelectedText,
974
- "--ci-chip-close": o?.chipClose,
975
- "--ci-chip-close-hover": o?.chipCloseHover
976
- }),
977
- children: e.map((e) => /* @__PURE__ */ W("div", {
978
- className: c(nt.chip, e.isSelected && nt.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 transition-colors", r ? "pe-1 ps-2" : "px-2"),
979
- children: [/* @__PURE__ */ W("button", {
980
- type: "button",
981
- onClick: () => t(e.id),
982
- "aria-pressed": e.isSelected,
983
- className: "flex min-w-0 items-center gap-1.5",
984
- children: [/* @__PURE__ */ U("span", {
985
- className: c(nt.chipIcon, "shrink-0"),
986
- "aria-hidden": !0,
987
- children: e.icon
988
- }), /* @__PURE__ */ U("span", {
989
- className: c(nt.chipText, a?.fontClassName || "dial-small-paragraph-text", "truncate"),
990
- children: e.label
1064
+ }, G = {
1065
+ chip: "_chip_1lvv5_1",
1066
+ chipSelected: "_chipSelected_1lvv5_9",
1067
+ chipIcon: "_chipIcon_1lvv5_16",
1068
+ chipText: "_chipText_1lvv5_19",
1069
+ chipState: "_chipState_1lvv5_22",
1070
+ chipClose: "_chipClose_1lvv5_25"
1071
+ }, mt = (e) => `Remove ${e}`, ht = ({ items: e, onToolToggle: t, onToolDismiss: n, canRemove: r = !0, removeLabel: i = mt, stateOnLabel: a, stateOffLabel: o, typography: s, colors: u }) => {
1072
+ if (e.length === 0) return null;
1073
+ let d = !!(a && o);
1074
+ return /* @__PURE__ */ P("div", {
1075
+ className: "flex flex-wrap items-center gap-2",
1076
+ style: c({
1077
+ "--ci-chip-bg": u?.chipBg,
1078
+ "--ci-chip-border": u?.chipBorder,
1079
+ "--ci-chip-icon": u?.chipIcon,
1080
+ "--ci-chip-text": u?.chipText,
1081
+ "--ci-chip-hover-bg": u?.chipHoverBg,
1082
+ "--ci-chip-selected-bg": u?.chipSelectedBg,
1083
+ "--ci-chip-selected-border": u?.chipSelectedBorder,
1084
+ "--ci-chip-selected-icon": u?.chipSelectedIcon,
1085
+ "--ci-chip-selected-text": u?.chipSelectedText,
1086
+ "--ci-chip-state-text": u?.chipStateText,
1087
+ "--ci-chip-close": u?.chipClose,
1088
+ "--ci-chip-close-hover": u?.chipCloseHover
1089
+ }),
1090
+ children: e.map((e) => /* @__PURE__ */ F("div", {
1091
+ className: l(G.chip, e.isSelected && G.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 transition-colors", r ? "pe-1 ps-2" : "px-2"),
1092
+ children: [/* @__PURE__ */ F("button", {
1093
+ type: "button",
1094
+ onClick: () => t(e.id),
1095
+ "aria-pressed": e.isSelected,
1096
+ className: "flex min-w-0 items-center gap-1.5",
1097
+ children: [
1098
+ /* @__PURE__ */ P("span", {
1099
+ className: l(G.chipIcon, "shrink-0"),
1100
+ "aria-hidden": !0,
1101
+ children: e.icon
1102
+ }),
1103
+ /* @__PURE__ */ F("span", {
1104
+ className: l(G.chipText, s?.fontClassName || "dial-small-paragraph-text", "truncate"),
1105
+ children: [e.label, d && /* @__PURE__ */ P("span", {
1106
+ "aria-hidden": !0,
1107
+ children: ":"
1108
+ })]
1109
+ }),
1110
+ d && /* @__PURE__ */ P("span", {
1111
+ className: l(G.chipState, s?.fontClassName || "dial-small-paragraph-text", "ms-1 shrink-0 uppercase tracking-wider"),
1112
+ "aria-hidden": !0,
1113
+ children: e.isSelected ? a : o
1114
+ })
1115
+ ]
1116
+ }), r && /* @__PURE__ */ P("button", {
1117
+ type: "button",
1118
+ onClick: () => n(e.id),
1119
+ "aria-label": i(e.label),
1120
+ className: l(G.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
1121
+ children: /* @__PURE__ */ P(xe, {
1122
+ size: 12,
1123
+ "aria-hidden": !0,
1124
+ stroke: _
1125
+ })
991
1126
  })]
992
- }), r && /* @__PURE__ */ U("button", {
993
- type: "button",
994
- onClick: () => n(e.id),
995
- "aria-label": i(e.label),
996
- className: c(nt.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
997
- children: /* @__PURE__ */ U(me, {
998
- size: 12,
999
- "aria-hidden": !0,
1000
- stroke: m
1001
- })
1002
- })]
1003
- }, e.id))
1004
- }), K = {
1005
- wrapper: "_wrapper_q1jcl_2",
1006
- wrapperDisabled: "_wrapperDisabled_q1jcl_9",
1007
- textarea: "_textarea_q1jcl_13",
1008
- textareaIndented: "_textareaIndented_q1jcl_19",
1009
- commandHint: "_commandHint_q1jcl_43",
1010
- modelSelectorButton: "_modelSelectorButton_q1jcl_47",
1011
- modelSelectorCaret: "_modelSelectorCaret_q1jcl_47",
1012
- modelSelectorName: "_modelSelectorName_q1jcl_50",
1013
- modelSelectorVersion: "_modelSelectorVersion_q1jcl_53",
1014
- modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_q1jcl_62"
1015
- }, at = {
1016
- wrapperError: "_wrapperError_129ri_1",
1017
- waveformCanvas: "_waveformCanvas_129ri_5",
1018
- recordingDot: "_recordingDot_129ri_19",
1019
- "recording-pulse": "_recording-pulse_129ri_1"
1020
- }, ot = 3, st = 4, q = 200, ct = ({ state: e, analyserNodeRef: t, errorMessage: n, onStop: r, onDiscard: i, attachButton: a, stopLabel: o = "Stop recording", discardLabel: s = "Discard recording", processingLabel: l = "Transcribing audio…", style: u, className: d, embedded: f = !1 }) => {
1021
- let h = B(null), g = B(new Float32Array(q)), y = B(0), b = B(0), x = e === Le.Recording, S = e === Le.Error, C = e === Le.Processing, w = I((e) => {
1127
+ }, e.id))
1128
+ });
1129
+ }, K = {
1130
+ wrapper: "_wrapper_19a9k_2",
1131
+ wrapperDisabled: "_wrapperDisabled_19a9k_9",
1132
+ textarea: "_textarea_19a9k_13",
1133
+ textareaMentionMode: "_textareaMentionMode_19a9k_19",
1134
+ commandHint: "_commandHint_19a9k_53",
1135
+ mentionHighlight: "_mentionHighlight_19a9k_57",
1136
+ mentionHighlightUnsupported: "_mentionHighlightUnsupported_19a9k_63",
1137
+ modelSelectorButton: "_modelSelectorButton_19a9k_69",
1138
+ modelSelectorCaret: "_modelSelectorCaret_19a9k_69",
1139
+ modelSelectorName: "_modelSelectorName_19a9k_72",
1140
+ modelSelectorVersion: "_modelSelectorVersion_19a9k_75",
1141
+ modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_19a9k_84"
1142
+ }, gt = {
1143
+ waveformCanvas: "_waveformCanvas_18zb5_1",
1144
+ recordingDot: "_recordingDot_18zb5_15",
1145
+ "recording-pulse": "_recording-pulse_18zb5_1"
1146
+ }, _t = 3, vt = 4, yt = 200, bt = ({ state: e, analyserNodeRef: t, onStop: n, onDiscard: r, attachButton: i, stopLabel: a = "Stop recording", discardLabel: o = "Discard recording", processingLabel: s = "Transcribing audio…", style: c, className: u, embedded: d = !1 }) => {
1147
+ let f = B(null), p = B(new Float32Array(yt)), m = B(0), h = B(0), v = e === qe.Recording, y = e === qe.Processing, b = L((e) => {
1022
1148
  let t = e.getContext("2d");
1023
1149
  if (!t) return;
1024
1150
  e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
1025
1151
  let { width: n, height: r } = e;
1026
1152
  t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
1027
- let i = Math.min(Math.max(1, Math.floor(n / st)), q - 1), a = y.current, o = b.current;
1153
+ let i = Math.min(Math.max(1, Math.floor(n / vt)), yt - 1), a = m.current, o = h.current;
1028
1154
  t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
1029
1155
  for (let e = 0; e <= i; e++) {
1030
- let n = ((a - i + e) % q + q) % q, o = g.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
1031
- t.fillRect(e * st, (r - c) / 2, ot, c);
1156
+ let n = ((a - i + e) % yt + yt) % yt, o = p.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
1157
+ t.fillRect(e * vt, (r - c) / 2, _t, c);
1032
1158
  }
1033
1159
  t.restore();
1034
1160
  }, []);
1035
- L(() => {
1036
- if (!x) return;
1037
- let e = h.current;
1161
+ R(() => {
1162
+ if (!v) return;
1163
+ let e = f.current;
1038
1164
  if (!e) return;
1039
- g.current.fill(0), y.current = 0, b.current = 0;
1165
+ p.current.fill(0), m.current = 0, h.current = 0;
1040
1166
  let n, r = () => {
1041
- if (b.current += 1, b.current >= st) {
1042
- b.current -= st;
1167
+ if (h.current += 1, h.current >= vt) {
1168
+ h.current -= vt;
1043
1169
  let e = t.current;
1044
1170
  if (e) {
1045
1171
  let t = new Uint8Array(e.frequencyBinCount);
@@ -1049,205 +1175,223 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
1049
1175
  let r = (t[e] - 128) / 128;
1050
1176
  n += r * r;
1051
1177
  }
1052
- g.current[y.current % q] = Math.sqrt(n / t.length), y.current++;
1178
+ p.current[m.current % yt] = Math.sqrt(n / t.length), m.current++;
1053
1179
  }
1054
1180
  }
1055
- w(e), n = requestAnimationFrame(r);
1181
+ b(e), n = requestAnimationFrame(r);
1056
1182
  };
1057
1183
  return n = requestAnimationFrame(r), () => {
1058
1184
  cancelAnimationFrame(n);
1059
1185
  };
1060
1186
  }, [
1061
- x,
1187
+ v,
1062
1188
  t,
1063
- w
1064
- ]), L(() => {
1065
- let e = h.current;
1189
+ b
1190
+ ]), R(() => {
1191
+ let e = f.current;
1066
1192
  if (!e) return;
1067
1193
  let t = new ResizeObserver(() => {
1068
- w(e);
1194
+ b(e);
1069
1195
  });
1070
1196
  return t.observe(e), () => t.disconnect();
1071
- }, [w]);
1072
- let E = /* @__PURE__ */ W("div", {
1197
+ }, [b]);
1198
+ let x = /* @__PURE__ */ F("div", {
1073
1199
  className: "flex flex-shrink-0 items-center justify-end gap-1",
1074
1200
  children: [
1075
- /* @__PURE__ */ U(v, {
1076
- icon: /* @__PURE__ */ U(me, {
1077
- size: p.LG,
1201
+ /* @__PURE__ */ P(T, {
1202
+ icon: /* @__PURE__ */ P(xe, {
1203
+ size: g.LG,
1078
1204
  "aria-hidden": !0,
1079
- stroke: m
1205
+ stroke: _
1080
1206
  }),
1081
- "aria-label": s,
1207
+ "aria-label": o,
1082
1208
  className: "mobile:min-h-11 mobile:min-w-11",
1083
- onClick: i
1209
+ onClick: r
1084
1210
  }),
1085
- x && /* @__PURE__ */ U(T, {
1086
- icon: /* @__PURE__ */ U(F, {
1087
- size: p.LG,
1088
- "aria-hidden": !0
1211
+ v && /* @__PURE__ */ P(O, {
1212
+ icon: /* @__PURE__ */ P(de, {
1213
+ size: g.LG,
1214
+ "aria-hidden": !0,
1215
+ stroke: _
1089
1216
  }),
1090
- onClick: () => r?.(),
1217
+ onClick: () => n?.(),
1091
1218
  autoFocus: !0,
1092
- "aria-label": o,
1219
+ "aria-label": a,
1093
1220
  className: "mobile:min-h-11 mobile:min-w-11"
1094
1221
  }),
1095
- C && /* @__PURE__ */ U("span", {
1222
+ y && /* @__PURE__ */ P("span", {
1096
1223
  className: "flex size-[40px] flex-shrink-0 items-center justify-center mobile:min-h-11 mobile:min-w-11",
1097
- children: /* @__PURE__ */ U(te, {
1224
+ children: /* @__PURE__ */ P(ie, {
1098
1225
  size: 20,
1099
- ariaLabel: l
1226
+ ariaLabel: s
1100
1227
  })
1101
1228
  })
1102
1229
  ]
1103
1230
  });
1104
- return /* @__PURE__ */ W("div", {
1105
- className: d,
1106
- children: [/* @__PURE__ */ W("div", {
1107
- style: u,
1108
- className: c("flex w-full min-w-0 flex-col justify-center gap-2", !f && K.wrapper, !f && "min-h-[64px] max-w-[748px] rounded-xl border px-3 shadow-md", S && at.wrapperError),
1109
- children: [/* @__PURE__ */ W("div", {
1231
+ return /* @__PURE__ */ P("div", {
1232
+ className: u,
1233
+ children: /* @__PURE__ */ F("div", {
1234
+ style: c,
1235
+ className: l("flex w-full min-w-0 flex-col justify-center gap-2", !d && K.wrapper, !d && "min-h-[64px] max-w-[748px] rounded-xl border px-3 shadow-md"),
1236
+ children: [/* @__PURE__ */ F("div", {
1110
1237
  className: "flex min-w-0 flex-1 items-center gap-3",
1111
- children: [x && /* @__PURE__ */ U("span", {
1112
- className: c(at.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
1238
+ children: [v && /* @__PURE__ */ P("span", {
1239
+ className: l(gt.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
1113
1240
  "aria-hidden": !0
1114
- }), /* @__PURE__ */ U("canvas", {
1115
- ref: h,
1241
+ }), /* @__PURE__ */ P("canvas", {
1242
+ ref: f,
1116
1243
  height: 26,
1117
1244
  "aria-hidden": !0,
1118
- className: c(at.waveformCanvas, "h-[26px] min-w-0 flex-1")
1245
+ className: l(gt.waveformCanvas, "h-[26px] min-w-0 flex-1")
1119
1246
  })]
1120
- }), /* @__PURE__ */ W("div", {
1247
+ }), /* @__PURE__ */ F("div", {
1121
1248
  className: "flex items-center justify-between gap-2",
1122
- children: [a ?? /* @__PURE__ */ U("span", { "aria-hidden": !0 }), E]
1249
+ children: [i ?? /* @__PURE__ */ P("span", { "aria-hidden": !0 }), x]
1123
1250
  })]
1124
- }), S && n && /* @__PURE__ */ U("div", {
1125
- role: "alert",
1126
- children: /* @__PURE__ */ U(_, {
1127
- text: n,
1128
- className: "mt-1 px-1"
1129
- })
1130
- })]
1251
+ })
1131
1252
  });
1132
- }, lt = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message" }) => /* @__PURE__ */ U(T, {
1253
+ }, xt = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", sendTooltip: r }) => /* @__PURE__ */ P(O, {
1133
1254
  "aria-label": n,
1134
1255
  onClick: () => e?.(),
1135
1256
  disabled: t,
1136
- icon: /* @__PURE__ */ U(oe, {
1137
- size: p.LG,
1257
+ tooltipProps: r ? { tooltip: r } : void 0,
1258
+ icon: /* @__PURE__ */ P(ue, {
1259
+ size: g.LG,
1138
1260
  className: "rtl:scale-x-[-1]",
1139
- stroke: m
1261
+ stroke: _
1140
1262
  })
1141
- }), ut = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ U(j, {
1142
- icon: /* @__PURE__ */ U(ue, {
1143
- size: p.LG,
1144
- stroke: m
1263
+ }), St = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ P(T, {
1264
+ icon: /* @__PURE__ */ P(_e, {
1265
+ size: g.LG,
1266
+ stroke: _
1145
1267
  }),
1146
1268
  onClick: () => e?.(),
1147
1269
  "aria-label": t
1148
- }), dt = ({ size: e = 20 }) => /* @__PURE__ */ U(k, {
1149
- variant: ee.Circular,
1270
+ }), Ct = ({ size: e = 20 }) => /* @__PURE__ */ P(te, {
1271
+ variant: ne.Circular,
1150
1272
  width: e,
1151
1273
  height: e,
1152
1274
  active: !0
1153
- }), ft = ({ loadingLabel: e }) => /* @__PURE__ */ W("span", {
1275
+ }), wt = ({ loadingLabel: e }) => /* @__PURE__ */ F("span", {
1154
1276
  className: "flex min-w-0 flex-1 items-center",
1155
- children: [/* @__PURE__ */ U(k, {
1156
- variant: ee.Text,
1277
+ children: [/* @__PURE__ */ P(te, {
1278
+ variant: ne.Text,
1157
1279
  width: "100%",
1158
1280
  height: 16,
1159
1281
  active: !0
1160
- }), e && /* @__PURE__ */ U("span", {
1282
+ }), e && /* @__PURE__ */ P("span", {
1161
1283
  className: "sr-only",
1162
1284
  children: e
1163
1285
  })]
1164
- }), pt = ({ loadingLabel: e }) => /* @__PURE__ */ U("div", {
1286
+ }), Tt = ({ loadingLabel: e }) => /* @__PURE__ */ P("div", {
1165
1287
  role: "status",
1166
1288
  "aria-label": e,
1167
- children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ W("div", {
1289
+ children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ F("div", {
1168
1290
  className: "flex h-11 items-center gap-3 px-4",
1169
1291
  "aria-hidden": "true",
1170
- children: [/* @__PURE__ */ U(dt, {}), /* @__PURE__ */ U(ft, {})]
1292
+ children: [/* @__PURE__ */ P(Ct, {}), /* @__PURE__ */ P(wt, {})]
1171
1293
  }, t))
1172
- }), J = (e) => e.displayName ?? e.id, Y = (e, t) => {
1294
+ }), Et = (e) => e.displayName ?? e.id, Dt = (e, t) => {
1173
1295
  let n = t.trim().toLowerCase();
1174
- return n ? e.filter((e) => J(e).toLowerCase().includes(n)) : e;
1175
- }, mt = (e, t, r, i = 18, a) => /* @__PURE__ */ U(n, {
1296
+ return n ? e.filter((e) => Et(e).toLowerCase().includes(n)) : e;
1297
+ }, Ot = (e, t, r, i = 18, a) => /* @__PURE__ */ P(n, {
1176
1298
  src: e,
1177
1299
  size: i,
1178
1300
  labels: { tooltip: a },
1179
1301
  initialsName: r
1180
- }), ht = { searchHeader: "_searchHeader_1728o_1" }, gt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, searchHeaderClassName: i = ht.searchHeader, colors: a }) => {
1181
- let [o, l] = V(""), u = z(() => e?.find((e) => e.id === t), [e, t]), d = r?.loading !== void 0, f = !d && !u && !!t, m = z(() => d ? /* @__PURE__ */ U(dt, { size: p.LG }) : mt(u?.iconUrl, u?.type, u?.displayName ?? u?.id ?? "", p.LG, f ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
1182
- d,
1302
+ }), kt = {
1303
+ searchHeader: "_searchHeader_1u7db_1",
1304
+ itemText: "_itemText_1u7db_13",
1305
+ itemHover: "_itemHover_1u7db_17",
1306
+ selectedItemBackground: "_selectedItemBackground_1u7db_22",
1307
+ selectedItemText: "_selectedItemText_1u7db_26",
1308
+ checkIcon: "_checkIcon_1u7db_30"
1309
+ }, At = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, styles: i }) => {
1310
+ let [a, o] = V(""), s = z(() => e?.find((e) => e.id === t), [e, t]), u = r?.loading !== void 0, d = !u && !s && !!t, f = z(() => u ? /* @__PURE__ */ P(Ct, { size: g.LG }) : Ot(s?.iconUrl, s?.type, s?.displayName ?? s?.id ?? "", g.LG, d ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
1183
1311
  u,
1184
- f,
1312
+ s,
1313
+ d,
1185
1314
  r?.unavailableTooltip
1186
- ]), h = u?.displayName ?? u?.id, _ = u?.displayVersion;
1187
- return {
1188
- selectorIcon: m,
1189
- selectorAriaLabel: h ? `${r?.ariaLabel ?? "Select model"}: ${h}` : r?.ariaLabel ?? "Select model",
1190
- selectedLabel: h,
1191
- selectedVersion: _,
1192
- menuItems: z(() => {
1193
- if (d) return Array.from({ length: 7 }, (e, t) => ({
1194
- key: `__loading-${t}`,
1195
- icon: /* @__PURE__ */ U(dt, {}),
1196
- label: /* @__PURE__ */ U(ft, { loadingLabel: t === 0 ? r?.loading : void 0 }),
1315
+ ]), p = s?.displayName ?? s?.id, m = s?.displayVersion, h = p ? `${r?.ariaLabel ?? "Select model"}: ${p}` : r?.ariaLabel ?? "Select model", _ = z(() => {
1316
+ if (u) return Array.from({ length: 7 }, (e, t) => ({
1317
+ key: `__loading-${t}`,
1318
+ icon: /* @__PURE__ */ P(Ct, {}),
1319
+ label: /* @__PURE__ */ P(wt, { loadingLabel: t === 0 ? r?.loading : void 0 }),
1320
+ disabled: !0
1321
+ }));
1322
+ if (!e || e.length === 0) {
1323
+ let e = r?.error ?? r?.empty;
1324
+ return e ? [{
1325
+ key: "__state",
1326
+ label: e,
1197
1327
  disabled: !0
1198
- }));
1199
- if (!e || e.length === 0) {
1200
- let e = r?.error ?? r?.empty;
1201
- return e ? [{
1202
- key: "__state",
1203
- label: e,
1204
- disabled: !0
1205
- }] : [];
1206
- }
1207
- return Y(e, o).map((e) => ({
1328
+ }] : [];
1329
+ }
1330
+ let o = i?.colors;
1331
+ return Dt(e, a).map((e) => {
1332
+ let r = e.id === t;
1333
+ return {
1208
1334
  key: e.id,
1209
- label: /* @__PURE__ */ U(y, {
1210
- text: J(e),
1211
- query: o,
1335
+ label: /* @__PURE__ */ P(S, {
1336
+ text: Et(e),
1337
+ query: a,
1212
1338
  maxLines: 1
1213
1339
  }),
1214
- icon: mt(e.iconUrl, e.type, e.displayName ?? e.id),
1215
- mark: b.Check,
1216
- checked: e.id === t,
1340
+ icon: Ot(e.iconUrl, e.type, e.displayName ?? e.id),
1341
+ mark: C.Check,
1342
+ checked: r,
1343
+ className: l(o?.itemText && kt.itemText, o?.itemHoverBackground && kt.itemHover, r && o?.selectedItemBackground && kt.selectedItemBackground, r && o?.selectedItemText && kt.selectedItemText, r && o?.checkIcon && kt.checkIcon, i?.itemClassName, r && i?.selectedItemClassName, H.modelMenuItem, r && H.modelMenuItemSelected),
1217
1344
  onClick: () => n?.(e.id)
1218
- }));
1219
- }, [
1220
- e,
1221
- d,
1222
- o,
1223
- t,
1224
- r,
1225
- n
1226
- ]),
1227
- menuHeader: z(() => !d && e && e.length > 0 ? /* @__PURE__ */ U("div", {
1228
- style: s({ "--ms-search-header-bg": a?.searchHeaderBackground }),
1229
- className: c("sticky top-0 z-10 pb-1 pe-2 pt-2", i),
1230
- children: /* @__PURE__ */ U(O, {
1231
- value: o,
1345
+ };
1346
+ });
1347
+ }, [
1348
+ e,
1349
+ u,
1350
+ a,
1351
+ t,
1352
+ r,
1353
+ n,
1354
+ i?.itemClassName,
1355
+ i?.selectedItemClassName,
1356
+ i?.colors
1357
+ ]), v = z(() => c({
1358
+ "--ms-item-text": i?.colors?.itemText,
1359
+ "--ms-item-hover-bg": i?.colors?.itemHoverBackground,
1360
+ "--ms-selected-item-bg": i?.colors?.selectedItemBackground,
1361
+ "--ms-selected-item-text": i?.colors?.selectedItemText,
1362
+ "--ms-check-icon": i?.colors?.checkIcon
1363
+ }), [i?.colors]);
1364
+ return {
1365
+ selectorIcon: f,
1366
+ selectorAriaLabel: h,
1367
+ selectedLabel: p,
1368
+ selectedVersion: m,
1369
+ menuItems: _,
1370
+ menuHeader: z(() => !u && e && e.length > 0 ? /* @__PURE__ */ P("div", {
1371
+ style: c({ "--ms-search-header-bg": i?.colors?.searchHeaderBackground }),
1372
+ className: l("sticky top-0 z-10 pb-1 pe-2 pt-2", kt.searchHeader, i?.searchHeaderClassName, H.modelMenuSearch),
1373
+ children: /* @__PURE__ */ P(j, {
1374
+ value: a,
1232
1375
  placeholder: r?.searchPlaceholder ?? "Search",
1233
- size: g.Small,
1376
+ size: y.Small,
1234
1377
  wrapperClassName: "border-0",
1235
- onChange: (e) => l(e ?? "")
1378
+ onChange: (e) => o(e ?? "")
1236
1379
  })
1237
1380
  }) : void 0, [
1238
1381
  e,
1239
- d,
1240
- o,
1382
+ u,
1383
+ a,
1241
1384
  r,
1242
- i,
1243
- a?.searchHeaderBackground
1385
+ i?.searchHeaderClassName,
1386
+ i?.colors?.searchHeaderBackground
1244
1387
  ]),
1388
+ menuStyle: v,
1245
1389
  onOpenChange: (e) => {
1246
- e || l("");
1390
+ e || o("");
1247
1391
  }
1248
1392
  };
1249
- }, _t = typeof window < "u" ? _e : L;
1250
- function vt(e) {
1393
+ }, jt = typeof window < "u" ? De : R;
1394
+ function Mt(e) {
1251
1395
  if (e !== void 0) switch (typeof e) {
1252
1396
  case "number": return e;
1253
1397
  case "string":
@@ -1255,15 +1399,15 @@ function vt(e) {
1255
1399
  break;
1256
1400
  }
1257
1401
  }
1258
- function X({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
1402
+ function Nt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
1259
1403
  let { styleHeight: s, styleWidth: c } = z(() => ({
1260
- styleHeight: vt(o?.height),
1261
- styleWidth: vt(o?.width)
1404
+ styleHeight: Mt(o?.height),
1405
+ styleWidth: Mt(o?.width)
1262
1406
  }), [o?.height, o?.width]), [l, u] = V({
1263
1407
  height: t,
1264
1408
  width: n
1265
1409
  }), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
1266
- return _t(() => {
1410
+ return jt(() => {
1267
1411
  if (i === null || d) return;
1268
1412
  let t = new ResizeObserver((e) => {
1269
1413
  for (let t of e) {
@@ -1292,26 +1436,26 @@ function X({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i,
1292
1436
  c
1293
1437
  ]);
1294
1438
  }
1295
- function Z(e) {
1439
+ function Pt(e) {
1296
1440
  let t = B(() => {
1297
1441
  throw Error("Cannot call during render.");
1298
1442
  });
1299
- return _t(() => {
1443
+ return jt(() => {
1300
1444
  t.current = e;
1301
- }, [e]), I((e) => t.current?.(e), [t]);
1445
+ }, [e]), L((e) => t.current?.(e), [t]);
1302
1446
  }
1303
- var Q = null;
1304
- function yt(e = !1) {
1305
- if (Q === null || e) {
1447
+ var q = null;
1448
+ function Ft(e = !1) {
1449
+ if (q === null || e) {
1306
1450
  let e = document.createElement("div"), t = e.style;
1307
1451
  t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
1308
1452
  let n = document.createElement("div"), r = n.style;
1309
- return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? Q = "positive-descending" : (e.scrollLeft = 1, Q = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), Q;
1453
+ return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? q = "positive-descending" : (e.scrollLeft = 1, q = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), q;
1310
1454
  }
1311
- return Q;
1455
+ return q;
1312
1456
  }
1313
- function bt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
1314
- if (t === "horizontal" && n) switch (yt()) {
1457
+ function It({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
1458
+ if (t === "horizontal" && n) switch (Ft()) {
1315
1459
  case "negative": return -r;
1316
1460
  case "positive-descending":
1317
1461
  if (e) {
@@ -1322,26 +1466,26 @@ function bt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
1322
1466
  }
1323
1467
  return r;
1324
1468
  }
1325
- function $(e, t = "Assertion error") {
1469
+ function J(e, t = "Assertion error") {
1326
1470
  if (!e) throw console.error(t), Error(t);
1327
1471
  }
1328
- function xt(e, t) {
1472
+ function Lt(e, t) {
1329
1473
  if (e === t) return !0;
1330
- if (!!e != !!t || ($(e !== void 0), $(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
1474
+ if (!!e != !!t || (J(e !== void 0), J(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
1331
1475
  for (let n in e) if (!Object.is(t[n], e[n])) return !1;
1332
1476
  return !0;
1333
1477
  }
1334
- function St({ cachedBounds: e, itemCount: t, itemSize: n }) {
1478
+ function Y({ cachedBounds: e, itemCount: t, itemSize: n }) {
1335
1479
  if (t === 0) return 0;
1336
1480
  if (typeof n == "number") return t * n;
1337
1481
  {
1338
1482
  let n = e.get(e.size === 0 ? 0 : e.size - 1);
1339
- return $(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
1483
+ return J(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
1340
1484
  }
1341
1485
  }
1342
- function Ct({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
1486
+ function X({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
1343
1487
  if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
1344
- let s = St({
1488
+ let s = Y({
1345
1489
  cachedBounds: t,
1346
1490
  itemCount: r,
1347
1491
  itemSize: i
@@ -1353,7 +1497,7 @@ function Ct({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, co
1353
1497
  default: return a >= u && a <= l ? a : a < u ? u : l;
1354
1498
  }
1355
1499
  }
1356
- function wt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
1500
+ function Z({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
1357
1501
  let a = r - 1, o = 0, s = -1, c = 0, l = -1, u = 0;
1358
1502
  for (; u < a;) {
1359
1503
  let n = e.get(u);
@@ -1372,11 +1516,11 @@ function wt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemC
1372
1516
  stopIndexOverscan: l
1373
1517
  };
1374
1518
  }
1375
- function Tt({ itemCount: e, itemProps: t, itemSize: n }) {
1519
+ function Rt({ itemCount: e, itemProps: t, itemSize: n }) {
1376
1520
  let r = /* @__PURE__ */ new Map();
1377
1521
  return {
1378
1522
  get(i) {
1379
- for ($(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
1523
+ for (J(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
1380
1524
  let e = r.size, a;
1381
1525
  switch (typeof n) {
1382
1526
  case "function":
@@ -1392,14 +1536,14 @@ function Tt({ itemCount: e, itemProps: t, itemSize: n }) {
1392
1536
  });
1393
1537
  else {
1394
1538
  let t = r.get(e - 1);
1395
- $(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
1539
+ J(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
1396
1540
  scrollOffset: t.scrollOffset + t.size,
1397
1541
  size: a
1398
1542
  });
1399
1543
  }
1400
1544
  }
1401
1545
  let a = r.get(i);
1402
- return $(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
1546
+ return J(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
1403
1547
  },
1404
1548
  set(e, t) {
1405
1549
  r.set(e, t);
@@ -1409,8 +1553,8 @@ function Tt({ itemCount: e, itemProps: t, itemSize: n }) {
1409
1553
  }
1410
1554
  };
1411
1555
  }
1412
- function Et({ itemCount: e, itemProps: t, itemSize: n }) {
1413
- return z(() => Tt({
1556
+ function zt({ itemCount: e, itemProps: t, itemSize: n }) {
1557
+ return z(() => Rt({
1414
1558
  itemCount: e,
1415
1559
  itemProps: t,
1416
1560
  itemSize: n
@@ -1420,11 +1564,11 @@ function Et({ itemCount: e, itemProps: t, itemSize: n }) {
1420
1564
  n
1421
1565
  ]);
1422
1566
  }
1423
- function Dt({ containerSize: e, itemSize: t }) {
1567
+ function Bt({ containerSize: e, itemSize: t }) {
1424
1568
  let n;
1425
1569
  switch (typeof t) {
1426
1570
  case "string":
1427
- $(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), $(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
1571
+ J(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), J(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
1428
1572
  break;
1429
1573
  default:
1430
1574
  n = t;
@@ -1432,8 +1576,8 @@ function Dt({ containerSize: e, itemSize: t }) {
1432
1576
  }
1433
1577
  return n;
1434
1578
  }
1435
- function Ot({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
1436
- let { height: u = n, width: d = n } = X({
1579
+ function Q({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
1580
+ let { height: u = n, width: d = n } = Nt({
1437
1581
  defaultHeight: r === "vertical" ? n : void 0,
1438
1582
  defaultWidth: r === "horizontal" ? n : void 0,
1439
1583
  element: e,
@@ -1442,11 +1586,11 @@ function Ot({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1442
1586
  }), f = B({
1443
1587
  height: 0,
1444
1588
  width: 0
1445
- }), p = r === "vertical" ? u : d, m = Dt({
1589
+ }), p = r === "vertical" ? u : d, m = Bt({
1446
1590
  containerSize: p,
1447
1591
  itemSize: s
1448
1592
  });
1449
- _e(() => {
1593
+ De(() => {
1450
1594
  if (typeof c == "function") {
1451
1595
  let e = f.current;
1452
1596
  (e.height !== u || e.width !== d) && (c({
@@ -1459,11 +1603,11 @@ function Ot({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1459
1603
  c,
1460
1604
  d
1461
1605
  ]);
1462
- let h = Et({
1606
+ let h = zt({
1463
1607
  itemCount: a,
1464
1608
  itemProps: o,
1465
1609
  itemSize: m
1466
- }), g = I((e) => h.get(e), [h]), [_, v] = V(() => wt({
1610
+ }), g = L((e) => h.get(e), [h]), [_, v] = V(() => Z({
1467
1611
  cachedBounds: h,
1468
1612
  containerScrollOffset: 0,
1469
1613
  containerSize: p,
@@ -1474,7 +1618,7 @@ function Ot({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1474
1618
  startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
1475
1619
  stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
1476
1620
  stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
1477
- }, C = I(() => St({
1621
+ }, C = L(() => Y({
1478
1622
  cachedBounds: h,
1479
1623
  itemCount: a,
1480
1624
  itemSize: m
@@ -1482,9 +1626,9 @@ function Ot({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1482
1626
  h,
1483
1627
  a,
1484
1628
  m
1485
- ]), w = I((t) => wt({
1629
+ ]), w = L((t) => Z({
1486
1630
  cachedBounds: h,
1487
- containerScrollOffset: bt({
1631
+ containerScrollOffset: It({
1488
1632
  containerElement: e,
1489
1633
  direction: r,
1490
1634
  isRtl: i,
@@ -1502,19 +1646,19 @@ function Ot({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1502
1646
  a,
1503
1647
  l
1504
1648
  ]);
1505
- return _t(() => {
1649
+ return jt(() => {
1506
1650
  v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
1507
1651
  }, [
1508
1652
  e,
1509
1653
  r,
1510
1654
  w
1511
- ]), _t(() => {
1655
+ ]), jt(() => {
1512
1656
  if (!e) return;
1513
1657
  let t = () => {
1514
1658
  v((t) => {
1515
- let { scrollLeft: n, scrollTop: o } = e, s = wt({
1659
+ let { scrollLeft: n, scrollTop: o } = e, s = Z({
1516
1660
  cachedBounds: h,
1517
- containerScrollOffset: bt({
1661
+ containerScrollOffset: It({
1518
1662
  containerElement: e,
1519
1663
  direction: r,
1520
1664
  isRtl: i,
@@ -1524,7 +1668,7 @@ function Ot({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1524
1668
  itemCount: a,
1525
1669
  overscanCount: l
1526
1670
  });
1527
- return xt(s, t) ? t : s;
1671
+ return Lt(s, t) ? t : s;
1528
1672
  });
1529
1673
  };
1530
1674
  return e.addEventListener("scroll", t), () => {
@@ -1540,8 +1684,8 @@ function Ot({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1540
1684
  ]), {
1541
1685
  getCellBounds: g,
1542
1686
  getEstimatedSize: C,
1543
- scrollToIndex: Z(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
1544
- let s = Ct({
1687
+ scrollToIndex: Pt(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
1688
+ let s = X({
1545
1689
  align: t,
1546
1690
  cachedBounds: h,
1547
1691
  containerScrollOffset: n,
@@ -1551,14 +1695,14 @@ function Ot({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1551
1695
  itemSize: m
1552
1696
  });
1553
1697
  if (e) {
1554
- if (s = bt({
1698
+ if (s = It({
1555
1699
  containerElement: e,
1556
1700
  direction: r,
1557
1701
  isRtl: i,
1558
1702
  scrollOffset: s
1559
1703
  }), typeof e.scrollTo != "function") {
1560
1704
  let e = w(s);
1561
- xt(_, e) || v(e);
1705
+ Lt(_, e) || v(e);
1562
1706
  }
1563
1707
  return s;
1564
1708
  }
@@ -1569,19 +1713,19 @@ function Ot({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1569
1713
  stopIndexVisible: x
1570
1714
  };
1571
1715
  }
1572
- function kt(e) {
1716
+ function Vt(e) {
1573
1717
  return z(() => e, Object.values(e));
1574
1718
  }
1575
- function At(e, t) {
1719
+ function Ht(e, t) {
1576
1720
  let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
1577
- return xt(n, a) && xt(r, o) && xt(i, s);
1721
+ return Lt(n, a) && Lt(r, o) && Lt(i, s);
1578
1722
  }
1579
- function jt(e) {
1723
+ function Ut(e) {
1580
1724
  return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
1581
1725
  }
1582
- var Mt = "data-react-window-index";
1583
- function Nt({ 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 }) {
1584
- let m = kt(u), h = z(() => ge(s, At), [s]), [g, _] = V(null), v = jt(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = Ot({
1726
+ var Wt = "data-react-window-index";
1727
+ function Gt({ 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 }) {
1728
+ let m = Vt(u), h = z(() => we(s, Ht), [s]), [g, _] = V(null), v = Ut(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = Q({
1585
1729
  containerElement: g,
1586
1730
  containerStyle: f,
1587
1731
  defaultContainerSize: n,
@@ -1592,7 +1736,7 @@ function Nt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1592
1736
  onResize: i,
1593
1737
  overscanCount: o
1594
1738
  });
1595
- R(r, () => ({
1739
+ Ee(r, () => ({
1596
1740
  get element() {
1597
1741
  return g;
1598
1742
  },
@@ -1607,12 +1751,12 @@ function Nt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1607
1751
  top: r
1608
1752
  });
1609
1753
  }
1610
- }), [g, x]), _t(() => {
1754
+ }), [g, x]), jt(() => {
1611
1755
  if (!g) return;
1612
1756
  let e = Array.from(g.children).filter((e, t) => {
1613
1757
  if (e.hasAttribute("aria-hidden")) return !1;
1614
1758
  let n = `${S + t}`;
1615
- return e.setAttribute(Mt, n), !0;
1759
+ return e.setAttribute(Wt, n), !0;
1616
1760
  });
1617
1761
  if (v) return l.observeRowElements(e);
1618
1762
  }, [
@@ -1621,7 +1765,7 @@ function Nt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1621
1765
  l,
1622
1766
  S,
1623
1767
  w
1624
- ]), L(() => {
1768
+ ]), R(() => {
1625
1769
  S >= 0 && w >= 0 && a && a({
1626
1770
  startIndex: C,
1627
1771
  stopIndex: T
@@ -1640,7 +1784,7 @@ function Nt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1640
1784
  let e = [];
1641
1785
  if (c > 0) for (let t = S; t <= w; t++) {
1642
1786
  let n = y(t);
1643
- e.push(/* @__PURE__ */ he(h, {
1787
+ e.push(/* @__PURE__ */ Se(h, {
1644
1788
  ...m,
1645
1789
  ariaAttributes: {
1646
1790
  "aria-posinset": t + 1,
@@ -1667,7 +1811,7 @@ function Nt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1667
1811
  m,
1668
1812
  S,
1669
1813
  w
1670
- ]), D = /* @__PURE__ */ U("div", {
1814
+ ]), D = /* @__PURE__ */ P("div", {
1671
1815
  "aria-hidden": !0,
1672
1816
  style: {
1673
1817
  height: b(),
@@ -1675,7 +1819,7 @@ function Nt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1675
1819
  zIndex: -1
1676
1820
  }
1677
1821
  });
1678
- return he(d, {
1822
+ return Se(d, {
1679
1823
  role: "list",
1680
1824
  ...p,
1681
1825
  className: t,
@@ -1689,701 +1833,862 @@ function Nt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1689
1833
  }
1690
1834
  }, E, e, D);
1691
1835
  }
1692
- var Pt = {
1693
- divider: "_divider_1tiyp_1",
1694
- item: "_item_1tiyp_5",
1695
- itemIcon: "_itemIcon_1tiyp_15",
1696
- checkIcon: "_checkIcon_1tiyp_19",
1697
- stateLabel: "_stateLabel_1tiyp_23"
1698
- }, Ft = 44, It = 8, Lt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: o, onSelect: s }) => {
1699
- let l = r[e], u = mt(l.iconUrl, l.type, l.displayName ?? l.id, p.SM), f = l.id === i;
1700
- return /* @__PURE__ */ U("div", {
1836
+ var Kt = {
1837
+ search: "_search_5skzl_1",
1838
+ divider: "_divider_5skzl_5",
1839
+ item: "_item_5skzl_9",
1840
+ itemIcon: "_itemIcon_5skzl_19",
1841
+ checkIcon: "_checkIcon_5skzl_23",
1842
+ stateLabel: "_stateLabel_5skzl_27",
1843
+ itemSelectedBackground: "_itemSelectedBackground_5skzl_37",
1844
+ itemSelectedText: "_itemSelectedText_5skzl_41"
1845
+ }, qt = 44, Jt = 8, Yt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: o, itemClassName: s, selectedItemClassName: c, hasSelectedBackground: u, hasSelectedText: d, onSelect: f }) => {
1846
+ let p = r[e], h = Ot(p.iconUrl, p.type, p.displayName ?? p.id, g.SM), v = p.id === i;
1847
+ return /* @__PURE__ */ P("div", {
1701
1848
  style: t,
1702
1849
  ...n,
1703
- children: /* @__PURE__ */ U(d, {
1850
+ children: /* @__PURE__ */ P(m, {
1704
1851
  type: "button",
1705
- "aria-current": f ? "true" : void 0,
1706
- className: c(Pt.item, "h-full w-full gap-3 px-4"),
1707
- iconBefore: /* @__PURE__ */ U("span", {
1708
- className: Pt.itemIcon,
1709
- children: u
1852
+ "aria-current": v ? "true" : void 0,
1853
+ className: l(Kt.item, "h-full w-full gap-3 px-4", v && u && Kt.itemSelectedBackground, v && d && Kt.itemSelectedText, s, v && c, H.modelMenuItem, v && H.modelMenuItemSelected),
1854
+ iconBefore: /* @__PURE__ */ P("span", {
1855
+ className: Kt.itemIcon,
1856
+ children: h
1710
1857
  }),
1711
- label: /* @__PURE__ */ W("span", {
1858
+ label: /* @__PURE__ */ F("span", {
1712
1859
  className: "flex flex-1 items-center justify-between gap-2",
1713
- children: [/* @__PURE__ */ U(y, {
1714
- text: l.displayName ?? l.id,
1860
+ children: [/* @__PURE__ */ P(S, {
1861
+ text: p.displayName ?? p.id,
1715
1862
  query: o,
1716
1863
  maxLines: 1,
1717
- className: c(a, "min-w-0 flex-1 text-start")
1718
- }), f && /* @__PURE__ */ U(M, {
1719
- size: p.SM,
1720
- className: Pt.checkIcon,
1864
+ className: l(a, "min-w-0 flex-1 text-start")
1865
+ }), v && /* @__PURE__ */ P(de, {
1866
+ size: g.SM,
1867
+ className: Kt.checkIcon,
1721
1868
  "aria-hidden": !0,
1722
- stroke: m
1869
+ stroke: _
1723
1870
  })]
1724
1871
  }),
1725
- onClick: () => s(l.id)
1872
+ onClick: () => f(p.id)
1726
1873
  })
1727
1874
  });
1728
- }, Rt = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: a, selectedDeploymentId: o, onSelect: l, loadingLabel: u, errorLabel: d, emptyLabel: f, style: p, titleClassName: m = "dial-body-semi-text", labelClassName: h = "dial-small-text", colors: _ }) => {
1729
- let [v, y] = V("");
1730
- L(() => {
1731
- e || y("");
1875
+ }, Xt = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: a, selectedDeploymentId: o, onSelect: s, loadingLabel: u, errorLabel: d, emptyLabel: f, style: p, titleClassName: m = "dial-body-semi-text", labelClassName: h = "dial-small-text", colors: g, menuStyles: _ }) => {
1876
+ let [v, b] = V("");
1877
+ R(() => {
1878
+ e || b("");
1732
1879
  }, [e]);
1733
- let b = a && a.length > 0, x = u !== void 0, S = !b && !x ? d ?? f : void 0, C = b ? Y(a, v) : [], w = (e) => {
1734
- l(e), i();
1735
- }, T = s({
1736
- "--ci-sheet-divider": _?.divider,
1737
- "--ci-sheet-text": _?.itemText,
1738
- "--ci-sheet-item-hover": _?.itemHoverBg,
1739
- "--ci-sheet-item-active": _?.itemActiveBg,
1740
- "--ci-sheet-icon": _?.itemIcon,
1741
- "--ci-check-icon": _?.checkIcon
1880
+ let x = a && a.length > 0, S = u !== void 0, C = !x && !S ? d ?? f : void 0, w = x ? Dt(a, v) : [], T = (e) => {
1881
+ s(e), i();
1882
+ }, E = _?.colors, D = c({
1883
+ "--ci-sheet-divider": g?.divider,
1884
+ "--ci-sheet-text": E?.itemText ?? g?.itemText,
1885
+ "--ci-sheet-item-hover": E?.itemHoverBackground ?? g?.itemHoverBg,
1886
+ "--ci-sheet-item-active": g?.itemActiveBg,
1887
+ "--ci-sheet-icon": E?.itemText ?? g?.itemIcon,
1888
+ "--ci-check-icon": E?.checkIcon ?? g?.checkIcon,
1889
+ "--ci-sheet-selected-bg": E?.selectedItemBackground,
1890
+ "--ci-sheet-selected-text": E?.selectedItemText
1742
1891
  });
1743
- return /* @__PURE__ */ U(Ee, {
1892
+ return /* @__PURE__ */ P(U, {
1744
1893
  isOpen: e,
1745
1894
  title: t,
1746
1895
  closeLabel: n,
1747
1896
  onClose: i,
1748
1897
  style: p,
1749
1898
  titleClassName: m,
1750
- className: "max-h-[80dvh]",
1751
- colors: _?.shell,
1752
- children: /* @__PURE__ */ W("div", {
1899
+ className: l("max-h-[80dvh]", _?.className, H.modelMenu),
1900
+ colors: g?.shell,
1901
+ children: /* @__PURE__ */ F("div", {
1753
1902
  className: "contents",
1754
- style: T,
1755
- children: [b && !x && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("div", {
1756
- className: "flex-shrink-0 px-4 py-[10px]",
1757
- children: /* @__PURE__ */ U(O, {
1903
+ style: D,
1904
+ children: [x && !S && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P("div", {
1905
+ style: c({ "--ci-sheet-search-bg": _?.colors?.searchHeaderBackground }),
1906
+ className: l("flex-shrink-0 px-4 py-[10px]", Kt.search, _?.searchHeaderClassName, H.modelMenuSearch),
1907
+ children: /* @__PURE__ */ P(j, {
1758
1908
  value: v,
1759
1909
  placeholder: r,
1760
- size: g.Standard,
1761
- onChange: (e) => y(e ?? "")
1910
+ size: y.Standard,
1911
+ onChange: (e) => b(e ?? "")
1762
1912
  })
1763
- }), /* @__PURE__ */ U("div", { className: c(Pt.divider, "h-px flex-shrink-0") })] }), x ? /* @__PURE__ */ U(pt, { loadingLabel: u }) : S ? /* @__PURE__ */ U("div", {
1913
+ }), /* @__PURE__ */ P("div", { className: l(Kt.divider, "h-px flex-shrink-0") })] }), S ? /* @__PURE__ */ P(Tt, { loadingLabel: u }) : C ? /* @__PURE__ */ P("div", {
1764
1914
  role: "list",
1765
- className: c(Pt.stateLabel, h, "px-4 py-4"),
1766
- children: S
1767
- }) : /* @__PURE__ */ U(Nt, {
1915
+ className: l(Kt.stateLabel, h, "px-4 py-4"),
1916
+ children: C
1917
+ }) : /* @__PURE__ */ P(Gt, {
1768
1918
  role: "list",
1769
1919
  className: "overflow-y-auto",
1770
- style: { height: Math.min(C.length, It) * Ft },
1771
- rowComponent: Lt,
1772
- rowCount: C.length,
1773
- rowHeight: Ft,
1920
+ style: { height: Math.min(w.length, Jt) * qt },
1921
+ rowComponent: Yt,
1922
+ rowCount: w.length,
1923
+ rowHeight: qt,
1774
1924
  rowProps: {
1775
- items: C,
1925
+ items: w,
1776
1926
  selectedDeploymentId: o,
1777
1927
  labelClassName: h,
1778
1928
  query: v,
1779
- onSelect: w
1929
+ itemClassName: _?.itemClassName,
1930
+ selectedItemClassName: _?.selectedItemClassName,
1931
+ hasSelectedBackground: !!E?.selectedItemBackground,
1932
+ hasSelectedText: !!E?.selectedItemText,
1933
+ onSelect: T
1780
1934
  }
1781
1935
  })]
1782
1936
  })
1783
1937
  });
1784
- }, zt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, isStreaming: i, isMobile: a, isDisabled: s = !1, style: l, modelPickerOverlay: u, isPickerOpen: d, onPickerToggle: f, onPickerOpenChange: g }) => {
1785
- let [_, y] = V(!1), { selectorIcon: b, selectorAriaLabel: x, selectedLabel: S, selectedVersion: C, menuItems: w, menuHeader: T, onOpenChange: E } = gt({
1938
+ }, Zt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, menuStyles: i, isStreaming: a, isMobile: o, isDisabled: c = !1, style: u, modelPickerOverlay: d, isPickerOpen: f, onPickerToggle: p, onPickerOpenChange: h }) => {
1939
+ let [y, b] = V(!1), { selectorIcon: S, selectorAriaLabel: C, selectedLabel: w, selectedVersion: T, menuItems: E, menuHeader: D, menuStyle: ee, onOpenChange: O } = At({
1786
1940
  deployments: e,
1787
1941
  selectedDeploymentId: t,
1788
1942
  onDeploymentChange: n,
1789
- modelSelectorLabels: r
1943
+ modelSelectorLabels: r,
1944
+ styles: i
1790
1945
  });
1791
1946
  if (!e) return null;
1792
- let D = i || s ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, O = /* @__PURE__ */ U(N, {
1793
- size: p.SM,
1794
- className: K.modelSelectorCaret,
1947
+ let k = a || c, A = k ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, j = /* @__PURE__ */ P(fe, {
1948
+ size: g.SM,
1949
+ className: l(K.modelSelectorCaret, H.modelSelectorCaret),
1795
1950
  "aria-hidden": !0,
1796
- stroke: m
1951
+ stroke: _
1952
+ }), te = /* @__PURE__ */ P("span", {
1953
+ className: l("flex shrink-0 items-center", H.modelSelectorIcon),
1954
+ children: S
1797
1955
  });
1798
- return a ? /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(ie, {
1799
- tooltip: S,
1800
- children: /* @__PURE__ */ U(v, {
1801
- icon: /* @__PURE__ */ W("div", {
1802
- className: "flex items-center gap-1",
1803
- children: [b, O]
1804
- }),
1805
- "aria-label": x,
1806
- onClick: () => {
1807
- s || y(!0);
1808
- },
1809
- className: c("w-[50px]", K.modelSelectorButton, D)
1810
- })
1811
- }), u ? /* @__PURE__ */ U(Ee, {
1812
- isOpen: _,
1956
+ if (o) return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(x, {
1957
+ tooltipProps: { tooltip: w },
1958
+ icon: /* @__PURE__ */ F("div", {
1959
+ className: "flex items-center gap-1",
1960
+ children: [te, j]
1961
+ }),
1962
+ "aria-label": C,
1963
+ "aria-disabled": k || void 0,
1964
+ onClick: () => {
1965
+ k || b(!0);
1966
+ },
1967
+ className: l("w-[50px]", K.modelSelectorButton, A, H.modelSelectorButton)
1968
+ }), d ? /* @__PURE__ */ P(U, {
1969
+ isOpen: y,
1813
1970
  title: r?.ariaLabel ?? "Select model",
1814
1971
  closeLabel: r?.closeLabel ?? "Close",
1815
- onClose: () => y(!1),
1816
- style: l,
1817
- children: u(() => y(!1))
1818
- }) : /* @__PURE__ */ U(Rt, {
1819
- isOpen: _,
1972
+ onClose: () => b(!1),
1973
+ style: u,
1974
+ className: l(i?.className, H.modelMenu),
1975
+ children: d(() => b(!1))
1976
+ }) : /* @__PURE__ */ P(Xt, {
1977
+ isOpen: y,
1820
1978
  title: r?.ariaLabel ?? "Select model",
1821
1979
  closeLabel: r?.closeLabel ?? "Close",
1822
1980
  searchPlaceholder: r?.searchPlaceholder ?? "Search",
1823
- onClose: () => y(!1),
1981
+ onClose: () => b(!1),
1824
1982
  deployments: e,
1825
1983
  selectedDeploymentId: t,
1826
1984
  onSelect: (e) => n?.(e),
1827
1985
  loadingLabel: r?.loading,
1828
1986
  errorLabel: r?.error,
1829
1987
  emptyLabel: r?.empty,
1830
- style: l
1831
- })] }) : u ? /* @__PURE__ */ U(h, {
1832
- placement: "top-end",
1833
- matchReferenceWidth: !1,
1834
- open: d,
1835
- onOpenChange: g,
1836
- trigger: [],
1837
- outsideClosable: !0,
1838
- renderOverlay: () => u(() => g?.(!1)),
1839
- listClassName: "!w-[368px] !bg-layer-raised",
1840
- children: /* @__PURE__ */ U(ie, {
1841
- tooltip: C ? `${S} · ${C}` : S,
1842
- children: /* @__PURE__ */ W("button", {
1843
- type: "button",
1844
- "aria-label": x,
1845
- "aria-disabled": s || void 0,
1846
- className: c("flex min-w-0 items-center gap-1.5 rounded-full py-1.5 pe-2 ps-1.5", K.modelSelectorButton, D, s && K.modelSelectorButtonDisabled),
1988
+ style: u,
1989
+ menuStyles: i
1990
+ })] });
1991
+ if (d) {
1992
+ let e = T ? `${w} · ${T}` : w;
1993
+ return /* @__PURE__ */ P(v, {
1994
+ placement: "top-end",
1995
+ matchReferenceWidth: !1,
1996
+ open: f,
1997
+ onOpenChange: h,
1998
+ trigger: [],
1999
+ outsideClosable: !0,
2000
+ renderOverlay: () => d(() => h?.(!1)),
2001
+ listClassName: l("!w-[368px] !bg-layer-raised", i?.className, H.modelMenu),
2002
+ children: /* @__PURE__ */ P(m, {
2003
+ "aria-label": C,
2004
+ "aria-disabled": k || void 0,
2005
+ tooltipProps: { tooltip: e },
2006
+ className: l("h-auto min-w-0 gap-1.5 !rounded-full !border-0 px-0 py-1.5 pe-2 ps-1.5", K.modelSelectorButton, A, k && K.modelSelectorButtonDisabled, H.modelSelectorButton),
1847
2007
  onClick: () => {
1848
- !i && !s && f?.();
2008
+ k || p?.();
1849
2009
  },
1850
- children: [
1851
- b,
1852
- /* @__PURE__ */ W("span", {
1853
- className: "flex min-w-0 max-w-[180px] items-baseline gap-1",
1854
- children: [/* @__PURE__ */ U("span", {
1855
- className: c("dial-small-text max-w-[180px] shrink-0 truncate", K.modelSelectorName),
1856
- children: S
1857
- }), C && /* @__PURE__ */ U("span", {
1858
- className: c("dial-tiny-text min-w-0 truncate", K.modelSelectorVersion),
1859
- children: C
1860
- })]
1861
- }),
1862
- O
1863
- ]
2010
+ iconBefore: te,
2011
+ iconAfter: j,
2012
+ textClassName: "min-w-0",
2013
+ label: /* @__PURE__ */ F("span", {
2014
+ className: "flex min-w-0 max-w-[180px] items-baseline gap-1",
2015
+ children: [/* @__PURE__ */ P("span", {
2016
+ className: l("dial-small-text max-w-[180px] shrink-0 truncate", K.modelSelectorName),
2017
+ children: w
2018
+ }), T && /* @__PURE__ */ P("span", {
2019
+ className: l("dial-tiny-text min-w-0 truncate", K.modelSelectorVersion),
2020
+ children: T
2021
+ })]
2022
+ })
1864
2023
  })
1865
- })
1866
- }) : /* @__PURE__ */ U("div", {
1867
- className: c(s && D),
1868
- "aria-disabled": s || void 0,
1869
- children: /* @__PURE__ */ U(h, {
1870
- items: w,
1871
- menuHeader: T,
2024
+ });
2025
+ }
2026
+ return /* @__PURE__ */ P("div", {
2027
+ className: l(A),
2028
+ "aria-disabled": k || void 0,
2029
+ children: /* @__PURE__ */ P(v, {
2030
+ items: E,
2031
+ menuHeader: D,
1872
2032
  placement: "bottom-end",
1873
2033
  matchReferenceWidth: !1,
1874
- maxDropdownHeight: o,
1875
- listClassName: "!w-[240px]",
1876
- disabled: s,
1877
- onOpenChange: s ? void 0 : E,
1878
- children: /* @__PURE__ */ U(ie, {
1879
- tooltip: S,
1880
- children: /* @__PURE__ */ W("button", {
1881
- type: "button",
1882
- "aria-label": x,
1883
- "aria-disabled": s || void 0,
1884
- className: c("flex items-center gap-1 rounded-full p-1.5", K.modelSelectorButton, s && K.modelSelectorButtonDisabled),
1885
- children: [b, O]
1886
- })
2034
+ maxDropdownHeight: s,
2035
+ listClassName: l("!w-[240px]", i?.className, H.modelMenu),
2036
+ listStyle: ee,
2037
+ disabled: k,
2038
+ onOpenChange: k ? void 0 : O,
2039
+ children: /* @__PURE__ */ P(m, {
2040
+ "aria-label": C,
2041
+ "aria-disabled": k || void 0,
2042
+ tooltipProps: { tooltip: w },
2043
+ iconBefore: te,
2044
+ iconAfter: j,
2045
+ className: l("h-auto gap-1 !rounded-full !border-0 p-1.5", K.modelSelectorButton, k && K.modelSelectorButtonDisabled, H.modelSelectorButton)
1887
2046
  })
1888
2047
  })
1889
2048
  });
1890
- }, Bt = ({ message: e = "", messageRevision: t, textInsertion: n, onSend: r, onUploadAttachment: i, onStop: a, isStreaming: o = !1, onChange: d, onAttachmentsChange: f, placeholder: g = "Type a message...", ariaLabel: _, attachLabel: y = "Attach file", fileAccept: b, addMenuTitle: x = "Add", menuTitle: S = "Menu", menuCloseLabel: C = "Close", removeLabel: w, retryLabel: T, uploadingLabel: E, sendLabel: D, stopLabel: O, micLabel: k = "Dictate", recordVoiceLabel: ee = "Record voice", stopRecordingLabel: A, discardRecordingLabel: te, colors: j, typography: ne, className: re, pendingDropFiles: ie = [], onDropFilesConsumed: ae, pendingAttachments: oe = [], onPendingAttachmentsConsumed: M, pasteTextThreshold: N = 4e3, maxMessageLength: P = 5e4, deployments: le, selectedDeploymentId: F, onDeploymentChange: ue, modelSelectorLabels: de, initialAttachments: fe = [], hideAddButton: pe = !1, hideAttachFile: me = !1, hideActionBar: he = !1, renderFooterActions: ge, isInputDisabled: R = !1, isModelSelectorDisabled: _e = !1, isSendDisabled: ve = !1, isAudioMessageSupported: be = !1, isVoiceRecordingSupported: xe = be, onTranscribeAudio: Ce, transcribingLabel: we, voiceErrorLabel: Te, sendOnEnter: Ee = We.Enter, prefixAttachments: De = [], onRemovePrefixAttachment: ke, chatSettings: je, toolsMenuItems: Me, onToolToggle: Fe, canRemoveTools: ze = !0, toolsMenuTitle: Be, toolsBackLabel: Ve, toolsChipLabels: He, menuOverlays: Ge, inlineStartSlot: Ke, onInlineStartRemove: qe, commandMenu: G, autoFocus: Je = !1, messageHistory: Ye, onDialFileSystemClick: Xe, dialFileSystemLabel: Ze, validateAttachment: Qe, onAttachmentClick: $e, modelPickerOverlay: et, maximumAttachmentsAmount: nt, onAttachmentsLimitExceeded: rt, isAttachmentsEnabled: at = !0, isTextAttachmentsAllowed: ot = !0, usageLimitsSlot: st, onMessageTooLong: q }) => {
1891
- let dt = l(), [ft, pt] = V(!1), J = Ne(Ye), Y = Ke != null, mt = B(null), [ht, gt] = V(0), _t = z(() => s({
1892
- "--ci-bg": j?.background,
1893
- "--ci-text": j?.text,
1894
- "--ci-border": j?.border,
1895
- "--ci-border-focus": j?.borderFocus,
1896
- "--ci-placeholder": j?.placeholder,
1897
- "--ci-text-disabled": j?.textDisabled,
1898
- "--ci-model-selector-caret-color": j?.modelSelectorCaret,
1899
- "--ci-model-selector-hover-bg": j?.modelSelectorHoverBg,
1900
- "--ci-model-selector-disabled-color": j?.modelSelectorDisabled,
1901
- "--ci-model-selector-name-color": j?.modelSelectorName,
1902
- "--ci-model-selector-version-color": j?.modelSelectorVersion,
1903
- "--ci-voice-error": j?.voiceError,
1904
- "--ci-voice-waveform": j?.voiceWaveform,
1905
- "--ci-voice-accent": j?.voiceAccent,
1906
- "--ci-first-line-indent": Y ? `calc(${ht}px + 4px)` : void 0
1907
- }), [
1908
- j,
1909
- Y,
1910
- ht
1911
- ]), vt = z(() => Xe ? [{
2049
+ }, Qt = Ce(({ message: e = "", messageRevision: t, focusRequestId: n, textInsertion: r, onSend: i, onUploadAttachment: a, onStop: o, isStreaming: s = !1, onChange: u, onAttachmentsChange: p, placeholder: m = "Type a message...", ariaLabel: h, attachLabel: y = "Attach file", fileAccept: S, addMenuTitle: C = "Add", menuTitle: w = "Menu", menuCloseLabel: T = "Close", removeLabel: E, retryLabel: D, uploadingLabel: ee, expandLabel: O, clickLabel: k, sendLabel: A, sendTooltip: j, emptyMessageTooltip: te, stopLabel: ne, micLabel: re = "Dictate", recordVoiceLabel: ie = "Record voice", stopRecordingLabel: ae, discardRecordingLabel: oe, colors: M, typography: I, attachmentTray: ce, modelMenu: ue, className: de, pendingDropFiles: fe = [], onDropFilesConsumed: pe, pendingAttachments: ge = [], onPendingAttachmentsConsumed: _e, pasteTextThreshold: ve = 4e3, maxMessageLength: ye = 5e4, deployments: be, selectedDeploymentId: xe, onDeploymentChange: Se, modelSelectorLabels: Ce, initialAttachments: we = [], hideAddButton: Te = !1, hideAttachFile: Oe = !1, hideActionBar: U = !1, actionRowLayout: ke = tt.Stacked, isInlineActionRowAllowedBelowDesktop: je = !1, renderFooterActions: Me, isInputDisabled: W = !1, isModelSelectorDisabled: Ne = !1, isSendDisabled: Ie = !1, isAudioMessageSupported: Le = !1, isVoiceRecordingSupported: Be = Le, onTranscribeAudio: Ve, transcribingLabel: Ge, voiceErrorLabel: Ye, sendOnEnter: Xe = et.Enter, prefixAttachments: Ze = [], onRemovePrefixAttachment: Qe, chatSettings: nt, toolsMenuItems: rt, onToolToggle: it, canRemoveTools: at = !0, toolsMenuTitle: ot, toolsBackLabel: st, toolsChipLabels: ct, menuOverlays: lt, activeMentions: ut, onBackspaceAtCaret: dt, caretPositionOverride: ft, commandMenu: G, autoFocus: mt = !1, messageHistory: gt, onDialFileSystemClick: _t, dialFileSystemLabel: vt, validateAttachment: yt, onAttachmentClick: Ct, modelPickerOverlay: wt, maximumAttachmentsAmount: Tt, onAttachmentsLimitExceeded: Et, isAttachmentsEnabled: Dt = !0, isTextAttachmentsAllowed: Ot = !0, usageLimitsSlot: kt, onMessageTooLong: At }, jt) => {
2050
+ let Mt = d(), [Nt, Pt] = V(!1), q = Re(gt), Ft = ut ?? [], It = Ft.length > 0, J = z(() => c({
2051
+ "--ci-bg": M?.background,
2052
+ "--ci-text": M?.text,
2053
+ "--ci-border": M?.border,
2054
+ "--ci-border-focus": M?.borderFocus,
2055
+ "--ci-placeholder": M?.placeholder,
2056
+ "--ci-text-disabled": M?.textDisabled,
2057
+ "--ci-model-selector-caret-color": M?.modelSelectorCaret,
2058
+ "--ci-model-selector-hover-bg": M?.modelSelectorHoverBg,
2059
+ "--ci-model-selector-disabled-color": M?.modelSelectorDisabled,
2060
+ "--ci-model-selector-name-color": M?.modelSelectorName,
2061
+ "--ci-model-selector-version-color": M?.modelSelectorVersion,
2062
+ "--ci-voice-waveform": M?.voiceWaveform,
2063
+ "--ci-voice-accent": M?.voiceAccent,
2064
+ "--ci-mention-highlight-bg": M?.mentionHighlightBg,
2065
+ "--ci-mention-highlight-text": M?.mentionHighlightText,
2066
+ "--ci-mention-highlight-unsupported-bg": M?.mentionHighlightUnsupportedBg,
2067
+ "--ci-mention-highlight-unsupported-text": M?.mentionHighlightUnsupportedText
2068
+ }), [M]), Lt = z(() => _t ? [{
1912
2069
  key: "dial-fs",
1913
- label: Ze ?? "DIAL file system",
1914
- icon: /* @__PURE__ */ U(se, {
1915
- size: u,
2070
+ label: vt ?? "DIAL file system",
2071
+ icon: /* @__PURE__ */ P(me, {
2072
+ size: f,
1916
2073
  "aria-hidden": !0,
1917
- stroke: m
2074
+ stroke: _
1918
2075
  }),
1919
- onClick: Xe
1920
- }] : [], [Xe, Ze]), { message: X, setMessage: Z, textareaRef: Q } = Pe({
2076
+ onClick: _t
2077
+ }] : [], [_t, vt]), { message: Y, setMessage: X, textareaRef: Z } = Ue({
1921
2078
  messageProp: e,
1922
2079
  messageRevision: t
1923
2080
  });
1924
- Ie({
1925
- insertion: n,
1926
- textareaRef: Q
1927
- });
1928
- let { isMenuOpen: yt, query: bt, dismiss: $, handleValueChange: xt } = Ae({
2081
+ R(() => {
2082
+ n !== void 0 && Z.current?.focus();
2083
+ }, [n, Z]), Ee(jt, () => ({ getCaretPosition: () => Z.current?.selectionStart ?? Y.length }), [Y, Z]);
2084
+ let { handleUndoKeyDown: Rt } = Ke({
2085
+ insertion: r,
2086
+ textareaRef: Z
2087
+ }), { isMenuOpen: zt, query: Bt, activeWordStart: Q, dismiss: Vt, closeOnOutsidePress: Ht, handleCaretMove: Ut, handleValueChange: Wt, listboxId: Gt, overlayRef: Kt, activeOptionId: qt, moveActiveOption: Jt, getActiveOption: Yt } = Fe({
1929
2088
  config: G,
1930
- message: X
1931
- }), St = G?.emptyQueryHint != null, Ct = St && yt && bt === "", wt = I((e) => {
1932
- if (G == null || ($(), !e?.consumeQuery)) return;
1933
- Q.current?.focus();
1934
- let t = `${G.triggerPrefix}${bt}`;
1935
- if (!X.startsWith(t)) return;
1936
- let n = X.slice(t.length);
1937
- Z(n), J.notifyChange(), d?.(n);
2089
+ message: Y
2090
+ }), Xt = () => {
2091
+ Ut(Z.current?.selectionStart ?? Y.length);
2092
+ }, Qt = () => {
2093
+ requestAnimationFrame(() => {
2094
+ Ut(Z.current?.selectionStart ?? Y.length);
2095
+ });
2096
+ }, $t = (e) => {
2097
+ e.key !== "ArrowLeft" && e.key !== "ArrowRight" && e.key !== "Home" && e.key !== "End" && e.key !== "PageUp" && e.key !== "PageDown" || Ut(e.currentTarget.selectionStart ?? Y.length);
2098
+ }, en = G?.emptyQueryHint != null, tn = G != null && Q != null ? Q + G.triggerPrefix.length : null, nn = tn != null && Y.slice(tn).split("\n", 1)[0] !== "", rn = en && zt && Bt === "" && tn != null && !nn, an = G != null && zt ? Q ?? 0 : null, on = B(null), sn = B(null), [cn, ln] = V(null), un = L(() => {
2099
+ let e = on.current, t = sn.current;
2100
+ if (e == null || t == null) {
2101
+ ln(null);
2102
+ return;
2103
+ }
2104
+ let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
2105
+ ln({
2106
+ left: n.left - r.left,
2107
+ top: n.top - r.top
2108
+ });
2109
+ }, []);
2110
+ De(() => {
2111
+ un();
1938
2112
  }, [
1939
- G,
1940
- $,
1941
- bt,
1942
- X,
2113
+ un,
2114
+ an,
2115
+ Y
2116
+ ]), R(() => {
2117
+ if (an == null) return;
2118
+ let e = Z.current;
2119
+ if (e == null || typeof ResizeObserver > "u") return;
2120
+ let t = new ResizeObserver(un);
2121
+ return t.observe(e), () => t.disconnect();
2122
+ }, [
2123
+ an,
1943
2124
  Z,
1944
- J,
1945
- d,
1946
- Q
2125
+ un
1947
2126
  ]);
1948
- L(() => {
1949
- let e = mt.current;
1950
- if (e == null) return;
1951
- let t = new ResizeObserver((e) => {
1952
- let t = e[0];
1953
- t != null && gt(t.contentRect.width);
1954
- });
1955
- return t.observe(e), () => t.disconnect();
2127
+ let dn = L((e) => {
2128
+ if (G == null || (Vt(), !e?.consumeQuery) || (e.returnFocus !== !1 && Z.current?.focus(), Q == null)) return;
2129
+ let t = `${G.triggerPrefix}${Bt}`, n = Q + t.length;
2130
+ if (Y.slice(Q, n) !== t) return;
2131
+ let r = Y.slice(0, Q) + Y.slice(n);
2132
+ X(r), q.notifyChange(), u?.(r);
2133
+ }, [
2134
+ G,
2135
+ Vt,
2136
+ Bt,
2137
+ Y,
2138
+ Q,
2139
+ X,
2140
+ q,
2141
+ u,
2142
+ Z
2143
+ ]), fn = B(void 0);
2144
+ R(() => {
2145
+ ft == null || fn.current === t || (fn.current = t, Z.current?.setSelectionRange(ft, ft), Ut(ft));
1956
2146
  }, [Y]);
1957
- let { attachments: Tt, buildAttachments: Et, addAttachments: Dt, resetAttachments: Ot, handleRemove: kt, handleRetry: At, handleExpand: jt, hasBlockedAttachments: Mt } = Oe({
1958
- initialAttachments: fe,
1959
- onUploadAttachment: i,
1960
- onAttachmentsChange: f,
1961
- validateAttachment: Qe,
1962
- pendingDropFiles: ie,
1963
- onDropFilesConsumed: ae,
1964
- pendingAttachments: oe,
1965
- onPendingAttachmentsConsumed: M,
1966
- onExpandPastedText: I((e) => {
1967
- Z((t) => t ? `${t}\n${e}` : e);
1968
- }, [Z]),
1969
- maximumAttachmentsAmount: nt,
1970
- baseAttachmentsAmount: De.length,
1971
- onAttachmentsLimitExceeded: rt
1972
- }), Nt = I((e) => {
1973
- Dt(Et([e]));
1974
- }, [Dt, Et]), Pt = B(!1), Ft = B(X);
1975
- Ft.current = X;
1976
- let [It, Lt] = V({
2147
+ let { attachments: pn, buildAttachments: mn, addAttachments: hn, resetAttachments: gn, handleRemove: _n, handleRetry: vn, handleExpand: yn, hasBlockedAttachments: bn } = Ae({
2148
+ initialAttachments: we,
2149
+ onUploadAttachment: a,
2150
+ onAttachmentsChange: p,
2151
+ validateAttachment: yt,
2152
+ pendingDropFiles: fe,
2153
+ onDropFilesConsumed: pe,
2154
+ isDropDisabled: W,
2155
+ pendingAttachments: ge,
2156
+ onPendingAttachmentsConsumed: _e,
2157
+ onExpandPastedText: L((e) => {
2158
+ X((t) => t ? `${t}\n${e}` : e);
2159
+ }, [X]),
2160
+ maximumAttachmentsAmount: Tt,
2161
+ baseAttachmentsAmount: Ze.length,
2162
+ onAttachmentsLimitExceeded: Et
2163
+ }), xn = L((e) => {
2164
+ hn(mn([e]));
2165
+ }, [hn, mn]), Sn = B(!1), Cn = B(Y);
2166
+ Cn.current = Y;
2167
+ let [wn, Tn] = V({
1977
2168
  text: "",
1978
2169
  revision: 0
1979
- }), { state: Rt, analyserNodeRef: Bt, errorMessage: Vt, startRecording: Ht, stopRecording: Ut, discardRecording: Wt } = Ue({
1980
- onAttachAudio: Nt,
1981
- onTranscribeAudio: Ce,
1982
- onTranscript: I((e) => {
2170
+ }), { state: En, analyserNodeRef: Dn, errorMessage: On, startRecording: kn, stopRecording: An, discardRecording: jn } = $e({
2171
+ onAttachAudio: xn,
2172
+ onTranscribeAudio: Ve,
2173
+ onTranscript: L((e) => {
1983
2174
  let t = e.trim();
1984
2175
  if (t) {
1985
- let e = Ft.current, n = `${e}${e && !/\s$/.test(e) ? " " : ""}${t}`;
1986
- Ft.current = n, Z(n), Lt((e) => ({
2176
+ let e = Cn.current, n = `${e}${e && !/\s$/.test(e) ? " " : ""}${t}`;
2177
+ Cn.current = n, X(n), Tn((e) => ({
1987
2178
  text: t,
1988
2179
  revision: e.revision + 1
1989
- })), J.notifyChange(), d?.(n);
2180
+ })), q.notifyChange(), u?.(n);
1990
2181
  }
1991
- Pt.current = !0;
2182
+ Sn.current = !0;
1992
2183
  }, [
1993
- Z,
1994
- J,
1995
- d
2184
+ X,
2185
+ q,
2186
+ u
1996
2187
  ]),
1997
- errorLabel: Te
1998
- }), Gt = Rt !== Le.Idle;
1999
- L(() => {
2000
- Rt === Le.Idle && Pt.current && (Pt.current = !1, Q.current?.focus());
2001
- }, [Rt, Q]);
2002
- let Kt = B(null), qt = B(null), Jt = at && ot, { handlePaste: Yt } = Se(Dt, Jt ? N : Infinity), Xt = I((e) => {
2003
- if (!Jt) {
2188
+ errorLabel: Ye
2189
+ }), $ = En === qe.Recording || En === qe.Processing;
2190
+ R(() => {
2191
+ (En === qe.Error || En === qe.Idle && Sn.current) && (Sn.current = !1, Z.current?.focus());
2192
+ }, [En, Z]);
2193
+ let Mn = B(null), Nn = B(null), Pn = Dt && Ot, { handlePaste: Fn } = le(hn, Pn ? ve : Infinity), In = L((e) => {
2194
+ if (!Pn) {
2004
2195
  let t = e.clipboardData.getData("text/plain");
2005
- t.length >= P && q?.(t.length, P);
2196
+ t.length >= ye && At?.(t.length, ye);
2006
2197
  }
2007
- Yt(e);
2198
+ Fn(e);
2008
2199
  }, [
2009
- Jt,
2010
- P,
2011
- q,
2012
- Yt
2013
- ]), Zt = (X.trim().length > 0 || Tt.length > 0 || Y) && !Mt && !ve && !Gt, [Qt, $t] = V([]);
2014
- L(() => {
2015
- $t([]);
2016
- }, [(Me ?? []).map((e) => e.id).join("|")]);
2017
- let en = z(() => {
2018
- let e = Me ?? [];
2019
- return ze ? e.filter((e) => e.isSelected || !Qt.includes(e.id)) : e;
2200
+ Pn,
2201
+ ye,
2202
+ At,
2203
+ Fn
2204
+ ]), Ln = Y.trim().length > 0 || pn.length > 0, Rn = Ln && !bn && !Ie && !$, [zn, Bn] = V([]);
2205
+ R(() => {
2206
+ Bn([]);
2207
+ }, [(rt ?? []).map((e) => e.id).join("|")]);
2208
+ let Vn = z(() => {
2209
+ let e = rt ?? [];
2210
+ return at ? e.filter((e) => e.isSelected || !zn.includes(e.id)) : e;
2020
2211
  }, [
2021
- Me,
2022
- Qt,
2023
- ze
2024
- ]), tn = I((e) => {
2025
- $t((t) => t.includes(e) ? t : [...t, e]), Me?.find((t) => t.id === e)?.isSelected && Fe?.(e);
2026
- }, [Me, Fe]), nn = le === void 0 || F != null, rn = be && !o, an = async () => {
2027
- if (ve || Gt) return;
2028
- if (X.length >= P) {
2029
- q?.(X.length, P);
2212
+ rt,
2213
+ zn,
2214
+ at
2215
+ ]), Hn = L((e) => {
2216
+ Bn((t) => t.includes(e) ? t : [...t, e]), rt?.find((t) => t.id === e)?.isSelected && it?.(e);
2217
+ }, [rt, it]), Un = be === void 0 || xe != null, Wn = Le && !s, Gn = async () => {
2218
+ if (Ie || $) return;
2219
+ if (Y.length >= ye) {
2220
+ At?.(Y.length, ye);
2030
2221
  return;
2031
2222
  }
2032
- let e = X, t = Tt;
2033
- Z(""), J.reset();
2223
+ let e = Y, t = pn;
2224
+ X(""), q.reset();
2034
2225
  try {
2035
- await r?.(e, t), t.forEach((e) => {
2226
+ await i?.(e, t), t.forEach((e) => {
2036
2227
  e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
2037
- }), Ot([]);
2228
+ }), gn([]);
2038
2229
  } catch {
2039
- Z(e), Ot(t);
2230
+ X(e), gn(t);
2040
2231
  }
2041
- }, on = (e) => {
2042
- if (!Gt) {
2043
- if (!e.nativeEvent.isComposing && !R && !o) {
2232
+ }, Kn = (e) => Xe === et.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey, qn = (e) => {
2233
+ if (!zt || e.nativeEvent.isComposing) return !1;
2234
+ if (e.key === "Escape") return e.preventDefault(), e.stopPropagation(), Vt(), !0;
2235
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") return e.preventDefault(), Jt(e.key === "ArrowDown" ? Pe.Next : Pe.Previous), !0;
2236
+ if (e.key !== "Enter" || e.shiftKey) return !1;
2237
+ let t = Yt();
2238
+ return t == null ? Kn(e) ? (e.preventDefault(), !0) : !1 : (e.preventDefault(), t.click(), !0);
2239
+ }, Jn = (e) => {
2240
+ if (!$ && !Rt(e) && !qn(e)) {
2241
+ if (!e.nativeEvent.isComposing && !W && !s) {
2044
2242
  if (e.key === "ArrowUp" || e.key === "ArrowDown") {
2045
- let t = e.currentTarget.selectionStart ?? 0, n = J.navigate(e.key === "ArrowUp" ? "up" : "down", X, t);
2243
+ let t = e.currentTarget.selectionStart ?? 0, n = q.navigate(e.key === "ArrowUp" ? "up" : "down", Y, t);
2046
2244
  if (n !== null) {
2047
- e.preventDefault(), Z(n);
2245
+ e.preventDefault(), X(n);
2048
2246
  return;
2049
2247
  }
2050
2248
  }
2051
- if (e.key === "Backspace" && Y && qe != null && e.currentTarget.selectionStart === 0 && e.currentTarget.selectionEnd === 0) {
2052
- e.preventDefault(), qe();
2053
- return;
2249
+ if (e.key === "Backspace" && dt != null && e.currentTarget.selectionStart === e.currentTarget.selectionEnd && e.currentTarget.selectionStart != null) {
2250
+ let t = dt(e.currentTarget.selectionStart);
2251
+ if (t != null) {
2252
+ e.preventDefault();
2253
+ let n = e.currentTarget;
2254
+ n.setSelectionRange(t.start, t.start + t.length), typeof document.execCommand == "function" && document.execCommand("delete", !1) || We(n, Y.slice(0, t.start) + Y.slice(t.start + t.length), t.start);
2255
+ return;
2256
+ }
2054
2257
  }
2055
2258
  }
2056
- e.key === "Enter" && (Ee === We.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !o && Zt && nn && !R && an());
2259
+ e.key === "Enter" && Kn(e) && (e.preventDefault(), !s && Rn && Un && !W && Gn());
2057
2260
  }
2058
- }, sn = (e) => {
2261
+ }, Yn = (e) => {
2059
2262
  let t = Array.from(e.target.files ?? []);
2060
2263
  if (t.length === 0) return;
2061
- let n = Et(t);
2062
- e.target.value = "", Dt(n);
2063
- }, cn = /* @__PURE__ */ U("textarea", {
2064
- className: c(K.textarea, Y && K.textareaIndented, ne?.fontClassName || "dial-body-paragraph-text", "max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent outline-none [field-sizing:content]", "disabled:cursor-not-allowed"),
2065
- ref: Q,
2066
- autoFocus: Je,
2067
- value: X,
2264
+ let n = mn(t);
2265
+ e.target.value = "", hn(n);
2266
+ }, Xn = z(() => {
2267
+ let e = [];
2268
+ return an != null && e.push({
2269
+ offset: an,
2270
+ node: /* @__PURE__ */ P("span", {
2271
+ ref: on,
2272
+ "aria-hidden": !0,
2273
+ className: "inline-block h-[1lh] w-0 align-text-top"
2274
+ }, "caret-marker")
2275
+ }), rn && G != null && tn != null && e.push({
2276
+ offset: tn,
2277
+ node: /* @__PURE__ */ P("span", {
2278
+ className: K.commandHint,
2279
+ "aria-hidden": !0,
2280
+ "data-mirror-synthetic": !0,
2281
+ children: G.emptyQueryHint
2282
+ }, "command-hint")
2283
+ }), e;
2284
+ }, [
2285
+ an,
2286
+ rn,
2287
+ G,
2288
+ tn
2289
+ ]), Zn = It || Xn.length > 0, { mirrorRef: Qn, selectionRects: $n, updateSelectionRects: er } = He({
2290
+ textareaRef: Z,
2291
+ message: Y,
2292
+ isMirrorActive: Zn
2293
+ }), tr = /* @__PURE__ */ P("textarea", {
2294
+ className: l(K.textarea, Zn && K.textareaMentionMode, I?.fontClassName || "dial-body-paragraph-text", "relative z-0 max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent pe-1 ps-1 outline-none [field-sizing:content]", "disabled:cursor-not-allowed"),
2295
+ ref: Z,
2296
+ autoFocus: mt,
2297
+ value: Y,
2068
2298
  onChange: (e) => {
2069
- Z(e.target.value), J.notifyChange();
2299
+ X(e.target.value), q.notifyChange();
2070
2300
  let t = e.nativeEvent instanceof InputEvent ? e.nativeEvent : void 0;
2071
- xt(e.target.value, t?.isComposing ?? !1, t?.inputType), d?.(e.target.value);
2301
+ Wt(e.target.value, e.target.selectionStart ?? e.target.value.length, t?.isComposing ?? !1), u?.(e.target.value);
2072
2302
  },
2073
- onKeyDown: on,
2074
- onPaste: Xt,
2075
- placeholder: Y ? void 0 : g,
2076
- "aria-label": _,
2077
- disabled: R,
2078
- readOnly: Gt,
2303
+ onSelect: er,
2304
+ onFocus: Qt,
2305
+ onClick: Xt,
2306
+ onKeyDown: Jn,
2307
+ onKeyUp: $t,
2308
+ onPaste: In,
2309
+ placeholder: m,
2310
+ "aria-label": h,
2311
+ "aria-autocomplete": G == null ? void 0 : "list",
2312
+ "aria-controls": zt ? Gt : void 0,
2313
+ "aria-activedescendant": qt ?? void 0,
2314
+ "aria-hidden": It ? !0 : void 0,
2315
+ disabled: W,
2316
+ readOnly: $,
2079
2317
  rows: 1
2080
- }), ln = G == null ? cn : /* @__PURE__ */ U(h, {
2081
- className: "w-full",
2082
- open: yt,
2083
- onOpenChange: (e) => {
2084
- e || $();
2318
+ }), nr = G == null ? tr : /* @__PURE__ */ F(N, { children: [tr, /* @__PURE__ */ P("div", {
2319
+ "aria-hidden": !0,
2320
+ className: l("pointer-events-none absolute", I?.fontClassName || "dial-body-paragraph-text"),
2321
+ style: {
2322
+ left: cn?.left ?? 0,
2323
+ top: cn?.top ?? 0
2085
2324
  },
2086
- placement: "top-start",
2087
- trigger: [],
2088
- initialFocus: -1,
2089
- matchReferenceWidth: !1,
2090
- outsidePressIgnoreRef: Q,
2091
- renderOverlay: () => {
2092
- let e = G.renderMenu({
2093
- query: bt,
2094
- close: wt
2095
- });
2096
- return G.menuLabel == null ? e : /* @__PURE__ */ U("div", {
2097
- role: "group",
2325
+ children: /* @__PURE__ */ P(v, {
2326
+ open: zt,
2327
+ onOpenChange: (e) => {
2328
+ e || Ht();
2329
+ },
2330
+ placement: "top-start",
2331
+ trigger: [],
2332
+ initialFocus: -1,
2333
+ matchReferenceWidth: !1,
2334
+ outsidePressIgnoreRef: Z,
2335
+ renderOverlay: () => /* @__PURE__ */ P("div", {
2336
+ ref: Kt,
2337
+ role: G.menuLabel == null ? void 0 : "group",
2098
2338
  "aria-label": G.menuLabel,
2099
- children: e
2100
- });
2101
- },
2102
- children: cn
2103
- }), un = Y || St ? /* @__PURE__ */ W("div", {
2104
- className: "relative w-full",
2105
- children: [
2106
- Y && /* @__PURE__ */ U("div", {
2107
- ref: mt,
2108
- className: "absolute start-0 top-0",
2109
- children: Ke
2339
+ children: G.renderMenu({
2340
+ query: Bt,
2341
+ caretPosition: Q ?? 0,
2342
+ close: dn,
2343
+ listboxId: Gt,
2344
+ activeOptionId: qt
2345
+ })
2110
2346
  }),
2111
- Ct && G != null && /* @__PURE__ */ W("span", {
2112
- className: c(K.commandHint, "pointer-events-none absolute start-[var(--ci-first-line-indent,0px)] top-0", ne?.fontClassName || "dial-body-paragraph-text"),
2347
+ children: /* @__PURE__ */ P("span", {
2113
2348
  "aria-hidden": !0,
2114
- children: [/* @__PURE__ */ U("span", {
2115
- className: "invisible",
2116
- children: G.triggerPrefix
2117
- }), G.emptyQueryHint]
2118
- }),
2119
- ln
2120
- ]
2121
- }) : ln, dn = pe ? void 0 : /* @__PURE__ */ U(tt, {
2122
- onAttachClick: me ? void 0 : () => Kt.current?.click(),
2349
+ className: "inline-block h-[1lh] w-0"
2350
+ })
2351
+ })
2352
+ })] }), rr = /* @__PURE__ */ F("div", {
2353
+ ref: sn,
2354
+ className: "relative -me-1 -ms-1 w-[calc(100%+8px)]",
2355
+ children: [Zn && /* @__PURE__ */ F("div", {
2356
+ ref: Qn,
2357
+ className: l(K.textarea, I?.fontClassName || "dial-body-paragraph-text", "pointer-events-none absolute inset-0 z-10 max-h-[272px] w-full overflow-hidden whitespace-pre-wrap pe-1 ps-1 [overflow-wrap:anywhere]"),
2358
+ children: [ze(Y, Ft, Xn, K.mentionHighlight, K.mentionHighlightUnsupported), $n.map((e, t) => /* @__PURE__ */ P("div", {
2359
+ "aria-hidden": !0,
2360
+ className: "pointer-events-none absolute rounded-sm bg-control-accent-alpha-active",
2361
+ style: {
2362
+ left: e.left,
2363
+ top: e.top,
2364
+ width: e.width,
2365
+ height: e.height
2366
+ }
2367
+ }, `selection-${t}`))]
2368
+ }), nr]
2369
+ }), ir = Te ? void 0 : /* @__PURE__ */ P(pt, {
2370
+ onAttachClick: Oe ? void 0 : () => Mn.current?.click(),
2123
2371
  attachLabel: y,
2124
- addMenuTitle: x,
2125
- menuTitle: S,
2126
- menuCloseLabel: C,
2127
- style: _t,
2128
- isDisabled: R || Gt && Rt !== Le.Recording,
2129
- chatSettings: je,
2130
- extraMenuItems: vt,
2131
- onRecordVoice: xe && at && !o && !Gt ? () => Ht(Re.Attachment) : void 0,
2132
- recordVoiceLabel: ee,
2133
- toolsMenuItems: ze ? Me : void 0,
2134
- onToolToggle: Fe,
2135
- toolsMenuTitle: Be,
2136
- toolsBackLabel: Ve,
2137
- menuOverlays: Ge
2372
+ addMenuTitle: C,
2373
+ menuTitle: w,
2374
+ menuCloseLabel: T,
2375
+ style: J,
2376
+ isDisabled: W || $,
2377
+ chatSettings: nt,
2378
+ extraMenuItems: Lt,
2379
+ onRecordVoice: Be && Dt && !s && !$ ? () => kn(Je.Attachment) : void 0,
2380
+ recordVoiceLabel: ie,
2381
+ toolsMenuItems: at ? rt : void 0,
2382
+ onToolToggle: it,
2383
+ toolsMenuTitle: ot,
2384
+ toolsBackLabel: st,
2385
+ menuOverlays: lt,
2386
+ getCaretPosition: () => Z.current?.selectionStart ?? Y.length
2387
+ }), ar = ke === tt.Inline && (!Mt || je), or = ir && /* @__PURE__ */ P("div", {
2388
+ className: l("flex", H.addCluster),
2389
+ children: ir
2390
+ }), sr = Vn.length > 0 && it != null && /* @__PURE__ */ P("div", {
2391
+ className: l("min-w-0 flex-1", H.toolsChips),
2392
+ children: /* @__PURE__ */ P(ht, {
2393
+ items: Vn,
2394
+ onToolToggle: it,
2395
+ onToolDismiss: Hn,
2396
+ canRemove: at,
2397
+ removeLabel: ct?.removeLabel,
2398
+ stateOnLabel: ct?.stateOnLabel,
2399
+ stateOffLabel: ct?.stateOffLabel
2400
+ })
2138
2401
  });
2139
- return /* @__PURE__ */ W("div", {
2140
- ref: qt,
2141
- style: _t,
2142
- className: c(K.wrapper, R && K.wrapperDisabled, R && "cursor-not-allowed", "flex w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", "focus-within:outline focus-within:-outline-offset-1 active:outline active:-outline-offset-1", Tt.length > 6 ? "py-4 ps-4" : "p-4", re),
2402
+ return /* @__PURE__ */ F("div", {
2403
+ ref: Nn,
2404
+ style: J,
2405
+ className: l(K.wrapper, W && K.wrapperDisabled, W && "cursor-not-allowed", "flex w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", "focus-within:outline focus-within:-outline-offset-1 active:outline active:-outline-offset-1", pn.length > 6 ? "py-4 ps-4" : "p-4", de, H.wrapper),
2143
2406
  children: [
2144
- (De.length > 0 || Tt.length > 0) && /* @__PURE__ */ U(ye, {
2145
- attachments: [...De, ...Tt],
2407
+ (Ze.length > 0 || pn.length > 0) && /* @__PURE__ */ P(se, {
2408
+ attachments: [...Ze, ...pn],
2146
2409
  onRemove: (e) => {
2147
- De.some((t) => t.id === e) ? ke?.(e) : kt(e);
2410
+ Ze.some((t) => t.id === e) ? Qe?.(e) : _n(e);
2148
2411
  },
2149
- onRetry: At,
2150
- onExpand: jt,
2412
+ onRetry: vn,
2413
+ onExpand: yn,
2151
2414
  labels: {
2152
- removeLabel: w,
2153
- retryLabel: T,
2154
- uploadingLabel: E
2415
+ removeLabel: E,
2416
+ retryLabel: D,
2417
+ uploadingLabel: ee,
2418
+ expandLabel: O,
2419
+ clickLabel: k
2155
2420
  },
2156
- onAttachmentClick: $e == null ? void 0 : (e) => {
2157
- let t = [...De, ...Tt].find((t) => t.id === e);
2158
- t != null && $e(t);
2421
+ styles: ce,
2422
+ onAttachmentClick: Ct == null ? void 0 : (e) => {
2423
+ let t = [...Ze, ...pn].find((t) => t.id === e);
2424
+ t != null && Ct(t);
2159
2425
  }
2160
2426
  }),
2161
- !pe && /* @__PURE__ */ U("input", {
2162
- ref: Kt,
2427
+ !Te && /* @__PURE__ */ P("input", {
2428
+ ref: Mn,
2163
2429
  type: "file",
2164
2430
  multiple: !0,
2165
- accept: b,
2431
+ accept: S,
2166
2432
  className: "sr-only",
2167
2433
  "aria-hidden": !0,
2168
2434
  tabIndex: -1,
2169
- onChange: sn
2435
+ onChange: Yn
2436
+ }),
2437
+ On && /* @__PURE__ */ P(b, {
2438
+ text: On,
2439
+ className: "min-w-0 break-words px-1"
2170
2440
  }),
2171
- Gt && /* @__PURE__ */ U(ct, {
2441
+ $ && /* @__PURE__ */ P(bt, {
2172
2442
  embedded: !0,
2173
- state: Rt,
2174
- analyserNodeRef: Bt,
2175
- errorMessage: Vt,
2176
- onStop: Ut,
2177
- onDiscard: Wt,
2178
- attachButton: dn,
2179
- stopLabel: A,
2180
- discardLabel: te,
2181
- processingLabel: we
2443
+ state: En,
2444
+ analyserNodeRef: Dn,
2445
+ onStop: An,
2446
+ onDiscard: jn,
2447
+ attachButton: ir,
2448
+ stopLabel: ae,
2449
+ discardLabel: oe,
2450
+ processingLabel: Ge
2451
+ }),
2452
+ !$ && U && rr,
2453
+ !$ && !U && ar && sr && /* @__PURE__ */ P("div", {
2454
+ className: "flex",
2455
+ children: sr
2182
2456
  }),
2183
- !Gt && he && un,
2184
- !Gt && !he && /* @__PURE__ */ W("div", {
2185
- className: "flex flex-wrap items-center gap-2",
2457
+ !$ && !U && /* @__PURE__ */ F("div", {
2458
+ className: l("flex items-center gap-2", ar ? "flex-nowrap" : "flex-wrap", H.actionRow),
2186
2459
  children: [
2187
- /* @__PURE__ */ U("div", {
2188
- className: "flex w-full min-w-0 items-center self-stretch",
2189
- children: un
2460
+ ar && or,
2461
+ /* @__PURE__ */ P("div", {
2462
+ className: l("flex min-w-0 items-center self-stretch", ar ? "flex-1" : "w-full", H.textareaWrap),
2463
+ children: rr
2190
2464
  }),
2191
- dn && /* @__PURE__ */ U("div", {
2192
- className: "flex",
2193
- children: dn
2194
- }),
2195
- en.length > 0 && Fe != null && /* @__PURE__ */ U("div", {
2196
- className: "min-w-0 flex-1",
2197
- children: /* @__PURE__ */ U(it, {
2198
- items: en,
2199
- onToolToggle: Fe,
2200
- onToolDismiss: tn,
2201
- canRemove: ze,
2202
- removeLabel: He?.removeLabel
2203
- })
2204
- }),
2205
- /* @__PURE__ */ U("div", {
2206
- className: "ms-auto flex flex-shrink-0 items-center gap-2",
2207
- children: ge ? ge({
2208
- canSend: Zt,
2209
- onSend: an
2210
- }) : /* @__PURE__ */ W(H, { children: [
2211
- st,
2212
- /* @__PURE__ */ U(zt, {
2213
- deployments: le,
2214
- selectedDeploymentId: F,
2215
- onDeploymentChange: ue,
2216
- modelSelectorLabels: de,
2217
- isStreaming: o,
2218
- isMobile: dt,
2219
- isDisabled: _e,
2220
- style: _t,
2221
- modelPickerOverlay: et,
2222
- isPickerOpen: ft,
2223
- onPickerToggle: () => pt((e) => !e),
2224
- onPickerOpenChange: pt
2465
+ !ar && or,
2466
+ !ar && sr,
2467
+ /* @__PURE__ */ P("div", {
2468
+ className: l("ms-auto flex flex-shrink-0 items-center gap-2", H.footerActions),
2469
+ children: Me ? Me({
2470
+ canSend: Rn,
2471
+ onSend: Gn
2472
+ }) : /* @__PURE__ */ F(N, { children: [
2473
+ kt,
2474
+ /* @__PURE__ */ P(Zt, {
2475
+ deployments: be,
2476
+ selectedDeploymentId: xe,
2477
+ onDeploymentChange: Se,
2478
+ modelSelectorLabels: Ce,
2479
+ menuStyles: ue,
2480
+ isStreaming: s,
2481
+ isMobile: Mt,
2482
+ isDisabled: Ne,
2483
+ style: J,
2484
+ modelPickerOverlay: wt,
2485
+ isPickerOpen: Nt,
2486
+ onPickerToggle: () => Pt((e) => !e),
2487
+ onPickerOpenChange: Pt
2225
2488
  }),
2226
- rn && /* @__PURE__ */ U(v, {
2227
- icon: /* @__PURE__ */ U(ce, {
2228
- size: p.LG,
2229
- stroke: m,
2489
+ Wn && /* @__PURE__ */ P(x, {
2490
+ icon: /* @__PURE__ */ P(he, {
2491
+ size: g.LG,
2492
+ stroke: _,
2230
2493
  "aria-hidden": !0
2231
2494
  }),
2232
- "aria-label": k,
2233
- tooltipProps: { tooltip: k },
2495
+ "aria-label": re,
2496
+ tooltipProps: { tooltip: re },
2234
2497
  className: "size-[40px] flex-shrink-0 mobile:min-h-11 mobile:min-w-11",
2235
- onClick: () => Ht(Re.Dictation),
2236
- disabled: R || o
2498
+ onClick: () => kn(Je.Dictation),
2499
+ disabled: W || s
2237
2500
  }),
2238
- o && a ? /* @__PURE__ */ U(ut, {
2239
- onStop: a,
2240
- ariaLabel: O
2241
- }) : !o && /* @__PURE__ */ U(lt, {
2242
- onSend: an,
2243
- isDisabled: !nn || !Zt,
2244
- ariaLabel: D
2501
+ s && o ? /* @__PURE__ */ P(St, {
2502
+ onStop: o,
2503
+ ariaLabel: ne
2504
+ }) : !s && /* @__PURE__ */ P(xt, {
2505
+ onSend: Gn,
2506
+ isDisabled: !Un || !Rn,
2507
+ ariaLabel: A,
2508
+ sendTooltip: Ln ? j : te ?? j
2245
2509
  })
2246
2510
  ] })
2247
2511
  })
2248
2512
  ]
2249
2513
  }),
2250
- /* @__PURE__ */ U("span", {
2514
+ /* @__PURE__ */ P("span", {
2251
2515
  className: "sr-only",
2252
2516
  role: "status",
2253
2517
  "aria-live": "polite",
2254
2518
  "aria-atomic": "true",
2255
- children: /* @__PURE__ */ U("span", { children: It.text }, It.revision)
2519
+ children: /* @__PURE__ */ P("span", { children: wn.text }, wn.revision)
2256
2520
  })
2257
2521
  ]
2258
2522
  });
2259
- }, Vt = {
2523
+ });
2524
+ Qt.displayName = "Input";
2525
+ var $t = {
2260
2526
  welcome: "_welcome_1icyo_1",
2261
2527
  description: "_description_1icyo_5"
2262
- }, Ht = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, descriptionText: r, styles: i, className: a, inputClassName: o, isInputDisabled: l = !1, ...u }) => {
2263
- let { colors: d, typography: f } = i ?? {};
2264
- return /* @__PURE__ */ W("div", {
2265
- style: s({
2266
- "--ci-welcome-color": d?.welcomeText,
2267
- "--ci-description-color": d?.descriptionText
2528
+ }, en = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, descriptionText: r, belowWelcomeSlot: i, styles: a, className: o, inputClassName: s, isInputDisabled: u = !1, ...d }) => {
2529
+ let { colors: f, typography: p, attachmentTray: m, modelMenu: h } = a ?? {};
2530
+ return /* @__PURE__ */ F("div", {
2531
+ style: c({
2532
+ "--ci-welcome-color": f?.welcomeText,
2533
+ "--ci-description-color": f?.descriptionText
2268
2534
  }),
2269
- className: c("relative flex w-full flex-col items-center gap-9 px-4 py-5 desktop:p-5", a),
2270
- children: [n && /* @__PURE__ */ W("div", {
2271
- className: "flex flex-col items-center gap-4 text-center",
2272
- children: [/* @__PURE__ */ U("h1", {
2273
- className: c(Vt.welcome, "m-0", f?.welcomeClassName || "dial-display2-text"),
2274
- children: n
2275
- }), r && /* @__PURE__ */ U("p", {
2276
- className: c(Vt.description, "m-0 max-w-[540px]", f?.descriptionClassName || "dial-body-paragraph-text"),
2277
- children: r
2278
- })]
2279
- }), /* @__PURE__ */ U("div", {
2280
- className: c("relative w-full", n ? "max-w-[700px]" : "max-w-[748px]"),
2281
- children: /* @__PURE__ */ U(Bt, {
2282
- placeholder: t,
2283
- isStreaming: e,
2284
- isInputDisabled: l,
2285
- ...u,
2286
- className: o,
2287
- colors: d?.input,
2288
- typography: f?.input
2535
+ className: l("relative flex w-full flex-col items-center gap-9 px-4 py-5 desktop:p-5", o),
2536
+ children: [
2537
+ n && /* @__PURE__ */ F("div", {
2538
+ className: "flex flex-col items-center gap-4 text-center",
2539
+ children: [/* @__PURE__ */ P("h1", {
2540
+ className: l($t.welcome, "m-0", p?.welcomeClassName || "dial-display2-text"),
2541
+ children: n
2542
+ }), r && /* @__PURE__ */ P("p", {
2543
+ className: l($t.description, "m-0 max-w-[540px]", p?.descriptionClassName || "dial-body-paragraph-text"),
2544
+ children: r
2545
+ })]
2546
+ }),
2547
+ i != null && /* @__PURE__ */ P("div", {
2548
+ className: "flex w-full max-w-[700px] flex-col items-center empty:hidden",
2549
+ children: i
2550
+ }),
2551
+ /* @__PURE__ */ P("div", {
2552
+ className: l("relative w-full", n ? "max-w-[700px]" : "max-w-[748px]"),
2553
+ children: /* @__PURE__ */ P(Qt, {
2554
+ placeholder: t,
2555
+ isStreaming: e,
2556
+ isInputDisabled: u,
2557
+ ...d,
2558
+ className: s,
2559
+ colors: f?.input,
2560
+ typography: p?.input,
2561
+ attachmentTray: m,
2562
+ modelMenu: h
2563
+ })
2289
2564
  })
2290
- })]
2565
+ ]
2291
2566
  });
2292
- }, Ut = ({ message: e, inlineStartSlot: t, onInlineStartRemove: n, initialAttachments: r = [], onCancel: a, onSave: o, onUploadAttachment: s, cancelLabel: l = "Cancel", saveLabel: d = "Save & Submit", ariaLabel: f, removeLabel: p, retryLabel: h, uploadingLabel: g, addMenuTitle: _ = "Add", attachLabel: v = "Attach file", menuTitle: y = "Menu", menuCloseLabel: b = "Close", className: S, pendingDropFiles: C, onDropFilesConsumed: T, validateAttachment: E, isAttachmentsEnabled: D, isTextAttachmentsAllowed: O, hideAttachFile: k = !1, fileAccept: ee, maximumAttachmentsAmount: A, onAttachmentsLimitExceeded: te, onDialFileSystemClick: j, dialFileSystemLabel: ne, pendingAttachments: re, onPendingAttachmentsConsumed: ie, onAttachmentClick: ae, pasteTextThreshold: oe, maxMessageLength: M = 5e4, onMessageTooLong: N }) => {
2293
- let P = B(null), [ce, le] = V([]);
2294
- L(() => {
2295
- C?.length && (le(C), T?.());
2296
- }, [C, T]);
2297
- let [F, ue] = V(e ?? ""), [de, fe] = V([]), [pe, me] = V(r), he = de.some((e) => e.status === i.Loading || e.status === i.Error), ge = (F.trim().length > 0 || de.length > 0 || pe.length > 0) && !he, R = (e) => {
2298
- me((t) => t.filter((t) => t.id !== e));
2299
- }, _e = I((e, t) => {
2300
- o(e, pe, t);
2301
- }, [pe, o]), ve = () => {
2302
- if (ge) {
2303
- if (F.length >= M) {
2304
- N?.(F.length, M);
2567
+ }, tn = ({ message: e, messageRevision: t, onChange: n, activeMentions: r, onBackspaceAtCaret: i, caretPositionOverride: o, commandMenu: s, menuOverlays: c, initialAttachments: u = [], onCancel: d, onSave: p, onUploadAttachment: m, cancelLabel: h = "Cancel", saveLabel: g = "Save & Submit", ariaLabel: v, removeLabel: y, retryLabel: b, uploadingLabel: x, expandLabel: S, clickLabel: C, addMenuTitle: T = "Add", attachLabel: E = "Attach file", menuTitle: D = "Menu", menuCloseLabel: O = "Close", className: k, pendingDropFiles: A, onDropFilesConsumed: j, validateAttachment: te, isAttachmentsEnabled: ne, isTextAttachmentsAllowed: re, hideAttachFile: ie = !1, fileAccept: ae, maximumAttachmentsAmount: oe, onAttachmentsLimitExceeded: M, onDialFileSystemClick: N, dialFileSystemLabel: se, pendingAttachments: I, onPendingAttachmentsConsumed: ce, onAttachmentClick: le, pasteTextThreshold: ue, maxMessageLength: de = 5e4, onMessageTooLong: fe }) => {
2568
+ let pe = B(null), he = B(null), [ge, _e] = V([]);
2569
+ R(() => {
2570
+ A?.length && (_e(A), j?.());
2571
+ }, [A, j]);
2572
+ let [ve, ye] = V(e ?? ""), [be, xe] = V([]), [Se, Ce] = V(u), we = be.some((e) => e.status === a.Loading || e.status === a.Error), Te = (ve.trim().length > 0 || be.length > 0 || Se.length > 0) && !we, Ee = (e) => {
2573
+ Ce((t) => t.filter((t) => t.id !== e));
2574
+ }, De = L((e, t) => {
2575
+ p(e, Se, t);
2576
+ }, [Se, p]), H = () => {
2577
+ if (Te) {
2578
+ if (ve.length >= de) {
2579
+ fe?.(ve.length, de);
2305
2580
  return;
2306
2581
  }
2307
- _e(F, de);
2582
+ De(ve, be);
2308
2583
  }
2309
- }, ye = I(() => le([]), []), be = I((e) => {
2584
+ }, Oe = L(() => _e([]), []), U = L((e) => {
2585
+ ye(e), n?.(e);
2586
+ }, [n]), ke = L((e) => {
2310
2587
  let t = Array.from(e.target.files ?? []);
2311
- t.length !== 0 && (e.target.value = "", le(t));
2312
- }, []), xe = z(() => j ? [{
2588
+ t.length !== 0 && (e.target.value = "", _e(t));
2589
+ }, []), Ae = z(() => N ? [{
2313
2590
  key: "dial-fs",
2314
- label: ne ?? "DIAL file system",
2315
- icon: /* @__PURE__ */ U(se, {
2316
- size: u,
2591
+ label: se ?? "DIAL file system",
2592
+ icon: /* @__PURE__ */ P(me, {
2593
+ size: f,
2317
2594
  "aria-hidden": !0,
2318
- stroke: m
2595
+ stroke: _
2319
2596
  }),
2320
- onClick: j
2321
- }] : [], [j, ne]);
2322
- return /* @__PURE__ */ W("div", {
2323
- className: c("flex w-full flex-col gap-2", S),
2324
- children: [/* @__PURE__ */ U(Bt, {
2597
+ onClick: N
2598
+ }] : [], [N, se]);
2599
+ return /* @__PURE__ */ F("div", {
2600
+ className: l("flex w-full flex-col gap-2", k),
2601
+ children: [/* @__PURE__ */ P(Qt, {
2602
+ ref: he,
2325
2603
  message: e,
2326
- inlineStartSlot: t,
2327
- onInlineStartRemove: n,
2328
- ariaLabel: f,
2604
+ messageRevision: t,
2605
+ activeMentions: r,
2606
+ onBackspaceAtCaret: i,
2607
+ caretPositionOverride: o,
2608
+ commandMenu: s,
2609
+ ariaLabel: v,
2329
2610
  hideActionBar: !0,
2330
- pendingDropFiles: ce,
2331
- onDropFilesConsumed: ye,
2332
- onSend: _e,
2333
- onUploadAttachment: s,
2334
- onChange: ue,
2335
- onAttachmentsChange: fe,
2336
- removeLabel: p,
2337
- retryLabel: h,
2338
- uploadingLabel: g,
2611
+ pendingDropFiles: ge,
2612
+ onDropFilesConsumed: Oe,
2613
+ onSend: De,
2614
+ onUploadAttachment: m,
2615
+ onChange: U,
2616
+ onAttachmentsChange: xe,
2617
+ removeLabel: y,
2618
+ retryLabel: b,
2619
+ uploadingLabel: x,
2620
+ expandLabel: S,
2621
+ clickLabel: C,
2339
2622
  className: "max-w-full",
2340
- prefixAttachments: pe,
2341
- onRemovePrefixAttachment: R,
2342
- validateAttachment: E,
2343
- isAttachmentsEnabled: D,
2344
- isTextAttachmentsAllowed: O,
2345
- maximumAttachmentsAmount: A,
2346
- onAttachmentsLimitExceeded: te,
2347
- pendingAttachments: re,
2348
- onPendingAttachmentsConsumed: ie,
2349
- onAttachmentClick: ae,
2350
- pasteTextThreshold: oe,
2351
- maxMessageLength: M,
2352
- onMessageTooLong: N
2353
- }), /* @__PURE__ */ W("div", {
2623
+ prefixAttachments: Se,
2624
+ onRemovePrefixAttachment: Ee,
2625
+ validateAttachment: te,
2626
+ isAttachmentsEnabled: ne,
2627
+ isTextAttachmentsAllowed: re,
2628
+ maximumAttachmentsAmount: oe,
2629
+ onAttachmentsLimitExceeded: M,
2630
+ pendingAttachments: I,
2631
+ onPendingAttachmentsConsumed: ce,
2632
+ onAttachmentClick: le,
2633
+ pasteTextThreshold: ue,
2634
+ maxMessageLength: de,
2635
+ onMessageTooLong: fe
2636
+ }), /* @__PURE__ */ F("div", {
2354
2637
  className: "flex items-center justify-between",
2355
- children: [/* @__PURE__ */ U("div", {
2638
+ children: [/* @__PURE__ */ F("div", {
2356
2639
  className: "flex",
2357
- children: !k && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("input", {
2358
- ref: P,
2640
+ children: [!ie && /* @__PURE__ */ P("input", {
2641
+ ref: pe,
2359
2642
  type: "file",
2360
2643
  multiple: !0,
2361
- accept: ee,
2644
+ accept: ae,
2362
2645
  className: "sr-only",
2363
2646
  "aria-hidden": !0,
2364
2647
  tabIndex: -1,
2365
- onChange: be
2366
- }), /* @__PURE__ */ U(tt, {
2367
- onAttachClick: () => P.current?.click(),
2368
- attachLabel: v,
2369
- addMenuTitle: _,
2370
- menuTitle: y,
2371
- menuCloseLabel: b,
2372
- extraMenuItems: xe
2373
- })] })
2374
- }), /* @__PURE__ */ W("div", {
2648
+ onChange: ke
2649
+ }), (!ie || (c?.length ?? 0) > 0) && /* @__PURE__ */ P(pt, {
2650
+ onAttachClick: ie ? void 0 : () => pe.current?.click(),
2651
+ attachLabel: E,
2652
+ addMenuTitle: T,
2653
+ menuTitle: D,
2654
+ menuCloseLabel: O,
2655
+ extraMenuItems: Ae,
2656
+ menuOverlays: c,
2657
+ getCaretPosition: () => he.current?.getCaretPosition() ?? 0
2658
+ })]
2659
+ }), /* @__PURE__ */ F("div", {
2375
2660
  className: "flex gap-2",
2376
- children: [/* @__PURE__ */ U(x, {
2377
- label: l,
2378
- onClick: a
2379
- }), /* @__PURE__ */ U(w, {
2380
- label: d,
2381
- onClick: ve,
2382
- disabled: !ge
2661
+ children: [/* @__PURE__ */ P(w, {
2662
+ label: h,
2663
+ onClick: d
2664
+ }), /* @__PURE__ */ P(ee, {
2665
+ label: g,
2666
+ onClick: H,
2667
+ disabled: !Te
2383
2668
  })]
2384
2669
  })]
2385
2670
  })]
2386
2671
  });
2672
+ }, nn = (e) => {
2673
+ let [t, n] = V({
2674
+ text: e?.text,
2675
+ revision: e?.revision ?? 0
2676
+ }), r = L((e) => {
2677
+ n((t) => ({
2678
+ text: e,
2679
+ revision: t.revision + 1
2680
+ }));
2681
+ }, []);
2682
+ return {
2683
+ message: t.text,
2684
+ messageRevision: t.revision,
2685
+ seedMessage: r
2686
+ };
2687
+ }, rn = (e, t) => {
2688
+ let n = B(e), r = B(t);
2689
+ r.current = t, R(() => {
2690
+ e !== n.current && (n.current = e, r.current());
2691
+ }, [e]);
2387
2692
  };
2388
2693
  //#endregion
2389
- export { Ee as BottomSheetShell, Ze as ChatSettingsModal, Ht as ConversationInput, Ut as EditMessageInput, Bt as Input, We as SendOnEnter };
2694
+ export { tt as ActionRowLayout, U as BottomSheetShell, H as CONVERSATION_INPUT_CLASS, lt as ChatSettingsModal, en as ConversationInput, tn as EditMessageInput, Qt as Input, et as SendOnEnter, nn as useComposerSeed, rn as useComposerSeedSource };