@pdf-viewer/react 1.0.1 → 1.1.0-beta.1

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