teodor-new-chat-ui 4.3.240 → 4.3.242

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ var om = Object.defineProperty;
2
2
  var sm = (e, t, n) => t in e ? om(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var cl = (e, t, n) => sm(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as v from "react";
5
- import z, { createContext as co, useContext as xs, useRef as Qe, useCallback as ke, useReducer as im, useEffect as kt, useMemo as at, useState as xe, useLayoutEffect as am, createElement as Do, useImperativeHandle as lm } from "react";
5
+ import z, { createContext as co, useContext as xs, useRef as Qe, useCallback as ke, useReducer as im, useEffect as kt, useMemo as lt, useState as xe, useLayoutEffect as am, createElement as Do, useImperativeHandle as lm } from "react";
6
6
  import { Square as cm, Send as um, ChevronRight as Xc, Check as ca, Circle as dm, X as vr, ExternalLink as fm, Download as pm, Image as hm, FileText as ul, Loader as ua, Bot as si, Wrench as mm, User as gm, Paperclip as ji, ChevronUp as da, ChevronDown as ys, ChevronLeft as xm, Copy as dl, Edit as fl, RotateCcw as _i, Info as ym, Loader2 as zr, Edit3 as Jc, Plus as vm, FileSpreadsheet as wm, MessageSquarePlus as bm, MessageSquare as Sm, Calendar as Cm, Trash2 as Tm, Settings as km, Server as Rm, EyeOff as Em, Eye as Im, Layout as Nm, MessageCircle as Am, Save as jm } from "lucide-react";
7
7
  import { Slot as _m, createSlot as Tr } from "@radix-ui/react-slot";
8
8
  import { cva as vs } from "class-variance-authority";
@@ -51,25 +51,25 @@ function Dm() {
51
51
  function y(R) {
52
52
  if (R === null || typeof R != "object")
53
53
  return null;
54
- var V = m && R[m] || R[x];
55
- return typeof V == "function" ? V : null;
54
+ var K = m && R[m] || R[x];
55
+ return typeof K == "function" ? K : null;
56
56
  }
57
57
  var g = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
58
58
  function w(R) {
59
59
  {
60
- for (var V = arguments.length, se = new Array(V > 1 ? V - 1 : 0), be = 1; be < V; be++)
60
+ for (var K = arguments.length, se = new Array(K > 1 ? K - 1 : 0), be = 1; be < K; be++)
61
61
  se[be - 1] = arguments[be];
62
62
  b("error", R, se);
63
63
  }
64
64
  }
65
- function b(R, V, se) {
65
+ function b(R, K, se) {
66
66
  {
67
67
  var be = g.ReactDebugCurrentFrame, Ge = be.getStackAddendum();
68
- Ge !== "" && (V += "%s", se = se.concat([Ge]));
69
- var it = se.map(function(Be) {
70
- return String(Be);
68
+ Ge !== "" && (K += "%s", se = se.concat([Ge]));
69
+ var at = se.map(function(He) {
70
+ return String(He);
71
71
  });
72
- it.unshift("Warning: " + V), Function.prototype.apply.call(console[R], console, it);
72
+ at.unshift("Warning: " + K), Function.prototype.apply.call(console[R], console, at);
73
73
  }
74
74
  }
75
75
  var T = !1, C = !1, S = !1, k = !1, N = !1, E;
@@ -81,11 +81,11 @@ function Dm() {
81
81
  // with.
82
82
  R.$$typeof === E || R.getModuleId !== void 0));
83
83
  }
84
- function P(R, V, se) {
84
+ function P(R, K, se) {
85
85
  var be = R.displayName;
86
86
  if (be)
87
87
  return be;
88
- var Ge = V.displayName || V.name || "";
88
+ var Ge = K.displayName || K.name || "";
89
89
  return Ge !== "" ? se + "(" + Ge + ")" : se;
90
90
  }
91
91
  function L(R) {
@@ -115,8 +115,8 @@ function Dm() {
115
115
  if (typeof R == "object")
116
116
  switch (R.$$typeof) {
117
117
  case a:
118
- var V = R;
119
- return L(V) + ".Consumer";
118
+ var K = R;
119
+ return L(K) + ".Consumer";
120
120
  case i:
121
121
  var se = R;
122
122
  return L(se._context) + ".Provider";
@@ -126,9 +126,9 @@ function Dm() {
126
126
  var be = R.displayName || null;
127
127
  return be !== null ? be : F(R.type) || "Memo";
128
128
  case p: {
129
- var Ge = R, it = Ge._payload, Be = Ge._init;
129
+ var Ge = R, at = Ge._payload, He = Ge._init;
130
130
  try {
131
- return F(Be(it));
131
+ return F(He(at));
132
132
  } catch {
133
133
  return null;
134
134
  }
@@ -163,7 +163,7 @@ function Dm() {
163
163
  $++;
164
164
  }
165
165
  }
166
- function K() {
166
+ function V() {
167
167
  {
168
168
  if ($--, $ === 0) {
169
169
  var R = {
@@ -199,7 +199,7 @@ function Dm() {
199
199
  }
200
200
  }
201
201
  var ee = g.ReactCurrentDispatcher, q;
202
- function M(R, V, se) {
202
+ function M(R, K, se) {
203
203
  {
204
204
  if (q === void 0)
205
205
  try {
@@ -217,7 +217,7 @@ function Dm() {
217
217
  var oe = typeof WeakMap == "function" ? WeakMap : Map;
218
218
  te = new oe();
219
219
  }
220
- function ne(R, V) {
220
+ function ne(R, K) {
221
221
  if (!R || H)
222
222
  return "";
223
223
  {
@@ -229,31 +229,31 @@ function Dm() {
229
229
  H = !0;
230
230
  var Ge = Error.prepareStackTrace;
231
231
  Error.prepareStackTrace = void 0;
232
- var it;
233
- it = ee.current, ee.current = null, Ae();
232
+ var at;
233
+ at = ee.current, ee.current = null, Ae();
234
234
  try {
235
- if (V) {
236
- var Be = function() {
235
+ if (K) {
236
+ var He = function() {
237
237
  throw Error();
238
238
  };
239
- if (Object.defineProperty(Be.prototype, "props", {
239
+ if (Object.defineProperty(He.prototype, "props", {
240
240
  set: function() {
241
241
  throw Error();
242
242
  }
243
243
  }), typeof Reflect == "object" && Reflect.construct) {
244
244
  try {
245
- Reflect.construct(Be, []);
245
+ Reflect.construct(He, []);
246
246
  } catch (Ft) {
247
247
  be = Ft;
248
248
  }
249
- Reflect.construct(R, [], Be);
249
+ Reflect.construct(R, [], He);
250
250
  } else {
251
251
  try {
252
- Be.call();
252
+ He.call();
253
253
  } catch (Ft) {
254
254
  be = Ft;
255
255
  }
256
- R.call(Be.prototype);
256
+ R.call(He.prototype);
257
257
  }
258
258
  } else {
259
259
  try {
@@ -283,19 +283,19 @@ function Dm() {
283
283
  }
284
284
  }
285
285
  } finally {
286
- H = !1, ee.current = it, K(), Error.prepareStackTrace = Ge;
286
+ H = !1, ee.current = at, V(), Error.prepareStackTrace = Ge;
287
287
  }
288
288
  var Fn = R ? R.displayName || R.name : "", Nn = Fn ? M(Fn) : "";
289
289
  return typeof R == "function" && te.set(R, Nn), Nn;
290
290
  }
291
- function Te(R, V, se) {
291
+ function Te(R, K, se) {
292
292
  return ne(R, !1);
293
293
  }
294
294
  function Z(R) {
295
- var V = R.prototype;
296
- return !!(V && V.isReactComponent);
295
+ var K = R.prototype;
296
+ return !!(K && K.isReactComponent);
297
297
  }
298
- function de(R, V, se) {
298
+ function de(R, K, se) {
299
299
  if (R == null)
300
300
  return "";
301
301
  if (typeof R == "function")
@@ -313,51 +313,51 @@ function Dm() {
313
313
  case l:
314
314
  return Te(R.render);
315
315
  case f:
316
- return de(R.type, V, se);
316
+ return de(R.type, K, se);
317
317
  case p: {
318
- var be = R, Ge = be._payload, it = be._init;
318
+ var be = R, Ge = be._payload, at = be._init;
319
319
  try {
320
- return de(it(Ge), V, se);
320
+ return de(at(Ge), K, se);
321
321
  } catch {
322
322
  }
323
323
  }
324
324
  }
325
325
  return "";
326
326
  }
327
- var Ee = Object.prototype.hasOwnProperty, Ne = {}, Le = g.ReactDebugCurrentFrame;
327
+ var Ee = Object.prototype.hasOwnProperty, Ne = {}, Fe = g.ReactDebugCurrentFrame;
328
328
  function Je(R) {
329
329
  if (R) {
330
- var V = R._owner, se = de(R.type, R._source, V ? V.type : null);
331
- Le.setExtraStackFrame(se);
330
+ var K = R._owner, se = de(R.type, R._source, K ? K.type : null);
331
+ Fe.setExtraStackFrame(se);
332
332
  } else
333
- Le.setExtraStackFrame(null);
333
+ Fe.setExtraStackFrame(null);
334
334
  }
335
- function He(R, V, se, be, Ge) {
335
+ function Ue(R, K, se, be, Ge) {
336
336
  {
337
- var it = Function.call.bind(Ee);
338
- for (var Be in R)
339
- if (it(R, Be)) {
337
+ var at = Function.call.bind(Ee);
338
+ for (var He in R)
339
+ if (at(R, He)) {
340
340
  var $e = void 0;
341
341
  try {
342
- if (typeof R[Be] != "function") {
343
- var Ot = Error((be || "React class") + ": " + se + " type `" + Be + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[Be] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
342
+ if (typeof R[He] != "function") {
343
+ var Ot = Error((be || "React class") + ": " + se + " type `" + He + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[He] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
344
344
  throw Ot.name = "Invariant Violation", Ot;
345
345
  }
346
- $e = R[Be](V, Be, be, se, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
346
+ $e = R[He](K, He, be, se, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
347
  } catch (bt) {
348
348
  $e = bt;
349
349
  }
350
- $e && !($e instanceof Error) && (Je(Ge), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", be || "React class", se, Be, typeof $e), Je(null)), $e instanceof Error && !($e.message in Ne) && (Ne[$e.message] = !0, Je(Ge), w("Failed %s type: %s", se, $e.message), Je(null));
350
+ $e && !($e instanceof Error) && (Je(Ge), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", be || "React class", se, He, typeof $e), Je(null)), $e instanceof Error && !($e.message in Ne) && (Ne[$e.message] = !0, Je(Ge), w("Failed %s type: %s", se, $e.message), Je(null));
351
351
  }
352
352
  }
353
353
  }
354
- var Ve = Array.isArray;
355
- function Ke(R) {
356
- return Ve(R);
354
+ var Ke = Array.isArray;
355
+ function qe(R) {
356
+ return Ke(R);
357
357
  }
358
358
  function Xe(R) {
359
359
  {
360
- var V = typeof Symbol == "function" && Symbol.toStringTag, se = V && R[Symbol.toStringTag] || R.constructor.name || "Object";
360
+ var K = typeof Symbol == "function" && Symbol.toStringTag, se = K && R[Symbol.toStringTag] || R.constructor.name || "Object";
361
361
  return se;
362
362
  }
363
363
  }
@@ -371,11 +371,11 @@ function Dm() {
371
371
  function tt(R) {
372
372
  return "" + R;
373
373
  }
374
- function Nt(R) {
374
+ function At(R) {
375
375
  if (Ze(R))
376
376
  return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Xe(R)), tt(R);
377
377
  }
378
- var ht = g.ReactCurrentOwner, lt = {
378
+ var mt = g.ReactCurrentOwner, ct = {
379
379
  key: !0,
380
380
  ref: !0,
381
381
  __self: !0,
@@ -383,27 +383,27 @@ function Dm() {
383
383
  }, ce, fe;
384
384
  function he(R) {
385
385
  if (Ee.call(R, "ref")) {
386
- var V = Object.getOwnPropertyDescriptor(R, "ref").get;
387
- if (V && V.isReactWarning)
386
+ var K = Object.getOwnPropertyDescriptor(R, "ref").get;
387
+ if (K && K.isReactWarning)
388
388
  return !1;
389
389
  }
390
390
  return R.ref !== void 0;
391
391
  }
392
- function qe(R) {
392
+ function ze(R) {
393
393
  if (Ee.call(R, "key")) {
394
- var V = Object.getOwnPropertyDescriptor(R, "key").get;
395
- if (V && V.isReactWarning)
394
+ var K = Object.getOwnPropertyDescriptor(R, "key").get;
395
+ if (K && K.isReactWarning)
396
396
  return !1;
397
397
  }
398
398
  return R.key !== void 0;
399
399
  }
400
- function Fe(R, V) {
401
- typeof R.ref == "string" && ht.current;
400
+ function De(R, K) {
401
+ typeof R.ref == "string" && mt.current;
402
402
  }
403
- function yt(R, V) {
403
+ function st(R, K) {
404
404
  {
405
405
  var se = function() {
406
- ce || (ce = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", V));
406
+ ce || (ce = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", K));
407
407
  };
408
408
  se.isReactWarning = !0, Object.defineProperty(R, "key", {
409
409
  get: se,
@@ -411,10 +411,10 @@ function Dm() {
411
411
  });
412
412
  }
413
413
  }
414
- function At(R, V) {
414
+ function Et(R, K) {
415
415
  {
416
416
  var se = function() {
417
- fe || (fe = !0, w("%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)", V));
417
+ fe || (fe = !0, w("%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)", K));
418
418
  };
419
419
  se.isReactWarning = !0, Object.defineProperty(R, "ref", {
420
420
  get: se,
@@ -422,17 +422,17 @@ function Dm() {
422
422
  });
423
423
  }
424
424
  }
425
- var st = function(R, V, se, be, Ge, it, Be) {
425
+ var it = function(R, K, se, be, Ge, at, He) {
426
426
  var $e = {
427
427
  // This tag allows us to uniquely identify this as a React Element
428
428
  $$typeof: t,
429
429
  // Built-in properties that belong on the element
430
430
  type: R,
431
- key: V,
431
+ key: K,
432
432
  ref: se,
433
- props: Be,
433
+ props: He,
434
434
  // Record the component responsible for creating this element.
435
- _owner: it
435
+ _owner: at
436
436
  };
437
437
  return $e._store = {}, Object.defineProperty($e._store, "validated", {
438
438
  configurable: !1,
@@ -451,28 +451,28 @@ function Dm() {
451
451
  value: Ge
452
452
  }), Object.freeze && (Object.freeze($e.props), Object.freeze($e)), $e;
453
453
  };
454
- function ze(R, V, se, be, Ge) {
454
+ function Be(R, K, se, be, Ge) {
455
455
  {
456
- var it, Be = {}, $e = null, Ot = null;
457
- se !== void 0 && (Nt(se), $e = "" + se), qe(V) && (Nt(V.key), $e = "" + V.key), he(V) && (Ot = V.ref, Fe(V, Ge));
458
- for (it in V)
459
- Ee.call(V, it) && !lt.hasOwnProperty(it) && (Be[it] = V[it]);
456
+ var at, He = {}, $e = null, Ot = null;
457
+ se !== void 0 && (At(se), $e = "" + se), ze(K) && (At(K.key), $e = "" + K.key), he(K) && (Ot = K.ref, De(K, Ge));
458
+ for (at in K)
459
+ Ee.call(K, at) && !ct.hasOwnProperty(at) && (He[at] = K[at]);
460
460
  if (R && R.defaultProps) {
461
461
  var bt = R.defaultProps;
462
- for (it in bt)
463
- Be[it] === void 0 && (Be[it] = bt[it]);
462
+ for (at in bt)
463
+ He[at] === void 0 && (He[at] = bt[at]);
464
464
  }
465
465
  if ($e || Ot) {
466
466
  var vt = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
467
- $e && yt(Be, vt), Ot && At(Be, vt);
467
+ $e && st(He, vt), Ot && Et(He, vt);
468
468
  }
469
- return st(R, $e, Ot, Ge, be, ht.current, Be);
469
+ return it(R, $e, Ot, Ge, be, mt.current, He);
470
470
  }
471
471
  }
472
472
  var Pt = g.ReactCurrentOwner, jt = g.ReactDebugCurrentFrame;
473
473
  function W(R) {
474
474
  if (R) {
475
- var V = R._owner, se = de(R.type, R._source, V ? V.type : null);
475
+ var K = R._owner, se = de(R.type, R._source, K ? K.type : null);
476
476
  jt.setExtraStackFrame(se);
477
477
  } else
478
478
  jt.setExtraStackFrame(null);
@@ -482,7 +482,7 @@ function Dm() {
482
482
  function ye(R) {
483
483
  return typeof R == "object" && R !== null && R.$$typeof === t;
484
484
  }
485
- function pt() {
485
+ function ht() {
486
486
  {
487
487
  if (Pt.current) {
488
488
  var R = F(Pt.current.type);
@@ -494,28 +494,28 @@ Check the render method of \`` + R + "`.";
494
494
  return "";
495
495
  }
496
496
  }
497
- function mt(R) {
497
+ function gt(R) {
498
498
  return "";
499
499
  }
500
500
  var St = {};
501
501
  function Pe(R) {
502
502
  {
503
- var V = pt();
504
- if (!V) {
503
+ var K = ht();
504
+ if (!K) {
505
505
  var se = typeof R == "string" ? R : R.displayName || R.name;
506
- se && (V = `
506
+ se && (K = `
507
507
 
508
508
  Check the top-level render call using <` + se + ">.");
509
509
  }
510
- return V;
510
+ return K;
511
511
  }
512
512
  }
513
- function Vt(R, V) {
513
+ function Vt(R, K) {
514
514
  {
515
515
  if (!R._store || R._store.validated || R.key != null)
516
516
  return;
517
517
  R._store.validated = !0;
518
- var se = Pe(V);
518
+ var se = Pe(K);
519
519
  if (St[se])
520
520
  return;
521
521
  St[se] = !0;
@@ -523,54 +523,54 @@ Check the top-level render call using <` + se + ">.");
523
523
  R && R._owner && R._owner !== Pt.current && (be = " It was passed a child from " + F(R._owner.type) + "."), W(R), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', se, be), W(null);
524
524
  }
525
525
  }
526
- function ct(R, V) {
526
+ function ut(R, K) {
527
527
  {
528
528
  if (typeof R != "object")
529
529
  return;
530
- if (Ke(R))
530
+ if (qe(R))
531
531
  for (var se = 0; se < R.length; se++) {
532
532
  var be = R[se];
533
- ye(be) && Vt(be, V);
533
+ ye(be) && Vt(be, K);
534
534
  }
535
535
  else if (ye(R))
536
536
  R._store && (R._store.validated = !0);
537
537
  else if (R) {
538
538
  var Ge = y(R);
539
539
  if (typeof Ge == "function" && Ge !== R.entries)
540
- for (var it = Ge.call(R), Be; !(Be = it.next()).done; )
541
- ye(Be.value) && Vt(Be.value, V);
540
+ for (var at = Ge.call(R), He; !(He = at.next()).done; )
541
+ ye(He.value) && Vt(He.value, K);
542
542
  }
543
543
  }
544
544
  }
545
545
  function Ct(R) {
546
546
  {
547
- var V = R.type;
548
- if (V == null || typeof V == "string")
547
+ var K = R.type;
548
+ if (K == null || typeof K == "string")
549
549
  return;
550
550
  var se;
551
- if (typeof V == "function")
552
- se = V.propTypes;
553
- else if (typeof V == "object" && (V.$$typeof === l || // Note: Memo only checks outer props here.
551
+ if (typeof K == "function")
552
+ se = K.propTypes;
553
+ else if (typeof K == "object" && (K.$$typeof === l || // Note: Memo only checks outer props here.
554
554
  // Inner props are checked in the reconciler.
555
- V.$$typeof === f))
556
- se = V.propTypes;
555
+ K.$$typeof === f))
556
+ se = K.propTypes;
557
557
  else
558
558
  return;
559
559
  if (se) {
560
- var be = F(V);
561
- He(se, R.props, "prop", be, R);
562
- } else if (V.PropTypes !== void 0 && !we) {
560
+ var be = F(K);
561
+ Ue(se, R.props, "prop", be, R);
562
+ } else if (K.PropTypes !== void 0 && !we) {
563
563
  we = !0;
564
- var Ge = F(V);
564
+ var Ge = F(K);
565
565
  w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Ge || "Unknown");
566
566
  }
567
- typeof V.getDefaultProps == "function" && !V.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
567
+ typeof K.getDefaultProps == "function" && !K.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
568
568
  }
569
569
  }
570
570
  function Dn(R) {
571
571
  {
572
- for (var V = Object.keys(R.props), se = 0; se < V.length; se++) {
573
- var be = V[se];
572
+ for (var K = Object.keys(R.props), se = 0; se < K.length; se++) {
573
+ var be = K[se];
574
574
  if (be !== "children" && be !== "key") {
575
575
  W(R), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", be), W(null);
576
576
  break;
@@ -580,35 +580,35 @@ Check the top-level render call using <` + se + ">.");
580
580
  }
581
581
  }
582
582
  var Jn = {};
583
- function Ln(R, V, se, be, Ge, it) {
583
+ function Ln(R, K, se, be, Ge, at) {
584
584
  {
585
- var Be = I(R);
586
- if (!Be) {
585
+ var He = I(R);
586
+ if (!He) {
587
587
  var $e = "";
588
588
  (R === void 0 || typeof R == "object" && R !== null && Object.keys(R).length === 0) && ($e += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
589
- var Ot = mt();
590
- Ot ? $e += Ot : $e += pt();
589
+ var Ot = gt();
590
+ Ot ? $e += Ot : $e += ht();
591
591
  var bt;
592
- R === null ? bt = "null" : Ke(R) ? bt = "array" : R !== void 0 && R.$$typeof === t ? (bt = "<" + (F(R.type) || "Unknown") + " />", $e = " Did you accidentally export a JSX literal instead of a component?") : bt = typeof R, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", bt, $e);
592
+ R === null ? bt = "null" : qe(R) ? bt = "array" : R !== void 0 && R.$$typeof === t ? (bt = "<" + (F(R.type) || "Unknown") + " />", $e = " Did you accidentally export a JSX literal instead of a component?") : bt = typeof R, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", bt, $e);
593
593
  }
594
- var vt = ze(R, V, se, Ge, it);
594
+ var vt = Be(R, K, se, Ge, at);
595
595
  if (vt == null)
596
596
  return vt;
597
- if (Be) {
598
- var Kt = V.children;
597
+ if (He) {
598
+ var Kt = K.children;
599
599
  if (Kt !== void 0)
600
600
  if (be)
601
- if (Ke(Kt)) {
601
+ if (qe(Kt)) {
602
602
  for (var Fn = 0; Fn < Kt.length; Fn++)
603
- ct(Kt[Fn], R);
603
+ ut(Kt[Fn], R);
604
604
  Object.freeze && Object.freeze(Kt);
605
605
  } else
606
606
  w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
607
607
  else
608
- ct(Kt, R);
608
+ ut(Kt, R);
609
609
  }
610
- if (Ee.call(V, "key")) {
611
- var Nn = F(R), Ft = Object.keys(V).filter(function(re) {
610
+ if (Ee.call(K, "key")) {
611
+ var Nn = F(R), Ft = Object.keys(K).filter(function(re) {
612
612
  return re !== "key";
613
613
  }), Dr = Ft.length > 0 ? "{key: someKey, " + Ft.join(": ..., ") + ": ...}" : "{key: someKey}";
614
614
  if (!Jn[Nn + Dr]) {
@@ -624,11 +624,11 @@ React keys must be passed directly to JSX without using spread:
624
624
  return R === r ? Dn(vt) : Ct(vt), vt;
625
625
  }
626
626
  }
627
- function ti(R, V, se) {
628
- return Ln(R, V, se, !0);
627
+ function ti(R, K, se) {
628
+ return Ln(R, K, se, !0);
629
629
  }
630
- function So(R, V, se) {
631
- return Ln(R, V, se, !1);
630
+ function So(R, K, se) {
631
+ return Ln(R, K, se, !1);
632
632
  }
633
633
  var ni = So, ri = ti;
634
634
  Fr.Fragment = r, Fr.jsx = ni, Fr.jsxs = ri;
@@ -1904,8 +1904,8 @@ const xu = (e) => {
1904
1904
  const O = d && (k === "stream" || k === "response");
1905
1905
  if (d && (C || O && j)) {
1906
1906
  const X = {};
1907
- ["status", "statusText", "headers"].forEach((K) => {
1908
- X[K] = D[K];
1907
+ ["status", "statusText", "headers"].forEach((V) => {
1908
+ X[V] = D[V];
1909
1909
  });
1910
1910
  const pe = _.toFiniteNumber(D.headers.get("content-length")), [Ie, Ae] = C && wl(
1911
1911
  pe,
@@ -2618,7 +2618,7 @@ function Ur(e) {
2618
2618
  }
2619
2619
  function ku(e, t) {
2620
2620
  if (!ma(e)) return null;
2621
- const n = e.values ?? { messages: [] }, r = Array.isArray(n == null ? void 0 : n.messages) ? n.messages : [], { messages: o, ...s } = n, i = Object.keys(s).length ? s : null, a = e.tasks, l = Array.isArray(a) ? a.filter((E) => !!E && typeof E == "object").map((E) => ({ ...E })) : a === null ? null : void 0, c = r.map((E, I) => jx(E, I)).filter((E) => !!E), d = qt(e.config), f = qt(d == null ? void 0 : d.configurable), p = Et(f, ["checkpoint_id", "checkpointId"]), h = Et(f, ["checkpoint_ns", "checkpointNs"]), m = qt(e == null ? void 0 : e.parentConfig), x = qt(m == null ? void 0 : m.configurable), y = Et(x, ["checkpoint_id", "checkpointId"]) ?? null, g = Et(x, ["checkpoint_ns", "checkpointNs"]) ?? null, w = e == null ? void 0 : e.createdAt, b = typeof w == "string" && w.trim() ? w : new Date(Date.now() - t).toISOString(), T = c[c.length - 1] ?? null, C = qt(e == null ? void 0 : e.metadata), S = Et(C, ["branch_label", "branchLabel"]), k = Et(x, ["checkpoint_id", "checkpointId"]), N = Array.isArray(e.next) ? [...e.next] : (e == null ? void 0 : e.next) === null ? null : void 0;
2621
+ const n = e.values ?? { messages: [] }, r = Array.isArray(n == null ? void 0 : n.messages) ? n.messages : [], { messages: o, ...s } = n, i = Object.keys(s).length ? s : null, a = e.tasks, l = Array.isArray(a) ? a.filter((E) => !!E && typeof E == "object").map((E) => ({ ...E })) : a === null ? null : void 0, c = r.map((E, I) => jx(E, I)).filter((E) => !!E), d = qt(e.config), f = qt(d == null ? void 0 : d.configurable), p = It(f, ["checkpoint_id", "checkpointId"]), h = It(f, ["checkpoint_ns", "checkpointNs"]), m = qt(e == null ? void 0 : e.parentConfig), x = qt(m == null ? void 0 : m.configurable), y = It(x, ["checkpoint_id", "checkpointId"]) ?? null, g = It(x, ["checkpoint_ns", "checkpointNs"]) ?? null, w = e == null ? void 0 : e.createdAt, b = typeof w == "string" && w.trim() ? w : new Date(Date.now() - t).toISOString(), T = c[c.length - 1] ?? null, C = qt(e == null ? void 0 : e.metadata), S = It(C, ["branch_label", "branchLabel"]), k = It(x, ["checkpoint_id", "checkpointId"]), N = Array.isArray(e.next) ? [...e.next] : (e == null ? void 0 : e.next) === null ? null : void 0;
2622
2622
  return {
2623
2623
  messages: c,
2624
2624
  checkpointId: p ?? null,
@@ -2734,7 +2734,7 @@ function Ax(e, t) {
2734
2734
  }
2735
2735
  const n = qt(e);
2736
2736
  if (!n) return null;
2737
- const r = Et(n, ["id", "task_id", "taskId"]) ?? t, o = Et(n, ["name"]) ?? "task", s = Array.isArray(n.interrupts) ? n.interrupts : void 0, i = Object.prototype.hasOwnProperty.call(n, "state") ? n.state : void 0;
2737
+ const r = It(n, ["id", "task_id", "taskId"]) ?? t, o = It(n, ["name"]) ?? "task", s = Array.isArray(n.interrupts) ? n.interrupts : void 0, i = Object.prototype.hasOwnProperty.call(n, "state") ? n.state : void 0;
2738
2738
  return { id: r, name: o, interrupts: s, state: i };
2739
2739
  }
2740
2740
  function Wr(e, t, n = 0, r = /* @__PURE__ */ new Set()) {
@@ -2787,7 +2787,7 @@ function Ru(e, t) {
2787
2787
  if (!e)
2788
2788
  return null;
2789
2789
  if (typeof e == "object" && !Array.isArray(e)) {
2790
- const n = e, r = Et(n, ["type", "event", "kind"]), o = Et(n, ["id", "interrupt_id", "interruptId", "value_id"]) ?? (r && r.toLowerCase().includes("interrupt") ? t : void 0);
2790
+ const n = e, r = It(n, ["type", "event", "kind"]), o = It(n, ["id", "interrupt_id", "interruptId", "value_id"]) ?? (r && r.toLowerCase().includes("interrupt") ? t : void 0);
2791
2791
  if (!(Object.prototype.hasOwnProperty.call(n, "value") || Object.prototype.hasOwnProperty.call(n, "data") || Object.prototype.hasOwnProperty.call(n, "payload")) && !(r && r.toLowerCase().includes("interrupt")))
2792
2792
  return null;
2793
2793
  const i = Object.prototype.hasOwnProperty.call(n, "value") ? n.value : Object.prototype.hasOwnProperty.call(n, "data") ? n.data : Object.prototype.hasOwnProperty.call(n, "payload") ? n.payload : n, a = o && o.trim() ? o : t;
@@ -2819,7 +2819,7 @@ function jx(e, t) {
2819
2819
  ).toLowerCase(), i = bx[s];
2820
2820
  if (!i)
2821
2821
  return null;
2822
- const a = o.id ?? o.message_id ?? o.run_id ?? null, l = typeof a == "string" && a.trim() ? a : `history-${i}-${t}`, c = qt(o.additional_kwargs) ?? qt(o.additionalKwargs), d = qt(o.response_metadata) ?? qt(o.responseMetadata), f = Et(c, ["createdAt", "created_at"]) ?? Et(o, ["created_at", "createdAt"]), p = Et(c, ["checkpointId", "checkpoint_id"]), h = Et(c, ["checkpointNs", "checkpoint_ns"]), m = _x(o.content), x = {
2822
+ const a = o.id ?? o.message_id ?? o.run_id ?? null, l = typeof a == "string" && a.trim() ? a : `history-${i}-${t}`, c = qt(o.additional_kwargs) ?? qt(o.additionalKwargs), d = qt(o.response_metadata) ?? qt(o.responseMetadata), f = It(c, ["createdAt", "created_at"]) ?? It(o, ["created_at", "createdAt"]), p = It(c, ["checkpointId", "checkpoint_id"]), h = It(c, ["checkpointNs", "checkpoint_ns"]), m = _x(o.content), x = {
2823
2823
  id: l,
2824
2824
  role: i,
2825
2825
  content: m
@@ -2863,13 +2863,13 @@ function Ml(e) {
2863
2863
  return o.trim() ? { type: "text", text: o } : null;
2864
2864
  }
2865
2865
  if (n === "image" || n === "image_url") {
2866
- const o = Et(t, ["url", "src"]);
2866
+ const o = It(t, ["url", "src"]);
2867
2867
  if (!o) return null;
2868
2868
  const s = { type: "image_url", url: o };
2869
2869
  return typeof t.mimeType == "string" && (s.mimeType = t.mimeType), typeof t.alt == "string" && (s.alt = t.alt), s;
2870
2870
  }
2871
2871
  if (n === "file") {
2872
- const o = Et(t, ["url"]);
2872
+ const o = It(t, ["url"]);
2873
2873
  if (!o) return null;
2874
2874
  const s = { type: "file", url: o };
2875
2875
  return typeof t.mimeType == "string" && (s.mimeType = t.mimeType), typeof t.name == "string" && (s.name = t.name), typeof t.size == "number" && (s.size = t.size), typeof t.sourceType == "string" && (s.sourceType = t.sourceType), s;
@@ -2887,7 +2887,7 @@ function Ml(e) {
2887
2887
  ...t
2888
2888
  };
2889
2889
  if (n === "tool") {
2890
- const o = Et(t, ["text", "content"]);
2890
+ const o = It(t, ["text", "content"]);
2891
2891
  if (o)
2892
2892
  return { type: "text", text: o };
2893
2893
  }
@@ -2896,7 +2896,7 @@ function Ml(e) {
2896
2896
  }
2897
2897
  function Eu(e, t) {
2898
2898
  var s;
2899
- const n = Et(e, ["id", "call_id"]) ?? t, r = Et(e, ["name"]) ?? Et(qt(e.function), ["name"]);
2899
+ const n = It(e, ["id", "call_id"]) ?? t, r = It(e, ["name"]) ?? It(qt(e.function), ["name"]);
2900
2900
  if (!n || !r) return null;
2901
2901
  const o = Mx(e.args ?? e.arguments ?? ((s = qt(e.function)) == null ? void 0 : s.arguments));
2902
2902
  return { type: "tool_call", id: n, name: r, args: o };
@@ -2929,7 +2929,7 @@ function qt(e) {
2929
2929
  if (!(!e || typeof e != "object" || Array.isArray(e)))
2930
2930
  return { ...e };
2931
2931
  }
2932
- function Et(e, t) {
2932
+ function It(e, t) {
2933
2933
  if (e)
2934
2934
  for (const n of t) {
2935
2935
  const r = e[n];
@@ -3064,7 +3064,7 @@ function Bx(e = []) {
3064
3064
  kt(() => () => {
3065
3065
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
3066
3066
  }, []);
3067
- const c = at(() => ({
3067
+ const c = lt(() => ({
3068
3068
  reset: (d) => n({ type: "reset", payload: { messages: d } }),
3069
3069
  seed: (d, f) => n({ type: "seed", payload: { messages: d, ...f ?? {} } }),
3070
3070
  prepend: (d) => n({ type: "prepend", payload: { messages: d } }),
@@ -3398,7 +3398,7 @@ function Vx(e) {
3398
3398
  return t[t.length - 1] || null;
3399
3399
  }
3400
3400
  function Kx(e = {}) {
3401
- const t = at(() => _n(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = xe(e.token ?? null), s = Qe(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = xe(!1), [c, d] = xe(null), [f, p] = xe(""), [h, m] = xe(null), [x, y] = xe(0), [g, w] = xe(!1), b = Qe(null), T = Qe(!0), C = Qe(0), S = Qe(null), k = Qe(null), N = Qe(null), E = Qe(null), I = ke((j) => {
3401
+ const t = lt(() => _n(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = xe(e.token ?? null), s = Qe(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = xe(!1), [c, d] = xe(null), [f, p] = xe(""), [h, m] = xe(null), [x, y] = xe(0), [g, w] = xe(!1), b = Qe(null), T = Qe(!0), C = Qe(0), S = Qe(null), k = Qe(null), N = Qe(null), E = Qe(null), I = ke((j) => {
3402
3402
  o(j);
3403
3403
  }, []), P = ke(() => {
3404
3404
  p(""), m(null), d(null), k.current = null, N.current = null, E.current = null;
@@ -3415,34 +3415,34 @@ function Kx(e = {}) {
3415
3415
  threadId: j.threadId ?? null,
3416
3416
  headers: {}
3417
3417
  }, (async () => {
3418
- var pe, Ie, Ae, K, ee, q, M, H, te, oe, ne, Te, Z, de, Ee, Ne, Le, Je;
3419
- const X = (He) => {
3420
- var Ve;
3418
+ var pe, Ie, Ae, V, ee, q, M, H, te, oe, ne, Te, Z, de, Ee, Ne, Fe, Je;
3419
+ const X = (Ue) => {
3420
+ var Ke;
3421
3421
  try {
3422
- const Ke = JSON.parse(JSON.stringify(He));
3423
- return (Ve = Ke == null ? void 0 : Ke.payload) != null && Ve.files_info && Array.isArray(Ke.payload.files_info) && (Ke.payload.files_info = Ke.payload.files_info.map((Xe) => ({
3422
+ const qe = JSON.parse(JSON.stringify(Ue));
3423
+ return (Ke = qe == null ? void 0 : qe.payload) != null && Ke.files_info && Array.isArray(qe.payload.files_info) && (qe.payload.files_info = qe.payload.files_info.map((Xe) => ({
3424
3424
  ...Xe,
3425
3425
  data: Xe != null && Xe.data ? `<base64 ${String(Xe.data).length} chars>` : Xe == null ? void 0 : Xe.data
3426
- }))), Ke;
3426
+ }))), qe;
3427
3427
  } catch {
3428
- return He;
3428
+ return Ue;
3429
3429
  }
3430
3430
  };
3431
3431
  try {
3432
- let He = {};
3432
+ let Ue = {};
3433
3433
  try {
3434
3434
  if (r)
3435
- He = { Authorization: `Bearer ${r}` };
3435
+ Ue = { Authorization: `Bearer ${r}` };
3436
3436
  else if (typeof window < "u") {
3437
- const ze = window.__AUTH_TOKEN__, Pt = ((pe = window.localStorage) == null ? void 0 : pe.getItem("authToken")) || null;
3437
+ const Be = window.__AUTH_TOKEN__, Pt = ((pe = window.localStorage) == null ? void 0 : pe.getItem("authToken")) || null;
3438
3438
  let jt = null;
3439
3439
  try {
3440
3440
  const we = (Ie = window.localStorage) == null ? void 0 : Ie.getItem("chat-settings");
3441
3441
  we && (jt = ((Ae = JSON.parse(we)) == null ? void 0 : Ae.apiKey) || null);
3442
3442
  } catch {
3443
3443
  }
3444
- const W = ze || Pt || jt || null;
3445
- W && (He = { Authorization: `Bearer ${W}` });
3444
+ const W = Be || Pt || jt || null;
3445
+ W && (Ue = { Authorization: `Bearer ${W}` });
3446
3446
  }
3447
3447
  } catch {
3448
3448
  }
@@ -3451,21 +3451,21 @@ function Kx(e = {}) {
3451
3451
  t + n,
3452
3452
  X(j)
3453
3453
  );
3454
- let Ve = {};
3454
+ let Ke = {};
3455
3455
  if (typeof window < "u")
3456
3456
  try {
3457
- const st = (K = window.localStorage) == null ? void 0 : K.getItem("authSessionId");
3458
- st && (Ve = { "X-Session-Id": st });
3457
+ const it = (V = window.localStorage) == null ? void 0 : V.getItem("authSessionId");
3458
+ it && (Ke = { "X-Session-Id": it });
3459
3459
  } catch {
3460
3460
  }
3461
- const Ke = {
3462
- ...He,
3463
- ...Ve,
3461
+ const qe = {
3462
+ ...Ue,
3463
+ ...Ke,
3464
3464
  ...s.current
3465
3465
  }, Xe = {
3466
3466
  "Content-Type": "application/json",
3467
3467
  Accept: "text/event-stream",
3468
- ...Ke
3468
+ ...qe
3469
3469
  }, Ze = await fetch(t + n, {
3470
3470
  method: "POST",
3471
3471
  headers: Xe,
@@ -3473,64 +3473,64 @@ function Kx(e = {}) {
3473
3473
  signal: B.signal,
3474
3474
  credentials: i
3475
3475
  });
3476
- if (S.current && (S.current.headers = Ke), !Ze.ok || !Ze.body) {
3477
- const st = await Ze.text().catch(() => "");
3476
+ if (S.current && (S.current.headers = qe), !Ze.ok || !Ze.body) {
3477
+ const it = await Ze.text().catch(() => "");
3478
3478
  console.debug(
3479
3479
  "[use-chat] non-OK response",
3480
3480
  Ze.status,
3481
- st == null ? void 0 : st.slice(0, 500)
3481
+ it == null ? void 0 : it.slice(0, 500)
3482
3482
  );
3483
- const ze = `stream ${Ze.status}${st ? ": " + st : ""}`;
3484
- throw (ee = A == null ? void 0 : A.onConnectionError) == null || ee.call(A, ze), J = !0, D = "error", O = ze, new Error(ze);
3483
+ const Be = `stream ${Ze.status}${it ? ": " + it : ""}`;
3484
+ throw (ee = A == null ? void 0 : A.onConnectionError) == null || ee.call(A, Be), J = !0, D = "error", O = Be, new Error(Be);
3485
3485
  }
3486
3486
  w(!0);
3487
- const tt = Ze.body.getReader(), Nt = new TextDecoder();
3488
- let ht = "", lt = [];
3487
+ const tt = Ze.body.getReader(), At = new TextDecoder();
3488
+ let mt = "", ct = [];
3489
3489
  C.current = 0, y(0);
3490
3490
  let ce = 0, fe = null;
3491
3491
  const he = () => {
3492
- if (lt.length) {
3493
- const st = lt.join("");
3494
- lt = [], T.current && p((ze) => ze + st);
3492
+ if (ct.length) {
3493
+ const it = ct.join("");
3494
+ ct = [], T.current && p((Be) => Be + it);
3495
3495
  }
3496
3496
  fe = null;
3497
- }, qe = () => {
3497
+ }, ze = () => {
3498
3498
  typeof window < "u" && fe == null && (fe = requestAnimationFrame(he));
3499
3499
  };
3500
- let Fe = Date.now();
3501
- const yt = setInterval(() => {
3502
- var st;
3503
- if (Date.now() - Fe > 18e5) {
3504
- const ze = "Stream idle timeout";
3505
- d(ze), D = "error", O = ze, B.abort(), (st = A == null ? void 0 : A.onError) == null || st.call(A, ze);
3500
+ let De = Date.now();
3501
+ const st = setInterval(() => {
3502
+ var it;
3503
+ if (Date.now() - De > 18e5) {
3504
+ const Be = "Stream idle timeout";
3505
+ d(Be), D = "error", O = Be, B.abort(), (it = A == null ? void 0 : A.onError) == null || it.call(A, Be);
3506
3506
  }
3507
- }, 5e3), At = 1024 * 1024;
3507
+ }, 5e3), Et = 1024 * 1024;
3508
3508
  try {
3509
- const st = Ze.headers.get("X-Thread-Id") || Ze.headers.get("x-thread-id"), ze = Ze.headers.get("X-Thread-Created") || Ze.headers.get("x-thread-created"), Pt = st ?? null, jt = String(ze ?? "").toLowerCase() === "true";
3509
+ const it = Ze.headers.get("X-Thread-Id") || Ze.headers.get("x-thread-id"), Be = Ze.headers.get("X-Thread-Created") || Ze.headers.get("x-thread-created"), Pt = it ?? null, jt = String(Be ?? "").toLowerCase() === "true";
3510
3510
  for (S.current && !S.current.threadId && (S.current = {
3511
3511
  ...S.current,
3512
3512
  threadId: Pt
3513
3513
  }), (q = A == null ? void 0 : A.onOpen) == null || q.call(A, { threadId: Pt, created: jt }); ; ) {
3514
3514
  const { value: W, done: we } = await tt.read();
3515
3515
  if (we) break;
3516
- ht += Nt.decode(W, { stream: !0 }), ht.length > At && (ht = "", console.warn("Stream buffer reset: exceeded 1MB"));
3516
+ mt += At.decode(W, { stream: !0 }), mt.length > Et && (mt = "", console.warn("Stream buffer reset: exceeded 1MB"));
3517
3517
  let ye;
3518
- for (; (ye = ht.indexOf(`
3518
+ for (; (ye = mt.indexOf(`
3519
3519
 
3520
3520
  `)) >= 0; ) {
3521
- const pt = ht.slice(0, ye);
3522
- ht = ht.slice(ye + 2);
3523
- const mt = Gx(pt);
3524
- if (!mt) continue;
3521
+ const ht = mt.slice(0, ye);
3522
+ mt = mt.slice(ye + 2);
3523
+ const gt = Gx(ht);
3524
+ if (!gt) continue;
3525
3525
  let St;
3526
3526
  try {
3527
- St = JSON.parse(mt);
3527
+ St = JSON.parse(gt);
3528
3528
  } catch {
3529
- console.debug("[use-chat] malformed SSE:", mt.slice(0, 200));
3529
+ console.debug("[use-chat] malformed SSE:", gt.slice(0, 200));
3530
3530
  continue;
3531
3531
  }
3532
3532
  const Pe = qx(St) ? St.data : St;
3533
- Fe = Date.now();
3533
+ De = Date.now();
3534
3534
  const Vt = Pe.seq;
3535
3535
  if (Vt !== void 0) {
3536
3536
  if (Vt <= ce) {
@@ -3543,9 +3543,9 @@ function Kx(e = {}) {
3543
3543
  seq: Pe.seq,
3544
3544
  type: Pe.type,
3545
3545
  preview: (() => {
3546
- var ct;
3546
+ var ut;
3547
3547
  try {
3548
- return Pe.type === "message_delta" ? { deltaTypes: (ct = Pe.delta) == null ? void 0 : ct.map((Ct) => Ct.type), textLen: (Pe.delta || []).filter((Ct) => Ct.type === "text").map((Ct) => String(Ct.text || "").length) } : Pe.content || Pe.delta ? { hasContent: !0 } : {};
3548
+ return Pe.type === "message_delta" ? { deltaTypes: (ut = Pe.delta) == null ? void 0 : ut.map((Ct) => Ct.type), textLen: (Pe.delta || []).filter((Ct) => Ct.type === "text").map((Ct) => String(Ct.text || "").length) } : Pe.content || Pe.delta ? { hasContent: !0 } : {};
3549
3549
  } catch (Ct) {
3550
3550
  return { err: String(Ct) };
3551
3551
  }
@@ -3557,35 +3557,35 @@ function Kx(e = {}) {
3557
3557
  try {
3558
3558
  const Ct = Ur(Pe).latest;
3559
3559
  Ct && (k.current = Ct.checkpointId ?? null, N.current = Ct.checkpointNs ?? null, m(Ct.checkpointId ?? null));
3560
- } catch (ct) {
3561
- console.warn("[use-chat] Failed to hydrate state_history payload", ct);
3560
+ } catch (ut) {
3561
+ console.warn("[use-chat] Failed to hydrate state_history payload", ut);
3562
3562
  }
3563
3563
  }
3564
3564
  try {
3565
3565
  $ == null || $(Pe);
3566
- } catch (ct) {
3567
- console.error("[use-chat] Error in onEvent callback:", ct, "for event:", Pe.type);
3566
+ } catch (ut) {
3567
+ console.error("[use-chat] Error in onEvent callback:", ut, "for event:", Pe.type);
3568
3568
  }
3569
3569
  if (Pe.type === "token" && e.autoAppendAssistant !== !1)
3570
- lt.push(Pe.content), qe();
3570
+ ct.push(Pe.content), ze();
3571
3571
  else if (Pe.type === "message_delta") {
3572
- const ct = Pe.delta.filter((Ct) => Ct.type === "text").map((Ct) => Ct.text).join("");
3573
- ct && e.autoAppendAssistant !== !1 && (lt.push(ct), qe());
3572
+ const ut = Pe.delta.filter((Ct) => Ct.type === "text").map((Ct) => Ct.text).join("");
3573
+ ut && e.autoAppendAssistant !== !1 && (ct.push(ut), ze());
3574
3574
  } else if (Pe.type === "heartbeat") {
3575
3575
  console.debug("[use-chat] heartbeat received");
3576
3576
  try {
3577
3577
  (H = A == null ? void 0 : A.onHeartbeat) == null || H.call(A, Pe);
3578
- } catch (ct) {
3579
- console.warn("[use-chat] heartbeat callback failed", ct);
3578
+ } catch (ut) {
3579
+ console.warn("[use-chat] heartbeat callback failed", ut);
3580
3580
  }
3581
3581
  } else if (fe !== null && cancelAnimationFrame(fe), he(), Pe.type === "checkpoint")
3582
3582
  m(Pe.checkpointId);
3583
3583
  else if (Pe.type === "error") {
3584
- const ct = Pe;
3585
- if (d(ct.message), D = "error", O = ct.message, ct.error_type === "auth_error" || ct.code === "TOKEN_EXPIRED" || ((te = ct.message) == null ? void 0 : te.includes("token")) || ((oe = ct.message) == null ? void 0 : oe.includes("401")) || ((ne = ct.message) == null ? void 0 : ne.includes("unauthorized")) || ((Te = ct.message) == null ? void 0 : Te.includes("Unauthorized"))) {
3586
- console.error("[use-chat] Auth error detected:", ct.message);
3584
+ const ut = Pe;
3585
+ if (d(ut.message), D = "error", O = ut.message, ut.error_type === "auth_error" || ut.code === "TOKEN_EXPIRED" || ((te = ut.message) == null ? void 0 : te.includes("token")) || ((oe = ut.message) == null ? void 0 : oe.includes("401")) || ((ne = ut.message) == null ? void 0 : ne.includes("unauthorized")) || ((Te = ut.message) == null ? void 0 : Te.includes("Unauthorized"))) {
3586
+ console.error("[use-chat] Auth error detected:", ut.message);
3587
3587
  try {
3588
- (Z = A == null ? void 0 : A.onAuthError) == null || Z.call(A, ct.message);
3588
+ (Z = A == null ? void 0 : A.onAuthError) == null || Z.call(A, ut.message);
3589
3589
  } catch (Dn) {
3590
3590
  console.warn("[use-chat] onAuthError handler failed", Dn);
3591
3591
  }
@@ -3595,12 +3595,12 @@ function Kx(e = {}) {
3595
3595
  }
3596
3596
  }
3597
3597
  he(), D === null && !B.signal.aborted && (D = "complete");
3598
- } catch (st) {
3599
- if (st.name === "AbortError")
3598
+ } catch (it) {
3599
+ if (it.name === "AbortError")
3600
3600
  D = D ?? "aborted";
3601
3601
  else {
3602
- const ze = st.message || String(st);
3603
- D = "error", O = ze, d(ze), (de = A == null ? void 0 : A.onError) == null || de.call(A, ze);
3602
+ const Be = it.message || String(it);
3603
+ D = "error", O = Be, d(Be), (de = A == null ? void 0 : A.onError) == null || de.call(A, Be);
3604
3604
  }
3605
3605
  } finally {
3606
3606
  try {
@@ -3609,23 +3609,23 @@ function Kx(e = {}) {
3609
3609
  } finally {
3610
3610
  (Ee = tt.releaseLock) == null || Ee.call(tt);
3611
3611
  }
3612
- fe !== null && typeof window < "u" && window.cancelAnimationFrame(fe), clearInterval(yt);
3612
+ fe !== null && typeof window < "u" && window.cancelAnimationFrame(fe), clearInterval(st);
3613
3613
  }
3614
- } catch (He) {
3615
- if (He.name === "AbortError")
3614
+ } catch (Ue) {
3615
+ if (Ue.name === "AbortError")
3616
3616
  D = D ?? "aborted";
3617
3617
  else {
3618
- const Ve = He.message || String(He);
3619
- D = "error", O = Ve, d(Ve), (Ne = A == null ? void 0 : A.onError) == null || Ne.call(A, Ve), J || ((Le = A == null ? void 0 : A.onConnectionError) == null || Le.call(A, Ve), J = !0);
3618
+ const Ke = Ue.message || String(Ue);
3619
+ D = "error", O = Ke, d(Ke), (Ne = A == null ? void 0 : A.onError) == null || Ne.call(A, Ke), J || ((Fe = A == null ? void 0 : A.onConnectionError) == null || Fe.call(A, Ke), J = !0);
3620
3620
  }
3621
3621
  } finally {
3622
- const He = C.current, Ve = k.current, Ke = N.current, Xe = E.current, Ze = D ?? (B.signal.aborted ? "aborted" : O ? "error" : "complete");
3622
+ const Ue = C.current, Ke = k.current, qe = N.current, Xe = E.current, Ze = D ?? (B.signal.aborted ? "aborted" : O ? "error" : "complete");
3623
3623
  try {
3624
3624
  (Je = A == null ? void 0 : A.onClosed) == null || Je.call(A, {
3625
3625
  reason: Ze,
3626
- lastSeq: He,
3627
- lastCheckpointId: Ve,
3628
- lastCheckpointNs: Ke,
3626
+ lastSeq: Ue,
3627
+ lastCheckpointId: Ke,
3628
+ lastCheckpointNs: qe,
3629
3629
  lastStateHistory: Xe,
3630
3630
  error: O
3631
3631
  });
@@ -3850,7 +3850,7 @@ function Yx({
3850
3850
  ), N = ke(() => {
3851
3851
  p.current && (p.current.manualStop = !0), b();
3852
3852
  }, [b]);
3853
- return at(
3853
+ return lt(
3854
3854
  () => ({
3855
3855
  startStream: k,
3856
3856
  stop: N,
@@ -3875,14 +3875,14 @@ function Xx({
3875
3875
  onThreadChange: a,
3876
3876
  checkpointMetadataCache: l
3877
3877
  }) {
3878
- const { api: c, baseUrl: d } = Tu(), f = at(() => _n(d), [d]), [p, h] = xe([]), [m, x] = xe(t), [y, g] = xe(!1), [w, b] = xe(null), [T, C] = xe(!1), [S, k] = xe(null), { state: N, seed: E, prepend: I, pushUser: P, onEvent: L } = Bx(), [F, j] = xe(!1), [$, A] = xe(!1), [B, D] = xe(null), [O, J] = xe([]), [X, pe] = xe(!1), Ie = l ?? Lx(), { setCacheForThread: Ae } = Ie, K = Qe(m), ee = Qe(null);
3878
+ const { api: c, baseUrl: d } = Tu(), f = lt(() => _n(d), [d]), [p, h] = xe([]), [m, x] = xe(t), [y, g] = xe(!1), [w, b] = xe(null), [T, C] = xe(!1), [S, k] = xe(null), { state: N, seed: E, prepend: I, pushUser: P, onEvent: L } = Bx(), [F, j] = xe(!1), [$, A] = xe(!1), [B, D] = xe(null), [O, J] = xe([]), [X, pe] = xe(!1), Ie = l ?? Lx(), { setCacheForThread: Ae } = Ie, V = Qe(m), ee = Qe(null);
3879
3879
  kt(() => {
3880
- K.current = m;
3880
+ V.current = m;
3881
3881
  }, [m]);
3882
3882
  const q = Qe(), { startStream: M, stop: H, isStreaming: te, error: oe, setAuthToken: ne } = Yx({
3883
3883
  baseUrl: f,
3884
3884
  onThreadInfo: (ce) => {
3885
- console.log("[ChatSessionProvider] Thread info:", ce.threadId), K.current !== ce.threadId && x(ce.threadId);
3885
+ console.log("[ChatSessionProvider] Thread info:", ce.threadId), V.current !== ce.threadId && x(ce.threadId);
3886
3886
  },
3887
3887
  onMessageEvent: L,
3888
3888
  onUnhandledEvent: (ce) => {
@@ -3913,7 +3913,7 @@ function Xx({
3913
3913
  ), de = ke(
3914
3914
  async (ce) => {
3915
3915
  try {
3916
- await c.deleteThread(ce), K.current === ce && (x(null), E([], {})), await Te();
3916
+ await c.deleteThread(ce), V.current === ce && (x(null), E([], {})), await Te();
3917
3917
  } catch (fe) {
3918
3918
  s == null || s(String(fe));
3919
3919
  }
@@ -3930,15 +3930,15 @@ function Xx({
3930
3930
  [c, Te, s]
3931
3931
  ), Ne = ke(
3932
3932
  (ce, fe, he) => {
3933
- const qe = fe.filter((Fe) => Fe.checkpointId).map((Fe) => ({
3934
- checkpointId: Fe.checkpointId,
3935
- checkpointNs: Fe.checkpointNs ?? void 0,
3936
- createdAt: Fe.createdAt ?? ""
3933
+ const ze = fe.filter((De) => De.checkpointId).map((De) => ({
3934
+ checkpointId: De.checkpointId,
3935
+ checkpointNs: De.checkpointNs ?? void 0,
3936
+ createdAt: De.createdAt ?? ""
3937
3937
  }));
3938
- console.log(`[ChatSessionProvider] Cached metadata for ${qe.length} checkpoints from ${he}`), Ae(ce, qe);
3938
+ console.log(`[ChatSessionProvider] Cached metadata for ${ze.length} checkpoints from ${he}`), Ae(ce, ze);
3939
3939
  },
3940
3940
  [Ae]
3941
- ), Le = ke(
3941
+ ), Fe = ke(
3942
3942
  async (ce, fe) => {
3943
3943
  if (ce) {
3944
3944
  C(!0), k(null);
@@ -3947,16 +3947,16 @@ function Xx({
3947
3947
  threadId: ce,
3948
3948
  checkpointId: fe || void 0
3949
3949
  // Let backend pick latest if not specified
3950
- }), { checkpoints: qe } = Ur(he);
3951
- Ne(ce, qe, `thread load (requested: ${fe})`);
3952
- const Fe = qe.find((yt) => yt.messages && yt.messages.length > 0) ?? (fe ? qe.find((yt) => yt.checkpointId === fe) : null) ?? qe[0];
3953
- E((Fe == null ? void 0 : Fe.messages) ?? [], {
3954
- checkpointId: (Fe == null ? void 0 : Fe.checkpointId) ?? null,
3955
- checkpointNs: (Fe == null ? void 0 : Fe.checkpointNs) ?? null
3956
- }), J(qe), j(!!(Fe != null && Fe.nextCursor)), D((Fe == null ? void 0 : Fe.nextCursor) ?? null);
3950
+ }), { checkpoints: ze } = Ur(he);
3951
+ Ne(ce, ze, `thread load (requested: ${fe})`);
3952
+ const De = ze.find((st) => st.messages && st.messages.length > 0) ?? (fe ? ze.find((st) => st.checkpointId === fe) : null) ?? ze[0];
3953
+ E((De == null ? void 0 : De.messages) ?? [], {
3954
+ checkpointId: (De == null ? void 0 : De.checkpointId) ?? null,
3955
+ checkpointNs: (De == null ? void 0 : De.checkpointNs) ?? null
3956
+ }), J(ze), j(!!(De != null && De.nextCursor)), D((De == null ? void 0 : De.nextCursor) ?? null);
3957
3957
  } catch (he) {
3958
- const qe = String(he);
3959
- k(qe), s == null || s(qe);
3958
+ const ze = String(he);
3959
+ k(ze), s == null || s(ze);
3960
3960
  } finally {
3961
3961
  C(!1);
3962
3962
  }
@@ -3965,40 +3965,40 @@ function Xx({
3965
3965
  [c, E, s, Ne]
3966
3966
  );
3967
3967
  kt(() => {
3968
- q.current = Le;
3969
- }, [Le]);
3968
+ q.current = Fe;
3969
+ }, [Fe]);
3970
3970
  const Je = ke(
3971
3971
  async (ce, fe) => {
3972
- const he = K.current;
3972
+ const he = V.current;
3973
3973
  if (he) {
3974
3974
  pe(!0);
3975
3975
  try {
3976
- const qe = await c.getStateHistory({
3976
+ const ze = await c.getStateHistory({
3977
3977
  threadId: he,
3978
3978
  checkpointId: ce,
3979
3979
  checkpointNs: fe ?? void 0
3980
- }), { checkpoints: Fe } = Ur(qe);
3981
- Ne(he, Fe, "checkpoint navigation");
3982
- const yt = Fe.find(
3983
- (At) => At.checkpointId === ce && (fe ? At.checkpointNs === fe : !0)
3980
+ }), { checkpoints: De } = Ur(ze);
3981
+ Ne(he, De, "checkpoint navigation");
3982
+ const st = De.find(
3983
+ (Et) => Et.checkpointId === ce && (fe ? Et.checkpointNs === fe : !0)
3984
3984
  );
3985
- if (!yt) {
3985
+ if (!st) {
3986
3986
  console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: ce, checkpointNs: fe });
3987
3987
  return;
3988
3988
  }
3989
- J(Fe), E(yt.messages ?? [], {
3990
- checkpointId: yt.checkpointId ?? null,
3991
- checkpointNs: yt.checkpointNs ?? null
3989
+ J(De), E(st.messages ?? [], {
3990
+ checkpointId: st.checkpointId ?? null,
3991
+ checkpointNs: st.checkpointNs ?? null
3992
3992
  });
3993
- } catch (qe) {
3994
- s == null || s(String(qe));
3993
+ } catch (ze) {
3994
+ s == null || s(String(ze));
3995
3995
  } finally {
3996
3996
  pe(!1);
3997
3997
  }
3998
3998
  }
3999
3999
  },
4000
4000
  [c, E, s, Ne]
4001
- ), He = ke(
4001
+ ), Ue = ke(
4002
4002
  (ce, fe) => {
4003
4003
  E(N.messages, {
4004
4004
  checkpointId: ce ?? null,
@@ -4006,14 +4006,14 @@ function Xx({
4006
4006
  });
4007
4007
  },
4008
4008
  [E, N.messages]
4009
- ), Ve = ke(async () => {
4010
- K.current && await Le(K.current);
4011
- }, [Le]), Ke = ke(async () => {
4012
- if (!(!K.current || !B)) {
4009
+ ), Ke = ke(async () => {
4010
+ V.current && await Fe(V.current);
4011
+ }, [Fe]), qe = ke(async () => {
4012
+ if (!(!V.current || !B)) {
4013
4013
  A(!0);
4014
4014
  try {
4015
4015
  const ce = await c.getStateHistory({
4016
- threadId: K.current,
4016
+ threadId: V.current,
4017
4017
  checkpointId: B
4018
4018
  }), { checkpoints: fe } = Ur(ce);
4019
4019
  if (fe.length > 0) {
@@ -4027,12 +4027,27 @@ function Xx({
4027
4027
  }
4028
4028
  }
4029
4029
  }, [c, B, I, s]), Xe = ke(async () => {
4030
- E([], {}), J([]), j(!1), D(null);
4031
- }, [E]), Ze = ke(
4032
- async (ce, fe) => {
4033
- console.log("[ChatSessionProvider] Interrupt:", ce, fe);
4030
+ E([], {}), x(null), H(), J([]), j(!1), D(null);
4031
+ }, [E, H]), Ze = ke(
4032
+ async (ce, fe, he) => {
4033
+ const ze = V.current;
4034
+ if (!ze)
4035
+ throw new Error("No active thread to handle interrupt");
4036
+ const De = fe ? he ?? !0 : !1;
4037
+ try {
4038
+ const st = {
4039
+ threadId: ze,
4040
+ checkpointId: N.lastCheckpointId ?? void 0,
4041
+ checkpointNs: N.lastCheckpointNs ?? void 0,
4042
+ // The command is the key: backend extracts this and routes to LangGraph
4043
+ command: { kind: "resume", value: De }
4044
+ };
4045
+ M(st);
4046
+ } catch (st) {
4047
+ throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${ce}:`, st), st;
4048
+ }
4034
4049
  },
4035
- []
4050
+ [N.lastCheckpointId, N.lastCheckpointNs, M]
4036
4051
  );
4037
4052
  kt(() => {
4038
4053
  Te();
@@ -4044,33 +4059,36 @@ function Xx({
4044
4059
  }, [m, a]);
4045
4060
  const tt = ke(
4046
4061
  async (ce, fe) => {
4047
- const he = K.current, qe = (ce == null ? void 0 : ce.text) ?? "";
4048
- if (!he && !qe) return;
4062
+ const he = V.current, ze = (ce == null ? void 0 : ce.text) ?? "";
4063
+ if (!he && !ze) return;
4049
4064
  if (!he) {
4050
4065
  await Z("New Chat");
4051
4066
  return;
4052
4067
  }
4053
- const { contentParts: Fe } = await wx(
4068
+ const { contentParts: De } = await wx(
4054
4069
  c,
4055
4070
  (ce == null ? void 0 : ce.attachments) ?? []
4056
- ), yt = [...Fe];
4057
- qe != null && qe.trim() && yt.push({ type: "text", text: qe });
4058
- const At = {
4071
+ ), st = [...De];
4072
+ ze != null && ze.trim() && st.push({ type: "text", text: ze });
4073
+ const Et = {
4059
4074
  id: `msg-${Date.now()}`,
4060
4075
  role: "user",
4061
- content: yt,
4076
+ content: st,
4062
4077
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4063
4078
  };
4064
- P(At);
4065
- const st = {
4079
+ P(Et);
4080
+ const it = {
4066
4081
  threadId: he,
4082
+ payload: {
4083
+ messages: [Et]
4084
+ },
4067
4085
  checkpointId: (fe == null ? void 0 : fe.checkpointId) ?? N.lastCheckpointId ?? void 0,
4068
4086
  checkpointNs: (fe == null ? void 0 : fe.checkpointNs) ?? N.lastCheckpointNs ?? void 0
4069
4087
  };
4070
- M(st);
4088
+ M(it);
4071
4089
  },
4072
4090
  [c, Z, P, N, M]
4073
- ), Nt = at(
4091
+ ), At = lt(
4074
4092
  () => ({
4075
4093
  threads: p,
4076
4094
  currentThreadId: m,
@@ -4085,7 +4103,7 @@ function Xx({
4085
4103
  }
4086
4104
  }),
4087
4105
  [p, m, y, w, Z, de, Ee, Te]
4088
- ), ht = at(
4106
+ ), mt = lt(
4089
4107
  () => ({
4090
4108
  threadId: m,
4091
4109
  messages: N.messages,
@@ -4101,12 +4119,12 @@ function Xx({
4101
4119
  isLoadingCheckpoint: X,
4102
4120
  error: S,
4103
4121
  hasMore: F,
4104
- loadOlder: Ke,
4122
+ loadOlder: qe,
4105
4123
  clearState: Xe,
4106
4124
  navigateToCheckpoint: Je,
4107
- setCurrentCheckpointId: He,
4108
- returnToLatest: Ve,
4109
- loadThread: Le,
4125
+ setCurrentCheckpointId: Ue,
4126
+ returnToLatest: Ke,
4127
+ loadThread: Fe,
4110
4128
  clearThread: Xe,
4111
4129
  respondToInterrupt: Ze
4112
4130
  }),
@@ -4119,15 +4137,15 @@ function Xx({
4119
4137
  X,
4120
4138
  S,
4121
4139
  F,
4122
- Ke,
4140
+ qe,
4123
4141
  Xe,
4124
4142
  Je,
4125
- He,
4126
- Ve,
4127
- Le,
4143
+ Ue,
4144
+ Ke,
4145
+ Fe,
4128
4146
  Ze
4129
4147
  ]
4130
- ), lt = at(
4148
+ ), ct = lt(
4131
4149
  () => ({
4132
4150
  isStreaming: te,
4133
4151
  error: oe,
@@ -4139,7 +4157,7 @@ function Xx({
4139
4157
  }),
4140
4158
  [te, oe, tt, H, ne]
4141
4159
  );
4142
- return /* @__PURE__ */ u.jsx(Au.Provider, { value: Nt, children: /* @__PURE__ */ u.jsx(ju.Provider, { value: ht, children: /* @__PURE__ */ u.jsx(_u.Provider, { value: lt, children: e }) }) });
4160
+ return /* @__PURE__ */ u.jsx(Au.Provider, { value: At, children: /* @__PURE__ */ u.jsx(ju.Provider, { value: mt, children: /* @__PURE__ */ u.jsx(_u.Provider, { value: ct, children: e }) }) });
4143
4161
  }
4144
4162
  function xa() {
4145
4163
  const e = xs(Au);
@@ -4378,7 +4396,7 @@ function va(...e) {
4378
4396
  };
4379
4397
  };
4380
4398
  }
4381
- function We(...e) {
4399
+ function Ve(...e) {
4382
4400
  return v.useCallback(va(...e), e);
4383
4401
  }
4384
4402
  function ty(e, t) {
@@ -4534,14 +4552,14 @@ function wa(e) {
4534
4552
  i.displayName = t;
4535
4553
  const a = e + "CollectionSlot", l = Tr(a), c = z.forwardRef(
4536
4554
  (x, y) => {
4537
- const { scope: g, children: w } = x, b = s(a, g), T = We(y, b.collectionRef);
4555
+ const { scope: g, children: w } = x, b = s(a, g), T = Ve(y, b.collectionRef);
4538
4556
  return /* @__PURE__ */ u.jsx(l, { ref: T, children: w });
4539
4557
  }
4540
4558
  );
4541
4559
  c.displayName = a;
4542
4560
  const d = e + "CollectionItemSlot", f = "data-radix-collection-item", p = Tr(d), h = z.forwardRef(
4543
4561
  (x, y) => {
4544
- const { scope: g, children: w, ...b } = x, T = z.useRef(null), C = We(y, T), S = s(d, g);
4562
+ const { scope: g, children: w, ...b } = x, T = z.useRef(null), C = Ve(y, T), S = s(d, g);
4545
4563
  return z.useEffect(() => (S.itemMap.set(T, { ref: T, ...b }), () => void S.itemMap.delete(T))), /* @__PURE__ */ u.jsx(p, { [f]: "", ref: C, children: w });
4546
4564
  }
4547
4565
  );
@@ -4600,7 +4618,7 @@ var cy = "DismissableLayer", Bi = "dismissableLayer.update", uy = "dismissableLa
4600
4618
  onInteractOutside: i,
4601
4619
  onDismiss: a,
4602
4620
  ...l
4603
- } = e, c = v.useContext(Mu), [d, f] = v.useState(null), p = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, h] = v.useState({}), m = We(t, (k) => f(k)), x = Array.from(c.layers), [y] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), g = x.indexOf(y), w = d ? x.indexOf(d) : -1, b = c.layersWithOutsidePointerEventsDisabled.size > 0, T = w >= g, C = hy((k) => {
4621
+ } = e, c = v.useContext(Mu), [d, f] = v.useState(null), p = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, h] = v.useState({}), m = Ve(t, (k) => f(k)), x = Array.from(c.layers), [y] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), g = x.indexOf(y), w = d ? x.indexOf(d) : -1, b = c.layersWithOutsidePointerEventsDisabled.size > 0, T = w >= g, C = hy((k) => {
4604
4622
  const N = k.target, E = [...c.branches].some((I) => I.contains(N));
4605
4623
  !T || E || (o == null || o(k), i == null || i(k), k.defaultPrevented || a == null || a());
4606
4624
  }, p), S = my((k) => {
@@ -4640,7 +4658,7 @@ var cy = "DismissableLayer", Bi = "dismissableLayer.update", uy = "dismissableLa
4640
4658
  );
4641
4659
  Es.displayName = cy;
4642
4660
  var fy = "DismissableLayerBranch", py = v.forwardRef((e, t) => {
4643
- const n = v.useContext(Mu), r = v.useRef(null), o = We(t, r);
4661
+ const n = v.useContext(Mu), r = v.useRef(null), o = Ve(t, r);
4644
4662
  return v.useEffect(() => {
4645
4663
  const s = r.current;
4646
4664
  if (s)
@@ -4722,7 +4740,7 @@ var hi = "focusScope.autoFocusOnMount", mi = "focusScope.autoFocusOnUnmount", Kl
4722
4740
  onMountAutoFocus: o,
4723
4741
  onUnmountAutoFocus: s,
4724
4742
  ...i
4725
- } = e, [a, l] = v.useState(null), c = Dt(o), d = Dt(s), f = v.useRef(null), p = We(t, (x) => l(x)), h = v.useRef({
4743
+ } = e, [a, l] = v.useState(null), c = Dt(o), d = Dt(s), f = v.useRef(null), p = Ve(t, (x) => l(x)), h = v.useRef({
4726
4744
  paused: !1,
4727
4745
  pause() {
4728
4746
  this.paused = !0;
@@ -6208,7 +6226,7 @@ var Ia = "Popper", [Ju, Ps] = Mn(Ia), [Lv, Zu] = Ju(Ia), Qu = (e) => {
6208
6226
  Qu.displayName = Ia;
6209
6227
  var ed = "PopperAnchor", td = v.forwardRef(
6210
6228
  (e, t) => {
6211
- const { __scopePopper: n, virtualRef: r, ...o } = e, s = Zu(ed, n), i = v.useRef(null), a = We(t, i), l = v.useRef(null);
6229
+ const { __scopePopper: n, virtualRef: r, ...o } = e, s = Zu(ed, n), i = v.useRef(null), a = Ve(t, i), l = v.useRef(null);
6212
6230
  return v.useEffect(() => {
6213
6231
  const c = l.current;
6214
6232
  l.current = (r == null ? void 0 : r.current) || i.current, c !== l.current && s.onAnchorChange(l.current);
@@ -6234,7 +6252,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6234
6252
  updatePositionStrategy: h = "optimized",
6235
6253
  onPlaced: m,
6236
6254
  ...x
6237
- } = e, y = Zu(Na, n), [g, w] = v.useState(null), b = We(t, (Te) => w(Te)), [T, C] = v.useState(null), S = Xu(T), k = (S == null ? void 0 : S.width) ?? 0, N = (S == null ? void 0 : S.height) ?? 0, E = r + (s !== "center" ? "-" + s : ""), I = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, P = Array.isArray(c) ? c : [c], L = P.length > 0, F = {
6255
+ } = e, y = Zu(Na, n), [g, w] = v.useState(null), b = Ve(t, (Te) => w(Te)), [T, C] = v.useState(null), S = Xu(T), k = (S == null ? void 0 : S.width) ?? 0, N = (S == null ? void 0 : S.height) ?? 0, E = r + (s !== "center" ? "-" + s : ""), I = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, P = Array.isArray(c) ? c : [c], L = P.length > 0, F = {
6238
6256
  padding: I,
6239
6257
  boundary: P.filter(Bv),
6240
6258
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
@@ -6261,8 +6279,8 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6261
6279
  _v({
6262
6280
  ...F,
6263
6281
  apply: ({ elements: Te, rects: Z, availableWidth: de, availableHeight: Ee }) => {
6264
- const { width: Ne, height: Le } = Z.reference, Je = Te.floating.style;
6265
- Je.setProperty("--radix-popper-available-width", `${de}px`), Je.setProperty("--radix-popper-available-height", `${Ee}px`), Je.setProperty("--radix-popper-anchor-width", `${Ne}px`), Je.setProperty("--radix-popper-anchor-height", `${Le}px`);
6282
+ const { width: Ne, height: Fe } = Z.reference, Je = Te.floating.style;
6283
+ Je.setProperty("--radix-popper-available-width", `${de}px`), Je.setProperty("--radix-popper-available-height", `${Ee}px`), Je.setProperty("--radix-popper-anchor-width", `${Ne}px`), Je.setProperty("--radix-popper-anchor-height", `${Fe}px`);
6266
6284
  }
6267
6285
  }),
6268
6286
  T && Ov({ element: T, padding: a }),
@@ -6273,7 +6291,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6273
6291
  Lt(() => {
6274
6292
  B && (X == null || X());
6275
6293
  }, [B, X]);
6276
- const pe = (q = D.arrow) == null ? void 0 : q.x, Ie = (M = D.arrow) == null ? void 0 : M.y, Ae = ((H = D.arrow) == null ? void 0 : H.centerOffset) !== 0, [K, ee] = v.useState();
6294
+ const pe = (q = D.arrow) == null ? void 0 : q.x, Ie = (M = D.arrow) == null ? void 0 : M.y, Ae = ((H = D.arrow) == null ? void 0 : H.centerOffset) !== 0, [V, ee] = v.useState();
6277
6295
  return Lt(() => {
6278
6296
  g && ee(window.getComputedStyle(g).zIndex);
6279
6297
  }, [g]), /* @__PURE__ */ u.jsx(
@@ -6286,7 +6304,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6286
6304
  transform: B ? $.transform : "translate(0, -200%)",
6287
6305
  // keep off the page when measuring
6288
6306
  minWidth: "max-content",
6289
- zIndex: K,
6307
+ zIndex: V,
6290
6308
  "--radix-popper-transform-origin": [
6291
6309
  (te = D.transformOrigin) == null ? void 0 : te.x,
6292
6310
  (oe = D.transformOrigin) == null ? void 0 : oe.y
@@ -6411,7 +6429,7 @@ function Wv(e, t) {
6411
6429
  return v.useReducer((n, r) => t[n][r] ?? n, e);
6412
6430
  }
6413
6431
  var cn = (e) => {
6414
- const { present: t, children: n } = e, r = Vv(t), o = typeof n == "function" ? n({ present: r.isPresent }) : v.Children.only(n), s = We(r.ref, Kv(o));
6432
+ const { present: t, children: n } = e, r = Vv(t), o = typeof n == "function" ? n({ present: r.isPresent }) : v.Children.only(n), s = Ve(r.ref, Kv(o));
6415
6433
  return typeof n == "function" || r.isPresent ? v.cloneElement(o, { ref: s }) : null;
6416
6434
  };
6417
6435
  cn.displayName = "Presence";
@@ -6491,7 +6509,7 @@ var Zv = v.forwardRef((e, t) => {
6491
6509
  onEntryFocus: c,
6492
6510
  preventScrollOnEntryFocus: d = !1,
6493
6511
  ...f
6494
- } = e, p = v.useRef(null), h = We(t, p), m = Rs(s), [x, y] = Rr({
6512
+ } = e, p = v.useRef(null), h = Ve(t, p), m = Rs(s), [x, y] = Rr({
6495
6513
  prop: i,
6496
6514
  defaultProp: a ?? null,
6497
6515
  onChange: l,
@@ -7219,7 +7237,7 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
7219
7237
  }
7220
7238
  ), tb = v.forwardRef(
7221
7239
  (e, t) => {
7222
- const n = fr(an, e.__scopeMenu), r = v.useRef(null), o = We(t, r);
7240
+ const n = fr(an, e.__scopeMenu), r = v.useRef(null), o = Ve(t, r);
7223
7241
  return v.useEffect(() => {
7224
7242
  const s = r.current;
7225
7243
  if (s) return Aa(s);
@@ -7270,9 +7288,9 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
7270
7288
  onDismiss: h,
7271
7289
  disableOutsideScroll: m,
7272
7290
  ...x
7273
- } = e, y = fr(an, n), g = yo(an, n), w = Ls(n), b = Rd(n), T = Gw(n), [C, S] = v.useState(null), k = v.useRef(null), N = We(t, k, y.onContentChange), E = v.useRef(0), I = v.useRef(""), P = v.useRef(0), L = v.useRef(null), F = v.useRef("right"), j = v.useRef(0), $ = m ? Ds : v.Fragment, A = m ? { as: rb, allowPinchZoom: !0 } : void 0, B = (O) => {
7291
+ } = e, y = fr(an, n), g = yo(an, n), w = Ls(n), b = Rd(n), T = Gw(n), [C, S] = v.useState(null), k = v.useRef(null), N = Ve(t, k, y.onContentChange), E = v.useRef(0), I = v.useRef(""), P = v.useRef(0), L = v.useRef(null), F = v.useRef("right"), j = v.useRef(0), $ = m ? Ds : v.Fragment, A = m ? { as: rb, allowPinchZoom: !0 } : void 0, B = (O) => {
7274
7292
  var q, M;
7275
- const J = I.current + O, X = T().filter((H) => !H.disabled), pe = document.activeElement, Ie = (q = X.find((H) => H.ref.current === pe)) == null ? void 0 : q.textValue, Ae = X.map((H) => H.textValue), K = mb(Ae, J, Ie), ee = (M = X.find((H) => H.textValue === K)) == null ? void 0 : M.ref.current;
7293
+ const J = I.current + O, X = T().filter((H) => !H.disabled), pe = document.activeElement, Ie = (q = X.find((H) => H.ref.current === pe)) == null ? void 0 : q.textValue, Ae = X.map((H) => H.textValue), V = mb(Ae, J, Ie), ee = (M = X.find((H) => H.textValue === V)) == null ? void 0 : M.ref.current;
7276
7294
  (function H(te) {
7277
7295
  I.current = te, window.clearTimeout(E.current), te !== "" && (E.current = window.setTimeout(() => H(""), 1e3));
7278
7296
  })(J), ee && setTimeout(() => ee.focus());
@@ -7407,7 +7425,7 @@ var sb = "MenuLabel", jd = v.forwardRef(
7407
7425
  jd.displayName = sb;
7408
7426
  var ns = "MenuItem", fc = "menu.itemSelect", Fs = v.forwardRef(
7409
7427
  (e, t) => {
7410
- const { disabled: n = !1, onSelect: r, ...o } = e, s = v.useRef(null), i = yo(ns, e.__scopeMenu), a = Pa(ns, e.__scopeMenu), l = We(t, s), c = v.useRef(!1), d = () => {
7428
+ const { disabled: n = !1, onSelect: r, ...o } = e, s = v.useRef(null), i = yo(ns, e.__scopeMenu), a = Pa(ns, e.__scopeMenu), l = Ve(t, s), c = v.useRef(!1), d = () => {
7411
7429
  const f = s.current;
7412
7430
  if (!n && f) {
7413
7431
  const p = new CustomEvent(fc, { bubbles: !0, cancelable: !0 });
@@ -7440,7 +7458,7 @@ var ns = "MenuItem", fc = "menu.itemSelect", Fs = v.forwardRef(
7440
7458
  Fs.displayName = ns;
7441
7459
  var _d = v.forwardRef(
7442
7460
  (e, t) => {
7443
- const { __scopeMenu: n, disabled: r = !1, textValue: o, ...s } = e, i = Pa(ns, n), a = Rd(n), l = v.useRef(null), c = We(t, l), [d, f] = v.useState(!1), [p, h] = v.useState("");
7461
+ const { __scopeMenu: n, disabled: r = !1, textValue: o, ...s } = e, i = Pa(ns, n), a = Rd(n), l = v.useRef(null), c = Ve(t, l), [d, f] = v.useState(!1), [p, h] = v.useState("");
7444
7462
  return v.useEffect(() => {
7445
7463
  const m = l.current;
7446
7464
  m && h((m.textContent ?? "").trim());
@@ -7650,7 +7668,7 @@ var fb = "MenuSub", [mk, Hd] = dr(fb), Br = "MenuSubTrigger", Ud = v.forwardRef(
7650
7668
  Ud.displayName = Br;
7651
7669
  var Wd = "MenuSubContent", Vd = v.forwardRef(
7652
7670
  (e, t) => {
7653
- const n = Id(an, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = fr(an, e.__scopeMenu), i = yo(an, e.__scopeMenu), a = Hd(Wd, e.__scopeMenu), l = v.useRef(null), c = We(t, l);
7671
+ const n = Id(an, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = fr(an, e.__scopeMenu), i = yo(an, e.__scopeMenu), a = Hd(Wd, e.__scopeMenu), l = v.useRef(null), c = Ve(t, l);
7654
7672
  return /* @__PURE__ */ u.jsx(eo.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ u.jsx(cn, { present: r || s.open, children: /* @__PURE__ */ u.jsx(eo.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ u.jsx(
7655
7673
  Oa,
7656
7674
  {
@@ -8085,7 +8103,7 @@ function Bs(e, t) {
8085
8103
  function p0(e, t) {
8086
8104
  return t(e);
8087
8105
  }
8088
- function xt(...e) {
8106
+ function yt(...e) {
8089
8107
  return e;
8090
8108
  }
8091
8109
  function ot(e, t) {
@@ -8120,7 +8138,7 @@ function mc(e) {
8120
8138
  function bf(e, t) {
8121
8139
  return e === t;
8122
8140
  }
8123
- function gt(e = bf) {
8141
+ function xt(e = bf) {
8124
8142
  let t;
8125
8143
  return (n) => (r) => {
8126
8144
  e(t, r) || (t = r, n(r));
@@ -8169,7 +8187,7 @@ function An(e) {
8169
8187
  }, e));
8170
8188
  };
8171
8189
  }
8172
- function De(...e) {
8190
+ function Le(...e) {
8173
8191
  const t = new Array(e.length);
8174
8192
  let n = 0, r = null;
8175
8193
  const o = Math.pow(2, e.length) - 1;
@@ -8204,7 +8222,7 @@ function m0(e) {
8204
8222
  }
8205
8223
  function Y(e) {
8206
8224
  let t = e;
8207
- const n = Ue();
8225
+ const n = We();
8208
8226
  return (r, o) => {
8209
8227
  switch (r) {
8210
8228
  case zs:
@@ -8223,7 +8241,7 @@ function Y(e) {
8223
8241
  function Ht(e, t) {
8224
8242
  return Bs(Y(t), (n) => me(e, n));
8225
8243
  }
8226
- function Ue() {
8244
+ function We() {
8227
8245
  const e = [];
8228
8246
  return (t, n) => {
8229
8247
  switch (t) {
@@ -8244,7 +8262,7 @@ function Ue() {
8244
8262
  };
8245
8263
  }
8246
8264
  function en(e) {
8247
- return Bs(Ue(), (t) => me(e, t));
8265
+ return Bs(We(), (t) => me(e, t));
8248
8266
  }
8249
8267
  function et(e, t = [], { singleton: n } = { singleton: !0 }) {
8250
8268
  return {
@@ -8264,8 +8282,8 @@ function x0(e) {
8264
8282
  };
8265
8283
  return n(e);
8266
8284
  }
8267
- function It(...e) {
8268
- const t = Ue(), n = new Array(e.length);
8285
+ function Nt(...e) {
8286
+ const t = We(), n = new Array(e.length);
8269
8287
  let r = 0;
8270
8288
  const o = Math.pow(2, e.length) - 1;
8271
8289
  return e.forEach((s, i) => {
@@ -8285,7 +8303,7 @@ function It(...e) {
8285
8303
  };
8286
8304
  }
8287
8305
  function Ce(e, t = bf) {
8288
- return U(e, gt(t));
8306
+ return U(e, xt(t));
8289
8307
  }
8290
8308
  function Yi(...e) {
8291
8309
  return function(t, n) {
@@ -8433,7 +8451,7 @@ function Sf(e, t, n) {
8433
8451
  }
8434
8452
  const Wt = et(
8435
8453
  () => {
8436
- const e = Ue(), t = Ue(), n = Y(0), r = Ue(), o = Y(0), s = Ue(), i = Ue(), a = Y(0), l = Y(0), c = Y(0), d = Y(0), f = Ue(), p = Ue(), h = Y(!1), m = Y(!1), x = Y(!1);
8454
+ const e = We(), t = We(), n = Y(0), r = We(), o = Y(0), s = We(), i = We(), a = Y(0), l = Y(0), c = Y(0), d = Y(0), f = We(), p = We(), h = Y(!1), m = Y(!1), x = Y(!1);
8437
8455
  return me(
8438
8456
  U(
8439
8457
  e,
@@ -8483,15 +8501,15 @@ function Cf(e, t) {
8483
8501
  }
8484
8502
  return s.push({ end: 1 / 0, start: r, value: o }), s;
8485
8503
  }
8486
- function dt(e) {
8504
+ function ft(e) {
8487
8505
  return e === no;
8488
8506
  }
8489
8507
  function ro(e, t) {
8490
- if (!dt(e))
8508
+ if (!ft(e))
8491
8509
  return t === e.k ? e.v : t < e.k ? ro(e.l, t) : ro(e.r, t);
8492
8510
  }
8493
8511
  function gn(e, t, n = "k") {
8494
- if (dt(e))
8512
+ if (ft(e))
8495
8513
  return [-1 / 0, void 0];
8496
8514
  if (Number(e[n]) === t)
8497
8515
  return [e.k, e.v];
@@ -8502,24 +8520,24 @@ function gn(e, t, n = "k") {
8502
8520
  return gn(e.l, t, n);
8503
8521
  }
8504
8522
  function Zt(e, t, n) {
8505
- return dt(e) ? Rf(t, n, 1) : t === e.k ? _t(e, { k: t, v: n }) : t < e.k ? xc(_t(e, { l: Zt(e.l, t, n) })) : xc(_t(e, { r: Zt(e.r, t, n) }));
8523
+ return ft(e) ? Rf(t, n, 1) : t === e.k ? _t(e, { k: t, v: n }) : t < e.k ? xc(_t(e, { l: Zt(e.l, t, n) })) : xc(_t(e, { r: Zt(e.r, t, n) }));
8506
8524
  }
8507
8525
  function Sr() {
8508
8526
  return no;
8509
8527
  }
8510
8528
  function Hs(e, t, n) {
8511
- if (dt(e))
8529
+ if (ft(e))
8512
8530
  return [];
8513
8531
  const r = gn(e, t)[0];
8514
8532
  return S0(Ji(e, r, n));
8515
8533
  }
8516
8534
  function Xi(e, t) {
8517
- if (dt(e)) return no;
8535
+ if (ft(e)) return no;
8518
8536
  const { k: n, l: r, r: o } = e;
8519
8537
  if (t === n) {
8520
- if (dt(r))
8538
+ if (ft(r))
8521
8539
  return o;
8522
- if (dt(o))
8540
+ if (ft(o))
8523
8541
  return r;
8524
8542
  {
8525
8543
  const [s, i] = kf(r);
@@ -8528,10 +8546,10 @@ function Xi(e, t) {
8528
8546
  } else return t < n ? Vo(_t(e, { l: Xi(r, t) })) : Vo(_t(e, { r: Xi(o, t) }));
8529
8547
  }
8530
8548
  function tr(e) {
8531
- return dt(e) ? [] : [...tr(e.l), { k: e.k, v: e.v }, ...tr(e.r)];
8549
+ return ft(e) ? [] : [...tr(e.l), { k: e.k, v: e.v }, ...tr(e.r)];
8532
8550
  }
8533
8551
  function Ji(e, t, n) {
8534
- if (dt(e))
8552
+ if (ft(e))
8535
8553
  return [];
8536
8554
  const { k: r, l: o, r: s, v: i } = e;
8537
8555
  let a = [];
@@ -8544,7 +8562,7 @@ function Vo(e) {
8544
8562
  if (n > r.lvl + 1) {
8545
8563
  if (Ci(t))
8546
8564
  return Ef(_t(e, { lvl: n - 1 }));
8547
- if (!dt(t) && !dt(t.r))
8565
+ if (!ft(t) && !ft(t.r))
8548
8566
  return _t(t.r, {
8549
8567
  l: _t(t, { r: t.r.l }),
8550
8568
  lvl: n,
@@ -8557,7 +8575,7 @@ function Vo(e) {
8557
8575
  } else {
8558
8576
  if (Ci(e))
8559
8577
  return Zi(_t(e, { lvl: n - 1 }));
8560
- if (!dt(r) && !dt(r.l)) {
8578
+ if (!ft(r) && !ft(r.l)) {
8561
8579
  const o = r.l, s = Ci(o) ? r.lvl - 1 : r.lvl;
8562
8580
  return _t(o, {
8563
8581
  l: _t(e, {
@@ -8581,13 +8599,13 @@ function _t(e, t) {
8581
8599
  );
8582
8600
  }
8583
8601
  function Tf(e) {
8584
- return dt(e.r) ? e.l : Vo(_t(e, { r: Tf(e.r) }));
8602
+ return ft(e.r) ? e.l : Vo(_t(e, { r: Tf(e.r) }));
8585
8603
  }
8586
8604
  function Ci(e) {
8587
- return dt(e) || e.lvl > e.r.lvl;
8605
+ return ft(e) || e.lvl > e.r.lvl;
8588
8606
  }
8589
8607
  function kf(e) {
8590
- return dt(e.r) ? [e.k, e.v] : kf(e.r);
8608
+ return ft(e.r) ? [e.k, e.v] : kf(e.r);
8591
8609
  }
8592
8610
  function Rf(e, t, n, r = no, o = no) {
8593
8611
  return { k: e, l: r, lvl: n, r: o, v: t };
@@ -8597,11 +8615,11 @@ function xc(e) {
8597
8615
  }
8598
8616
  function Ef(e) {
8599
8617
  const { l: t } = e;
8600
- return !dt(t) && t.lvl === e.lvl ? _t(t, { r: _t(e, { l: t.r }) }) : e;
8618
+ return !ft(t) && t.lvl === e.lvl ? _t(t, { r: _t(e, { l: t.r }) }) : e;
8601
8619
  }
8602
8620
  function Zi(e) {
8603
8621
  const { lvl: t, r: n } = e;
8604
- return !dt(n) && !dt(n.r) && n.lvl === t && n.r.lvl === t ? _t(n, { l: _t(e, { r: n.l }), lvl: t + 1 }) : e;
8622
+ return !ft(n) && !ft(n.r) && n.lvl === t && n.r.lvl === t ? _t(n, { l: _t(e, { r: n.l }), lvl: t + 1 }) : e;
8605
8623
  }
8606
8624
  function S0(e) {
8607
8625
  return Cf(e, ({ k: t, v: n }) => ({ index: t, value: n }));
@@ -8646,7 +8664,7 @@ function Un(e, t) {
8646
8664
  return Math.round(e.getBoundingClientRect()[t]);
8647
8665
  }
8648
8666
  function Us(e) {
8649
- return !dt(e.groupOffsetTree);
8667
+ return !ft(e.groupOffsetTree);
8650
8668
  }
8651
8669
  function Ha({ index: e }, t) {
8652
8670
  return t === e ? 0 : t < e ? -1 : 1;
@@ -8663,10 +8681,10 @@ function T0() {
8663
8681
  };
8664
8682
  }
8665
8683
  function k0(e, t) {
8666
- let n = dt(e) ? 0 : 1 / 0;
8684
+ let n = ft(e) ? 0 : 1 / 0;
8667
8685
  for (const r of t) {
8668
8686
  const { endIndex: o, size: s, startIndex: i } = r;
8669
- if (n = Math.min(n, i), dt(e)) {
8687
+ if (n = Math.min(n, i), ft(e)) {
8670
8688
  e = Zt(e, 0, s);
8671
8689
  continue;
8672
8690
  }
@@ -8716,7 +8734,7 @@ function N0(e, [t, n, r, o]) {
8716
8734
  t.length > 0 && r("received item sizes", t, Xt.DEBUG);
8717
8735
  const s = e.sizeTree;
8718
8736
  let i = s, a = 0;
8719
- if (n.length > 0 && dt(s) && t.length === 2) {
8737
+ if (n.length > 0 && ft(s) && t.length === 2) {
8720
8738
  const p = t[0].size, h = t[1].size;
8721
8739
  i = n.reduce((m, x) => Zt(Zt(m, x, p), x + 1, h), i);
8722
8740
  } else
@@ -8781,13 +8799,13 @@ const P0 = {
8781
8799
  offsetWidth: "width"
8782
8800
  }, En = et(
8783
8801
  ([{ log: e }, { recalcInProgress: t }]) => {
8784
- const n = Ue(), r = Ue(), o = Ht(r, 0), s = Ue(), i = Ue(), a = Y(0), l = Y([]), c = Y(void 0), d = Y(void 0), f = Y((C, S) => Un(C, P0[S])), p = Y(void 0), h = Y(0), m = T0(), x = Ht(
8785
- U(n, De(l, e, h), Cn(N0, m), gt()),
8802
+ const n = We(), r = We(), o = Ht(r, 0), s = We(), i = We(), a = Y(0), l = Y([]), c = Y(void 0), d = Y(void 0), f = Y((C, S) => Un(C, P0[S])), p = Y(void 0), h = Y(0), m = T0(), x = Ht(
8803
+ U(n, Le(l, e, h), Cn(N0, m), xt()),
8786
8804
  m
8787
8805
  ), y = Ht(
8788
8806
  U(
8789
8807
  l,
8790
- gt(),
8808
+ xt(),
8791
8809
  Cn((C, S) => ({ current: S, prev: C.current }), {
8792
8810
  current: [],
8793
8811
  prev: []
@@ -8800,7 +8818,7 @@ const P0 = {
8800
8818
  U(
8801
8819
  l,
8802
8820
  Re((C) => C.length > 0),
8803
- De(x, h),
8821
+ Le(x, h),
8804
8822
  ae(([C, S, k]) => {
8805
8823
  const N = C.reduce((E, I, P) => Zt(E, I, so(I, S.offsetTree, k) || P), Sr());
8806
8824
  return {
@@ -8814,7 +8832,7 @@ const P0 = {
8814
8832
  ), me(
8815
8833
  U(
8816
8834
  r,
8817
- De(x),
8835
+ Le(x),
8818
8836
  Re(([C, { lastIndex: S }]) => C < S),
8819
8837
  ae(([C, { lastIndex: S, lastSize: k }]) => [
8820
8838
  {
@@ -8836,7 +8854,7 @@ const P0 = {
8836
8854
  me(
8837
8855
  U(
8838
8856
  d,
8839
- Re((C) => C !== void 0 && dt(Tt(x).sizeTree)),
8857
+ Re((C) => C !== void 0 && ft(Tt(x).sizeTree)),
8840
8858
  ae((C) => [{ endIndex: 0, size: C, startIndex: 0 }])
8841
8859
  ),
8842
8860
  n
@@ -8844,7 +8862,7 @@ const P0 = {
8844
8862
  const w = en(
8845
8863
  U(
8846
8864
  n,
8847
- De(x),
8865
+ Le(x),
8848
8866
  Cn(
8849
8867
  ({ sizes: C }, [S, k]) => ({
8850
8868
  changed: k !== C,
@@ -8873,7 +8891,7 @@ const P0 = {
8873
8891
  k.length > 0 && (C -= yc(-C, k)), Me(i, C);
8874
8892
  }
8875
8893
  }
8876
- ), ot(U(a, De(e)), ([C, S]) => {
8894
+ ), ot(U(a, Le(e)), ([C, S]) => {
8877
8895
  C < 0 && S(
8878
8896
  "`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",
8879
8897
  { firstItemIndex: a },
@@ -8884,7 +8902,7 @@ const P0 = {
8884
8902
  me(
8885
8903
  U(
8886
8904
  s,
8887
- De(x),
8905
+ Le(x),
8888
8906
  ae(([C, S]) => {
8889
8907
  const k = S.groupIndices.length > 0, N = [], E = S.lastSize;
8890
8908
  if (k) {
@@ -8945,7 +8963,7 @@ const P0 = {
8945
8963
  const T = en(
8946
8964
  U(
8947
8965
  i,
8948
- De(x, h),
8966
+ Le(x, h),
8949
8967
  ae(([C, { offsetTree: S }, k]) => {
8950
8968
  const N = -C;
8951
8969
  return so(N, S, k);
@@ -8955,10 +8973,10 @@ const P0 = {
8955
8973
  return me(
8956
8974
  U(
8957
8975
  i,
8958
- De(x, h),
8976
+ Le(x, h),
8959
8977
  ae(([C, S, k]) => {
8960
8978
  if (S.groupIndices.length > 0) {
8961
- if (dt(S.sizeTree))
8979
+ if (ft(S.sizeTree))
8962
8980
  return S;
8963
8981
  let N = Sr();
8964
8982
  const E = Tt(y);
@@ -9012,7 +9030,7 @@ const P0 = {
9012
9030
  unshiftWith: s
9013
9031
  };
9014
9032
  },
9015
- xt(qn, Ba),
9033
+ yt(qn, Ba),
9016
9034
  { singleton: !0 }
9017
9035
  );
9018
9036
  function O0(e) {
@@ -9026,7 +9044,7 @@ function O0(e) {
9026
9044
  }
9027
9045
  const _f = et(
9028
9046
  ([{ groupIndices: e, sizes: t, totalCount: n }, { headerHeight: r, scrollTop: o }]) => {
9029
- const s = Ue(), i = Ue(), a = en(U(s, ae(O0)));
9047
+ const s = We(), i = We(), a = en(U(s, ae(O0)));
9030
9048
  return me(
9031
9049
  U(
9032
9050
  a,
@@ -9041,30 +9059,30 @@ const _f = et(
9041
9059
  e
9042
9060
  ), me(
9043
9061
  U(
9044
- It(o, t, r),
9062
+ Nt(o, t, r),
9045
9063
  Re(([l, c]) => Us(c)),
9046
9064
  ae(([l, c, d]) => gn(c.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
9047
- gt(),
9065
+ xt(),
9048
9066
  ae((l) => [l])
9049
9067
  ),
9050
9068
  i
9051
9069
  ), { groupCounts: s, topItemsIndexes: i };
9052
9070
  },
9053
- xt(En, Wt)
9071
+ yt(En, Wt)
9054
9072
  ), Gn = et(
9055
9073
  ([{ log: e }]) => {
9056
9074
  const t = Y(!1), n = en(
9057
9075
  U(
9058
9076
  t,
9059
9077
  Re((r) => r),
9060
- gt()
9078
+ xt()
9061
9079
  )
9062
9080
  );
9063
9081
  return ot(t, (r) => {
9064
9082
  r && Tt(e)("props updated", {}, Xt.DEBUG);
9065
9083
  }), { didMount: n, propsReady: t };
9066
9084
  },
9067
- xt(qn),
9085
+ yt(qn),
9068
9086
  { singleton: !0 }
9069
9087
  ), M0 = typeof document < "u" && "scrollBehavior" in document.documentElement.style;
9070
9088
  function Pf(e) {
@@ -9086,7 +9104,7 @@ const vo = et(
9086
9104
  },
9087
9105
  { log: p }
9088
9106
  ]) => {
9089
- const h = Ue(), m = Ue(), x = Y(0);
9107
+ const h = We(), m = We(), x = Y(0);
9090
9108
  let y = null, g = null, w = null;
9091
9109
  function b() {
9092
9110
  y && (y(), y = null), w && (w(), w = null), g && (clearTimeout(g), g = null), Me(l, !1);
@@ -9094,8 +9112,8 @@ const vo = et(
9094
9112
  return me(
9095
9113
  U(
9096
9114
  h,
9097
- De(n, f, r, x, a, i, p),
9098
- De(e, s, o),
9115
+ Le(n, f, r, x, a, i, p),
9116
+ Le(e, s, o),
9099
9117
  ae(
9100
9118
  ([
9101
9119
  [T, C, S, k, N, E, I, P],
@@ -9131,7 +9149,7 @@ const vo = et(
9131
9149
  topListHeight: x
9132
9150
  };
9133
9151
  },
9134
- xt(En, Wt, qn),
9152
+ yt(En, Wt, qn),
9135
9153
  { singleton: !0 }
9136
9154
  );
9137
9155
  function D0(e) {
@@ -9159,7 +9177,7 @@ const wo = et(
9159
9177
  return me(
9160
9178
  U(
9161
9179
  i,
9162
- De(l),
9180
+ Le(l),
9163
9181
  Re(([d, f]) => !!f),
9164
9182
  wn(!1)
9165
9183
  ),
@@ -9167,17 +9185,17 @@ const wo = et(
9167
9185
  ), me(
9168
9186
  U(
9169
9187
  i,
9170
- De(l),
9188
+ Le(l),
9171
9189
  Re(([d, f]) => !!f),
9172
9190
  wn(!1)
9173
9191
  ),
9174
9192
  c
9175
9193
  ), ot(
9176
9194
  U(
9177
- It(t, i),
9178
- De(a, n, e, c),
9179
- Re(([[, d], f, { sizeTree: p }, h, m]) => d && (!dt(p) || Fa(h)) && !f && !m),
9180
- De(l)
9195
+ Nt(t, i),
9196
+ Le(a, n, e, c),
9197
+ Re(([[, d], f, { sizeTree: p }, h, m]) => d && (!ft(p) || Fa(h)) && !f && !m),
9198
+ Le(l)
9181
9199
  ),
9182
9200
  ([, d]) => {
9183
9201
  pn(o, () => {
@@ -9194,7 +9212,7 @@ const wo = et(
9194
9212
  scrolledToInitialItem: a
9195
9213
  };
9196
9214
  },
9197
- xt(En, Wt, vo, Gn),
9215
+ yt(En, Wt, vo, Gn),
9198
9216
  { singleton: !0 }
9199
9217
  );
9200
9218
  function Of(e, t) {
@@ -9210,27 +9228,27 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9210
9228
  viewportHeight: 0
9211
9229
  }
9212
9230
  }, $0 = 0, bo = et(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
9213
- const i = Y(!1), a = Y(!0), l = Ue(), c = Ue(), d = Y(4), f = Y($0), p = Ht(
9231
+ const i = Y(!1), a = Y(!0), l = We(), c = We(), d = Y(4), f = Y($0), p = Ht(
9214
9232
  U(
9215
9233
  Yi(U(Ce(o), ar(1), wn(!0)), U(Ce(o), ar(1), wn(!1), mc(100))),
9216
- gt()
9234
+ xt()
9217
9235
  ),
9218
9236
  !1
9219
9237
  ), h = Ht(
9220
- U(Yi(U(n, wn(!0)), U(n, wn(!1), mc(200))), gt()),
9238
+ U(Yi(U(n, wn(!0)), U(n, wn(!1), mc(200))), xt()),
9221
9239
  !1
9222
9240
  );
9223
9241
  me(
9224
9242
  U(
9225
- It(Ce(o), Ce(f)),
9243
+ Nt(Ce(o), Ce(f)),
9226
9244
  ae(([w, b]) => w <= b),
9227
- gt()
9245
+ xt()
9228
9246
  ),
9229
9247
  a
9230
9248
  ), me(U(a, An(50)), c);
9231
9249
  const m = en(
9232
9250
  U(
9233
- It(r, Ce(s), Ce(t), Ce(e), Ce(d)),
9251
+ Nt(r, Ce(s), Ce(t), Ce(e), Ce(d)),
9234
9252
  Cn((w, [{ scrollHeight: b, scrollTop: T }, C, S, k, N]) => {
9235
9253
  const E = T + C - b > -N, I = {
9236
9254
  scrollHeight: b,
@@ -9253,7 +9271,7 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9253
9271
  state: I
9254
9272
  };
9255
9273
  }, F0),
9256
- gt((w, b) => w && w.atBottom === b.atBottom)
9274
+ xt((w, b) => w && w.atBottom === b.atBottom)
9257
9275
  )
9258
9276
  ), x = Ht(
9259
9277
  U(
@@ -9301,7 +9319,7 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9301
9319
  U(
9302
9320
  r,
9303
9321
  ae(({ scrollTop: w }) => w),
9304
- gt(),
9322
+ xt(),
9305
9323
  Cn(
9306
9324
  (w, b) => Tt(h) ? { direction: w.direction, prevScrollTop: b } : { direction: b < w.prevScrollTop ? io : Vr, prevScrollTop: b },
9307
9325
  { direction: Vr, prevScrollTop: 0 }
@@ -9322,7 +9340,7 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9322
9340
  U(
9323
9341
  o,
9324
9342
  An(100),
9325
- De(p),
9343
+ Le(p),
9326
9344
  Re(([w, b]) => !!b),
9327
9345
  Cn(([w, b], [T]) => [b, T], [0, 0]),
9328
9346
  ae(([w, b]) => b - w)
@@ -9341,7 +9359,7 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9341
9359
  scrollDirection: y,
9342
9360
  scrollVelocity: g
9343
9361
  };
9344
- }, xt(Wt)), ss = "top", is = "bottom", vc = "none";
9362
+ }, yt(Wt)), ss = "top", is = "bottom", vc = "none";
9345
9363
  function wc(e, t, n) {
9346
9364
  return typeof e == "number" ? n === io && t === ss || n === Vr && t === is ? e : 0 : n === io ? t === ss ? e.main : e.reverse : t === is ? e.main : e.reverse;
9347
9365
  }
@@ -9351,9 +9369,9 @@ function bc(e, t) {
9351
9369
  }
9352
9370
  const Va = et(
9353
9371
  ([{ deviation: e, fixedHeaderHeight: t, headerHeight: n, scrollTop: r, viewportHeight: o }]) => {
9354
- const s = Ue(), i = Y(0), a = Y(0), l = Y(0), c = Ht(
9372
+ const s = We(), i = Y(0), a = Y(0), l = Y(0), c = Ht(
9355
9373
  U(
9356
- It(
9374
+ Nt(
9357
9375
  Ce(r),
9358
9376
  Ce(o),
9359
9377
  Ce(n),
@@ -9386,7 +9404,7 @@ const Va = et(
9386
9404
  }
9387
9405
  ),
9388
9406
  Re((d) => d != null),
9389
- gt(oo)
9407
+ xt(oo)
9390
9408
  ),
9391
9409
  [0, 0]
9392
9410
  );
@@ -9400,7 +9418,7 @@ const Va = et(
9400
9418
  visibleRange: c
9401
9419
  };
9402
9420
  },
9403
- xt(Wt),
9421
+ yt(Wt),
9404
9422
  { singleton: !0 }
9405
9423
  );
9406
9424
  function z0(e, t, n) {
@@ -9498,11 +9516,11 @@ const hr = et(
9498
9516
  { didMount: h },
9499
9517
  { recalcInProgress: m }
9500
9518
  ]) => {
9501
- const x = Y([]), y = Y(0), g = Ue();
9519
+ const x = Y([]), y = Y(0), g = We();
9502
9520
  me(s.topItemsIndexes, x);
9503
9521
  const w = Ht(
9504
9522
  U(
9505
- It(
9523
+ Nt(
9506
9524
  h,
9507
9525
  m,
9508
9526
  Ce(l, oo),
@@ -9538,7 +9556,7 @@ const hr = et(
9538
9556
  return { ...Ti, totalCount: N };
9539
9557
  if (S === 0 && k === 0)
9540
9558
  return O === 0 ? { ...Ti, totalCount: N } : Mf(O, I, E, F, j, $ || []);
9541
- if (dt(D))
9559
+ if (ft(D))
9542
9560
  return O > 0 ? null : Ko(
9543
9561
  z0(Wa(I, N), A, $),
9544
9562
  [],
@@ -9549,10 +9567,10 @@ const hr = et(
9549
9567
  );
9550
9568
  const J = [];
9551
9569
  if (L.length > 0) {
9552
- const K = L[0], ee = L[L.length - 1];
9570
+ const V = L[0], ee = L[L.length - 1];
9553
9571
  let q = 0;
9554
- for (const M of Hs(D, K, ee)) {
9555
- const H = M.value, te = Math.max(M.start, K), oe = Math.min(M.end, ee);
9572
+ for (const M of Hs(D, V, ee)) {
9573
+ const H = M.value, te = Math.max(M.start, V), oe = Math.min(M.end, ee);
9556
9574
  for (let ne = te; ne <= oe; ne++)
9557
9575
  J.push({ data: $ == null ? void 0 : $[ne], index: ne, offset: q, size: H }), q += H;
9558
9576
  }
@@ -9562,7 +9580,7 @@ const hr = et(
9562
9580
  const X = L.length > 0 ? L[L.length - 1] + 1 : 0, pe = I0(B, S, k, X);
9563
9581
  if (pe.length === 0)
9564
9582
  return null;
9565
- const Ie = N - 1, Ae = Bs([], (K) => {
9583
+ const Ie = N - 1, Ae = Bs([], (V) => {
9566
9584
  for (const ee of pe) {
9567
9585
  const q = ee.value;
9568
9586
  let M = q.offset, H = ee.start;
@@ -9575,7 +9593,7 @@ const hr = et(
9575
9593
  H < X && (M += (X - H) * te, H = X);
9576
9594
  const oe = Math.min(ee.end, Ie);
9577
9595
  for (let ne = H; ne <= oe && !(M >= k); ne++)
9578
- K.push({ data: $ == null ? void 0 : $[ne], index: ne, offset: M, size: te }), M += te + j;
9596
+ V.push({ data: $ == null ? void 0 : $[ne], index: ne, offset: M, size: te }), M += te + j;
9579
9597
  }
9580
9598
  });
9581
9599
  return Ko(Ae, J, N, j, A, F);
@@ -9583,7 +9601,7 @@ const hr = et(
9583
9601
  ),
9584
9602
  //@ts-expect-error filter needs to be fixed
9585
9603
  Re((S) => S !== null),
9586
- gt()
9604
+ xt()
9587
9605
  ),
9588
9606
  Ti
9589
9607
  );
@@ -9617,10 +9635,10 @@ const hr = et(
9617
9635
  U(
9618
9636
  w,
9619
9637
  Re(({ items: S }) => S.length > 0),
9620
- De(o, e),
9638
+ Le(o, e),
9621
9639
  Re(([{ items: S }, k]) => S[S.length - 1].originalIndex === k - 1),
9622
9640
  ae(([, S, k]) => [S - 1, k]),
9623
- gt(oo),
9641
+ xt(oo),
9624
9642
  ae(([S]) => S)
9625
9643
  )
9626
9644
  ), T = en(
@@ -9629,7 +9647,7 @@ const hr = et(
9629
9647
  An(200),
9630
9648
  Re(({ items: S, topItems: k }) => S.length > 0 && S[0].originalIndex === k.length),
9631
9649
  ae(({ items: S }) => S[0].index),
9632
- gt()
9650
+ xt()
9633
9651
  )
9634
9652
  ), C = en(
9635
9653
  U(
@@ -9646,12 +9664,12 @@ const hr = et(
9646
9664
  startIndex: S[k].index
9647
9665
  };
9648
9666
  }),
9649
- gt(If)
9667
+ xt(If)
9650
9668
  )
9651
9669
  );
9652
9670
  return { endReached: b, initialItemCount: y, itemsRendered: g, listState: w, rangeChanged: C, startReached: T, topItemsIndexes: x, ...p };
9653
9671
  },
9654
- xt(
9672
+ yt(
9655
9673
  En,
9656
9674
  _f,
9657
9675
  Va,
@@ -9664,32 +9682,32 @@ const hr = et(
9664
9682
  { singleton: !0 }
9665
9683
  ), Df = et(
9666
9684
  ([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: n, headerHeight: r }, { listState: o }]) => {
9667
- const s = Ue(), i = Ht(
9685
+ const s = We(), i = Ht(
9668
9686
  U(
9669
- It(n, e, r, t, o),
9687
+ Nt(n, e, r, t, o),
9670
9688
  ae(([a, l, c, d, f]) => a + l + c + d + f.offsetBottom + f.bottom)
9671
9689
  ),
9672
9690
  0
9673
9691
  );
9674
9692
  return me(Ce(i), s), { totalListHeight: i, totalListHeightChanged: s };
9675
9693
  },
9676
- xt(Wt, hr),
9694
+ yt(Wt, hr),
9677
9695
  { singleton: !0 }
9678
9696
  ), B0 = et(
9679
9697
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
9680
9698
  const n = Y(!1), r = Ht(
9681
9699
  U(
9682
- It(n, e, t),
9700
+ Nt(n, e, t),
9683
9701
  Re(([o]) => o),
9684
9702
  ae(([, o, s]) => Math.max(0, o - s)),
9685
9703
  An(0),
9686
- gt()
9704
+ xt()
9687
9705
  ),
9688
9706
  0
9689
9707
  );
9690
9708
  return { alignToBottom: n, paddingTopAddition: r };
9691
9709
  },
9692
- xt(Wt, Df),
9710
+ yt(Wt, Df),
9693
9711
  { singleton: !0 }
9694
9712
  ), Lf = et(() => ({
9695
9713
  context: Y(null)
@@ -9705,12 +9723,12 @@ const hr = et(
9705
9723
  { fixedFooterHeight: r, fixedHeaderHeight: o, headerHeight: s, scrollingInProgress: i, scrollTop: a, viewportHeight: l },
9706
9724
  { scrollToIndex: c }
9707
9725
  ]) => {
9708
- const d = Ue();
9726
+ const d = We();
9709
9727
  return me(
9710
9728
  U(
9711
9729
  d,
9712
- De(t, l, n, s, o, r, a),
9713
- De(e),
9730
+ Le(t, l, n, s, o, r, a),
9731
+ Le(e),
9714
9732
  ae(([[f, p, h, m, x, y, g, w], b]) => {
9715
9733
  const { align: T, behavior: C, calculateViewLocation: S = H0, done: k, ...N } = f, E = jf(f, p, m - 1), I = so(E, p.offsetTree, b) + x + y, P = I + gn(p.sizeTree, E)[1], L = w + y, F = w + h - g, j = S({
9716
9734
  itemBottom: P,
@@ -9737,7 +9755,7 @@ const hr = et(
9737
9755
  scrollIntoView: d
9738
9756
  };
9739
9757
  },
9740
- xt(En, Wt, vo, hr, qn),
9758
+ yt(En, Wt, vo, hr, qn),
9741
9759
  { singleton: !0 }
9742
9760
  );
9743
9761
  function Cc(e) {
@@ -9755,7 +9773,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9755
9773
  { context: p },
9756
9774
  { scrollIntoView: h }
9757
9775
  ]) => {
9758
- const m = Y(!1), x = Ue();
9776
+ const m = Y(!1), x = We();
9759
9777
  let y = null;
9760
9778
  function g(C) {
9761
9779
  Me(i, {
@@ -9766,8 +9784,8 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9766
9784
  }
9767
9785
  ot(
9768
9786
  U(
9769
- It(U(Ce(t), ar(1)), l),
9770
- De(Ce(m), s, a, f),
9787
+ Nt(U(Ce(t), ar(1)), l),
9788
+ Le(Ce(m), s, a, f),
9771
9789
  ae(([[C, S], k, N, E, I]) => {
9772
9790
  let P = S && E, L = "auto";
9773
9791
  return P && (L = U0(k, N || I), P = P && !!L), { followOutputBehavior: L, shouldFollow: P, totalCount: C };
@@ -9790,24 +9808,24 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9790
9808
  }
9791
9809
  ot(
9792
9810
  U(
9793
- It(Ce(m), t, c),
9811
+ Nt(Ce(m), t, c),
9794
9812
  Re(([C, , S]) => C && S),
9795
9813
  Cn(
9796
9814
  ({ value: C }, [, S]) => ({ refreshed: C === S, value: S }),
9797
9815
  { refreshed: !1, value: 0 }
9798
9816
  ),
9799
9817
  Re(({ refreshed: C }) => C),
9800
- De(m, t)
9818
+ Le(m, t)
9801
9819
  ),
9802
9820
  ([, C]) => {
9803
9821
  Tt(a) && w(C !== !1);
9804
9822
  }
9805
9823
  ), ot(x, () => {
9806
9824
  w(Tt(m) !== !1);
9807
- }), ot(It(Ce(m), o), ([C, S]) => {
9825
+ }), ot(Nt(Ce(m), o), ([C, S]) => {
9808
9826
  C && !S.atBottom && S.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && g("auto");
9809
9827
  });
9810
- const b = Y(null), T = Ue();
9828
+ const b = Y(null), T = We();
9811
9829
  return me(
9812
9830
  Yi(
9813
9831
  U(
@@ -9822,8 +9840,8 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9822
9840
  T
9823
9841
  ), ot(
9824
9842
  U(
9825
- It(U(T, ar(1)), l),
9826
- De(Ce(b), a, f, p),
9843
+ Nt(U(T, ar(1)), l),
9844
+ Le(Ce(b), a, f, p),
9827
9845
  ae(([[C, S], k, N, E, I]) => S && N && (k == null ? void 0 : k({ context: I, totalCount: C, scrollingInProgress: E }))),
9828
9846
  Re((C) => !!C),
9829
9847
  An(0)
@@ -9837,7 +9855,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9837
9855
  }
9838
9856
  ), { autoscrollToBottom: x, followOutput: m, scrollIntoViewOnChange: b };
9839
9857
  },
9840
- xt(
9858
+ yt(
9841
9859
  En,
9842
9860
  bo,
9843
9861
  vo,
@@ -9852,14 +9870,14 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9852
9870
  ([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (me(
9853
9871
  U(
9854
9872
  a,
9855
- De(s),
9873
+ Le(s),
9856
9874
  Re(([, l]) => l !== 0),
9857
- De(o, r, t, n, e),
9875
+ Le(o, r, t, n, e),
9858
9876
  ae(([[, l], c, d, f, p, h = []]) => Mf(l, c, d, f, p, h))
9859
9877
  ),
9860
9878
  i
9861
9879
  ), {}),
9862
- xt(En, wo, hr, Gn),
9880
+ yt(En, wo, hr, Gn),
9863
9881
  { singleton: !0 }
9864
9882
  ), K0 = et(
9865
9883
  ([{ didMount: e }, { scrollTo: t }, { listState: n }]) => {
@@ -9867,7 +9885,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9867
9885
  return ot(
9868
9886
  U(
9869
9887
  e,
9870
- De(r),
9888
+ Le(r),
9871
9889
  Re(([, o]) => o !== 0),
9872
9890
  ae(([, o]) => ({ top: o }))
9873
9891
  ),
@@ -9889,15 +9907,15 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9889
9907
  initialScrollTop: r
9890
9908
  };
9891
9909
  },
9892
- xt(Gn, Wt, hr),
9910
+ yt(Gn, Wt, hr),
9893
9911
  { singleton: !0 }
9894
9912
  ), $f = et(
9895
9913
  ([{ scrollVelocity: e }]) => {
9896
- const t = Y(!1), n = Ue(), r = Y(!1);
9914
+ const t = Y(!1), n = We(), r = Y(!1);
9897
9915
  return me(
9898
9916
  U(
9899
9917
  e,
9900
- De(r, t, n),
9918
+ Le(r, t, n),
9901
9919
  Re(([o, s]) => !!s),
9902
9920
  ae(([o, s, i, a]) => {
9903
9921
  const { enter: l, exit: c } = s;
@@ -9908,23 +9926,23 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9908
9926
  return !0;
9909
9927
  return i;
9910
9928
  }),
9911
- gt()
9929
+ xt()
9912
9930
  ),
9913
9931
  t
9914
9932
  ), ot(
9915
- U(It(t, e, n), De(r)),
9933
+ U(Nt(t, e, n), Le(r)),
9916
9934
  ([[o, s, i], a]) => {
9917
9935
  o && a && a.change && a.change(s, i);
9918
9936
  }
9919
9937
  ), { isSeeking: t, scrollSeekConfiguration: r, scrollSeekRangeChanged: n, scrollVelocity: e };
9920
9938
  },
9921
- xt(bo),
9939
+ yt(bo),
9922
9940
  { singleton: !0 }
9923
9941
  ), Ka = et(([{ scrollContainerState: e, scrollTo: t }]) => {
9924
- const n = Ue(), r = Ue(), o = Ue(), s = Y(!1), i = Y(void 0);
9942
+ const n = We(), r = We(), o = We(), s = Y(!1), i = Y(void 0);
9925
9943
  return me(
9926
9944
  U(
9927
- It(n, r),
9945
+ Nt(n, r),
9928
9946
  ae(([{ scrollHeight: a, scrollTop: l, viewportHeight: c }, { offsetTop: d }]) => ({
9929
9947
  scrollHeight: a,
9930
9948
  scrollTop: Math.max(0, l - d),
@@ -9935,7 +9953,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9935
9953
  ), me(
9936
9954
  U(
9937
9955
  t,
9938
- De(r),
9956
+ Le(r),
9939
9957
  ae(([a, { offsetTop: l }]) => ({
9940
9958
  ...a,
9941
9959
  top: a.top + l
@@ -9952,7 +9970,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9952
9970
  windowScrollTo: o,
9953
9971
  windowViewportRect: r
9954
9972
  };
9955
- }, xt(Wt)), q0 = et(
9973
+ }, yt(Wt)), q0 = et(
9956
9974
  ([
9957
9975
  { sizeRanges: e, sizes: t },
9958
9976
  { headerHeight: n, scrollTop: r },
@@ -9960,11 +9978,11 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9960
9978
  { didMount: s },
9961
9979
  { useWindowScroll: i, windowScrollContainerState: a, windowViewportRect: l }
9962
9980
  ]) => {
9963
- const c = Ue(), d = Y(void 0), f = Y(null), p = Y(null);
9981
+ const c = We(), d = Y(void 0), f = Y(null), p = Y(null);
9964
9982
  return me(a, f), me(l, p), ot(
9965
9983
  U(
9966
9984
  c,
9967
- De(t, r, i, f, p, n)
9985
+ Le(t, r, i, f, p, n)
9968
9986
  ),
9969
9987
  ([h, m, x, y, g, w, b]) => {
9970
9988
  const T = A0(m.sizeTree);
@@ -9973,9 +9991,9 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9973
9991
  ), me(U(d, Re(Fa), ae(G0)), o), me(
9974
9992
  U(
9975
9993
  s,
9976
- De(d),
9994
+ Le(d),
9977
9995
  Re(([, h]) => h !== void 0),
9978
- gt(),
9996
+ xt(),
9979
9997
  ae(([, h]) => h.ranges)
9980
9998
  ),
9981
9999
  e
@@ -9984,7 +10002,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9984
10002
  restoreStateFrom: d
9985
10003
  };
9986
10004
  },
9987
- xt(En, Wt, wo, Gn, Ka)
10005
+ yt(En, Wt, wo, Gn, Ka)
9988
10006
  );
9989
10007
  function G0(e) {
9990
10008
  return { align: "start", index: 0, offset: e.scrollTop };
@@ -9999,7 +10017,7 @@ const Y0 = et(([{ topItemsIndexes: e }]) => {
9999
10017
  ),
10000
10018
  e
10001
10019
  ), { topItemCount: t };
10002
- }, xt(hr));
10020
+ }, yt(hr));
10003
10021
  function zf(e) {
10004
10022
  let t = !1, n;
10005
10023
  return () => (t || (t = !0, n = e()), n);
@@ -10016,7 +10034,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10016
10034
  const x = en(
10017
10035
  U(
10018
10036
  l,
10019
- De(i),
10037
+ Le(i),
10020
10038
  Cn(
10021
10039
  ([, g, w, b], [{ bottom: T, items: C, offsetBottom: S, totalCount: k }, N]) => {
10022
10040
  const E = T + S;
@@ -10026,7 +10044,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10026
10044
  [0, [], 0, 0]
10027
10045
  ),
10028
10046
  Re(([g]) => g !== 0),
10029
- De(r, a, n, o, h, m),
10047
+ Le(r, a, n, o, h, m),
10030
10048
  Re(([, g, w, b, , , T]) => !T && !b && g !== 0 && w === io),
10031
10049
  ae(([[g], , , , , w]) => (w("Upward scrolling compensation", { amount: g }, Xt.DEBUG), g))
10032
10050
  )
@@ -10034,11 +10052,11 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10034
10052
  function y(g) {
10035
10053
  g > 0 ? (Me(t, { behavior: "auto", top: -g }), Me(e, 0)) : (Me(e, 0), Me(t, { behavior: "auto", top: -g }));
10036
10054
  }
10037
- return ot(U(x, De(e, s)), ([g, w, b]) => {
10055
+ return ot(U(x, Le(e, s)), ([g, w, b]) => {
10038
10056
  b && X0() ? Me(e, w - g) : y(-g);
10039
10057
  }), ot(
10040
10058
  U(
10041
- It(Ht(s, !1), e, m),
10059
+ Nt(Ht(s, !1), e, m),
10042
10060
  Re(([g, w, b]) => !g && !b && w !== 0),
10043
10061
  ae(([g, w]) => w),
10044
10062
  An(1)
@@ -10053,7 +10071,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10053
10071
  ), ot(
10054
10072
  U(
10055
10073
  c,
10056
- De(p, d),
10074
+ Le(p, d),
10057
10075
  ae(([g, { groupIndices: w, lastSize: b, sizeTree: T }, C]) => {
10058
10076
  function S(k) {
10059
10077
  return k * (b + C);
@@ -10082,7 +10100,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10082
10100
  }
10083
10101
  ), { deviation: e };
10084
10102
  },
10085
- xt(Wt, bo, hr, En, qn, Ba)
10103
+ yt(Wt, bo, hr, En, qn, Ba)
10086
10104
  ), Z0 = et(
10087
10105
  ([
10088
10106
  e,
@@ -10109,7 +10127,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10109
10127
  ...c,
10110
10128
  ...d
10111
10129
  }),
10112
- xt(
10130
+ yt(
10113
10131
  Va,
10114
10132
  V0,
10115
10133
  Gn,
@@ -10185,7 +10203,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10185
10203
  sizes: l,
10186
10204
  ...y
10187
10205
  }),
10188
- xt(
10206
+ yt(
10189
10207
  En,
10190
10208
  wo,
10191
10209
  Wt,
@@ -10358,7 +10376,7 @@ const tS = /* @__PURE__ */ et(() => {
10358
10376
  U(
10359
10377
  n,
10360
10378
  ae((c) => c[a]),
10361
- gt()
10379
+ xt()
10362
10380
  ),
10363
10381
  l
10364
10382
  );
@@ -10381,7 +10399,7 @@ const tS = /* @__PURE__ */ et(() => {
10381
10399
  };
10382
10400
  }), nS = /* @__PURE__ */ et(
10383
10401
  ([e, t]) => ({ ...e, ...t }),
10384
- xt(Bf, tS)
10402
+ yt(Bf, tS)
10385
10403
  ), rS = ({ height: e }) => /* @__PURE__ */ u.jsx("div", { style: { height: e } }), oS = { overflowAnchor: "none", position: qa(), zIndex: 1 }, qf = { overflowAnchor: "none" }, sS = { ...qf, display: "inline-block", height: "100%" }, kc = /* @__PURE__ */ z.memo(function({ showTopList: e = !1 }) {
10386
10404
  const t = je("listState"), n = on("sizeRanges"), r = je("useWindowScroll"), o = je("customScrollParent"), s = on("windowScrollContainerState"), i = on("scrollContainerState"), a = o || r ? s : i, l = je("itemContent"), c = je("context"), d = je("groupContent"), f = je("trackItemSizes"), p = je("itemSize"), h = je("log"), m = on("gap"), x = je("horizontalDirection"), { callbackRef: y } = w0(
10387
10405
  n,
@@ -10671,7 +10689,7 @@ const fS = ({ children: e }) => {
10671
10689
  U(
10672
10690
  s,
10673
10691
  ae((f) => f[c]),
10674
- gt()
10692
+ xt()
10675
10693
  ),
10676
10694
  d
10677
10695
  );
@@ -10696,7 +10714,7 @@ const fS = ({ children: e }) => {
10696
10714
  GroupComponent: l("Group", "tr")
10697
10715
  };
10698
10716
  });
10699
- xt(Bf, wS);
10717
+ yt(Bf, wS);
10700
10718
  qa();
10701
10719
  const Rc = {
10702
10720
  bottom: 0,
@@ -10740,11 +10758,11 @@ const TS = /* @__PURE__ */ et(
10740
10758
  { customScrollParent: y, useWindowScroll: g, windowScrollContainerState: w, windowScrollTo: b, windowViewportRect: T },
10741
10759
  C
10742
10760
  ]) => {
10743
- const S = Y(0), k = Y(0), N = Y(Rc), E = Y({ height: 0, width: 0 }), I = Y({ height: 0, width: 0 }), P = Ue(), L = Ue(), F = Y(0), j = Y(null), $ = Y({ column: 0, row: 0 }), A = Ue(), B = Ue(), D = Y(!1), O = Y(0), J = Y(!0), X = Y(!1), pe = Y(!1);
10761
+ const S = Y(0), k = Y(0), N = Y(Rc), E = Y({ height: 0, width: 0 }), I = Y({ height: 0, width: 0 }), P = We(), L = We(), F = Y(0), j = Y(null), $ = Y({ column: 0, row: 0 }), A = We(), B = We(), D = Y(!1), O = Y(0), J = Y(!0), X = Y(!1), pe = Y(!1);
10744
10762
  ot(
10745
10763
  U(
10746
10764
  m,
10747
- De(O),
10765
+ Le(O),
10748
10766
  Re(([M, H]) => !!H)
10749
10767
  ),
10750
10768
  () => {
@@ -10752,7 +10770,7 @@ const TS = /* @__PURE__ */ et(
10752
10770
  }
10753
10771
  ), ot(
10754
10772
  U(
10755
- It(m, J, I, E, O, X),
10773
+ Nt(m, J, I, E, O, X),
10756
10774
  Re(([M, H, te, oe, , ne]) => M && !H && te.height !== 0 && oe.height !== 0 && !ne)
10757
10775
  ),
10758
10776
  ([, , , , M]) => {
@@ -10772,7 +10790,7 @@ const TS = /* @__PURE__ */ et(
10772
10790
  ), ot(
10773
10791
  U(
10774
10792
  m,
10775
- De(B),
10793
+ Le(B),
10776
10794
  Re(([, M]) => M != null)
10777
10795
  ),
10778
10796
  ([, M]) => {
@@ -10788,7 +10806,7 @@ const TS = /* @__PURE__ */ et(
10788
10806
  f
10789
10807
  ), me(
10790
10808
  U(
10791
- It(
10809
+ Nt(
10792
10810
  Ce(E, Po),
10793
10811
  Ce(I, Po),
10794
10812
  Ce($, (M, H) => M && M.column === H.column && M.row === H.row),
@@ -10804,7 +10822,7 @@ const TS = /* @__PURE__ */ et(
10804
10822
  A
10805
10823
  ), me(
10806
10824
  U(
10807
- It(
10825
+ Nt(
10808
10826
  Ce(S),
10809
10827
  r,
10810
10828
  Ce($, CS),
@@ -10830,18 +10848,18 @@ const TS = /* @__PURE__ */ et(
10830
10848
  Ee,
10831
10849
  Ne
10832
10850
  ]) => {
10833
- const { column: Le, row: Je } = oe, { height: He, width: Ve } = ne, { width: Ke } = Te;
10834
- if (de === 0 && (M === 0 || Ke === 0))
10851
+ const { column: Fe, row: Je } = oe, { height: Ue, width: Ke } = ne, { width: qe } = Te;
10852
+ if (de === 0 && (M === 0 || qe === 0))
10835
10853
  return Rc;
10836
- if (Ve === 0) {
10837
- const he = Wa(Ne, M), qe = he + Math.max(de - 1, 0);
10838
- return SS(Nc(he, qe, Z));
10854
+ if (Ke === 0) {
10855
+ const he = Wa(Ne, M), ze = he + Math.max(de - 1, 0);
10856
+ return SS(Nc(he, ze, Z));
10839
10857
  }
10840
- const Xe = Xf(Ke, Ve, Le);
10858
+ const Xe = Xf(qe, Ke, Fe);
10841
10859
  let Ze, tt;
10842
- Ee ? H === 0 && te === 0 && de > 0 ? (Ze = 0, tt = de - 1) : (Ze = Xe * as((H + Je) / (He + Je)), tt = Xe * Ec((te + Je) / (He + Je)) - 1, tt = Ei(M - 1, Kr(tt, Xe - 1)), Ze = Ei(tt, Kr(0, Ze))) : (Ze = 0, tt = -1);
10843
- const Nt = Nc(Ze, tt, Z), { bottom: ht, top: lt } = Ac(Te, oe, ne, Nt), ce = Ec(M / Xe), fe = ce * He + (ce - 1) * Je - ht;
10844
- return { bottom: ht, itemHeight: He, items: Nt, itemWidth: Ve, offsetBottom: fe, offsetTop: lt, top: lt };
10860
+ Ee ? H === 0 && te === 0 && de > 0 ? (Ze = 0, tt = de - 1) : (Ze = Xe * as((H + Je) / (Ue + Je)), tt = Xe * Ec((te + Je) / (Ue + Je)) - 1, tt = Ei(M - 1, Kr(tt, Xe - 1)), Ze = Ei(tt, Kr(0, Ze))) : (Ze = 0, tt = -1);
10861
+ const At = Nc(Ze, tt, Z), { bottom: mt, top: ct } = Ac(Te, oe, ne, At), ce = Ec(M / Xe), fe = ce * Ue + (ce - 1) * Je - mt;
10862
+ return { bottom: mt, itemHeight: Ue, items: At, itemWidth: Ke, offsetBottom: fe, offsetTop: ct, top: ct };
10845
10863
  }
10846
10864
  )
10847
10865
  ),
@@ -10855,13 +10873,13 @@ const TS = /* @__PURE__ */ et(
10855
10873
  S
10856
10874
  ), me(
10857
10875
  U(
10858
- It(E, I, N, $),
10876
+ Nt(E, I, N, $),
10859
10877
  Re(([M, H, { items: te }]) => te.length > 0 && H.height !== 0 && M.height !== 0),
10860
10878
  ae(([M, H, { items: te }, oe]) => {
10861
10879
  const { bottom: ne, top: Te } = Ac(M, oe, H, te);
10862
10880
  return [Te, ne];
10863
10881
  }),
10864
- gt(oo)
10882
+ xt(oo)
10865
10883
  ),
10866
10884
  t
10867
10885
  );
@@ -10869,53 +10887,53 @@ const TS = /* @__PURE__ */ et(
10869
10887
  me(
10870
10888
  U(
10871
10889
  c,
10872
- De(Ie),
10890
+ Le(Ie),
10873
10891
  ae(([M, H]) => H || M !== 0)
10874
10892
  ),
10875
10893
  Ie
10876
10894
  );
10877
10895
  const Ae = en(
10878
10896
  U(
10879
- It(N, S),
10897
+ Nt(N, S),
10880
10898
  Re(([{ items: M }]) => M.length > 0),
10881
- De(Ie),
10899
+ Le(Ie),
10882
10900
  Re(([[M, H], te]) => {
10883
10901
  const oe = M.items[M.items.length - 1].index === H - 1;
10884
10902
  return (te || M.bottom > 0 && M.itemHeight > 0 && M.offsetBottom === 0 && M.items.length === H) && oe;
10885
10903
  }),
10886
10904
  ae(([[, M]]) => M - 1),
10887
- gt()
10905
+ xt()
10888
10906
  )
10889
- ), K = en(
10907
+ ), V = en(
10890
10908
  U(
10891
10909
  Ce(N),
10892
10910
  Re(({ items: M }) => M.length > 0 && M[0].index === 0),
10893
10911
  wn(0),
10894
- gt()
10912
+ xt()
10895
10913
  )
10896
10914
  ), ee = en(
10897
10915
  U(
10898
10916
  Ce(N),
10899
- De(D),
10917
+ Le(D),
10900
10918
  Re(([{ items: M }, H]) => M.length > 0 && !H),
10901
10919
  ae(([{ items: M }]) => ({
10902
10920
  endIndex: M[M.length - 1].index,
10903
10921
  startIndex: M[0].index
10904
10922
  })),
10905
- gt(If),
10923
+ xt(If),
10906
10924
  An(0)
10907
10925
  )
10908
10926
  );
10909
10927
  me(ee, h.scrollSeekRangeChanged), me(
10910
10928
  U(
10911
10929
  P,
10912
- De(E, I, S, $),
10930
+ Le(E, I, S, $),
10913
10931
  ae(([M, H, te, oe, ne]) => {
10914
10932
  const Te = Pf(M), { align: Z, behavior: de, offset: Ee } = Te;
10915
10933
  let Ne = Te.index;
10916
10934
  Ne === "LAST" && (Ne = oe - 1), Ne = Kr(0, Ne, Ei(oe - 1, Ne));
10917
- let Le = ea(H, ne, te, Ne);
10918
- return Z === "end" ? Le = Ic(Le - H.height + te.height) : Z === "center" && (Le = Ic(Le - H.height / 2 + te.height / 2)), Ee && (Le += Ee), { behavior: de, top: Le };
10935
+ let Fe = ea(H, ne, te, Ne);
10936
+ return Z === "end" ? Fe = Ic(Fe - H.height + te.height) : Z === "center" && (Fe = Ic(Fe - H.height / 2 + te.height / 2)), Ee && (Fe += Ee), { behavior: de, top: Fe };
10919
10937
  })
10920
10938
  ),
10921
10939
  l
@@ -10969,13 +10987,13 @@ const TS = /* @__PURE__ */ et(
10969
10987
  endReached: Ae,
10970
10988
  propsReady: x,
10971
10989
  rangeChanged: ee,
10972
- startReached: K,
10990
+ startReached: V,
10973
10991
  stateChanged: A,
10974
10992
  stateRestoreInProgress: D,
10975
10993
  ...C
10976
10994
  };
10977
10995
  },
10978
- xt(Va, Wt, bo, $f, Gn, Ka, qn)
10996
+ yt(Va, Wt, bo, $f, Gn, Ka, qn)
10979
10997
  );
10980
10998
  function Xf(e, t, n) {
10981
10999
  return Kr(1, as((e + n) / (as(t) + n)));
@@ -10996,7 +11014,7 @@ const kS = /* @__PURE__ */ et(() => {
10996
11014
  U(
10997
11015
  t,
10998
11016
  ae((h) => h[f]),
10999
- gt()
11017
+ xt()
11000
11018
  ),
11001
11019
  p
11002
11020
  ), c = Y(!1), d = Y(!1);
@@ -11020,7 +11038,7 @@ const kS = /* @__PURE__ */ et(() => {
11020
11038
  };
11021
11039
  }), RS = /* @__PURE__ */ et(
11022
11040
  ([e, t]) => ({ ...e, ...t }),
11023
- xt(TS, kS)
11041
+ yt(TS, kS)
11024
11042
  ), ES = /* @__PURE__ */ z.memo(function() {
11025
11043
  const e = wt("gridState"), t = wt("listClassName"), n = wt("itemClassName"), r = wt("itemContent"), o = wt("computeItemKey"), s = wt("isSeeking"), i = sn("scrollHeight"), a = wt("ItemComponent"), l = wt("ListComponent"), c = wt("ScrollSeekPlaceholder"), d = wt("context"), f = sn("itemDimensions"), p = sn("gap"), h = wt("log"), m = wt("stateRestoreInProgress"), x = sn("reportReadyState"), y = pr(
11026
11044
  z.useMemo(
@@ -11489,7 +11507,7 @@ var Vs = "Dialog", [rp, xk] = Mn(Vs), [VS, yn] = rp(Vs), op = (e) => {
11489
11507
  op.displayName = Vs;
11490
11508
  var sp = "DialogTrigger", ip = v.forwardRef(
11491
11509
  (e, t) => {
11492
- const { __scopeDialog: n, ...r } = e, o = yn(sp, n), s = We(t, o.triggerRef);
11510
+ const { __scopeDialog: n, ...r } = e, o = yn(sp, n), s = Ve(t, o.triggerRef);
11493
11511
  return /* @__PURE__ */ u.jsx(
11494
11512
  _e.button,
11495
11513
  {
@@ -11546,7 +11564,7 @@ var qS = Tr("DialogOverlay.RemoveScroll"), GS = v.forwardRef(
11546
11564
  up.displayName = lr;
11547
11565
  var YS = v.forwardRef(
11548
11566
  (e, t) => {
11549
- const n = yn(lr, e.__scopeDialog), r = v.useRef(null), o = We(t, n.contentRef, r);
11567
+ const n = yn(lr, e.__scopeDialog), r = v.useRef(null), o = Ve(t, n.contentRef, r);
11550
11568
  return v.useEffect(() => {
11551
11569
  const s = r.current;
11552
11570
  if (s) return Aa(s);
@@ -11597,7 +11615,7 @@ var YS = v.forwardRef(
11597
11615
  }
11598
11616
  ), dp = v.forwardRef(
11599
11617
  (e, t) => {
11600
- const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: s, ...i } = e, a = yn(lr, n), l = v.useRef(null), c = We(t, l);
11618
+ const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: s, ...i } = e, a = yn(lr, n), l = v.useRef(null), c = Ve(t, l);
11601
11619
  return ba(), /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
11602
11620
  /* @__PURE__ */ u.jsx(
11603
11621
  Is,
@@ -11924,7 +11942,7 @@ function Np(e) {
11924
11942
  return e.replace(cC, (t, n) => (n = n.toLowerCase(), n === "colon" ? ":" : n.charAt(0) === "#" ? n.charAt(1) === "x" ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1)) : ""));
11925
11943
  }
11926
11944
  const uC = /(^|[^\[])\^/g;
11927
- function ft(e, t) {
11945
+ function pt(e, t) {
11928
11946
  e = typeof e == "string" ? e : e.source, t = t || "";
11929
11947
  const n = {
11930
11948
  replace: (r, o) => (o = o.source || o, o = o.replace(uC, "$1"), e = e.replace(r, o), n),
@@ -12486,26 +12504,26 @@ const ve = {
12486
12504
  };
12487
12505
  ve._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
12488
12506
  ve._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
12489
- ve.def = ft(ve.def).replace("label", ve._label).replace("title", ve._title).getRegex();
12507
+ ve.def = pt(ve.def).replace("label", ve._label).replace("title", ve._title).getRegex();
12490
12508
  ve.bullet = /(?:[*+-]|\d{1,9}[.)])/;
12491
- ve.listItemStart = ft(/^( *)(bull) */).replace("bull", ve.bullet).getRegex();
12492
- ve.list = ft(ve.list).replace(/bull/g, ve.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + ve.def.source + ")").getRegex();
12509
+ ve.listItemStart = pt(/^( *)(bull) */).replace("bull", ve.bullet).getRegex();
12510
+ ve.list = pt(ve.list).replace(/bull/g, ve.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + ve.def.source + ")").getRegex();
12493
12511
  ve._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
12494
12512
  ve._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
12495
- ve.html = ft(ve.html, "i").replace("comment", ve._comment).replace("tag", ve._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
12496
- ve.paragraph = ft(ve._paragraph).replace("hr", ve.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ve._tag).getRegex();
12497
- ve.blockquote = ft(ve.blockquote).replace("paragraph", ve.paragraph).getRegex();
12513
+ ve.html = pt(ve.html, "i").replace("comment", ve._comment).replace("tag", ve._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
12514
+ ve.paragraph = pt(ve._paragraph).replace("hr", ve.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ve._tag).getRegex();
12515
+ ve.blockquote = pt(ve.blockquote).replace("paragraph", ve.paragraph).getRegex();
12498
12516
  ve.normal = { ...ve };
12499
12517
  ve.gfm = {
12500
12518
  ...ve.normal,
12501
12519
  table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
12502
12520
  // Cells
12503
12521
  };
12504
- ve.gfm.table = ft(ve.gfm.table).replace("hr", ve.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ve._tag).getRegex();
12505
- ve.gfm.paragraph = ft(ve._paragraph).replace("hr", ve.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", ve.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ve._tag).getRegex();
12522
+ ve.gfm.table = pt(ve.gfm.table).replace("hr", ve.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ve._tag).getRegex();
12523
+ ve.gfm.paragraph = pt(ve._paragraph).replace("hr", ve.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", ve.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ve._tag).getRegex();
12506
12524
  ve.pedantic = {
12507
12525
  ...ve.normal,
12508
- html: ft(
12526
+ html: pt(
12509
12527
  `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
12510
12528
  ).replace("comment", ve._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
12511
12529
  def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
@@ -12513,7 +12531,7 @@ ve.pedantic = {
12513
12531
  fences: us,
12514
12532
  // fences not supported
12515
12533
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
12516
- paragraph: ft(ve.normal._paragraph).replace("hr", ve.hr).replace("heading", ` *#{1,6} *[^
12534
+ paragraph: pt(ve.normal._paragraph).replace("hr", ve.hr).replace("heading", ` *#{1,6} *[^
12517
12535
  ]`).replace("lheading", ve.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
12518
12536
  };
12519
12537
  const le = {
@@ -12541,26 +12559,26 @@ const le = {
12541
12559
  punctuation: /^([\spunctuation])/
12542
12560
  };
12543
12561
  le._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
12544
- le.punctuation = ft(le.punctuation).replace(/punctuation/g, le._punctuation).getRegex();
12562
+ le.punctuation = pt(le.punctuation).replace(/punctuation/g, le._punctuation).getRegex();
12545
12563
  le.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
12546
12564
  le.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
12547
- le._comment = ft(ve._comment).replace("(?:-->|$)", "-->").getRegex();
12548
- le.emStrong.lDelim = ft(le.emStrong.lDelim).replace(/punct/g, le._punctuation).getRegex();
12549
- le.emStrong.rDelimAst = ft(le.emStrong.rDelimAst, "g").replace(/punct/g, le._punctuation).getRegex();
12550
- le.emStrong.rDelimUnd = ft(le.emStrong.rDelimUnd, "g").replace(/punct/g, le._punctuation).getRegex();
12565
+ le._comment = pt(ve._comment).replace("(?:-->|$)", "-->").getRegex();
12566
+ le.emStrong.lDelim = pt(le.emStrong.lDelim).replace(/punct/g, le._punctuation).getRegex();
12567
+ le.emStrong.rDelimAst = pt(le.emStrong.rDelimAst, "g").replace(/punct/g, le._punctuation).getRegex();
12568
+ le.emStrong.rDelimUnd = pt(le.emStrong.rDelimUnd, "g").replace(/punct/g, le._punctuation).getRegex();
12551
12569
  le._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
12552
12570
  le._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
12553
12571
  le._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
12554
- le.autolink = ft(le.autolink).replace("scheme", le._scheme).replace("email", le._email).getRegex();
12572
+ le.autolink = pt(le.autolink).replace("scheme", le._scheme).replace("email", le._email).getRegex();
12555
12573
  le._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
12556
- le.tag = ft(le.tag).replace("comment", le._comment).replace("attribute", le._attribute).getRegex();
12574
+ le.tag = pt(le.tag).replace("comment", le._comment).replace("attribute", le._attribute).getRegex();
12557
12575
  le._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
12558
12576
  le._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
12559
12577
  le._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
12560
- le.link = ft(le.link).replace("label", le._label).replace("href", le._href).replace("title", le._title).getRegex();
12561
- le.reflink = ft(le.reflink).replace("label", le._label).replace("ref", ve._label).getRegex();
12562
- le.nolink = ft(le.nolink).replace("ref", ve._label).getRegex();
12563
- le.reflinkSearch = ft(le.reflinkSearch, "g").replace("reflink", le.reflink).replace("nolink", le.nolink).getRegex();
12578
+ le.link = pt(le.link).replace("label", le._label).replace("href", le._href).replace("title", le._title).getRegex();
12579
+ le.reflink = pt(le.reflink).replace("label", le._label).replace("ref", ve._label).getRegex();
12580
+ le.nolink = pt(le.nolink).replace("ref", ve._label).getRegex();
12581
+ le.reflinkSearch = pt(le.reflinkSearch, "g").replace("reflink", le.reflink).replace("nolink", le.nolink).getRegex();
12564
12582
  le.normal = { ...le };
12565
12583
  le.pedantic = {
12566
12584
  ...le.normal,
@@ -12576,23 +12594,23 @@ le.pedantic = {
12576
12594
  endAst: /\*(?!\*)/g,
12577
12595
  endUnd: /_(?!_)/g
12578
12596
  },
12579
- link: ft(/^!?\[(label)\]\((.*?)\)/).replace("label", le._label).getRegex(),
12580
- reflink: ft(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", le._label).getRegex()
12597
+ link: pt(/^!?\[(label)\]\((.*?)\)/).replace("label", le._label).getRegex(),
12598
+ reflink: pt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", le._label).getRegex()
12581
12599
  };
12582
12600
  le.gfm = {
12583
12601
  ...le.normal,
12584
- escape: ft(le.escape).replace("])", "~|])").getRegex(),
12602
+ escape: pt(le.escape).replace("])", "~|])").getRegex(),
12585
12603
  _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
12586
12604
  url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
12587
12605
  _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
12588
12606
  del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
12589
12607
  text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
12590
12608
  };
12591
- le.gfm.url = ft(le.gfm.url, "i").replace("email", le.gfm._extended_email).getRegex();
12609
+ le.gfm.url = pt(le.gfm.url, "i").replace("email", le.gfm._extended_email).getRegex();
12592
12610
  le.breaks = {
12593
12611
  ...le.gfm,
12594
- br: ft(le.br).replace("{2,}", "*").getRegex(),
12595
- text: ft(le.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
12612
+ br: pt(le.br).replace("{2,}", "*").getRegex(),
12613
+ text: pt(le.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
12596
12614
  };
12597
12615
  function wC(e) {
12598
12616
  return e.replace(/---/g, "—").replace(/--/g, "–").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1‘").replace(/'/g, "’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1“").replace(/"/g, "”").replace(/\.{3}/g, "…");
@@ -13431,7 +13449,7 @@ function fs({
13431
13449
  allowHtml: n = !1,
13432
13450
  style: r
13433
13451
  }) {
13434
- const o = at(() => {
13452
+ const o = lt(() => {
13435
13453
  try {
13436
13454
  if (!n) {
13437
13455
  const i = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
@@ -13441,7 +13459,7 @@ function fs({
13441
13459
  } catch (i) {
13442
13460
  return console.error("[MarkdownContent] parse error", i), `<pre class="font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words">Error rendering markdown: ${String(i)}</pre>`;
13443
13461
  }
13444
- }, [e, n]), s = at(() => {
13462
+ }, [e, n]), s = lt(() => {
13445
13463
  const i = {
13446
13464
  color: "currentColor",
13447
13465
  ...r
@@ -13586,9 +13604,9 @@ const Bc = z.memo(function({
13586
13604
  defaultCheckpointId: N = null,
13587
13605
  messageParentCheckpointId: E = null
13588
13606
  }) {
13589
- const [I, P] = xe(!1), [L, F] = xe("preview"), [j, $] = xe(!1), { currentThreadId: A } = xa(), { respondToInterrupt: B } = ya(), D = l === "phone" || l === "half-screen", O = t.role, J = O === "tool", X = at(() => "type" in t && t.type === "default_message" ? t : null, [t]), pe = !!X, Ie = !(r && O !== "user"), {
13607
+ const [I, P] = xe(!1), [L, F] = xe("preview"), [j, $] = xe(!1), { currentThreadId: A } = xa(), { respondToInterrupt: B } = ya(), D = l === "phone" || l === "half-screen", O = t.role, J = O === "tool", X = lt(() => "type" in t && t.type === "default_message" ? t : null, [t]), pe = !!X, Ie = !(r && O !== "user"), {
13590
13608
  uploadingFiles: Ae,
13591
- handleFileClick: K,
13609
+ handleFileClick: V,
13592
13610
  fileViewerOpen: ee,
13593
13611
  currentFileInfo: q,
13594
13612
  closeFileViewer: M
@@ -13605,27 +13623,27 @@ const Bc = z.memo(function({
13605
13623
  default:
13606
13624
  return "text-[hsl(var(--chat-bubble-ai-text))]";
13607
13625
  }
13608
- }, [O]), te = at(() => X ? "" : CC(t.content), [X, t]), oe = at(() => X ? {} : Pp(t), [X, t]), ne = at(
13626
+ }, [O]), te = lt(() => X ? "" : CC(t.content), [X, t]), oe = lt(() => X ? {} : Pp(t), [X, t]), ne = lt(
13609
13627
  () => X ? [] : t.content.filter((W) => W.type === "image_url"),
13610
13628
  [X, t]
13611
- ), Te = at(
13629
+ ), Te = lt(
13612
13630
  () => X ? [] : t.content.filter((W) => W.type === "file"),
13613
13631
  [X, t]
13614
- ), Z = at(
13632
+ ), Z = lt(
13615
13633
  () => X ? [] : t.content.filter((W) => W.type === "interrupt"),
13616
13634
  [X, t]
13617
- ), de = (g == null ? void 0 : g.id) ?? (g == null ? void 0 : g.interrupt_id), Ee = Mo(de), Ne = g == null ? void 0 : g.value, Le = at(() => X ? "" : TC(t.content), [X, t]), Je = z.useCallback(async () => {
13618
- const W = J ? Le : te;
13635
+ ), de = (g == null ? void 0 : g.id) ?? (g == null ? void 0 : g.interrupt_id), Ee = Mo(de), Ne = g == null ? void 0 : g.value, Fe = lt(() => X ? "" : TC(t.content), [X, t]), Je = z.useCallback(async () => {
13636
+ const W = J ? Fe : te;
13619
13637
  async function we(ye) {
13620
13638
  if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
13621
13639
  await navigator.clipboard.writeText(ye);
13622
13640
  return;
13623
13641
  }
13624
13642
  if (navigator.clipboard && typeof navigator.clipboard.write == "function" && typeof ClipboardItem < "u") {
13625
- const pt = new Blob([ye], { type: "text/plain" });
13643
+ const ht = new Blob([ye], { type: "text/plain" });
13626
13644
  await navigator.clipboard.write([
13627
13645
  new ClipboardItem({
13628
- "text/plain": pt
13646
+ "text/plain": ht
13629
13647
  })
13630
13648
  ]);
13631
13649
  return;
@@ -13637,16 +13655,16 @@ const Bc = z.memo(function({
13637
13655
  } catch (ye) {
13638
13656
  console.error("Failed to copy:", ye);
13639
13657
  }
13640
- }, [J, Le, te, y]), He = z.useCallback(() => {
13658
+ }, [J, Fe, te, y]), Ue = z.useCallback(() => {
13641
13659
  if (!h) return;
13642
- const W = J ? Le : te, we = "type" in t && t.type === "default_message" ? void 0 : {
13660
+ const W = J ? Fe : te, we = "type" in t && t.type === "default_message" ? void 0 : {
13643
13661
  checkpointId: t.checkpointId ?? null,
13644
13662
  checkpointNs: t.checkpointNs ?? null
13645
13663
  };
13646
13664
  h(t.id, W, we);
13647
- }, [h, t.id, J, Le, te, t]), Ve = z.useCallback(() => {
13665
+ }, [h, t.id, J, Fe, te, t]), Ke = z.useCallback(() => {
13648
13666
  m == null || m(n);
13649
- }, [m, n]), Ke = z.useCallback(() => {
13667
+ }, [m, n]), qe = z.useCallback(() => {
13650
13668
  const we = Q(D ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", H);
13651
13669
  switch (O) {
13652
13670
  case "user":
@@ -13741,7 +13759,7 @@ const Bc = z.memo(function({
13741
13759
  } finally {
13742
13760
  T == null || T();
13743
13761
  }
13744
- }, [w, T, b, B]), Nt = z.useCallback(async (W) => {
13762
+ }, [w, T, b, B]), At = z.useCallback(async (W) => {
13745
13763
  if (w)
13746
13764
  return;
13747
13765
  const we = Mo(
@@ -13758,13 +13776,13 @@ const Bc = z.memo(function({
13758
13776
  } finally {
13759
13777
  T == null || T();
13760
13778
  }
13761
- }, [w, T, b, B]), ht = z.useCallback(({ part: W, i: we }) => {
13779
+ }, [w, T, b, B]), mt = z.useCallback(({ part: W, i: we }) => {
13762
13780
  if (W.type === "text") {
13763
- const ye = W.text ?? "", pt = ye.trim(), mt = Ja(pt);
13764
- return mt && O !== "tool" ? /* @__PURE__ */ u.jsx(Op, { data: mt }, we) : O === "user" && c && pt.length > d ? /* @__PURE__ */ u.jsx(
13781
+ const ye = W.text ?? "", ht = ye.trim(), gt = Ja(ht);
13782
+ return gt && O !== "tool" ? /* @__PURE__ */ u.jsx(Op, { data: gt }, we) : O === "user" && c && ht.length > d ? /* @__PURE__ */ u.jsx(
13765
13783
  NC,
13766
13784
  {
13767
- text: pt,
13785
+ text: ht,
13768
13786
  expanded: j,
13769
13787
  onExpandedChange: $,
13770
13788
  previewLength: d,
@@ -13786,18 +13804,18 @@ const Bc = z.memo(function({
13786
13804
  ) }, we);
13787
13805
  }
13788
13806
  if (W.type === "file") {
13789
- const ye = W, pt = ye.name || "file";
13807
+ const ye = W, ht = ye.name || "file";
13790
13808
  return /* @__PURE__ */ u.jsxs(
13791
13809
  "a",
13792
13810
  {
13793
13811
  href: ye.url,
13794
- onClick: (mt) => K(mt, ye, we),
13812
+ onClick: (gt) => V(gt, ye, we),
13795
13813
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
13796
13814
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
13797
13815
  children: [
13798
13816
  Ae[we] ? /* @__PURE__ */ u.jsx(ua, { className: "h-4 w-4 animate-spin" }) : null,
13799
13817
  /* @__PURE__ */ u.jsxs("span", { className: "truncate max-w-[180px]", children: [
13800
- pt,
13818
+ ht,
13801
13819
  Ae[we] ? " (processing)" : ""
13802
13820
  ] })
13803
13821
  ]
@@ -13806,17 +13824,17 @@ const Bc = z.memo(function({
13806
13824
  );
13807
13825
  }
13808
13826
  if (W.type === "interrupt") {
13809
- const ye = W, pt = Mo(
13827
+ const ye = W, ht = Mo(
13810
13828
  (ye == null ? void 0 : ye.id) ?? (ye == null ? void 0 : ye.interrupt_id)
13811
- ), mt = !!(Ee && pt && pt === Ee), St = mt ? Ne ?? (ye == null ? void 0 : ye.value) : ye == null ? void 0 : ye.value, Pe = pt ? { ...ye, id: pt, interrupt_id: pt } : ye;
13829
+ ), gt = !!(Ee && ht && ht === Ee), St = gt ? Ne ?? (ye == null ? void 0 : ye.value) : ye == null ? void 0 : ye.value, Pe = ht ? { ...ye, id: ht, interrupt_id: ht } : ye;
13812
13830
  return /* @__PURE__ */ u.jsx(
13813
13831
  EC,
13814
13832
  {
13815
13833
  interruptPart: Pe,
13816
13834
  onApprove: tt,
13817
- onReject: Nt,
13835
+ onReject: At,
13818
13836
  disabled: w,
13819
- isActive: mt,
13837
+ isActive: gt,
13820
13838
  payload: St
13821
13839
  },
13822
13840
  we
@@ -13824,10 +13842,10 @@ const Bc = z.memo(function({
13824
13842
  }
13825
13843
  return null;
13826
13844
  }, [
13827
- K,
13845
+ V,
13828
13846
  Ae,
13829
13847
  tt,
13830
- Nt,
13848
+ At,
13831
13849
  O,
13832
13850
  c,
13833
13851
  d,
@@ -13838,13 +13856,13 @@ const Bc = z.memo(function({
13838
13856
  g,
13839
13857
  w,
13840
13858
  Z
13841
- ]), lt = z.useCallback(() => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/30 rounded", children: [
13859
+ ]), ct = z.useCallback(() => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/30 rounded", children: [
13842
13860
  /* @__PURE__ */ u.jsx(ji, { className: "h-4 w-4 text-muted-foreground" }),
13843
13861
  /* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
13844
13862
  ] }), []), ce = z.useCallback(() => {
13845
13863
  const W = te.trim().length > 0 || ne.length > 0 || Te.length > 0 || Z.length > 0;
13846
13864
  if (!J && Te.length > 0 && !r)
13847
- return lt();
13865
+ return ct();
13848
13866
  if (!J && !W && !r)
13849
13867
  return null;
13850
13868
  if (J)
@@ -13857,7 +13875,7 @@ const Bc = z.memo(function({
13857
13875
  t.id
13858
13876
  );
13859
13877
  if (!J && !X) {
13860
- const we = t, ye = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: we.content.map((pt, mt) => /* @__PURE__ */ u.jsx(ht, { part: pt, i: mt }, mt)) });
13878
+ const we = t, ye = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: we.content.map((ht, gt) => /* @__PURE__ */ u.jsx(mt, { part: ht, i: gt }, gt)) });
13861
13879
  return r ? /* @__PURE__ */ u.jsxs("div", { "aria-busy": "true", role: "status", children: [
13862
13880
  ye,
13863
13881
  /* @__PURE__ */ u.jsx(RC, { className: H })
@@ -13871,29 +13889,29 @@ const Bc = z.memo(function({
13871
13889
  r,
13872
13890
  J,
13873
13891
  L,
13874
- lt,
13892
+ ct,
13875
13893
  H
13876
- ]), fe = at(() => X ? "Assistant" : kC(t), [X, t]), he = z.useMemo(() => X ? [] : Array.isArray(C) ? C : [], [C, X]), qe = z.useMemo(() => {
13894
+ ]), fe = lt(() => X ? "Assistant" : kC(t), [X, t]), he = z.useMemo(() => X ? [] : Array.isArray(C) ? C : [], [C, X]), ze = z.useMemo(() => {
13877
13895
  var W;
13878
13896
  return he.length ? N && he.some((we) => we.id === N) ? N : ((W = he[0]) == null ? void 0 : W.id) ?? null : null;
13879
- }, [N, he]), yt = z.useMemo(() => !he.length || !S ? null : he.some((W) => W.id === S) ? S : null, [S, he]) ?? qe, At = O === "user" && he.length > 0 && typeof k == "function", st = z.useCallback(
13897
+ }, [N, he]), st = z.useMemo(() => !he.length || !S ? null : he.some((W) => W.id === S) ? S : null, [S, he]) ?? ze, Et = O === "user" && he.length > 0 && typeof k == "function", it = z.useCallback(
13880
13898
  (W) => {
13881
13899
  if (!k) return;
13882
13900
  const we = (W == null ? void 0 : W.id) ?? null, ye = (W == null ? void 0 : W.parentId) ?? E ?? null;
13883
13901
  k(we, ye);
13884
13902
  },
13885
13903
  [E, k]
13886
- ), ze = z.useMemo(() => yt ? he.findIndex((W) => W.id === yt) : -1, [yt, he]), Pt = z.useMemo(() => ze < 0 ? null : he[ze] ?? null, [ze, he]), jt = z.useCallback((W) => {
13904
+ ), Be = z.useMemo(() => st ? he.findIndex((W) => W.id === st) : -1, [st, he]), Pt = z.useMemo(() => Be < 0 ? null : he[Be] ?? null, [Be, he]), jt = z.useCallback((W) => {
13887
13905
  const we = [];
13888
13906
  if (W.step !== null && we.push(`Step ${W.step}`), W.source && we.push(W.source), !W.createdAt)
13889
13907
  return we.length ? we.join(" • ") : W.id.slice(0, 8);
13890
13908
  let ye = "";
13891
13909
  try {
13892
- const pt = new Date(W.createdAt);
13893
- Number.isNaN(pt.getTime()) || (ye = new Intl.DateTimeFormat(void 0, {
13910
+ const ht = new Date(W.createdAt);
13911
+ Number.isNaN(ht.getTime()) || (ye = new Intl.DateTimeFormat(void 0, {
13894
13912
  hour: "2-digit",
13895
13913
  minute: "2-digit"
13896
- }).format(pt));
13914
+ }).format(ht));
13897
13915
  } catch {
13898
13916
  ye = "";
13899
13917
  }
@@ -13912,7 +13930,7 @@ const Bc = z.memo(function({
13912
13930
  ),
13913
13931
  children: [
13914
13932
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
13915
- Ke(),
13933
+ qe(),
13916
13934
  a && fe && /* @__PURE__ */ u.jsx("span", { className: Q("font-medium", D ? "text-xs" : "text-sm"), children: fe }),
13917
13935
  J && /* @__PURE__ */ u.jsxs(
13918
13936
  Zf,
@@ -13940,28 +13958,28 @@ const Bc = z.memo(function({
13940
13958
  )
13941
13959
  ] }),
13942
13960
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
13943
- At && Pt && ze >= 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
13961
+ Et && Pt && Be >= 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
13944
13962
  /* @__PURE__ */ u.jsx(
13945
13963
  "button",
13946
13964
  {
13947
13965
  type: "button",
13948
13966
  className: Q(
13949
13967
  "flex items-center justify-center rounded border px-1.5 py-1 transition-colors",
13950
- ze > 0 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
13968
+ Be > 0 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
13951
13969
  ),
13952
13970
  onClick: () => {
13953
- if (ze <= 0) return;
13954
- const W = he[ze - 1];
13955
- W && st(W);
13971
+ if (Be <= 0) return;
13972
+ const W = he[Be - 1];
13973
+ W && it(W);
13956
13974
  },
13957
13975
  "aria-label": "Previous checkpoint",
13958
- disabled: ze <= 0,
13976
+ disabled: Be <= 0,
13959
13977
  children: /* @__PURE__ */ u.jsx(xm, { className: "h-3 w-3" })
13960
13978
  }
13961
13979
  ),
13962
13980
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
13963
13981
  /* @__PURE__ */ u.jsxs("span", { className: "whitespace-nowrap", children: [
13964
- ze + 1,
13982
+ Be + 1,
13965
13983
  " / ",
13966
13984
  he.length
13967
13985
  ] }),
@@ -13973,15 +13991,15 @@ const Bc = z.memo(function({
13973
13991
  type: "button",
13974
13992
  className: Q(
13975
13993
  "flex items-center justify-center rounded border px-1.5 py-1 transition-colors",
13976
- ze < he.length - 1 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
13994
+ Be < he.length - 1 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
13977
13995
  ),
13978
13996
  onClick: () => {
13979
- if (ze >= he.length - 1) return;
13980
- const W = he[ze + 1];
13981
- W && st(W);
13997
+ if (Be >= he.length - 1) return;
13998
+ const W = he[Be + 1];
13999
+ W && it(W);
13982
14000
  },
13983
14001
  "aria-label": "Next checkpoint",
13984
- disabled: ze >= he.length - 1,
14002
+ disabled: Be >= he.length - 1,
13985
14003
  children: /* @__PURE__ */ u.jsx(Xc, { className: "h-3 w-3" })
13986
14004
  }
13987
14005
  )
@@ -14021,7 +14039,7 @@ const Bc = z.memo(function({
14021
14039
  {
14022
14040
  variant: "ghost",
14023
14041
  size: "sm",
14024
- onClick: He,
14042
+ onClick: Ue,
14025
14043
  className: Q("h-6 w-6 p-0 hover:bg-foreground/10", H, D && "h-5 w-5"),
14026
14044
  "aria-label": "Edit message",
14027
14045
  children: /* @__PURE__ */ u.jsx(fl, { className: Q(H, D ? "h-3 w-3" : "h-4 w-4") })
@@ -14032,7 +14050,7 @@ const Bc = z.memo(function({
14032
14050
  {
14033
14051
  variant: "ghost",
14034
14052
  size: "sm",
14035
- onClick: Ve,
14053
+ onClick: Ke,
14036
14054
  className: Q("h-6 w-6 p-0 hover:bg-foreground/10", H, D && "h-5 w-5"),
14037
14055
  "aria-label": "Regenerate response",
14038
14056
  children: /* @__PURE__ */ u.jsx(_i, { className: Q(H, D ? "h-3 w-3" : "h-4 w-4") })
@@ -14080,7 +14098,7 @@ const Bc = z.memo(function({
14080
14098
  {
14081
14099
  variant: "ghost",
14082
14100
  size: "sm",
14083
- onClick: He,
14101
+ onClick: Ue,
14084
14102
  className: Q("h-6 w-6 p-0 hover:bg-background/50 text-current", D && "h-5 w-5"),
14085
14103
  children: /* @__PURE__ */ u.jsx(fl, { className: Q("text-current", D ? "h-3 w-3" : "h-4 w-4") })
14086
14104
  }
@@ -14090,7 +14108,7 @@ const Bc = z.memo(function({
14090
14108
  {
14091
14109
  variant: "ghost",
14092
14110
  size: "sm",
14093
- onClick: Ve,
14111
+ onClick: Ke,
14094
14112
  className: Q("h-6 w-6 p-0 hover:bg-background/50 text-current", D && "h-5 w-5"),
14095
14113
  children: /* @__PURE__ */ u.jsx(_i, { className: Q("text-current", D ? "h-3 w-3" : "h-4 w-4") })
14096
14114
  }
@@ -14375,9 +14393,9 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14375
14393
  onSelectCheckpoint: I,
14376
14394
  timelineCheckpoints: P
14377
14395
  }, L) => {
14378
- const F = Qe(null), j = Qe(null), $ = Qe(!1), [A, B] = xe(!0), D = at(() => w ? e.some((Z) => "type" in Z && Z.type === "default_message" ? !1 : Array.isArray(Z == null ? void 0 : Z.content) && Z.content.some(
14396
+ const F = Qe(null), j = Qe(null), $ = Qe(!1), [A, B] = xe(!0), D = lt(() => w ? e.some((Z) => "type" in Z && Z.type === "default_message" ? !1 : Array.isArray(Z == null ? void 0 : Z.content) && Z.content.some(
14379
14397
  (de) => de && de.type === "interrupt" && (de.id ?? de.interrupt_id) === w.id
14380
- )) : !1, [w, e]), O = at(() => {
14398
+ )) : !1, [w, e]), O = lt(() => {
14381
14399
  if (!w || D)
14382
14400
  return null;
14383
14401
  const Z = w.id && String(w.id).trim() ? String(w.id).trim() : "pending-interrupt";
@@ -14400,7 +14418,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14400
14418
  }
14401
14419
  ]
14402
14420
  };
14403
- }, [w, D]), J = at(() => O ? [...e, O] : e, [e, O]), X = at(() => S ? J : J.filter((Z) => (Z == null ? void 0 : Z.role) !== "tool"), [J, S]), pe = at(() => {
14421
+ }, [w, D]), J = lt(() => O ? [...e, O] : e, [e, O]), X = lt(() => S ? J : J.filter((Z) => (Z == null ? void 0 : Z.role) !== "tool"), [J, S]), pe = lt(() => {
14404
14422
  const Z = /* @__PURE__ */ new Set(), de = [];
14405
14423
  for (let Ee = X.length - 1; Ee >= 0; Ee--) {
14406
14424
  const Ne = X[Ee];
@@ -14409,13 +14427,13 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14409
14427
  de.push(Ne);
14410
14428
  continue;
14411
14429
  }
14412
- const Le = Ne, Je = jC(Le);
14413
- Z.has(Je) || (Z.add(Je), de.push(Le));
14430
+ const Fe = Ne, Je = jC(Fe);
14431
+ Z.has(Je) || (Z.add(Je), de.push(Fe));
14414
14432
  }
14415
14433
  return de.reverse();
14416
14434
  }, [X]), Ie = ke((Z) => {
14417
14435
  B(Z), y && y(!Z), g && g(Z);
14418
- }, [y, g]), Ae = at(() => {
14436
+ }, [y, g]), Ae = lt(() => {
14419
14437
  if (a)
14420
14438
  return async () => {
14421
14439
  if (!$.current) {
@@ -14427,7 +14445,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14427
14445
  }
14428
14446
  }
14429
14447
  };
14430
- }, [a]), K = at(() => !m || x ? !1 : A ? "auto" : !1, [A, m, x]), ee = at(() => P ?? [], [P]), q = E ?? (ee.length ? ee[ee.length - 1].id : null), M = ee.length > 0, H = at(() => {
14448
+ }, [a]), V = lt(() => !m || x ? !1 : A ? "auto" : !1, [A, m, x]), ee = lt(() => P ?? [], [P]), q = E ?? (ee.length ? ee[ee.length - 1].id : null), M = ee.length > 0, H = lt(() => {
14431
14449
  if (typeof h != "string") return null;
14432
14450
  const Z = h.trim();
14433
14451
  return Z ? {
@@ -14540,7 +14558,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14540
14558
  j.current = Z instanceof HTMLDivElement ? Z : null;
14541
14559
  },
14542
14560
  data: pe,
14543
- followOutput: K,
14561
+ followOutput: V,
14544
14562
  overscan: 200,
14545
14563
  increaseViewportBy: { top: 100, bottom: 200 },
14546
14564
  defaultItemHeight: 80,
@@ -14555,22 +14573,22 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14555
14573
  itemContent: (Z, de) => {
14556
14574
  var tt;
14557
14575
  const Ee = Hc(de, Z), Ne = "type" in de && de.type === "default_message";
14558
- let Le = [], Je = null, He = {}, Ve = {}, Ke = null, Xe = null;
14576
+ let Fe = [], Je = null, Ue = {}, Ke = {}, qe = null, Xe = null;
14559
14577
  if (!Ne) {
14560
- const Nt = de, ht = Nt.checkpointId ?? null;
14561
- He = Nt.additionalKwargs ?? {}, Ve = Nt.responseMetadata ?? {};
14562
- const lt = ht && k ? k.get(ht) ?? null : null;
14563
- Ke = typeof He.step == "number" ? He.step : typeof Ve.step == "number" ? Ve.step : (lt == null ? void 0 : lt.step) ?? null;
14564
- const ce = typeof He.source == "string" ? He.source : typeof Ve.source == "string" ? Ve.source : (lt == null ? void 0 : lt.source) ?? null;
14578
+ const At = de, mt = At.checkpointId ?? null;
14579
+ Ue = At.additionalKwargs ?? {}, Ke = At.responseMetadata ?? {};
14580
+ const ct = mt && k ? k.get(mt) ?? null : null;
14581
+ qe = typeof Ue.step == "number" ? Ue.step : typeof Ke.step == "number" ? Ke.step : (ct == null ? void 0 : ct.step) ?? null;
14582
+ const ce = typeof Ue.source == "string" ? Ue.source : typeof Ke.source == "string" ? Ke.source : (ct == null ? void 0 : ct.source) ?? null;
14565
14583
  Xe = ce ? String(ce) : null;
14566
- const fe = Ke !== null && Xe ? `${Ke}:${Xe}` : null;
14567
- fe && (N != null && N.has(fe)) ? Le = N.get(fe) ?? [] : ht && lt && (Le = [lt]), Je = ht ?? ((tt = Le[0]) == null ? void 0 : tt.id) ?? null;
14584
+ const fe = qe !== null && Xe ? `${qe}:${Xe}` : null;
14585
+ fe && (N != null && N.has(fe)) ? Fe = N.get(fe) ?? [] : mt && ct && (Fe = [ct]), Je = mt ?? ((tt = Fe[0]) == null ? void 0 : tt.id) ?? null;
14568
14586
  }
14569
14587
  const Ze = (() => {
14570
- if (typeof He.parentCheckpointId == "string")
14571
- return He.parentCheckpointId;
14572
- if (typeof Ve.parentCheckpointId == "string")
14573
- return Ve.parentCheckpointId;
14588
+ if (typeof Ue.parentCheckpointId == "string")
14589
+ return Ue.parentCheckpointId;
14590
+ if (typeof Ke.parentCheckpointId == "string")
14591
+ return Ke.parentCheckpointId;
14574
14592
  })();
14575
14593
  return /* @__PURE__ */ u.jsx(
14576
14594
  "div",
@@ -14601,7 +14619,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14601
14619
  onInterruptActionStart: T,
14602
14620
  onInterruptActionEnd: C,
14603
14621
  showToolMessages: S,
14604
- checkpointCandidates: Le,
14622
+ checkpointCandidates: Fe,
14605
14623
  activeCheckpointId: E ?? null,
14606
14624
  onSelectCheckpoint: I,
14607
14625
  defaultCheckpointId: Je,
@@ -14653,13 +14671,13 @@ function Ai({
14653
14671
  kt(() => {
14654
14672
  pe || Ae(!1);
14655
14673
  }, [pe]);
14656
- const K = ke(() => {
14674
+ const V = ke(() => {
14657
14675
  Ae(!0);
14658
14676
  }, []), ee = ke(() => {
14659
14677
  Ae(!1);
14660
- }, []), q = !!pe || Ie, [M, H] = xe(null), [te, oe] = xe(""), [ne, Te] = xe(null), [Z, de] = xe(null), [Ee, Ne] = xe([]), [Le, Je] = xe(0), [He, Ve] = xe(0), [Ke, Xe] = xe(!1), [Ze, tt] = xe(null), [Nt, ht] = xe(null), [lt, ce] = xe(!1), [fe, he] = xe(null), [qe, Fe] = xe(!1), yt = Qe(!1), [At, st] = xe(() => Uc.value), ze = Qe(At), Pt = Qe(null), jt = ke((G) => {
14661
- Uc.value = G, st(G);
14662
- }, []), [W, we] = xe(!1), ye = Qe(null), pt = ke((G) => {
14678
+ }, []), q = !!pe || Ie, [M, H] = xe(null), [te, oe] = xe(""), [ne, Te] = xe(null), [Z, de] = xe(null), [Ee, Ne] = xe([]), [Fe, Je] = xe(0), [Ue, Ke] = xe(0), [qe, Xe] = xe(!1), [Ze, tt] = xe(null), [At, mt] = xe(null), [ct, ce] = xe(!1), [fe, he] = xe(null), [ze, De] = xe(!1), st = Qe(!1), [Et, it] = xe(() => Uc.value), Be = Qe(Et), Pt = Qe(null), jt = ke((G) => {
14679
+ Uc.value = G, it(G);
14680
+ }, []), [W, we] = xe(!1), ye = Qe(null), ht = ke((G) => {
14663
14681
  if (!Array.isArray(G))
14664
14682
  return { text: null, messageId: null };
14665
14683
  for (let re = G.length - 1; re >= 0; re--) {
@@ -14672,7 +14690,7 @@ function Ai({
14672
14690
  };
14673
14691
  }
14674
14692
  return { text: null, messageId: null };
14675
- }, []), mt = ke(
14693
+ }, []), gt = ke(
14676
14694
  (G, re) => {
14677
14695
  if (!G || typeof G != "object") return null;
14678
14696
  const ie = G[re];
@@ -14686,11 +14704,11 @@ function Ai({
14686
14704
  return typeof ie == "string" && ie.trim() ? ie : null;
14687
14705
  },
14688
14706
  []
14689
- ), Pe = at(() => {
14707
+ ), Pe = lt(() => {
14690
14708
  const G = (Se) => {
14691
14709
  if (!Array.isArray(Se) || Se.length === 0)
14692
14710
  return null;
14693
- const ut = Se.map((Ye) => {
14711
+ const dt = Se.map((Ye) => {
14694
14712
  if (typeof Ye == "string")
14695
14713
  return Ye.trim();
14696
14714
  if (Ye && typeof Ye == "object" && "type" in Ye) {
@@ -14700,49 +14718,49 @@ function Ai({
14700
14718
  }
14701
14719
  return null;
14702
14720
  }).filter((Ye) => !!(Ye && Ye.length));
14703
- return ut.length ? ut.join(", ") : null;
14721
+ return dt.length ? dt.join(", ") : null;
14704
14722
  }, re = Array.isArray(I) ? I.map((Se) => {
14705
- const ut = G(Se.next);
14706
- return ut ? {
14723
+ const dt = G(Se.next);
14724
+ return dt ? {
14707
14725
  ...Se,
14708
14726
  metadata: {
14709
14727
  ...Se.metadata ?? {},
14710
- next: ut
14728
+ next: dt
14711
14729
  }
14712
14730
  } : Se;
14713
14731
  }) : [];
14714
- return re.some((Se) => mt(Se.metadata, "step") !== null) && re.sort((Se, ut) => {
14715
- const Ye = mt(Se.metadata, "step"), nt = mt(ut.metadata, "step");
14732
+ return re.some((Se) => gt(Se.metadata, "step") !== null) && re.sort((Se, dt) => {
14733
+ const Ye = gt(Se.metadata, "step"), nt = gt(dt.metadata, "step");
14716
14734
  if (Ye !== null || nt !== null)
14717
14735
  return (nt ?? Number.NEGATIVE_INFINITY) - (Ye ?? Number.NEGATIVE_INFINITY);
14718
- const Mt = Date.parse(Se.createdAt ?? ""), tn = Date.parse(ut.createdAt ?? "");
14736
+ const Mt = Date.parse(Se.createdAt ?? ""), tn = Date.parse(dt.createdAt ?? "");
14719
14737
  return Number.isNaN(Mt) || Number.isNaN(tn) ? 0 : tn - Mt;
14720
14738
  }), re;
14721
- }, [I, mt]), { checkpointMetaById: Vt, checkpointIndexByKey: ct } = at(() => {
14739
+ }, [I, gt]), { checkpointMetaById: Vt, checkpointIndexByKey: ut } = lt(() => {
14722
14740
  const G = /* @__PURE__ */ new Map(), re = /* @__PURE__ */ new Map();
14723
14741
  for (const ie of Pe) {
14724
14742
  const Se = ie.checkpointId ?? null;
14725
14743
  if (!Se) continue;
14726
- const ut = mt(ie.metadata, "step"), Ye = St(ie.metadata, "source"), nt = {
14744
+ const dt = gt(ie.metadata, "step"), Ye = St(ie.metadata, "source"), nt = {
14727
14745
  id: Se,
14728
- step: ut,
14746
+ step: dt,
14729
14747
  source: Ye,
14730
14748
  createdAt: ie.createdAt ?? null,
14731
14749
  namespace: ie.checkpointNs ?? null,
14732
14750
  parentId: ie.parentId ?? null
14733
14751
  };
14734
- if (G.set(Se, nt), ut !== null && Ye) {
14735
- const Mt = `${ut}:${Ye}`, tn = re.get(Mt) ?? [];
14752
+ if (G.set(Se, nt), dt !== null && Ye) {
14753
+ const Mt = `${dt}:${Ye}`, tn = re.get(Mt) ?? [];
14736
14754
  tn.push(nt), re.set(Mt, tn);
14737
14755
  }
14738
14756
  }
14739
14757
  for (const ie of re.values())
14740
- ie.sort((Se, ut) => {
14758
+ ie.sort((Se, dt) => {
14741
14759
  const Ye = Se.createdAt ?? "";
14742
- return (ut.createdAt ?? "").localeCompare(Ye);
14760
+ return (dt.createdAt ?? "").localeCompare(Ye);
14743
14761
  });
14744
14762
  return { checkpointMetaById: G, checkpointIndexByKey: re };
14745
- }, [Pe, mt, St]), Ct = at(() => {
14763
+ }, [Pe, gt, St]), Ct = lt(() => {
14746
14764
  var Ye;
14747
14765
  if (!Pe.length) return [];
14748
14766
  const G = [...Pe].reverse(), re = (nt, Mt) => {
@@ -14750,13 +14768,13 @@ function Ai({
14750
14768
  if (!tn) return null;
14751
14769
  const Zn = St(nt.metadata, "source");
14752
14770
  St(nt.metadata, "next");
14753
- const { text: ll, messageId: nm } = pt(nt.messages), oi = ll && ll.replace(/\s+/g, " ").trim() || St(nt.metadata, "title") || St(nt.metadata, "label") || Mt || Zn || "Checkpoint", rm = oi.length > 60 ? `${oi.slice(0, 57)}…` : oi;
14771
+ const { text: ll, messageId: nm } = ht(nt.messages), oi = ll && ll.replace(/\s+/g, " ").trim() || St(nt.metadata, "title") || St(nt.metadata, "label") || Mt || Zn || "Checkpoint", rm = oi.length > 60 ? `${oi.slice(0, 57)}…` : oi;
14754
14772
  return {
14755
14773
  id: tn,
14756
14774
  label: rm,
14757
14775
  messageId: nm ?? null,
14758
14776
  createdAt: nt.createdAt ?? null,
14759
- step: mt(nt.metadata, "step"),
14777
+ step: gt(nt.metadata, "step"),
14760
14778
  source: Zn ?? null,
14761
14779
  next: St(nt.metadata, "next")
14762
14780
  };
@@ -14772,17 +14790,17 @@ function Ai({
14772
14790
  const Mt = re(nt);
14773
14791
  Mt && !Se.has(Mt.id) && (ie.push(Mt), Se.add(Mt.id));
14774
14792
  }
14775
- const ut = Pe.find((nt) => {
14793
+ const dt = Pe.find((nt) => {
14776
14794
  var tn;
14777
14795
  return (((tn = St(nt.metadata, "source")) == null ? void 0 : tn.toLowerCase()) ?? null) === "loop";
14778
14796
  });
14779
- if (ut) {
14780
- const nt = re(ut, "Latest loop");
14797
+ if (dt) {
14798
+ const nt = re(dt, "Latest loop");
14781
14799
  nt && !Se.has(nt.id) && (ie.push(nt), Se.add(nt.id));
14782
14800
  }
14783
14801
  return ie;
14784
- }, [Pe, pt, mt, St]), Dn = Qe(null), Jn = Qe(null), Ln = ke(() => {
14785
- Dn.current && (Dn.current.value = ""), Jn.current && (Jn.current.value = ""), Je((G) => G + 1), Ve((G) => G + 1);
14802
+ }, [Pe, ht, gt, St]), Dn = Qe(null), Jn = Qe(null), Ln = ke(() => {
14803
+ Dn.current && (Dn.current.value = ""), Jn.current && (Jn.current.value = ""), Je((G) => G + 1), Ke((G) => G + 1);
14786
14804
  }, []), ti = ke(
14787
14805
  (G) => {
14788
14806
  jt(G);
@@ -14800,24 +14818,24 @@ function Ai({
14800
14818
  };
14801
14819
  return G(), window.addEventListener("resize", G), () => window.removeEventListener("resize", G);
14802
14820
  }, []), kt(() => {
14803
- Fe(!1), yt.current = !1;
14821
+ De(!1), st.current = !1;
14804
14822
  }, [D]), kt(() => {
14805
- ze.current = At;
14806
- }, [At]), kt(() => {
14823
+ Be.current = Et;
14824
+ }, [Et]), kt(() => {
14807
14825
  if (!M) {
14808
14826
  Pt.current = null;
14809
14827
  return;
14810
14828
  }
14811
- Pt.current === null && (Pt.current = ze.current), jt(te ?? "");
14829
+ Pt.current === null && (Pt.current = Be.current), jt(te ?? "");
14812
14830
  }, [te, M, jt]);
14813
14831
  const R = ke(async () => {
14814
- if (!(!b || T || !qe))
14832
+ if (!(!b || T || !ze))
14815
14833
  try {
14816
14834
  await S();
14817
14835
  } catch (G) {
14818
14836
  console.warn("loadOlder failed", G);
14819
14837
  }
14820
- }, [b, qe, T, S]);
14838
+ }, [b, ze, T, S]);
14821
14839
  kt(() => {
14822
14840
  (async () => {
14823
14841
  if (!x.baseUrl) {
@@ -14832,9 +14850,9 @@ function Ai({
14832
14850
  }
14833
14851
  })();
14834
14852
  }, [x.baseUrl]), kt(() => {
14835
- j && !lt && (m == null || m(j));
14836
- }, [j, lt, m]);
14837
- const V = (G) => {
14853
+ j && !ct && (m == null || m(j));
14854
+ }, [j, ct, m]);
14855
+ const K = (G) => {
14838
14856
  if (G.length > Wo)
14839
14857
  return `Message too long (${G.length}/${Wo} characters)`;
14840
14858
  try {
@@ -14846,14 +14864,14 @@ function Ai({
14846
14864
  const re = G.trim();
14847
14865
  if (!(!re && Ee.length === 0)) {
14848
14866
  if (re) {
14849
- const ie = V(re);
14867
+ const ie = K(re);
14850
14868
  if (ie) {
14851
14869
  de(ie);
14852
14870
  return;
14853
14871
  }
14854
14872
  }
14855
14873
  try {
14856
- const ie = O ?? void 0, Se = J ?? void 0, ut = M ? {
14874
+ const ie = O ?? void 0, Se = J ?? void 0, dt = M ? {
14857
14875
  edit: !0,
14858
14876
  originalMessageId: M,
14859
14877
  ...ne != null && ne.checkpointId ? { originalCheckpointId: ne.checkpointId } : {},
@@ -14863,7 +14881,7 @@ function Ai({
14863
14881
  {
14864
14882
  text: re || "",
14865
14883
  attachments: Ee,
14866
- messageAdditionalKwargs: ut
14884
+ messageAdditionalKwargs: dt
14867
14885
  },
14868
14886
  {
14869
14887
  checkpointId: ie,
@@ -14877,31 +14895,31 @@ function Ai({
14877
14895
  }
14878
14896
  }, be = z.useCallback(
14879
14897
  (G, re, ie) => {
14880
- c && (Pt.current = At, H(G), oe(re), jt(re), de(null), Te({
14898
+ c && (Pt.current = Et, H(G), oe(re), jt(re), de(null), Te({
14881
14899
  checkpointId: (ie == null ? void 0 : ie.checkpointId) ?? null,
14882
14900
  checkpointNs: (ie == null ? void 0 : ie.checkpointNs) ?? null
14883
14901
  }));
14884
14902
  },
14885
- [At, c, jt]
14903
+ [Et, c, jt]
14886
14904
  ), Ge = z.useCallback(() => {
14887
- H(null), oe(""), Te(null), de(null), jt(Pt.current ?? At), Pt.current = null;
14888
- }, [At, jt]), it = ke(
14905
+ H(null), oe(""), Te(null), de(null), jt(Pt.current ?? Et), Pt.current = null;
14906
+ }, [Et, jt]), at = ke(
14889
14907
  (G, re, ie) => {
14890
14908
  be(G, re, ie);
14891
14909
  },
14892
14910
  [be]
14893
- ), Be = ke((G) => {
14911
+ ), He = ke((G) => {
14894
14912
  for (let re = G - 1; re >= 0; re--)
14895
14913
  if (w[re].role === "user") {
14896
- const ie = w[re].content || [], ut = ie.filter((Ye) => Ye.type === "text").map((Ye) => Ye.text).join("") || (() => {
14914
+ const ie = w[re].content || [], dt = ie.filter((Ye) => Ye.type === "text").map((Ye) => Ye.text).join("") || (() => {
14897
14915
  try {
14898
14916
  return JSON.stringify(ie, null, 2);
14899
14917
  } catch {
14900
14918
  return String(ie);
14901
14919
  }
14902
14920
  })();
14903
- ut && A(
14904
- { text: ut },
14921
+ dt && A(
14922
+ { text: dt },
14905
14923
  {
14906
14924
  checkpointId: O ?? void 0,
14907
14925
  checkpointNs: J ?? void 0
@@ -14914,13 +14932,13 @@ function Ai({
14914
14932
  Ne((ie) => [...ie, ...re]), G.target.value = "";
14915
14933
  }, Ot = (G) => {
14916
14934
  Ne((re) => {
14917
- const ie = re.filter((Se, ut) => G !== ut);
14935
+ const ie = re.filter((Se, dt) => G !== dt);
14918
14936
  return ie.length === 0 && Ln(), ie;
14919
14937
  });
14920
14938
  }, bt = async (G) => {
14921
14939
  const re = (G.target.files || [])[0];
14922
14940
  if (re) {
14923
- tt(null), ht(null), Xe(!0);
14941
+ tt(null), mt(null), Xe(!0);
14924
14942
  try {
14925
14943
  await A(
14926
14944
  { attachments: [re] },
@@ -14930,7 +14948,7 @@ function Ai({
14930
14948
  }
14931
14949
  );
14932
14950
  const ie = `Uploaded ${re.name} - processing through chat stream`;
14933
- ht(ie);
14951
+ mt(ie);
14934
14952
  } catch (ie) {
14935
14953
  const Se = ie instanceof Error ? ie.message : "Failed to upload Excel file";
14936
14954
  console.error("Excel upload failed", ie), tt(Se), m == null || m(Se);
@@ -14943,14 +14961,14 @@ function Ai({
14943
14961
  we(!0);
14944
14962
  try {
14945
14963
  if (!G) {
14946
- await N(), Fe(!1), requestAnimationFrame(() => {
14964
+ await N(), De(!1), requestAnimationFrame(() => {
14947
14965
  var Se;
14948
14966
  (Se = ye.current) == null || Se.scrollToLatest();
14949
14967
  });
14950
14968
  return;
14951
14969
  }
14952
14970
  const re = Pe.find((Se) => Se.checkpointId === G), ie = (re == null ? void 0 : re.checkpointNs) ?? null;
14953
- await k(G, ie), Fe(!0), requestAnimationFrame(() => {
14971
+ await k(G, ie), De(!0), requestAnimationFrame(() => {
14954
14972
  var Se;
14955
14973
  (Se = ye.current) == null || Se.scrollToTop();
14956
14974
  });
@@ -14969,13 +14987,13 @@ function Ai({
14969
14987
  return "Latest";
14970
14988
  const re = [];
14971
14989
  G.step !== null && re.push(`Step ${G.step}`), G.source && re.push(G.source);
14972
- const ie = G.createdAt ? new Date(G.createdAt) : null, Se = ie && !Number.isNaN(ie.getTime()) ? ie.toLocaleString() : G.createdAt ?? G.id, ut = re.length ? ` — ${re.join(" • ")}` : "";
14973
- return `${Se}${ut}`;
14990
+ const ie = G.createdAt ? new Date(G.createdAt) : null, Se = ie && !Number.isNaN(ie.getTime()) ? ie.toLocaleString() : G.createdAt ?? G.id, dt = re.length ? ` — ${re.join(" • ")}` : "";
14991
+ return `${Se}${dt}`;
14974
14992
  },
14975
14993
  []
14976
14994
  );
14977
14995
  return /* @__PURE__ */ u.jsxs("div", { className: Fn, children: [
14978
- !!j && !lt && /* @__PURE__ */ u.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: [
14996
+ !!j && !ct && /* @__PURE__ */ u.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: [
14979
14997
  /* @__PURE__ */ u.jsx("span", { children: j }),
14980
14998
  /* @__PURE__ */ u.jsx(
14981
14999
  rt,
@@ -15031,27 +15049,27 @@ function Ai({
15031
15049
  enableMessageEditing: c,
15032
15050
  editingMessageId: M,
15033
15051
  onStartReached: () => {
15034
- qe && R();
15052
+ ze && R();
15035
15053
  },
15036
15054
  onScrollAway: (G) => {
15037
- if (!yt.current) {
15038
- yt.current = !0;
15055
+ if (!st.current) {
15056
+ st.current = !0;
15039
15057
  return;
15040
15058
  }
15041
- G && Fe(!0);
15059
+ G && De(!0);
15042
15060
  },
15043
- onEdit: it,
15044
- onRegenerate: Be,
15061
+ onEdit: at,
15062
+ onRegenerate: He,
15045
15063
  onCancelEdit: Ge,
15046
15064
  emptyMessage: fe ?? void 0,
15047
15065
  isNavigatingCheckpoint: W,
15048
15066
  activeInterrupt: pe,
15049
15067
  disableInterruptActions: Ie,
15050
- onInterruptActionStart: K,
15068
+ onInterruptActionStart: V,
15051
15069
  onInterruptActionEnd: ee,
15052
15070
  showToolMessages: d,
15053
15071
  checkpointMetaById: Vt,
15054
- checkpointIndexByKey: ct,
15072
+ checkpointIndexByKey: ut,
15055
15073
  activeCheckpointId: O,
15056
15074
  onSelectCheckpoint: Kt,
15057
15075
  timelineCheckpoints: Ct
@@ -15101,7 +15119,7 @@ function Ai({
15101
15119
  onChange: (G) => $e(G),
15102
15120
  className: "hidden"
15103
15121
  },
15104
- Le
15122
+ Fe
15105
15123
  ),
15106
15124
  Ee.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "flex flex-wrap gap-2", children: Ee.map((G, re) => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100", children: [
15107
15125
  /* @__PURE__ */ u.jsx(ji, { size: 14 }),
@@ -15129,14 +15147,14 @@ function Ai({
15129
15147
  onChange: bt,
15130
15148
  className: "hidden"
15131
15149
  },
15132
- He
15150
+ Ue
15133
15151
  ),
15134
- Ke && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
15152
+ qe && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
15135
15153
  /* @__PURE__ */ u.jsx(zr, { className: "h-4 w-4 animate-spin" }),
15136
15154
  " Uploading Excel file..."
15137
15155
  ] }),
15138
- Nt && !Ke && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: Nt }),
15139
- Ze && !Ke && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: Ze })
15156
+ At && !qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: At }),
15157
+ Ze && !qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: Ze })
15140
15158
  ] })
15141
15159
  ] }),
15142
15160
  Z && /* @__PURE__ */ u.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: Z }),
@@ -15167,9 +15185,9 @@ function Ai({
15167
15185
  {
15168
15186
  onClick: () => {
15169
15187
  var G;
15170
- Ke || (G = Jn.current) == null || G.click();
15188
+ qe || (G = Jn.current) == null || G.click();
15171
15189
  },
15172
- className: `cursor-pointer ${Ke ? "opacity-60 pointer-events-none" : ""}`,
15190
+ className: `cursor-pointer ${qe ? "opacity-60 pointer-events-none" : ""}`,
15173
15191
  children: [
15174
15192
  /* @__PURE__ */ u.jsx(wm, { className: "h-4 w-4 mr-2" }),
15175
15193
  " Upload Excel file"
@@ -15183,7 +15201,7 @@ function Ai({
15183
15201
  {
15184
15202
  initialValue: te,
15185
15203
  editingMessageId: M,
15186
- value: At,
15204
+ value: Et,
15187
15205
  onValueChange: ti,
15188
15206
  placeholder: M ? "Edit your message..." : t,
15189
15207
  isStreaming: F,
@@ -15229,7 +15247,7 @@ var rl = "ScrollArea", [Dp, vk] = Mn(rl), [PC, un] = Dp(rl), Lp = v.forwardRef(
15229
15247
  dir: o,
15230
15248
  scrollHideDelay: s = 600,
15231
15249
  ...i
15232
- } = e, [a, l] = v.useState(null), [c, d] = v.useState(null), [f, p] = v.useState(null), [h, m] = v.useState(null), [x, y] = v.useState(null), [g, w] = v.useState(0), [b, T] = v.useState(0), [C, S] = v.useState(!1), [k, N] = v.useState(!1), E = We(t, (P) => l(P)), I = Rs(o);
15250
+ } = e, [a, l] = v.useState(null), [c, d] = v.useState(null), [f, p] = v.useState(null), [h, m] = v.useState(null), [x, y] = v.useState(null), [g, w] = v.useState(0), [b, T] = v.useState(0), [C, S] = v.useState(!1), [k, N] = v.useState(!1), E = Ve(t, (P) => l(P)), I = Rs(o);
15233
15251
  return /* @__PURE__ */ u.jsx(
15234
15252
  PC,
15235
15253
  {
@@ -15274,7 +15292,7 @@ var rl = "ScrollArea", [Dp, vk] = Mn(rl), [PC, un] = Dp(rl), Lp = v.forwardRef(
15274
15292
  Lp.displayName = rl;
15275
15293
  var Fp = "ScrollAreaViewport", $p = v.forwardRef(
15276
15294
  (e, t) => {
15277
- const { __scopeScrollArea: n, children: r, nonce: o, ...s } = e, i = un(Fp, n), a = v.useRef(null), l = We(t, a, i.onViewportChange);
15295
+ const { __scopeScrollArea: n, children: r, nonce: o, ...s } = e, i = un(Fp, n), a = v.useRef(null), l = Ve(t, a, i.onViewportChange);
15278
15296
  return /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
15279
15297
  /* @__PURE__ */ u.jsx(
15280
15298
  "style",
@@ -15460,7 +15478,7 @@ var OC = v.forwardRef((e, t) => {
15460
15478
  }
15461
15479
  ) : null;
15462
15480
  }), DC = v.forwardRef((e, t) => {
15463
- const { sizes: n, onSizesChange: r, ...o } = e, s = un(In, e.__scopeScrollArea), [i, a] = v.useState(), l = v.useRef(null), c = We(t, l, s.onScrollbarXChange);
15481
+ const { sizes: n, onSizesChange: r, ...o } = e, s = un(In, e.__scopeScrollArea), [i, a] = v.useState(), l = v.useRef(null), c = Ve(t, l, s.onScrollbarXChange);
15464
15482
  return v.useEffect(() => {
15465
15483
  l.current && a(getComputedStyle(l.current));
15466
15484
  }, [l]), /* @__PURE__ */ u.jsx(
@@ -15499,7 +15517,7 @@ var OC = v.forwardRef((e, t) => {
15499
15517
  }
15500
15518
  );
15501
15519
  }), LC = v.forwardRef((e, t) => {
15502
- const { sizes: n, onSizesChange: r, ...o } = e, s = un(In, e.__scopeScrollArea), [i, a] = v.useState(), l = v.useRef(null), c = We(t, l, s.onScrollbarYChange);
15520
+ const { sizes: n, onSizesChange: r, ...o } = e, s = un(In, e.__scopeScrollArea), [i, a] = v.useState(), l = v.useRef(null), c = Ve(t, l, s.onScrollbarYChange);
15503
15521
  return v.useEffect(() => {
15504
15522
  l.current && a(getComputedStyle(l.current));
15505
15523
  }, [l]), /* @__PURE__ */ u.jsx(
@@ -15551,7 +15569,7 @@ var OC = v.forwardRef((e, t) => {
15551
15569
  onWheelScroll: d,
15552
15570
  onResize: f,
15553
15571
  ...p
15554
- } = e, h = un(In, n), [m, x] = v.useState(null), y = We(t, (E) => x(E)), g = v.useRef(null), w = v.useRef(""), b = h.viewport, T = r.content - r.viewport, C = Dt(d), S = Dt(l), k = Xs(f, 10);
15572
+ } = e, h = un(In, n), [m, x] = v.useState(null), y = Ve(t, (E) => x(E)), g = v.useRef(null), w = v.useRef(""), b = h.viewport, T = r.content - r.viewport, C = Dt(d), S = Dt(l), k = Xs(f, 10);
15555
15573
  function N(E) {
15556
15574
  if (g.current) {
15557
15575
  const I = E.clientX - g.current.left, P = E.clientY - g.current.top;
@@ -15599,7 +15617,7 @@ var OC = v.forwardRef((e, t) => {
15599
15617
  }
15600
15618
  ), $C = v.forwardRef(
15601
15619
  (e, t) => {
15602
- const { __scopeScrollArea: n, style: r, ...o } = e, s = un(hs, n), i = Bp(hs, n), { onThumbPositionChange: a } = i, l = We(
15620
+ const { __scopeScrollArea: n, style: r, ...o } = e, s = un(hs, n), i = Bp(hs, n), { onThumbPositionChange: a } = i, l = Ve(
15603
15621
  t,
15604
15622
  (f) => i.onThumbChange(f)
15605
15623
  ), c = v.useRef(void 0), d = Xs(() => {
@@ -15781,78 +15799,78 @@ function Kc({
15781
15799
  actions: x
15782
15800
  } = xa(), { loadThread: y } = ya(), { createThread: g, deleteThread: w, renameThread: b } = x, [T, C] = xe(Array.isArray(f) ? f : []), S = Qe(T.length > 0), k = Qe(null), N = Qe(0), [E, I] = xe(null), [P, L] = xe(""), [F, j] = xe(!1);
15783
15801
  kt(() => {
15784
- const K = Array.isArray(f) ? f : [];
15785
- if (K.length > 0) {
15786
- S.current = !0, C(K);
15802
+ const V = Array.isArray(f) ? f : [];
15803
+ if (V.length > 0) {
15804
+ S.current = !0, C(V);
15787
15805
  return;
15788
15806
  }
15789
- m || (S.current = !1, C(K));
15807
+ m || (S.current = !1, C(V));
15790
15808
  }, [f, m]), kt(() => {
15791
15809
  if (!k.current) return;
15792
- const K = k.current.querySelector(
15810
+ const V = k.current.querySelector(
15793
15811
  "[data-radix-scroll-area-viewport]"
15794
15812
  );
15795
- if (!K) return;
15813
+ if (!V) return;
15796
15814
  let ee = null, q = null;
15797
15815
  return ee = requestAnimationFrame(() => {
15798
15816
  q = requestAnimationFrame(() => {
15799
- K.scrollTop = N.current;
15817
+ V.scrollTop = N.current;
15800
15818
  });
15801
15819
  }), () => {
15802
15820
  ee !== null && cancelAnimationFrame(ee), q !== null && cancelAnimationFrame(q);
15803
15821
  };
15804
15822
  }, [T]);
15805
- const $ = async (K) => {
15823
+ const $ = async (V) => {
15806
15824
  try {
15807
- h(K), await y(K), a == null || a(K), l == null || l(K);
15825
+ h(V), await y(V), a == null || a(V), l == null || l(V);
15808
15826
  } catch (ee) {
15809
15827
  console.error("Failed to select thread:", ee);
15810
15828
  }
15811
15829
  }, A = async () => {
15812
15830
  try {
15813
15831
  j(!0);
15814
- const K = await g();
15815
- K && (c == null || c(K), a == null || a(K));
15816
- } catch (K) {
15817
- console.error("Failed to create thread:", K);
15832
+ const V = await g();
15833
+ V && (c == null || c(V), a == null || a(V));
15834
+ } catch (V) {
15835
+ console.error("Failed to create thread:", V);
15818
15836
  } finally {
15819
15837
  j(!1);
15820
15838
  }
15821
- }, B = async (K, ee) => {
15839
+ }, B = async (V, ee) => {
15822
15840
  if (ee.stopPropagation(), !!confirm("Delete this thread?")) {
15823
15841
  if (k.current) {
15824
15842
  const q = k.current.querySelector("[data-radix-scroll-area-viewport]");
15825
15843
  q && (N.current = q.scrollTop);
15826
15844
  }
15827
15845
  try {
15828
- await w(K), d == null || d(K);
15846
+ await w(V), d == null || d(V);
15829
15847
  } catch (q) {
15830
15848
  console.error("Failed to delete thread:", q);
15831
15849
  }
15832
15850
  }
15833
- }, D = (K, ee) => {
15834
- ee.stopPropagation(), I(K.threadId), L(K.title || `Thread ${K.threadId.slice(0, 8)}`);
15835
- }, O = async (K) => {
15851
+ }, D = (V, ee) => {
15852
+ ee.stopPropagation(), I(V.threadId), L(V.title || `Thread ${V.threadId.slice(0, 8)}`);
15853
+ }, O = async (V) => {
15836
15854
  if (P.trim())
15837
15855
  try {
15838
- await b(K, P.trim()), I(null), L("");
15856
+ await b(V, P.trim()), I(null), L("");
15839
15857
  } catch (ee) {
15840
15858
  console.error("Failed to update title:", ee);
15841
15859
  }
15842
15860
  }, J = () => {
15843
15861
  I(null), L("");
15844
- }, X = (K, ee) => {
15845
- K.key === "Enter" ? O(ee) : K.key === "Escape" && J();
15846
- }, pe = (K) => {
15847
- if (!K) return "";
15862
+ }, X = (V, ee) => {
15863
+ V.key === "Enter" ? O(ee) : V.key === "Escape" && J();
15864
+ }, pe = (V) => {
15865
+ if (!V) return "";
15848
15866
  try {
15849
- const ee = new Date(K), M = (/* @__PURE__ */ new Date()).getTime() - ee.getTime(), H = Math.floor(M / (1e3 * 60 * 60 * 24));
15867
+ const ee = new Date(V), M = (/* @__PURE__ */ new Date()).getTime() - ee.getTime(), H = Math.floor(M / (1e3 * 60 * 60 * 24));
15850
15868
  return H === 0 ? ee.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : H === 1 ? "Yesterday" : H < 7 ? `${H} days ago` : ee.toLocaleDateString();
15851
15869
  } catch {
15852
15870
  return "";
15853
15871
  }
15854
- }, Ie = (K) => K.title || `Thread ${K.threadId.slice(0, 8)}`, Ae = (K) => {
15855
- const ee = Ie(K);
15872
+ }, Ie = (V) => V.title || `Thread ${V.threadId.slice(0, 8)}`, Ae = (V) => {
15873
+ const ee = Ie(V);
15856
15874
  return ee.length <= Vc ? ee : `${ee.slice(0, Vc)}...`;
15857
15875
  };
15858
15876
  return /* @__PURE__ */ u.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
@@ -15880,32 +15898,32 @@ function Kc({
15880
15898
  ] }) : T.length === 0 ? /* @__PURE__ */ u.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
15881
15899
  /* @__PURE__ */ u.jsx(Sm, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
15882
15900
  /* @__PURE__ */ u.jsx("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
15883
- ] }) : T.slice().sort((K, ee) => new Date(ee.updatedAt || ee.createdAt || "").getTime() - new Date(K.updatedAt || K.createdAt || "").getTime()).map((K) => /* @__PURE__ */ u.jsxs(
15901
+ ] }) : T.slice().sort((V, ee) => new Date(ee.updatedAt || ee.createdAt || "").getTime() - new Date(V.updatedAt || V.createdAt || "").getTime()).map((V) => /* @__PURE__ */ u.jsxs(
15884
15902
  "div",
15885
15903
  {
15886
- onClick: () => $(K.threadId),
15887
- className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? p) === K.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
15904
+ onClick: () => $(V.threadId),
15905
+ className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? p) === V.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
15888
15906
  children: [
15889
15907
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center justify-between", children: [
15890
- /* @__PURE__ */ u.jsx("div", { className: "flex-1 min-w-0", children: E === K.threadId ? /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", onClick: (ee) => ee.stopPropagation(), children: [
15891
- /* @__PURE__ */ u.jsx(ps, { value: P, onChange: (ee) => L(ee.target.value), onKeyDown: (ee) => X(ee, K.threadId), className: "h-6 text-sm", autoFocus: !0 }),
15892
- /* @__PURE__ */ u.jsx(rt, { variant: "ghost", size: "sm", onClick: () => O(K.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(ca, { size: 12 }) }),
15908
+ /* @__PURE__ */ u.jsx("div", { className: "flex-1 min-w-0", children: E === V.threadId ? /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", onClick: (ee) => ee.stopPropagation(), children: [
15909
+ /* @__PURE__ */ u.jsx(ps, { value: P, onChange: (ee) => L(ee.target.value), onKeyDown: (ee) => X(ee, V.threadId), className: "h-6 text-sm", autoFocus: !0 }),
15910
+ /* @__PURE__ */ u.jsx(rt, { variant: "ghost", size: "sm", onClick: () => O(V.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(ca, { size: 12 }) }),
15893
15911
  /* @__PURE__ */ u.jsx(rt, { variant: "ghost", size: "sm", onClick: J, className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(vr, { size: 12 }) })
15894
15912
  ] }) : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
15895
- /* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: Ae(K) }),
15913
+ /* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: Ae(V) }),
15896
15914
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
15897
15915
  /* @__PURE__ */ u.jsx(Cm, { size: 10 }),
15898
- /* @__PURE__ */ u.jsx("span", { children: pe(K.updatedAt || K.createdAt) })
15916
+ /* @__PURE__ */ u.jsx("span", { children: pe(V.updatedAt || V.createdAt) })
15899
15917
  ] })
15900
15918
  ] }) }),
15901
15919
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
15902
- r && E !== K.threadId && /* @__PURE__ */ u.jsx(rt, { variant: "ghost", size: "sm", onClick: (ee) => D(K, ee), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ u.jsx(Jc, { size: 12 }) }),
15920
+ r && E !== V.threadId && /* @__PURE__ */ u.jsx(rt, { variant: "ghost", size: "sm", onClick: (ee) => D(V, ee), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ u.jsx(Jc, { size: 12 }) }),
15903
15921
  n && /* @__PURE__ */ u.jsx(
15904
15922
  rt,
15905
15923
  {
15906
15924
  variant: "ghost",
15907
15925
  size: "sm",
15908
- onClick: (ee) => B(K.threadId, ee),
15926
+ onClick: (ee) => B(V.threadId, ee),
15909
15927
  className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
15910
15928
  title: "Delete thread",
15911
15929
  children: /* @__PURE__ */ u.jsx(Tm, { size: 12 })
@@ -15913,10 +15931,10 @@ function Kc({
15913
15931
  )
15914
15932
  ] })
15915
15933
  ] }),
15916
- i === K.threadId && /* @__PURE__ */ u.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-blue-400 rounded-r" })
15934
+ i === V.threadId && /* @__PURE__ */ u.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-blue-400 rounded-r" })
15917
15935
  ]
15918
15936
  },
15919
- K.threadId
15937
+ V.threadId
15920
15938
  )) })
15921
15939
  }
15922
15940
  )
@@ -16065,7 +16083,7 @@ var Js = "Switch", [ZC, Sk] = Mn(Js), [QC, eT] = ZC(Js), oh = v.forwardRef(
16065
16083
  onCheckedChange: c,
16066
16084
  form: d,
16067
16085
  ...f
16068
- } = e, [p, h] = v.useState(null), m = We(t, (b) => h(b)), x = v.useRef(!1), y = p ? d || !!p.closest("form") : !0, [g, w] = Rr({
16086
+ } = e, [p, h] = v.useState(null), m = Ve(t, (b) => h(b)), x = v.useRef(!1), y = p ? d || !!p.closest("form") : !0, [g, w] = Rr({
16069
16087
  prop: o,
16070
16088
  defaultProp: s ?? !1,
16071
16089
  onChange: c,
@@ -16131,7 +16149,7 @@ var tT = "SwitchBubbleInput", ah = v.forwardRef(
16131
16149
  bubbles: r = !0,
16132
16150
  ...o
16133
16151
  }, s) => {
16134
- const i = v.useRef(null), a = We(i, s), l = rh(n), c = Xu(t);
16152
+ const i = v.useRef(null), a = Ve(i, s), l = rh(n), c = Xu(t);
16135
16153
  return v.useEffect(() => {
16136
16154
  const d = i.current;
16137
16155
  if (!d) return;
@@ -16304,7 +16322,7 @@ var sT = [" ", "Enter", "ArrowUp", "ArrowDown"], iT = [" ", "Enter"], cr = "Sele
16304
16322
  dh.displayName = cr;
16305
16323
  var fh = "SelectTrigger", ph = v.forwardRef(
16306
16324
  (e, t) => {
16307
- const { __scopeSelect: n, disabled: r = !1, ...o } = e, s = ei(n), i = Yn(fh, n), a = i.disabled || r, l = We(t, i.onTriggerChange), c = Qs(n), d = v.useRef("touch"), [f, p, h] = Lh((x) => {
16325
+ const { __scopeSelect: n, disabled: r = !1, ...o } = e, s = ei(n), i = Yn(fh, n), a = i.disabled || r, l = Ve(t, i.onTriggerChange), c = Qs(n), d = v.useRef("touch"), [f, p, h] = Lh((x) => {
16308
16326
  const y = c().filter((b) => !b.disabled), g = y.find((b) => b.value === i.value), w = Fh(y, x, g);
16309
16327
  w !== void 0 && i.onValueChange(w.value);
16310
16328
  }), m = (x) => {
@@ -16348,7 +16366,7 @@ var fh = "SelectTrigger", ph = v.forwardRef(
16348
16366
  ph.displayName = fh;
16349
16367
  var hh = "SelectValue", mh = v.forwardRef(
16350
16368
  (e, t) => {
16351
- const { __scopeSelect: n, className: r, style: o, children: s, placeholder: i = "", ...a } = e, l = Yn(hh, n), { onValueNodeHasChildrenChange: c } = l, d = s !== void 0, f = We(t, l.onValueNodeChange);
16369
+ const { __scopeSelect: n, className: r, style: o, children: s, placeholder: i = "", ...a } = e, l = Yn(hh, n), { onValueNodeHasChildrenChange: c } = l, d = s !== void 0, f = Ve(t, l.onValueNodeChange);
16352
16370
  return Lt(() => {
16353
16371
  c(d);
16354
16372
  }, [c, d]), /* @__PURE__ */ u.jsx(
@@ -16410,7 +16428,7 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
16410
16428
  avoidCollisions: y,
16411
16429
  //
16412
16430
  ...g
16413
- } = e, w = Yn(ur, n), [b, T] = v.useState(null), [C, S] = v.useState(null), k = We(t, (q) => T(q)), [N, E] = v.useState(null), [I, P] = v.useState(
16431
+ } = e, w = Yn(ur, n), [b, T] = v.useState(null), [C, S] = v.useState(null), k = Ve(t, (q) => T(q)), [N, E] = v.useState(null), [I, P] = v.useState(
16414
16432
  null
16415
16433
  ), L = Qs(n), [F, j] = v.useState(!1), $ = v.useRef(!1);
16416
16434
  v.useEffect(() => {
@@ -16468,7 +16486,7 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
16468
16486
  (w.value !== void 0 && w.value === M || te) && P(q);
16469
16487
  },
16470
16488
  [w.value]
16471
- ), K = r === "popper" ? na : bh, ee = K === na ? {
16489
+ ), V = r === "popper" ? na : bh, ee = V === na ? {
16472
16490
  side: a,
16473
16491
  sideOffset: l,
16474
16492
  align: c,
@@ -16518,7 +16536,7 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
16518
16536
  onFocusOutside: (q) => q.preventDefault(),
16519
16537
  onDismiss: () => w.onOpenChange(!1),
16520
16538
  children: /* @__PURE__ */ u.jsx(
16521
- K,
16539
+ V,
16522
16540
  {
16523
16541
  role: "listbox",
16524
16542
  id: w.contentId,
@@ -16560,7 +16578,7 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
16560
16578
  );
16561
16579
  wh.displayName = pT;
16562
16580
  var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
16563
- const { __scopeSelect: n, onPlaced: r, ...o } = e, s = Yn(ur, n), i = Xn(ur, n), [a, l] = v.useState(null), [c, d] = v.useState(null), f = We(t, (k) => d(k)), p = Qs(n), h = v.useRef(!1), m = v.useRef(!0), { viewport: x, selectedItem: y, selectedItemText: g, focusSelectedItem: w } = i, b = v.useCallback(() => {
16581
+ const { __scopeSelect: n, onPlaced: r, ...o } = e, s = Yn(ur, n), i = Xn(ur, n), [a, l] = v.useState(null), [c, d] = v.useState(null), f = Ve(t, (k) => d(k)), p = Qs(n), h = v.useRef(!1), m = v.useRef(!0), { viewport: x, selectedItem: y, selectedItemText: g, focusSelectedItem: w } = i, b = v.useCallback(() => {
16564
16582
  if (s.trigger && s.valueNode && a && c && x && y && g) {
16565
16583
  const k = s.trigger.getBoundingClientRect(), N = c.getBoundingClientRect(), E = s.valueNode.getBoundingClientRect(), I = g.getBoundingClientRect();
16566
16584
  if (s.dir !== "rtl") {
@@ -16581,12 +16599,12 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
16581
16599
  ]);
16582
16600
  a.style.minWidth = Z + "px", a.style.right = Ne + "px";
16583
16601
  }
16584
- const P = p(), L = window.innerHeight - dn * 2, F = x.scrollHeight, j = window.getComputedStyle(c), $ = parseInt(j.borderTopWidth, 10), A = parseInt(j.paddingTop, 10), B = parseInt(j.borderBottomWidth, 10), D = parseInt(j.paddingBottom, 10), O = $ + A + F + D + B, J = Math.min(y.offsetHeight * 5, O), X = window.getComputedStyle(x), pe = parseInt(X.paddingTop, 10), Ie = parseInt(X.paddingBottom, 10), Ae = k.top + k.height / 2 - dn, K = L - Ae, ee = y.offsetHeight / 2, q = y.offsetTop + ee, M = $ + A + q, H = O - M;
16602
+ const P = p(), L = window.innerHeight - dn * 2, F = x.scrollHeight, j = window.getComputedStyle(c), $ = parseInt(j.borderTopWidth, 10), A = parseInt(j.paddingTop, 10), B = parseInt(j.borderBottomWidth, 10), D = parseInt(j.paddingBottom, 10), O = $ + A + F + D + B, J = Math.min(y.offsetHeight * 5, O), X = window.getComputedStyle(x), pe = parseInt(X.paddingTop, 10), Ie = parseInt(X.paddingBottom, 10), Ae = k.top + k.height / 2 - dn, V = L - Ae, ee = y.offsetHeight / 2, q = y.offsetTop + ee, M = $ + A + q, H = O - M;
16585
16603
  if (M <= Ae) {
16586
16604
  const oe = P.length > 0 && y === P[P.length - 1].ref.current;
16587
16605
  a.style.bottom = "0px";
16588
16606
  const ne = c.clientHeight - x.offsetTop - x.offsetHeight, Te = Math.max(
16589
- K,
16607
+ V,
16590
16608
  ee + // viewport might have padding bottom, include it to avoid a scrollable viewport
16591
16609
  (oe ? Ie : 0) + ne + B
16592
16610
  ), Z = M + Te;
@@ -16695,7 +16713,7 @@ var gT = "SelectPopperPosition", na = v.forwardRef((e, t) => {
16695
16713
  na.displayName = gT;
16696
16714
  var [xT, al] = Mr(ur, {}), ra = "SelectViewport", Sh = v.forwardRef(
16697
16715
  (e, t) => {
16698
- const { __scopeSelect: n, nonce: r, ...o } = e, s = Xn(ra, n), i = al(ra, n), a = We(t, s.onViewportChange), l = v.useRef(0);
16716
+ const { __scopeSelect: n, nonce: r, ...o } = e, s = Xn(ra, n), i = al(ra, n), a = Ve(t, s.onViewportChange), l = v.useRef(0);
16699
16717
  return /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
16700
16718
  /* @__PURE__ */ u.jsx(
16701
16719
  "style",
@@ -16768,7 +16786,7 @@ var gs = "SelectItem", [bT, Rh] = Mr(gs), Eh = v.forwardRef(
16768
16786
  disabled: o = !1,
16769
16787
  textValue: s,
16770
16788
  ...i
16771
- } = e, a = Yn(gs, n), l = Xn(gs, n), c = a.value === r, [d, f] = v.useState(s ?? ""), [p, h] = v.useState(!1), m = We(
16789
+ } = e, a = Yn(gs, n), l = Xn(gs, n), c = a.value === r, [d, f] = v.useState(s ?? ""), [p, h] = v.useState(!1), m = Ve(
16772
16790
  t,
16773
16791
  (w) => {
16774
16792
  var b;
@@ -16846,7 +16864,7 @@ var gs = "SelectItem", [bT, Rh] = Mr(gs), Eh = v.forwardRef(
16846
16864
  Eh.displayName = gs;
16847
16865
  var Hr = "SelectItemText", Ih = v.forwardRef(
16848
16866
  (e, t) => {
16849
- const { __scopeSelect: n, className: r, style: o, ...s } = e, i = Yn(Hr, n), a = Xn(Hr, n), l = Rh(Hr, n), c = uT(Hr, n), [d, f] = v.useState(null), p = We(
16867
+ const { __scopeSelect: n, className: r, style: o, ...s } = e, i = Yn(Hr, n), a = Xn(Hr, n), l = Rh(Hr, n), c = uT(Hr, n), [d, f] = v.useState(null), p = Ve(
16850
16868
  t,
16851
16869
  (g) => f(g),
16852
16870
  l.onItemTextChange,
@@ -16873,7 +16891,7 @@ var Nh = "SelectItemIndicator", Ah = v.forwardRef(
16873
16891
  );
16874
16892
  Ah.displayName = Nh;
16875
16893
  var oa = "SelectScrollUpButton", jh = v.forwardRef((e, t) => {
16876
- const n = Xn(oa, e.__scopeSelect), r = al(oa, e.__scopeSelect), [o, s] = v.useState(!1), i = We(t, r.onScrollButtonChange);
16894
+ const n = Xn(oa, e.__scopeSelect), r = al(oa, e.__scopeSelect), [o, s] = v.useState(!1), i = Ve(t, r.onScrollButtonChange);
16877
16895
  return Lt(() => {
16878
16896
  if (n.viewport && n.isPositioned) {
16879
16897
  let a = function() {
@@ -16897,7 +16915,7 @@ var oa = "SelectScrollUpButton", jh = v.forwardRef((e, t) => {
16897
16915
  });
16898
16916
  jh.displayName = oa;
16899
16917
  var sa = "SelectScrollDownButton", _h = v.forwardRef((e, t) => {
16900
- const n = Xn(sa, e.__scopeSelect), r = al(sa, e.__scopeSelect), [o, s] = v.useState(!1), i = We(t, r.onScrollButtonChange);
16918
+ const n = Xn(sa, e.__scopeSelect), r = al(sa, e.__scopeSelect), [o, s] = v.useState(!1), i = Ve(t, r.onScrollButtonChange);
16901
16919
  return Lt(() => {
16902
16920
  if (n.viewport && n.isPositioned) {
16903
16921
  let a = function() {
@@ -16963,7 +16981,7 @@ var ia = "SelectArrow", CT = v.forwardRef(
16963
16981
  CT.displayName = ia;
16964
16982
  var TT = "SelectBubbleInput", Mh = v.forwardRef(
16965
16983
  ({ __scopeSelect: e, value: t, ...n }, r) => {
16966
- const o = v.useRef(null), s = We(r, o), i = rh(t);
16984
+ const o = v.useRef(null), s = Ve(r, o), i = rh(t);
16967
16985
  return v.useEffect(() => {
16968
16986
  const a = o.current;
16969
16987
  if (!a) return;