vrembem 3.0.13 → 4.0.0-next.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.
@@ -0,0 +1,2239 @@
1
+ (function(global, factory) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.vrembem = {}));
3
+ })(this, function(exports2) {
4
+ "use strict";
5
+ var b$2 = (t, e, n) => {
6
+ if (!e.has(t))
7
+ throw TypeError("Cannot " + n);
8
+ };
9
+ var o$1 = (t, e, n) => (b$2(t, e, "read from private field"), n ? n.call(t) : e.get(t)), f$2 = (t, e, n) => {
10
+ if (e.has(t))
11
+ throw TypeError("Cannot add the same private member more than once");
12
+ e instanceof WeakSet ? e.add(t) : e.set(t, n);
13
+ }, a = (t, e, n, i2) => (b$2(t, e, "write to private field"), i2 ? i2.call(t, n) : e.set(t, n), n);
14
+ var r$2;
15
+ let $$2 = class $ {
16
+ constructor(e, n) {
17
+ f$2(this, r$2, void 0);
18
+ this.value = e, a(this, r$2, n), this.mql = null;
19
+ }
20
+ get handler() {
21
+ return o$1(this, r$2);
22
+ }
23
+ // Unmount existing handler before setting a new one.
24
+ set handler(e) {
25
+ this.mql && (typeof this.mql.removeEventListener == "function" ? this.mql.removeEventListener("change", o$1(this, r$2)) : this.mql.removeListener(o$1(this, r$2))), a(this, r$2, e);
26
+ }
27
+ mount(e, n) {
28
+ return e && (this.value = e), n && a(this, r$2, n), this.value ? (this.mql = window.matchMedia(`(min-width: ${this.value})`), typeof this.mql.addEventListener == "function" ? this.mql.addEventListener("change", o$1(this, r$2)) : this.mql.addListener(o$1(this, r$2)), o$1(this, r$2).call(this, this.mql), this) : this;
29
+ }
30
+ unmount() {
31
+ return this.mql ? (typeof this.mql.removeEventListener == "function" ? this.mql.removeEventListener("change", o$1(this, r$2)) : this.mql.removeListener(o$1(this, r$2)), this.value = null, a(this, r$2, null), this.mql = null, this) : this;
32
+ }
33
+ };
34
+ r$2 = /* @__PURE__ */ new WeakMap();
35
+ let T$2 = class T {
36
+ constructor() {
37
+ this.collection = [];
38
+ }
39
+ async register(e) {
40
+ return await this.deregister(e), this.collection.push(e), this.collection;
41
+ }
42
+ async deregister(e) {
43
+ const n = this.collection.findIndex((i2) => i2 === e);
44
+ if (n >= 0) {
45
+ const i2 = this.collection[n];
46
+ Object.getOwnPropertyNames(i2).forEach((l2) => {
47
+ delete i2[l2];
48
+ }), this.collection.splice(n, 1);
49
+ }
50
+ return this.collection;
51
+ }
52
+ async registerCollection(e) {
53
+ return await Promise.all(Array.from(e, (n) => {
54
+ this.register(n);
55
+ })), this.collection;
56
+ }
57
+ async deregisterCollection() {
58
+ for (; this.collection.length > 0; )
59
+ await this.deregister(this.collection[0]);
60
+ return this.collection;
61
+ }
62
+ get(e, n = "id") {
63
+ return this.collection.find((i2) => i2[n] === e);
64
+ }
65
+ };
66
+ const s = {
67
+ inert: ":not([inert]):not([inert] *)",
68
+ negTabIndex: ':not([tabindex^="-"])',
69
+ disabled: ":not(:disabled)"
70
+ }, v$2 = [
71
+ `a[href]${s.inert}${s.negTabIndex}`,
72
+ `area[href]${s.inert}${s.negTabIndex}`,
73
+ `input:not([type="hidden"]):not([type="radio"])${s.inert}${s.negTabIndex}${s.disabled}`,
74
+ `input[type="radio"]${s.inert}${s.negTabIndex}${s.disabled}`,
75
+ `select${s.inert}${s.negTabIndex}${s.disabled}`,
76
+ `textarea${s.inert}${s.negTabIndex}${s.disabled}`,
77
+ `button${s.inert}${s.negTabIndex}${s.disabled}`,
78
+ `details${s.inert} > summary:first-of-type${s.negTabIndex}`,
79
+ // Discard until Firefox supports `:has()`
80
+ // See: https://github.com/KittyGiraudel/focusable-selectors/issues/12
81
+ // `details:not(:has(> summary))${not.inert}${not.negTabIndex}`,
82
+ `iframe${s.inert}${s.negTabIndex}`,
83
+ `audio[controls]${s.inert}${s.negTabIndex}`,
84
+ `video[controls]${s.inert}${s.negTabIndex}`,
85
+ `[contenteditable]${s.inert}${s.negTabIndex}`,
86
+ `[tabindex]${s.inert}${s.negTabIndex}`
87
+ ];
88
+ var h$2, d$1, u$2;
89
+ let x$1 = class x {
90
+ constructor(e = null, n = "[data-focus]") {
91
+ f$2(this, h$2, void 0);
92
+ f$2(this, d$1, void 0);
93
+ f$2(this, u$2, void 0);
94
+ this.el = e, this.selectorFocus = n, a(this, d$1, p$2.bind(this)), a(this, u$2, g$2.bind(this));
95
+ }
96
+ get focusable() {
97
+ return o$1(this, h$2);
98
+ }
99
+ set focusable(e) {
100
+ a(this, h$2, e), o$1(this, h$2).length ? (document.removeEventListener("keydown", o$1(this, u$2)), document.addEventListener("keydown", o$1(this, d$1))) : (document.removeEventListener("keydown", o$1(this, d$1)), document.addEventListener("keydown", o$1(this, u$2)));
101
+ }
102
+ get focusableFirst() {
103
+ return this.focusable[0];
104
+ }
105
+ get focusableLast() {
106
+ return this.focusable[this.focusable.length - 1];
107
+ }
108
+ mount(e, n) {
109
+ e && (this.el = e), n && (this.selectorFocus = n), this.focusable = this.getFocusable(), this.focus();
110
+ }
111
+ unmount() {
112
+ this.el = null, this.focusable = [], document.removeEventListener("keydown", o$1(this, d$1)), document.removeEventListener("keydown", o$1(this, u$2));
113
+ }
114
+ focus(e = this.el, n = this.selectorFocus) {
115
+ (e.querySelector(n) || e).focus();
116
+ }
117
+ getFocusable(e = this.el) {
118
+ const n = [], i2 = document.activeElement, l2 = e.scrollTop;
119
+ return e.querySelectorAll(v$2.join(",")).forEach((m2) => {
120
+ m2.focus(), document.activeElement === m2 && n.push(m2);
121
+ }), e.scrollTop = l2, i2.focus(), n;
122
+ }
123
+ };
124
+ h$2 = /* @__PURE__ */ new WeakMap(), d$1 = /* @__PURE__ */ new WeakMap(), u$2 = /* @__PURE__ */ new WeakMap();
125
+ function p$2(t) {
126
+ (t.key === "Tab" || t.keyCode === 9) && (t.shiftKey ? (document.activeElement === this.focusableFirst || document.activeElement === this.el) && (t.preventDefault(), this.focusableLast.focus()) : (document.activeElement === this.focusableLast || document.activeElement === this.el) && (t.preventDefault(), this.focusableFirst.focus()));
127
+ }
128
+ function g$2(t) {
129
+ (t.key === "Tab" || t.keyCode === 9) && t.preventDefault();
130
+ }
131
+ function q$2(t, e) {
132
+ const i2 = (t.getAttribute(`data-${e}`) || "").replace(/'/g, '"');
133
+ return i2 ? JSON.parse(i2) : {};
134
+ }
135
+ function I$3() {
136
+ return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim();
137
+ }
138
+ function C$2(t, e = true) {
139
+ const n = localStorage.getItem(t), i2 = n ? JSON.parse(n) : {};
140
+ return {
141
+ get(l2) {
142
+ return l2 ? i2[l2] : i2;
143
+ },
144
+ set(l2, c2) {
145
+ return c2 ? i2[l2] = c2 : delete i2[l2], e && localStorage.setItem(t, JSON.stringify(i2)), i2;
146
+ }
147
+ };
148
+ }
149
+ function O$2(t, e, n) {
150
+ const i2 = e.nodeType === Node.COMMENT_NODE, l2 = e.nodeType === Node.ELEMENT_NODE;
151
+ if (e = i2 || l2 ? e : document.querySelector(e), i2 && (n = "after"), !e)
152
+ throw new Error(`Not a valid teleport reference: '${e}'`);
153
+ if (typeof e[n] != "function")
154
+ throw new Error(`Not a valid teleport method: '${n}'`);
155
+ let c2 = null;
156
+ return i2 || (c2 = document.createComment("teleported #" + t.id), t.before(c2)), e[n](t), i2 && e.remove(), c2;
157
+ }
158
+ const S$3 = (t, e) => new Promise((n) => {
159
+ e.transition ? (t.classList.remove(e.stateClosed), t.classList.add(e.stateOpening), t.addEventListener("transitionend", function i2() {
160
+ t.classList.add(e.stateOpened), t.classList.remove(e.stateOpening), n(t), this.removeEventListener("transitionend", i2);
161
+ })) : (t.classList.add(e.stateOpened), t.classList.remove(e.stateClosed), n(t));
162
+ }), F$3 = (t, e) => new Promise((n) => {
163
+ e.transition ? (t.classList.add(e.stateClosing), t.classList.remove(e.stateOpened), t.addEventListener("transitionend", function i2() {
164
+ t.classList.remove(e.stateClosing), t.classList.add(e.stateClosed), n(t), this.removeEventListener("transitionend", i2);
165
+ })) : (t.classList.add(e.stateClosed), t.classList.remove(e.stateOpened), n(t));
166
+ });
167
+ function y$2(t, e) {
168
+ e && document.querySelectorAll(e).forEach((i2) => {
169
+ t ? i2.style.overflow = "hidden" : i2.style.removeProperty("overflow");
170
+ });
171
+ }
172
+ function L$2(t, e) {
173
+ e && document.querySelectorAll(e).forEach((i2) => {
174
+ t ? (i2.inert = true, i2.setAttribute("aria-hidden", true)) : (i2.inert = null, i2.removeAttribute("aria-hidden"));
175
+ });
176
+ }
177
+ function k$3(t, e) {
178
+ L$2(!!t, e.selectorInert), y$2(!!t, e.selectorOverflow);
179
+ }
180
+ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
181
+ __proto__: null,
182
+ Breakpoint: $$2,
183
+ Collection: T$2,
184
+ FocusTrap: x$1,
185
+ closeTransition: F$3,
186
+ getConfig: q$2,
187
+ getPrefix: I$3,
188
+ localStore: C$2,
189
+ openTransition: S$3,
190
+ teleport: O$2,
191
+ updateGlobalState: k$3
192
+ }, Symbol.toStringTag, { value: "Module" }));
193
+ const i = {
194
+ autoInit: false,
195
+ stateAttr: "aria-checked",
196
+ stateValue: "mixed"
197
+ };
198
+ let r$1 = class r {
199
+ constructor(t) {
200
+ this.defaults = i, this.settings = { ...this.defaults, ...t }, this.__handlerClick = this.handlerClick.bind(this), this.settings.autoInit && this.init();
201
+ }
202
+ init(t = null) {
203
+ t && (this.settings = { ...this.settings, ...t });
204
+ const e = `[${this.settings.stateAttr}="${this.settings.stateValue}"]`, s2 = document.querySelectorAll(e);
205
+ this.setIndeterminate(s2), document.addEventListener("click", this.__handlerClick, false);
206
+ }
207
+ destroy() {
208
+ document.removeEventListener("click", this.__handlerClick, false);
209
+ }
210
+ handlerClick(t) {
211
+ const e = `[${this.settings.stateAttr}="${this.settings.stateValue}"]`, s2 = t.target.closest(e);
212
+ s2 && (this.removeAriaState(s2), this.setIndeterminate(s2));
213
+ }
214
+ setAriaState(t, e = this.settings.stateValue) {
215
+ t = t.forEach ? t : [t], t.forEach((s2) => {
216
+ s2.setAttribute(this.settings.stateAttr, e);
217
+ });
218
+ }
219
+ removeAriaState(t) {
220
+ t = t.forEach ? t : [t], t.forEach((e) => {
221
+ e.removeAttribute(this.settings.stateAttr);
222
+ });
223
+ }
224
+ setIndeterminate(t) {
225
+ t = t.forEach ? t : [t], t.forEach((e) => {
226
+ e.hasAttribute(this.settings.stateAttr) ? e.indeterminate = true : e.indeterminate = false;
227
+ });
228
+ }
229
+ };
230
+ var S$2 = (t, e, s2) => {
231
+ if (!e.has(t))
232
+ throw TypeError("Cannot " + s2);
233
+ };
234
+ var p$1 = (t, e, s2) => (S$2(t, e, "read from private field"), s2 ? s2.call(t) : e.get(t)), E$1 = (t, e, s2) => {
235
+ if (e.has(t))
236
+ throw TypeError("Cannot add the same private member more than once");
237
+ e instanceof WeakSet ? e.add(t) : e.set(t, s2);
238
+ }, $$1 = (t, e, s2, i2) => (S$2(t, e, "write to private field"), i2 ? i2.call(t, s2) : e.set(t, s2), s2);
239
+ var I$2 = (t, e, s2) => {
240
+ if (!e.has(t))
241
+ throw TypeError("Cannot " + s2);
242
+ }, l$1 = (t, e, s2) => (I$2(t, e, "read from private field"), s2 ? s2.call(t) : e.get(t)), w$1 = (t, e, s2) => {
243
+ if (e.has(t))
244
+ throw TypeError("Cannot add the same private member more than once");
245
+ e instanceof WeakSet ? e.add(t) : e.set(t, s2);
246
+ }, h$1 = (t, e, s2, i2) => (I$2(t, e, "write to private field"), i2 ? i2.call(t, s2) : e.set(t, s2), s2), c$1;
247
+ let M$2 = class M {
248
+ constructor(e, s2) {
249
+ w$1(this, c$1, void 0), this.value = e, h$1(this, c$1, s2), this.mql = null;
250
+ }
251
+ get handler() {
252
+ return l$1(this, c$1);
253
+ }
254
+ // Unmount existing handler before setting a new one.
255
+ set handler(e) {
256
+ this.mql && (typeof this.mql.removeEventListener == "function" ? this.mql.removeEventListener("change", l$1(this, c$1)) : this.mql.removeListener(l$1(this, c$1))), h$1(this, c$1, e);
257
+ }
258
+ mount(e, s2) {
259
+ return e && (this.value = e), s2 && h$1(this, c$1, s2), this.value ? (this.mql = window.matchMedia(`(min-width: ${this.value})`), typeof this.mql.addEventListener == "function" ? this.mql.addEventListener("change", l$1(this, c$1)) : this.mql.addListener(l$1(this, c$1)), l$1(this, c$1).call(this, this.mql), this) : this;
260
+ }
261
+ unmount() {
262
+ return this.mql ? (typeof this.mql.removeEventListener == "function" ? this.mql.removeEventListener("change", l$1(this, c$1)) : this.mql.removeListener(l$1(this, c$1)), this.value = null, h$1(this, c$1, null), this.mql = null, this) : this;
263
+ }
264
+ };
265
+ c$1 = /* @__PURE__ */ new WeakMap();
266
+ let P$1 = class P {
267
+ constructor() {
268
+ this.collection = [];
269
+ }
270
+ async register(e) {
271
+ return await this.deregister(e), this.collection.push(e), this.collection;
272
+ }
273
+ async deregister(e) {
274
+ const s2 = this.collection.findIndex((i2) => i2 === e);
275
+ if (s2 >= 0) {
276
+ const i2 = this.collection[s2];
277
+ Object.getOwnPropertyNames(i2).forEach((n) => {
278
+ delete i2[n];
279
+ }), this.collection.splice(s2, 1);
280
+ }
281
+ return this.collection;
282
+ }
283
+ async registerCollection(e) {
284
+ return await Promise.all(Array.from(e, (s2) => {
285
+ this.register(s2);
286
+ })), this.collection;
287
+ }
288
+ async deregisterCollection() {
289
+ for (; this.collection.length > 0; )
290
+ await this.deregister(this.collection[0]);
291
+ return this.collection;
292
+ }
293
+ get(e, s2 = "id") {
294
+ return this.collection.find((i2) => i2[s2] === e);
295
+ }
296
+ };
297
+ const r = {
298
+ inert: ":not([inert]):not([inert] *)",
299
+ negTabIndex: ':not([tabindex^="-"])',
300
+ disabled: ":not(:disabled)"
301
+ }, F$2 = [
302
+ `a[href]${r.inert}${r.negTabIndex}`,
303
+ `area[href]${r.inert}${r.negTabIndex}`,
304
+ `input:not([type="hidden"]):not([type="radio"])${r.inert}${r.negTabIndex}${r.disabled}`,
305
+ `input[type="radio"]${r.inert}${r.negTabIndex}${r.disabled}`,
306
+ `select${r.inert}${r.negTabIndex}${r.disabled}`,
307
+ `textarea${r.inert}${r.negTabIndex}${r.disabled}`,
308
+ `button${r.inert}${r.negTabIndex}${r.disabled}`,
309
+ `details${r.inert} > summary:first-of-type${r.negTabIndex}`,
310
+ // Discard until Firefox supports `:has()`
311
+ // See: https://github.com/KittyGiraudel/focusable-selectors/issues/12
312
+ // `details:not(:has(> summary))${not.inert}${not.negTabIndex}`,
313
+ `iframe${r.inert}${r.negTabIndex}`,
314
+ `audio[controls]${r.inert}${r.negTabIndex}`,
315
+ `video[controls]${r.inert}${r.negTabIndex}`,
316
+ `[contenteditable]${r.inert}${r.negTabIndex}`,
317
+ `[tabindex]${r.inert}${r.negTabIndex}`
318
+ ];
319
+ var v$1, u$1, g$1;
320
+ let B$2 = class B {
321
+ constructor(e = null, s2 = "[data-focus]") {
322
+ w$1(this, v$1, void 0), w$1(this, u$1, void 0), w$1(this, g$1, void 0), this.el = e, this.selectorFocus = s2, h$1(this, u$1, _$2.bind(this)), h$1(this, g$1, N$2.bind(this));
323
+ }
324
+ get focusable() {
325
+ return l$1(this, v$1);
326
+ }
327
+ set focusable(e) {
328
+ h$1(this, v$1, e), l$1(this, v$1).length ? (document.removeEventListener("keydown", l$1(this, g$1)), document.addEventListener("keydown", l$1(this, u$1))) : (document.removeEventListener("keydown", l$1(this, u$1)), document.addEventListener("keydown", l$1(this, g$1)));
329
+ }
330
+ get focusableFirst() {
331
+ return this.focusable[0];
332
+ }
333
+ get focusableLast() {
334
+ return this.focusable[this.focusable.length - 1];
335
+ }
336
+ mount(e, s2) {
337
+ e && (this.el = e), s2 && (this.selectorFocus = s2), this.focusable = this.getFocusable(), this.focus();
338
+ }
339
+ unmount() {
340
+ this.el = null, this.focusable = [], document.removeEventListener("keydown", l$1(this, u$1)), document.removeEventListener("keydown", l$1(this, g$1));
341
+ }
342
+ focus(e = this.el, s2 = this.selectorFocus) {
343
+ (e.querySelector(s2) || e).focus();
344
+ }
345
+ getFocusable(e = this.el) {
346
+ const s2 = [], i2 = document.activeElement, n = e.scrollTop;
347
+ return e.querySelectorAll(F$2.join(",")).forEach((a2) => {
348
+ a2.focus(), document.activeElement === a2 && s2.push(a2);
349
+ }), e.scrollTop = n, i2.focus(), s2;
350
+ }
351
+ };
352
+ v$1 = /* @__PURE__ */ new WeakMap(), u$1 = /* @__PURE__ */ new WeakMap(), g$1 = /* @__PURE__ */ new WeakMap();
353
+ function _$2(t) {
354
+ (t.key === "Tab" || t.keyCode === 9) && (t.shiftKey ? (document.activeElement === this.focusableFirst || document.activeElement === this.el) && (t.preventDefault(), this.focusableLast.focus()) : (document.activeElement === this.focusableLast || document.activeElement === this.el) && (t.preventDefault(), this.focusableFirst.focus()));
355
+ }
356
+ function N$2(t) {
357
+ (t.key === "Tab" || t.keyCode === 9) && t.preventDefault();
358
+ }
359
+ function K$2(t, e) {
360
+ const s2 = (t.getAttribute(`data-${e}`) || "").replace(/'/g, '"');
361
+ return s2 ? JSON.parse(s2) : {};
362
+ }
363
+ function W$1() {
364
+ return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim();
365
+ }
366
+ function V(t, e = true) {
367
+ const s2 = localStorage.getItem(t), i2 = s2 ? JSON.parse(s2) : {};
368
+ return {
369
+ get(n) {
370
+ return n ? i2[n] : i2;
371
+ },
372
+ set(n, a2) {
373
+ return a2 ? i2[n] = a2 : delete i2[n], e && localStorage.setItem(t, JSON.stringify(i2)), i2;
374
+ }
375
+ };
376
+ }
377
+ const J$2 = (t, e) => new Promise((s2) => {
378
+ e.transition ? (t.classList.remove(e.stateClosed), t.classList.add(e.stateOpening), t.addEventListener("transitionend", function i2() {
379
+ t.classList.add(e.stateOpened), t.classList.remove(e.stateOpening), s2(t), this.removeEventListener("transitionend", i2);
380
+ })) : (t.classList.add(e.stateOpened), t.classList.remove(e.stateClosed), s2(t));
381
+ }), z$1 = (t, e) => new Promise((s2) => {
382
+ e.transition ? (t.classList.add(e.stateClosing), t.classList.remove(e.stateOpened), t.addEventListener("transitionend", function i2() {
383
+ t.classList.remove(e.stateClosing), t.classList.add(e.stateClosed), s2(t), this.removeEventListener("transitionend", i2);
384
+ })) : (t.classList.add(e.stateClosed), t.classList.remove(e.stateOpened), s2(t));
385
+ });
386
+ function G$1(t, e) {
387
+ e && document.querySelectorAll(e).forEach((s2) => {
388
+ t ? s2.style.overflow = "hidden" : s2.style.removeProperty("overflow");
389
+ });
390
+ }
391
+ function H$2(t, e) {
392
+ e && document.querySelectorAll(e).forEach((s2) => {
393
+ t ? (s2.inert = true, s2.setAttribute("aria-hidden", true)) : (s2.inert = null, s2.removeAttribute("aria-hidden"));
394
+ });
395
+ }
396
+ function k$2(t, e) {
397
+ H$2(!!t, e.selectorInert), G$1(!!t, e.selectorOverflow);
398
+ }
399
+ const Q$1 = {
400
+ autoInit: false,
401
+ // Data attributes
402
+ dataOpen: "drawer-open",
403
+ dataClose: "drawer-close",
404
+ dataToggle: "drawer-toggle",
405
+ dataBreakpoint: "drawer-breakpoint",
406
+ dataConfig: "drawer-config",
407
+ // Selectors
408
+ selectorDrawer: ".drawer",
409
+ selectorDialog: ".drawer__dialog",
410
+ selectorFocus: "[data-focus]",
411
+ selectorInert: null,
412
+ selectorOverflow: "body",
413
+ // State classes
414
+ stateOpened: "is-opened",
415
+ stateOpening: "is-opening",
416
+ stateClosing: "is-closing",
417
+ stateClosed: "is-closed",
418
+ // Classes
419
+ classModal: "drawer_modal",
420
+ // Feature toggles
421
+ breakpoints: null,
422
+ customEventPrefix: "drawer:",
423
+ eventListeners: true,
424
+ store: true,
425
+ storeKey: "VB:DrawerState",
426
+ setTabindex: true,
427
+ transition: true
428
+ };
429
+ function R$1(t) {
430
+ const e = t.target.closest(`
431
+ [data-${this.settings.dataOpen}],
432
+ [data-${this.settings.dataToggle}],
433
+ [data-${this.settings.dataClose}]
434
+ `);
435
+ if (e) {
436
+ t.preventDefault(), e.matches(`[data-${this.settings.dataToggle}]`) && e.getAttribute(`data-${this.settings.dataToggle}`).trim().split(" ").forEach((i2) => {
437
+ const n = this.get(i2);
438
+ n.trigger = e, n.toggle();
439
+ }), e.matches(`[data-${this.settings.dataOpen}]`) && e.getAttribute(`data-${this.settings.dataOpen}`).trim().split(" ").forEach((i2) => {
440
+ const n = this.get(i2);
441
+ n.trigger = e, n.open();
442
+ }), e.matches(`[data-${this.settings.dataClose}]`) && e.getAttribute(`data-${this.settings.dataClose}`).trim().split(" ").forEach((i2) => {
443
+ if (i2) {
444
+ const n = this.get(i2);
445
+ n.trigger = e, n.close();
446
+ } else {
447
+ const n = t.target.closest(this.settings.selectorDrawer);
448
+ n && this.close(n);
449
+ }
450
+ });
451
+ return;
452
+ }
453
+ t.target.matches(this.settings.selectorDrawer) && this.close(t.target.id);
454
+ }
455
+ function U$1(t) {
456
+ if (t.key === "Escape") {
457
+ const e = this.activeModal;
458
+ e && this.close(e);
459
+ }
460
+ }
461
+ async function L$1(t, e = true) {
462
+ if (!t)
463
+ return this.collection;
464
+ const s2 = this.collection.findIndex((i2) => i2.id === t.id);
465
+ if (s2 >= 0) {
466
+ const i2 = this.collection[s2];
467
+ e && i2.state === "opened" && await i2.close(false), this.store.set(i2.id), i2.unmountBreakpoint(), Object.getOwnPropertyNames(i2).forEach((n) => {
468
+ delete i2[n];
469
+ }), this.collection.splice(s2, 1);
470
+ }
471
+ return this.collection;
472
+ }
473
+ function X(t) {
474
+ const e = W$1(), s2 = t.getAttribute(`data-${this.settings.dataBreakpoint}`);
475
+ return this.settings.breakpoints && this.settings.breakpoints[s2] ? this.settings.breakpoints[s2] : getComputedStyle(document.body).getPropertyValue(`--${e}breakpoint-${s2}`).trim() ? getComputedStyle(document.body).getPropertyValue(`--${e}breakpoint-${s2}`).trim() : s2;
476
+ }
477
+ function y$1(t) {
478
+ const e = typeof t == "string" ? this.get(t) : this.get(t.id);
479
+ if (e)
480
+ return e;
481
+ throw new Error(`Drawer not found in collection with id of "${t.id || t}".`);
482
+ }
483
+ function O$1(t) {
484
+ return typeof t == "string" ? t : typeof t.hasAttribute == "function" ? t.hasAttribute(`data-${this.settings.dataOpen}`) ? t.getAttribute(`data-${this.settings.dataOpen}`) : t.hasAttribute(`data-${this.settings.dataClose}`) ? t.getAttribute(`data-${this.settings.dataClose}`) || false : t.hasAttribute(`data-${this.settings.dataToggle}`) ? t.getAttribute(`data-${this.settings.dataToggle}`) : t.closest(this.settings.selectorDrawer) ? (t = t.closest(this.settings.selectorDrawer), t.id || false) : false : t.id ? t.id : false;
485
+ }
486
+ function Y(t) {
487
+ const e = O$1.call(this, t);
488
+ if (e) {
489
+ const s2 = document.querySelector(`#${e}`), i2 = s2 ? s2.querySelector(this.settings.selectorDialog) : null;
490
+ return !s2 && !i2 ? { error: new Error(`No drawer elements found using the ID: "${e}".`) } : i2 ? { drawer: s2, dialog: i2 } : { error: new Error("Drawer is missing dialog element.") };
491
+ } else
492
+ return { error: new Error("Could not resolve the drawer ID.") };
493
+ }
494
+ async function A$1(t) {
495
+ this.store.get(t.id) ? this.store.get(t.id) === "opened" ? await t.open(false, false) : await t.close(false, false) : t.el.classList.contains(this.settings.stateOpened) ? t.state = "opened" : (t.el.classList.remove(this.settings.stateOpening), t.el.classList.remove(this.settings.stateClosing), t.el.classList.add(this.settings.stateClosed));
496
+ }
497
+ function D$2(t) {
498
+ t.state === "opened" ? t.mode === "modal" ? this.focusTrap.mount(t.dialog, this.settings.selectorFocus) : this.focusTrap.focus(t.dialog, this.settings.selectorFocus) : (t.trigger && (t.trigger.focus(), t.trigger = null), this.focusTrap.unmount());
499
+ }
500
+ async function C$1(t, e, s2 = true) {
501
+ const i2 = y$1.call(this, t), n = { ...this.settings, ...i2.settings };
502
+ return e !== void 0 && (n.transition = e), i2.state === "closed" && (i2.state = "opening", await J$2(i2.el, n), i2.mode === "modal" && k$2(true, n), i2.state = "opened"), s2 && D$2.call(this, i2), i2.el.dispatchEvent(new CustomEvent(n.customEventPrefix + "opened", {
503
+ detail: this,
504
+ bubbles: true
505
+ })), i2;
506
+ }
507
+ async function b$1(t, e, s2 = true) {
508
+ const i2 = y$1.call(this, t), n = { ...this.settings, ...i2.settings };
509
+ return e !== void 0 && (n.transition = e), i2.state === "opened" && (i2.state = "closing", document.activeElement.blur(), await z$1(i2.el, n), i2.mode === "modal" && k$2(false, n), s2 && D$2.call(this, i2), i2.state = "closed", i2.el.dispatchEvent(new CustomEvent(n.customEventPrefix + "closed", {
510
+ detail: this,
511
+ bubbles: true
512
+ }))), i2;
513
+ }
514
+ async function q$1(t, e, s2) {
515
+ const i2 = y$1.call(this, t);
516
+ return i2.state === "closed" ? C$1.call(this, i2, e, s2) : b$1.call(this, i2, e, s2);
517
+ }
518
+ function Z$1(t) {
519
+ switch (t.mode) {
520
+ case "inline":
521
+ return j.call(this, t);
522
+ case "modal":
523
+ return tt$1.call(this, t);
524
+ default:
525
+ throw new Error(`"${t.mode}" is not a valid drawer mode.`);
526
+ }
527
+ }
528
+ async function j(t) {
529
+ return t.el.classList.remove(t.getSetting("classModal")), t.dialog.removeAttribute("aria-modal"), k$2(false, { ...this.settings, ...t.settings }), this.focusTrap.unmount(), await A$1.call(this, t), t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix") + "switchMode", {
530
+ detail: this,
531
+ bubbles: true
532
+ })), t;
533
+ }
534
+ async function tt$1(t) {
535
+ return t.el.classList.add(t.getSetting("classModal")), t.dialog.setAttribute("aria-modal", "true"), !this.store.get(t.id) && t.el.classList.contains(t.getSetting("stateOpened")) && this.store.set(t.id, "opened"), await b$1.call(this, t, false, false), t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix") + "switchMode", {
536
+ detail: this,
537
+ bubbles: true
538
+ })), t;
539
+ }
540
+ async function et$1(t, e) {
541
+ await L$1.call(this, t, false);
542
+ const s2 = this, i2 = new M$2(), n = {
543
+ open(o2, d2) {
544
+ return C$1.call(s2, this, o2, d2);
545
+ },
546
+ close(o2, d2) {
547
+ return b$1.call(s2, this, o2, d2);
548
+ },
549
+ toggle(o2, d2) {
550
+ return q$1.call(s2, this, o2, d2);
551
+ },
552
+ deregister() {
553
+ return L$1.call(s2, this);
554
+ },
555
+ mountBreakpoint() {
556
+ const o2 = this.breakpoint, d2 = this.handleBreakpoint.bind(this);
557
+ return i2.mount(o2, d2), this;
558
+ },
559
+ unmountBreakpoint() {
560
+ return i2.unmount(), this;
561
+ },
562
+ handleBreakpoint(o2) {
563
+ return this.mode = o2.matches ? "inline" : "modal", this;
564
+ },
565
+ getSetting(o2) {
566
+ return o2 in this.settings ? this.settings[o2] : s2.settings[o2];
567
+ }
568
+ }, a2 = {
569
+ id: t.id,
570
+ el: t,
571
+ dialog: e,
572
+ trigger: null,
573
+ settings: K$2(t, this.settings.dataConfig),
574
+ get breakpoint() {
575
+ return X.call(s2, t);
576
+ },
577
+ get state() {
578
+ return T2;
579
+ },
580
+ set state(o2) {
581
+ T2 = o2, (o2 === "opened" || o2 === "closed") && this.mode === "inline" && s2.store.set(this.id, this.state);
582
+ },
583
+ get mode() {
584
+ return x2;
585
+ },
586
+ set mode(o2) {
587
+ x2 = o2, Z$1.call(s2, this);
588
+ },
589
+ ...n
590
+ };
591
+ let T2 = t.classList.contains(a2.getSetting("stateOpened")) ? "opened" : "closed", x2 = t.classList.contains(a2.getSetting("classModal")) ? "modal" : "inline";
592
+ return a2.mode === "modal" ? a2.dialog.setAttribute("aria-modal", "true") : a2.dialog.removeAttribute("aria-modal"), a2.getSetting("setTabindex") && a2.dialog.setAttribute("tabindex", "-1"), this.collection.push(a2), a2.breakpoint ? a2.mountBreakpoint() : await A$1.call(this, a2), a2;
593
+ }
594
+ var f$1, m$1;
595
+ let it$1 = class it extends P$1 {
596
+ constructor(s2) {
597
+ super();
598
+ E$1(this, f$1, void 0);
599
+ E$1(this, m$1, void 0);
600
+ this.defaults = Q$1, this.settings = { ...this.defaults, ...s2 }, this.focusTrap = new B$2(), this.store = V(this.settings.storeKey, this.settings.store), $$1(this, f$1, R$1.bind(this)), $$1(this, m$1, U$1.bind(this)), this.settings.autoInit && this.init();
601
+ }
602
+ get activeModal() {
603
+ return this.collection.find((s2) => s2.state === "opened" && s2.mode === "modal");
604
+ }
605
+ async init(s2 = null) {
606
+ s2 && (this.settings = { ...this.settings, ...s2 });
607
+ const i2 = document.querySelectorAll(this.settings.selectorDrawer);
608
+ return await this.registerCollection(i2), this.settings.eventListeners && this.initEventListeners(), this;
609
+ }
610
+ async destroy() {
611
+ return await this.deregisterCollection(), this.settings.eventListeners && this.destroyEventListeners(), this;
612
+ }
613
+ initEventListeners() {
614
+ document.addEventListener("click", p$1(this, f$1), false), document.addEventListener("keydown", p$1(this, m$1), false);
615
+ }
616
+ destroyEventListeners() {
617
+ document.removeEventListener("click", p$1(this, f$1), false), document.removeEventListener("keydown", p$1(this, m$1), false);
618
+ }
619
+ register(s2) {
620
+ const i2 = Y.call(this, s2);
621
+ return i2.error ? Promise.reject(i2.error) : et$1.call(this, i2.drawer, i2.dialog);
622
+ }
623
+ deregister(s2) {
624
+ const i2 = this.get(O$1.call(this, s2));
625
+ return L$1.call(this, i2);
626
+ }
627
+ open(s2, i2, n) {
628
+ return C$1.call(this, s2, i2, n);
629
+ }
630
+ close(s2, i2, n) {
631
+ return b$1.call(this, s2, i2, n);
632
+ }
633
+ toggle(s2, i2, n) {
634
+ return q$1.call(this, s2, i2, n);
635
+ }
636
+ };
637
+ f$1 = /* @__PURE__ */ new WeakMap(), m$1 = /* @__PURE__ */ new WeakMap();
638
+ var I$1 = (t, e, s2) => {
639
+ if (!e.has(t))
640
+ throw TypeError("Cannot " + s2);
641
+ };
642
+ var f = (t, e, s2) => (I$1(t, e, "read from private field"), s2 ? s2.call(t) : e.get(t)), v = (t, e, s2) => {
643
+ if (e.has(t))
644
+ throw TypeError("Cannot add the same private member more than once");
645
+ e instanceof WeakSet ? e.add(t) : e.set(t, s2);
646
+ }, b = (t, e, s2, i2) => (I$1(t, e, "write to private field"), i2 ? i2.call(t, s2) : e.set(t, s2), s2);
647
+ var k$1 = (t, e, s2) => {
648
+ if (!e.has(t))
649
+ throw TypeError("Cannot " + s2);
650
+ }, o = (t, e, s2) => (k$1(t, e, "read from private field"), s2 ? s2.call(t) : e.get(t)), y = (t, e, s2) => {
651
+ if (e.has(t))
652
+ throw TypeError("Cannot add the same private member more than once");
653
+ e instanceof WeakSet ? e.add(t) : e.set(t, s2);
654
+ }, E = (t, e, s2, i2) => (k$1(t, e, "write to private field"), i2 ? i2.call(t, s2) : e.set(t, s2), s2);
655
+ class A {
656
+ constructor() {
657
+ this.collection = [];
658
+ }
659
+ async register(e) {
660
+ return await this.deregister(e), this.collection.push(e), this.collection;
661
+ }
662
+ async deregister(e) {
663
+ const s2 = this.collection.findIndex((i2) => i2 === e);
664
+ if (s2 >= 0) {
665
+ const i2 = this.collection[s2];
666
+ Object.getOwnPropertyNames(i2).forEach((n) => {
667
+ delete i2[n];
668
+ }), this.collection.splice(s2, 1);
669
+ }
670
+ return this.collection;
671
+ }
672
+ async registerCollection(e) {
673
+ return await Promise.all(Array.from(e, (s2) => {
674
+ this.register(s2);
675
+ })), this.collection;
676
+ }
677
+ async deregisterCollection() {
678
+ for (; this.collection.length > 0; )
679
+ await this.deregister(this.collection[0]);
680
+ return this.collection;
681
+ }
682
+ get(e, s2 = "id") {
683
+ return this.collection.find((i2) => i2[s2] === e);
684
+ }
685
+ }
686
+ const l = {
687
+ inert: ":not([inert]):not([inert] *)",
688
+ negTabIndex: ':not([tabindex^="-"])',
689
+ disabled: ":not(:disabled)"
690
+ }, S$1 = [
691
+ `a[href]${l.inert}${l.negTabIndex}`,
692
+ `area[href]${l.inert}${l.negTabIndex}`,
693
+ `input:not([type="hidden"]):not([type="radio"])${l.inert}${l.negTabIndex}${l.disabled}`,
694
+ `input[type="radio"]${l.inert}${l.negTabIndex}${l.disabled}`,
695
+ `select${l.inert}${l.negTabIndex}${l.disabled}`,
696
+ `textarea${l.inert}${l.negTabIndex}${l.disabled}`,
697
+ `button${l.inert}${l.negTabIndex}${l.disabled}`,
698
+ `details${l.inert} > summary:first-of-type${l.negTabIndex}`,
699
+ // Discard until Firefox supports `:has()`
700
+ // See: https://github.com/KittyGiraudel/focusable-selectors/issues/12
701
+ // `details:not(:has(> summary))${not.inert}${not.negTabIndex}`,
702
+ `iframe${l.inert}${l.negTabIndex}`,
703
+ `audio[controls]${l.inert}${l.negTabIndex}`,
704
+ `video[controls]${l.inert}${l.negTabIndex}`,
705
+ `[contenteditable]${l.inert}${l.negTabIndex}`,
706
+ `[tabindex]${l.inert}${l.negTabIndex}`
707
+ ];
708
+ var g, c, d;
709
+ let M$1 = class M {
710
+ constructor(e = null, s2 = "[data-focus]") {
711
+ y(this, g, void 0), y(this, c, void 0), y(this, d, void 0), this.el = e, this.selectorFocus = s2, E(this, c, R.bind(this)), E(this, d, N$1.bind(this));
712
+ }
713
+ get focusable() {
714
+ return o(this, g);
715
+ }
716
+ set focusable(e) {
717
+ E(this, g, e), o(this, g).length ? (document.removeEventListener("keydown", o(this, d)), document.addEventListener("keydown", o(this, c))) : (document.removeEventListener("keydown", o(this, c)), document.addEventListener("keydown", o(this, d)));
718
+ }
719
+ get focusableFirst() {
720
+ return this.focusable[0];
721
+ }
722
+ get focusableLast() {
723
+ return this.focusable[this.focusable.length - 1];
724
+ }
725
+ mount(e, s2) {
726
+ e && (this.el = e), s2 && (this.selectorFocus = s2), this.focusable = this.getFocusable(), this.focus();
727
+ }
728
+ unmount() {
729
+ this.el = null, this.focusable = [], document.removeEventListener("keydown", o(this, c)), document.removeEventListener("keydown", o(this, d));
730
+ }
731
+ focus(e = this.el, s2 = this.selectorFocus) {
732
+ (e.querySelector(s2) || e).focus();
733
+ }
734
+ getFocusable(e = this.el) {
735
+ const s2 = [], i2 = document.activeElement, n = e.scrollTop;
736
+ return e.querySelectorAll(S$1.join(",")).forEach((r2) => {
737
+ r2.focus(), document.activeElement === r2 && s2.push(r2);
738
+ }), e.scrollTop = n, i2.focus(), s2;
739
+ }
740
+ };
741
+ g = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap();
742
+ function R(t) {
743
+ (t.key === "Tab" || t.keyCode === 9) && (t.shiftKey ? (document.activeElement === this.focusableFirst || document.activeElement === this.el) && (t.preventDefault(), this.focusableLast.focus()) : (document.activeElement === this.focusableLast || document.activeElement === this.el) && (t.preventDefault(), this.focusableFirst.focus()));
744
+ }
745
+ function N$1(t) {
746
+ (t.key === "Tab" || t.keyCode === 9) && t.preventDefault();
747
+ }
748
+ function P(t, e) {
749
+ const s2 = (t.getAttribute(`data-${e}`) || "").replace(/'/g, '"');
750
+ return s2 ? JSON.parse(s2) : {};
751
+ }
752
+ function T$1(t, e, s2) {
753
+ const i2 = e.nodeType === Node.COMMENT_NODE, n = e.nodeType === Node.ELEMENT_NODE;
754
+ if (e = i2 || n ? e : document.querySelector(e), i2 && (s2 = "after"), !e)
755
+ throw new Error(`Not a valid teleport reference: '${e}'`);
756
+ if (typeof e[s2] != "function")
757
+ throw new Error(`Not a valid teleport method: '${s2}'`);
758
+ let r2 = null;
759
+ return i2 || (r2 = document.createComment("teleported #" + t.id), t.before(r2)), e[s2](t), i2 && e.remove(), r2;
760
+ }
761
+ const D$1 = (t, e) => new Promise((s2) => {
762
+ e.transition ? (t.classList.remove(e.stateClosed), t.classList.add(e.stateOpening), t.addEventListener("transitionend", function i2() {
763
+ t.classList.add(e.stateOpened), t.classList.remove(e.stateOpening), s2(t), this.removeEventListener("transitionend", i2);
764
+ })) : (t.classList.add(e.stateOpened), t.classList.remove(e.stateClosed), s2(t));
765
+ }), F$1 = (t, e) => new Promise((s2) => {
766
+ e.transition ? (t.classList.add(e.stateClosing), t.classList.remove(e.stateOpened), t.addEventListener("transitionend", function i2() {
767
+ t.classList.remove(e.stateClosing), t.classList.add(e.stateClosed), s2(t), this.removeEventListener("transitionend", i2);
768
+ })) : (t.classList.add(e.stateClosed), t.classList.remove(e.stateOpened), s2(t));
769
+ });
770
+ function q(t, e) {
771
+ e && document.querySelectorAll(e).forEach((s2) => {
772
+ t ? s2.style.overflow = "hidden" : s2.style.removeProperty("overflow");
773
+ });
774
+ }
775
+ function z(t, e) {
776
+ e && document.querySelectorAll(e).forEach((s2) => {
777
+ t ? (s2.inert = true, s2.setAttribute("aria-hidden", true)) : (s2.inert = null, s2.removeAttribute("aria-hidden"));
778
+ });
779
+ }
780
+ function W(t, e) {
781
+ z(!!t, e.selectorInert), q(!!t, e.selectorOverflow);
782
+ }
783
+ const _$1 = {
784
+ autoInit: false,
785
+ // Data attributes
786
+ dataOpen: "modal-open",
787
+ dataClose: "modal-close",
788
+ dataReplace: "modal-replace",
789
+ dataConfig: "modal-config",
790
+ // Selectors
791
+ selectorModal: ".modal",
792
+ selectorDialog: ".modal__dialog",
793
+ selectorRequired: '[role="alertdialog"]',
794
+ selectorFocus: "[data-focus]",
795
+ selectorInert: null,
796
+ selectorOverflow: "body",
797
+ // State classes
798
+ stateOpened: "is-opened",
799
+ stateOpening: "is-opening",
800
+ stateClosing: "is-closing",
801
+ stateClosed: "is-closed",
802
+ // Feature settings
803
+ customEventPrefix: "modal:",
804
+ eventListeners: true,
805
+ teleport: null,
806
+ teleportMethod: "append",
807
+ setTabindex: true,
808
+ transition: true
809
+ };
810
+ function L(t) {
811
+ const e = typeof t == "string" ? this.get(t) : this.get(t.id);
812
+ if (e)
813
+ return e;
814
+ throw new Error(`Modal not found in collection with id of "${t.id || t}".`);
815
+ }
816
+ function p(t) {
817
+ return typeof t == "string" ? t : typeof t.hasAttribute == "function" ? t.hasAttribute(`data-${this.settings.dataOpen}`) ? t.getAttribute(`data-${this.settings.dataOpen}`) : t.hasAttribute(`data-${this.settings.dataClose}`) ? t.getAttribute(`data-${this.settings.dataClose}`) || false : t.hasAttribute(`data-${this.settings.dataReplace}`) ? t.getAttribute(`data-${this.settings.dataReplace}`) : t.closest(this.settings.selectorModal) ? (t = t.closest(this.settings.selectorModal), t.id || false) : false : t.id ? t.id : false;
818
+ }
819
+ function G(t) {
820
+ const e = p.call(this, t);
821
+ if (e) {
822
+ const s2 = document.querySelector(`#${e}`), i2 = s2 ? s2.querySelector(this.settings.selectorDialog) : null;
823
+ return !s2 && !i2 ? { error: new Error(`No modal elements found using the ID: "${e}".`) } : i2 ? { modal: s2, dialog: i2 } : { error: new Error("Modal is missing dialog element.") };
824
+ } else
825
+ return { error: new Error("Could not resolve the modal ID.") };
826
+ }
827
+ function m() {
828
+ this.active ? this.focusTrap.mount(this.active.dialog, this.settings.selectorFocus) : (this.trigger && (this.trigger.focus(), this.trigger = null), this.focusTrap.unmount());
829
+ }
830
+ async function K$1(t) {
831
+ let e = t.target.closest(
832
+ `[data-${this.settings.dataOpen}], [data-${this.settings.dataReplace}]`
833
+ );
834
+ if (e) {
835
+ t.preventDefault(), t.target.closest(this.settings.selectorModal) || (this.trigger = e);
836
+ const i2 = this.get(p.call(this, e));
837
+ return e.matches(`[data-${this.settings.dataOpen}]`) ? i2.open() : i2.replace();
838
+ }
839
+ if (e = t.target.closest(`[data-${this.settings.dataClose}]`), e) {
840
+ t.preventDefault();
841
+ const s2 = e.getAttribute(`data-${this.settings.dataClose}`);
842
+ return s2 === "*" ? this.closeAll() : this.close(s2);
843
+ }
844
+ if (t.target.matches(this.settings.selectorModal) && !t.target.querySelector(this.settings.selectorRequired))
845
+ return this.close(p.call(this, t.target));
846
+ }
847
+ function J$1(t) {
848
+ if (t.key === "Escape" && this.active && !this.active.dialog.matches(this.settings.selectorRequired))
849
+ return this.close();
850
+ }
851
+ async function w(t, e = true) {
852
+ if (!t)
853
+ return this.collection;
854
+ const s2 = this.collection.findIndex((i2) => i2.id === t.id);
855
+ if (s2 >= 0) {
856
+ const i2 = this.collection[s2];
857
+ e && i2.state === "opened" ? await i2.close(false) : this.stack.remove(i2), i2.getSetting("teleport") && i2.teleportReturn(), Object.getOwnPropertyNames(i2).forEach((n) => {
858
+ delete i2[n];
859
+ }), this.collection.splice(s2, 1);
860
+ }
861
+ return this.collection;
862
+ }
863
+ async function x(t, e, s2 = true) {
864
+ const i2 = L.call(this, t), n = { ...this.settings, ...i2.settings };
865
+ return e !== void 0 && (n.transition = e), this.stack.moveToTop(i2), i2.state === "closed" && (i2.state = "opening", this.stack.add(i2), await D$1(i2.el, n), i2.state = "opened"), s2 && m.call(this), i2.el.dispatchEvent(new CustomEvent(n.customEventPrefix + "opened", {
866
+ detail: this,
867
+ bubbles: true
868
+ })), i2;
869
+ }
870
+ async function C(t, e, s2 = true) {
871
+ const i2 = t ? L.call(this, t) : this.active;
872
+ if (i2 && i2.state === "opened") {
873
+ i2.state = "closing";
874
+ const n = { ...this.settings, ...i2.settings };
875
+ e !== void 0 && (n.transition = e), document.activeElement.blur(), await F$1(i2.el, n), this.stack.remove(i2), s2 && m.call(this), i2.state = "closed", i2.el.dispatchEvent(new CustomEvent(n.customEventPrefix + "closed", {
876
+ detail: this,
877
+ bubbles: true
878
+ }));
879
+ }
880
+ return i2;
881
+ }
882
+ async function $(t, e) {
883
+ const s2 = [];
884
+ return await Promise.all(this.stack.value.map(async (i2) => {
885
+ t && t === i2.id ? Promise.resolve() : s2.push(await C.call(this, i2, e, false)), i2.trigger = null;
886
+ })), s2;
887
+ }
888
+ async function O(t, e, s2 = true) {
889
+ const i2 = L.call(this, t);
890
+ let n, r2;
891
+ return i2.state === "opened" ? (n = i2, r2 = await $.call(this, i2.id, e)) : (n = x.call(this, i2, e, false), r2 = $.call(this, false, e), await Promise.all([n, r2])), s2 && m.call(this), { opened: n, closed: r2 };
892
+ }
893
+ async function B$1(t, e) {
894
+ await w.call(this, t, false);
895
+ const s2 = this, i2 = {
896
+ open(r2, a2) {
897
+ return x.call(s2, this, r2, a2);
898
+ },
899
+ close(r2, a2) {
900
+ return C.call(s2, this, r2, a2);
901
+ },
902
+ replace(r2, a2) {
903
+ return O.call(s2, this, r2, a2);
904
+ },
905
+ deregister() {
906
+ return w.call(s2, this);
907
+ },
908
+ teleport(r2 = this.getSetting("teleport"), a2 = this.getSetting("teleportMethod")) {
909
+ return this.returnRef ? (console.error("Element has already been teleported:", this.el), false) : (this.returnRef = T$1(this.el, r2, a2), this.el);
910
+ },
911
+ teleportReturn() {
912
+ return this.returnRef ? (this.returnRef = T$1(this.el, this.returnRef), this.el) : (console.error("No return reference found:", this.el), false);
913
+ },
914
+ getSetting(r2) {
915
+ return r2 in this.settings ? this.settings[r2] : s2.settings[r2];
916
+ }
917
+ }, n = {
918
+ id: t.id,
919
+ state: "closed",
920
+ el: t,
921
+ dialog: e,
922
+ returnRef: null,
923
+ settings: P(t, this.settings.dataConfig),
924
+ ...i2
925
+ };
926
+ return n.dialog.setAttribute("aria-modal", "true"), n.dialog.hasAttribute("role") || n.dialog.setAttribute("role", "dialog"), n.getSetting("setTabindex") && n.dialog.setAttribute("tabindex", "-1"), n.getSetting("teleport") && n.teleport(), this.collection.push(n), n.el.classList.contains(this.settings.stateOpened) ? await n.open(false) : (n.el.classList.remove(this.settings.stateOpening), n.el.classList.remove(this.settings.stateClosing), n.el.classList.add(this.settings.stateClosed)), n;
927
+ }
928
+ function H$1(t) {
929
+ const e = [];
930
+ return {
931
+ get value() {
932
+ return [...e];
933
+ },
934
+ get top() {
935
+ return e[e.length - 1];
936
+ },
937
+ updateIndex() {
938
+ e.forEach((s2, i2) => {
939
+ s2.el.style.zIndex = null;
940
+ const n = getComputedStyle(s2.el)["z-index"];
941
+ s2.el.style.zIndex = parseInt(n) + i2 + 1;
942
+ });
943
+ },
944
+ updateGlobalState() {
945
+ W(this.top, t), this.updateIndex();
946
+ },
947
+ add(s2) {
948
+ s2.el.style.zIndex = null;
949
+ const i2 = getComputedStyle(s2.el)["z-index"];
950
+ s2.el.style.zIndex = parseInt(i2) + e.length + 1, e.push(s2), this.updateGlobalState();
951
+ },
952
+ remove(s2) {
953
+ const i2 = e.findIndex((n) => n.id === s2.id);
954
+ i2 >= 0 && (s2.el.style.zIndex = null, e.splice(i2, 1), this.updateGlobalState());
955
+ },
956
+ moveToTop(s2) {
957
+ const i2 = e.findIndex((n) => n.id === s2.id);
958
+ i2 >= 0 && (e.splice(i2, 1), this.add(s2));
959
+ }
960
+ };
961
+ }
962
+ var u, h;
963
+ class U extends A {
964
+ constructor(s2) {
965
+ super();
966
+ v(this, u, void 0);
967
+ v(this, h, void 0);
968
+ this.defaults = _$1, this.settings = { ...this.defaults, ...s2 }, this.trigger = null, this.focusTrap = new M$1(), this.stack = H$1(this.settings), b(this, u, K$1.bind(this)), b(this, h, J$1.bind(this)), this.settings.autoInit && this.init();
969
+ }
970
+ get active() {
971
+ return this.stack.top;
972
+ }
973
+ async init(s2) {
974
+ s2 && (this.settings = { ...this.settings, ...s2 });
975
+ const i2 = document.querySelectorAll(this.settings.selectorModal);
976
+ return await this.registerCollection(i2), this.settings.eventListeners && this.initEventListeners(), this;
977
+ }
978
+ async destroy() {
979
+ return this.trigger = null, await this.deregisterCollection(), this.settings.eventListeners && this.destroyEventListeners(), this;
980
+ }
981
+ initEventListeners() {
982
+ document.addEventListener("click", f(this, u), false), document.addEventListener("keydown", f(this, h), false);
983
+ }
984
+ destroyEventListeners() {
985
+ document.removeEventListener("click", f(this, u), false), document.removeEventListener("keydown", f(this, h), false);
986
+ }
987
+ register(s2) {
988
+ const i2 = G.call(this, s2);
989
+ return i2.error ? Promise.reject(i2.error) : B$1.call(this, i2.modal, i2.dialog);
990
+ }
991
+ deregister(s2) {
992
+ const i2 = this.get(p.call(this, s2));
993
+ return w.call(this, i2);
994
+ }
995
+ open(s2, i2, n) {
996
+ return x.call(this, s2, i2, n);
997
+ }
998
+ close(s2, i2, n) {
999
+ return C.call(this, s2, i2, n);
1000
+ }
1001
+ replace(s2, i2, n) {
1002
+ return O.call(this, s2, i2, n);
1003
+ }
1004
+ async closeAll(s2 = false, i2, n = true) {
1005
+ const r2 = await $.call(this, s2, i2);
1006
+ return n && m.call(this), r2;
1007
+ }
1008
+ }
1009
+ u = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap();
1010
+ var Ue = (e, t, r2) => {
1011
+ if (!t.has(e))
1012
+ throw TypeError("Cannot " + r2);
1013
+ };
1014
+ var Ae = (e, t, r2) => (Ue(e, t, "read from private field"), r2 ? r2.call(e) : t.get(e)), _e = (e, t, r2) => {
1015
+ if (t.has(e))
1016
+ throw TypeError("Cannot add the same private member more than once");
1017
+ t instanceof WeakSet ? t.add(e) : t.set(e, r2);
1018
+ }, Ke = (e, t, r2, i2) => (Ue(e, t, "write to private field"), i2 ? i2.call(e, r2) : t.set(e, r2), r2);
1019
+ class Ct {
1020
+ constructor() {
1021
+ this.collection = [];
1022
+ }
1023
+ async register(t) {
1024
+ return await this.deregister(t), this.collection.push(t), this.collection;
1025
+ }
1026
+ async deregister(t) {
1027
+ const r2 = this.collection.findIndex((i2) => i2 === t);
1028
+ if (r2 >= 0) {
1029
+ const i2 = this.collection[r2];
1030
+ Object.getOwnPropertyNames(i2).forEach((n) => {
1031
+ delete i2[n];
1032
+ }), this.collection.splice(r2, 1);
1033
+ }
1034
+ return this.collection;
1035
+ }
1036
+ async registerCollection(t) {
1037
+ return await Promise.all(Array.from(t, (r2) => {
1038
+ this.register(r2);
1039
+ })), this.collection;
1040
+ }
1041
+ async deregisterCollection() {
1042
+ for (; this.collection.length > 0; )
1043
+ await this.deregister(this.collection[0]);
1044
+ return this.collection;
1045
+ }
1046
+ get(t, r2 = "id") {
1047
+ return this.collection.find((i2) => i2[r2] === t);
1048
+ }
1049
+ }
1050
+ function kt() {
1051
+ return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim();
1052
+ }
1053
+ const Dt = {
1054
+ autoInit: false,
1055
+ // Selectors
1056
+ selectorPopover: ".popover",
1057
+ selectorArrow: ".popover__arrow",
1058
+ // State classes
1059
+ stateActive: "is-active",
1060
+ // Feature settings
1061
+ eventListeners: true,
1062
+ eventType: "click",
1063
+ placement: "bottom"
1064
+ };
1065
+ function ot(e, t) {
1066
+ const r2 = getComputedStyle(e), i2 = {
1067
+ placement: t.placement,
1068
+ event: t.eventType,
1069
+ offset: 0,
1070
+ "overflow-padding": 0,
1071
+ "flip-padding": 0,
1072
+ "arrow-element": t.selectorArrow,
1073
+ "arrow-padding": 0
1074
+ };
1075
+ for (const n in i2) {
1076
+ const o2 = kt(), l2 = r2.getPropertyValue(`--${o2}popover-${n}`).trim();
1077
+ l2 && (i2[n] = l2);
1078
+ }
1079
+ return i2;
1080
+ }
1081
+ function Pe(e) {
1082
+ let t;
1083
+ const r2 = typeof e == "string" ? e.trim().split(" ") : [e];
1084
+ switch (r2.forEach(function(i2, n) {
1085
+ r2[n] = parseInt(i2, 10);
1086
+ }), r2.length) {
1087
+ case 1:
1088
+ t = r2[0];
1089
+ break;
1090
+ case 2:
1091
+ t = {
1092
+ top: r2[0],
1093
+ right: r2[1],
1094
+ bottom: r2[0],
1095
+ left: r2[1]
1096
+ };
1097
+ break;
1098
+ case 3:
1099
+ t = {
1100
+ top: r2[0],
1101
+ right: r2[1],
1102
+ bottom: r2[2],
1103
+ left: r2[1]
1104
+ };
1105
+ break;
1106
+ case 4:
1107
+ t = {
1108
+ top: r2[0],
1109
+ right: r2[1],
1110
+ bottom: r2[2],
1111
+ left: r2[3]
1112
+ };
1113
+ break;
1114
+ default:
1115
+ t = false;
1116
+ break;
1117
+ }
1118
+ return t;
1119
+ }
1120
+ function Rt(e) {
1121
+ return [{
1122
+ name: "offset",
1123
+ options: {
1124
+ offset: [0, parseInt(e.offset, 10)]
1125
+ }
1126
+ }, {
1127
+ name: "preventOverflow",
1128
+ options: {
1129
+ padding: Pe(e["overflow-padding"])
1130
+ }
1131
+ }, {
1132
+ name: "flip",
1133
+ options: {
1134
+ padding: Pe(e["flip-padding"])
1135
+ }
1136
+ }, {
1137
+ name: "arrow",
1138
+ options: {
1139
+ element: e["arrow-element"],
1140
+ padding: Pe(e["arrow-padding"])
1141
+ }
1142
+ }];
1143
+ }
1144
+ function at(e) {
1145
+ const t = typeof e == "string" ? this.get(e) : this.get(e.id);
1146
+ if (t)
1147
+ return t;
1148
+ throw new Error(`Popover not found in collection with id of "${e}".`);
1149
+ }
1150
+ function st(e) {
1151
+ return typeof e == "string" ? e : typeof e.hasAttribute == "function" ? e.closest(this.settings.selectorPopover) ? (e = e.closest(this.settings.selectorPopover), e.id) : e.hasAttribute("aria-controls") ? e.getAttribute("aria-controls") : e.hasAttribute("aria-describedby") ? e.getAttribute("aria-describedby") : false : e.id ? e.id : false;
1152
+ }
1153
+ function Bt(e) {
1154
+ const t = st.call(this, e);
1155
+ if (t) {
1156
+ const r2 = document.querySelector(`#${t}`), i2 = document.querySelector(`[aria-controls="${t}"]`) || document.querySelector(`[aria-describedby="${t}"]`);
1157
+ return !i2 && !r2 ? { error: new Error(`No popover elements found using the ID: "${t}".`) } : i2 ? r2 ? { popover: r2, trigger: i2 } : { error: new Error("No popover associated with the provided popover trigger.") } : { error: new Error("No popover trigger associated with the provided popover.") };
1158
+ } else
1159
+ return { error: new Error("Could not resolve the popover ID.") };
1160
+ }
1161
+ async function ke(e) {
1162
+ const t = e ? at.call(this, e) : await ct.call(this);
1163
+ return t && t.state === "opened" && (t.el.classList.remove(this.settings.stateActive), t.trigger.hasAttribute("aria-controls") && t.trigger.setAttribute("aria-expanded", "false"), t.popper.setOptions({
1164
+ modifiers: [{ name: "eventListeners", enabled: false }]
1165
+ }), t.state = "closed", t.trigger === this.trigger && (this.trigger = null)), t;
1166
+ }
1167
+ async function ct() {
1168
+ const e = [];
1169
+ return await Promise.all(this.collection.map(async (t) => {
1170
+ t.state === "opened" && e.push(await ke.call(this, t));
1171
+ })), e;
1172
+ }
1173
+ function lt(e) {
1174
+ e.state == "opened" && setTimeout(() => {
1175
+ const t = e.el.closest(":hover") === e.el || e.trigger.closest(":hover") === e.trigger, r2 = document.activeElement.closest(
1176
+ `#${e.id}, [aria-controls="${e.id}"], [aria-describedby="${e.id}"]`
1177
+ );
1178
+ return !t && !r2 && e.close(), e;
1179
+ }, 1);
1180
+ }
1181
+ function Tt(e) {
1182
+ e.state === "opened" ? e.close() : (this.trigger = e.trigger, e.open(), ft.call(this, e));
1183
+ }
1184
+ function St(e) {
1185
+ switch (e.key) {
1186
+ case "Escape":
1187
+ this.trigger && this.trigger.focus(), ct.call(this);
1188
+ return;
1189
+ case "Tab":
1190
+ this.collection.forEach((t) => {
1191
+ lt.call(this, t);
1192
+ });
1193
+ return;
1194
+ default:
1195
+ return;
1196
+ }
1197
+ }
1198
+ function ft(e) {
1199
+ const t = this;
1200
+ document.addEventListener("click", function r2(i2) {
1201
+ i2.target.closest(
1202
+ `#${e.id}, [aria-controls="${e.id}"], [aria-describedby="${e.id}"]`
1203
+ ) ? e.el && !e.el.classList.contains(t.settings.stateActive) && this.removeEventListener("click", r2) : (e.el && e.el.classList.contains(t.settings.stateActive) && e.close(), this.removeEventListener("click", r2));
1204
+ });
1205
+ }
1206
+ var k = "top", S = "bottom", M = "right", D = "left", De = "auto", le = [k, S, M, D], Q = "start", se = "end", Mt = "clippingParents", ut = "viewport", ne = "popper", Wt = "reference", Ge = /* @__PURE__ */ le.reduce(function(e, t) {
1207
+ return e.concat([t + "-" + Q, t + "-" + se]);
1208
+ }, []), pt = /* @__PURE__ */ [].concat(le, [De]).reduce(function(e, t) {
1209
+ return e.concat([t, t + "-" + Q, t + "-" + se]);
1210
+ }, []), jt = "beforeRead", Ht = "read", Nt = "afterRead", It = "beforeMain", Vt = "main", Ft = "afterMain", qt = "beforeWrite", Xt = "write", Yt = "afterWrite", zt = [jt, Ht, Nt, It, Vt, Ft, qt, Xt, Yt];
1211
+ function N(e) {
1212
+ return e ? (e.nodeName || "").toLowerCase() : null;
1213
+ }
1214
+ function B(e) {
1215
+ if (e == null)
1216
+ return window;
1217
+ if (e.toString() !== "[object Window]") {
1218
+ var t = e.ownerDocument;
1219
+ return t && t.defaultView || window;
1220
+ }
1221
+ return e;
1222
+ }
1223
+ function K(e) {
1224
+ var t = B(e).Element;
1225
+ return e instanceof t || e instanceof Element;
1226
+ }
1227
+ function T(e) {
1228
+ var t = B(e).HTMLElement;
1229
+ return e instanceof t || e instanceof HTMLElement;
1230
+ }
1231
+ function Re(e) {
1232
+ if (typeof ShadowRoot > "u")
1233
+ return false;
1234
+ var t = B(e).ShadowRoot;
1235
+ return e instanceof t || e instanceof ShadowRoot;
1236
+ }
1237
+ function Ut(e) {
1238
+ var t = e.state;
1239
+ Object.keys(t.elements).forEach(function(r2) {
1240
+ var i2 = t.styles[r2] || {}, n = t.attributes[r2] || {}, o2 = t.elements[r2];
1241
+ !T(o2) || !N(o2) || (Object.assign(o2.style, i2), Object.keys(n).forEach(function(l2) {
1242
+ var s2 = n[l2];
1243
+ s2 === false ? o2.removeAttribute(l2) : o2.setAttribute(l2, s2 === true ? "" : s2);
1244
+ }));
1245
+ });
1246
+ }
1247
+ function _t(e) {
1248
+ var t = e.state, r2 = {
1249
+ popper: {
1250
+ position: t.options.strategy,
1251
+ left: "0",
1252
+ top: "0",
1253
+ margin: "0"
1254
+ },
1255
+ arrow: {
1256
+ position: "absolute"
1257
+ },
1258
+ reference: {}
1259
+ };
1260
+ return Object.assign(t.elements.popper.style, r2.popper), t.styles = r2, t.elements.arrow && Object.assign(t.elements.arrow.style, r2.arrow), function() {
1261
+ Object.keys(t.elements).forEach(function(i2) {
1262
+ var n = t.elements[i2], o2 = t.attributes[i2] || {}, l2 = Object.keys(t.styles.hasOwnProperty(i2) ? t.styles[i2] : r2[i2]), s2 = l2.reduce(function(a2, f2) {
1263
+ return a2[f2] = "", a2;
1264
+ }, {});
1265
+ !T(n) || !N(n) || (Object.assign(n.style, s2), Object.keys(o2).forEach(function(a2) {
1266
+ n.removeAttribute(a2);
1267
+ }));
1268
+ });
1269
+ };
1270
+ }
1271
+ const Kt = {
1272
+ name: "applyStyles",
1273
+ enabled: true,
1274
+ phase: "write",
1275
+ fn: Ut,
1276
+ effect: _t,
1277
+ requires: ["computeStyles"]
1278
+ };
1279
+ function H(e) {
1280
+ return e.split("-")[0];
1281
+ }
1282
+ var _ = Math.max, ye = Math.min, Z = Math.round;
1283
+ function Le() {
1284
+ var e = navigator.userAgentData;
1285
+ return e != null && e.brands && Array.isArray(e.brands) ? e.brands.map(function(t) {
1286
+ return t.brand + "/" + t.version;
1287
+ }).join(" ") : navigator.userAgent;
1288
+ }
1289
+ function dt() {
1290
+ return !/^((?!chrome|android).)*safari/i.test(Le());
1291
+ }
1292
+ function ee(e, t, r2) {
1293
+ t === void 0 && (t = false), r2 === void 0 && (r2 = false);
1294
+ var i2 = e.getBoundingClientRect(), n = 1, o2 = 1;
1295
+ t && T(e) && (n = e.offsetWidth > 0 && Z(i2.width) / e.offsetWidth || 1, o2 = e.offsetHeight > 0 && Z(i2.height) / e.offsetHeight || 1);
1296
+ var l2 = K(e) ? B(e) : window, s2 = l2.visualViewport, a2 = !dt() && r2, f2 = (i2.left + (a2 && s2 ? s2.offsetLeft : 0)) / n, c2 = (i2.top + (a2 && s2 ? s2.offsetTop : 0)) / o2, h2 = i2.width / n, y2 = i2.height / o2;
1297
+ return {
1298
+ width: h2,
1299
+ height: y2,
1300
+ top: c2,
1301
+ right: f2 + h2,
1302
+ bottom: c2 + y2,
1303
+ left: f2,
1304
+ x: f2,
1305
+ y: c2
1306
+ };
1307
+ }
1308
+ function Be(e) {
1309
+ var t = ee(e), r2 = e.offsetWidth, i2 = e.offsetHeight;
1310
+ return Math.abs(t.width - r2) <= 1 && (r2 = t.width), Math.abs(t.height - i2) <= 1 && (i2 = t.height), {
1311
+ x: e.offsetLeft,
1312
+ y: e.offsetTop,
1313
+ width: r2,
1314
+ height: i2
1315
+ };
1316
+ }
1317
+ function vt(e, t) {
1318
+ var r2 = t.getRootNode && t.getRootNode();
1319
+ if (e.contains(t))
1320
+ return true;
1321
+ if (r2 && Re(r2)) {
1322
+ var i2 = t;
1323
+ do {
1324
+ if (i2 && e.isSameNode(i2))
1325
+ return true;
1326
+ i2 = i2.parentNode || i2.host;
1327
+ } while (i2);
1328
+ }
1329
+ return false;
1330
+ }
1331
+ function I(e) {
1332
+ return B(e).getComputedStyle(e);
1333
+ }
1334
+ function Gt(e) {
1335
+ return ["table", "td", "th"].indexOf(N(e)) >= 0;
1336
+ }
1337
+ function F(e) {
1338
+ return ((K(e) ? e.ownerDocument : (
1339
+ // $FlowFixMe[prop-missing]
1340
+ e.document
1341
+ )) || window.document).documentElement;
1342
+ }
1343
+ function we(e) {
1344
+ return N(e) === "html" ? e : (
1345
+ // this is a quicker (but less type safe) way to save quite some bytes from the bundle
1346
+ // $FlowFixMe[incompatible-return]
1347
+ // $FlowFixMe[prop-missing]
1348
+ e.assignedSlot || // step into the shadow DOM of the parent of a slotted node
1349
+ e.parentNode || // DOM Element detected
1350
+ (Re(e) ? e.host : null) || // ShadowRoot detected
1351
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
1352
+ F(e)
1353
+ );
1354
+ }
1355
+ function Je(e) {
1356
+ return !T(e) || // https://github.com/popperjs/popper-core/issues/837
1357
+ I(e).position === "fixed" ? null : e.offsetParent;
1358
+ }
1359
+ function Jt(e) {
1360
+ var t = /firefox/i.test(Le()), r2 = /Trident/i.test(Le());
1361
+ if (r2 && T(e)) {
1362
+ var i2 = I(e);
1363
+ if (i2.position === "fixed")
1364
+ return null;
1365
+ }
1366
+ var n = we(e);
1367
+ for (Re(n) && (n = n.host); T(n) && ["html", "body"].indexOf(N(n)) < 0; ) {
1368
+ var o2 = I(n);
1369
+ if (o2.transform !== "none" || o2.perspective !== "none" || o2.contain === "paint" || ["transform", "perspective"].indexOf(o2.willChange) !== -1 || t && o2.willChange === "filter" || t && o2.filter && o2.filter !== "none")
1370
+ return n;
1371
+ n = n.parentNode;
1372
+ }
1373
+ return null;
1374
+ }
1375
+ function fe(e) {
1376
+ for (var t = B(e), r2 = Je(e); r2 && Gt(r2) && I(r2).position === "static"; )
1377
+ r2 = Je(r2);
1378
+ return r2 && (N(r2) === "html" || N(r2) === "body" && I(r2).position === "static") ? t : r2 || Jt(e) || t;
1379
+ }
1380
+ function Te(e) {
1381
+ return ["top", "bottom"].indexOf(e) >= 0 ? "x" : "y";
1382
+ }
1383
+ function oe(e, t, r2) {
1384
+ return _(e, ye(t, r2));
1385
+ }
1386
+ function Qt(e, t, r2) {
1387
+ var i2 = oe(e, t, r2);
1388
+ return i2 > r2 ? r2 : i2;
1389
+ }
1390
+ function ht() {
1391
+ return {
1392
+ top: 0,
1393
+ right: 0,
1394
+ bottom: 0,
1395
+ left: 0
1396
+ };
1397
+ }
1398
+ function gt(e) {
1399
+ return Object.assign({}, ht(), e);
1400
+ }
1401
+ function mt(e, t) {
1402
+ return t.reduce(function(r2, i2) {
1403
+ return r2[i2] = e, r2;
1404
+ }, {});
1405
+ }
1406
+ var Zt = function(t, r2) {
1407
+ return t = typeof t == "function" ? t(Object.assign({}, r2.rects, {
1408
+ placement: r2.placement
1409
+ })) : t, gt(typeof t != "number" ? t : mt(t, le));
1410
+ };
1411
+ function er(e) {
1412
+ var t, r2 = e.state, i2 = e.name, n = e.options, o2 = r2.elements.arrow, l2 = r2.modifiersData.popperOffsets, s2 = H(r2.placement), a2 = Te(s2), f2 = [D, M].indexOf(s2) >= 0, c2 = f2 ? "height" : "width";
1413
+ if (!(!o2 || !l2)) {
1414
+ var h2 = Zt(n.padding, r2), y2 = Be(o2), u2 = a2 === "y" ? k : D, b2 = a2 === "y" ? S : M, v2 = r2.rects.reference[c2] + r2.rects.reference[a2] - l2[a2] - r2.rects.popper[c2], d2 = l2[a2] - r2.rects.reference[a2], w2 = fe(o2), O2 = w2 ? a2 === "y" ? w2.clientHeight || 0 : w2.clientWidth || 0 : 0, E2 = v2 / 2 - d2 / 2, p2 = h2[u2], g2 = O2 - y2[c2] - h2[b2], m2 = O2 / 2 - y2[c2] / 2 + E2, x2 = oe(p2, m2, g2), L2 = a2;
1415
+ r2.modifiersData[i2] = (t = {}, t[L2] = x2, t.centerOffset = x2 - m2, t);
1416
+ }
1417
+ }
1418
+ function tr(e) {
1419
+ var t = e.state, r2 = e.options, i2 = r2.element, n = i2 === void 0 ? "[data-popper-arrow]" : i2;
1420
+ n != null && (typeof n == "string" && (n = t.elements.popper.querySelector(n), !n) || vt(t.elements.popper, n) && (t.elements.arrow = n));
1421
+ }
1422
+ const rr = {
1423
+ name: "arrow",
1424
+ enabled: true,
1425
+ phase: "main",
1426
+ fn: er,
1427
+ effect: tr,
1428
+ requires: ["popperOffsets"],
1429
+ requiresIfExists: ["preventOverflow"]
1430
+ };
1431
+ function te(e) {
1432
+ return e.split("-")[1];
1433
+ }
1434
+ var ir = {
1435
+ top: "auto",
1436
+ right: "auto",
1437
+ bottom: "auto",
1438
+ left: "auto"
1439
+ };
1440
+ function nr(e, t) {
1441
+ var r2 = e.x, i2 = e.y, n = t.devicePixelRatio || 1;
1442
+ return {
1443
+ x: Z(r2 * n) / n || 0,
1444
+ y: Z(i2 * n) / n || 0
1445
+ };
1446
+ }
1447
+ function Qe(e) {
1448
+ var t, r2 = e.popper, i2 = e.popperRect, n = e.placement, o2 = e.variation, l2 = e.offsets, s2 = e.position, a2 = e.gpuAcceleration, f2 = e.adaptive, c2 = e.roundOffsets, h2 = e.isFixed, y2 = l2.x, u2 = y2 === void 0 ? 0 : y2, b2 = l2.y, v2 = b2 === void 0 ? 0 : b2, d2 = typeof c2 == "function" ? c2({
1449
+ x: u2,
1450
+ y: v2
1451
+ }) : {
1452
+ x: u2,
1453
+ y: v2
1454
+ };
1455
+ u2 = d2.x, v2 = d2.y;
1456
+ var w2 = l2.hasOwnProperty("x"), O2 = l2.hasOwnProperty("y"), E2 = D, p2 = k, g2 = window;
1457
+ if (f2) {
1458
+ var m2 = fe(r2), x2 = "clientHeight", L2 = "clientWidth";
1459
+ if (m2 === B(r2) && (m2 = F(r2), I(m2).position !== "static" && s2 === "absolute" && (x2 = "scrollHeight", L2 = "scrollWidth")), m2 = m2, n === k || (n === D || n === M) && o2 === se) {
1460
+ p2 = S;
1461
+ var P2 = h2 && m2 === g2 && g2.visualViewport ? g2.visualViewport.height : (
1462
+ // $FlowFixMe[prop-missing]
1463
+ m2[x2]
1464
+ );
1465
+ v2 -= P2 - i2.height, v2 *= a2 ? 1 : -1;
1466
+ }
1467
+ if (n === D || (n === k || n === S) && o2 === se) {
1468
+ E2 = M;
1469
+ var A2 = h2 && m2 === g2 && g2.visualViewport ? g2.visualViewport.width : (
1470
+ // $FlowFixMe[prop-missing]
1471
+ m2[L2]
1472
+ );
1473
+ u2 -= A2 - i2.width, u2 *= a2 ? 1 : -1;
1474
+ }
1475
+ }
1476
+ var $2 = Object.assign({
1477
+ position: s2
1478
+ }, f2 && ir), W2 = c2 === true ? nr({
1479
+ x: u2,
1480
+ y: v2
1481
+ }, B(r2)) : {
1482
+ x: u2,
1483
+ y: v2
1484
+ };
1485
+ if (u2 = W2.x, v2 = W2.y, a2) {
1486
+ var C2;
1487
+ return Object.assign({}, $2, (C2 = {}, C2[p2] = O2 ? "0" : "", C2[E2] = w2 ? "0" : "", C2.transform = (g2.devicePixelRatio || 1) <= 1 ? "translate(" + u2 + "px, " + v2 + "px)" : "translate3d(" + u2 + "px, " + v2 + "px, 0)", C2));
1488
+ }
1489
+ return Object.assign({}, $2, (t = {}, t[p2] = O2 ? v2 + "px" : "", t[E2] = w2 ? u2 + "px" : "", t.transform = "", t));
1490
+ }
1491
+ function or(e) {
1492
+ var t = e.state, r2 = e.options, i2 = r2.gpuAcceleration, n = i2 === void 0 ? true : i2, o2 = r2.adaptive, l2 = o2 === void 0 ? true : o2, s2 = r2.roundOffsets, a2 = s2 === void 0 ? true : s2, f2 = {
1493
+ placement: H(t.placement),
1494
+ variation: te(t.placement),
1495
+ popper: t.elements.popper,
1496
+ popperRect: t.rects.popper,
1497
+ gpuAcceleration: n,
1498
+ isFixed: t.options.strategy === "fixed"
1499
+ };
1500
+ t.modifiersData.popperOffsets != null && (t.styles.popper = Object.assign({}, t.styles.popper, Qe(Object.assign({}, f2, {
1501
+ offsets: t.modifiersData.popperOffsets,
1502
+ position: t.options.strategy,
1503
+ adaptive: l2,
1504
+ roundOffsets: a2
1505
+ })))), t.modifiersData.arrow != null && (t.styles.arrow = Object.assign({}, t.styles.arrow, Qe(Object.assign({}, f2, {
1506
+ offsets: t.modifiersData.arrow,
1507
+ position: "absolute",
1508
+ adaptive: false,
1509
+ roundOffsets: a2
1510
+ })))), t.attributes.popper = Object.assign({}, t.attributes.popper, {
1511
+ "data-popper-placement": t.placement
1512
+ });
1513
+ }
1514
+ const ar = {
1515
+ name: "computeStyles",
1516
+ enabled: true,
1517
+ phase: "beforeWrite",
1518
+ fn: or,
1519
+ data: {}
1520
+ };
1521
+ var ge = {
1522
+ passive: true
1523
+ };
1524
+ function sr(e) {
1525
+ var t = e.state, r2 = e.instance, i2 = e.options, n = i2.scroll, o2 = n === void 0 ? true : n, l2 = i2.resize, s2 = l2 === void 0 ? true : l2, a2 = B(t.elements.popper), f2 = [].concat(t.scrollParents.reference, t.scrollParents.popper);
1526
+ return o2 && f2.forEach(function(c2) {
1527
+ c2.addEventListener("scroll", r2.update, ge);
1528
+ }), s2 && a2.addEventListener("resize", r2.update, ge), function() {
1529
+ o2 && f2.forEach(function(c2) {
1530
+ c2.removeEventListener("scroll", r2.update, ge);
1531
+ }), s2 && a2.removeEventListener("resize", r2.update, ge);
1532
+ };
1533
+ }
1534
+ const cr = {
1535
+ name: "eventListeners",
1536
+ enabled: true,
1537
+ phase: "write",
1538
+ fn: function() {
1539
+ },
1540
+ effect: sr,
1541
+ data: {}
1542
+ };
1543
+ var lr = {
1544
+ left: "right",
1545
+ right: "left",
1546
+ bottom: "top",
1547
+ top: "bottom"
1548
+ };
1549
+ function me(e) {
1550
+ return e.replace(/left|right|bottom|top/g, function(t) {
1551
+ return lr[t];
1552
+ });
1553
+ }
1554
+ var fr = {
1555
+ start: "end",
1556
+ end: "start"
1557
+ };
1558
+ function Ze(e) {
1559
+ return e.replace(/start|end/g, function(t) {
1560
+ return fr[t];
1561
+ });
1562
+ }
1563
+ function Se(e) {
1564
+ var t = B(e), r2 = t.pageXOffset, i2 = t.pageYOffset;
1565
+ return {
1566
+ scrollLeft: r2,
1567
+ scrollTop: i2
1568
+ };
1569
+ }
1570
+ function Me(e) {
1571
+ return ee(F(e)).left + Se(e).scrollLeft;
1572
+ }
1573
+ function ur(e, t) {
1574
+ var r2 = B(e), i2 = F(e), n = r2.visualViewport, o2 = i2.clientWidth, l2 = i2.clientHeight, s2 = 0, a2 = 0;
1575
+ if (n) {
1576
+ o2 = n.width, l2 = n.height;
1577
+ var f2 = dt();
1578
+ (f2 || !f2 && t === "fixed") && (s2 = n.offsetLeft, a2 = n.offsetTop);
1579
+ }
1580
+ return {
1581
+ width: o2,
1582
+ height: l2,
1583
+ x: s2 + Me(e),
1584
+ y: a2
1585
+ };
1586
+ }
1587
+ function pr(e) {
1588
+ var t, r2 = F(e), i2 = Se(e), n = (t = e.ownerDocument) == null ? void 0 : t.body, o2 = _(r2.scrollWidth, r2.clientWidth, n ? n.scrollWidth : 0, n ? n.clientWidth : 0), l2 = _(r2.scrollHeight, r2.clientHeight, n ? n.scrollHeight : 0, n ? n.clientHeight : 0), s2 = -i2.scrollLeft + Me(e), a2 = -i2.scrollTop;
1589
+ return I(n || r2).direction === "rtl" && (s2 += _(r2.clientWidth, n ? n.clientWidth : 0) - o2), {
1590
+ width: o2,
1591
+ height: l2,
1592
+ x: s2,
1593
+ y: a2
1594
+ };
1595
+ }
1596
+ function We(e) {
1597
+ var t = I(e), r2 = t.overflow, i2 = t.overflowX, n = t.overflowY;
1598
+ return /auto|scroll|overlay|hidden/.test(r2 + n + i2);
1599
+ }
1600
+ function yt(e) {
1601
+ return ["html", "body", "#document"].indexOf(N(e)) >= 0 ? e.ownerDocument.body : T(e) && We(e) ? e : yt(we(e));
1602
+ }
1603
+ function ae(e, t) {
1604
+ var r2;
1605
+ t === void 0 && (t = []);
1606
+ var i2 = yt(e), n = i2 === ((r2 = e.ownerDocument) == null ? void 0 : r2.body), o2 = B(i2), l2 = n ? [o2].concat(o2.visualViewport || [], We(i2) ? i2 : []) : i2, s2 = t.concat(l2);
1607
+ return n ? s2 : (
1608
+ // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
1609
+ s2.concat(ae(we(l2)))
1610
+ );
1611
+ }
1612
+ function $e(e) {
1613
+ return Object.assign({}, e, {
1614
+ left: e.x,
1615
+ top: e.y,
1616
+ right: e.x + e.width,
1617
+ bottom: e.y + e.height
1618
+ });
1619
+ }
1620
+ function dr(e, t) {
1621
+ var r2 = ee(e, false, t === "fixed");
1622
+ return r2.top = r2.top + e.clientTop, r2.left = r2.left + e.clientLeft, r2.bottom = r2.top + e.clientHeight, r2.right = r2.left + e.clientWidth, r2.width = e.clientWidth, r2.height = e.clientHeight, r2.x = r2.left, r2.y = r2.top, r2;
1623
+ }
1624
+ function et(e, t, r2) {
1625
+ return t === ut ? $e(ur(e, r2)) : K(t) ? dr(t, r2) : $e(pr(F(e)));
1626
+ }
1627
+ function vr(e) {
1628
+ var t = ae(we(e)), r2 = ["absolute", "fixed"].indexOf(I(e).position) >= 0, i2 = r2 && T(e) ? fe(e) : e;
1629
+ return K(i2) ? t.filter(function(n) {
1630
+ return K(n) && vt(n, i2) && N(n) !== "body";
1631
+ }) : [];
1632
+ }
1633
+ function hr(e, t, r2, i2) {
1634
+ var n = t === "clippingParents" ? vr(e) : [].concat(t), o2 = [].concat(n, [r2]), l2 = o2[0], s2 = o2.reduce(function(a2, f2) {
1635
+ var c2 = et(e, f2, i2);
1636
+ return a2.top = _(c2.top, a2.top), a2.right = ye(c2.right, a2.right), a2.bottom = ye(c2.bottom, a2.bottom), a2.left = _(c2.left, a2.left), a2;
1637
+ }, et(e, l2, i2));
1638
+ return s2.width = s2.right - s2.left, s2.height = s2.bottom - s2.top, s2.x = s2.left, s2.y = s2.top, s2;
1639
+ }
1640
+ function wt(e) {
1641
+ var t = e.reference, r2 = e.element, i2 = e.placement, n = i2 ? H(i2) : null, o2 = i2 ? te(i2) : null, l2 = t.x + t.width / 2 - r2.width / 2, s2 = t.y + t.height / 2 - r2.height / 2, a2;
1642
+ switch (n) {
1643
+ case k:
1644
+ a2 = {
1645
+ x: l2,
1646
+ y: t.y - r2.height
1647
+ };
1648
+ break;
1649
+ case S:
1650
+ a2 = {
1651
+ x: l2,
1652
+ y: t.y + t.height
1653
+ };
1654
+ break;
1655
+ case M:
1656
+ a2 = {
1657
+ x: t.x + t.width,
1658
+ y: s2
1659
+ };
1660
+ break;
1661
+ case D:
1662
+ a2 = {
1663
+ x: t.x - r2.width,
1664
+ y: s2
1665
+ };
1666
+ break;
1667
+ default:
1668
+ a2 = {
1669
+ x: t.x,
1670
+ y: t.y
1671
+ };
1672
+ }
1673
+ var f2 = n ? Te(n) : null;
1674
+ if (f2 != null) {
1675
+ var c2 = f2 === "y" ? "height" : "width";
1676
+ switch (o2) {
1677
+ case Q:
1678
+ a2[f2] = a2[f2] - (t[c2] / 2 - r2[c2] / 2);
1679
+ break;
1680
+ case se:
1681
+ a2[f2] = a2[f2] + (t[c2] / 2 - r2[c2] / 2);
1682
+ break;
1683
+ }
1684
+ }
1685
+ return a2;
1686
+ }
1687
+ function ce(e, t) {
1688
+ t === void 0 && (t = {});
1689
+ var r2 = t, i2 = r2.placement, n = i2 === void 0 ? e.placement : i2, o2 = r2.strategy, l2 = o2 === void 0 ? e.strategy : o2, s2 = r2.boundary, a2 = s2 === void 0 ? Mt : s2, f2 = r2.rootBoundary, c2 = f2 === void 0 ? ut : f2, h2 = r2.elementContext, y2 = h2 === void 0 ? ne : h2, u2 = r2.altBoundary, b2 = u2 === void 0 ? false : u2, v2 = r2.padding, d2 = v2 === void 0 ? 0 : v2, w2 = gt(typeof d2 != "number" ? d2 : mt(d2, le)), O2 = y2 === ne ? Wt : ne, E2 = e.rects.popper, p2 = e.elements[b2 ? O2 : y2], g2 = hr(K(p2) ? p2 : p2.contextElement || F(e.elements.popper), a2, c2, l2), m2 = ee(e.elements.reference), x2 = wt({
1690
+ reference: m2,
1691
+ element: E2,
1692
+ strategy: "absolute",
1693
+ placement: n
1694
+ }), L2 = $e(Object.assign({}, E2, x2)), P2 = y2 === ne ? L2 : m2, A2 = {
1695
+ top: g2.top - P2.top + w2.top,
1696
+ bottom: P2.bottom - g2.bottom + w2.bottom,
1697
+ left: g2.left - P2.left + w2.left,
1698
+ right: P2.right - g2.right + w2.right
1699
+ }, $2 = e.modifiersData.offset;
1700
+ if (y2 === ne && $2) {
1701
+ var W2 = $2[n];
1702
+ Object.keys(A2).forEach(function(C2) {
1703
+ var q2 = [M, S].indexOf(C2) >= 0 ? 1 : -1, X2 = [k, S].indexOf(C2) >= 0 ? "y" : "x";
1704
+ A2[C2] += W2[X2] * q2;
1705
+ });
1706
+ }
1707
+ return A2;
1708
+ }
1709
+ function gr(e, t) {
1710
+ t === void 0 && (t = {});
1711
+ var r2 = t, i2 = r2.placement, n = r2.boundary, o2 = r2.rootBoundary, l2 = r2.padding, s2 = r2.flipVariations, a2 = r2.allowedAutoPlacements, f2 = a2 === void 0 ? pt : a2, c2 = te(i2), h2 = c2 ? s2 ? Ge : Ge.filter(function(b2) {
1712
+ return te(b2) === c2;
1713
+ }) : le, y2 = h2.filter(function(b2) {
1714
+ return f2.indexOf(b2) >= 0;
1715
+ });
1716
+ y2.length === 0 && (y2 = h2);
1717
+ var u2 = y2.reduce(function(b2, v2) {
1718
+ return b2[v2] = ce(e, {
1719
+ placement: v2,
1720
+ boundary: n,
1721
+ rootBoundary: o2,
1722
+ padding: l2
1723
+ })[H(v2)], b2;
1724
+ }, {});
1725
+ return Object.keys(u2).sort(function(b2, v2) {
1726
+ return u2[b2] - u2[v2];
1727
+ });
1728
+ }
1729
+ function mr(e) {
1730
+ if (H(e) === De)
1731
+ return [];
1732
+ var t = me(e);
1733
+ return [Ze(e), t, Ze(t)];
1734
+ }
1735
+ function yr(e) {
1736
+ var t = e.state, r2 = e.options, i2 = e.name;
1737
+ if (!t.modifiersData[i2]._skip) {
1738
+ for (var n = r2.mainAxis, o2 = n === void 0 ? true : n, l2 = r2.altAxis, s2 = l2 === void 0 ? true : l2, a2 = r2.fallbackPlacements, f2 = r2.padding, c2 = r2.boundary, h2 = r2.rootBoundary, y2 = r2.altBoundary, u2 = r2.flipVariations, b2 = u2 === void 0 ? true : u2, v2 = r2.allowedAutoPlacements, d2 = t.options.placement, w2 = H(d2), O2 = w2 === d2, E2 = a2 || (O2 || !b2 ? [me(d2)] : mr(d2)), p2 = [d2].concat(E2).reduce(function(G2, V2) {
1739
+ return G2.concat(H(V2) === De ? gr(t, {
1740
+ placement: V2,
1741
+ boundary: c2,
1742
+ rootBoundary: h2,
1743
+ padding: f2,
1744
+ flipVariations: b2,
1745
+ allowedAutoPlacements: v2
1746
+ }) : V2);
1747
+ }, []), g2 = t.rects.reference, m2 = t.rects.popper, x2 = /* @__PURE__ */ new Map(), L2 = true, P2 = p2[0], A2 = 0; A2 < p2.length; A2++) {
1748
+ var $2 = p2[A2], W2 = H($2), C2 = te($2) === Q, q2 = [k, S].indexOf(W2) >= 0, X2 = q2 ? "width" : "height", R2 = ce(t, {
1749
+ placement: $2,
1750
+ boundary: c2,
1751
+ rootBoundary: h2,
1752
+ altBoundary: y2,
1753
+ padding: f2
1754
+ }), j2 = q2 ? C2 ? M : D : C2 ? S : k;
1755
+ g2[X2] > m2[X2] && (j2 = me(j2));
1756
+ var ue = me(j2), Y2 = [];
1757
+ if (o2 && Y2.push(R2[W2] <= 0), s2 && Y2.push(R2[j2] <= 0, R2[ue] <= 0), Y2.every(function(G2) {
1758
+ return G2;
1759
+ })) {
1760
+ P2 = $2, L2 = false;
1761
+ break;
1762
+ }
1763
+ x2.set($2, Y2);
1764
+ }
1765
+ if (L2)
1766
+ for (var pe = b2 ? 3 : 1, be = function(V2) {
1767
+ var ie = p2.find(function(ve) {
1768
+ var z2 = x2.get(ve);
1769
+ if (z2)
1770
+ return z2.slice(0, V2).every(function(xe) {
1771
+ return xe;
1772
+ });
1773
+ });
1774
+ if (ie)
1775
+ return P2 = ie, "break";
1776
+ }, re = pe; re > 0; re--) {
1777
+ var de = be(re);
1778
+ if (de === "break")
1779
+ break;
1780
+ }
1781
+ t.placement !== P2 && (t.modifiersData[i2]._skip = true, t.placement = P2, t.reset = true);
1782
+ }
1783
+ }
1784
+ const wr = {
1785
+ name: "flip",
1786
+ enabled: true,
1787
+ phase: "main",
1788
+ fn: yr,
1789
+ requiresIfExists: ["offset"],
1790
+ data: {
1791
+ _skip: false
1792
+ }
1793
+ };
1794
+ function tt(e, t, r2) {
1795
+ return r2 === void 0 && (r2 = {
1796
+ x: 0,
1797
+ y: 0
1798
+ }), {
1799
+ top: e.top - t.height - r2.y,
1800
+ right: e.right - t.width + r2.x,
1801
+ bottom: e.bottom - t.height + r2.y,
1802
+ left: e.left - t.width - r2.x
1803
+ };
1804
+ }
1805
+ function rt(e) {
1806
+ return [k, M, S, D].some(function(t) {
1807
+ return e[t] >= 0;
1808
+ });
1809
+ }
1810
+ function br(e) {
1811
+ var t = e.state, r2 = e.name, i2 = t.rects.reference, n = t.rects.popper, o2 = t.modifiersData.preventOverflow, l2 = ce(t, {
1812
+ elementContext: "reference"
1813
+ }), s2 = ce(t, {
1814
+ altBoundary: true
1815
+ }), a2 = tt(l2, i2), f2 = tt(s2, n, o2), c2 = rt(a2), h2 = rt(f2);
1816
+ t.modifiersData[r2] = {
1817
+ referenceClippingOffsets: a2,
1818
+ popperEscapeOffsets: f2,
1819
+ isReferenceHidden: c2,
1820
+ hasPopperEscaped: h2
1821
+ }, t.attributes.popper = Object.assign({}, t.attributes.popper, {
1822
+ "data-popper-reference-hidden": c2,
1823
+ "data-popper-escaped": h2
1824
+ });
1825
+ }
1826
+ const xr = {
1827
+ name: "hide",
1828
+ enabled: true,
1829
+ phase: "main",
1830
+ requiresIfExists: ["preventOverflow"],
1831
+ fn: br
1832
+ };
1833
+ function Or(e, t, r2) {
1834
+ var i2 = H(e), n = [D, k].indexOf(i2) >= 0 ? -1 : 1, o2 = typeof r2 == "function" ? r2(Object.assign({}, t, {
1835
+ placement: e
1836
+ })) : r2, l2 = o2[0], s2 = o2[1];
1837
+ return l2 = l2 || 0, s2 = (s2 || 0) * n, [D, M].indexOf(i2) >= 0 ? {
1838
+ x: s2,
1839
+ y: l2
1840
+ } : {
1841
+ x: l2,
1842
+ y: s2
1843
+ };
1844
+ }
1845
+ function Er(e) {
1846
+ var t = e.state, r2 = e.options, i2 = e.name, n = r2.offset, o2 = n === void 0 ? [0, 0] : n, l2 = pt.reduce(function(c2, h2) {
1847
+ return c2[h2] = Or(h2, t.rects, o2), c2;
1848
+ }, {}), s2 = l2[t.placement], a2 = s2.x, f2 = s2.y;
1849
+ t.modifiersData.popperOffsets != null && (t.modifiersData.popperOffsets.x += a2, t.modifiersData.popperOffsets.y += f2), t.modifiersData[i2] = l2;
1850
+ }
1851
+ const Ar = {
1852
+ name: "offset",
1853
+ enabled: true,
1854
+ phase: "main",
1855
+ requires: ["popperOffsets"],
1856
+ fn: Er
1857
+ };
1858
+ function Pr(e) {
1859
+ var t = e.state, r2 = e.name;
1860
+ t.modifiersData[r2] = wt({
1861
+ reference: t.rects.reference,
1862
+ element: t.rects.popper,
1863
+ strategy: "absolute",
1864
+ placement: t.placement
1865
+ });
1866
+ }
1867
+ const Lr = {
1868
+ name: "popperOffsets",
1869
+ enabled: true,
1870
+ phase: "read",
1871
+ fn: Pr,
1872
+ data: {}
1873
+ };
1874
+ function $r(e) {
1875
+ return e === "x" ? "y" : "x";
1876
+ }
1877
+ function Cr(e) {
1878
+ var t = e.state, r2 = e.options, i2 = e.name, n = r2.mainAxis, o2 = n === void 0 ? true : n, l2 = r2.altAxis, s2 = l2 === void 0 ? false : l2, a2 = r2.boundary, f2 = r2.rootBoundary, c2 = r2.altBoundary, h2 = r2.padding, y2 = r2.tether, u2 = y2 === void 0 ? true : y2, b2 = r2.tetherOffset, v2 = b2 === void 0 ? 0 : b2, d2 = ce(t, {
1879
+ boundary: a2,
1880
+ rootBoundary: f2,
1881
+ padding: h2,
1882
+ altBoundary: c2
1883
+ }), w2 = H(t.placement), O2 = te(t.placement), E2 = !O2, p2 = Te(w2), g2 = $r(p2), m2 = t.modifiersData.popperOffsets, x2 = t.rects.reference, L2 = t.rects.popper, P2 = typeof v2 == "function" ? v2(Object.assign({}, t.rects, {
1884
+ placement: t.placement
1885
+ })) : v2, A2 = typeof P2 == "number" ? {
1886
+ mainAxis: P2,
1887
+ altAxis: P2
1888
+ } : Object.assign({
1889
+ mainAxis: 0,
1890
+ altAxis: 0
1891
+ }, P2), $2 = t.modifiersData.offset ? t.modifiersData.offset[t.placement] : null, W2 = {
1892
+ x: 0,
1893
+ y: 0
1894
+ };
1895
+ if (m2) {
1896
+ if (o2) {
1897
+ var C2, q2 = p2 === "y" ? k : D, X2 = p2 === "y" ? S : M, R2 = p2 === "y" ? "height" : "width", j2 = m2[p2], ue = j2 + d2[q2], Y2 = j2 - d2[X2], pe = u2 ? -L2[R2] / 2 : 0, be = O2 === Q ? x2[R2] : L2[R2], re = O2 === Q ? -L2[R2] : -x2[R2], de = t.elements.arrow, G2 = u2 && de ? Be(de) : {
1898
+ width: 0,
1899
+ height: 0
1900
+ }, V2 = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : ht(), ie = V2[q2], ve = V2[X2], z2 = oe(0, x2[R2], G2[R2]), xe = E2 ? x2[R2] / 2 - pe - z2 - ie - A2.mainAxis : be - z2 - ie - A2.mainAxis, Ot = E2 ? -x2[R2] / 2 + pe + z2 + ve + A2.mainAxis : re + z2 + ve + A2.mainAxis, Oe = t.elements.arrow && fe(t.elements.arrow), Et = Oe ? p2 === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, He = (C2 = $2 == null ? void 0 : $2[p2]) != null ? C2 : 0, At = j2 + xe - He - Et, Pt = j2 + Ot - He, Ne = oe(u2 ? ye(ue, At) : ue, j2, u2 ? _(Y2, Pt) : Y2);
1901
+ m2[p2] = Ne, W2[p2] = Ne - j2;
1902
+ }
1903
+ if (s2) {
1904
+ var Ie, Lt = p2 === "x" ? k : D, $t = p2 === "x" ? S : M, U2 = m2[g2], he = g2 === "y" ? "height" : "width", Ve = U2 + d2[Lt], Fe = U2 - d2[$t], Ee = [k, D].indexOf(w2) !== -1, qe = (Ie = $2 == null ? void 0 : $2[g2]) != null ? Ie : 0, Xe = Ee ? Ve : U2 - x2[he] - L2[he] - qe + A2.altAxis, Ye = Ee ? U2 + x2[he] + L2[he] - qe - A2.altAxis : Fe, ze = u2 && Ee ? Qt(Xe, U2, Ye) : oe(u2 ? Xe : Ve, U2, u2 ? Ye : Fe);
1905
+ m2[g2] = ze, W2[g2] = ze - U2;
1906
+ }
1907
+ t.modifiersData[i2] = W2;
1908
+ }
1909
+ }
1910
+ const kr = {
1911
+ name: "preventOverflow",
1912
+ enabled: true,
1913
+ phase: "main",
1914
+ fn: Cr,
1915
+ requiresIfExists: ["offset"]
1916
+ };
1917
+ function Dr(e) {
1918
+ return {
1919
+ scrollLeft: e.scrollLeft,
1920
+ scrollTop: e.scrollTop
1921
+ };
1922
+ }
1923
+ function Rr(e) {
1924
+ return e === B(e) || !T(e) ? Se(e) : Dr(e);
1925
+ }
1926
+ function Br(e) {
1927
+ var t = e.getBoundingClientRect(), r2 = Z(t.width) / e.offsetWidth || 1, i2 = Z(t.height) / e.offsetHeight || 1;
1928
+ return r2 !== 1 || i2 !== 1;
1929
+ }
1930
+ function Tr(e, t, r2) {
1931
+ r2 === void 0 && (r2 = false);
1932
+ var i2 = T(t), n = T(t) && Br(t), o2 = F(t), l2 = ee(e, n, r2), s2 = {
1933
+ scrollLeft: 0,
1934
+ scrollTop: 0
1935
+ }, a2 = {
1936
+ x: 0,
1937
+ y: 0
1938
+ };
1939
+ return (i2 || !i2 && !r2) && ((N(t) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
1940
+ We(o2)) && (s2 = Rr(t)), T(t) ? (a2 = ee(t, true), a2.x += t.clientLeft, a2.y += t.clientTop) : o2 && (a2.x = Me(o2))), {
1941
+ x: l2.left + s2.scrollLeft - a2.x,
1942
+ y: l2.top + s2.scrollTop - a2.y,
1943
+ width: l2.width,
1944
+ height: l2.height
1945
+ };
1946
+ }
1947
+ function Sr(e) {
1948
+ var t = /* @__PURE__ */ new Map(), r2 = /* @__PURE__ */ new Set(), i2 = [];
1949
+ e.forEach(function(o2) {
1950
+ t.set(o2.name, o2);
1951
+ });
1952
+ function n(o2) {
1953
+ r2.add(o2.name);
1954
+ var l2 = [].concat(o2.requires || [], o2.requiresIfExists || []);
1955
+ l2.forEach(function(s2) {
1956
+ if (!r2.has(s2)) {
1957
+ var a2 = t.get(s2);
1958
+ a2 && n(a2);
1959
+ }
1960
+ }), i2.push(o2);
1961
+ }
1962
+ return e.forEach(function(o2) {
1963
+ r2.has(o2.name) || n(o2);
1964
+ }), i2;
1965
+ }
1966
+ function Mr(e) {
1967
+ var t = Sr(e);
1968
+ return zt.reduce(function(r2, i2) {
1969
+ return r2.concat(t.filter(function(n) {
1970
+ return n.phase === i2;
1971
+ }));
1972
+ }, []);
1973
+ }
1974
+ function Wr(e) {
1975
+ var t;
1976
+ return function() {
1977
+ return t || (t = new Promise(function(r2) {
1978
+ Promise.resolve().then(function() {
1979
+ t = void 0, r2(e());
1980
+ });
1981
+ })), t;
1982
+ };
1983
+ }
1984
+ function jr(e) {
1985
+ var t = e.reduce(function(r2, i2) {
1986
+ var n = r2[i2.name];
1987
+ return r2[i2.name] = n ? Object.assign({}, n, i2, {
1988
+ options: Object.assign({}, n.options, i2.options),
1989
+ data: Object.assign({}, n.data, i2.data)
1990
+ }) : i2, r2;
1991
+ }, {});
1992
+ return Object.keys(t).map(function(r2) {
1993
+ return t[r2];
1994
+ });
1995
+ }
1996
+ var it = {
1997
+ placement: "bottom",
1998
+ modifiers: [],
1999
+ strategy: "absolute"
2000
+ };
2001
+ function nt() {
2002
+ for (var e = arguments.length, t = new Array(e), r2 = 0; r2 < e; r2++)
2003
+ t[r2] = arguments[r2];
2004
+ return !t.some(function(i2) {
2005
+ return !(i2 && typeof i2.getBoundingClientRect == "function");
2006
+ });
2007
+ }
2008
+ function Hr(e) {
2009
+ e === void 0 && (e = {});
2010
+ var t = e, r2 = t.defaultModifiers, i2 = r2 === void 0 ? [] : r2, n = t.defaultOptions, o2 = n === void 0 ? it : n;
2011
+ return function(s2, a2, f2) {
2012
+ f2 === void 0 && (f2 = o2);
2013
+ var c2 = {
2014
+ placement: "bottom",
2015
+ orderedModifiers: [],
2016
+ options: Object.assign({}, it, o2),
2017
+ modifiersData: {},
2018
+ elements: {
2019
+ reference: s2,
2020
+ popper: a2
2021
+ },
2022
+ attributes: {},
2023
+ styles: {}
2024
+ }, h2 = [], y2 = false, u2 = {
2025
+ state: c2,
2026
+ setOptions: function(w2) {
2027
+ var O2 = typeof w2 == "function" ? w2(c2.options) : w2;
2028
+ v2(), c2.options = Object.assign({}, o2, c2.options, O2), c2.scrollParents = {
2029
+ reference: K(s2) ? ae(s2) : s2.contextElement ? ae(s2.contextElement) : [],
2030
+ popper: ae(a2)
2031
+ };
2032
+ var E2 = Mr(jr([].concat(i2, c2.options.modifiers)));
2033
+ return c2.orderedModifiers = E2.filter(function(p2) {
2034
+ return p2.enabled;
2035
+ }), b2(), u2.update();
2036
+ },
2037
+ // Sync update – it will always be executed, even if not necessary. This
2038
+ // is useful for low frequency updates where sync behavior simplifies the
2039
+ // logic.
2040
+ // For high frequency updates (e.g. `resize` and `scroll` events), always
2041
+ // prefer the async Popper#update method
2042
+ forceUpdate: function() {
2043
+ if (!y2) {
2044
+ var w2 = c2.elements, O2 = w2.reference, E2 = w2.popper;
2045
+ if (nt(O2, E2)) {
2046
+ c2.rects = {
2047
+ reference: Tr(O2, fe(E2), c2.options.strategy === "fixed"),
2048
+ popper: Be(E2)
2049
+ }, c2.reset = false, c2.placement = c2.options.placement, c2.orderedModifiers.forEach(function(A2) {
2050
+ return c2.modifiersData[A2.name] = Object.assign({}, A2.data);
2051
+ });
2052
+ for (var p2 = 0; p2 < c2.orderedModifiers.length; p2++) {
2053
+ if (c2.reset === true) {
2054
+ c2.reset = false, p2 = -1;
2055
+ continue;
2056
+ }
2057
+ var g2 = c2.orderedModifiers[p2], m2 = g2.fn, x2 = g2.options, L2 = x2 === void 0 ? {} : x2, P2 = g2.name;
2058
+ typeof m2 == "function" && (c2 = m2({
2059
+ state: c2,
2060
+ options: L2,
2061
+ name: P2,
2062
+ instance: u2
2063
+ }) || c2);
2064
+ }
2065
+ }
2066
+ }
2067
+ },
2068
+ // Async and optimistically optimized update – it will not be executed if
2069
+ // not necessary (debounced to run at most once-per-tick)
2070
+ update: Wr(function() {
2071
+ return new Promise(function(d2) {
2072
+ u2.forceUpdate(), d2(c2);
2073
+ });
2074
+ }),
2075
+ destroy: function() {
2076
+ v2(), y2 = true;
2077
+ }
2078
+ };
2079
+ if (!nt(s2, a2))
2080
+ return u2;
2081
+ u2.setOptions(f2).then(function(d2) {
2082
+ !y2 && f2.onFirstUpdate && f2.onFirstUpdate(d2);
2083
+ });
2084
+ function b2() {
2085
+ c2.orderedModifiers.forEach(function(d2) {
2086
+ var w2 = d2.name, O2 = d2.options, E2 = O2 === void 0 ? {} : O2, p2 = d2.effect;
2087
+ if (typeof p2 == "function") {
2088
+ var g2 = p2({
2089
+ state: c2,
2090
+ name: w2,
2091
+ instance: u2,
2092
+ options: E2
2093
+ }), m2 = function() {
2094
+ };
2095
+ h2.push(g2 || m2);
2096
+ }
2097
+ });
2098
+ }
2099
+ function v2() {
2100
+ h2.forEach(function(d2) {
2101
+ return d2();
2102
+ }), h2 = [];
2103
+ }
2104
+ return u2;
2105
+ };
2106
+ }
2107
+ var Nr = [cr, Lr, ar, Kt, Ar, wr, kr, rr, xr], Ir = /* @__PURE__ */ Hr({
2108
+ defaultModifiers: Nr
2109
+ });
2110
+ async function Ce(e) {
2111
+ if (!e)
2112
+ return this.collection;
2113
+ const t = this.collection.findIndex((r2) => r2.id === e.id);
2114
+ if (t >= 0) {
2115
+ const r2 = this.collection[t];
2116
+ r2.state === "opened" && r2.close(), r2.popper.destroy(), bt(r2), Object.getOwnPropertyNames(r2).forEach((i2) => {
2117
+ delete r2[i2];
2118
+ }), this.collection.splice(t, 1);
2119
+ }
2120
+ return this.collection;
2121
+ }
2122
+ function bt(e) {
2123
+ return e.__eventListeners && (e.__eventListeners.forEach((t) => {
2124
+ t.el.forEach((r2) => {
2125
+ t.type.forEach((i2) => {
2126
+ e[r2].removeEventListener(i2, t.listener, false);
2127
+ });
2128
+ });
2129
+ }), delete e.__eventListeners), e;
2130
+ }
2131
+ async function je(e) {
2132
+ const t = at.call(this, e);
2133
+ return t.el.classList.add(this.settings.stateActive), t.trigger.hasAttribute("aria-controls") && t.trigger.setAttribute("aria-expanded", "true"), t.config = ot(t.el, this.settings), t.popper.setOptions({
2134
+ placement: t.config.placement,
2135
+ modifiers: [
2136
+ { name: "eventListeners", enabled: true },
2137
+ ...Rt(t.config)
2138
+ ]
2139
+ }), t.popper.update(), t.state = "opened", t;
2140
+ }
2141
+ async function Vr(e, t) {
2142
+ Ce.call(this, e);
2143
+ const r2 = this, i2 = {
2144
+ open() {
2145
+ return je.call(r2, this);
2146
+ },
2147
+ close() {
2148
+ return ke.call(r2, this);
2149
+ },
2150
+ deregister() {
2151
+ return Ce.call(r2, this);
2152
+ }
2153
+ }, n = {
2154
+ id: e.id,
2155
+ state: "closed",
2156
+ el: e,
2157
+ trigger: t,
2158
+ popper: Ir(t, e),
2159
+ config: ot(e, this.settings),
2160
+ ...i2
2161
+ };
2162
+ return n.trigger.hasAttribute("aria-controls") && n.trigger.setAttribute("aria-expanded", "false"), xt.call(this, n), this.collection.push(n), n.el.classList.contains(this.settings.stateActive) && (await n.open(), ft.call(this, n)), n;
2163
+ }
2164
+ function xt(e) {
2165
+ return e.__eventListeners || (e.config.event === "hover" ? (e.__eventListeners = [{
2166
+ el: ["trigger"],
2167
+ type: ["mouseenter", "focus"],
2168
+ listener: je.bind(this, e)
2169
+ }, {
2170
+ el: ["el", "trigger"],
2171
+ type: ["mouseleave", "focusout"],
2172
+ listener: lt.bind(this, e)
2173
+ }], e.__eventListeners.forEach((r2) => {
2174
+ r2.el.forEach((i2) => {
2175
+ r2.type.forEach((n) => {
2176
+ e[i2].addEventListener(n, r2.listener, false);
2177
+ });
2178
+ });
2179
+ })) : (e.__eventListeners = [{
2180
+ el: ["trigger"],
2181
+ type: ["click"],
2182
+ listener: Tt.bind(this, e)
2183
+ }], e.__eventListeners.forEach((r2) => {
2184
+ r2.el.forEach((i2) => {
2185
+ r2.type.forEach((n) => {
2186
+ e[i2].addEventListener(n, r2.listener, false);
2187
+ });
2188
+ });
2189
+ }))), e;
2190
+ }
2191
+ var J;
2192
+ class qr extends Ct {
2193
+ constructor(r2) {
2194
+ super();
2195
+ _e(this, J, void 0);
2196
+ this.defaults = Dt, this.settings = { ...this.defaults, ...r2 }, this.trigger = null, Ke(this, J, St.bind(this)), this.settings.autoInit && this.init();
2197
+ }
2198
+ async init(r2) {
2199
+ r2 && (this.settings = { ...this.settings, ...r2 });
2200
+ const i2 = document.querySelectorAll(this.settings.selectorPopover);
2201
+ return await this.registerCollection(i2), this.settings.eventListeners && this.initEventListeners(false), this;
2202
+ }
2203
+ async destroy() {
2204
+ return this.trigger = null, await this.deregisterCollection(), this.settings.eventListeners && this.destroyEventListeners(false), this;
2205
+ }
2206
+ initEventListeners(r2 = true) {
2207
+ r2 && this.collection.forEach((i2) => {
2208
+ xt.call(this, i2);
2209
+ }), document.addEventListener("keydown", Ae(this, J), false);
2210
+ }
2211
+ destroyEventListeners(r2 = true) {
2212
+ r2 && this.collection.forEach((i2) => {
2213
+ bt(i2);
2214
+ }), document.removeEventListener("keydown", Ae(this, J), false);
2215
+ }
2216
+ register(r2) {
2217
+ const i2 = Bt.call(this, r2);
2218
+ return i2.error ? Promise.reject(i2.error) : Vr.call(this, i2.popover, i2.trigger);
2219
+ }
2220
+ deregister(r2) {
2221
+ const i2 = this.get(st.call(this, r2));
2222
+ return Ce.call(this, i2);
2223
+ }
2224
+ open(r2) {
2225
+ return je.call(this, r2);
2226
+ }
2227
+ close(r2) {
2228
+ return ke.call(this, r2);
2229
+ }
2230
+ }
2231
+ J = /* @__PURE__ */ new WeakMap();
2232
+ exports2.Checkbox = r$1;
2233
+ exports2.Drawer = it$1;
2234
+ exports2.Modal = U;
2235
+ exports2.Popover = qr;
2236
+ exports2.core = index;
2237
+ Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
2238
+ });
2239
+ //# sourceMappingURL=index.umd.cjs.map