@pdf-viewer/react 1.0.1 → 1.1.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 (64) hide show
  1. package/dist/RPDefaultLayout-62e0f668.js +2754 -0
  2. package/dist/assets/RPDefaultLayout.css +1 -1
  3. package/dist/components/RPConfig.js +340 -318
  4. package/dist/components/RPController.js +1 -1
  5. package/dist/components/RPPages.js +3 -2
  6. package/dist/components/RPProvider.js +1 -1
  7. package/dist/components/layout/RPDefaultLayout.js +4 -2
  8. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  9. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  10. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  11. package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
  12. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  13. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  14. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  15. package/dist/components/layout/toolbar/MostPageTool.js +2 -2
  16. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  17. package/dist/components/layout/toolbar/Paginate.js +1 -1
  18. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  19. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  20. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  21. package/dist/components/layout/toolbar/RotateTool.js +1 -1
  22. package/dist/components/layout/toolbar/ScrollModeTool.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/ViewModeTool.js +1 -1
  26. package/dist/components/layout/toolbar/ZoomTool.js +2 -2
  27. package/dist/components/page/AnnotationLayer.js +1 -1
  28. package/dist/components/page/CanvasLayer.js +1 -1
  29. package/dist/components/page/DualPage.js +1 -1
  30. package/dist/components/page/RPPage.js +1 -1
  31. package/dist/components/page/SinglePage.js +1 -1
  32. package/dist/components/page/TextLayer.js +1 -1
  33. package/dist/components/ui/Checkbox.js +92 -252
  34. package/dist/components/ui/DropDown.js +1 -1
  35. package/dist/components/ui/LoadingIndicator.js +1 -1
  36. package/dist/components/ui/RPTooltip.js +224 -961
  37. package/dist/contexts/DarkModeContext.js +9 -9
  38. package/dist/contexts/PaginationContext.js +1 -1
  39. package/dist/contexts/PrintContext.js +1 -1
  40. package/dist/contexts/RPDocumentContext.js +24 -37
  41. package/dist/contexts/RotationContext.js +8 -8
  42. package/dist/contexts/ScrollModeContext.js +5 -5
  43. package/dist/contexts/SearchContext.js +1 -1
  44. package/dist/contexts/SelectionModeContext.js +1 -1
  45. package/dist/contexts/ThumbnailsContext.js +1 -1
  46. package/dist/contexts/ViewModeContext.js +9 -9
  47. package/dist/contexts/ZoomContext.js +11 -11
  48. package/dist/index-1db49c1a.js +1664 -0
  49. package/dist/index-3dff3fa8.js +307 -0
  50. package/dist/index-4f17fe4d.js +1657 -0
  51. package/dist/main.js +1 -1
  52. package/dist/utils/hooks/useFileDownload.js +1 -1
  53. package/dist/utils/hooks/useLicense.js +37 -40
  54. package/dist/utils/hooks/usePaginate.js +1 -1
  55. package/dist/utils/hooks/usePrint.js +1 -1
  56. package/dist/utils/hooks/useScrollToPage.js +1 -1
  57. package/dist/utils/hooks/useSearch.js +1 -1
  58. package/dist/utils/hooks/useThumbnail.js +1 -1
  59. package/dist/utils/hooks/useVirtualReactWindow.js +1 -1
  60. package/package.json +1 -1
  61. package/dist/RPDefaultLayout-adbb0836.js +0 -2707
  62. package/dist/floating-ui.react-dom-e6d5fe8f.js +0 -1327
  63. package/dist/index-316854c1.js +0 -2299
  64. package/dist/index-71898eb9.js +0 -139
@@ -1,751 +1,14 @@
1
- import { jsx as f, Fragment as F, jsxs as Y } from "react/jsx-runtime";
1
+ import { jsx as d, jsxs as O } from "react/jsx-runtime";
2
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";
5
- 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 } = {}) {
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 me(e, t) {
14
- if (typeof e == "function")
15
- return e(t);
16
- e != null && (e.current = t);
17
- }
18
- function Pe(...e) {
19
- return (t) => {
20
- let n = !1;
21
- const o = e.map((r) => {
22
- const i = me(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() : me(e[r], null);
30
- }
31
- };
32
- };
33
- }
34
- function _(...e) {
35
- return s.useCallback(Pe(...e), e);
36
- }
37
- var be = s.forwardRef((e, t) => {
38
- const { children: n, ...o } = e, r = s.Children.toArray(n), i = r.find(Nt);
39
- 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 });
42
- }
43
- return /* @__PURE__ */ f(G, { ...o, ref: t, children: n });
44
- });
45
- be.displayName = "Slot";
46
- var G = s.forwardRef((e, t) => {
47
- 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);
51
- }
52
- return s.Children.count(n) > 1 ? s.Children.only(null) : null;
53
- });
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;
58
- }
59
- function St(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] = (...c) => {
64
- i(...c), r(...c);
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 Dt(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 _t = [
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
- ], 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 });
95
- });
96
- return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
97
- }, {});
98
- function Lt(e, t) {
99
- e && yt.flushSync(() => e.dispatchEvent(t));
100
- }
101
- var $t = "DismissableLayer", X = "dismissableLayer.update", Mt = "dismissableLayer.pointerDownOutside", It = "dismissableLayer.focusOutside", he, Re = s.createContext({
102
- layers: /* @__PURE__ */ new Set(),
103
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
104
- branches: /* @__PURE__ */ new Set()
105
- }), Ae = 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: c,
114
- ...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());
121
- }, 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);
128
- };
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,
136
- {
137
- ...l,
138
- ref: v,
139
- style: {
140
- pointerEvents: x ? P ? "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
- R.onPointerDownCapture
148
- )
149
- }
150
- );
151
- }
152
- );
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(() => {
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(ee.div, { ...e, ref: r });
163
- });
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(() => {
167
- });
168
- return s.useEffect(() => {
169
- const i = (c) => {
170
- if (c.target && !o.current) {
171
- let l = function() {
172
- Te(
173
- Mt,
174
- n,
175
- u,
176
- { discrete: !0 }
177
- );
178
- };
179
- const u = { originalEvent: c };
180
- c.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 Ft(e, t = globalThis == null ? void 0 : globalThis.document) {
196
- const n = Q(e), o = s.useRef(!1);
197
- return s.useEffect(() => {
198
- const r = (i) => {
199
- i.target && !o.current && Te(It, 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 ve() {
210
- const e = new CustomEvent(X);
211
- document.dispatchEvent(e);
212
- }
213
- function Te(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 ? Lt(r, i) : r.dispatchEvent(i);
216
- }
217
- function ye(e, t) {
218
- if (typeof e == "function")
219
- return e(t);
220
- e != null && (e.current = t);
221
- }
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;
228
- });
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);
234
- }
235
- };
236
- };
237
- }
238
- var Oe = s.forwardRef((e, t) => {
239
- const { children: n, ...o } = e, r = s.Children.toArray(n), i = r.find(Ut);
240
- 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 });
243
- }
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);
252
- }
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;
259
- }
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(" "));
267
- }
268
- return { ...e, ...n };
269
- }
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);
274
- }
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 });
296
- });
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" })
310
- }
311
- );
312
- });
313
- Ne.displayName = zt;
314
- var Zt = Ne;
315
- function ge(e, t) {
316
- if (typeof e == "function")
317
- return e(t);
318
- e != null && (e.current = t);
319
- }
320
- function Se(...e) {
321
- return (t) => {
322
- let n = !1;
323
- const o = e.map((r) => {
324
- const i = ge(r, t);
325
- return !n && typeof i == "function" && (n = !0), i;
326
- });
327
- if (n)
328
- return () => {
329
- for (let r = 0; r < o.length; r++) {
330
- const i = o[r];
331
- typeof i == "function" ? i() : ge(e[r], null);
332
- }
333
- };
334
- };
335
- }
336
- function De(...e) {
337
- return s.useCallback(Se(...e), e);
338
- }
339
- var _e = s.forwardRef((e, t) => {
340
- const { children: n, ...o } = e, r = s.Children.toArray(n), i = r.find(Kt);
341
- 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 });
344
- }
345
- return /* @__PURE__ */ f(Z, { ...o, ref: t, children: n });
346
- });
347
- _e.displayName = "Slot";
348
- var Z = s.forwardRef((e, t) => {
349
- 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);
353
- }
354
- return s.Children.count(n) > 1 ? s.Children.only(null) : null;
355
- });
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;
360
- }
361
- function Jt(e, t) {
362
- const n = { ...t };
363
- for (const o in t) {
364
- const r = e[o], i = t[o];
365
- /^on[A-Z]/.test(o) ? r && i ? n[o] = (...c) => {
366
- i(...c), r(...c);
367
- } : r && (n[o] = r) : o === "style" ? n[o] = { ...r, ...i } : o === "className" && (n[o] = [r, i].filter(Boolean).join(" "));
368
- }
369
- return { ...e, ...n };
370
- }
371
- function Qt(e) {
372
- var o, r;
373
- let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
374
- 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
- }
376
- var en = [
377
- "a",
378
- "button",
379
- "div",
380
- "form",
381
- "h2",
382
- "h3",
383
- "img",
384
- "input",
385
- "label",
386
- "li",
387
- "nav",
388
- "ol",
389
- "p",
390
- "span",
391
- "svg",
392
- "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 });
397
- });
398
- 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 });
402
- };
403
- We.displayName = te;
404
- var ke = "PopperAnchor", He = s.forwardRef(
405
- (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 });
410
- }
411
- );
412
- He.displayName = ke;
413
- var ne = "PopperContent", [nn, rn] = $e(ne), Fe = s.forwardRef(
414
- (e, t) => {
415
- var ae, le, ce, ue, de, fe;
416
- const {
417
- __scopePopper: n,
418
- side: o = "bottom",
419
- sideOffset: r = 0,
420
- align: i = "center",
421
- alignOffset: a = 0,
422
- arrowPadding: c = 0,
423
- avoidCollisions: l = !0,
424
- collisionBoundary: u = [],
425
- collisionPadding: d = 0,
426
- sticky: m = "partial",
427
- hideWhenDetached: h = !1,
428
- 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),
434
- // 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({
437
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
438
- strategy: "fixed",
439
- placement: L,
440
- whileElementsMounted: (...D) => Ct(...D, {
441
- animationFrame: p === "always"
442
- }),
443
- elements: {
444
- reference: w.anchor
445
- },
446
- middleware: [
447
- Et({ mainAxis: r + T, alignmentAxis: a }),
448
- l && Pt({
449
- mainAxis: !0,
450
- crossAxis: !1,
451
- limiter: m === "partial" ? Tt() : void 0,
452
- ...$
453
- }),
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`);
460
- }
461
- }),
462
- P && Rt({ element: P, padding: c }),
463
- an({ arrowWidth: g, arrowHeight: T }),
464
- h && At({ strategy: "referenceHidden", ...$ })
465
- ]
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(
474
- "div",
475
- {
476
- ref: nt.setFloating,
477
- "data-radix-popper-content-wrapper": "",
478
- style: {
479
- ...ie,
480
- transform: M ? ie.transform : "translate(0, -200%)",
481
- // keep off the page when measuring
482
- minWidth: "max-content",
483
- zIndex: lt,
484
- "--radix-popper-transform-origin": [
485
- (ue = O.transformOrigin) == null ? void 0 : ue.x,
486
- (de = O.transformOrigin) == null ? void 0 : de.y
487
- ].join(" "),
488
- // hide the content if using the hide middleware and should be hidden
489
- // set visibility to hidden and disable pointer events so the UI behaves
490
- // as if the PopperContent isn't there at all
491
- ...((fe = O.hide) == null ? void 0 : fe.referenceHidden) && {
492
- visibility: "hidden",
493
- pointerEvents: "none"
494
- }
495
- },
496
- dir: e.dir,
497
- children: /* @__PURE__ */ f(
498
- nn,
499
- {
500
- scope: n,
501
- placedSide: se,
502
- onArrowChange: R,
503
- arrowX: it,
504
- arrowY: st,
505
- shouldHideArrow: at,
506
- children: /* @__PURE__ */ f(
507
- Le.div,
508
- {
509
- "data-side": se,
510
- "data-align": ot,
511
- ...y,
512
- ref: x,
513
- style: {
514
- ...y.style,
515
- // if the PopperContent hasn't been placed yet (not all measurements done)
516
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
517
- animation: M ? void 0 : "none"
518
- }
519
- }
520
- )
521
- }
522
- )
523
- }
524
- );
525
- }
526
- );
527
- Fe.displayName = ne;
528
- var Ve = "PopperArrow", on = {
529
- top: "bottom",
530
- right: "left",
531
- bottom: "top",
532
- left: "right"
533
- }, Be = s.forwardRef(function(t, n) {
534
- const { __scopePopper: o, ...r } = t, i = rn(Ve, o), a = on[i.placedSide];
535
- return (
536
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
537
- // doesn't report size as we'd expect on SVG elements.
538
- // it reports their bounding box which is effectively the largest path inside the SVG.
539
- /* @__PURE__ */ f(
540
- "span",
541
- {
542
- ref: i.onArrowChange,
543
- style: {
544
- position: "absolute",
545
- left: i.arrowX,
546
- top: i.arrowY,
547
- [a]: 0,
548
- transformOrigin: {
549
- top: "",
550
- right: "0 0",
551
- bottom: "center 0",
552
- left: "100% 0"
553
- }[i.placedSide],
554
- transform: {
555
- top: "translateY(100%)",
556
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
557
- bottom: "rotate(180deg)",
558
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
559
- }[i.placedSide],
560
- visibility: i.shouldHideArrow ? "hidden" : void 0
561
- },
562
- children: /* @__PURE__ */ f(
563
- Zt,
564
- {
565
- ...r,
566
- ref: n,
567
- style: {
568
- ...r.style,
569
- // ensures the element can be measured correctly (mostly for if SVG)
570
- display: "block"
571
- }
572
- }
573
- )
574
- }
575
- )
576
- );
577
- });
578
- Be.displayName = Ve;
579
- function sn(e) {
580
- return e !== null;
581
- }
582
- var an = (e) => ({
583
- name: "transformOrigin",
584
- options: e,
585
- 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 } };
590
- }
591
- });
592
- function Ue(e) {
593
- const [t, n = "center"] = e.split("-");
594
- return [t, n];
595
- }
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);
599
- }
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;
603
- };
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, {
607
- mounted: {
608
- UNMOUNT: "unmounted",
609
- ANIMATION_OUT: "unmountSuspended"
610
- },
611
- unmountSuspended: {
612
- MOUNT: "mounted",
613
- ANIMATION_END: "unmounted"
614
- },
615
- unmounted: {
616
- MOUNT: "mounted"
617
- }
618
- });
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;
627
- }
628
- }, [e, l]), H(() => {
629
- 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);
637
- });
638
- }
639
- }, h = (p) => {
640
- p.target === t && (i.current = k(o.current));
641
- };
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);
644
- };
645
- } else
646
- l("ANIMATION_END");
647
- }, [t, l]), {
648
- isPresent: ["mounted", "unmountSuspended"].includes(c),
649
- ref: s.useCallback((u) => {
650
- u && (o.current = getComputedStyle(u)), n(u);
651
- }, [])
652
- };
653
- }
654
- function k(e) {
655
- return (e == null ? void 0 : e.animationName) || "none";
656
- }
657
- function mn(e) {
658
- var o, r;
659
- let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
660
- 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
- }
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 });
688
- }
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;
704
- }
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 };
714
- }
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,
3
+ import { forwardRef as z } from "react";
4
+ import { P as S, c as J, u as Q, a as G, b as w, d as Z, S as $ } from "../../index-3dff3fa8.js";
5
+ import { c as F, u as ee, R as te, A as oe, D as re, C as ne, a as se } from "../../index-4f17fe4d.js";
6
+ import '../../assets/RPTooltip.css';var ae = "VisuallyHidden", j = s.forwardRef(
7
+ (e, o) => /* @__PURE__ */ d(
8
+ S.span,
746
9
  {
747
10
  ...e,
748
- ref: t,
11
+ ref: o,
749
12
  style: {
750
13
  // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
751
14
  position: "absolute",
@@ -763,192 +26,192 @@ var Cn = [
763
26
  }
764
27
  )
765
28
  );
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) => {
29
+ j.displayName = ae;
30
+ var ie = j, [R, Oe] = J("Tooltip", [
31
+ F
32
+ ]), _ = F(), V = "TooltipProvider", le = 700, L = "tooltip.open", [ce, I] = R(V), B = (e) => {
770
33
  const {
771
- __scopeTooltip: t,
772
- delayDuration: n = xn,
773
- skipDelayDuration: o = 300,
774
- disableHoverableContent: r = !1,
34
+ __scopeTooltip: o,
35
+ delayDuration: t = le,
36
+ skipDelayDuration: r = 300,
37
+ disableHoverableContent: n = !1,
775
38
  children: i
776
- } = e, [a, c] = s.useState(!0), l = s.useRef(!1), u = s.useRef(0);
39
+ } = e, [c, v] = s.useState(!0), a = s.useRef(!1), p = s.useRef(0);
777
40
  return s.useEffect(() => {
778
- const d = u.current;
779
- return () => window.clearTimeout(d);
780
- }, []), /* @__PURE__ */ f(
781
- Rn,
41
+ const l = p.current;
42
+ return () => window.clearTimeout(l);
43
+ }, []), /* @__PURE__ */ d(
44
+ ce,
782
45
  {
783
- scope: t,
784
- isOpenDelayed: a,
785
- delayDuration: n,
46
+ scope: o,
47
+ isOpenDelayed: c,
48
+ delayDuration: t,
786
49
  onOpen: s.useCallback(() => {
787
- window.clearTimeout(u.current), c(!1);
50
+ window.clearTimeout(p.current), v(!1);
788
51
  }, []),
789
52
  onClose: s.useCallback(() => {
790
- window.clearTimeout(u.current), u.current = window.setTimeout(
791
- () => c(!0),
792
- o
53
+ window.clearTimeout(p.current), p.current = window.setTimeout(
54
+ () => v(!0),
55
+ r
793
56
  );
794
- }, [o]),
795
- isPointerInTransitRef: l,
796
- onPointerInTransitChange: s.useCallback((d) => {
797
- l.current = d;
57
+ }, [r]),
58
+ isPointerInTransitRef: a,
59
+ onPointerInTransitChange: s.useCallback((l) => {
60
+ a.current = l;
798
61
  }, []),
799
- disableHoverableContent: r,
62
+ disableHoverableContent: n,
800
63
  children: i
801
64
  }
802
65
  );
803
66
  };
804
- ze.displayName = Xe;
805
- var U = "Tooltip", [An, j] = V(U), Ze = (e) => {
67
+ B.displayName = V;
68
+ var A = "Tooltip", [ue, D] = R(A), U = (e) => {
806
69
  const {
807
- __scopeTooltip: t,
808
- children: n,
809
- open: o,
810
- defaultOpen: r = !1,
70
+ __scopeTooltip: o,
71
+ children: t,
72
+ open: r,
73
+ defaultOpen: n = !1,
811
74
  onOpenChange: i,
812
- disableHoverableContent: a,
813
- 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({
815
- prop: o,
816
- defaultProp: r,
817
- onChange: (g) => {
818
- g ? (l.onOpen(), document.dispatchEvent(new CustomEvent(K))) : l.onClose(), i == null || i(g);
75
+ disableHoverableContent: c,
76
+ delayDuration: v
77
+ } = e, a = I(A, e.__scopeTooltip), p = _(o), [l, f] = s.useState(null), y = ee(), u = s.useRef(0), h = c ?? a.disableHoverableContent, C = v ?? a.delayDuration, T = s.useRef(!1), [x = !1, m] = Q({
78
+ prop: r,
79
+ defaultProp: n,
80
+ onChange: (M) => {
81
+ M ? (a.onOpen(), document.dispatchEvent(new CustomEvent(L))) : a.onClose(), i == null || i(M);
819
82
  }
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(() => {
825
- window.clearTimeout(p.current), p.current = window.setTimeout(() => {
826
- w.current = !0, C(!0), p.current = 0;
827
- }, y);
828
- }, [y, C]);
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]), N = s.useCallback(() => {
88
+ window.clearTimeout(u.current), u.current = window.setTimeout(() => {
89
+ T.current = !0, m(!0), u.current = 0;
90
+ }, C);
91
+ }, [C, m]);
829
92
  return s.useEffect(() => () => {
830
- p.current && (window.clearTimeout(p.current), p.current = 0);
831
- }, []), /* @__PURE__ */ f(ln, { ...u, children: /* @__PURE__ */ f(
832
- An,
93
+ u.current && (window.clearTimeout(u.current), u.current = 0);
94
+ }, []), /* @__PURE__ */ d(te, { ...p, children: /* @__PURE__ */ d(
95
+ ue,
833
96
  {
834
- scope: t,
835
- contentId: h,
836
- open: E,
837
- stateAttribute: x,
838
- trigger: d,
839
- onTriggerChange: m,
97
+ scope: o,
98
+ contentId: y,
99
+ open: x,
100
+ stateAttribute: b,
101
+ trigger: l,
102
+ onTriggerChange: f,
840
103
  onTriggerEnter: s.useCallback(() => {
841
- l.isOpenDelayed ? b() : P();
842
- }, [l.isOpenDelayed, b, P]),
104
+ a.isOpenDelayed ? N() : E();
105
+ }, [a.isOpenDelayed, N, E]),
843
106
  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,
849
- children: n
107
+ h ? P() : (window.clearTimeout(u.current), u.current = 0);
108
+ }, [P, h]),
109
+ onOpen: E,
110
+ onClose: P,
111
+ disableHoverableContent: h,
112
+ children: t
850
113
  }
851
114
  ) });
852
115
  };
853
- Ze.displayName = U;
854
- var J = "TooltipTrigger", qe = s.forwardRef(
855
- (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,
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 = G(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(oe, { asChild: !0, ...c, children: /* @__PURE__ */ d(
121
+ S.button,
859
122
  {
860
- "aria-describedby": r.open ? r.contentId : void 0,
861
- "data-state": r.stateAttribute,
862
- ...o,
863
- ref: l,
864
- onPointerMove: A(e.onPointerMove, (h) => {
865
- h.pointerType !== "touch" && !d.current && !i.isPointerInTransitRef.current && (r.onTriggerEnter(), d.current = !0);
123
+ "aria-describedby": n.open ? n.contentId : void 0,
124
+ "data-state": n.stateAttribute,
125
+ ...r,
126
+ ref: a,
127
+ onPointerMove: w(e.onPointerMove, (y) => {
128
+ y.pointerType !== "touch" && !l.current && !i.isPointerInTransitRef.current && (n.onTriggerEnter(), l.current = !0);
866
129
  }),
867
- onPointerLeave: A(e.onPointerLeave, () => {
868
- r.onTriggerLeave(), d.current = !1;
130
+ onPointerLeave: w(e.onPointerLeave, () => {
131
+ n.onTriggerLeave(), l.current = !1;
869
132
  }),
870
- onPointerDown: A(e.onPointerDown, () => {
871
- u.current = !0, document.addEventListener("pointerup", m, { once: !0 });
133
+ onPointerDown: w(e.onPointerDown, () => {
134
+ p.current = !0, document.addEventListener("pointerup", f, { once: !0 });
872
135
  }),
873
- onFocus: A(e.onFocus, () => {
874
- u.current || r.onOpen();
136
+ onFocus: w(e.onFocus, () => {
137
+ p.current || n.onOpen();
875
138
  }),
876
- onBlur: A(e.onBlur, r.onClose),
877
- onClick: A(e.onClick, r.onClose)
139
+ onBlur: w(e.onBlur, n.onClose),
140
+ onClick: w(e.onClick, n.onClose)
878
141
  }
879
142
  ) });
880
143
  }
881
144
  );
882
- qe.displayName = J;
883
- var Tn = "TooltipPortal", [Xn, On] = V(Tn, {
145
+ Y.displayName = k;
146
+ var de = "TooltipPortal", [Le, pe] = R(de, {
884
147
  forceMount: void 0
885
- }), N = "TooltipContent", Ke = s.forwardRef(
886
- (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 }) });
148
+ }), g = "TooltipContent", q = s.forwardRef(
149
+ (e, o) => {
150
+ const t = pe(g, e.__scopeTooltip), { forceMount: r = t.forceMount, side: n = "top", ...i } = e, c = D(g, e.__scopeTooltip);
151
+ return /* @__PURE__ */ d(Z, { present: r || c.open, children: c.disableHoverableContent ? /* @__PURE__ */ d(W, { side: n, ...i, ref: o }) : /* @__PURE__ */ d(fe, { side: n, ...i, ref: o }) });
889
152
  }
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);
153
+ ), fe = s.forwardRef((e, o) => {
154
+ const t = D(g, e.__scopeTooltip), r = I(g, e.__scopeTooltip), n = s.useRef(null), i = G(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);
897
160
  },
898
- [m]
161
+ [f]
899
162
  );
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);
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);
905
168
  };
906
169
  }
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());
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());
912
175
  };
913
- return document.addEventListener("pointermove", v), () => document.removeEventListener("pointermove", v);
176
+ return document.addEventListener("pointermove", h), () => document.removeEventListener("pointermove", h);
914
177
  }
915
- }, [l, d, a, u, h]), /* @__PURE__ */ f(Je, { ...e, ref: i });
916
- }), [Sn, Dn] = V(U, { isInside: !1 }), Je = s.forwardRef(
917
- (e, t) => {
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) => {
918
181
  const {
919
- __scopeTooltip: n,
920
- children: o,
921
- "aria-label": r,
182
+ __scopeTooltip: t,
183
+ children: r,
184
+ "aria-label": n,
922
185
  onEscapeKeyDown: i,
923
- onPointerDownOutside: a,
924
- ...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(() => {
927
- if (l.trigger) {
928
- const m = (h) => {
929
- const p = h.target;
930
- p != null && p.contains(l.trigger) && d();
186
+ onPointerDownOutside: c,
187
+ ...v
188
+ } = e, a = D(g, 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) {
191
+ const f = (y) => {
192
+ const u = y.target;
193
+ u != null && u.contains(a.trigger) && l();
931
194
  };
932
- return window.addEventListener("scroll", m, { capture: !0 }), () => window.removeEventListener("scroll", m, { capture: !0 });
195
+ return window.addEventListener("scroll", f, { capture: !0 }), () => window.removeEventListener("scroll", f, { capture: !0 });
933
196
  }
934
- }, [l.trigger, d]), /* @__PURE__ */ f(
935
- Ae,
197
+ }, [a.trigger, l]), /* @__PURE__ */ d(
198
+ re,
936
199
  {
937
200
  asChild: !0,
938
201
  disableOutsidePointerEvents: !1,
939
202
  onEscapeKeyDown: i,
940
- onPointerDownOutside: a,
941
- onFocusOutside: (m) => m.preventDefault(),
942
- onDismiss: d,
943
- children: /* @__PURE__ */ Y(
944
- un,
203
+ onPointerDownOutside: c,
204
+ onFocusOutside: (f) => f.preventDefault(),
205
+ onDismiss: l,
206
+ children: /* @__PURE__ */ O(
207
+ ne,
945
208
  {
946
- "data-state": l.stateAttribute,
947
- ...u,
948
- ...c,
949
- ref: t,
209
+ "data-state": a.stateAttribute,
210
+ ...p,
211
+ ...v,
212
+ ref: o,
950
213
  style: {
951
- ...c.style,
214
+ ...v.style,
952
215
  "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
953
216
  "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
954
217
  "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
@@ -956,8 +219,8 @@ var Tn = "TooltipPortal", [Xn, On] = V(Tn, {
956
219
  "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
957
220
  },
958
221
  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 }) })
222
+ /* @__PURE__ */ d($, { children: r }),
223
+ /* @__PURE__ */ d(ve, { scope: t, isInside: !0, children: /* @__PURE__ */ d(ie, { id: a.contentId, role: "tooltip", children: n || r }) })
961
224
  ]
962
225
  }
963
226
  )
@@ -965,128 +228,128 @@ var Tn = "TooltipPortal", [Xn, On] = V(Tn, {
965
228
  );
966
229
  }
967
230
  );
968
- Ke.displayName = N;
969
- var Qe = "TooltipArrow", et = s.forwardRef(
970
- (e, t) => {
971
- const { __scopeTooltip: n, ...o } = e, r = B(n);
972
- return Dn(
973
- Qe,
974
- n
975
- ).isInside ? null : /* @__PURE__ */ f(dn, { ...r, ...o, ref: t });
231
+ q.displayName = g;
232
+ var X = "TooltipArrow", K = s.forwardRef(
233
+ (e, o) => {
234
+ const { __scopeTooltip: t, ...r } = e, n = _(t);
235
+ return he(
236
+ X,
237
+ t
238
+ ).isInside ? null : /* @__PURE__ */ d(se, { ...n, ...r, ref: o });
976
239
  }
977
240
  );
978
- et.displayName = Qe;
979
- function _n(e, t) {
980
- 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
- switch (Math.min(n, o, r, i)) {
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)) {
982
245
  case i:
983
246
  return "left";
984
- case r:
985
- return "right";
986
247
  case n:
248
+ return "right";
249
+ case t:
987
250
  return "top";
988
- case o:
251
+ case r:
989
252
  return "bottom";
990
253
  default:
991
254
  throw new Error("unreachable");
992
255
  }
993
256
  }
994
- function Ln(e, t, n = 5) {
995
- const o = [];
996
- switch (t) {
257
+ function Te(e, o, t = 5) {
258
+ const r = [];
259
+ switch (o) {
997
260
  case "top":
998
- o.push(
999
- { x: e.x - n, y: e.y + n },
1000
- { x: e.x + n, y: e.y + n }
261
+ r.push(
262
+ { x: e.x - t, y: e.y + t },
263
+ { x: e.x + t, y: e.y + t }
1001
264
  );
1002
265
  break;
1003
266
  case "bottom":
1004
- o.push(
1005
- { x: e.x - n, y: e.y - n },
1006
- { x: e.x + n, y: e.y - n }
267
+ r.push(
268
+ { x: e.x - t, y: e.y - t },
269
+ { x: e.x + t, y: e.y - t }
1007
270
  );
1008
271
  break;
1009
272
  case "left":
1010
- o.push(
1011
- { x: e.x + n, y: e.y - n },
1012
- { x: e.x + n, y: e.y + n }
273
+ r.push(
274
+ { x: e.x + t, y: e.y - t },
275
+ { x: e.x + t, y: e.y + t }
1013
276
  );
1014
277
  break;
1015
278
  case "right":
1016
- o.push(
1017
- { x: e.x - n, y: e.y - n },
1018
- { x: e.x - n, y: e.y + n }
279
+ r.push(
280
+ { x: e.x - t, y: e.y - t },
281
+ { x: e.x - t, y: e.y + t }
1019
282
  );
1020
283
  break;
1021
284
  }
1022
- return o;
285
+ return r;
1023
286
  }
1024
- function $n(e) {
1025
- const { top: t, right: n, bottom: o, left: r } = e;
287
+ function Ce(e) {
288
+ const { top: o, right: t, bottom: r, left: n } = e;
1026
289
  return [
1027
- { x: r, y: t },
1028
- { x: n, y: t },
1029
290
  { x: n, y: o },
1030
- { x: r, y: o }
291
+ { x: t, y: o },
292
+ { x: t, y: r },
293
+ { x: n, y: r }
1031
294
  ];
1032
295
  }
1033
- function Mn(e, t) {
1034
- const { x: n, y: o } = e;
1035
- 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);
296
+ function me(e, o) {
297
+ const { x: t, y: r } = e;
298
+ 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);
1039
302
  }
1040
- return r;
303
+ return n;
1041
304
  }
1042
- function In(e) {
1043
- 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);
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), we(o);
1045
308
  }
1046
- function Wn(e) {
309
+ function we(e) {
1047
310
  if (e.length <= 1)
1048
311
  return e.slice();
1049
- const t = [];
1050
- for (let o = 0; o < e.length; o++) {
1051
- const r = e[o];
1052
- 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))
1055
- t.pop();
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();
1056
319
  else
1057
320
  break;
1058
321
  }
1059
- t.push(r);
322
+ o.push(n);
1060
323
  }
1061
- t.pop();
1062
- const n = [];
1063
- for (let o = e.length - 1; o >= 0; o--) {
1064
- const r = e[o];
1065
- 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))
1068
- n.pop();
324
+ o.pop();
325
+ const t = [];
326
+ for (let r = e.length - 1; r >= 0; r--) {
327
+ const n = e[r];
328
+ 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))
331
+ t.pop();
1069
332
  else
1070
333
  break;
1071
334
  }
1072
- n.push(r);
335
+ t.push(n);
1073
336
  }
1074
- 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
- }
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 })
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);
338
+ }
339
+ const ge = "_tooltipContent_1i9ed_1", be = "_tooltipArrow_1i9ed_8", Ee = "_fadeIn_1i9ed_1", H = {
340
+ tooltipContent: ge,
341
+ tooltipArrow: be,
342
+ fadeIn: Ee
343
+ }, Pe = z(
344
+ ({ children: e, content: o, className: t }, r) => /* @__PURE__ */ d(B, { children: /* @__PURE__ */ O(U, { delayDuration: 1e3, children: [
345
+ /* @__PURE__ */ d(Y, { asChild: !0, children: /* @__PURE__ */ d("div", { ref: r, className: t, 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 })
1086
349
  ] })
1087
350
  ] }) })
1088
351
  );
1089
- Vn.displayName = "RPTooltip";
352
+ Pe.displayName = "RPTooltip";
1090
353
  export {
1091
- Vn as default
354
+ Pe as default
1092
355
  };