teodor-new-chat-ui 4.3.335 → 4.3.336

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
@@ -57,14 +57,14 @@ function Em() {
57
57
  var g = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
58
58
  function w(k) {
59
59
  {
60
- for (var H = arguments.length, se = new Array(H > 1 ? H - 1 : 0), we = 1; we < H; we++)
61
- se[we - 1] = arguments[we];
60
+ for (var H = arguments.length, se = new Array(H > 1 ? H - 1 : 0), be = 1; be < H; be++)
61
+ se[be - 1] = arguments[be];
62
62
  b("error", k, se);
63
63
  }
64
64
  }
65
65
  function b(k, H, se) {
66
66
  {
67
- var we = g.ReactDebugCurrentFrame, Je = we.getStackAddendum();
67
+ var be = g.ReactDebugCurrentFrame, Je = be.getStackAddendum();
68
68
  Je !== "" && (H += "%s", se = se.concat([Je]));
69
69
  var it = se.map(function(Be) {
70
70
  return String(Be);
@@ -82,9 +82,9 @@ function Em() {
82
82
  k.$$typeof === _ || k.getModuleId !== void 0));
83
83
  }
84
84
  function P(k, H, se) {
85
- var we = k.displayName;
86
- if (we)
87
- return we;
85
+ var be = k.displayName;
86
+ if (be)
87
+ return be;
88
88
  var Je = H.displayName || H.name || "";
89
89
  return Je !== "" ? se + "(" + Je + ")" : se;
90
90
  }
@@ -123,8 +123,8 @@ function Em() {
123
123
  case l:
124
124
  return P(k, k.render, "ForwardRef");
125
125
  case f:
126
- var we = k.displayName || null;
127
- return we !== null ? we : $(k.type) || "Memo";
126
+ var be = k.displayName || null;
127
+ return be !== null ? be : $(k.type) || "Memo";
128
128
  case p: {
129
129
  var Je = k, it = Je._payload, Be = Je._init;
130
130
  try {
@@ -136,14 +136,14 @@ function Em() {
136
136
  }
137
137
  return null;
138
138
  }
139
- var E = Object.assign, F = 0, j, Z, B, A, W, G, oe;
139
+ var E = Object.assign, F = 0, j, Z, B, N, W, G, oe;
140
140
  function ve() {
141
141
  }
142
142
  ve.__reactDisabledLog = !0;
143
143
  function je() {
144
144
  {
145
145
  if (F === 0) {
146
- j = console.log, Z = console.info, B = console.warn, A = console.error, W = console.group, G = console.groupCollapsed, oe = console.groupEnd;
146
+ j = console.log, Z = console.info, B = console.warn, N = console.error, W = console.group, G = console.groupCollapsed, oe = console.groupEnd;
147
147
  var k = {
148
148
  configurable: !0,
149
149
  enumerable: !0,
@@ -182,7 +182,7 @@ function Em() {
182
182
  value: B
183
183
  }),
184
184
  error: E({}, k, {
185
- value: A
185
+ value: N
186
186
  }),
187
187
  group: E({}, k, {
188
188
  value: W
@@ -205,8 +205,8 @@ function Em() {
205
205
  try {
206
206
  throw Error();
207
207
  } catch (Je) {
208
- var we = Je.stack.trim().match(/\n( *(at )?)/);
209
- Y = we && we[1] || "";
208
+ var be = Je.stack.trim().match(/\n( *(at )?)/);
209
+ Y = be && be[1] || "";
210
210
  }
211
211
  return `
212
212
  ` + Y + k;
@@ -225,7 +225,7 @@ function Em() {
225
225
  if (se !== void 0)
226
226
  return se;
227
227
  }
228
- var we;
228
+ var be;
229
229
  V = !0;
230
230
  var Je = Error.prepareStackTrace;
231
231
  Error.prepareStackTrace = void 0;
@@ -244,14 +244,14 @@ function Em() {
244
244
  try {
245
245
  Reflect.construct(Be, []);
246
246
  } catch (Ge) {
247
- we = Ge;
247
+ be = Ge;
248
248
  }
249
249
  Reflect.construct(k, [], Be);
250
250
  } else {
251
251
  try {
252
252
  Be.call();
253
253
  } catch (Ge) {
254
- we = Ge;
254
+ be = Ge;
255
255
  }
256
256
  k.call(Be.prototype);
257
257
  }
@@ -259,14 +259,14 @@ function Em() {
259
259
  try {
260
260
  throw Error();
261
261
  } catch (Ge) {
262
- we = Ge;
262
+ be = Ge;
263
263
  }
264
264
  k();
265
265
  }
266
266
  } catch (Ge) {
267
- if (Ge && we && typeof Ge.stack == "string") {
267
+ if (Ge && be && typeof Ge.stack == "string") {
268
268
  for (var Fe = Ge.stack.split(`
269
- `), Et = we.stack.split(`
269
+ `), Et = be.stack.split(`
270
270
  `), xt = Fe.length - 1, wt = Et.length - 1; xt >= 1 && wt >= 0 && Fe[xt] !== Et[wt]; )
271
271
  wt--;
272
272
  for (; xt >= 1 && wt >= 0; xt--, wt--)
@@ -285,8 +285,8 @@ function Em() {
285
285
  } finally {
286
286
  V = !1, z.current = it, q(), Error.prepareStackTrace = Je;
287
287
  }
288
- var Se = k ? k.displayName || k.name : "", Ie = Se ? D(Se) : "";
289
- return typeof k == "function" && J.set(k, Ie), Ie;
288
+ var Ce = k ? k.displayName || k.name : "", ke = Ce ? D(Ce) : "";
289
+ return typeof k == "function" && J.set(k, ke), ke;
290
290
  }
291
291
  function Ne(k, H, se) {
292
292
  return re(k, !1);
@@ -315,7 +315,7 @@ function Em() {
315
315
  case f:
316
316
  return Oe(k.type, H, se);
317
317
  case p: {
318
- var we = k, Je = we._payload, it = we._init;
318
+ var be = k, Je = be._payload, it = be._init;
319
319
  try {
320
320
  return Oe(it(Je), H, se);
321
321
  } catch {
@@ -332,7 +332,7 @@ function Em() {
332
332
  } else
333
333
  tt.setExtraStackFrame(null);
334
334
  }
335
- function ie(k, H, se, we, Je) {
335
+ function ie(k, H, se, be, Je) {
336
336
  {
337
337
  var it = Function.call.bind(Ye);
338
338
  for (var Be in k)
@@ -340,14 +340,14 @@ function Em() {
340
340
  var Fe = void 0;
341
341
  try {
342
342
  if (typeof k[Be] != "function") {
343
- var Et = Error((we || "React class") + ": " + se + " type `" + Be + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof k[Be] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
343
+ var Et = Error((be || "React class") + ": " + se + " type `" + Be + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof k[Be] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
344
344
  throw Et.name = "Invariant Violation", Et;
345
345
  }
346
- Fe = k[Be](H, Be, we, se, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
346
+ Fe = k[Be](H, Be, be, se, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
347
  } catch (xt) {
348
348
  Fe = xt;
349
349
  }
350
- Fe && !(Fe instanceof Error) && (Xe(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", se, Be, typeof Fe), Xe(null)), Fe instanceof Error && !(Fe.message in qe) && (qe[Fe.message] = !0, Xe(Je), w("Failed %s type: %s", se, Fe.message), Xe(null));
350
+ Fe && !(Fe instanceof Error) && (Xe(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).", be || "React class", se, Be, typeof Fe), Xe(null)), Fe instanceof Error && !(Fe.message in qe) && (qe[Fe.message] = !0, Xe(Je), w("Failed %s type: %s", se, Fe.message), Xe(null));
351
351
  }
352
352
  }
353
353
  }
@@ -422,7 +422,7 @@ function Em() {
422
422
  });
423
423
  }
424
424
  }
425
- var Qe = function(k, H, se, we, Je, it, Be) {
425
+ var Qe = function(k, H, se, be, Je, it, Be) {
426
426
  var Fe = {
427
427
  // This tag allows us to uniquely identify this as a React Element
428
428
  $$typeof: t,
@@ -443,7 +443,7 @@ function Em() {
443
443
  configurable: !1,
444
444
  enumerable: !1,
445
445
  writable: !1,
446
- value: we
446
+ value: be
447
447
  }), Object.defineProperty(Fe, "_source", {
448
448
  configurable: !1,
449
449
  enumerable: !1,
@@ -451,7 +451,7 @@ function Em() {
451
451
  value: Je
452
452
  }), Object.freeze && (Object.freeze(Fe.props), Object.freeze(Fe)), Fe;
453
453
  };
454
- function et(k, H, se, we, Je) {
454
+ function et(k, H, se, be, Je) {
455
455
  {
456
456
  var it, Be = {}, Fe = null, Et = null;
457
457
  se !== void 0 && (_t(se), Fe = "" + se), jt(H) && (_t(H.key), Fe = "" + H.key), Lt(H) && (Et = H.ref, nt(H, Je));
@@ -466,7 +466,7 @@ function Em() {
466
466
  var wt = typeof k == "function" ? k.displayName || k.name || "Unknown" : k;
467
467
  Fe && Rt(Be, wt), Et && pn(Be, wt);
468
468
  }
469
- return Qe(k, Fe, Et, Je, we, vt.current, Be);
469
+ return Qe(k, Fe, Et, Je, be, vt.current, Be);
470
470
  }
471
471
  }
472
472
  var pt = g.ReactCurrentOwner, lt = g.ReactDebugCurrentFrame;
@@ -477,12 +477,12 @@ function Em() {
477
477
  } else
478
478
  lt.setExtraStackFrame(null);
479
479
  }
480
- var N;
481
- N = !1;
480
+ var A;
481
+ A = !1;
482
482
  function X(k) {
483
483
  return typeof k == "object" && k !== null && k.$$typeof === t;
484
484
  }
485
- function ne() {
485
+ function te() {
486
486
  {
487
487
  if (pt.current) {
488
488
  var k = $(pt.current.type);
@@ -497,10 +497,10 @@ Check the render method of \`` + k + "`.";
497
497
  function fe(k) {
498
498
  return "";
499
499
  }
500
- var Re = {};
501
- function be(k) {
500
+ var we = {};
501
+ function Se(k) {
502
502
  {
503
- var H = ne();
503
+ var H = te();
504
504
  if (!H) {
505
505
  var se = typeof k == "string" ? k : k.displayName || k.name;
506
506
  se && (H = `
@@ -515,12 +515,12 @@ Check the top-level render call using <` + se + ">.");
515
515
  if (!k._store || k._store.validated || k.key != null)
516
516
  return;
517
517
  k._store.validated = !0;
518
- var se = be(H);
519
- if (Re[se])
518
+ var se = Se(H);
519
+ if (we[se])
520
520
  return;
521
- Re[se] = !0;
522
- var we = "";
523
- k && k._owner && k._owner !== pt.current && (we = " It was passed a child from " + $(k._owner.type) + "."), K(k), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', se, we), K(null);
521
+ we[se] = !0;
522
+ var be = "";
523
+ k && k._owner && k._owner !== pt.current && (be = " It was passed a child from " + $(k._owner.type) + "."), K(k), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', se, be), K(null);
524
524
  }
525
525
  }
526
526
  function Me(k, H) {
@@ -529,8 +529,8 @@ Check the top-level render call using <` + se + ">.");
529
529
  return;
530
530
  if (Ue(k))
531
531
  for (var se = 0; se < k.length; se++) {
532
- var we = k[se];
533
- X(we) && ze(we, H);
532
+ var be = k[se];
533
+ X(be) && ze(be, H);
534
534
  }
535
535
  else if (X(k))
536
536
  k._store && (k._store.validated = !0);
@@ -557,10 +557,10 @@ Check the top-level render call using <` + se + ">.");
557
557
  else
558
558
  return;
559
559
  if (se) {
560
- var we = $(H);
561
- ie(se, k.props, "prop", we, k);
562
- } else if (H.PropTypes !== void 0 && !N) {
563
- N = !0;
560
+ var be = $(H);
561
+ ie(se, k.props, "prop", be, k);
562
+ } else if (H.PropTypes !== void 0 && !A) {
563
+ A = !0;
564
564
  var Je = $(H);
565
565
  w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Je || "Unknown");
566
566
  }
@@ -570,9 +570,9 @@ Check the top-level render call using <` + se + ">.");
570
570
  function Wt(k) {
571
571
  {
572
572
  for (var H = Object.keys(k.props), se = 0; se < H.length; se++) {
573
- var we = H[se];
574
- if (we !== "children" && we !== "key") {
575
- K(k), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", we), K(null);
573
+ var be = H[se];
574
+ if (be !== "children" && be !== "key") {
575
+ K(k), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", be), K(null);
576
576
  break;
577
577
  }
578
578
  }
@@ -580,14 +580,14 @@ Check the top-level render call using <` + se + ">.");
580
580
  }
581
581
  }
582
582
  var Tn = {};
583
- function Vn(k, H, se, we, Je, it) {
583
+ function Vn(k, H, se, be, Je, it) {
584
584
  {
585
585
  var Be = L(k);
586
586
  if (!Be) {
587
587
  var Fe = "";
588
588
  (k === void 0 || typeof k == "object" && k !== null && Object.keys(k).length === 0) && (Fe += " 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 Et = fe();
590
- Et ? Fe += Et : Fe += ne();
590
+ Et ? Fe += Et : Fe += te();
591
591
  var xt;
592
592
  k === null ? xt = "null" : Ue(k) ? xt = "array" : k !== void 0 && k.$$typeof === t ? (xt = "<" + ($(k.type) || "Unknown") + " />", Fe = " Did you accidentally export a JSX literal instead of a component?") : xt = typeof k, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", xt, Fe);
593
593
  }
@@ -597,10 +597,10 @@ Check the top-level render call using <` + se + ">.");
597
597
  if (Be) {
598
598
  var de = H.children;
599
599
  if (de !== void 0)
600
- if (we)
600
+ if (be)
601
601
  if (Ue(de)) {
602
- for (var Se = 0; Se < de.length; Se++)
603
- Me(de[Se], k);
602
+ for (var Ce = 0; Ce < de.length; Ce++)
603
+ Me(de[Ce], k);
604
604
  Object.freeze && Object.freeze(de);
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.");
@@ -608,17 +608,17 @@ Check the top-level render call using <` + se + ">.");
608
608
  Me(de, k);
609
609
  }
610
610
  if (Ye.call(H, "key")) {
611
- var Ie = $(k), Ge = Object.keys(H).filter(function(Gh) {
611
+ var ke = $(k), Ge = Object.keys(H).filter(function(Gh) {
612
612
  return Gh !== "key";
613
613
  }), jn = Ge.length > 0 ? "{key: someKey, " + Ge.join(": ..., ") + ": ...}" : "{key: someKey}";
614
- if (!Tn[Ie + jn]) {
614
+ if (!Tn[ke + jn]) {
615
615
  var Yt = Ge.length > 0 ? "{" + Ge.join(": ..., ") + ": ...}" : "{}";
616
616
  w(`A props object containing a "key" prop is being spread into JSX:
617
617
  let props = %s;
618
618
  <%s {...props} />
619
619
  React keys must be passed directly to JSX without using spread:
620
620
  let props = %s;
621
- <%s key={someKey} {...props} />`, jn, Ie, Yt, Ie), Tn[Ie + jn] = !0;
621
+ <%s key={someKey} {...props} />`, jn, ke, Yt, ke), Tn[ke + jn] = !0;
622
622
  }
623
623
  }
624
624
  return k === r ? Wt(wt) : Ee(wt), wt;
@@ -1901,8 +1901,8 @@ const au = (e) => {
1901
1901
  };
1902
1902
  $ = s && new n(m, Z);
1903
1903
  let B = await (s ? P($, L) : P(m, Z));
1904
- const A = d && (I === "stream" || I === "response");
1905
- if (d && (S || A && E)) {
1904
+ const N = d && (I === "stream" || I === "response");
1905
+ if (d && (S || N && E)) {
1906
1906
  const G = {};
1907
1907
  ["status", "statusText", "headers"].forEach((q) => {
1908
1908
  G[q] = B[q];
@@ -1920,7 +1920,7 @@ const au = (e) => {
1920
1920
  }
1921
1921
  I = I || "text";
1922
1922
  let W = await f[O.findKey(f, I) || "text"](B, x);
1923
- return !A && E && E(), await new Promise((G, oe) => {
1923
+ return !N && E && E(), await new Promise((G, oe) => {
1924
1924
  su(G, oe, {
1925
1925
  data: W,
1926
1926
  headers: Ht.from(B.headers),
@@ -3062,7 +3062,7 @@ function $x(e = {}) {
3062
3062
  b.current && (b.current.abort(), b.current = null), l(!0), d(null), e.autoAppendAssistant !== !1 && p(""), x(null), I.current = null, R.current = null, _.current = null;
3063
3063
  const Z = new AbortController();
3064
3064
  b.current = Z;
3065
- let B = null, A = null, W = !1;
3065
+ let B = null, N = null, W = !1;
3066
3066
  return C.current = {
3067
3067
  threadId: E.threadId ?? null,
3068
3068
  headers: {}
@@ -3089,8 +3089,8 @@ function $x(e = {}) {
3089
3089
  const et = window.__AUTH_TOKEN__, pt = ((oe = window.localStorage) == null ? void 0 : oe.getItem("authToken")) || null;
3090
3090
  let lt = null;
3091
3091
  try {
3092
- const N = (ve = window.localStorage) == null ? void 0 : ve.getItem("chat-settings");
3093
- N && (lt = ((je = JSON.parse(N)) == null ? void 0 : je.apiKey) || null);
3092
+ const A = (ve = window.localStorage) == null ? void 0 : ve.getItem("chat-settings");
3093
+ A && (lt = ((je = JSON.parse(A)) == null ? void 0 : je.apiKey) || null);
3094
3094
  } catch {
3095
3095
  }
3096
3096
  const K = et || pt || lt || null;
@@ -3133,7 +3133,7 @@ function $x(e = {}) {
3133
3133
  Qe == null ? void 0 : Qe.slice(0, 500)
3134
3134
  );
3135
3135
  const et = `stream ${st.status}${Qe ? ": " + Qe : ""}`;
3136
- throw (z = j == null ? void 0 : j.onConnectionError) == null || z.call(j, et), W = !0, B = "error", A = et, new Error(et);
3136
+ throw (z = j == null ? void 0 : j.onConnectionError) == null || z.call(j, et), W = !0, B = "error", N = et, new Error(et);
3137
3137
  }
3138
3138
  w(!0);
3139
3139
  const at = st.body.getReader(), _t = new TextDecoder();
@@ -3154,7 +3154,7 @@ function $x(e = {}) {
3154
3154
  var Qe;
3155
3155
  if (Date.now() - nt > 18e5) {
3156
3156
  const et = "Stream idle timeout";
3157
- d(et), B = "error", A = et, Z.abort(), (Qe = j == null ? void 0 : j.onError) == null || Qe.call(j, et);
3157
+ d(et), B = "error", N = et, Z.abort(), (Qe = j == null ? void 0 : j.onError) == null || Qe.call(j, et);
3158
3158
  }
3159
3159
  }, 5e3), pn = 1024 * 1024;
3160
3160
  try {
@@ -3163,78 +3163,78 @@ function $x(e = {}) {
3163
3163
  ...C.current,
3164
3164
  threadId: pt
3165
3165
  }), (Y = j == null ? void 0 : j.onOpen) == null || Y.call(j, { threadId: pt, created: lt }); ; ) {
3166
- const { value: K, done: N } = await at.read();
3167
- if (N) break;
3166
+ const { value: K, done: A } = await at.read();
3167
+ if (A) break;
3168
3168
  vt += _t.decode(K, { stream: !0 }), vt.length > pn && (vt = "", console.warn("Stream buffer reset: exceeded 1MB"));
3169
3169
  let X;
3170
3170
  for (; (X = vt.indexOf(`
3171
3171
 
3172
3172
  `)) >= 0; ) {
3173
- const ne = vt.slice(0, X);
3173
+ const te = vt.slice(0, X);
3174
3174
  vt = vt.slice(X + 2);
3175
- const fe = Bx(ne);
3175
+ const fe = Bx(te);
3176
3176
  if (!fe) continue;
3177
- let Re;
3177
+ let we;
3178
3178
  try {
3179
- Re = JSON.parse(fe);
3179
+ we = JSON.parse(fe);
3180
3180
  } catch {
3181
3181
  console.debug("[use-chat] malformed SSE:", fe.slice(0, 200));
3182
3182
  continue;
3183
3183
  }
3184
- const be = Fx(Re) ? Re.data : Re;
3184
+ const Se = Fx(we) ? we.data : we;
3185
3185
  nt = Date.now();
3186
- const ze = be.seq;
3186
+ const ze = Se.seq;
3187
3187
  if (ze !== void 0) {
3188
3188
  if (ze <= bt) {
3189
- console.debug("[use-chat] drop duplicate/out-of-order event", { seq: ze, lastProcessedSeq: bt, type: be.type });
3189
+ console.debug("[use-chat] drop duplicate/out-of-order event", { seq: ze, lastProcessedSeq: bt, type: Se.type });
3190
3190
  continue;
3191
3191
  }
3192
3192
  bt > 0 && ze > bt + 1 && ((D = j == null ? void 0 : j.onGap) == null || D.call(j, { from: bt, to: ze })), bt = ze, S.current = ze, y(ze);
3193
3193
  }
3194
3194
  if (console.debug("[use-chat] received event", {
3195
- seq: be.seq,
3196
- type: be.type,
3195
+ seq: Se.seq,
3196
+ type: Se.type,
3197
3197
  preview: (() => {
3198
3198
  var Me;
3199
3199
  try {
3200
- return be.type === "message_delta" ? { deltaTypes: (Me = be.delta) == null ? void 0 : Me.map((Ee) => Ee.type), textLen: (be.delta || []).filter((Ee) => Ee.type === "text").map((Ee) => String(Ee.text || "").length) } : be.content || be.delta ? { hasContent: !0 } : {};
3200
+ return Se.type === "message_delta" ? { deltaTypes: (Me = Se.delta) == null ? void 0 : Me.map((Ee) => Ee.type), textLen: (Se.delta || []).filter((Ee) => Ee.type === "text").map((Ee) => String(Ee.text || "").length) } : Se.content || Se.delta ? { hasContent: !0 } : {};
3201
3201
  } catch (Ee) {
3202
3202
  return { err: String(Ee) };
3203
3203
  }
3204
3204
  })()
3205
- }), be.type === "checkpoint")
3206
- I.current = be.checkpointId ?? null, R.current = be.checkpointNs ?? null, x(be.checkpointId ?? null);
3207
- else if (be.type === "state_history") {
3208
- _.current = be;
3205
+ }), Se.type === "checkpoint")
3206
+ I.current = Se.checkpointId ?? null, R.current = Se.checkpointNs ?? null, x(Se.checkpointId ?? null);
3207
+ else if (Se.type === "state_history") {
3208
+ _.current = Se;
3209
3209
  try {
3210
- const Ee = hr(be).latest;
3210
+ const Ee = hr(Se).latest;
3211
3211
  Ee && (I.current = Ee.checkpointId ?? null, R.current = Ee.checkpointNs ?? null, x(Ee.checkpointId ?? null));
3212
3212
  } catch (Me) {
3213
3213
  console.warn("[use-chat] Failed to hydrate state_history payload", Me);
3214
3214
  }
3215
3215
  }
3216
3216
  try {
3217
- F == null || F(be);
3217
+ F == null || F(Se);
3218
3218
  } catch (Me) {
3219
- console.error("[use-chat] Error in onEvent callback:", Me, "for event:", be.type);
3219
+ console.error("[use-chat] Error in onEvent callback:", Me, "for event:", Se.type);
3220
3220
  }
3221
- if (be.type === "token" && e.autoAppendAssistant !== !1)
3222
- gt.push(be.content), jt();
3223
- else if (be.type === "message_delta") {
3224
- const Me = be.delta.filter((Ee) => Ee.type === "text").map((Ee) => Ee.text).join("");
3221
+ if (Se.type === "token" && e.autoAppendAssistant !== !1)
3222
+ gt.push(Se.content), jt();
3223
+ else if (Se.type === "message_delta") {
3224
+ const Me = Se.delta.filter((Ee) => Ee.type === "text").map((Ee) => Ee.text).join("");
3225
3225
  Me && e.autoAppendAssistant !== !1 && (gt.push(Me), jt());
3226
- } else if (be.type === "heartbeat") {
3226
+ } else if (Se.type === "heartbeat") {
3227
3227
  console.debug("[use-chat] heartbeat received");
3228
3228
  try {
3229
- (V = j == null ? void 0 : j.onHeartbeat) == null || V.call(j, be);
3229
+ (V = j == null ? void 0 : j.onHeartbeat) == null || V.call(j, Se);
3230
3230
  } catch (Me) {
3231
3231
  console.warn("[use-chat] heartbeat callback failed", Me);
3232
3232
  }
3233
- } else if (Tt !== null && cancelAnimationFrame(Tt), Lt(), be.type === "checkpoint")
3234
- x(be.checkpointId);
3235
- else if (be.type === "error") {
3236
- const Me = be;
3237
- if (d(Me.message), B = "error", A = Me.message, Me.error_type === "auth_error" || Me.code === "TOKEN_EXPIRED" || ((J = Me.message) == null ? void 0 : J.includes("token")) || ((ae = Me.message) == null ? void 0 : ae.includes("401")) || ((re = Me.message) == null ? void 0 : re.includes("unauthorized")) || ((Ne = Me.message) == null ? void 0 : Ne.includes("Unauthorized"))) {
3233
+ } else if (Tt !== null && cancelAnimationFrame(Tt), Lt(), Se.type === "checkpoint")
3234
+ x(Se.checkpointId);
3235
+ else if (Se.type === "error") {
3236
+ const Me = Se;
3237
+ if (d(Me.message), B = "error", N = Me.message, Me.error_type === "auth_error" || Me.code === "TOKEN_EXPIRED" || ((J = Me.message) == null ? void 0 : J.includes("token")) || ((ae = Me.message) == null ? void 0 : ae.includes("401")) || ((re = Me.message) == null ? void 0 : re.includes("unauthorized")) || ((Ne = Me.message) == null ? void 0 : Ne.includes("Unauthorized"))) {
3238
3238
  console.error("[use-chat] Auth error detected:", Me.message);
3239
3239
  try {
3240
3240
  (He = j == null ? void 0 : j.onAuthError) == null || He.call(j, Me.message);
@@ -3252,7 +3252,7 @@ function $x(e = {}) {
3252
3252
  B = B ?? "aborted";
3253
3253
  else {
3254
3254
  const et = Qe.message || String(Qe);
3255
- B = "error", A = et, d(et), (Oe = j == null ? void 0 : j.onError) == null || Oe.call(j, et);
3255
+ B = "error", N = et, d(et), (Oe = j == null ? void 0 : j.onError) == null || Oe.call(j, et);
3256
3256
  }
3257
3257
  } finally {
3258
3258
  try {
@@ -3268,10 +3268,10 @@ function $x(e = {}) {
3268
3268
  B = B ?? "aborted";
3269
3269
  else {
3270
3270
  const xe = ie.message || String(ie);
3271
- B = "error", A = xe, d(xe), (qe = j == null ? void 0 : j.onError) == null || qe.call(j, xe), W || ((tt = j == null ? void 0 : j.onConnectionError) == null || tt.call(j, xe), W = !0);
3271
+ B = "error", N = xe, d(xe), (qe = j == null ? void 0 : j.onError) == null || qe.call(j, xe), W || ((tt = j == null ? void 0 : j.onConnectionError) == null || tt.call(j, xe), W = !0);
3272
3272
  }
3273
3273
  } finally {
3274
- const ie = S.current, xe = I.current, Ue = R.current, We = _.current, st = B ?? (Z.signal.aborted ? "aborted" : A ? "error" : "complete");
3274
+ const ie = S.current, xe = I.current, Ue = R.current, We = _.current, st = B ?? (Z.signal.aborted ? "aborted" : N ? "error" : "complete");
3275
3275
  try {
3276
3276
  (Xe = j == null ? void 0 : j.onClosed) == null || Xe.call(j, {
3277
3277
  reason: st,
@@ -3279,7 +3279,7 @@ function $x(e = {}) {
3279
3279
  lastCheckpointId: xe,
3280
3280
  lastCheckpointNs: Ue,
3281
3281
  lastStateHistory: We,
3282
- error: A
3282
+ error: N
3283
3283
  });
3284
3284
  } catch (at) {
3285
3285
  console.warn("[use-chat] onClosed callback failed", at);
@@ -3780,11 +3780,11 @@ function Yx({
3780
3780
  var E, F, j, Z, B;
3781
3781
  const M = P.seq ?? null;
3782
3782
  if (M !== null) {
3783
- const A = d.current;
3784
- if (A !== null) {
3785
- if (M <= A)
3783
+ const N = d.current;
3784
+ if (N !== null) {
3785
+ if (M <= N)
3786
3786
  return;
3787
- M > A + 1 && (s == null || s({ from: A, to: M }));
3787
+ M > N + 1 && (s == null || s({ from: N, to: M }));
3788
3788
  }
3789
3789
  d.current = M;
3790
3790
  }
@@ -3792,25 +3792,25 @@ function Yx({
3792
3792
  f.current = P.threadId, h.current && (h.current.threadIdGuess = P.threadId), x.current = P, g(P.threadId), console.log("[useChatStreamingService] 🎯 Received thread_info event:", P);
3793
3793
  try {
3794
3794
  t(P);
3795
- } catch (A) {
3796
- console.error("[useChatStreamingService] Error in onThreadInfo handler:", A);
3795
+ } catch (N) {
3796
+ console.error("[useChatStreamingService] Error in onThreadInfo handler:", N);
3797
3797
  }
3798
3798
  return;
3799
3799
  }
3800
3800
  if (P.type === "heartbeat") {
3801
3801
  try {
3802
3802
  c == null || c(P);
3803
- } catch (A) {
3804
- console.error("[useChatStreamingService] Error in onHeartbeat handler:", A);
3803
+ } catch (N) {
3804
+ console.error("[useChatStreamingService] Error in onHeartbeat handler:", N);
3805
3805
  }
3806
3806
  return;
3807
3807
  }
3808
3808
  if (P.type === "error") {
3809
- const A = P;
3810
- if (A.error_type === "auth_error" || A.code === "TOKEN_EXPIRED" || ((E = A.message) == null ? void 0 : E.includes("token")) || ((F = A.message) == null ? void 0 : F.includes("401")) || ((j = A.message) == null ? void 0 : j.includes("unauthorized")) || ((Z = A.message) == null ? void 0 : Z.includes("Unauthorized"))) {
3811
- console.error("[useChatStreamingService] Auth error event detected:", A.message);
3809
+ const N = P;
3810
+ if (N.error_type === "auth_error" || N.code === "TOKEN_EXPIRED" || ((E = N.message) == null ? void 0 : E.includes("token")) || ((F = N.message) == null ? void 0 : F.includes("401")) || ((j = N.message) == null ? void 0 : j.includes("unauthorized")) || ((Z = N.message) == null ? void 0 : Z.includes("Unauthorized"))) {
3811
+ console.error("[useChatStreamingService] Auth error event detected:", N.message);
3812
3812
  try {
3813
- l == null || l(A.message);
3813
+ l == null || l(N.message);
3814
3814
  } catch (G) {
3815
3815
  console.warn("[useChatStreamingService] onAuthError handler failed", G);
3816
3816
  }
@@ -3821,23 +3821,23 @@ function Yx({
3821
3821
  f.current = $ ?? f.current;
3822
3822
  try {
3823
3823
  r == null || r(P);
3824
- } catch (A) {
3825
- console.error("[useChatStreamingService] onStateHistory handler failed", A);
3824
+ } catch (N) {
3825
+ console.error("[useChatStreamingService] onStateHistory handler failed", N);
3826
3826
  }
3827
3827
  }
3828
3828
  if (zx(P)) {
3829
3829
  P.type === "checkpoint" || P.type === "state_history" ? g($ ?? null) : y($ ?? null, P);
3830
3830
  try {
3831
3831
  n(P);
3832
- } catch (A) {
3833
- console.error("[useChatStreamingService] Error in onMessageEvent handler:", A);
3832
+ } catch (N) {
3833
+ console.error("[useChatStreamingService] Error in onMessageEvent handler:", N);
3834
3834
  }
3835
3835
  return;
3836
3836
  }
3837
3837
  try {
3838
3838
  o == null || o(P);
3839
- } catch (A) {
3840
- console.error("[useChatStreamingService] Error in onUnhandledEvent handler:", A);
3839
+ } catch (N) {
3840
+ console.error("[useChatStreamingService] Error in onUnhandledEvent handler:", N);
3841
3841
  }
3842
3842
  },
3843
3843
  [y, g, n, s, t, r, o]
@@ -3883,8 +3883,8 @@ function Yx({
3883
3883
  }
3884
3884
  },
3885
3885
  onClosed: ($) => {
3886
- var Z, B, A, W;
3887
- const E = ((Z = h.current) == null ? void 0 : Z.manualStop) ?? !1, F = f.current ?? ((B = h.current) == null ? void 0 : B.threadIdGuess) ?? ((A = $.lastStateHistory) == null ? void 0 : A.threadId) ?? null;
3886
+ var Z, B, N, W;
3887
+ const E = ((Z = h.current) == null ? void 0 : Z.manualStop) ?? !1, F = f.current ?? ((B = h.current) == null ? void 0 : B.threadIdGuess) ?? ((N = $.lastStateHistory) == null ? void 0 : N.threadId) ?? null;
3888
3888
  ($.reason === "complete" || $.reason === "aborted" && E) && g(F);
3889
3889
  const j = {
3890
3890
  ...$,
@@ -3945,7 +3945,7 @@ function Xx({
3945
3945
  onAuthError: i,
3946
3946
  onThreadChange: a
3947
3947
  }) {
3948
- const { api: l, baseUrl: c } = hu(), d = De(() => Rn(c), [c]), [f, p] = me([]), [h, x] = me(t), [m, y] = me(!1), [g, w] = me(null), [b, T] = me(!1), [S, C] = me(null), { state: I, seed: R, prepend: _, pushUser: L, onEvent: P } = Wx(), [M, $] = me(!1), [E, F] = me(!1), [j, Z] = me(null), [B, A] = me([]), [W, G] = me([]), [oe, ve] = me(!1), je = De(
3948
+ const { api: l, baseUrl: c } = hu(), d = De(() => Rn(c), [c]), [f, p] = me([]), [h, x] = me(t), [m, y] = me(!1), [g, w] = me(null), [b, T] = me(!1), [S, C] = me(null), { state: I, seed: R, prepend: _, pushUser: L, onEvent: P } = Wx(), [M, $] = me(!1), [E, F] = me(!1), [j, Z] = me(null), [B, N] = me([]), [W, G] = me([]), [oe, ve] = me(!1), je = De(
3949
3949
  () => B.flatMap((K) => K.messages ?? []),
3950
3950
  [B]
3951
3951
  ), q = De(() => Lx(je), [je]), z = Le(h), Y = Le(null), D = Le(null), V = Le(null), J = Le(null), ae = Le(!1), re = Le(null), Ne = Le(/* @__PURE__ */ new Map()), He = Le(/* @__PURE__ */ new Map());
@@ -3958,34 +3958,43 @@ function Xx({
3958
3958
  const K = await l.listThreads();
3959
3959
  p(K ?? []);
3960
3960
  } catch (K) {
3961
- const N = String(K);
3962
- w(N), s == null || s(N);
3961
+ const A = String(K);
3962
+ w(A), s == null || s(A);
3963
3963
  } finally {
3964
3964
  y(!1);
3965
3965
  }
3966
3966
  }, [l, s]), Ye = ge((K) => {
3967
3967
  if (!(K != null && K.threadId)) return;
3968
- const N = {
3968
+ const A = {
3969
3969
  threadId: K.threadId,
3970
3970
  title: K.title || `Thread ${K.threadId.slice(0, 8)}`,
3971
3971
  createdAt: K.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
3972
3972
  updatedAt: K.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
3973
3973
  messageCount: K.messageCount ?? 1
3974
3974
  };
3975
- p((X) => X.some((fe) => fe.threadId === N.threadId) ? (console.debug("[ChatSessionProvider] thread_info: thread already in list", N.threadId), X) : (console.debug("[ChatSessionProvider] thread_info: adding thread to list", N.threadId), [N, ...X]));
3975
+ p((X) => {
3976
+ let te = !1;
3977
+ const fe = X.map((we) => we.threadId === A.threadId ? (te = !0, console.debug("[ChatSessionProvider] thread_info: updating existing thread", A.threadId), {
3978
+ ...we,
3979
+ title: A.title ?? we.title,
3980
+ updatedAt: A.updatedAt ?? we.updatedAt,
3981
+ messageCount: A.messageCount ?? we.messageCount
3982
+ }) : we);
3983
+ return te ? fe : (console.debug("[ChatSessionProvider] thread_info: adding thread to list", A.threadId), [A, ...X]);
3984
+ });
3976
3985
  }, []), qe = ge(
3977
3986
  (K) => {
3978
- const N = K.threadId ?? z.current;
3979
- if (!N || z.current && z.current !== N)
3987
+ const A = K.threadId ?? z.current;
3988
+ if (!A || z.current && z.current !== A)
3980
3989
  return;
3981
- const { checkpoints: X, timeline: ne } = hr(K);
3990
+ const { checkpoints: X, timeline: te } = hr(K);
3982
3991
  if (!X.length)
3983
3992
  return;
3984
- const fe = X.find((Re) => Re.messages && Re.messages.length > 0) ?? X.find((Re) => !!Re.checkpointId) ?? X[0];
3993
+ const fe = X.find((we) => we.messages && we.messages.length > 0) ?? X.find((we) => !!we.checkpointId) ?? X[0];
3985
3994
  R((fe == null ? void 0 : fe.messages) ?? [], {
3986
3995
  checkpointId: (fe == null ? void 0 : fe.checkpointId) ?? null,
3987
3996
  checkpointNs: (fe == null ? void 0 : fe.checkpointNs) ?? null
3988
- }), G(ne), A(X), $(!!(fe != null && fe.nextCursor)), Z((fe == null ? void 0 : fe.nextCursor) ?? null), re.current = `${N}:latest`, D.current = null, V.current = null;
3997
+ }), G(te), N(X), $(!!(fe != null && fe.nextCursor)), Z((fe == null ? void 0 : fe.nextCursor) ?? null), re.current = `${A}:latest`, D.current = null, V.current = null;
3989
3998
  },
3990
3999
  [R]
3991
4000
  ), tt = ge((K) => {
@@ -4002,63 +4011,63 @@ function Xx({
4002
4011
  }), st = ge(
4003
4012
  async (K) => {
4004
4013
  try {
4005
- const N = await l.createThread(K);
4006
- return x(N.threadId), await Oe(), N.threadId;
4007
- } catch (N) {
4008
- return s == null || s(String(N)), null;
4014
+ const A = await l.createThread(K);
4015
+ return x(A.threadId), await Oe(), A.threadId;
4016
+ } catch (A) {
4017
+ return s == null || s(String(A)), null;
4009
4018
  }
4010
4019
  },
4011
4020
  [l, Oe, s]
4012
4021
  ), at = ge(
4013
4022
  async (K) => {
4014
- const N = f;
4015
- p((ne) => ne.filter((fe) => fe.threadId !== K));
4023
+ const A = f;
4024
+ p((te) => te.filter((fe) => fe.threadId !== K));
4016
4025
  const X = new AbortController();
4017
4026
  He.current.set(K, X);
4018
4027
  try {
4019
4028
  await l.deleteThread(K), z.current === K && (x(null), R([], {})), console.log("[ChatSessionProvider] Thread deleted successfully:", K);
4020
- } catch (ne) {
4021
- console.error("[ChatSessionProvider] Delete failed, restoring thread:", K, ne), p(N), s == null || s(`Failed to delete thread: ${String(ne)}`);
4029
+ } catch (te) {
4030
+ console.error("[ChatSessionProvider] Delete failed, restoring thread:", K, te), p(A), s == null || s(`Failed to delete thread: ${String(te)}`);
4022
4031
  } finally {
4023
4032
  He.current.delete(K);
4024
4033
  }
4025
4034
  },
4026
4035
  [f, l, R, s]
4027
4036
  ), _t = ge(
4028
- async (K, N) => {
4037
+ async (K, A) => {
4029
4038
  try {
4030
- await l.updateThread(K, N), await Oe();
4039
+ await l.updateThread(K, A), await Oe();
4031
4040
  } catch (X) {
4032
4041
  s == null || s(String(X));
4033
4042
  }
4034
4043
  },
4035
4044
  [l, Oe, s]
4036
4045
  ), vt = ge(
4037
- async (K, N) => {
4046
+ async (K, A) => {
4038
4047
  if (!K) return;
4039
- const X = `${K}:${N ?? "latest"}`, ne = Ne.current.get(X);
4040
- if (ne)
4041
- return ne;
4048
+ const X = `${K}:${A ?? "latest"}`, te = Ne.current.get(X);
4049
+ if (te)
4050
+ return te;
4042
4051
  const fe = (async () => {
4043
- const Re = K;
4052
+ const we = K;
4044
4053
  T(!0), C(null);
4045
4054
  try {
4046
- const be = await l.getStateHistory({
4047
- threadId: Re,
4048
- checkpointId: N || void 0
4055
+ const Se = await l.getStateHistory({
4056
+ threadId: we,
4057
+ checkpointId: A || void 0
4049
4058
  });
4050
- if (z.current !== Re) {
4051
- console.log(`[ChatSessionProvider] Thread changed during load (was ${Re}, now ${z.current}), discarding stale data`);
4059
+ if (z.current !== we) {
4060
+ console.log(`[ChatSessionProvider] Thread changed during load (was ${we}, now ${z.current}), discarding stale data`);
4052
4061
  return;
4053
4062
  }
4054
- const { checkpoints: ze, timeline: Me } = hr(be), Ee = ze.find((Wt) => Wt.messages && Wt.messages.length > 0) ?? (N ? ze.find((Wt) => Wt.checkpointId === N) : null) ?? ze[0];
4063
+ const { checkpoints: ze, timeline: Me } = hr(Se), Ee = ze.find((Wt) => Wt.messages && Wt.messages.length > 0) ?? (A ? ze.find((Wt) => Wt.checkpointId === A) : null) ?? ze[0];
4055
4064
  R((Ee == null ? void 0 : Ee.messages) ?? [], {
4056
4065
  checkpointId: (Ee == null ? void 0 : Ee.checkpointId) ?? null,
4057
4066
  checkpointNs: (Ee == null ? void 0 : Ee.checkpointNs) ?? null
4058
- }), G(Me), A(ze), $(!!(Ee != null && Ee.nextCursor)), Z((Ee == null ? void 0 : Ee.nextCursor) ?? null);
4059
- } catch (be) {
4060
- if (z.current === Re) {
4061
- const ze = String(be);
4067
+ }), G(Me), N(ze), $(!!(Ee != null && Ee.nextCursor)), Z((Ee == null ? void 0 : Ee.nextCursor) ?? null);
4068
+ } catch (Se) {
4069
+ if (z.current === we) {
4070
+ const ze = String(Se);
4062
4071
  C(ze), s == null || s(ze);
4063
4072
  }
4064
4073
  } finally {
@@ -4075,10 +4084,10 @@ function Xx({
4075
4084
  },
4076
4085
  [l, R, s]
4077
4086
  ), gt = ge(
4078
- async (K, N) => {
4087
+ async (K, A) => {
4079
4088
  J.current = K;
4080
4089
  try {
4081
- await vt(K, N);
4090
+ await vt(K, A);
4082
4091
  } finally {
4083
4092
  J.current === K && (J.current = null);
4084
4093
  }
@@ -4104,14 +4113,14 @@ function Xx({
4104
4113
  return;
4105
4114
  Y.current = h;
4106
4115
  const K = !ae.current && !!n && h === t;
4107
- let N;
4108
- K && n ? (N = n, ae.current = !0, console.log(
4116
+ let A;
4117
+ K && n ? (A = n, ae.current = !0, console.log(
4109
4118
  "[ChatSessionProvider] Loading thread with checkpoint:",
4110
- N,
4119
+ A,
4111
4120
  r ? `(ns: ${r})` : ""
4112
4121
  )) : console.log("[ChatSessionProvider] Loading thread with latest checkpoint");
4113
- const X = `${h}:${N ?? "latest"}`;
4114
- re.current !== X && gt(h, N);
4122
+ const X = `${h}:${A ?? "latest"}`;
4123
+ re.current !== X && gt(h, A);
4115
4124
  }, [
4116
4125
  o,
4117
4126
  h,
@@ -4123,44 +4132,44 @@ function Xx({
4123
4132
  gt
4124
4133
  ]);
4125
4134
  const bt = ge(
4126
- async (K, N) => {
4135
+ async (K, A) => {
4127
4136
  const X = z.current;
4128
4137
  if (!X) return;
4129
- const ne = X;
4138
+ const te = X;
4130
4139
  ve(!0);
4131
4140
  try {
4132
4141
  const fe = await l.getStateHistory({
4133
- threadId: ne,
4142
+ threadId: te,
4134
4143
  checkpointId: K,
4135
- checkpointNs: N ?? void 0
4144
+ checkpointNs: A ?? void 0
4136
4145
  });
4137
- if (z.current !== ne) {
4138
- console.log(`[ChatSessionProvider] Thread changed during checkpoint navigation (was ${ne}, now ${z.current}), discarding stale data`);
4146
+ if (z.current !== te) {
4147
+ console.log(`[ChatSessionProvider] Thread changed during checkpoint navigation (was ${te}, now ${z.current}), discarding stale data`);
4139
4148
  return;
4140
4149
  }
4141
- const { checkpoints: Re, timeline: be } = hr(fe), ze = Re.find(
4142
- (Me) => Me.checkpointId === K && (N ? Me.checkpointNs === N : !0)
4150
+ const { checkpoints: we, timeline: Se } = hr(fe), ze = we.find(
4151
+ (Me) => Me.checkpointId === K && (A ? Me.checkpointNs === A : !0)
4143
4152
  );
4144
4153
  if (!ze) {
4145
- console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: K, checkpointNs: N });
4154
+ console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: K, checkpointNs: A });
4146
4155
  return;
4147
4156
  }
4148
- G(be), A(Re), R(ze.messages ?? [], {
4157
+ G(Se), N(we), R(ze.messages ?? [], {
4149
4158
  checkpointId: ze.checkpointId ?? null,
4150
4159
  checkpointNs: ze.checkpointNs ?? null
4151
4160
  });
4152
4161
  } catch (fe) {
4153
- z.current === ne && (s == null || s(String(fe)));
4162
+ z.current === te && (s == null || s(String(fe)));
4154
4163
  } finally {
4155
4164
  ve(!1);
4156
4165
  }
4157
4166
  },
4158
4167
  [l, R, s]
4159
4168
  ), Tt = ge(
4160
- (K, N) => {
4169
+ (K, A) => {
4161
4170
  R(I.messages, {
4162
4171
  checkpointId: K ?? null,
4163
- checkpointNs: N ?? null
4172
+ checkpointNs: A ?? null
4164
4173
  });
4165
4174
  },
4166
4175
  [R, I.messages]
@@ -4171,46 +4180,46 @@ function Xx({
4171
4180
  const K = z.current;
4172
4181
  F(!0);
4173
4182
  try {
4174
- const N = await l.getStateHistory({
4183
+ const A = await l.getStateHistory({
4175
4184
  threadId: K,
4176
4185
  checkpointId: j
4177
4186
  });
4178
4187
  if (z.current !== K)
4179
4188
  return;
4180
- const { checkpoints: X } = hr(N);
4189
+ const { checkpoints: X } = hr(A);
4181
4190
  if (X.length > 0) {
4182
- const ne = X[X.length - 1];
4183
- _((ne == null ? void 0 : ne.messages) ?? []), $(!!(ne != null && ne.nextCursor)), Z((ne == null ? void 0 : ne.nextCursor) ?? null);
4191
+ const te = X[X.length - 1];
4192
+ _((te == null ? void 0 : te.messages) ?? []), $(!!(te != null && te.nextCursor)), Z((te == null ? void 0 : te.nextCursor) ?? null);
4184
4193
  }
4185
- } catch (N) {
4186
- z.current === K && (s == null || s(String(N)));
4194
+ } catch (A) {
4195
+ z.current === K && (s == null || s(String(A)));
4187
4196
  } finally {
4188
4197
  F(!1);
4189
4198
  }
4190
4199
  }, [l, j, _, s]), nt = ge(async () => {
4191
- R([], {}), x(null), ie(), A([]), G([]), $(!1), Z(null), T(!1), ve(!1), F(!1), C(null);
4200
+ R([], {}), x(null), ie(), N([]), G([]), $(!1), Z(null), T(!1), ve(!1), F(!1), C(null);
4192
4201
  try {
4193
4202
  await l.getAgent("default");
4194
4203
  } catch (K) {
4195
4204
  console.warn("[ChatSessionProvider] Failed to refetch agent after clearing thread:", K);
4196
4205
  }
4197
4206
  }, [R, ie, l]), Rt = ge(
4198
- async (K, N, X) => {
4199
- const ne = z.current;
4200
- if (!ne)
4207
+ async (K, A, X) => {
4208
+ const te = z.current;
4209
+ if (!te)
4201
4210
  throw new Error("No active thread to handle interrupt");
4202
- const fe = N ? X ?? !0 : !1;
4211
+ const fe = A ? X ?? !0 : !1;
4203
4212
  try {
4204
- const Re = {
4205
- threadId: ne,
4213
+ const we = {
4214
+ threadId: te,
4206
4215
  checkpointId: I.lastCheckpointId ?? void 0,
4207
4216
  checkpointNs: I.lastCheckpointNs ?? void 0,
4208
4217
  // The command is the key: backend extracts this and routes to LangGraph
4209
4218
  command: { kind: "resume", value: fe }
4210
4219
  };
4211
- Xe(Re);
4212
- } catch (Re) {
4213
- throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${K}:`, Re), Re;
4220
+ Xe(we);
4221
+ } catch (we) {
4222
+ throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${K}:`, we), we;
4214
4223
  }
4215
4224
  },
4216
4225
  [I.lastCheckpointId, I.lastCheckpointNs, Xe]
@@ -4221,25 +4230,25 @@ function Xx({
4221
4230
  a == null || a(h);
4222
4231
  }, [h, a]);
4223
4232
  const pn = ge(
4224
- async (K, N) => {
4233
+ async (K, A) => {
4225
4234
  let X = z.current;
4226
- const ne = (K == null ? void 0 : K.text) ?? "", fe = (K == null ? void 0 : K.attachments) ?? [], Re = (ne == null ? void 0 : ne.trim()) ?? "", be = { ...(K == null ? void 0 : K.payload) ?? {} }, ze = Array.isArray(be.messages) ? be.messages : void 0;
4227
- ze && delete be.messages;
4235
+ const te = (K == null ? void 0 : K.text) ?? "", fe = (K == null ? void 0 : K.attachments) ?? [], we = (te == null ? void 0 : te.trim()) ?? "", Se = { ...(K == null ? void 0 : K.payload) ?? {} }, ze = Array.isArray(Se.messages) ? Se.messages : void 0;
4236
+ ze && delete Se.messages;
4228
4237
  const Me = !!(ze && ze.length);
4229
- if (!X && !Re && fe.length === 0 && !Me) return;
4238
+ if (!X && !we && fe.length === 0 && !Me) return;
4230
4239
  if (!X) {
4231
- const se = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), we = Array.from(
4240
+ const se = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), be = Array.from(
4232
4241
  { length: 4 },
4233
4242
  () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")
4234
4243
  ).join("").slice(0, 16);
4235
- X = `${se}${we}`, D.current = X, x(X);
4244
+ X = `${se}${be}`, D.current = X, x(X);
4236
4245
  }
4237
4246
  const { contentParts: Ee, filesInfo: Wt } = await fx(
4238
4247
  l,
4239
4248
  fe
4240
4249
  ), Tn = [...Ee];
4241
- Re && Tn.push({ type: "text", text: ne });
4242
- const Vn = N == null ? void 0 : N.originalMessageId, ur = !!(N != null && N.edit && Vn), Pr = !Me && Tn.length > 0;
4250
+ we && Tn.push({ type: "text", text: te });
4251
+ const Vn = A == null ? void 0 : A.originalMessageId, ur = !!(A != null && A.edit && Vn), Pr = !Me && Tn.length > 0;
4243
4252
  let _n = null;
4244
4253
  Pr && (_n = {
4245
4254
  id: ur ? Vn : `msg-${Date.now()}`,
@@ -4248,16 +4257,16 @@ function Xx({
4248
4257
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4249
4258
  }, ur || L(_n));
4250
4259
  const Kn = Me ? ze : _n ? [_n] : [], k = {
4251
- ...be,
4260
+ ...Se,
4252
4261
  ...Wt.length ? { files_info: Wt } : {}
4253
4262
  };
4254
4263
  Kn.length ? k.messages = Kn : "messages" in k || (k.messages = []);
4255
4264
  const H = {
4256
4265
  threadId: X,
4257
4266
  payload: k,
4258
- checkpointId: (N == null ? void 0 : N.checkpointId) ?? I.lastCheckpointId ?? void 0,
4259
- checkpointNs: (N == null ? void 0 : N.checkpointNs) ?? I.lastCheckpointNs ?? void 0,
4260
- edit: !!(N != null && N.edit),
4267
+ checkpointId: (A == null ? void 0 : A.checkpointId) ?? I.lastCheckpointId ?? void 0,
4268
+ checkpointNs: (A == null ? void 0 : A.checkpointNs) ?? I.lastCheckpointNs ?? void 0,
4269
+ edit: !!(A != null && A.edit),
4261
4270
  timelineCheckpoints: W
4262
4271
  };
4263
4272
  Xe(H);
@@ -4382,7 +4391,7 @@ function oi({
4382
4391
  }
4383
4392
  ) });
4384
4393
  }
4385
- function te(...e) {
4394
+ function ne(...e) {
4386
4395
  return km(Im(e));
4387
4396
  }
4388
4397
  const Zx = ms(
@@ -4415,7 +4424,7 @@ const Zx = ms(
4415
4424
  return /* @__PURE__ */ u.jsx(
4416
4425
  i,
4417
4426
  {
4418
- className: te(Zx({ variant: t, size: n, className: e })),
4427
+ className: ne(Zx({ variant: t, size: n, className: e })),
4419
4428
  ref: s,
4420
4429
  ...o
4421
4430
  }
@@ -4427,7 +4436,7 @@ const Cu = v.forwardRef(
4427
4436
  ({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
4428
4437
  "textarea",
4429
4438
  {
4430
- className: te(
4439
+ className: ne(
4431
4440
  "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
4432
4441
  e
4433
4442
  ),
@@ -4480,7 +4489,7 @@ function Qx({
4480
4489
  id: Z,
4481
4490
  shouldClear: !0
4482
4491
  }, b(() => {
4483
- var B, A, W;
4492
+ var B, N, W;
4484
4493
  try {
4485
4494
  const G = l(j);
4486
4495
  G && typeof G.then == "function" ? G.then(() => {
@@ -4489,7 +4498,7 @@ function Qx({
4489
4498
  }).catch(() => {
4490
4499
  var oe;
4491
4500
  ((oe = C.current) == null ? void 0 : oe.id) === Z && (C.current = null);
4492
- }) : (((B = C.current) == null ? void 0 : B.id) === Z && C.current.shouldClear && (x || (y(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((A = C.current) == null ? void 0 : A.id) === Z && (C.current = null));
4501
+ }) : (((B = C.current) == null ? void 0 : B.id) === Z && C.current.shouldClear && (x || (y(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((N = C.current) == null ? void 0 : N.id) === Z && (C.current = null));
4493
4502
  } catch {
4494
4503
  ((W = C.current) == null ? void 0 : W.id) === Z && (C.current = null);
4495
4504
  }
@@ -5405,13 +5414,13 @@ const Ly = (e) => ({
5405
5414
  var $;
5406
5415
  const Z = ($ = L.filter((B) => {
5407
5416
  if (C) {
5408
- const A = xn(B.placement);
5409
- return A === w || // Create a bias to the `y` side axis due to horizontal
5417
+ const N = xn(B.placement);
5418
+ return N === w || // Create a bias to the `y` side axis due to horizontal
5410
5419
  // reading directions favoring greater width.
5411
- A === "y";
5420
+ N === "y";
5412
5421
  }
5413
5422
  return !0;
5414
- }).map((B) => [B.placement, B.overflows.filter((A) => A > 0).reduce((A, W) => A + W, 0)]).sort((B, A) => B[1] - A[1])[0]) == null ? void 0 : $[0];
5423
+ }).map((B) => [B.placement, B.overflows.filter((N) => N > 0).reduce((N, W) => N + W, 0)]).sort((B, N) => B[1] - N[1])[0]) == null ? void 0 : $[0];
5415
5424
  Z && (j = Z);
5416
5425
  break;
5417
5426
  }
@@ -6251,9 +6260,9 @@ function kv(e) {
6251
6260
  strategy: n,
6252
6261
  middleware: p
6253
6262
  };
6254
- P.current && (B.platform = P.current), Cv(C.current, I.current, B).then((A) => {
6263
+ P.current && (B.platform = P.current), Cv(C.current, I.current, B).then((N) => {
6255
6264
  const W = {
6256
- ...A,
6265
+ ...N,
6257
6266
  // The floating element's position may be recomputed while it's closed
6258
6267
  // but still mounted (such as when transitioning out). To ensure
6259
6268
  // `isPositioned` will be `false` initially on the next open, avoid
@@ -6297,16 +6306,16 @@ function kv(e) {
6297
6306
  };
6298
6307
  if (!j.floating)
6299
6308
  return B;
6300
- const A = Zl(j.floating, d.x), W = Zl(j.floating, d.y);
6309
+ const N = Zl(j.floating, d.x), W = Zl(j.floating, d.y);
6301
6310
  return a ? {
6302
6311
  ...B,
6303
- transform: "translate(" + A + "px, " + W + "px)",
6312
+ transform: "translate(" + N + "px, " + W + "px)",
6304
6313
  ...$u(j.floating) >= 1.5 && {
6305
6314
  willChange: "transform"
6306
6315
  }
6307
6316
  } : {
6308
6317
  position: n,
6309
- left: A,
6318
+ left: N,
6310
6319
  top: W
6311
6320
  };
6312
6321
  }, [n, a, j.floating, d.x, d.y]);
@@ -6468,7 +6477,7 @@ var ba = "PopperContent", [$v, Fv] = zu(ba), Ku = v.forwardRef(
6468
6477
  Hv({ arrowWidth: I, arrowHeight: R }),
6469
6478
  p && Pv({ strategy: "referenceHidden", ...$ })
6470
6479
  ]
6471
- }), [A, W] = Yu(j), G = At(x);
6480
+ }), [N, W] = Yu(j), G = At(x);
6472
6481
  Nt(() => {
6473
6482
  Z && (G == null || G());
6474
6483
  }, [Z, G]);
@@ -6503,7 +6512,7 @@ var ba = "PopperContent", [$v, Fv] = zu(ba), Ku = v.forwardRef(
6503
6512
  $v,
6504
6513
  {
6505
6514
  scope: n,
6506
- placedSide: A,
6515
+ placedSide: N,
6507
6516
  onArrowChange: S,
6508
6517
  arrowX: oe,
6509
6518
  arrowY: ve,
@@ -6511,7 +6520,7 @@ var ba = "PopperContent", [$v, Fv] = zu(ba), Ku = v.forwardRef(
6511
6520
  children: /* @__PURE__ */ u.jsx(
6512
6521
  Ae.div,
6513
6522
  {
6514
- "data-side": A,
6523
+ "data-side": N,
6515
6524
  "data-align": W,
6516
6525
  ...m,
6517
6526
  ref: b,
@@ -7469,17 +7478,17 @@ var en = "MenuContent", [eb, Ia] = sr(en), wd = v.forwardRef(
7469
7478
  onDismiss: h,
7470
7479
  disableOutsideScroll: x,
7471
7480
  ...m
7472
- } = e, y = ir(en, n), g = ho(en, n), w = Ps(n), b = gd(n), T = Gw(n), [S, C] = v.useState(null), I = v.useRef(null), R = Ke(t, I, y.onContentChange), _ = v.useRef(0), L = v.useRef(""), P = v.useRef(0), M = v.useRef(null), $ = v.useRef("right"), E = v.useRef(0), F = x ? js : v.Fragment, j = x ? { as: rb, allowPinchZoom: !0 } : void 0, Z = (A) => {
7481
+ } = e, y = ir(en, n), g = ho(en, n), w = Ps(n), b = gd(n), T = Gw(n), [S, C] = v.useState(null), I = v.useRef(null), R = Ke(t, I, y.onContentChange), _ = v.useRef(0), L = v.useRef(""), P = v.useRef(0), M = v.useRef(null), $ = v.useRef("right"), E = v.useRef(0), F = x ? js : v.Fragment, j = x ? { as: rb, allowPinchZoom: !0 } : void 0, Z = (N) => {
7473
7482
  var Y, D;
7474
- const W = L.current + A, G = T().filter((V) => !V.disabled), oe = document.activeElement, ve = (Y = G.find((V) => V.ref.current === oe)) == null ? void 0 : Y.textValue, je = G.map((V) => V.textValue), q = mb(je, W, ve), z = (D = G.find((V) => V.textValue === q)) == null ? void 0 : D.ref.current;
7483
+ const W = L.current + N, G = T().filter((V) => !V.disabled), oe = document.activeElement, ve = (Y = G.find((V) => V.ref.current === oe)) == null ? void 0 : Y.textValue, je = G.map((V) => V.textValue), q = mb(je, W, ve), z = (D = G.find((V) => V.textValue === q)) == null ? void 0 : D.ref.current;
7475
7484
  (function V(J) {
7476
7485
  L.current = J, window.clearTimeout(_.current), J !== "" && (_.current = window.setTimeout(() => V(""), 1e3));
7477
7486
  })(W), z && setTimeout(() => z.focus());
7478
7487
  };
7479
7488
  v.useEffect(() => () => window.clearTimeout(_.current), []), pa();
7480
- const B = v.useCallback((A) => {
7489
+ const B = v.useCallback((N) => {
7481
7490
  var G, oe;
7482
- return $.current === ((G = M.current) == null ? void 0 : G.side) && xb(A, (oe = M.current) == null ? void 0 : oe.area);
7491
+ return $.current === ((G = M.current) == null ? void 0 : G.side) && xb(N, (oe = M.current) == null ? void 0 : oe.area);
7483
7492
  }, []);
7484
7493
  return /* @__PURE__ */ u.jsx(
7485
7494
  eb,
@@ -7487,36 +7496,36 @@ var en = "MenuContent", [eb, Ia] = sr(en), wd = v.forwardRef(
7487
7496
  scope: n,
7488
7497
  searchRef: L,
7489
7498
  onItemEnter: v.useCallback(
7490
- (A) => {
7491
- B(A) && A.preventDefault();
7499
+ (N) => {
7500
+ B(N) && N.preventDefault();
7492
7501
  },
7493
7502
  [B]
7494
7503
  ),
7495
7504
  onItemLeave: v.useCallback(
7496
- (A) => {
7505
+ (N) => {
7497
7506
  var W;
7498
- B(A) || ((W = I.current) == null || W.focus(), C(null));
7507
+ B(N) || ((W = I.current) == null || W.focus(), C(null));
7499
7508
  },
7500
7509
  [B]
7501
7510
  ),
7502
7511
  onTriggerLeave: v.useCallback(
7503
- (A) => {
7504
- B(A) && A.preventDefault();
7512
+ (N) => {
7513
+ B(N) && N.preventDefault();
7505
7514
  },
7506
7515
  [B]
7507
7516
  ),
7508
7517
  pointerGraceTimerRef: P,
7509
- onPointerGraceIntentChange: v.useCallback((A) => {
7510
- M.current = A;
7518
+ onPointerGraceIntentChange: v.useCallback((N) => {
7519
+ M.current = N;
7511
7520
  }, []),
7512
7521
  children: /* @__PURE__ */ u.jsx(F, { ...j, children: /* @__PURE__ */ u.jsx(
7513
7522
  Ts,
7514
7523
  {
7515
7524
  asChild: !0,
7516
7525
  trapped: o,
7517
- onMountAutoFocus: ue(s, (A) => {
7526
+ onMountAutoFocus: ue(s, (N) => {
7518
7527
  var W;
7519
- A.preventDefault(), (W = I.current) == null || W.focus({ preventScroll: !0 });
7528
+ N.preventDefault(), (W = I.current) == null || W.focus({ preventScroll: !0 });
7520
7529
  }),
7521
7530
  onUnmountAutoFocus: i,
7522
7531
  children: /* @__PURE__ */ u.jsx(
@@ -7539,8 +7548,8 @@ var en = "MenuContent", [eb, Ia] = sr(en), wd = v.forwardRef(
7539
7548
  loop: r,
7540
7549
  currentTabStopId: S,
7541
7550
  onCurrentTabStopIdChange: C,
7542
- onEntryFocus: ue(l, (A) => {
7543
- g.isUsingKeyboardRef.current || A.preventDefault();
7551
+ onEntryFocus: ue(l, (N) => {
7552
+ g.isUsingKeyboardRef.current || N.preventDefault();
7544
7553
  }),
7545
7554
  preventScrollOnEntryFocus: !0,
7546
7555
  children: /* @__PURE__ */ u.jsx(
@@ -7555,25 +7564,25 @@ var en = "MenuContent", [eb, Ia] = sr(en), wd = v.forwardRef(
7555
7564
  ...m,
7556
7565
  ref: R,
7557
7566
  style: { outline: "none", ...m.style },
7558
- onKeyDown: ue(m.onKeyDown, (A) => {
7559
- const G = A.target.closest("[data-radix-menu-content]") === A.currentTarget, oe = A.ctrlKey || A.altKey || A.metaKey, ve = A.key.length === 1;
7560
- G && (A.key === "Tab" && A.preventDefault(), !oe && ve && Z(A.key));
7567
+ onKeyDown: ue(m.onKeyDown, (N) => {
7568
+ const G = N.target.closest("[data-radix-menu-content]") === N.currentTarget, oe = N.ctrlKey || N.altKey || N.metaKey, ve = N.key.length === 1;
7569
+ G && (N.key === "Tab" && N.preventDefault(), !oe && ve && Z(N.key));
7561
7570
  const je = I.current;
7562
- if (A.target !== je || !Vw.includes(A.key)) return;
7563
- A.preventDefault();
7571
+ if (N.target !== je || !Vw.includes(N.key)) return;
7572
+ N.preventDefault();
7564
7573
  const z = T().filter((Y) => !Y.disabled).map((Y) => Y.ref.current);
7565
- hd.includes(A.key) && z.reverse(), pb(z);
7574
+ hd.includes(N.key) && z.reverse(), pb(z);
7566
7575
  }),
7567
- onBlur: ue(e.onBlur, (A) => {
7568
- A.currentTarget.contains(A.target) || (window.clearTimeout(_.current), L.current = "");
7576
+ onBlur: ue(e.onBlur, (N) => {
7577
+ N.currentTarget.contains(N.target) || (window.clearTimeout(_.current), L.current = "");
7569
7578
  }),
7570
7579
  onPointerMove: ue(
7571
7580
  e.onPointerMove,
7572
- Jr((A) => {
7573
- const W = A.target, G = E.current !== A.clientX;
7574
- if (A.currentTarget.contains(W) && G) {
7575
- const oe = A.clientX > E.current ? "right" : "left";
7576
- $.current = oe, E.current = A.clientX;
7581
+ Jr((N) => {
7582
+ const W = N.target, G = E.current !== N.clientX;
7583
+ if (N.currentTarget.contains(W) && G) {
7584
+ const oe = N.clientX > E.current ? "right" : "left";
7585
+ $.current = oe, E.current = N.clientX;
7577
7586
  }
7578
7587
  })
7579
7588
  )
@@ -8107,7 +8116,7 @@ const Qb = Xb, e0 = Jb, t0 = v.forwardRef(({ className: e, inset: t, children: n
8107
8116
  sf,
8108
8117
  {
8109
8118
  ref: o,
8110
- className: te(
8119
+ className: ne(
8111
8120
  "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
8112
8121
  t && "pl-8",
8113
8122
  e
@@ -8124,7 +8133,7 @@ const n0 = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
8124
8133
  af,
8125
8134
  {
8126
8135
  ref: n,
8127
- className: te(
8136
+ className: ne(
8128
8137
  "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
8129
8138
  e
8130
8139
  ),
@@ -8137,7 +8146,7 @@ const lf = v.forwardRef(({ className: e, sideOffset: t = 4, ...n }, r) => /* @__
8137
8146
  {
8138
8147
  ref: r,
8139
8148
  sideOffset: t,
8140
- className: te(
8149
+ className: ne(
8141
8150
  "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
8142
8151
  e
8143
8152
  ),
@@ -8149,7 +8158,7 @@ const Bi = v.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */
8149
8158
  ef,
8150
8159
  {
8151
8160
  ref: r,
8152
- className: te(
8161
+ className: ne(
8153
8162
  "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
8154
8163
  t && "pl-8",
8155
8164
  e
@@ -8162,7 +8171,7 @@ const r0 = v.forwardRef(({ className: e, children: t, checked: n, ...r }, o) =>
8162
8171
  tf,
8163
8172
  {
8164
8173
  ref: o,
8165
- className: te(
8174
+ className: ne(
8166
8175
  "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
8167
8176
  e
8168
8177
  ),
@@ -8179,7 +8188,7 @@ const o0 = v.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
8179
8188
  nf,
8180
8189
  {
8181
8190
  ref: r,
8182
- className: te(
8191
+ className: ne(
8183
8192
  "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
8184
8193
  e
8185
8194
  ),
@@ -8195,7 +8204,7 @@ const s0 = v.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */
8195
8204
  Qd,
8196
8205
  {
8197
8206
  ref: r,
8198
- className: te(
8207
+ className: ne(
8199
8208
  "px-2 py-1.5 text-sm font-semibold",
8200
8209
  t && "pl-8",
8201
8210
  e
@@ -8208,7 +8217,7 @@ const i0 = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
8208
8217
  of,
8209
8218
  {
8210
8219
  ref: n,
8211
- className: te("-mx-1 my-1 h-px bg-muted", e),
8220
+ className: ne("-mx-1 my-1 h-px bg-muted", e),
8212
8221
  ...t
8213
8222
  }
8214
8223
  ));
@@ -8515,7 +8524,7 @@ function dt(e = df) {
8515
8524
  e(t, r) || (t = r, n(r));
8516
8525
  };
8517
8526
  }
8518
- function Te(e) {
8527
+ function Ie(e) {
8519
8528
  return (t) => (n) => {
8520
8529
  e(n) && t(n);
8521
8530
  };
@@ -8673,7 +8682,7 @@ function It(...e) {
8673
8682
  }
8674
8683
  };
8675
8684
  }
8676
- function Ce(e, t = df) {
8685
+ function Te(e, t = df) {
8677
8686
  return U(e, dt(t));
8678
8687
  }
8679
8688
  function zi(...e) {
@@ -9188,7 +9197,7 @@ const B0 = {
9188
9197
  pe(
9189
9198
  U(
9190
9199
  l,
9191
- Te((S) => S.length > 0),
9200
+ Ie((S) => S.length > 0),
9192
9201
  $e(m, h),
9193
9202
  le(([S, C, I]) => {
9194
9203
  const R = S.reduce((_, L, P) => Kt(_, L, to(L, C.offsetTree, I) || P), vr());
@@ -9204,7 +9213,7 @@ const B0 = {
9204
9213
  U(
9205
9214
  r,
9206
9215
  $e(m),
9207
- Te(([S, { lastIndex: C }]) => S < C),
9216
+ Ie(([S, { lastIndex: C }]) => S < C),
9208
9217
  le(([S, { lastIndex: C, lastSize: I }]) => [
9209
9218
  {
9210
9219
  endIndex: C,
@@ -9225,7 +9234,7 @@ const B0 = {
9225
9234
  pe(
9226
9235
  U(
9227
9236
  d,
9228
- Te((S) => S !== void 0 && ct(St(m).sizeTree)),
9237
+ Ie((S) => S !== void 0 && ct(St(m).sizeTree)),
9229
9238
  le((S) => [{ endIndex: 0, size: S, startIndex: 0 }])
9230
9239
  ),
9231
9240
  n
@@ -9431,7 +9440,7 @@ const Sf = Ze(
9431
9440
  ), pe(
9432
9441
  U(
9433
9442
  It(o, t, r),
9434
- Te(([l, c]) => Fs(c)),
9443
+ Ie(([l, c]) => Fs(c)),
9435
9444
  le(([l, c, d]) => un(c.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
9436
9445
  dt(),
9437
9446
  le((l) => [l])
@@ -9445,7 +9454,7 @@ const Sf = Ze(
9445
9454
  const t = ee(!1), n = Gt(
9446
9455
  U(
9447
9456
  t,
9448
- Te((r) => r),
9457
+ Ie((r) => r),
9449
9458
  dt()
9450
9459
  )
9451
9460
  );
@@ -9492,9 +9501,9 @@ const mo = Ze(
9492
9501
  $,
9493
9502
  E
9494
9503
  ]) => {
9495
- const F = Cf(T), { align: j, behavior: Z, offset: B } = F, A = I - 1, W = bf(F, S, A);
9504
+ const F = Cf(T), { align: j, behavior: Z, offset: B } = F, N = I - 1, W = bf(F, S, N);
9496
9505
  let G = to(W, S.offsetTree, M) + _;
9497
- j === "end" ? (G += $ + un(S.sizeTree, W)[1] - C + E, W === A && (G += L)) : j === "center" ? G += ($ + un(S.sizeTree, W)[1] - C + E) / 2 : G -= R, B && (G += B);
9506
+ j === "end" ? (G += $ + un(S.sizeTree, W)[1] - C + E, W === N && (G += L)) : j === "center" ? G += ($ + un(S.sizeTree, W)[1] - C + E) / 2 : G -= R, B && (G += B);
9498
9507
  const oe = (ve) => {
9499
9508
  b(), ve ? (P("retrying to scroll to", { location: T }, Ut.DEBUG), Pe(h, T)) : (Pe(x, !0), P("list did not change, scroll successful", {}, Ut.DEBUG));
9500
9509
  };
@@ -9549,7 +9558,7 @@ const go = Ze(
9549
9558
  U(
9550
9559
  i,
9551
9560
  $e(l),
9552
- Te(([d, f]) => !!f),
9561
+ Ie(([d, f]) => !!f),
9553
9562
  mn(!1)
9554
9563
  ),
9555
9564
  a
@@ -9557,7 +9566,7 @@ const go = Ze(
9557
9566
  U(
9558
9567
  i,
9559
9568
  $e(l),
9560
- Te(([d, f]) => !!f),
9569
+ Ie(([d, f]) => !!f),
9561
9570
  mn(!1)
9562
9571
  ),
9563
9572
  c
@@ -9565,7 +9574,7 @@ const go = Ze(
9565
9574
  U(
9566
9575
  It(t, i),
9567
9576
  $e(a, n, e, c),
9568
- Te(([[, d], f, { sizeTree: p }, h, x]) => d && (!ct(p) || Na(h)) && !f && !x),
9577
+ Ie(([[, d], f, { sizeTree: p }, h, x]) => d && (!ct(p) || Na(h)) && !f && !x),
9569
9578
  $e(l)
9570
9579
  ),
9571
9580
  ([, d]) => {
@@ -9601,7 +9610,7 @@ const no = "up", zr = "down", W0 = "none", V0 = {
9601
9610
  }, K0 = 0, xo = Ze(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
9602
9611
  const i = ee(!1), a = ee(!0), l = Ve(), c = Ve(), d = ee(4), f = ee(K0), p = Dt(
9603
9612
  U(
9604
- zi(U(Ce(o), tr(1), mn(!0)), U(Ce(o), tr(1), mn(!1), ac(100))),
9613
+ zi(U(Te(o), tr(1), mn(!0)), U(Te(o), tr(1), mn(!1), ac(100))),
9605
9614
  dt()
9606
9615
  ),
9607
9616
  !1
@@ -9611,7 +9620,7 @@ const no = "up", zr = "down", W0 = "none", V0 = {
9611
9620
  );
9612
9621
  pe(
9613
9622
  U(
9614
- It(Ce(o), Ce(f)),
9623
+ It(Te(o), Te(f)),
9615
9624
  le(([w, b]) => w <= b),
9616
9625
  dt()
9617
9626
  ),
@@ -9619,7 +9628,7 @@ const no = "up", zr = "down", W0 = "none", V0 = {
9619
9628
  ), pe(U(a, In(50)), c);
9620
9629
  const x = Gt(
9621
9630
  U(
9622
- It(r, Ce(s), Ce(t), Ce(e), Ce(d)),
9631
+ It(r, Te(s), Te(t), Te(e), Te(d)),
9623
9632
  yn((w, [{ scrollHeight: b, scrollTop: T }, S, C, I, R]) => {
9624
9633
  const _ = T + S - b > -R, L = {
9625
9634
  scrollHeight: b,
@@ -9673,7 +9682,7 @@ const no = "up", zr = "down", W0 = "none", V0 = {
9673
9682
  },
9674
9683
  { changed: !1, jump: 0, scrollHeight: 0, scrollTop: 0 }
9675
9684
  ),
9676
- Te((w) => w.changed),
9685
+ Ie((w) => w.changed),
9677
9686
  le((w) => w.jump)
9678
9687
  ),
9679
9688
  0
@@ -9703,7 +9712,7 @@ const no = "up", zr = "down", W0 = "none", V0 = {
9703
9712
  return pe(
9704
9713
  U(
9705
9714
  p,
9706
- Te((w) => !w),
9715
+ Ie((w) => !w),
9707
9716
  mn(0)
9708
9717
  ),
9709
9718
  g
@@ -9712,7 +9721,7 @@ const no = "up", zr = "down", W0 = "none", V0 = {
9712
9721
  o,
9713
9722
  In(100),
9714
9723
  $e(p),
9715
- Te(([w, b]) => !!b),
9724
+ Ie(([w, b]) => !!b),
9716
9725
  yn(([w, b], [T]) => [b, T], [0, 0]),
9717
9726
  le(([w, b]) => b - w)
9718
9727
  ),
@@ -9743,15 +9752,15 @@ const La = Ze(
9743
9752
  const s = Ve(), i = ee(0), a = ee(0), l = ee(0), c = Dt(
9744
9753
  U(
9745
9754
  It(
9746
- Ce(r),
9747
- Ce(o),
9748
- Ce(n),
9749
- Ce(s, eo),
9750
- Ce(l),
9751
- Ce(i),
9752
- Ce(t),
9753
- Ce(e),
9754
- Ce(a)
9755
+ Te(r),
9756
+ Te(o),
9757
+ Te(n),
9758
+ Te(s, eo),
9759
+ Te(l),
9760
+ Te(i),
9761
+ Te(t),
9762
+ Te(e),
9763
+ Te(a)
9755
9764
  ),
9756
9765
  le(
9757
9766
  ([
@@ -9774,7 +9783,7 @@ const La = Ze(
9774
9783
  ] : null;
9775
9784
  }
9776
9785
  ),
9777
- Te((d) => d != null),
9786
+ Ie((d) => d != null),
9778
9787
  dt(eo)
9779
9788
  ),
9780
9789
  [0, 0]
@@ -9894,17 +9903,17 @@ const lr = Ze(
9894
9903
  It(
9895
9904
  h,
9896
9905
  x,
9897
- Ce(l, eo),
9898
- Ce(o),
9899
- Ce(r),
9900
- Ce(c),
9906
+ Te(l, eo),
9907
+ Te(o),
9908
+ Te(r),
9909
+ Te(c),
9901
9910
  d,
9902
- Ce(m),
9903
- Ce(t),
9904
- Ce(n),
9911
+ Te(m),
9912
+ Te(t),
9913
+ Te(n),
9905
9914
  e
9906
9915
  ),
9907
- Te(([C, I, , R, , , , , , , _]) => {
9916
+ Ie(([C, I, , R, , , , , , , _]) => {
9908
9917
  const L = _ && _.length !== R;
9909
9918
  return C && !I && !L;
9910
9919
  }),
@@ -9922,13 +9931,13 @@ const lr = Ze(
9922
9931
  E,
9923
9932
  F
9924
9933
  ]) => {
9925
- const j = _, { offsetTree: Z, sizeTree: B } = j, A = St(y);
9934
+ const j = _, { offsetTree: Z, sizeTree: B } = j, N = St(y);
9926
9935
  if (R === 0)
9927
9936
  return { ...gi, totalCount: R };
9928
9937
  if (C === 0 && I === 0)
9929
- return A === 0 ? { ...gi, totalCount: R } : If(A, L, _, $, E, F || []);
9938
+ return N === 0 ? { ...gi, totalCount: R } : If(N, L, _, $, E, F || []);
9930
9939
  if (ct(B))
9931
- return A > 0 ? null : Ho(
9940
+ return N > 0 ? null : Ho(
9932
9941
  q0(Da(L, R), j, F),
9933
9942
  [],
9934
9943
  R,
@@ -9971,7 +9980,7 @@ const lr = Ze(
9971
9980
  }
9972
9981
  ),
9973
9982
  //@ts-expect-error filter needs to be fixed
9974
- Te((C) => C !== null),
9983
+ Ie((C) => C !== null),
9975
9984
  dt()
9976
9985
  ),
9977
9986
  gi
@@ -9979,7 +9988,7 @@ const lr = Ze(
9979
9988
  pe(
9980
9989
  U(
9981
9990
  e,
9982
- Te(Na),
9991
+ Ie(Na),
9983
9992
  le((C) => C == null ? void 0 : C.length)
9984
9993
  ),
9985
9994
  o
@@ -10005,9 +10014,9 @@ const lr = Ze(
10005
10014
  const b = Gt(
10006
10015
  U(
10007
10016
  w,
10008
- Te(({ items: C }) => C.length > 0),
10017
+ Ie(({ items: C }) => C.length > 0),
10009
10018
  $e(o, e),
10010
- Te(([{ items: C }, I]) => C[C.length - 1].originalIndex === I - 1),
10019
+ Ie(([{ items: C }, I]) => C[C.length - 1].originalIndex === I - 1),
10011
10020
  le(([, C, I]) => [C - 1, I]),
10012
10021
  dt(eo),
10013
10022
  le(([C]) => C)
@@ -10016,14 +10025,14 @@ const lr = Ze(
10016
10025
  U(
10017
10026
  w,
10018
10027
  In(200),
10019
- Te(({ items: C, topItems: I }) => C.length > 0 && C[0].originalIndex === I.length),
10028
+ Ie(({ items: C, topItems: I }) => C.length > 0 && C[0].originalIndex === I.length),
10020
10029
  le(({ items: C }) => C[0].index),
10021
10030
  dt()
10022
10031
  )
10023
10032
  ), S = Gt(
10024
10033
  U(
10025
10034
  w,
10026
- Te(({ items: C }) => C.length > 0),
10035
+ Ie(({ items: C }) => C.length > 0),
10027
10036
  le(({ items: C }) => {
10028
10037
  let I = 0, R = C.length - 1;
10029
10038
  for (; C[I].type === "group" && I < R; )
@@ -10060,7 +10069,7 @@ const lr = Ze(
10060
10069
  ),
10061
10070
  0
10062
10071
  );
10063
- return pe(Ce(i), s), { totalListHeight: i, totalListHeightChanged: s };
10072
+ return pe(Te(i), s), { totalListHeight: i, totalListHeightChanged: s };
10064
10073
  },
10065
10074
  ft(Bt, lr),
10066
10075
  { singleton: !0 }
@@ -10069,7 +10078,7 @@ const lr = Ze(
10069
10078
  const n = ee(!1), r = Dt(
10070
10079
  U(
10071
10080
  It(n, e, t),
10072
- Te(([o]) => o),
10081
+ Ie(([o]) => o),
10073
10082
  le(([, o, s]) => Math.max(0, o - s)),
10074
10083
  In(0),
10075
10084
  dt()
@@ -10111,7 +10120,7 @@ const lr = Ze(
10111
10120
  return E ? I && an(
10112
10121
  U(
10113
10122
  i,
10114
- Te((F) => !F),
10123
+ Ie((F) => !F),
10115
10124
  // skips the initial publish of false, and the cleanup call.
10116
10125
  // but if scrollingInProgress is true, we skip the initial publish.
10117
10126
  tr(St(i) ? 1 : 2)
@@ -10119,7 +10128,7 @@ const lr = Ze(
10119
10128
  I
10120
10129
  ) : I && I(), E;
10121
10130
  }),
10122
- Te((f) => f !== null)
10131
+ Ie((f) => f !== null)
10123
10132
  ),
10124
10133
  c
10125
10134
  ), {
@@ -10155,13 +10164,13 @@ const X0 = (e, t) => typeof e == "function" ? mc(e(t)) : t && mc(e), J0 = Ze(
10155
10164
  }
10156
10165
  ot(
10157
10166
  U(
10158
- It(U(Ce(t), tr(1)), l),
10159
- $e(Ce(x), s, a, f),
10167
+ It(U(Te(t), tr(1)), l),
10168
+ $e(Te(x), s, a, f),
10160
10169
  le(([[S, C], I, R, _, L]) => {
10161
10170
  let P = C && _, M = "auto";
10162
10171
  return P && (M = X0(I, R || L), P = P && !!M), { followOutputBehavior: M, shouldFollow: P, totalCount: S };
10163
10172
  }),
10164
- Te(({ shouldFollow: S }) => S)
10173
+ Ie(({ shouldFollow: S }) => S)
10165
10174
  ),
10166
10175
  ({ followOutputBehavior: S, totalCount: C }) => {
10167
10176
  y && (y(), y = null), St(n) ? requestAnimationFrame(() => {
@@ -10179,13 +10188,13 @@ const X0 = (e, t) => typeof e == "function" ? mc(e(t)) : t && mc(e), J0 = Ze(
10179
10188
  }
10180
10189
  ot(
10181
10190
  U(
10182
- It(Ce(x), t, c),
10183
- Te(([S, , C]) => S && C),
10191
+ It(Te(x), t, c),
10192
+ Ie(([S, , C]) => S && C),
10184
10193
  yn(
10185
10194
  ({ value: S }, [, C]) => ({ refreshed: S === C, value: C }),
10186
10195
  { refreshed: !1, value: 0 }
10187
10196
  ),
10188
- Te(({ refreshed: S }) => S),
10197
+ Ie(({ refreshed: S }) => S),
10189
10198
  $e(x, t)
10190
10199
  ),
10191
10200
  ([, S]) => {
@@ -10193,28 +10202,28 @@ const X0 = (e, t) => typeof e == "function" ? mc(e(t)) : t && mc(e), J0 = Ze(
10193
10202
  }
10194
10203
  ), ot(m, () => {
10195
10204
  w(St(x) !== !1);
10196
- }), ot(It(Ce(x), o), ([S, C]) => {
10205
+ }), ot(It(Te(x), o), ([S, C]) => {
10197
10206
  S && !C.atBottom && C.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && g("auto");
10198
10207
  });
10199
10208
  const b = ee(null), T = Ve();
10200
10209
  return pe(
10201
10210
  zi(
10202
10211
  U(
10203
- Ce(r),
10212
+ Te(r),
10204
10213
  le((S) => {
10205
10214
  var C;
10206
10215
  return (C = S == null ? void 0 : S.length) != null ? C : 0;
10207
10216
  })
10208
10217
  ),
10209
- U(Ce(t))
10218
+ U(Te(t))
10210
10219
  ),
10211
10220
  T
10212
10221
  ), ot(
10213
10222
  U(
10214
10223
  It(U(T, tr(1)), l),
10215
- $e(Ce(b), a, f, p),
10224
+ $e(Te(b), a, f, p),
10216
10225
  le(([[S, C], I, R, _, L]) => C && R && (I == null ? void 0 : I({ context: L, totalCount: S, scrollingInProgress: _ }))),
10217
- Te((S) => !!S),
10226
+ Ie((S) => !!S),
10218
10227
  In(0)
10219
10228
  ),
10220
10229
  (S) => {
@@ -10242,7 +10251,7 @@ const X0 = (e, t) => typeof e == "function" ? mc(e(t)) : t && mc(e), J0 = Ze(
10242
10251
  U(
10243
10252
  a,
10244
10253
  $e(s),
10245
- Te(([, l]) => l !== 0),
10254
+ Ie(([, l]) => l !== 0),
10246
10255
  $e(o, r, t, n, e),
10247
10256
  le(([[, l], c, d, f, p, h = []]) => If(l, c, d, f, p, h))
10248
10257
  ),
@@ -10257,7 +10266,7 @@ const X0 = (e, t) => typeof e == "function" ? mc(e(t)) : t && mc(e), J0 = Ze(
10257
10266
  U(
10258
10267
  e,
10259
10268
  $e(r),
10260
- Te(([, o]) => o !== 0),
10269
+ Ie(([, o]) => o !== 0),
10261
10270
  le(([, o]) => ({ top: o }))
10262
10271
  ),
10263
10272
  (o) => {
@@ -10265,7 +10274,7 @@ const X0 = (e, t) => typeof e == "function" ? mc(e(t)) : t && mc(e), J0 = Ze(
10265
10274
  U(
10266
10275
  n,
10267
10276
  tr(1),
10268
- Te((s) => s.items.length > 1)
10277
+ Ie((s) => s.items.length > 1)
10269
10278
  ),
10270
10279
  () => {
10271
10280
  requestAnimationFrame(() => {
@@ -10287,7 +10296,7 @@ const X0 = (e, t) => typeof e == "function" ? mc(e(t)) : t && mc(e), J0 = Ze(
10287
10296
  U(
10288
10297
  e,
10289
10298
  $e(r, t, n),
10290
- Te(([o, s]) => !!s),
10299
+ Ie(([o, s]) => !!s),
10291
10300
  le(([o, s, i, a]) => {
10292
10301
  const { enter: l, exit: c } = s;
10293
10302
  if (i) {
@@ -10359,11 +10368,11 @@ const X0 = (e, t) => typeof e == "function" ? mc(e(t)) : t && mc(e), J0 = Ze(
10359
10368
  const T = L0(x.sizeTree);
10360
10369
  y && g !== null && w !== null && (m = g.scrollTop - w.offsetTop), m -= b, h({ ranges: T, scrollTop: m });
10361
10370
  }
10362
- ), pe(U(d, Te(Na), le(tS)), o), pe(
10371
+ ), pe(U(d, Ie(Na), le(tS)), o), pe(
10363
10372
  U(
10364
10373
  s,
10365
10374
  $e(d),
10366
- Te(([, h]) => h !== void 0),
10375
+ Ie(([, h]) => h !== void 0),
10367
10376
  dt(),
10368
10377
  le(([, h]) => h.ranges)
10369
10378
  ),
@@ -10383,7 +10392,7 @@ const nS = Ze(([{ topItemsIndexes: e }]) => {
10383
10392
  return pe(
10384
10393
  U(
10385
10394
  t,
10386
- Te((n) => n >= 0),
10395
+ Ie((n) => n >= 0),
10387
10396
  le((n) => Array.from({ length: n }).map((r, o) => o))
10388
10397
  ),
10389
10398
  e
@@ -10414,9 +10423,9 @@ const rS = Nf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10414
10423
  },
10415
10424
  [0, [], 0, 0]
10416
10425
  ),
10417
- Te(([g]) => g !== 0),
10426
+ Ie(([g]) => g !== 0),
10418
10427
  $e(r, a, n, o, h, x),
10419
- Te(([, g, w, b, , , T]) => !T && !b && g !== 0 && w === no),
10428
+ Ie(([, g, w, b, , , T]) => !T && !b && g !== 0 && w === no),
10420
10429
  le(([[g], , , , , w]) => (w("Upward scrolling compensation", { amount: g }, Ut.DEBUG), g))
10421
10430
  )
10422
10431
  );
@@ -10428,7 +10437,7 @@ const rS = Nf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10428
10437
  }), ot(
10429
10438
  U(
10430
10439
  It(Dt(s, !1), e, x),
10431
- Te(([g, w, b]) => !g && !b && w !== 0),
10440
+ Ie(([g, w, b]) => !g && !b && w !== 0),
10432
10441
  le(([g, w]) => w),
10433
10442
  In(1)
10434
10443
  ),
@@ -10772,7 +10781,7 @@ const lS = /* @__PURE__ */ Ze(() => {
10772
10781
  ([e, t]) => ({ ...e, ...t }),
10773
10782
  ft(_f, lS)
10774
10783
  ), uS = ({ height: e }) => /* @__PURE__ */ u.jsx("div", { style: { height: e } }), dS = { overflowAnchor: "none", position: Fa(), zIndex: 1 }, Lf = { overflowAnchor: "none" }, fS = { ...Lf, display: "inline-block", height: "100%" }, xc = /* @__PURE__ */ Q.memo(function({ showTopList: e = !1 }) {
10775
- const t = ke("listState"), n = Zt("sizeRanges"), r = ke("useWindowScroll"), o = ke("customScrollParent"), s = Zt("windowScrollContainerState"), i = Zt("scrollContainerState"), a = o || r ? s : i, l = ke("itemContent"), c = ke("context"), d = ke("groupContent"), f = ke("trackItemSizes"), p = ke("itemSize"), h = ke("log"), x = Zt("gap"), m = ke("horizontalDirection"), { callbackRef: y } = R0(
10784
+ const t = Re("listState"), n = Zt("sizeRanges"), r = Re("useWindowScroll"), o = Re("customScrollParent"), s = Zt("windowScrollContainerState"), i = Zt("scrollContainerState"), a = o || r ? s : i, l = Re("itemContent"), c = Re("context"), d = Re("groupContent"), f = Re("trackItemSizes"), p = Re("itemSize"), h = Re("log"), x = Zt("gap"), m = Re("horizontalDirection"), { callbackRef: y } = R0(
10776
10785
  n,
10777
10786
  p,
10778
10787
  f,
@@ -10781,12 +10790,12 @@ const lS = /* @__PURE__ */ Ze(() => {
10781
10790
  x,
10782
10791
  o,
10783
10792
  m,
10784
- ke("skipAnimationFrameInResizeObserver")
10793
+ Re("skipAnimationFrameInResizeObserver")
10785
10794
  ), [g, w] = Q.useState(0);
10786
10795
  za("deviation", (E) => {
10787
10796
  g !== E && w(E);
10788
10797
  });
10789
- const b = ke("EmptyPlaceholder"), T = ke("ScrollSeekPlaceholder") || uS, S = ke("ListComponent"), C = ke("ItemComponent"), I = ke("GroupComponent"), R = ke("computeItemKey"), _ = ke("isSeeking"), L = ke("groupIndices").length > 0, P = ke("alignToBottom"), M = ke("initialItemFinalLocationReached"), $ = e ? {} : {
10798
+ const b = Re("EmptyPlaceholder"), T = Re("ScrollSeekPlaceholder") || uS, S = Re("ListComponent"), C = Re("ItemComponent"), I = Re("GroupComponent"), R = Re("computeItemKey"), _ = Re("isSeeking"), L = Re("groupIndices").length > 0, P = Re("alignToBottom"), M = Re("initialItemFinalLocationReached"), $ = e ? {} : {
10790
10799
  boxSizing: "border-box",
10791
10800
  ...m ? {
10792
10801
  display: "inline-block",
@@ -10879,7 +10888,7 @@ function gS(e, t) {
10879
10888
  return { item: typeof e == "string" ? void 0 : t };
10880
10889
  }
10881
10890
  const xS = /* @__PURE__ */ Q.memo(function() {
10882
- const e = ke("HeaderComponent"), t = Zt("headerHeight"), n = ke("HeaderFooterTag"), r = ar(
10891
+ const e = Re("HeaderComponent"), t = Zt("headerHeight"), n = Re("HeaderFooterTag"), r = ar(
10883
10892
  Q.useMemo(
10884
10893
  () => (s) => {
10885
10894
  t(Ln(s, "height"));
@@ -10887,11 +10896,11 @@ const xS = /* @__PURE__ */ Q.memo(function() {
10887
10896
  [t]
10888
10897
  ),
10889
10898
  !0,
10890
- ke("skipAnimationFrameInResizeObserver")
10891
- ), o = ke("context");
10899
+ Re("skipAnimationFrameInResizeObserver")
10900
+ ), o = Re("context");
10892
10901
  return e ? /* @__PURE__ */ u.jsx(n, { ref: r, children: /* @__PURE__ */ u.jsx(e, { ...Ot(e, o) }) }) : null;
10893
10902
  }), yS = /* @__PURE__ */ Q.memo(function() {
10894
- const e = ke("FooterComponent"), t = Zt("footerHeight"), n = ke("HeaderFooterTag"), r = ar(
10903
+ const e = Re("FooterComponent"), t = Zt("footerHeight"), n = Re("HeaderFooterTag"), r = ar(
10895
10904
  Q.useMemo(
10896
10905
  () => (s) => {
10897
10906
  t(Ln(s, "height"));
@@ -10899,8 +10908,8 @@ const xS = /* @__PURE__ */ Q.memo(function() {
10899
10908
  [t]
10900
10909
  ),
10901
10910
  !0,
10902
- ke("skipAnimationFrameInResizeObserver")
10903
- ), o = ke("context");
10911
+ Re("skipAnimationFrameInResizeObserver")
10912
+ ), o = Re("context");
10904
10913
  return e ? /* @__PURE__ */ u.jsx(n, { ref: r, children: /* @__PURE__ */ u.jsx(e, { ...Ot(e, o) }) }) : null;
10905
10914
  });
10906
10915
  function $f({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
@@ -10956,27 +10965,27 @@ function Ff({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
10956
10965
  });
10957
10966
  }
10958
10967
  const vS = ({ children: e }) => {
10959
- const t = Q.useContext(Pf), n = Zt("viewportHeight"), r = Zt("fixedItemHeight"), o = ke("alignToBottom"), s = ke("horizontalDirection"), i = Q.useMemo(
10968
+ const t = Q.useContext(Pf), n = Zt("viewportHeight"), r = Zt("fixedItemHeight"), o = Re("alignToBottom"), s = Re("horizontalDirection"), i = Q.useMemo(
10960
10969
  () => uf(n, (l) => Ln(l, s ? "width" : "height")),
10961
10970
  [n, s]
10962
- ), a = ar(i, !0, ke("skipAnimationFrameInResizeObserver"));
10971
+ ), a = ar(i, !0, Re("skipAnimationFrameInResizeObserver"));
10963
10972
  return Q.useEffect(() => {
10964
10973
  t && (n(t.viewportHeight), r(t.itemHeight));
10965
10974
  }, [t, n, r]), /* @__PURE__ */ u.jsx("div", { "data-viewport-type": "element", ref: a, style: Bs(o), children: e });
10966
10975
  }, wS = ({ children: e }) => {
10967
- const t = Q.useContext(Pf), n = Zt("windowViewportRect"), r = Zt("fixedItemHeight"), o = ke("customScrollParent"), s = ff(
10976
+ const t = Q.useContext(Pf), n = Zt("windowViewportRect"), r = Zt("fixedItemHeight"), o = Re("customScrollParent"), s = ff(
10968
10977
  n,
10969
10978
  o,
10970
- ke("skipAnimationFrameInResizeObserver")
10971
- ), i = ke("alignToBottom");
10979
+ Re("skipAnimationFrameInResizeObserver")
10980
+ ), i = Re("alignToBottom");
10972
10981
  return Q.useEffect(() => {
10973
10982
  t && (r(t.itemHeight), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: 100 }));
10974
10983
  }, [t, n, r]), /* @__PURE__ */ u.jsx("div", { "data-viewport-type": "window", ref: s, style: Bs(i), children: e });
10975
10984
  }, bS = ({ children: e }) => {
10976
- const t = ke("TopItemListComponent") || "div", n = ke("headerHeight"), r = { ...mS, marginTop: `${n}px` }, o = ke("context");
10985
+ const t = Re("TopItemListComponent") || "div", n = Re("headerHeight"), r = { ...mS, marginTop: `${n}px` }, o = Re("context");
10977
10986
  return /* @__PURE__ */ u.jsx(t, { style: r, ...Ot(t, o), children: e });
10978
10987
  }, SS = /* @__PURE__ */ Q.memo(function(e) {
10979
- const t = ke("useWindowScroll"), n = ke("topItemsIndexes").length > 0, r = ke("customScrollParent"), o = ke("context");
10988
+ const t = Re("useWindowScroll"), n = Re("topItemsIndexes").length > 0, r = Re("customScrollParent"), o = Re("context");
10980
10989
  return /* @__PURE__ */ u.jsxs(r || t ? IS : TS, { ...e, context: o, children: [
10981
10990
  n && /* @__PURE__ */ u.jsx(bS, { children: /* @__PURE__ */ u.jsx(xc, { showTopList: !0 }) }),
10982
10991
  /* @__PURE__ */ u.jsxs(r || t ? wS : vS, { children: [
@@ -10988,7 +10997,7 @@ const vS = ({ children: e }) => {
10988
10997
  }), {
10989
10998
  Component: CS,
10990
10999
  useEmitter: za,
10991
- useEmitterValue: ke,
11000
+ useEmitterValue: Re,
10992
11001
  usePublisher: Zt
10993
11002
  } = /* @__PURE__ */ jf(
10994
11003
  cS,
@@ -11049,7 +11058,7 @@ const vS = ({ children: e }) => {
11049
11058
  }
11050
11059
  },
11051
11060
  SS
11052
- ), TS = /* @__PURE__ */ $f({ useEmitter: za, useEmitterValue: ke, usePublisher: Zt }), IS = /* @__PURE__ */ Ff({ useEmitter: za, useEmitterValue: ke, usePublisher: Zt }), kS = CS, RS = /* @__PURE__ */ Ze(() => {
11061
+ ), TS = /* @__PURE__ */ $f({ useEmitter: za, useEmitterValue: Re, usePublisher: Zt }), IS = /* @__PURE__ */ Ff({ useEmitter: za, useEmitterValue: Re, usePublisher: Zt }), kS = CS, RS = /* @__PURE__ */ Ze(() => {
11053
11062
  const e = ee((c) => /* @__PURE__ */ u.jsxs("td", { children: [
11054
11063
  "Item $",
11055
11064
  c
@@ -11129,20 +11138,20 @@ const _S = /* @__PURE__ */ Ze(
11129
11138
  { customScrollParent: y, useWindowScroll: g, windowScrollContainerState: w, windowScrollTo: b, windowViewportRect: T },
11130
11139
  S
11131
11140
  ]) => {
11132
- const C = ee(0), I = ee(0), R = ee(yc), _ = ee({ height: 0, width: 0 }), L = ee({ height: 0, width: 0 }), P = Ve(), M = Ve(), $ = ee(0), E = ee(null), F = ee({ column: 0, row: 0 }), j = Ve(), Z = Ve(), B = ee(!1), A = ee(0), W = ee(!0), G = ee(!1), oe = ee(!1);
11141
+ const C = ee(0), I = ee(0), R = ee(yc), _ = ee({ height: 0, width: 0 }), L = ee({ height: 0, width: 0 }), P = Ve(), M = Ve(), $ = ee(0), E = ee(null), F = ee({ column: 0, row: 0 }), j = Ve(), Z = Ve(), B = ee(!1), N = ee(0), W = ee(!0), G = ee(!1), oe = ee(!1);
11133
11142
  ot(
11134
11143
  U(
11135
11144
  x,
11136
- $e(A),
11137
- Te(([D, V]) => !!V)
11145
+ $e(N),
11146
+ Ie(([D, V]) => !!V)
11138
11147
  ),
11139
11148
  () => {
11140
11149
  Pe(W, !1);
11141
11150
  }
11142
11151
  ), ot(
11143
11152
  U(
11144
- It(x, W, L, _, A, G),
11145
- Te(([D, V, J, ae, , re]) => D && !V && J.height !== 0 && ae.height !== 0 && !re)
11153
+ It(x, W, L, _, N, G),
11154
+ Ie(([D, V, J, ae, , re]) => D && !V && J.height !== 0 && ae.height !== 0 && !re)
11146
11155
  ),
11147
11156
  ([, , , , D]) => {
11148
11157
  Pe(G, !0), Oa(1, () => {
@@ -11154,7 +11163,7 @@ const _S = /* @__PURE__ */ Ze(
11154
11163
  ), pe(
11155
11164
  U(
11156
11165
  Z,
11157
- Te((D) => D != null && D.scrollTop > 0),
11166
+ Ie((D) => D != null && D.scrollTop > 0),
11158
11167
  mn(0)
11159
11168
  ),
11160
11169
  I
@@ -11162,7 +11171,7 @@ const _S = /* @__PURE__ */ Ze(
11162
11171
  U(
11163
11172
  x,
11164
11173
  $e(Z),
11165
- Te(([, D]) => D != null)
11174
+ Ie(([, D]) => D != null)
11166
11175
  ),
11167
11176
  ([, D]) => {
11168
11177
  D && (Pe(_, D.viewport), Pe(L, D.item), Pe(F, D.gap), D.scrollTop > 0 && (Pe(B, !0), an(U(c, tr(1)), (V) => {
@@ -11178,10 +11187,10 @@ const _S = /* @__PURE__ */ Ze(
11178
11187
  ), pe(
11179
11188
  U(
11180
11189
  It(
11181
- Ce(_, Eo),
11182
- Ce(L, Eo),
11183
- Ce(F, (D, V) => D && D.column === V.column && D.row === V.row),
11184
- Ce(c)
11190
+ Te(_, Eo),
11191
+ Te(L, Eo),
11192
+ Te(F, (D, V) => D && D.column === V.column && D.row === V.row),
11193
+ Te(c)
11185
11194
  ),
11186
11195
  le(([D, V, J, ae]) => ({
11187
11196
  gap: J,
@@ -11194,18 +11203,18 @@ const _S = /* @__PURE__ */ Ze(
11194
11203
  ), pe(
11195
11204
  U(
11196
11205
  It(
11197
- Ce(C),
11206
+ Te(C),
11198
11207
  r,
11199
- Ce(F, NS),
11200
- Ce(L, Eo),
11201
- Ce(_, Eo),
11202
- Ce(E),
11203
- Ce(I),
11204
- Ce(B),
11205
- Ce(W),
11206
- Ce(A)
11208
+ Te(F, NS),
11209
+ Te(L, Eo),
11210
+ Te(_, Eo),
11211
+ Te(E),
11212
+ Te(I),
11213
+ Te(B),
11214
+ Te(W),
11215
+ Te(N)
11207
11216
  ),
11208
- Te(([, , , , , , , D]) => !D),
11217
+ Ie(([, , , , , , , D]) => !D),
11209
11218
  le(
11210
11219
  ([
11211
11220
  D,
@@ -11238,14 +11247,14 @@ const _S = /* @__PURE__ */ Ze(
11238
11247
  ), pe(
11239
11248
  U(
11240
11249
  E,
11241
- Te((D) => D !== null),
11250
+ Ie((D) => D !== null),
11242
11251
  le((D) => D.length)
11243
11252
  ),
11244
11253
  C
11245
11254
  ), pe(
11246
11255
  U(
11247
11256
  It(_, L, R, F),
11248
- Te(([D, V, { items: J }]) => J.length > 0 && V.height !== 0 && D.height !== 0),
11257
+ Ie(([D, V, { items: J }]) => J.length > 0 && V.height !== 0 && D.height !== 0),
11249
11258
  le(([D, V, { items: J }, ae]) => {
11250
11259
  const { bottom: re, top: Ne } = Sc(D, ae, V, J);
11251
11260
  return [Ne, re];
@@ -11266,9 +11275,9 @@ const _S = /* @__PURE__ */ Ze(
11266
11275
  const je = Gt(
11267
11276
  U(
11268
11277
  It(R, C),
11269
- Te(([{ items: D }]) => D.length > 0),
11278
+ Ie(([{ items: D }]) => D.length > 0),
11270
11279
  $e(ve),
11271
- Te(([[D, V], J]) => {
11280
+ Ie(([[D, V], J]) => {
11272
11281
  const ae = D.items[D.items.length - 1].index === V - 1;
11273
11282
  return (J || D.bottom > 0 && D.itemHeight > 0 && D.offsetBottom === 0 && D.items.length === V) && ae;
11274
11283
  }),
@@ -11277,16 +11286,16 @@ const _S = /* @__PURE__ */ Ze(
11277
11286
  )
11278
11287
  ), q = Gt(
11279
11288
  U(
11280
- Ce(R),
11281
- Te(({ items: D }) => D.length > 0 && D[0].index === 0),
11289
+ Te(R),
11290
+ Ie(({ items: D }) => D.length > 0 && D[0].index === 0),
11282
11291
  mn(0),
11283
11292
  dt()
11284
11293
  )
11285
11294
  ), z = Gt(
11286
11295
  U(
11287
- Ce(R),
11296
+ Te(R),
11288
11297
  $e(B),
11289
- Te(([{ items: D }, V]) => D.length > 0 && !V),
11298
+ Ie(([{ items: D }, V]) => D.length > 0 && !V),
11290
11299
  le(([{ items: D }]) => ({
11291
11300
  endIndex: D[D.length - 1].index,
11292
11301
  startIndex: D[0].index
@@ -11352,7 +11361,7 @@ const _S = /* @__PURE__ */ Ze(
11352
11361
  // output
11353
11362
  gridState: R,
11354
11363
  horizontalDirection: oe,
11355
- initialTopMostItemIndex: A,
11364
+ initialTopMostItemIndex: N,
11356
11365
  totalListHeight: Y,
11357
11366
  ...p,
11358
11367
  endReached: je,
@@ -11389,7 +11398,7 @@ const jS = /* @__PURE__ */ Ze(() => {
11389
11398
  ),
11390
11399
  p
11391
11400
  ), c = ee(!1), d = ee(!1);
11392
- return pe(Ce(d), c), {
11401
+ return pe(Te(d), c), {
11393
11402
  components: t,
11394
11403
  computeItemKey: s,
11395
11404
  context: n,
@@ -11581,7 +11590,7 @@ const HS = ms(
11581
11590
  }
11582
11591
  );
11583
11592
  function Hf({ className: e, variant: t, ...n }) {
11584
- return /* @__PURE__ */ u.jsx("div", { className: te(HS({ variant: t }), e), ...n });
11593
+ return /* @__PURE__ */ u.jsx("div", { className: ne(HS({ variant: t }), e), ...n });
11585
11594
  }
11586
11595
  function Ha(e) {
11587
11596
  const t = e == null ? void 0 : e.trim();
@@ -12015,7 +12024,7 @@ const uC = lp, dC = cp, dp = v.forwardRef(({ className: e, ...t }, n) => /* @__P
12015
12024
  Hs,
12016
12025
  {
12017
12026
  ref: n,
12018
- className: te(
12027
+ className: ne(
12019
12028
  "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
12020
12029
  e
12021
12030
  ),
@@ -12045,7 +12054,7 @@ const fp = v.forwardRef(({ className: e, children: t, ...n }, r) => {
12045
12054
  Us,
12046
12055
  {
12047
12056
  ref: r,
12048
- className: te(
12057
+ className: ne(
12049
12058
  "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
12050
12059
  e
12051
12060
  ),
@@ -12069,7 +12078,7 @@ const pp = ({
12069
12078
  }) => /* @__PURE__ */ u.jsx(
12070
12079
  "div",
12071
12080
  {
12072
- className: te(
12081
+ className: ne(
12073
12082
  "flex flex-col space-y-1.5 text-center sm:text-left",
12074
12083
  e
12075
12084
  ),
@@ -12081,7 +12090,7 @@ const hp = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12081
12090
  Jn,
12082
12091
  {
12083
12092
  ref: n,
12084
- className: te(
12093
+ className: ne(
12085
12094
  "text-lg font-semibold leading-none tracking-tight",
12086
12095
  e
12087
12096
  ),
@@ -12093,7 +12102,7 @@ const fC = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12093
12102
  Ws,
12094
12103
  {
12095
12104
  ref: n,
12096
- className: te("text-sm text-muted-foreground", e),
12105
+ className: ne("text-sm text-muted-foreground", e),
12097
12106
  ...t
12098
12107
  }
12099
12108
  ));
@@ -13893,7 +13902,7 @@ function ls({
13893
13902
  return /* @__PURE__ */ u.jsx(
13894
13903
  "div",
13895
13904
  {
13896
- className: te(
13905
+ className: ne(
13897
13906
  "markdown prose prose-sm max-w-none break-words",
13898
13907
  // In dark mode, use prose-invert for better contrast in dark bubbles
13899
13908
  "dark:prose-invert",
@@ -13969,7 +13978,7 @@ const Wr = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
13969
13978
  "div",
13970
13979
  {
13971
13980
  ref: n,
13972
- className: te(
13981
+ className: ne(
13973
13982
  "rounded-lg border bg-card text-card-foreground shadow-sm",
13974
13983
  e
13975
13984
  ),
@@ -13981,7 +13990,7 @@ const Vr = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
13981
13990
  "div",
13982
13991
  {
13983
13992
  ref: n,
13984
- className: te("flex flex-col space-y-1.5 p-6", e),
13993
+ className: ne("flex flex-col space-y-1.5 p-6", e),
13985
13994
  ...t
13986
13995
  }
13987
13996
  ));
@@ -13990,7 +13999,7 @@ const Kr = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
13990
13999
  "h3",
13991
14000
  {
13992
14001
  ref: n,
13993
- className: te(
14002
+ className: ne(
13994
14003
  "text-2xl font-semibold leading-none tracking-tight",
13995
14004
  e
13996
14005
  ),
@@ -14002,18 +14011,18 @@ const Cp = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
14002
14011
  "p",
14003
14012
  {
14004
14013
  ref: n,
14005
- className: te("text-sm text-muted-foreground", e),
14014
+ className: ne("text-sm text-muted-foreground", e),
14006
14015
  ...t
14007
14016
  }
14008
14017
  ));
14009
14018
  Cp.displayName = "CardDescription";
14010
- const qr = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx("div", { ref: n, className: te("p-6 pt-0", e), ...t }));
14019
+ const qr = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx("div", { ref: n, className: ne("p-6 pt-0", e), ...t }));
14011
14020
  qr.displayName = "CardContent";
14012
14021
  const Tp = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
14013
14022
  "div",
14014
14023
  {
14015
14024
  ref: n,
14016
- className: te("flex items-center p-6 pt-0", e),
14025
+ className: ne("flex items-center p-6 pt-0", e),
14017
14026
  ...t
14018
14027
  }
14019
14028
  ));
@@ -14039,7 +14048,7 @@ function UC({
14039
14048
  return /* @__PURE__ */ u.jsxs(
14040
14049
  Wr,
14041
14050
  {
14042
- className: te(
14051
+ className: ne(
14043
14052
  "border-blue-200 dark:border-blue-800 bg-blue-50/50 dark:bg-blue-950/10 transition-shadow",
14044
14053
  o ? "shadow-md ring-1 ring-blue-300 dark:ring-blue-500/70" : "opacity-80"
14045
14054
  ),
@@ -14157,10 +14166,10 @@ function VC({
14157
14166
  }) {
14158
14167
  const s = Math.max(e.length - r, 0), i = e.substring(0, r);
14159
14168
  return /* @__PURE__ */ u.jsxs("div", { className: "flex flex-col gap-1", children: [
14160
- /* @__PURE__ */ u.jsx("div", { className: te("text-sm text-[hsl(var(--chat-bubble-user-text))]", o && "text-xs"), children: t ? /* @__PURE__ */ u.jsx(ls, { content: e, allowHtml: !1 }) : /* @__PURE__ */ u.jsxs(
14169
+ /* @__PURE__ */ u.jsx("div", { className: ne("text-sm text-[hsl(var(--chat-bubble-user-text))]", o && "text-xs"), children: t ? /* @__PURE__ */ u.jsx(ls, { content: e, allowHtml: !1 }) : /* @__PURE__ */ u.jsxs(
14161
14170
  "pre",
14162
14171
  {
14163
- className: te(
14172
+ className: ne(
14164
14173
  "font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]",
14165
14174
  o && "text-xs"
14166
14175
  ),
@@ -14241,7 +14250,7 @@ function qC({ className: e }) {
14241
14250
  "span",
14242
14251
  {
14243
14252
  "aria-live": "polite",
14244
- className: te("inline-block text-xs opacity-70 ml-1", e),
14253
+ className: ne("inline-block text-xs opacity-70 ml-1", e),
14245
14254
  children: [
14246
14255
  "Is thinking",
14247
14256
  ".".repeat(t)
@@ -14277,7 +14286,7 @@ const Ya = Qh(function({
14277
14286
  defaultCheckpointId: _ = null,
14278
14287
  messageParentCheckpointId: L = null
14279
14288
  }) {
14280
- const [P, M] = me(!1), [$, E] = me("preview"), [F, j] = me(!1), { currentThreadId: Z } = ca(), { respondToInterrupt: B } = ua(), A = l === "phone" || l === "half-screen", W = t.role, G = W === "tool", oe = De(() => "type" in t && t.type === "default_message" ? t : null, [t]), ve = !!oe, je = !(r && W !== "user"), {
14289
+ const [P, M] = me(!1), [$, E] = me("preview"), [F, j] = me(!1), { currentThreadId: Z } = ca(), { respondToInterrupt: B } = ua(), N = l === "phone" || l === "half-screen", W = t.role, G = W === "tool", oe = De(() => "type" in t && t.type === "default_message" ? t : null, [t]), ve = !!oe, je = !(r && W !== "user"), {
14281
14290
  uploadingFiles: q,
14282
14291
  handleFileClick: z,
14283
14292
  fileViewerOpen: Y,
@@ -14299,63 +14308,63 @@ const Ya = Qh(function({
14299
14308
  }, [W]), ae = De(() => {
14300
14309
  if (oe)
14301
14310
  return "";
14302
- const N = t.content;
14303
- return Array.isArray(N) ? VS(N) : "";
14311
+ const A = t.content;
14312
+ return Array.isArray(A) ? VS(A) : "";
14304
14313
  }, [oe, t]), re = De(() => {
14305
14314
  if (oe)
14306
14315
  return {};
14307
- const N = t.content;
14308
- return Array.isArray(N) ? Wf(t) : {};
14316
+ const A = t.content;
14317
+ return Array.isArray(A) ? Wf(t) : {};
14309
14318
  }, [oe, t]), Ne = De(
14310
14319
  () => {
14311
14320
  if (oe)
14312
14321
  return [];
14313
- const N = t.content;
14314
- return Array.isArray(N) ? N.filter((X) => X.type === "image_url") : [];
14322
+ const A = t.content;
14323
+ return Array.isArray(A) ? A.filter((X) => X.type === "image_url") : [];
14315
14324
  },
14316
14325
  [oe, t]
14317
14326
  ), He = De(
14318
14327
  () => {
14319
14328
  if (oe)
14320
14329
  return [];
14321
- const N = t.content;
14322
- return Array.isArray(N) ? N.filter((X) => X.type === "file") : [];
14330
+ const A = t.content;
14331
+ return Array.isArray(A) ? A.filter((X) => X.type === "file") : [];
14323
14332
  },
14324
14333
  [oe, t]
14325
14334
  ), Oe = De(
14326
14335
  () => {
14327
14336
  if (oe)
14328
14337
  return [];
14329
- const N = t.content;
14330
- return Array.isArray(N) ? N.filter((X) => X.type === "interrupt") : [];
14338
+ const A = t.content;
14339
+ return Array.isArray(A) ? A.filter((X) => X.type === "interrupt") : [];
14331
14340
  },
14332
14341
  [oe, t]
14333
14342
  ), Ye = (w == null ? void 0 : w.id) ?? (w == null ? void 0 : w.interrupt_id), qe = Ao(Ye), tt = w == null ? void 0 : w.value, Xe = De(() => {
14334
14343
  if (oe)
14335
14344
  return "";
14336
- const N = t.content;
14337
- return Array.isArray(N) ? KS(N) : "";
14345
+ const A = t.content;
14346
+ return Array.isArray(A) ? KS(A) : "";
14338
14347
  }, [oe, t]), ie = De(() => {
14339
14348
  if (oe || !p) return [];
14340
14349
  const X = t.artifact;
14341
14350
  if (!X) return [];
14342
- const ne = [], fe = [
14351
+ const te = [], fe = [
14343
14352
  ...Array.isArray(X.plots) ? X.plots : []
14344
14353
  ];
14345
- for (const Re of fe) {
14346
- const be = JS(Re);
14347
- be && ne.push(be);
14354
+ for (const we of fe) {
14355
+ const Se = JS(we);
14356
+ Se && te.push(Se);
14348
14357
  }
14349
- return ne;
14358
+ return te;
14350
14359
  }, [oe, t, p]), xe = ge(async () => {
14351
- const N = G ? Xe : ae;
14352
- async function X(ne) {
14360
+ const A = G ? Xe : ae;
14361
+ async function X(te) {
14353
14362
  if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
14354
- await navigator.clipboard.writeText(ne);
14363
+ await navigator.clipboard.writeText(te);
14355
14364
  return;
14356
14365
  }
14357
14366
  if (navigator.clipboard && typeof navigator.clipboard.write == "function" && typeof ClipboardItem < "u") {
14358
- const fe = new Blob([ne], { type: "text/plain" });
14367
+ const fe = new Blob([te], { type: "text/plain" });
14359
14368
  await navigator.clipboard.write([
14360
14369
  new ClipboardItem({
14361
14370
  "text/plain": fe
@@ -14366,21 +14375,21 @@ const Ya = Qh(function({
14366
14375
  throw new Error("Clipboard API not supported in this context.");
14367
14376
  }
14368
14377
  try {
14369
- await X(N), M(!0), setTimeout(() => M(!1), 2e3), g == null || g(N);
14370
- } catch (ne) {
14371
- console.error("Failed to copy:", ne);
14378
+ await X(A), M(!0), setTimeout(() => M(!1), 2e3), g == null || g(A);
14379
+ } catch (te) {
14380
+ console.error("Failed to copy:", te);
14372
14381
  }
14373
14382
  }, [G, Xe, ae, g]), Ue = ge(() => {
14374
14383
  if (!x) return;
14375
- const N = G ? Xe : ae, X = "type" in t && t.type === "default_message" ? void 0 : {
14384
+ const A = G ? Xe : ae, X = "type" in t && t.type === "default_message" ? void 0 : {
14376
14385
  checkpointId: t.checkpointId ?? null,
14377
14386
  checkpointNs: t.checkpointNs ?? null
14378
14387
  };
14379
- x(t.id, N, X);
14388
+ x(t.id, A, X);
14380
14389
  }, [x, t.id, G, Xe, ae, t]), We = ge(() => {
14381
14390
  m == null || m(n);
14382
14391
  }, [m, n]), st = ge(() => {
14383
- const X = te(A ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", J);
14392
+ const X = ne(N ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", J);
14384
14393
  switch (W) {
14385
14394
  case "user":
14386
14395
  return /* @__PURE__ */ u.jsx(lm, { className: X });
@@ -14391,125 +14400,125 @@ const Ya = Qh(function({
14391
14400
  default:
14392
14401
  return /* @__PURE__ */ u.jsx(Js, { className: X });
14393
14402
  }
14394
- }, [A, J, W]), at = ge(() => {
14395
- const N = "group relative mb-4 flex w-full";
14403
+ }, [N, J, W]), at = ge(() => {
14404
+ const A = "group relative mb-4 flex w-full";
14396
14405
  switch (W) {
14397
14406
  case "user":
14398
- return te(N, "justify-end");
14407
+ return ne(A, "justify-end");
14399
14408
  case "assistant":
14400
14409
  case "tool":
14401
14410
  case "system":
14402
- return te(N, "justify-start");
14411
+ return ne(A, "justify-start");
14403
14412
  default:
14404
- return N;
14413
+ return A;
14405
14414
  }
14406
14415
  }, [W]), _t = ge(() => {
14407
- const N = te(
14416
+ const A = ne(
14408
14417
  "rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
14409
- A && "px-3 py-2 text-sm"
14418
+ N && "px-3 py-2 text-sm"
14410
14419
  );
14411
14420
  if (ve)
14412
- return te(
14413
- N,
14421
+ return ne(
14422
+ A,
14414
14423
  "w-full",
14415
14424
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
14416
14425
  "border border-border/60 dark:border-border/40 shadow-sm"
14417
14426
  );
14418
14427
  switch (W) {
14419
14428
  case "user":
14420
- return te(
14421
- N,
14429
+ return ne(
14430
+ A,
14422
14431
  "w-full md:max-w-[95%]",
14423
14432
  "bg-[hsl(var(--chat-bubble-user))] text-[hsl(var(--chat-bubble-user-text))]",
14424
14433
  "border border-transparent"
14425
14434
  );
14426
14435
  case "assistant":
14427
- return te(
14428
- N,
14436
+ return ne(
14437
+ A,
14429
14438
  "w-full md:max-w-[95%]",
14430
14439
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
14431
14440
  "border border-border/60 dark:border-border/40"
14432
14441
  );
14433
14442
  case "tool":
14434
- return te(N, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
14443
+ return ne(A, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
14435
14444
  case "system":
14436
- return te(N, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
14445
+ return ne(A, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
14437
14446
  default:
14438
- return te(
14439
- N,
14447
+ return ne(
14448
+ A,
14440
14449
  "w-full md:max-w-[95%]",
14441
14450
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
14442
14451
  "border border-border/60 dark:border-border/40"
14443
14452
  );
14444
14453
  }
14445
- }, [A, ve, W]), vt = ge(async (N) => {
14454
+ }, [N, ve, W]), vt = ge(async (A) => {
14446
14455
  if (b)
14447
14456
  return;
14448
14457
  const X = Ao(
14449
- (N == null ? void 0 : N.id) ?? (N == null ? void 0 : N.interrupt_id)
14458
+ (A == null ? void 0 : A.id) ?? (A == null ? void 0 : A.interrupt_id)
14450
14459
  );
14451
14460
  if (!X) {
14452
- console.warn("Interrupt part missing id", N);
14461
+ console.warn("Interrupt part missing id", A);
14453
14462
  return;
14454
14463
  }
14455
14464
  try {
14456
14465
  T == null || T(), await B(X, !0);
14457
- } catch (ne) {
14458
- console.error("Failed to approve interrupt:", ne);
14466
+ } catch (te) {
14467
+ console.error("Failed to approve interrupt:", te);
14459
14468
  } finally {
14460
14469
  S == null || S();
14461
14470
  }
14462
- }, [b, S, T, B]), gt = ge(async (N) => {
14471
+ }, [b, S, T, B]), gt = ge(async (A) => {
14463
14472
  if (b)
14464
14473
  return;
14465
14474
  const X = Ao(
14466
- (N == null ? void 0 : N.id) ?? (N == null ? void 0 : N.interrupt_id)
14475
+ (A == null ? void 0 : A.id) ?? (A == null ? void 0 : A.interrupt_id)
14467
14476
  );
14468
14477
  if (!X) {
14469
- console.warn("Interrupt part missing id", N);
14478
+ console.warn("Interrupt part missing id", A);
14470
14479
  return;
14471
14480
  }
14472
14481
  try {
14473
14482
  T == null || T(), await B(X, !1);
14474
- } catch (ne) {
14475
- console.error("Failed to reject interrupt:", ne);
14483
+ } catch (te) {
14484
+ console.error("Failed to reject interrupt:", te);
14476
14485
  } finally {
14477
14486
  S == null || S();
14478
14487
  }
14479
- }, [b, S, T, B]), bt = ge(({ part: N, i: X }) => {
14480
- if (N.type === "text") {
14481
- const ne = N.text ?? "", fe = ne.trim(), Re = Ha(fe);
14482
- return Re && W !== "tool" ? /* @__PURE__ */ u.jsx(Sp, { data: Re }, X) : W === "user" && c && fe.length > d ? /* @__PURE__ */ u.jsx(
14488
+ }, [b, S, T, B]), bt = ge(({ part: A, i: X }) => {
14489
+ if (A.type === "text") {
14490
+ const te = A.text ?? "", fe = te.trim(), we = Ha(fe);
14491
+ return we && W !== "tool" ? /* @__PURE__ */ u.jsx(Sp, { data: we }, X) : W === "user" && c && fe.length > d ? /* @__PURE__ */ u.jsx(
14483
14492
  VC,
14484
14493
  {
14485
14494
  text: fe,
14486
14495
  expanded: F,
14487
14496
  onExpandedChange: j,
14488
14497
  previewLength: d,
14489
- isCompact: A
14498
+ isCompact: N
14490
14499
  },
14491
14500
  X
14492
- ) : /* @__PURE__ */ u.jsx(ls, { content: ne, allowHtml: !1 }, X);
14501
+ ) : /* @__PURE__ */ u.jsx(ls, { content: te, allowHtml: !1 }, X);
14493
14502
  }
14494
- if (N.type === "image_url") {
14495
- const ne = N;
14503
+ if (A.type === "image_url") {
14504
+ const te = A;
14496
14505
  return /* @__PURE__ */ u.jsx("div", { className: "my-2", children: /* @__PURE__ */ u.jsx(
14497
14506
  "img",
14498
14507
  {
14499
- src: ne.url,
14500
- alt: ne.alt ?? "",
14508
+ src: te.url,
14509
+ alt: te.alt ?? "",
14501
14510
  loading: "lazy",
14502
14511
  className: "border rounded max-h-[420px] w-auto object-contain"
14503
14512
  }
14504
14513
  ) }, X);
14505
14514
  }
14506
- if (N.type === "file") {
14507
- const ne = N, fe = ne.name || "file";
14515
+ if (A.type === "file") {
14516
+ const te = A, fe = te.name || "file";
14508
14517
  return /* @__PURE__ */ u.jsxs(
14509
14518
  "a",
14510
14519
  {
14511
- href: ne.url,
14512
- onClick: (Re) => z(Re.nativeEvent, ne, X),
14520
+ href: te.url,
14521
+ onClick: (we) => z(we.nativeEvent, te, X),
14513
14522
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
14514
14523
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
14515
14524
  children: [
@@ -14523,10 +14532,10 @@ const Ya = Qh(function({
14523
14532
  X
14524
14533
  );
14525
14534
  }
14526
- if (N.type === "interrupt") {
14527
- const ne = N, fe = Ao(
14528
- (ne == null ? void 0 : ne.id) ?? (ne == null ? void 0 : ne.interrupt_id)
14529
- ), Re = !!(qe && fe && fe === qe), be = Re ? tt ?? (ne == null ? void 0 : ne.value) : ne == null ? void 0 : ne.value, ze = fe ? { ...ne, id: fe, interrupt_id: fe } : ne;
14535
+ if (A.type === "interrupt") {
14536
+ const te = A, fe = Ao(
14537
+ (te == null ? void 0 : te.id) ?? (te == null ? void 0 : te.interrupt_id)
14538
+ ), we = !!(qe && fe && fe === qe), Se = we ? tt ?? (te == null ? void 0 : te.value) : te == null ? void 0 : te.value, ze = fe ? { ...te, id: fe, interrupt_id: fe } : te;
14530
14539
  return /* @__PURE__ */ u.jsx(
14531
14540
  UC,
14532
14541
  {
@@ -14534,8 +14543,8 @@ const Ya = Qh(function({
14534
14543
  onApprove: vt,
14535
14544
  onReject: gt,
14536
14545
  disabled: b,
14537
- isActive: Re,
14538
- payload: be
14546
+ isActive: we,
14547
+ payload: Se
14539
14548
  },
14540
14549
  X
14541
14550
  );
@@ -14550,7 +14559,7 @@ const Ya = Qh(function({
14550
14559
  c,
14551
14560
  d,
14552
14561
  F,
14553
- A,
14562
+ N,
14554
14563
  qe,
14555
14564
  tt,
14556
14565
  w,
@@ -14560,10 +14569,10 @@ const Ya = Qh(function({
14560
14569
  /* @__PURE__ */ u.jsx(Ci, { className: "h-4 w-4 text-muted-foreground" }),
14561
14570
  /* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
14562
14571
  ] }), []), Lt = ge(() => {
14563
- const N = ae.trim().length > 0 || Ne.length > 0 || He.length > 0 || Oe.length > 0;
14572
+ const A = ae.trim().length > 0 || Ne.length > 0 || He.length > 0 || Oe.length > 0;
14564
14573
  if (!G && He.length > 0 && !r)
14565
14574
  return Tt();
14566
- if (!G && !N && !r)
14575
+ if (!G && !A && !r)
14567
14576
  return null;
14568
14577
  if (G)
14569
14578
  return !f && ie.length > 0 ? null : f ? /* @__PURE__ */ u.jsx(
@@ -14575,11 +14584,11 @@ const Ya = Qh(function({
14575
14584
  t.id
14576
14585
  ) : null;
14577
14586
  if (!G && !oe) {
14578
- const X = t, ne = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: X.content.map((fe, Re) => /* @__PURE__ */ u.jsx(bt, { part: fe, i: Re }, Re)) });
14587
+ const X = t, te = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: X.content.map((fe, we) => /* @__PURE__ */ u.jsx(bt, { part: fe, i: we }, we)) });
14579
14588
  return r ? /* @__PURE__ */ u.jsxs("div", { "aria-busy": "true", role: "status", children: [
14580
- ne,
14589
+ te,
14581
14590
  /* @__PURE__ */ u.jsx(qC, { className: J })
14582
- ] }) : ne;
14591
+ ] }) : te;
14583
14592
  }
14584
14593
  }, [
14585
14594
  ae,
@@ -14594,19 +14603,19 @@ const Ya = Qh(function({
14594
14603
  Tt,
14595
14604
  J
14596
14605
  ]), jt = De(() => oe ? "Assistant" : qS(t), [oe, t]), nt = De(() => oe ? [] : Array.isArray(C) ? C : [], [C, oe]), Rt = De(() => {
14597
- var N;
14598
- return nt.length ? _ && nt.some((X) => X.id === _) ? _ : ((N = nt[0]) == null ? void 0 : N.id) ?? null : null;
14599
- }, [_, nt]), Qe = De(() => !nt.length || !I ? null : nt.some((N) => N.id === I) ? I : null, [I, nt]) ?? Rt, et = W === "user" && nt.length > 0 && typeof R == "function", pt = ge(
14600
- (N, X = !1) => {
14606
+ var A;
14607
+ return nt.length ? _ && nt.some((X) => X.id === _) ? _ : ((A = nt[0]) == null ? void 0 : A.id) ?? null : null;
14608
+ }, [_, nt]), Qe = De(() => !nt.length || !I ? null : nt.some((A) => A.id === I) ? I : null, [I, nt]) ?? Rt, et = W === "user" && nt.length > 0 && typeof R == "function", pt = ge(
14609
+ (A, X = !1) => {
14601
14610
  if (!R) return;
14602
- const ne = (N == null ? void 0 : N.id) ?? null, fe = (N == null ? void 0 : N.parentId) ?? L ?? null;
14603
- R(ne, fe, X);
14611
+ const te = (A == null ? void 0 : A.id) ?? null, fe = (A == null ? void 0 : A.parentId) ?? L ?? null;
14612
+ R(te, fe, X);
14604
14613
  },
14605
14614
  [L, R]
14606
- ), lt = De(() => Qe ? nt.findIndex((N) => N.id === Qe) : -1, [Qe, nt]), K = De(() => lt < 0 ? null : nt[lt] ?? null, [lt, nt]);
14607
- return G && !f && ie.length === 0 ? null : ve && oe ? /* @__PURE__ */ u.jsx("div", { className: te(at(), h.container), children: /* @__PURE__ */ u.jsxs("div", { className: te(_t(), h.content), children: [
14615
+ ), lt = De(() => Qe ? nt.findIndex((A) => A.id === Qe) : -1, [Qe, nt]), K = De(() => lt < 0 ? null : nt[lt] ?? null, [lt, nt]);
14616
+ return G && !f && ie.length === 0 ? null : ve && oe ? /* @__PURE__ */ u.jsx("div", { className: ne(at(), h.container), children: /* @__PURE__ */ u.jsxs("div", { className: ne(_t(), h.content), children: [
14608
14617
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 mb-2 pb-2 border-b border-current/10", children: [
14609
- /* @__PURE__ */ u.jsx(Js, { className: te("h-4 w-4", J) }),
14618
+ /* @__PURE__ */ u.jsx(Js, { className: ne("h-4 w-4", J) }),
14610
14619
  a && /* @__PURE__ */ u.jsx("span", { className: "font-medium text-sm", children: "Assistant" })
14611
14620
  ] }),
14612
14621
  /* @__PURE__ */ u.jsx(
@@ -14617,36 +14626,36 @@ const Ya = Qh(function({
14617
14626
  }
14618
14627
  )
14619
14628
  ] }) }) : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
14620
- /* @__PURE__ */ u.jsx("div", { className: te(at(), h.container), children: /* @__PURE__ */ u.jsxs("div", { className: te(_t(), h.content), children: [
14629
+ /* @__PURE__ */ u.jsx("div", { className: ne(at(), h.container), children: /* @__PURE__ */ u.jsxs("div", { className: ne(_t(), h.content), children: [
14621
14630
  (i || a || G) && /* @__PURE__ */ u.jsxs(
14622
14631
  "div",
14623
14632
  {
14624
- className: te(
14633
+ className: ne(
14625
14634
  "flex items-center justify-between mb-2 pb-2 border-b border-current/10",
14626
- A && "mb-1 pb-1",
14635
+ N && "mb-1 pb-1",
14627
14636
  J,
14628
14637
  h.header
14629
14638
  ),
14630
14639
  children: [
14631
14640
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
14632
14641
  st(),
14633
- a && jt && /* @__PURE__ */ u.jsx("span", { className: te("font-medium", A ? "text-xs" : "text-sm"), children: jt }),
14642
+ a && jt && /* @__PURE__ */ u.jsx("span", { className: ne("font-medium", N ? "text-xs" : "text-sm"), children: jt }),
14634
14643
  G && /* @__PURE__ */ u.jsxs(
14635
14644
  Hf,
14636
14645
  {
14637
14646
  variant: "outline",
14638
- className: te(
14647
+ className: ne(
14639
14648
  "text-xs flex items-center gap-1 cursor-pointer select-none",
14640
14649
  J,
14641
14650
  "border border-current/40",
14642
- A && "text-xs h-4"
14651
+ N && "text-xs h-4"
14643
14652
  ),
14644
14653
  role: "button",
14645
14654
  tabIndex: 0,
14646
14655
  "aria-expanded": $ === "expanded",
14647
- onClick: () => E((N) => N === "expanded" ? "preview" : "expanded"),
14648
- onKeyDown: (N) => {
14649
- (N.key === "Enter" || N.key === " ") && (N.preventDefault(), E((X) => X === "expanded" ? "preview" : "expanded"));
14656
+ onClick: () => E((A) => A === "expanded" ? "preview" : "expanded"),
14657
+ onKeyDown: (A) => {
14658
+ (A.key === "Enter" || A.key === " ") && (A.preventDefault(), E((X) => X === "expanded" ? "preview" : "expanded"));
14650
14659
  },
14651
14660
  children: [
14652
14661
  /* @__PURE__ */ u.jsx("span", { children: re.name ?? "Tool Output" }),
@@ -14662,14 +14671,14 @@ const Ya = Qh(function({
14662
14671
  "button",
14663
14672
  {
14664
14673
  type: "button",
14665
- className: te(
14674
+ className: ne(
14666
14675
  "flex items-center justify-center rounded border px-1.5 py-1 transition-colors",
14667
14676
  lt < nt.length - 1 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
14668
14677
  ),
14669
14678
  onClick: () => {
14670
14679
  if (lt >= nt.length - 1) return;
14671
- const N = nt[lt + 1];
14672
- N && pt(N);
14680
+ const A = nt[lt + 1];
14681
+ A && pt(A);
14673
14682
  },
14674
14683
  "aria-label": "Older checkpoint (back in time)",
14675
14684
  disabled: lt >= nt.length - 1,
@@ -14685,7 +14694,7 @@ const Ya = Qh(function({
14685
14694
  "button",
14686
14695
  {
14687
14696
  type: "button",
14688
- className: te(
14697
+ className: ne(
14689
14698
  "flex items-center justify-center rounded border px-1.5 py-1 transition-colors",
14690
14699
  lt > 0 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
14691
14700
  ),
@@ -14694,8 +14703,8 @@ const Ya = Qh(function({
14694
14703
  if (lt === 1)
14695
14704
  pt(null, !0);
14696
14705
  else {
14697
- const N = nt[lt - 1];
14698
- N && pt(N, !1);
14706
+ const A = nt[lt - 1];
14707
+ A && pt(A, !1);
14699
14708
  }
14700
14709
  },
14701
14710
  "aria-label": "Newer checkpoint (forward in time)",
@@ -14707,7 +14716,7 @@ const Ya = Qh(function({
14707
14716
  i && t.createdAt && /* @__PURE__ */ u.jsx(
14708
14717
  "time",
14709
14718
  {
14710
- className: te("text-xs opacity-60", J, A && "text-xs"),
14719
+ className: ne("text-xs opacity-60", J, N && "text-xs"),
14711
14720
  dateTime: new Date(t.createdAt).toISOString(),
14712
14721
  title: new Date(t.createdAt).toLocaleString(),
14713
14722
  children: new Intl.DateTimeFormat(void 0, { hour: "2-digit", minute: "2-digit" }).format(new Date(t.createdAt))
@@ -14716,7 +14725,7 @@ const Ya = Qh(function({
14716
14725
  s && !o && /* @__PURE__ */ u.jsxs(
14717
14726
  "div",
14718
14727
  {
14719
- className: te(
14728
+ className: ne(
14720
14729
  "opacity-0 group-hover:opacity-100 transition-opacity",
14721
14730
  "flex items-center gap-1",
14722
14731
  h.actions
@@ -14728,10 +14737,10 @@ const Ya = Qh(function({
14728
14737
  variant: "ghost",
14729
14738
  size: "sm",
14730
14739
  onClick: () => xe(),
14731
- className: te("h-6 w-6 p-0 hover:bg-foreground/10", J, A && "h-5 w-5"),
14740
+ className: ne("h-6 w-6 p-0 hover:bg-foreground/10", J, N && "h-5 w-5"),
14732
14741
  "aria-label": "Copy message",
14733
14742
  title: "Copy message",
14734
- children: /* @__PURE__ */ u.jsx(rl, { className: te(P ? "text-success" : J, A ? "h-3 w-3" : "h-4 w-4") })
14743
+ children: /* @__PURE__ */ u.jsx(rl, { className: ne(P ? "text-success" : J, N ? "h-3 w-3" : "h-4 w-4") })
14735
14744
  }
14736
14745
  ) }),
14737
14746
  W === "user" && x && /* @__PURE__ */ u.jsx(
@@ -14740,9 +14749,9 @@ const Ya = Qh(function({
14740
14749
  variant: "ghost",
14741
14750
  size: "sm",
14742
14751
  onClick: Ue,
14743
- className: te("h-6 w-6 p-0 hover:bg-foreground/10", J, A && "h-5 w-5"),
14752
+ className: ne("h-6 w-6 p-0 hover:bg-foreground/10", J, N && "h-5 w-5"),
14744
14753
  "aria-label": "Edit message",
14745
- children: /* @__PURE__ */ u.jsx(ol, { className: te(J, A ? "h-3 w-3" : "h-4 w-4") })
14754
+ children: /* @__PURE__ */ u.jsx(ol, { className: ne(J, N ? "h-3 w-3" : "h-4 w-4") })
14746
14755
  }
14747
14756
  ),
14748
14757
  W === "assistant" && m && /* @__PURE__ */ u.jsx(
@@ -14751,9 +14760,9 @@ const Ya = Qh(function({
14751
14760
  variant: "ghost",
14752
14761
  size: "sm",
14753
14762
  onClick: We,
14754
- className: te("h-6 w-6 p-0 hover:bg-foreground/10", J, A && "h-5 w-5"),
14763
+ className: ne("h-6 w-6 p-0 hover:bg-foreground/10", J, N && "h-5 w-5"),
14755
14764
  "aria-label": "Regenerate response",
14756
- children: /* @__PURE__ */ u.jsx(Ti, { className: te(J, A ? "h-3 w-3" : "h-4 w-4") })
14765
+ children: /* @__PURE__ */ u.jsx(Ti, { className: ne(J, N ? "h-3 w-3" : "h-4 w-4") })
14757
14766
  }
14758
14767
  )
14759
14768
  ]
@@ -14765,9 +14774,9 @@ const Ya = Qh(function({
14765
14774
  ),
14766
14775
  /* @__PURE__ */ u.jsxs("div", { className: "relative", children: [
14767
14776
  Lt(),
14768
- p && ie.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "mt-3 space-y-4", children: ie.map((N, X) => /* @__PURE__ */ u.jsx(zC, { preview: N, idx: X }, `artifact-${X}`)) })
14777
+ p && ie.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "mt-3 space-y-4", children: ie.map((A, X) => /* @__PURE__ */ u.jsx(zC, { preview: A, idx: X }, `artifact-${X}`)) })
14769
14778
  ] }),
14770
- G && $ === "expanded" && (re.toolCallId || re.name) && /* @__PURE__ */ u.jsxs("div", { className: te("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", A && "text-xs"), children: [
14779
+ G && $ === "expanded" && (re.toolCallId || re.name) && /* @__PURE__ */ u.jsxs("div", { className: ne("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", N && "text-xs"), children: [
14771
14780
  re.name && /* @__PURE__ */ u.jsxs("div", { children: [
14772
14781
  "Function: ",
14773
14782
  re.name
@@ -14780,7 +14789,7 @@ const Ya = Qh(function({
14780
14789
  !(i || a || G) && s && !o && /* @__PURE__ */ u.jsxs(
14781
14790
  "div",
14782
14791
  {
14783
- className: te(
14792
+ className: ne(
14784
14793
  "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",
14785
14794
  "flex items-center gap-1",
14786
14795
  h.actions
@@ -14792,8 +14801,8 @@ const Ya = Qh(function({
14792
14801
  variant: "ghost",
14793
14802
  size: "sm",
14794
14803
  onClick: () => xe(),
14795
- className: te("h-6 w-6 p-0 hover:bg-background/50 text-current", A && "h-5 w-5"),
14796
- children: /* @__PURE__ */ u.jsx(rl, { className: te(P ? "text-success" : "text-current", A ? "h-3 w-3" : "h-4 w-4") })
14804
+ className: ne("h-6 w-6 p-0 hover:bg-background/50 text-current", N && "h-5 w-5"),
14805
+ children: /* @__PURE__ */ u.jsx(rl, { className: ne(P ? "text-success" : "text-current", N ? "h-3 w-3" : "h-4 w-4") })
14797
14806
  }
14798
14807
  ),
14799
14808
  W === "user" && x && /* @__PURE__ */ u.jsx(
@@ -14802,8 +14811,8 @@ const Ya = Qh(function({
14802
14811
  variant: "ghost",
14803
14812
  size: "sm",
14804
14813
  onClick: Ue,
14805
- className: te("h-6 w-6 p-0 hover:bg-background/50 text-current", A && "h-5 w-5"),
14806
- children: /* @__PURE__ */ u.jsx(ol, { className: te("text-current", A ? "h-3 w-3" : "h-4 w-4") })
14814
+ className: ne("h-6 w-6 p-0 hover:bg-background/50 text-current", N && "h-5 w-5"),
14815
+ children: /* @__PURE__ */ u.jsx(ol, { className: ne("text-current", N ? "h-3 w-3" : "h-4 w-4") })
14807
14816
  }
14808
14817
  ),
14809
14818
  W === "assistant" && m && /* @__PURE__ */ u.jsx(
@@ -14812,8 +14821,8 @@ const Ya = Qh(function({
14812
14821
  variant: "ghost",
14813
14822
  size: "sm",
14814
14823
  onClick: We,
14815
- className: te("h-6 w-6 p-0 hover:bg-background/50 text-current", A && "h-5 w-5"),
14816
- children: /* @__PURE__ */ u.jsx(Ti, { className: te("text-current", A ? "h-3 w-3" : "h-4 w-4") })
14824
+ className: ne("h-6 w-6 p-0 hover:bg-background/50 text-current", N && "h-5 w-5"),
14825
+ children: /* @__PURE__ */ u.jsx(Ti, { className: ne("text-current", N ? "h-3 w-3" : "h-4 w-4") })
14817
14826
  }
14818
14827
  )
14819
14828
  ]
@@ -15103,7 +15112,7 @@ const Rp = Q.forwardRef(({
15103
15112
  messagePreviews: F,
15104
15113
  createSyntheticThinkingMessage: j = !1
15105
15114
  }, Z) => {
15106
- const B = Le(null), A = Le(null), W = Le(!1), G = Le(!1), [oe, ve] = me(!0), je = De(() => w ? e.some((ie) => "type" in ie && ie.type === "default_message" ? !1 : Array.isArray(ie == null ? void 0 : ie.content) && ie.content.some(
15115
+ const B = Le(null), N = Le(null), W = Le(!1), G = Le(!1), [oe, ve] = me(!0), je = De(() => w ? e.some((ie) => "type" in ie && ie.type === "default_message" ? !1 : Array.isArray(ie == null ? void 0 : ie.content) && ie.content.some(
15107
15116
  (xe) => xe && xe.type === "interrupt" && (xe.id ?? xe.interrupt_id) === w.id
15108
15117
  )) : !1, [w, e]), q = De(() => {
15109
15118
  if (!w || je)
@@ -15193,7 +15202,7 @@ const Rp = Q.forwardRef(({
15193
15202
  G.current = !1;
15194
15203
  return;
15195
15204
  }
15196
- G.current || (G.current = !0, B.current ? (xe = (ie = B.current).scrollToIndex) == null || xe.call(ie, { index: 0, align: "start", behavior: "auto" }) : A.current && (A.current.scrollTop = 0));
15205
+ G.current || (G.current = !0, B.current ? (xe = (ie = B.current).scrollToIndex) == null || xe.call(ie, { index: 0, align: "start", behavior: "auto" }) : N.current && (N.current.scrollTop = 0));
15197
15206
  }, [tt]), em(
15198
15207
  Z,
15199
15208
  () => ({
@@ -15206,7 +15215,7 @@ const Rp = Q.forwardRef(({
15206
15215
  align: "end",
15207
15216
  behavior: "auto"
15208
15217
  });
15209
- } else A.current && (A.current.scrollTop = A.current.scrollHeight);
15218
+ } else N.current && (N.current.scrollTop = N.current.scrollHeight);
15210
15219
  },
15211
15220
  scrollToTop: () => {
15212
15221
  var ie, xe;
@@ -15214,7 +15223,7 @@ const Rp = Q.forwardRef(({
15214
15223
  index: 0,
15215
15224
  align: "start",
15216
15225
  behavior: "auto"
15217
- }) : A.current && (A.current.scrollTop = 0);
15226
+ }) : N.current && (N.current.scrollTop = 0);
15218
15227
  }
15219
15228
  }),
15220
15229
  [D]
@@ -15227,7 +15236,7 @@ const Rp = Q.forwardRef(({
15227
15236
  B.current = ie;
15228
15237
  },
15229
15238
  scrollerRef: (ie) => {
15230
- A.current = ie instanceof HTMLDivElement ? ie : null;
15239
+ N.current = ie instanceof HTMLDivElement ? ie : null;
15231
15240
  },
15232
15241
  data: D,
15233
15242
  followOutput: ae,
@@ -15308,7 +15317,7 @@ function Si({
15308
15317
  metadata: P,
15309
15318
  timelineCheckpoints: M,
15310
15319
  messagePreviews: $
15311
- } = ua(), { isStreaming: E, error: F, connectionState: j, submit: Z, stop: B } = Jx(), A = w ?? g ?? null, W = (R == null ? void 0 : R.id) ?? null, G = (R == null ? void 0 : R.namespace) ?? null, oe = (P == null ? void 0 : P.assemblingMessageId) ?? null, ve = L, [je, q] = me(!1);
15320
+ } = ua(), { isStreaming: E, error: F, connectionState: j, submit: Z, stop: B } = Jx(), N = w ?? g ?? null, W = (R == null ? void 0 : R.id) ?? null, G = (R == null ? void 0 : R.namespace) ?? null, oe = (P == null ? void 0 : P.assemblingMessageId) ?? null, ve = L, [je, q] = me(!1);
15312
15321
  yt(() => {
15313
15322
  ve || q(!1);
15314
15323
  }, [ve]);
@@ -15318,7 +15327,7 @@ function Si({
15318
15327
  q(!1);
15319
15328
  }, []), D = !!ve || je, [V, J] = me(null), [ae, re] = me(""), [Ne, He] = me(null), [Oe, Ye] = me(null), [qe, tt] = me([]), [Xe, ie] = me(0), [xe, Ue] = me(0), [We, st] = me(!1), [at, _t] = me(null), [vt, gt] = me(null), [bt, Tt] = me(!1), [Lt, jt] = me(null), nt = Le(!1), [Rt, pn] = me(() => Pc.value), Qe = Le(Rt), et = Le(null), pt = ge((de) => {
15320
15329
  Pc.value = de, pn(de);
15321
- }, []), [lt, K] = me(!1), N = Le(null), { checkpointMetaById: X, checkpointIndexByKey: ne, attemptMetaById: fe, userMessageIdToAttempts: Re } = p0(_), be = M ?? [], ze = Le(null), Me = Le(null), Ee = ge(() => {
15330
+ }, []), [lt, K] = me(!1), A = Le(null), { checkpointMetaById: X, checkpointIndexByKey: te, attemptMetaById: fe, userMessageIdToAttempts: we } = p0(_), Se = M ?? [], ze = Le(null), Me = Le(null), Ee = ge(() => {
15322
15331
  ze.current && (ze.current.value = ""), Me.current && (Me.current.value = ""), ie((de) => de + 1), Ue((de) => de + 1);
15323
15332
  }, []), Wt = ge(
15324
15333
  (de) => {
@@ -15332,13 +15341,13 @@ function Si({
15332
15341
  const [Vn, ur] = me("desktop");
15333
15342
  yt(() => {
15334
15343
  const de = () => {
15335
- const Se = window.innerWidth;
15336
- ur(Se < 640 ? "phone" : Se < 1024 ? "tablet" : "desktop");
15344
+ const Ce = window.innerWidth;
15345
+ ur(Ce < 640 ? "phone" : Ce < 1024 ? "tablet" : "desktop");
15337
15346
  };
15338
15347
  return de(), window.addEventListener("resize", de), () => window.removeEventListener("resize", de);
15339
15348
  }, []), yt(() => {
15340
15349
  nt.current = !1;
15341
- }, [A]), yt(() => {
15350
+ }, [N]), yt(() => {
15342
15351
  Qe.current = Rt;
15343
15352
  }, [Rt]), yt(() => {
15344
15353
  if (!V) {
@@ -15353,10 +15362,10 @@ function Si({
15353
15362
  return;
15354
15363
  }
15355
15364
  try {
15356
- const Ie = (await y.getAgent("default")).uiDefaultMessage || "";
15357
- jt(Ie || null);
15358
- } catch (Se) {
15359
- console.warn("Failed to fetch default message:", Se), jt(null);
15365
+ const ke = (await y.getAgent("default")).uiDefaultMessage || "";
15366
+ jt(ke || null);
15367
+ } catch (Ce) {
15368
+ console.warn("Failed to fetch default message:", Ce), jt(null);
15360
15369
  }
15361
15370
  })();
15362
15371
  }, [y.baseUrl]), yt(() => {
@@ -15367,66 +15376,66 @@ function Si({
15367
15376
  return `Message too long (${de.length}/${Bo} characters)`;
15368
15377
  try {
15369
15378
  return g0(de), null;
15370
- } catch (Se) {
15371
- return (Se == null ? void 0 : Se.message) || "Invalid message";
15379
+ } catch (Ce) {
15380
+ return (Ce == null ? void 0 : Ce.message) || "Invalid message";
15372
15381
  }
15373
15382
  }, _n = async (de) => {
15374
- const Se = de.trim();
15375
- if (!(!Se && qe.length === 0)) {
15376
- if (Se) {
15377
- const Ie = Pr(Se);
15378
- if (Ie) {
15379
- Ye(Ie);
15383
+ const Ce = de.trim();
15384
+ if (!(!Ce && qe.length === 0)) {
15385
+ if (Ce) {
15386
+ const ke = Pr(Ce);
15387
+ if (ke) {
15388
+ Ye(ke);
15380
15389
  return;
15381
15390
  }
15382
15391
  }
15383
15392
  try {
15384
- const Ie = V ? (Ne == null ? void 0 : Ne.checkpointId) ?? W ?? void 0 : W ?? void 0, Ge = V ? (Ne == null ? void 0 : Ne.checkpointNs) ?? G ?? void 0 : G ?? void 0;
15393
+ const ke = V ? (Ne == null ? void 0 : Ne.checkpointId) ?? W ?? void 0 : W ?? void 0, Ge = V ? (Ne == null ? void 0 : Ne.checkpointNs) ?? G ?? void 0 : G ?? void 0;
15385
15394
  await Z(
15386
15395
  {
15387
- text: Se || "",
15396
+ text: Ce || "",
15388
15397
  attachments: qe
15389
15398
  },
15390
15399
  {
15391
- checkpointId: Ie,
15400
+ checkpointId: ke,
15392
15401
  checkpointNs: Ge,
15393
15402
  edit: !!V,
15394
15403
  originalMessageId: V ?? void 0
15395
15404
  }
15396
- ), h == null || h(Se), pt(""), Ye(null), tt([]), Ee(), J(null), re(""), He(null);
15397
- } catch (Ie) {
15398
- const Ge = (Ie == null ? void 0 : Ie.message) || "Failed to send message";
15405
+ ), h == null || h(Ce), pt(""), Ye(null), tt([]), Ee(), J(null), re(""), He(null);
15406
+ } catch (ke) {
15407
+ const Ge = (ke == null ? void 0 : ke.message) || "Failed to send message";
15399
15408
  Ye(Ge), m == null || m(Ge);
15400
15409
  }
15401
15410
  }
15402
15411
  }, Kn = Q.useCallback(
15403
- (de, Se, Ie) => {
15404
- c && (et.current = Rt, J(de), re(Se), pt(Se), Ye(null), He({
15405
- checkpointId: (Ie == null ? void 0 : Ie.checkpointId) ?? null,
15406
- checkpointNs: (Ie == null ? void 0 : Ie.checkpointNs) ?? null
15412
+ (de, Ce, ke) => {
15413
+ c && (et.current = Rt, J(de), re(Ce), pt(Ce), Ye(null), He({
15414
+ checkpointId: (ke == null ? void 0 : ke.checkpointId) ?? null,
15415
+ checkpointNs: (ke == null ? void 0 : ke.checkpointNs) ?? null
15407
15416
  }));
15408
15417
  },
15409
15418
  [Rt, c, pt]
15410
15419
  ), k = Q.useCallback(() => {
15411
15420
  J(null), re(""), He(null), Ye(null), pt(et.current ?? Rt), et.current = null;
15412
15421
  }, [Rt, pt]), H = ge(
15413
- (de, Se, Ie) => {
15414
- Kn(de, Se, Ie);
15422
+ (de, Ce, ke) => {
15423
+ Kn(de, Ce, ke);
15415
15424
  },
15416
15425
  [Kn]
15417
15426
  ), se = ge((de) => {
15418
- let Se = null;
15427
+ let Ce = null;
15419
15428
  for (let Yt = de - 1; Yt >= 0; Yt--)
15420
15429
  if (b[Yt].role === "user") {
15421
- Se = b[Yt];
15430
+ Ce = b[Yt];
15422
15431
  break;
15423
15432
  }
15424
- if (!Se) return;
15425
- const Ie = Array.isArray(Se.content) ? Se.content : [], jn = Ie.filter((Yt) => (Yt == null ? void 0 : Yt.type) === "text").map((Yt) => Yt.text).join("") || (() => {
15433
+ if (!Ce) return;
15434
+ const ke = Array.isArray(Ce.content) ? Ce.content : [], jn = ke.filter((Yt) => (Yt == null ? void 0 : Yt.type) === "text").map((Yt) => Yt.text).join("") || (() => {
15426
15435
  try {
15427
- return JSON.stringify(Ie, null, 2);
15436
+ return JSON.stringify(ke, null, 2);
15428
15437
  } catch {
15429
- return String(Ie);
15438
+ return String(ke);
15430
15439
  }
15431
15440
  })();
15432
15441
  jn && Z(
@@ -15435,34 +15444,34 @@ function Si({
15435
15444
  checkpointId: W ?? void 0,
15436
15445
  checkpointNs: G ?? void 0,
15437
15446
  edit: !0,
15438
- originalMessageId: Se.id
15447
+ originalMessageId: Ce.id
15439
15448
  }
15440
15449
  );
15441
- }, [b, Z, W, G]), we = (de) => {
15442
- const Se = Array.from(de.target.files || []);
15443
- tt((Ie) => [...Ie, ...Se]), de.target.value = "";
15450
+ }, [b, Z, W, G]), be = (de) => {
15451
+ const Ce = Array.from(de.target.files || []);
15452
+ tt((ke) => [...ke, ...Ce]), de.target.value = "";
15444
15453
  }, Je = (de) => {
15445
- tt((Se) => {
15446
- const Ie = Se.filter((Ge, jn) => de !== jn);
15447
- return Ie.length === 0 && Ee(), Ie;
15454
+ tt((Ce) => {
15455
+ const ke = Ce.filter((Ge, jn) => de !== jn);
15456
+ return ke.length === 0 && Ee(), ke;
15448
15457
  });
15449
15458
  }, it = async (de) => {
15450
- const Se = (de.target.files || [])[0];
15451
- if (Se) {
15459
+ const Ce = (de.target.files || [])[0];
15460
+ if (Ce) {
15452
15461
  _t(null), gt(null), st(!0);
15453
15462
  try {
15454
15463
  await Z(
15455
- { attachments: [Se] },
15464
+ { attachments: [Ce] },
15456
15465
  {
15457
15466
  checkpointId: W ?? void 0,
15458
15467
  checkpointNs: G ?? void 0
15459
15468
  }
15460
15469
  );
15461
- const Ie = `Uploaded ${Se.name} - processing through chat stream`;
15462
- gt(Ie);
15463
- } catch (Ie) {
15464
- const Ge = Ie instanceof Error ? Ie.message : "Failed to upload Excel file";
15465
- console.error("Excel upload failed", Ie), _t(Ge), m == null || m(Ge);
15470
+ const ke = `Uploaded ${Ce.name} - processing through chat stream`;
15471
+ gt(ke);
15472
+ } catch (ke) {
15473
+ const Ge = ke instanceof Error ? ke.message : "Failed to upload Excel file";
15474
+ console.error("Excel upload failed", ke), _t(Ge), m == null || m(Ge);
15466
15475
  } finally {
15467
15476
  st(!1), de.target.value = "", Ee();
15468
15477
  }
@@ -15474,22 +15483,22 @@ function Si({
15474
15483
  if (!de) {
15475
15484
  await I(), requestAnimationFrame(() => {
15476
15485
  var Ge;
15477
- (Ge = N.current) == null || Ge.scrollToLatest();
15486
+ (Ge = A.current) == null || Ge.scrollToLatest();
15478
15487
  });
15479
15488
  return;
15480
15489
  }
15481
- const Se = _.find((Ge) => Ge.checkpointId === de), Ie = (Se == null ? void 0 : Se.checkpointNs) ?? null;
15482
- await C(de, Ie), requestAnimationFrame(() => {
15490
+ const Ce = _.find((Ge) => Ge.checkpointId === de), ke = (Ce == null ? void 0 : Ce.checkpointNs) ?? null;
15491
+ await C(de, ke), requestAnimationFrame(() => {
15483
15492
  var Ge;
15484
- (Ge = N.current) == null || Ge.scrollToTop();
15493
+ (Ge = A.current) == null || Ge.scrollToTop();
15485
15494
  });
15486
15495
  } finally {
15487
15496
  K(!1);
15488
15497
  }
15489
15498
  }
15490
15499
  }, Fe = ge(
15491
- async (de, Se, Ie) => {
15492
- await Be(Ie ? null : de);
15500
+ async (de, Ce, ke) => {
15501
+ await Be(ke ? null : de);
15493
15502
  },
15494
15503
  [Be]
15495
15504
  ), Et = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${p.container || ""}`, xt = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-hidden overscroll-contain break-words break-anywhere p-4 bg-transparent ${p.messagesArea || ""}`, wt = `flex-shrink-0 w-full border-t p-4 bg-transparent ${p.inputArea || ""}`;
@@ -15517,7 +15526,7 @@ function Si({
15517
15526
  /* @__PURE__ */ u.jsx(
15518
15527
  Rp,
15519
15528
  {
15520
- ref: N,
15529
+ ref: A,
15521
15530
  className: "h-full",
15522
15531
  style: { height: "100%" },
15523
15532
  messages: b,
@@ -15540,12 +15549,12 @@ function Si({
15540
15549
  showToolMessages: d,
15541
15550
  showArtifactPreviews: f,
15542
15551
  checkpointMetaById: X,
15543
- checkpointIndexByKey: ne,
15552
+ checkpointIndexByKey: te,
15544
15553
  attemptMetaById: fe,
15545
- userMessageIdToAttempts: Re,
15554
+ userMessageIdToAttempts: we,
15546
15555
  activeCheckpointId: W,
15547
15556
  onSelectCheckpoint: Fe,
15548
- timelineCheckpoints: be,
15557
+ timelineCheckpoints: Se,
15549
15558
  messagePreviews: $
15550
15559
  }
15551
15560
  ),
@@ -15590,12 +15599,12 @@ function Si({
15590
15599
  ref: ze,
15591
15600
  type: "file",
15592
15601
  multiple: !0,
15593
- onChange: (de) => we(de),
15602
+ onChange: (de) => be(de),
15594
15603
  className: "hidden"
15595
15604
  },
15596
15605
  Xe
15597
15606
  ),
15598
- qe.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "flex flex-wrap gap-2", children: qe.map((de, Se) => /* @__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: [
15607
+ qe.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "flex flex-wrap gap-2", children: qe.map((de, Ce) => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100", children: [
15599
15608
  /* @__PURE__ */ u.jsx(Ci, { size: 14 }),
15600
15609
  /* @__PURE__ */ u.jsx("span", { className: "truncate max-w-[150px]", children: de.name }),
15601
15610
  /* @__PURE__ */ u.jsx(
@@ -15603,13 +15612,13 @@ function Si({
15603
15612
  {
15604
15613
  variant: "ghost",
15605
15614
  size: "sm",
15606
- onClick: () => Je(Se),
15615
+ onClick: () => Je(Ce),
15607
15616
  className: "h-4 w-4 p-0 text-gray-500 dark:text-gray-400 hover:text-red-500 dark:hover:text-red-400",
15608
15617
  "aria-label": `Remove ${de.name}`,
15609
15618
  children: /* @__PURE__ */ u.jsx(gr, { size: 12 })
15610
15619
  }
15611
15620
  )
15612
- ] }, Se)) })
15621
+ ] }, Ce)) })
15613
15622
  ] }),
15614
15623
  l && /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
15615
15624
  /* @__PURE__ */ u.jsx(
@@ -15697,7 +15706,7 @@ const cs = v.forwardRef(
15697
15706
  "input",
15698
15707
  {
15699
15708
  type: t,
15700
- className: te(
15709
+ className: ne(
15701
15710
  "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
15702
15711
  e
15703
15712
  ),
@@ -16225,7 +16234,7 @@ const zp = v.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
16225
16234
  Bp,
16226
16235
  {
16227
16236
  ref: r,
16228
- className: te("relative overflow-hidden", e),
16237
+ className: ne("relative overflow-hidden", e),
16229
16238
  ...n,
16230
16239
  children: [
16231
16240
  /* @__PURE__ */ u.jsx(aT, { className: "h-full w-full rounded-[inherit] overflow-auto", children: t }),
@@ -16240,7 +16249,7 @@ const Hp = v.forwardRef(({ className: e, orientation: t = "vertical", ...n }, r)
16240
16249
  {
16241
16250
  ref: r,
16242
16251
  orientation: t,
16243
- className: te(
16252
+ className: ne(
16244
16253
  "flex touch-none select-none transition-colors",
16245
16254
  t === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
16246
16255
  t === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
@@ -16324,7 +16333,7 @@ function Dc({
16324
16333
  }
16325
16334
  }, B = (q, z) => {
16326
16335
  z.stopPropagation(), L(q.threadId), M(q.title || `Thread ${q.threadId.slice(0, 8)}`);
16327
- }, A = async (q) => {
16336
+ }, N = async (q) => {
16328
16337
  if (P.trim())
16329
16338
  try {
16330
16339
  await b(q, P.trim()), L(null), M("");
@@ -16334,7 +16343,7 @@ function Dc({
16334
16343
  }, W = () => {
16335
16344
  L(null), M("");
16336
16345
  }, G = (q, z) => {
16337
- q.key === "Enter" ? A(z) : q.key === "Escape" && W();
16346
+ q.key === "Enter" ? N(z) : q.key === "Escape" && W();
16338
16347
  }, oe = (q) => {
16339
16348
  if (!q) return "";
16340
16349
  try {
@@ -16381,7 +16390,7 @@ function Dc({
16381
16390
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center justify-between", children: [
16382
16391
  /* @__PURE__ */ u.jsx("div", { className: "flex-1 min-w-0", children: _ === q.threadId ? /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", onClick: (z) => z.stopPropagation(), children: [
16383
16392
  /* @__PURE__ */ u.jsx(cs, { value: P, onChange: (z) => M(z.target.value), onKeyDown: (z) => G(z, q.threadId), className: "h-6 text-sm", autoFocus: !0 }),
16384
- /* @__PURE__ */ u.jsx(rt, { variant: "ghost", size: "sm", onClick: () => A(q.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(ta, { size: 12 }) }),
16393
+ /* @__PURE__ */ u.jsx(rt, { variant: "ghost", size: "sm", onClick: () => N(q.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(ta, { size: 12 }) }),
16385
16394
  /* @__PURE__ */ u.jsx(rt, { variant: "ghost", size: "sm", onClick: W, className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(gr, { size: 12 }) })
16386
16395
  ] }) : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
16387
16396
  /* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: je(q) }),
@@ -16535,7 +16544,7 @@ const mT = ms(
16535
16544
  Gp,
16536
16545
  {
16537
16546
  ref: n,
16538
- className: te(mT(), e),
16547
+ className: ne(mT(), e),
16539
16548
  ...t
16540
16549
  }
16541
16550
  ));
@@ -16785,24 +16794,24 @@ var on = 10, [sh, Wn] = jr(or), kT = "SelectContentImpl", RT = br("SelectContent
16785
16794
  v.useEffect(() => {
16786
16795
  $ && Z();
16787
16796
  }, [$, Z]);
16788
- const { onOpenChange: B, triggerPointerDownPosRef: A } = w;
16797
+ const { onOpenChange: B, triggerPointerDownPosRef: N } = w;
16789
16798
  v.useEffect(() => {
16790
16799
  if (b) {
16791
16800
  let Y = { x: 0, y: 0 };
16792
16801
  const D = (J) => {
16793
16802
  var ae, re;
16794
16803
  Y = {
16795
- x: Math.abs(Math.round(J.pageX) - (((ae = A.current) == null ? void 0 : ae.x) ?? 0)),
16796
- y: Math.abs(Math.round(J.pageY) - (((re = A.current) == null ? void 0 : re.y) ?? 0))
16804
+ x: Math.abs(Math.round(J.pageX) - (((ae = N.current) == null ? void 0 : ae.x) ?? 0)),
16805
+ y: Math.abs(Math.round(J.pageY) - (((re = N.current) == null ? void 0 : re.y) ?? 0))
16797
16806
  };
16798
16807
  }, V = (J) => {
16799
- Y.x <= 10 && Y.y <= 10 ? J.preventDefault() : b.contains(J.target) || B(!1), document.removeEventListener("pointermove", D), A.current = null;
16808
+ Y.x <= 10 && Y.y <= 10 ? J.preventDefault() : b.contains(J.target) || B(!1), document.removeEventListener("pointermove", D), N.current = null;
16800
16809
  };
16801
- return A.current !== null && (document.addEventListener("pointermove", D), document.addEventListener("pointerup", V, { capture: !0, once: !0 })), () => {
16810
+ return N.current !== null && (document.addEventListener("pointermove", D), document.addEventListener("pointerup", V, { capture: !0, once: !0 })), () => {
16802
16811
  document.removeEventListener("pointermove", D), document.removeEventListener("pointerup", V, { capture: !0 });
16803
16812
  };
16804
16813
  }
16805
- }, [b, B, A]), v.useEffect(() => {
16814
+ }, [b, B, N]), v.useEffect(() => {
16806
16815
  const Y = () => B(!1);
16807
16816
  return window.addEventListener("blur", Y), window.addEventListener("resize", Y), () => {
16808
16817
  window.removeEventListener("blur", Y), window.removeEventListener("resize", Y);
@@ -16936,7 +16945,7 @@ var ET = "SelectItemAlignedPosition", ah = v.forwardRef((e, t) => {
16936
16945
  ]);
16937
16946
  a.style.minWidth = He + "px", a.style.right = qe + "px";
16938
16947
  }
16939
- const P = p(), M = window.innerHeight - on * 2, $ = m.scrollHeight, E = window.getComputedStyle(c), F = parseInt(E.borderTopWidth, 10), j = parseInt(E.paddingTop, 10), Z = parseInt(E.borderBottomWidth, 10), B = parseInt(E.paddingBottom, 10), A = F + j + $ + B + Z, W = Math.min(y.offsetHeight * 5, A), G = window.getComputedStyle(m), oe = parseInt(G.paddingTop, 10), ve = parseInt(G.paddingBottom, 10), je = I.top + I.height / 2 - on, q = M - je, z = y.offsetHeight / 2, Y = y.offsetTop + z, D = F + j + Y, V = A - D;
16948
+ const P = p(), M = window.innerHeight - on * 2, $ = m.scrollHeight, E = window.getComputedStyle(c), F = parseInt(E.borderTopWidth, 10), j = parseInt(E.paddingTop, 10), Z = parseInt(E.borderBottomWidth, 10), B = parseInt(E.paddingBottom, 10), N = F + j + $ + B + Z, W = Math.min(y.offsetHeight * 5, N), G = window.getComputedStyle(m), oe = parseInt(G.paddingTop, 10), ve = parseInt(G.paddingBottom, 10), je = I.top + I.height / 2 - on, q = M - je, z = y.offsetHeight / 2, Y = y.offsetTop + z, D = F + j + Y, V = N - D;
16940
16949
  if (D <= je) {
16941
16950
  const ae = P.length > 0 && y === P[P.length - 1].ref.current;
16942
16951
  a.style.bottom = "0px";
@@ -17376,7 +17385,7 @@ const Lc = FT, $c = BT, Qi = v.forwardRef(({ className: e, children: t, ...n },
17376
17385
  Ih,
17377
17386
  {
17378
17387
  ref: r,
17379
- className: te(
17388
+ className: ne(
17380
17389
  "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
17381
17390
  e
17382
17391
  ),
@@ -17392,7 +17401,7 @@ const jh = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17392
17401
  Ah,
17393
17402
  {
17394
17403
  ref: n,
17395
- className: te(
17404
+ className: ne(
17396
17405
  "flex cursor-default items-center justify-center py-1",
17397
17406
  e
17398
17407
  ),
@@ -17405,7 +17414,7 @@ const Ph = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17405
17414
  Nh,
17406
17415
  {
17407
17416
  ref: n,
17408
- className: te(
17417
+ className: ne(
17409
17418
  "flex cursor-default items-center justify-center py-1",
17410
17419
  e
17411
17420
  ),
@@ -17418,7 +17427,7 @@ const ea = v.forwardRef(({ className: e, children: t, position: n = "popper", ..
17418
17427
  kh,
17419
17428
  {
17420
17429
  ref: o,
17421
- className: te(
17430
+ className: ne(
17422
17431
  "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
17423
17432
  n === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
17424
17433
  e
@@ -17430,7 +17439,7 @@ const ea = v.forwardRef(({ className: e, children: t, position: n = "popper", ..
17430
17439
  /* @__PURE__ */ u.jsx(
17431
17440
  UT,
17432
17441
  {
17433
- className: te(
17442
+ className: ne(
17434
17443
  "p-1",
17435
17444
  n === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
17436
17445
  ),
@@ -17446,7 +17455,7 @@ const KT = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17446
17455
  Rh,
17447
17456
  {
17448
17457
  ref: n,
17449
- className: te("py-1.5 pl-8 pr-2 text-sm font-semibold", e),
17458
+ className: ne("py-1.5 pl-8 pr-2 text-sm font-semibold", e),
17450
17459
  ...t
17451
17460
  }
17452
17461
  ));
@@ -17455,7 +17464,7 @@ const qn = v.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
17455
17464
  Eh,
17456
17465
  {
17457
17466
  ref: r,
17458
- className: te(
17467
+ className: ne(
17459
17468
  "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
17460
17469
  e
17461
17470
  ),
@@ -17471,7 +17480,7 @@ const qT = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17471
17480
  _h,
17472
17481
  {
17473
17482
  ref: n,
17474
- className: te("-mx-1 my-1 h-px bg-muted", e),
17483
+ className: ne("-mx-1 my-1 h-px bg-muted", e),
17475
17484
  ...t
17476
17485
  }
17477
17486
  ));
@@ -17500,7 +17509,7 @@ const Dh = v.forwardRef(
17500
17509
  ref: o,
17501
17510
  decorative: n,
17502
17511
  orientation: t,
17503
- className: te(
17512
+ className: ne(
17504
17513
  "shrink-0 bg-border",
17505
17514
  t === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
17506
17515
  e
@@ -17513,7 +17522,7 @@ Dh.displayName = Oh.displayName;
17513
17522
  const JT = lp, ZT = cC, QT = cp, Lh = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17514
17523
  Hs,
17515
17524
  {
17516
- className: te(
17525
+ className: ne(
17517
17526
  "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
17518
17527
  e
17519
17528
  ),
@@ -17543,7 +17552,7 @@ const eI = ms(
17543
17552
  Us,
17544
17553
  {
17545
17554
  ref: o,
17546
- className: te(eI({ side: e }), t),
17555
+ className: ne(eI({ side: e }), t),
17547
17556
  ...r,
17548
17557
  children: [
17549
17558
  n,
@@ -17562,7 +17571,7 @@ const Fh = ({
17562
17571
  }) => /* @__PURE__ */ u.jsx(
17563
17572
  "div",
17564
17573
  {
17565
- className: te(
17574
+ className: ne(
17566
17575
  "flex flex-col space-y-2 text-center sm:text-left",
17567
17576
  e
17568
17577
  ),
@@ -17574,7 +17583,7 @@ const Bh = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17574
17583
  Jn,
17575
17584
  {
17576
17585
  ref: n,
17577
- className: te("text-lg font-semibold text-foreground", e),
17586
+ className: ne("text-lg font-semibold text-foreground", e),
17578
17587
  ...t
17579
17588
  }
17580
17589
  ));
@@ -17583,7 +17592,7 @@ const zh = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17583
17592
  Ws,
17584
17593
  {
17585
17594
  ref: n,
17586
- className: te("text-sm text-muted-foreground", e),
17595
+ className: ne("text-sm text-muted-foreground", e),
17587
17596
  ...t
17588
17597
  }
17589
17598
  ));
@@ -17708,7 +17717,7 @@ var qh = Hh, sI = Wh;
17708
17717
  const Mn = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17709
17718
  qh,
17710
17719
  {
17711
- className: te(
17720
+ className: ne(
17712
17721
  "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
17713
17722
  e
17714
17723
  ),
@@ -17717,7 +17726,7 @@ const Mn = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17717
17726
  children: /* @__PURE__ */ u.jsx(
17718
17727
  sI,
17719
17728
  {
17720
- className: te(
17729
+ className: ne(
17721
17730
  "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
17722
17731
  )
17723
17732
  }