@epam/ai-dial-conversation-input 1.3.0-dev.108 → 1.3.0-dev.112

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