teodor-new-chat-ui 4.3.173 → 4.3.174

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 hg = Object.defineProperty;
2
2
  var pg = (e, t, n) => t in e ? hg(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var dc = (e, t, n) => pg(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as v from "react";
5
- import V, { createContext as Bo, useContext as Qs, useReducer as mg, useRef as be, useCallback as de, useEffect as bt, useMemo as ct, useState as we, startTransition as Qo, useLayoutEffect as gg, createElement as ps, useImperativeHandle as xg } from "react";
5
+ import V, { createContext as Bo, useContext as Qs, useReducer as mg, useRef as be, useCallback as fe, useEffect as St, useMemo as ct, useState as we, startTransition as Qo, useLayoutEffect as gg, createElement as ps, useImperativeHandle as xg } from "react";
6
6
  import { Square as yg, Send as vg, ChevronRight as nd, Check as el, Circle as wg, X as Xr, ExternalLink as bg, Download as Sg, Image as Cg, FileText as fc, Loader as tl, Bot as Bi, Wrench as Tg, User as kg, Paperclip as ya, ChevronUp as nl, ChevronDown as ei, ChevronLeft as Rg, Copy as hc, Edit as pc, RotateCcw as va, Info as Eg, Loader2 as ms, Edit3 as rd, Plus as Ig, FileSpreadsheet as Ng, MessageSquarePlus as Ag, MessageSquare as _g, Calendar as jg, Trash2 as Pg, Settings as Og, Server as Mg, EyeOff as Dg, Eye as Lg, Layout as Fg, MessageCircle as $g, Save as zg } from "lucide-react";
7
7
  import { Slot as Bg, createSlot as no } from "@radix-ui/react-slot";
8
8
  import { cva as ti } from "class-variance-authority";
@@ -57,16 +57,16 @@ function Vg() {
57
57
  var y = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
58
58
  function w(R) {
59
59
  {
60
- for (var K = arguments.length, fe = new Array(K > 1 ? K - 1 : 0), Ne = 1; Ne < K; Ne++)
61
- fe[Ne - 1] = arguments[Ne];
62
- S("error", R, fe);
60
+ for (var K = arguments.length, he = new Array(K > 1 ? K - 1 : 0), Ne = 1; Ne < K; Ne++)
61
+ he[Ne - 1] = arguments[Ne];
62
+ S("error", R, he);
63
63
  }
64
64
  }
65
- function S(R, K, fe) {
65
+ function S(R, K, he) {
66
66
  {
67
67
  var Ne = y.ReactDebugCurrentFrame, Ge = Ne.getStackAddendum();
68
- Ge !== "" && (K += "%s", fe = fe.concat([Ge]));
69
- var lt = fe.map(function(Ue) {
68
+ Ge !== "" && (K += "%s", he = he.concat([Ge]));
69
+ var lt = he.map(function(Ue) {
70
70
  return String(Ue);
71
71
  });
72
72
  lt.unshift("Warning: " + K), Function.prototype.apply.call(console[R], console, lt);
@@ -81,12 +81,12 @@ function Vg() {
81
81
  // with.
82
82
  R.$$typeof === N || R.getModuleId !== void 0));
83
83
  }
84
- function M(R, K, fe) {
84
+ function M(R, K, he) {
85
85
  var Ne = R.displayName;
86
86
  if (Ne)
87
87
  return Ne;
88
88
  var Ge = K.displayName || K.name || "";
89
- return Ge !== "" ? fe + "(" + Ge + ")" : fe;
89
+ return Ge !== "" ? he + "(" + Ge + ")" : he;
90
90
  }
91
91
  function $(R) {
92
92
  return R.displayName || "Context";
@@ -118,8 +118,8 @@ function Vg() {
118
118
  var K = R;
119
119
  return $(K) + ".Consumer";
120
120
  case i:
121
- var fe = R;
122
- return $(fe._context) + ".Provider";
121
+ var he = R;
122
+ return $(he._context) + ".Provider";
123
123
  case l:
124
124
  return M(R, R.render, "ForwardRef");
125
125
  case f:
@@ -136,14 +136,14 @@ function Vg() {
136
136
  }
137
137
  return null;
138
138
  }
139
- var P = Object.assign, B = 0, j, W, F, L, ne, Q, ge;
139
+ var P = Object.assign, B = 0, j, W, L, F, ne, Q, ge;
140
140
  function _e() {
141
141
  }
142
142
  _e.__reactDisabledLog = !0;
143
- function J() {
143
+ function Z() {
144
144
  {
145
145
  if (B === 0) {
146
- j = console.log, W = console.info, F = console.warn, L = console.error, ne = console.group, Q = console.groupCollapsed, ge = console.groupEnd;
146
+ j = console.log, W = console.info, L = console.warn, F = console.error, ne = console.group, Q = console.groupCollapsed, ge = console.groupEnd;
147
147
  var R = {
148
148
  configurable: !0,
149
149
  enumerable: !0,
@@ -163,7 +163,7 @@ function Vg() {
163
163
  B++;
164
164
  }
165
165
  }
166
- function ue() {
166
+ function de() {
167
167
  {
168
168
  if (B--, B === 0) {
169
169
  var R = {
@@ -179,10 +179,10 @@ function Vg() {
179
179
  value: W
180
180
  }),
181
181
  warn: P({}, R, {
182
- value: F
182
+ value: L
183
183
  }),
184
184
  error: P({}, R, {
185
- value: L
185
+ value: F
186
186
  }),
187
187
  group: P({}, R, {
188
188
  value: ne
@@ -199,7 +199,7 @@ function Vg() {
199
199
  }
200
200
  }
201
201
  var ke = y.ReactCurrentDispatcher, ee;
202
- function D(R, K, fe) {
202
+ function D(R, K, he) {
203
203
  {
204
204
  if (ee === void 0)
205
205
  try {
@@ -214,23 +214,23 @@ function Vg() {
214
214
  }
215
215
  var G = !1, ie;
216
216
  {
217
- var le = typeof WeakMap == "function" ? WeakMap : Map;
218
- ie = new le();
217
+ var ce = typeof WeakMap == "function" ? WeakMap : Map;
218
+ ie = new ce();
219
219
  }
220
220
  function H(R, K) {
221
221
  if (!R || G)
222
222
  return "";
223
223
  {
224
- var fe = ie.get(R);
225
- if (fe !== void 0)
226
- return fe;
224
+ var he = ie.get(R);
225
+ if (he !== void 0)
226
+ return he;
227
227
  }
228
228
  var Ne;
229
229
  G = !0;
230
230
  var Ge = Error.prepareStackTrace;
231
231
  Error.prepareStackTrace = void 0;
232
232
  var lt;
233
- lt = ke.current, ke.current = null, J();
233
+ lt = ke.current, ke.current = null, Z();
234
234
  try {
235
235
  if (K) {
236
236
  var Ue = function() {
@@ -267,35 +267,35 @@ function Vg() {
267
267
  if (Dt && Ne && typeof Dt.stack == "string") {
268
268
  for (var ze = Dt.stack.split(`
269
269
  `), Ot = Ne.stack.split(`
270
- `), yt = ze.length - 1, St = Ot.length - 1; yt >= 1 && St >= 0 && ze[yt] !== Ot[St]; )
271
- St--;
272
- for (; yt >= 1 && St >= 0; yt--, St--)
273
- if (ze[yt] !== Ot[St]) {
274
- if (yt !== 1 || St !== 1)
270
+ `), yt = ze.length - 1, vt = Ot.length - 1; yt >= 1 && vt >= 0 && ze[yt] !== Ot[vt]; )
271
+ vt--;
272
+ for (; yt >= 1 && vt >= 0; yt--, vt--)
273
+ if (ze[yt] !== Ot[vt]) {
274
+ if (yt !== 1 || vt !== 1)
275
275
  do
276
- if (yt--, St--, St < 0 || ze[yt] !== Ot[St]) {
276
+ if (yt--, vt--, vt < 0 || ze[yt] !== Ot[vt]) {
277
277
  var Mt = `
278
278
  ` + ze[yt].replace(" at new ", " at ");
279
279
  return R.displayName && Mt.includes("<anonymous>") && (Mt = Mt.replace("<anonymous>", R.displayName)), typeof R == "function" && ie.set(R, Mt), Mt;
280
280
  }
281
- while (yt >= 1 && St >= 0);
281
+ while (yt >= 1 && vt >= 0);
282
282
  break;
283
283
  }
284
284
  }
285
285
  } finally {
286
- G = !1, ke.current = lt, ue(), Error.prepareStackTrace = Ge;
286
+ G = !1, ke.current = lt, de(), Error.prepareStackTrace = Ge;
287
287
  }
288
288
  var Sn = R ? R.displayName || R.name : "", on = Sn ? D(Sn) : "";
289
289
  return typeof R == "function" && ie.set(R, on), on;
290
290
  }
291
- function We(R, K, fe) {
291
+ function We(R, K, he) {
292
292
  return H(R, !1);
293
293
  }
294
294
  function re(R) {
295
295
  var K = R.prototype;
296
296
  return !!(K && K.isReactComponent);
297
297
  }
298
- function ye(R, K, fe) {
298
+ function ye(R, K, he) {
299
299
  if (R == null)
300
300
  return "";
301
301
  if (typeof R == "function")
@@ -313,41 +313,41 @@ function Vg() {
313
313
  case l:
314
314
  return We(R.render);
315
315
  case f:
316
- return ye(R.type, K, fe);
316
+ return ye(R.type, K, he);
317
317
  case h: {
318
318
  var Ne = R, Ge = Ne._payload, lt = Ne._init;
319
319
  try {
320
- return ye(lt(Ge), K, fe);
320
+ return ye(lt(Ge), K, he);
321
321
  } catch {
322
322
  }
323
323
  }
324
324
  }
325
325
  return "";
326
326
  }
327
- var Pe = Object.prototype.hasOwnProperty, Fe = {}, rt = y.ReactDebugCurrentFrame;
327
+ var Oe = Object.prototype.hasOwnProperty, Fe = {}, rt = y.ReactDebugCurrentFrame;
328
328
  function Te(R) {
329
329
  if (R) {
330
- var K = R._owner, fe = ye(R.type, R._source, K ? K.type : null);
331
- rt.setExtraStackFrame(fe);
330
+ var K = R._owner, he = ye(R.type, R._source, K ? K.type : null);
331
+ rt.setExtraStackFrame(he);
332
332
  } else
333
333
  rt.setExtraStackFrame(null);
334
334
  }
335
- function Ye(R, K, fe, Ne, Ge) {
335
+ function Ye(R, K, he, Ne, Ge) {
336
336
  {
337
- var lt = Function.call.bind(Pe);
337
+ var lt = Function.call.bind(Oe);
338
338
  for (var Ue in R)
339
339
  if (lt(R, Ue)) {
340
340
  var ze = void 0;
341
341
  try {
342
342
  if (typeof R[Ue] != "function") {
343
- var Ot = Error((Ne || "React class") + ": " + fe + " type `" + Ue + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[Ue] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
343
+ var Ot = Error((Ne || "React class") + ": " + he + " type `" + Ue + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[Ue] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
344
344
  throw Ot.name = "Invariant Violation", Ot;
345
345
  }
346
- ze = R[Ue](K, Ue, Ne, fe, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
346
+ ze = R[Ue](K, Ue, Ne, he, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
347
  } catch (yt) {
348
348
  ze = yt;
349
349
  }
350
- ze && !(ze instanceof Error) && (Te(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).", Ne || "React class", fe, Ue, typeof ze), Te(null)), ze instanceof Error && !(ze.message in Fe) && (Fe[ze.message] = !0, Te(Ge), w("Failed %s type: %s", fe, ze.message), Te(null));
350
+ ze && !(ze instanceof Error) && (Te(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).", Ne || "React class", he, Ue, typeof ze), Te(null)), ze instanceof Error && !(ze.message in Fe) && (Fe[ze.message] = !0, Te(Ge), w("Failed %s type: %s", he, ze.message), Te(null));
351
351
  }
352
352
  }
353
353
  }
@@ -357,8 +357,8 @@ function Vg() {
357
357
  }
358
358
  function Xe(R) {
359
359
  {
360
- var K = typeof Symbol == "function" && Symbol.toStringTag, fe = K && R[Symbol.toStringTag] || R.constructor.name || "Object";
361
- return fe;
360
+ var K = typeof Symbol == "function" && Symbol.toStringTag, he = K && R[Symbol.toStringTag] || R.constructor.name || "Object";
361
+ return he;
362
362
  }
363
363
  }
364
364
  function qe(R) {
@@ -380,9 +380,9 @@ function Vg() {
380
380
  ref: !0,
381
381
  __self: !0,
382
382
  __source: !0
383
- }, vt, At;
383
+ }, wt, At;
384
384
  function st(R) {
385
- if (Pe.call(R, "ref")) {
385
+ if (Oe.call(R, "ref")) {
386
386
  var K = Object.getOwnPropertyDescriptor(R, "ref").get;
387
387
  if (K && K.isReactWarning)
388
388
  return !1;
@@ -390,7 +390,7 @@ function Vg() {
390
390
  return R.ref !== void 0;
391
391
  }
392
392
  function Jt(R) {
393
- if (Pe.call(R, "key")) {
393
+ if (Oe.call(R, "key")) {
394
394
  var K = Object.getOwnPropertyDescriptor(R, "key").get;
395
395
  if (K && K.isReactWarning)
396
396
  return !1;
@@ -402,34 +402,34 @@ function Vg() {
402
402
  }
403
403
  function Qt(R, K) {
404
404
  {
405
- var fe = function() {
406
- vt || (vt = !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));
405
+ var he = function() {
406
+ wt || (wt = !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
- fe.isReactWarning = !0, Object.defineProperty(R, "key", {
409
- get: fe,
408
+ he.isReactWarning = !0, Object.defineProperty(R, "key", {
409
+ get: he,
410
410
  configurable: !0
411
411
  });
412
412
  }
413
413
  }
414
414
  function en(R, K) {
415
415
  {
416
- var fe = function() {
416
+ var he = function() {
417
417
  At || (At = !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
- fe.isReactWarning = !0, Object.defineProperty(R, "ref", {
420
- get: fe,
419
+ he.isReactWarning = !0, Object.defineProperty(R, "ref", {
420
+ get: he,
421
421
  configurable: !0
422
422
  });
423
423
  }
424
424
  }
425
- var ft = function(R, K, fe, Ne, Ge, lt, Ue) {
425
+ var ft = function(R, K, he, Ne, Ge, lt, Ue) {
426
426
  var ze = {
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
431
  key: K,
432
- ref: fe,
432
+ ref: he,
433
433
  props: Ue,
434
434
  // Record the component responsible for creating this element.
435
435
  _owner: lt
@@ -451,20 +451,20 @@ function Vg() {
451
451
  value: Ge
452
452
  }), Object.freeze && (Object.freeze(ze.props), Object.freeze(ze)), ze;
453
453
  };
454
- function Ve(R, K, fe, Ne, Ge) {
454
+ function Ve(R, K, he, Ne, Ge) {
455
455
  {
456
456
  var lt, Ue = {}, ze = null, Ot = null;
457
- fe !== void 0 && (zt(fe), ze = "" + fe), Jt(K) && (zt(K.key), ze = "" + K.key), st(K) && (Ot = K.ref, Zt(K, Ge));
457
+ he !== void 0 && (zt(he), ze = "" + he), Jt(K) && (zt(K.key), ze = "" + K.key), st(K) && (Ot = K.ref, Zt(K, Ge));
458
458
  for (lt in K)
459
- Pe.call(K, lt) && !Qe.hasOwnProperty(lt) && (Ue[lt] = K[lt]);
459
+ Oe.call(K, lt) && !Qe.hasOwnProperty(lt) && (Ue[lt] = K[lt]);
460
460
  if (R && R.defaultProps) {
461
461
  var yt = R.defaultProps;
462
462
  for (lt in yt)
463
463
  Ue[lt] === void 0 && (Ue[lt] = yt[lt]);
464
464
  }
465
465
  if (ze || Ot) {
466
- var St = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
467
- ze && Qt(Ue, St), Ot && en(Ue, St);
466
+ var vt = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
467
+ ze && Qt(Ue, vt), Ot && en(Ue, vt);
468
468
  }
469
469
  return ft(R, ze, Ot, Ge, Ne, kt.current, Ue);
470
470
  }
@@ -472,8 +472,8 @@ function Vg() {
472
472
  var Bt = y.ReactCurrentOwner, Ft = y.ReactDebugCurrentFrame;
473
473
  function Y(R) {
474
474
  if (R) {
475
- var K = R._owner, fe = ye(R.type, R._source, K ? K.type : null);
476
- Ft.setExtraStackFrame(fe);
475
+ var K = R._owner, he = ye(R.type, R._source, K ? K.type : null);
476
+ Ft.setExtraStackFrame(he);
477
477
  } else
478
478
  Ft.setExtraStackFrame(null);
479
479
  }
@@ -498,14 +498,14 @@ Check the render method of \`` + R + "`.";
498
498
  return "";
499
499
  }
500
500
  var Pt = {};
501
- function Oe(R) {
501
+ function je(R) {
502
502
  {
503
503
  var K = gt();
504
504
  if (!K) {
505
- var fe = typeof R == "string" ? R : R.displayName || R.name;
506
- fe && (K = `
505
+ var he = typeof R == "string" ? R : R.displayName || R.name;
506
+ he && (K = `
507
507
 
508
- Check the top-level render call using <` + fe + ">.");
508
+ Check the top-level render call using <` + he + ">.");
509
509
  }
510
510
  return K;
511
511
  }
@@ -515,12 +515,12 @@ Check the top-level render call using <` + fe + ">.");
515
515
  if (!R._store || R._store.validated || R.key != null)
516
516
  return;
517
517
  R._store.validated = !0;
518
- var fe = Oe(K);
519
- if (Pt[fe])
518
+ var he = je(K);
519
+ if (Pt[he])
520
520
  return;
521
- Pt[fe] = !0;
521
+ Pt[he] = !0;
522
522
  var Ne = "";
523
- R && R._owner && R._owner !== Bt.current && (Ne = " It was passed a child from " + z(R._owner.type) + "."), Y(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.', fe, Ne), Y(null);
523
+ R && R._owner && R._owner !== Bt.current && (Ne = " It was passed a child from " + z(R._owner.type) + "."), Y(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.', he, Ne), Y(null);
524
524
  }
525
525
  }
526
526
  function at(R, K) {
@@ -528,8 +528,8 @@ Check the top-level render call using <` + fe + ">.");
528
528
  if (typeof R != "object")
529
529
  return;
530
530
  if (Je(R))
531
- for (var fe = 0; fe < R.length; fe++) {
532
- var Ne = R[fe];
531
+ for (var he = 0; he < R.length; he++) {
532
+ var Ne = R[he];
533
533
  ve(Ne) && Et(Ne, K);
534
534
  }
535
535
  else if (ve(R))
@@ -547,18 +547,18 @@ Check the top-level render call using <` + fe + ">.");
547
547
  var K = R.type;
548
548
  if (K == null || typeof K == "string")
549
549
  return;
550
- var fe;
550
+ var he;
551
551
  if (typeof K == "function")
552
- fe = K.propTypes;
552
+ he = K.propTypes;
553
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
555
  K.$$typeof === f))
556
- fe = K.propTypes;
556
+ he = K.propTypes;
557
557
  else
558
558
  return;
559
- if (fe) {
559
+ if (he) {
560
560
  var Ne = z(K);
561
- Ye(fe, R.props, "prop", Ne, R);
561
+ Ye(he, R.props, "prop", Ne, R);
562
562
  } else if (K.PropTypes !== void 0 && !Re) {
563
563
  Re = !0;
564
564
  var Ge = z(K);
@@ -569,8 +569,8 @@ Check the top-level render call using <` + fe + ">.");
569
569
  }
570
570
  function jn(R) {
571
571
  {
572
- for (var K = Object.keys(R.props), fe = 0; fe < K.length; fe++) {
573
- var Ne = K[fe];
572
+ for (var K = Object.keys(R.props), he = 0; he < K.length; he++) {
573
+ var Ne = K[he];
574
574
  if (Ne !== "children" && Ne !== "key") {
575
575
  Y(R), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", Ne), Y(null);
576
576
  break;
@@ -580,7 +580,7 @@ Check the top-level render call using <` + fe + ">.");
580
580
  }
581
581
  }
582
582
  var Kt = {};
583
- function Hn(R, K, fe, Ne, Ge, lt) {
583
+ function Hn(R, K, he, Ne, Ge, lt) {
584
584
  {
585
585
  var Ue = _(R);
586
586
  if (!Ue) {
@@ -591,9 +591,9 @@ Check the top-level render call using <` + fe + ">.");
591
591
  var yt;
592
592
  R === null ? yt = "null" : Je(R) ? yt = "array" : R !== void 0 && R.$$typeof === t ? (yt = "<" + (z(R.type) || "Unknown") + " />", ze = " Did you accidentally export a JSX literal instead of a component?") : yt = 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", yt, ze);
593
593
  }
594
- var St = Ve(R, K, fe, Ge, lt);
595
- if (St == null)
596
- return St;
594
+ var vt = Ve(R, K, he, Ge, lt);
595
+ if (vt == null)
596
+ return vt;
597
597
  if (Ue) {
598
598
  var Mt = K.children;
599
599
  if (Mt !== void 0)
@@ -607,28 +607,28 @@ Check the top-level render call using <` + fe + ">.");
607
607
  else
608
608
  at(Mt, R);
609
609
  }
610
- if (Pe.call(K, "key")) {
611
- var on = z(R), Dt = Object.keys(K).filter(function(ce) {
612
- return ce !== "key";
610
+ if (Oe.call(K, "key")) {
611
+ var on = z(R), Dt = Object.keys(K).filter(function(le) {
612
+ return le !== "key";
613
613
  }), Pn = Dt.length > 0 ? "{key: someKey, " + Dt.join(": ..., ") + ": ...}" : "{key: someKey}";
614
614
  if (!Kt[on + Pn]) {
615
- var Z = Dt.length > 0 ? "{" + Dt.join(": ..., ") + ": ...}" : "{}";
615
+ var X = Dt.length > 0 ? "{" + Dt.join(": ..., ") + ": ...}" : "{}";
616
616
  w(`A props object containing a "key" prop is being spread into JSX:
617
617
  let props = %s;
618
618
  <%s {...props} />
619
619
  React keys must be passed directly to JSX without using spread:
620
620
  let props = %s;
621
- <%s key={someKey} {...props} />`, Pn, on, Z, on), Kt[on + Pn] = !0;
621
+ <%s key={someKey} {...props} />`, Pn, on, X, on), Kt[on + Pn] = !0;
622
622
  }
623
623
  }
624
- return R === r ? jn(St) : _t(St), St;
624
+ return R === r ? jn(vt) : _t(vt), vt;
625
625
  }
626
626
  }
627
- function Cr(R, K, fe) {
628
- return Hn(R, K, fe, !0);
627
+ function Cr(R, K, he) {
628
+ return Hn(R, K, he, !0);
629
629
  }
630
- function qt(R, K, fe) {
631
- return Hn(R, K, fe, !1);
630
+ function qt(R, K, he) {
631
+ return Hn(R, K, he, !1);
632
632
  }
633
633
  var Un = qt, Vr = Cr;
634
634
  yo.Fragment = r, yo.jsx = Un, yo.jsxs = Vr;
@@ -1882,11 +1882,11 @@ const Cd = (e) => {
1882
1882
  duplex: "half"
1883
1883
  }), ge;
1884
1884
  if (O.isFormData(y) && (ge = Q.headers.get("content-type")) && A.setContentType(ge), Q.body) {
1885
- const [_e, J] = Sc(
1885
+ const [_e, Z] = Sc(
1886
1886
  B,
1887
1887
  _s(Cc(b))
1888
1888
  );
1889
- y = kc(Q.body, Rc, _e, J);
1889
+ y = kc(Q.body, Rc, _e, Z);
1890
1890
  }
1891
1891
  }
1892
1892
  O.isString(N) || (N = N ? "include" : "omit");
@@ -1900,32 +1900,32 @@ const Cd = (e) => {
1900
1900
  credentials: j ? N : void 0
1901
1901
  };
1902
1902
  z = s && new n(g, W);
1903
- let F = await (s ? M(z, _) : M(g, W));
1904
- const L = d && (k === "stream" || k === "response");
1905
- if (d && (C || L && P)) {
1903
+ let L = await (s ? M(z, _) : M(g, W));
1904
+ const F = d && (k === "stream" || k === "response");
1905
+ if (d && (C || F && P)) {
1906
1906
  const Q = {};
1907
- ["status", "statusText", "headers"].forEach((ue) => {
1908
- Q[ue] = F[ue];
1907
+ ["status", "statusText", "headers"].forEach((de) => {
1908
+ Q[de] = L[de];
1909
1909
  });
1910
- const ge = O.toFiniteNumber(F.headers.get("content-length")), [_e, J] = C && Sc(
1910
+ const ge = O.toFiniteNumber(L.headers.get("content-length")), [_e, Z] = C && Sc(
1911
1911
  ge,
1912
1912
  _s(Cc(C), !0)
1913
1913
  ) || [];
1914
- F = new r(
1915
- kc(F.body, Rc, _e, () => {
1916
- J && J(), P && P();
1914
+ L = new r(
1915
+ kc(L.body, Rc, _e, () => {
1916
+ Z && Z(), P && P();
1917
1917
  }),
1918
1918
  Q
1919
1919
  );
1920
1920
  }
1921
1921
  k = k || "text";
1922
- let ne = await f[O.findKey(f, k) || "text"](F, m);
1923
- return !L && P && P(), await new Promise((Q, ge) => {
1922
+ let ne = await f[O.findKey(f, k) || "text"](L, m);
1923
+ return !F && P && P(), await new Promise((Q, ge) => {
1924
1924
  bd(Q, ge, {
1925
1925
  data: ne,
1926
- headers: gn.from(F.headers),
1927
- status: F.status,
1928
- statusText: F.statusText,
1926
+ headers: gn.from(L.headers),
1927
+ status: L.status,
1928
+ statusText: L.statusText,
1929
1929
  config: m,
1930
1930
  request: z
1931
1931
  });
@@ -3011,16 +3011,16 @@ function qy(e, t) {
3011
3011
  }
3012
3012
  }
3013
3013
  function Gy(e = []) {
3014
- const [t, n] = mg(qy, { ...Ky, messages: e }), r = be([]), o = be(null), s = be(null), i = de(() => {
3014
+ const [t, n] = mg(qy, { ...Ky, messages: e }), r = be([]), o = be(null), s = be(null), i = fe(() => {
3015
3015
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), o.current = null, s.current = null;
3016
3016
  const d = r.current;
3017
3017
  d.length && (r.current = [], n({ type: "batch", payload: { events: d } }));
3018
- }, []), a = de(() => {
3018
+ }, []), a = fe(() => {
3019
3019
  typeof window < "u" && typeof window.requestAnimationFrame == "function" ? o.current === null && (o.current = window.requestAnimationFrame(() => i())) : s.current === null && (s.current = setTimeout(i, 8));
3020
- }, [i]), l = de((d) => {
3020
+ }, [i]), l = fe((d) => {
3021
3021
  r.current.push(d), a();
3022
3022
  }, [a]);
3023
- bt(() => () => {
3023
+ St(() => () => {
3024
3024
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
3025
3025
  }, []);
3026
3026
  const c = ct(() => ({
@@ -3357,24 +3357,24 @@ function Zy(e) {
3357
3357
  return t[t.length - 1] || null;
3358
3358
  }
3359
3359
  function Qy(e = {}) {
3360
- const t = ct(() => sr(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = we(e.token ?? null), s = be(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = we(!1), [c, d] = we(null), [f, h] = we(""), [p, m] = we(null), [g, x] = we(0), [y, w] = we(!1), S = be(null), T = be(!0), C = be(0), b = be(null), k = be(null), A = be(null), N = be(null), _ = de((P) => {
3360
+ const t = ct(() => sr(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = we(e.token ?? null), s = be(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = we(!1), [c, d] = we(null), [f, h] = we(""), [p, m] = we(null), [g, x] = we(0), [y, w] = we(!1), S = be(null), T = be(!0), C = be(0), b = be(null), k = be(null), A = be(null), N = be(null), _ = fe((P) => {
3361
3361
  o(P);
3362
- }, []), M = de(() => {
3362
+ }, []), M = fe(() => {
3363
3363
  h(""), m(null), d(null), k.current = null, A.current = null, N.current = null;
3364
- }, []), $ = de(() => {
3364
+ }, []), $ = fe(() => {
3365
3365
  var P;
3366
3366
  console.debug("[use-chat] stop() invoked - aborting stream"), (P = S.current) == null || P.abort(), S.current = null, b.current = null, l(!1), w(!1), C.current = 0, x(0);
3367
- }, []), z = de(
3367
+ }, []), z = fe(
3368
3368
  (P, B, j) => {
3369
3369
  S.current && (S.current.abort(), S.current = null), l(!0), d(null), e.autoAppendAssistant !== !1 && h(""), m(null), k.current = null, A.current = null, N.current = null;
3370
3370
  const W = new AbortController();
3371
3371
  S.current = W;
3372
- let F = null, L = null, ne = !1;
3372
+ let L = null, F = null, ne = !1;
3373
3373
  return b.current = {
3374
3374
  threadId: P.threadId ?? null,
3375
3375
  headers: {}
3376
3376
  }, (async () => {
3377
- var ge, _e, J, ue, ke, ee, D, G, ie, le, H, We, re, ye, Pe, Fe, rt, Te;
3377
+ var ge, _e, Z, de, ke, ee, D, G, ie, ce, H, We, re, ye, Oe, Fe, rt, Te;
3378
3378
  const Q = (Ye) => {
3379
3379
  var ot;
3380
3380
  try {
@@ -3397,7 +3397,7 @@ function Qy(e = {}) {
3397
3397
  let Ft = null;
3398
3398
  try {
3399
3399
  const Re = (_e = window.localStorage) == null ? void 0 : _e.getItem("chat-settings");
3400
- Re && (Ft = ((J = JSON.parse(Re)) == null ? void 0 : J.apiKey) || null);
3400
+ Re && (Ft = ((Z = JSON.parse(Re)) == null ? void 0 : Z.apiKey) || null);
3401
3401
  } catch {
3402
3402
  }
3403
3403
  const Y = Ve || Bt || Ft || null;
@@ -3413,7 +3413,7 @@ function Qy(e = {}) {
3413
3413
  let ot = {};
3414
3414
  if (typeof window < "u")
3415
3415
  try {
3416
- const ft = (ue = window.localStorage) == null ? void 0 : ue.getItem("authSessionId");
3416
+ const ft = (de = window.localStorage) == null ? void 0 : de.getItem("authSessionId");
3417
3417
  ft && (ot = { "X-Session-Id": ft });
3418
3418
  } catch {
3419
3419
  }
@@ -3440,13 +3440,13 @@ function Qy(e = {}) {
3440
3440
  ft == null ? void 0 : ft.slice(0, 500)
3441
3441
  );
3442
3442
  const Ve = `stream ${qe.status}${ft ? ": " + ft : ""}`;
3443
- throw (ke = j == null ? void 0 : j.onConnectionError) == null || ke.call(j, Ve), ne = !0, F = "error", L = Ve, new Error(Ve);
3443
+ throw (ke = j == null ? void 0 : j.onConnectionError) == null || ke.call(j, Ve), ne = !0, L = "error", F = Ve, new Error(Ve);
3444
3444
  }
3445
3445
  w(!0);
3446
3446
  const Ze = qe.body.getReader(), zt = new TextDecoder();
3447
3447
  let kt = "", Qe = [];
3448
3448
  C.current = 0, x(0);
3449
- let vt = 0, At = null;
3449
+ let wt = 0, At = null;
3450
3450
  const st = () => {
3451
3451
  if (Qe.length) {
3452
3452
  const ft = Qe.join("");
@@ -3461,7 +3461,7 @@ function Qy(e = {}) {
3461
3461
  var ft;
3462
3462
  if (Date.now() - Zt > 18e5) {
3463
3463
  const Ve = "Stream idle timeout";
3464
- d(Ve), F = "error", L = Ve, W.abort(), (ft = j == null ? void 0 : j.onError) == null || ft.call(j, Ve);
3464
+ d(Ve), L = "error", F = Ve, W.abort(), (ft = j == null ? void 0 : j.onError) == null || ft.call(j, Ve);
3465
3465
  }
3466
3466
  }, 5e3), en = 1024 * 1024;
3467
3467
  try {
@@ -3488,60 +3488,60 @@ function Qy(e = {}) {
3488
3488
  console.debug("[use-chat] malformed SSE:", xt.slice(0, 200));
3489
3489
  continue;
3490
3490
  }
3491
- const Oe = ev(Pt) ? Pt.data : Pt;
3491
+ const je = ev(Pt) ? Pt.data : Pt;
3492
3492
  Zt = Date.now();
3493
- const Et = Oe.seq;
3493
+ const Et = je.seq;
3494
3494
  if (Et !== void 0) {
3495
- if (Et <= vt) {
3496
- console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Et, lastProcessedSeq: vt, type: Oe.type });
3495
+ if (Et <= wt) {
3496
+ console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Et, lastProcessedSeq: wt, type: je.type });
3497
3497
  continue;
3498
3498
  }
3499
- vt > 0 && Et > vt + 1 && ((D = j == null ? void 0 : j.onGap) == null || D.call(j, { from: vt, to: Et })), vt = Et, C.current = Et, x(Et);
3499
+ wt > 0 && Et > wt + 1 && ((D = j == null ? void 0 : j.onGap) == null || D.call(j, { from: wt, to: Et })), wt = Et, C.current = Et, x(Et);
3500
3500
  }
3501
3501
  if (console.debug("[use-chat] received event", {
3502
- seq: Oe.seq,
3503
- type: Oe.type,
3502
+ seq: je.seq,
3503
+ type: je.type,
3504
3504
  preview: (() => {
3505
3505
  var at;
3506
3506
  try {
3507
- return Oe.type === "message_delta" ? { deltaTypes: (at = Oe.delta) == null ? void 0 : at.map((_t) => _t.type), textLen: (Oe.delta || []).filter((_t) => _t.type === "text").map((_t) => String(_t.text || "").length) } : Oe.content || Oe.delta ? { hasContent: !0 } : {};
3507
+ return je.type === "message_delta" ? { deltaTypes: (at = je.delta) == null ? void 0 : at.map((_t) => _t.type), textLen: (je.delta || []).filter((_t) => _t.type === "text").map((_t) => String(_t.text || "").length) } : je.content || je.delta ? { hasContent: !0 } : {};
3508
3508
  } catch (_t) {
3509
3509
  return { err: String(_t) };
3510
3510
  }
3511
3511
  })()
3512
- }), Oe.type === "checkpoint")
3513
- k.current = Oe.checkpointId ?? null, A.current = Oe.checkpointNs ?? null, m(Oe.checkpointId ?? null);
3514
- else if (Oe.type === "state_history") {
3515
- N.current = Oe;
3512
+ }), je.type === "checkpoint")
3513
+ k.current = je.checkpointId ?? null, A.current = je.checkpointNs ?? null, m(je.checkpointId ?? null);
3514
+ else if (je.type === "state_history") {
3515
+ N.current = je;
3516
3516
  try {
3517
- const _t = Ps(Oe).latest;
3517
+ const _t = Ps(je).latest;
3518
3518
  _t && (k.current = _t.checkpointId ?? null, A.current = _t.checkpointNs ?? null, m(_t.checkpointId ?? null));
3519
3519
  } catch (at) {
3520
3520
  console.warn("[use-chat] Failed to hydrate state_history payload", at);
3521
3521
  }
3522
3522
  }
3523
3523
  try {
3524
- B == null || B(Oe);
3524
+ B == null || B(je);
3525
3525
  } catch (at) {
3526
- console.error("[use-chat] Error in onEvent callback:", at, "for event:", Oe.type);
3526
+ console.error("[use-chat] Error in onEvent callback:", at, "for event:", je.type);
3527
3527
  }
3528
- if (Oe.type === "token" && e.autoAppendAssistant !== !1)
3529
- Qe.push(Oe.content), Jt();
3530
- else if (Oe.type === "message_delta") {
3531
- const at = Oe.delta.filter((_t) => _t.type === "text").map((_t) => _t.text).join("");
3528
+ if (je.type === "token" && e.autoAppendAssistant !== !1)
3529
+ Qe.push(je.content), Jt();
3530
+ else if (je.type === "message_delta") {
3531
+ const at = je.delta.filter((_t) => _t.type === "text").map((_t) => _t.text).join("");
3532
3532
  at && e.autoAppendAssistant !== !1 && (Qe.push(at), Jt());
3533
- } else if (Oe.type === "heartbeat") {
3533
+ } else if (je.type === "heartbeat") {
3534
3534
  console.debug("[use-chat] heartbeat received");
3535
3535
  try {
3536
- (G = j == null ? void 0 : j.onHeartbeat) == null || G.call(j, Oe);
3536
+ (G = j == null ? void 0 : j.onHeartbeat) == null || G.call(j, je);
3537
3537
  } catch (at) {
3538
3538
  console.warn("[use-chat] heartbeat callback failed", at);
3539
3539
  }
3540
- } else if (At !== null && cancelAnimationFrame(At), st(), Oe.type === "checkpoint")
3541
- m(Oe.checkpointId);
3542
- else if (Oe.type === "error") {
3543
- const at = Oe;
3544
- if (d(at.message), F = "error", L = at.message, at.error_type === "auth_error" || at.code === "TOKEN_EXPIRED" || ((ie = at.message) == null ? void 0 : ie.includes("token")) || ((le = at.message) == null ? void 0 : le.includes("401")) || ((H = at.message) == null ? void 0 : H.includes("unauthorized")) || ((We = at.message) == null ? void 0 : We.includes("Unauthorized"))) {
3540
+ } else if (At !== null && cancelAnimationFrame(At), st(), je.type === "checkpoint")
3541
+ m(je.checkpointId);
3542
+ else if (je.type === "error") {
3543
+ const at = je;
3544
+ if (d(at.message), L = "error", F = at.message, at.error_type === "auth_error" || at.code === "TOKEN_EXPIRED" || ((ie = at.message) == null ? void 0 : ie.includes("token")) || ((ce = at.message) == null ? void 0 : ce.includes("401")) || ((H = at.message) == null ? void 0 : H.includes("unauthorized")) || ((We = at.message) == null ? void 0 : We.includes("Unauthorized"))) {
3545
3545
  console.error("[use-chat] Auth error detected:", at.message);
3546
3546
  try {
3547
3547
  (re = j == null ? void 0 : j.onAuthError) == null || re.call(j, at.message);
@@ -3553,32 +3553,32 @@ function Qy(e = {}) {
3553
3553
  }
3554
3554
  }
3555
3555
  }
3556
- st(), F === null && !W.signal.aborted && (F = "complete");
3556
+ st(), L === null && !W.signal.aborted && (L = "complete");
3557
3557
  } catch (ft) {
3558
3558
  if (ft.name === "AbortError")
3559
- F = F ?? "aborted";
3559
+ L = L ?? "aborted";
3560
3560
  else {
3561
3561
  const Ve = ft.message || String(ft);
3562
- F = "error", L = Ve, d(Ve), (ye = j == null ? void 0 : j.onError) == null || ye.call(j, Ve);
3562
+ L = "error", F = Ve, d(Ve), (ye = j == null ? void 0 : j.onError) == null || ye.call(j, Ve);
3563
3563
  }
3564
3564
  } finally {
3565
3565
  try {
3566
3566
  await Ze.cancel();
3567
3567
  } catch {
3568
3568
  } finally {
3569
- (Pe = Ze.releaseLock) == null || Pe.call(Ze);
3569
+ (Oe = Ze.releaseLock) == null || Oe.call(Ze);
3570
3570
  }
3571
3571
  At !== null && typeof window < "u" && window.cancelAnimationFrame(At), clearInterval(Qt);
3572
3572
  }
3573
3573
  } catch (Ye) {
3574
3574
  if (Ye.name === "AbortError")
3575
- F = F ?? "aborted";
3575
+ L = L ?? "aborted";
3576
3576
  else {
3577
3577
  const ot = Ye.message || String(Ye);
3578
- F = "error", L = ot, d(ot), (Fe = j == null ? void 0 : j.onError) == null || Fe.call(j, ot), ne || ((rt = j == null ? void 0 : j.onConnectionError) == null || rt.call(j, ot), ne = !0);
3578
+ L = "error", F = ot, d(ot), (Fe = j == null ? void 0 : j.onError) == null || Fe.call(j, ot), ne || ((rt = j == null ? void 0 : j.onConnectionError) == null || rt.call(j, ot), ne = !0);
3579
3579
  }
3580
3580
  } finally {
3581
- const Ye = C.current, ot = k.current, Je = A.current, Xe = N.current, qe = F ?? (W.signal.aborted ? "aborted" : L ? "error" : "complete");
3581
+ const Ye = C.current, ot = k.current, Je = A.current, Xe = N.current, qe = L ?? (W.signal.aborted ? "aborted" : F ? "error" : "complete");
3582
3582
  try {
3583
3583
  (Te = j == null ? void 0 : j.onClosed) == null || Te.call(j, {
3584
3584
  reason: qe,
@@ -3586,7 +3586,7 @@ function Qy(e = {}) {
3586
3586
  lastCheckpointId: ot,
3587
3587
  lastCheckpointNs: Je,
3588
3588
  lastStateHistory: Xe,
3589
- error: L
3589
+ error: F
3590
3590
  });
3591
3591
  } catch (Ze) {
3592
3592
  console.warn("[use-chat] onClosed callback failed", Ze);
@@ -3597,7 +3597,7 @@ function Qy(e = {}) {
3597
3597
  },
3598
3598
  [t, n, r, e.autoAppendAssistant]
3599
3599
  );
3600
- return bt(() => () => {
3600
+ return St(() => () => {
3601
3601
  var P;
3602
3602
  T.current = !1, (P = S.current) == null || P.abort();
3603
3603
  }, []), {
@@ -3638,7 +3638,7 @@ function nv({
3638
3638
  onAuthError: a,
3639
3639
  onHeartbeat: l
3640
3640
  }) {
3641
- const c = be(null), d = be(null), f = be(/* @__PURE__ */ new Map()), h = be(null), p = de((N) => {
3641
+ const c = be(null), d = be(null), f = be(/* @__PURE__ */ new Map()), h = be(null), p = fe((N) => {
3642
3642
  try {
3643
3643
  const _ = globalThis.structuredClone;
3644
3644
  if (typeof _ == "function")
@@ -3650,16 +3650,16 @@ function nv({
3650
3650
  } catch {
3651
3651
  return N;
3652
3652
  }
3653
- }, []), m = de(
3653
+ }, []), m = fe(
3654
3654
  (N, _) => {
3655
3655
  if (!N) return;
3656
3656
  const M = f.current.get(N) ?? [], $ = p(_), z = M.length >= Uc ? [...M.slice(M.length - Uc + 1), $] : [...M, $];
3657
3657
  f.current.set(N, z);
3658
3658
  },
3659
3659
  [p]
3660
- ), g = de((N) => {
3660
+ ), g = fe((N) => {
3661
3661
  N && f.current.set(N, []);
3662
- }, []), x = de(
3662
+ }, []), x = fe(
3663
3663
  (N) => {
3664
3664
  const _ = N ?? d.current;
3665
3665
  if (!_) return;
@@ -3673,7 +3673,7 @@ function nv({
3673
3673
  });
3674
3674
  },
3675
3675
  [n]
3676
- ), y = de(
3676
+ ), y = fe(
3677
3677
  (N) => {
3678
3678
  var $, z, P, B, j;
3679
3679
  const _ = N.seq ?? null;
@@ -3709,8 +3709,8 @@ function nv({
3709
3709
  console.error("[useChatStreamingService] Auth error event detected:", W.message);
3710
3710
  try {
3711
3711
  a == null || a(W.message);
3712
- } catch (L) {
3713
- console.warn("[useChatStreamingService] onAuthError handler failed", L);
3712
+ } catch (F) {
3713
+ console.warn("[useChatStreamingService] onAuthError handler failed", F);
3714
3714
  }
3715
3715
  }
3716
3716
  }
@@ -3734,7 +3734,7 @@ function nv({
3734
3734
  ), { stream: w, stop: S, isStreaming: T, error: C, setToken: b } = Qy({
3735
3735
  baseUrl: e,
3736
3736
  token: void 0
3737
- }), k = de(
3737
+ }), k = fe(
3738
3738
  (N, _) => {
3739
3739
  c.current = null, d.current = N.threadId ?? null, h.current = {
3740
3740
  request: N,
@@ -3773,7 +3773,7 @@ function nv({
3773
3773
  }
3774
3774
  },
3775
3775
  onClosed: (M) => {
3776
- var B, j, W, F;
3776
+ var B, j, W, L;
3777
3777
  const $ = ((B = h.current) == null ? void 0 : B.manualStop) ?? !1, z = d.current ?? ((j = h.current) == null ? void 0 : j.threadIdGuess) ?? ((W = M.lastStateHistory) == null ? void 0 : W.threadId) ?? null;
3778
3778
  (M.reason === "complete" || M.reason === "aborted" && $) && g(z);
3779
3779
  const P = {
@@ -3783,13 +3783,13 @@ function nv({
3783
3783
  };
3784
3784
  try {
3785
3785
  s == null || s(P);
3786
- } catch (L) {
3787
- console.warn("[useChatStreamingService] onStreamClosed handler failed", L);
3786
+ } catch (F) {
3787
+ console.warn("[useChatStreamingService] onStreamClosed handler failed", F);
3788
3788
  }
3789
3789
  try {
3790
- (F = _ == null ? void 0 : _.onClosed) == null || F.call(_, P);
3791
- } catch (L) {
3792
- console.warn("[useChatStreamingService] downstream onClosed handler failed", L);
3790
+ (L = _ == null ? void 0 : _.onClosed) == null || L.call(_, P);
3791
+ } catch (F) {
3792
+ console.warn("[useChatStreamingService] downstream onClosed handler failed", F);
3793
3793
  }
3794
3794
  h.current && (h.current = null);
3795
3795
  }
@@ -3806,7 +3806,7 @@ function nv({
3806
3806
  s,
3807
3807
  w
3808
3808
  ]
3809
- ), A = de(() => {
3809
+ ), A = fe(() => {
3810
3810
  h.current && (h.current.manualStop = !0), S();
3811
3811
  }, [S]);
3812
3812
  return ct(
@@ -4078,7 +4078,7 @@ function Zi(e) {
4078
4078
  return e.order.map((t) => e.byId[t]).filter(Boolean);
4079
4079
  }
4080
4080
  function Cv({ currentThreadId: e, currentThreadIdRef: t }) {
4081
- const [n, r] = we([]), o = be(/* @__PURE__ */ new Map()), s = be(/* @__PURE__ */ new Map()), i = de((m) => {
4081
+ const [n, r] = we([]), o = be(/* @__PURE__ */ new Map()), s = be(/* @__PURE__ */ new Map()), i = fe((m) => {
4082
4082
  if (!m) {
4083
4083
  r([]);
4084
4084
  return;
@@ -4092,10 +4092,10 @@ function Cv({ currentThreadId: e, currentThreadIdRef: t }) {
4092
4092
  g.map((x) => hn(x, { cloneMessages: !0 }))
4093
4093
  );
4094
4094
  }, []);
4095
- bt(() => {
4095
+ St(() => {
4096
4096
  i(e);
4097
4097
  }, [e, i]);
4098
- const a = de(
4098
+ const a = fe(
4099
4099
  (m, g, x) => {
4100
4100
  if (!m) return;
4101
4101
  const y = x === "replace" ? [] : o.current.get(m) ?? [], w = x === "replace" ? g : [...g, ...y];
@@ -4121,7 +4121,7 @@ function Cv({ currentThreadId: e, currentThreadIdRef: t }) {
4121
4121
  o.current.set(m, T), m === t.current && i(m);
4122
4122
  },
4123
4123
  [t, i]
4124
- ), l = de(
4124
+ ), l = fe(
4125
4125
  (m, g, x) => {
4126
4126
  if (!m) return;
4127
4127
  const y = s.current.get(m), w = x === "replace" || !y ? /* @__PURE__ */ new Map() : new Map(y);
@@ -4134,7 +4134,7 @@ function Cv({ currentThreadId: e, currentThreadIdRef: t }) {
4134
4134
  s.current.set(m, w);
4135
4135
  },
4136
4136
  []
4137
- ), c = de(
4137
+ ), c = fe(
4138
4138
  (m, g) => {
4139
4139
  if (!m) return !1;
4140
4140
  const x = Ld(g);
@@ -4157,17 +4157,17 @@ function Cv({ currentThreadId: e, currentThreadIdRef: t }) {
4157
4157
  ), !0;
4158
4158
  },
4159
4159
  [t]
4160
- ), d = de(
4160
+ ), d = fe(
4161
4161
  (m) => {
4162
4162
  m && (o.current.delete(m), s.current.delete(m), m === t.current && r([]));
4163
4163
  },
4164
4164
  [t]
4165
- ), f = de(() => {
4165
+ ), f = fe(() => {
4166
4166
  r([]);
4167
- }, []), h = de(
4167
+ }, []), h = fe(
4168
4168
  (m) => m ? s.current.get(m) ?? null : null,
4169
4169
  []
4170
- ), p = de(
4170
+ ), p = fe(
4171
4171
  (m, g) => {
4172
4172
  var x;
4173
4173
  if (m)
@@ -4208,20 +4208,20 @@ function kv({
4208
4208
  }, [d]), p = ct(
4209
4209
  () => `threadPayload:${vv}:${h}:`,
4210
4210
  [h]
4211
- ), m = de(
4211
+ ), m = fe(
4212
4212
  (E) => dv(p, E),
4213
4213
  [p]
4214
- ), g = de(
4214
+ ), g = fe(
4215
4215
  (E, I = 100) => {
4216
4216
  fv(p, E, I);
4217
4217
  },
4218
4218
  [p]
4219
- ), x = de(
4219
+ ), x = fe(
4220
4220
  (E) => {
4221
4221
  hv(p, E);
4222
4222
  },
4223
4223
  [p]
4224
- ), y = de(() => {
4224
+ ), y = fe(() => {
4225
4225
  pv(p);
4226
4226
  }, [p]), [w, S] = we(
4227
4227
  () => {
@@ -4234,24 +4234,24 @@ function kv({
4234
4234
  Xi(h, (I = c.getAuthToken) == null ? void 0 : I.call(c))
4235
4235
  );
4236
4236
  return rs(E);
4237
- }), b = ct(() => Zi(T), [T]), [k, A] = we(t), [N, _] = we(!1), [M, $] = we(!1), [z, P] = we(null), [B, j] = we(null), [W, F] = we(null), L = de(() => {
4237
+ }), b = ct(() => Zi(T), [T]), [k, A] = we(t), [N, _] = we(!1), [M, $] = we(!1), [z, P] = we(null), [B, j] = we(null), [W, L] = we(null), F = fe(() => {
4238
4238
  const E = Ji(w);
4239
4239
  Qo(() => {
4240
4240
  C(rs(E));
4241
4241
  });
4242
- }, [w]), [ne, Q] = we(!1), [ge, _e] = we(!1), [J, ue] = we(null), [ke, ee] = we(void 0), [D, G] = we(void 0), [ie, le] = we(void 0), {
4242
+ }, [w]), [ne, Q] = we(!1), [ge, _e] = we(!1), [Z, de] = we(null), [ke, ee] = we(void 0), [D, G] = we(void 0), [ie, ce] = we(void 0), {
4243
4243
  state: H,
4244
4244
  dispatch: We,
4245
4245
  seed: re,
4246
4246
  prepend: ye,
4247
- pushUser: Pe,
4247
+ pushUser: Oe,
4248
4248
  onEvent: Fe,
4249
4249
  reset: rt
4250
4250
  } = Gy(), Te = be(k);
4251
- bt(() => {
4251
+ St(() => {
4252
4252
  Te.current = k;
4253
4253
  }, [k]);
4254
- const Ye = be(!1), ot = be([]), Je = be(null), Xe = be(null), qe = be(/* @__PURE__ */ new Map()), Ze = be(k), zt = be(!1), kt = be(null), Qe = be(/* @__PURE__ */ new Map()), vt = be(/* @__PURE__ */ new Map()), {
4254
+ const Ye = be(!1), ot = be([]), Je = be(null), Xe = be(null), qe = be(/* @__PURE__ */ new Map()), Ze = be(k), zt = be(!1), kt = be(null), Qe = be(/* @__PURE__ */ new Map()), wt = be(/* @__PURE__ */ new Map()), {
4255
4255
  threadCheckpoints: At,
4256
4256
  syncActiveThreadCheckpoints: st,
4257
4257
  updateCheckpointCache: Jt,
@@ -4261,16 +4261,16 @@ function kv({
4261
4261
  resetThreadCheckpoints: ft,
4262
4262
  getSnapshotCache: Ve,
4263
4263
  getSnapshotFromCache: Bt
4264
- } = Cv({ currentThreadId: k, currentThreadIdRef: Te }), Ft = de(() => {
4264
+ } = Cv({ currentThreadId: k, currentThreadIdRef: Te }), Ft = fe(() => {
4265
4265
  var q;
4266
- const E = vt.current;
4266
+ const E = wt.current;
4267
4267
  if (E.size <= Wc) return;
4268
4268
  const I = Array.from(E.entries()).sort((se, ae) => se[1].timestamp - ae[1].timestamp), U = E.size - Wc;
4269
4269
  for (let se = 0; se < U; se++) {
4270
4270
  const ae = (q = I[se]) == null ? void 0 : q[0];
4271
4271
  ae && E.delete(ae);
4272
4272
  }
4273
- }, []), Y = de(
4273
+ }, []), Y = fe(
4274
4274
  (E, I) => {
4275
4275
  if (!E)
4276
4276
  return null;
@@ -4282,16 +4282,16 @@ function kv({
4282
4282
  };
4283
4283
  },
4284
4284
  []
4285
- ), Re = de(
4285
+ ), Re = fe(
4286
4286
  (E, I) => {
4287
4287
  const { threadId: U, checkpointId: q = null, checkpointNs: se = null } = E, ae = qc(U, q, se);
4288
4288
  if (I != null && I.force)
4289
- Qe.current.delete(ae), vt.current.delete(ae);
4289
+ Qe.current.delete(ae), wt.current.delete(ae);
4290
4290
  else {
4291
4291
  if (I != null && I.preferCache) {
4292
- const wt = vt.current.get(ae);
4293
- if (wt)
4294
- return Promise.resolve(wt.result);
4292
+ const bt = wt.current.get(ae);
4293
+ if (bt)
4294
+ return Promise.resolve(bt.result);
4295
4295
  }
4296
4296
  const Me = Qe.current.get(ae);
4297
4297
  if (Me)
@@ -4303,13 +4303,13 @@ function kv({
4303
4303
  threadId: U,
4304
4304
  checkpointId: q ?? void 0,
4305
4305
  checkpointNs: se ?? void 0
4306
- }), wt = Y(Me, U);
4307
- if (wt)
4308
- return { payload: wt, usedHistoryApi: !0 };
4306
+ }), bt = Y(Me, U);
4307
+ if (bt)
4308
+ return { payload: bt, usedHistoryApi: !0 };
4309
4309
  throw new Error("History response missing checkpoints");
4310
4310
  } catch (Me) {
4311
4311
  console.warn("[ChatSessionProvider] getStateHistory failed, falling back to getState:", Me);
4312
- const wt = await c.getState({
4312
+ const bt = await c.getState({
4313
4313
  threadId: U,
4314
4314
  checkpointId: q ?? void 0,
4315
4315
  checkpointNs: se ?? void 0
@@ -4318,18 +4318,18 @@ function kv({
4318
4318
  payload: {
4319
4319
  version: Gi,
4320
4320
  threadId: U,
4321
- checkpoints: [wt]
4321
+ checkpoints: [bt]
4322
4322
  },
4323
4323
  usedHistoryApi: !1
4324
4324
  };
4325
4325
  }
4326
- })().then((Me) => (vt.current.set(ae, { result: Me, timestamp: Date.now() }), Ft(), Me)).finally(() => {
4326
+ })().then((Me) => (wt.current.set(ae, { result: Me, timestamp: Date.now() }), Ft(), Me)).finally(() => {
4327
4327
  Qe.current.get(ae) === dt && Qe.current.delete(ae);
4328
4328
  });
4329
4329
  return Qe.current.set(ae, dt), dt;
4330
4330
  },
4331
4331
  [c, Y, Ft]
4332
- ), ve = de((E, I) => new Promise((U, q) => {
4332
+ ), ve = fe((E, I) => new Promise((U, q) => {
4333
4333
  const se = async () => {
4334
4334
  Ye.current = !0;
4335
4335
  try {
@@ -4347,29 +4347,29 @@ function kv({
4347
4347
  q(ae);
4348
4348
  });
4349
4349
  }), []), gt = be(b.length), xt = be(!1), Pt = be(T);
4350
- bt(() => {
4350
+ St(() => {
4351
4351
  gt.current = b.length;
4352
- }, [b.length]), bt(() => {
4352
+ }, [b.length]), St(() => {
4353
4353
  Pt.current = T;
4354
- }, [T]), bt(() => {
4354
+ }, [T]), St(() => {
4355
4355
  const E = H.pendingInterrupt ?? uv(H.messages);
4356
- Kc(W, E) || F(E ?? null);
4356
+ Kc(W, E) || L(E ?? null);
4357
4357
  }, [W, H.messages, H.pendingInterrupt]);
4358
- const Oe = be(0), Et = be(null), at = be(!1), _t = be(null), jn = 500, Kt = de(async () => {
4358
+ const je = be(0), Et = be(null), at = be(!1), _t = be(null), jn = 500, Kt = fe(async () => {
4359
4359
  var q;
4360
4360
  const E = Date.now();
4361
- if (E - Oe.current < jn) {
4361
+ if (E - je.current < jn) {
4362
4362
  console.debug("[ChatSessionProvider] Debouncing thread refresh (too soon after last call)");
4363
4363
  return;
4364
4364
  }
4365
- Oe.current = E, Et.current !== null && (window.clearTimeout(Et.current), Et.current = null), at.current = !0;
4365
+ je.current = E, Et.current !== null && (window.clearTimeout(Et.current), Et.current = null), at.current = !0;
4366
4366
  const I = (q = c.getAuthToken) == null ? void 0 : q.call(c), U = gt.current > 0;
4367
4367
  U || _(!0);
4368
4368
  try {
4369
4369
  const se = await c.listThreads();
4370
4370
  Qo(() => {
4371
4371
  C((ae) => {
4372
- const et = (wt) => wt.map((Lt) => `${Lt.threadId}:${Lt.updatedAt ?? ""}:${Lt.messageCount ?? ""}`).join("|"), dt = Zi(ae);
4372
+ const et = (bt) => bt.map((Lt) => `${Lt.threadId}:${Lt.updatedAt ?? ""}:${Lt.messageCount ?? ""}`).join("|"), dt = Zi(ae);
4373
4373
  return et(dt) === et(se) || se.length === 0 && dt.length > 0 && !xt.current ? ae : rs(se);
4374
4374
  });
4375
4375
  }), _t.current = I ?? null, P(null), xt.current || (xt.current = !0);
@@ -4382,20 +4382,20 @@ function kv({
4382
4382
  attempts: 0,
4383
4383
  timer: null,
4384
4384
  reason: null
4385
- }), fe = be(null), Ne = be(0), Ge = be(() => {
4385
+ }), he = be(null), Ne = be(0), Ge = be(() => {
4386
4386
  }), lt = be(() => {
4387
4387
  }), Ue = be(() => {
4388
4388
  }), ze = (E) => {
4389
4389
  if (!E || typeof E != "object") return !1;
4390
4390
  const I = E;
4391
4391
  return I.code === "ECONNABORTED" ? !0 : (typeof I.message == "string" ? I.message.toLowerCase() : "").includes("timeout");
4392
- }, Ot = de(
4392
+ }, Ot = fe(
4393
4393
  async (E) => {
4394
4394
  const I = await c.listCheckpointSummaries(E);
4395
4395
  return Ld(I ?? []);
4396
4396
  },
4397
4397
  [c]
4398
- ), yt = de(
4398
+ ), yt = fe(
4399
4399
  (E, I) => {
4400
4400
  if (!Or()) return;
4401
4401
  qt.current !== null && (window.clearTimeout(qt.current), qt.current = null);
@@ -4428,9 +4428,9 @@ function kv({
4428
4428
  }, ws);
4429
4429
  },
4430
4430
  [w]
4431
- ), St = de(() => {
4431
+ ), vt = fe(() => {
4432
4432
  yt(b, { immediate: !0 });
4433
- }, [yt, b]), Mt = de(
4433
+ }, [yt, b]), Mt = fe(
4434
4434
  (E, I, U, q) => {
4435
4435
  var $i;
4436
4436
  const se = U ?? Te.current;
@@ -4451,10 +4451,10 @@ function kv({
4451
4451
  checkpointId: ae.checkpointId ?? null,
4452
4452
  checkpointNs: ae.checkpointNs ?? null,
4453
4453
  pendingInterrupt: ae.interrupt ?? null
4454
- }), F(ae.interrupt ?? null), ue(ae.nextCursor ?? null), Q(!!ae.nextCursor), ee(ae.checkpointId ?? void 0), G(ae.checkpointNs ?? void 0), le(ae.nextCursorNs ?? void 0);
4454
+ }), L(ae.interrupt ?? null), de(ae.nextCursor ?? null), Q(!!ae.nextCursor), ee(ae.checkpointId ?? void 0), G(ae.checkpointNs ?? void 0), ce(ae.nextCursorNs ?? void 0);
4455
4455
  return;
4456
4456
  }
4457
- const Me = qe.current.get(se), wt = (Me == null ? void 0 : Me.snapshot) ?? null, Lt = Array.isArray(wt == null ? void 0 : wt.messages) ? wt.messages : [], fn = hn(wt), Vn = Array.isArray(E == null ? void 0 : E.messages) ? E.messages : [], Yt = /* @__PURE__ */ new Set(), $t = [...Vn, ...Lt].filter((Xt) => {
4457
+ const Me = qe.current.get(se), bt = (Me == null ? void 0 : Me.snapshot) ?? null, Lt = Array.isArray(bt == null ? void 0 : bt.messages) ? bt.messages : [], fn = hn(bt), Vn = Array.isArray(E == null ? void 0 : E.messages) ? E.messages : [], Yt = /* @__PURE__ */ new Set(), $t = [...Vn, ...Lt].filter((Xt) => {
4458
4458
  const zi = Xt == null ? void 0 : Xt.id;
4459
4459
  return zi ? Yt.has(zi) ? !1 : (Yt.add(zi), !0) : !0;
4460
4460
  }), nr = Dd(fn, ae), kr = {
@@ -4479,7 +4479,7 @@ function kv({
4479
4479
  return;
4480
4480
  Vn.length && ye(Vn);
4481
4481
  const Kr = E && Object.prototype.hasOwnProperty.call(E, "checkpointId") ? E.checkpointId : void 0, Cn = E && Object.prototype.hasOwnProperty.call(E, "checkpointNs") ? E.checkpointNs : void 0, Rr = E && Object.prototype.hasOwnProperty.call(E, "nextCursor") ? E.nextCursor : void 0, ur = E && Object.prototype.hasOwnProperty.call(E, "nextCursorNs") ? E.nextCursorNs : void 0;
4482
- ue(
4482
+ de(
4483
4483
  (Xt) => Rr !== void 0 ? Rr ?? Xt ?? null : Xt ?? null
4484
4484
  ), Q(
4485
4485
  (Xt) => Rr !== void 0 ? !!Rr : Xt
@@ -4487,12 +4487,12 @@ function kv({
4487
4487
  (Xt) => Kr !== void 0 ? Kr ?? Xt ?? void 0 : Xt ?? void 0
4488
4488
  ), G(
4489
4489
  (Xt) => Cn !== void 0 ? Cn ?? Xt ?? void 0 : Xt ?? void 0
4490
- ), le(
4490
+ ), ce(
4491
4491
  (Xt) => ur !== void 0 ? ur ?? void 0 : Xt
4492
4492
  );
4493
4493
  },
4494
- [ye, re, F]
4495
- ), Sn = de(
4494
+ [ye, re, L]
4495
+ ), Sn = fe(
4496
4496
  (E) => {
4497
4497
  if (E.threadId != null && E.threadId !== Te.current)
4498
4498
  return;
@@ -4501,27 +4501,27 @@ function kv({
4501
4501
  checkpointId: I.checkpointId ?? null,
4502
4502
  checkpointNs: I.checkpointNs ?? null,
4503
4503
  pendingInterrupt: I.interrupt ?? null
4504
- }), F(I.interrupt ?? null), ue(I.nextCursor ?? null), Q(!!I.nextCursor), ee(I.checkpointId ?? void 0), G(I.checkpointNs ?? void 0), le(I.nextCursorNs ?? void 0), Ze.current = E.threadId, st(E.threadId ?? Te.current ?? null);
4504
+ }), L(I.interrupt ?? null), de(I.nextCursor ?? null), Q(!!I.nextCursor), ee(I.checkpointId ?? void 0), G(I.checkpointNs ?? void 0), ce(I.nextCursorNs ?? void 0), Ze.current = E.threadId, st(E.threadId ?? Te.current ?? null);
4505
4505
  },
4506
- [re, F, st]
4507
- ), on = de((E) => {
4506
+ [re, L, st]
4507
+ ), on = fe((E) => {
4508
4508
  if (!E) return;
4509
4509
  qe.current.delete(E), x(E), en(E);
4510
4510
  const I = `${E}__`;
4511
4511
  for (const U of Qe.current.keys())
4512
4512
  U.startsWith(I) && Qe.current.delete(U);
4513
- for (const U of vt.current.keys())
4514
- U.startsWith(I) && vt.current.delete(U);
4513
+ for (const U of wt.current.keys())
4514
+ U.startsWith(I) && wt.current.delete(U);
4515
4515
  Ze.current === E && (Ze.current = null);
4516
- }, [en, x]), Dt = de(() => {
4516
+ }, [en, x]), Dt = fe(() => {
4517
4517
  const E = Te.current;
4518
- E && on(E), rt([]), Q(!1), _e(!1), ue(null), ee(void 0), G(void 0), le(void 0);
4519
- }, [on, rt]), Pn = de(({ from: E, to: I }) => {
4518
+ E && on(E), rt([]), Q(!1), _e(!1), de(null), ee(void 0), G(void 0), ce(void 0);
4519
+ }, [on, rt]), Pn = fe(({ from: E, to: I }) => {
4520
4520
  const U = Te.current;
4521
4521
  U && console.warn(
4522
4522
  `[ChatSessionProvider] Stream sequence gap detected (${E} -> ${I}) for thread ${U}`
4523
4523
  );
4524
- }, []), Z = de(
4524
+ }, []), X = fe(
4525
4525
  (E) => {
4526
4526
  const I = E.threadId;
4527
4527
  console.log("[ChatSessionProvider] 📥 Handling thread_info event:", {
@@ -4551,9 +4551,9 @@ function kv({
4551
4551
  });
4552
4552
  },
4553
4553
  [H.messages.length]
4554
- ), { startStream: ce, stop: he, isStreaming: Ee, error: ht, setAuthToken: Be, replayBufferedEvents: it } = nv({
4554
+ ), { startStream: le, stop: ue, isStreaming: Ee, error: ht, setAuthToken: Be, replayBufferedEvents: it } = nv({
4555
4555
  baseUrl: f,
4556
- onThreadInfo: Z,
4556
+ onThreadInfo: X,
4557
4557
  onMessageEvent: Fe,
4558
4558
  onUnhandledEvent: (E) => {
4559
4559
  console.warn(`[ChatSessionProvider] Unhandled stream event: ${E.type}`, E);
@@ -4569,12 +4569,12 @@ function kv({
4569
4569
  onHeartbeat: (E) => {
4570
4570
  Ue.current(E);
4571
4571
  }
4572
- }), Rt = de(() => {
4572
+ }), Rt = fe(() => {
4573
4573
  const E = K.current;
4574
4574
  E.timer !== null && (window.clearTimeout(E.timer), E.timer = null), E.reason = null;
4575
- }, []), tn = de(
4575
+ }, []), tn = fe(
4576
4576
  (E, I) => {
4577
- R("connecting"), ce(E, {
4577
+ R("connecting"), le(E, {
4578
4578
  onOpen: (U) => {
4579
4579
  var q;
4580
4580
  Rt(), K.current.attempts = 0, R("connected"), (q = I == null ? void 0 : I.onOpen) == null || q.call(I, U);
@@ -4598,19 +4598,19 @@ function kv({
4598
4598
  }
4599
4599
  });
4600
4600
  },
4601
- [Rt, Pn, R, ce]
4602
- ), Wn = de(() => {
4601
+ [Rt, Pn, R, le]
4602
+ ), Wn = fe(() => {
4603
4603
  const E = Te.current;
4604
4604
  if (!E)
4605
4605
  return null;
4606
- const I = fe.current, U = H.lastCheckpointId ?? (I == null ? void 0 : I.lastCheckpointId) ?? null, q = H.lastCheckpointNs ?? (I == null ? void 0 : I.lastCheckpointNs) ?? null, se = {};
4606
+ const I = he.current, U = H.lastCheckpointId ?? (I == null ? void 0 : I.lastCheckpointId) ?? null, q = H.lastCheckpointNs ?? (I == null ? void 0 : I.lastCheckpointNs) ?? null, se = {};
4607
4607
  return U && (se.checkpointId = U), q && (se.checkpointNs = q), {
4608
4608
  threadId: E,
4609
4609
  checkpointId: U,
4610
4610
  checkpointNs: q,
4611
4611
  command: { kind: "resume", value: se }
4612
4612
  };
4613
- }, [H.lastCheckpointId, H.lastCheckpointNs]), Tr = de(
4613
+ }, [H.lastCheckpointId, H.lastCheckpointNs]), Tr = fe(
4614
4614
  (E) => {
4615
4615
  const I = K.current;
4616
4616
  if (I.timer !== null)
@@ -4635,10 +4635,10 @@ function kv({
4635
4635
  }, U);
4636
4636
  },
4637
4637
  [Wn, it, R, tn]
4638
- ), Li = de(
4638
+ ), Li = fe(
4639
4639
  (E) => {
4640
4640
  var I;
4641
- if (fe.current = E, E.manualStop || E.reason === "complete") {
4641
+ if (he.current = E, E.manualStop || E.reason === "complete") {
4642
4642
  Rt(), K.current.attempts = 0, R("idle");
4643
4643
  return;
4644
4644
  }
@@ -4660,23 +4660,23 @@ function kv({
4660
4660
  }
4661
4661
  },
4662
4662
  [Rt, Tr, R, a]
4663
- ), mo = de(
4663
+ ), mo = fe(
4664
4664
  (E) => {
4665
4665
  console.warn("[ChatSessionProvider] Stream connection error:", E), Tr("connection-error");
4666
4666
  },
4667
4667
  [Tr]
4668
- ), Fi = de((E) => {
4668
+ ), Fi = fe((E) => {
4669
4669
  Ne.current = Date.now(), R((I) => I === "reconnecting" ? "connected" : I);
4670
4670
  }, [R]);
4671
- Ge.current = Li, lt.current = mo, Ue.current = Fi, bt(() => () => {
4671
+ Ge.current = Li, lt.current = mo, Ue.current = Fi, St(() => () => {
4672
4672
  Rt();
4673
4673
  }, [Rt]);
4674
- const tc = de(() => {
4675
- Rt(), K.current.attempts = 0, R("idle"), he();
4676
- }, [Rt, R, he]);
4677
- bt(() => {
4674
+ const tc = fe(() => {
4675
+ Rt(), K.current.attempts = 0, R("idle"), ue();
4676
+ }, [Rt, R, ue]);
4677
+ St(() => {
4678
4678
  Hn.current = Ee;
4679
- }, [Ee]), bt(() => {
4679
+ }, [Ee]), St(() => {
4680
4680
  if (!Or()) return;
4681
4681
  qt.current !== null && (window.clearTimeout(qt.current), qt.current = null);
4682
4682
  const E = b.map((U) => `${U.threadId}:${U.updatedAt ?? ""}:${U.messageCount ?? ""}`).join("|");
@@ -4704,7 +4704,7 @@ function kv({
4704
4704
  }, ws), () => {
4705
4705
  qt.current !== null && (window.clearTimeout(qt.current), qt.current = null);
4706
4706
  };
4707
- }, [b, yt]), bt(() => {
4707
+ }, [b, yt]), St(() => {
4708
4708
  var q;
4709
4709
  const E = c.getAuthToken();
4710
4710
  Be(E);
@@ -4727,7 +4727,7 @@ function kv({
4727
4727
  ), Be(se);
4728
4728
  return;
4729
4729
  }
4730
- Be(se), y(), Qe.current.clear(), vt.current.clear(), I(se, !0), Et.current !== null && window.clearTimeout(Et.current), Et.current = window.setTimeout(() => {
4730
+ Be(se), y(), Qe.current.clear(), wt.current.clear(), I(se, !0), Et.current !== null && window.clearTimeout(Et.current), Et.current = window.setTimeout(() => {
4731
4731
  Et.current = null, Kt().catch((dt) => {
4732
4732
  console.warn("[ChatSessionProvider] Background thread refresh after token rotation failed:", dt);
4733
4733
  });
@@ -4738,7 +4738,7 @@ function kv({
4738
4738
  U == null || U(), Et.current !== null && (window.clearTimeout(Et.current), Et.current = null);
4739
4739
  };
4740
4740
  }, [c, h, Be, y, Kt]);
4741
- const nc = de(
4741
+ const nc = fe(
4742
4742
  async (E) => {
4743
4743
  var q;
4744
4744
  const I = `Thread ${(q = crypto.randomUUID) == null ? void 0 : q.call(crypto)}`, U = {
@@ -4759,8 +4759,8 @@ function kv({
4759
4759
  if (!dt) return et;
4760
4760
  const Me = { ...et.byId };
4761
4761
  delete Me[I], Me[ae] = { ...dt, threadId: ae };
4762
- const wt = et.order.map((Lt) => Lt === I ? ae : Lt);
4763
- return { byId: Me, order: wt };
4762
+ const bt = et.order.map((Lt) => Lt === I ? ae : Lt);
4763
+ return { byId: Me, order: bt };
4764
4764
  }), A(ae), setTimeout(() => Kt(), 10), P(null), ae;
4765
4765
  } catch (se) {
4766
4766
  throw C((ae) => {
@@ -4773,7 +4773,7 @@ function kv({
4773
4773
  }
4774
4774
  },
4775
4775
  [c, Kt]
4776
- ), rc = de(
4776
+ ), rc = fe(
4777
4777
  async (E) => {
4778
4778
  try {
4779
4779
  await c.deleteThread(E);
@@ -4790,7 +4790,7 @@ function kv({
4790
4790
  }
4791
4791
  },
4792
4792
  [c, Dt, on, Kt, yt]
4793
- ), oc = de(
4793
+ ), oc = fe(
4794
4794
  async (E, I) => {
4795
4795
  try {
4796
4796
  await c.updateThread(E, I), C((U) => {
@@ -4805,7 +4805,7 @@ function kv({
4805
4805
  }
4806
4806
  },
4807
4807
  [c, Kt]
4808
- ), cr = de(
4808
+ ), cr = fe(
4809
4809
  async (E, I, U, q = !1) => {
4810
4810
  await ve(async () => {
4811
4811
  if (Xe.current === E && !q) {
@@ -4819,9 +4819,9 @@ function kv({
4819
4819
  E,
4820
4820
  I ?? null,
4821
4821
  U ?? null
4822
- ), dt = vt.current.get(et), Me = !q && !I && !U && dt && Date.now() - dt.timestamp < rv, wt = !q && !I && !U;
4822
+ ), dt = wt.current.get(et), Me = !q && !I && !U && dt && Date.now() - dt.timestamp < rv, bt = !q && !I && !U;
4823
4823
  let Lt = !1;
4824
- if (wt) {
4824
+ if (bt) {
4825
4825
  const Yt = qe.current.get(E);
4826
4826
  if (Yt)
4827
4827
  Sn(Yt), Lt = !0;
@@ -4846,7 +4846,7 @@ function kv({
4846
4846
  if (ze($t))
4847
4847
  try {
4848
4848
  const nr = await Ot(E), kr = Qt(E, nr);
4849
- if (Q(!1), ue(null), le(void 0), ee(void 0), G(void 0), kr) {
4849
+ if (Q(!1), de(null), ce(void 0), ee(void 0), G(void 0), kr) {
4850
4850
  j("History request timed out. Select a checkpoint to load manually.");
4851
4851
  return;
4852
4852
  }
@@ -4858,7 +4858,7 @@ function kv({
4858
4858
  Je.current = null, Yt && $(!1);
4859
4859
  }
4860
4860
  };
4861
- fn ? await Vn(!0) : wt && Lt && !Me && Vn(!1).catch((Yt) => {
4861
+ fn ? await Vn(!0) : bt && Lt && !Me && Vn(!1).catch((Yt) => {
4862
4862
  console.warn("[ChatSessionProvider] Background refresh failed:", Yt);
4863
4863
  });
4864
4864
  }, `loadThread-${E}`);
@@ -4875,17 +4875,17 @@ function kv({
4875
4875
  Jt,
4876
4876
  Zt
4877
4877
  ]
4878
- ), sc = de(async () => {
4878
+ ), sc = fe(async () => {
4879
4879
  await ve(async () => {
4880
4880
  const E = Te.current;
4881
- E && on(E), Xe.current = null, A(null), Te.current = null, Ze.current = null, Dt(), ee(void 0), G(void 0), le(void 0), ft();
4881
+ E && on(E), Xe.current = null, A(null), Te.current = null, Ze.current = null, Dt(), ee(void 0), G(void 0), ce(void 0), ft();
4882
4882
  try {
4883
4883
  localStorage.removeItem("lastThreadId");
4884
4884
  } catch (I) {
4885
4885
  console.warn("[ChatSessionProvider] Failed to clear lastThreadId:", I);
4886
4886
  }
4887
4887
  }, "clearCurrentThread");
4888
- }, [Dt, on, ve, ft]), ic = de(
4888
+ }, [Dt, on, ve, ft]), ic = fe(
4889
4889
  async (E, I) => {
4890
4890
  const U = Te.current;
4891
4891
  if (!U) throw new Error("No active thread");
@@ -4899,14 +4899,14 @@ function kv({
4899
4899
  await cr(U, E, I ?? void 0, !0);
4900
4900
  },
4901
4901
  [Mt, ve, Bt, cr]
4902
- ), ac = de(async () => {
4902
+ ), ac = fe(async () => {
4903
4903
  if (!Te.current) throw new Error("No active thread");
4904
4904
  await cr(Te.current, void 0, void 0, !0);
4905
- }, [cr]), lc = de(
4905
+ }, [cr]), lc = fe(
4906
4906
  async () => {
4907
4907
  if (!Te.current) throw new Error("No active thread");
4908
4908
  if (ge || !ne) return;
4909
- const E = J;
4909
+ const E = Z;
4910
4910
  if (E) {
4911
4911
  _e(!0);
4912
4912
  try {
@@ -4919,10 +4919,10 @@ function kv({
4919
4919
  if (dt && et && et.size > 0 && (dt = se.some((Me) => {
4920
4920
  if (!(Me != null && Me.checkpointId))
4921
4921
  return !1;
4922
- const wt = Jr(Me.checkpointId, Me.checkpointNs ?? null);
4923
- return !et.has(wt);
4922
+ const bt = Jr(Me.checkpointId, Me.checkpointNs ?? null);
4923
+ return !et.has(bt);
4924
4924
  })), !dt) {
4925
- ue(null), le(void 0), Q(!1), j(null);
4925
+ de(null), ce(void 0), Q(!1), j(null);
4926
4926
  return;
4927
4927
  }
4928
4928
  if (Mt(q, "prepend", I ?? void 0), I && (Jt(I, se, "prepend"), Zt(I, ae, "prepend"), !U.usedHistoryApi))
@@ -4948,14 +4948,14 @@ function kv({
4948
4948
  ke,
4949
4949
  D,
4950
4950
  ie,
4951
- J,
4951
+ Z,
4952
4952
  Ot,
4953
4953
  Qt,
4954
4954
  ge,
4955
4955
  Jt,
4956
4956
  Zt
4957
4957
  ]
4958
- ), cc = de(
4958
+ ), cc = fe(
4959
4959
  (E) => {
4960
4960
  if (E != null && E.threadId) {
4961
4961
  if (E.checkpointId) {
@@ -4972,7 +4972,7 @@ function kv({
4972
4972
  }
4973
4973
  },
4974
4974
  [Mt, Zt]
4975
- ), go = de(
4975
+ ), go = fe(
4976
4976
  async (E, I) => {
4977
4977
  var Rr;
4978
4978
  const U = Te.current, q = (E == null ? void 0 : E.text) ?? "", se = (E == null ? void 0 : E.attachments) ?? [], ae = se.length ? se : (I == null ? void 0 : I.attachments) ?? [], et = E == null ? void 0 : E.messageAdditionalKwargs, dt = {
@@ -4984,7 +4984,7 @@ function kv({
4984
4984
  return;
4985
4985
  }
4986
4986
  !U && !dt.messages && console.warn("[ChatSessionProvider] No thread ID - message will create new thread");
4987
- const { contentParts: Me, filesInfo: wt } = await Ny(
4987
+ const { contentParts: Me, filesInfo: bt } = await Ny(
4988
4988
  c,
4989
4989
  ae
4990
4990
  ), Lt = [...Me];
@@ -5000,10 +5000,10 @@ function kv({
5000
5000
  et && Object.keys(et).length && ($t.additionalKwargs = {
5001
5001
  ...$t.additionalKwargs ?? {},
5002
5002
  ...et
5003
- }), Lt.length > 0 && Pe($t);
5003
+ }), Lt.length > 0 && Oe($t);
5004
5004
  const nr = { ...$t, content: Lt }, kr = ae.length > 0, Kr = {
5005
5005
  messages: Lt.length > 0 ? [nr] : [],
5006
- files_info: wt,
5006
+ files_info: bt,
5007
5007
  ...o && kr && s ? { active_agent: s } : {},
5008
5008
  ...dt
5009
5009
  }, Cn = {
@@ -5036,10 +5036,10 @@ function kv({
5036
5036
  H.lastCheckpointId,
5037
5037
  H.lastCheckpointNs,
5038
5038
  H.messages.length,
5039
- Pe,
5039
+ Oe,
5040
5040
  tn
5041
5041
  ]
5042
- ), uc = de(
5042
+ ), uc = fe(
5043
5043
  async (E, I, U) => {
5044
5044
  if (!Te.current)
5045
5045
  throw new Error("No active thread to handle interrupt");
@@ -5057,21 +5057,21 @@ function kv({
5057
5057
  checkpointNs: H.lastCheckpointNs ?? void 0,
5058
5058
  command: { kind: "resume", value: se }
5059
5059
  }
5060
- ), F(null);
5060
+ ), L(null);
5061
5061
  } catch (ae) {
5062
5062
  throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${E}:`, ae), ae;
5063
5063
  }
5064
5064
  },
5065
5065
  [We, H.lastCheckpointId, H.lastCheckpointNs, go]
5066
5066
  );
5067
- bt(() => {
5067
+ St(() => {
5068
5068
  if (l == null || l(k), k)
5069
5069
  try {
5070
5070
  localStorage.setItem("lastThreadId", k);
5071
5071
  } catch (E) {
5072
5072
  console.warn("[ChatSessionProvider] Failed to persist lastThreadId:", E);
5073
5073
  }
5074
- }, [k, l]), bt(() => ((async () => {
5074
+ }, [k, l]), St(() => ((async () => {
5075
5075
  try {
5076
5076
  if (Kt().catch((I) => {
5077
5077
  console.error("[ChatSessionProvider] Failed to refresh threads (background):", I), i == null || i(String(I));
@@ -5087,7 +5087,7 @@ function kv({
5087
5087
  console.error("[ChatSessionProvider] Initialization failed:", I), i == null || i(String(I));
5088
5088
  }
5089
5089
  })(), () => {
5090
- }), []), bt(() => {
5090
+ }), []), St(() => {
5091
5091
  const E = Te.current;
5092
5092
  if (!E || Ze.current !== E) return;
5093
5093
  H.messages.length && H.messages[H.messages.length - 1];
@@ -5095,12 +5095,12 @@ function kv({
5095
5095
  checkpointId: H.lastCheckpointId ?? null,
5096
5096
  checkpointNs: H.lastCheckpointNs ?? null,
5097
5097
  messages: H.messages.slice(),
5098
- nextCursor: J ?? null,
5098
+ nextCursor: Z ?? null,
5099
5099
  nextCursorNs: ie ?? null,
5100
5100
  interrupt: H.pendingInterrupt ?? W ?? null
5101
- }), U = qe.current.get(E), q = U == null ? void 0 : U.snapshot, se = !q || q.messages.length !== I.messages.length || q.messages.some((Me, wt) => {
5101
+ }), U = qe.current.get(E), q = U == null ? void 0 : U.snapshot, se = !q || q.messages.length !== I.messages.length || q.messages.some((Me, bt) => {
5102
5102
  var Lt;
5103
- return (Me == null ? void 0 : Me.id) !== ((Lt = I.messages[wt]) == null ? void 0 : Lt.id);
5103
+ return (Me == null ? void 0 : Me.id) !== ((Lt = I.messages[bt]) == null ? void 0 : Lt.id);
5104
5104
  }), ae = ((q == null ? void 0 : q.checkpointId) ?? null) !== I.checkpointId || ((q == null ? void 0 : q.checkpointNs) ?? null) !== I.checkpointNs, et = ((q == null ? void 0 : q.nextCursor) ?? null) !== I.nextCursor || ((q == null ? void 0 : q.nextCursorNs) ?? null) !== I.nextCursorNs, dt = !Kc(
5105
5105
  (q == null ? void 0 : q.interrupt) ?? null,
5106
5106
  I.interrupt ?? null
@@ -5113,13 +5113,13 @@ function kv({
5113
5113
  qe.current.set(E, Me), Cr.current && window.clearTimeout(Cr.current), Cr.current = window.setTimeout(() => {
5114
5114
  try {
5115
5115
  g(Me, 100);
5116
- } catch (wt) {
5117
- console.warn("[ChatSessionProvider] Failed to persist thread payload:", wt);
5116
+ } catch (bt) {
5117
+ console.warn("[ChatSessionProvider] Failed to persist thread payload:", bt);
5118
5118
  }
5119
5119
  }, ws);
5120
5120
  }
5121
5121
  }, [
5122
- J,
5122
+ Z,
5123
5123
  ie,
5124
5124
  H.lastCheckpointId,
5125
5125
  H.lastCheckpointNs,
@@ -5141,8 +5141,8 @@ function kv({
5141
5141
  renameThread: oc,
5142
5142
  refreshThreads: () => Kt()
5143
5143
  },
5144
- persistThreadsCache: St,
5145
- hydrateFromCache: L
5144
+ persistThreadsCache: vt,
5145
+ hydrateFromCache: F
5146
5146
  }),
5147
5147
  [
5148
5148
  b,
@@ -5153,8 +5153,8 @@ function kv({
5153
5153
  rc,
5154
5154
  oc,
5155
5155
  Kt,
5156
- St,
5157
- L,
5156
+ vt,
5157
+ F,
5158
5158
  A
5159
5159
  ]
5160
5160
  ), dg = ct(() => {
@@ -5364,7 +5364,7 @@ function Iv({
5364
5364
  id: W,
5365
5365
  shouldClear: !0
5366
5366
  }, S(() => {
5367
- var F, L, ne;
5367
+ var L, F, ne;
5368
5368
  try {
5369
5369
  const Q = l(j);
5370
5370
  Q && typeof Q.then == "function" ? Q.then(() => {
@@ -5373,7 +5373,7 @@ function Iv({
5373
5373
  }).catch(() => {
5374
5374
  var ge;
5375
5375
  ((ge = b.current) == null ? void 0 : ge.id) === W && (b.current = null);
5376
- }) : (((F = b.current) == null ? void 0 : F.id) === W && b.current.shouldClear && (m || (x(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((L = b.current) == null ? void 0 : L.id) === W && (b.current = null));
5376
+ }) : (((L = b.current) == null ? void 0 : L.id) === W && b.current.shouldClear && (m || (x(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((F = b.current) == null ? void 0 : F.id) === W && (b.current = null));
5377
5377
  } catch {
5378
5378
  ((ne = b.current) == null ? void 0 : ne.id) === W && (b.current = null);
5379
5379
  }
@@ -6272,7 +6272,7 @@ const fw = (e) => ({
6272
6272
  const P = (((M = s.flip) == null ? void 0 : M.index) || 0) + 1, B = k[P];
6273
6273
  if (B && (!(f === "alignment" ? w !== Yn(B) : !1) || // We leave the current main axis only if every placement on that axis
6274
6274
  // overflows the main axis.
6275
- _.every((F) => Yn(F.placement) === w ? F.overflows[0] > 0 : !0)))
6275
+ _.every((L) => Yn(L.placement) === w ? L.overflows[0] > 0 : !0)))
6276
6276
  return {
6277
6277
  data: {
6278
6278
  index: P,
@@ -6282,20 +6282,20 @@ const fw = (e) => ({
6282
6282
  placement: B
6283
6283
  }
6284
6284
  };
6285
- let j = ($ = _.filter((W) => W.overflows[0] <= 0).sort((W, F) => W.overflows[1] - F.overflows[1])[0]) == null ? void 0 : $.placement;
6285
+ let j = ($ = _.filter((W) => W.overflows[0] <= 0).sort((W, L) => W.overflows[1] - L.overflows[1])[0]) == null ? void 0 : $.placement;
6286
6286
  if (!j)
6287
6287
  switch (p) {
6288
6288
  case "bestFit": {
6289
6289
  var z;
6290
- const W = (z = _.filter((F) => {
6290
+ const W = (z = _.filter((L) => {
6291
6291
  if (b) {
6292
- const L = Yn(F.placement);
6293
- return L === w || // Create a bias to the `y` side axis due to horizontal
6292
+ const F = Yn(L.placement);
6293
+ return F === w || // Create a bias to the `y` side axis due to horizontal
6294
6294
  // reading directions favoring greater width.
6295
- L === "y";
6295
+ F === "y";
6296
6296
  }
6297
6297
  return !0;
6298
- }).map((F) => [F.placement, F.overflows.filter((L) => L > 0).reduce((L, ne) => L + ne, 0)]).sort((F, L) => F[1] - L[1])[0]) == null ? void 0 : z[0];
6298
+ }).map((L) => [L.placement, L.overflows.filter((F) => F > 0).reduce((F, ne) => F + ne, 0)]).sort((L, F) => L[1] - F[1])[0]) == null ? void 0 : z[0];
6299
6299
  W && (j = W);
6300
6300
  break;
6301
6301
  }
@@ -7123,21 +7123,21 @@ function tb(e) {
7123
7123
  isPositioned: !1
7124
7124
  }), [h, p] = v.useState(r);
7125
7125
  Ls(h, r) || p(r);
7126
- const [m, g] = v.useState(null), [x, y] = v.useState(null), w = v.useCallback((F) => {
7127
- F !== b.current && (b.current = F, g(F));
7128
- }, []), S = v.useCallback((F) => {
7129
- F !== k.current && (k.current = F, y(F));
7126
+ const [m, g] = v.useState(null), [x, y] = v.useState(null), w = v.useCallback((L) => {
7127
+ L !== b.current && (b.current = L, g(L));
7128
+ }, []), S = v.useCallback((L) => {
7129
+ L !== k.current && (k.current = L, y(L));
7130
7130
  }, []), T = s || m, C = i || x, b = v.useRef(null), k = v.useRef(null), A = v.useRef(d), N = l != null, _ = oa(l), M = oa(o), $ = oa(c), z = v.useCallback(() => {
7131
7131
  if (!b.current || !k.current)
7132
7132
  return;
7133
- const F = {
7133
+ const L = {
7134
7134
  placement: t,
7135
7135
  strategy: n,
7136
7136
  middleware: h
7137
7137
  };
7138
- M.current && (F.platform = M.current), Zw(b.current, k.current, F).then((L) => {
7138
+ M.current && (L.platform = M.current), Zw(b.current, k.current, L).then((F) => {
7139
7139
  const ne = {
7140
- ...L,
7140
+ ...F,
7141
7141
  // The floating element's position may be recomputed while it's closed
7142
7142
  // but still mounted (such as when transitioning out). To ensure
7143
7143
  // `isPositioned` will be `false` initially on the next open, avoid
@@ -7150,8 +7150,8 @@ function tb(e) {
7150
7150
  });
7151
7151
  }, [h, t, n, M, $]);
7152
7152
  Ss(() => {
7153
- c === !1 && A.current.isPositioned && (A.current.isPositioned = !1, f((F) => ({
7154
- ...F,
7153
+ c === !1 && A.current.isPositioned && (A.current.isPositioned = !1, f((L) => ({
7154
+ ...L,
7155
7155
  isPositioned: !1
7156
7156
  })));
7157
7157
  }, [c]);
@@ -7174,23 +7174,23 @@ function tb(e) {
7174
7174
  reference: T,
7175
7175
  floating: C
7176
7176
  }), [T, C]), W = v.useMemo(() => {
7177
- const F = {
7177
+ const L = {
7178
7178
  position: n,
7179
7179
  left: 0,
7180
7180
  top: 0
7181
7181
  };
7182
7182
  if (!j.floating)
7183
- return F;
7184
- const L = fu(j.floating, d.x), ne = fu(j.floating, d.y);
7183
+ return L;
7184
+ const F = fu(j.floating, d.x), ne = fu(j.floating, d.y);
7185
7185
  return a ? {
7186
- ...F,
7187
- transform: "translate(" + L + "px, " + ne + "px)",
7186
+ ...L,
7187
+ transform: "translate(" + F + "px, " + ne + "px)",
7188
7188
  ...nf(j.floating) >= 1.5 && {
7189
7189
  willChange: "transform"
7190
7190
  }
7191
7191
  } : {
7192
7192
  position: n,
7193
- left: L,
7193
+ left: F,
7194
7194
  top: ne
7195
7195
  };
7196
7196
  }, [n, a, j.floating, d.x, d.y]);
@@ -7301,7 +7301,7 @@ var cf = "PopperAnchor", uf = v.forwardRef(
7301
7301
  uf.displayName = cf;
7302
7302
  var Sl = "PopperContent", [hb, pb] = sf(Sl), df = v.forwardRef(
7303
7303
  (e, t) => {
7304
- var ee, D, G, ie, le, H;
7304
+ var ee, D, G, ie, ce, H;
7305
7305
  const {
7306
7306
  __scopePopper: n,
7307
7307
  side: r = "bottom",
@@ -7322,7 +7322,7 @@ var Sl = "PopperContent", [hb, pb] = sf(Sl), df = v.forwardRef(
7322
7322
  boundary: M.filter(gb),
7323
7323
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
7324
7324
  altBoundary: $
7325
- }, { refs: P, floatingStyles: B, placement: j, isPositioned: W, middlewareData: F } = tb({
7325
+ }, { refs: P, floatingStyles: B, placement: j, isPositioned: W, middlewareData: L } = tb({
7326
7326
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
7327
7327
  strategy: "fixed",
7328
7328
  placement: N,
@@ -7343,20 +7343,20 @@ var Sl = "PopperContent", [hb, pb] = sf(Sl), df = v.forwardRef(
7343
7343
  l && ib({ ...z }),
7344
7344
  ab({
7345
7345
  ...z,
7346
- apply: ({ elements: We, rects: re, availableWidth: ye, availableHeight: Pe }) => {
7346
+ apply: ({ elements: We, rects: re, availableWidth: ye, availableHeight: Oe }) => {
7347
7347
  const { width: Fe, height: rt } = re.reference, Te = We.floating.style;
7348
- Te.setProperty("--radix-popper-available-width", `${ye}px`), Te.setProperty("--radix-popper-available-height", `${Pe}px`), Te.setProperty("--radix-popper-anchor-width", `${Fe}px`), Te.setProperty("--radix-popper-anchor-height", `${rt}px`);
7348
+ Te.setProperty("--radix-popper-available-width", `${ye}px`), Te.setProperty("--radix-popper-available-height", `${Oe}px`), Te.setProperty("--radix-popper-anchor-width", `${Fe}px`), Te.setProperty("--radix-popper-anchor-height", `${rt}px`);
7349
7349
  }
7350
7350
  }),
7351
7351
  T && cb({ element: T, padding: a }),
7352
7352
  xb({ arrowWidth: k, arrowHeight: A }),
7353
7353
  h && lb({ strategy: "referenceHidden", ...z })
7354
7354
  ]
7355
- }), [L, ne] = pf(j), Q = nn(m);
7355
+ }), [F, ne] = pf(j), Q = nn(m);
7356
7356
  rn(() => {
7357
7357
  W && (Q == null || Q());
7358
7358
  }, [W, Q]);
7359
- const ge = (ee = F.arrow) == null ? void 0 : ee.x, _e = (D = F.arrow) == null ? void 0 : D.y, J = ((G = F.arrow) == null ? void 0 : G.centerOffset) !== 0, [ue, ke] = v.useState();
7359
+ const ge = (ee = L.arrow) == null ? void 0 : ee.x, _e = (D = L.arrow) == null ? void 0 : D.y, Z = ((G = L.arrow) == null ? void 0 : G.centerOffset) !== 0, [de, ke] = v.useState();
7360
7360
  return rn(() => {
7361
7361
  y && ke(window.getComputedStyle(y).zIndex);
7362
7362
  }, [y]), /* @__PURE__ */ u.jsx(
@@ -7369,15 +7369,15 @@ var Sl = "PopperContent", [hb, pb] = sf(Sl), df = v.forwardRef(
7369
7369
  transform: W ? B.transform : "translate(0, -200%)",
7370
7370
  // keep off the page when measuring
7371
7371
  minWidth: "max-content",
7372
- zIndex: ue,
7372
+ zIndex: de,
7373
7373
  "--radix-popper-transform-origin": [
7374
- (ie = F.transformOrigin) == null ? void 0 : ie.x,
7375
- (le = F.transformOrigin) == null ? void 0 : le.y
7374
+ (ie = L.transformOrigin) == null ? void 0 : ie.x,
7375
+ (ce = L.transformOrigin) == null ? void 0 : ce.y
7376
7376
  ].join(" "),
7377
7377
  // hide the content if using the hide middleware and should be hidden
7378
7378
  // set visibility to hidden and disable pointer events so the UI behaves
7379
7379
  // as if the PopperContent isn't there at all
7380
- ...((H = F.hide) == null ? void 0 : H.referenceHidden) && {
7380
+ ...((H = L.hide) == null ? void 0 : H.referenceHidden) && {
7381
7381
  visibility: "hidden",
7382
7382
  pointerEvents: "none"
7383
7383
  }
@@ -7387,15 +7387,15 @@ var Sl = "PopperContent", [hb, pb] = sf(Sl), df = v.forwardRef(
7387
7387
  hb,
7388
7388
  {
7389
7389
  scope: n,
7390
- placedSide: L,
7390
+ placedSide: F,
7391
7391
  onArrowChange: C,
7392
7392
  arrowX: ge,
7393
7393
  arrowY: _e,
7394
- shouldHideArrow: J,
7394
+ shouldHideArrow: Z,
7395
7395
  children: /* @__PURE__ */ u.jsx(
7396
7396
  Le.div,
7397
7397
  {
7398
- "data-side": L,
7398
+ "data-side": F,
7399
7399
  "data-align": ne,
7400
7400
  ...g,
7401
7401
  ref: S,
@@ -8353,17 +8353,17 @@ var In = "MenuContent", [N0, Rl] = zr(In), $f = v.forwardRef(
8353
8353
  onDismiss: p,
8354
8354
  disableOutsideScroll: m,
8355
8355
  ...g
8356
- } = e, x = Br(In, n), y = Yo(In, n), w = vi(n), S = Mf(n), T = C0(n), [C, b] = v.useState(null), k = v.useRef(null), A = nt(t, k, x.onContentChange), N = v.useRef(0), _ = v.useRef(""), M = v.useRef(0), $ = v.useRef(null), z = v.useRef("right"), P = v.useRef(0), B = m ? yi : v.Fragment, j = m ? { as: j0, allowPinchZoom: !0 } : void 0, W = (L) => {
8356
+ } = e, x = Br(In, n), y = Yo(In, n), w = vi(n), S = Mf(n), T = C0(n), [C, b] = v.useState(null), k = v.useRef(null), A = nt(t, k, x.onContentChange), N = v.useRef(0), _ = v.useRef(""), M = v.useRef(0), $ = v.useRef(null), z = v.useRef("right"), P = v.useRef(0), B = m ? yi : v.Fragment, j = m ? { as: j0, allowPinchZoom: !0 } : void 0, W = (F) => {
8357
8357
  var ee, D;
8358
- const ne = _.current + L, Q = T().filter((G) => !G.disabled), ge = document.activeElement, _e = (ee = Q.find((G) => G.ref.current === ge)) == null ? void 0 : ee.textValue, J = Q.map((G) => G.textValue), ue = W0(J, ne, _e), ke = (D = Q.find((G) => G.textValue === ue)) == null ? void 0 : D.ref.current;
8358
+ const ne = _.current + F, Q = T().filter((G) => !G.disabled), ge = document.activeElement, _e = (ee = Q.find((G) => G.ref.current === ge)) == null ? void 0 : ee.textValue, Z = Q.map((G) => G.textValue), de = W0(Z, ne, _e), ke = (D = Q.find((G) => G.textValue === de)) == null ? void 0 : D.ref.current;
8359
8359
  (function G(ie) {
8360
8360
  _.current = ie, window.clearTimeout(N.current), ie !== "" && (N.current = window.setTimeout(() => G(""), 1e3));
8361
8361
  })(ne), ke && setTimeout(() => ke.focus());
8362
8362
  };
8363
8363
  v.useEffect(() => () => window.clearTimeout(N.current), []), pl();
8364
- const F = v.useCallback((L) => {
8364
+ const L = v.useCallback((F) => {
8365
8365
  var Q, ge;
8366
- return z.current === ((Q = $.current) == null ? void 0 : Q.side) && K0(L, (ge = $.current) == null ? void 0 : ge.area);
8366
+ return z.current === ((Q = $.current) == null ? void 0 : Q.side) && K0(F, (ge = $.current) == null ? void 0 : ge.area);
8367
8367
  }, []);
8368
8368
  return /* @__PURE__ */ u.jsx(
8369
8369
  N0,
@@ -8371,36 +8371,36 @@ var In = "MenuContent", [N0, Rl] = zr(In), $f = v.forwardRef(
8371
8371
  scope: n,
8372
8372
  searchRef: _,
8373
8373
  onItemEnter: v.useCallback(
8374
- (L) => {
8375
- F(L) && L.preventDefault();
8374
+ (F) => {
8375
+ L(F) && F.preventDefault();
8376
8376
  },
8377
- [F]
8377
+ [L]
8378
8378
  ),
8379
8379
  onItemLeave: v.useCallback(
8380
- (L) => {
8380
+ (F) => {
8381
8381
  var ne;
8382
- F(L) || ((ne = k.current) == null || ne.focus(), b(null));
8382
+ L(F) || ((ne = k.current) == null || ne.focus(), b(null));
8383
8383
  },
8384
- [F]
8384
+ [L]
8385
8385
  ),
8386
8386
  onTriggerLeave: v.useCallback(
8387
- (L) => {
8388
- F(L) && L.preventDefault();
8387
+ (F) => {
8388
+ L(F) && F.preventDefault();
8389
8389
  },
8390
- [F]
8390
+ [L]
8391
8391
  ),
8392
8392
  pointerGraceTimerRef: M,
8393
- onPointerGraceIntentChange: v.useCallback((L) => {
8394
- $.current = L;
8393
+ onPointerGraceIntentChange: v.useCallback((F) => {
8394
+ $.current = F;
8395
8395
  }, []),
8396
8396
  children: /* @__PURE__ */ u.jsx(B, { ...j, children: /* @__PURE__ */ u.jsx(
8397
8397
  ui,
8398
8398
  {
8399
8399
  asChild: !0,
8400
8400
  trapped: o,
8401
- onMountAutoFocus: xe(s, (L) => {
8401
+ onMountAutoFocus: xe(s, (F) => {
8402
8402
  var ne;
8403
- L.preventDefault(), (ne = k.current) == null || ne.focus({ preventScroll: !0 });
8403
+ F.preventDefault(), (ne = k.current) == null || ne.focus({ preventScroll: !0 });
8404
8404
  }),
8405
8405
  onUnmountAutoFocus: i,
8406
8406
  children: /* @__PURE__ */ u.jsx(
@@ -8423,8 +8423,8 @@ var In = "MenuContent", [N0, Rl] = zr(In), $f = v.forwardRef(
8423
8423
  loop: r,
8424
8424
  currentTabStopId: C,
8425
8425
  onCurrentTabStopIdChange: b,
8426
- onEntryFocus: xe(l, (L) => {
8427
- y.isUsingKeyboardRef.current || L.preventDefault();
8426
+ onEntryFocus: xe(l, (F) => {
8427
+ y.isUsingKeyboardRef.current || F.preventDefault();
8428
8428
  }),
8429
8429
  preventScrollOnEntryFocus: !0,
8430
8430
  children: /* @__PURE__ */ u.jsx(
@@ -8439,25 +8439,25 @@ var In = "MenuContent", [N0, Rl] = zr(In), $f = v.forwardRef(
8439
8439
  ...g,
8440
8440
  ref: A,
8441
8441
  style: { outline: "none", ...g.style },
8442
- onKeyDown: xe(g.onKeyDown, (L) => {
8443
- const Q = L.target.closest("[data-radix-menu-content]") === L.currentTarget, ge = L.ctrlKey || L.altKey || L.metaKey, _e = L.key.length === 1;
8444
- Q && (L.key === "Tab" && L.preventDefault(), !ge && _e && W(L.key));
8445
- const J = k.current;
8446
- if (L.target !== J || !w0.includes(L.key)) return;
8447
- L.preventDefault();
8442
+ onKeyDown: xe(g.onKeyDown, (F) => {
8443
+ const Q = F.target.closest("[data-radix-menu-content]") === F.currentTarget, ge = F.ctrlKey || F.altKey || F.metaKey, _e = F.key.length === 1;
8444
+ Q && (F.key === "Tab" && F.preventDefault(), !ge && _e && W(F.key));
8445
+ const Z = k.current;
8446
+ if (F.target !== Z || !w0.includes(F.key)) return;
8447
+ F.preventDefault();
8448
8448
  const ke = T().filter((ee) => !ee.disabled).map((ee) => ee.ref.current);
8449
- Pf.includes(L.key) && ke.reverse(), H0(ke);
8449
+ Pf.includes(F.key) && ke.reverse(), H0(ke);
8450
8450
  }),
8451
- onBlur: xe(e.onBlur, (L) => {
8452
- L.currentTarget.contains(L.target) || (window.clearTimeout(N.current), _.current = "");
8451
+ onBlur: xe(e.onBlur, (F) => {
8452
+ F.currentTarget.contains(F.target) || (window.clearTimeout(N.current), _.current = "");
8453
8453
  }),
8454
8454
  onPointerMove: xe(
8455
8455
  e.onPointerMove,
8456
- Po((L) => {
8457
- const ne = L.target, Q = P.current !== L.clientX;
8458
- if (L.currentTarget.contains(ne) && Q) {
8459
- const ge = L.clientX > P.current ? "right" : "left";
8460
- z.current = ge, P.current = L.clientX;
8456
+ Po((F) => {
8457
+ const ne = F.target, Q = P.current !== F.clientX;
8458
+ if (F.currentTarget.contains(ne) && Q) {
8459
+ const ge = F.clientX > P.current ? "right" : "left";
8460
+ z.current = ge, P.current = F.clientX;
8461
8461
  }
8462
8462
  })
8463
8463
  )
@@ -9209,7 +9209,7 @@ function It(e = Nh) {
9209
9209
  e(t, r) || (t = r, n(r));
9210
9210
  };
9211
9211
  }
9212
- function je(e) {
9212
+ function Pe(e) {
9213
9213
  return (t) => (n) => {
9214
9214
  e(n) && t(n);
9215
9215
  };
@@ -9222,7 +9222,7 @@ function qn(e) {
9222
9222
  t(e);
9223
9223
  };
9224
9224
  }
9225
- function X(e, ...t) {
9225
+ function J(e, ...t) {
9226
9226
  const n = US(...t);
9227
9227
  return (r, o) => {
9228
9228
  switch (r) {
@@ -9368,7 +9368,7 @@ function Vt(...e) {
9368
9368
  };
9369
9369
  }
9370
9370
  function Ae(e, t = Nh) {
9371
- return X(e, It(t));
9371
+ return J(e, It(t));
9372
9372
  }
9373
9373
  function za(...e) {
9374
9374
  return function(t, n) {
@@ -9518,13 +9518,13 @@ const dn = ut(
9518
9518
  () => {
9519
9519
  const e = tt(), t = tt(), n = te(0), r = tt(), o = te(0), s = tt(), i = tt(), a = te(0), l = te(0), c = te(0), d = te(0), f = tt(), h = tt(), p = te(!1), m = te(!1), g = te(!1);
9520
9520
  return Se(
9521
- X(
9521
+ J(
9522
9522
  e,
9523
9523
  pe(({ scrollTop: x }) => x)
9524
9524
  ),
9525
9525
  t
9526
9526
  ), Se(
9527
- X(
9527
+ J(
9528
9528
  e,
9529
9529
  pe(({ scrollHeight: x }) => x)
9530
9530
  ),
@@ -9865,10 +9865,10 @@ const lC = {
9865
9865
  }, er = ut(
9866
9866
  ([{ log: e }, { recalcInProgress: t }]) => {
9867
9867
  const n = tt(), r = tt(), o = cn(r, 0), s = tt(), i = tt(), a = te(0), l = te([]), c = te(void 0), d = te(void 0), f = te((C, b) => mr(C, lC[b])), h = te(void 0), p = te(0), m = QS(), g = cn(
9868
- X(n, Ke(l, e, p), Xn(oC, m), It()),
9868
+ J(n, Ke(l, e, p), Xn(oC, m), It()),
9869
9869
  m
9870
9870
  ), x = cn(
9871
- X(
9871
+ J(
9872
9872
  l,
9873
9873
  It(),
9874
9874
  Xn((C, b) => ({ current: b, prev: C.current }), {
@@ -9880,9 +9880,9 @@ const lC = {
9880
9880
  []
9881
9881
  );
9882
9882
  Se(
9883
- X(
9883
+ J(
9884
9884
  l,
9885
- je((C) => C.length > 0),
9885
+ Pe((C) => C.length > 0),
9886
9886
  Ke(g, p),
9887
9887
  pe(([C, b, k]) => {
9888
9888
  const A = C.reduce((N, _, M) => vn(N, _, Lo(_, b.offsetTree, k) || M), eo());
@@ -9895,10 +9895,10 @@ const lC = {
9895
9895
  ),
9896
9896
  g
9897
9897
  ), Se(
9898
- X(
9898
+ J(
9899
9899
  r,
9900
9900
  Ke(g),
9901
- je(([C, { lastIndex: b }]) => C < b),
9901
+ Pe(([C, { lastIndex: b }]) => C < b),
9902
9902
  pe(([C, { lastIndex: b, lastSize: k }]) => [
9903
9903
  {
9904
9904
  endIndex: b,
@@ -9910,22 +9910,22 @@ const lC = {
9910
9910
  n
9911
9911
  ), Se(c, d);
9912
9912
  const y = cn(
9913
- X(
9913
+ J(
9914
9914
  c,
9915
9915
  pe((C) => C === void 0)
9916
9916
  ),
9917
9917
  !0
9918
9918
  );
9919
9919
  Se(
9920
- X(
9920
+ J(
9921
9921
  d,
9922
- je((C) => C !== void 0 && Ct(Ht(g).sizeTree)),
9922
+ Pe((C) => C !== void 0 && Ct(Ht(g).sizeTree)),
9923
9923
  pe((C) => [{ endIndex: 0, size: C, startIndex: 0 }])
9924
9924
  ),
9925
9925
  n
9926
9926
  );
9927
9927
  const w = bn(
9928
- X(
9928
+ J(
9929
9929
  n,
9930
9930
  Ke(g),
9931
9931
  Xn(
@@ -9939,7 +9939,7 @@ const lC = {
9939
9939
  )
9940
9940
  );
9941
9941
  mt(
9942
- X(
9942
+ J(
9943
9943
  a,
9944
9944
  Xn(
9945
9945
  (C, b) => ({ diff: C.prev - b, prev: b }),
@@ -9956,7 +9956,7 @@ const lC = {
9956
9956
  k.length > 0 && (C -= Tu(-C, k)), He(i, C);
9957
9957
  }
9958
9958
  }
9959
- ), mt(X(a, Ke(e)), ([C, b]) => {
9959
+ ), mt(J(a, Ke(e)), ([C, b]) => {
9960
9960
  C < 0 && b(
9961
9961
  "`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",
9962
9962
  { firstItemIndex: a },
@@ -9965,7 +9965,7 @@ const lC = {
9965
9965
  });
9966
9966
  const S = bn(s);
9967
9967
  Se(
9968
- X(
9968
+ J(
9969
9969
  s,
9970
9970
  Ke(g),
9971
9971
  pe(([C, b]) => {
@@ -10026,7 +10026,7 @@ const lC = {
10026
10026
  n
10027
10027
  );
10028
10028
  const T = bn(
10029
- X(
10029
+ J(
10030
10030
  i,
10031
10031
  Ke(g, p),
10032
10032
  pe(([C, { offsetTree: b }, k]) => {
@@ -10036,7 +10036,7 @@ const lC = {
10036
10036
  )
10037
10037
  );
10038
10038
  return Se(
10039
- X(
10039
+ J(
10040
10040
  i,
10041
10041
  Ke(g, p),
10042
10042
  pe(([C, b, k]) => {
@@ -10109,23 +10109,23 @@ function cC(e) {
10109
10109
  }
10110
10110
  const zh = ut(
10111
10111
  ([{ groupIndices: e, sizes: t, totalCount: n }, { headerHeight: r, scrollTop: o }]) => {
10112
- const s = tt(), i = tt(), a = bn(X(s, pe(cC)));
10112
+ const s = tt(), i = tt(), a = bn(J(s, pe(cC)));
10113
10113
  return Se(
10114
- X(
10114
+ J(
10115
10115
  a,
10116
10116
  pe((l) => l.totalCount)
10117
10117
  ),
10118
10118
  n
10119
10119
  ), Se(
10120
- X(
10120
+ J(
10121
10121
  a,
10122
10122
  pe((l) => l.groupIndices)
10123
10123
  ),
10124
10124
  e
10125
10125
  ), Se(
10126
- X(
10126
+ J(
10127
10127
  Vt(o, t, r),
10128
- je(([l, c]) => ki(c)),
10128
+ Pe(([l, c]) => ki(c)),
10129
10129
  pe(([l, c, d]) => $n(c.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
10130
10130
  It(),
10131
10131
  pe((l) => [l])
@@ -10137,9 +10137,9 @@ const zh = ut(
10137
10137
  ), wr = ut(
10138
10138
  ([{ log: e }]) => {
10139
10139
  const t = te(!1), n = bn(
10140
- X(
10140
+ J(
10141
10141
  t,
10142
- je((r) => r),
10142
+ Pe((r) => r),
10143
10143
  It()
10144
10144
  )
10145
10145
  );
@@ -10175,7 +10175,7 @@ const Xo = ut(
10175
10175
  x && (x(), x = null), w && (w(), w = null), y && (clearTimeout(y), y = null), He(l, !1);
10176
10176
  }
10177
10177
  return Se(
10178
- X(
10178
+ J(
10179
10179
  p,
10180
10180
  Ke(n, f, r, g, a, i, h),
10181
10181
  Ke(e, s, o),
@@ -10186,21 +10186,21 @@ const Xo = ut(
10186
10186
  z,
10187
10187
  P
10188
10188
  ]) => {
10189
- const B = Bh(T), { align: j, behavior: W, offset: F } = B, L = k - 1, ne = $h(B, C, L);
10189
+ const B = Bh(T), { align: j, behavior: W, offset: L } = B, F = k - 1, ne = $h(B, C, F);
10190
10190
  let Q = Lo(ne, C.offsetTree, $) + N;
10191
- j === "end" ? (Q += z + $n(C.sizeTree, ne)[1] - b + P, ne === L && (Q += _)) : j === "center" ? Q += (z + $n(C.sizeTree, ne)[1] - b + P) / 2 : Q -= A, F && (Q += F);
10191
+ j === "end" ? (Q += z + $n(C.sizeTree, ne)[1] - b + P, ne === F && (Q += _)) : j === "center" ? Q += (z + $n(C.sizeTree, ne)[1] - b + P) / 2 : Q -= A, L && (Q += L);
10192
10192
  const ge = (_e) => {
10193
10193
  S(), _e ? (M("retrying to scroll to", { location: T }, xn.DEBUG), He(p, T)) : (He(m, !0), M("list did not change, scroll successful", {}, xn.DEBUG));
10194
10194
  };
10195
10195
  if (S(), W === "smooth") {
10196
10196
  let _e = !1;
10197
- w = mt(t, (J) => {
10198
- _e = _e || J;
10197
+ w = mt(t, (Z) => {
10198
+ _e = _e || Z;
10199
10199
  }), x = Dn(d, () => {
10200
10200
  ge(_e);
10201
10201
  });
10202
10202
  } else
10203
- x = Dn(X(t, dC(150)), ge);
10203
+ x = Dn(J(t, dC(150)), ge);
10204
10204
  return y = setTimeout(() => {
10205
10205
  S();
10206
10206
  }, 1200), He(l, !0), M("scrolling from index to", { behavior: W, index: ne, top: Q }, xn.DEBUG), { behavior: W, top: Q };
@@ -10240,26 +10240,26 @@ const Jo = ut(
10240
10240
  ([{ defaultItemSize: e, listRefresh: t, sizes: n }, { scrollTop: r }, { scrollTargetReached: o, scrollToIndex: s }, { didMount: i }]) => {
10241
10241
  const a = te(!0), l = te(0), c = te(!0);
10242
10242
  return Se(
10243
- X(
10243
+ J(
10244
10244
  i,
10245
10245
  Ke(l),
10246
- je(([d, f]) => !!f),
10246
+ Pe(([d, f]) => !!f),
10247
10247
  qn(!1)
10248
10248
  ),
10249
10249
  a
10250
10250
  ), Se(
10251
- X(
10251
+ J(
10252
10252
  i,
10253
10253
  Ke(l),
10254
- je(([d, f]) => !!f),
10254
+ Pe(([d, f]) => !!f),
10255
10255
  qn(!1)
10256
10256
  ),
10257
10257
  c
10258
10258
  ), mt(
10259
- X(
10259
+ J(
10260
10260
  Vt(t, i),
10261
10261
  Ke(a, n, e, c),
10262
- je(([[, d], f, { sizeTree: h }, p, m]) => d && (!Ct(h) || _l(p)) && !f && !m),
10262
+ Pe(([[, d], f, { sizeTree: h }, p, m]) => d && (!Ct(h) || _l(p)) && !f && !m),
10263
10263
  Ke(l)
10264
10264
  ),
10265
10265
  ([, d]) => {
@@ -10294,25 +10294,25 @@ const Fo = "up", Co = "down", fC = "none", hC = {
10294
10294
  }
10295
10295
  }, pC = 0, Zo = ut(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
10296
10296
  const i = te(!1), a = te(!0), l = tt(), c = tt(), d = te(4), f = te(pC), h = cn(
10297
- X(
10298
- za(X(Ae(o), Dr(1), qn(!0)), X(Ae(o), Dr(1), qn(!1), bu(100))),
10297
+ J(
10298
+ za(J(Ae(o), Dr(1), qn(!0)), J(Ae(o), Dr(1), qn(!1), bu(100))),
10299
10299
  It()
10300
10300
  ),
10301
10301
  !1
10302
10302
  ), p = cn(
10303
- X(za(X(n, qn(!0)), X(n, qn(!1), bu(200))), It()),
10303
+ J(za(J(n, qn(!0)), J(n, qn(!1), bu(200))), It()),
10304
10304
  !1
10305
10305
  );
10306
10306
  Se(
10307
- X(
10307
+ J(
10308
10308
  Vt(Ae(o), Ae(f)),
10309
10309
  pe(([w, S]) => w <= S),
10310
10310
  It()
10311
10311
  ),
10312
10312
  a
10313
- ), Se(X(a, rr(50)), c);
10313
+ ), Se(J(a, rr(50)), c);
10314
10314
  const m = bn(
10315
- X(
10315
+ J(
10316
10316
  Vt(r, Ae(s), Ae(t), Ae(e), Ae(d)),
10317
10317
  Xn((w, [{ scrollHeight: S, scrollTop: T }, C, b, k, A]) => {
10318
10318
  const N = T + C - S > -A, _ = {
@@ -10339,7 +10339,7 @@ const Fo = "up", Co = "down", fC = "none", hC = {
10339
10339
  It((w, S) => w && w.atBottom === S.atBottom)
10340
10340
  )
10341
10341
  ), g = cn(
10342
- X(
10342
+ J(
10343
10343
  r,
10344
10344
  Xn(
10345
10345
  (w, { scrollHeight: S, scrollTop: T, viewportHeight: C }) => {
@@ -10367,21 +10367,21 @@ const Fo = "up", Co = "down", fC = "none", hC = {
10367
10367
  },
10368
10368
  { changed: !1, jump: 0, scrollHeight: 0, scrollTop: 0 }
10369
10369
  ),
10370
- je((w) => w.changed),
10370
+ Pe((w) => w.changed),
10371
10371
  pe((w) => w.jump)
10372
10372
  ),
10373
10373
  0
10374
10374
  );
10375
10375
  Se(
10376
- X(
10376
+ J(
10377
10377
  m,
10378
10378
  pe((w) => w.atBottom)
10379
10379
  ),
10380
10380
  i
10381
- ), Se(X(i, rr(50)), l);
10381
+ ), Se(J(i, rr(50)), l);
10382
10382
  const x = te(Co);
10383
10383
  Se(
10384
- X(
10384
+ J(
10385
10385
  r,
10386
10386
  pe(({ scrollTop: w }) => w),
10387
10387
  It(),
@@ -10392,21 +10392,21 @@ const Fo = "up", Co = "down", fC = "none", hC = {
10392
10392
  pe((w) => w.direction)
10393
10393
  ),
10394
10394
  x
10395
- ), Se(X(r, rr(50), qn(fC)), x);
10395
+ ), Se(J(r, rr(50), qn(fC)), x);
10396
10396
  const y = te(0);
10397
10397
  return Se(
10398
- X(
10398
+ J(
10399
10399
  h,
10400
- je((w) => !w),
10400
+ Pe((w) => !w),
10401
10401
  qn(0)
10402
10402
  ),
10403
10403
  y
10404
10404
  ), Se(
10405
- X(
10405
+ J(
10406
10406
  o,
10407
10407
  rr(100),
10408
10408
  Ke(h),
10409
- je(([w, S]) => !!S),
10409
+ Pe(([w, S]) => !!S),
10410
10410
  Xn(([w, S], [T]) => [S, T], [0, 0]),
10411
10411
  pe(([w, S]) => S - w)
10412
10412
  ),
@@ -10435,7 +10435,7 @@ function Eu(e, t) {
10435
10435
  const Fl = ut(
10436
10436
  ([{ deviation: e, fixedHeaderHeight: t, headerHeight: n, scrollTop: r, viewportHeight: o }]) => {
10437
10437
  const s = tt(), i = te(0), a = te(0), l = te(0), c = cn(
10438
- X(
10438
+ J(
10439
10439
  Vt(
10440
10440
  Ae(r),
10441
10441
  Ae(o),
@@ -10468,7 +10468,7 @@ const Fl = ut(
10468
10468
  ] : null;
10469
10469
  }
10470
10470
  ),
10471
- je((d) => d != null),
10471
+ Pe((d) => d != null),
10472
10472
  It(Do)
10473
10473
  ),
10474
10474
  [0, 0]
@@ -10584,7 +10584,7 @@ const Ur = ut(
10584
10584
  const g = te([]), x = te(0), y = tt();
10585
10585
  Se(s.topItemsIndexes, g);
10586
10586
  const w = cn(
10587
- X(
10587
+ J(
10588
10588
  Vt(
10589
10589
  p,
10590
10590
  m,
@@ -10598,7 +10598,7 @@ const Ur = ut(
10598
10598
  Ae(n),
10599
10599
  e
10600
10600
  ),
10601
- je(([b, k, , A, , , , , , , N]) => {
10601
+ Pe(([b, k, , A, , , , , , , N]) => {
10602
10602
  const _ = N && N.length !== A;
10603
10603
  return b && !k && !_;
10604
10604
  }),
@@ -10616,13 +10616,13 @@ const Ur = ut(
10616
10616
  P,
10617
10617
  B
10618
10618
  ]) => {
10619
- const j = N, { offsetTree: W, sizeTree: F } = j, L = Ht(x);
10619
+ const j = N, { offsetTree: W, sizeTree: L } = j, F = Ht(x);
10620
10620
  if (A === 0)
10621
10621
  return { ...da, totalCount: A };
10622
10622
  if (b === 0 && k === 0)
10623
- return L === 0 ? { ...da, totalCount: A } : Uh(L, _, N, z, P, B || []);
10624
- if (Ct(F))
10625
- return L > 0 ? null : Es(
10623
+ return F === 0 ? { ...da, totalCount: A } : Uh(F, _, N, z, P, B || []);
10624
+ if (Ct(L))
10625
+ return F > 0 ? null : Es(
10626
10626
  mC(Ll(_, A), j, B),
10627
10627
  [],
10628
10628
  A,
@@ -10632,11 +10632,11 @@ const Ur = ut(
10632
10632
  );
10633
10633
  const ne = [];
10634
10634
  if ($.length > 0) {
10635
- const ue = $[0], ke = $[$.length - 1];
10635
+ const de = $[0], ke = $[$.length - 1];
10636
10636
  let ee = 0;
10637
- for (const D of Ti(F, ue, ke)) {
10638
- const G = D.value, ie = Math.max(D.start, ue), le = Math.min(D.end, ke);
10639
- for (let H = ie; H <= le; H++)
10637
+ for (const D of Ti(L, de, ke)) {
10638
+ const G = D.value, ie = Math.max(D.start, de), ce = Math.min(D.end, ke);
10639
+ for (let H = ie; H <= ce; H++)
10640
10640
  ne.push({ data: B == null ? void 0 : B[H], index: H, offset: ee, size: G }), ee += G;
10641
10641
  }
10642
10642
  }
@@ -10645,7 +10645,7 @@ const Ur = ut(
10645
10645
  const Q = $.length > 0 ? $[$.length - 1] + 1 : 0, ge = rC(W, b, k, Q);
10646
10646
  if (ge.length === 0)
10647
10647
  return null;
10648
- const _e = A - 1, J = Ci([], (ue) => {
10648
+ const _e = A - 1, Z = Ci([], (de) => {
10649
10649
  for (const ke of ge) {
10650
10650
  const ee = ke.value;
10651
10651
  let D = ee.offset, G = ke.start;
@@ -10656,68 +10656,68 @@ const Ur = ut(
10656
10656
  D += H * ie + H * P;
10657
10657
  }
10658
10658
  G < Q && (D += (Q - G) * ie, G = Q);
10659
- const le = Math.min(ke.end, _e);
10660
- for (let H = G; H <= le && !(D >= k); H++)
10661
- ue.push({ data: B == null ? void 0 : B[H], index: H, offset: D, size: ie }), D += ie + P;
10659
+ const ce = Math.min(ke.end, _e);
10660
+ for (let H = G; H <= ce && !(D >= k); H++)
10661
+ de.push({ data: B == null ? void 0 : B[H], index: H, offset: D, size: ie }), D += ie + P;
10662
10662
  }
10663
10663
  });
10664
- return Es(J, ne, A, P, j, z);
10664
+ return Es(Z, ne, A, P, j, z);
10665
10665
  }
10666
10666
  ),
10667
10667
  //@ts-expect-error filter needs to be fixed
10668
- je((b) => b !== null),
10668
+ Pe((b) => b !== null),
10669
10669
  It()
10670
10670
  ),
10671
10671
  da
10672
10672
  );
10673
10673
  Se(
10674
- X(
10674
+ J(
10675
10675
  e,
10676
- je(_l),
10676
+ Pe(_l),
10677
10677
  pe((b) => b == null ? void 0 : b.length)
10678
10678
  ),
10679
10679
  o
10680
10680
  ), Se(
10681
- X(
10681
+ J(
10682
10682
  w,
10683
10683
  pe((b) => b.topListHeight)
10684
10684
  ),
10685
10685
  f
10686
10686
  ), Se(f, a), Se(
10687
- X(
10687
+ J(
10688
10688
  w,
10689
10689
  pe((b) => [b.top, b.bottom])
10690
10690
  ),
10691
10691
  i
10692
10692
  ), Se(
10693
- X(
10693
+ J(
10694
10694
  w,
10695
10695
  pe((b) => b.items)
10696
10696
  ),
10697
10697
  y
10698
10698
  );
10699
10699
  const S = bn(
10700
- X(
10700
+ J(
10701
10701
  w,
10702
- je(({ items: b }) => b.length > 0),
10702
+ Pe(({ items: b }) => b.length > 0),
10703
10703
  Ke(o, e),
10704
- je(([{ items: b }, k]) => b[b.length - 1].originalIndex === k - 1),
10704
+ Pe(([{ items: b }, k]) => b[b.length - 1].originalIndex === k - 1),
10705
10705
  pe(([, b, k]) => [b - 1, k]),
10706
10706
  It(Do),
10707
10707
  pe(([b]) => b)
10708
10708
  )
10709
10709
  ), T = bn(
10710
- X(
10710
+ J(
10711
10711
  w,
10712
10712
  rr(200),
10713
- je(({ items: b, topItems: k }) => b.length > 0 && b[0].originalIndex === k.length),
10713
+ Pe(({ items: b, topItems: k }) => b.length > 0 && b[0].originalIndex === k.length),
10714
10714
  pe(({ items: b }) => b[0].index),
10715
10715
  It()
10716
10716
  )
10717
10717
  ), C = bn(
10718
- X(
10718
+ J(
10719
10719
  w,
10720
- je(({ items: b }) => b.length > 0),
10720
+ Pe(({ items: b }) => b.length > 0),
10721
10721
  pe(({ items: b }) => {
10722
10722
  let k = 0, A = b.length - 1;
10723
10723
  for (; b[k].type === "group" && k < A; )
@@ -10748,7 +10748,7 @@ const Ur = ut(
10748
10748
  ), Wh = ut(
10749
10749
  ([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: n, headerHeight: r }, { listState: o }]) => {
10750
10750
  const s = tt(), i = cn(
10751
- X(
10751
+ J(
10752
10752
  Vt(n, e, r, t, o),
10753
10753
  pe(([a, l, c, d, f]) => a + l + c + d + f.offsetBottom + f.bottom)
10754
10754
  ),
@@ -10761,9 +10761,9 @@ const Ur = ut(
10761
10761
  ), gC = ut(
10762
10762
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
10763
10763
  const n = te(!1), r = cn(
10764
- X(
10764
+ J(
10765
10765
  Vt(n, e, t),
10766
- je(([o]) => o),
10766
+ Pe(([o]) => o),
10767
10767
  pe(([, o, s]) => Math.max(0, o - s)),
10768
10768
  rr(0),
10769
10769
  It()
@@ -10790,7 +10790,7 @@ const Ur = ut(
10790
10790
  ]) => {
10791
10791
  const d = tt();
10792
10792
  return Se(
10793
- X(
10793
+ J(
10794
10794
  d,
10795
10795
  Ke(t, l, n, s, o, r, a),
10796
10796
  Ke(e),
@@ -10803,9 +10803,9 @@ const Ur = ut(
10803
10803
  viewportTop: $
10804
10804
  });
10805
10805
  return P ? k && Dn(
10806
- X(
10806
+ J(
10807
10807
  i,
10808
- je((B) => !B),
10808
+ Pe((B) => !B),
10809
10809
  // skips the initial publish of false, and the cleanup call.
10810
10810
  // but if scrollingInProgress is true, we skip the initial publish.
10811
10811
  Dr(Ht(i) ? 1 : 2)
@@ -10813,7 +10813,7 @@ const Ur = ut(
10813
10813
  k
10814
10814
  ) : k && k(), P;
10815
10815
  }),
10816
- je((f) => f !== null)
10816
+ Pe((f) => f !== null)
10817
10817
  ),
10818
10818
  c
10819
10819
  ), {
@@ -10848,14 +10848,14 @@ const yC = (e, t) => typeof e == "function" ? Nu(e(t)) : t && Nu(e), vC = ut(
10848
10848
  });
10849
10849
  }
10850
10850
  mt(
10851
- X(
10852
- Vt(X(Ae(t), Dr(1)), l),
10851
+ J(
10852
+ Vt(J(Ae(t), Dr(1)), l),
10853
10853
  Ke(Ae(m), s, a, f),
10854
10854
  pe(([[C, b], k, A, N, _]) => {
10855
10855
  let M = b && N, $ = "auto";
10856
10856
  return M && ($ = yC(k, A || _), M = M && !!$), { followOutputBehavior: $, shouldFollow: M, totalCount: C };
10857
10857
  }),
10858
- je(({ shouldFollow: C }) => C)
10858
+ Pe(({ shouldFollow: C }) => C)
10859
10859
  ),
10860
10860
  ({ followOutputBehavior: C, totalCount: b }) => {
10861
10861
  x && (x(), x = null), Ht(n) ? requestAnimationFrame(() => {
@@ -10872,14 +10872,14 @@ const yC = (e, t) => typeof e == "function" ? Nu(e(t)) : t && Nu(e), vC = ut(
10872
10872
  setTimeout(b, 100);
10873
10873
  }
10874
10874
  mt(
10875
- X(
10875
+ J(
10876
10876
  Vt(Ae(m), t, c),
10877
- je(([C, , b]) => C && b),
10877
+ Pe(([C, , b]) => C && b),
10878
10878
  Xn(
10879
10879
  ({ value: C }, [, b]) => ({ refreshed: C === b, value: b }),
10880
10880
  { refreshed: !1, value: 0 }
10881
10881
  ),
10882
- je(({ refreshed: C }) => C),
10882
+ Pe(({ refreshed: C }) => C),
10883
10883
  Ke(m, t)
10884
10884
  ),
10885
10885
  ([, C]) => {
@@ -10893,22 +10893,22 @@ const yC = (e, t) => typeof e == "function" ? Nu(e(t)) : t && Nu(e), vC = ut(
10893
10893
  const S = te(null), T = tt();
10894
10894
  return Se(
10895
10895
  za(
10896
- X(
10896
+ J(
10897
10897
  Ae(r),
10898
10898
  pe((C) => {
10899
10899
  var b;
10900
10900
  return (b = C == null ? void 0 : C.length) != null ? b : 0;
10901
10901
  })
10902
10902
  ),
10903
- X(Ae(t))
10903
+ J(Ae(t))
10904
10904
  ),
10905
10905
  T
10906
10906
  ), mt(
10907
- X(
10908
- Vt(X(T, Dr(1)), l),
10907
+ J(
10908
+ Vt(J(T, Dr(1)), l),
10909
10909
  Ke(Ae(S), a, f, h),
10910
10910
  pe(([[C, b], k, A, N, _]) => b && A && (k == null ? void 0 : k({ context: _, totalCount: C, scrollingInProgress: N }))),
10911
- je((C) => !!C),
10911
+ Pe((C) => !!C),
10912
10912
  rr(0)
10913
10913
  ),
10914
10914
  (C) => {
@@ -10933,10 +10933,10 @@ const yC = (e, t) => typeof e == "function" ? Nu(e(t)) : t && Nu(e), vC = ut(
10933
10933
  )
10934
10934
  ), wC = ut(
10935
10935
  ([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (Se(
10936
- X(
10936
+ J(
10937
10937
  a,
10938
10938
  Ke(s),
10939
- je(([, l]) => l !== 0),
10939
+ Pe(([, l]) => l !== 0),
10940
10940
  Ke(o, r, t, n, e),
10941
10941
  pe(([[, l], c, d, f, h, p = []]) => Uh(l, c, d, f, h, p))
10942
10942
  ),
@@ -10948,18 +10948,18 @@ const yC = (e, t) => typeof e == "function" ? Nu(e(t)) : t && Nu(e), vC = ut(
10948
10948
  ([{ didMount: e }, { scrollTo: t }, { listState: n }]) => {
10949
10949
  const r = te(0);
10950
10950
  return mt(
10951
- X(
10951
+ J(
10952
10952
  e,
10953
10953
  Ke(r),
10954
- je(([, o]) => o !== 0),
10954
+ Pe(([, o]) => o !== 0),
10955
10955
  pe(([, o]) => ({ top: o }))
10956
10956
  ),
10957
10957
  (o) => {
10958
10958
  Dn(
10959
- X(
10959
+ J(
10960
10960
  n,
10961
10961
  Dr(1),
10962
- je((s) => s.items.length > 1)
10962
+ Pe((s) => s.items.length > 1)
10963
10963
  ),
10964
10964
  () => {
10965
10965
  requestAnimationFrame(() => {
@@ -10978,10 +10978,10 @@ const yC = (e, t) => typeof e == "function" ? Nu(e(t)) : t && Nu(e), vC = ut(
10978
10978
  ([{ scrollVelocity: e }]) => {
10979
10979
  const t = te(!1), n = tt(), r = te(!1);
10980
10980
  return Se(
10981
- X(
10981
+ J(
10982
10982
  e,
10983
10983
  Ke(r, t, n),
10984
- je(([o, s]) => !!s),
10984
+ Pe(([o, s]) => !!s),
10985
10985
  pe(([o, s, i, a]) => {
10986
10986
  const { enter: l, exit: c } = s;
10987
10987
  if (i) {
@@ -10995,7 +10995,7 @@ const yC = (e, t) => typeof e == "function" ? Nu(e(t)) : t && Nu(e), vC = ut(
10995
10995
  ),
10996
10996
  t
10997
10997
  ), mt(
10998
- X(Vt(t, e, n), Ke(r)),
10998
+ J(Vt(t, e, n), Ke(r)),
10999
10999
  ([[o, s, i], a]) => {
11000
11000
  o && a && a.change && a.change(s, i);
11001
11001
  }
@@ -11006,7 +11006,7 @@ const yC = (e, t) => typeof e == "function" ? Nu(e(t)) : t && Nu(e), vC = ut(
11006
11006
  ), $l = ut(([{ scrollContainerState: e, scrollTo: t }]) => {
11007
11007
  const n = tt(), r = tt(), o = tt(), s = te(!1), i = te(void 0);
11008
11008
  return Se(
11009
- X(
11009
+ J(
11010
11010
  Vt(n, r),
11011
11011
  pe(([{ scrollHeight: a, scrollTop: l, viewportHeight: c }, { offsetTop: d }]) => ({
11012
11012
  scrollHeight: a,
@@ -11016,7 +11016,7 @@ const yC = (e, t) => typeof e == "function" ? Nu(e(t)) : t && Nu(e), vC = ut(
11016
11016
  ),
11017
11017
  e
11018
11018
  ), Se(
11019
- X(
11019
+ J(
11020
11020
  t,
11021
11021
  Ke(r),
11022
11022
  pe(([a, { offsetTop: l }]) => ({
@@ -11045,7 +11045,7 @@ const yC = (e, t) => typeof e == "function" ? Nu(e(t)) : t && Nu(e), vC = ut(
11045
11045
  ]) => {
11046
11046
  const c = tt(), d = te(void 0), f = te(null), h = te(null);
11047
11047
  return Se(a, f), Se(l, h), mt(
11048
- X(
11048
+ J(
11049
11049
  c,
11050
11050
  Ke(t, r, i, f, h, n)
11051
11051
  ),
@@ -11053,11 +11053,11 @@ const yC = (e, t) => typeof e == "function" ? Nu(e(t)) : t && Nu(e), vC = ut(
11053
11053
  const T = sC(m.sizeTree);
11054
11054
  x && y !== null && w !== null && (g = y.scrollTop - w.offsetTop), g -= S, p({ ranges: T, scrollTop: g });
11055
11055
  }
11056
- ), Se(X(d, je(_l), pe(CC)), o), Se(
11057
- X(
11056
+ ), Se(J(d, Pe(_l), pe(CC)), o), Se(
11057
+ J(
11058
11058
  s,
11059
11059
  Ke(d),
11060
- je(([, p]) => p !== void 0),
11060
+ Pe(([, p]) => p !== void 0),
11061
11061
  It(),
11062
11062
  pe(([, p]) => p.ranges)
11063
11063
  ),
@@ -11075,9 +11075,9 @@ function CC(e) {
11075
11075
  const TC = ut(([{ topItemsIndexes: e }]) => {
11076
11076
  const t = te(0);
11077
11077
  return Se(
11078
- X(
11078
+ J(
11079
11079
  t,
11080
- je((n) => n >= 0),
11080
+ Pe((n) => n >= 0),
11081
11081
  pe((n) => Array.from({ length: n }).map((r, o) => o))
11082
11082
  ),
11083
11083
  e
@@ -11097,7 +11097,7 @@ const kC = Gh(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
11097
11097
  { recalcInProgress: m }
11098
11098
  ]) => {
11099
11099
  const g = bn(
11100
- X(
11100
+ J(
11101
11101
  l,
11102
11102
  Ke(i),
11103
11103
  Xn(
@@ -11108,33 +11108,33 @@ const kC = Gh(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
11108
11108
  },
11109
11109
  [0, [], 0, 0]
11110
11110
  ),
11111
- je(([y]) => y !== 0),
11111
+ Pe(([y]) => y !== 0),
11112
11112
  Ke(r, a, n, o, p, m),
11113
- je(([, y, w, S, , , T]) => !T && !S && y !== 0 && w === Fo),
11113
+ Pe(([, y, w, S, , , T]) => !T && !S && y !== 0 && w === Fo),
11114
11114
  pe(([[y], , , , , w]) => (w("Upward scrolling compensation", { amount: y }, xn.DEBUG), y))
11115
11115
  )
11116
11116
  );
11117
11117
  function x(y) {
11118
11118
  y > 0 ? (He(t, { behavior: "auto", top: -y }), He(e, 0)) : (He(e, 0), He(t, { behavior: "auto", top: -y }));
11119
11119
  }
11120
- return mt(X(g, Ke(e, s)), ([y, w, S]) => {
11120
+ return mt(J(g, Ke(e, s)), ([y, w, S]) => {
11121
11121
  S && kC() ? He(e, w - y) : x(-y);
11122
11122
  }), mt(
11123
- X(
11123
+ J(
11124
11124
  Vt(cn(s, !1), e, m),
11125
- je(([y, w, S]) => !y && !S && w !== 0),
11125
+ Pe(([y, w, S]) => !y && !S && w !== 0),
11126
11126
  pe(([y, w]) => w),
11127
11127
  rr(1)
11128
11128
  ),
11129
11129
  x
11130
11130
  ), Se(
11131
- X(
11131
+ J(
11132
11132
  f,
11133
11133
  pe((y) => ({ top: -y }))
11134
11134
  ),
11135
11135
  t
11136
11136
  ), mt(
11137
- X(
11137
+ J(
11138
11138
  c,
11139
11139
  Ke(h, d),
11140
11140
  pe(([y, { groupIndices: w, lastSize: S, sizeTree: T }, C]) => {
@@ -11232,7 +11232,7 @@ const kC = Gh(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
11232
11232
  { groupCounts: A },
11233
11233
  N
11234
11234
  ]) => (Se(T.rangeChanged, N.scrollSeekRangeChanged), Se(
11235
- X(
11235
+ J(
11236
11236
  N.windowViewportRect,
11237
11237
  pe((_) => _.visibleHeight)
11238
11238
  ),
@@ -11438,7 +11438,7 @@ function Bl(e) {
11438
11438
  }
11439
11439
  const AC = /* @__PURE__ */ ut(() => {
11440
11440
  const e = te((a) => `Item ${a}`), t = te((a) => `Group ${a}`), n = te({}), r = te(Bl), o = te("div"), s = te(ho), i = (a, l = null) => cn(
11441
- X(
11441
+ J(
11442
11442
  n,
11443
11443
  pe((c) => c[a]),
11444
11444
  It()
@@ -11751,7 +11751,7 @@ const BC = ({ children: e }) => {
11751
11751
  "Group ",
11752
11752
  c
11753
11753
  ] })), r = te(null), o = te(null), s = te({}), i = te(Bl), a = te(ho), l = (c, d = null) => cn(
11754
- X(
11754
+ J(
11755
11755
  s,
11756
11756
  pe((f) => f[c]),
11757
11757
  It()
@@ -11823,70 +11823,70 @@ const QC = /* @__PURE__ */ ut(
11823
11823
  { customScrollParent: x, useWindowScroll: y, windowScrollContainerState: w, windowScrollTo: S, windowViewportRect: T },
11824
11824
  C
11825
11825
  ]) => {
11826
- const b = te(0), k = te(0), A = te(ju), N = te({ height: 0, width: 0 }), _ = te({ height: 0, width: 0 }), M = tt(), $ = tt(), z = te(0), P = te(null), B = te({ column: 0, row: 0 }), j = tt(), W = tt(), F = te(!1), L = te(0), ne = te(!0), Q = te(!1), ge = te(!1);
11826
+ const b = te(0), k = te(0), A = te(ju), N = te({ height: 0, width: 0 }), _ = te({ height: 0, width: 0 }), M = tt(), $ = tt(), z = te(0), P = te(null), B = te({ column: 0, row: 0 }), j = tt(), W = tt(), L = te(!1), F = te(0), ne = te(!0), Q = te(!1), ge = te(!1);
11827
11827
  mt(
11828
- X(
11828
+ J(
11829
11829
  m,
11830
- Ke(L),
11831
- je(([D, G]) => !!G)
11830
+ Ke(F),
11831
+ Pe(([D, G]) => !!G)
11832
11832
  ),
11833
11833
  () => {
11834
11834
  He(ne, !1);
11835
11835
  }
11836
11836
  ), mt(
11837
- X(
11838
- Vt(m, ne, _, N, L, Q),
11839
- je(([D, G, ie, le, , H]) => D && !G && ie.height !== 0 && le.height !== 0 && !H)
11837
+ J(
11838
+ Vt(m, ne, _, N, F, Q),
11839
+ Pe(([D, G, ie, ce, , H]) => D && !G && ie.height !== 0 && ce.height !== 0 && !H)
11840
11840
  ),
11841
11841
  ([, , , , D]) => {
11842
11842
  He(Q, !0), Dl(1, () => {
11843
11843
  He(M, D);
11844
- }), Dn(X(c), () => {
11844
+ }), Dn(J(c), () => {
11845
11845
  He(t, [0, 0]), He(ne, !0);
11846
11846
  });
11847
11847
  }
11848
11848
  ), Se(
11849
- X(
11849
+ J(
11850
11850
  W,
11851
- je((D) => D != null && D.scrollTop > 0),
11851
+ Pe((D) => D != null && D.scrollTop > 0),
11852
11852
  qn(0)
11853
11853
  ),
11854
11854
  k
11855
11855
  ), mt(
11856
- X(
11856
+ J(
11857
11857
  m,
11858
11858
  Ke(W),
11859
- je(([, D]) => D != null)
11859
+ Pe(([, D]) => D != null)
11860
11860
  ),
11861
11861
  ([, D]) => {
11862
- D && (He(N, D.viewport), He(_, D.item), He(B, D.gap), D.scrollTop > 0 && (He(F, !0), Dn(X(c, Dr(1)), (G) => {
11863
- He(F, !1);
11862
+ D && (He(N, D.viewport), He(_, D.item), He(B, D.gap), D.scrollTop > 0 && (He(L, !0), Dn(J(c, Dr(1)), (G) => {
11863
+ He(L, !1);
11864
11864
  }), He(l, { top: D.scrollTop })));
11865
11865
  }
11866
11866
  ), Se(
11867
- X(
11867
+ J(
11868
11868
  N,
11869
11869
  pe(({ height: D }) => D)
11870
11870
  ),
11871
11871
  f
11872
11872
  ), Se(
11873
- X(
11873
+ J(
11874
11874
  Vt(
11875
11875
  Ae(N, ds),
11876
11876
  Ae(_, ds),
11877
11877
  Ae(B, (D, G) => D && D.column === G.column && D.row === G.row),
11878
11878
  Ae(c)
11879
11879
  ),
11880
- pe(([D, G, ie, le]) => ({
11880
+ pe(([D, G, ie, ce]) => ({
11881
11881
  gap: ie,
11882
11882
  item: G,
11883
- scrollTop: le,
11883
+ scrollTop: ce,
11884
11884
  viewport: D
11885
11885
  }))
11886
11886
  ),
11887
11887
  j
11888
11888
  ), Se(
11889
- X(
11889
+ J(
11890
11890
  Vt(
11891
11891
  Ae(b),
11892
11892
  r,
@@ -11895,25 +11895,25 @@ const QC = /* @__PURE__ */ ut(
11895
11895
  Ae(N, ds),
11896
11896
  Ae(P),
11897
11897
  Ae(k),
11898
- Ae(F),
11898
+ Ae(L),
11899
11899
  Ae(ne),
11900
- Ae(L)
11900
+ Ae(F)
11901
11901
  ),
11902
- je(([, , , , , , , D]) => !D),
11902
+ Pe(([, , , , , , , D]) => !D),
11903
11903
  pe(
11904
11904
  ([
11905
11905
  D,
11906
11906
  [G, ie],
11907
- le,
11907
+ ce,
11908
11908
  H,
11909
11909
  We,
11910
11910
  re,
11911
11911
  ye,
11912
11912
  ,
11913
- Pe,
11913
+ Oe,
11914
11914
  Fe
11915
11915
  ]) => {
11916
- const { column: rt, row: Te } = le, { height: Ye, width: ot } = H, { width: Je } = We;
11916
+ const { column: rt, row: Te } = ce, { height: Ye, width: ot } = H, { width: Je } = We;
11917
11917
  if (ye === 0 && (D === 0 || Je === 0))
11918
11918
  return ju;
11919
11919
  if (ot === 0) {
@@ -11922,26 +11922,26 @@ const QC = /* @__PURE__ */ ut(
11922
11922
  }
11923
11923
  const Xe = op(Je, ot, rt);
11924
11924
  let qe, Ze;
11925
- Pe ? G === 0 && ie === 0 && ye > 0 ? (qe = 0, Ze = ye - 1) : (qe = Xe * Us((G + Te) / (Ye + Te)), Ze = Xe * Pu((ie + Te) / (Ye + Te)) - 1, Ze = pa(D - 1, To(Ze, Xe - 1)), qe = pa(Ze, To(0, qe))) : (qe = 0, Ze = -1);
11926
- const zt = Mu(qe, Ze, re), { bottom: kt, top: Qe } = Du(We, le, H, zt), vt = Pu(D / Xe), At = vt * Ye + (vt - 1) * Te - kt;
11925
+ Oe ? G === 0 && ie === 0 && ye > 0 ? (qe = 0, Ze = ye - 1) : (qe = Xe * Us((G + Te) / (Ye + Te)), Ze = Xe * Pu((ie + Te) / (Ye + Te)) - 1, Ze = pa(D - 1, To(Ze, Xe - 1)), qe = pa(Ze, To(0, qe))) : (qe = 0, Ze = -1);
11926
+ const zt = Mu(qe, Ze, re), { bottom: kt, top: Qe } = Du(We, ce, H, zt), wt = Pu(D / Xe), At = wt * Ye + (wt - 1) * Te - kt;
11927
11927
  return { bottom: kt, itemHeight: Ye, items: zt, itemWidth: ot, offsetBottom: At, offsetTop: Qe, top: Qe };
11928
11928
  }
11929
11929
  )
11930
11930
  ),
11931
11931
  A
11932
11932
  ), Se(
11933
- X(
11933
+ J(
11934
11934
  P,
11935
- je((D) => D !== null),
11935
+ Pe((D) => D !== null),
11936
11936
  pe((D) => D.length)
11937
11937
  ),
11938
11938
  b
11939
11939
  ), Se(
11940
- X(
11940
+ J(
11941
11941
  Vt(N, _, A, B),
11942
- je(([D, G, { items: ie }]) => ie.length > 0 && G.height !== 0 && D.height !== 0),
11943
- pe(([D, G, { items: ie }, le]) => {
11944
- const { bottom: H, top: We } = Du(D, le, G, ie);
11942
+ Pe(([D, G, { items: ie }]) => ie.length > 0 && G.height !== 0 && D.height !== 0),
11943
+ pe(([D, G, { items: ie }, ce]) => {
11944
+ const { bottom: H, top: We } = Du(D, ce, G, ie);
11945
11945
  return [We, H];
11946
11946
  }),
11947
11947
  It(Do)
@@ -11950,37 +11950,37 @@ const QC = /* @__PURE__ */ ut(
11950
11950
  );
11951
11951
  const _e = te(!1);
11952
11952
  Se(
11953
- X(
11953
+ J(
11954
11954
  c,
11955
11955
  Ke(_e),
11956
11956
  pe(([D, G]) => G || D !== 0)
11957
11957
  ),
11958
11958
  _e
11959
11959
  );
11960
- const J = bn(
11961
- X(
11960
+ const Z = bn(
11961
+ J(
11962
11962
  Vt(A, b),
11963
- je(([{ items: D }]) => D.length > 0),
11963
+ Pe(([{ items: D }]) => D.length > 0),
11964
11964
  Ke(_e),
11965
- je(([[D, G], ie]) => {
11966
- const le = D.items[D.items.length - 1].index === G - 1;
11967
- return (ie || D.bottom > 0 && D.itemHeight > 0 && D.offsetBottom === 0 && D.items.length === G) && le;
11965
+ Pe(([[D, G], ie]) => {
11966
+ const ce = D.items[D.items.length - 1].index === G - 1;
11967
+ return (ie || D.bottom > 0 && D.itemHeight > 0 && D.offsetBottom === 0 && D.items.length === G) && ce;
11968
11968
  }),
11969
11969
  pe(([[, D]]) => D - 1),
11970
11970
  It()
11971
11971
  )
11972
- ), ue = bn(
11973
- X(
11972
+ ), de = bn(
11973
+ J(
11974
11974
  Ae(A),
11975
- je(({ items: D }) => D.length > 0 && D[0].index === 0),
11975
+ Pe(({ items: D }) => D.length > 0 && D[0].index === 0),
11976
11976
  qn(0),
11977
11977
  It()
11978
11978
  )
11979
11979
  ), ke = bn(
11980
- X(
11980
+ J(
11981
11981
  Ae(A),
11982
- Ke(F),
11983
- je(([{ items: D }, G]) => D.length > 0 && !G),
11982
+ Ke(L),
11983
+ Pe(([{ items: D }, G]) => D.length > 0 && !G),
11984
11984
  pe(([{ items: D }]) => ({
11985
11985
  endIndex: D[D.length - 1].index,
11986
11986
  startIndex: D[0].index
@@ -11990,28 +11990,28 @@ const QC = /* @__PURE__ */ ut(
11990
11990
  )
11991
11991
  );
11992
11992
  Se(ke, p.scrollSeekRangeChanged), Se(
11993
- X(
11993
+ J(
11994
11994
  M,
11995
11995
  Ke(N, _, b, B),
11996
- pe(([D, G, ie, le, H]) => {
11997
- const We = Bh(D), { align: re, behavior: ye, offset: Pe } = We;
11996
+ pe(([D, G, ie, ce, H]) => {
11997
+ const We = Bh(D), { align: re, behavior: ye, offset: Oe } = We;
11998
11998
  let Fe = We.index;
11999
- Fe === "LAST" && (Fe = le - 1), Fe = To(0, Fe, pa(le - 1, Fe));
11999
+ Fe === "LAST" && (Fe = ce - 1), Fe = To(0, Fe, pa(ce - 1, Fe));
12000
12000
  let rt = Va(G, H, ie, Fe);
12001
- return re === "end" ? rt = Ou(rt - G.height + ie.height) : re === "center" && (rt = Ou(rt - G.height / 2 + ie.height / 2)), Pe && (rt += Pe), { behavior: ye, top: rt };
12001
+ return re === "end" ? rt = Ou(rt - G.height + ie.height) : re === "center" && (rt = Ou(rt - G.height / 2 + ie.height / 2)), Oe && (rt += Oe), { behavior: ye, top: rt };
12002
12002
  })
12003
12003
  ),
12004
12004
  l
12005
12005
  );
12006
12006
  const ee = cn(
12007
- X(
12007
+ J(
12008
12008
  A,
12009
12009
  pe((D) => D.offsetBottom + D.bottom)
12010
12010
  ),
12011
12011
  0
12012
12012
  );
12013
12013
  return Se(
12014
- X(
12014
+ J(
12015
12015
  T,
12016
12016
  pe((D) => ({ height: D.visibleHeight, width: D.visibleWidth }))
12017
12017
  ),
@@ -12046,15 +12046,15 @@ const QC = /* @__PURE__ */ ut(
12046
12046
  // output
12047
12047
  gridState: A,
12048
12048
  horizontalDirection: ge,
12049
- initialTopMostItemIndex: L,
12049
+ initialTopMostItemIndex: F,
12050
12050
  totalListHeight: ee,
12051
12051
  ...h,
12052
- endReached: J,
12052
+ endReached: Z,
12053
12053
  propsReady: g,
12054
12054
  rangeChanged: ke,
12055
- startReached: ue,
12055
+ startReached: de,
12056
12056
  stateChanged: j,
12057
- stateRestoreInProgress: F,
12057
+ stateRestoreInProgress: L,
12058
12058
  ...C
12059
12059
  };
12060
12060
  },
@@ -12076,7 +12076,7 @@ function Va(e, t, n, r) {
12076
12076
  }
12077
12077
  const eT = /* @__PURE__ */ ut(() => {
12078
12078
  const e = te((f) => `Item ${f}`), t = te({}), n = te(null), r = te("virtuoso-grid-item"), o = te("virtuoso-grid-list"), s = te(Bl), i = te("div"), a = te(ho), l = (f, h = null) => cn(
12079
- X(
12079
+ J(
12080
12080
  t,
12081
12081
  pe((p) => p[f]),
12082
12082
  It()
@@ -12865,7 +12865,7 @@ function PT({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
12865
12865
  }
12866
12866
  }
12867
12867
  }, [n]);
12868
- bt(() => {
12868
+ St(() => {
12869
12869
  e && n && h();
12870
12870
  }, [e, n, h]);
12871
12871
  const p = async () => {
@@ -14627,7 +14627,7 @@ function Ku(e) {
14627
14627
  }
14628
14628
  function tk({ className: e }) {
14629
14629
  const [t, n] = we(0);
14630
- return bt(() => {
14630
+ return St(() => {
14631
14631
  const r = setInterval(() => n((o) => (o + 1) % 4), 500);
14632
14632
  return () => clearInterval(r);
14633
14633
  }, []), /* @__PURE__ */ u.jsxs(
@@ -14669,14 +14669,14 @@ const qu = V.memo(function({
14669
14669
  defaultCheckpointId: A = null,
14670
14670
  messageParentCheckpointId: N = null
14671
14671
  }) {
14672
- const [_, M] = we(!1), [$, z] = we("preview"), [P, B] = we(!1), { currentThreadId: j } = ul(), { respondToInterrupt: W } = dl(), F = l === "phone" || l === "half-screen", L = t.role, ne = L === "tool", Q = ct(() => "type" in t && t.type === "default_message" ? t : null, [t]), ge = !!Q, _e = !(r && L !== "user"), {
14673
- uploadingFiles: J,
14674
- handleFileClick: ue,
14672
+ const [_, M] = we(!1), [$, z] = we("preview"), [P, B] = we(!1), { currentThreadId: j } = ul(), { respondToInterrupt: W } = dl(), L = l === "phone" || l === "half-screen", F = t.role, ne = F === "tool", Q = ct(() => "type" in t && t.type === "default_message" ? t : null, [t]), ge = !!Q, _e = !(r && F !== "user"), {
14673
+ uploadingFiles: Z,
14674
+ handleFileClick: de,
14675
14675
  fileViewerOpen: ke,
14676
14676
  currentFileInfo: ee,
14677
14677
  closeFileViewer: D
14678
14678
  } = rk({ allowFileOpen: _e, currentThreadId: j }), G = V.useMemo(() => {
14679
- switch (L) {
14679
+ switch (F) {
14680
14680
  case "user":
14681
14681
  return "text-[hsl(var(--chat-bubble-user-text))]";
14682
14682
  case "assistant":
@@ -14688,7 +14688,7 @@ const qu = V.memo(function({
14688
14688
  default:
14689
14689
  return "text-[hsl(var(--chat-bubble-ai-text))]";
14690
14690
  }
14691
- }, [L]), ie = ct(() => Q ? "" : ZT(t.content), [Q, t]), le = ct(() => Q ? {} : Bp(t), [Q, t]), H = ct(
14691
+ }, [F]), ie = ct(() => Q ? "" : ZT(t.content), [Q, t]), ce = ct(() => Q ? {} : Bp(t), [Q, t]), H = ct(
14692
14692
  () => Q ? [] : t.content.filter((Y) => Y.type === "image_url"),
14693
14693
  [Q, t]
14694
14694
  ), We = ct(
@@ -14697,7 +14697,7 @@ const qu = V.memo(function({
14697
14697
  ), re = ct(
14698
14698
  () => Q ? [] : t.content.filter((Y) => Y.type === "interrupt"),
14699
14699
  [Q, t]
14700
- ), ye = (y == null ? void 0 : y.id) ?? (y == null ? void 0 : y.interrupt_id), Pe = hs(ye), Fe = y == null ? void 0 : y.value, rt = ct(() => Q ? "" : QT(t.content), [Q, t]), Te = V.useCallback(async () => {
14700
+ ), ye = (y == null ? void 0 : y.id) ?? (y == null ? void 0 : y.interrupt_id), Oe = hs(ye), Fe = y == null ? void 0 : y.value, rt = ct(() => Q ? "" : QT(t.content), [Q, t]), Te = V.useCallback(async () => {
14701
14701
  const Y = ne ? rt : ie;
14702
14702
  async function Re(ve) {
14703
14703
  if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
@@ -14730,8 +14730,8 @@ const qu = V.memo(function({
14730
14730
  }, [p, t.id, ne, rt, ie, t]), ot = V.useCallback(() => {
14731
14731
  m == null || m(n);
14732
14732
  }, [m, n]), Je = V.useCallback(() => {
14733
- const Re = oe(F ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", G);
14734
- switch (L) {
14733
+ const Re = oe(L ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", G);
14734
+ switch (F) {
14735
14735
  case "user":
14736
14736
  return /* @__PURE__ */ u.jsx(kg, { className: Re });
14737
14737
  case "assistant":
@@ -14741,9 +14741,9 @@ const qu = V.memo(function({
14741
14741
  default:
14742
14742
  return /* @__PURE__ */ u.jsx(Bi, { className: Re });
14743
14743
  }
14744
- }, [F, G, L]), Xe = V.useCallback(() => {
14744
+ }, [L, G, F]), Xe = V.useCallback(() => {
14745
14745
  const Y = "group relative mb-4 flex w-full";
14746
- switch (L) {
14746
+ switch (F) {
14747
14747
  case "user":
14748
14748
  return oe(Y, "justify-end");
14749
14749
  case "assistant":
@@ -14753,10 +14753,10 @@ const qu = V.memo(function({
14753
14753
  default:
14754
14754
  return Y;
14755
14755
  }
14756
- }, [L]), qe = V.useCallback(() => {
14756
+ }, [F]), qe = V.useCallback(() => {
14757
14757
  const Y = oe(
14758
14758
  "rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
14759
- F && "px-3 py-2 text-sm"
14759
+ L && "px-3 py-2 text-sm"
14760
14760
  );
14761
14761
  if (ge)
14762
14762
  return oe(
@@ -14765,7 +14765,7 @@ const qu = V.memo(function({
14765
14765
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
14766
14766
  "border border-border/60 dark:border-border/40 shadow-sm"
14767
14767
  );
14768
- switch (L) {
14768
+ switch (F) {
14769
14769
  case "user":
14770
14770
  return oe(
14771
14771
  Y,
@@ -14792,7 +14792,7 @@ const qu = V.memo(function({
14792
14792
  "border border-border/60 dark:border-border/40"
14793
14793
  );
14794
14794
  }
14795
- }, [F, ge, L]);
14795
+ }, [L, ge, F]);
14796
14796
  if (ge && Q)
14797
14797
  return /* @__PURE__ */ u.jsx("div", { className: oe(Xe(), h.container), children: /* @__PURE__ */ u.jsxs("div", { className: oe(qe(), h.content), children: [
14798
14798
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 mb-2 pb-2 border-b border-current/10", children: [
@@ -14844,14 +14844,14 @@ const qu = V.memo(function({
14844
14844
  }, [w, T, S, W]), kt = V.useCallback(({ part: Y, i: Re }) => {
14845
14845
  if (Y.type === "text") {
14846
14846
  const ve = Y.text ?? "", gt = ve.trim(), xt = Wl(gt);
14847
- return xt && L !== "tool" ? /* @__PURE__ */ u.jsx(Hp, { data: xt }, Re) : L === "user" && c && gt.length > d ? /* @__PURE__ */ u.jsx(
14847
+ return xt && F !== "tool" ? /* @__PURE__ */ u.jsx(Hp, { data: xt }, Re) : F === "user" && c && gt.length > d ? /* @__PURE__ */ u.jsx(
14848
14848
  ok,
14849
14849
  {
14850
14850
  text: gt,
14851
14851
  expanded: P,
14852
14852
  onExpandedChange: B,
14853
14853
  previewLength: d,
14854
- isCompact: F
14854
+ isCompact: L
14855
14855
  },
14856
14856
  Re
14857
14857
  ) : /* @__PURE__ */ u.jsx(Gs, { content: ve, allowHtml: !1 }, Re);
@@ -14874,14 +14874,14 @@ const qu = V.memo(function({
14874
14874
  "a",
14875
14875
  {
14876
14876
  href: ve.url,
14877
- onClick: (xt) => ue(xt, ve, Re),
14877
+ onClick: (xt) => de(xt, ve, Re),
14878
14878
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
14879
14879
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
14880
14880
  children: [
14881
- J[Re] ? /* @__PURE__ */ u.jsx(tl, { className: "h-4 w-4 animate-spin" }) : null,
14881
+ Z[Re] ? /* @__PURE__ */ u.jsx(tl, { className: "h-4 w-4 animate-spin" }) : null,
14882
14882
  /* @__PURE__ */ u.jsxs("span", { className: "truncate max-w-[180px]", children: [
14883
14883
  gt,
14884
- J[Re] ? " (processing)" : ""
14884
+ Z[Re] ? " (processing)" : ""
14885
14885
  ] })
14886
14886
  ]
14887
14887
  },
@@ -14891,11 +14891,11 @@ const qu = V.memo(function({
14891
14891
  if (Y.type === "interrupt") {
14892
14892
  const ve = Y, gt = hs(
14893
14893
  (ve == null ? void 0 : ve.id) ?? (ve == null ? void 0 : ve.interrupt_id)
14894
- ), xt = !!(Pe && gt && gt === Pe), Pt = xt ? Fe ?? (ve == null ? void 0 : ve.value) : ve == null ? void 0 : ve.value, Oe = gt ? { ...ve, id: gt, interrupt_id: gt } : ve;
14894
+ ), xt = !!(Oe && gt && gt === Oe), Pt = xt ? Fe ?? (ve == null ? void 0 : ve.value) : ve == null ? void 0 : ve.value, je = gt ? { ...ve, id: gt, interrupt_id: gt } : ve;
14895
14895
  return /* @__PURE__ */ u.jsx(
14896
14896
  nk,
14897
14897
  {
14898
- interruptPart: Oe,
14898
+ interruptPart: je,
14899
14899
  onApprove: Ze,
14900
14900
  onReject: zt,
14901
14901
  disabled: w,
@@ -14907,16 +14907,16 @@ const qu = V.memo(function({
14907
14907
  }
14908
14908
  return null;
14909
14909
  }, [
14910
- ue,
14911
- J,
14910
+ de,
14911
+ Z,
14912
14912
  Ze,
14913
14913
  zt,
14914
- L,
14914
+ F,
14915
14915
  c,
14916
14916
  d,
14917
14917
  P,
14918
- F,
14919
- Pe,
14918
+ L,
14919
+ Oe,
14920
14920
  Fe,
14921
14921
  y,
14922
14922
  w,
@@ -14924,7 +14924,7 @@ const qu = V.memo(function({
14924
14924
  ]), Qe = V.useCallback(() => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/30 rounded", children: [
14925
14925
  /* @__PURE__ */ u.jsx(ya, { className: "h-4 w-4 text-muted-foreground" }),
14926
14926
  /* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
14927
- ] }), []), vt = V.useCallback(() => {
14927
+ ] }), []), wt = V.useCallback(() => {
14928
14928
  const Y = ie.trim().length > 0 || H.length > 0 || We.length > 0 || re.length > 0;
14929
14929
  if (!ne && We.length > 0 && !r)
14930
14930
  return Qe();
@@ -14959,7 +14959,7 @@ const qu = V.memo(function({
14959
14959
  ]), At = ct(() => Q ? "Assistant" : ek(t), [Q, t]), st = V.useMemo(() => Q ? [] : Array.isArray(C) ? C : [], [C, Q]), Jt = V.useMemo(() => {
14960
14960
  var Y;
14961
14961
  return st.length ? A && st.some((Re) => Re.id === A) ? A : ((Y = st[0]) == null ? void 0 : Y.id) ?? null : null;
14962
- }, [A, st]), Qt = V.useMemo(() => !st.length || !b ? null : st.some((Y) => Y.id === b) ? b : null, [b, st]) ?? Jt, en = L === "user" && st.length > 0 && typeof k == "function", ft = V.useCallback(
14962
+ }, [A, st]), Qt = V.useMemo(() => !st.length || !b ? null : st.some((Y) => Y.id === b) ? b : null, [b, st]) ?? Jt, en = F === "user" && st.length > 0 && typeof k == "function", ft = V.useCallback(
14963
14963
  (Y) => {
14964
14964
  if (!k) return;
14965
14965
  const Re = (Y == null ? void 0 : Y.id) ?? null, ve = (Y == null ? void 0 : Y.parentId) ?? N ?? null;
@@ -14989,14 +14989,14 @@ const qu = V.memo(function({
14989
14989
  {
14990
14990
  className: oe(
14991
14991
  "flex items-center justify-between mb-2 pb-2 border-b border-current/10",
14992
- F && "mb-1 pb-1",
14992
+ L && "mb-1 pb-1",
14993
14993
  G,
14994
14994
  h.header
14995
14995
  ),
14996
14996
  children: [
14997
14997
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
14998
14998
  Je(),
14999
- a && At && /* @__PURE__ */ u.jsx("span", { className: oe("font-medium", F ? "text-xs" : "text-sm"), children: At }),
14999
+ a && At && /* @__PURE__ */ u.jsx("span", { className: oe("font-medium", L ? "text-xs" : "text-sm"), children: At }),
15000
15000
  ne && /* @__PURE__ */ u.jsxs(
15001
15001
  ip,
15002
15002
  {
@@ -15005,7 +15005,7 @@ const qu = V.memo(function({
15005
15005
  "text-xs flex items-center gap-1 cursor-pointer select-none",
15006
15006
  G,
15007
15007
  "border border-current/40",
15008
- F && "text-xs h-4"
15008
+ L && "text-xs h-4"
15009
15009
  ),
15010
15010
  role: "button",
15011
15011
  tabIndex: 0,
@@ -15015,8 +15015,8 @@ const qu = V.memo(function({
15015
15015
  (Y.key === "Enter" || Y.key === " ") && (Y.preventDefault(), z((Re) => Re === "expanded" ? "preview" : "expanded"));
15016
15016
  },
15017
15017
  children: [
15018
- /* @__PURE__ */ u.jsx("span", { children: le.name ?? "Tool Output" }),
15019
- le.toolCallId && /* @__PURE__ */ u.jsx("span", { className: "opacity-70", children: le.toolCallId.slice(0, 8) }),
15018
+ /* @__PURE__ */ u.jsx("span", { children: ce.name ?? "Tool Output" }),
15019
+ ce.toolCallId && /* @__PURE__ */ u.jsx("span", { className: "opacity-70", children: ce.toolCallId.slice(0, 8) }),
15020
15020
  $ === "expanded" ? /* @__PURE__ */ u.jsx(nl, { className: "h-3 w-3" }) : /* @__PURE__ */ u.jsx(ei, { className: "h-3 w-3" })
15021
15021
  ]
15022
15022
  }
@@ -15072,7 +15072,7 @@ const qu = V.memo(function({
15072
15072
  i && t.createdAt && /* @__PURE__ */ u.jsx(
15073
15073
  "time",
15074
15074
  {
15075
- className: oe("text-xs opacity-60", G, F && "text-xs"),
15075
+ className: oe("text-xs opacity-60", G, L && "text-xs"),
15076
15076
  dateTime: new Date(t.createdAt).toISOString(),
15077
15077
  title: new Date(t.createdAt).toLocaleString(),
15078
15078
  children: new Intl.DateTimeFormat(void 0, { hour: "2-digit", minute: "2-digit" }).format(new Date(t.createdAt))
@@ -15093,32 +15093,32 @@ const qu = V.memo(function({
15093
15093
  variant: "ghost",
15094
15094
  size: "sm",
15095
15095
  onClick: () => Te(),
15096
- className: oe("h-6 w-6 p-0 hover:bg-foreground/10", G, F && "h-5 w-5"),
15096
+ className: oe("h-6 w-6 p-0 hover:bg-foreground/10", G, L && "h-5 w-5"),
15097
15097
  "aria-label": "Copy message",
15098
15098
  title: "Copy message",
15099
- children: /* @__PURE__ */ u.jsx(hc, { className: oe(_ ? "text-success" : G, F ? "h-3 w-3" : "h-4 w-4") })
15099
+ children: /* @__PURE__ */ u.jsx(hc, { className: oe(_ ? "text-success" : G, L ? "h-3 w-3" : "h-4 w-4") })
15100
15100
  }
15101
15101
  ) }),
15102
- L === "user" && p && /* @__PURE__ */ u.jsx(
15102
+ F === "user" && p && /* @__PURE__ */ u.jsx(
15103
15103
  pt,
15104
15104
  {
15105
15105
  variant: "ghost",
15106
15106
  size: "sm",
15107
15107
  onClick: Ye,
15108
- className: oe("h-6 w-6 p-0 hover:bg-foreground/10", G, F && "h-5 w-5"),
15108
+ className: oe("h-6 w-6 p-0 hover:bg-foreground/10", G, L && "h-5 w-5"),
15109
15109
  "aria-label": "Edit message",
15110
- children: /* @__PURE__ */ u.jsx(pc, { className: oe(G, F ? "h-3 w-3" : "h-4 w-4") })
15110
+ children: /* @__PURE__ */ u.jsx(pc, { className: oe(G, L ? "h-3 w-3" : "h-4 w-4") })
15111
15111
  }
15112
15112
  ),
15113
- L === "assistant" && m && /* @__PURE__ */ u.jsx(
15113
+ F === "assistant" && m && /* @__PURE__ */ u.jsx(
15114
15114
  pt,
15115
15115
  {
15116
15116
  variant: "ghost",
15117
15117
  size: "sm",
15118
15118
  onClick: ot,
15119
- className: oe("h-6 w-6 p-0 hover:bg-foreground/10", G, F && "h-5 w-5"),
15119
+ className: oe("h-6 w-6 p-0 hover:bg-foreground/10", G, L && "h-5 w-5"),
15120
15120
  "aria-label": "Regenerate response",
15121
- children: /* @__PURE__ */ u.jsx(va, { className: oe(G, F ? "h-3 w-3" : "h-4 w-4") })
15121
+ children: /* @__PURE__ */ u.jsx(va, { className: oe(G, L ? "h-3 w-3" : "h-4 w-4") })
15122
15122
  }
15123
15123
  )
15124
15124
  ]
@@ -15128,15 +15128,15 @@ const qu = V.memo(function({
15128
15128
  ]
15129
15129
  }
15130
15130
  ),
15131
- /* @__PURE__ */ u.jsx("div", { className: "relative", children: vt() }),
15132
- ne && $ === "expanded" && (le.toolCallId || le.name) && /* @__PURE__ */ u.jsxs("div", { className: oe("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", F && "text-xs"), children: [
15133
- le.name && /* @__PURE__ */ u.jsxs("div", { children: [
15131
+ /* @__PURE__ */ u.jsx("div", { className: "relative", children: wt() }),
15132
+ ne && $ === "expanded" && (ce.toolCallId || ce.name) && /* @__PURE__ */ u.jsxs("div", { className: oe("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", L && "text-xs"), children: [
15133
+ ce.name && /* @__PURE__ */ u.jsxs("div", { children: [
15134
15134
  "Function: ",
15135
- le.name
15135
+ ce.name
15136
15136
  ] }),
15137
- le.toolCallId && /* @__PURE__ */ u.jsxs("div", { children: [
15137
+ ce.toolCallId && /* @__PURE__ */ u.jsxs("div", { children: [
15138
15138
  "Call ID: ",
15139
- le.toolCallId
15139
+ ce.toolCallId
15140
15140
  ] })
15141
15141
  ] }),
15142
15142
  !(i || a || ne) && s && !o && /* @__PURE__ */ u.jsxs(
@@ -15154,28 +15154,28 @@ const qu = V.memo(function({
15154
15154
  variant: "ghost",
15155
15155
  size: "sm",
15156
15156
  onClick: () => Te(),
15157
- className: oe("h-6 w-6 p-0 hover:bg-background/50 text-current", F && "h-5 w-5"),
15158
- children: /* @__PURE__ */ u.jsx(hc, { className: oe(_ ? "text-success" : "text-current", F ? "h-3 w-3" : "h-4 w-4") })
15157
+ className: oe("h-6 w-6 p-0 hover:bg-background/50 text-current", L && "h-5 w-5"),
15158
+ children: /* @__PURE__ */ u.jsx(hc, { className: oe(_ ? "text-success" : "text-current", L ? "h-3 w-3" : "h-4 w-4") })
15159
15159
  }
15160
15160
  ),
15161
- L === "user" && p && /* @__PURE__ */ u.jsx(
15161
+ F === "user" && p && /* @__PURE__ */ u.jsx(
15162
15162
  pt,
15163
15163
  {
15164
15164
  variant: "ghost",
15165
15165
  size: "sm",
15166
15166
  onClick: Ye,
15167
- className: oe("h-6 w-6 p-0 hover:bg-background/50 text-current", F && "h-5 w-5"),
15168
- children: /* @__PURE__ */ u.jsx(pc, { className: oe("text-current", F ? "h-3 w-3" : "h-4 w-4") })
15167
+ className: oe("h-6 w-6 p-0 hover:bg-background/50 text-current", L && "h-5 w-5"),
15168
+ children: /* @__PURE__ */ u.jsx(pc, { className: oe("text-current", L ? "h-3 w-3" : "h-4 w-4") })
15169
15169
  }
15170
15170
  ),
15171
- L === "assistant" && m && /* @__PURE__ */ u.jsx(
15171
+ F === "assistant" && m && /* @__PURE__ */ u.jsx(
15172
15172
  pt,
15173
15173
  {
15174
15174
  variant: "ghost",
15175
15175
  size: "sm",
15176
15176
  onClick: ot,
15177
- className: oe("h-6 w-6 p-0 hover:bg-background/50 text-current", F && "h-5 w-5"),
15178
- children: /* @__PURE__ */ u.jsx(va, { className: oe("text-current", F ? "h-3 w-3" : "h-4 w-4") })
15177
+ className: oe("h-6 w-6 p-0 hover:bg-background/50 text-current", L && "h-5 w-5"),
15178
+ children: /* @__PURE__ */ u.jsx(va, { className: oe("text-current", L ? "h-3 w-3" : "h-4 w-4") })
15179
15179
  }
15180
15180
  )
15181
15181
  ]
@@ -15458,16 +15458,16 @@ const Gu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, ik = (e) =>
15458
15458
  onSelectCheckpoint: _,
15459
15459
  timelineCheckpoints: M
15460
15460
  }, $) => {
15461
- const z = be(null), P = be(null), B = be(!1), [j, W] = we(!0), F = ct(() => w ? e.some((re) => "type" in re && re.type === "default_message" ? !1 : Array.isArray(re == null ? void 0 : re.content) && re.content.some(
15461
+ const z = be(null), P = be(null), B = be(!1), [j, W] = we(!0), L = ct(() => w ? e.some((re) => "type" in re && re.type === "default_message" ? !1 : Array.isArray(re == null ? void 0 : re.content) && re.content.some(
15462
15462
  (ye) => ye && ye.type === "interrupt" && (ye.id ?? ye.interrupt_id) === w.id
15463
- )) : !1, [w, e]), L = ct(() => {
15464
- if (!w || F)
15463
+ )) : !1, [w, e]), F = ct(() => {
15464
+ if (!w || L)
15465
15465
  return null;
15466
15466
  const re = w.id && String(w.id).trim() ? String(w.id).trim() : "pending-interrupt";
15467
15467
  let ye;
15468
- const Pe = w.value;
15469
- if (Pe && typeof Pe == "object" && !Array.isArray(Pe)) {
15470
- const Fe = Pe.title;
15468
+ const Oe = w.value;
15469
+ if (Oe && typeof Oe == "object" && !Array.isArray(Oe)) {
15470
+ const Fe = Oe.title;
15471
15471
  typeof Fe == "string" && Fe.trim() && (ye = Fe.trim());
15472
15472
  }
15473
15473
  return {
@@ -15478,15 +15478,15 @@ const Gu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, ik = (e) =>
15478
15478
  {
15479
15479
  type: "interrupt",
15480
15480
  id: re,
15481
- value: Pe,
15481
+ value: Oe,
15482
15482
  title: ye
15483
15483
  }
15484
15484
  ]
15485
15485
  };
15486
- }, [w, F]), ne = ct(() => L ? [...e, L] : e, [e, L]), Q = ct(() => b ? ne : ne.filter((re) => (re == null ? void 0 : re.role) !== "tool"), [ne, b]), ge = ct(() => {
15486
+ }, [w, L]), ne = ct(() => F ? [...e, F] : e, [e, F]), Q = ct(() => b ? ne : ne.filter((re) => (re == null ? void 0 : re.role) !== "tool"), [ne, b]), ge = ct(() => {
15487
15487
  const re = /* @__PURE__ */ new Set(), ye = [];
15488
- for (let Pe = Q.length - 1; Pe >= 0; Pe--) {
15489
- const Fe = Q[Pe];
15488
+ for (let Oe = Q.length - 1; Oe >= 0; Oe--) {
15489
+ const Fe = Q[Oe];
15490
15490
  if (!Fe) continue;
15491
15491
  if ("type" in Fe && Fe.type === "default_message") {
15492
15492
  ye.push(Fe);
@@ -15496,9 +15496,9 @@ const Gu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, ik = (e) =>
15496
15496
  re.has(Te) || (re.add(Te), ye.push(rt));
15497
15497
  }
15498
15498
  return ye.reverse();
15499
- }, [Q]), _e = de((re) => {
15499
+ }, [Q]), _e = fe((re) => {
15500
15500
  W(re), x && x(!re), y && y(re);
15501
- }, [x, y]), J = ct(() => {
15501
+ }, [x, y]), Z = ct(() => {
15502
15502
  if (a)
15503
15503
  return async () => {
15504
15504
  if (!B.current) {
@@ -15510,7 +15510,7 @@ const Gu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, ik = (e) =>
15510
15510
  }
15511
15511
  }
15512
15512
  };
15513
- }, [a]), ue = ct(() => !m || g ? !1 : j ? "auto" : !1, [j, m, g]), ke = ct(() => M ?? [], [M]), ee = N ?? (ke.length ? ke[ke.length - 1].id : null), D = ke.length > 0, G = ct(() => {
15513
+ }, [a]), de = ct(() => !m || g ? !1 : j ? "auto" : !1, [j, m, g]), ke = ct(() => M ?? [], [M]), ee = N ?? (ke.length ? ke[ke.length - 1].id : null), D = ke.length > 0, G = ct(() => {
15514
15514
  if (typeof p != "string") return null;
15515
15515
  const re = p.trim();
15516
15516
  return re ? {
@@ -15569,7 +15569,7 @@ const Gu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, ik = (e) =>
15569
15569
  children: "Latest"
15570
15570
  }
15571
15571
  )
15572
- ] }) : null, le = ["flex h-full flex-col md:flex-row", f].filter(Boolean).join(" "), H = () => G ? /* @__PURE__ */ u.jsx("div", { className: "p-6 h-full overflow-y-auto", children: /* @__PURE__ */ u.jsx("div", { className: "w-full max-w-full", children: /* @__PURE__ */ u.jsx(
15572
+ ] }) : null, ce = ["flex h-full flex-col md:flex-row", f].filter(Boolean).join(" "), H = () => G ? /* @__PURE__ */ u.jsx("div", { className: "p-6 h-full overflow-y-auto", children: /* @__PURE__ */ u.jsx("div", { className: "w-full max-w-full", children: /* @__PURE__ */ u.jsx(
15573
15573
  qu,
15574
15574
  {
15575
15575
  message: G,
@@ -15593,9 +15593,9 @@ const Gu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, ik = (e) =>
15593
15593
  scrollToLatest: () => {
15594
15594
  var re, ye;
15595
15595
  if (z.current && ge.length > 0) {
15596
- const Pe = ge.length - 1;
15596
+ const Oe = ge.length - 1;
15597
15597
  (ye = (re = z.current).scrollToIndex) == null || ye.call(re, {
15598
- index: Pe,
15598
+ index: Oe,
15599
15599
  align: "end",
15600
15600
  behavior: "auto"
15601
15601
  });
@@ -15611,7 +15611,7 @@ const Gu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, ik = (e) =>
15611
15611
  }
15612
15612
  }),
15613
15613
  [ge]
15614
- ), /* @__PURE__ */ u.jsxs("div", { className: le, style: h, children: [
15614
+ ), /* @__PURE__ */ u.jsxs("div", { className: ce, style: h, children: [
15615
15615
  ie,
15616
15616
  /* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0", children: We ? /* @__PURE__ */ u.jsx(
15617
15617
  GC,
@@ -15623,29 +15623,29 @@ const Gu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, ik = (e) =>
15623
15623
  P.current = re instanceof HTMLDivElement ? re : null;
15624
15624
  },
15625
15625
  data: ge,
15626
- followOutput: ue,
15626
+ followOutput: de,
15627
15627
  overscan: 200,
15628
15628
  increaseViewportBy: { top: 100, bottom: 200 },
15629
15629
  defaultItemHeight: 80,
15630
15630
  atBottomThreshold: 50,
15631
15631
  alignToBottom: !1,
15632
15632
  startReached: () => {
15633
- J && J();
15633
+ Z && Z();
15634
15634
  },
15635
15635
  atBottomStateChange: _e,
15636
15636
  style: { height: "100%", overscrollBehavior: "contain" },
15637
15637
  computeItemKey: (re, ye) => Gu(ye, re),
15638
15638
  itemContent: (re, ye) => {
15639
15639
  var Ze;
15640
- const Pe = Gu(ye, re), Fe = "type" in ye && ye.type === "default_message";
15640
+ const Oe = Gu(ye, re), Fe = "type" in ye && ye.type === "default_message";
15641
15641
  let rt = [], Te = null, Ye = {}, ot = {}, Je = null, Xe = null;
15642
15642
  if (!Fe) {
15643
15643
  const zt = ye, kt = zt.checkpointId ?? null;
15644
15644
  Ye = zt.additionalKwargs ?? {}, ot = zt.responseMetadata ?? {};
15645
15645
  const Qe = kt && k ? k.get(kt) ?? null : null;
15646
15646
  Je = typeof Ye.step == "number" ? Ye.step : typeof ot.step == "number" ? ot.step : (Qe == null ? void 0 : Qe.step) ?? null;
15647
- const vt = typeof Ye.source == "string" ? Ye.source : typeof ot.source == "string" ? ot.source : (Qe == null ? void 0 : Qe.source) ?? null;
15648
- Xe = vt ? String(vt) : null;
15647
+ const wt = typeof Ye.source == "string" ? Ye.source : typeof ot.source == "string" ? ot.source : (Qe == null ? void 0 : Qe.source) ?? null;
15648
+ Xe = wt ? String(wt) : null;
15649
15649
  const At = Je !== null && Xe ? `${Je}:${Xe}` : null;
15650
15650
  At && (A != null && A.has(At)) ? rt = A.get(At) ?? [] : kt && Qe && (rt = [Qe]), Te = kt ?? ((Ze = rt[0]) == null ? void 0 : Ze.id) ?? null;
15651
15651
  }
@@ -15659,7 +15659,7 @@ const Gu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, ik = (e) =>
15659
15659
  "div",
15660
15660
  {
15661
15661
  className: "relative mb-4 last:mb-0",
15662
- "data-message-id": Pe,
15662
+ "data-message-id": Oe,
15663
15663
  style: {
15664
15664
  minHeight: "60px",
15665
15665
  containIntrinsicSize: "auto 120px"
@@ -15732,45 +15732,45 @@ function xa({
15732
15732
  checkpoints: _,
15733
15733
  interrupt: M,
15734
15734
  metadata: $
15735
- } = dl(), { isStreaming: z, error: P, connectionState: B, submit: j, stop: W } = Rv(), F = y ?? x ?? null, L = (N == null ? void 0 : N.id) ?? null, ne = (N == null ? void 0 : N.namespace) ?? null, Q = ($ == null ? void 0 : $.assemblingMessageId) ?? null, ge = M, [_e, J] = we(!1);
15736
- bt(() => {
15737
- ge || J(!1);
15735
+ } = dl(), { isStreaming: z, error: P, connectionState: B, submit: j, stop: W } = Rv(), L = y ?? x ?? null, F = (N == null ? void 0 : N.id) ?? null, ne = (N == null ? void 0 : N.namespace) ?? null, Q = ($ == null ? void 0 : $.assemblingMessageId) ?? null, ge = M, [_e, Z] = we(!1);
15736
+ St(() => {
15737
+ ge || Z(!1);
15738
15738
  }, [ge]);
15739
- const ue = de(() => {
15740
- J(!0);
15741
- }, []), ke = de(() => {
15742
- J(!1);
15743
- }, []), ee = !!ge || _e, [D, G] = we(null), [ie, le] = we(""), [H, We] = we(null), [re, ye] = we(null), [Pe, Fe] = we([]), [rt, Te] = we(0), [Ye, ot] = we(0), [Je, Xe] = we(!1), [qe, Ze] = we(null), [zt, kt] = we(null), [Qe, vt] = we(!1), [At, st] = we(null), [Jt, Zt] = we(!1), Qt = be(!1), [en, ft] = we(() => Yu.value), Ve = be(en), Bt = be(null), Ft = de((Z) => {
15744
- Yu.value = Z, ft(Z);
15745
- }, []), [Y, Re] = we(!1), ve = be(null), gt = de((Z) => {
15746
- if (!Array.isArray(Z))
15739
+ const de = fe(() => {
15740
+ Z(!0);
15741
+ }, []), ke = fe(() => {
15742
+ Z(!1);
15743
+ }, []), ee = !!ge || _e, [D, G] = we(null), [ie, ce] = we(""), [H, We] = we(null), [re, ye] = we(null), [Oe, Fe] = we([]), [rt, Te] = we(0), [Ye, ot] = we(0), [Je, Xe] = we(!1), [qe, Ze] = we(null), [zt, kt] = we(null), [Qe, wt] = we(!1), [At, st] = we(null), [Jt, Zt] = we(!1), Qt = be(!1), [en, ft] = we(() => Yu.value), Ve = be(en), Bt = be(null), Ft = fe((X) => {
15744
+ Yu.value = X, ft(X);
15745
+ }, []), [Y, Re] = we(!1), ve = be(null), gt = fe((X) => {
15746
+ if (!Array.isArray(X))
15747
15747
  return { text: null, messageId: null };
15748
- for (let ce = Z.length - 1; ce >= 0; ce--) {
15749
- const he = Z[ce];
15750
- if (!he || he.role !== "user") continue;
15751
- const Ee = (he.content ?? []).filter((Be) => (Be == null ? void 0 : Be.type) === "text").map((Be) => Be.text).filter((Be) => typeof Be == "string" && Be.trim().length > 0);
15748
+ for (let le = X.length - 1; le >= 0; le--) {
15749
+ const ue = X[le];
15750
+ if (!ue || ue.role !== "user") continue;
15751
+ const Ee = (ue.content ?? []).filter((Be) => (Be == null ? void 0 : Be.type) === "text").map((Be) => Be.text).filter((Be) => typeof Be == "string" && Be.trim().length > 0);
15752
15752
  return {
15753
15753
  text: Ee.length ? Ee.join(" ").trim() : null,
15754
- messageId: he.id ?? null
15754
+ messageId: ue.id ?? null
15755
15755
  };
15756
15756
  }
15757
15757
  return { text: null, messageId: null };
15758
- }, []), xt = de(
15759
- (Z, ce) => {
15760
- if (!Z || typeof Z != "object") return null;
15761
- const he = Z[ce];
15762
- return typeof he == "number" ? he : null;
15758
+ }, []), xt = fe(
15759
+ (X, le) => {
15760
+ if (!X || typeof X != "object") return null;
15761
+ const ue = X[le];
15762
+ return typeof ue == "number" ? ue : null;
15763
15763
  },
15764
15764
  []
15765
- ), Pt = de(
15766
- (Z, ce) => {
15767
- if (!Z || typeof Z != "object") return null;
15768
- const he = Z[ce];
15769
- return typeof he == "string" && he.trim() ? he : null;
15765
+ ), Pt = fe(
15766
+ (X, le) => {
15767
+ if (!X || typeof X != "object") return null;
15768
+ const ue = X[le];
15769
+ return typeof ue == "string" && ue.trim() ? ue : null;
15770
15770
  },
15771
15771
  []
15772
- ), Oe = ct(() => {
15773
- const Z = (Ee) => {
15772
+ ), je = ct(() => {
15773
+ const X = (Ee) => {
15774
15774
  if (!Array.isArray(Ee) || Ee.length === 0)
15775
15775
  return null;
15776
15776
  const ht = Ee.map((Be) => {
@@ -15784,8 +15784,8 @@ function xa({
15784
15784
  return null;
15785
15785
  }).filter((Be) => !!(Be && Be.length));
15786
15786
  return ht.length ? ht.join(", ") : null;
15787
- }, ce = Array.isArray(_) ? _.map((Ee) => {
15788
- const ht = Z(Ee.next);
15787
+ }, le = Array.isArray(_) ? _.map((Ee) => {
15788
+ const ht = X(Ee.next);
15789
15789
  return ht ? {
15790
15790
  ...Ee,
15791
15791
  metadata: {
@@ -15794,41 +15794,41 @@ function xa({
15794
15794
  }
15795
15795
  } : Ee;
15796
15796
  }) : [];
15797
- return ce.some((Ee) => xt(Ee.metadata, "step") !== null) && ce.sort((Ee, ht) => {
15797
+ return le.some((Ee) => xt(Ee.metadata, "step") !== null) && le.sort((Ee, ht) => {
15798
15798
  const Be = xt(Ee.metadata, "step"), it = xt(ht.metadata, "step");
15799
15799
  if (Be !== null || it !== null)
15800
15800
  return (it ?? Number.NEGATIVE_INFINITY) - (Be ?? Number.NEGATIVE_INFINITY);
15801
15801
  const Rt = Date.parse(Ee.createdAt ?? ""), tn = Date.parse(ht.createdAt ?? "");
15802
15802
  return Number.isNaN(Rt) || Number.isNaN(tn) ? 0 : tn - Rt;
15803
- }), ce;
15803
+ }), le;
15804
15804
  }, [_, xt]), { checkpointMetaById: Et, checkpointIndexByKey: at } = ct(() => {
15805
- const Z = /* @__PURE__ */ new Map(), ce = /* @__PURE__ */ new Map();
15806
- for (const he of Oe) {
15807
- const Ee = he.checkpointId ?? null;
15805
+ const X = /* @__PURE__ */ new Map(), le = /* @__PURE__ */ new Map();
15806
+ for (const ue of je) {
15807
+ const Ee = ue.checkpointId ?? null;
15808
15808
  if (!Ee) continue;
15809
- const ht = xt(he.metadata, "step"), Be = Pt(he.metadata, "source"), it = {
15809
+ const ht = xt(ue.metadata, "step"), Be = Pt(ue.metadata, "source"), it = {
15810
15810
  id: Ee,
15811
15811
  step: ht,
15812
15812
  source: Be,
15813
- createdAt: he.createdAt ?? null,
15814
- namespace: he.checkpointNs ?? null,
15815
- parentId: he.parentId ?? null
15813
+ createdAt: ue.createdAt ?? null,
15814
+ namespace: ue.checkpointNs ?? null,
15815
+ parentId: ue.parentId ?? null
15816
15816
  };
15817
- if (Z.set(Ee, it), ht !== null && Be) {
15818
- const Rt = `${ht}:${Be}`, tn = ce.get(Rt) ?? [];
15819
- tn.push(it), ce.set(Rt, tn);
15817
+ if (X.set(Ee, it), ht !== null && Be) {
15818
+ const Rt = `${ht}:${Be}`, tn = le.get(Rt) ?? [];
15819
+ tn.push(it), le.set(Rt, tn);
15820
15820
  }
15821
15821
  }
15822
- for (const he of ce.values())
15823
- he.sort((Ee, ht) => {
15822
+ for (const ue of le.values())
15823
+ ue.sort((Ee, ht) => {
15824
15824
  const Be = Ee.createdAt ?? "";
15825
15825
  return (ht.createdAt ?? "").localeCompare(Be);
15826
15826
  });
15827
- return { checkpointMetaById: Z, checkpointIndexByKey: ce };
15828
- }, [Oe, xt, Pt]), _t = ct(() => {
15827
+ return { checkpointMetaById: X, checkpointIndexByKey: le };
15828
+ }, [je, xt, Pt]), _t = ct(() => {
15829
15829
  var Be;
15830
- if (!Oe.length) return [];
15831
- const Z = [...Oe].reverse(), ce = (it, Rt) => {
15830
+ if (!je.length) return [];
15831
+ const X = [...je].reverse(), le = (it, Rt) => {
15832
15832
  const tn = it.checkpointId ?? null;
15833
15833
  if (!tn) return null;
15834
15834
  const Wn = Pt(it.metadata, "source");
@@ -15843,100 +15843,100 @@ function xa({
15843
15843
  source: Wn ?? null,
15844
15844
  next: Pt(it.metadata, "next")
15845
15845
  };
15846
- }, he = [], Ee = /* @__PURE__ */ new Set();
15847
- for (const it of Z) {
15846
+ }, ue = [], Ee = /* @__PURE__ */ new Set();
15847
+ for (const it of X) {
15848
15848
  const Rt = ((Be = Pt(it.metadata, "source")) == null ? void 0 : Be.toLowerCase()) ?? null;
15849
15849
  if (!(Rt === "input" || Rt === "user_input" || Rt === "user")) continue;
15850
- const Wn = ce(it, "User input");
15851
- Wn && !Ee.has(Wn.id) && (he.push(Wn), Ee.add(Wn.id));
15850
+ const Wn = le(it, "User input");
15851
+ Wn && !Ee.has(Wn.id) && (ue.push(Wn), Ee.add(Wn.id));
15852
15852
  }
15853
- if (!he.length)
15854
- for (const it of Z) {
15855
- const Rt = ce(it);
15856
- Rt && !Ee.has(Rt.id) && (he.push(Rt), Ee.add(Rt.id));
15853
+ if (!ue.length)
15854
+ for (const it of X) {
15855
+ const Rt = le(it);
15856
+ Rt && !Ee.has(Rt.id) && (ue.push(Rt), Ee.add(Rt.id));
15857
15857
  }
15858
- const ht = Oe.find((it) => {
15858
+ const ht = je.find((it) => {
15859
15859
  var tn;
15860
15860
  return (((tn = Pt(it.metadata, "source")) == null ? void 0 : tn.toLowerCase()) ?? null) === "loop";
15861
15861
  });
15862
15862
  if (ht) {
15863
- const it = ce(ht, "Latest loop");
15864
- it && !Ee.has(it.id) && (he.push(it), Ee.add(it.id));
15865
- }
15866
- return he;
15867
- }, [Oe, gt, xt, Pt]), jn = be(null), Kt = be(null), Hn = de(() => {
15868
- jn.current && (jn.current.value = ""), Kt.current && (Kt.current.value = ""), Te((Z) => Z + 1), ot((Z) => Z + 1);
15869
- }, []), Cr = de(
15870
- (Z) => {
15871
- Ft(Z);
15863
+ const it = le(ht, "Latest loop");
15864
+ it && !Ee.has(it.id) && (ue.push(it), Ee.add(it.id));
15865
+ }
15866
+ return ue;
15867
+ }, [je, gt, xt, Pt]), jn = be(null), Kt = be(null), Hn = fe(() => {
15868
+ jn.current && (jn.current.value = ""), Kt.current && (Kt.current.value = ""), Te((X) => X + 1), ot((X) => X + 1);
15869
+ }, []), Cr = fe(
15870
+ (X) => {
15871
+ Ft(X);
15872
15872
  },
15873
15873
  [Ft]
15874
15874
  ), qt = be(!1);
15875
- bt(() => {
15875
+ St(() => {
15876
15876
  qt.current && !z && (Fe([]), Hn()), qt.current = z;
15877
15877
  }, [z, Hn]);
15878
15878
  const [Un, Vr] = we("desktop");
15879
- bt(() => {
15880
- const Z = () => {
15881
- const ce = window.innerWidth;
15882
- Vr(ce < 640 ? "phone" : ce < 1024 ? "tablet" : "desktop");
15879
+ St(() => {
15880
+ const X = () => {
15881
+ const le = window.innerWidth;
15882
+ Vr(le < 640 ? "phone" : le < 1024 ? "tablet" : "desktop");
15883
15883
  };
15884
- return Z(), window.addEventListener("resize", Z), () => window.removeEventListener("resize", Z);
15885
- }, []), bt(() => {
15884
+ return X(), window.addEventListener("resize", X), () => window.removeEventListener("resize", X);
15885
+ }, []), St(() => {
15886
15886
  Zt(!1), Qt.current = !1;
15887
- }, [F]), bt(() => {
15887
+ }, [L]), St(() => {
15888
15888
  Ve.current = en;
15889
- }, [en]), bt(() => {
15889
+ }, [en]), St(() => {
15890
15890
  if (!D) {
15891
15891
  Bt.current = null;
15892
15892
  return;
15893
15893
  }
15894
15894
  Bt.current === null && (Bt.current = Ve.current), Ft(ie ?? "");
15895
15895
  }, [ie, D, Ft]);
15896
- const R = de(async () => {
15896
+ const R = fe(async () => {
15897
15897
  if (!(!S || T || !Jt))
15898
15898
  try {
15899
15899
  await b();
15900
- } catch (Z) {
15901
- console.warn("loadOlder failed", Z);
15900
+ } catch (X) {
15901
+ console.warn("loadOlder failed", X);
15902
15902
  }
15903
15903
  }, [S, Jt, T, b]);
15904
- bt(() => {
15904
+ St(() => {
15905
15905
  (async () => {
15906
15906
  if (!g.baseUrl) {
15907
15907
  st(null);
15908
15908
  return;
15909
15909
  }
15910
15910
  try {
15911
- const he = (await g.getAgent("default")).uiDefaultMessage || "";
15912
- st(he || null);
15913
- } catch (ce) {
15914
- console.warn("Failed to fetch default message:", ce), st(null);
15911
+ const ue = (await g.getAgent("default")).uiDefaultMessage || "";
15912
+ st(ue || null);
15913
+ } catch (le) {
15914
+ console.warn("Failed to fetch default message:", le), st(null);
15915
15915
  }
15916
15916
  })();
15917
- }, [g.baseUrl]), bt(() => {
15917
+ }, [g.baseUrl]), St(() => {
15918
15918
  P && !Qe && (m == null || m(P));
15919
15919
  }, [P, Qe, m]);
15920
- const K = (Z) => {
15921
- if (Z.length > ks)
15922
- return `Message too long (${Z.length}/${ks} characters)`;
15920
+ const K = (X) => {
15921
+ if (X.length > ks)
15922
+ return `Message too long (${X.length}/${ks} characters)`;
15923
15923
  try {
15924
- return FS(Z), null;
15925
- } catch (ce) {
15926
- return (ce == null ? void 0 : ce.message) || "Invalid message";
15927
- }
15928
- }, fe = async (Z) => {
15929
- const ce = Z.trim();
15930
- if (!(!ce && Pe.length === 0)) {
15931
- if (ce) {
15932
- const he = K(ce);
15933
- if (he) {
15934
- ye(he);
15924
+ return FS(X), null;
15925
+ } catch (le) {
15926
+ return (le == null ? void 0 : le.message) || "Invalid message";
15927
+ }
15928
+ }, he = async (X) => {
15929
+ const le = X.trim();
15930
+ if (!(!le && Oe.length === 0)) {
15931
+ if (le) {
15932
+ const ue = K(le);
15933
+ if (ue) {
15934
+ ye(ue);
15935
15935
  return;
15936
15936
  }
15937
15937
  }
15938
15938
  try {
15939
- const he = L ?? void 0, Ee = ne ?? void 0, ht = D ? {
15939
+ const ue = F ?? void 0, Ee = ne ?? void 0, ht = D ? {
15940
15940
  edit: !0,
15941
15941
  originalMessageId: D,
15942
15942
  ...H != null && H.checkpointId ? { originalCheckpointId: H.checkpointId } : {},
@@ -15944,96 +15944,96 @@ function xa({
15944
15944
  } : void 0;
15945
15945
  await j(
15946
15946
  {
15947
- text: ce || "",
15948
- attachments: Pe,
15947
+ text: le || "",
15948
+ attachments: Oe,
15949
15949
  messageAdditionalKwargs: ht
15950
15950
  },
15951
15951
  {
15952
- checkpointId: he,
15952
+ checkpointId: ue,
15953
15953
  checkpointNs: Ee
15954
15954
  }
15955
- ), h == null || h(ce), Ft(""), ye(null), Fe([]), Hn(), G(null), le(""), We(null);
15956
- } catch (he) {
15957
- const Ee = (he == null ? void 0 : he.message) || "Failed to send message";
15955
+ ), h == null || h(le), Ft(""), ye(null), Fe([]), Hn(), G(null), ce(""), We(null);
15956
+ } catch (ue) {
15957
+ const Ee = (ue == null ? void 0 : ue.message) || "Failed to send message";
15958
15958
  ye(Ee), m == null || m(Ee);
15959
15959
  }
15960
15960
  }
15961
15961
  }, Ne = V.useCallback(
15962
- (Z, ce, he) => {
15963
- c && (Bt.current = en, G(Z), le(ce), Ft(ce), ye(null), We({
15964
- checkpointId: (he == null ? void 0 : he.checkpointId) ?? null,
15965
- checkpointNs: (he == null ? void 0 : he.checkpointNs) ?? null
15962
+ (X, le, ue) => {
15963
+ c && (Bt.current = en, G(X), ce(le), Ft(le), ye(null), We({
15964
+ checkpointId: (ue == null ? void 0 : ue.checkpointId) ?? null,
15965
+ checkpointNs: (ue == null ? void 0 : ue.checkpointNs) ?? null
15966
15966
  }));
15967
15967
  },
15968
15968
  [en, c, Ft]
15969
15969
  ), Ge = V.useCallback(() => {
15970
- G(null), le(""), We(null), ye(null), Ft(Bt.current ?? en), Bt.current = null;
15971
- }, [en, Ft]), lt = de(
15972
- (Z, ce, he) => {
15973
- Ne(Z, ce, he);
15970
+ G(null), ce(""), We(null), ye(null), Ft(Bt.current ?? en), Bt.current = null;
15971
+ }, [en, Ft]), lt = fe(
15972
+ (X, le, ue) => {
15973
+ Ne(X, le, ue);
15974
15974
  },
15975
15975
  [Ne]
15976
- ), Ue = de((Z) => {
15977
- for (let ce = Z - 1; ce >= 0; ce--)
15978
- if (w[ce].role === "user") {
15979
- const he = w[ce].content || [], ht = he.filter((Be) => Be.type === "text").map((Be) => Be.text).join("") || (() => {
15976
+ ), Ue = fe((X) => {
15977
+ for (let le = X - 1; le >= 0; le--)
15978
+ if (w[le].role === "user") {
15979
+ const ue = w[le].content || [], ht = ue.filter((Be) => Be.type === "text").map((Be) => Be.text).join("") || (() => {
15980
15980
  try {
15981
- return JSON.stringify(he, null, 2);
15981
+ return JSON.stringify(ue, null, 2);
15982
15982
  } catch {
15983
- return String(he);
15983
+ return String(ue);
15984
15984
  }
15985
15985
  })();
15986
15986
  ht && j(
15987
15987
  { text: ht },
15988
15988
  {
15989
- checkpointId: L ?? void 0,
15989
+ checkpointId: F ?? void 0,
15990
15990
  checkpointNs: ne ?? void 0
15991
15991
  }
15992
15992
  );
15993
15993
  break;
15994
15994
  }
15995
- }, [w, j, L, ne]), ze = (Z) => {
15996
- const ce = Array.from(Z.target.files || []);
15997
- Fe((he) => [...he, ...ce]), Z.target.value = "";
15998
- }, Ot = (Z) => {
15999
- Fe((ce) => {
16000
- const he = ce.filter((Ee, ht) => Z !== ht);
16001
- return he.length === 0 && Hn(), he;
15995
+ }, [w, j, F, ne]), ze = (X) => {
15996
+ const le = Array.from(X.target.files || []);
15997
+ Fe((ue) => [...ue, ...le]), X.target.value = "";
15998
+ }, Ot = (X) => {
15999
+ Fe((le) => {
16000
+ const ue = le.filter((Ee, ht) => X !== ht);
16001
+ return ue.length === 0 && Hn(), ue;
16002
16002
  });
16003
- }, yt = async (Z) => {
16004
- const ce = (Z.target.files || [])[0];
16005
- if (ce) {
16003
+ }, yt = async (X) => {
16004
+ const le = (X.target.files || [])[0];
16005
+ if (le) {
16006
16006
  Ze(null), kt(null), Xe(!0);
16007
16007
  try {
16008
16008
  await j(
16009
- { attachments: [ce] },
16009
+ { attachments: [le] },
16010
16010
  {
16011
- checkpointId: L ?? void 0,
16011
+ checkpointId: F ?? void 0,
16012
16012
  checkpointNs: ne ?? void 0
16013
16013
  }
16014
16014
  );
16015
- const he = `Uploaded ${ce.name} - processing through chat stream`;
16016
- kt(he);
16017
- } catch (he) {
16018
- const Ee = he instanceof Error ? he.message : "Failed to upload Excel file";
16019
- console.error("Excel upload failed", he), Ze(Ee), m == null || m(Ee);
16015
+ const ue = `Uploaded ${le.name} - processing through chat stream`;
16016
+ kt(ue);
16017
+ } catch (ue) {
16018
+ const Ee = ue instanceof Error ? ue.message : "Failed to upload Excel file";
16019
+ console.error("Excel upload failed", ue), Ze(Ee), m == null || m(Ee);
16020
16020
  } finally {
16021
- Xe(!1), Z.target.value = "", Hn();
16021
+ Xe(!1), X.target.value = "", Hn();
16022
16022
  }
16023
16023
  }
16024
- }, St = async (Z) => {
16024
+ }, vt = async (X) => {
16025
16025
  if (x) {
16026
16026
  Re(!0);
16027
16027
  try {
16028
- if (!Z) {
16028
+ if (!X) {
16029
16029
  await A(), Zt(!1), requestAnimationFrame(() => {
16030
16030
  var Ee;
16031
16031
  (Ee = ve.current) == null || Ee.scrollToLatest();
16032
16032
  });
16033
16033
  return;
16034
16034
  }
16035
- const ce = Oe.find((Ee) => Ee.checkpointId === Z), he = (ce == null ? void 0 : ce.checkpointNs) ?? null;
16036
- await k(Z, he), Zt(!0), requestAnimationFrame(() => {
16035
+ const le = je.find((Ee) => Ee.checkpointId === X), ue = (le == null ? void 0 : le.checkpointNs) ?? null;
16036
+ await k(X, ue), Zt(!0), requestAnimationFrame(() => {
16037
16037
  var Ee;
16038
16038
  (Ee = ve.current) == null || Ee.scrollToTop();
16039
16039
  });
@@ -16041,18 +16041,31 @@ function xa({
16041
16041
  Re(!1);
16042
16042
  }
16043
16043
  }
16044
- }, Mt = de(
16045
- async (Z) => {
16046
- await St(Z);
16044
+ }, Mt = fe(
16045
+ async (X) => {
16046
+ var le;
16047
+ if (!L || !X) {
16048
+ await vt(X);
16049
+ return;
16050
+ }
16051
+ try {
16052
+ await g.getStateHistory({
16053
+ threadId: L,
16054
+ checkpointId: X,
16055
+ checkpointNs: ((le = je.find((ue) => ue.checkpointId === X)) == null ? void 0 : le.checkpointNs) ?? void 0
16056
+ }), await vt(X);
16057
+ } catch (ue) {
16058
+ console.error("Failed to fetch checkpoint state:", ue), await vt(X);
16059
+ }
16047
16060
  },
16048
- [St]
16049
- ), Sn = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${f.container || ""}`, on = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-hidden overscroll-contain break-words break-anywhere p-4 bg-transparent ${f.messagesArea || ""}`, Dt = `flex-shrink-0 w-full border-t p-4 bg-transparent ${f.inputArea || ""}`, Pn = de(
16050
- (Z) => {
16051
- if (!Z)
16061
+ [L, g, je, vt]
16062
+ ), Sn = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${f.container || ""}`, on = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-hidden overscroll-contain break-words break-anywhere p-4 bg-transparent ${f.messagesArea || ""}`, Dt = `flex-shrink-0 w-full border-t p-4 bg-transparent ${f.inputArea || ""}`, Pn = fe(
16063
+ (X) => {
16064
+ if (!X)
16052
16065
  return "Latest";
16053
- const ce = [];
16054
- Z.step !== null && ce.push(`Step ${Z.step}`), Z.source && ce.push(Z.source);
16055
- const he = Z.createdAt ? new Date(Z.createdAt) : null, Ee = he && !Number.isNaN(he.getTime()) ? he.toLocaleString() : Z.createdAt ?? Z.id, ht = ce.length ? ` — ${ce.join(" • ")}` : "";
16066
+ const le = [];
16067
+ X.step !== null && le.push(`Step ${X.step}`), X.source && le.push(X.source);
16068
+ const ue = X.createdAt ? new Date(X.createdAt) : null, Ee = ue && !Number.isNaN(ue.getTime()) ? ue.toLocaleString() : X.createdAt ?? X.id, ht = le.length ? ` — ${le.join(" • ")}` : "";
16056
16069
  return `${Ee}${ht}`;
16057
16070
  },
16058
16071
  []
@@ -16065,29 +16078,29 @@ function xa({
16065
16078
  {
16066
16079
  variant: "ghost",
16067
16080
  size: "sm",
16068
- onClick: () => vt(!0),
16081
+ onClick: () => wt(!0),
16069
16082
  className: "text-red-800 hover:bg-red-100",
16070
16083
  "aria-label": "Dismiss error",
16071
16084
  children: /* @__PURE__ */ u.jsx(Xr, { size: 16 })
16072
16085
  }
16073
16086
  )
16074
16087
  ] }),
16075
- x && Oe.length > 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex-shrink-0 flex items-center gap-2 px-4 py-2 border-b border-border bg-muted/60 text-xs dark:bg-muted/50", children: [
16088
+ x && je.length > 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex-shrink-0 flex items-center gap-2 px-4 py-2 border-b border-border bg-muted/60 text-xs dark:bg-muted/50", children: [
16076
16089
  /* @__PURE__ */ u.jsx("span", { className: "opacity-70", children: "Checkpoint:" }),
16077
16090
  /* @__PURE__ */ u.jsxs(
16078
16091
  "select",
16079
16092
  {
16080
16093
  className: "border border-border rounded px-2 py-1 text-xs bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring dark:bg-secondary",
16081
- value: L ?? "",
16082
- onChange: (Z) => {
16083
- const ce = Z.target.value || null;
16084
- St(ce);
16094
+ value: F ?? "",
16095
+ onChange: (X) => {
16096
+ const le = X.target.value || null;
16097
+ vt(le);
16085
16098
  },
16086
16099
  children: [
16087
16100
  /* @__PURE__ */ u.jsx("option", { value: "", children: "Latest" }),
16088
- Oe.map((Z) => {
16089
- const ce = Et.get(Z.checkpointId ?? "") ?? null;
16090
- return /* @__PURE__ */ u.jsx("option", { value: Z.checkpointId ?? void 0, children: Pn(ce) }, Z.checkpointId);
16101
+ je.map((X) => {
16102
+ const le = Et.get(X.checkpointId ?? "") ?? null;
16103
+ return /* @__PURE__ */ u.jsx("option", { value: X.checkpointId ?? void 0, children: Pn(le) }, X.checkpointId);
16091
16104
  })
16092
16105
  ]
16093
16106
  }
@@ -16116,12 +16129,12 @@ function xa({
16116
16129
  onStartReached: () => {
16117
16130
  Jt && R();
16118
16131
  },
16119
- onScrollAway: (Z) => {
16132
+ onScrollAway: (X) => {
16120
16133
  if (!Qt.current) {
16121
16134
  Qt.current = !0;
16122
16135
  return;
16123
16136
  }
16124
- Z && Zt(!0);
16137
+ X && Zt(!0);
16125
16138
  },
16126
16139
  onEdit: lt,
16127
16140
  onRegenerate: Ue,
@@ -16130,12 +16143,12 @@ function xa({
16130
16143
  isNavigatingCheckpoint: Y,
16131
16144
  activeInterrupt: ge,
16132
16145
  disableInterruptActions: _e,
16133
- onInterruptActionStart: ue,
16146
+ onInterruptActionStart: de,
16134
16147
  onInterruptActionEnd: ke,
16135
16148
  showToolMessages: d,
16136
16149
  checkpointMetaById: Et,
16137
16150
  checkpointIndexByKey: at,
16138
- activeCheckpointId: L,
16151
+ activeCheckpointId: F,
16139
16152
  onSelectCheckpoint: Mt,
16140
16153
  timelineCheckpoints: _t
16141
16154
  }
@@ -16177,26 +16190,26 @@ function xa({
16177
16190
  ref: jn,
16178
16191
  type: "file",
16179
16192
  multiple: !0,
16180
- onChange: (Z) => ze(Z),
16193
+ onChange: (X) => ze(X),
16181
16194
  className: "hidden"
16182
16195
  },
16183
16196
  rt
16184
16197
  ),
16185
- Pe.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "flex flex-wrap gap-2", children: Pe.map((Z, ce) => /* @__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: [
16198
+ Oe.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "flex flex-wrap gap-2", children: Oe.map((X, le) => /* @__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: [
16186
16199
  /* @__PURE__ */ u.jsx(ya, { size: 14 }),
16187
- /* @__PURE__ */ u.jsx("span", { className: "truncate max-w-[150px]", children: Z.name }),
16200
+ /* @__PURE__ */ u.jsx("span", { className: "truncate max-w-[150px]", children: X.name }),
16188
16201
  /* @__PURE__ */ u.jsx(
16189
16202
  pt,
16190
16203
  {
16191
16204
  variant: "ghost",
16192
16205
  size: "sm",
16193
- onClick: () => Ot(ce),
16206
+ onClick: () => Ot(le),
16194
16207
  className: "h-4 w-4 p-0 text-gray-500 dark:text-gray-400 hover:text-red-500 dark:hover:text-red-400",
16195
- "aria-label": `Remove ${Z.name}`,
16208
+ "aria-label": `Remove ${X.name}`,
16196
16209
  children: /* @__PURE__ */ u.jsx(Xr, { size: 12 })
16197
16210
  }
16198
16211
  )
16199
- ] }, ce)) })
16212
+ ] }, le)) })
16200
16213
  ] }),
16201
16214
  l && /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
16202
16215
  /* @__PURE__ */ u.jsx(
@@ -16235,8 +16248,8 @@ function xa({
16235
16248
  ) }),
16236
16249
  /* @__PURE__ */ u.jsxs(Rh, { align: "start", sideOffset: 6, className: "w-52", children: [
16237
16250
  a && /* @__PURE__ */ u.jsxs($a, { onClick: () => {
16238
- var Z;
16239
- return (Z = jn.current) == null ? void 0 : Z.click();
16251
+ var X;
16252
+ return (X = jn.current) == null ? void 0 : X.click();
16240
16253
  }, className: "cursor-pointer", children: [
16241
16254
  /* @__PURE__ */ u.jsx(ya, { className: "h-4 w-4 mr-2" }),
16242
16255
  " Attach files or images"
@@ -16245,8 +16258,8 @@ function xa({
16245
16258
  $a,
16246
16259
  {
16247
16260
  onClick: () => {
16248
- var Z;
16249
- Je || (Z = Kt.current) == null || Z.click();
16261
+ var X;
16262
+ Je || (X = Kt.current) == null || X.click();
16250
16263
  },
16251
16264
  className: `cursor-pointer ${Je ? "opacity-60 pointer-events-none" : ""}`,
16252
16265
  children: [
@@ -16268,10 +16281,10 @@ function xa({
16268
16281
  isStreaming: z,
16269
16282
  disabled: ee,
16270
16283
  maxLength: ks,
16271
- onSend: fe,
16284
+ onSend: he,
16272
16285
  onCancelEdit: Ge,
16273
16286
  onStop: W,
16274
- allowEmptySend: Pe.length > 0,
16287
+ allowEmptySend: Oe.length > 0,
16275
16288
  textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${D ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${re ? "border-red-400" : ""} ${f.textarea || ""}`
16276
16289
  }
16277
16290
  ) })
@@ -16858,80 +16871,80 @@ function Zu({
16858
16871
  isLoading: p,
16859
16872
  actions: m
16860
16873
  } = ul(), { loadThread: g } = dl(), { createThread: x, deleteThread: y, renameThread: w } = m, [S, T] = we(Array.isArray(f) ? f : []), C = be(S.length > 0), b = be(null), k = be(0), [A, N] = we(null), [_, M] = we(""), [$, z] = we(!1);
16861
- bt(() => {
16862
- const J = Array.isArray(f) ? f : [];
16863
- if (J.length > 0) {
16864
- C.current = !0, T(J);
16874
+ St(() => {
16875
+ const Z = Array.isArray(f) ? f : [];
16876
+ if (Z.length > 0) {
16877
+ C.current = !0, T(Z);
16865
16878
  return;
16866
16879
  }
16867
- p || (C.current = !1, T(J));
16868
- }, [f, p]), bt(() => {
16880
+ p || (C.current = !1, T(Z));
16881
+ }, [f, p]), St(() => {
16869
16882
  if (!b.current) return;
16870
- const J = b.current.querySelector(
16883
+ const Z = b.current.querySelector(
16871
16884
  "[data-radix-scroll-area-viewport]"
16872
16885
  );
16873
- if (!J) return;
16874
- let ue = null, ke = null;
16875
- return ue = requestAnimationFrame(() => {
16886
+ if (!Z) return;
16887
+ let de = null, ke = null;
16888
+ return de = requestAnimationFrame(() => {
16876
16889
  ke = requestAnimationFrame(() => {
16877
- J.scrollTop = k.current;
16890
+ Z.scrollTop = k.current;
16878
16891
  });
16879
16892
  }), () => {
16880
- ue !== null && cancelAnimationFrame(ue), ke !== null && cancelAnimationFrame(ke);
16893
+ de !== null && cancelAnimationFrame(de), ke !== null && cancelAnimationFrame(ke);
16881
16894
  };
16882
16895
  }, [S]);
16883
- const P = async (J) => {
16896
+ const P = async (Z) => {
16884
16897
  try {
16885
- await g(J), a == null || a(J), l == null || l(J);
16886
- } catch (ue) {
16887
- console.error("Failed to select thread:", ue);
16898
+ await g(Z), a == null || a(Z), l == null || l(Z);
16899
+ } catch (de) {
16900
+ console.error("Failed to select thread:", de);
16888
16901
  }
16889
16902
  }, B = async () => {
16890
16903
  try {
16891
16904
  z(!0);
16892
- const J = await x();
16893
- c == null || c(J), a == null || a(J);
16894
- } catch (J) {
16895
- console.error("Failed to create thread:", J);
16905
+ const Z = await x();
16906
+ c == null || c(Z), a == null || a(Z);
16907
+ } catch (Z) {
16908
+ console.error("Failed to create thread:", Z);
16896
16909
  } finally {
16897
16910
  z(!1);
16898
16911
  }
16899
- }, j = async (J, ue) => {
16900
- if (ue.stopPropagation(), !!confirm("Delete this thread?")) {
16912
+ }, j = async (Z, de) => {
16913
+ if (de.stopPropagation(), !!confirm("Delete this thread?")) {
16901
16914
  if (b.current) {
16902
16915
  const ke = b.current.querySelector("[data-radix-scroll-area-viewport]");
16903
16916
  ke && (k.current = ke.scrollTop);
16904
16917
  }
16905
16918
  try {
16906
- await y(J), d == null || d(J);
16919
+ await y(Z), d == null || d(Z);
16907
16920
  } catch (ke) {
16908
16921
  console.error("Failed to delete thread:", ke);
16909
16922
  }
16910
16923
  }
16911
- }, W = (J, ue) => {
16912
- ue.stopPropagation(), N(J.threadId), M(J.title || `Thread ${J.threadId.slice(0, 8)}`);
16913
- }, F = async (J) => {
16924
+ }, W = (Z, de) => {
16925
+ de.stopPropagation(), N(Z.threadId), M(Z.title || `Thread ${Z.threadId.slice(0, 8)}`);
16926
+ }, L = async (Z) => {
16914
16927
  if (_.trim())
16915
16928
  try {
16916
- await w(J, _.trim()), N(null), M("");
16917
- } catch (ue) {
16918
- console.error("Failed to update title:", ue);
16929
+ await w(Z, _.trim()), N(null), M("");
16930
+ } catch (de) {
16931
+ console.error("Failed to update title:", de);
16919
16932
  }
16920
- }, L = () => {
16933
+ }, F = () => {
16921
16934
  N(null), M("");
16922
- }, ne = (J, ue) => {
16923
- J.key === "Enter" ? F(ue) : J.key === "Escape" && L();
16924
- }, Q = (J) => {
16925
- if (!J) return "";
16935
+ }, ne = (Z, de) => {
16936
+ Z.key === "Enter" ? L(de) : Z.key === "Escape" && F();
16937
+ }, Q = (Z) => {
16938
+ if (!Z) return "";
16926
16939
  try {
16927
- const ue = new Date(J), ee = (/* @__PURE__ */ new Date()).getTime() - ue.getTime(), D = Math.floor(ee / (1e3 * 60 * 60 * 24));
16928
- return D === 0 ? ue.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : D === 1 ? "Yesterday" : D < 7 ? `${D} days ago` : ue.toLocaleDateString();
16940
+ const de = new Date(Z), ee = (/* @__PURE__ */ new Date()).getTime() - de.getTime(), D = Math.floor(ee / (1e3 * 60 * 60 * 24));
16941
+ return D === 0 ? de.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : D === 1 ? "Yesterday" : D < 7 ? `${D} days ago` : de.toLocaleDateString();
16929
16942
  } catch {
16930
16943
  return "";
16931
16944
  }
16932
- }, ge = (J) => J.title || `Thread ${J.threadId.slice(0, 8)}`, _e = (J) => {
16933
- const ue = ge(J);
16934
- return ue.length <= Ju ? ue : `${ue.slice(0, Ju)}...`;
16945
+ }, ge = (Z) => Z.title || `Thread ${Z.threadId.slice(0, 8)}`, _e = (Z) => {
16946
+ const de = ge(Z);
16947
+ return de.length <= Ju ? de : `${de.slice(0, Ju)}...`;
16935
16948
  };
16936
16949
  return /* @__PURE__ */ u.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
16937
16950
  t && /* @__PURE__ */ u.jsx("div", { className: s.header || "flex-shrink-0 p-2 border-b bg-slate-800 border-slate-700 text-slate-100 flex justify-end", children: /* @__PURE__ */ u.jsx(
@@ -16958,32 +16971,32 @@ function Zu({
16958
16971
  ] }) : S.length === 0 ? /* @__PURE__ */ u.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
16959
16972
  /* @__PURE__ */ u.jsx(_g, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
16960
16973
  /* @__PURE__ */ u.jsx("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
16961
- ] }) : S.slice().sort((J, ue) => new Date(ue.updatedAt || ue.createdAt || "").getTime() - new Date(J.updatedAt || J.createdAt || "").getTime()).map((J) => /* @__PURE__ */ u.jsxs(
16974
+ ] }) : S.slice().sort((Z, de) => new Date(de.updatedAt || de.createdAt || "").getTime() - new Date(Z.updatedAt || Z.createdAt || "").getTime()).map((Z) => /* @__PURE__ */ u.jsxs(
16962
16975
  "div",
16963
16976
  {
16964
- onClick: () => P(J.threadId),
16965
- className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? h) === J.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`,
16977
+ onClick: () => P(Z.threadId),
16978
+ className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? h) === Z.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`,
16966
16979
  children: [
16967
16980
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center justify-between", children: [
16968
- /* @__PURE__ */ u.jsx("div", { className: "flex-1 min-w-0", children: A === J.threadId ? /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", onClick: (ue) => ue.stopPropagation(), children: [
16969
- /* @__PURE__ */ u.jsx(Ys, { value: _, onChange: (ue) => M(ue.target.value), onKeyDown: (ue) => ne(ue, J.threadId), className: "h-6 text-sm", autoFocus: !0 }),
16970
- /* @__PURE__ */ u.jsx(pt, { variant: "ghost", size: "sm", onClick: () => F(J.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(el, { size: 12 }) }),
16971
- /* @__PURE__ */ u.jsx(pt, { variant: "ghost", size: "sm", onClick: L, className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(Xr, { size: 12 }) })
16981
+ /* @__PURE__ */ u.jsx("div", { className: "flex-1 min-w-0", children: A === Z.threadId ? /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", onClick: (de) => de.stopPropagation(), children: [
16982
+ /* @__PURE__ */ u.jsx(Ys, { value: _, onChange: (de) => M(de.target.value), onKeyDown: (de) => ne(de, Z.threadId), className: "h-6 text-sm", autoFocus: !0 }),
16983
+ /* @__PURE__ */ u.jsx(pt, { variant: "ghost", size: "sm", onClick: () => L(Z.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(el, { size: 12 }) }),
16984
+ /* @__PURE__ */ u.jsx(pt, { variant: "ghost", size: "sm", onClick: F, className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(Xr, { size: 12 }) })
16972
16985
  ] }) : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
16973
- /* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: _e(J) }),
16986
+ /* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: _e(Z) }),
16974
16987
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
16975
16988
  /* @__PURE__ */ u.jsx(jg, { size: 10 }),
16976
- /* @__PURE__ */ u.jsx("span", { children: Q(J.updatedAt || J.createdAt) })
16989
+ /* @__PURE__ */ u.jsx("span", { children: Q(Z.updatedAt || Z.createdAt) })
16977
16990
  ] })
16978
16991
  ] }) }),
16979
16992
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
16980
- r && A !== J.threadId && /* @__PURE__ */ u.jsx(pt, { variant: "ghost", size: "sm", onClick: (ue) => W(J, ue), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ u.jsx(rd, { size: 12 }) }),
16993
+ r && A !== Z.threadId && /* @__PURE__ */ u.jsx(pt, { variant: "ghost", size: "sm", onClick: (de) => W(Z, de), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ u.jsx(rd, { size: 12 }) }),
16981
16994
  n && /* @__PURE__ */ u.jsx(
16982
16995
  pt,
16983
16996
  {
16984
16997
  variant: "ghost",
16985
16998
  size: "sm",
16986
- onClick: (ue) => j(J.threadId, ue),
16999
+ onClick: (de) => j(Z.threadId, de),
16987
17000
  className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
16988
17001
  title: "Delete thread",
16989
17002
  children: /* @__PURE__ */ u.jsx(Pg, { size: 12 })
@@ -16991,10 +17004,10 @@ function Zu({
16991
17004
  )
16992
17005
  ] })
16993
17006
  ] }),
16994
- i === J.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" })
17007
+ i === Z.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" })
16995
17008
  ]
16996
17009
  },
16997
- J.threadId
17010
+ Z.threadId
16998
17011
  )) })
16999
17012
  }
17000
17013
  )
@@ -17349,8 +17362,8 @@ var Ok = [" ", "Enter", "ArrowUp", "ArrowDown"], Mk = [" ", "Enter"], Fr = "Sele
17349
17362
  }, []),
17350
17363
  onNativeOptionRemove: v.useCallback((j) => {
17351
17364
  P((W) => {
17352
- const F = new Set(W);
17353
- return F.delete(j), F;
17365
+ const L = new Set(W);
17366
+ return L.delete(j), L;
17354
17367
  });
17355
17368
  }, []),
17356
17369
  children: n
@@ -17496,9 +17509,9 @@ var On = 10, [Em, Sr] = po($r), Hk = "SelectContentImpl", Uk = no("SelectContent
17496
17509
  }, [S]), pl();
17497
17510
  const j = v.useCallback(
17498
17511
  (ee) => {
17499
- const [D, ...G] = $().map((H) => H.ref.current), [ie] = G.slice(-1), le = document.activeElement;
17512
+ const [D, ...G] = $().map((H) => H.ref.current), [ie] = G.slice(-1), ce = document.activeElement;
17500
17513
  for (const H of ee)
17501
- if (H === le || (H == null || H.scrollIntoView({ block: "nearest" }), H === D && C && (C.scrollTop = 0), H === ie && C && (C.scrollTop = C.scrollHeight), H == null || H.focus(), document.activeElement !== le)) return;
17514
+ if (H === ce || (H == null || H.scrollIntoView({ block: "nearest" }), H === D && C && (C.scrollTop = 0), H === ie && C && (C.scrollTop = C.scrollHeight), H == null || H.focus(), document.activeElement !== ce)) return;
17502
17515
  },
17503
17516
  [$, C]
17504
17517
  ), W = v.useCallback(
@@ -17508,31 +17521,31 @@ var On = 10, [Em, Sr] = po($r), Hk = "SelectContentImpl", Uk = no("SelectContent
17508
17521
  v.useEffect(() => {
17509
17522
  z && W();
17510
17523
  }, [z, W]);
17511
- const { onOpenChange: F, triggerPointerDownPosRef: L } = w;
17524
+ const { onOpenChange: L, triggerPointerDownPosRef: F } = w;
17512
17525
  v.useEffect(() => {
17513
17526
  if (S) {
17514
17527
  let ee = { x: 0, y: 0 };
17515
17528
  const D = (ie) => {
17516
- var le, H;
17529
+ var ce, H;
17517
17530
  ee = {
17518
- x: Math.abs(Math.round(ie.pageX) - (((le = L.current) == null ? void 0 : le.x) ?? 0)),
17519
- y: Math.abs(Math.round(ie.pageY) - (((H = L.current) == null ? void 0 : H.y) ?? 0))
17531
+ x: Math.abs(Math.round(ie.pageX) - (((ce = F.current) == null ? void 0 : ce.x) ?? 0)),
17532
+ y: Math.abs(Math.round(ie.pageY) - (((H = F.current) == null ? void 0 : H.y) ?? 0))
17520
17533
  };
17521
17534
  }, G = (ie) => {
17522
- ee.x <= 10 && ee.y <= 10 ? ie.preventDefault() : S.contains(ie.target) || F(!1), document.removeEventListener("pointermove", D), L.current = null;
17535
+ ee.x <= 10 && ee.y <= 10 ? ie.preventDefault() : S.contains(ie.target) || L(!1), document.removeEventListener("pointermove", D), F.current = null;
17523
17536
  };
17524
- return L.current !== null && (document.addEventListener("pointermove", D), document.addEventListener("pointerup", G, { capture: !0, once: !0 })), () => {
17537
+ return F.current !== null && (document.addEventListener("pointermove", D), document.addEventListener("pointerup", G, { capture: !0, once: !0 })), () => {
17525
17538
  document.removeEventListener("pointermove", D), document.removeEventListener("pointerup", G, { capture: !0 });
17526
17539
  };
17527
17540
  }
17528
- }, [S, F, L]), v.useEffect(() => {
17529
- const ee = () => F(!1);
17541
+ }, [S, L, F]), v.useEffect(() => {
17542
+ const ee = () => L(!1);
17530
17543
  return window.addEventListener("blur", ee), window.addEventListener("resize", ee), () => {
17531
17544
  window.removeEventListener("blur", ee), window.removeEventListener("resize", ee);
17532
17545
  };
17533
- }, [F]);
17546
+ }, [L]);
17534
17547
  const [ne, Q] = Vm((ee) => {
17535
- const D = $().filter((le) => !le.disabled), G = D.find((le) => le.ref.current === document.activeElement), ie = Km(D, ee, G);
17548
+ const D = $().filter((ce) => !ce.disabled), G = D.find((ce) => ce.ref.current === document.activeElement), ie = Km(D, ee, G);
17536
17549
  ie && setTimeout(() => ie.ref.current.focus());
17537
17550
  }), ge = v.useCallback(
17538
17551
  (ee, D, G) => {
@@ -17540,13 +17553,13 @@ var On = 10, [Em, Sr] = po($r), Hk = "SelectContentImpl", Uk = no("SelectContent
17540
17553
  (w.value !== void 0 && w.value === D || ie) && (N(ee), ie && (B.current = !0));
17541
17554
  },
17542
17555
  [w.value]
17543
- ), _e = v.useCallback(() => S == null ? void 0 : S.focus(), [S]), J = v.useCallback(
17556
+ ), _e = v.useCallback(() => S == null ? void 0 : S.focus(), [S]), Z = v.useCallback(
17544
17557
  (ee, D, G) => {
17545
17558
  const ie = !B.current && !G;
17546
17559
  (w.value !== void 0 && w.value === D || ie) && M(ee);
17547
17560
  },
17548
17561
  [w.value]
17549
- ), ue = r === "popper" ? qa : Nm, ke = ue === qa ? {
17562
+ ), de = r === "popper" ? qa : Nm, ke = de === qa ? {
17550
17563
  side: a,
17551
17564
  sideOffset: l,
17552
17565
  align: c,
@@ -17568,7 +17581,7 @@ var On = 10, [Em, Sr] = po($r), Hk = "SelectContentImpl", Uk = no("SelectContent
17568
17581
  itemRefCallback: ge,
17569
17582
  selectedItem: A,
17570
17583
  onItemLeave: _e,
17571
- itemTextRefCallback: J,
17584
+ itemTextRefCallback: Z,
17572
17585
  focusSelectedItem: W,
17573
17586
  selectedItemText: _,
17574
17587
  position: r,
@@ -17596,7 +17609,7 @@ var On = 10, [Em, Sr] = po($r), Hk = "SelectContentImpl", Uk = no("SelectContent
17596
17609
  onFocusOutside: (ee) => ee.preventDefault(),
17597
17610
  onDismiss: () => w.onOpenChange(!1),
17598
17611
  children: /* @__PURE__ */ u.jsx(
17599
- ue,
17612
+ de,
17600
17613
  {
17601
17614
  role: "listbox",
17602
17615
  id: w.contentId,
@@ -17618,9 +17631,9 @@ var On = 10, [Em, Sr] = po($r), Hk = "SelectContentImpl", Uk = no("SelectContent
17618
17631
  onKeyDown: xe(y.onKeyDown, (ee) => {
17619
17632
  const D = ee.ctrlKey || ee.altKey || ee.metaKey;
17620
17633
  if (ee.key === "Tab" && ee.preventDefault(), !D && ee.key.length === 1 && Q(ee.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(ee.key)) {
17621
- let ie = $().filter((le) => !le.disabled).map((le) => le.ref.current);
17634
+ let ie = $().filter((ce) => !ce.disabled).map((ce) => ce.ref.current);
17622
17635
  if (["ArrowUp", "End"].includes(ee.key) && (ie = ie.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(ee.key)) {
17623
- const le = ee.target, H = ie.indexOf(le);
17636
+ const ce = ee.target, H = ie.indexOf(ce);
17624
17637
  ie = ie.slice(H + 1);
17625
17638
  }
17626
17639
  setTimeout(() => j(ie)), ee.preventDefault();
@@ -17642,42 +17655,42 @@ var Wk = "SelectItemAlignedPosition", Nm = v.forwardRef((e, t) => {
17642
17655
  if (s.trigger && s.valueNode && a && c && g && x && y) {
17643
17656
  const k = s.trigger.getBoundingClientRect(), A = c.getBoundingClientRect(), N = s.valueNode.getBoundingClientRect(), _ = y.getBoundingClientRect();
17644
17657
  if (s.dir !== "rtl") {
17645
- const le = _.left - A.left, H = N.left - le, We = k.left - H, re = k.width + We, ye = Math.max(re, A.width), Pe = window.innerWidth - On, Fe = Ka(H, [
17658
+ const ce = _.left - A.left, H = N.left - ce, We = k.left - H, re = k.width + We, ye = Math.max(re, A.width), Oe = window.innerWidth - On, Fe = Ka(H, [
17646
17659
  On,
17647
17660
  // Prevents the content from going off the starting edge of the
17648
17661
  // viewport. It may still go off the ending edge, but this can be
17649
17662
  // controlled by the user since they may want to manage overflow in a
17650
17663
  // specific way.
17651
17664
  // https://github.com/radix-ui/primitives/issues/2049
17652
- Math.max(On, Pe - ye)
17665
+ Math.max(On, Oe - ye)
17653
17666
  ]);
17654
17667
  a.style.minWidth = re + "px", a.style.left = Fe + "px";
17655
17668
  } else {
17656
- const le = A.right - _.right, H = window.innerWidth - N.right - le, We = window.innerWidth - k.right - H, re = k.width + We, ye = Math.max(re, A.width), Pe = window.innerWidth - On, Fe = Ka(H, [
17669
+ const ce = A.right - _.right, H = window.innerWidth - N.right - ce, We = window.innerWidth - k.right - H, re = k.width + We, ye = Math.max(re, A.width), Oe = window.innerWidth - On, Fe = Ka(H, [
17657
17670
  On,
17658
- Math.max(On, Pe - ye)
17671
+ Math.max(On, Oe - ye)
17659
17672
  ]);
17660
17673
  a.style.minWidth = re + "px", a.style.right = Fe + "px";
17661
17674
  }
17662
- const M = h(), $ = window.innerHeight - On * 2, z = g.scrollHeight, P = window.getComputedStyle(c), B = parseInt(P.borderTopWidth, 10), j = parseInt(P.paddingTop, 10), W = parseInt(P.borderBottomWidth, 10), F = parseInt(P.paddingBottom, 10), L = B + j + z + F + W, ne = Math.min(x.offsetHeight * 5, L), Q = window.getComputedStyle(g), ge = parseInt(Q.paddingTop, 10), _e = parseInt(Q.paddingBottom, 10), J = k.top + k.height / 2 - On, ue = $ - J, ke = x.offsetHeight / 2, ee = x.offsetTop + ke, D = B + j + ee, G = L - D;
17663
- if (D <= J) {
17664
- const le = M.length > 0 && x === M[M.length - 1].ref.current;
17675
+ const M = h(), $ = window.innerHeight - On * 2, z = g.scrollHeight, P = window.getComputedStyle(c), B = parseInt(P.borderTopWidth, 10), j = parseInt(P.paddingTop, 10), W = parseInt(P.borderBottomWidth, 10), L = parseInt(P.paddingBottom, 10), F = B + j + z + L + W, ne = Math.min(x.offsetHeight * 5, F), Q = window.getComputedStyle(g), ge = parseInt(Q.paddingTop, 10), _e = parseInt(Q.paddingBottom, 10), Z = k.top + k.height / 2 - On, de = $ - Z, ke = x.offsetHeight / 2, ee = x.offsetTop + ke, D = B + j + ee, G = F - D;
17676
+ if (D <= Z) {
17677
+ const ce = M.length > 0 && x === M[M.length - 1].ref.current;
17665
17678
  a.style.bottom = "0px";
17666
17679
  const H = c.clientHeight - g.offsetTop - g.offsetHeight, We = Math.max(
17667
- ue,
17680
+ de,
17668
17681
  ke + // viewport might have padding bottom, include it to avoid a scrollable viewport
17669
- (le ? _e : 0) + H + W
17682
+ (ce ? _e : 0) + H + W
17670
17683
  ), re = D + We;
17671
17684
  a.style.height = re + "px";
17672
17685
  } else {
17673
- const le = M.length > 0 && x === M[0].ref.current;
17686
+ const ce = M.length > 0 && x === M[0].ref.current;
17674
17687
  a.style.top = "0px";
17675
17688
  const We = Math.max(
17676
- J,
17689
+ Z,
17677
17690
  B + g.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
17678
- (le ? ge : 0) + ke
17691
+ (ce ? ge : 0) + ke
17679
17692
  ) + G;
17680
- a.style.height = We + "px", g.scrollTop = D - J + g.offsetTop;
17693
+ a.style.height = We + "px", g.scrollTop = D - Z + g.offsetTop;
17681
17694
  }
17682
17695
  a.style.margin = `${On}px 0`, a.style.minHeight = ne + "px", a.style.maxHeight = $ + "px", r == null || r(), requestAnimationFrame(() => p.current = !0);
17683
17696
  }
@@ -18332,10 +18345,10 @@ const xR = {
18332
18345
  };
18333
18346
  function QR({ settings: e, onSettingsChange: t, className: n = "" }) {
18334
18347
  const [r, o] = we(!1), [s, i] = we(!1), [a, l] = we(e), [c, d] = we(!1), { toast: f } = Ul();
18335
- bt(() => {
18348
+ St(() => {
18336
18349
  const x = JSON.stringify(a) !== JSON.stringify(e);
18337
18350
  d(x);
18338
- }, [a, e]), bt(() => {
18351
+ }, [a, e]), St(() => {
18339
18352
  l(e);
18340
18353
  }, [e]);
18341
18354
  const h = () => {