@pdf-viewer/react 0.9.0-beta.0 → 0.9.0-beta.2

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.
Files changed (56) hide show
  1. package/dist/{RPDefaultLayout-6a828c29.js → RPDefaultLayout-3d9595ed.js} +16 -17
  2. package/dist/components/RPController.js +1 -1
  3. package/dist/components/RPPages.js +1 -1
  4. package/dist/components/RPProvider.js +1 -1
  5. package/dist/components/layout/RPDefaultLayout.js +1 -1
  6. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  7. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  8. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  9. package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
  10. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  11. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  12. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  13. package/dist/components/layout/toolbar/MostPageTool.js +2 -2
  14. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  15. package/dist/components/layout/toolbar/Paginate.js +1 -1
  16. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  17. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  18. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  19. package/dist/components/layout/toolbar/RotateTool.js +1 -1
  20. package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
  21. package/dist/components/layout/toolbar/SearchTool.js +1 -1
  22. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  23. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  24. package/dist/components/layout/toolbar/ZoomTool.js +2 -2
  25. package/dist/components/page/AnnotationLayer.js +1 -1
  26. package/dist/components/page/CanvasLayer.js +1 -1
  27. package/dist/components/page/DualPage.js +1 -1
  28. package/dist/components/page/RPPage.js +1 -1
  29. package/dist/components/page/SinglePage.js +1 -1
  30. package/dist/components/page/TextLayer.js +1 -1
  31. package/dist/components/ui/Checkbox.js +1 -1
  32. package/dist/components/ui/DropDown.js +1 -1
  33. package/dist/components/ui/LoadingIndicator.js +1 -1
  34. package/dist/components/ui/RPTooltip.js +1793 -532
  35. package/dist/contexts/PaginationContext.js +1 -1
  36. package/dist/contexts/PrintContext.js +1 -1
  37. package/dist/contexts/SearchContext.js +1 -1
  38. package/dist/contexts/ThumbnailsContext.js +1 -1
  39. package/dist/index-3459164c.js +3609 -0
  40. package/dist/{index-71898eb9.js → index-743c36f0.js} +30 -30
  41. package/dist/main.js +1 -1
  42. package/dist/types/contexts/DarkModeContext.d.ts +3 -3
  43. package/dist/types/utils/hooks/useDarkMode.d.ts +2 -2
  44. package/dist/types/utils/types.d.ts +3 -5
  45. package/dist/utils/hooks/useDarkModeProps.js +6 -7
  46. package/dist/utils/hooks/useFileDownload.js +1 -1
  47. package/dist/utils/hooks/useLicense.js +31 -39
  48. package/dist/utils/hooks/usePaginate.js +1 -1
  49. package/dist/utils/hooks/usePrint.js +1 -1
  50. package/dist/utils/hooks/useScrollToPage.js +1 -1
  51. package/dist/utils/hooks/useSearch.js +1 -1
  52. package/dist/utils/hooks/useThumbnail.js +1 -1
  53. package/dist/utils/hooks/useVirtualReactWindow.js +1 -1
  54. package/package.json +2 -4
  55. package/dist/floating-ui.react-dom-e6d5fe8f.js +0 -1327
  56. package/dist/index-316854c1.js +0 -2299
@@ -1,62 +1,113 @@
1
- import { jsx as f, Fragment as F, jsxs as Y } from "react/jsx-runtime";
2
- import * as s from "react";
3
- import { forwardRef as mt } from "react";
4
- import { u as Q, c as Ee, d as ht, a as H, b as vt } from "../../index-71898eb9.js";
1
+ import { jsx as A, Fragment as gt, jsxs as De } from "react/jsx-runtime";
2
+ import * as u from "react";
3
+ import { useLayoutEffect as mn, useEffect as gn, forwardRef as yn } from "react";
5
4
  import * as yt from "react-dom";
6
- import { u as gt, a as wt, b as Ct, o as Et, s as Pt, f as bt, c as xt, d as Rt, h as At, l as Tt, e as Ot } from "../../floating-ui.react-dom-e6d5fe8f.js";
7
- import '../../assets/RPTooltip.css';function A(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
5
+ import '../../assets/RPTooltip.css';function Y(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
8
6
  return function(r) {
9
7
  if (e == null || e(r), n === !1 || !r.defaultPrevented)
10
8
  return t == null ? void 0 : t(r);
11
9
  };
12
10
  }
13
- function me(e, t) {
11
+ function ot(e, t) {
14
12
  if (typeof e == "function")
15
13
  return e(t);
16
14
  e != null && (e.current = t);
17
15
  }
18
- function Pe(...e) {
16
+ function wt(...e) {
19
17
  return (t) => {
20
18
  let n = !1;
21
19
  const o = e.map((r) => {
22
- const i = me(r, t);
20
+ const i = ot(r, t);
23
21
  return !n && typeof i == "function" && (n = !0), i;
24
22
  });
25
23
  if (n)
26
24
  return () => {
27
25
  for (let r = 0; r < o.length; r++) {
28
26
  const i = o[r];
29
- typeof i == "function" ? i() : me(e[r], null);
27
+ typeof i == "function" ? i() : ot(e[r], null);
30
28
  }
31
29
  };
32
30
  };
33
31
  }
34
- function _(...e) {
35
- return s.useCallback(Pe(...e), e);
32
+ function ae(...e) {
33
+ return u.useCallback(wt(...e), e);
36
34
  }
37
- var be = s.forwardRef((e, t) => {
38
- const { children: n, ...o } = e, r = s.Children.toArray(n), i = r.find(Nt);
35
+ function vt(e, t = []) {
36
+ let n = [];
37
+ function o(i, s) {
38
+ const c = u.createContext(s), l = n.length;
39
+ n = [...n, s];
40
+ const a = (d) => {
41
+ var w;
42
+ const { scope: h, children: p, ...m } = d, g = ((w = h == null ? void 0 : h[e]) == null ? void 0 : w[l]) || c, y = u.useMemo(() => m, Object.values(m));
43
+ return /* @__PURE__ */ A(g.Provider, { value: y, children: p });
44
+ };
45
+ a.displayName = i + "Provider";
46
+ function f(d, h) {
47
+ var g;
48
+ const p = ((g = h == null ? void 0 : h[e]) == null ? void 0 : g[l]) || c, m = u.useContext(p);
49
+ if (m)
50
+ return m;
51
+ if (s !== void 0)
52
+ return s;
53
+ throw new Error(`\`${d}\` must be used within \`${i}\``);
54
+ }
55
+ return [a, f];
56
+ }
57
+ const r = () => {
58
+ const i = n.map((s) => u.createContext(s));
59
+ return function(c) {
60
+ const l = (c == null ? void 0 : c[e]) || i;
61
+ return u.useMemo(
62
+ () => ({ [`__scope${e}`]: { ...c, [e]: l } }),
63
+ [c, l]
64
+ );
65
+ };
66
+ };
67
+ return r.scopeName = e, [o, wn(r, ...t)];
68
+ }
69
+ function wn(...e) {
70
+ const t = e[0];
71
+ if (e.length === 1)
72
+ return t;
73
+ const n = () => {
74
+ const o = e.map((r) => ({
75
+ useScope: r(),
76
+ scopeName: r.scopeName
77
+ }));
78
+ return function(i) {
79
+ const s = o.reduce((c, { useScope: l, scopeName: a }) => {
80
+ const d = l(i)[`__scope${a}`];
81
+ return { ...c, ...d };
82
+ }, {});
83
+ return u.useMemo(() => ({ [`__scope${t.scopeName}`]: s }), [s]);
84
+ };
85
+ };
86
+ return n.scopeName = t.scopeName, n;
87
+ }
88
+ var xt = u.forwardRef((e, t) => {
89
+ const { children: n, ...o } = e, r = u.Children.toArray(n), i = r.find(vn);
39
90
  if (i) {
40
- const a = i.props.children, c = r.map((l) => l === i ? s.Children.count(a) > 1 ? s.Children.only(null) : s.isValidElement(a) ? a.props.children : null : l);
41
- return /* @__PURE__ */ f(G, { ...o, ref: t, children: s.isValidElement(a) ? s.cloneElement(a, void 0, c) : null });
91
+ const s = i.props.children, c = r.map((l) => l === i ? u.Children.count(s) > 1 ? u.Children.only(null) : u.isValidElement(s) ? s.props.children : null : l);
92
+ return /* @__PURE__ */ A(Ne, { ...o, ref: t, children: u.isValidElement(s) ? u.cloneElement(s, void 0, c) : null });
42
93
  }
43
- return /* @__PURE__ */ f(G, { ...o, ref: t, children: n });
94
+ return /* @__PURE__ */ A(Ne, { ...o, ref: t, children: n });
44
95
  });
45
- be.displayName = "Slot";
46
- var G = s.forwardRef((e, t) => {
96
+ xt.displayName = "Slot";
97
+ var Ne = u.forwardRef((e, t) => {
47
98
  const { children: n, ...o } = e;
48
- if (s.isValidElement(n)) {
49
- const r = Dt(n), i = St(o, n.props);
50
- return n.type !== s.Fragment && (i.ref = t ? Pe(t, r) : r), s.cloneElement(n, i);
99
+ if (u.isValidElement(n)) {
100
+ const r = bn(n), i = xn(o, n.props);
101
+ return n.type !== u.Fragment && (i.ref = t ? wt(t, r) : r), u.cloneElement(n, i);
51
102
  }
52
- return s.Children.count(n) > 1 ? s.Children.only(null) : null;
103
+ return u.Children.count(n) > 1 ? u.Children.only(null) : null;
53
104
  });
54
- G.displayName = "SlotClone";
55
- var xe = ({ children: e }) => /* @__PURE__ */ f(F, { children: e });
56
- function Nt(e) {
57
- return s.isValidElement(e) && e.type === xe;
105
+ Ne.displayName = "SlotClone";
106
+ var bt = ({ children: e }) => /* @__PURE__ */ A(gt, { children: e });
107
+ function vn(e) {
108
+ return u.isValidElement(e) && e.type === bt;
58
109
  }
59
- function St(e, t) {
110
+ function xn(e, t) {
60
111
  const n = { ...t };
61
112
  for (const o in t) {
62
113
  const r = e[o], i = t[o];
@@ -66,12 +117,12 @@ function St(e, t) {
66
117
  }
67
118
  return { ...e, ...n };
68
119
  }
69
- function Dt(e) {
120
+ function bn(e) {
70
121
  var o, r;
71
122
  let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
72
123
  return n ? e.ref : (t = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
73
124
  }
74
- var _t = [
125
+ var Cn = [
75
126
  "a",
76
127
  "button",
77
128
  "div",
@@ -88,115 +139,133 @@ var _t = [
88
139
  "span",
89
140
  "svg",
90
141
  "ul"
91
- ], ee = _t.reduce((e, t) => {
92
- const n = s.forwardRef((o, r) => {
93
- const { asChild: i, ...a } = o, c = i ? be : t;
94
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ f(c, { ...a, ref: r });
142
+ ], Ie = Cn.reduce((e, t) => {
143
+ const n = u.forwardRef((o, r) => {
144
+ const { asChild: i, ...s } = o, c = i ? xt : t;
145
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ A(c, { ...s, ref: r });
95
146
  });
96
147
  return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
97
148
  }, {});
98
- function Lt(e, t) {
149
+ function En(e, t) {
99
150
  e && yt.flushSync(() => e.dispatchEvent(t));
100
151
  }
101
- var $t = "DismissableLayer", X = "dismissableLayer.update", Mt = "dismissableLayer.pointerDownOutside", It = "dismissableLayer.focusOutside", he, Re = s.createContext({
152
+ function oe(e) {
153
+ const t = u.useRef(e);
154
+ return u.useEffect(() => {
155
+ t.current = e;
156
+ }), u.useMemo(() => (...n) => {
157
+ var o;
158
+ return (o = t.current) == null ? void 0 : o.call(t, ...n);
159
+ }, []);
160
+ }
161
+ function An(e, t = globalThis == null ? void 0 : globalThis.document) {
162
+ const n = oe(e);
163
+ u.useEffect(() => {
164
+ const o = (r) => {
165
+ r.key === "Escape" && n(r);
166
+ };
167
+ return t.addEventListener("keydown", o, { capture: !0 }), () => t.removeEventListener("keydown", o, { capture: !0 });
168
+ }, [n, t]);
169
+ }
170
+ var Pn = "DismissableLayer", Le = "dismissableLayer.update", Rn = "dismissableLayer.pointerDownOutside", On = "dismissableLayer.focusOutside", rt, Ct = u.createContext({
102
171
  layers: /* @__PURE__ */ new Set(),
103
172
  layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
104
173
  branches: /* @__PURE__ */ new Set()
105
- }), Ae = s.forwardRef(
174
+ }), Et = u.forwardRef(
106
175
  (e, t) => {
107
176
  const {
108
177
  disableOutsidePointerEvents: n = !1,
109
178
  onEscapeKeyDown: o,
110
179
  onPointerDownOutside: r,
111
180
  onFocusOutside: i,
112
- onInteractOutside: a,
181
+ onInteractOutside: s,
113
182
  onDismiss: c,
114
183
  ...l
115
- } = e, u = s.useContext(Re), [d, m] = s.useState(null), h = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, p] = s.useState({}), v = _(t, (g) => m(g)), y = Array.from(u.layers), [w] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), E = y.indexOf(w), C = d ? y.indexOf(d) : -1, x = u.layersWithOutsidePointerEventsDisabled.size > 0, P = C >= E, R = Ht((g) => {
116
- const T = g.target, L = [...u.branches].some((S) => S.contains(T));
117
- !P || L || (r == null || r(g), a == null || a(g), g.defaultPrevented || c == null || c());
118
- }, h), b = Ft((g) => {
119
- const T = g.target;
120
- [...u.branches].some((S) => S.contains(T)) || (i == null || i(g), a == null || a(g), g.defaultPrevented || c == null || c());
184
+ } = e, a = u.useContext(Ct), [f, d] = u.useState(null), h = (f == null ? void 0 : f.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, p] = u.useState({}), m = ae(t, (b) => d(b)), g = Array.from(a.layers), [y] = [...a.layersWithOutsidePointerEventsDisabled].slice(-1), w = g.indexOf(y), v = f ? g.indexOf(f) : -1, E = a.layersWithOutsidePointerEventsDisabled.size > 0, x = v >= w, C = Dn((b) => {
185
+ const O = b.target, M = [...a.branches].some((T) => T.contains(O));
186
+ !x || M || (r == null || r(b), s == null || s(b), b.defaultPrevented || c == null || c());
187
+ }, h), P = Nn((b) => {
188
+ const O = b.target;
189
+ [...a.branches].some((T) => T.contains(O)) || (i == null || i(b), s == null || s(b), b.defaultPrevented || c == null || c());
121
190
  }, h);
122
- return gt((g) => {
123
- C === u.layers.size - 1 && (o == null || o(g), !g.defaultPrevented && c && (g.preventDefault(), c()));
124
- }, h), s.useEffect(() => {
125
- if (d)
126
- return n && (u.layersWithOutsidePointerEventsDisabled.size === 0 && (he = h.body.style.pointerEvents, h.body.style.pointerEvents = "none"), u.layersWithOutsidePointerEventsDisabled.add(d)), u.layers.add(d), ve(), () => {
127
- n && u.layersWithOutsidePointerEventsDisabled.size === 1 && (h.body.style.pointerEvents = he);
191
+ return An((b) => {
192
+ v === a.layers.size - 1 && (o == null || o(b), !b.defaultPrevented && c && (b.preventDefault(), c()));
193
+ }, h), u.useEffect(() => {
194
+ if (f)
195
+ return n && (a.layersWithOutsidePointerEventsDisabled.size === 0 && (rt = h.body.style.pointerEvents, h.body.style.pointerEvents = "none"), a.layersWithOutsidePointerEventsDisabled.add(f)), a.layers.add(f), it(), () => {
196
+ n && a.layersWithOutsidePointerEventsDisabled.size === 1 && (h.body.style.pointerEvents = rt);
128
197
  };
129
- }, [d, h, n, u]), s.useEffect(() => () => {
130
- d && (u.layers.delete(d), u.layersWithOutsidePointerEventsDisabled.delete(d), ve());
131
- }, [d, u]), s.useEffect(() => {
132
- const g = () => p({});
133
- return document.addEventListener(X, g), () => document.removeEventListener(X, g);
134
- }, []), /* @__PURE__ */ f(
135
- ee.div,
198
+ }, [f, h, n, a]), u.useEffect(() => () => {
199
+ f && (a.layers.delete(f), a.layersWithOutsidePointerEventsDisabled.delete(f), it());
200
+ }, [f, a]), u.useEffect(() => {
201
+ const b = () => p({});
202
+ return document.addEventListener(Le, b), () => document.removeEventListener(Le, b);
203
+ }, []), /* @__PURE__ */ A(
204
+ Ie.div,
136
205
  {
137
206
  ...l,
138
- ref: v,
207
+ ref: m,
139
208
  style: {
140
- pointerEvents: x ? P ? "auto" : "none" : void 0,
209
+ pointerEvents: E ? x ? "auto" : "none" : void 0,
141
210
  ...e.style
142
211
  },
143
- onFocusCapture: A(e.onFocusCapture, b.onFocusCapture),
144
- onBlurCapture: A(e.onBlurCapture, b.onBlurCapture),
145
- onPointerDownCapture: A(
212
+ onFocusCapture: Y(e.onFocusCapture, P.onFocusCapture),
213
+ onBlurCapture: Y(e.onBlurCapture, P.onBlurCapture),
214
+ onPointerDownCapture: Y(
146
215
  e.onPointerDownCapture,
147
- R.onPointerDownCapture
216
+ C.onPointerDownCapture
148
217
  )
149
218
  }
150
219
  );
151
220
  }
152
221
  );
153
- Ae.displayName = $t;
154
- var Wt = "DismissableLayerBranch", kt = s.forwardRef((e, t) => {
155
- const n = s.useContext(Re), o = s.useRef(null), r = _(t, o);
156
- return s.useEffect(() => {
222
+ Et.displayName = Pn;
223
+ var Tn = "DismissableLayerBranch", Sn = u.forwardRef((e, t) => {
224
+ const n = u.useContext(Ct), o = u.useRef(null), r = ae(t, o);
225
+ return u.useEffect(() => {
157
226
  const i = o.current;
158
227
  if (i)
159
228
  return n.branches.add(i), () => {
160
229
  n.branches.delete(i);
161
230
  };
162
- }, [n.branches]), /* @__PURE__ */ f(ee.div, { ...e, ref: r });
231
+ }, [n.branches]), /* @__PURE__ */ A(Ie.div, { ...e, ref: r });
163
232
  });
164
- kt.displayName = Wt;
165
- function Ht(e, t = globalThis == null ? void 0 : globalThis.document) {
166
- const n = Q(e), o = s.useRef(!1), r = s.useRef(() => {
233
+ Sn.displayName = Tn;
234
+ function Dn(e, t = globalThis == null ? void 0 : globalThis.document) {
235
+ const n = oe(e), o = u.useRef(!1), r = u.useRef(() => {
167
236
  });
168
- return s.useEffect(() => {
237
+ return u.useEffect(() => {
169
238
  const i = (c) => {
170
239
  if (c.target && !o.current) {
171
240
  let l = function() {
172
- Te(
173
- Mt,
241
+ At(
242
+ Rn,
174
243
  n,
175
- u,
244
+ a,
176
245
  { discrete: !0 }
177
246
  );
178
247
  };
179
- const u = { originalEvent: c };
248
+ const a = { originalEvent: c };
180
249
  c.pointerType === "touch" ? (t.removeEventListener("click", r.current), r.current = l, t.addEventListener("click", r.current, { once: !0 })) : l();
181
250
  } else
182
251
  t.removeEventListener("click", r.current);
183
252
  o.current = !1;
184
- }, a = window.setTimeout(() => {
253
+ }, s = window.setTimeout(() => {
185
254
  t.addEventListener("pointerdown", i);
186
255
  }, 0);
187
256
  return () => {
188
- window.clearTimeout(a), t.removeEventListener("pointerdown", i), t.removeEventListener("click", r.current);
257
+ window.clearTimeout(s), t.removeEventListener("pointerdown", i), t.removeEventListener("click", r.current);
189
258
  };
190
259
  }, [t, n]), {
191
260
  // ensures we check React component tree (not just DOM tree)
192
261
  onPointerDownCapture: () => o.current = !0
193
262
  };
194
263
  }
195
- function Ft(e, t = globalThis == null ? void 0 : globalThis.document) {
196
- const n = Q(e), o = s.useRef(!1);
197
- return s.useEffect(() => {
264
+ function Nn(e, t = globalThis == null ? void 0 : globalThis.document) {
265
+ const n = oe(e), o = u.useRef(!1);
266
+ return u.useEffect(() => {
198
267
  const r = (i) => {
199
- i.target && !o.current && Te(It, n, { originalEvent: i }, {
268
+ i.target && !o.current && At(On, n, { originalEvent: i }, {
200
269
  discrete: !1
201
270
  });
202
271
  };
@@ -206,159 +275,1366 @@ function Ft(e, t = globalThis == null ? void 0 : globalThis.document) {
206
275
  onBlurCapture: () => o.current = !1
207
276
  };
208
277
  }
209
- function ve() {
210
- const e = new CustomEvent(X);
278
+ function it() {
279
+ const e = new CustomEvent(Le);
211
280
  document.dispatchEvent(e);
212
281
  }
213
- function Te(e, t, n, { discrete: o }) {
282
+ function At(e, t, n, { discrete: o }) {
214
283
  const r = n.originalEvent.target, i = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
215
- t && r.addEventListener(e, t, { once: !0 }), o ? Lt(r, i) : r.dispatchEvent(i);
284
+ t && r.addEventListener(e, t, { once: !0 }), o ? En(r, i) : r.dispatchEvent(i);
216
285
  }
217
- function ye(e, t) {
218
- if (typeof e == "function")
219
- return e(t);
220
- e != null && (e.current = t);
286
+ var ee = globalThis != null && globalThis.document ? u.useLayoutEffect : () => {
287
+ }, Ln = u["useId".toString()] || (() => {
288
+ }), Mn = 0;
289
+ function _n(e) {
290
+ const [t, n] = u.useState(Ln());
291
+ return ee(() => {
292
+ e || n((o) => o ?? String(Mn++));
293
+ }, [e]), e || (t ? `radix-${t}` : "");
221
294
  }
222
- function Vt(...e) {
223
- return (t) => {
224
- let n = !1;
225
- const o = e.map((r) => {
226
- const i = ye(r, t);
227
- return !n && typeof i == "function" && (n = !0), i;
295
+ const kn = ["top", "right", "bottom", "left"], q = Math.min, W = Math.max, ge = Math.round, pe = Math.floor, z = (e) => ({
296
+ x: e,
297
+ y: e
298
+ }), $n = {
299
+ left: "right",
300
+ right: "left",
301
+ bottom: "top",
302
+ top: "bottom"
303
+ }, Wn = {
304
+ start: "end",
305
+ end: "start"
306
+ };
307
+ function Me(e, t, n) {
308
+ return W(e, q(t, n));
309
+ }
310
+ function X(e, t) {
311
+ return typeof e == "function" ? e(t) : e;
312
+ }
313
+ function G(e) {
314
+ return e.split("-")[0];
315
+ }
316
+ function re(e) {
317
+ return e.split("-")[1];
318
+ }
319
+ function He(e) {
320
+ return e === "x" ? "y" : "x";
321
+ }
322
+ function Be(e) {
323
+ return e === "y" ? "height" : "width";
324
+ }
325
+ function K(e) {
326
+ return ["top", "bottom"].includes(G(e)) ? "y" : "x";
327
+ }
328
+ function Ve(e) {
329
+ return He(K(e));
330
+ }
331
+ function Fn(e, t, n) {
332
+ n === void 0 && (n = !1);
333
+ const o = re(e), r = Ve(e), i = Be(r);
334
+ let s = r === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
335
+ return t.reference[i] > t.floating[i] && (s = ye(s)), [s, ye(s)];
336
+ }
337
+ function In(e) {
338
+ const t = ye(e);
339
+ return [_e(e), t, _e(t)];
340
+ }
341
+ function _e(e) {
342
+ return e.replace(/start|end/g, (t) => Wn[t]);
343
+ }
344
+ function Hn(e, t, n) {
345
+ const o = ["left", "right"], r = ["right", "left"], i = ["top", "bottom"], s = ["bottom", "top"];
346
+ switch (e) {
347
+ case "top":
348
+ case "bottom":
349
+ return n ? t ? r : o : t ? o : r;
350
+ case "left":
351
+ case "right":
352
+ return t ? i : s;
353
+ default:
354
+ return [];
355
+ }
356
+ }
357
+ function Bn(e, t, n, o) {
358
+ const r = re(e);
359
+ let i = Hn(G(e), n === "start", o);
360
+ return r && (i = i.map((s) => s + "-" + r), t && (i = i.concat(i.map(_e)))), i;
361
+ }
362
+ function ye(e) {
363
+ return e.replace(/left|right|bottom|top/g, (t) => $n[t]);
364
+ }
365
+ function Vn(e) {
366
+ return {
367
+ top: 0,
368
+ right: 0,
369
+ bottom: 0,
370
+ left: 0,
371
+ ...e
372
+ };
373
+ }
374
+ function Pt(e) {
375
+ return typeof e != "number" ? Vn(e) : {
376
+ top: e,
377
+ right: e,
378
+ bottom: e,
379
+ left: e
380
+ };
381
+ }
382
+ function we(e) {
383
+ const {
384
+ x: t,
385
+ y: n,
386
+ width: o,
387
+ height: r
388
+ } = e;
389
+ return {
390
+ width: o,
391
+ height: r,
392
+ top: n,
393
+ left: t,
394
+ right: t + o,
395
+ bottom: n + r,
396
+ x: t,
397
+ y: n
398
+ };
399
+ }
400
+ function st(e, t, n) {
401
+ let {
402
+ reference: o,
403
+ floating: r
404
+ } = e;
405
+ const i = K(t), s = Ve(t), c = Be(s), l = G(t), a = i === "y", f = o.x + o.width / 2 - r.width / 2, d = o.y + o.height / 2 - r.height / 2, h = o[c] / 2 - r[c] / 2;
406
+ let p;
407
+ switch (l) {
408
+ case "top":
409
+ p = {
410
+ x: f,
411
+ y: o.y - r.height
412
+ };
413
+ break;
414
+ case "bottom":
415
+ p = {
416
+ x: f,
417
+ y: o.y + o.height
418
+ };
419
+ break;
420
+ case "right":
421
+ p = {
422
+ x: o.x + o.width,
423
+ y: d
424
+ };
425
+ break;
426
+ case "left":
427
+ p = {
428
+ x: o.x - r.width,
429
+ y: d
430
+ };
431
+ break;
432
+ default:
433
+ p = {
434
+ x: o.x,
435
+ y: o.y
436
+ };
437
+ }
438
+ switch (re(t)) {
439
+ case "start":
440
+ p[s] -= h * (n && a ? -1 : 1);
441
+ break;
442
+ case "end":
443
+ p[s] += h * (n && a ? -1 : 1);
444
+ break;
445
+ }
446
+ return p;
447
+ }
448
+ const zn = async (e, t, n) => {
449
+ const {
450
+ placement: o = "bottom",
451
+ strategy: r = "absolute",
452
+ middleware: i = [],
453
+ platform: s
454
+ } = n, c = i.filter(Boolean), l = await (s.isRTL == null ? void 0 : s.isRTL(t));
455
+ let a = await s.getElementRects({
456
+ reference: e,
457
+ floating: t,
458
+ strategy: r
459
+ }), {
460
+ x: f,
461
+ y: d
462
+ } = st(a, o, l), h = o, p = {}, m = 0;
463
+ for (let g = 0; g < c.length; g++) {
464
+ const {
465
+ name: y,
466
+ fn: w
467
+ } = c[g], {
468
+ x: v,
469
+ y: E,
470
+ data: x,
471
+ reset: C
472
+ } = await w({
473
+ x: f,
474
+ y: d,
475
+ initialPlacement: o,
476
+ placement: h,
477
+ strategy: r,
478
+ middlewareData: p,
479
+ rects: a,
480
+ platform: s,
481
+ elements: {
482
+ reference: e,
483
+ floating: t
484
+ }
228
485
  });
229
- if (n)
230
- return () => {
231
- for (let r = 0; r < o.length; r++) {
232
- const i = o[r];
233
- typeof i == "function" ? i() : ye(e[r], null);
486
+ f = v ?? f, d = E ?? d, p = {
487
+ ...p,
488
+ [y]: {
489
+ ...p[y],
490
+ ...x
491
+ }
492
+ }, C && m <= 50 && (m++, typeof C == "object" && (C.placement && (h = C.placement), C.rects && (a = C.rects === !0 ? await s.getElementRects({
493
+ reference: e,
494
+ floating: t,
495
+ strategy: r
496
+ }) : C.rects), {
497
+ x: f,
498
+ y: d
499
+ } = st(a, h, l)), g = -1);
500
+ }
501
+ return {
502
+ x: f,
503
+ y: d,
504
+ placement: h,
505
+ strategy: r,
506
+ middlewareData: p
507
+ };
508
+ };
509
+ async function ce(e, t) {
510
+ var n;
511
+ t === void 0 && (t = {});
512
+ const {
513
+ x: o,
514
+ y: r,
515
+ platform: i,
516
+ rects: s,
517
+ elements: c,
518
+ strategy: l
519
+ } = e, {
520
+ boundary: a = "clippingAncestors",
521
+ rootBoundary: f = "viewport",
522
+ elementContext: d = "floating",
523
+ altBoundary: h = !1,
524
+ padding: p = 0
525
+ } = X(t, e), m = Pt(p), y = c[h ? d === "floating" ? "reference" : "floating" : d], w = we(await i.getClippingRect({
526
+ element: (n = await (i.isElement == null ? void 0 : i.isElement(y))) == null || n ? y : y.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(c.floating)),
527
+ boundary: a,
528
+ rootBoundary: f,
529
+ strategy: l
530
+ })), v = d === "floating" ? {
531
+ x: o,
532
+ y: r,
533
+ width: s.floating.width,
534
+ height: s.floating.height
535
+ } : s.reference, E = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(c.floating)), x = await (i.isElement == null ? void 0 : i.isElement(E)) ? await (i.getScale == null ? void 0 : i.getScale(E)) || {
536
+ x: 1,
537
+ y: 1
538
+ } : {
539
+ x: 1,
540
+ y: 1
541
+ }, C = we(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
542
+ elements: c,
543
+ rect: v,
544
+ offsetParent: E,
545
+ strategy: l
546
+ }) : v);
547
+ return {
548
+ top: (w.top - C.top + m.top) / x.y,
549
+ bottom: (C.bottom - w.bottom + m.bottom) / x.y,
550
+ left: (w.left - C.left + m.left) / x.x,
551
+ right: (C.right - w.right + m.right) / x.x
552
+ };
553
+ }
554
+ const jn = (e) => ({
555
+ name: "arrow",
556
+ options: e,
557
+ async fn(t) {
558
+ const {
559
+ x: n,
560
+ y: o,
561
+ placement: r,
562
+ rects: i,
563
+ platform: s,
564
+ elements: c,
565
+ middlewareData: l
566
+ } = t, {
567
+ element: a,
568
+ padding: f = 0
569
+ } = X(e, t) || {};
570
+ if (a == null)
571
+ return {};
572
+ const d = Pt(f), h = {
573
+ x: n,
574
+ y: o
575
+ }, p = Ve(r), m = Be(p), g = await s.getDimensions(a), y = p === "y", w = y ? "top" : "left", v = y ? "bottom" : "right", E = y ? "clientHeight" : "clientWidth", x = i.reference[m] + i.reference[p] - h[p] - i.floating[m], C = h[p] - i.reference[p], P = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a));
576
+ let b = P ? P[E] : 0;
577
+ (!b || !await (s.isElement == null ? void 0 : s.isElement(P))) && (b = c.floating[E] || i.floating[m]);
578
+ const O = x / 2 - C / 2, M = b / 2 - g[m] / 2 - 1, T = q(d[w], M), k = q(d[v], M), $ = T, D = b - g[m] - k, S = b / 2 - g[m] / 2 + O, I = Me($, S, D), N = !l.arrow && re(r) != null && S !== I && i.reference[m] / 2 - (S < $ ? T : k) - g[m] / 2 < 0, L = N ? S < $ ? S - $ : S - D : 0;
579
+ return {
580
+ [p]: h[p] + L,
581
+ data: {
582
+ [p]: I,
583
+ centerOffset: S - I - L,
584
+ ...N && {
585
+ alignmentOffset: L
586
+ }
587
+ },
588
+ reset: N
589
+ };
590
+ }
591
+ }), Un = function(e) {
592
+ return e === void 0 && (e = {}), {
593
+ name: "flip",
594
+ options: e,
595
+ async fn(t) {
596
+ var n, o;
597
+ const {
598
+ placement: r,
599
+ middlewareData: i,
600
+ rects: s,
601
+ initialPlacement: c,
602
+ platform: l,
603
+ elements: a
604
+ } = t, {
605
+ mainAxis: f = !0,
606
+ crossAxis: d = !0,
607
+ fallbackPlacements: h,
608
+ fallbackStrategy: p = "bestFit",
609
+ fallbackAxisSideDirection: m = "none",
610
+ flipAlignment: g = !0,
611
+ ...y
612
+ } = X(e, t);
613
+ if ((n = i.arrow) != null && n.alignmentOffset)
614
+ return {};
615
+ const w = G(r), v = K(c), E = G(c) === c, x = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), C = h || (E || !g ? [ye(c)] : In(c)), P = m !== "none";
616
+ !h && P && C.push(...Bn(c, g, m, x));
617
+ const b = [c, ...C], O = await ce(t, y), M = [];
618
+ let T = ((o = i.flip) == null ? void 0 : o.overflows) || [];
619
+ if (f && M.push(O[w]), d) {
620
+ const S = Fn(r, s, x);
621
+ M.push(O[S[0]], O[S[1]]);
622
+ }
623
+ if (T = [...T, {
624
+ placement: r,
625
+ overflows: M
626
+ }], !M.every((S) => S <= 0)) {
627
+ var k, $;
628
+ const S = (((k = i.flip) == null ? void 0 : k.index) || 0) + 1, I = b[S];
629
+ if (I)
630
+ return {
631
+ data: {
632
+ index: S,
633
+ overflows: T
634
+ },
635
+ reset: {
636
+ placement: I
637
+ }
638
+ };
639
+ let N = ($ = T.filter((L) => L.overflows[0] <= 0).sort((L, R) => L.overflows[1] - R.overflows[1])[0]) == null ? void 0 : $.placement;
640
+ if (!N)
641
+ switch (p) {
642
+ case "bestFit": {
643
+ var D;
644
+ const L = (D = T.filter((R) => {
645
+ if (P) {
646
+ const _ = K(R.placement);
647
+ return _ === v || // Create a bias to the `y` side axis due to horizontal
648
+ // reading directions favoring greater width.
649
+ _ === "y";
650
+ }
651
+ return !0;
652
+ }).map((R) => [R.placement, R.overflows.filter((_) => _ > 0).reduce((_, V) => _ + V, 0)]).sort((R, _) => R[1] - _[1])[0]) == null ? void 0 : D[0];
653
+ L && (N = L);
654
+ break;
655
+ }
656
+ case "initialPlacement":
657
+ N = c;
658
+ break;
659
+ }
660
+ if (r !== N)
661
+ return {
662
+ reset: {
663
+ placement: N
664
+ }
665
+ };
666
+ }
667
+ return {};
668
+ }
669
+ };
670
+ };
671
+ function ct(e, t) {
672
+ return {
673
+ top: e.top - t.height,
674
+ right: e.right - t.width,
675
+ bottom: e.bottom - t.height,
676
+ left: e.left - t.width
677
+ };
678
+ }
679
+ function lt(e) {
680
+ return kn.some((t) => e[t] >= 0);
681
+ }
682
+ const Yn = function(e) {
683
+ return e === void 0 && (e = {}), {
684
+ name: "hide",
685
+ options: e,
686
+ async fn(t) {
687
+ const {
688
+ rects: n
689
+ } = t, {
690
+ strategy: o = "referenceHidden",
691
+ ...r
692
+ } = X(e, t);
693
+ switch (o) {
694
+ case "referenceHidden": {
695
+ const i = await ce(t, {
696
+ ...r,
697
+ elementContext: "reference"
698
+ }), s = ct(i, n.reference);
699
+ return {
700
+ data: {
701
+ referenceHiddenOffsets: s,
702
+ referenceHidden: lt(s)
703
+ }
704
+ };
705
+ }
706
+ case "escaped": {
707
+ const i = await ce(t, {
708
+ ...r,
709
+ altBoundary: !0
710
+ }), s = ct(i, n.floating);
711
+ return {
712
+ data: {
713
+ escapedOffsets: s,
714
+ escaped: lt(s)
715
+ }
716
+ };
717
+ }
718
+ default:
719
+ return {};
720
+ }
721
+ }
722
+ };
723
+ };
724
+ async function Xn(e, t) {
725
+ const {
726
+ placement: n,
727
+ platform: o,
728
+ elements: r
729
+ } = e, i = await (o.isRTL == null ? void 0 : o.isRTL(r.floating)), s = G(n), c = re(n), l = K(n) === "y", a = ["left", "top"].includes(s) ? -1 : 1, f = i && l ? -1 : 1, d = X(t, e);
730
+ let {
731
+ mainAxis: h,
732
+ crossAxis: p,
733
+ alignmentAxis: m
734
+ } = typeof d == "number" ? {
735
+ mainAxis: d,
736
+ crossAxis: 0,
737
+ alignmentAxis: null
738
+ } : {
739
+ mainAxis: d.mainAxis || 0,
740
+ crossAxis: d.crossAxis || 0,
741
+ alignmentAxis: d.alignmentAxis
742
+ };
743
+ return c && typeof m == "number" && (p = c === "end" ? m * -1 : m), l ? {
744
+ x: p * f,
745
+ y: h * a
746
+ } : {
747
+ x: h * a,
748
+ y: p * f
749
+ };
750
+ }
751
+ const Gn = function(e) {
752
+ return e === void 0 && (e = 0), {
753
+ name: "offset",
754
+ options: e,
755
+ async fn(t) {
756
+ var n, o;
757
+ const {
758
+ x: r,
759
+ y: i,
760
+ placement: s,
761
+ middlewareData: c
762
+ } = t, l = await Xn(t, e);
763
+ return s === ((n = c.offset) == null ? void 0 : n.placement) && (o = c.arrow) != null && o.alignmentOffset ? {} : {
764
+ x: r + l.x,
765
+ y: i + l.y,
766
+ data: {
767
+ ...l,
768
+ placement: s
234
769
  }
235
770
  };
771
+ }
772
+ };
773
+ }, qn = function(e) {
774
+ return e === void 0 && (e = {}), {
775
+ name: "shift",
776
+ options: e,
777
+ async fn(t) {
778
+ const {
779
+ x: n,
780
+ y: o,
781
+ placement: r
782
+ } = t, {
783
+ mainAxis: i = !0,
784
+ crossAxis: s = !1,
785
+ limiter: c = {
786
+ fn: (y) => {
787
+ let {
788
+ x: w,
789
+ y: v
790
+ } = y;
791
+ return {
792
+ x: w,
793
+ y: v
794
+ };
795
+ }
796
+ },
797
+ ...l
798
+ } = X(e, t), a = {
799
+ x: n,
800
+ y: o
801
+ }, f = await ce(t, l), d = K(G(r)), h = He(d);
802
+ let p = a[h], m = a[d];
803
+ if (i) {
804
+ const y = h === "y" ? "top" : "left", w = h === "y" ? "bottom" : "right", v = p + f[y], E = p - f[w];
805
+ p = Me(v, p, E);
806
+ }
807
+ if (s) {
808
+ const y = d === "y" ? "top" : "left", w = d === "y" ? "bottom" : "right", v = m + f[y], E = m - f[w];
809
+ m = Me(v, m, E);
810
+ }
811
+ const g = c.fn({
812
+ ...t,
813
+ [h]: p,
814
+ [d]: m
815
+ });
816
+ return {
817
+ ...g,
818
+ data: {
819
+ x: g.x - n,
820
+ y: g.y - o,
821
+ enabled: {
822
+ [h]: i,
823
+ [d]: s
824
+ }
825
+ }
826
+ };
827
+ }
828
+ };
829
+ }, Kn = function(e) {
830
+ return e === void 0 && (e = {}), {
831
+ options: e,
832
+ fn(t) {
833
+ const {
834
+ x: n,
835
+ y: o,
836
+ placement: r,
837
+ rects: i,
838
+ middlewareData: s
839
+ } = t, {
840
+ offset: c = 0,
841
+ mainAxis: l = !0,
842
+ crossAxis: a = !0
843
+ } = X(e, t), f = {
844
+ x: n,
845
+ y: o
846
+ }, d = K(r), h = He(d);
847
+ let p = f[h], m = f[d];
848
+ const g = X(c, t), y = typeof g == "number" ? {
849
+ mainAxis: g,
850
+ crossAxis: 0
851
+ } : {
852
+ mainAxis: 0,
853
+ crossAxis: 0,
854
+ ...g
855
+ };
856
+ if (l) {
857
+ const E = h === "y" ? "height" : "width", x = i.reference[h] - i.floating[E] + y.mainAxis, C = i.reference[h] + i.reference[E] - y.mainAxis;
858
+ p < x ? p = x : p > C && (p = C);
859
+ }
860
+ if (a) {
861
+ var w, v;
862
+ const E = h === "y" ? "width" : "height", x = ["top", "left"].includes(G(r)), C = i.reference[d] - i.floating[E] + (x && ((w = s.offset) == null ? void 0 : w[d]) || 0) + (x ? 0 : y.crossAxis), P = i.reference[d] + i.reference[E] + (x ? 0 : ((v = s.offset) == null ? void 0 : v[d]) || 0) - (x ? y.crossAxis : 0);
863
+ m < C ? m = C : m > P && (m = P);
864
+ }
865
+ return {
866
+ [h]: p,
867
+ [d]: m
868
+ };
869
+ }
236
870
  };
871
+ }, Zn = function(e) {
872
+ return e === void 0 && (e = {}), {
873
+ name: "size",
874
+ options: e,
875
+ async fn(t) {
876
+ var n, o;
877
+ const {
878
+ placement: r,
879
+ rects: i,
880
+ platform: s,
881
+ elements: c
882
+ } = t, {
883
+ apply: l = () => {
884
+ },
885
+ ...a
886
+ } = X(e, t), f = await ce(t, a), d = G(r), h = re(r), p = K(r) === "y", {
887
+ width: m,
888
+ height: g
889
+ } = i.floating;
890
+ let y, w;
891
+ d === "top" || d === "bottom" ? (y = d, w = h === (await (s.isRTL == null ? void 0 : s.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (w = d, y = h === "end" ? "top" : "bottom");
892
+ const v = g - f.top - f.bottom, E = m - f.left - f.right, x = q(g - f[y], v), C = q(m - f[w], E), P = !t.middlewareData.shift;
893
+ let b = x, O = C;
894
+ if ((n = t.middlewareData.shift) != null && n.enabled.x && (O = E), (o = t.middlewareData.shift) != null && o.enabled.y && (b = v), P && !h) {
895
+ const T = W(f.left, 0), k = W(f.right, 0), $ = W(f.top, 0), D = W(f.bottom, 0);
896
+ p ? O = m - 2 * (T !== 0 || k !== 0 ? T + k : W(f.left, f.right)) : b = g - 2 * ($ !== 0 || D !== 0 ? $ + D : W(f.top, f.bottom));
897
+ }
898
+ await l({
899
+ ...t,
900
+ availableWidth: O,
901
+ availableHeight: b
902
+ });
903
+ const M = await s.getDimensions(c.floating);
904
+ return m !== M.width || g !== M.height ? {
905
+ reset: {
906
+ rects: !0
907
+ }
908
+ } : {};
909
+ }
910
+ };
911
+ };
912
+ function xe() {
913
+ return typeof window < "u";
914
+ }
915
+ function ie(e) {
916
+ return Rt(e) ? (e.nodeName || "").toLowerCase() : "#document";
917
+ }
918
+ function F(e) {
919
+ var t;
920
+ return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
921
+ }
922
+ function U(e) {
923
+ var t;
924
+ return (t = (Rt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
925
+ }
926
+ function Rt(e) {
927
+ return xe() ? e instanceof Node || e instanceof F(e).Node : !1;
928
+ }
929
+ function H(e) {
930
+ return xe() ? e instanceof Element || e instanceof F(e).Element : !1;
931
+ }
932
+ function j(e) {
933
+ return xe() ? e instanceof HTMLElement || e instanceof F(e).HTMLElement : !1;
934
+ }
935
+ function at(e) {
936
+ return !xe() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof F(e).ShadowRoot;
937
+ }
938
+ function ue(e) {
939
+ const {
940
+ overflow: t,
941
+ overflowX: n,
942
+ overflowY: o,
943
+ display: r
944
+ } = B(e);
945
+ return /auto|scroll|overlay|hidden|clip/.test(t + o + n) && !["inline", "contents"].includes(r);
946
+ }
947
+ function Jn(e) {
948
+ return ["table", "td", "th"].includes(ie(e));
949
+ }
950
+ function be(e) {
951
+ return [":popover-open", ":modal"].some((t) => {
952
+ try {
953
+ return e.matches(t);
954
+ } catch {
955
+ return !1;
956
+ }
957
+ });
958
+ }
959
+ function ze(e) {
960
+ const t = je(), n = H(e) ? B(e) : e;
961
+ return ["transform", "translate", "scale", "rotate", "perspective"].some((o) => n[o] ? n[o] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((o) => (n.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (n.contain || "").includes(o));
962
+ }
963
+ function Qn(e) {
964
+ let t = Z(e);
965
+ for (; j(t) && !te(t); ) {
966
+ if (ze(t))
967
+ return t;
968
+ if (be(t))
969
+ return null;
970
+ t = Z(t);
971
+ }
972
+ return null;
237
973
  }
238
- var Oe = s.forwardRef((e, t) => {
239
- const { children: n, ...o } = e, r = s.Children.toArray(n), i = r.find(Ut);
974
+ function je() {
975
+ return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
976
+ }
977
+ function te(e) {
978
+ return ["html", "body", "#document"].includes(ie(e));
979
+ }
980
+ function B(e) {
981
+ return F(e).getComputedStyle(e);
982
+ }
983
+ function Ce(e) {
984
+ return H(e) ? {
985
+ scrollLeft: e.scrollLeft,
986
+ scrollTop: e.scrollTop
987
+ } : {
988
+ scrollLeft: e.scrollX,
989
+ scrollTop: e.scrollY
990
+ };
991
+ }
992
+ function Z(e) {
993
+ if (ie(e) === "html")
994
+ return e;
995
+ const t = (
996
+ // Step into the shadow DOM of the parent of a slotted node.
997
+ e.assignedSlot || // DOM Element detected.
998
+ e.parentNode || // ShadowRoot detected.
999
+ at(e) && e.host || // Fallback.
1000
+ U(e)
1001
+ );
1002
+ return at(t) ? t.host : t;
1003
+ }
1004
+ function Ot(e) {
1005
+ const t = Z(e);
1006
+ return te(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : j(t) && ue(t) ? t : Ot(t);
1007
+ }
1008
+ function le(e, t, n) {
1009
+ var o;
1010
+ t === void 0 && (t = []), n === void 0 && (n = !0);
1011
+ const r = Ot(e), i = r === ((o = e.ownerDocument) == null ? void 0 : o.body), s = F(r);
240
1012
  if (i) {
241
- const a = i.props.children, c = r.map((l) => l === i ? s.Children.count(a) > 1 ? s.Children.only(null) : s.isValidElement(a) ? a.props.children : null : l);
242
- return /* @__PURE__ */ f(z, { ...o, ref: t, children: s.isValidElement(a) ? s.cloneElement(a, void 0, c) : null });
1013
+ const c = ke(s);
1014
+ return t.concat(s, s.visualViewport || [], ue(r) ? r : [], c && n ? le(c) : []);
243
1015
  }
244
- return /* @__PURE__ */ f(z, { ...o, ref: t, children: n });
245
- });
246
- Oe.displayName = "Slot";
247
- var z = s.forwardRef((e, t) => {
248
- const { children: n, ...o } = e;
249
- if (s.isValidElement(n)) {
250
- const r = Yt(n), i = jt(o, n.props);
251
- return n.type !== s.Fragment && (i.ref = t ? Vt(t, r) : r), s.cloneElement(n, i);
1016
+ return t.concat(r, le(r, [], n));
1017
+ }
1018
+ function ke(e) {
1019
+ return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
1020
+ }
1021
+ function Tt(e) {
1022
+ const t = B(e);
1023
+ let n = parseFloat(t.width) || 0, o = parseFloat(t.height) || 0;
1024
+ const r = j(e), i = r ? e.offsetWidth : n, s = r ? e.offsetHeight : o, c = ge(n) !== i || ge(o) !== s;
1025
+ return c && (n = i, o = s), {
1026
+ width: n,
1027
+ height: o,
1028
+ $: c
1029
+ };
1030
+ }
1031
+ function Ue(e) {
1032
+ return H(e) ? e : e.contextElement;
1033
+ }
1034
+ function Q(e) {
1035
+ const t = Ue(e);
1036
+ if (!j(t))
1037
+ return z(1);
1038
+ const n = t.getBoundingClientRect(), {
1039
+ width: o,
1040
+ height: r,
1041
+ $: i
1042
+ } = Tt(t);
1043
+ let s = (i ? ge(n.width) : n.width) / o, c = (i ? ge(n.height) : n.height) / r;
1044
+ return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {
1045
+ x: s,
1046
+ y: c
1047
+ };
1048
+ }
1049
+ const eo = /* @__PURE__ */ z(0);
1050
+ function St(e) {
1051
+ const t = F(e);
1052
+ return !je() || !t.visualViewport ? eo : {
1053
+ x: t.visualViewport.offsetLeft,
1054
+ y: t.visualViewport.offsetTop
1055
+ };
1056
+ }
1057
+ function to(e, t, n) {
1058
+ return t === void 0 && (t = !1), !n || t && n !== F(e) ? !1 : t;
1059
+ }
1060
+ function J(e, t, n, o) {
1061
+ t === void 0 && (t = !1), n === void 0 && (n = !1);
1062
+ const r = e.getBoundingClientRect(), i = Ue(e);
1063
+ let s = z(1);
1064
+ t && (o ? H(o) && (s = Q(o)) : s = Q(e));
1065
+ const c = to(i, n, o) ? St(i) : z(0);
1066
+ let l = (r.left + c.x) / s.x, a = (r.top + c.y) / s.y, f = r.width / s.x, d = r.height / s.y;
1067
+ if (i) {
1068
+ const h = F(i), p = o && H(o) ? F(o) : o;
1069
+ let m = h, g = ke(m);
1070
+ for (; g && o && p !== m; ) {
1071
+ const y = Q(g), w = g.getBoundingClientRect(), v = B(g), E = w.left + (g.clientLeft + parseFloat(v.paddingLeft)) * y.x, x = w.top + (g.clientTop + parseFloat(v.paddingTop)) * y.y;
1072
+ l *= y.x, a *= y.y, f *= y.x, d *= y.y, l += E, a += x, m = F(g), g = ke(m);
1073
+ }
252
1074
  }
253
- return s.Children.count(n) > 1 ? s.Children.only(null) : null;
254
- });
255
- z.displayName = "SlotClone";
256
- var Bt = ({ children: e }) => /* @__PURE__ */ f(F, { children: e });
257
- function Ut(e) {
258
- return s.isValidElement(e) && e.type === Bt;
1075
+ return we({
1076
+ width: f,
1077
+ height: d,
1078
+ x: l,
1079
+ y: a
1080
+ });
259
1081
  }
260
- function jt(e, t) {
261
- const n = { ...t };
262
- for (const o in t) {
263
- const r = e[o], i = t[o];
264
- /^on[A-Z]/.test(o) ? r && i ? n[o] = (...c) => {
265
- i(...c), r(...c);
266
- } : r && (n[o] = r) : o === "style" ? n[o] = { ...r, ...i } : o === "className" && (n[o] = [r, i].filter(Boolean).join(" "));
1082
+ function Ye(e, t) {
1083
+ const n = Ce(e).scrollLeft;
1084
+ return t ? t.left + n : J(U(e)).left + n;
1085
+ }
1086
+ function Dt(e, t, n) {
1087
+ n === void 0 && (n = !1);
1088
+ const o = e.getBoundingClientRect(), r = o.left + t.scrollLeft - (n ? 0 : (
1089
+ // RTL <body> scrollbar.
1090
+ Ye(e, o)
1091
+ )), i = o.top + t.scrollTop;
1092
+ return {
1093
+ x: r,
1094
+ y: i
1095
+ };
1096
+ }
1097
+ function no(e) {
1098
+ let {
1099
+ elements: t,
1100
+ rect: n,
1101
+ offsetParent: o,
1102
+ strategy: r
1103
+ } = e;
1104
+ const i = r === "fixed", s = U(o), c = t ? be(t.floating) : !1;
1105
+ if (o === s || c && i)
1106
+ return n;
1107
+ let l = {
1108
+ scrollLeft: 0,
1109
+ scrollTop: 0
1110
+ }, a = z(1);
1111
+ const f = z(0), d = j(o);
1112
+ if ((d || !d && !i) && ((ie(o) !== "body" || ue(s)) && (l = Ce(o)), j(o))) {
1113
+ const p = J(o);
1114
+ a = Q(o), f.x = p.x + o.clientLeft, f.y = p.y + o.clientTop;
267
1115
  }
268
- return { ...e, ...n };
1116
+ const h = s && !d && !i ? Dt(s, l, !0) : z(0);
1117
+ return {
1118
+ width: n.width * a.x,
1119
+ height: n.height * a.y,
1120
+ x: n.x * a.x - l.scrollLeft * a.x + f.x + h.x,
1121
+ y: n.y * a.y - l.scrollTop * a.y + f.y + h.y
1122
+ };
269
1123
  }
270
- function Yt(e) {
271
- var o, r;
272
- let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
273
- return n ? e.ref : (t = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
1124
+ function oo(e) {
1125
+ return Array.from(e.getClientRects());
274
1126
  }
275
- var Gt = [
276
- "a",
277
- "button",
278
- "div",
279
- "form",
280
- "h2",
281
- "h3",
282
- "img",
283
- "input",
284
- "label",
285
- "li",
286
- "nav",
287
- "ol",
288
- "p",
289
- "span",
290
- "svg",
291
- "ul"
292
- ], Xt = Gt.reduce((e, t) => {
293
- const n = s.forwardRef((o, r) => {
294
- const { asChild: i, ...a } = o, c = i ? Oe : t;
295
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ f(c, { ...a, ref: r });
1127
+ function ro(e) {
1128
+ const t = U(e), n = Ce(e), o = e.ownerDocument.body, r = W(t.scrollWidth, t.clientWidth, o.scrollWidth, o.clientWidth), i = W(t.scrollHeight, t.clientHeight, o.scrollHeight, o.clientHeight);
1129
+ let s = -n.scrollLeft + Ye(e);
1130
+ const c = -n.scrollTop;
1131
+ return B(o).direction === "rtl" && (s += W(t.clientWidth, o.clientWidth) - r), {
1132
+ width: r,
1133
+ height: i,
1134
+ x: s,
1135
+ y: c
1136
+ };
1137
+ }
1138
+ function io(e, t) {
1139
+ const n = F(e), o = U(e), r = n.visualViewport;
1140
+ let i = o.clientWidth, s = o.clientHeight, c = 0, l = 0;
1141
+ if (r) {
1142
+ i = r.width, s = r.height;
1143
+ const a = je();
1144
+ (!a || a && t === "fixed") && (c = r.offsetLeft, l = r.offsetTop);
1145
+ }
1146
+ return {
1147
+ width: i,
1148
+ height: s,
1149
+ x: c,
1150
+ y: l
1151
+ };
1152
+ }
1153
+ function so(e, t) {
1154
+ const n = J(e, !0, t === "fixed"), o = n.top + e.clientTop, r = n.left + e.clientLeft, i = j(e) ? Q(e) : z(1), s = e.clientWidth * i.x, c = e.clientHeight * i.y, l = r * i.x, a = o * i.y;
1155
+ return {
1156
+ width: s,
1157
+ height: c,
1158
+ x: l,
1159
+ y: a
1160
+ };
1161
+ }
1162
+ function ut(e, t, n) {
1163
+ let o;
1164
+ if (t === "viewport")
1165
+ o = io(e, n);
1166
+ else if (t === "document")
1167
+ o = ro(U(e));
1168
+ else if (H(t))
1169
+ o = so(t, n);
1170
+ else {
1171
+ const r = St(e);
1172
+ o = {
1173
+ x: t.x - r.x,
1174
+ y: t.y - r.y,
1175
+ width: t.width,
1176
+ height: t.height
1177
+ };
1178
+ }
1179
+ return we(o);
1180
+ }
1181
+ function Nt(e, t) {
1182
+ const n = Z(e);
1183
+ return n === t || !H(n) || te(n) ? !1 : B(n).position === "fixed" || Nt(n, t);
1184
+ }
1185
+ function co(e, t) {
1186
+ const n = t.get(e);
1187
+ if (n)
1188
+ return n;
1189
+ let o = le(e, [], !1).filter((c) => H(c) && ie(c) !== "body"), r = null;
1190
+ const i = B(e).position === "fixed";
1191
+ let s = i ? Z(e) : e;
1192
+ for (; H(s) && !te(s); ) {
1193
+ const c = B(s), l = ze(s);
1194
+ !l && c.position === "fixed" && (r = null), (i ? !l && !r : !l && c.position === "static" && !!r && ["absolute", "fixed"].includes(r.position) || ue(s) && !l && Nt(e, s)) ? o = o.filter((f) => f !== s) : r = c, s = Z(s);
1195
+ }
1196
+ return t.set(e, o), o;
1197
+ }
1198
+ function lo(e) {
1199
+ let {
1200
+ element: t,
1201
+ boundary: n,
1202
+ rootBoundary: o,
1203
+ strategy: r
1204
+ } = e;
1205
+ const s = [...n === "clippingAncestors" ? be(t) ? [] : co(t, this._c) : [].concat(n), o], c = s[0], l = s.reduce((a, f) => {
1206
+ const d = ut(t, f, r);
1207
+ return a.top = W(d.top, a.top), a.right = q(d.right, a.right), a.bottom = q(d.bottom, a.bottom), a.left = W(d.left, a.left), a;
1208
+ }, ut(t, c, r));
1209
+ return {
1210
+ width: l.right - l.left,
1211
+ height: l.bottom - l.top,
1212
+ x: l.left,
1213
+ y: l.top
1214
+ };
1215
+ }
1216
+ function ao(e) {
1217
+ const {
1218
+ width: t,
1219
+ height: n
1220
+ } = Tt(e);
1221
+ return {
1222
+ width: t,
1223
+ height: n
1224
+ };
1225
+ }
1226
+ function uo(e, t, n) {
1227
+ const o = j(t), r = U(t), i = n === "fixed", s = J(e, !0, i, t);
1228
+ let c = {
1229
+ scrollLeft: 0,
1230
+ scrollTop: 0
1231
+ };
1232
+ const l = z(0);
1233
+ if (o || !o && !i)
1234
+ if ((ie(t) !== "body" || ue(r)) && (c = Ce(t)), o) {
1235
+ const h = J(t, !0, i, t);
1236
+ l.x = h.x + t.clientLeft, l.y = h.y + t.clientTop;
1237
+ } else
1238
+ r && (l.x = Ye(r));
1239
+ const a = r && !o && !i ? Dt(r, c) : z(0), f = s.left + c.scrollLeft - l.x - a.x, d = s.top + c.scrollTop - l.y - a.y;
1240
+ return {
1241
+ x: f,
1242
+ y: d,
1243
+ width: s.width,
1244
+ height: s.height
1245
+ };
1246
+ }
1247
+ function Te(e) {
1248
+ return B(e).position === "static";
1249
+ }
1250
+ function ft(e, t) {
1251
+ if (!j(e) || B(e).position === "fixed")
1252
+ return null;
1253
+ if (t)
1254
+ return t(e);
1255
+ let n = e.offsetParent;
1256
+ return U(e) === n && (n = n.ownerDocument.body), n;
1257
+ }
1258
+ function Lt(e, t) {
1259
+ const n = F(e);
1260
+ if (be(e))
1261
+ return n;
1262
+ if (!j(e)) {
1263
+ let r = Z(e);
1264
+ for (; r && !te(r); ) {
1265
+ if (H(r) && !Te(r))
1266
+ return r;
1267
+ r = Z(r);
1268
+ }
1269
+ return n;
1270
+ }
1271
+ let o = ft(e, t);
1272
+ for (; o && Jn(o) && Te(o); )
1273
+ o = ft(o, t);
1274
+ return o && te(o) && Te(o) && !ze(o) ? n : o || Qn(e) || n;
1275
+ }
1276
+ const fo = async function(e) {
1277
+ const t = this.getOffsetParent || Lt, n = this.getDimensions, o = await n(e.floating);
1278
+ return {
1279
+ reference: uo(e.reference, await t(e.floating), e.strategy),
1280
+ floating: {
1281
+ x: 0,
1282
+ y: 0,
1283
+ width: o.width,
1284
+ height: o.height
1285
+ }
1286
+ };
1287
+ };
1288
+ function po(e) {
1289
+ return B(e).direction === "rtl";
1290
+ }
1291
+ const ho = {
1292
+ convertOffsetParentRelativeRectToViewportRelativeRect: no,
1293
+ getDocumentElement: U,
1294
+ getClippingRect: lo,
1295
+ getOffsetParent: Lt,
1296
+ getElementRects: fo,
1297
+ getClientRects: oo,
1298
+ getDimensions: ao,
1299
+ getScale: Q,
1300
+ isElement: H,
1301
+ isRTL: po
1302
+ };
1303
+ function Mt(e, t) {
1304
+ return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
1305
+ }
1306
+ function mo(e, t) {
1307
+ let n = null, o;
1308
+ const r = U(e);
1309
+ function i() {
1310
+ var c;
1311
+ clearTimeout(o), (c = n) == null || c.disconnect(), n = null;
1312
+ }
1313
+ function s(c, l) {
1314
+ c === void 0 && (c = !1), l === void 0 && (l = 1), i();
1315
+ const a = e.getBoundingClientRect(), {
1316
+ left: f,
1317
+ top: d,
1318
+ width: h,
1319
+ height: p
1320
+ } = a;
1321
+ if (c || t(), !h || !p)
1322
+ return;
1323
+ const m = pe(d), g = pe(r.clientWidth - (f + h)), y = pe(r.clientHeight - (d + p)), w = pe(f), E = {
1324
+ rootMargin: -m + "px " + -g + "px " + -y + "px " + -w + "px",
1325
+ threshold: W(0, q(1, l)) || 1
1326
+ };
1327
+ let x = !0;
1328
+ function C(P) {
1329
+ const b = P[0].intersectionRatio;
1330
+ if (b !== l) {
1331
+ if (!x)
1332
+ return s();
1333
+ b ? s(!1, b) : o = setTimeout(() => {
1334
+ s(!1, 1e-7);
1335
+ }, 1e3);
1336
+ }
1337
+ b === 1 && !Mt(a, e.getBoundingClientRect()) && s(), x = !1;
1338
+ }
1339
+ try {
1340
+ n = new IntersectionObserver(C, {
1341
+ ...E,
1342
+ // Handle <iframe>s
1343
+ root: r.ownerDocument
1344
+ });
1345
+ } catch {
1346
+ n = new IntersectionObserver(C, E);
1347
+ }
1348
+ n.observe(e);
1349
+ }
1350
+ return s(!0), i;
1351
+ }
1352
+ function go(e, t, n, o) {
1353
+ o === void 0 && (o = {});
1354
+ const {
1355
+ ancestorScroll: r = !0,
1356
+ ancestorResize: i = !0,
1357
+ elementResize: s = typeof ResizeObserver == "function",
1358
+ layoutShift: c = typeof IntersectionObserver == "function",
1359
+ animationFrame: l = !1
1360
+ } = o, a = Ue(e), f = r || i ? [...a ? le(a) : [], ...le(t)] : [];
1361
+ f.forEach((w) => {
1362
+ r && w.addEventListener("scroll", n, {
1363
+ passive: !0
1364
+ }), i && w.addEventListener("resize", n);
296
1365
  });
297
- return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
298
- }, {}), zt = "Arrow", Ne = s.forwardRef((e, t) => {
299
- const { children: n, width: o = 10, height: r = 5, ...i } = e;
300
- return /* @__PURE__ */ f(
301
- Xt.svg,
302
- {
303
- ...i,
304
- ref: t,
305
- width: o,
306
- height: r,
307
- viewBox: "0 0 30 10",
308
- preserveAspectRatio: "none",
309
- children: e.asChild ? n : /* @__PURE__ */ f("polygon", { points: "0,0 30,0 15,10" })
1366
+ const d = a && c ? mo(a, n) : null;
1367
+ let h = -1, p = null;
1368
+ s && (p = new ResizeObserver((w) => {
1369
+ let [v] = w;
1370
+ v && v.target === a && p && (p.unobserve(t), cancelAnimationFrame(h), h = requestAnimationFrame(() => {
1371
+ var E;
1372
+ (E = p) == null || E.observe(t);
1373
+ })), n();
1374
+ }), a && !l && p.observe(a), p.observe(t));
1375
+ let m, g = l ? J(e) : null;
1376
+ l && y();
1377
+ function y() {
1378
+ const w = J(e);
1379
+ g && !Mt(g, w) && n(), g = w, m = requestAnimationFrame(y);
1380
+ }
1381
+ return n(), () => {
1382
+ var w;
1383
+ f.forEach((v) => {
1384
+ r && v.removeEventListener("scroll", n), i && v.removeEventListener("resize", n);
1385
+ }), d == null || d(), (w = p) == null || w.disconnect(), p = null, l && cancelAnimationFrame(m);
1386
+ };
1387
+ }
1388
+ const yo = Gn, wo = qn, vo = Un, xo = Zn, bo = Yn, dt = jn, Co = Kn, Eo = (e, t, n) => {
1389
+ const o = /* @__PURE__ */ new Map(), r = {
1390
+ platform: ho,
1391
+ ...n
1392
+ }, i = {
1393
+ ...r.platform,
1394
+ _c: o
1395
+ };
1396
+ return zn(e, t, {
1397
+ ...r,
1398
+ platform: i
1399
+ });
1400
+ };
1401
+ var me = typeof document < "u" ? mn : gn;
1402
+ function ve(e, t) {
1403
+ if (e === t)
1404
+ return !0;
1405
+ if (typeof e != typeof t)
1406
+ return !1;
1407
+ if (typeof e == "function" && e.toString() === t.toString())
1408
+ return !0;
1409
+ let n, o, r;
1410
+ if (e && t && typeof e == "object") {
1411
+ if (Array.isArray(e)) {
1412
+ if (n = e.length, n !== t.length)
1413
+ return !1;
1414
+ for (o = n; o-- !== 0; )
1415
+ if (!ve(e[o], t[o]))
1416
+ return !1;
1417
+ return !0;
310
1418
  }
311
- );
1419
+ if (r = Object.keys(e), n = r.length, n !== Object.keys(t).length)
1420
+ return !1;
1421
+ for (o = n; o-- !== 0; )
1422
+ if (!{}.hasOwnProperty.call(t, r[o]))
1423
+ return !1;
1424
+ for (o = n; o-- !== 0; ) {
1425
+ const i = r[o];
1426
+ if (!(i === "_owner" && e.$$typeof) && !ve(e[i], t[i]))
1427
+ return !1;
1428
+ }
1429
+ return !0;
1430
+ }
1431
+ return e !== e && t !== t;
1432
+ }
1433
+ function _t(e) {
1434
+ return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1435
+ }
1436
+ function pt(e, t) {
1437
+ const n = _t(e);
1438
+ return Math.round(t * n) / n;
1439
+ }
1440
+ function Se(e) {
1441
+ const t = u.useRef(e);
1442
+ return me(() => {
1443
+ t.current = e;
1444
+ }), t;
1445
+ }
1446
+ function Ao(e) {
1447
+ e === void 0 && (e = {});
1448
+ const {
1449
+ placement: t = "bottom",
1450
+ strategy: n = "absolute",
1451
+ middleware: o = [],
1452
+ platform: r,
1453
+ elements: {
1454
+ reference: i,
1455
+ floating: s
1456
+ } = {},
1457
+ transform: c = !0,
1458
+ whileElementsMounted: l,
1459
+ open: a
1460
+ } = e, [f, d] = u.useState({
1461
+ x: 0,
1462
+ y: 0,
1463
+ strategy: n,
1464
+ placement: t,
1465
+ middlewareData: {},
1466
+ isPositioned: !1
1467
+ }), [h, p] = u.useState(o);
1468
+ ve(h, o) || p(o);
1469
+ const [m, g] = u.useState(null), [y, w] = u.useState(null), v = u.useCallback((R) => {
1470
+ R !== P.current && (P.current = R, g(R));
1471
+ }, []), E = u.useCallback((R) => {
1472
+ R !== b.current && (b.current = R, w(R));
1473
+ }, []), x = i || m, C = s || y, P = u.useRef(null), b = u.useRef(null), O = u.useRef(f), M = l != null, T = Se(l), k = Se(r), $ = Se(a), D = u.useCallback(() => {
1474
+ if (!P.current || !b.current)
1475
+ return;
1476
+ const R = {
1477
+ placement: t,
1478
+ strategy: n,
1479
+ middleware: h
1480
+ };
1481
+ k.current && (R.platform = k.current), Eo(P.current, b.current, R).then((_) => {
1482
+ const V = {
1483
+ ..._,
1484
+ // The floating element's position may be recomputed while it's closed
1485
+ // but still mounted (such as when transitioning out). To ensure
1486
+ // `isPositioned` will be `false` initially on the next open, avoid
1487
+ // setting it to `true` when `open === false` (must be specified).
1488
+ isPositioned: $.current !== !1
1489
+ };
1490
+ S.current && !ve(O.current, V) && (O.current = V, yt.flushSync(() => {
1491
+ d(V);
1492
+ }));
1493
+ });
1494
+ }, [h, t, n, k, $]);
1495
+ me(() => {
1496
+ a === !1 && O.current.isPositioned && (O.current.isPositioned = !1, d((R) => ({
1497
+ ...R,
1498
+ isPositioned: !1
1499
+ })));
1500
+ }, [a]);
1501
+ const S = u.useRef(!1);
1502
+ me(() => (S.current = !0, () => {
1503
+ S.current = !1;
1504
+ }), []), me(() => {
1505
+ if (x && (P.current = x), C && (b.current = C), x && C) {
1506
+ if (T.current)
1507
+ return T.current(x, C, D);
1508
+ D();
1509
+ }
1510
+ }, [x, C, D, T, M]);
1511
+ const I = u.useMemo(() => ({
1512
+ reference: P,
1513
+ floating: b,
1514
+ setReference: v,
1515
+ setFloating: E
1516
+ }), [v, E]), N = u.useMemo(() => ({
1517
+ reference: x,
1518
+ floating: C
1519
+ }), [x, C]), L = u.useMemo(() => {
1520
+ const R = {
1521
+ position: n,
1522
+ left: 0,
1523
+ top: 0
1524
+ };
1525
+ if (!N.floating)
1526
+ return R;
1527
+ const _ = pt(N.floating, f.x), V = pt(N.floating, f.y);
1528
+ return c ? {
1529
+ ...R,
1530
+ transform: "translate(" + _ + "px, " + V + "px)",
1531
+ ..._t(N.floating) >= 1.5 && {
1532
+ willChange: "transform"
1533
+ }
1534
+ } : {
1535
+ position: n,
1536
+ left: _,
1537
+ top: V
1538
+ };
1539
+ }, [n, c, N.floating, f.x, f.y]);
1540
+ return u.useMemo(() => ({
1541
+ ...f,
1542
+ update: D,
1543
+ refs: I,
1544
+ elements: N,
1545
+ floatingStyles: L
1546
+ }), [f, D, I, N, L]);
1547
+ }
1548
+ const Po = (e) => {
1549
+ function t(n) {
1550
+ return {}.hasOwnProperty.call(n, "current");
1551
+ }
1552
+ return {
1553
+ name: "arrow",
1554
+ options: e,
1555
+ fn(n) {
1556
+ const {
1557
+ element: o,
1558
+ padding: r
1559
+ } = typeof e == "function" ? e(n) : e;
1560
+ return o && t(o) ? o.current != null ? dt({
1561
+ element: o.current,
1562
+ padding: r
1563
+ }).fn(n) : {} : o ? dt({
1564
+ element: o,
1565
+ padding: r
1566
+ }).fn(n) : {};
1567
+ }
1568
+ };
1569
+ }, Ro = (e, t) => ({
1570
+ ...yo(e),
1571
+ options: [e, t]
1572
+ }), Oo = (e, t) => ({
1573
+ ...wo(e),
1574
+ options: [e, t]
1575
+ }), To = (e, t) => ({
1576
+ ...Co(e),
1577
+ options: [e, t]
1578
+ }), So = (e, t) => ({
1579
+ ...vo(e),
1580
+ options: [e, t]
1581
+ }), Do = (e, t) => ({
1582
+ ...xo(e),
1583
+ options: [e, t]
1584
+ }), No = (e, t) => ({
1585
+ ...bo(e),
1586
+ options: [e, t]
1587
+ }), Lo = (e, t) => ({
1588
+ ...Po(e),
1589
+ options: [e, t]
312
1590
  });
313
- Ne.displayName = zt;
314
- var Zt = Ne;
315
- function ge(e, t) {
1591
+ function ht(e, t) {
316
1592
  if (typeof e == "function")
317
1593
  return e(t);
318
1594
  e != null && (e.current = t);
319
1595
  }
320
- function Se(...e) {
1596
+ function kt(...e) {
321
1597
  return (t) => {
322
1598
  let n = !1;
323
1599
  const o = e.map((r) => {
324
- const i = ge(r, t);
1600
+ const i = ht(r, t);
325
1601
  return !n && typeof i == "function" && (n = !0), i;
326
1602
  });
327
1603
  if (n)
328
1604
  return () => {
329
1605
  for (let r = 0; r < o.length; r++) {
330
1606
  const i = o[r];
331
- typeof i == "function" ? i() : ge(e[r], null);
1607
+ typeof i == "function" ? i() : ht(e[r], null);
332
1608
  }
333
1609
  };
334
1610
  };
335
1611
  }
336
- function De(...e) {
337
- return s.useCallback(Se(...e), e);
1612
+ function $t(...e) {
1613
+ return u.useCallback(kt(...e), e);
338
1614
  }
339
- var _e = s.forwardRef((e, t) => {
340
- const { children: n, ...o } = e, r = s.Children.toArray(n), i = r.find(Kt);
1615
+ var Wt = u.forwardRef((e, t) => {
1616
+ const { children: n, ...o } = e, r = u.Children.toArray(n), i = r.find(_o);
341
1617
  if (i) {
342
- const a = i.props.children, c = r.map((l) => l === i ? s.Children.count(a) > 1 ? s.Children.only(null) : s.isValidElement(a) ? a.props.children : null : l);
343
- return /* @__PURE__ */ f(Z, { ...o, ref: t, children: s.isValidElement(a) ? s.cloneElement(a, void 0, c) : null });
1618
+ const s = i.props.children, c = r.map((l) => l === i ? u.Children.count(s) > 1 ? u.Children.only(null) : u.isValidElement(s) ? s.props.children : null : l);
1619
+ return /* @__PURE__ */ A($e, { ...o, ref: t, children: u.isValidElement(s) ? u.cloneElement(s, void 0, c) : null });
344
1620
  }
345
- return /* @__PURE__ */ f(Z, { ...o, ref: t, children: n });
1621
+ return /* @__PURE__ */ A($e, { ...o, ref: t, children: n });
346
1622
  });
347
- _e.displayName = "Slot";
348
- var Z = s.forwardRef((e, t) => {
1623
+ Wt.displayName = "Slot";
1624
+ var $e = u.forwardRef((e, t) => {
349
1625
  const { children: n, ...o } = e;
350
- if (s.isValidElement(n)) {
351
- const r = Qt(n), i = Jt(o, n.props);
352
- return n.type !== s.Fragment && (i.ref = t ? Se(t, r) : r), s.cloneElement(n, i);
1626
+ if (u.isValidElement(n)) {
1627
+ const r = $o(n), i = ko(o, n.props);
1628
+ return n.type !== u.Fragment && (i.ref = t ? kt(t, r) : r), u.cloneElement(n, i);
353
1629
  }
354
- return s.Children.count(n) > 1 ? s.Children.only(null) : null;
1630
+ return u.Children.count(n) > 1 ? u.Children.only(null) : null;
355
1631
  });
356
- Z.displayName = "SlotClone";
357
- var qt = ({ children: e }) => /* @__PURE__ */ f(F, { children: e });
358
- function Kt(e) {
359
- return s.isValidElement(e) && e.type === qt;
1632
+ $e.displayName = "SlotClone";
1633
+ var Mo = ({ children: e }) => /* @__PURE__ */ A(gt, { children: e });
1634
+ function _o(e) {
1635
+ return u.isValidElement(e) && e.type === Mo;
360
1636
  }
361
- function Jt(e, t) {
1637
+ function ko(e, t) {
362
1638
  const n = { ...t };
363
1639
  for (const o in t) {
364
1640
  const r = e[o], i = t[o];
@@ -368,12 +1644,12 @@ function Jt(e, t) {
368
1644
  }
369
1645
  return { ...e, ...n };
370
1646
  }
371
- function Qt(e) {
1647
+ function $o(e) {
372
1648
  var o, r;
373
1649
  let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
374
1650
  return n ? e.ref : (t = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
375
1651
  }
376
- var en = [
1652
+ var Wo = [
377
1653
  "a",
378
1654
  "button",
379
1655
  "div",
@@ -390,131 +1666,170 @@ var en = [
390
1666
  "span",
391
1667
  "svg",
392
1668
  "ul"
393
- ], Le = en.reduce((e, t) => {
394
- const n = s.forwardRef((o, r) => {
395
- const { asChild: i, ...a } = o, c = i ? _e : t;
396
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ f(c, { ...a, ref: r });
1669
+ ], Ee = Wo.reduce((e, t) => {
1670
+ const n = u.forwardRef((o, r) => {
1671
+ const { asChild: i, ...s } = o, c = i ? Wt : t;
1672
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ A(c, { ...s, ref: r });
397
1673
  });
398
1674
  return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
399
- }, {}), te = "Popper", [$e, Me] = Ee(te), [tn, Ie] = $e(te), We = (e) => {
400
- const { __scopePopper: t, children: n } = e, [o, r] = s.useState(null);
401
- return /* @__PURE__ */ f(tn, { scope: t, anchor: o, onAnchorChange: r, children: n });
1675
+ }, {}), Fo = "Arrow", Ft = u.forwardRef((e, t) => {
1676
+ const { children: n, width: o = 10, height: r = 5, ...i } = e;
1677
+ return /* @__PURE__ */ A(
1678
+ Ee.svg,
1679
+ {
1680
+ ...i,
1681
+ ref: t,
1682
+ width: o,
1683
+ height: r,
1684
+ viewBox: "0 0 30 10",
1685
+ preserveAspectRatio: "none",
1686
+ children: e.asChild ? n : /* @__PURE__ */ A("polygon", { points: "0,0 30,0 15,10" })
1687
+ }
1688
+ );
1689
+ });
1690
+ Ft.displayName = Fo;
1691
+ var Io = Ft;
1692
+ function Ho(e) {
1693
+ const [t, n] = u.useState(void 0);
1694
+ return ee(() => {
1695
+ if (e) {
1696
+ n({ width: e.offsetWidth, height: e.offsetHeight });
1697
+ const o = new ResizeObserver((r) => {
1698
+ if (!Array.isArray(r) || !r.length)
1699
+ return;
1700
+ const i = r[0];
1701
+ let s, c;
1702
+ if ("borderBoxSize" in i) {
1703
+ const l = i.borderBoxSize, a = Array.isArray(l) ? l[0] : l;
1704
+ s = a.inlineSize, c = a.blockSize;
1705
+ } else
1706
+ s = e.offsetWidth, c = e.offsetHeight;
1707
+ n({ width: s, height: c });
1708
+ });
1709
+ return o.observe(e, { box: "border-box" }), () => o.unobserve(e);
1710
+ } else
1711
+ n(void 0);
1712
+ }, [e]), t;
1713
+ }
1714
+ var Xe = "Popper", [It, Ht] = vt(Xe), [Bo, Bt] = It(Xe), Vt = (e) => {
1715
+ const { __scopePopper: t, children: n } = e, [o, r] = u.useState(null);
1716
+ return /* @__PURE__ */ A(Bo, { scope: t, anchor: o, onAnchorChange: r, children: n });
402
1717
  };
403
- We.displayName = te;
404
- var ke = "PopperAnchor", He = s.forwardRef(
1718
+ Vt.displayName = Xe;
1719
+ var zt = "PopperAnchor", jt = u.forwardRef(
405
1720
  (e, t) => {
406
- const { __scopePopper: n, virtualRef: o, ...r } = e, i = Ie(ke, n), a = s.useRef(null), c = De(t, a);
407
- return s.useEffect(() => {
408
- i.onAnchorChange((o == null ? void 0 : o.current) || a.current);
409
- }), o ? null : /* @__PURE__ */ f(Le.div, { ...r, ref: c });
1721
+ const { __scopePopper: n, virtualRef: o, ...r } = e, i = Bt(zt, n), s = u.useRef(null), c = $t(t, s);
1722
+ return u.useEffect(() => {
1723
+ i.onAnchorChange((o == null ? void 0 : o.current) || s.current);
1724
+ }), o ? null : /* @__PURE__ */ A(Ee.div, { ...r, ref: c });
410
1725
  }
411
1726
  );
412
- He.displayName = ke;
413
- var ne = "PopperContent", [nn, rn] = $e(ne), Fe = s.forwardRef(
1727
+ jt.displayName = zt;
1728
+ var Ge = "PopperContent", [Vo, zo] = It(Ge), Ut = u.forwardRef(
414
1729
  (e, t) => {
415
- var ae, le, ce, ue, de, fe;
1730
+ var Ke, Ze, Je, Qe, et, tt;
416
1731
  const {
417
1732
  __scopePopper: n,
418
1733
  side: o = "bottom",
419
1734
  sideOffset: r = 0,
420
1735
  align: i = "center",
421
- alignOffset: a = 0,
1736
+ alignOffset: s = 0,
422
1737
  arrowPadding: c = 0,
423
1738
  avoidCollisions: l = !0,
424
- collisionBoundary: u = [],
425
- collisionPadding: d = 0,
426
- sticky: m = "partial",
1739
+ collisionBoundary: a = [],
1740
+ collisionPadding: f = 0,
1741
+ sticky: d = "partial",
427
1742
  hideWhenDetached: h = !1,
428
1743
  updatePositionStrategy: p = "optimized",
429
- onPlaced: v,
430
- ...y
431
- } = e, w = Ie(ne, n), [E, C] = s.useState(null), x = De(t, (D) => C(D)), [P, R] = s.useState(null), b = ht(P), g = (b == null ? void 0 : b.width) ?? 0, T = (b == null ? void 0 : b.height) ?? 0, L = o + (i !== "center" ? "-" + i : ""), S = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, oe = Array.isArray(u) ? u : [u], tt = oe.length > 0, $ = {
432
- padding: S,
433
- boundary: oe.filter(sn),
1744
+ onPlaced: m,
1745
+ ...g
1746
+ } = e, y = Bt(Ge, n), [w, v] = u.useState(null), E = $t(t, (se) => v(se)), [x, C] = u.useState(null), P = Ho(x), b = (P == null ? void 0 : P.width) ?? 0, O = (P == null ? void 0 : P.height) ?? 0, M = o + (i !== "center" ? "-" + i : ""), T = typeof f == "number" ? f : { top: 0, right: 0, bottom: 0, left: 0, ...f }, k = Array.isArray(a) ? a : [a], $ = k.length > 0, D = {
1747
+ padding: T,
1748
+ boundary: k.filter(Uo),
434
1749
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
435
- altBoundary: tt
436
- }, { refs: nt, floatingStyles: ie, placement: rt, isPositioned: M, middlewareData: O } = wt({
1750
+ altBoundary: $
1751
+ }, { refs: S, floatingStyles: I, placement: N, isPositioned: L, middlewareData: R } = Ao({
437
1752
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
438
1753
  strategy: "fixed",
439
- placement: L,
440
- whileElementsMounted: (...D) => Ct(...D, {
1754
+ placement: M,
1755
+ whileElementsMounted: (...se) => go(...se, {
441
1756
  animationFrame: p === "always"
442
1757
  }),
443
1758
  elements: {
444
- reference: w.anchor
1759
+ reference: y.anchor
445
1760
  },
446
1761
  middleware: [
447
- Et({ mainAxis: r + T, alignmentAxis: a }),
448
- l && Pt({
1762
+ Ro({ mainAxis: r + O, alignmentAxis: s }),
1763
+ l && Oo({
449
1764
  mainAxis: !0,
450
1765
  crossAxis: !1,
451
- limiter: m === "partial" ? Tt() : void 0,
452
- ...$
1766
+ limiter: d === "partial" ? To() : void 0,
1767
+ ...D
453
1768
  }),
454
- l && bt({ ...$ }),
455
- xt({
456
- ...$,
457
- apply: ({ elements: D, rects: pe, availableWidth: ut, availableHeight: dt }) => {
458
- const { width: ft, height: pt } = pe.reference, W = D.floating.style;
459
- W.setProperty("--radix-popper-available-width", `${ut}px`), W.setProperty("--radix-popper-available-height", `${dt}px`), W.setProperty("--radix-popper-anchor-width", `${ft}px`), W.setProperty("--radix-popper-anchor-height", `${pt}px`);
1769
+ l && So({ ...D }),
1770
+ Do({
1771
+ ...D,
1772
+ apply: ({ elements: se, rects: nt, availableWidth: fn, availableHeight: dn }) => {
1773
+ const { width: pn, height: hn } = nt.reference, de = se.floating.style;
1774
+ de.setProperty("--radix-popper-available-width", `${fn}px`), de.setProperty("--radix-popper-available-height", `${dn}px`), de.setProperty("--radix-popper-anchor-width", `${pn}px`), de.setProperty("--radix-popper-anchor-height", `${hn}px`);
460
1775
  }
461
1776
  }),
462
- P && Rt({ element: P, padding: c }),
463
- an({ arrowWidth: g, arrowHeight: T }),
464
- h && At({ strategy: "referenceHidden", ...$ })
1777
+ x && Lo({ element: x, padding: c }),
1778
+ Yo({ arrowWidth: b, arrowHeight: O }),
1779
+ h && No({ strategy: "referenceHidden", ...D })
465
1780
  ]
466
- }), [se, ot] = Ue(rt), I = Q(v);
467
- H(() => {
468
- M && (I == null || I());
469
- }, [M, I]);
470
- const it = (ae = O.arrow) == null ? void 0 : ae.x, st = (le = O.arrow) == null ? void 0 : le.y, at = ((ce = O.arrow) == null ? void 0 : ce.centerOffset) !== 0, [lt, ct] = s.useState();
471
- return H(() => {
472
- E && ct(window.getComputedStyle(E).zIndex);
473
- }, [E]), /* @__PURE__ */ f(
1781
+ }), [_, V] = Gt(N), fe = oe(m);
1782
+ ee(() => {
1783
+ L && (fe == null || fe());
1784
+ }, [L, fe]);
1785
+ const sn = (Ke = R.arrow) == null ? void 0 : Ke.x, cn = (Ze = R.arrow) == null ? void 0 : Ze.y, ln = ((Je = R.arrow) == null ? void 0 : Je.centerOffset) !== 0, [an, un] = u.useState();
1786
+ return ee(() => {
1787
+ w && un(window.getComputedStyle(w).zIndex);
1788
+ }, [w]), /* @__PURE__ */ A(
474
1789
  "div",
475
1790
  {
476
- ref: nt.setFloating,
1791
+ ref: S.setFloating,
477
1792
  "data-radix-popper-content-wrapper": "",
478
1793
  style: {
479
- ...ie,
480
- transform: M ? ie.transform : "translate(0, -200%)",
1794
+ ...I,
1795
+ transform: L ? I.transform : "translate(0, -200%)",
481
1796
  // keep off the page when measuring
482
1797
  minWidth: "max-content",
483
- zIndex: lt,
1798
+ zIndex: an,
484
1799
  "--radix-popper-transform-origin": [
485
- (ue = O.transformOrigin) == null ? void 0 : ue.x,
486
- (de = O.transformOrigin) == null ? void 0 : de.y
1800
+ (Qe = R.transformOrigin) == null ? void 0 : Qe.x,
1801
+ (et = R.transformOrigin) == null ? void 0 : et.y
487
1802
  ].join(" "),
488
1803
  // hide the content if using the hide middleware and should be hidden
489
1804
  // set visibility to hidden and disable pointer events so the UI behaves
490
1805
  // as if the PopperContent isn't there at all
491
- ...((fe = O.hide) == null ? void 0 : fe.referenceHidden) && {
1806
+ ...((tt = R.hide) == null ? void 0 : tt.referenceHidden) && {
492
1807
  visibility: "hidden",
493
1808
  pointerEvents: "none"
494
1809
  }
495
1810
  },
496
1811
  dir: e.dir,
497
- children: /* @__PURE__ */ f(
498
- nn,
1812
+ children: /* @__PURE__ */ A(
1813
+ Vo,
499
1814
  {
500
1815
  scope: n,
501
- placedSide: se,
502
- onArrowChange: R,
503
- arrowX: it,
504
- arrowY: st,
505
- shouldHideArrow: at,
506
- children: /* @__PURE__ */ f(
507
- Le.div,
1816
+ placedSide: _,
1817
+ onArrowChange: C,
1818
+ arrowX: sn,
1819
+ arrowY: cn,
1820
+ shouldHideArrow: ln,
1821
+ children: /* @__PURE__ */ A(
1822
+ Ee.div,
508
1823
  {
509
- "data-side": se,
510
- "data-align": ot,
511
- ...y,
512
- ref: x,
1824
+ "data-side": _,
1825
+ "data-align": V,
1826
+ ...g,
1827
+ ref: E,
513
1828
  style: {
514
- ...y.style,
1829
+ ...g.style,
515
1830
  // if the PopperContent hasn't been placed yet (not all measurements done)
516
1831
  // we prevent animations so that users's animation don't kick in too early referring wrong sides
517
- animation: M ? void 0 : "none"
1832
+ animation: L ? void 0 : "none"
518
1833
  }
519
1834
  }
520
1835
  )
@@ -524,19 +1839,19 @@ var ne = "PopperContent", [nn, rn] = $e(ne), Fe = s.forwardRef(
524
1839
  );
525
1840
  }
526
1841
  );
527
- Fe.displayName = ne;
528
- var Ve = "PopperArrow", on = {
1842
+ Ut.displayName = Ge;
1843
+ var Yt = "PopperArrow", jo = {
529
1844
  top: "bottom",
530
1845
  right: "left",
531
1846
  bottom: "top",
532
1847
  left: "right"
533
- }, Be = s.forwardRef(function(t, n) {
534
- const { __scopePopper: o, ...r } = t, i = rn(Ve, o), a = on[i.placedSide];
1848
+ }, Xt = u.forwardRef(function(t, n) {
1849
+ const { __scopePopper: o, ...r } = t, i = zo(Yt, o), s = jo[i.placedSide];
535
1850
  return (
536
1851
  // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
537
1852
  // doesn't report size as we'd expect on SVG elements.
538
1853
  // it reports their bounding box which is effectively the largest path inside the SVG.
539
- /* @__PURE__ */ f(
1854
+ /* @__PURE__ */ A(
540
1855
  "span",
541
1856
  {
542
1857
  ref: i.onArrowChange,
@@ -544,7 +1859,7 @@ var Ve = "PopperArrow", on = {
544
1859
  position: "absolute",
545
1860
  left: i.arrowX,
546
1861
  top: i.arrowY,
547
- [a]: 0,
1862
+ [s]: 0,
548
1863
  transformOrigin: {
549
1864
  top: "",
550
1865
  right: "0 0",
@@ -559,8 +1874,8 @@ var Ve = "PopperArrow", on = {
559
1874
  }[i.placedSide],
560
1875
  visibility: i.shouldHideArrow ? "hidden" : void 0
561
1876
  },
562
- children: /* @__PURE__ */ f(
563
- Zt,
1877
+ children: /* @__PURE__ */ A(
1878
+ Io,
564
1879
  {
565
1880
  ...r,
566
1881
  ref: n,
@@ -575,35 +1890,35 @@ var Ve = "PopperArrow", on = {
575
1890
  )
576
1891
  );
577
1892
  });
578
- Be.displayName = Ve;
579
- function sn(e) {
1893
+ Xt.displayName = Yt;
1894
+ function Uo(e) {
580
1895
  return e !== null;
581
1896
  }
582
- var an = (e) => ({
1897
+ var Yo = (e) => ({
583
1898
  name: "transformOrigin",
584
1899
  options: e,
585
1900
  fn(t) {
586
- var w, E, C;
587
- const { placement: n, rects: o, middlewareData: r } = t, a = ((w = r.arrow) == null ? void 0 : w.centerOffset) !== 0, c = a ? 0 : e.arrowWidth, l = a ? 0 : e.arrowHeight, [u, d] = Ue(n), m = { start: "0%", center: "50%", end: "100%" }[d], h = (((E = r.arrow) == null ? void 0 : E.x) ?? 0) + c / 2, p = (((C = r.arrow) == null ? void 0 : C.y) ?? 0) + l / 2;
588
- let v = "", y = "";
589
- return u === "bottom" ? (v = a ? m : `${h}px`, y = `${-l}px`) : u === "top" ? (v = a ? m : `${h}px`, y = `${o.floating.height + l}px`) : u === "right" ? (v = `${-l}px`, y = a ? m : `${p}px`) : u === "left" && (v = `${o.floating.width + l}px`, y = a ? m : `${p}px`), { data: { x: v, y } };
1901
+ var y, w, v;
1902
+ const { placement: n, rects: o, middlewareData: r } = t, s = ((y = r.arrow) == null ? void 0 : y.centerOffset) !== 0, c = s ? 0 : e.arrowWidth, l = s ? 0 : e.arrowHeight, [a, f] = Gt(n), d = { start: "0%", center: "50%", end: "100%" }[f], h = (((w = r.arrow) == null ? void 0 : w.x) ?? 0) + c / 2, p = (((v = r.arrow) == null ? void 0 : v.y) ?? 0) + l / 2;
1903
+ let m = "", g = "";
1904
+ return a === "bottom" ? (m = s ? d : `${h}px`, g = `${-l}px`) : a === "top" ? (m = s ? d : `${h}px`, g = `${o.floating.height + l}px`) : a === "right" ? (m = `${-l}px`, g = s ? d : `${p}px`) : a === "left" && (m = `${o.floating.width + l}px`, g = s ? d : `${p}px`), { data: { x: m, y: g } };
590
1905
  }
591
1906
  });
592
- function Ue(e) {
1907
+ function Gt(e) {
593
1908
  const [t, n = "center"] = e.split("-");
594
1909
  return [t, n];
595
1910
  }
596
- var ln = We, cn = He, un = Fe, dn = Be;
597
- function fn(e, t) {
598
- return s.useReducer((n, o) => t[n][o] ?? n, e);
1911
+ var Xo = Vt, Go = jt, qo = Ut, Ko = Xt;
1912
+ function Zo(e, t) {
1913
+ return u.useReducer((n, o) => t[n][o] ?? n, e);
599
1914
  }
600
- var je = (e) => {
601
- const { present: t, children: n } = e, o = pn(t), r = typeof n == "function" ? n({ present: o.isPresent }) : s.Children.only(n), i = _(o.ref, mn(r));
602
- return typeof n == "function" || o.isPresent ? s.cloneElement(r, { ref: i }) : null;
1915
+ var qt = (e) => {
1916
+ const { present: t, children: n } = e, o = Jo(t), r = typeof n == "function" ? n({ present: o.isPresent }) : u.Children.only(n), i = ae(o.ref, Qo(r));
1917
+ return typeof n == "function" || o.isPresent ? u.cloneElement(r, { ref: i }) : null;
603
1918
  };
604
- je.displayName = "Presence";
605
- function pn(e) {
606
- const [t, n] = s.useState(), o = s.useRef({}), r = s.useRef(e), i = s.useRef("none"), a = e ? "mounted" : "unmounted", [c, l] = fn(a, {
1919
+ qt.displayName = "Presence";
1920
+ function Jo(e) {
1921
+ const [t, n] = u.useState(), o = u.useRef({}), r = u.useRef(e), i = u.useRef("none"), s = e ? "mounted" : "unmounted", [c, l] = Zo(s, {
607
1922
  mounted: {
608
1923
  UNMOUNT: "unmounted",
609
1924
  ANIMATION_OUT: "unmountSuspended"
@@ -616,133 +1931,79 @@ function pn(e) {
616
1931
  MOUNT: "mounted"
617
1932
  }
618
1933
  });
619
- return s.useEffect(() => {
620
- const u = k(o.current);
621
- i.current = c === "mounted" ? u : "none";
622
- }, [c]), H(() => {
623
- const u = o.current, d = r.current;
624
- if (d !== e) {
625
- const h = i.current, p = k(u);
626
- e ? l("MOUNT") : p === "none" || (u == null ? void 0 : u.display) === "none" ? l("UNMOUNT") : l(d && h !== p ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
1934
+ return u.useEffect(() => {
1935
+ const a = he(o.current);
1936
+ i.current = c === "mounted" ? a : "none";
1937
+ }, [c]), ee(() => {
1938
+ const a = o.current, f = r.current;
1939
+ if (f !== e) {
1940
+ const h = i.current, p = he(a);
1941
+ e ? l("MOUNT") : p === "none" || (a == null ? void 0 : a.display) === "none" ? l("UNMOUNT") : l(f && h !== p ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
627
1942
  }
628
- }, [e, l]), H(() => {
1943
+ }, [e, l]), ee(() => {
629
1944
  if (t) {
630
- let u;
631
- const d = t.ownerDocument.defaultView ?? window, m = (p) => {
632
- const y = k(o.current).includes(p.animationName);
633
- if (p.target === t && y && (l("ANIMATION_END"), !r.current)) {
634
- const w = t.style.animationFillMode;
635
- t.style.animationFillMode = "forwards", u = d.setTimeout(() => {
636
- t.style.animationFillMode === "forwards" && (t.style.animationFillMode = w);
1945
+ let a;
1946
+ const f = t.ownerDocument.defaultView ?? window, d = (p) => {
1947
+ const g = he(o.current).includes(p.animationName);
1948
+ if (p.target === t && g && (l("ANIMATION_END"), !r.current)) {
1949
+ const y = t.style.animationFillMode;
1950
+ t.style.animationFillMode = "forwards", a = f.setTimeout(() => {
1951
+ t.style.animationFillMode === "forwards" && (t.style.animationFillMode = y);
637
1952
  });
638
1953
  }
639
1954
  }, h = (p) => {
640
- p.target === t && (i.current = k(o.current));
1955
+ p.target === t && (i.current = he(o.current));
641
1956
  };
642
- return t.addEventListener("animationstart", h), t.addEventListener("animationcancel", m), t.addEventListener("animationend", m), () => {
643
- d.clearTimeout(u), t.removeEventListener("animationstart", h), t.removeEventListener("animationcancel", m), t.removeEventListener("animationend", m);
1957
+ return t.addEventListener("animationstart", h), t.addEventListener("animationcancel", d), t.addEventListener("animationend", d), () => {
1958
+ f.clearTimeout(a), t.removeEventListener("animationstart", h), t.removeEventListener("animationcancel", d), t.removeEventListener("animationend", d);
644
1959
  };
645
1960
  } else
646
1961
  l("ANIMATION_END");
647
1962
  }, [t, l]), {
648
1963
  isPresent: ["mounted", "unmountSuspended"].includes(c),
649
- ref: s.useCallback((u) => {
650
- u && (o.current = getComputedStyle(u)), n(u);
1964
+ ref: u.useCallback((a) => {
1965
+ a && (o.current = getComputedStyle(a)), n(a);
651
1966
  }, [])
652
1967
  };
653
1968
  }
654
- function k(e) {
1969
+ function he(e) {
655
1970
  return (e == null ? void 0 : e.animationName) || "none";
656
1971
  }
657
- function mn(e) {
1972
+ function Qo(e) {
658
1973
  var o, r;
659
1974
  let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
660
1975
  return n ? e.ref : (t = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
661
1976
  }
662
- function we(e, t) {
663
- if (typeof e == "function")
664
- return e(t);
665
- e != null && (e.current = t);
666
- }
667
- function hn(...e) {
668
- return (t) => {
669
- let n = !1;
670
- const o = e.map((r) => {
671
- const i = we(r, t);
672
- return !n && typeof i == "function" && (n = !0), i;
673
- });
674
- if (n)
675
- return () => {
676
- for (let r = 0; r < o.length; r++) {
677
- const i = o[r];
678
- typeof i == "function" ? i() : we(e[r], null);
679
- }
680
- };
681
- };
682
- }
683
- var Ye = s.forwardRef((e, t) => {
684
- const { children: n, ...o } = e, r = s.Children.toArray(n), i = r.find(yn);
685
- if (i) {
686
- const a = i.props.children, c = r.map((l) => l === i ? s.Children.count(a) > 1 ? s.Children.only(null) : s.isValidElement(a) ? a.props.children : null : l);
687
- return /* @__PURE__ */ f(q, { ...o, ref: t, children: s.isValidElement(a) ? s.cloneElement(a, void 0, c) : null });
1977
+ function er({
1978
+ prop: e,
1979
+ defaultProp: t,
1980
+ onChange: n = () => {
688
1981
  }
689
- return /* @__PURE__ */ f(q, { ...o, ref: t, children: n });
690
- });
691
- Ye.displayName = "Slot";
692
- var q = s.forwardRef((e, t) => {
693
- const { children: n, ...o } = e;
694
- if (s.isValidElement(n)) {
695
- const r = wn(n), i = gn(o, n.props);
696
- return n.type !== s.Fragment && (i.ref = t ? hn(t, r) : r), s.cloneElement(n, i);
697
- }
698
- return s.Children.count(n) > 1 ? s.Children.only(null) : null;
699
- });
700
- q.displayName = "SlotClone";
701
- var vn = ({ children: e }) => /* @__PURE__ */ f(F, { children: e });
702
- function yn(e) {
703
- return s.isValidElement(e) && e.type === vn;
1982
+ }) {
1983
+ const [o, r] = tr({ defaultProp: t, onChange: n }), i = e !== void 0, s = i ? e : o, c = oe(n), l = u.useCallback(
1984
+ (a) => {
1985
+ if (i) {
1986
+ const d = typeof a == "function" ? a(e) : a;
1987
+ d !== e && c(d);
1988
+ } else
1989
+ r(a);
1990
+ },
1991
+ [i, e, r, c]
1992
+ );
1993
+ return [s, l];
704
1994
  }
705
- function gn(e, t) {
706
- const n = { ...t };
707
- for (const o in t) {
708
- const r = e[o], i = t[o];
709
- /^on[A-Z]/.test(o) ? r && i ? n[o] = (...c) => {
710
- i(...c), r(...c);
711
- } : r && (n[o] = r) : o === "style" ? n[o] = { ...r, ...i } : o === "className" && (n[o] = [r, i].filter(Boolean).join(" "));
712
- }
713
- return { ...e, ...n };
1995
+ function tr({
1996
+ defaultProp: e,
1997
+ onChange: t
1998
+ }) {
1999
+ const n = u.useState(e), [o] = n, r = u.useRef(o), i = oe(t);
2000
+ return u.useEffect(() => {
2001
+ r.current !== o && (i(o), r.current = o);
2002
+ }, [o, r, i]), n;
714
2003
  }
715
- function wn(e) {
716
- var o, r;
717
- let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
718
- return n ? e.ref : (t = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
719
- }
720
- var Cn = [
721
- "a",
722
- "button",
723
- "div",
724
- "form",
725
- "h2",
726
- "h3",
727
- "img",
728
- "input",
729
- "label",
730
- "li",
731
- "nav",
732
- "ol",
733
- "p",
734
- "span",
735
- "svg",
736
- "ul"
737
- ], En = Cn.reduce((e, t) => {
738
- const n = s.forwardRef((o, r) => {
739
- const { asChild: i, ...a } = o, c = i ? Ye : t;
740
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ f(c, { ...a, ref: r });
741
- });
742
- return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
743
- }, {}), Pn = "VisuallyHidden", Ge = s.forwardRef(
744
- (e, t) => /* @__PURE__ */ f(
745
- En.span,
2004
+ var nr = "VisuallyHidden", Kt = u.forwardRef(
2005
+ (e, t) => /* @__PURE__ */ A(
2006
+ Ee.span,
746
2007
  {
747
2008
  ...e,
748
2009
  ref: t,
@@ -763,188 +2024,188 @@ var Cn = [
763
2024
  }
764
2025
  )
765
2026
  );
766
- Ge.displayName = Pn;
767
- var bn = Ge, [V, Gn] = Ee("Tooltip", [
768
- Me
769
- ]), B = Me(), Xe = "TooltipProvider", xn = 700, K = "tooltip.open", [Rn, re] = V(Xe), ze = (e) => {
2027
+ Kt.displayName = nr;
2028
+ var or = Kt, [Ae, Ar] = vt("Tooltip", [
2029
+ Ht
2030
+ ]), Pe = Ht(), Zt = "TooltipProvider", rr = 700, We = "tooltip.open", [ir, qe] = Ae(Zt), Jt = (e) => {
770
2031
  const {
771
2032
  __scopeTooltip: t,
772
- delayDuration: n = xn,
2033
+ delayDuration: n = rr,
773
2034
  skipDelayDuration: o = 300,
774
2035
  disableHoverableContent: r = !1,
775
2036
  children: i
776
- } = e, [a, c] = s.useState(!0), l = s.useRef(!1), u = s.useRef(0);
777
- return s.useEffect(() => {
778
- const d = u.current;
779
- return () => window.clearTimeout(d);
780
- }, []), /* @__PURE__ */ f(
781
- Rn,
2037
+ } = e, [s, c] = u.useState(!0), l = u.useRef(!1), a = u.useRef(0);
2038
+ return u.useEffect(() => {
2039
+ const f = a.current;
2040
+ return () => window.clearTimeout(f);
2041
+ }, []), /* @__PURE__ */ A(
2042
+ ir,
782
2043
  {
783
2044
  scope: t,
784
- isOpenDelayed: a,
2045
+ isOpenDelayed: s,
785
2046
  delayDuration: n,
786
- onOpen: s.useCallback(() => {
787
- window.clearTimeout(u.current), c(!1);
2047
+ onOpen: u.useCallback(() => {
2048
+ window.clearTimeout(a.current), c(!1);
788
2049
  }, []),
789
- onClose: s.useCallback(() => {
790
- window.clearTimeout(u.current), u.current = window.setTimeout(
2050
+ onClose: u.useCallback(() => {
2051
+ window.clearTimeout(a.current), a.current = window.setTimeout(
791
2052
  () => c(!0),
792
2053
  o
793
2054
  );
794
2055
  }, [o]),
795
2056
  isPointerInTransitRef: l,
796
- onPointerInTransitChange: s.useCallback((d) => {
797
- l.current = d;
2057
+ onPointerInTransitChange: u.useCallback((f) => {
2058
+ l.current = f;
798
2059
  }, []),
799
2060
  disableHoverableContent: r,
800
2061
  children: i
801
2062
  }
802
2063
  );
803
2064
  };
804
- ze.displayName = Xe;
805
- var U = "Tooltip", [An, j] = V(U), Ze = (e) => {
2065
+ Jt.displayName = Zt;
2066
+ var Re = "Tooltip", [sr, Oe] = Ae(Re), Qt = (e) => {
806
2067
  const {
807
2068
  __scopeTooltip: t,
808
2069
  children: n,
809
2070
  open: o,
810
2071
  defaultOpen: r = !1,
811
2072
  onOpenChange: i,
812
- disableHoverableContent: a,
2073
+ disableHoverableContent: s,
813
2074
  delayDuration: c
814
- } = e, l = re(U, e.__scopeTooltip), u = B(t), [d, m] = s.useState(null), h = Ot(), p = s.useRef(0), v = a ?? l.disableHoverableContent, y = c ?? l.delayDuration, w = s.useRef(!1), [E = !1, C] = vt({
2075
+ } = e, l = qe(Re, e.__scopeTooltip), a = Pe(t), [f, d] = u.useState(null), h = _n(), p = u.useRef(0), m = s ?? l.disableHoverableContent, g = c ?? l.delayDuration, y = u.useRef(!1), [w = !1, v] = er({
815
2076
  prop: o,
816
2077
  defaultProp: r,
817
- onChange: (g) => {
818
- g ? (l.onOpen(), document.dispatchEvent(new CustomEvent(K))) : l.onClose(), i == null || i(g);
2078
+ onChange: (b) => {
2079
+ b ? (l.onOpen(), document.dispatchEvent(new CustomEvent(We))) : l.onClose(), i == null || i(b);
819
2080
  }
820
- }), x = s.useMemo(() => E ? w.current ? "delayed-open" : "instant-open" : "closed", [E]), P = s.useCallback(() => {
821
- window.clearTimeout(p.current), p.current = 0, w.current = !1, C(!0);
822
- }, [C]), R = s.useCallback(() => {
823
- window.clearTimeout(p.current), p.current = 0, C(!1);
824
- }, [C]), b = s.useCallback(() => {
2081
+ }), E = u.useMemo(() => w ? y.current ? "delayed-open" : "instant-open" : "closed", [w]), x = u.useCallback(() => {
2082
+ window.clearTimeout(p.current), p.current = 0, y.current = !1, v(!0);
2083
+ }, [v]), C = u.useCallback(() => {
2084
+ window.clearTimeout(p.current), p.current = 0, v(!1);
2085
+ }, [v]), P = u.useCallback(() => {
825
2086
  window.clearTimeout(p.current), p.current = window.setTimeout(() => {
826
- w.current = !0, C(!0), p.current = 0;
827
- }, y);
828
- }, [y, C]);
829
- return s.useEffect(() => () => {
2087
+ y.current = !0, v(!0), p.current = 0;
2088
+ }, g);
2089
+ }, [g, v]);
2090
+ return u.useEffect(() => () => {
830
2091
  p.current && (window.clearTimeout(p.current), p.current = 0);
831
- }, []), /* @__PURE__ */ f(ln, { ...u, children: /* @__PURE__ */ f(
832
- An,
2092
+ }, []), /* @__PURE__ */ A(Xo, { ...a, children: /* @__PURE__ */ A(
2093
+ sr,
833
2094
  {
834
2095
  scope: t,
835
2096
  contentId: h,
836
- open: E,
837
- stateAttribute: x,
838
- trigger: d,
839
- onTriggerChange: m,
840
- onTriggerEnter: s.useCallback(() => {
841
- l.isOpenDelayed ? b() : P();
842
- }, [l.isOpenDelayed, b, P]),
843
- onTriggerLeave: s.useCallback(() => {
844
- v ? R() : (window.clearTimeout(p.current), p.current = 0);
845
- }, [R, v]),
846
- onOpen: P,
847
- onClose: R,
848
- disableHoverableContent: v,
2097
+ open: w,
2098
+ stateAttribute: E,
2099
+ trigger: f,
2100
+ onTriggerChange: d,
2101
+ onTriggerEnter: u.useCallback(() => {
2102
+ l.isOpenDelayed ? P() : x();
2103
+ }, [l.isOpenDelayed, P, x]),
2104
+ onTriggerLeave: u.useCallback(() => {
2105
+ m ? C() : (window.clearTimeout(p.current), p.current = 0);
2106
+ }, [C, m]),
2107
+ onOpen: x,
2108
+ onClose: C,
2109
+ disableHoverableContent: m,
849
2110
  children: n
850
2111
  }
851
2112
  ) });
852
2113
  };
853
- Ze.displayName = U;
854
- var J = "TooltipTrigger", qe = s.forwardRef(
2114
+ Qt.displayName = Re;
2115
+ var Fe = "TooltipTrigger", en = u.forwardRef(
855
2116
  (e, t) => {
856
- const { __scopeTooltip: n, ...o } = e, r = j(J, n), i = re(J, n), a = B(n), c = s.useRef(null), l = _(t, c, r.onTriggerChange), u = s.useRef(!1), d = s.useRef(!1), m = s.useCallback(() => u.current = !1, []);
857
- return s.useEffect(() => () => document.removeEventListener("pointerup", m), [m]), /* @__PURE__ */ f(cn, { asChild: !0, ...a, children: /* @__PURE__ */ f(
858
- ee.button,
2117
+ const { __scopeTooltip: n, ...o } = e, r = Oe(Fe, n), i = qe(Fe, n), s = Pe(n), c = u.useRef(null), l = ae(t, c, r.onTriggerChange), a = u.useRef(!1), f = u.useRef(!1), d = u.useCallback(() => a.current = !1, []);
2118
+ return u.useEffect(() => () => document.removeEventListener("pointerup", d), [d]), /* @__PURE__ */ A(Go, { asChild: !0, ...s, children: /* @__PURE__ */ A(
2119
+ Ie.button,
859
2120
  {
860
2121
  "aria-describedby": r.open ? r.contentId : void 0,
861
2122
  "data-state": r.stateAttribute,
862
2123
  ...o,
863
2124
  ref: l,
864
- onPointerMove: A(e.onPointerMove, (h) => {
865
- h.pointerType !== "touch" && !d.current && !i.isPointerInTransitRef.current && (r.onTriggerEnter(), d.current = !0);
2125
+ onPointerMove: Y(e.onPointerMove, (h) => {
2126
+ h.pointerType !== "touch" && !f.current && !i.isPointerInTransitRef.current && (r.onTriggerEnter(), f.current = !0);
866
2127
  }),
867
- onPointerLeave: A(e.onPointerLeave, () => {
868
- r.onTriggerLeave(), d.current = !1;
2128
+ onPointerLeave: Y(e.onPointerLeave, () => {
2129
+ r.onTriggerLeave(), f.current = !1;
869
2130
  }),
870
- onPointerDown: A(e.onPointerDown, () => {
871
- u.current = !0, document.addEventListener("pointerup", m, { once: !0 });
2131
+ onPointerDown: Y(e.onPointerDown, () => {
2132
+ a.current = !0, document.addEventListener("pointerup", d, { once: !0 });
872
2133
  }),
873
- onFocus: A(e.onFocus, () => {
874
- u.current || r.onOpen();
2134
+ onFocus: Y(e.onFocus, () => {
2135
+ a.current || r.onOpen();
875
2136
  }),
876
- onBlur: A(e.onBlur, r.onClose),
877
- onClick: A(e.onClick, r.onClose)
2137
+ onBlur: Y(e.onBlur, r.onClose),
2138
+ onClick: Y(e.onClick, r.onClose)
878
2139
  }
879
2140
  ) });
880
2141
  }
881
2142
  );
882
- qe.displayName = J;
883
- var Tn = "TooltipPortal", [Xn, On] = V(Tn, {
2143
+ en.displayName = Fe;
2144
+ var cr = "TooltipPortal", [Pr, lr] = Ae(cr, {
884
2145
  forceMount: void 0
885
- }), N = "TooltipContent", Ke = s.forwardRef(
2146
+ }), ne = "TooltipContent", tn = u.forwardRef(
886
2147
  (e, t) => {
887
- const n = On(N, e.__scopeTooltip), { forceMount: o = n.forceMount, side: r = "top", ...i } = e, a = j(N, e.__scopeTooltip);
888
- return /* @__PURE__ */ f(je, { present: o || a.open, children: a.disableHoverableContent ? /* @__PURE__ */ f(Je, { side: r, ...i, ref: t }) : /* @__PURE__ */ f(Nn, { side: r, ...i, ref: t }) });
2148
+ const n = lr(ne, e.__scopeTooltip), { forceMount: o = n.forceMount, side: r = "top", ...i } = e, s = Oe(ne, e.__scopeTooltip);
2149
+ return /* @__PURE__ */ A(qt, { present: o || s.open, children: s.disableHoverableContent ? /* @__PURE__ */ A(nn, { side: r, ...i, ref: t }) : /* @__PURE__ */ A(ar, { side: r, ...i, ref: t }) });
889
2150
  }
890
- ), Nn = s.forwardRef((e, t) => {
891
- const n = j(N, e.__scopeTooltip), o = re(N, e.__scopeTooltip), r = s.useRef(null), i = _(t, r), [a, c] = s.useState(null), { trigger: l, onClose: u } = n, d = r.current, { onPointerInTransitChange: m } = o, h = s.useCallback(() => {
892
- c(null), m(!1);
893
- }, [m]), p = s.useCallback(
894
- (v, y) => {
895
- const w = v.currentTarget, E = { x: v.clientX, y: v.clientY }, C = _n(E, w.getBoundingClientRect()), x = Ln(E, C), P = $n(y.getBoundingClientRect()), R = In([...x, ...P]);
896
- c(R), m(!0);
2151
+ ), ar = u.forwardRef((e, t) => {
2152
+ const n = Oe(ne, e.__scopeTooltip), o = qe(ne, e.__scopeTooltip), r = u.useRef(null), i = ae(t, r), [s, c] = u.useState(null), { trigger: l, onClose: a } = n, f = r.current, { onPointerInTransitChange: d } = o, h = u.useCallback(() => {
2153
+ c(null), d(!1);
2154
+ }, [d]), p = u.useCallback(
2155
+ (m, g) => {
2156
+ const y = m.currentTarget, w = { x: m.clientX, y: m.clientY }, v = dr(w, y.getBoundingClientRect()), E = pr(w, v), x = hr(g.getBoundingClientRect()), C = gr([...E, ...x]);
2157
+ c(C), d(!0);
897
2158
  },
898
- [m]
2159
+ [d]
899
2160
  );
900
- return s.useEffect(() => () => h(), [h]), s.useEffect(() => {
901
- if (l && d) {
902
- const v = (w) => p(w, d), y = (w) => p(w, l);
903
- return l.addEventListener("pointerleave", v), d.addEventListener("pointerleave", y), () => {
904
- l.removeEventListener("pointerleave", v), d.removeEventListener("pointerleave", y);
2161
+ return u.useEffect(() => () => h(), [h]), u.useEffect(() => {
2162
+ if (l && f) {
2163
+ const m = (y) => p(y, f), g = (y) => p(y, l);
2164
+ return l.addEventListener("pointerleave", m), f.addEventListener("pointerleave", g), () => {
2165
+ l.removeEventListener("pointerleave", m), f.removeEventListener("pointerleave", g);
905
2166
  };
906
2167
  }
907
- }, [l, d, p, h]), s.useEffect(() => {
908
- if (a) {
909
- const v = (y) => {
910
- const w = y.target, E = { x: y.clientX, y: y.clientY }, C = (l == null ? void 0 : l.contains(w)) || (d == null ? void 0 : d.contains(w)), x = !Mn(E, a);
911
- C ? h() : x && (h(), u());
2168
+ }, [l, f, p, h]), u.useEffect(() => {
2169
+ if (s) {
2170
+ const m = (g) => {
2171
+ const y = g.target, w = { x: g.clientX, y: g.clientY }, v = (l == null ? void 0 : l.contains(y)) || (f == null ? void 0 : f.contains(y)), E = !mr(w, s);
2172
+ v ? h() : E && (h(), a());
912
2173
  };
913
- return document.addEventListener("pointermove", v), () => document.removeEventListener("pointermove", v);
2174
+ return document.addEventListener("pointermove", m), () => document.removeEventListener("pointermove", m);
914
2175
  }
915
- }, [l, d, a, u, h]), /* @__PURE__ */ f(Je, { ...e, ref: i });
916
- }), [Sn, Dn] = V(U, { isInside: !1 }), Je = s.forwardRef(
2176
+ }, [l, f, s, a, h]), /* @__PURE__ */ A(nn, { ...e, ref: i });
2177
+ }), [ur, fr] = Ae(Re, { isInside: !1 }), nn = u.forwardRef(
917
2178
  (e, t) => {
918
2179
  const {
919
2180
  __scopeTooltip: n,
920
2181
  children: o,
921
2182
  "aria-label": r,
922
2183
  onEscapeKeyDown: i,
923
- onPointerDownOutside: a,
2184
+ onPointerDownOutside: s,
924
2185
  ...c
925
- } = e, l = j(N, n), u = B(n), { onClose: d } = l;
926
- return s.useEffect(() => (document.addEventListener(K, d), () => document.removeEventListener(K, d)), [d]), s.useEffect(() => {
2186
+ } = e, l = Oe(ne, n), a = Pe(n), { onClose: f } = l;
2187
+ return u.useEffect(() => (document.addEventListener(We, f), () => document.removeEventListener(We, f)), [f]), u.useEffect(() => {
927
2188
  if (l.trigger) {
928
- const m = (h) => {
2189
+ const d = (h) => {
929
2190
  const p = h.target;
930
- p != null && p.contains(l.trigger) && d();
2191
+ p != null && p.contains(l.trigger) && f();
931
2192
  };
932
- return window.addEventListener("scroll", m, { capture: !0 }), () => window.removeEventListener("scroll", m, { capture: !0 });
2193
+ return window.addEventListener("scroll", d, { capture: !0 }), () => window.removeEventListener("scroll", d, { capture: !0 });
933
2194
  }
934
- }, [l.trigger, d]), /* @__PURE__ */ f(
935
- Ae,
2195
+ }, [l.trigger, f]), /* @__PURE__ */ A(
2196
+ Et,
936
2197
  {
937
2198
  asChild: !0,
938
2199
  disableOutsidePointerEvents: !1,
939
2200
  onEscapeKeyDown: i,
940
- onPointerDownOutside: a,
941
- onFocusOutside: (m) => m.preventDefault(),
942
- onDismiss: d,
943
- children: /* @__PURE__ */ Y(
944
- un,
2201
+ onPointerDownOutside: s,
2202
+ onFocusOutside: (d) => d.preventDefault(),
2203
+ onDismiss: f,
2204
+ children: /* @__PURE__ */ De(
2205
+ qo,
945
2206
  {
946
2207
  "data-state": l.stateAttribute,
947
- ...u,
2208
+ ...a,
948
2209
  ...c,
949
2210
  ref: t,
950
2211
  style: {
@@ -956,8 +2217,8 @@ var Tn = "TooltipPortal", [Xn, On] = V(Tn, {
956
2217
  "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
957
2218
  },
958
2219
  children: [
959
- /* @__PURE__ */ f(xe, { children: o }),
960
- /* @__PURE__ */ f(Sn, { scope: n, isInside: !0, children: /* @__PURE__ */ f(bn, { id: l.contentId, role: "tooltip", children: r || o }) })
2220
+ /* @__PURE__ */ A(bt, { children: o }),
2221
+ /* @__PURE__ */ A(ur, { scope: n, isInside: !0, children: /* @__PURE__ */ A(or, { id: l.contentId, role: "tooltip", children: r || o }) })
961
2222
  ]
962
2223
  }
963
2224
  )
@@ -965,18 +2226,18 @@ var Tn = "TooltipPortal", [Xn, On] = V(Tn, {
965
2226
  );
966
2227
  }
967
2228
  );
968
- Ke.displayName = N;
969
- var Qe = "TooltipArrow", et = s.forwardRef(
2229
+ tn.displayName = ne;
2230
+ var on = "TooltipArrow", rn = u.forwardRef(
970
2231
  (e, t) => {
971
- const { __scopeTooltip: n, ...o } = e, r = B(n);
972
- return Dn(
973
- Qe,
2232
+ const { __scopeTooltip: n, ...o } = e, r = Pe(n);
2233
+ return fr(
2234
+ on,
974
2235
  n
975
- ).isInside ? null : /* @__PURE__ */ f(dn, { ...r, ...o, ref: t });
2236
+ ).isInside ? null : /* @__PURE__ */ A(Ko, { ...r, ...o, ref: t });
976
2237
  }
977
2238
  );
978
- et.displayName = Qe;
979
- function _n(e, t) {
2239
+ rn.displayName = on;
2240
+ function dr(e, t) {
980
2241
  const n = Math.abs(t.top - e.y), o = Math.abs(t.bottom - e.y), r = Math.abs(t.right - e.x), i = Math.abs(t.left - e.x);
981
2242
  switch (Math.min(n, o, r, i)) {
982
2243
  case i:
@@ -991,7 +2252,7 @@ function _n(e, t) {
991
2252
  throw new Error("unreachable");
992
2253
  }
993
2254
  }
994
- function Ln(e, t, n = 5) {
2255
+ function pr(e, t, n = 5) {
995
2256
  const o = [];
996
2257
  switch (t) {
997
2258
  case "top":
@@ -1021,7 +2282,7 @@ function Ln(e, t, n = 5) {
1021
2282
  }
1022
2283
  return o;
1023
2284
  }
1024
- function $n(e) {
2285
+ function hr(e) {
1025
2286
  const { top: t, right: n, bottom: o, left: r } = e;
1026
2287
  return [
1027
2288
  { x: r, y: t },
@@ -1030,28 +2291,28 @@ function $n(e) {
1030
2291
  { x: r, y: o }
1031
2292
  ];
1032
2293
  }
1033
- function Mn(e, t) {
2294
+ function mr(e, t) {
1034
2295
  const { x: n, y: o } = e;
1035
2296
  let r = !1;
1036
- for (let i = 0, a = t.length - 1; i < t.length; a = i++) {
1037
- const c = t[i].x, l = t[i].y, u = t[a].x, d = t[a].y;
1038
- l > o != d > o && n < (u - c) * (o - l) / (d - l) + c && (r = !r);
2297
+ for (let i = 0, s = t.length - 1; i < t.length; s = i++) {
2298
+ const c = t[i].x, l = t[i].y, a = t[s].x, f = t[s].y;
2299
+ l > o != f > o && n < (a - c) * (o - l) / (f - l) + c && (r = !r);
1039
2300
  }
1040
2301
  return r;
1041
2302
  }
1042
- function In(e) {
2303
+ function gr(e) {
1043
2304
  const t = e.slice();
1044
- return t.sort((n, o) => n.x < o.x ? -1 : n.x > o.x ? 1 : n.y < o.y ? -1 : n.y > o.y ? 1 : 0), Wn(t);
2305
+ return t.sort((n, o) => n.x < o.x ? -1 : n.x > o.x ? 1 : n.y < o.y ? -1 : n.y > o.y ? 1 : 0), yr(t);
1045
2306
  }
1046
- function Wn(e) {
2307
+ function yr(e) {
1047
2308
  if (e.length <= 1)
1048
2309
  return e.slice();
1049
2310
  const t = [];
1050
2311
  for (let o = 0; o < e.length; o++) {
1051
2312
  const r = e[o];
1052
2313
  for (; t.length >= 2; ) {
1053
- const i = t[t.length - 1], a = t[t.length - 2];
1054
- if ((i.x - a.x) * (r.y - a.y) >= (i.y - a.y) * (r.x - a.x))
2314
+ const i = t[t.length - 1], s = t[t.length - 2];
2315
+ if ((i.x - s.x) * (r.y - s.y) >= (i.y - s.y) * (r.x - s.x))
1055
2316
  t.pop();
1056
2317
  else
1057
2318
  break;
@@ -1063,8 +2324,8 @@ function Wn(e) {
1063
2324
  for (let o = e.length - 1; o >= 0; o--) {
1064
2325
  const r = e[o];
1065
2326
  for (; n.length >= 2; ) {
1066
- const i = n[n.length - 1], a = n[n.length - 2];
1067
- if ((i.x - a.x) * (r.y - a.y) >= (i.y - a.y) * (r.x - a.x))
2327
+ const i = n[n.length - 1], s = n[n.length - 2];
2328
+ if ((i.x - s.x) * (r.y - s.y) >= (i.y - s.y) * (r.x - s.x))
1068
2329
  n.pop();
1069
2330
  else
1070
2331
  break;
@@ -1073,20 +2334,20 @@ function Wn(e) {
1073
2334
  }
1074
2335
  return n.pop(), t.length === 1 && n.length === 1 && t[0].x === n[0].x && t[0].y === n[0].y ? t : t.concat(n);
1075
2336
  }
1076
- const kn = "_tooltipContent_1i9ed_1", Hn = "_tooltipArrow_1i9ed_8", Fn = "_fadeIn_1i9ed_1", Ce = {
1077
- tooltipContent: kn,
1078
- tooltipArrow: Hn,
1079
- fadeIn: Fn
1080
- }, Vn = mt(
1081
- ({ children: e, content: t, className: n }, o) => /* @__PURE__ */ f(ze, { children: /* @__PURE__ */ Y(Ze, { delayDuration: 1e3, children: [
1082
- /* @__PURE__ */ f(qe, { asChild: !0, children: /* @__PURE__ */ f("div", { ref: o, className: n, children: e }) }),
1083
- /* @__PURE__ */ Y(Ke, { className: Ce.tooltipContent, sideOffset: 5, children: [
1084
- /* @__PURE__ */ f(et, { className: Ce.tooltipArrow }),
1085
- /* @__PURE__ */ f("span", { children: t })
2337
+ const wr = "_tooltipContent_1i9ed_1", vr = "_tooltipArrow_1i9ed_8", xr = "_fadeIn_1i9ed_1", mt = {
2338
+ tooltipContent: wr,
2339
+ tooltipArrow: vr,
2340
+ fadeIn: xr
2341
+ }, br = yn(
2342
+ ({ children: e, content: t, className: n }, o) => /* @__PURE__ */ A(Jt, { children: /* @__PURE__ */ De(Qt, { delayDuration: 1e3, children: [
2343
+ /* @__PURE__ */ A(en, { asChild: !0, children: /* @__PURE__ */ A("div", { ref: o, className: n, children: e }) }),
2344
+ /* @__PURE__ */ De(tn, { className: mt.tooltipContent, sideOffset: 5, children: [
2345
+ /* @__PURE__ */ A(rn, { className: mt.tooltipArrow }),
2346
+ /* @__PURE__ */ A("span", { children: t })
1086
2347
  ] })
1087
2348
  ] }) })
1088
2349
  );
1089
- Vn.displayName = "RPTooltip";
2350
+ br.displayName = "RPTooltip";
1090
2351
  export {
1091
- Vn as default
2352
+ br as default
1092
2353
  };