teodor-new-chat-ui 4.3.230 → 4.3.232

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ var om = Object.defineProperty;
2
2
  var sm = (e, t, n) => t in e ? om(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var cl = (e, t, n) => sm(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as v from "react";
5
- import z, { createContext as co, useContext as xs, useRef as Je, useCallback as Ce, useReducer as im, useEffect as Et, useMemo as at, useState as ge, useLayoutEffect as am, createElement as Do, useImperativeHandle as lm } from "react";
5
+ import z, { createContext as co, useContext as xs, useRef as et, useCallback as Ce, useReducer as im, useEffect as Et, useMemo as lt, useState as ge, useLayoutEffect as am, createElement as Do, useImperativeHandle as lm } from "react";
6
6
  import { Square as cm, Send as um, ChevronRight as Xc, Check as ca, Circle as dm, X as vr, ExternalLink as fm, Download as pm, Image as hm, FileText as ul, Loader as ua, Bot as si, Wrench as mm, User as gm, Paperclip as ji, ChevronUp as da, ChevronDown as ys, ChevronLeft as xm, Copy as dl, Edit as fl, RotateCcw as _i, Info as ym, Loader2 as zr, Edit3 as Jc, Plus as vm, FileSpreadsheet as wm, MessageSquarePlus as bm, MessageSquare as Sm, Calendar as Cm, Trash2 as Tm, Settings as km, Server as Rm, EyeOff as Em, Eye as Im, Layout as Nm, MessageCircle as Am, Save as jm } from "lucide-react";
7
7
  import { Slot as _m, createSlot as Tr } from "@radix-ui/react-slot";
8
8
  import { cva as vs } from "class-variance-authority";
@@ -51,25 +51,25 @@ function Dm() {
51
51
  function y(R) {
52
52
  if (R === null || typeof R != "object")
53
53
  return null;
54
- var K = m && R[m] || R[x];
55
- return typeof K == "function" ? K : null;
54
+ var q = m && R[m] || R[x];
55
+ return typeof q == "function" ? q : null;
56
56
  }
57
57
  var g = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
58
58
  function w(R) {
59
59
  {
60
- for (var K = arguments.length, ie = new Array(K > 1 ? K - 1 : 0), we = 1; we < K; we++)
60
+ for (var q = arguments.length, ie = new Array(q > 1 ? q - 1 : 0), we = 1; we < q; we++)
61
61
  ie[we - 1] = arguments[we];
62
62
  b("error", R, ie);
63
63
  }
64
64
  }
65
- function b(R, K, ie) {
65
+ function b(R, q, ie) {
66
66
  {
67
- var we = g.ReactDebugCurrentFrame, Ge = we.getStackAddendum();
68
- Ge !== "" && (K += "%s", ie = ie.concat([Ge]));
69
- var it = ie.map(function(He) {
70
- return String(He);
67
+ var we = g.ReactDebugCurrentFrame, Je = we.getStackAddendum();
68
+ Je !== "" && (q += "%s", ie = ie.concat([Je]));
69
+ var at = ie.map(function(Ue) {
70
+ return String(Ue);
71
71
  });
72
- it.unshift("Warning: " + K), Function.prototype.apply.call(console[R], console, it);
72
+ at.unshift("Warning: " + q), Function.prototype.apply.call(console[R], console, at);
73
73
  }
74
74
  }
75
75
  var T = !1, C = !1, S = !1, k = !1, N = !1, E;
@@ -81,12 +81,12 @@ function Dm() {
81
81
  // with.
82
82
  R.$$typeof === E || R.getModuleId !== void 0));
83
83
  }
84
- function O(R, K, ie) {
84
+ function O(R, q, ie) {
85
85
  var we = R.displayName;
86
86
  if (we)
87
87
  return we;
88
- var Ge = K.displayName || K.name || "";
89
- return Ge !== "" ? ie + "(" + Ge + ")" : ie;
88
+ var Je = q.displayName || q.name || "";
89
+ return Je !== "" ? ie + "(" + Je + ")" : ie;
90
90
  }
91
91
  function L(R) {
92
92
  return R.displayName || "Context";
@@ -115,8 +115,8 @@ function Dm() {
115
115
  if (typeof R == "object")
116
116
  switch (R.$$typeof) {
117
117
  case a:
118
- var K = R;
119
- return L(K) + ".Consumer";
118
+ var q = R;
119
+ return L(q) + ".Consumer";
120
120
  case i:
121
121
  var ie = R;
122
122
  return L(ie._context) + ".Provider";
@@ -126,9 +126,9 @@ function Dm() {
126
126
  var we = R.displayName || null;
127
127
  return we !== null ? we : F(R.type) || "Memo";
128
128
  case p: {
129
- var Ge = R, it = Ge._payload, He = Ge._init;
129
+ var Je = R, at = Je._payload, Ue = Je._init;
130
130
  try {
131
- return F(He(it));
131
+ return F(Ue(at));
132
132
  } catch {
133
133
  return null;
134
134
  }
@@ -198,18 +198,18 @@ function Dm() {
198
198
  $ < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
199
199
  }
200
200
  }
201
- var ee = g.ReactCurrentDispatcher, q;
202
- function P(R, K, ie) {
201
+ var ee = g.ReactCurrentDispatcher, U;
202
+ function P(R, q, ie) {
203
203
  {
204
- if (q === void 0)
204
+ if (U === void 0)
205
205
  try {
206
206
  throw Error();
207
- } catch (Ge) {
208
- var we = Ge.stack.trim().match(/\n( *(at )?)/);
209
- q = we && we[1] || "";
207
+ } catch (Je) {
208
+ var we = Je.stack.trim().match(/\n( *(at )?)/);
209
+ U = we && we[1] || "";
210
210
  }
211
211
  return `
212
- ` + q + R;
212
+ ` + U + R;
213
213
  }
214
214
  }
215
215
  var H = !1, te;
@@ -217,7 +217,7 @@ function Dm() {
217
217
  var se = typeof WeakMap == "function" ? WeakMap : Map;
218
218
  te = new se();
219
219
  }
220
- function ne(R, K) {
220
+ function ne(R, q) {
221
221
  if (!R || H)
222
222
  return "";
223
223
  {
@@ -227,33 +227,33 @@ function Dm() {
227
227
  }
228
228
  var we;
229
229
  H = !0;
230
- var Ge = Error.prepareStackTrace;
230
+ var Je = Error.prepareStackTrace;
231
231
  Error.prepareStackTrace = void 0;
232
- var it;
233
- it = ee.current, ee.current = null, Ee();
232
+ var at;
233
+ at = ee.current, ee.current = null, Ee();
234
234
  try {
235
- if (K) {
236
- var He = function() {
235
+ if (q) {
236
+ var Ue = function() {
237
237
  throw Error();
238
238
  };
239
- if (Object.defineProperty(He.prototype, "props", {
239
+ if (Object.defineProperty(Ue.prototype, "props", {
240
240
  set: function() {
241
241
  throw Error();
242
242
  }
243
243
  }), typeof Reflect == "object" && Reflect.construct) {
244
244
  try {
245
- Reflect.construct(He, []);
245
+ Reflect.construct(Ue, []);
246
246
  } catch (Ft) {
247
247
  we = Ft;
248
248
  }
249
- Reflect.construct(R, [], He);
249
+ Reflect.construct(R, [], Ue);
250
250
  } else {
251
251
  try {
252
- He.call();
252
+ Ue.call();
253
253
  } catch (Ft) {
254
254
  we = Ft;
255
255
  }
256
- R.call(He.prototype);
256
+ R.call(Ue.prototype);
257
257
  }
258
258
  } else {
259
259
  try {
@@ -265,17 +265,17 @@ function Dm() {
265
265
  }
266
266
  } catch (Ft) {
267
267
  if (Ft && we && typeof Ft.stack == "string") {
268
- for (var $e = Ft.stack.split(`
268
+ for (var ze = Ft.stack.split(`
269
269
  `), Ot = we.stack.split(`
270
- `), bt = $e.length - 1, vt = Ot.length - 1; bt >= 1 && vt >= 0 && $e[bt] !== Ot[vt]; )
270
+ `), bt = ze.length - 1, vt = Ot.length - 1; bt >= 1 && vt >= 0 && ze[bt] !== Ot[vt]; )
271
271
  vt--;
272
272
  for (; bt >= 1 && vt >= 0; bt--, vt--)
273
- if ($e[bt] !== Ot[vt]) {
273
+ if (ze[bt] !== Ot[vt]) {
274
274
  if (bt !== 1 || vt !== 1)
275
275
  do
276
- if (bt--, vt--, vt < 0 || $e[bt] !== Ot[vt]) {
276
+ if (bt--, vt--, vt < 0 || ze[bt] !== Ot[vt]) {
277
277
  var Kt = `
278
- ` + $e[bt].replace(" at new ", " at ");
278
+ ` + ze[bt].replace(" at new ", " at ");
279
279
  return R.displayName && Kt.includes("<anonymous>") && (Kt = Kt.replace("<anonymous>", R.displayName)), typeof R == "function" && te.set(R, Kt), Kt;
280
280
  }
281
281
  while (bt >= 1 && vt >= 0);
@@ -283,19 +283,19 @@ function Dm() {
283
283
  }
284
284
  }
285
285
  } finally {
286
- H = !1, ee.current = it, W(), Error.prepareStackTrace = Ge;
286
+ H = !1, ee.current = at, W(), Error.prepareStackTrace = Je;
287
287
  }
288
288
  var Fn = R ? R.displayName || R.name : "", Nn = Fn ? P(Fn) : "";
289
289
  return typeof R == "function" && te.set(R, Nn), Nn;
290
290
  }
291
- function Oe(R, K, ie) {
291
+ function Le(R, q, ie) {
292
292
  return ne(R, !1);
293
293
  }
294
294
  function Y(R) {
295
- var K = R.prototype;
296
- return !!(K && K.isReactComponent);
295
+ var q = R.prototype;
296
+ return !!(q && q.isReactComponent);
297
297
  }
298
- function de(R, K, ie) {
298
+ function de(R, q, ie) {
299
299
  if (R == null)
300
300
  return "";
301
301
  if (typeof R == "function")
@@ -311,71 +311,71 @@ function Dm() {
311
311
  if (typeof R == "object")
312
312
  switch (R.$$typeof) {
313
313
  case l:
314
- return Oe(R.render);
314
+ return Le(R.render);
315
315
  case f:
316
- return de(R.type, K, ie);
316
+ return de(R.type, q, ie);
317
317
  case p: {
318
- var we = R, Ge = we._payload, it = we._init;
318
+ var we = R, Je = we._payload, at = we._init;
319
319
  try {
320
- return de(it(Ge), K, ie);
320
+ return de(at(Je), q, ie);
321
321
  } catch {
322
322
  }
323
323
  }
324
324
  }
325
325
  return "";
326
326
  }
327
- var ke = Object.prototype.hasOwnProperty, Ne = {}, ze = g.ReactDebugCurrentFrame;
328
- function Be(R) {
327
+ var ke = Object.prototype.hasOwnProperty, Ne = {}, Be = g.ReactDebugCurrentFrame;
328
+ function He(R) {
329
329
  if (R) {
330
- var K = R._owner, ie = de(R.type, R._source, K ? K.type : null);
331
- ze.setExtraStackFrame(ie);
330
+ var q = R._owner, ie = de(R.type, R._source, q ? q.type : null);
331
+ Be.setExtraStackFrame(ie);
332
332
  } else
333
- ze.setExtraStackFrame(null);
333
+ Be.setExtraStackFrame(null);
334
334
  }
335
- function Ue(R, K, ie, we, Ge) {
335
+ function We(R, q, ie, we, Je) {
336
336
  {
337
- var it = Function.call.bind(ke);
338
- for (var He in R)
339
- if (it(R, He)) {
340
- var $e = void 0;
337
+ var at = Function.call.bind(ke);
338
+ for (var Ue in R)
339
+ if (at(R, Ue)) {
340
+ var ze = void 0;
341
341
  try {
342
- if (typeof R[He] != "function") {
343
- var Ot = Error((we || "React class") + ": " + ie + " type `" + He + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[He] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
342
+ if (typeof R[Ue] != "function") {
343
+ var Ot = Error((we || "React class") + ": " + ie + " type `" + Ue + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[Ue] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
344
344
  throw Ot.name = "Invariant Violation", Ot;
345
345
  }
346
- $e = R[He](K, He, we, ie, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
346
+ ze = R[Ue](q, Ue, we, ie, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
347
  } catch (bt) {
348
- $e = bt;
348
+ ze = bt;
349
349
  }
350
- $e && !($e instanceof Error) && (Be(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).", we || "React class", ie, He, typeof $e), Be(null)), $e instanceof Error && !($e.message in Ne) && (Ne[$e.message] = !0, Be(Ge), w("Failed %s type: %s", ie, $e.message), Be(null));
350
+ ze && !(ze instanceof Error) && (He(Je), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", we || "React class", ie, Ue, typeof ze), He(null)), ze instanceof Error && !(ze.message in Ne) && (Ne[ze.message] = !0, He(Je), w("Failed %s type: %s", ie, ze.message), He(null));
351
351
  }
352
352
  }
353
353
  }
354
- var Ke = Array.isArray;
355
- function qe(R) {
356
- return Ke(R);
354
+ var qe = Array.isArray;
355
+ function Ge(R) {
356
+ return qe(R);
357
357
  }
358
- function Ze(R) {
358
+ function tt(R) {
359
359
  {
360
- var K = typeof Symbol == "function" && Symbol.toStringTag, ie = K && R[Symbol.toStringTag] || R.constructor.name || "Object";
360
+ var q = typeof Symbol == "function" && Symbol.toStringTag, ie = q && R[Symbol.toStringTag] || R.constructor.name || "Object";
361
361
  return ie;
362
362
  }
363
363
  }
364
- function Xe(R) {
364
+ function Qe(R) {
365
365
  try {
366
- return rt(R), !1;
366
+ return ot(R), !1;
367
367
  } catch {
368
368
  return !0;
369
369
  }
370
370
  }
371
- function rt(R) {
371
+ function ot(R) {
372
372
  return "" + R;
373
373
  }
374
374
  function St(R) {
375
- if (Xe(R))
376
- return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ze(R)), rt(R);
375
+ if (Qe(R))
376
+ return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", tt(R)), ot(R);
377
377
  }
378
- var mt = g.ReactCurrentOwner, lt = {
378
+ var mt = g.ReactCurrentOwner, ct = {
379
379
  key: !0,
380
380
  ref: !0,
381
381
  __self: !0,
@@ -383,27 +383,27 @@ function Dm() {
383
383
  }, Ct, ce;
384
384
  function re(R) {
385
385
  if (ke.call(R, "ref")) {
386
- var K = Object.getOwnPropertyDescriptor(R, "ref").get;
387
- if (K && K.isReactWarning)
386
+ var q = Object.getOwnPropertyDescriptor(R, "ref").get;
387
+ if (q && q.isReactWarning)
388
388
  return !1;
389
389
  }
390
390
  return R.ref !== void 0;
391
391
  }
392
- function Le(R) {
392
+ function Ye(R) {
393
393
  if (ke.call(R, "key")) {
394
- var K = Object.getOwnPropertyDescriptor(R, "key").get;
395
- if (K && K.isReactWarning)
394
+ var q = Object.getOwnPropertyDescriptor(R, "key").get;
395
+ if (q && q.isReactWarning)
396
396
  return !1;
397
397
  }
398
398
  return R.key !== void 0;
399
399
  }
400
- function Qe(R, K) {
400
+ function De(R, q) {
401
401
  typeof R.ref == "string" && mt.current;
402
402
  }
403
- function Me(R, K) {
403
+ function Xe(R, q) {
404
404
  {
405
405
  var ie = function() {
406
- Ct || (Ct = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", K));
406
+ Ct || (Ct = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", q));
407
407
  };
408
408
  ie.isReactWarning = !0, Object.defineProperty(R, "key", {
409
409
  get: ie,
@@ -411,10 +411,10 @@ function Dm() {
411
411
  });
412
412
  }
413
413
  }
414
- function ut(R, K) {
414
+ function je(R, q) {
415
415
  {
416
416
  var ie = function() {
417
- ce || (ce = !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));
417
+ ce || (ce = !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)", q));
418
418
  };
419
419
  ie.isReactWarning = !0, Object.defineProperty(R, "ref", {
420
420
  get: ie,
@@ -422,57 +422,57 @@ function Dm() {
422
422
  });
423
423
  }
424
424
  }
425
- var et = function(R, K, ie, we, Ge, it, He) {
426
- var $e = {
425
+ var Fe = function(R, q, ie, we, Je, at, Ue) {
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
- key: K,
431
+ key: q,
432
432
  ref: ie,
433
- props: He,
433
+ props: Ue,
434
434
  // Record the component responsible for creating this element.
435
- _owner: it
435
+ _owner: at
436
436
  };
437
- return $e._store = {}, Object.defineProperty($e._store, "validated", {
437
+ return ze._store = {}, Object.defineProperty(ze._store, "validated", {
438
438
  configurable: !1,
439
439
  enumerable: !1,
440
440
  writable: !0,
441
441
  value: !1
442
- }), Object.defineProperty($e, "_self", {
442
+ }), Object.defineProperty(ze, "_self", {
443
443
  configurable: !1,
444
444
  enumerable: !1,
445
445
  writable: !1,
446
446
  value: we
447
- }), Object.defineProperty($e, "_source", {
447
+ }), Object.defineProperty(ze, "_source", {
448
448
  configurable: !1,
449
449
  enumerable: !1,
450
450
  writable: !1,
451
- value: Ge
452
- }), Object.freeze && (Object.freeze($e.props), Object.freeze($e)), $e;
451
+ value: Je
452
+ }), Object.freeze && (Object.freeze(ze.props), Object.freeze(ze)), ze;
453
453
  };
454
- function Fe(R, K, ie, we, Ge) {
454
+ function Oe(R, q, ie, we, Je) {
455
455
  {
456
- var it, He = {}, $e = null, Ot = null;
457
- ie !== void 0 && (St(ie), $e = "" + ie), Le(K) && (St(K.key), $e = "" + K.key), re(K) && (Ot = K.ref, Qe(K, Ge));
458
- for (it in K)
459
- ke.call(K, it) && !lt.hasOwnProperty(it) && (He[it] = K[it]);
456
+ var at, Ue = {}, ze = null, Ot = null;
457
+ ie !== void 0 && (St(ie), ze = "" + ie), Ye(q) && (St(q.key), ze = "" + q.key), re(q) && (Ot = q.ref, De(q, Je));
458
+ for (at in q)
459
+ ke.call(q, at) && !ct.hasOwnProperty(at) && (Ue[at] = q[at]);
460
460
  if (R && R.defaultProps) {
461
461
  var bt = R.defaultProps;
462
- for (it in bt)
463
- He[it] === void 0 && (He[it] = bt[it]);
462
+ for (at in bt)
463
+ Ue[at] === void 0 && (Ue[at] = bt[at]);
464
464
  }
465
- if ($e || Ot) {
465
+ if (ze || Ot) {
466
466
  var vt = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
467
- $e && Me(He, vt), Ot && ut(He, vt);
467
+ ze && Xe(Ue, vt), Ot && je(Ue, vt);
468
468
  }
469
- return et(R, $e, Ot, Ge, we, mt.current, He);
469
+ return Fe(R, ze, Ot, Je, we, mt.current, Ue);
470
470
  }
471
471
  }
472
472
  var Pt = g.ReactCurrentOwner, jt = g.ReactDebugCurrentFrame;
473
- function V(R) {
473
+ function K(R) {
474
474
  if (R) {
475
- var K = R._owner, ie = de(R.type, R._source, K ? K.type : null);
475
+ var q = R._owner, ie = de(R.type, R._source, q ? q.type : null);
476
476
  jt.setExtraStackFrame(ie);
477
477
  } else
478
478
  jt.setExtraStackFrame(null);
@@ -498,117 +498,117 @@ Check the render method of \`` + R + "`.";
498
498
  return "";
499
499
  }
500
500
  var Tt = {};
501
- function je(R) {
501
+ function _e(R) {
502
502
  {
503
- var K = ht();
504
- if (!K) {
503
+ var q = ht();
504
+ if (!q) {
505
505
  var ie = typeof R == "string" ? R : R.displayName || R.name;
506
- ie && (K = `
506
+ ie && (q = `
507
507
 
508
508
  Check the top-level render call using <` + ie + ">.");
509
509
  }
510
- return K;
510
+ return q;
511
511
  }
512
512
  }
513
- function Vt(R, K) {
513
+ function Vt(R, q) {
514
514
  {
515
515
  if (!R._store || R._store.validated || R.key != null)
516
516
  return;
517
517
  R._store.validated = !0;
518
- var ie = je(K);
518
+ var ie = _e(q);
519
519
  if (Tt[ie])
520
520
  return;
521
521
  Tt[ie] = !0;
522
522
  var we = "";
523
- R && R._owner && R._owner !== Pt.current && (we = " It was passed a child from " + F(R._owner.type) + "."), V(R), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ie, we), V(null);
523
+ R && R._owner && R._owner !== Pt.current && (we = " It was passed a child from " + F(R._owner.type) + "."), K(R), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ie, we), K(null);
524
524
  }
525
525
  }
526
- function ct(R, K) {
526
+ function ut(R, q) {
527
527
  {
528
528
  if (typeof R != "object")
529
529
  return;
530
- if (qe(R))
530
+ if (Ge(R))
531
531
  for (var ie = 0; ie < R.length; ie++) {
532
532
  var we = R[ie];
533
- xe(we) && Vt(we, K);
533
+ xe(we) && Vt(we, q);
534
534
  }
535
535
  else if (xe(R))
536
536
  R._store && (R._store.validated = !0);
537
537
  else if (R) {
538
- var Ge = y(R);
539
- if (typeof Ge == "function" && Ge !== R.entries)
540
- for (var it = Ge.call(R), He; !(He = it.next()).done; )
541
- xe(He.value) && Vt(He.value, K);
538
+ var Je = y(R);
539
+ if (typeof Je == "function" && Je !== R.entries)
540
+ for (var at = Je.call(R), Ue; !(Ue = at.next()).done; )
541
+ xe(Ue.value) && Vt(Ue.value, q);
542
542
  }
543
543
  }
544
544
  }
545
545
  function kt(R) {
546
546
  {
547
- var K = R.type;
548
- if (K == null || typeof K == "string")
547
+ var q = R.type;
548
+ if (q == null || typeof q == "string")
549
549
  return;
550
550
  var ie;
551
- if (typeof K == "function")
552
- ie = K.propTypes;
553
- else if (typeof K == "object" && (K.$$typeof === l || // Note: Memo only checks outer props here.
551
+ if (typeof q == "function")
552
+ ie = q.propTypes;
553
+ else if (typeof q == "object" && (q.$$typeof === l || // Note: Memo only checks outer props here.
554
554
  // Inner props are checked in the reconciler.
555
- K.$$typeof === f))
556
- ie = K.propTypes;
555
+ q.$$typeof === f))
556
+ ie = q.propTypes;
557
557
  else
558
558
  return;
559
559
  if (ie) {
560
- var we = F(K);
561
- Ue(ie, R.props, "prop", we, R);
562
- } else if (K.PropTypes !== void 0 && !ve) {
560
+ var we = F(q);
561
+ We(ie, R.props, "prop", we, R);
562
+ } else if (q.PropTypes !== void 0 && !ve) {
563
563
  ve = !0;
564
- var Ge = F(K);
565
- w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Ge || "Unknown");
564
+ var Je = F(q);
565
+ w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Je || "Unknown");
566
566
  }
567
- typeof K.getDefaultProps == "function" && !K.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
567
+ typeof q.getDefaultProps == "function" && !q.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
568
568
  }
569
569
  }
570
570
  function Dn(R) {
571
571
  {
572
- for (var K = Object.keys(R.props), ie = 0; ie < K.length; ie++) {
573
- var we = K[ie];
572
+ for (var q = Object.keys(R.props), ie = 0; ie < q.length; ie++) {
573
+ var we = q[ie];
574
574
  if (we !== "children" && we !== "key") {
575
- V(R), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", we), V(null);
575
+ K(R), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", we), K(null);
576
576
  break;
577
577
  }
578
578
  }
579
- R.ref !== null && (V(R), w("Invalid attribute `ref` supplied to `React.Fragment`."), V(null));
579
+ R.ref !== null && (K(R), w("Invalid attribute `ref` supplied to `React.Fragment`."), K(null));
580
580
  }
581
581
  }
582
582
  var Jn = {};
583
- function Ln(R, K, ie, we, Ge, it) {
583
+ function Ln(R, q, ie, we, Je, at) {
584
584
  {
585
- var He = I(R);
586
- if (!He) {
587
- var $e = "";
588
- (R === void 0 || typeof R == "object" && R !== null && Object.keys(R).length === 0) && ($e += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
585
+ var Ue = I(R);
586
+ if (!Ue) {
587
+ var ze = "";
588
+ (R === void 0 || typeof R == "object" && R !== null && Object.keys(R).length === 0) && (ze += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
589
589
  var Ot = gt();
590
- Ot ? $e += Ot : $e += ht();
590
+ Ot ? ze += Ot : ze += ht();
591
591
  var bt;
592
- R === null ? bt = "null" : qe(R) ? bt = "array" : R !== void 0 && R.$$typeof === t ? (bt = "<" + (F(R.type) || "Unknown") + " />", $e = " Did you accidentally export a JSX literal instead of a component?") : bt = typeof R, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", bt, $e);
592
+ R === null ? bt = "null" : Ge(R) ? bt = "array" : R !== void 0 && R.$$typeof === t ? (bt = "<" + (F(R.type) || "Unknown") + " />", ze = " Did you accidentally export a JSX literal instead of a component?") : bt = typeof R, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", bt, ze);
593
593
  }
594
- var vt = Fe(R, K, ie, Ge, it);
594
+ var vt = Oe(R, q, ie, Je, at);
595
595
  if (vt == null)
596
596
  return vt;
597
- if (He) {
598
- var Kt = K.children;
597
+ if (Ue) {
598
+ var Kt = q.children;
599
599
  if (Kt !== void 0)
600
600
  if (we)
601
- if (qe(Kt)) {
601
+ if (Ge(Kt)) {
602
602
  for (var Fn = 0; Fn < Kt.length; Fn++)
603
- ct(Kt[Fn], R);
603
+ ut(Kt[Fn], R);
604
604
  Object.freeze && Object.freeze(Kt);
605
605
  } else
606
606
  w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
607
607
  else
608
- ct(Kt, R);
608
+ ut(Kt, R);
609
609
  }
610
- if (ke.call(K, "key")) {
611
- var Nn = F(R), Ft = Object.keys(K).filter(function(oe) {
610
+ if (ke.call(q, "key")) {
611
+ var Nn = F(R), Ft = Object.keys(q).filter(function(oe) {
612
612
  return oe !== "key";
613
613
  }), Dr = Ft.length > 0 ? "{key: someKey, " + Ft.join(": ..., ") + ": ...}" : "{key: someKey}";
614
614
  if (!Jn[Nn + Dr]) {
@@ -624,11 +624,11 @@ React keys must be passed directly to JSX without using spread:
624
624
  return R === r ? Dn(vt) : kt(vt), vt;
625
625
  }
626
626
  }
627
- function ti(R, K, ie) {
628
- return Ln(R, K, ie, !0);
627
+ function ti(R, q, ie) {
628
+ return Ln(R, q, ie, !0);
629
629
  }
630
- function So(R, K, ie) {
631
- return Ln(R, K, ie, !1);
630
+ function So(R, q, ie) {
631
+ return Ln(R, q, ie, !1);
632
632
  }
633
633
  var ni = So, ri = ti;
634
634
  Fr.Fragment = r, Fr.jsx = ni, Fr.jsxs = ri;
@@ -874,10 +874,10 @@ const xg = (e) => {
874
874
  asap: wg,
875
875
  isIterable: bg
876
876
  };
877
- function _e(e, t, n, r, o) {
877
+ function Pe(e, t, n, r, o) {
878
878
  Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), o && (this.response = o, this.status = o.status ? o.status : null);
879
879
  }
880
- _.inherits(_e, Error, {
880
+ _.inherits(Pe, Error, {
881
881
  toJSON: function() {
882
882
  return {
883
883
  // Standard
@@ -898,7 +898,7 @@ _.inherits(_e, Error, {
898
898
  };
899
899
  }
900
900
  });
901
- const au = _e.prototype, lu = {};
901
+ const au = Pe.prototype, lu = {};
902
902
  [
903
903
  "ERR_BAD_OPTION_VALUE",
904
904
  "ERR_BAD_OPTION",
@@ -916,15 +916,15 @@ const au = _e.prototype, lu = {};
916
916
  ].forEach((e) => {
917
917
  lu[e] = { value: e };
918
918
  });
919
- Object.defineProperties(_e, lu);
919
+ Object.defineProperties(Pe, lu);
920
920
  Object.defineProperty(au, "isAxiosError", { value: !0 });
921
- _e.from = (e, t, n, r, o, s) => {
921
+ Pe.from = (e, t, n, r, o, s) => {
922
922
  const i = Object.create(au);
923
923
  _.toFlatObject(e, i, function(d) {
924
924
  return d !== Error.prototype;
925
925
  }, (c) => c !== "isAxiosError");
926
926
  const a = e && e.message ? e.message : "Error", l = t == null && e ? e.code : t;
927
- return _e.call(i, a, l, n, r, o), e && i.cause == null && Object.defineProperty(i, "cause", { value: e, configurable: !0 }), i.name = e && e.name || "Error", s && Object.assign(i, s), i;
927
+ return Pe.call(i, a, l, n, r, o), e && i.cause == null && Object.defineProperty(i, "cause", { value: e, configurable: !0 }), i.name = e && e.name || "Error", s && Object.assign(i, s), i;
928
928
  };
929
929
  const Sg = null;
930
930
  function Mi(e) {
@@ -964,7 +964,7 @@ function Ts(e, t, n) {
964
964
  if (_.isBoolean(m))
965
965
  return m.toString();
966
966
  if (!l && _.isBlob(m))
967
- throw new _e("Blob is not supported. Use a Buffer instead.");
967
+ throw new Pe("Blob is not supported. Use a Buffer instead.");
968
968
  return _.isArrayBuffer(m) || _.isTypedArray(m) ? l && typeof Blob == "function" ? new Blob([m]) : Buffer.from(m) : m;
969
969
  }
970
970
  function d(m, x, y) {
@@ -1215,7 +1215,7 @@ const ho = {
1215
1215
  return JSON.parse(t, this.parseReviver);
1216
1216
  } catch (a) {
1217
1217
  if (i)
1218
- throw a.name === "SyntaxError" ? _e.from(a, _e.ERR_BAD_RESPONSE, this, null, this.response) : a;
1218
+ throw a.name === "SyntaxError" ? Pe.from(a, Pe.ERR_BAD_RESPONSE, this, null, this.response) : a;
1219
1219
  }
1220
1220
  }
1221
1221
  return t;
@@ -1458,16 +1458,16 @@ function hu(e) {
1458
1458
  return !!(e && e.__CANCEL__);
1459
1459
  }
1460
1460
  function Ar(e, t, n) {
1461
- _e.call(this, e ?? "canceled", _e.ERR_CANCELED, t, n), this.name = "CanceledError";
1461
+ Pe.call(this, e ?? "canceled", Pe.ERR_CANCELED, t, n), this.name = "CanceledError";
1462
1462
  }
1463
- _.inherits(Ar, _e, {
1463
+ _.inherits(Ar, Pe, {
1464
1464
  __CANCEL__: !0
1465
1465
  });
1466
1466
  function mu(e, t, n) {
1467
1467
  const r = n.config.validateStatus;
1468
- !n.status || !r || r(n.status) ? e(n) : t(new _e(
1468
+ !n.status || !r || r(n.status) ? e(n) : t(new Pe(
1469
1469
  "Request failed with status code " + n.status,
1470
- [_e.ERR_BAD_REQUEST, _e.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
1470
+ [Pe.ERR_BAD_REQUEST, Pe.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
1471
1471
  n.config,
1472
1472
  n.request,
1473
1473
  n
@@ -1690,16 +1690,16 @@ const xu = (e) => {
1690
1690
  "onloadend" in y ? y.onloadend = g : y.onreadystatechange = function() {
1691
1691
  !y || y.readyState !== 4 || y.status === 0 && !(y.responseURL && y.responseURL.indexOf("file:") === 0) || setTimeout(g);
1692
1692
  }, y.onabort = function() {
1693
- y && (r(new _e("Request aborted", _e.ECONNABORTED, e, y)), y = null);
1693
+ y && (r(new Pe("Request aborted", Pe.ECONNABORTED, e, y)), y = null);
1694
1694
  }, y.onerror = function(T) {
1695
- const C = T && T.message ? T.message : "Network Error", S = new _e(C, _e.ERR_NETWORK, e, y);
1695
+ const C = T && T.message ? T.message : "Network Error", S = new Pe(C, Pe.ERR_NETWORK, e, y);
1696
1696
  S.event = T || null, r(S), y = null;
1697
1697
  }, y.ontimeout = function() {
1698
1698
  let T = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
1699
1699
  const C = o.transitional || fu;
1700
- o.timeoutErrorMessage && (T = o.timeoutErrorMessage), r(new _e(
1700
+ o.timeoutErrorMessage && (T = o.timeoutErrorMessage), r(new Pe(
1701
1701
  T,
1702
- C.clarifyTimeoutError ? _e.ETIMEDOUT : _e.ECONNABORTED,
1702
+ C.clarifyTimeoutError ? Pe.ETIMEDOUT : Pe.ECONNABORTED,
1703
1703
  e,
1704
1704
  y
1705
1705
  )), y = null;
@@ -1710,7 +1710,7 @@ const xu = (e) => {
1710
1710
  }, o.cancelToken && o.cancelToken.subscribe(d), o.signal && (o.signal.aborted ? d() : o.signal.addEventListener("abort", d)));
1711
1711
  const w = Wg(o.url);
1712
1712
  if (w && zt.protocols.indexOf(w) === -1) {
1713
- r(new _e("Unsupported protocol " + w + ":", _e.ERR_BAD_REQUEST, e));
1713
+ r(new Pe("Unsupported protocol " + w + ":", Pe.ERR_BAD_REQUEST, e));
1714
1714
  return;
1715
1715
  }
1716
1716
  y.send(s || null);
@@ -1723,11 +1723,11 @@ const xu = (e) => {
1723
1723
  if (!o) {
1724
1724
  o = !0, a();
1725
1725
  const d = c instanceof Error ? c : this.reason;
1726
- r.abort(d instanceof _e ? d : new Ar(d instanceof Error ? d.message : d));
1726
+ r.abort(d instanceof Pe ? d : new Ar(d instanceof Error ? d.message : d));
1727
1727
  }
1728
1728
  };
1729
1729
  let i = t && setTimeout(() => {
1730
- i = null, s(new _e(`timeout ${t} of ms exceeded`, _e.ETIMEDOUT));
1730
+ i = null, s(new Pe(`timeout ${t} of ms exceeded`, Pe.ETIMEDOUT));
1731
1731
  }, t);
1732
1732
  const a = () => {
1733
1733
  e && (i && clearTimeout(i), i = null, e.forEach((c) => {
@@ -1832,7 +1832,7 @@ const xu = (e) => {
1832
1832
  let g = x && x[m];
1833
1833
  if (g)
1834
1834
  return g.call(x);
1835
- throw new _e(`Response type '${m}' is not supported`, _e.ERR_NOT_SUPPORT, y);
1835
+ throw new Pe(`Response type '${m}' is not supported`, Pe.ERR_NOT_SUPPORT, y);
1836
1836
  });
1837
1837
  });
1838
1838
  const p = async (m) => {
@@ -1932,11 +1932,11 @@ const xu = (e) => {
1932
1932
  });
1933
1933
  } catch (A) {
1934
1934
  throw j && j(), A && A.name === "TypeError" && /Load failed|fetch/i.test(A.message) ? Object.assign(
1935
- new _e("Network Error", _e.ERR_NETWORK, m, F),
1935
+ new Pe("Network Error", Pe.ERR_NETWORK, m, F),
1936
1936
  {
1937
1937
  cause: A.cause || A
1938
1938
  }
1939
- ) : _e.from(A, A && A.code, m, F);
1939
+ ) : Pe.from(A, A && A.code, m, F);
1940
1940
  }
1941
1941
  };
1942
1942
  }, sx = /* @__PURE__ */ new Map(), yu = (e) => {
@@ -1978,7 +1978,7 @@ const Il = (e) => `- ${e}`, ix = (e) => _.isFunction(e) || e === null || e === !
1978
1978
  r = e[i];
1979
1979
  let a;
1980
1980
  if (o = r, !ix(r) && (o = Li[(a = String(r)).toLowerCase()], o === void 0))
1981
- throw new _e(`Unknown adapter '${a}'`);
1981
+ throw new Pe(`Unknown adapter '${a}'`);
1982
1982
  if (o && (_.isFunction(o) || (o = o.get(t))))
1983
1983
  break;
1984
1984
  s[a || "#" + i] = o;
@@ -1990,7 +1990,7 @@ const Il = (e) => `- ${e}`, ix = (e) => _.isFunction(e) || e === null || e === !
1990
1990
  let a = n ? i.length > 1 ? `since :
1991
1991
  ` + i.map(Il).join(`
1992
1992
  `) : " " + Il(i[0]) : "as no adapter specified";
1993
- throw new _e(
1993
+ throw new Pe(
1994
1994
  "There is no suitable adapter to dispatch the request " + a,
1995
1995
  "ERR_NOT_SUPPORT"
1996
1996
  );
@@ -2034,9 +2034,9 @@ ks.transitional = function(t, n, r) {
2034
2034
  }
2035
2035
  return (s, i, a) => {
2036
2036
  if (t === !1)
2037
- throw new _e(
2037
+ throw new Pe(
2038
2038
  o(i, " has been removed" + (n ? " in " + n : "")),
2039
- _e.ERR_DEPRECATED
2039
+ Pe.ERR_DEPRECATED
2040
2040
  );
2041
2041
  return n && !Al[i] && (Al[i] = !0, console.warn(
2042
2042
  o(
@@ -2051,7 +2051,7 @@ ks.spelling = function(t) {
2051
2051
  };
2052
2052
  function ax(e, t, n) {
2053
2053
  if (typeof e != "object")
2054
- throw new _e("options must be an object", _e.ERR_BAD_OPTION_VALUE);
2054
+ throw new Pe("options must be an object", Pe.ERR_BAD_OPTION_VALUE);
2055
2055
  const r = Object.keys(e);
2056
2056
  let o = r.length;
2057
2057
  for (; o-- > 0; ) {
@@ -2059,11 +2059,11 @@ function ax(e, t, n) {
2059
2059
  if (i) {
2060
2060
  const a = e[s], l = a === void 0 || i(a, s, e);
2061
2061
  if (l !== !0)
2062
- throw new _e("option " + s + " must be " + l, _e.ERR_BAD_OPTION_VALUE);
2062
+ throw new Pe("option " + s + " must be " + l, Pe.ERR_BAD_OPTION_VALUE);
2063
2063
  continue;
2064
2064
  }
2065
2065
  if (n !== !0)
2066
- throw new _e("Unknown option " + s, _e.ERR_BAD_OPTION);
2066
+ throw new Pe("Unknown option " + s, Pe.ERR_BAD_OPTION);
2067
2067
  }
2068
2068
  }
2069
2069
  const $o = {
@@ -2356,7 +2356,7 @@ It.CancelToken = lx;
2356
2356
  It.isCancel = hu;
2357
2357
  It.VERSION = wu;
2358
2358
  It.toFormData = Ts;
2359
- It.AxiosError = _e;
2359
+ It.AxiosError = Pe;
2360
2360
  It.Cancel = It.CanceledError;
2361
2361
  It.all = function(t) {
2362
2362
  return Promise.all(t);
@@ -2951,7 +2951,7 @@ function Dx(e, t) {
2951
2951
  return r ? Object.keys(n).length ? n : void 0 : e;
2952
2952
  }
2953
2953
  function Lx() {
2954
- const e = Je(/* @__PURE__ */ new Map()), t = Ce(
2954
+ const e = et(/* @__PURE__ */ new Map()), t = Ce(
2955
2955
  (a, l) => {
2956
2956
  const c = e.current.get(a), d = /* @__PURE__ */ new Map();
2957
2957
  c && c.forEach((f) => {
@@ -3052,7 +3052,7 @@ function zx(e, t) {
3052
3052
  }
3053
3053
  }
3054
3054
  function Bx(e = []) {
3055
- const [t, n] = im(zx, { ...$x, messages: e }), r = Je([]), o = Je(null), s = Je(null), i = Ce(() => {
3055
+ const [t, n] = im(zx, { ...$x, messages: e }), r = et([]), o = et(null), s = et(null), i = Ce(() => {
3056
3056
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), o.current = null, s.current = null;
3057
3057
  const d = r.current;
3058
3058
  d.length && (r.current = [], n({ type: "batch", payload: { events: d } }));
@@ -3064,7 +3064,7 @@ function Bx(e = []) {
3064
3064
  Et(() => () => {
3065
3065
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
3066
3066
  }, []);
3067
- const c = at(() => ({
3067
+ const c = lt(() => ({
3068
3068
  reset: (d) => n({ type: "reset", payload: { messages: d } }),
3069
3069
  seed: (d, f) => n({ type: "seed", payload: { messages: d, ...f ?? {} } }),
3070
3070
  prepend: (d) => n({ type: "prepend", payload: { messages: d } }),
@@ -3398,7 +3398,7 @@ function Vx(e) {
3398
3398
  return t[t.length - 1] || null;
3399
3399
  }
3400
3400
  function Kx(e = {}) {
3401
- const t = at(() => _n(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = ge(e.token ?? null), s = Je(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = ge(!1), [c, d] = ge(null), [f, p] = ge(""), [h, m] = ge(null), [x, y] = ge(0), [g, w] = ge(!1), b = Je(null), T = Je(!0), C = Je(0), S = Je(null), k = Je(null), N = Je(null), E = Je(null), I = Ce((j) => {
3401
+ const t = lt(() => _n(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = ge(e.token ?? null), s = et(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = ge(!1), [c, d] = ge(null), [f, p] = ge(""), [h, m] = ge(null), [x, y] = ge(0), [g, w] = ge(!1), b = et(null), T = et(!0), C = et(0), S = et(null), k = et(null), N = et(null), E = et(null), I = Ce((j) => {
3402
3402
  o(j);
3403
3403
  }, []), O = Ce(() => {
3404
3404
  p(""), m(null), d(null), k.current = null, N.current = null, E.current = null;
@@ -3415,34 +3415,34 @@ function Kx(e = {}) {
3415
3415
  threadId: j.threadId ?? null,
3416
3416
  headers: {}
3417
3417
  }, (async () => {
3418
- var pe, Re, Ee, W, ee, q, P, H, te, se, ne, Oe, Y, de, ke, Ne, ze, Be;
3419
- const J = (Ue) => {
3420
- var Ke;
3418
+ var pe, Re, Ee, W, ee, U, P, H, te, se, ne, Le, Y, de, ke, Ne, Be, He;
3419
+ const J = (We) => {
3420
+ var qe;
3421
3421
  try {
3422
- const qe = JSON.parse(JSON.stringify(Ue));
3423
- return (Ke = qe == null ? void 0 : qe.payload) != null && Ke.files_info && Array.isArray(qe.payload.files_info) && (qe.payload.files_info = qe.payload.files_info.map((Ze) => ({
3424
- ...Ze,
3425
- data: Ze != null && Ze.data ? `<base64 ${String(Ze.data).length} chars>` : Ze == null ? void 0 : Ze.data
3426
- }))), qe;
3422
+ const Ge = JSON.parse(JSON.stringify(We));
3423
+ return (qe = Ge == null ? void 0 : Ge.payload) != null && qe.files_info && Array.isArray(Ge.payload.files_info) && (Ge.payload.files_info = Ge.payload.files_info.map((tt) => ({
3424
+ ...tt,
3425
+ data: tt != null && tt.data ? `<base64 ${String(tt.data).length} chars>` : tt == null ? void 0 : tt.data
3426
+ }))), Ge;
3427
3427
  } catch {
3428
- return Ue;
3428
+ return We;
3429
3429
  }
3430
3430
  };
3431
3431
  try {
3432
- let Ue = {};
3432
+ let We = {};
3433
3433
  try {
3434
3434
  if (r)
3435
- Ue = { Authorization: `Bearer ${r}` };
3435
+ We = { Authorization: `Bearer ${r}` };
3436
3436
  else if (typeof window < "u") {
3437
- const Fe = window.__AUTH_TOKEN__, Pt = ((pe = window.localStorage) == null ? void 0 : pe.getItem("authToken")) || null;
3437
+ const Oe = window.__AUTH_TOKEN__, Pt = ((pe = window.localStorage) == null ? void 0 : pe.getItem("authToken")) || null;
3438
3438
  let jt = null;
3439
3439
  try {
3440
3440
  const ve = (Re = window.localStorage) == null ? void 0 : Re.getItem("chat-settings");
3441
3441
  ve && (jt = ((Ee = JSON.parse(ve)) == null ? void 0 : Ee.apiKey) || null);
3442
3442
  } catch {
3443
3443
  }
3444
- const V = Fe || Pt || jt || null;
3445
- V && (Ue = { Authorization: `Bearer ${V}` });
3444
+ const K = Oe || Pt || jt || null;
3445
+ K && (We = { Authorization: `Bearer ${K}` });
3446
3446
  }
3447
3447
  } catch {
3448
3448
  }
@@ -3451,69 +3451,69 @@ function Kx(e = {}) {
3451
3451
  t + n,
3452
3452
  J(j)
3453
3453
  );
3454
- let Ke = {};
3454
+ let qe = {};
3455
3455
  if (typeof window < "u")
3456
3456
  try {
3457
- const et = (W = window.localStorage) == null ? void 0 : W.getItem("authSessionId");
3458
- et && (Ke = { "X-Session-Id": et });
3457
+ const Fe = (W = window.localStorage) == null ? void 0 : W.getItem("authSessionId");
3458
+ Fe && (qe = { "X-Session-Id": Fe });
3459
3459
  } catch {
3460
3460
  }
3461
- const qe = {
3462
- ...Ue,
3463
- ...Ke,
3461
+ const Ge = {
3462
+ ...We,
3463
+ ...qe,
3464
3464
  ...s.current
3465
- }, Ze = {
3465
+ }, tt = {
3466
3466
  "Content-Type": "application/json",
3467
3467
  Accept: "text/event-stream",
3468
- ...qe
3469
- }, Xe = await fetch(t + n, {
3468
+ ...Ge
3469
+ }, Qe = await fetch(t + n, {
3470
3470
  method: "POST",
3471
- headers: Ze,
3471
+ headers: tt,
3472
3472
  body: JSON.stringify(j),
3473
3473
  signal: B.signal,
3474
3474
  credentials: i
3475
3475
  });
3476
- if (S.current && (S.current.headers = qe), !Xe.ok || !Xe.body) {
3477
- const et = await Xe.text().catch(() => "");
3476
+ if (S.current && (S.current.headers = Ge), !Qe.ok || !Qe.body) {
3477
+ const Fe = await Qe.text().catch(() => "");
3478
3478
  console.debug(
3479
3479
  "[use-chat] non-OK response",
3480
- Xe.status,
3481
- et == null ? void 0 : et.slice(0, 500)
3480
+ Qe.status,
3481
+ Fe == null ? void 0 : Fe.slice(0, 500)
3482
3482
  );
3483
- const Fe = `stream ${Xe.status}${et ? ": " + et : ""}`;
3484
- throw (ee = A == null ? void 0 : A.onConnectionError) == null || ee.call(A, Fe), Z = !0, D = "error", M = Fe, new Error(Fe);
3483
+ const Oe = `stream ${Qe.status}${Fe ? ": " + Fe : ""}`;
3484
+ throw (ee = A == null ? void 0 : A.onConnectionError) == null || ee.call(A, Oe), Z = !0, D = "error", M = Oe, new Error(Oe);
3485
3485
  }
3486
3486
  w(!0);
3487
- const rt = Xe.body.getReader(), St = new TextDecoder();
3488
- let mt = "", lt = [];
3487
+ const ot = Qe.body.getReader(), St = new TextDecoder();
3488
+ let mt = "", ct = [];
3489
3489
  C.current = 0, y(0);
3490
3490
  let Ct = 0, ce = null;
3491
3491
  const re = () => {
3492
- if (lt.length) {
3493
- const et = lt.join("");
3494
- lt = [], T.current && p((Fe) => Fe + et);
3492
+ if (ct.length) {
3493
+ const Fe = ct.join("");
3494
+ ct = [], T.current && p((Oe) => Oe + Fe);
3495
3495
  }
3496
3496
  ce = null;
3497
- }, Le = () => {
3497
+ }, Ye = () => {
3498
3498
  typeof window < "u" && ce == null && (ce = requestAnimationFrame(re));
3499
3499
  };
3500
- let Qe = Date.now();
3501
- const Me = setInterval(() => {
3502
- var et;
3503
- if (Date.now() - Qe > 18e5) {
3504
- const Fe = "Stream idle timeout";
3505
- d(Fe), D = "error", M = Fe, B.abort(), (et = A == null ? void 0 : A.onError) == null || et.call(A, Fe);
3500
+ let De = Date.now();
3501
+ const Xe = setInterval(() => {
3502
+ var Fe;
3503
+ if (Date.now() - De > 18e5) {
3504
+ const Oe = "Stream idle timeout";
3505
+ d(Oe), D = "error", M = Oe, B.abort(), (Fe = A == null ? void 0 : A.onError) == null || Fe.call(A, Oe);
3506
3506
  }
3507
- }, 5e3), ut = 1024 * 1024;
3507
+ }, 5e3), je = 1024 * 1024;
3508
3508
  try {
3509
- const et = Xe.headers.get("X-Thread-Id") || Xe.headers.get("x-thread-id"), Fe = Xe.headers.get("X-Thread-Created") || Xe.headers.get("x-thread-created"), Pt = et ?? null, jt = String(Fe ?? "").toLowerCase() === "true";
3509
+ const Fe = Qe.headers.get("X-Thread-Id") || Qe.headers.get("x-thread-id"), Oe = Qe.headers.get("X-Thread-Created") || Qe.headers.get("x-thread-created"), Pt = Fe ?? null, jt = String(Oe ?? "").toLowerCase() === "true";
3510
3510
  for (S.current && !S.current.threadId && (S.current = {
3511
3511
  ...S.current,
3512
3512
  threadId: Pt
3513
- }), (q = A == null ? void 0 : A.onOpen) == null || q.call(A, { threadId: Pt, created: jt }); ; ) {
3514
- const { value: V, done: ve } = await rt.read();
3513
+ }), (U = A == null ? void 0 : A.onOpen) == null || U.call(A, { threadId: Pt, created: jt }); ; ) {
3514
+ const { value: K, done: ve } = await ot.read();
3515
3515
  if (ve) break;
3516
- mt += St.decode(V, { stream: !0 }), mt.length > ut && (mt = "", console.warn("Stream buffer reset: exceeded 1MB"));
3516
+ mt += St.decode(K, { stream: !0 }), mt.length > je && (mt = "", console.warn("Stream buffer reset: exceeded 1MB"));
3517
3517
  let xe;
3518
3518
  for (; (xe = mt.indexOf(`
3519
3519
 
@@ -3529,63 +3529,63 @@ function Kx(e = {}) {
3529
3529
  console.debug("[use-chat] malformed SSE:", gt.slice(0, 200));
3530
3530
  continue;
3531
3531
  }
3532
- const je = qx(Tt) ? Tt.data : Tt;
3533
- Qe = Date.now();
3534
- const Vt = je.seq;
3532
+ const _e = qx(Tt) ? Tt.data : Tt;
3533
+ De = Date.now();
3534
+ const Vt = _e.seq;
3535
3535
  if (Vt !== void 0) {
3536
3536
  if (Vt <= Ct) {
3537
- console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Vt, lastProcessedSeq: Ct, type: je.type });
3537
+ console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Vt, lastProcessedSeq: Ct, type: _e.type });
3538
3538
  continue;
3539
3539
  }
3540
3540
  Ct > 0 && Vt > Ct + 1 && ((P = A == null ? void 0 : A.onGap) == null || P.call(A, { from: Ct, to: Vt })), Ct = Vt, C.current = Vt, y(Vt);
3541
3541
  }
3542
3542
  if (console.debug("[use-chat] received event", {
3543
- seq: je.seq,
3544
- type: je.type,
3543
+ seq: _e.seq,
3544
+ type: _e.type,
3545
3545
  preview: (() => {
3546
- var ct;
3546
+ var ut;
3547
3547
  try {
3548
- return je.type === "message_delta" ? { deltaTypes: (ct = je.delta) == null ? void 0 : ct.map((kt) => kt.type), textLen: (je.delta || []).filter((kt) => kt.type === "text").map((kt) => String(kt.text || "").length) } : je.content || je.delta ? { hasContent: !0 } : {};
3548
+ return _e.type === "message_delta" ? { deltaTypes: (ut = _e.delta) == null ? void 0 : ut.map((kt) => kt.type), textLen: (_e.delta || []).filter((kt) => kt.type === "text").map((kt) => String(kt.text || "").length) } : _e.content || _e.delta ? { hasContent: !0 } : {};
3549
3549
  } catch (kt) {
3550
3550
  return { err: String(kt) };
3551
3551
  }
3552
3552
  })()
3553
- }), je.type === "checkpoint")
3554
- k.current = je.checkpointId ?? null, N.current = je.checkpointNs ?? null, m(je.checkpointId ?? null);
3555
- else if (je.type === "state_history") {
3556
- E.current = je;
3553
+ }), _e.type === "checkpoint")
3554
+ k.current = _e.checkpointId ?? null, N.current = _e.checkpointNs ?? null, m(_e.checkpointId ?? null);
3555
+ else if (_e.type === "state_history") {
3556
+ E.current = _e;
3557
3557
  try {
3558
- const kt = Ur(je).latest;
3558
+ const kt = Ur(_e).latest;
3559
3559
  kt && (k.current = kt.checkpointId ?? null, N.current = kt.checkpointNs ?? null, m(kt.checkpointId ?? null));
3560
- } catch (ct) {
3561
- console.warn("[use-chat] Failed to hydrate state_history payload", ct);
3560
+ } catch (ut) {
3561
+ console.warn("[use-chat] Failed to hydrate state_history payload", ut);
3562
3562
  }
3563
3563
  }
3564
3564
  try {
3565
- $ == null || $(je);
3566
- } catch (ct) {
3567
- console.error("[use-chat] Error in onEvent callback:", ct, "for event:", je.type);
3565
+ $ == null || $(_e);
3566
+ } catch (ut) {
3567
+ console.error("[use-chat] Error in onEvent callback:", ut, "for event:", _e.type);
3568
3568
  }
3569
- if (je.type === "token" && e.autoAppendAssistant !== !1)
3570
- lt.push(je.content), Le();
3571
- else if (je.type === "message_delta") {
3572
- const ct = je.delta.filter((kt) => kt.type === "text").map((kt) => kt.text).join("");
3573
- ct && e.autoAppendAssistant !== !1 && (lt.push(ct), Le());
3574
- } else if (je.type === "heartbeat") {
3569
+ if (_e.type === "token" && e.autoAppendAssistant !== !1)
3570
+ ct.push(_e.content), Ye();
3571
+ else if (_e.type === "message_delta") {
3572
+ const ut = _e.delta.filter((kt) => kt.type === "text").map((kt) => kt.text).join("");
3573
+ ut && e.autoAppendAssistant !== !1 && (ct.push(ut), Ye());
3574
+ } else if (_e.type === "heartbeat") {
3575
3575
  console.debug("[use-chat] heartbeat received");
3576
3576
  try {
3577
- (H = A == null ? void 0 : A.onHeartbeat) == null || H.call(A, je);
3578
- } catch (ct) {
3579
- console.warn("[use-chat] heartbeat callback failed", ct);
3577
+ (H = A == null ? void 0 : A.onHeartbeat) == null || H.call(A, _e);
3578
+ } catch (ut) {
3579
+ console.warn("[use-chat] heartbeat callback failed", ut);
3580
3580
  }
3581
- } else if (ce !== null && cancelAnimationFrame(ce), re(), je.type === "checkpoint")
3582
- m(je.checkpointId);
3583
- else if (je.type === "error") {
3584
- const ct = je;
3585
- if (d(ct.message), D = "error", M = ct.message, ct.error_type === "auth_error" || ct.code === "TOKEN_EXPIRED" || ((te = ct.message) == null ? void 0 : te.includes("token")) || ((se = ct.message) == null ? void 0 : se.includes("401")) || ((ne = ct.message) == null ? void 0 : ne.includes("unauthorized")) || ((Oe = ct.message) == null ? void 0 : Oe.includes("Unauthorized"))) {
3586
- console.error("[use-chat] Auth error detected:", ct.message);
3581
+ } else if (ce !== null && cancelAnimationFrame(ce), re(), _e.type === "checkpoint")
3582
+ m(_e.checkpointId);
3583
+ else if (_e.type === "error") {
3584
+ const ut = _e;
3585
+ if (d(ut.message), D = "error", M = ut.message, ut.error_type === "auth_error" || ut.code === "TOKEN_EXPIRED" || ((te = ut.message) == null ? void 0 : te.includes("token")) || ((se = ut.message) == null ? void 0 : se.includes("401")) || ((ne = ut.message) == null ? void 0 : ne.includes("unauthorized")) || ((Le = ut.message) == null ? void 0 : Le.includes("Unauthorized"))) {
3586
+ console.error("[use-chat] Auth error detected:", ut.message);
3587
3587
  try {
3588
- (Y = A == null ? void 0 : A.onAuthError) == null || Y.call(A, ct.message);
3588
+ (Y = A == null ? void 0 : A.onAuthError) == null || Y.call(A, ut.message);
3589
3589
  } catch (Dn) {
3590
3590
  console.warn("[use-chat] onAuthError handler failed", Dn);
3591
3591
  }
@@ -3595,42 +3595,42 @@ function Kx(e = {}) {
3595
3595
  }
3596
3596
  }
3597
3597
  re(), D === null && !B.signal.aborted && (D = "complete");
3598
- } catch (et) {
3599
- if (et.name === "AbortError")
3598
+ } catch (Fe) {
3599
+ if (Fe.name === "AbortError")
3600
3600
  D = D ?? "aborted";
3601
3601
  else {
3602
- const Fe = et.message || String(et);
3603
- D = "error", M = Fe, d(Fe), (de = A == null ? void 0 : A.onError) == null || de.call(A, Fe);
3602
+ const Oe = Fe.message || String(Fe);
3603
+ D = "error", M = Oe, d(Oe), (de = A == null ? void 0 : A.onError) == null || de.call(A, Oe);
3604
3604
  }
3605
3605
  } finally {
3606
3606
  try {
3607
- await rt.cancel();
3607
+ await ot.cancel();
3608
3608
  } catch {
3609
3609
  } finally {
3610
- (ke = rt.releaseLock) == null || ke.call(rt);
3610
+ (ke = ot.releaseLock) == null || ke.call(ot);
3611
3611
  }
3612
- ce !== null && typeof window < "u" && window.cancelAnimationFrame(ce), clearInterval(Me);
3612
+ ce !== null && typeof window < "u" && window.cancelAnimationFrame(ce), clearInterval(Xe);
3613
3613
  }
3614
- } catch (Ue) {
3615
- if (Ue.name === "AbortError")
3614
+ } catch (We) {
3615
+ if (We.name === "AbortError")
3616
3616
  D = D ?? "aborted";
3617
3617
  else {
3618
- const Ke = Ue.message || String(Ue);
3619
- D = "error", M = Ke, d(Ke), (Ne = A == null ? void 0 : A.onError) == null || Ne.call(A, Ke), Z || ((ze = A == null ? void 0 : A.onConnectionError) == null || ze.call(A, Ke), Z = !0);
3618
+ const qe = We.message || String(We);
3619
+ D = "error", M = qe, d(qe), (Ne = A == null ? void 0 : A.onError) == null || Ne.call(A, qe), Z || ((Be = A == null ? void 0 : A.onConnectionError) == null || Be.call(A, qe), Z = !0);
3620
3620
  }
3621
3621
  } finally {
3622
- const Ue = C.current, Ke = k.current, qe = N.current, Ze = E.current, Xe = D ?? (B.signal.aborted ? "aborted" : M ? "error" : "complete");
3622
+ const We = C.current, qe = k.current, Ge = N.current, tt = E.current, Qe = D ?? (B.signal.aborted ? "aborted" : M ? "error" : "complete");
3623
3623
  try {
3624
- (Be = A == null ? void 0 : A.onClosed) == null || Be.call(A, {
3625
- reason: Xe,
3626
- lastSeq: Ue,
3627
- lastCheckpointId: Ke,
3628
- lastCheckpointNs: qe,
3629
- lastStateHistory: Ze,
3624
+ (He = A == null ? void 0 : A.onClosed) == null || He.call(A, {
3625
+ reason: Qe,
3626
+ lastSeq: We,
3627
+ lastCheckpointId: qe,
3628
+ lastCheckpointNs: Ge,
3629
+ lastStateHistory: tt,
3630
3630
  error: M
3631
3631
  });
3632
- } catch (rt) {
3633
- console.warn("[use-chat] onClosed callback failed", rt);
3632
+ } catch (ot) {
3633
+ console.warn("[use-chat] onClosed callback failed", ot);
3634
3634
  }
3635
3635
  l(!1), w(!1), b.current = null, C.current = 0, y(0), S.current = null;
3636
3636
  }
@@ -3679,7 +3679,7 @@ function Yx({
3679
3679
  onAuthError: a,
3680
3680
  onHeartbeat: l
3681
3681
  }) {
3682
- const c = Je(null), d = Je(null), f = Je(/* @__PURE__ */ new Map()), p = Je(null), h = Ce((E) => {
3682
+ const c = et(null), d = et(null), f = et(/* @__PURE__ */ new Map()), p = et(null), h = Ce((E) => {
3683
3683
  try {
3684
3684
  const I = globalThis.structuredClone;
3685
3685
  if (typeof I == "function")
@@ -3850,7 +3850,7 @@ function Yx({
3850
3850
  ), N = Ce(() => {
3851
3851
  p.current && (p.current.manualStop = !0), b();
3852
3852
  }, [b]);
3853
- return at(
3853
+ return lt(
3854
3854
  () => ({
3855
3855
  startStream: k,
3856
3856
  stop: N,
@@ -3875,11 +3875,11 @@ function Xx({
3875
3875
  onThreadChange: a,
3876
3876
  checkpointMetadataCache: l
3877
3877
  }) {
3878
- const { api: c, baseUrl: d } = Tu(), f = at(() => _n(d), [d]), [p, h] = ge([]), [m, x] = ge(t), [y, g] = ge(!1), [w, b] = ge(null), [T, C] = ge(!1), [S, k] = ge(null), { state: N, seed: E, prepend: I, pushUser: O, onEvent: L } = Bx(), [F, j] = ge(!1), [$, A] = ge(!1), [B, D] = ge(null), [M, Z] = ge([]), [J, pe] = ge(!1), Re = l ?? Lx(), { setCacheForThread: Ee } = Re, W = Je(m), ee = Je(null), q = Je(!1);
3878
+ const { api: c, baseUrl: d } = Tu(), f = lt(() => _n(d), [d]), [p, h] = ge([]), [m, x] = ge(t), [y, g] = ge(!1), [w, b] = ge(null), [T, C] = ge(!1), [S, k] = ge(null), { state: N, seed: E, prepend: I, pushUser: O, onEvent: L } = Bx(), [F, j] = ge(!1), [$, A] = ge(!1), [B, D] = ge(null), [M, Z] = ge([]), [J, pe] = ge(!1), Re = l ?? Lx(), { setCacheForThread: Ee } = Re, W = et(m), ee = et(null), U = et(!1);
3879
3879
  Et(() => {
3880
3880
  W.current = m;
3881
3881
  }, [m]);
3882
- const P = Je(), { startStream: H, stop: te, isStreaming: se, error: ne, setAuthToken: Oe } = Yx({
3882
+ const P = et(), { startStream: H, stop: te, isStreaming: se, error: ne, setAuthToken: Le } = Yx({
3883
3883
  baseUrl: f,
3884
3884
  onThreadInfo: (ce) => {
3885
3885
  if (console.log("[ChatSessionProvider] Thread info:", ce.threadId), W.current === null) {
@@ -3927,82 +3927,104 @@ function Xx({
3927
3927
  async (ce, re) => {
3928
3928
  try {
3929
3929
  await c.updateThread(ce, re), await Y();
3930
- } catch (Le) {
3931
- s == null || s(String(Le));
3930
+ } catch (Ye) {
3931
+ s == null || s(String(Ye));
3932
3932
  }
3933
3933
  },
3934
3934
  [c, Y, s]
3935
- ), ze = Ce(
3936
- (ce, re, Le) => {
3937
- const Qe = re.filter((Me) => Me.checkpointId).map((Me) => ({
3938
- checkpointId: Me.checkpointId,
3939
- checkpointNs: Me.checkpointNs ?? void 0,
3940
- createdAt: Me.createdAt ?? ""
3935
+ ), Be = Ce(
3936
+ (ce, re, Ye) => {
3937
+ const De = re.filter((Xe) => Xe.checkpointId).map((Xe) => ({
3938
+ checkpointId: Xe.checkpointId,
3939
+ checkpointNs: Xe.checkpointNs ?? void 0,
3940
+ createdAt: Xe.createdAt ?? ""
3941
3941
  }));
3942
- console.log(`[ChatSessionProvider] Cached metadata for ${Qe.length} checkpoints from ${Le}`), Ee(ce, Qe);
3942
+ console.log(`[ChatSessionProvider] Cached metadata for ${De.length} checkpoints from ${Ye}`), Ee(ce, De);
3943
3943
  },
3944
3944
  [Ee]
3945
- ), Be = Ce(
3945
+ ), He = Ce(
3946
3946
  async (ce, re) => {
3947
- if (ce) {
3948
- C(!0), k(null);
3949
- try {
3950
- const Le = await c.getStateHistory({
3951
- threadId: ce,
3952
- checkpointId: re || void 0
3953
- // Let backend pick latest if not specified
3954
- }), { checkpoints: Qe } = Ur(Le);
3955
- ze(ce, Qe, `thread load (requested: ${re})`);
3956
- const Me = Qe.find((ut) => ut.messages && ut.messages.length > 0) ?? (re ? Qe.find((ut) => ut.checkpointId === re) : null) ?? Qe[0];
3957
- E((Me == null ? void 0 : Me.messages) ?? [], {
3958
- checkpointId: (Me == null ? void 0 : Me.checkpointId) ?? null,
3959
- checkpointNs: (Me == null ? void 0 : Me.checkpointNs) ?? null
3960
- }), Z(Qe), j(!!(Me != null && Me.nextCursor)), D((Me == null ? void 0 : Me.nextCursor) ?? null);
3961
- } catch (Le) {
3962
- const Qe = String(Le);
3963
- k(Qe), s == null || s(Qe);
3964
- } finally {
3965
- C(!1);
3947
+ if (!ce) return;
3948
+ if (U.current) {
3949
+ console.log("[ChatSessionProvider] Skipping thread load - cleanup in progress");
3950
+ return;
3951
+ }
3952
+ C(!0), k(null);
3953
+ let Ye = !0;
3954
+ try {
3955
+ const De = await c.getStateHistory({
3956
+ threadId: ce,
3957
+ checkpointId: re || void 0
3958
+ // Let backend pick latest if not specified
3959
+ });
3960
+ if (U.current) {
3961
+ console.log("[ChatSessionProvider] Discarding thread load - thread was cleared"), Ye = !1;
3962
+ return;
3963
+ }
3964
+ const { checkpoints: Xe } = Ur(De);
3965
+ Be(ce, Xe, `thread load (requested: ${re})`);
3966
+ const je = Xe.find((Fe) => Fe.messages && Fe.messages.length > 0) ?? (re ? Xe.find((Fe) => Fe.checkpointId === re) : null) ?? Xe[0];
3967
+ E((je == null ? void 0 : je.messages) ?? [], {
3968
+ checkpointId: (je == null ? void 0 : je.checkpointId) ?? null,
3969
+ checkpointNs: (je == null ? void 0 : je.checkpointNs) ?? null
3970
+ }), Z(Xe), j(!!(je != null && je.nextCursor)), D((je == null ? void 0 : je.nextCursor) ?? null);
3971
+ } catch (De) {
3972
+ if (U.current)
3973
+ console.log("[ChatSessionProvider] Error during thread load, but cleanup in progress - ignoring"), Ye = !1;
3974
+ else {
3975
+ const Xe = String(De);
3976
+ k(Xe), s == null || s(Xe);
3966
3977
  }
3978
+ } finally {
3979
+ Ye && C(!1);
3967
3980
  }
3968
3981
  },
3969
- [c, E, s, ze]
3982
+ [c, E, s, Be]
3970
3983
  );
3971
3984
  Et(() => {
3972
- P.current = Be;
3973
- }, [Be]);
3974
- const Ue = Ce(
3985
+ P.current = He;
3986
+ }, [He]);
3987
+ const We = Ce(
3975
3988
  async (ce, re) => {
3976
- const Le = W.current;
3977
- if (Le) {
3978
- pe(!0);
3979
- try {
3980
- const Qe = await c.getStateHistory({
3981
- threadId: Le,
3982
- checkpointId: ce,
3983
- checkpointNs: re ?? void 0
3984
- }), { checkpoints: Me } = Ur(Qe);
3985
- ze(Le, Me, "checkpoint navigation");
3986
- const ut = Me.find(
3987
- (et) => et.checkpointId === ce && (re ? et.checkpointNs === re : !0)
3988
- );
3989
- if (!ut) {
3990
- console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: ce, checkpointNs: re });
3991
- return;
3992
- }
3993
- Z(Me), E(ut.messages ?? [], {
3994
- checkpointId: ut.checkpointId ?? null,
3995
- checkpointNs: ut.checkpointNs ?? null
3996
- });
3997
- } catch (Qe) {
3998
- s == null || s(String(Qe));
3999
- } finally {
4000
- pe(!1);
3989
+ const Ye = W.current;
3990
+ if (!Ye) return;
3991
+ if (U.current) {
3992
+ console.log("[ChatSessionProvider] Skipping checkpoint navigation - cleanup in progress");
3993
+ return;
3994
+ }
3995
+ pe(!0);
3996
+ let De = !0;
3997
+ try {
3998
+ const Xe = await c.getStateHistory({
3999
+ threadId: Ye,
4000
+ checkpointId: ce,
4001
+ checkpointNs: re ?? void 0
4002
+ });
4003
+ if (U.current) {
4004
+ console.log("[ChatSessionProvider] Discarding checkpoint navigation - thread was cleared"), De = !1;
4005
+ return;
4001
4006
  }
4007
+ const { checkpoints: je } = Ur(Xe);
4008
+ Be(Ye, je, "checkpoint navigation");
4009
+ const Fe = je.find(
4010
+ (Oe) => Oe.checkpointId === ce && (re ? Oe.checkpointNs === re : !0)
4011
+ );
4012
+ if (!Fe) {
4013
+ console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: ce, checkpointNs: re });
4014
+ return;
4015
+ }
4016
+ Z(je), E(Fe.messages ?? [], {
4017
+ checkpointId: Fe.checkpointId ?? null,
4018
+ checkpointNs: Fe.checkpointNs ?? null
4019
+ });
4020
+ } catch (Xe) {
4021
+ U.current ? (console.log("[ChatSessionProvider] Error during checkpoint navigation, but cleanup in progress - ignoring"), De = !1) : s == null || s(String(Xe));
4022
+ } finally {
4023
+ De && pe(!1);
4002
4024
  }
4003
4025
  },
4004
- [c, E, s, ze]
4005
- ), Ke = Ce(
4026
+ [c, E, s, Be]
4027
+ ), qe = Ce(
4006
4028
  (ce, re) => {
4007
4029
  E(N.messages, {
4008
4030
  checkpointId: ce ?? null,
@@ -4010,42 +4032,57 @@ function Xx({
4010
4032
  });
4011
4033
  },
4012
4034
  [E, N.messages]
4013
- ), qe = Ce(async () => {
4014
- W.current && await Be(W.current);
4015
- }, [Be]), Ze = Ce(async () => {
4016
- if (!(!W.current || !B)) {
4017
- if (q.current) {
4018
- console.log("[ChatSessionProvider] Skipping history load - thread cleanup in progress");
4035
+ ), Ge = Ce(async () => {
4036
+ W.current && await He(W.current);
4037
+ }, [He]), tt = Ce(async () => {
4038
+ if (!W.current || !B) return;
4039
+ if (U.current) {
4040
+ console.log("[ChatSessionProvider] Skipping history load - thread cleanup in progress");
4041
+ return;
4042
+ }
4043
+ A(!0);
4044
+ let ce = !0;
4045
+ try {
4046
+ const re = await c.getStateHistory({
4047
+ threadId: W.current,
4048
+ checkpointId: B
4049
+ });
4050
+ if (U.current) {
4051
+ console.log("[ChatSessionProvider] Discarding history fetch - thread was cleared"), ce = !1;
4019
4052
  return;
4020
4053
  }
4021
- A(!0);
4054
+ const { checkpoints: Ye } = Ur(re);
4055
+ if (Ye.length > 0) {
4056
+ const De = Ye[Ye.length - 1];
4057
+ I((De == null ? void 0 : De.messages) ?? []), j(!!(De != null && De.nextCursor)), D((De == null ? void 0 : De.nextCursor) ?? null);
4058
+ }
4059
+ } catch (re) {
4060
+ U.current ? (console.log("[ChatSessionProvider] Error during history fetch, but cleanup in progress - ignoring"), ce = !1) : s == null || s(String(re));
4061
+ } finally {
4062
+ ce && A(!1);
4063
+ }
4064
+ }, [c, B, I, s]), Qe = Ce(async () => {
4065
+ U.current = !0, te(), W.current = null, ee.current = null, E([], {}), Z([]), j(!1), D(null), x(null), await Promise.resolve(), U.current = !1;
4066
+ }, [E, te]), ot = Ce(
4067
+ async (ce, re, Ye) => {
4068
+ const De = W.current;
4069
+ if (!De)
4070
+ throw new Error("No active thread to handle interrupt");
4071
+ const Xe = re ? Ye ?? !0 : !1;
4022
4072
  try {
4023
- const ce = await c.getStateHistory({
4024
- threadId: W.current,
4025
- checkpointId: B
4026
- });
4027
- if (q.current) {
4028
- console.log("[ChatSessionProvider] Discarding history fetch - thread was cleared");
4029
- return;
4030
- }
4031
- const { checkpoints: re } = Ur(ce);
4032
- if (re.length > 0) {
4033
- const Le = re[re.length - 1];
4034
- I((Le == null ? void 0 : Le.messages) ?? []), j(!!(Le != null && Le.nextCursor)), D((Le == null ? void 0 : Le.nextCursor) ?? null);
4035
- }
4036
- } catch (ce) {
4037
- s == null || s(String(ce));
4038
- } finally {
4039
- A(!1);
4073
+ const je = {
4074
+ threadId: De,
4075
+ checkpointId: N.lastCheckpointId ?? void 0,
4076
+ checkpointNs: N.lastCheckpointNs ?? void 0,
4077
+ // The command is the key: backend extracts this and routes to LangGraph
4078
+ command: { kind: "resume", value: Xe }
4079
+ };
4080
+ H(je);
4081
+ } catch (je) {
4082
+ throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${ce}:`, je), je;
4040
4083
  }
4041
- }
4042
- }, [c, B, I, s]), Xe = Ce(async () => {
4043
- q.current = !0, te(), W.current = null, ee.current = null, E([], {}), Z([]), j(!1), D(null), await Promise.resolve(), q.current = !1;
4044
- }, [E, te]), rt = Ce(
4045
- async (ce, re) => {
4046
- console.log("[ChatSessionProvider] Interrupt:", ce, re);
4047
4084
  },
4048
- []
4085
+ [N.lastCheckpointId, N.lastCheckpointNs, H]
4049
4086
  );
4050
4087
  Et(() => {
4051
4088
  Y();
@@ -4057,33 +4094,33 @@ function Xx({
4057
4094
  }, [m, a]);
4058
4095
  const St = Ce(
4059
4096
  async (ce, re) => {
4060
- const Le = W.current, Qe = (ce == null ? void 0 : ce.text) ?? "";
4061
- if (!Le && !Qe) return;
4062
- if (!Le) {
4097
+ const Ye = W.current, De = (ce == null ? void 0 : ce.text) ?? "";
4098
+ if (!Ye && !De) return;
4099
+ if (!Ye) {
4063
4100
  await de("New Chat");
4064
4101
  return;
4065
4102
  }
4066
- const { contentParts: Me } = await wx(
4103
+ const { contentParts: Xe } = await wx(
4067
4104
  c,
4068
4105
  (ce == null ? void 0 : ce.attachments) ?? []
4069
- ), ut = [...Me];
4070
- Qe != null && Qe.trim() && ut.push({ type: "text", text: Qe });
4071
- const et = {
4106
+ ), je = [...Xe];
4107
+ De != null && De.trim() && je.push({ type: "text", text: De });
4108
+ const Fe = {
4072
4109
  id: `msg-${Date.now()}`,
4073
4110
  role: "user",
4074
- content: ut,
4111
+ content: je,
4075
4112
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4076
4113
  };
4077
- O(et);
4078
- const Fe = {
4079
- threadId: Le,
4114
+ O(Fe);
4115
+ const Oe = {
4116
+ threadId: Ye,
4080
4117
  checkpointId: (re == null ? void 0 : re.checkpointId) ?? N.lastCheckpointId ?? void 0,
4081
4118
  checkpointNs: (re == null ? void 0 : re.checkpointNs) ?? N.lastCheckpointNs ?? void 0
4082
4119
  };
4083
- H(Fe);
4120
+ H(Oe);
4084
4121
  },
4085
4122
  [c, de, O, N, H]
4086
- ), mt = at(
4123
+ ), mt = lt(
4087
4124
  () => ({
4088
4125
  threads: p,
4089
4126
  currentThreadId: m,
@@ -4098,7 +4135,7 @@ function Xx({
4098
4135
  }
4099
4136
  }),
4100
4137
  [p, m, y, w, de, ke, Ne, Y]
4101
- ), lt = at(
4138
+ ), ct = lt(
4102
4139
  () => ({
4103
4140
  threadId: m,
4104
4141
  messages: N.messages,
@@ -4114,14 +4151,14 @@ function Xx({
4114
4151
  isLoadingCheckpoint: J,
4115
4152
  error: S,
4116
4153
  hasMore: F,
4117
- loadOlder: Ze,
4118
- clearState: Xe,
4119
- navigateToCheckpoint: Ue,
4120
- setCurrentCheckpointId: Ke,
4121
- returnToLatest: qe,
4122
- loadThread: Be,
4123
- clearThread: Xe,
4124
- respondToInterrupt: rt
4154
+ loadOlder: tt,
4155
+ clearState: Qe,
4156
+ navigateToCheckpoint: We,
4157
+ setCurrentCheckpointId: qe,
4158
+ returnToLatest: Ge,
4159
+ loadThread: He,
4160
+ clearThread: Qe,
4161
+ respondToInterrupt: ot
4125
4162
  }),
4126
4163
  [
4127
4164
  m,
@@ -4132,15 +4169,15 @@ function Xx({
4132
4169
  J,
4133
4170
  S,
4134
4171
  F,
4135
- Ze,
4136
- Xe,
4137
- Ue,
4138
- Ke,
4172
+ tt,
4173
+ Qe,
4174
+ We,
4139
4175
  qe,
4140
- Be,
4141
- rt
4176
+ Ge,
4177
+ He,
4178
+ ot
4142
4179
  ]
4143
- ), Ct = at(
4180
+ ), Ct = lt(
4144
4181
  () => ({
4145
4182
  isStreaming: se,
4146
4183
  error: ne,
@@ -4148,11 +4185,11 @@ function Xx({
4148
4185
  submit: St,
4149
4186
  send: St,
4150
4187
  stop: te,
4151
- setAuthToken: Oe
4188
+ setAuthToken: Le
4152
4189
  }),
4153
- [se, ne, St, te, Oe]
4190
+ [se, ne, St, te, Le]
4154
4191
  );
4155
- return /* @__PURE__ */ u.jsx(Au.Provider, { value: mt, children: /* @__PURE__ */ u.jsx(ju.Provider, { value: lt, children: /* @__PURE__ */ u.jsx(_u.Provider, { value: Ct, children: e }) }) });
4192
+ return /* @__PURE__ */ u.jsx(Au.Provider, { value: mt, children: /* @__PURE__ */ u.jsx(ju.Provider, { value: ct, children: /* @__PURE__ */ u.jsx(_u.Provider, { value: Ct, children: e }) }) });
4156
4193
  }
4157
4194
  function xa() {
4158
4195
  const e = xs(Au);
@@ -4223,7 +4260,7 @@ const Zx = vs(
4223
4260
  size: "default"
4224
4261
  }
4225
4262
  }
4226
- ), ot = v.forwardRef(
4263
+ ), st = v.forwardRef(
4227
4264
  ({ className: e, variant: t, size: n, asChild: r = !1, ...o }, s) => {
4228
4265
  const i = r ? _m : "button";
4229
4266
  return /* @__PURE__ */ u.jsx(
@@ -4236,7 +4273,7 @@ const Zx = vs(
4236
4273
  );
4237
4274
  }
4238
4275
  );
4239
- ot.displayName = "Button";
4276
+ st.displayName = "Button";
4240
4277
  const Pu = v.forwardRef(
4241
4278
  ({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
4242
4279
  "textarea",
@@ -4337,7 +4374,7 @@ function Qx({
4337
4374
  }
4338
4375
  ) }),
4339
4376
  /* @__PURE__ */ u.jsx("div", { children: r ? /* @__PURE__ */ u.jsx(
4340
- ot,
4377
+ st,
4341
4378
  {
4342
4379
  type: "button",
4343
4380
  onClick: () => {
@@ -4351,7 +4388,7 @@ function Qx({
4351
4388
  children: /* @__PURE__ */ u.jsx(cm, { size: 16 })
4352
4389
  }
4353
4390
  ) : /* @__PURE__ */ u.jsx(
4354
- ot,
4391
+ st,
4355
4392
  {
4356
4393
  type: "submit",
4357
4394
  size: "icon",
@@ -4391,7 +4428,7 @@ function va(...e) {
4391
4428
  };
4392
4429
  };
4393
4430
  }
4394
- function Ve(...e) {
4431
+ function Ke(...e) {
4395
4432
  return v.useCallback(va(...e), e);
4396
4433
  }
4397
4434
  function ty(e, t) {
@@ -4547,14 +4584,14 @@ function wa(e) {
4547
4584
  i.displayName = t;
4548
4585
  const a = e + "CollectionSlot", l = Tr(a), c = z.forwardRef(
4549
4586
  (x, y) => {
4550
- const { scope: g, children: w } = x, b = s(a, g), T = Ve(y, b.collectionRef);
4587
+ const { scope: g, children: w } = x, b = s(a, g), T = Ke(y, b.collectionRef);
4551
4588
  return /* @__PURE__ */ u.jsx(l, { ref: T, children: w });
4552
4589
  }
4553
4590
  );
4554
4591
  c.displayName = a;
4555
4592
  const d = e + "CollectionItemSlot", f = "data-radix-collection-item", p = Tr(d), h = z.forwardRef(
4556
4593
  (x, y) => {
4557
- const { scope: g, children: w, ...b } = x, T = z.useRef(null), C = Ve(y, T), S = s(d, g);
4594
+ const { scope: g, children: w, ...b } = x, T = z.useRef(null), C = Ke(y, T), S = s(d, g);
4558
4595
  return z.useEffect(() => (S.itemMap.set(T, { ref: T, ...b }), () => void S.itemMap.delete(T))), /* @__PURE__ */ u.jsx(p, { [f]: "", ref: C, children: w });
4559
4596
  }
4560
4597
  );
@@ -4613,7 +4650,7 @@ var cy = "DismissableLayer", Bi = "dismissableLayer.update", uy = "dismissableLa
4613
4650
  onInteractOutside: i,
4614
4651
  onDismiss: a,
4615
4652
  ...l
4616
- } = e, c = v.useContext(Mu), [d, f] = v.useState(null), p = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, h] = v.useState({}), m = Ve(t, (k) => f(k)), x = Array.from(c.layers), [y] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), g = x.indexOf(y), w = d ? x.indexOf(d) : -1, b = c.layersWithOutsidePointerEventsDisabled.size > 0, T = w >= g, C = hy((k) => {
4653
+ } = e, c = v.useContext(Mu), [d, f] = v.useState(null), p = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, h] = v.useState({}), m = Ke(t, (k) => f(k)), x = Array.from(c.layers), [y] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), g = x.indexOf(y), w = d ? x.indexOf(d) : -1, b = c.layersWithOutsidePointerEventsDisabled.size > 0, T = w >= g, C = hy((k) => {
4617
4654
  const N = k.target, E = [...c.branches].some((I) => I.contains(N));
4618
4655
  !T || E || (o == null || o(k), i == null || i(k), k.defaultPrevented || a == null || a());
4619
4656
  }, p), S = my((k) => {
@@ -4653,7 +4690,7 @@ var cy = "DismissableLayer", Bi = "dismissableLayer.update", uy = "dismissableLa
4653
4690
  );
4654
4691
  Es.displayName = cy;
4655
4692
  var fy = "DismissableLayerBranch", py = v.forwardRef((e, t) => {
4656
- const n = v.useContext(Mu), r = v.useRef(null), o = Ve(t, r);
4693
+ const n = v.useContext(Mu), r = v.useRef(null), o = Ke(t, r);
4657
4694
  return v.useEffect(() => {
4658
4695
  const s = r.current;
4659
4696
  if (s)
@@ -4735,7 +4772,7 @@ var hi = "focusScope.autoFocusOnMount", mi = "focusScope.autoFocusOnUnmount", Kl
4735
4772
  onMountAutoFocus: o,
4736
4773
  onUnmountAutoFocus: s,
4737
4774
  ...i
4738
- } = e, [a, l] = v.useState(null), c = Dt(o), d = Dt(s), f = v.useRef(null), p = Ve(t, (x) => l(x)), h = v.useRef({
4775
+ } = e, [a, l] = v.useState(null), c = Dt(o), d = Dt(s), f = v.useRef(null), p = Ke(t, (x) => l(x)), h = v.useRef({
4739
4776
  paused: !1,
4740
4777
  pause() {
4741
4778
  this.paused = !0;
@@ -6221,7 +6258,7 @@ var Ia = "Popper", [Ju, Ps] = Mn(Ia), [Lv, Zu] = Ju(Ia), Qu = (e) => {
6221
6258
  Qu.displayName = Ia;
6222
6259
  var ed = "PopperAnchor", td = v.forwardRef(
6223
6260
  (e, t) => {
6224
- const { __scopePopper: n, virtualRef: r, ...o } = e, s = Zu(ed, n), i = v.useRef(null), a = Ve(t, i), l = v.useRef(null);
6261
+ const { __scopePopper: n, virtualRef: r, ...o } = e, s = Zu(ed, n), i = v.useRef(null), a = Ke(t, i), l = v.useRef(null);
6225
6262
  return v.useEffect(() => {
6226
6263
  const c = l.current;
6227
6264
  l.current = (r == null ? void 0 : r.current) || i.current, c !== l.current && s.onAnchorChange(l.current);
@@ -6231,7 +6268,7 @@ var ed = "PopperAnchor", td = v.forwardRef(
6231
6268
  td.displayName = ed;
6232
6269
  var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6233
6270
  (e, t) => {
6234
- var q, P, H, te, se, ne;
6271
+ var U, P, H, te, se, ne;
6235
6272
  const {
6236
6273
  __scopePopper: n,
6237
6274
  side: r = "bottom",
@@ -6247,7 +6284,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6247
6284
  updatePositionStrategy: h = "optimized",
6248
6285
  onPlaced: m,
6249
6286
  ...x
6250
- } = e, y = Zu(Na, n), [g, w] = v.useState(null), b = Ve(t, (Oe) => w(Oe)), [T, C] = v.useState(null), S = Xu(T), k = (S == null ? void 0 : S.width) ?? 0, N = (S == null ? void 0 : S.height) ?? 0, E = r + (s !== "center" ? "-" + s : ""), I = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, O = Array.isArray(c) ? c : [c], L = O.length > 0, F = {
6287
+ } = e, y = Zu(Na, n), [g, w] = v.useState(null), b = Ke(t, (Le) => w(Le)), [T, C] = v.useState(null), S = Xu(T), k = (S == null ? void 0 : S.width) ?? 0, N = (S == null ? void 0 : S.height) ?? 0, E = r + (s !== "center" ? "-" + s : ""), I = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, O = Array.isArray(c) ? c : [c], L = O.length > 0, F = {
6251
6288
  padding: I,
6252
6289
  boundary: O.filter(Bv),
6253
6290
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
@@ -6256,7 +6293,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6256
6293
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
6257
6294
  strategy: "fixed",
6258
6295
  placement: E,
6259
- whileElementsMounted: (...Oe) => gv(...Oe, {
6296
+ whileElementsMounted: (...Le) => gv(...Le, {
6260
6297
  animationFrame: h === "always"
6261
6298
  }),
6262
6299
  elements: {
@@ -6273,9 +6310,9 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6273
6310
  l && jv({ ...F }),
6274
6311
  _v({
6275
6312
  ...F,
6276
- apply: ({ elements: Oe, rects: Y, availableWidth: de, availableHeight: ke }) => {
6277
- const { width: Ne, height: ze } = Y.reference, Be = Oe.floating.style;
6278
- Be.setProperty("--radix-popper-available-width", `${de}px`), Be.setProperty("--radix-popper-available-height", `${ke}px`), Be.setProperty("--radix-popper-anchor-width", `${Ne}px`), Be.setProperty("--radix-popper-anchor-height", `${ze}px`);
6313
+ apply: ({ elements: Le, rects: Y, availableWidth: de, availableHeight: ke }) => {
6314
+ const { width: Ne, height: Be } = Y.reference, He = Le.floating.style;
6315
+ He.setProperty("--radix-popper-available-width", `${de}px`), He.setProperty("--radix-popper-available-height", `${ke}px`), He.setProperty("--radix-popper-anchor-width", `${Ne}px`), He.setProperty("--radix-popper-anchor-height", `${Be}px`);
6279
6316
  }
6280
6317
  }),
6281
6318
  T && Ov({ element: T, padding: a }),
@@ -6286,7 +6323,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6286
6323
  Lt(() => {
6287
6324
  B && (J == null || J());
6288
6325
  }, [B, J]);
6289
- const pe = (q = D.arrow) == null ? void 0 : q.x, Re = (P = D.arrow) == null ? void 0 : P.y, Ee = ((H = D.arrow) == null ? void 0 : H.centerOffset) !== 0, [W, ee] = v.useState();
6326
+ const pe = (U = D.arrow) == null ? void 0 : U.x, Re = (P = D.arrow) == null ? void 0 : P.y, Ee = ((H = D.arrow) == null ? void 0 : H.centerOffset) !== 0, [W, ee] = v.useState();
6290
6327
  return Lt(() => {
6291
6328
  g && ee(window.getComputedStyle(g).zIndex);
6292
6329
  }, [g]), /* @__PURE__ */ u.jsx(
@@ -6424,7 +6461,7 @@ function Wv(e, t) {
6424
6461
  return v.useReducer((n, r) => t[n][r] ?? n, e);
6425
6462
  }
6426
6463
  var cn = (e) => {
6427
- const { present: t, children: n } = e, r = Vv(t), o = typeof n == "function" ? n({ present: r.isPresent }) : v.Children.only(n), s = Ve(r.ref, Kv(o));
6464
+ const { present: t, children: n } = e, r = Vv(t), o = typeof n == "function" ? n({ present: r.isPresent }) : v.Children.only(n), s = Ke(r.ref, Kv(o));
6428
6465
  return typeof n == "function" || r.isPresent ? v.cloneElement(o, { ref: s }) : null;
6429
6466
  };
6430
6467
  cn.displayName = "Presence";
@@ -6504,7 +6541,7 @@ var Zv = v.forwardRef((e, t) => {
6504
6541
  onEntryFocus: c,
6505
6542
  preventScrollOnEntryFocus: d = !1,
6506
6543
  ...f
6507
- } = e, p = v.useRef(null), h = Ve(t, p), m = Rs(s), [x, y] = Rr({
6544
+ } = e, p = v.useRef(null), h = Ke(t, p), m = Rs(s), [x, y] = Rr({
6508
6545
  prop: i,
6509
6546
  defaultProp: a ?? null,
6510
6547
  onChange: l,
@@ -7232,7 +7269,7 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
7232
7269
  }
7233
7270
  ), tb = v.forwardRef(
7234
7271
  (e, t) => {
7235
- const n = fr(an, e.__scopeMenu), r = v.useRef(null), o = Ve(t, r);
7272
+ const n = fr(an, e.__scopeMenu), r = v.useRef(null), o = Ke(t, r);
7236
7273
  return v.useEffect(() => {
7237
7274
  const s = r.current;
7238
7275
  if (s) return Aa(s);
@@ -7283,9 +7320,9 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
7283
7320
  onDismiss: h,
7284
7321
  disableOutsideScroll: m,
7285
7322
  ...x
7286
- } = e, y = fr(an, n), g = yo(an, n), w = Ls(n), b = Rd(n), T = Gw(n), [C, S] = v.useState(null), k = v.useRef(null), N = Ve(t, k, y.onContentChange), E = v.useRef(0), I = v.useRef(""), O = v.useRef(0), L = v.useRef(null), F = v.useRef("right"), j = v.useRef(0), $ = m ? Ds : v.Fragment, A = m ? { as: rb, allowPinchZoom: !0 } : void 0, B = (M) => {
7287
- var q, P;
7288
- const Z = I.current + M, J = T().filter((H) => !H.disabled), pe = document.activeElement, Re = (q = J.find((H) => H.ref.current === pe)) == null ? void 0 : q.textValue, Ee = J.map((H) => H.textValue), W = mb(Ee, Z, Re), ee = (P = J.find((H) => H.textValue === W)) == null ? void 0 : P.ref.current;
7323
+ } = e, y = fr(an, n), g = yo(an, n), w = Ls(n), b = Rd(n), T = Gw(n), [C, S] = v.useState(null), k = v.useRef(null), N = Ke(t, k, y.onContentChange), E = v.useRef(0), I = v.useRef(""), O = v.useRef(0), L = v.useRef(null), F = v.useRef("right"), j = v.useRef(0), $ = m ? Ds : v.Fragment, A = m ? { as: rb, allowPinchZoom: !0 } : void 0, B = (M) => {
7324
+ var U, P;
7325
+ const Z = I.current + M, J = T().filter((H) => !H.disabled), pe = document.activeElement, Re = (U = J.find((H) => H.ref.current === pe)) == null ? void 0 : U.textValue, Ee = J.map((H) => H.textValue), W = mb(Ee, Z, Re), ee = (P = J.find((H) => H.textValue === W)) == null ? void 0 : P.ref.current;
7289
7326
  (function H(te) {
7290
7327
  I.current = te, window.clearTimeout(E.current), te !== "" && (E.current = window.setTimeout(() => H(""), 1e3));
7291
7328
  })(Z), ee && setTimeout(() => ee.focus());
@@ -7375,7 +7412,7 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
7375
7412
  const Ee = k.current;
7376
7413
  if (M.target !== Ee || !Vw.includes(M.key)) return;
7377
7414
  M.preventDefault();
7378
- const ee = T().filter((q) => !q.disabled).map((q) => q.ref.current);
7415
+ const ee = T().filter((U) => !U.disabled).map((U) => U.ref.current);
7379
7416
  Td.includes(M.key) && ee.reverse(), pb(ee);
7380
7417
  }),
7381
7418
  onBlur: fe(e.onBlur, (M) => {
@@ -7420,7 +7457,7 @@ var sb = "MenuLabel", jd = v.forwardRef(
7420
7457
  jd.displayName = sb;
7421
7458
  var ns = "MenuItem", fc = "menu.itemSelect", Fs = v.forwardRef(
7422
7459
  (e, t) => {
7423
- const { disabled: n = !1, onSelect: r, ...o } = e, s = v.useRef(null), i = yo(ns, e.__scopeMenu), a = Pa(ns, e.__scopeMenu), l = Ve(t, s), c = v.useRef(!1), d = () => {
7460
+ const { disabled: n = !1, onSelect: r, ...o } = e, s = v.useRef(null), i = yo(ns, e.__scopeMenu), a = Pa(ns, e.__scopeMenu), l = Ke(t, s), c = v.useRef(!1), d = () => {
7424
7461
  const f = s.current;
7425
7462
  if (!n && f) {
7426
7463
  const p = new CustomEvent(fc, { bubbles: !0, cancelable: !0 });
@@ -7453,7 +7490,7 @@ var ns = "MenuItem", fc = "menu.itemSelect", Fs = v.forwardRef(
7453
7490
  Fs.displayName = ns;
7454
7491
  var _d = v.forwardRef(
7455
7492
  (e, t) => {
7456
- const { __scopeMenu: n, disabled: r = !1, textValue: o, ...s } = e, i = Pa(ns, n), a = Rd(n), l = v.useRef(null), c = Ve(t, l), [d, f] = v.useState(!1), [p, h] = v.useState("");
7493
+ const { __scopeMenu: n, disabled: r = !1, textValue: o, ...s } = e, i = Pa(ns, n), a = Rd(n), l = v.useRef(null), c = Ke(t, l), [d, f] = v.useState(!1), [p, h] = v.useState("");
7457
7494
  return v.useEffect(() => {
7458
7495
  const m = l.current;
7459
7496
  m && h((m.textContent ?? "").trim());
@@ -7663,7 +7700,7 @@ var fb = "MenuSub", [mk, Hd] = dr(fb), Br = "MenuSubTrigger", Ud = v.forwardRef(
7663
7700
  Ud.displayName = Br;
7664
7701
  var Wd = "MenuSubContent", Vd = v.forwardRef(
7665
7702
  (e, t) => {
7666
- const n = Id(an, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = fr(an, e.__scopeMenu), i = yo(an, e.__scopeMenu), a = Hd(Wd, e.__scopeMenu), l = v.useRef(null), c = Ve(t, l);
7703
+ const n = Id(an, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = fr(an, e.__scopeMenu), i = yo(an, e.__scopeMenu), a = Hd(Wd, e.__scopeMenu), l = v.useRef(null), c = Ke(t, l);
7667
7704
  return /* @__PURE__ */ u.jsx(eo.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ u.jsx(cn, { present: r || s.open, children: /* @__PURE__ */ u.jsx(eo.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ u.jsx(
7668
7705
  Oa,
7669
7706
  {
@@ -8101,10 +8138,10 @@ function p0(e, t) {
8101
8138
  function yt(...e) {
8102
8139
  return e;
8103
8140
  }
8104
- function st(e, t) {
8141
+ function it(e, t) {
8105
8142
  return e(Kn, t);
8106
8143
  }
8107
- function Pe(e, t) {
8144
+ function Me(e, t) {
8108
8145
  e(zs, t);
8109
8146
  }
8110
8147
  function $a(e) {
@@ -8114,7 +8151,7 @@ function Rt(e) {
8114
8151
  return e(vf);
8115
8152
  }
8116
8153
  function he(e, t) {
8117
- return st(e, d0(t, zs));
8154
+ return it(e, d0(t, zs));
8118
8155
  }
8119
8156
  function pn(e, t) {
8120
8157
  const n = e(Kn, (r) => {
@@ -8152,7 +8189,7 @@ function wn(e) {
8152
8189
  t(e);
8153
8190
  };
8154
8191
  }
8155
- function U(e, ...t) {
8192
+ function V(e, ...t) {
8156
8193
  const n = h0(...t);
8157
8194
  return (r, o) => {
8158
8195
  switch (r) {
@@ -8160,7 +8197,7 @@ function U(e, ...t) {
8160
8197
  $a(e);
8161
8198
  return;
8162
8199
  case Kn:
8163
- return st(e, n(o));
8200
+ return it(e, n(o));
8164
8201
  }
8165
8202
  };
8166
8203
  }
@@ -8182,13 +8219,13 @@ function An(e) {
8182
8219
  }, e));
8183
8220
  };
8184
8221
  }
8185
- function De(...e) {
8222
+ function $e(...e) {
8186
8223
  const t = new Array(e.length);
8187
8224
  let n = 0, r = null;
8188
8225
  const o = Math.pow(2, e.length) - 1;
8189
8226
  return e.forEach((s, i) => {
8190
8227
  const a = Math.pow(2, i);
8191
- st(s, (l) => {
8228
+ it(s, (l) => {
8192
8229
  const c = n;
8193
8230
  n = n | a, t[i] = l, c !== o && n === o && r && (r(), r = null);
8194
8231
  });
@@ -8208,7 +8245,7 @@ function m0(e) {
8208
8245
  return function(o, s) {
8209
8246
  switch (o) {
8210
8247
  case Kn:
8211
- return s ? n === s ? void 0 : (r(), n = s, t = st(e, s), t) : (r(), Or);
8248
+ return s ? n === s ? void 0 : (r(), n = s, t = it(e, s), t) : (r(), Or);
8212
8249
  case Pr:
8213
8250
  r(), n = null;
8214
8251
  return;
@@ -8217,7 +8254,7 @@ function m0(e) {
8217
8254
  }
8218
8255
  function X(e) {
8219
8256
  let t = e;
8220
- const n = We();
8257
+ const n = Ve();
8221
8258
  return (r, o) => {
8222
8259
  switch (r) {
8223
8260
  case zs:
@@ -8236,7 +8273,7 @@ function X(e) {
8236
8273
  function Ht(e, t) {
8237
8274
  return Bs(X(t), (n) => he(e, n));
8238
8275
  }
8239
- function We() {
8276
+ function Ve() {
8240
8277
  const e = [];
8241
8278
  return (t, n) => {
8242
8279
  switch (t) {
@@ -8257,9 +8294,9 @@ function We() {
8257
8294
  };
8258
8295
  }
8259
8296
  function en(e) {
8260
- return Bs(We(), (t) => he(e, t));
8297
+ return Bs(Ve(), (t) => he(e, t));
8261
8298
  }
8262
- function tt(e, t = [], { singleton: n } = { singleton: !0 }) {
8299
+ function nt(e, t = [], { singleton: n } = { singleton: !0 }) {
8263
8300
  return {
8264
8301
  constructor: e,
8265
8302
  dependencies: t,
@@ -8278,13 +8315,13 @@ function x0(e) {
8278
8315
  return n(e);
8279
8316
  }
8280
8317
  function At(...e) {
8281
- const t = We(), n = new Array(e.length);
8318
+ const t = Ve(), n = new Array(e.length);
8282
8319
  let r = 0;
8283
8320
  const o = Math.pow(2, e.length) - 1;
8284
8321
  return e.forEach((s, i) => {
8285
8322
  const a = Math.pow(2, i);
8286
- st(s, (l) => {
8287
- n[i] = l, r = r | a, r === o && Pe(t, n);
8323
+ it(s, (l) => {
8324
+ n[i] = l, r = r | a, r === o && Me(t, n);
8288
8325
  });
8289
8326
  }), function(s, i) {
8290
8327
  switch (s) {
@@ -8293,12 +8330,12 @@ function At(...e) {
8293
8330
  return;
8294
8331
  }
8295
8332
  case Kn:
8296
- return r === o && i(n), st(t, i);
8333
+ return r === o && i(n), it(t, i);
8297
8334
  }
8298
8335
  };
8299
8336
  }
8300
8337
  function Se(e, t = bf) {
8301
- return U(e, xt(t));
8338
+ return V(e, xt(t));
8302
8339
  }
8303
8340
  function Yi(...e) {
8304
8341
  return function(t, n) {
@@ -8306,7 +8343,7 @@ function Yi(...e) {
8306
8343
  case Pr:
8307
8344
  return;
8308
8345
  case Kn:
8309
- return f0(...e.map((r) => st(r, n)));
8346
+ return f0(...e.map((r) => it(r, n)));
8310
8347
  }
8311
8348
  };
8312
8349
  }
@@ -8316,7 +8353,7 @@ const y0 = {
8316
8353
  3: "error",
8317
8354
  1: "log",
8318
8355
  2: "warn"
8319
- }, v0 = () => typeof globalThis > "u" ? window : globalThis, qn = tt(
8356
+ }, v0 = () => typeof globalThis > "u" ? window : globalThis, qn = nt(
8320
8357
  () => {
8321
8358
  const e = X(
8322
8359
  3
@@ -8444,17 +8481,17 @@ function Sf(e, t, n) {
8444
8481
  }
8445
8482
  }, [a, t, i]), s;
8446
8483
  }
8447
- const Wt = tt(
8484
+ const Wt = nt(
8448
8485
  () => {
8449
- const e = We(), t = We(), n = X(0), r = We(), o = X(0), s = We(), i = We(), a = X(0), l = X(0), c = X(0), d = X(0), f = We(), p = We(), h = X(!1), m = X(!1), x = X(!1);
8486
+ const e = Ve(), t = Ve(), n = X(0), r = Ve(), o = X(0), s = Ve(), i = Ve(), a = X(0), l = X(0), c = X(0), d = X(0), f = Ve(), p = Ve(), h = X(!1), m = X(!1), x = X(!1);
8450
8487
  return he(
8451
- U(
8488
+ V(
8452
8489
  e,
8453
8490
  le(({ scrollTop: y }) => y)
8454
8491
  ),
8455
8492
  t
8456
8493
  ), he(
8457
- U(
8494
+ V(
8458
8495
  e,
8459
8496
  le(({ scrollHeight: y }) => y)
8460
8497
  ),
@@ -8625,7 +8662,7 @@ function If(e, t) {
8625
8662
  function oo(e, t) {
8626
8663
  return !!(e && e[0] === t[0] && e[1] === t[1]);
8627
8664
  }
8628
- const Ba = tt(
8665
+ const Ba = nt(
8629
8666
  () => ({ recalcInProgress: X(!1) }),
8630
8667
  [],
8631
8668
  { singleton: !0 }
@@ -8792,13 +8829,13 @@ function _0(e) {
8792
8829
  const P0 = {
8793
8830
  offsetHeight: "height",
8794
8831
  offsetWidth: "width"
8795
- }, En = tt(
8832
+ }, En = nt(
8796
8833
  ([{ log: e }, { recalcInProgress: t }]) => {
8797
- const n = We(), r = We(), o = Ht(r, 0), s = We(), i = We(), a = X(0), l = X([]), c = X(void 0), d = X(void 0), f = X((C, S) => Un(C, P0[S])), p = X(void 0), h = X(0), m = T0(), x = Ht(
8798
- U(n, De(l, e, h), Cn(N0, m), xt()),
8834
+ const n = Ve(), r = Ve(), o = Ht(r, 0), s = Ve(), i = Ve(), a = X(0), l = X([]), c = X(void 0), d = X(void 0), f = X((C, S) => Un(C, P0[S])), p = X(void 0), h = X(0), m = T0(), x = Ht(
8835
+ V(n, $e(l, e, h), Cn(N0, m), xt()),
8799
8836
  m
8800
8837
  ), y = Ht(
8801
- U(
8838
+ V(
8802
8839
  l,
8803
8840
  xt(),
8804
8841
  Cn((C, S) => ({ current: S, prev: C.current }), {
@@ -8810,10 +8847,10 @@ const P0 = {
8810
8847
  []
8811
8848
  );
8812
8849
  he(
8813
- U(
8850
+ V(
8814
8851
  l,
8815
8852
  Te((C) => C.length > 0),
8816
- De(x, h),
8853
+ $e(x, h),
8817
8854
  le(([C, S, k]) => {
8818
8855
  const N = C.reduce((E, I, O) => Zt(E, I, so(I, S.offsetTree, k) || O), Sr());
8819
8856
  return {
@@ -8825,9 +8862,9 @@ const P0 = {
8825
8862
  ),
8826
8863
  x
8827
8864
  ), he(
8828
- U(
8865
+ V(
8829
8866
  r,
8830
- De(x),
8867
+ $e(x),
8831
8868
  Te(([C, { lastIndex: S }]) => C < S),
8832
8869
  le(([C, { lastIndex: S, lastSize: k }]) => [
8833
8870
  {
@@ -8840,14 +8877,14 @@ const P0 = {
8840
8877
  n
8841
8878
  ), he(c, d);
8842
8879
  const g = Ht(
8843
- U(
8880
+ V(
8844
8881
  c,
8845
8882
  le((C) => C === void 0)
8846
8883
  ),
8847
8884
  !0
8848
8885
  );
8849
8886
  he(
8850
- U(
8887
+ V(
8851
8888
  d,
8852
8889
  Te((C) => C !== void 0 && ft(Rt(x).sizeTree)),
8853
8890
  le((C) => [{ endIndex: 0, size: C, startIndex: 0 }])
@@ -8855,9 +8892,9 @@ const P0 = {
8855
8892
  n
8856
8893
  );
8857
8894
  const w = en(
8858
- U(
8895
+ V(
8859
8896
  n,
8860
- De(x),
8897
+ $e(x),
8861
8898
  Cn(
8862
8899
  ({ sizes: C }, [S, k]) => ({
8863
8900
  changed: k !== C,
@@ -8868,8 +8905,8 @@ const P0 = {
8868
8905
  le((C) => C.changed)
8869
8906
  )
8870
8907
  );
8871
- st(
8872
- U(
8908
+ it(
8909
+ V(
8873
8910
  a,
8874
8911
  Cn(
8875
8912
  (C, S) => ({ diff: C.prev - S, prev: S }),
@@ -8880,13 +8917,13 @@ const P0 = {
8880
8917
  (C) => {
8881
8918
  const { groupIndices: S } = Rt(x);
8882
8919
  if (C > 0)
8883
- Pe(t, !0), Pe(s, C + yc(C, S));
8920
+ Me(t, !0), Me(s, C + yc(C, S));
8884
8921
  else if (C < 0) {
8885
8922
  const k = Rt(y);
8886
- k.length > 0 && (C -= yc(-C, k)), Pe(i, C);
8923
+ k.length > 0 && (C -= yc(-C, k)), Me(i, C);
8887
8924
  }
8888
8925
  }
8889
- ), st(U(a, De(e)), ([C, S]) => {
8926
+ ), it(V(a, $e(e)), ([C, S]) => {
8890
8927
  C < 0 && S(
8891
8928
  "`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",
8892
8929
  { firstItemIndex: a },
@@ -8895,9 +8932,9 @@ const P0 = {
8895
8932
  });
8896
8933
  const b = en(s);
8897
8934
  he(
8898
- U(
8935
+ V(
8899
8936
  s,
8900
- De(x),
8937
+ $e(x),
8901
8938
  le(([C, S]) => {
8902
8939
  const k = S.groupIndices.length > 0, N = [], E = S.lastSize;
8903
8940
  if (k) {
@@ -8956,9 +8993,9 @@ const P0 = {
8956
8993
  n
8957
8994
  );
8958
8995
  const T = en(
8959
- U(
8996
+ V(
8960
8997
  i,
8961
- De(x, h),
8998
+ $e(x, h),
8962
8999
  le(([C, { offsetTree: S }, k]) => {
8963
9000
  const N = -C;
8964
9001
  return so(N, S, k);
@@ -8966,9 +9003,9 @@ const P0 = {
8966
9003
  )
8967
9004
  );
8968
9005
  return he(
8969
- U(
9006
+ V(
8970
9007
  i,
8971
- De(x, h),
9008
+ $e(x, h),
8972
9009
  le(([C, S, k]) => {
8973
9010
  if (S.groupIndices.length > 0) {
8974
9011
  if (ft(S.sizeTree))
@@ -9037,23 +9074,23 @@ function O0(e) {
9037
9074
  }
9038
9075
  );
9039
9076
  }
9040
- const _f = tt(
9077
+ const _f = nt(
9041
9078
  ([{ groupIndices: e, sizes: t, totalCount: n }, { headerHeight: r, scrollTop: o }]) => {
9042
- const s = We(), i = We(), a = en(U(s, le(O0)));
9079
+ const s = Ve(), i = Ve(), a = en(V(s, le(O0)));
9043
9080
  return he(
9044
- U(
9081
+ V(
9045
9082
  a,
9046
9083
  le((l) => l.totalCount)
9047
9084
  ),
9048
9085
  n
9049
9086
  ), he(
9050
- U(
9087
+ V(
9051
9088
  a,
9052
9089
  le((l) => l.groupIndices)
9053
9090
  ),
9054
9091
  e
9055
9092
  ), he(
9056
- U(
9093
+ V(
9057
9094
  At(o, t, r),
9058
9095
  Te(([l, c]) => Us(c)),
9059
9096
  le(([l, c, d]) => gn(c.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
@@ -9064,16 +9101,16 @@ const _f = tt(
9064
9101
  ), { groupCounts: s, topItemsIndexes: i };
9065
9102
  },
9066
9103
  yt(En, Wt)
9067
- ), Gn = tt(
9104
+ ), Gn = nt(
9068
9105
  ([{ log: e }]) => {
9069
9106
  const t = X(!1), n = en(
9070
- U(
9107
+ V(
9071
9108
  t,
9072
9109
  Te((r) => r),
9073
9110
  xt()
9074
9111
  )
9075
9112
  );
9076
- return st(t, (r) => {
9113
+ return it(t, (r) => {
9077
9114
  r && Rt(e)("props updated", {}, Xt.DEBUG);
9078
9115
  }), { didMount: n, propsReady: t };
9079
9116
  },
@@ -9084,7 +9121,7 @@ function Pf(e) {
9084
9121
  const t = typeof e == "number" ? { index: e } : e;
9085
9122
  return t.align || (t.align = "start"), (!t.behavior || !M0) && (t.behavior = "auto"), t.offset || (t.offset = 0), t;
9086
9123
  }
9087
- const vo = tt(
9124
+ const vo = nt(
9088
9125
  ([
9089
9126
  { gap: e, listRefresh: t, sizes: n, totalCount: r },
9090
9127
  {
@@ -9099,16 +9136,16 @@ const vo = tt(
9099
9136
  },
9100
9137
  { log: p }
9101
9138
  ]) => {
9102
- const h = We(), m = We(), x = X(0);
9139
+ const h = Ve(), m = Ve(), x = X(0);
9103
9140
  let y = null, g = null, w = null;
9104
9141
  function b() {
9105
- y && (y(), y = null), w && (w(), w = null), g && (clearTimeout(g), g = null), Pe(l, !1);
9142
+ y && (y(), y = null), w && (w(), w = null), g && (clearTimeout(g), g = null), Me(l, !1);
9106
9143
  }
9107
9144
  return he(
9108
- U(
9145
+ V(
9109
9146
  h,
9110
- De(n, f, r, x, a, i, p),
9111
- De(e, s, o),
9147
+ $e(n, f, r, x, a, i, p),
9148
+ $e(e, s, o),
9112
9149
  le(
9113
9150
  ([
9114
9151
  [T, C, S, k, N, E, I, O],
@@ -9120,20 +9157,20 @@ const vo = tt(
9120
9157
  let J = so(Z, C.offsetTree, L) + E;
9121
9158
  A === "end" ? (J += F + gn(C.sizeTree, Z)[1] - S + j, Z === M && (J += I)) : A === "center" ? J += (F + gn(C.sizeTree, Z)[1] - S + j) / 2 : J -= N, D && (J += D);
9122
9159
  const pe = (Re) => {
9123
- b(), Re ? (O("retrying to scroll to", { location: T }, Xt.DEBUG), Pe(h, T)) : (Pe(m, !0), O("list did not change, scroll successful", {}, Xt.DEBUG));
9160
+ b(), Re ? (O("retrying to scroll to", { location: T }, Xt.DEBUG), Me(h, T)) : (Me(m, !0), O("list did not change, scroll successful", {}, Xt.DEBUG));
9124
9161
  };
9125
9162
  if (b(), B === "smooth") {
9126
9163
  let Re = !1;
9127
- w = st(t, (Ee) => {
9164
+ w = it(t, (Ee) => {
9128
9165
  Re = Re || Ee;
9129
9166
  }), y = pn(d, () => {
9130
9167
  pe(Re);
9131
9168
  });
9132
9169
  } else
9133
- y = pn(U(t, D0(150)), pe);
9170
+ y = pn(V(t, D0(150)), pe);
9134
9171
  return g = setTimeout(() => {
9135
9172
  b();
9136
- }, 1200), Pe(l, !0), O("scrolling from index to", { behavior: B, index: Z, top: J }, Xt.DEBUG), { behavior: B, top: J };
9173
+ }, 1200), Me(l, !0), O("scrolling from index to", { behavior: B, index: Z, top: J }, Xt.DEBUG), { behavior: B, top: J };
9137
9174
  }
9138
9175
  )
9139
9176
  ),
@@ -9166,39 +9203,39 @@ function Wa(e, t) {
9166
9203
  const n = t - 1;
9167
9204
  return typeof e == "number" ? e : e.index === "LAST" ? n : e.index;
9168
9205
  }
9169
- const wo = tt(
9206
+ const wo = nt(
9170
9207
  ([{ defaultItemSize: e, listRefresh: t, sizes: n }, { scrollTop: r }, { scrollTargetReached: o, scrollToIndex: s }, { didMount: i }]) => {
9171
9208
  const a = X(!0), l = X(0), c = X(!0);
9172
9209
  return he(
9173
- U(
9210
+ V(
9174
9211
  i,
9175
- De(l),
9212
+ $e(l),
9176
9213
  Te(([d, f]) => !!f),
9177
9214
  wn(!1)
9178
9215
  ),
9179
9216
  a
9180
9217
  ), he(
9181
- U(
9218
+ V(
9182
9219
  i,
9183
- De(l),
9220
+ $e(l),
9184
9221
  Te(([d, f]) => !!f),
9185
9222
  wn(!1)
9186
9223
  ),
9187
9224
  c
9188
- ), st(
9189
- U(
9225
+ ), it(
9226
+ V(
9190
9227
  At(t, i),
9191
- De(a, n, e, c),
9228
+ $e(a, n, e, c),
9192
9229
  Te(([[, d], f, { sizeTree: p }, h, m]) => d && (!ft(p) || Fa(h)) && !f && !m),
9193
- De(l)
9230
+ $e(l)
9194
9231
  ),
9195
9232
  ([, d]) => {
9196
9233
  pn(o, () => {
9197
- Pe(c, !0);
9234
+ Me(c, !0);
9198
9235
  }), Ua(4, () => {
9199
9236
  pn(r, () => {
9200
- Pe(a, !0);
9201
- }), Pe(s, d);
9237
+ Me(a, !0);
9238
+ }), Me(s, d);
9202
9239
  });
9203
9240
  }
9204
9241
  ), {
@@ -9222,27 +9259,27 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9222
9259
  scrollTop: 0,
9223
9260
  viewportHeight: 0
9224
9261
  }
9225
- }, $0 = 0, bo = tt(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
9226
- const i = X(!1), a = X(!0), l = We(), c = We(), d = X(4), f = X($0), p = Ht(
9227
- U(
9228
- Yi(U(Se(o), ar(1), wn(!0)), U(Se(o), ar(1), wn(!1), mc(100))),
9262
+ }, $0 = 0, bo = nt(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
9263
+ const i = X(!1), a = X(!0), l = Ve(), c = Ve(), d = X(4), f = X($0), p = Ht(
9264
+ V(
9265
+ Yi(V(Se(o), ar(1), wn(!0)), V(Se(o), ar(1), wn(!1), mc(100))),
9229
9266
  xt()
9230
9267
  ),
9231
9268
  !1
9232
9269
  ), h = Ht(
9233
- U(Yi(U(n, wn(!0)), U(n, wn(!1), mc(200))), xt()),
9270
+ V(Yi(V(n, wn(!0)), V(n, wn(!1), mc(200))), xt()),
9234
9271
  !1
9235
9272
  );
9236
9273
  he(
9237
- U(
9274
+ V(
9238
9275
  At(Se(o), Se(f)),
9239
9276
  le(([w, b]) => w <= b),
9240
9277
  xt()
9241
9278
  ),
9242
9279
  a
9243
- ), he(U(a, An(50)), c);
9280
+ ), he(V(a, An(50)), c);
9244
9281
  const m = en(
9245
- U(
9282
+ V(
9246
9283
  At(r, Se(s), Se(t), Se(e), Se(d)),
9247
9284
  Cn((w, [{ scrollHeight: b, scrollTop: T }, C, S, k, N]) => {
9248
9285
  const E = T + C - b > -N, I = {
@@ -9269,7 +9306,7 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9269
9306
  xt((w, b) => w && w.atBottom === b.atBottom)
9270
9307
  )
9271
9308
  ), x = Ht(
9272
- U(
9309
+ V(
9273
9310
  r,
9274
9311
  Cn(
9275
9312
  (w, { scrollHeight: b, scrollTop: T, viewportHeight: C }) => {
@@ -9303,15 +9340,15 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9303
9340
  0
9304
9341
  );
9305
9342
  he(
9306
- U(
9343
+ V(
9307
9344
  m,
9308
9345
  le((w) => w.atBottom)
9309
9346
  ),
9310
9347
  i
9311
- ), he(U(i, An(50)), l);
9348
+ ), he(V(i, An(50)), l);
9312
9349
  const y = X(Vr);
9313
9350
  he(
9314
- U(
9351
+ V(
9315
9352
  r,
9316
9353
  le(({ scrollTop: w }) => w),
9317
9354
  xt(),
@@ -9322,20 +9359,20 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9322
9359
  le((w) => w.direction)
9323
9360
  ),
9324
9361
  y
9325
- ), he(U(r, An(50), wn(L0)), y);
9362
+ ), he(V(r, An(50), wn(L0)), y);
9326
9363
  const g = X(0);
9327
9364
  return he(
9328
- U(
9365
+ V(
9329
9366
  p,
9330
9367
  Te((w) => !w),
9331
9368
  wn(0)
9332
9369
  ),
9333
9370
  g
9334
9371
  ), he(
9335
- U(
9372
+ V(
9336
9373
  o,
9337
9374
  An(100),
9338
- De(p),
9375
+ $e(p),
9339
9376
  Te(([w, b]) => !!b),
9340
9377
  Cn(([w, b], [T]) => [b, T], [0, 0]),
9341
9378
  le(([w, b]) => b - w)
@@ -9362,10 +9399,10 @@ function bc(e, t) {
9362
9399
  var n;
9363
9400
  return typeof e == "number" ? e : (n = e[t]) != null ? n : 0;
9364
9401
  }
9365
- const Va = tt(
9402
+ const Va = nt(
9366
9403
  ([{ deviation: e, fixedHeaderHeight: t, headerHeight: n, scrollTop: r, viewportHeight: o }]) => {
9367
- const s = We(), i = X(0), a = X(0), l = X(0), c = Ht(
9368
- U(
9404
+ const s = Ve(), i = X(0), a = X(0), l = X(0), c = Ht(
9405
+ V(
9369
9406
  At(
9370
9407
  Se(r),
9371
9408
  Se(o),
@@ -9500,7 +9537,7 @@ function Sc(e, t, n) {
9500
9537
  }
9501
9538
  return s;
9502
9539
  }
9503
- const hr = tt(
9540
+ const hr = nt(
9504
9541
  ([
9505
9542
  { data: e, firstItemIndex: t, gap: n, sizes: r, totalCount: o },
9506
9543
  s,
@@ -9511,10 +9548,10 @@ const hr = tt(
9511
9548
  { didMount: h },
9512
9549
  { recalcInProgress: m }
9513
9550
  ]) => {
9514
- const x = X([]), y = X(0), g = We();
9551
+ const x = X([]), y = X(0), g = Ve();
9515
9552
  he(s.topItemsIndexes, x);
9516
9553
  const w = Ht(
9517
- U(
9554
+ V(
9518
9555
  At(
9519
9556
  h,
9520
9557
  m,
@@ -9563,11 +9600,11 @@ const hr = tt(
9563
9600
  const Z = [];
9564
9601
  if (L.length > 0) {
9565
9602
  const W = L[0], ee = L[L.length - 1];
9566
- let q = 0;
9603
+ let U = 0;
9567
9604
  for (const P of Hs(D, W, ee)) {
9568
9605
  const H = P.value, te = Math.max(P.start, W), se = Math.min(P.end, ee);
9569
9606
  for (let ne = te; ne <= se; ne++)
9570
- Z.push({ data: $ == null ? void 0 : $[ne], index: ne, offset: q, size: H }), q += H;
9607
+ Z.push({ data: $ == null ? void 0 : $[ne], index: ne, offset: U, size: H }), U += H;
9571
9608
  }
9572
9609
  }
9573
9610
  if (!O)
@@ -9577,11 +9614,11 @@ const hr = tt(
9577
9614
  return null;
9578
9615
  const Re = N - 1, Ee = Bs([], (W) => {
9579
9616
  for (const ee of pe) {
9580
- const q = ee.value;
9581
- let P = q.offset, H = ee.start;
9582
- const te = q.size;
9583
- if (q.offset < S) {
9584
- H += Math.floor((S - q.offset + j) / (te + j));
9617
+ const U = ee.value;
9618
+ let P = U.offset, H = ee.start;
9619
+ const te = U.size;
9620
+ if (U.offset < S) {
9621
+ H += Math.floor((S - U.offset + j) / (te + j));
9585
9622
  const ne = H - ee.start;
9586
9623
  P += ne * te + ne * j;
9587
9624
  }
@@ -9601,43 +9638,43 @@ const hr = tt(
9601
9638
  Ti
9602
9639
  );
9603
9640
  he(
9604
- U(
9641
+ V(
9605
9642
  e,
9606
9643
  Te(Fa),
9607
9644
  le((S) => S == null ? void 0 : S.length)
9608
9645
  ),
9609
9646
  o
9610
9647
  ), he(
9611
- U(
9648
+ V(
9612
9649
  w,
9613
9650
  le((S) => S.topListHeight)
9614
9651
  ),
9615
9652
  f
9616
9653
  ), he(f, a), he(
9617
- U(
9654
+ V(
9618
9655
  w,
9619
9656
  le((S) => [S.top, S.bottom])
9620
9657
  ),
9621
9658
  i
9622
9659
  ), he(
9623
- U(
9660
+ V(
9624
9661
  w,
9625
9662
  le((S) => S.items)
9626
9663
  ),
9627
9664
  g
9628
9665
  );
9629
9666
  const b = en(
9630
- U(
9667
+ V(
9631
9668
  w,
9632
9669
  Te(({ items: S }) => S.length > 0),
9633
- De(o, e),
9670
+ $e(o, e),
9634
9671
  Te(([{ items: S }, k]) => S[S.length - 1].originalIndex === k - 1),
9635
9672
  le(([, S, k]) => [S - 1, k]),
9636
9673
  xt(oo),
9637
9674
  le(([S]) => S)
9638
9675
  )
9639
9676
  ), T = en(
9640
- U(
9677
+ V(
9641
9678
  w,
9642
9679
  An(200),
9643
9680
  Te(({ items: S, topItems: k }) => S.length > 0 && S[0].originalIndex === k.length),
@@ -9645,7 +9682,7 @@ const hr = tt(
9645
9682
  xt()
9646
9683
  )
9647
9684
  ), C = en(
9648
- U(
9685
+ V(
9649
9686
  w,
9650
9687
  Te(({ items: S }) => S.length > 0),
9651
9688
  le(({ items: S }) => {
@@ -9675,10 +9712,10 @@ const hr = tt(
9675
9712
  Ba
9676
9713
  ),
9677
9714
  { singleton: !0 }
9678
- ), Df = tt(
9715
+ ), Df = nt(
9679
9716
  ([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: n, headerHeight: r }, { listState: o }]) => {
9680
- const s = We(), i = Ht(
9681
- U(
9717
+ const s = Ve(), i = Ht(
9718
+ V(
9682
9719
  At(n, e, r, t, o),
9683
9720
  le(([a, l, c, d, f]) => a + l + c + d + f.offsetBottom + f.bottom)
9684
9721
  ),
@@ -9688,10 +9725,10 @@ const hr = tt(
9688
9725
  },
9689
9726
  yt(Wt, hr),
9690
9727
  { singleton: !0 }
9691
- ), B0 = tt(
9728
+ ), B0 = nt(
9692
9729
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
9693
9730
  const n = X(!1), r = Ht(
9694
- U(
9731
+ V(
9695
9732
  At(n, e, t),
9696
9733
  Te(([o]) => o),
9697
9734
  le(([, o, s]) => Math.max(0, o - s)),
@@ -9704,7 +9741,7 @@ const hr = tt(
9704
9741
  },
9705
9742
  yt(Wt, Df),
9706
9743
  { singleton: !0 }
9707
- ), Lf = tt(() => ({
9744
+ ), Lf = nt(() => ({
9708
9745
  context: X(null)
9709
9746
  })), H0 = ({
9710
9747
  itemBottom: e,
@@ -9712,18 +9749,18 @@ const hr = tt(
9712
9749
  locationParams: { align: n, behavior: r, ...o },
9713
9750
  viewportBottom: s,
9714
9751
  viewportTop: i
9715
- }) => t < i ? { ...o, align: n ?? "start", behavior: r } : e > s ? { ...o, align: n ?? "end", behavior: r } : null, Ff = tt(
9752
+ }) => t < i ? { ...o, align: n ?? "start", behavior: r } : e > s ? { ...o, align: n ?? "end", behavior: r } : null, Ff = nt(
9716
9753
  ([
9717
9754
  { gap: e, sizes: t, totalCount: n },
9718
9755
  { fixedFooterHeight: r, fixedHeaderHeight: o, headerHeight: s, scrollingInProgress: i, scrollTop: a, viewportHeight: l },
9719
9756
  { scrollToIndex: c }
9720
9757
  ]) => {
9721
- const d = We();
9758
+ const d = Ve();
9722
9759
  return he(
9723
- U(
9760
+ V(
9724
9761
  d,
9725
- De(t, l, n, s, o, r, a),
9726
- De(e),
9762
+ $e(t, l, n, s, o, r, a),
9763
+ $e(e),
9727
9764
  le(([[f, p, h, m, x, y, g, w], b]) => {
9728
9765
  const { align: T, behavior: C, calculateViewLocation: S = H0, done: k, ...N } = f, E = jf(f, p, m - 1), I = so(E, p.offsetTree, b) + x + y, O = I + gn(p.sizeTree, E)[1], L = w + y, F = w + h - g, j = S({
9729
9766
  itemBottom: O,
@@ -9733,7 +9770,7 @@ const hr = tt(
9733
9770
  viewportTop: L
9734
9771
  });
9735
9772
  return j ? k && pn(
9736
- U(
9773
+ V(
9737
9774
  i,
9738
9775
  Te(($) => !$),
9739
9776
  // skips the initial publish of false, and the cleanup call.
@@ -9756,7 +9793,7 @@ const hr = tt(
9756
9793
  function Cc(e) {
9757
9794
  return e ? e === "smooth" ? "smooth" : "auto" : !1;
9758
9795
  }
9759
- const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9796
+ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = nt(
9760
9797
  ([
9761
9798
  { listRefresh: e, totalCount: t, fixedItemSize: n, data: r },
9762
9799
  { atBottomState: o, isAtBottom: s },
@@ -9768,19 +9805,19 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9768
9805
  { context: p },
9769
9806
  { scrollIntoView: h }
9770
9807
  ]) => {
9771
- const m = X(!1), x = We();
9808
+ const m = X(!1), x = Ve();
9772
9809
  let y = null;
9773
9810
  function g(C) {
9774
- Pe(i, {
9811
+ Me(i, {
9775
9812
  align: "end",
9776
9813
  behavior: C,
9777
9814
  index: "LAST"
9778
9815
  });
9779
9816
  }
9780
- st(
9781
- U(
9782
- At(U(Se(t), ar(1)), l),
9783
- De(Se(m), s, a, f),
9817
+ it(
9818
+ V(
9819
+ At(V(Se(t), ar(1)), l),
9820
+ $e(Se(m), s, a, f),
9784
9821
  le(([[C, S], k, N, E, I]) => {
9785
9822
  let O = S && E, L = "auto";
9786
9823
  return O && (L = U0(k, N || I), O = O && !!L), { followOutputBehavior: L, shouldFollow: O, totalCount: C };
@@ -9801,8 +9838,8 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9801
9838
  });
9802
9839
  setTimeout(S, 100);
9803
9840
  }
9804
- st(
9805
- U(
9841
+ it(
9842
+ V(
9806
9843
  At(Se(m), t, c),
9807
9844
  Te(([C, , S]) => C && S),
9808
9845
  Cn(
@@ -9810,42 +9847,42 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9810
9847
  { refreshed: !1, value: 0 }
9811
9848
  ),
9812
9849
  Te(({ refreshed: C }) => C),
9813
- De(m, t)
9850
+ $e(m, t)
9814
9851
  ),
9815
9852
  ([, C]) => {
9816
9853
  Rt(a) && w(C !== !1);
9817
9854
  }
9818
- ), st(x, () => {
9855
+ ), it(x, () => {
9819
9856
  w(Rt(m) !== !1);
9820
- }), st(At(Se(m), o), ([C, S]) => {
9857
+ }), it(At(Se(m), o), ([C, S]) => {
9821
9858
  C && !S.atBottom && S.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && g("auto");
9822
9859
  });
9823
- const b = X(null), T = We();
9860
+ const b = X(null), T = Ve();
9824
9861
  return he(
9825
9862
  Yi(
9826
- U(
9863
+ V(
9827
9864
  Se(r),
9828
9865
  le((C) => {
9829
9866
  var S;
9830
9867
  return (S = C == null ? void 0 : C.length) != null ? S : 0;
9831
9868
  })
9832
9869
  ),
9833
- U(Se(t))
9870
+ V(Se(t))
9834
9871
  ),
9835
9872
  T
9836
- ), st(
9837
- U(
9838
- At(U(T, ar(1)), l),
9839
- De(Se(b), a, f, p),
9873
+ ), it(
9874
+ V(
9875
+ At(V(T, ar(1)), l),
9876
+ $e(Se(b), a, f, p),
9840
9877
  le(([[C, S], k, N, E, I]) => S && N && (k == null ? void 0 : k({ context: I, totalCount: C, scrollingInProgress: E }))),
9841
9878
  Te((C) => !!C),
9842
9879
  An(0)
9843
9880
  ),
9844
9881
  (C) => {
9845
9882
  y && (y(), y = null), Rt(n) ? requestAnimationFrame(() => {
9846
- Rt(d)("scrolling into view", {}), Pe(h, C);
9883
+ Rt(d)("scrolling into view", {}), Me(h, C);
9847
9884
  }) : y = pn(e, () => {
9848
- Rt(d)("scrolling into view", {}), Pe(h, C), y = null;
9885
+ Rt(d)("scrolling into view", {}), Me(h, C), y = null;
9849
9886
  });
9850
9887
  }
9851
9888
  ), { autoscrollToBottom: x, followOutput: m, scrollIntoViewOnChange: b };
@@ -9861,39 +9898,39 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9861
9898
  Lf,
9862
9899
  Ff
9863
9900
  )
9864
- ), V0 = tt(
9901
+ ), V0 = nt(
9865
9902
  ([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (he(
9866
- U(
9903
+ V(
9867
9904
  a,
9868
- De(s),
9905
+ $e(s),
9869
9906
  Te(([, l]) => l !== 0),
9870
- De(o, r, t, n, e),
9907
+ $e(o, r, t, n, e),
9871
9908
  le(([[, l], c, d, f, p, h = []]) => Mf(l, c, d, f, p, h))
9872
9909
  ),
9873
9910
  i
9874
9911
  ), {}),
9875
9912
  yt(En, wo, hr, Gn),
9876
9913
  { singleton: !0 }
9877
- ), K0 = tt(
9914
+ ), K0 = nt(
9878
9915
  ([{ didMount: e }, { scrollTo: t }, { listState: n }]) => {
9879
9916
  const r = X(0);
9880
- return st(
9881
- U(
9917
+ return it(
9918
+ V(
9882
9919
  e,
9883
- De(r),
9920
+ $e(r),
9884
9921
  Te(([, o]) => o !== 0),
9885
9922
  le(([, o]) => ({ top: o }))
9886
9923
  ),
9887
9924
  (o) => {
9888
9925
  pn(
9889
- U(
9926
+ V(
9890
9927
  n,
9891
9928
  ar(1),
9892
9929
  Te((s) => s.items.length > 1)
9893
9930
  ),
9894
9931
  () => {
9895
9932
  requestAnimationFrame(() => {
9896
- Pe(t, o);
9933
+ Me(t, o);
9897
9934
  });
9898
9935
  }
9899
9936
  );
@@ -9904,13 +9941,13 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9904
9941
  },
9905
9942
  yt(Gn, Wt, hr),
9906
9943
  { singleton: !0 }
9907
- ), $f = tt(
9944
+ ), $f = nt(
9908
9945
  ([{ scrollVelocity: e }]) => {
9909
- const t = X(!1), n = We(), r = X(!1);
9946
+ const t = X(!1), n = Ve(), r = X(!1);
9910
9947
  return he(
9911
- U(
9948
+ V(
9912
9949
  e,
9913
- De(r, t, n),
9950
+ $e(r, t, n),
9914
9951
  Te(([o, s]) => !!s),
9915
9952
  le(([o, s, i, a]) => {
9916
9953
  const { enter: l, exit: c } = s;
@@ -9924,8 +9961,8 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9924
9961
  xt()
9925
9962
  ),
9926
9963
  t
9927
- ), st(
9928
- U(At(t, e, n), De(r)),
9964
+ ), it(
9965
+ V(At(t, e, n), $e(r)),
9929
9966
  ([[o, s, i], a]) => {
9930
9967
  o && a && a.change && a.change(s, i);
9931
9968
  }
@@ -9933,10 +9970,10 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9933
9970
  },
9934
9971
  yt(bo),
9935
9972
  { singleton: !0 }
9936
- ), Ka = tt(([{ scrollContainerState: e, scrollTo: t }]) => {
9937
- const n = We(), r = We(), o = We(), s = X(!1), i = X(void 0);
9973
+ ), Ka = nt(([{ scrollContainerState: e, scrollTo: t }]) => {
9974
+ const n = Ve(), r = Ve(), o = Ve(), s = X(!1), i = X(void 0);
9938
9975
  return he(
9939
- U(
9976
+ V(
9940
9977
  At(n, r),
9941
9978
  le(([{ scrollHeight: a, scrollTop: l, viewportHeight: c }, { offsetTop: d }]) => ({
9942
9979
  scrollHeight: a,
@@ -9946,9 +9983,9 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9946
9983
  ),
9947
9984
  e
9948
9985
  ), he(
9949
- U(
9986
+ V(
9950
9987
  t,
9951
- De(r),
9988
+ $e(r),
9952
9989
  le(([a, { offsetTop: l }]) => ({
9953
9990
  ...a,
9954
9991
  top: a.top + l
@@ -9965,7 +10002,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9965
10002
  windowScrollTo: o,
9966
10003
  windowViewportRect: r
9967
10004
  };
9968
- }, yt(Wt)), q0 = tt(
10005
+ }, yt(Wt)), q0 = nt(
9969
10006
  ([
9970
10007
  { sizeRanges: e, sizes: t },
9971
10008
  { headerHeight: n, scrollTop: r },
@@ -9973,20 +10010,20 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9973
10010
  { didMount: s },
9974
10011
  { useWindowScroll: i, windowScrollContainerState: a, windowViewportRect: l }
9975
10012
  ]) => {
9976
- const c = We(), d = X(void 0), f = X(null), p = X(null);
9977
- return he(a, f), he(l, p), st(
9978
- U(
10013
+ const c = Ve(), d = X(void 0), f = X(null), p = X(null);
10014
+ return he(a, f), he(l, p), it(
10015
+ V(
9979
10016
  c,
9980
- De(t, r, i, f, p, n)
10017
+ $e(t, r, i, f, p, n)
9981
10018
  ),
9982
10019
  ([h, m, x, y, g, w, b]) => {
9983
10020
  const T = A0(m.sizeTree);
9984
10021
  y && g !== null && w !== null && (x = g.scrollTop - w.offsetTop), x -= b, h({ ranges: T, scrollTop: x });
9985
10022
  }
9986
- ), he(U(d, Te(Fa), le(G0)), o), he(
9987
- U(
10023
+ ), he(V(d, Te(Fa), le(G0)), o), he(
10024
+ V(
9988
10025
  s,
9989
- De(d),
10026
+ $e(d),
9990
10027
  Te(([, h]) => h !== void 0),
9991
10028
  xt(),
9992
10029
  le(([, h]) => h.ranges)
@@ -10002,10 +10039,10 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
10002
10039
  function G0(e) {
10003
10040
  return { align: "start", index: 0, offset: e.scrollTop };
10004
10041
  }
10005
- const Y0 = tt(([{ topItemsIndexes: e }]) => {
10042
+ const Y0 = nt(([{ topItemsIndexes: e }]) => {
10006
10043
  const t = X(0);
10007
10044
  return he(
10008
- U(
10045
+ V(
10009
10046
  t,
10010
10047
  Te((n) => n >= 0),
10011
10048
  le((n) => Array.from({ length: n }).map((r, o) => o))
@@ -10017,7 +10054,7 @@ function zf(e) {
10017
10054
  let t = !1, n;
10018
10055
  return () => (t || (t = !0, n = e()), n);
10019
10056
  }
10020
- const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent)), J0 = tt(
10057
+ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent)), J0 = nt(
10021
10058
  ([
10022
10059
  { deviation: e, scrollBy: t, scrollingInProgress: n, scrollTop: r },
10023
10060
  { isAtBottom: o, isScrolling: s, lastJumpDueToItemResize: i, scrollDirection: a },
@@ -10027,9 +10064,9 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10027
10064
  { recalcInProgress: m }
10028
10065
  ]) => {
10029
10066
  const x = en(
10030
- U(
10067
+ V(
10031
10068
  l,
10032
- De(i),
10069
+ $e(i),
10033
10070
  Cn(
10034
10071
  ([, g, w, b], [{ bottom: T, items: C, offsetBottom: S, totalCount: k }, N]) => {
10035
10072
  const E = T + S;
@@ -10039,18 +10076,18 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10039
10076
  [0, [], 0, 0]
10040
10077
  ),
10041
10078
  Te(([g]) => g !== 0),
10042
- De(r, a, n, o, h, m),
10079
+ $e(r, a, n, o, h, m),
10043
10080
  Te(([, g, w, b, , , T]) => !T && !b && g !== 0 && w === io),
10044
10081
  le(([[g], , , , , w]) => (w("Upward scrolling compensation", { amount: g }, Xt.DEBUG), g))
10045
10082
  )
10046
10083
  );
10047
10084
  function y(g) {
10048
- g > 0 ? (Pe(t, { behavior: "auto", top: -g }), Pe(e, 0)) : (Pe(e, 0), Pe(t, { behavior: "auto", top: -g }));
10085
+ g > 0 ? (Me(t, { behavior: "auto", top: -g }), Me(e, 0)) : (Me(e, 0), Me(t, { behavior: "auto", top: -g }));
10049
10086
  }
10050
- return st(U(x, De(e, s)), ([g, w, b]) => {
10051
- b && X0() ? Pe(e, w - g) : y(-g);
10052
- }), st(
10053
- U(
10087
+ return it(V(x, $e(e, s)), ([g, w, b]) => {
10088
+ b && X0() ? Me(e, w - g) : y(-g);
10089
+ }), it(
10090
+ V(
10054
10091
  At(Ht(s, !1), e, m),
10055
10092
  Te(([g, w, b]) => !g && !b && w !== 0),
10056
10093
  le(([g, w]) => w),
@@ -10058,15 +10095,15 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10058
10095
  ),
10059
10096
  y
10060
10097
  ), he(
10061
- U(
10098
+ V(
10062
10099
  f,
10063
10100
  le((g) => ({ top: -g }))
10064
10101
  ),
10065
10102
  t
10066
- ), st(
10067
- U(
10103
+ ), it(
10104
+ V(
10068
10105
  c,
10069
- De(p, d),
10106
+ $e(p, d),
10070
10107
  le(([g, { groupIndices: w, lastSize: b, sizeTree: T }, C]) => {
10071
10108
  function S(k) {
10072
10109
  return k * (b + C);
@@ -10087,16 +10124,16 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10087
10124
  })
10088
10125
  ),
10089
10126
  (g) => {
10090
- Pe(e, g), requestAnimationFrame(() => {
10091
- Pe(t, { top: g }), requestAnimationFrame(() => {
10092
- Pe(e, 0), Pe(m, !1);
10127
+ Me(e, g), requestAnimationFrame(() => {
10128
+ Me(t, { top: g }), requestAnimationFrame(() => {
10129
+ Me(e, 0), Me(m, !1);
10093
10130
  });
10094
10131
  });
10095
10132
  }
10096
10133
  ), { deviation: e };
10097
10134
  },
10098
10135
  yt(Wt, bo, hr, En, qn, Ba)
10099
- ), Z0 = tt(
10136
+ ), Z0 = nt(
10100
10137
  ([
10101
10138
  e,
10102
10139
  t,
@@ -10135,7 +10172,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10135
10172
  qn,
10136
10173
  Lf
10137
10174
  )
10138
- ), Bf = tt(
10175
+ ), Bf = nt(
10139
10176
  ([
10140
10177
  {
10141
10178
  data: e,
@@ -10162,7 +10199,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10162
10199
  { groupCounts: N },
10163
10200
  E
10164
10201
  ]) => (he(T.rangeChanged, E.scrollSeekRangeChanged), he(
10165
- U(
10202
+ V(
10166
10203
  E.windowViewportRect,
10167
10204
  le((I) => I.visibleHeight)
10168
10205
  ),
@@ -10226,22 +10263,22 @@ const _o = typeof document < "u" ? z.useLayoutEffect : z.useEffect;
10226
10263
  function Hf(e, t, n) {
10227
10264
  const r = Object.keys(t.required || {}), o = Object.keys(t.optional || {}), s = Object.keys(t.methods || {}), i = Object.keys(t.events || {}), a = z.createContext({});
10228
10265
  function l(y, g) {
10229
- y.propsReady && Pe(y.propsReady, !1);
10266
+ y.propsReady && Me(y.propsReady, !1);
10230
10267
  for (const w of r) {
10231
10268
  const b = y[t.required[w]];
10232
- Pe(b, g[w]);
10269
+ Me(b, g[w]);
10233
10270
  }
10234
10271
  for (const w of o)
10235
10272
  if (w in g) {
10236
10273
  const b = y[t.optional[w]];
10237
- Pe(b, g[w]);
10274
+ Me(b, g[w]);
10238
10275
  }
10239
- y.propsReady && Pe(y.propsReady, !0);
10276
+ y.propsReady && Me(y.propsReady, !0);
10240
10277
  }
10241
10278
  function c(y) {
10242
10279
  return s.reduce((g, w) => (g[w] = (b) => {
10243
10280
  const T = y[t.methods[w]];
10244
- Pe(T, b);
10281
+ Me(T, b);
10245
10282
  }, g), {});
10246
10283
  }
10247
10284
  function d(y) {
@@ -10253,7 +10290,7 @@ function Hf(e, t, n) {
10253
10290
  })), [C] = z.useState(hc(d, T));
10254
10291
  _o(() => {
10255
10292
  for (const k of i)
10256
- k in b && st(C[k], b[k]);
10293
+ k in b && it(C[k], b[k]);
10257
10294
  return () => {
10258
10295
  Object.values(C).map($a);
10259
10296
  };
@@ -10266,13 +10303,13 @@ function Hf(e, t, n) {
10266
10303
  const g = z.useContext(a);
10267
10304
  return z.useCallback(
10268
10305
  (w) => {
10269
- Pe(g[y], w);
10306
+ Me(g[y], w);
10270
10307
  },
10271
10308
  [g, y]
10272
10309
  );
10273
10310
  }, h = (y) => {
10274
10311
  const g = z.useContext(a)[y], w = z.useCallback(
10275
- (b) => st(g, b),
10312
+ (b) => it(g, b),
10276
10313
  [g]
10277
10314
  );
10278
10315
  return z.useSyncExternalStore(
@@ -10283,7 +10320,7 @@ function Hf(e, t, n) {
10283
10320
  }, m = (y) => {
10284
10321
  const g = z.useContext(a)[y], [w, b] = z.useState(hc(Rt, g));
10285
10322
  return _o(
10286
- () => st(g, (T) => {
10323
+ () => it(g, (T) => {
10287
10324
  T !== w && b(pc(T));
10288
10325
  }),
10289
10326
  [g, w]
@@ -10293,7 +10330,7 @@ function Hf(e, t, n) {
10293
10330
  Component: f,
10294
10331
  useEmitter: (y, g) => {
10295
10332
  const w = z.useContext(a)[y];
10296
- _o(() => st(w, g), [g, w]);
10333
+ _o(() => it(w, g), [g, w]);
10297
10334
  },
10298
10335
  useEmitterValue: x,
10299
10336
  usePublisher: p
@@ -10366,9 +10403,9 @@ const Ri = "-webkit-sticky", Tc = "sticky", qa = zf(() => {
10366
10403
  function Ga(e) {
10367
10404
  return e;
10368
10405
  }
10369
- const tS = /* @__PURE__ */ tt(() => {
10406
+ const tS = /* @__PURE__ */ nt(() => {
10370
10407
  const e = X((a) => `Item ${a}`), t = X((a) => `Group ${a}`), n = X({}), r = X(Ga), o = X("div"), s = X(Or), i = (a, l = null) => Ht(
10371
- U(
10408
+ V(
10372
10409
  n,
10373
10410
  le((c) => c[a]),
10374
10411
  xt()
@@ -10392,7 +10429,7 @@ const tS = /* @__PURE__ */ tt(() => {
10392
10429
  ScrollSeekPlaceholder: i("ScrollSeekPlaceholder"),
10393
10430
  TopItemListComponent: i("TopItemList")
10394
10431
  };
10395
- }), nS = /* @__PURE__ */ tt(
10432
+ }), nS = /* @__PURE__ */ nt(
10396
10433
  ([e, t]) => ({ ...e, ...t }),
10397
10434
  yt(Bf, tS)
10398
10435
  ), rS = ({ height: e }) => /* @__PURE__ */ u.jsx("div", { style: { height: e } }), oS = { overflowAnchor: "none", position: qa(), zIndex: 1 }, qf = { overflowAnchor: "none" }, sS = { ...qf, display: "inline-block", height: "100%" }, kc = /* @__PURE__ */ z.memo(function({ showTopList: e = !1 }) {
@@ -10673,7 +10710,7 @@ const fS = ({ children: e }) => {
10673
10710
  }
10674
10711
  },
10675
10712
  mS
10676
- ), xS = /* @__PURE__ */ Gf({ useEmitter: Ya, useEmitterValue: Ie, usePublisher: on }), yS = /* @__PURE__ */ Yf({ useEmitter: Ya, useEmitterValue: Ie, usePublisher: on }), vS = gS, wS = /* @__PURE__ */ tt(() => {
10713
+ ), xS = /* @__PURE__ */ Gf({ useEmitter: Ya, useEmitterValue: Ie, usePublisher: on }), yS = /* @__PURE__ */ Yf({ useEmitter: Ya, useEmitterValue: Ie, usePublisher: on }), vS = gS, wS = /* @__PURE__ */ nt(() => {
10677
10714
  const e = X((c) => /* @__PURE__ */ u.jsxs("td", { children: [
10678
10715
  "Item $",
10679
10716
  c
@@ -10681,7 +10718,7 @@ const fS = ({ children: e }) => {
10681
10718
  "Group ",
10682
10719
  c
10683
10720
  ] })), r = X(null), o = X(null), s = X({}), i = X(Ga), a = X(Or), l = (c, d = null) => Ht(
10684
- U(
10721
+ V(
10685
10722
  s,
10686
10723
  le((f) => f[c]),
10687
10724
  xt()
@@ -10743,7 +10780,7 @@ function Po(e, t) {
10743
10780
  function CS(e, t) {
10744
10781
  return e && e.column === t.column && e.row === t.row;
10745
10782
  }
10746
- const TS = /* @__PURE__ */ tt(
10783
+ const TS = /* @__PURE__ */ nt(
10747
10784
  ([
10748
10785
  { increaseViewportBy: e, listBoundary: t, overscan: n, visibleRange: r },
10749
10786
  { footerHeight: o, headerHeight: s, scrollBy: i, scrollContainerState: a, scrollTo: l, scrollTop: c, smoothScrollTargetReached: d, viewportHeight: f },
@@ -10753,54 +10790,54 @@ const TS = /* @__PURE__ */ tt(
10753
10790
  { customScrollParent: y, useWindowScroll: g, windowScrollContainerState: w, windowScrollTo: b, windowViewportRect: T },
10754
10791
  C
10755
10792
  ]) => {
10756
- const S = X(0), k = X(0), N = X(Rc), E = X({ height: 0, width: 0 }), I = X({ height: 0, width: 0 }), O = We(), L = We(), F = X(0), j = X(null), $ = X({ column: 0, row: 0 }), A = We(), B = We(), D = X(!1), M = X(0), Z = X(!0), J = X(!1), pe = X(!1);
10757
- st(
10758
- U(
10793
+ const S = X(0), k = X(0), N = X(Rc), E = X({ height: 0, width: 0 }), I = X({ height: 0, width: 0 }), O = Ve(), L = Ve(), F = X(0), j = X(null), $ = X({ column: 0, row: 0 }), A = Ve(), B = Ve(), D = X(!1), M = X(0), Z = X(!0), J = X(!1), pe = X(!1);
10794
+ it(
10795
+ V(
10759
10796
  m,
10760
- De(M),
10797
+ $e(M),
10761
10798
  Te(([P, H]) => !!H)
10762
10799
  ),
10763
10800
  () => {
10764
- Pe(Z, !1);
10801
+ Me(Z, !1);
10765
10802
  }
10766
- ), st(
10767
- U(
10803
+ ), it(
10804
+ V(
10768
10805
  At(m, Z, I, E, M, J),
10769
10806
  Te(([P, H, te, se, , ne]) => P && !H && te.height !== 0 && se.height !== 0 && !ne)
10770
10807
  ),
10771
10808
  ([, , , , P]) => {
10772
- Pe(J, !0), Ua(1, () => {
10773
- Pe(O, P);
10774
- }), pn(U(c), () => {
10775
- Pe(t, [0, 0]), Pe(Z, !0);
10809
+ Me(J, !0), Ua(1, () => {
10810
+ Me(O, P);
10811
+ }), pn(V(c), () => {
10812
+ Me(t, [0, 0]), Me(Z, !0);
10776
10813
  });
10777
10814
  }
10778
10815
  ), he(
10779
- U(
10816
+ V(
10780
10817
  B,
10781
10818
  Te((P) => P != null && P.scrollTop > 0),
10782
10819
  wn(0)
10783
10820
  ),
10784
10821
  k
10785
- ), st(
10786
- U(
10822
+ ), it(
10823
+ V(
10787
10824
  m,
10788
- De(B),
10825
+ $e(B),
10789
10826
  Te(([, P]) => P != null)
10790
10827
  ),
10791
10828
  ([, P]) => {
10792
- P && (Pe(E, P.viewport), Pe(I, P.item), Pe($, P.gap), P.scrollTop > 0 && (Pe(D, !0), pn(U(c, ar(1)), (H) => {
10793
- Pe(D, !1);
10794
- }), Pe(l, { top: P.scrollTop })));
10829
+ P && (Me(E, P.viewport), Me(I, P.item), Me($, P.gap), P.scrollTop > 0 && (Me(D, !0), pn(V(c, ar(1)), (H) => {
10830
+ Me(D, !1);
10831
+ }), Me(l, { top: P.scrollTop })));
10795
10832
  }
10796
10833
  ), he(
10797
- U(
10834
+ V(
10798
10835
  E,
10799
10836
  le(({ height: P }) => P)
10800
10837
  ),
10801
10838
  f
10802
10839
  ), he(
10803
- U(
10840
+ V(
10804
10841
  At(
10805
10842
  Se(E, Po),
10806
10843
  Se(I, Po),
@@ -10816,7 +10853,7 @@ const TS = /* @__PURE__ */ tt(
10816
10853
  ),
10817
10854
  A
10818
10855
  ), he(
10819
- U(
10856
+ V(
10820
10857
  At(
10821
10858
  Se(S),
10822
10859
  r,
@@ -10836,43 +10873,43 @@ const TS = /* @__PURE__ */ tt(
10836
10873
  [H, te],
10837
10874
  se,
10838
10875
  ne,
10839
- Oe,
10876
+ Le,
10840
10877
  Y,
10841
10878
  de,
10842
10879
  ,
10843
10880
  ke,
10844
10881
  Ne
10845
10882
  ]) => {
10846
- const { column: ze, row: Be } = se, { height: Ue, width: Ke } = ne, { width: qe } = Oe;
10847
- if (de === 0 && (P === 0 || qe === 0))
10883
+ const { column: Be, row: He } = se, { height: We, width: qe } = ne, { width: Ge } = Le;
10884
+ if (de === 0 && (P === 0 || Ge === 0))
10848
10885
  return Rc;
10849
- if (Ke === 0) {
10850
- const re = Wa(Ne, P), Le = re + Math.max(de - 1, 0);
10851
- return SS(Nc(re, Le, Y));
10886
+ if (qe === 0) {
10887
+ const re = Wa(Ne, P), Ye = re + Math.max(de - 1, 0);
10888
+ return SS(Nc(re, Ye, Y));
10852
10889
  }
10853
- const Ze = Xf(qe, Ke, ze);
10854
- let Xe, rt;
10855
- ke ? H === 0 && te === 0 && de > 0 ? (Xe = 0, rt = de - 1) : (Xe = Ze * as((H + Be) / (Ue + Be)), rt = Ze * Ec((te + Be) / (Ue + Be)) - 1, rt = Ei(P - 1, Kr(rt, Ze - 1)), Xe = Ei(rt, Kr(0, Xe))) : (Xe = 0, rt = -1);
10856
- const St = Nc(Xe, rt, Y), { bottom: mt, top: lt } = Ac(Oe, se, ne, St), Ct = Ec(P / Ze), ce = Ct * Ue + (Ct - 1) * Be - mt;
10857
- return { bottom: mt, itemHeight: Ue, items: St, itemWidth: Ke, offsetBottom: ce, offsetTop: lt, top: lt };
10890
+ const tt = Xf(Ge, qe, Be);
10891
+ let Qe, ot;
10892
+ ke ? H === 0 && te === 0 && de > 0 ? (Qe = 0, ot = de - 1) : (Qe = tt * as((H + He) / (We + He)), ot = tt * Ec((te + He) / (We + He)) - 1, ot = Ei(P - 1, Kr(ot, tt - 1)), Qe = Ei(ot, Kr(0, Qe))) : (Qe = 0, ot = -1);
10893
+ const St = Nc(Qe, ot, Y), { bottom: mt, top: ct } = Ac(Le, se, ne, St), Ct = Ec(P / tt), ce = Ct * We + (Ct - 1) * He - mt;
10894
+ return { bottom: mt, itemHeight: We, items: St, itemWidth: qe, offsetBottom: ce, offsetTop: ct, top: ct };
10858
10895
  }
10859
10896
  )
10860
10897
  ),
10861
10898
  N
10862
10899
  ), he(
10863
- U(
10900
+ V(
10864
10901
  j,
10865
10902
  Te((P) => P !== null),
10866
10903
  le((P) => P.length)
10867
10904
  ),
10868
10905
  S
10869
10906
  ), he(
10870
- U(
10907
+ V(
10871
10908
  At(E, I, N, $),
10872
10909
  Te(([P, H, { items: te }]) => te.length > 0 && H.height !== 0 && P.height !== 0),
10873
10910
  le(([P, H, { items: te }, se]) => {
10874
- const { bottom: ne, top: Oe } = Ac(P, se, H, te);
10875
- return [Oe, ne];
10911
+ const { bottom: ne, top: Le } = Ac(P, se, H, te);
10912
+ return [Le, ne];
10876
10913
  }),
10877
10914
  xt(oo)
10878
10915
  ),
@@ -10880,18 +10917,18 @@ const TS = /* @__PURE__ */ tt(
10880
10917
  );
10881
10918
  const Re = X(!1);
10882
10919
  he(
10883
- U(
10920
+ V(
10884
10921
  c,
10885
- De(Re),
10922
+ $e(Re),
10886
10923
  le(([P, H]) => H || P !== 0)
10887
10924
  ),
10888
10925
  Re
10889
10926
  );
10890
10927
  const Ee = en(
10891
- U(
10928
+ V(
10892
10929
  At(N, S),
10893
10930
  Te(([{ items: P }]) => P.length > 0),
10894
- De(Re),
10931
+ $e(Re),
10895
10932
  Te(([[P, H], te]) => {
10896
10933
  const se = P.items[P.items.length - 1].index === H - 1;
10897
10934
  return (te || P.bottom > 0 && P.itemHeight > 0 && P.offsetBottom === 0 && P.items.length === H) && se;
@@ -10900,16 +10937,16 @@ const TS = /* @__PURE__ */ tt(
10900
10937
  xt()
10901
10938
  )
10902
10939
  ), W = en(
10903
- U(
10940
+ V(
10904
10941
  Se(N),
10905
10942
  Te(({ items: P }) => P.length > 0 && P[0].index === 0),
10906
10943
  wn(0),
10907
10944
  xt()
10908
10945
  )
10909
10946
  ), ee = en(
10910
- U(
10947
+ V(
10911
10948
  Se(N),
10912
- De(D),
10949
+ $e(D),
10913
10950
  Te(([{ items: P }, H]) => P.length > 0 && !H),
10914
10951
  le(([{ items: P }]) => ({
10915
10952
  endIndex: P[P.length - 1].index,
@@ -10920,28 +10957,28 @@ const TS = /* @__PURE__ */ tt(
10920
10957
  )
10921
10958
  );
10922
10959
  he(ee, h.scrollSeekRangeChanged), he(
10923
- U(
10960
+ V(
10924
10961
  O,
10925
- De(E, I, S, $),
10962
+ $e(E, I, S, $),
10926
10963
  le(([P, H, te, se, ne]) => {
10927
- const Oe = Pf(P), { align: Y, behavior: de, offset: ke } = Oe;
10928
- let Ne = Oe.index;
10964
+ const Le = Pf(P), { align: Y, behavior: de, offset: ke } = Le;
10965
+ let Ne = Le.index;
10929
10966
  Ne === "LAST" && (Ne = se - 1), Ne = Kr(0, Ne, Ei(se - 1, Ne));
10930
- let ze = ea(H, ne, te, Ne);
10931
- return Y === "end" ? ze = Ic(ze - H.height + te.height) : Y === "center" && (ze = Ic(ze - H.height / 2 + te.height / 2)), ke && (ze += ke), { behavior: de, top: ze };
10967
+ let Be = ea(H, ne, te, Ne);
10968
+ return Y === "end" ? Be = Ic(Be - H.height + te.height) : Y === "center" && (Be = Ic(Be - H.height / 2 + te.height / 2)), ke && (Be += ke), { behavior: de, top: Be };
10932
10969
  })
10933
10970
  ),
10934
10971
  l
10935
10972
  );
10936
- const q = Ht(
10937
- U(
10973
+ const U = Ht(
10974
+ V(
10938
10975
  N,
10939
10976
  le((P) => P.offsetBottom + P.bottom)
10940
10977
  ),
10941
10978
  0
10942
10979
  );
10943
10980
  return he(
10944
- U(
10981
+ V(
10945
10982
  T,
10946
10983
  le((P) => ({ height: P.visibleHeight, width: P.visibleWidth }))
10947
10984
  ),
@@ -10977,7 +11014,7 @@ const TS = /* @__PURE__ */ tt(
10977
11014
  gridState: N,
10978
11015
  horizontalDirection: pe,
10979
11016
  initialTopMostItemIndex: M,
10980
- totalListHeight: q,
11017
+ totalListHeight: U,
10981
11018
  ...p,
10982
11019
  endReached: Ee,
10983
11020
  propsReady: x,
@@ -11004,9 +11041,9 @@ function ea(e, t, n, r) {
11004
11041
  const o = Xf(e.width, n.width, t.column), s = as(r / o), i = s * n.height + Kr(0, s - 1) * t.row;
11005
11042
  return i > 0 ? i + t.row : i;
11006
11043
  }
11007
- const kS = /* @__PURE__ */ tt(() => {
11044
+ const kS = /* @__PURE__ */ nt(() => {
11008
11045
  const e = X((f) => `Item ${f}`), t = X({}), n = X(null), r = X("virtuoso-grid-item"), o = X("virtuoso-grid-list"), s = X(Ga), i = X("div"), a = X(Or), l = (f, p = null) => Ht(
11009
- U(
11046
+ V(
11010
11047
  t,
11011
11048
  le((h) => h[f]),
11012
11049
  xt()
@@ -11031,7 +11068,7 @@ const kS = /* @__PURE__ */ tt(() => {
11031
11068
  scrollerRef: a,
11032
11069
  ScrollSeekPlaceholder: l("ScrollSeekPlaceholder", "div")
11033
11070
  };
11034
- }), RS = /* @__PURE__ */ tt(
11071
+ }), RS = /* @__PURE__ */ nt(
11035
11072
  ([e, t]) => ({ ...e, ...t }),
11036
11073
  yt(TS, kS)
11037
11074
  ), ES = /* @__PURE__ */ z.memo(function() {
@@ -11502,7 +11539,7 @@ var Vs = "Dialog", [rp, xk] = Mn(Vs), [VS, yn] = rp(Vs), op = (e) => {
11502
11539
  op.displayName = Vs;
11503
11540
  var sp = "DialogTrigger", ip = v.forwardRef(
11504
11541
  (e, t) => {
11505
- const { __scopeDialog: n, ...r } = e, o = yn(sp, n), s = Ve(t, o.triggerRef);
11542
+ const { __scopeDialog: n, ...r } = e, o = yn(sp, n), s = Ke(t, o.triggerRef);
11506
11543
  return /* @__PURE__ */ u.jsx(
11507
11544
  Ae.button,
11508
11545
  {
@@ -11559,7 +11596,7 @@ var qS = Tr("DialogOverlay.RemoveScroll"), GS = v.forwardRef(
11559
11596
  up.displayName = lr;
11560
11597
  var YS = v.forwardRef(
11561
11598
  (e, t) => {
11562
- const n = yn(lr, e.__scopeDialog), r = v.useRef(null), o = Ve(t, n.contentRef, r);
11599
+ const n = yn(lr, e.__scopeDialog), r = v.useRef(null), o = Ke(t, n.contentRef, r);
11563
11600
  return v.useEffect(() => {
11564
11601
  const s = r.current;
11565
11602
  if (s) return Aa(s);
@@ -11610,7 +11647,7 @@ var YS = v.forwardRef(
11610
11647
  }
11611
11648
  ), dp = v.forwardRef(
11612
11649
  (e, t) => {
11613
- const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: s, ...i } = e, a = yn(lr, n), l = v.useRef(null), c = Ve(t, l);
11650
+ const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: s, ...i } = e, a = yn(lr, n), l = v.useRef(null), c = Ke(t, l);
11614
11651
  return ba(), /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
11615
11652
  /* @__PURE__ */ u.jsx(
11616
11653
  Is,
@@ -11819,7 +11856,7 @@ function oC({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
11819
11856
  ] }) : c ? /* @__PURE__ */ u.jsxs("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [
11820
11857
  /* @__PURE__ */ u.jsx("div", { className: "text-red-500 mb-4", children: "⚠️" }),
11821
11858
  /* @__PURE__ */ u.jsx("p", { className: "text-red-600 mb-4", children: c }),
11822
- /* @__PURE__ */ u.jsx(ot, { onClick: p, variant: "outline", children: "Try Again" })
11859
+ /* @__PURE__ */ u.jsx(st, { onClick: p, variant: "outline", children: "Try Again" })
11823
11860
  ] }) : a ? o.startsWith("image/") ? /* @__PURE__ */ u.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ u.jsx(
11824
11861
  "img",
11825
11862
  {
@@ -11859,7 +11896,7 @@ function oC({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
11859
11896
  ] }),
11860
11897
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
11861
11898
  /* @__PURE__ */ u.jsxs(
11862
- ot,
11899
+ st,
11863
11900
  {
11864
11901
  variant: "outline",
11865
11902
  size: "sm",
@@ -11872,7 +11909,7 @@ function oC({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
11872
11909
  }
11873
11910
  ),
11874
11911
  /* @__PURE__ */ u.jsxs(
11875
- ot,
11912
+ st,
11876
11913
  {
11877
11914
  variant: "outline",
11878
11915
  size: "sm",
@@ -13444,7 +13481,7 @@ function fs({
13444
13481
  allowHtml: n = !1,
13445
13482
  style: r
13446
13483
  }) {
13447
- const o = at(() => {
13484
+ const o = lt(() => {
13448
13485
  try {
13449
13486
  if (!n) {
13450
13487
  const i = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
@@ -13454,7 +13491,7 @@ function fs({
13454
13491
  } catch (i) {
13455
13492
  return console.error("[MarkdownContent] parse error", i), `<pre class="font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words">Error rendering markdown: ${String(i)}</pre>`;
13456
13493
  }
13457
- }, [e, n]), s = at(() => {
13494
+ }, [e, n]), s = lt(() => {
13458
13495
  const i = {
13459
13496
  color: "currentColor",
13460
13497
  ...r
@@ -13599,11 +13636,11 @@ const Bc = z.memo(function({
13599
13636
  defaultCheckpointId: N = null,
13600
13637
  messageParentCheckpointId: E = null
13601
13638
  }) {
13602
- const [I, O] = ge(!1), [L, F] = ge("preview"), [j, $] = ge(!1), { currentThreadId: A } = xa(), { respondToInterrupt: B } = ya(), D = l === "phone" || l === "half-screen", M = t.role, Z = M === "tool", J = at(() => "type" in t && t.type === "default_message" ? t : null, [t]), pe = !!J, Re = !(r && M !== "user"), {
13639
+ const [I, O] = ge(!1), [L, F] = ge("preview"), [j, $] = ge(!1), { currentThreadId: A } = xa(), { respondToInterrupt: B } = ya(), D = l === "phone" || l === "half-screen", M = t.role, Z = M === "tool", J = lt(() => "type" in t && t.type === "default_message" ? t : null, [t]), pe = !!J, Re = !(r && M !== "user"), {
13603
13640
  uploadingFiles: Ee,
13604
13641
  handleFileClick: W,
13605
13642
  fileViewerOpen: ee,
13606
- currentFileInfo: q,
13643
+ currentFileInfo: U,
13607
13644
  closeFileViewer: P
13608
13645
  } = IC({ allowFileOpen: Re, currentThreadId: A }), H = z.useMemo(() => {
13609
13646
  switch (M) {
@@ -13618,17 +13655,17 @@ const Bc = z.memo(function({
13618
13655
  default:
13619
13656
  return "text-[hsl(var(--chat-bubble-ai-text))]";
13620
13657
  }
13621
- }, [M]), te = at(() => J ? "" : CC(t.content), [J, t]), se = at(() => J ? {} : Pp(t), [J, t]), ne = at(
13622
- () => J ? [] : t.content.filter((V) => V.type === "image_url"),
13658
+ }, [M]), te = lt(() => J ? "" : CC(t.content), [J, t]), se = lt(() => J ? {} : Pp(t), [J, t]), ne = lt(
13659
+ () => J ? [] : t.content.filter((K) => K.type === "image_url"),
13623
13660
  [J, t]
13624
- ), Oe = at(
13625
- () => J ? [] : t.content.filter((V) => V.type === "file"),
13661
+ ), Le = lt(
13662
+ () => J ? [] : t.content.filter((K) => K.type === "file"),
13626
13663
  [J, t]
13627
- ), Y = at(
13628
- () => J ? [] : t.content.filter((V) => V.type === "interrupt"),
13664
+ ), Y = lt(
13665
+ () => J ? [] : t.content.filter((K) => K.type === "interrupt"),
13629
13666
  [J, t]
13630
- ), de = (g == null ? void 0 : g.id) ?? (g == null ? void 0 : g.interrupt_id), ke = Mo(de), Ne = g == null ? void 0 : g.value, ze = at(() => J ? "" : TC(t.content), [J, t]), Be = z.useCallback(async () => {
13631
- const V = Z ? ze : te;
13667
+ ), de = (g == null ? void 0 : g.id) ?? (g == null ? void 0 : g.interrupt_id), ke = Mo(de), Ne = g == null ? void 0 : g.value, Be = lt(() => J ? "" : TC(t.content), [J, t]), He = z.useCallback(async () => {
13668
+ const K = Z ? Be : te;
13632
13669
  async function ve(xe) {
13633
13670
  if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
13634
13671
  await navigator.clipboard.writeText(xe);
@@ -13646,20 +13683,20 @@ const Bc = z.memo(function({
13646
13683
  throw new Error("Clipboard API not supported in this context.");
13647
13684
  }
13648
13685
  try {
13649
- await ve(V), O(!0), setTimeout(() => O(!1), 2e3), y == null || y(V);
13686
+ await ve(K), O(!0), setTimeout(() => O(!1), 2e3), y == null || y(K);
13650
13687
  } catch (xe) {
13651
13688
  console.error("Failed to copy:", xe);
13652
13689
  }
13653
- }, [Z, ze, te, y]), Ue = z.useCallback(() => {
13690
+ }, [Z, Be, te, y]), We = z.useCallback(() => {
13654
13691
  if (!h) return;
13655
- const V = Z ? ze : te, ve = "type" in t && t.type === "default_message" ? void 0 : {
13692
+ const K = Z ? Be : te, ve = "type" in t && t.type === "default_message" ? void 0 : {
13656
13693
  checkpointId: t.checkpointId ?? null,
13657
13694
  checkpointNs: t.checkpointNs ?? null
13658
13695
  };
13659
- h(t.id, V, ve);
13660
- }, [h, t.id, Z, ze, te, t]), Ke = z.useCallback(() => {
13696
+ h(t.id, K, ve);
13697
+ }, [h, t.id, Z, Be, te, t]), qe = z.useCallback(() => {
13661
13698
  m == null || m(n);
13662
- }, [m, n]), qe = z.useCallback(() => {
13699
+ }, [m, n]), Ge = z.useCallback(() => {
13663
13700
  const ve = Q(D ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", H);
13664
13701
  switch (M) {
13665
13702
  case "user":
@@ -13671,26 +13708,26 @@ const Bc = z.memo(function({
13671
13708
  default:
13672
13709
  return /* @__PURE__ */ u.jsx(si, { className: ve });
13673
13710
  }
13674
- }, [D, H, M]), Ze = z.useCallback(() => {
13675
- const V = "group relative mb-4 flex w-full";
13711
+ }, [D, H, M]), tt = z.useCallback(() => {
13712
+ const K = "group relative mb-4 flex w-full";
13676
13713
  switch (M) {
13677
13714
  case "user":
13678
- return Q(V, "justify-end");
13715
+ return Q(K, "justify-end");
13679
13716
  case "assistant":
13680
13717
  case "tool":
13681
13718
  case "system":
13682
- return Q(V, "justify-start");
13719
+ return Q(K, "justify-start");
13683
13720
  default:
13684
- return V;
13721
+ return K;
13685
13722
  }
13686
- }, [M]), Xe = z.useCallback(() => {
13687
- const V = Q(
13723
+ }, [M]), Qe = z.useCallback(() => {
13724
+ const K = Q(
13688
13725
  "rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
13689
13726
  D && "px-3 py-2 text-sm"
13690
13727
  );
13691
13728
  if (pe)
13692
13729
  return Q(
13693
- V,
13730
+ K,
13694
13731
  "w-full",
13695
13732
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
13696
13733
  "border border-border/60 dark:border-border/40 shadow-sm"
@@ -13698,25 +13735,25 @@ const Bc = z.memo(function({
13698
13735
  switch (M) {
13699
13736
  case "user":
13700
13737
  return Q(
13701
- V,
13738
+ K,
13702
13739
  "w-full md:max-w-[95%]",
13703
13740
  "bg-[hsl(var(--chat-bubble-user))] text-[hsl(var(--chat-bubble-user-text))]",
13704
13741
  "border border-transparent"
13705
13742
  );
13706
13743
  case "assistant":
13707
13744
  return Q(
13708
- V,
13745
+ K,
13709
13746
  "w-full md:max-w-[95%]",
13710
13747
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
13711
13748
  "border border-border/60 dark:border-border/40"
13712
13749
  );
13713
13750
  case "tool":
13714
- return Q(V, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
13751
+ return Q(K, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
13715
13752
  case "system":
13716
- return Q(V, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
13753
+ return Q(K, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
13717
13754
  default:
13718
13755
  return Q(
13719
- V,
13756
+ K,
13720
13757
  "w-full md:max-w-[95%]",
13721
13758
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
13722
13759
  "border border-border/60 dark:border-border/40"
@@ -13724,7 +13761,7 @@ const Bc = z.memo(function({
13724
13761
  }
13725
13762
  }, [D, pe, M]);
13726
13763
  if (pe && J)
13727
- return /* @__PURE__ */ u.jsx("div", { className: Q(Ze(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: Q(Xe(), p.content), children: [
13764
+ return /* @__PURE__ */ u.jsx("div", { className: Q(tt(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: Q(Qe(), p.content), children: [
13728
13765
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 mb-2 pb-2 border-b border-current/10", children: [
13729
13766
  /* @__PURE__ */ u.jsx(si, { className: Q("h-4 w-4", H) }),
13730
13767
  a && /* @__PURE__ */ u.jsx("span", { className: "font-medium text-sm", children: "Assistant" })
@@ -13737,14 +13774,14 @@ const Bc = z.memo(function({
13737
13774
  }
13738
13775
  )
13739
13776
  ] }) });
13740
- const rt = z.useCallback(async (V) => {
13777
+ const ot = z.useCallback(async (K) => {
13741
13778
  if (w)
13742
13779
  return;
13743
13780
  const ve = Mo(
13744
- (V == null ? void 0 : V.id) ?? (V == null ? void 0 : V.interrupt_id)
13781
+ (K == null ? void 0 : K.id) ?? (K == null ? void 0 : K.interrupt_id)
13745
13782
  );
13746
13783
  if (!ve) {
13747
- console.warn("Interrupt part missing id", V);
13784
+ console.warn("Interrupt part missing id", K);
13748
13785
  return;
13749
13786
  }
13750
13787
  try {
@@ -13754,14 +13791,14 @@ const Bc = z.memo(function({
13754
13791
  } finally {
13755
13792
  T == null || T();
13756
13793
  }
13757
- }, [w, T, b, B]), St = z.useCallback(async (V) => {
13794
+ }, [w, T, b, B]), St = z.useCallback(async (K) => {
13758
13795
  if (w)
13759
13796
  return;
13760
13797
  const ve = Mo(
13761
- (V == null ? void 0 : V.id) ?? (V == null ? void 0 : V.interrupt_id)
13798
+ (K == null ? void 0 : K.id) ?? (K == null ? void 0 : K.interrupt_id)
13762
13799
  );
13763
13800
  if (!ve) {
13764
- console.warn("Interrupt part missing id", V);
13801
+ console.warn("Interrupt part missing id", K);
13765
13802
  return;
13766
13803
  }
13767
13804
  try {
@@ -13771,9 +13808,9 @@ const Bc = z.memo(function({
13771
13808
  } finally {
13772
13809
  T == null || T();
13773
13810
  }
13774
- }, [w, T, b, B]), mt = z.useCallback(({ part: V, i: ve }) => {
13775
- if (V.type === "text") {
13776
- const xe = V.text ?? "", ht = xe.trim(), gt = Ja(ht);
13811
+ }, [w, T, b, B]), mt = z.useCallback(({ part: K, i: ve }) => {
13812
+ if (K.type === "text") {
13813
+ const xe = K.text ?? "", ht = xe.trim(), gt = Ja(ht);
13777
13814
  return gt && M !== "tool" ? /* @__PURE__ */ u.jsx(Op, { data: gt }, ve) : M === "user" && c && ht.length > d ? /* @__PURE__ */ u.jsx(
13778
13815
  NC,
13779
13816
  {
@@ -13786,8 +13823,8 @@ const Bc = z.memo(function({
13786
13823
  ve
13787
13824
  ) : /* @__PURE__ */ u.jsx(fs, { content: xe, allowHtml: !1 }, ve);
13788
13825
  }
13789
- if (V.type === "image_url") {
13790
- const xe = V;
13826
+ if (K.type === "image_url") {
13827
+ const xe = K;
13791
13828
  return /* @__PURE__ */ u.jsx("div", { className: "my-2", children: /* @__PURE__ */ u.jsx(
13792
13829
  "img",
13793
13830
  {
@@ -13798,8 +13835,8 @@ const Bc = z.memo(function({
13798
13835
  }
13799
13836
  ) }, ve);
13800
13837
  }
13801
- if (V.type === "file") {
13802
- const xe = V, ht = xe.name || "file";
13838
+ if (K.type === "file") {
13839
+ const xe = K, ht = xe.name || "file";
13803
13840
  return /* @__PURE__ */ u.jsxs(
13804
13841
  "a",
13805
13842
  {
@@ -13818,15 +13855,15 @@ const Bc = z.memo(function({
13818
13855
  ve
13819
13856
  );
13820
13857
  }
13821
- if (V.type === "interrupt") {
13822
- const xe = V, ht = Mo(
13858
+ if (K.type === "interrupt") {
13859
+ const xe = K, ht = Mo(
13823
13860
  (xe == null ? void 0 : xe.id) ?? (xe == null ? void 0 : xe.interrupt_id)
13824
- ), gt = !!(ke && ht && ht === ke), Tt = gt ? Ne ?? (xe == null ? void 0 : xe.value) : xe == null ? void 0 : xe.value, je = ht ? { ...xe, id: ht, interrupt_id: ht } : xe;
13861
+ ), gt = !!(ke && ht && ht === ke), Tt = gt ? Ne ?? (xe == null ? void 0 : xe.value) : xe == null ? void 0 : xe.value, _e = ht ? { ...xe, id: ht, interrupt_id: ht } : xe;
13825
13862
  return /* @__PURE__ */ u.jsx(
13826
13863
  EC,
13827
13864
  {
13828
- interruptPart: je,
13829
- onApprove: rt,
13865
+ interruptPart: _e,
13866
+ onApprove: ot,
13830
13867
  onReject: St,
13831
13868
  disabled: w,
13832
13869
  isActive: gt,
@@ -13839,7 +13876,7 @@ const Bc = z.memo(function({
13839
13876
  }, [
13840
13877
  W,
13841
13878
  Ee,
13842
- rt,
13879
+ ot,
13843
13880
  St,
13844
13881
  M,
13845
13882
  c,
@@ -13851,14 +13888,14 @@ const Bc = z.memo(function({
13851
13888
  g,
13852
13889
  w,
13853
13890
  Y
13854
- ]), lt = z.useCallback(() => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/30 rounded", children: [
13891
+ ]), ct = z.useCallback(() => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/30 rounded", children: [
13855
13892
  /* @__PURE__ */ u.jsx(ji, { className: "h-4 w-4 text-muted-foreground" }),
13856
13893
  /* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
13857
13894
  ] }), []), Ct = z.useCallback(() => {
13858
- const V = te.trim().length > 0 || ne.length > 0 || Oe.length > 0 || Y.length > 0;
13859
- if (!Z && Oe.length > 0 && !r)
13860
- return lt();
13861
- if (!Z && !V && !r)
13895
+ const K = te.trim().length > 0 || ne.length > 0 || Le.length > 0 || Y.length > 0;
13896
+ if (!Z && Le.length > 0 && !r)
13897
+ return ct();
13898
+ if (!Z && !K && !r)
13862
13899
  return null;
13863
13900
  if (Z)
13864
13901
  return /* @__PURE__ */ u.jsx(
@@ -13879,30 +13916,30 @@ const Bc = z.memo(function({
13879
13916
  }, [
13880
13917
  te,
13881
13918
  ne.length,
13882
- Oe.length,
13919
+ Le.length,
13883
13920
  Y.length,
13884
13921
  r,
13885
13922
  Z,
13886
13923
  L,
13887
- lt,
13924
+ ct,
13888
13925
  H
13889
- ]), ce = at(() => J ? "Assistant" : kC(t), [J, t]), re = z.useMemo(() => J ? [] : Array.isArray(C) ? C : [], [C, J]), Le = z.useMemo(() => {
13890
- var V;
13891
- return re.length ? N && re.some((ve) => ve.id === N) ? N : ((V = re[0]) == null ? void 0 : V.id) ?? null : null;
13892
- }, [N, re]), Me = z.useMemo(() => !re.length || !S ? null : re.some((V) => V.id === S) ? S : null, [S, re]) ?? Le, ut = M === "user" && re.length > 0 && typeof k == "function", et = z.useCallback(
13893
- (V) => {
13926
+ ]), ce = lt(() => J ? "Assistant" : kC(t), [J, t]), re = z.useMemo(() => J ? [] : Array.isArray(C) ? C : [], [C, J]), Ye = z.useMemo(() => {
13927
+ var K;
13928
+ return re.length ? N && re.some((ve) => ve.id === N) ? N : ((K = re[0]) == null ? void 0 : K.id) ?? null : null;
13929
+ }, [N, re]), Xe = z.useMemo(() => !re.length || !S ? null : re.some((K) => K.id === S) ? S : null, [S, re]) ?? Ye, je = M === "user" && re.length > 0 && typeof k == "function", Fe = z.useCallback(
13930
+ (K) => {
13894
13931
  if (!k) return;
13895
- const ve = (V == null ? void 0 : V.id) ?? null, xe = (V == null ? void 0 : V.parentId) ?? E ?? null;
13932
+ const ve = (K == null ? void 0 : K.id) ?? null, xe = (K == null ? void 0 : K.parentId) ?? E ?? null;
13896
13933
  k(ve, xe);
13897
13934
  },
13898
13935
  [E, k]
13899
- ), Fe = z.useMemo(() => Me ? re.findIndex((V) => V.id === Me) : -1, [Me, re]), Pt = z.useMemo(() => Fe < 0 ? null : re[Fe] ?? null, [Fe, re]), jt = z.useCallback((V) => {
13936
+ ), Oe = z.useMemo(() => Xe ? re.findIndex((K) => K.id === Xe) : -1, [Xe, re]), Pt = z.useMemo(() => Oe < 0 ? null : re[Oe] ?? null, [Oe, re]), jt = z.useCallback((K) => {
13900
13937
  const ve = [];
13901
- if (V.step !== null && ve.push(`Step ${V.step}`), V.source && ve.push(V.source), !V.createdAt)
13902
- return ve.length ? ve.join(" • ") : V.id.slice(0, 8);
13938
+ if (K.step !== null && ve.push(`Step ${K.step}`), K.source && ve.push(K.source), !K.createdAt)
13939
+ return ve.length ? ve.join(" • ") : K.id.slice(0, 8);
13903
13940
  let xe = "";
13904
13941
  try {
13905
- const ht = new Date(V.createdAt);
13942
+ const ht = new Date(K.createdAt);
13906
13943
  Number.isNaN(ht.getTime()) || (xe = new Intl.DateTimeFormat(void 0, {
13907
13944
  hour: "2-digit",
13908
13945
  minute: "2-digit"
@@ -13913,7 +13950,7 @@ const Bc = z.memo(function({
13913
13950
  return `${xe}`;
13914
13951
  }, []);
13915
13952
  return Z && !f ? null : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
13916
- /* @__PURE__ */ u.jsx("div", { className: Q(Ze(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: Q(Xe(), p.content), children: [
13953
+ /* @__PURE__ */ u.jsx("div", { className: Q(tt(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: Q(Qe(), p.content), children: [
13917
13954
  (i || a || Z) && /* @__PURE__ */ u.jsxs(
13918
13955
  "div",
13919
13956
  {
@@ -13925,7 +13962,7 @@ const Bc = z.memo(function({
13925
13962
  ),
13926
13963
  children: [
13927
13964
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
13928
- qe(),
13965
+ Ge(),
13929
13966
  a && ce && /* @__PURE__ */ u.jsx("span", { className: Q("font-medium", D ? "text-xs" : "text-sm"), children: ce }),
13930
13967
  Z && /* @__PURE__ */ u.jsxs(
13931
13968
  Zf,
@@ -13940,9 +13977,9 @@ const Bc = z.memo(function({
13940
13977
  role: "button",
13941
13978
  tabIndex: 0,
13942
13979
  "aria-expanded": L === "expanded",
13943
- onClick: () => F((V) => V === "expanded" ? "preview" : "expanded"),
13944
- onKeyDown: (V) => {
13945
- (V.key === "Enter" || V.key === " ") && (V.preventDefault(), F((ve) => ve === "expanded" ? "preview" : "expanded"));
13980
+ onClick: () => F((K) => K === "expanded" ? "preview" : "expanded"),
13981
+ onKeyDown: (K) => {
13982
+ (K.key === "Enter" || K.key === " ") && (K.preventDefault(), F((ve) => ve === "expanded" ? "preview" : "expanded"));
13946
13983
  },
13947
13984
  children: [
13948
13985
  /* @__PURE__ */ u.jsx("span", { children: se.name ?? "Tool Output" }),
@@ -13953,28 +13990,28 @@ const Bc = z.memo(function({
13953
13990
  )
13954
13991
  ] }),
13955
13992
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
13956
- ut && Pt && Fe >= 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
13993
+ je && Pt && Oe >= 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
13957
13994
  /* @__PURE__ */ u.jsx(
13958
13995
  "button",
13959
13996
  {
13960
13997
  type: "button",
13961
13998
  className: Q(
13962
13999
  "flex items-center justify-center rounded border px-1.5 py-1 transition-colors",
13963
- Fe > 0 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
14000
+ Oe > 0 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
13964
14001
  ),
13965
14002
  onClick: () => {
13966
- if (Fe <= 0) return;
13967
- const V = re[Fe - 1];
13968
- V && et(V);
14003
+ if (Oe <= 0) return;
14004
+ const K = re[Oe - 1];
14005
+ K && Fe(K);
13969
14006
  },
13970
14007
  "aria-label": "Previous checkpoint",
13971
- disabled: Fe <= 0,
14008
+ disabled: Oe <= 0,
13972
14009
  children: /* @__PURE__ */ u.jsx(xm, { className: "h-3 w-3" })
13973
14010
  }
13974
14011
  ),
13975
14012
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
13976
14013
  /* @__PURE__ */ u.jsxs("span", { className: "whitespace-nowrap", children: [
13977
- Fe + 1,
14014
+ Oe + 1,
13978
14015
  " / ",
13979
14016
  re.length
13980
14017
  ] }),
@@ -13986,15 +14023,15 @@ const Bc = z.memo(function({
13986
14023
  type: "button",
13987
14024
  className: Q(
13988
14025
  "flex items-center justify-center rounded border px-1.5 py-1 transition-colors",
13989
- Fe < re.length - 1 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
14026
+ Oe < re.length - 1 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
13990
14027
  ),
13991
14028
  onClick: () => {
13992
- if (Fe >= re.length - 1) return;
13993
- const V = re[Fe + 1];
13994
- V && et(V);
14029
+ if (Oe >= re.length - 1) return;
14030
+ const K = re[Oe + 1];
14031
+ K && Fe(K);
13995
14032
  },
13996
14033
  "aria-label": "Next checkpoint",
13997
- disabled: Fe >= re.length - 1,
14034
+ disabled: Oe >= re.length - 1,
13998
14035
  children: /* @__PURE__ */ u.jsx(Xc, { className: "h-3 w-3" })
13999
14036
  }
14000
14037
  )
@@ -14018,11 +14055,11 @@ const Bc = z.memo(function({
14018
14055
  ),
14019
14056
  children: [
14020
14057
  /* @__PURE__ */ u.jsx("div", { className: "relative", children: /* @__PURE__ */ u.jsx(
14021
- ot,
14058
+ st,
14022
14059
  {
14023
14060
  variant: "ghost",
14024
14061
  size: "sm",
14025
- onClick: () => Be(),
14062
+ onClick: () => He(),
14026
14063
  className: Q("h-6 w-6 p-0 hover:bg-foreground/10", H, D && "h-5 w-5"),
14027
14064
  "aria-label": "Copy message",
14028
14065
  title: "Copy message",
@@ -14030,22 +14067,22 @@ const Bc = z.memo(function({
14030
14067
  }
14031
14068
  ) }),
14032
14069
  M === "user" && h && /* @__PURE__ */ u.jsx(
14033
- ot,
14070
+ st,
14034
14071
  {
14035
14072
  variant: "ghost",
14036
14073
  size: "sm",
14037
- onClick: Ue,
14074
+ onClick: We,
14038
14075
  className: Q("h-6 w-6 p-0 hover:bg-foreground/10", H, D && "h-5 w-5"),
14039
14076
  "aria-label": "Edit message",
14040
14077
  children: /* @__PURE__ */ u.jsx(fl, { className: Q(H, D ? "h-3 w-3" : "h-4 w-4") })
14041
14078
  }
14042
14079
  ),
14043
14080
  M === "assistant" && m && /* @__PURE__ */ u.jsx(
14044
- ot,
14081
+ st,
14045
14082
  {
14046
14083
  variant: "ghost",
14047
14084
  size: "sm",
14048
- onClick: Ke,
14085
+ onClick: qe,
14049
14086
  className: Q("h-6 w-6 p-0 hover:bg-foreground/10", H, D && "h-5 w-5"),
14050
14087
  "aria-label": "Regenerate response",
14051
14088
  children: /* @__PURE__ */ u.jsx(_i, { className: Q(H, D ? "h-3 w-3" : "h-4 w-4") })
@@ -14079,31 +14116,31 @@ const Bc = z.memo(function({
14079
14116
  ),
14080
14117
  children: [
14081
14118
  /* @__PURE__ */ u.jsx(
14082
- ot,
14119
+ st,
14083
14120
  {
14084
14121
  variant: "ghost",
14085
14122
  size: "sm",
14086
- onClick: () => Be(),
14123
+ onClick: () => He(),
14087
14124
  className: Q("h-6 w-6 p-0 hover:bg-background/50 text-current", D && "h-5 w-5"),
14088
14125
  children: /* @__PURE__ */ u.jsx(dl, { className: Q(I ? "text-success" : "text-current", D ? "h-3 w-3" : "h-4 w-4") })
14089
14126
  }
14090
14127
  ),
14091
14128
  M === "user" && h && /* @__PURE__ */ u.jsx(
14092
- ot,
14129
+ st,
14093
14130
  {
14094
14131
  variant: "ghost",
14095
14132
  size: "sm",
14096
- onClick: Ue,
14133
+ onClick: We,
14097
14134
  className: Q("h-6 w-6 p-0 hover:bg-background/50 text-current", D && "h-5 w-5"),
14098
14135
  children: /* @__PURE__ */ u.jsx(fl, { className: Q("text-current", D ? "h-3 w-3" : "h-4 w-4") })
14099
14136
  }
14100
14137
  ),
14101
14138
  M === "assistant" && m && /* @__PURE__ */ u.jsx(
14102
- ot,
14139
+ st,
14103
14140
  {
14104
14141
  variant: "ghost",
14105
14142
  size: "sm",
14106
- onClick: Ke,
14143
+ onClick: qe,
14107
14144
  className: Q("h-6 w-6 p-0 hover:bg-background/50 text-current", D && "h-5 w-5"),
14108
14145
  children: /* @__PURE__ */ u.jsx(_i, { className: Q("text-current", D ? "h-3 w-3" : "h-4 w-4") })
14109
14146
  }
@@ -14112,14 +14149,14 @@ const Bc = z.memo(function({
14112
14149
  }
14113
14150
  )
14114
14151
  ] }) }),
14115
- q && /* @__PURE__ */ u.jsx(
14152
+ U && /* @__PURE__ */ u.jsx(
14116
14153
  oC,
14117
14154
  {
14118
14155
  isOpen: ee,
14119
14156
  onClose: P,
14120
- fileId: q.id,
14121
- fileName: q.name,
14122
- mimeType: q.mimeType
14157
+ fileId: U.id,
14158
+ fileName: U.name,
14159
+ mimeType: U.mimeType
14123
14160
  }
14124
14161
  )
14125
14162
  ] });
@@ -14174,7 +14211,7 @@ function EC({
14174
14211
  a && /* @__PURE__ */ u.jsx(Xr, { className: "pt-0 pb-3", children: a }),
14175
14212
  /* @__PURE__ */ u.jsx(ep, { className: "pt-0", children: /* @__PURE__ */ u.jsxs("div", { className: "flex gap-2 ml-auto", children: [
14176
14213
  /* @__PURE__ */ u.jsx(
14177
- ot,
14214
+ st,
14178
14215
  {
14179
14216
  size: "sm",
14180
14217
  variant: "outline",
@@ -14185,7 +14222,7 @@ function EC({
14185
14222
  }
14186
14223
  ),
14187
14224
  /* @__PURE__ */ u.jsx(
14188
- ot,
14225
+ st,
14189
14226
  {
14190
14227
  size: "sm",
14191
14228
  onClick: () => t(e),
@@ -14294,7 +14331,7 @@ function NC({
14294
14331
  }
14295
14332
  ) }),
14296
14333
  /* @__PURE__ */ u.jsx(
14297
- ot,
14334
+ st,
14298
14335
  {
14299
14336
  type: "button",
14300
14337
  variant: "ghost",
@@ -14388,9 +14425,9 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14388
14425
  onSelectCheckpoint: I,
14389
14426
  timelineCheckpoints: O
14390
14427
  }, L) => {
14391
- const F = Je(null), j = Je(null), $ = Je(!1), [A, B] = ge(!0), D = at(() => w ? e.some((Y) => "type" in Y && Y.type === "default_message" ? !1 : Array.isArray(Y == null ? void 0 : Y.content) && Y.content.some(
14428
+ const F = et(null), j = et(null), $ = et(!1), [A, B] = ge(!0), D = lt(() => w ? e.some((Y) => "type" in Y && Y.type === "default_message" ? !1 : Array.isArray(Y == null ? void 0 : Y.content) && Y.content.some(
14392
14429
  (de) => de && de.type === "interrupt" && (de.id ?? de.interrupt_id) === w.id
14393
- )) : !1, [w, e]), M = at(() => {
14430
+ )) : !1, [w, e]), M = lt(() => {
14394
14431
  if (!w || D)
14395
14432
  return null;
14396
14433
  const Y = w.id && String(w.id).trim() ? String(w.id).trim() : "pending-interrupt";
@@ -14413,7 +14450,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14413
14450
  }
14414
14451
  ]
14415
14452
  };
14416
- }, [w, D]), Z = at(() => M ? [...e, M] : e, [e, M]), J = at(() => S ? Z : Z.filter((Y) => (Y == null ? void 0 : Y.role) !== "tool"), [Z, S]), pe = at(() => {
14453
+ }, [w, D]), Z = lt(() => M ? [...e, M] : e, [e, M]), J = lt(() => S ? Z : Z.filter((Y) => (Y == null ? void 0 : Y.role) !== "tool"), [Z, S]), pe = lt(() => {
14417
14454
  const Y = /* @__PURE__ */ new Set(), de = [];
14418
14455
  for (let ke = J.length - 1; ke >= 0; ke--) {
14419
14456
  const Ne = J[ke];
@@ -14422,13 +14459,13 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14422
14459
  de.push(Ne);
14423
14460
  continue;
14424
14461
  }
14425
- const ze = Ne, Be = jC(ze);
14426
- Y.has(Be) || (Y.add(Be), de.push(ze));
14462
+ const Be = Ne, He = jC(Be);
14463
+ Y.has(He) || (Y.add(He), de.push(Be));
14427
14464
  }
14428
14465
  return de.reverse();
14429
14466
  }, [J]), Re = Ce((Y) => {
14430
14467
  B(Y), y && y(!Y), g && g(Y);
14431
- }, [y, g]), Ee = at(() => {
14468
+ }, [y, g]), Ee = lt(() => {
14432
14469
  if (a)
14433
14470
  return async () => {
14434
14471
  if (!$.current) {
@@ -14440,7 +14477,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14440
14477
  }
14441
14478
  }
14442
14479
  };
14443
- }, [a]), W = at(() => !m || x ? !1 : A ? "auto" : !1, [A, m, x]), ee = at(() => O ?? [], [O]), q = E ?? (ee.length ? ee[ee.length - 1].id : null), P = ee.length > 0, H = at(() => {
14480
+ }, [a]), W = lt(() => !m || x ? !1 : A ? "auto" : !1, [A, m, x]), ee = lt(() => O ?? [], [O]), U = E ?? (ee.length ? ee[ee.length - 1].id : null), P = ee.length > 0, H = lt(() => {
14444
14481
  if (typeof h != "string") return null;
14445
14482
  const Y = h.trim();
14446
14483
  return Y ? {
@@ -14461,7 +14498,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14461
14498
  ] }),
14462
14499
  /* @__PURE__ */ u.jsx("div", { className: "pointer-events-none absolute left-5 top-0 bottom-0 w-px bg-border/50" }),
14463
14500
  /* @__PURE__ */ u.jsx("div", { className: "flex flex-col gap-4", children: ee.map((Y) => {
14464
- const de = q === Y.id;
14501
+ const de = U === Y.id;
14465
14502
  return /* @__PURE__ */ u.jsxs(
14466
14503
  "button",
14467
14504
  {
@@ -14516,7 +14553,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14516
14553
  onCancelEdit: () => {
14517
14554
  }
14518
14555
  }
14519
- ) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: h ?? "No messages yet. Start a conversation!" }), Oe = pe.length > 0;
14556
+ ) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: h ?? "No messages yet. Start a conversation!" }), Le = pe.length > 0;
14520
14557
  return lm(
14521
14558
  L,
14522
14559
  () => ({
@@ -14543,7 +14580,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14543
14580
  [pe]
14544
14581
  ), /* @__PURE__ */ u.jsxs("div", { className: se, style: p, children: [
14545
14582
  te,
14546
- /* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0", children: Oe ? /* @__PURE__ */ u.jsx(
14583
+ /* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0", children: Le ? /* @__PURE__ */ u.jsx(
14547
14584
  vS,
14548
14585
  {
14549
14586
  ref: (Y) => {
@@ -14566,24 +14603,24 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14566
14603
  style: { height: "100%", overscrollBehavior: "contain" },
14567
14604
  computeItemKey: (Y, de) => Hc(de, Y),
14568
14605
  itemContent: (Y, de) => {
14569
- var rt;
14606
+ var ot;
14570
14607
  const ke = Hc(de, Y), Ne = "type" in de && de.type === "default_message";
14571
- let ze = [], Be = null, Ue = {}, Ke = {}, qe = null, Ze = null;
14608
+ let Be = [], He = null, We = {}, qe = {}, Ge = null, tt = null;
14572
14609
  if (!Ne) {
14573
14610
  const St = de, mt = St.checkpointId ?? null;
14574
- Ue = St.additionalKwargs ?? {}, Ke = St.responseMetadata ?? {};
14575
- const lt = mt && k ? k.get(mt) ?? null : null;
14576
- qe = typeof Ue.step == "number" ? Ue.step : typeof Ke.step == "number" ? Ke.step : (lt == null ? void 0 : lt.step) ?? null;
14577
- const Ct = typeof Ue.source == "string" ? Ue.source : typeof Ke.source == "string" ? Ke.source : (lt == null ? void 0 : lt.source) ?? null;
14578
- Ze = Ct ? String(Ct) : null;
14579
- const ce = qe !== null && Ze ? `${qe}:${Ze}` : null;
14580
- ce && (N != null && N.has(ce)) ? ze = N.get(ce) ?? [] : mt && lt && (ze = [lt]), Be = mt ?? ((rt = ze[0]) == null ? void 0 : rt.id) ?? null;
14611
+ We = St.additionalKwargs ?? {}, qe = St.responseMetadata ?? {};
14612
+ const ct = mt && k ? k.get(mt) ?? null : null;
14613
+ Ge = typeof We.step == "number" ? We.step : typeof qe.step == "number" ? qe.step : (ct == null ? void 0 : ct.step) ?? null;
14614
+ const Ct = typeof We.source == "string" ? We.source : typeof qe.source == "string" ? qe.source : (ct == null ? void 0 : ct.source) ?? null;
14615
+ tt = Ct ? String(Ct) : null;
14616
+ const ce = Ge !== null && tt ? `${Ge}:${tt}` : null;
14617
+ ce && (N != null && N.has(ce)) ? Be = N.get(ce) ?? [] : mt && ct && (Be = [ct]), He = mt ?? ((ot = Be[0]) == null ? void 0 : ot.id) ?? null;
14581
14618
  }
14582
- const Xe = (() => {
14583
- if (typeof Ue.parentCheckpointId == "string")
14584
- return Ue.parentCheckpointId;
14585
- if (typeof Ke.parentCheckpointId == "string")
14586
- return Ke.parentCheckpointId;
14619
+ const Qe = (() => {
14620
+ if (typeof We.parentCheckpointId == "string")
14621
+ return We.parentCheckpointId;
14622
+ if (typeof qe.parentCheckpointId == "string")
14623
+ return qe.parentCheckpointId;
14587
14624
  })();
14588
14625
  return /* @__PURE__ */ u.jsx(
14589
14626
  "div",
@@ -14614,11 +14651,11 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14614
14651
  onInterruptActionStart: T,
14615
14652
  onInterruptActionEnd: C,
14616
14653
  showToolMessages: S,
14617
- checkpointCandidates: ze,
14654
+ checkpointCandidates: Be,
14618
14655
  activeCheckpointId: E ?? null,
14619
14656
  onSelectCheckpoint: I,
14620
- defaultCheckpointId: Be,
14621
- messageParentCheckpointId: Xe
14657
+ defaultCheckpointId: He,
14658
+ messageParentCheckpointId: Qe
14622
14659
  }
14623
14660
  )
14624
14661
  }
@@ -14670,15 +14707,15 @@ function Ai({
14670
14707
  Ee(!0);
14671
14708
  }, []), ee = Ce(() => {
14672
14709
  Ee(!1);
14673
- }, []), q = !!pe || Re, [P, H] = ge(null), [te, se] = ge(""), [ne, Oe] = ge(null), [Y, de] = ge(null), [ke, Ne] = ge([]), [ze, Be] = ge(0), [Ue, Ke] = ge(0), [qe, Ze] = ge(!1), [Xe, rt] = ge(null), [St, mt] = ge(null), [lt, Ct] = ge(!1), [ce, re] = ge(null), [Le, Qe] = ge(!1), Me = Je(!1), [ut, et] = ge(() => Uc.value), Fe = Je(ut), Pt = Je(null), jt = Ce((G) => {
14674
- Uc.value = G, et(G);
14675
- }, []), [V, ve] = ge(!1), xe = Je(null), ht = Ce((G) => {
14710
+ }, []), U = !!pe || Re, [P, H] = ge(null), [te, se] = ge(""), [ne, Le] = ge(null), [Y, de] = ge(null), [ke, Ne] = ge([]), [Be, He] = ge(0), [We, qe] = ge(0), [Ge, tt] = ge(!1), [Qe, ot] = ge(null), [St, mt] = ge(null), [ct, Ct] = ge(!1), [ce, re] = ge(null), [Ye, De] = ge(!1), Xe = et(!1), [je, Fe] = ge(() => Uc.value), Oe = et(je), Pt = et(null), jt = Ce((G) => {
14711
+ Uc.value = G, Fe(G);
14712
+ }, []), [K, ve] = ge(!1), xe = et(null), ht = Ce((G) => {
14676
14713
  if (!Array.isArray(G))
14677
14714
  return { text: null, messageId: null };
14678
14715
  for (let oe = G.length - 1; oe >= 0; oe--) {
14679
14716
  const ae = G[oe];
14680
14717
  if (!ae || ae.role !== "user") continue;
14681
- const be = (ae.content ?? []).filter((Ye) => (Ye == null ? void 0 : Ye.type) === "text").map((Ye) => Ye.text).filter((Ye) => typeof Ye == "string" && Ye.trim().length > 0);
14718
+ const be = (ae.content ?? []).filter((Ze) => (Ze == null ? void 0 : Ze.type) === "text").map((Ze) => Ze.text).filter((Ze) => typeof Ze == "string" && Ze.trim().length > 0);
14682
14719
  return {
14683
14720
  text: be.length ? be.join(" ").trim() : null,
14684
14721
  messageId: ae.id ?? null
@@ -14699,20 +14736,20 @@ function Ai({
14699
14736
  return typeof ae == "string" && ae.trim() ? ae : null;
14700
14737
  },
14701
14738
  []
14702
- ), je = at(() => {
14739
+ ), _e = lt(() => {
14703
14740
  const G = (be) => {
14704
14741
  if (!Array.isArray(be) || be.length === 0)
14705
14742
  return null;
14706
- const dt = be.map((Ye) => {
14707
- if (typeof Ye == "string")
14708
- return Ye.trim();
14709
- if (Ye && typeof Ye == "object" && "type" in Ye) {
14710
- const nt = Ye;
14711
- if (typeof nt.type == "string")
14712
- return nt.type;
14743
+ const dt = be.map((Ze) => {
14744
+ if (typeof Ze == "string")
14745
+ return Ze.trim();
14746
+ if (Ze && typeof Ze == "object" && "type" in Ze) {
14747
+ const rt = Ze;
14748
+ if (typeof rt.type == "string")
14749
+ return rt.type;
14713
14750
  }
14714
14751
  return null;
14715
- }).filter((Ye) => !!(Ye && Ye.length));
14752
+ }).filter((Ze) => !!(Ze && Ze.length));
14716
14753
  return dt.length ? dt.join(", ") : null;
14717
14754
  }, oe = Array.isArray(I) ? I.map((be) => {
14718
14755
  const dt = G(be.next);
@@ -14725,83 +14762,83 @@ function Ai({
14725
14762
  } : be;
14726
14763
  }) : [];
14727
14764
  return oe.some((be) => gt(be.metadata, "step") !== null) && oe.sort((be, dt) => {
14728
- const Ye = gt(be.metadata, "step"), nt = gt(dt.metadata, "step");
14729
- if (Ye !== null || nt !== null)
14730
- return (nt ?? Number.NEGATIVE_INFINITY) - (Ye ?? Number.NEGATIVE_INFINITY);
14765
+ const Ze = gt(be.metadata, "step"), rt = gt(dt.metadata, "step");
14766
+ if (Ze !== null || rt !== null)
14767
+ return (rt ?? Number.NEGATIVE_INFINITY) - (Ze ?? Number.NEGATIVE_INFINITY);
14731
14768
  const Mt = Date.parse(be.createdAt ?? ""), tn = Date.parse(dt.createdAt ?? "");
14732
14769
  return Number.isNaN(Mt) || Number.isNaN(tn) ? 0 : tn - Mt;
14733
14770
  }), oe;
14734
- }, [I, gt]), { checkpointMetaById: Vt, checkpointIndexByKey: ct } = at(() => {
14771
+ }, [I, gt]), { checkpointMetaById: Vt, checkpointIndexByKey: ut } = lt(() => {
14735
14772
  const G = /* @__PURE__ */ new Map(), oe = /* @__PURE__ */ new Map();
14736
- for (const ae of je) {
14773
+ for (const ae of _e) {
14737
14774
  const be = ae.checkpointId ?? null;
14738
14775
  if (!be) continue;
14739
- const dt = gt(ae.metadata, "step"), Ye = Tt(ae.metadata, "source"), nt = {
14776
+ const dt = gt(ae.metadata, "step"), Ze = Tt(ae.metadata, "source"), rt = {
14740
14777
  id: be,
14741
14778
  step: dt,
14742
- source: Ye,
14779
+ source: Ze,
14743
14780
  createdAt: ae.createdAt ?? null,
14744
14781
  namespace: ae.checkpointNs ?? null,
14745
14782
  parentId: ae.parentId ?? null
14746
14783
  };
14747
- if (G.set(be, nt), dt !== null && Ye) {
14748
- const Mt = `${dt}:${Ye}`, tn = oe.get(Mt) ?? [];
14749
- tn.push(nt), oe.set(Mt, tn);
14784
+ if (G.set(be, rt), dt !== null && Ze) {
14785
+ const Mt = `${dt}:${Ze}`, tn = oe.get(Mt) ?? [];
14786
+ tn.push(rt), oe.set(Mt, tn);
14750
14787
  }
14751
14788
  }
14752
14789
  for (const ae of oe.values())
14753
14790
  ae.sort((be, dt) => {
14754
- const Ye = be.createdAt ?? "";
14755
- return (dt.createdAt ?? "").localeCompare(Ye);
14791
+ const Ze = be.createdAt ?? "";
14792
+ return (dt.createdAt ?? "").localeCompare(Ze);
14756
14793
  });
14757
14794
  return { checkpointMetaById: G, checkpointIndexByKey: oe };
14758
- }, [je, gt, Tt]), kt = at(() => {
14759
- var Ye;
14760
- if (!je.length) return [];
14761
- const G = [...je].reverse(), oe = (nt, Mt) => {
14762
- const tn = nt.checkpointId ?? null;
14795
+ }, [_e, gt, Tt]), kt = lt(() => {
14796
+ var Ze;
14797
+ if (!_e.length) return [];
14798
+ const G = [..._e].reverse(), oe = (rt, Mt) => {
14799
+ const tn = rt.checkpointId ?? null;
14763
14800
  if (!tn) return null;
14764
- const Zn = Tt(nt.metadata, "source");
14765
- Tt(nt.metadata, "next");
14766
- const { text: ll, messageId: nm } = ht(nt.messages), oi = ll && ll.replace(/\s+/g, " ").trim() || Tt(nt.metadata, "title") || Tt(nt.metadata, "label") || Mt || Zn || "Checkpoint", rm = oi.length > 60 ? `${oi.slice(0, 57)}…` : oi;
14801
+ const Zn = Tt(rt.metadata, "source");
14802
+ Tt(rt.metadata, "next");
14803
+ const { text: ll, messageId: nm } = ht(rt.messages), oi = ll && ll.replace(/\s+/g, " ").trim() || Tt(rt.metadata, "title") || Tt(rt.metadata, "label") || Mt || Zn || "Checkpoint", rm = oi.length > 60 ? `${oi.slice(0, 57)}…` : oi;
14767
14804
  return {
14768
14805
  id: tn,
14769
14806
  label: rm,
14770
14807
  messageId: nm ?? null,
14771
- createdAt: nt.createdAt ?? null,
14772
- step: gt(nt.metadata, "step"),
14808
+ createdAt: rt.createdAt ?? null,
14809
+ step: gt(rt.metadata, "step"),
14773
14810
  source: Zn ?? null,
14774
- next: Tt(nt.metadata, "next")
14811
+ next: Tt(rt.metadata, "next")
14775
14812
  };
14776
14813
  }, ae = [], be = /* @__PURE__ */ new Set();
14777
- for (const nt of G) {
14778
- const Mt = ((Ye = Tt(nt.metadata, "source")) == null ? void 0 : Ye.toLowerCase()) ?? null;
14814
+ for (const rt of G) {
14815
+ const Mt = ((Ze = Tt(rt.metadata, "source")) == null ? void 0 : Ze.toLowerCase()) ?? null;
14779
14816
  if (!(Mt === "input" || Mt === "user_input" || Mt === "user")) continue;
14780
- const Zn = oe(nt, "User input");
14817
+ const Zn = oe(rt, "User input");
14781
14818
  Zn && !be.has(Zn.id) && (ae.push(Zn), be.add(Zn.id));
14782
14819
  }
14783
14820
  if (!ae.length)
14784
- for (const nt of G) {
14785
- const Mt = oe(nt);
14821
+ for (const rt of G) {
14822
+ const Mt = oe(rt);
14786
14823
  Mt && !be.has(Mt.id) && (ae.push(Mt), be.add(Mt.id));
14787
14824
  }
14788
- const dt = je.find((nt) => {
14825
+ const dt = _e.find((rt) => {
14789
14826
  var tn;
14790
- return (((tn = Tt(nt.metadata, "source")) == null ? void 0 : tn.toLowerCase()) ?? null) === "loop";
14827
+ return (((tn = Tt(rt.metadata, "source")) == null ? void 0 : tn.toLowerCase()) ?? null) === "loop";
14791
14828
  });
14792
14829
  if (dt) {
14793
- const nt = oe(dt, "Latest loop");
14794
- nt && !be.has(nt.id) && (ae.push(nt), be.add(nt.id));
14830
+ const rt = oe(dt, "Latest loop");
14831
+ rt && !be.has(rt.id) && (ae.push(rt), be.add(rt.id));
14795
14832
  }
14796
14833
  return ae;
14797
- }, [je, ht, gt, Tt]), Dn = Je(null), Jn = Je(null), Ln = Ce(() => {
14798
- Dn.current && (Dn.current.value = ""), Jn.current && (Jn.current.value = ""), Be((G) => G + 1), Ke((G) => G + 1);
14834
+ }, [_e, ht, gt, Tt]), Dn = et(null), Jn = et(null), Ln = Ce(() => {
14835
+ Dn.current && (Dn.current.value = ""), Jn.current && (Jn.current.value = ""), He((G) => G + 1), qe((G) => G + 1);
14799
14836
  }, []), ti = Ce(
14800
14837
  (G) => {
14801
14838
  jt(G);
14802
14839
  },
14803
14840
  [jt]
14804
- ), So = Je(!1);
14841
+ ), So = et(!1);
14805
14842
  Et(() => {
14806
14843
  So.current && !F && (Ne([]), Ln()), So.current = F;
14807
14844
  }, [F, Ln]);
@@ -14813,24 +14850,24 @@ function Ai({
14813
14850
  };
14814
14851
  return G(), window.addEventListener("resize", G), () => window.removeEventListener("resize", G);
14815
14852
  }, []), Et(() => {
14816
- Qe(!1), Me.current = !1;
14853
+ De(!1), Xe.current = !1;
14817
14854
  }, [D]), Et(() => {
14818
- Fe.current = ut;
14819
- }, [ut]), Et(() => {
14855
+ Oe.current = je;
14856
+ }, [je]), Et(() => {
14820
14857
  if (!P) {
14821
14858
  Pt.current = null;
14822
14859
  return;
14823
14860
  }
14824
- Pt.current === null && (Pt.current = Fe.current), jt(te ?? "");
14861
+ Pt.current === null && (Pt.current = Oe.current), jt(te ?? "");
14825
14862
  }, [te, P, jt]);
14826
14863
  const R = Ce(async () => {
14827
- if (!(!b || T || !Le))
14864
+ if (!(!b || T || !Ye))
14828
14865
  try {
14829
14866
  await S();
14830
14867
  } catch (G) {
14831
14868
  console.warn("loadOlder failed", G);
14832
14869
  }
14833
- }, [b, Le, T, S]);
14870
+ }, [b, Ye, T, S]);
14834
14871
  Et(() => {
14835
14872
  (async () => {
14836
14873
  if (!x.baseUrl) {
@@ -14845,9 +14882,9 @@ function Ai({
14845
14882
  }
14846
14883
  })();
14847
14884
  }, [x.baseUrl]), Et(() => {
14848
- j && !lt && (m == null || m(j));
14849
- }, [j, lt, m]);
14850
- const K = (G) => {
14885
+ j && !ct && (m == null || m(j));
14886
+ }, [j, ct, m]);
14887
+ const q = (G) => {
14851
14888
  if (G.length > Wo)
14852
14889
  return `Message too long (${G.length}/${Wo} characters)`;
14853
14890
  try {
@@ -14859,7 +14896,7 @@ function Ai({
14859
14896
  const oe = G.trim();
14860
14897
  if (!(!oe && ke.length === 0)) {
14861
14898
  if (oe) {
14862
- const ae = K(oe);
14899
+ const ae = q(oe);
14863
14900
  if (ae) {
14864
14901
  de(ae);
14865
14902
  return;
@@ -14882,7 +14919,7 @@ function Ai({
14882
14919
  checkpointId: ae,
14883
14920
  checkpointNs: be
14884
14921
  }
14885
- ), p == null || p(oe), jt(""), de(null), Ne([]), Ln(), H(null), se(""), Oe(null);
14922
+ ), p == null || p(oe), jt(""), de(null), Ne([]), Ln(), H(null), se(""), Le(null);
14886
14923
  } catch (ae) {
14887
14924
  const be = (ae == null ? void 0 : ae.message) || "Failed to send message";
14888
14925
  de(be), m == null || m(be);
@@ -14890,23 +14927,23 @@ function Ai({
14890
14927
  }
14891
14928
  }, we = z.useCallback(
14892
14929
  (G, oe, ae) => {
14893
- c && (Pt.current = ut, H(G), se(oe), jt(oe), de(null), Oe({
14930
+ c && (Pt.current = je, H(G), se(oe), jt(oe), de(null), Le({
14894
14931
  checkpointId: (ae == null ? void 0 : ae.checkpointId) ?? null,
14895
14932
  checkpointNs: (ae == null ? void 0 : ae.checkpointNs) ?? null
14896
14933
  }));
14897
14934
  },
14898
- [ut, c, jt]
14899
- ), Ge = z.useCallback(() => {
14900
- H(null), se(""), Oe(null), de(null), jt(Pt.current ?? ut), Pt.current = null;
14901
- }, [ut, jt]), it = Ce(
14935
+ [je, c, jt]
14936
+ ), Je = z.useCallback(() => {
14937
+ H(null), se(""), Le(null), de(null), jt(Pt.current ?? je), Pt.current = null;
14938
+ }, [je, jt]), at = Ce(
14902
14939
  (G, oe, ae) => {
14903
14940
  we(G, oe, ae);
14904
14941
  },
14905
14942
  [we]
14906
- ), He = Ce((G) => {
14943
+ ), Ue = Ce((G) => {
14907
14944
  for (let oe = G - 1; oe >= 0; oe--)
14908
14945
  if (w[oe].role === "user") {
14909
- const ae = w[oe].content || [], dt = ae.filter((Ye) => Ye.type === "text").map((Ye) => Ye.text).join("") || (() => {
14946
+ const ae = w[oe].content || [], dt = ae.filter((Ze) => Ze.type === "text").map((Ze) => Ze.text).join("") || (() => {
14910
14947
  try {
14911
14948
  return JSON.stringify(ae, null, 2);
14912
14949
  } catch {
@@ -14922,7 +14959,7 @@ function Ai({
14922
14959
  );
14923
14960
  break;
14924
14961
  }
14925
- }, [w, A, M, Z]), $e = (G) => {
14962
+ }, [w, A, M, Z]), ze = (G) => {
14926
14963
  const oe = Array.from(G.target.files || []);
14927
14964
  Ne((ae) => [...ae, ...oe]), G.target.value = "";
14928
14965
  }, Ot = (G) => {
@@ -14933,7 +14970,7 @@ function Ai({
14933
14970
  }, bt = async (G) => {
14934
14971
  const oe = (G.target.files || [])[0];
14935
14972
  if (oe) {
14936
- rt(null), mt(null), Ze(!0);
14973
+ ot(null), mt(null), tt(!0);
14937
14974
  try {
14938
14975
  await A(
14939
14976
  { attachments: [oe] },
@@ -14946,9 +14983,9 @@ function Ai({
14946
14983
  mt(ae);
14947
14984
  } catch (ae) {
14948
14985
  const be = ae instanceof Error ? ae.message : "Failed to upload Excel file";
14949
- console.error("Excel upload failed", ae), rt(be), m == null || m(be);
14986
+ console.error("Excel upload failed", ae), ot(be), m == null || m(be);
14950
14987
  } finally {
14951
- Ze(!1), G.target.value = "", Ln();
14988
+ tt(!1), G.target.value = "", Ln();
14952
14989
  }
14953
14990
  }
14954
14991
  }, vt = async (G) => {
@@ -14956,14 +14993,14 @@ function Ai({
14956
14993
  ve(!0);
14957
14994
  try {
14958
14995
  if (!G) {
14959
- await N(), Qe(!1), requestAnimationFrame(() => {
14996
+ await N(), De(!1), requestAnimationFrame(() => {
14960
14997
  var be;
14961
14998
  (be = xe.current) == null || be.scrollToLatest();
14962
14999
  });
14963
15000
  return;
14964
15001
  }
14965
- const oe = je.find((be) => be.checkpointId === G), ae = (oe == null ? void 0 : oe.checkpointNs) ?? null;
14966
- await k(G, ae), Qe(!0), requestAnimationFrame(() => {
15002
+ const oe = _e.find((be) => be.checkpointId === G), ae = (oe == null ? void 0 : oe.checkpointNs) ?? null;
15003
+ await k(G, ae), De(!0), requestAnimationFrame(() => {
14967
15004
  var be;
14968
15005
  (be = xe.current) == null || be.scrollToTop();
14969
15006
  });
@@ -14988,10 +15025,10 @@ function Ai({
14988
15025
  []
14989
15026
  );
14990
15027
  return /* @__PURE__ */ u.jsxs("div", { className: Fn, children: [
14991
- !!j && !lt && /* @__PURE__ */ u.jsxs("div", { className: "flex-shrink-0 bg-red-50 border border-red-200 text-red-800 px-4 py-2 text-sm flex items-center justify-between", children: [
15028
+ !!j && !ct && /* @__PURE__ */ u.jsxs("div", { className: "flex-shrink-0 bg-red-50 border border-red-200 text-red-800 px-4 py-2 text-sm flex items-center justify-between", children: [
14992
15029
  /* @__PURE__ */ u.jsx("span", { children: j }),
14993
15030
  /* @__PURE__ */ u.jsx(
14994
- ot,
15031
+ st,
14995
15032
  {
14996
15033
  variant: "ghost",
14997
15034
  size: "sm",
@@ -15002,7 +15039,7 @@ function Ai({
15002
15039
  }
15003
15040
  )
15004
15041
  ] }),
15005
- y && je.length > 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex-shrink-0 flex items-center gap-2 px-4 py-2 border-b border-border bg-muted/60 text-xs dark:bg-muted/50", children: [
15042
+ y && _e.length > 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex-shrink-0 flex items-center gap-2 px-4 py-2 border-b border-border bg-muted/60 text-xs dark:bg-muted/50", children: [
15006
15043
  /* @__PURE__ */ u.jsx("span", { className: "opacity-70", children: "Checkpoint:" }),
15007
15044
  /* @__PURE__ */ u.jsxs(
15008
15045
  "select",
@@ -15015,7 +15052,7 @@ function Ai({
15015
15052
  },
15016
15053
  children: [
15017
15054
  /* @__PURE__ */ u.jsx("option", { value: "", children: "Latest" }),
15018
- je.map((G) => {
15055
+ _e.map((G) => {
15019
15056
  const oe = Vt.get(G.checkpointId ?? "") ?? null;
15020
15057
  return /* @__PURE__ */ u.jsx("option", { value: G.checkpointId ?? void 0, children: Dr(oe) }, G.checkpointId);
15021
15058
  })
@@ -15044,27 +15081,27 @@ function Ai({
15044
15081
  enableMessageEditing: c,
15045
15082
  editingMessageId: P,
15046
15083
  onStartReached: () => {
15047
- Le && R();
15084
+ Ye && R();
15048
15085
  },
15049
15086
  onScrollAway: (G) => {
15050
- if (!Me.current) {
15051
- Me.current = !0;
15087
+ if (!Xe.current) {
15088
+ Xe.current = !0;
15052
15089
  return;
15053
15090
  }
15054
- G && Qe(!0);
15091
+ G && De(!0);
15055
15092
  },
15056
- onEdit: it,
15057
- onRegenerate: He,
15058
- onCancelEdit: Ge,
15093
+ onEdit: at,
15094
+ onRegenerate: Ue,
15095
+ onCancelEdit: Je,
15059
15096
  emptyMessage: ce ?? void 0,
15060
- isNavigatingCheckpoint: V,
15097
+ isNavigatingCheckpoint: K,
15061
15098
  activeInterrupt: pe,
15062
15099
  disableInterruptActions: Re,
15063
15100
  onInterruptActionStart: W,
15064
15101
  onInterruptActionEnd: ee,
15065
15102
  showToolMessages: d,
15066
15103
  checkpointMetaById: Vt,
15067
- checkpointIndexByKey: ct,
15104
+ checkpointIndexByKey: ut,
15068
15105
  activeCheckpointId: M,
15069
15106
  onSelectCheckpoint: Kt,
15070
15107
  timelineCheckpoints: kt
@@ -15079,7 +15116,7 @@ function Ai({
15079
15116
  /* @__PURE__ */ u.jsx(zr, { className: "h-6 w-6 animate-spin" }),
15080
15117
  /* @__PURE__ */ u.jsx("span", { className: "text-xs font-semibold uppercase tracking-wide", children: "Loading messages…" })
15081
15118
  ] }),
15082
- (T || V) && /* @__PURE__ */ u.jsxs("div", { className: "absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 bg-background/80 backdrop-blur-sm text-muted-foreground", children: [
15119
+ (T || K) && /* @__PURE__ */ u.jsxs("div", { className: "absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 bg-background/80 backdrop-blur-sm text-muted-foreground", children: [
15083
15120
  /* @__PURE__ */ u.jsx(zr, { className: "h-6 w-6 animate-spin" }),
15084
15121
  /* @__PURE__ */ u.jsx("span", { className: "text-xs font-semibold uppercase tracking-wide", children: "Loading checkpoint…" })
15085
15122
  ] })
@@ -15093,11 +15130,11 @@ function Ai({
15093
15130
  /* @__PURE__ */ u.jsx("span", { className: "text-sm font-medium text-blue-800", children: "Editing message" })
15094
15131
  ] }),
15095
15132
  /* @__PURE__ */ u.jsx(
15096
- ot,
15133
+ st,
15097
15134
  {
15098
15135
  variant: "ghost",
15099
15136
  size: "sm",
15100
- onClick: Ge,
15137
+ onClick: Je,
15101
15138
  className: "text-blue-600 hover:bg-blue-100",
15102
15139
  children: /* @__PURE__ */ u.jsx(vr, { size: 16 })
15103
15140
  }
@@ -15111,16 +15148,16 @@ function Ai({
15111
15148
  ref: Dn,
15112
15149
  type: "file",
15113
15150
  multiple: !0,
15114
- onChange: (G) => $e(G),
15151
+ onChange: (G) => ze(G),
15115
15152
  className: "hidden"
15116
15153
  },
15117
- ze
15154
+ Be
15118
15155
  ),
15119
15156
  ke.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "flex flex-wrap gap-2", children: ke.map((G, oe) => /* @__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: [
15120
15157
  /* @__PURE__ */ u.jsx(ji, { size: 14 }),
15121
15158
  /* @__PURE__ */ u.jsx("span", { className: "truncate max-w-[150px]", children: G.name }),
15122
15159
  /* @__PURE__ */ u.jsx(
15123
- ot,
15160
+ st,
15124
15161
  {
15125
15162
  variant: "ghost",
15126
15163
  size: "sm",
@@ -15142,26 +15179,26 @@ function Ai({
15142
15179
  onChange: bt,
15143
15180
  className: "hidden"
15144
15181
  },
15145
- Ue
15182
+ We
15146
15183
  ),
15147
- qe && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
15184
+ Ge && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
15148
15185
  /* @__PURE__ */ u.jsx(zr, { className: "h-4 w-4 animate-spin" }),
15149
15186
  " Uploading Excel file..."
15150
15187
  ] }),
15151
- St && !qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: St }),
15152
- Xe && !qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: Xe })
15188
+ St && !Ge && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: St }),
15189
+ Qe && !Ge && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: Qe })
15153
15190
  ] })
15154
15191
  ] }),
15155
15192
  Y && /* @__PURE__ */ u.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: Y }),
15156
15193
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-end gap-2", children: [
15157
15194
  (a || l) && /* @__PURE__ */ u.jsxs(Qb, { children: [
15158
15195
  /* @__PURE__ */ u.jsx(e0, { asChild: !0, children: /* @__PURE__ */ u.jsx(
15159
- ot,
15196
+ st,
15160
15197
  {
15161
15198
  type: "button",
15162
15199
  size: "icon",
15163
15200
  variant: "outline",
15164
- disabled: F || q,
15201
+ disabled: F || U,
15165
15202
  title: "More input actions",
15166
15203
  className: f.moreButton || "",
15167
15204
  children: /* @__PURE__ */ u.jsx(vm, { size: 16 })
@@ -15180,9 +15217,9 @@ function Ai({
15180
15217
  {
15181
15218
  onClick: () => {
15182
15219
  var G;
15183
- qe || (G = Jn.current) == null || G.click();
15220
+ Ge || (G = Jn.current) == null || G.click();
15184
15221
  },
15185
- className: `cursor-pointer ${qe ? "opacity-60 pointer-events-none" : ""}`,
15222
+ className: `cursor-pointer ${Ge ? "opacity-60 pointer-events-none" : ""}`,
15186
15223
  children: [
15187
15224
  /* @__PURE__ */ u.jsx(wm, { className: "h-4 w-4 mr-2" }),
15188
15225
  " Upload Excel file"
@@ -15196,14 +15233,14 @@ function Ai({
15196
15233
  {
15197
15234
  initialValue: te,
15198
15235
  editingMessageId: P,
15199
- value: ut,
15236
+ value: je,
15200
15237
  onValueChange: ti,
15201
15238
  placeholder: P ? "Edit your message..." : t,
15202
15239
  isStreaming: F,
15203
- disabled: q,
15240
+ disabled: U,
15204
15241
  maxLength: Wo,
15205
15242
  onSend: ie,
15206
- onCancelEdit: Ge,
15243
+ onCancelEdit: Je,
15207
15244
  onStop: B,
15208
15245
  allowEmptySend: ke.length > 0,
15209
15246
  textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${P ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${Y ? "border-red-400" : ""} ${f.textarea || ""}`
@@ -15242,7 +15279,7 @@ var rl = "ScrollArea", [Dp, vk] = Mn(rl), [PC, un] = Dp(rl), Lp = v.forwardRef(
15242
15279
  dir: o,
15243
15280
  scrollHideDelay: s = 600,
15244
15281
  ...i
15245
- } = e, [a, l] = v.useState(null), [c, d] = v.useState(null), [f, p] = v.useState(null), [h, m] = v.useState(null), [x, y] = v.useState(null), [g, w] = v.useState(0), [b, T] = v.useState(0), [C, S] = v.useState(!1), [k, N] = v.useState(!1), E = Ve(t, (O) => l(O)), I = Rs(o);
15282
+ } = e, [a, l] = v.useState(null), [c, d] = v.useState(null), [f, p] = v.useState(null), [h, m] = v.useState(null), [x, y] = v.useState(null), [g, w] = v.useState(0), [b, T] = v.useState(0), [C, S] = v.useState(!1), [k, N] = v.useState(!1), E = Ke(t, (O) => l(O)), I = Rs(o);
15246
15283
  return /* @__PURE__ */ u.jsx(
15247
15284
  PC,
15248
15285
  {
@@ -15287,7 +15324,7 @@ var rl = "ScrollArea", [Dp, vk] = Mn(rl), [PC, un] = Dp(rl), Lp = v.forwardRef(
15287
15324
  Lp.displayName = rl;
15288
15325
  var Fp = "ScrollAreaViewport", $p = v.forwardRef(
15289
15326
  (e, t) => {
15290
- const { __scopeScrollArea: n, children: r, nonce: o, ...s } = e, i = un(Fp, n), a = v.useRef(null), l = Ve(t, a, i.onViewportChange);
15327
+ const { __scopeScrollArea: n, children: r, nonce: o, ...s } = e, i = un(Fp, n), a = v.useRef(null), l = Ke(t, a, i.onViewportChange);
15291
15328
  return /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
15292
15329
  /* @__PURE__ */ u.jsx(
15293
15330
  "style",
@@ -15473,7 +15510,7 @@ var OC = v.forwardRef((e, t) => {
15473
15510
  }
15474
15511
  ) : null;
15475
15512
  }), DC = v.forwardRef((e, t) => {
15476
- const { sizes: n, onSizesChange: r, ...o } = e, s = un(In, e.__scopeScrollArea), [i, a] = v.useState(), l = v.useRef(null), c = Ve(t, l, s.onScrollbarXChange);
15513
+ const { sizes: n, onSizesChange: r, ...o } = e, s = un(In, e.__scopeScrollArea), [i, a] = v.useState(), l = v.useRef(null), c = Ke(t, l, s.onScrollbarXChange);
15477
15514
  return v.useEffect(() => {
15478
15515
  l.current && a(getComputedStyle(l.current));
15479
15516
  }, [l]), /* @__PURE__ */ u.jsx(
@@ -15512,7 +15549,7 @@ var OC = v.forwardRef((e, t) => {
15512
15549
  }
15513
15550
  );
15514
15551
  }), LC = v.forwardRef((e, t) => {
15515
- const { sizes: n, onSizesChange: r, ...o } = e, s = un(In, e.__scopeScrollArea), [i, a] = v.useState(), l = v.useRef(null), c = Ve(t, l, s.onScrollbarYChange);
15552
+ const { sizes: n, onSizesChange: r, ...o } = e, s = un(In, e.__scopeScrollArea), [i, a] = v.useState(), l = v.useRef(null), c = Ke(t, l, s.onScrollbarYChange);
15516
15553
  return v.useEffect(() => {
15517
15554
  l.current && a(getComputedStyle(l.current));
15518
15555
  }, [l]), /* @__PURE__ */ u.jsx(
@@ -15564,7 +15601,7 @@ var OC = v.forwardRef((e, t) => {
15564
15601
  onWheelScroll: d,
15565
15602
  onResize: f,
15566
15603
  ...p
15567
- } = e, h = un(In, n), [m, x] = v.useState(null), y = Ve(t, (E) => x(E)), g = v.useRef(null), w = v.useRef(""), b = h.viewport, T = r.content - r.viewport, C = Dt(d), S = Dt(l), k = Xs(f, 10);
15604
+ } = e, h = un(In, n), [m, x] = v.useState(null), y = Ke(t, (E) => x(E)), g = v.useRef(null), w = v.useRef(""), b = h.viewport, T = r.content - r.viewport, C = Dt(d), S = Dt(l), k = Xs(f, 10);
15568
15605
  function N(E) {
15569
15606
  if (g.current) {
15570
15607
  const I = E.clientX - g.current.left, O = E.clientY - g.current.top;
@@ -15612,7 +15649,7 @@ var OC = v.forwardRef((e, t) => {
15612
15649
  }
15613
15650
  ), $C = v.forwardRef(
15614
15651
  (e, t) => {
15615
- const { __scopeScrollArea: n, style: r, ...o } = e, s = un(hs, n), i = Bp(hs, n), { onThumbPositionChange: a } = i, l = Ve(
15652
+ const { __scopeScrollArea: n, style: r, ...o } = e, s = un(hs, n), i = Bp(hs, n), { onThumbPositionChange: a } = i, l = Ke(
15616
15653
  t,
15617
15654
  (f) => i.onThumbChange(f)
15618
15655
  ), c = v.useRef(void 0), d = Xs(() => {
@@ -15792,7 +15829,7 @@ function Kc({
15792
15829
  setCurrentThreadId: h,
15793
15830
  isLoading: m,
15794
15831
  actions: x
15795
- } = xa(), { loadThread: y } = ya(), { createThread: g, deleteThread: w, renameThread: b } = x, [T, C] = ge(Array.isArray(f) ? f : []), S = Je(T.length > 0), k = Je(null), N = Je(0), [E, I] = ge(null), [O, L] = ge(""), [F, j] = ge(!1);
15832
+ } = xa(), { loadThread: y } = ya(), { createThread: g, deleteThread: w, renameThread: b } = x, [T, C] = ge(Array.isArray(f) ? f : []), S = et(T.length > 0), k = et(null), N = et(0), [E, I] = ge(null), [O, L] = ge(""), [F, j] = ge(!1);
15796
15833
  Et(() => {
15797
15834
  const W = Array.isArray(f) ? f : [];
15798
15835
  if (W.length > 0) {
@@ -15806,13 +15843,13 @@ function Kc({
15806
15843
  "[data-radix-scroll-area-viewport]"
15807
15844
  );
15808
15845
  if (!W) return;
15809
- let ee = null, q = null;
15846
+ let ee = null, U = null;
15810
15847
  return ee = requestAnimationFrame(() => {
15811
- q = requestAnimationFrame(() => {
15848
+ U = requestAnimationFrame(() => {
15812
15849
  W.scrollTop = N.current;
15813
15850
  });
15814
15851
  }), () => {
15815
- ee !== null && cancelAnimationFrame(ee), q !== null && cancelAnimationFrame(q);
15852
+ ee !== null && cancelAnimationFrame(ee), U !== null && cancelAnimationFrame(U);
15816
15853
  };
15817
15854
  }, [T]);
15818
15855
  const $ = async (W) => {
@@ -15834,13 +15871,13 @@ function Kc({
15834
15871
  }, B = async (W, ee) => {
15835
15872
  if (ee.stopPropagation(), !!confirm("Delete this thread?")) {
15836
15873
  if (k.current) {
15837
- const q = k.current.querySelector("[data-radix-scroll-area-viewport]");
15838
- q && (N.current = q.scrollTop);
15874
+ const U = k.current.querySelector("[data-radix-scroll-area-viewport]");
15875
+ U && (N.current = U.scrollTop);
15839
15876
  }
15840
15877
  try {
15841
15878
  await w(W), d == null || d(W);
15842
- } catch (q) {
15843
- console.error("Failed to delete thread:", q);
15879
+ } catch (U) {
15880
+ console.error("Failed to delete thread:", U);
15844
15881
  }
15845
15882
  }
15846
15883
  }, D = (W, ee) => {
@@ -15870,7 +15907,7 @@ function Kc({
15870
15907
  };
15871
15908
  return /* @__PURE__ */ u.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
15872
15909
  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(
15873
- ot,
15910
+ st,
15874
15911
  {
15875
15912
  onClick: A,
15876
15913
  disabled: F || m,
@@ -15902,8 +15939,8 @@ function Kc({
15902
15939
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center justify-between", children: [
15903
15940
  /* @__PURE__ */ u.jsx("div", { className: "flex-1 min-w-0", children: E === W.threadId ? /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", onClick: (ee) => ee.stopPropagation(), children: [
15904
15941
  /* @__PURE__ */ u.jsx(ps, { value: O, onChange: (ee) => L(ee.target.value), onKeyDown: (ee) => J(ee, W.threadId), className: "h-6 text-sm", autoFocus: !0 }),
15905
- /* @__PURE__ */ u.jsx(ot, { variant: "ghost", size: "sm", onClick: () => M(W.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(ca, { size: 12 }) }),
15906
- /* @__PURE__ */ u.jsx(ot, { variant: "ghost", size: "sm", onClick: Z, className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(vr, { size: 12 }) })
15942
+ /* @__PURE__ */ u.jsx(st, { variant: "ghost", size: "sm", onClick: () => M(W.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(ca, { size: 12 }) }),
15943
+ /* @__PURE__ */ u.jsx(st, { variant: "ghost", size: "sm", onClick: Z, className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(vr, { size: 12 }) })
15907
15944
  ] }) : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
15908
15945
  /* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: Ee(W) }),
15909
15946
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
@@ -15912,9 +15949,9 @@ function Kc({
15912
15949
  ] })
15913
15950
  ] }) }),
15914
15951
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
15915
- r && E !== W.threadId && /* @__PURE__ */ u.jsx(ot, { variant: "ghost", size: "sm", onClick: (ee) => D(W, ee), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ u.jsx(Jc, { size: 12 }) }),
15952
+ r && E !== W.threadId && /* @__PURE__ */ u.jsx(st, { variant: "ghost", size: "sm", onClick: (ee) => D(W, ee), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ u.jsx(Jc, { size: 12 }) }),
15916
15953
  n && /* @__PURE__ */ u.jsx(
15917
- ot,
15954
+ st,
15918
15955
  {
15919
15956
  variant: "ghost",
15920
15957
  size: "sm",
@@ -16078,7 +16115,7 @@ var Js = "Switch", [ZC, Sk] = Mn(Js), [QC, eT] = ZC(Js), oh = v.forwardRef(
16078
16115
  onCheckedChange: c,
16079
16116
  form: d,
16080
16117
  ...f
16081
- } = e, [p, h] = v.useState(null), m = Ve(t, (b) => h(b)), x = v.useRef(!1), y = p ? d || !!p.closest("form") : !0, [g, w] = Rr({
16118
+ } = e, [p, h] = v.useState(null), m = Ke(t, (b) => h(b)), x = v.useRef(!1), y = p ? d || !!p.closest("form") : !0, [g, w] = Rr({
16082
16119
  prop: o,
16083
16120
  defaultProp: s ?? !1,
16084
16121
  onChange: c,
@@ -16144,7 +16181,7 @@ var tT = "SwitchBubbleInput", ah = v.forwardRef(
16144
16181
  bubbles: r = !0,
16145
16182
  ...o
16146
16183
  }, s) => {
16147
- const i = v.useRef(null), a = Ve(i, s), l = rh(n), c = Xu(t);
16184
+ const i = v.useRef(null), a = Ke(i, s), l = rh(n), c = Xu(t);
16148
16185
  return v.useEffect(() => {
16149
16186
  const d = i.current;
16150
16187
  if (!d) return;
@@ -16317,7 +16354,7 @@ var sT = [" ", "Enter", "ArrowUp", "ArrowDown"], iT = [" ", "Enter"], cr = "Sele
16317
16354
  dh.displayName = cr;
16318
16355
  var fh = "SelectTrigger", ph = v.forwardRef(
16319
16356
  (e, t) => {
16320
- const { __scopeSelect: n, disabled: r = !1, ...o } = e, s = ei(n), i = Yn(fh, n), a = i.disabled || r, l = Ve(t, i.onTriggerChange), c = Qs(n), d = v.useRef("touch"), [f, p, h] = Lh((x) => {
16357
+ const { __scopeSelect: n, disabled: r = !1, ...o } = e, s = ei(n), i = Yn(fh, n), a = i.disabled || r, l = Ke(t, i.onTriggerChange), c = Qs(n), d = v.useRef("touch"), [f, p, h] = Lh((x) => {
16321
16358
  const y = c().filter((b) => !b.disabled), g = y.find((b) => b.value === i.value), w = Fh(y, x, g);
16322
16359
  w !== void 0 && i.onValueChange(w.value);
16323
16360
  }), m = (x) => {
@@ -16361,7 +16398,7 @@ var fh = "SelectTrigger", ph = v.forwardRef(
16361
16398
  ph.displayName = fh;
16362
16399
  var hh = "SelectValue", mh = v.forwardRef(
16363
16400
  (e, t) => {
16364
- const { __scopeSelect: n, className: r, style: o, children: s, placeholder: i = "", ...a } = e, l = Yn(hh, n), { onValueNodeHasChildrenChange: c } = l, d = s !== void 0, f = Ve(t, l.onValueNodeChange);
16401
+ const { __scopeSelect: n, className: r, style: o, children: s, placeholder: i = "", ...a } = e, l = Yn(hh, n), { onValueNodeHasChildrenChange: c } = l, d = s !== void 0, f = Ke(t, l.onValueNodeChange);
16365
16402
  return Lt(() => {
16366
16403
  c(d);
16367
16404
  }, [c, d]), /* @__PURE__ */ u.jsx(
@@ -16423,16 +16460,16 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
16423
16460
  avoidCollisions: y,
16424
16461
  //
16425
16462
  ...g
16426
- } = e, w = Yn(ur, n), [b, T] = v.useState(null), [C, S] = v.useState(null), k = Ve(t, (q) => T(q)), [N, E] = v.useState(null), [I, O] = v.useState(
16463
+ } = e, w = Yn(ur, n), [b, T] = v.useState(null), [C, S] = v.useState(null), k = Ke(t, (U) => T(U)), [N, E] = v.useState(null), [I, O] = v.useState(
16427
16464
  null
16428
16465
  ), L = Qs(n), [F, j] = v.useState(!1), $ = v.useRef(!1);
16429
16466
  v.useEffect(() => {
16430
16467
  if (b) return Aa(b);
16431
16468
  }, [b]), ba();
16432
16469
  const A = v.useCallback(
16433
- (q) => {
16470
+ (U) => {
16434
16471
  const [P, ...H] = L().map((ne) => ne.ref.current), [te] = H.slice(-1), se = document.activeElement;
16435
- for (const ne of q)
16472
+ for (const ne of U)
16436
16473
  if (ne === se || (ne == null || ne.scrollIntoView({ block: "nearest" }), ne === P && C && (C.scrollTop = 0), ne === te && C && (C.scrollTop = C.scrollHeight), ne == null || ne.focus(), document.activeElement !== se)) return;
16437
16474
  },
16438
16475
  [L, C]
@@ -16446,39 +16483,39 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
16446
16483
  const { onOpenChange: D, triggerPointerDownPosRef: M } = w;
16447
16484
  v.useEffect(() => {
16448
16485
  if (b) {
16449
- let q = { x: 0, y: 0 };
16486
+ let U = { x: 0, y: 0 };
16450
16487
  const P = (te) => {
16451
16488
  var se, ne;
16452
- q = {
16489
+ U = {
16453
16490
  x: Math.abs(Math.round(te.pageX) - (((se = M.current) == null ? void 0 : se.x) ?? 0)),
16454
16491
  y: Math.abs(Math.round(te.pageY) - (((ne = M.current) == null ? void 0 : ne.y) ?? 0))
16455
16492
  };
16456
16493
  }, H = (te) => {
16457
- q.x <= 10 && q.y <= 10 ? te.preventDefault() : b.contains(te.target) || D(!1), document.removeEventListener("pointermove", P), M.current = null;
16494
+ U.x <= 10 && U.y <= 10 ? te.preventDefault() : b.contains(te.target) || D(!1), document.removeEventListener("pointermove", P), M.current = null;
16458
16495
  };
16459
16496
  return M.current !== null && (document.addEventListener("pointermove", P), document.addEventListener("pointerup", H, { capture: !0, once: !0 })), () => {
16460
16497
  document.removeEventListener("pointermove", P), document.removeEventListener("pointerup", H, { capture: !0 });
16461
16498
  };
16462
16499
  }
16463
16500
  }, [b, D, M]), v.useEffect(() => {
16464
- const q = () => D(!1);
16465
- return window.addEventListener("blur", q), window.addEventListener("resize", q), () => {
16466
- window.removeEventListener("blur", q), window.removeEventListener("resize", q);
16501
+ const U = () => D(!1);
16502
+ return window.addEventListener("blur", U), window.addEventListener("resize", U), () => {
16503
+ window.removeEventListener("blur", U), window.removeEventListener("resize", U);
16467
16504
  };
16468
16505
  }, [D]);
16469
- const [Z, J] = Lh((q) => {
16470
- const P = L().filter((se) => !se.disabled), H = P.find((se) => se.ref.current === document.activeElement), te = Fh(P, q, H);
16506
+ const [Z, J] = Lh((U) => {
16507
+ const P = L().filter((se) => !se.disabled), H = P.find((se) => se.ref.current === document.activeElement), te = Fh(P, U, H);
16471
16508
  te && setTimeout(() => te.ref.current.focus());
16472
16509
  }), pe = v.useCallback(
16473
- (q, P, H) => {
16510
+ (U, P, H) => {
16474
16511
  const te = !$.current && !H;
16475
- (w.value !== void 0 && w.value === P || te) && (E(q), te && ($.current = !0));
16512
+ (w.value !== void 0 && w.value === P || te) && (E(U), te && ($.current = !0));
16476
16513
  },
16477
16514
  [w.value]
16478
16515
  ), Re = v.useCallback(() => b == null ? void 0 : b.focus(), [b]), Ee = v.useCallback(
16479
- (q, P, H) => {
16516
+ (U, P, H) => {
16480
16517
  const te = !$.current && !H;
16481
- (w.value !== void 0 && w.value === P || te) && O(q);
16518
+ (w.value !== void 0 && w.value === P || te) && O(U);
16482
16519
  },
16483
16520
  [w.value]
16484
16521
  ), W = r === "popper" ? na : bh, ee = W === na ? {
@@ -16514,12 +16551,12 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
16514
16551
  {
16515
16552
  asChild: !0,
16516
16553
  trapped: w.open,
16517
- onMountAutoFocus: (q) => {
16518
- q.preventDefault();
16554
+ onMountAutoFocus: (U) => {
16555
+ U.preventDefault();
16519
16556
  },
16520
- onUnmountAutoFocus: fe(o, (q) => {
16557
+ onUnmountAutoFocus: fe(o, (U) => {
16521
16558
  var P;
16522
- (P = w.trigger) == null || P.focus({ preventScroll: !0 }), q.preventDefault();
16559
+ (P = w.trigger) == null || P.focus({ preventScroll: !0 }), U.preventDefault();
16523
16560
  }),
16524
16561
  children: /* @__PURE__ */ u.jsx(
16525
16562
  Es,
@@ -16528,7 +16565,7 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
16528
16565
  disableOutsidePointerEvents: !0,
16529
16566
  onEscapeKeyDown: s,
16530
16567
  onPointerDownOutside: i,
16531
- onFocusOutside: (q) => q.preventDefault(),
16568
+ onFocusOutside: (U) => U.preventDefault(),
16532
16569
  onDismiss: () => w.onOpenChange(!1),
16533
16570
  children: /* @__PURE__ */ u.jsx(
16534
16571
  W,
@@ -16537,7 +16574,7 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
16537
16574
  id: w.contentId,
16538
16575
  "data-state": w.open ? "open" : "closed",
16539
16576
  dir: w.dir,
16540
- onContextMenu: (q) => q.preventDefault(),
16577
+ onContextMenu: (U) => U.preventDefault(),
16541
16578
  ...g,
16542
16579
  ...ee,
16543
16580
  onPlaced: () => j(!0),
@@ -16550,15 +16587,15 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
16550
16587
  outline: "none",
16551
16588
  ...g.style
16552
16589
  },
16553
- onKeyDown: fe(g.onKeyDown, (q) => {
16554
- const P = q.ctrlKey || q.altKey || q.metaKey;
16555
- if (q.key === "Tab" && q.preventDefault(), !P && q.key.length === 1 && J(q.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(q.key)) {
16590
+ onKeyDown: fe(g.onKeyDown, (U) => {
16591
+ const P = U.ctrlKey || U.altKey || U.metaKey;
16592
+ if (U.key === "Tab" && U.preventDefault(), !P && U.key.length === 1 && J(U.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(U.key)) {
16556
16593
  let te = L().filter((se) => !se.disabled).map((se) => se.ref.current);
16557
- if (["ArrowUp", "End"].includes(q.key) && (te = te.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(q.key)) {
16558
- const se = q.target, ne = te.indexOf(se);
16594
+ if (["ArrowUp", "End"].includes(U.key) && (te = te.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(U.key)) {
16595
+ const se = U.target, ne = te.indexOf(se);
16559
16596
  te = te.slice(ne + 1);
16560
16597
  }
16561
- setTimeout(() => A(te)), q.preventDefault();
16598
+ setTimeout(() => A(te)), U.preventDefault();
16562
16599
  }
16563
16600
  })
16564
16601
  }
@@ -16573,11 +16610,11 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
16573
16610
  );
16574
16611
  wh.displayName = pT;
16575
16612
  var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
16576
- const { __scopeSelect: n, onPlaced: r, ...o } = e, s = Yn(ur, n), i = Xn(ur, n), [a, l] = v.useState(null), [c, d] = v.useState(null), f = Ve(t, (k) => d(k)), p = Qs(n), h = v.useRef(!1), m = v.useRef(!0), { viewport: x, selectedItem: y, selectedItemText: g, focusSelectedItem: w } = i, b = v.useCallback(() => {
16613
+ const { __scopeSelect: n, onPlaced: r, ...o } = e, s = Yn(ur, n), i = Xn(ur, n), [a, l] = v.useState(null), [c, d] = v.useState(null), f = Ke(t, (k) => d(k)), p = Qs(n), h = v.useRef(!1), m = v.useRef(!0), { viewport: x, selectedItem: y, selectedItemText: g, focusSelectedItem: w } = i, b = v.useCallback(() => {
16577
16614
  if (s.trigger && s.valueNode && a && c && x && y && g) {
16578
16615
  const k = s.trigger.getBoundingClientRect(), N = c.getBoundingClientRect(), E = s.valueNode.getBoundingClientRect(), I = g.getBoundingClientRect();
16579
16616
  if (s.dir !== "rtl") {
16580
- const se = I.left - N.left, ne = E.left - se, Oe = k.left - ne, Y = k.width + Oe, de = Math.max(Y, N.width), ke = window.innerWidth - dn, Ne = ta(ne, [
16617
+ const se = I.left - N.left, ne = E.left - se, Le = k.left - ne, Y = k.width + Le, de = Math.max(Y, N.width), ke = window.innerWidth - dn, Ne = ta(ne, [
16581
16618
  dn,
16582
16619
  // Prevents the content from going off the starting edge of the
16583
16620
  // viewport. It may still go off the ending edge, but this can be
@@ -16588,31 +16625,31 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
16588
16625
  ]);
16589
16626
  a.style.minWidth = Y + "px", a.style.left = Ne + "px";
16590
16627
  } else {
16591
- const se = N.right - I.right, ne = window.innerWidth - E.right - se, Oe = window.innerWidth - k.right - ne, Y = k.width + Oe, de = Math.max(Y, N.width), ke = window.innerWidth - dn, Ne = ta(ne, [
16628
+ const se = N.right - I.right, ne = window.innerWidth - E.right - se, Le = window.innerWidth - k.right - ne, Y = k.width + Le, de = Math.max(Y, N.width), ke = window.innerWidth - dn, Ne = ta(ne, [
16592
16629
  dn,
16593
16630
  Math.max(dn, ke - de)
16594
16631
  ]);
16595
16632
  a.style.minWidth = Y + "px", a.style.right = Ne + "px";
16596
16633
  }
16597
- const O = p(), L = window.innerHeight - dn * 2, F = x.scrollHeight, j = window.getComputedStyle(c), $ = parseInt(j.borderTopWidth, 10), A = parseInt(j.paddingTop, 10), B = parseInt(j.borderBottomWidth, 10), D = parseInt(j.paddingBottom, 10), M = $ + A + F + D + B, Z = Math.min(y.offsetHeight * 5, M), J = window.getComputedStyle(x), pe = parseInt(J.paddingTop, 10), Re = parseInt(J.paddingBottom, 10), Ee = k.top + k.height / 2 - dn, W = L - Ee, ee = y.offsetHeight / 2, q = y.offsetTop + ee, P = $ + A + q, H = M - P;
16634
+ const O = p(), L = window.innerHeight - dn * 2, F = x.scrollHeight, j = window.getComputedStyle(c), $ = parseInt(j.borderTopWidth, 10), A = parseInt(j.paddingTop, 10), B = parseInt(j.borderBottomWidth, 10), D = parseInt(j.paddingBottom, 10), M = $ + A + F + D + B, Z = Math.min(y.offsetHeight * 5, M), J = window.getComputedStyle(x), pe = parseInt(J.paddingTop, 10), Re = parseInt(J.paddingBottom, 10), Ee = k.top + k.height / 2 - dn, W = L - Ee, ee = y.offsetHeight / 2, U = y.offsetTop + ee, P = $ + A + U, H = M - P;
16598
16635
  if (P <= Ee) {
16599
16636
  const se = O.length > 0 && y === O[O.length - 1].ref.current;
16600
16637
  a.style.bottom = "0px";
16601
- const ne = c.clientHeight - x.offsetTop - x.offsetHeight, Oe = Math.max(
16638
+ const ne = c.clientHeight - x.offsetTop - x.offsetHeight, Le = Math.max(
16602
16639
  W,
16603
16640
  ee + // viewport might have padding bottom, include it to avoid a scrollable viewport
16604
16641
  (se ? Re : 0) + ne + B
16605
- ), Y = P + Oe;
16642
+ ), Y = P + Le;
16606
16643
  a.style.height = Y + "px";
16607
16644
  } else {
16608
16645
  const se = O.length > 0 && y === O[0].ref.current;
16609
16646
  a.style.top = "0px";
16610
- const Oe = Math.max(
16647
+ const Le = Math.max(
16611
16648
  Ee,
16612
16649
  $ + x.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
16613
16650
  (se ? pe : 0) + ee
16614
16651
  ) + H;
16615
- a.style.height = Oe + "px", x.scrollTop = P - Ee + x.offsetTop;
16652
+ a.style.height = Le + "px", x.scrollTop = P - Ee + x.offsetTop;
16616
16653
  }
16617
16654
  a.style.margin = `${dn}px 0`, a.style.minHeight = Z + "px", a.style.maxHeight = L + "px", r == null || r(), requestAnimationFrame(() => h.current = !0);
16618
16655
  }
@@ -16708,7 +16745,7 @@ var gT = "SelectPopperPosition", na = v.forwardRef((e, t) => {
16708
16745
  na.displayName = gT;
16709
16746
  var [xT, al] = Mr(ur, {}), ra = "SelectViewport", Sh = v.forwardRef(
16710
16747
  (e, t) => {
16711
- const { __scopeSelect: n, nonce: r, ...o } = e, s = Xn(ra, n), i = al(ra, n), a = Ve(t, s.onViewportChange), l = v.useRef(0);
16748
+ const { __scopeSelect: n, nonce: r, ...o } = e, s = Xn(ra, n), i = al(ra, n), a = Ke(t, s.onViewportChange), l = v.useRef(0);
16712
16749
  return /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
16713
16750
  /* @__PURE__ */ u.jsx(
16714
16751
  "style",
@@ -16781,7 +16818,7 @@ var gs = "SelectItem", [bT, Rh] = Mr(gs), Eh = v.forwardRef(
16781
16818
  disabled: o = !1,
16782
16819
  textValue: s,
16783
16820
  ...i
16784
- } = e, a = Yn(gs, n), l = Xn(gs, n), c = a.value === r, [d, f] = v.useState(s ?? ""), [p, h] = v.useState(!1), m = Ve(
16821
+ } = e, a = Yn(gs, n), l = Xn(gs, n), c = a.value === r, [d, f] = v.useState(s ?? ""), [p, h] = v.useState(!1), m = Ke(
16785
16822
  t,
16786
16823
  (w) => {
16787
16824
  var b;
@@ -16859,7 +16896,7 @@ var gs = "SelectItem", [bT, Rh] = Mr(gs), Eh = v.forwardRef(
16859
16896
  Eh.displayName = gs;
16860
16897
  var Hr = "SelectItemText", Ih = v.forwardRef(
16861
16898
  (e, t) => {
16862
- const { __scopeSelect: n, className: r, style: o, ...s } = e, i = Yn(Hr, n), a = Xn(Hr, n), l = Rh(Hr, n), c = uT(Hr, n), [d, f] = v.useState(null), p = Ve(
16899
+ const { __scopeSelect: n, className: r, style: o, ...s } = e, i = Yn(Hr, n), a = Xn(Hr, n), l = Rh(Hr, n), c = uT(Hr, n), [d, f] = v.useState(null), p = Ke(
16863
16900
  t,
16864
16901
  (g) => f(g),
16865
16902
  l.onItemTextChange,
@@ -16886,7 +16923,7 @@ var Nh = "SelectItemIndicator", Ah = v.forwardRef(
16886
16923
  );
16887
16924
  Ah.displayName = Nh;
16888
16925
  var oa = "SelectScrollUpButton", jh = v.forwardRef((e, t) => {
16889
- const n = Xn(oa, e.__scopeSelect), r = al(oa, e.__scopeSelect), [o, s] = v.useState(!1), i = Ve(t, r.onScrollButtonChange);
16926
+ const n = Xn(oa, e.__scopeSelect), r = al(oa, e.__scopeSelect), [o, s] = v.useState(!1), i = Ke(t, r.onScrollButtonChange);
16890
16927
  return Lt(() => {
16891
16928
  if (n.viewport && n.isPositioned) {
16892
16929
  let a = function() {
@@ -16910,7 +16947,7 @@ var oa = "SelectScrollUpButton", jh = v.forwardRef((e, t) => {
16910
16947
  });
16911
16948
  jh.displayName = oa;
16912
16949
  var sa = "SelectScrollDownButton", _h = v.forwardRef((e, t) => {
16913
- const n = Xn(sa, e.__scopeSelect), r = al(sa, e.__scopeSelect), [o, s] = v.useState(!1), i = Ve(t, r.onScrollButtonChange);
16950
+ const n = Xn(sa, e.__scopeSelect), r = al(sa, e.__scopeSelect), [o, s] = v.useState(!1), i = Ke(t, r.onScrollButtonChange);
16914
16951
  return Lt(() => {
16915
16952
  if (n.viewport && n.isPositioned) {
16916
16953
  let a = function() {
@@ -16976,7 +17013,7 @@ var ia = "SelectArrow", CT = v.forwardRef(
16976
17013
  CT.displayName = ia;
16977
17014
  var TT = "SelectBubbleInput", Mh = v.forwardRef(
16978
17015
  ({ __scopeSelect: e, value: t, ...n }, r) => {
16979
- const o = v.useRef(null), s = Ve(r, o), i = rh(t);
17016
+ const o = v.useRef(null), s = Ke(r, o), i = rh(t);
16980
17017
  return v.useEffect(() => {
16981
17018
  const a = o.current;
16982
17019
  if (!a) return;
@@ -17301,7 +17338,7 @@ function Tk({ settings: e, onSettingsChange: t, className: n = "" }) {
17301
17338
  }
17302
17339
  };
17303
17340
  return /* @__PURE__ */ u.jsxs(FT, { open: r, onOpenChange: o, children: [
17304
- /* @__PURE__ */ u.jsx($T, { asChild: !0, children: /* @__PURE__ */ u.jsxs(ot, { variant: "outline", size: "sm", className: n, children: [
17341
+ /* @__PURE__ */ u.jsx($T, { asChild: !0, children: /* @__PURE__ */ u.jsxs(st, { variant: "outline", size: "sm", className: n, children: [
17305
17342
  /* @__PURE__ */ u.jsx(km, { className: "h-4 w-4 mr-2" }),
17306
17343
  "Settings",
17307
17344
  c && /* @__PURE__ */ u.jsx(Zf, { variant: "destructive", className: "ml-2 h-4 w-4 p-0" })
@@ -17333,7 +17370,7 @@ function Tk({ settings: e, onSettingsChange: t, className: n = "" }) {
17333
17370
  placeholder: "http://localhost:8000/api"
17334
17371
  }
17335
17372
  ),
17336
- /* @__PURE__ */ u.jsx(ot, { variant: "outline", onClick: x, children: "Test" })
17373
+ /* @__PURE__ */ u.jsx(st, { variant: "outline", onClick: x, children: "Test" })
17337
17374
  ] })
17338
17375
  ] }),
17339
17376
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center justify-between", children: [
@@ -17367,7 +17404,7 @@ function Tk({ settings: e, onSettingsChange: t, className: n = "" }) {
17367
17404
  }
17368
17405
  ),
17369
17406
  /* @__PURE__ */ u.jsx(
17370
- ot,
17407
+ st,
17371
17408
  {
17372
17409
  variant: "outline",
17373
17410
  size: "icon",
@@ -17535,13 +17572,13 @@ function Tk({ settings: e, onSettingsChange: t, className: n = "" }) {
17535
17572
  ] })
17536
17573
  ] }),
17537
17574
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center justify-between pt-6 border-t", children: [
17538
- /* @__PURE__ */ u.jsxs(ot, { variant: "outline", onClick: h, children: [
17575
+ /* @__PURE__ */ u.jsxs(st, { variant: "outline", onClick: h, children: [
17539
17576
  /* @__PURE__ */ u.jsx(_i, { className: "h-4 w-4 mr-2" }),
17540
17577
  "Reset"
17541
17578
  ] }),
17542
17579
  /* @__PURE__ */ u.jsxs("div", { className: "flex gap-2", children: [
17543
- /* @__PURE__ */ u.jsx(ot, { variant: "outline", onClick: m, children: "Cancel" }),
17544
- /* @__PURE__ */ u.jsxs(ot, { onClick: p, disabled: !c, children: [
17580
+ /* @__PURE__ */ u.jsx(st, { variant: "outline", onClick: m, children: "Cancel" }),
17581
+ /* @__PURE__ */ u.jsxs(st, { onClick: p, disabled: !c, children: [
17545
17582
  /* @__PURE__ */ u.jsx(jm, { className: "h-4 w-4 mr-2" }),
17546
17583
  "Save Changes"
17547
17584
  ] })