teodor-new-chat-ui 3.0.185 → 3.0.187

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/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ var vp = Object.defineProperty;
2
2
  var wp = (e, t, n) => t in e ? vp(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var Oa = (e, t, n) => wp(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as p from "react";
5
- import B, { useState as me, useRef as rt, useCallback as Ye, useEffect as ct, useReducer as bp, useMemo as Gt, createContext as yp, useContext as Sp, createElement as co, useLayoutEffect as Cp } from "react";
5
+ import B, { useState as me, useRef as rt, useCallback as Ye, useEffect as ct, useReducer as bp, useMemo as Yt, createContext as yp, useContext as Sp, createElement as co, useLayoutEffect as Cp } from "react";
6
6
  import { Square as Tp, Send as Rp, X as rr, ExternalLink as kp, Download as Ep, Image as Ip, FileText as Ma, Loader as gc, Bot as Da, Wrench as Np, User as Ap, Paperclip as ni, ChevronUp as kr, ChevronDown as nr, Copy as La, Edit as $a, RotateCcw as ri, ChevronRight as _p, Check as Mi, Circle as jp, Edit3 as xc, Loader2 as Pp, Plus as Op, FileSpreadsheet as Mp, MessageSquarePlus as Dp, MessageSquare as Lp, Calendar as $p, Trash2 as Fp, Settings as zp, Server as Bp, EyeOff as Hp, Eye as Up, Layout as Wp, MessageCircle as Vp, Save as Kp } from "lucide-react";
7
7
  import { Slot as qp, createSlot as lr } from "@radix-ui/react-slot";
8
8
  import { cva as qo } from "class-variance-authority";
@@ -66,8 +66,8 @@ function Jp() {
66
66
  {
67
67
  var Se = x.ReactDebugCurrentFrame, Ve = Se.getStackAddendum();
68
68
  Ve !== "" && (U += "%s", ne = ne.concat([Ve]));
69
- var Ge = ne.map(function(Fe) {
70
- return String(Fe);
69
+ var Ge = ne.map(function(ze) {
70
+ return String(ze);
71
71
  });
72
72
  Ge.unshift("Warning: " + U), Function.prototype.apply.call(console[T], console, Ge);
73
73
  }
@@ -126,9 +126,9 @@ function Jp() {
126
126
  var Se = T.displayName || null;
127
127
  return Se !== null ? Se : V(T.type) || "Memo";
128
128
  case h: {
129
- var Ve = T, Ge = Ve._payload, Fe = Ve._init;
129
+ var Ve = T, Ge = Ve._payload, ze = Ve._init;
130
130
  try {
131
- return V(Fe(Ge));
131
+ return V(ze(Ge));
132
132
  } catch {
133
133
  return null;
134
134
  }
@@ -136,14 +136,14 @@ function Jp() {
136
136
  }
137
137
  return null;
138
138
  }
139
- var P = Object.assign, G = 0, W, K, D, O, ie, Z, ee;
139
+ var P = Object.assign, G = 0, W, K, D, O, ie, J, ee;
140
140
  function M() {
141
141
  }
142
142
  M.__reactDisabledLog = !0;
143
- function J() {
143
+ function Z() {
144
144
  {
145
145
  if (G === 0) {
146
- W = console.log, K = console.info, D = console.warn, O = console.error, ie = console.group, Z = console.groupCollapsed, ee = console.groupEnd;
146
+ W = console.log, K = console.info, D = console.warn, O = console.error, ie = console.group, J = console.groupCollapsed, ee = console.groupEnd;
147
147
  var T = {
148
148
  configurable: !0,
149
149
  enumerable: !0,
@@ -188,7 +188,7 @@ function Jp() {
188
188
  value: ie
189
189
  }),
190
190
  groupCollapsed: P({}, T, {
191
- value: Z
191
+ value: J
192
192
  }),
193
193
  groupEnd: P({}, T, {
194
194
  value: ee
@@ -230,30 +230,30 @@ function Jp() {
230
230
  var Ve = Error.prepareStackTrace;
231
231
  Error.prepareStackTrace = void 0;
232
232
  var Ge;
233
- Ge = fe.current, fe.current = null, J();
233
+ Ge = fe.current, fe.current = null, Z();
234
234
  try {
235
235
  if (U) {
236
- var Fe = function() {
236
+ var ze = function() {
237
237
  throw Error();
238
238
  };
239
- if (Object.defineProperty(Fe.prototype, "props", {
239
+ if (Object.defineProperty(ze.prototype, "props", {
240
240
  set: function() {
241
241
  throw Error();
242
242
  }
243
243
  }), typeof Reflect == "object" && Reflect.construct) {
244
244
  try {
245
- Reflect.construct(Fe, []);
245
+ Reflect.construct(ze, []);
246
246
  } catch (kt) {
247
247
  Se = kt;
248
248
  }
249
- Reflect.construct(T, [], Fe);
249
+ Reflect.construct(T, [], ze);
250
250
  } else {
251
251
  try {
252
- Fe.call();
252
+ ze.call();
253
253
  } catch (kt) {
254
254
  Se = kt;
255
255
  }
256
- T.call(Fe.prototype);
256
+ T.call(ze.prototype);
257
257
  }
258
258
  } else {
259
259
  try {
@@ -274,9 +274,9 @@ function Jp() {
274
274
  if (ot !== 1 || lt !== 1)
275
275
  do
276
276
  if (ot--, lt--, lt < 0 || Oe[ot] !== St[lt]) {
277
- var $t = `
277
+ var Ft = `
278
278
  ` + Oe[ot].replace(" at new ", " at ");
279
- return T.displayName && $t.includes("<anonymous>") && ($t = $t.replace("<anonymous>", T.displayName)), typeof T == "function" && Q.set(T, $t), $t;
279
+ return T.displayName && Ft.includes("<anonymous>") && (Ft = Ft.replace("<anonymous>", T.displayName)), typeof T == "function" && Q.set(T, Ft), Ft;
280
280
  }
281
281
  while (ot >= 1 && lt >= 0);
282
282
  break;
@@ -335,19 +335,19 @@ function Jp() {
335
335
  function dt(T, U, ne, Se, Ve) {
336
336
  {
337
337
  var Ge = Function.call.bind(ke);
338
- for (var Fe in T)
339
- if (Ge(T, Fe)) {
338
+ for (var ze in T)
339
+ if (Ge(T, ze)) {
340
340
  var Oe = void 0;
341
341
  try {
342
- if (typeof T[Fe] != "function") {
343
- var St = Error((Se || "React class") + ": " + ne + " type `" + Fe + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof T[Fe] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
342
+ if (typeof T[ze] != "function") {
343
+ var St = Error((Se || "React class") + ": " + ne + " type `" + ze + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof T[ze] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
344
344
  throw St.name = "Invariant Violation", St;
345
345
  }
346
- Oe = T[Fe](U, Fe, Se, ne, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
346
+ Oe = T[ze](U, ze, Se, ne, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
347
  } catch (ot) {
348
348
  Oe = ot;
349
349
  }
350
- Oe && !(Oe instanceof Error) && (qe(Ve), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Se || "React class", ne, Fe, typeof Oe), qe(null)), Oe instanceof Error && !(Oe.message in Be) && (Be[Oe.message] = !0, qe(Ve), w("Failed %s type: %s", ne, Oe.message), qe(null));
350
+ Oe && !(Oe instanceof Error) && (qe(Ve), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Se || "React class", ne, ze, typeof Oe), qe(null)), Oe instanceof Error && !(Oe.message in Be) && (Be[Oe.message] = !0, qe(Ve), w("Failed %s type: %s", ne, Oe.message), qe(null));
351
351
  }
352
352
  }
353
353
  }
@@ -400,7 +400,7 @@ function Jp() {
400
400
  function at(T, U) {
401
401
  typeof T.ref == "string" && Ue.current;
402
402
  }
403
- function Dt(T, U) {
403
+ function Lt(T, U) {
404
404
  {
405
405
  var ne = function() {
406
406
  Y || (Y = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", U));
@@ -422,7 +422,7 @@ function Jp() {
422
422
  });
423
423
  }
424
424
  }
425
- var xt = function(T, U, ne, Se, Ve, Ge, Fe) {
425
+ var xt = function(T, U, ne, Se, Ve, Ge, ze) {
426
426
  var Oe = {
427
427
  // This tag allows us to uniquely identify this as a React Element
428
428
  $$typeof: t,
@@ -430,7 +430,7 @@ function Jp() {
430
430
  type: T,
431
431
  key: U,
432
432
  ref: ne,
433
- props: Fe,
433
+ props: ze,
434
434
  // Record the component responsible for creating this element.
435
435
  _owner: Ge
436
436
  };
@@ -453,20 +453,20 @@ function Jp() {
453
453
  };
454
454
  function At(T, U, ne, Se, Ve) {
455
455
  {
456
- var Ge, Fe = {}, Oe = null, St = null;
456
+ var Ge, ze = {}, Oe = null, St = null;
457
457
  ne !== void 0 && (Pe(ne), Oe = "" + ne), Ne(U) && (Pe(U.key), Oe = "" + U.key), tt(U) && (St = U.ref, at(U, Ve));
458
458
  for (Ge in U)
459
- ke.call(U, Ge) && !$.hasOwnProperty(Ge) && (Fe[Ge] = U[Ge]);
459
+ ke.call(U, Ge) && !$.hasOwnProperty(Ge) && (ze[Ge] = U[Ge]);
460
460
  if (T && T.defaultProps) {
461
461
  var ot = T.defaultProps;
462
462
  for (Ge in ot)
463
- Fe[Ge] === void 0 && (Fe[Ge] = ot[Ge]);
463
+ ze[Ge] === void 0 && (ze[Ge] = ot[Ge]);
464
464
  }
465
465
  if (Oe || St) {
466
466
  var lt = typeof T == "function" ? T.displayName || T.name || "Unknown" : T;
467
- Oe && Dt(Fe, lt), St && _n(Fe, lt);
467
+ Oe && Lt(ze, lt), St && _n(ze, lt);
468
468
  }
469
- return xt(T, Oe, St, Ve, Se, Ue.current, Fe);
469
+ return xt(T, Oe, St, Ve, Se, Ue.current, ze);
470
470
  }
471
471
  }
472
472
  var ht = x.ReactCurrentOwner, Rt = x.ReactDebugCurrentFrame;
@@ -482,7 +482,7 @@ function Jp() {
482
482
  function je(T) {
483
483
  return typeof T == "object" && T !== null && T.$$typeof === t;
484
484
  }
485
- function ze() {
485
+ function Fe() {
486
486
  {
487
487
  if (ht.current) {
488
488
  var T = V(ht.current.type);
@@ -494,13 +494,13 @@ Check the render method of \`` + T + "`.";
494
494
  return "";
495
495
  }
496
496
  }
497
- function Lt(T) {
497
+ function $t(T) {
498
498
  return "";
499
499
  }
500
- var tn = {};
500
+ var _t = {};
501
501
  function wr(T) {
502
502
  {
503
- var U = ze();
503
+ var U = Fe();
504
504
  if (!U) {
505
505
  var ne = typeof T == "string" ? T : T.displayName || T.name;
506
506
  ne && (U = `
@@ -516,9 +516,9 @@ Check the top-level render call using <` + ne + ">.");
516
516
  return;
517
517
  T._store.validated = !0;
518
518
  var ne = wr(U);
519
- if (tn[ne])
519
+ if (_t[ne])
520
520
  return;
521
- tn[ne] = !0;
521
+ _t[ne] = !0;
522
522
  var Se = "";
523
523
  T && T._owner && T._owner !== ht.current && (Se = " It was passed a child from " + V(T._owner.type) + "."), te(T), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ne, Se), te(null);
524
524
  }
@@ -537,8 +537,8 @@ Check the top-level render call using <` + ne + ">.");
537
537
  else if (T) {
538
538
  var Ve = g(T);
539
539
  if (typeof Ve == "function" && Ve !== T.entries)
540
- for (var Ge = Ve.call(T), Fe; !(Fe = Ge.next()).done; )
541
- je(Fe.value) && br(Fe.value, U);
540
+ for (var Ge = Ve.call(T), ze; !(ze = Ge.next()).done; )
541
+ je(ze.value) && br(ze.value, U);
542
542
  }
543
543
  }
544
544
  }
@@ -582,30 +582,30 @@ Check the top-level render call using <` + ne + ">.");
582
582
  var ja = {};
583
583
  function Pa(T, U, ne, Se, Ve, Ge) {
584
584
  {
585
- var Fe = _(T);
586
- if (!Fe) {
585
+ var ze = _(T);
586
+ if (!ze) {
587
587
  var Oe = "";
588
588
  (T === void 0 || typeof T == "object" && T !== null && Object.keys(T).length === 0) && (Oe += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
589
- var St = Lt();
590
- St ? Oe += St : Oe += ze();
589
+ var St = $t();
590
+ St ? Oe += St : Oe += Fe();
591
591
  var ot;
592
592
  T === null ? ot = "null" : ce(T) ? ot = "array" : T !== void 0 && T.$$typeof === t ? (ot = "<" + (V(T.type) || "Unknown") + " />", Oe = " Did you accidentally export a JSX literal instead of a component?") : ot = typeof T, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ot, Oe);
593
593
  }
594
594
  var lt = At(T, U, ne, Ve, Ge);
595
595
  if (lt == null)
596
596
  return lt;
597
- if (Fe) {
598
- var $t = U.children;
599
- if ($t !== void 0)
597
+ if (ze) {
598
+ var Ft = U.children;
599
+ if (Ft !== void 0)
600
600
  if (Se)
601
- if (ce($t)) {
602
- for (var Zn = 0; Zn < $t.length; Zn++)
603
- yr($t[Zn], T);
604
- Object.freeze && Object.freeze($t);
601
+ if (ce(Ft)) {
602
+ for (var Zn = 0; Zn < Ft.length; Zn++)
603
+ yr(Ft[Zn], T);
604
+ Object.freeze && Object.freeze(Ft);
605
605
  } else
606
606
  w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
607
607
  else
608
- yr($t, T);
608
+ yr(Ft, T);
609
609
  }
610
610
  if (ke.call(U, "key")) {
611
611
  var jn = V(T), kt = Object.keys(U).filter(function(xp) {
@@ -644,11 +644,11 @@ function wc(e, t) {
644
644
  const { toString: Zp } = Object.prototype, { getPrototypeOf: Di } = Object, { iterator: Yo, toStringTag: bc } = Symbol, Xo = /* @__PURE__ */ ((e) => (t) => {
645
645
  const n = Zp.call(t);
646
646
  return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
647
- })(/* @__PURE__ */ Object.create(null)), Qt = (e) => (e = e.toLowerCase(), (t) => Xo(t) === e), Jo = (e) => (t) => typeof t === e, { isArray: fr } = Array, cr = Jo("undefined");
647
+ })(/* @__PURE__ */ Object.create(null)), en = (e) => (e = e.toLowerCase(), (t) => Xo(t) === e), Jo = (e) => (t) => typeof t === e, { isArray: fr } = Array, cr = Jo("undefined");
648
648
  function Hr(e) {
649
649
  return e !== null && !cr(e) && e.constructor !== null && !cr(e.constructor) && Et(e.constructor.isBuffer) && e.constructor.isBuffer(e);
650
650
  }
651
- const yc = Qt("ArrayBuffer");
651
+ const yc = en("ArrayBuffer");
652
652
  function Qp(e) {
653
653
  let t;
654
654
  return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && yc(e.buffer), t;
@@ -666,11 +666,11 @@ const em = Jo("string"), Et = Jo("function"), Sc = Jo("number"), Ur = (e) => e !
666
666
  } catch {
667
667
  return !1;
668
668
  }
669
- }, rm = Qt("Date"), om = Qt("File"), sm = Qt("Blob"), im = Qt("FileList"), am = (e) => Ur(e) && Et(e.pipe), lm = (e) => {
669
+ }, rm = en("Date"), om = en("File"), sm = en("Blob"), im = en("FileList"), am = (e) => Ur(e) && Et(e.pipe), lm = (e) => {
670
670
  let t;
671
671
  return e && (typeof FormData == "function" && e instanceof FormData || Et(e.append) && ((t = Xo(e)) === "formdata" || // detect form-data instance
672
672
  t === "object" && Et(e.toString) && e.toString() === "[object FormData]"));
673
- }, cm = Qt("URLSearchParams"), [um, dm, fm, hm] = ["ReadableStream", "Request", "Response", "Headers"].map(Qt), pm = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
673
+ }, cm = en("URLSearchParams"), [um, dm, fm, hm] = ["ReadableStream", "Request", "Response", "Headers"].map(en), pm = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
674
674
  function Wr(e, t, { allOwnKeys: n = !1 } = {}) {
675
675
  if (e === null || typeof e > "u")
676
676
  return;
@@ -750,12 +750,12 @@ const mm = (e, t, n, { allOwnKeys: r } = {}) => (Wr(t, (o, s) => {
750
750
  for (; (n = e.exec(t)) !== null; )
751
751
  r.push(n);
752
752
  return r;
753
- }, Tm = Qt("HTMLFormElement"), Rm = (e) => e.toLowerCase().replace(
753
+ }, Tm = en("HTMLFormElement"), Rm = (e) => e.toLowerCase().replace(
754
754
  /[-_\s]([a-z\d])(\w*)/g,
755
755
  function(n, r, o) {
756
756
  return r.toUpperCase() + o;
757
757
  }
758
- ), Ba = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), km = Qt("RegExp"), Rc = (e, t) => {
758
+ ), Ba = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), km = en("RegExp"), Rc = (e, t) => {
759
759
  const n = Object.getOwnPropertyDescriptors(e), r = {};
760
760
  Wr(n, (o, s) => {
761
761
  let i;
@@ -807,7 +807,7 @@ const jm = (e) => {
807
807
  return r;
808
808
  };
809
809
  return n(e, 0);
810
- }, Pm = Qt("AsyncFunction"), Om = (e) => e && (Ur(e) || Et(e)) && Et(e.then) && Et(e.catch), kc = ((e, t) => e ? setImmediate : t ? ((n, r) => (Mn.addEventListener("message", ({ source: o, data: s }) => {
810
+ }, Pm = en("AsyncFunction"), Om = (e) => e && (Ur(e) || Et(e)) && Et(e.then) && Et(e.catch), kc = ((e, t) => e ? setImmediate : t ? ((n, r) => (Mn.addEventListener("message", ({ source: o, data: s }) => {
811
811
  o === Mn && s === n && r.length && r.shift()();
812
812
  }, !1), (o) => {
813
813
  r.push(o), Mn.postMessage(n, "*");
@@ -848,7 +848,7 @@ const jm = (e) => {
848
848
  inherits: xm,
849
849
  toFlatObject: vm,
850
850
  kindOf: Xo,
851
- kindOfTest: Qt,
851
+ kindOfTest: en,
852
852
  endsWith: wm,
853
853
  toArray: bm,
854
854
  forEachEntry: Sm,
@@ -1876,17 +1876,17 @@ const Lc = (e) => {
1876
1876
  let G;
1877
1877
  try {
1878
1878
  if (C && u && g !== "get" && g !== "head" && (G = await m(E, x)) !== 0) {
1879
- let Z = new n(v, {
1879
+ let J = new n(v, {
1880
1880
  method: "POST",
1881
1881
  body: x,
1882
1882
  duplex: "half"
1883
1883
  }), ee;
1884
- if (A.isFormData(x) && (ee = Z.headers.get("content-type")) && E.setContentType(ee), Z.body) {
1885
- const [M, J] = Ka(
1884
+ if (A.isFormData(x) && (ee = J.headers.get("content-type")) && E.setContentType(ee), J.body) {
1885
+ const [M, Z] = Ka(
1886
1886
  G,
1887
1887
  Io(qa(C))
1888
1888
  );
1889
- x = Ya(Z.body, Xa, M, J);
1889
+ x = Ya(J.body, Xa, M, Z);
1890
1890
  }
1891
1891
  }
1892
1892
  A.isString(N) || (N = N ? "include" : "omit");
@@ -1903,25 +1903,25 @@ const Lc = (e) => {
1903
1903
  let D = await (s ? I(V, _) : I(v, K));
1904
1904
  const O = d && (k === "stream" || k === "response");
1905
1905
  if (d && (S || O && P)) {
1906
- const Z = {};
1906
+ const J = {};
1907
1907
  ["status", "statusText", "headers"].forEach((Re) => {
1908
- Z[Re] = D[Re];
1908
+ J[Re] = D[Re];
1909
1909
  });
1910
- const ee = A.toFiniteNumber(D.headers.get("content-length")), [M, J] = S && Ka(
1910
+ const ee = A.toFiniteNumber(D.headers.get("content-length")), [M, Z] = S && Ka(
1911
1911
  ee,
1912
1912
  Io(qa(S), !0)
1913
1913
  ) || [];
1914
1914
  D = new r(
1915
1915
  Ya(D.body, Xa, M, () => {
1916
- J && J(), P && P();
1916
+ Z && Z(), P && P();
1917
1917
  }),
1918
- Z
1918
+ J
1919
1919
  );
1920
1920
  }
1921
1921
  k = k || "text";
1922
1922
  let ie = await f[A.findKey(f, k) || "text"](D, b);
1923
- return !O && P && P(), await new Promise((Z, ee) => {
1924
- Mc(Z, ee, {
1923
+ return !O && P && P(), await new Promise((J, ee) => {
1924
+ Mc(J, ee, {
1925
1925
  data: ie,
1926
1926
  headers: It.from(D.headers),
1927
1927
  status: D.status,
@@ -2398,41 +2398,41 @@ function sl(e) {
2398
2398
  function Eg(e) {
2399
2399
  return ui.add(e), () => ui.delete(e);
2400
2400
  }
2401
- const Vt = it.create({
2401
+ const Kt = it.create({
2402
2402
  // Only set baseURL when configured — do NOT fall back to localhost. Falling back causes
2403
2403
  // noisy network requests to the frontend Dev server when the backend isn't configured.
2404
2404
  ...ol ? { baseURL: ol } : {},
2405
2405
  timeout: 3e4,
2406
2406
  withCredentials: !0
2407
2407
  });
2408
- Vt.interceptors.request.use((e) => (No && (e.headers.Authorization = `Bearer ${No}`), e));
2409
- Vt.interceptors.response.use(
2408
+ Kt.interceptors.request.use((e) => (No && (e.headers.Authorization = `Bearer ${No}`), e));
2409
+ Kt.interceptors.response.use(
2410
2410
  (e) => e,
2411
2411
  (e) => Promise.reject(e)
2412
2412
  );
2413
- async function Bt(e, t) {
2414
- return Vt.defaults.baseURL ? (await Vt.get(e, t)).data : Promise.reject(new Error("API base URL is not configured"));
2413
+ async function Ht(e, t) {
2414
+ return Kt.defaults.baseURL ? (await Kt.get(e, t)).data : Promise.reject(new Error("API base URL is not configured"));
2415
2415
  }
2416
2416
  async function Ig(e, t, n) {
2417
- return Vt.defaults.baseURL ? (await Vt.post(e, t, n)).data : Promise.reject(new Error("API base URL is not configured"));
2417
+ return Kt.defaults.baseURL ? (await Kt.post(e, t, n)).data : Promise.reject(new Error("API base URL is not configured"));
2418
2418
  }
2419
2419
  async function Ng(e, t, n) {
2420
- return Vt.defaults.baseURL ? (await Vt.put(e, t, n)).data : Promise.reject(new Error("API base URL is not configured"));
2420
+ return Kt.defaults.baseURL ? (await Kt.put(e, t, n)).data : Promise.reject(new Error("API base URL is not configured"));
2421
2421
  }
2422
2422
  async function Ag(e, t) {
2423
- return Vt.defaults.baseURL ? (await Vt.delete(e, t)).data : Promise.reject(new Error("API base URL is not configured"));
2423
+ return Kt.defaults.baseURL ? (await Kt.delete(e, t)).data : Promise.reject(new Error("API base URL is not configured"));
2424
2424
  }
2425
- function Ft(e) {
2425
+ function zt(e) {
2426
2426
  return e && typeof e == "object" && "data" in e ? e.data : e;
2427
2427
  }
2428
2428
  class _g {
2429
2429
  // ---- Configuration ----
2430
2430
  get baseUrl() {
2431
- const t = Vt.defaults.baseURL || "";
2431
+ const t = Kt.defaults.baseURL || "";
2432
2432
  return String(t).replace(/\/+$|^\s+|\s+$/g, "");
2433
2433
  }
2434
2434
  updateConfig(t) {
2435
- t.baseUrl && (Vt.defaults.baseURL = String(t.baseUrl).replace(/\/+$/g, "")), t.authToken !== void 0 && sl(t.authToken);
2435
+ t.baseUrl && (Kt.defaults.baseURL = String(t.baseUrl).replace(/\/+$/g, "")), t.authToken !== void 0 && sl(t.authToken);
2436
2436
  }
2437
2437
  // ---- Token Management ----
2438
2438
  getAuthToken() {
@@ -2446,41 +2446,41 @@ class _g {
2446
2446
  }
2447
2447
  // ---- Thread Management ----
2448
2448
  async listThreads() {
2449
- const t = await Bt("/chat/threads"), n = Ft(t);
2449
+ const t = await Ht("/chat/threads"), n = zt(t);
2450
2450
  return (n == null ? void 0 : n.items) ?? (t == null ? void 0 : t.items) ?? [];
2451
2451
  }
2452
2452
  async createThread(t) {
2453
2453
  const r = await Ig("/chat/threads", t ? { title: t } : void 0);
2454
- return Ft(r);
2454
+ return zt(r);
2455
2455
  }
2456
2456
  async updateThread(t, n) {
2457
2457
  const r = await Ng(`/chat/threads/${t}`, { title: n });
2458
- return Ft(r);
2458
+ return zt(r);
2459
2459
  }
2460
2460
  async deleteThread(t) {
2461
2461
  const n = await Ag(`/chat/threads/${t}`);
2462
- return Ft(n);
2462
+ return zt(n);
2463
2463
  }
2464
2464
  async threadInfo(t) {
2465
- const n = await Bt(`/chat/threads/${t}/info`);
2466
- return Ft(n);
2465
+ const n = await Ht(`/chat/threads/${t}/info`);
2466
+ return zt(n);
2467
2467
  }
2468
2468
  // ---- Agents ----
2469
2469
  async listAgents() {
2470
- const t = await Bt("/chat/agents"), n = Ft(t);
2470
+ const t = await Ht("/chat/agents"), n = zt(t);
2471
2471
  return (n == null ? void 0 : n.items) ?? [];
2472
2472
  }
2473
2473
  async getAgent(t) {
2474
- const n = await Bt(`/chat/agents/${t}`);
2475
- return Ft(n);
2474
+ const n = await Ht(`/chat/agents/${t}`);
2475
+ return zt(n);
2476
2476
  }
2477
2477
  async getAgentSchema(t) {
2478
- const n = await Bt(`/chat/agents/${t}/schema`);
2479
- return Ft(n);
2478
+ const n = await Ht(`/chat/agents/${t}/schema`);
2479
+ return zt(n);
2480
2480
  }
2481
2481
  // ---- Messages & State ----
2482
2482
  async getMessages(t) {
2483
- const n = await Bt(`/chat/threads/${t.threadId}/messages`, {
2483
+ const n = await Ht(`/chat/threads/${t.threadId}/messages`, {
2484
2484
  params: {
2485
2485
  thread_id: t.threadId,
2486
2486
  checkpoint_id: t.checkpointId,
@@ -2489,34 +2489,34 @@ class _g {
2489
2489
  before_id: t.beforeId ?? void 0
2490
2490
  }
2491
2491
  });
2492
- return Ft(n);
2492
+ return zt(n);
2493
2493
  }
2494
2494
  async getState(t) {
2495
- const n = await Bt(`/chat/threads/${t.threadId}/state`, {
2495
+ const n = await Ht(`/chat/threads/${t.threadId}/state`, {
2496
2496
  params: {
2497
2497
  thread_id: t.threadId,
2498
2498
  checkpoint_id: t.checkpointId,
2499
2499
  checkpoint_ns: t.checkpointNs
2500
2500
  }
2501
2501
  });
2502
- return Ft(n);
2502
+ return zt(n);
2503
2503
  }
2504
2504
  async getStateHistory(t) {
2505
- const n = await Bt(`/chat/threads/${t.threadId}/state/history`, {
2505
+ const n = await Ht(`/chat/threads/${t.threadId}/state/history`, {
2506
2506
  params: {
2507
2507
  thread_id: t.threadId,
2508
2508
  checkpoint_id: t.checkpointId,
2509
2509
  checkpoint_ns: t.checkpointNs
2510
2510
  }
2511
2511
  });
2512
- return Ft(n);
2512
+ return zt(n);
2513
2513
  }
2514
2514
  // ---- Checkpoints ----
2515
2515
  async listCheckpoints(t) {
2516
- const n = await Bt(`/chat/threads/${t}/checkpoints`, {
2516
+ const n = await Ht(`/chat/threads/${t}/checkpoints`, {
2517
2517
  params: { thread_id: t }
2518
2518
  });
2519
- return Ft(n);
2519
+ return zt(n);
2520
2520
  }
2521
2521
  }
2522
2522
  const zn = new _g();
@@ -2533,15 +2533,15 @@ function jg(e = {}) {
2533
2533
  w.current && (w.current.abort(), w.current = null), a(!0), u(null), e.autoAppendAssistant !== !1 && f("");
2534
2534
  const F = new AbortController();
2535
2535
  return w.current = F, (async () => {
2536
- var P, G, W, K, D, O, ie, Z;
2536
+ var P, G, W, K, D, O, ie, J;
2537
2537
  const V = (ee) => {
2538
2538
  var M;
2539
2539
  try {
2540
- const J = JSON.parse(JSON.stringify(ee));
2541
- return (M = J == null ? void 0 : J.payload) != null && M.files_info && Array.isArray(J.payload.files_info) && (J.payload.files_info = J.payload.files_info.map((Re) => ({
2540
+ const Z = JSON.parse(JSON.stringify(ee));
2541
+ return (M = Z == null ? void 0 : Z.payload) != null && M.files_info && Array.isArray(Z.payload.files_info) && (Z.payload.files_info = Z.payload.files_info.map((Re) => ({
2542
2542
  ...Re,
2543
2543
  data: Re != null && Re.data ? `<base64 ${String(Re.data).length} chars>` : Re == null ? void 0 : Re.data
2544
- }))), J;
2544
+ }))), Z;
2545
2545
  } catch {
2546
2546
  return ee;
2547
2547
  }
@@ -2591,7 +2591,7 @@ function jg(e = {}) {
2591
2591
  );
2592
2592
  }
2593
2593
  x(!0);
2594
- const J = M.body.getReader(), Re = new TextDecoder();
2594
+ const Z = M.body.getReader(), Re = new TextDecoder();
2595
2595
  let fe = "", L = [], j = R.current, H = null;
2596
2596
  const Q = () => {
2597
2597
  if (L.length) {
@@ -2613,7 +2613,7 @@ function jg(e = {}) {
2613
2613
  try {
2614
2614
  const ve = M.headers.get("X-Thread-Id") || M.headers.get("x-thread-id"), ke = M.headers.get("X-Thread-Created") || M.headers.get("x-thread-created"), Be = ve ?? null, Ze = String(ke ?? "").toLowerCase() === "true";
2615
2615
  for ((K = I == null ? void 0 : I.onOpen) == null || K.call(I, { threadId: Be, created: Ze }); ; ) {
2616
- const { value: qe, done: dt } = await J.read();
2616
+ const { value: qe, done: dt } = await Z.read();
2617
2617
  if (dt) break;
2618
2618
  fe += Re.decode(qe, { stream: !0 }), fe.length > De && (fe = "", console.warn("Stream buffer reset: exceeded 1MB"));
2619
2619
  let ft;
@@ -2655,17 +2655,17 @@ function jg(e = {}) {
2655
2655
  }
2656
2656
  } finally {
2657
2657
  try {
2658
- await J.cancel();
2658
+ await Z.cancel();
2659
2659
  } catch {
2660
2660
  } finally {
2661
- (ie = J.releaseLock) == null || ie.call(J);
2661
+ (ie = Z.releaseLock) == null || ie.call(Z);
2662
2662
  }
2663
2663
  H !== null && typeof window < "u" && window.cancelAnimationFrame(H), clearInterval($e), a(!1), x(!1), w.current = null;
2664
2664
  }
2665
2665
  } catch (ee) {
2666
2666
  if (ee.name !== "AbortError") {
2667
2667
  const M = ee.message || String(ee);
2668
- u(M), (Z = I == null ? void 0 : I.onError) == null || Z.call(I, M);
2668
+ u(M), (J = I == null ? void 0 : I.onError) == null || J.call(I, M);
2669
2669
  }
2670
2670
  } finally {
2671
2671
  a(!1), x(!1), w.current = null;
@@ -2783,7 +2783,7 @@ function Lg(e = []) {
2783
2783
  ct(() => () => {
2784
2784
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
2785
2785
  }, []);
2786
- const u = Gt(() => ({
2786
+ const u = Yt(() => ({
2787
2787
  reset: (d) => n({ type: "reset", payload: { messages: d } }),
2788
2788
  seed: (d, f) => n({ type: "seed", payload: { messages: d, ...f ?? {} } }),
2789
2789
  prepend: (d) => n({ type: "prepend", payload: { messages: d } }),
@@ -3001,7 +3001,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3001
3001
  }, [u, b]);
3002
3002
  const x = Ye(($) => {
3003
3003
  u.setAuthToken($);
3004
- }, [u]), { state: w, seed: y, prepend: R, pushUser: S, onEvent: C, reset: k } = Lg(), E = 20, [N, _] = me(!1), [I, F] = me(!1), [V, P] = me(null), [G, W] = me(void 0), [K, D] = me(void 0), O = rt(!1), ie = rt([]), Z = rt(null), ee = Ye(($) => {
3004
+ }, [u]), { state: w, seed: y, prepend: R, pushUser: S, onEvent: C, reset: k } = Lg(), E = 20, [N, _] = me(!1), [I, F] = me(!1), [V, P] = me(null), [G, W] = me(void 0), [K, D] = me(void 0), O = rt(!1), ie = rt([]), J = rt(null), ee = Ye(($) => {
3005
3005
  $.cursor !== void 0 && P($.cursor), $.hasMore !== void 0 && _($.hasMore), $.checkpointId !== void 0 && W($.checkpointId), $.checkpointNs !== void 0 && D($.checkpointNs);
3006
3006
  }, []), M = Ye(($, Y) => new Promise((Ae, tt) => {
3007
3007
  const Ne = async () => {
@@ -3024,7 +3024,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3024
3024
  O.current ? (ie.current.push(Ne), console.log(`[ChatProvider] Queued operation: ${Y}`)) : Ne().catch((at) => {
3025
3025
  tt(at);
3026
3026
  });
3027
- }), []), J = Ye(
3027
+ }), []), Z = Ye(
3028
3028
  ($, Y) => {
3029
3029
  const Ae = Array.isArray($ == null ? void 0 : $.messages) ? $.messages : [];
3030
3030
  Y === "replace" ? (console.log("[ChatProvider] Replacing messages, count:", Ae.length), y(Ae, {
@@ -3047,7 +3047,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3047
3047
  // root
3048
3048
  "/api/v2/health",
3049
3049
  "/api/v2/chat/health"
3050
- ], Dt = async (xt) => {
3050
+ ], Lt = async (xt) => {
3051
3051
  try {
3052
3052
  const At = new AbortController(), ht = setTimeout(() => At.abort(), tt), Rt = await fetch(xt, { method: "GET", signal: At.signal });
3053
3053
  return clearTimeout(ht), Rt.ok;
@@ -3068,7 +3068,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3068
3068
  let Rt = ht;
3069
3069
  Ne.endsWith("/api") && ht.startsWith("/api") && (Rt = ht.replace(/^\/api/, "") || "/");
3070
3070
  const te = Rt === "/" ? Ne + "/" : Ne + Rt;
3071
- if (console.debug(`[ChatProvider] checking ${te}`), await Dt(te) || ht === "/" && await _n(Ne + "/"))
3071
+ if (console.debug(`[ChatProvider] checking ${te}`), await Lt(te) || ht === "/" && await _n(Ne + "/"))
3072
3072
  return le(!0), !0;
3073
3073
  }
3074
3074
  const At = Ae * Math.pow(2, xt);
@@ -3116,8 +3116,8 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3116
3116
  const De = rt(null), ve = rt(null), ke = Ye(
3117
3117
  async ($, Y, Ae) => {
3118
3118
  await M(async () => {
3119
- if (Z.current === $) {
3120
- console.log(`[ChatProvider] Skipping auto-load for thread ${$} - suppressed after clear`), Z.current = null;
3119
+ if (J.current === $) {
3120
+ console.log(`[ChatProvider] Skipping auto-load for thread ${$} - suppressed after clear`), J.current = null;
3121
3121
  return;
3122
3122
  }
3123
3123
  if (!u.baseUrl) {
@@ -3145,7 +3145,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3145
3145
  console.log("[ChatProvider] Loading thread with", at.length, "messages"), y(at, {
3146
3146
  checkpointId: (Ne == null ? void 0 : Ne.checkpointId) ?? null,
3147
3147
  checkpointNs: (Ne == null ? void 0 : Ne.checkpointNs) ?? null
3148
- }), P((Ne == null ? void 0 : Ne.nextCursor) ?? null), _(!!(Ne != null && Ne.hasMore)), W((Dt) => (Ne == null ? void 0 : Ne.checkpointId) ?? Dt ?? void 0), D((Dt) => (Ne == null ? void 0 : Ne.checkpointNs) ?? Dt ?? void 0);
3148
+ }), P((Ne == null ? void 0 : Ne.nextCursor) ?? null), _(!!(Ne != null && Ne.hasMore)), W((Lt) => (Ne == null ? void 0 : Ne.checkpointId) ?? Lt ?? void 0), D((Lt) => (Ne == null ? void 0 : Ne.checkpointNs) ?? Lt ?? void 0);
3149
3149
  } finally {
3150
3150
  De.current = null;
3151
3151
  }
@@ -3170,9 +3170,9 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3170
3170
  checkpointNs: Y ?? void 0,
3171
3171
  limit: E
3172
3172
  });
3173
- J(Ae, "replace");
3173
+ Z(Ae, "replace");
3174
3174
  }, `navigateToCheckpoint-${$}`);
3175
- }, [u, L, J, M, ee]), qe = Ye(async () => {
3175
+ }, [u, L, Z, M, ee]), qe = Ye(async () => {
3176
3176
  if (!L) throw new Error("No active thread");
3177
3177
  await ke(L);
3178
3178
  }, [L, ke]), dt = rt(!1);
@@ -3185,9 +3185,9 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3185
3185
  console.warn("[ChatProvider] Post-streaming thread refresh failed:", Y);
3186
3186
  }
3187
3187
  }, "postStreamingRefresh");
3188
- }, [d, L, u, J, H, M]);
3188
+ }, [d, L, u, Z, H, M]);
3189
3189
  const ft = Ye(async () => {
3190
- console.log("[ChatProvider] 🔄 clearCurrentThread called"), console.log("[ChatProvider] 📊 Before clear - currentThreadId:", L), console.log("[ChatProvider] 📊 Before clear - messages count:", w.messages.length), L && (Z.current = L, console.log(`[ChatProvider] 🚫 Suppressing next auto-load for thread: ${L}`)), await M(() => (console.log("[ChatProvider] 🚀 Executing atomic clear operation"), j(null), k([]), ee({
3190
+ console.log("[ChatProvider] 🔄 clearCurrentThread called"), console.log("[ChatProvider] 📊 Before clear - currentThreadId:", L), console.log("[ChatProvider] 📊 Before clear - messages count:", w.messages.length), L && (J.current = L, console.log(`[ChatProvider] 🚫 Suppressing next auto-load for thread: ${L}`)), await M(() => (console.log("[ChatProvider] 🚀 Executing atomic clear operation"), j(null), k([]), ee({
3191
3191
  cursor: null,
3192
3192
  hasMore: !1,
3193
3193
  checkpointId: void 0,
@@ -3209,7 +3209,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3209
3209
  t == null ? void 0 : t.uploadPath
3210
3210
  ), at = [];
3211
3211
  $ && $.trim() && at.push({ type: "text", text: $.trim() });
3212
- const Dt = {
3212
+ const Lt = {
3213
3213
  id: ((je = crypto.randomUUID) == null ? void 0 : je.call(crypto)) || `user-${Date.now()}`,
3214
3214
  role: "user",
3215
3215
  content: at,
@@ -3217,9 +3217,9 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3217
3217
  checkpointId: (Y == null ? void 0 : Y.checkpointId) ?? w.lastCheckpointId ?? void 0,
3218
3218
  checkpointNs: (Y == null ? void 0 : Y.checkpointNs) ?? w.lastCheckpointNs ?? void 0
3219
3219
  };
3220
- S(Dt);
3220
+ S(Lt);
3221
3221
  const _n = {
3222
- ...Dt,
3222
+ ...Lt,
3223
3223
  content: at
3224
3224
  }, xt = { ...(Y == null ? void 0 : Y.payloadExtras) ?? {} }, At = !!xt.edit, ht = xt.originalMessageId, Rt = typeof ht == "string" ? ht : void 0, te = Ae && Ae.length > 0, pe = {
3225
3225
  ...L ? { threadId: L } : {},
@@ -3238,16 +3238,19 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3238
3238
  };
3239
3239
  h(
3240
3240
  pe,
3241
- (ze) => C(ze),
3241
+ (Fe) => C(Fe),
3242
3242
  {
3243
- onError: (ze) => console.warn("stream error", ze),
3244
- onOpen: ({ threadId: ze, created: Lt }) => {
3245
- !L && ze && (j(ze), Lt && H().catch(() => {
3246
- }));
3243
+ onError: (Fe) => console.warn("stream error", Fe),
3244
+ onOpen: ({ threadId: Fe, created: $t }) => {
3245
+ if (!L && Fe) {
3246
+ const _t = w.messages.length <= 1;
3247
+ _t && (J.current = Fe), j(Fe), ($t || _t) && H().catch(() => {
3248
+ });
3249
+ }
3247
3250
  }
3248
3251
  }
3249
3252
  );
3250
- }, [L, S, h, C, w.lastCheckpointId, w.lastCheckpointNs, u, t == null ? void 0 : t.uploadPath, H, j, a, c]), Pe = Ye(
3253
+ }, [L, S, h, C, w.lastCheckpointId, w.lastCheckpointNs, u, t == null ? void 0 : t.uploadPath, H, j, a, c, w.messages.length]), Pe = Ye(
3251
3254
  async ($) => {
3252
3255
  if (!L) throw new Error("No active thread");
3253
3256
  if (I || !N) return;
@@ -3262,13 +3265,13 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3262
3265
  limit: ($ == null ? void 0 : $.limit) ?? E,
3263
3266
  beforeId: Y
3264
3267
  });
3265
- J(Ae, "prepend");
3268
+ Z(Ae, "prepend");
3266
3269
  } finally {
3267
3270
  F(!1);
3268
3271
  }
3269
3272
  }
3270
3273
  },
3271
- [u, L, G, K, V, N, I, J, E]
3274
+ [u, L, G, K, V, N, I, Z, E]
3272
3275
  ), Ue = {
3273
3276
  baseUrl: u.baseUrl,
3274
3277
  token: v,
@@ -3504,7 +3507,7 @@ function st(e) {
3504
3507
  function de(e, t) {
3505
3508
  return Ke(e, Xg(t, es));
3506
3509
  }
3507
- function Yt(e, t) {
3510
+ function Xt(e, t) {
3508
3511
  const n = e(kn, (r) => {
3509
3512
  n(), t(r);
3510
3513
  });
@@ -3644,7 +3647,7 @@ function Le() {
3644
3647
  }
3645
3648
  };
3646
3649
  }
3647
- function Pt(e) {
3650
+ function Ot(e) {
3648
3651
  return ts(Le(), (t) => de(e, t));
3649
3652
  }
3650
3653
  function He(e, t = [], { singleton: n } = { singleton: !0 }) {
@@ -3891,19 +3894,19 @@ function Pr(e, t) {
3891
3894
  if (!Xe(e))
3892
3895
  return t === e.k ? e.v : t < e.k ? Pr(e.l, t) : Pr(e.r, t);
3893
3896
  }
3894
- function Xt(e, t, n = "k") {
3897
+ function Jt(e, t, n = "k") {
3895
3898
  if (Xe(e))
3896
3899
  return [-1 / 0, void 0];
3897
3900
  if (Number(e[n]) === t)
3898
3901
  return [e.k, e.v];
3899
3902
  if (Number(e[n]) < t) {
3900
- const r = Xt(e.r, t, n);
3903
+ const r = Jt(e.r, t, n);
3901
3904
  return r[0] === -1 / 0 ? [e.k, e.v] : r;
3902
3905
  }
3903
- return Xt(e.l, t, n);
3906
+ return Jt(e.l, t, n);
3904
3907
  }
3905
- function jt(e, t, n) {
3906
- return Xe(e) ? Qc(t, n, 1) : t === e.k ? pt(e, { k: t, v: n }) : t < e.k ? fl(pt(e, { l: jt(e.l, t, n) })) : fl(pt(e, { r: jt(e.r, t, n) }));
3908
+ function Pt(e, t, n) {
3909
+ return Xe(e) ? Qc(t, n, 1) : t === e.k ? pt(e, { k: t, v: n }) : t < e.k ? fl(pt(e, { l: Pt(e.l, t, n) })) : fl(pt(e, { r: Pt(e.r, t, n) }));
3907
3910
  }
3908
3911
  function or() {
3909
3912
  return jr;
@@ -3911,7 +3914,7 @@ function or() {
3911
3914
  function ns(e, t, n) {
3912
3915
  if (Xe(e))
3913
3916
  return [];
3914
- const r = Xt(e, t)[0];
3917
+ const r = Jt(e, t)[0];
3915
3918
  return ax(hi(e, r, n));
3916
3919
  }
3917
3920
  function fi(e, t) {
@@ -4068,7 +4071,7 @@ function ux(e, t) {
4068
4071
  for (const r of t) {
4069
4072
  const { endIndex: o, size: s, startIndex: i } = r;
4070
4073
  if (n = Math.min(n, i), Xe(e)) {
4071
- e = jt(e, 0, s);
4074
+ e = Pt(e, 0, s);
4072
4075
  continue;
4073
4076
  }
4074
4077
  const a = ns(e, i - 1, o + 1);
@@ -4076,8 +4079,8 @@ function ux(e, t) {
4076
4079
  continue;
4077
4080
  let c = !1, u = !1;
4078
4081
  for (const { end: d, start: f, value: h } of a)
4079
- c ? (o >= f || s === h) && (e = fi(e, f)) : (u = h !== s, c = !0), d > o && o >= f && h !== s && (e = jt(e, o + 1, h));
4080
- u && (e = jt(e, i, s));
4082
+ c ? (o >= f || s === h) && (e = fi(e, f)) : (u = h !== s, c = !0), d > o && o >= f && h !== s && (e = Pt(e, o + 1, h));
4083
+ u && (e = Pt(e, i, s));
4081
4084
  }
4082
4085
  return [e, n];
4083
4086
  }
@@ -4119,7 +4122,7 @@ function px(e, [t, n, r, o]) {
4119
4122
  let i = s, a = 0;
4120
4123
  if (n.length > 0 && Xe(s) && t.length === 2) {
4121
4124
  const h = t[0].size, m = t[1].size;
4122
- i = n.reduce((b, v) => jt(jt(b, v, h), v + 1, m), i);
4125
+ i = n.reduce((b, v) => Pt(Pt(b, v, h), v + 1, m), i);
4123
4126
  } else
4124
4127
  [i, a] = ux(i, t);
4125
4128
  if (i === s)
@@ -4127,7 +4130,7 @@ function px(e, [t, n, r, o]) {
4127
4130
  const { lastIndex: c, lastOffset: u, lastSize: d, offsetTree: f } = mi(e.offsetTree, a, i, o);
4128
4131
  return {
4129
4132
  groupIndices: n,
4130
- groupOffsetTree: n.reduce((h, m) => jt(h, m, Mr(m, f, o)), or()),
4133
+ groupOffsetTree: n.reduce((h, m) => Pt(h, m, Mr(m, f, o)), or()),
4131
4134
  lastIndex: c,
4132
4135
  lastOffset: u,
4133
4136
  lastSize: d,
@@ -4151,8 +4154,8 @@ function mi(e, t, n, r) {
4151
4154
  let o = e, s = 0, i = 0, a = 0, c = 0;
4152
4155
  if (t !== 0) {
4153
4156
  c = Ao(o, t - 1, Wi), a = o[c].offset;
4154
- const u = Xt(n, t - 1);
4155
- s = u[0], i = u[1], o.length && o[c].size === Xt(n, t)[1] && (c -= 1), o = o.slice(0, c + 1);
4157
+ const u = Jt(n, t - 1);
4158
+ s = u[0], i = u[1], o.length && o[c].size === Jt(n, t)[1] && (c -= 1), o = o.slice(0, c + 1);
4156
4159
  } else
4157
4160
  o = [];
4158
4161
  for (const { start: u, value: d } of ns(n, t, 1 / 0)) {
@@ -4203,7 +4206,7 @@ const vx = {
4203
4206
  be((S) => S.length > 0),
4204
4207
  _e(v, m),
4205
4208
  re(([S, C, k]) => {
4206
- const E = S.reduce((N, _, I) => jt(N, _, Mr(_, C.offsetTree, k) || I), or());
4209
+ const E = S.reduce((N, _, I) => Pt(N, _, Mr(_, C.offsetTree, k) || I), or());
4207
4210
  return {
4208
4211
  ...C,
4209
4212
  groupIndices: S,
@@ -4242,7 +4245,7 @@ const vx = {
4242
4245
  ),
4243
4246
  n
4244
4247
  );
4245
- const w = Pt(
4248
+ const w = Ot(
4246
4249
  z(
4247
4250
  n,
4248
4251
  _e(v),
@@ -4281,7 +4284,7 @@ const vx = {
4281
4284
  Nt.ERROR
4282
4285
  );
4283
4286
  });
4284
- const y = Pt(s);
4287
+ const y = Ot(s);
4285
4288
  de(
4286
4289
  z(
4287
4290
  s,
@@ -4343,7 +4346,7 @@ const vx = {
4343
4346
  ),
4344
4347
  n
4345
4348
  );
4346
- const R = Pt(
4349
+ const R = Ot(
4347
4350
  z(
4348
4351
  i,
4349
4352
  _e(v, m),
@@ -4369,11 +4372,11 @@ const vx = {
4369
4372
  const V = N[I + 1] - F - 1;
4370
4373
  I++, _ += V + 1;
4371
4374
  }
4372
- if (E = Dn(C.sizeTree).reduce((V, { k: P, v: G }) => jt(V, Math.max(0, P + S), G), E), _ !== -S) {
4375
+ if (E = Dn(C.sizeTree).reduce((V, { k: P, v: G }) => Pt(V, Math.max(0, P + S), G), E), _ !== -S) {
4373
4376
  const V = Pr(C.sizeTree, F);
4374
- E = jt(E, 0, V);
4375
- const P = Xt(C.sizeTree, -S + 1)[1];
4376
- E = jt(E, 1, P);
4377
+ E = Pt(E, 0, V);
4378
+ const P = Jt(C.sizeTree, -S + 1)[1];
4379
+ E = Pt(E, 1, P);
4377
4380
  }
4378
4381
  return {
4379
4382
  ...C,
@@ -4381,7 +4384,7 @@ const vx = {
4381
4384
  ...mi(C.offsetTree, 0, E, k)
4382
4385
  };
4383
4386
  } else {
4384
- const E = Dn(C.sizeTree).reduce((N, { k: _, v: I }) => jt(N, Math.max(0, _ + S), I), or());
4387
+ const E = Dn(C.sizeTree).reduce((N, { k: _, v: I }) => Pt(N, Math.max(0, _ + S), I), or());
4385
4388
  return {
4386
4389
  ...C,
4387
4390
  sizeTree: E,
@@ -4427,7 +4430,7 @@ function wx(e) {
4427
4430
  }
4428
4431
  const su = He(
4429
4432
  ([{ groupIndices: e, sizes: t, totalCount: n }, { headerHeight: r, scrollTop: o }]) => {
4430
- const s = Le(), i = Le(), a = Pt(z(s, re(wx)));
4433
+ const s = Le(), i = Le(), a = Ot(z(s, re(wx)));
4431
4434
  return de(
4432
4435
  z(
4433
4436
  a,
@@ -4444,7 +4447,7 @@ const su = He(
4444
4447
  z(
4445
4448
  ut(o, t, r),
4446
4449
  be(([c, u]) => rs(u)),
4447
- re(([c, u, d]) => Xt(u.groupOffsetTree, Math.max(c - d, 0), "v")[0]),
4450
+ re(([c, u, d]) => Jt(u.groupOffsetTree, Math.max(c - d, 0), "v")[0]),
4448
4451
  Qe(),
4449
4452
  re((c) => [c])
4450
4453
  ),
@@ -4454,7 +4457,7 @@ const su = He(
4454
4457
  et(dn, Ct)
4455
4458
  ), In = He(
4456
4459
  ([{ log: e }]) => {
4457
- const t = q(!1), n = Pt(
4460
+ const t = q(!1), n = Ot(
4458
4461
  z(
4459
4462
  t,
4460
4463
  be((r) => r),
@@ -4505,23 +4508,23 @@ const Kr = He(
4505
4508
  P
4506
4509
  ]) => {
4507
4510
  const G = iu(R), { align: W, behavior: K, offset: D } = G, O = k - 1, ie = ou(G, S, O);
4508
- let Z = Mr(ie, S.offsetTree, F) + N;
4509
- W === "end" ? (Z += V + Xt(S.sizeTree, ie)[1] - C + P, ie === O && (Z += _)) : W === "center" ? Z += (V + Xt(S.sizeTree, ie)[1] - C + P) / 2 : Z -= E, D && (Z += D);
4511
+ let J = Mr(ie, S.offsetTree, F) + N;
4512
+ W === "end" ? (J += V + Jt(S.sizeTree, ie)[1] - C + P, ie === O && (J += _)) : W === "center" ? J += (V + Jt(S.sizeTree, ie)[1] - C + P) / 2 : J -= E, D && (J += D);
4510
4513
  const ee = (M) => {
4511
4514
  y(), M ? (I("retrying to scroll to", { location: R }, Nt.DEBUG), Ie(m, R)) : (Ie(b, !0), I("list did not change, scroll successful", {}, Nt.DEBUG));
4512
4515
  };
4513
4516
  if (y(), K === "smooth") {
4514
4517
  let M = !1;
4515
- w = Ke(t, (J) => {
4516
- M = M || J;
4517
- }), g = Yt(d, () => {
4518
+ w = Ke(t, (Z) => {
4519
+ M = M || Z;
4520
+ }), g = Xt(d, () => {
4518
4521
  ee(M);
4519
4522
  });
4520
4523
  } else
4521
- g = Yt(z(t, yx(150)), ee);
4524
+ g = Xt(z(t, yx(150)), ee);
4522
4525
  return x = setTimeout(() => {
4523
4526
  y();
4524
- }, 1200), Ie(c, !0), I("scrolling from index to", { behavior: K, index: ie, top: Z }, Nt.DEBUG), { behavior: K, top: Z };
4527
+ }, 1200), Ie(c, !0), I("scrolling from index to", { behavior: K, index: ie, top: J }, Nt.DEBUG), { behavior: K, top: J };
4525
4528
  }
4526
4529
  )
4527
4530
  ),
@@ -4581,10 +4584,10 @@ const qr = He(
4581
4584
  _e(c)
4582
4585
  ),
4583
4586
  ([, d]) => {
4584
- Yt(o, () => {
4587
+ Xt(o, () => {
4585
4588
  Ie(u, !0);
4586
4589
  }), Vi(4, () => {
4587
- Yt(r, () => {
4590
+ Xt(r, () => {
4588
4591
  Ie(a, !0);
4589
4592
  }), Ie(s, d);
4590
4593
  });
@@ -4629,7 +4632,7 @@ const Dr = "up", Nr = "down", Sx = "none", Cx = {
4629
4632
  ),
4630
4633
  a
4631
4634
  ), de(z(a, gn(50)), u);
4632
- const b = Pt(
4635
+ const b = Ot(
4633
4636
  z(
4634
4637
  ut(r, we(s), we(t), we(e), we(d)),
4635
4638
  sn((w, [{ scrollHeight: y, scrollTop: R }, S, C, k, E]) => {
@@ -4808,7 +4811,7 @@ function Rx(e, t, n) {
4808
4811
  if (rs(t)) {
4809
4812
  const r = ru(e, t);
4810
4813
  return [
4811
- { index: Xt(t.groupOffsetTree, r)[0], offset: 0, size: 0 },
4814
+ { index: Jt(t.groupOffsetTree, r)[0], offset: 0, size: 0 },
4812
4815
  { data: n == null ? void 0 : n[0], index: r, offset: 0, size: 0 }
4813
4816
  ];
4814
4817
  }
@@ -4960,10 +4963,10 @@ const Gn = He(
4960
4963
  }
4961
4964
  if (!I)
4962
4965
  return mo([], ie, E, P, W, V);
4963
- const Z = F.length > 0 ? F[F.length - 1] + 1 : 0, ee = hx(K, C, k, Z);
4966
+ const J = F.length > 0 ? F[F.length - 1] + 1 : 0, ee = hx(K, C, k, J);
4964
4967
  if (ee.length === 0)
4965
4968
  return null;
4966
- const M = E - 1, J = ts([], (Re) => {
4969
+ const M = E - 1, Z = ts([], (Re) => {
4967
4970
  for (const fe of ee) {
4968
4971
  const L = fe.value;
4969
4972
  let j = L.offset, H = fe.start;
@@ -4973,13 +4976,13 @@ const Gn = He(
4973
4976
  const oe = H - fe.start;
4974
4977
  j += oe * Q + oe * P;
4975
4978
  }
4976
- H < Z && (j += (Z - H) * Q, H = Z);
4979
+ H < J && (j += (J - H) * Q, H = J);
4977
4980
  const le = Math.min(fe.end, M);
4978
4981
  for (let oe = H; oe <= le && !(j >= k); oe++)
4979
4982
  Re.push({ data: G == null ? void 0 : G[oe], index: oe, offset: j, size: Q }), j += Q + P;
4980
4983
  }
4981
4984
  });
4982
- return mo(J, ie, E, P, W, V);
4985
+ return mo(Z, ie, E, P, W, V);
4983
4986
  }
4984
4987
  ),
4985
4988
  //@ts-expect-error filter needs to be fixed
@@ -5014,7 +5017,7 @@ const Gn = He(
5014
5017
  ),
5015
5018
  x
5016
5019
  );
5017
- const y = Pt(
5020
+ const y = Ot(
5018
5021
  z(
5019
5022
  w,
5020
5023
  be(({ items: C }) => C.length > 0),
@@ -5024,7 +5027,7 @@ const Gn = He(
5024
5027
  Qe(Or),
5025
5028
  re(([C]) => C)
5026
5029
  )
5027
- ), R = Pt(
5030
+ ), R = Ot(
5028
5031
  z(
5029
5032
  w,
5030
5033
  gn(200),
@@ -5032,7 +5035,7 @@ const Gn = He(
5032
5035
  re(({ items: C }) => C[0].index),
5033
5036
  Qe()
5034
5037
  )
5035
- ), S = Pt(
5038
+ ), S = Ot(
5036
5039
  z(
5037
5040
  w,
5038
5041
  be(({ items: C }) => C.length > 0),
@@ -5113,14 +5116,14 @@ const Gn = He(
5113
5116
  _e(t, c, n, s, o, r, a),
5114
5117
  _e(e),
5115
5118
  re(([[f, h, m, b, v, g, x, w], y]) => {
5116
- const { align: R, behavior: S, calculateViewLocation: C = Ex, done: k, ...E } = f, N = ou(f, h, b - 1), _ = Mr(N, h.offsetTree, y) + v + g, I = _ + Xt(h.sizeTree, N)[1], F = w + g, V = w + m - x, P = C({
5119
+ const { align: R, behavior: S, calculateViewLocation: C = Ex, done: k, ...E } = f, N = ou(f, h, b - 1), _ = Mr(N, h.offsetTree, y) + v + g, I = _ + Jt(h.sizeTree, N)[1], F = w + g, V = w + m - x, P = C({
5117
5120
  itemBottom: I,
5118
5121
  itemTop: _,
5119
5122
  locationParams: { align: R, behavior: S, ...E },
5120
5123
  viewportBottom: V,
5121
5124
  viewportTop: F
5122
5125
  });
5123
- return P ? k && Yt(
5126
+ return P ? k && Xt(
5124
5127
  z(
5125
5128
  i,
5126
5129
  be((G) => !G),
@@ -5178,13 +5181,13 @@ const Ix = (e, t) => typeof e == "function" ? vl(e(t)) : t && vl(e), Nx = He(
5178
5181
  ({ followOutputBehavior: S, totalCount: C }) => {
5179
5182
  g && (g(), g = null), st(n) ? requestAnimationFrame(() => {
5180
5183
  st(d)("following output to ", { totalCount: C }, Nt.DEBUG), x(S);
5181
- }) : g = Yt(e, () => {
5184
+ }) : g = Xt(e, () => {
5182
5185
  st(d)("following output to ", { totalCount: C }, Nt.DEBUG), x(S), g = null;
5183
5186
  });
5184
5187
  }
5185
5188
  );
5186
5189
  function w(S) {
5187
- const C = Yt(o, (k) => {
5190
+ const C = Xt(o, (k) => {
5188
5191
  S && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !g && (st(d)("scrolling to bottom due to increased size", {}, Nt.DEBUG), x("auto"));
5189
5192
  });
5190
5193
  setTimeout(C, 100);
@@ -5232,7 +5235,7 @@ const Ix = (e, t) => typeof e == "function" ? vl(e(t)) : t && vl(e), Nx = He(
5232
5235
  (S) => {
5233
5236
  g && (g(), g = null), st(n) ? requestAnimationFrame(() => {
5234
5237
  st(d)("scrolling into view", {}), Ie(m, S);
5235
- }) : g = Yt(e, () => {
5238
+ }) : g = Xt(e, () => {
5236
5239
  st(d)("scrolling into view", {}), Ie(m, S), g = null;
5237
5240
  });
5238
5241
  }
@@ -5273,7 +5276,7 @@ const Ix = (e, t) => typeof e == "function" ? vl(e(t)) : t && vl(e), Nx = He(
5273
5276
  re(([, o]) => ({ top: o }))
5274
5277
  ),
5275
5278
  (o) => {
5276
- Yt(
5279
+ Xt(
5277
5280
  z(
5278
5281
  n,
5279
5282
  Bn(1),
@@ -5414,7 +5417,7 @@ const Mx = hu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5414
5417
  { log: m },
5415
5418
  { recalcInProgress: b }
5416
5419
  ]) => {
5417
- const v = Pt(
5420
+ const v = Ot(
5418
5421
  z(
5419
5422
  c,
5420
5423
  _e(i),
@@ -5784,7 +5787,7 @@ const zx = /* @__PURE__ */ He(() => {
5784
5787
  ([e, t]) => ({ ...e, ...t }),
5785
5788
  et(pu, zx)
5786
5789
  ), Hx = ({ height: e }) => /* @__PURE__ */ l.jsx("div", { style: { height: e } }), Ux = { overflowAnchor: "none", position: Yi(), zIndex: 1 }, bu = { overflowAnchor: "none" }, Wx = { ...bu, display: "inline-block", height: "100%" }, bl = /* @__PURE__ */ B.memo(function({ showTopList: e = !1 }) {
5787
- const t = Te("listState"), n = Ht("sizeRanges"), r = Te("useWindowScroll"), o = Te("customScrollParent"), s = Ht("windowScrollContainerState"), i = Ht("scrollContainerState"), a = o || r ? s : i, c = Te("itemContent"), u = Te("context"), d = Te("groupContent"), f = Te("trackItemSizes"), h = Te("itemSize"), m = Te("log"), b = Ht("gap"), v = Te("horizontalDirection"), { callbackRef: g } = sx(
5790
+ const t = Te("listState"), n = Ut("sizeRanges"), r = Te("useWindowScroll"), o = Te("customScrollParent"), s = Ut("windowScrollContainerState"), i = Ut("scrollContainerState"), a = o || r ? s : i, c = Te("itemContent"), u = Te("context"), d = Te("groupContent"), f = Te("trackItemSizes"), h = Te("itemSize"), m = Te("log"), b = Ut("gap"), v = Te("horizontalDirection"), { callbackRef: g } = sx(
5788
5791
  n,
5789
5792
  h,
5790
5793
  f,
@@ -5891,7 +5894,7 @@ function Gx(e, t) {
5891
5894
  return { item: typeof e == "string" ? void 0 : t };
5892
5895
  }
5893
5896
  const Yx = /* @__PURE__ */ B.memo(function() {
5894
- const e = Te("HeaderComponent"), t = Ht("headerHeight"), n = Te("HeaderFooterTag"), r = qn(
5897
+ const e = Te("HeaderComponent"), t = Ut("headerHeight"), n = Te("HeaderFooterTag"), r = qn(
5895
5898
  B.useMemo(
5896
5899
  () => (s) => {
5897
5900
  t(yn(s, "height"));
@@ -5903,7 +5906,7 @@ const Yx = /* @__PURE__ */ B.memo(function() {
5903
5906
  ), o = Te("context");
5904
5907
  return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...bt(e, o) }) }) : null;
5905
5908
  }), Xx = /* @__PURE__ */ B.memo(function() {
5906
- const e = Te("FooterComponent"), t = Ht("footerHeight"), n = Te("HeaderFooterTag"), r = qn(
5909
+ const e = Te("FooterComponent"), t = Ut("footerHeight"), n = Te("HeaderFooterTag"), r = qn(
5907
5910
  B.useMemo(
5908
5911
  () => (s) => {
5909
5912
  t(yn(s, "height"));
@@ -5968,7 +5971,7 @@ function Su({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
5968
5971
  });
5969
5972
  }
5970
5973
  const Jx = ({ children: e }) => {
5971
- const t = B.useContext(gu), n = Ht("viewportHeight"), r = Ht("fixedItemHeight"), o = Te("alignToBottom"), s = Te("horizontalDirection"), i = B.useMemo(
5974
+ const t = B.useContext(gu), n = Ut("viewportHeight"), r = Ut("fixedItemHeight"), o = Te("alignToBottom"), s = Te("horizontalDirection"), i = B.useMemo(
5972
5975
  () => qc(n, (c) => yn(c, s ? "width" : "height")),
5973
5976
  [n, s]
5974
5977
  ), a = qn(i, !0, Te("skipAnimationFrameInResizeObserver"));
@@ -5976,7 +5979,7 @@ const Jx = ({ children: e }) => {
5976
5979
  t && (n(t.viewportHeight), r(t.itemHeight));
5977
5980
  }, [t, n, r]), /* @__PURE__ */ l.jsx("div", { "data-viewport-type": "element", ref: a, style: os(o), children: e });
5978
5981
  }, Zx = ({ children: e }) => {
5979
- const t = B.useContext(gu), n = Ht("windowViewportRect"), r = Ht("fixedItemHeight"), o = Te("customScrollParent"), s = Yc(
5982
+ const t = B.useContext(gu), n = Ut("windowViewportRect"), r = Ut("fixedItemHeight"), o = Te("customScrollParent"), s = Yc(
5980
5983
  n,
5981
5984
  o,
5982
5985
  Te("skipAnimationFrameInResizeObserver")
@@ -6001,7 +6004,7 @@ const Jx = ({ children: e }) => {
6001
6004
  Component: tv,
6002
6005
  useEmitter: Ji,
6003
6006
  useEmitterValue: Te,
6004
- usePublisher: Ht
6007
+ usePublisher: Ut
6005
6008
  } = /* @__PURE__ */ mu(
6006
6009
  Bx,
6007
6010
  {
@@ -6061,7 +6064,7 @@ const Jx = ({ children: e }) => {
6061
6064
  }
6062
6065
  },
6063
6066
  ev
6064
- ), nv = /* @__PURE__ */ yu({ useEmitter: Ji, useEmitterValue: Te, usePublisher: Ht }), rv = /* @__PURE__ */ Su({ useEmitter: Ji, useEmitterValue: Te, usePublisher: Ht }), ov = tv, sv = /* @__PURE__ */ He(() => {
6067
+ ), nv = /* @__PURE__ */ yu({ useEmitter: Ji, useEmitterValue: Te, usePublisher: Ut }), rv = /* @__PURE__ */ Su({ useEmitter: Ji, useEmitterValue: Te, usePublisher: Ut }), ov = tv, sv = /* @__PURE__ */ He(() => {
6065
6068
  const e = q((u) => /* @__PURE__ */ l.jsxs("td", { children: [
6066
6069
  "Item $",
6067
6070
  u
@@ -6141,7 +6144,7 @@ const cv = /* @__PURE__ */ He(
6141
6144
  { customScrollParent: g, useWindowScroll: x, windowScrollContainerState: w, windowScrollTo: y, windowViewportRect: R },
6142
6145
  S
6143
6146
  ]) => {
6144
- const C = q(0), k = q(0), E = q(yl), N = q({ height: 0, width: 0 }), _ = q({ height: 0, width: 0 }), I = Le(), F = Le(), V = q(0), P = q(null), G = q({ column: 0, row: 0 }), W = Le(), K = Le(), D = q(!1), O = q(0), ie = q(!0), Z = q(!1), ee = q(!1);
6147
+ const C = q(0), k = q(0), E = q(yl), N = q({ height: 0, width: 0 }), _ = q({ height: 0, width: 0 }), I = Le(), F = Le(), V = q(0), P = q(null), G = q({ column: 0, row: 0 }), W = Le(), K = Le(), D = q(!1), O = q(0), ie = q(!0), J = q(!1), ee = q(!1);
6145
6148
  Ke(
6146
6149
  z(
6147
6150
  b,
@@ -6153,13 +6156,13 @@ const cv = /* @__PURE__ */ He(
6153
6156
  }
6154
6157
  ), Ke(
6155
6158
  z(
6156
- ut(b, ie, _, N, O, Z),
6159
+ ut(b, ie, _, N, O, J),
6157
6160
  be(([j, H, Q, le, , oe]) => j && !H && Q.height !== 0 && le.height !== 0 && !oe)
6158
6161
  ),
6159
6162
  ([, , , , j]) => {
6160
- Ie(Z, !0), Vi(1, () => {
6163
+ Ie(J, !0), Vi(1, () => {
6161
6164
  Ie(I, j);
6162
- }), Yt(z(u), () => {
6165
+ }), Xt(z(u), () => {
6163
6166
  Ie(t, [0, 0]), Ie(ie, !0);
6164
6167
  });
6165
6168
  }
@@ -6177,7 +6180,7 @@ const cv = /* @__PURE__ */ He(
6177
6180
  be(([, j]) => j != null)
6178
6181
  ),
6179
6182
  ([, j]) => {
6180
- j && (Ie(N, j.viewport), Ie(_, j.item), Ie(G, j.gap), j.scrollTop > 0 && (Ie(D, !0), Yt(z(u, Bn(1)), (H) => {
6183
+ j && (Ie(N, j.viewport), Ie(_, j.item), Ie(G, j.gap), j.scrollTop > 0 && (Ie(D, !0), Xt(z(u, Bn(1)), (H) => {
6181
6184
  Ie(D, !1);
6182
6185
  }), Ie(c, { top: j.scrollTop })));
6183
6186
  }
@@ -6275,7 +6278,7 @@ const cv = /* @__PURE__ */ He(
6275
6278
  ),
6276
6279
  M
6277
6280
  );
6278
- const J = Pt(
6281
+ const Z = Ot(
6279
6282
  z(
6280
6283
  ut(E, C),
6281
6284
  be(([{ items: j }]) => j.length > 0),
@@ -6287,14 +6290,14 @@ const cv = /* @__PURE__ */ He(
6287
6290
  re(([[, j]]) => j - 1),
6288
6291
  Qe()
6289
6292
  )
6290
- ), Re = Pt(
6293
+ ), Re = Ot(
6291
6294
  z(
6292
6295
  we(E),
6293
6296
  be(({ items: j }) => j.length > 0 && j[0].index === 0),
6294
6297
  rn(0),
6295
6298
  Qe()
6296
6299
  )
6297
- ), fe = Pt(
6300
+ ), fe = Ot(
6298
6301
  z(
6299
6302
  we(E),
6300
6303
  _e(D),
@@ -6367,7 +6370,7 @@ const cv = /* @__PURE__ */ He(
6367
6370
  initialTopMostItemIndex: O,
6368
6371
  totalListHeight: L,
6369
6372
  ...h,
6370
- endReached: J,
6373
+ endReached: Z,
6371
6374
  propsReady: v,
6372
6375
  rangeChanged: fe,
6373
6376
  startReached: Re,
@@ -6423,7 +6426,7 @@ const uv = /* @__PURE__ */ He(() => {
6423
6426
  ([e, t]) => ({ ...e, ...t }),
6424
6427
  et(cv, uv)
6425
6428
  ), fv = /* @__PURE__ */ B.memo(function() {
6426
- const e = nt("gridState"), t = nt("listClassName"), n = nt("itemClassName"), r = nt("itemContent"), o = nt("computeItemKey"), s = nt("isSeeking"), i = Ut("scrollHeight"), a = nt("ItemComponent"), c = nt("ListComponent"), u = nt("ScrollSeekPlaceholder"), d = nt("context"), f = Ut("itemDimensions"), h = Ut("gap"), m = nt("log"), b = nt("stateRestoreInProgress"), v = Ut("reportReadyState"), g = qn(
6429
+ const e = nt("gridState"), t = nt("listClassName"), n = nt("itemClassName"), r = nt("itemContent"), o = nt("computeItemKey"), s = nt("isSeeking"), i = Wt("scrollHeight"), a = nt("ItemComponent"), c = nt("ListComponent"), u = nt("ScrollSeekPlaceholder"), d = nt("context"), f = Wt("itemDimensions"), h = Wt("gap"), m = nt("log"), b = nt("stateRestoreInProgress"), v = Wt("reportReadyState"), g = qn(
6427
6430
  B.useMemo(
6428
6431
  () => (x) => {
6429
6432
  const w = x.parentElement.parentElement.scrollHeight;
@@ -6478,7 +6481,7 @@ const uv = /* @__PURE__ */ He(() => {
6478
6481
  }
6479
6482
  );
6480
6483
  }), hv = B.memo(function() {
6481
- const e = nt("HeaderComponent"), t = Ut("headerHeight"), n = nt("headerFooterTag"), r = qn(
6484
+ const e = nt("HeaderComponent"), t = Wt("headerHeight"), n = nt("headerFooterTag"), r = qn(
6482
6485
  B.useMemo(
6483
6486
  () => (s) => {
6484
6487
  t(yn(s, "height"));
@@ -6490,7 +6493,7 @@ const uv = /* @__PURE__ */ He(() => {
6490
6493
  ), o = nt("context");
6491
6494
  return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...bt(e, o) }) }) : null;
6492
6495
  }), pv = B.memo(function() {
6493
- const e = nt("FooterComponent"), t = Ut("footerHeight"), n = nt("headerFooterTag"), r = qn(
6496
+ const e = nt("FooterComponent"), t = Wt("footerHeight"), n = nt("headerFooterTag"), r = qn(
6494
6497
  B.useMemo(
6495
6498
  () => (s) => {
6496
6499
  t(yn(s, "height"));
@@ -6502,7 +6505,7 @@ const uv = /* @__PURE__ */ He(() => {
6502
6505
  ), o = nt("context");
6503
6506
  return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...bt(e, o) }) }) : null;
6504
6507
  }), mv = ({ children: e }) => {
6505
- const t = B.useContext(xu), n = Ut("itemDimensions"), r = Ut("viewportDimensions"), o = qn(
6508
+ const t = B.useContext(xu), n = Wt("itemDimensions"), r = Wt("viewportDimensions"), o = qn(
6506
6509
  B.useMemo(
6507
6510
  () => (s) => {
6508
6511
  r(s.getBoundingClientRect());
@@ -6516,7 +6519,7 @@ const uv = /* @__PURE__ */ He(() => {
6516
6519
  t && (r({ height: t.viewportHeight, width: t.viewportWidth }), n({ height: t.itemHeight, width: t.itemWidth }));
6517
6520
  }, [t, r, n]), /* @__PURE__ */ l.jsx("div", { ref: o, style: os(!1), children: e });
6518
6521
  }, gv = ({ children: e }) => {
6519
- const t = B.useContext(xu), n = Ut("windowViewportRect"), r = Ut("itemDimensions"), o = nt("customScrollParent"), s = Yc(n, o, !1);
6522
+ const t = B.useContext(xu), n = Wt("windowViewportRect"), r = Wt("itemDimensions"), o = nt("customScrollParent"), s = Yc(n, o, !1);
6520
6523
  return B.useEffect(() => {
6521
6524
  t && (r({ height: t.itemHeight, width: t.itemWidth }), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: t.viewportWidth }));
6522
6525
  }, [t, n, r]), /* @__PURE__ */ l.jsx("div", { ref: s, style: os(!1), children: e });
@@ -6530,7 +6533,7 @@ const uv = /* @__PURE__ */ He(() => {
6530
6533
  }), {
6531
6534
  useEmitter: Tu,
6532
6535
  useEmitterValue: nt,
6533
- usePublisher: Ut
6536
+ usePublisher: Wt
6534
6537
  } = /* @__PURE__ */ mu(
6535
6538
  dv,
6536
6539
  {
@@ -6572,7 +6575,7 @@ const uv = /* @__PURE__ */ He(() => {
6572
6575
  }
6573
6576
  },
6574
6577
  xv
6575
- ), vv = /* @__PURE__ */ yu({ useEmitter: Tu, useEmitterValue: nt, usePublisher: Ut }), wv = /* @__PURE__ */ Su({ useEmitter: Tu, useEmitterValue: nt, usePublisher: Ut });
6578
+ ), vv = /* @__PURE__ */ yu({ useEmitter: Tu, useEmitterValue: nt, usePublisher: Wt }), wv = /* @__PURE__ */ Su({ useEmitter: Tu, useEmitterValue: nt, usePublisher: Wt });
6576
6579
  function kl(e, t, n) {
6577
6580
  return t !== "normal" && !(t != null && t.endsWith("px")) && n(`${e} was not resolved to pixel value correctly`, t, Nt.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
6578
6581
  }
@@ -6770,11 +6773,11 @@ function Ru(e, t) {
6770
6773
  function Ev(e, t) {
6771
6774
  return p.useReducer((n, r) => t[n][r] ?? n, e);
6772
6775
  }
6773
- var Mt = (e) => {
6776
+ var Dt = (e) => {
6774
6777
  const { present: t, children: n } = e, r = Iv(t), o = typeof n == "function" ? n({ present: r.isPresent }) : p.Children.only(n), s = Me(r.ref, Nv(o));
6775
6778
  return typeof n == "function" || r.isPresent ? p.cloneElement(o, { ref: s }) : null;
6776
6779
  };
6777
- Mt.displayName = "Presence";
6780
+ Dt.displayName = "Presence";
6778
6781
  function Iv(e) {
6779
6782
  const [t, n] = p.useState(), r = p.useRef(null), o = p.useRef(e), s = p.useRef("none"), i = e ? "mounted" : "unmounted", [a, c] = Ev(i, {
6780
6783
  mounted: {
@@ -6900,7 +6903,7 @@ Iu.displayName = Eu;
6900
6903
  var ea = "CollapsibleContent", Ov = p.forwardRef(
6901
6904
  (e, t) => {
6902
6905
  const { forceMount: n, ...r } = e, o = Qi(ea, e.__scopeCollapsible);
6903
- return /* @__PURE__ */ l.jsx(Mt, { present: n || o.open, children: ({ present: s }) => /* @__PURE__ */ l.jsx(Mv, { ...r, ref: t, present: s }) });
6906
+ return /* @__PURE__ */ l.jsx(Dt, { present: n || o.open, children: ({ present: s }) => /* @__PURE__ */ l.jsx(Mv, { ...r, ref: t, present: s }) });
6904
6907
  }
6905
6908
  );
6906
6909
  Ov.displayName = ea;
@@ -8496,7 +8499,7 @@ function Bs({
8496
8499
  className: t = "",
8497
8500
  allowHtml: n = !1
8498
8501
  }) {
8499
- const r = Gt(() => {
8502
+ const r = Yt(() => {
8500
8503
  try {
8501
8504
  if (!n) {
8502
8505
  const o = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
@@ -8516,7 +8519,7 @@ function Bs({
8516
8519
  );
8517
8520
  }
8518
8521
  async function Du(e, t) {
8519
- return await Bt(e, {
8522
+ return await Ht(e, {
8520
8523
  responseType: "blob",
8521
8524
  onDownloadProgress: (r) => {
8522
8525
  try {
@@ -8535,7 +8538,7 @@ async function ew(e, t) {
8535
8538
  const n = await Du(`/chat/files/${e}/download`, t), r = URL.createObjectURL(n);
8536
8539
  let o = `file_${e}`;
8537
8540
  try {
8538
- const i = await Bt(`/chat/files/${e}`);
8541
+ const i = await Ht(`/chat/files/${e}`);
8539
8542
  o = (i == null ? void 0 : i.filename) ?? o;
8540
8543
  } catch {
8541
8544
  }
@@ -8544,7 +8547,7 @@ async function ew(e, t) {
8544
8547
  }
8545
8548
  async function tw(e, t = 50, n = 0) {
8546
8549
  const r = { limit: t, offset: n };
8547
- return e && (r.thread_id = e), await Bt("/chat/files", { params: r });
8550
+ return e && (r.thread_id = e), await Ht("/chat/files", { params: r });
8548
8551
  }
8549
8552
  const nw = 1, rw = 1e6;
8550
8553
  let Hs = 0;
@@ -9441,7 +9444,7 @@ var sb = function(e) {
9441
9444
  return o ? (r.push.apply(r, Array.from(o.querySelectorAll("[aria-live], script"))), ab(r, o, n, "aria-hidden")) : function() {
9442
9445
  return null;
9443
9446
  };
9444
- }, ds = "Dialog", [Gu, wT] = fn(ds), [lb, en] = Gu(ds), Yu = (e) => {
9447
+ }, ds = "Dialog", [Gu, wT] = fn(ds), [lb, tn] = Gu(ds), Yu = (e) => {
9445
9448
  const {
9446
9449
  __scopeDialog: t,
9447
9450
  children: n,
@@ -9475,7 +9478,7 @@ var sb = function(e) {
9475
9478
  Yu.displayName = ds;
9476
9479
  var Xu = "DialogTrigger", Ju = p.forwardRef(
9477
9480
  (e, t) => {
9478
- const { __scopeDialog: n, ...r } = e, o = en(Xu, n), s = Me(t, o.triggerRef);
9481
+ const { __scopeDialog: n, ...r } = e, o = tn(Xu, n), s = Me(t, o.triggerRef);
9479
9482
  return /* @__PURE__ */ l.jsx(
9480
9483
  Ce.button,
9481
9484
  {
@@ -9495,20 +9498,20 @@ Ju.displayName = Xu;
9495
9498
  var aa = "DialogPortal", [cb, Zu] = Gu(aa, {
9496
9499
  forceMount: void 0
9497
9500
  }), Qu = (e) => {
9498
- const { __scopeDialog: t, forceMount: n, children: r, container: o } = e, s = en(aa, t);
9499
- return /* @__PURE__ */ l.jsx(cb, { scope: t, forceMount: n, children: p.Children.map(r, (i) => /* @__PURE__ */ l.jsx(Mt, { present: n || s.open, children: /* @__PURE__ */ l.jsx(ls, { asChild: !0, container: o, children: i }) })) });
9501
+ const { __scopeDialog: t, forceMount: n, children: r, container: o } = e, s = tn(aa, t);
9502
+ return /* @__PURE__ */ l.jsx(cb, { scope: t, forceMount: n, children: p.Children.map(r, (i) => /* @__PURE__ */ l.jsx(Dt, { present: n || s.open, children: /* @__PURE__ */ l.jsx(ls, { asChild: !0, container: o, children: i }) })) });
9500
9503
  };
9501
9504
  Qu.displayName = aa;
9502
9505
  var Do = "DialogOverlay", ed = p.forwardRef(
9503
9506
  (e, t) => {
9504
- const n = Zu(Do, e.__scopeDialog), { forceMount: r = n.forceMount, ...o } = e, s = en(Do, e.__scopeDialog);
9505
- return s.modal ? /* @__PURE__ */ l.jsx(Mt, { present: r || s.open, children: /* @__PURE__ */ l.jsx(db, { ...o, ref: t }) }) : null;
9507
+ const n = Zu(Do, e.__scopeDialog), { forceMount: r = n.forceMount, ...o } = e, s = tn(Do, e.__scopeDialog);
9508
+ return s.modal ? /* @__PURE__ */ l.jsx(Dt, { present: r || s.open, children: /* @__PURE__ */ l.jsx(db, { ...o, ref: t }) }) : null;
9506
9509
  }
9507
9510
  );
9508
9511
  ed.displayName = Do;
9509
9512
  var ub = lr("DialogOverlay.RemoveScroll"), db = p.forwardRef(
9510
9513
  (e, t) => {
9511
- const { __scopeDialog: n, ...r } = e, o = en(Do, n);
9514
+ const { __scopeDialog: n, ...r } = e, o = tn(Do, n);
9512
9515
  return (
9513
9516
  // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
9514
9517
  // ie. when `Overlay` and `Content` are siblings
@@ -9525,14 +9528,14 @@ var ub = lr("DialogOverlay.RemoveScroll"), db = p.forwardRef(
9525
9528
  }
9526
9529
  ), Un = "DialogContent", td = p.forwardRef(
9527
9530
  (e, t) => {
9528
- const n = Zu(Un, e.__scopeDialog), { forceMount: r = n.forceMount, ...o } = e, s = en(Un, e.__scopeDialog);
9529
- return /* @__PURE__ */ l.jsx(Mt, { present: r || s.open, children: s.modal ? /* @__PURE__ */ l.jsx(fb, { ...o, ref: t }) : /* @__PURE__ */ l.jsx(hb, { ...o, ref: t }) });
9531
+ const n = Zu(Un, e.__scopeDialog), { forceMount: r = n.forceMount, ...o } = e, s = tn(Un, e.__scopeDialog);
9532
+ return /* @__PURE__ */ l.jsx(Dt, { present: r || s.open, children: s.modal ? /* @__PURE__ */ l.jsx(fb, { ...o, ref: t }) : /* @__PURE__ */ l.jsx(hb, { ...o, ref: t }) });
9530
9533
  }
9531
9534
  );
9532
9535
  td.displayName = Un;
9533
9536
  var fb = p.forwardRef(
9534
9537
  (e, t) => {
9535
- const n = en(Un, e.__scopeDialog), r = p.useRef(null), o = Me(t, n.contentRef, r);
9538
+ const n = tn(Un, e.__scopeDialog), r = p.useRef(null), o = Me(t, n.contentRef, r);
9536
9539
  return p.useEffect(() => {
9537
9540
  const s = r.current;
9538
9541
  if (s) return ia(s);
@@ -9560,7 +9563,7 @@ var fb = p.forwardRef(
9560
9563
  }
9561
9564
  ), hb = p.forwardRef(
9562
9565
  (e, t) => {
9563
- const n = en(Un, e.__scopeDialog), r = p.useRef(!1), o = p.useRef(!1);
9566
+ const n = tn(Un, e.__scopeDialog), r = p.useRef(!1), o = p.useRef(!1);
9564
9567
  return /* @__PURE__ */ l.jsx(
9565
9568
  nd,
9566
9569
  {
@@ -9583,7 +9586,7 @@ var fb = p.forwardRef(
9583
9586
  }
9584
9587
  ), nd = p.forwardRef(
9585
9588
  (e, t) => {
9586
- const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: s, ...i } = e, a = en(Un, n), c = p.useRef(null), u = Me(t, c);
9589
+ const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: s, ...i } = e, a = tn(Un, n), c = p.useRef(null), u = Me(t, c);
9587
9590
  return sa(), /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
9588
9591
  /* @__PURE__ */ l.jsx(
9589
9592
  as,
@@ -9616,21 +9619,21 @@ var fb = p.forwardRef(
9616
9619
  }
9617
9620
  ), la = "DialogTitle", rd = p.forwardRef(
9618
9621
  (e, t) => {
9619
- const { __scopeDialog: n, ...r } = e, o = en(la, n);
9622
+ const { __scopeDialog: n, ...r } = e, o = tn(la, n);
9620
9623
  return /* @__PURE__ */ l.jsx(Ce.h2, { id: o.titleId, ...r, ref: t });
9621
9624
  }
9622
9625
  );
9623
9626
  rd.displayName = la;
9624
9627
  var od = "DialogDescription", sd = p.forwardRef(
9625
9628
  (e, t) => {
9626
- const { __scopeDialog: n, ...r } = e, o = en(od, n);
9629
+ const { __scopeDialog: n, ...r } = e, o = tn(od, n);
9627
9630
  return /* @__PURE__ */ l.jsx(Ce.p, { id: o.descriptionId, ...r, ref: t });
9628
9631
  }
9629
9632
  );
9630
9633
  sd.displayName = od;
9631
9634
  var id = "DialogClose", ad = p.forwardRef(
9632
9635
  (e, t) => {
9633
- const { __scopeDialog: n, ...r } = e, o = en(id, n);
9636
+ const { __scopeDialog: n, ...r } = e, o = tn(id, n);
9634
9637
  return /* @__PURE__ */ l.jsx(
9635
9638
  Ce.button,
9636
9639
  {
@@ -10088,7 +10091,7 @@ const jb = B.memo(function({
10088
10091
  onCancelEdit: x,
10089
10092
  onCopy: w
10090
10093
  }) {
10091
- const [y, R] = me(!1), [S, C] = me("collapsed"), [k, E] = me(!1), { currentThreadId: N } = Fi(), { toast: _ } = oa(), [I, F] = me({}), [V, P] = me(!1), [G, W] = me(null), K = u === "phone" || u === "half-screen", D = t.role, O = D === "tool", ie = !(r && D !== "user"), Z = B.useMemo(() => {
10094
+ const [y, R] = me(!1), [S, C] = me("collapsed"), [k, E] = me(!1), { currentThreadId: N } = Fi(), { toast: _ } = oa(), [I, F] = me({}), [V, P] = me(!1), [G, W] = me(null), K = u === "phone" || u === "half-screen", D = t.role, O = D === "tool", ie = !(r && D !== "user"), J = B.useMemo(() => {
10092
10095
  switch (D) {
10093
10096
  case "user":
10094
10097
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -10101,15 +10104,15 @@ const jb = B.memo(function({
10101
10104
  default:
10102
10105
  return "text-[hsl(var(--chat-bubble-ai-text))]";
10103
10106
  }
10104
- }, [D]), ee = Gt(() => Tb(t.content), [t.content]), M = Gt(() => Rb(t.content), [t.content]), J = Gt(
10107
+ }, [D]), ee = Yt(() => Tb(t.content), [t.content]), M = Yt(() => Rb(t.content), [t.content]), Z = Yt(
10105
10108
  () => t.content.filter((ce) => ce.type === "image_url"),
10106
10109
  [t.content]
10107
- ), Re = Gt(
10110
+ ), Re = Yt(
10108
10111
  () => t.content.filter((ce) => ce.type === "file"),
10109
10112
  [t.content]
10110
- ), fe = Gt(() => Eb(t.content), [t.content]);
10111
- Gt(() => Ib(t.content), [t.content]);
10112
- const L = Gt(() => fe.length <= Pn ? fe : `${fe.slice(0, Pn)}
10113
+ ), fe = Yt(() => Eb(t.content), [t.content]);
10114
+ Yt(() => Ib(t.content), [t.content]);
10115
+ const L = Yt(() => fe.length <= Pn ? fe : `${fe.slice(0, Pn)}
10113
10116
  … [truncated ${fe.length - Pn} chars]`, [fe]), j = Ab(ee, r, o), H = B.useCallback(async (ce = "all") => {
10114
10117
  const he = ce === "visible" && O ? L : O ? fe : ee;
10115
10118
  async function ye(Pe) {
@@ -10185,7 +10188,7 @@ const jb = B.memo(function({
10185
10188
  console.error("File click error:", ye), F((Pe) => ({ ...Pe, [he]: !1 }));
10186
10189
  }
10187
10190
  }, [ie, I, _, N]), $e = B.useCallback(() => {
10188
- const ue = X(K ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", Z);
10191
+ const ue = X(K ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", J);
10189
10192
  switch (D) {
10190
10193
  case "user":
10191
10194
  return /* @__PURE__ */ l.jsx(Ap, { className: ue });
@@ -10196,7 +10199,7 @@ const jb = B.memo(function({
10196
10199
  default:
10197
10200
  return /* @__PURE__ */ l.jsx(Da, { className: ue });
10198
10201
  }
10199
- }, [K, Z, D]), De = B.useCallback(() => {
10202
+ }, [K, J, D]), De = B.useCallback(() => {
10200
10203
  const ce = "group relative mb-4 flex w-full";
10201
10204
  switch (D) {
10202
10205
  case "user":
@@ -10330,7 +10333,7 @@ const jb = B.memo(function({
10330
10333
  }
10331
10334
  return /* @__PURE__ */ l.jsx(Bs, { content: ee.trim(), allowHtml: !1 });
10332
10335
  }, [ee, D, h, m, k, K]), dt = B.useCallback(() => {
10333
- if (!(ee.trim().length > 0 || J.length > 0 || Re.length > 0) && !r)
10336
+ if (!(ee.trim().length > 0 || Z.length > 0 || Re.length > 0) && !r)
10334
10337
  return Be();
10335
10338
  if (t.model === "reflection") {
10336
10339
  const ue = ee.trim(), he = Js(ue);
@@ -10364,11 +10367,11 @@ const jb = B.memo(function({
10364
10367
  if (!O)
10365
10368
  return r ? /* @__PURE__ */ l.jsxs("div", { "aria-busy": "true", role: "status", children: [
10366
10369
  Ze(),
10367
- r && /* @__PURE__ */ l.jsx(_b, { className: Z })
10370
+ r && /* @__PURE__ */ l.jsx(_b, { className: J })
10368
10371
  ] }) : /* @__PURE__ */ l.jsx("div", { className: "space-y-2", children: t.content.map((ue, he) => /* @__PURE__ */ l.jsx(ke, { part: ue, i: he }, he)) });
10369
10372
  }, [
10370
10373
  ee,
10371
- J.length,
10374
+ Z.length,
10372
10375
  Re.length,
10373
10376
  r,
10374
10377
  t.model,
@@ -10380,8 +10383,8 @@ const jb = B.memo(function({
10380
10383
  Be,
10381
10384
  Ze,
10382
10385
  qe,
10383
- Z
10384
- ]), ft = Gt(() => Nb(t), [t]);
10386
+ J
10387
+ ]), ft = Yt(() => Nb(t), [t]);
10385
10388
  return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
10386
10389
  /* @__PURE__ */ l.jsx("div", { className: X(De(), b.container), children: /* @__PURE__ */ l.jsxs("div", { className: X(ve(), b.content), children: [
10387
10390
  (a || c || O) && /* @__PURE__ */ l.jsxs(
@@ -10390,7 +10393,7 @@ const jb = B.memo(function({
10390
10393
  className: X(
10391
10394
  "flex items-center justify-between mb-2 pb-2 border-b border-current/10",
10392
10395
  K && "mb-1 pb-1",
10393
- Z,
10396
+ J,
10394
10397
  b.header
10395
10398
  ),
10396
10399
  children: [
@@ -10403,7 +10406,7 @@ const jb = B.memo(function({
10403
10406
  variant: "outline",
10404
10407
  className: X(
10405
10408
  "text-xs flex items-center gap-1 cursor-pointer",
10406
- Z,
10409
+ J,
10407
10410
  "border border-current/40",
10408
10411
  K && "text-xs h-4"
10409
10412
  ),
@@ -10425,7 +10428,7 @@ const jb = B.memo(function({
10425
10428
  {
10426
10429
  variant: "ghost",
10427
10430
  size: "sm",
10428
- className: X("h-6 px-1", Z, "hover:bg-foreground/10"),
10431
+ className: X("h-6 px-1", J, "hover:bg-foreground/10"),
10429
10432
  onClick: () => C((ce) => ce === "collapsed" ? "preview" : "collapsed"),
10430
10433
  children: /* @__PURE__ */ l.jsxs("span", { className: "text-xs flex items-center gap-1", children: [
10431
10434
  "Tool Output ",
@@ -10438,7 +10441,7 @@ const jb = B.memo(function({
10438
10441
  a && t.createdAt && /* @__PURE__ */ l.jsx(
10439
10442
  "time",
10440
10443
  {
10441
- className: X("text-xs opacity-60", Z, K && "text-xs"),
10444
+ className: X("text-xs opacity-60", J, K && "text-xs"),
10442
10445
  dateTime: new Date(t.createdAt).toISOString(),
10443
10446
  title: new Date(t.createdAt).toLocaleString(),
10444
10447
  children: new Intl.DateTimeFormat(void 0, { hour: "2-digit", minute: "2-digit" }).format(new Date(t.createdAt))
@@ -10460,10 +10463,10 @@ const jb = B.memo(function({
10460
10463
  variant: "ghost",
10461
10464
  size: "sm",
10462
10465
  onClick: () => H(O ? "visible" : "all"),
10463
- className: X("h-6 w-6 p-0 hover:bg-foreground/10", Z, K && "h-5 w-5"),
10466
+ className: X("h-6 w-6 p-0 hover:bg-foreground/10", J, K && "h-5 w-5"),
10464
10467
  "aria-label": O ? "Copy visible" : "Copy message",
10465
10468
  title: O ? "Copy visible portion" : "Copy message",
10466
- children: /* @__PURE__ */ l.jsx(La, { className: X(y ? "text-success" : Z, K ? "h-3 w-3" : "h-4 w-4") })
10469
+ children: /* @__PURE__ */ l.jsx(La, { className: X(y ? "text-success" : J, K ? "h-3 w-3" : "h-4 w-4") })
10467
10470
  }
10468
10471
  ),
10469
10472
  O && /* @__PURE__ */ l.jsx(
@@ -10472,7 +10475,7 @@ const jb = B.memo(function({
10472
10475
  variant: "ghost",
10473
10476
  size: "sm",
10474
10477
  onClick: () => H("all"),
10475
- className: X("h-6 px-1 text-xs hover:bg-foreground/10", Z),
10478
+ className: X("h-6 px-1 text-xs hover:bg-foreground/10", J),
10476
10479
  "aria-label": "Copy all (may be large)",
10477
10480
  title: "Copy all (may be large)",
10478
10481
  children: "all"
@@ -10485,9 +10488,9 @@ const jb = B.memo(function({
10485
10488
  variant: "ghost",
10486
10489
  size: "sm",
10487
10490
  onClick: Q,
10488
- className: X("h-6 w-6 p-0 hover:bg-foreground/10", Z, K && "h-5 w-5"),
10491
+ className: X("h-6 w-6 p-0 hover:bg-foreground/10", J, K && "h-5 w-5"),
10489
10492
  "aria-label": "Edit message",
10490
- children: /* @__PURE__ */ l.jsx($a, { className: X(Z, K ? "h-3 w-3" : "h-4 w-4") })
10493
+ children: /* @__PURE__ */ l.jsx($a, { className: X(J, K ? "h-3 w-3" : "h-4 w-4") })
10491
10494
  }
10492
10495
  ),
10493
10496
  D === "assistant" && g && /* @__PURE__ */ l.jsx(
@@ -10496,9 +10499,9 @@ const jb = B.memo(function({
10496
10499
  variant: "ghost",
10497
10500
  size: "sm",
10498
10501
  onClick: le,
10499
- className: X("h-6 w-6 p-0 hover:bg-foreground/10", Z, K && "h-5 w-5"),
10502
+ className: X("h-6 w-6 p-0 hover:bg-foreground/10", J, K && "h-5 w-5"),
10500
10503
  "aria-label": "Regenerate response",
10501
- children: /* @__PURE__ */ l.jsx(ri, { className: X(Z, K ? "h-3 w-3" : "h-4 w-4") })
10504
+ children: /* @__PURE__ */ l.jsx(ri, { className: X(J, K ? "h-3 w-3" : "h-4 w-4") })
10502
10505
  }
10503
10506
  )
10504
10507
  ]
@@ -10692,7 +10695,7 @@ const Ql = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, wd = B.forwa
10692
10695
  }, w) => {
10693
10696
  const y = rt(null), R = rt(null), S = rt(!1), [C, k] = me(!0), E = Ye((I) => {
10694
10697
  k(I), g && g(!I), x && x(I);
10695
- }, [g, x]), N = Gt(() => {
10698
+ }, [g, x]), N = Yt(() => {
10696
10699
  if (a)
10697
10700
  return async () => {
10698
10701
  if (!S.current) {
@@ -10855,7 +10858,7 @@ function ms(e) {
10855
10858
  const t = p.useContext(Fb);
10856
10859
  return e || t || "ltr";
10857
10860
  }
10858
- const zb = ["top", "right", "bottom", "left"], Tn = Math.min, _t = Math.max, Lo = Math.round, lo = Math.floor, cn = (e) => ({
10861
+ const zb = ["top", "right", "bottom", "left"], Tn = Math.min, jt = Math.max, Lo = Math.round, lo = Math.floor, cn = (e) => ({
10859
10862
  x: e,
10860
10863
  y: e
10861
10864
  }), Bb = {
@@ -10868,7 +10871,7 @@ const zb = ["top", "right", "bottom", "left"], Tn = Math.min, _t = Math.max, Lo
10868
10871
  end: "start"
10869
10872
  };
10870
10873
  function yi(e, t, n) {
10871
- return _t(e, Tn(t, n));
10874
+ return jt(e, Tn(t, n));
10872
10875
  }
10873
10876
  function xn(e, t) {
10874
10877
  return typeof e == "function" ? e(t) : e;
@@ -11458,8 +11461,8 @@ const ny = function(e) {
11458
11461
  const w = v - d.top - d.bottom, y = b - d.left - d.right, R = Tn(v - d[g], w), S = Tn(b - d[x], y), C = !t.middlewareData.shift;
11459
11462
  let k = R, E = S;
11460
11463
  if ((n = t.middlewareData.shift) != null && n.enabled.x && (E = y), (r = t.middlewareData.shift) != null && r.enabled.y && (k = w), C && !h) {
11461
- const _ = _t(d.left, 0), I = _t(d.right, 0), F = _t(d.top, 0), V = _t(d.bottom, 0);
11462
- m ? E = b - 2 * (_ !== 0 || I !== 0 ? _ + I : _t(d.left, d.right)) : k = v - 2 * (F !== 0 || V !== 0 ? F + V : _t(d.top, d.bottom));
11464
+ const _ = jt(d.left, 0), I = jt(d.right, 0), F = jt(d.top, 0), V = jt(d.bottom, 0);
11465
+ m ? E = b - 2 * (_ !== 0 || I !== 0 ? _ + I : jt(d.left, d.right)) : k = v - 2 * (F !== 0 || V !== 0 ? F + V : jt(d.top, d.bottom));
11463
11466
  }
11464
11467
  await c({
11465
11468
  ...t,
@@ -11481,7 +11484,7 @@ function gs() {
11481
11484
  function xr(e) {
11482
11485
  return Sd(e) ? (e.nodeName || "").toLowerCase() : "#document";
11483
11486
  }
11484
- function Ot(e) {
11487
+ function Mt(e) {
11485
11488
  var t;
11486
11489
  return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
11487
11490
  }
@@ -11490,16 +11493,16 @@ function hn(e) {
11490
11493
  return (t = (Sd(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
11491
11494
  }
11492
11495
  function Sd(e) {
11493
- return gs() ? e instanceof Node || e instanceof Ot(e).Node : !1;
11496
+ return gs() ? e instanceof Node || e instanceof Mt(e).Node : !1;
11494
11497
  }
11495
- function Jt(e) {
11496
- return gs() ? e instanceof Element || e instanceof Ot(e).Element : !1;
11498
+ function Zt(e) {
11499
+ return gs() ? e instanceof Element || e instanceof Mt(e).Element : !1;
11497
11500
  }
11498
11501
  function un(e) {
11499
- return gs() ? e instanceof HTMLElement || e instanceof Ot(e).HTMLElement : !1;
11502
+ return gs() ? e instanceof HTMLElement || e instanceof Mt(e).HTMLElement : !1;
11500
11503
  }
11501
11504
  function sc(e) {
11502
- return !gs() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof Ot(e).ShadowRoot;
11505
+ return !gs() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof Mt(e).ShadowRoot;
11503
11506
  }
11504
11507
  const iy = /* @__PURE__ */ new Set(["inline", "contents"]);
11505
11508
  function Yr(e) {
@@ -11508,7 +11511,7 @@ function Yr(e) {
11508
11511
  overflowX: n,
11509
11512
  overflowY: r,
11510
11513
  display: o
11511
- } = Zt(e);
11514
+ } = Qt(e);
11512
11515
  return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !iy.has(o);
11513
11516
  }
11514
11517
  const ay = /* @__PURE__ */ new Set(["table", "td", "th"]);
@@ -11527,7 +11530,7 @@ function xs(e) {
11527
11530
  }
11528
11531
  const uy = ["transform", "translate", "scale", "rotate", "perspective"], dy = ["transform", "translate", "scale", "rotate", "perspective", "filter"], fy = ["paint", "layout", "strict", "content"];
11529
11532
  function pa(e) {
11530
- const t = ma(), n = Jt(e) ? Zt(e) : e;
11533
+ const t = ma(), n = Zt(e) ? Qt(e) : e;
11531
11534
  return uy.some((r) => n[r] ? n[r] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || dy.some((r) => (n.willChange || "").includes(r)) || fy.some((r) => (n.contain || "").includes(r));
11532
11535
  }
11533
11536
  function hy(e) {
@@ -11548,11 +11551,11 @@ const py = /* @__PURE__ */ new Set(["html", "body", "#document"]);
11548
11551
  function ur(e) {
11549
11552
  return py.has(xr(e));
11550
11553
  }
11551
- function Zt(e) {
11552
- return Ot(e).getComputedStyle(e);
11554
+ function Qt(e) {
11555
+ return Mt(e).getComputedStyle(e);
11553
11556
  }
11554
11557
  function vs(e) {
11555
- return Jt(e) ? {
11558
+ return Zt(e) ? {
11556
11559
  scrollLeft: e.scrollLeft,
11557
11560
  scrollTop: e.scrollTop
11558
11561
  } : {
@@ -11579,7 +11582,7 @@ function Cd(e) {
11579
11582
  function Fr(e, t, n) {
11580
11583
  var r;
11581
11584
  t === void 0 && (t = []), n === void 0 && (n = !0);
11582
- const o = Cd(e), s = o === ((r = e.ownerDocument) == null ? void 0 : r.body), i = Ot(o);
11585
+ const o = Cd(e), s = o === ((r = e.ownerDocument) == null ? void 0 : r.body), i = Mt(o);
11583
11586
  if (s) {
11584
11587
  const a = Ci(i);
11585
11588
  return t.concat(i, i.visualViewport || [], Yr(o) ? o : [], a && n ? Fr(a) : []);
@@ -11590,7 +11593,7 @@ function Ci(e) {
11590
11593
  return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
11591
11594
  }
11592
11595
  function Td(e) {
11593
- const t = Zt(e);
11596
+ const t = Qt(e);
11594
11597
  let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
11595
11598
  const o = un(e), s = o ? e.offsetWidth : n, i = o ? e.offsetHeight : r, a = Lo(n) !== s || Lo(r) !== i;
11596
11599
  return a && (n = s, r = i), {
@@ -11600,7 +11603,7 @@ function Td(e) {
11600
11603
  };
11601
11604
  }
11602
11605
  function ga(e) {
11603
- return Jt(e) ? e : e.contextElement;
11606
+ return Zt(e) ? e : e.contextElement;
11604
11607
  }
11605
11608
  function ir(e) {
11606
11609
  const t = ga(e);
@@ -11619,28 +11622,28 @@ function ir(e) {
11619
11622
  }
11620
11623
  const my = /* @__PURE__ */ cn(0);
11621
11624
  function Rd(e) {
11622
- const t = Ot(e);
11625
+ const t = Mt(e);
11623
11626
  return !ma() || !t.visualViewport ? my : {
11624
11627
  x: t.visualViewport.offsetLeft,
11625
11628
  y: t.visualViewport.offsetTop
11626
11629
  };
11627
11630
  }
11628
11631
  function gy(e, t, n) {
11629
- return t === void 0 && (t = !1), !n || t && n !== Ot(e) ? !1 : t;
11632
+ return t === void 0 && (t = !1), !n || t && n !== Mt(e) ? !1 : t;
11630
11633
  }
11631
11634
  function Wn(e, t, n, r) {
11632
11635
  t === void 0 && (t = !1), n === void 0 && (n = !1);
11633
11636
  const o = e.getBoundingClientRect(), s = ga(e);
11634
11637
  let i = cn(1);
11635
- t && (r ? Jt(r) && (i = ir(r)) : i = ir(e));
11638
+ t && (r ? Zt(r) && (i = ir(r)) : i = ir(e));
11636
11639
  const a = gy(s, n, r) ? Rd(s) : cn(0);
11637
11640
  let c = (o.left + a.x) / i.x, u = (o.top + a.y) / i.y, d = o.width / i.x, f = o.height / i.y;
11638
11641
  if (s) {
11639
- const h = Ot(s), m = r && Jt(r) ? Ot(r) : r;
11642
+ const h = Mt(s), m = r && Zt(r) ? Mt(r) : r;
11640
11643
  let b = h, v = Ci(b);
11641
11644
  for (; v && r && m !== b; ) {
11642
- const g = ir(v), x = v.getBoundingClientRect(), w = Zt(v), y = x.left + (v.clientLeft + parseFloat(w.paddingLeft)) * g.x, R = x.top + (v.clientTop + parseFloat(w.paddingTop)) * g.y;
11643
- c *= g.x, u *= g.y, d *= g.x, f *= g.y, c += y, u += R, b = Ot(v), v = Ci(b);
11645
+ const g = ir(v), x = v.getBoundingClientRect(), w = Qt(v), y = x.left + (v.clientLeft + parseFloat(w.paddingLeft)) * g.x, R = x.top + (v.clientTop + parseFloat(w.paddingTop)) * g.y;
11646
+ c *= g.x, u *= g.y, d *= g.x, f *= g.y, c += y, u += R, b = Mt(v), v = Ci(b);
11644
11647
  }
11645
11648
  }
11646
11649
  return Fo({
@@ -11696,10 +11699,10 @@ function vy(e) {
11696
11699
  return Array.from(e.getClientRects());
11697
11700
  }
11698
11701
  function wy(e) {
11699
- const t = hn(e), n = vs(e), r = e.ownerDocument.body, o = _t(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), s = _t(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
11702
+ const t = hn(e), n = vs(e), r = e.ownerDocument.body, o = jt(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), s = jt(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
11700
11703
  let i = -n.scrollLeft + xa(e);
11701
11704
  const a = -n.scrollTop;
11702
- return Zt(r).direction === "rtl" && (i += _t(t.clientWidth, r.clientWidth) - o), {
11705
+ return Qt(r).direction === "rtl" && (i += jt(t.clientWidth, r.clientWidth) - o), {
11703
11706
  width: o,
11704
11707
  height: s,
11705
11708
  x: i,
@@ -11707,7 +11710,7 @@ function wy(e) {
11707
11710
  };
11708
11711
  }
11709
11712
  function by(e, t) {
11710
- const n = Ot(e), r = hn(e), o = n.visualViewport;
11713
+ const n = Mt(e), r = hn(e), o = n.visualViewport;
11711
11714
  let s = r.clientWidth, i = r.clientHeight, a = 0, c = 0;
11712
11715
  if (o) {
11713
11716
  s = o.width, i = o.height;
@@ -11737,7 +11740,7 @@ function ic(e, t, n) {
11737
11740
  r = by(e, n);
11738
11741
  else if (t === "document")
11739
11742
  r = wy(hn(e));
11740
- else if (Jt(t))
11743
+ else if (Zt(t))
11741
11744
  r = Sy(t, n);
11742
11745
  else {
11743
11746
  const o = Rd(e);
@@ -11752,17 +11755,17 @@ function ic(e, t, n) {
11752
11755
  }
11753
11756
  function Ed(e, t) {
11754
11757
  const n = Rn(e);
11755
- return n === t || !Jt(n) || ur(n) ? !1 : Zt(n).position === "fixed" || Ed(n, t);
11758
+ return n === t || !Zt(n) || ur(n) ? !1 : Qt(n).position === "fixed" || Ed(n, t);
11756
11759
  }
11757
11760
  function Cy(e, t) {
11758
11761
  const n = t.get(e);
11759
11762
  if (n)
11760
11763
  return n;
11761
- let r = Fr(e, [], !1).filter((a) => Jt(a) && xr(a) !== "body"), o = null;
11762
- const s = Zt(e).position === "fixed";
11764
+ let r = Fr(e, [], !1).filter((a) => Zt(a) && xr(a) !== "body"), o = null;
11765
+ const s = Qt(e).position === "fixed";
11763
11766
  let i = s ? Rn(e) : e;
11764
- for (; Jt(i) && !ur(i); ) {
11765
- const a = Zt(i), c = pa(i);
11767
+ for (; Zt(i) && !ur(i); ) {
11768
+ const a = Qt(i), c = pa(i);
11766
11769
  !c && a.position === "fixed" && (o = null), (s ? !c && !o : !c && a.position === "static" && !!o && yy.has(o.position) || Yr(i) && !c && Ed(e, i)) ? r = r.filter((d) => d !== i) : o = a, i = Rn(i);
11767
11770
  }
11768
11771
  return t.set(e, r), r;
@@ -11776,7 +11779,7 @@ function Ty(e) {
11776
11779
  } = e;
11777
11780
  const i = [...n === "clippingAncestors" ? xs(t) ? [] : Cy(t, this._c) : [].concat(n), r], a = i[0], c = i.reduce((u, d) => {
11778
11781
  const f = ic(t, d, o);
11779
- return u.top = _t(f.top, u.top), u.right = Tn(f.right, u.right), u.bottom = Tn(f.bottom, u.bottom), u.left = _t(f.left, u.left), u;
11782
+ return u.top = jt(f.top, u.top), u.right = Tn(f.right, u.right), u.bottom = Tn(f.bottom, u.bottom), u.left = jt(f.left, u.left), u;
11780
11783
  }, ic(t, a, o));
11781
11784
  return {
11782
11785
  width: c.right - c.left,
@@ -11820,10 +11823,10 @@ function ky(e, t, n) {
11820
11823
  };
11821
11824
  }
11822
11825
  function Zs(e) {
11823
- return Zt(e).position === "static";
11826
+ return Qt(e).position === "static";
11824
11827
  }
11825
11828
  function ac(e, t) {
11826
- if (!un(e) || Zt(e).position === "fixed")
11829
+ if (!un(e) || Qt(e).position === "fixed")
11827
11830
  return null;
11828
11831
  if (t)
11829
11832
  return t(e);
@@ -11831,13 +11834,13 @@ function ac(e, t) {
11831
11834
  return hn(e) === n && (n = n.ownerDocument.body), n;
11832
11835
  }
11833
11836
  function Id(e, t) {
11834
- const n = Ot(e);
11837
+ const n = Mt(e);
11835
11838
  if (xs(e))
11836
11839
  return n;
11837
11840
  if (!un(e)) {
11838
11841
  let o = Rn(e);
11839
11842
  for (; o && !ur(o); ) {
11840
- if (Jt(o) && !Zs(o))
11843
+ if (Zt(o) && !Zs(o))
11841
11844
  return o;
11842
11845
  o = Rn(o);
11843
11846
  }
@@ -11861,7 +11864,7 @@ const Ey = async function(e) {
11861
11864
  };
11862
11865
  };
11863
11866
  function Iy(e) {
11864
- return Zt(e).direction === "rtl";
11867
+ return Qt(e).direction === "rtl";
11865
11868
  }
11866
11869
  const Ny = {
11867
11870
  convertOffsetParentRelativeRectToViewportRelativeRect: xy,
@@ -11872,7 +11875,7 @@ const Ny = {
11872
11875
  getClientRects: vy,
11873
11876
  getDimensions: Ry,
11874
11877
  getScale: ir,
11875
- isElement: Jt,
11878
+ isElement: Zt,
11876
11879
  isRTL: Iy
11877
11880
  };
11878
11881
  function Nd(e, t) {
@@ -11897,7 +11900,7 @@ function Ay(e, t) {
11897
11900
  return;
11898
11901
  const b = lo(f), v = lo(o.clientWidth - (d + h)), g = lo(o.clientHeight - (f + m)), x = lo(d), y = {
11899
11902
  rootMargin: -b + "px " + -v + "px " + -g + "px " + -x + "px",
11900
- threshold: _t(0, Tn(1, c)) || 1
11903
+ threshold: jt(0, Tn(1, c)) || 1
11901
11904
  };
11902
11905
  let R = !0;
11903
11906
  function S(C) {
@@ -12270,11 +12273,11 @@ var wa = "PopperContent", [Qy, e0] = Pd(wa), $d = p.forwardRef(
12270
12273
  r0({ arrowWidth: k, arrowHeight: E }),
12271
12274
  h && Gy({ strategy: "referenceHidden", ...V })
12272
12275
  ]
12273
- }), [O, ie] = Bd(W), Z = gt(b);
12276
+ }), [O, ie] = Bd(W), J = gt(b);
12274
12277
  mt(() => {
12275
- K && (Z == null || Z());
12276
- }, [K, Z]);
12277
- const ee = (L = D.arrow) == null ? void 0 : L.x, M = (j = D.arrow) == null ? void 0 : j.y, J = ((H = D.arrow) == null ? void 0 : H.centerOffset) !== 0, [Re, fe] = p.useState();
12278
+ K && (J == null || J());
12279
+ }, [K, J]);
12280
+ const ee = (L = D.arrow) == null ? void 0 : L.x, M = (j = D.arrow) == null ? void 0 : j.y, Z = ((H = D.arrow) == null ? void 0 : H.centerOffset) !== 0, [Re, fe] = p.useState();
12278
12281
  return mt(() => {
12279
12282
  x && fe(window.getComputedStyle(x).zIndex);
12280
12283
  }, [x]), /* @__PURE__ */ l.jsx(
@@ -12309,7 +12312,7 @@ var wa = "PopperContent", [Qy, e0] = Pd(wa), $d = p.forwardRef(
12309
12312
  onArrowChange: S,
12310
12313
  arrowX: ee,
12311
12314
  arrowY: M,
12312
- shouldHideArrow: J,
12315
+ shouldHideArrow: Z,
12313
12316
  children: /* @__PURE__ */ l.jsx(
12314
12317
  Ce.div,
12315
12318
  {
@@ -12617,17 +12620,17 @@ var ya = "MenuPortal", [R0, nf] = Xn(ya, {
12617
12620
  forceMount: void 0
12618
12621
  }), rf = (e) => {
12619
12622
  const { __scopeMenu: t, forceMount: n, children: r, container: o } = e, s = Jn(ya, t);
12620
- return /* @__PURE__ */ l.jsx(R0, { scope: t, forceMount: n, children: /* @__PURE__ */ l.jsx(Mt, { present: n || s.open, children: /* @__PURE__ */ l.jsx(ls, { asChild: !0, container: o, children: r }) }) });
12623
+ return /* @__PURE__ */ l.jsx(R0, { scope: t, forceMount: n, children: /* @__PURE__ */ l.jsx(Dt, { present: n || s.open, children: /* @__PURE__ */ l.jsx(ls, { asChild: !0, container: o, children: r }) }) });
12621
12624
  };
12622
12625
  rf.displayName = ya;
12623
- var Wt = "MenuContent", [k0, Sa] = Xn(Wt), of = p.forwardRef(
12626
+ var Vt = "MenuContent", [k0, Sa] = Xn(Vt), of = p.forwardRef(
12624
12627
  (e, t) => {
12625
- const n = nf(Wt, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = Jn(Wt, e.__scopeMenu), i = Zr(Wt, e.__scopeMenu);
12626
- return /* @__PURE__ */ l.jsx(zr.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ l.jsx(Mt, { present: r || s.open, children: /* @__PURE__ */ l.jsx(zr.Slot, { scope: e.__scopeMenu, children: i.modal ? /* @__PURE__ */ l.jsx(E0, { ...o, ref: t }) : /* @__PURE__ */ l.jsx(I0, { ...o, ref: t }) }) }) });
12628
+ const n = nf(Vt, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = Jn(Vt, e.__scopeMenu), i = Zr(Vt, e.__scopeMenu);
12629
+ return /* @__PURE__ */ l.jsx(zr.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ l.jsx(Dt, { present: r || s.open, children: /* @__PURE__ */ l.jsx(zr.Slot, { scope: e.__scopeMenu, children: i.modal ? /* @__PURE__ */ l.jsx(E0, { ...o, ref: t }) : /* @__PURE__ */ l.jsx(I0, { ...o, ref: t }) }) }) });
12627
12630
  }
12628
12631
  ), E0 = p.forwardRef(
12629
12632
  (e, t) => {
12630
- const n = Jn(Wt, e.__scopeMenu), r = p.useRef(null), o = Me(t, r);
12633
+ const n = Jn(Vt, e.__scopeMenu), r = p.useRef(null), o = Me(t, r);
12631
12634
  return p.useEffect(() => {
12632
12635
  const s = r.current;
12633
12636
  if (s) return ia(s);
@@ -12649,7 +12652,7 @@ var Wt = "MenuContent", [k0, Sa] = Xn(Wt), of = p.forwardRef(
12649
12652
  );
12650
12653
  }
12651
12654
  ), I0 = p.forwardRef((e, t) => {
12652
- const n = Jn(Wt, e.__scopeMenu);
12655
+ const n = Jn(Vt, e.__scopeMenu);
12653
12656
  return /* @__PURE__ */ l.jsx(
12654
12657
  Ca,
12655
12658
  {
@@ -12678,17 +12681,17 @@ var Wt = "MenuContent", [k0, Sa] = Xn(Wt), of = p.forwardRef(
12678
12681
  onDismiss: m,
12679
12682
  disableOutsideScroll: b,
12680
12683
  ...v
12681
- } = e, g = Jn(Wt, n), x = Zr(Wt, n), w = bs(n), y = ef(n), R = b0(n), [S, C] = p.useState(null), k = p.useRef(null), E = Me(t, k, g.onContentChange), N = p.useRef(0), _ = p.useRef(""), I = p.useRef(0), F = p.useRef(null), V = p.useRef("right"), P = p.useRef(0), G = b ? us : p.Fragment, W = b ? { as: N0, allowPinchZoom: !0 } : void 0, K = (O) => {
12684
+ } = e, g = Jn(Vt, n), x = Zr(Vt, n), w = bs(n), y = ef(n), R = b0(n), [S, C] = p.useState(null), k = p.useRef(null), E = Me(t, k, g.onContentChange), N = p.useRef(0), _ = p.useRef(""), I = p.useRef(0), F = p.useRef(null), V = p.useRef("right"), P = p.useRef(0), G = b ? us : p.Fragment, W = b ? { as: N0, allowPinchZoom: !0 } : void 0, K = (O) => {
12682
12685
  var L, j;
12683
- const ie = _.current + O, Z = R().filter((H) => !H.disabled), ee = document.activeElement, M = (L = Z.find((H) => H.ref.current === ee)) == null ? void 0 : L.textValue, J = Z.map((H) => H.textValue), Re = B0(J, ie, M), fe = (j = Z.find((H) => H.textValue === Re)) == null ? void 0 : j.ref.current;
12686
+ const ie = _.current + O, J = R().filter((H) => !H.disabled), ee = document.activeElement, M = (L = J.find((H) => H.ref.current === ee)) == null ? void 0 : L.textValue, Z = J.map((H) => H.textValue), Re = B0(Z, ie, M), fe = (j = J.find((H) => H.textValue === Re)) == null ? void 0 : j.ref.current;
12684
12687
  (function H(Q) {
12685
12688
  _.current = Q, window.clearTimeout(N.current), Q !== "" && (N.current = window.setTimeout(() => H(""), 1e3));
12686
12689
  })(ie), fe && setTimeout(() => fe.focus());
12687
12690
  };
12688
12691
  p.useEffect(() => () => window.clearTimeout(N.current), []), sa();
12689
12692
  const D = p.useCallback((O) => {
12690
- var Z, ee;
12691
- return V.current === ((Z = F.current) == null ? void 0 : Z.side) && U0(O, (ee = F.current) == null ? void 0 : ee.area);
12693
+ var J, ee;
12694
+ return V.current === ((J = F.current) == null ? void 0 : J.side) && U0(O, (ee = F.current) == null ? void 0 : ee.area);
12692
12695
  }, []);
12693
12696
  return /* @__PURE__ */ l.jsx(
12694
12697
  k0,
@@ -12765,10 +12768,10 @@ var Wt = "MenuContent", [k0, Sa] = Xn(Wt), of = p.forwardRef(
12765
12768
  ref: E,
12766
12769
  style: { outline: "none", ...v.style },
12767
12770
  onKeyDown: ae(v.onKeyDown, (O) => {
12768
- const Z = O.target.closest("[data-radix-menu-content]") === O.currentTarget, ee = O.ctrlKey || O.altKey || O.metaKey, M = O.key.length === 1;
12769
- Z && (O.key === "Tab" && O.preventDefault(), !ee && M && K(O.key));
12770
- const J = k.current;
12771
- if (O.target !== J || !x0.includes(O.key)) return;
12771
+ const J = O.target.closest("[data-radix-menu-content]") === O.currentTarget, ee = O.ctrlKey || O.altKey || O.metaKey, M = O.key.length === 1;
12772
+ J && (O.key === "Tab" && O.preventDefault(), !ee && M && K(O.key));
12773
+ const Z = k.current;
12774
+ if (O.target !== Z || !x0.includes(O.key)) return;
12772
12775
  O.preventDefault();
12773
12776
  const fe = R().filter((L) => !L.disabled).map((L) => L.ref.current);
12774
12777
  Zd.includes(O.key) && fe.reverse(), F0(fe);
@@ -12779,8 +12782,8 @@ var Wt = "MenuContent", [k0, Sa] = Xn(Wt), of = p.forwardRef(
12779
12782
  onPointerMove: ae(
12780
12783
  e.onPointerMove,
12781
12784
  Br((O) => {
12782
- const ie = O.target, Z = P.current !== O.clientX;
12783
- if (O.currentTarget.contains(ie) && Z) {
12785
+ const ie = O.target, J = P.current !== O.clientX;
12786
+ if (O.currentTarget.contains(ie) && J) {
12784
12787
  const ee = O.clientX > P.current ? "right" : "left";
12785
12788
  V.current = ee, P.current = O.clientX;
12786
12789
  }
@@ -12798,7 +12801,7 @@ var Wt = "MenuContent", [k0, Sa] = Xn(Wt), of = p.forwardRef(
12798
12801
  );
12799
12802
  }
12800
12803
  );
12801
- of.displayName = Wt;
12804
+ of.displayName = Vt;
12802
12805
  var A0 = "MenuGroup", Ta = p.forwardRef(
12803
12806
  (e, t) => {
12804
12807
  const { __scopeMenu: n, ...r } = e;
@@ -12947,7 +12950,7 @@ var Ra = "MenuItemIndicator", [hf, M0] = Xn(
12947
12950
  (e, t) => {
12948
12951
  const { __scopeMenu: n, forceMount: r, ...o } = e, s = M0(Ra, n);
12949
12952
  return /* @__PURE__ */ l.jsx(
12950
- Mt,
12953
+ Dt,
12951
12954
  {
12952
12955
  present: r || Ho(s.checked) || s.checked === !0,
12953
12956
  children: /* @__PURE__ */ l.jsx(
@@ -13058,8 +13061,8 @@ var $0 = "MenuSub", [yT, xf] = Xn($0), Er = "MenuSubTrigger", vf = p.forwardRef(
13058
13061
  vf.displayName = Er;
13059
13062
  var wf = "MenuSubContent", bf = p.forwardRef(
13060
13063
  (e, t) => {
13061
- const n = nf(Wt, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = Jn(Wt, e.__scopeMenu), i = Zr(Wt, e.__scopeMenu), a = xf(wf, e.__scopeMenu), c = p.useRef(null), u = Me(t, c);
13062
- return /* @__PURE__ */ l.jsx(zr.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ l.jsx(Mt, { present: r || s.open, children: /* @__PURE__ */ l.jsx(zr.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ l.jsx(
13064
+ const n = nf(Vt, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = Jn(Vt, e.__scopeMenu), i = Zr(Vt, e.__scopeMenu), a = xf(wf, e.__scopeMenu), c = p.useRef(null), u = Me(t, c);
13065
+ return /* @__PURE__ */ l.jsx(zr.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ l.jsx(Dt, { present: r || s.open, children: /* @__PURE__ */ l.jsx(zr.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ l.jsx(
13063
13066
  Ca,
13064
13067
  {
13065
13068
  id: a.contentId,
@@ -13455,7 +13458,7 @@ function ti({
13455
13458
  isLoadingHistory: I,
13456
13459
  loadOlderMessages: F,
13457
13460
  api: V
13458
- } = Fi(), [P, G] = me(null), [W, K] = me(""), [D, O] = me(null), [ie, Z] = me([]), [ee, M] = me(!1), [J, Re] = me(null), [fe, L] = me(null), [j, H] = me(!1), [Q, le] = me(null), [oe, $e] = me([]), [De, ve] = me(null), [ke, Be] = me(null), [Ze, qe] = me(!1), dt = rt(null), ft = rt(null), ce = rt(null), [ue, he] = me("desktop");
13461
+ } = Fi(), [P, G] = me(null), [W, K] = me(""), [D, O] = me(null), [ie, J] = me([]), [ee, M] = me(!1), [Z, Re] = me(null), [fe, L] = me(null), [j, H] = me(!1), [Q, le] = me(null), [oe, $e] = me([]), [De, ve] = me(null), [ke, Be] = me(null), [Ze, qe] = me(!1), dt = rt(null), ft = rt(null), ce = rt(null), [ue, he] = me("desktop");
13459
13462
  ct(() => {
13460
13463
  const te = () => {
13461
13464
  const pe = window.innerWidth;
@@ -13474,20 +13477,20 @@ function ti({
13474
13477
  checkpointNs: C ?? null
13475
13478
  }, je = ce.current;
13476
13479
  if (!(je && je.threadId === pe.threadId && je.checkpointId === pe.checkpointId && je.checkpointNs === pe.checkpointNs))
13477
- return k(b).then((ze) => {
13480
+ return k(b).then((Fe) => {
13478
13481
  var yr;
13479
13482
  if (te) return;
13480
- const Lt = ((ze == null ? void 0 : ze.checkpoints) ?? []).slice().sort((mn, Sr) => new Date(Sr.createdAt).getTime() - new Date(mn.createdAt).getTime());
13481
- $e(Lt);
13482
- const tn = De, wr = tn && Lt.some((mn) => mn.checkpointId === tn) ? tn : ((yr = Lt[0]) == null ? void 0 : yr.checkpointId) ?? null;
13483
+ const $t = ((Fe == null ? void 0 : Fe.checkpoints) ?? []).slice().sort((mn, Sr) => new Date(Sr.createdAt).getTime() - new Date(mn.createdAt).getTime());
13484
+ $e($t);
13485
+ const _t = De, wr = _t && $t.some((mn) => mn.checkpointId === _t) ? _t : ((yr = $t[0]) == null ? void 0 : yr.checkpointId) ?? null;
13483
13486
  let br = null;
13484
13487
  if (wr) {
13485
- const mn = Lt.find((Sr) => Sr.checkpointId === wr);
13488
+ const mn = $t.find((Sr) => Sr.checkpointId === wr);
13486
13489
  br = (mn == null ? void 0 : mn.checkpointNs) ?? null;
13487
13490
  }
13488
13491
  ve(wr), Be(br), ce.current = pe;
13489
- }).catch((ze) => {
13490
- console.error("ChatInterface - listCheckpoints error:", ze), te || ($e([]), ce.current = null);
13492
+ }).catch((Fe) => {
13493
+ console.error("ChatInterface - listCheckpoints error:", Fe), te || ($e([]), ce.current = null);
13491
13494
  }), () => {
13492
13495
  te = !0;
13493
13496
  };
@@ -13542,10 +13545,10 @@ function ti({
13542
13545
  checkpointNs: ke ?? C ?? void 0,
13543
13546
  payloadExtras: P ? { edit: !0, originalMessageId: P } : void 0,
13544
13547
  attachments: ie
13545
- }), f == null || f(pe), O(null), Z([]), G(null), K("");
13548
+ }), f == null || f(pe), O(null), J([]), G(null), K("");
13546
13549
  } catch (je) {
13547
- const ze = (je == null ? void 0 : je.message) || "Failed to send message";
13548
- O(ze), m == null || m(ze);
13550
+ const Fe = (je == null ? void 0 : je.message) || "Failed to send message";
13551
+ O(Fe), m == null || m(Fe);
13549
13552
  }
13550
13553
  }
13551
13554
  }, $ = B.useCallback((te, pe) => {
@@ -13556,18 +13559,18 @@ function ti({
13556
13559
  $(te, pe);
13557
13560
  }, [$]), tt = Ye((te) => {
13558
13561
  const pe = (je) => {
13559
- const ze = je.content || [], Lt = ze.filter((tn) => tn.type === "text").map((tn) => tn.text).join("");
13560
- if (Lt) return Lt;
13562
+ const Fe = je.content || [], $t = Fe.filter((_t) => _t.type === "text").map((_t) => _t.text).join("");
13563
+ if ($t) return $t;
13561
13564
  try {
13562
- return JSON.stringify(ze, null, 2);
13565
+ return JSON.stringify(Fe, null, 2);
13563
13566
  } catch {
13564
- return String(ze);
13567
+ return String(Fe);
13565
13568
  }
13566
13569
  };
13567
13570
  for (let je = te - 1; je >= 0; je--)
13568
13571
  if (v[je].role === "user") {
13569
- const ze = pe(v[je]);
13570
- ze && y(ze, {
13572
+ const Fe = pe(v[je]);
13573
+ Fe && y(Fe, {
13571
13574
  checkpointId: De ?? S ?? void 0,
13572
13575
  checkpointNs: ke ?? C ?? void 0
13573
13576
  });
@@ -13575,8 +13578,8 @@ function ti({
13575
13578
  }
13576
13579
  }, [v, y, De, ke, S, C]), Ne = (te) => {
13577
13580
  const pe = Array.from(te.target.files || []);
13578
- Z((je) => [...je, ...pe]);
13579
- }, at = (te) => Z((pe) => pe.filter((je, ze) => te !== ze)), Dt = async (te) => {
13581
+ J((je) => [...je, ...pe]);
13582
+ }, at = (te) => J((pe) => pe.filter((je, Fe) => te !== Fe)), Lt = async (te) => {
13580
13583
  const pe = (te.target.files || [])[0];
13581
13584
  if (pe) {
13582
13585
  Re(null), L(null), M(!0);
@@ -13589,8 +13592,8 @@ function ti({
13589
13592
  const je = `Uploaded ${pe.name} - processing through chat stream`;
13590
13593
  L(je);
13591
13594
  } catch (je) {
13592
- const ze = je instanceof Error ? je.message : "Failed to upload Excel file";
13593
- console.error("Excel upload failed", je), Re(ze), m == null || m(ze);
13595
+ const Fe = je instanceof Error ? je.message : "Failed to upload Excel file";
13596
+ console.error("Excel upload failed", je), Re(Fe), m == null || m(Fe);
13594
13597
  } finally {
13595
13598
  M(!1), te.target.value = "";
13596
13599
  }
@@ -13607,7 +13610,7 @@ function ti({
13607
13610
  await N(), ve(null), Be(null);
13608
13611
  return;
13609
13612
  }
13610
- const pe = oe.find((ze) => ze.checkpointId === te), je = (pe == null ? void 0 : pe.checkpointNs) ?? null;
13613
+ const pe = oe.find((Fe) => Fe.checkpointId === te), je = (pe == null ? void 0 : pe.checkpointNs) ?? null;
13611
13614
  await E(te, je), ve(te), Be(je);
13612
13615
  } finally {
13613
13616
  qe(!1);
@@ -13725,7 +13728,7 @@ function ti({
13725
13728
  ref: ft,
13726
13729
  type: "file",
13727
13730
  accept: ".xls,.xlsx,.xlsm",
13728
- onChange: Dt,
13731
+ onChange: Lt,
13729
13732
  className: "hidden"
13730
13733
  }
13731
13734
  ),
@@ -13734,7 +13737,7 @@ function ti({
13734
13737
  " Uploading Excel file..."
13735
13738
  ] }),
13736
13739
  fe && !ee && /* @__PURE__ */ l.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: fe }),
13737
- J && !ee && /* @__PURE__ */ l.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: J })
13740
+ Z && !ee && /* @__PURE__ */ l.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: Z })
13738
13741
  ] })
13739
13742
  ] }),
13740
13743
  D && /* @__PURE__ */ l.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: D }),
@@ -13817,7 +13820,7 @@ function Ei(e, [t, n]) {
13817
13820
  function PS(e, t) {
13818
13821
  return p.useReducer((n, r) => t[n][r] ?? n, e);
13819
13822
  }
13820
- var Ea = "ScrollArea", [qf, CT] = fn(Ea), [OS, Kt] = qf(Ea), Gf = p.forwardRef(
13823
+ var Ea = "ScrollArea", [qf, CT] = fn(Ea), [OS, qt] = qf(Ea), Gf = p.forwardRef(
13821
13824
  (e, t) => {
13822
13825
  const {
13823
13826
  __scopeScrollArea: n,
@@ -13870,7 +13873,7 @@ var Ea = "ScrollArea", [qf, CT] = fn(Ea), [OS, Kt] = qf(Ea), Gf = p.forwardRef(
13870
13873
  Gf.displayName = Ea;
13871
13874
  var Yf = "ScrollAreaViewport", Xf = p.forwardRef(
13872
13875
  (e, t) => {
13873
- const { __scopeScrollArea: n, children: r, nonce: o, ...s } = e, i = Kt(Yf, n), a = p.useRef(null), c = Me(t, a, i.onViewportChange);
13876
+ const { __scopeScrollArea: n, children: r, nonce: o, ...s } = e, i = qt(Yf, n), a = p.useRef(null), c = Me(t, a, i.onViewportChange);
13874
13877
  return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
13875
13878
  /* @__PURE__ */ l.jsx(
13876
13879
  "style",
@@ -13912,7 +13915,7 @@ var Yf = "ScrollAreaViewport", Xf = p.forwardRef(
13912
13915
  Xf.displayName = Yf;
13913
13916
  var pn = "ScrollAreaScrollbar", Ia = p.forwardRef(
13914
13917
  (e, t) => {
13915
- const { forceMount: n, ...r } = e, o = Kt(pn, e.__scopeScrollArea), { onScrollbarXEnabledChange: s, onScrollbarYEnabledChange: i } = o, a = e.orientation === "horizontal";
13918
+ const { forceMount: n, ...r } = e, o = qt(pn, e.__scopeScrollArea), { onScrollbarXEnabledChange: s, onScrollbarYEnabledChange: i } = o, a = e.orientation === "horizontal";
13916
13919
  return p.useEffect(() => (a ? s(!0) : i(!0), () => {
13917
13920
  a ? s(!1) : i(!1);
13918
13921
  }), [a, s, i]), o.type === "hover" ? /* @__PURE__ */ l.jsx(MS, { ...r, ref: t, forceMount: n }) : o.type === "scroll" ? /* @__PURE__ */ l.jsx(DS, { ...r, ref: t, forceMount: n }) : o.type === "auto" ? /* @__PURE__ */ l.jsx(Jf, { ...r, ref: t, forceMount: n }) : o.type === "always" ? /* @__PURE__ */ l.jsx(Na, { ...r, ref: t }) : null;
@@ -13920,7 +13923,7 @@ var pn = "ScrollAreaScrollbar", Ia = p.forwardRef(
13920
13923
  );
13921
13924
  Ia.displayName = pn;
13922
13925
  var MS = p.forwardRef((e, t) => {
13923
- const { forceMount: n, ...r } = e, o = Kt(pn, e.__scopeScrollArea), [s, i] = p.useState(!1);
13926
+ const { forceMount: n, ...r } = e, o = qt(pn, e.__scopeScrollArea), [s, i] = p.useState(!1);
13924
13927
  return p.useEffect(() => {
13925
13928
  const a = o.scrollArea;
13926
13929
  let c = 0;
@@ -13934,7 +13937,7 @@ var MS = p.forwardRef((e, t) => {
13934
13937
  window.clearTimeout(c), a.removeEventListener("pointerenter", u), a.removeEventListener("pointerleave", d);
13935
13938
  };
13936
13939
  }
13937
- }, [o.scrollArea, o.scrollHideDelay]), /* @__PURE__ */ l.jsx(Mt, { present: n || s, children: /* @__PURE__ */ l.jsx(
13940
+ }, [o.scrollArea, o.scrollHideDelay]), /* @__PURE__ */ l.jsx(Dt, { present: n || s, children: /* @__PURE__ */ l.jsx(
13938
13941
  Jf,
13939
13942
  {
13940
13943
  "data-state": s ? "visible" : "hidden",
@@ -13943,7 +13946,7 @@ var MS = p.forwardRef((e, t) => {
13943
13946
  }
13944
13947
  ) });
13945
13948
  }), DS = p.forwardRef((e, t) => {
13946
- const { forceMount: n, ...r } = e, o = Kt(pn, e.__scopeScrollArea), s = e.orientation === "horizontal", i = Ts(() => c("SCROLL_END"), 100), [a, c] = PS("hidden", {
13949
+ const { forceMount: n, ...r } = e, o = qt(pn, e.__scopeScrollArea), s = e.orientation === "horizontal", i = Ts(() => c("SCROLL_END"), 100), [a, c] = PS("hidden", {
13947
13950
  hidden: {
13948
13951
  SCROLL: "scrolling"
13949
13952
  },
@@ -13976,7 +13979,7 @@ var MS = p.forwardRef((e, t) => {
13976
13979
  };
13977
13980
  return u.addEventListener("scroll", h), () => u.removeEventListener("scroll", h);
13978
13981
  }
13979
- }, [o.viewport, s, c, i]), /* @__PURE__ */ l.jsx(Mt, { present: n || a !== "hidden", children: /* @__PURE__ */ l.jsx(
13982
+ }, [o.viewport, s, c, i]), /* @__PURE__ */ l.jsx(Dt, { present: n || a !== "hidden", children: /* @__PURE__ */ l.jsx(
13980
13983
  Na,
13981
13984
  {
13982
13985
  "data-state": a === "hidden" ? "hidden" : "visible",
@@ -13987,13 +13990,13 @@ var MS = p.forwardRef((e, t) => {
13987
13990
  }
13988
13991
  ) });
13989
13992
  }), Jf = p.forwardRef((e, t) => {
13990
- const n = Kt(pn, e.__scopeScrollArea), { forceMount: r, ...o } = e, [s, i] = p.useState(!1), a = e.orientation === "horizontal", c = Ts(() => {
13993
+ const n = qt(pn, e.__scopeScrollArea), { forceMount: r, ...o } = e, [s, i] = p.useState(!1), a = e.orientation === "horizontal", c = Ts(() => {
13991
13994
  if (n.viewport) {
13992
13995
  const u = n.viewport.offsetWidth < n.viewport.scrollWidth, d = n.viewport.offsetHeight < n.viewport.scrollHeight;
13993
13996
  i(a ? u : d);
13994
13997
  }
13995
13998
  }, 10);
13996
- return dr(n.viewport, c), dr(n.content, c), /* @__PURE__ */ l.jsx(Mt, { present: r || s, children: /* @__PURE__ */ l.jsx(
13999
+ return dr(n.viewport, c), dr(n.content, c), /* @__PURE__ */ l.jsx(Dt, { present: r || s, children: /* @__PURE__ */ l.jsx(
13997
14000
  Na,
13998
14001
  {
13999
14002
  "data-state": s ? "visible" : "hidden",
@@ -14002,7 +14005,7 @@ var MS = p.forwardRef((e, t) => {
14002
14005
  }
14003
14006
  ) });
14004
14007
  }), Na = p.forwardRef((e, t) => {
14005
- const { orientation: n = "vertical", ...r } = e, o = Kt(pn, e.__scopeScrollArea), s = p.useRef(null), i = p.useRef(0), [a, c] = p.useState({
14008
+ const { orientation: n = "vertical", ...r } = e, o = qt(pn, e.__scopeScrollArea), s = p.useRef(null), i = p.useRef(0), [a, c] = p.useState({
14006
14009
  content: 0,
14007
14010
  viewport: 0,
14008
14011
  scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
@@ -14056,7 +14059,7 @@ var MS = p.forwardRef((e, t) => {
14056
14059
  }
14057
14060
  ) : null;
14058
14061
  }), LS = p.forwardRef((e, t) => {
14059
- const { sizes: n, onSizesChange: r, ...o } = e, s = Kt(pn, e.__scopeScrollArea), [i, a] = p.useState(), c = p.useRef(null), u = Me(t, c, s.onScrollbarXChange);
14062
+ const { sizes: n, onSizesChange: r, ...o } = e, s = qt(pn, e.__scopeScrollArea), [i, a] = p.useState(), c = p.useRef(null), u = Me(t, c, s.onScrollbarXChange);
14060
14063
  return p.useEffect(() => {
14061
14064
  c.current && a(getComputedStyle(c.current));
14062
14065
  }, [c]), /* @__PURE__ */ l.jsx(
@@ -14095,7 +14098,7 @@ var MS = p.forwardRef((e, t) => {
14095
14098
  }
14096
14099
  );
14097
14100
  }), $S = p.forwardRef((e, t) => {
14098
- const { sizes: n, onSizesChange: r, ...o } = e, s = Kt(pn, e.__scopeScrollArea), [i, a] = p.useState(), c = p.useRef(null), u = Me(t, c, s.onScrollbarYChange);
14101
+ const { sizes: n, onSizesChange: r, ...o } = e, s = qt(pn, e.__scopeScrollArea), [i, a] = p.useState(), c = p.useRef(null), u = Me(t, c, s.onScrollbarYChange);
14099
14102
  return p.useEffect(() => {
14100
14103
  c.current && a(getComputedStyle(c.current));
14101
14104
  }, [c]), /* @__PURE__ */ l.jsx(
@@ -14147,7 +14150,7 @@ var MS = p.forwardRef((e, t) => {
14147
14150
  onWheelScroll: d,
14148
14151
  onResize: f,
14149
14152
  ...h
14150
- } = e, m = Kt(pn, n), [b, v] = p.useState(null), g = Me(t, (N) => v(N)), x = p.useRef(null), w = p.useRef(""), y = m.viewport, R = r.content - r.viewport, S = gt(d), C = gt(c), k = Ts(f, 10);
14153
+ } = e, m = qt(pn, n), [b, v] = p.useState(null), g = Me(t, (N) => v(N)), x = p.useRef(null), w = p.useRef(""), y = m.viewport, R = r.content - r.viewport, S = gt(d), C = gt(c), k = Ts(f, 10);
14151
14154
  function E(N) {
14152
14155
  if (x.current) {
14153
14156
  const _ = N.clientX - x.current.left, I = N.clientY - x.current.top;
@@ -14191,11 +14194,11 @@ var MS = p.forwardRef((e, t) => {
14191
14194
  }), Wo = "ScrollAreaThumb", eh = p.forwardRef(
14192
14195
  (e, t) => {
14193
14196
  const { forceMount: n, ...r } = e, o = Zf(Wo, e.__scopeScrollArea);
14194
- return /* @__PURE__ */ l.jsx(Mt, { present: n || o.hasThumb, children: /* @__PURE__ */ l.jsx(zS, { ref: t, ...r }) });
14197
+ return /* @__PURE__ */ l.jsx(Dt, { present: n || o.hasThumb, children: /* @__PURE__ */ l.jsx(zS, { ref: t, ...r }) });
14195
14198
  }
14196
14199
  ), zS = p.forwardRef(
14197
14200
  (e, t) => {
14198
- const { __scopeScrollArea: n, style: r, ...o } = e, s = Kt(Wo, n), i = Zf(Wo, n), { onThumbPositionChange: a } = i, c = Me(
14201
+ const { __scopeScrollArea: n, style: r, ...o } = e, s = qt(Wo, n), i = Zf(Wo, n), { onThumbPositionChange: a } = i, c = Me(
14199
14202
  t,
14200
14203
  (f) => i.onThumbChange(f)
14201
14204
  ), u = p.useRef(void 0), d = Ts(() => {
@@ -14235,13 +14238,13 @@ var MS = p.forwardRef((e, t) => {
14235
14238
  eh.displayName = Wo;
14236
14239
  var Aa = "ScrollAreaCorner", th = p.forwardRef(
14237
14240
  (e, t) => {
14238
- const n = Kt(Aa, e.__scopeScrollArea), r = !!(n.scrollbarX && n.scrollbarY);
14241
+ const n = qt(Aa, e.__scopeScrollArea), r = !!(n.scrollbarX && n.scrollbarY);
14239
14242
  return n.type !== "scroll" && r ? /* @__PURE__ */ l.jsx(BS, { ...e, ref: t }) : null;
14240
14243
  }
14241
14244
  );
14242
14245
  th.displayName = Aa;
14243
14246
  var BS = p.forwardRef((e, t) => {
14244
- const { __scopeScrollArea: n, ...r } = e, o = Kt(Aa, n), [s, i] = p.useState(0), [a, c] = p.useState(0), u = !!(s && a);
14247
+ const { __scopeScrollArea: n, ...r } = e, o = qt(Aa, n), [s, i] = p.useState(0), [a, c] = p.useState(0), u = !!(s && a);
14245
14248
  return dr(o.scrollbarX, () => {
14246
14249
  var f;
14247
14250
  const d = ((f = o.scrollbarX) == null ? void 0 : f.offsetHeight) || 0;
@@ -14383,8 +14386,8 @@ function fc({
14383
14386
  const P = async (M) => {
14384
14387
  try {
14385
14388
  await f(M), a == null || a(M), c == null || c(M);
14386
- } catch (J) {
14387
- console.error("Failed to select thread:", J);
14389
+ } catch (Z) {
14390
+ console.error("Failed to select thread:", Z);
14388
14391
  }
14389
14392
  }, G = async () => {
14390
14393
  try {
@@ -14396,31 +14399,31 @@ function fc({
14396
14399
  } finally {
14397
14400
  V(!1);
14398
14401
  }
14399
- }, W = async (M, J) => {
14400
- if (J.stopPropagation(), !!confirm("Delete this thread?"))
14402
+ }, W = async (M, Z) => {
14403
+ if (Z.stopPropagation(), !!confirm("Delete this thread?"))
14401
14404
  try {
14402
14405
  await g(M), d == null || d(M);
14403
14406
  } catch (Re) {
14404
14407
  console.error("Failed to delete thread:", Re);
14405
14408
  }
14406
- }, K = (M, J) => {
14407
- J.stopPropagation(), N(M.threadId), I(M.title || `Thread ${M.threadId.slice(0, 8)}`);
14409
+ }, K = (M, Z) => {
14410
+ Z.stopPropagation(), N(M.threadId), I(M.title || `Thread ${M.threadId.slice(0, 8)}`);
14408
14411
  }, D = async (M) => {
14409
14412
  if (_.trim())
14410
14413
  try {
14411
14414
  await x(M, _.trim()), N(null), I("");
14412
- } catch (J) {
14413
- console.error("Failed to update title:", J);
14415
+ } catch (Z) {
14416
+ console.error("Failed to update title:", Z);
14414
14417
  }
14415
14418
  }, O = () => {
14416
14419
  N(null), I("");
14417
- }, ie = (M, J) => {
14418
- M.key === "Enter" ? D(J) : M.key === "Escape" && O();
14419
- }, Z = (M) => {
14420
+ }, ie = (M, Z) => {
14421
+ M.key === "Enter" ? D(Z) : M.key === "Escape" && O();
14422
+ }, J = (M) => {
14420
14423
  if (!M) return "";
14421
14424
  try {
14422
- const J = new Date(M), fe = (/* @__PURE__ */ new Date()).getTime() - J.getTime(), L = Math.floor(fe / (1e3 * 60 * 60 * 24));
14423
- return L === 0 ? J.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : L === 1 ? "Yesterday" : L < 7 ? `${L} days ago` : J.toLocaleDateString();
14425
+ const Z = new Date(M), fe = (/* @__PURE__ */ new Date()).getTime() - Z.getTime(), L = Math.floor(fe / (1e3 * 60 * 60 * 24));
14426
+ return L === 0 ? Z.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : L === 1 ? "Yesterday" : L < 7 ? `${L} days ago` : Z.toLocaleDateString();
14424
14427
  } catch {
14425
14428
  return "";
14426
14429
  }
@@ -14446,32 +14449,32 @@ function fc({
14446
14449
  children: /* @__PURE__ */ l.jsx("div", { className: "p-2 space-y-1 pb-4", children: R ? /* @__PURE__ */ l.jsx("div", { className: "text-center py-8 text-slate-400", children: "Loading…" }) : w.length === 0 ? /* @__PURE__ */ l.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
14447
14450
  /* @__PURE__ */ l.jsx(Lp, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
14448
14451
  /* @__PURE__ */ l.jsx("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
14449
- ] }) : w.slice().sort((M, J) => new Date(J.updatedAt || J.createdAt || "").getTime() - new Date(M.updatedAt || M.createdAt || "").getTime()).map((M) => /* @__PURE__ */ l.jsxs(
14452
+ ] }) : w.slice().sort((M, Z) => new Date(Z.updatedAt || Z.createdAt || "").getTime() - new Date(M.updatedAt || M.createdAt || "").getTime()).map((M) => /* @__PURE__ */ l.jsxs(
14450
14453
  "div",
14451
14454
  {
14452
14455
  onClick: () => P(M.threadId),
14453
14456
  className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? b) === M.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
14454
14457
  children: [
14455
14458
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
14456
- /* @__PURE__ */ l.jsx("div", { className: "flex-1 min-w-0", children: E === M.threadId ? /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2", onClick: (J) => J.stopPropagation(), children: [
14457
- /* @__PURE__ */ l.jsx(Uo, { value: _, onChange: (J) => I(J.target.value), onKeyDown: (J) => ie(J, M.threadId), className: "h-6 text-sm", autoFocus: !0 }),
14459
+ /* @__PURE__ */ l.jsx("div", { className: "flex-1 min-w-0", children: E === M.threadId ? /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2", onClick: (Z) => Z.stopPropagation(), children: [
14460
+ /* @__PURE__ */ l.jsx(Uo, { value: _, onChange: (Z) => I(Z.target.value), onKeyDown: (Z) => ie(Z, M.threadId), className: "h-6 text-sm", autoFocus: !0 }),
14458
14461
  /* @__PURE__ */ l.jsx(We, { variant: "ghost", size: "sm", onClick: () => D(M.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ l.jsx(Mi, { size: 12 }) }),
14459
14462
  /* @__PURE__ */ l.jsx(We, { variant: "ghost", size: "sm", onClick: O, className: "h-6 w-6 p-0", children: /* @__PURE__ */ l.jsx(rr, { size: 12 }) })
14460
14463
  ] }) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
14461
14464
  /* @__PURE__ */ l.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: ee(M) }),
14462
14465
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
14463
14466
  /* @__PURE__ */ l.jsx($p, { size: 10 }),
14464
- /* @__PURE__ */ l.jsx("span", { children: Z(M.updatedAt || M.createdAt) })
14467
+ /* @__PURE__ */ l.jsx("span", { children: J(M.updatedAt || M.createdAt) })
14465
14468
  ] })
14466
14469
  ] }) }),
14467
14470
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
14468
- r && E !== M.threadId && /* @__PURE__ */ l.jsx(We, { variant: "ghost", size: "sm", onClick: (J) => K(M, J), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ l.jsx(xc, { size: 12 }) }),
14471
+ r && E !== M.threadId && /* @__PURE__ */ l.jsx(We, { variant: "ghost", size: "sm", onClick: (Z) => K(M, Z), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ l.jsx(xc, { size: 12 }) }),
14469
14472
  n && /* @__PURE__ */ l.jsx(
14470
14473
  We,
14471
14474
  {
14472
14475
  variant: "ghost",
14473
14476
  size: "sm",
14474
- onClick: (J) => W(M.threadId, J),
14477
+ onClick: (Z) => W(M.threadId, Z),
14475
14478
  className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
14476
14479
  title: "Delete thread",
14477
14480
  children: /* @__PURE__ */ l.jsx(Fp, { size: 12 })
@@ -14586,7 +14589,7 @@ dh.displayName = JS;
14586
14589
  var fh = dh;
14587
14590
  const ZS = qo(
14588
14591
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
14589
- ), zt = p.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
14592
+ ), Bt = p.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
14590
14593
  fh,
14591
14594
  {
14592
14595
  ref: n,
@@ -14594,7 +14597,7 @@ const ZS = qo(
14594
14597
  ...t
14595
14598
  }
14596
14599
  ));
14597
- zt.displayName = fh.displayName;
14600
+ Bt.displayName = fh.displayName;
14598
14601
  function hh(e) {
14599
14602
  const t = p.useRef({ value: e, previous: e });
14600
14603
  return p.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
@@ -14935,7 +14938,7 @@ var Kn = "SelectContent", Ih = p.forwardRef(
14935
14938
  }
14936
14939
  );
14937
14940
  Ih.displayName = Kn;
14938
- var qt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent.RemoveScroll"), Ah = p.forwardRef(
14941
+ var Gt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent.RemoveScroll"), Ah = p.forwardRef(
14939
14942
  (e, t) => {
14940
14943
  const {
14941
14944
  __scopeSelect: n,
@@ -15000,7 +15003,7 @@ var qt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent
15000
15003
  window.removeEventListener("blur", L), window.removeEventListener("resize", L);
15001
15004
  };
15002
15005
  }, [D]);
15003
- const [ie, Z] = qh((L) => {
15006
+ const [ie, J] = qh((L) => {
15004
15007
  const j = F().filter((le) => !le.disabled), H = j.find((le) => le.ref.current === document.activeElement), Q = Gh(j, L, H);
15005
15008
  Q && setTimeout(() => Q.ref.current.focus());
15006
15009
  }), ee = p.useCallback(
@@ -15009,7 +15012,7 @@ var qt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent
15009
15012
  (w.value !== void 0 && w.value === j || Q) && (N(L), Q && (G.current = !0));
15010
15013
  },
15011
15014
  [w.value]
15012
- ), M = p.useCallback(() => y == null ? void 0 : y.focus(), [y]), J = p.useCallback(
15015
+ ), M = p.useCallback(() => y == null ? void 0 : y.focus(), [y]), Z = p.useCallback(
15013
15016
  (L, j, H) => {
15014
15017
  const Q = !G.current && !H;
15015
15018
  (w.value !== void 0 && w.value === j || Q) && I(L);
@@ -15037,7 +15040,7 @@ var qt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent
15037
15040
  itemRefCallback: ee,
15038
15041
  selectedItem: E,
15039
15042
  onItemLeave: M,
15040
- itemTextRefCallback: J,
15043
+ itemTextRefCallback: Z,
15041
15044
  focusSelectedItem: K,
15042
15045
  selectedItemText: _,
15043
15046
  position: r,
@@ -15086,7 +15089,7 @@ var qt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent
15086
15089
  },
15087
15090
  onKeyDown: ae(x.onKeyDown, (L) => {
15088
15091
  const j = L.ctrlKey || L.altKey || L.metaKey;
15089
- if (L.key === "Tab" && L.preventDefault(), !j && L.key.length === 1 && Z(L.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(L.key)) {
15092
+ if (L.key === "Tab" && L.preventDefault(), !j && L.key.length === 1 && J(L.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(L.key)) {
15090
15093
  let Q = F().filter((le) => !le.disabled).map((le) => le.ref.current);
15091
15094
  if (["ArrowUp", "End"].includes(L.key) && (Q = Q.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(L.key)) {
15092
15095
  const le = L.target, oe = Q.indexOf(le);
@@ -15111,25 +15114,25 @@ var gC = "SelectItemAlignedPosition", _h = p.forwardRef((e, t) => {
15111
15114
  if (s.trigger && s.valueNode && a && u && v && g && x) {
15112
15115
  const k = s.trigger.getBoundingClientRect(), E = u.getBoundingClientRect(), N = s.valueNode.getBoundingClientRect(), _ = x.getBoundingClientRect();
15113
15116
  if (s.dir !== "rtl") {
15114
- const le = _.left - E.left, oe = N.left - le, $e = k.left - oe, De = k.width + $e, ve = Math.max(De, E.width), ke = window.innerWidth - qt, Be = Ei(oe, [
15115
- qt,
15117
+ const le = _.left - E.left, oe = N.left - le, $e = k.left - oe, De = k.width + $e, ve = Math.max(De, E.width), ke = window.innerWidth - Gt, Be = Ei(oe, [
15118
+ Gt,
15116
15119
  // Prevents the content from going off the starting edge of the
15117
15120
  // viewport. It may still go off the ending edge, but this can be
15118
15121
  // controlled by the user since they may want to manage overflow in a
15119
15122
  // specific way.
15120
15123
  // https://github.com/radix-ui/primitives/issues/2049
15121
- Math.max(qt, ke - ve)
15124
+ Math.max(Gt, ke - ve)
15122
15125
  ]);
15123
15126
  a.style.minWidth = De + "px", a.style.left = Be + "px";
15124
15127
  } else {
15125
- const le = E.right - _.right, oe = window.innerWidth - N.right - le, $e = window.innerWidth - k.right - oe, De = k.width + $e, ve = Math.max(De, E.width), ke = window.innerWidth - qt, Be = Ei(oe, [
15126
- qt,
15127
- Math.max(qt, ke - ve)
15128
+ const le = E.right - _.right, oe = window.innerWidth - N.right - le, $e = window.innerWidth - k.right - oe, De = k.width + $e, ve = Math.max(De, E.width), ke = window.innerWidth - Gt, Be = Ei(oe, [
15129
+ Gt,
15130
+ Math.max(Gt, ke - ve)
15128
15131
  ]);
15129
15132
  a.style.minWidth = De + "px", a.style.right = Be + "px";
15130
15133
  }
15131
- const I = h(), F = window.innerHeight - qt * 2, V = v.scrollHeight, P = window.getComputedStyle(u), G = parseInt(P.borderTopWidth, 10), W = parseInt(P.paddingTop, 10), K = parseInt(P.borderBottomWidth, 10), D = parseInt(P.paddingBottom, 10), O = G + W + V + D + K, ie = Math.min(g.offsetHeight * 5, O), Z = window.getComputedStyle(v), ee = parseInt(Z.paddingTop, 10), M = parseInt(Z.paddingBottom, 10), J = k.top + k.height / 2 - qt, Re = F - J, fe = g.offsetHeight / 2, L = g.offsetTop + fe, j = G + W + L, H = O - j;
15132
- if (j <= J) {
15134
+ const I = h(), F = window.innerHeight - Gt * 2, V = v.scrollHeight, P = window.getComputedStyle(u), G = parseInt(P.borderTopWidth, 10), W = parseInt(P.paddingTop, 10), K = parseInt(P.borderBottomWidth, 10), D = parseInt(P.paddingBottom, 10), O = G + W + V + D + K, ie = Math.min(g.offsetHeight * 5, O), J = window.getComputedStyle(v), ee = parseInt(J.paddingTop, 10), M = parseInt(J.paddingBottom, 10), Z = k.top + k.height / 2 - Gt, Re = F - Z, fe = g.offsetHeight / 2, L = g.offsetTop + fe, j = G + W + L, H = O - j;
15135
+ if (j <= Z) {
15133
15136
  const le = I.length > 0 && g === I[I.length - 1].ref.current;
15134
15137
  a.style.bottom = "0px";
15135
15138
  const oe = u.clientHeight - v.offsetTop - v.offsetHeight, $e = Math.max(
@@ -15142,13 +15145,13 @@ var gC = "SelectItemAlignedPosition", _h = p.forwardRef((e, t) => {
15142
15145
  const le = I.length > 0 && g === I[0].ref.current;
15143
15146
  a.style.top = "0px";
15144
15147
  const $e = Math.max(
15145
- J,
15148
+ Z,
15146
15149
  G + v.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
15147
15150
  (le ? ee : 0) + fe
15148
15151
  ) + H;
15149
- a.style.height = $e + "px", v.scrollTop = j - J + v.offsetTop;
15152
+ a.style.height = $e + "px", v.scrollTop = j - Z + v.offsetTop;
15150
15153
  }
15151
- a.style.margin = `${qt}px 0`, a.style.minHeight = ie + "px", a.style.maxHeight = F + "px", r == null || r(), requestAnimationFrame(() => m.current = !0);
15154
+ a.style.margin = `${Gt}px 0`, a.style.minHeight = ie + "px", a.style.maxHeight = F + "px", r == null || r(), requestAnimationFrame(() => m.current = !0);
15152
15155
  }
15153
15156
  }, [
15154
15157
  h,
@@ -15215,7 +15218,7 @@ var xC = "SelectPopperPosition", Ii = p.forwardRef((e, t) => {
15215
15218
  const {
15216
15219
  __scopeSelect: n,
15217
15220
  align: r = "start",
15218
- collisionPadding: o = qt,
15221
+ collisionPadding: o = Gt,
15219
15222
  ...s
15220
15223
  } = e, i = Is(n);
15221
15224
  return /* @__PURE__ */ l.jsx(
@@ -15278,7 +15281,7 @@ var [vC, _a] = vr(Kn, {}), Ni = "SelectViewport", jh = p.forwardRef(
15278
15281
  if (h != null && h.current && f) {
15279
15282
  const m = Math.abs(c.current - d.scrollTop);
15280
15283
  if (m > 0) {
15281
- const b = window.innerHeight - qt * 2, v = parseFloat(f.style.minHeight), g = parseFloat(f.style.height), x = Math.max(v, g);
15284
+ const b = window.innerHeight - Gt * 2, v = parseFloat(f.style.minHeight), g = parseFloat(f.style.height), x = Math.max(v, g);
15282
15285
  if (x < b) {
15283
15286
  const w = x + m, y = Math.min(b, w), R = w - y;
15284
15287
  f.style.height = y + "px", f.style.bottom === "0px" && (d.scrollTop = R > 0 ? R : 0, f.style.justifyContent = "flex-end");
@@ -15906,7 +15909,7 @@ function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
15906
15909
  ] }) }),
15907
15910
  /* @__PURE__ */ l.jsxs(Eo, { className: "space-y-4", children: [
15908
15911
  /* @__PURE__ */ l.jsxs("div", { className: "space-y-2", children: [
15909
- /* @__PURE__ */ l.jsx(zt, { htmlFor: "api-url", children: "API Base URL" }),
15912
+ /* @__PURE__ */ l.jsx(Bt, { htmlFor: "api-url", children: "API Base URL" }),
15910
15913
  /* @__PURE__ */ l.jsxs("div", { className: "flex gap-2", children: [
15911
15914
  /* @__PURE__ */ l.jsx(
15912
15915
  Uo,
@@ -15924,7 +15927,7 @@ function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
15924
15927
  ] })
15925
15928
  ] }),
15926
15929
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
15927
- /* @__PURE__ */ l.jsx(zt, { htmlFor: "enable-auth", children: "Enable Authentication" }),
15930
+ /* @__PURE__ */ l.jsx(Bt, { htmlFor: "enable-auth", children: "Enable Authentication" }),
15928
15931
  /* @__PURE__ */ l.jsx(
15929
15932
  bn,
15930
15933
  {
@@ -15938,7 +15941,7 @@ function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
15938
15941
  )
15939
15942
  ] }),
15940
15943
  a.api.enableAuth && /* @__PURE__ */ l.jsxs("div", { className: "space-y-2", children: [
15941
- /* @__PURE__ */ l.jsx(zt, { htmlFor: "auth-token", children: "Authentication Token" }),
15944
+ /* @__PURE__ */ l.jsx(Bt, { htmlFor: "auth-token", children: "Authentication Token" }),
15942
15945
  /* @__PURE__ */ l.jsxs("div", { className: "flex gap-2", children: [
15943
15946
  /* @__PURE__ */ l.jsx(
15944
15947
  Uo,
@@ -15973,7 +15976,7 @@ function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
15973
15976
  ] }) }),
15974
15977
  /* @__PURE__ */ l.jsxs(Eo, { className: "space-y-4", children: [
15975
15978
  /* @__PURE__ */ l.jsxs("div", { className: "space-y-2", children: [
15976
- /* @__PURE__ */ l.jsx(zt, { htmlFor: "layout", children: "Layout Style" }),
15979
+ /* @__PURE__ */ l.jsx(Bt, { htmlFor: "layout", children: "Layout Style" }),
15977
15980
  /* @__PURE__ */ l.jsxs(
15978
15981
  hc,
15979
15982
  {
@@ -15994,7 +15997,7 @@ function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
15994
15997
  )
15995
15998
  ] }),
15996
15999
  /* @__PURE__ */ l.jsxs("div", { className: "space-y-2", children: [
15997
- /* @__PURE__ */ l.jsx(zt, { htmlFor: "theme", children: "Theme" }),
16000
+ /* @__PURE__ */ l.jsx(Bt, { htmlFor: "theme", children: "Theme" }),
15998
16001
  /* @__PURE__ */ l.jsxs(
15999
16002
  hc,
16000
16003
  {
@@ -16017,7 +16020,7 @@ function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
16017
16020
  /* @__PURE__ */ l.jsx(ip, {}),
16018
16021
  /* @__PURE__ */ l.jsxs("div", { className: "space-y-3", children: [
16019
16022
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
16020
- /* @__PURE__ */ l.jsx(zt, { htmlFor: "show-timestamps", children: "Show Timestamps" }),
16023
+ /* @__PURE__ */ l.jsx(Bt, { htmlFor: "show-timestamps", children: "Show Timestamps" }),
16021
16024
  /* @__PURE__ */ l.jsx(
16022
16025
  bn,
16023
16026
  {
@@ -16031,7 +16034,7 @@ function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
16031
16034
  )
16032
16035
  ] }),
16033
16036
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
16034
- /* @__PURE__ */ l.jsx(zt, { htmlFor: "show-agent-names", children: "Show Agent Names" }),
16037
+ /* @__PURE__ */ l.jsx(Bt, { htmlFor: "show-agent-names", children: "Show Agent Names" }),
16035
16038
  /* @__PURE__ */ l.jsx(
16036
16039
  bn,
16037
16040
  {
@@ -16045,7 +16048,7 @@ function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
16045
16048
  )
16046
16049
  ] }),
16047
16050
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
16048
- /* @__PURE__ */ l.jsx(zt, { htmlFor: "compact-messages", children: "Compact Messages" }),
16051
+ /* @__PURE__ */ l.jsx(Bt, { htmlFor: "compact-messages", children: "Compact Messages" }),
16049
16052
  /* @__PURE__ */ l.jsx(
16050
16053
  bn,
16051
16054
  {
@@ -16069,7 +16072,7 @@ function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
16069
16072
  /* @__PURE__ */ l.jsxs(Eo, { className: "space-y-4", children: [
16070
16073
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
16071
16074
  /* @__PURE__ */ l.jsxs("div", { children: [
16072
- /* @__PURE__ */ l.jsx(zt, { htmlFor: "auto-save", children: "Auto-save Conversations" }),
16075
+ /* @__PURE__ */ l.jsx(Bt, { htmlFor: "auto-save", children: "Auto-save Conversations" }),
16073
16076
  /* @__PURE__ */ l.jsx("p", { className: "text-sm text-muted-foreground", children: "Automatically save messages to threads" })
16074
16077
  ] }),
16075
16078
  /* @__PURE__ */ l.jsx(
@@ -16086,7 +16089,7 @@ function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
16086
16089
  ] }),
16087
16090
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
16088
16091
  /* @__PURE__ */ l.jsxs("div", { children: [
16089
- /* @__PURE__ */ l.jsx(zt, { htmlFor: "enable-streaming", children: "Enable Streaming" }),
16092
+ /* @__PURE__ */ l.jsx(Bt, { htmlFor: "enable-streaming", children: "Enable Streaming" }),
16090
16093
  /* @__PURE__ */ l.jsx("p", { className: "text-sm text-muted-foreground", children: "Stream responses in real-time" })
16091
16094
  ] }),
16092
16095
  /* @__PURE__ */ l.jsx(
@@ -16103,7 +16106,7 @@ function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
16103
16106
  ] }),
16104
16107
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
16105
16108
  /* @__PURE__ */ l.jsxs("div", { children: [
16106
- /* @__PURE__ */ l.jsx(zt, { htmlFor: "typing-indicator", children: "Typing Indicator" }),
16109
+ /* @__PURE__ */ l.jsx(Bt, { htmlFor: "typing-indicator", children: "Typing Indicator" }),
16107
16110
  /* @__PURE__ */ l.jsx("p", { className: "text-sm text-muted-foreground", children: "Show typing indicator during responses" })
16108
16111
  ] }),
16109
16112
  /* @__PURE__ */ l.jsx(
@@ -16224,7 +16227,7 @@ export {
16224
16227
  zn as chatApiClient,
16225
16228
  NT as default,
16226
16229
  Ag as del,
16227
- Bt as get,
16230
+ Ht as get,
16228
16231
  kg as getChatToken,
16229
16232
  TT as getCurrentSettings,
16230
16233
  qS as getDefaultApiConfig,