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