teodor-new-chat-ui 3.0.137 → 3.0.138

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
@@ -1,5 +1,5 @@
1
1
  import * as f from "react";
2
- import q, { useState as de, useRef as Ue, useCallback as ze, useEffect as Ye, useReducer as $p, useMemo as ln, createContext as Sl, useContext as Cl, createElement as go, useLayoutEffect as Hp } from "react";
2
+ import q, { useState as de, useRef as Ue, useCallback as ze, useEffect as Ye, useReducer as $p, useMemo as Zt, createContext as Sl, useContext as Cl, createElement as go, useLayoutEffect as Hp } from "react";
3
3
  import { Square as zp, Send as Up, X as er, ExternalLink as Wp, Download as Vp, Image as Tl, FileText as Ya, Loader as Gp, ChevronUp as Cr, ChevronDown as Qn, Copy as qa, Edit as Xa, RotateCcw as ci, Bot as Ja, Wrench as Kp, User as Yp, Paperclip as li, ChevronRight as qp, Check as Wi, Circle as Xp, Edit3 as Rl, Loader2 as Jp, Plus as Zp, FileSpreadsheet as Qp, MessageSquarePlus as em, MessageSquare as tm, Calendar as nm, Trash2 as rm, PanelLeft as om, Settings as sm, Server as im, EyeOff as am, Eye as cm, Layout as lm, MessageCircle as um, Save as dm } from "lucide-react";
4
4
  import { Slot as ur, createSlot as sr, createSlottable as fm } from "@radix-ui/react-slot";
5
5
  import { cva as Wr } from "class-variance-authority";
@@ -54,36 +54,36 @@ function gm() {
54
54
  var g = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
55
55
  function b(T) {
56
56
  {
57
- for (var W = arguments.length, re = new Array(W > 1 ? W - 1 : 0), xe = 1; xe < W; xe++)
58
- re[xe - 1] = arguments[xe];
59
- y("error", T, re);
57
+ for (var W = arguments.length, oe = new Array(W > 1 ? W - 1 : 0), xe = 1; xe < W; xe++)
58
+ oe[xe - 1] = arguments[xe];
59
+ y("error", T, oe);
60
60
  }
61
61
  }
62
- function y(T, W, re) {
62
+ function y(T, W, oe) {
63
63
  {
64
64
  var xe = g.ReactDebugCurrentFrame, Le = xe.getStackAddendum();
65
- Le !== "" && (W += "%s", re = re.concat([Le]));
66
- var He = re.map(function(Pe) {
65
+ Le !== "" && (W += "%s", oe = oe.concat([Le]));
66
+ var He = oe.map(function(Pe) {
67
67
  return String(Pe);
68
68
  });
69
69
  He.unshift("Warning: " + W), Function.prototype.apply.call(console[T], console, He);
70
70
  }
71
71
  }
72
- var E = !1, S = !1, C = !1, R = !1, N = !1, I;
72
+ var R = !1, S = !1, C = !1, E = !1, N = !1, I;
73
73
  I = Symbol.for("react.module.reference");
74
74
  function j(T) {
75
- return !!(typeof T == "string" || typeof T == "function" || T === r || T === s || N || T === o || T === u || T === d || R || T === w || E || S || C || typeof T == "object" && T !== null && (T.$$typeof === m || T.$$typeof === h || T.$$typeof === i || T.$$typeof === a || T.$$typeof === l || // This needs to include all possible module reference object
75
+ return !!(typeof T == "string" || typeof T == "function" || T === r || T === s || N || T === o || T === u || T === d || E || T === w || R || S || C || typeof T == "object" && T !== null && (T.$$typeof === m || T.$$typeof === h || T.$$typeof === i || T.$$typeof === a || T.$$typeof === l || // This needs to include all possible module reference object
76
76
  // types supported by any Flight configuration anywhere since
77
77
  // we don't know which Flight build this will end up being used
78
78
  // with.
79
79
  T.$$typeof === I || T.getModuleId !== void 0));
80
80
  }
81
- function O(T, W, re) {
81
+ function M(T, W, oe) {
82
82
  var xe = T.displayName;
83
83
  if (xe)
84
84
  return xe;
85
85
  var Le = W.displayName || W.name || "";
86
- return Le !== "" ? re + "(" + Le + ")" : re;
86
+ return Le !== "" ? oe + "(" + Le + ")" : oe;
87
87
  }
88
88
  function U(T) {
89
89
  return T.displayName || "Context";
@@ -115,10 +115,10 @@ function gm() {
115
115
  var W = T;
116
116
  return U(W) + ".Consumer";
117
117
  case i:
118
- var re = T;
119
- return U(re._context) + ".Provider";
118
+ var oe = T;
119
+ return U(oe._context) + ".Provider";
120
120
  case l:
121
- return O(T, T.render, "ForwardRef");
121
+ return M(T, T.render, "ForwardRef");
122
122
  case h:
123
123
  var xe = T.displayName || null;
124
124
  return xe !== null ? xe : K(T.type) || "Memo";
@@ -133,14 +133,14 @@ function gm() {
133
133
  }
134
134
  return null;
135
135
  }
136
- var P = Object.assign, M = 0, L, oe, _, D, Y, V, ee;
136
+ var P = Object.assign, O = 0, D, ne, _, L, Y, V, ee;
137
137
  function B() {
138
138
  }
139
139
  B.__reactDisabledLog = !0;
140
140
  function Z() {
141
141
  {
142
- if (M === 0) {
143
- L = console.log, oe = console.info, _ = console.warn, D = console.error, Y = console.group, V = console.groupCollapsed, ee = console.groupEnd;
142
+ if (O === 0) {
143
+ D = console.log, ne = console.info, _ = console.warn, L = console.error, Y = console.group, V = console.groupCollapsed, ee = console.groupEnd;
144
144
  var T = {
145
145
  configurable: !0,
146
146
  enumerable: !0,
@@ -157,12 +157,12 @@ function gm() {
157
157
  groupEnd: T
158
158
  });
159
159
  }
160
- M++;
160
+ O++;
161
161
  }
162
162
  }
163
163
  function pe() {
164
164
  {
165
- if (M--, M === 0) {
165
+ if (O--, O === 0) {
166
166
  var T = {
167
167
  configurable: !0,
168
168
  enumerable: !0,
@@ -170,16 +170,16 @@ function gm() {
170
170
  };
171
171
  Object.defineProperties(console, {
172
172
  log: P({}, T, {
173
- value: L
173
+ value: D
174
174
  }),
175
175
  info: P({}, T, {
176
- value: oe
176
+ value: ne
177
177
  }),
178
178
  warn: P({}, T, {
179
179
  value: _
180
180
  }),
181
181
  error: P({}, T, {
182
- value: D
182
+ value: L
183
183
  }),
184
184
  group: P({}, T, {
185
185
  value: Y
@@ -192,11 +192,11 @@ function gm() {
192
192
  })
193
193
  });
194
194
  }
195
- M < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
195
+ O < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
196
196
  }
197
197
  }
198
198
  var he = g.ReactCurrentDispatcher, $;
199
- function A(T, W, re) {
199
+ function A(T, W, oe) {
200
200
  {
201
201
  if ($ === void 0)
202
202
  try {
@@ -218,9 +218,9 @@ function gm() {
218
218
  if (!T || z)
219
219
  return "";
220
220
  {
221
- var re = J.get(T);
222
- if (re !== void 0)
223
- return re;
221
+ var oe = J.get(T);
222
+ if (oe !== void 0)
223
+ return oe;
224
224
  }
225
225
  var xe;
226
226
  z = !0;
@@ -285,14 +285,14 @@ function gm() {
285
285
  var Yn = T ? T.displayName || T.name : "", In = Yn ? A(Yn) : "";
286
286
  return typeof T == "function" && J.set(T, In), In;
287
287
  }
288
- function Ae(T, W, re) {
288
+ function Ae(T, W, oe) {
289
289
  return ie(T, !1);
290
290
  }
291
291
  function _e(T) {
292
292
  var W = T.prototype;
293
293
  return !!(W && W.isReactComponent);
294
294
  }
295
- function je(T, W, re) {
295
+ function je(T, W, oe) {
296
296
  if (T == null)
297
297
  return "";
298
298
  if (typeof T == "function")
@@ -310,11 +310,11 @@ function gm() {
310
310
  case l:
311
311
  return Ae(T.render);
312
312
  case h:
313
- return je(T.type, W, re);
313
+ return je(T.type, W, oe);
314
314
  case m: {
315
315
  var xe = T, Le = xe._payload, He = xe._init;
316
316
  try {
317
- return je(He(Le), W, re);
317
+ return je(He(Le), W, oe);
318
318
  } catch {
319
319
  }
320
320
  }
@@ -324,12 +324,12 @@ function gm() {
324
324
  var ae = Object.prototype.hasOwnProperty, Ne = {}, Se = g.ReactDebugCurrentFrame;
325
325
  function fe(T) {
326
326
  if (T) {
327
- var W = T._owner, re = je(T.type, T._source, W ? W.type : null);
328
- Se.setExtraStackFrame(re);
327
+ var W = T._owner, oe = je(T.type, T._source, W ? W.type : null);
328
+ Se.setExtraStackFrame(oe);
329
329
  } else
330
330
  Se.setExtraStackFrame(null);
331
331
  }
332
- function Ce(T, W, re, xe, Le) {
332
+ function Ce(T, W, oe, xe, Le) {
333
333
  {
334
334
  var He = Function.call.bind(ae);
335
335
  for (var Pe in T)
@@ -337,14 +337,14 @@ function gm() {
337
337
  var Ie = void 0;
338
338
  try {
339
339
  if (typeof T[Pe] != "function") {
340
- var mt = Error((xe || "React class") + ": " + re + " type `" + Pe + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof T[Pe] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
340
+ var mt = Error((xe || "React class") + ": " + oe + " type `" + Pe + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof T[Pe] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
341
341
  throw mt.name = "Invariant Violation", mt;
342
342
  }
343
- Ie = T[Pe](W, Pe, xe, re, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
343
+ Ie = T[Pe](W, Pe, xe, oe, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
344
344
  } catch (Je) {
345
345
  Ie = Je;
346
346
  }
347
- Ie && !(Ie instanceof Error) && (fe(Le), b("%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).", xe || "React class", re, Pe, typeof Ie), fe(null)), Ie instanceof Error && !(Ie.message in Ne) && (Ne[Ie.message] = !0, fe(Le), b("Failed %s type: %s", re, Ie.message), fe(null));
347
+ Ie && !(Ie instanceof Error) && (fe(Le), b("%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).", xe || "React class", oe, Pe, typeof Ie), fe(null)), Ie instanceof Error && !(Ie.message in Ne) && (Ne[Ie.message] = !0, fe(Le), b("Failed %s type: %s", oe, Ie.message), fe(null));
348
348
  }
349
349
  }
350
350
  }
@@ -354,8 +354,8 @@ function gm() {
354
354
  }
355
355
  function et(T) {
356
356
  {
357
- var W = typeof Symbol == "function" && Symbol.toStringTag, re = W && T[Symbol.toStringTag] || T.constructor.name || "Object";
358
- return re;
357
+ var W = typeof Symbol == "function" && Symbol.toStringTag, oe = W && T[Symbol.toStringTag] || T.constructor.name || "Object";
358
+ return oe;
359
359
  }
360
360
  }
361
361
  function xt(T) {
@@ -368,11 +368,11 @@ function gm() {
368
368
  function it(T) {
369
369
  return "" + T;
370
370
  }
371
- function an(T) {
371
+ function cn(T) {
372
372
  if (xt(T))
373
373
  return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", et(T)), it(T);
374
374
  }
375
- var G = g.ReactCurrentOwner, ne = {
375
+ var G = g.ReactCurrentOwner, re = {
376
376
  key: !0,
377
377
  ref: !0,
378
378
  __self: !0,
@@ -399,34 +399,34 @@ function gm() {
399
399
  }
400
400
  function En(T, W) {
401
401
  {
402
- var re = function() {
402
+ var oe = function() {
403
403
  $e || ($e = !0, b("%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)", W));
404
404
  };
405
- re.isReactWarning = !0, Object.defineProperty(T, "key", {
406
- get: re,
405
+ oe.isReactWarning = !0, Object.defineProperty(T, "key", {
406
+ get: oe,
407
407
  configurable: !0
408
408
  });
409
409
  }
410
410
  }
411
411
  function lt(T, W) {
412
412
  {
413
- var re = function() {
413
+ var oe = function() {
414
414
  Xe || (Xe = !0, b("%s: `ref` 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)", W));
415
415
  };
416
- re.isReactWarning = !0, Object.defineProperty(T, "ref", {
417
- get: re,
416
+ oe.isReactWarning = !0, Object.defineProperty(T, "ref", {
417
+ get: oe,
418
418
  configurable: !0
419
419
  });
420
420
  }
421
421
  }
422
- var Tt = function(T, W, re, xe, Le, He, Pe) {
422
+ var Tt = function(T, W, oe, xe, Le, He, Pe) {
423
423
  var Ie = {
424
424
  // This tag allows us to uniquely identify this as a React Element
425
425
  $$typeof: t,
426
426
  // Built-in properties that belong on the element
427
427
  type: T,
428
428
  key: W,
429
- ref: re,
429
+ ref: oe,
430
430
  props: Pe,
431
431
  // Record the component responsible for creating this element.
432
432
  _owner: He
@@ -448,12 +448,12 @@ function gm() {
448
448
  value: Le
449
449
  }), Object.freeze && (Object.freeze(Ie.props), Object.freeze(Ie)), Ie;
450
450
  };
451
- function at(T, W, re, xe, Le) {
451
+ function at(T, W, oe, xe, Le) {
452
452
  {
453
453
  var He, Pe = {}, Ie = null, mt = null;
454
- re !== void 0 && (an(re), Ie = "" + re), ht(W) && (an(W.key), Ie = "" + W.key), Re(W) && (mt = W.ref, jt(W, Le));
454
+ oe !== void 0 && (cn(oe), Ie = "" + oe), ht(W) && (cn(W.key), Ie = "" + W.key), Re(W) && (mt = W.ref, jt(W, Le));
455
455
  for (He in W)
456
- ae.call(W, He) && !ne.hasOwnProperty(He) && (Pe[He] = W[He]);
456
+ ae.call(W, He) && !re.hasOwnProperty(He) && (Pe[He] = W[He]);
457
457
  if (T && T.defaultProps) {
458
458
  var Je = T.defaultProps;
459
459
  for (He in Je)
@@ -466,13 +466,13 @@ function gm() {
466
466
  return Tt(T, Ie, mt, Le, xe, G.current, Pe);
467
467
  }
468
468
  }
469
- var pt = g.ReactCurrentOwner, cn = g.ReactDebugCurrentFrame;
469
+ var pt = g.ReactCurrentOwner, ln = g.ReactDebugCurrentFrame;
470
470
  function Yt(T) {
471
471
  if (T) {
472
- var W = T._owner, re = je(T.type, T._source, W ? W.type : null);
473
- cn.setExtraStackFrame(re);
472
+ var W = T._owner, oe = je(T.type, T._source, W ? W.type : null);
473
+ ln.setExtraStackFrame(oe);
474
474
  } else
475
- cn.setExtraStackFrame(null);
475
+ ln.setExtraStackFrame(null);
476
476
  }
477
477
  var hn;
478
478
  hn = !1;
@@ -499,10 +499,10 @@ Check the render method of \`` + T + "`.";
499
499
  {
500
500
  var W = le();
501
501
  if (!W) {
502
- var re = typeof T == "string" ? T : T.displayName || T.name;
503
- re && (W = `
502
+ var oe = typeof T == "string" ? T : T.displayName || T.name;
503
+ oe && (W = `
504
504
 
505
- Check the top-level render call using <` + re + ">.");
505
+ Check the top-level render call using <` + oe + ">.");
506
506
  }
507
507
  return W;
508
508
  }
@@ -512,12 +512,12 @@ Check the top-level render call using <` + re + ">.");
512
512
  if (!T._store || T._store.validated || T.key != null)
513
513
  return;
514
514
  T._store.validated = !0;
515
- var re = Nn(W);
516
- if (qe[re])
515
+ var oe = Nn(W);
516
+ if (qe[oe])
517
517
  return;
518
- qe[re] = !0;
518
+ qe[oe] = !0;
519
519
  var xe = "";
520
- T && T._owner && T._owner !== pt.current && (xe = " It was passed a child from " + K(T._owner.type) + "."), Yt(T), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', re, xe), Yt(null);
520
+ T && T._owner && T._owner !== pt.current && (xe = " It was passed a child from " + K(T._owner.type) + "."), Yt(T), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', oe, xe), Yt(null);
521
521
  }
522
522
  }
523
523
  function Gn(T, W) {
@@ -525,8 +525,8 @@ Check the top-level render call using <` + re + ">.");
525
525
  if (typeof T != "object")
526
526
  return;
527
527
  if (ot(T))
528
- for (var re = 0; re < T.length; re++) {
529
- var xe = T[re];
528
+ for (var oe = 0; oe < T.length; oe++) {
529
+ var xe = T[oe];
530
530
  te(xe) && Vn(xe, W);
531
531
  }
532
532
  else if (te(T))
@@ -544,18 +544,18 @@ Check the top-level render call using <` + re + ">.");
544
544
  var W = T.type;
545
545
  if (W == null || typeof W == "string")
546
546
  return;
547
- var re;
547
+ var oe;
548
548
  if (typeof W == "function")
549
- re = W.propTypes;
549
+ oe = W.propTypes;
550
550
  else if (typeof W == "object" && (W.$$typeof === l || // Note: Memo only checks outer props here.
551
551
  // Inner props are checked in the reconciler.
552
552
  W.$$typeof === h))
553
- re = W.propTypes;
553
+ oe = W.propTypes;
554
554
  else
555
555
  return;
556
- if (re) {
556
+ if (oe) {
557
557
  var xe = K(W);
558
- Ce(re, T.props, "prop", xe, T);
558
+ Ce(oe, T.props, "prop", xe, T);
559
559
  } else if (W.PropTypes !== void 0 && !hn) {
560
560
  hn = !0;
561
561
  var Le = K(W);
@@ -566,8 +566,8 @@ Check the top-level render call using <` + re + ">.");
566
566
  }
567
567
  function oo(T) {
568
568
  {
569
- for (var W = Object.keys(T.props), re = 0; re < W.length; re++) {
570
- var xe = W[re];
569
+ for (var W = Object.keys(T.props), oe = 0; oe < W.length; oe++) {
570
+ var xe = W[oe];
571
571
  if (xe !== "children" && xe !== "key") {
572
572
  Yt(T), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Yt(null);
573
573
  break;
@@ -577,7 +577,7 @@ Check the top-level render call using <` + re + ">.");
577
577
  }
578
578
  }
579
579
  var qt = {};
580
- function Kn(T, W, re, xe, Le, He) {
580
+ function Kn(T, W, oe, xe, Le, He) {
581
581
  {
582
582
  var Pe = j(T);
583
583
  if (!Pe) {
@@ -588,7 +588,7 @@ Check the top-level render call using <` + re + ">.");
588
588
  var Je;
589
589
  T === null ? Je = "null" : ot(T) ? Je = "array" : T !== void 0 && T.$$typeof === t ? (Je = "<" + (K(T.type) || "Unknown") + " />", Ie = " Did you accidentally export a JSX literal instead of a component?") : Je = typeof T, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Je, Ie);
590
590
  }
591
- var tt = at(T, W, re, Le, He);
591
+ var tt = at(T, W, oe, Le, He);
592
592
  if (tt == null)
593
593
  return tt;
594
594
  if (Pe) {
@@ -621,11 +621,11 @@ React keys must be passed directly to JSX without using spread:
621
621
  return T === r ? oo(tt) : ro(tt), tt;
622
622
  }
623
623
  }
624
- function Op(T, W, re) {
625
- return Kn(T, W, re, !0);
624
+ function Op(T, W, oe) {
625
+ return Kn(T, W, oe, !0);
626
626
  }
627
- function Mp(T, W, re) {
628
- return Kn(T, W, re, !1);
627
+ function Mp(T, W, oe) {
628
+ return Kn(T, W, oe, !1);
629
629
  }
630
630
  var Dp = Mp, Lp = Op;
631
631
  wr.Fragment = r, wr.jsx = Dp, wr.jsxs = Lp;
@@ -970,10 +970,10 @@ function ns(e, t, n) {
970
970
  if (k.endsWith(x, "{}"))
971
971
  x = r ? x : x.slice(0, -2), v = JSON.stringify(v);
972
972
  else if (k.isArray(v) && rg(v) || (k.isFileList(v) || k.endsWith(x, "[]")) && (g = k.toArray(v)))
973
- return x = Ll(x), g.forEach(function(y, E) {
973
+ return x = Ll(x), g.forEach(function(y, R) {
974
974
  !(k.isUndefined(y) || y === null) && t.append(
975
975
  // eslint-disable-next-line no-nested-ternary
976
- i === !0 ? tc([x], E, s) : i === null ? x : x + "[]",
976
+ i === !0 ? tc([x], R, s) : i === null ? x : x + "[]",
977
977
  u(y)
978
978
  );
979
979
  }), !1;
@@ -1678,30 +1678,30 @@ const Vl = (e) => {
1678
1678
  config: e,
1679
1679
  request: p
1680
1680
  };
1681
- Ul(function(R) {
1682
- n(R), x();
1683
- }, function(R) {
1684
- r(R), x();
1681
+ Ul(function(E) {
1682
+ n(E), x();
1683
+ }, function(E) {
1684
+ r(E), x();
1685
1685
  }, S), p = null;
1686
1686
  }
1687
1687
  "onloadend" in p ? p.onloadend = g : p.onreadystatechange = function() {
1688
1688
  !p || p.readyState !== 4 || p.status === 0 && !(p.responseURL && p.responseURL.indexOf("file:") === 0) || setTimeout(g);
1689
1689
  }, p.onabort = function() {
1690
1690
  p && (r(new we("Request aborted", we.ECONNABORTED, e, p)), p = null);
1691
- }, p.onerror = function(E) {
1692
- const S = E && E.message ? E.message : "Network Error", C = new we(S, we.ERR_NETWORK, e, p);
1693
- C.event = E || null, r(C), p = null;
1691
+ }, p.onerror = function(R) {
1692
+ const S = R && R.message ? R.message : "Network Error", C = new we(S, we.ERR_NETWORK, e, p);
1693
+ C.event = R || null, r(C), p = null;
1694
1694
  }, p.ontimeout = function() {
1695
- let E = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
1695
+ let R = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
1696
1696
  const S = o.transitional || $l;
1697
- o.timeoutErrorMessage && (E = o.timeoutErrorMessage), r(new we(
1698
- E,
1697
+ o.timeoutErrorMessage && (R = o.timeoutErrorMessage), r(new we(
1698
+ R,
1699
1699
  S.clarifyTimeoutError ? we.ETIMEDOUT : we.ECONNABORTED,
1700
1700
  e,
1701
1701
  p
1702
1702
  )), p = null;
1703
- }, s === void 0 && i.setContentType(null), "setRequestHeader" in p && k.forEach(i.toJSON(), function(E, S) {
1704
- p.setRequestHeader(S, E);
1703
+ }, s === void 0 && i.setContentType(null), "setRequestHeader" in p && k.forEach(i.toJSON(), function(R, S) {
1704
+ p.setRequestHeader(S, R);
1705
1705
  }), k.isUndefined(o.withCredentials) || (p.withCredentials = !!o.withCredentials), a && a !== "json" && (p.responseType = o.responseType), u && ([m, v] = Mo(u, !0), p.addEventListener("progress", m)), l && p.upload && ([h, w] = Mo(l), p.upload.addEventListener("progress", h), p.upload.addEventListener("loadend", w)), (o.cancelToken || o.signal) && (d = (y) => {
1706
1706
  p && (r(!y || y.type ? new fr(null, e, p) : y), p.abort(), p = null);
1707
1707
  }, o.cancelToken && o.cancelToken.subscribe(d), o.signal && (o.signal.aborted ? d() : o.signal.addEventListener("abort", d)));
@@ -1857,22 +1857,22 @@ const Vl = (e) => {
1857
1857
  data: g,
1858
1858
  signal: b,
1859
1859
  cancelToken: y,
1860
- timeout: E,
1860
+ timeout: R,
1861
1861
  onDownloadProgress: S,
1862
1862
  onUploadProgress: C,
1863
- responseType: R,
1863
+ responseType: E,
1864
1864
  headers: N,
1865
1865
  withCredentials: I = "same-origin",
1866
1866
  fetchOptions: j
1867
- } = Vl(v), O = t || fetch;
1868
- R = R ? (R + "").toLowerCase() : "text";
1869
- let U = _g([b, y && y.toAbortSignal()], E), K = null;
1867
+ } = Vl(v), M = t || fetch;
1868
+ E = E ? (E + "").toLowerCase() : "text";
1869
+ let U = _g([b, y && y.toAbortSignal()], R), K = null;
1870
1870
  const P = U && U.unsubscribe && (() => {
1871
1871
  U.unsubscribe();
1872
1872
  });
1873
- let M;
1873
+ let O;
1874
1874
  try {
1875
- if (C && u && p !== "get" && p !== "head" && (M = await w(N, g)) !== 0) {
1875
+ if (C && u && p !== "get" && p !== "head" && (O = await w(N, g)) !== 0) {
1876
1876
  let V = new n(x, {
1877
1877
  method: "POST",
1878
1878
  body: g,
@@ -1880,26 +1880,26 @@ const Vl = (e) => {
1880
1880
  }), ee;
1881
1881
  if (k.isFormData(g) && (ee = V.headers.get("content-type")) && N.setContentType(ee), V.body) {
1882
1882
  const [B, Z] = sc(
1883
- M,
1883
+ O,
1884
1884
  Mo(ic(C))
1885
1885
  );
1886
1886
  g = cc(V.body, lc, B, Z);
1887
1887
  }
1888
1888
  }
1889
1889
  k.isString(I) || (I = I ? "include" : "omit");
1890
- const L = s && "credentials" in n.prototype, oe = {
1890
+ const D = s && "credentials" in n.prototype, ne = {
1891
1891
  ...j,
1892
1892
  signal: U,
1893
1893
  method: p.toUpperCase(),
1894
1894
  headers: N.normalize().toJSON(),
1895
1895
  body: g,
1896
1896
  duplex: "half",
1897
- credentials: L ? I : void 0
1897
+ credentials: D ? I : void 0
1898
1898
  };
1899
- K = s && new n(x, oe);
1900
- let _ = await (s ? O(K, j) : O(x, oe));
1901
- const D = d && (R === "stream" || R === "response");
1902
- if (d && (S || D && P)) {
1899
+ K = s && new n(x, ne);
1900
+ let _ = await (s ? M(K, j) : M(x, ne));
1901
+ const L = d && (E === "stream" || E === "response");
1902
+ if (d && (S || L && P)) {
1903
1903
  const V = {};
1904
1904
  ["status", "statusText", "headers"].forEach((pe) => {
1905
1905
  V[pe] = _[pe];
@@ -1915,9 +1915,9 @@ const Vl = (e) => {
1915
1915
  V
1916
1916
  );
1917
1917
  }
1918
- R = R || "text";
1919
- let Y = await h[k.findKey(h, R) || "text"](_, v);
1920
- return !D && P && P(), await new Promise((V, ee) => {
1918
+ E = E || "text";
1919
+ let Y = await h[k.findKey(h, E) || "text"](_, v);
1920
+ return !L && P && P(), await new Promise((V, ee) => {
1921
1921
  Ul(V, ee, {
1922
1922
  data: Y,
1923
1923
  headers: yt.from(_.headers),
@@ -1927,13 +1927,13 @@ const Vl = (e) => {
1927
1927
  request: K
1928
1928
  });
1929
1929
  });
1930
- } catch (L) {
1931
- throw P && P(), L && L.name === "TypeError" && /Load failed|fetch/i.test(L.message) ? Object.assign(
1930
+ } catch (D) {
1931
+ throw P && P(), D && D.name === "TypeError" && /Load failed|fetch/i.test(D.message) ? Object.assign(
1932
1932
  new we("Network Error", we.ERR_NETWORK, v, K),
1933
1933
  {
1934
- cause: L.cause || L
1934
+ cause: D.cause || D
1935
1935
  }
1936
- ) : we.from(L, L && L.code, v, K);
1936
+ ) : we.from(D, D && D.code, v, K);
1937
1937
  }
1938
1938
  };
1939
1939
  }, Bg = /* @__PURE__ */ new Map(), Gl = (e) => {
@@ -2519,19 +2519,19 @@ class Xg {
2519
2519
  }
2520
2520
  const Mn = new Xg();
2521
2521
  function Jg(e = {}) {
2522
- const t = e.baseUrl ?? "/api/chat", n = e.streamPath ?? "/runs/stream", [r, o] = de(e.token ?? null), s = Ue(e.headers ?? {}), [i, a] = de(!1), [l, u] = de(null), [d, h] = de(""), [m, w] = de(null), [v, x] = de(0), [p, g] = de(!1), b = Ue(null), y = Ue(0), E = ze((N) => {
2522
+ const t = e.baseUrl ?? "/api/chat", n = e.streamPath ?? "/runs/stream", [r, o] = de(e.token ?? null), s = Ue(e.headers ?? {}), [i, a] = de(!1), [l, u] = de(null), [d, h] = de(""), [m, w] = de(null), [v, x] = de(0), [p, g] = de(!1), b = Ue(null), y = Ue(0), R = ze((N) => {
2523
2523
  o(N);
2524
2524
  }, []), S = ze(() => {
2525
2525
  var N;
2526
2526
  (N = b.current) == null || N.abort(), b.current = null, a(!1);
2527
2527
  }, []), C = ze(() => {
2528
2528
  h(""), w(null), u(null);
2529
- }, []), R = ze(
2529
+ }, []), E = ze(
2530
2530
  (N, I, j) => {
2531
2531
  b.current && (b.current.abort(), b.current = null), a(!0), u(null), e.autoAppendAssistant !== !1 && h("");
2532
- const O = new AbortController();
2533
- return b.current = O, (async () => {
2534
- var P, M, L, oe, _, D;
2532
+ const M = new AbortController();
2533
+ return b.current = M, (async () => {
2534
+ var P, O, D, ne, _, L;
2535
2535
  const U = (() => {
2536
2536
  var Y;
2537
2537
  try {
@@ -2560,8 +2560,8 @@ function Jg(e = {}) {
2560
2560
  const he = window.__AUTH_TOKEN__, $ = ((P = window.localStorage) == null ? void 0 : P.getItem("authToken")) || null;
2561
2561
  let A = null;
2562
2562
  try {
2563
- const J = (M = window.localStorage) == null ? void 0 : M.getItem("chat-settings");
2564
- J && (A = ((L = JSON.parse(J)) == null ? void 0 : L.apiKey) || null);
2563
+ const J = (O = window.localStorage) == null ? void 0 : O.getItem("chat-settings");
2564
+ J && (A = ((D = JSON.parse(J)) == null ? void 0 : D.apiKey) || null);
2565
2565
  } catch {
2566
2566
  }
2567
2567
  const z = he || $ || A || null;
@@ -2579,7 +2579,7 @@ function Jg(e = {}) {
2579
2579
  ...s.current
2580
2580
  },
2581
2581
  body: JSON.stringify(N),
2582
- signal: O.signal
2582
+ signal: M.signal
2583
2583
  });
2584
2584
  if (!V.ok || !V.body) {
2585
2585
  const pe = await V.text().catch(() => "");
@@ -2589,7 +2589,7 @@ function Jg(e = {}) {
2589
2589
  let ee = null, B = null, Z = null;
2590
2590
  try {
2591
2591
  const pe = V.headers.get("X-Thread-Id") || V.headers.get("x-thread-id"), he = V.headers.get("X-Thread-Created") || V.headers.get("x-thread-created"), $ = pe ?? null, A = String(he ?? "").toLowerCase() === "true";
2592
- (oe = j == null ? void 0 : j.onOpen) == null || oe.call(j, { threadId: $, created: A }), ee = V.body.getReader(), B = new TextDecoder();
2592
+ (ne = j == null ? void 0 : j.onOpen) == null || ne.call(j, { threadId: $, created: A }), ee = V.body.getReader(), B = new TextDecoder();
2593
2593
  let z = "", J = "", ce = y.current;
2594
2594
  for (; ; ) {
2595
2595
  const { value: ie, done: Ae } = await ee.read();
@@ -2645,11 +2645,11 @@ function Jg(e = {}) {
2645
2645
  } catch (Y) {
2646
2646
  if ((Y == null ? void 0 : Y.name) === "AbortError") return;
2647
2647
  const V = (Y == null ? void 0 : Y.message) || String(Y);
2648
- U && console.debug("[use-chat] connection error:", V), u(V), (D = j == null ? void 0 : j.onError) == null || D.call(j, V);
2648
+ U && console.debug("[use-chat] connection error:", V), u(V), (L = j == null ? void 0 : j.onError) == null || L.call(j, V);
2649
2649
  } finally {
2650
2650
  a(!1), g(!1), b.current = null;
2651
2651
  }
2652
- })(), { close: () => O.abort() };
2652
+ })(), { close: () => M.abort() };
2653
2653
  },
2654
2654
  [t, r, e.autoAppendAssistant]
2655
2655
  );
@@ -2663,10 +2663,10 @@ function Jg(e = {}) {
2663
2663
  lastCheckpointId: m,
2664
2664
  lastSeq: v,
2665
2665
  connected: p,
2666
- stream: R,
2666
+ stream: E,
2667
2667
  stop: S,
2668
2668
  clear: C,
2669
- setToken: E
2669
+ setToken: R
2670
2670
  };
2671
2671
  }
2672
2672
  function Zg(e) {
@@ -2759,7 +2759,7 @@ function nv(e = []) {
2759
2759
  Ye(() => () => {
2760
2760
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
2761
2761
  }, []);
2762
- const u = ln(() => ({
2762
+ const u = Zt(() => ({
2763
2763
  reset: (d) => n({ type: "reset", payload: { messages: d } }),
2764
2764
  seed: (d, h) => n({ type: "seed", payload: { messages: d, ...h ?? {} } }),
2765
2765
  prepend: (d) => n({ type: "prepend", payload: { messages: d } }),
@@ -2960,8 +2960,8 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2960
2960
  }), [v, x] = de(() => typeof l.getAuthToken == "function" ? l.getAuthToken() : null);
2961
2961
  Ye(() => {
2962
2962
  w(typeof l.getAuthToken == "function" ? l.getAuthToken() : null);
2963
- const G = l.onTokenChange((ne) => {
2964
- x(ne), w(ne);
2963
+ const G = l.onTokenChange((re) => {
2964
+ x(re), w(re);
2965
2965
  });
2966
2966
  return () => {
2967
2967
  G();
@@ -2969,19 +2969,19 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2969
2969
  }, [l, w]);
2970
2970
  const p = ze((G) => {
2971
2971
  l.setAuthToken(G);
2972
- }, [l]), { state: g, seed: b, prepend: y, pushUser: E, onEvent: S, reset: C } = nv(), R = 20, [N, I] = de(!1), [j, O] = de(!1), [U, K] = de(null), [P, M] = de(void 0), [L, oe] = de(void 0), [_, D] = de(!1), Y = Ue(!1), V = Ue([]), ee = ze((G) => {
2973
- G.cursor !== void 0 && K(G.cursor), G.hasMore !== void 0 && I(G.hasMore), G.checkpointId !== void 0 && M(G.checkpointId), G.checkpointNs !== void 0 && oe(G.checkpointNs);
2974
- }, []), B = ze((G, ne) => {
2972
+ }, [l]), { state: g, seed: b, prepend: y, pushUser: R, onEvent: S, reset: C } = nv(), E = 20, [N, I] = de(!1), [j, M] = de(!1), [U, K] = de(null), [P, O] = de(void 0), [D, ne] = de(void 0), [_, L] = de(!1), Y = Ue(!1), V = Ue([]), ee = ze((G) => {
2973
+ G.cursor !== void 0 && K(G.cursor), G.hasMore !== void 0 && I(G.hasMore), G.checkpointId !== void 0 && O(G.checkpointId), G.checkpointNs !== void 0 && ne(G.checkpointNs);
2974
+ }, []), B = ze((G, re) => {
2975
2975
  const $e = async () => {
2976
2976
  if (Y.current) {
2977
- console.warn(`[ChatProvider] Operation "${ne}" queued - another operation in progress`), V.current.push($e);
2977
+ console.warn(`[ChatProvider] Operation "${re}" queued - another operation in progress`), V.current.push($e);
2978
2978
  return;
2979
2979
  }
2980
2980
  Y.current = !0;
2981
2981
  try {
2982
- console.log(`[ChatProvider] Executing operation: ${ne}`), await G();
2982
+ console.log(`[ChatProvider] Executing operation: ${re}`), await G();
2983
2983
  } catch (Xe) {
2984
- throw console.error(`[ChatProvider] Operation "${ne}" failed:`, Xe), Xe;
2984
+ throw console.error(`[ChatProvider] Operation "${re}" failed:`, Xe), Xe;
2985
2985
  } finally {
2986
2986
  Y.current = !1;
2987
2987
  const Xe = V.current.shift();
@@ -2989,15 +2989,15 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2989
2989
  });
2990
2990
  }
2991
2991
  };
2992
- Y.current ? (V.current.push($e), console.log(`[ChatProvider] Queued operation: ${ne}`)) : $e().catch(() => {
2992
+ Y.current ? (V.current.push($e), console.log(`[ChatProvider] Queued operation: ${re}`)) : $e().catch(() => {
2993
2993
  });
2994
2994
  }, []), Z = ze(
2995
- (G, ne) => {
2995
+ (G, re) => {
2996
2996
  const $e = Array.isArray(G == null ? void 0 : G.messages) ? G.messages : [];
2997
- ne === "replace" ? (console.log("[ChatProvider] Replacing messages, count:", $e.length), b($e, {
2997
+ re === "replace" ? (console.log("[ChatProvider] Replacing messages, count:", $e.length), b($e, {
2998
2998
  checkpointId: (G == null ? void 0 : G.checkpointId) ?? null,
2999
2999
  checkpointNs: (G == null ? void 0 : G.checkpointNs) ?? null
3000
- })) : ne === "prepend" && $e.length ? (console.log("[ChatProvider] Calling prepend with", $e.length, "messages"), y($e)) : console.log("[ChatProvider] Skipping prepend - empty list or wrong mode"), K((G == null ? void 0 : G.nextCursor) ?? null), I(!!(G != null && G.hasMore)), M((Xe) => (G == null ? void 0 : G.checkpointId) ?? Xe ?? void 0), oe((Xe) => (G == null ? void 0 : G.checkpointNs) ?? Xe ?? void 0);
3000
+ })) : re === "prepend" && $e.length ? (console.log("[ChatProvider] Calling prepend with", $e.length, "messages"), y($e)) : console.log("[ChatProvider] Skipping prepend - empty list or wrong mode"), K((G == null ? void 0 : G.nextCursor) ?? null), I(!!(G != null && G.hasMore)), O((Xe) => (G == null ? void 0 : G.checkpointId) ?? Xe ?? void 0), ne((Xe) => (G == null ? void 0 : G.checkpointNs) ?? Xe ?? void 0);
3001
3001
  },
3002
3002
  [b, y]
3003
3003
  ), [pe, he] = de([]), [$, A] = de(null), z = ze(async () => {
@@ -3005,7 +3005,7 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3005
3005
  he(G);
3006
3006
  }, [l]), [J, ce] = de(!1), ie = ze(
3007
3007
  async (G) => {
3008
- const ne = (G == null ? void 0 : G.maxAttempts) ?? 5, $e = (G == null ? void 0 : G.baseDelayMs) ?? 500, Xe = (G == null ? void 0 : G.timeoutMs) ?? 2e3;
3008
+ const re = (G == null ? void 0 : G.maxAttempts) ?? 5, $e = (G == null ? void 0 : G.baseDelayMs) ?? 500, Xe = (G == null ? void 0 : G.timeoutMs) ?? 2e3;
3009
3009
  if (!l.baseUrl) return !1;
3010
3010
  const Re = l.baseUrl.replace(/\/+$/, ""), ht = [
3011
3011
  "/health",
@@ -3029,13 +3029,13 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3029
3029
  return !1;
3030
3030
  }
3031
3031
  };
3032
- for (let lt = 0; lt < ne; lt++) {
3033
- console.debug(`[ChatProvider] health-check attempt ${lt + 1}/${ne}`);
3032
+ for (let lt = 0; lt < re; lt++) {
3033
+ console.debug(`[ChatProvider] health-check attempt ${lt + 1}/${re}`);
3034
3034
  for (const at of ht) {
3035
3035
  let pt = at;
3036
3036
  Re.endsWith("/api") && at.startsWith("/api") && (pt = at.replace(/^\/api/, "") || "/");
3037
- const cn = pt === "/" ? Re + "/" : Re + pt;
3038
- if (console.debug(`[ChatProvider] checking ${cn}`), await jt(cn) || at === "/" && await En(Re + "/"))
3037
+ const ln = pt === "/" ? Re + "/" : Re + pt;
3038
+ if (console.debug(`[ChatProvider] checking ${ln}`), await jt(ln) || at === "/" && await En(Re + "/"))
3039
3039
  return ce(!0), !0;
3040
3040
  }
3041
3041
  const Tt = $e * Math.pow(2, lt);
@@ -3053,9 +3053,9 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3053
3053
  }
3054
3054
  return (async () => {
3055
3055
  try {
3056
- const ne = await ie();
3056
+ const re = await ie();
3057
3057
  if (!G) return;
3058
- ne ? z().catch(() => {
3058
+ re ? z().catch(() => {
3059
3059
  }) : console.warn("[ChatProvider] backend health-check failed — skipping initial loads");
3060
3060
  } catch {
3061
3061
  }
@@ -3081,7 +3081,7 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3081
3081
  }
3082
3082
  }, [o, s, l.baseUrl, J]);
3083
3083
  const _e = Ue(null), je = Ue(null), ae = ze(
3084
- async (G, ne, $e) => {
3084
+ async (G, re, $e) => {
3085
3085
  await B(async () => {
3086
3086
  if (!l.baseUrl) {
3087
3087
  console.debug("[ChatProvider] skipping loadThread: api.baseUrl not configured");
@@ -3101,16 +3101,16 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3101
3101
  });
3102
3102
  const Re = await l.getMessages({
3103
3103
  threadId: G,
3104
- checkpointId: ne,
3104
+ checkpointId: re,
3105
3105
  checkpointNs: $e,
3106
- limit: R
3106
+ limit: E
3107
3107
  });
3108
3108
  A(G);
3109
3109
  const ht = Array.isArray(Re == null ? void 0 : Re.messages) ? Re.messages : [];
3110
3110
  ht.length > 0 && (console.log("[ChatProvider] Loading thread with", ht.length, "messages"), b(ht, {
3111
3111
  checkpointId: (Re == null ? void 0 : Re.checkpointId) ?? null,
3112
3112
  checkpointNs: (Re == null ? void 0 : Re.checkpointNs) ?? null
3113
- })), K((Re == null ? void 0 : Re.nextCursor) ?? null), I(!!(Re != null && Re.hasMore)), M((jt) => (Re == null ? void 0 : Re.checkpointId) ?? jt ?? void 0), oe((jt) => (Re == null ? void 0 : Re.checkpointNs) ?? jt ?? void 0);
3113
+ })), K((Re == null ? void 0 : Re.nextCursor) ?? null), I(!!(Re != null && Re.hasMore)), O((jt) => (Re == null ? void 0 : Re.checkpointId) ?? jt ?? void 0), ne((jt) => (Re == null ? void 0 : Re.checkpointNs) ?? jt ?? void 0);
3114
3114
  } finally {
3115
3115
  _e.current = null;
3116
3116
  }
@@ -3118,9 +3118,9 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3118
3118
  },
3119
3119
  [l, B, ee, b]
3120
3120
  ), Ne = ze(async (G) => {
3121
- const ne = await l.listCheckpoints(G);
3122
- return lv(ne, G);
3123
- }, [l]), Se = ze(async (G, ne) => {
3121
+ const re = await l.listCheckpoints(G);
3122
+ return lv(re, G);
3123
+ }, [l]), Se = ze(async (G, re) => {
3124
3124
  await B(async () => {
3125
3125
  if (!$) throw new Error("No active thread");
3126
3126
  ee({
@@ -3132,8 +3132,8 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3132
3132
  const $e = await l.getMessages({
3133
3133
  threadId: $,
3134
3134
  checkpointId: G,
3135
- checkpointNs: ne ?? void 0,
3136
- limit: R
3135
+ checkpointNs: re ?? void 0,
3136
+ limit: E
3137
3137
  });
3138
3138
  Z($e, "replace");
3139
3139
  }, `navigateToCheckpoint-${G}`);
@@ -3144,38 +3144,38 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3144
3144
  Ye(() => {
3145
3145
  const G = Ce.current;
3146
3146
  Ce.current = u, G && !u && $ && B(async () => {
3147
- D(!0);
3147
+ L(!0);
3148
3148
  try {
3149
- const ne = await l.getMessages({
3149
+ const re = await l.getMessages({
3150
3150
  threadId: $,
3151
3151
  // Do not pass checkpointId/checkpointNs so the backend returns the latest
3152
3152
  checkpointId: void 0,
3153
3153
  checkpointNs: void 0,
3154
- limit: R
3154
+ limit: E
3155
3155
  });
3156
- Z(ne, "replace");
3157
- } catch (ne) {
3158
- console.warn("[ChatProvider] Post-streaming fetch failed:", ne);
3156
+ Z(re, "replace");
3157
+ } catch (re) {
3158
+ console.warn("[ChatProvider] Post-streaming fetch failed:", re);
3159
3159
  } finally {
3160
- setTimeout(() => D(!1), 100);
3160
+ setTimeout(() => L(!1), 100);
3161
3161
  }
3162
3162
  try {
3163
3163
  await z();
3164
- } catch (ne) {
3165
- console.warn("[ChatProvider] Post-streaming thread refresh failed:", ne);
3164
+ } catch (re) {
3165
+ console.warn("[ChatProvider] Post-streaming thread refresh failed:", re);
3166
3166
  }
3167
3167
  }, "postStreamingRefresh");
3168
3168
  }, [u, $, l, Z, z, B]);
3169
3169
  const Be = ze(async (G) => {
3170
- const ne = await l.createThread(G);
3171
- return await z(), await ae(ne.threadId), ne.threadId;
3170
+ const re = await l.createThread(G);
3171
+ return await z(), await ae(re.threadId), re.threadId;
3172
3172
  }, [l, z, ae]), ot = ze(async (G) => {
3173
- await l.deleteThread(G), await z(), $ === G && (A(null), C([]), I(!1), K(null), M(void 0), oe(void 0));
3174
- }, [l, z, $, C]), et = ze(async (G, ne) => {
3175
- await l.updateThread(G, ne), await z();
3176
- }, [l, z]), xt = ze(async (G, ne) => {
3173
+ await l.deleteThread(G), await z(), $ === G && (A(null), C([]), I(!1), K(null), O(void 0), ne(void 0));
3174
+ }, [l, z, $, C]), et = ze(async (G, re) => {
3175
+ await l.updateThread(G, re), await z();
3176
+ }, [l, z]), xt = ze(async (G, re) => {
3177
3177
  var hn;
3178
- const $e = (ne == null ? void 0 : ne.attachments) || [], { contentParts: Xe, filesInfo: Re } = await dv(
3178
+ const $e = (re == null ? void 0 : re.attachments) || [], { contentParts: Xe, filesInfo: Re } = await dv(
3179
3179
  l,
3180
3180
  $e,
3181
3181
  t == null ? void 0 : t.uploadPath
@@ -3187,28 +3187,28 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3187
3187
  content: ht,
3188
3188
  // ← No empty text parts
3189
3189
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3190
- checkpointId: (ne == null ? void 0 : ne.checkpointId) ?? g.lastCheckpointId ?? void 0,
3191
- checkpointNs: (ne == null ? void 0 : ne.checkpointNs) ?? g.lastCheckpointNs ?? void 0
3190
+ checkpointId: (re == null ? void 0 : re.checkpointId) ?? g.lastCheckpointId ?? void 0,
3191
+ checkpointNs: (re == null ? void 0 : re.checkpointNs) ?? g.lastCheckpointNs ?? void 0
3192
3192
  };
3193
- E(jt);
3193
+ R(jt);
3194
3194
  const En = {
3195
3195
  ...jt,
3196
3196
  // No need to filter - messageContent already only contains text
3197
3197
  content: ht
3198
3198
  // ← Clean content without empty parts
3199
- }, lt = { ...(ne == null ? void 0 : ne.payloadExtras) ?? {} }, Tt = !!lt.edit, at = lt.originalMessageId, pt = typeof at == "string" ? at : void 0, cn = $e && $e.length > 0, Yt = {
3199
+ }, lt = { ...(re == null ? void 0 : re.payloadExtras) ?? {} }, Tt = !!lt.edit, at = lt.originalMessageId, pt = typeof at == "string" ? at : void 0, ln = $e && $e.length > 0, Yt = {
3200
3200
  ...$ ? { threadId: $ } : {},
3201
3201
  payload: {
3202
3202
  messages: [En],
3203
3203
  // Remove attachments array since we're not including file parts in message content
3204
3204
  files_info: Re,
3205
- ...i && cn && a ? { active_agent: a } : {},
3205
+ ...i && ln && a ? { active_agent: a } : {},
3206
3206
  ...lt
3207
3207
  },
3208
- checkpointId: (ne == null ? void 0 : ne.checkpointId) ?? g.lastCheckpointId ?? void 0,
3209
- checkpointNs: (ne == null ? void 0 : ne.checkpointNs) ?? g.lastCheckpointNs ?? void 0,
3210
- nodeFilter: ne == null ? void 0 : ne.nodeFilter,
3211
- config: ne == null ? void 0 : ne.config,
3208
+ checkpointId: (re == null ? void 0 : re.checkpointId) ?? g.lastCheckpointId ?? void 0,
3209
+ checkpointNs: (re == null ? void 0 : re.checkpointNs) ?? g.lastCheckpointNs ?? void 0,
3210
+ nodeFilter: re == null ? void 0 : re.nodeFilter,
3211
+ config: re == null ? void 0 : re.config,
3212
3212
  edit: Tt,
3213
3213
  originalMessageId: pt
3214
3214
  };
@@ -3223,29 +3223,29 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3223
3223
  }
3224
3224
  }
3225
3225
  );
3226
- }, [$, E, h, S, g.lastCheckpointId, g.lastCheckpointNs, l, t == null ? void 0 : t.uploadPath, z, A, i, a]), it = ze(
3226
+ }, [$, R, h, S, g.lastCheckpointId, g.lastCheckpointNs, l, t == null ? void 0 : t.uploadPath, z, A, i, a]), it = ze(
3227
3227
  async (G) => {
3228
3228
  if (!$) throw new Error("No active thread");
3229
3229
  if (j || !N) return;
3230
- const ne = U;
3231
- if (ne) {
3232
- O(!0);
3230
+ const re = U;
3231
+ if (re) {
3232
+ M(!0);
3233
3233
  try {
3234
3234
  const $e = await l.getMessages({
3235
3235
  threadId: $,
3236
3236
  checkpointId: P,
3237
- checkpointNs: L,
3238
- limit: (G == null ? void 0 : G.limit) ?? R,
3239
- beforeId: ne
3237
+ checkpointNs: D,
3238
+ limit: (G == null ? void 0 : G.limit) ?? E,
3239
+ beforeId: re
3240
3240
  });
3241
3241
  Z($e, "prepend");
3242
3242
  } finally {
3243
- O(!1);
3243
+ M(!1);
3244
3244
  }
3245
3245
  }
3246
3246
  },
3247
- [l, $, P, L, U, N, j, Z, R]
3248
- ), an = {
3247
+ [l, $, P, D, U, N, j, Z, E]
3248
+ ), cn = {
3249
3249
  baseUrl: l.baseUrl,
3250
3250
  token: v,
3251
3251
  setToken: p,
@@ -3264,7 +3264,7 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3264
3264
  isPostStreamFetch: _,
3265
3265
  // NEW: expose flag for post-stream fetches to consumers
3266
3266
  loadOlderMessages: it,
3267
- historyPageSize: R,
3267
+ historyPageSize: E,
3268
3268
  listCheckpoints: Ne,
3269
3269
  navigateToCheckpoint: Se,
3270
3270
  returnToLatest: fe,
@@ -3276,7 +3276,7 @@ function wo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3276
3276
  send: xt,
3277
3277
  stop: m
3278
3278
  };
3279
- return /* @__PURE__ */ c.jsx(Jl.Provider, { value: an, children: e });
3279
+ return /* @__PURE__ */ c.jsx(Jl.Provider, { value: cn, children: e });
3280
3280
  }
3281
3281
  function Yi() {
3282
3282
  const e = Cl(Jl);
@@ -3381,12 +3381,12 @@ function hv({
3381
3381
  [m, i, h]
3382
3382
  ), y = q.useCallback((N) => {
3383
3383
  w(N.target.value), p.current && (p.current.style.height = "auto", p.current.style.height = `${p.current.scrollHeight}px`);
3384
- }, []), E = q.useCallback(
3384
+ }, []), R = q.useCallback(
3385
3385
  (N) => {
3386
3386
  N.key === "Enter" && !N.shiftKey ? (N.preventDefault(), b()) : N.key === "Escape" && t && (N.preventDefault(), a == null || a());
3387
3387
  },
3388
3388
  [b, t, a]
3389
- ), R = `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${t ? "border-[hsl(var(--ring))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))] dark:bg-[hsl(var(--card))] dark:text-[hsl(var(--card-foreground))]" : ""} ${d}`;
3389
+ ), E = `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${t ? "border-[hsl(var(--ring))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))] dark:bg-[hsl(var(--card))] dark:text-[hsl(var(--card-foreground))]" : ""} ${d}`;
3390
3390
  return /* @__PURE__ */ c.jsx("form", { onSubmit: (N) => void b(N), className: `w-full ${u}`, children: /* @__PURE__ */ c.jsxs("div", { className: "flex items-end gap-2", children: [
3391
3391
  /* @__PURE__ */ c.jsx("div", { className: "flex-1", children: /* @__PURE__ */ c.jsx(
3392
3392
  Zl,
@@ -3394,9 +3394,9 @@ function hv({
3394
3394
  ref: p,
3395
3395
  value: m,
3396
3396
  onChange: y,
3397
- onKeyDown: E,
3397
+ onKeyDown: R,
3398
3398
  placeholder: t ? "Edit your message..." : n,
3399
- className: R,
3399
+ className: E,
3400
3400
  disabled: o,
3401
3401
  maxLength: s,
3402
3402
  rows: 1,
@@ -3529,7 +3529,7 @@ function H(e, ...t) {
3529
3529
  }
3530
3530
  };
3531
3531
  }
3532
- function Qt(e, t) {
3532
+ function en(e, t) {
3533
3533
  return (n) => (r) => {
3534
3534
  n(t = e(t, r));
3535
3535
  };
@@ -4157,16 +4157,16 @@ function Lv(e) {
4157
4157
  const Fv = {
4158
4158
  offsetHeight: "height",
4159
4159
  offsetWidth: "width"
4160
- }, rn = Me(
4160
+ }, on = Me(
4161
4161
  ([{ log: e }, { recalcInProgress: t }]) => {
4162
4162
  const n = ke(), r = ke(), o = ft(r, 0), s = ke(), i = ke(), a = X(0), l = X([]), u = X(void 0), d = X(void 0), h = X((S, C) => vn(S, Fv[C])), m = X(void 0), w = X(0), v = jv(), x = ft(
4163
- H(n, Te(l, e, w), Qt(Ov, v), Ve()),
4163
+ H(n, Te(l, e, w), en(Ov, v), Ve()),
4164
4164
  v
4165
4165
  ), p = ft(
4166
4166
  H(
4167
4167
  l,
4168
4168
  Ve(),
4169
- Qt((S, C) => ({ current: C, prev: S.current }), {
4169
+ en((S, C) => ({ current: C, prev: S.current }), {
4170
4170
  current: [],
4171
4171
  prev: []
4172
4172
  }),
@@ -4179,8 +4179,8 @@ const Fv = {
4179
4179
  l,
4180
4180
  ge((S) => S.length > 0),
4181
4181
  Te(x, w),
4182
- se(([S, C, R]) => {
4183
- const N = S.reduce((I, j, O) => Et(I, j, Dr(j, C.offsetTree, R) || O), tr());
4182
+ se(([S, C, E]) => {
4183
+ const N = S.reduce((I, j, M) => Et(I, j, Dr(j, C.offsetTree, E) || M), tr());
4184
4184
  return {
4185
4185
  ...C,
4186
4186
  groupIndices: S,
@@ -4194,10 +4194,10 @@ const Fv = {
4194
4194
  r,
4195
4195
  Te(x),
4196
4196
  ge(([S, { lastIndex: C }]) => S < C),
4197
- se(([S, { lastIndex: C, lastSize: R }]) => [
4197
+ se(([S, { lastIndex: C, lastSize: E }]) => [
4198
4198
  {
4199
4199
  endIndex: C,
4200
- size: R,
4200
+ size: E,
4201
4201
  startIndex: S
4202
4202
  }
4203
4203
  ])
@@ -4223,10 +4223,10 @@ const Fv = {
4223
4223
  H(
4224
4224
  n,
4225
4225
  Te(x),
4226
- Qt(
4227
- ({ sizes: S }, [C, R]) => ({
4228
- changed: R !== S,
4229
- sizes: R
4226
+ en(
4227
+ ({ sizes: S }, [C, E]) => ({
4228
+ changed: E !== S,
4229
+ sizes: E
4230
4230
  }),
4231
4231
  { changed: !1, sizes: v }
4232
4232
  ),
@@ -4236,7 +4236,7 @@ const Fv = {
4236
4236
  Fe(
4237
4237
  H(
4238
4238
  a,
4239
- Qt(
4239
+ en(
4240
4240
  (S, C) => ({ diff: S.prev - C, prev: C }),
4241
4241
  { diff: 0, prev: 0 }
4242
4242
  ),
@@ -4247,8 +4247,8 @@ const Fv = {
4247
4247
  if (S > 0)
4248
4248
  ye(t, !0), ye(s, S + Rc(S, C));
4249
4249
  else if (S < 0) {
4250
- const R = Ze(p);
4251
- R.length > 0 && (S -= Rc(-S, R)), ye(i, S);
4250
+ const E = Ze(p);
4251
+ E.length > 0 && (S -= Rc(-S, E)), ye(i, S);
4252
4252
  }
4253
4253
  }
4254
4254
  ), Fe(H(a, Te(e)), ([S, C]) => {
@@ -4264,37 +4264,37 @@ const Fv = {
4264
4264
  s,
4265
4265
  Te(x),
4266
4266
  se(([S, C]) => {
4267
- const R = C.groupIndices.length > 0, N = [], I = C.lastSize;
4268
- if (R) {
4267
+ const E = C.groupIndices.length > 0, N = [], I = C.lastSize;
4268
+ if (E) {
4269
4269
  const j = Or(C.sizeTree, 0);
4270
- let O = 0, U = 0;
4271
- for (; O < S; ) {
4272
- const P = C.groupIndices[U], M = C.groupIndices.length === U + 1 ? 1 / 0 : C.groupIndices[U + 1] - P - 1;
4270
+ let M = 0, U = 0;
4271
+ for (; M < S; ) {
4272
+ const P = C.groupIndices[U], O = C.groupIndices.length === U + 1 ? 1 / 0 : C.groupIndices[U + 1] - P - 1;
4273
4273
  N.push({
4274
4274
  endIndex: P,
4275
4275
  size: j,
4276
4276
  startIndex: P
4277
4277
  }), N.push({
4278
- endIndex: P + 1 + M - 1,
4278
+ endIndex: P + 1 + O - 1,
4279
4279
  size: I,
4280
4280
  startIndex: P + 1
4281
- }), U++, O += M + 1;
4281
+ }), U++, M += O + 1;
4282
4282
  }
4283
4283
  const K = An(C.sizeTree);
4284
- return O !== S && K.shift(), K.reduce(
4285
- (P, { k: M, v: L }) => {
4286
- let oe = P.ranges;
4287
- return P.prevSize !== 0 && (oe = [
4284
+ return M !== S && K.shift(), K.reduce(
4285
+ (P, { k: O, v: D }) => {
4286
+ let ne = P.ranges;
4287
+ return P.prevSize !== 0 && (ne = [
4288
4288
  ...P.ranges,
4289
4289
  {
4290
- endIndex: M + S - 1,
4290
+ endIndex: O + S - 1,
4291
4291
  size: P.prevSize,
4292
4292
  startIndex: P.prevIndex
4293
4293
  }
4294
4294
  ]), {
4295
- prevIndex: M + S,
4296
- prevSize: L,
4297
- ranges: oe
4295
+ prevIndex: O + S,
4296
+ prevSize: D,
4297
+ ranges: ne
4298
4298
  };
4299
4299
  },
4300
4300
  {
@@ -4305,10 +4305,10 @@ const Fv = {
4305
4305
  ).ranges;
4306
4306
  }
4307
4307
  return An(C.sizeTree).reduce(
4308
- (j, { k: O, v: U }) => ({
4309
- prevIndex: O + S,
4308
+ (j, { k: M, v: U }) => ({
4309
+ prevIndex: M + S,
4310
4310
  prevSize: U,
4311
- ranges: [...j.ranges, { endIndex: O + S - 1, size: j.prevSize, startIndex: j.prevIndex }]
4311
+ ranges: [...j.ranges, { endIndex: M + S - 1, size: j.prevSize, startIndex: j.prevIndex }]
4312
4312
  }),
4313
4313
  {
4314
4314
  prevIndex: 0,
@@ -4320,13 +4320,13 @@ const Fv = {
4320
4320
  ),
4321
4321
  n
4322
4322
  );
4323
- const E = Nt(
4323
+ const R = Nt(
4324
4324
  H(
4325
4325
  i,
4326
4326
  Te(x, w),
4327
- se(([S, { offsetTree: C }, R]) => {
4327
+ se(([S, { offsetTree: C }, E]) => {
4328
4328
  const N = -S;
4329
- return Dr(N, C, R);
4329
+ return Dr(N, C, E);
4330
4330
  })
4331
4331
  )
4332
4332
  );
@@ -4334,19 +4334,19 @@ const Fv = {
4334
4334
  H(
4335
4335
  i,
4336
4336
  Te(x, w),
4337
- se(([S, C, R]) => {
4337
+ se(([S, C, E]) => {
4338
4338
  if (C.groupIndices.length > 0) {
4339
4339
  if (We(C.sizeTree))
4340
4340
  return C;
4341
4341
  let N = tr();
4342
4342
  const I = Ze(p);
4343
- let j = 0, O = 0, U = 0;
4343
+ let j = 0, M = 0, U = 0;
4344
4344
  for (; j < -S; ) {
4345
- U = I[O];
4346
- const K = I[O + 1] - U - 1;
4347
- O++, j += K + 1;
4345
+ U = I[M];
4346
+ const K = I[M + 1] - U - 1;
4347
+ M++, j += K + 1;
4348
4348
  }
4349
- if (N = An(C.sizeTree).reduce((K, { k: P, v: M }) => Et(K, Math.max(0, P + S), M), N), j !== -S) {
4349
+ if (N = An(C.sizeTree).reduce((K, { k: P, v: O }) => Et(K, Math.max(0, P + S), O), N), j !== -S) {
4350
4350
  const K = Or(C.sizeTree, U);
4351
4351
  N = Et(N, 0, K);
4352
4352
  const P = zt(C.sizeTree, -S + 1)[1];
@@ -4355,14 +4355,14 @@ const Fv = {
4355
4355
  return {
4356
4356
  ...C,
4357
4357
  sizeTree: N,
4358
- ...Si(C.offsetTree, 0, N, R)
4358
+ ...Si(C.offsetTree, 0, N, E)
4359
4359
  };
4360
4360
  } else {
4361
- const N = An(C.sizeTree).reduce((I, { k: j, v: O }) => Et(I, Math.max(0, j + S), O), tr());
4361
+ const N = An(C.sizeTree).reduce((I, { k: j, v: M }) => Et(I, Math.max(0, j + S), M), tr());
4362
4362
  return {
4363
4363
  ...C,
4364
4364
  sizeTree: N,
4365
- ...Si(C.offsetTree, 0, N, R)
4365
+ ...Si(C.offsetTree, 0, N, E)
4366
4366
  };
4367
4367
  }
4368
4368
  })
@@ -4380,7 +4380,7 @@ const Fv = {
4380
4380
  itemSize: h,
4381
4381
  listRefresh: b,
4382
4382
  shiftWith: i,
4383
- shiftWithOffset: E,
4383
+ shiftWithOffset: R,
4384
4384
  sizeRanges: n,
4385
4385
  // output
4386
4386
  sizes: x,
@@ -4428,7 +4428,7 @@ const fu = Me(
4428
4428
  i
4429
4429
  ), { groupCounts: s, topItemsIndexes: i };
4430
4430
  },
4431
- Ge(rn, gt)
4431
+ Ge(on, gt)
4432
4432
  ), Cn = Me(
4433
4433
  ([{ log: e }]) => {
4434
4434
  const t = X(!1), n = Nt(
@@ -4476,18 +4476,18 @@ const qr = Me(
4476
4476
  Te(e, s, o),
4477
4477
  se(
4478
4478
  ([
4479
- [E, S, C, R, N, I, j, O],
4479
+ [R, S, C, E, N, I, j, M],
4480
4480
  U,
4481
4481
  K,
4482
4482
  P
4483
4483
  ]) => {
4484
- const M = hu(E), { align: L, behavior: oe, offset: _ } = M, D = R - 1, Y = du(M, S, D);
4484
+ const O = hu(R), { align: D, behavior: ne, offset: _ } = O, L = E - 1, Y = du(O, S, L);
4485
4485
  let V = Dr(Y, S.offsetTree, U) + I;
4486
- L === "end" ? (V += K + zt(S.sizeTree, Y)[1] - C + P, Y === D && (V += j)) : L === "center" ? V += (K + zt(S.sizeTree, Y)[1] - C + P) / 2 : V -= N, _ && (V += _);
4486
+ D === "end" ? (V += K + zt(S.sizeTree, Y)[1] - C + P, Y === L && (V += j)) : D === "center" ? V += (K + zt(S.sizeTree, Y)[1] - C + P) / 2 : V -= N, _ && (V += _);
4487
4487
  const ee = (B) => {
4488
- y(), B ? (O("retrying to scroll to", { location: E }, St.DEBUG), ye(w, E)) : (ye(v, !0), O("list did not change, scroll successful", {}, St.DEBUG));
4488
+ y(), B ? (M("retrying to scroll to", { location: R }, St.DEBUG), ye(w, R)) : (ye(v, !0), M("list did not change, scroll successful", {}, St.DEBUG));
4489
4489
  };
4490
- if (y(), oe === "smooth") {
4490
+ if (y(), ne === "smooth") {
4491
4491
  let B = !1;
4492
4492
  b = Fe(t, (Z) => {
4493
4493
  B = B || Z;
@@ -4498,7 +4498,7 @@ const qr = Me(
4498
4498
  p = $t(H(t, Hv(150)), ee);
4499
4499
  return g = setTimeout(() => {
4500
4500
  y();
4501
- }, 1200), ye(l, !0), O("scrolling from index to", { behavior: oe, index: Y, top: V }, St.DEBUG), { behavior: oe, top: V };
4501
+ }, 1200), ye(l, !0), M("scrolling from index to", { behavior: ne, index: Y, top: V }, St.DEBUG), { behavior: ne, top: V };
4502
4502
  }
4503
4503
  )
4504
4504
  ),
@@ -4509,7 +4509,7 @@ const qr = Me(
4509
4509
  topListHeight: x
4510
4510
  };
4511
4511
  },
4512
- Ge(rn, gt, Sn),
4512
+ Ge(on, gt, Sn),
4513
4513
  { singleton: !0 }
4514
4514
  );
4515
4515
  function Hv(e) {
@@ -4572,7 +4572,7 @@ const Xr = Me(
4572
4572
  scrolledToInitialItem: a
4573
4573
  };
4574
4574
  },
4575
- Ge(rn, gt, qr, Cn),
4575
+ Ge(on, gt, qr, Cn),
4576
4576
  { singleton: !0 }
4577
4577
  );
4578
4578
  function pu(e, t) {
@@ -4609,25 +4609,25 @@ const Lr = "up", Nr = "down", zv = "none", Uv = {
4609
4609
  const v = Nt(
4610
4610
  H(
4611
4611
  nt(r, me(s), me(t), me(e), me(d)),
4612
- Qt((b, [{ scrollHeight: y, scrollTop: E }, S, C, R, N]) => {
4613
- const I = E + S - y > -N, j = {
4612
+ en((b, [{ scrollHeight: y, scrollTop: R }, S, C, E, N]) => {
4613
+ const I = R + S - y > -N, j = {
4614
4614
  scrollHeight: y,
4615
- scrollTop: E,
4615
+ scrollTop: R,
4616
4616
  viewportHeight: S
4617
4617
  };
4618
4618
  if (I) {
4619
4619
  let U, K;
4620
- return E > b.state.scrollTop ? (U = "SCROLLED_DOWN", K = b.state.scrollTop - E) : (U = "SIZE_DECREASED", K = b.state.scrollTop - E || b.scrollTopDelta), {
4620
+ return R > b.state.scrollTop ? (U = "SCROLLED_DOWN", K = b.state.scrollTop - R) : (U = "SIZE_DECREASED", K = b.state.scrollTop - R || b.scrollTopDelta), {
4621
4621
  atBottom: !0,
4622
4622
  atBottomBecause: U,
4623
4623
  scrollTopDelta: K,
4624
4624
  state: j
4625
4625
  };
4626
4626
  }
4627
- let O;
4628
- return j.scrollHeight > b.state.scrollHeight ? O = "SIZE_INCREASED" : S < b.state.viewportHeight ? O = "VIEWPORT_HEIGHT_DECREASING" : E < b.state.scrollTop ? O = "SCROLLING_UPWARDS" : O = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
4627
+ let M;
4628
+ return j.scrollHeight > b.state.scrollHeight ? M = "SIZE_INCREASED" : S < b.state.viewportHeight ? M = "VIEWPORT_HEIGHT_DECREASING" : R < b.state.scrollTop ? M = "SCROLLING_UPWARDS" : M = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
4629
4629
  atBottom: !1,
4630
- notAtBottomBecause: O,
4630
+ notAtBottomBecause: M,
4631
4631
  state: j
4632
4632
  };
4633
4633
  }, Uv),
@@ -4636,27 +4636,27 @@ const Lr = "up", Nr = "down", zv = "none", Uv = {
4636
4636
  ), x = ft(
4637
4637
  H(
4638
4638
  r,
4639
- Qt(
4640
- (b, { scrollHeight: y, scrollTop: E, viewportHeight: S }) => {
4639
+ en(
4640
+ (b, { scrollHeight: y, scrollTop: R, viewportHeight: S }) => {
4641
4641
  if (pu(b.scrollHeight, y))
4642
4642
  return {
4643
4643
  changed: !1,
4644
4644
  jump: 0,
4645
4645
  scrollHeight: y,
4646
- scrollTop: E
4646
+ scrollTop: R
4647
4647
  };
4648
4648
  {
4649
- const C = y - (E + S) < 1;
4650
- return b.scrollTop !== E && C ? {
4649
+ const C = y - (R + S) < 1;
4650
+ return b.scrollTop !== R && C ? {
4651
4651
  changed: !0,
4652
- jump: b.scrollTop - E,
4652
+ jump: b.scrollTop - R,
4653
4653
  scrollHeight: y,
4654
- scrollTop: E
4654
+ scrollTop: R
4655
4655
  } : {
4656
4656
  changed: !0,
4657
4657
  jump: 0,
4658
4658
  scrollHeight: y,
4659
- scrollTop: E
4659
+ scrollTop: R
4660
4660
  };
4661
4661
  }
4662
4662
  },
@@ -4680,7 +4680,7 @@ const Lr = "up", Nr = "down", zv = "none", Uv = {
4680
4680
  r,
4681
4681
  se(({ scrollTop: b }) => b),
4682
4682
  Ve(),
4683
- Qt(
4683
+ en(
4684
4684
  (b, y) => Ze(w) ? { direction: b.direction, prevScrollTop: y } : { direction: y < b.prevScrollTop ? Lr : Nr, prevScrollTop: y },
4685
4685
  { direction: Nr, prevScrollTop: 0 }
4686
4686
  ),
@@ -4702,7 +4702,7 @@ const Lr = "up", Nr = "down", zv = "none", Uv = {
4702
4702
  un(100),
4703
4703
  Te(m),
4704
4704
  ge(([b, y]) => !!y),
4705
- Qt(([b, y], [E]) => [y, E], [0, 0]),
4705
+ en(([b, y], [R]) => [y, R], [0, 0]),
4706
4706
  se(([b, y]) => y - b)
4707
4707
  ),
4708
4708
  g
@@ -4754,12 +4754,12 @@ const na = Me(
4754
4754
  b,
4755
4755
  y
4756
4756
  ]) => {
4757
- const E = d - b, S = p + g, C = Math.max(m - E, 0);
4758
- let R = Ec;
4757
+ const R = d - b, S = p + g, C = Math.max(m - R, 0);
4758
+ let E = Ec;
4759
4759
  const N = Ic(y, Fo), I = Ic(y, Bo);
4760
- return w -= b, w += m + g, v += m + g, v -= b, w > d + S - N && (R = Lr), v < d - C + h + I && (R = Nr), R !== Ec ? [
4761
- Math.max(E - m - Nc(x, Fo, R) - N, 0),
4762
- E - C - g + h + Nc(x, Bo, R) + I
4760
+ return w -= b, w += m + g, v += m + g, v -= b, w > d + S - N && (E = Lr), v < d - C + h + I && (E = Nr), E !== Ec ? [
4761
+ Math.max(R - m - Nc(x, Fo, E) - N, 0),
4762
+ R - C - g + h + Nc(x, Bo, E) + I
4763
4763
  ] : null;
4764
4764
  }
4765
4765
  ),
@@ -4893,36 +4893,36 @@ const zn = Me(
4893
4893
  me(n),
4894
4894
  e
4895
4895
  ),
4896
- ge(([C, R, , N, , , , , , , I]) => {
4896
+ ge(([C, E, , N, , , , , , , I]) => {
4897
4897
  const j = I && I.length !== N;
4898
- return C && !R && !j;
4898
+ return C && !E && !j;
4899
4899
  }),
4900
4900
  se(
4901
4901
  ([
4902
4902
  ,
4903
4903
  ,
4904
- [C, R],
4904
+ [C, E],
4905
4905
  N,
4906
4906
  I,
4907
4907
  j,
4908
- O,
4908
+ M,
4909
4909
  U,
4910
4910
  K,
4911
4911
  P,
4912
- M
4912
+ O
4913
4913
  ]) => {
4914
- const L = I, { offsetTree: oe, sizeTree: _ } = L, D = Ze(p);
4914
+ const D = I, { offsetTree: ne, sizeTree: _ } = D, L = Ze(p);
4915
4915
  if (N === 0)
4916
4916
  return { ...zs, totalCount: N };
4917
- if (C === 0 && R === 0)
4918
- return D === 0 ? { ...zs, totalCount: N } : mu(D, j, I, K, P, M || []);
4917
+ if (C === 0 && E === 0)
4918
+ return L === 0 ? { ...zs, totalCount: N } : mu(L, j, I, K, P, O || []);
4919
4919
  if (We(_))
4920
- return D > 0 ? null : So(
4921
- Vv(ta(j, N), L, M),
4920
+ return L > 0 ? null : So(
4921
+ Vv(ta(j, N), D, O),
4922
4922
  [],
4923
4923
  N,
4924
4924
  P,
4925
- L,
4925
+ D,
4926
4926
  K
4927
4927
  );
4928
4928
  const Y = [];
@@ -4932,12 +4932,12 @@ const zn = Me(
4932
4932
  for (const A of is(_, pe, he)) {
4933
4933
  const z = A.value, J = Math.max(A.start, pe), ce = Math.min(A.end, he);
4934
4934
  for (let ie = J; ie <= ce; ie++)
4935
- Y.push({ data: M == null ? void 0 : M[ie], index: ie, offset: $, size: z }), $ += z;
4935
+ Y.push({ data: O == null ? void 0 : O[ie], index: ie, offset: $, size: z }), $ += z;
4936
4936
  }
4937
4937
  }
4938
- if (!O)
4939
- return So([], Y, N, P, L, K);
4940
- const V = U.length > 0 ? U[U.length - 1] + 1 : 0, ee = _v(oe, C, R, V);
4938
+ if (!M)
4939
+ return So([], Y, N, P, D, K);
4940
+ const V = U.length > 0 ? U[U.length - 1] + 1 : 0, ee = _v(ne, C, E, V);
4941
4941
  if (ee.length === 0)
4942
4942
  return null;
4943
4943
  const B = N - 1, Z = ss([], (pe) => {
@@ -4952,11 +4952,11 @@ const zn = Me(
4952
4952
  }
4953
4953
  z < V && (A += (V - z) * J, z = V);
4954
4954
  const ce = Math.min(he.end, B);
4955
- for (let ie = z; ie <= ce && !(A >= R); ie++)
4956
- pe.push({ data: M == null ? void 0 : M[ie], index: ie, offset: A, size: J }), A += J + P;
4955
+ for (let ie = z; ie <= ce && !(A >= E); ie++)
4956
+ pe.push({ data: O == null ? void 0 : O[ie], index: ie, offset: A, size: J }), A += J + P;
4957
4957
  }
4958
4958
  });
4959
- return So(Z, Y, N, P, L, K);
4959
+ return So(Z, Y, N, P, D, K);
4960
4960
  }
4961
4961
  ),
4962
4962
  //@ts-expect-error filter needs to be fixed
@@ -4996,16 +4996,16 @@ const zn = Me(
4996
4996
  b,
4997
4997
  ge(({ items: C }) => C.length > 0),
4998
4998
  Te(o, e),
4999
- ge(([{ items: C }, R]) => C[C.length - 1].originalIndex === R - 1),
5000
- se(([, C, R]) => [C - 1, R]),
4999
+ ge(([{ items: C }, E]) => C[C.length - 1].originalIndex === E - 1),
5000
+ se(([, C, E]) => [C - 1, E]),
5001
5001
  Ve(Mr),
5002
5002
  se(([C]) => C)
5003
5003
  )
5004
- ), E = Nt(
5004
+ ), R = Nt(
5005
5005
  H(
5006
5006
  b,
5007
5007
  un(200),
5008
- ge(({ items: C, topItems: R }) => C.length > 0 && C[0].originalIndex === R.length),
5008
+ ge(({ items: C, topItems: E }) => C.length > 0 && C[0].originalIndex === E.length),
5009
5009
  se(({ items: C }) => C[0].index),
5010
5010
  Ve()
5011
5011
  )
@@ -5014,23 +5014,23 @@ const zn = Me(
5014
5014
  b,
5015
5015
  ge(({ items: C }) => C.length > 0),
5016
5016
  se(({ items: C }) => {
5017
- let R = 0, N = C.length - 1;
5018
- for (; C[R].type === "group" && R < N; )
5019
- R++;
5020
- for (; C[N].type === "group" && N > R; )
5017
+ let E = 0, N = C.length - 1;
5018
+ for (; C[E].type === "group" && E < N; )
5019
+ E++;
5020
+ for (; C[N].type === "group" && N > E; )
5021
5021
  N--;
5022
5022
  return {
5023
5023
  endIndex: C[N].index,
5024
- startIndex: C[R].index
5024
+ startIndex: C[E].index
5025
5025
  };
5026
5026
  }),
5027
5027
  Ve(cu)
5028
5028
  )
5029
5029
  );
5030
- return { endReached: y, initialItemCount: p, itemsRendered: g, listState: b, rangeChanged: S, startReached: E, topItemsIndexes: x, ...m };
5030
+ return { endReached: y, initialItemCount: p, itemsRendered: g, listState: b, rangeChanged: S, startReached: R, topItemsIndexes: x, ...m };
5031
5031
  },
5032
5032
  Ge(
5033
- rn,
5033
+ on,
5034
5034
  fu,
5035
5035
  na,
5036
5036
  Xr,
@@ -5090,23 +5090,23 @@ const zn = Me(
5090
5090
  Te(t, l, n, s, o, r, a),
5091
5091
  Te(e),
5092
5092
  se(([[h, m, w, v, x, p, g, b], y]) => {
5093
- const { align: E, behavior: S, calculateViewLocation: C = Kv, done: R, ...N } = h, I = du(h, m, v - 1), j = Dr(I, m.offsetTree, y) + x + p, O = j + zt(m.sizeTree, I)[1], U = b + p, K = b + w - g, P = C({
5094
- itemBottom: O,
5093
+ const { align: R, behavior: S, calculateViewLocation: C = Kv, done: E, ...N } = h, I = du(h, m, v - 1), j = Dr(I, m.offsetTree, y) + x + p, M = j + zt(m.sizeTree, I)[1], U = b + p, K = b + w - g, P = C({
5094
+ itemBottom: M,
5095
5095
  itemTop: j,
5096
- locationParams: { align: E, behavior: S, ...N },
5096
+ locationParams: { align: R, behavior: S, ...N },
5097
5097
  viewportBottom: K,
5098
5098
  viewportTop: U
5099
5099
  });
5100
- return P ? R && $t(
5100
+ return P ? E && $t(
5101
5101
  H(
5102
5102
  i,
5103
- ge((M) => !M),
5103
+ ge((O) => !O),
5104
5104
  // skips the initial publish of false, and the cleanup call.
5105
5105
  // but if scrollingInProgress is true, we skip the initial publish.
5106
5106
  Dn(Ze(i) ? 1 : 2)
5107
5107
  ),
5108
- R
5109
- ) : R && R(), P;
5108
+ E
5109
+ ) : E && E(), P;
5110
5110
  }),
5111
5111
  ge((h) => h !== null)
5112
5112
  ),
@@ -5115,7 +5115,7 @@ const zn = Me(
5115
5115
  scrollIntoView: d
5116
5116
  };
5117
5117
  },
5118
- Ge(rn, gt, qr, zn, Sn),
5118
+ Ge(on, gt, qr, zn, Sn),
5119
5119
  { singleton: !0 }
5120
5120
  );
5121
5121
  function kc(e) {
@@ -5146,9 +5146,9 @@ const Yv = (e, t) => typeof e == "function" ? kc(e(t)) : t && kc(e), qv = Me(
5146
5146
  H(
5147
5147
  nt(H(me(t), Dn(1)), l),
5148
5148
  Te(me(v), s, a, h),
5149
- se(([[S, C], R, N, I, j]) => {
5150
- let O = C && I, U = "auto";
5151
- return O && (U = Yv(R, N || j), O = O && !!U), { followOutputBehavior: U, shouldFollow: O, totalCount: S };
5149
+ se(([[S, C], E, N, I, j]) => {
5150
+ let M = C && I, U = "auto";
5151
+ return M && (U = Yv(E, N || j), M = M && !!U), { followOutputBehavior: U, shouldFollow: M, totalCount: S };
5152
5152
  }),
5153
5153
  ge(({ shouldFollow: S }) => S)
5154
5154
  ),
@@ -5161,8 +5161,8 @@ const Yv = (e, t) => typeof e == "function" ? kc(e(t)) : t && kc(e), qv = Me(
5161
5161
  }
5162
5162
  );
5163
5163
  function b(S) {
5164
- const C = $t(o, (R) => {
5165
- S && !R.atBottom && R.notAtBottomBecause === "SIZE_INCREASED" && !p && (Ze(d)("scrolling to bottom due to increased size", {}, St.DEBUG), g("auto"));
5164
+ const C = $t(o, (E) => {
5165
+ S && !E.atBottom && E.notAtBottomBecause === "SIZE_INCREASED" && !p && (Ze(d)("scrolling to bottom due to increased size", {}, St.DEBUG), g("auto"));
5166
5166
  });
5167
5167
  setTimeout(C, 100);
5168
5168
  }
@@ -5170,7 +5170,7 @@ const Yv = (e, t) => typeof e == "function" ? kc(e(t)) : t && kc(e), qv = Me(
5170
5170
  H(
5171
5171
  nt(me(v), t, u),
5172
5172
  ge(([S, , C]) => S && C),
5173
- Qt(
5173
+ en(
5174
5174
  ({ value: S }, [, C]) => ({ refreshed: S === C, value: C }),
5175
5175
  { refreshed: !1, value: 0 }
5176
5176
  ),
@@ -5185,7 +5185,7 @@ const Yv = (e, t) => typeof e == "function" ? kc(e(t)) : t && kc(e), qv = Me(
5185
5185
  }), Fe(nt(me(v), o), ([S, C]) => {
5186
5186
  S && !C.atBottom && C.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && g("auto");
5187
5187
  });
5188
- const y = X(null), E = ke();
5188
+ const y = X(null), R = ke();
5189
5189
  return ue(
5190
5190
  xi(
5191
5191
  H(
@@ -5197,12 +5197,12 @@ const Yv = (e, t) => typeof e == "function" ? kc(e(t)) : t && kc(e), qv = Me(
5197
5197
  ),
5198
5198
  H(me(t))
5199
5199
  ),
5200
- E
5200
+ R
5201
5201
  ), Fe(
5202
5202
  H(
5203
- nt(H(E, Dn(1)), l),
5203
+ nt(H(R, Dn(1)), l),
5204
5204
  Te(me(y), a, h, m),
5205
- se(([[S, C], R, N, I, j]) => C && N && (R == null ? void 0 : R({ context: j, totalCount: S, scrollingInProgress: I }))),
5205
+ se(([[S, C], E, N, I, j]) => C && N && (E == null ? void 0 : E({ context: j, totalCount: S, scrollingInProgress: I }))),
5206
5206
  ge((S) => !!S),
5207
5207
  un(0)
5208
5208
  ),
@@ -5216,7 +5216,7 @@ const Yv = (e, t) => typeof e == "function" ? kc(e(t)) : t && kc(e), qv = Me(
5216
5216
  ), { autoscrollToBottom: x, followOutput: v, scrollIntoViewOnChange: y };
5217
5217
  },
5218
5218
  Ge(
5219
- rn,
5219
+ on,
5220
5220
  Jr,
5221
5221
  qr,
5222
5222
  Xr,
@@ -5237,7 +5237,7 @@ const Yv = (e, t) => typeof e == "function" ? kc(e(t)) : t && kc(e), qv = Me(
5237
5237
  ),
5238
5238
  i
5239
5239
  ), {}),
5240
- Ge(rn, Xr, zn, Cn),
5240
+ Ge(on, Xr, zn, Cn),
5241
5241
  { singleton: !0 }
5242
5242
  ), Jv = Me(
5243
5243
  ([{ didMount: e }, { scrollTo: t }, { listState: n }]) => {
@@ -5345,8 +5345,8 @@ const Yv = (e, t) => typeof e == "function" ? kc(e(t)) : t && kc(e), qv = Me(
5345
5345
  Te(t, r, i, h, m, n)
5346
5346
  ),
5347
5347
  ([w, v, x, p, g, b, y]) => {
5348
- const E = Mv(v.sizeTree);
5349
- p && g !== null && b !== null && (x = g.scrollTop - b.offsetTop), x -= y, w({ ranges: E, scrollTop: x });
5348
+ const R = Mv(v.sizeTree);
5349
+ p && g !== null && b !== null && (x = g.scrollTop - b.offsetTop), x -= y, w({ ranges: R, scrollTop: x });
5350
5350
  }
5351
5351
  ), ue(H(d, ge(qi), se(Qv)), o), ue(
5352
5352
  H(
@@ -5362,7 +5362,7 @@ const Yv = (e, t) => typeof e == "function" ? kc(e(t)) : t && kc(e), qv = Me(
5362
5362
  restoreStateFrom: d
5363
5363
  };
5364
5364
  },
5365
- Ge(rn, gt, Xr, Cn, ra)
5365
+ Ge(on, gt, Xr, Cn, ra)
5366
5366
  );
5367
5367
  function Qv(e) {
5368
5368
  return { align: "start", index: 0, offset: e.scrollTop };
@@ -5395,17 +5395,17 @@ const tx = wu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5395
5395
  H(
5396
5396
  l,
5397
5397
  Te(i),
5398
- Qt(
5399
- ([, g, b, y], [{ bottom: E, items: S, offsetBottom: C, totalCount: R }, N]) => {
5400
- const I = E + C;
5398
+ en(
5399
+ ([, g, b, y], [{ bottom: R, items: S, offsetBottom: C, totalCount: E }, N]) => {
5400
+ const I = R + C;
5401
5401
  let j = 0;
5402
- return b === R && g.length > 0 && S.length > 0 && (S[0].originalIndex === 0 && g[0].originalIndex === 0 || (j = I - y, j !== 0 && (j += N))), [j, S, R, I];
5402
+ return b === E && g.length > 0 && S.length > 0 && (S[0].originalIndex === 0 && g[0].originalIndex === 0 || (j = I - y, j !== 0 && (j += N))), [j, S, E, I];
5403
5403
  },
5404
5404
  [0, [], 0, 0]
5405
5405
  ),
5406
5406
  ge(([g]) => g !== 0),
5407
5407
  Te(r, a, n, o, w, v),
5408
- ge(([, g, b, y, , , E]) => !E && !y && g !== 0 && b === Lr),
5408
+ ge(([, g, b, y, , , R]) => !R && !y && g !== 0 && b === Lr),
5409
5409
  se(([[g], , , , , b]) => (b("Upward scrolling compensation", { amount: g }, St.DEBUG), g))
5410
5410
  )
5411
5411
  );
@@ -5432,22 +5432,22 @@ const tx = wu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5432
5432
  H(
5433
5433
  u,
5434
5434
  Te(m, d),
5435
- se(([g, { groupIndices: b, lastSize: y, sizeTree: E }, S]) => {
5436
- function C(R) {
5437
- return R * (y + S);
5435
+ se(([g, { groupIndices: b, lastSize: y, sizeTree: R }, S]) => {
5436
+ function C(E) {
5437
+ return E * (y + S);
5438
5438
  }
5439
5439
  if (b.length === 0)
5440
5440
  return C(g);
5441
5441
  {
5442
- let R = 0;
5443
- const N = Or(E, 0);
5442
+ let E = 0;
5443
+ const N = Or(R, 0);
5444
5444
  let I = 0, j = 0;
5445
5445
  for (; I < g; ) {
5446
- I++, R += N;
5447
- let O = b.length === j + 1 ? 1 / 0 : b[j + 1] - b[j] - 1;
5448
- I + O > g && (R -= N, O = g - I + 1), I += O, R += C(O), j++;
5446
+ I++, E += N;
5447
+ let M = b.length === j + 1 ? 1 / 0 : b[j + 1] - b[j] - 1;
5448
+ I + M > g && (E -= N, M = g - I + 1), I += M, E += C(M), j++;
5449
5449
  }
5450
- return R;
5450
+ return E;
5451
5451
  }
5452
5452
  })
5453
5453
  ),
@@ -5460,7 +5460,7 @@ const tx = wu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5460
5460
  }
5461
5461
  ), { deviation: e };
5462
5462
  },
5463
- Ge(gt, Jr, zn, rn, Sn, Zi)
5463
+ Ge(gt, Jr, zn, on, Sn, Zi)
5464
5464
  ), rx = Me(
5465
5465
  ([
5466
5466
  e,
@@ -5520,13 +5520,13 @@ const tx = wu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5520
5520
  x,
5521
5521
  p,
5522
5522
  g,
5523
- { listState: b, topItemsIndexes: y, ...E },
5523
+ { listState: b, topItemsIndexes: y, ...R },
5524
5524
  { scrollToIndex: S },
5525
5525
  C,
5526
- { topItemCount: R },
5526
+ { topItemCount: E },
5527
5527
  { groupCounts: N },
5528
5528
  I
5529
- ]) => (ue(E.rangeChanged, I.scrollSeekRangeChanged), ue(
5529
+ ]) => (ue(R.rangeChanged, I.scrollSeekRangeChanged), ue(
5530
5530
  H(
5531
5531
  I.windowViewportRect,
5532
5532
  se((j) => j.visibleHeight)
@@ -5543,7 +5543,7 @@ const tx = wu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5543
5543
  initialTopMostItemIndex: w,
5544
5544
  scrolledToInitialItem: v,
5545
5545
  sizeRanges: a,
5546
- topItemCount: R,
5546
+ topItemCount: E,
5547
5547
  topItemsIndexes: y,
5548
5548
  // input
5549
5549
  totalCount: d,
@@ -5556,7 +5556,7 @@ const tx = wu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5556
5556
  statefulTotalCount: u,
5557
5557
  trackItemSizes: h,
5558
5558
  // exported from stateFlagsSystem
5559
- ...E,
5559
+ ...R,
5560
5560
  // the bag of IO from featureGroup1System
5561
5561
  ...I,
5562
5562
  ...x,
@@ -5564,7 +5564,7 @@ const tx = wu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5564
5564
  ...p
5565
5565
  }),
5566
5566
  Ge(
5567
- rn,
5567
+ on,
5568
5568
  Xr,
5569
5569
  gt,
5570
5570
  Zv,
@@ -5605,28 +5605,28 @@ function Su(e, t, n) {
5605
5605
  }
5606
5606
  function u(p) {
5607
5607
  return s.reduce((g, b) => (g[b] = (y) => {
5608
- const E = p[t.methods[b]];
5609
- ye(E, y);
5608
+ const R = p[t.methods[b]];
5609
+ ye(R, y);
5610
5610
  }, g), {});
5611
5611
  }
5612
5612
  function d(p) {
5613
5613
  return i.reduce((g, b) => (g[b] = wv(p[t.events[b]]), g), {});
5614
5614
  }
5615
5615
  const h = q.forwardRef((p, g) => {
5616
- const { children: b, ...y } = p, [E] = q.useState(() => ss(Sv(e), (R) => {
5617
- l(R, y);
5618
- })), [S] = q.useState(yc(d, E));
5616
+ const { children: b, ...y } = p, [R] = q.useState(() => ss(Sv(e), (E) => {
5617
+ l(E, y);
5618
+ })), [S] = q.useState(yc(d, R));
5619
5619
  io(() => {
5620
- for (const R of i)
5621
- R in y && Fe(S[R], y[R]);
5620
+ for (const E of i)
5621
+ E in y && Fe(S[E], y[E]);
5622
5622
  return () => {
5623
5623
  Object.values(S).map(Xi);
5624
5624
  };
5625
- }, [y, S, E]), io(() => {
5626
- l(E, y);
5627
- }), q.useImperativeHandle(g, wc(u(E)));
5625
+ }, [y, S, R]), io(() => {
5626
+ l(R, y);
5627
+ }), q.useImperativeHandle(g, wc(u(R)));
5628
5628
  const C = n;
5629
- return /* @__PURE__ */ c.jsx(a.Provider, { value: E, children: n ? /* @__PURE__ */ c.jsx(C, { ...ox([...r, ...o, ...i], y), children: b }) : b });
5629
+ return /* @__PURE__ */ c.jsx(a.Provider, { value: R, children: n ? /* @__PURE__ */ c.jsx(C, { ...ox([...r, ...o, ...i], y), children: b }) : b });
5630
5630
  }), m = (p) => {
5631
5631
  const g = q.useContext(a);
5632
5632
  return q.useCallback(
@@ -5648,8 +5648,8 @@ function Su(e, t, n) {
5648
5648
  }, v = (p) => {
5649
5649
  const g = q.useContext(a)[p], [b, y] = q.useState(yc(Ze, g));
5650
5650
  return io(
5651
- () => Fe(g, (E) => {
5652
- E !== b && y(wc(E));
5651
+ () => Fe(g, (R) => {
5652
+ R !== b && y(wc(R));
5653
5653
  }),
5654
5654
  [g, b]
5655
5655
  ), b;
@@ -5775,17 +5775,17 @@ const ix = /* @__PURE__ */ Me(() => {
5775
5775
  ia("deviation", (P) => {
5776
5776
  g !== P && b(P);
5777
5777
  });
5778
- const y = be("EmptyPlaceholder"), E = be("ScrollSeekPlaceholder") || cx, S = be("ListComponent"), C = be("ItemComponent"), R = be("GroupComponent"), N = be("computeItemKey"), I = be("isSeeking"), j = be("groupIndices").length > 0, O = be("alignToBottom"), U = be("initialItemFinalLocationReached"), K = e ? {} : {
5778
+ const y = be("EmptyPlaceholder"), R = be("ScrollSeekPlaceholder") || cx, S = be("ListComponent"), C = be("ItemComponent"), E = be("GroupComponent"), N = be("computeItemKey"), I = be("isSeeking"), j = be("groupIndices").length > 0, M = be("alignToBottom"), U = be("initialItemFinalLocationReached"), K = e ? {} : {
5779
5779
  boxSizing: "border-box",
5780
5780
  ...x ? {
5781
5781
  display: "inline-block",
5782
5782
  height: "100%",
5783
- marginLeft: g !== 0 ? g : O ? "auto" : 0,
5783
+ marginLeft: g !== 0 ? g : M ? "auto" : 0,
5784
5784
  paddingLeft: t.offsetTop,
5785
5785
  paddingRight: t.offsetBottom,
5786
5786
  whiteSpace: "nowrap"
5787
5787
  } : {
5788
- marginTop: g !== 0 ? g : O ? "auto" : 0,
5788
+ marginTop: g !== 0 ? g : M ? "auto" : 0,
5789
5789
  paddingBottom: t.offsetBottom,
5790
5790
  paddingTop: t.offsetTop
5791
5791
  },
@@ -5799,25 +5799,25 @@ const ix = /* @__PURE__ */ Me(() => {
5799
5799
  ref: p,
5800
5800
  style: K,
5801
5801
  children: (e ? t.topItems : t.items).map((P) => {
5802
- const M = P.originalIndex, L = N(M + t.firstItemIndex, P.data, u);
5802
+ const O = P.originalIndex, D = N(O + t.firstItemIndex, P.data, u);
5803
5803
  return I ? /* @__PURE__ */ go(
5804
- E,
5804
+ R,
5805
5805
  {
5806
- ...dt(E, u),
5806
+ ...dt(R, u),
5807
5807
  height: P.size,
5808
5808
  index: P.index,
5809
- key: L,
5809
+ key: D,
5810
5810
  type: P.type || "item",
5811
5811
  ...P.type === "group" ? {} : { groupIndex: P.groupIndex }
5812
5812
  }
5813
5813
  ) : P.type === "group" ? /* @__PURE__ */ go(
5814
- R,
5814
+ E,
5815
5815
  {
5816
- ...dt(R, u),
5817
- "data-index": M,
5816
+ ...dt(E, u),
5817
+ "data-index": O,
5818
5818
  "data-item-index": P.index,
5819
5819
  "data-known-size": P.size,
5820
- key: L,
5820
+ key: D,
5821
5821
  style: lx
5822
5822
  },
5823
5823
  d(P.index, u)
@@ -5826,11 +5826,11 @@ const ix = /* @__PURE__ */ Me(() => {
5826
5826
  {
5827
5827
  ...dt(C, u),
5828
5828
  ...px(C, P.data),
5829
- "data-index": M,
5829
+ "data-index": O,
5830
5830
  "data-item-group-index": P.groupIndex,
5831
5831
  "data-item-index": P.index,
5832
5832
  "data-known-size": P.size,
5833
- key: L,
5833
+ key: D,
5834
5834
  style: x ? ux : Nu
5835
5835
  },
5836
5836
  j ? l(P.index, P.groupIndex, P.data, u) : l(P.index, P.data, u)
@@ -6115,14 +6115,14 @@ const jx = /* @__PURE__ */ Me(
6115
6115
  m,
6116
6116
  w,
6117
6117
  { didMount: v, propsReady: x },
6118
- { customScrollParent: p, useWindowScroll: g, windowScrollContainerState: b, windowScrollTo: y, windowViewportRect: E },
6118
+ { customScrollParent: p, useWindowScroll: g, windowScrollContainerState: b, windowScrollTo: y, windowViewportRect: R },
6119
6119
  S
6120
6120
  ]) => {
6121
- const C = X(0), R = X(0), N = X(_c), I = X({ height: 0, width: 0 }), j = X({ height: 0, width: 0 }), O = ke(), U = ke(), K = X(0), P = X(null), M = X({ column: 0, row: 0 }), L = ke(), oe = ke(), _ = X(!1), D = X(0), Y = X(!0), V = X(!1), ee = X(!1);
6121
+ const C = X(0), E = X(0), N = X(_c), I = X({ height: 0, width: 0 }), j = X({ height: 0, width: 0 }), M = ke(), U = ke(), K = X(0), P = X(null), O = X({ column: 0, row: 0 }), D = ke(), ne = ke(), _ = X(!1), L = X(0), Y = X(!0), V = X(!1), ee = X(!1);
6122
6122
  Fe(
6123
6123
  H(
6124
6124
  v,
6125
- Te(D),
6125
+ Te(L),
6126
6126
  ge(([A, z]) => !!z)
6127
6127
  ),
6128
6128
  () => {
@@ -6130,31 +6130,31 @@ const jx = /* @__PURE__ */ Me(
6130
6130
  }
6131
6131
  ), Fe(
6132
6132
  H(
6133
- nt(v, Y, j, I, D, V),
6133
+ nt(v, Y, j, I, L, V),
6134
6134
  ge(([A, z, J, ce, , ie]) => A && !z && J.height !== 0 && ce.height !== 0 && !ie)
6135
6135
  ),
6136
6136
  ([, , , , A]) => {
6137
6137
  ye(V, !0), ea(1, () => {
6138
- ye(O, A);
6138
+ ye(M, A);
6139
6139
  }), $t(H(u), () => {
6140
6140
  ye(t, [0, 0]), ye(Y, !0);
6141
6141
  });
6142
6142
  }
6143
6143
  ), ue(
6144
6144
  H(
6145
- oe,
6145
+ ne,
6146
6146
  ge((A) => A != null && A.scrollTop > 0),
6147
6147
  Jt(0)
6148
6148
  ),
6149
- R
6149
+ E
6150
6150
  ), Fe(
6151
6151
  H(
6152
6152
  v,
6153
- Te(oe),
6153
+ Te(ne),
6154
6154
  ge(([, A]) => A != null)
6155
6155
  ),
6156
6156
  ([, A]) => {
6157
- A && (ye(I, A.viewport), ye(j, A.item), ye(M, A.gap), A.scrollTop > 0 && (ye(_, !0), $t(H(u, Dn(1)), (z) => {
6157
+ A && (ye(I, A.viewport), ye(j, A.item), ye(O, A.gap), A.scrollTop > 0 && (ye(_, !0), $t(H(u, Dn(1)), (z) => {
6158
6158
  ye(_, !1);
6159
6159
  }), ye(l, { top: A.scrollTop })));
6160
6160
  }
@@ -6169,7 +6169,7 @@ const jx = /* @__PURE__ */ Me(
6169
6169
  nt(
6170
6170
  me(I, ao),
6171
6171
  me(j, ao),
6172
- me(M, (A, z) => A && A.column === z.column && A.row === z.row),
6172
+ me(O, (A, z) => A && A.column === z.column && A.row === z.row),
6173
6173
  me(u)
6174
6174
  ),
6175
6175
  se(([A, z, J, ce]) => ({
@@ -6179,20 +6179,20 @@ const jx = /* @__PURE__ */ Me(
6179
6179
  viewport: A
6180
6180
  }))
6181
6181
  ),
6182
- L
6182
+ D
6183
6183
  ), ue(
6184
6184
  H(
6185
6185
  nt(
6186
6186
  me(C),
6187
6187
  r,
6188
- me(M, Ix),
6188
+ me(O, Ix),
6189
6189
  me(j, ao),
6190
6190
  me(I, ao),
6191
6191
  me(P),
6192
- me(R),
6192
+ me(E),
6193
6193
  me(_),
6194
6194
  me(Y),
6195
- me(D)
6195
+ me(L)
6196
6196
  ),
6197
6197
  ge(([, , , , , , , A]) => !A),
6198
6198
  se(
@@ -6218,8 +6218,8 @@ const jx = /* @__PURE__ */ Me(
6218
6218
  const et = ku(ot, Be, Se);
6219
6219
  let xt, it;
6220
6220
  ae ? z === 0 && J === 0 && je > 0 ? (xt = 0, it = je - 1) : (xt = et * $o((z + fe) / (Ce + fe)), it = et * Oc((J + fe) / (Ce + fe)) - 1, it = Vs(A - 1, Ir(it, et - 1)), xt = Vs(it, Ir(0, xt))) : (xt = 0, it = -1);
6221
- const an = Dc(xt, it, _e), { bottom: G, top: ne } = Lc(Ae, ce, ie, an), $e = Oc(A / et), Xe = $e * Ce + ($e - 1) * fe - G;
6222
- return { bottom: G, itemHeight: Ce, items: an, itemWidth: Be, offsetBottom: Xe, offsetTop: ne, top: ne };
6221
+ const cn = Dc(xt, it, _e), { bottom: G, top: re } = Lc(Ae, ce, ie, cn), $e = Oc(A / et), Xe = $e * Ce + ($e - 1) * fe - G;
6222
+ return { bottom: G, itemHeight: Ce, items: cn, itemWidth: Be, offsetBottom: Xe, offsetTop: re, top: re };
6223
6223
  }
6224
6224
  )
6225
6225
  ),
@@ -6233,7 +6233,7 @@ const jx = /* @__PURE__ */ Me(
6233
6233
  C
6234
6234
  ), ue(
6235
6235
  H(
6236
- nt(I, j, N, M),
6236
+ nt(I, j, N, O),
6237
6237
  ge(([A, z, { items: J }]) => J.length > 0 && z.height !== 0 && A.height !== 0),
6238
6238
  se(([A, z, { items: J }, ce]) => {
6239
6239
  const { bottom: ie, top: Ae } = Lc(A, ce, z, J);
@@ -6286,8 +6286,8 @@ const jx = /* @__PURE__ */ Me(
6286
6286
  );
6287
6287
  ue(he, w.scrollSeekRangeChanged), ue(
6288
6288
  H(
6289
- O,
6290
- Te(I, j, C, M),
6289
+ M,
6290
+ Te(I, j, C, O),
6291
6291
  se(([A, z, J, ce, ie]) => {
6292
6292
  const Ae = hu(A), { align: _e, behavior: je, offset: ae } = Ae;
6293
6293
  let Ne = Ae.index;
@@ -6307,7 +6307,7 @@ const jx = /* @__PURE__ */ Me(
6307
6307
  );
6308
6308
  return ue(
6309
6309
  H(
6310
- E,
6310
+ R,
6311
6311
  se((A) => ({ height: A.visibleHeight, width: A.visibleWidth }))
6312
6312
  ),
6313
6313
  I
@@ -6317,18 +6317,18 @@ const jx = /* @__PURE__ */ Me(
6317
6317
  data: P,
6318
6318
  deviation: K,
6319
6319
  footerHeight: o,
6320
- gap: M,
6320
+ gap: O,
6321
6321
  headerHeight: s,
6322
6322
  increaseViewportBy: e,
6323
- initialItemCount: R,
6323
+ initialItemCount: E,
6324
6324
  itemDimensions: j,
6325
6325
  overscan: n,
6326
- restoreStateFrom: oe,
6326
+ restoreStateFrom: ne,
6327
6327
  scrollBy: i,
6328
6328
  scrollContainerState: a,
6329
6329
  scrollHeight: U,
6330
6330
  scrollTo: l,
6331
- scrollToIndex: O,
6331
+ scrollToIndex: M,
6332
6332
  scrollTop: u,
6333
6333
  smoothScrollTargetReached: d,
6334
6334
  totalCount: C,
@@ -6336,19 +6336,19 @@ const jx = /* @__PURE__ */ Me(
6336
6336
  viewportDimensions: I,
6337
6337
  windowScrollContainerState: b,
6338
6338
  windowScrollTo: y,
6339
- windowViewportRect: E,
6339
+ windowViewportRect: R,
6340
6340
  ...w,
6341
6341
  // output
6342
6342
  gridState: N,
6343
6343
  horizontalDirection: ee,
6344
- initialTopMostItemIndex: D,
6344
+ initialTopMostItemIndex: L,
6345
6345
  totalListHeight: $,
6346
6346
  ...m,
6347
6347
  endReached: Z,
6348
6348
  propsReady: x,
6349
6349
  rangeChanged: he,
6350
6350
  startReached: pe,
6351
- stateChanged: L,
6351
+ stateChanged: D,
6352
6352
  stateRestoreInProgress: _,
6353
6353
  ...S
6354
6354
  };
@@ -6407,8 +6407,8 @@ const kx = /* @__PURE__ */ Me(() => {
6407
6407
  i(b);
6408
6408
  const y = g.firstChild;
6409
6409
  if (y) {
6410
- const { height: E, width: S } = y.getBoundingClientRect();
6411
- h({ height: E, width: S });
6410
+ const { height: R, width: S } = y.getBoundingClientRect();
6411
+ h({ height: R, width: S });
6412
6412
  }
6413
6413
  m({
6414
6414
  column: Fc("column-gap", getComputedStyle(g).columnGap, w),
@@ -7117,11 +7117,11 @@ function Ks({
7117
7117
  const j = I.data;
7118
7118
  if (!j || j.id !== b || j.key && j.key !== l || !p) return;
7119
7119
  g = !0;
7120
- const O = j.html ?? "";
7121
- Sr.set(l, { html: O, source: a }), d(O);
7120
+ const M = j.html ?? "";
7121
+ Sr.set(l, { html: M, source: a }), d(M);
7122
7122
  };
7123
7123
  gn.addEventListener("message", y);
7124
- const E = () => {
7124
+ const R = () => {
7125
7125
  try {
7126
7126
  gn.postMessage({ id: b, key: l, source: a });
7127
7127
  } catch (I) {
@@ -7129,28 +7129,28 @@ function Ks({
7129
7129
  }
7130
7130
  }, S = () => {
7131
7131
  if (!r || s <= 0) {
7132
- E();
7132
+ R();
7133
7133
  return;
7134
7134
  }
7135
7135
  if (typeof window > "u") {
7136
- E();
7136
+ R();
7137
7137
  return;
7138
7138
  }
7139
7139
  const I = window.setTimeout(() => {
7140
7140
  if (typeof window.requestAnimationFrame == "function") {
7141
7141
  const j = window.requestAnimationFrame(() => {
7142
- E();
7142
+ R();
7143
7143
  });
7144
7144
  m.current.push({ type: "raf", id: j });
7145
7145
  } else
7146
- E();
7146
+ R();
7147
7147
  }, s);
7148
7148
  m.current.push({ type: "timeout", id: I });
7149
7149
  };
7150
7150
  Tr ? S() : kr.push(S);
7151
- const R = ((I, j, O) => j ? O ? I > 2e4 ? 15e3 : I > 8e3 ? 8e3 : I > 2e3 ? 3e3 : 1e3 : I > 2e4 ? 1e4 : I > 8e3 ? 5e3 : I > 2e3 ? 2e3 : 600 : Math.min(15e3, 2e3 + Math.floor(I * 0.5)))(a.length, Tr, r), N = window.setTimeout(async () => {
7151
+ const E = ((I, j, M) => j ? M ? I > 2e4 ? 15e3 : I > 8e3 ? 8e3 : I > 2e3 ? 3e3 : 1e3 : I > 2e4 ? 1e4 : I > 8e3 ? 5e3 : I > 2e3 ? 2e3 : 600 : Math.min(15e3, 2e3 + Math.floor(I * 0.5)))(a.length, Tr, r), N = window.setTimeout(async () => {
7152
7152
  if (!g) {
7153
- console.warn("[MarkdownContent] worker timeout (ms=" + R + "), falling back to main-thread parse for", l);
7153
+ console.warn("[MarkdownContent] worker timeout (ms=" + E + "), falling back to main-thread parse for", l);
7154
7154
  try {
7155
7155
  const I = await zc(a);
7156
7156
  Sr.set(l, { html: I, source: a }), p && h.current === b && d(I);
@@ -7158,7 +7158,7 @@ function Ks({
7158
7158
  console.error("[MarkdownContent] fallback parse failed", I);
7159
7159
  }
7160
7160
  }
7161
- }, R);
7161
+ }, E);
7162
7162
  return () => {
7163
7163
  if (p = !1, clearTimeout(N), gn.removeEventListener("message", y), h.current === b && (h.current = null), !Tr) {
7164
7164
  const I = kr.indexOf(S);
@@ -7177,10 +7177,10 @@ function Ks({
7177
7177
  const x = Array.from(v.querySelectorAll("pre code"));
7178
7178
  if (!x.length) return;
7179
7179
  let p = null, g = !1;
7180
- const b = (E, S) => {
7181
- for (const C of E) {
7180
+ const b = (R, S) => {
7181
+ for (const C of R) {
7182
7182
  if (!C.isIntersecting) continue;
7183
- const R = C.target;
7183
+ const E = C.target;
7184
7184
  if (!p)
7185
7185
  import("./index-BixObhJB.js").then((N) => {
7186
7186
  if (g) return;
@@ -7198,13 +7198,13 @@ function Ks({
7198
7198
  });
7199
7199
  else
7200
7200
  try {
7201
- p.highlightElement(R);
7201
+ p.highlightElement(E);
7202
7202
  } catch {
7203
7203
  }
7204
- S.unobserve(R);
7204
+ S.unobserve(E);
7205
7205
  }
7206
7206
  }, y = new IntersectionObserver(b, { root: v, threshold: 0.1 });
7207
- return x.forEach((E) => y.observe(E)), () => {
7207
+ return x.forEach((R) => y.observe(R)), () => {
7208
7208
  g = !0, y.disconnect();
7209
7209
  };
7210
7210
  }, [u]), u ? /* @__PURE__ */ c.jsx("div", { ref: w, className: F("markdown prose max-w-none break-words dark:prose-invert", t), dangerouslySetInnerHTML: { __html: u } }) : r && o ? null : /* @__PURE__ */ c.jsx("div", { className: F("markdown prose max-w-none break-words dark:prose-invert", t), children: n });
@@ -7359,15 +7359,15 @@ var bb = "DismissableLayer", Ri = "dismissableLayer.update", wb = "dismissableLa
7359
7359
  onInteractOutside: i,
7360
7360
  onDismiss: a,
7361
7361
  ...l
7362
- } = e, u = f.useContext($u), [d, h] = f.useState(null), m = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, w] = f.useState({}), v = Ee(t, (R) => h(R)), x = Array.from(u.layers), [p] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), g = x.indexOf(p), b = d ? x.indexOf(d) : -1, y = u.layersWithOutsidePointerEventsDisabled.size > 0, E = b >= g, S = Tb((R) => {
7363
- const N = R.target, I = [...u.branches].some((j) => j.contains(N));
7364
- !E || I || (o == null || o(R), i == null || i(R), R.defaultPrevented || a == null || a());
7365
- }, m), C = Rb((R) => {
7366
- const N = R.target;
7367
- [...u.branches].some((j) => j.contains(N)) || (s == null || s(R), i == null || i(R), R.defaultPrevented || a == null || a());
7362
+ } = e, u = f.useContext($u), [d, h] = f.useState(null), m = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, w] = f.useState({}), v = Ee(t, (E) => h(E)), x = Array.from(u.layers), [p] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), g = x.indexOf(p), b = d ? x.indexOf(d) : -1, y = u.layersWithOutsidePointerEventsDisabled.size > 0, R = b >= g, S = Tb((E) => {
7363
+ const N = E.target, I = [...u.branches].some((j) => j.contains(N));
7364
+ !R || I || (o == null || o(E), i == null || i(E), E.defaultPrevented || a == null || a());
7365
+ }, m), C = Rb((E) => {
7366
+ const N = E.target;
7367
+ [...u.branches].some((j) => j.contains(N)) || (s == null || s(E), i == null || i(E), E.defaultPrevented || a == null || a());
7368
7368
  }, m);
7369
- return xb((R) => {
7370
- b === u.layers.size - 1 && (r == null || r(R), !R.defaultPrevented && a && (R.preventDefault(), a()));
7369
+ return xb((E) => {
7370
+ b === u.layers.size - 1 && (r == null || r(E), !E.defaultPrevented && a && (E.preventDefault(), a()));
7371
7371
  }, m), f.useEffect(() => {
7372
7372
  if (d)
7373
7373
  return n && (u.layersWithOutsidePointerEventsDisabled.size === 0 && (Gc = m.body.style.pointerEvents, m.body.style.pointerEvents = "none"), u.layersWithOutsidePointerEventsDisabled.add(d)), u.layers.add(d), Kc(), () => {
@@ -7376,15 +7376,15 @@ var bb = "DismissableLayer", Ri = "dismissableLayer.update", wb = "dismissableLa
7376
7376
  }, [d, m, n, u]), f.useEffect(() => () => {
7377
7377
  d && (u.layers.delete(d), u.layersWithOutsidePointerEventsDisabled.delete(d), Kc());
7378
7378
  }, [d, u]), f.useEffect(() => {
7379
- const R = () => w({});
7380
- return document.addEventListener(Ri, R), () => document.removeEventListener(Ri, R);
7379
+ const E = () => w({});
7380
+ return document.addEventListener(Ri, E), () => document.removeEventListener(Ri, E);
7381
7381
  }, []), /* @__PURE__ */ c.jsx(
7382
7382
  ve.div,
7383
7383
  {
7384
7384
  ...l,
7385
7385
  ref: v,
7386
7386
  style: {
7387
- pointerEvents: y ? E ? "auto" : "none" : void 0,
7387
+ pointerEvents: y ? R ? "auto" : "none" : void 0,
7388
7388
  ...e.style
7389
7389
  },
7390
7390
  onFocusCapture: Q(e.onFocusCapture, C.onFocusCapture),
@@ -7481,12 +7481,12 @@ var Xs = "focusScope.autoFocusOnMount", Js = "focusScope.autoFocusOnUnmount", Yc
7481
7481
  if (r) {
7482
7482
  let x = function(y) {
7483
7483
  if (w.paused || !a) return;
7484
- const E = y.target;
7485
- a.contains(E) ? h.current = E : pn(h.current, { select: !0 });
7484
+ const R = y.target;
7485
+ a.contains(R) ? h.current = R : pn(h.current, { select: !0 });
7486
7486
  }, p = function(y) {
7487
7487
  if (w.paused || !a) return;
7488
- const E = y.relatedTarget;
7489
- E !== null && (a.contains(E) || pn(h.current, { select: !0 }));
7488
+ const R = y.relatedTarget;
7489
+ R !== null && (a.contains(R) || pn(h.current, { select: !0 }));
7490
7490
  }, g = function(y) {
7491
7491
  if (document.activeElement === document.body)
7492
7492
  for (const S of y)
@@ -7519,8 +7519,8 @@ var Xs = "focusScope.autoFocusOnMount", Js = "focusScope.autoFocusOnUnmount", Yc
7519
7519
  if (!n && !r || w.paused) return;
7520
7520
  const p = x.key === "Tab" && !x.altKey && !x.ctrlKey && !x.metaKey, g = document.activeElement;
7521
7521
  if (p && g) {
7522
- const b = x.currentTarget, [y, E] = Ib(b);
7523
- y && E ? !x.shiftKey && g === E ? (x.preventDefault(), n && pn(y, { select: !0 })) : x.shiftKey && g === y && (x.preventDefault(), n && pn(E, { select: !0 })) : g === b && x.preventDefault();
7522
+ const b = x.currentTarget, [y, R] = Ib(b);
7523
+ y && R ? !x.shiftKey && g === R ? (x.preventDefault(), n && pn(y, { select: !0 })) : x.shiftKey && g === y && (x.preventDefault(), n && pn(R, { select: !0 })) : g === b && x.preventDefault();
7524
7524
  }
7525
7525
  },
7526
7526
  [n, r, w.paused]
@@ -7611,14 +7611,14 @@ function Zc() {
7611
7611
  const e = document.createElement("span");
7612
7612
  return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
7613
7613
  }
7614
- var Zt = function() {
7615
- return Zt = Object.assign || function(t) {
7614
+ var Qt = function() {
7615
+ return Qt = Object.assign || function(t) {
7616
7616
  for (var n, r = 1, o = arguments.length; r < o; r++) {
7617
7617
  n = arguments[r];
7618
7618
  for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (t[s] = n[s]);
7619
7619
  }
7620
7620
  return t;
7621
- }, Zt.apply(this, arguments);
7621
+ }, Qt.apply(this, arguments);
7622
7622
  };
7623
7623
  function Uu(e, t) {
7624
7624
  var n = {};
@@ -7739,7 +7739,7 @@ function Hb(e, t) {
7739
7739
  function zb(e) {
7740
7740
  e === void 0 && (e = {});
7741
7741
  var t = Hb(null);
7742
- return t.options = Zt({ async: !0, ssr: !1 }, e), t;
7742
+ return t.options = Qt({ async: !0, ssr: !1 }, e), t;
7743
7743
  }
7744
7744
  var Wu = function(e) {
7745
7745
  var t = e.sideCar, n = Uu(e, ["sideCar"]);
@@ -7748,7 +7748,7 @@ var Wu = function(e) {
7748
7748
  var r = t.read();
7749
7749
  if (!r)
7750
7750
  throw new Error("Sidecar medium not found");
7751
- return f.createElement(r, Zt({}, n));
7751
+ return f.createElement(r, Qt({}, n));
7752
7752
  };
7753
7753
  Wu.isSideCarExport = !0;
7754
7754
  function Ub(e, t) {
@@ -7760,12 +7760,12 @@ var Vu = zb(), ei = function() {
7760
7760
  onScrollCapture: ei,
7761
7761
  onWheelCapture: ei,
7762
7762
  onTouchMoveCapture: ei
7763
- }), o = r[0], s = r[1], i = e.forwardProps, a = e.children, l = e.className, u = e.removeScrollBar, d = e.enabled, h = e.shards, m = e.sideCar, w = e.noRelative, v = e.noIsolation, x = e.inert, p = e.allowPinchZoom, g = e.as, b = g === void 0 ? "div" : g, y = e.gapMode, E = Uu(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), S = m, C = Bb([n, t]), R = Zt(Zt({}, E), o);
7763
+ }), o = r[0], s = r[1], i = e.forwardProps, a = e.children, l = e.className, u = e.removeScrollBar, d = e.enabled, h = e.shards, m = e.sideCar, w = e.noRelative, v = e.noIsolation, x = e.inert, p = e.allowPinchZoom, g = e.as, b = g === void 0 ? "div" : g, y = e.gapMode, R = Uu(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), S = m, C = Bb([n, t]), E = Qt(Qt({}, R), o);
7764
7764
  return f.createElement(
7765
7765
  f.Fragment,
7766
7766
  null,
7767
7767
  d && f.createElement(S, { sideCar: Vu, removeScrollBar: u, shards: h, noRelative: w, noIsolation: v, inert: x, setCallbacks: s, allowPinchZoom: !!p, lockRef: n, gapMode: y }),
7768
- i ? f.cloneElement(f.Children.only(a), Zt(Zt({}, R), { ref: C })) : f.createElement(b, Zt({}, R, { className: l, ref: C }), a)
7768
+ i ? f.cloneElement(f.Children.only(a), Qt(Qt({}, E), { ref: C })) : f.createElement(b, Qt({}, E, { className: l, ref: C }), a)
7769
7769
  );
7770
7770
  });
7771
7771
  fs.defaultProps = {
@@ -8011,18 +8011,18 @@ function hw(e) {
8011
8011
  var a = f.useCallback(function(x, p) {
8012
8012
  if ("touches" in x && x.touches.length === 2 || x.type === "wheel" && x.ctrlKey)
8013
8013
  return !i.current.allowPinchZoom;
8014
- var g = fo(x), b = n.current, y = "deltaX" in x ? x.deltaX : b[0] - g[0], E = "deltaY" in x ? x.deltaY : b[1] - g[1], S, C = x.target, R = Math.abs(y) > Math.abs(E) ? "h" : "v";
8015
- if ("touches" in x && R === "h" && C.type === "range")
8014
+ var g = fo(x), b = n.current, y = "deltaX" in x ? x.deltaX : b[0] - g[0], R = "deltaY" in x ? x.deltaY : b[1] - g[1], S, C = x.target, E = Math.abs(y) > Math.abs(R) ? "h" : "v";
8015
+ if ("touches" in x && E === "h" && C.type === "range")
8016
8016
  return !1;
8017
- var N = tl(R, C);
8017
+ var N = tl(E, C);
8018
8018
  if (!N)
8019
8019
  return !0;
8020
- if (N ? S = R : (S = R === "v" ? "h" : "v", N = tl(R, C)), !N)
8020
+ if (N ? S = E : (S = E === "v" ? "h" : "v", N = tl(E, C)), !N)
8021
8021
  return !1;
8022
- if (!r.current && "changedTouches" in x && (y || E) && (r.current = S), !S)
8022
+ if (!r.current && "changedTouches" in x && (y || R) && (r.current = S), !S)
8023
8023
  return !0;
8024
8024
  var I = r.current || S;
8025
- return lw(I, p, x, I === "h" ? y : E);
8025
+ return lw(I, p, x, I === "h" ? y : R);
8026
8026
  }, []), l = f.useCallback(function(x) {
8027
8027
  var p = x;
8028
8028
  if (!(!Xn.length || Xn[Xn.length - 1] !== s)) {
@@ -8036,15 +8036,15 @@ function hw(e) {
8036
8036
  if (!b) {
8037
8037
  var y = (i.current.shards || []).map(rl).filter(Boolean).filter(function(S) {
8038
8038
  return S.contains(p.target);
8039
- }), E = y.length > 0 ? a(p, y[0]) : !i.current.noIsolation;
8040
- E && p.cancelable && p.preventDefault();
8039
+ }), R = y.length > 0 ? a(p, y[0]) : !i.current.noIsolation;
8040
+ R && p.cancelable && p.preventDefault();
8041
8041
  }
8042
8042
  }
8043
8043
  }, []), u = f.useCallback(function(x, p, g, b) {
8044
8044
  var y = { name: x, delta: p, target: g, should: b, shadowParent: pw(g) };
8045
8045
  t.current.push(y), setTimeout(function() {
8046
- t.current = t.current.filter(function(E) {
8047
- return E !== y;
8046
+ t.current = t.current.filter(function(R) {
8047
+ return R !== y;
8048
8048
  });
8049
8049
  }, 1);
8050
8050
  }, []), d = f.useCallback(function(x) {
@@ -8080,7 +8080,7 @@ function pw(e) {
8080
8080
  }
8081
8081
  const mw = Ub(Vu, hw);
8082
8082
  var hs = f.forwardRef(function(e, t) {
8083
- return f.createElement(fs, Zt({}, e, { ref: t, sideCar: mw }));
8083
+ return f.createElement(fs, Qt({}, e, { ref: t, sideCar: mw }));
8084
8084
  });
8085
8085
  hs.classNames = fs.classNames;
8086
8086
  var gw = function(e) {
@@ -8591,10 +8591,10 @@ const Ow = q.memo(function({
8591
8591
  onCancelEdit: g,
8592
8592
  onCopy: b
8593
8593
  }) {
8594
- const [y, E] = de(!1), [S, C] = de(!1), [R, N] = de(!1), [I, j] = de(!1), { currentThreadId: O } = Yi();
8594
+ const [y, R] = de(!1), [S, C] = de(!1), [E, N] = de(!1), [I, j] = de(!1), { currentThreadId: M } = Yi();
8595
8595
  ha();
8596
- const [U, K] = de({}), [P, M] = de(!1), [L, oe] = de(null), _ = u === "phone" || u === "half-screen", D = t.role, Y = D === "tool", V = q.useMemo(() => {
8597
- switch (D) {
8596
+ const [U, K] = de({}), [P, O] = de(!1), [D, ne] = de(null), _ = u === "phone" || u === "half-screen", L = t.role, Y = L === "tool", V = q.useMemo(() => {
8597
+ switch (L) {
8598
8598
  case "user":
8599
8599
  return "text-[hsl(var(--chat-bubble-user-text))]";
8600
8600
  case "assistant":
@@ -8606,7 +8606,7 @@ const Ow = q.memo(function({
8606
8606
  default:
8607
8607
  return "text-[hsl(var(--chat-bubble-ai-text))]";
8608
8608
  }
8609
- }, [D]), ee = ln(() => Mw(t.content), [t.content]), B = ln(() => $w(t.content), [t.content]), Z = ln(() => t.content.filter((ae) => ae.type === "image_url"), [t.content]), pe = ln(() => t.content.filter((ae) => ae.type === "file"), [t.content]), he = zw(ee, r);
8609
+ }, [L]), ee = Zt(() => Mw(t.content), [t.content]), B = Zt(() => $w(t.content), [t.content]), Z = Zt(() => t.content.filter((ae) => ae.type === "image_url"), [t.content]), pe = Zt(() => t.content.filter((ae) => ae.type === "file"), [t.content]), he = zw(ee, r);
8610
8610
  q.useEffect(() => {
8611
8611
  r && ee !== he && console.log("[MessageComponent] Streaming update:", {
8612
8612
  messageId: t.id,
@@ -8620,7 +8620,7 @@ const Ow = q.memo(function({
8620
8620
  const $ = async () => {
8621
8621
  try {
8622
8622
  const ae = Y ? Zn(t.content) : ee;
8623
- await navigator.clipboard.writeText(ae), E(!0), setTimeout(() => E(!1), 2e3), b == null || b(ae);
8623
+ await navigator.clipboard.writeText(ae), R(!0), setTimeout(() => R(!1), 2e3), b == null || b(ae);
8624
8624
  } catch (ae) {
8625
8625
  console.error("Failed to copy:", ae);
8626
8626
  }
@@ -8630,7 +8630,7 @@ const Ow = q.memo(function({
8630
8630
  x(t.id, ae);
8631
8631
  }, z = () => p == null ? void 0 : p(n), J = () => {
8632
8632
  const Ne = F(_ ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", V);
8633
- switch (D) {
8633
+ switch (L) {
8634
8634
  case "user":
8635
8635
  return /* @__PURE__ */ c.jsx(Yp, { className: Ne });
8636
8636
  case "assistant":
@@ -8642,7 +8642,7 @@ const Ow = q.memo(function({
8642
8642
  }
8643
8643
  }, ce = () => {
8644
8644
  const ae = "group relative mb-4 flex w-full";
8645
- switch (D) {
8645
+ switch (L) {
8646
8646
  case "user":
8647
8647
  return F(ae, "justify-end");
8648
8648
  case "assistant":
@@ -8657,7 +8657,7 @@ const Ow = q.memo(function({
8657
8657
  "rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
8658
8658
  _ && "px-3 py-2 text-sm"
8659
8659
  );
8660
- switch (D) {
8660
+ switch (L) {
8661
8661
  case "user":
8662
8662
  return F(
8663
8663
  ae,
@@ -8706,7 +8706,7 @@ const Ow = q.memo(function({
8706
8706
  const fe = t.content.find((ot) => ot.type === "tool_result"), Ce = (fe == null ? void 0 : fe.output) ?? Zn(t.content), Be = yd(Ce);
8707
8707
  if (Be) return /* @__PURE__ */ c.jsx(Ww, { issues: Be });
8708
8708
  }
8709
- if (Y && !R) {
8709
+ if (Y && !E) {
8710
8710
  const fe = Zn(t.content).slice(0, 80).replace(/\s+/g, " ");
8711
8711
  return /* @__PURE__ */ c.jsx("div", { className: F("text-xs font-mono opacity-70 flex items-center justify-between gap-2 text-current", _ && "text-[10px]"), children: /* @__PURE__ */ c.jsxs("span", { className: "truncate max-w-full text-current", children: [
8712
8712
  fe,
@@ -8728,14 +8728,14 @@ const Ow = q.memo(function({
8728
8728
  ] }) }) })
8729
8729
  ] }) });
8730
8730
  }
8731
- if (Y && R && !d) {
8731
+ if (Y && E && !d) {
8732
8732
  const fe = Vw(t.content);
8733
8733
  if (fe && Dw(fe))
8734
8734
  return /* @__PURE__ */ c.jsx(Ks, { content: fe.trim(), hideFallbackDuringStreaming: !0 });
8735
8735
  const Ce = Zn(t.content);
8736
8736
  return /* @__PURE__ */ c.jsx("div", { className: "font-mono text-sm text-current", children: /* @__PURE__ */ c.jsx("pre", { className: F("whitespace-pre-wrap break-words text-current", _ && "text-xs"), children: Ce }) });
8737
8737
  }
8738
- const Ne = Z.length > 0 && D !== "tool", Se = pe.length > 0 && D !== "tool" && !1;
8738
+ const Ne = Z.length > 0 && L !== "tool", Se = pe.length > 0 && L !== "tool" && !1;
8739
8739
  return /* @__PURE__ */ c.jsxs("div", { children: [
8740
8740
  r ? (
8741
8741
  // Streaming container: reserve space and show a skeleton until we have text,
@@ -8778,7 +8778,7 @@ const Ow = q.memo(function({
8778
8778
  ) : (() => {
8779
8779
  const fe = ri(ee.trim());
8780
8780
  if (fe !== null) return /* @__PURE__ */ c.jsx(ol, { data: fe });
8781
- if (D === "user" && m) {
8781
+ if (L === "user" && m) {
8782
8782
  const Ce = ee.trim();
8783
8783
  if (Ce.length > w)
8784
8784
  return /* @__PURE__ */ c.jsxs($c, { open: I, onOpenChange: j, children: [
@@ -8845,7 +8845,7 @@ const Ow = q.memo(function({
8845
8845
  }) }),
8846
8846
  Se
8847
8847
  ] });
8848
- }, je = ln(() => Hw(t), [t]);
8848
+ }, je = Zt(() => Hw(t), [t]);
8849
8849
  return /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
8850
8850
  /* @__PURE__ */ c.jsx("div", { className: F(ce(), v.container), children: /* @__PURE__ */ c.jsxs("div", { className: F(ie(), v.content), children: [
8851
8851
  (a || l || Y) && /* @__PURE__ */ c.jsxs(
@@ -8874,7 +8874,7 @@ const Ow = q.memo(function({
8874
8874
  onClick: () => N((ae) => !ae),
8875
8875
  children: [
8876
8876
  /* @__PURE__ */ c.jsx("span", { children: B.name }),
8877
- /* @__PURE__ */ c.jsx("span", { className: "inline-flex items-center", children: R ? /* @__PURE__ */ c.jsx(Cr, { className: "h-3 w-3" }) : /* @__PURE__ */ c.jsx(Qn, { className: "h-3 w-3" }) })
8877
+ /* @__PURE__ */ c.jsx("span", { className: "inline-flex items-center", children: E ? /* @__PURE__ */ c.jsx(Cr, { className: "h-3 w-3" }) : /* @__PURE__ */ c.jsx(Qn, { className: "h-3 w-3" }) })
8878
8878
  ]
8879
8879
  }
8880
8880
  ),
@@ -8887,7 +8887,7 @@ const Ow = q.memo(function({
8887
8887
  onClick: () => N((ae) => !ae),
8888
8888
  children: /* @__PURE__ */ c.jsxs("span", { className: "text-xs flex items-center gap-1", children: [
8889
8889
  "Tool Output ",
8890
- R ? /* @__PURE__ */ c.jsx(Cr, { className: "h-3 w-3" }) : /* @__PURE__ */ c.jsx(Qn, { className: "h-3 w-3" })
8890
+ E ? /* @__PURE__ */ c.jsx(Cr, { className: "h-3 w-3" }) : /* @__PURE__ */ c.jsx(Qn, { className: "h-3 w-3" })
8891
8891
  ] })
8892
8892
  }
8893
8893
  )
@@ -8921,7 +8921,7 @@ const Ow = q.memo(function({
8921
8921
  )
8922
8922
  }
8923
8923
  ),
8924
- D === "user" && x && /* @__PURE__ */ c.jsx(
8924
+ L === "user" && x && /* @__PURE__ */ c.jsx(
8925
8925
  De,
8926
8926
  {
8927
8927
  variant: "ghost",
@@ -8931,7 +8931,7 @@ const Ow = q.memo(function({
8931
8931
  children: /* @__PURE__ */ c.jsx(Xa, { className: F(V, _ ? "h-3 w-3" : "h-4 w-4") })
8932
8932
  }
8933
8933
  ),
8934
- D === "assistant" && p && /* @__PURE__ */ c.jsx(
8934
+ L === "assistant" && p && /* @__PURE__ */ c.jsx(
8935
8935
  De,
8936
8936
  {
8937
8937
  variant: "ghost",
@@ -8949,7 +8949,7 @@ const Ow = q.memo(function({
8949
8949
  }
8950
8950
  ),
8951
8951
  /* @__PURE__ */ c.jsx("div", { className: "relative", children: _e() }),
8952
- Y && R && (B.toolCallId || B.name) && /* @__PURE__ */ c.jsxs("div", { className: F("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", _ && "text-xs"), children: [
8952
+ Y && E && (B.toolCallId || B.name) && /* @__PURE__ */ c.jsxs("div", { className: F("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", _ && "text-xs"), children: [
8953
8953
  B.name && /* @__PURE__ */ c.jsxs("div", { children: [
8954
8954
  "Function: ",
8955
8955
  B.name
@@ -8978,7 +8978,7 @@ const Ow = q.memo(function({
8978
8978
  children: /* @__PURE__ */ c.jsx(qa, { className: F(y ? "text-success" : "text-current", _ ? "h-3 w-3" : "h-4 w-4") })
8979
8979
  }
8980
8980
  ),
8981
- D === "user" && x && /* @__PURE__ */ c.jsx(
8981
+ L === "user" && x && /* @__PURE__ */ c.jsx(
8982
8982
  De,
8983
8983
  {
8984
8984
  variant: "ghost",
@@ -8988,7 +8988,7 @@ const Ow = q.memo(function({
8988
8988
  children: /* @__PURE__ */ c.jsx(Xa, { className: F("text-current", _ ? "h-3 w-3" : "h-4 w-4") })
8989
8989
  }
8990
8990
  ),
8991
- D === "assistant" && p && /* @__PURE__ */ c.jsx(
8991
+ L === "assistant" && p && /* @__PURE__ */ c.jsx(
8992
8992
  De,
8993
8993
  {
8994
8994
  variant: "ghost",
@@ -9002,16 +9002,16 @@ const Ow = q.memo(function({
9002
9002
  }
9003
9003
  )
9004
9004
  ] }) }),
9005
- L && /* @__PURE__ */ c.jsx(
9005
+ D && /* @__PURE__ */ c.jsx(
9006
9006
  Pw,
9007
9007
  {
9008
9008
  isOpen: P,
9009
9009
  onClose: () => {
9010
- M(!1), oe(null);
9010
+ O(!1), ne(null);
9011
9011
  },
9012
- fileId: L.id,
9013
- fileName: L.name,
9014
- mimeType: L.mimeType
9012
+ fileId: D.id,
9013
+ fileName: D.name,
9014
+ mimeType: D.mimeType
9015
9015
  }
9016
9016
  )
9017
9017
  ] });
@@ -9266,13 +9266,13 @@ const sl = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Sd = q.forwa
9266
9266
  onScrollAway: p,
9267
9267
  onAtBottom: g
9268
9268
  }, b) => {
9269
- const y = Ue(null), E = Ue(null), S = Ue(!1), C = Ue(!0), R = Ue(!1), N = Ue(e.length), I = ze((M) => {
9270
- C.current = M, p && p(!M), g && g(M);
9269
+ const y = Ue(null), R = Ue(null), S = Ue(!1), C = Ue(!0), E = Ue(e.length), N = Ue(t), I = ze((O) => {
9270
+ C.current = O, p && p(!O), g && g(O);
9271
9271
  }, [p, g]), j = ze(
9272
- (M) => {
9272
+ (O) => {
9273
9273
  },
9274
9274
  []
9275
- ), O = ln(() => {
9275
+ ), M = Zt(() => {
9276
9276
  if (a)
9277
9277
  return async () => {
9278
9278
  if (!S.current) {
@@ -9286,16 +9286,27 @@ const sl = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Sd = q.forwa
9286
9286
  };
9287
9287
  }, [a]);
9288
9288
  Ye(() => {
9289
- N.current;
9290
- const M = e.length;
9291
- N.current = M;
9289
+ E.current;
9290
+ const O = e.length;
9291
+ E.current = O;
9292
9292
  }, [e.length]), Ye(() => () => {
9293
- }, []), Ye(() => {
9294
- const L = t && v && C.current ? "auto" : !1;
9295
- R.current !== L && (console.log("[MessageList] followOutput changed:", R.current, "->", L), R.current = L);
9296
- }, [t, v]);
9297
- const U = R.current;
9298
- q.useEffect(() => {
9293
+ }, []);
9294
+ const U = Zt(() => !C.current || !v ? !1 : t && n && e.some((D) => D.id === n) ? "auto" : !1, [t, n, v, e]);
9295
+ Ye(() => {
9296
+ const O = N.current, D = t;
9297
+ if (N.current = D, !O && D) {
9298
+ const ne = setTimeout(() => {
9299
+ var _;
9300
+ C.current && e.length > 0 && ((_ = y.current) == null || _.scrollToIndex({
9301
+ index: e.length - 1,
9302
+ align: "end",
9303
+ behavior: "auto"
9304
+ // instant, no animation
9305
+ }));
9306
+ }, 0);
9307
+ return () => clearTimeout(ne);
9308
+ }
9309
+ }, [t, e.length]), q.useEffect(() => {
9299
9310
  console.log("[MessageList] Streaming state:", {
9300
9311
  isStreaming: t,
9301
9312
  streamingAssistantId: n,
@@ -9306,7 +9317,7 @@ const sl = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Sd = q.forwa
9306
9317
  followNewMessages: v
9307
9318
  });
9308
9319
  }, [t, n, e.length, U, x, v]);
9309
- const K = ln(() => {
9320
+ const K = Zt(() => {
9310
9321
  }, []), P = {
9311
9322
  display: "flex",
9312
9323
  flexDirection: "column",
@@ -9318,11 +9329,11 @@ const sl = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Sd = q.forwa
9318
9329
  return e.length === 0 ? /* @__PURE__ */ c.jsx("div", { className: h, style: m, children: /* @__PURE__ */ c.jsx("div", { className: "flex items-center justify-center py-8 text-muted-foreground text-center max-w-md mx-auto", children: w || "No messages yet. Start a conversation!" }) }) : /* @__PURE__ */ c.jsx("div", { className: h, style: m, children: /* @__PURE__ */ c.jsx(
9319
9330
  Tx,
9320
9331
  {
9321
- ref: (M) => {
9322
- y.current = M;
9332
+ ref: (O) => {
9333
+ y.current = O;
9323
9334
  },
9324
- scrollerRef: (M) => {
9325
- E.current = M instanceof HTMLDivElement ? M : null;
9335
+ scrollerRef: (O) => {
9336
+ R.current = O instanceof HTMLDivElement ? O : null;
9326
9337
  },
9327
9338
  data: e,
9328
9339
  followOutput: U,
@@ -9333,32 +9344,32 @@ const sl = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Sd = q.forwa
9333
9344
  atBottomThreshold: 50,
9334
9345
  alignToBottom: !0,
9335
9346
  startReached: () => {
9336
- O && O();
9347
+ M && M();
9337
9348
  },
9338
9349
  atBottomStateChange: I,
9339
9350
  rangeChanged: j,
9340
9351
  style: { height: "100%", overscrollBehavior: "contain" },
9341
- computeItemKey: (M, L) => sl(L, M),
9352
+ computeItemKey: (O, D) => sl(D, O),
9342
9353
  components: {
9343
- Scroller: q.forwardRef((M, L) => /* @__PURE__ */ c.jsx(
9354
+ Scroller: q.forwardRef((O, D) => /* @__PURE__ */ c.jsx(
9344
9355
  "div",
9345
9356
  {
9346
- ...M,
9347
- ref: L,
9357
+ ...O,
9358
+ ref: D,
9348
9359
  style: {
9349
9360
  ...P,
9350
- ...(M == null ? void 0 : M.style) ?? {}
9361
+ ...(O == null ? void 0 : O.style) ?? {}
9351
9362
  }
9352
9363
  }
9353
9364
  ))
9354
9365
  },
9355
- itemContent: (M, L) => {
9356
- const oe = L.role === "user" && M === e.length - 1, _ = t && n === L.id || oe && t, D = sl(L, M);
9366
+ itemContent: (O, D) => {
9367
+ const ne = D.role === "user" && O === e.length - 1, _ = t && n === D.id || ne && t, L = sl(D, O);
9357
9368
  return /* @__PURE__ */ c.jsx(
9358
9369
  "div",
9359
9370
  {
9360
9371
  className: "mb-4 last:mb-0",
9361
- "data-message-id": D,
9372
+ "data-message-id": L,
9362
9373
  style: {
9363
9374
  // REMOVED contentVisibility - causes scroll jumps during streaming
9364
9375
  // Reserve space to prevent layout shifts during streaming
@@ -9370,11 +9381,11 @@ const sl = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Sd = q.forwa
9370
9381
  children: /* @__PURE__ */ c.jsx(
9371
9382
  Ow,
9372
9383
  {
9373
- message: L,
9374
- messageIndex: M,
9375
- isStreamingMessage: t && n === L.id,
9384
+ message: D,
9385
+ messageIndex: O,
9386
+ isStreamingMessage: t && n === D.id,
9376
9387
  streamingDebounceMs: r,
9377
- isEditing: i === L.id,
9388
+ isEditing: i === D.id,
9378
9389
  showActions: s,
9379
9390
  showTimestamp: !1,
9380
9391
  showAgentName: !0,
@@ -9382,10 +9393,10 @@ const sl = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Sd = q.forwa
9382
9393
  truncateToolMessages: !1,
9383
9394
  toolMessagePreviewLength: 200,
9384
9395
  onEdit: l,
9385
- onRegenerate: () => u(M),
9396
+ onRegenerate: () => u(O),
9386
9397
  onCancelEdit: d
9387
9398
  },
9388
- L.id ?? `msg-${L.role}-${M}-${L.createdAt ?? ""}`
9399
+ D.id ?? `msg-${D.role}-${O}-${D.createdAt ?? ""}`
9389
9400
  )
9390
9401
  }
9391
9402
  );
@@ -9444,15 +9455,15 @@ function ba(e) {
9444
9455
  i.displayName = t;
9445
9456
  const a = e + "CollectionSlot", l = sr(a), u = q.forwardRef(
9446
9457
  (x, p) => {
9447
- const { scope: g, children: b } = x, y = s(a, g), E = Ee(p, y.collectionRef);
9448
- return /* @__PURE__ */ c.jsx(l, { ref: E, children: b });
9458
+ const { scope: g, children: b } = x, y = s(a, g), R = Ee(p, y.collectionRef);
9459
+ return /* @__PURE__ */ c.jsx(l, { ref: R, children: b });
9449
9460
  }
9450
9461
  );
9451
9462
  u.displayName = a;
9452
9463
  const d = e + "CollectionItemSlot", h = "data-radix-collection-item", m = sr(d), w = q.forwardRef(
9453
9464
  (x, p) => {
9454
- const { scope: g, children: b, ...y } = x, E = q.useRef(null), S = Ee(p, E), C = s(d, g);
9455
- return q.useEffect(() => (C.itemMap.set(E, { ref: E, ...y }), () => void C.itemMap.delete(E))), /* @__PURE__ */ c.jsx(m, { [h]: "", ref: S, children: b });
9465
+ const { scope: g, children: b, ...y } = x, R = q.useRef(null), S = Ee(p, R), C = s(d, g);
9466
+ return q.useEffect(() => (C.itemMap.set(R, { ref: R, ...y }), () => void C.itemMap.delete(R))), /* @__PURE__ */ c.jsx(m, { [h]: "", ref: S, children: b });
9456
9467
  }
9457
9468
  );
9458
9469
  w.displayName = d;
@@ -9463,7 +9474,7 @@ function ba(e) {
9463
9474
  if (!b) return [];
9464
9475
  const y = Array.from(b.querySelectorAll(`[${h}]`));
9465
9476
  return Array.from(p.itemMap.values()).sort(
9466
- (C, R) => y.indexOf(C.ref.current) - y.indexOf(R.ref.current)
9477
+ (C, E) => y.indexOf(C.ref.current) - y.indexOf(E.ref.current)
9467
9478
  );
9468
9479
  }, [p.collectionRef, p.itemMap]);
9469
9480
  }
@@ -9478,7 +9489,7 @@ function xs(e) {
9478
9489
  const t = f.useContext(qw);
9479
9490
  return e || t || "ltr";
9480
9491
  }
9481
- const Xw = ["top", "right", "bottom", "left"], bn = Math.min, Rt = Math.max, Uo = Math.round, mo = Math.floor, tn = (e) => ({
9492
+ const Xw = ["top", "right", "bottom", "left"], bn = Math.min, Rt = Math.max, Uo = Math.round, mo = Math.floor, nn = (e) => ({
9482
9493
  x: e,
9483
9494
  y: e
9484
9495
  }), Jw = {
@@ -9509,11 +9520,11 @@ function ya(e) {
9509
9520
  return e === "y" ? "height" : "width";
9510
9521
  }
9511
9522
  const Qw = /* @__PURE__ */ new Set(["top", "bottom"]);
9512
- function en(e) {
9523
+ function tn(e) {
9513
9524
  return Qw.has(fn(e)) ? "y" : "x";
9514
9525
  }
9515
9526
  function Sa(e) {
9516
- return wa(en(e));
9527
+ return wa(tn(e));
9517
9528
  }
9518
9529
  function ey(e, t, n) {
9519
9530
  n === void 0 && (n = !1);
@@ -9589,7 +9600,7 @@ function cl(e, t, n) {
9589
9600
  reference: r,
9590
9601
  floating: o
9591
9602
  } = e;
9592
- const s = en(t), i = Sa(t), a = ya(i), l = fn(t), u = s === "y", d = r.x + r.width / 2 - o.width / 2, h = r.y + r.height / 2 - o.height / 2, m = r[a] / 2 - o[a] / 2;
9603
+ const s = tn(t), i = Sa(t), a = ya(i), l = fn(t), u = s === "y", d = r.x + r.width / 2 - o.width / 2, h = r.y + r.height / 2 - o.height / 2, m = r[a] / 2 - o[a] / 2;
9593
9604
  let w;
9594
9605
  switch (l) {
9595
9606
  case "top":
@@ -9654,7 +9665,7 @@ const ay = async (e, t, n) => {
9654
9665
  } = a[x], {
9655
9666
  x: b,
9656
9667
  y,
9657
- data: E,
9668
+ data: R,
9658
9669
  reset: S
9659
9670
  } = await g({
9660
9671
  x: d,
@@ -9674,7 +9685,7 @@ const ay = async (e, t, n) => {
9674
9685
  ...w,
9675
9686
  [p]: {
9676
9687
  ...w[p],
9677
- ...E
9688
+ ...R
9678
9689
  }
9679
9690
  }, S && v <= 50 && (v++, typeof S == "object" && (S.placement && (m = S.placement), S.rects && (u = S.rects === !0 ? await i.getElementRects({
9680
9691
  reference: e,
@@ -9719,7 +9730,7 @@ async function Fr(e, t) {
9719
9730
  y: o,
9720
9731
  width: i.floating.width,
9721
9732
  height: i.floating.height
9722
- } : i.reference, y = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a.floating)), E = await (s.isElement == null ? void 0 : s.isElement(y)) ? await (s.getScale == null ? void 0 : s.getScale(y)) || {
9733
+ } : i.reference, y = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a.floating)), R = await (s.isElement == null ? void 0 : s.isElement(y)) ? await (s.getScale == null ? void 0 : s.getScale(y)) || {
9723
9734
  x: 1,
9724
9735
  y: 1
9725
9736
  } : {
@@ -9732,10 +9743,10 @@ async function Fr(e, t) {
9732
9743
  strategy: l
9733
9744
  }) : b);
9734
9745
  return {
9735
- top: (g.top - S.top + v.top) / E.y,
9736
- bottom: (S.bottom - g.bottom + v.bottom) / E.y,
9737
- left: (g.left - S.left + v.left) / E.x,
9738
- right: (S.right - g.right + v.right) / E.x
9746
+ top: (g.top - S.top + v.top) / R.y,
9747
+ bottom: (S.bottom - g.bottom + v.bottom) / R.y,
9748
+ left: (g.left - S.left + v.left) / R.x,
9749
+ right: (S.right - g.right + v.right) / R.x
9739
9750
  };
9740
9751
  }
9741
9752
  const cy = (e) => ({
@@ -9759,20 +9770,20 @@ const cy = (e) => ({
9759
9770
  const h = Cd(d), m = {
9760
9771
  x: n,
9761
9772
  y: r
9762
- }, w = Sa(o), v = ya(w), x = await i.getDimensions(u), p = w === "y", g = p ? "top" : "left", b = p ? "bottom" : "right", y = p ? "clientHeight" : "clientWidth", E = s.reference[v] + s.reference[w] - m[w] - s.floating[v], S = m[w] - s.reference[w], C = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u));
9763
- let R = C ? C[y] : 0;
9764
- (!R || !await (i.isElement == null ? void 0 : i.isElement(C))) && (R = a.floating[y] || s.floating[v]);
9765
- const N = E / 2 - S / 2, I = R / 2 - x[v] / 2 - 1, j = bn(h[g], I), O = bn(h[b], I), U = j, K = R - x[v] - O, P = R / 2 - x[v] / 2 + N, M = Ni(U, P, K), L = !l.arrow && mr(o) != null && P !== M && s.reference[v] / 2 - (P < U ? j : O) - x[v] / 2 < 0, oe = L ? P < U ? P - U : P - K : 0;
9773
+ }, w = Sa(o), v = ya(w), x = await i.getDimensions(u), p = w === "y", g = p ? "top" : "left", b = p ? "bottom" : "right", y = p ? "clientHeight" : "clientWidth", R = s.reference[v] + s.reference[w] - m[w] - s.floating[v], S = m[w] - s.reference[w], C = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u));
9774
+ let E = C ? C[y] : 0;
9775
+ (!E || !await (i.isElement == null ? void 0 : i.isElement(C))) && (E = a.floating[y] || s.floating[v]);
9776
+ const N = R / 2 - S / 2, I = E / 2 - x[v] / 2 - 1, j = bn(h[g], I), M = bn(h[b], I), U = j, K = E - x[v] - M, P = E / 2 - x[v] / 2 + N, O = Ni(U, P, K), D = !l.arrow && mr(o) != null && P !== O && s.reference[v] / 2 - (P < U ? j : M) - x[v] / 2 < 0, ne = D ? P < U ? P - U : P - K : 0;
9766
9777
  return {
9767
- [w]: m[w] + oe,
9778
+ [w]: m[w] + ne,
9768
9779
  data: {
9769
- [w]: M,
9770
- centerOffset: P - M - oe,
9771
- ...L && {
9772
- alignmentOffset: oe
9780
+ [w]: O,
9781
+ centerOffset: P - O - ne,
9782
+ ...D && {
9783
+ alignmentOffset: ne
9773
9784
  }
9774
9785
  },
9775
- reset: L
9786
+ reset: D
9776
9787
  };
9777
9788
  }
9778
9789
  }), ly = function(e) {
@@ -9799,57 +9810,57 @@ const cy = (e) => ({
9799
9810
  } = dn(e, t);
9800
9811
  if ((n = s.arrow) != null && n.alignmentOffset)
9801
9812
  return {};
9802
- const g = fn(o), b = en(a), y = fn(a) === a, E = await (l.isRTL == null ? void 0 : l.isRTL(u.floating)), S = m || (y || !x ? [Wo(a)] : ty(a)), C = v !== "none";
9803
- !m && C && S.push(...sy(a, x, v, E));
9804
- const R = [a, ...S], N = await Fr(t, p), I = [];
9813
+ const g = fn(o), b = tn(a), y = fn(a) === a, R = await (l.isRTL == null ? void 0 : l.isRTL(u.floating)), S = m || (y || !x ? [Wo(a)] : ty(a)), C = v !== "none";
9814
+ !m && C && S.push(...sy(a, x, v, R));
9815
+ const E = [a, ...S], N = await Fr(t, p), I = [];
9805
9816
  let j = ((r = s.flip) == null ? void 0 : r.overflows) || [];
9806
9817
  if (d && I.push(N[g]), h) {
9807
- const P = ey(o, i, E);
9818
+ const P = ey(o, i, R);
9808
9819
  I.push(N[P[0]], N[P[1]]);
9809
9820
  }
9810
9821
  if (j = [...j, {
9811
9822
  placement: o,
9812
9823
  overflows: I
9813
9824
  }], !I.every((P) => P <= 0)) {
9814
- var O, U;
9815
- const P = (((O = s.flip) == null ? void 0 : O.index) || 0) + 1, M = R[P];
9816
- if (M && (!(h === "alignment" ? b !== en(M) : !1) || // We leave the current main axis only if every placement on that axis
9825
+ var M, U;
9826
+ const P = (((M = s.flip) == null ? void 0 : M.index) || 0) + 1, O = E[P];
9827
+ if (O && (!(h === "alignment" ? b !== tn(O) : !1) || // We leave the current main axis only if every placement on that axis
9817
9828
  // overflows the main axis.
9818
- j.every((_) => en(_.placement) === b ? _.overflows[0] > 0 : !0)))
9829
+ j.every((_) => tn(_.placement) === b ? _.overflows[0] > 0 : !0)))
9819
9830
  return {
9820
9831
  data: {
9821
9832
  index: P,
9822
9833
  overflows: j
9823
9834
  },
9824
9835
  reset: {
9825
- placement: M
9836
+ placement: O
9826
9837
  }
9827
9838
  };
9828
- let L = (U = j.filter((oe) => oe.overflows[0] <= 0).sort((oe, _) => oe.overflows[1] - _.overflows[1])[0]) == null ? void 0 : U.placement;
9829
- if (!L)
9839
+ let D = (U = j.filter((ne) => ne.overflows[0] <= 0).sort((ne, _) => ne.overflows[1] - _.overflows[1])[0]) == null ? void 0 : U.placement;
9840
+ if (!D)
9830
9841
  switch (w) {
9831
9842
  case "bestFit": {
9832
9843
  var K;
9833
- const oe = (K = j.filter((_) => {
9844
+ const ne = (K = j.filter((_) => {
9834
9845
  if (C) {
9835
- const D = en(_.placement);
9836
- return D === b || // Create a bias to the `y` side axis due to horizontal
9846
+ const L = tn(_.placement);
9847
+ return L === b || // Create a bias to the `y` side axis due to horizontal
9837
9848
  // reading directions favoring greater width.
9838
- D === "y";
9849
+ L === "y";
9839
9850
  }
9840
9851
  return !0;
9841
- }).map((_) => [_.placement, _.overflows.filter((D) => D > 0).reduce((D, Y) => D + Y, 0)]).sort((_, D) => _[1] - D[1])[0]) == null ? void 0 : K[0];
9842
- oe && (L = oe);
9852
+ }).map((_) => [_.placement, _.overflows.filter((L) => L > 0).reduce((L, Y) => L + Y, 0)]).sort((_, L) => _[1] - L[1])[0]) == null ? void 0 : K[0];
9853
+ ne && (D = ne);
9843
9854
  break;
9844
9855
  }
9845
9856
  case "initialPlacement":
9846
- L = a;
9857
+ D = a;
9847
9858
  break;
9848
9859
  }
9849
- if (o !== L)
9860
+ if (o !== D)
9850
9861
  return {
9851
9862
  reset: {
9852
- placement: L
9863
+ placement: D
9853
9864
  }
9854
9865
  };
9855
9866
  }
@@ -9915,7 +9926,7 @@ async function dy(e, t) {
9915
9926
  placement: n,
9916
9927
  platform: r,
9917
9928
  elements: o
9918
- } = e, s = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), i = fn(n), a = mr(n), l = en(n) === "y", u = Td.has(i) ? -1 : 1, d = s && l ? -1 : 1, h = dn(t, e);
9929
+ } = e, s = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), i = fn(n), a = mr(n), l = tn(n) === "y", u = Td.has(i) ? -1 : 1, d = s && l ? -1 : 1, h = dn(t, e);
9919
9930
  let {
9920
9931
  mainAxis: m,
9921
9932
  crossAxis: w,
@@ -9987,7 +9998,7 @@ const fy = function(e) {
9987
9998
  } = dn(e, t), u = {
9988
9999
  x: n,
9989
10000
  y: r
9990
- }, d = await Fr(t, l), h = en(fn(o)), m = wa(h);
10001
+ }, d = await Fr(t, l), h = tn(fn(o)), m = wa(h);
9991
10002
  let w = u[m], v = u[h];
9992
10003
  if (s) {
9993
10004
  const p = m === "y" ? "top" : "left", g = m === "y" ? "bottom" : "right", b = w + d[p], y = w - d[g];
@@ -10032,7 +10043,7 @@ const fy = function(e) {
10032
10043
  } = dn(e, t), d = {
10033
10044
  x: n,
10034
10045
  y: r
10035
- }, h = en(o), m = wa(h);
10046
+ }, h = tn(o), m = wa(h);
10036
10047
  let w = d[m], v = d[h];
10037
10048
  const x = dn(a, t), p = typeof x == "number" ? {
10038
10049
  mainAxis: x,
@@ -10043,12 +10054,12 @@ const fy = function(e) {
10043
10054
  ...x
10044
10055
  };
10045
10056
  if (l) {
10046
- const y = m === "y" ? "height" : "width", E = s.reference[m] - s.floating[y] + p.mainAxis, S = s.reference[m] + s.reference[y] - p.mainAxis;
10047
- w < E ? w = E : w > S && (w = S);
10057
+ const y = m === "y" ? "height" : "width", R = s.reference[m] - s.floating[y] + p.mainAxis, S = s.reference[m] + s.reference[y] - p.mainAxis;
10058
+ w < R ? w = R : w > S && (w = S);
10048
10059
  }
10049
10060
  if (u) {
10050
10061
  var g, b;
10051
- const y = m === "y" ? "width" : "height", E = Td.has(fn(o)), S = s.reference[h] - s.floating[y] + (E && ((g = i.offset) == null ? void 0 : g[h]) || 0) + (E ? 0 : p.crossAxis), C = s.reference[h] + s.reference[y] + (E ? 0 : ((b = i.offset) == null ? void 0 : b[h]) || 0) - (E ? p.crossAxis : 0);
10062
+ const y = m === "y" ? "width" : "height", R = Td.has(fn(o)), S = s.reference[h] - s.floating[y] + (R && ((g = i.offset) == null ? void 0 : g[h]) || 0) + (R ? 0 : p.crossAxis), C = s.reference[h] + s.reference[y] + (R ? 0 : ((b = i.offset) == null ? void 0 : b[h]) || 0) - (R ? p.crossAxis : 0);
10052
10063
  v < S ? v = S : v > C && (v = C);
10053
10064
  }
10054
10065
  return {
@@ -10072,22 +10083,22 @@ const fy = function(e) {
10072
10083
  apply: l = () => {
10073
10084
  },
10074
10085
  ...u
10075
- } = dn(e, t), d = await Fr(t, u), h = fn(o), m = mr(o), w = en(o) === "y", {
10086
+ } = dn(e, t), d = await Fr(t, u), h = fn(o), m = mr(o), w = tn(o) === "y", {
10076
10087
  width: v,
10077
10088
  height: x
10078
10089
  } = s.floating;
10079
10090
  let p, g;
10080
10091
  h === "top" || h === "bottom" ? (p = h, g = m === (await (i.isRTL == null ? void 0 : i.isRTL(a.floating)) ? "start" : "end") ? "left" : "right") : (g = h, p = m === "end" ? "top" : "bottom");
10081
- const b = x - d.top - d.bottom, y = v - d.left - d.right, E = bn(x - d[p], b), S = bn(v - d[g], y), C = !t.middlewareData.shift;
10082
- let R = E, N = S;
10083
- if ((n = t.middlewareData.shift) != null && n.enabled.x && (N = y), (r = t.middlewareData.shift) != null && r.enabled.y && (R = b), C && !m) {
10084
- const j = Rt(d.left, 0), O = Rt(d.right, 0), U = Rt(d.top, 0), K = Rt(d.bottom, 0);
10085
- w ? N = v - 2 * (j !== 0 || O !== 0 ? j + O : Rt(d.left, d.right)) : R = x - 2 * (U !== 0 || K !== 0 ? U + K : Rt(d.top, d.bottom));
10092
+ const b = x - d.top - d.bottom, y = v - d.left - d.right, R = bn(x - d[p], b), S = bn(v - d[g], y), C = !t.middlewareData.shift;
10093
+ let E = R, N = S;
10094
+ if ((n = t.middlewareData.shift) != null && n.enabled.x && (N = y), (r = t.middlewareData.shift) != null && r.enabled.y && (E = b), C && !m) {
10095
+ const j = Rt(d.left, 0), M = Rt(d.right, 0), U = Rt(d.top, 0), K = Rt(d.bottom, 0);
10096
+ w ? N = v - 2 * (j !== 0 || M !== 0 ? j + M : Rt(d.left, d.right)) : E = x - 2 * (U !== 0 || K !== 0 ? U + K : Rt(d.top, d.bottom));
10086
10097
  }
10087
10098
  await l({
10088
10099
  ...t,
10089
10100
  availableWidth: N,
10090
- availableHeight: R
10101
+ availableHeight: E
10091
10102
  });
10092
10103
  const I = await i.getDimensions(a.floating);
10093
10104
  return v !== I.width || x !== I.height ? {
@@ -10108,7 +10119,7 @@ function It(e) {
10108
10119
  var t;
10109
10120
  return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
10110
10121
  }
10111
- function on(e) {
10122
+ function sn(e) {
10112
10123
  var t;
10113
10124
  return (t = (Rd(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
10114
10125
  }
@@ -10118,7 +10129,7 @@ function Rd(e) {
10118
10129
  function Ut(e) {
10119
10130
  return bs() ? e instanceof Element || e instanceof It(e).Element : !1;
10120
10131
  }
10121
- function nn(e) {
10132
+ function rn(e) {
10122
10133
  return bs() ? e instanceof HTMLElement || e instanceof It(e).HTMLElement : !1;
10123
10134
  }
10124
10135
  function dl(e) {
@@ -10155,7 +10166,7 @@ function Ca(e) {
10155
10166
  }
10156
10167
  function Cy(e) {
10157
10168
  let t = wn(e);
10158
- for (; nn(t) && !ar(t); ) {
10169
+ for (; rn(t) && !ar(t); ) {
10159
10170
  if (Ca(t))
10160
10171
  return t;
10161
10172
  if (ws(t))
@@ -10191,13 +10202,13 @@ function wn(e) {
10191
10202
  e.assignedSlot || // DOM Element detected.
10192
10203
  e.parentNode || // ShadowRoot detected.
10193
10204
  dl(e) && e.host || // Fallback.
10194
- on(e)
10205
+ sn(e)
10195
10206
  );
10196
10207
  return dl(t) ? t.host : t;
10197
10208
  }
10198
10209
  function Ed(e) {
10199
10210
  const t = wn(e);
10200
- return ar(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : nn(t) && Qr(t) ? t : Ed(t);
10211
+ return ar(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : rn(t) && Qr(t) ? t : Ed(t);
10201
10212
  }
10202
10213
  function Br(e, t, n) {
10203
10214
  var r;
@@ -10215,7 +10226,7 @@ function ji(e) {
10215
10226
  function Nd(e) {
10216
10227
  const t = Wt(e);
10217
10228
  let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
10218
- const o = nn(e), s = o ? e.offsetWidth : n, i = o ? e.offsetHeight : r, a = Uo(n) !== s || Uo(r) !== i;
10229
+ const o = rn(e), s = o ? e.offsetWidth : n, i = o ? e.offsetHeight : r, a = Uo(n) !== s || Uo(r) !== i;
10219
10230
  return a && (n = s, r = i), {
10220
10231
  width: n,
10221
10232
  height: r,
@@ -10227,8 +10238,8 @@ function Ra(e) {
10227
10238
  }
10228
10239
  function rr(e) {
10229
10240
  const t = Ra(e);
10230
- if (!nn(t))
10231
- return tn(1);
10241
+ if (!rn(t))
10242
+ return nn(1);
10232
10243
  const n = t.getBoundingClientRect(), {
10233
10244
  width: r,
10234
10245
  height: o,
@@ -10240,7 +10251,7 @@ function rr(e) {
10240
10251
  y: a
10241
10252
  };
10242
10253
  }
10243
- const Ry = /* @__PURE__ */ tn(0);
10254
+ const Ry = /* @__PURE__ */ nn(0);
10244
10255
  function Id(e) {
10245
10256
  const t = It(e);
10246
10257
  return !Ta() || !t.visualViewport ? Ry : {
@@ -10254,16 +10265,16 @@ function Ey(e, t, n) {
10254
10265
  function Fn(e, t, n, r) {
10255
10266
  t === void 0 && (t = !1), n === void 0 && (n = !1);
10256
10267
  const o = e.getBoundingClientRect(), s = Ra(e);
10257
- let i = tn(1);
10268
+ let i = nn(1);
10258
10269
  t && (r ? Ut(r) && (i = rr(r)) : i = rr(e));
10259
- const a = Ey(s, n, r) ? Id(s) : tn(0);
10270
+ const a = Ey(s, n, r) ? Id(s) : nn(0);
10260
10271
  let l = (o.left + a.x) / i.x, u = (o.top + a.y) / i.y, d = o.width / i.x, h = o.height / i.y;
10261
10272
  if (s) {
10262
10273
  const m = It(s), w = r && Ut(r) ? It(r) : r;
10263
10274
  let v = m, x = ji(v);
10264
10275
  for (; x && r && w !== v; ) {
10265
- const p = rr(x), g = x.getBoundingClientRect(), b = Wt(x), y = g.left + (x.clientLeft + parseFloat(b.paddingLeft)) * p.x, E = g.top + (x.clientTop + parseFloat(b.paddingTop)) * p.y;
10266
- l *= p.x, u *= p.y, d *= p.x, h *= p.y, l += y, u += E, v = It(x), x = ji(v);
10276
+ const p = rr(x), g = x.getBoundingClientRect(), b = Wt(x), y = g.left + (x.clientLeft + parseFloat(b.paddingLeft)) * p.x, R = g.top + (x.clientTop + parseFloat(b.paddingTop)) * p.y;
10277
+ l *= p.x, u *= p.y, d *= p.x, h *= p.y, l += y, u += R, v = It(x), x = ji(v);
10267
10278
  }
10268
10279
  }
10269
10280
  return Vo({
@@ -10275,7 +10286,7 @@ function Fn(e, t, n, r) {
10275
10286
  }
10276
10287
  function Ea(e, t) {
10277
10288
  const n = ys(e).scrollLeft;
10278
- return t ? t.left + n : Fn(on(e)).left + n;
10289
+ return t ? t.left + n : Fn(sn(e)).left + n;
10279
10290
  }
10280
10291
  function jd(e, t, n) {
10281
10292
  n === void 0 && (n = !1);
@@ -10295,19 +10306,19 @@ function Ny(e) {
10295
10306
  offsetParent: r,
10296
10307
  strategy: o
10297
10308
  } = e;
10298
- const s = o === "fixed", i = on(r), a = t ? ws(t.floating) : !1;
10309
+ const s = o === "fixed", i = sn(r), a = t ? ws(t.floating) : !1;
10299
10310
  if (r === i || a && s)
10300
10311
  return n;
10301
10312
  let l = {
10302
10313
  scrollLeft: 0,
10303
10314
  scrollTop: 0
10304
- }, u = tn(1);
10305
- const d = tn(0), h = nn(r);
10306
- if ((h || !h && !s) && ((gr(r) !== "body" || Qr(i)) && (l = ys(r)), nn(r))) {
10315
+ }, u = nn(1);
10316
+ const d = nn(0), h = rn(r);
10317
+ if ((h || !h && !s) && ((gr(r) !== "body" || Qr(i)) && (l = ys(r)), rn(r))) {
10307
10318
  const w = Fn(r);
10308
10319
  u = rr(r), d.x = w.x + r.clientLeft, d.y = w.y + r.clientTop;
10309
10320
  }
10310
- const m = i && !h && !s ? jd(i, l, !0) : tn(0);
10321
+ const m = i && !h && !s ? jd(i, l, !0) : nn(0);
10311
10322
  return {
10312
10323
  width: n.width * u.x,
10313
10324
  height: n.height * u.y,
@@ -10319,7 +10330,7 @@ function Iy(e) {
10319
10330
  return Array.from(e.getClientRects());
10320
10331
  }
10321
10332
  function jy(e) {
10322
- const t = on(e), n = ys(e), r = e.ownerDocument.body, o = Rt(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), s = Rt(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
10333
+ const t = sn(e), n = ys(e), r = e.ownerDocument.body, o = Rt(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), s = Rt(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
10323
10334
  let i = -n.scrollLeft + Ea(e);
10324
10335
  const a = -n.scrollTop;
10325
10336
  return Wt(r).direction === "rtl" && (i += Rt(t.clientWidth, r.clientWidth) - o), {
@@ -10330,7 +10341,7 @@ function jy(e) {
10330
10341
  };
10331
10342
  }
10332
10343
  function ky(e, t) {
10333
- const n = It(e), r = on(e), o = n.visualViewport;
10344
+ const n = It(e), r = sn(e), o = n.visualViewport;
10334
10345
  let s = r.clientWidth, i = r.clientHeight, a = 0, l = 0;
10335
10346
  if (o) {
10336
10347
  s = o.width, i = o.height;
@@ -10346,7 +10357,7 @@ function ky(e, t) {
10346
10357
  }
10347
10358
  const Ay = /* @__PURE__ */ new Set(["absolute", "fixed"]);
10348
10359
  function Py(e, t) {
10349
- const n = Fn(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, s = nn(e) ? rr(e) : tn(1), i = e.clientWidth * s.x, a = e.clientHeight * s.y, l = o * s.x, u = r * s.y;
10360
+ const n = Fn(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, s = rn(e) ? rr(e) : nn(1), i = e.clientWidth * s.x, a = e.clientHeight * s.y, l = o * s.x, u = r * s.y;
10350
10361
  return {
10351
10362
  width: i,
10352
10363
  height: a,
@@ -10359,7 +10370,7 @@ function fl(e, t, n) {
10359
10370
  if (t === "viewport")
10360
10371
  r = ky(e, n);
10361
10372
  else if (t === "document")
10362
- r = jy(on(e));
10373
+ r = jy(sn(e));
10363
10374
  else if (Ut(t))
10364
10375
  r = Py(t, n);
10365
10376
  else {
@@ -10419,12 +10430,12 @@ function My(e) {
10419
10430
  };
10420
10431
  }
10421
10432
  function Dy(e, t, n) {
10422
- const r = nn(t), o = on(t), s = n === "fixed", i = Fn(e, !0, s, t);
10433
+ const r = rn(t), o = sn(t), s = n === "fixed", i = Fn(e, !0, s, t);
10423
10434
  let a = {
10424
10435
  scrollLeft: 0,
10425
10436
  scrollTop: 0
10426
10437
  };
10427
- const l = tn(0);
10438
+ const l = nn(0);
10428
10439
  function u() {
10429
10440
  l.x = Ea(o);
10430
10441
  }
@@ -10434,7 +10445,7 @@ function Dy(e, t, n) {
10434
10445
  l.x = w.x + t.clientLeft, l.y = w.y + t.clientTop;
10435
10446
  } else o && u();
10436
10447
  s && !r && o && u();
10437
- const d = o && !r && !s ? jd(o, a) : tn(0), h = i.left + a.scrollLeft - l.x - d.x, m = i.top + a.scrollTop - l.y - d.y;
10448
+ const d = o && !r && !s ? jd(o, a) : nn(0), h = i.left + a.scrollLeft - l.x - d.x, m = i.top + a.scrollTop - l.y - d.y;
10438
10449
  return {
10439
10450
  x: h,
10440
10451
  y: m,
@@ -10446,18 +10457,18 @@ function oi(e) {
10446
10457
  return Wt(e).position === "static";
10447
10458
  }
10448
10459
  function hl(e, t) {
10449
- if (!nn(e) || Wt(e).position === "fixed")
10460
+ if (!rn(e) || Wt(e).position === "fixed")
10450
10461
  return null;
10451
10462
  if (t)
10452
10463
  return t(e);
10453
10464
  let n = e.offsetParent;
10454
- return on(e) === n && (n = n.ownerDocument.body), n;
10465
+ return sn(e) === n && (n = n.ownerDocument.body), n;
10455
10466
  }
10456
10467
  function Ad(e, t) {
10457
10468
  const n = It(e);
10458
10469
  if (ws(e))
10459
10470
  return n;
10460
- if (!nn(e)) {
10471
+ if (!rn(e)) {
10461
10472
  let o = wn(e);
10462
10473
  for (; o && !ar(o); ) {
10463
10474
  if (Ut(o) && !oi(o))
@@ -10488,7 +10499,7 @@ function Fy(e) {
10488
10499
  }
10489
10500
  const By = {
10490
10501
  convertOffsetParentRelativeRectToViewportRelativeRect: Ny,
10491
- getDocumentElement: on,
10502
+ getDocumentElement: sn,
10492
10503
  getClippingRect: Oy,
10493
10504
  getOffsetParent: Ad,
10494
10505
  getElementRects: Ly,
@@ -10503,7 +10514,7 @@ function Pd(e, t) {
10503
10514
  }
10504
10515
  function $y(e, t) {
10505
10516
  let n = null, r;
10506
- const o = on(e);
10517
+ const o = sn(e);
10507
10518
  function s() {
10508
10519
  var a;
10509
10520
  clearTimeout(r), (a = n) == null || a.disconnect(), n = null;
@@ -10522,17 +10533,17 @@ function $y(e, t) {
10522
10533
  rootMargin: -v + "px " + -x + "px " + -p + "px " + -g + "px",
10523
10534
  threshold: Rt(0, bn(1, l)) || 1
10524
10535
  };
10525
- let E = !0;
10536
+ let R = !0;
10526
10537
  function S(C) {
10527
- const R = C[0].intersectionRatio;
10528
- if (R !== l) {
10529
- if (!E)
10538
+ const E = C[0].intersectionRatio;
10539
+ if (E !== l) {
10540
+ if (!R)
10530
10541
  return i();
10531
- R ? i(!1, R) : r = setTimeout(() => {
10542
+ E ? i(!1, E) : r = setTimeout(() => {
10532
10543
  i(!1, 1e-7);
10533
10544
  }, 1e3);
10534
10545
  }
10535
- R === 1 && !Pd(u, e.getBoundingClientRect()) && i(), E = !1;
10546
+ E === 1 && !Pd(u, e.getBoundingClientRect()) && i(), R = !1;
10536
10547
  }
10537
10548
  try {
10538
10549
  n = new IntersectionObserver(S, {
@@ -10667,18 +10678,18 @@ function Jy(e) {
10667
10678
  const [v, x] = f.useState(null), [p, g] = f.useState(null), b = f.useCallback((_) => {
10668
10679
  _ !== C.current && (C.current = _, x(_));
10669
10680
  }, []), y = f.useCallback((_) => {
10670
- _ !== R.current && (R.current = _, g(_));
10671
- }, []), E = s || v, S = i || p, C = f.useRef(null), R = f.useRef(null), N = f.useRef(d), I = l != null, j = si(l), O = si(o), U = si(u), K = f.useCallback(() => {
10672
- if (!C.current || !R.current)
10681
+ _ !== E.current && (E.current = _, g(_));
10682
+ }, []), R = s || v, S = i || p, C = f.useRef(null), E = f.useRef(null), N = f.useRef(d), I = l != null, j = si(l), M = si(o), U = si(u), K = f.useCallback(() => {
10683
+ if (!C.current || !E.current)
10673
10684
  return;
10674
10685
  const _ = {
10675
10686
  placement: t,
10676
10687
  strategy: n,
10677
10688
  middleware: m
10678
10689
  };
10679
- O.current && (_.platform = O.current), Yy(C.current, R.current, _).then((D) => {
10690
+ M.current && (_.platform = M.current), Yy(C.current, E.current, _).then((L) => {
10680
10691
  const Y = {
10681
- ...D,
10692
+ ...L,
10682
10693
  // The floating element's position may be recomputed while it's closed
10683
10694
  // but still mounted (such as when transitioning out). To ensure
10684
10695
  // `isPositioned` will be `false` initially on the next open, avoid
@@ -10689,7 +10700,7 @@ function Jy(e) {
10689
10700
  h(Y);
10690
10701
  }));
10691
10702
  });
10692
- }, [m, t, n, O, U]);
10703
+ }, [m, t, n, M, U]);
10693
10704
  jo(() => {
10694
10705
  u === !1 && N.current.isPositioned && (N.current.isPositioned = !1, h((_) => ({
10695
10706
  ..._,
@@ -10700,48 +10711,48 @@ function Jy(e) {
10700
10711
  jo(() => (P.current = !0, () => {
10701
10712
  P.current = !1;
10702
10713
  }), []), jo(() => {
10703
- if (E && (C.current = E), S && (R.current = S), E && S) {
10714
+ if (R && (C.current = R), S && (E.current = S), R && S) {
10704
10715
  if (j.current)
10705
- return j.current(E, S, K);
10716
+ return j.current(R, S, K);
10706
10717
  K();
10707
10718
  }
10708
- }, [E, S, K, j, I]);
10709
- const M = f.useMemo(() => ({
10719
+ }, [R, S, K, j, I]);
10720
+ const O = f.useMemo(() => ({
10710
10721
  reference: C,
10711
- floating: R,
10722
+ floating: E,
10712
10723
  setReference: b,
10713
10724
  setFloating: y
10714
- }), [b, y]), L = f.useMemo(() => ({
10715
- reference: E,
10725
+ }), [b, y]), D = f.useMemo(() => ({
10726
+ reference: R,
10716
10727
  floating: S
10717
- }), [E, S]), oe = f.useMemo(() => {
10728
+ }), [R, S]), ne = f.useMemo(() => {
10718
10729
  const _ = {
10719
10730
  position: n,
10720
10731
  left: 0,
10721
10732
  top: 0
10722
10733
  };
10723
- if (!L.floating)
10734
+ if (!D.floating)
10724
10735
  return _;
10725
- const D = ml(L.floating, d.x), Y = ml(L.floating, d.y);
10736
+ const L = ml(D.floating, d.x), Y = ml(D.floating, d.y);
10726
10737
  return a ? {
10727
10738
  ..._,
10728
- transform: "translate(" + D + "px, " + Y + "px)",
10729
- ..._d(L.floating) >= 1.5 && {
10739
+ transform: "translate(" + L + "px, " + Y + "px)",
10740
+ ..._d(D.floating) >= 1.5 && {
10730
10741
  willChange: "transform"
10731
10742
  }
10732
10743
  } : {
10733
10744
  position: n,
10734
- left: D,
10745
+ left: L,
10735
10746
  top: Y
10736
10747
  };
10737
- }, [n, a, L.floating, d.x, d.y]);
10748
+ }, [n, a, D.floating, d.x, d.y]);
10738
10749
  return f.useMemo(() => ({
10739
10750
  ...d,
10740
10751
  update: K,
10741
- refs: M,
10742
- elements: L,
10743
- floatingStyles: oe
10744
- }), [d, K, M, L, oe]);
10752
+ refs: O,
10753
+ elements: D,
10754
+ floatingStyles: ne
10755
+ }), [d, K, O, D, ne]);
10745
10756
  }
10746
10757
  const Zy = (e) => {
10747
10758
  function t(n) {
@@ -10858,12 +10869,12 @@ var Ia = "PopperContent", [l0, u0] = Dd(Ia), Hd = f.forwardRef(
10858
10869
  updatePositionStrategy: w = "optimized",
10859
10870
  onPlaced: v,
10860
10871
  ...x
10861
- } = e, p = Ld(Ia, n), [g, b] = f.useState(null), y = Ee(t, (Ae) => b(Ae)), [E, S] = f.useState(null), C = Md(E), R = (C == null ? void 0 : C.width) ?? 0, N = (C == null ? void 0 : C.height) ?? 0, I = r + (s !== "center" ? "-" + s : ""), j = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, O = Array.isArray(u) ? u : [u], U = O.length > 0, K = {
10872
+ } = e, p = Ld(Ia, n), [g, b] = f.useState(null), y = Ee(t, (Ae) => b(Ae)), [R, S] = f.useState(null), C = Md(R), E = (C == null ? void 0 : C.width) ?? 0, N = (C == null ? void 0 : C.height) ?? 0, I = r + (s !== "center" ? "-" + s : ""), j = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, M = Array.isArray(u) ? u : [u], U = M.length > 0, K = {
10862
10873
  padding: j,
10863
- boundary: O.filter(f0),
10874
+ boundary: M.filter(f0),
10864
10875
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
10865
10876
  altBoundary: U
10866
- }, { refs: P, floatingStyles: M, placement: L, isPositioned: oe, middlewareData: _ } = Jy({
10877
+ }, { refs: P, floatingStyles: O, placement: D, isPositioned: ne, middlewareData: _ } = Jy({
10867
10878
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
10868
10879
  strategy: "fixed",
10869
10880
  placement: I,
@@ -10889,14 +10900,14 @@ var Ia = "PopperContent", [l0, u0] = Dd(Ia), Hd = f.forwardRef(
10889
10900
  fe.setProperty("--radix-popper-available-width", `${je}px`), fe.setProperty("--radix-popper-available-height", `${ae}px`), fe.setProperty("--radix-popper-anchor-width", `${Ne}px`), fe.setProperty("--radix-popper-anchor-height", `${Se}px`);
10890
10901
  }
10891
10902
  }),
10892
- E && s0({ element: E, padding: a }),
10893
- h0({ arrowWidth: R, arrowHeight: N }),
10903
+ R && s0({ element: R, padding: a }),
10904
+ h0({ arrowWidth: E, arrowHeight: N }),
10894
10905
  m && o0({ strategy: "referenceHidden", ...K })
10895
10906
  ]
10896
- }), [D, Y] = Wd(L), V = ct(v);
10907
+ }), [L, Y] = Wd(D), V = ct(v);
10897
10908
  st(() => {
10898
- oe && (V == null || V());
10899
- }, [oe, V]);
10909
+ ne && (V == null || V());
10910
+ }, [ne, V]);
10900
10911
  const ee = ($ = _.arrow) == null ? void 0 : $.x, B = (A = _.arrow) == null ? void 0 : A.y, Z = ((z = _.arrow) == null ? void 0 : z.centerOffset) !== 0, [pe, he] = f.useState();
10901
10912
  return st(() => {
10902
10913
  g && he(window.getComputedStyle(g).zIndex);
@@ -10906,8 +10917,8 @@ var Ia = "PopperContent", [l0, u0] = Dd(Ia), Hd = f.forwardRef(
10906
10917
  ref: P.setFloating,
10907
10918
  "data-radix-popper-content-wrapper": "",
10908
10919
  style: {
10909
- ...M,
10910
- transform: oe ? M.transform : "translate(0, -200%)",
10920
+ ...O,
10921
+ transform: ne ? O.transform : "translate(0, -200%)",
10911
10922
  // keep off the page when measuring
10912
10923
  minWidth: "max-content",
10913
10924
  zIndex: pe,
@@ -10928,7 +10939,7 @@ var Ia = "PopperContent", [l0, u0] = Dd(Ia), Hd = f.forwardRef(
10928
10939
  l0,
10929
10940
  {
10930
10941
  scope: n,
10931
- placedSide: D,
10942
+ placedSide: L,
10932
10943
  onArrowChange: S,
10933
10944
  arrowX: ee,
10934
10945
  arrowY: B,
@@ -10936,7 +10947,7 @@ var Ia = "PopperContent", [l0, u0] = Dd(Ia), Hd = f.forwardRef(
10936
10947
  children: /* @__PURE__ */ c.jsx(
10937
10948
  ve.div,
10938
10949
  {
10939
- "data-side": D,
10950
+ "data-side": L,
10940
10951
  "data-align": Y,
10941
10952
  ...x,
10942
10953
  ref: y,
@@ -10944,7 +10955,7 @@ var Ia = "PopperContent", [l0, u0] = Dd(Ia), Hd = f.forwardRef(
10944
10955
  ...x.style,
10945
10956
  // if the PopperContent hasn't been placed yet (not all measurements done)
10946
10957
  // we prevent animations so that users's animation don't kick in too early referring wrong sides
10947
- animation: oe ? void 0 : "none"
10958
+ animation: ne ? void 0 : "none"
10948
10959
  }
10949
10960
  }
10950
10961
  )
@@ -11047,7 +11058,7 @@ var b0 = f.forwardRef((e, t) => {
11047
11058
  defaultProp: a ?? null,
11048
11059
  onChange: l,
11049
11060
  caller: eo
11050
- }), [g, b] = f.useState(!1), y = ct(u), E = Vd(n), S = f.useRef(!1), [C, R] = f.useState(0);
11061
+ }), [g, b] = f.useState(!1), y = ct(u), R = Vd(n), S = f.useRef(!1), [C, E] = f.useState(0);
11051
11062
  return f.useEffect(() => {
11052
11063
  const N = m.current;
11053
11064
  if (N)
@@ -11066,11 +11077,11 @@ var b0 = f.forwardRef((e, t) => {
11066
11077
  ),
11067
11078
  onItemShiftTab: f.useCallback(() => b(!0), []),
11068
11079
  onFocusableItemAdd: f.useCallback(
11069
- () => R((N) => N + 1),
11080
+ () => E((N) => N + 1),
11070
11081
  []
11071
11082
  ),
11072
11083
  onFocusableItemRemove: f.useCallback(
11073
- () => R((N) => N - 1),
11084
+ () => E((N) => N - 1),
11074
11085
  []
11075
11086
  ),
11076
11087
  children: /* @__PURE__ */ c.jsx(
@@ -11089,10 +11100,10 @@ var b0 = f.forwardRef((e, t) => {
11089
11100
  if (N.target === N.currentTarget && I && !g) {
11090
11101
  const j = new CustomEvent(ii, p0);
11091
11102
  if (N.currentTarget.dispatchEvent(j), !j.defaultPrevented) {
11092
- const O = E().filter((L) => L.focusable), U = O.find((L) => L.active), K = O.find((L) => L.id === x), M = [U, K, ...O].filter(
11103
+ const M = R().filter((D) => D.focusable), U = M.find((D) => D.active), K = M.find((D) => D.id === x), O = [U, K, ...M].filter(
11093
11104
  Boolean
11094
- ).map((L) => L.ref.current);
11095
- Xd(M, d);
11105
+ ).map((D) => D.ref.current);
11106
+ Xd(O, d);
11096
11107
  }
11097
11108
  }
11098
11109
  S.current = !1;
@@ -11143,12 +11154,12 @@ var b0 = f.forwardRef((e, t) => {
11143
11154
  if (g !== void 0) {
11144
11155
  if (p.metaKey || p.ctrlKey || p.altKey || p.shiftKey) return;
11145
11156
  p.preventDefault();
11146
- let y = m().filter((E) => E.focusable).map((E) => E.ref.current);
11157
+ let y = m().filter((R) => R.focusable).map((R) => R.ref.current);
11147
11158
  if (g === "last") y.reverse();
11148
11159
  else if (g === "prev" || g === "next") {
11149
11160
  g === "prev" && y.reverse();
11150
- const E = y.indexOf(p.currentTarget);
11151
- y = d.loop ? C0(y, E + 1) : y.slice(E + 1);
11161
+ const R = y.indexOf(p.currentTarget);
11162
+ y = d.loop ? C0(y, R + 1) : y.slice(R + 1);
11152
11163
  }
11153
11164
  setTimeout(() => Xd(y));
11154
11165
  }
@@ -11301,17 +11312,17 @@ var Mt = "MenuContent", [D0, Ma] = Un(Mt), rf = f.forwardRef(
11301
11312
  onDismiss: w,
11302
11313
  disableOutsideScroll: v,
11303
11314
  ...x
11304
- } = e, p = Wn(Mt, n), g = no(Mt, n), b = Ss(n), y = Qd(n), E = k0(n), [S, C] = f.useState(null), R = f.useRef(null), N = Ee(t, R, p.onContentChange), I = f.useRef(0), j = f.useRef(""), O = f.useRef(0), U = f.useRef(null), K = f.useRef("right"), P = f.useRef(0), M = v ? hs : f.Fragment, L = v ? { as: B0, allowPinchZoom: !0 } : void 0, oe = (D) => {
11315
+ } = e, p = Wn(Mt, n), g = no(Mt, n), b = Ss(n), y = Qd(n), R = k0(n), [S, C] = f.useState(null), E = f.useRef(null), N = Ee(t, E, p.onContentChange), I = f.useRef(0), j = f.useRef(""), M = f.useRef(0), U = f.useRef(null), K = f.useRef("right"), P = f.useRef(0), O = v ? hs : f.Fragment, D = v ? { as: B0, allowPinchZoom: !0 } : void 0, ne = (L) => {
11305
11316
  var $, A;
11306
- const Y = j.current + D, V = E().filter((z) => !z.disabled), ee = document.activeElement, B = ($ = V.find((z) => z.ref.current === ee)) == null ? void 0 : $.textValue, Z = V.map((z) => z.textValue), pe = J0(Z, Y, B), he = (A = V.find((z) => z.textValue === pe)) == null ? void 0 : A.ref.current;
11317
+ const Y = j.current + L, V = R().filter((z) => !z.disabled), ee = document.activeElement, B = ($ = V.find((z) => z.ref.current === ee)) == null ? void 0 : $.textValue, Z = V.map((z) => z.textValue), pe = J0(Z, Y, B), he = (A = V.find((z) => z.textValue === pe)) == null ? void 0 : A.ref.current;
11307
11318
  (function z(J) {
11308
11319
  j.current = J, window.clearTimeout(I.current), J !== "" && (I.current = window.setTimeout(() => z(""), 1e3));
11309
11320
  })(Y), he && setTimeout(() => he.focus());
11310
11321
  };
11311
11322
  f.useEffect(() => () => window.clearTimeout(I.current), []), pa();
11312
- const _ = f.useCallback((D) => {
11323
+ const _ = f.useCallback((L) => {
11313
11324
  var V, ee;
11314
- return K.current === ((V = U.current) == null ? void 0 : V.side) && Q0(D, (ee = U.current) == null ? void 0 : ee.area);
11325
+ return K.current === ((V = U.current) == null ? void 0 : V.side) && Q0(L, (ee = U.current) == null ? void 0 : ee.area);
11315
11326
  }, []);
11316
11327
  return /* @__PURE__ */ c.jsx(
11317
11328
  D0,
@@ -11319,36 +11330,36 @@ var Mt = "MenuContent", [D0, Ma] = Un(Mt), rf = f.forwardRef(
11319
11330
  scope: n,
11320
11331
  searchRef: j,
11321
11332
  onItemEnter: f.useCallback(
11322
- (D) => {
11323
- _(D) && D.preventDefault();
11333
+ (L) => {
11334
+ _(L) && L.preventDefault();
11324
11335
  },
11325
11336
  [_]
11326
11337
  ),
11327
11338
  onItemLeave: f.useCallback(
11328
- (D) => {
11339
+ (L) => {
11329
11340
  var Y;
11330
- _(D) || ((Y = R.current) == null || Y.focus(), C(null));
11341
+ _(L) || ((Y = E.current) == null || Y.focus(), C(null));
11331
11342
  },
11332
11343
  [_]
11333
11344
  ),
11334
11345
  onTriggerLeave: f.useCallback(
11335
- (D) => {
11336
- _(D) && D.preventDefault();
11346
+ (L) => {
11347
+ _(L) && L.preventDefault();
11337
11348
  },
11338
11349
  [_]
11339
11350
  ),
11340
- pointerGraceTimerRef: O,
11341
- onPointerGraceIntentChange: f.useCallback((D) => {
11342
- U.current = D;
11351
+ pointerGraceTimerRef: M,
11352
+ onPointerGraceIntentChange: f.useCallback((L) => {
11353
+ U.current = L;
11343
11354
  }, []),
11344
- children: /* @__PURE__ */ c.jsx(M, { ...L, children: /* @__PURE__ */ c.jsx(
11355
+ children: /* @__PURE__ */ c.jsx(O, { ...D, children: /* @__PURE__ */ c.jsx(
11345
11356
  us,
11346
11357
  {
11347
11358
  asChild: !0,
11348
11359
  trapped: o,
11349
- onMountAutoFocus: Q(s, (D) => {
11360
+ onMountAutoFocus: Q(s, (L) => {
11350
11361
  var Y;
11351
- D.preventDefault(), (Y = R.current) == null || Y.focus({ preventScroll: !0 });
11362
+ L.preventDefault(), (Y = E.current) == null || Y.focus({ preventScroll: !0 });
11352
11363
  }),
11353
11364
  onUnmountAutoFocus: i,
11354
11365
  children: /* @__PURE__ */ c.jsx(
@@ -11371,8 +11382,8 @@ var Mt = "MenuContent", [D0, Ma] = Un(Mt), rf = f.forwardRef(
11371
11382
  loop: r,
11372
11383
  currentTabStopId: S,
11373
11384
  onCurrentTabStopIdChange: C,
11374
- onEntryFocus: Q(l, (D) => {
11375
- g.isUsingKeyboardRef.current || D.preventDefault();
11385
+ onEntryFocus: Q(l, (L) => {
11386
+ g.isUsingKeyboardRef.current || L.preventDefault();
11376
11387
  }),
11377
11388
  preventScrollOnEntryFocus: !0,
11378
11389
  children: /* @__PURE__ */ c.jsx(
@@ -11387,25 +11398,25 @@ var Mt = "MenuContent", [D0, Ma] = Un(Mt), rf = f.forwardRef(
11387
11398
  ...x,
11388
11399
  ref: N,
11389
11400
  style: { outline: "none", ...x.style },
11390
- onKeyDown: Q(x.onKeyDown, (D) => {
11391
- const V = D.target.closest("[data-radix-menu-content]") === D.currentTarget, ee = D.ctrlKey || D.altKey || D.metaKey, B = D.key.length === 1;
11392
- V && (D.key === "Tab" && D.preventDefault(), !ee && B && oe(D.key));
11393
- const Z = R.current;
11394
- if (D.target !== Z || !N0.includes(D.key)) return;
11395
- D.preventDefault();
11396
- const he = E().filter(($) => !$.disabled).map(($) => $.ref.current);
11397
- Jd.includes(D.key) && he.reverse(), q0(he);
11401
+ onKeyDown: Q(x.onKeyDown, (L) => {
11402
+ const V = L.target.closest("[data-radix-menu-content]") === L.currentTarget, ee = L.ctrlKey || L.altKey || L.metaKey, B = L.key.length === 1;
11403
+ V && (L.key === "Tab" && L.preventDefault(), !ee && B && ne(L.key));
11404
+ const Z = E.current;
11405
+ if (L.target !== Z || !N0.includes(L.key)) return;
11406
+ L.preventDefault();
11407
+ const he = R().filter(($) => !$.disabled).map(($) => $.ref.current);
11408
+ Jd.includes(L.key) && he.reverse(), q0(he);
11398
11409
  }),
11399
- onBlur: Q(e.onBlur, (D) => {
11400
- D.currentTarget.contains(D.target) || (window.clearTimeout(I.current), j.current = "");
11410
+ onBlur: Q(e.onBlur, (L) => {
11411
+ L.currentTarget.contains(L.target) || (window.clearTimeout(I.current), j.current = "");
11401
11412
  }),
11402
11413
  onPointerMove: Q(
11403
11414
  e.onPointerMove,
11404
- Hr((D) => {
11405
- const Y = D.target, V = P.current !== D.clientX;
11406
- if (D.currentTarget.contains(Y) && V) {
11407
- const ee = D.clientX > P.current ? "right" : "left";
11408
- K.current = ee, P.current = D.clientX;
11415
+ Hr((L) => {
11416
+ const Y = L.target, V = P.current !== L.clientX;
11417
+ if (L.currentTarget.contains(Y) && V) {
11418
+ const ee = L.clientX > P.current ? "right" : "left";
11419
+ K.current = ee, P.current = L.clientX;
11409
11420
  }
11410
11421
  })
11411
11422
  )
@@ -12068,18 +12079,18 @@ function ko({
12068
12079
  streamingAssistantId: g,
12069
12080
  error: b,
12070
12081
  send: y,
12071
- stop: E,
12082
+ stop: R,
12072
12083
  lastCheckpointId: S,
12073
12084
  lastCheckpointNs: C,
12074
- listCheckpoints: R,
12085
+ listCheckpoints: E,
12075
12086
  navigateToCheckpoint: N,
12076
12087
  returnToLatest: I,
12077
12088
  hasMoreHistory: j,
12078
- isLoadingHistory: O,
12089
+ isLoadingHistory: M,
12079
12090
  loadOlderMessages: U,
12080
12091
  isPostStreamFetch: K,
12081
12092
  api: P
12082
- } = Yi(), [M, L] = de(null), [oe, _] = de(""), [D, Y] = de(null), [V, ee] = de([]), [B, Z] = de(!1), [pe, he] = de(null), [$, A] = de(null), [z, J] = de(!1), [ce, ie] = de(null), [Ae, _e] = de([]), [je, ae] = de(null), [Ne, Se] = de(null), [fe, Ce] = de(!1), Be = Ue(null), ot = Ue(null), et = Ue(null), [xt, it] = de("desktop");
12093
+ } = Yi(), [O, D] = de(null), [ne, _] = de(""), [L, Y] = de(null), [V, ee] = de([]), [B, Z] = de(!1), [pe, he] = de(null), [$, A] = de(null), [z, J] = de(!1), [ce, ie] = de(null), [Ae, _e] = de([]), [je, ae] = de(null), [Ne, Se] = de(null), [fe, Ce] = de(!1), Be = Ue(null), ot = Ue(null), et = Ue(null), [xt, it] = de("desktop");
12083
12094
  Ye(() => {
12084
12095
  const te = () => {
12085
12096
  const le = window.innerWidth;
@@ -12098,7 +12109,7 @@ function ko({
12098
12109
  checkpointNs: C ?? null
12099
12110
  }, Oe = et.current;
12100
12111
  if (!(Oe && Oe.threadId === le.threadId && Oe.checkpointId === le.checkpointId && Oe.checkpointNs === le.checkpointNs))
12101
- return R(v).then((qe) => {
12112
+ return E(v).then((qe) => {
12102
12113
  var oo;
12103
12114
  if (te) return;
12104
12115
  const Nn = ((qe == null ? void 0 : qe.checkpoints) ?? []).slice().sort((qt, Kn) => new Date(Kn.createdAt).getTime() - new Date(qt.createdAt).getTime());
@@ -12115,17 +12126,17 @@ function ko({
12115
12126
  }), () => {
12116
12127
  te = !0;
12117
12128
  };
12118
- }, [v, S, C, je, R]), Ye(() => {
12129
+ }, [v, S, C, je, E]), Ye(() => {
12119
12130
  S && (ae(S), Se(C ?? null));
12120
12131
  }, [S, C]);
12121
- const an = ze(async () => {
12122
- if (!(!j || O))
12132
+ const cn = ze(async () => {
12133
+ if (!(!j || M))
12123
12134
  try {
12124
12135
  await U();
12125
12136
  } catch (te) {
12126
12137
  console.warn("loadOlderMessages failed", te);
12127
12138
  }
12128
- }, [j, O, U]);
12139
+ }, [j, M, U]);
12129
12140
  Ye(() => {
12130
12141
  (async () => {
12131
12142
  try {
@@ -12146,7 +12157,7 @@ function ko({
12146
12157
  } catch (le) {
12147
12158
  return (le == null ? void 0 : le.message) || "Invalid message";
12148
12159
  }
12149
- }, ne = (te) => {
12160
+ }, re = (te) => {
12150
12161
  const le = te.content || [], Oe = le.filter((qe) => qe.type === "text").map((qe) => qe.text).join("");
12151
12162
  if (Oe) return Oe;
12152
12163
  try {
@@ -12168,31 +12179,31 @@ function ko({
12168
12179
  await y(le || "", {
12169
12180
  checkpointId: je ?? S ?? void 0,
12170
12181
  checkpointNs: Ne ?? C ?? void 0,
12171
- payloadExtras: M ? { edit: !0, originalMessageId: M } : void 0,
12182
+ payloadExtras: O ? { edit: !0, originalMessageId: O } : void 0,
12172
12183
  attachments: V
12173
- }), h == null || h(le), Y(null), ee([]), L(null), _("");
12184
+ }), h == null || h(le), Y(null), ee([]), D(null), _("");
12174
12185
  } catch (Oe) {
12175
12186
  const qe = (Oe == null ? void 0 : Oe.message) || "Failed to send message";
12176
12187
  Y(qe), w == null || w(qe);
12177
12188
  }
12178
12189
  }
12179
12190
  }, Xe = q.useCallback((te, le) => {
12180
- u && (L(te), _(le), Y(null));
12191
+ u && (D(te), _(le), Y(null));
12181
12192
  }, [u]), Re = q.useCallback(() => {
12182
- L(null), _(""), Y(null);
12193
+ D(null), _(""), Y(null);
12183
12194
  }, []), ht = ze((te, le) => {
12184
12195
  Xe(te, le);
12185
12196
  }, [Xe]), jt = ze((te) => {
12186
12197
  for (let le = te - 1; le >= 0; le--)
12187
12198
  if (x[le].role === "user") {
12188
- const Oe = ne(x[le]);
12199
+ const Oe = re(x[le]);
12189
12200
  Oe && y(Oe, {
12190
12201
  checkpointId: je ?? S ?? void 0,
12191
12202
  checkpointNs: Ne ?? C ?? void 0
12192
12203
  });
12193
12204
  break;
12194
12205
  }
12195
- }, [x, y, je, Ne, S, C, ne]), En = (te) => {
12206
+ }, [x, y, je, Ne, S, C, re]), En = (te) => {
12196
12207
  const le = Array.from(te.target.files || []);
12197
12208
  ee((Oe) => [...Oe, ...le]);
12198
12209
  }, lt = (te) => ee((le) => le.filter((Oe, qe) => te !== qe)), Tt = async (te) => {
@@ -12232,8 +12243,8 @@ function ko({
12232
12243
  Ce(!1);
12233
12244
  }
12234
12245
  }
12235
- }, cn = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${d.container || ""}`, Yt = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-y-auto overflow-x-auto overscroll-contain break-words break-anywhere p-4 bg-transparent ${d.messagesArea || ""}`, hn = `flex-shrink-0 w-full border-t p-4 bg-transparent ${d.inputArea || ""}`;
12236
- return /* @__PURE__ */ c.jsxs("div", { className: cn, children: [
12246
+ }, ln = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${d.container || ""}`, Yt = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-y-auto overflow-x-auto overscroll-contain break-words break-anywhere p-4 bg-transparent ${d.messagesArea || ""}`, hn = `flex-shrink-0 w-full border-t p-4 bg-transparent ${d.inputArea || ""}`;
12247
+ return /* @__PURE__ */ c.jsxs("div", { className: ln, children: [
12237
12248
  !!b && !z && /* @__PURE__ */ c.jsxs("div", { className: "flex-shrink-0 bg-red-50 border border-red-200 text-red-800 px-4 py-2 text-sm flex items-center justify-between", children: [
12238
12249
  /* @__PURE__ */ c.jsx("span", { children: b }),
12239
12250
  /* @__PURE__ */ c.jsx(
@@ -12281,9 +12292,9 @@ function ko({
12281
12292
  followNewMessages: i,
12282
12293
  layoutSize: xt,
12283
12294
  enableMessageEditing: u,
12284
- editingMessageId: M,
12295
+ editingMessageId: O,
12285
12296
  onStartReached: () => {
12286
- an();
12297
+ cn();
12287
12298
  },
12288
12299
  onEdit: ht,
12289
12300
  onRegenerate: jt,
@@ -12293,7 +12304,7 @@ function ko({
12293
12304
  }
12294
12305
  ),
12295
12306
  /* @__PURE__ */ c.jsxs("div", { className: hn, children: [
12296
- M && /* @__PURE__ */ c.jsx("div", { className: "mb-3 p-3 bg-blue-50 border border-blue-200 rounded-lg", children: /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
12307
+ O && /* @__PURE__ */ c.jsx("div", { className: "mb-3 p-3 bg-blue-50 border border-blue-200 rounded-lg", children: /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
12297
12308
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2", children: [
12298
12309
  /* @__PURE__ */ c.jsx(Rl, { size: 16, className: "text-blue-600" }),
12299
12310
  /* @__PURE__ */ c.jsx("span", { className: "text-sm font-medium text-blue-800", children: "Editing message" })
@@ -12356,7 +12367,7 @@ function ko({
12356
12367
  pe && !B && /* @__PURE__ */ c.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: pe })
12357
12368
  ] })
12358
12369
  ] }),
12359
- D && /* @__PURE__ */ c.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: D }),
12370
+ L && /* @__PURE__ */ c.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: L }),
12360
12371
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-end gap-2", children: [
12361
12372
  (a || l) && /* @__PURE__ */ c.jsxs(MS, { children: [
12362
12373
  /* @__PURE__ */ c.jsx(DS, { asChild: !0, children: /* @__PURE__ */ c.jsx(
@@ -12398,17 +12409,17 @@ function ko({
12398
12409
  /* @__PURE__ */ c.jsx("div", { className: "flex-1", children: /* @__PURE__ */ c.jsx(
12399
12410
  pv,
12400
12411
  {
12401
- initialValue: oe,
12402
- editingMessageId: M,
12403
- placeholder: M ? "Edit your message..." : t,
12412
+ initialValue: ne,
12413
+ editingMessageId: O,
12414
+ placeholder: O ? "Edit your message..." : t,
12404
12415
  isStreaming: p,
12405
12416
  disabled: !1,
12406
12417
  maxLength: Io,
12407
12418
  onSend: $e,
12408
12419
  onCancelEdit: Re,
12409
- onStop: E,
12420
+ onStop: R,
12410
12421
  allowEmptySend: V.length > 0,
12411
- textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${M ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${D ? "border-red-400" : ""} ${d.textarea || ""}`
12422
+ textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${O ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${L ? "border-red-400" : ""} ${d.textarea || ""}`
12412
12423
  }
12413
12424
  ) })
12414
12425
  ] })
@@ -12444,7 +12455,7 @@ var $a = "ScrollArea", [Gf, xR] = Gt($a), [WS, Lt] = Gf($a), Kf = f.forwardRef(
12444
12455
  dir: o,
12445
12456
  scrollHideDelay: s = 600,
12446
12457
  ...i
12447
- } = e, [a, l] = f.useState(null), [u, d] = f.useState(null), [h, m] = f.useState(null), [w, v] = f.useState(null), [x, p] = f.useState(null), [g, b] = f.useState(0), [y, E] = f.useState(0), [S, C] = f.useState(!1), [R, N] = f.useState(!1), I = Ee(t, (O) => l(O)), j = xs(o);
12458
+ } = e, [a, l] = f.useState(null), [u, d] = f.useState(null), [h, m] = f.useState(null), [w, v] = f.useState(null), [x, p] = f.useState(null), [g, b] = f.useState(0), [y, R] = f.useState(0), [S, C] = f.useState(!1), [E, N] = f.useState(!1), I = Ee(t, (M) => l(M)), j = xs(o);
12448
12459
  return /* @__PURE__ */ c.jsx(
12449
12460
  WS,
12450
12461
  {
@@ -12463,10 +12474,10 @@ var $a = "ScrollArea", [Gf, xR] = Gt($a), [WS, Lt] = Gf($a), Kf = f.forwardRef(
12463
12474
  onScrollbarXEnabledChange: C,
12464
12475
  scrollbarY: x,
12465
12476
  onScrollbarYChange: p,
12466
- scrollbarYEnabled: R,
12477
+ scrollbarYEnabled: E,
12467
12478
  onScrollbarYEnabledChange: N,
12468
12479
  onCornerWidthChange: b,
12469
- onCornerHeightChange: E,
12480
+ onCornerHeightChange: R,
12470
12481
  children: /* @__PURE__ */ c.jsx(
12471
12482
  ve.div,
12472
12483
  {
@@ -12529,17 +12540,17 @@ var Yf = "ScrollAreaViewport", qf = f.forwardRef(
12529
12540
  }
12530
12541
  );
12531
12542
  qf.displayName = Yf;
12532
- var sn = "ScrollAreaScrollbar", Ha = f.forwardRef(
12543
+ var an = "ScrollAreaScrollbar", Ha = f.forwardRef(
12533
12544
  (e, t) => {
12534
- const { forceMount: n, ...r } = e, o = Lt(sn, e.__scopeScrollArea), { onScrollbarXEnabledChange: s, onScrollbarYEnabledChange: i } = o, a = e.orientation === "horizontal";
12545
+ const { forceMount: n, ...r } = e, o = Lt(an, e.__scopeScrollArea), { onScrollbarXEnabledChange: s, onScrollbarYEnabledChange: i } = o, a = e.orientation === "horizontal";
12535
12546
  return f.useEffect(() => (a ? s(!0) : i(!0), () => {
12536
12547
  a ? s(!1) : i(!1);
12537
12548
  }), [a, s, i]), o.type === "hover" ? /* @__PURE__ */ c.jsx(VS, { ...r, ref: t, forceMount: n }) : o.type === "scroll" ? /* @__PURE__ */ c.jsx(GS, { ...r, ref: t, forceMount: n }) : o.type === "auto" ? /* @__PURE__ */ c.jsx(Xf, { ...r, ref: t, forceMount: n }) : o.type === "always" ? /* @__PURE__ */ c.jsx(za, { ...r, ref: t }) : null;
12538
12549
  }
12539
12550
  );
12540
- Ha.displayName = sn;
12551
+ Ha.displayName = an;
12541
12552
  var VS = f.forwardRef((e, t) => {
12542
- const { forceMount: n, ...r } = e, o = Lt(sn, e.__scopeScrollArea), [s, i] = f.useState(!1);
12553
+ const { forceMount: n, ...r } = e, o = Lt(an, e.__scopeScrollArea), [s, i] = f.useState(!1);
12543
12554
  return f.useEffect(() => {
12544
12555
  const a = o.scrollArea;
12545
12556
  let l = 0;
@@ -12562,7 +12573,7 @@ var VS = f.forwardRef((e, t) => {
12562
12573
  }
12563
12574
  ) });
12564
12575
  }), GS = f.forwardRef((e, t) => {
12565
- const { forceMount: n, ...r } = e, o = Lt(sn, e.__scopeScrollArea), s = e.orientation === "horizontal", i = Es(() => l("SCROLL_END"), 100), [a, l] = US("hidden", {
12576
+ const { forceMount: n, ...r } = e, o = Lt(an, e.__scopeScrollArea), s = e.orientation === "horizontal", i = Es(() => l("SCROLL_END"), 100), [a, l] = US("hidden", {
12566
12577
  hidden: {
12567
12578
  SCROLL: "scrolling"
12568
12579
  },
@@ -12606,7 +12617,7 @@ var VS = f.forwardRef((e, t) => {
12606
12617
  }
12607
12618
  ) });
12608
12619
  }), Xf = f.forwardRef((e, t) => {
12609
- const n = Lt(sn, e.__scopeScrollArea), { forceMount: r, ...o } = e, [s, i] = f.useState(!1), a = e.orientation === "horizontal", l = Es(() => {
12620
+ const n = Lt(an, e.__scopeScrollArea), { forceMount: r, ...o } = e, [s, i] = f.useState(!1), a = e.orientation === "horizontal", l = Es(() => {
12610
12621
  if (n.viewport) {
12611
12622
  const u = n.viewport.offsetWidth < n.viewport.scrollWidth, d = n.viewport.offsetHeight < n.viewport.scrollHeight;
12612
12623
  i(a ? u : d);
@@ -12621,7 +12632,7 @@ var VS = f.forwardRef((e, t) => {
12621
12632
  }
12622
12633
  ) });
12623
12634
  }), za = f.forwardRef((e, t) => {
12624
- const { orientation: n = "vertical", ...r } = e, o = Lt(sn, e.__scopeScrollArea), s = f.useRef(null), i = f.useRef(0), [a, l] = f.useState({
12635
+ const { orientation: n = "vertical", ...r } = e, o = Lt(an, e.__scopeScrollArea), s = f.useRef(null), i = f.useRef(0), [a, l] = f.useState({
12625
12636
  content: 0,
12626
12637
  viewport: 0,
12627
12638
  scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
@@ -12675,7 +12686,7 @@ var VS = f.forwardRef((e, t) => {
12675
12686
  }
12676
12687
  ) : null;
12677
12688
  }), KS = f.forwardRef((e, t) => {
12678
- const { sizes: n, onSizesChange: r, ...o } = e, s = Lt(sn, e.__scopeScrollArea), [i, a] = f.useState(), l = f.useRef(null), u = Ee(t, l, s.onScrollbarXChange);
12689
+ const { sizes: n, onSizesChange: r, ...o } = e, s = Lt(an, e.__scopeScrollArea), [i, a] = f.useState(), l = f.useRef(null), u = Ee(t, l, s.onScrollbarXChange);
12679
12690
  return f.useEffect(() => {
12680
12691
  l.current && a(getComputedStyle(l.current));
12681
12692
  }, [l]), /* @__PURE__ */ c.jsx(
@@ -12714,7 +12725,7 @@ var VS = f.forwardRef((e, t) => {
12714
12725
  }
12715
12726
  );
12716
12727
  }), YS = f.forwardRef((e, t) => {
12717
- const { sizes: n, onSizesChange: r, ...o } = e, s = Lt(sn, e.__scopeScrollArea), [i, a] = f.useState(), l = f.useRef(null), u = Ee(t, l, s.onScrollbarYChange);
12728
+ const { sizes: n, onSizesChange: r, ...o } = e, s = Lt(an, e.__scopeScrollArea), [i, a] = f.useState(), l = f.useRef(null), u = Ee(t, l, s.onScrollbarYChange);
12718
12729
  return f.useEffect(() => {
12719
12730
  l.current && a(getComputedStyle(l.current));
12720
12731
  }, [l]), /* @__PURE__ */ c.jsx(
@@ -12753,7 +12764,7 @@ var VS = f.forwardRef((e, t) => {
12753
12764
  }
12754
12765
  }
12755
12766
  );
12756
- }), [qS, Jf] = Gf(sn), Zf = f.forwardRef((e, t) => {
12767
+ }), [qS, Jf] = Gf(an), Zf = f.forwardRef((e, t) => {
12757
12768
  const {
12758
12769
  __scopeScrollArea: n,
12759
12770
  sizes: r,
@@ -12766,20 +12777,20 @@ var VS = f.forwardRef((e, t) => {
12766
12777
  onWheelScroll: d,
12767
12778
  onResize: h,
12768
12779
  ...m
12769
- } = e, w = Lt(sn, n), [v, x] = f.useState(null), p = Ee(t, (I) => x(I)), g = f.useRef(null), b = f.useRef(""), y = w.viewport, E = r.content - r.viewport, S = ct(d), C = ct(l), R = Es(h, 10);
12780
+ } = e, w = Lt(an, n), [v, x] = f.useState(null), p = Ee(t, (I) => x(I)), g = f.useRef(null), b = f.useRef(""), y = w.viewport, R = r.content - r.viewport, S = ct(d), C = ct(l), E = Es(h, 10);
12770
12781
  function N(I) {
12771
12782
  if (g.current) {
12772
- const j = I.clientX - g.current.left, O = I.clientY - g.current.top;
12773
- u({ x: j, y: O });
12783
+ const j = I.clientX - g.current.left, M = I.clientY - g.current.top;
12784
+ u({ x: j, y: M });
12774
12785
  }
12775
12786
  }
12776
12787
  return f.useEffect(() => {
12777
12788
  const I = (j) => {
12778
- const O = j.target;
12779
- (v == null ? void 0 : v.contains(O)) && S(j, E);
12789
+ const M = j.target;
12790
+ (v == null ? void 0 : v.contains(M)) && S(j, R);
12780
12791
  };
12781
12792
  return document.addEventListener("wheel", I, { passive: !1 }), () => document.removeEventListener("wheel", I, { passive: !1 });
12782
- }, [y, v, E, S]), f.useEffect(C, [r, C]), cr(v, R), cr(w.content, R), /* @__PURE__ */ c.jsx(
12793
+ }, [y, v, R, S]), f.useEffect(C, [r, C]), cr(v, E), cr(w.content, E), /* @__PURE__ */ c.jsx(
12783
12794
  qS,
12784
12795
  {
12785
12796
  scope: n,
@@ -12995,7 +13006,7 @@ function Oi({
12995
13006
  createThread: x,
12996
13007
  deleteThread: p,
12997
13008
  renameThread: g
12998
- } = Yi(), [b, y] = de(m ?? []), [E, S] = de(!1), [C, R] = de(null), [N, I] = de(null), [j, O] = de(""), [U, K] = de(!1);
13009
+ } = Yi(), [b, y] = de(m ?? []), [R, S] = de(!1), [C, E] = de(null), [N, I] = de(null), [j, M] = de(""), [U, K] = de(!1);
12999
13010
  Ye(() => {
13000
13011
  y(m ?? []);
13001
13012
  }, [m]);
@@ -13005,7 +13016,7 @@ function Oi({
13005
13016
  } catch (Z) {
13006
13017
  console.error("Failed to select thread:", Z);
13007
13018
  }
13008
- }, M = async () => {
13019
+ }, O = async () => {
13009
13020
  try {
13010
13021
  K(!0);
13011
13022
  const B = await x();
@@ -13015,26 +13026,26 @@ function Oi({
13015
13026
  } finally {
13016
13027
  K(!1);
13017
13028
  }
13018
- }, L = async (B, Z) => {
13029
+ }, D = async (B, Z) => {
13019
13030
  if (Z.stopPropagation(), !!confirm("Delete this thread?"))
13020
13031
  try {
13021
13032
  await p(B), d == null || d(B);
13022
13033
  } catch (pe) {
13023
13034
  console.error("Failed to delete thread:", pe);
13024
13035
  }
13025
- }, oe = (B, Z) => {
13026
- Z.stopPropagation(), I(B.threadId), O(B.title || `Thread ${B.threadId.slice(0, 8)}`);
13036
+ }, ne = (B, Z) => {
13037
+ Z.stopPropagation(), I(B.threadId), M(B.title || `Thread ${B.threadId.slice(0, 8)}`);
13027
13038
  }, _ = async (B) => {
13028
13039
  if (j.trim())
13029
13040
  try {
13030
- await g(B, j.trim()), I(null), O("");
13041
+ await g(B, j.trim()), I(null), M("");
13031
13042
  } catch (Z) {
13032
13043
  console.error("Failed to update title:", Z);
13033
13044
  }
13034
- }, D = () => {
13035
- I(null), O("");
13045
+ }, L = () => {
13046
+ I(null), M("");
13036
13047
  }, Y = (B, Z) => {
13037
- B.key === "Enter" ? _(Z) : B.key === "Escape" && D();
13048
+ B.key === "Enter" ? _(Z) : B.key === "Escape" && L();
13038
13049
  }, V = (B) => {
13039
13050
  if (!B) return "";
13040
13051
  try {
@@ -13048,8 +13059,8 @@ function Oi({
13048
13059
  t && /* @__PURE__ */ c.jsx("div", { className: s.header || "flex-shrink-0 p-2 border-b bg-slate-800 border-slate-700 text-slate-100 flex justify-end", children: /* @__PURE__ */ c.jsx(
13049
13060
  De,
13050
13061
  {
13051
- onClick: M,
13052
- disabled: U || E,
13062
+ onClick: O,
13063
+ disabled: U || R,
13053
13064
  className: s.createButton || "p-2",
13054
13065
  size: "sm",
13055
13066
  variant: "ghost",
@@ -13062,7 +13073,7 @@ function Oi({
13062
13073
  {
13063
13074
  className: `flex-1 min-h-0 ${s.threadList || ""}`,
13064
13075
  style: o ? { maxHeight: o } : void 0,
13065
- children: /* @__PURE__ */ c.jsx("div", { className: "p-2 space-y-1 pb-4", children: E ? /* @__PURE__ */ c.jsx("div", { className: "text-center py-8 text-slate-400", children: "Loading…" }) : b.length === 0 ? /* @__PURE__ */ c.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
13076
+ children: /* @__PURE__ */ c.jsx("div", { className: "p-2 space-y-1 pb-4", children: R ? /* @__PURE__ */ c.jsx("div", { className: "text-center py-8 text-slate-400", children: "Loading…" }) : b.length === 0 ? /* @__PURE__ */ c.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
13066
13077
  /* @__PURE__ */ c.jsx(tm, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
13067
13078
  /* @__PURE__ */ c.jsx("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
13068
13079
  ] }) : b.slice().sort((B, Z) => new Date(Z.updatedAt || Z.createdAt || "").getTime() - new Date(B.updatedAt || B.createdAt || "").getTime()).map((B) => /* @__PURE__ */ c.jsxs(
@@ -13073,9 +13084,9 @@ function Oi({
13073
13084
  children: [
13074
13085
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
13075
13086
  /* @__PURE__ */ c.jsx("div", { className: "flex-1 min-w-0", children: N === B.threadId ? /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2", onClick: (Z) => Z.stopPropagation(), children: [
13076
- /* @__PURE__ */ c.jsx(zr, { value: j, onChange: (Z) => O(Z.target.value), onKeyDown: (Z) => Y(Z, B.threadId), className: "h-6 text-sm", autoFocus: !0 }),
13087
+ /* @__PURE__ */ c.jsx(zr, { value: j, onChange: (Z) => M(Z.target.value), onKeyDown: (Z) => Y(Z, B.threadId), className: "h-6 text-sm", autoFocus: !0 }),
13077
13088
  /* @__PURE__ */ c.jsx(De, { variant: "ghost", size: "sm", onClick: () => _(B.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ c.jsx(Wi, { size: 12 }) }),
13078
- /* @__PURE__ */ c.jsx(De, { variant: "ghost", size: "sm", onClick: D, className: "h-6 w-6 p-0", children: /* @__PURE__ */ c.jsx(er, { size: 12 }) })
13089
+ /* @__PURE__ */ c.jsx(De, { variant: "ghost", size: "sm", onClick: L, className: "h-6 w-6 p-0", children: /* @__PURE__ */ c.jsx(er, { size: 12 }) })
13079
13090
  ] }) : /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
13080
13091
  /* @__PURE__ */ c.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: ee(B) }),
13081
13092
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
@@ -13084,13 +13095,13 @@ function Oi({
13084
13095
  ] })
13085
13096
  ] }) }),
13086
13097
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
13087
- r && N !== B.threadId && /* @__PURE__ */ c.jsx(De, { variant: "ghost", size: "sm", onClick: (Z) => oe(B, Z), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ c.jsx(Rl, { size: 12 }) }),
13098
+ r && N !== B.threadId && /* @__PURE__ */ c.jsx(De, { variant: "ghost", size: "sm", onClick: (Z) => ne(B, Z), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ c.jsx(Rl, { size: 12 }) }),
13088
13099
  n && /* @__PURE__ */ c.jsx(
13089
13100
  De,
13090
13101
  {
13091
13102
  variant: "ghost",
13092
13103
  size: "sm",
13093
- onClick: (Z) => L(B.threadId, Z),
13104
+ onClick: (Z) => D(B.threadId, Z),
13094
13105
  className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
13095
13106
  title: "Delete thread",
13096
13107
  children: /* @__PURE__ */ c.jsx(rm, { size: 12 })
@@ -13109,7 +13120,7 @@ function Oi({
13109
13120
  }
13110
13121
  const ah = Sl(null);
13111
13122
  function bR({ children: e, basePath: t = "/chat" }) {
13112
- const n = ln(() => t ? t === "/" ? "" : t.endsWith("/") ? t.slice(0, -1) : t : "/chat", [t]), r = {
13123
+ const n = Zt(() => t ? t === "/" ? "" : t.endsWith("/") ? t.slice(0, -1) : t : "/chat", [t]), r = {
13113
13124
  basePath: n,
13114
13125
  buildThreadPath: (o) => `${n}/${o}`,
13115
13126
  buildBasePath: () => n
@@ -13414,11 +13425,11 @@ var Ur = "Tooltip", [xC, js] = Ns(Ur), Sh = (e) => {
13414
13425
  } = e, l = Ga(Ur, e.__scopeTooltip), u = Is(t), [d, h] = f.useState(null), m = Ht(), w = f.useRef(0), v = i ?? l.disableHoverableContent, x = a ?? l.delayDuration, p = f.useRef(!1), [g, b] = xn({
13415
13426
  prop: r,
13416
13427
  defaultProp: o ?? !1,
13417
- onChange: (R) => {
13418
- R ? (l.onOpen(), document.dispatchEvent(new CustomEvent(Mi))) : l.onClose(), s == null || s(R);
13428
+ onChange: (E) => {
13429
+ E ? (l.onOpen(), document.dispatchEvent(new CustomEvent(Mi))) : l.onClose(), s == null || s(E);
13419
13430
  },
13420
13431
  caller: Ur
13421
- }), y = f.useMemo(() => g ? p.current ? "delayed-open" : "instant-open" : "closed", [g]), E = f.useCallback(() => {
13432
+ }), y = f.useMemo(() => g ? p.current ? "delayed-open" : "instant-open" : "closed", [g]), R = f.useCallback(() => {
13422
13433
  window.clearTimeout(w.current), w.current = 0, p.current = !1, b(!0);
13423
13434
  }, [b]), S = f.useCallback(() => {
13424
13435
  window.clearTimeout(w.current), w.current = 0, b(!1);
@@ -13439,12 +13450,12 @@ var Ur = "Tooltip", [xC, js] = Ns(Ur), Sh = (e) => {
13439
13450
  trigger: d,
13440
13451
  onTriggerChange: h,
13441
13452
  onTriggerEnter: f.useCallback(() => {
13442
- l.isOpenDelayedRef.current ? C() : E();
13443
- }, [l.isOpenDelayedRef, C, E]),
13453
+ l.isOpenDelayedRef.current ? C() : R();
13454
+ }, [l.isOpenDelayedRef, C, R]),
13444
13455
  onTriggerLeave: f.useCallback(() => {
13445
13456
  v ? S() : (window.clearTimeout(w.current), w.current = 0);
13446
13457
  }, [S, v]),
13447
- onOpen: E,
13458
+ onOpen: R,
13448
13459
  onClose: S,
13449
13460
  disableHoverableContent: v,
13450
13461
  children: n
@@ -13493,7 +13504,7 @@ var bC = "TooltipPortal", [TR, wC] = Ns(bC, {
13493
13504
  a(null), h(!1);
13494
13505
  }, [h]), w = f.useCallback(
13495
13506
  (v, x) => {
13496
- const p = v.currentTarget, g = { x: v.clientX, y: v.clientY }, b = EC(g, p.getBoundingClientRect()), y = NC(g, b), E = IC(x.getBoundingClientRect()), S = kC([...y, ...E]);
13507
+ const p = v.currentTarget, g = { x: v.clientX, y: v.clientY }, b = EC(g, p.getBoundingClientRect()), y = NC(g, b), R = IC(x.getBoundingClientRect()), S = kC([...y, ...R]);
13497
13508
  a(S), h(!0);
13498
13509
  },
13499
13510
  [h]
@@ -14283,7 +14294,7 @@ var As = "Switch", [oT, ER] = Gt(As), [sT, iT] = oT(As), Vh = f.forwardRef(
14283
14294
  ...h,
14284
14295
  ref: v,
14285
14296
  onClick: Q(e.onClick, (y) => {
14286
- b((E) => !E), p && (x.current = y.isPropagationStopped(), x.current || y.stopPropagation());
14297
+ b((R) => !R), p && (x.current = y.isPropagationStopped(), x.current || y.stopPropagation());
14287
14298
  })
14288
14299
  }
14289
14300
  ),
@@ -14405,7 +14416,7 @@ var lT = [" ", "Enter", "ArrowUp", "ArrowDown"], uT = [" ", "Enter"], Bn = "Sele
14405
14416
  disabled: m,
14406
14417
  required: w,
14407
14418
  form: v
14408
- } = e, x = Os(t), [p, g] = f.useState(null), [b, y] = f.useState(null), [E, S] = f.useState(!1), C = xs(u), [R, N] = xn({
14419
+ } = e, x = Os(t), [p, g] = f.useState(null), [b, y] = f.useState(null), [R, S] = f.useState(!1), C = xs(u), [E, N] = xn({
14409
14420
  prop: r,
14410
14421
  defaultProp: o ?? !1,
14411
14422
  onChange: s,
@@ -14415,7 +14426,7 @@ var lT = [" ", "Enter", "ArrowUp", "ArrowDown"], uT = [" ", "Enter"], Bn = "Sele
14415
14426
  defaultProp: a,
14416
14427
  onChange: l,
14417
14428
  caller: Bn
14418
- }), O = f.useRef(null), U = p ? v || !!p.closest("form") : !0, [K, P] = f.useState(/* @__PURE__ */ new Set()), M = Array.from(K).map((L) => L.props.value).join(";");
14429
+ }), M = f.useRef(null), U = p ? v || !!p.closest("form") : !0, [K, P] = f.useState(/* @__PURE__ */ new Set()), O = Array.from(K).map((D) => D.props.value).join(";");
14419
14430
  return /* @__PURE__ */ c.jsx(ja, { ...x, children: /* @__PURE__ */ c.jsxs(
14420
14431
  fT,
14421
14432
  {
@@ -14425,28 +14436,28 @@ var lT = [" ", "Enter", "ArrowUp", "ArrowDown"], uT = [" ", "Enter"], Bn = "Sele
14425
14436
  onTriggerChange: g,
14426
14437
  valueNode: b,
14427
14438
  onValueNodeChange: y,
14428
- valueNodeHasChildren: E,
14439
+ valueNodeHasChildren: R,
14429
14440
  onValueNodeHasChildrenChange: S,
14430
14441
  contentId: Ht(),
14431
14442
  value: I,
14432
14443
  onValueChange: j,
14433
- open: R,
14444
+ open: E,
14434
14445
  onOpenChange: N,
14435
14446
  dir: C,
14436
- triggerPointerDownPosRef: O,
14447
+ triggerPointerDownPosRef: M,
14437
14448
  disabled: m,
14438
14449
  children: [
14439
14450
  /* @__PURE__ */ c.jsx(Ps.Provider, { scope: t, children: /* @__PURE__ */ c.jsx(
14440
14451
  hT,
14441
14452
  {
14442
14453
  scope: e.__scopeSelect,
14443
- onNativeOptionAdd: f.useCallback((L) => {
14444
- P((oe) => new Set(oe).add(L));
14454
+ onNativeOptionAdd: f.useCallback((D) => {
14455
+ P((ne) => new Set(ne).add(D));
14445
14456
  }, []),
14446
- onNativeOptionRemove: f.useCallback((L) => {
14447
- P((oe) => {
14448
- const _ = new Set(oe);
14449
- return _.delete(L), _;
14457
+ onNativeOptionRemove: f.useCallback((D) => {
14458
+ P((ne) => {
14459
+ const _ = new Set(ne);
14460
+ return _.delete(D), _;
14450
14461
  });
14451
14462
  }, []),
14452
14463
  children: n
@@ -14461,7 +14472,7 @@ var lT = [" ", "Enter", "ArrowUp", "ArrowDown"], uT = [" ", "Enter"], Bn = "Sele
14461
14472
  name: d,
14462
14473
  autoComplete: h,
14463
14474
  value: I,
14464
- onChange: (L) => j(L.target.value),
14475
+ onChange: (D) => j(D.target.value),
14465
14476
  disabled: m,
14466
14477
  form: v,
14467
14478
  children: [
@@ -14469,7 +14480,7 @@ var lT = [" ", "Enter", "ArrowUp", "ArrowDown"], uT = [" ", "Enter"], Bn = "Sele
14469
14480
  Array.from(K)
14470
14481
  ]
14471
14482
  },
14472
- M
14483
+ O
14473
14484
  ) : null
14474
14485
  ]
14475
14486
  }
@@ -14584,44 +14595,44 @@ var Bt = 10, [sp, Rn] = xr($n), vT = "SelectContentImpl", xT = sr("SelectContent
14584
14595
  avoidCollisions: p,
14585
14596
  //
14586
14597
  ...g
14587
- } = e, b = Tn($n, n), [y, E] = f.useState(null), [S, C] = f.useState(null), R = Ee(t, ($) => E($)), [N, I] = f.useState(null), [j, O] = f.useState(
14598
+ } = e, b = Tn($n, n), [y, R] = f.useState(null), [S, C] = f.useState(null), E = Ee(t, ($) => R($)), [N, I] = f.useState(null), [j, M] = f.useState(
14588
14599
  null
14589
- ), U = _s(n), [K, P] = f.useState(!1), M = f.useRef(!1);
14600
+ ), U = _s(n), [K, P] = f.useState(!1), O = f.useRef(!1);
14590
14601
  f.useEffect(() => {
14591
14602
  if (y) return ma(y);
14592
14603
  }, [y]), pa();
14593
- const L = f.useCallback(
14604
+ const D = f.useCallback(
14594
14605
  ($) => {
14595
14606
  const [A, ...z] = U().map((ie) => ie.ref.current), [J] = z.slice(-1), ce = document.activeElement;
14596
14607
  for (const ie of $)
14597
14608
  if (ie === ce || (ie == null || ie.scrollIntoView({ block: "nearest" }), ie === A && S && (S.scrollTop = 0), ie === J && S && (S.scrollTop = S.scrollHeight), ie == null || ie.focus(), document.activeElement !== ce)) return;
14598
14609
  },
14599
14610
  [U, S]
14600
- ), oe = f.useCallback(
14601
- () => L([N, y]),
14602
- [L, N, y]
14611
+ ), ne = f.useCallback(
14612
+ () => D([N, y]),
14613
+ [D, N, y]
14603
14614
  );
14604
14615
  f.useEffect(() => {
14605
- K && oe();
14606
- }, [K, oe]);
14607
- const { onOpenChange: _, triggerPointerDownPosRef: D } = b;
14616
+ K && ne();
14617
+ }, [K, ne]);
14618
+ const { onOpenChange: _, triggerPointerDownPosRef: L } = b;
14608
14619
  f.useEffect(() => {
14609
14620
  if (y) {
14610
14621
  let $ = { x: 0, y: 0 };
14611
14622
  const A = (J) => {
14612
14623
  var ce, ie;
14613
14624
  $ = {
14614
- x: Math.abs(Math.round(J.pageX) - (((ce = D.current) == null ? void 0 : ce.x) ?? 0)),
14615
- y: Math.abs(Math.round(J.pageY) - (((ie = D.current) == null ? void 0 : ie.y) ?? 0))
14625
+ x: Math.abs(Math.round(J.pageX) - (((ce = L.current) == null ? void 0 : ce.x) ?? 0)),
14626
+ y: Math.abs(Math.round(J.pageY) - (((ie = L.current) == null ? void 0 : ie.y) ?? 0))
14616
14627
  };
14617
14628
  }, z = (J) => {
14618
- $.x <= 10 && $.y <= 10 ? J.preventDefault() : y.contains(J.target) || _(!1), document.removeEventListener("pointermove", A), D.current = null;
14629
+ $.x <= 10 && $.y <= 10 ? J.preventDefault() : y.contains(J.target) || _(!1), document.removeEventListener("pointermove", A), L.current = null;
14619
14630
  };
14620
- return D.current !== null && (document.addEventListener("pointermove", A), document.addEventListener("pointerup", z, { capture: !0, once: !0 })), () => {
14631
+ return L.current !== null && (document.addEventListener("pointermove", A), document.addEventListener("pointerup", z, { capture: !0, once: !0 })), () => {
14621
14632
  document.removeEventListener("pointermove", A), document.removeEventListener("pointerup", z, { capture: !0 });
14622
14633
  };
14623
14634
  }
14624
- }, [y, _, D]), f.useEffect(() => {
14635
+ }, [y, _, L]), f.useEffect(() => {
14625
14636
  const $ = () => _(!1);
14626
14637
  return window.addEventListener("blur", $), window.addEventListener("resize", $), () => {
14627
14638
  window.removeEventListener("blur", $), window.removeEventListener("resize", $);
@@ -14632,14 +14643,14 @@ var Bt = 10, [sp, Rn] = xr($n), vT = "SelectContentImpl", xT = sr("SelectContent
14632
14643
  J && setTimeout(() => J.ref.current.focus());
14633
14644
  }), ee = f.useCallback(
14634
14645
  ($, A, z) => {
14635
- const J = !M.current && !z;
14636
- (b.value !== void 0 && b.value === A || J) && (I($), J && (M.current = !0));
14646
+ const J = !O.current && !z;
14647
+ (b.value !== void 0 && b.value === A || J) && (I($), J && (O.current = !0));
14637
14648
  },
14638
14649
  [b.value]
14639
14650
  ), B = f.useCallback(() => y == null ? void 0 : y.focus(), [y]), Z = f.useCallback(
14640
14651
  ($, A, z) => {
14641
- const J = !M.current && !z;
14642
- (b.value !== void 0 && b.value === A || J) && O($);
14652
+ const J = !O.current && !z;
14653
+ (b.value !== void 0 && b.value === A || J) && M($);
14643
14654
  },
14644
14655
  [b.value]
14645
14656
  ), pe = r === "popper" ? Li : ap, he = pe === Li ? {
@@ -14665,7 +14676,7 @@ var Bt = 10, [sp, Rn] = xr($n), vT = "SelectContentImpl", xT = sr("SelectContent
14665
14676
  selectedItem: N,
14666
14677
  onItemLeave: B,
14667
14678
  itemTextRefCallback: Z,
14668
- focusSelectedItem: oe,
14679
+ focusSelectedItem: ne,
14669
14680
  selectedItemText: j,
14670
14681
  position: r,
14671
14682
  isPositioned: K,
@@ -14702,7 +14713,7 @@ var Bt = 10, [sp, Rn] = xr($n), vT = "SelectContentImpl", xT = sr("SelectContent
14702
14713
  ...g,
14703
14714
  ...he,
14704
14715
  onPlaced: () => P(!0),
14705
- ref: R,
14716
+ ref: E,
14706
14717
  style: {
14707
14718
  // flex layout so we can place the scroll buttons properly
14708
14719
  display: "flex",
@@ -14719,7 +14730,7 @@ var Bt = 10, [sp, Rn] = xr($n), vT = "SelectContentImpl", xT = sr("SelectContent
14719
14730
  const ce = $.target, ie = J.indexOf(ce);
14720
14731
  J = J.slice(ie + 1);
14721
14732
  }
14722
- setTimeout(() => L(J)), $.preventDefault();
14733
+ setTimeout(() => D(J)), $.preventDefault();
14723
14734
  }
14724
14735
  })
14725
14736
  }
@@ -14734,11 +14745,11 @@ var Bt = 10, [sp, Rn] = xr($n), vT = "SelectContentImpl", xT = sr("SelectContent
14734
14745
  );
14735
14746
  ip.displayName = vT;
14736
14747
  var bT = "SelectItemAlignedPosition", ap = f.forwardRef((e, t) => {
14737
- const { __scopeSelect: n, onPlaced: r, ...o } = e, s = Tn($n, n), i = Rn($n, n), [a, l] = f.useState(null), [u, d] = f.useState(null), h = Ee(t, (R) => d(R)), m = _s(n), w = f.useRef(!1), v = f.useRef(!0), { viewport: x, selectedItem: p, selectedItemText: g, focusSelectedItem: b } = i, y = f.useCallback(() => {
14748
+ const { __scopeSelect: n, onPlaced: r, ...o } = e, s = Tn($n, n), i = Rn($n, n), [a, l] = f.useState(null), [u, d] = f.useState(null), h = Ee(t, (E) => d(E)), m = _s(n), w = f.useRef(!1), v = f.useRef(!0), { viewport: x, selectedItem: p, selectedItemText: g, focusSelectedItem: b } = i, y = f.useCallback(() => {
14738
14749
  if (s.trigger && s.valueNode && a && u && x && p && g) {
14739
- const R = s.trigger.getBoundingClientRect(), N = u.getBoundingClientRect(), I = s.valueNode.getBoundingClientRect(), j = g.getBoundingClientRect();
14750
+ const E = s.trigger.getBoundingClientRect(), N = u.getBoundingClientRect(), I = s.valueNode.getBoundingClientRect(), j = g.getBoundingClientRect();
14740
14751
  if (s.dir !== "rtl") {
14741
- const ce = j.left - N.left, ie = I.left - ce, Ae = R.left - ie, _e = R.width + Ae, je = Math.max(_e, N.width), ae = window.innerWidth - Bt, Ne = _i(ie, [
14752
+ const ce = j.left - N.left, ie = I.left - ce, Ae = E.left - ie, _e = E.width + Ae, je = Math.max(_e, N.width), ae = window.innerWidth - Bt, Ne = _i(ie, [
14742
14753
  Bt,
14743
14754
  // Prevents the content from going off the starting edge of the
14744
14755
  // viewport. It may still go off the ending edge, but this can be
@@ -14749,28 +14760,28 @@ var bT = "SelectItemAlignedPosition", ap = f.forwardRef((e, t) => {
14749
14760
  ]);
14750
14761
  a.style.minWidth = _e + "px", a.style.left = Ne + "px";
14751
14762
  } else {
14752
- const ce = N.right - j.right, ie = window.innerWidth - I.right - ce, Ae = window.innerWidth - R.right - ie, _e = R.width + Ae, je = Math.max(_e, N.width), ae = window.innerWidth - Bt, Ne = _i(ie, [
14763
+ const ce = N.right - j.right, ie = window.innerWidth - I.right - ce, Ae = window.innerWidth - E.right - ie, _e = E.width + Ae, je = Math.max(_e, N.width), ae = window.innerWidth - Bt, Ne = _i(ie, [
14753
14764
  Bt,
14754
14765
  Math.max(Bt, ae - je)
14755
14766
  ]);
14756
14767
  a.style.minWidth = _e + "px", a.style.right = Ne + "px";
14757
14768
  }
14758
- const O = m(), U = window.innerHeight - Bt * 2, K = x.scrollHeight, P = window.getComputedStyle(u), M = parseInt(P.borderTopWidth, 10), L = parseInt(P.paddingTop, 10), oe = parseInt(P.borderBottomWidth, 10), _ = parseInt(P.paddingBottom, 10), D = M + L + K + _ + oe, Y = Math.min(p.offsetHeight * 5, D), V = window.getComputedStyle(x), ee = parseInt(V.paddingTop, 10), B = parseInt(V.paddingBottom, 10), Z = R.top + R.height / 2 - Bt, pe = U - Z, he = p.offsetHeight / 2, $ = p.offsetTop + he, A = M + L + $, z = D - A;
14769
+ const M = m(), U = window.innerHeight - Bt * 2, K = x.scrollHeight, P = window.getComputedStyle(u), O = parseInt(P.borderTopWidth, 10), D = parseInt(P.paddingTop, 10), ne = parseInt(P.borderBottomWidth, 10), _ = parseInt(P.paddingBottom, 10), L = O + D + K + _ + ne, Y = Math.min(p.offsetHeight * 5, L), V = window.getComputedStyle(x), ee = parseInt(V.paddingTop, 10), B = parseInt(V.paddingBottom, 10), Z = E.top + E.height / 2 - Bt, pe = U - Z, he = p.offsetHeight / 2, $ = p.offsetTop + he, A = O + D + $, z = L - A;
14759
14770
  if (A <= Z) {
14760
- const ce = O.length > 0 && p === O[O.length - 1].ref.current;
14771
+ const ce = M.length > 0 && p === M[M.length - 1].ref.current;
14761
14772
  a.style.bottom = "0px";
14762
14773
  const ie = u.clientHeight - x.offsetTop - x.offsetHeight, Ae = Math.max(
14763
14774
  pe,
14764
14775
  he + // viewport might have padding bottom, include it to avoid a scrollable viewport
14765
- (ce ? B : 0) + ie + oe
14776
+ (ce ? B : 0) + ie + ne
14766
14777
  ), _e = A + Ae;
14767
14778
  a.style.height = _e + "px";
14768
14779
  } else {
14769
- const ce = O.length > 0 && p === O[0].ref.current;
14780
+ const ce = M.length > 0 && p === M[0].ref.current;
14770
14781
  a.style.top = "0px";
14771
14782
  const Ae = Math.max(
14772
14783
  Z,
14773
- M + x.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
14784
+ O + x.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
14774
14785
  (ce ? ee : 0) + he
14775
14786
  ) + z;
14776
14787
  a.style.height = Ae + "px", x.scrollTop = A - Z + x.offsetTop;
@@ -14790,13 +14801,13 @@ var bT = "SelectItemAlignedPosition", ap = f.forwardRef((e, t) => {
14790
14801
  r
14791
14802
  ]);
14792
14803
  st(() => y(), [y]);
14793
- const [E, S] = f.useState();
14804
+ const [R, S] = f.useState();
14794
14805
  st(() => {
14795
14806
  u && S(window.getComputedStyle(u).zIndex);
14796
14807
  }, [u]);
14797
14808
  const C = f.useCallback(
14798
- (R) => {
14799
- R && v.current === !0 && (y(), b == null || b(), v.current = !1);
14809
+ (E) => {
14810
+ E && v.current === !0 && (y(), b == null || b(), v.current = !1);
14800
14811
  },
14801
14812
  [y, b]
14802
14813
  );
@@ -14815,7 +14826,7 @@ var bT = "SelectItemAlignedPosition", ap = f.forwardRef((e, t) => {
14815
14826
  display: "flex",
14816
14827
  flexDirection: "column",
14817
14828
  position: "fixed",
14818
- zIndex: E
14829
+ zIndex: R
14819
14830
  },
14820
14831
  children: /* @__PURE__ */ c.jsx(
14821
14832
  ve.div,
@@ -14907,8 +14918,8 @@ var [yT, Ka] = xr($n, {}), Fi = "SelectViewport", cp = f.forwardRef(
14907
14918
  if (w > 0) {
14908
14919
  const v = window.innerHeight - Bt * 2, x = parseFloat(h.style.minHeight), p = parseFloat(h.style.height), g = Math.max(x, p);
14909
14920
  if (g < v) {
14910
- const b = g + w, y = Math.min(v, b), E = b - y;
14911
- h.style.height = y + "px", h.style.bottom === "0px" && (d.scrollTop = E > 0 ? E : 0, h.style.justifyContent = "flex-end");
14921
+ const b = g + w, y = Math.min(v, b), R = b - y;
14922
+ h.style.height = y + "px", h.style.bottom === "0px" && (d.scrollTop = R > 0 ? R : 0, h.style.justifyContent = "flex-end");
14912
14923
  }
14913
14924
  }
14914
14925
  }
@@ -15006,8 +15017,8 @@ var Jo = "SelectItem", [RT, fp] = xr(Jo), hp = f.forwardRef(
15006
15017
  b.currentTarget === document.activeElement && ((y = l.onItemLeave) == null || y.call(l));
15007
15018
  }),
15008
15019
  onKeyDown: Q(i.onKeyDown, (b) => {
15009
- var E;
15010
- ((E = l.searchRef) == null ? void 0 : E.current) !== "" && b.key === " " || (uT.includes(b.key) && g(), b.key === " " && b.preventDefault());
15020
+ var R;
15021
+ ((R = l.searchRef) == null ? void 0 : R.current) !== "" && b.key === " " || (uT.includes(b.key) && g(), b.key === " " && b.preventDefault());
15011
15022
  })
15012
15023
  }
15013
15024
  )