teodor-new-chat-ui 4.3.145 → 4.3.147

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
@@ -371,7 +371,7 @@ function zg() {
371
371
  function et(E) {
372
372
  return "" + E;
373
373
  }
374
- function Pt(E) {
374
+ function Mt(E) {
375
375
  if (qe(E))
376
376
  return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Je(E)), et(E);
377
377
  }
@@ -454,7 +454,7 @@ function zg() {
454
454
  function Ve(E, Y, ae, Te, Ye) {
455
455
  {
456
456
  var Ge, Ue = {}, Oe = null, _t = null;
457
- ae !== void 0 && (Pt(ae), Oe = "" + ae), Yt(Y) && (Pt(Y.key), Oe = "" + Y.key), it(Y) && (_t = Y.ref, Xt(Y, Ye));
457
+ ae !== void 0 && (Mt(ae), Oe = "" + ae), Yt(Y) && (Mt(Y.key), Oe = "" + Y.key), it(Y) && (_t = Y.ref, Xt(Y, Ye));
458
458
  for (Ge in Y)
459
459
  Pe.call(Y, Ge) && !tt.hasOwnProperty(Ge) && (Ue[Ge] = Y[Ge]);
460
460
  if (E && E.defaultProps) {
@@ -469,13 +469,13 @@ function zg() {
469
469
  return ft(E, Oe, _t, Ye, Te, kt.current, Ue);
470
470
  }
471
471
  }
472
- var Dt = y.ReactCurrentOwner, Ot = y.ReactDebugCurrentFrame;
472
+ var Dt = y.ReactCurrentOwner, Pt = y.ReactDebugCurrentFrame;
473
473
  function G(E) {
474
474
  if (E) {
475
475
  var Y = E._owner, ae = ye(E.type, E._source, Y ? Y.type : null);
476
- Ot.setExtraStackFrame(ae);
476
+ Pt.setExtraStackFrame(ae);
477
477
  } else
478
- Ot.setExtraStackFrame(null);
478
+ Pt.setExtraStackFrame(null);
479
479
  }
480
480
  var Re;
481
481
  Re = !1;
@@ -3393,13 +3393,13 @@ function Gy(e = {}) {
3393
3393
  Xe = { Authorization: `Bearer ${r}` };
3394
3394
  else if (typeof window < "u") {
3395
3395
  const Ve = window.__AUTH_TOKEN__, Dt = ((ge = window.localStorage) == null ? void 0 : ge.getItem("authToken")) || null;
3396
- let Ot = null;
3396
+ let Pt = null;
3397
3397
  try {
3398
3398
  const Re = (_e = window.localStorage) == null ? void 0 : _e.getItem("chat-settings");
3399
- Re && (Ot = ((J = JSON.parse(Re)) == null ? void 0 : J.apiKey) || null);
3399
+ Re && (Pt = ((J = JSON.parse(Re)) == null ? void 0 : J.apiKey) || null);
3400
3400
  } catch {
3401
3401
  }
3402
- const G = Ve || Dt || Ot || null;
3402
+ const G = Ve || Dt || Pt || null;
3403
3403
  G && (Xe = { Authorization: `Bearer ${G}` });
3404
3404
  }
3405
3405
  } catch {
@@ -3442,7 +3442,7 @@ function Gy(e = {}) {
3442
3442
  throw (ke = j == null ? void 0 : j.onConnectionError) == null || ke.call(j, Ve), ne = !0, F = "error", L = Ve, new Error(Ve);
3443
3443
  }
3444
3444
  w(!0);
3445
- const et = qe.body.getReader(), Pt = new TextDecoder();
3445
+ const et = qe.body.getReader(), Mt = new TextDecoder();
3446
3446
  let kt = "", tt = [];
3447
3447
  C.current = 0, x(0);
3448
3448
  let vt = 0, At = null;
@@ -3464,14 +3464,14 @@ function Gy(e = {}) {
3464
3464
  }
3465
3465
  }, 5e3), Zt = 1024 * 1024;
3466
3466
  try {
3467
- const ft = qe.headers.get("X-Thread-Id") || qe.headers.get("x-thread-id"), Ve = qe.headers.get("X-Thread-Created") || qe.headers.get("x-thread-created"), Dt = ft ?? null, Ot = String(Ve ?? "").toLowerCase() === "true";
3467
+ const ft = qe.headers.get("X-Thread-Id") || qe.headers.get("x-thread-id"), Ve = qe.headers.get("X-Thread-Created") || qe.headers.get("x-thread-created"), Dt = ft ?? null, Pt = String(Ve ?? "").toLowerCase() === "true";
3468
3468
  for (b.current && !b.current.threadId && (b.current = {
3469
3469
  ...b.current,
3470
3470
  threadId: Dt
3471
- }), (ee = j == null ? void 0 : j.onOpen) == null || ee.call(j, { threadId: Dt, created: Ot }); ; ) {
3471
+ }), (ee = j == null ? void 0 : j.onOpen) == null || ee.call(j, { threadId: Dt, created: Pt }); ; ) {
3472
3472
  const { value: G, done: Re } = await et.read();
3473
3473
  if (Re) break;
3474
- kt += Pt.decode(G, { stream: !0 }), kt.length > Zt && (kt = "", console.warn("Stream buffer reset: exceeded 1MB"));
3474
+ kt += Mt.decode(G, { stream: !0 }), kt.length > Zt && (kt = "", console.warn("Stream buffer reset: exceeded 1MB"));
3475
3475
  let ve;
3476
3476
  for (; (ve = kt.indexOf(`
3477
3477
 
@@ -4250,7 +4250,7 @@ function wv({
4250
4250
  St(() => {
4251
4251
  Ce.current = k;
4252
4252
  }, [k]);
4253
- const Xe = Ee(!1), st = Ee([]), Qe = Ee(null), Je = Ee(null), qe = Ee(/* @__PURE__ */ new Map()), et = Ee(k), Pt = Ee(!1), kt = Ee(null), tt = Ee(/* @__PURE__ */ new Map()), vt = Ee(/* @__PURE__ */ new Map()), {
4253
+ const Xe = Ee(!1), st = Ee([]), Qe = Ee(null), Je = Ee(null), qe = Ee(/* @__PURE__ */ new Map()), et = Ee(k), Mt = Ee(!1), kt = Ee(null), tt = Ee(/* @__PURE__ */ new Map()), vt = Ee(/* @__PURE__ */ new Map()), {
4254
4254
  threadCheckpoints: At,
4255
4255
  syncActiveThreadCheckpoints: it,
4256
4256
  updateCheckpointCache: Yt,
@@ -4260,7 +4260,7 @@ function wv({
4260
4260
  resetThreadCheckpoints: ft,
4261
4261
  getSnapshotCache: Ve,
4262
4262
  getSnapshotFromCache: Dt
4263
- } = yv({ currentThreadId: k, currentThreadIdRef: Ce }), Ot = de(() => {
4263
+ } = yv({ currentThreadId: k, currentThreadIdRef: Ce }), Pt = de(() => {
4264
4264
  var K;
4265
4265
  const R = vt.current;
4266
4266
  if (R.size <= $c) return;
@@ -4322,12 +4322,12 @@ function wv({
4322
4322
  usedHistoryApi: !1
4323
4323
  };
4324
4324
  }
4325
- })().then((Be) => (vt.current.set(le, { result: Be, timestamp: Date.now() }), Ot(), Be)).finally(() => {
4325
+ })().then((Be) => (vt.current.set(le, { result: Be, timestamp: Date.now() }), Pt(), Be)).finally(() => {
4326
4326
  tt.current.get(le) === bt && tt.current.delete(le);
4327
4327
  });
4328
4328
  return tt.current.set(le, bt), bt;
4329
4329
  },
4330
- [c, G, Ot]
4330
+ [c, G, Pt]
4331
4331
  ), ve = de((R, I) => new Promise((U, K) => {
4332
4332
  const he = async () => {
4333
4333
  Xe.current = !0;
@@ -4361,10 +4361,12 @@ function wv({
4361
4361
  C((U) => {
4362
4362
  const K = (ht) => ht.map((bt) => `${bt.threadId}:${bt.updatedAt ?? ""}:${bt.messageCount ?? ""}`).join("|"), he = Ji(U);
4363
4363
  return K(he) === K(I) || I.length === 0 && he.length > 0 && !xt.current ? U : os(I);
4364
- }), R || _(!1);
4364
+ });
4365
4365
  }), P(null), xt.current || (xt.current = !0);
4366
4366
  } catch (I) {
4367
- i == null || i(String(I)), console.error("[ChatSessionProvider] Failed to refresh threads:", I), P(String(I)), R || _(!1);
4367
+ i == null || i(String(I)), console.error("[ChatSessionProvider] Failed to refresh threads:", I), P(String(I));
4368
+ } finally {
4369
+ R || _(!1);
4368
4370
  }
4369
4371
  }, [c, i]), Me = Ee(!1), Kt = Ee(null), Le = Ee(null), wt = Ee(""), [jn, Lt] = we("idle"), un = Ee({
4370
4372
  attempts: 0,
@@ -4442,7 +4444,7 @@ function wv({
4442
4444
  }), F(le.interrupt ?? null), ue(le.nextCursor ?? null), Q(!!le.nextCursor), ee(le.checkpointId ?? void 0), q(le.checkpointNs ?? void 0), ce(le.nextCursorNs ?? void 0);
4443
4445
  return;
4444
4446
  }
4445
- const Be = qe.current.get(he), Et = (Be == null ? void 0 : Be.snapshot) ?? null, Wt = Array.isArray(Et == null ? void 0 : Et.messages) ? Et.messages : [], fn = hn(Et), Wn = Array.isArray(R == null ? void 0 : R.messages) ? R.messages : [], qt = /* @__PURE__ */ new Set(), Mt = [...Wn, ...Wt].filter((Gt) => {
4447
+ const Be = qe.current.get(he), Et = (Be == null ? void 0 : Be.snapshot) ?? null, Wt = Array.isArray(Et == null ? void 0 : Et.messages) ? Et.messages : [], fn = hn(Et), Wn = Array.isArray(R == null ? void 0 : R.messages) ? R.messages : [], qt = /* @__PURE__ */ new Set(), Ot = [...Wn, ...Wt].filter((Gt) => {
4446
4448
  const $i = Gt == null ? void 0 : Gt.id;
4447
4449
  return $i ? qt.has($i) ? !1 : (qt.add($i), !0) : !0;
4448
4450
  }), tr = _d(fn, le), Cr = {
@@ -4451,10 +4453,10 @@ function wv({
4451
4453
  createdAt: le.createdAt ?? fn.createdAt ?? null,
4452
4454
  parentId: le.parentId ?? fn.parentId ?? null,
4453
4455
  branchLabel: le.branchLabel ?? fn.branchLabel ?? null,
4454
- lastMessageId: ((Fi = Mt[Mt.length - 1]) == null ? void 0 : Fi.id) ?? null,
4455
- messagesLen: Mt.length,
4456
- hasMessages: Mt.length > 0,
4457
- messages: Mt,
4456
+ lastMessageId: ((Fi = Ot[Ot.length - 1]) == null ? void 0 : Fi.id) ?? null,
4457
+ messagesLen: Ot.length,
4458
+ hasMessages: Ot.length > 0,
4459
+ messages: Ot,
4458
4460
  nextCursor: le.nextCursor ?? fn.nextCursor ?? null,
4459
4461
  nextCursorNs: le.nextCursorNs ?? fn.nextCursorNs ?? null,
4460
4462
  interrupt: fn.interrupt ?? le.interrupt ?? null,
@@ -4698,11 +4700,11 @@ function wv({
4698
4700
  On(R);
4699
4701
  const I = (he) => {
4700
4702
  const le = Yi(h, he);
4701
- kt.current !== le && (kt.current = le, Pt.current = !1), S(le);
4703
+ kt.current !== le && (kt.current = le, Mt.current = !1), S(le);
4702
4704
  const ht = Xi(le);
4703
4705
  go(() => {
4704
4706
  C(os(ht));
4705
- }), he && !Pt.current && (Pt.current = !0);
4707
+ }), he && !Mt.current && (Mt.current = !0);
4706
4708
  };
4707
4709
  I(R);
4708
4710
  const U = (K = c.onTokenChange) == null ? void 0 : K.call(c, (he) => {
@@ -4800,26 +4802,26 @@ function wv({
4800
4802
  if (qt)
4801
4803
  Ue(qt), Wt = !0;
4802
4804
  else {
4803
- const Mt = m(R);
4804
- Mt && (qe.current.set(R, Mt), Ue(Mt), Wt = !0);
4805
+ const Ot = m(R);
4806
+ Ot && (qe.current.set(R, Ot), Ue(Ot), Wt = !0);
4805
4807
  }
4806
4808
  }
4807
4809
  const fn = K || !Wt || !!I || !!U, Wn = async (qt) => {
4808
4810
  qt && $(!0), Qe.current = R;
4809
4811
  try {
4810
- const Mt = await Re(
4812
+ const Ot = await Re(
4811
4813
  { threadId: R, checkpointId: I, checkpointNs: U },
4812
4814
  { force: K }
4813
- ), { latest: tr, checkpoints: Cr, snapshots: Vr } = Os(Mt.payload);
4815
+ ), { latest: tr, checkpoints: Cr, snapshots: Vr } = Os(Ot.payload);
4814
4816
  go(() => {
4815
- Ge(tr, "replace", R), Yt(R, Cr, "replace"), Xt(R, Vr, "replace"), j(null), qt && $(!1);
4816
- }), Mt.usedHistoryApi || ae(R).then((Cn) => {
4817
+ Ge(tr, "replace", R), Yt(R, Cr, "replace"), Xt(R, Vr, "replace"), j(null);
4818
+ }), Ot.usedHistoryApi || ae(R).then((Cn) => {
4817
4819
  Jt(R, Cn);
4818
4820
  }).catch((Cn) => {
4819
4821
  console.warn("[ChatSessionProvider] Failed to refresh checkpoint summaries:", Cn);
4820
4822
  });
4821
- } catch (Mt) {
4822
- if (Y(Mt))
4823
+ } catch (Ot) {
4824
+ if (Y(Ot))
4823
4825
  try {
4824
4826
  const tr = await ae(R), Cr = Jt(R, tr);
4825
4827
  if (Q(!1), ue(null), ce(void 0), ee(void 0), q(void 0), Cr) {
@@ -4829,9 +4831,9 @@ function wv({
4829
4831
  } catch (tr) {
4830
4832
  console.warn("[ChatSessionProvider] Failed to fetch checkpoint summaries after timeout:", tr);
4831
4833
  }
4832
- throw (!Wt || K || qt) && (i == null || i(String(Mt))), j(String(Mt)), Mt;
4834
+ throw (!Wt || K || qt) && (i == null || i(String(Ot))), j(String(Ot)), Ot;
4833
4835
  } finally {
4834
- Qe.current = null;
4836
+ Qe.current = null, qt && $(!1);
4835
4837
  }
4836
4838
  };
4837
4839
  fn ? await Wn(!0) : Et && Wt && !Be && Wn(!1).catch((qt) => {
@@ -4965,7 +4967,7 @@ function wv({
4965
4967
  le
4966
4968
  ), Wt = [...Be];
4967
4969
  K && K.trim() && Wt.push({ type: "text", text: K.trim() });
4968
- const fn = !!U, Wn = fn ? (I == null ? void 0 : I.checkpointId) ?? H.lastCheckpointId ?? void 0 : void 0, qt = fn ? (I == null ? void 0 : I.checkpointNs) ?? H.lastCheckpointNs ?? void 0 : void 0, Mt = {
4970
+ const fn = !!U, Wn = fn ? (I == null ? void 0 : I.checkpointId) ?? H.lastCheckpointId ?? void 0 : void 0, qt = fn ? (I == null ? void 0 : I.checkpointNs) ?? H.lastCheckpointNs ?? void 0 : void 0, Ot = {
4969
4971
  id: ((Tr = crypto.randomUUID) == null ? void 0 : Tr.call(crypto)) || `user-${Date.now()}`,
4970
4972
  role: "user",
4971
4973
  content: Wt,
@@ -4973,11 +4975,11 @@ function wv({
4973
4975
  ...Wn != null ? { checkpointId: Wn } : {},
4974
4976
  ...qt != null ? { checkpointNs: qt } : {}
4975
4977
  };
4976
- ht && Object.keys(ht).length && (Mt.additionalKwargs = {
4977
- ...Mt.additionalKwargs ?? {},
4978
+ ht && Object.keys(ht).length && (Ot.additionalKwargs = {
4979
+ ...Ot.additionalKwargs ?? {},
4978
4980
  ...ht
4979
- }), Wt.length > 0 && Pe(Mt);
4980
- const tr = { ...Mt, content: Wt }, Cr = le.length > 0, Vr = {
4981
+ }), Wt.length > 0 && Pe(Ot);
4982
+ const tr = { ...Ot, content: Wt }, Cr = le.length > 0, Vr = {
4981
4983
  messages: Wt.length > 0 ? [tr] : [],
4982
4984
  files_info: Et,
4983
4985
  ...o && Cr && s ? { active_agent: s } : {},
@@ -5047,9 +5049,11 @@ function wv({
5047
5049
  } catch (R) {
5048
5050
  console.warn("[ChatSessionProvider] Failed to persist lastThreadId:", R);
5049
5051
  }
5050
- }, [k, l]), St(() => Pt.current ? void 0 : (Pt.current = !0, (async () => {
5052
+ }, [k, l]), St(() => ((async () => {
5051
5053
  try {
5052
- if (await dt(), !r && !t)
5054
+ if (dt().catch((I) => {
5055
+ console.error("[ChatSessionProvider] Failed to refresh threads (background):", I), i == null || i(String(I));
5056
+ }), !r && !t)
5053
5057
  try {
5054
5058
  const I = localStorage.getItem("lastThreadId");
5055
5059
  I && (A(I), n && await Sn(I));
@@ -11897,8 +11901,8 @@ const GC = /* @__PURE__ */ ut(
11897
11901
  const Je = Qh(Qe, st, ot);
11898
11902
  let qe, et;
11899
11903
  Pe ? q === 0 && ie === 0 && ye > 0 ? (qe = 0, et = ye - 1) : (qe = Je * Ws((q + Ce) / (Xe + Ce)), et = Je * Iu((ie + Ce) / (Xe + Ce)) - 1, et = ha(D - 1, To(et, Je - 1)), qe = ha(et, To(0, qe))) : (qe = 0, et = -1);
11900
- const Pt = Au(qe, et, re), { bottom: kt, top: tt } = _u(We, ce, H, Pt), vt = Iu(D / Je), At = vt * Xe + (vt - 1) * Ce - kt;
11901
- return { bottom: kt, itemHeight: Xe, items: Pt, itemWidth: st, offsetBottom: At, offsetTop: tt, top: tt };
11904
+ const Mt = Au(qe, et, re), { bottom: kt, top: tt } = _u(We, ce, H, Mt), vt = Iu(D / Je), At = vt * Xe + (vt - 1) * Ce - kt;
11905
+ return { bottom: kt, itemHeight: Xe, items: Mt, itemWidth: st, offsetBottom: At, offsetTop: tt, top: tt };
11902
11906
  }
11903
11907
  )
11904
11908
  ),
@@ -14798,7 +14802,7 @@ const Hu = V.memo(function({
14798
14802
  } finally {
14799
14803
  T == null || T();
14800
14804
  }
14801
- }, [w, T, S, W]), Pt = V.useCallback(async (G) => {
14805
+ }, [w, T, S, W]), Mt = V.useCallback(async (G) => {
14802
14806
  if (w)
14803
14807
  return;
14804
14808
  const Re = ps(
@@ -14871,7 +14875,7 @@ const Hu = V.memo(function({
14871
14875
  {
14872
14876
  interruptPart: Me,
14873
14877
  onApprove: et,
14874
- onReject: Pt,
14878
+ onReject: Mt,
14875
14879
  disabled: w,
14876
14880
  isActive: xt,
14877
14881
  payload: dt
@@ -14884,7 +14888,7 @@ const Hu = V.memo(function({
14884
14888
  ue,
14885
14889
  J,
14886
14890
  et,
14887
- Pt,
14891
+ Mt,
14888
14892
  L,
14889
14893
  c,
14890
14894
  d,
@@ -14940,7 +14944,7 @@ const Hu = V.memo(function({
14940
14944
  k(Re, ve);
14941
14945
  },
14942
14946
  [N, k]
14943
- ), Ve = V.useMemo(() => Jt ? it.findIndex((G) => G.id === Jt) : -1, [Jt, it]), Dt = V.useMemo(() => Ve < 0 ? null : it[Ve] ?? null, [Ve, it]), Ot = V.useCallback((G) => {
14947
+ ), Ve = V.useMemo(() => Jt ? it.findIndex((G) => G.id === Jt) : -1, [Jt, it]), Dt = V.useMemo(() => Ve < 0 ? null : it[Ve] ?? null, [Ve, it]), Pt = V.useCallback((G) => {
14944
14948
  const Re = [];
14945
14949
  if (G.step !== null && Re.push(`Step ${G.step}`), G.source && Re.push(G.source), !G.createdAt)
14946
14950
  return Re.length ? Re.join(" • ") : G.id.slice(0, 8);
@@ -15022,7 +15026,7 @@ const Hu = V.memo(function({
15022
15026
  " / ",
15023
15027
  it.length
15024
15028
  ] }),
15025
- /* @__PURE__ */ u.jsx("span", { className: "text-muted-foreground", children: Ot(Dt) })
15029
+ /* @__PURE__ */ u.jsx("span", { className: "text-muted-foreground", children: Pt(Dt) })
15026
15030
  ] }),
15027
15031
  /* @__PURE__ */ u.jsx(
15028
15032
  "button",
@@ -15614,8 +15618,8 @@ const Uu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, tk = (e) =>
15614
15618
  const Pe = Uu(ye, re), $e = "type" in ye && ye.type === "default_message";
15615
15619
  let ot = [], Ce = null, Xe = {}, st = {}, Qe = null, Je = null;
15616
15620
  if (!$e) {
15617
- const Pt = ye, kt = Pt.checkpointId ?? null;
15618
- Xe = Pt.additionalKwargs ?? {}, st = Pt.responseMetadata ?? {};
15621
+ const Mt = ye, kt = Mt.checkpointId ?? null;
15622
+ Xe = Mt.additionalKwargs ?? {}, st = Mt.responseMetadata ?? {};
15619
15623
  const tt = kt && k ? k.get(kt) ?? null : null;
15620
15624
  Qe = typeof Xe.step == "number" ? Xe.step : typeof st.step == "number" ? st.step : (tt == null ? void 0 : tt.step) ?? null;
15621
15625
  const vt = typeof Xe.source == "string" ? Xe.source : typeof st.source == "string" ? st.source : (tt == null ? void 0 : tt.source) ?? null;
@@ -15714,7 +15718,7 @@ function ga({
15714
15718
  J(!0);
15715
15719
  }, []), ke = de(() => {
15716
15720
  J(!1);
15717
- }, []), ee = !!ge || _e, [D, q] = we(null), [ie, ce] = we(""), [H, We] = we(null), [re, ye] = we(null), [Pe, $e] = we([]), [ot, Ce] = we(0), [Xe, st] = we(0), [Qe, Je] = we(!1), [qe, et] = we(null), [Pt, kt] = we(null), [tt, vt] = we(!1), [At, it] = we(null), [Yt, Xt] = we(!1), Jt = Ee(!1), [Zt, ft] = we(() => Wu.value), Ve = Ee(Zt), Dt = Ee(null), Ot = de((Z) => {
15721
+ }, []), ee = !!ge || _e, [D, q] = we(null), [ie, ce] = we(""), [H, We] = we(null), [re, ye] = we(null), [Pe, $e] = we([]), [ot, Ce] = we(0), [Xe, st] = we(0), [Qe, Je] = we(!1), [qe, et] = we(null), [Mt, kt] = we(null), [tt, vt] = we(!1), [At, it] = we(null), [Yt, Xt] = we(!1), Jt = Ee(!1), [Zt, ft] = we(() => Wu.value), Ve = Ee(Zt), Dt = Ee(null), Pt = de((Z) => {
15718
15722
  Wu.value = Z, ft(Z);
15719
15723
  }, []), [G, Re] = we(!1), ve = Ee(null), gt = de((Z) => {
15720
15724
  if (!Array.isArray(Z))
@@ -15842,9 +15846,9 @@ function ga({
15842
15846
  jn.current && (jn.current.value = ""), Lt.current && (Lt.current.value = ""), Ce((Z) => Z + 1), st((Z) => Z + 1);
15843
15847
  }, []), Ur = de(
15844
15848
  (Z) => {
15845
- Ot(Z);
15849
+ Pt(Z);
15846
15850
  },
15847
- [Ot]
15851
+ [Pt]
15848
15852
  ), Wr = Ee(!1);
15849
15853
  St(() => {
15850
15854
  Wr.current && !z && ($e([]), un()), Wr.current = z;
@@ -15865,8 +15869,8 @@ function ga({
15865
15869
  Dt.current = null;
15866
15870
  return;
15867
15871
  }
15868
- Dt.current === null && (Dt.current = Ve.current), Ot(ie ?? "");
15869
- }, [ie, D, Ot]);
15872
+ Dt.current === null && (Dt.current = Ve.current), Pt(ie ?? "");
15873
+ }, [ie, D, Pt]);
15870
15874
  const E = de(async () => {
15871
15875
  if (!(!S || T || !Yt))
15872
15876
  try {
@@ -15926,7 +15930,7 @@ function ga({
15926
15930
  checkpointId: fe,
15927
15931
  checkpointNs: Ie
15928
15932
  }
15929
- ), h == null || h(se), Ot(""), ye(null), $e([]), un(), q(null), ce(""), We(null);
15933
+ ), h == null || h(se), Pt(""), ye(null), $e([]), un(), q(null), ce(""), We(null);
15930
15934
  } catch (fe) {
15931
15935
  const Ie = (fe == null ? void 0 : fe.message) || "Failed to send message";
15932
15936
  ye(Ie), m == null || m(Ie);
@@ -15934,15 +15938,15 @@ function ga({
15934
15938
  }
15935
15939
  }, Te = V.useCallback(
15936
15940
  (Z, se, fe) => {
15937
- c && (Dt.current = Zt, q(Z), ce(se), Ot(se), ye(null), We({
15941
+ c && (Dt.current = Zt, q(Z), ce(se), Pt(se), ye(null), We({
15938
15942
  checkpointId: (fe == null ? void 0 : fe.checkpointId) ?? null,
15939
15943
  checkpointNs: (fe == null ? void 0 : fe.checkpointNs) ?? null
15940
15944
  }));
15941
15945
  },
15942
- [Zt, c, Ot]
15946
+ [Zt, c, Pt]
15943
15947
  ), Ye = V.useCallback(() => {
15944
- q(null), ce(""), We(null), ye(null), Ot(Dt.current ?? Zt), Dt.current = null;
15945
- }, [Zt, Ot]), Ge = de(
15948
+ q(null), ce(""), We(null), ye(null), Pt(Dt.current ?? Zt), Dt.current = null;
15949
+ }, [Zt, Pt]), Ge = de(
15946
15950
  (Z, se, fe) => {
15947
15951
  Te(Z, se, fe);
15948
15952
  },
@@ -16188,7 +16192,7 @@ function ga({
16188
16192
  /* @__PURE__ */ u.jsx(gs, { className: "h-4 w-4 animate-spin" }),
16189
16193
  " Uploading Excel file..."
16190
16194
  ] }),
16191
- Pt && !Qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: Pt }),
16195
+ Mt && !Qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: Mt }),
16192
16196
  qe && !Qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: qe })
16193
16197
  ] })
16194
16198
  ] }),