vrembem 4.0.0-next.26 → 4.0.0-next.28

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