@epam/ai-dial-conversation-input 1.1.0-dev.66 → 1.1.0-dev.68

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,12 +1,12 @@
1
1
  import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, RequestStatus as r, ResponseFormat as i, buildCssVars as a, mergeClasses as o, useIsMobile as s } from "@epam/ai-dial-chat-shared";
2
2
  import { BASE_ICON_SIZE as c, Button as l, DIAL_ICON_SIZE as u, DialCloseButton as d, DialDropdown as f, DialDropdownIcon as p, DialErrorText as m, DialGhostIconButton as h, DialInput as g, DialPopup as _, DialRadioGroup as v, DialSearch as y, DialSkeleton as b, DialSkeletonVariant as x, DialSlider as S, DialTag as C, DialTooltip as w, ElementSize as T, Highlight as E, NeutralButton as D, PopupSize as O, PrimaryButton as k, PrimaryIconButton as A, RadioGroupOrientation as ee } from "@epam/ai-dial-ui-kit";
3
- import { IconArrowLeft as te, IconArrowNarrowRight as ne, IconCheck as re, IconChevronDown as ie, IconChevronRight as ae, IconFile as oe, IconMicrophone as se, IconPaperclip as j, IconPlayerStopFilled as ce, IconPlaystationSquare as M, IconPlus as le, IconSettings as ue, IconTool as de, IconX as fe } from "@tabler/icons-react";
3
+ import { IconArrowLeft as te, IconArrowNarrowRight as ne, IconCheck as re, IconChevronDown as ie, IconChevronRight as j, IconFile as ae, IconMicrophone as oe, IconPaperclip as M, IconPlayerStopFilled as se, IconPlaystationSquare as ce, IconPlus as le, IconSettings as ue, IconTool as de, IconX as fe } from "@tabler/icons-react";
4
4
  import { createPortal as pe } from "react-dom";
5
5
  import { createElement as me, memo as N, useCallback as P, useEffect as F, useImperativeHandle as he, useLayoutEffect as I, useMemo as L, useRef as R, useState as z } from "react";
6
6
  import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
7
- import { AttachmentCard as ge, AttachmentGroup as _e, AttachmentTray as U, AttachmentTray as ve, FileDndOverlay as ye, MAX_UPLOADS_PER_MINUTE as be, generateAttachmentId as xe, getAttachmentIcon as Se, useClipboardPaste as Ce } from "@epam/ai-dial-attachment-input";
7
+ import { AttachmentCard as ge, AttachmentGroup as _e, AttachmentTray as ve, AttachmentTray as ye, FileDndOverlay as be, MAX_UPLOADS_PER_MINUTE as xe, generateAttachmentId as Se, getAttachmentIcon as Ce, useClipboardPaste as we } from "@epam/ai-dial-attachment-input";
8
8
  //#region src/hooks/useBottomSheet.ts
9
- var we = (e, t) => {
9
+ var Te = (e, t) => {
10
10
  F(() => {
11
11
  if (!e) return;
12
12
  let n = (e) => {
@@ -18,14 +18,14 @@ var we = (e, t) => {
18
18
  document.body.style.overflow = "";
19
19
  };
20
20
  }, [e]);
21
- }, Te = {
21
+ }, Ee = {
22
22
  backdrop: "_backdrop_3xrn0_9",
23
23
  sheet: "_sheet_3xrn0_13",
24
24
  "slide-up": "_slide-up_3xrn0_1",
25
25
  title: "_title_3xrn0_18",
26
26
  divider: "_divider_3xrn0_22"
27
- }, W = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: a, "aria-label": s, style: c, titleClassName: l = "dial-body-semi-text", className: f, children: p }) => (we(e, r), !e || typeof document > "u" ? null : pe(/* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("div", {
28
- className: o(Te.backdrop, "fixed inset-0 z-[55]"),
27
+ }, U = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: a, "aria-label": s, style: c, titleClassName: l = "dial-body-semi-text", className: f, children: p }) => (Te(e, r), !e || typeof document > "u" ? null : pe(/* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("div", {
28
+ className: o(Ee.backdrop, "fixed inset-0 z-[55]"),
29
29
  onPointerDown: r,
30
30
  "aria-hidden": !0
31
31
  }), /* @__PURE__ */ H("div", {
@@ -33,7 +33,7 @@ var we = (e, t) => {
33
33
  "aria-modal": !0,
34
34
  "aria-label": t ?? s,
35
35
  style: c,
36
- className: o(Te.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col", f),
36
+ className: o(Ee.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col", f),
37
37
  children: [t != null && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ H("div", {
38
38
  className: "relative flex h-[60px] flex-shrink-0 items-center justify-center px-4",
39
39
  children: [
@@ -50,7 +50,7 @@ var we = (e, t) => {
50
50
  })
51
51
  }),
52
52
  /* @__PURE__ */ V("span", {
53
- className: o(Te.title, l),
53
+ className: o(Ee.title, l),
54
54
  children: t
55
55
  }),
56
56
  /* @__PURE__ */ V("div", {
@@ -66,11 +66,11 @@ var we = (e, t) => {
66
66
  className: "overflow-y-auto",
67
67
  children: p
68
68
  })]
69
- })] }), document.body)), Ee = async (e, t, n) => {
69
+ })] }), document.body)), De = async (e, t, n) => {
70
70
  let r = 6e4 / t, i = [];
71
71
  for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
72
72
  await Promise.allSettled(i);
73
- }, De = ({ initialAttachments: n, onUploadAttachment: i, onAttachmentsChange: a, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, pendingAttachments: l, onPendingAttachmentsConsumed: u, onExpandPastedText: d, maximumAttachmentsAmount: f, baseAttachmentsAmount: p = 0, onAttachmentsLimitExceeded: m }) => {
73
+ }, Oe = ({ initialAttachments: n, onUploadAttachment: i, onAttachmentsChange: a, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, pendingAttachments: l, onPendingAttachmentsConsumed: u, onExpandPastedText: d, maximumAttachmentsAmount: f, baseAttachmentsAmount: p = 0, onAttachmentsLimitExceeded: m }) => {
74
74
  let [h, g] = z(n), _ = R(h);
75
75
  F(() => {
76
76
  _.current = h;
@@ -82,7 +82,7 @@ var we = (e, t) => {
82
82
  let v = P((e) => e.map((e) => {
83
83
  let n = e.type.startsWith("image/"), i = e.type.startsWith("audio/"), a = n ? URL.createObjectURL(e) : void 0, o = i ? URL.createObjectURL(e) : void 0;
84
84
  return {
85
- id: xe(),
85
+ id: Se(),
86
86
  name: e.name,
87
87
  contentType: e.type,
88
88
  file: e,
@@ -91,36 +91,48 @@ var we = (e, t) => {
91
91
  previewUrl: a,
92
92
  playUrl: o
93
93
  };
94
- }), []), y = P((e) => {
94
+ }), []), y = R(a);
95
+ F(() => {
96
+ y.current = a;
97
+ }, [a]);
98
+ let b = R(!0), x = P((e) => {
95
99
  g((t) => {
96
100
  let n = e(t);
97
- return n !== t && a?.(n), n;
101
+ return n === t ? t : n;
98
102
  });
99
- }, [a]), b = P((e) => {
100
- g(e), a?.(e);
101
- }, [a]), x = P(async (t) => {
103
+ }, []);
104
+ F(() => {
105
+ if (b.current) {
106
+ b.current = !1;
107
+ return;
108
+ }
109
+ y.current?.(h);
110
+ }, [h]);
111
+ let S = P((e) => {
112
+ g(e);
113
+ }, []), C = P(async (t) => {
102
114
  if (i) {
103
- y((e) => e.map((e) => e.id === t.id ? {
115
+ x((e) => e.map((e) => e.id === t.id ? {
104
116
  ...e,
105
117
  status: r.Loading
106
118
  } : e));
107
119
  try {
108
120
  let e = await i(t);
109
- y((n) => n.map((n) => n.id === t.id ? {
121
+ x((n) => n.map((n) => n.id === t.id ? {
110
122
  ...n,
111
123
  status: r.Idle,
112
124
  url: e
113
125
  } : n));
114
126
  } catch (n) {
115
127
  let i = typeof n == "object" && n && "errorReason" in n && Object.values(e).includes(n.errorReason) ? n.errorReason : void 0;
116
- y((e) => e.map((e) => e.id === t.id ? {
128
+ x((e) => e.map((e) => e.id === t.id ? {
117
129
  ...e,
118
130
  status: r.Error,
119
131
  ...i != null && { errorReason: i }
120
132
  } : e));
121
133
  }
122
134
  }
123
- }, [i, y]), S = P((e, t = !0) => {
135
+ }, [i, x]), w = P((e, t = !0) => {
124
136
  let n = new Set(_.current.map((e) => e.id)), i = e.filter((e) => !n.has(e.id));
125
137
  if (i.length !== 0) {
126
138
  if (f != null && f > 0 && Number.isFinite(f)) {
@@ -132,37 +144,37 @@ var we = (e, t) => {
132
144
  return;
133
145
  }
134
146
  }
135
- if (y((e) => [...e, ...i]), t) {
147
+ if (x((e) => [...e, ...i]), t) {
136
148
  let e = [];
137
149
  i.forEach((t) => {
138
150
  let n = o?.(t);
139
- n == null ? e.push(t) : y((e) => e.map((e) => e.id === t.id ? {
151
+ n == null ? e.push(t) : x((e) => e.map((e) => e.id === t.id ? {
140
152
  ...e,
141
153
  status: r.Error,
142
154
  errorReason: n
143
155
  } : e));
144
- }), Ee(e, be, x);
156
+ }), De(e, xe, C);
145
157
  }
146
158
  }
147
159
  }, [
148
160
  p,
149
161
  f,
150
162
  m,
151
- y,
152
163
  x,
164
+ C,
153
165
  o
154
166
  ]);
155
167
  F(() => {
156
- s.length !== 0 && (S(v(s)), c?.());
168
+ s.length !== 0 && (w(v(s)), c?.());
157
169
  }, [
158
- S,
170
+ w,
159
171
  v,
160
172
  c,
161
173
  s
162
174
  ]), F(() => {
163
- l.length !== 0 && (S(l, !1), u?.());
175
+ l.length !== 0 && (w(l, !1), u?.());
164
176
  }, [
165
- S,
177
+ w,
166
178
  u,
167
179
  l
168
180
  ]), F(() => {
@@ -186,41 +198,41 @@ var we = (e, t) => {
186
198
  }
187
199
  return i;
188
200
  });
189
- t && y(() => i), n.forEach((e) => void x(e));
201
+ t && x(() => i), n.forEach((e) => void C(e));
190
202
  }, [
191
203
  o,
192
- y,
193
- x
204
+ x,
205
+ C
194
206
  ]);
195
- let C = P((e) => {
196
- y((t) => {
207
+ let T = P((e) => {
208
+ x((t) => {
197
209
  let n = t.find((t) => t.id === e);
198
210
  return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
199
211
  });
200
- }, [y]);
212
+ }, [x]);
201
213
  return {
202
214
  attachments: h,
203
215
  buildAttachments: v,
204
- addAttachments: S,
205
- resetAttachments: b,
206
- handleRemove: C,
216
+ addAttachments: w,
217
+ resetAttachments: S,
218
+ handleRemove: T,
207
219
  handleRetry: P((e) => {
208
220
  let t = h.find((t) => t.id === e);
209
- t && x(t);
210
- }, [h, x]),
221
+ t && C(t);
222
+ }, [h, C]),
211
223
  handleExpand: P(async (e) => {
212
224
  let n = h.find((t) => t.id === e);
213
225
  if (!n || n.type !== t.Pasted) return;
214
226
  let r = await n.file.text();
215
- d?.(r), C(e);
227
+ d?.(r), T(e);
216
228
  }, [
217
229
  h,
218
- C,
230
+ T,
219
231
  d
220
232
  ]),
221
233
  hasBlockedAttachments: h.some((e) => e.status === r.Loading || e.status === r.Error)
222
234
  };
223
- }, Oe = (e, t) => {
235
+ }, ke = (e, t) => {
224
236
  let [n, r] = z(e), [i, a] = z(!1), [o, s] = z(0);
225
237
  return F(() => {
226
238
  if (e) {
@@ -238,12 +250,12 @@ var we = (e, t) => {
238
250
  isExiting: i,
239
251
  instanceKey: o
240
252
  };
241
- }, ke = (e, t) => !e.slice(0, t).includes("\n"), Ae = (e, t) => !e.slice(t).includes("\n"), je = (e) => {
253
+ }, Ae = (e, t) => !e.slice(0, t).includes("\n"), je = (e, t) => !e.slice(t).includes("\n"), Me = (e) => {
242
254
  let t = R(e);
243
255
  t.current = e;
244
256
  let n = R(-1), r = R(""), i = P((e, i, a) => {
245
257
  let o = t.current;
246
- return !o || o.length === 0 ? null : e === "up" ? !ke(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 || !Ae(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
258
+ return !o || o.length === 0 ? null : e === "up" ? !Ae(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 || !je(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
247
259
  }, []), a = P(() => {
248
260
  n.current = -1, r.current = "";
249
261
  }, []), o = P(() => {
@@ -258,7 +270,7 @@ var we = (e, t) => {
258
270
  a,
259
271
  o
260
272
  ]);
261
- }, Me = ({ messageProp: e, messageRevision: t }) => {
273
+ }, Ne = ({ messageProp: e, messageRevision: t }) => {
262
274
  let [n, r] = z(e), i = R(null), a = R(0), [o, s] = z(!1);
263
275
  return F(() => {
264
276
  r(e);
@@ -274,13 +286,13 @@ var we = (e, t) => {
274
286
  textareaRef: i,
275
287
  isMultiLine: o
276
288
  };
277
- }, Ne = /* @__PURE__ */ function(e) {
289
+ }, Pe = /* @__PURE__ */ function(e) {
278
290
  return e.Idle = "idle", e.Recording = "recording", e.Error = "error", e;
279
- }({}), Pe = [
291
+ }({}), Fe = [
280
292
  "audio/webm;codecs=opus",
281
293
  "audio/ogg;codecs=opus",
282
294
  "audio/webm"
283
- ], Fe = () => Pe.find((e) => MediaRecorder.isTypeSupported(e)) ?? "", Ie = ({ onAttachAudio: e }) => {
295
+ ], Ie = () => Fe.find((e) => MediaRecorder.isTypeSupported(e)) ?? "", Le = ({ onAttachAudio: e }) => {
284
296
  let [t, n] = z("idle"), [r, i] = z(null), [a, o] = z(0), s = R(null), c = R(null), l = R(null), u = R(null), d = R([]), f = R(""), p = R(null), m = R(e);
285
297
  m.current = e;
286
298
  let h = P(() => {
@@ -296,7 +308,7 @@ var we = (e, t) => {
296
308
  c.current = t;
297
309
  let r = t.createAnalyser();
298
310
  r.fftSize = 256, l.current = r, t.createMediaStreamSource(e).connect(r);
299
- let i = Fe();
311
+ let i = Ie();
300
312
  f.current = i, d.current = [];
301
313
  let a = new MediaRecorder(e, i ? { mimeType: i } : void 0);
302
314
  u.current = a, a.ondataavailable = (e) => {
@@ -329,16 +341,16 @@ var we = (e, t) => {
329
341
  stopRecording: v,
330
342
  discardRecording: y
331
343
  };
332
- }, Le = /* @__PURE__ */ function(e) {
344
+ }, Re = /* @__PURE__ */ function(e) {
333
345
  return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
334
- }({}), Re = {
346
+ }({}), ze = {
335
347
  item: "_item_l2r5m_1",
336
348
  itemIcon: "_itemIcon_l2r5m_11"
337
- }, ze = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: a, className: s, titleClassName: c = "dial-body-semi-text", itemLabelClassName: u = "dial-small-text", btnTextClassName: d = "" }) => {
349
+ }, Be = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: a, className: s, titleClassName: c = "dial-body-semi-text", itemLabelClassName: u = "dial-small-text", btnTextClassName: d = "" }) => {
338
350
  let f = (e) => {
339
351
  e(), r();
340
352
  };
341
- return /* @__PURE__ */ V(W, {
353
+ return /* @__PURE__ */ V(U, {
342
354
  isOpen: e,
343
355
  title: t,
344
356
  closeLabel: n,
@@ -351,9 +363,9 @@ var we = (e, t) => {
351
363
  className: "flex flex-col",
352
364
  children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ V("li", { children: /* @__PURE__ */ V(l, {
353
365
  type: "button",
354
- className: o(Re.item, "flex w-full items-center gap-3 px-4 py-[10px] text-start"),
366
+ className: o(ze.item, "flex w-full items-center gap-3 px-4 py-[10px] text-start"),
355
367
  iconBefore: /* @__PURE__ */ V("span", {
356
- className: Re.itemIcon,
368
+ className: ze.itemIcon,
357
369
  children: n
358
370
  }),
359
371
  iconAfter: r ? /* @__PURE__ */ V("span", {
@@ -369,7 +381,7 @@ var we = (e, t) => {
369
381
  }) }, e))
370
382
  })
371
383
  });
372
- }, Be = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
384
+ }, Ve = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
373
385
  let [s, c] = z(t), [l, u] = z(n), [d, f] = z(r), p = R(o);
374
386
  F(() => {
375
387
  o && !p.current && (c(t), u(n), f(r)), p.current = o;
@@ -402,7 +414,7 @@ var we = (e, t) => {
402
414
  a
403
415
  ])
404
416
  };
405
- }, Ve = "!dial-small-semi-text !text-primary gap-1", He = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: a, onSystemPromptChange: o, onTemperatureChange: s, responseFormatLabel: c = "Response format", responseFormatHint: l = "Applies to new and existing messages", responseFormatMarkdownLabel: u = "Markdown", responseFormatPlainTextLabel: d = "Plain text", systemPromptLabel: f = "System prompt", systemPromptTooltip: p = "Enter a prompt", temperatureLabel: m = "Temperature", temperatureLabels: h = [
417
+ }, W = "!dial-small-semi-text !text-primary gap-1", He = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: a, onSystemPromptChange: o, onTemperatureChange: s, responseFormatLabel: c = "Response format", responseFormatHint: l = "Applies to new and existing messages", responseFormatMarkdownLabel: u = "Markdown", responseFormatPlainTextLabel: d = "Plain text", systemPromptLabel: f = "System prompt", systemPromptTooltip: p = "Enter a prompt", temperatureLabel: m = "Temperature", temperatureLabels: h = [
406
418
  "Precise",
407
419
  "Neutral",
408
420
  "Creative"
@@ -411,7 +423,7 @@ var we = (e, t) => {
411
423
  children: [
412
424
  e.responseFormat && /* @__PURE__ */ V(v, {
413
425
  fieldTitle: c,
414
- labelClassName: Ve,
426
+ labelClassName: W,
415
427
  elementId: "response-format",
416
428
  orientation: ee.Column,
417
429
  activeRadioButton: t ?? i.Markdown,
@@ -429,7 +441,7 @@ var we = (e, t) => {
429
441
  value: n,
430
442
  placeholder: p,
431
443
  labelProps: {
432
- className: Ve,
444
+ className: W,
433
445
  label: f
434
446
  },
435
447
  onChange: (e) => o(e ?? "")
@@ -437,7 +449,7 @@ var we = (e, t) => {
437
449
  e.temperature && /* @__PURE__ */ V(S, {
438
450
  labelProps: {
439
451
  label: m,
440
- className: Ve,
452
+ className: W,
441
453
  caption: _
442
454
  },
443
455
  value: r,
@@ -449,7 +461,7 @@ var we = (e, t) => {
449
461
  })
450
462
  ]
451
463
  }), Ue = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: s, initialResponseFormat: c, initialSystemPrompt: l, initialTemperature: u, onSave: d, title: f = "Chat settings", responseFormatLabel: p, responseFormatHint: m, responseFormatMarkdownLabel: h, responseFormatPlainTextLabel: g, systemPromptLabel: _, systemPromptTooltip: v, temperatureLabel: y, temperatureLabels: b, temperatureHint: x, saveLabel: S = "Apply changes", saveDisabledTooltip: C }) => {
452
- let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat: A, setSystemPrompt: ee, setTemperature: te, handleSubmit: ne } = Be({
464
+ let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat: A, setSystemPrompt: ee, setTemperature: te, handleSubmit: ne } = Ve({
453
465
  isOpen: e,
454
466
  features: s,
455
467
  initialResponseFormat: c,
@@ -458,7 +470,7 @@ var we = (e, t) => {
458
470
  onSave: d,
459
471
  onClose: r
460
472
  });
461
- return /* @__PURE__ */ H(W, {
473
+ return /* @__PURE__ */ H(U, {
462
474
  isOpen: e,
463
475
  title: f,
464
476
  closeLabel: i,
@@ -499,7 +511,7 @@ var we = (e, t) => {
499
511
  })]
500
512
  });
501
513
  }, We = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", responseFormatLabel: s, responseFormatHint: c, responseFormatMarkdownLabel: l, responseFormatPlainTextLabel: u, systemPromptLabel: d, systemPromptTooltip: f, temperatureLabel: p, temperatureLabels: m, temperatureHint: h, saveLabel: g = "Apply changes", saveDisabledTooltip: v }) => {
502
- let { responseFormat: y, systemPrompt: b, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: T, setTemperature: E, handleSubmit: D } = Be({
514
+ let { responseFormat: y, systemPrompt: b, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: T, setTemperature: E, handleSubmit: D } = Ve({
503
515
  features: e,
504
516
  initialResponseFormat: t,
505
517
  initialSystemPrompt: n,
@@ -548,7 +560,7 @@ var we = (e, t) => {
548
560
  N(We);
549
561
  //#endregion
550
562
  //#region src/components/ToolsBottomSheet/ToolsBottomSheet.tsx
551
- var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: a, title: o = "Tools", items: s, onToolToggle: u }) => /* @__PURE__ */ V(W, {
563
+ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: a, title: o = "Tools", items: s, onToolToggle: u }) => /* @__PURE__ */ V(U, {
552
564
  isOpen: e,
553
565
  title: o,
554
566
  closeLabel: i,
@@ -608,7 +620,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
608
620
  ...e == null ? [] : [{
609
621
  key: "attach",
610
622
  label: t,
611
- icon: /* @__PURE__ */ V(j, {
623
+ icon: /* @__PURE__ */ V(M, {
612
624
  size: c,
613
625
  "aria-hidden": !0
614
626
  }),
@@ -625,7 +637,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
625
637
  onClick: x ? () => {
626
638
  D(!0), C(!1);
627
639
  } : () => void 0,
628
- ...x ? { iconAfter: /* @__PURE__ */ V(ae, {
640
+ ...x ? { iconAfter: /* @__PURE__ */ V(j, {
629
641
  size: c,
630
642
  stroke: 1.5,
631
643
  className: "text-secondary rtl:scale-x-[-1]",
@@ -639,7 +651,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
639
651
  size: c,
640
652
  "aria-hidden": !0
641
653
  }),
642
- iconAfter: x ? /* @__PURE__ */ V(ae, {
654
+ iconAfter: x ? /* @__PURE__ */ V(j, {
643
655
  size: c,
644
656
  stroke: 1.5,
645
657
  className: "text-secondary rtl:scale-x-[-1]",
@@ -668,7 +680,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
668
680
  className: o("size-10 flex-shrink-0", p && "pointer-events-none opacity-50"),
669
681
  onClick: () => C(!0)
670
682
  }),
671
- /* @__PURE__ */ V(ze, {
683
+ /* @__PURE__ */ V(Be, {
672
684
  isOpen: S,
673
685
  title: r,
674
686
  closeLabel: a,
@@ -816,18 +828,18 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
816
828
  stopRecordingIcon: "_stopRecordingIcon_8j81i_28",
817
829
  recordingDot: "_recordingDot_8j81i_42",
818
830
  "recording-pulse": "_recording-pulse_8j81i_1"
819
- }, q = 3, Xe = 4, J = 200, Y = (e) => `${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`, Ze = ({ state: e, analyserNodeRef: t, elapsedSeconds: n, errorMessage: r, onStop: i, onDiscard: a, stopLabel: s = "Stop recording", discardLabel: c = "Discard recording", timerLabel: l = "Recording time", style: d, className: f }) => {
820
- let p = R(null), g = R(new Float32Array(J)), _ = R(0), v = R(0), y = e === Ne.Recording, b = e === Ne.Error, x = P((e) => {
831
+ }, q = 3, J = 4, Y = 200, Xe = (e) => `${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`, Ze = ({ state: e, analyserNodeRef: t, elapsedSeconds: n, errorMessage: r, onStop: i, onDiscard: a, stopLabel: s = "Stop recording", discardLabel: c = "Discard recording", timerLabel: l = "Recording time", style: d, className: f }) => {
832
+ let p = R(null), g = R(new Float32Array(Y)), _ = R(0), v = R(0), y = e === Pe.Recording, b = e === Pe.Error, x = P((e) => {
821
833
  let t = e.getContext("2d");
822
834
  if (!t) return;
823
835
  e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
824
836
  let { width: n, height: r } = e;
825
837
  t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
826
- let i = Math.min(Math.max(1, Math.floor(n / Xe)), J - 1), a = _.current, o = v.current;
838
+ let i = Math.min(Math.max(1, Math.floor(n / J)), Y - 1), a = _.current, o = v.current;
827
839
  t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
828
840
  for (let e = 0; e <= i; e++) {
829
- let n = ((a - i + e) % J + J) % J, o = g.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
830
- t.fillRect(e * Xe, (r - c) / 2, q, c);
841
+ let n = ((a - i + e) % Y + Y) % Y, o = g.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
842
+ t.fillRect(e * J, (r - c) / 2, q, c);
831
843
  }
832
844
  t.restore();
833
845
  }, []);
@@ -837,8 +849,8 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
837
849
  if (!e) return;
838
850
  g.current.fill(0), _.current = 0, v.current = 0;
839
851
  let n, r = () => {
840
- if (v.current += 1, v.current >= Xe) {
841
- v.current -= Xe;
852
+ if (v.current += 1, v.current >= J) {
853
+ v.current -= J;
842
854
  let e = t.current;
843
855
  if (e) {
844
856
  let t = new Uint8Array(e.frequencyBinCount);
@@ -848,7 +860,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
848
860
  let r = (t[e] - 128) / 128;
849
861
  n += r * r;
850
862
  }
851
- g.current[_.current % J] = Math.sqrt(n / t.length), _.current++;
863
+ g.current[_.current % Y] = Math.sqrt(n / t.length), _.current++;
852
864
  }
853
865
  }
854
866
  x(e), n = requestAnimationFrame(r);
@@ -879,7 +891,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
879
891
  className: "size-10 flex-shrink-0",
880
892
  onClick: a
881
893
  }), y && /* @__PURE__ */ V(h, {
882
- icon: /* @__PURE__ */ V(ce, {
894
+ icon: /* @__PURE__ */ V(se, {
883
895
  size: u.LG,
884
896
  className: K.stopRecordingIcon,
885
897
  "aria-hidden": !0
@@ -902,7 +914,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
902
914
  }), /* @__PURE__ */ V("span", {
903
915
  className: o(K.timer, "flex-shrink-0"),
904
916
  "aria-label": l,
905
- children: Y(n)
917
+ children: Xe(n)
906
918
  })] }), /* @__PURE__ */ V("canvas", {
907
919
  ref: p,
908
920
  height: 32,
@@ -937,11 +949,11 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
937
949
  "aria-label": t,
938
950
  onClick: () => e?.(),
939
951
  type: "button",
940
- children: /* @__PURE__ */ V(M, {
952
+ children: /* @__PURE__ */ V(ce, {
941
953
  size: u.LG,
942
954
  className: X.stopIcon
943
955
  })
944
- }), et = ({ gradientId: e = "gradient-check-icon" }) => /* @__PURE__ */ H("svg", {
956
+ }), Z = ({ gradientId: e = "gradient-check-icon" }) => /* @__PURE__ */ H("svg", {
945
957
  width: u.SM,
946
958
  height: u.SM,
947
959
  viewBox: "0 0 24 24",
@@ -968,7 +980,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
968
980
  strokeLinecap: "round",
969
981
  strokeLinejoin: "round"
970
982
  })]
971
- }), tt = {
983
+ }), et = {
972
984
  tabContainer: "_tabContainer_153ct_1",
973
985
  tabActive: "_tabActive_153ct_13"
974
986
  };
@@ -987,18 +999,18 @@ N(({ tabs: e, activeTabId: t, onTabChange: n, styles: r }) => {
987
999
  label: e.label,
988
1000
  selected: r,
989
1001
  onClick: () => n(e.id),
990
- className: o("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i, tt.tabContainer, r && tt.tabActive)
1002
+ className: o("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i, et.tabContainer, r && et.tabActive)
991
1003
  })
992
1004
  }, e.id);
993
1005
  })
994
1006
  });
995
1007
  });
996
- var nt = ({ size: e = 20 }) => /* @__PURE__ */ V(b, {
1008
+ var tt = ({ size: e = 20 }) => /* @__PURE__ */ V(b, {
997
1009
  variant: x.Circular,
998
1010
  width: e,
999
1011
  height: e,
1000
1012
  active: !0
1001
- }), rt = ({ loadingLabel: e }) => /* @__PURE__ */ H("span", {
1013
+ }), nt = ({ loadingLabel: e }) => /* @__PURE__ */ H("span", {
1002
1014
  className: "flex min-w-0 flex-1 items-center",
1003
1015
  children: [/* @__PURE__ */ V(b, {
1004
1016
  variant: x.Text,
@@ -1009,24 +1021,24 @@ var nt = ({ size: e = 20 }) => /* @__PURE__ */ V(b, {
1009
1021
  className: "sr-only",
1010
1022
  children: e
1011
1023
  })]
1012
- }), it = ({ loadingLabel: e }) => /* @__PURE__ */ V("div", {
1024
+ }), rt = ({ loadingLabel: e }) => /* @__PURE__ */ V("div", {
1013
1025
  role: "status",
1014
1026
  "aria-label": e,
1015
1027
  children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ H("div", {
1016
1028
  className: "flex h-11 items-center gap-3 px-4",
1017
1029
  "aria-hidden": "true",
1018
- children: [/* @__PURE__ */ V(nt, {}), /* @__PURE__ */ V(rt, {})]
1030
+ children: [/* @__PURE__ */ V(tt, {}), /* @__PURE__ */ V(nt, {})]
1019
1031
  }, t))
1020
- }), at = (e) => e.displayName ?? e.id, ot = (e, t) => {
1032
+ }), it = (e) => e.displayName ?? e.id, at = (e, t) => {
1021
1033
  let n = t.trim().toLowerCase();
1022
- return n ? e.filter((e) => at(e).toLowerCase().includes(n)) : e;
1023
- }, st = (e, t, r, i = 18, a) => /* @__PURE__ */ V(n, {
1034
+ return n ? e.filter((e) => it(e).toLowerCase().includes(n)) : e;
1035
+ }, ot = (e, t, r, i = 18, a) => /* @__PURE__ */ V(n, {
1024
1036
  src: e,
1025
1037
  size: i,
1026
1038
  labels: { tooltip: a },
1027
1039
  initialsName: r
1028
- }), ct = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, searchHeaderClassName: i = "bg-layer-0" }) => {
1029
- let [a, s] = z(""), c = L(() => e?.find((e) => e.id === t), [e, t]), l = r?.loading !== void 0, d = L(() => l ? /* @__PURE__ */ V(nt, { size: u.LG }) : st(c?.iconUrl, c?.type, c?.displayName ?? c?.id ?? "", u.LG), [l, c]), f = c?.displayName ?? c?.id;
1040
+ }), st = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, searchHeaderClassName: i = "bg-layer-0" }) => {
1041
+ let [a, s] = z(""), c = L(() => e?.find((e) => e.id === t), [e, t]), l = r?.loading !== void 0, d = L(() => l ? /* @__PURE__ */ V(tt, { size: u.LG }) : ot(c?.iconUrl, c?.type, c?.displayName ?? c?.id ?? "", u.LG), [l, c]), f = c?.displayName ?? c?.id;
1030
1042
  return {
1031
1043
  selectorIcon: d,
1032
1044
  selectorAriaLabel: f ? `${r?.ariaLabel ?? "Select model"}: ${f}` : r?.ariaLabel ?? "Select model",
@@ -1034,8 +1046,8 @@ var nt = ({ size: e = 20 }) => /* @__PURE__ */ V(b, {
1034
1046
  menuItems: L(() => {
1035
1047
  if (l) return Array.from({ length: 7 }, (e, t) => ({
1036
1048
  key: `__loading-${t}`,
1037
- icon: /* @__PURE__ */ V(nt, {}),
1038
- label: /* @__PURE__ */ V(rt, { loadingLabel: t === 0 ? r?.loading : void 0 }),
1049
+ icon: /* @__PURE__ */ V(tt, {}),
1050
+ label: /* @__PURE__ */ V(nt, { loadingLabel: t === 0 ? r?.loading : void 0 }),
1039
1051
  disabled: !0
1040
1052
  }));
1041
1053
  if (!e || e.length === 0) {
@@ -1046,19 +1058,19 @@ var nt = ({ size: e = 20 }) => /* @__PURE__ */ V(b, {
1046
1058
  disabled: !0
1047
1059
  }] : [];
1048
1060
  }
1049
- return ot(e, a).map((e) => {
1061
+ return at(e, a).map((e) => {
1050
1062
  let r = e.id === t;
1051
1063
  return {
1052
1064
  key: e.id,
1053
1065
  label: /* @__PURE__ */ H("span", {
1054
1066
  className: "flex w-full items-center justify-between gap-2",
1055
1067
  children: [/* @__PURE__ */ V(E, {
1056
- text: at(e),
1068
+ text: it(e),
1057
1069
  query: a,
1058
1070
  maxLines: 1
1059
- }), r && /* @__PURE__ */ V(et, { gradientId: "ms-check-grad" })]
1071
+ }), r && /* @__PURE__ */ V(Z, { gradientId: "ms-check-grad" })]
1060
1072
  }),
1061
- icon: st(e.iconUrl, e.type, e.displayName ?? e.id),
1073
+ icon: ot(e.iconUrl, e.type, e.displayName ?? e.id),
1062
1074
  onClick: () => n?.(e.id),
1063
1075
  className: r ? "bg-accent-primary-alpha" : void 0
1064
1076
  };
@@ -1091,8 +1103,8 @@ var nt = ({ size: e = 20 }) => /* @__PURE__ */ V(b, {
1091
1103
  e || s("");
1092
1104
  }
1093
1105
  };
1094
- }, lt = typeof window < "u" ? I : F;
1095
- function ut(e) {
1106
+ }, ct = typeof window < "u" ? I : F;
1107
+ function lt(e) {
1096
1108
  if (e !== void 0) switch (typeof e) {
1097
1109
  case "number": return e;
1098
1110
  case "string":
@@ -1100,15 +1112,15 @@ function ut(e) {
1100
1112
  break;
1101
1113
  }
1102
1114
  }
1103
- function dt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
1115
+ function ut({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
1104
1116
  let { styleHeight: s, styleWidth: c } = L(() => ({
1105
- styleHeight: ut(o?.height),
1106
- styleWidth: ut(o?.width)
1117
+ styleHeight: lt(o?.height),
1118
+ styleWidth: lt(o?.width)
1107
1119
  }), [o?.height, o?.width]), [l, u] = z({
1108
1120
  height: t,
1109
1121
  width: n
1110
1122
  }), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
1111
- return lt(() => {
1123
+ return ct(() => {
1112
1124
  if (i === null || d) return;
1113
1125
  let t = new ResizeObserver((e) => {
1114
1126
  for (let t of e) {
@@ -1137,26 +1149,26 @@ function dt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
1137
1149
  c
1138
1150
  ]);
1139
1151
  }
1140
- function ft(e) {
1152
+ function dt(e) {
1141
1153
  let t = R(() => {
1142
1154
  throw Error("Cannot call during render.");
1143
1155
  });
1144
- return lt(() => {
1156
+ return ct(() => {
1145
1157
  t.current = e;
1146
1158
  }, [e]), P((e) => t.current?.(e), [t]);
1147
1159
  }
1148
- var pt = null;
1149
- function mt(e = !1) {
1150
- if (pt === null || e) {
1160
+ var ft = null;
1161
+ function pt(e = !1) {
1162
+ if (ft === null || e) {
1151
1163
  let e = document.createElement("div"), t = e.style;
1152
1164
  t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
1153
1165
  let n = document.createElement("div"), r = n.style;
1154
- return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? pt = "positive-descending" : (e.scrollLeft = 1, pt = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), pt;
1166
+ return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? ft = "positive-descending" : (e.scrollLeft = 1, ft = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), ft;
1155
1167
  }
1156
- return pt;
1168
+ return ft;
1157
1169
  }
1158
- function ht({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
1159
- if (t === "horizontal" && n) switch (mt()) {
1170
+ function mt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
1171
+ if (t === "horizontal" && n) switch (pt()) {
1160
1172
  case "negative": return -r;
1161
1173
  case "positive-descending":
1162
1174
  if (e) {
@@ -1167,12 +1179,12 @@ function ht({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
1167
1179
  }
1168
1180
  return r;
1169
1181
  }
1170
- function Z(e, t = "Assertion error") {
1182
+ function Q(e, t = "Assertion error") {
1171
1183
  if (!e) throw console.error(t), Error(t);
1172
1184
  }
1173
- function Q(e, t) {
1185
+ function ht(e, t) {
1174
1186
  if (e === t) return !0;
1175
- if (!!e != !!t || (Z(e !== void 0), Z(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
1187
+ if (!!e != !!t || (Q(e !== void 0), Q(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
1176
1188
  for (let n in e) if (!Object.is(t[n], e[n])) return !1;
1177
1189
  return !0;
1178
1190
  }
@@ -1181,7 +1193,7 @@ function gt({ cachedBounds: e, itemCount: t, itemSize: n }) {
1181
1193
  if (typeof n == "number") return t * n;
1182
1194
  {
1183
1195
  let n = e.get(e.size === 0 ? 0 : e.size - 1);
1184
- return Z(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
1196
+ return Q(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
1185
1197
  }
1186
1198
  }
1187
1199
  function _t({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
@@ -1221,7 +1233,7 @@ function yt({ itemCount: e, itemProps: t, itemSize: n }) {
1221
1233
  let r = /* @__PURE__ */ new Map();
1222
1234
  return {
1223
1235
  get(i) {
1224
- for (Z(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
1236
+ for (Q(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
1225
1237
  let e = r.size, a;
1226
1238
  switch (typeof n) {
1227
1239
  case "function":
@@ -1237,14 +1249,14 @@ function yt({ itemCount: e, itemProps: t, itemSize: n }) {
1237
1249
  });
1238
1250
  else {
1239
1251
  let t = r.get(e - 1);
1240
- Z(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
1252
+ Q(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
1241
1253
  scrollOffset: t.scrollOffset + t.size,
1242
1254
  size: a
1243
1255
  });
1244
1256
  }
1245
1257
  }
1246
1258
  let a = r.get(i);
1247
- return Z(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
1259
+ return Q(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
1248
1260
  },
1249
1261
  set(e, t) {
1250
1262
  r.set(e, t);
@@ -1265,11 +1277,11 @@ function bt({ itemCount: e, itemProps: t, itemSize: n }) {
1265
1277
  n
1266
1278
  ]);
1267
1279
  }
1268
- function $({ containerSize: e, itemSize: t }) {
1280
+ function xt({ containerSize: e, itemSize: t }) {
1269
1281
  let n;
1270
1282
  switch (typeof t) {
1271
1283
  case "string":
1272
- Z(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), Z(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
1284
+ Q(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), Q(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
1273
1285
  break;
1274
1286
  default:
1275
1287
  n = t;
@@ -1277,8 +1289,8 @@ function $({ containerSize: e, itemSize: t }) {
1277
1289
  }
1278
1290
  return n;
1279
1291
  }
1280
- function xt({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
1281
- let { height: u = n, width: d = n } = dt({
1292
+ function St({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
1293
+ let { height: u = n, width: d = n } = ut({
1282
1294
  defaultHeight: r === "vertical" ? n : void 0,
1283
1295
  defaultWidth: r === "horizontal" ? n : void 0,
1284
1296
  element: e,
@@ -1287,7 +1299,7 @@ function xt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1287
1299
  }), f = R({
1288
1300
  height: 0,
1289
1301
  width: 0
1290
- }), p = r === "vertical" ? u : d, m = $({
1302
+ }), p = r === "vertical" ? u : d, m = xt({
1291
1303
  containerSize: p,
1292
1304
  itemSize: s
1293
1305
  });
@@ -1329,7 +1341,7 @@ function xt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1329
1341
  m
1330
1342
  ]), w = P((t) => vt({
1331
1343
  cachedBounds: h,
1332
- containerScrollOffset: ht({
1344
+ containerScrollOffset: mt({
1333
1345
  containerElement: e,
1334
1346
  direction: r,
1335
1347
  isRtl: i,
@@ -1347,19 +1359,19 @@ function xt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1347
1359
  a,
1348
1360
  l
1349
1361
  ]);
1350
- return lt(() => {
1362
+ return ct(() => {
1351
1363
  v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
1352
1364
  }, [
1353
1365
  e,
1354
1366
  r,
1355
1367
  w
1356
- ]), lt(() => {
1368
+ ]), ct(() => {
1357
1369
  if (!e) return;
1358
1370
  let t = () => {
1359
1371
  v((t) => {
1360
1372
  let { scrollLeft: n, scrollTop: o } = e, s = vt({
1361
1373
  cachedBounds: h,
1362
- containerScrollOffset: ht({
1374
+ containerScrollOffset: mt({
1363
1375
  containerElement: e,
1364
1376
  direction: r,
1365
1377
  isRtl: i,
@@ -1369,7 +1381,7 @@ function xt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1369
1381
  itemCount: a,
1370
1382
  overscanCount: l
1371
1383
  });
1372
- return Q(s, t) ? t : s;
1384
+ return ht(s, t) ? t : s;
1373
1385
  });
1374
1386
  };
1375
1387
  return e.addEventListener("scroll", t), () => {
@@ -1385,7 +1397,7 @@ function xt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1385
1397
  ]), {
1386
1398
  getCellBounds: g,
1387
1399
  getEstimatedSize: C,
1388
- scrollToIndex: ft(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
1400
+ scrollToIndex: dt(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
1389
1401
  let s = _t({
1390
1402
  align: t,
1391
1403
  cachedBounds: h,
@@ -1396,14 +1408,14 @@ function xt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1396
1408
  itemSize: m
1397
1409
  });
1398
1410
  if (e) {
1399
- if (s = ht({
1411
+ if (s = mt({
1400
1412
  containerElement: e,
1401
1413
  direction: r,
1402
1414
  isRtl: i,
1403
1415
  scrollOffset: s
1404
1416
  }), typeof e.scrollTo != "function") {
1405
1417
  let e = w(s);
1406
- Q(_, e) || v(e);
1418
+ ht(_, e) || v(e);
1407
1419
  }
1408
1420
  return s;
1409
1421
  }
@@ -1414,19 +1426,19 @@ function xt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1414
1426
  stopIndexVisible: x
1415
1427
  };
1416
1428
  }
1417
- function St(e) {
1429
+ function $(e) {
1418
1430
  return L(() => e, Object.values(e));
1419
1431
  }
1420
1432
  function Ct(e, t) {
1421
1433
  let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
1422
- return Q(n, a) && Q(r, o) && Q(i, s);
1434
+ return ht(n, a) && ht(r, o) && ht(i, s);
1423
1435
  }
1424
1436
  function wt(e) {
1425
1437
  return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
1426
1438
  }
1427
1439
  var Tt = "data-react-window-index";
1428
1440
  function Et({ 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 }) {
1429
- let m = St(u), h = L(() => N(s, Ct), [s]), [g, _] = z(null), v = wt(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = xt({
1441
+ let m = $(u), h = L(() => N(s, Ct), [s]), [g, _] = z(null), v = wt(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = St({
1430
1442
  containerElement: g,
1431
1443
  containerStyle: f,
1432
1444
  defaultContainerSize: n,
@@ -1452,7 +1464,7 @@ function Et({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1452
1464
  top: r
1453
1465
  });
1454
1466
  }
1455
- }), [g, x]), lt(() => {
1467
+ }), [g, x]), ct(() => {
1456
1468
  if (!g) return;
1457
1469
  let e = Array.from(g.children).filter((e, t) => {
1458
1470
  if (e.hasAttribute("aria-hidden")) return !1;
@@ -1541,7 +1553,7 @@ var Dt = {
1541
1553
  checkIcon: "_checkIcon_13nxz_19",
1542
1554
  stateLabel: "_stateLabel_13nxz_23"
1543
1555
  }, Ot = 44, kt = 8, At = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: s, onSelect: c }) => {
1544
- let d = r[e], f = st(d.iconUrl, d.type, d.displayName ?? d.id, u.SM), p = d.id === i;
1556
+ let d = r[e], f = ot(d.iconUrl, d.type, d.displayName ?? d.id, u.SM), p = d.id === i;
1545
1557
  return /* @__PURE__ */ V("div", {
1546
1558
  style: t,
1547
1559
  ...n,
@@ -1573,8 +1585,8 @@ var Dt = {
1573
1585
  F(() => {
1574
1586
  e || g("");
1575
1587
  }, [e]);
1576
- let _ = a && a.length > 0, v = l !== void 0, b = !_ && !v ? u ?? d : void 0, x = _ ? ot(a, h) : [];
1577
- return /* @__PURE__ */ H(W, {
1588
+ let _ = a && a.length > 0, v = l !== void 0, b = !_ && !v ? u ?? d : void 0, x = _ ? at(a, h) : [];
1589
+ return /* @__PURE__ */ H(U, {
1578
1590
  isOpen: e,
1579
1591
  title: t,
1580
1592
  closeLabel: n,
@@ -1590,7 +1602,7 @@ var Dt = {
1590
1602
  size: T.Standard,
1591
1603
  onChange: g
1592
1604
  })
1593
- }), /* @__PURE__ */ V("div", { className: o(Dt.divider, "h-px flex-shrink-0") })] }), v ? /* @__PURE__ */ V(it, { loadingLabel: l }) : b ? /* @__PURE__ */ V("div", {
1605
+ }), /* @__PURE__ */ V("div", { className: o(Dt.divider, "h-px flex-shrink-0") })] }), v ? /* @__PURE__ */ V(rt, { loadingLabel: l }) : b ? /* @__PURE__ */ V("div", {
1594
1606
  role: "list",
1595
1607
  className: o(Dt.stateLabel, m, "px-4 py-4"),
1596
1608
  children: b
@@ -1613,7 +1625,7 @@ var Dt = {
1613
1625
  })]
1614
1626
  });
1615
1627
  }, Mt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, isStreaming: i, isMobile: a, isInputDisabled: s = !1, isDisabled: c = !1, style: l, modelPickerOverlay: d, isPickerOpen: m, onPickerToggle: g, onPickerOpenChange: _ }) => {
1616
- let [v, y] = z(!1), { selectorIcon: b, selectorAriaLabel: x, selectedLabel: S, menuItems: C, menuHeader: E, onOpenChange: D } = ct({
1628
+ let [v, y] = z(!1), { selectorIcon: b, selectorAriaLabel: x, selectedLabel: S, menuItems: C, menuHeader: E, onOpenChange: D } = st({
1617
1629
  deployments: e,
1618
1630
  selectedDeploymentId: t,
1619
1631
  onDeploymentChange: n,
@@ -1638,7 +1650,7 @@ var Dt = {
1638
1650
  },
1639
1651
  className: o(X.modelSelectorButton, O)
1640
1652
  })
1641
- }), d ? /* @__PURE__ */ V(W, {
1653
+ }), d ? /* @__PURE__ */ V(U, {
1642
1654
  isOpen: v,
1643
1655
  title: r?.ariaLabel ?? "Select model",
1644
1656
  closeLabel: r?.closeLabel ?? "Close",
@@ -1700,8 +1712,8 @@ var Dt = {
1700
1712
  })
1701
1713
  })
1702
1714
  });
1703
- }, Nt = 160, Pt = ({ message: e = "", messageRevision: t, onSend: n, onUploadAttachment: r, onStop: i, isStreaming: l = !1, onChange: d, onAttachmentsChange: f, placeholder: p = "Type a message...", ariaLabel: m, attachLabel: g = "Attach file", fileAccept: _, addMenuTitle: v = "Add", menuTitle: y = "Menu", menuCloseLabel: b = "Close", removeLabel: x, retryLabel: S, sendLabel: C, stopLabel: w, micLabel: T = "Record voice message", stopRecordingLabel: E, discardRecordingLabel: D, timerAriaLabel: O, colors: k, typography: A, className: ee, pendingDropFiles: te = [], onDropFilesConsumed: ne, pendingAttachments: re = [], onPendingAttachmentsConsumed: ie, pasteTextThreshold: ae = 4e3, deployments: j, selectedDeploymentId: ce, onDeploymentChange: M, modelSelectorLabels: le, initialAttachments: ue = [], isStacked: de = !1, hideAddButton: fe = !1, hideAttachFile: pe = !1, hideActionBar: me = !1, renderFooterActions: N, isInputDisabled: F = !1, isModelSelectorDisabled: he = !1, isSendDisabled: I = !1, isAudioMessageSupported: ge = !1, sendOnEnter: _e = Le.Enter, prefixAttachments: U = [], onRemovePrefixAttachment: ye, chatSettings: be, toolsMenuItems: xe, onToolToggle: Se, toolsMenuTitle: we, toolsBackLabel: Te, toolsChipLabels: W, autoFocus: Ee = !1, messageHistory: ke, onDialFileSystemClick: Ae, dialFileSystemLabel: Ne, validateAttachment: Pe, onAttachmentClick: Fe, modelPickerOverlay: Re, maximumAttachmentsAmount: ze, onAttachmentsLimitExceeded: Be, isAttachmentsEnabled: Ve = !0, usageLimitsSlot: He }) => {
1704
- let Ue = s(), [We, Ge] = z(!1), G = je(ke), qe = L(() => a({
1715
+ }, Nt = 160, Pt = ({ message: e = "", messageRevision: t, onSend: n, onUploadAttachment: r, onStop: i, isStreaming: l = !1, onChange: d, onAttachmentsChange: f, placeholder: p = "Type a message...", ariaLabel: m, attachLabel: g = "Attach file", fileAccept: _, addMenuTitle: v = "Add", menuTitle: y = "Menu", menuCloseLabel: b = "Close", removeLabel: x, retryLabel: S, sendLabel: C, stopLabel: w, micLabel: T = "Record voice message", stopRecordingLabel: E, discardRecordingLabel: D, timerAriaLabel: O, colors: k, typography: A, className: ee, pendingDropFiles: te = [], onDropFilesConsumed: ne, pendingAttachments: re = [], onPendingAttachmentsConsumed: ie, pasteTextThreshold: j = 4e3, deployments: M, selectedDeploymentId: se, onDeploymentChange: ce, modelSelectorLabels: le, initialAttachments: ue = [], isStacked: de = !1, hideAddButton: fe = !1, hideAttachFile: pe = !1, hideActionBar: me = !1, renderFooterActions: N, isInputDisabled: F = !1, isModelSelectorDisabled: he = !1, isSendDisabled: I = !1, isAudioMessageSupported: ge = !1, sendOnEnter: _e = Re.Enter, prefixAttachments: ve = [], onRemovePrefixAttachment: be, chatSettings: xe, toolsMenuItems: Se, onToolToggle: Ce, toolsMenuTitle: Te, toolsBackLabel: Ee, toolsChipLabels: U, autoFocus: De = !1, messageHistory: Ae, onDialFileSystemClick: je, dialFileSystemLabel: Pe, validateAttachment: Fe, onAttachmentClick: Ie, modelPickerOverlay: ze, maximumAttachmentsAmount: Be, onAttachmentsLimitExceeded: Ve, isAttachmentsEnabled: W = !0, usageLimitsSlot: He, onMessageTooLong: Ue }) => {
1716
+ let We = s(), [Ge, G] = z(!1), qe = Me(Ae), Je = L(() => a({
1705
1717
  "--ci-bg": k?.background,
1706
1718
  "--ci-text": k?.text,
1707
1719
  "--ci-border": k?.border,
@@ -1713,55 +1725,70 @@ var Dt = {
1713
1725
  "--ci-send-bg": k?.sendBackground,
1714
1726
  "--ci-send-text": k?.sendText,
1715
1727
  "--ci-stop-color": k?.stopColor
1716
- }), [k]), Je = L(() => Ae ? [{
1728
+ }), [k]), K = L(() => je ? [{
1717
1729
  key: "dial-fs",
1718
- label: Ne ?? "DIAL file system",
1719
- icon: /* @__PURE__ */ V(oe, {
1730
+ label: Pe ?? "DIAL file system",
1731
+ icon: /* @__PURE__ */ V(ae, {
1720
1732
  size: c,
1721
1733
  "aria-hidden": !0
1722
1734
  }),
1723
- onClick: Ae
1724
- }] : [], [Ae, Ne]), { message: K, setMessage: q, textareaRef: Xe, isMultiLine: J } = Me({
1735
+ onClick: je
1736
+ }] : [], [je, Pe]), { message: q, setMessage: J, textareaRef: Y, isMultiLine: Xe } = Ne({
1725
1737
  messageProp: e,
1726
1738
  messageRevision: t
1727
- }), { attachments: Y, buildAttachments: et, addAttachments: tt, resetAttachments: nt, handleRemove: rt, handleRetry: it, handleExpand: at, hasBlockedAttachments: ot } = De({
1739
+ }), { attachments: Z, buildAttachments: et, addAttachments: tt, resetAttachments: nt, handleRemove: rt, handleRetry: it, handleExpand: at, hasBlockedAttachments: ot } = Oe({
1728
1740
  initialAttachments: ue,
1729
1741
  onUploadAttachment: r,
1730
1742
  onAttachmentsChange: f,
1731
- validateAttachment: Pe,
1743
+ validateAttachment: Fe,
1732
1744
  pendingDropFiles: te,
1733
1745
  onDropFilesConsumed: ne,
1734
1746
  pendingAttachments: re,
1735
1747
  onPendingAttachmentsConsumed: ie,
1736
1748
  onExpandPastedText: P((e) => {
1737
- q((t) => t ? `${t}\n${e}` : e);
1738
- }, [q]),
1739
- maximumAttachmentsAmount: ze,
1740
- baseAttachmentsAmount: U.length,
1741
- onAttachmentsLimitExceeded: Be
1742
- }), { state: st, analyserNodeRef: ct, elapsedSeconds: lt, errorMessage: ut, startRecording: dt, stopRecording: ft, discardRecording: pt } = Ie({ onAttachAudio: P((e) => {
1749
+ J((t) => t ? `${t}\n${e}` : e);
1750
+ }, [J]),
1751
+ maximumAttachmentsAmount: Be,
1752
+ baseAttachmentsAmount: ve.length,
1753
+ onAttachmentsLimitExceeded: Ve
1754
+ }), { state: st, analyserNodeRef: ct, elapsedSeconds: lt, errorMessage: ut, startRecording: dt, stopRecording: ft, discardRecording: pt } = Le({ onAttachAudio: P((e) => {
1743
1755
  tt(et([e]));
1744
- }, [tt, et]) }), mt = R(null), ht = R(null), { handlePaste: Z } = Ce(tt, Ve ? ae : Infinity), Q = K.trim().length > 0 || Y.length > 0, gt = Q && !ot && !I, { shouldRender: _t, isExiting: vt, instanceKey: yt } = Oe(!l && Q, Nt), bt = (xe?.some((e) => e.isSelected) ?? !1) && Se != null, $ = de || K.includes("\n") || J || bt, xt = j === void 0 || ce != null, St = async () => {
1756
+ }, [tt, et]) }), mt = R(null), Q = R(null), { handlePaste: ht } = we(tt, W ? j : Infinity), gt = P((e) => {
1757
+ if (!W) {
1758
+ let t = e.clipboardData.getData("text/plain");
1759
+ t.length >= j && Ue?.(t.length, j);
1760
+ }
1761
+ ht(e);
1762
+ }, [
1763
+ W,
1764
+ j,
1765
+ Ue,
1766
+ ht
1767
+ ]), _t = q.trim().length > 0 || Z.length > 0, vt = _t && !ot && !I, { shouldRender: yt, isExiting: bt, instanceKey: xt } = ke(!l && _t, Nt), St = (Se?.some((e) => e.isSelected) ?? !1) && Ce != null, $ = de || q.includes("\n") || Xe || St, Ct = M === void 0 || se != null, wt = async () => {
1745
1768
  if (I) return;
1746
- let e = K, t = Y;
1747
- q(""), G.reset();
1769
+ if (!W && q.length >= j) {
1770
+ Ue?.(q.length, j);
1771
+ return;
1772
+ }
1773
+ let e = q, t = Z;
1774
+ J(""), qe.reset();
1748
1775
  try {
1749
1776
  await n?.(e, t), t.forEach((e) => {
1750
1777
  e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
1751
1778
  }), nt([]);
1752
1779
  } catch {
1753
- q(e), nt(t);
1780
+ J(e), nt(t);
1754
1781
  }
1755
- }, Ct = (e) => {
1782
+ }, Tt = (e) => {
1756
1783
  if (!e.nativeEvent.isComposing && !F && !l && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
1757
- let t = e.currentTarget.selectionStart ?? 0, n = G.navigate(e.key === "ArrowUp" ? "up" : "down", K, t);
1784
+ let t = e.currentTarget.selectionStart ?? 0, n = qe.navigate(e.key === "ArrowUp" ? "up" : "down", q, t);
1758
1785
  if (n !== null) {
1759
- e.preventDefault(), q(n);
1786
+ e.preventDefault(), J(n);
1760
1787
  return;
1761
1788
  }
1762
1789
  }
1763
- e.key === "Enter" && (_e === Le.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !l && gt && xt && !F && St());
1764
- }, wt = (e) => {
1790
+ e.key === "Enter" && (_e === Re.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !l && vt && Ct && !F && wt());
1791
+ }, Et = (e) => {
1765
1792
  let t = Array.from(e.target.files ?? []);
1766
1793
  if (t.length === 0) return;
1767
1794
  let n = et(t);
@@ -1777,32 +1804,32 @@ var Dt = {
1777
1804
  stopLabel: E,
1778
1805
  discardLabel: D,
1779
1806
  timerLabel: O,
1780
- style: qe,
1807
+ style: Je,
1781
1808
  className: ee
1782
1809
  });
1783
- let Tt = /* @__PURE__ */ V("textarea", {
1810
+ let Dt = /* @__PURE__ */ V("textarea", {
1784
1811
  className: o(X.textarea, A?.fontClassName, "max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent outline-none [field-sizing:content]"),
1785
- ref: Xe,
1786
- autoFocus: Ee,
1787
- value: K,
1812
+ ref: Y,
1813
+ autoFocus: De,
1814
+ value: q,
1788
1815
  onChange: (e) => {
1789
- q(e.target.value), G.notifyChange(), d?.(e.target.value);
1816
+ J(e.target.value), qe.notifyChange(), d?.(e.target.value);
1790
1817
  },
1791
- onKeyDown: Ct,
1792
- onPaste: Z,
1818
+ onKeyDown: Tt,
1819
+ onPaste: gt,
1793
1820
  placeholder: p,
1794
1821
  "aria-label": m,
1795
1822
  disabled: F,
1796
1823
  rows: 1
1797
1824
  });
1798
1825
  return /* @__PURE__ */ H("div", {
1799
- ref: ht,
1800
- style: qe,
1801
- className: o(X.wrapper, F && X.wrapperDisabled, "flex min-h-[56px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", Y.length > 6 ? "py-3 ps-3" : "p-3", ee),
1802
- children: [(U.length > 0 || Y.length > 0) && /* @__PURE__ */ V(ve, {
1803
- attachments: [...U, ...Y],
1826
+ ref: Q,
1827
+ style: Je,
1828
+ className: o(X.wrapper, F && X.wrapperDisabled, "flex min-h-[56px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", Z.length > 6 ? "py-3 ps-3" : "p-3", ee),
1829
+ children: [(ve.length > 0 || Z.length > 0) && /* @__PURE__ */ V(ye, {
1830
+ attachments: [...ve, ...Z],
1804
1831
  onRemove: (e) => {
1805
- U.some((t) => t.id === e) ? ye?.(e) : rt(e);
1832
+ ve.some((t) => t.id === e) ? be?.(e) : rt(e);
1806
1833
  },
1807
1834
  onRetry: it,
1808
1835
  onExpand: at,
@@ -1810,11 +1837,11 @@ var Dt = {
1810
1837
  removeLabel: x,
1811
1838
  retryLabel: S
1812
1839
  },
1813
- onAttachmentClick: Fe == null ? void 0 : (e) => {
1814
- let t = [...U, ...Y].find((t) => t.id === e);
1815
- t != null && Fe(t);
1840
+ onAttachmentClick: Ie == null ? void 0 : (e) => {
1841
+ let t = [...ve, ...Z].find((t) => t.id === e);
1842
+ t != null && Ie(t);
1816
1843
  }
1817
- }), me ? $ && Tt : /* @__PURE__ */ H("div", {
1844
+ }), me ? $ && Dt : /* @__PURE__ */ H("div", {
1818
1845
  className: o("flex items-center gap-2", $ ? "flex-wrap" : "flex-wrap desktop:flex-nowrap"),
1819
1846
  children: [
1820
1847
  !fe && /* @__PURE__ */ H("div", {
@@ -1827,70 +1854,70 @@ var Dt = {
1827
1854
  className: "sr-only",
1828
1855
  "aria-hidden": !0,
1829
1856
  tabIndex: -1,
1830
- onChange: wt
1857
+ onChange: Et
1831
1858
  }), /* @__PURE__ */ V(Ke, {
1832
1859
  onAttachClick: pe ? void 0 : () => mt.current?.click(),
1833
1860
  attachLabel: g,
1834
1861
  addMenuTitle: v,
1835
1862
  menuTitle: y,
1836
1863
  menuCloseLabel: b,
1837
- style: qe,
1864
+ style: Je,
1838
1865
  isDisabled: F,
1839
- chatSettings: be,
1840
- extraMenuItems: Je,
1841
- toolsMenuItems: xe,
1842
- onToolToggle: Se,
1843
- toolsMenuTitle: we,
1844
- toolsBackLabel: Te
1866
+ chatSettings: xe,
1867
+ extraMenuItems: K,
1868
+ toolsMenuItems: Se,
1869
+ onToolToggle: Ce,
1870
+ toolsMenuTitle: Te,
1871
+ toolsBackLabel: Ee
1845
1872
  })]
1846
1873
  }),
1847
- $ && bt && /* @__PURE__ */ V("div", {
1874
+ $ && St && /* @__PURE__ */ V("div", {
1848
1875
  className: "order-3 min-w-0 flex-1",
1849
1876
  children: /* @__PURE__ */ V(Ye, {
1850
- items: xe ?? [],
1851
- onToolToggle: Se,
1852
- isMobile: Ue,
1853
- countLabel: W?.countLabel,
1854
- removeLabel: W?.removeLabel
1877
+ items: Se ?? [],
1878
+ onToolToggle: Ce,
1879
+ isMobile: We,
1880
+ countLabel: U?.countLabel,
1881
+ removeLabel: U?.removeLabel
1855
1882
  })
1856
1883
  }),
1857
1884
  /* @__PURE__ */ V("div", {
1858
1885
  className: o("order-1 flex w-full min-w-0 items-center self-stretch", !$ && "desktop:order-2 desktop:w-auto desktop:flex-1"),
1859
- children: Tt
1886
+ children: Dt
1860
1887
  }),
1861
1888
  /* @__PURE__ */ H("div", {
1862
- className: o("flex flex-shrink-0 items-center gap-2", $ && bt ? "order-4" : "order-3", "ms-auto", !$ && "desktop:ms-0"),
1889
+ className: o("flex flex-shrink-0 items-center gap-2", $ && St ? "order-4" : "order-3", "ms-auto", !$ && "desktop:ms-0"),
1863
1890
  children: [N ? N({
1864
- canSend: gt,
1865
- onSend: St
1891
+ canSend: vt,
1892
+ onSend: wt
1866
1893
  }) : /* @__PURE__ */ H(B, { children: [
1867
1894
  He,
1868
1895
  /* @__PURE__ */ V(Mt, {
1869
- deployments: j,
1870
- selectedDeploymentId: ce,
1871
- onDeploymentChange: M,
1896
+ deployments: M,
1897
+ selectedDeploymentId: se,
1898
+ onDeploymentChange: ce,
1872
1899
  modelSelectorLabels: le,
1873
1900
  isStreaming: l,
1874
- isMobile: Ue,
1901
+ isMobile: We,
1875
1902
  isInputDisabled: F,
1876
1903
  isDisabled: he,
1877
- style: qe,
1878
- modelPickerOverlay: Re,
1879
- isPickerOpen: We,
1880
- onPickerToggle: () => Ge((e) => !e),
1881
- onPickerOpenChange: Ge
1904
+ style: Je,
1905
+ modelPickerOverlay: ze,
1906
+ isPickerOpen: Ge,
1907
+ onPickerToggle: () => G((e) => !e),
1908
+ onPickerOpenChange: G
1882
1909
  }),
1883
1910
  l && i ? /* @__PURE__ */ V($e, {
1884
1911
  onStop: i,
1885
1912
  ariaLabel: w
1886
- }) : !l && _t && /* @__PURE__ */ V(Qe, {
1887
- onSend: St,
1888
- isDisabled: !xt || ot || I,
1913
+ }) : !l && yt && /* @__PURE__ */ V(Qe, {
1914
+ onSend: wt,
1915
+ isDisabled: !Ct || ot || I,
1889
1916
  ariaLabel: C,
1890
- isExiting: vt
1891
- }, yt)
1892
- ] }), ge && !vt && /* @__PURE__ */ V(h, {
1893
- icon: /* @__PURE__ */ V(se, {
1917
+ isExiting: bt
1918
+ }, xt)
1919
+ ] }), ge && !bt && /* @__PURE__ */ V(h, {
1920
+ icon: /* @__PURE__ */ V(oe, {
1894
1921
  size: u.LG,
1895
1922
  "aria-hidden": !0
1896
1923
  }),
@@ -1927,24 +1954,30 @@ var Dt = {
1927
1954
  })
1928
1955
  })]
1929
1956
  });
1930
- }, Lt = ({ message: e, initialAttachments: t = [], onCancel: n, onSave: i, onUploadAttachment: a, cancelLabel: s = "Cancel", saveLabel: l = "Save & Submit", ariaLabel: u, removeLabel: d, retryLabel: f, addMenuTitle: p = "Add", attachLabel: m = "Attach file", menuTitle: h = "Menu", menuCloseLabel: g = "Close", className: _, pendingDropFiles: v, onDropFilesConsumed: y, validateAttachment: b, isAttachmentsEnabled: x, hideAttachFile: S = !1, fileAccept: C, maximumAttachmentsAmount: w, onAttachmentsLimitExceeded: T, onDialFileSystemClick: E, dialFileSystemLabel: O, pendingAttachments: A, onPendingAttachmentsConsumed: ee, onAttachmentClick: te }) => {
1931
- let ne = R(null), [re, ie] = z([]);
1957
+ }, Lt = ({ message: e, initialAttachments: t = [], onCancel: n, onSave: i, onUploadAttachment: a, cancelLabel: s = "Cancel", saveLabel: l = "Save & Submit", ariaLabel: u, removeLabel: d, retryLabel: f, addMenuTitle: p = "Add", attachLabel: m = "Attach file", menuTitle: h = "Menu", menuCloseLabel: g = "Close", className: _, pendingDropFiles: v, onDropFilesConsumed: y, validateAttachment: b, isAttachmentsEnabled: x, hideAttachFile: S = !1, fileAccept: C, maximumAttachmentsAmount: w, onAttachmentsLimitExceeded: T, onDialFileSystemClick: E, dialFileSystemLabel: O, pendingAttachments: A, onPendingAttachmentsConsumed: ee, onAttachmentClick: te, pasteTextThreshold: ne, onMessageTooLong: re }) => {
1958
+ let ie = R(null), [j, oe] = z([]);
1932
1959
  F(() => {
1933
- v?.length && (ie(v), y?.());
1960
+ v?.length && (oe(v), y?.());
1934
1961
  }, [v, y]);
1935
- let [ae, se] = z(e ?? ""), [j, ce] = z([]), [M, le] = z(t), ue = j.some((e) => e.status === r.Loading || e.status === r.Error), de = (ae.trim().length > 0 || j.length > 0 || M.length > 0) && !ue, fe = (e) => {
1936
- le((t) => t.filter((t) => t.id !== e));
1937
- }, pe = P((e, t) => {
1938
- i(e, M, t);
1939
- }, [M, i]), me = () => {
1940
- de && pe(ae, j);
1941
- }, N = P(() => ie([]), []), he = P((e) => {
1962
+ let [M, se] = z(e ?? ""), [ce, le] = z([]), [ue, de] = z(t), fe = ce.some((e) => e.status === r.Loading || e.status === r.Error), pe = (M.trim().length > 0 || ce.length > 0 || ue.length > 0) && !fe, me = (e) => {
1963
+ de((t) => t.filter((t) => t.id !== e));
1964
+ }, N = P((e, t) => {
1965
+ i(e, ue, t);
1966
+ }, [ue, i]), he = () => {
1967
+ if (pe) {
1968
+ if (!x && M.length >= (ne ?? 4e3)) {
1969
+ re?.(M.length, ne ?? 4e3);
1970
+ return;
1971
+ }
1972
+ N(M, ce);
1973
+ }
1974
+ }, I = P(() => oe([]), []), ge = P((e) => {
1942
1975
  let t = Array.from(e.target.files ?? []);
1943
- t.length !== 0 && (e.target.value = "", ie(t));
1944
- }, []), I = L(() => E ? [{
1976
+ t.length !== 0 && (e.target.value = "", oe(t));
1977
+ }, []), _e = L(() => E ? [{
1945
1978
  key: "dial-fs",
1946
1979
  label: O ?? "DIAL file system",
1947
- icon: /* @__PURE__ */ V(oe, {
1980
+ icon: /* @__PURE__ */ V(ae, {
1948
1981
  size: c,
1949
1982
  "aria-hidden": !0
1950
1983
  }),
@@ -1957,44 +1990,46 @@ var Dt = {
1957
1990
  ariaLabel: u,
1958
1991
  isStacked: !0,
1959
1992
  hideActionBar: !0,
1960
- pendingDropFiles: re,
1961
- onDropFilesConsumed: N,
1962
- onSend: pe,
1993
+ pendingDropFiles: j,
1994
+ onDropFilesConsumed: I,
1995
+ onSend: N,
1963
1996
  onUploadAttachment: a,
1964
1997
  onChange: se,
1965
- onAttachmentsChange: ce,
1998
+ onAttachmentsChange: le,
1966
1999
  removeLabel: d,
1967
2000
  retryLabel: f,
1968
2001
  className: "max-w-full",
1969
- prefixAttachments: M,
1970
- onRemovePrefixAttachment: fe,
2002
+ prefixAttachments: ue,
2003
+ onRemovePrefixAttachment: me,
1971
2004
  validateAttachment: b,
1972
2005
  isAttachmentsEnabled: x,
1973
2006
  maximumAttachmentsAmount: w,
1974
2007
  onAttachmentsLimitExceeded: T,
1975
2008
  pendingAttachments: A,
1976
2009
  onPendingAttachmentsConsumed: ee,
1977
- onAttachmentClick: te
2010
+ onAttachmentClick: te,
2011
+ pasteTextThreshold: ne,
2012
+ onMessageTooLong: re
1978
2013
  }), /* @__PURE__ */ H("div", {
1979
2014
  className: "flex items-center justify-between",
1980
2015
  children: [/* @__PURE__ */ V("div", {
1981
2016
  className: "flex",
1982
2017
  children: !S && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("input", {
1983
- ref: ne,
2018
+ ref: ie,
1984
2019
  type: "file",
1985
2020
  multiple: !0,
1986
2021
  accept: C,
1987
2022
  className: "sr-only",
1988
2023
  "aria-hidden": !0,
1989
2024
  tabIndex: -1,
1990
- onChange: he
2025
+ onChange: ge
1991
2026
  }), /* @__PURE__ */ V(Ke, {
1992
- onAttachClick: () => ne.current?.click(),
2027
+ onAttachClick: () => ie.current?.click(),
1993
2028
  attachLabel: m,
1994
2029
  addMenuTitle: p,
1995
2030
  menuTitle: h,
1996
2031
  menuCloseLabel: g,
1997
- extraMenuItems: I
2032
+ extraMenuItems: _e
1998
2033
  })] })
1999
2034
  }), /* @__PURE__ */ H("div", {
2000
2035
  className: "flex gap-2",
@@ -2003,12 +2038,12 @@ var Dt = {
2003
2038
  onClick: n
2004
2039
  }), /* @__PURE__ */ V(k, {
2005
2040
  label: l,
2006
- onClick: me,
2007
- disabled: !de
2041
+ onClick: he,
2042
+ disabled: !pe
2008
2043
  })]
2009
2044
  })]
2010
2045
  })]
2011
2046
  });
2012
2047
  };
2013
2048
  //#endregion
2014
- export { ge as AttachmentCard, _e as AttachmentGroup, U as AttachmentTray, W as BottomSheetShell, We as ChatSettingsModal, It as ConversationInput, Lt as EditMessageInput, ye as FileDndOverlay, Pt as Input, Le as SendOnEnter, Se as getAttachmentIcon };
2049
+ export { ge as AttachmentCard, _e as AttachmentGroup, ve as AttachmentTray, U as BottomSheetShell, We as ChatSettingsModal, It as ConversationInput, Lt as EditMessageInput, be as FileDndOverlay, Pt as Input, Re as SendOnEnter, Ce as getAttachmentIcon };