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