@multiplayer-app/ai-agent-react 0.4.13 → 0.4.15

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.
@@ -1,7 +1,7 @@
1
1
  import { z as U } from "zod";
2
2
  import { jsx as T, Fragment as Rt, jsxs as re } from "react/jsx-runtime";
3
3
  import * as ee from "react";
4
- import tr, { forwardRef as ho, createElement as hd, useMemo as ot, useState as Ze, useEffect as Fe, useLayoutEffect as mo, memo as ft, useCallback as Ge, useRef as Ve, createContext as ip, useContext as op, useImperativeHandle as $7, isValidElement as C5 } from "react";
4
+ import tr, { forwardRef as ho, createElement as hd, useMemo as ot, useState as Ze, useEffect as Fe, useLayoutEffect as mo, memo as ft, useCallback as je, useRef as Ve, createContext as ip, useContext as op, useImperativeHandle as $7, isValidElement as C5 } from "react";
5
5
  import { useInfiniteQuery as sp, useQuery as mr, useQueryClient as F7, useMutation as r2, QueryClient as P7, QueryClientProvider as q7 } from "@tanstack/react-query";
6
6
  import { create as B7, useStore as U7 } from "zustand";
7
7
  import { nanoid as Tt } from "nanoid";
@@ -30690,9 +30690,9 @@ const Pn = ({
30690
30690
  const e = Pe();
30691
30691
  return { ...md, ...e.config.translations ?? {} };
30692
30692
  }, z2 = 300, _3 = ft(({ field: e, isExpanded: t, canApply: n, onToggleExpand: r, onApply: a }) => {
30693
- const i = fn(), o = e.value.length > z2, s = o && !t ? `${e.value.slice(0, z2)}...` : e.value, l = Ge(() => {
30693
+ const i = fn(), o = e.value.length > z2, s = o && !t ? `${e.value.slice(0, z2)}...` : e.value, l = je(() => {
30694
30694
  r(e.name);
30695
- }, [e.name, r]), u = Ge(() => {
30695
+ }, [e.name, r]), u = je(() => {
30696
30696
  a(e);
30697
30697
  }, [e, a]);
30698
30698
  return /* @__PURE__ */ re("div", { className: "mp-agent-form-proposal-row", children: [
@@ -30949,16 +30949,16 @@ const M3 = 30 * 1e3, S3 = 5 * 60 * 1e3, N3 = 20, Er = {
30949
30949
  }
30950
30950
  }, [t.data, n]), t;
30951
30951
  }, XVe = (e = {}, t = []) => {
30952
- const { threshold: n = 50, scrollOnMount: r = !0, observeMutations: a = !0 } = e, i = Ve(null), o = Ve(null), [s, l] = Ze(!0), u = Ve(!1), d = Ve(!1), p = Ve(), h = Ge(() => {
30952
+ const { threshold: n = 50, scrollOnMount: r = !0, observeMutations: a = !0 } = e, i = Ve(null), o = Ve(null), [s, l] = Ze(!0), u = Ve(!1), d = Ve(!1), p = Ve(), h = je(() => {
30953
30953
  const g = i.current;
30954
30954
  if (!g)
30955
30955
  return !1;
30956
30956
  const { scrollTop: _, scrollHeight: k, clientHeight: b } = g;
30957
30957
  return k - _ - b <= n;
30958
- }, [n]), m = Ge(() => {
30958
+ }, [n]), m = je(() => {
30959
30959
  const g = i.current, _ = o.current;
30960
30960
  !g || !_ || _.scrollIntoView({ behavior: "auto", block: "end" });
30961
- }, []), f = Ge(() => {
30961
+ }, []), f = je(() => {
30962
30962
  const g = h();
30963
30963
  l(g), g && (u.current = !1);
30964
30964
  }, [h]);
@@ -31411,18 +31411,18 @@ const Ia = (e) => e === Yr.Streaming || e === Yr.Processing || e === Yr.WaitingF
31411
31411
  refetchOnWindowFocus: !1
31412
31412
  });
31413
31413
  }, QVe = (e, t = []) => {
31414
- const n = Pe(), r = Ve(e), a = Ge(e, t);
31414
+ const n = Pe(), r = Ve(e), a = je(e, t);
31415
31415
  r.current = a;
31416
- const i = Ge((o) => r.current(o), []);
31416
+ const i = je((o) => r.current(o), []);
31417
31417
  Fe(() => n.registerPageContextProvider(i), [n, i]);
31418
31418
  }, JVe = (e, t = []) => {
31419
- const n = Pe(), r = Ve(e), a = Ge(e, t);
31419
+ const n = Pe(), r = Ve(e), a = je(e, t);
31420
31420
  r.current = a;
31421
- const i = Ge((o) => r.current(o), []);
31421
+ const i = je((o) => r.current(o), []);
31422
31422
  Fe(() => n.registerChatMetadataProvider(i), [n, i]);
31423
31423
  }, u7e = (e) => {
31424
31424
  const t = Pe();
31425
- return Ge(
31425
+ return je(
31426
31426
  (r) => {
31427
31427
  t.events.dispatchEvent(
31428
31428
  new CustomEvent(e, {
@@ -31433,9 +31433,9 @@ const Ia = (e) => e === Yr.Streaming || e === Yr.Processing || e === Yr.WaitingF
31433
31433
  [t, e]
31434
31434
  );
31435
31435
  }, d7e = (e, t, n = [], r) => {
31436
- const a = Pe(), i = Ve(t), o = Ge(t, n);
31436
+ const a = Pe(), i = Ve(t), o = je(t, n);
31437
31437
  i.current = o;
31438
- const s = Ge((u) => {
31438
+ const s = je((u) => {
31439
31439
  i.current(u);
31440
31440
  }, []), l = typeof r == "boolean" ? r : r?.capture;
31441
31441
  Fe(() => (a.events.addEventListener(e, s, r), () => {
@@ -31510,7 +31510,7 @@ const Ia = (e) => e === Yr.Streaming || e === Yr.Processing || e === Yr.WaitingF
31510
31510
  });
31511
31511
  }, [e, s.data, i]), s;
31512
31512
  }, g7e = () => {
31513
- const e = Pe(), t = e.config.user?.id ?? ra(), n = fe((u) => u.activeChatId), r = fe((u) => u.removeChat), a = fe((u) => u.setActiveChat), [i, o] = Ze(/* @__PURE__ */ new Set()), s = Ge(
31513
+ const e = Pe(), t = e.config.user?.id ?? ra(), n = fe((u) => u.activeChatId), r = fe((u) => u.removeChat), a = fe((u) => u.setActiveChat), [i, o] = Ze(/* @__PURE__ */ new Set()), s = je(
31514
31514
  async (u) => {
31515
31515
  o((d) => new Set(d).add(u));
31516
31516
  try {
@@ -31523,7 +31523,7 @@ const Ia = (e) => e === Yr.Streaming || e === Yr.Processing || e === Yr.WaitingF
31523
31523
  }
31524
31524
  },
31525
31525
  [n, r, e.queryClient, e.transport, a, t]
31526
- ), l = Ge((u) => i.has(u), [i]);
31526
+ ), l = je((u) => i.has(u), [i]);
31527
31527
  return { deleteChat: s, isDeleting: l };
31528
31528
  }, y7e = (e) => {
31529
31529
  if (e == null)
@@ -31570,7 +31570,7 @@ const Ia = (e) => e === Yr.Streaming || e === Yr.Processing || e === Yr.WaitingF
31570
31570
  () => e.status === rt.Succeeded && !!s.formId && s.fields.length > 0 && !p && !h,
31571
31571
  [e.status, s.formId, s.fields.length, p, h]
31572
31572
  );
31573
- const f = Ge(
31573
+ const f = je(
31574
31574
  async (E) => {
31575
31575
  s.formId && a.transport.recordToolCallAction && await a.transport.recordToolCallAction(
31576
31576
  t,
@@ -31589,7 +31589,7 @@ const Ia = (e) => e === Yr.Streaming || e === Yr.Processing || e === Yr.WaitingF
31589
31589
  );
31590
31590
  },
31591
31591
  [s.formId, s.formName, t, e.id, a.transport]
31592
- ), g = Ge(
31592
+ ), g = je(
31593
31593
  async (E) => {
31594
31594
  if (s.formId) {
31595
31595
  i({
@@ -31608,7 +31608,7 @@ const Ia = (e) => e === Yr.Streaming || e === Yr.Processing || e === Yr.WaitingF
31608
31608
  },
31609
31609
  [s.formId, s.formName, t, e.id, i, f]
31610
31610
  );
31611
- Ge(async () => {
31611
+ je(async () => {
31612
31612
  if (s.formId)
31613
31613
  try {
31614
31614
  await f({ action: "reject", fields: s.fields });
@@ -31616,7 +31616,7 @@ const Ia = (e) => e === Yr.Streaming || e === Yr.Processing || e === Yr.WaitingF
31616
31616
  return;
31617
31617
  }
31618
31618
  }, [s.formId, s.fields, f]);
31619
- const _ = Ge((E) => {
31619
+ const _ = je((E) => {
31620
31620
  u((S) => {
31621
31621
  if (S.has(E)) {
31622
31622
  if (S.size === 1)
@@ -31628,12 +31628,12 @@ const Ia = (e) => e === Yr.Streaming || e === Yr.Processing || e === Yr.WaitingF
31628
31628
  return x.add(E), x;
31629
31629
  }
31630
31630
  });
31631
- }, []), k = Ge(
31631
+ }, []), k = je(
31632
31632
  (E) => {
31633
31633
  g([E]);
31634
31634
  },
31635
31635
  [g]
31636
- ), b = Ge(() => {
31636
+ ), b = je(() => {
31637
31637
  g(s.fields);
31638
31638
  }, [g, s.fields]), w = s.formName ? `${o.formProposalHeaderPrefix} ${s.formName}` : `${o.formProposalHeaderPrefix} ${s.formId}`;
31639
31639
  return e.status === rt.Failed && e.error ? /* @__PURE__ */ T("div", { className: "mp-agent-tool-body", children: /* @__PURE__ */ T("div", { className: "mp-agent-tool-simple-message", children: o.formProposalFailed }) }) : e.status !== rt.Succeeded ? /* @__PURE__ */ T("div", { className: "mp-agent-tool-simple-message", children: o.formProposalPreparing }) : !s.formId || s.fields.length === 0 ? /* @__PURE__ */ T("div", { className: "mp-agent-tool-simple-message", children: o.formProposalNone }) : /* @__PURE__ */ re("div", { className: "mp-agent-tool-body", children: [
@@ -31678,39 +31678,50 @@ const Ia = (e) => e === Yr.Streaming || e === Yr.Processing || e === Yr.WaitingF
31678
31678
  images: n
31679
31679
  };
31680
31680
  }, _7e = ({ call: e }) => {
31681
- const t = Pe(), n = fn(), r = ot(() => v7e(e), [e]), [a, i] = Ze({}), o = Ve(/* @__PURE__ */ new Set()), s = Ge(
31682
- async (u) => {
31683
- if (!u.s3Key || o.current.has(u.attachmentId))
31681
+ const t = Pe(), n = fn(), r = ot(() => v7e(e), [e]), a = je(
31682
+ (p) => {
31683
+ const h = t.config.transport;
31684
+ if (h.mode !== "proxy" || !p.s3Key?.startsWith("generated-images/"))
31685
+ return;
31686
+ const m = p.s3Key.split("/").map(encodeURIComponent).join("/");
31687
+ return `${h.baseUrl}/files/${m}`;
31688
+ },
31689
+ [t.config.transport]
31690
+ ), i = 3, [o, s] = Ze({}), l = Ve(/* @__PURE__ */ new Map()), u = je(
31691
+ async (p) => {
31692
+ const h = l.current.get(p.attachmentId) ?? 0;
31693
+ if (!p.s3Key || h >= i)
31684
31694
  return;
31685
- o.current.add(u.attachmentId);
31686
- const d = t.config.transport;
31687
- if (d.mode === "proxy")
31695
+ l.current.set(p.attachmentId, h + 1);
31696
+ const m = t.config.transport;
31697
+ if (m.mode === "proxy")
31688
31698
  try {
31689
- const p = { "Content-Type": "application/json" };
31690
- d.headers ? Object.assign(p, d.headers) : d.apiKey && (p.Authorization = `Bearer ${d.apiKey}`);
31691
- const h = await fetch(`${d.baseUrl}/files/download/presigned`, {
31699
+ const f = { "Content-Type": "application/json" };
31700
+ m.headers ? Object.assign(f, m.headers) : m.apiKey && (f.Authorization = `Bearer ${m.apiKey}`);
31701
+ const g = await fetch(`${m.baseUrl}/files/download/presigned`, {
31692
31702
  method: "POST",
31693
- headers: p,
31694
- body: JSON.stringify({ s3Key: u.s3Key })
31703
+ credentials: "include",
31704
+ headers: f,
31705
+ body: JSON.stringify({ s3Key: p.s3Key })
31695
31706
  });
31696
- if (!h.ok)
31707
+ if (!g.ok)
31697
31708
  return;
31698
- const m = await h.json();
31699
- typeof m?.url == "string" && i((f) => ({ ...f, [u.attachmentId]: m.url }));
31709
+ const _ = await g.json();
31710
+ typeof _?.url == "string" && s((k) => ({ ...k, [p.attachmentId]: _.url }));
31700
31711
  } catch {
31701
31712
  }
31702
31713
  },
31703
31714
  [t.config.transport]
31704
31715
  );
31705
31716
  Fe(() => {
31706
- r.images.filter((u) => !u.url).forEach((u) => void s(u));
31707
- }, [r.images, s]);
31708
- const l = Ge(async (u, d) => {
31717
+ r.images.filter((p) => !p.url && !a(p)).forEach((p) => void u(p));
31718
+ }, [r.images, u, a]);
31719
+ const d = je(async (p, h) => {
31709
31720
  try {
31710
- const h = await (await fetch(d)).blob(), m = URL.createObjectURL(h), f = document.createElement("a");
31711
- f.href = m, f.download = u.name, f.click(), URL.revokeObjectURL(m);
31721
+ const f = await (await fetch(h, { credentials: "include" })).blob(), g = URL.createObjectURL(f), _ = document.createElement("a");
31722
+ _.href = g, _.download = p.name, _.click(), URL.revokeObjectURL(g);
31712
31723
  } catch {
31713
- window.open(d, "_blank", "noreferrer");
31724
+ window.open(h, "_blank", "noreferrer");
31714
31725
  }
31715
31726
  }, []);
31716
31727
  return e.status === rt.Failed || r.error ? /* @__PURE__ */ re("div", { className: "mp-agent-tool-body", children: [
@@ -31719,24 +31730,24 @@ const Ia = (e) => e === Yr.Streaming || e === Yr.Processing || e === Yr.WaitingF
31719
31730
  ] }) : e.status !== rt.Succeeded ? /* @__PURE__ */ T("div", { className: "mp-agent-tool-body mp-agent-image-tool", children: /* @__PURE__ */ re("div", { className: "mp-agent-image-tool-loading", children: [
31720
31731
  /* @__PURE__ */ T(bd, { size: 16 }),
31721
31732
  /* @__PURE__ */ T("span", { children: n.imageGenerationGenerating })
31722
- ] }) }) : r.images.length ? /* @__PURE__ */ T("div", { className: "mp-agent-tool-body mp-agent-image-tool", children: /* @__PURE__ */ T("div", { className: "mp-agent-image-tool-grid", children: r.images.map((u) => {
31723
- const d = a[u.attachmentId] ?? u.url;
31733
+ ] }) }) : r.images.length ? /* @__PURE__ */ T("div", { className: "mp-agent-tool-body mp-agent-image-tool", children: /* @__PURE__ */ T("div", { className: "mp-agent-image-tool-grid", children: r.images.map((p) => {
31734
+ const h = o[p.attachmentId] ?? a(p) ?? p.url;
31724
31735
  return /* @__PURE__ */ re("figure", { className: "mp-agent-image-tool-item", children: [
31725
- d ? /* @__PURE__ */ T(
31736
+ h ? /* @__PURE__ */ T(
31726
31737
  "img",
31727
31738
  {
31728
- src: d,
31729
- alt: r.prompt || u.name,
31739
+ src: h,
31740
+ alt: r.prompt || p.name,
31730
31741
  title: r.prompt,
31731
31742
  loading: "lazy",
31732
- onError: () => void s(u)
31743
+ onError: () => void u(p)
31733
31744
  }
31734
31745
  ) : /* @__PURE__ */ T("div", { className: "mp-agent-image-tool-placeholder", children: /* @__PURE__ */ T(bd, { size: 20 }) }),
31735
- d ? /* @__PURE__ */ re("figcaption", { className: "mp-agent-image-tool-actions", children: [
31736
- /* @__PURE__ */ T("a", { href: d, target: "_blank", rel: "noreferrer", title: n.imageGenerationOpen, children: /* @__PURE__ */ T(F5, { size: 14 }) }),
31737
- /* @__PURE__ */ T("button", { type: "button", onClick: () => void l(u, d), title: n.imageGenerationDownload, children: /* @__PURE__ */ T($5, { size: 14 }) })
31746
+ h ? /* @__PURE__ */ re("figcaption", { className: "mp-agent-image-tool-actions", children: [
31747
+ /* @__PURE__ */ T("a", { href: h, target: "_blank", rel: "noreferrer", title: n.imageGenerationOpen, children: /* @__PURE__ */ T(F5, { size: 14 }) }),
31748
+ /* @__PURE__ */ T("button", { type: "button", onClick: () => void d(p, h), title: n.imageGenerationDownload, children: /* @__PURE__ */ T($5, { size: 14 }) })
31738
31749
  ] }) : null
31739
- ] }, u.attachmentId);
31750
+ ] }, p.attachmentId);
31740
31751
  }) }) }) : /* @__PURE__ */ T("div", { className: "mp-agent-tool-simple-message", children: n.imageGenerationNone });
31741
31752
  }, Ap = (e) => {
31742
31753
  const { id: t, name: n, url: r, capturedAt: a, source: i, security: o, target: s, kind: l, ...u } = e, d = r ?? i?.url, p = i || d ? { ...i ?? {}, ...d ? { url: d } : {} } : void 0, h = l === "webSnippet" || l === "formSnapshot" || l === "formField" ? !0 : void 0, m = o || (h !== void 0 ? {
@@ -34718,9 +34729,9 @@ const A_e = ip(null), T_e = ({ children: e }) => {
34718
34729
  commitPendingAssistant: V.commitPendingAssistant,
34719
34730
  setPageContextDismissed: V.setPageContextDismissed
34720
34731
  };
34721
- }), x = Ge((V) => !V || V.length === 0 ? !1 : V.some(
34732
+ }), x = je((V) => !V || V.length === 0 ? !1 : V.some(
34722
34733
  (N) => N.type === _t.Context && N?.metadata?.kind === "pageContext"
34723
- ), []), D = Ve(!1), P = Ve(!1), C = Ve(void 0), I = Ve(/* @__PURE__ */ new Set()), q = s ?? l, Y = Ge(
34734
+ ), []), D = Ve(!1), P = Ve(!1), C = Ve(void 0), I = Ve(/* @__PURE__ */ new Set()), q = s ?? l, Y = je(
34724
34735
  async (V, N) => {
34725
34736
  if (!a.transport.generateTitle)
34726
34737
  return;
@@ -34738,7 +34749,7 @@ const A_e = ip(null), T_e = ({ children: e }) => {
34738
34749
  return J;
34739
34750
  },
34740
34751
  [a.transport, a.config.features?.titleGeneration, o]
34741
- ), Z = Ge(
34752
+ ), Z = je(
34742
34753
  async (V, N = []) => {
34743
34754
  const K = a.config.user?.id ?? "guest", J = !s, L = s ?? l, se = { current: L };
34744
34755
  C.current = L;
@@ -34885,7 +34896,7 @@ const A_e = ip(null), T_e = ({ children: e }) => {
34885
34896
  t,
34886
34897
  f
34887
34898
  ]
34888
- ), W = Ge(async () => {
34899
+ ), W = je(async () => {
34889
34900
  if (d !== yt.Idle || P.current || !u.length || D.current)
34890
34901
  return;
34891
34902
  const V = u[0];
@@ -34899,7 +34910,7 @@ const A_e = ip(null), T_e = ({ children: e }) => {
34899
34910
  Fe(() => {
34900
34911
  W();
34901
34912
  }, [W]);
34902
- const R = Ge(
34913
+ const R = je(
34903
34914
  async (V) => {
34904
34915
  if (P.current)
34905
34916
  return;
@@ -34914,7 +34925,7 @@ const A_e = ip(null), T_e = ({ children: e }) => {
34914
34925
  }
34915
34926
  },
34916
34927
  [u, q, _, Z]
34917
- ), H = Ge(
34928
+ ), H = je(
34918
34929
  async (V) => {
34919
34930
  const K = t.current.getDraft().attachments;
34920
34931
  if (!n && d !== yt.Idle) {
@@ -34933,11 +34944,11 @@ const A_e = ip(null), T_e = ({ children: e }) => {
34933
34944
  x,
34934
34945
  S
34935
34946
  ]
34936
- ), j = Ge(() => {
34947
+ ), j = je(() => {
34937
34948
  D.current = !0;
34938
34949
  const V = C.current ?? q;
34939
34950
  I.current.add(V), a.transport.cancelStream?.(V), E(V), h(V, yt.Idle);
34940
- }, [q, a.transport, E, h]), z = Ge(
34951
+ }, [q, a.transport, E, h]), z = je(
34941
34952
  async (V) => {
34942
34953
  d === yt.Streaming && j(), await R(V);
34943
34954
  },
@@ -35461,7 +35472,7 @@ const W_e = ({
35461
35472
  }, [s]), u = ot(
35462
35473
  () => t.model !== void 0 ? t.model : ga,
35463
35474
  [t.model]
35464
- ), d = Ge(
35475
+ ), d = je(
35465
35476
  (p) => {
35466
35477
  p === ga ? (r({ model: void 0 }), q2(e.config.transport, ga)) : (r({ model: p }), q2(e.config.transport, p));
35467
35478
  },
@@ -39216,7 +39227,7 @@ const Dd = fr(/\d/), V9e = fr(/[\dA-Fa-f]/), j9e = fr(/[!-/:-@[-`{-~]/);
39216
39227
  function he(e) {
39217
39228
  return e !== null && e < -2;
39218
39229
  }
39219
- function je(e) {
39230
+ function Ge(e) {
39220
39231
  return e !== null && (e < 0 || e === 32);
39221
39232
  }
39222
39233
  function ze(e) {
@@ -39412,7 +39423,7 @@ function Z9e(e, t, n) {
39412
39423
  return Ae(e, e.attempt(this.parser.constructs.document, t, n), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
39413
39424
  }
39414
39425
  function Jr(e) {
39415
- if (e === null || je(e) || xn(e))
39426
+ if (e === null || Ge(e) || xn(e))
39416
39427
  return 1;
39417
39428
  if (ur(e))
39418
39429
  return 2;
@@ -40085,7 +40096,7 @@ function Av(e, t, n, r, a, i, o, s, l) {
40085
40096
  return k === 60 || k === 62 || k === 92 ? (e.consume(k), m) : m(k);
40086
40097
  }
40087
40098
  function g(k) {
40088
- return !d && (k === null || k === 41 || je(k)) ? (e.exit("chunkString"), e.exit(s), e.exit(o), e.exit(r), t(k)) : d < u && k === 40 ? (e.consume(k), d++, g) : k === 41 ? (e.consume(k), d--, g) : k === null || k === 32 || k === 40 || Xi(k) ? n(k) : (e.consume(k), k === 92 ? _ : g);
40099
+ return !d && (k === null || k === 41 || Ge(k)) ? (e.exit("chunkString"), e.exit(s), e.exit(o), e.exit(r), t(k)) : d < u && k === 40 ? (e.consume(k), d++, g) : k === 41 ? (e.consume(k), d--, g) : k === null || k === 32 || k === 40 || Xi(k) ? n(k) : (e.consume(k), k === 92 ? _ : g);
40089
40100
  }
40090
40101
  function _(k) {
40091
40102
  return k === 40 || k === 41 || k === 92 ? (e.consume(k), g) : g(k);
@@ -40173,7 +40184,7 @@ function Mxe(e, t, n) {
40173
40184
  return a = _n(r.sliceSerialize(r.events[r.events.length - 1][1]).slice(1, -1)), m === 58 ? (e.enter("definitionMarker"), e.consume(m), e.exit("definitionMarker"), l) : n(m);
40174
40185
  }
40175
40186
  function l(m) {
40176
- return je(m) ? qn(e, u)(m) : u(m);
40187
+ return Ge(m) ? qn(e, u)(m) : u(m);
40177
40188
  }
40178
40189
  function u(m) {
40179
40190
  return Av(
@@ -40201,7 +40212,7 @@ function Mxe(e, t, n) {
40201
40212
  function Sxe(e, t, n) {
40202
40213
  return r;
40203
40214
  function r(s) {
40204
- return je(s) ? qn(e, a)(s) : n(s);
40215
+ return Ge(s) ? qn(e, a)(s) : n(s);
40205
40216
  }
40206
40217
  function a(s) {
40207
40218
  return Cv(e, i, n, "definitionTitle", "definitionTitleMarker", "definitionTitleString")(s);
@@ -40254,7 +40265,7 @@ function Rxe(e, t, n) {
40254
40265
  return e.enter("atxHeadingSequence"), o(d);
40255
40266
  }
40256
40267
  function o(d) {
40257
- return d === 35 && r++ < 6 ? (e.consume(d), o) : d === null || je(d) ? (e.exit("atxHeadingSequence"), s(d)) : n(d);
40268
+ return d === 35 && r++ < 6 ? (e.consume(d), o) : d === null || Ge(d) ? (e.exit("atxHeadingSequence"), s(d)) : n(d);
40258
40269
  }
40259
40270
  function s(d) {
40260
40271
  return d === 35 ? (e.enter("atxHeadingSequence"), l(d)) : d === null || he(d) ? (e.exit("atxHeading"), t(d)) : ze(d) ? Ae(e, s, "whitespace")(d) : (e.enter("atxHeadingText"), u(d));
@@ -40263,7 +40274,7 @@ function Rxe(e, t, n) {
40263
40274
  return d === 35 ? (e.consume(d), l) : (e.exit("atxHeadingSequence"), s(d));
40264
40275
  }
40265
40276
  function u(d) {
40266
- return d === null || d === 35 || je(d) ? (e.exit("atxHeadingText"), s(d)) : (e.consume(d), u);
40277
+ return d === null || d === 35 || Ge(d) ? (e.exit("atxHeadingText"), s(d)) : (e.consume(d), u);
40267
40278
  }
40268
40279
  }
40269
40280
  const Ixe = [
@@ -40374,7 +40385,7 @@ function $xe(e, t, n) {
40374
40385
  return $t(L) ? (e.consume(L), o = String.fromCharCode(L), _) : n(L);
40375
40386
  }
40376
40387
  function _(L) {
40377
- if (L === null || L === 47 || L === 62 || je(L)) {
40388
+ if (L === null || L === 47 || L === 62 || Ge(L)) {
40378
40389
  const se = L === 47, ye = o.toLowerCase();
40379
40390
  return !se && !i && vm.includes(ye) ? (a = 1, r.interrupt ? t(L) : Y(L)) : Ixe.includes(o.toLowerCase()) ? (a = 6, se ? (e.consume(L), k) : r.interrupt ? t(L) : Y(L)) : (a = 7, r.interrupt && !r.parser.lazy[r.now().line] ? n(L) : i ? b(L) : w(L));
40380
40391
  }
@@ -40402,7 +40413,7 @@ function $xe(e, t, n) {
40402
40413
  return L === l ? (e.consume(L), l = null, C) : L === null || he(L) ? n(L) : (e.consume(L), D);
40403
40414
  }
40404
40415
  function P(L) {
40405
- return L === null || L === 34 || L === 39 || L === 47 || L === 60 || L === 61 || L === 62 || L === 96 || je(L) ? S(L) : (e.consume(L), P);
40416
+ return L === null || L === 34 || L === 39 || L === 47 || L === 60 || L === 61 || L === 62 || L === 96 || Ge(L) ? S(L) : (e.consume(L), P);
40406
40417
  }
40407
40418
  function C(L) {
40408
40419
  return L === 47 || L === 62 || ze(L) ? w(L) : n(L);
@@ -40528,7 +40539,7 @@ function Bxe(e, t, n) {
40528
40539
  return he(N) ? (o = D, j(N)) : ze(N) ? (e.consume(N), D) : H(N);
40529
40540
  }
40530
40541
  function P(N) {
40531
- return N === 45 || Ct(N) ? (e.consume(N), P) : N === 47 || N === 62 || je(N) ? C(N) : n(N);
40542
+ return N === 45 || Ct(N) ? (e.consume(N), P) : N === 47 || N === 62 || Ge(N) ? C(N) : n(N);
40532
40543
  }
40533
40544
  function C(N) {
40534
40545
  return N === 47 ? (e.consume(N), H) : N === 58 || N === 95 || $t(N) ? (e.consume(N), I) : he(N) ? (o = C, j(N)) : ze(N) ? (e.consume(N), C) : H(N);
@@ -40546,10 +40557,10 @@ function Bxe(e, t, n) {
40546
40557
  return N === a ? (e.consume(N), a = void 0, R) : N === null ? n(N) : he(N) ? (o = Z, j(N)) : (e.consume(N), Z);
40547
40558
  }
40548
40559
  function W(N) {
40549
- return N === null || N === 34 || N === 39 || N === 60 || N === 61 || N === 96 ? n(N) : N === 47 || N === 62 || je(N) ? C(N) : (e.consume(N), W);
40560
+ return N === null || N === 34 || N === 39 || N === 60 || N === 61 || N === 96 ? n(N) : N === 47 || N === 62 || Ge(N) ? C(N) : (e.consume(N), W);
40550
40561
  }
40551
40562
  function R(N) {
40552
- return N === 47 || N === 62 || je(N) ? C(N) : n(N);
40563
+ return N === 47 || N === 62 || Ge(N) ? C(N) : n(N);
40553
40564
  }
40554
40565
  function H(N) {
40555
40566
  return N === 62 ? (e.consume(N), e.exit("htmlTextData"), e.exit("htmlText"), t) : n(N);
@@ -40663,13 +40674,13 @@ function Kxe(e, t, n) {
40663
40674
  return e.enter("resource"), e.enter("resourceMarker"), e.consume(p), e.exit("resourceMarker"), a;
40664
40675
  }
40665
40676
  function a(p) {
40666
- return je(p) ? qn(e, i)(p) : i(p);
40677
+ return Ge(p) ? qn(e, i)(p) : i(p);
40667
40678
  }
40668
40679
  function i(p) {
40669
40680
  return p === 41 ? d(p) : Av(e, o, s, "resourceDestination", "resourceDestinationLiteral", "resourceDestinationLiteralMarker", "resourceDestinationRaw", "resourceDestinationString", 32)(p);
40670
40681
  }
40671
40682
  function o(p) {
40672
- return je(p) ? qn(e, l)(p) : d(p);
40683
+ return Ge(p) ? qn(e, l)(p) : d(p);
40673
40684
  }
40674
40685
  function s(p) {
40675
40686
  return n(p);
@@ -40678,7 +40689,7 @@ function Kxe(e, t, n) {
40678
40689
  return p === 34 || p === 39 || p === 40 ? Cv(e, u, n, "resourceTitle", "resourceTitleMarker", "resourceTitleString")(p) : d(p);
40679
40690
  }
40680
40691
  function u(p) {
40681
- return je(p) ? qn(e, d)(p) : d(p);
40692
+ return Ge(p) ? qn(e, d)(p) : d(p);
40682
40693
  }
40683
40694
  function d(p) {
40684
40695
  return p === 41 ? (e.enter("resourceMarker"), e.consume(p), e.exit("resourceMarker"), e.exit("resource"), t) : n(p);
@@ -45422,7 +45433,7 @@ function FNe(e, t, n) {
45422
45433
  return p === 47 ? (e.consume(p), i ? u : (i = !0, l)) : n(p);
45423
45434
  }
45424
45435
  function u(p) {
45425
- return p === null || Xi(p) || je(p) || xn(p) || ur(p) ? n(p) : e.attempt(s6, e.attempt(l6, d), n)(p);
45436
+ return p === null || Xi(p) || Ge(p) || xn(p) || ur(p) ? n(p) : e.attempt(s6, e.attempt(l6, d), n)(p);
45426
45437
  }
45427
45438
  function d(p) {
45428
45439
  return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), t(p);
@@ -45442,7 +45453,7 @@ function qNe(e, t, n) {
45442
45453
  let r, a, i;
45443
45454
  return o;
45444
45455
  function o(u) {
45445
- return u === 46 || u === 95 ? e.check(c6, l, s)(u) : u === null || je(u) || xn(u) || u !== 45 && ur(u) ? l(u) : (i = !0, e.consume(u), o);
45456
+ return u === 46 || u === 95 ? e.check(c6, l, s)(u) : u === null || Ge(u) || xn(u) || u !== 45 && ur(u) ? l(u) : (i = !0, e.consume(u), o);
45446
45457
  }
45447
45458
  function s(u) {
45448
45459
  return u === 95 ? r = !0 : (a = r, r = void 0), e.consume(u), o;
@@ -45455,7 +45466,7 @@ function BNe(e, t) {
45455
45466
  let n = 0, r = 0;
45456
45467
  return a;
45457
45468
  function a(o) {
45458
- return o === 40 ? (n++, e.consume(o), a) : o === 41 && r < n ? i(o) : o === 33 || o === 34 || o === 38 || o === 39 || o === 41 || o === 42 || o === 44 || o === 46 || o === 58 || o === 59 || o === 60 || o === 63 || o === 93 || o === 95 || o === 126 ? e.check(c6, t, i)(o) : o === null || je(o) || xn(o) ? t(o) : (e.consume(o), a);
45469
+ return o === 40 ? (n++, e.consume(o), a) : o === 41 && r < n ? i(o) : o === 33 || o === 34 || o === 38 || o === 39 || o === 41 || o === 42 || o === 44 || o === 46 || o === 58 || o === 59 || o === 60 || o === 63 || o === 93 || o === 95 || o === 126 ? e.check(c6, t, i)(o) : o === null || Ge(o) || xn(o) ? t(o) : (e.consume(o), a);
45459
45470
  }
45460
45471
  function i(o) {
45461
45472
  return o === 41 && r++, e.consume(o), a;
@@ -45467,11 +45478,11 @@ function UNe(e, t, n) {
45467
45478
  return s === 33 || s === 34 || s === 39 || s === 41 || s === 42 || s === 44 || s === 46 || s === 58 || s === 59 || s === 63 || s === 95 || s === 126 ? (e.consume(s), r) : s === 38 ? (e.consume(s), i) : s === 93 ? (e.consume(s), a) : (
45468
45479
  // `<` is an end.
45469
45480
  s === 60 || // So is whitespace.
45470
- s === null || je(s) || xn(s) ? t(s) : n(s)
45481
+ s === null || Ge(s) || xn(s) ? t(s) : n(s)
45471
45482
  );
45472
45483
  }
45473
45484
  function a(s) {
45474
- return s === null || s === 40 || s === 91 || je(s) || xn(s) ? t(s) : r(s);
45485
+ return s === null || s === 40 || s === 91 || Ge(s) || xn(s) ? t(s) : r(s);
45475
45486
  }
45476
45487
  function i(s) {
45477
45488
  return $t(s) ? o(s) : n(s);
@@ -45490,7 +45501,7 @@ function HNe(e, t, n) {
45490
45501
  }
45491
45502
  }
45492
45503
  function p6(e) {
45493
- return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || je(e);
45504
+ return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || Ge(e);
45494
45505
  }
45495
45506
  function h6(e) {
45496
45507
  return !$t(e);
@@ -45637,7 +45648,7 @@ function KNe(e, t, n) {
45637
45648
  i > 999 || // Closing brace with nothing.
45638
45649
  p === 93 && !o || // Space or tab is not supported by GFM for some reason.
45639
45650
  // `\n` and `[` not being supported makes sense.
45640
- p === null || p === 91 || je(p)
45651
+ p === null || p === 91 || Ge(p)
45641
45652
  )
45642
45653
  return n(p);
45643
45654
  if (p === 93) {
@@ -45645,7 +45656,7 @@ function KNe(e, t, n) {
45645
45656
  const h = e.exit("gfmFootnoteCallString");
45646
45657
  return a.includes(_n(r.sliceSerialize(h))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(p), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), t) : n(p);
45647
45658
  }
45648
- return je(p) || (o = !0), i++, e.consume(p), p === 92 ? d : u;
45659
+ return Ge(p) || (o = !0), i++, e.consume(p), p === 92 ? d : u;
45649
45660
  }
45650
45661
  function d(p) {
45651
45662
  return p === 91 || p === 92 || p === 93 ? (e.consume(p), i++, u) : u(p);
@@ -45667,7 +45678,7 @@ function YNe(e, t, n) {
45667
45678
  o > 999 || // Closing brace with nothing.
45668
45679
  f === 93 && !s || // Space or tab is not supported by GFM for some reason.
45669
45680
  // `\n` and `[` not being supported makes sense.
45670
- f === null || f === 91 || je(f)
45681
+ f === null || f === 91 || Ge(f)
45671
45682
  )
45672
45683
  return n(f);
45673
45684
  if (f === 93) {
@@ -45675,7 +45686,7 @@ function YNe(e, t, n) {
45675
45686
  const g = e.exit("gfmFootnoteDefinitionLabelString");
45676
45687
  return i = _n(r.sliceSerialize(g)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(f), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), h;
45677
45688
  }
45678
- return je(f) || (s = !0), o++, e.consume(f), f === 92 ? p : d;
45689
+ return Ge(f) || (s = !0), o++, e.consume(f), f === 92 ? p : d;
45679
45690
  }
45680
45691
  function p(f) {
45681
45692
  return f === 91 || f === 92 || f === 93 ? (e.consume(f), o++, d) : d(f);
@@ -45890,7 +45901,7 @@ function aAe(e, t, n) {
45890
45901
  return I === null ? n(I) : he(I) ? i > 1 ? (i = 0, r.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(I), e.exit("lineEnding"), m) : n(I) : ze(I) ? Ae(e, d, "whitespace")(I) : (i += 1, o && (o = !1, a += 1), I === 124 ? (e.enter("tableCellDivider"), e.consume(I), e.exit("tableCellDivider"), o = !0, d) : (e.enter("data"), p(I)));
45891
45902
  }
45892
45903
  function p(I) {
45893
- return I === null || I === 124 || je(I) ? (e.exit("data"), d(I)) : (e.consume(I), I === 92 ? h : p);
45904
+ return I === null || I === 124 || Ge(I) ? (e.exit("data"), d(I)) : (e.consume(I), I === 92 ? h : p);
45894
45905
  }
45895
45906
  function h(I) {
45896
45907
  return I === 92 || I === 124 ? (e.consume(I), p) : p(I);
@@ -45929,7 +45940,7 @@ function aAe(e, t, n) {
45929
45940
  return I === 124 ? (e.enter("tableCellDivider"), e.consume(I), e.exit("tableCellDivider"), D) : I === null || he(I) ? (e.exit("tableRow"), t(I)) : ze(I) ? Ae(e, D, "whitespace")(I) : (e.enter("data"), P(I));
45930
45941
  }
45931
45942
  function P(I) {
45932
- return I === null || I === 124 || je(I) ? (e.exit("data"), D(I)) : (e.consume(I), I === 92 ? C : P);
45943
+ return I === null || I === 124 || Ge(I) ? (e.exit("data"), D(I)) : (e.consume(I), I === 92 ? C : P);
45933
45944
  }
45934
45945
  function C(I) {
45935
45946
  return I === 92 || I === 124 ? (e.consume(I), P) : P(I);
@@ -46015,7 +46026,7 @@ function lAe(e, t, n) {
46015
46026
  );
46016
46027
  }
46017
46028
  function i(l) {
46018
- return je(l) ? (e.enter("taskListCheckValueUnchecked"), e.consume(l), e.exit("taskListCheckValueUnchecked"), o) : l === 88 || l === 120 ? (e.enter("taskListCheckValueChecked"), e.consume(l), e.exit("taskListCheckValueChecked"), o) : n(l);
46029
+ return Ge(l) ? (e.enter("taskListCheckValueUnchecked"), e.consume(l), e.exit("taskListCheckValueUnchecked"), o) : l === 88 || l === 120 ? (e.enter("taskListCheckValueChecked"), e.consume(l), e.exit("taskListCheckValueChecked"), o) : n(l);
46019
46030
  }
46020
46031
  function o(l) {
46021
46032
  return l === 93 ? (e.enter("taskListCheckMarker"), e.consume(l), e.exit("taskListCheckMarker"), e.exit("taskListCheck"), s) : n(l);
@@ -58687,7 +58698,7 @@ function _h(e, t, n, r, a, i, o, s, l, u, d, p, h, m, f) {
58687
58698
  return e.enter(r), e.enter(a), e.consume(R), e.exit(a), b;
58688
58699
  }
58689
58700
  function b(R) {
58690
- return R === 35 ? (g = o, w(R)) : R === 46 ? (g = s, w(R)) : f && ze(R) ? Ae(e, b, "whitespace")(R) : !f && je(R) ? qn(e, b)(R) : R === null || he(R) || xn(R) || ur(R) && R !== 45 && R !== 95 ? W(R) : (e.enter(i), e.enter(l), e.consume(R), x);
58701
+ return R === 35 ? (g = o, w(R)) : R === 46 ? (g = s, w(R)) : f && ze(R) ? Ae(e, b, "whitespace")(R) : !f && Ge(R) ? qn(e, b)(R) : R === null || he(R) || xn(R) || ur(R) && R !== 45 && R !== 95 ? W(R) : (e.enter(i), e.enter(l), e.consume(R), x);
58691
58702
  }
58692
58703
  function w(R) {
58693
58704
  const H = (
@@ -58697,7 +58708,7 @@ function _h(e, t, n, r, a, i, o, s, l, u, d, p, h, m, f) {
58697
58708
  return e.enter(i), e.enter(g), e.enter(H), e.consume(R), e.exit(H), E;
58698
58709
  }
58699
58710
  function E(R) {
58700
- if (R === null || R === 34 || R === 35 || R === 39 || R === 46 || R === 60 || R === 61 || R === 62 || R === 96 || R === 125 || je(R))
58711
+ if (R === null || R === 34 || R === 35 || R === 39 || R === 46 || R === 60 || R === 61 || R === 62 || R === 96 || R === 125 || Ge(R))
58701
58712
  return n(R);
58702
58713
  const H = (
58703
58714
  /** @type {TokenType} */
@@ -58708,7 +58719,7 @@ function _h(e, t, n, r, a, i, o, s, l, u, d, p, h, m, f) {
58708
58719
  function S(R) {
58709
58720
  if (R === null || R === 34 || R === 39 || R === 60 || R === 61 || R === 62 || R === 96)
58710
58721
  return n(R);
58711
- if (R === 35 || R === 46 || R === 125 || je(R)) {
58722
+ if (R === 35 || R === 46 || R === 125 || Ge(R)) {
58712
58723
  const H = (
58713
58724
  /** @type {TokenType} */
58714
58725
  g + "Value"
@@ -58718,16 +58729,16 @@ function _h(e, t, n, r, a, i, o, s, l, u, d, p, h, m, f) {
58718
58729
  return e.consume(R), S;
58719
58730
  }
58720
58731
  function x(R) {
58721
- return R === null || he(R) || xn(R) || ur(R) && R !== 45 && R !== 46 && R !== 58 && R !== 95 ? (e.exit(l), f && ze(R) ? Ae(e, D, "whitespace")(R) : !f && je(R) ? qn(e, D)(R) : D(R)) : (e.consume(R), x);
58732
+ return R === null || he(R) || xn(R) || ur(R) && R !== 45 && R !== 46 && R !== 58 && R !== 95 ? (e.exit(l), f && ze(R) ? Ae(e, D, "whitespace")(R) : !f && Ge(R) ? qn(e, D)(R) : D(R)) : (e.consume(R), x);
58722
58733
  }
58723
58734
  function D(R) {
58724
58735
  return R === 61 ? (e.enter(u), e.consume(R), e.exit(u), P) : (e.exit(i), b(R));
58725
58736
  }
58726
58737
  function P(R) {
58727
- return R === null || R === 60 || R === 61 || R === 62 || R === 96 || R === 125 || f && he(R) ? n(R) : R === 34 || R === 39 ? (e.enter(d), e.enter(h), e.consume(R), e.exit(h), _ = R, I) : f && ze(R) ? Ae(e, P, "whitespace")(R) : !f && je(R) ? qn(e, P)(R) : (e.enter(p), e.enter(m), e.consume(R), _ = void 0, C);
58738
+ return R === null || R === 60 || R === 61 || R === 62 || R === 96 || R === 125 || f && he(R) ? n(R) : R === 34 || R === 39 ? (e.enter(d), e.enter(h), e.consume(R), e.exit(h), _ = R, I) : f && ze(R) ? Ae(e, P, "whitespace")(R) : !f && Ge(R) ? qn(e, P)(R) : (e.enter(p), e.enter(m), e.consume(R), _ = void 0, C);
58728
58739
  }
58729
58740
  function C(R) {
58730
- return R === null || R === 34 || R === 39 || R === 60 || R === 61 || R === 62 || R === 96 ? n(R) : R === 125 || je(R) ? (e.exit(m), e.exit(p), e.exit(i), b(R)) : (e.consume(R), C);
58741
+ return R === null || R === 34 || R === 39 || R === 60 || R === 61 || R === 62 || R === 96 ? n(R) : R === 125 || Ge(R) ? (e.exit(m), e.exit(p), e.exit(i), b(R)) : (e.consume(R), C);
58731
58742
  }
58732
58743
  function I(R) {
58733
58744
  return R === _ ? (e.enter(h), e.consume(R), e.exit(h), e.exit(d), e.exit(i), Z) : (e.enter(p), q(R));
@@ -58739,7 +58750,7 @@ function _h(e, t, n, r, a, i, o, s, l, u, d, p, h, m, f) {
58739
58750
  return R === _ || R === null || he(R) ? (e.exit(m), q(R)) : (e.consume(R), Y);
58740
58751
  }
58741
58752
  function Z(R) {
58742
- return R === 125 || je(R) ? b(R) : W(R);
58753
+ return R === 125 || Ge(R) ? b(R) : W(R);
58743
58754
  }
58744
58755
  function W(R) {
58745
58756
  return R === 125 ? (e.enter(a), e.consume(R), e.exit(a), e.exit(r), t) : n(R);
@@ -96905,7 +96916,7 @@ const oVe = {
96905
96916
  );
96906
96917
  R7.displayName = "CodeContent";
96907
96918
  const I7 = ft(({ lang: e = "text", codeChildren: t, allowExecution: n = !1 }) => {
96908
- const { colorMode: r } = C7e(), a = ap(t).replace(/\n$/, ""), i = r === "light" ? eVe : JHe, { truncated: o, isTruncated: s, totalLines: l } = ot(() => iVe(a), [a]), [u, d] = Ze(!1), p = Ge(() => d((f) => !f), []), h = u ? a : o, m = ot(() => aVe(h), [h]);
96919
+ const { colorMode: r } = C7e(), a = ap(t).replace(/\n$/, ""), i = r === "light" ? eVe : JHe, { truncated: o, isTruncated: s, totalLines: l } = ot(() => iVe(a), [a]), [u, d] = Ze(!1), p = je(() => d((f) => !f), []), h = u ? a : o, m = ot(() => aVe(h), [h]);
96909
96920
  return /* @__PURE__ */ re("div", { className: "mp-agent-code-block-wrapper", children: [
96910
96921
  /* @__PURE__ */ re("div", { className: "mp-agent-code-block-header", children: [
96911
96922
  /* @__PURE__ */ T("span", { className: "mp-agent-code-block-language", children: e }),
@@ -97148,7 +97159,7 @@ const L7 = () => /* @__PURE__ */ re("span", { className: "mp-agent-message-typin
97148
97159
  overscan: 8,
97149
97160
  gap: 16,
97150
97161
  getItemKey: (S) => i[S]?.id ?? S
97151
- }), b = k.getVirtualItems(), w = Ge(() => {
97162
+ }), b = k.getVirtualItems(), w = je(() => {
97152
97163
  const S = h.current;
97153
97164
  S && (S.scrollTop = S.scrollHeight);
97154
97165
  }, []);