teodor-new-chat-ui 3.0.71 → 3.0.72

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
@@ -214,7 +214,7 @@ function fm() {
214
214
  var le = typeof WeakMap == "function" ? WeakMap : Map;
215
215
  ne = new le();
216
216
  }
217
- function se(T, U) {
217
+ function ie(T, U) {
218
218
  if (!T || Z)
219
219
  return "";
220
220
  {
@@ -286,7 +286,7 @@ function fm() {
286
286
  return typeof T == "function" && ne.set(T, za), za;
287
287
  }
288
288
  function ke(T, U, te) {
289
- return se(T, !1);
289
+ return ie(T, !1);
290
290
  }
291
291
  function Fe(T) {
292
292
  var U = T.prototype;
@@ -296,7 +296,7 @@ function fm() {
296
296
  if (T == null)
297
297
  return "";
298
298
  if (typeof T == "function")
299
- return se(T, Fe(T));
299
+ return ie(T, Fe(T));
300
300
  if (typeof T == "string")
301
301
  return P(T);
302
302
  switch (T) {
@@ -466,13 +466,13 @@ function fm() {
466
466
  return Rs(T, Te, ft, _e, ge, Ve.current, Ie);
467
467
  }
468
468
  }
469
- var J = b.ReactCurrentOwner, ie = b.ReactDebugCurrentFrame;
469
+ var J = b.ReactCurrentOwner, se = b.ReactDebugCurrentFrame;
470
470
  function Re(T) {
471
471
  if (T) {
472
472
  var U = T._owner, te = Le(T.type, T._source, U ? U.type : null);
473
- ie.setExtraStackFrame(te);
473
+ se.setExtraStackFrame(te);
474
474
  } else
475
- ie.setExtraStackFrame(null);
475
+ se.setExtraStackFrame(null);
476
476
  }
477
477
  var Pe;
478
478
  Pe = !1;
@@ -3073,10 +3073,10 @@ function ao({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3073
3073
  }, [u, z, q, I]), le = We(async () => {
3074
3074
  if (!z) throw new Error("No active thread");
3075
3075
  await P(z);
3076
- }, [z, P]), se = at(!1);
3076
+ }, [z, P]), ie = at(!1);
3077
3077
  Ge(() => {
3078
- const H = se.current;
3079
- if (se.current = d, H && !d && z) {
3078
+ const H = ie.current;
3079
+ if (ie.current = d, H && !d && z) {
3080
3080
  const ae = w.lastCheckpointId ?? void 0;
3081
3081
  (async () => {
3082
3082
  try {
@@ -4708,8 +4708,8 @@ const _n = Ne(
4708
4708
  let Y = 0;
4709
4709
  for (const P of Yo(O, he, be)) {
4710
4710
  const Z = P.value, ne = Math.max(P.start, he), le = Math.min(P.end, be);
4711
- for (let se = ne; se <= le; se++)
4712
- z.push({ data: $ == null ? void 0 : $[se], index: se, offset: Y, size: Z }), Y += Z;
4711
+ for (let ie = ne; ie <= le; ie++)
4712
+ z.push({ data: $ == null ? void 0 : $[ie], index: ie, offset: Y, size: Z }), Y += Z;
4713
4713
  }
4714
4714
  }
4715
4715
  if (!M)
@@ -4724,13 +4724,13 @@ const _n = Ne(
4724
4724
  const ne = Y.size;
4725
4725
  if (Y.offset < C) {
4726
4726
  Z += Math.floor((C - Y.offset + N) / (ne + N));
4727
- const se = Z - be.start;
4728
- P += se * ne + se * N;
4727
+ const ie = Z - be.start;
4728
+ P += ie * ne + ie * N;
4729
4729
  }
4730
4730
  Z < X && (P += (X - Z) * ne, Z = X);
4731
4731
  const le = Math.min(be.end, F);
4732
- for (let se = Z; se <= le && !(P >= R); se++)
4733
- he.push({ data: $ == null ? void 0 : $[se], index: se, offset: P, size: ne }), P += ne + N;
4732
+ for (let ie = Z; ie <= le && !(P >= R); ie++)
4733
+ he.push({ data: $ == null ? void 0 : $[ie], index: ie, offset: P, size: ne }), P += ne + N;
4734
4734
  }
4735
4735
  });
4736
4736
  return co(ee, z, I, N, L, G);
@@ -5908,7 +5908,7 @@ const yv = /* @__PURE__ */ Ne(
5908
5908
  ), Oe(
5909
5909
  B(
5910
5910
  Ze(g, z, k, A, _, X),
5911
- pe(([P, Z, ne, le, , se]) => P && !Z && ne.height !== 0 && le.height !== 0 && !se)
5911
+ pe(([P, Z, ne, le, , ie]) => P && !Z && ne.height !== 0 && le.height !== 0 && !ie)
5912
5912
  ),
5913
5913
  ([, , , , P]) => {
5914
5914
  ye(X, !0), Gi(1, () => {
@@ -5977,7 +5977,7 @@ const yv = /* @__PURE__ */ Ne(
5977
5977
  P,
5978
5978
  [Z, ne],
5979
5979
  le,
5980
- se,
5980
+ ie,
5981
5981
  ke,
5982
5982
  Fe,
5983
5983
  Le,
@@ -5985,7 +5985,7 @@ const yv = /* @__PURE__ */ Ne(
5985
5985
  ue,
5986
5986
  je
5987
5987
  ]) => {
5988
- const { column: xe, row: H } = le, { height: ae, width: Be } = se, { width: nt } = ke;
5988
+ const { column: xe, row: H } = le, { height: ae, width: Be } = ie, { width: nt } = ke;
5989
5989
  if (Le === 0 && (P === 0 || nt === 0))
5990
5990
  return jl;
5991
5991
  if (Be === 0) {
@@ -5995,7 +5995,7 @@ const yv = /* @__PURE__ */ Ne(
5995
5995
  const dt = Ru(nt, Be, xe);
5996
5996
  let rt, Qe;
5997
5997
  ue ? Z === 0 && ne === 0 && Le > 0 ? (rt = 0, Qe = Le - 1) : (rt = dt * No((Z + H) / (ae + H)), Qe = dt * Al((ne + H) / (ae + H)) - 1, Qe = Ds(P - 1, vr(Qe, dt - 1)), rt = Ds(Qe, vr(0, rt))) : (rt = 0, Qe = -1);
5998
- const Ct = Pl(rt, Qe, Fe), { bottom: Ve, top: st } = _l(ke, le, se, Ct), Ke = Al(P / dt), it = Ke * ae + (Ke - 1) * H - Ve;
5998
+ const Ct = Pl(rt, Qe, Fe), { bottom: Ve, top: st } = _l(ke, le, ie, Ct), Ke = Al(P / dt), it = Ke * ae + (Ke - 1) * H - Ve;
5999
5999
  return { bottom: Ve, itemHeight: ae, items: Ct, itemWidth: Be, offsetBottom: it, offsetTop: st, top: st };
6000
6000
  }
6001
6001
  )
@@ -6013,8 +6013,8 @@ const yv = /* @__PURE__ */ Ne(
6013
6013
  Ze(A, k, I, $),
6014
6014
  pe(([P, Z, { items: ne }]) => ne.length > 0 && Z.height !== 0 && P.height !== 0),
6015
6015
  re(([P, Z, { items: ne }, le]) => {
6016
- const { bottom: se, top: ke } = _l(P, le, Z, ne);
6017
- return [ke, se];
6016
+ const { bottom: ie, top: ke } = _l(P, le, Z, ne);
6017
+ return [ke, ie];
6018
6018
  }),
6019
6019
  He(Tr)
6020
6020
  ),
@@ -6065,11 +6065,11 @@ const yv = /* @__PURE__ */ Ne(
6065
6065
  B(
6066
6066
  M,
6067
6067
  Se(A, k, C, $),
6068
- re(([P, Z, ne, le, se]) => {
6068
+ re(([P, Z, ne, le, ie]) => {
6069
6069
  const ke = lu(P), { align: Fe, behavior: Le, offset: ue } = ke;
6070
6070
  let je = ke.index;
6071
6071
  je === "LAST" && (je = le - 1), je = vr(0, je, Ds(le - 1, je));
6072
- let xe = hi(Z, se, ne, je);
6072
+ let xe = hi(Z, ie, ne, je);
6073
6073
  return Fe === "end" ? xe = kl(xe - Z.height + ne.height) : Fe === "center" && (xe = kl(xe - Z.height / 2 + ne.height / 2)), ue && (xe += ue), { behavior: Le, top: xe };
6074
6074
  })
6075
6075
  ),
@@ -8504,7 +8504,7 @@ const Nw = K.memo(function({
8504
8504
  default:
8505
8505
  return ue;
8506
8506
  }
8507
- }, se = () => {
8507
+ }, ie = () => {
8508
8508
  const ue = D(
8509
8509
  "rounded-lg px-4 py-3 relative transition-all duration-200 min-w-0 max-w-full break-words",
8510
8510
  O && "px-3 py-2 text-sm"
@@ -8633,7 +8633,7 @@ const Nw = K.memo(function({
8633
8633
  ] });
8634
8634
  }, Le = wn(() => Mw(t), [t]);
8635
8635
  return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
8636
- /* @__PURE__ */ l.jsx("div", { className: D(le(), g.container), children: /* @__PURE__ */ l.jsxs("div", { className: D(se(), g.content), children: [
8636
+ /* @__PURE__ */ l.jsx("div", { className: D(le(), g.container), children: /* @__PURE__ */ l.jsxs("div", { className: D(ie(), g.content), children: [
8637
8637
  (a || c || z) && /* @__PURE__ */ l.jsxs(
8638
8638
  "div",
8639
8639
  {
@@ -10479,7 +10479,7 @@ var Od = "PopperAnchor", Md = f.forwardRef(
10479
10479
  Md.displayName = Od;
10480
10480
  var va = "PopperContent", [rS, oS] = kd(va), Dd = f.forwardRef(
10481
10481
  (e, t) => {
10482
- var Y, P, Z, ne, le, se;
10482
+ var Y, P, Z, ne, le, ie;
10483
10483
  const {
10484
10484
  __scopePopper: n,
10485
10485
  side: r = "bottom",
@@ -10555,7 +10555,7 @@ var va = "PopperContent", [rS, oS] = kd(va), Dd = f.forwardRef(
10555
10555
  // hide the content if using the hide middleware and should be hidden
10556
10556
  // set visibility to hidden and disable pointer events so the UI behaves
10557
10557
  // as if the PopperContent isn't there at all
10558
- ...((se = O.hide) == null ? void 0 : se.referenceHidden) && {
10558
+ ...((ie = O.hide) == null ? void 0 : ie.referenceHidden) && {
10559
10559
  visibility: "hidden",
10560
10560
  pointerEvents: "none"
10561
10561
  }
@@ -11712,46 +11712,46 @@ function vo({
11712
11712
  isLoadingHistory: I,
11713
11713
  loadOlderMessages: A,
11714
11714
  api: k
11715
- } = Hi(), [M, W] = de(null), [G, N] = de(""), [$, L] = de(null), [q, O] = de([]), [_, z] = de(!1), [X, oe] = de(null), [F, ee] = de(null), [he, be] = de(!1), [Y, P] = de(null), [Z, ne] = de([]), [le, se] = de(null);
11715
+ } = Hi(), [M, W] = de(null), [G, N] = de(""), [$, L] = de(null), [q, O] = de([]), [_, z] = de(!1), [X, oe] = de(null), [F, ee] = de(null), [he, be] = de(!1), [Y, P] = de(null), [Z, ne] = de([]), [le, ie] = de(null);
11716
11716
  at(null);
11717
11717
  const ke = at(null), Fe = at(null), Le = at(null), ue = at(!1), je = at(!0), xe = at(0), H = at(null), [ae, Be] = de("desktop");
11718
11718
  Ge(() => {
11719
11719
  const J = () => {
11720
- const ie = window.innerWidth;
11721
- Be(ie < 640 ? "phone" : ie < 1024 ? "tablet" : "desktop");
11720
+ const se = window.innerWidth;
11721
+ Be(se < 640 ? "phone" : se < 1024 ? "tablet" : "desktop");
11722
11722
  };
11723
11723
  return J(), window.addEventListener("resize", J), () => window.removeEventListener("resize", J);
11724
11724
  }, []), Ge(() => {
11725
11725
  let J = !1;
11726
11726
  if (!p) {
11727
- ne([]), se(null), H.current = null;
11727
+ ne([]), ie(null), H.current = null;
11728
11728
  return;
11729
11729
  }
11730
- const ie = {
11730
+ const se = {
11731
11731
  threadId: p,
11732
11732
  checkpointId: y ?? null
11733
11733
  }, Re = H.current;
11734
- if (!(Re && Re.threadId === ie.threadId && Re.checkpointId === ie.checkpointId))
11734
+ if (!(Re && Re.threadId === se.threadId && Re.checkpointId === se.checkpointId))
11735
11735
  return E(p).then((Pe) => {
11736
11736
  if (J) return;
11737
11737
  const Qt = ((Pe == null ? void 0 : Pe.checkpoints) ?? []).slice().sort((on, Ln) => new Date(Ln.createdAt).getTime() - new Date(on.createdAt).getTime());
11738
- ne(Qt), se((on) => {
11738
+ ne(Qt), ie((on) => {
11739
11739
  var Ln;
11740
11740
  return on ?? ((Ln = Qt[0]) == null ? void 0 : Ln.checkpointId) ?? null;
11741
- }), H.current = ie;
11741
+ }), H.current = se;
11742
11742
  }).catch((Pe) => {
11743
11743
  console.error("ChatInterface - listCheckpoints error:", Pe), J || (ne([]), H.current = null);
11744
11744
  }), () => {
11745
11745
  J = !0;
11746
11746
  };
11747
11747
  }, [p, y, E]), Ge(() => {
11748
- y && se(y);
11748
+ y && ie(y);
11749
11749
  }, [y]);
11750
11750
  const nt = We(async () => {
11751
11751
  if (!R || I) return;
11752
11752
  const J = Le.current;
11753
11753
  if (!J) return;
11754
- const ie = J.scrollHeight, Re = J.scrollTop;
11754
+ const se = J.scrollHeight, Re = J.scrollTop;
11755
11755
  ue.current = !0;
11756
11756
  try {
11757
11757
  await A();
@@ -11765,7 +11765,7 @@ function vo({
11765
11765
  return;
11766
11766
  }
11767
11767
  const Qt = Pe.scrollHeight;
11768
- Pe.scrollTop = Re + (Qt - ie);
11768
+ Pe.scrollTop = Re + (Qt - se);
11769
11769
  const on = Qt - Pe.scrollTop - Pe.clientHeight;
11770
11770
  je.current = on <= 32, ue.current = !1;
11771
11771
  });
@@ -11779,10 +11779,10 @@ function vo({
11779
11779
  }, [v]), Ge(() => {
11780
11780
  (async () => {
11781
11781
  try {
11782
- const ie = await k.getAgent("default");
11783
- P(ie.uiDefaultMessage || null);
11784
- } catch (ie) {
11785
- console.warn("Failed to fetch default message:", ie), P(null);
11782
+ const se = await k.getAgent("default");
11783
+ P(se.uiDefaultMessage || null);
11784
+ } catch (se) {
11785
+ console.warn("Failed to fetch default message:", se), P(null);
11786
11786
  }
11787
11787
  })();
11788
11788
  }, [k]), Ge(() => {
@@ -11793,60 +11793,60 @@ function vo({
11793
11793
  return `Message too long (${J.length}/${go} characters)`;
11794
11794
  try {
11795
11795
  return zw(J), null;
11796
- } catch (ie) {
11797
- return (ie == null ? void 0 : ie.message) || "Invalid message";
11796
+ } catch (se) {
11797
+ return (se == null ? void 0 : se.message) || "Invalid message";
11798
11798
  }
11799
11799
  }, rt = (J) => {
11800
- const ie = J.content || [], Re = ie.filter((Pe) => Pe.type === "text").map((Pe) => Pe.text).join("");
11800
+ const se = J.content || [], Re = se.filter((Pe) => Pe.type === "text").map((Pe) => Pe.text).join("");
11801
11801
  if (Re) return Re;
11802
11802
  try {
11803
- return JSON.stringify(ie, null, 2);
11803
+ return JSON.stringify(se, null, 2);
11804
11804
  } catch {
11805
- return String(ie);
11805
+ return String(se);
11806
11806
  }
11807
11807
  }, Qe = async (J) => {
11808
- const ie = J.trim();
11809
- if (!(!ie && q.length === 0)) {
11810
- if (ie) {
11811
- const Re = dt(ie);
11808
+ const se = J.trim();
11809
+ if (!(!se && q.length === 0)) {
11810
+ if (se) {
11811
+ const Re = dt(se);
11812
11812
  if (Re) {
11813
11813
  L(Re);
11814
11814
  return;
11815
11815
  }
11816
11816
  }
11817
11817
  try {
11818
- await b(ie, { checkpointId: le || y || void 0, payloadExtras: M ? { edit: !0, originalMessageId: M } : void 0, attachments: q }), u == null || u(ie), L(null), O([]), W(null), N("");
11818
+ await b(se, { checkpointId: le || y || void 0, payloadExtras: M ? { edit: !0, originalMessageId: M } : void 0, attachments: q }), u == null || u(se), L(null), O([]), W(null), N("");
11819
11819
  } catch (Re) {
11820
11820
  const Pe = (Re == null ? void 0 : Re.message) || "Failed to send message";
11821
11821
  L(Pe), h == null || h(Pe);
11822
11822
  }
11823
11823
  }
11824
- }, Ct = K.useCallback((J, ie) => {
11825
- a && (W(J), N(ie), L(null));
11824
+ }, Ct = K.useCallback((J, se) => {
11825
+ a && (W(J), N(se), L(null));
11826
11826
  }, [a]), Ve = K.useCallback(() => {
11827
11827
  W(null), N(""), L(null);
11828
- }, []), st = We((J, ie) => {
11829
- Ct(J, ie);
11828
+ }, []), st = We((J, se) => {
11829
+ Ct(J, se);
11830
11830
  }, [Ct]), Ke = We((J) => {
11831
- for (let ie = J - 1; ie >= 0; ie--)
11832
- if (v[ie].role === "user") {
11833
- const Re = rt(v[ie]);
11831
+ for (let se = J - 1; se >= 0; se--)
11832
+ if (v[se].role === "user") {
11833
+ const Re = rt(v[se]);
11834
11834
  Re && b(Re, { checkpointId: le || y || void 0 });
11835
11835
  break;
11836
11836
  }
11837
11837
  }, [v, b, le, y, rt]), it = (J) => {
11838
- const ie = Array.from(J.target.files || []);
11839
- O((Re) => [...Re, ...ie]);
11840
- }, Pt = (J) => O((ie) => ie.filter((Re, Pe) => J !== Pe)), vn = async (J) => {
11841
- const ie = (J.target.files || [])[0];
11842
- if (ie) {
11838
+ const se = Array.from(J.target.files || []);
11839
+ O((Re) => [...Re, ...se]);
11840
+ }, Pt = (J) => O((se) => se.filter((Re, Pe) => J !== Pe)), vn = async (J) => {
11841
+ const se = (J.target.files || [])[0];
11842
+ if (se) {
11843
11843
  oe(null), ee(null), z(!0);
11844
11844
  try {
11845
11845
  await b("", {
11846
11846
  checkpointId: le || y || void 0,
11847
- attachments: [ie]
11847
+ attachments: [se]
11848
11848
  });
11849
- const Re = `Uploaded ${ie.name} - processing through chat stream`;
11849
+ const Re = `Uploaded ${se.name} - processing through chat stream`;
11850
11850
  ee(Re);
11851
11851
  } catch (Re) {
11852
11852
  const Pe = Re instanceof Error ? Re.message : "Failed to upload Excel file";
@@ -11857,15 +11857,15 @@ function vo({
11857
11857
  }
11858
11858
  }, Dn = (J) => {
11859
11859
  if (!J) return "Unknown";
11860
- const ie = Date.parse(J);
11861
- return Number.isNaN(ie) ? J : new Date(ie).toLocaleString();
11860
+ const se = Date.parse(J);
11861
+ return Number.isNaN(se) ? J : new Date(se).toLocaleString();
11862
11862
  }, Ue = async (J) => {
11863
11863
  if (p) {
11864
11864
  if (!J) {
11865
- await C(), se(null);
11865
+ await C(), ie(null);
11866
11866
  return;
11867
11867
  }
11868
- await S(J), se(J);
11868
+ await S(J), ie(J);
11869
11869
  }
11870
11870
  }, ur = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${c.container || ""}`, Rs = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-y-auto overflow-x-auto overscroll-contain break-words break-anywhere p-4 space-y-4 bg-transparent ${c.messagesArea || ""}`, Es = `flex-shrink-0 w-full border-t p-4 bg-transparent ${c.inputArea || ""}`;
11871
11871
  return /* @__PURE__ */ l.jsxs("div", { className: ur, children: [
@@ -11891,8 +11891,8 @@ function vo({
11891
11891
  className: "border border-border rounded px-2 py-1 text-xs bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring dark:bg-secondary",
11892
11892
  value: le ?? "",
11893
11893
  onChange: (J) => {
11894
- const ie = J.target.value || null;
11895
- Ue(ie);
11894
+ const se = J.target.value || null;
11895
+ Ue(se);
11896
11896
  },
11897
11897
  children: [
11898
11898
  /* @__PURE__ */ l.jsx("option", { value: "", children: "Latest" }),
@@ -11913,35 +11913,36 @@ function vo({
11913
11913
  gv,
11914
11914
  {
11915
11915
  data: v,
11916
- followOutput: "smooth",
11916
+ followOutput: g ? "auto" : "smooth",
11917
11917
  overscan: 120,
11918
11918
  increaseViewportBy: { top: 200, bottom: 200 },
11919
11919
  startReached: () => {
11920
11920
  nt();
11921
11921
  },
11922
11922
  style: { height: "100%", overscrollBehavior: "contain" },
11923
+ computeItemKey: (J, se) => se.id ?? `message-${J}`,
11923
11924
  components: {
11924
- Scroller: K.forwardRef((J, ie) => /* @__PURE__ */ l.jsx(
11925
+ Scroller: K.forwardRef((J, se) => /* @__PURE__ */ l.jsx(
11925
11926
  "div",
11926
11927
  {
11927
11928
  ...J,
11928
- ref: ie,
11929
+ ref: se,
11929
11930
  style: {
11930
- overflowAnchor: "auto",
11931
+ overflowAnchor: "none",
11931
11932
  willChange: "transform",
11932
11933
  ...(J == null ? void 0 : J.style) ?? {}
11933
11934
  }
11934
11935
  }
11935
11936
  ))
11936
11937
  },
11937
- itemContent: (J, ie) => /* @__PURE__ */ l.jsx(
11938
+ itemContent: (J, se) => /* @__PURE__ */ l.jsx(
11938
11939
  Nw,
11939
11940
  {
11940
- message: ie,
11941
+ message: se,
11941
11942
  messageIndex: J,
11942
- isStreamingMessage: g && x === ie.id,
11943
+ isStreamingMessage: g && x === se.id,
11943
11944
  streamingDebounceMs: o,
11944
- isEditing: M === ie.id,
11945
+ isEditing: M === se.id,
11945
11946
  showActions: a,
11946
11947
  showTimestamp: !1,
11947
11948
  showAgentName: !0,
@@ -11952,7 +11953,7 @@ function vo({
11952
11953
  onRegenerate: () => Ke(J),
11953
11954
  onCancelEdit: Ve
11954
11955
  },
11955
- ie.id ?? `msg-${ie.role}-${J}-${ie.createdAt ?? ""}`
11956
+ se.id ?? `msg-${se.role}-${J}-${se.createdAt ?? ""}`
11956
11957
  )
11957
11958
  }
11958
11959
  )
@@ -11987,7 +11988,7 @@ function vo({
11987
11988
  className: "hidden"
11988
11989
  }
11989
11990
  ),
11990
- q.length > 0 && /* @__PURE__ */ l.jsx("div", { className: "flex flex-wrap gap-2", children: q.map((J, ie) => /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100", children: [
11991
+ q.length > 0 && /* @__PURE__ */ l.jsx("div", { className: "flex flex-wrap gap-2", children: q.map((J, se) => /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100", children: [
11991
11992
  /* @__PURE__ */ l.jsx(Ka, { size: 14 }),
11992
11993
  /* @__PURE__ */ l.jsx("span", { className: "truncate max-w-[150px]", children: J.name }),
11993
11994
  /* @__PURE__ */ l.jsx(
@@ -11995,13 +11996,13 @@ function vo({
11995
11996
  {
11996
11997
  variant: "ghost",
11997
11998
  size: "sm",
11998
- onClick: () => Pt(ie),
11999
+ onClick: () => Pt(se),
11999
12000
  className: "h-4 w-4 p-0 text-gray-500 dark:text-gray-400 hover:text-red-500 dark:hover:text-red-400",
12000
12001
  "aria-label": `Remove ${J.name}`,
12001
12002
  children: /* @__PURE__ */ l.jsx(Vn, { size: 12 })
12002
12003
  }
12003
12004
  )
12004
- ] }, ie)) })
12005
+ ] }, se)) })
12005
12006
  ] }),
12006
12007
  i && /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
12007
12008
  /* @__PURE__ */ l.jsx(
@@ -14258,9 +14259,9 @@ var Ot = 10, [ep, xn] = cr(kn), dT = "SelectContentImpl", fT = Xn("SelectContent
14258
14259
  }, [y]), sa();
14259
14260
  const L = f.useCallback(
14260
14261
  (Y) => {
14261
- const [P, ...Z] = W().map((se) => se.ref.current), [ne] = Z.slice(-1), le = document.activeElement;
14262
- for (const se of Y)
14263
- if (se === le || (se == null || se.scrollIntoView({ block: "nearest" }), se === P && S && (S.scrollTop = 0), se === ne && S && (S.scrollTop = S.scrollHeight), se == null || se.focus(), document.activeElement !== le)) return;
14262
+ const [P, ...Z] = W().map((ie) => ie.ref.current), [ne] = Z.slice(-1), le = document.activeElement;
14263
+ for (const ie of Y)
14264
+ if (ie === le || (ie == null || ie.scrollIntoView({ block: "nearest" }), ie === P && S && (S.scrollTop = 0), ie === ne && S && (S.scrollTop = S.scrollHeight), ie == null || ie.focus(), document.activeElement !== le)) return;
14264
14265
  },
14265
14266
  [W, S]
14266
14267
  ), q = f.useCallback(
@@ -14275,10 +14276,10 @@ var Ot = 10, [ep, xn] = cr(kn), dT = "SelectContentImpl", fT = Xn("SelectContent
14275
14276
  if (y) {
14276
14277
  let Y = { x: 0, y: 0 };
14277
14278
  const P = (ne) => {
14278
- var le, se;
14279
+ var le, ie;
14279
14280
  Y = {
14280
14281
  x: Math.abs(Math.round(ne.pageX) - (((le = _.current) == null ? void 0 : le.x) ?? 0)),
14281
- y: Math.abs(Math.round(ne.pageY) - (((se = _.current) == null ? void 0 : se.y) ?? 0))
14282
+ y: Math.abs(Math.round(ne.pageY) - (((ie = _.current) == null ? void 0 : ie.y) ?? 0))
14282
14283
  };
14283
14284
  }, Z = (ne) => {
14284
14285
  Y.x <= 10 && Y.y <= 10 ? ne.preventDefault() : y.contains(ne.target) || O(!1), document.removeEventListener("pointermove", P), _.current = null;
@@ -14382,8 +14383,8 @@ var Ot = 10, [ep, xn] = cr(kn), dT = "SelectContentImpl", fT = Xn("SelectContent
14382
14383
  if (Y.key === "Tab" && Y.preventDefault(), !P && Y.key.length === 1 && X(Y.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(Y.key)) {
14383
14384
  let ne = W().filter((le) => !le.disabled).map((le) => le.ref.current);
14384
14385
  if (["ArrowUp", "End"].includes(Y.key) && (ne = ne.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(Y.key)) {
14385
- const le = Y.target, se = ne.indexOf(le);
14386
- ne = ne.slice(se + 1);
14386
+ const le = Y.target, ie = ne.indexOf(le);
14387
+ ne = ne.slice(ie + 1);
14387
14388
  }
14388
14389
  setTimeout(() => L(ne)), Y.preventDefault();
14389
14390
  }
@@ -14404,7 +14405,7 @@ var hT = "SelectItemAlignedPosition", np = f.forwardRef((e, t) => {
14404
14405
  if (s.trigger && s.valueNode && a && u && x && m && b) {
14405
14406
  const R = s.trigger.getBoundingClientRect(), I = u.getBoundingClientRect(), A = s.valueNode.getBoundingClientRect(), k = b.getBoundingClientRect();
14406
14407
  if (s.dir !== "rtl") {
14407
- const le = k.left - I.left, se = A.left - le, ke = R.left - se, Fe = R.width + ke, Le = Math.max(Fe, I.width), ue = window.innerWidth - Ot, je = Ri(se, [
14408
+ const le = k.left - I.left, ie = A.left - le, ke = R.left - ie, Fe = R.width + ke, Le = Math.max(Fe, I.width), ue = window.innerWidth - Ot, je = Ri(ie, [
14408
14409
  Ot,
14409
14410
  // Prevents the content from going off the starting edge of the
14410
14411
  // viewport. It may still go off the ending edge, but this can be
@@ -14415,7 +14416,7 @@ var hT = "SelectItemAlignedPosition", np = f.forwardRef((e, t) => {
14415
14416
  ]);
14416
14417
  a.style.minWidth = Fe + "px", a.style.left = je + "px";
14417
14418
  } else {
14418
- const le = I.right - k.right, se = window.innerWidth - A.right - le, ke = window.innerWidth - R.right - se, Fe = R.width + ke, Le = Math.max(Fe, I.width), ue = window.innerWidth - Ot, je = Ri(se, [
14419
+ const le = I.right - k.right, ie = window.innerWidth - A.right - le, ke = window.innerWidth - R.right - ie, Fe = R.width + ke, Le = Math.max(Fe, I.width), ue = window.innerWidth - Ot, je = Ri(ie, [
14419
14420
  Ot,
14420
14421
  Math.max(Ot, ue - Le)
14421
14422
  ]);
@@ -14425,10 +14426,10 @@ var hT = "SelectItemAlignedPosition", np = f.forwardRef((e, t) => {
14425
14426
  if (P <= ee) {
14426
14427
  const le = M.length > 0 && m === M[M.length - 1].ref.current;
14427
14428
  a.style.bottom = "0px";
14428
- const se = u.clientHeight - x.offsetTop - x.offsetHeight, ke = Math.max(
14429
+ const ie = u.clientHeight - x.offsetTop - x.offsetHeight, ke = Math.max(
14429
14430
  he,
14430
14431
  be + // viewport might have padding bottom, include it to avoid a scrollable viewport
14431
- (le ? F : 0) + se + q
14432
+ (le ? F : 0) + ie + q
14432
14433
  ), Fe = P + ke;
14433
14434
  a.style.height = Fe + "px";
14434
14435
  } else {