@pdf-viewer/react 1.9.0-beta.5 → 1.9.0-beta.6

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 (81) hide show
  1. package/dist/{Combination-da8647d4.js → Combination-9a0a3e65.js} +14 -14
  2. package/dist/ToolbarLayout.module-88476995.js +2464 -0
  3. package/dist/assets/ToolbarLayout.css +1 -1
  4. package/dist/components/RPController.js +35 -35
  5. package/dist/components/RPPages.js +1 -1
  6. package/dist/components/RPProvider.js +1 -1
  7. package/dist/components/layout/LayoutContainer.js +1 -1
  8. package/dist/components/layout/RPDefaultLayout.js +1 -1
  9. package/dist/components/layout/RPLayout.js +1 -1
  10. package/dist/components/layout/sidebar/RPSidebar.js +11 -11
  11. package/dist/components/layout/sidebar/Thumbnail.js +49 -2
  12. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  13. package/dist/components/layout/toolbar/DocumentDialog.js +11 -11
  14. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  15. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  16. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  17. package/dist/components/layout/toolbar/MostPageTool.js +2 -2
  18. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  19. package/dist/components/layout/toolbar/Paginate.js +6 -6
  20. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  21. package/dist/components/layout/toolbar/RPToolbar.js +3 -3
  22. package/dist/components/layout/toolbar/RotateTool.js +1 -1
  23. package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
  24. package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
  25. package/dist/components/layout/toolbar/SearchTool.js +1 -1
  26. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  27. package/dist/components/layout/toolbar/ThumbnailTool.js +6 -6
  28. package/dist/components/layout/toolbar/ToolbarCustom.js +3 -3
  29. package/dist/components/layout/toolbar/ToolbarDefault.js +7 -7
  30. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  31. package/dist/components/layout/toolbar/ZoomTool.js +8 -8
  32. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
  33. package/dist/components/layout/toolbar/tools/InputPageTool.js +5 -5
  34. package/dist/components/layout/toolbar/tools/NextPageTool.js +1 -1
  35. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
  36. package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
  37. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
  38. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +7 -7
  39. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +1 -1
  40. package/dist/components/page/AnnotationLayer.js +1 -1
  41. package/dist/components/page/CanvasLayer.js +2 -3
  42. package/dist/components/page/DualPage.js +1 -1
  43. package/dist/components/page/RPPage.js +1 -1
  44. package/dist/components/page/SinglePage.js +1 -1
  45. package/dist/components/page/TextHighlightLayer.js +1 -1
  46. package/dist/components/page/TextLayer.js +1 -1
  47. package/dist/components/ui/Checkbox.js +1 -1
  48. package/dist/components/ui/DropDown.js +1 -1
  49. package/dist/components/ui/LoadingIndicator.js +6 -6
  50. package/dist/components/ui/RPTooltip.js +197 -410
  51. package/dist/contexts/ElementPageContext.js +37 -37
  52. package/dist/contexts/FileInputContext.js +18 -20
  53. package/dist/contexts/PaginationContext.js +1 -1
  54. package/dist/contexts/PrintContext.js +2 -2
  55. package/dist/contexts/RenderQueueProvider.js +10 -0
  56. package/dist/contexts/SearchContext.js +1 -1
  57. package/dist/contexts/ThumbnailsContext.js +1 -1
  58. package/dist/{index-8547fbc6.js → index-2160dd99.js} +5 -5
  59. package/dist/index-492f99d0.js +1657 -0
  60. package/dist/index-49b9a615.js +978 -0
  61. package/dist/main.js +1 -1
  62. package/dist/types/components/layout/sidebar/Thumbnail.d.ts +0 -1
  63. package/dist/types/contexts/RenderQueueProvider.d.ts +16 -0
  64. package/dist/types/utils/Queue.d.ts +18 -0
  65. package/dist/types/utils/renderPage.d.ts +1 -6
  66. package/dist/types/utils/types.d.ts +5 -0
  67. package/dist/utils/Queue.js +47 -0
  68. package/dist/utils/hooks/useFileDownload.js +1 -1
  69. package/dist/utils/hooks/useLicense.js +1 -1
  70. package/dist/utils/hooks/usePageRotateContext.js +14 -14
  71. package/dist/utils/hooks/usePaginate.js +2 -2
  72. package/dist/utils/hooks/usePresentPage.js +1 -1
  73. package/dist/utils/hooks/usePrint.js +1 -1
  74. package/dist/utils/hooks/useScrollToPage.js +1 -1
  75. package/dist/utils/hooks/useSearch.js +1 -1
  76. package/dist/utils/hooks/useThumbnail.js +2 -3
  77. package/dist/utils/hooks/useVirtualReactWindow.js +1 -1
  78. package/package.json +1 -1
  79. package/dist/ToolbarLayout.module-60c3d6e8.js +0 -2434
  80. package/dist/floating-ui.react-dom-f3f380e0.js +0 -1447
  81. package/dist/index-473557b1.js +0 -1191
@@ -1,1191 +0,0 @@
1
- import * as a from "react";
2
- import X from "react";
3
- import { c as ce, u as k, S as Me, P as O, f as Bt, g as pe, h as ke, e as Ge, a as C, b as me, j as Ke, k as Yt } from "./index-8547fbc6.js";
4
- import { jsx as s } from "react/jsx-runtime";
5
- import { a as Ht, b as Vt, o as Xt, s as Wt, l as jt, f as zt, c as Zt, d as qt, h as Jt, u as Ce, D as Qt } from "./floating-ui.react-dom-f3f380e0.js";
6
- import { h as en, u as tn, F as nn, R as on, P as rn } from "./Combination-da8647d4.js";
7
- function $e(e) {
8
- const n = e + "CollectionProvider", [t, o] = ce(n), [r, c] = t(
9
- n,
10
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
11
- ), u = (h) => {
12
- const { scope: d, children: w } = h, R = X.useRef(null), M = X.useRef(/* @__PURE__ */ new Map()).current;
13
- return /* @__PURE__ */ s(r, { scope: d, itemMap: M, collectionRef: R, children: w });
14
- };
15
- u.displayName = n;
16
- const l = e + "CollectionSlot", f = X.forwardRef(
17
- (h, d) => {
18
- const { scope: w, children: R } = h, M = c(l, w), _ = k(d, M.collectionRef);
19
- return /* @__PURE__ */ s(Me, { ref: _, children: R });
20
- }
21
- );
22
- f.displayName = l;
23
- const p = e + "CollectionItemSlot", m = "data-radix-collection-item", i = X.forwardRef(
24
- (h, d) => {
25
- const { scope: w, children: R, ...M } = h, _ = X.useRef(null), S = k(d, _), x = c(p, w);
26
- return X.useEffect(() => (x.itemMap.set(_, { ref: _, ...M }), () => void x.itemMap.delete(_))), /* @__PURE__ */ s(Me, { [m]: "", ref: S, children: R });
27
- }
28
- );
29
- i.displayName = p;
30
- function v(h) {
31
- const d = c(e + "CollectionConsumer", h);
32
- return X.useCallback(() => {
33
- const R = d.collectionRef.current;
34
- if (!R)
35
- return [];
36
- const M = Array.from(R.querySelectorAll(`[${m}]`));
37
- return Array.from(d.itemMap.values()).sort(
38
- (x, L) => M.indexOf(x.ref.current) - M.indexOf(L.ref.current)
39
- );
40
- }, [d.collectionRef, d.itemMap]);
41
- }
42
- return [
43
- { Provider: u, Slot: f, ItemSlot: i },
44
- v,
45
- o
46
- ];
47
- }
48
- var an = a.createContext(void 0);
49
- function Ue(e) {
50
- const n = a.useContext(an);
51
- return e || n || "ltr";
52
- }
53
- var cn = "Arrow", Be = a.forwardRef((e, n) => {
54
- const { children: t, width: o = 10, height: r = 5, ...c } = e;
55
- return /* @__PURE__ */ s(
56
- O.svg,
57
- {
58
- ...c,
59
- ref: n,
60
- width: o,
61
- height: r,
62
- viewBox: "0 0 30 10",
63
- preserveAspectRatio: "none",
64
- children: e.asChild ? t : /* @__PURE__ */ s("polygon", { points: "0,0 30,0 15,10" })
65
- }
66
- );
67
- });
68
- Be.displayName = cn;
69
- var sn = Be, Pe = "Popper", [Ye, He] = ce(Pe), [un, Ve] = Ye(Pe), Xe = (e) => {
70
- const { __scopePopper: n, children: t } = e, [o, r] = a.useState(null);
71
- return /* @__PURE__ */ s(un, { scope: n, anchor: o, onAnchorChange: r, children: t });
72
- };
73
- Xe.displayName = Pe;
74
- var We = "PopperAnchor", je = a.forwardRef(
75
- (e, n) => {
76
- const { __scopePopper: t, virtualRef: o, ...r } = e, c = Ve(We, t), u = a.useRef(null), l = k(n, u);
77
- return a.useEffect(() => {
78
- c.onAnchorChange((o == null ? void 0 : o.current) || u.current);
79
- }), o ? null : /* @__PURE__ */ s(O.div, { ...r, ref: l });
80
- }
81
- );
82
- je.displayName = We;
83
- var Ie = "PopperContent", [dn, ln] = Ye(Ie), ze = a.forwardRef(
84
- (e, n) => {
85
- var U, ee, A, te, Ne, Oe;
86
- const {
87
- __scopePopper: t,
88
- side: o = "bottom",
89
- sideOffset: r = 0,
90
- align: c = "center",
91
- alignOffset: u = 0,
92
- arrowPadding: l = 0,
93
- avoidCollisions: f = !0,
94
- collisionBoundary: p = [],
95
- collisionPadding: m = 0,
96
- sticky: i = "partial",
97
- hideWhenDetached: v = !1,
98
- updatePositionStrategy: h = "optimized",
99
- onPlaced: d,
100
- ...w
101
- } = e, R = Ve(Ie, t), [M, _] = a.useState(null), S = k(n, (ne) => _(ne)), [x, L] = a.useState(null), T = Bt(x), G = (T == null ? void 0 : T.width) ?? 0, P = (T == null ? void 0 : T.height) ?? 0, B = o + (c !== "center" ? "-" + c : ""), K = typeof m == "number" ? m : { top: 0, right: 0, bottom: 0, left: 0, ...m }, Y = Array.isArray(p) ? p : [p], H = Y.length > 0, $ = {
102
- padding: K,
103
- boundary: Y.filter(pn),
104
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
105
- altBoundary: H
106
- }, { refs: z, floatingStyles: Z, placement: N, isPositioned: q, middlewareData: b } = Ht({
107
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
108
- strategy: "fixed",
109
- placement: B,
110
- whileElementsMounted: (...ne) => Vt(...ne, {
111
- animationFrame: h === "always"
112
- }),
113
- elements: {
114
- reference: R.anchor
115
- },
116
- middleware: [
117
- Xt({ mainAxis: r + P, alignmentAxis: u }),
118
- f && Wt({
119
- mainAxis: !0,
120
- crossAxis: !1,
121
- limiter: i === "partial" ? jt() : void 0,
122
- ...$
123
- }),
124
- f && zt({ ...$ }),
125
- Zt({
126
- ...$,
127
- apply: ({ elements: ne, rects: Fe, availableWidth: Gt, availableHeight: Kt }) => {
128
- const { width: $t, height: Ut } = Fe.reference, de = ne.floating.style;
129
- de.setProperty("--radix-popper-available-width", `${Gt}px`), de.setProperty("--radix-popper-available-height", `${Kt}px`), de.setProperty("--radix-popper-anchor-width", `${$t}px`), de.setProperty("--radix-popper-anchor-height", `${Ut}px`);
130
- }
131
- }),
132
- x && qt({ element: x, padding: l }),
133
- mn({ arrowWidth: G, arrowHeight: P }),
134
- v && Jt({ strategy: "referenceHidden", ...$ })
135
- ]
136
- }), [g, E] = Je(N), I = pe(d);
137
- ke(() => {
138
- q && (I == null || I());
139
- }, [q, I]);
140
- const F = (U = b.arrow) == null ? void 0 : U.x, J = (ee = b.arrow) == null ? void 0 : ee.y, Q = ((A = b.arrow) == null ? void 0 : A.centerOffset) !== 0, [ue, V] = a.useState();
141
- return ke(() => {
142
- M && V(window.getComputedStyle(M).zIndex);
143
- }, [M]), /* @__PURE__ */ s(
144
- "div",
145
- {
146
- ref: z.setFloating,
147
- "data-radix-popper-content-wrapper": "",
148
- style: {
149
- ...Z,
150
- transform: q ? Z.transform : "translate(0, -200%)",
151
- // keep off the page when measuring
152
- minWidth: "max-content",
153
- zIndex: ue,
154
- "--radix-popper-transform-origin": [
155
- (te = b.transformOrigin) == null ? void 0 : te.x,
156
- (Ne = b.transformOrigin) == null ? void 0 : Ne.y
157
- ].join(" "),
158
- // hide the content if using the hide middleware and should be hidden
159
- // set visibility to hidden and disable pointer events so the UI behaves
160
- // as if the PopperContent isn't there at all
161
- ...((Oe = b.hide) == null ? void 0 : Oe.referenceHidden) && {
162
- visibility: "hidden",
163
- pointerEvents: "none"
164
- }
165
- },
166
- dir: e.dir,
167
- children: /* @__PURE__ */ s(
168
- dn,
169
- {
170
- scope: t,
171
- placedSide: g,
172
- onArrowChange: L,
173
- arrowX: F,
174
- arrowY: J,
175
- shouldHideArrow: Q,
176
- children: /* @__PURE__ */ s(
177
- O.div,
178
- {
179
- "data-side": g,
180
- "data-align": E,
181
- ...w,
182
- ref: S,
183
- style: {
184
- ...w.style,
185
- // if the PopperContent hasn't been placed yet (not all measurements done)
186
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
187
- animation: q ? void 0 : "none"
188
- }
189
- }
190
- )
191
- }
192
- )
193
- }
194
- );
195
- }
196
- );
197
- ze.displayName = Ie;
198
- var Ze = "PopperArrow", fn = {
199
- top: "bottom",
200
- right: "left",
201
- bottom: "top",
202
- left: "right"
203
- }, qe = a.forwardRef(function(n, t) {
204
- const { __scopePopper: o, ...r } = n, c = ln(Ze, o), u = fn[c.placedSide];
205
- return (
206
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
207
- // doesn't report size as we'd expect on SVG elements.
208
- // it reports their bounding box which is effectively the largest path inside the SVG.
209
- /* @__PURE__ */ s(
210
- "span",
211
- {
212
- ref: c.onArrowChange,
213
- style: {
214
- position: "absolute",
215
- left: c.arrowX,
216
- top: c.arrowY,
217
- [u]: 0,
218
- transformOrigin: {
219
- top: "",
220
- right: "0 0",
221
- bottom: "center 0",
222
- left: "100% 0"
223
- }[c.placedSide],
224
- transform: {
225
- top: "translateY(100%)",
226
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
227
- bottom: "rotate(180deg)",
228
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
229
- }[c.placedSide],
230
- visibility: c.shouldHideArrow ? "hidden" : void 0
231
- },
232
- children: /* @__PURE__ */ s(
233
- sn,
234
- {
235
- ...r,
236
- ref: t,
237
- style: {
238
- ...r.style,
239
- // ensures the element can be measured correctly (mostly for if SVG)
240
- display: "block"
241
- }
242
- }
243
- )
244
- }
245
- )
246
- );
247
- });
248
- qe.displayName = Ze;
249
- function pn(e) {
250
- return e !== null;
251
- }
252
- var mn = (e) => ({
253
- name: "transformOrigin",
254
- options: e,
255
- fn(n) {
256
- var R, M, _;
257
- const { placement: t, rects: o, middlewareData: r } = n, u = ((R = r.arrow) == null ? void 0 : R.centerOffset) !== 0, l = u ? 0 : e.arrowWidth, f = u ? 0 : e.arrowHeight, [p, m] = Je(t), i = { start: "0%", center: "50%", end: "100%" }[m], v = (((M = r.arrow) == null ? void 0 : M.x) ?? 0) + l / 2, h = (((_ = r.arrow) == null ? void 0 : _.y) ?? 0) + f / 2;
258
- let d = "", w = "";
259
- return p === "bottom" ? (d = u ? i : `${v}px`, w = `${-f}px`) : p === "top" ? (d = u ? i : `${v}px`, w = `${o.floating.height + f}px`) : p === "right" ? (d = `${-f}px`, w = u ? i : `${h}px`) : p === "left" && (d = `${o.floating.width + f}px`, w = u ? i : `${h}px`), { data: { x: d, y: w } };
260
- }
261
- });
262
- function Je(e) {
263
- const [n, t = "center"] = e.split("-");
264
- return [n, t];
265
- }
266
- var vn = Xe, gn = je, hn = ze, wn = qe, we = "rovingFocusGroup.onEntryFocus", Mn = { bubbles: !1, cancelable: !0 }, ve = "RovingFocusGroup", [_e, Qe, Cn] = $e(ve), [_n, et] = ce(
267
- ve,
268
- [Cn]
269
- ), [Rn, Pn] = _n(ve), tt = a.forwardRef(
270
- (e, n) => /* @__PURE__ */ s(_e.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ s(_e.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ s(In, { ...e, ref: n }) }) })
271
- );
272
- tt.displayName = ve;
273
- var In = a.forwardRef((e, n) => {
274
- const {
275
- __scopeRovingFocusGroup: t,
276
- orientation: o,
277
- loop: r = !1,
278
- dir: c,
279
- currentTabStopId: u,
280
- defaultCurrentTabStopId: l,
281
- onCurrentTabStopIdChange: f,
282
- onEntryFocus: p,
283
- preventScrollOnEntryFocus: m = !1,
284
- ...i
285
- } = e, v = a.useRef(null), h = k(n, v), d = Ue(c), [w = null, R] = Ge({
286
- prop: u,
287
- defaultProp: l,
288
- onChange: f
289
- }), [M, _] = a.useState(!1), S = pe(p), x = Qe(t), L = a.useRef(!1), [T, G] = a.useState(0);
290
- return a.useEffect(() => {
291
- const P = v.current;
292
- if (P)
293
- return P.addEventListener(we, S), () => P.removeEventListener(we, S);
294
- }, [S]), /* @__PURE__ */ s(
295
- Rn,
296
- {
297
- scope: t,
298
- orientation: o,
299
- dir: d,
300
- loop: r,
301
- currentTabStopId: w,
302
- onItemFocus: a.useCallback(
303
- (P) => R(P),
304
- [R]
305
- ),
306
- onItemShiftTab: a.useCallback(() => _(!0), []),
307
- onFocusableItemAdd: a.useCallback(
308
- () => G((P) => P + 1),
309
- []
310
- ),
311
- onFocusableItemRemove: a.useCallback(
312
- () => G((P) => P - 1),
313
- []
314
- ),
315
- children: /* @__PURE__ */ s(
316
- O.div,
317
- {
318
- tabIndex: M || T === 0 ? -1 : 0,
319
- "data-orientation": o,
320
- ...i,
321
- ref: h,
322
- style: { outline: "none", ...e.style },
323
- onMouseDown: C(e.onMouseDown, () => {
324
- L.current = !0;
325
- }),
326
- onFocus: C(e.onFocus, (P) => {
327
- const B = !L.current;
328
- if (P.target === P.currentTarget && B && !M) {
329
- const K = new CustomEvent(we, Mn);
330
- if (P.currentTarget.dispatchEvent(K), !K.defaultPrevented) {
331
- const Y = x().filter((N) => N.focusable), H = Y.find((N) => N.active), $ = Y.find((N) => N.id === w), Z = [H, $, ...Y].filter(
332
- Boolean
333
- ).map((N) => N.ref.current);
334
- rt(Z, m);
335
- }
336
- }
337
- L.current = !1;
338
- }),
339
- onBlur: C(e.onBlur, () => _(!1))
340
- }
341
- )
342
- }
343
- );
344
- }), nt = "RovingFocusGroupItem", ot = a.forwardRef(
345
- (e, n) => {
346
- const {
347
- __scopeRovingFocusGroup: t,
348
- focusable: o = !0,
349
- active: r = !1,
350
- tabStopId: c,
351
- ...u
352
- } = e, l = Ce(), f = c || l, p = Pn(nt, t), m = p.currentTabStopId === f, i = Qe(t), { onFocusableItemAdd: v, onFocusableItemRemove: h } = p;
353
- return a.useEffect(() => {
354
- if (o)
355
- return v(), () => h();
356
- }, [o, v, h]), /* @__PURE__ */ s(
357
- _e.ItemSlot,
358
- {
359
- scope: t,
360
- id: f,
361
- focusable: o,
362
- active: r,
363
- children: /* @__PURE__ */ s(
364
- O.span,
365
- {
366
- tabIndex: m ? 0 : -1,
367
- "data-orientation": p.orientation,
368
- ...u,
369
- ref: n,
370
- onMouseDown: C(e.onMouseDown, (d) => {
371
- o ? p.onItemFocus(f) : d.preventDefault();
372
- }),
373
- onFocus: C(e.onFocus, () => p.onItemFocus(f)),
374
- onKeyDown: C(e.onKeyDown, (d) => {
375
- if (d.key === "Tab" && d.shiftKey) {
376
- p.onItemShiftTab();
377
- return;
378
- }
379
- if (d.target !== d.currentTarget)
380
- return;
381
- const w = Sn(d, p.orientation, p.dir);
382
- if (w !== void 0) {
383
- if (d.metaKey || d.ctrlKey || d.altKey || d.shiftKey)
384
- return;
385
- d.preventDefault();
386
- let M = i().filter((_) => _.focusable).map((_) => _.ref.current);
387
- if (w === "last")
388
- M.reverse();
389
- else if (w === "prev" || w === "next") {
390
- w === "prev" && M.reverse();
391
- const _ = M.indexOf(d.currentTarget);
392
- M = p.loop ? xn(M, _ + 1) : M.slice(_ + 1);
393
- }
394
- setTimeout(() => rt(M));
395
- }
396
- })
397
- }
398
- )
399
- }
400
- );
401
- }
402
- );
403
- ot.displayName = nt;
404
- var yn = {
405
- ArrowLeft: "prev",
406
- ArrowUp: "prev",
407
- ArrowRight: "next",
408
- ArrowDown: "next",
409
- PageUp: "first",
410
- Home: "first",
411
- PageDown: "last",
412
- End: "last"
413
- };
414
- function En(e, n) {
415
- return n !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
416
- }
417
- function Sn(e, n, t) {
418
- const o = En(e.key, t);
419
- if (!(n === "vertical" && ["ArrowLeft", "ArrowRight"].includes(o)) && !(n === "horizontal" && ["ArrowUp", "ArrowDown"].includes(o)))
420
- return yn[o];
421
- }
422
- function rt(e, n = !1) {
423
- const t = document.activeElement;
424
- for (const o of e)
425
- if (o === t || (o.focus({ preventScroll: n }), document.activeElement !== t))
426
- return;
427
- }
428
- function xn(e, n) {
429
- return e.map((t, o) => e[(n + o) % e.length]);
430
- }
431
- var bn = tt, An = ot, Re = ["Enter", " "], Dn = ["ArrowDown", "PageUp", "Home"], at = ["ArrowUp", "PageDown", "End"], Tn = [...Dn, ...at], Nn = {
432
- ltr: [...Re, "ArrowRight"],
433
- rtl: [...Re, "ArrowLeft"]
434
- }, On = {
435
- ltr: ["ArrowLeft"],
436
- rtl: ["ArrowRight"]
437
- }, se = "Menu", [re, Fn, kn] = $e(se), [W, ct] = ce(se, [
438
- kn,
439
- He,
440
- et
441
- ]), ge = He(), st = et(), [Ln, j] = W(se), [Gn, ie] = W(se), it = (e) => {
442
- const { __scopeMenu: n, open: t = !1, children: o, dir: r, onOpenChange: c, modal: u = !0 } = e, l = ge(n), [f, p] = a.useState(null), m = a.useRef(!1), i = pe(c), v = Ue(r);
443
- return a.useEffect(() => {
444
- const h = () => {
445
- m.current = !0, document.addEventListener("pointerdown", d, { capture: !0, once: !0 }), document.addEventListener("pointermove", d, { capture: !0, once: !0 });
446
- }, d = () => m.current = !1;
447
- return document.addEventListener("keydown", h, { capture: !0 }), () => {
448
- document.removeEventListener("keydown", h, { capture: !0 }), document.removeEventListener("pointerdown", d, { capture: !0 }), document.removeEventListener("pointermove", d, { capture: !0 });
449
- };
450
- }, []), /* @__PURE__ */ s(vn, { ...l, children: /* @__PURE__ */ s(
451
- Ln,
452
- {
453
- scope: n,
454
- open: t,
455
- onOpenChange: i,
456
- content: f,
457
- onContentChange: p,
458
- children: /* @__PURE__ */ s(
459
- Gn,
460
- {
461
- scope: n,
462
- onClose: a.useCallback(() => i(!1), [i]),
463
- isUsingKeyboardRef: m,
464
- dir: v,
465
- modal: u,
466
- children: o
467
- }
468
- )
469
- }
470
- ) });
471
- };
472
- it.displayName = se;
473
- var Kn = "MenuAnchor", ye = a.forwardRef(
474
- (e, n) => {
475
- const { __scopeMenu: t, ...o } = e, r = ge(t);
476
- return /* @__PURE__ */ s(gn, { ...r, ...o, ref: n });
477
- }
478
- );
479
- ye.displayName = Kn;
480
- var Ee = "MenuPortal", [$n, ut] = W(Ee, {
481
- forceMount: void 0
482
- }), dt = (e) => {
483
- const { __scopeMenu: n, forceMount: t, children: o, container: r } = e, c = j(Ee, n);
484
- return /* @__PURE__ */ s($n, { scope: n, forceMount: t, children: /* @__PURE__ */ s(me, { present: t || c.open, children: /* @__PURE__ */ s(rn, { asChild: !0, container: r, children: o }) }) });
485
- };
486
- dt.displayName = Ee;
487
- var D = "MenuContent", [Un, Se] = W(D), lt = a.forwardRef(
488
- (e, n) => {
489
- const t = ut(D, e.__scopeMenu), { forceMount: o = t.forceMount, ...r } = e, c = j(D, e.__scopeMenu), u = ie(D, e.__scopeMenu);
490
- return /* @__PURE__ */ s(re.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(me, { present: o || c.open, children: /* @__PURE__ */ s(re.Slot, { scope: e.__scopeMenu, children: u.modal ? /* @__PURE__ */ s(Bn, { ...r, ref: n }) : /* @__PURE__ */ s(Yn, { ...r, ref: n }) }) }) });
491
- }
492
- ), Bn = a.forwardRef(
493
- (e, n) => {
494
- const t = j(D, e.__scopeMenu), o = a.useRef(null), r = k(n, o);
495
- return a.useEffect(() => {
496
- const c = o.current;
497
- if (c)
498
- return en(c);
499
- }, []), /* @__PURE__ */ s(
500
- xe,
501
- {
502
- ...e,
503
- ref: r,
504
- trapFocus: t.open,
505
- disableOutsidePointerEvents: t.open,
506
- disableOutsideScroll: !0,
507
- onFocusOutside: C(
508
- e.onFocusOutside,
509
- (c) => c.preventDefault(),
510
- { checkForDefaultPrevented: !1 }
511
- ),
512
- onDismiss: () => t.onOpenChange(!1)
513
- }
514
- );
515
- }
516
- ), Yn = a.forwardRef((e, n) => {
517
- const t = j(D, e.__scopeMenu);
518
- return /* @__PURE__ */ s(
519
- xe,
520
- {
521
- ...e,
522
- ref: n,
523
- trapFocus: !1,
524
- disableOutsidePointerEvents: !1,
525
- disableOutsideScroll: !1,
526
- onDismiss: () => t.onOpenChange(!1)
527
- }
528
- );
529
- }), xe = a.forwardRef(
530
- (e, n) => {
531
- const {
532
- __scopeMenu: t,
533
- loop: o = !1,
534
- trapFocus: r,
535
- onOpenAutoFocus: c,
536
- onCloseAutoFocus: u,
537
- disableOutsidePointerEvents: l,
538
- onEntryFocus: f,
539
- onEscapeKeyDown: p,
540
- onPointerDownOutside: m,
541
- onFocusOutside: i,
542
- onInteractOutside: v,
543
- onDismiss: h,
544
- disableOutsideScroll: d,
545
- ...w
546
- } = e, R = j(D, t), M = ie(D, t), _ = ge(t), S = st(t), x = Fn(t), [L, T] = a.useState(null), G = a.useRef(null), P = k(n, G, R.onContentChange), B = a.useRef(0), K = a.useRef(""), Y = a.useRef(0), H = a.useRef(null), $ = a.useRef("right"), z = a.useRef(0), Z = d ? on : a.Fragment, N = d ? { as: Me, allowPinchZoom: !0 } : void 0, q = (g) => {
547
- var U, ee;
548
- const E = K.current + g, I = x().filter((A) => !A.disabled), F = document.activeElement, J = (U = I.find((A) => A.ref.current === F)) == null ? void 0 : U.textValue, Q = I.map((A) => A.textValue), ue = to(Q, E, J), V = (ee = I.find((A) => A.textValue === ue)) == null ? void 0 : ee.ref.current;
549
- (function A(te) {
550
- K.current = te, window.clearTimeout(B.current), te !== "" && (B.current = window.setTimeout(() => A(""), 1e3));
551
- })(E), V && setTimeout(() => V.focus());
552
- };
553
- a.useEffect(() => () => window.clearTimeout(B.current), []), tn();
554
- const b = a.useCallback((g) => {
555
- var I, F;
556
- return $.current === ((I = H.current) == null ? void 0 : I.side) && oo(g, (F = H.current) == null ? void 0 : F.area);
557
- }, []);
558
- return /* @__PURE__ */ s(
559
- Un,
560
- {
561
- scope: t,
562
- searchRef: K,
563
- onItemEnter: a.useCallback(
564
- (g) => {
565
- b(g) && g.preventDefault();
566
- },
567
- [b]
568
- ),
569
- onItemLeave: a.useCallback(
570
- (g) => {
571
- var E;
572
- b(g) || ((E = G.current) == null || E.focus(), T(null));
573
- },
574
- [b]
575
- ),
576
- onTriggerLeave: a.useCallback(
577
- (g) => {
578
- b(g) && g.preventDefault();
579
- },
580
- [b]
581
- ),
582
- pointerGraceTimerRef: Y,
583
- onPointerGraceIntentChange: a.useCallback((g) => {
584
- H.current = g;
585
- }, []),
586
- children: /* @__PURE__ */ s(Z, { ...N, children: /* @__PURE__ */ s(
587
- nn,
588
- {
589
- asChild: !0,
590
- trapped: r,
591
- onMountAutoFocus: C(c, (g) => {
592
- var E;
593
- g.preventDefault(), (E = G.current) == null || E.focus({ preventScroll: !0 });
594
- }),
595
- onUnmountAutoFocus: u,
596
- children: /* @__PURE__ */ s(
597
- Qt,
598
- {
599
- asChild: !0,
600
- disableOutsidePointerEvents: l,
601
- onEscapeKeyDown: p,
602
- onPointerDownOutside: m,
603
- onFocusOutside: i,
604
- onInteractOutside: v,
605
- onDismiss: h,
606
- children: /* @__PURE__ */ s(
607
- bn,
608
- {
609
- asChild: !0,
610
- ...S,
611
- dir: M.dir,
612
- orientation: "vertical",
613
- loop: o,
614
- currentTabStopId: L,
615
- onCurrentTabStopIdChange: T,
616
- onEntryFocus: C(f, (g) => {
617
- M.isUsingKeyboardRef.current || g.preventDefault();
618
- }),
619
- preventScrollOnEntryFocus: !0,
620
- children: /* @__PURE__ */ s(
621
- hn,
622
- {
623
- role: "menu",
624
- "aria-orientation": "vertical",
625
- "data-state": St(R.open),
626
- "data-radix-menu-content": "",
627
- dir: M.dir,
628
- ..._,
629
- ...w,
630
- ref: P,
631
- style: { outline: "none", ...w.style },
632
- onKeyDown: C(w.onKeyDown, (g) => {
633
- const I = g.target.closest("[data-radix-menu-content]") === g.currentTarget, F = g.ctrlKey || g.altKey || g.metaKey, J = g.key.length === 1;
634
- I && (g.key === "Tab" && g.preventDefault(), !F && J && q(g.key));
635
- const Q = G.current;
636
- if (g.target !== Q || !Tn.includes(g.key))
637
- return;
638
- g.preventDefault();
639
- const V = x().filter((U) => !U.disabled).map((U) => U.ref.current);
640
- at.includes(g.key) && V.reverse(), Qn(V);
641
- }),
642
- onBlur: C(e.onBlur, (g) => {
643
- g.currentTarget.contains(g.target) || (window.clearTimeout(B.current), K.current = "");
644
- }),
645
- onPointerMove: C(
646
- e.onPointerMove,
647
- ae((g) => {
648
- const E = g.target, I = z.current !== g.clientX;
649
- if (g.currentTarget.contains(E) && I) {
650
- const F = g.clientX > z.current ? "right" : "left";
651
- $.current = F, z.current = g.clientX;
652
- }
653
- })
654
- )
655
- }
656
- )
657
- }
658
- )
659
- }
660
- )
661
- }
662
- ) })
663
- }
664
- );
665
- }
666
- );
667
- lt.displayName = D;
668
- var Hn = "MenuGroup", be = a.forwardRef(
669
- (e, n) => {
670
- const { __scopeMenu: t, ...o } = e;
671
- return /* @__PURE__ */ s(O.div, { role: "group", ...o, ref: n });
672
- }
673
- );
674
- be.displayName = Hn;
675
- var Vn = "MenuLabel", ft = a.forwardRef(
676
- (e, n) => {
677
- const { __scopeMenu: t, ...o } = e;
678
- return /* @__PURE__ */ s(O.div, { ...o, ref: n });
679
- }
680
- );
681
- ft.displayName = Vn;
682
- var le = "MenuItem", Le = "menu.itemSelect", he = a.forwardRef(
683
- (e, n) => {
684
- const { disabled: t = !1, onSelect: o, ...r } = e, c = a.useRef(null), u = ie(le, e.__scopeMenu), l = Se(le, e.__scopeMenu), f = k(n, c), p = a.useRef(!1), m = () => {
685
- const i = c.current;
686
- if (!t && i) {
687
- const v = new CustomEvent(Le, { bubbles: !0, cancelable: !0 });
688
- i.addEventListener(Le, (h) => o == null ? void 0 : o(h), { once: !0 }), Yt(i, v), v.defaultPrevented ? p.current = !1 : u.onClose();
689
- }
690
- };
691
- return /* @__PURE__ */ s(
692
- pt,
693
- {
694
- ...r,
695
- ref: f,
696
- disabled: t,
697
- onClick: C(e.onClick, m),
698
- onPointerDown: (i) => {
699
- var v;
700
- (v = e.onPointerDown) == null || v.call(e, i), p.current = !0;
701
- },
702
- onPointerUp: C(e.onPointerUp, (i) => {
703
- var v;
704
- p.current || (v = i.currentTarget) == null || v.click();
705
- }),
706
- onKeyDown: C(e.onKeyDown, (i) => {
707
- const v = l.searchRef.current !== "";
708
- t || v && i.key === " " || Re.includes(i.key) && (i.currentTarget.click(), i.preventDefault());
709
- })
710
- }
711
- );
712
- }
713
- );
714
- he.displayName = le;
715
- var pt = a.forwardRef(
716
- (e, n) => {
717
- const { __scopeMenu: t, disabled: o = !1, textValue: r, ...c } = e, u = Se(le, t), l = st(t), f = a.useRef(null), p = k(n, f), [m, i] = a.useState(!1), [v, h] = a.useState("");
718
- return a.useEffect(() => {
719
- const d = f.current;
720
- d && h((d.textContent ?? "").trim());
721
- }, [c.children]), /* @__PURE__ */ s(
722
- re.ItemSlot,
723
- {
724
- scope: t,
725
- disabled: o,
726
- textValue: r ?? v,
727
- children: /* @__PURE__ */ s(An, { asChild: !0, ...l, focusable: !o, children: /* @__PURE__ */ s(
728
- O.div,
729
- {
730
- role: "menuitem",
731
- "data-highlighted": m ? "" : void 0,
732
- "aria-disabled": o || void 0,
733
- "data-disabled": o ? "" : void 0,
734
- ...c,
735
- ref: p,
736
- onPointerMove: C(
737
- e.onPointerMove,
738
- ae((d) => {
739
- o ? u.onItemLeave(d) : (u.onItemEnter(d), d.defaultPrevented || d.currentTarget.focus({ preventScroll: !0 }));
740
- })
741
- ),
742
- onPointerLeave: C(
743
- e.onPointerLeave,
744
- ae((d) => u.onItemLeave(d))
745
- ),
746
- onFocus: C(e.onFocus, () => i(!0)),
747
- onBlur: C(e.onBlur, () => i(!1))
748
- }
749
- ) })
750
- }
751
- );
752
- }
753
- ), Xn = "MenuCheckboxItem", mt = a.forwardRef(
754
- (e, n) => {
755
- const { checked: t = !1, onCheckedChange: o, ...r } = e;
756
- return /* @__PURE__ */ s(Mt, { scope: e.__scopeMenu, checked: t, children: /* @__PURE__ */ s(
757
- he,
758
- {
759
- role: "menuitemcheckbox",
760
- "aria-checked": fe(t) ? "mixed" : t,
761
- ...r,
762
- ref: n,
763
- "data-state": De(t),
764
- onSelect: C(
765
- r.onSelect,
766
- () => o == null ? void 0 : o(fe(t) ? !0 : !t),
767
- { checkForDefaultPrevented: !1 }
768
- )
769
- }
770
- ) });
771
- }
772
- );
773
- mt.displayName = Xn;
774
- var vt = "MenuRadioGroup", [Wn, jn] = W(
775
- vt,
776
- { value: void 0, onValueChange: () => {
777
- } }
778
- ), gt = a.forwardRef(
779
- (e, n) => {
780
- const { value: t, onValueChange: o, ...r } = e, c = pe(o);
781
- return /* @__PURE__ */ s(Wn, { scope: e.__scopeMenu, value: t, onValueChange: c, children: /* @__PURE__ */ s(be, { ...r, ref: n }) });
782
- }
783
- );
784
- gt.displayName = vt;
785
- var ht = "MenuRadioItem", wt = a.forwardRef(
786
- (e, n) => {
787
- const { value: t, ...o } = e, r = jn(ht, e.__scopeMenu), c = t === r.value;
788
- return /* @__PURE__ */ s(Mt, { scope: e.__scopeMenu, checked: c, children: /* @__PURE__ */ s(
789
- he,
790
- {
791
- role: "menuitemradio",
792
- "aria-checked": c,
793
- ...o,
794
- ref: n,
795
- "data-state": De(c),
796
- onSelect: C(
797
- o.onSelect,
798
- () => {
799
- var u;
800
- return (u = r.onValueChange) == null ? void 0 : u.call(r, t);
801
- },
802
- { checkForDefaultPrevented: !1 }
803
- )
804
- }
805
- ) });
806
- }
807
- );
808
- wt.displayName = ht;
809
- var Ae = "MenuItemIndicator", [Mt, zn] = W(
810
- Ae,
811
- { checked: !1 }
812
- ), Ct = a.forwardRef(
813
- (e, n) => {
814
- const { __scopeMenu: t, forceMount: o, ...r } = e, c = zn(Ae, t);
815
- return /* @__PURE__ */ s(
816
- me,
817
- {
818
- present: o || fe(c.checked) || c.checked === !0,
819
- children: /* @__PURE__ */ s(
820
- O.span,
821
- {
822
- ...r,
823
- ref: n,
824
- "data-state": De(c.checked)
825
- }
826
- )
827
- }
828
- );
829
- }
830
- );
831
- Ct.displayName = Ae;
832
- var Zn = "MenuSeparator", _t = a.forwardRef(
833
- (e, n) => {
834
- const { __scopeMenu: t, ...o } = e;
835
- return /* @__PURE__ */ s(
836
- O.div,
837
- {
838
- role: "separator",
839
- "aria-orientation": "horizontal",
840
- ...o,
841
- ref: n
842
- }
843
- );
844
- }
845
- );
846
- _t.displayName = Zn;
847
- var qn = "MenuArrow", Rt = a.forwardRef(
848
- (e, n) => {
849
- const { __scopeMenu: t, ...o } = e, r = ge(t);
850
- return /* @__PURE__ */ s(wn, { ...r, ...o, ref: n });
851
- }
852
- );
853
- Rt.displayName = qn;
854
- var Jn = "MenuSub", [Wo, Pt] = W(Jn), oe = "MenuSubTrigger", It = a.forwardRef(
855
- (e, n) => {
856
- const t = j(oe, e.__scopeMenu), o = ie(oe, e.__scopeMenu), r = Pt(oe, e.__scopeMenu), c = Se(oe, e.__scopeMenu), u = a.useRef(null), { pointerGraceTimerRef: l, onPointerGraceIntentChange: f } = c, p = { __scopeMenu: e.__scopeMenu }, m = a.useCallback(() => {
857
- u.current && window.clearTimeout(u.current), u.current = null;
858
- }, []);
859
- return a.useEffect(() => m, [m]), a.useEffect(() => {
860
- const i = l.current;
861
- return () => {
862
- window.clearTimeout(i), f(null);
863
- };
864
- }, [l, f]), /* @__PURE__ */ s(ye, { asChild: !0, ...p, children: /* @__PURE__ */ s(
865
- pt,
866
- {
867
- id: r.triggerId,
868
- "aria-haspopup": "menu",
869
- "aria-expanded": t.open,
870
- "aria-controls": r.contentId,
871
- "data-state": St(t.open),
872
- ...e,
873
- ref: Ke(n, r.onTriggerChange),
874
- onClick: (i) => {
875
- var v;
876
- (v = e.onClick) == null || v.call(e, i), !(e.disabled || i.defaultPrevented) && (i.currentTarget.focus(), t.open || t.onOpenChange(!0));
877
- },
878
- onPointerMove: C(
879
- e.onPointerMove,
880
- ae((i) => {
881
- c.onItemEnter(i), !i.defaultPrevented && !e.disabled && !t.open && !u.current && (c.onPointerGraceIntentChange(null), u.current = window.setTimeout(() => {
882
- t.onOpenChange(!0), m();
883
- }, 100));
884
- })
885
- ),
886
- onPointerLeave: C(
887
- e.onPointerLeave,
888
- ae((i) => {
889
- var h, d;
890
- m();
891
- const v = (h = t.content) == null ? void 0 : h.getBoundingClientRect();
892
- if (v) {
893
- const w = (d = t.content) == null ? void 0 : d.dataset.side, R = w === "right", M = R ? -5 : 5, _ = v[R ? "left" : "right"], S = v[R ? "right" : "left"];
894
- c.onPointerGraceIntentChange({
895
- area: [
896
- // Apply a bleed on clientX to ensure that our exit point is
897
- // consistently within polygon bounds
898
- { x: i.clientX + M, y: i.clientY },
899
- { x: _, y: v.top },
900
- { x: S, y: v.top },
901
- { x: S, y: v.bottom },
902
- { x: _, y: v.bottom }
903
- ],
904
- side: w
905
- }), window.clearTimeout(l.current), l.current = window.setTimeout(
906
- () => c.onPointerGraceIntentChange(null),
907
- 300
908
- );
909
- } else {
910
- if (c.onTriggerLeave(i), i.defaultPrevented)
911
- return;
912
- c.onPointerGraceIntentChange(null);
913
- }
914
- })
915
- ),
916
- onKeyDown: C(e.onKeyDown, (i) => {
917
- var h;
918
- const v = c.searchRef.current !== "";
919
- e.disabled || v && i.key === " " || Nn[o.dir].includes(i.key) && (t.onOpenChange(!0), (h = t.content) == null || h.focus(), i.preventDefault());
920
- })
921
- }
922
- ) });
923
- }
924
- );
925
- It.displayName = oe;
926
- var yt = "MenuSubContent", Et = a.forwardRef(
927
- (e, n) => {
928
- const t = ut(D, e.__scopeMenu), { forceMount: o = t.forceMount, ...r } = e, c = j(D, e.__scopeMenu), u = ie(D, e.__scopeMenu), l = Pt(yt, e.__scopeMenu), f = a.useRef(null), p = k(n, f);
929
- return /* @__PURE__ */ s(re.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(me, { present: o || c.open, children: /* @__PURE__ */ s(re.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(
930
- xe,
931
- {
932
- id: l.contentId,
933
- "aria-labelledby": l.triggerId,
934
- ...r,
935
- ref: p,
936
- align: "start",
937
- side: u.dir === "rtl" ? "left" : "right",
938
- disableOutsidePointerEvents: !1,
939
- disableOutsideScroll: !1,
940
- trapFocus: !1,
941
- onOpenAutoFocus: (m) => {
942
- var i;
943
- u.isUsingKeyboardRef.current && ((i = f.current) == null || i.focus()), m.preventDefault();
944
- },
945
- onCloseAutoFocus: (m) => m.preventDefault(),
946
- onFocusOutside: C(e.onFocusOutside, (m) => {
947
- m.target !== l.trigger && c.onOpenChange(!1);
948
- }),
949
- onEscapeKeyDown: C(e.onEscapeKeyDown, (m) => {
950
- u.onClose(), m.preventDefault();
951
- }),
952
- onKeyDown: C(e.onKeyDown, (m) => {
953
- var h;
954
- const i = m.currentTarget.contains(m.target), v = On[u.dir].includes(m.key);
955
- i && v && (c.onOpenChange(!1), (h = l.trigger) == null || h.focus(), m.preventDefault());
956
- })
957
- }
958
- ) }) }) });
959
- }
960
- );
961
- Et.displayName = yt;
962
- function St(e) {
963
- return e ? "open" : "closed";
964
- }
965
- function fe(e) {
966
- return e === "indeterminate";
967
- }
968
- function De(e) {
969
- return fe(e) ? "indeterminate" : e ? "checked" : "unchecked";
970
- }
971
- function Qn(e) {
972
- const n = document.activeElement;
973
- for (const t of e)
974
- if (t === n || (t.focus(), document.activeElement !== n))
975
- return;
976
- }
977
- function eo(e, n) {
978
- return e.map((t, o) => e[(n + o) % e.length]);
979
- }
980
- function to(e, n, t) {
981
- const r = n.length > 1 && Array.from(n).every((p) => p === n[0]) ? n[0] : n, c = t ? e.indexOf(t) : -1;
982
- let u = eo(e, Math.max(c, 0));
983
- r.length === 1 && (u = u.filter((p) => p !== t));
984
- const f = u.find(
985
- (p) => p.toLowerCase().startsWith(r.toLowerCase())
986
- );
987
- return f !== t ? f : void 0;
988
- }
989
- function no(e, n) {
990
- const { x: t, y: o } = e;
991
- let r = !1;
992
- for (let c = 0, u = n.length - 1; c < n.length; u = c++) {
993
- const l = n[c].x, f = n[c].y, p = n[u].x, m = n[u].y;
994
- f > o != m > o && t < (p - l) * (o - f) / (m - f) + l && (r = !r);
995
- }
996
- return r;
997
- }
998
- function oo(e, n) {
999
- if (!n)
1000
- return !1;
1001
- const t = { x: e.clientX, y: e.clientY };
1002
- return no(t, n);
1003
- }
1004
- function ae(e) {
1005
- return (n) => n.pointerType === "mouse" ? e(n) : void 0;
1006
- }
1007
- var ro = it, ao = ye, co = dt, so = lt, io = be, uo = ft, lo = he, fo = mt, po = gt, mo = wt, vo = Ct, go = _t, ho = Rt, wo = It, Mo = Et, Te = "DropdownMenu", [Co, jo] = ce(
1008
- Te,
1009
- [ct]
1010
- ), y = ct(), [_o, xt] = Co(Te), bt = (e) => {
1011
- const {
1012
- __scopeDropdownMenu: n,
1013
- children: t,
1014
- dir: o,
1015
- open: r,
1016
- defaultOpen: c,
1017
- onOpenChange: u,
1018
- modal: l = !0
1019
- } = e, f = y(n), p = a.useRef(null), [m = !1, i] = Ge({
1020
- prop: r,
1021
- defaultProp: c,
1022
- onChange: u
1023
- });
1024
- return /* @__PURE__ */ s(
1025
- _o,
1026
- {
1027
- scope: n,
1028
- triggerId: Ce(),
1029
- triggerRef: p,
1030
- contentId: Ce(),
1031
- open: m,
1032
- onOpenChange: i,
1033
- onOpenToggle: a.useCallback(() => i((v) => !v), [i]),
1034
- modal: l,
1035
- children: /* @__PURE__ */ s(ro, { ...f, open: m, onOpenChange: i, dir: o, modal: l, children: t })
1036
- }
1037
- );
1038
- };
1039
- bt.displayName = Te;
1040
- var At = "DropdownMenuTrigger", Dt = a.forwardRef(
1041
- (e, n) => {
1042
- const { __scopeDropdownMenu: t, disabled: o = !1, ...r } = e, c = xt(At, t), u = y(t);
1043
- return /* @__PURE__ */ s(ao, { asChild: !0, ...u, children: /* @__PURE__ */ s(
1044
- O.button,
1045
- {
1046
- type: "button",
1047
- id: c.triggerId,
1048
- "aria-haspopup": "menu",
1049
- "aria-expanded": c.open,
1050
- "aria-controls": c.open ? c.contentId : void 0,
1051
- "data-state": c.open ? "open" : "closed",
1052
- "data-disabled": o ? "" : void 0,
1053
- disabled: o,
1054
- ...r,
1055
- ref: Ke(n, c.triggerRef),
1056
- onPointerDown: C(e.onPointerDown, (l) => {
1057
- !o && l.button === 0 && l.ctrlKey === !1 && (c.onOpenToggle(), c.open || l.preventDefault());
1058
- }),
1059
- onKeyDown: C(e.onKeyDown, (l) => {
1060
- o || (["Enter", " "].includes(l.key) && c.onOpenToggle(), l.key === "ArrowDown" && c.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(l.key) && l.preventDefault());
1061
- })
1062
- }
1063
- ) });
1064
- }
1065
- );
1066
- Dt.displayName = At;
1067
- var Ro = "DropdownMenuPortal", Tt = (e) => {
1068
- const { __scopeDropdownMenu: n, ...t } = e, o = y(n);
1069
- return /* @__PURE__ */ s(co, { ...o, ...t });
1070
- };
1071
- Tt.displayName = Ro;
1072
- var Nt = "DropdownMenuContent", Ot = a.forwardRef(
1073
- (e, n) => {
1074
- const { __scopeDropdownMenu: t, ...o } = e, r = xt(Nt, t), c = y(t), u = a.useRef(!1);
1075
- return /* @__PURE__ */ s(
1076
- so,
1077
- {
1078
- id: r.contentId,
1079
- "aria-labelledby": r.triggerId,
1080
- ...c,
1081
- ...o,
1082
- ref: n,
1083
- onCloseAutoFocus: C(e.onCloseAutoFocus, (l) => {
1084
- var f;
1085
- u.current || (f = r.triggerRef.current) == null || f.focus(), u.current = !1, l.preventDefault();
1086
- }),
1087
- onInteractOutside: C(e.onInteractOutside, (l) => {
1088
- const f = l.detail.originalEvent, p = f.button === 0 && f.ctrlKey === !0, m = f.button === 2 || p;
1089
- (!r.modal || m) && (u.current = !0);
1090
- }),
1091
- style: {
1092
- ...e.style,
1093
- "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
1094
- "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
1095
- "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
1096
- "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
1097
- "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
1098
- }
1099
- }
1100
- );
1101
- }
1102
- );
1103
- Ot.displayName = Nt;
1104
- var Po = "DropdownMenuGroup", Ft = a.forwardRef(
1105
- (e, n) => {
1106
- const { __scopeDropdownMenu: t, ...o } = e, r = y(t);
1107
- return /* @__PURE__ */ s(io, { ...r, ...o, ref: n });
1108
- }
1109
- );
1110
- Ft.displayName = Po;
1111
- var Io = "DropdownMenuLabel", yo = a.forwardRef(
1112
- (e, n) => {
1113
- const { __scopeDropdownMenu: t, ...o } = e, r = y(t);
1114
- return /* @__PURE__ */ s(uo, { ...r, ...o, ref: n });
1115
- }
1116
- );
1117
- yo.displayName = Io;
1118
- var Eo = "DropdownMenuItem", kt = a.forwardRef(
1119
- (e, n) => {
1120
- const { __scopeDropdownMenu: t, ...o } = e, r = y(t);
1121
- return /* @__PURE__ */ s(lo, { ...r, ...o, ref: n });
1122
- }
1123
- );
1124
- kt.displayName = Eo;
1125
- var So = "DropdownMenuCheckboxItem", xo = a.forwardRef((e, n) => {
1126
- const { __scopeDropdownMenu: t, ...o } = e, r = y(t);
1127
- return /* @__PURE__ */ s(fo, { ...r, ...o, ref: n });
1128
- });
1129
- xo.displayName = So;
1130
- var bo = "DropdownMenuRadioGroup", Ao = a.forwardRef((e, n) => {
1131
- const { __scopeDropdownMenu: t, ...o } = e, r = y(t);
1132
- return /* @__PURE__ */ s(po, { ...r, ...o, ref: n });
1133
- });
1134
- Ao.displayName = bo;
1135
- var Do = "DropdownMenuRadioItem", To = a.forwardRef((e, n) => {
1136
- const { __scopeDropdownMenu: t, ...o } = e, r = y(t);
1137
- return /* @__PURE__ */ s(mo, { ...r, ...o, ref: n });
1138
- });
1139
- To.displayName = Do;
1140
- var No = "DropdownMenuItemIndicator", Oo = a.forwardRef((e, n) => {
1141
- const { __scopeDropdownMenu: t, ...o } = e, r = y(t);
1142
- return /* @__PURE__ */ s(vo, { ...r, ...o, ref: n });
1143
- });
1144
- Oo.displayName = No;
1145
- var Fo = "DropdownMenuSeparator", Lt = a.forwardRef((e, n) => {
1146
- const { __scopeDropdownMenu: t, ...o } = e, r = y(t);
1147
- return /* @__PURE__ */ s(go, { ...r, ...o, ref: n });
1148
- });
1149
- Lt.displayName = Fo;
1150
- var ko = "DropdownMenuArrow", Lo = a.forwardRef(
1151
- (e, n) => {
1152
- const { __scopeDropdownMenu: t, ...o } = e, r = y(t);
1153
- return /* @__PURE__ */ s(ho, { ...r, ...o, ref: n });
1154
- }
1155
- );
1156
- Lo.displayName = ko;
1157
- var Go = "DropdownMenuSubTrigger", Ko = a.forwardRef((e, n) => {
1158
- const { __scopeDropdownMenu: t, ...o } = e, r = y(t);
1159
- return /* @__PURE__ */ s(wo, { ...r, ...o, ref: n });
1160
- });
1161
- Ko.displayName = Go;
1162
- var $o = "DropdownMenuSubContent", Uo = a.forwardRef((e, n) => {
1163
- const { __scopeDropdownMenu: t, ...o } = e, r = y(t);
1164
- return /* @__PURE__ */ s(
1165
- Mo,
1166
- {
1167
- ...r,
1168
- ...o,
1169
- ref: n,
1170
- style: {
1171
- ...e.style,
1172
- "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
1173
- "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
1174
- "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
1175
- "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
1176
- "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
1177
- }
1178
- }
1179
- );
1180
- });
1181
- Uo.displayName = $o;
1182
- var zo = bt, Zo = Dt, qo = Tt, Jo = Ot, Qo = Ft, er = kt, tr = Lt;
1183
- export {
1184
- Jo as C,
1185
- Qo as G,
1186
- er as I,
1187
- qo as P,
1188
- zo as R,
1189
- tr as S,
1190
- Zo as T
1191
- };