@uva-glass/component-library 1.19.0 → 1.21.0

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 (50) hide show
  1. package/dist/MenuLink-CLEqkVVh.js +865 -0
  2. package/dist/MenuLink-CLEqkVVh.js.map +1 -0
  3. package/dist/ModalDialog-yEr_JLht.js +1276 -0
  4. package/dist/ModalDialog-yEr_JLht.js.map +1 -0
  5. package/dist/_commonjsHelpers-DaMA6jEr.js +9 -0
  6. package/dist/_commonjsHelpers-DaMA6jEr.js.map +1 -0
  7. package/dist/assets/Accordion.css +1 -0
  8. package/dist/assets/Container.css +1 -1
  9. package/dist/assets/ModalDialog.css +1 -0
  10. package/dist/assets/ModalDialog2.css +1 -0
  11. package/dist/components/Accordion/Accordion.d.ts +8 -0
  12. package/dist/components/Accordion/Accordion.js +55 -0
  13. package/dist/components/Accordion/Accordion.js.map +1 -0
  14. package/dist/components/Accordion/Accordion.stories.d.ts +6 -0
  15. package/dist/components/Accordion/Accordion.stories.js +30 -0
  16. package/dist/components/Accordion/Accordion.stories.js.map +1 -0
  17. package/dist/components/Accordion/index.d.ts +1 -0
  18. package/dist/components/Accordion/index.js +5 -0
  19. package/dist/components/Accordion/index.js.map +1 -0
  20. package/dist/components/Button/Button.stories.js +1 -1
  21. package/dist/components/IconButton/IconButton.stories.js +1 -1
  22. package/dist/components/MenuLink/MenuLink.js +1 -1
  23. package/dist/components/MenuLink/MenuLink.stories.js +1 -1
  24. package/dist/components/MenuLink/index.js +1 -1
  25. package/dist/components/ModalDialog/ModalDialog.d.ts +24 -0
  26. package/dist/components/ModalDialog/ModalDialog.js +11 -0
  27. package/dist/components/ModalDialog/ModalDialog.js.map +1 -0
  28. package/dist/components/ModalDialog/ModalDialog.stories.d.ts +6 -0
  29. package/dist/components/ModalDialog/ModalDialog.stories.js +74 -0
  30. package/dist/components/ModalDialog/ModalDialog.stories.js.map +1 -0
  31. package/dist/components/ModalDialog/index.d.ts +1 -0
  32. package/dist/components/ModalDialog/index.js +5 -0
  33. package/dist/components/ModalDialog/index.js.map +1 -0
  34. package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +4 -4
  35. package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js.map +1 -1
  36. package/dist/components/SelectListbox/SelectListBox.stories.js +1 -1
  37. package/dist/components/index.d.ts +2 -0
  38. package/dist/components/index.js +42 -38
  39. package/dist/components/index.js.map +1 -1
  40. package/dist/components/storyComponents/Container/Container.d.ts +2 -1
  41. package/dist/components/storyComponents/Container/Container.js +22 -19
  42. package/dist/components/storyComponents/Container/Container.js.map +1 -1
  43. package/dist/{MenuLink-DDAin3rf.js → index-BA9Z7itR.js} +8080 -8937
  44. package/dist/index-BA9Z7itR.js.map +1 -0
  45. package/dist/{index-Ce_VqA9S.js → index-DFUrxrKJ.js} +910 -913
  46. package/dist/{index-Ce_VqA9S.js.map → index-DFUrxrKJ.js.map} +1 -1
  47. package/dist/index.js +42 -38
  48. package/dist/index.js.map +1 -1
  49. package/package.json +5 -4
  50. package/dist/MenuLink-DDAin3rf.js.map +0 -1
@@ -0,0 +1,1276 @@
1
+ import { jsx as x, Fragment as pe, jsxs as te } from "react/jsx-runtime";
2
+ import p, { useRef as w, useCallback as O, useState as Z, useContext as P, useEffect as F, useMemo as z } from "react";
3
+ import { $ as je } from "./index-BA9Z7itR.js";
4
+ import { c as K } from "./clsx-DB4S2d7J.js";
5
+ import { Backdrop as ze } from "./components/Backdrop/Backdrop.js";
6
+ import { OverlayCloseButton as qe } from "./components/OverlayCloseButton/OverlayCloseButton.js";
7
+ import { Spinner as Ue } from "./components/Spinner/Spinner.js";
8
+ import './assets/ModalDialog2.css';const h = typeof document < "u" ? p.useLayoutEffect : () => {
9
+ };
10
+ function B(e) {
11
+ const t = w(null);
12
+ return h(() => {
13
+ t.current = e;
14
+ }, [
15
+ e
16
+ ]), O((...n) => {
17
+ const r = t.current;
18
+ return r == null ? void 0 : r(...n);
19
+ }, []);
20
+ }
21
+ function Ge(e) {
22
+ let [t, n] = Z(e), r = w(null), o = B(() => {
23
+ if (!r.current)
24
+ return;
25
+ let i = r.current.next();
26
+ if (i.done) {
27
+ r.current = null;
28
+ return;
29
+ }
30
+ t === i.value ? o() : n(i.value);
31
+ });
32
+ h(() => {
33
+ r.current && o();
34
+ });
35
+ let a = B((i) => {
36
+ r.current = i(t), o();
37
+ });
38
+ return [
39
+ t,
40
+ a
41
+ ];
42
+ }
43
+ const q = {
44
+ prefix: String(Math.round(Math.random() * 1e10)),
45
+ current: 0
46
+ }, Se = /* @__PURE__ */ p.createContext(q), Xe = /* @__PURE__ */ p.createContext(!1);
47
+ let Ye = !!(typeof window < "u" && window.document && window.document.createElement), ne = /* @__PURE__ */ new WeakMap();
48
+ function Je(e = !1) {
49
+ let t = P(Se), n = w(null);
50
+ if (n.current === null && !e) {
51
+ var r, o;
52
+ let a = (o = p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || o === void 0 || (r = o.ReactCurrentOwner) === null || r === void 0 ? void 0 : r.current;
53
+ if (a) {
54
+ let i = ne.get(a);
55
+ i == null ? ne.set(a, {
56
+ id: t.current,
57
+ state: a.memoizedState
58
+ }) : a.memoizedState !== i.state && (t.current = i.id, ne.delete(a));
59
+ }
60
+ n.current = ++t.current;
61
+ }
62
+ return n.current;
63
+ }
64
+ function Qe(e) {
65
+ let t = P(Se);
66
+ t === q && !Ye && console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");
67
+ let n = Je(!!e), r = t === q && process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${t.prefix}`;
68
+ return e || `${r}-${n}`;
69
+ }
70
+ function Ze(e) {
71
+ let t = p.useId(), [n] = Z(Le()), r = n || process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${q.prefix}`;
72
+ return e || `${r}-${t}`;
73
+ }
74
+ const et = typeof p.useId == "function" ? Ze : Qe;
75
+ function tt() {
76
+ return !1;
77
+ }
78
+ function nt() {
79
+ return !0;
80
+ }
81
+ function rt(e) {
82
+ return () => {
83
+ };
84
+ }
85
+ function Le() {
86
+ return typeof p.useSyncExternalStore == "function" ? p.useSyncExternalStore(rt, tt, nt) : P(Xe);
87
+ }
88
+ let ot = !!(typeof window < "u" && window.document && window.document.createElement), $e = /* @__PURE__ */ new Map();
89
+ function it(e) {
90
+ let [t, n] = Z(e), r = w(null), o = et(t), a = O((i) => {
91
+ r.current = i;
92
+ }, []);
93
+ return ot && $e.set(o, a), h(() => {
94
+ let i = o;
95
+ return () => {
96
+ $e.delete(i);
97
+ };
98
+ }, [
99
+ o
100
+ ]), F(() => {
101
+ let i = r.current;
102
+ i && (r.current = null, n(i));
103
+ }), o;
104
+ }
105
+ function at(e = []) {
106
+ let t = it(), [n, r] = Ge(t), o = O(() => {
107
+ r(function* () {
108
+ yield t, yield document.getElementById(t) ? t : void 0;
109
+ });
110
+ }, [
111
+ t,
112
+ r
113
+ ]);
114
+ return h(o, [
115
+ t,
116
+ o,
117
+ ...e
118
+ ]), n;
119
+ }
120
+ function ie(...e) {
121
+ return (...t) => {
122
+ for (let n of e)
123
+ typeof n == "function" && n(...t);
124
+ };
125
+ }
126
+ const g = (e) => {
127
+ var t;
128
+ return (t = e == null ? void 0 : e.ownerDocument) !== null && t !== void 0 ? t : document;
129
+ }, U = (e) => e && "window" in e && e.window === e ? e : g(e).defaultView || window, lt = /* @__PURE__ */ new Set([
130
+ "id"
131
+ ]), dt = /* @__PURE__ */ new Set([
132
+ "aria-label",
133
+ "aria-labelledby",
134
+ "aria-describedby",
135
+ "aria-details"
136
+ ]), ut = /* @__PURE__ */ new Set([
137
+ "href",
138
+ "hrefLang",
139
+ "target",
140
+ "rel",
141
+ "download",
142
+ "ping",
143
+ "referrerPolicy"
144
+ ]), ct = /^(data-.*)$/;
145
+ function st(e, t = {}) {
146
+ let { labelable: n, isLink: r, propNames: o } = t, a = {};
147
+ for (const i in e)
148
+ Object.prototype.hasOwnProperty.call(e, i) && (lt.has(i) || n && dt.has(i) || r && ut.has(i) || o != null && o.has(i) || ct.test(i)) && (a[i] = e[i]);
149
+ return a;
150
+ }
151
+ function he(e) {
152
+ if (ft())
153
+ e.focus({
154
+ preventScroll: !0
155
+ });
156
+ else {
157
+ let t = vt(e);
158
+ e.focus(), bt(t);
159
+ }
160
+ }
161
+ let R = null;
162
+ function ft() {
163
+ if (R == null) {
164
+ R = !1;
165
+ try {
166
+ document.createElement("div").focus({
167
+ get preventScroll() {
168
+ return R = !0, !0;
169
+ }
170
+ });
171
+ } catch {
172
+ }
173
+ }
174
+ return R;
175
+ }
176
+ function vt(e) {
177
+ let t = e.parentNode, n = [], r = document.scrollingElement || document.documentElement;
178
+ for (; t instanceof HTMLElement && t !== r; )
179
+ (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && n.push({
180
+ element: t,
181
+ scrollTop: t.scrollTop,
182
+ scrollLeft: t.scrollLeft
183
+ }), t = t.parentNode;
184
+ return r instanceof HTMLElement && n.push({
185
+ element: r,
186
+ scrollTop: r.scrollTop,
187
+ scrollLeft: r.scrollLeft
188
+ }), n;
189
+ }
190
+ function bt(e) {
191
+ for (let { element: t, scrollTop: n, scrollLeft: r } of e)
192
+ t.scrollTop = n, t.scrollLeft = r;
193
+ }
194
+ function mt(e) {
195
+ var t;
196
+ return typeof window > "u" || window.navigator == null ? !1 : ((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.brands.some((n) => e.test(n.brand))) || e.test(window.navigator.userAgent);
197
+ }
198
+ function ce(e) {
199
+ var t;
200
+ return typeof window < "u" && window.navigator != null ? e.test(((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.platform) || window.navigator.platform) : !1;
201
+ }
202
+ function Ne() {
203
+ return ce(/^Mac/i);
204
+ }
205
+ function pt() {
206
+ return ce(/^iPhone/i);
207
+ }
208
+ function $t() {
209
+ return ce(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
210
+ Ne() && navigator.maxTouchPoints > 1;
211
+ }
212
+ function ht() {
213
+ return pt() || $t();
214
+ }
215
+ function gt() {
216
+ return mt(/Android/i);
217
+ }
218
+ let _ = /* @__PURE__ */ new Map(), ae = /* @__PURE__ */ new Set();
219
+ function ge() {
220
+ if (typeof window > "u")
221
+ return;
222
+ function e(r) {
223
+ return "propertyName" in r;
224
+ }
225
+ let t = (r) => {
226
+ if (!e(r) || !r.target)
227
+ return;
228
+ let o = _.get(r.target);
229
+ o || (o = /* @__PURE__ */ new Set(), _.set(r.target, o), r.target.addEventListener("transitioncancel", n, {
230
+ once: !0
231
+ })), o.add(r.propertyName);
232
+ }, n = (r) => {
233
+ if (!e(r) || !r.target)
234
+ return;
235
+ let o = _.get(r.target);
236
+ if (o && (o.delete(r.propertyName), o.size === 0 && (r.target.removeEventListener("transitioncancel", n), _.delete(r.target)), _.size === 0)) {
237
+ for (let a of ae)
238
+ a();
239
+ ae.clear();
240
+ }
241
+ };
242
+ document.body.addEventListener("transitionrun", t), document.body.addEventListener("transitionend", n);
243
+ }
244
+ typeof document < "u" && (document.readyState !== "loading" ? ge() : document.addEventListener("DOMContentLoaded", ge));
245
+ function Et(e) {
246
+ requestAnimationFrame(() => {
247
+ _.size === 0 ? e() : ae.add(e);
248
+ });
249
+ }
250
+ function Ee(e, t) {
251
+ let n = window.getComputedStyle(e), r = /(auto|scroll)/.test(n.overflow + n.overflowX + n.overflowY);
252
+ return r && t && (r = e.scrollHeight !== e.clientHeight || e.scrollWidth !== e.clientWidth), r;
253
+ }
254
+ function Pe(e, t) {
255
+ let n = e;
256
+ for (Ee(n, t) && (n = n.parentElement); n && !Ee(n, t); )
257
+ n = n.parentElement;
258
+ return n || document.scrollingElement || document.documentElement;
259
+ }
260
+ function wt(e) {
261
+ return e.mozInputSource === 0 && e.isTrusted ? !0 : gt() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
262
+ }
263
+ class yt {
264
+ isDefaultPrevented() {
265
+ return this.nativeEvent.defaultPrevented;
266
+ }
267
+ preventDefault() {
268
+ this.defaultPrevented = !0, this.nativeEvent.preventDefault();
269
+ }
270
+ stopPropagation() {
271
+ this.nativeEvent.stopPropagation(), this.isPropagationStopped = () => !0;
272
+ }
273
+ isPropagationStopped() {
274
+ return !1;
275
+ }
276
+ persist() {
277
+ }
278
+ constructor(t, n) {
279
+ this.nativeEvent = n, this.target = n.target, this.currentTarget = n.currentTarget, this.relatedTarget = n.relatedTarget, this.bubbles = n.bubbles, this.cancelable = n.cancelable, this.defaultPrevented = n.defaultPrevented, this.eventPhase = n.eventPhase, this.isTrusted = n.isTrusted, this.timeStamp = n.timeStamp, this.type = t;
280
+ }
281
+ }
282
+ function Tt(e) {
283
+ let t = w({
284
+ isFocused: !1,
285
+ observer: null
286
+ });
287
+ h(() => {
288
+ const r = t.current;
289
+ return () => {
290
+ r.observer && (r.observer.disconnect(), r.observer = null);
291
+ };
292
+ }, []);
293
+ let n = B((r) => {
294
+ e == null || e(r);
295
+ });
296
+ return O((r) => {
297
+ if (r.target instanceof HTMLButtonElement || r.target instanceof HTMLInputElement || r.target instanceof HTMLTextAreaElement || r.target instanceof HTMLSelectElement) {
298
+ t.current.isFocused = !0;
299
+ let o = r.target, a = (i) => {
300
+ t.current.isFocused = !1, o.disabled && n(new yt("blur", i)), t.current.observer && (t.current.observer.disconnect(), t.current.observer = null);
301
+ };
302
+ o.addEventListener("focusout", a, {
303
+ once: !0
304
+ }), t.current.observer = new MutationObserver(() => {
305
+ if (t.current.isFocused && o.disabled) {
306
+ var i;
307
+ (i = t.current.observer) === null || i === void 0 || i.disconnect();
308
+ let l = o === document.activeElement ? null : document.activeElement;
309
+ o.dispatchEvent(new FocusEvent("blur", {
310
+ relatedTarget: l
311
+ })), o.dispatchEvent(new FocusEvent("focusout", {
312
+ bubbles: !0,
313
+ relatedTarget: l
314
+ }));
315
+ }
316
+ }), t.current.observer.observe(o, {
317
+ attributes: !0,
318
+ attributeFilter: [
319
+ "disabled"
320
+ ]
321
+ });
322
+ }
323
+ }, [
324
+ n
325
+ ]);
326
+ }
327
+ let H = null, xt = /* @__PURE__ */ new Set(), I = /* @__PURE__ */ new Map(), M = !1, le = !1;
328
+ function se(e, t) {
329
+ for (let n of xt)
330
+ n(e, t);
331
+ }
332
+ function St(e) {
333
+ return !(e.metaKey || !Ne() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
334
+ }
335
+ function G(e) {
336
+ M = !0, St(e) && (H = "keyboard", se("keyboard", e));
337
+ }
338
+ function T(e) {
339
+ H = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (M = !0, se("pointer", e));
340
+ }
341
+ function Ce(e) {
342
+ wt(e) && (M = !0, H = "virtual");
343
+ }
344
+ function De(e) {
345
+ e.target === window || e.target === document || (!M && !le && (H = "virtual", se("virtual", e)), M = !1, le = !1);
346
+ }
347
+ function Me() {
348
+ M = !1, le = !0;
349
+ }
350
+ function we(e) {
351
+ if (typeof window > "u" || I.get(U(e)))
352
+ return;
353
+ const t = U(e), n = g(e);
354
+ let r = t.HTMLElement.prototype.focus;
355
+ t.HTMLElement.prototype.focus = function() {
356
+ M = !0, r.apply(this, arguments);
357
+ }, n.addEventListener("keydown", G, !0), n.addEventListener("keyup", G, !0), n.addEventListener("click", Ce, !0), t.addEventListener("focus", De, !0), t.addEventListener("blur", Me, !1), typeof PointerEvent < "u" ? (n.addEventListener("pointerdown", T, !0), n.addEventListener("pointermove", T, !0), n.addEventListener("pointerup", T, !0)) : (n.addEventListener("mousedown", T, !0), n.addEventListener("mousemove", T, !0), n.addEventListener("mouseup", T, !0)), t.addEventListener("beforeunload", () => {
358
+ Fe(e);
359
+ }, {
360
+ once: !0
361
+ }), I.set(t, {
362
+ focus: r
363
+ });
364
+ }
365
+ const Fe = (e, t) => {
366
+ const n = U(e), r = g(e);
367
+ t && r.removeEventListener("DOMContentLoaded", t), I.has(n) && (n.HTMLElement.prototype.focus = I.get(n).focus, r.removeEventListener("keydown", G, !0), r.removeEventListener("keyup", G, !0), r.removeEventListener("click", Ce, !0), n.removeEventListener("focus", De, !0), n.removeEventListener("blur", Me, !1), typeof PointerEvent < "u" ? (r.removeEventListener("pointerdown", T, !0), r.removeEventListener("pointermove", T, !0), r.removeEventListener("pointerup", T, !0)) : (r.removeEventListener("mousedown", T, !0), r.removeEventListener("mousemove", T, !0), r.removeEventListener("mouseup", T, !0)), I.delete(n));
368
+ };
369
+ function Lt(e) {
370
+ const t = g(e);
371
+ let n;
372
+ return t.readyState !== "loading" ? we(e) : (n = () => {
373
+ we(e);
374
+ }, t.addEventListener("DOMContentLoaded", n)), () => Fe(e, n);
375
+ }
376
+ typeof document < "u" && Lt();
377
+ function Nt() {
378
+ return H;
379
+ }
380
+ function Pt(e) {
381
+ let { isDisabled: t, onBlurWithin: n, onFocusWithin: r, onFocusWithinChange: o } = e, a = w({
382
+ isFocusWithin: !1
383
+ }), i = O((u) => {
384
+ a.current.isFocusWithin && !u.currentTarget.contains(u.relatedTarget) && (a.current.isFocusWithin = !1, n && n(u), o && o(!1));
385
+ }, [
386
+ n,
387
+ o,
388
+ a
389
+ ]), l = Tt(i), c = O((u) => {
390
+ !a.current.isFocusWithin && document.activeElement === u.target && (r && r(u), o && o(!0), a.current.isFocusWithin = !0, l(u));
391
+ }, [
392
+ r,
393
+ o,
394
+ l
395
+ ]);
396
+ return t ? {
397
+ focusWithinProps: {
398
+ // These should not have been null, that would conflict in mergeProps
399
+ onFocus: void 0,
400
+ onBlur: void 0
401
+ }
402
+ } : {
403
+ focusWithinProps: {
404
+ onFocus: c,
405
+ onBlur: i
406
+ }
407
+ };
408
+ }
409
+ function Ct(e) {
410
+ let { ref: t, onInteractOutside: n, isDisabled: r, onInteractOutsideStart: o } = e, a = w({
411
+ isPointerDown: !1,
412
+ ignoreEmulatedMouseEvents: !1
413
+ }), i = B((c) => {
414
+ n && V(c, t) && (o && o(c), a.current.isPointerDown = !0);
415
+ }), l = B((c) => {
416
+ n && n(c);
417
+ });
418
+ F(() => {
419
+ let c = a.current;
420
+ if (r)
421
+ return;
422
+ const u = t.current, d = g(u);
423
+ if (typeof PointerEvent < "u") {
424
+ let f = (b) => {
425
+ c.isPointerDown && V(b, t) && l(b), c.isPointerDown = !1;
426
+ };
427
+ return d.addEventListener("pointerdown", i, !0), d.addEventListener("pointerup", f, !0), () => {
428
+ d.removeEventListener("pointerdown", i, !0), d.removeEventListener("pointerup", f, !0);
429
+ };
430
+ } else {
431
+ let f = (v) => {
432
+ c.ignoreEmulatedMouseEvents ? c.ignoreEmulatedMouseEvents = !1 : c.isPointerDown && V(v, t) && l(v), c.isPointerDown = !1;
433
+ }, b = (v) => {
434
+ c.ignoreEmulatedMouseEvents = !0, c.isPointerDown && V(v, t) && l(v), c.isPointerDown = !1;
435
+ };
436
+ return d.addEventListener("mousedown", i, !0), d.addEventListener("mouseup", f, !0), d.addEventListener("touchstart", i, !0), d.addEventListener("touchend", b, !0), () => {
437
+ d.removeEventListener("mousedown", i, !0), d.removeEventListener("mouseup", f, !0), d.removeEventListener("touchstart", i, !0), d.removeEventListener("touchend", b, !0);
438
+ };
439
+ }
440
+ }, [
441
+ t,
442
+ r,
443
+ i,
444
+ l
445
+ ]);
446
+ }
447
+ function V(e, t) {
448
+ if (e.button > 0)
449
+ return !1;
450
+ if (e.target) {
451
+ const n = e.target.ownerDocument;
452
+ if (!n || !n.documentElement.contains(e.target) || e.target.closest("[data-react-aria-top-layer]"))
453
+ return !1;
454
+ }
455
+ return t.current && !t.current.contains(e.target);
456
+ }
457
+ function de(e) {
458
+ const t = g(e);
459
+ if (Nt() === "virtual") {
460
+ let n = t.activeElement;
461
+ Et(() => {
462
+ t.activeElement === n && e.isConnected && he(e);
463
+ });
464
+ } else
465
+ he(e);
466
+ }
467
+ function Dt(e) {
468
+ const t = U(e);
469
+ if (!(e instanceof t.HTMLElement) && !(e instanceof t.SVGElement))
470
+ return !1;
471
+ let { display: n, visibility: r } = e.style, o = n !== "none" && r !== "hidden" && r !== "collapse";
472
+ if (o) {
473
+ const { getComputedStyle: a } = e.ownerDocument.defaultView;
474
+ let { display: i, visibility: l } = a(e);
475
+ o = i !== "none" && l !== "hidden" && l !== "collapse";
476
+ }
477
+ return o;
478
+ }
479
+ function Mt(e, t) {
480
+ return !e.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
481
+ !e.hasAttribute("data-react-aria-prevent-focus") && (e.nodeName === "DETAILS" && t && t.nodeName !== "SUMMARY" ? e.hasAttribute("open") : !0);
482
+ }
483
+ function _e(e, t) {
484
+ return e.nodeName !== "#comment" && Dt(e) && Mt(e, t) && (!e.parentElement || _e(e.parentElement, e));
485
+ }
486
+ const ye = /* @__PURE__ */ p.createContext(null);
487
+ let m = null;
488
+ function Ft(e) {
489
+ let { children: t, contain: n, restoreFocus: r, autoFocus: o } = e, a = w(null), i = w(null), l = w([]), { parentNode: c } = P(ye) || {}, u = z(() => new ue({
490
+ scopeRef: l
491
+ }), [
492
+ l
493
+ ]);
494
+ h(() => {
495
+ let b = c || $.root;
496
+ if ($.getTreeNode(b.scopeRef) && m && !Y(m, b.scopeRef)) {
497
+ let v = $.getTreeNode(m);
498
+ v && (b = v);
499
+ }
500
+ b.addChild(u), $.addNode(u);
501
+ }, [
502
+ u,
503
+ c
504
+ ]), h(() => {
505
+ let b = $.getTreeNode(l);
506
+ b && (b.contain = !!n);
507
+ }, [
508
+ n
509
+ ]), h(() => {
510
+ var b;
511
+ let v = (b = a.current) === null || b === void 0 ? void 0 : b.nextSibling, s = [];
512
+ for (; v && v !== i.current; )
513
+ s.push(v), v = v.nextSibling;
514
+ l.current = s;
515
+ }, [
516
+ t
517
+ ]), Bt(l, r, n), At(l, n), Kt(l, r, n), It(l, o), F(() => {
518
+ const b = g(l.current ? l.current[0] : void 0).activeElement;
519
+ let v = null;
520
+ if (E(b, l.current)) {
521
+ for (let s of $.traverse())
522
+ s.scopeRef && E(b, s.scopeRef.current) && (v = s);
523
+ v === $.getTreeNode(l) && (m = v.scopeRef);
524
+ }
525
+ }, [
526
+ l
527
+ ]), h(() => () => {
528
+ var b, v, s;
529
+ let C = (s = (v = $.getTreeNode(l)) === null || v === void 0 || (b = v.parent) === null || b === void 0 ? void 0 : b.scopeRef) !== null && s !== void 0 ? s : null;
530
+ (l === m || Y(l, m)) && (!C || $.getTreeNode(C)) && (m = C), $.removeTreeNode(l);
531
+ }, [
532
+ l
533
+ ]);
534
+ let d = z(() => _t(l), []), f = z(() => ({
535
+ focusManager: d,
536
+ parentNode: u
537
+ }), [
538
+ u,
539
+ d
540
+ ]);
541
+ return /* @__PURE__ */ p.createElement(ye.Provider, {
542
+ value: f
543
+ }, /* @__PURE__ */ p.createElement("span", {
544
+ "data-focus-scope-start": !0,
545
+ hidden: !0,
546
+ ref: a
547
+ }), t, /* @__PURE__ */ p.createElement("span", {
548
+ "data-focus-scope-end": !0,
549
+ hidden: !0,
550
+ ref: i
551
+ }));
552
+ }
553
+ function _t(e) {
554
+ return {
555
+ focusNext(t = {}) {
556
+ let n = e.current, { from: r, tabbable: o, wrap: a, accept: i } = t, l = r || g(n[0]).activeElement, c = n[0].previousElementSibling, u = D(n), d = N(u, {
557
+ tabbable: o,
558
+ accept: i
559
+ }, n);
560
+ d.currentNode = E(l, n) ? l : c;
561
+ let f = d.nextNode();
562
+ return !f && a && (d.currentNode = c, f = d.nextNode()), f && L(f, !0), f;
563
+ },
564
+ focusPrevious(t = {}) {
565
+ let n = e.current, { from: r, tabbable: o, wrap: a, accept: i } = t, l = r || g(n[0]).activeElement, c = n[n.length - 1].nextElementSibling, u = D(n), d = N(u, {
566
+ tabbable: o,
567
+ accept: i
568
+ }, n);
569
+ d.currentNode = E(l, n) ? l : c;
570
+ let f = d.previousNode();
571
+ return !f && a && (d.currentNode = c, f = d.previousNode()), f && L(f, !0), f;
572
+ },
573
+ focusFirst(t = {}) {
574
+ let n = e.current, { tabbable: r, accept: o } = t, a = D(n), i = N(a, {
575
+ tabbable: r,
576
+ accept: o
577
+ }, n);
578
+ i.currentNode = n[0].previousElementSibling;
579
+ let l = i.nextNode();
580
+ return l && L(l, !0), l;
581
+ },
582
+ focusLast(t = {}) {
583
+ let n = e.current, { tabbable: r, accept: o } = t, a = D(n), i = N(a, {
584
+ tabbable: r,
585
+ accept: o
586
+ }, n);
587
+ i.currentNode = n[n.length - 1].nextElementSibling;
588
+ let l = i.previousNode();
589
+ return l && L(l, !0), l;
590
+ }
591
+ };
592
+ }
593
+ const fe = [
594
+ "input:not([disabled]):not([type=hidden])",
595
+ "select:not([disabled])",
596
+ "textarea:not([disabled])",
597
+ "button:not([disabled])",
598
+ "a[href]",
599
+ "area[href]",
600
+ "summary",
601
+ "iframe",
602
+ "object",
603
+ "embed",
604
+ "audio[controls]",
605
+ "video[controls]",
606
+ "[contenteditable]"
607
+ ], kt = fe.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
608
+ fe.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
609
+ const Ot = fe.join(':not([hidden]):not([tabindex="-1"]),');
610
+ function D(e) {
611
+ return e[0].parentElement;
612
+ }
613
+ function W(e) {
614
+ let t = $.getTreeNode(m);
615
+ for (; t && t.scopeRef !== e; ) {
616
+ if (t.contain)
617
+ return !1;
618
+ t = t.parent;
619
+ }
620
+ return !0;
621
+ }
622
+ function At(e, t) {
623
+ let n = w(), r = w();
624
+ h(() => {
625
+ let o = e.current;
626
+ if (!t) {
627
+ r.current && (cancelAnimationFrame(r.current), r.current = void 0);
628
+ return;
629
+ }
630
+ const a = g(o ? o[0] : void 0);
631
+ let i = (u) => {
632
+ if (u.key !== "Tab" || u.altKey || u.ctrlKey || u.metaKey || !W(e) || u.isComposing)
633
+ return;
634
+ let d = a.activeElement, f = e.current;
635
+ if (!f || !E(d, f))
636
+ return;
637
+ let b = D(f), v = N(b, {
638
+ tabbable: !0
639
+ }, f);
640
+ if (!d)
641
+ return;
642
+ v.currentNode = d;
643
+ let s = u.shiftKey ? v.previousNode() : v.nextNode();
644
+ s || (v.currentNode = u.shiftKey ? f[f.length - 1].nextElementSibling : f[0].previousElementSibling, s = u.shiftKey ? v.previousNode() : v.nextNode()), u.preventDefault(), s && L(s, !0);
645
+ }, l = (u) => {
646
+ (!m || Y(m, e)) && E(u.target, e.current) ? (m = e, n.current = u.target) : W(e) && !X(u.target, e) ? n.current ? n.current.focus() : m && m.current && J(m.current) : W(e) && (n.current = u.target);
647
+ }, c = (u) => {
648
+ r.current && cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
649
+ if (a.activeElement && W(e) && !X(a.activeElement, e))
650
+ if (m = e, a.body.contains(u.target)) {
651
+ var d;
652
+ n.current = u.target, (d = n.current) === null || d === void 0 || d.focus();
653
+ } else
654
+ m.current && J(m.current);
655
+ });
656
+ };
657
+ return a.addEventListener("keydown", i, !1), a.addEventListener("focusin", l, !1), o == null || o.forEach((u) => u.addEventListener("focusin", l, !1)), o == null || o.forEach((u) => u.addEventListener("focusout", c, !1)), () => {
658
+ a.removeEventListener("keydown", i, !1), a.removeEventListener("focusin", l, !1), o == null || o.forEach((u) => u.removeEventListener("focusin", l, !1)), o == null || o.forEach((u) => u.removeEventListener("focusout", c, !1));
659
+ };
660
+ }, [
661
+ e,
662
+ t
663
+ ]), h(() => () => {
664
+ r.current && cancelAnimationFrame(r.current);
665
+ }, [
666
+ r
667
+ ]);
668
+ }
669
+ function ke(e) {
670
+ return X(e);
671
+ }
672
+ function E(e, t) {
673
+ return !e || !t ? !1 : t.some((n) => n.contains(e));
674
+ }
675
+ function X(e, t = null) {
676
+ if (e instanceof Element && e.closest("[data-react-aria-top-layer]"))
677
+ return !0;
678
+ for (let { scopeRef: n } of $.traverse($.getTreeNode(t)))
679
+ if (n && E(e, n.current))
680
+ return !0;
681
+ return !1;
682
+ }
683
+ function Wt(e) {
684
+ return X(e, m);
685
+ }
686
+ function Y(e, t) {
687
+ var n;
688
+ let r = (n = $.getTreeNode(t)) === null || n === void 0 ? void 0 : n.parent;
689
+ for (; r; ) {
690
+ if (r.scopeRef === e)
691
+ return !0;
692
+ r = r.parent;
693
+ }
694
+ return !1;
695
+ }
696
+ function L(e, t = !1) {
697
+ if (e != null && !t)
698
+ try {
699
+ de(e);
700
+ } catch {
701
+ }
702
+ else if (e != null)
703
+ try {
704
+ e.focus();
705
+ } catch {
706
+ }
707
+ }
708
+ function J(e, t = !0) {
709
+ let n = e[0].previousElementSibling, r = D(e), o = N(r, {
710
+ tabbable: t
711
+ }, e);
712
+ o.currentNode = n;
713
+ let a = o.nextNode();
714
+ t && !a && (r = D(e), o = N(r, {
715
+ tabbable: !1
716
+ }, e), o.currentNode = n, a = o.nextNode()), L(a);
717
+ }
718
+ function It(e, t) {
719
+ const n = p.useRef(t);
720
+ F(() => {
721
+ if (n.current) {
722
+ m = e;
723
+ const r = g(e.current ? e.current[0] : void 0);
724
+ !E(r.activeElement, m.current) && e.current && J(e.current);
725
+ }
726
+ n.current = !1;
727
+ }, [
728
+ e
729
+ ]);
730
+ }
731
+ function Bt(e, t, n) {
732
+ h(() => {
733
+ if (t || n)
734
+ return;
735
+ let r = e.current;
736
+ const o = g(r ? r[0] : void 0);
737
+ let a = (i) => {
738
+ let l = i.target;
739
+ E(l, e.current) ? m = e : ke(l) || (m = null);
740
+ };
741
+ return o.addEventListener("focusin", a, !1), r == null || r.forEach((i) => i.addEventListener("focusin", a, !1)), () => {
742
+ o.removeEventListener("focusin", a, !1), r == null || r.forEach((i) => i.removeEventListener("focusin", a, !1));
743
+ };
744
+ }, [
745
+ e,
746
+ t,
747
+ n
748
+ ]);
749
+ }
750
+ function Ht(e) {
751
+ let t = $.getTreeNode(m);
752
+ for (; t && t.scopeRef !== e; ) {
753
+ if (t.nodeToRestore)
754
+ return !1;
755
+ t = t.parent;
756
+ }
757
+ return (t == null ? void 0 : t.scopeRef) === e;
758
+ }
759
+ function Kt(e, t, n) {
760
+ const r = w(typeof document < "u" ? g(e.current ? e.current[0] : void 0).activeElement : null);
761
+ h(() => {
762
+ let o = e.current;
763
+ const a = g(o ? o[0] : void 0);
764
+ if (!t || n)
765
+ return;
766
+ let i = () => {
767
+ (!m || Y(m, e)) && E(a.activeElement, e.current) && (m = e);
768
+ };
769
+ return a.addEventListener("focusin", i, !1), o == null || o.forEach((l) => l.addEventListener("focusin", i, !1)), () => {
770
+ a.removeEventListener("focusin", i, !1), o == null || o.forEach((l) => l.removeEventListener("focusin", i, !1));
771
+ };
772
+ }, [
773
+ e,
774
+ n
775
+ ]), h(() => {
776
+ const o = g(e.current ? e.current[0] : void 0);
777
+ if (!t)
778
+ return;
779
+ let a = (i) => {
780
+ if (i.key !== "Tab" || i.altKey || i.ctrlKey || i.metaKey || !W(e) || i.isComposing)
781
+ return;
782
+ let l = o.activeElement;
783
+ if (!E(l, e.current))
784
+ return;
785
+ let c = $.getTreeNode(e);
786
+ if (!c)
787
+ return;
788
+ let u = c.nodeToRestore, d = N(o.body, {
789
+ tabbable: !0
790
+ });
791
+ d.currentNode = l;
792
+ let f = i.shiftKey ? d.previousNode() : d.nextNode();
793
+ if ((!u || !o.body.contains(u) || u === o.body) && (u = void 0, c.nodeToRestore = void 0), (!f || !E(f, e.current)) && u) {
794
+ d.currentNode = u;
795
+ do
796
+ f = i.shiftKey ? d.previousNode() : d.nextNode();
797
+ while (E(f, e.current));
798
+ i.preventDefault(), i.stopPropagation(), f ? L(f, !0) : ke(u) ? L(u, !0) : l.blur();
799
+ }
800
+ };
801
+ return n || o.addEventListener("keydown", a, !0), () => {
802
+ n || o.removeEventListener("keydown", a, !0);
803
+ };
804
+ }, [
805
+ e,
806
+ t,
807
+ n
808
+ ]), h(() => {
809
+ const o = g(e.current ? e.current[0] : void 0);
810
+ if (!t)
811
+ return;
812
+ let a = $.getTreeNode(e);
813
+ if (a) {
814
+ var i;
815
+ return a.nodeToRestore = (i = r.current) !== null && i !== void 0 ? i : void 0, () => {
816
+ let l = $.getTreeNode(e);
817
+ if (!l)
818
+ return;
819
+ let c = l.nodeToRestore;
820
+ if (t && c && // eslint-disable-next-line react-hooks/exhaustive-deps
821
+ (E(o.activeElement, e.current) || o.activeElement === o.body && Ht(e))) {
822
+ let u = $.clone();
823
+ requestAnimationFrame(() => {
824
+ if (o.activeElement === o.body) {
825
+ let d = u.getTreeNode(e);
826
+ for (; d; ) {
827
+ if (d.nodeToRestore && d.nodeToRestore.isConnected) {
828
+ L(d.nodeToRestore);
829
+ return;
830
+ }
831
+ d = d.parent;
832
+ }
833
+ for (d = u.getTreeNode(e); d; ) {
834
+ if (d.scopeRef && d.scopeRef.current && $.getTreeNode(d.scopeRef)) {
835
+ J(d.scopeRef.current, !0);
836
+ return;
837
+ }
838
+ d = d.parent;
839
+ }
840
+ }
841
+ });
842
+ }
843
+ };
844
+ }
845
+ }, [
846
+ e,
847
+ t
848
+ ]);
849
+ }
850
+ function N(e, t, n) {
851
+ let r = t != null && t.tabbable ? Ot : kt, o = g(e).createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
852
+ acceptNode(a) {
853
+ var i;
854
+ return !(t == null || (i = t.from) === null || i === void 0) && i.contains(a) ? NodeFilter.FILTER_REJECT : a.matches(r) && _e(a) && (!n || E(a, n)) && (!(t != null && t.accept) || t.accept(a)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
855
+ }
856
+ });
857
+ return t != null && t.from && (o.currentNode = t.from), o;
858
+ }
859
+ class ve {
860
+ get size() {
861
+ return this.fastMap.size;
862
+ }
863
+ getTreeNode(t) {
864
+ return this.fastMap.get(t);
865
+ }
866
+ addTreeNode(t, n, r) {
867
+ let o = this.fastMap.get(n ?? null);
868
+ if (!o)
869
+ return;
870
+ let a = new ue({
871
+ scopeRef: t
872
+ });
873
+ o.addChild(a), a.parent = o, this.fastMap.set(t, a), r && (a.nodeToRestore = r);
874
+ }
875
+ addNode(t) {
876
+ this.fastMap.set(t.scopeRef, t);
877
+ }
878
+ removeTreeNode(t) {
879
+ if (t === null)
880
+ return;
881
+ let n = this.fastMap.get(t);
882
+ if (!n)
883
+ return;
884
+ let r = n.parent;
885
+ for (let a of this.traverse())
886
+ a !== n && n.nodeToRestore && a.nodeToRestore && n.scopeRef && n.scopeRef.current && E(a.nodeToRestore, n.scopeRef.current) && (a.nodeToRestore = n.nodeToRestore);
887
+ let o = n.children;
888
+ r && (r.removeChild(n), o.size > 0 && o.forEach((a) => r && r.addChild(a))), this.fastMap.delete(n.scopeRef);
889
+ }
890
+ // Pre Order Depth First
891
+ *traverse(t = this.root) {
892
+ if (t.scopeRef != null && (yield t), t.children.size > 0)
893
+ for (let n of t.children)
894
+ yield* this.traverse(n);
895
+ }
896
+ clone() {
897
+ var t;
898
+ let n = new ve();
899
+ var r;
900
+ for (let o of this.traverse())
901
+ n.addTreeNode(o.scopeRef, (r = (t = o.parent) === null || t === void 0 ? void 0 : t.scopeRef) !== null && r !== void 0 ? r : null, o.nodeToRestore);
902
+ return n;
903
+ }
904
+ constructor() {
905
+ this.fastMap = /* @__PURE__ */ new Map(), this.root = new ue({
906
+ scopeRef: null
907
+ }), this.fastMap.set(null, this.root);
908
+ }
909
+ }
910
+ class ue {
911
+ addChild(t) {
912
+ this.children.add(t), t.parent = this;
913
+ }
914
+ removeChild(t) {
915
+ this.children.delete(t), t.parent = void 0;
916
+ }
917
+ constructor(t) {
918
+ this.children = /* @__PURE__ */ new Set(), this.contain = !1, this.scopeRef = t.scopeRef;
919
+ }
920
+ }
921
+ let $ = new ve();
922
+ const S = [];
923
+ function Rt(e, t) {
924
+ let { onClose: n, shouldCloseOnBlur: r, isOpen: o, isDismissable: a = !1, isKeyboardDismissDisabled: i = !1, shouldCloseOnInteractOutside: l } = e;
925
+ F(() => (o && S.push(t), () => {
926
+ let s = S.indexOf(t);
927
+ s >= 0 && S.splice(s, 1);
928
+ }), [
929
+ o,
930
+ t
931
+ ]);
932
+ let c = () => {
933
+ S[S.length - 1] === t && n && n();
934
+ }, u = (s) => {
935
+ (!l || l(s.target)) && S[S.length - 1] === t && (s.stopPropagation(), s.preventDefault());
936
+ }, d = (s) => {
937
+ (!l || l(s.target)) && (S[S.length - 1] === t && (s.stopPropagation(), s.preventDefault()), c());
938
+ }, f = (s) => {
939
+ s.key === "Escape" && !i && !s.nativeEvent.isComposing && (s.stopPropagation(), s.preventDefault(), c());
940
+ };
941
+ Ct({
942
+ ref: t,
943
+ onInteractOutside: a && o ? d : null,
944
+ onInteractOutsideStart: u
945
+ });
946
+ let { focusWithinProps: b } = Pt({
947
+ isDisabled: !r,
948
+ onBlurWithin: (s) => {
949
+ !s.relatedTarget || Wt(s.relatedTarget) || (!l || l(s.relatedTarget)) && n();
950
+ }
951
+ }), v = (s) => {
952
+ s.target === s.currentTarget && s.preventDefault();
953
+ };
954
+ return {
955
+ overlayProps: {
956
+ onKeyDown: f,
957
+ ...b
958
+ },
959
+ underlayProps: {
960
+ onPointerDown: v
961
+ }
962
+ };
963
+ }
964
+ const re = typeof document < "u" && window.visualViewport, Vt = /* @__PURE__ */ new Set([
965
+ "checkbox",
966
+ "radio",
967
+ "range",
968
+ "color",
969
+ "file",
970
+ "image",
971
+ "button",
972
+ "submit",
973
+ "reset"
974
+ ]);
975
+ let j = 0, oe;
976
+ function jt(e = {}) {
977
+ let { isDisabled: t } = e;
978
+ h(() => {
979
+ if (!t)
980
+ return j++, j === 1 && (ht() ? oe = qt() : oe = zt()), () => {
981
+ j--, j === 0 && oe();
982
+ };
983
+ }, [
984
+ t
985
+ ]);
986
+ }
987
+ function zt() {
988
+ return ie(k(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), k(document.documentElement, "overflow", "hidden"));
989
+ }
990
+ function qt() {
991
+ let e, t, n = (u) => {
992
+ e = Pe(u.target, !0), !(e === document.documentElement && e === document.body) && e instanceof HTMLElement && window.getComputedStyle(e).overscrollBehavior === "auto" && (t = k(e, "overscrollBehavior", "contain"));
993
+ }, r = (u) => {
994
+ if (!e || e === document.documentElement || e === document.body) {
995
+ u.preventDefault();
996
+ return;
997
+ }
998
+ e.scrollHeight === e.clientHeight && e.scrollWidth === e.clientWidth && u.preventDefault();
999
+ }, o = (u) => {
1000
+ let d = u.target;
1001
+ xe(d) && d !== document.activeElement && (u.preventDefault(), l(), d.style.transform = "translateY(-2000px)", d.focus(), requestAnimationFrame(() => {
1002
+ d.style.transform = "";
1003
+ })), t && t();
1004
+ }, a = (u) => {
1005
+ let d = u.target;
1006
+ xe(d) && (l(), d.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
1007
+ d.style.transform = "", re && (re.height < window.innerHeight ? requestAnimationFrame(() => {
1008
+ Te(d);
1009
+ }) : re.addEventListener("resize", () => Te(d), {
1010
+ once: !0
1011
+ }));
1012
+ }));
1013
+ }, i = null, l = () => {
1014
+ if (i)
1015
+ return;
1016
+ let u = () => {
1017
+ window.scrollTo(0, 0);
1018
+ }, d = window.pageXOffset, f = window.pageYOffset;
1019
+ i = ie(A(window, "scroll", u), k(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), k(document.documentElement, "overflow", "hidden"), k(document.body, "marginTop", `-${f}px`), () => {
1020
+ window.scrollTo(d, f);
1021
+ }), window.scrollTo(0, 0);
1022
+ }, c = ie(A(document, "touchstart", n, {
1023
+ passive: !1,
1024
+ capture: !0
1025
+ }), A(document, "touchmove", r, {
1026
+ passive: !1,
1027
+ capture: !0
1028
+ }), A(document, "touchend", o, {
1029
+ passive: !1,
1030
+ capture: !0
1031
+ }), A(document, "focus", a, !0));
1032
+ return () => {
1033
+ t == null || t(), i == null || i(), c();
1034
+ };
1035
+ }
1036
+ function k(e, t, n) {
1037
+ let r = e.style[t];
1038
+ return e.style[t] = n, () => {
1039
+ e.style[t] = r;
1040
+ };
1041
+ }
1042
+ function A(e, t, n, r) {
1043
+ return e.addEventListener(t, n, r), () => {
1044
+ e.removeEventListener(t, n, r);
1045
+ };
1046
+ }
1047
+ function Te(e) {
1048
+ let t = document.scrollingElement || document.documentElement;
1049
+ for (; e && e !== t; ) {
1050
+ let n = Pe(e);
1051
+ if (n !== document.documentElement && n !== document.body && n !== e) {
1052
+ let r = n.getBoundingClientRect().top, o = e.getBoundingClientRect().top;
1053
+ o > r + e.clientHeight && (n.scrollTop += o - r);
1054
+ }
1055
+ e = n.parentElement;
1056
+ }
1057
+ }
1058
+ function xe(e) {
1059
+ return e instanceof HTMLInputElement && !Vt.has(e.type) || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable;
1060
+ }
1061
+ const Q = /* @__PURE__ */ p.createContext(null);
1062
+ function Ut(e) {
1063
+ let { children: t } = e, n = P(Q), [r, o] = Z(0), a = z(() => ({
1064
+ parent: n,
1065
+ modalCount: r,
1066
+ addModal() {
1067
+ o((i) => i + 1), n && n.addModal();
1068
+ },
1069
+ removeModal() {
1070
+ o((i) => i - 1), n && n.removeModal();
1071
+ }
1072
+ }), [
1073
+ n,
1074
+ r
1075
+ ]);
1076
+ return /* @__PURE__ */ p.createElement(Q.Provider, {
1077
+ value: a
1078
+ }, t);
1079
+ }
1080
+ function Gt() {
1081
+ let e = P(Q);
1082
+ return {
1083
+ modalProviderProps: {
1084
+ "aria-hidden": e && e.modalCount > 0 ? !0 : null
1085
+ }
1086
+ };
1087
+ }
1088
+ function Xt(e) {
1089
+ let { modalProviderProps: t } = Gt();
1090
+ return /* @__PURE__ */ p.createElement("div", {
1091
+ "data-overlay-container": !0,
1092
+ ...e,
1093
+ ...t
1094
+ });
1095
+ }
1096
+ function Yt(e) {
1097
+ return /* @__PURE__ */ p.createElement(Ut, null, /* @__PURE__ */ p.createElement(Xt, e));
1098
+ }
1099
+ function Jt(e) {
1100
+ let t = Le(), { portalContainer: n = t ? null : document.body, ...r } = e;
1101
+ if (p.useEffect(() => {
1102
+ if (n != null && n.closest("[data-overlay-container]"))
1103
+ throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
1104
+ }, [
1105
+ n
1106
+ ]), !n)
1107
+ return null;
1108
+ let o = /* @__PURE__ */ p.createElement(Yt, r);
1109
+ return /* @__PURE__ */ je.createPortal(o, n);
1110
+ }
1111
+ function Qt(e) {
1112
+ let t = P(Q);
1113
+ if (!t)
1114
+ throw new Error("Modal is not contained within a provider");
1115
+ return F(() => {
1116
+ if (!(e != null && e.isDisabled || !t || !t.parent))
1117
+ return t.parent.addModal(), () => {
1118
+ t && t.parent && t.parent.removeModal();
1119
+ };
1120
+ }, [
1121
+ t,
1122
+ t.parent,
1123
+ e == null ? void 0 : e.isDisabled
1124
+ ]), {
1125
+ modalProps: {
1126
+ "data-ismodal": !(e != null && e.isDisabled)
1127
+ }
1128
+ };
1129
+ }
1130
+ const Zt = /* @__PURE__ */ p.createContext(null);
1131
+ function en() {
1132
+ let e = P(Zt), t = e == null ? void 0 : e.setContain;
1133
+ h(() => {
1134
+ t == null || t(!0);
1135
+ }, [
1136
+ t
1137
+ ]);
1138
+ }
1139
+ function tn(e, t) {
1140
+ let { role: n = "dialog" } = e, r = at();
1141
+ r = e["aria-label"] ? void 0 : r;
1142
+ let o = w(!1);
1143
+ return F(() => {
1144
+ if (t.current && !t.current.contains(document.activeElement)) {
1145
+ de(t.current);
1146
+ let a = setTimeout(() => {
1147
+ document.activeElement === t.current && (o.current = !0, t.current && (t.current.blur(), de(t.current)), o.current = !1);
1148
+ }, 500);
1149
+ return () => {
1150
+ clearTimeout(a);
1151
+ };
1152
+ }
1153
+ }, [
1154
+ t
1155
+ ]), en(), {
1156
+ dialogProps: {
1157
+ ...st(e, {
1158
+ labelable: !0
1159
+ }),
1160
+ role: n,
1161
+ tabIndex: -1,
1162
+ "aria-labelledby": e["aria-labelledby"] || r,
1163
+ // Prevent blur events from reaching useOverlay, which may cause
1164
+ // popovers to close. Since focus is contained within the dialog,
1165
+ // we don't want this to occur due to the above useEffect.
1166
+ onBlur: (a) => {
1167
+ o.current && a.stopPropagation();
1168
+ }
1169
+ },
1170
+ titleProps: {
1171
+ id: r
1172
+ }
1173
+ };
1174
+ }
1175
+ const y = {
1176
+ "modal-dialog": "_modal-dialog_14t7m_1",
1177
+ "modal-dialog--padded": "_modal-dialog--padded_14t7m_18",
1178
+ "modal-dialog__content": "_modal-dialog__content_14t7m_22",
1179
+ "modal-dialog__children": "_modal-dialog__children_14t7m_32",
1180
+ "modal-dialog__title": "_modal-dialog__title_14t7m_36",
1181
+ "modal-dialog--confirm": "_modal-dialog--confirm_14t7m_43",
1182
+ "modal-dialog__buttons": "_modal-dialog__buttons_14t7m_47",
1183
+ "modal-dialog--buttons-border": "_modal-dialog--buttons-border_14t7m_60",
1184
+ "modal-dialog__close": "_modal-dialog__close_14t7m_64",
1185
+ "modal-dialog--slim": "_modal-dialog--slim_14t7m_82",
1186
+ "modal-dialog--wide": "_modal-dialog--wide_14t7m_86",
1187
+ "modal-dialog--content-with-buttons": "_modal-dialog--content-with-buttons_14t7m_100"
1188
+ };
1189
+ function cn(e) {
1190
+ const {
1191
+ buttons: t,
1192
+ children: n,
1193
+ isDismissable: r = !0,
1194
+ isKeyboardDismissDisabled: o = !r,
1195
+ isLoading: a,
1196
+ spinnerAriaValueText: i = "Loading",
1197
+ closeButtonAriaValueText: l = "Close",
1198
+ isOpen: c,
1199
+ noValidate: u = !1,
1200
+ onClose: d,
1201
+ onSubmit: f,
1202
+ role: b = "dialog",
1203
+ title: v,
1204
+ headerContent: s,
1205
+ variant: C = "dialog",
1206
+ padded: be,
1207
+ slim: Oe,
1208
+ wide: Ae,
1209
+ noButtonBorder: me = !1
1210
+ } = e, ee = w(null), { dialogProps: We, titleProps: Ie } = tn({ role: b }, ee), { modalProps: Be } = Qt({ isDisabled: !c }), { overlayProps: He, underlayProps: Ke } = Rt(
1211
+ { isDismissable: r, isKeyboardDismissDisabled: o, isOpen: c, onClose: d },
1212
+ ee
1213
+ );
1214
+ jt({ isDisabled: !c });
1215
+ function Re(Ve) {
1216
+ Ve.stopPropagation();
1217
+ }
1218
+ return c ? /* @__PURE__ */ x(Jt, { children: /* @__PURE__ */ x(ze, { ...Ke, children: a ? /* @__PURE__ */ x(Ue, { ariaValueText: i }) : /* @__PURE__ */ x(pe, { children: /* @__PURE__ */ x(Ft, { autoFocus: !0, contain: !0, restoreFocus: !0, children: /* @__PURE__ */ te(
1219
+ "div",
1220
+ {
1221
+ ...We,
1222
+ ...Be,
1223
+ ...He,
1224
+ className: K(y["modal-dialog"], {
1225
+ [y["modal-dialog--confirm"]]: C === "confirm",
1226
+ [y["modal-dialog--padded"]]: be,
1227
+ [y["modal-dialog--slim"]]: Oe,
1228
+ [y["modal-dialog--wide"]]: Ae
1229
+ }),
1230
+ onKeyUp: Re,
1231
+ role: "presentation",
1232
+ ref: ee,
1233
+ children: [
1234
+ (v || s) && C === "dialog" && /* @__PURE__ */ te(pe, { children: [
1235
+ v && /* @__PURE__ */ x("h1", { ...Ie, className: y["modal-dialog__title"], children: v }),
1236
+ s,
1237
+ C === "dialog" && /* @__PURE__ */ x("span", { className: y["modal-dialog__close"], children: /* @__PURE__ */ x(
1238
+ qe,
1239
+ {
1240
+ "aria-label": l,
1241
+ onClick: d,
1242
+ paddedModal: be
1243
+ }
1244
+ ) })
1245
+ ] }),
1246
+ /* @__PURE__ */ te(
1247
+ "form",
1248
+ {
1249
+ className: K(y["modal-dialog__content"], {
1250
+ [y["modal-dialog--content-with-buttons"]]: t
1251
+ }),
1252
+ onSubmit: f,
1253
+ noValidate: u,
1254
+ children: [
1255
+ /* @__PURE__ */ x("div", { className: K({ [y["modal-dialog__children"]]: !me }), children: n }),
1256
+ t && /* @__PURE__ */ x(
1257
+ "div",
1258
+ {
1259
+ className: K(y["modal-dialog__buttons"], {
1260
+ [y["modal-dialog--buttons-border"]]: !me
1261
+ }),
1262
+ children: t
1263
+ }
1264
+ )
1265
+ ]
1266
+ }
1267
+ )
1268
+ ]
1269
+ }
1270
+ ) }) }) }) }) : null;
1271
+ }
1272
+ export {
1273
+ Ut as $,
1274
+ cn as M
1275
+ };
1276
+ //# sourceMappingURL=ModalDialog-yEr_JLht.js.map