@pdf-viewer/react 1.13.0 → 1.13.1-rc.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 (100) hide show
  1. package/dist/{ToolbarLayout.module-126458d9.js → ToolbarLayout.module-eac6ee00.js} +5 -5
  2. package/dist/components/RPController.js +3 -3
  3. package/dist/components/RPPages.js +3 -3
  4. package/dist/components/RPProvider.js +3 -3
  5. package/dist/components/layout/LayoutContainer.js +3 -3
  6. package/dist/components/layout/RPDefaultLayout.js +3 -3
  7. package/dist/components/layout/RPLayout.js +3 -3
  8. package/dist/components/layout/sidebar/RPSidebar.js +3 -3
  9. package/dist/components/layout/sidebar/Thumbnail.js +3 -3
  10. package/dist/components/layout/sidebar/Thumbnails.js +3 -3
  11. package/dist/components/layout/toolbar/DarkModeTool.js +1 -1
  12. package/dist/components/layout/toolbar/DocumentDialog.js +3 -3
  13. package/dist/components/layout/toolbar/DocumentProperties.js +2 -2
  14. package/dist/components/layout/toolbar/FileDownloadTool.js +3 -3
  15. package/dist/components/layout/toolbar/FileUploadTool.js +2 -2
  16. package/dist/components/layout/toolbar/FullScreenTool.js +2 -2
  17. package/dist/components/layout/toolbar/MenuItem.js +2 -2
  18. package/dist/components/layout/toolbar/MenuSeparator.js +2 -2
  19. package/dist/components/layout/toolbar/MostPageTool.js +3 -3
  20. package/dist/components/layout/toolbar/OtherTool.js +3 -3
  21. package/dist/components/layout/toolbar/Paginate.js +3 -3
  22. package/dist/components/layout/toolbar/PrintTool.js +3 -3
  23. package/dist/components/layout/toolbar/RPMenuItem.js +2 -2
  24. package/dist/components/layout/toolbar/RPMoreOptions.js +3 -3
  25. package/dist/components/layout/toolbar/RPToolbar.js +3 -3
  26. package/dist/components/layout/toolbar/RPToolbarEnd.js +3 -3
  27. package/dist/components/layout/toolbar/RotateTool.js +2 -2
  28. package/dist/components/layout/toolbar/ScrollModeTool.js +2 -2
  29. package/dist/components/layout/toolbar/SearchCloseButton.js +1 -1
  30. package/dist/components/layout/toolbar/SearchResultNavigator.js +3 -3
  31. package/dist/components/layout/toolbar/SearchTool.js +3 -3
  32. package/dist/components/layout/toolbar/SelectionModeTool.js +2 -2
  33. package/dist/components/layout/toolbar/ThumbnailTool.js +3 -3
  34. package/dist/components/layout/toolbar/ToolbarCustom.js +3 -3
  35. package/dist/components/layout/toolbar/ToolbarDefault.js +3 -3
  36. package/dist/components/layout/toolbar/ToolbarLayout.js +3 -3
  37. package/dist/components/layout/toolbar/ViewModeTool.js +2 -2
  38. package/dist/components/layout/toolbar/ZoomTool.js +3 -3
  39. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +3 -3
  40. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +3 -3
  41. package/dist/components/layout/toolbar/tools/FileUploadTool.js +1 -1
  42. package/dist/components/layout/toolbar/tools/FullScreenTool.js +1 -1
  43. package/dist/components/layout/toolbar/tools/InputPageTool.js +3 -3
  44. package/dist/components/layout/toolbar/tools/NextPageTool.js +3 -3
  45. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +3 -3
  46. package/dist/components/layout/toolbar/tools/PrintTool.js +3 -3
  47. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +1 -1
  48. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +1 -1
  49. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +1 -1
  50. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +3 -3
  51. package/dist/components/layout/toolbar/tools/ZoomInTool.js +1 -1
  52. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +3 -3
  53. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +3 -3
  54. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +1 -1
  55. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +3 -3
  56. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +3 -3
  57. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +2 -2
  58. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +3 -3
  59. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +3 -3
  60. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +2 -2
  61. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +3 -3
  62. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +3 -3
  63. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +2 -2
  64. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +2 -2
  65. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +2 -2
  66. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +2 -2
  67. package/dist/components/page/AnnotationLayer.js +3 -3
  68. package/dist/components/page/CanvasLayer.js +3 -3
  69. package/dist/components/page/DualPage.js +3 -3
  70. package/dist/components/page/RPPage.js +3 -3
  71. package/dist/components/page/SinglePage.js +3 -3
  72. package/dist/components/page/TextHighlightLayer.js +3 -3
  73. package/dist/components/page/TextLayer.js +3 -3
  74. package/dist/components/ui/DropDown.js +2 -2
  75. package/dist/components/ui/LoadingIndicator.js +3 -3
  76. package/dist/components/ui/RPTooltip.js +200 -430
  77. package/dist/contexts/PaginationContext.js +3 -3
  78. package/dist/contexts/PrintContext.js +3 -3
  79. package/dist/contexts/RenderQueueProvider.js +3 -3
  80. package/dist/contexts/SearchContext.js +3 -3
  81. package/dist/contexts/ThumbnailsContext.js +3 -3
  82. package/dist/index-808ea7bf.js +1685 -0
  83. package/dist/index-a48ec088.js +1672 -0
  84. package/dist/main.js +3 -3
  85. package/dist/types/utils/getElementPositionInPage.d.ts +2 -2
  86. package/dist/types/utils/types.d.ts +6 -0
  87. package/dist/utils/getWordPositionInPage.js +5 -5
  88. package/dist/utils/highlight.js +72 -72
  89. package/dist/utils/hooks/useFileDownload.js +3 -3
  90. package/dist/utils/hooks/useLicense.js +1 -1
  91. package/dist/utils/hooks/usePaginate.js +3 -3
  92. package/dist/utils/hooks/usePresentPage.js +3 -3
  93. package/dist/utils/hooks/usePrint.js +3 -3
  94. package/dist/utils/hooks/useScrollToPage.js +3 -3
  95. package/dist/utils/hooks/useSearch.js +3 -3
  96. package/dist/utils/hooks/useThumbnail.js +3 -3
  97. package/dist/utils/hooks/useVirtualReactWindow.js +3 -3
  98. package/package.json +1 -1
  99. package/dist/floating-ui.react-dom-d22a10b4.js +0 -1474
  100. package/dist/index-3bf64864.js +0 -1886
@@ -1,1886 +0,0 @@
1
- import * as a from "react";
2
- import j, { useState as Dn } from "react";
3
- import { h as $e, P as D, c as pe, u as G, i as Ue, d as On, e as ht, a as S, b as _e, j as gt, g as Fn } from "./index-c9a2990a.js";
4
- import { jsx as d } from "react/jsx-runtime";
5
- import { e as oe, u as kn, a as Ln, o as Gn, s as Kn, l as $n, f as Un, b as Bn, c as Wn, h as Hn, d as Be, D as Yn } from "./floating-ui.react-dom-d22a10b4.js";
6
- import Vn from "react-dom";
7
- var Xn = "Portal", wt = a.forwardRef((e, t) => {
8
- var i;
9
- const { container: n, ...r } = e, [o, c] = a.useState(!1);
10
- $e(() => c(!0), []);
11
- const u = n || o && ((i = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : i.body);
12
- return u ? Vn.createPortal(/* @__PURE__ */ d(D.div, { ...r, ref: t }), u) : null;
13
- });
14
- wt.displayName = Xn;
15
- function yt(e) {
16
- const t = e + "CollectionProvider", [n, r] = pe(t), [o, c] = n(
17
- t,
18
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
19
- ), u = (l) => {
20
- const { scope: v, children: g } = l, b = j.useRef(null), y = j.useRef(/* @__PURE__ */ new Map()).current;
21
- return /* @__PURE__ */ d(o, { scope: v, itemMap: y, collectionRef: b, children: g });
22
- };
23
- u.displayName = t;
24
- const i = e + "CollectionSlot", h = Ue(i), m = j.forwardRef(
25
- (l, v) => {
26
- const { scope: g, children: b } = l, y = c(i, g), E = G(v, y.collectionRef);
27
- return /* @__PURE__ */ d(h, { ref: E, children: b });
28
- }
29
- );
30
- m.displayName = i;
31
- const f = e + "CollectionItemSlot", s = "data-radix-collection-item", p = Ue(f), w = j.forwardRef(
32
- (l, v) => {
33
- const { scope: g, children: b, ...y } = l, E = j.useRef(null), R = G(v, E), P = c(f, g);
34
- return j.useEffect(() => (P.itemMap.set(E, { ref: E, ...y }), () => void P.itemMap.delete(E))), /* @__PURE__ */ d(p, { [s]: "", ref: R, children: b });
35
- }
36
- );
37
- w.displayName = f;
38
- function C(l) {
39
- const v = c(e + "CollectionConsumer", l);
40
- return j.useCallback(() => {
41
- const b = v.collectionRef.current;
42
- if (!b)
43
- return [];
44
- const y = Array.from(b.querySelectorAll(`[${s}]`));
45
- return Array.from(v.itemMap.values()).sort(
46
- (P, I) => y.indexOf(P.ref.current) - y.indexOf(I.ref.current)
47
- );
48
- }, [v.collectionRef, v.itemMap]);
49
- }
50
- return [
51
- { Provider: u, Slot: m, ItemSlot: w },
52
- C,
53
- r
54
- ];
55
- }
56
- var jn = a.createContext(void 0);
57
- function Ct(e) {
58
- const t = a.useContext(jn);
59
- return e || t || "ltr";
60
- }
61
- var Ne = 0;
62
- function zn() {
63
- a.useEffect(() => {
64
- const e = document.querySelectorAll("[data-radix-focus-guard]");
65
- return document.body.insertAdjacentElement("afterbegin", e[0] ?? ot()), document.body.insertAdjacentElement("beforeend", e[1] ?? ot()), Ne++, () => {
66
- Ne === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), Ne--;
67
- };
68
- }, []);
69
- }
70
- function ot() {
71
- const e = document.createElement("span");
72
- return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
73
- }
74
- var De = "focusScope.autoFocusOnMount", Oe = "focusScope.autoFocusOnUnmount", at = { bubbles: !1, cancelable: !0 }, Zn = "FocusScope", bt = a.forwardRef((e, t) => {
75
- const {
76
- loop: n = !1,
77
- trapped: r = !1,
78
- onMountAutoFocus: o,
79
- onUnmountAutoFocus: c,
80
- ...u
81
- } = e, [i, h] = a.useState(null), m = oe(o), f = oe(c), s = a.useRef(null), p = G(t, (l) => h(l)), w = a.useRef({
82
- paused: !1,
83
- pause() {
84
- this.paused = !0;
85
- },
86
- resume() {
87
- this.paused = !1;
88
- }
89
- }).current;
90
- a.useEffect(() => {
91
- if (r) {
92
- let l = function(y) {
93
- if (w.paused || !i)
94
- return;
95
- const E = y.target;
96
- i.contains(E) ? s.current = E : Y(s.current, { select: !0 });
97
- }, v = function(y) {
98
- if (w.paused || !i)
99
- return;
100
- const E = y.relatedTarget;
101
- E !== null && (i.contains(E) || Y(s.current, { select: !0 }));
102
- }, g = function(y) {
103
- if (document.activeElement === document.body)
104
- for (const R of y)
105
- R.removedNodes.length > 0 && Y(i);
106
- };
107
- document.addEventListener("focusin", l), document.addEventListener("focusout", v);
108
- const b = new MutationObserver(g);
109
- return i && b.observe(i, { childList: !0, subtree: !0 }), () => {
110
- document.removeEventListener("focusin", l), document.removeEventListener("focusout", v), b.disconnect();
111
- };
112
- }
113
- }, [r, i, w.paused]), a.useEffect(() => {
114
- if (i) {
115
- it.add(w);
116
- const l = document.activeElement;
117
- if (!i.contains(l)) {
118
- const g = new CustomEvent(De, at);
119
- i.addEventListener(De, m), i.dispatchEvent(g), g.defaultPrevented || (qn(nr(Et(i)), { select: !0 }), document.activeElement === l && Y(i));
120
- }
121
- return () => {
122
- i.removeEventListener(De, m), setTimeout(() => {
123
- const g = new CustomEvent(Oe, at);
124
- i.addEventListener(Oe, f), i.dispatchEvent(g), g.defaultPrevented || Y(l ?? document.body, { select: !0 }), i.removeEventListener(Oe, f), it.remove(w);
125
- }, 0);
126
- };
127
- }
128
- }, [i, m, f, w]);
129
- const C = a.useCallback(
130
- (l) => {
131
- if (!n && !r || w.paused)
132
- return;
133
- const v = l.key === "Tab" && !l.altKey && !l.ctrlKey && !l.metaKey, g = document.activeElement;
134
- if (v && g) {
135
- const b = l.currentTarget, [y, E] = Qn(b);
136
- y && E ? !l.shiftKey && g === E ? (l.preventDefault(), n && Y(y, { select: !0 })) : l.shiftKey && g === y && (l.preventDefault(), n && Y(E, { select: !0 })) : g === b && l.preventDefault();
137
- }
138
- },
139
- [n, r, w.paused]
140
- );
141
- return /* @__PURE__ */ d(D.div, { tabIndex: -1, ...u, ref: p, onKeyDown: C });
142
- });
143
- bt.displayName = Zn;
144
- function qn(e, { select: t = !1 } = {}) {
145
- const n = document.activeElement;
146
- for (const r of e)
147
- if (Y(r, { select: t }), document.activeElement !== n)
148
- return;
149
- }
150
- function Qn(e) {
151
- const t = Et(e), n = ct(t, e), r = ct(t.reverse(), e);
152
- return [n, r];
153
- }
154
- function Et(e) {
155
- const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
156
- acceptNode: (r) => {
157
- const o = r.tagName === "INPUT" && r.type === "hidden";
158
- return r.disabled || r.hidden || o ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
159
- }
160
- });
161
- for (; n.nextNode(); )
162
- t.push(n.currentNode);
163
- return t;
164
- }
165
- function ct(e, t) {
166
- for (const n of e)
167
- if (!Jn(n, { upTo: t }))
168
- return n;
169
- }
170
- function Jn(e, { upTo: t }) {
171
- if (getComputedStyle(e).visibility === "hidden")
172
- return !0;
173
- for (; e; ) {
174
- if (t !== void 0 && e === t)
175
- return !1;
176
- if (getComputedStyle(e).display === "none")
177
- return !0;
178
- e = e.parentElement;
179
- }
180
- return !1;
181
- }
182
- function er(e) {
183
- return e instanceof HTMLInputElement && "select" in e;
184
- }
185
- function Y(e, { select: t = !1 } = {}) {
186
- if (e && e.focus) {
187
- const n = document.activeElement;
188
- e.focus({ preventScroll: !0 }), e !== n && er(e) && t && e.select();
189
- }
190
- }
191
- var it = tr();
192
- function tr() {
193
- let e = [];
194
- return {
195
- add(t) {
196
- const n = e[0];
197
- t !== n && (n == null || n.pause()), e = ut(e, t), e.unshift(t);
198
- },
199
- remove(t) {
200
- var n;
201
- e = ut(e, t), (n = e[0]) == null || n.resume();
202
- }
203
- };
204
- }
205
- function ut(e, t) {
206
- const n = [...e], r = n.indexOf(t);
207
- return r !== -1 && n.splice(r, 1), n;
208
- }
209
- function nr(e) {
210
- return e.filter((t) => t.tagName !== "A");
211
- }
212
- var rr = "Arrow", Mt = a.forwardRef((e, t) => {
213
- const { children: n, width: r = 10, height: o = 5, ...c } = e;
214
- return /* @__PURE__ */ d(
215
- D.svg,
216
- {
217
- ...c,
218
- ref: t,
219
- width: r,
220
- height: o,
221
- viewBox: "0 0 30 10",
222
- preserveAspectRatio: "none",
223
- children: e.asChild ? n : /* @__PURE__ */ d("polygon", { points: "0,0 30,0 15,10" })
224
- }
225
- );
226
- });
227
- Mt.displayName = rr;
228
- var or = Mt, Ve = "Popper", [St, Rt] = pe(Ve), [ar, Pt] = St(Ve), _t = (e) => {
229
- const { __scopePopper: t, children: n } = e, [r, o] = a.useState(null);
230
- return /* @__PURE__ */ d(ar, { scope: t, anchor: r, onAnchorChange: o, children: n });
231
- };
232
- _t.displayName = Ve;
233
- var It = "PopperAnchor", At = a.forwardRef(
234
- (e, t) => {
235
- const { __scopePopper: n, virtualRef: r, ...o } = e, c = Pt(It, n), u = a.useRef(null), i = G(t, u), h = a.useRef(null);
236
- return a.useEffect(() => {
237
- const m = h.current;
238
- h.current = (r == null ? void 0 : r.current) || u.current, m !== h.current && c.onAnchorChange(h.current);
239
- }), r ? null : /* @__PURE__ */ d(D.div, { ...o, ref: i });
240
- }
241
- );
242
- At.displayName = It;
243
- var Xe = "PopperContent", [cr, ir] = St(Xe), xt = a.forwardRef(
244
- (e, t) => {
245
- var W, ie, O, ue, tt, nt;
246
- const {
247
- __scopePopper: n,
248
- side: r = "bottom",
249
- sideOffset: o = 0,
250
- align: c = "center",
251
- alignOffset: u = 0,
252
- arrowPadding: i = 0,
253
- avoidCollisions: h = !0,
254
- collisionBoundary: m = [],
255
- collisionPadding: f = 0,
256
- sticky: s = "partial",
257
- hideWhenDetached: p = !1,
258
- updatePositionStrategy: w = "optimized",
259
- onPlaced: C,
260
- ...l
261
- } = e, v = Pt(Xe, n), [g, b] = a.useState(null), y = G(t, (se) => b(se)), [E, R] = a.useState(null), P = On(E), I = (P == null ? void 0 : P.width) ?? 0, _ = (P == null ? void 0 : P.height) ?? 0, k = r + (c !== "center" ? "-" + c : ""), U = typeof f == "number" ? f : { top: 0, right: 0, bottom: 0, left: 0, ...f }, H = Array.isArray(m) ? m : [m], V = H.length > 0, B = {
262
- padding: U,
263
- boundary: H.filter(sr),
264
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
265
- altBoundary: V
266
- }, { refs: q, floatingStyles: Q, placement: L, isPositioned: J, middlewareData: N } = kn({
267
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
268
- strategy: "fixed",
269
- placement: k,
270
- whileElementsMounted: (...se) => Ln(...se, {
271
- animationFrame: w === "always"
272
- }),
273
- elements: {
274
- reference: v.anchor
275
- },
276
- middleware: [
277
- Gn({ mainAxis: o + _, alignmentAxis: u }),
278
- h && Kn({
279
- mainAxis: !0,
280
- crossAxis: !1,
281
- limiter: s === "partial" ? $n() : void 0,
282
- ...B
283
- }),
284
- h && Un({ ...B }),
285
- Bn({
286
- ...B,
287
- apply: ({ elements: se, rects: rt, availableWidth: An, availableHeight: xn }) => {
288
- const { width: Tn, height: Nn } = rt.reference, we = se.floating.style;
289
- we.setProperty("--radix-popper-available-width", `${An}px`), we.setProperty("--radix-popper-available-height", `${xn}px`), we.setProperty("--radix-popper-anchor-width", `${Tn}px`), we.setProperty("--radix-popper-anchor-height", `${Nn}px`);
290
- }
291
- }),
292
- E && Wn({ element: E, padding: i }),
293
- lr({ arrowWidth: I, arrowHeight: _ }),
294
- p && Hn({ strategy: "referenceHidden", ...B })
295
- ]
296
- }), [M, T] = Dt(L), A = oe(C);
297
- $e(() => {
298
- J && (A == null || A());
299
- }, [J, A]);
300
- const K = (W = N.arrow) == null ? void 0 : W.x, ae = (ie = N.arrow) == null ? void 0 : ie.y, ce = ((O = N.arrow) == null ? void 0 : O.centerOffset) !== 0, [ge, X] = a.useState();
301
- return $e(() => {
302
- g && X(window.getComputedStyle(g).zIndex);
303
- }, [g]), /* @__PURE__ */ d(
304
- "div",
305
- {
306
- ref: q.setFloating,
307
- "data-radix-popper-content-wrapper": "",
308
- style: {
309
- ...Q,
310
- transform: J ? Q.transform : "translate(0, -200%)",
311
- // keep off the page when measuring
312
- minWidth: "max-content",
313
- zIndex: ge,
314
- "--radix-popper-transform-origin": [
315
- (ue = N.transformOrigin) == null ? void 0 : ue.x,
316
- (tt = N.transformOrigin) == null ? void 0 : tt.y
317
- ].join(" "),
318
- // hide the content if using the hide middleware and should be hidden
319
- // set visibility to hidden and disable pointer events so the UI behaves
320
- // as if the PopperContent isn't there at all
321
- ...((nt = N.hide) == null ? void 0 : nt.referenceHidden) && {
322
- visibility: "hidden",
323
- pointerEvents: "none"
324
- }
325
- },
326
- dir: e.dir,
327
- children: /* @__PURE__ */ d(
328
- cr,
329
- {
330
- scope: n,
331
- placedSide: M,
332
- onArrowChange: R,
333
- arrowX: K,
334
- arrowY: ae,
335
- shouldHideArrow: ce,
336
- children: /* @__PURE__ */ d(
337
- D.div,
338
- {
339
- "data-side": M,
340
- "data-align": T,
341
- ...l,
342
- ref: y,
343
- style: {
344
- ...l.style,
345
- // if the PopperContent hasn't been placed yet (not all measurements done)
346
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
347
- animation: J ? void 0 : "none"
348
- }
349
- }
350
- )
351
- }
352
- )
353
- }
354
- );
355
- }
356
- );
357
- xt.displayName = Xe;
358
- var Tt = "PopperArrow", ur = {
359
- top: "bottom",
360
- right: "left",
361
- bottom: "top",
362
- left: "right"
363
- }, Nt = a.forwardRef(function(t, n) {
364
- const { __scopePopper: r, ...o } = t, c = ir(Tt, r), u = ur[c.placedSide];
365
- return (
366
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
367
- // doesn't report size as we'd expect on SVG elements.
368
- // it reports their bounding box which is effectively the largest path inside the SVG.
369
- /* @__PURE__ */ d(
370
- "span",
371
- {
372
- ref: c.onArrowChange,
373
- style: {
374
- position: "absolute",
375
- left: c.arrowX,
376
- top: c.arrowY,
377
- [u]: 0,
378
- transformOrigin: {
379
- top: "",
380
- right: "0 0",
381
- bottom: "center 0",
382
- left: "100% 0"
383
- }[c.placedSide],
384
- transform: {
385
- top: "translateY(100%)",
386
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
387
- bottom: "rotate(180deg)",
388
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
389
- }[c.placedSide],
390
- visibility: c.shouldHideArrow ? "hidden" : void 0
391
- },
392
- children: /* @__PURE__ */ d(
393
- or,
394
- {
395
- ...o,
396
- ref: n,
397
- style: {
398
- ...o.style,
399
- // ensures the element can be measured correctly (mostly for if SVG)
400
- display: "block"
401
- }
402
- }
403
- )
404
- }
405
- )
406
- );
407
- });
408
- Nt.displayName = Tt;
409
- function sr(e) {
410
- return e !== null;
411
- }
412
- var lr = (e) => ({
413
- name: "transformOrigin",
414
- options: e,
415
- fn(t) {
416
- var v, g, b;
417
- const { placement: n, rects: r, middlewareData: o } = t, u = ((v = o.arrow) == null ? void 0 : v.centerOffset) !== 0, i = u ? 0 : e.arrowWidth, h = u ? 0 : e.arrowHeight, [m, f] = Dt(n), s = { start: "0%", center: "50%", end: "100%" }[f], p = (((g = o.arrow) == null ? void 0 : g.x) ?? 0) + i / 2, w = (((b = o.arrow) == null ? void 0 : b.y) ?? 0) + h / 2;
418
- let C = "", l = "";
419
- return m === "bottom" ? (C = u ? s : `${p}px`, l = `${-h}px`) : m === "top" ? (C = u ? s : `${p}px`, l = `${r.floating.height + h}px`) : m === "right" ? (C = `${-h}px`, l = u ? s : `${w}px`) : m === "left" && (C = `${r.floating.width + h}px`, l = u ? s : `${w}px`), { data: { x: C, y: l } };
420
- }
421
- });
422
- function Dt(e) {
423
- const [t, n = "center"] = e.split("-");
424
- return [t, n];
425
- }
426
- var dr = _t, fr = At, pr = xt, vr = Nt, Fe = "rovingFocusGroup.onEntryFocus", mr = { bubbles: !1, cancelable: !0 }, ve = "RovingFocusGroup", [We, Ot, hr] = yt(ve), [gr, Ft] = pe(
427
- ve,
428
- [hr]
429
- ), [wr, yr] = gr(ve), kt = a.forwardRef(
430
- (e, t) => /* @__PURE__ */ d(We.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d(We.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d(Cr, { ...e, ref: t }) }) })
431
- );
432
- kt.displayName = ve;
433
- var Cr = a.forwardRef((e, t) => {
434
- const {
435
- __scopeRovingFocusGroup: n,
436
- orientation: r,
437
- loop: o = !1,
438
- dir: c,
439
- currentTabStopId: u,
440
- defaultCurrentTabStopId: i,
441
- onCurrentTabStopIdChange: h,
442
- onEntryFocus: m,
443
- preventScrollOnEntryFocus: f = !1,
444
- ...s
445
- } = e, p = a.useRef(null), w = G(t, p), C = Ct(c), [l, v] = ht({
446
- prop: u,
447
- defaultProp: i ?? null,
448
- onChange: h,
449
- caller: ve
450
- }), [g, b] = a.useState(!1), y = oe(m), E = Ot(n), R = a.useRef(!1), [P, I] = a.useState(0);
451
- return a.useEffect(() => {
452
- const _ = p.current;
453
- if (_)
454
- return _.addEventListener(Fe, y), () => _.removeEventListener(Fe, y);
455
- }, [y]), /* @__PURE__ */ d(
456
- wr,
457
- {
458
- scope: n,
459
- orientation: r,
460
- dir: C,
461
- loop: o,
462
- currentTabStopId: l,
463
- onItemFocus: a.useCallback(
464
- (_) => v(_),
465
- [v]
466
- ),
467
- onItemShiftTab: a.useCallback(() => b(!0), []),
468
- onFocusableItemAdd: a.useCallback(
469
- () => I((_) => _ + 1),
470
- []
471
- ),
472
- onFocusableItemRemove: a.useCallback(
473
- () => I((_) => _ - 1),
474
- []
475
- ),
476
- children: /* @__PURE__ */ d(
477
- D.div,
478
- {
479
- tabIndex: g || P === 0 ? -1 : 0,
480
- "data-orientation": r,
481
- ...s,
482
- ref: w,
483
- style: { outline: "none", ...e.style },
484
- onMouseDown: S(e.onMouseDown, () => {
485
- R.current = !0;
486
- }),
487
- onFocus: S(e.onFocus, (_) => {
488
- const k = !R.current;
489
- if (_.target === _.currentTarget && k && !g) {
490
- const U = new CustomEvent(Fe, mr);
491
- if (_.currentTarget.dispatchEvent(U), !U.defaultPrevented) {
492
- const H = E().filter((L) => L.focusable), V = H.find((L) => L.active), B = H.find((L) => L.id === l), Q = [V, B, ...H].filter(
493
- Boolean
494
- ).map((L) => L.ref.current);
495
- Kt(Q, f);
496
- }
497
- }
498
- R.current = !1;
499
- }),
500
- onBlur: S(e.onBlur, () => b(!1))
501
- }
502
- )
503
- }
504
- );
505
- }), Lt = "RovingFocusGroupItem", Gt = a.forwardRef(
506
- (e, t) => {
507
- const {
508
- __scopeRovingFocusGroup: n,
509
- focusable: r = !0,
510
- active: o = !1,
511
- tabStopId: c,
512
- children: u,
513
- ...i
514
- } = e, h = Be(), m = c || h, f = yr(Lt, n), s = f.currentTabStopId === m, p = Ot(n), { onFocusableItemAdd: w, onFocusableItemRemove: C, currentTabStopId: l } = f;
515
- return a.useEffect(() => {
516
- if (r)
517
- return w(), () => C();
518
- }, [r, w, C]), /* @__PURE__ */ d(
519
- We.ItemSlot,
520
- {
521
- scope: n,
522
- id: m,
523
- focusable: r,
524
- active: o,
525
- children: /* @__PURE__ */ d(
526
- D.span,
527
- {
528
- tabIndex: s ? 0 : -1,
529
- "data-orientation": f.orientation,
530
- ...i,
531
- ref: t,
532
- onMouseDown: S(e.onMouseDown, (v) => {
533
- r ? f.onItemFocus(m) : v.preventDefault();
534
- }),
535
- onFocus: S(e.onFocus, () => f.onItemFocus(m)),
536
- onKeyDown: S(e.onKeyDown, (v) => {
537
- if (v.key === "Tab" && v.shiftKey) {
538
- f.onItemShiftTab();
539
- return;
540
- }
541
- if (v.target !== v.currentTarget)
542
- return;
543
- const g = Mr(v, f.orientation, f.dir);
544
- if (g !== void 0) {
545
- if (v.metaKey || v.ctrlKey || v.altKey || v.shiftKey)
546
- return;
547
- v.preventDefault();
548
- let y = p().filter((E) => E.focusable).map((E) => E.ref.current);
549
- if (g === "last")
550
- y.reverse();
551
- else if (g === "prev" || g === "next") {
552
- g === "prev" && y.reverse();
553
- const E = y.indexOf(v.currentTarget);
554
- y = f.loop ? Sr(y, E + 1) : y.slice(E + 1);
555
- }
556
- setTimeout(() => Kt(y));
557
- }
558
- }),
559
- children: typeof u == "function" ? u({ isCurrentTabStop: s, hasTabStop: l != null }) : u
560
- }
561
- )
562
- }
563
- );
564
- }
565
- );
566
- Gt.displayName = Lt;
567
- var br = {
568
- ArrowLeft: "prev",
569
- ArrowUp: "prev",
570
- ArrowRight: "next",
571
- ArrowDown: "next",
572
- PageUp: "first",
573
- Home: "first",
574
- PageDown: "last",
575
- End: "last"
576
- };
577
- function Er(e, t) {
578
- return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
579
- }
580
- function Mr(e, t, n) {
581
- const r = Er(e.key, n);
582
- if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r)))
583
- return br[r];
584
- }
585
- function Kt(e, t = !1) {
586
- const n = document.activeElement;
587
- for (const r of e)
588
- if (r === n || (r.focus({ preventScroll: t }), document.activeElement !== n))
589
- return;
590
- }
591
- function Sr(e, t) {
592
- return e.map((n, r) => e[(t + r) % e.length]);
593
- }
594
- var Rr = kt, Pr = Gt, _r = function(e) {
595
- if (typeof document > "u")
596
- return null;
597
- var t = Array.isArray(e) ? e[0] : e;
598
- return t.ownerDocument.body;
599
- }, ee = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), Ce = {}, ke = 0, $t = function(e) {
600
- return e && (e.host || $t(e.parentNode));
601
- }, Ir = function(e, t) {
602
- return t.map(function(n) {
603
- if (e.contains(n))
604
- return n;
605
- var r = $t(n);
606
- return r && e.contains(r) ? r : (console.error("aria-hidden", n, "in not contained inside", e, ". Doing nothing"), null);
607
- }).filter(function(n) {
608
- return !!n;
609
- });
610
- }, Ar = function(e, t, n, r) {
611
- var o = Ir(t, Array.isArray(e) ? e : [e]);
612
- Ce[n] || (Ce[n] = /* @__PURE__ */ new WeakMap());
613
- var c = Ce[n], u = [], i = /* @__PURE__ */ new Set(), h = new Set(o), m = function(s) {
614
- !s || i.has(s) || (i.add(s), m(s.parentNode));
615
- };
616
- o.forEach(m);
617
- var f = function(s) {
618
- !s || h.has(s) || Array.prototype.forEach.call(s.children, function(p) {
619
- if (i.has(p))
620
- f(p);
621
- else
622
- try {
623
- var w = p.getAttribute(r), C = w !== null && w !== "false", l = (ee.get(p) || 0) + 1, v = (c.get(p) || 0) + 1;
624
- ee.set(p, l), c.set(p, v), u.push(p), l === 1 && C && ye.set(p, !0), v === 1 && p.setAttribute(n, "true"), C || p.setAttribute(r, "true");
625
- } catch (g) {
626
- console.error("aria-hidden: cannot operate on ", p, g);
627
- }
628
- });
629
- };
630
- return f(t), i.clear(), ke++, function() {
631
- u.forEach(function(s) {
632
- var p = ee.get(s) - 1, w = c.get(s) - 1;
633
- ee.set(s, p), c.set(s, w), p || (ye.has(s) || s.removeAttribute(r), ye.delete(s)), w || s.removeAttribute(n);
634
- }), ke--, ke || (ee = /* @__PURE__ */ new WeakMap(), ee = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), Ce = {});
635
- };
636
- }, xr = function(e, t, n) {
637
- n === void 0 && (n = "data-aria-hidden");
638
- var r = Array.from(Array.isArray(e) ? e : [e]), o = t || _r(e);
639
- return o ? (r.push.apply(r, Array.from(o.querySelectorAll("[aria-live], script"))), Ar(r, o, n, "aria-hidden")) : function() {
640
- return null;
641
- };
642
- }, $ = function() {
643
- return $ = Object.assign || function(t) {
644
- for (var n, r = 1, o = arguments.length; r < o; r++) {
645
- n = arguments[r];
646
- for (var c in n)
647
- Object.prototype.hasOwnProperty.call(n, c) && (t[c] = n[c]);
648
- }
649
- return t;
650
- }, $.apply(this, arguments);
651
- };
652
- function Ut(e, t) {
653
- var n = {};
654
- for (var r in e)
655
- Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
656
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
657
- for (var o = 0, r = Object.getOwnPropertySymbols(e); o < r.length; o++)
658
- t.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (n[r[o]] = e[r[o]]);
659
- return n;
660
- }
661
- function Tr(e, t, n) {
662
- if (n || arguments.length === 2)
663
- for (var r = 0, o = t.length, c; r < o; r++)
664
- (c || !(r in t)) && (c || (c = Array.prototype.slice.call(t, 0, r)), c[r] = t[r]);
665
- return e.concat(c || Array.prototype.slice.call(t));
666
- }
667
- var Me = "right-scroll-bar-position", Se = "width-before-scroll-bar", Nr = "with-scroll-bars-hidden", Dr = "--removed-body-scroll-bar-size";
668
- function Le(e, t) {
669
- return typeof e == "function" ? e(t) : e && (e.current = t), e;
670
- }
671
- function Or(e, t) {
672
- var n = Dn(function() {
673
- return {
674
- // value
675
- value: e,
676
- // last callback
677
- callback: t,
678
- // "memoized" public interface
679
- facade: {
680
- get current() {
681
- return n.value;
682
- },
683
- set current(r) {
684
- var o = n.value;
685
- o !== r && (n.value = r, n.callback(r, o));
686
- }
687
- }
688
- };
689
- })[0];
690
- return n.callback = t, n.facade;
691
- }
692
- var Fr = typeof window < "u" ? a.useLayoutEffect : a.useEffect, st = /* @__PURE__ */ new WeakMap();
693
- function kr(e, t) {
694
- var n = Or(t || null, function(r) {
695
- return e.forEach(function(o) {
696
- return Le(o, r);
697
- });
698
- });
699
- return Fr(function() {
700
- var r = st.get(n);
701
- if (r) {
702
- var o = new Set(r), c = new Set(e), u = n.current;
703
- o.forEach(function(i) {
704
- c.has(i) || Le(i, null);
705
- }), c.forEach(function(i) {
706
- o.has(i) || Le(i, u);
707
- });
708
- }
709
- st.set(n, e);
710
- }, [e]), n;
711
- }
712
- function Lr(e) {
713
- return e;
714
- }
715
- function Gr(e, t) {
716
- t === void 0 && (t = Lr);
717
- var n = [], r = !1, o = {
718
- read: function() {
719
- if (r)
720
- throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
721
- return n.length ? n[n.length - 1] : e;
722
- },
723
- useMedium: function(c) {
724
- var u = t(c, r);
725
- return n.push(u), function() {
726
- n = n.filter(function(i) {
727
- return i !== u;
728
- });
729
- };
730
- },
731
- assignSyncMedium: function(c) {
732
- for (r = !0; n.length; ) {
733
- var u = n;
734
- n = [], u.forEach(c);
735
- }
736
- n = {
737
- push: function(i) {
738
- return c(i);
739
- },
740
- filter: function() {
741
- return n;
742
- }
743
- };
744
- },
745
- assignMedium: function(c) {
746
- r = !0;
747
- var u = [];
748
- if (n.length) {
749
- var i = n;
750
- n = [], i.forEach(c), u = n;
751
- }
752
- var h = function() {
753
- var f = u;
754
- u = [], f.forEach(c);
755
- }, m = function() {
756
- return Promise.resolve().then(h);
757
- };
758
- m(), n = {
759
- push: function(f) {
760
- u.push(f), m();
761
- },
762
- filter: function(f) {
763
- return u = u.filter(f), n;
764
- }
765
- };
766
- }
767
- };
768
- return o;
769
- }
770
- function Kr(e) {
771
- e === void 0 && (e = {});
772
- var t = Gr(null);
773
- return t.options = $({ async: !0, ssr: !1 }, e), t;
774
- }
775
- var Bt = function(e) {
776
- var t = e.sideCar, n = Ut(e, ["sideCar"]);
777
- if (!t)
778
- throw new Error("Sidecar: please provide `sideCar` property to import the right car");
779
- var r = t.read();
780
- if (!r)
781
- throw new Error("Sidecar medium not found");
782
- return a.createElement(r, $({}, n));
783
- };
784
- Bt.isSideCarExport = !0;
785
- function $r(e, t) {
786
- return e.useMedium(t), Bt;
787
- }
788
- var Wt = Kr(), Ge = function() {
789
- }, Ie = a.forwardRef(function(e, t) {
790
- var n = a.useRef(null), r = a.useState({
791
- onScrollCapture: Ge,
792
- onWheelCapture: Ge,
793
- onTouchMoveCapture: Ge
794
- }), o = r[0], c = r[1], u = e.forwardProps, i = e.children, h = e.className, m = e.removeScrollBar, f = e.enabled, s = e.shards, p = e.sideCar, w = e.noRelative, C = e.noIsolation, l = e.inert, v = e.allowPinchZoom, g = e.as, b = g === void 0 ? "div" : g, y = e.gapMode, E = Ut(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), R = p, P = kr([n, t]), I = $($({}, E), o);
795
- return a.createElement(
796
- a.Fragment,
797
- null,
798
- f && a.createElement(R, { sideCar: Wt, removeScrollBar: m, shards: s, noRelative: w, noIsolation: C, inert: l, setCallbacks: c, allowPinchZoom: !!v, lockRef: n, gapMode: y }),
799
- u ? a.cloneElement(a.Children.only(i), $($({}, I), { ref: P })) : a.createElement(b, $({}, I, { className: h, ref: P }), i)
800
- );
801
- });
802
- Ie.defaultProps = {
803
- enabled: !0,
804
- removeScrollBar: !0,
805
- inert: !1
806
- };
807
- Ie.classNames = {
808
- fullWidth: Se,
809
- zeroRight: Me
810
- };
811
- var lt, Ur = function() {
812
- if (lt)
813
- return lt;
814
- if (typeof __webpack_nonce__ < "u")
815
- return __webpack_nonce__;
816
- };
817
- function Br() {
818
- if (!document)
819
- return null;
820
- var e = document.createElement("style");
821
- e.type = "text/css";
822
- var t = Ur();
823
- return t && e.setAttribute("nonce", t), e;
824
- }
825
- function Wr(e, t) {
826
- e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
827
- }
828
- function Hr(e) {
829
- var t = document.head || document.getElementsByTagName("head")[0];
830
- t.appendChild(e);
831
- }
832
- var Yr = function() {
833
- var e = 0, t = null;
834
- return {
835
- add: function(n) {
836
- e == 0 && (t = Br()) && (Wr(t, n), Hr(t)), e++;
837
- },
838
- remove: function() {
839
- e--, !e && t && (t.parentNode && t.parentNode.removeChild(t), t = null);
840
- }
841
- };
842
- }, Vr = function() {
843
- var e = Yr();
844
- return function(t, n) {
845
- a.useEffect(function() {
846
- return e.add(t), function() {
847
- e.remove();
848
- };
849
- }, [t && n]);
850
- };
851
- }, Ht = function() {
852
- var e = Vr(), t = function(n) {
853
- var r = n.styles, o = n.dynamic;
854
- return e(r, o), null;
855
- };
856
- return t;
857
- }, Xr = {
858
- left: 0,
859
- top: 0,
860
- right: 0,
861
- gap: 0
862
- }, Ke = function(e) {
863
- return parseInt(e || "", 10) || 0;
864
- }, jr = function(e) {
865
- var t = window.getComputedStyle(document.body), n = t[e === "padding" ? "paddingLeft" : "marginLeft"], r = t[e === "padding" ? "paddingTop" : "marginTop"], o = t[e === "padding" ? "paddingRight" : "marginRight"];
866
- return [Ke(n), Ke(r), Ke(o)];
867
- }, zr = function(e) {
868
- if (e === void 0 && (e = "margin"), typeof window > "u")
869
- return Xr;
870
- var t = jr(e), n = document.documentElement.clientWidth, r = window.innerWidth;
871
- return {
872
- left: t[0],
873
- top: t[1],
874
- right: t[2],
875
- gap: Math.max(0, r - n + t[2] - t[0])
876
- };
877
- }, Zr = Ht(), re = "data-scroll-locked", qr = function(e, t, n, r) {
878
- var o = e.left, c = e.top, u = e.right, i = e.gap;
879
- return n === void 0 && (n = "margin"), `
880
- .`.concat(Nr, ` {
881
- overflow: hidden `).concat(r, `;
882
- padding-right: `).concat(i, "px ").concat(r, `;
883
- }
884
- body[`).concat(re, `] {
885
- overflow: hidden `).concat(r, `;
886
- overscroll-behavior: contain;
887
- `).concat([
888
- t && "position: relative ".concat(r, ";"),
889
- n === "margin" && `
890
- padding-left: `.concat(o, `px;
891
- padding-top: `).concat(c, `px;
892
- padding-right: `).concat(u, `px;
893
- margin-left:0;
894
- margin-top:0;
895
- margin-right: `).concat(i, "px ").concat(r, `;
896
- `),
897
- n === "padding" && "padding-right: ".concat(i, "px ").concat(r, ";")
898
- ].filter(Boolean).join(""), `
899
- }
900
-
901
- .`).concat(Me, ` {
902
- right: `).concat(i, "px ").concat(r, `;
903
- }
904
-
905
- .`).concat(Se, ` {
906
- margin-right: `).concat(i, "px ").concat(r, `;
907
- }
908
-
909
- .`).concat(Me, " .").concat(Me, ` {
910
- right: 0 `).concat(r, `;
911
- }
912
-
913
- .`).concat(Se, " .").concat(Se, ` {
914
- margin-right: 0 `).concat(r, `;
915
- }
916
-
917
- body[`).concat(re, `] {
918
- `).concat(Dr, ": ").concat(i, `px;
919
- }
920
- `);
921
- }, dt = function() {
922
- var e = parseInt(document.body.getAttribute(re) || "0", 10);
923
- return isFinite(e) ? e : 0;
924
- }, Qr = function() {
925
- a.useEffect(function() {
926
- return document.body.setAttribute(re, (dt() + 1).toString()), function() {
927
- var e = dt() - 1;
928
- e <= 0 ? document.body.removeAttribute(re) : document.body.setAttribute(re, e.toString());
929
- };
930
- }, []);
931
- }, Jr = function(e) {
932
- var t = e.noRelative, n = e.noImportant, r = e.gapMode, o = r === void 0 ? "margin" : r;
933
- Qr();
934
- var c = a.useMemo(function() {
935
- return zr(o);
936
- }, [o]);
937
- return a.createElement(Zr, { styles: qr(c, !t, o, n ? "" : "!important") });
938
- }, He = !1;
939
- if (typeof window < "u")
940
- try {
941
- var be = Object.defineProperty({}, "passive", {
942
- get: function() {
943
- return He = !0, !0;
944
- }
945
- });
946
- window.addEventListener("test", be, be), window.removeEventListener("test", be, be);
947
- } catch {
948
- He = !1;
949
- }
950
- var te = He ? { passive: !1 } : !1, eo = function(e) {
951
- return e.tagName === "TEXTAREA";
952
- }, Yt = function(e, t) {
953
- if (!(e instanceof Element))
954
- return !1;
955
- var n = window.getComputedStyle(e);
956
- return (
957
- // not-not-scrollable
958
- n[t] !== "hidden" && // contains scroll inside self
959
- !(n.overflowY === n.overflowX && !eo(e) && n[t] === "visible")
960
- );
961
- }, to = function(e) {
962
- return Yt(e, "overflowY");
963
- }, no = function(e) {
964
- return Yt(e, "overflowX");
965
- }, ft = function(e, t) {
966
- var n = t.ownerDocument, r = t;
967
- do {
968
- typeof ShadowRoot < "u" && r instanceof ShadowRoot && (r = r.host);
969
- var o = Vt(e, r);
970
- if (o) {
971
- var c = Xt(e, r), u = c[1], i = c[2];
972
- if (u > i)
973
- return !0;
974
- }
975
- r = r.parentNode;
976
- } while (r && r !== n.body);
977
- return !1;
978
- }, ro = function(e) {
979
- var t = e.scrollTop, n = e.scrollHeight, r = e.clientHeight;
980
- return [
981
- t,
982
- n,
983
- r
984
- ];
985
- }, oo = function(e) {
986
- var t = e.scrollLeft, n = e.scrollWidth, r = e.clientWidth;
987
- return [
988
- t,
989
- n,
990
- r
991
- ];
992
- }, Vt = function(e, t) {
993
- return e === "v" ? to(t) : no(t);
994
- }, Xt = function(e, t) {
995
- return e === "v" ? ro(t) : oo(t);
996
- }, ao = function(e, t) {
997
- return e === "h" && t === "rtl" ? -1 : 1;
998
- }, co = function(e, t, n, r, o) {
999
- var c = ao(e, window.getComputedStyle(t).direction), u = c * r, i = n.target, h = t.contains(i), m = !1, f = u > 0, s = 0, p = 0;
1000
- do {
1001
- if (!i)
1002
- break;
1003
- var w = Xt(e, i), C = w[0], l = w[1], v = w[2], g = l - v - c * C;
1004
- (C || g) && Vt(e, i) && (s += g, p += C);
1005
- var b = i.parentNode;
1006
- i = b && b.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? b.host : b;
1007
- } while (
1008
- // portaled content
1009
- !h && i !== document.body || // self content
1010
- h && (t.contains(i) || t === i)
1011
- );
1012
- return (f && (o && Math.abs(s) < 1 || !o && u > s) || !f && (o && Math.abs(p) < 1 || !o && -u > p)) && (m = !0), m;
1013
- }, Ee = function(e) {
1014
- return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
1015
- }, pt = function(e) {
1016
- return [e.deltaX, e.deltaY];
1017
- }, vt = function(e) {
1018
- return e && "current" in e ? e.current : e;
1019
- }, io = function(e, t) {
1020
- return e[0] === t[0] && e[1] === t[1];
1021
- }, uo = function(e) {
1022
- return `
1023
- .block-interactivity-`.concat(e, ` {pointer-events: none;}
1024
- .allow-interactivity-`).concat(e, ` {pointer-events: all;}
1025
- `);
1026
- }, so = 0, ne = [];
1027
- function lo(e) {
1028
- var t = a.useRef([]), n = a.useRef([0, 0]), r = a.useRef(), o = a.useState(so++)[0], c = a.useState(Ht)[0], u = a.useRef(e);
1029
- a.useEffect(function() {
1030
- u.current = e;
1031
- }, [e]), a.useEffect(function() {
1032
- if (e.inert) {
1033
- document.body.classList.add("block-interactivity-".concat(o));
1034
- var l = Tr([e.lockRef.current], (e.shards || []).map(vt), !0).filter(Boolean);
1035
- return l.forEach(function(v) {
1036
- return v.classList.add("allow-interactivity-".concat(o));
1037
- }), function() {
1038
- document.body.classList.remove("block-interactivity-".concat(o)), l.forEach(function(v) {
1039
- return v.classList.remove("allow-interactivity-".concat(o));
1040
- });
1041
- };
1042
- }
1043
- }, [e.inert, e.lockRef.current, e.shards]);
1044
- var i = a.useCallback(function(l, v) {
1045
- if ("touches" in l && l.touches.length === 2 || l.type === "wheel" && l.ctrlKey)
1046
- return !u.current.allowPinchZoom;
1047
- var g = Ee(l), b = n.current, y = "deltaX" in l ? l.deltaX : b[0] - g[0], E = "deltaY" in l ? l.deltaY : b[1] - g[1], R, P = l.target, I = Math.abs(y) > Math.abs(E) ? "h" : "v";
1048
- if ("touches" in l && I === "h" && P.type === "range")
1049
- return !1;
1050
- var _ = ft(I, P);
1051
- if (!_)
1052
- return !0;
1053
- if (_ ? R = I : (R = I === "v" ? "h" : "v", _ = ft(I, P)), !_)
1054
- return !1;
1055
- if (!r.current && "changedTouches" in l && (y || E) && (r.current = R), !R)
1056
- return !0;
1057
- var k = r.current || R;
1058
- return co(k, v, l, k === "h" ? y : E, !0);
1059
- }, []), h = a.useCallback(function(l) {
1060
- var v = l;
1061
- if (!(!ne.length || ne[ne.length - 1] !== c)) {
1062
- var g = "deltaY" in v ? pt(v) : Ee(v), b = t.current.filter(function(R) {
1063
- return R.name === v.type && (R.target === v.target || v.target === R.shadowParent) && io(R.delta, g);
1064
- })[0];
1065
- if (b && b.should) {
1066
- v.cancelable && v.preventDefault();
1067
- return;
1068
- }
1069
- if (!b) {
1070
- var y = (u.current.shards || []).map(vt).filter(Boolean).filter(function(R) {
1071
- return R.contains(v.target);
1072
- }), E = y.length > 0 ? i(v, y[0]) : !u.current.noIsolation;
1073
- E && v.cancelable && v.preventDefault();
1074
- }
1075
- }
1076
- }, []), m = a.useCallback(function(l, v, g, b) {
1077
- var y = { name: l, delta: v, target: g, should: b, shadowParent: fo(g) };
1078
- t.current.push(y), setTimeout(function() {
1079
- t.current = t.current.filter(function(E) {
1080
- return E !== y;
1081
- });
1082
- }, 1);
1083
- }, []), f = a.useCallback(function(l) {
1084
- n.current = Ee(l), r.current = void 0;
1085
- }, []), s = a.useCallback(function(l) {
1086
- m(l.type, pt(l), l.target, i(l, e.lockRef.current));
1087
- }, []), p = a.useCallback(function(l) {
1088
- m(l.type, Ee(l), l.target, i(l, e.lockRef.current));
1089
- }, []);
1090
- a.useEffect(function() {
1091
- return ne.push(c), e.setCallbacks({
1092
- onScrollCapture: s,
1093
- onWheelCapture: s,
1094
- onTouchMoveCapture: p
1095
- }), document.addEventListener("wheel", h, te), document.addEventListener("touchmove", h, te), document.addEventListener("touchstart", f, te), function() {
1096
- ne = ne.filter(function(l) {
1097
- return l !== c;
1098
- }), document.removeEventListener("wheel", h, te), document.removeEventListener("touchmove", h, te), document.removeEventListener("touchstart", f, te);
1099
- };
1100
- }, []);
1101
- var w = e.removeScrollBar, C = e.inert;
1102
- return a.createElement(
1103
- a.Fragment,
1104
- null,
1105
- C ? a.createElement(c, { styles: uo(o) }) : null,
1106
- w ? a.createElement(Jr, { noRelative: e.noRelative, gapMode: e.gapMode }) : null
1107
- );
1108
- }
1109
- function fo(e) {
1110
- for (var t = null; e !== null; )
1111
- e instanceof ShadowRoot && (t = e.host, e = e.host), e = e.parentNode;
1112
- return t;
1113
- }
1114
- const po = $r(Wt, lo);
1115
- var jt = a.forwardRef(function(e, t) {
1116
- return a.createElement(Ie, $({}, e, { ref: t, sideCar: po }));
1117
- });
1118
- jt.classNames = Ie.classNames;
1119
- const vo = jt;
1120
- var Ye = ["Enter", " "], mo = ["ArrowDown", "PageUp", "Home"], zt = ["ArrowUp", "PageDown", "End"], ho = [...mo, ...zt], go = {
1121
- ltr: [...Ye, "ArrowRight"],
1122
- rtl: [...Ye, "ArrowLeft"]
1123
- }, wo = {
1124
- ltr: ["ArrowLeft"],
1125
- rtl: ["ArrowRight"]
1126
- }, me = "Menu", [de, yo, Co] = yt(me), [z, Zt] = pe(me, [
1127
- Co,
1128
- Rt,
1129
- Ft
1130
- ]), Ae = Rt(), qt = Ft(), [bo, Z] = z(me), [Eo, he] = z(me), Qt = (e) => {
1131
- const { __scopeMenu: t, open: n = !1, children: r, dir: o, onOpenChange: c, modal: u = !0 } = e, i = Ae(t), [h, m] = a.useState(null), f = a.useRef(!1), s = oe(c), p = Ct(o);
1132
- return a.useEffect(() => {
1133
- const w = () => {
1134
- f.current = !0, document.addEventListener("pointerdown", C, { capture: !0, once: !0 }), document.addEventListener("pointermove", C, { capture: !0, once: !0 });
1135
- }, C = () => f.current = !1;
1136
- return document.addEventListener("keydown", w, { capture: !0 }), () => {
1137
- document.removeEventListener("keydown", w, { capture: !0 }), document.removeEventListener("pointerdown", C, { capture: !0 }), document.removeEventListener("pointermove", C, { capture: !0 });
1138
- };
1139
- }, []), /* @__PURE__ */ d(dr, { ...i, children: /* @__PURE__ */ d(
1140
- bo,
1141
- {
1142
- scope: t,
1143
- open: n,
1144
- onOpenChange: s,
1145
- content: h,
1146
- onContentChange: m,
1147
- children: /* @__PURE__ */ d(
1148
- Eo,
1149
- {
1150
- scope: t,
1151
- onClose: a.useCallback(() => s(!1), [s]),
1152
- isUsingKeyboardRef: f,
1153
- dir: p,
1154
- modal: u,
1155
- children: r
1156
- }
1157
- )
1158
- }
1159
- ) });
1160
- };
1161
- Qt.displayName = me;
1162
- var Mo = "MenuAnchor", je = a.forwardRef(
1163
- (e, t) => {
1164
- const { __scopeMenu: n, ...r } = e, o = Ae(n);
1165
- return /* @__PURE__ */ d(fr, { ...o, ...r, ref: t });
1166
- }
1167
- );
1168
- je.displayName = Mo;
1169
- var ze = "MenuPortal", [So, Jt] = z(ze, {
1170
- forceMount: void 0
1171
- }), en = (e) => {
1172
- const { __scopeMenu: t, forceMount: n, children: r, container: o } = e, c = Z(ze, t);
1173
- return /* @__PURE__ */ d(So, { scope: t, forceMount: n, children: /* @__PURE__ */ d(_e, { present: n || c.open, children: /* @__PURE__ */ d(wt, { asChild: !0, container: o, children: r }) }) });
1174
- };
1175
- en.displayName = ze;
1176
- var F = "MenuContent", [Ro, Ze] = z(F), tn = a.forwardRef(
1177
- (e, t) => {
1178
- const n = Jt(F, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, c = Z(F, e.__scopeMenu), u = he(F, e.__scopeMenu);
1179
- return /* @__PURE__ */ d(de.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ d(_e, { present: r || c.open, children: /* @__PURE__ */ d(de.Slot, { scope: e.__scopeMenu, children: u.modal ? /* @__PURE__ */ d(Po, { ...o, ref: t }) : /* @__PURE__ */ d(_o, { ...o, ref: t }) }) }) });
1180
- }
1181
- ), Po = a.forwardRef(
1182
- (e, t) => {
1183
- const n = Z(F, e.__scopeMenu), r = a.useRef(null), o = G(t, r);
1184
- return a.useEffect(() => {
1185
- const c = r.current;
1186
- if (c)
1187
- return xr(c);
1188
- }, []), /* @__PURE__ */ d(
1189
- qe,
1190
- {
1191
- ...e,
1192
- ref: o,
1193
- trapFocus: n.open,
1194
- disableOutsidePointerEvents: n.open,
1195
- disableOutsideScroll: !0,
1196
- onFocusOutside: S(
1197
- e.onFocusOutside,
1198
- (c) => c.preventDefault(),
1199
- { checkForDefaultPrevented: !1 }
1200
- ),
1201
- onDismiss: () => n.onOpenChange(!1)
1202
- }
1203
- );
1204
- }
1205
- ), _o = a.forwardRef((e, t) => {
1206
- const n = Z(F, e.__scopeMenu);
1207
- return /* @__PURE__ */ d(
1208
- qe,
1209
- {
1210
- ...e,
1211
- ref: t,
1212
- trapFocus: !1,
1213
- disableOutsidePointerEvents: !1,
1214
- disableOutsideScroll: !1,
1215
- onDismiss: () => n.onOpenChange(!1)
1216
- }
1217
- );
1218
- }), Io = Ue("MenuContent.ScrollLock"), qe = a.forwardRef(
1219
- (e, t) => {
1220
- const {
1221
- __scopeMenu: n,
1222
- loop: r = !1,
1223
- trapFocus: o,
1224
- onOpenAutoFocus: c,
1225
- onCloseAutoFocus: u,
1226
- disableOutsidePointerEvents: i,
1227
- onEntryFocus: h,
1228
- onEscapeKeyDown: m,
1229
- onPointerDownOutside: f,
1230
- onFocusOutside: s,
1231
- onInteractOutside: p,
1232
- onDismiss: w,
1233
- disableOutsideScroll: C,
1234
- ...l
1235
- } = e, v = Z(F, n), g = he(F, n), b = Ae(n), y = qt(n), E = yo(n), [R, P] = a.useState(null), I = a.useRef(null), _ = G(t, I, v.onContentChange), k = a.useRef(0), U = a.useRef(""), H = a.useRef(0), V = a.useRef(null), B = a.useRef("right"), q = a.useRef(0), Q = C ? vo : a.Fragment, L = C ? { as: Io, allowPinchZoom: !0 } : void 0, J = (M) => {
1236
- var W, ie;
1237
- const T = U.current + M, A = E().filter((O) => !O.disabled), K = document.activeElement, ae = (W = A.find((O) => O.ref.current === K)) == null ? void 0 : W.textValue, ce = A.map((O) => O.textValue), ge = $o(ce, T, ae), X = (ie = A.find((O) => O.textValue === ge)) == null ? void 0 : ie.ref.current;
1238
- (function O(ue) {
1239
- U.current = ue, window.clearTimeout(k.current), ue !== "" && (k.current = window.setTimeout(() => O(""), 1e3));
1240
- })(T), X && setTimeout(() => X.focus());
1241
- };
1242
- a.useEffect(() => () => window.clearTimeout(k.current), []), zn();
1243
- const N = a.useCallback((M) => {
1244
- var A, K;
1245
- return B.current === ((A = V.current) == null ? void 0 : A.side) && Bo(M, (K = V.current) == null ? void 0 : K.area);
1246
- }, []);
1247
- return /* @__PURE__ */ d(
1248
- Ro,
1249
- {
1250
- scope: n,
1251
- searchRef: U,
1252
- onItemEnter: a.useCallback(
1253
- (M) => {
1254
- N(M) && M.preventDefault();
1255
- },
1256
- [N]
1257
- ),
1258
- onItemLeave: a.useCallback(
1259
- (M) => {
1260
- var T;
1261
- N(M) || ((T = I.current) == null || T.focus(), P(null));
1262
- },
1263
- [N]
1264
- ),
1265
- onTriggerLeave: a.useCallback(
1266
- (M) => {
1267
- N(M) && M.preventDefault();
1268
- },
1269
- [N]
1270
- ),
1271
- pointerGraceTimerRef: H,
1272
- onPointerGraceIntentChange: a.useCallback((M) => {
1273
- V.current = M;
1274
- }, []),
1275
- children: /* @__PURE__ */ d(Q, { ...L, children: /* @__PURE__ */ d(
1276
- bt,
1277
- {
1278
- asChild: !0,
1279
- trapped: o,
1280
- onMountAutoFocus: S(c, (M) => {
1281
- var T;
1282
- M.preventDefault(), (T = I.current) == null || T.focus({ preventScroll: !0 });
1283
- }),
1284
- onUnmountAutoFocus: u,
1285
- children: /* @__PURE__ */ d(
1286
- Yn,
1287
- {
1288
- asChild: !0,
1289
- disableOutsidePointerEvents: i,
1290
- onEscapeKeyDown: m,
1291
- onPointerDownOutside: f,
1292
- onFocusOutside: s,
1293
- onInteractOutside: p,
1294
- onDismiss: w,
1295
- children: /* @__PURE__ */ d(
1296
- Rr,
1297
- {
1298
- asChild: !0,
1299
- ...y,
1300
- dir: g.dir,
1301
- orientation: "vertical",
1302
- loop: r,
1303
- currentTabStopId: R,
1304
- onCurrentTabStopIdChange: P,
1305
- onEntryFocus: S(h, (M) => {
1306
- g.isUsingKeyboardRef.current || M.preventDefault();
1307
- }),
1308
- preventScrollOnEntryFocus: !0,
1309
- children: /* @__PURE__ */ d(
1310
- pr,
1311
- {
1312
- role: "menu",
1313
- "aria-orientation": "vertical",
1314
- "data-state": wn(v.open),
1315
- "data-radix-menu-content": "",
1316
- dir: g.dir,
1317
- ...b,
1318
- ...l,
1319
- ref: _,
1320
- style: { outline: "none", ...l.style },
1321
- onKeyDown: S(l.onKeyDown, (M) => {
1322
- const A = M.target.closest("[data-radix-menu-content]") === M.currentTarget, K = M.ctrlKey || M.altKey || M.metaKey, ae = M.key.length === 1;
1323
- A && (M.key === "Tab" && M.preventDefault(), !K && ae && J(M.key));
1324
- const ce = I.current;
1325
- if (M.target !== ce || !ho.includes(M.key))
1326
- return;
1327
- M.preventDefault();
1328
- const X = E().filter((W) => !W.disabled).map((W) => W.ref.current);
1329
- zt.includes(M.key) && X.reverse(), Go(X);
1330
- }),
1331
- onBlur: S(e.onBlur, (M) => {
1332
- M.currentTarget.contains(M.target) || (window.clearTimeout(k.current), U.current = "");
1333
- }),
1334
- onPointerMove: S(
1335
- e.onPointerMove,
1336
- fe((M) => {
1337
- const T = M.target, A = q.current !== M.clientX;
1338
- if (M.currentTarget.contains(T) && A) {
1339
- const K = M.clientX > q.current ? "right" : "left";
1340
- B.current = K, q.current = M.clientX;
1341
- }
1342
- })
1343
- )
1344
- }
1345
- )
1346
- }
1347
- )
1348
- }
1349
- )
1350
- }
1351
- ) })
1352
- }
1353
- );
1354
- }
1355
- );
1356
- tn.displayName = F;
1357
- var Ao = "MenuGroup", Qe = a.forwardRef(
1358
- (e, t) => {
1359
- const { __scopeMenu: n, ...r } = e;
1360
- return /* @__PURE__ */ d(D.div, { role: "group", ...r, ref: t });
1361
- }
1362
- );
1363
- Qe.displayName = Ao;
1364
- var xo = "MenuLabel", nn = a.forwardRef(
1365
- (e, t) => {
1366
- const { __scopeMenu: n, ...r } = e;
1367
- return /* @__PURE__ */ d(D.div, { ...r, ref: t });
1368
- }
1369
- );
1370
- nn.displayName = xo;
1371
- var Re = "MenuItem", mt = "menu.itemSelect", xe = a.forwardRef(
1372
- (e, t) => {
1373
- const { disabled: n = !1, onSelect: r, ...o } = e, c = a.useRef(null), u = he(Re, e.__scopeMenu), i = Ze(Re, e.__scopeMenu), h = G(t, c), m = a.useRef(!1), f = () => {
1374
- const s = c.current;
1375
- if (!n && s) {
1376
- const p = new CustomEvent(mt, { bubbles: !0, cancelable: !0 });
1377
- s.addEventListener(mt, (w) => r == null ? void 0 : r(w), { once: !0 }), Fn(s, p), p.defaultPrevented ? m.current = !1 : u.onClose();
1378
- }
1379
- };
1380
- return /* @__PURE__ */ d(
1381
- rn,
1382
- {
1383
- ...o,
1384
- ref: h,
1385
- disabled: n,
1386
- onClick: S(e.onClick, f),
1387
- onPointerDown: (s) => {
1388
- var p;
1389
- (p = e.onPointerDown) == null || p.call(e, s), m.current = !0;
1390
- },
1391
- onPointerUp: S(e.onPointerUp, (s) => {
1392
- var p;
1393
- m.current || (p = s.currentTarget) == null || p.click();
1394
- }),
1395
- onKeyDown: S(e.onKeyDown, (s) => {
1396
- const p = i.searchRef.current !== "";
1397
- n || p && s.key === " " || Ye.includes(s.key) && (s.currentTarget.click(), s.preventDefault());
1398
- })
1399
- }
1400
- );
1401
- }
1402
- );
1403
- xe.displayName = Re;
1404
- var rn = a.forwardRef(
1405
- (e, t) => {
1406
- const { __scopeMenu: n, disabled: r = !1, textValue: o, ...c } = e, u = Ze(Re, n), i = qt(n), h = a.useRef(null), m = G(t, h), [f, s] = a.useState(!1), [p, w] = a.useState("");
1407
- return a.useEffect(() => {
1408
- const C = h.current;
1409
- C && w((C.textContent ?? "").trim());
1410
- }, [c.children]), /* @__PURE__ */ d(
1411
- de.ItemSlot,
1412
- {
1413
- scope: n,
1414
- disabled: r,
1415
- textValue: o ?? p,
1416
- children: /* @__PURE__ */ d(Pr, { asChild: !0, ...i, focusable: !r, children: /* @__PURE__ */ d(
1417
- D.div,
1418
- {
1419
- role: "menuitem",
1420
- "data-highlighted": f ? "" : void 0,
1421
- "aria-disabled": r || void 0,
1422
- "data-disabled": r ? "" : void 0,
1423
- ...c,
1424
- ref: m,
1425
- onPointerMove: S(
1426
- e.onPointerMove,
1427
- fe((C) => {
1428
- r ? u.onItemLeave(C) : (u.onItemEnter(C), C.defaultPrevented || C.currentTarget.focus({ preventScroll: !0 }));
1429
- })
1430
- ),
1431
- onPointerLeave: S(
1432
- e.onPointerLeave,
1433
- fe((C) => u.onItemLeave(C))
1434
- ),
1435
- onFocus: S(e.onFocus, () => s(!0)),
1436
- onBlur: S(e.onBlur, () => s(!1))
1437
- }
1438
- ) })
1439
- }
1440
- );
1441
- }
1442
- ), To = "MenuCheckboxItem", on = a.forwardRef(
1443
- (e, t) => {
1444
- const { checked: n = !1, onCheckedChange: r, ...o } = e;
1445
- return /* @__PURE__ */ d(ln, { scope: e.__scopeMenu, checked: n, children: /* @__PURE__ */ d(
1446
- xe,
1447
- {
1448
- role: "menuitemcheckbox",
1449
- "aria-checked": Pe(n) ? "mixed" : n,
1450
- ...o,
1451
- ref: t,
1452
- "data-state": et(n),
1453
- onSelect: S(
1454
- o.onSelect,
1455
- () => r == null ? void 0 : r(Pe(n) ? !0 : !n),
1456
- { checkForDefaultPrevented: !1 }
1457
- )
1458
- }
1459
- ) });
1460
- }
1461
- );
1462
- on.displayName = To;
1463
- var an = "MenuRadioGroup", [No, Do] = z(
1464
- an,
1465
- { value: void 0, onValueChange: () => {
1466
- } }
1467
- ), cn = a.forwardRef(
1468
- (e, t) => {
1469
- const { value: n, onValueChange: r, ...o } = e, c = oe(r);
1470
- return /* @__PURE__ */ d(No, { scope: e.__scopeMenu, value: n, onValueChange: c, children: /* @__PURE__ */ d(Qe, { ...o, ref: t }) });
1471
- }
1472
- );
1473
- cn.displayName = an;
1474
- var un = "MenuRadioItem", sn = a.forwardRef(
1475
- (e, t) => {
1476
- const { value: n, ...r } = e, o = Do(un, e.__scopeMenu), c = n === o.value;
1477
- return /* @__PURE__ */ d(ln, { scope: e.__scopeMenu, checked: c, children: /* @__PURE__ */ d(
1478
- xe,
1479
- {
1480
- role: "menuitemradio",
1481
- "aria-checked": c,
1482
- ...r,
1483
- ref: t,
1484
- "data-state": et(c),
1485
- onSelect: S(
1486
- r.onSelect,
1487
- () => {
1488
- var u;
1489
- return (u = o.onValueChange) == null ? void 0 : u.call(o, n);
1490
- },
1491
- { checkForDefaultPrevented: !1 }
1492
- )
1493
- }
1494
- ) });
1495
- }
1496
- );
1497
- sn.displayName = un;
1498
- var Je = "MenuItemIndicator", [ln, Oo] = z(
1499
- Je,
1500
- { checked: !1 }
1501
- ), dn = a.forwardRef(
1502
- (e, t) => {
1503
- const { __scopeMenu: n, forceMount: r, ...o } = e, c = Oo(Je, n);
1504
- return /* @__PURE__ */ d(
1505
- _e,
1506
- {
1507
- present: r || Pe(c.checked) || c.checked === !0,
1508
- children: /* @__PURE__ */ d(
1509
- D.span,
1510
- {
1511
- ...o,
1512
- ref: t,
1513
- "data-state": et(c.checked)
1514
- }
1515
- )
1516
- }
1517
- );
1518
- }
1519
- );
1520
- dn.displayName = Je;
1521
- var Fo = "MenuSeparator", fn = a.forwardRef(
1522
- (e, t) => {
1523
- const { __scopeMenu: n, ...r } = e;
1524
- return /* @__PURE__ */ d(
1525
- D.div,
1526
- {
1527
- role: "separator",
1528
- "aria-orientation": "horizontal",
1529
- ...r,
1530
- ref: t
1531
- }
1532
- );
1533
- }
1534
- );
1535
- fn.displayName = Fo;
1536
- var ko = "MenuArrow", pn = a.forwardRef(
1537
- (e, t) => {
1538
- const { __scopeMenu: n, ...r } = e, o = Ae(n);
1539
- return /* @__PURE__ */ d(vr, { ...o, ...r, ref: t });
1540
- }
1541
- );
1542
- pn.displayName = ko;
1543
- var Lo = "MenuSub", [Ta, vn] = z(Lo), le = "MenuSubTrigger", mn = a.forwardRef(
1544
- (e, t) => {
1545
- const n = Z(le, e.__scopeMenu), r = he(le, e.__scopeMenu), o = vn(le, e.__scopeMenu), c = Ze(le, e.__scopeMenu), u = a.useRef(null), { pointerGraceTimerRef: i, onPointerGraceIntentChange: h } = c, m = { __scopeMenu: e.__scopeMenu }, f = a.useCallback(() => {
1546
- u.current && window.clearTimeout(u.current), u.current = null;
1547
- }, []);
1548
- return a.useEffect(() => f, [f]), a.useEffect(() => {
1549
- const s = i.current;
1550
- return () => {
1551
- window.clearTimeout(s), h(null);
1552
- };
1553
- }, [i, h]), /* @__PURE__ */ d(je, { asChild: !0, ...m, children: /* @__PURE__ */ d(
1554
- rn,
1555
- {
1556
- id: o.triggerId,
1557
- "aria-haspopup": "menu",
1558
- "aria-expanded": n.open,
1559
- "aria-controls": o.contentId,
1560
- "data-state": wn(n.open),
1561
- ...e,
1562
- ref: gt(t, o.onTriggerChange),
1563
- onClick: (s) => {
1564
- var p;
1565
- (p = e.onClick) == null || p.call(e, s), !(e.disabled || s.defaultPrevented) && (s.currentTarget.focus(), n.open || n.onOpenChange(!0));
1566
- },
1567
- onPointerMove: S(
1568
- e.onPointerMove,
1569
- fe((s) => {
1570
- c.onItemEnter(s), !s.defaultPrevented && !e.disabled && !n.open && !u.current && (c.onPointerGraceIntentChange(null), u.current = window.setTimeout(() => {
1571
- n.onOpenChange(!0), f();
1572
- }, 100));
1573
- })
1574
- ),
1575
- onPointerLeave: S(
1576
- e.onPointerLeave,
1577
- fe((s) => {
1578
- var w, C;
1579
- f();
1580
- const p = (w = n.content) == null ? void 0 : w.getBoundingClientRect();
1581
- if (p) {
1582
- const l = (C = n.content) == null ? void 0 : C.dataset.side, v = l === "right", g = v ? -5 : 5, b = p[v ? "left" : "right"], y = p[v ? "right" : "left"];
1583
- c.onPointerGraceIntentChange({
1584
- area: [
1585
- // Apply a bleed on clientX to ensure that our exit point is
1586
- // consistently within polygon bounds
1587
- { x: s.clientX + g, y: s.clientY },
1588
- { x: b, y: p.top },
1589
- { x: y, y: p.top },
1590
- { x: y, y: p.bottom },
1591
- { x: b, y: p.bottom }
1592
- ],
1593
- side: l
1594
- }), window.clearTimeout(i.current), i.current = window.setTimeout(
1595
- () => c.onPointerGraceIntentChange(null),
1596
- 300
1597
- );
1598
- } else {
1599
- if (c.onTriggerLeave(s), s.defaultPrevented)
1600
- return;
1601
- c.onPointerGraceIntentChange(null);
1602
- }
1603
- })
1604
- ),
1605
- onKeyDown: S(e.onKeyDown, (s) => {
1606
- var w;
1607
- const p = c.searchRef.current !== "";
1608
- e.disabled || p && s.key === " " || go[r.dir].includes(s.key) && (n.onOpenChange(!0), (w = n.content) == null || w.focus(), s.preventDefault());
1609
- })
1610
- }
1611
- ) });
1612
- }
1613
- );
1614
- mn.displayName = le;
1615
- var hn = "MenuSubContent", gn = a.forwardRef(
1616
- (e, t) => {
1617
- const n = Jt(F, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, c = Z(F, e.__scopeMenu), u = he(F, e.__scopeMenu), i = vn(hn, e.__scopeMenu), h = a.useRef(null), m = G(t, h);
1618
- return /* @__PURE__ */ d(de.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ d(_e, { present: r || c.open, children: /* @__PURE__ */ d(de.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ d(
1619
- qe,
1620
- {
1621
- id: i.contentId,
1622
- "aria-labelledby": i.triggerId,
1623
- ...o,
1624
- ref: m,
1625
- align: "start",
1626
- side: u.dir === "rtl" ? "left" : "right",
1627
- disableOutsidePointerEvents: !1,
1628
- disableOutsideScroll: !1,
1629
- trapFocus: !1,
1630
- onOpenAutoFocus: (f) => {
1631
- var s;
1632
- u.isUsingKeyboardRef.current && ((s = h.current) == null || s.focus()), f.preventDefault();
1633
- },
1634
- onCloseAutoFocus: (f) => f.preventDefault(),
1635
- onFocusOutside: S(e.onFocusOutside, (f) => {
1636
- f.target !== i.trigger && c.onOpenChange(!1);
1637
- }),
1638
- onEscapeKeyDown: S(e.onEscapeKeyDown, (f) => {
1639
- u.onClose(), f.preventDefault();
1640
- }),
1641
- onKeyDown: S(e.onKeyDown, (f) => {
1642
- var w;
1643
- const s = f.currentTarget.contains(f.target), p = wo[u.dir].includes(f.key);
1644
- s && p && (c.onOpenChange(!1), (w = i.trigger) == null || w.focus(), f.preventDefault());
1645
- })
1646
- }
1647
- ) }) }) });
1648
- }
1649
- );
1650
- gn.displayName = hn;
1651
- function wn(e) {
1652
- return e ? "open" : "closed";
1653
- }
1654
- function Pe(e) {
1655
- return e === "indeterminate";
1656
- }
1657
- function et(e) {
1658
- return Pe(e) ? "indeterminate" : e ? "checked" : "unchecked";
1659
- }
1660
- function Go(e) {
1661
- const t = document.activeElement;
1662
- for (const n of e)
1663
- if (n === t || (n.focus(), document.activeElement !== t))
1664
- return;
1665
- }
1666
- function Ko(e, t) {
1667
- return e.map((n, r) => e[(t + r) % e.length]);
1668
- }
1669
- function $o(e, t, n) {
1670
- const o = t.length > 1 && Array.from(t).every((m) => m === t[0]) ? t[0] : t, c = n ? e.indexOf(n) : -1;
1671
- let u = Ko(e, Math.max(c, 0));
1672
- o.length === 1 && (u = u.filter((m) => m !== n));
1673
- const h = u.find(
1674
- (m) => m.toLowerCase().startsWith(o.toLowerCase())
1675
- );
1676
- return h !== n ? h : void 0;
1677
- }
1678
- function Uo(e, t) {
1679
- const { x: n, y: r } = e;
1680
- let o = !1;
1681
- for (let c = 0, u = t.length - 1; c < t.length; u = c++) {
1682
- const i = t[c], h = t[u], m = i.x, f = i.y, s = h.x, p = h.y;
1683
- f > r != p > r && n < (s - m) * (r - f) / (p - f) + m && (o = !o);
1684
- }
1685
- return o;
1686
- }
1687
- function Bo(e, t) {
1688
- if (!t)
1689
- return !1;
1690
- const n = { x: e.clientX, y: e.clientY };
1691
- return Uo(n, t);
1692
- }
1693
- function fe(e) {
1694
- return (t) => t.pointerType === "mouse" ? e(t) : void 0;
1695
- }
1696
- var Wo = Qt, Ho = je, Yo = en, Vo = tn, Xo = Qe, jo = nn, zo = xe, Zo = on, qo = cn, Qo = sn, Jo = dn, ea = fn, ta = pn, na = mn, ra = gn, Te = "DropdownMenu", [oa, Na] = pe(
1697
- Te,
1698
- [Zt]
1699
- ), x = Zt(), [aa, yn] = oa(Te), Cn = (e) => {
1700
- const {
1701
- __scopeDropdownMenu: t,
1702
- children: n,
1703
- dir: r,
1704
- open: o,
1705
- defaultOpen: c,
1706
- onOpenChange: u,
1707
- modal: i = !0
1708
- } = e, h = x(t), m = a.useRef(null), [f, s] = ht({
1709
- prop: o,
1710
- defaultProp: c ?? !1,
1711
- onChange: u,
1712
- caller: Te
1713
- });
1714
- return /* @__PURE__ */ d(
1715
- aa,
1716
- {
1717
- scope: t,
1718
- triggerId: Be(),
1719
- triggerRef: m,
1720
- contentId: Be(),
1721
- open: f,
1722
- onOpenChange: s,
1723
- onOpenToggle: a.useCallback(() => s((p) => !p), [s]),
1724
- modal: i,
1725
- children: /* @__PURE__ */ d(Wo, { ...h, open: f, onOpenChange: s, dir: r, modal: i, children: n })
1726
- }
1727
- );
1728
- };
1729
- Cn.displayName = Te;
1730
- var bn = "DropdownMenuTrigger", En = a.forwardRef(
1731
- (e, t) => {
1732
- const { __scopeDropdownMenu: n, disabled: r = !1, ...o } = e, c = yn(bn, n), u = x(n);
1733
- return /* @__PURE__ */ d(Ho, { asChild: !0, ...u, children: /* @__PURE__ */ d(
1734
- D.button,
1735
- {
1736
- type: "button",
1737
- id: c.triggerId,
1738
- "aria-haspopup": "menu",
1739
- "aria-expanded": c.open,
1740
- "aria-controls": c.open ? c.contentId : void 0,
1741
- "data-state": c.open ? "open" : "closed",
1742
- "data-disabled": r ? "" : void 0,
1743
- disabled: r,
1744
- ...o,
1745
- ref: gt(t, c.triggerRef),
1746
- onPointerDown: S(e.onPointerDown, (i) => {
1747
- !r && i.button === 0 && i.ctrlKey === !1 && (c.onOpenToggle(), c.open || i.preventDefault());
1748
- }),
1749
- onKeyDown: S(e.onKeyDown, (i) => {
1750
- r || (["Enter", " "].includes(i.key) && c.onOpenToggle(), i.key === "ArrowDown" && c.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(i.key) && i.preventDefault());
1751
- })
1752
- }
1753
- ) });
1754
- }
1755
- );
1756
- En.displayName = bn;
1757
- var ca = "DropdownMenuPortal", Mn = (e) => {
1758
- const { __scopeDropdownMenu: t, ...n } = e, r = x(t);
1759
- return /* @__PURE__ */ d(Yo, { ...r, ...n });
1760
- };
1761
- Mn.displayName = ca;
1762
- var Sn = "DropdownMenuContent", Rn = a.forwardRef(
1763
- (e, t) => {
1764
- const { __scopeDropdownMenu: n, ...r } = e, o = yn(Sn, n), c = x(n), u = a.useRef(!1);
1765
- return /* @__PURE__ */ d(
1766
- Vo,
1767
- {
1768
- id: o.contentId,
1769
- "aria-labelledby": o.triggerId,
1770
- ...c,
1771
- ...r,
1772
- ref: t,
1773
- onCloseAutoFocus: S(e.onCloseAutoFocus, (i) => {
1774
- var h;
1775
- u.current || (h = o.triggerRef.current) == null || h.focus(), u.current = !1, i.preventDefault();
1776
- }),
1777
- onInteractOutside: S(e.onInteractOutside, (i) => {
1778
- const h = i.detail.originalEvent, m = h.button === 0 && h.ctrlKey === !0, f = h.button === 2 || m;
1779
- (!o.modal || f) && (u.current = !0);
1780
- }),
1781
- style: {
1782
- ...e.style,
1783
- "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
1784
- "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
1785
- "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
1786
- "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
1787
- "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
1788
- }
1789
- }
1790
- );
1791
- }
1792
- );
1793
- Rn.displayName = Sn;
1794
- var ia = "DropdownMenuGroup", Pn = a.forwardRef(
1795
- (e, t) => {
1796
- const { __scopeDropdownMenu: n, ...r } = e, o = x(n);
1797
- return /* @__PURE__ */ d(Xo, { ...o, ...r, ref: t });
1798
- }
1799
- );
1800
- Pn.displayName = ia;
1801
- var ua = "DropdownMenuLabel", sa = a.forwardRef(
1802
- (e, t) => {
1803
- const { __scopeDropdownMenu: n, ...r } = e, o = x(n);
1804
- return /* @__PURE__ */ d(jo, { ...o, ...r, ref: t });
1805
- }
1806
- );
1807
- sa.displayName = ua;
1808
- var la = "DropdownMenuItem", _n = a.forwardRef(
1809
- (e, t) => {
1810
- const { __scopeDropdownMenu: n, ...r } = e, o = x(n);
1811
- return /* @__PURE__ */ d(zo, { ...o, ...r, ref: t });
1812
- }
1813
- );
1814
- _n.displayName = la;
1815
- var da = "DropdownMenuCheckboxItem", fa = a.forwardRef((e, t) => {
1816
- const { __scopeDropdownMenu: n, ...r } = e, o = x(n);
1817
- return /* @__PURE__ */ d(Zo, { ...o, ...r, ref: t });
1818
- });
1819
- fa.displayName = da;
1820
- var pa = "DropdownMenuRadioGroup", va = a.forwardRef((e, t) => {
1821
- const { __scopeDropdownMenu: n, ...r } = e, o = x(n);
1822
- return /* @__PURE__ */ d(qo, { ...o, ...r, ref: t });
1823
- });
1824
- va.displayName = pa;
1825
- var ma = "DropdownMenuRadioItem", ha = a.forwardRef((e, t) => {
1826
- const { __scopeDropdownMenu: n, ...r } = e, o = x(n);
1827
- return /* @__PURE__ */ d(Qo, { ...o, ...r, ref: t });
1828
- });
1829
- ha.displayName = ma;
1830
- var ga = "DropdownMenuItemIndicator", wa = a.forwardRef((e, t) => {
1831
- const { __scopeDropdownMenu: n, ...r } = e, o = x(n);
1832
- return /* @__PURE__ */ d(Jo, { ...o, ...r, ref: t });
1833
- });
1834
- wa.displayName = ga;
1835
- var ya = "DropdownMenuSeparator", In = a.forwardRef((e, t) => {
1836
- const { __scopeDropdownMenu: n, ...r } = e, o = x(n);
1837
- return /* @__PURE__ */ d(ea, { ...o, ...r, ref: t });
1838
- });
1839
- In.displayName = ya;
1840
- var Ca = "DropdownMenuArrow", ba = a.forwardRef(
1841
- (e, t) => {
1842
- const { __scopeDropdownMenu: n, ...r } = e, o = x(n);
1843
- return /* @__PURE__ */ d(ta, { ...o, ...r, ref: t });
1844
- }
1845
- );
1846
- ba.displayName = Ca;
1847
- var Ea = "DropdownMenuSubTrigger", Ma = a.forwardRef((e, t) => {
1848
- const { __scopeDropdownMenu: n, ...r } = e, o = x(n);
1849
- return /* @__PURE__ */ d(na, { ...o, ...r, ref: t });
1850
- });
1851
- Ma.displayName = Ea;
1852
- var Sa = "DropdownMenuSubContent", Ra = a.forwardRef((e, t) => {
1853
- const { __scopeDropdownMenu: n, ...r } = e, o = x(n);
1854
- return /* @__PURE__ */ d(
1855
- ra,
1856
- {
1857
- ...o,
1858
- ...r,
1859
- ref: t,
1860
- style: {
1861
- ...e.style,
1862
- "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
1863
- "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
1864
- "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
1865
- "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
1866
- "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
1867
- }
1868
- }
1869
- );
1870
- });
1871
- Ra.displayName = Sa;
1872
- var Da = Cn, Oa = En, Fa = Mn, ka = Rn, La = Pn, Ga = _n, Ka = In;
1873
- export {
1874
- ka as C,
1875
- bt as F,
1876
- La as G,
1877
- Ga as I,
1878
- Fa as P,
1879
- Da as R,
1880
- Ka as S,
1881
- Oa as T,
1882
- vo as a,
1883
- wt as b,
1884
- xr as h,
1885
- zn as u
1886
- };