@epam/ai-dial-conversation-input 1.2.0-dev.20 → 1.2.0-dev.201

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