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

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