@epam/ai-dial-conversation-input 1.3.0-dev.14 → 1.3.0-dev.142

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