teodor-new-chat-ui 4.3.316 → 4.3.317

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
@@ -136,14 +136,14 @@ function Om() {
136
136
  }
137
137
  return null;
138
138
  }
139
- var E = Object.assign, F = 0, _, J, z, P, U, X, de;
139
+ var E = Object.assign, F = 0, _, J, z, P, U, X, fe;
140
140
  function ie() {
141
141
  }
142
142
  ie.__reactDisabledLog = !0;
143
143
  function Ae() {
144
144
  {
145
145
  if (F === 0) {
146
- _ = console.log, J = console.info, z = console.warn, P = console.error, U = console.group, X = console.groupCollapsed, de = console.groupEnd;
146
+ _ = console.log, J = console.info, z = console.warn, P = console.error, U = console.group, X = console.groupCollapsed, fe = console.groupEnd;
147
147
  var R = {
148
148
  configurable: !0,
149
149
  enumerable: !0,
@@ -191,7 +191,7 @@ function Om() {
191
191
  value: X
192
192
  }),
193
193
  groupEnd: E({}, R, {
194
- value: de
194
+ value: fe
195
195
  })
196
196
  });
197
197
  }
@@ -497,7 +497,7 @@ Check the render method of \`` + R + "`.";
497
497
  function L(R) {
498
498
  return "";
499
499
  }
500
- var fe = {};
500
+ var ue = {};
501
501
  function Y(R) {
502
502
  {
503
503
  var V = De();
@@ -516,9 +516,9 @@ Check the top-level render call using <` + ae + ">.");
516
516
  return;
517
517
  R._store.validated = !0;
518
518
  var ae = Y(V);
519
- if (fe[ae])
519
+ if (ue[ae])
520
520
  return;
521
- fe[ae] = !0;
521
+ ue[ae] = !0;
522
522
  var Re = "";
523
523
  R && R._owner && R._owner !== ut.current && (Re = " It was passed a child from " + $(R._owner.type) + "."), ee(R), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ae, Re), ee(null);
524
524
  }
@@ -1880,8 +1880,8 @@ const xu = (e) => {
1880
1880
  method: "POST",
1881
1881
  body: g,
1882
1882
  duplex: "half"
1883
- }), de;
1884
- if (O.isFormData(g) && (de = X.headers.get("content-type")) && I.setContentType(de), X.body) {
1883
+ }), fe;
1884
+ if (O.isFormData(g) && (fe = X.headers.get("content-type")) && I.setContentType(fe), X.body) {
1885
1885
  const [ie, Ae] = wl(
1886
1886
  F,
1887
1887
  Go(bl(C))
@@ -1907,8 +1907,8 @@ const xu = (e) => {
1907
1907
  ["status", "statusText", "headers"].forEach((q) => {
1908
1908
  X[q] = z[q];
1909
1909
  });
1910
- const de = O.toFiniteNumber(z.headers.get("content-length")), [ie, Ae] = S && wl(
1911
- de,
1910
+ const fe = O.toFiniteNumber(z.headers.get("content-length")), [ie, Ae] = S && wl(
1911
+ fe,
1912
1912
  Go(bl(S), !0)
1913
1913
  ) || [];
1914
1914
  z = new r(
@@ -1920,8 +1920,8 @@ const xu = (e) => {
1920
1920
  }
1921
1921
  k = k || "text";
1922
1922
  let U = await f[O.findKey(f, k) || "text"](z, x);
1923
- return !P && E && E(), await new Promise((X, de) => {
1924
- mu(X, de, {
1923
+ return !P && E && E(), await new Promise((X, fe) => {
1924
+ mu(X, fe, {
1925
1925
  data: U,
1926
1926
  headers: qt.from(z.headers),
1927
1927
  status: z.status,
@@ -3066,7 +3066,7 @@ function Wx(e = {}) {
3066
3066
  threadId: E.threadId ?? null,
3067
3067
  headers: {}
3068
3068
  }, (async () => {
3069
- var de, ie, Ae, q, B, K, D, W, re, oe, se, Se, nt, Fe, Qe, rt, ce, he;
3069
+ var fe, ie, Ae, q, B, K, D, W, re, oe, se, Se, nt, Fe, Qe, rt, ce, he;
3070
3070
  const X = (Me) => {
3071
3071
  var He;
3072
3072
  try {
@@ -3085,7 +3085,7 @@ function Wx(e = {}) {
3085
3085
  if (r)
3086
3086
  Me = { Authorization: `Bearer ${r}` };
3087
3087
  else if (typeof window < "u") {
3088
- const Ne = window.__AUTH_TOKEN__, ut = ((de = window.localStorage) == null ? void 0 : de.getItem("authToken")) || null;
3088
+ const Ne = window.__AUTH_TOKEN__, ut = ((fe = window.localStorage) == null ? void 0 : fe.getItem("authToken")) || null;
3089
3089
  let G = null;
3090
3090
  try {
3091
3091
  const Ce = (ie = window.localStorage) == null ? void 0 : ie.getItem("chat-settings");
@@ -3173,14 +3173,14 @@ function Wx(e = {}) {
3173
3173
  ht = ht.slice(Te + 2);
3174
3174
  const L = Kx(De);
3175
3175
  if (!L) continue;
3176
- let fe;
3176
+ let ue;
3177
3177
  try {
3178
- fe = JSON.parse(L);
3178
+ ue = JSON.parse(L);
3179
3179
  } catch {
3180
3180
  console.debug("[use-chat] malformed SSE:", L.slice(0, 200));
3181
3181
  continue;
3182
3182
  }
3183
- const Y = Vx(fe) ? fe.data : fe;
3183
+ const Y = Vx(ue) ? ue.data : ue;
3184
3184
  Ct = Date.now();
3185
3185
  const Le = Y.seq;
3186
3186
  if (Le !== void 0) {
@@ -3944,7 +3944,7 @@ function ny({
3944
3944
  onAuthError: i,
3945
3945
  onThreadChange: a
3946
3946
  }) {
3947
- const { api: l, baseUrl: c } = Tu(), d = Ve(() => _n(c), [c]), [f, p] = be([]), [h, x] = be(t), [m, v] = be(!1), [g, w] = be(null), [b, T] = be(!1), [S, C] = be(null), { state: k, seed: I, prepend: N, pushUser: j, onEvent: A } = Xx(), [M, $] = be(!1), [E, F] = be(!1), [_, J] = be(null), [z, P] = be([]), [U, X] = be([]), [de, ie] = be(!1), Ae = Ve(
3947
+ const { api: l, baseUrl: c } = Tu(), d = Ve(() => _n(c), [c]), [f, p] = be([]), [h, x] = be(t), [m, v] = be(!1), [g, w] = be(null), [b, T] = be(!1), [S, C] = be(null), { state: k, seed: I, prepend: N, pushUser: j, onEvent: A } = Xx(), [M, $] = be(!1), [E, F] = be(!1), [_, J] = be(null), [z, P] = be([]), [U, X] = be([]), [fe, ie] = be(!1), Ae = Ve(
3948
3948
  () => z.flatMap((G) => G.messages ?? []),
3949
3949
  [z]
3950
3950
  ), q = Ve(() => Ux(Ae), [Ae]), B = Ke(h), K = Ke(null), D = Ke(null), W = Ke(null), re = Ke(null), oe = Ke(!1), se = Ke(null), Se = Ke(/* @__PURE__ */ new Map()), nt = Ke(/* @__PURE__ */ new Map());
@@ -4042,7 +4042,7 @@ function ny({
4042
4042
  const L = G;
4043
4043
  T(!0), C(null);
4044
4044
  try {
4045
- const fe = await l.getStateHistory({
4045
+ const ue = await l.getStateHistory({
4046
4046
  threadId: L,
4047
4047
  checkpointId: ee || void 0
4048
4048
  });
@@ -4050,14 +4050,14 @@ function ny({
4050
4050
  console.log(`[ChatSessionProvider] Thread changed during load (was ${L}, now ${B.current}), discarding stale data`);
4051
4051
  return;
4052
4052
  }
4053
- const { checkpoints: Y, timeline: Le } = xr(fe), ge = Y.find((ot) => ot.messages && ot.messages.length > 0) ?? (ee ? Y.find((ot) => ot.checkpointId === ee) : null) ?? Y[0];
4053
+ const { checkpoints: Y, timeline: Le } = xr(ue), ge = Y.find((ot) => ot.messages && ot.messages.length > 0) ?? (ee ? Y.find((ot) => ot.checkpointId === ee) : null) ?? Y[0];
4054
4054
  I((ge == null ? void 0 : ge.messages) ?? [], {
4055
4055
  checkpointId: (ge == null ? void 0 : ge.checkpointId) ?? null,
4056
4056
  checkpointNs: (ge == null ? void 0 : ge.checkpointNs) ?? null
4057
4057
  }), X(Le), P(Y), $(!!(ge != null && ge.nextCursor)), J((ge == null ? void 0 : ge.nextCursor) ?? null);
4058
- } catch (fe) {
4058
+ } catch (ue) {
4059
4059
  if (B.current === L) {
4060
- const Y = String(fe);
4060
+ const Y = String(ue);
4061
4061
  C(Y), s == null || s(Y);
4062
4062
  }
4063
4063
  } finally {
@@ -4137,14 +4137,14 @@ function ny({
4137
4137
  console.log(`[ChatSessionProvider] Thread changed during checkpoint navigation (was ${Te}, now ${B.current}), discarding stale data`);
4138
4138
  return;
4139
4139
  }
4140
- const { checkpoints: L, timeline: fe } = xr(De), Y = L.find(
4140
+ const { checkpoints: L, timeline: ue } = xr(De), Y = L.find(
4141
4141
  (Le) => Le.checkpointId === G && (ee ? Le.checkpointNs === ee : !0)
4142
4142
  );
4143
4143
  if (!Y) {
4144
4144
  console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: G, checkpointNs: ee });
4145
4145
  return;
4146
4146
  }
4147
- X(fe), P(L), I(Y.messages ?? [], {
4147
+ X(ue), P(L), I(Y.messages ?? [], {
4148
4148
  checkpointId: Y.checkpointId ?? null,
4149
4149
  checkpointNs: Y.checkpointNs ?? null
4150
4150
  });
@@ -4238,17 +4238,17 @@ function ny({
4238
4238
  (G == null ? void 0 : G.attachments) ?? []
4239
4239
  ), L = [...De];
4240
4240
  Te != null && Te.trim() && L.push({ type: "text", text: Te });
4241
- const fe = {
4241
+ const ue = {
4242
4242
  id: `msg-${Date.now()}`,
4243
4243
  role: "user",
4244
4244
  content: L,
4245
4245
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4246
4246
  };
4247
- j(fe);
4247
+ j(ue);
4248
4248
  const Y = {
4249
4249
  threadId: Ce,
4250
4250
  payload: {
4251
- messages: [fe]
4251
+ messages: [ue]
4252
4252
  },
4253
4253
  checkpointId: (ee == null ? void 0 : ee.checkpointId) ?? k.lastCheckpointId ?? void 0,
4254
4254
  checkpointNs: (ee == null ? void 0 : ee.checkpointNs) ?? k.lastCheckpointNs ?? void 0
@@ -4285,7 +4285,7 @@ function ny({
4285
4285
  metadata: null,
4286
4286
  isLoading: b,
4287
4287
  isHistoryLoading: E,
4288
- isLoadingCheckpoint: de,
4288
+ isLoadingCheckpoint: fe,
4289
4289
  error: S,
4290
4290
  hasMore: M,
4291
4291
  loadOlder: St,
@@ -4305,7 +4305,7 @@ function ny({
4305
4305
  U,
4306
4306
  b,
4307
4307
  E,
4308
- de,
4308
+ fe,
4309
4309
  S,
4310
4310
  M,
4311
4311
  St,
@@ -4473,11 +4473,11 @@ function sy({
4473
4473
  try {
4474
4474
  const X = l(_);
4475
4475
  X && typeof X.then == "function" ? X.then(() => {
4476
- var de, ie;
4477
- ((de = C.current) == null ? void 0 : de.id) === J && C.current.shouldClear && (x || (v(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((ie = C.current) == null ? void 0 : ie.id) === J && (C.current = null);
4476
+ var fe, ie;
4477
+ ((fe = C.current) == null ? void 0 : fe.id) === J && C.current.shouldClear && (x || (v(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((ie = C.current) == null ? void 0 : ie.id) === J && (C.current = null);
4478
4478
  }).catch(() => {
4479
- var de;
4480
- ((de = C.current) == null ? void 0 : de.id) === J && (C.current = null);
4479
+ var fe;
4480
+ ((fe = C.current) == null ? void 0 : fe.id) === J && (C.current = null);
4481
4481
  }) : (((z = C.current) == null ? void 0 : z.id) === J && C.current.shouldClear && (x || (v(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((P = C.current) == null ? void 0 : P.id) === J && (C.current = null));
4482
4482
  } catch {
4483
4483
  ((U = C.current) == null ? void 0 : U.id) === J && (C.current = null);
@@ -6461,7 +6461,7 @@ var Ia = "PopperContent", [Wv, Vv] = Ju(Ia), nd = y.forwardRef(
6461
6461
  Mt(() => {
6462
6462
  J && (X == null || X());
6463
6463
  }, [J, X]);
6464
- const de = (K = z.arrow) == null ? void 0 : K.x, ie = (D = z.arrow) == null ? void 0 : D.y, Ae = ((W = z.arrow) == null ? void 0 : W.centerOffset) !== 0, [q, B] = y.useState();
6464
+ const fe = (K = z.arrow) == null ? void 0 : K.x, ie = (D = z.arrow) == null ? void 0 : D.y, Ae = ((W = z.arrow) == null ? void 0 : W.centerOffset) !== 0, [q, B] = y.useState();
6465
6465
  return Mt(() => {
6466
6466
  g && B(window.getComputedStyle(g).zIndex);
6467
6467
  }, [g]), /* @__PURE__ */ u.jsx(
@@ -6494,7 +6494,7 @@ var Ia = "PopperContent", [Wv, Vv] = Ju(Ia), nd = y.forwardRef(
6494
6494
  scope: n,
6495
6495
  placedSide: P,
6496
6496
  onArrowChange: S,
6497
- arrowX: de,
6497
+ arrowX: fe,
6498
6498
  arrowY: ie,
6499
6499
  shouldHideArrow: Ae,
6500
6500
  children: /* @__PURE__ */ u.jsx(
@@ -7460,15 +7460,15 @@ var on = "MenuContent", [ib, _a] = lr(on), Ad = y.forwardRef(
7460
7460
  ...m
7461
7461
  } = e, v = cr(on, n), g = go(on, n), w = Ms(n), b = Rd(n), T = eb(n), [S, C] = y.useState(null), k = y.useRef(null), I = Ze(t, k, v.onContentChange), N = y.useRef(0), j = y.useRef(""), A = y.useRef(0), M = y.useRef(null), $ = y.useRef("right"), E = y.useRef(0), F = x ? Os : y.Fragment, _ = x ? { as: cb, allowPinchZoom: !0 } : void 0, J = (P) => {
7462
7462
  var K, D;
7463
- const U = j.current + P, X = T().filter((W) => !W.disabled), de = document.activeElement, ie = (K = X.find((W) => W.ref.current === de)) == null ? void 0 : K.textValue, Ae = X.map((W) => W.textValue), q = bb(Ae, U, ie), B = (D = X.find((W) => W.textValue === q)) == null ? void 0 : D.ref.current;
7463
+ const U = j.current + P, X = T().filter((W) => !W.disabled), fe = document.activeElement, ie = (K = X.find((W) => W.ref.current === fe)) == null ? void 0 : K.textValue, Ae = X.map((W) => W.textValue), q = bb(Ae, U, ie), B = (D = X.find((W) => W.textValue === q)) == null ? void 0 : D.ref.current;
7464
7464
  (function W(re) {
7465
7465
  j.current = re, window.clearTimeout(N.current), re !== "" && (N.current = window.setTimeout(() => W(""), 1e3));
7466
7466
  })(U), B && setTimeout(() => B.focus());
7467
7467
  };
7468
7468
  y.useEffect(() => () => window.clearTimeout(N.current), []), va();
7469
7469
  const z = y.useCallback((P) => {
7470
- var X, de;
7471
- return $.current === ((X = M.current) == null ? void 0 : X.side) && Cb(P, (de = M.current) == null ? void 0 : de.area);
7470
+ var X, fe;
7471
+ return $.current === ((X = M.current) == null ? void 0 : X.side) && Cb(P, (fe = M.current) == null ? void 0 : fe.area);
7472
7472
  }, []);
7473
7473
  return /* @__PURE__ */ u.jsx(
7474
7474
  ib,
@@ -7545,8 +7545,8 @@ var on = "MenuContent", [ib, _a] = lr(on), Ad = y.forwardRef(
7545
7545
  ref: I,
7546
7546
  style: { outline: "none", ...m.style },
7547
7547
  onKeyDown: pe(m.onKeyDown, (P) => {
7548
- const X = P.target.closest("[data-radix-menu-content]") === P.currentTarget, de = P.ctrlKey || P.altKey || P.metaKey, ie = P.key.length === 1;
7549
- X && (P.key === "Tab" && P.preventDefault(), !de && ie && J(P.key));
7548
+ const X = P.target.closest("[data-radix-menu-content]") === P.currentTarget, fe = P.ctrlKey || P.altKey || P.metaKey, ie = P.key.length === 1;
7549
+ X && (P.key === "Tab" && P.preventDefault(), !fe && ie && J(P.key));
7550
7550
  const Ae = k.current;
7551
7551
  if (P.target !== Ae || !Jw.includes(P.key)) return;
7552
7552
  P.preventDefault();
@@ -7561,8 +7561,8 @@ var on = "MenuContent", [ib, _a] = lr(on), Ad = y.forwardRef(
7561
7561
  Qr((P) => {
7562
7562
  const U = P.target, X = E.current !== P.clientX;
7563
7563
  if (P.currentTarget.contains(U) && X) {
7564
- const de = P.clientX > E.current ? "right" : "left";
7565
- $.current = de, E.current = P.clientX;
7564
+ const fe = P.clientX > E.current ? "right" : "left";
7565
+ $.current = fe, E.current = P.clientX;
7566
7566
  }
7567
7567
  })
7568
7568
  )
@@ -9370,7 +9370,7 @@ const xo = it(
9370
9370
  const F = Pf(T), { align: _, behavior: J, offset: z } = F, P = k - 1, U = _f(F, S, P);
9371
9371
  let X = ro(U, S.offsetTree, M) + N;
9372
9372
  _ === "end" ? (X += $ + hn(S.sizeTree, U)[1] - C + E, U === P && (X += j)) : _ === "center" ? X += ($ + hn(S.sizeTree, U)[1] - C + E) / 2 : X -= I, z && (X += z);
9373
- const de = (ie) => {
9373
+ const fe = (ie) => {
9374
9374
  b(), ie ? (A("retrying to scroll to", { location: T }, Gt.DEBUG), $e(h, T)) : ($e(x, !0), A("list did not change, scroll successful", {}, Gt.DEBUG));
9375
9375
  };
9376
9376
  if (b(), J === "smooth") {
@@ -9378,10 +9378,10 @@ const xo = it(
9378
9378
  w = ct(t, (Ae) => {
9379
9379
  ie = ie || Ae;
9380
9380
  }), v = dn(d, () => {
9381
- de(ie);
9381
+ fe(ie);
9382
9382
  });
9383
9383
  } else
9384
- v = dn(H(t, V0(150)), de);
9384
+ v = dn(H(t, V0(150)), fe);
9385
9385
  return g = setTimeout(() => {
9386
9386
  b();
9387
9387
  }, 1200), $e(l, !0), A("scrolling from index to", { behavior: J, index: U, top: X }, Gt.DEBUG), { behavior: J, top: X };
@@ -9823,11 +9823,11 @@ const dr = it(
9823
9823
  }
9824
9824
  if (!A)
9825
9825
  return Wo([], U, I, E, _, $);
9826
- const X = M.length > 0 ? M[M.length - 1] + 1 : 0, de = L0(J, C, k, X);
9827
- if (de.length === 0)
9826
+ const X = M.length > 0 ? M[M.length - 1] + 1 : 0, fe = L0(J, C, k, X);
9827
+ if (fe.length === 0)
9828
9828
  return null;
9829
9829
  const ie = I - 1, Ae = Fs([], (q) => {
9830
- for (const B of de) {
9830
+ for (const B of fe) {
9831
9831
  const K = B.value;
9832
9832
  let D = K.offset, W = B.start;
9833
9833
  const re = K.size;
@@ -11004,7 +11004,7 @@ const PS = /* @__PURE__ */ it(
11004
11004
  { customScrollParent: v, useWindowScroll: g, windowScrollContainerState: w, windowScrollTo: b, windowViewportRect: T },
11005
11005
  S
11006
11006
  ]) => {
11007
- const C = Q(0), k = Q(0), I = Q(Rc), N = Q({ height: 0, width: 0 }), j = Q({ height: 0, width: 0 }), A = Je(), M = Je(), $ = Q(0), E = Q(null), F = Q({ column: 0, row: 0 }), _ = Je(), J = Je(), z = Q(!1), P = Q(0), U = Q(!0), X = Q(!1), de = Q(!1);
11007
+ const C = Q(0), k = Q(0), I = Q(Rc), N = Q({ height: 0, width: 0 }), j = Q({ height: 0, width: 0 }), A = Je(), M = Je(), $ = Q(0), E = Q(null), F = Q({ column: 0, row: 0 }), _ = Je(), J = Je(), z = Q(!1), P = Q(0), U = Q(!0), X = Q(!1), fe = Q(!1);
11008
11008
  ct(
11009
11009
  H(
11010
11010
  x,
@@ -11226,7 +11226,7 @@ const PS = /* @__PURE__ */ it(
11226
11226
  ...h,
11227
11227
  // output
11228
11228
  gridState: I,
11229
- horizontalDirection: de,
11229
+ horizontalDirection: fe,
11230
11230
  initialTopMostItemIndex: P,
11231
11231
  totalListHeight: K,
11232
11232
  ...p,
@@ -12798,7 +12798,7 @@ ke.pedantic = {
12798
12798
  paragraph: pt(ke.normal._paragraph).replace("hr", ke.hr).replace("heading", ` *#{1,6} *[^
12799
12799
  ]`).replace("lheading", ke.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
12800
12800
  };
12801
- const ue = {
12801
+ const de = {
12802
12802
  escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
12803
12803
  autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
12804
12804
  url: ls,
@@ -12822,30 +12822,30 @@ const ue = {
12822
12822
  text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
12823
12823
  punctuation: /^([\spunctuation])/
12824
12824
  };
12825
- ue._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
12826
- ue.punctuation = pt(ue.punctuation).replace(/punctuation/g, ue._punctuation).getRegex();
12827
- ue.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
12828
- ue.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
12829
- ue._comment = pt(ke._comment).replace("(?:-->|$)", "-->").getRegex();
12830
- ue.emStrong.lDelim = pt(ue.emStrong.lDelim).replace(/punct/g, ue._punctuation).getRegex();
12831
- ue.emStrong.rDelimAst = pt(ue.emStrong.rDelimAst, "g").replace(/punct/g, ue._punctuation).getRegex();
12832
- ue.emStrong.rDelimUnd = pt(ue.emStrong.rDelimUnd, "g").replace(/punct/g, ue._punctuation).getRegex();
12833
- ue._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
12834
- ue._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
12835
- ue._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
12836
- ue.autolink = pt(ue.autolink).replace("scheme", ue._scheme).replace("email", ue._email).getRegex();
12837
- ue._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
12838
- ue.tag = pt(ue.tag).replace("comment", ue._comment).replace("attribute", ue._attribute).getRegex();
12839
- ue._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
12840
- ue._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
12841
- ue._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
12842
- ue.link = pt(ue.link).replace("label", ue._label).replace("href", ue._href).replace("title", ue._title).getRegex();
12843
- ue.reflink = pt(ue.reflink).replace("label", ue._label).replace("ref", ke._label).getRegex();
12844
- ue.nolink = pt(ue.nolink).replace("ref", ke._label).getRegex();
12845
- ue.reflinkSearch = pt(ue.reflinkSearch, "g").replace("reflink", ue.reflink).replace("nolink", ue.nolink).getRegex();
12846
- ue.normal = { ...ue };
12847
- ue.pedantic = {
12848
- ...ue.normal,
12825
+ de._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
12826
+ de.punctuation = pt(de.punctuation).replace(/punctuation/g, de._punctuation).getRegex();
12827
+ de.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
12828
+ de.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
12829
+ de._comment = pt(ke._comment).replace("(?:-->|$)", "-->").getRegex();
12830
+ de.emStrong.lDelim = pt(de.emStrong.lDelim).replace(/punct/g, de._punctuation).getRegex();
12831
+ de.emStrong.rDelimAst = pt(de.emStrong.rDelimAst, "g").replace(/punct/g, de._punctuation).getRegex();
12832
+ de.emStrong.rDelimUnd = pt(de.emStrong.rDelimUnd, "g").replace(/punct/g, de._punctuation).getRegex();
12833
+ de._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
12834
+ de._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
12835
+ de._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
12836
+ de.autolink = pt(de.autolink).replace("scheme", de._scheme).replace("email", de._email).getRegex();
12837
+ de._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
12838
+ de.tag = pt(de.tag).replace("comment", de._comment).replace("attribute", de._attribute).getRegex();
12839
+ de._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
12840
+ de._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
12841
+ de._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
12842
+ de.link = pt(de.link).replace("label", de._label).replace("href", de._href).replace("title", de._title).getRegex();
12843
+ de.reflink = pt(de.reflink).replace("label", de._label).replace("ref", ke._label).getRegex();
12844
+ de.nolink = pt(de.nolink).replace("ref", ke._label).getRegex();
12845
+ de.reflinkSearch = pt(de.reflinkSearch, "g").replace("reflink", de.reflink).replace("nolink", de.nolink).getRegex();
12846
+ de.normal = { ...de };
12847
+ de.pedantic = {
12848
+ ...de.normal,
12849
12849
  strong: {
12850
12850
  start: /^__|\*\*/,
12851
12851
  middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
@@ -12858,23 +12858,23 @@ ue.pedantic = {
12858
12858
  endAst: /\*(?!\*)/g,
12859
12859
  endUnd: /_(?!_)/g
12860
12860
  },
12861
- link: pt(/^!?\[(label)\]\((.*?)\)/).replace("label", ue._label).getRegex(),
12862
- reflink: pt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", ue._label).getRegex()
12861
+ link: pt(/^!?\[(label)\]\((.*?)\)/).replace("label", de._label).getRegex(),
12862
+ reflink: pt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", de._label).getRegex()
12863
12863
  };
12864
- ue.gfm = {
12865
- ...ue.normal,
12866
- escape: pt(ue.escape).replace("])", "~|])").getRegex(),
12864
+ de.gfm = {
12865
+ ...de.normal,
12866
+ escape: pt(de.escape).replace("])", "~|])").getRegex(),
12867
12867
  _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
12868
12868
  url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
12869
12869
  _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
12870
12870
  del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
12871
12871
  text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
12872
12872
  };
12873
- ue.gfm.url = pt(ue.gfm.url, "i").replace("email", ue.gfm._extended_email).getRegex();
12874
- ue.breaks = {
12875
- ...ue.gfm,
12876
- br: pt(ue.br).replace("{2,}", "*").getRegex(),
12877
- text: pt(ue.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
12873
+ de.gfm.url = pt(de.gfm.url, "i").replace("email", de.gfm._extended_email).getRegex();
12874
+ de.breaks = {
12875
+ ...de.gfm,
12876
+ br: pt(de.br).replace("{2,}", "*").getRegex(),
12877
+ text: pt(de.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
12878
12878
  };
12879
12879
  function OC(e) {
12880
12880
  return e.replace(/---/g, "—").replace(/--/g, "–").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1‘").replace(/'/g, "’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1“").replace(/"/g, "”").replace(/\.{3}/g, "…");
@@ -12895,9 +12895,9 @@ class Hn {
12895
12895
  };
12896
12896
  const n = {
12897
12897
  block: ke.normal,
12898
- inline: ue.normal
12898
+ inline: de.normal
12899
12899
  };
12900
- this.options.pedantic ? (n.block = ke.pedantic, n.inline = ue.pedantic) : this.options.gfm && (n.block = ke.gfm, this.options.breaks ? n.inline = ue.breaks : n.inline = ue.gfm), this.tokenizer.rules = n;
12900
+ this.options.pedantic ? (n.block = ke.pedantic, n.inline = de.pedantic) : this.options.gfm && (n.block = ke.gfm, this.options.breaks ? n.inline = de.breaks : n.inline = de.gfm), this.tokenizer.rules = n;
12901
12901
  }
12902
12902
  /**
12903
12903
  * Expose Rules
@@ -12905,7 +12905,7 @@ class Hn {
12905
12905
  static get rules() {
12906
12906
  return {
12907
12907
  block: ke,
12908
- inline: ue
12908
+ inline: de
12909
12909
  };
12910
12910
  }
12911
12911
  /**
@@ -13904,7 +13904,7 @@ const Bc = sm(function({
13904
13904
  messageParentCheckpointId: j = null,
13905
13905
  attemptMeta: A = null
13906
13906
  }) {
13907
- const [M, $] = be(!1), [E, F] = be("preview"), [_, J] = be(!1), { currentThreadId: z } = ma(), { respondToInterrupt: P } = ga(), U = l === "phone" || l === "half-screen", X = t.role, de = X === "tool", ie = Ve(() => "type" in t && t.type === "default_message" ? t : null, [t]), Ae = !!ie, q = !(r && X !== "user"), {
13907
+ const [M, $] = be(!1), [E, F] = be("preview"), [_, J] = be(!1), { currentThreadId: z } = ma(), { respondToInterrupt: P } = ga(), U = l === "phone" || l === "half-screen", X = t.role, fe = X === "tool", ie = Ve(() => "type" in t && t.type === "default_message" ? t : null, [t]), Ae = !!ie, q = !(r && X !== "user"), {
13908
13908
  uploadingFiles: B,
13909
13909
  handleFileClick: K,
13910
13910
  fileViewerOpen: D,
@@ -13934,10 +13934,10 @@ const Bc = sm(function({
13934
13934
  [ie, t]
13935
13935
  ), rt = (w == null ? void 0 : w.id) ?? (w == null ? void 0 : w.interrupt_id), ce = Po(rt), he = w == null ? void 0 : w.value, Me = Ve(() => ie ? "" : $C(t.content), [ie, t]), He = Ve(() => {
13936
13936
  if (ie || !p) return [];
13937
- const fe = t.artifact;
13938
- if (!fe) return [];
13937
+ const ue = t.artifact;
13938
+ if (!ue) return [];
13939
13939
  const Y = [], Le = [
13940
- ...Array.isArray(fe.plots) ? fe.plots : []
13940
+ ...Array.isArray(ue.plots) ? ue.plots : []
13941
13941
  ];
13942
13942
  for (const ge of Le) {
13943
13943
  const ot = UC(ge);
@@ -13945,8 +13945,8 @@ const Bc = sm(function({
13945
13945
  }
13946
13946
  return Y;
13947
13947
  }, [ie, t, p]), qe = ye(async () => {
13948
- const L = de ? Me : se;
13949
- async function fe(Y) {
13948
+ const L = fe ? Me : se;
13949
+ async function ue(Y) {
13950
13950
  if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
13951
13951
  await navigator.clipboard.writeText(Y);
13952
13952
  return;
@@ -13963,30 +13963,30 @@ const Bc = sm(function({
13963
13963
  throw new Error("Clipboard API not supported in this context.");
13964
13964
  }
13965
13965
  try {
13966
- await fe(L), $(!0), setTimeout(() => $(!1), 2e3), g == null || g(L);
13966
+ await ue(L), $(!0), setTimeout(() => $(!1), 2e3), g == null || g(L);
13967
13967
  } catch (Y) {
13968
13968
  console.error("Failed to copy:", Y);
13969
13969
  }
13970
- }, [de, Me, se, g]), et = ye(() => {
13970
+ }, [fe, Me, se, g]), et = ye(() => {
13971
13971
  if (!x) return;
13972
- const L = de ? Me : se, fe = "type" in t && t.type === "default_message" ? void 0 : {
13972
+ const L = fe ? Me : se, ue = "type" in t && t.type === "default_message" ? void 0 : {
13973
13973
  checkpointId: t.checkpointId ?? null,
13974
13974
  checkpointNs: t.checkpointNs ?? null
13975
13975
  };
13976
- x(t.id, L, fe);
13977
- }, [x, t.id, de, Me, se, t]), ze = ye(() => {
13976
+ x(t.id, L, ue);
13977
+ }, [x, t.id, fe, Me, se, t]), ze = ye(() => {
13978
13978
  m == null || m(n);
13979
13979
  }, [m, n]), tt = ye(() => {
13980
- const fe = ne(U ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", oe);
13980
+ const ue = ne(U ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", oe);
13981
13981
  switch (X) {
13982
13982
  case "user":
13983
- return /* @__PURE__ */ u.jsx(hm, { className: fe });
13983
+ return /* @__PURE__ */ u.jsx(hm, { className: ue });
13984
13984
  case "assistant":
13985
- return /* @__PURE__ */ u.jsx(ni, { className: fe });
13985
+ return /* @__PURE__ */ u.jsx(ni, { className: ue });
13986
13986
  case "tool":
13987
- return /* @__PURE__ */ u.jsx(pm, { className: fe });
13987
+ return /* @__PURE__ */ u.jsx(pm, { className: ue });
13988
13988
  default:
13989
- return /* @__PURE__ */ u.jsx(ni, { className: fe });
13989
+ return /* @__PURE__ */ u.jsx(ni, { className: ue });
13990
13990
  }
13991
13991
  }, [U, oe, X]), Et = ye(() => {
13992
13992
  const L = "group relative mb-4 flex w-full";
@@ -14057,15 +14057,15 @@ const Bc = sm(function({
14057
14057
  const Ue = ye(async (L) => {
14058
14058
  if (b)
14059
14059
  return;
14060
- const fe = Po(
14060
+ const ue = Po(
14061
14061
  (L == null ? void 0 : L.id) ?? (L == null ? void 0 : L.interrupt_id)
14062
14062
  );
14063
- if (!fe) {
14063
+ if (!ue) {
14064
14064
  console.warn("Interrupt part missing id", L);
14065
14065
  return;
14066
14066
  }
14067
14067
  try {
14068
- T == null || T(), await P(fe, !0);
14068
+ T == null || T(), await P(ue, !0);
14069
14069
  } catch (Y) {
14070
14070
  console.error("Failed to approve interrupt:", Y);
14071
14071
  } finally {
@@ -14074,24 +14074,24 @@ const Bc = sm(function({
14074
14074
  }, [b, S, T, P]), xt = ye(async (L) => {
14075
14075
  if (b)
14076
14076
  return;
14077
- const fe = Po(
14077
+ const ue = Po(
14078
14078
  (L == null ? void 0 : L.id) ?? (L == null ? void 0 : L.interrupt_id)
14079
14079
  );
14080
- if (!fe) {
14080
+ if (!ue) {
14081
14081
  console.warn("Interrupt part missing id", L);
14082
14082
  return;
14083
14083
  }
14084
14084
  try {
14085
- T == null || T(), await P(fe, !1);
14085
+ T == null || T(), await P(ue, !1);
14086
14086
  } catch (Y) {
14087
14087
  console.error("Failed to reject interrupt:", Y);
14088
14088
  } finally {
14089
14089
  S == null || S();
14090
14090
  }
14091
- }, [b, S, T, P]), bt = ye(({ part: L, i: fe }) => {
14091
+ }, [b, S, T, P]), bt = ye(({ part: L, i: ue }) => {
14092
14092
  if (L.type === "text") {
14093
14093
  const Y = L.text ?? "", Le = Y.trim(), ge = Ya(Le);
14094
- return ge && X !== "tool" ? /* @__PURE__ */ u.jsx(Pp, { data: ge }, fe) : X === "user" && c && Le.length > d ? /* @__PURE__ */ u.jsx(
14094
+ return ge && X !== "tool" ? /* @__PURE__ */ u.jsx(Pp, { data: ge }, ue) : X === "user" && c && Le.length > d ? /* @__PURE__ */ u.jsx(
14095
14095
  qC,
14096
14096
  {
14097
14097
  text: Le,
@@ -14100,8 +14100,8 @@ const Bc = sm(function({
14100
14100
  previewLength: d,
14101
14101
  isCompact: U
14102
14102
  },
14103
- fe
14104
- ) : /* @__PURE__ */ u.jsx(us, { content: Y, allowHtml: !1 }, fe);
14103
+ ue
14104
+ ) : /* @__PURE__ */ u.jsx(us, { content: Y, allowHtml: !1 }, ue);
14105
14105
  }
14106
14106
  if (L.type === "image_url") {
14107
14107
  const Y = L;
@@ -14113,7 +14113,7 @@ const Bc = sm(function({
14113
14113
  loading: "lazy",
14114
14114
  className: "border rounded max-h-[420px] w-auto object-contain"
14115
14115
  }
14116
- ) }, fe);
14116
+ ) }, ue);
14117
14117
  }
14118
14118
  if (L.type === "file") {
14119
14119
  const Y = L, Le = Y.name || "file";
@@ -14121,18 +14121,18 @@ const Bc = sm(function({
14121
14121
  "a",
14122
14122
  {
14123
14123
  href: Y.url,
14124
- onClick: (ge) => K(ge.nativeEvent, Y, fe),
14124
+ onClick: (ge) => K(ge.nativeEvent, Y, ue),
14125
14125
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
14126
14126
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
14127
14127
  children: [
14128
- B[fe] ? /* @__PURE__ */ u.jsx(la, { className: "h-4 w-4 animate-spin" }) : null,
14128
+ B[ue] ? /* @__PURE__ */ u.jsx(la, { className: "h-4 w-4 animate-spin" }) : null,
14129
14129
  /* @__PURE__ */ u.jsxs("span", { className: "truncate max-w-[180px]", children: [
14130
14130
  Le,
14131
- B[fe] ? " (processing)" : ""
14131
+ B[ue] ? " (processing)" : ""
14132
14132
  ] })
14133
14133
  ]
14134
14134
  },
14135
- fe
14135
+ ue
14136
14136
  );
14137
14137
  }
14138
14138
  if (L.type === "interrupt") {
@@ -14149,7 +14149,7 @@ const Bc = sm(function({
14149
14149
  isActive: ge,
14150
14150
  payload: ot
14151
14151
  },
14152
- fe
14152
+ ue
14153
14153
  );
14154
14154
  }
14155
14155
  return null;
@@ -14173,11 +14173,11 @@ const Bc = sm(function({
14173
14173
  /* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
14174
14174
  ] }), []), St = ye(() => {
14175
14175
  const L = se.trim().length > 0 || nt.length > 0 || Fe.length > 0 || Qe.length > 0;
14176
- if (!de && Fe.length > 0 && !r)
14176
+ if (!fe && Fe.length > 0 && !r)
14177
14177
  return Nt();
14178
- if (!de && !L && !r)
14178
+ if (!fe && !L && !r)
14179
14179
  return null;
14180
- if (de)
14180
+ if (fe)
14181
14181
  return !f && He.length > 0 ? null : f ? /* @__PURE__ */ u.jsx(
14182
14182
  GC,
14183
14183
  {
@@ -14186,8 +14186,8 @@ const Bc = sm(function({
14186
14186
  },
14187
14187
  t.id
14188
14188
  ) : null;
14189
- if (!de && !ie) {
14190
- const fe = t, Y = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: fe.content.map((Le, ge) => /* @__PURE__ */ u.jsx(bt, { part: Le, i: ge }, ge)) });
14189
+ if (!fe && !ie) {
14190
+ const ue = t, Y = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: ue.content.map((Le, ge) => /* @__PURE__ */ u.jsx(bt, { part: Le, i: ge }, ge)) });
14191
14191
  return r ? /* @__PURE__ */ u.jsxs("div", { "aria-busy": "true", role: "status", children: [
14192
14192
  Y,
14193
14193
  /* @__PURE__ */ u.jsx(WC, { className: oe })
@@ -14199,7 +14199,7 @@ const Bc = sm(function({
14199
14199
  Fe.length,
14200
14200
  Qe.length,
14201
14201
  r,
14202
- de,
14202
+ fe,
14203
14203
  E,
14204
14204
  f,
14205
14205
  He.length,
@@ -14207,18 +14207,18 @@ const Bc = sm(function({
14207
14207
  oe
14208
14208
  ]), Ct = Ve(() => ie ? "Assistant" : FC(t), [ie, t]), Ge = Ve(() => ie ? [] : Array.isArray(C) ? C : [], [C, ie]), zt = Ve(() => {
14209
14209
  var L;
14210
- return Ge.length ? N && Ge.some((fe) => fe.id === N) ? N : ((L = Ge[0]) == null ? void 0 : L.id) ?? null : null;
14210
+ return Ge.length ? N && Ge.some((ue) => ue.id === N) ? N : ((L = Ge[0]) == null ? void 0 : L.id) ?? null : null;
14211
14211
  }, [N, Ge]), Ne = Ve(() => !Ge.length || !k ? null : Ge.some((L) => L.id === k) ? k : null, [k, Ge]) ?? zt, ut = X === "user" && Ge.length > 0 && typeof I == "function", G = ye(
14212
14212
  (L) => {
14213
14213
  if (!I) return;
14214
- const fe = (L == null ? void 0 : L.id) ?? null, Y = (L == null ? void 0 : L.parentId) ?? j ?? null;
14215
- I(fe, Y);
14214
+ const ue = (L == null ? void 0 : L.id) ?? null, Y = (L == null ? void 0 : L.parentId) ?? j ?? null;
14215
+ I(ue, Y);
14216
14216
  },
14217
14217
  [j, I]
14218
14218
  ), ee = Ve(() => Ne ? Ge.findIndex((L) => L.id === Ne) : -1, [Ne, Ge]), Ce = Ve(() => ee < 0 ? null : Ge[ee] ?? null, [ee, Ge]), Te = ye((L) => {
14219
- const fe = [];
14220
- if (L.step !== null && fe.push(`Step ${L.step}`), L.source && fe.push(L.source), !L.createdAt)
14221
- return fe.length ? fe.join(" • ") : L.id.slice(0, 8);
14219
+ const ue = [];
14220
+ if (L.step !== null && ue.push(`Step ${L.step}`), L.source && ue.push(L.source), !L.createdAt)
14221
+ return ue.length ? ue.join(" • ") : L.id.slice(0, 8);
14222
14222
  let Y = "";
14223
14223
  try {
14224
14224
  const Le = new Date(L.createdAt);
@@ -14233,7 +14233,7 @@ const Bc = sm(function({
14233
14233
  }, []), De = Ve(() => {
14234
14234
  if (!A || A.attemptCount <= 1)
14235
14235
  return null;
14236
- const L = A.isLatestAttempt ? `LATEST OF ${A.attemptCount}` : `ATTEMPT ${A.attemptIndex + 1} OF ${A.attemptCount}`;
14236
+ const L = A.attemptCount - A.attemptIndex, ue = A.isLatestAttempt ? `LATEST OF ${A.attemptCount}` : `${L} / ${A.attemptCount}`;
14237
14237
  return /* @__PURE__ */ u.jsx(
14238
14238
  Zi,
14239
14239
  {
@@ -14242,13 +14242,13 @@ const Bc = sm(function({
14242
14242
  "text-xs font-semibold",
14243
14243
  A.isLatestAttempt ? "border-green-300 text-green-700 dark:border-green-700 dark:text-green-300" : "border-amber-300 text-amber-700 dark:border-amber-700 dark:text-amber-300"
14244
14244
  ),
14245
- children: L
14245
+ children: ue
14246
14246
  }
14247
14247
  );
14248
14248
  }, [A]);
14249
- return de && !f && He.length === 0 ? null : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
14249
+ return fe && !f && He.length === 0 ? null : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
14250
14250
  /* @__PURE__ */ u.jsx("div", { className: ne(Et(), h.container), children: /* @__PURE__ */ u.jsxs("div", { className: ne(ht(), h.content), children: [
14251
- (i || a || de) && /* @__PURE__ */ u.jsxs(
14251
+ (i || a || fe) && /* @__PURE__ */ u.jsxs(
14252
14252
  "div",
14253
14253
  {
14254
14254
  className: ne(
@@ -14262,7 +14262,7 @@ const Bc = sm(function({
14262
14262
  tt(),
14263
14263
  a && Ct && /* @__PURE__ */ u.jsx("span", { className: ne("font-medium", U ? "text-xs" : "text-sm"), children: Ct }),
14264
14264
  De,
14265
- de && /* @__PURE__ */ u.jsxs(
14265
+ fe && /* @__PURE__ */ u.jsxs(
14266
14266
  Zi,
14267
14267
  {
14268
14268
  variant: "outline",
@@ -14277,7 +14277,7 @@ const Bc = sm(function({
14277
14277
  "aria-expanded": E === "expanded",
14278
14278
  onClick: () => F((L) => L === "expanded" ? "preview" : "expanded"),
14279
14279
  onKeyDown: (L) => {
14280
- (L.key === "Enter" || L.key === " ") && (L.preventDefault(), F((fe) => fe === "expanded" ? "preview" : "expanded"));
14280
+ (L.key === "Enter" || L.key === " ") && (L.preventDefault(), F((ue) => ue === "expanded" ? "preview" : "expanded"));
14281
14281
  },
14282
14282
  children: [
14283
14283
  /* @__PURE__ */ u.jsx("span", { children: Se.name ?? "Tool Output" }),
@@ -14395,8 +14395,8 @@ const Bc = sm(function({
14395
14395
  ),
14396
14396
  /* @__PURE__ */ u.jsxs("div", { className: "relative", children: [
14397
14397
  St(),
14398
- p && He.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "mt-3 space-y-4", children: He.map((L, fe) => (kt(() => {
14399
- oC() && console.debug(`[MessageComponent] Preview ${fe} mounted:`, {
14398
+ p && He.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "mt-3 space-y-4", children: He.map((L, ue) => (kt(() => {
14399
+ oC() && console.debug(`[MessageComponent] Preview ${ue} mounted:`, {
14400
14400
  src: L.src.substring(0, 100),
14401
14401
  alt: L.alt,
14402
14402
  label: L.label
@@ -14417,7 +14417,7 @@ const Bc = sm(function({
14417
14417
  onLoad: () => {
14418
14418
  },
14419
14419
  onError: (Y) => {
14420
- console.error(`[MessageComponent] ❌ Image failed to load for artifact ${fe}:`, {
14420
+ console.error(`[MessageComponent] ❌ Image failed to load for artifact ${ue}:`, {
14421
14421
  alt: L.alt,
14422
14422
  label: L.label,
14423
14423
  message: Y.target.alt
@@ -14425,9 +14425,9 @@ const Bc = sm(function({
14425
14425
  }
14426
14426
  }
14427
14427
  ) })
14428
- ] }, `artifact-${fe}`))) })
14428
+ ] }, `artifact-${ue}`))) })
14429
14429
  ] }),
14430
- de && E === "expanded" && (Se.toolCallId || Se.name) && /* @__PURE__ */ u.jsxs("div", { className: ne("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", U && "text-xs"), children: [
14430
+ fe && E === "expanded" && (Se.toolCallId || Se.name) && /* @__PURE__ */ u.jsxs("div", { className: ne("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", U && "text-xs"), children: [
14431
14431
  Se.name && /* @__PURE__ */ u.jsxs("div", { children: [
14432
14432
  "Function: ",
14433
14433
  Se.name
@@ -14437,7 +14437,7 @@ const Bc = sm(function({
14437
14437
  Se.toolCallId
14438
14438
  ] })
14439
14439
  ] }),
14440
- !(i || a || de) && s && !o && /* @__PURE__ */ u.jsxs(
14440
+ !(i || a || fe) && s && !o && /* @__PURE__ */ u.jsxs(
14441
14441
  "div",
14442
14442
  {
14443
14443
  className: ne(
@@ -14833,7 +14833,7 @@ const YC = ({
14833
14833
  messagePreviews: F,
14834
14834
  createSyntheticThinkingMessage: _ = !1
14835
14835
  }, J) => {
14836
- const z = Ke(null), P = Ke(null), U = Ke(!1), [X, de] = be(!0), ie = Ve(() => w ? e.some((ce) => "type" in ce && ce.type === "default_message" ? !1 : Array.isArray(ce == null ? void 0 : ce.content) && ce.content.some(
14836
+ const z = Ke(null), P = Ke(null), U = Ke(!1), [X, fe] = be(!0), ie = Ve(() => w ? e.some((ce) => "type" in ce && ce.type === "default_message" ? !1 : Array.isArray(ce == null ? void 0 : ce.content) && ce.content.some(
14837
14837
  (he) => he && he.type === "interrupt" && (he.id ?? he.interrupt_id) === w.id
14838
14838
  )) : !1, [w, e]), Ae = Ve(() => {
14839
14839
  if (!w || ie)
@@ -14867,7 +14867,7 @@ const YC = ({
14867
14867
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
14868
14868
  }
14869
14869
  ] : q, [q, t, _]), K = Ve(() => C ? B : B.filter((ce) => (ce == null ? void 0 : ce.role) !== "tool"), [B, C]), D = ye((ce) => {
14870
- de(ce), v && v(!ce), g && g(ce);
14870
+ fe(ce), v && v(!ce), g && g(ce);
14871
14871
  }, [v, g]), W = Ve(() => {
14872
14872
  if (a)
14873
14873
  return async () => {
@@ -15102,7 +15102,7 @@ function Ii({
15102
15102
  metadata: A,
15103
15103
  timelineCheckpoints: M,
15104
15104
  messagePreviews: $
15105
- } = ga(), { isStreaming: E, error: F, connectionState: _, submit: J, stop: z } = ry(), P = w ?? g ?? null, U = (I == null ? void 0 : I.id) ?? null, X = (I == null ? void 0 : I.namespace) ?? null, de = (A == null ? void 0 : A.assemblingMessageId) ?? null, ie = j, [Ae, q] = be(!1);
15105
+ } = ga(), { isStreaming: E, error: F, connectionState: _, submit: J, stop: z } = ry(), P = w ?? g ?? null, U = (I == null ? void 0 : I.id) ?? null, X = (I == null ? void 0 : I.namespace) ?? null, fe = (A == null ? void 0 : A.assemblingMessageId) ?? null, ie = j, [Ae, q] = be(!1);
15106
15106
  kt(() => {
15107
15107
  ie || q(!1);
15108
15108
  }, [ie]);
@@ -15158,7 +15158,7 @@ function Ii({
15158
15158
  const Qt = Date.parse(Ye.createdAt ?? ""), pr = Date.parse(At.createdAt ?? "");
15159
15159
  return Number.isNaN(Qt) || Number.isNaN(pr) ? 0 : pr - Qt;
15160
15160
  }), me;
15161
- }, [N, Te]), { checkpointMetaById: fe, checkpointIndexByKey: Y, attemptMetaById: Le, userMessageIdToAttempts: ge } = Ve(() => {
15161
+ }, [N, Te]), { checkpointMetaById: ue, checkpointIndexByKey: Y, attemptMetaById: Le, userMessageIdToAttempts: ge } = Ve(() => {
15162
15162
  const Z = /* @__PURE__ */ new Map(), me = /* @__PURE__ */ new Map(), xe = /* @__PURE__ */ new Map();
15163
15163
  for (const at of L) {
15164
15164
  const Bt = at.checkpointId ?? null;
@@ -15418,7 +15418,7 @@ function Ii({
15418
15418
  style: { height: "100%" },
15419
15419
  messages: b,
15420
15420
  isStreaming: E,
15421
- streamingAssistantId: de,
15421
+ streamingAssistantId: fe,
15422
15422
  streamingDebounceMs: typeof s == "number" ? s : o,
15423
15423
  followNewMessages: i,
15424
15424
  layoutSize: ei,
@@ -15435,7 +15435,7 @@ function Ii({
15435
15435
  onInterruptActionEnd: K,
15436
15436
  showToolMessages: d,
15437
15437
  showArtifactPreviews: f,
15438
- checkpointMetaById: fe,
15438
+ checkpointMetaById: ue,
15439
15439
  checkpointIndexByKey: Y,
15440
15440
  attemptMetaById: Le,
15441
15441
  userMessageIdToAttempts: ge,
@@ -16231,7 +16231,7 @@ function Kc({
16231
16231
  j(null), M("");
16232
16232
  }, X = (q, B) => {
16233
16233
  q.key === "Enter" ? P(B) : q.key === "Escape" && U();
16234
- }, de = (q) => {
16234
+ }, fe = (q) => {
16235
16235
  if (!q) return "";
16236
16236
  try {
16237
16237
  const B = new Date(q), D = (/* @__PURE__ */ new Date()).getTime() - B.getTime(), W = Math.floor(D / (1e3 * 60 * 60 * 24));
@@ -16283,7 +16283,7 @@ function Kc({
16283
16283
  /* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: Ae(q) }),
16284
16284
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
16285
16285
  /* @__PURE__ */ u.jsx(bm, { size: 10 }),
16286
- /* @__PURE__ */ u.jsx("span", { children: de(q.updatedAt || q.createdAt) })
16286
+ /* @__PURE__ */ u.jsx("span", { children: fe(q.updatedAt || q.createdAt) })
16287
16287
  ] })
16288
16288
  ] }) }),
16289
16289
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
@@ -16707,7 +16707,7 @@ var cn = 10, [fh, Gn] = Mr(ar), RT = "SelectContentImpl", IT = Tr("SelectContent
16707
16707
  const [U, X] = Ah((K) => {
16708
16708
  const D = M().filter((oe) => !oe.disabled), W = D.find((oe) => oe.ref.current === document.activeElement), re = _h(D, K, W);
16709
16709
  re && setTimeout(() => re.ref.current.focus());
16710
- }), de = y.useCallback(
16710
+ }), fe = y.useCallback(
16711
16711
  (K, D, W) => {
16712
16712
  const re = !F.current && !W;
16713
16713
  (w.value !== void 0 && w.value === D || re) && (N(K), re && (F.current = !0));
@@ -16738,7 +16738,7 @@ var cn = 10, [fh, Gn] = Mr(ar), RT = "SelectContentImpl", IT = Tr("SelectContent
16738
16738
  content: b,
16739
16739
  viewport: S,
16740
16740
  onViewportChange: C,
16741
- itemRefCallback: de,
16741
+ itemRefCallback: fe,
16742
16742
  selectedItem: I,
16743
16743
  onItemLeave: ie,
16744
16744
  itemTextRefCallback: Ae,
@@ -16832,7 +16832,7 @@ var ET = "SelectItemAlignedPosition", hh = y.forwardRef((e, t) => {
16832
16832
  ]);
16833
16833
  a.style.minWidth = nt + "px", a.style.right = rt + "px";
16834
16834
  }
16835
- const A = p(), M = window.innerHeight - cn * 2, $ = m.scrollHeight, E = window.getComputedStyle(c), F = parseInt(E.borderTopWidth, 10), _ = parseInt(E.paddingTop, 10), J = parseInt(E.borderBottomWidth, 10), z = parseInt(E.paddingBottom, 10), P = F + _ + $ + z + J, U = Math.min(v.offsetHeight * 5, P), X = window.getComputedStyle(m), de = parseInt(X.paddingTop, 10), ie = parseInt(X.paddingBottom, 10), Ae = k.top + k.height / 2 - cn, q = M - Ae, B = v.offsetHeight / 2, K = v.offsetTop + B, D = F + _ + K, W = P - D;
16835
+ const A = p(), M = window.innerHeight - cn * 2, $ = m.scrollHeight, E = window.getComputedStyle(c), F = parseInt(E.borderTopWidth, 10), _ = parseInt(E.paddingTop, 10), J = parseInt(E.borderBottomWidth, 10), z = parseInt(E.paddingBottom, 10), P = F + _ + $ + z + J, U = Math.min(v.offsetHeight * 5, P), X = window.getComputedStyle(m), fe = parseInt(X.paddingTop, 10), ie = parseInt(X.paddingBottom, 10), Ae = k.top + k.height / 2 - cn, q = M - Ae, B = v.offsetHeight / 2, K = v.offsetTop + B, D = F + _ + K, W = P - D;
16836
16836
  if (D <= Ae) {
16837
16837
  const oe = A.length > 0 && v === A[A.length - 1].ref.current;
16838
16838
  a.style.bottom = "0px";
@@ -16848,7 +16848,7 @@ var ET = "SelectItemAlignedPosition", hh = y.forwardRef((e, t) => {
16848
16848
  const Se = Math.max(
16849
16849
  Ae,
16850
16850
  F + m.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
16851
- (oe ? de : 0) + B
16851
+ (oe ? fe : 0) + B
16852
16852
  ) + W;
16853
16853
  a.style.height = Se + "px", m.scrollTop = D - Ae + m.offsetTop;
16854
16854
  }