teodor-new-chat-ui 4.3.246 → 4.3.248

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 om = Object.defineProperty;
2
2
  var sm = (e, t, n) => t in e ? om(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var cl = (e, t, n) => sm(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as v from "react";
5
- import z, { createContext as co, useContext as xs, useRef as Qe, useCallback as Ce, useReducer as im, useEffect as Et, useMemo as lt, useState as ge, useLayoutEffect as am, createElement as Do, useImperativeHandle as lm } from "react";
5
+ import z, { createContext as co, useContext as xs, useRef as Qe, useCallback as Ce, useReducer as im, useEffect as It, useMemo as lt, useState as ge, useLayoutEffect as am, createElement as Do, useImperativeHandle as lm } from "react";
6
6
  import { Square as cm, Send as um, ChevronRight as Xc, Check as ca, Circle as dm, X as vr, ExternalLink as fm, Download as pm, Image as hm, FileText as ul, Loader as ua, Bot as si, Wrench as mm, User as gm, Paperclip as ji, ChevronUp as da, ChevronDown as ys, ChevronLeft as xm, Copy as dl, Edit as fl, RotateCcw as _i, Info as ym, Loader2 as zr, Edit3 as Jc, Plus as vm, FileSpreadsheet as wm, MessageSquarePlus as bm, MessageSquare as Sm, Calendar as Cm, Trash2 as Tm, Settings as km, Server as Rm, EyeOff as Em, Eye as Im, Layout as Nm, MessageCircle as Am, Save as jm } from "lucide-react";
7
7
  import { Slot as _m, createSlot as Tr } from "@radix-ui/react-slot";
8
8
  import { cva as vs } from "class-variance-authority";
@@ -66,8 +66,8 @@ function Dm() {
66
66
  {
67
67
  var we = g.ReactDebugCurrentFrame, Ye = we.getStackAddendum();
68
68
  Ye !== "" && (K += "%s", ie = ie.concat([Ye]));
69
- var at = ie.map(function(He) {
70
- return String(He);
69
+ var at = ie.map(function(Ue) {
70
+ return String(Ue);
71
71
  });
72
72
  at.unshift("Warning: " + K), Function.prototype.apply.call(console[R], console, at);
73
73
  }
@@ -126,9 +126,9 @@ function Dm() {
126
126
  var we = R.displayName || null;
127
127
  return we !== null ? we : F(R.type) || "Memo";
128
128
  case p: {
129
- var Ye = R, at = Ye._payload, He = Ye._init;
129
+ var Ye = R, at = Ye._payload, Ue = Ye._init;
130
130
  try {
131
- return F(He(at));
131
+ return F(Ue(at));
132
132
  } catch {
133
133
  return null;
134
134
  }
@@ -233,27 +233,27 @@ function Dm() {
233
233
  at = ee.current, ee.current = null, Ee();
234
234
  try {
235
235
  if (K) {
236
- var He = function() {
236
+ var Ue = function() {
237
237
  throw Error();
238
238
  };
239
- if (Object.defineProperty(He.prototype, "props", {
239
+ if (Object.defineProperty(Ue.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(He, []);
245
+ Reflect.construct(Ue, []);
246
246
  } catch (Ft) {
247
247
  we = Ft;
248
248
  }
249
- Reflect.construct(R, [], He);
249
+ Reflect.construct(R, [], Ue);
250
250
  } else {
251
251
  try {
252
- He.call();
252
+ Ue.call();
253
253
  } catch (Ft) {
254
254
  we = Ft;
255
255
  }
256
- R.call(He.prototype);
256
+ R.call(Ue.prototype);
257
257
  }
258
258
  } else {
259
259
  try {
@@ -288,7 +288,7 @@ function Dm() {
288
288
  var Fn = R ? R.displayName || R.name : "", Nn = Fn ? P(Fn) : "";
289
289
  return typeof R == "function" && te.set(R, Nn), Nn;
290
290
  }
291
- function Me(R, K, ie) {
291
+ function De(R, K, ie) {
292
292
  return re(R, !1);
293
293
  }
294
294
  function Y(R) {
@@ -311,7 +311,7 @@ function Dm() {
311
311
  if (typeof R == "object")
312
312
  switch (R.$$typeof) {
313
313
  case l:
314
- return Me(R.render);
314
+ return De(R.render);
315
315
  case f:
316
316
  return de(R.type, K, ie);
317
317
  case p: {
@@ -332,22 +332,22 @@ function Dm() {
332
332
  } else
333
333
  ze.setExtraStackFrame(null);
334
334
  }
335
- function Ue(R, K, ie, we, Ye) {
335
+ function We(R, K, ie, we, Ye) {
336
336
  {
337
337
  var at = Function.call.bind(ke);
338
- for (var He in R)
339
- if (at(R, He)) {
338
+ for (var Ue in R)
339
+ if (at(R, Ue)) {
340
340
  var $e = void 0;
341
341
  try {
342
- if (typeof R[He] != "function") {
343
- var Ot = Error((we || "React class") + ": " + ie + " type `" + He + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[He] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
342
+ if (typeof R[Ue] != "function") {
343
+ var Ot = Error((we || "React class") + ": " + ie + " type `" + Ue + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[Ue] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
344
344
  throw Ot.name = "Invariant Violation", Ot;
345
345
  }
346
- $e = R[He](K, He, we, ie, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
346
+ $e = R[Ue](K, Ue, we, ie, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
347
  } catch (bt) {
348
348
  $e = bt;
349
349
  }
350
- $e && !($e instanceof Error) && (Be(Ye), 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).", we || "React class", ie, He, typeof $e), Be(null)), $e instanceof Error && !($e.message in Ne) && (Ne[$e.message] = !0, Be(Ye), w("Failed %s type: %s", ie, $e.message), Be(null));
350
+ $e && !($e instanceof Error) && (Be(Ye), 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).", we || "React class", ie, Ue, typeof $e), Be(null)), $e instanceof Error && !($e.message in Ne) && (Ne[$e.message] = !0, Be(Ye), w("Failed %s type: %s", ie, $e.message), Be(null));
351
351
  }
352
352
  }
353
353
  }
@@ -389,7 +389,7 @@ function Dm() {
389
389
  }
390
390
  return R.ref !== void 0;
391
391
  }
392
- function De(R) {
392
+ function Ae(R) {
393
393
  if (ke.call(R, "key")) {
394
394
  var K = Object.getOwnPropertyDescriptor(R, "key").get;
395
395
  if (K && K.isReactWarning)
@@ -397,10 +397,10 @@ function Dm() {
397
397
  }
398
398
  return R.key !== void 0;
399
399
  }
400
- function We(R, K) {
400
+ function He(R, K) {
401
401
  typeof R.ref == "string" && mt.current;
402
402
  }
403
- function Pe(R, K) {
403
+ function Oe(R, K) {
404
404
  {
405
405
  var ie = function() {
406
406
  Ct || (Ct = !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)", K));
@@ -422,7 +422,7 @@ function Dm() {
422
422
  });
423
423
  }
424
424
  }
425
- var Ze = function(R, K, ie, we, Ye, at, He) {
425
+ var Ze = function(R, K, ie, we, Ye, at, Ue) {
426
426
  var $e = {
427
427
  // This tag allows us to uniquely identify this as a React Element
428
428
  $$typeof: t,
@@ -430,7 +430,7 @@ function Dm() {
430
430
  type: R,
431
431
  key: K,
432
432
  ref: ie,
433
- props: He,
433
+ props: Ue,
434
434
  // Record the component responsible for creating this element.
435
435
  _owner: at
436
436
  };
@@ -453,29 +453,29 @@ function Dm() {
453
453
  };
454
454
  function Fe(R, K, ie, we, Ye) {
455
455
  {
456
- var at, He = {}, $e = null, Ot = null;
457
- ie !== void 0 && (St(ie), $e = "" + ie), De(K) && (St(K.key), $e = "" + K.key), ne(K) && (Ot = K.ref, We(K, Ye));
456
+ var at, Ue = {}, $e = null, Ot = null;
457
+ ie !== void 0 && (St(ie), $e = "" + ie), Ae(K) && (St(K.key), $e = "" + K.key), ne(K) && (Ot = K.ref, He(K, Ye));
458
458
  for (at in K)
459
- ke.call(K, at) && !ct.hasOwnProperty(at) && (He[at] = K[at]);
459
+ ke.call(K, at) && !ct.hasOwnProperty(at) && (Ue[at] = K[at]);
460
460
  if (R && R.defaultProps) {
461
461
  var bt = R.defaultProps;
462
462
  for (at in bt)
463
- He[at] === void 0 && (He[at] = bt[at]);
463
+ Ue[at] === void 0 && (Ue[at] = bt[at]);
464
464
  }
465
465
  if ($e || Ot) {
466
466
  var vt = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
467
- $e && Pe(He, vt), Ot && tt(He, vt);
467
+ $e && Oe(Ue, vt), Ot && tt(Ue, vt);
468
468
  }
469
- return Ze(R, $e, Ot, Ye, we, mt.current, He);
469
+ return Ze(R, $e, Ot, Ye, we, mt.current, Ue);
470
470
  }
471
471
  }
472
- var Pt = g.ReactCurrentOwner, jt = g.ReactDebugCurrentFrame;
472
+ var At = g.ReactCurrentOwner, Tt = g.ReactDebugCurrentFrame;
473
473
  function V(R) {
474
474
  if (R) {
475
475
  var K = R._owner, ie = de(R.type, R._source, K ? K.type : null);
476
- jt.setExtraStackFrame(ie);
476
+ Tt.setExtraStackFrame(ie);
477
477
  } else
478
- jt.setExtraStackFrame(null);
478
+ Tt.setExtraStackFrame(null);
479
479
  }
480
480
  var ve;
481
481
  ve = !1;
@@ -484,8 +484,8 @@ function Dm() {
484
484
  }
485
485
  function ht() {
486
486
  {
487
- if (Pt.current) {
488
- var R = F(Pt.current.type);
487
+ if (At.current) {
488
+ var R = F(At.current.type);
489
489
  if (R)
490
490
  return `
491
491
 
@@ -497,8 +497,8 @@ Check the render method of \`` + R + "`.";
497
497
  function gt(R) {
498
498
  return "";
499
499
  }
500
- var Tt = {};
501
- function je(R) {
500
+ var kt = {};
501
+ function _e(R) {
502
502
  {
503
503
  var K = ht();
504
504
  if (!K) {
@@ -515,12 +515,12 @@ Check the top-level render call using <` + ie + ">.");
515
515
  if (!R._store || R._store.validated || R.key != null)
516
516
  return;
517
517
  R._store.validated = !0;
518
- var ie = je(K);
519
- if (Tt[ie])
518
+ var ie = _e(K);
519
+ if (kt[ie])
520
520
  return;
521
- Tt[ie] = !0;
521
+ kt[ie] = !0;
522
522
  var we = "";
523
- R && R._owner && R._owner !== Pt.current && (we = " It was passed a child from " + F(R._owner.type) + "."), V(R), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ie, we), V(null);
523
+ R && R._owner && R._owner !== At.current && (we = " It was passed a child from " + F(R._owner.type) + "."), V(R), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ie, we), V(null);
524
524
  }
525
525
  }
526
526
  function ut(R, K) {
@@ -537,12 +537,12 @@ Check the top-level render call using <` + ie + ">.");
537
537
  else if (R) {
538
538
  var Ye = y(R);
539
539
  if (typeof Ye == "function" && Ye !== R.entries)
540
- for (var at = Ye.call(R), He; !(He = at.next()).done; )
541
- xe(He.value) && Vt(He.value, K);
540
+ for (var at = Ye.call(R), Ue; !(Ue = at.next()).done; )
541
+ xe(Ue.value) && Vt(Ue.value, K);
542
542
  }
543
543
  }
544
544
  }
545
- function kt(R) {
545
+ function Rt(R) {
546
546
  {
547
547
  var K = R.type;
548
548
  if (K == null || typeof K == "string")
@@ -558,7 +558,7 @@ Check the top-level render call using <` + ie + ">.");
558
558
  return;
559
559
  if (ie) {
560
560
  var we = F(K);
561
- Ue(ie, R.props, "prop", we, R);
561
+ We(ie, R.props, "prop", we, R);
562
562
  } else if (K.PropTypes !== void 0 && !ve) {
563
563
  ve = !0;
564
564
  var Ye = F(K);
@@ -582,8 +582,8 @@ Check the top-level render call using <` + ie + ">.");
582
582
  var Jn = {};
583
583
  function Ln(R, K, ie, we, Ye, at) {
584
584
  {
585
- var He = I(R);
586
- if (!He) {
585
+ var Ue = I(R);
586
+ if (!Ue) {
587
587
  var $e = "";
588
588
  (R === void 0 || typeof R == "object" && R !== null && Object.keys(R).length === 0) && ($e += " 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
589
  var Ot = gt();
@@ -594,7 +594,7 @@ Check the top-level render call using <` + ie + ">.");
594
594
  var vt = Fe(R, K, ie, Ye, at);
595
595
  if (vt == null)
596
596
  return vt;
597
- if (He) {
597
+ if (Ue) {
598
598
  var Kt = K.children;
599
599
  if (Kt !== void 0)
600
600
  if (we)
@@ -621,7 +621,7 @@ React keys must be passed directly to JSX without using spread:
621
621
  <%s key={someKey} {...props} />`, Dr, Nn, G, Nn), Jn[Nn + Dr] = !0;
622
622
  }
623
623
  }
624
- return R === r ? Dn(vt) : kt(vt), vt;
624
+ return R === r ? Dn(vt) : Rt(vt), vt;
625
625
  }
626
626
  }
627
627
  function ti(R, K, ie) {
@@ -874,10 +874,10 @@ const xg = (e) => {
874
874
  asap: wg,
875
875
  isIterable: bg
876
876
  };
877
- function _e(e, t, n, r, o) {
877
+ function Pe(e, t, n, r, o) {
878
878
  Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), o && (this.response = o, this.status = o.status ? o.status : null);
879
879
  }
880
- _.inherits(_e, Error, {
880
+ _.inherits(Pe, Error, {
881
881
  toJSON: function() {
882
882
  return {
883
883
  // Standard
@@ -898,7 +898,7 @@ _.inherits(_e, Error, {
898
898
  };
899
899
  }
900
900
  });
901
- const au = _e.prototype, lu = {};
901
+ const au = Pe.prototype, lu = {};
902
902
  [
903
903
  "ERR_BAD_OPTION_VALUE",
904
904
  "ERR_BAD_OPTION",
@@ -916,15 +916,15 @@ const au = _e.prototype, lu = {};
916
916
  ].forEach((e) => {
917
917
  lu[e] = { value: e };
918
918
  });
919
- Object.defineProperties(_e, lu);
919
+ Object.defineProperties(Pe, lu);
920
920
  Object.defineProperty(au, "isAxiosError", { value: !0 });
921
- _e.from = (e, t, n, r, o, s) => {
921
+ Pe.from = (e, t, n, r, o, s) => {
922
922
  const i = Object.create(au);
923
923
  _.toFlatObject(e, i, function(d) {
924
924
  return d !== Error.prototype;
925
925
  }, (c) => c !== "isAxiosError");
926
926
  const a = e && e.message ? e.message : "Error", l = t == null && e ? e.code : t;
927
- return _e.call(i, a, l, n, r, o), e && i.cause == null && Object.defineProperty(i, "cause", { value: e, configurable: !0 }), i.name = e && e.name || "Error", s && Object.assign(i, s), i;
927
+ return Pe.call(i, a, l, n, r, o), e && i.cause == null && Object.defineProperty(i, "cause", { value: e, configurable: !0 }), i.name = e && e.name || "Error", s && Object.assign(i, s), i;
928
928
  };
929
929
  const Sg = null;
930
930
  function Mi(e) {
@@ -964,7 +964,7 @@ function Ts(e, t, n) {
964
964
  if (_.isBoolean(m))
965
965
  return m.toString();
966
966
  if (!l && _.isBlob(m))
967
- throw new _e("Blob is not supported. Use a Buffer instead.");
967
+ throw new Pe("Blob is not supported. Use a Buffer instead.");
968
968
  return _.isArrayBuffer(m) || _.isTypedArray(m) ? l && typeof Blob == "function" ? new Blob([m]) : Buffer.from(m) : m;
969
969
  }
970
970
  function d(m, x, y) {
@@ -1215,7 +1215,7 @@ const ho = {
1215
1215
  return JSON.parse(t, this.parseReviver);
1216
1216
  } catch (a) {
1217
1217
  if (i)
1218
- throw a.name === "SyntaxError" ? _e.from(a, _e.ERR_BAD_RESPONSE, this, null, this.response) : a;
1218
+ throw a.name === "SyntaxError" ? Pe.from(a, Pe.ERR_BAD_RESPONSE, this, null, this.response) : a;
1219
1219
  }
1220
1220
  }
1221
1221
  return t;
@@ -1458,16 +1458,16 @@ function hu(e) {
1458
1458
  return !!(e && e.__CANCEL__);
1459
1459
  }
1460
1460
  function Ar(e, t, n) {
1461
- _e.call(this, e ?? "canceled", _e.ERR_CANCELED, t, n), this.name = "CanceledError";
1461
+ Pe.call(this, e ?? "canceled", Pe.ERR_CANCELED, t, n), this.name = "CanceledError";
1462
1462
  }
1463
- _.inherits(Ar, _e, {
1463
+ _.inherits(Ar, Pe, {
1464
1464
  __CANCEL__: !0
1465
1465
  });
1466
1466
  function mu(e, t, n) {
1467
1467
  const r = n.config.validateStatus;
1468
- !n.status || !r || r(n.status) ? e(n) : t(new _e(
1468
+ !n.status || !r || r(n.status) ? e(n) : t(new Pe(
1469
1469
  "Request failed with status code " + n.status,
1470
- [_e.ERR_BAD_REQUEST, _e.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
1470
+ [Pe.ERR_BAD_REQUEST, Pe.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
1471
1471
  n.config,
1472
1472
  n.request,
1473
1473
  n
@@ -1690,16 +1690,16 @@ const xu = (e) => {
1690
1690
  "onloadend" in y ? y.onloadend = g : y.onreadystatechange = function() {
1691
1691
  !y || y.readyState !== 4 || y.status === 0 && !(y.responseURL && y.responseURL.indexOf("file:") === 0) || setTimeout(g);
1692
1692
  }, y.onabort = function() {
1693
- y && (r(new _e("Request aborted", _e.ECONNABORTED, e, y)), y = null);
1693
+ y && (r(new Pe("Request aborted", Pe.ECONNABORTED, e, y)), y = null);
1694
1694
  }, y.onerror = function(T) {
1695
- const C = T && T.message ? T.message : "Network Error", S = new _e(C, _e.ERR_NETWORK, e, y);
1695
+ const C = T && T.message ? T.message : "Network Error", S = new Pe(C, Pe.ERR_NETWORK, e, y);
1696
1696
  S.event = T || null, r(S), y = null;
1697
1697
  }, y.ontimeout = function() {
1698
1698
  let T = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
1699
1699
  const C = o.transitional || fu;
1700
- o.timeoutErrorMessage && (T = o.timeoutErrorMessage), r(new _e(
1700
+ o.timeoutErrorMessage && (T = o.timeoutErrorMessage), r(new Pe(
1701
1701
  T,
1702
- C.clarifyTimeoutError ? _e.ETIMEDOUT : _e.ECONNABORTED,
1702
+ C.clarifyTimeoutError ? Pe.ETIMEDOUT : Pe.ECONNABORTED,
1703
1703
  e,
1704
1704
  y
1705
1705
  )), y = null;
@@ -1710,7 +1710,7 @@ const xu = (e) => {
1710
1710
  }, o.cancelToken && o.cancelToken.subscribe(d), o.signal && (o.signal.aborted ? d() : o.signal.addEventListener("abort", d)));
1711
1711
  const w = Wg(o.url);
1712
1712
  if (w && zt.protocols.indexOf(w) === -1) {
1713
- r(new _e("Unsupported protocol " + w + ":", _e.ERR_BAD_REQUEST, e));
1713
+ r(new Pe("Unsupported protocol " + w + ":", Pe.ERR_BAD_REQUEST, e));
1714
1714
  return;
1715
1715
  }
1716
1716
  y.send(s || null);
@@ -1723,11 +1723,11 @@ const xu = (e) => {
1723
1723
  if (!o) {
1724
1724
  o = !0, a();
1725
1725
  const d = c instanceof Error ? c : this.reason;
1726
- r.abort(d instanceof _e ? d : new Ar(d instanceof Error ? d.message : d));
1726
+ r.abort(d instanceof Pe ? d : new Ar(d instanceof Error ? d.message : d));
1727
1727
  }
1728
1728
  };
1729
1729
  let i = t && setTimeout(() => {
1730
- i = null, s(new _e(`timeout ${t} of ms exceeded`, _e.ETIMEDOUT));
1730
+ i = null, s(new Pe(`timeout ${t} of ms exceeded`, Pe.ETIMEDOUT));
1731
1731
  }, t);
1732
1732
  const a = () => {
1733
1733
  e && (i && clearTimeout(i), i = null, e.forEach((c) => {
@@ -1832,7 +1832,7 @@ const xu = (e) => {
1832
1832
  let g = x && x[m];
1833
1833
  if (g)
1834
1834
  return g.call(x);
1835
- throw new _e(`Response type '${m}' is not supported`, _e.ERR_NOT_SUPPORT, y);
1835
+ throw new Pe(`Response type '${m}' is not supported`, Pe.ERR_NOT_SUPPORT, y);
1836
1836
  });
1837
1837
  });
1838
1838
  const p = async (m) => {
@@ -1932,11 +1932,11 @@ const xu = (e) => {
1932
1932
  });
1933
1933
  } catch (A) {
1934
1934
  throw j && j(), A && A.name === "TypeError" && /Load failed|fetch/i.test(A.message) ? Object.assign(
1935
- new _e("Network Error", _e.ERR_NETWORK, m, F),
1935
+ new Pe("Network Error", Pe.ERR_NETWORK, m, F),
1936
1936
  {
1937
1937
  cause: A.cause || A
1938
1938
  }
1939
- ) : _e.from(A, A && A.code, m, F);
1939
+ ) : Pe.from(A, A && A.code, m, F);
1940
1940
  }
1941
1941
  };
1942
1942
  }, sx = /* @__PURE__ */ new Map(), yu = (e) => {
@@ -1978,7 +1978,7 @@ const Il = (e) => `- ${e}`, ix = (e) => _.isFunction(e) || e === null || e === !
1978
1978
  r = e[i];
1979
1979
  let a;
1980
1980
  if (o = r, !ix(r) && (o = Li[(a = String(r)).toLowerCase()], o === void 0))
1981
- throw new _e(`Unknown adapter '${a}'`);
1981
+ throw new Pe(`Unknown adapter '${a}'`);
1982
1982
  if (o && (_.isFunction(o) || (o = o.get(t))))
1983
1983
  break;
1984
1984
  s[a || "#" + i] = o;
@@ -1990,7 +1990,7 @@ const Il = (e) => `- ${e}`, ix = (e) => _.isFunction(e) || e === null || e === !
1990
1990
  let a = n ? i.length > 1 ? `since :
1991
1991
  ` + i.map(Il).join(`
1992
1992
  `) : " " + Il(i[0]) : "as no adapter specified";
1993
- throw new _e(
1993
+ throw new Pe(
1994
1994
  "There is no suitable adapter to dispatch the request " + a,
1995
1995
  "ERR_NOT_SUPPORT"
1996
1996
  );
@@ -2034,9 +2034,9 @@ ks.transitional = function(t, n, r) {
2034
2034
  }
2035
2035
  return (s, i, a) => {
2036
2036
  if (t === !1)
2037
- throw new _e(
2037
+ throw new Pe(
2038
2038
  o(i, " has been removed" + (n ? " in " + n : "")),
2039
- _e.ERR_DEPRECATED
2039
+ Pe.ERR_DEPRECATED
2040
2040
  );
2041
2041
  return n && !Al[i] && (Al[i] = !0, console.warn(
2042
2042
  o(
@@ -2051,7 +2051,7 @@ ks.spelling = function(t) {
2051
2051
  };
2052
2052
  function ax(e, t, n) {
2053
2053
  if (typeof e != "object")
2054
- throw new _e("options must be an object", _e.ERR_BAD_OPTION_VALUE);
2054
+ throw new Pe("options must be an object", Pe.ERR_BAD_OPTION_VALUE);
2055
2055
  const r = Object.keys(e);
2056
2056
  let o = r.length;
2057
2057
  for (; o-- > 0; ) {
@@ -2059,11 +2059,11 @@ function ax(e, t, n) {
2059
2059
  if (i) {
2060
2060
  const a = e[s], l = a === void 0 || i(a, s, e);
2061
2061
  if (l !== !0)
2062
- throw new _e("option " + s + " must be " + l, _e.ERR_BAD_OPTION_VALUE);
2062
+ throw new Pe("option " + s + " must be " + l, Pe.ERR_BAD_OPTION_VALUE);
2063
2063
  continue;
2064
2064
  }
2065
2065
  if (n !== !0)
2066
- throw new _e("Unknown option " + s, _e.ERR_BAD_OPTION);
2066
+ throw new Pe("Unknown option " + s, Pe.ERR_BAD_OPTION);
2067
2067
  }
2068
2068
  }
2069
2069
  const $o = {
@@ -2349,26 +2349,26 @@ function Su(e) {
2349
2349
  return Su(or(e, o));
2350
2350
  }, n;
2351
2351
  }
2352
- const It = Su(ho);
2353
- It.Axios = nr;
2354
- It.CanceledError = Ar;
2355
- It.CancelToken = lx;
2356
- It.isCancel = hu;
2357
- It.VERSION = wu;
2358
- It.toFormData = Ts;
2359
- It.AxiosError = _e;
2360
- It.Cancel = It.CanceledError;
2361
- It.all = function(t) {
2352
+ const Nt = Su(ho);
2353
+ Nt.Axios = nr;
2354
+ Nt.CanceledError = Ar;
2355
+ Nt.CancelToken = lx;
2356
+ Nt.isCancel = hu;
2357
+ Nt.VERSION = wu;
2358
+ Nt.toFormData = Ts;
2359
+ Nt.AxiosError = Pe;
2360
+ Nt.Cancel = Nt.CanceledError;
2361
+ Nt.all = function(t) {
2362
2362
  return Promise.all(t);
2363
2363
  };
2364
- It.spread = cx;
2365
- It.isAxiosError = ux;
2366
- It.mergeConfig = or;
2367
- It.AxiosHeaders = Yt;
2368
- It.formToJSON = (e) => pu(_.isHTMLForm(e) ? new FormData(e) : e);
2369
- It.getAdapter = vu.getAdapter;
2370
- It.HttpStatusCode = Fi;
2371
- It.default = It;
2364
+ Nt.spread = cx;
2365
+ Nt.isAxiosError = ux;
2366
+ Nt.mergeConfig = or;
2367
+ Nt.AxiosHeaders = Yt;
2368
+ Nt.formToJSON = (e) => pu(_.isHTMLForm(e) ? new FormData(e) : e);
2369
+ Nt.getAdapter = vu.getAdapter;
2370
+ Nt.HttpStatusCode = Fi;
2371
+ Nt.default = Nt;
2372
2372
  const {
2373
2373
  Axios: QT,
2374
2374
  AxiosError: ek,
@@ -2386,7 +2386,7 @@ const {
2386
2386
  formToJSON: fk,
2387
2387
  getAdapter: pk,
2388
2388
  mergeConfig: hk
2389
- } = It, jl = typeof window < "u" ? window.__API_BASE_URL__ : void 0, _l = jl ? _n(jl) : void 0;
2389
+ } = Nt, jl = typeof window < "u" ? window.__API_BASE_URL__ : void 0, _l = jl ? _n(jl) : void 0;
2390
2390
  function _n(e) {
2391
2391
  const n = (e != null && e.trim() ? e.trim() : "/api/chat").replace(/\/+$/, "");
2392
2392
  return n ? n.endsWith("/chat") ? n : `${n}/chat` : "/api/chat";
@@ -2402,7 +2402,7 @@ function zi(e) {
2402
2402
  function fx(e) {
2403
2403
  return $i.add(e), () => $i.delete(e);
2404
2404
  }
2405
- const px = 3e4, hx = 9e4, ln = It.create({
2405
+ const px = 3e4, hx = 9e4, ln = Nt.create({
2406
2406
  // Only set baseURL when configured — do NOT fall back to localhost. Falling back causes
2407
2407
  // noisy network requests to the frontend Dev server when the backend isn't configured.
2408
2408
  ..._l ? { baseURL: _l } : {},
@@ -2618,7 +2618,7 @@ function Ur(e) {
2618
2618
  }
2619
2619
  function ku(e, t) {
2620
2620
  if (!ma(e)) return null;
2621
- const n = e.values ?? { messages: [] }, r = Array.isArray(n == null ? void 0 : n.messages) ? n.messages : [], { messages: o, ...s } = n, i = Object.keys(s).length ? s : null, a = e.tasks, l = Array.isArray(a) ? a.filter((E) => !!E && typeof E == "object").map((E) => ({ ...E })) : a === null ? null : void 0, c = r.map((E, I) => jx(E, I)).filter((E) => !!E), d = qt(e.config), f = qt(d == null ? void 0 : d.configurable), p = Nt(f, ["checkpoint_id", "checkpointId"]), h = Nt(f, ["checkpoint_ns", "checkpointNs"]), m = qt(e == null ? void 0 : e.parentConfig), x = qt(m == null ? void 0 : m.configurable), y = Nt(x, ["checkpoint_id", "checkpointId"]) ?? null, g = Nt(x, ["checkpoint_ns", "checkpointNs"]) ?? null, w = e == null ? void 0 : e.createdAt, b = typeof w == "string" && w.trim() ? w : new Date(Date.now() - t).toISOString(), T = c[c.length - 1] ?? null, C = qt(e == null ? void 0 : e.metadata), S = Nt(C, ["branch_label", "branchLabel"]), k = Nt(x, ["checkpoint_id", "checkpointId"]), N = Array.isArray(e.next) ? [...e.next] : (e == null ? void 0 : e.next) === null ? null : void 0;
2621
+ const n = e.values ?? { messages: [] }, r = Array.isArray(n == null ? void 0 : n.messages) ? n.messages : [], { messages: o, ...s } = n, i = Object.keys(s).length ? s : null, a = e.tasks, l = Array.isArray(a) ? a.filter((E) => !!E && typeof E == "object").map((E) => ({ ...E })) : a === null ? null : void 0, c = r.map((E, I) => jx(E, I)).filter((E) => !!E), d = qt(e.config), f = qt(d == null ? void 0 : d.configurable), p = jt(f, ["checkpoint_id", "checkpointId"]), h = jt(f, ["checkpoint_ns", "checkpointNs"]), m = qt(e == null ? void 0 : e.parentConfig), x = qt(m == null ? void 0 : m.configurable), y = jt(x, ["checkpoint_id", "checkpointId"]) ?? null, g = jt(x, ["checkpoint_ns", "checkpointNs"]) ?? null, w = e == null ? void 0 : e.createdAt, b = typeof w == "string" && w.trim() ? w : new Date(Date.now() - t).toISOString(), T = c[c.length - 1] ?? null, C = qt(e == null ? void 0 : e.metadata), S = jt(C, ["branch_label", "branchLabel"]), k = jt(x, ["checkpoint_id", "checkpointId"]), N = Array.isArray(e.next) ? [...e.next] : (e == null ? void 0 : e.next) === null ? null : void 0;
2622
2622
  return {
2623
2623
  messages: c,
2624
2624
  checkpointId: p ?? null,
@@ -2734,7 +2734,7 @@ function Ax(e, t) {
2734
2734
  }
2735
2735
  const n = qt(e);
2736
2736
  if (!n) return null;
2737
- const r = Nt(n, ["id", "task_id", "taskId"]) ?? t, o = Nt(n, ["name"]) ?? "task", s = Array.isArray(n.interrupts) ? n.interrupts : void 0, i = Object.prototype.hasOwnProperty.call(n, "state") ? n.state : void 0;
2737
+ const r = jt(n, ["id", "task_id", "taskId"]) ?? t, o = jt(n, ["name"]) ?? "task", s = Array.isArray(n.interrupts) ? n.interrupts : void 0, i = Object.prototype.hasOwnProperty.call(n, "state") ? n.state : void 0;
2738
2738
  return { id: r, name: o, interrupts: s, state: i };
2739
2739
  }
2740
2740
  function Wr(e, t, n = 0, r = /* @__PURE__ */ new Set()) {
@@ -2787,7 +2787,7 @@ function Ru(e, t) {
2787
2787
  if (!e)
2788
2788
  return null;
2789
2789
  if (typeof e == "object" && !Array.isArray(e)) {
2790
- const n = e, r = Nt(n, ["type", "event", "kind"]), o = Nt(n, ["id", "interrupt_id", "interruptId", "value_id"]) ?? (r && r.toLowerCase().includes("interrupt") ? t : void 0);
2790
+ const n = e, r = jt(n, ["type", "event", "kind"]), o = jt(n, ["id", "interrupt_id", "interruptId", "value_id"]) ?? (r && r.toLowerCase().includes("interrupt") ? t : void 0);
2791
2791
  if (!(Object.prototype.hasOwnProperty.call(n, "value") || Object.prototype.hasOwnProperty.call(n, "data") || Object.prototype.hasOwnProperty.call(n, "payload")) && !(r && r.toLowerCase().includes("interrupt")))
2792
2792
  return null;
2793
2793
  const i = Object.prototype.hasOwnProperty.call(n, "value") ? n.value : Object.prototype.hasOwnProperty.call(n, "data") ? n.data : Object.prototype.hasOwnProperty.call(n, "payload") ? n.payload : n, a = o && o.trim() ? o : t;
@@ -2819,7 +2819,7 @@ function jx(e, t) {
2819
2819
  ).toLowerCase(), i = bx[s];
2820
2820
  if (!i)
2821
2821
  return null;
2822
- const a = o.id ?? o.message_id ?? o.run_id ?? null, l = typeof a == "string" && a.trim() ? a : `history-${i}-${t}`, c = qt(o.additional_kwargs) ?? qt(o.additionalKwargs), d = qt(o.response_metadata) ?? qt(o.responseMetadata), f = Nt(c, ["createdAt", "created_at"]) ?? Nt(o, ["created_at", "createdAt"]), p = Nt(c, ["checkpointId", "checkpoint_id"]), h = Nt(c, ["checkpointNs", "checkpoint_ns"]), m = _x(o.content), x = {
2822
+ const a = o.id ?? o.message_id ?? o.run_id ?? null, l = typeof a == "string" && a.trim() ? a : `history-${i}-${t}`, c = qt(o.additional_kwargs) ?? qt(o.additionalKwargs), d = qt(o.response_metadata) ?? qt(o.responseMetadata), f = jt(c, ["createdAt", "created_at"]) ?? jt(o, ["created_at", "createdAt"]), p = jt(c, ["checkpointId", "checkpoint_id"]), h = jt(c, ["checkpointNs", "checkpoint_ns"]), m = _x(o.content), x = {
2823
2823
  id: l,
2824
2824
  role: i,
2825
2825
  content: m
@@ -2863,13 +2863,13 @@ function Ml(e) {
2863
2863
  return o.trim() ? { type: "text", text: o } : null;
2864
2864
  }
2865
2865
  if (n === "image" || n === "image_url") {
2866
- const o = Nt(t, ["url", "src"]);
2866
+ const o = jt(t, ["url", "src"]);
2867
2867
  if (!o) return null;
2868
2868
  const s = { type: "image_url", url: o };
2869
2869
  return typeof t.mimeType == "string" && (s.mimeType = t.mimeType), typeof t.alt == "string" && (s.alt = t.alt), s;
2870
2870
  }
2871
2871
  if (n === "file") {
2872
- const o = Nt(t, ["url"]);
2872
+ const o = jt(t, ["url"]);
2873
2873
  if (!o) return null;
2874
2874
  const s = { type: "file", url: o };
2875
2875
  return typeof t.mimeType == "string" && (s.mimeType = t.mimeType), typeof t.name == "string" && (s.name = t.name), typeof t.size == "number" && (s.size = t.size), typeof t.sourceType == "string" && (s.sourceType = t.sourceType), s;
@@ -2887,7 +2887,7 @@ function Ml(e) {
2887
2887
  ...t
2888
2888
  };
2889
2889
  if (n === "tool") {
2890
- const o = Nt(t, ["text", "content"]);
2890
+ const o = jt(t, ["text", "content"]);
2891
2891
  if (o)
2892
2892
  return { type: "text", text: o };
2893
2893
  }
@@ -2896,7 +2896,7 @@ function Ml(e) {
2896
2896
  }
2897
2897
  function Eu(e, t) {
2898
2898
  var s;
2899
- const n = Nt(e, ["id", "call_id"]) ?? t, r = Nt(e, ["name"]) ?? Nt(qt(e.function), ["name"]);
2899
+ const n = jt(e, ["id", "call_id"]) ?? t, r = jt(e, ["name"]) ?? jt(qt(e.function), ["name"]);
2900
2900
  if (!n || !r) return null;
2901
2901
  const o = Mx(e.args ?? e.arguments ?? ((s = qt(e.function)) == null ? void 0 : s.arguments));
2902
2902
  return { type: "tool_call", id: n, name: r, args: o };
@@ -2929,7 +2929,7 @@ function qt(e) {
2929
2929
  if (!(!e || typeof e != "object" || Array.isArray(e)))
2930
2930
  return { ...e };
2931
2931
  }
2932
- function Nt(e, t) {
2932
+ function jt(e, t) {
2933
2933
  if (e)
2934
2934
  for (const n of t) {
2935
2935
  const r = e[n];
@@ -3061,7 +3061,7 @@ function Bx(e = []) {
3061
3061
  }, [i]), l = Ce((d) => {
3062
3062
  r.current.push(d), a();
3063
3063
  }, [a]);
3064
- Et(() => () => {
3064
+ It(() => () => {
3065
3065
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
3066
3066
  }, []);
3067
3067
  const c = lt(() => ({
@@ -3415,34 +3415,34 @@ function Kx(e = {}) {
3415
3415
  threadId: j.threadId ?? null,
3416
3416
  headers: {}
3417
3417
  }, (async () => {
3418
- var pe, Re, Ee, W, ee, q, P, H, te, se, re, Me, Y, de, ke, Ne, ze, Be;
3419
- const J = (Ue) => {
3418
+ var pe, Re, Ee, W, ee, q, P, H, te, se, re, De, Y, de, ke, Ne, ze, Be;
3419
+ const J = (We) => {
3420
3420
  var qe;
3421
3421
  try {
3422
- const Ge = JSON.parse(JSON.stringify(Ue));
3422
+ const Ge = JSON.parse(JSON.stringify(We));
3423
3423
  return (qe = Ge == null ? void 0 : Ge.payload) != null && qe.files_info && Array.isArray(Ge.payload.files_info) && (Ge.payload.files_info = Ge.payload.files_info.map((et) => ({
3424
3424
  ...et,
3425
3425
  data: et != null && et.data ? `<base64 ${String(et.data).length} chars>` : et == null ? void 0 : et.data
3426
3426
  }))), Ge;
3427
3427
  } catch {
3428
- return Ue;
3428
+ return We;
3429
3429
  }
3430
3430
  };
3431
3431
  try {
3432
- let Ue = {};
3432
+ let We = {};
3433
3433
  try {
3434
3434
  if (r)
3435
- Ue = { Authorization: `Bearer ${r}` };
3435
+ We = { Authorization: `Bearer ${r}` };
3436
3436
  else if (typeof window < "u") {
3437
- const Fe = window.__AUTH_TOKEN__, Pt = ((pe = window.localStorage) == null ? void 0 : pe.getItem("authToken")) || null;
3438
- let jt = null;
3437
+ const Fe = window.__AUTH_TOKEN__, At = ((pe = window.localStorage) == null ? void 0 : pe.getItem("authToken")) || null;
3438
+ let Tt = null;
3439
3439
  try {
3440
3440
  const ve = (Re = window.localStorage) == null ? void 0 : Re.getItem("chat-settings");
3441
- ve && (jt = ((Ee = JSON.parse(ve)) == null ? void 0 : Ee.apiKey) || null);
3441
+ ve && (Tt = ((Ee = JSON.parse(ve)) == null ? void 0 : Ee.apiKey) || null);
3442
3442
  } catch {
3443
3443
  }
3444
- const V = Fe || Pt || jt || null;
3445
- V && (Ue = { Authorization: `Bearer ${V}` });
3444
+ const V = Fe || At || Tt || null;
3445
+ V && (We = { Authorization: `Bearer ${V}` });
3446
3446
  }
3447
3447
  } catch {
3448
3448
  }
@@ -3459,7 +3459,7 @@ function Kx(e = {}) {
3459
3459
  } catch {
3460
3460
  }
3461
3461
  const Ge = {
3462
- ...Ue,
3462
+ ...We,
3463
3463
  ...qe,
3464
3464
  ...s.current
3465
3465
  }, et = {
@@ -3494,23 +3494,23 @@ function Kx(e = {}) {
3494
3494
  ct = [], T.current && p((Fe) => Fe + Ze);
3495
3495
  }
3496
3496
  le = null;
3497
- }, De = () => {
3497
+ }, Ae = () => {
3498
3498
  typeof window < "u" && le == null && (le = requestAnimationFrame(ne));
3499
3499
  };
3500
- let We = Date.now();
3501
- const Pe = setInterval(() => {
3500
+ let He = Date.now();
3501
+ const Oe = setInterval(() => {
3502
3502
  var Ze;
3503
- if (Date.now() - We > 18e5) {
3503
+ if (Date.now() - He > 18e5) {
3504
3504
  const Fe = "Stream idle timeout";
3505
3505
  d(Fe), D = "error", M = Fe, B.abort(), (Ze = A == null ? void 0 : A.onError) == null || Ze.call(A, Fe);
3506
3506
  }
3507
3507
  }, 5e3), tt = 1024 * 1024;
3508
3508
  try {
3509
- const Ze = Je.headers.get("X-Thread-Id") || Je.headers.get("x-thread-id"), Fe = Je.headers.get("X-Thread-Created") || Je.headers.get("x-thread-created"), Pt = Ze ?? null, jt = String(Fe ?? "").toLowerCase() === "true";
3509
+ const Ze = Je.headers.get("X-Thread-Id") || Je.headers.get("x-thread-id"), Fe = Je.headers.get("X-Thread-Created") || Je.headers.get("x-thread-created"), At = Ze ?? null, Tt = String(Fe ?? "").toLowerCase() === "true";
3510
3510
  for (S.current && !S.current.threadId && (S.current = {
3511
3511
  ...S.current,
3512
- threadId: Pt
3513
- }), (q = A == null ? void 0 : A.onOpen) == null || q.call(A, { threadId: Pt, created: jt }); ; ) {
3512
+ threadId: At
3513
+ }), (q = A == null ? void 0 : A.onOpen) == null || q.call(A, { threadId: At, created: Tt }); ; ) {
3514
3514
  const { value: V, done: ve } = await ot.read();
3515
3515
  if (ve) break;
3516
3516
  mt += St.decode(V, { stream: !0 }), mt.length > tt && (mt = "", console.warn("Stream buffer reset: exceeded 1MB"));
@@ -3522,67 +3522,67 @@ function Kx(e = {}) {
3522
3522
  mt = mt.slice(xe + 2);
3523
3523
  const gt = Gx(ht);
3524
3524
  if (!gt) continue;
3525
- let Tt;
3525
+ let kt;
3526
3526
  try {
3527
- Tt = JSON.parse(gt);
3527
+ kt = JSON.parse(gt);
3528
3528
  } catch {
3529
3529
  console.debug("[use-chat] malformed SSE:", gt.slice(0, 200));
3530
3530
  continue;
3531
3531
  }
3532
- const je = qx(Tt) ? Tt.data : Tt;
3533
- We = Date.now();
3534
- const Vt = je.seq;
3532
+ const _e = qx(kt) ? kt.data : kt;
3533
+ He = Date.now();
3534
+ const Vt = _e.seq;
3535
3535
  if (Vt !== void 0) {
3536
3536
  if (Vt <= Ct) {
3537
- console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Vt, lastProcessedSeq: Ct, type: je.type });
3537
+ console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Vt, lastProcessedSeq: Ct, type: _e.type });
3538
3538
  continue;
3539
3539
  }
3540
3540
  Ct > 0 && Vt > Ct + 1 && ((P = A == null ? void 0 : A.onGap) == null || P.call(A, { from: Ct, to: Vt })), Ct = Vt, C.current = Vt, y(Vt);
3541
3541
  }
3542
3542
  if (console.debug("[use-chat] received event", {
3543
- seq: je.seq,
3544
- type: je.type,
3543
+ seq: _e.seq,
3544
+ type: _e.type,
3545
3545
  preview: (() => {
3546
3546
  var ut;
3547
3547
  try {
3548
- return je.type === "message_delta" ? { deltaTypes: (ut = je.delta) == null ? void 0 : ut.map((kt) => kt.type), textLen: (je.delta || []).filter((kt) => kt.type === "text").map((kt) => String(kt.text || "").length) } : je.content || je.delta ? { hasContent: !0 } : {};
3549
- } catch (kt) {
3550
- return { err: String(kt) };
3548
+ return _e.type === "message_delta" ? { deltaTypes: (ut = _e.delta) == null ? void 0 : ut.map((Rt) => Rt.type), textLen: (_e.delta || []).filter((Rt) => Rt.type === "text").map((Rt) => String(Rt.text || "").length) } : _e.content || _e.delta ? { hasContent: !0 } : {};
3549
+ } catch (Rt) {
3550
+ return { err: String(Rt) };
3551
3551
  }
3552
3552
  })()
3553
- }), je.type === "checkpoint")
3554
- k.current = je.checkpointId ?? null, N.current = je.checkpointNs ?? null, m(je.checkpointId ?? null);
3555
- else if (je.type === "state_history") {
3556
- E.current = je;
3553
+ }), _e.type === "checkpoint")
3554
+ k.current = _e.checkpointId ?? null, N.current = _e.checkpointNs ?? null, m(_e.checkpointId ?? null);
3555
+ else if (_e.type === "state_history") {
3556
+ E.current = _e;
3557
3557
  try {
3558
- const kt = Ur(je).latest;
3559
- kt && (k.current = kt.checkpointId ?? null, N.current = kt.checkpointNs ?? null, m(kt.checkpointId ?? null));
3558
+ const Rt = Ur(_e).latest;
3559
+ Rt && (k.current = Rt.checkpointId ?? null, N.current = Rt.checkpointNs ?? null, m(Rt.checkpointId ?? null));
3560
3560
  } catch (ut) {
3561
3561
  console.warn("[use-chat] Failed to hydrate state_history payload", ut);
3562
3562
  }
3563
3563
  }
3564
3564
  try {
3565
- $ == null || $(je);
3565
+ $ == null || $(_e);
3566
3566
  } catch (ut) {
3567
- console.error("[use-chat] Error in onEvent callback:", ut, "for event:", je.type);
3567
+ console.error("[use-chat] Error in onEvent callback:", ut, "for event:", _e.type);
3568
3568
  }
3569
- if (je.type === "token" && e.autoAppendAssistant !== !1)
3570
- ct.push(je.content), De();
3571
- else if (je.type === "message_delta") {
3572
- const ut = je.delta.filter((kt) => kt.type === "text").map((kt) => kt.text).join("");
3573
- ut && e.autoAppendAssistant !== !1 && (ct.push(ut), De());
3574
- } else if (je.type === "heartbeat") {
3569
+ if (_e.type === "token" && e.autoAppendAssistant !== !1)
3570
+ ct.push(_e.content), Ae();
3571
+ else if (_e.type === "message_delta") {
3572
+ const ut = _e.delta.filter((Rt) => Rt.type === "text").map((Rt) => Rt.text).join("");
3573
+ ut && e.autoAppendAssistant !== !1 && (ct.push(ut), Ae());
3574
+ } else if (_e.type === "heartbeat") {
3575
3575
  console.debug("[use-chat] heartbeat received");
3576
3576
  try {
3577
- (H = A == null ? void 0 : A.onHeartbeat) == null || H.call(A, je);
3577
+ (H = A == null ? void 0 : A.onHeartbeat) == null || H.call(A, _e);
3578
3578
  } catch (ut) {
3579
3579
  console.warn("[use-chat] heartbeat callback failed", ut);
3580
3580
  }
3581
- } else if (le !== null && cancelAnimationFrame(le), ne(), je.type === "checkpoint")
3582
- m(je.checkpointId);
3583
- else if (je.type === "error") {
3584
- const ut = je;
3585
- if (d(ut.message), D = "error", M = ut.message, ut.error_type === "auth_error" || ut.code === "TOKEN_EXPIRED" || ((te = ut.message) == null ? void 0 : te.includes("token")) || ((se = ut.message) == null ? void 0 : se.includes("401")) || ((re = ut.message) == null ? void 0 : re.includes("unauthorized")) || ((Me = ut.message) == null ? void 0 : Me.includes("Unauthorized"))) {
3581
+ } else if (le !== null && cancelAnimationFrame(le), ne(), _e.type === "checkpoint")
3582
+ m(_e.checkpointId);
3583
+ else if (_e.type === "error") {
3584
+ const ut = _e;
3585
+ if (d(ut.message), D = "error", M = ut.message, ut.error_type === "auth_error" || ut.code === "TOKEN_EXPIRED" || ((te = ut.message) == null ? void 0 : te.includes("token")) || ((se = ut.message) == null ? void 0 : se.includes("401")) || ((re = ut.message) == null ? void 0 : re.includes("unauthorized")) || ((De = ut.message) == null ? void 0 : De.includes("Unauthorized"))) {
3586
3586
  console.error("[use-chat] Auth error detected:", ut.message);
3587
3587
  try {
3588
3588
  (Y = A == null ? void 0 : A.onAuthError) == null || Y.call(A, ut.message);
@@ -3609,21 +3609,21 @@ function Kx(e = {}) {
3609
3609
  } finally {
3610
3610
  (ke = ot.releaseLock) == null || ke.call(ot);
3611
3611
  }
3612
- le !== null && typeof window < "u" && window.cancelAnimationFrame(le), clearInterval(Pe);
3612
+ le !== null && typeof window < "u" && window.cancelAnimationFrame(le), clearInterval(Oe);
3613
3613
  }
3614
- } catch (Ue) {
3615
- if (Ue.name === "AbortError")
3614
+ } catch (We) {
3615
+ if (We.name === "AbortError")
3616
3616
  D = D ?? "aborted";
3617
3617
  else {
3618
- const qe = Ue.message || String(Ue);
3618
+ const qe = We.message || String(We);
3619
3619
  D = "error", M = qe, d(qe), (Ne = A == null ? void 0 : A.onError) == null || Ne.call(A, qe), Z || ((ze = A == null ? void 0 : A.onConnectionError) == null || ze.call(A, qe), Z = !0);
3620
3620
  }
3621
3621
  } finally {
3622
- const Ue = C.current, qe = k.current, Ge = N.current, et = E.current, Je = D ?? (B.signal.aborted ? "aborted" : M ? "error" : "complete");
3622
+ const We = C.current, qe = k.current, Ge = N.current, et = E.current, Je = D ?? (B.signal.aborted ? "aborted" : M ? "error" : "complete");
3623
3623
  try {
3624
3624
  (Be = A == null ? void 0 : A.onClosed) == null || Be.call(A, {
3625
3625
  reason: Je,
3626
- lastSeq: Ue,
3626
+ lastSeq: We,
3627
3627
  lastCheckpointId: qe,
3628
3628
  lastCheckpointNs: Ge,
3629
3629
  lastStateHistory: et,
@@ -3638,7 +3638,7 @@ function Kx(e = {}) {
3638
3638
  },
3639
3639
  [t, n, r, e.autoAppendAssistant]
3640
3640
  );
3641
- return Et(() => () => {
3641
+ return It(() => () => {
3642
3642
  var j;
3643
3643
  T.current = !1, (j = b.current) == null || j.abort();
3644
3644
  }, []), {
@@ -3876,10 +3876,10 @@ function Xx({
3876
3876
  checkpointMetadataCache: l
3877
3877
  }) {
3878
3878
  const { api: c, baseUrl: d } = Tu(), f = lt(() => _n(d), [d]), [p, h] = ge([]), [m, x] = ge(t), [y, g] = ge(!1), [w, b] = ge(null), [T, C] = ge(!1), [S, k] = ge(null), { state: N, seed: E, prepend: I, pushUser: O, onEvent: L } = Bx(), [F, j] = ge(!1), [$, A] = ge(!1), [B, D] = ge(null), [M, Z] = ge([]), [J, pe] = ge(!1), Re = l ?? Lx(), { setCacheForThread: Ee } = Re, W = Qe(m), ee = Qe(null), q = Qe(null);
3879
- Et(() => {
3879
+ It(() => {
3880
3880
  W.current = m;
3881
3881
  }, [m]);
3882
- const P = Qe(), { startStream: H, stop: te, isStreaming: se, error: re, setAuthToken: Me } = Yx({
3882
+ const P = Qe(), { startStream: H, stop: te, isStreaming: se, error: re, setAuthToken: De } = Yx({
3883
3883
  baseUrl: f,
3884
3884
  onThreadInfo: (le) => {
3885
3885
  console.log("[ChatSessionProvider] Thread info:", le.threadId), W.current !== le.threadId && (!W.current && N.messages.length <= 1 && (q.current = le.threadId), x(le.threadId));
@@ -3923,19 +3923,19 @@ function Xx({
3923
3923
  async (le, ne) => {
3924
3924
  try {
3925
3925
  await c.updateThread(le, ne), await Y();
3926
- } catch (De) {
3927
- s == null || s(String(De));
3926
+ } catch (Ae) {
3927
+ s == null || s(String(Ae));
3928
3928
  }
3929
3929
  },
3930
3930
  [c, Y, s]
3931
3931
  ), ze = Ce(
3932
- (le, ne, De) => {
3933
- const We = ne.filter((Pe) => Pe.checkpointId).map((Pe) => ({
3934
- checkpointId: Pe.checkpointId,
3935
- checkpointNs: Pe.checkpointNs ?? void 0,
3936
- createdAt: Pe.createdAt ?? ""
3932
+ (le, ne, Ae) => {
3933
+ const He = ne.filter((Oe) => Oe.checkpointId).map((Oe) => ({
3934
+ checkpointId: Oe.checkpointId,
3935
+ checkpointNs: Oe.checkpointNs ?? void 0,
3936
+ createdAt: Oe.createdAt ?? ""
3937
3937
  }));
3938
- console.log(`[ChatSessionProvider] Cached metadata for ${We.length} checkpoints from ${De}`), Ee(le, We);
3938
+ console.log(`[ChatSessionProvider] Cached metadata for ${He.length} checkpoints from ${Ae}`), Ee(le, He);
3939
3939
  },
3940
3940
  [Ee]
3941
3941
  ), Be = Ce(
@@ -3943,20 +3943,20 @@ function Xx({
3943
3943
  if (le) {
3944
3944
  C(!0), k(null);
3945
3945
  try {
3946
- const De = await c.getStateHistory({
3946
+ const Ae = await c.getStateHistory({
3947
3947
  threadId: le,
3948
3948
  checkpointId: ne || void 0
3949
3949
  // Let backend pick latest if not specified
3950
- }), { checkpoints: We } = Ur(De);
3951
- ze(le, We, `thread load (requested: ${ne})`);
3952
- const Pe = We.find((tt) => tt.messages && tt.messages.length > 0) ?? (ne ? We.find((tt) => tt.checkpointId === ne) : null) ?? We[0];
3953
- E((Pe == null ? void 0 : Pe.messages) ?? [], {
3954
- checkpointId: (Pe == null ? void 0 : Pe.checkpointId) ?? null,
3955
- checkpointNs: (Pe == null ? void 0 : Pe.checkpointNs) ?? null
3956
- }), Z(We), j(!!(Pe != null && Pe.nextCursor)), D((Pe == null ? void 0 : Pe.nextCursor) ?? null);
3957
- } catch (De) {
3958
- const We = String(De);
3959
- k(We), s == null || s(We);
3950
+ }), { checkpoints: He } = Ur(Ae);
3951
+ ze(le, He, `thread load (requested: ${ne})`);
3952
+ const Oe = He.find((tt) => tt.messages && tt.messages.length > 0) ?? (ne ? He.find((tt) => tt.checkpointId === ne) : null) ?? He[0];
3953
+ E((Oe == null ? void 0 : Oe.messages) ?? [], {
3954
+ checkpointId: (Oe == null ? void 0 : Oe.checkpointId) ?? null,
3955
+ checkpointNs: (Oe == null ? void 0 : Oe.checkpointNs) ?? null
3956
+ }), Z(He), j(!!(Oe != null && Oe.nextCursor)), D((Oe == null ? void 0 : Oe.nextCursor) ?? null);
3957
+ } catch (Ae) {
3958
+ const He = String(Ae);
3959
+ k(He), s == null || s(He);
3960
3960
  } finally {
3961
3961
  C(!1);
3962
3962
  }
@@ -3964,34 +3964,34 @@ function Xx({
3964
3964
  },
3965
3965
  [c, E, s, ze]
3966
3966
  );
3967
- Et(() => {
3967
+ It(() => {
3968
3968
  P.current = Be;
3969
3969
  }, [Be]);
3970
- const Ue = Ce(
3970
+ const We = Ce(
3971
3971
  async (le, ne) => {
3972
- const De = W.current;
3973
- if (De) {
3972
+ const Ae = W.current;
3973
+ if (Ae) {
3974
3974
  pe(!0);
3975
3975
  try {
3976
- const We = await c.getStateHistory({
3977
- threadId: De,
3976
+ const He = await c.getStateHistory({
3977
+ threadId: Ae,
3978
3978
  checkpointId: le,
3979
3979
  checkpointNs: ne ?? void 0
3980
- }), { checkpoints: Pe } = Ur(We);
3981
- ze(De, Pe, "checkpoint navigation");
3982
- const tt = Pe.find(
3980
+ }), { checkpoints: Oe } = Ur(He);
3981
+ ze(Ae, Oe, "checkpoint navigation");
3982
+ const tt = Oe.find(
3983
3983
  (Ze) => Ze.checkpointId === le && (ne ? Ze.checkpointNs === ne : !0)
3984
3984
  );
3985
3985
  if (!tt) {
3986
3986
  console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: le, checkpointNs: ne });
3987
3987
  return;
3988
3988
  }
3989
- Z(Pe), E(tt.messages ?? [], {
3989
+ Z(Oe), E(tt.messages ?? [], {
3990
3990
  checkpointId: tt.checkpointId ?? null,
3991
3991
  checkpointNs: tt.checkpointNs ?? null
3992
3992
  });
3993
- } catch (We) {
3994
- s == null || s(String(We));
3993
+ } catch (He) {
3994
+ s == null || s(String(He));
3995
3995
  } finally {
3996
3996
  pe(!1);
3997
3997
  }
@@ -4017,8 +4017,8 @@ function Xx({
4017
4017
  checkpointId: B
4018
4018
  }), { checkpoints: ne } = Ur(le);
4019
4019
  if (ne.length > 0) {
4020
- const De = ne[ne.length - 1];
4021
- I((De == null ? void 0 : De.messages) ?? []), j(!!(De != null && De.nextCursor)), D((De == null ? void 0 : De.nextCursor) ?? null);
4020
+ const Ae = ne[ne.length - 1];
4021
+ I((Ae == null ? void 0 : Ae.messages) ?? []), j(!!(Ae != null && Ae.nextCursor)), D((Ae == null ? void 0 : Ae.nextCursor) ?? null);
4022
4022
  }
4023
4023
  } catch (le) {
4024
4024
  s == null || s(String(le));
@@ -4029,18 +4029,18 @@ function Xx({
4029
4029
  }, [c, B, I, s]), Je = Ce(async () => {
4030
4030
  E([], {}), x(null), te(), Z([]), j(!1), D(null);
4031
4031
  }, [E, te]), ot = Ce(
4032
- async (le, ne, De) => {
4033
- const We = W.current;
4034
- if (!We)
4032
+ async (le, ne, Ae) => {
4033
+ const He = W.current;
4034
+ if (!He)
4035
4035
  throw new Error("No active thread to handle interrupt");
4036
- const Pe = ne ? De ?? !0 : !1;
4036
+ const Oe = ne ? Ae ?? !0 : !1;
4037
4037
  try {
4038
4038
  const tt = {
4039
- threadId: We,
4039
+ threadId: He,
4040
4040
  checkpointId: N.lastCheckpointId ?? void 0,
4041
4041
  checkpointNs: N.lastCheckpointNs ?? void 0,
4042
4042
  // The command is the key: backend extracts this and routes to LangGraph
4043
- command: { kind: "resume", value: Pe }
4043
+ command: { kind: "resume", value: Oe }
4044
4044
  };
4045
4045
  H(tt);
4046
4046
  } catch (tt) {
@@ -4049,9 +4049,9 @@ function Xx({
4049
4049
  },
4050
4050
  [N.lastCheckpointId, N.lastCheckpointNs, H]
4051
4051
  );
4052
- Et(() => {
4052
+ It(() => {
4053
4053
  Y();
4054
- }, [Y]), Et(() => {
4054
+ }, [Y]), It(() => {
4055
4055
  var le, ne;
4056
4056
  if (!(!o || !m || T)) {
4057
4057
  if (q.current === m) {
@@ -4060,18 +4060,26 @@ function Xx({
4060
4060
  }
4061
4061
  ee.current !== m && (ee.current = m, n ? (console.log("[ChatSessionProvider] Loading thread with checkpoint:", n), (le = P.current) == null || le.call(P, m, n)) : (console.log("[ChatSessionProvider] Loading thread with latest checkpoint"), (ne = P.current) == null || ne.call(P, m)));
4062
4062
  }
4063
- }, [o, m, T, n, r]), Et(() => {
4063
+ }, [o, m, T, n, r]), It(() => {
4064
4064
  a == null || a(m);
4065
4065
  }, [m, a]);
4066
4066
  const St = Ce(
4067
4067
  async (le, ne) => {
4068
- const De = W.current, We = (le == null ? void 0 : le.text) ?? "";
4069
- if (!De && !We) return;
4070
- const { contentParts: Pe } = await wx(
4068
+ let Ae = W.current;
4069
+ const He = (le == null ? void 0 : le.text) ?? "";
4070
+ if (!Ae && !He) return;
4071
+ if (!Ae && He) {
4072
+ const At = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), Tt = Array.from(
4073
+ { length: 4 },
4074
+ () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")
4075
+ ).join("").slice(0, 16);
4076
+ Ae = `${At}${Tt}`, q.current = Ae, x(Ae);
4077
+ }
4078
+ const { contentParts: Oe } = await wx(
4071
4079
  c,
4072
4080
  (le == null ? void 0 : le.attachments) ?? []
4073
- ), tt = [...Pe];
4074
- We != null && We.trim() && tt.push({ type: "text", text: We });
4081
+ ), tt = [...Oe];
4082
+ He != null && He.trim() && tt.push({ type: "text", text: He });
4075
4083
  const Ze = {
4076
4084
  id: `msg-${Date.now()}`,
4077
4085
  role: "user",
@@ -4080,7 +4088,7 @@ function Xx({
4080
4088
  };
4081
4089
  O(Ze);
4082
4090
  const Fe = {
4083
- threadId: De,
4091
+ threadId: Ae,
4084
4092
  payload: {
4085
4093
  messages: [Ze]
4086
4094
  },
@@ -4123,7 +4131,7 @@ function Xx({
4123
4131
  hasMore: F,
4124
4132
  loadOlder: et,
4125
4133
  clearState: Je,
4126
- navigateToCheckpoint: Ue,
4134
+ navigateToCheckpoint: We,
4127
4135
  setCurrentCheckpointId: qe,
4128
4136
  returnToLatest: Ge,
4129
4137
  loadThread: Be,
@@ -4141,7 +4149,7 @@ function Xx({
4141
4149
  F,
4142
4150
  et,
4143
4151
  Je,
4144
- Ue,
4152
+ We,
4145
4153
  qe,
4146
4154
  Ge,
4147
4155
  Be,
@@ -4155,9 +4163,9 @@ function Xx({
4155
4163
  submit: St,
4156
4164
  send: St,
4157
4165
  stop: te,
4158
- setAuthToken: Me
4166
+ setAuthToken: De
4159
4167
  }),
4160
- [se, re, St, te, Me]
4168
+ [se, re, St, te, De]
4161
4169
  );
4162
4170
  return /* @__PURE__ */ u.jsx(Au.Provider, { value: mt, children: /* @__PURE__ */ u.jsx(ju.Provider, { value: ct, children: /* @__PURE__ */ u.jsx(_u.Provider, { value: Ct, children: e }) }) });
4163
4171
  }
@@ -4533,7 +4541,7 @@ var iy = [
4533
4541
  "span",
4534
4542
  "svg",
4535
4543
  "ul"
4536
- ], Ae = iy.reduce((e, t) => {
4544
+ ], je = iy.reduce((e, t) => {
4537
4545
  const n = Tr(`Primitive.${t}`), r = v.forwardRef((o, s) => {
4538
4546
  const { asChild: i, ...a } = o, l = i ? n : t;
4539
4547
  return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ u.jsx(l, { ...a, ref: s });
@@ -4640,7 +4648,7 @@ var cy = "DismissableLayer", Bi = "dismissableLayer.update", uy = "dismissableLa
4640
4648
  const k = () => h({});
4641
4649
  return document.addEventListener(Bi, k), () => document.removeEventListener(Bi, k);
4642
4650
  }, []), /* @__PURE__ */ u.jsx(
4643
- Ae.div,
4651
+ je.div,
4644
4652
  {
4645
4653
  ...l,
4646
4654
  ref: m,
@@ -4667,7 +4675,7 @@ var fy = "DismissableLayerBranch", py = v.forwardRef((e, t) => {
4667
4675
  return n.branches.add(s), () => {
4668
4676
  n.branches.delete(s);
4669
4677
  };
4670
- }, [n.branches]), /* @__PURE__ */ u.jsx(Ae.div, { ...e, ref: o });
4678
+ }, [n.branches]), /* @__PURE__ */ u.jsx(je.div, { ...e, ref: o });
4671
4679
  });
4672
4680
  py.displayName = fy;
4673
4681
  function hy(e, t = globalThis == null ? void 0 : globalThis.document) {
@@ -4799,7 +4807,7 @@ var hi = "focusScope.autoFocusOnMount", mi = "focusScope.autoFocusOnUnmount", Kl
4799
4807
  },
4800
4808
  [n, r, h.paused]
4801
4809
  );
4802
- return /* @__PURE__ */ u.jsx(Ae.div, { tabIndex: -1, ...i, ref: p, onKeyDown: m });
4810
+ return /* @__PURE__ */ u.jsx(je.div, { tabIndex: -1, ...i, ref: p, onKeyDown: m });
4803
4811
  });
4804
4812
  Is.displayName = gy;
4805
4813
  function xy(e, { select: t = !1 } = {}) {
@@ -6185,7 +6193,7 @@ const Ev = (e) => {
6185
6193
  var Mv = "Arrow", Yu = v.forwardRef((e, t) => {
6186
6194
  const { children: n, width: r = 10, height: o = 5, ...s } = e;
6187
6195
  return /* @__PURE__ */ u.jsx(
6188
- Ae.svg,
6196
+ je.svg,
6189
6197
  {
6190
6198
  ...s,
6191
6199
  ref: t,
@@ -6232,7 +6240,7 @@ var ed = "PopperAnchor", td = v.forwardRef(
6232
6240
  return v.useEffect(() => {
6233
6241
  const c = l.current;
6234
6242
  l.current = (r == null ? void 0 : r.current) || i.current, c !== l.current && s.onAnchorChange(l.current);
6235
- }), r ? null : /* @__PURE__ */ u.jsx(Ae.div, { ...o, ref: a });
6243
+ }), r ? null : /* @__PURE__ */ u.jsx(je.div, { ...o, ref: a });
6236
6244
  }
6237
6245
  );
6238
6246
  td.displayName = ed;
@@ -6254,7 +6262,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6254
6262
  updatePositionStrategy: h = "optimized",
6255
6263
  onPlaced: m,
6256
6264
  ...x
6257
- } = e, y = Zu(Na, n), [g, w] = v.useState(null), b = Ke(t, (Me) => w(Me)), [T, C] = v.useState(null), S = Xu(T), k = (S == null ? void 0 : S.width) ?? 0, N = (S == null ? void 0 : S.height) ?? 0, E = r + (s !== "center" ? "-" + s : ""), I = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, O = Array.isArray(c) ? c : [c], L = O.length > 0, F = {
6265
+ } = e, y = Zu(Na, n), [g, w] = v.useState(null), b = Ke(t, (De) => w(De)), [T, C] = v.useState(null), S = Xu(T), k = (S == null ? void 0 : S.width) ?? 0, N = (S == null ? void 0 : S.height) ?? 0, E = r + (s !== "center" ? "-" + s : ""), I = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, O = Array.isArray(c) ? c : [c], L = O.length > 0, F = {
6258
6266
  padding: I,
6259
6267
  boundary: O.filter(Bv),
6260
6268
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
@@ -6263,7 +6271,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6263
6271
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
6264
6272
  strategy: "fixed",
6265
6273
  placement: E,
6266
- whileElementsMounted: (...Me) => gv(...Me, {
6274
+ whileElementsMounted: (...De) => gv(...De, {
6267
6275
  animationFrame: h === "always"
6268
6276
  }),
6269
6277
  elements: {
@@ -6280,8 +6288,8 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6280
6288
  l && jv({ ...F }),
6281
6289
  _v({
6282
6290
  ...F,
6283
- apply: ({ elements: Me, rects: Y, availableWidth: de, availableHeight: ke }) => {
6284
- const { width: Ne, height: ze } = Y.reference, Be = Me.floating.style;
6291
+ apply: ({ elements: De, rects: Y, availableWidth: de, availableHeight: ke }) => {
6292
+ const { width: Ne, height: ze } = Y.reference, Be = De.floating.style;
6285
6293
  Be.setProperty("--radix-popper-available-width", `${de}px`), Be.setProperty("--radix-popper-available-height", `${ke}px`), Be.setProperty("--radix-popper-anchor-width", `${Ne}px`), Be.setProperty("--radix-popper-anchor-height", `${ze}px`);
6286
6294
  }
6287
6295
  }),
@@ -6330,7 +6338,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6330
6338
  arrowY: Re,
6331
6339
  shouldHideArrow: Ee,
6332
6340
  children: /* @__PURE__ */ u.jsx(
6333
- Ae.div,
6341
+ je.div,
6334
6342
  {
6335
6343
  "data-side": M,
6336
6344
  "data-align": Z,
@@ -6424,7 +6432,7 @@ var id = Qu, ad = td, ld = nd, cd = od, Uv = "Portal", Os = v.forwardRef((e, t)
6424
6432
  const { container: n, ...r } = e, [o, s] = v.useState(!1);
6425
6433
  Lt(() => s(!0), []);
6426
6434
  const i = n || o && ((a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : a.body);
6427
- return i ? Zc.createPortal(/* @__PURE__ */ u.jsx(Ae.div, { ...r, ref: t }), i) : null;
6435
+ return i ? Zc.createPortal(/* @__PURE__ */ u.jsx(je.div, { ...r, ref: t }), i) : null;
6428
6436
  });
6429
6437
  Os.displayName = Uv;
6430
6438
  function Wv(e, t) {
@@ -6543,7 +6551,7 @@ var Zv = v.forwardRef((e, t) => {
6543
6551
  []
6544
6552
  ),
6545
6553
  children: /* @__PURE__ */ u.jsx(
6546
- Ae.div,
6554
+ je.div,
6547
6555
  {
6548
6556
  tabIndex: g || S === 0 ? -1 : 0,
6549
6557
  "data-orientation": r,
@@ -6592,7 +6600,7 @@ var Zv = v.forwardRef((e, t) => {
6592
6600
  focusable: r,
6593
6601
  active: o,
6594
6602
  children: /* @__PURE__ */ u.jsx(
6595
- Ae.span,
6603
+ je.span,
6596
6604
  {
6597
6605
  tabIndex: f ? 0 : -1,
6598
6606
  "data-orientation": d.orientation,
@@ -7414,14 +7422,14 @@ Ad.displayName = an;
7414
7422
  var ob = "MenuGroup", Ma = v.forwardRef(
7415
7423
  (e, t) => {
7416
7424
  const { __scopeMenu: n, ...r } = e;
7417
- return /* @__PURE__ */ u.jsx(Ae.div, { role: "group", ...r, ref: t });
7425
+ return /* @__PURE__ */ u.jsx(je.div, { role: "group", ...r, ref: t });
7418
7426
  }
7419
7427
  );
7420
7428
  Ma.displayName = ob;
7421
7429
  var sb = "MenuLabel", jd = v.forwardRef(
7422
7430
  (e, t) => {
7423
7431
  const { __scopeMenu: n, ...r } = e;
7424
- return /* @__PURE__ */ u.jsx(Ae.div, { ...r, ref: t });
7432
+ return /* @__PURE__ */ u.jsx(je.div, { ...r, ref: t });
7425
7433
  }
7426
7434
  );
7427
7435
  jd.displayName = sb;
@@ -7471,7 +7479,7 @@ var _d = v.forwardRef(
7471
7479
  disabled: r,
7472
7480
  textValue: o ?? p,
7473
7481
  children: /* @__PURE__ */ u.jsx(ow, { asChild: !0, ...a, focusable: !r, children: /* @__PURE__ */ u.jsx(
7474
- Ae.div,
7482
+ je.div,
7475
7483
  {
7476
7484
  role: "menuitem",
7477
7485
  "data-highlighted": d ? "" : void 0,
@@ -7563,7 +7571,7 @@ var Da = "MenuItemIndicator", [Fd, cb] = dr(
7563
7571
  {
7564
7572
  present: r || rs(s.checked) || s.checked === !0,
7565
7573
  children: /* @__PURE__ */ u.jsx(
7566
- Ae.span,
7574
+ je.span,
7567
7575
  {
7568
7576
  ...o,
7569
7577
  ref: t,
@@ -7579,7 +7587,7 @@ var ub = "MenuSeparator", zd = v.forwardRef(
7579
7587
  (e, t) => {
7580
7588
  const { __scopeMenu: n, ...r } = e;
7581
7589
  return /* @__PURE__ */ u.jsx(
7582
- Ae.div,
7590
+ je.div,
7583
7591
  {
7584
7592
  role: "separator",
7585
7593
  "aria-orientation": "horizontal",
@@ -7785,7 +7793,7 @@ var Yd = "DropdownMenuTrigger", Xd = v.forwardRef(
7785
7793
  (e, t) => {
7786
7794
  const { __scopeDropdownMenu: n, disabled: r = !1, ...o } = e, s = qd(Yd, n), i = Ut(n);
7787
7795
  return /* @__PURE__ */ u.jsx(vb, { asChild: !0, ...i, children: /* @__PURE__ */ u.jsx(
7788
- Ae.button,
7796
+ je.button,
7789
7797
  {
7790
7798
  type: "button",
7791
7799
  id: s.triggerId,
@@ -8111,13 +8119,13 @@ function yt(...e) {
8111
8119
  function it(e, t) {
8112
8120
  return e(Kn, t);
8113
8121
  }
8114
- function Oe(e, t) {
8122
+ function Me(e, t) {
8115
8123
  e(zs, t);
8116
8124
  }
8117
8125
  function $a(e) {
8118
8126
  e(Pr);
8119
8127
  }
8120
- function Rt(e) {
8128
+ function Et(e) {
8121
8129
  return e(vf);
8122
8130
  }
8123
8131
  function he(e, t) {
@@ -8284,14 +8292,14 @@ function x0(e) {
8284
8292
  };
8285
8293
  return n(e);
8286
8294
  }
8287
- function At(...e) {
8295
+ function _t(...e) {
8288
8296
  const t = Ve(), n = new Array(e.length);
8289
8297
  let r = 0;
8290
8298
  const o = Math.pow(2, e.length) - 1;
8291
8299
  return e.forEach((s, i) => {
8292
8300
  const a = Math.pow(2, i);
8293
8301
  it(s, (l) => {
8294
- n[i] = l, r = r | a, r === o && Oe(t, n);
8302
+ n[i] = l, r = r | a, r === o && Me(t, n);
8295
8303
  });
8296
8304
  }), function(s, i) {
8297
8305
  switch (s) {
@@ -8332,7 +8340,7 @@ const y0 = {
8332
8340
  return {
8333
8341
  log: X((t, n, r = 1) => {
8334
8342
  var o;
8335
- const s = (o = v0().VIRTUOSO_LOG_LEVEL) != null ? o : Rt(e);
8343
+ const s = (o = v0().VIRTUOSO_LOG_LEVEL) != null ? o : Et(e);
8336
8344
  r >= s && console[y0[r]](
8337
8345
  "%creact-virtuoso: %c%s %o",
8338
8346
  "color: #0253b3; font-weight: bold",
@@ -8522,7 +8530,7 @@ function gn(e, t, n = "k") {
8522
8530
  return gn(e.l, t, n);
8523
8531
  }
8524
8532
  function Zt(e, t, n) {
8525
- return ft(e) ? Rf(t, n, 1) : t === e.k ? _t(e, { k: t, v: n }) : t < e.k ? xc(_t(e, { l: Zt(e.l, t, n) })) : xc(_t(e, { r: Zt(e.r, t, n) }));
8533
+ return ft(e) ? Rf(t, n, 1) : t === e.k ? Pt(e, { k: t, v: n }) : t < e.k ? xc(Pt(e, { l: Zt(e.l, t, n) })) : xc(Pt(e, { r: Zt(e.r, t, n) }));
8526
8534
  }
8527
8535
  function Sr() {
8528
8536
  return no;
@@ -8543,9 +8551,9 @@ function Xi(e, t) {
8543
8551
  return r;
8544
8552
  {
8545
8553
  const [s, i] = kf(r);
8546
- return Vo(_t(e, { k: s, l: Tf(r), v: i }));
8554
+ return Vo(Pt(e, { k: s, l: Tf(r), v: i }));
8547
8555
  }
8548
- } else return t < n ? Vo(_t(e, { l: Xi(r, t) })) : Vo(_t(e, { r: Xi(o, t) }));
8556
+ } else return t < n ? Vo(Pt(e, { l: Xi(r, t) })) : Vo(Pt(e, { r: Xi(o, t) }));
8549
8557
  }
8550
8558
  function tr(e) {
8551
8559
  return ft(e) ? [] : [...tr(e.l), { k: e.k, v: e.v }, ...tr(e.r)];
@@ -8563,12 +8571,12 @@ function Vo(e) {
8563
8571
  return e;
8564
8572
  if (n > r.lvl + 1) {
8565
8573
  if (Ci(t))
8566
- return Ef(_t(e, { lvl: n - 1 }));
8574
+ return Ef(Pt(e, { lvl: n - 1 }));
8567
8575
  if (!ft(t) && !ft(t.r))
8568
- return _t(t.r, {
8569
- l: _t(t, { r: t.r.l }),
8576
+ return Pt(t.r, {
8577
+ l: Pt(t, { r: t.r.l }),
8570
8578
  lvl: n,
8571
- r: _t(e, {
8579
+ r: Pt(e, {
8572
8580
  l: t.r.r,
8573
8581
  lvl: n - 1
8574
8582
  })
@@ -8576,22 +8584,22 @@ function Vo(e) {
8576
8584
  throw new Error("Unexpected empty nodes");
8577
8585
  } else {
8578
8586
  if (Ci(e))
8579
- return Zi(_t(e, { lvl: n - 1 }));
8587
+ return Zi(Pt(e, { lvl: n - 1 }));
8580
8588
  if (!ft(r) && !ft(r.l)) {
8581
8589
  const o = r.l, s = Ci(o) ? r.lvl - 1 : r.lvl;
8582
- return _t(o, {
8583
- l: _t(e, {
8590
+ return Pt(o, {
8591
+ l: Pt(e, {
8584
8592
  lvl: n - 1,
8585
8593
  r: o.l
8586
8594
  }),
8587
8595
  lvl: o.lvl + 1,
8588
- r: Zi(_t(r, { l: o.r, lvl: s }))
8596
+ r: Zi(Pt(r, { l: o.r, lvl: s }))
8589
8597
  });
8590
8598
  } else
8591
8599
  throw new Error("Unexpected empty nodes");
8592
8600
  }
8593
8601
  }
8594
- function _t(e, t) {
8602
+ function Pt(e, t) {
8595
8603
  return Rf(
8596
8604
  t.k !== void 0 ? t.k : e.k,
8597
8605
  t.v !== void 0 ? t.v : e.v,
@@ -8601,7 +8609,7 @@ function _t(e, t) {
8601
8609
  );
8602
8610
  }
8603
8611
  function Tf(e) {
8604
- return ft(e.r) ? e.l : Vo(_t(e, { r: Tf(e.r) }));
8612
+ return ft(e.r) ? e.l : Vo(Pt(e, { r: Tf(e.r) }));
8605
8613
  }
8606
8614
  function Ci(e) {
8607
8615
  return ft(e) || e.lvl > e.r.lvl;
@@ -8617,11 +8625,11 @@ function xc(e) {
8617
8625
  }
8618
8626
  function Ef(e) {
8619
8627
  const { l: t } = e;
8620
- return !ft(t) && t.lvl === e.lvl ? _t(t, { r: _t(e, { l: t.r }) }) : e;
8628
+ return !ft(t) && t.lvl === e.lvl ? Pt(t, { r: Pt(e, { l: t.r }) }) : e;
8621
8629
  }
8622
8630
  function Zi(e) {
8623
8631
  const { lvl: t, r: n } = e;
8624
- return !ft(n) && !ft(n.r) && n.lvl === t && n.r.lvl === t ? _t(n, { l: _t(e, { r: n.l }), lvl: t + 1 }) : e;
8632
+ return !ft(n) && !ft(n.r) && n.lvl === t && n.r.lvl === t ? Pt(n, { l: Pt(e, { r: n.l }), lvl: t + 1 }) : e;
8625
8633
  }
8626
8634
  function S0(e) {
8627
8635
  return Cf(e, ({ k: t, v: n }) => ({ index: t, value: n }));
@@ -8856,7 +8864,7 @@ const P0 = {
8856
8864
  he(
8857
8865
  U(
8858
8866
  d,
8859
- Te((C) => C !== void 0 && ft(Rt(x).sizeTree)),
8867
+ Te((C) => C !== void 0 && ft(Et(x).sizeTree)),
8860
8868
  ce((C) => [{ endIndex: 0, size: C, startIndex: 0 }])
8861
8869
  ),
8862
8870
  n
@@ -8885,12 +8893,12 @@ const P0 = {
8885
8893
  ce((C) => C.diff)
8886
8894
  ),
8887
8895
  (C) => {
8888
- const { groupIndices: S } = Rt(x);
8896
+ const { groupIndices: S } = Et(x);
8889
8897
  if (C > 0)
8890
- Oe(t, !0), Oe(s, C + yc(C, S));
8898
+ Me(t, !0), Me(s, C + yc(C, S));
8891
8899
  else if (C < 0) {
8892
- const k = Rt(y);
8893
- k.length > 0 && (C -= yc(-C, k)), Oe(i, C);
8900
+ const k = Et(y);
8901
+ k.length > 0 && (C -= yc(-C, k)), Me(i, C);
8894
8902
  }
8895
8903
  }
8896
8904
  ), it(U(a, Le(e)), ([C, S]) => {
@@ -8981,7 +8989,7 @@ const P0 = {
8981
8989
  if (ft(S.sizeTree))
8982
8990
  return S;
8983
8991
  let N = Sr();
8984
- const E = Rt(y);
8992
+ const E = Et(y);
8985
8993
  let I = 0, O = 0, L = 0;
8986
8994
  for (; I < -C; ) {
8987
8995
  L = E[O];
@@ -9061,7 +9069,7 @@ const _f = nt(
9061
9069
  e
9062
9070
  ), he(
9063
9071
  U(
9064
- At(o, t, r),
9072
+ _t(o, t, r),
9065
9073
  Te(([l, c]) => Us(c)),
9066
9074
  ce(([l, c, d]) => gn(c.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
9067
9075
  xt(),
@@ -9081,7 +9089,7 @@ const _f = nt(
9081
9089
  )
9082
9090
  );
9083
9091
  return it(t, (r) => {
9084
- r && Rt(e)("props updated", {}, Xt.DEBUG);
9092
+ r && Et(e)("props updated", {}, Xt.DEBUG);
9085
9093
  }), { didMount: n, propsReady: t };
9086
9094
  },
9087
9095
  yt(qn),
@@ -9109,7 +9117,7 @@ const vo = nt(
9109
9117
  const h = Ve(), m = Ve(), x = X(0);
9110
9118
  let y = null, g = null, w = null;
9111
9119
  function b() {
9112
- y && (y(), y = null), w && (w(), w = null), g && (clearTimeout(g), g = null), Oe(l, !1);
9120
+ y && (y(), y = null), w && (w(), w = null), g && (clearTimeout(g), g = null), Me(l, !1);
9113
9121
  }
9114
9122
  return he(
9115
9123
  U(
@@ -9127,7 +9135,7 @@ const vo = nt(
9127
9135
  let J = so(Z, C.offsetTree, L) + E;
9128
9136
  A === "end" ? (J += F + gn(C.sizeTree, Z)[1] - S + j, Z === M && (J += I)) : A === "center" ? J += (F + gn(C.sizeTree, Z)[1] - S + j) / 2 : J -= N, D && (J += D);
9129
9137
  const pe = (Re) => {
9130
- b(), Re ? (O("retrying to scroll to", { location: T }, Xt.DEBUG), Oe(h, T)) : (Oe(m, !0), O("list did not change, scroll successful", {}, Xt.DEBUG));
9138
+ b(), Re ? (O("retrying to scroll to", { location: T }, Xt.DEBUG), Me(h, T)) : (Me(m, !0), O("list did not change, scroll successful", {}, Xt.DEBUG));
9131
9139
  };
9132
9140
  if (b(), B === "smooth") {
9133
9141
  let Re = !1;
@@ -9140,7 +9148,7 @@ const vo = nt(
9140
9148
  y = pn(U(t, D0(150)), pe);
9141
9149
  return g = setTimeout(() => {
9142
9150
  b();
9143
- }, 1200), Oe(l, !0), O("scrolling from index to", { behavior: B, index: Z, top: J }, Xt.DEBUG), { behavior: B, top: J };
9151
+ }, 1200), Me(l, !0), O("scrolling from index to", { behavior: B, index: Z, top: J }, Xt.DEBUG), { behavior: B, top: J };
9144
9152
  }
9145
9153
  )
9146
9154
  ),
@@ -9194,18 +9202,18 @@ const wo = nt(
9194
9202
  c
9195
9203
  ), it(
9196
9204
  U(
9197
- At(t, i),
9205
+ _t(t, i),
9198
9206
  Le(a, n, e, c),
9199
9207
  Te(([[, d], f, { sizeTree: p }, h, m]) => d && (!ft(p) || Fa(h)) && !f && !m),
9200
9208
  Le(l)
9201
9209
  ),
9202
9210
  ([, d]) => {
9203
9211
  pn(o, () => {
9204
- Oe(c, !0);
9212
+ Me(c, !0);
9205
9213
  }), Ua(4, () => {
9206
9214
  pn(r, () => {
9207
- Oe(a, !0);
9208
- }), Oe(s, d);
9215
+ Me(a, !0);
9216
+ }), Me(s, d);
9209
9217
  });
9210
9218
  }
9211
9219
  ), {
@@ -9242,7 +9250,7 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9242
9250
  );
9243
9251
  he(
9244
9252
  U(
9245
- At(Se(o), Se(f)),
9253
+ _t(Se(o), Se(f)),
9246
9254
  ce(([w, b]) => w <= b),
9247
9255
  xt()
9248
9256
  ),
@@ -9250,7 +9258,7 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9250
9258
  ), he(U(a, An(50)), c);
9251
9259
  const m = en(
9252
9260
  U(
9253
- At(r, Se(s), Se(t), Se(e), Se(d)),
9261
+ _t(r, Se(s), Se(t), Se(e), Se(d)),
9254
9262
  Cn((w, [{ scrollHeight: b, scrollTop: T }, C, S, k, N]) => {
9255
9263
  const E = T + C - b > -N, I = {
9256
9264
  scrollHeight: b,
@@ -9323,7 +9331,7 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9323
9331
  ce(({ scrollTop: w }) => w),
9324
9332
  xt(),
9325
9333
  Cn(
9326
- (w, b) => Rt(h) ? { direction: w.direction, prevScrollTop: b } : { direction: b < w.prevScrollTop ? io : Vr, prevScrollTop: b },
9334
+ (w, b) => Et(h) ? { direction: w.direction, prevScrollTop: b } : { direction: b < w.prevScrollTop ? io : Vr, prevScrollTop: b },
9327
9335
  { direction: Vr, prevScrollTop: 0 }
9328
9336
  ),
9329
9337
  ce((w) => w.direction)
@@ -9373,7 +9381,7 @@ const Va = nt(
9373
9381
  ([{ deviation: e, fixedHeaderHeight: t, headerHeight: n, scrollTop: r, viewportHeight: o }]) => {
9374
9382
  const s = Ve(), i = X(0), a = X(0), l = X(0), c = Ht(
9375
9383
  U(
9376
- At(
9384
+ _t(
9377
9385
  Se(r),
9378
9386
  Se(o),
9379
9387
  Se(n),
@@ -9522,7 +9530,7 @@ const hr = nt(
9522
9530
  he(s.topItemsIndexes, x);
9523
9531
  const w = Ht(
9524
9532
  U(
9525
- At(
9533
+ _t(
9526
9534
  h,
9527
9535
  m,
9528
9536
  Se(l, oo),
@@ -9553,7 +9561,7 @@ const hr = nt(
9553
9561
  j,
9554
9562
  $
9555
9563
  ]) => {
9556
- const A = E, { offsetTree: B, sizeTree: D } = A, M = Rt(y);
9564
+ const A = E, { offsetTree: B, sizeTree: D } = A, M = Et(y);
9557
9565
  if (N === 0)
9558
9566
  return { ...Ti, totalCount: N };
9559
9567
  if (S === 0 && k === 0)
@@ -9686,7 +9694,7 @@ const hr = nt(
9686
9694
  ([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: n, headerHeight: r }, { listState: o }]) => {
9687
9695
  const s = Ve(), i = Ht(
9688
9696
  U(
9689
- At(n, e, r, t, o),
9697
+ _t(n, e, r, t, o),
9690
9698
  ce(([a, l, c, d, f]) => a + l + c + d + f.offsetBottom + f.bottom)
9691
9699
  ),
9692
9700
  0
@@ -9699,7 +9707,7 @@ const hr = nt(
9699
9707
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
9700
9708
  const n = X(!1), r = Ht(
9701
9709
  U(
9702
- At(n, e, t),
9710
+ _t(n, e, t),
9703
9711
  Te(([o]) => o),
9704
9712
  ce(([, o, s]) => Math.max(0, o - s)),
9705
9713
  An(0),
@@ -9745,7 +9753,7 @@ const hr = nt(
9745
9753
  Te(($) => !$),
9746
9754
  // skips the initial publish of false, and the cleanup call.
9747
9755
  // but if scrollingInProgress is true, we skip the initial publish.
9748
- ar(Rt(i) ? 1 : 2)
9756
+ ar(Et(i) ? 1 : 2)
9749
9757
  ),
9750
9758
  k
9751
9759
  ) : k && k(), j;
@@ -9778,7 +9786,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = nt(
9778
9786
  const m = X(!1), x = Ve();
9779
9787
  let y = null;
9780
9788
  function g(C) {
9781
- Oe(i, {
9789
+ Me(i, {
9782
9790
  align: "end",
9783
9791
  behavior: C,
9784
9792
  index: "LAST"
@@ -9786,7 +9794,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = nt(
9786
9794
  }
9787
9795
  it(
9788
9796
  U(
9789
- At(U(Se(t), ar(1)), l),
9797
+ _t(U(Se(t), ar(1)), l),
9790
9798
  Le(Se(m), s, a, f),
9791
9799
  ce(([[C, S], k, N, E, I]) => {
9792
9800
  let O = S && E, L = "auto";
@@ -9795,22 +9803,22 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = nt(
9795
9803
  Te(({ shouldFollow: C }) => C)
9796
9804
  ),
9797
9805
  ({ followOutputBehavior: C, totalCount: S }) => {
9798
- y && (y(), y = null), Rt(n) ? requestAnimationFrame(() => {
9799
- Rt(d)("following output to ", { totalCount: S }, Xt.DEBUG), g(C);
9806
+ y && (y(), y = null), Et(n) ? requestAnimationFrame(() => {
9807
+ Et(d)("following output to ", { totalCount: S }, Xt.DEBUG), g(C);
9800
9808
  }) : y = pn(e, () => {
9801
- Rt(d)("following output to ", { totalCount: S }, Xt.DEBUG), g(C), y = null;
9809
+ Et(d)("following output to ", { totalCount: S }, Xt.DEBUG), g(C), y = null;
9802
9810
  });
9803
9811
  }
9804
9812
  );
9805
9813
  function w(C) {
9806
9814
  const S = pn(o, (k) => {
9807
- C && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !y && (Rt(d)("scrolling to bottom due to increased size", {}, Xt.DEBUG), g("auto"));
9815
+ C && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !y && (Et(d)("scrolling to bottom due to increased size", {}, Xt.DEBUG), g("auto"));
9808
9816
  });
9809
9817
  setTimeout(S, 100);
9810
9818
  }
9811
9819
  it(
9812
9820
  U(
9813
- At(Se(m), t, c),
9821
+ _t(Se(m), t, c),
9814
9822
  Te(([C, , S]) => C && S),
9815
9823
  Cn(
9816
9824
  ({ value: C }, [, S]) => ({ refreshed: C === S, value: S }),
@@ -9820,11 +9828,11 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = nt(
9820
9828
  Le(m, t)
9821
9829
  ),
9822
9830
  ([, C]) => {
9823
- Rt(a) && w(C !== !1);
9831
+ Et(a) && w(C !== !1);
9824
9832
  }
9825
9833
  ), it(x, () => {
9826
- w(Rt(m) !== !1);
9827
- }), it(At(Se(m), o), ([C, S]) => {
9834
+ w(Et(m) !== !1);
9835
+ }), it(_t(Se(m), o), ([C, S]) => {
9828
9836
  C && !S.atBottom && S.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && g("auto");
9829
9837
  });
9830
9838
  const b = X(null), T = Ve();
@@ -9842,17 +9850,17 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = nt(
9842
9850
  T
9843
9851
  ), it(
9844
9852
  U(
9845
- At(U(T, ar(1)), l),
9853
+ _t(U(T, ar(1)), l),
9846
9854
  Le(Se(b), a, f, p),
9847
9855
  ce(([[C, S], k, N, E, I]) => S && N && (k == null ? void 0 : k({ context: I, totalCount: C, scrollingInProgress: E }))),
9848
9856
  Te((C) => !!C),
9849
9857
  An(0)
9850
9858
  ),
9851
9859
  (C) => {
9852
- y && (y(), y = null), Rt(n) ? requestAnimationFrame(() => {
9853
- Rt(d)("scrolling into view", {}), Oe(h, C);
9860
+ y && (y(), y = null), Et(n) ? requestAnimationFrame(() => {
9861
+ Et(d)("scrolling into view", {}), Me(h, C);
9854
9862
  }) : y = pn(e, () => {
9855
- Rt(d)("scrolling into view", {}), Oe(h, C), y = null;
9863
+ Et(d)("scrolling into view", {}), Me(h, C), y = null;
9856
9864
  });
9857
9865
  }
9858
9866
  ), { autoscrollToBottom: x, followOutput: m, scrollIntoViewOnChange: b };
@@ -9900,7 +9908,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = nt(
9900
9908
  ),
9901
9909
  () => {
9902
9910
  requestAnimationFrame(() => {
9903
- Oe(t, o);
9911
+ Me(t, o);
9904
9912
  });
9905
9913
  }
9906
9914
  );
@@ -9932,7 +9940,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = nt(
9932
9940
  ),
9933
9941
  t
9934
9942
  ), it(
9935
- U(At(t, e, n), Le(r)),
9943
+ U(_t(t, e, n), Le(r)),
9936
9944
  ([[o, s, i], a]) => {
9937
9945
  o && a && a.change && a.change(s, i);
9938
9946
  }
@@ -9944,7 +9952,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = nt(
9944
9952
  const n = Ve(), r = Ve(), o = Ve(), s = X(!1), i = X(void 0);
9945
9953
  return he(
9946
9954
  U(
9947
- At(n, r),
9955
+ _t(n, r),
9948
9956
  ce(([{ scrollHeight: a, scrollTop: l, viewportHeight: c }, { offsetTop: d }]) => ({
9949
9957
  scrollHeight: a,
9950
9958
  scrollTop: Math.max(0, l - d),
@@ -10052,13 +10060,13 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10052
10060
  )
10053
10061
  );
10054
10062
  function y(g) {
10055
- g > 0 ? (Oe(t, { behavior: "auto", top: -g }), Oe(e, 0)) : (Oe(e, 0), Oe(t, { behavior: "auto", top: -g }));
10063
+ g > 0 ? (Me(t, { behavior: "auto", top: -g }), Me(e, 0)) : (Me(e, 0), Me(t, { behavior: "auto", top: -g }));
10056
10064
  }
10057
10065
  return it(U(x, Le(e, s)), ([g, w, b]) => {
10058
- b && X0() ? Oe(e, w - g) : y(-g);
10066
+ b && X0() ? Me(e, w - g) : y(-g);
10059
10067
  }), it(
10060
10068
  U(
10061
- At(Ht(s, !1), e, m),
10069
+ _t(Ht(s, !1), e, m),
10062
10070
  Te(([g, w, b]) => !g && !b && w !== 0),
10063
10071
  ce(([g, w]) => w),
10064
10072
  An(1)
@@ -10094,9 +10102,9 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10094
10102
  })
10095
10103
  ),
10096
10104
  (g) => {
10097
- Oe(e, g), requestAnimationFrame(() => {
10098
- Oe(t, { top: g }), requestAnimationFrame(() => {
10099
- Oe(e, 0), Oe(m, !1);
10105
+ Me(e, g), requestAnimationFrame(() => {
10106
+ Me(t, { top: g }), requestAnimationFrame(() => {
10107
+ Me(e, 0), Me(m, !1);
10100
10108
  });
10101
10109
  });
10102
10110
  }
@@ -10233,22 +10241,22 @@ const _o = typeof document < "u" ? z.useLayoutEffect : z.useEffect;
10233
10241
  function Hf(e, t, n) {
10234
10242
  const r = Object.keys(t.required || {}), o = Object.keys(t.optional || {}), s = Object.keys(t.methods || {}), i = Object.keys(t.events || {}), a = z.createContext({});
10235
10243
  function l(y, g) {
10236
- y.propsReady && Oe(y.propsReady, !1);
10244
+ y.propsReady && Me(y.propsReady, !1);
10237
10245
  for (const w of r) {
10238
10246
  const b = y[t.required[w]];
10239
- Oe(b, g[w]);
10247
+ Me(b, g[w]);
10240
10248
  }
10241
10249
  for (const w of o)
10242
10250
  if (w in g) {
10243
10251
  const b = y[t.optional[w]];
10244
- Oe(b, g[w]);
10252
+ Me(b, g[w]);
10245
10253
  }
10246
- y.propsReady && Oe(y.propsReady, !0);
10254
+ y.propsReady && Me(y.propsReady, !0);
10247
10255
  }
10248
10256
  function c(y) {
10249
10257
  return s.reduce((g, w) => (g[w] = (b) => {
10250
10258
  const T = y[t.methods[w]];
10251
- Oe(T, b);
10259
+ Me(T, b);
10252
10260
  }, g), {});
10253
10261
  }
10254
10262
  function d(y) {
@@ -10273,7 +10281,7 @@ function Hf(e, t, n) {
10273
10281
  const g = z.useContext(a);
10274
10282
  return z.useCallback(
10275
10283
  (w) => {
10276
- Oe(g[y], w);
10284
+ Me(g[y], w);
10277
10285
  },
10278
10286
  [g, y]
10279
10287
  );
@@ -10284,11 +10292,11 @@ function Hf(e, t, n) {
10284
10292
  );
10285
10293
  return z.useSyncExternalStore(
10286
10294
  w,
10287
- () => Rt(g),
10288
- () => Rt(g)
10295
+ () => Et(g),
10296
+ () => Et(g)
10289
10297
  );
10290
10298
  }, m = (y) => {
10291
- const g = z.useContext(a)[y], [w, b] = z.useState(hc(Rt, g));
10299
+ const g = z.useContext(a)[y], [w, b] = z.useState(hc(Et, g));
10292
10300
  return _o(
10293
10301
  () => it(g, (T) => {
10294
10302
  T !== w && b(pc(T));
@@ -10768,18 +10776,18 @@ const TS = /* @__PURE__ */ nt(
10768
10776
  Te(([P, H]) => !!H)
10769
10777
  ),
10770
10778
  () => {
10771
- Oe(Z, !1);
10779
+ Me(Z, !1);
10772
10780
  }
10773
10781
  ), it(
10774
10782
  U(
10775
- At(m, Z, I, E, M, J),
10783
+ _t(m, Z, I, E, M, J),
10776
10784
  Te(([P, H, te, se, , re]) => P && !H && te.height !== 0 && se.height !== 0 && !re)
10777
10785
  ),
10778
10786
  ([, , , , P]) => {
10779
- Oe(J, !0), Ua(1, () => {
10780
- Oe(O, P);
10787
+ Me(J, !0), Ua(1, () => {
10788
+ Me(O, P);
10781
10789
  }), pn(U(c), () => {
10782
- Oe(t, [0, 0]), Oe(Z, !0);
10790
+ Me(t, [0, 0]), Me(Z, !0);
10783
10791
  });
10784
10792
  }
10785
10793
  ), he(
@@ -10796,9 +10804,9 @@ const TS = /* @__PURE__ */ nt(
10796
10804
  Te(([, P]) => P != null)
10797
10805
  ),
10798
10806
  ([, P]) => {
10799
- P && (Oe(E, P.viewport), Oe(I, P.item), Oe($, P.gap), P.scrollTop > 0 && (Oe(D, !0), pn(U(c, ar(1)), (H) => {
10800
- Oe(D, !1);
10801
- }), Oe(l, { top: P.scrollTop })));
10807
+ P && (Me(E, P.viewport), Me(I, P.item), Me($, P.gap), P.scrollTop > 0 && (Me(D, !0), pn(U(c, ar(1)), (H) => {
10808
+ Me(D, !1);
10809
+ }), Me(l, { top: P.scrollTop })));
10802
10810
  }
10803
10811
  ), he(
10804
10812
  U(
@@ -10808,7 +10816,7 @@ const TS = /* @__PURE__ */ nt(
10808
10816
  f
10809
10817
  ), he(
10810
10818
  U(
10811
- At(
10819
+ _t(
10812
10820
  Se(E, Po),
10813
10821
  Se(I, Po),
10814
10822
  Se($, (P, H) => P && P.column === H.column && P.row === H.row),
@@ -10824,7 +10832,7 @@ const TS = /* @__PURE__ */ nt(
10824
10832
  A
10825
10833
  ), he(
10826
10834
  U(
10827
- At(
10835
+ _t(
10828
10836
  Se(S),
10829
10837
  r,
10830
10838
  Se($, CS),
@@ -10843,25 +10851,25 @@ const TS = /* @__PURE__ */ nt(
10843
10851
  [H, te],
10844
10852
  se,
10845
10853
  re,
10846
- Me,
10854
+ De,
10847
10855
  Y,
10848
10856
  de,
10849
10857
  ,
10850
10858
  ke,
10851
10859
  Ne
10852
10860
  ]) => {
10853
- const { column: ze, row: Be } = se, { height: Ue, width: qe } = re, { width: Ge } = Me;
10861
+ const { column: ze, row: Be } = se, { height: We, width: qe } = re, { width: Ge } = De;
10854
10862
  if (de === 0 && (P === 0 || Ge === 0))
10855
10863
  return Rc;
10856
10864
  if (qe === 0) {
10857
- const ne = Wa(Ne, P), De = ne + Math.max(de - 1, 0);
10858
- return SS(Nc(ne, De, Y));
10865
+ const ne = Wa(Ne, P), Ae = ne + Math.max(de - 1, 0);
10866
+ return SS(Nc(ne, Ae, Y));
10859
10867
  }
10860
10868
  const et = Xf(Ge, qe, ze);
10861
10869
  let Je, ot;
10862
- ke ? H === 0 && te === 0 && de > 0 ? (Je = 0, ot = de - 1) : (Je = et * as((H + Be) / (Ue + Be)), ot = et * Ec((te + Be) / (Ue + Be)) - 1, ot = Ei(P - 1, Kr(ot, et - 1)), Je = Ei(ot, Kr(0, Je))) : (Je = 0, ot = -1);
10863
- const St = Nc(Je, ot, Y), { bottom: mt, top: ct } = Ac(Me, se, re, St), Ct = Ec(P / et), le = Ct * Ue + (Ct - 1) * Be - mt;
10864
- return { bottom: mt, itemHeight: Ue, items: St, itemWidth: qe, offsetBottom: le, offsetTop: ct, top: ct };
10870
+ ke ? H === 0 && te === 0 && de > 0 ? (Je = 0, ot = de - 1) : (Je = et * as((H + Be) / (We + Be)), ot = et * Ec((te + Be) / (We + Be)) - 1, ot = Ei(P - 1, Kr(ot, et - 1)), Je = Ei(ot, Kr(0, Je))) : (Je = 0, ot = -1);
10871
+ const St = Nc(Je, ot, Y), { bottom: mt, top: ct } = Ac(De, se, re, St), Ct = Ec(P / et), le = Ct * We + (Ct - 1) * Be - mt;
10872
+ return { bottom: mt, itemHeight: We, items: St, itemWidth: qe, offsetBottom: le, offsetTop: ct, top: ct };
10865
10873
  }
10866
10874
  )
10867
10875
  ),
@@ -10875,11 +10883,11 @@ const TS = /* @__PURE__ */ nt(
10875
10883
  S
10876
10884
  ), he(
10877
10885
  U(
10878
- At(E, I, N, $),
10886
+ _t(E, I, N, $),
10879
10887
  Te(([P, H, { items: te }]) => te.length > 0 && H.height !== 0 && P.height !== 0),
10880
10888
  ce(([P, H, { items: te }, se]) => {
10881
- const { bottom: re, top: Me } = Ac(P, se, H, te);
10882
- return [Me, re];
10889
+ const { bottom: re, top: De } = Ac(P, se, H, te);
10890
+ return [De, re];
10883
10891
  }),
10884
10892
  xt(oo)
10885
10893
  ),
@@ -10896,7 +10904,7 @@ const TS = /* @__PURE__ */ nt(
10896
10904
  );
10897
10905
  const Ee = en(
10898
10906
  U(
10899
- At(N, S),
10907
+ _t(N, S),
10900
10908
  Te(([{ items: P }]) => P.length > 0),
10901
10909
  Le(Re),
10902
10910
  Te(([[P, H], te]) => {
@@ -10931,8 +10939,8 @@ const TS = /* @__PURE__ */ nt(
10931
10939
  O,
10932
10940
  Le(E, I, S, $),
10933
10941
  ce(([P, H, te, se, re]) => {
10934
- const Me = Pf(P), { align: Y, behavior: de, offset: ke } = Me;
10935
- let Ne = Me.index;
10942
+ const De = Pf(P), { align: Y, behavior: de, offset: ke } = De;
10943
+ let Ne = De.index;
10936
10944
  Ne === "LAST" && (Ne = se - 1), Ne = Kr(0, Ne, Ei(se - 1, Ne));
10937
10945
  let ze = ea(H, re, te, Ne);
10938
10946
  return Y === "end" ? ze = Ic(ze - H.height + te.height) : Y === "center" && (ze = Ic(ze - H.height / 2 + te.height / 2)), ke && (ze += ke), { behavior: de, top: ze };
@@ -11511,7 +11519,7 @@ var sp = "DialogTrigger", ip = v.forwardRef(
11511
11519
  (e, t) => {
11512
11520
  const { __scopeDialog: n, ...r } = e, o = yn(sp, n), s = Ke(t, o.triggerRef);
11513
11521
  return /* @__PURE__ */ u.jsx(
11514
- Ae.button,
11522
+ je.button,
11515
11523
  {
11516
11524
  type: "button",
11517
11525
  "aria-haspopup": "dialog",
@@ -11547,7 +11555,7 @@ var qS = Tr("DialogOverlay.RemoveScroll"), GS = v.forwardRef(
11547
11555
  // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
11548
11556
  // ie. when `Overlay` and `Content` are siblings
11549
11557
  /* @__PURE__ */ u.jsx(Ds, { as: qS, allowPinchZoom: !0, shards: [o.contentRef], children: /* @__PURE__ */ u.jsx(
11550
- Ae.div,
11558
+ je.div,
11551
11559
  {
11552
11560
  "data-state": el(o.open),
11553
11561
  ...r,
@@ -11651,14 +11659,14 @@ var YS = v.forwardRef(
11651
11659
  ), Qa = "DialogTitle", fp = v.forwardRef(
11652
11660
  (e, t) => {
11653
11661
  const { __scopeDialog: n, ...r } = e, o = yn(Qa, n);
11654
- return /* @__PURE__ */ u.jsx(Ae.h2, { id: o.titleId, ...r, ref: t });
11662
+ return /* @__PURE__ */ u.jsx(je.h2, { id: o.titleId, ...r, ref: t });
11655
11663
  }
11656
11664
  );
11657
11665
  fp.displayName = Qa;
11658
11666
  var pp = "DialogDescription", hp = v.forwardRef(
11659
11667
  (e, t) => {
11660
11668
  const { __scopeDialog: n, ...r } = e, o = yn(pp, n);
11661
- return /* @__PURE__ */ u.jsx(Ae.p, { id: o.descriptionId, ...r, ref: t });
11669
+ return /* @__PURE__ */ u.jsx(je.p, { id: o.descriptionId, ...r, ref: t });
11662
11670
  }
11663
11671
  );
11664
11672
  hp.displayName = pp;
@@ -11666,7 +11674,7 @@ var mp = "DialogClose", gp = v.forwardRef(
11666
11674
  (e, t) => {
11667
11675
  const { __scopeDialog: n, ...r } = e, o = yn(mp, n);
11668
11676
  return /* @__PURE__ */ u.jsx(
11669
- Ae.button,
11677
+ je.button,
11670
11678
  {
11671
11679
  type: "button",
11672
11680
  ...r,
@@ -11802,7 +11810,7 @@ function oC({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
11802
11810
  }
11803
11811
  }
11804
11812
  }, [n]);
11805
- Et(() => {
11813
+ It(() => {
11806
11814
  e && n && p();
11807
11815
  }, [e, n, p]);
11808
11816
  const h = async () => {
@@ -13564,7 +13572,7 @@ function zc(e) {
13564
13572
  }
13565
13573
  function RC({ className: e }) {
13566
13574
  const [t, n] = ge(0);
13567
- return Et(() => {
13575
+ return It(() => {
13568
13576
  const r = setInterval(() => n((o) => (o + 1) % 4), 500);
13569
13577
  return () => clearInterval(r);
13570
13578
  }, []), /* @__PURE__ */ u.jsxs(
@@ -13628,7 +13636,7 @@ const Bc = z.memo(function({
13628
13636
  }, [M]), te = lt(() => J ? "" : CC(t.content), [J, t]), se = lt(() => J ? {} : Pp(t), [J, t]), re = lt(
13629
13637
  () => J ? [] : t.content.filter((V) => V.type === "image_url"),
13630
13638
  [J, t]
13631
- ), Me = lt(
13639
+ ), De = lt(
13632
13640
  () => J ? [] : t.content.filter((V) => V.type === "file"),
13633
13641
  [J, t]
13634
13642
  ), Y = lt(
@@ -13657,7 +13665,7 @@ const Bc = z.memo(function({
13657
13665
  } catch (xe) {
13658
13666
  console.error("Failed to copy:", xe);
13659
13667
  }
13660
- }, [Z, ze, te, y]), Ue = z.useCallback(() => {
13668
+ }, [Z, ze, te, y]), We = z.useCallback(() => {
13661
13669
  if (!h) return;
13662
13670
  const V = Z ? ze : te, ve = "type" in t && t.type === "default_message" ? void 0 : {
13663
13671
  checkpointId: t.checkpointId ?? null,
@@ -13828,16 +13836,16 @@ const Bc = z.memo(function({
13828
13836
  if (V.type === "interrupt") {
13829
13837
  const xe = V, ht = Mo(
13830
13838
  (xe == null ? void 0 : xe.id) ?? (xe == null ? void 0 : xe.interrupt_id)
13831
- ), gt = !!(ke && ht && ht === ke), Tt = gt ? Ne ?? (xe == null ? void 0 : xe.value) : xe == null ? void 0 : xe.value, je = ht ? { ...xe, id: ht, interrupt_id: ht } : xe;
13839
+ ), gt = !!(ke && ht && ht === ke), kt = gt ? Ne ?? (xe == null ? void 0 : xe.value) : xe == null ? void 0 : xe.value, _e = ht ? { ...xe, id: ht, interrupt_id: ht } : xe;
13832
13840
  return /* @__PURE__ */ u.jsx(
13833
13841
  EC,
13834
13842
  {
13835
- interruptPart: je,
13843
+ interruptPart: _e,
13836
13844
  onApprove: ot,
13837
13845
  onReject: St,
13838
13846
  disabled: w,
13839
13847
  isActive: gt,
13840
- payload: Tt
13848
+ payload: kt
13841
13849
  },
13842
13850
  ve
13843
13851
  );
@@ -13862,8 +13870,8 @@ const Bc = z.memo(function({
13862
13870
  /* @__PURE__ */ u.jsx(ji, { className: "h-4 w-4 text-muted-foreground" }),
13863
13871
  /* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
13864
13872
  ] }), []), Ct = z.useCallback(() => {
13865
- const V = te.trim().length > 0 || re.length > 0 || Me.length > 0 || Y.length > 0;
13866
- if (!Z && Me.length > 0 && !r)
13873
+ const V = te.trim().length > 0 || re.length > 0 || De.length > 0 || Y.length > 0;
13874
+ if (!Z && De.length > 0 && !r)
13867
13875
  return ct();
13868
13876
  if (!Z && !V && !r)
13869
13877
  return null;
@@ -13886,24 +13894,24 @@ const Bc = z.memo(function({
13886
13894
  }, [
13887
13895
  te,
13888
13896
  re.length,
13889
- Me.length,
13897
+ De.length,
13890
13898
  Y.length,
13891
13899
  r,
13892
13900
  Z,
13893
13901
  L,
13894
13902
  ct,
13895
13903
  H
13896
- ]), le = lt(() => J ? "Assistant" : kC(t), [J, t]), ne = z.useMemo(() => J ? [] : Array.isArray(C) ? C : [], [C, J]), De = z.useMemo(() => {
13904
+ ]), le = lt(() => J ? "Assistant" : kC(t), [J, t]), ne = z.useMemo(() => J ? [] : Array.isArray(C) ? C : [], [C, J]), Ae = z.useMemo(() => {
13897
13905
  var V;
13898
13906
  return ne.length ? N && ne.some((ve) => ve.id === N) ? N : ((V = ne[0]) == null ? void 0 : V.id) ?? null : null;
13899
- }, [N, ne]), Pe = z.useMemo(() => !ne.length || !S ? null : ne.some((V) => V.id === S) ? S : null, [S, ne]) ?? De, tt = M === "user" && ne.length > 0 && typeof k == "function", Ze = z.useCallback(
13907
+ }, [N, ne]), Oe = z.useMemo(() => !ne.length || !S ? null : ne.some((V) => V.id === S) ? S : null, [S, ne]) ?? Ae, tt = M === "user" && ne.length > 0 && typeof k == "function", Ze = z.useCallback(
13900
13908
  (V) => {
13901
13909
  if (!k) return;
13902
13910
  const ve = (V == null ? void 0 : V.id) ?? null, xe = (V == null ? void 0 : V.parentId) ?? E ?? null;
13903
13911
  k(ve, xe);
13904
13912
  },
13905
13913
  [E, k]
13906
- ), Fe = z.useMemo(() => Pe ? ne.findIndex((V) => V.id === Pe) : -1, [Pe, ne]), Pt = z.useMemo(() => Fe < 0 ? null : ne[Fe] ?? null, [Fe, ne]), jt = z.useCallback((V) => {
13914
+ ), Fe = z.useMemo(() => Oe ? ne.findIndex((V) => V.id === Oe) : -1, [Oe, ne]), At = z.useMemo(() => Fe < 0 ? null : ne[Fe] ?? null, [Fe, ne]), Tt = z.useCallback((V) => {
13907
13915
  const ve = [];
13908
13916
  if (V.step !== null && ve.push(`Step ${V.step}`), V.source && ve.push(V.source), !V.createdAt)
13909
13917
  return ve.length ? ve.join(" • ") : V.id.slice(0, 8);
@@ -13960,7 +13968,7 @@ const Bc = z.memo(function({
13960
13968
  )
13961
13969
  ] }),
13962
13970
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
13963
- tt && Pt && Fe >= 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
13971
+ tt && At && Fe >= 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
13964
13972
  /* @__PURE__ */ u.jsx(
13965
13973
  "button",
13966
13974
  {
@@ -13985,7 +13993,7 @@ const Bc = z.memo(function({
13985
13993
  " / ",
13986
13994
  ne.length
13987
13995
  ] }),
13988
- /* @__PURE__ */ u.jsx("span", { className: "text-muted-foreground", children: jt(Pt) })
13996
+ /* @__PURE__ */ u.jsx("span", { className: "text-muted-foreground", children: Tt(At) })
13989
13997
  ] }),
13990
13998
  /* @__PURE__ */ u.jsx(
13991
13999
  "button",
@@ -14041,7 +14049,7 @@ const Bc = z.memo(function({
14041
14049
  {
14042
14050
  variant: "ghost",
14043
14051
  size: "sm",
14044
- onClick: Ue,
14052
+ onClick: We,
14045
14053
  className: Q("h-6 w-6 p-0 hover:bg-foreground/10", H, D && "h-5 w-5"),
14046
14054
  "aria-label": "Edit message",
14047
14055
  children: /* @__PURE__ */ u.jsx(fl, { className: Q(H, D ? "h-3 w-3" : "h-4 w-4") })
@@ -14100,7 +14108,7 @@ const Bc = z.memo(function({
14100
14108
  {
14101
14109
  variant: "ghost",
14102
14110
  size: "sm",
14103
- onClick: Ue,
14111
+ onClick: We,
14104
14112
  className: Q("h-6 w-6 p-0 hover:bg-background/50 text-current", D && "h-5 w-5"),
14105
14113
  children: /* @__PURE__ */ u.jsx(fl, { className: Q("text-current", D ? "h-3 w-3" : "h-4 w-4") })
14106
14114
  }
@@ -14523,7 +14531,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14523
14531
  onCancelEdit: () => {
14524
14532
  }
14525
14533
  }
14526
- ) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: h ?? "No messages yet. Start a conversation!" }), Me = pe.length > 0;
14534
+ ) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: h ?? "No messages yet. Start a conversation!" }), De = pe.length > 0;
14527
14535
  return lm(
14528
14536
  L,
14529
14537
  () => ({
@@ -14550,7 +14558,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14550
14558
  [pe]
14551
14559
  ), /* @__PURE__ */ u.jsxs("div", { className: se, style: p, children: [
14552
14560
  te,
14553
- /* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0", children: Me ? /* @__PURE__ */ u.jsx(
14561
+ /* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0", children: De ? /* @__PURE__ */ u.jsx(
14554
14562
  vS,
14555
14563
  {
14556
14564
  ref: (Y) => {
@@ -14575,20 +14583,20 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14575
14583
  itemContent: (Y, de) => {
14576
14584
  var ot;
14577
14585
  const ke = Hc(de, Y), Ne = "type" in de && de.type === "default_message";
14578
- let ze = [], Be = null, Ue = {}, qe = {}, Ge = null, et = null;
14586
+ let ze = [], Be = null, We = {}, qe = {}, Ge = null, et = null;
14579
14587
  if (!Ne) {
14580
14588
  const St = de, mt = St.checkpointId ?? null;
14581
- Ue = St.additionalKwargs ?? {}, qe = St.responseMetadata ?? {};
14589
+ We = St.additionalKwargs ?? {}, qe = St.responseMetadata ?? {};
14582
14590
  const ct = mt && k ? k.get(mt) ?? null : null;
14583
- Ge = typeof Ue.step == "number" ? Ue.step : typeof qe.step == "number" ? qe.step : (ct == null ? void 0 : ct.step) ?? null;
14584
- const Ct = typeof Ue.source == "string" ? Ue.source : typeof qe.source == "string" ? qe.source : (ct == null ? void 0 : ct.source) ?? null;
14591
+ Ge = typeof We.step == "number" ? We.step : typeof qe.step == "number" ? qe.step : (ct == null ? void 0 : ct.step) ?? null;
14592
+ const Ct = typeof We.source == "string" ? We.source : typeof qe.source == "string" ? qe.source : (ct == null ? void 0 : ct.source) ?? null;
14585
14593
  et = Ct ? String(Ct) : null;
14586
14594
  const le = Ge !== null && et ? `${Ge}:${et}` : null;
14587
14595
  le && (N != null && N.has(le)) ? ze = N.get(le) ?? [] : mt && ct && (ze = [ct]), Be = mt ?? ((ot = ze[0]) == null ? void 0 : ot.id) ?? null;
14588
14596
  }
14589
14597
  const Je = (() => {
14590
- if (typeof Ue.parentCheckpointId == "string")
14591
- return Ue.parentCheckpointId;
14598
+ if (typeof We.parentCheckpointId == "string")
14599
+ return We.parentCheckpointId;
14592
14600
  if (typeof qe.parentCheckpointId == "string")
14593
14601
  return qe.parentCheckpointId;
14594
14602
  })();
@@ -14670,14 +14678,14 @@ function Ai({
14670
14678
  interrupt: O,
14671
14679
  metadata: L
14672
14680
  } = ya(), { isStreaming: F, error: j, connectionState: $, submit: A, stop: B } = Jx(), D = g ?? y ?? null, M = (E == null ? void 0 : E.id) ?? null, Z = (E == null ? void 0 : E.namespace) ?? null, J = (L == null ? void 0 : L.assemblingMessageId) ?? null, pe = O, [Re, Ee] = ge(!1);
14673
- Et(() => {
14681
+ It(() => {
14674
14682
  pe || Ee(!1);
14675
14683
  }, [pe]);
14676
14684
  const W = Ce(() => {
14677
14685
  Ee(!0);
14678
14686
  }, []), ee = Ce(() => {
14679
14687
  Ee(!1);
14680
- }, []), q = !!pe || Re, [P, H] = ge(null), [te, se] = ge(""), [re, Me] = ge(null), [Y, de] = ge(null), [ke, Ne] = ge([]), [ze, Be] = ge(0), [Ue, qe] = ge(0), [Ge, et] = ge(!1), [Je, ot] = ge(null), [St, mt] = ge(null), [ct, Ct] = ge(!1), [le, ne] = ge(null), [De, We] = ge(!1), Pe = Qe(!1), [tt, Ze] = ge(() => Uc.value), Fe = Qe(tt), Pt = Qe(null), jt = Ce((G) => {
14688
+ }, []), q = !!pe || Re, [P, H] = ge(null), [te, se] = ge(""), [re, De] = ge(null), [Y, de] = ge(null), [ke, Ne] = ge([]), [ze, Be] = ge(0), [We, qe] = ge(0), [Ge, et] = ge(!1), [Je, ot] = ge(null), [St, mt] = ge(null), [ct, Ct] = ge(!1), [le, ne] = ge(null), [Ae, He] = ge(!1), Oe = Qe(!1), [tt, Ze] = ge(() => Uc.value), Fe = Qe(tt), At = Qe(null), Tt = Ce((G) => {
14681
14689
  Uc.value = G, Ze(G);
14682
14690
  }, []), [V, ve] = ge(!1), xe = Qe(null), ht = Ce((G) => {
14683
14691
  if (!Array.isArray(G))
@@ -14699,14 +14707,14 @@ function Ai({
14699
14707
  return typeof ae == "number" ? ae : null;
14700
14708
  },
14701
14709
  []
14702
- ), Tt = Ce(
14710
+ ), kt = Ce(
14703
14711
  (G, oe) => {
14704
14712
  if (!G || typeof G != "object") return null;
14705
14713
  const ae = G[oe];
14706
14714
  return typeof ae == "string" && ae.trim() ? ae : null;
14707
14715
  },
14708
14716
  []
14709
- ), je = lt(() => {
14717
+ ), _e = lt(() => {
14710
14718
  const G = (be) => {
14711
14719
  if (!Array.isArray(be) || be.length === 0)
14712
14720
  return null;
@@ -14740,10 +14748,10 @@ function Ai({
14740
14748
  }), oe;
14741
14749
  }, [I, gt]), { checkpointMetaById: Vt, checkpointIndexByKey: ut } = lt(() => {
14742
14750
  const G = /* @__PURE__ */ new Map(), oe = /* @__PURE__ */ new Map();
14743
- for (const ae of je) {
14751
+ for (const ae of _e) {
14744
14752
  const be = ae.checkpointId ?? null;
14745
14753
  if (!be) continue;
14746
- const dt = gt(ae.metadata, "step"), Xe = Tt(ae.metadata, "source"), rt = {
14754
+ const dt = gt(ae.metadata, "step"), Xe = kt(ae.metadata, "source"), rt = {
14747
14755
  id: be,
14748
14756
  step: dt,
14749
14757
  source: Xe,
@@ -14762,15 +14770,15 @@ function Ai({
14762
14770
  return (dt.createdAt ?? "").localeCompare(Xe);
14763
14771
  });
14764
14772
  return { checkpointMetaById: G, checkpointIndexByKey: oe };
14765
- }, [je, gt, Tt]), kt = lt(() => {
14773
+ }, [_e, gt, kt]), Rt = lt(() => {
14766
14774
  var Xe;
14767
- if (!je.length) return [];
14768
- const G = [...je].reverse(), oe = (rt, Mt) => {
14775
+ if (!_e.length) return [];
14776
+ const G = [..._e].reverse(), oe = (rt, Mt) => {
14769
14777
  const tn = rt.checkpointId ?? null;
14770
14778
  if (!tn) return null;
14771
- const Zn = Tt(rt.metadata, "source");
14772
- Tt(rt.metadata, "next");
14773
- const { text: ll, messageId: nm } = ht(rt.messages), oi = ll && ll.replace(/\s+/g, " ").trim() || Tt(rt.metadata, "title") || Tt(rt.metadata, "label") || Mt || Zn || "Checkpoint", rm = oi.length > 60 ? `${oi.slice(0, 57)}…` : oi;
14779
+ const Zn = kt(rt.metadata, "source");
14780
+ kt(rt.metadata, "next");
14781
+ const { text: ll, messageId: nm } = ht(rt.messages), oi = ll && ll.replace(/\s+/g, " ").trim() || kt(rt.metadata, "title") || kt(rt.metadata, "label") || Mt || Zn || "Checkpoint", rm = oi.length > 60 ? `${oi.slice(0, 57)}…` : oi;
14774
14782
  return {
14775
14783
  id: tn,
14776
14784
  label: rm,
@@ -14778,11 +14786,11 @@ function Ai({
14778
14786
  createdAt: rt.createdAt ?? null,
14779
14787
  step: gt(rt.metadata, "step"),
14780
14788
  source: Zn ?? null,
14781
- next: Tt(rt.metadata, "next")
14789
+ next: kt(rt.metadata, "next")
14782
14790
  };
14783
14791
  }, ae = [], be = /* @__PURE__ */ new Set();
14784
14792
  for (const rt of G) {
14785
- const Mt = ((Xe = Tt(rt.metadata, "source")) == null ? void 0 : Xe.toLowerCase()) ?? null;
14793
+ const Mt = ((Xe = kt(rt.metadata, "source")) == null ? void 0 : Xe.toLowerCase()) ?? null;
14786
14794
  if (!(Mt === "input" || Mt === "user_input" || Mt === "user")) continue;
14787
14795
  const Zn = oe(rt, "User input");
14788
14796
  Zn && !be.has(Zn.id) && (ae.push(Zn), be.add(Zn.id));
@@ -14792,53 +14800,53 @@ function Ai({
14792
14800
  const Mt = oe(rt);
14793
14801
  Mt && !be.has(Mt.id) && (ae.push(Mt), be.add(Mt.id));
14794
14802
  }
14795
- const dt = je.find((rt) => {
14803
+ const dt = _e.find((rt) => {
14796
14804
  var tn;
14797
- return (((tn = Tt(rt.metadata, "source")) == null ? void 0 : tn.toLowerCase()) ?? null) === "loop";
14805
+ return (((tn = kt(rt.metadata, "source")) == null ? void 0 : tn.toLowerCase()) ?? null) === "loop";
14798
14806
  });
14799
14807
  if (dt) {
14800
14808
  const rt = oe(dt, "Latest loop");
14801
14809
  rt && !be.has(rt.id) && (ae.push(rt), be.add(rt.id));
14802
14810
  }
14803
14811
  return ae;
14804
- }, [je, ht, gt, Tt]), Dn = Qe(null), Jn = Qe(null), Ln = Ce(() => {
14812
+ }, [_e, ht, gt, kt]), Dn = Qe(null), Jn = Qe(null), Ln = Ce(() => {
14805
14813
  Dn.current && (Dn.current.value = ""), Jn.current && (Jn.current.value = ""), Be((G) => G + 1), qe((G) => G + 1);
14806
14814
  }, []), ti = Ce(
14807
14815
  (G) => {
14808
- jt(G);
14816
+ Tt(G);
14809
14817
  },
14810
- [jt]
14818
+ [Tt]
14811
14819
  ), So = Qe(!1);
14812
- Et(() => {
14820
+ It(() => {
14813
14821
  So.current && !F && (Ne([]), Ln()), So.current = F;
14814
14822
  }, [F, Ln]);
14815
14823
  const [ni, ri] = ge("desktop");
14816
- Et(() => {
14824
+ It(() => {
14817
14825
  const G = () => {
14818
14826
  const oe = window.innerWidth;
14819
14827
  ri(oe < 640 ? "phone" : oe < 1024 ? "tablet" : "desktop");
14820
14828
  };
14821
14829
  return G(), window.addEventListener("resize", G), () => window.removeEventListener("resize", G);
14822
- }, []), Et(() => {
14823
- We(!1), Pe.current = !1;
14824
- }, [D]), Et(() => {
14830
+ }, []), It(() => {
14831
+ He(!1), Oe.current = !1;
14832
+ }, [D]), It(() => {
14825
14833
  Fe.current = tt;
14826
- }, [tt]), Et(() => {
14834
+ }, [tt]), It(() => {
14827
14835
  if (!P) {
14828
- Pt.current = null;
14836
+ At.current = null;
14829
14837
  return;
14830
14838
  }
14831
- Pt.current === null && (Pt.current = Fe.current), jt(te ?? "");
14832
- }, [te, P, jt]);
14839
+ At.current === null && (At.current = Fe.current), Tt(te ?? "");
14840
+ }, [te, P, Tt]);
14833
14841
  const R = Ce(async () => {
14834
- if (!(!b || T || !De))
14842
+ if (!(!b || T || !Ae))
14835
14843
  try {
14836
14844
  await S();
14837
14845
  } catch (G) {
14838
14846
  console.warn("loadOlder failed", G);
14839
14847
  }
14840
- }, [b, De, T, S]);
14841
- Et(() => {
14848
+ }, [b, Ae, T, S]);
14849
+ It(() => {
14842
14850
  (async () => {
14843
14851
  if (!x.baseUrl) {
14844
14852
  ne(null);
@@ -14851,7 +14859,7 @@ function Ai({
14851
14859
  console.warn("Failed to fetch default message:", oe), ne(null);
14852
14860
  }
14853
14861
  })();
14854
- }, [x.baseUrl]), Et(() => {
14862
+ }, [x.baseUrl]), It(() => {
14855
14863
  j && !ct && (m == null || m(j));
14856
14864
  }, [j, ct, m]);
14857
14865
  const K = (G) => {
@@ -14889,7 +14897,7 @@ function Ai({
14889
14897
  checkpointId: ae,
14890
14898
  checkpointNs: be
14891
14899
  }
14892
- ), p == null || p(oe), jt(""), de(null), Ne([]), Ln(), H(null), se(""), Me(null);
14900
+ ), p == null || p(oe), Tt(""), de(null), Ne([]), Ln(), H(null), se(""), De(null);
14893
14901
  } catch (ae) {
14894
14902
  const be = (ae == null ? void 0 : ae.message) || "Failed to send message";
14895
14903
  de(be), m == null || m(be);
@@ -14897,20 +14905,20 @@ function Ai({
14897
14905
  }
14898
14906
  }, we = z.useCallback(
14899
14907
  (G, oe, ae) => {
14900
- c && (Pt.current = tt, H(G), se(oe), jt(oe), de(null), Me({
14908
+ c && (At.current = tt, H(G), se(oe), Tt(oe), de(null), De({
14901
14909
  checkpointId: (ae == null ? void 0 : ae.checkpointId) ?? null,
14902
14910
  checkpointNs: (ae == null ? void 0 : ae.checkpointNs) ?? null
14903
14911
  }));
14904
14912
  },
14905
- [tt, c, jt]
14913
+ [tt, c, Tt]
14906
14914
  ), Ye = z.useCallback(() => {
14907
- H(null), se(""), Me(null), de(null), jt(Pt.current ?? tt), Pt.current = null;
14908
- }, [tt, jt]), at = Ce(
14915
+ H(null), se(""), De(null), de(null), Tt(At.current ?? tt), At.current = null;
14916
+ }, [tt, Tt]), at = Ce(
14909
14917
  (G, oe, ae) => {
14910
14918
  we(G, oe, ae);
14911
14919
  },
14912
14920
  [we]
14913
- ), He = Ce((G) => {
14921
+ ), Ue = Ce((G) => {
14914
14922
  for (let oe = G - 1; oe >= 0; oe--)
14915
14923
  if (w[oe].role === "user") {
14916
14924
  const ae = w[oe].content || [], dt = ae.filter((Xe) => Xe.type === "text").map((Xe) => Xe.text).join("") || (() => {
@@ -14963,14 +14971,14 @@ function Ai({
14963
14971
  ve(!0);
14964
14972
  try {
14965
14973
  if (!G) {
14966
- await N(), We(!1), requestAnimationFrame(() => {
14974
+ await N(), He(!1), requestAnimationFrame(() => {
14967
14975
  var be;
14968
14976
  (be = xe.current) == null || be.scrollToLatest();
14969
14977
  });
14970
14978
  return;
14971
14979
  }
14972
- const oe = je.find((be) => be.checkpointId === G), ae = (oe == null ? void 0 : oe.checkpointNs) ?? null;
14973
- await k(G, ae), We(!0), requestAnimationFrame(() => {
14980
+ const oe = _e.find((be) => be.checkpointId === G), ae = (oe == null ? void 0 : oe.checkpointNs) ?? null;
14981
+ await k(G, ae), He(!0), requestAnimationFrame(() => {
14974
14982
  var be;
14975
14983
  (be = xe.current) == null || be.scrollToTop();
14976
14984
  });
@@ -15009,7 +15017,7 @@ function Ai({
15009
15017
  }
15010
15018
  )
15011
15019
  ] }),
15012
- y && je.length > 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex-shrink-0 flex items-center gap-2 px-4 py-2 border-b border-border bg-muted/60 text-xs dark:bg-muted/50", children: [
15020
+ y && _e.length > 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex-shrink-0 flex items-center gap-2 px-4 py-2 border-b border-border bg-muted/60 text-xs dark:bg-muted/50", children: [
15013
15021
  /* @__PURE__ */ u.jsx("span", { className: "opacity-70", children: "Checkpoint:" }),
15014
15022
  /* @__PURE__ */ u.jsxs(
15015
15023
  "select",
@@ -15022,7 +15030,7 @@ function Ai({
15022
15030
  },
15023
15031
  children: [
15024
15032
  /* @__PURE__ */ u.jsx("option", { value: "", children: "Latest" }),
15025
- je.map((G) => {
15033
+ _e.map((G) => {
15026
15034
  const oe = Vt.get(G.checkpointId ?? "") ?? null;
15027
15035
  return /* @__PURE__ */ u.jsx("option", { value: G.checkpointId ?? void 0, children: Dr(oe) }, G.checkpointId);
15028
15036
  })
@@ -15051,17 +15059,17 @@ function Ai({
15051
15059
  enableMessageEditing: c,
15052
15060
  editingMessageId: P,
15053
15061
  onStartReached: () => {
15054
- De && R();
15062
+ Ae && R();
15055
15063
  },
15056
15064
  onScrollAway: (G) => {
15057
- if (!Pe.current) {
15058
- Pe.current = !0;
15065
+ if (!Oe.current) {
15066
+ Oe.current = !0;
15059
15067
  return;
15060
15068
  }
15061
- G && We(!0);
15069
+ G && He(!0);
15062
15070
  },
15063
15071
  onEdit: at,
15064
- onRegenerate: He,
15072
+ onRegenerate: Ue,
15065
15073
  onCancelEdit: Ye,
15066
15074
  emptyMessage: le ?? void 0,
15067
15075
  isNavigatingCheckpoint: V,
@@ -15074,7 +15082,7 @@ function Ai({
15074
15082
  checkpointIndexByKey: ut,
15075
15083
  activeCheckpointId: M,
15076
15084
  onSelectCheckpoint: Kt,
15077
- timelineCheckpoints: kt
15085
+ timelineCheckpoints: Rt
15078
15086
  }
15079
15087
  ),
15080
15088
  ($ === "reconnecting" || $ === "connecting") && /* @__PURE__ */ u.jsx("div", { className: "pointer-events-none absolute top-3 right-3 z-20 rounded-full bg-muted/80 px-3 py-1 text-xs font-medium text-foreground shadow-sm backdrop-blur-sm dark:bg-muted/60", children: /* @__PURE__ */ u.jsxs("span", { className: "flex items-center gap-2", children: [
@@ -15149,7 +15157,7 @@ function Ai({
15149
15157
  onChange: bt,
15150
15158
  className: "hidden"
15151
15159
  },
15152
- Ue
15160
+ We
15153
15161
  ),
15154
15162
  Ge && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
15155
15163
  /* @__PURE__ */ u.jsx(zr, { className: "h-4 w-4 animate-spin" }),
@@ -15273,7 +15281,7 @@ var rl = "ScrollArea", [Dp, vk] = Mn(rl), [PC, un] = Dp(rl), Lp = v.forwardRef(
15273
15281
  onCornerWidthChange: w,
15274
15282
  onCornerHeightChange: T,
15275
15283
  children: /* @__PURE__ */ u.jsx(
15276
- Ae.div,
15284
+ je.div,
15277
15285
  {
15278
15286
  dir: I,
15279
15287
  ...i,
@@ -15306,7 +15314,7 @@ var Fp = "ScrollAreaViewport", $p = v.forwardRef(
15306
15314
  }
15307
15315
  ),
15308
15316
  /* @__PURE__ */ u.jsx(
15309
- Ae.div,
15317
+ je.div,
15310
15318
  {
15311
15319
  "data-radix-scroll-area-viewport": "",
15312
15320
  ...s,
@@ -15595,7 +15603,7 @@ var OC = v.forwardRef((e, t) => {
15595
15603
  onThumbPositionChange: S,
15596
15604
  onThumbPointerDown: Dt(a),
15597
15605
  children: /* @__PURE__ */ u.jsx(
15598
- Ae.div,
15606
+ je.div,
15599
15607
  {
15600
15608
  ...p,
15601
15609
  ref: y,
@@ -15637,7 +15645,7 @@ var OC = v.forwardRef((e, t) => {
15637
15645
  return a(), f.addEventListener("scroll", p), () => f.removeEventListener("scroll", p);
15638
15646
  }
15639
15647
  }, [s.viewport, d, a]), /* @__PURE__ */ u.jsx(
15640
- Ae.div,
15648
+ je.div,
15641
15649
  {
15642
15650
  "data-state": i.hasThumb ? "visible" : "hidden",
15643
15651
  ...o,
@@ -15675,7 +15683,7 @@ var zC = v.forwardRef((e, t) => {
15675
15683
  const d = ((f = o.scrollbarY) == null ? void 0 : f.offsetWidth) || 0;
15676
15684
  o.onCornerWidthChange(d), i(d);
15677
15685
  }), c ? /* @__PURE__ */ u.jsx(
15678
- Ae.div,
15686
+ je.div,
15679
15687
  {
15680
15688
  ...r,
15681
15689
  ref: t,
@@ -15800,14 +15808,14 @@ function Kc({
15800
15808
  isLoading: m,
15801
15809
  actions: x
15802
15810
  } = xa(), { loadThread: y } = ya(), { createThread: g, deleteThread: w, renameThread: b } = x, [T, C] = ge(Array.isArray(f) ? f : []), S = Qe(T.length > 0), k = Qe(null), N = Qe(0), [E, I] = ge(null), [O, L] = ge(""), [F, j] = ge(!1);
15803
- Et(() => {
15811
+ It(() => {
15804
15812
  const W = Array.isArray(f) ? f : [];
15805
15813
  if (W.length > 0) {
15806
15814
  S.current = !0, C(W);
15807
15815
  return;
15808
15816
  }
15809
15817
  m || (S.current = !1, C(W));
15810
- }, [f, m]), Et(() => {
15818
+ }, [f, m]), It(() => {
15811
15819
  if (!k.current) return;
15812
15820
  const W = k.current.querySelector(
15813
15821
  "[data-radix-scroll-area-viewport]"
@@ -16045,7 +16053,7 @@ function bk(e) {
16045
16053
  }), YC(e);
16046
16054
  }
16047
16055
  var XC = "Label", th = v.forwardRef((e, t) => /* @__PURE__ */ u.jsx(
16048
- Ae.label,
16056
+ je.label,
16049
16057
  {
16050
16058
  ...e,
16051
16059
  ref: t,
@@ -16093,7 +16101,7 @@ var Js = "Switch", [ZC, Sk] = Mn(Js), [QC, eT] = ZC(Js), oh = v.forwardRef(
16093
16101
  });
16094
16102
  return /* @__PURE__ */ u.jsxs(QC, { scope: n, checked: g, disabled: a, children: [
16095
16103
  /* @__PURE__ */ u.jsx(
16096
- Ae.button,
16104
+ je.button,
16097
16105
  {
16098
16106
  type: "button",
16099
16107
  role: "switch",
@@ -16132,7 +16140,7 @@ var sh = "SwitchThumb", ih = v.forwardRef(
16132
16140
  (e, t) => {
16133
16141
  const { __scopeSwitch: n, ...r } = e, o = eT(sh, n);
16134
16142
  return /* @__PURE__ */ u.jsx(
16135
- Ae.span,
16143
+ je.span,
16136
16144
  {
16137
16145
  "data-state": lh(o.checked),
16138
16146
  "data-disabled": o.disabled ? "" : void 0,
@@ -16223,7 +16231,7 @@ var uh = Object.freeze({
16223
16231
  wordWrap: "normal"
16224
16232
  }), rT = "VisuallyHidden", oT = v.forwardRef(
16225
16233
  (e, t) => /* @__PURE__ */ u.jsx(
16226
- Ae.span,
16234
+ je.span,
16227
16235
  {
16228
16236
  ...e,
16229
16237
  ref: t,
@@ -16334,7 +16342,7 @@ var fh = "SelectTrigger", ph = v.forwardRef(
16334
16342
  });
16335
16343
  };
16336
16344
  return /* @__PURE__ */ u.jsx(ad, { asChild: !0, ...s, children: /* @__PURE__ */ u.jsx(
16337
- Ae.button,
16345
+ je.button,
16338
16346
  {
16339
16347
  type: "button",
16340
16348
  role: "combobox",
@@ -16372,7 +16380,7 @@ var hh = "SelectValue", mh = v.forwardRef(
16372
16380
  return Lt(() => {
16373
16381
  c(d);
16374
16382
  }, [c, d]), /* @__PURE__ */ u.jsx(
16375
- Ae.span,
16383
+ je.span,
16376
16384
  {
16377
16385
  ...a,
16378
16386
  ref: f,
@@ -16386,7 +16394,7 @@ mh.displayName = hh;
16386
16394
  var dT = "SelectIcon", gh = v.forwardRef(
16387
16395
  (e, t) => {
16388
16396
  const { __scopeSelect: n, children: r, ...o } = e;
16389
- return /* @__PURE__ */ u.jsx(Ae.span, { "aria-hidden": !0, ...o, ref: t, children: r || "▼" });
16397
+ return /* @__PURE__ */ u.jsx(je.span, { "aria-hidden": !0, ...o, ref: t, children: r || "▼" });
16390
16398
  }
16391
16399
  );
16392
16400
  gh.displayName = dT;
@@ -16584,7 +16592,7 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
16584
16592
  if (s.trigger && s.valueNode && a && c && x && y && g) {
16585
16593
  const k = s.trigger.getBoundingClientRect(), N = c.getBoundingClientRect(), E = s.valueNode.getBoundingClientRect(), I = g.getBoundingClientRect();
16586
16594
  if (s.dir !== "rtl") {
16587
- const se = I.left - N.left, re = E.left - se, Me = k.left - re, Y = k.width + Me, de = Math.max(Y, N.width), ke = window.innerWidth - dn, Ne = ta(re, [
16595
+ const se = I.left - N.left, re = E.left - se, De = k.left - re, Y = k.width + De, de = Math.max(Y, N.width), ke = window.innerWidth - dn, Ne = ta(re, [
16588
16596
  dn,
16589
16597
  // Prevents the content from going off the starting edge of the
16590
16598
  // viewport. It may still go off the ending edge, but this can be
@@ -16595,7 +16603,7 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
16595
16603
  ]);
16596
16604
  a.style.minWidth = Y + "px", a.style.left = Ne + "px";
16597
16605
  } else {
16598
- const se = N.right - I.right, re = window.innerWidth - E.right - se, Me = window.innerWidth - k.right - re, Y = k.width + Me, de = Math.max(Y, N.width), ke = window.innerWidth - dn, Ne = ta(re, [
16606
+ const se = N.right - I.right, re = window.innerWidth - E.right - se, De = window.innerWidth - k.right - re, Y = k.width + De, de = Math.max(Y, N.width), ke = window.innerWidth - dn, Ne = ta(re, [
16599
16607
  dn,
16600
16608
  Math.max(dn, ke - de)
16601
16609
  ]);
@@ -16605,21 +16613,21 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
16605
16613
  if (P <= Ee) {
16606
16614
  const se = O.length > 0 && y === O[O.length - 1].ref.current;
16607
16615
  a.style.bottom = "0px";
16608
- const re = c.clientHeight - x.offsetTop - x.offsetHeight, Me = Math.max(
16616
+ const re = c.clientHeight - x.offsetTop - x.offsetHeight, De = Math.max(
16609
16617
  W,
16610
16618
  ee + // viewport might have padding bottom, include it to avoid a scrollable viewport
16611
16619
  (se ? Re : 0) + re + B
16612
- ), Y = P + Me;
16620
+ ), Y = P + De;
16613
16621
  a.style.height = Y + "px";
16614
16622
  } else {
16615
16623
  const se = O.length > 0 && y === O[0].ref.current;
16616
16624
  a.style.top = "0px";
16617
- const Me = Math.max(
16625
+ const De = Math.max(
16618
16626
  Ee,
16619
16627
  $ + x.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
16620
16628
  (se ? pe : 0) + ee
16621
16629
  ) + H;
16622
- a.style.height = Me + "px", x.scrollTop = P - Ee + x.offsetTop;
16630
+ a.style.height = De + "px", x.scrollTop = P - Ee + x.offsetTop;
16623
16631
  }
16624
16632
  a.style.margin = `${dn}px 0`, a.style.minHeight = Z + "px", a.style.maxHeight = L + "px", r == null || r(), requestAnimationFrame(() => h.current = !0);
16625
16633
  }
@@ -16664,7 +16672,7 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
16664
16672
  zIndex: T
16665
16673
  },
16666
16674
  children: /* @__PURE__ */ u.jsx(
16667
- Ae.div,
16675
+ je.div,
16668
16676
  {
16669
16677
  ...o,
16670
16678
  ref: f,
@@ -16727,7 +16735,7 @@ var [xT, al] = Mr(ur, {}), ra = "SelectViewport", Sh = v.forwardRef(
16727
16735
  }
16728
16736
  ),
16729
16737
  /* @__PURE__ */ u.jsx(Zs.Slot, { scope: n, children: /* @__PURE__ */ u.jsx(
16730
- Ae.div,
16738
+ je.div,
16731
16739
  {
16732
16740
  "data-radix-select-viewport": "",
16733
16741
  role: "presentation",
@@ -16769,14 +16777,14 @@ Sh.displayName = ra;
16769
16777
  var Ch = "SelectGroup", [yT, vT] = Mr(Ch), wT = v.forwardRef(
16770
16778
  (e, t) => {
16771
16779
  const { __scopeSelect: n, ...r } = e, o = jn();
16772
- return /* @__PURE__ */ u.jsx(yT, { scope: n, id: o, children: /* @__PURE__ */ u.jsx(Ae.div, { role: "group", "aria-labelledby": o, ...r, ref: t }) });
16780
+ return /* @__PURE__ */ u.jsx(yT, { scope: n, id: o, children: /* @__PURE__ */ u.jsx(je.div, { role: "group", "aria-labelledby": o, ...r, ref: t }) });
16773
16781
  }
16774
16782
  );
16775
16783
  wT.displayName = Ch;
16776
16784
  var Th = "SelectLabel", kh = v.forwardRef(
16777
16785
  (e, t) => {
16778
16786
  const { __scopeSelect: n, ...r } = e, o = vT(Th, n);
16779
- return /* @__PURE__ */ u.jsx(Ae.div, { id: o.id, ...r, ref: t });
16787
+ return /* @__PURE__ */ u.jsx(je.div, { id: o.id, ...r, ref: t });
16780
16788
  }
16781
16789
  );
16782
16790
  kh.displayName = Th;
@@ -16820,7 +16828,7 @@ var gs = "SelectItem", [bT, Rh] = Mr(gs), Eh = v.forwardRef(
16820
16828
  disabled: o,
16821
16829
  textValue: d,
16822
16830
  children: /* @__PURE__ */ u.jsx(
16823
- Ae.div,
16831
+ je.div,
16824
16832
  {
16825
16833
  role: "option",
16826
16834
  "aria-labelledby": x,
@@ -16879,7 +16887,7 @@ var Hr = "SelectItemText", Ih = v.forwardRef(
16879
16887
  [l.disabled, l.value, h]
16880
16888
  ), { onNativeOptionAdd: x, onNativeOptionRemove: y } = c;
16881
16889
  return Lt(() => (x(m), () => y(m)), [x, y, m]), /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
16882
- /* @__PURE__ */ u.jsx(Ae.span, { id: l.textId, ...s, ref: p }),
16890
+ /* @__PURE__ */ u.jsx(je.span, { id: l.textId, ...s, ref: p }),
16883
16891
  l.isSelected && i.valueNode && !i.valueNodeHasChildren ? ws.createPortal(s.children, i.valueNode) : null
16884
16892
  ] });
16885
16893
  }
@@ -16888,7 +16896,7 @@ Ih.displayName = Hr;
16888
16896
  var Nh = "SelectItemIndicator", Ah = v.forwardRef(
16889
16897
  (e, t) => {
16890
16898
  const { __scopeSelect: n, ...r } = e;
16891
- return Rh(Nh, n).isSelected ? /* @__PURE__ */ u.jsx(Ae.span, { "aria-hidden": !0, ...r, ref: t }) : null;
16899
+ return Rh(Nh, n).isSelected ? /* @__PURE__ */ u.jsx(je.span, { "aria-hidden": !0, ...r, ref: t }) : null;
16892
16900
  }
16893
16901
  );
16894
16902
  Ah.displayName = Nh;
@@ -16949,7 +16957,7 @@ var Ph = v.forwardRef((e, t) => {
16949
16957
  const c = a().find((f) => f.ref.current === document.activeElement);
16950
16958
  (d = c == null ? void 0 : c.ref.current) == null || d.scrollIntoView({ block: "nearest" });
16951
16959
  }, [a]), /* @__PURE__ */ u.jsx(
16952
- Ae.div,
16960
+ je.div,
16953
16961
  {
16954
16962
  "aria-hidden": !0,
16955
16963
  ...o,
@@ -16970,7 +16978,7 @@ var Ph = v.forwardRef((e, t) => {
16970
16978
  }), ST = "SelectSeparator", Oh = v.forwardRef(
16971
16979
  (e, t) => {
16972
16980
  const { __scopeSelect: n, ...r } = e;
16973
- return /* @__PURE__ */ u.jsx(Ae.div, { "aria-hidden": !0, ...r, ref: t });
16981
+ return /* @__PURE__ */ u.jsx(je.div, { "aria-hidden": !0, ...r, ref: t });
16974
16982
  }
16975
16983
  );
16976
16984
  Oh.displayName = ST;
@@ -16996,7 +17004,7 @@ var TT = "SelectBubbleInput", Mh = v.forwardRef(
16996
17004
  d.call(a, t), a.dispatchEvent(f);
16997
17005
  }
16998
17006
  }, [i, t]), /* @__PURE__ */ u.jsx(
16999
- Ae.select,
17007
+ je.select,
17000
17008
  {
17001
17009
  ...n,
17002
17010
  style: { ...uh, ...n.style },
@@ -17144,7 +17152,7 @@ OT.displayName = Vh.displayName;
17144
17152
  var MT = "Separator", Yc = "horizontal", DT = ["horizontal", "vertical"], Gh = v.forwardRef((e, t) => {
17145
17153
  const { decorative: n, orientation: r = Yc, ...o } = e, s = LT(r) ? r : Yc, a = n ? { role: "none" } : { "aria-orientation": s === "vertical" ? s : void 0, role: "separator" };
17146
17154
  return /* @__PURE__ */ u.jsx(
17147
- Ae.div,
17155
+ je.div,
17148
17156
  {
17149
17157
  "data-orientation": s,
17150
17158
  ...a,
@@ -17274,10 +17282,10 @@ const HT = {
17274
17282
  };
17275
17283
  function Tk({ settings: e, onSettingsChange: t, className: n = "" }) {
17276
17284
  const [r, o] = ge(!1), [s, i] = ge(!1), [a, l] = ge(e), [c, d] = ge(!1), { toast: f } = Xa();
17277
- Et(() => {
17285
+ It(() => {
17278
17286
  const y = JSON.stringify(a) !== JSON.stringify(e);
17279
17287
  d(y);
17280
- }, [a, e]), Et(() => {
17288
+ }, [a, e]), It(() => {
17281
17289
  l(e);
17282
17290
  }, [e]);
17283
17291
  const p = () => {