@pdf-viewer/react 1.9.2-rc.3 → 1.9.2-rc.4

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 (69) hide show
  1. package/dist/{ToolbarLayout.module-95e678ab.js → ToolbarLayout.module-d8ed3e47.js} +3 -3
  2. package/dist/components/RPController.js +1 -1
  3. package/dist/components/RPPages.js +1 -1
  4. package/dist/components/layout/LayoutContainer.js +1 -1
  5. package/dist/components/layout/RPDefaultLayout.js +1 -1
  6. package/dist/components/layout/RPLayout.js +1 -1
  7. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  8. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  9. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  10. package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
  11. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  12. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  13. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  14. package/dist/components/layout/toolbar/MostPageTool.js +2 -2
  15. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  16. package/dist/components/layout/toolbar/Paginate.js +1 -1
  17. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  18. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  19. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  20. package/dist/components/layout/toolbar/RotateTool.js +1 -1
  21. package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
  22. package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
  23. package/dist/components/layout/toolbar/SearchTool.js +1 -1
  24. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  25. package/dist/components/layout/toolbar/ThumbnailTool.js +1 -1
  26. package/dist/components/layout/toolbar/ToolbarCustom.js +5 -5
  27. package/dist/components/layout/toolbar/ToolbarDefault.js +34 -21
  28. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  29. package/dist/components/layout/toolbar/ZoomTool.js +1 -1
  30. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
  31. package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
  32. package/dist/components/layout/toolbar/tools/NextPageTool.js +1 -1
  33. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
  34. package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
  35. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
  36. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +1 -1
  37. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +1 -1
  38. package/dist/components/page/AnnotationLayer.js +1 -1
  39. package/dist/components/page/CanvasLayer.js +1 -1
  40. package/dist/components/page/DualPage.js +1 -1
  41. package/dist/components/page/RPPage.js +1 -1
  42. package/dist/components/page/SinglePage.js +1 -1
  43. package/dist/components/page/TextHighlightLayer.js +1 -1
  44. package/dist/components/page/TextLayer.js +1 -1
  45. package/dist/components/ui/Checkbox.js +1 -1
  46. package/dist/components/ui/DropDown.js +1 -1
  47. package/dist/components/ui/LoadingIndicator.js +1 -1
  48. package/dist/components/ui/RPTooltip.js +405 -192
  49. package/dist/contexts/PaginationContext.js +1 -1
  50. package/dist/contexts/PrintContext.js +1 -1
  51. package/dist/contexts/RenderQueueProvider.js +1 -1
  52. package/dist/contexts/SearchContext.js +1 -1
  53. package/dist/contexts/ThumbnailsContext.js +1 -1
  54. package/dist/floating-ui.react-dom-88a86594.js +1447 -0
  55. package/dist/{index-5908484b.js → index-48ca3f30.js} +2 -2
  56. package/dist/index-4ba3ab9a.js +1877 -0
  57. package/dist/main.js +1 -1
  58. package/dist/utils/hooks/useFileDownload.js +1 -1
  59. package/dist/utils/hooks/useLicense.js +1 -1
  60. package/dist/utils/hooks/usePaginate.js +1 -1
  61. package/dist/utils/hooks/usePresentPage.js +1 -1
  62. package/dist/utils/hooks/usePrint.js +1 -1
  63. package/dist/utils/hooks/useScrollToPage.js +1 -1
  64. package/dist/utils/hooks/useSearch.js +1 -1
  65. package/dist/utils/hooks/useThumbnail.js +1 -1
  66. package/dist/utils/hooks/useVirtualReactWindow.js +1 -1
  67. package/package.json +1 -1
  68. package/dist/index-18b0454c.js +0 -1657
  69. package/dist/index-f4a9ae4d.js +0 -1664
@@ -1,14 +1,227 @@
1
- import { jsx as d, jsxs as O } from "react/jsx-runtime";
2
- import * as s from "react";
3
- import { P as S, c as z, a as J, u as j, b as g, d as Q, S as Z } from "../../index-5908484b.js";
4
- import { c as G, u as $, R as ee, A as te, D as oe, C as re, a as ne } from "../../index-18b0454c.js";
5
- import { withRef as se } from "../../utils/withRef.js";
6
- import '../../assets/RPTooltip.css';var ae = "VisuallyHidden", F = s.forwardRef(
7
- (e, o) => /* @__PURE__ */ d(
8
- S.span,
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,
10
+ {
11
+ ...s,
12
+ ref: r,
13
+ width: o,
14
+ height: n,
15
+ viewBox: "0 0 30 10",
16
+ preserveAspectRatio: "none",
17
+ children: e.asChild ? t : /* @__PURE__ */ d("polygon", { points: "0,0 30,0 15,10" })
18
+ }
19
+ );
20
+ });
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 });
25
+ };
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 });
33
+ }
34
+ );
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;
39
+ const {
40
+ __scopePopper: t,
41
+ side: o = "bottom",
42
+ sideOffset: n = 0,
43
+ align: s = "center",
44
+ alignOffset: i = 0,
45
+ arrowPadding: h = 0,
46
+ avoidCollisions: l = !0,
47
+ collisionBoundary: p = [],
48
+ collisionPadding: c = 0,
49
+ sticky: f = "partial",
50
+ hideWhenDetached: y = !1,
51
+ updatePositionStrategy: u = "optimized",
52
+ onPlaced: v,
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),
57
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
58
+ altBoundary: _e
59
+ }, { refs: Oe, floatingStyles: q, placement: Ne, isPositioned: D, middlewareData: A } = Ve({
60
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
61
+ strategy: "fixed",
62
+ placement: Ee,
63
+ whileElementsMounted: (..._) => Ue(..._, {
64
+ animationFrame: u === "always"
65
+ }),
66
+ elements: {
67
+ reference: m.anchor
68
+ },
69
+ middleware: [
70
+ qe({ mainAxis: n + V, alignmentAxis: i }),
71
+ l && ze({
72
+ mainAxis: !0,
73
+ crossAxis: !1,
74
+ limiter: f === "partial" ? et() : void 0,
75
+ ...S
76
+ }),
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`);
83
+ }
84
+ }),
85
+ C && Je({ element: C, padding: h }),
86
+ pt({ arrowWidth: N, arrowHeight: V }),
87
+ y && Qe({ strategy: "referenceHidden", ...S })
88
+ ]
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(
97
+ "div",
98
+ {
99
+ ref: Oe.setFloating,
100
+ "data-radix-popper-content-wrapper": "",
101
+ style: {
102
+ ...q,
103
+ transform: D ? q.transform : "translate(0, -200%)",
104
+ // keep off the page when measuring
105
+ minWidth: "max-content",
106
+ zIndex: ke,
107
+ "--radix-popper-transform-origin": [
108
+ (Q = A.transformOrigin) == null ? void 0 : Q.x,
109
+ (ee = A.transformOrigin) == null ? void 0 : ee.y
110
+ ].join(" "),
111
+ // hide the content if using the hide middleware and should be hidden
112
+ // set visibility to hidden and disable pointer events so the UI behaves
113
+ // as if the PopperContent isn't there at all
114
+ ...((te = A.hide) == null ? void 0 : te.referenceHidden) && {
115
+ visibility: "hidden",
116
+ pointerEvents: "none"
117
+ }
118
+ },
119
+ dir: e.dir,
120
+ children: /* @__PURE__ */ d(
121
+ it,
122
+ {
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,
131
+ {
132
+ "data-side": z,
133
+ "data-align": Se,
134
+ ...g,
135
+ ref: T,
136
+ style: {
137
+ ...g.style,
138
+ // if the PopperContent hasn't been placed yet (not all measurements done)
139
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
140
+ animation: D ? void 0 : "none"
141
+ }
142
+ }
143
+ )
144
+ }
145
+ )
146
+ }
147
+ );
148
+ }
149
+ );
150
+ fe.displayName = G;
151
+ var he = "PopperArrow", ct = {
152
+ top: "bottom",
153
+ right: "left",
154
+ bottom: "top",
155
+ left: "right"
156
+ }, ve = a.forwardRef(function(r, t) {
157
+ const { __scopePopper: o, ...n } = r, s = lt(he, o), i = ct[s.placedSide];
158
+ return (
159
+ // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
160
+ // doesn't report size as we'd expect on SVG elements.
161
+ // it reports their bounding box which is effectively the largest path inside the SVG.
162
+ /* @__PURE__ */ d(
163
+ "span",
164
+ {
165
+ ref: s.onArrowChange,
166
+ style: {
167
+ position: "absolute",
168
+ left: s.arrowX,
169
+ top: s.arrowY,
170
+ [i]: 0,
171
+ transformOrigin: {
172
+ top: "",
173
+ right: "0 0",
174
+ bottom: "center 0",
175
+ left: "100% 0"
176
+ }[s.placedSide],
177
+ transform: {
178
+ top: "translateY(100%)",
179
+ right: "translateY(50%) rotate(90deg) translateX(-50%)",
180
+ bottom: "rotate(180deg)",
181
+ left: "translateY(50%) rotate(-90deg) translateX(50%)"
182
+ }[s.placedSide],
183
+ visibility: s.shouldHideArrow ? "hidden" : void 0
184
+ },
185
+ children: /* @__PURE__ */ d(
186
+ at,
187
+ {
188
+ ...n,
189
+ ref: t,
190
+ style: {
191
+ ...n.style,
192
+ // ensures the element can be measured correctly (mostly for if SVG)
193
+ display: "block"
194
+ }
195
+ }
196
+ )
197
+ }
198
+ )
199
+ );
200
+ });
201
+ ve.displayName = he;
202
+ function dt(e) {
203
+ return e !== null;
204
+ }
205
+ var pt = (e) => ({
206
+ name: "transformOrigin",
207
+ options: e,
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 } };
213
+ }
214
+ });
215
+ function ge(e) {
216
+ const [r, t = "center"] = e.split("-");
217
+ return [r, t];
218
+ }
219
+ var ut = de, ft = ue, ht = fe, vt = ve, gt = "VisuallyHidden", ye = a.forwardRef(
220
+ (e, r) => /* @__PURE__ */ d(
221
+ O.span,
9
222
  {
10
223
  ...e,
11
- ref: o,
224
+ ref: r,
12
225
  style: {
13
226
  // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
14
227
  position: "absolute",
@@ -26,192 +239,192 @@ import '../../assets/RPTooltip.css';var ae = "VisuallyHidden", F = s.forwardRef(
26
239
  }
27
240
  )
28
241
  );
29
- F.displayName = ae;
30
- var ie = F, [R, De] = z("Tooltip", [
31
- G
32
- ]), _ = G(), V = "TooltipProvider", le = 700, L = "tooltip.open", [ce, I] = R(V), B = (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) => {
33
246
  const {
34
- __scopeTooltip: o,
35
- delayDuration: t = le,
36
- skipDelayDuration: r = 300,
247
+ __scopeTooltip: r,
248
+ delayDuration: t = mt,
249
+ skipDelayDuration: o = 300,
37
250
  disableHoverableContent: n = !1,
38
- children: i
39
- } = e, [c, v] = s.useState(!0), a = s.useRef(!1), p = s.useRef(0);
40
- return s.useEffect(() => {
41
- const l = p.current;
42
- return () => window.clearTimeout(l);
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);
43
256
  }, []), /* @__PURE__ */ d(
44
- ce,
257
+ wt,
45
258
  {
46
- scope: o,
47
- isOpenDelayed: c,
259
+ scope: r,
260
+ isOpenDelayed: i,
48
261
  delayDuration: t,
49
- onOpen: s.useCallback(() => {
50
- window.clearTimeout(p.current), v(!1);
262
+ onOpen: a.useCallback(() => {
263
+ window.clearTimeout(p.current), h(!1);
51
264
  }, []),
52
- onClose: s.useCallback(() => {
265
+ onClose: a.useCallback(() => {
53
266
  window.clearTimeout(p.current), p.current = window.setTimeout(
54
- () => v(!0),
55
- r
267
+ () => h(!0),
268
+ o
56
269
  );
57
- }, [r]),
58
- isPointerInTransitRef: a,
59
- onPointerInTransitChange: s.useCallback((l) => {
60
- a.current = l;
270
+ }, [o]),
271
+ isPointerInTransitRef: l,
272
+ onPointerInTransitChange: a.useCallback((c) => {
273
+ l.current = c;
61
274
  }, []),
62
275
  disableHoverableContent: n,
63
- children: i
276
+ children: s
64
277
  }
65
278
  );
66
279
  };
67
- B.displayName = V;
68
- var A = "Tooltip", [ue, D] = R(A), U = (e) => {
280
+ we.displayName = me;
281
+ var $ = "Tooltip", [xt, F] = L($), xe = (e) => {
69
282
  const {
70
- __scopeTooltip: o,
283
+ __scopeTooltip: r,
71
284
  children: t,
72
- open: r,
285
+ open: o,
73
286
  defaultOpen: n = !1,
74
- onOpenChange: i,
75
- disableHoverableContent: c,
76
- delayDuration: v
77
- } = e, a = I(A, e.__scopeTooltip), p = _(o), [l, f] = s.useState(null), y = $(), u = s.useRef(0), h = c ?? a.disableHoverableContent, C = v ?? a.delayDuration, T = s.useRef(!1), [x = !1, m] = J({
78
- prop: r,
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({
291
+ prop: o,
79
292
  defaultProp: n,
80
293
  onChange: (N) => {
81
- N ? (a.onOpen(), document.dispatchEvent(new CustomEvent(L))) : a.onClose(), i == null || i(N);
294
+ N ? (l.onOpen(), document.dispatchEvent(new CustomEvent(W))) : l.onClose(), s == null || s(N);
82
295
  }
83
- }), b = s.useMemo(() => x ? T.current ? "delayed-open" : "instant-open" : "closed", [x]), E = s.useCallback(() => {
84
- window.clearTimeout(u.current), u.current = 0, T.current = !1, m(!0);
85
- }, [m]), P = s.useCallback(() => {
86
- window.clearTimeout(u.current), u.current = 0, m(!1);
87
- }, [m]), M = s.useCallback(() => {
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(() => {
88
301
  window.clearTimeout(u.current), u.current = window.setTimeout(() => {
89
- T.current = !0, m(!0), u.current = 0;
90
- }, C);
91
- }, [C, m]);
92
- return s.useEffect(() => () => {
302
+ m.current = !0, x(!0), u.current = 0;
303
+ }, g);
304
+ }, [g, x]);
305
+ return a.useEffect(() => () => {
93
306
  u.current && (window.clearTimeout(u.current), u.current = 0);
94
- }, []), /* @__PURE__ */ d(ee, { ...p, children: /* @__PURE__ */ d(
95
- ue,
307
+ }, []), /* @__PURE__ */ d(ut, { ...p, children: /* @__PURE__ */ d(
308
+ xt,
96
309
  {
97
- scope: o,
310
+ scope: r,
98
311
  contentId: y,
99
- open: x,
100
- stateAttribute: b,
101
- trigger: l,
312
+ open: w,
313
+ stateAttribute: T,
314
+ trigger: c,
102
315
  onTriggerChange: f,
103
- onTriggerEnter: s.useCallback(() => {
104
- a.isOpenDelayed ? M() : E();
105
- }, [a.isOpenDelayed, M, E]),
106
- onTriggerLeave: s.useCallback(() => {
107
- h ? P() : (window.clearTimeout(u.current), u.current = 0);
108
- }, [P, h]),
109
- onOpen: E,
110
- onClose: P,
111
- disableHoverableContent: h,
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,
324
+ disableHoverableContent: v,
112
325
  children: t
113
326
  }
114
327
  ) });
115
328
  };
116
- U.displayName = A;
117
- var k = "TooltipTrigger", Y = s.forwardRef(
118
- (e, o) => {
119
- const { __scopeTooltip: t, ...r } = e, n = D(k, t), i = I(k, t), c = _(t), v = s.useRef(null), a = j(o, v, n.onTriggerChange), p = s.useRef(!1), l = s.useRef(!1), f = s.useCallback(() => p.current = !1, []);
120
- return s.useEffect(() => () => document.removeEventListener("pointerup", f), [f]), /* @__PURE__ */ d(te, { asChild: !0, ...c, children: /* @__PURE__ */ d(
121
- 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,
122
335
  {
123
336
  "aria-describedby": n.open ? n.contentId : void 0,
124
337
  "data-state": n.stateAttribute,
125
- ...r,
126
- ref: a,
127
- onPointerMove: g(e.onPointerMove, (y) => {
128
- y.pointerType !== "touch" && !l.current && !i.isPointerInTransitRef.current && (n.onTriggerEnter(), l.current = !0);
338
+ ...o,
339
+ ref: l,
340
+ onPointerMove: E(e.onPointerMove, (y) => {
341
+ y.pointerType !== "touch" && !c.current && !s.isPointerInTransitRef.current && (n.onTriggerEnter(), c.current = !0);
129
342
  }),
130
- onPointerLeave: g(e.onPointerLeave, () => {
131
- n.onTriggerLeave(), l.current = !1;
343
+ onPointerLeave: E(e.onPointerLeave, () => {
344
+ n.onTriggerLeave(), c.current = !1;
132
345
  }),
133
- onPointerDown: g(e.onPointerDown, () => {
346
+ onPointerDown: E(e.onPointerDown, () => {
134
347
  p.current = !0, document.addEventListener("pointerup", f, { once: !0 });
135
348
  }),
136
- onFocus: g(e.onFocus, () => {
349
+ onFocus: E(e.onFocus, () => {
137
350
  p.current || n.onOpen();
138
351
  }),
139
- onBlur: g(e.onBlur, n.onClose),
140
- onClick: g(e.onClick, n.onClose)
352
+ onBlur: E(e.onBlur, n.onClose),
353
+ onClick: E(e.onClick, n.onClose)
141
354
  }
142
355
  ) });
143
356
  }
144
357
  );
145
- Y.displayName = k;
146
- var de = "TooltipPortal", [Oe, pe] = R(de, {
358
+ Ce.displayName = Y;
359
+ var Ct = "TooltipPortal", [jt, Pt] = L(Ct, {
147
360
  forceMount: void 0
148
- }), w = "TooltipContent", q = s.forwardRef(
149
- (e, o) => {
150
- const t = pe(w, e.__scopeTooltip), { forceMount: r = t.forceMount, side: n = "top", ...i } = e, c = D(w, e.__scopeTooltip);
151
- return /* @__PURE__ */ d(Q, { present: r || c.open, children: c.disableHoverableContent ? /* @__PURE__ */ d(W, { side: n, ...i, ref: o }) : /* @__PURE__ */ d(fe, { side: n, ...i, ref: o }) });
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 }) });
152
365
  }
153
- ), fe = s.forwardRef((e, o) => {
154
- const t = D(w, e.__scopeTooltip), r = I(w, e.__scopeTooltip), n = s.useRef(null), i = j(o, n), [c, v] = s.useState(null), { trigger: a, onClose: p } = t, l = n.current, { onPointerInTransitChange: f } = r, y = s.useCallback(() => {
155
- v(null), f(!1);
156
- }, [f]), u = s.useCallback(
157
- (h, C) => {
158
- const T = h.currentTarget, x = { x: h.clientX, y: h.clientY }, m = ye(x, T.getBoundingClientRect()), b = Te(x, m), E = Ce(C.getBoundingClientRect()), P = xe([...b, ...E]);
159
- v(P), f(!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);
160
373
  },
161
374
  [f]
162
375
  );
163
- return s.useEffect(() => () => y(), [y]), s.useEffect(() => {
164
- if (a && l) {
165
- const h = (T) => u(T, l), C = (T) => u(T, a);
166
- return a.addEventListener("pointerleave", h), l.addEventListener("pointerleave", C), () => {
167
- a.removeEventListener("pointerleave", h), l.removeEventListener("pointerleave", C);
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);
168
381
  };
169
382
  }
170
- }, [a, l, u, y]), s.useEffect(() => {
171
- if (c) {
172
- const h = (C) => {
173
- const T = C.target, x = { x: C.clientX, y: C.clientY }, m = (a == null ? void 0 : a.contains(T)) || (l == null ? void 0 : l.contains(T)), b = !me(x, c);
174
- m ? y() : b && (y(), p());
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());
175
388
  };
176
- return document.addEventListener("pointermove", h), () => document.removeEventListener("pointermove", h);
389
+ return document.addEventListener("pointermove", v), () => document.removeEventListener("pointermove", v);
177
390
  }
178
- }, [a, l, c, p, y]), /* @__PURE__ */ d(W, { ...e, ref: i });
179
- }), [ve, he] = R(A, { isInside: !1 }), W = s.forwardRef(
180
- (e, o) => {
391
+ }, [l, c, i, p, y]), /* @__PURE__ */ d(Te, { ...e, ref: s });
392
+ }), [bt, At] = L($, { isInside: !1 }), Te = a.forwardRef(
393
+ (e, r) => {
181
394
  const {
182
395
  __scopeTooltip: t,
183
- children: r,
396
+ children: o,
184
397
  "aria-label": n,
185
- onEscapeKeyDown: i,
186
- onPointerDownOutside: c,
187
- ...v
188
- } = e, a = D(w, t), p = _(t), { onClose: l } = a;
189
- return s.useEffect(() => (document.addEventListener(L, l), () => document.removeEventListener(L, l)), [l]), s.useEffect(() => {
190
- if (a.trigger) {
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(() => {
403
+ if (l.trigger) {
191
404
  const f = (y) => {
192
405
  const u = y.target;
193
- u != null && u.contains(a.trigger) && l();
406
+ u != null && u.contains(l.trigger) && c();
194
407
  };
195
408
  return window.addEventListener("scroll", f, { capture: !0 }), () => window.removeEventListener("scroll", f, { capture: !0 });
196
409
  }
197
- }, [a.trigger, l]), /* @__PURE__ */ d(
198
- oe,
410
+ }, [l.trigger, c]), /* @__PURE__ */ d(
411
+ rt,
199
412
  {
200
413
  asChild: !0,
201
414
  disableOutsidePointerEvents: !1,
202
- onEscapeKeyDown: i,
203
- onPointerDownOutside: c,
415
+ onEscapeKeyDown: s,
416
+ onPointerDownOutside: i,
204
417
  onFocusOutside: (f) => f.preventDefault(),
205
- onDismiss: l,
206
- children: /* @__PURE__ */ O(
207
- re,
418
+ onDismiss: c,
419
+ children: /* @__PURE__ */ j(
420
+ ht,
208
421
  {
209
- "data-state": a.stateAttribute,
422
+ "data-state": l.stateAttribute,
210
423
  ...p,
211
- ...v,
212
- ref: o,
424
+ ...h,
425
+ ref: r,
213
426
  style: {
214
- ...v.style,
427
+ ...h.style,
215
428
  "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
216
429
  "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
217
430
  "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
@@ -219,8 +432,8 @@ var de = "TooltipPortal", [Oe, pe] = R(de, {
219
432
  "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
220
433
  },
221
434
  children: [
222
- /* @__PURE__ */ d(Z, { children: r }),
223
- /* @__PURE__ */ d(ve, { scope: t, isInside: !0, children: /* @__PURE__ */ d(ie, { id: a.contentId, role: "tooltip", children: n || r }) })
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 }) })
224
437
  ]
225
438
  }
226
439
  )
@@ -228,127 +441,127 @@ var de = "TooltipPortal", [Oe, pe] = R(de, {
228
441
  );
229
442
  }
230
443
  );
231
- q.displayName = w;
232
- var X = "TooltipArrow", K = s.forwardRef(
233
- (e, o) => {
234
- const { __scopeTooltip: t, ...r } = e, n = _(t);
235
- return he(
236
- X,
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,
237
450
  t
238
- ).isInside ? null : /* @__PURE__ */ d(ne, { ...n, ...r, ref: o });
451
+ ).isInside ? null : /* @__PURE__ */ d(vt, { ...n, ...o, ref: r });
239
452
  }
240
453
  );
241
- K.displayName = X;
242
- function ye(e, o) {
243
- const t = Math.abs(o.top - e.y), r = Math.abs(o.bottom - e.y), n = Math.abs(o.right - e.x), i = Math.abs(o.left - e.x);
244
- switch (Math.min(t, r, n, i)) {
245
- 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:
246
459
  return "left";
247
460
  case n:
248
461
  return "right";
249
462
  case t:
250
463
  return "top";
251
- case r:
464
+ case o:
252
465
  return "bottom";
253
466
  default:
254
467
  throw new Error("unreachable");
255
468
  }
256
469
  }
257
- function Te(e, o, t = 5) {
258
- const r = [];
259
- switch (o) {
470
+ function Rt(e, r, t = 5) {
471
+ const o = [];
472
+ switch (r) {
260
473
  case "top":
261
- r.push(
474
+ o.push(
262
475
  { x: e.x - t, y: e.y + t },
263
476
  { x: e.x + t, y: e.y + t }
264
477
  );
265
478
  break;
266
479
  case "bottom":
267
- r.push(
480
+ o.push(
268
481
  { x: e.x - t, y: e.y - t },
269
482
  { x: e.x + t, y: e.y - t }
270
483
  );
271
484
  break;
272
485
  case "left":
273
- r.push(
486
+ o.push(
274
487
  { x: e.x + t, y: e.y - t },
275
488
  { x: e.x + t, y: e.y + t }
276
489
  );
277
490
  break;
278
491
  case "right":
279
- r.push(
492
+ o.push(
280
493
  { x: e.x - t, y: e.y - t },
281
494
  { x: e.x - t, y: e.y + t }
282
495
  );
283
496
  break;
284
497
  }
285
- return r;
498
+ return o;
286
499
  }
287
- function Ce(e) {
288
- const { top: o, right: t, bottom: r, left: n } = e;
500
+ function _t(e) {
501
+ const { top: r, right: t, bottom: o, left: n } = e;
289
502
  return [
290
- { x: n, y: o },
291
- { x: t, y: o },
503
+ { x: n, y: r },
292
504
  { x: t, y: r },
293
- { x: n, y: r }
505
+ { x: t, y: o },
506
+ { x: n, y: o }
294
507
  ];
295
508
  }
296
- function me(e, o) {
297
- const { x: t, y: r } = e;
509
+ function Ot(e, r) {
510
+ const { x: t, y: o } = e;
298
511
  let n = !1;
299
- for (let i = 0, c = o.length - 1; i < o.length; c = i++) {
300
- const v = o[i].x, a = o[i].y, p = o[c].x, l = o[c].y;
301
- a > r != l > r && t < (p - v) * (r - a) / (l - a) + v && (n = !n);
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);
302
515
  }
303
516
  return n;
304
517
  }
305
- function xe(e) {
306
- const o = e.slice();
307
- return o.sort((t, r) => t.x < r.x ? -1 : t.x > r.x ? 1 : t.y < r.y ? -1 : t.y > r.y ? 1 : 0), ge(o);
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);
308
521
  }
309
- function ge(e) {
522
+ function St(e) {
310
523
  if (e.length <= 1)
311
524
  return e.slice();
312
- const o = [];
313
- for (let r = 0; r < e.length; r++) {
314
- const n = e[r];
315
- for (; o.length >= 2; ) {
316
- const i = o[o.length - 1], c = o[o.length - 2];
317
- if ((i.x - c.x) * (n.y - c.y) >= (i.y - c.y) * (n.x - c.x))
318
- o.pop();
525
+ const r = [];
526
+ for (let o = 0; o < e.length; o++) {
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();
319
532
  else
320
533
  break;
321
534
  }
322
- o.push(n);
535
+ r.push(n);
323
536
  }
324
- o.pop();
537
+ r.pop();
325
538
  const t = [];
326
- for (let r = e.length - 1; r >= 0; r--) {
327
- const n = e[r];
539
+ for (let o = e.length - 1; o >= 0; o--) {
540
+ const n = e[o];
328
541
  for (; t.length >= 2; ) {
329
- const i = t[t.length - 1], c = t[t.length - 2];
330
- if ((i.x - c.x) * (n.y - c.y) >= (i.y - c.y) * (n.x - c.x))
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))
331
544
  t.pop();
332
545
  else
333
546
  break;
334
547
  }
335
548
  t.push(n);
336
549
  }
337
- return t.pop(), o.length === 1 && t.length === 1 && o[0].x === t[0].x && o[0].y === t[0].y ? o : o.concat(t);
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);
338
551
  }
339
- const we = "_tooltipContent_12gjy_1", be = "_tooltipArrow_12gjy_8", Ee = "_fadeIn_12gjy_1", H = {
340
- tooltipContent: we,
341
- tooltipArrow: be,
342
- fadeIn: Ee
343
- }, Le = se(
344
- ({ children: e, content: o, className: t, style: r }, n) => /* @__PURE__ */ d(B, { children: /* @__PURE__ */ O(U, { delayDuration: 1e3, children: [
345
- /* @__PURE__ */ d(Y, { asChild: !0, children: /* @__PURE__ */ d("div", { ref: n, className: t, style: r, children: e }) }),
346
- /* @__PURE__ */ O(q, { className: H.tooltipContent, sideOffset: 5, children: [
347
- /* @__PURE__ */ d(K, { className: H.tooltipArrow }),
348
- /* @__PURE__ */ d("span", { children: o })
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 })
349
562
  ] })
350
563
  ] }) })
351
564
  );
352
565
  export {
353
- Le as default
566
+ Wt as default
354
567
  };