@pdf-viewer/react 1.11.0-beta.0 → 1.11.0-beta.1

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 (115) hide show
  1. package/dist/RotateTool.module-03987eba.js +6 -0
  2. package/dist/ToolbarLayout.module-9d258526.js +3394 -0
  3. package/dist/assets/ToolbarLayout.css +1 -1
  4. package/dist/components/RPController.js +1 -1
  5. package/dist/components/RPPages.js +2 -2
  6. package/dist/components/layout/LayoutContainer.js +2 -2
  7. package/dist/components/layout/RPDefaultLayout.js +2 -3
  8. package/dist/components/layout/RPLayout.js +2 -2
  9. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  10. package/dist/components/layout/sidebar/Thumbnail.js +2 -2
  11. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  12. package/dist/components/layout/toolbar/DocumentDialog.js +2 -2
  13. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  14. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  15. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  16. package/dist/components/layout/toolbar/MostPageTool.js +3 -3
  17. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  18. package/dist/components/layout/toolbar/Paginate.js +1 -1
  19. package/dist/components/layout/toolbar/PrintTool.js +2 -2
  20. package/dist/components/layout/toolbar/RPMenuItem.js +23 -0
  21. package/dist/components/layout/toolbar/RPMoreOptions.js +147 -0
  22. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  23. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  24. package/dist/components/layout/toolbar/RotateTool.js +20 -21
  25. package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
  26. package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
  27. package/dist/components/layout/toolbar/SearchTool.js +3 -3
  28. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  29. package/dist/components/layout/toolbar/ThumbnailTool.js +1 -1
  30. package/dist/components/layout/toolbar/ToolbarCustom.js +2 -2
  31. package/dist/components/layout/toolbar/ToolbarDefault.js +6 -3
  32. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  33. package/dist/components/layout/toolbar/ZoomTool.js +1 -1
  34. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +28 -0
  35. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
  36. package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
  37. package/dist/components/layout/toolbar/tools/NextPageTool.js +2 -2
  38. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
  39. package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
  40. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +17 -0
  41. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +25 -0
  42. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
  43. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +1 -1
  44. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +6 -3
  45. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +16 -0
  46. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +20 -0
  47. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +69 -0
  48. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +20 -0
  49. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +78 -0
  50. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +20 -0
  51. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +26 -0
  52. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +43 -0
  53. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +30 -0
  54. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +32 -0
  55. package/dist/components/page/AnnotationLayer.js +2 -2
  56. package/dist/components/page/CanvasLayer.js +2 -2
  57. package/dist/components/page/DualPage.js +1 -1
  58. package/dist/components/page/RPPage.js +2 -2
  59. package/dist/components/page/SinglePage.js +1 -1
  60. package/dist/components/page/TextHighlightLayer.js +2 -2
  61. package/dist/components/page/TextLayer.js +2 -2
  62. package/dist/components/ui/Checkbox.js +13 -14
  63. package/dist/components/ui/DropDown.js +1 -1
  64. package/dist/components/ui/LoadingIndicator.js +1 -1
  65. package/dist/components/ui/RPTooltip.js +329 -687
  66. package/dist/contexts/PaginationContext.js +1 -1
  67. package/dist/contexts/PrintContext.js +1 -1
  68. package/dist/contexts/RenderQueueProvider.js +1 -1
  69. package/dist/contexts/SearchContext.js +1 -1
  70. package/dist/contexts/ThumbnailsContext.js +1 -1
  71. package/dist/floating-ui.react-dom-88a86594.js +1447 -0
  72. package/dist/index-48ca3f30.js +307 -0
  73. package/dist/index-4ba3ab9a.js +1877 -0
  74. package/dist/main.js +29 -23
  75. package/dist/types/components/layout/toolbar/RPMenuItem.d.ts +11 -0
  76. package/dist/types/components/layout/toolbar/RPMoreOptions.d.ts +3 -0
  77. package/dist/types/components/layout/toolbar/tools/DocumentPropertiesTool.d.ts +3 -0
  78. package/dist/types/components/layout/toolbar/tools/RotateClockwiseTool.d.ts +3 -0
  79. package/dist/types/components/layout/toolbar/tools/RotateCounterclockwiseTool.d.ts +3 -0
  80. package/dist/types/components/layout/toolbar/tools/more-options/DocumentProperties.d.ts +3 -0
  81. package/dist/types/components/layout/toolbar/tools/more-options/FileDownloadTool.d.ts +3 -0
  82. package/dist/types/components/layout/toolbar/tools/more-options/FileUploadTool.d.ts +3 -0
  83. package/dist/types/components/layout/toolbar/tools/more-options/FullScreenTool.d.ts +3 -0
  84. package/dist/types/components/layout/toolbar/tools/more-options/MostPageTool.d.ts +3 -0
  85. package/dist/types/components/layout/toolbar/tools/more-options/PrintTool.d.ts +3 -0
  86. package/dist/types/components/layout/toolbar/tools/more-options/RotateTool.d.ts +3 -0
  87. package/dist/types/components/layout/toolbar/tools/more-options/ScrollModeTool.d.ts +3 -0
  88. package/dist/types/components/layout/toolbar/tools/more-options/SelectionModeTool.d.ts +3 -0
  89. package/dist/types/components/layout/toolbar/tools/more-options/ViewModeTool.d.ts +3 -0
  90. package/dist/types/contexts/SelectionModeContext.d.ts +2 -2
  91. package/dist/types/main.d.ts +4 -1
  92. package/dist/types/utils/calculatePage.d.ts +7 -0
  93. package/dist/types/utils/elementPagePosition.d.ts +17 -0
  94. package/dist/types/utils/getWordPositionInPage.d.ts +2 -2
  95. package/dist/types/utils/hooks/useVirtualReactWindow.d.ts +8 -0
  96. package/dist/types/utils/types.d.ts +85 -7
  97. package/dist/utils/calculatePage.js +12 -5
  98. package/dist/utils/elementPagePosition.js +11 -0
  99. package/dist/utils/getScrollDistance.js +2 -2
  100. package/dist/utils/getZoomLevel.js +7 -7
  101. package/dist/utils/hooks/useFileDownload.js +2 -2
  102. package/dist/utils/hooks/useLicense.js +1 -1
  103. package/dist/utils/hooks/usePaginate.js +2 -2
  104. package/dist/utils/hooks/usePresentPage.js +2 -2
  105. package/dist/utils/hooks/usePrint.js +2 -2
  106. package/dist/utils/hooks/useScrollToPage.js +4 -3
  107. package/dist/utils/hooks/useSearch.js +2 -2
  108. package/dist/utils/hooks/useThumbnail.js +2 -2
  109. package/dist/utils/hooks/useVirtualReactWindow.js +4 -3
  110. package/package.json +1 -1
  111. package/dist/ToolbarLayout.module-310f3470.js +0 -3368
  112. package/dist/floating-ui.react-dom-bbd2b1a7.js +0 -1330
  113. package/dist/index-54351a14.js +0 -1995
  114. package/dist/index-94df4e25.js +0 -139
  115. package/dist/index-e620205e.js +0 -172
@@ -1,354 +1,143 @@
1
- import { jsx as f, Fragment as ve, jsxs as Y } from "react/jsx-runtime";
2
- import * as s from "react";
3
- import { d as K, c as ye, a as it, b as H, u as st } from "../../index-94df4e25.js";
4
- import * as at from "react-dom";
5
- import { u as lt, a as ct, b as ut, o as dt, s as ft, f as pt, c as ht, d as mt, h as vt, l as yt, e as gt } from "../../floating-ui.react-dom-bbd2b1a7.js";
6
- import { withRef as wt } from "../../utils/withRef.js";
7
- import '../../assets/RPTooltip.css';function A(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
8
- return function(r) {
9
- if (e == null || e(r), n === !1 || !r.defaultPrevented)
10
- return t == null ? void 0 : t(r);
11
- };
12
- }
13
- function de(e, t) {
14
- if (typeof e == "function")
15
- return e(t);
16
- e != null && (e.current = t);
17
- }
18
- function ge(...e) {
19
- return (t) => {
20
- let n = !1;
21
- const o = e.map((r) => {
22
- const i = de(r, t);
23
- return !n && typeof i == "function" && (n = !0), i;
24
- });
25
- if (n)
26
- return () => {
27
- for (let r = 0; r < o.length; r++) {
28
- const i = o[r];
29
- typeof i == "function" ? i() : de(e[r], null);
30
- }
31
- };
32
- };
33
- }
34
- function O(...e) {
35
- return s.useCallback(ge(...e), e);
36
- }
37
- var we = s.forwardRef((e, t) => {
38
- const { children: n, ...o } = e, r = s.Children.toArray(n), i = r.find(Ct);
39
- if (i) {
40
- const a = i.props.children, d = 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, d) : null });
42
- }
43
- return /* @__PURE__ */ f(G, { ...o, ref: t, children: n });
44
- });
45
- we.displayName = "Slot";
46
- var G = s.forwardRef((e, t) => {
47
- const { children: n, ...o } = e;
48
- if (s.isValidElement(n)) {
49
- const r = Et(n), i = Pt(o, n.props);
50
- return n.type !== s.Fragment && (i.ref = t ? ge(t, r) : r), s.cloneElement(n, i);
51
- }
52
- return s.Children.count(n) > 1 ? s.Children.only(null) : null;
53
- });
54
- G.displayName = "SlotClone";
55
- var Ce = ({ children: e }) => /* @__PURE__ */ f(ve, { children: e });
56
- function Ct(e) {
57
- return s.isValidElement(e) && e.type === Ce;
58
- }
59
- function Pt(e, t) {
60
- const n = { ...t };
61
- for (const o in t) {
62
- const r = e[o], i = t[o];
63
- /^on[A-Z]/.test(o) ? r && i ? n[o] = (...d) => {
64
- i(...d), r(...d);
65
- } : r && (n[o] = r) : o === "style" ? n[o] = { ...r, ...i } : o === "className" && (n[o] = [r, i].filter(Boolean).join(" "));
66
- }
67
- return { ...e, ...n };
68
- }
69
- function Et(e) {
70
- var o, r;
71
- let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
72
- 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
- }
74
- var bt = [
75
- "a",
76
- "button",
77
- "div",
78
- "form",
79
- "h2",
80
- "h3",
81
- "img",
82
- "input",
83
- "label",
84
- "li",
85
- "nav",
86
- "ol",
87
- "p",
88
- "span",
89
- "svg",
90
- "ul"
91
- ], S = bt.reduce((e, t) => {
92
- const n = s.forwardRef((o, r) => {
93
- const { asChild: i, ...a } = o, d = i ? we : t;
94
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ f(d, { ...a, ref: r });
95
- });
96
- return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
97
- }, {});
98
- function xt(e, t) {
99
- e && at.flushSync(() => e.dispatchEvent(t));
100
- }
101
- var Tt = "DismissableLayer", X = "dismissableLayer.update", At = "dismissableLayer.pointerDownOutside", Rt = "dismissableLayer.focusOutside", fe, Pe = s.createContext({
102
- layers: /* @__PURE__ */ new Set(),
103
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
104
- branches: /* @__PURE__ */ new Set()
105
- }), Ee = s.forwardRef(
106
- (e, t) => {
107
- const {
108
- disableOutsidePointerEvents: n = !1,
109
- onEscapeKeyDown: o,
110
- onPointerDownOutside: r,
111
- onFocusOutside: i,
112
- onInteractOutside: a,
113
- onDismiss: d,
114
- ...l
115
- } = e, c = s.useContext(Pe), [u, h] = s.useState(null), m = (u == null ? void 0 : u.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, p] = s.useState({}), v = O(t, (g) => h(g)), y = Array.from(c.layers), [w] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), P = y.indexOf(w), C = u ? y.indexOf(u) : -1, x = c.layersWithOutsidePointerEventsDisabled.size > 0, E = C >= P, T = Dt((g) => {
116
- const R = g.target, M = [...c.branches].some((_) => _.contains(R));
117
- !E || M || (r == null || r(g), a == null || a(g), g.defaultPrevented || d == null || d());
118
- }, m), b = St((g) => {
119
- const R = g.target;
120
- [...c.branches].some((_) => _.contains(R)) || (i == null || i(g), a == null || a(g), g.defaultPrevented || d == null || d());
121
- }, m);
122
- return lt((g) => {
123
- C === c.layers.size - 1 && (o == null || o(g), !g.defaultPrevented && d && (g.preventDefault(), d()));
124
- }, m), s.useEffect(() => {
125
- if (u)
126
- return n && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (fe = m.body.style.pointerEvents, m.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(u)), c.layers.add(u), pe(), () => {
127
- n && c.layersWithOutsidePointerEventsDisabled.size === 1 && (m.body.style.pointerEvents = fe);
128
- };
129
- }, [u, m, n, c]), s.useEffect(() => () => {
130
- u && (c.layers.delete(u), c.layersWithOutsidePointerEventsDisabled.delete(u), pe());
131
- }, [u, c]), s.useEffect(() => {
132
- const g = () => p({});
133
- return document.addEventListener(X, g), () => document.removeEventListener(X, g);
134
- }, []), /* @__PURE__ */ f(
135
- S.div,
136
- {
137
- ...l,
138
- ref: v,
139
- style: {
140
- pointerEvents: x ? E ? "auto" : "none" : void 0,
141
- ...e.style
142
- },
143
- onFocusCapture: A(e.onFocusCapture, b.onFocusCapture),
144
- onBlurCapture: A(e.onBlurCapture, b.onBlurCapture),
145
- onPointerDownCapture: A(
146
- e.onPointerDownCapture,
147
- T.onPointerDownCapture
148
- )
149
- }
150
- );
151
- }
152
- );
153
- Ee.displayName = Tt;
154
- var Ot = "DismissableLayerBranch", Nt = s.forwardRef((e, t) => {
155
- const n = s.useContext(Pe), o = s.useRef(null), r = O(t, o);
156
- return s.useEffect(() => {
157
- const i = o.current;
158
- if (i)
159
- return n.branches.add(i), () => {
160
- n.branches.delete(i);
161
- };
162
- }, [n.branches]), /* @__PURE__ */ f(S.div, { ...e, ref: r });
163
- });
164
- Nt.displayName = Ot;
165
- function Dt(e, t = globalThis == null ? void 0 : globalThis.document) {
166
- const n = K(e), o = s.useRef(!1), r = s.useRef(() => {
167
- });
168
- return s.useEffect(() => {
169
- const i = (d) => {
170
- if (d.target && !o.current) {
171
- let l = function() {
172
- be(
173
- At,
174
- n,
175
- c,
176
- { discrete: !0 }
177
- );
178
- };
179
- const c = { originalEvent: d };
180
- d.pointerType === "touch" ? (t.removeEventListener("click", r.current), r.current = l, t.addEventListener("click", r.current, { once: !0 })) : l();
181
- } else
182
- t.removeEventListener("click", r.current);
183
- o.current = !1;
184
- }, a = window.setTimeout(() => {
185
- t.addEventListener("pointerdown", i);
186
- }, 0);
187
- return () => {
188
- window.clearTimeout(a), t.removeEventListener("pointerdown", i), t.removeEventListener("click", r.current);
189
- };
190
- }, [t, n]), {
191
- // ensures we check React component tree (not just DOM tree)
192
- onPointerDownCapture: () => o.current = !0
193
- };
194
- }
195
- function St(e, t = globalThis == null ? void 0 : globalThis.document) {
196
- const n = K(e), o = s.useRef(!1);
197
- return s.useEffect(() => {
198
- const r = (i) => {
199
- i.target && !o.current && be(Rt, n, { originalEvent: i }, {
200
- discrete: !1
201
- });
202
- };
203
- return t.addEventListener("focusin", r), () => t.removeEventListener("focusin", r);
204
- }, [t, n]), {
205
- onFocusCapture: () => o.current = !0,
206
- onBlurCapture: () => o.current = !1
207
- };
208
- }
209
- function pe() {
210
- const e = new CustomEvent(X);
211
- document.dispatchEvent(e);
212
- }
213
- function be(e, t, n, { discrete: o }) {
214
- const r = n.originalEvent.target, i = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
215
- t && r.addEventListener(e, t, { once: !0 }), o ? xt(r, i) : r.dispatchEvent(i);
216
- }
217
- var _t = "Arrow", xe = s.forwardRef((e, t) => {
218
- const { children: n, width: o = 10, height: r = 5, ...i } = e;
219
- return /* @__PURE__ */ f(
220
- S.svg,
1
+ import { jsx as d, jsxs as j } from "react/jsx-runtime";
2
+ import * as a from "react";
3
+ import { P as O, c as ae, u as k, e as We, f as Ye, g as oe, a as Be, b as E, d as Ge, S as Xe } from "../../index-48ca3f30.js";
4
+ import { u as Ve, a as Ue, o as qe, s as ze, f as Ze, b as Ke, c as Je, h as Qe, l as et, d as tt, D as rt } from "../../floating-ui.react-dom-88a86594.js";
5
+ import { withRef as ot } from "../../utils/withRef.js";
6
+ import '../../assets/RPTooltip.css';var nt = "Arrow", se = a.forwardRef((e, r) => {
7
+ const { children: t, width: o = 10, height: n = 5, ...s } = e;
8
+ return /* @__PURE__ */ d(
9
+ O.svg,
221
10
  {
222
- ...i,
223
- ref: t,
11
+ ...s,
12
+ ref: r,
224
13
  width: o,
225
- height: r,
14
+ height: n,
226
15
  viewBox: "0 0 30 10",
227
16
  preserveAspectRatio: "none",
228
- children: e.asChild ? n : /* @__PURE__ */ f("polygon", { points: "0,0 30,0 15,10" })
17
+ children: e.asChild ? t : /* @__PURE__ */ d("polygon", { points: "0,0 30,0 15,10" })
229
18
  }
230
19
  );
231
20
  });
232
- xe.displayName = _t;
233
- var Lt = xe, J = "Popper", [Te, Ae] = ye(J), [Mt, Re] = Te(J), Oe = (e) => {
234
- const { __scopePopper: t, children: n } = e, [o, r] = s.useState(null);
235
- return /* @__PURE__ */ f(Mt, { scope: t, anchor: o, onAnchorChange: r, children: n });
21
+ se.displayName = nt;
22
+ var at = se, B = "Popper", [ie, le] = ae(B), [st, ce] = ie(B), de = (e) => {
23
+ const { __scopePopper: r, children: t } = e, [o, n] = a.useState(null);
24
+ return /* @__PURE__ */ d(st, { scope: r, anchor: o, onAnchorChange: n, children: t });
236
25
  };
237
- Oe.displayName = J;
238
- var Ne = "PopperAnchor", De = s.forwardRef(
239
- (e, t) => {
240
- const { __scopePopper: n, virtualRef: o, ...r } = e, i = Re(Ne, n), a = s.useRef(null), d = O(t, a);
241
- return s.useEffect(() => {
242
- i.onAnchorChange((o == null ? void 0 : o.current) || a.current);
243
- }), o ? null : /* @__PURE__ */ f(S.div, { ...r, ref: d });
26
+ de.displayName = B;
27
+ var pe = "PopperAnchor", ue = a.forwardRef(
28
+ (e, r) => {
29
+ const { __scopePopper: t, virtualRef: o, ...n } = e, s = ce(pe, t), i = a.useRef(null), h = k(r, i);
30
+ return a.useEffect(() => {
31
+ s.onAnchorChange((o == null ? void 0 : o.current) || i.current);
32
+ }), o ? null : /* @__PURE__ */ d(O.div, { ...n, ref: h });
244
33
  }
245
34
  );
246
- De.displayName = Ne;
247
- var Q = "PopperContent", [It, Wt] = Te(Q), Se = s.forwardRef(
248
- (e, t) => {
249
- var oe, ie, se, ae, le, ce;
35
+ ue.displayName = pe;
36
+ var G = "PopperContent", [it, lt] = ie(G), fe = a.forwardRef(
37
+ (e, r) => {
38
+ var Z, K, J, Q, ee, te;
250
39
  const {
251
- __scopePopper: n,
40
+ __scopePopper: t,
252
41
  side: o = "bottom",
253
- sideOffset: r = 0,
254
- align: i = "center",
255
- alignOffset: a = 0,
256
- arrowPadding: d = 0,
42
+ sideOffset: n = 0,
43
+ align: s = "center",
44
+ alignOffset: i = 0,
45
+ arrowPadding: h = 0,
257
46
  avoidCollisions: l = !0,
258
- collisionBoundary: c = [],
259
- collisionPadding: u = 0,
260
- sticky: h = "partial",
261
- hideWhenDetached: m = !1,
262
- updatePositionStrategy: p = "optimized",
47
+ collisionBoundary: p = [],
48
+ collisionPadding: c = 0,
49
+ sticky: f = "partial",
50
+ hideWhenDetached: y = !1,
51
+ updatePositionStrategy: u = "optimized",
263
52
  onPlaced: v,
264
- ...y
265
- } = e, w = Re(Q, n), [P, C] = s.useState(null), x = O(t, (L) => C(L)), [E, T] = s.useState(null), b = it(E), g = (b == null ? void 0 : b.width) ?? 0, R = (b == null ? void 0 : b.height) ?? 0, M = o + (i !== "center" ? "-" + i : ""), _ = typeof u == "number" ? u : { top: 0, right: 0, bottom: 0, left: 0, ...u }, te = Array.isArray(c) ? c : [c], Ge = te.length > 0, I = {
266
- padding: _,
267
- boundary: te.filter($t),
53
+ ...g
54
+ } = e, m = ce(G, t), [w, x] = a.useState(null), T = k(r, (_) => x(_)), [C, b] = a.useState(null), P = We(C), N = (P == null ? void 0 : P.width) ?? 0, V = (P == null ? void 0 : P.height) ?? 0, Ee = o + (s !== "center" ? "-" + s : ""), Re = typeof c == "number" ? c : { top: 0, right: 0, bottom: 0, left: 0, ...c }, U = Array.isArray(p) ? p : [p], _e = U.length > 0, S = {
55
+ padding: Re,
56
+ boundary: U.filter(dt),
268
57
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
269
- altBoundary: Ge
270
- }, { refs: Xe, floatingStyles: ne, placement: ze, isPositioned: W, middlewareData: N } = ct({
58
+ altBoundary: _e
59
+ }, { refs: Oe, floatingStyles: q, placement: Ne, isPositioned: D, middlewareData: A } = Ve({
271
60
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
272
61
  strategy: "fixed",
273
- placement: M,
274
- whileElementsMounted: (...L) => ut(...L, {
275
- animationFrame: p === "always"
62
+ placement: Ee,
63
+ whileElementsMounted: (..._) => Ue(..._, {
64
+ animationFrame: u === "always"
276
65
  }),
277
66
  elements: {
278
- reference: w.anchor
67
+ reference: m.anchor
279
68
  },
280
69
  middleware: [
281
- dt({ mainAxis: r + R, alignmentAxis: a }),
282
- l && ft({
70
+ qe({ mainAxis: n + V, alignmentAxis: i }),
71
+ l && ze({
283
72
  mainAxis: !0,
284
73
  crossAxis: !1,
285
- limiter: h === "partial" ? yt() : void 0,
286
- ...I
74
+ limiter: f === "partial" ? et() : void 0,
75
+ ...S
287
76
  }),
288
- l && pt({ ...I }),
289
- ht({
290
- ...I,
291
- apply: ({ elements: L, rects: ue, availableWidth: tt, availableHeight: nt }) => {
292
- const { width: rt, height: ot } = ue.reference, $ = L.floating.style;
293
- $.setProperty("--radix-popper-available-width", `${tt}px`), $.setProperty("--radix-popper-available-height", `${nt}px`), $.setProperty("--radix-popper-anchor-width", `${rt}px`), $.setProperty("--radix-popper-anchor-height", `${ot}px`);
77
+ l && Ze({ ...S }),
78
+ Ke({
79
+ ...S,
80
+ apply: ({ elements: _, rects: re, availableWidth: Me, availableHeight: $e }) => {
81
+ const { width: Fe, height: je } = re.reference, I = _.floating.style;
82
+ I.setProperty("--radix-popper-available-width", `${Me}px`), I.setProperty("--radix-popper-available-height", `${$e}px`), I.setProperty("--radix-popper-anchor-width", `${Fe}px`), I.setProperty("--radix-popper-anchor-height", `${je}px`);
294
83
  }
295
84
  }),
296
- E && mt({ element: E, padding: d }),
297
- Ft({ arrowWidth: g, arrowHeight: R }),
298
- m && vt({ strategy: "referenceHidden", ...I })
85
+ C && Je({ element: C, padding: h }),
86
+ pt({ arrowWidth: N, arrowHeight: V }),
87
+ y && Qe({ strategy: "referenceHidden", ...S })
299
88
  ]
300
- }), [re, Ze] = Me(ze), k = K(v);
301
- H(() => {
302
- W && (k == null || k());
303
- }, [W, k]);
304
- const qe = (oe = N.arrow) == null ? void 0 : oe.x, Ke = (ie = N.arrow) == null ? void 0 : ie.y, Je = ((se = N.arrow) == null ? void 0 : se.centerOffset) !== 0, [Qe, et] = s.useState();
305
- return H(() => {
306
- P && et(window.getComputedStyle(P).zIndex);
307
- }, [P]), /* @__PURE__ */ f(
89
+ }), [z, Se] = ge(Ne), H = Ye(v);
90
+ oe(() => {
91
+ D && (H == null || H());
92
+ }, [D, H]);
93
+ const De = (Z = A.arrow) == null ? void 0 : Z.x, He = (K = A.arrow) == null ? void 0 : K.y, Ie = ((J = A.arrow) == null ? void 0 : J.centerOffset) !== 0, [ke, Le] = a.useState();
94
+ return oe(() => {
95
+ w && Le(window.getComputedStyle(w).zIndex);
96
+ }, [w]), /* @__PURE__ */ d(
308
97
  "div",
309
98
  {
310
- ref: Xe.setFloating,
99
+ ref: Oe.setFloating,
311
100
  "data-radix-popper-content-wrapper": "",
312
101
  style: {
313
- ...ne,
314
- transform: W ? ne.transform : "translate(0, -200%)",
102
+ ...q,
103
+ transform: D ? q.transform : "translate(0, -200%)",
315
104
  // keep off the page when measuring
316
105
  minWidth: "max-content",
317
- zIndex: Qe,
106
+ zIndex: ke,
318
107
  "--radix-popper-transform-origin": [
319
- (ae = N.transformOrigin) == null ? void 0 : ae.x,
320
- (le = N.transformOrigin) == null ? void 0 : le.y
108
+ (Q = A.transformOrigin) == null ? void 0 : Q.x,
109
+ (ee = A.transformOrigin) == null ? void 0 : ee.y
321
110
  ].join(" "),
322
111
  // hide the content if using the hide middleware and should be hidden
323
112
  // set visibility to hidden and disable pointer events so the UI behaves
324
113
  // as if the PopperContent isn't there at all
325
- ...((ce = N.hide) == null ? void 0 : ce.referenceHidden) && {
114
+ ...((te = A.hide) == null ? void 0 : te.referenceHidden) && {
326
115
  visibility: "hidden",
327
116
  pointerEvents: "none"
328
117
  }
329
118
  },
330
119
  dir: e.dir,
331
- children: /* @__PURE__ */ f(
332
- It,
120
+ children: /* @__PURE__ */ d(
121
+ it,
333
122
  {
334
- scope: n,
335
- placedSide: re,
336
- onArrowChange: T,
337
- arrowX: qe,
338
- arrowY: Ke,
339
- shouldHideArrow: Je,
340
- children: /* @__PURE__ */ f(
341
- S.div,
123
+ scope: t,
124
+ placedSide: z,
125
+ onArrowChange: b,
126
+ arrowX: De,
127
+ arrowY: He,
128
+ shouldHideArrow: Ie,
129
+ children: /* @__PURE__ */ d(
130
+ O.div,
342
131
  {
343
- "data-side": re,
344
- "data-align": Ze,
345
- ...y,
346
- ref: x,
132
+ "data-side": z,
133
+ "data-align": Se,
134
+ ...g,
135
+ ref: T,
347
136
  style: {
348
- ...y.style,
137
+ ...g.style,
349
138
  // if the PopperContent hasn't been placed yet (not all measurements done)
350
139
  // we prevent animations so that users's animation don't kick in too early referring wrong sides
351
- animation: W ? void 0 : "none"
140
+ animation: D ? void 0 : "none"
352
141
  }
353
142
  }
354
143
  )
@@ -358,48 +147,48 @@ var Q = "PopperContent", [It, Wt] = Te(Q), Se = s.forwardRef(
358
147
  );
359
148
  }
360
149
  );
361
- Se.displayName = Q;
362
- var _e = "PopperArrow", kt = {
150
+ fe.displayName = G;
151
+ var he = "PopperArrow", ct = {
363
152
  top: "bottom",
364
153
  right: "left",
365
154
  bottom: "top",
366
155
  left: "right"
367
- }, Le = s.forwardRef(function(t, n) {
368
- const { __scopePopper: o, ...r } = t, i = Wt(_e, o), a = kt[i.placedSide];
156
+ }, ve = a.forwardRef(function(r, t) {
157
+ const { __scopePopper: o, ...n } = r, s = lt(he, o), i = ct[s.placedSide];
369
158
  return (
370
159
  // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
371
160
  // doesn't report size as we'd expect on SVG elements.
372
161
  // it reports their bounding box which is effectively the largest path inside the SVG.
373
- /* @__PURE__ */ f(
162
+ /* @__PURE__ */ d(
374
163
  "span",
375
164
  {
376
- ref: i.onArrowChange,
165
+ ref: s.onArrowChange,
377
166
  style: {
378
167
  position: "absolute",
379
- left: i.arrowX,
380
- top: i.arrowY,
381
- [a]: 0,
168
+ left: s.arrowX,
169
+ top: s.arrowY,
170
+ [i]: 0,
382
171
  transformOrigin: {
383
172
  top: "",
384
173
  right: "0 0",
385
174
  bottom: "center 0",
386
175
  left: "100% 0"
387
- }[i.placedSide],
176
+ }[s.placedSide],
388
177
  transform: {
389
178
  top: "translateY(100%)",
390
179
  right: "translateY(50%) rotate(90deg) translateX(-50%)",
391
180
  bottom: "rotate(180deg)",
392
181
  left: "translateY(50%) rotate(-90deg) translateX(50%)"
393
- }[i.placedSide],
394
- visibility: i.shouldHideArrow ? "hidden" : void 0
182
+ }[s.placedSide],
183
+ visibility: s.shouldHideArrow ? "hidden" : void 0
395
184
  },
396
- children: /* @__PURE__ */ f(
397
- Lt,
185
+ children: /* @__PURE__ */ d(
186
+ at,
398
187
  {
399
- ...r,
400
- ref: n,
188
+ ...n,
189
+ ref: t,
401
190
  style: {
402
- ...r.style,
191
+ ...n.style,
403
192
  // ensures the element can be measured correctly (mostly for if SVG)
404
193
  display: "block"
405
194
  }
@@ -409,177 +198,30 @@ var _e = "PopperArrow", kt = {
409
198
  )
410
199
  );
411
200
  });
412
- Le.displayName = _e;
413
- function $t(e) {
201
+ ve.displayName = he;
202
+ function dt(e) {
414
203
  return e !== null;
415
204
  }
416
- var Ft = (e) => ({
205
+ var pt = (e) => ({
417
206
  name: "transformOrigin",
418
207
  options: e,
419
- fn(t) {
420
- var w, P, C;
421
- const { placement: n, rects: o, middlewareData: r } = t, a = ((w = r.arrow) == null ? void 0 : w.centerOffset) !== 0, d = a ? 0 : e.arrowWidth, l = a ? 0 : e.arrowHeight, [c, u] = Me(n), h = { start: "0%", center: "50%", end: "100%" }[u], m = (((P = r.arrow) == null ? void 0 : P.x) ?? 0) + d / 2, p = (((C = r.arrow) == null ? void 0 : C.y) ?? 0) + l / 2;
422
- let v = "", y = "";
423
- return c === "bottom" ? (v = a ? h : `${m}px`, y = `${-l}px`) : c === "top" ? (v = a ? h : `${m}px`, y = `${o.floating.height + l}px`) : c === "right" ? (v = `${-l}px`, y = a ? h : `${p}px`) : c === "left" && (v = `${o.floating.width + l}px`, y = a ? h : `${p}px`), { data: { x: v, y } };
208
+ fn(r) {
209
+ var m, w, x;
210
+ const { placement: t, rects: o, middlewareData: n } = r, i = ((m = n.arrow) == null ? void 0 : m.centerOffset) !== 0, h = i ? 0 : e.arrowWidth, l = i ? 0 : e.arrowHeight, [p, c] = ge(t), f = { start: "0%", center: "50%", end: "100%" }[c], y = (((w = n.arrow) == null ? void 0 : w.x) ?? 0) + h / 2, u = (((x = n.arrow) == null ? void 0 : x.y) ?? 0) + l / 2;
211
+ let v = "", g = "";
212
+ return p === "bottom" ? (v = i ? f : `${y}px`, g = `${-l}px`) : p === "top" ? (v = i ? f : `${y}px`, g = `${o.floating.height + l}px`) : p === "right" ? (v = `${-l}px`, g = i ? f : `${u}px`) : p === "left" && (v = `${o.floating.width + l}px`, g = i ? f : `${u}px`), { data: { x: v, y: g } };
424
213
  }
425
214
  });
426
- function Me(e) {
427
- const [t, n = "center"] = e.split("-");
428
- return [t, n];
215
+ function ge(e) {
216
+ const [r, t = "center"] = e.split("-");
217
+ return [r, t];
429
218
  }
430
- var Ht = Oe, Bt = De, Ut = Se, Vt = Le;
431
- function jt(e, t) {
432
- return s.useReducer((n, o) => t[n][o] ?? n, e);
433
- }
434
- var Ie = (e) => {
435
- const { present: t, children: n } = e, o = Yt(t), r = typeof n == "function" ? n({ present: o.isPresent }) : s.Children.only(n), i = O(o.ref, Gt(r));
436
- return typeof n == "function" || o.isPresent ? s.cloneElement(r, { ref: i }) : null;
437
- };
438
- Ie.displayName = "Presence";
439
- function Yt(e) {
440
- const [t, n] = s.useState(), o = s.useRef({}), r = s.useRef(e), i = s.useRef("none"), a = e ? "mounted" : "unmounted", [d, l] = jt(a, {
441
- mounted: {
442
- UNMOUNT: "unmounted",
443
- ANIMATION_OUT: "unmountSuspended"
444
- },
445
- unmountSuspended: {
446
- MOUNT: "mounted",
447
- ANIMATION_END: "unmounted"
448
- },
449
- unmounted: {
450
- MOUNT: "mounted"
451
- }
452
- });
453
- return s.useEffect(() => {
454
- const c = F(o.current);
455
- i.current = d === "mounted" ? c : "none";
456
- }, [d]), H(() => {
457
- const c = o.current, u = r.current;
458
- if (u !== e) {
459
- const m = i.current, p = F(c);
460
- e ? l("MOUNT") : p === "none" || (c == null ? void 0 : c.display) === "none" ? l("UNMOUNT") : l(u && m !== p ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
461
- }
462
- }, [e, l]), H(() => {
463
- if (t) {
464
- let c;
465
- const u = t.ownerDocument.defaultView ?? window, h = (p) => {
466
- const y = F(o.current).includes(p.animationName);
467
- if (p.target === t && y && (l("ANIMATION_END"), !r.current)) {
468
- const w = t.style.animationFillMode;
469
- t.style.animationFillMode = "forwards", c = u.setTimeout(() => {
470
- t.style.animationFillMode === "forwards" && (t.style.animationFillMode = w);
471
- });
472
- }
473
- }, m = (p) => {
474
- p.target === t && (i.current = F(o.current));
475
- };
476
- return t.addEventListener("animationstart", m), t.addEventListener("animationcancel", h), t.addEventListener("animationend", h), () => {
477
- u.clearTimeout(c), t.removeEventListener("animationstart", m), t.removeEventListener("animationcancel", h), t.removeEventListener("animationend", h);
478
- };
479
- } else
480
- l("ANIMATION_END");
481
- }, [t, l]), {
482
- isPresent: ["mounted", "unmountSuspended"].includes(d),
483
- ref: s.useCallback((c) => {
484
- c && (o.current = getComputedStyle(c)), n(c);
485
- }, [])
486
- };
487
- }
488
- function F(e) {
489
- return (e == null ? void 0 : e.animationName) || "none";
490
- }
491
- function Gt(e) {
492
- var o, r;
493
- let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
494
- 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);
495
- }
496
- function he(e, t) {
497
- if (typeof e == "function")
498
- return e(t);
499
- e != null && (e.current = t);
500
- }
501
- function Xt(...e) {
502
- return (t) => {
503
- let n = !1;
504
- const o = e.map((r) => {
505
- const i = he(r, t);
506
- return !n && typeof i == "function" && (n = !0), i;
507
- });
508
- if (n)
509
- return () => {
510
- for (let r = 0; r < o.length; r++) {
511
- const i = o[r];
512
- typeof i == "function" ? i() : he(e[r], null);
513
- }
514
- };
515
- };
516
- }
517
- var We = s.forwardRef((e, t) => {
518
- const { children: n, ...o } = e, r = s.Children.toArray(n), i = r.find(Zt);
519
- if (i) {
520
- const a = i.props.children, d = r.map((l) => l === i ? s.Children.count(a) > 1 ? s.Children.only(null) : s.isValidElement(a) ? a.props.children : null : l);
521
- return /* @__PURE__ */ f(z, { ...o, ref: t, children: s.isValidElement(a) ? s.cloneElement(a, void 0, d) : null });
522
- }
523
- return /* @__PURE__ */ f(z, { ...o, ref: t, children: n });
524
- });
525
- We.displayName = "Slot";
526
- var z = s.forwardRef((e, t) => {
527
- const { children: n, ...o } = e;
528
- if (s.isValidElement(n)) {
529
- const r = Kt(n), i = qt(o, n.props);
530
- return n.type !== s.Fragment && (i.ref = t ? Xt(t, r) : r), s.cloneElement(n, i);
531
- }
532
- return s.Children.count(n) > 1 ? s.Children.only(null) : null;
533
- });
534
- z.displayName = "SlotClone";
535
- var zt = ({ children: e }) => /* @__PURE__ */ f(ve, { children: e });
536
- function Zt(e) {
537
- return s.isValidElement(e) && e.type === zt;
538
- }
539
- function qt(e, t) {
540
- const n = { ...t };
541
- for (const o in t) {
542
- const r = e[o], i = t[o];
543
- /^on[A-Z]/.test(o) ? r && i ? n[o] = (...d) => {
544
- i(...d), r(...d);
545
- } : r && (n[o] = r) : o === "style" ? n[o] = { ...r, ...i } : o === "className" && (n[o] = [r, i].filter(Boolean).join(" "));
546
- }
547
- return { ...e, ...n };
548
- }
549
- function Kt(e) {
550
- var o, r;
551
- let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
552
- 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);
553
- }
554
- var Jt = [
555
- "a",
556
- "button",
557
- "div",
558
- "form",
559
- "h2",
560
- "h3",
561
- "img",
562
- "input",
563
- "label",
564
- "li",
565
- "nav",
566
- "ol",
567
- "p",
568
- "span",
569
- "svg",
570
- "ul"
571
- ], Qt = Jt.reduce((e, t) => {
572
- const n = s.forwardRef((o, r) => {
573
- const { asChild: i, ...a } = o, d = i ? We : t;
574
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ f(d, { ...a, ref: r });
575
- });
576
- return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
577
- }, {}), en = "VisuallyHidden", ke = s.forwardRef(
578
- (e, t) => /* @__PURE__ */ f(
579
- Qt.span,
219
+ var ut = de, ft = ue, ht = fe, vt = ve, gt = "VisuallyHidden", ye = a.forwardRef(
220
+ (e, r) => /* @__PURE__ */ d(
221
+ O.span,
580
222
  {
581
223
  ...e,
582
- ref: t,
224
+ ref: r,
583
225
  style: {
584
226
  // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
585
227
  position: "absolute",
@@ -597,192 +239,192 @@ var Jt = [
597
239
  }
598
240
  )
599
241
  );
600
- ke.displayName = en;
601
- var tn = ke, [B, xn] = ye("Tooltip", [
602
- Ae
603
- ]), U = Ae(), $e = "TooltipProvider", nn = 700, Z = "tooltip.open", [rn, ee] = B($e), Fe = (e) => {
242
+ ye.displayName = gt;
243
+ var yt = ye, [L, Ft] = ae("Tooltip", [
244
+ le
245
+ ]), M = le(), me = "TooltipProvider", mt = 700, W = "tooltip.open", [wt, X] = L(me), we = (e) => {
604
246
  const {
605
- __scopeTooltip: t,
606
- delayDuration: n = nn,
247
+ __scopeTooltip: r,
248
+ delayDuration: t = mt,
607
249
  skipDelayDuration: o = 300,
608
- disableHoverableContent: r = !1,
609
- children: i
610
- } = e, [a, d] = s.useState(!0), l = s.useRef(!1), c = s.useRef(0);
611
- return s.useEffect(() => {
612
- const u = c.current;
613
- return () => window.clearTimeout(u);
614
- }, []), /* @__PURE__ */ f(
615
- rn,
250
+ disableHoverableContent: n = !1,
251
+ children: s
252
+ } = e, [i, h] = a.useState(!0), l = a.useRef(!1), p = a.useRef(0);
253
+ return a.useEffect(() => {
254
+ const c = p.current;
255
+ return () => window.clearTimeout(c);
256
+ }, []), /* @__PURE__ */ d(
257
+ wt,
616
258
  {
617
- scope: t,
618
- isOpenDelayed: a,
619
- delayDuration: n,
620
- onOpen: s.useCallback(() => {
621
- window.clearTimeout(c.current), d(!1);
259
+ scope: r,
260
+ isOpenDelayed: i,
261
+ delayDuration: t,
262
+ onOpen: a.useCallback(() => {
263
+ window.clearTimeout(p.current), h(!1);
622
264
  }, []),
623
- onClose: s.useCallback(() => {
624
- window.clearTimeout(c.current), c.current = window.setTimeout(
625
- () => d(!0),
265
+ onClose: a.useCallback(() => {
266
+ window.clearTimeout(p.current), p.current = window.setTimeout(
267
+ () => h(!0),
626
268
  o
627
269
  );
628
270
  }, [o]),
629
271
  isPointerInTransitRef: l,
630
- onPointerInTransitChange: s.useCallback((u) => {
631
- l.current = u;
272
+ onPointerInTransitChange: a.useCallback((c) => {
273
+ l.current = c;
632
274
  }, []),
633
- disableHoverableContent: r,
634
- children: i
275
+ disableHoverableContent: n,
276
+ children: s
635
277
  }
636
278
  );
637
279
  };
638
- Fe.displayName = $e;
639
- var V = "Tooltip", [on, j] = B(V), He = (e) => {
280
+ we.displayName = me;
281
+ var $ = "Tooltip", [xt, F] = L($), xe = (e) => {
640
282
  const {
641
- __scopeTooltip: t,
642
- children: n,
283
+ __scopeTooltip: r,
284
+ children: t,
643
285
  open: o,
644
- defaultOpen: r = !1,
645
- onOpenChange: i,
646
- disableHoverableContent: a,
647
- delayDuration: d
648
- } = e, l = ee(V, e.__scopeTooltip), c = U(t), [u, h] = s.useState(null), m = gt(), p = s.useRef(0), v = a ?? l.disableHoverableContent, y = d ?? l.delayDuration, w = s.useRef(!1), [P = !1, C] = st({
286
+ defaultOpen: n = !1,
287
+ onOpenChange: s,
288
+ disableHoverableContent: i,
289
+ delayDuration: h
290
+ } = e, l = X($, e.__scopeTooltip), p = M(r), [c, f] = a.useState(null), y = tt(), u = a.useRef(0), v = i ?? l.disableHoverableContent, g = h ?? l.delayDuration, m = a.useRef(!1), [w = !1, x] = Be({
649
291
  prop: o,
650
- defaultProp: r,
651
- onChange: (g) => {
652
- g ? (l.onOpen(), document.dispatchEvent(new CustomEvent(Z))) : l.onClose(), i == null || i(g);
292
+ defaultProp: n,
293
+ onChange: (N) => {
294
+ N ? (l.onOpen(), document.dispatchEvent(new CustomEvent(W))) : l.onClose(), s == null || s(N);
653
295
  }
654
- }), x = s.useMemo(() => P ? w.current ? "delayed-open" : "instant-open" : "closed", [P]), E = s.useCallback(() => {
655
- window.clearTimeout(p.current), p.current = 0, w.current = !1, C(!0);
656
- }, [C]), T = s.useCallback(() => {
657
- window.clearTimeout(p.current), p.current = 0, C(!1);
658
- }, [C]), b = s.useCallback(() => {
659
- window.clearTimeout(p.current), p.current = window.setTimeout(() => {
660
- w.current = !0, C(!0), p.current = 0;
661
- }, y);
662
- }, [y, C]);
663
- return s.useEffect(() => () => {
664
- p.current && (window.clearTimeout(p.current), p.current = 0);
665
- }, []), /* @__PURE__ */ f(Ht, { ...c, children: /* @__PURE__ */ f(
666
- on,
296
+ }), T = a.useMemo(() => w ? m.current ? "delayed-open" : "instant-open" : "closed", [w]), C = a.useCallback(() => {
297
+ window.clearTimeout(u.current), u.current = 0, m.current = !1, x(!0);
298
+ }, [x]), b = a.useCallback(() => {
299
+ window.clearTimeout(u.current), u.current = 0, x(!1);
300
+ }, [x]), P = a.useCallback(() => {
301
+ window.clearTimeout(u.current), u.current = window.setTimeout(() => {
302
+ m.current = !0, x(!0), u.current = 0;
303
+ }, g);
304
+ }, [g, x]);
305
+ return a.useEffect(() => () => {
306
+ u.current && (window.clearTimeout(u.current), u.current = 0);
307
+ }, []), /* @__PURE__ */ d(ut, { ...p, children: /* @__PURE__ */ d(
308
+ xt,
667
309
  {
668
- scope: t,
669
- contentId: m,
670
- open: P,
671
- stateAttribute: x,
672
- trigger: u,
673
- onTriggerChange: h,
674
- onTriggerEnter: s.useCallback(() => {
675
- l.isOpenDelayed ? b() : E();
676
- }, [l.isOpenDelayed, b, E]),
677
- onTriggerLeave: s.useCallback(() => {
678
- v ? T() : (window.clearTimeout(p.current), p.current = 0);
679
- }, [T, v]),
680
- onOpen: E,
681
- onClose: T,
310
+ scope: r,
311
+ contentId: y,
312
+ open: w,
313
+ stateAttribute: T,
314
+ trigger: c,
315
+ onTriggerChange: f,
316
+ onTriggerEnter: a.useCallback(() => {
317
+ l.isOpenDelayed ? P() : C();
318
+ }, [l.isOpenDelayed, P, C]),
319
+ onTriggerLeave: a.useCallback(() => {
320
+ v ? b() : (window.clearTimeout(u.current), u.current = 0);
321
+ }, [b, v]),
322
+ onOpen: C,
323
+ onClose: b,
682
324
  disableHoverableContent: v,
683
- children: n
325
+ children: t
684
326
  }
685
327
  ) });
686
328
  };
687
- He.displayName = V;
688
- var q = "TooltipTrigger", Be = s.forwardRef(
689
- (e, t) => {
690
- const { __scopeTooltip: n, ...o } = e, r = j(q, n), i = ee(q, n), a = U(n), d = s.useRef(null), l = O(t, d, r.onTriggerChange), c = s.useRef(!1), u = s.useRef(!1), h = s.useCallback(() => c.current = !1, []);
691
- return s.useEffect(() => () => document.removeEventListener("pointerup", h), [h]), /* @__PURE__ */ f(Bt, { asChild: !0, ...a, children: /* @__PURE__ */ f(
692
- S.button,
329
+ xe.displayName = $;
330
+ var Y = "TooltipTrigger", Ce = a.forwardRef(
331
+ (e, r) => {
332
+ const { __scopeTooltip: t, ...o } = e, n = F(Y, t), s = X(Y, t), i = M(t), h = a.useRef(null), l = k(r, h, n.onTriggerChange), p = a.useRef(!1), c = a.useRef(!1), f = a.useCallback(() => p.current = !1, []);
333
+ return a.useEffect(() => () => document.removeEventListener("pointerup", f), [f]), /* @__PURE__ */ d(ft, { asChild: !0, ...i, children: /* @__PURE__ */ d(
334
+ O.button,
693
335
  {
694
- "aria-describedby": r.open ? r.contentId : void 0,
695
- "data-state": r.stateAttribute,
336
+ "aria-describedby": n.open ? n.contentId : void 0,
337
+ "data-state": n.stateAttribute,
696
338
  ...o,
697
339
  ref: l,
698
- onPointerMove: A(e.onPointerMove, (m) => {
699
- m.pointerType !== "touch" && !u.current && !i.isPointerInTransitRef.current && (r.onTriggerEnter(), u.current = !0);
340
+ onPointerMove: E(e.onPointerMove, (y) => {
341
+ y.pointerType !== "touch" && !c.current && !s.isPointerInTransitRef.current && (n.onTriggerEnter(), c.current = !0);
700
342
  }),
701
- onPointerLeave: A(e.onPointerLeave, () => {
702
- r.onTriggerLeave(), u.current = !1;
343
+ onPointerLeave: E(e.onPointerLeave, () => {
344
+ n.onTriggerLeave(), c.current = !1;
703
345
  }),
704
- onPointerDown: A(e.onPointerDown, () => {
705
- c.current = !0, document.addEventListener("pointerup", h, { once: !0 });
346
+ onPointerDown: E(e.onPointerDown, () => {
347
+ p.current = !0, document.addEventListener("pointerup", f, { once: !0 });
706
348
  }),
707
- onFocus: A(e.onFocus, () => {
708
- c.current || r.onOpen();
349
+ onFocus: E(e.onFocus, () => {
350
+ p.current || n.onOpen();
709
351
  }),
710
- onBlur: A(e.onBlur, r.onClose),
711
- onClick: A(e.onClick, r.onClose)
352
+ onBlur: E(e.onBlur, n.onClose),
353
+ onClick: E(e.onClick, n.onClose)
712
354
  }
713
355
  ) });
714
356
  }
715
357
  );
716
- Be.displayName = q;
717
- var sn = "TooltipPortal", [Tn, an] = B(sn, {
358
+ Ce.displayName = Y;
359
+ var Ct = "TooltipPortal", [jt, Pt] = L(Ct, {
718
360
  forceMount: void 0
719
- }), D = "TooltipContent", Ue = s.forwardRef(
720
- (e, t) => {
721
- const n = an(D, e.__scopeTooltip), { forceMount: o = n.forceMount, side: r = "top", ...i } = e, a = j(D, e.__scopeTooltip);
722
- return /* @__PURE__ */ f(Ie, { present: o || a.open, children: a.disableHoverableContent ? /* @__PURE__ */ f(Ve, { side: r, ...i, ref: t }) : /* @__PURE__ */ f(ln, { side: r, ...i, ref: t }) });
361
+ }), R = "TooltipContent", Pe = a.forwardRef(
362
+ (e, r) => {
363
+ const t = Pt(R, e.__scopeTooltip), { forceMount: o = t.forceMount, side: n = "top", ...s } = e, i = F(R, e.__scopeTooltip);
364
+ return /* @__PURE__ */ d(Ge, { present: o || i.open, children: i.disableHoverableContent ? /* @__PURE__ */ d(Te, { side: n, ...s, ref: r }) : /* @__PURE__ */ d(Tt, { side: n, ...s, ref: r }) });
723
365
  }
724
- ), ln = s.forwardRef((e, t) => {
725
- const n = j(D, e.__scopeTooltip), o = ee(D, e.__scopeTooltip), r = s.useRef(null), i = O(t, r), [a, d] = s.useState(null), { trigger: l, onClose: c } = n, u = r.current, { onPointerInTransitChange: h } = o, m = s.useCallback(() => {
726
- d(null), h(!1);
727
- }, [h]), p = s.useCallback(
728
- (v, y) => {
729
- const w = v.currentTarget, P = { x: v.clientX, y: v.clientY }, C = dn(P, w.getBoundingClientRect()), x = fn(P, C), E = pn(y.getBoundingClientRect()), T = mn([...x, ...E]);
730
- d(T), h(!0);
366
+ ), Tt = a.forwardRef((e, r) => {
367
+ const t = F(R, e.__scopeTooltip), o = X(R, e.__scopeTooltip), n = a.useRef(null), s = k(r, n), [i, h] = a.useState(null), { trigger: l, onClose: p } = t, c = n.current, { onPointerInTransitChange: f } = o, y = a.useCallback(() => {
368
+ h(null), f(!1);
369
+ }, [f]), u = a.useCallback(
370
+ (v, g) => {
371
+ const m = v.currentTarget, w = { x: v.clientX, y: v.clientY }, x = Et(w, m.getBoundingClientRect()), T = Rt(w, x), C = _t(g.getBoundingClientRect()), b = Nt([...T, ...C]);
372
+ h(b), f(!0);
731
373
  },
732
- [h]
374
+ [f]
733
375
  );
734
- return s.useEffect(() => () => m(), [m]), s.useEffect(() => {
735
- if (l && u) {
736
- const v = (w) => p(w, u), y = (w) => p(w, l);
737
- return l.addEventListener("pointerleave", v), u.addEventListener("pointerleave", y), () => {
738
- l.removeEventListener("pointerleave", v), u.removeEventListener("pointerleave", y);
376
+ return a.useEffect(() => () => y(), [y]), a.useEffect(() => {
377
+ if (l && c) {
378
+ const v = (m) => u(m, c), g = (m) => u(m, l);
379
+ return l.addEventListener("pointerleave", v), c.addEventListener("pointerleave", g), () => {
380
+ l.removeEventListener("pointerleave", v), c.removeEventListener("pointerleave", g);
739
381
  };
740
382
  }
741
- }, [l, u, p, m]), s.useEffect(() => {
742
- if (a) {
743
- const v = (y) => {
744
- const w = y.target, P = { x: y.clientX, y: y.clientY }, C = (l == null ? void 0 : l.contains(w)) || (u == null ? void 0 : u.contains(w)), x = !hn(P, a);
745
- C ? m() : x && (m(), c());
383
+ }, [l, c, u, y]), a.useEffect(() => {
384
+ if (i) {
385
+ const v = (g) => {
386
+ const m = g.target, w = { x: g.clientX, y: g.clientY }, x = (l == null ? void 0 : l.contains(m)) || (c == null ? void 0 : c.contains(m)), T = !Ot(w, i);
387
+ x ? y() : T && (y(), p());
746
388
  };
747
389
  return document.addEventListener("pointermove", v), () => document.removeEventListener("pointermove", v);
748
390
  }
749
- }, [l, u, a, c, m]), /* @__PURE__ */ f(Ve, { ...e, ref: i });
750
- }), [cn, un] = B(V, { isInside: !1 }), Ve = s.forwardRef(
751
- (e, t) => {
391
+ }, [l, c, i, p, y]), /* @__PURE__ */ d(Te, { ...e, ref: s });
392
+ }), [bt, At] = L($, { isInside: !1 }), Te = a.forwardRef(
393
+ (e, r) => {
752
394
  const {
753
- __scopeTooltip: n,
395
+ __scopeTooltip: t,
754
396
  children: o,
755
- "aria-label": r,
756
- onEscapeKeyDown: i,
757
- onPointerDownOutside: a,
758
- ...d
759
- } = e, l = j(D, n), c = U(n), { onClose: u } = l;
760
- return s.useEffect(() => (document.addEventListener(Z, u), () => document.removeEventListener(Z, u)), [u]), s.useEffect(() => {
397
+ "aria-label": n,
398
+ onEscapeKeyDown: s,
399
+ onPointerDownOutside: i,
400
+ ...h
401
+ } = e, l = F(R, t), p = M(t), { onClose: c } = l;
402
+ return a.useEffect(() => (document.addEventListener(W, c), () => document.removeEventListener(W, c)), [c]), a.useEffect(() => {
761
403
  if (l.trigger) {
762
- const h = (m) => {
763
- const p = m.target;
764
- p != null && p.contains(l.trigger) && u();
404
+ const f = (y) => {
405
+ const u = y.target;
406
+ u != null && u.contains(l.trigger) && c();
765
407
  };
766
- return window.addEventListener("scroll", h, { capture: !0 }), () => window.removeEventListener("scroll", h, { capture: !0 });
408
+ return window.addEventListener("scroll", f, { capture: !0 }), () => window.removeEventListener("scroll", f, { capture: !0 });
767
409
  }
768
- }, [l.trigger, u]), /* @__PURE__ */ f(
769
- Ee,
410
+ }, [l.trigger, c]), /* @__PURE__ */ d(
411
+ rt,
770
412
  {
771
413
  asChild: !0,
772
414
  disableOutsidePointerEvents: !1,
773
- onEscapeKeyDown: i,
774
- onPointerDownOutside: a,
775
- onFocusOutside: (h) => h.preventDefault(),
776
- onDismiss: u,
777
- children: /* @__PURE__ */ Y(
778
- Ut,
415
+ onEscapeKeyDown: s,
416
+ onPointerDownOutside: i,
417
+ onFocusOutside: (f) => f.preventDefault(),
418
+ onDismiss: c,
419
+ children: /* @__PURE__ */ j(
420
+ ht,
779
421
  {
780
422
  "data-state": l.stateAttribute,
781
- ...c,
782
- ...d,
783
- ref: t,
423
+ ...p,
424
+ ...h,
425
+ ref: r,
784
426
  style: {
785
- ...d.style,
427
+ ...h.style,
786
428
  "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
787
429
  "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
788
430
  "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
@@ -790,8 +432,8 @@ var sn = "TooltipPortal", [Tn, an] = B(sn, {
790
432
  "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
791
433
  },
792
434
  children: [
793
- /* @__PURE__ */ f(Ce, { children: o }),
794
- /* @__PURE__ */ f(cn, { scope: n, isInside: !0, children: /* @__PURE__ */ f(tn, { id: l.contentId, role: "tooltip", children: r || o }) })
435
+ /* @__PURE__ */ d(Xe, { children: o }),
436
+ /* @__PURE__ */ d(bt, { scope: t, isInside: !0, children: /* @__PURE__ */ d(yt, { id: l.contentId, role: "tooltip", children: n || o }) })
795
437
  ]
796
438
  }
797
439
  )
@@ -799,25 +441,25 @@ var sn = "TooltipPortal", [Tn, an] = B(sn, {
799
441
  );
800
442
  }
801
443
  );
802
- Ue.displayName = D;
803
- var je = "TooltipArrow", Ye = s.forwardRef(
804
- (e, t) => {
805
- const { __scopeTooltip: n, ...o } = e, r = U(n);
806
- return un(
807
- je,
808
- n
809
- ).isInside ? null : /* @__PURE__ */ f(Vt, { ...r, ...o, ref: t });
444
+ Pe.displayName = R;
445
+ var be = "TooltipArrow", Ae = a.forwardRef(
446
+ (e, r) => {
447
+ const { __scopeTooltip: t, ...o } = e, n = M(t);
448
+ return At(
449
+ be,
450
+ t
451
+ ).isInside ? null : /* @__PURE__ */ d(vt, { ...n, ...o, ref: r });
810
452
  }
811
453
  );
812
- Ye.displayName = je;
813
- function dn(e, t) {
814
- 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);
815
- switch (Math.min(n, o, r, i)) {
816
- case i:
454
+ Ae.displayName = be;
455
+ function Et(e, r) {
456
+ const t = Math.abs(r.top - e.y), o = Math.abs(r.bottom - e.y), n = Math.abs(r.right - e.x), s = Math.abs(r.left - e.x);
457
+ switch (Math.min(t, o, n, s)) {
458
+ case s:
817
459
  return "left";
818
- case r:
819
- return "right";
820
460
  case n:
461
+ return "right";
462
+ case t:
821
463
  return "top";
822
464
  case o:
823
465
  return "bottom";
@@ -825,101 +467,101 @@ function dn(e, t) {
825
467
  throw new Error("unreachable");
826
468
  }
827
469
  }
828
- function fn(e, t, n = 5) {
470
+ function Rt(e, r, t = 5) {
829
471
  const o = [];
830
- switch (t) {
472
+ switch (r) {
831
473
  case "top":
832
474
  o.push(
833
- { x: e.x - n, y: e.y + n },
834
- { x: e.x + n, y: e.y + n }
475
+ { x: e.x - t, y: e.y + t },
476
+ { x: e.x + t, y: e.y + t }
835
477
  );
836
478
  break;
837
479
  case "bottom":
838
480
  o.push(
839
- { x: e.x - n, y: e.y - n },
840
- { x: e.x + n, y: e.y - n }
481
+ { x: e.x - t, y: e.y - t },
482
+ { x: e.x + t, y: e.y - t }
841
483
  );
842
484
  break;
843
485
  case "left":
844
486
  o.push(
845
- { x: e.x + n, y: e.y - n },
846
- { x: e.x + n, y: e.y + n }
487
+ { x: e.x + t, y: e.y - t },
488
+ { x: e.x + t, y: e.y + t }
847
489
  );
848
490
  break;
849
491
  case "right":
850
492
  o.push(
851
- { x: e.x - n, y: e.y - n },
852
- { x: e.x - n, y: e.y + n }
493
+ { x: e.x - t, y: e.y - t },
494
+ { x: e.x - t, y: e.y + t }
853
495
  );
854
496
  break;
855
497
  }
856
498
  return o;
857
499
  }
858
- function pn(e) {
859
- const { top: t, right: n, bottom: o, left: r } = e;
500
+ function _t(e) {
501
+ const { top: r, right: t, bottom: o, left: n } = e;
860
502
  return [
861
- { x: r, y: t },
862
- { x: n, y: t },
863
- { x: n, y: o },
864
- { x: r, y: o }
503
+ { x: n, y: r },
504
+ { x: t, y: r },
505
+ { x: t, y: o },
506
+ { x: n, y: o }
865
507
  ];
866
508
  }
867
- function hn(e, t) {
868
- const { x: n, y: o } = e;
869
- let r = !1;
870
- for (let i = 0, a = t.length - 1; i < t.length; a = i++) {
871
- const d = t[i].x, l = t[i].y, c = t[a].x, u = t[a].y;
872
- l > o != u > o && n < (c - d) * (o - l) / (u - l) + d && (r = !r);
509
+ function Ot(e, r) {
510
+ const { x: t, y: o } = e;
511
+ let n = !1;
512
+ for (let s = 0, i = r.length - 1; s < r.length; i = s++) {
513
+ const h = r[s].x, l = r[s].y, p = r[i].x, c = r[i].y;
514
+ l > o != c > o && t < (p - h) * (o - l) / (c - l) + h && (n = !n);
873
515
  }
874
- return r;
516
+ return n;
875
517
  }
876
- function mn(e) {
877
- const t = e.slice();
878
- 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), vn(t);
518
+ function Nt(e) {
519
+ const r = e.slice();
520
+ return r.sort((t, o) => t.x < o.x ? -1 : t.x > o.x ? 1 : t.y < o.y ? -1 : t.y > o.y ? 1 : 0), St(r);
879
521
  }
880
- function vn(e) {
522
+ function St(e) {
881
523
  if (e.length <= 1)
882
524
  return e.slice();
883
- const t = [];
525
+ const r = [];
884
526
  for (let o = 0; o < e.length; o++) {
885
- const r = e[o];
886
- for (; t.length >= 2; ) {
887
- const i = t[t.length - 1], a = t[t.length - 2];
888
- if ((i.x - a.x) * (r.y - a.y) >= (i.y - a.y) * (r.x - a.x))
889
- t.pop();
527
+ const n = e[o];
528
+ for (; r.length >= 2; ) {
529
+ const s = r[r.length - 1], i = r[r.length - 2];
530
+ if ((s.x - i.x) * (n.y - i.y) >= (s.y - i.y) * (n.x - i.x))
531
+ r.pop();
890
532
  else
891
533
  break;
892
534
  }
893
- t.push(r);
535
+ r.push(n);
894
536
  }
895
- t.pop();
896
- const n = [];
537
+ r.pop();
538
+ const t = [];
897
539
  for (let o = e.length - 1; o >= 0; o--) {
898
- const r = e[o];
899
- for (; n.length >= 2; ) {
900
- const i = n[n.length - 1], a = n[n.length - 2];
901
- if ((i.x - a.x) * (r.y - a.y) >= (i.y - a.y) * (r.x - a.x))
902
- n.pop();
540
+ const n = e[o];
541
+ for (; t.length >= 2; ) {
542
+ const s = t[t.length - 1], i = t[t.length - 2];
543
+ if ((s.x - i.x) * (n.y - i.y) >= (s.y - i.y) * (n.x - i.x))
544
+ t.pop();
903
545
  else
904
546
  break;
905
547
  }
906
- n.push(r);
548
+ t.push(n);
907
549
  }
908
- 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);
550
+ return t.pop(), r.length === 1 && t.length === 1 && r[0].x === t[0].x && r[0].y === t[0].y ? r : r.concat(t);
909
551
  }
910
- const yn = "_tooltipContent_12gjy_1", gn = "_tooltipArrow_12gjy_8", wn = "_fadeIn_12gjy_1", me = {
911
- tooltipContent: yn,
912
- tooltipArrow: gn,
913
- fadeIn: wn
914
- }, An = wt(
915
- ({ children: e, content: t, className: n, style: o }, r) => /* @__PURE__ */ f(Fe, { children: /* @__PURE__ */ Y(He, { delayDuration: 1e3, children: [
916
- /* @__PURE__ */ f(Be, { asChild: !0, children: /* @__PURE__ */ f("div", { ref: r, className: n, style: o, children: e }) }),
917
- /* @__PURE__ */ Y(Ue, { className: me.tooltipContent, sideOffset: 5, children: [
918
- /* @__PURE__ */ f(Ye, { className: me.tooltipArrow }),
919
- /* @__PURE__ */ f("span", { children: t })
552
+ const Dt = "_tooltipContent_12gjy_1", Ht = "_tooltipArrow_12gjy_8", It = "_fadeIn_12gjy_1", ne = {
553
+ tooltipContent: Dt,
554
+ tooltipArrow: Ht,
555
+ fadeIn: It
556
+ }, Wt = ot(
557
+ ({ children: e, content: r, className: t, style: o }, n) => /* @__PURE__ */ d(we, { children: /* @__PURE__ */ j(xe, { delayDuration: 1e3, children: [
558
+ /* @__PURE__ */ d(Ce, { asChild: !0, children: /* @__PURE__ */ d("div", { ref: n, className: t, style: o, children: e }) }),
559
+ /* @__PURE__ */ j(Pe, { className: ne.tooltipContent, sideOffset: 5, children: [
560
+ /* @__PURE__ */ d(Ae, { className: ne.tooltipArrow }),
561
+ /* @__PURE__ */ d("span", { children: r })
920
562
  ] })
921
563
  ] }) })
922
564
  );
923
565
  export {
924
- An as default
566
+ Wt as default
925
567
  };