teodor-new-chat-ui 3.0.77 → 3.0.78

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
@@ -9070,7 +9070,7 @@ function Hw({
9070
9070
  var C;
9071
9071
  if (!m.current && v.current) {
9072
9072
  if (t) {
9073
- if (Date.now() - E.current < 200) return;
9073
+ if (Date.now() - E.current < 100) return;
9074
9074
  y.current && cancelAnimationFrame(y.current), y.current = requestAnimationFrame(() => {
9075
9075
  var j;
9076
9076
  (j = x.current) == null || j.scrollToIndex({
@@ -9082,7 +9082,7 @@ function Hw({
9082
9082
  } else
9083
9083
  (C = x.current) == null || C.scrollToIndex({
9084
9084
  index: Math.max(0, e.length - 1),
9085
- behavior: "smooth",
9085
+ behavior: "auto",
9086
9086
  align: "end"
9087
9087
  });
9088
9088
  return () => {
@@ -9127,23 +9127,17 @@ function Hw({
9127
9127
  x.current = C;
9128
9128
  },
9129
9129
  data: e,
9130
- followOutput: !1,
9131
- alignToBottom: !t,
9132
- overscan: { main: 400, reverse: 400 },
9133
- increaseViewportBy: { top: 800, bottom: 800 },
9134
- defaultItemHeight: 150,
9135
- fixedItemHeight: t ? 150 : void 0,
9130
+ followOutput: t ? !1 : "smooth",
9131
+ overscan: { main: 300, reverse: 300 },
9132
+ increaseViewportBy: { top: 600, bottom: 600 },
9133
+ defaultItemHeight: 100,
9136
9134
  startReached: () => {
9137
9135
  S && S();
9138
9136
  },
9139
9137
  atBottomStateChange: (C) => {
9140
9138
  v.current = C;
9141
9139
  },
9142
- style: {
9143
- height: "100%",
9144
- overscrollBehavior: "contain",
9145
- scrollBehavior: t ? "auto" : "smooth"
9146
- },
9140
+ style: { height: "100%", overscrollBehavior: "contain" },
9147
9141
  computeItemKey: (C, I) => I.id ?? `message-${C}`,
9148
9142
  components: {
9149
9143
  Scroller: K.forwardRef((C, I) => /* @__PURE__ */ l.jsx(
@@ -9153,9 +9147,8 @@ function Hw({
9153
9147
  ref: (N) => T(N, I),
9154
9148
  style: {
9155
9149
  overflowAnchor: "none",
9156
- willChange: t ? "contents" : "transform",
9157
- contain: t ? "strict" : "layout style paint",
9158
- contentVisibility: t ? "auto" : "visible",
9150
+ willChange: t ? "scroll-position" : "transform",
9151
+ contain: "layout style paint",
9159
9152
  ...(C == null ? void 0 : C.style) ?? {}
9160
9153
  }
9161
9154
  }
@@ -9167,12 +9160,9 @@ function Hw({
9167
9160
  className: "mb-4 last:mb-0",
9168
9161
  style: {
9169
9162
  contentVisibility: "auto",
9170
- containIntrinsicSize: t ? "1px 200px" : "auto 150px",
9171
- contain: t ? "size layout style paint" : "layout style paint",
9163
+ containIntrinsicSize: "auto 150px",
9172
9164
  transform: "translateZ(0)",
9173
- isolation: "isolate",
9174
- minHeight: t && n === I.id ? "200px" : void 0,
9175
- maxHeight: t && n === I.id ? "none" : void 0
9165
+ isolation: "isolate"
9176
9166
  },
9177
9167
  children: /* @__PURE__ */ l.jsx(
9178
9168
  Nw,
@@ -10589,11 +10579,11 @@ const Ky = (e) => {
10589
10579
  }), Qy = (e, t) => ({
10590
10580
  ...$y(e),
10591
10581
  options: [e, t]
10592
- }), e0 = (e, t) => ({
10582
+ }), eS = (e, t) => ({
10593
10583
  ...Ky(e),
10594
10584
  options: [e, t]
10595
10585
  });
10596
- var t0 = "Arrow", Nd = f.forwardRef((e, t) => {
10586
+ var tS = "Arrow", Nd = f.forwardRef((e, t) => {
10597
10587
  const { children: n, width: r = 10, height: o = 5, ...s } = e;
10598
10588
  return /* @__PURE__ */ l.jsx(
10599
10589
  me.svg,
@@ -10608,8 +10598,8 @@ var t0 = "Arrow", Nd = f.forwardRef((e, t) => {
10608
10598
  }
10609
10599
  );
10610
10600
  });
10611
- Nd.displayName = t0;
10612
- var n0 = Nd;
10601
+ Nd.displayName = tS;
10602
+ var nS = Nd;
10613
10603
  function jd(e) {
10614
10604
  const [t, n] = f.useState(void 0);
10615
10605
  return nt(() => {
@@ -10632,9 +10622,9 @@ function jd(e) {
10632
10622
  n(void 0);
10633
10623
  }, [e]), t;
10634
10624
  }
10635
- var ma = "Popper", [Ad, ar] = $t(ma), [r0, kd] = Ad(ma), Pd = (e) => {
10625
+ var ma = "Popper", [Ad, ar] = $t(ma), [rS, kd] = Ad(ma), Pd = (e) => {
10636
10626
  const { __scopePopper: t, children: n } = e, [r, o] = f.useState(null);
10637
- return /* @__PURE__ */ l.jsx(r0, { scope: t, anchor: r, onAnchorChange: o, children: n });
10627
+ return /* @__PURE__ */ l.jsx(rS, { scope: t, anchor: r, onAnchorChange: o, children: n });
10638
10628
  };
10639
10629
  Pd.displayName = ma;
10640
10630
  var _d = "PopperAnchor", Od = f.forwardRef(
@@ -10647,7 +10637,7 @@ var _d = "PopperAnchor", Od = f.forwardRef(
10647
10637
  }
10648
10638
  );
10649
10639
  Od.displayName = _d;
10650
- var ga = "PopperContent", [o0, s0] = Ad(ga), Md = f.forwardRef(
10640
+ var ga = "PopperContent", [oS, sS] = Ad(ga), Md = f.forwardRef(
10651
10641
  (e, t) => {
10652
10642
  var Y, P, Z, ne, ae, se;
10653
10643
  const {
@@ -10667,7 +10657,7 @@ var ga = "PopperContent", [o0, s0] = Ad(ga), Md = f.forwardRef(
10667
10657
  ...x
10668
10658
  } = e, m = kd(ga, n), [v, w] = f.useState(null), y = Ce(t, (je) => w(je)), [E, S] = f.useState(null), T = jd(E), C = (T == null ? void 0 : T.width) ?? 0, I = (T == null ? void 0 : T.height) ?? 0, N = r + (s !== "center" ? "-" + s : ""), j = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, M = Array.isArray(u) ? u : [u], W = M.length > 0, G = {
10669
10659
  padding: j,
10670
- boundary: M.filter(a0),
10660
+ boundary: M.filter(aS),
10671
10661
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
10672
10662
  altBoundary: W
10673
10663
  }, { refs: A, floatingStyles: H, placement: L, isPositioned: q, middlewareData: O } = Gy({
@@ -10696,8 +10686,8 @@ var ga = "PopperContent", [o0, s0] = Ad(ga), Md = f.forwardRef(
10696
10686
  $.setProperty("--radix-popper-available-width", `${Oe}px`), $.setProperty("--radix-popper-available-height", `${ue}px`), $.setProperty("--radix-popper-anchor-width", `${Pe}px`), $.setProperty("--radix-popper-anchor-height", `${xe}px`);
10697
10687
  }
10698
10688
  }),
10699
- E && e0({ element: E, padding: a }),
10700
- l0({ arrowWidth: C, arrowHeight: I }),
10689
+ E && eS({ element: E, padding: a }),
10690
+ lS({ arrowWidth: C, arrowHeight: I }),
10701
10691
  p && Qy({ strategy: "referenceHidden", ...G })
10702
10692
  ]
10703
10693
  }), [_, z] = Fd(L), X = ot(g);
@@ -10732,7 +10722,7 @@ var ga = "PopperContent", [o0, s0] = Ad(ga), Md = f.forwardRef(
10732
10722
  },
10733
10723
  dir: e.dir,
10734
10724
  children: /* @__PURE__ */ l.jsx(
10735
- o0,
10725
+ oS,
10736
10726
  {
10737
10727
  scope: n,
10738
10728
  placedSide: _,
@@ -10762,13 +10752,13 @@ var ga = "PopperContent", [o0, s0] = Ad(ga), Md = f.forwardRef(
10762
10752
  }
10763
10753
  );
10764
10754
  Md.displayName = ga;
10765
- var Dd = "PopperArrow", i0 = {
10755
+ var Dd = "PopperArrow", iS = {
10766
10756
  top: "bottom",
10767
10757
  right: "left",
10768
10758
  bottom: "top",
10769
10759
  left: "right"
10770
10760
  }, Ld = f.forwardRef(function(t, n) {
10771
- const { __scopePopper: r, ...o } = t, s = s0(Dd, r), i = i0[s.placedSide];
10761
+ const { __scopePopper: r, ...o } = t, s = sS(Dd, r), i = iS[s.placedSide];
10772
10762
  return (
10773
10763
  // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
10774
10764
  // doesn't report size as we'd expect on SVG elements.
@@ -10797,7 +10787,7 @@ var Dd = "PopperArrow", i0 = {
10797
10787
  visibility: s.shouldHideArrow ? "hidden" : void 0
10798
10788
  },
10799
10789
  children: /* @__PURE__ */ l.jsx(
10800
- n0,
10790
+ nS,
10801
10791
  {
10802
10792
  ...o,
10803
10793
  ref: n,
@@ -10813,10 +10803,10 @@ var Dd = "PopperArrow", i0 = {
10813
10803
  );
10814
10804
  });
10815
10805
  Ld.displayName = Dd;
10816
- function a0(e) {
10806
+ function aS(e) {
10817
10807
  return e !== null;
10818
10808
  }
10819
- var l0 = (e) => ({
10809
+ var lS = (e) => ({
10820
10810
  name: "transformOrigin",
10821
10811
  options: e,
10822
10812
  fn(t) {
@@ -10830,14 +10820,14 @@ function Fd(e) {
10830
10820
  const [t, n = "center"] = e.split("-");
10831
10821
  return [t, n];
10832
10822
  }
10833
- var xa = Pd, va = Od, ba = Md, wa = Ld, Ys = "rovingFocusGroup.onEntryFocus", c0 = { bubbles: !1, cancelable: !0 }, $r = "RovingFocusGroup", [wi, Bd, u0] = la($r), [d0, Hd] = $t(
10823
+ var xa = Pd, va = Od, ba = Md, wa = Ld, Ys = "rovingFocusGroup.onEntryFocus", cS = { bubbles: !1, cancelable: !0 }, $r = "RovingFocusGroup", [wi, Bd, uS] = la($r), [dS, Hd] = $t(
10834
10824
  $r,
10835
- [u0]
10836
- ), [f0, h0] = d0($r), $d = f.forwardRef(
10837
- (e, t) => /* @__PURE__ */ l.jsx(wi.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ l.jsx(wi.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ l.jsx(p0, { ...e, ref: t }) }) })
10825
+ [uS]
10826
+ ), [fS, hS] = dS($r), $d = f.forwardRef(
10827
+ (e, t) => /* @__PURE__ */ l.jsx(wi.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ l.jsx(wi.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ l.jsx(pS, { ...e, ref: t }) }) })
10838
10828
  );
10839
10829
  $d.displayName = $r;
10840
- var p0 = f.forwardRef((e, t) => {
10830
+ var pS = f.forwardRef((e, t) => {
10841
10831
  const {
10842
10832
  __scopeRovingFocusGroup: n,
10843
10833
  orientation: r,
@@ -10860,7 +10850,7 @@ var p0 = f.forwardRef((e, t) => {
10860
10850
  if (I)
10861
10851
  return I.addEventListener(Ys, y), () => I.removeEventListener(Ys, y);
10862
10852
  }, [y]), /* @__PURE__ */ l.jsx(
10863
- f0,
10853
+ fS,
10864
10854
  {
10865
10855
  scope: n,
10866
10856
  orientation: r,
@@ -10894,7 +10884,7 @@ var p0 = f.forwardRef((e, t) => {
10894
10884
  onFocus: Q(e.onFocus, (I) => {
10895
10885
  const N = !S.current;
10896
10886
  if (I.target === I.currentTarget && N && !v) {
10897
- const j = new CustomEvent(Ys, c0);
10887
+ const j = new CustomEvent(Ys, cS);
10898
10888
  if (I.currentTarget.dispatchEvent(j), !j.defaultPrevented) {
10899
10889
  const M = E().filter((L) => L.focusable), W = M.find((L) => L.active), G = M.find((L) => L.id === x), H = [W, G, ...M].filter(
10900
10890
  Boolean
@@ -10918,7 +10908,7 @@ var p0 = f.forwardRef((e, t) => {
10918
10908
  tabStopId: s,
10919
10909
  children: i,
10920
10910
  ...a
10921
- } = e, c = Dt(), u = s || c, d = h0(zd, n), h = d.currentTabStopId === u, p = Bd(n), { onFocusableItemAdd: b, onFocusableItemRemove: g, currentTabStopId: x } = d;
10911
+ } = e, c = Dt(), u = s || c, d = hS(zd, n), h = d.currentTabStopId === u, p = Bd(n), { onFocusableItemAdd: b, onFocusableItemRemove: g, currentTabStopId: x } = d;
10922
10912
  return f.useEffect(() => {
10923
10913
  if (r)
10924
10914
  return b(), () => g();
@@ -10946,7 +10936,7 @@ var p0 = f.forwardRef((e, t) => {
10946
10936
  return;
10947
10937
  }
10948
10938
  if (m.target !== m.currentTarget) return;
10949
- const v = x0(m, d.orientation, d.dir);
10939
+ const v = xS(m, d.orientation, d.dir);
10950
10940
  if (v !== void 0) {
10951
10941
  if (m.metaKey || m.ctrlKey || m.altKey || m.shiftKey) return;
10952
10942
  m.preventDefault();
@@ -10955,7 +10945,7 @@ var p0 = f.forwardRef((e, t) => {
10955
10945
  else if (v === "prev" || v === "next") {
10956
10946
  v === "prev" && y.reverse();
10957
10947
  const E = y.indexOf(m.currentTarget);
10958
- y = d.loop ? v0(y, E + 1) : y.slice(E + 1);
10948
+ y = d.loop ? vS(y, E + 1) : y.slice(E + 1);
10959
10949
  }
10960
10950
  setTimeout(() => Wd(y));
10961
10951
  }
@@ -10968,7 +10958,7 @@ var p0 = f.forwardRef((e, t) => {
10968
10958
  }
10969
10959
  );
10970
10960
  Ud.displayName = zd;
10971
- var m0 = {
10961
+ var mS = {
10972
10962
  ArrowLeft: "prev",
10973
10963
  ArrowUp: "prev",
10974
10964
  ArrowRight: "next",
@@ -10978,33 +10968,33 @@ var m0 = {
10978
10968
  PageDown: "last",
10979
10969
  End: "last"
10980
10970
  };
10981
- function g0(e, t) {
10971
+ function gS(e, t) {
10982
10972
  return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
10983
10973
  }
10984
- function x0(e, t, n) {
10985
- const r = g0(e.key, n);
10974
+ function xS(e, t, n) {
10975
+ const r = gS(e.key, n);
10986
10976
  if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r)))
10987
- return m0[r];
10977
+ return mS[r];
10988
10978
  }
10989
10979
  function Wd(e, t = !1) {
10990
10980
  const n = document.activeElement;
10991
10981
  for (const r of e)
10992
10982
  if (r === n || (r.focus({ preventScroll: t }), document.activeElement !== n)) return;
10993
10983
  }
10994
- function v0(e, t) {
10984
+ function vS(e, t) {
10995
10985
  return e.map((n, r) => e[(t + r) % e.length]);
10996
10986
  }
10997
- var b0 = $d, w0 = Ud, yi = ["Enter", " "], y0 = ["ArrowDown", "PageUp", "Home"], Vd = ["ArrowUp", "PageDown", "End"], S0 = [...y0, ...Vd], C0 = {
10987
+ var bS = $d, wS = Ud, yi = ["Enter", " "], yS = ["ArrowDown", "PageUp", "Home"], Vd = ["ArrowUp", "PageDown", "End"], SS = [...yS, ...Vd], CS = {
10998
10988
  ltr: [...yi, "ArrowRight"],
10999
10989
  rtl: [...yi, "ArrowLeft"]
11000
- }, T0 = {
10990
+ }, TS = {
11001
10991
  ltr: ["ArrowLeft"],
11002
10992
  rtl: ["ArrowRight"]
11003
- }, zr = "Menu", [Ir, R0, E0] = la(zr), [Pn, Gd] = $t(zr, [
11004
- E0,
10993
+ }, zr = "Menu", [Ir, RS, ES] = la(zr), [Pn, Gd] = $t(zr, [
10994
+ ES,
11005
10995
  ar,
11006
10996
  Hd
11007
- ]), us = ar(), Kd = Hd(), [I0, _n] = Pn(zr), [N0, Ur] = Pn(zr), Yd = (e) => {
10997
+ ]), us = ar(), Kd = Hd(), [IS, _n] = Pn(zr), [NS, Ur] = Pn(zr), Yd = (e) => {
11008
10998
  const { __scopeMenu: t, open: n = !1, children: r, dir: o, onOpenChange: s, modal: i = !0 } = e, a = us(t), [c, u] = f.useState(null), d = f.useRef(!1), h = ot(s), p = ss(o);
11009
10999
  return f.useEffect(() => {
11010
11000
  const b = () => {
@@ -11014,7 +11004,7 @@ var b0 = $d, w0 = Ud, yi = ["Enter", " "], y0 = ["ArrowDown", "PageUp", "Home"],
11014
11004
  document.removeEventListener("keydown", b, { capture: !0 }), document.removeEventListener("pointerdown", g, { capture: !0 }), document.removeEventListener("pointermove", g, { capture: !0 });
11015
11005
  };
11016
11006
  }, []), /* @__PURE__ */ l.jsx(xa, { ...a, children: /* @__PURE__ */ l.jsx(
11017
- I0,
11007
+ IS,
11018
11008
  {
11019
11009
  scope: t,
11020
11010
  open: n,
@@ -11022,7 +11012,7 @@ var b0 = $d, w0 = Ud, yi = ["Enter", " "], y0 = ["ArrowDown", "PageUp", "Home"],
11022
11012
  content: c,
11023
11013
  onContentChange: u,
11024
11014
  children: /* @__PURE__ */ l.jsx(
11025
- N0,
11015
+ NS,
11026
11016
  {
11027
11017
  scope: t,
11028
11018
  onClose: f.useCallback(() => h(!1), [h]),
@@ -11036,26 +11026,26 @@ var b0 = $d, w0 = Ud, yi = ["Enter", " "], y0 = ["ArrowDown", "PageUp", "Home"],
11036
11026
  ) });
11037
11027
  };
11038
11028
  Yd.displayName = zr;
11039
- var j0 = "MenuAnchor", ya = f.forwardRef(
11029
+ var jS = "MenuAnchor", ya = f.forwardRef(
11040
11030
  (e, t) => {
11041
11031
  const { __scopeMenu: n, ...r } = e, o = us(n);
11042
11032
  return /* @__PURE__ */ l.jsx(va, { ...o, ...r, ref: t });
11043
11033
  }
11044
11034
  );
11045
- ya.displayName = j0;
11046
- var Sa = "MenuPortal", [A0, qd] = Pn(Sa, {
11035
+ ya.displayName = jS;
11036
+ var Sa = "MenuPortal", [AS, qd] = Pn(Sa, {
11047
11037
  forceMount: void 0
11048
11038
  }), Xd = (e) => {
11049
11039
  const { __scopeMenu: t, forceMount: n, children: r, container: o } = e, s = _n(Sa, t);
11050
- return /* @__PURE__ */ l.jsx(A0, { scope: t, forceMount: n, children: /* @__PURE__ */ l.jsx(xt, { present: n || s.open, children: /* @__PURE__ */ l.jsx(Zo, { asChild: !0, container: o, children: r }) }) });
11040
+ return /* @__PURE__ */ l.jsx(AS, { scope: t, forceMount: n, children: /* @__PURE__ */ l.jsx(xt, { present: n || s.open, children: /* @__PURE__ */ l.jsx(Zo, { asChild: !0, container: o, children: r }) }) });
11051
11041
  };
11052
11042
  Xd.displayName = Sa;
11053
- var It = "MenuContent", [k0, Ca] = Pn(It), Jd = f.forwardRef(
11043
+ var It = "MenuContent", [kS, Ca] = Pn(It), Jd = f.forwardRef(
11054
11044
  (e, t) => {
11055
11045
  const n = qd(It, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = _n(It, e.__scopeMenu), i = Ur(It, e.__scopeMenu);
11056
- return /* @__PURE__ */ l.jsx(Ir.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ l.jsx(xt, { present: r || s.open, children: /* @__PURE__ */ l.jsx(Ir.Slot, { scope: e.__scopeMenu, children: i.modal ? /* @__PURE__ */ l.jsx(P0, { ...o, ref: t }) : /* @__PURE__ */ l.jsx(_0, { ...o, ref: t }) }) }) });
11046
+ return /* @__PURE__ */ l.jsx(Ir.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ l.jsx(xt, { present: r || s.open, children: /* @__PURE__ */ l.jsx(Ir.Slot, { scope: e.__scopeMenu, children: i.modal ? /* @__PURE__ */ l.jsx(PS, { ...o, ref: t }) : /* @__PURE__ */ l.jsx(_S, { ...o, ref: t }) }) }) });
11057
11047
  }
11058
- ), P0 = f.forwardRef(
11048
+ ), PS = f.forwardRef(
11059
11049
  (e, t) => {
11060
11050
  const n = _n(It, e.__scopeMenu), r = f.useRef(null), o = Ce(t, r);
11061
11051
  return f.useEffect(() => {
@@ -11078,7 +11068,7 @@ var It = "MenuContent", [k0, Ca] = Pn(It), Jd = f.forwardRef(
11078
11068
  }
11079
11069
  );
11080
11070
  }
11081
- ), _0 = f.forwardRef((e, t) => {
11071
+ ), _S = f.forwardRef((e, t) => {
11082
11072
  const n = _n(It, e.__scopeMenu);
11083
11073
  return /* @__PURE__ */ l.jsx(
11084
11074
  Ta,
@@ -11091,7 +11081,7 @@ var It = "MenuContent", [k0, Ca] = Pn(It), Jd = f.forwardRef(
11091
11081
  onDismiss: () => n.onOpenChange(!1)
11092
11082
  }
11093
11083
  );
11094
- }), O0 = qn("MenuContent.ScrollLock"), Ta = f.forwardRef(
11084
+ }), OS = qn("MenuContent.ScrollLock"), Ta = f.forwardRef(
11095
11085
  (e, t) => {
11096
11086
  const {
11097
11087
  __scopeMenu: n,
@@ -11108,9 +11098,9 @@ var It = "MenuContent", [k0, Ca] = Pn(It), Jd = f.forwardRef(
11108
11098
  onDismiss: b,
11109
11099
  disableOutsideScroll: g,
11110
11100
  ...x
11111
- } = e, m = _n(It, n), v = Ur(It, n), w = us(n), y = Kd(n), E = R0(n), [S, T] = f.useState(null), C = f.useRef(null), I = Ce(t, C, m.onContentChange), N = f.useRef(0), j = f.useRef(""), M = f.useRef(0), W = f.useRef(null), G = f.useRef("right"), A = f.useRef(0), H = g ? es : f.Fragment, L = g ? { as: O0, allowPinchZoom: !0 } : void 0, q = (_) => {
11101
+ } = e, m = _n(It, n), v = Ur(It, n), w = us(n), y = Kd(n), E = RS(n), [S, T] = f.useState(null), C = f.useRef(null), I = Ce(t, C, m.onContentChange), N = f.useRef(0), j = f.useRef(""), M = f.useRef(0), W = f.useRef(null), G = f.useRef("right"), A = f.useRef(0), H = g ? es : f.Fragment, L = g ? { as: OS, allowPinchZoom: !0 } : void 0, q = (_) => {
11112
11102
  var Y, P;
11113
- const z = j.current + _, X = E().filter((Z) => !Z.disabled), oe = document.activeElement, F = (Y = X.find((Z) => Z.ref.current === oe)) == null ? void 0 : Y.textValue, ee = X.map((Z) => Z.textValue), he = G0(ee, z, F), be = (P = X.find((Z) => Z.textValue === he)) == null ? void 0 : P.ref.current;
11103
+ const z = j.current + _, X = E().filter((Z) => !Z.disabled), oe = document.activeElement, F = (Y = X.find((Z) => Z.ref.current === oe)) == null ? void 0 : Y.textValue, ee = X.map((Z) => Z.textValue), he = GS(ee, z, F), be = (P = X.find((Z) => Z.textValue === he)) == null ? void 0 : P.ref.current;
11114
11104
  (function Z(ne) {
11115
11105
  j.current = ne, window.clearTimeout(N.current), ne !== "" && (N.current = window.setTimeout(() => Z(""), 1e3));
11116
11106
  })(z), be && setTimeout(() => be.focus());
@@ -11118,10 +11108,10 @@ var It = "MenuContent", [k0, Ca] = Pn(It), Jd = f.forwardRef(
11118
11108
  f.useEffect(() => () => window.clearTimeout(N.current), []), ra();
11119
11109
  const O = f.useCallback((_) => {
11120
11110
  var X, oe;
11121
- return G.current === ((X = W.current) == null ? void 0 : X.side) && Y0(_, (oe = W.current) == null ? void 0 : oe.area);
11111
+ return G.current === ((X = W.current) == null ? void 0 : X.side) && YS(_, (oe = W.current) == null ? void 0 : oe.area);
11122
11112
  }, []);
11123
11113
  return /* @__PURE__ */ l.jsx(
11124
- k0,
11114
+ kS,
11125
11115
  {
11126
11116
  scope: n,
11127
11117
  searchRef: j,
@@ -11169,7 +11159,7 @@ var It = "MenuContent", [k0, Ca] = Pn(It), Jd = f.forwardRef(
11169
11159
  onInteractOutside: p,
11170
11160
  onDismiss: b,
11171
11161
  children: /* @__PURE__ */ l.jsx(
11172
- b0,
11162
+ bS,
11173
11163
  {
11174
11164
  asChild: !0,
11175
11165
  ...y,
@@ -11198,10 +11188,10 @@ var It = "MenuContent", [k0, Ca] = Pn(It), Jd = f.forwardRef(
11198
11188
  const X = _.target.closest("[data-radix-menu-content]") === _.currentTarget, oe = _.ctrlKey || _.altKey || _.metaKey, F = _.key.length === 1;
11199
11189
  X && (_.key === "Tab" && _.preventDefault(), !oe && F && q(_.key));
11200
11190
  const ee = C.current;
11201
- if (_.target !== ee || !S0.includes(_.key)) return;
11191
+ if (_.target !== ee || !SS.includes(_.key)) return;
11202
11192
  _.preventDefault();
11203
11193
  const be = E().filter((Y) => !Y.disabled).map((Y) => Y.ref.current);
11204
- Vd.includes(_.key) && be.reverse(), W0(be);
11194
+ Vd.includes(_.key) && be.reverse(), WS(be);
11205
11195
  }),
11206
11196
  onBlur: Q(e.onBlur, (_) => {
11207
11197
  _.currentTarget.contains(_.target) || (window.clearTimeout(N.current), j.current = "");
@@ -11229,20 +11219,20 @@ var It = "MenuContent", [k0, Ca] = Pn(It), Jd = f.forwardRef(
11229
11219
  }
11230
11220
  );
11231
11221
  Jd.displayName = It;
11232
- var M0 = "MenuGroup", Ra = f.forwardRef(
11222
+ var MS = "MenuGroup", Ra = f.forwardRef(
11233
11223
  (e, t) => {
11234
11224
  const { __scopeMenu: n, ...r } = e;
11235
11225
  return /* @__PURE__ */ l.jsx(me.div, { role: "group", ...r, ref: t });
11236
11226
  }
11237
11227
  );
11238
- Ra.displayName = M0;
11239
- var D0 = "MenuLabel", Zd = f.forwardRef(
11228
+ Ra.displayName = MS;
11229
+ var DS = "MenuLabel", Zd = f.forwardRef(
11240
11230
  (e, t) => {
11241
11231
  const { __scopeMenu: n, ...r } = e;
11242
11232
  return /* @__PURE__ */ l.jsx(me.div, { ...r, ref: t });
11243
11233
  }
11244
11234
  );
11245
- Zd.displayName = D0;
11235
+ Zd.displayName = DS;
11246
11236
  var _o = "MenuItem", dc = "menu.itemSelect", ds = f.forwardRef(
11247
11237
  (e, t) => {
11248
11238
  const { disabled: n = !1, onSelect: r, ...o } = e, s = f.useRef(null), i = Ur(_o, e.__scopeMenu), a = Ca(_o, e.__scopeMenu), c = Ce(t, s), u = f.useRef(!1), d = () => {
@@ -11288,7 +11278,7 @@ var Qd = f.forwardRef(
11288
11278
  scope: n,
11289
11279
  disabled: r,
11290
11280
  textValue: o ?? p,
11291
- children: /* @__PURE__ */ l.jsx(w0, { asChild: !0, ...a, focusable: !r, children: /* @__PURE__ */ l.jsx(
11281
+ children: /* @__PURE__ */ l.jsx(wS, { asChild: !0, ...a, focusable: !r, children: /* @__PURE__ */ l.jsx(
11292
11282
  me.div,
11293
11283
  {
11294
11284
  role: "menuitem",
@@ -11314,7 +11304,7 @@ var Qd = f.forwardRef(
11314
11304
  }
11315
11305
  );
11316
11306
  }
11317
- ), L0 = "MenuCheckboxItem", ef = f.forwardRef(
11307
+ ), LS = "MenuCheckboxItem", ef = f.forwardRef(
11318
11308
  (e, t) => {
11319
11309
  const { checked: n = !1, onCheckedChange: r, ...o } = e;
11320
11310
  return /* @__PURE__ */ l.jsx(sf, { scope: e.__scopeMenu, checked: n, children: /* @__PURE__ */ l.jsx(
@@ -11334,21 +11324,21 @@ var Qd = f.forwardRef(
11334
11324
  ) });
11335
11325
  }
11336
11326
  );
11337
- ef.displayName = L0;
11338
- var tf = "MenuRadioGroup", [F0, B0] = Pn(
11327
+ ef.displayName = LS;
11328
+ var tf = "MenuRadioGroup", [FS, BS] = Pn(
11339
11329
  tf,
11340
11330
  { value: void 0, onValueChange: () => {
11341
11331
  } }
11342
11332
  ), nf = f.forwardRef(
11343
11333
  (e, t) => {
11344
11334
  const { value: n, onValueChange: r, ...o } = e, s = ot(r);
11345
- return /* @__PURE__ */ l.jsx(F0, { scope: e.__scopeMenu, value: n, onValueChange: s, children: /* @__PURE__ */ l.jsx(Ra, { ...o, ref: t }) });
11335
+ return /* @__PURE__ */ l.jsx(FS, { scope: e.__scopeMenu, value: n, onValueChange: s, children: /* @__PURE__ */ l.jsx(Ra, { ...o, ref: t }) });
11346
11336
  }
11347
11337
  );
11348
11338
  nf.displayName = tf;
11349
11339
  var rf = "MenuRadioItem", of = f.forwardRef(
11350
11340
  (e, t) => {
11351
- const { value: n, ...r } = e, o = B0(rf, e.__scopeMenu), s = n === o.value;
11341
+ const { value: n, ...r } = e, o = BS(rf, e.__scopeMenu), s = n === o.value;
11352
11342
  return /* @__PURE__ */ l.jsx(sf, { scope: e.__scopeMenu, checked: s, children: /* @__PURE__ */ l.jsx(
11353
11343
  ds,
11354
11344
  {
@@ -11370,12 +11360,12 @@ var rf = "MenuRadioItem", of = f.forwardRef(
11370
11360
  }
11371
11361
  );
11372
11362
  of.displayName = rf;
11373
- var Ea = "MenuItemIndicator", [sf, H0] = Pn(
11363
+ var Ea = "MenuItemIndicator", [sf, HS] = Pn(
11374
11364
  Ea,
11375
11365
  { checked: !1 }
11376
11366
  ), af = f.forwardRef(
11377
11367
  (e, t) => {
11378
- const { __scopeMenu: n, forceMount: r, ...o } = e, s = H0(Ea, n);
11368
+ const { __scopeMenu: n, forceMount: r, ...o } = e, s = HS(Ea, n);
11379
11369
  return /* @__PURE__ */ l.jsx(
11380
11370
  xt,
11381
11371
  {
@@ -11393,7 +11383,7 @@ var Ea = "MenuItemIndicator", [sf, H0] = Pn(
11393
11383
  }
11394
11384
  );
11395
11385
  af.displayName = Ea;
11396
- var $0 = "MenuSeparator", lf = f.forwardRef(
11386
+ var $S = "MenuSeparator", lf = f.forwardRef(
11397
11387
  (e, t) => {
11398
11388
  const { __scopeMenu: n, ...r } = e;
11399
11389
  return /* @__PURE__ */ l.jsx(
@@ -11407,15 +11397,15 @@ var $0 = "MenuSeparator", lf = f.forwardRef(
11407
11397
  );
11408
11398
  }
11409
11399
  );
11410
- lf.displayName = $0;
11411
- var z0 = "MenuArrow", cf = f.forwardRef(
11400
+ lf.displayName = $S;
11401
+ var zS = "MenuArrow", cf = f.forwardRef(
11412
11402
  (e, t) => {
11413
11403
  const { __scopeMenu: n, ...r } = e, o = us(n);
11414
11404
  return /* @__PURE__ */ l.jsx(wa, { ...o, ...r, ref: t });
11415
11405
  }
11416
11406
  );
11417
- cf.displayName = z0;
11418
- var U0 = "MenuSub", [dR, uf] = Pn(U0), hr = "MenuSubTrigger", df = f.forwardRef(
11407
+ cf.displayName = zS;
11408
+ var US = "MenuSub", [dR, uf] = Pn(US), hr = "MenuSubTrigger", df = f.forwardRef(
11419
11409
  (e, t) => {
11420
11410
  const n = _n(hr, e.__scopeMenu), r = Ur(hr, e.__scopeMenu), o = uf(hr, e.__scopeMenu), s = Ca(hr, e.__scopeMenu), i = f.useRef(null), { pointerGraceTimerRef: a, onPointerGraceIntentChange: c } = s, u = { __scopeMenu: e.__scopeMenu }, d = f.useCallback(() => {
11421
11411
  i.current && window.clearTimeout(i.current), i.current = null;
@@ -11479,7 +11469,7 @@ var U0 = "MenuSub", [dR, uf] = Pn(U0), hr = "MenuSubTrigger", df = f.forwardRef(
11479
11469
  onKeyDown: Q(e.onKeyDown, (h) => {
11480
11470
  var b;
11481
11471
  const p = s.searchRef.current !== "";
11482
- e.disabled || p && h.key === " " || C0[r.dir].includes(h.key) && (n.onOpenChange(!0), (b = n.content) == null || b.focus(), h.preventDefault());
11472
+ e.disabled || p && h.key === " " || CS[r.dir].includes(h.key) && (n.onOpenChange(!0), (b = n.content) == null || b.focus(), h.preventDefault());
11483
11473
  })
11484
11474
  }
11485
11475
  ) });
@@ -11514,7 +11504,7 @@ var ff = "MenuSubContent", hf = f.forwardRef(
11514
11504
  }),
11515
11505
  onKeyDown: Q(e.onKeyDown, (d) => {
11516
11506
  var b;
11517
- const h = d.currentTarget.contains(d.target), p = T0[i.dir].includes(d.key);
11507
+ const h = d.currentTarget.contains(d.target), p = TS[i.dir].includes(d.key);
11518
11508
  h && p && (s.onOpenChange(!1), (b = a.trigger) == null || b.focus(), d.preventDefault());
11519
11509
  })
11520
11510
  }
@@ -11531,24 +11521,24 @@ function Oo(e) {
11531
11521
  function Ia(e) {
11532
11522
  return Oo(e) ? "indeterminate" : e ? "checked" : "unchecked";
11533
11523
  }
11534
- function W0(e) {
11524
+ function WS(e) {
11535
11525
  const t = document.activeElement;
11536
11526
  for (const n of e)
11537
11527
  if (n === t || (n.focus(), document.activeElement !== t)) return;
11538
11528
  }
11539
- function V0(e, t) {
11529
+ function VS(e, t) {
11540
11530
  return e.map((n, r) => e[(t + r) % e.length]);
11541
11531
  }
11542
- function G0(e, t, n) {
11532
+ function GS(e, t, n) {
11543
11533
  const o = t.length > 1 && Array.from(t).every((u) => u === t[0]) ? t[0] : t, s = n ? e.indexOf(n) : -1;
11544
- let i = V0(e, Math.max(s, 0));
11534
+ let i = VS(e, Math.max(s, 0));
11545
11535
  o.length === 1 && (i = i.filter((u) => u !== n));
11546
11536
  const c = i.find(
11547
11537
  (u) => u.toLowerCase().startsWith(o.toLowerCase())
11548
11538
  );
11549
11539
  return c !== n ? c : void 0;
11550
11540
  }
11551
- function K0(e, t) {
11541
+ function KS(e, t) {
11552
11542
  const { x: n, y: r } = e;
11553
11543
  let o = !1;
11554
11544
  for (let s = 0, i = t.length - 1; s < t.length; i = s++) {
@@ -11557,18 +11547,18 @@ function K0(e, t) {
11557
11547
  }
11558
11548
  return o;
11559
11549
  }
11560
- function Y0(e, t) {
11550
+ function YS(e, t) {
11561
11551
  if (!t) return !1;
11562
11552
  const n = { x: e.clientX, y: e.clientY };
11563
- return K0(n, t);
11553
+ return KS(n, t);
11564
11554
  }
11565
11555
  function Nr(e) {
11566
11556
  return (t) => t.pointerType === "mouse" ? e(t) : void 0;
11567
11557
  }
11568
- var q0 = Yd, X0 = ya, J0 = Xd, Z0 = Jd, Q0 = Ra, eS = Zd, tS = ds, nS = ef, rS = nf, oS = of, sS = af, iS = lf, aS = cf, lS = df, cS = hf, fs = "DropdownMenu", [uS, fR] = $t(
11558
+ var qS = Yd, XS = ya, JS = Xd, ZS = Jd, QS = Ra, e0 = Zd, t0 = ds, n0 = ef, r0 = nf, o0 = of, s0 = af, i0 = lf, a0 = cf, l0 = df, c0 = hf, fs = "DropdownMenu", [u0, fR] = $t(
11569
11559
  fs,
11570
11560
  [Gd]
11571
- ), ht = Gd(), [dS, mf] = uS(fs), gf = (e) => {
11561
+ ), ht = Gd(), [d0, mf] = u0(fs), gf = (e) => {
11572
11562
  const {
11573
11563
  __scopeDropdownMenu: t,
11574
11564
  children: n,
@@ -11584,7 +11574,7 @@ var q0 = Yd, X0 = ya, J0 = Xd, Z0 = Jd, Q0 = Ra, eS = Zd, tS = ds, nS = ef, rS =
11584
11574
  caller: fs
11585
11575
  });
11586
11576
  return /* @__PURE__ */ l.jsx(
11587
- dS,
11577
+ d0,
11588
11578
  {
11589
11579
  scope: t,
11590
11580
  triggerId: Dt(),
@@ -11594,7 +11584,7 @@ var q0 = Yd, X0 = ya, J0 = Xd, Z0 = Jd, Q0 = Ra, eS = Zd, tS = ds, nS = ef, rS =
11594
11584
  onOpenChange: h,
11595
11585
  onOpenToggle: f.useCallback(() => h((p) => !p), [h]),
11596
11586
  modal: a,
11597
- children: /* @__PURE__ */ l.jsx(q0, { ...c, open: d, onOpenChange: h, dir: r, modal: a, children: n })
11587
+ children: /* @__PURE__ */ l.jsx(qS, { ...c, open: d, onOpenChange: h, dir: r, modal: a, children: n })
11598
11588
  }
11599
11589
  );
11600
11590
  };
@@ -11602,7 +11592,7 @@ gf.displayName = fs;
11602
11592
  var xf = "DropdownMenuTrigger", vf = f.forwardRef(
11603
11593
  (e, t) => {
11604
11594
  const { __scopeDropdownMenu: n, disabled: r = !1, ...o } = e, s = mf(xf, n), i = ht(n);
11605
- return /* @__PURE__ */ l.jsx(X0, { asChild: !0, ...i, children: /* @__PURE__ */ l.jsx(
11595
+ return /* @__PURE__ */ l.jsx(XS, { asChild: !0, ...i, children: /* @__PURE__ */ l.jsx(
11606
11596
  me.button,
11607
11597
  {
11608
11598
  type: "button",
@@ -11626,16 +11616,16 @@ var xf = "DropdownMenuTrigger", vf = f.forwardRef(
11626
11616
  }
11627
11617
  );
11628
11618
  vf.displayName = xf;
11629
- var fS = "DropdownMenuPortal", bf = (e) => {
11619
+ var f0 = "DropdownMenuPortal", bf = (e) => {
11630
11620
  const { __scopeDropdownMenu: t, ...n } = e, r = ht(t);
11631
- return /* @__PURE__ */ l.jsx(J0, { ...r, ...n });
11621
+ return /* @__PURE__ */ l.jsx(JS, { ...r, ...n });
11632
11622
  };
11633
- bf.displayName = fS;
11623
+ bf.displayName = f0;
11634
11624
  var wf = "DropdownMenuContent", yf = f.forwardRef(
11635
11625
  (e, t) => {
11636
11626
  const { __scopeDropdownMenu: n, ...r } = e, o = mf(wf, n), s = ht(n), i = f.useRef(!1);
11637
11627
  return /* @__PURE__ */ l.jsx(
11638
- Z0,
11628
+ ZS,
11639
11629
  {
11640
11630
  id: o.contentId,
11641
11631
  "aria-labelledby": o.triggerId,
@@ -11663,68 +11653,68 @@ var wf = "DropdownMenuContent", yf = f.forwardRef(
11663
11653
  }
11664
11654
  );
11665
11655
  yf.displayName = wf;
11666
- var hS = "DropdownMenuGroup", pS = f.forwardRef(
11656
+ var h0 = "DropdownMenuGroup", p0 = f.forwardRef(
11667
11657
  (e, t) => {
11668
11658
  const { __scopeDropdownMenu: n, ...r } = e, o = ht(n);
11669
- return /* @__PURE__ */ l.jsx(Q0, { ...o, ...r, ref: t });
11659
+ return /* @__PURE__ */ l.jsx(QS, { ...o, ...r, ref: t });
11670
11660
  }
11671
11661
  );
11672
- pS.displayName = hS;
11673
- var mS = "DropdownMenuLabel", Sf = f.forwardRef(
11662
+ p0.displayName = h0;
11663
+ var m0 = "DropdownMenuLabel", Sf = f.forwardRef(
11674
11664
  (e, t) => {
11675
11665
  const { __scopeDropdownMenu: n, ...r } = e, o = ht(n);
11676
- return /* @__PURE__ */ l.jsx(eS, { ...o, ...r, ref: t });
11666
+ return /* @__PURE__ */ l.jsx(e0, { ...o, ...r, ref: t });
11677
11667
  }
11678
11668
  );
11679
- Sf.displayName = mS;
11680
- var gS = "DropdownMenuItem", Cf = f.forwardRef(
11669
+ Sf.displayName = m0;
11670
+ var g0 = "DropdownMenuItem", Cf = f.forwardRef(
11681
11671
  (e, t) => {
11682
11672
  const { __scopeDropdownMenu: n, ...r } = e, o = ht(n);
11683
- return /* @__PURE__ */ l.jsx(tS, { ...o, ...r, ref: t });
11673
+ return /* @__PURE__ */ l.jsx(t0, { ...o, ...r, ref: t });
11684
11674
  }
11685
11675
  );
11686
- Cf.displayName = gS;
11687
- var xS = "DropdownMenuCheckboxItem", Tf = f.forwardRef((e, t) => {
11676
+ Cf.displayName = g0;
11677
+ var x0 = "DropdownMenuCheckboxItem", Tf = f.forwardRef((e, t) => {
11688
11678
  const { __scopeDropdownMenu: n, ...r } = e, o = ht(n);
11689
- return /* @__PURE__ */ l.jsx(nS, { ...o, ...r, ref: t });
11679
+ return /* @__PURE__ */ l.jsx(n0, { ...o, ...r, ref: t });
11690
11680
  });
11691
- Tf.displayName = xS;
11692
- var vS = "DropdownMenuRadioGroup", bS = f.forwardRef((e, t) => {
11681
+ Tf.displayName = x0;
11682
+ var v0 = "DropdownMenuRadioGroup", b0 = f.forwardRef((e, t) => {
11693
11683
  const { __scopeDropdownMenu: n, ...r } = e, o = ht(n);
11694
- return /* @__PURE__ */ l.jsx(rS, { ...o, ...r, ref: t });
11684
+ return /* @__PURE__ */ l.jsx(r0, { ...o, ...r, ref: t });
11695
11685
  });
11696
- bS.displayName = vS;
11697
- var wS = "DropdownMenuRadioItem", Rf = f.forwardRef((e, t) => {
11686
+ b0.displayName = v0;
11687
+ var w0 = "DropdownMenuRadioItem", Rf = f.forwardRef((e, t) => {
11698
11688
  const { __scopeDropdownMenu: n, ...r } = e, o = ht(n);
11699
- return /* @__PURE__ */ l.jsx(oS, { ...o, ...r, ref: t });
11689
+ return /* @__PURE__ */ l.jsx(o0, { ...o, ...r, ref: t });
11700
11690
  });
11701
- Rf.displayName = wS;
11702
- var yS = "DropdownMenuItemIndicator", Ef = f.forwardRef((e, t) => {
11691
+ Rf.displayName = w0;
11692
+ var y0 = "DropdownMenuItemIndicator", Ef = f.forwardRef((e, t) => {
11703
11693
  const { __scopeDropdownMenu: n, ...r } = e, o = ht(n);
11704
- return /* @__PURE__ */ l.jsx(sS, { ...o, ...r, ref: t });
11694
+ return /* @__PURE__ */ l.jsx(s0, { ...o, ...r, ref: t });
11705
11695
  });
11706
- Ef.displayName = yS;
11707
- var SS = "DropdownMenuSeparator", If = f.forwardRef((e, t) => {
11696
+ Ef.displayName = y0;
11697
+ var S0 = "DropdownMenuSeparator", If = f.forwardRef((e, t) => {
11708
11698
  const { __scopeDropdownMenu: n, ...r } = e, o = ht(n);
11709
- return /* @__PURE__ */ l.jsx(iS, { ...o, ...r, ref: t });
11699
+ return /* @__PURE__ */ l.jsx(i0, { ...o, ...r, ref: t });
11710
11700
  });
11711
- If.displayName = SS;
11712
- var CS = "DropdownMenuArrow", TS = f.forwardRef(
11701
+ If.displayName = S0;
11702
+ var C0 = "DropdownMenuArrow", T0 = f.forwardRef(
11713
11703
  (e, t) => {
11714
11704
  const { __scopeDropdownMenu: n, ...r } = e, o = ht(n);
11715
- return /* @__PURE__ */ l.jsx(aS, { ...o, ...r, ref: t });
11705
+ return /* @__PURE__ */ l.jsx(a0, { ...o, ...r, ref: t });
11716
11706
  }
11717
11707
  );
11718
- TS.displayName = CS;
11719
- var RS = "DropdownMenuSubTrigger", Nf = f.forwardRef((e, t) => {
11708
+ T0.displayName = C0;
11709
+ var R0 = "DropdownMenuSubTrigger", Nf = f.forwardRef((e, t) => {
11720
11710
  const { __scopeDropdownMenu: n, ...r } = e, o = ht(n);
11721
- return /* @__PURE__ */ l.jsx(lS, { ...o, ...r, ref: t });
11711
+ return /* @__PURE__ */ l.jsx(l0, { ...o, ...r, ref: t });
11722
11712
  });
11723
- Nf.displayName = RS;
11724
- var ES = "DropdownMenuSubContent", jf = f.forwardRef((e, t) => {
11713
+ Nf.displayName = R0;
11714
+ var E0 = "DropdownMenuSubContent", jf = f.forwardRef((e, t) => {
11725
11715
  const { __scopeDropdownMenu: n, ...r } = e, o = ht(n);
11726
11716
  return /* @__PURE__ */ l.jsx(
11727
- cS,
11717
+ c0,
11728
11718
  {
11729
11719
  ...o,
11730
11720
  ...r,
@@ -11740,9 +11730,9 @@ var ES = "DropdownMenuSubContent", jf = f.forwardRef((e, t) => {
11740
11730
  }
11741
11731
  );
11742
11732
  });
11743
- jf.displayName = ES;
11744
- var IS = gf, NS = vf, jS = bf, Af = yf, kf = Sf, Pf = Cf, _f = Tf, Of = Rf, Mf = Ef, Df = If, Lf = Nf, Ff = jf;
11745
- const AS = IS, kS = NS, PS = f.forwardRef(({ className: e, inset: t, children: n, ...r }, o) => /* @__PURE__ */ l.jsxs(
11733
+ jf.displayName = E0;
11734
+ var I0 = gf, N0 = vf, j0 = bf, Af = yf, kf = Sf, Pf = Cf, _f = Tf, Of = Rf, Mf = Ef, Df = If, Lf = Nf, Ff = jf;
11735
+ const A0 = I0, k0 = N0, P0 = f.forwardRef(({ className: e, inset: t, children: n, ...r }, o) => /* @__PURE__ */ l.jsxs(
11746
11736
  Lf,
11747
11737
  {
11748
11738
  ref: o,
@@ -11758,8 +11748,8 @@ const AS = IS, kS = NS, PS = f.forwardRef(({ className: e, inset: t, children: n
11758
11748
  ]
11759
11749
  }
11760
11750
  ));
11761
- PS.displayName = Lf.displayName;
11762
- const _S = f.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
11751
+ P0.displayName = Lf.displayName;
11752
+ const _0 = f.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
11763
11753
  Ff,
11764
11754
  {
11765
11755
  ref: n,
@@ -11770,8 +11760,8 @@ const _S = f.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
11770
11760
  ...t
11771
11761
  }
11772
11762
  ));
11773
- _S.displayName = Ff.displayName;
11774
- const Bf = f.forwardRef(({ className: e, sideOffset: t = 4, ...n }, r) => /* @__PURE__ */ l.jsx(jS, { children: /* @__PURE__ */ l.jsx(
11763
+ _0.displayName = Ff.displayName;
11764
+ const Bf = f.forwardRef(({ className: e, sideOffset: t = 4, ...n }, r) => /* @__PURE__ */ l.jsx(j0, { children: /* @__PURE__ */ l.jsx(
11775
11765
  Af,
11776
11766
  {
11777
11767
  ref: r,
@@ -11797,7 +11787,7 @@ const Si = f.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */
11797
11787
  }
11798
11788
  ));
11799
11789
  Si.displayName = Pf.displayName;
11800
- const OS = f.forwardRef(({ className: e, children: t, checked: n, ...r }, o) => /* @__PURE__ */ l.jsxs(
11790
+ const O0 = f.forwardRef(({ className: e, children: t, checked: n, ...r }, o) => /* @__PURE__ */ l.jsxs(
11801
11791
  _f,
11802
11792
  {
11803
11793
  ref: o,
@@ -11813,8 +11803,8 @@ const OS = f.forwardRef(({ className: e, children: t, checked: n, ...r }, o) =>
11813
11803
  ]
11814
11804
  }
11815
11805
  ));
11816
- OS.displayName = _f.displayName;
11817
- const MS = f.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ l.jsxs(
11806
+ O0.displayName = _f.displayName;
11807
+ const M0 = f.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ l.jsxs(
11818
11808
  Of,
11819
11809
  {
11820
11810
  ref: r,
@@ -11829,8 +11819,8 @@ const MS = f.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
11829
11819
  ]
11830
11820
  }
11831
11821
  ));
11832
- MS.displayName = Of.displayName;
11833
- const DS = f.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */ l.jsx(
11822
+ M0.displayName = Of.displayName;
11823
+ const D0 = f.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */ l.jsx(
11834
11824
  kf,
11835
11825
  {
11836
11826
  ref: r,
@@ -11842,8 +11832,8 @@ const DS = f.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */
11842
11832
  ...n
11843
11833
  }
11844
11834
  ));
11845
- DS.displayName = kf.displayName;
11846
- const LS = f.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
11835
+ D0.displayName = kf.displayName;
11836
+ const L0 = f.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
11847
11837
  Df,
11848
11838
  {
11849
11839
  ref: n,
@@ -11851,7 +11841,7 @@ const LS = f.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
11851
11841
  ...t
11852
11842
  }
11853
11843
  ));
11854
- LS.displayName = Df.displayName;
11844
+ L0.displayName = Df.displayName;
11855
11845
  function go({
11856
11846
  className: e = "",
11857
11847
  placeholder: t = "Type your message...",
@@ -12138,8 +12128,8 @@ function go({
12138
12128
  ] }),
12139
12129
  H && /* @__PURE__ */ l.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: H }),
12140
12130
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-end gap-2", children: [
12141
- (s || i) && /* @__PURE__ */ l.jsxs(AS, { children: [
12142
- /* @__PURE__ */ l.jsx(kS, { asChild: !0, children: /* @__PURE__ */ l.jsx(
12131
+ (s || i) && /* @__PURE__ */ l.jsxs(A0, { children: [
12132
+ /* @__PURE__ */ l.jsx(k0, { asChild: !0, children: /* @__PURE__ */ l.jsx(
12143
12133
  Ne,
12144
12134
  {
12145
12135
  type: "button",
@@ -12213,10 +12203,10 @@ jr.displayName = "Input";
12213
12203
  function Ci(e, [t, n]) {
12214
12204
  return Math.min(n, Math.max(t, e));
12215
12205
  }
12216
- function FS(e, t) {
12206
+ function F0(e, t) {
12217
12207
  return f.useReducer((n, r) => t[n][r] ?? n, e);
12218
12208
  }
12219
- var Na = "ScrollArea", [Hf, hR] = $t(Na), [BS, jt] = Hf(Na), $f = f.forwardRef(
12209
+ var Na = "ScrollArea", [Hf, hR] = $t(Na), [B0, jt] = Hf(Na), $f = f.forwardRef(
12220
12210
  (e, t) => {
12221
12211
  const {
12222
12212
  __scopeScrollArea: n,
@@ -12226,7 +12216,7 @@ var Na = "ScrollArea", [Hf, hR] = $t(Na), [BS, jt] = Hf(Na), $f = f.forwardRef(
12226
12216
  ...i
12227
12217
  } = e, [a, c] = f.useState(null), [u, d] = f.useState(null), [h, p] = f.useState(null), [b, g] = f.useState(null), [x, m] = f.useState(null), [v, w] = f.useState(0), [y, E] = f.useState(0), [S, T] = f.useState(!1), [C, I] = f.useState(!1), N = Ce(t, (M) => c(M)), j = ss(o);
12228
12218
  return /* @__PURE__ */ l.jsx(
12229
- BS,
12219
+ B0,
12230
12220
  {
12231
12221
  scope: n,
12232
12222
  type: r,
@@ -12314,11 +12304,11 @@ var Zt = "ScrollAreaScrollbar", ja = f.forwardRef(
12314
12304
  const { forceMount: n, ...r } = e, o = jt(Zt, e.__scopeScrollArea), { onScrollbarXEnabledChange: s, onScrollbarYEnabledChange: i } = o, a = e.orientation === "horizontal";
12315
12305
  return f.useEffect(() => (a ? s(!0) : i(!0), () => {
12316
12306
  a ? s(!1) : i(!1);
12317
- }), [a, s, i]), o.type === "hover" ? /* @__PURE__ */ l.jsx(HS, { ...r, ref: t, forceMount: n }) : o.type === "scroll" ? /* @__PURE__ */ l.jsx($S, { ...r, ref: t, forceMount: n }) : o.type === "auto" ? /* @__PURE__ */ l.jsx(Wf, { ...r, ref: t, forceMount: n }) : o.type === "always" ? /* @__PURE__ */ l.jsx(Aa, { ...r, ref: t }) : null;
12307
+ }), [a, s, i]), o.type === "hover" ? /* @__PURE__ */ l.jsx(H0, { ...r, ref: t, forceMount: n }) : o.type === "scroll" ? /* @__PURE__ */ l.jsx($0, { ...r, ref: t, forceMount: n }) : o.type === "auto" ? /* @__PURE__ */ l.jsx(Wf, { ...r, ref: t, forceMount: n }) : o.type === "always" ? /* @__PURE__ */ l.jsx(Aa, { ...r, ref: t }) : null;
12318
12308
  }
12319
12309
  );
12320
12310
  ja.displayName = Zt;
12321
- var HS = f.forwardRef((e, t) => {
12311
+ var H0 = f.forwardRef((e, t) => {
12322
12312
  const { forceMount: n, ...r } = e, o = jt(Zt, e.__scopeScrollArea), [s, i] = f.useState(!1);
12323
12313
  return f.useEffect(() => {
12324
12314
  const a = o.scrollArea;
@@ -12341,8 +12331,8 @@ var HS = f.forwardRef((e, t) => {
12341
12331
  ref: t
12342
12332
  }
12343
12333
  ) });
12344
- }), $S = f.forwardRef((e, t) => {
12345
- const { forceMount: n, ...r } = e, o = jt(Zt, e.__scopeScrollArea), s = e.orientation === "horizontal", i = ps(() => c("SCROLL_END"), 100), [a, c] = FS("hidden", {
12334
+ }), $0 = f.forwardRef((e, t) => {
12335
+ const { forceMount: n, ...r } = e, o = jt(Zt, e.__scopeScrollArea), s = e.orientation === "horizontal", i = ps(() => c("SCROLL_END"), 100), [a, c] = F0("hidden", {
12346
12336
  hidden: {
12347
12337
  SCROLL: "scrolling"
12348
12338
  },
@@ -12415,10 +12405,10 @@ var HS = f.forwardRef((e, t) => {
12415
12405
  onThumbPointerDown: (p) => i.current = p
12416
12406
  };
12417
12407
  function h(p, b) {
12418
- return KS(p, i.current, a, b);
12408
+ return K0(p, i.current, a, b);
12419
12409
  }
12420
12410
  return n === "horizontal" ? /* @__PURE__ */ l.jsx(
12421
- zS,
12411
+ z0,
12422
12412
  {
12423
12413
  ...d,
12424
12414
  ref: t,
@@ -12436,7 +12426,7 @@ var HS = f.forwardRef((e, t) => {
12436
12426
  }
12437
12427
  }
12438
12428
  ) : n === "vertical" ? /* @__PURE__ */ l.jsx(
12439
- US,
12429
+ U0,
12440
12430
  {
12441
12431
  ...d,
12442
12432
  ref: t,
@@ -12454,7 +12444,7 @@ var HS = f.forwardRef((e, t) => {
12454
12444
  }
12455
12445
  }
12456
12446
  ) : null;
12457
- }), zS = f.forwardRef((e, t) => {
12447
+ }), z0 = f.forwardRef((e, t) => {
12458
12448
  const { sizes: n, onSizesChange: r, ...o } = e, s = jt(Zt, e.__scopeScrollArea), [i, a] = f.useState(), c = f.useRef(null), u = Ce(t, c, s.onScrollbarXChange);
12459
12449
  return f.useEffect(() => {
12460
12450
  c.current && a(getComputedStyle(c.current));
@@ -12493,7 +12483,7 @@ var HS = f.forwardRef((e, t) => {
12493
12483
  }
12494
12484
  }
12495
12485
  );
12496
- }), US = f.forwardRef((e, t) => {
12486
+ }), U0 = f.forwardRef((e, t) => {
12497
12487
  const { sizes: n, onSizesChange: r, ...o } = e, s = jt(Zt, e.__scopeScrollArea), [i, a] = f.useState(), c = f.useRef(null), u = Ce(t, c, s.onScrollbarYChange);
12498
12488
  return f.useEffect(() => {
12499
12489
  c.current && a(getComputedStyle(c.current));
@@ -12533,7 +12523,7 @@ var HS = f.forwardRef((e, t) => {
12533
12523
  }
12534
12524
  }
12535
12525
  );
12536
- }), [WS, Vf] = Hf(Zt), Gf = f.forwardRef((e, t) => {
12526
+ }), [W0, Vf] = Hf(Zt), Gf = f.forwardRef((e, t) => {
12537
12527
  const {
12538
12528
  __scopeScrollArea: n,
12539
12529
  sizes: r,
@@ -12560,7 +12550,7 @@ var HS = f.forwardRef((e, t) => {
12560
12550
  };
12561
12551
  return document.addEventListener("wheel", N, { passive: !1 }), () => document.removeEventListener("wheel", N, { passive: !1 });
12562
12552
  }, [y, g, E, S]), f.useEffect(T, [r, T]), Zn(g, C), Zn(b.content, C), /* @__PURE__ */ l.jsx(
12563
- WS,
12553
+ W0,
12564
12554
  {
12565
12555
  scope: n,
12566
12556
  scrollbar: g,
@@ -12590,9 +12580,9 @@ var HS = f.forwardRef((e, t) => {
12590
12580
  }), Mo = "ScrollAreaThumb", Kf = f.forwardRef(
12591
12581
  (e, t) => {
12592
12582
  const { forceMount: n, ...r } = e, o = Vf(Mo, e.__scopeScrollArea);
12593
- return /* @__PURE__ */ l.jsx(xt, { present: n || o.hasThumb, children: /* @__PURE__ */ l.jsx(VS, { ref: t, ...r }) });
12583
+ return /* @__PURE__ */ l.jsx(xt, { present: n || o.hasThumb, children: /* @__PURE__ */ l.jsx(V0, { ref: t, ...r }) });
12594
12584
  }
12595
- ), VS = f.forwardRef(
12585
+ ), V0 = f.forwardRef(
12596
12586
  (e, t) => {
12597
12587
  const { __scopeScrollArea: n, style: r, ...o } = e, s = jt(Mo, n), i = Vf(Mo, n), { onThumbPositionChange: a } = i, c = Ce(
12598
12588
  t,
@@ -12605,7 +12595,7 @@ var HS = f.forwardRef((e, t) => {
12605
12595
  if (h) {
12606
12596
  const p = () => {
12607
12597
  if (d(), !u.current) {
12608
- const b = YS(h, a);
12598
+ const b = Y0(h, a);
12609
12599
  u.current = b, a();
12610
12600
  }
12611
12601
  };
@@ -12635,11 +12625,11 @@ Kf.displayName = Mo;
12635
12625
  var ka = "ScrollAreaCorner", Yf = f.forwardRef(
12636
12626
  (e, t) => {
12637
12627
  const n = jt(ka, e.__scopeScrollArea), r = !!(n.scrollbarX && n.scrollbarY);
12638
- return n.type !== "scroll" && r ? /* @__PURE__ */ l.jsx(GS, { ...e, ref: t }) : null;
12628
+ return n.type !== "scroll" && r ? /* @__PURE__ */ l.jsx(G0, { ...e, ref: t }) : null;
12639
12629
  }
12640
12630
  );
12641
12631
  Yf.displayName = ka;
12642
- var GS = f.forwardRef((e, t) => {
12632
+ var G0 = f.forwardRef((e, t) => {
12643
12633
  const { __scopeScrollArea: n, ...r } = e, o = jt(ka, n), [s, i] = f.useState(0), [a, c] = f.useState(0), u = !!(s && a);
12644
12634
  return Zn(o.scrollbarX, () => {
12645
12635
  var h;
@@ -12677,7 +12667,7 @@ function hs(e) {
12677
12667
  const t = qf(e.viewport, e.content), n = e.scrollbar.paddingStart + e.scrollbar.paddingEnd, r = (e.scrollbar.size - n) * t;
12678
12668
  return Math.max(r, 18);
12679
12669
  }
12680
- function KS(e, t, n, r = "ltr") {
12670
+ function K0(e, t, n, r = "ltr") {
12681
12671
  const o = hs(n), s = o / 2, i = t || s, a = o - i, c = n.scrollbar.paddingStart + i, u = n.scrollbar.size - n.scrollbar.paddingEnd - a, d = n.content - n.viewport, h = r === "ltr" ? [0, d] : [d * -1, 0];
12682
12672
  return Xf([c, u], h)(e);
12683
12673
  }
@@ -12695,7 +12685,7 @@ function Xf(e, t) {
12695
12685
  function Jf(e, t) {
12696
12686
  return e > 0 && e < t;
12697
12687
  }
12698
- var YS = (e, t = () => {
12688
+ var Y0 = (e, t = () => {
12699
12689
  }) => {
12700
12690
  let n = { left: e.scrollLeft, top: e.scrollTop }, r = 0;
12701
12691
  return function o() {
@@ -12723,7 +12713,7 @@ function Zn(e, t) {
12723
12713
  }
12724
12714
  }, [e, n]);
12725
12715
  }
12726
- var Zf = $f, qS = Uf, XS = Yf;
12716
+ var Zf = $f, q0 = Uf, X0 = Yf;
12727
12717
  const Qf = f.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ l.jsxs(
12728
12718
  Zf,
12729
12719
  {
@@ -12731,9 +12721,9 @@ const Qf = f.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
12731
12721
  className: D("relative overflow-hidden", e),
12732
12722
  ...n,
12733
12723
  children: [
12734
- /* @__PURE__ */ l.jsx(qS, { className: "h-full w-full rounded-[inherit] overflow-auto", children: t }),
12724
+ /* @__PURE__ */ l.jsx(q0, { className: "h-full w-full rounded-[inherit] overflow-auto", children: t }),
12735
12725
  /* @__PURE__ */ l.jsx(eh, {}),
12736
- /* @__PURE__ */ l.jsx(XS, {})
12726
+ /* @__PURE__ */ l.jsx(X0, {})
12737
12727
  ]
12738
12728
  }
12739
12729
  ));
@@ -12908,7 +12898,7 @@ function Yn(e) {
12908
12898
  if (!(typeof globalThis > "u"))
12909
12899
  return globalThis[e];
12910
12900
  }
12911
- function JS(e) {
12901
+ function J0(e) {
12912
12902
  if (typeof e != "string") return;
12913
12903
  const t = e.trim();
12914
12904
  if (t)
@@ -12921,7 +12911,7 @@ function nh() {
12921
12911
  Yn("__CHAT_API_URL__")
12922
12912
  ];
12923
12913
  for (const t of e) {
12924
- const n = JS(t);
12914
+ const n = J0(t);
12925
12915
  if (n) return n;
12926
12916
  }
12927
12917
  }
@@ -12935,12 +12925,12 @@ function rh() {
12935
12925
  if (typeof t == "string" && t.trim())
12936
12926
  return t.trim();
12937
12927
  }
12938
- function ZS() {
12928
+ function Z0() {
12939
12929
  const e = {}, t = nh(), n = rh();
12940
12930
  return t && (e.baseUrl = t), n && (e.apiKey = n), e;
12941
12931
  }
12942
- function QS() {
12943
- const e = ZS(), t = Tn.getAuthToken(), n = nh();
12932
+ function Q0() {
12933
+ const e = Z0(), t = Tn.getAuthToken(), n = nh();
12944
12934
  return {
12945
12935
  apiBaseUrl: e.baseUrl || Tn.baseUrl || n || "http://localhost:8000",
12946
12936
  apiKey: t || e.apiKey || rh() || "",
@@ -12974,7 +12964,7 @@ function tC(e) {
12974
12964
  }
12975
12965
  }
12976
12966
  function gR() {
12977
- const e = QS(), t = eC(), n = Tn.getAuthToken();
12967
+ const e = Q0(), t = eC(), n = Tn.getAuthToken();
12978
12968
  return {
12979
12969
  ...e,
12980
12970
  ...t,
@@ -15527,8 +15517,8 @@ export {
15527
15517
  _t as get,
15528
15518
  $g as getChatToken,
15529
15519
  gR as getCurrentSettings,
15530
- ZS as getDefaultApiConfig,
15531
- QS as getDefaultChatSettings,
15520
+ Z0 as getDefaultApiConfig,
15521
+ Q0 as getDefaultChatSettings,
15532
15522
  zg as onChatTokenChanged,
15533
15523
  Ug as post,
15534
15524
  Wg as put,
package/dist/index.umd.js CHANGED
@@ -75,7 +75,7 @@ Check the top-level render call using <`+ue+">.")}return J}}function Hu(A,J){{if
75
75
  If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
76
76
 
77
77
  For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},Jy="DialogDescriptionWarning",eI=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Vm(Jy).contentName}}.`;return b.useEffect(()=>{var i;const a=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&a&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},zm=xm,tI=wm,$m=Lm,Xa=Pm,Za=km,Gn=Fm,Ja=Gm,Wm=Hm;const nI=zm,rI=$m,Km=b.forwardRef(({className:t,...e},n)=>u.jsx(Xa,{ref:n,className:$("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));Km.displayName=Xa.displayName;const Qm=b.forwardRef(({className:t,children:e,...n},r)=>{const a=b.useMemo(()=>{let i=!1;function o(s){b.Children.forEach(s,l=>{if(i||!b.isValidElement(l))return;const c=l.type;if(c===Gn||(c==null?void 0:c.displayName)===Gn.displayName||(c==null?void 0:c.name)==="DialogTitle"){i=!0;return}l.props&&l.props.children&&o(l.props.children)})}return o(e),i},[e]);return u.jsxs(rI,{children:[u.jsx(Km,{}),u.jsxs(Za,{ref:r,className:$("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[!a&&u.jsx(Gn,{className:"sr-only",children:"Dialog"}),e,u.jsxs(Wm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[u.jsx(pe.X,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});Qm.displayName=Za.displayName;const jm=({className:t,...e})=>u.jsx("div",{className:$("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});jm.displayName="DialogHeader";const Xm=b.forwardRef(({className:t,...e},n)=>u.jsx(Gn,{ref:n,className:$("text-lg font-semibold leading-none tracking-tight",t),...e}));Xm.displayName=Gn.displayName;const aI=b.forwardRef(({className:t,...e},n)=>u.jsx(Ja,{ref:n,className:$("text-sm text-muted-foreground",t),...e}));aI.displayName=Ja.displayName;function iI({isOpen:t,onClose:e,fileId:n,fileName:r,mimeType:a}){const[i,o]=y.useState(!1),[s,l]=y.useState(null),[c,d]=y.useState(null),{toast:_}=Wo();y.useEffect(()=>{t&&n&&p()},[t,n]);const p=async()=>{if(n){o(!0),d(null),l(null);try{const S=await am(n);l(S)}catch(S){console.error("Failed to load file:",S),d(S instanceof Error?S.message:"Failed to load file")}finally{o(!1)}}},m=async()=>{if(n)try{await BO(n),_({title:"Download started",description:`Downloading ${r}`})}catch(S){console.error("Failed to download file:",S),_({title:"Download failed",description:String(S),variant:"destructive"})}},g=async()=>{if(n)try{const S=await am(n),T=new Blob([S],{type:a}),h=URL.createObjectURL(T);window.open(h,"_blank"),URL.revokeObjectURL(h)}catch(S){console.error("Failed to open file externally:",S),_({title:"Failed to open file",description:String(S),variant:"destructive"})}},f=()=>i?u.jsxs("div",{className:"flex items-center justify-center py-12",children:[u.jsx(pe.Loader,{className:"h-8 w-8 animate-spin mr-3"}),u.jsx("span",{children:"Loading file..."})]}):c?u.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[u.jsx("div",{className:"text-red-500 mb-4",children:"⚠️"}),u.jsx("p",{className:"text-red-600 mb-4",children:c}),u.jsx(Ve,{onClick:p,variant:"outline",children:"Try Again"})]}):s?a.startsWith("image/")?u.jsx("div",{className:"flex justify-center",children:u.jsx("img",{src:`data:${a};base64,${s}`,alt:r,className:"max-w-full max-h-[70vh] object-contain rounded-lg"})}):a==="application/pdf"?u.jsx("div",{className:"w-full h-[70vh] border rounded-lg overflow-hidden",children:u.jsx("iframe",{src:`data:application/pdf;base64,${s}`,className:"w-full h-full",title:r})}):a.startsWith("text/")||a.includes("json")||a.includes("xml")?u.jsx("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4 max-h-[70vh] overflow-auto",children:u.jsx("pre",{className:"whitespace-pre-wrap font-mono text-sm",children:s})}):u.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[u.jsx(pe.FileText,{className:"h-16 w-16 text-gray-400 mb-4"}),u.jsx("p",{className:"text-lg font-medium mb-2",children:r}),u.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[a," • ",s.length," bytes"]}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"This file type cannot be previewed. Use download or external view."})]}):u.jsx("div",{className:"flex items-center justify-center py-12",children:u.jsx("p",{className:"text-muted-foreground",children:"No content to display"})}),E=()=>a.startsWith("image/")?u.jsx(pe.Image,{className:"h-5 w-5"}):u.jsx(pe.FileText,{className:"h-5 w-5"});return u.jsx(nI,{open:t,onOpenChange:e,children:u.jsxs(Qm,{className:"max-w-4xl max-h-[90vh] overflow-hidden",children:[u.jsx(jm,{children:u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[E(),u.jsxs("div",{children:[u.jsx(Xm,{className:"text-left",children:r}),u.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[a," • Click download or external view for full access"]})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs(Ve,{variant:"outline",size:"sm",onClick:g,className:"flex items-center gap-2",children:[u.jsx(pe.ExternalLink,{className:"h-4 w-4"}),"External"]}),u.jsxs(Ve,{variant:"outline",size:"sm",onClick:m,className:"flex items-center gap-2",children:[u.jsx(pe.Download,{className:"h-4 w-4"}),"Download"]})]})]})}),u.jsx("div",{className:"flex-1 overflow-hidden",children:f()})]})})}const ei="prose prose-sm max-w-none break-words dark:prose-invert prose-headings:break-words prose-p:break-words prose-li:break-words prose-td:break-words prose-th:break-words prose-a:break-all prose-code:break-words prose-blockquote:break-words";function oI({className:t}){const[e,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>n(a=>(a+1)%4),500);return()=>clearInterval(r)},[]),u.jsxs("span",{"aria-live":"polite",className:$("inline-block text-xs opacity-70 ml-1",t),children:["Is thinking",".".repeat(e)]})}const Zm=y.memo(function({message:e,messageIndex:n,isStreamingMessage:r=!1,streamingDebounceMs:a=800,isEditing:i=!1,showActions:o=!0,showTimestamp:s=!0,showAgentName:l=!0,layoutSize:c="desktop",truncateToolMessages:d=!0,toolMessagePreviewLength:_=200,truncateUserMessages:p=!0,userMessagePreviewLength:m=200,customStyles:g={},onEdit:f,onRegenerate:E,onCancelEdit:S,onCopy:T}){const[h,N]=y.useState(!1),[R,C]=y.useState(!1),[v,O]=y.useState(!1),[x,w]=y.useState(!1),{currentThreadId:L}=ba();Wo();const[H,z]=y.useState({}),[P,G]=y.useState(!1),[I,U]=y.useState(null),M=c==="phone"||c==="half-screen",k=e.role,Y=k==="tool",W=y.useMemo(()=>{switch(k){case"user":return"text-[hsl(var(--chat-bubble-user-text))]";case"assistant":return"text-[hsl(var(--chat-bubble-ai-text))]";case"tool":return"text-secondary-foreground";case"system":return"text-muted-foreground";default:return"text-[hsl(var(--chat-bubble-ai-text))]"}},[k]),re=y.useMemo(()=>sI(e.content),[e.content]),q=y.useMemo(()=>_I(e.content),[e.content]),X=y.useMemo(()=>e.content.filter(Se=>Se.type==="image_url"),[e.content]),ce=y.useMemo(()=>e.content.filter(Se=>Se.type==="file"),[e.content]),ge=mI(re,r?a:0),V=async()=>{try{const Se=Y?sr(e.content):re;await navigator.clipboard.writeText(Se),N(!0),setTimeout(()=>N(!1),2e3),T==null||T(Se)}catch(Se){console.error("Failed to copy:",Se)}},F=()=>{if(!f)return;const Se=Y?sr(e.content):re;f(e.id,Se)},K=()=>E==null?void 0:E(n),te=()=>{const Be=$(M?"h-3 w-3":"h-4 w-4","opacity-60 flex-shrink-0",W);switch(k){case"user":return u.jsx(pe.User,{className:Be});case"assistant":return u.jsx(pe.Bot,{className:Be});case"tool":return u.jsx(pe.Wrench,{className:Be});default:return u.jsx(pe.Bot,{className:Be})}},le=()=>{const Se="group relative mb-4 flex w-full";switch(k){case"user":return $(Se,"justify-end");case"assistant":case"tool":case"system":return $(Se,"justify-start");default:return Se}},oe=()=>{const Se=$("rounded-lg px-4 py-3 relative transition-all duration-200 min-w-0 max-w-full break-words",M&&"px-3 py-2 text-sm");switch(k){case"user":return $(Se,"w-full md:max-w-[95%]","bg-[hsl(var(--chat-bubble-user))] text-[hsl(var(--chat-bubble-user-text))]","border border-transparent");case"assistant":return $(Se,"w-full md:max-w-[95%]","bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]","border border-border/60 dark:border-border/40");case"tool":return $(Se,"w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");case"system":return $(Se,"w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");default:return $(Se,"w-full md:max-w-[95%]","bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]","border border-border/60 dark:border-border/40")}},Ae=Se=>{if(!Se)return"";try{return new Date(Se).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}},qe=()=>{if(e.model==="reflection"){const ee=re.trim(),Q=ls(ee);if(Q&&typeof Q=="object")return u.jsx(gI,{data:Q})}if(Y&&q.name==="get_issues"){const ee=e.content.find(be=>be.type==="tool_result"),Q=(ee==null?void 0:ee.output)??sr(e.content),ae=tg(Q);if(ae)return u.jsx(EI,{issues:ae})}if(Y&&!v){const ee=sr(e.content).slice(0,80).replace(/\s+/g," ");return u.jsx("div",{className:$("text-xs font-mono opacity-70 flex items-center justify-between gap-2 text-current",M&&"text-[10px]"),children:u.jsxs("span",{className:"truncate max-w-full text-current",children:[ee,ee.length>=80?"…":""]})})}if(Y&&d){const ee=sr(e.content),Q=ee.length>_;return u.jsx(Xp,{open:R,onOpenChange:C,children:u.jsxs("div",{className:"font-mono text-sm text-current",children:[u.jsx("pre",{className:$("whitespace-pre-wrap break-words text-current",M&&"text-xs"),children:Q&&!R?ee.substring(0,_)+"...":ee}),Q&&u.jsx(Zp,{asChild:!0,children:u.jsx(Ve,{variant:"ghost",size:"sm",className:"h-6 text-xs text-current",children:R?u.jsxs(u.Fragment,{children:[u.jsx(pe.ChevronUp,{className:"h-3 w-3 mr-1"}),"Show less"]}):u.jsxs(u.Fragment,{children:[u.jsx(pe.ChevronDown,{className:"h-3 w-3 mr-1"}),"Show more (",ee.length-_," chars)"]})})})]})})}if(Y&&v&&!d){const ee=fI(e.content);if(ee&&lI(ee))return u.jsx(Br,{content:ee.trim()});const Q=sr(e.content);return u.jsx("div",{className:"font-mono text-sm text-current",children:u.jsx("pre",{className:$("whitespace-pre-wrap break-words text-current",M&&"text-xs"),children:Q})})}const Se=X.length>0&&k!=="tool",Be=ce.length>0&&k!=="tool"&&!1;return u.jsxs("div",{children:[r?u.jsxs("div",{className:"relative",children:[(()=>{const ee=ls(ge);return ee!==null?u.jsx(Jm,{data:ee}):u.jsx(Br,{content:dI(cI(ge))})})(),u.jsx(oI,{className:$(W,M?"text-xs":"text-sm")})]}):(()=>{const ee=ls(re.trim());if(ee!==null)return u.jsx(Jm,{data:ee});if(k==="user"&&p){const Q=re.trim();if(Q.length>m)return u.jsxs(Xp,{open:x,onOpenChange:w,children:[u.jsx("div",{className:$("text-sm text-[hsl(var(--chat-bubble-user-text))]",M&&"text-xs"),children:x?u.jsx(Br,{content:Q}):u.jsxs("pre",{className:$("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]",M&&"text-xs"),children:[Q.substring(0,m),"..."]})}),u.jsx(Zp,{asChild:!0,children:u.jsx(Ve,{variant:"ghost",size:"sm",className:"h-6 text-xs !text-[hsl(var(--chat-bubble-user-text))]",children:x?u.jsxs(u.Fragment,{children:[u.jsx(pe.ChevronUp,{className:"h-3 w-3 mr-1"})," Show less"]}):u.jsxs(u.Fragment,{children:[u.jsx(pe.ChevronDown,{className:"h-3 w-3 mr-1"})," Show more (",Q.length-m," chars)"]})})})]})}return u.jsx(Br,{content:re.trim()})})(),Se&&u.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2",children:X.map((ee,Q)=>u.jsxs("div",{className:"relative border rounded overflow-hidden",children:[u.jsx("img",{src:ee.url,alt:ee.alt??"image",className:"w-full h-auto"}),u.jsxs("div",{className:"absolute top-1 right-1 bg-background/70 rounded px-1 py-0.5 text-[10px] flex items-center gap-1",children:[u.jsx(pe.Image,{className:"h-3 w-3"}),u.jsx("span",{children:"image"})]})]},Q))}),Be]})},Me=y.useMemo(()=>pI(e),[e]);return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:$(le(),g.container),children:u.jsxs("div",{className:$(oe(),g.content),children:[(s||l||Y)&&u.jsxs("div",{className:$("flex items-center justify-between mb-2 pb-2 border-b border-current/10",M&&"mb-1 pb-1",W,g.header),children:[u.jsxs("div",{className:"flex items-center gap-2",children:[te(),l&&Me&&u.jsx("span",{className:$("font-medium",M?"text-xs":"text-sm"),children:Me}),Y&&q.name&&u.jsxs(zp,{variant:"outline",className:$("text-xs flex items-center gap-1 cursor-pointer",W,"border border-current/40",M&&"text-xs h-4"),onClick:()=>O(Se=>!Se),children:[u.jsx("span",{children:q.name}),u.jsx("span",{className:"inline-flex items-center",children:v?u.jsx(pe.ChevronUp,{className:"h-3 w-3"}):u.jsx(pe.ChevronDown,{className:"h-3 w-3"})})]}),Y&&!q.name&&u.jsx(Ve,{variant:"ghost",size:"sm",className:$("h-6 px-1",W,"hover:bg-foreground/10"),onClick:()=>O(Se=>!Se),children:u.jsxs("span",{className:"text-xs flex items-center gap-1",children:["Tool Output ",v?u.jsx(pe.ChevronUp,{className:"h-3 w-3"}):u.jsx(pe.ChevronDown,{className:"h-3 w-3"})]})})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[s&&u.jsx("span",{className:$("text-xs opacity-60",W,M&&"text-xs"),children:Ae(e.createdAt)}),o&&!i&&u.jsxs("div",{className:$("opacity-0 group-hover:opacity-100 transition-opacity","flex items-center gap-1",g.actions),children:[u.jsx(Ve,{variant:"ghost",size:"sm",onClick:V,className:$("h-6 w-6 p-0 hover:bg-foreground/10",W,M&&"h-5 w-5"),children:u.jsx(pe.Copy,{className:$(h?"text-success":W,M?"h-3 w-3":"h-4 w-4")})}),k==="user"&&f&&u.jsx(Ve,{variant:"ghost",size:"sm",onClick:F,className:$("h-6 w-6 p-0 hover:bg-foreground/10",W,M&&"h-5 w-5"),children:u.jsx(pe.Edit,{className:$(W,M?"h-3 w-3":"h-4 w-4")})}),k==="assistant"&&E&&u.jsx(Ve,{variant:"ghost",size:"sm",onClick:K,className:$("h-6 w-6 p-0 hover:bg-foreground/10",W,M&&"h-5 w-5"),children:u.jsx(pe.RotateCcw,{className:$(W,M?"h-3 w-3":"h-4 w-4")})})]})]})]}),u.jsx("div",{className:"relative",children:qe()}),Y&&v&&(q.toolCallId||q.name)&&u.jsxs("div",{className:$("mt-2 pt-2 border-t border-current/10 text-xs opacity-60",M&&"text-xs"),children:[q.name&&u.jsxs("div",{children:["Function: ",q.name]}),q.toolCallId&&u.jsxs("div",{children:["Call ID: ",q.toolCallId]})]}),!(s||l||Y)&&o&&!i&&u.jsxs("div",{className:$("absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity","flex items-center gap-1",g.actions),children:[u.jsx(Ve,{variant:"ghost",size:"sm",onClick:V,className:$("h-6 w-6 p-0 hover:bg-background/50 text-current",M&&"h-5 w-5"),children:u.jsx(pe.Copy,{className:$(h?"text-success":"text-current",M?"h-3 w-3":"h-4 w-4")})}),k==="user"&&f&&u.jsx(Ve,{variant:"ghost",size:"sm",onClick:F,className:$("h-6 w-6 p-0 hover:bg-background/50 text-current",M&&"h-5 w-5"),children:u.jsx(pe.Edit,{className:$("text-current",M?"h-3 w-3":"h-4 w-4")})}),k==="assistant"&&E&&u.jsx(Ve,{variant:"ghost",size:"sm",onClick:K,className:$("h-6 w-6 p-0 hover:bg-background/50 text-current",M&&"h-5 w-5"),children:u.jsx(pe.RotateCcw,{className:$("text-current",M?"h-3 w-3":"h-4 w-4")})})]})]})}),I&&u.jsx(iI,{isOpen:P,onClose:()=>{G(!1),U(null)},fileId:I.id,fileName:I.name,mimeType:I.mimeType})]})},(t,e)=>e.isStreamingMessage?!1:t.message.id===e.message.id&&t.message.content===e.message.content&&t.isStreamingMessage===e.isStreamingMessage&&t.isEditing===e.isEditing);function sI(t){const e=t.filter(n=>n.type==="text").map(n=>n.text).join("");return e||JSON.stringify(t)}function lI(t){return t.includes(`
78
- `)||t.includes("```")||/[-*] /.test(t)||/#+\s/.test(t)}function cI(t){let e=t;try{(e.match(/```/g)||[]).length%2===1&&(e+="\n```"),(e.replace(/```[\s\S]*?```/g,"").match(new RegExp("(?<!`)`(?!`)","g"))||[]).length%2===1&&(e+="`")}catch{}return e}function dI(t){let e=t;try{const n=[],r=[],a="\0F",i="\0I";let o=e.replace(/```[\s\S]*?```/g,s=>(n.push(s),`${a}${n.length-1}\0`));o=o.replace(/`[^`]*`/g,s=>(r.push(s),`${i}${r.length-1}\0`)),o=o.replace(/\b([A-Za-z0-9_&\/-]+)\b(\s+\1\b)+/g,"$1").replace(/\b([A-Za-z0-9_&\/-]+\s+[A-Za-z0-9_&\/-]+)\b(\s+\1\b)+/g,"$1").replace(/([\.,;:!\?\-])\1+/g,"$1").replace(/([:;!\?\)])([A-Za-z])/g,"$1 $2").replace(/\s{3,}/g," "),o=o.replace(/\u0000F(\d+)\u0000/g,(s,l)=>n[Number(l)]??""),o=o.replace(/\u0000I(\d+)\u0000/g,(s,l)=>r[Number(l)]??""),e=o}catch{}return e}function ls(t){const e=t==null?void 0:t.trim();if(!e||!(e.startsWith("{")||e.startsWith("[")))return null;try{return JSON.parse(e)}catch{return null}}function Jm({data:t}){if(Array.isArray(t))return t.every(n=>n===null||["string","number","boolean"].includes(typeof n))?u.jsx("div",{className:ei,children:u.jsx("ul",{className:"list-disc pl-5",children:t.map((n,r)=>u.jsx("li",{children:String(n)},r))})}):u.jsx("pre",{className:"font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words",children:Hr(t)});if(t&&typeof t=="object"){const e=Array.isArray(t.distilled_facts)?t.distilled_facts:null,n=Array.isArray(t.follow_up_queries)?t.follow_up_queries:null,r=typeof t.is_sufficient=="boolean"?t.is_sufficient:void 0;if(e||n||typeof r=="boolean")return u.jsxs("div",{className:ei,children:[typeof r=="boolean"&&u.jsxs("p",{children:[u.jsx("strong",{children:"Is sufficient:"})," ",r?"Yes":"No"]}),n&&n.length>0&&u.jsxs("div",{children:[u.jsx("p",{children:u.jsx("strong",{children:"Follow-up queries:"})}),u.jsx("ul",{className:"list-disc pl-5",children:n.map((i,o)=>u.jsx("li",{children:String(i)},o))})]}),e&&e.length>0&&u.jsxs("div",{children:[u.jsx("p",{children:u.jsx("strong",{children:"Facts:"})}),u.jsx("ul",{className:"list-disc pl-5",children:e.map((i,o)=>u.jsx("li",{children:String(i)},o))})]})]});const a=Object.entries(t);return u.jsx("div",{className:ei,children:u.jsx("dl",{className:"mt-0",children:a.map(([i,o])=>u.jsxs("div",{className:"mb-1",children:[u.jsxs("dt",{className:"inline font-medium mr-1",children:[i,":"]}),u.jsx("dd",{className:"inline",children:uI(o)})]},i))})})}return u.jsx("pre",{className:"font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words",children:Hr(t)})}function uI(t){if(t==null)return String(t);const e=typeof t;if(e==="string"||e==="number"||e==="boolean")return String(t);if(Array.isArray(t)&&t.every(r=>r===null||["string","number","boolean"].includes(typeof r)))return t.join(", ");try{return u.jsx("code",{className:"text-xs",children:JSON.stringify(ti(t))})}catch{return String(t)}}function eg(t){return!!(t&&typeof t=="object"&&(t.type==="file"||t.mimeType||t.filename||t.sourceType==="base64"))}function ti(t){if(typeof t=="string")return t.length>2e3?t.slice(0,2e3)+"... [truncated]":t;if(t&&typeof t=="object"){if(Array.isArray(t)){const n=t.map(ti).filter(r=>r!==void 0);return n.length?n:void 0}if(eg(t))return;const e={};for(const n of Object.keys(t)){const r=t[n];if(n==="data"&&typeof r=="string"&&r.length>100)e[n]=`[base64 ${r.length} chars omitted]`;else{const a=ti(r);a!==void 0&&(e[n]=a)}}return Object.keys(e).length?e:void 0}return t}function Hr(t){if(typeof t=="string")return t;if(eg(t))return"";try{const e=ti(t);return e===void 0?"":typeof e=="string"?e:JSON.stringify(e,null,2)}catch{return""}}function _I(t){const e=t.find(r=>r.type==="tool_call"),n=t.find(r=>r.type==="tool_result");return{name:e==null?void 0:e.name,toolCallId:(n==null?void 0:n.toolCallId)??(e==null?void 0:e.id)}}function pI(t){return t.name&&t.name.trim()?t.name:t.model&&t.model.includes("/")?t.model.split("/").pop()||null:t.model||null}function mI(t,e){const[n,r]=y.useState(t),a=y.useRef(null),i=y.useRef(null);return y.useEffect(()=>{if(!e){r(t);return}return i.current&&clearTimeout(i.current),a.current&&cancelAnimationFrame(a.current),i.current=setTimeout(()=>{a.current=requestAnimationFrame(()=>{r(t)})},e),()=>{i.current&&clearTimeout(i.current),a.current&&cancelAnimationFrame(a.current)}},[t,e]),n}function gI({data:t}){return u.jsx("dl",{className:"grid grid-cols-1 gap-y-2",children:Object.entries(t).map(([e,n])=>u.jsxs("div",{className:"flex",children:[u.jsxs("dt",{className:"font-semibold mr-2",children:[e,":"]}),u.jsx("dd",{className:"flex-1 break-words",children:Array.isArray(n)?n.map((r,a)=>u.jsxs("div",{className:"ml-4 break-words",children:["- ",String(r)]},a)):String(n)})]},e))})}function tg(t){if(!t)return null;if(typeof t=="object"&&!Array.isArray(t)){if(t.desirability||t.feasibility||t.viability||t.other)return{desirability:Array.isArray(t.desirability)?t.desirability:[],feasibility:Array.isArray(t.feasibility)?t.feasibility:[],viability:Array.isArray(t.viability)?t.viability:[],other:Array.isArray(t.other)?t.other:[]};if(t.output&&typeof t.output!="object")t=t.output;else if(t.output&&typeof t.output=="object")return tg(t.output)}const e=String(t),n={desirability:[],feasibility:[],viability:[],other:[]};let r=e;const a=Math.min(...["desirability=","feasibility=","viability=","other="].map(o=>{const s=r.toLowerCase().indexOf(o);return s===-1?Number.MAX_SAFE_INTEGER:s}));a!==Number.MAX_SAFE_INTEGER&&(r=r.slice(a));for(const o of Object.keys(n)){const l=new RegExp(o+"\\s*=\\s*\\[([\\s\\S]*?)\\]","i").exec(r);if(!l)continue;const c=l[1],d=/Issue\(([\s\S]*?)\)(?:,|$)/g;let _=null;for(;(_=d.exec(c))!==null;){const p=_[1],m=/title\s*=\s*(['"])([\s\S]*?)\1/.exec(p),g=/description\s*=\s*(['"])([\s\S]*?)\1/.exec(p),f=m?m[2].trim():"",E=g?g[2].trim():"";n[o].push({title:f,description:E})}}return Object.values(n).some(o=>o.length>0)?n:null}function EI({issues:t}){const e=[{key:"desirability",title:"Desirability"},{key:"feasibility",title:"Feasibility"},{key:"viability",title:"Viability"},{key:"other",title:"Other"}];return u.jsx("div",{className:ei,children:e.map(n=>{const r=t[n.key];return!r||!r.length?null:u.jsxs("div",{className:"mb-4",children:[u.jsxs("h4",{className:"font-semibold mb-2",children:[n.title," (",r.length,")"]}),u.jsx("ol",{className:"list-decimal pl-5 space-y-2",children:r.map((a,i)=>u.jsxs("li",{children:[u.jsx("div",{className:"font-medium",children:a.title}),u.jsx("div",{className:"text-sm text-muted-foreground",children:a.description})]},i))})]},n.key)})})}function sr(t){const e=t.filter(n=>n.type==="tool_result");if(e.length)try{return e.length===1?Hr(e[0].output):Hr(e.map(n=>({toolCallId:n.toolCallId,output:n.output})))}catch{}return Hr(t)}function fI(t){const e=t.find(r=>r.type==="tool_result");if(!e)return null;const n=e.output;return typeof n=="string"?n:null}function ng({messages:t,isStreaming:e,streamingAssistantId:n,streamingDebounceMs:r,layoutSize:a,enableMessageEditing:i,editingMessageId:o,onStartReached:s,onEdit:l,onRegenerate:c,onCancelEdit:d,className:_,style:p,emptyMessage:m}){const g=y.useRef(null),f=y.useRef(null),E=y.useRef(!1),S=y.useRef(!0),T=y.useRef(t.length),h=y.useRef(null),N=y.useRef(0);y.useEffect(()=>{const v=g.current;if(!v)return;let O=!1;const x=()=>{O||(window.requestAnimationFrame(()=>{const w=v.scrollHeight-v.scrollTop-v.clientHeight;S.current=w<=32,O=!1}),O=!0)};return v.addEventListener("scroll",x,{passive:!0}),x(),()=>{v.removeEventListener("scroll",x)}},[]),y.useEffect(()=>{t.length<T.current&&(S.current=!0),T.current=t.length},[t.length]),y.useEffect(()=>{var v;if(!E.current&&S.current){if(e){if(Date.now()-N.current<200)return;h.current&&cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{var w;(w=f.current)==null||w.scrollToIndex({index:Math.max(0,t.length-1),behavior:"auto",align:"end"}),N.current=Date.now(),h.current=null})}else(v=f.current)==null||v.scrollToIndex({index:Math.max(0,t.length-1),behavior:"smooth",align:"end"});return()=>{h.current&&cancelAnimationFrame(h.current)}}},[t,e]);const R=y.useMemo(()=>{if(s)return async()=>{if(E.current)return;const v=g.current;if(!v){await(s==null?void 0:s());return}const O=v.scrollHeight,x=v.scrollTop;E.current=!0;try{await s()}finally{requestAnimationFrame(()=>{const w=g.current;if(!w){E.current=!1;return}const L=w.scrollHeight;w.scrollTop=x+(L-O);const H=L-w.scrollTop-w.clientHeight;S.current=H<=32,E.current=!1})}}},[s]),C=(v,O)=>{g.current=v,O&&(typeof O=="function"?O(v):O.current=v)};return t.length===0?u.jsx("div",{className:_,style:p,children:u.jsx("div",{className:"flex items-center justify-center py-8 text-muted-foreground text-center max-w-md mx-auto",children:m||"No messages yet. Start a conversation!"})}):u.jsx("div",{className:_,style:p,children:u.jsx(JN,{ref:v=>{f.current=v},data:t,followOutput:!1,alignToBottom:!e,overscan:{main:400,reverse:400},increaseViewportBy:{top:800,bottom:800},defaultItemHeight:150,fixedItemHeight:e?150:void 0,startReached:()=>{R&&R()},atBottomStateChange:v=>{S.current=v},style:{height:"100%",overscrollBehavior:"contain",scrollBehavior:e?"auto":"smooth"},computeItemKey:(v,O)=>O.id??`message-${v}`,components:{Scroller:y.forwardRef((v,O)=>u.jsx("div",{...v,ref:x=>C(x,O),style:{overflowAnchor:"none",willChange:e?"contents":"transform",contain:e?"strict":"layout style paint",contentVisibility:e?"auto":"visible",...(v==null?void 0:v.style)??{}}}))},itemContent:(v,O)=>u.jsx("div",{className:"mb-4 last:mb-0",style:{contentVisibility:"auto",containIntrinsicSize:e?"1px 200px":"auto 150px",contain:e?"size layout style paint":"layout style paint",transform:"translateZ(0)",isolation:"isolate",minHeight:e&&n===O.id?"200px":void 0,maxHeight:e&&n===O.id?"none":void 0},children:u.jsx(Zm,{message:O,messageIndex:v,isStreamingMessage:e&&n===O.id,streamingDebounceMs:r,isEditing:o===O.id,showActions:i,showTimestamp:!1,showAgentName:!0,layoutSize:a,truncateToolMessages:!1,toolMessagePreviewLength:200,onEdit:l,onRegenerate:()=>c(v),onCancelEdit:d},O.id??`msg-${O.role}-${v}-${O.createdAt??""}`)})})})}const ni=1e4;function SI(t){if(typeof t!="string")return String(t);const e=[/<script[^>]*>.*?<\/script>/gi,/<iframe[^>]*>.*?<\/iframe>/gi,/javascript:/gi,/vbscript:/gi,/on\w+\s*=/gi,/<object[^>]*>.*?<\/object>/gi,/<embed[^>]*>.*?<\/embed>/gi,/<form[^>]*>.*?<\/form>/gi];let n=t;for(const a of e)n=n.replace(a,"");return/<[^>]+>/.test(n)&&!/<(?!\/?(?:code|strong|em|b|i|br|p|ul|ol|li|h[1-6])\b)[^>]+>/i.test(n)?n.replace(/<code>(.*?)<\/code>/gi,"`$1`").replace(/<strong>(.*?)<\/strong>/gi,"**$1**").replace(/<b>(.*?)<\/b>/gi,"**$1**").replace(/<em>(.*?)<\/em>/gi,"*$1*").replace(/<i>(.*?)<\/i>/gi,"*$1*").replace(/<br\s*\/?>/gi,`
78
+ `)||t.includes("```")||/[-*] /.test(t)||/#+\s/.test(t)}function cI(t){let e=t;try{(e.match(/```/g)||[]).length%2===1&&(e+="\n```"),(e.replace(/```[\s\S]*?```/g,"").match(new RegExp("(?<!`)`(?!`)","g"))||[]).length%2===1&&(e+="`")}catch{}return e}function dI(t){let e=t;try{const n=[],r=[],a="\0F",i="\0I";let o=e.replace(/```[\s\S]*?```/g,s=>(n.push(s),`${a}${n.length-1}\0`));o=o.replace(/`[^`]*`/g,s=>(r.push(s),`${i}${r.length-1}\0`)),o=o.replace(/\b([A-Za-z0-9_&\/-]+)\b(\s+\1\b)+/g,"$1").replace(/\b([A-Za-z0-9_&\/-]+\s+[A-Za-z0-9_&\/-]+)\b(\s+\1\b)+/g,"$1").replace(/([\.,;:!\?\-])\1+/g,"$1").replace(/([:;!\?\)])([A-Za-z])/g,"$1 $2").replace(/\s{3,}/g," "),o=o.replace(/\u0000F(\d+)\u0000/g,(s,l)=>n[Number(l)]??""),o=o.replace(/\u0000I(\d+)\u0000/g,(s,l)=>r[Number(l)]??""),e=o}catch{}return e}function ls(t){const e=t==null?void 0:t.trim();if(!e||!(e.startsWith("{")||e.startsWith("[")))return null;try{return JSON.parse(e)}catch{return null}}function Jm({data:t}){if(Array.isArray(t))return t.every(n=>n===null||["string","number","boolean"].includes(typeof n))?u.jsx("div",{className:ei,children:u.jsx("ul",{className:"list-disc pl-5",children:t.map((n,r)=>u.jsx("li",{children:String(n)},r))})}):u.jsx("pre",{className:"font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words",children:Hr(t)});if(t&&typeof t=="object"){const e=Array.isArray(t.distilled_facts)?t.distilled_facts:null,n=Array.isArray(t.follow_up_queries)?t.follow_up_queries:null,r=typeof t.is_sufficient=="boolean"?t.is_sufficient:void 0;if(e||n||typeof r=="boolean")return u.jsxs("div",{className:ei,children:[typeof r=="boolean"&&u.jsxs("p",{children:[u.jsx("strong",{children:"Is sufficient:"})," ",r?"Yes":"No"]}),n&&n.length>0&&u.jsxs("div",{children:[u.jsx("p",{children:u.jsx("strong",{children:"Follow-up queries:"})}),u.jsx("ul",{className:"list-disc pl-5",children:n.map((i,o)=>u.jsx("li",{children:String(i)},o))})]}),e&&e.length>0&&u.jsxs("div",{children:[u.jsx("p",{children:u.jsx("strong",{children:"Facts:"})}),u.jsx("ul",{className:"list-disc pl-5",children:e.map((i,o)=>u.jsx("li",{children:String(i)},o))})]})]});const a=Object.entries(t);return u.jsx("div",{className:ei,children:u.jsx("dl",{className:"mt-0",children:a.map(([i,o])=>u.jsxs("div",{className:"mb-1",children:[u.jsxs("dt",{className:"inline font-medium mr-1",children:[i,":"]}),u.jsx("dd",{className:"inline",children:uI(o)})]},i))})})}return u.jsx("pre",{className:"font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words",children:Hr(t)})}function uI(t){if(t==null)return String(t);const e=typeof t;if(e==="string"||e==="number"||e==="boolean")return String(t);if(Array.isArray(t)&&t.every(r=>r===null||["string","number","boolean"].includes(typeof r)))return t.join(", ");try{return u.jsx("code",{className:"text-xs",children:JSON.stringify(ti(t))})}catch{return String(t)}}function eg(t){return!!(t&&typeof t=="object"&&(t.type==="file"||t.mimeType||t.filename||t.sourceType==="base64"))}function ti(t){if(typeof t=="string")return t.length>2e3?t.slice(0,2e3)+"... [truncated]":t;if(t&&typeof t=="object"){if(Array.isArray(t)){const n=t.map(ti).filter(r=>r!==void 0);return n.length?n:void 0}if(eg(t))return;const e={};for(const n of Object.keys(t)){const r=t[n];if(n==="data"&&typeof r=="string"&&r.length>100)e[n]=`[base64 ${r.length} chars omitted]`;else{const a=ti(r);a!==void 0&&(e[n]=a)}}return Object.keys(e).length?e:void 0}return t}function Hr(t){if(typeof t=="string")return t;if(eg(t))return"";try{const e=ti(t);return e===void 0?"":typeof e=="string"?e:JSON.stringify(e,null,2)}catch{return""}}function _I(t){const e=t.find(r=>r.type==="tool_call"),n=t.find(r=>r.type==="tool_result");return{name:e==null?void 0:e.name,toolCallId:(n==null?void 0:n.toolCallId)??(e==null?void 0:e.id)}}function pI(t){return t.name&&t.name.trim()?t.name:t.model&&t.model.includes("/")?t.model.split("/").pop()||null:t.model||null}function mI(t,e){const[n,r]=y.useState(t),a=y.useRef(null),i=y.useRef(null);return y.useEffect(()=>{if(!e){r(t);return}return i.current&&clearTimeout(i.current),a.current&&cancelAnimationFrame(a.current),i.current=setTimeout(()=>{a.current=requestAnimationFrame(()=>{r(t)})},e),()=>{i.current&&clearTimeout(i.current),a.current&&cancelAnimationFrame(a.current)}},[t,e]),n}function gI({data:t}){return u.jsx("dl",{className:"grid grid-cols-1 gap-y-2",children:Object.entries(t).map(([e,n])=>u.jsxs("div",{className:"flex",children:[u.jsxs("dt",{className:"font-semibold mr-2",children:[e,":"]}),u.jsx("dd",{className:"flex-1 break-words",children:Array.isArray(n)?n.map((r,a)=>u.jsxs("div",{className:"ml-4 break-words",children:["- ",String(r)]},a)):String(n)})]},e))})}function tg(t){if(!t)return null;if(typeof t=="object"&&!Array.isArray(t)){if(t.desirability||t.feasibility||t.viability||t.other)return{desirability:Array.isArray(t.desirability)?t.desirability:[],feasibility:Array.isArray(t.feasibility)?t.feasibility:[],viability:Array.isArray(t.viability)?t.viability:[],other:Array.isArray(t.other)?t.other:[]};if(t.output&&typeof t.output!="object")t=t.output;else if(t.output&&typeof t.output=="object")return tg(t.output)}const e=String(t),n={desirability:[],feasibility:[],viability:[],other:[]};let r=e;const a=Math.min(...["desirability=","feasibility=","viability=","other="].map(o=>{const s=r.toLowerCase().indexOf(o);return s===-1?Number.MAX_SAFE_INTEGER:s}));a!==Number.MAX_SAFE_INTEGER&&(r=r.slice(a));for(const o of Object.keys(n)){const l=new RegExp(o+"\\s*=\\s*\\[([\\s\\S]*?)\\]","i").exec(r);if(!l)continue;const c=l[1],d=/Issue\(([\s\S]*?)\)(?:,|$)/g;let _=null;for(;(_=d.exec(c))!==null;){const p=_[1],m=/title\s*=\s*(['"])([\s\S]*?)\1/.exec(p),g=/description\s*=\s*(['"])([\s\S]*?)\1/.exec(p),f=m?m[2].trim():"",E=g?g[2].trim():"";n[o].push({title:f,description:E})}}return Object.values(n).some(o=>o.length>0)?n:null}function EI({issues:t}){const e=[{key:"desirability",title:"Desirability"},{key:"feasibility",title:"Feasibility"},{key:"viability",title:"Viability"},{key:"other",title:"Other"}];return u.jsx("div",{className:ei,children:e.map(n=>{const r=t[n.key];return!r||!r.length?null:u.jsxs("div",{className:"mb-4",children:[u.jsxs("h4",{className:"font-semibold mb-2",children:[n.title," (",r.length,")"]}),u.jsx("ol",{className:"list-decimal pl-5 space-y-2",children:r.map((a,i)=>u.jsxs("li",{children:[u.jsx("div",{className:"font-medium",children:a.title}),u.jsx("div",{className:"text-sm text-muted-foreground",children:a.description})]},i))})]},n.key)})})}function sr(t){const e=t.filter(n=>n.type==="tool_result");if(e.length)try{return e.length===1?Hr(e[0].output):Hr(e.map(n=>({toolCallId:n.toolCallId,output:n.output})))}catch{}return Hr(t)}function fI(t){const e=t.find(r=>r.type==="tool_result");if(!e)return null;const n=e.output;return typeof n=="string"?n:null}function ng({messages:t,isStreaming:e,streamingAssistantId:n,streamingDebounceMs:r,layoutSize:a,enableMessageEditing:i,editingMessageId:o,onStartReached:s,onEdit:l,onRegenerate:c,onCancelEdit:d,className:_,style:p,emptyMessage:m}){const g=y.useRef(null),f=y.useRef(null),E=y.useRef(!1),S=y.useRef(!0),T=y.useRef(t.length),h=y.useRef(null),N=y.useRef(0);y.useEffect(()=>{const v=g.current;if(!v)return;let O=!1;const x=()=>{O||(window.requestAnimationFrame(()=>{const w=v.scrollHeight-v.scrollTop-v.clientHeight;S.current=w<=32,O=!1}),O=!0)};return v.addEventListener("scroll",x,{passive:!0}),x(),()=>{v.removeEventListener("scroll",x)}},[]),y.useEffect(()=>{t.length<T.current&&(S.current=!0),T.current=t.length},[t.length]),y.useEffect(()=>{var v;if(!E.current&&S.current){if(e){if(Date.now()-N.current<100)return;h.current&&cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{var w;(w=f.current)==null||w.scrollToIndex({index:Math.max(0,t.length-1),behavior:"auto",align:"end"}),N.current=Date.now(),h.current=null})}else(v=f.current)==null||v.scrollToIndex({index:Math.max(0,t.length-1),behavior:"auto",align:"end"});return()=>{h.current&&cancelAnimationFrame(h.current)}}},[t,e]);const R=y.useMemo(()=>{if(s)return async()=>{if(E.current)return;const v=g.current;if(!v){await(s==null?void 0:s());return}const O=v.scrollHeight,x=v.scrollTop;E.current=!0;try{await s()}finally{requestAnimationFrame(()=>{const w=g.current;if(!w){E.current=!1;return}const L=w.scrollHeight;w.scrollTop=x+(L-O);const H=L-w.scrollTop-w.clientHeight;S.current=H<=32,E.current=!1})}}},[s]),C=(v,O)=>{g.current=v,O&&(typeof O=="function"?O(v):O.current=v)};return t.length===0?u.jsx("div",{className:_,style:p,children:u.jsx("div",{className:"flex items-center justify-center py-8 text-muted-foreground text-center max-w-md mx-auto",children:m||"No messages yet. Start a conversation!"})}):u.jsx("div",{className:_,style:p,children:u.jsx(JN,{ref:v=>{f.current=v},data:t,followOutput:e?!1:"smooth",overscan:{main:300,reverse:300},increaseViewportBy:{top:600,bottom:600},defaultItemHeight:100,startReached:()=>{R&&R()},atBottomStateChange:v=>{S.current=v},style:{height:"100%",overscrollBehavior:"contain"},computeItemKey:(v,O)=>O.id??`message-${v}`,components:{Scroller:y.forwardRef((v,O)=>u.jsx("div",{...v,ref:x=>C(x,O),style:{overflowAnchor:"none",willChange:e?"scroll-position":"transform",contain:"layout style paint",...(v==null?void 0:v.style)??{}}}))},itemContent:(v,O)=>u.jsx("div",{className:"mb-4 last:mb-0",style:{contentVisibility:"auto",containIntrinsicSize:"auto 150px",transform:"translateZ(0)",isolation:"isolate"},children:u.jsx(Zm,{message:O,messageIndex:v,isStreamingMessage:e&&n===O.id,streamingDebounceMs:r,isEditing:o===O.id,showActions:i,showTimestamp:!1,showAgentName:!0,layoutSize:a,truncateToolMessages:!1,toolMessagePreviewLength:200,onEdit:l,onRegenerate:()=>c(v),onCancelEdit:d},O.id??`msg-${O.role}-${v}-${O.createdAt??""}`)})})})}const ni=1e4;function SI(t){if(typeof t!="string")return String(t);const e=[/<script[^>]*>.*?<\/script>/gi,/<iframe[^>]*>.*?<\/iframe>/gi,/javascript:/gi,/vbscript:/gi,/on\w+\s*=/gi,/<object[^>]*>.*?<\/object>/gi,/<embed[^>]*>.*?<\/embed>/gi,/<form[^>]*>.*?<\/form>/gi];let n=t;for(const a of e)n=n.replace(a,"");return/<[^>]+>/.test(n)&&!/<(?!\/?(?:code|strong|em|b|i|br|p|ul|ol|li|h[1-6])\b)[^>]+>/i.test(n)?n.replace(/<code>(.*?)<\/code>/gi,"`$1`").replace(/<strong>(.*?)<\/strong>/gi,"**$1**").replace(/<b>(.*?)<\/b>/gi,"**$1**").replace(/<em>(.*?)<\/em>/gi,"*$1*").replace(/<i>(.*?)<\/i>/gi,"*$1*").replace(/<br\s*\/?>/gi,`
79
79
  `).replace(/<p>(.*?)<\/p>/gi,`$1
80
80
 
81
81
  `).replace(/<h([1-6])>(.*?)<\/h[1-6]>/gi,(a,i,o)=>`${"#".repeat(parseInt(i))} ${o}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teodor-new-chat-ui",
3
- "version": "3.0.77",
3
+ "version": "3.0.78",
4
4
  "description": "React chat UI components with streaming support, tool calls, and modern design",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.esm.js",