vrembem 4.0.0-next.32 → 4.0.0-next.34

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/dev/index.js CHANGED
@@ -1,38 +1,41 @@
1
- const u$2 = ":not([inert])", f = ':not([tabindex^="-"])', m$2 = ":not(:disabled)", k$3 = [
2
- `a[href]${u$2}${f}`,
3
- `area[href]${u$2}${f}`,
4
- `input:not([type="hidden"]):not([type="radio"])${u$2}${f}${m$2}`,
5
- `input[type="radio"]${u$2}${f}${m$2}`,
6
- `select${u$2}${f}${m$2}`,
7
- `textarea${u$2}${f}${m$2}`,
8
- `button${u$2}${f}${m$2}`,
9
- `details${u$2} > summary:first-of-type${f}`,
10
- `iframe${u$2}${f}`,
11
- `audio[controls]${u$2}${f}`,
12
- `video[controls]${u$2}${f}`,
13
- `[contenteditable]${u$2}${f}`,
14
- `[tabindex]${u$2}${f}`
1
+ const l$2 = ":not([inert])", u$2 = ':not([tabindex^="-"])', m$2 = ":not(:disabled)", C$2 = [
2
+ `a[href]${l$2}${u$2}`,
3
+ `area[href]${l$2}${u$2}`,
4
+ `input:not([type="hidden"]):not([type="radio"])${l$2}${u$2}${m$2}`,
5
+ `input[type="radio"]${l$2}${u$2}${m$2}`,
6
+ `select${l$2}${u$2}${m$2}`,
7
+ `textarea${l$2}${u$2}${m$2}`,
8
+ `button${l$2}${u$2}${m$2}`,
9
+ `details${l$2} > summary:first-of-type${u$2}`,
10
+ `iframe${l$2}${u$2}`,
11
+ `audio[controls]${l$2}${u$2}`,
12
+ `video[controls]${l$2}${u$2}`,
13
+ `[contenteditable]${l$2}${u$2}`,
14
+ `[tabindex]${l$2}${u$2}`
15
15
  ];
16
- function C$2(n, t = "config") {
17
- const s = (n.getAttribute(`data-${t}`) || "").replace(/'/g, '"');
18
- return s ? JSON.parse(s) : {};
16
+ function x$2(i, t = "config") {
17
+ const o = (i.getAttribute(`data-${t}`) || "").replace(/'/g, '"');
18
+ return o ? JSON.parse(o) : {};
19
19
  }
20
- function E$3(n) {
21
- if (typeof n == "string") {
22
- const t = document.getElementById(n);
20
+ function v$2(i) {
21
+ if (typeof i == "string") {
22
+ const t = document.getElementById(i);
23
23
  if (t) return t;
24
- throw new Error(`Element not found with ID: "${n}"`);
25
- } else if (n instanceof HTMLElement) {
26
- if (!n.id)
24
+ throw new Error(`Element not found with ID: "${i}"`);
25
+ } else if (i instanceof HTMLElement) {
26
+ if (!i.id)
27
27
  throw new Error("HTMLElement must have an ID");
28
- return n;
28
+ return i;
29
29
  } else
30
30
  throw new Error("Invalid argument: query must be a string or HTMLElement");
31
31
  }
32
- async function g$1(n, t, ...e) {
33
- t in n && typeof n[t] == "function" && await n[t](...e);
32
+ function h$2(i, ...t) {
33
+ return typeof i == "function" ? i(...t) : i;
34
+ }
35
+ async function g$2(i, t, ...e) {
36
+ t in i && typeof i[t] == "function" && await i[t](...e);
34
37
  }
35
- function x$2(n, t, e) {
38
+ function k$3(i, t, e) {
36
39
  if (typeof t == "string") {
37
40
  const r2 = document.querySelector(t);
38
41
  if (!r2)
@@ -42,121 +45,143 @@ function x$2(n, t, e) {
42
45
  throw new Error(`Not a valid teleport reference: '${t}'`);
43
46
  if (typeof t[e] != "function")
44
47
  throw new Error(`Not a valid teleport method: '${e}'`);
45
- let s = document.createComment(
46
- "teleported #" + n.id
48
+ let o = document.createComment(
49
+ "teleported #" + i.id
47
50
  );
48
- return n.before(s), t[e](n), () => {
49
- s && (s.after(n), s.remove(), s = null);
51
+ return i.before(o), t[e](i), () => {
52
+ o && (o.after(i), o.remove(), o = null);
50
53
  };
51
54
  }
52
- function v$2(n) {
53
- return n.split("-").map(
55
+ function R$1(i) {
56
+ return i.split("-").map(
54
57
  (t, e) => e === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1)
55
58
  ).join("");
56
59
  }
57
- function $$2(n) {
58
- return n.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
60
+ function M$2(i) {
61
+ return i.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
59
62
  }
60
- function S$2(n) {
61
- if (typeof n == "number")
62
- return n;
63
- const t = parseFloat(n);
63
+ function A$3(i) {
64
+ if (typeof i == "number")
65
+ return i;
66
+ const t = parseFloat(i);
64
67
  if (!Number.isNaN(t)) {
65
- const e = n.includes("ms");
68
+ const e = i.includes("ms");
66
69
  return t * (e ? 1 : 1e3);
67
70
  }
68
- throw new Error(`Could not convert value to milliseconds: ${n}`);
71
+ throw new Error(`Could not convert value to milliseconds: ${i}`);
69
72
  }
70
- function J$1(n, t, e, s, r2 = 0) {
71
- return new Promise((a2) => {
72
- n.classList.remove(t), n.classList.add(e), setTimeout(() => {
73
- n.classList.add(s), n.classList.remove(e), a2(n);
74
- }, S$2(r2));
73
+ function W$1(i, t, e, o, r2 = 0) {
74
+ return new Promise((n) => {
75
+ i.classList.remove(t), i.classList.add(e), setTimeout(() => {
76
+ i.classList.add(o), i.classList.remove(e), n(i);
77
+ }, A$3(r2));
75
78
  });
76
79
  }
77
- function R$2(n, t = {}) {
80
+ function S$3(i, t = {}) {
78
81
  const e = {
79
82
  fallback: null,
80
83
  element: document.body,
81
84
  ...t
82
85
  };
83
- if (!n.startsWith("--")) {
86
+ if (!i.startsWith("--")) {
84
87
  const r2 = y$2();
85
- r2 && (n = `${r2}${n}`), n = `--${n}`;
88
+ r2 && (i = `${r2}${i}`), i = `--${i}`;
86
89
  }
87
- const s = getComputedStyle(e.element).getPropertyValue(n).trim();
88
- if (s)
89
- return s;
90
+ const o = getComputedStyle(e.element).getPropertyValue(i).trim();
91
+ if (o)
92
+ return o;
90
93
  if (e.fallback)
91
94
  return e.fallback;
92
- throw new Error(`CSS variable "${n}" was not found!`);
95
+ throw new Error(`CSS variable "${i}" was not found!`);
93
96
  }
94
- async function h$1(n, t, e) {
95
- await g$1(t, n, e), e && await g$1(e, n);
96
- for (const s of t.plugins)
97
- await g$1(s, n, { plugin: s, parent: t, entry: e });
98
- await t.emit(n, e);
97
+ async function d$1(i, t, e) {
98
+ await g$2(t, i, e), e && await g$2(e, i);
99
+ for (const o of t.plugins)
100
+ await g$2(o, i, { parent: t, entry: e });
101
+ await t.emit(i, { parent: t, entry: e });
99
102
  }
100
- function M$2(n) {
101
- const t = getComputedStyle(n.el), e = {}, s = n.getSetting("customProps");
102
- for (let r2 = 0; r2 < s.length; r2++) {
103
- const a2 = y$2(), o2 = n.parent.module.toLowerCase(), i = $$2(s[r2]), c = t.getPropertyValue(`--${a2}${o2}-${i}`).trim();
104
- c && (e[i] = c);
103
+ function b$2(i) {
104
+ const t = getComputedStyle(i.el), e = {}, o = i.config.get("customProps");
105
+ for (let r2 = 0; r2 < o.length; r2++) {
106
+ const n = y$2(), s = i.parent.name.toLowerCase(), c2 = M$2(o[r2]), a2 = t.getPropertyValue(`--${n}${s}-${c2}`).trim();
107
+ a2 && (e[R$1(c2)] = a2);
105
108
  }
106
109
  return e;
107
110
  }
108
111
  function y$2() {
109
112
  return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim();
110
113
  }
111
- function P$3(n, t, e = "camel") {
112
- return t = e === "camel" ? v$2(t) : $$2(t), n.split(".").concat(t).reduce((s, r2) => s?.[r2], this);
113
- }
114
- function A$2(n, t = {}) {
115
- const {
116
- fallback: e,
117
- props: s = ["dataConfig", "customProps", "settings", "parent.settings"]
118
- } = t;
119
- for (const r2 of s) {
120
- const a2 = r2 !== "customProps" ? "camel" : "kebab", o2 = P$3.call(this, r2, n, a2);
121
- if (o2 !== void 0)
122
- return o2;
123
- }
124
- if (e !== void 0)
125
- return e;
126
- throw new Error(`${this.parent.module} setting does not exist: ${n}`);
127
- }
128
- function I$3(n, t) {
129
- t && document.querySelectorAll(t).forEach((s) => {
130
- n ? s.style.overflow = "hidden" : s.style.removeProperty("overflow");
114
+ function P$3(i, t) {
115
+ t && document.querySelectorAll(t).forEach((o) => {
116
+ i ? o.style.overflow = "hidden" : o.style.removeProperty("overflow");
131
117
  });
132
118
  }
133
- function T$3(n, t) {
134
- t && document.querySelectorAll(t).forEach((s) => {
135
- n ? (s.inert = true, s.setAttribute("aria-hidden", "true")) : (s.inert = false, s.removeAttribute("aria-hidden"));
119
+ function T$2(i, t) {
120
+ t && document.querySelectorAll(t).forEach((o) => {
121
+ o.inert = i;
136
122
  });
137
123
  }
138
- function G(n, t, e) {
139
- T$3(!!n, t), I$3(!!n, e);
124
+ function Z(i, t, e) {
125
+ T$2(!!i, t), P$3(!!i, e);
140
126
  }
141
- const L$2 = {
142
- events: {},
143
- on(n, t, ...e) {
144
- this.events[n] || (this.events[n] = []), this.events[n].some(
145
- (r2) => r2.listener === t
146
- ) || this.events[n].push({ listener: t, args: e });
147
- },
148
- off(n, t) {
149
- this.events[n] && (this.events[n] = this.events[n].filter(
150
- (e) => e.listener !== t
127
+ let I$3 = class I {
128
+ #t;
129
+ #e;
130
+ constructor() {
131
+ this.#t = {}, this.#e = [];
132
+ }
133
+ get(t, e) {
134
+ const { fallback: o, source: r2 } = e ?? {};
135
+ if (r2) {
136
+ const n = this.#t?.[r2]?.[t];
137
+ if (n !== void 0)
138
+ return n;
139
+ } else
140
+ for (const n of this.#e) {
141
+ const s = this.#t?.[n]?.[t];
142
+ if (s !== void 0)
143
+ return s;
144
+ }
145
+ if (o !== void 0)
146
+ return o;
147
+ throw new Error(`Config does not exist: ${t}`);
148
+ }
149
+ set(t, e = {}) {
150
+ let o, r2;
151
+ return typeof t == "string" ? (o = t, r2 = e) : (o = "entry", r2 = t), this.#t[o] ? Object.assign(this.#t[o], r2) : (this.#e.unshift(o), this.#t[o] = r2), this.#t[o];
152
+ }
153
+ remove(t) {
154
+ const e = this.#e.indexOf(t);
155
+ e !== -1 && this.#e.splice(e, 1), delete this.#t[t];
156
+ }
157
+ setSourceOrder(t) {
158
+ const e = Object.keys(this.#t).reverse(), o = t.filter((r2) => e.includes(r2));
159
+ for (const r2 of e)
160
+ o.includes(r2) || o.push(r2);
161
+ return this.#e = o;
162
+ }
163
+ };
164
+ let L$2 = class L {
165
+ constructor() {
166
+ this.events = {};
167
+ }
168
+ on(t, e, ...o) {
169
+ this.events[t] || (this.events[t] = []), this.events[t].some(
170
+ (n) => n.listener === e
171
+ ) || this.events[t].push({ listener: e, args: o });
172
+ }
173
+ off(t, e) {
174
+ this.events[t] && (this.events[t] = this.events[t].filter(
175
+ (o) => o.listener !== e
151
176
  ));
152
- },
153
- async emit(n, t) {
154
- if (n = n.startsWith("on") ? n.slice(2, 3).toLowerCase() + n.slice(3) : n, !!this.events[n])
155
- for (const { listener: e, args: s } of this.events[n])
156
- await e(t, ...s);
177
+ }
178
+ async emit(t, ...e) {
179
+ if (t = t.startsWith("on") ? t.slice(2, 3).toLowerCase() + t.slice(3) : t, !!this.events[t])
180
+ for (const { listener: o, args: r2 } of this.events[t])
181
+ await o(...e, ...r2);
157
182
  }
158
183
  };
159
- let O$2 = class O extends Array {
184
+ let U$1 = class U extends Array {
160
185
  constructor(t = null) {
161
186
  super(), this.el = t, this.el && this.set();
162
187
  }
@@ -167,76 +192,76 @@ let O$2 = class O extends Array {
167
192
  return this[this.length - 1];
168
193
  }
169
194
  set(t = this.el) {
170
- this.length = 0, t && this.push(...t.querySelectorAll(k$3.join(",")));
195
+ this.length = 0, t && this.push(...t.querySelectorAll(C$2.join(",")));
171
196
  }
172
197
  clear() {
173
198
  this.length = 0;
174
199
  }
175
200
  };
176
- let U$2 = class U {
201
+ let D$2 = class D {
177
202
  constructor(t = null) {
178
- this.el = t, this.focusable = new O$2(), this.handleFocusTrap = D$3.bind(this);
203
+ this.el = t, this.focusable = new U$1(), this.handleFocusTrap = O$2.bind(this);
179
204
  }
180
205
  on(t = this.el) {
181
- this.focusable.set(t), this.focusable.length ? document.addEventListener("keydown", this.handleFocusTrap) : document.addEventListener("keydown", b$2);
206
+ this.focusable.set(t), this.focusable.length ? document.addEventListener("keydown", this.handleFocusTrap) : document.addEventListener("keydown", $$2);
182
207
  }
183
208
  off() {
184
- this.focusable.clear(), document.removeEventListener("keydown", this.handleFocusTrap), document.removeEventListener("keydown", b$2);
209
+ this.focusable.clear(), document.removeEventListener("keydown", this.handleFocusTrap), document.removeEventListener("keydown", $$2);
185
210
  }
186
211
  };
187
- function b$2(n) {
188
- (n.key === "Tab" || n.keyCode === 9) && n.preventDefault();
212
+ function $$2(i) {
213
+ (i.key === "Tab" || i.keyCode === 9) && i.preventDefault();
189
214
  }
190
- function D$3(n) {
191
- if (n.key !== "Tab" && n.keyCode !== 9) return;
192
- const { activeElement: t } = document, { el: e, focusable: s } = this, r2 = n.shiftKey, a2 = t === s.first || t === e, o2 = t === s.last || t === e;
193
- if (r2 && a2 || !r2 && o2) {
194
- n.preventDefault();
195
- const i = r2 ? s.last : s.first;
196
- i && typeof i.focus == "function" && i.focus();
215
+ function O$2(i) {
216
+ if (i.key !== "Tab" && i.keyCode !== 9) return;
217
+ const { activeElement: t } = document, { el: e, focusable: o } = this, r2 = i.shiftKey, n = t === o.first || t === e, s = t === o.last || t === e;
218
+ if (r2 && n || !r2 && s) {
219
+ i.preventDefault();
220
+ const c2 = r2 ? o.last : o.first;
221
+ c2 && typeof c2.focus == "function" && c2.focus();
197
222
  }
198
223
  }
199
- function w$2(n, t = true) {
200
- const e = localStorage.getItem(n), s = e ? JSON.parse(e) : {};
224
+ function w$2(i, t = true) {
225
+ const e = localStorage.getItem(i), o = e ? JSON.parse(e) : {};
201
226
  return {
202
- get(r2, a2) {
203
- return r2 ? r2 in s ? s[r2] : a2 : s;
227
+ get(r2, n) {
228
+ return r2 ? r2 in o ? o[r2] : n : o;
204
229
  },
205
- set(r2, a2) {
206
- return a2 ? s[r2] = a2 : delete s[r2], t && localStorage.setItem(n, JSON.stringify(s)), s;
230
+ set(r2, n) {
231
+ return n ? o[r2] = n : delete o[r2], t && localStorage.setItem(i, JSON.stringify(o)), o;
207
232
  }
208
233
  };
209
234
  }
210
- let H$3 = class H extends Array {
235
+ class H extends Array {
211
236
  constructor(t = {}) {
212
237
  super(), this.presets = t;
213
238
  }
214
- applySettings(t) {
215
- const e = t?.defaults || {}, s = this.presets?.[t.name] || {}, r2 = t?.options || {};
216
- t.settings = { ...e, ...s, ...r2 };
239
+ #t(t) {
240
+ const e = this.presets?.[t.name] || {}, o = t?.options || {};
241
+ t.config = { ...t.config, ...e, ...o };
217
242
  }
218
- validate(t) {
243
+ #e(t) {
219
244
  return !("name" in t) || typeof t.name != "string" ? (console.error("Plugin requires a name!"), false) : true;
220
245
  }
221
246
  get(t) {
222
- return this.find((e) => e.name === t);
247
+ return this.find((e) => e.name === t) || null;
223
248
  }
224
249
  add(t) {
225
250
  if (Array.isArray(t))
226
251
  t.forEach((e) => this.add(e));
227
- else if (this.applySettings(t), this.validate(t)) {
228
- const e = this.findIndex((s) => s.name === t.name);
252
+ else if (this.#t(t), this.#e(t)) {
253
+ const e = this.findIndex((o) => o.name === t.name);
229
254
  ~e ? this[e] = t : this.push(t);
230
255
  }
231
256
  }
232
257
  remove(t) {
233
- const e = this.findIndex((s) => s.name === t);
258
+ const e = this.findIndex((o) => o.name === t);
234
259
  ~e && this.splice(e, 1);
235
260
  }
236
- };
237
- class W extends Array {
261
+ }
262
+ class _ extends Array {
238
263
  constructor(t = {}) {
239
- super(), this.settings = t;
264
+ super(), this.config = t;
240
265
  }
241
266
  get copy() {
242
267
  return [...this];
@@ -248,49 +273,104 @@ class W extends Array {
248
273
  updateIndex() {
249
274
  this.forEach((t, e) => {
250
275
  t.el.style.zIndex = "";
251
- const s = getComputedStyle(t.el)["z-index"];
252
- t.el.style.zIndex = String(parseInt(s, 10) + e + 1);
276
+ const o = getComputedStyle(t.el).getPropertyValue("z-index"), r2 = parseInt(o, 10), n = String((Number.isNaN(r2) ? 0 : r2) + e + 1);
277
+ t.el.style.zIndex = n;
253
278
  });
254
279
  }
255
280
  onChange() {
256
- this.updateIndex(), typeof this.settings.onChange == "function" && this.settings.onChange();
281
+ this.updateIndex(), typeof this.config.onChange == "function" && this.config.onChange();
257
282
  }
258
283
  add(t) {
259
284
  this.push(t), this.onChange();
260
285
  }
261
286
  remove(t) {
262
- const e = this.findIndex((s) => s.id === t.id);
287
+ const e = this.findIndex((o) => o.id === t.id);
263
288
  ~e && (t.el.style.zIndex = "", this.splice(e, 1), this.onChange());
264
289
  }
265
290
  moveToTop(t) {
266
- const e = this.findIndex((s) => s.id === t.id);
291
+ const e = this.findIndex((o) => o.id === t.id);
267
292
  ~e && (this.splice(e, 1), this.add(t));
268
293
  }
269
294
  }
270
- const N$3 = {
295
+ const N$1 = {
296
+ attr: "config",
297
+ sourceKey: "attr"
298
+ };
299
+ function X$1(i = {}) {
300
+ return { ...{
301
+ name: "attrConfig",
302
+ config: N$1,
303
+ options: i
304
+ }, ...{
305
+ onCreateEntry({ entry: o }) {
306
+ const r2 = x$2(o.el, this.config.attr);
307
+ o.config.set(this.config.sourceKey, r2);
308
+ },
309
+ onDestroyEntry({ entry: o }) {
310
+ o.config.remove(this.config.sourceKey);
311
+ }
312
+ } };
313
+ }
314
+ const K$1 = {
315
+ sourceKey: "css"
316
+ };
317
+ function Y$1(i = {}) {
318
+ const t = {
319
+ name: "cssConfig",
320
+ config: K$1,
321
+ options: i
322
+ }, e = {
323
+ setup(r2) {
324
+ r2.on("updateCustomProps", o, this);
325
+ },
326
+ teardown(r2) {
327
+ r2.off("updateCustomProps", o);
328
+ },
329
+ onCreateEntry({ entry: r2 }) {
330
+ const n = b$2(r2);
331
+ r2.config.set(this.config.sourceKey, n);
332
+ },
333
+ onDestroyEntry({ entry: r2 }) {
334
+ r2.config.remove(this.config.sourceKey);
335
+ }
336
+ };
337
+ function o(r2, n) {
338
+ const s = b$2(r2);
339
+ r2.config.set(n.config.sourceKey, s);
340
+ }
341
+ return { ...t, ...e };
342
+ }
343
+ const Q = {
271
344
  condition: true
272
- }, Q = {
345
+ }, q$2 = {
273
346
  primary: "hsl(152deg 60% 50%)",
274
347
  secondary: "hsl(214deg 50% 50%)",
275
348
  neutral: "hsl(214deg 20% 50%)",
276
349
  important: "hsl(0deg 80% 50%)"
277
350
  };
278
- function Z(n = {}) {
351
+ function tt$1(i = {}) {
279
352
  const t = {
280
353
  name: "debug",
281
- defaults: N$3,
282
- options: n
354
+ config: Q,
355
+ options: i
283
356
  };
284
- function e(o2, i = [], c = ["primary", "secondary"]) {
285
- const l2 = c.map((d2) => `color: ${Q[d2]}`);
286
- console.log(`%c📡 DEBUG: %c${o2}`, ...l2, ...i);
287
- }
288
- function s(o2, ...i) {
289
- return typeof o2 == "function" ? o2(...i) : o2;
357
+ function e(n, s = [], c2 = ["primary", "secondary"]) {
358
+ const a2 = c2.map((f2) => `color: ${q$2[f2]}`);
359
+ console.log(`%c📡 DEBUG: %c${n}`, ...a2, ...s);
290
360
  }
291
- const r2 = {
292
- beforeMountRef: e.bind(null, "Event > beforeMount()"),
293
- afterMountRef: e.bind(null, "Event > afterMount()"),
361
+ const o = {
362
+ beforeMountRef: e.bind(
363
+ null,
364
+ "Event > beforeMount()",
365
+ [],
366
+ ["primary", "secondary"]
367
+ ),
368
+ afterMountRef: e.bind(
369
+ null,
370
+ "Event > afterMount()",
371
+ [],
372
+ ["primary", "secondary"]
373
+ ),
294
374
  beforeUnmountRef: e.bind(
295
375
  null,
296
376
  "Event > beforeUnmount()",
@@ -303,33 +383,33 @@ function Z(n = {}) {
303
383
  [],
304
384
  ["important", "neutral"]
305
385
  ),
306
- createEntryRef: (o2, { parent: i, plugin: c }) => {
307
- if (s(c.settings.condition, o2)) {
308
- const l2 = i.collection.length;
309
- e(`Event > createEntry() > [${l2}] #${o2.id}`);
386
+ createEntryRef: ({ parent: n, entry: s }, c2) => {
387
+ if (h$2(c2.config.condition, s)) {
388
+ const a2 = n.collection.length;
389
+ e(`Event > createEntry() > [${a2}] #${s.id}`);
310
390
  }
311
391
  },
312
- registerEntryRef: (o2, { parent: i, plugin: c }) => {
313
- if (s(c.settings.condition, o2)) {
314
- const l2 = i.collection.length;
315
- e(`Event > registerEntry() > [${l2}] #${o2.id}`);
392
+ registerEntryRef: ({ parent: n, entry: s }, c2) => {
393
+ if (h$2(c2.config.condition, s)) {
394
+ const a2 = n.collection.length;
395
+ e(`Event > registerEntry() > [${a2}] #${s.id}`);
316
396
  }
317
397
  },
318
- destroyEntryRef: (o2, { parent: i, plugin: c }) => {
319
- if (s(c.settings.condition, o2)) {
320
- const l2 = i.collection.length;
398
+ destroyEntryRef: ({ parent: n, entry: s }, c2) => {
399
+ if (h$2(c2.config.condition, s)) {
400
+ const a2 = n.collection.length;
321
401
  e(
322
- `Event > destroyEntry() > [${l2}] #${o2.id}`,
402
+ `Event > destroyEntry() > [${a2}] #${s.id}`,
323
403
  [],
324
404
  ["important", "neutral"]
325
405
  );
326
406
  }
327
407
  },
328
- deregisterEntryRef: (o2, { parent: i, plugin: c }) => {
329
- if (s(c.settings.condition, o2)) {
330
- const l2 = i.collection.length;
408
+ deregisterEntryRef: ({ parent: n, entry: s }, c2) => {
409
+ if (h$2(c2.config.condition, s)) {
410
+ const a2 = n.collection.length;
331
411
  e(
332
- `Event > deregisterEntry() > [${l2}]`,
412
+ `Event > deregisterEntry() > [${a2}]`,
333
413
  [],
334
414
  ["important", "neutral"]
335
415
  );
@@ -338,39 +418,33 @@ function Z(n = {}) {
338
418
  };
339
419
  return { ...t, ...{
340
420
  // Plugin setup/teardown methods
341
- setup({ parent: o2 }) {
342
- e("Plugin > setup()", Array.from(arguments), ["secondary", "neutral"]), o2.on("beforeMount", r2.beforeMountRef), o2.on("createEntry", r2.createEntryRef, { parent: o2, plugin: this }), o2.on("registerEntry", r2.registerEntryRef, {
343
- parent: o2,
344
- plugin: this
345
- }), o2.on("afterMount", r2.afterMountRef), o2.on("beforeUnmount", r2.beforeUnmountRef), o2.on("destroyEntry", r2.destroyEntryRef, { parent: o2, plugin: this }), o2.on("deregisterEntry", r2.deregisterEntryRef, {
346
- parent: o2,
347
- plugin: this
348
- }), o2.on("afterUnmount", r2.afterUnmountRef);
421
+ setup(n) {
422
+ e("Plugin > setup()", Array.from(arguments), ["secondary", "neutral"]), n.on("beforeMount", o.beforeMountRef), n.on("createEntry", o.createEntryRef, this), n.on("registerEntry", o.registerEntryRef, this), n.on("afterMount", o.afterMountRef), n.on("beforeUnmount", o.beforeUnmountRef), n.on("destroyEntry", o.destroyEntryRef, this), n.on("deregisterEntry", o.deregisterEntryRef, this), n.on("afterUnmount", o.afterUnmountRef);
349
423
  },
350
- teardown({ parent: o2 }) {
424
+ teardown(n) {
351
425
  e("Plugin > teardown()", Array.from(arguments), [
352
426
  "secondary",
353
427
  "neutral"
354
- ]), o2.off("beforeMount", r2.beforeMountRef), o2.off("createEntry", r2.createEntryRef), o2.off("registerEntry", r2.registerEntryRef), o2.off("afterMount", r2.afterMountRef), o2.off("beforeUnmount", r2.beforeUnmountRef), o2.off("destroyEntry", r2.destroyEntryRef), o2.off("deregisterEntry", r2.deregisterEntryRef), o2.off("afterUnmount", r2.afterUnmountRef);
428
+ ]), n.off("beforeMount", o.beforeMountRef), n.off("createEntry", o.createEntryRef), n.off("registerEntry", o.registerEntryRef), n.off("afterMount", o.afterMountRef), n.off("beforeUnmount", o.beforeUnmountRef), n.off("destroyEntry", o.destroyEntryRef), n.off("deregisterEntry", o.deregisterEntryRef), n.off("afterUnmount", o.afterUnmountRef);
355
429
  },
356
430
  // Mount lifecycle hooks
357
431
  beforeMount() {
358
432
  e("Hook > beforeMount()", Array.from(arguments));
359
433
  },
360
- onCreateEntry({ parent: o2, entry: i }) {
361
- if (s(this.settings.condition, i)) {
362
- const c = o2.collection.length;
434
+ onCreateEntry({ parent: n, entry: s }) {
435
+ if (h$2(this.config.condition, s)) {
436
+ const c2 = n.collection.length;
363
437
  e(
364
- `Hook > onCreateEntry() > [${c}] #${i.id}`,
438
+ `Hook > onCreateEntry() > [${c2}] #${s.id}`,
365
439
  Array.from(arguments)
366
440
  );
367
441
  }
368
442
  },
369
- onRegisterEntry({ parent: o2, entry: i }) {
370
- if (s(this.settings.condition, i)) {
371
- const c = o2.collection.length - 1;
443
+ onRegisterEntry({ parent: n, entry: s }) {
444
+ if (h$2(this.config.condition, s)) {
445
+ const c2 = n.collection.length - 1;
372
446
  e(
373
- `Hook > onRegisterEntry() > [${c}] #${i.id}`,
447
+ `Hook > onRegisterEntry() > [${c2}] #${s.id}`,
374
448
  Array.from(arguments)
375
449
  );
376
450
  }
@@ -385,20 +459,20 @@ function Z(n = {}) {
385
459
  "neutral"
386
460
  ]);
387
461
  },
388
- onDestroyEntry({ parent: o2, entry: i }) {
389
- if (s(this.settings.condition, i)) {
390
- const c = o2.collection.length - 1;
462
+ onDestroyEntry({ parent: n, entry: s }) {
463
+ if (h$2(this.config.condition, s)) {
464
+ const c2 = n.collection.length - 1;
391
465
  e(
392
- `Hook > onDestroyEntry() > [${c}] #${i.id}`,
466
+ `Hook > onDestroyEntry() > [${c2}] #${s.id}`,
393
467
  Array.from(arguments),
394
468
  ["important", "neutral"]
395
469
  );
396
470
  }
397
471
  },
398
- onDeregisterEntry({ parent: o2, entry: i }) {
399
- if (s(this.settings.condition, i)) {
400
- const c = o2.collection.length;
401
- e(`Hook > onDeregisterEntry() > [${c}]`, Array.from(arguments), [
472
+ onDeregisterEntry({ parent: n, entry: s }) {
473
+ if (h$2(this.config.condition, s)) {
474
+ const c2 = n.collection.length;
475
+ e(`Hook > onDeregisterEntry() > [${c2}]`, Array.from(arguments), [
402
476
  "important",
403
477
  "neutral"
404
478
  ]);
@@ -412,43 +486,40 @@ function Z(n = {}) {
412
486
  }
413
487
  } };
414
488
  }
415
- const q$3 = {
489
+ const F$1 = {
416
490
  condition: true
417
491
  };
418
- function _$1(n = {}) {
492
+ function et$1(i = {}) {
419
493
  const t = {
420
494
  name: "focusTrap",
421
- defaults: q$3,
422
- options: n
495
+ config: F$1,
496
+ options: i
423
497
  }, e = {
424
- setup({ parent: o2 }) {
425
- o2.on("opened", r2, this), o2.on("closed", a2, this);
498
+ setup(n) {
499
+ n.on("opened", o, this), n.on("closed", r2, this);
426
500
  },
427
- teardown({ parent: o2 }) {
428
- o2.off("opened", r2), o2.off("closed", a2);
501
+ teardown(n) {
502
+ n.off("opened", o), n.off("closed", r2);
429
503
  },
430
- onCreateEntry({ entry: o2 }) {
431
- o2.focusTrap = new U$2();
504
+ onCreateEntry({ entry: n }) {
505
+ n.focusTrap = new D$2();
432
506
  }
433
507
  };
434
- function s(o2, ...i) {
435
- return typeof o2 == "function" ? o2(...i) : o2;
508
+ function o(n, s) {
509
+ const c2 = { plugin: s, parent: n.parent, entry: n };
510
+ n.focusTrap && h$2(s.config.condition, c2) && n.focusTrap.on(n.dialog);
436
511
  }
437
- function r2(o2, i) {
438
- const c = { plugin: i, parent: o2.parent, entry: o2 };
439
- s(i.settings.condition, c) && o2.focusTrap?.on(o2.dialog);
440
- }
441
- function a2(o2, i) {
442
- const c = { plugin: i, parent: o2.parent, entry: o2 };
443
- s(i.settings.condition, c) && o2.focusTrap?.off();
512
+ function r2(n, s) {
513
+ const c2 = { plugin: s, parent: n.parent, entry: n };
514
+ n.focusTrap && h$2(s.config.condition, c2) && n.focusTrap.off();
444
515
  }
445
516
  return { ...t, ...e };
446
517
  }
447
- const F$1 = {
518
+ const V = {
448
519
  // The data attributes to get the breakpoint values from
449
- dataBreakpoint: "breakpoint",
520
+ attrBreakpoint: "breakpoint",
450
521
  // The data attributes to get the media query value from
451
- dataMediaQuery: "media-query",
522
+ attrMediaQuery: "media-query",
452
523
  // The string token to replace in the media query string
453
524
  token: "{{BP}}",
454
525
  // Sets a global breakpoint. Can be overridden by setting a data attribute
@@ -469,47 +540,47 @@ const F$1 = {
469
540
  onChange: () => {
470
541
  }
471
542
  };
472
- function X$1(n = {}) {
543
+ function ot$1(i = {}) {
473
544
  const t = {
474
545
  name: "mediaQuery",
475
- defaults: F$1,
476
- options: n
546
+ config: V,
547
+ options: i
477
548
  }, e = {
478
549
  // Run when an entry is created
479
550
  // Sets up the MediaQueryList and event listener
480
- onCreateEntry({ entry: i }) {
481
- a2.call(this, i);
551
+ onCreateEntry({ entry: c2 }) {
552
+ n.call(this, c2);
482
553
  },
483
554
  // Run when an entry is destroyed
484
555
  // Removes the MediaQueryList and event listener
485
- onDestroyEntry({ entry: i }) {
486
- o2(i);
556
+ onDestroyEntry({ entry: c2 }) {
557
+ s(c2);
487
558
  }
488
559
  };
489
- function s(i) {
490
- const c = i.el.getAttribute(`data-${this.settings.dataMediaQuery}`);
491
- return !c && i.id in this.settings.mediaQueries ? this.settings.mediaQueries[i.id] : c || void 0;
492
- }
493
- function r2(i) {
494
- let c = i.el.getAttribute(`data-${this.settings.dataBreakpoint}`);
495
- return !c && i.id in this.settings.breakpoints && (c = this.settings.breakpoints[i.id]), c && c in this.settings.breakpoints && (c = this.settings.breakpoints[c]), c && (c = getComputedStyle(document.body).getPropertyValue(`--${y$2()}breakpoint-${c}`).trim() || c), c || this.settings.breakpoint;
496
- }
497
- function a2(i) {
498
- let c = s.call(this, i);
499
- const l2 = r2.call(this, i);
500
- if (!l2 && !c) return;
501
- l2 && !c && (c = this.settings.mediaQuery);
502
- const d2 = c.replace(new RegExp(`${this.settings.token}`, "g"), l2);
503
- i.mql = window.matchMedia(d2), i.mql.onchange = (p2) => {
504
- this.settings.onChange(p2, i);
505
- }, this.settings.onChange(i.mql, i);
506
- }
507
- function o2(i) {
508
- i.mql && (i.mql.onchange = null, i.mql = null);
560
+ function o(c2) {
561
+ const a2 = c2.el.getAttribute(`data-${this.config.attrMediaQuery}`);
562
+ return !a2 && c2.id in this.config.mediaQueries ? this.config.mediaQueries[c2.id] : a2 || void 0;
563
+ }
564
+ function r2(c2) {
565
+ let a2 = c2.el.getAttribute(`data-${this.config.attrBreakpoint}`);
566
+ return !a2 && c2.id in this.config.breakpoints && (a2 = this.config.breakpoints[c2.id]), a2 && a2 in this.config.breakpoints && (a2 = this.config.breakpoints[a2]), a2 && (a2 = getComputedStyle(document.body).getPropertyValue(`--${y$2()}breakpoint-${a2}`).trim() || a2), a2 || this.config.breakpoint;
567
+ }
568
+ function n(c2) {
569
+ const a2 = r2.call(this, c2);
570
+ if (!a2) return;
571
+ let f2 = o.call(this, c2) || this.config.mediaQuery;
572
+ if (!f2) return;
573
+ const p2 = f2.replace(new RegExp(`${this.config.token}`, "g"), a2);
574
+ c2.mql = window.matchMedia(p2), c2.mql.onchange = (E2) => {
575
+ this.config.onChange(E2, c2);
576
+ }, this.config.onChange(c2.mql, c2);
577
+ }
578
+ function s(c2) {
579
+ c2.mql && (c2.mql.onchange = null, c2.mql = null);
509
580
  }
510
581
  return { ...t, ...e };
511
582
  }
512
- const V$1 = {
583
+ const B = {
513
584
  // The property on entry objects to watch
514
585
  prop: "state",
515
586
  // The default value or a function to compute the initial value
@@ -525,280 +596,250 @@ const V$1 = {
525
596
  onChange() {
526
597
  }
527
598
  };
528
- function Y$1(n = {}) {
599
+ function nt$1(i = {}) {
529
600
  const t = {
530
601
  name: "propStore",
531
- defaults: V$1,
532
- options: n,
602
+ config: B,
603
+ options: i,
533
604
  store: null
534
605
  }, e = {
535
- setup({ parent: i }) {
536
- this.store = w$2(o2.call(this, i.module));
606
+ setup(s) {
607
+ this.store = w$2(n.call(this, s.name));
537
608
  },
538
- async onCreateEntry({ entry: i }) {
539
- await s.call(this, i);
609
+ async onCreateEntry({ entry: s }) {
610
+ await o.call(this, s);
540
611
  },
541
- onDestroyEntry({ entry: i }) {
542
- a2.call(this, i);
612
+ onDestroyEntry({ entry: s }) {
613
+ r2.call(this, s);
543
614
  }
544
615
  };
545
- async function s(i) {
546
- let c = i[this.settings.prop] || null;
547
- const l2 = { plugin: this, parent: i.parent, entry: i };
548
- Object.defineProperty(i, this.settings.prop, {
616
+ async function o(s) {
617
+ let c2 = s[this.config.prop] || null;
618
+ const a2 = { plugin: this, parent: s.parent, entry: s };
619
+ Object.defineProperty(s, this.config.prop, {
549
620
  configurable: true,
550
621
  get() {
551
- return c;
622
+ return c2;
552
623
  },
553
- set: async (d2) => {
554
- if (c === d2) return;
555
- const p2 = c;
556
- c = d2, r2(
557
- this.settings.condition,
558
- l2,
559
- d2,
624
+ set: async (f2) => {
625
+ if (c2 === f2) return;
626
+ const p2 = c2;
627
+ c2 = f2, h$2(
628
+ this.config.condition,
629
+ a2,
630
+ f2,
560
631
  p2
561
- ) && this.store.set(i.id, d2), await this.settings.onChange(l2, d2, p2);
632
+ ) && this.store?.set(s.id, f2), await this.config.onChange(a2, f2, p2);
562
633
  }
563
- }), Object.defineProperty(i, "store", {
634
+ }), Object.defineProperty(s, "store", {
564
635
  configurable: true,
565
- get: () => this.store.get(i.id),
566
- set: (d2) => {
567
- i[this.settings.prop] = d2;
636
+ get: () => this.store?.get(s.id),
637
+ set: (f2) => {
638
+ s[this.config.prop] = f2;
568
639
  }
569
- }), i[this.settings.prop] = await r2(this.settings.value, l2) || i[this.settings.prop];
640
+ }), s[this.config.prop] = await h$2(this.config.value, a2) || s[this.config.prop];
570
641
  }
571
- function r2(i, ...c) {
572
- return typeof i == "function" ? i(...c) : i;
642
+ async function r2(s) {
643
+ const c2 = s[this.config.prop];
644
+ delete s[this.config.prop], s[this.config.prop] = c2, this.store?.set(s.id, null);
573
645
  }
574
- async function a2(i) {
575
- const c = i[this.settings.prop];
576
- delete i[this.settings.prop], i[this.settings.prop] = c, this.store.set(i.id, null);
577
- }
578
- function o2(i) {
579
- const c = this.settings.prop.charAt(0).toUpperCase() + this.settings.prop.slice(1), l2 = this.settings.key || i + c;
580
- return this.settings.keyPrefix + l2;
646
+ function n(s) {
647
+ const c2 = this.config.prop.charAt(0).toUpperCase() + this.config.prop.slice(1), a2 = this.config.key || s + c2;
648
+ return this.config.keyPrefix + a2;
581
649
  }
582
650
  return { ...t, ...e };
583
651
  }
584
- const B = {
652
+ const j$1 = {
585
653
  where: null,
586
654
  how: "append"
587
655
  };
588
- function tt$1(n = {}) {
656
+ function it$1(i = {}) {
589
657
  const t = {
590
658
  name: "teleport",
591
- defaults: B,
592
- options: n
659
+ config: j$1,
660
+ options: i
593
661
  }, e = {
594
- onCreateEntry({ plugin: a2, entry: o2 }) {
595
- s(a2, o2);
662
+ onCreateEntry({ entry: n }) {
663
+ o(this, n);
596
664
  },
597
- onDestroyEntry({ plugin: a2, entry: o2 }) {
598
- r2(a2, o2);
665
+ onDestroyEntry({ entry: n }) {
666
+ r2(this, n);
599
667
  }
600
668
  };
601
- function s(a2, o2) {
602
- o2.teleport = () => {
603
- typeof o2.teleportReturn == "function" && o2.teleportReturn(), o2.teleportReturn = x$2(
604
- o2.el,
605
- o2.getSetting("teleport", { fallback: a2.settings.where }),
606
- o2.getSetting("teleportMethod", { fallback: a2.settings.how })
669
+ function o(n, s) {
670
+ s.teleport = () => {
671
+ typeof s.teleportReturn == "function" && s.teleportReturn(), s.teleportReturn = k$3(
672
+ s.el,
673
+ s.config.get("teleport", { fallback: n.config.where }),
674
+ s.config.get("teleportMethod", { fallback: n.config.how })
607
675
  );
608
- }, o2.teleport(), o2.parent.emit("teleport", { plugin: a2, parent: o2.parent, entry: o2 });
676
+ }, s.teleport(), s.parent.emit("teleport", { plugin: n, parent: s.parent, entry: s });
609
677
  }
610
- function r2(a2, o2) {
611
- typeof o2.teleportReturn == "function" && o2.teleportReturn(), o2.parent.emit("teleportReturn", {
612
- plugin: a2,
613
- parent: o2.parent,
614
- entry: o2
678
+ function r2(n, s) {
679
+ typeof s.teleportReturn == "function" && s.teleportReturn(), s.parent.emit("teleportReturn", {
680
+ plugin: n,
681
+ parent: s.parent,
682
+ entry: s
615
683
  });
616
684
  }
617
685
  return { ...t, ...e };
618
686
  }
619
- const j$3 = {
620
- dataConfig: "config",
621
- customProps: []
622
- };
623
- let z$3 = class z {
624
- constructor(t, e, s = {}) {
625
- this.parent = t, this.el = E$3(e), this.settings = { ...s }, this.dataConfig = {}, this.customProps = {};
626
- }
627
- get id() {
628
- return this.el.id;
629
- }
630
- applySettings(t) {
631
- return Object.assign(this.settings, t);
632
- }
633
- getSetting(t, e) {
634
- return A$2.call(this, t, e);
635
- }
636
- buildDataConfig() {
637
- return Object.assign(
638
- this.dataConfig,
639
- C$2(this.el, this.getSetting("dataConfig"))
640
- );
641
- }
642
- buildCustomProps() {
643
- return Object.assign(this.customProps, M$2(this));
644
- }
645
- async init(t = {}) {
646
- this.applySettings(t), this.buildDataConfig(), this.buildCustomProps();
647
- }
648
- async destroy() {
649
- Object.getOwnPropertyNames(this).forEach((t) => {
650
- delete this[t];
651
- });
687
+ let z$1 = class z {
688
+ constructor(t, e) {
689
+ this.config = new I$3(), this.parent = t, this.el = v$2(e), this.id = this.el.id, this.config.set("parent", this.parent.config), this.config.set("entry", {});
652
690
  }
653
691
  };
654
- let et$1 = class et {
692
+ const J$1 = {
693
+ selector: "",
694
+ plugins: [],
695
+ presets: {}
696
+ };
697
+ let st$1 = class st {
655
698
  constructor(t = {}) {
656
- this.module = this.constructor.name, this.collection = [], this.entryClass = z$3, this.settings = { ...j$3, ...t }, this.plugins = new H$3(this.settings.presets), this.events = {}, Object.assign(this, L$2);
699
+ this.#t = new L$2(), this.events = this.#t.events, this.on = this.#t.on.bind(this.#t), this.off = this.#t.off.bind(this.#t), this.emit = this.#t.emit.bind(this.#t), this.collection = [], this.entryClass = z$1, this.name = this.constructor.name, this.config = { ...J$1, ...t }, this.plugins = new H(this.config.presets);
657
700
  }
701
+ #t;
658
702
  get(t, e = "id") {
659
- return this.collection.find((s) => s[e] === t);
703
+ return this.collection.find((o) => o[e] === t);
704
+ }
705
+ getOrThrow(t, e = "id") {
706
+ const o = this.get(t, e);
707
+ if (o)
708
+ return o;
709
+ throw new Error(
710
+ `${this.name} entry not found in collection with ${String(e)} of "${t}"`
711
+ );
660
712
  }
661
- applySettings(t) {
662
- return Object.assign(this.settings, t);
713
+ updateConfig(t = {}) {
714
+ return Object.assign(this.config, t);
663
715
  }
664
- async createEntry(t, e) {
665
- const s = new this.entryClass(this, t, e);
666
- return await g$1(s, "init"), await h$1("onCreateEntry", this, s), s;
716
+ async createEntry(t) {
717
+ const e = new this.entryClass(this, t);
718
+ return await g$2(e, "init"), await d$1("onCreateEntry", this, e), e;
667
719
  }
668
720
  async destroyEntry(t) {
669
- return await h$1("onDestroyEntry", this, t), await g$1(t, "destroy"), t;
670
- }
671
- async register(t, e = {}) {
672
- const s = E$3(t), r2 = this.collection.findIndex((a2) => a2.id === s.id);
673
- if (~r2) {
674
- const a2 = this.collection[r2];
675
- return a2.el = s, typeof a2.init == "function" && await a2.init(e), a2;
676
- } else {
677
- const a2 = await this.createEntry(s, e);
678
- return this.collection.push(a2), await h$1("onRegisterEntry", this, a2), a2;
679
- }
721
+ return await d$1("onDestroyEntry", this, t), await g$2(t, "destroy"), t;
722
+ }
723
+ async register(t) {
724
+ const e = this.collection.findIndex((o) => o.id === t.id);
725
+ return ~e ? this.collection[e] = t : this.collection.push(t), await d$1("onRegisterEntry", this, t), t;
680
726
  }
681
727
  async deregister(t) {
682
- const e = this.collection.findIndex((s) => s.id === t);
728
+ const e = this.collection.findIndex((o) => o.id === t.id);
683
729
  if (~e) {
684
- const s = await this.destroyEntry(this.collection[e]);
685
- return await h$1(
730
+ await d$1(
686
731
  "onDeregisterEntry",
687
732
  this,
688
733
  this.collection[e]
689
- ), this.collection.splice(e, 1), s;
734
+ );
735
+ const [o] = this.collection.splice(e, 1);
690
736
  }
691
- return null;
737
+ return t;
692
738
  }
693
- async mount(t = {}) {
694
- this.applySettings(t);
695
- for (const s of this.settings?.plugins || [])
696
- this.plugins.add(s);
697
- for (const s of this.plugins)
698
- await g$1(s, "setup", { plugin: s, parent: this });
699
- await h$1("beforeMount", this);
700
- const e = document.querySelectorAll(this.settings.selector);
701
- for (const s of e)
702
- await this.register(s);
703
- return await h$1("afterMount", this), this;
704
- }
705
- async unmount() {
706
- for (await h$1("beforeUnmount", this); this.collection.length > 0; )
707
- await this.deregister(this.collection[0].id);
708
- await h$1("afterUnmount", this);
709
- for (const t of this.plugins)
710
- await g$1(t, "teardown", { plugin: t, parent: this });
711
- for (const t of [...this.plugins])
712
- this.plugins.remove(t.name);
739
+ async mount(t = (e) => e) {
740
+ for (const e of this.config?.plugins || [])
741
+ this.plugins.add(e);
742
+ for (const e of this.plugins)
743
+ await g$2(e, "setup", this);
744
+ if (await d$1("beforeMount", this), this.config.selector) {
745
+ const e = document.querySelectorAll(this.config.selector);
746
+ for (const o of e)
747
+ await this.createEntry(o).then((r2) => t(r2)).then((r2) => this.register(r2));
748
+ }
749
+ return await d$1("afterMount", this), this;
750
+ }
751
+ async unmount(t = (e) => e) {
752
+ for (await d$1("beforeUnmount", this); this.collection.length > 0; )
753
+ await this.destroyEntry(this.collection[0]).then((e) => t(e)).then((e) => this.deregister(e));
754
+ await d$1("afterUnmount", this);
755
+ for (const e of this.plugins)
756
+ await g$2(e, "teardown", this);
757
+ for (const e of [...this.plugins])
758
+ this.plugins.remove(e.name);
713
759
  return this;
714
760
  }
715
761
  };
716
- function nt$1(n = {}) {
717
- const t = {
718
- prefix: R$2("prefix-themes", { fallback: "vb-theme-" }),
719
- themes: ["root", "light", "dark"],
720
- storeKey: "VB:Profile"
721
- };
722
- for (const [a2] of Object.entries(t))
723
- n && n[a2] && (t[a2] = n[a2]);
724
- const e = {
725
- onInit() {
726
- },
727
- onChange() {
728
- }
729
- };
730
- for (const [a2] of Object.entries(e))
731
- n && n[a2] && (e[a2] = n[a2]);
732
- const s = w$2(t.storeKey), r2 = {
733
- // Store our settings in the API
734
- settings: t,
762
+ const G = {
763
+ prefix: S$3("theme-prefix", { fallback: "vb-theme-" }),
764
+ storeKey: "VB:Profile",
765
+ fallback: "root",
766
+ themes: ["root", "light", "dark"],
767
+ onInit() {
768
+ },
769
+ onChange() {
770
+ }
771
+ };
772
+ function rt$1(i = {}) {
773
+ const t = { ...G, ...i };
774
+ function e(n) {
775
+ t[n].call(r2);
776
+ }
777
+ const o = w$2(t.storeKey), r2 = {
778
+ // Store our config in the API
779
+ config: t,
735
780
  // Actions
736
- add(a2) {
737
- t.themes.push(a2);
738
- },
739
- remove(a2) {
740
- const o2 = t.themes.indexOf(a2);
741
- ~o2 && t.themes.splice(o2, 1);
781
+ add(n) {
782
+ t.themes.push(n);
742
783
  },
743
- callback(a2) {
744
- e[a2].call(this);
784
+ remove(n) {
785
+ const s = t.themes.indexOf(n);
786
+ ~s && t.themes.splice(s, 1);
745
787
  },
746
788
  // Getters
747
789
  get class() {
748
790
  return `${t.prefix}${this.theme}`;
749
791
  },
750
792
  get classes() {
751
- return t.themes.map((a2) => `${t.prefix}${a2}`);
793
+ return t.themes.map((n) => `${t.prefix}${n}`);
752
794
  },
753
795
  get themes() {
754
796
  return t.themes;
755
797
  },
756
798
  // Setup the theme get and set methods
757
799
  get theme() {
758
- return s.get("theme") || "root";
800
+ return o.get("theme") || t.fallback;
759
801
  },
760
- set theme(a2) {
761
- t.themes.includes(a2) ? this.theme != a2 && (s.set("theme", a2), document.documentElement.classList.remove(...this.classes), document.documentElement.classList.add(`${t.prefix}${a2}`), this.callback("onChange")) : console.error(`Not a valid theme value: "${a2}"`);
802
+ set theme(n) {
803
+ t.themes.includes(n) ? this.theme != n && (o.set("theme", n), document.documentElement.classList.remove(...this.classes), document.documentElement.classList.add(`${t.prefix}${n}`), e("onChange")) : console.error(`Not a valid theme value: "${n}"`);
762
804
  }
763
805
  };
764
- return r2.callback("onInit"), r2;
806
+ return e("onInit"), r2;
765
807
  }
766
808
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
767
809
  __proto__: null,
768
- Collection: et$1,
769
- CollectionEntry: z$3,
770
- FocusTrap: U$2,
771
- FocusableArray: O$2,
772
- PluginsArray: H$3,
773
- StackArray: W,
774
- cssVar: R$2,
775
- debug: Z,
776
- dispatchLifecycleHook: h$1,
777
- eventEmitter: L$2,
778
- focusTrap: _$1,
779
- focusableSelectors: k$3,
780
- getCustomProps: M$2,
781
- getDataConfig: C$2,
782
- getElement: E$3,
810
+ Collection: st$1,
811
+ CollectionEntry: z$1,
812
+ ConfigManager: I$3,
813
+ EventEmitter: L$2,
814
+ FocusTrap: D$2,
815
+ FocusableArray: U$1,
816
+ PluginArray: H,
817
+ StackArray: _,
818
+ attrConfig: X$1,
819
+ cssConfig: Y$1,
820
+ cssVar: S$3,
821
+ debug: tt$1,
822
+ dispatchLifecycleHook: d$1,
823
+ focusTrap: et$1,
824
+ focusableSelectors: C$2,
825
+ getAttrData: x$2,
826
+ getCustomProps: b$2,
827
+ getElement: v$2,
783
828
  getPrefix: y$2,
784
- getSetting: A$2,
829
+ getValue: h$2,
785
830
  localStore: w$2,
786
- maybeRunMethod: g$1,
787
- mediaQuery: X$1,
788
- propStore: Y$1,
789
- setGlobalState: G,
790
- teleport: tt$1,
791
- teleportElement: x$2,
792
- themeStore: nt$1,
793
- toCamel: v$2,
794
- toKebab: $$2,
795
- toMilliseconds: S$2,
796
- transition: J$1
831
+ maybeRunMethod: g$2,
832
+ mediaQuery: ot$1,
833
+ propStore: nt$1,
834
+ setGlobalState: Z,
835
+ teleport: it$1,
836
+ teleportElement: k$3,
837
+ themeStore: rt$1,
838
+ toCamel: R$1,
839
+ toKebab: M$2,
840
+ toMilliseconds: A$3,
841
+ transition: W$1
797
842
  }, Symbol.toStringTag, { value: "Module" }));
798
- function b$1(t, e = "config") {
799
- const s = (t.getAttribute(`data-${e}`) || "").replace(/'/g, '"');
800
- return s ? JSON.parse(s) : {};
801
- }
802
843
  function p$1(t) {
803
844
  if (typeof t == "string") {
804
845
  const e = document.getElementById(t);
@@ -814,15 +855,7 @@ function p$1(t) {
814
855
  async function r$1(t, e, ...s) {
815
856
  e in t && typeof t[e] == "function" && await t[e](...s);
816
857
  }
817
- function C$1(t) {
818
- return t.split("-").map(
819
- (e, s) => s === 0 ? e : e.charAt(0).toUpperCase() + e.slice(1)
820
- ).join("");
821
- }
822
- function m$1(t) {
823
- return t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
824
- }
825
- function L$1(t) {
858
+ function w$1(t) {
826
859
  if (typeof t == "number")
827
860
  return t;
828
861
  const e = parseFloat(t);
@@ -832,96 +865,127 @@ function L$1(t) {
832
865
  }
833
866
  throw new Error(`Could not convert value to milliseconds: ${t}`);
834
867
  }
835
- function w$1(t, e, s, i, n = 0) {
836
- return new Promise((a2) => {
868
+ function f(t, e, s, i, o = 0) {
869
+ return new Promise((n) => {
837
870
  t.classList.remove(e), t.classList.add(s), setTimeout(() => {
838
- t.classList.add(i), t.classList.remove(s), a2(t);
839
- }, L$1(n));
871
+ t.classList.add(i), t.classList.remove(s), n(t);
872
+ }, w$1(o));
840
873
  });
841
874
  }
842
- async function o(t, e, s) {
875
+ function v$1(t, e = {}) {
876
+ const s = {
877
+ fallback: null,
878
+ element: document.body,
879
+ ...e
880
+ };
881
+ if (!t.startsWith("--")) {
882
+ const o = E$1();
883
+ o && (t = `${o}${t}`), t = `--${t}`;
884
+ }
885
+ const i = getComputedStyle(s.element).getPropertyValue(t).trim();
886
+ if (i)
887
+ return i;
888
+ if (s.fallback)
889
+ return s.fallback;
890
+ throw new Error(`CSS variable "${t}" was not found!`);
891
+ }
892
+ async function a$1(t, e, s) {
843
893
  await r$1(e, t, s), s && await r$1(s, t);
844
894
  for (const i of e.plugins)
845
- await r$1(i, t, { plugin: i, parent: e, entry: s });
846
- await e.emit(t, s);
847
- }
848
- function O$1(t) {
849
- const e = getComputedStyle(t.el), s = {}, i = t.getSetting("customProps");
850
- for (let n = 0; n < i.length; n++) {
851
- const a2 = M$1(), c = t.parent.module.toLowerCase(), h2 = m$1(i[n]), f2 = e.getPropertyValue(`--${a2}${c}-${h2}`).trim();
852
- f2 && (s[h2] = f2);
853
- }
854
- return s;
895
+ await r$1(i, t, { parent: e, entry: s });
896
+ await e.emit(t, { parent: e, entry: s });
855
897
  }
856
- function M$1() {
898
+ function E$1() {
857
899
  return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim();
858
900
  }
859
- function $$1(t, e, s = "camel") {
860
- return e = s === "camel" ? C$1(e) : m$1(e), t.split(".").concat(e).reduce((i, n) => i?.[n], this);
861
- }
862
- function P$2(t, e = {}) {
863
- const {
864
- fallback: s,
865
- props: i = ["dataConfig", "customProps", "settings", "parent.settings"]
866
- } = e;
867
- for (const n of i) {
868
- const a2 = n !== "customProps" ? "camel" : "kebab", c = $$1.call(this, n, t, a2);
869
- if (c !== void 0)
870
- return c;
871
- }
872
- if (s !== void 0)
873
- return s;
874
- throw new Error(`${this.parent.module} setting does not exist: ${t}`);
875
- }
876
- function x$1(t, e) {
901
+ function b$1(t, e) {
877
902
  e && document.querySelectorAll(e).forEach((s) => {
878
903
  t ? s.style.overflow = "hidden" : s.style.removeProperty("overflow");
879
904
  });
880
905
  }
881
- function A$1(t, e) {
906
+ function C$1(t, e) {
882
907
  e && document.querySelectorAll(e).forEach((s) => {
883
- t ? (s.inert = true, s.setAttribute("aria-hidden", "true")) : (s.inert = false, s.removeAttribute("aria-hidden"));
908
+ s.inert = t;
884
909
  });
885
910
  }
886
- function d$1(t, e, s) {
887
- A$1(!!t, e), x$1(!!t, s);
911
+ function c$1(t, e, s) {
912
+ C$1(!!t, e), b$1(!!t, s);
888
913
  }
889
- const D$2 = {
890
- events: {},
891
- on(t, e, ...s) {
892
- this.events[t] || (this.events[t] = []), this.events[t].some(
893
- (i) => i.listener === e
894
- ) || this.events[t].push({ listener: e, args: s });
895
- },
896
- off(t, e) {
897
- this.events[t] && (this.events[t] = this.events[t].filter(
898
- (s) => s.listener !== e
914
+ let S$2 = class S {
915
+ #t;
916
+ #e;
917
+ constructor() {
918
+ this.#t = {}, this.#e = [];
919
+ }
920
+ get(e, s) {
921
+ const { fallback: i, source: o } = s ?? {};
922
+ if (o) {
923
+ const n = this.#t?.[o]?.[e];
924
+ if (n !== void 0)
925
+ return n;
926
+ } else
927
+ for (const n of this.#e) {
928
+ const d2 = this.#t?.[n]?.[e];
929
+ if (d2 !== void 0)
930
+ return d2;
931
+ }
932
+ if (i !== void 0)
933
+ return i;
934
+ throw new Error(`Config does not exist: ${e}`);
935
+ }
936
+ set(e, s = {}) {
937
+ let i, o;
938
+ return typeof e == "string" ? (i = e, o = s) : (i = "entry", o = e), this.#t[i] ? Object.assign(this.#t[i], o) : (this.#e.unshift(i), this.#t[i] = o), this.#t[i];
939
+ }
940
+ remove(e) {
941
+ const s = this.#e.indexOf(e);
942
+ s !== -1 && this.#e.splice(s, 1), delete this.#t[e];
943
+ }
944
+ setSourceOrder(e) {
945
+ const s = Object.keys(this.#t).reverse(), i = e.filter((o) => s.includes(o));
946
+ for (const o of s)
947
+ i.includes(o) || i.push(o);
948
+ return this.#e = i;
949
+ }
950
+ };
951
+ let O$1 = class O {
952
+ constructor() {
953
+ this.events = {};
954
+ }
955
+ on(e, s, ...i) {
956
+ this.events[e] || (this.events[e] = []), this.events[e].some(
957
+ (o) => o.listener === s
958
+ ) || this.events[e].push({ listener: s, args: i });
959
+ }
960
+ off(e, s) {
961
+ this.events[e] && (this.events[e] = this.events[e].filter(
962
+ (i) => i.listener !== s
899
963
  ));
900
- },
901
- async emit(t, e) {
902
- if (t = t.startsWith("on") ? t.slice(2, 3).toLowerCase() + t.slice(3) : t, !!this.events[t])
903
- for (const { listener: s, args: i } of this.events[t])
904
- await s(e, ...i);
964
+ }
965
+ async emit(e, ...s) {
966
+ if (e = e.startsWith("on") ? e.slice(2, 3).toLowerCase() + e.slice(3) : e, !!this.events[e])
967
+ for (const { listener: i, args: o } of this.events[e])
968
+ await i(...s, ...o);
905
969
  }
906
970
  };
907
- let y$1 = class y extends Array {
971
+ let L$1 = class L2 extends Array {
908
972
  constructor(e = {}) {
909
973
  super(), this.presets = e;
910
974
  }
911
- applySettings(e) {
912
- const s = e?.defaults || {}, i = this.presets?.[e.name] || {}, n = e?.options || {};
913
- e.settings = { ...s, ...i, ...n };
975
+ #t(e) {
976
+ const s = this.presets?.[e.name] || {}, i = e?.options || {};
977
+ e.config = { ...e.config, ...s, ...i };
914
978
  }
915
- validate(e) {
979
+ #e(e) {
916
980
  return !("name" in e) || typeof e.name != "string" ? (console.error("Plugin requires a name!"), false) : true;
917
981
  }
918
982
  get(e) {
919
- return this.find((s) => s.name === e);
983
+ return this.find((s) => s.name === e) || null;
920
984
  }
921
985
  add(e) {
922
986
  if (Array.isArray(e))
923
987
  e.forEach((s) => this.add(s));
924
- else if (this.applySettings(e), this.validate(e)) {
988
+ else if (this.#t(e), this.#e(e)) {
925
989
  const s = this.findIndex((i) => i.name === e.name);
926
990
  ~s ? this[s] = e : this.push(e);
927
991
  }
@@ -931,104 +995,83 @@ let y$1 = class y extends Array {
931
995
  ~s && this.splice(s, 1);
932
996
  }
933
997
  };
934
- const I$2 = {
935
- dataConfig: "config",
936
- customProps: []
937
- };
938
- let S$1 = class S {
939
- constructor(e, s, i = {}) {
940
- this.parent = e, this.el = p$1(s), this.settings = { ...i }, this.dataConfig = {}, this.customProps = {};
941
- }
942
- get id() {
943
- return this.el.id;
944
- }
945
- applySettings(e) {
946
- return Object.assign(this.settings, e);
947
- }
948
- getSetting(e, s) {
949
- return P$2.call(this, e, s);
950
- }
951
- buildDataConfig() {
952
- return Object.assign(
953
- this.dataConfig,
954
- b$1(this.el, this.getSetting("dataConfig"))
955
- );
956
- }
957
- buildCustomProps() {
958
- return Object.assign(this.customProps, O$1(this));
959
- }
960
- async init(e = {}) {
961
- this.applySettings(e), this.buildDataConfig(), this.buildCustomProps();
962
- }
963
- async destroy() {
964
- Object.getOwnPropertyNames(this).forEach((e) => {
965
- delete this[e];
966
- });
998
+ let g$1 = class g {
999
+ constructor(e, s) {
1000
+ this.config = new S$2(), this.parent = e, this.el = p$1(s), this.id = this.el.id, this.config.set("parent", this.parent.config), this.config.set("entry", {});
967
1001
  }
968
1002
  };
969
- let T$2 = class T {
1003
+ const M$1 = {
1004
+ selector: "",
1005
+ plugins: [],
1006
+ presets: {}
1007
+ };
1008
+ let x$1 = class x {
970
1009
  constructor(e = {}) {
971
- this.module = this.constructor.name, this.collection = [], this.entryClass = S$1, this.settings = { ...I$2, ...e }, this.plugins = new y$1(this.settings.presets), this.events = {}, Object.assign(this, D$2);
1010
+ this.#t = new O$1(), this.events = this.#t.events, this.on = this.#t.on.bind(this.#t), this.off = this.#t.off.bind(this.#t), this.emit = this.#t.emit.bind(this.#t), this.collection = [], this.entryClass = g$1, this.name = this.constructor.name, this.config = { ...M$1, ...e }, this.plugins = new L$1(this.config.presets);
972
1011
  }
1012
+ #t;
973
1013
  get(e, s = "id") {
974
1014
  return this.collection.find((i) => i[s] === e);
975
1015
  }
976
- applySettings(e) {
977
- return Object.assign(this.settings, e);
1016
+ getOrThrow(e, s = "id") {
1017
+ const i = this.get(e, s);
1018
+ if (i)
1019
+ return i;
1020
+ throw new Error(
1021
+ `${this.name} entry not found in collection with ${String(s)} of "${e}"`
1022
+ );
1023
+ }
1024
+ updateConfig(e = {}) {
1025
+ return Object.assign(this.config, e);
978
1026
  }
979
- async createEntry(e, s) {
980
- const i = new this.entryClass(this, e, s);
981
- return await r$1(i, "init"), await o("onCreateEntry", this, i), i;
1027
+ async createEntry(e) {
1028
+ const s = new this.entryClass(this, e);
1029
+ return await r$1(s, "init"), await a$1("onCreateEntry", this, s), s;
982
1030
  }
983
1031
  async destroyEntry(e) {
984
- return await o("onDestroyEntry", this, e), await r$1(e, "destroy"), e;
1032
+ return await a$1("onDestroyEntry", this, e), await r$1(e, "destroy"), e;
985
1033
  }
986
- async register(e, s = {}) {
987
- const i = p$1(e), n = this.collection.findIndex((a2) => a2.id === i.id);
988
- if (~n) {
989
- const a2 = this.collection[n];
990
- return a2.el = i, typeof a2.init == "function" && await a2.init(s), a2;
991
- } else {
992
- const a2 = await this.createEntry(i, s);
993
- return this.collection.push(a2), await o("onRegisterEntry", this, a2), a2;
994
- }
1034
+ async register(e) {
1035
+ const s = this.collection.findIndex((i) => i.id === e.id);
1036
+ return ~s ? this.collection[s] = e : this.collection.push(e), await a$1("onRegisterEntry", this, e), e;
995
1037
  }
996
1038
  async deregister(e) {
997
- const s = this.collection.findIndex((i) => i.id === e);
1039
+ const s = this.collection.findIndex((i) => i.id === e.id);
998
1040
  if (~s) {
999
- const i = await this.destroyEntry(this.collection[s]);
1000
- return await o(
1041
+ await a$1(
1001
1042
  "onDeregisterEntry",
1002
1043
  this,
1003
1044
  this.collection[s]
1004
- ), this.collection.splice(s, 1), i;
1045
+ );
1046
+ const [i] = this.collection.splice(s, 1);
1005
1047
  }
1006
- return null;
1048
+ return e;
1007
1049
  }
1008
- async mount(e = {}) {
1009
- this.applySettings(e);
1010
- for (const i of this.settings?.plugins || [])
1011
- this.plugins.add(i);
1012
- for (const i of this.plugins)
1013
- await r$1(i, "setup", { plugin: i, parent: this });
1014
- await o("beforeMount", this);
1015
- const s = document.querySelectorAll(this.settings.selector);
1016
- for (const i of s)
1017
- await this.register(i);
1018
- return await o("afterMount", this), this;
1019
- }
1020
- async unmount() {
1021
- for (await o("beforeUnmount", this); this.collection.length > 0; )
1022
- await this.deregister(this.collection[0].id);
1023
- await o("afterUnmount", this);
1024
- for (const e of this.plugins)
1025
- await r$1(e, "teardown", { plugin: e, parent: this });
1026
- for (const e of [...this.plugins])
1027
- this.plugins.remove(e.name);
1050
+ async mount(e = (s) => s) {
1051
+ for (const s of this.config?.plugins || [])
1052
+ this.plugins.add(s);
1053
+ for (const s of this.plugins)
1054
+ await r$1(s, "setup", this);
1055
+ if (await a$1("beforeMount", this), this.config.selector) {
1056
+ const s = document.querySelectorAll(this.config.selector);
1057
+ for (const i of s)
1058
+ await this.createEntry(i).then((o) => e(o)).then((o) => this.register(o));
1059
+ }
1060
+ return await a$1("afterMount", this), this;
1061
+ }
1062
+ async unmount(e = (s) => s) {
1063
+ for (await a$1("beforeUnmount", this); this.collection.length > 0; )
1064
+ await this.destroyEntry(this.collection[0]).then((s) => e(s)).then((s) => this.deregister(s));
1065
+ await a$1("afterUnmount", this);
1066
+ for (const s of this.plugins)
1067
+ await r$1(s, "teardown", this);
1068
+ for (const s of [...this.plugins])
1069
+ this.plugins.remove(s.name);
1028
1070
  return this;
1029
1071
  }
1030
1072
  };
1031
- const k$2 = {
1073
+ v$1("theme-prefix", { fallback: "vb-theme-" });
1074
+ const T$1 = {
1032
1075
  focusTrap: {
1033
1076
  condition: ({ entry: t }) => t.state === "closed" || t.state === "opened" && t.mode === "modal"
1034
1077
  },
@@ -1043,11 +1086,11 @@ const k$2 = {
1043
1086
  condition: ({ entry: t }) => ["opened", "closed", "indeterminate"].includes(t.state),
1044
1087
  onChange: ({ entry: t }) => t.applyState()
1045
1088
  }
1046
- }, j$2 = {
1047
- presets: k$2,
1048
- dataOpen: "drawer-open",
1049
- dataClose: "drawer-close",
1050
- dataToggle: "drawer-toggle",
1089
+ }, $$1 = {
1090
+ presets: T$1,
1091
+ attrOpen: "drawer-open",
1092
+ attrClose: "drawer-close",
1093
+ attrToggle: "drawer-toggle",
1051
1094
  selector: ".drawer",
1052
1095
  selectorDialog: ".drawer__dialog",
1053
1096
  selectorScreen: ".drawer",
@@ -1066,93 +1109,93 @@ const k$2 = {
1066
1109
  transition: true,
1067
1110
  transitionDuration: 300
1068
1111
  };
1069
- function q$2(t) {
1112
+ function k$2(t) {
1070
1113
  switch (t.mode) {
1071
1114
  case "inline":
1072
- return H$2(t);
1115
+ return D$1(t);
1073
1116
  case "modal":
1074
- return N$2(t);
1117
+ return I$2(t);
1075
1118
  default:
1076
1119
  throw new Error(`"${t.mode}" is not a valid drawer mode.`);
1077
1120
  }
1078
1121
  }
1079
- async function H$2(t) {
1080
- return t.el.classList.remove(t.getSetting("classModal")), t.dialog.removeAttribute("aria-modal"), d$1(
1122
+ async function D$1(t) {
1123
+ return t.el.classList.remove(t.config.get("classModal")), t.dialog.removeAttribute("aria-modal"), c$1(
1081
1124
  false,
1082
- t.getSetting("selectorInert"),
1083
- t.getSetting("selectorOverflow")
1125
+ t.config.get("selectorInert"),
1126
+ t.config.get("selectorOverflow")
1084
1127
  ), t.applyState(), t.el.dispatchEvent(
1085
- new CustomEvent(t.getSetting("customEventPrefix") + "switchMode", {
1128
+ new CustomEvent(t.config.get("customEventPrefix") + "switchMode", {
1086
1129
  detail: t.parent,
1087
1130
  bubbles: true
1088
1131
  })
1089
1132
  ), await t.parent.emit("switchMode", t), t;
1090
1133
  }
1091
- async function N$2(t) {
1092
- return t.el.classList.add(t.getSetting("classModal")), t.dialog.setAttribute("aria-modal", "true"), await t.close(false, false), t.el.dispatchEvent(
1093
- new CustomEvent(t.getSetting("customEventPrefix") + "switchMode", {
1134
+ async function I$2(t) {
1135
+ return t.el.classList.add(t.config.get("classModal")), t.dialog.setAttribute("aria-modal", "true"), await t.close(false, false), t.el.dispatchEvent(
1136
+ new CustomEvent(t.config.get("customEventPrefix") + "switchMode", {
1094
1137
  detail: t.parent,
1095
1138
  bubbles: true
1096
1139
  })
1097
1140
  ), await t.parent.emit("switchMode", t), t;
1098
1141
  }
1099
- function v$1(t) {
1100
- t.dialog && t.state === "opened" ? (t.dialog.querySelector(t.parent.settings.selectorFocus) || t.dialog).focus() : t.trigger && (t.trigger.focus(), t.trigger = null);
1142
+ function u$1(t) {
1143
+ t.dialog && t.state === "opened" ? (t.dialog.querySelector(t.config.get("selectorFocus")) || t.dialog).focus() : t.trigger && (t.trigger.focus(), t.trigger = null);
1101
1144
  }
1102
- async function u$1(t, e, s = true) {
1103
- return (t.state === "closed" || t.state === "indeterminate" || t.state === null) && (t.setState("opening"), e ?? t.getSetting("transition") ? await w$1(
1145
+ async function l$1(t, e, s = true) {
1146
+ return (t.state === "closed" || t.state === "indeterminate" || t.state === null) && (t.setState("opening"), e ?? t.config.get("transition") ? await f(
1104
1147
  t.el,
1105
- t.getSetting("stateClosed"),
1106
- t.getSetting("stateOpening"),
1107
- t.getSetting("stateOpened"),
1108
- t.getSetting("transitionDuration")
1109
- ) : (t.el.classList.add(t.getSetting("stateOpened")), t.el.classList.remove(t.getSetting("stateClosed"))), t.setState("opened"), t.mode === "modal" && d$1(
1148
+ t.config.get("stateClosed"),
1149
+ t.config.get("stateOpening"),
1150
+ t.config.get("stateOpened"),
1151
+ t.config.get("transitionDuration")
1152
+ ) : (t.el.classList.add(t.config.get("stateOpened")), t.el.classList.remove(t.config.get("stateClosed"))), t.setState("opened"), t.mode === "modal" && c$1(
1110
1153
  true,
1111
- t.getSetting("selectorInert"),
1112
- t.getSetting("selectorOverflow")
1113
- ), s && v$1(t), t.el.dispatchEvent(
1114
- new CustomEvent(t.getSetting("customEventPrefix") + "opened", {
1154
+ t.config.get("selectorInert"),
1155
+ t.config.get("selectorOverflow")
1156
+ ), s && u$1(t), t.el.dispatchEvent(
1157
+ new CustomEvent(t.config.get("customEventPrefix") + "opened", {
1115
1158
  detail: t.parent,
1116
1159
  bubbles: true
1117
1160
  })
1118
1161
  ), await t.parent.emit("opened", t)), t;
1119
1162
  }
1120
- async function g(t, e, s = true) {
1121
- return (t.state === "opened" || t.state === "indeterminate" || t.state === null) && (t.setState("closing"), document.activeElement && document.activeElement instanceof HTMLElement && document.activeElement.blur(), e ?? t.getSetting("transition") ? await w$1(
1163
+ async function h$1(t, e, s = true) {
1164
+ return (t.state === "opened" || t.state === "indeterminate" || t.state === null) && (t.setState("closing"), document.activeElement && document.activeElement instanceof HTMLElement && document.activeElement.blur(), e ?? t.config.get("transition") ? await f(
1122
1165
  t.el,
1123
- t.getSetting("stateOpened"),
1124
- t.getSetting("stateClosing"),
1125
- t.getSetting("stateClosed"),
1126
- t.getSetting("transitionDuration")
1127
- ) : (t.el.classList.add(t.getSetting("stateClosed")), t.el.classList.remove(t.getSetting("stateOpened"))), t.setState("closed"), t.mode === "modal" && d$1(
1166
+ t.config.get("stateOpened"),
1167
+ t.config.get("stateClosing"),
1168
+ t.config.get("stateClosed"),
1169
+ t.config.get("transitionDuration")
1170
+ ) : (t.el.classList.add(t.config.get("stateClosed")), t.el.classList.remove(t.config.get("stateOpened"))), t.setState("closed"), t.mode === "modal" && c$1(
1128
1171
  false,
1129
- t.getSetting("selectorInert"),
1130
- t.getSetting("selectorOverflow")
1131
- ), s && v$1(t), t.el.dispatchEvent(
1132
- new CustomEvent(t.getSetting("customEventPrefix") + "closed", {
1172
+ t.config.get("selectorInert"),
1173
+ t.config.get("selectorOverflow")
1174
+ ), s && u$1(t), t.el.dispatchEvent(
1175
+ new CustomEvent(t.config.get("customEventPrefix") + "closed", {
1133
1176
  detail: t.parent,
1134
1177
  bubbles: true
1135
1178
  })
1136
1179
  ), await t.parent.emit("closed", t)), t;
1137
1180
  }
1138
- async function E$2(t, e, s) {
1139
- return t.state === "closed" ? u$1(t, e, s) : g(t, e, s);
1181
+ async function m$1(t, e, s) {
1182
+ return t.state === "closed" ? l$1(t, e, s) : h$1(t, e, s);
1140
1183
  }
1141
- class F extends S$1 {
1184
+ let A$2 = class A extends g$1 {
1142
1185
  #t;
1143
- constructor(e, s, i = {}) {
1144
- super(e, s, i), this.#t = "indeterminate", this.dialog = this.el.querySelector(this.getSetting("selectorDialog")) || this.el, this.trigger = null, this.state = null, this.inlineState = null;
1186
+ constructor(e, s) {
1187
+ super(e, s), this.#t = "indeterminate", this.dialog = this.el.querySelector(this.config.get("selectorDialog")) || this.el, this.trigger = null, this.state = null, this.inlineState = null;
1145
1188
  }
1146
1189
  get mode() {
1147
1190
  return this.#t;
1148
1191
  }
1149
1192
  set mode(e) {
1150
- this.#t !== e && (this.#t = e, q$2(this));
1193
+ this.#t !== e && (this.#t = e, k$2(this));
1151
1194
  }
1152
1195
  setState(e) {
1153
1196
  this.state = e;
1154
1197
  const s = ["opening", "closing"];
1155
- this.mode === "inline" && !s.includes(e) && (this.inlineState = e), e === "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")));
1198
+ this.mode === "inline" && !s.includes(e) && (this.inlineState = e), e === "indeterminate" && (this.el.classList.remove(this.config.get("stateOpened")), this.el.classList.remove(this.config.get("stateOpening")), this.el.classList.remove(this.config.get("stateClosed")), this.el.classList.remove(this.config.get("stateClosing")));
1156
1199
  }
1157
1200
  async applyState() {
1158
1201
  if (this.mode === "modal") return this;
@@ -1161,92 +1204,86 @@ class F extends S$1 {
1161
1204
  if (this.inlineState === "closed")
1162
1205
  return await this.close(false, false);
1163
1206
  if (this.state === null) {
1164
- if (this.el.classList.contains(this.getSetting("stateOpened")))
1207
+ if (this.el.classList.contains(this.config.get("stateOpened")))
1165
1208
  return await this.open(false, false);
1166
- if (this.el.classList.contains(this.getSetting("stateClosed")))
1209
+ if (this.el.classList.contains(this.config.get("stateClosed")))
1167
1210
  return await this.close(false, false);
1168
1211
  }
1169
1212
  return this.setState("indeterminate"), this;
1170
1213
  }
1171
1214
  async open(e, s) {
1172
- return u$1(this, e, s);
1215
+ return l$1(this, e, s);
1173
1216
  }
1174
1217
  async close(e, s) {
1175
- return g(this, e, s);
1218
+ return h$1(this, e, s);
1176
1219
  }
1177
1220
  async toggle(e, s) {
1178
- return E$2(this, e, s);
1221
+ return m$1(this, e, s);
1179
1222
  }
1180
1223
  async deregister() {
1181
- return this.parent.deregister(this.id);
1224
+ return this.parent.deregister(this);
1182
1225
  }
1183
1226
  async onCreateEntry() {
1184
- this.getSetting("setTabindex") && this.dialog && this.dialog.setAttribute("tabindex", "-1"), await this.applyState(), this.inlineState = this.state, this.mode = this.el && this.el.classList.contains(this.getSetting("classModal")) ? "modal" : "inline";
1227
+ this.config.get("setTabindex") && this.dialog && this.dialog.setAttribute("tabindex", "-1"), await this.applyState(), this.inlineState = this.state, this.mode = this.el && this.el.classList.contains(this.config.get("classModal")) ? "modal" : "inline";
1185
1228
  }
1186
1229
  async onDestroyEntry() {
1187
1230
  this.mode === "modal" && this.state === "opened" && await this.close(false);
1188
1231
  }
1189
- }
1190
- function l$1(t) {
1191
- const e = this.get(t);
1192
- if (e)
1193
- return e;
1194
- throw new Error(`Drawer not found in collection with id of "${t}"`);
1195
- }
1196
- async function U$1(t) {
1232
+ };
1233
+ async function P$2(t) {
1197
1234
  const e = t.target;
1198
1235
  if (e) {
1199
1236
  const s = e.closest(`
1200
- [data-${this.settings.dataOpen}],
1201
- [data-${this.settings.dataToggle}],
1202
- [data-${this.settings.dataClose}]
1237
+ [data-${this.config.attrOpen}],
1238
+ [data-${this.config.attrToggle}],
1239
+ [data-${this.config.attrClose}]
1203
1240
  `);
1204
1241
  if (s) {
1205
- t.preventDefault(), s.matches(`[data-${this.settings.dataToggle}]`) && s.getAttribute(`data-${this.settings.dataToggle}`)?.trim().split(" ")?.forEach((n) => {
1206
- const a2 = l$1.call(this, n);
1207
- return a2.trigger = s, a2.toggle();
1208
- }), s.matches(`[data-${this.settings.dataOpen}]`) && s.getAttribute(`data-${this.settings.dataOpen}`)?.trim().split(" ")?.forEach((n) => {
1209
- const a2 = l$1.call(this, n);
1210
- return a2.trigger = s, a2.open();
1211
- }), s.matches(`[data-${this.settings.dataClose}]`) && s.getAttribute(`data-${this.settings.dataClose}`)?.trim().split(" ")?.forEach((n) => {
1212
- if (n) {
1213
- const a2 = l$1.call(this, n);
1214
- return a2.trigger = s, a2.close();
1242
+ t.preventDefault(), s.matches(`[data-${this.config.attrToggle}]`) && s.getAttribute(`data-${this.config.attrToggle}`)?.trim().split(" ")?.forEach((o) => {
1243
+ const n = this.getOrThrow(o);
1244
+ return n.trigger = s, n.toggle();
1245
+ }), s.matches(`[data-${this.config.attrOpen}]`) && s.getAttribute(`data-${this.config.attrOpen}`)?.trim().split(" ")?.forEach((o) => {
1246
+ const n = this.getOrThrow(o);
1247
+ return n.trigger = s, n.open();
1248
+ }), s.matches(`[data-${this.config.attrClose}]`) && s.getAttribute(`data-${this.config.attrClose}`)?.trim().split(" ")?.forEach((o) => {
1249
+ if (o) {
1250
+ const n = this.getOrThrow(o);
1251
+ return n.trigger = s, n.close();
1215
1252
  } else {
1216
- const a2 = e.closest(this.settings.selector);
1217
- if (a2) return this.close(a2.id);
1253
+ const n = e.closest(this.config.selector);
1254
+ if (n) return this.close(n.id);
1218
1255
  }
1219
1256
  });
1220
1257
  return;
1221
1258
  }
1222
- if (this.activeModal && e.matches(this.settings.selectorScreen))
1259
+ if (this.activeModal && e.matches(this.config.selectorScreen))
1223
1260
  return this.close(this.activeModal.id);
1224
1261
  }
1225
1262
  }
1226
- function _(t) {
1263
+ function y$1(t) {
1227
1264
  if (t.key === "Escape" && this.activeModal)
1228
1265
  return this.close(this.activeModal.id);
1229
1266
  }
1230
- let z$2 = class z2 extends T$2 {
1231
- #t;
1232
- #e;
1267
+ let q$1 = class q extends x$1 {
1233
1268
  constructor(e) {
1234
- super({ ...j$2, ...e }), this.module = "Drawer", this.entryClass = F, this.#t = U$1.bind(this), this.#e = _.bind(this);
1269
+ super({ ...$$1, ...e }), this.entryClass = A$2, this.name = "Drawer", this.#t = P$2.bind(this), this.#e = y$1.bind(this);
1235
1270
  }
1271
+ #t;
1272
+ #e;
1236
1273
  get activeModal() {
1237
1274
  return this.collection.find((e) => e.state === "opened" && e.mode === "modal");
1238
1275
  }
1239
1276
  async open(e, s, i) {
1240
- const n = l$1.call(this, e);
1241
- return u$1(n, s, i);
1277
+ const o = this.getOrThrow(e);
1278
+ return l$1(o, s, i);
1242
1279
  }
1243
1280
  async close(e, s, i) {
1244
- const n = l$1.call(this, e);
1245
- return g(n, s, i);
1281
+ const o = this.getOrThrow(e);
1282
+ return h$1(o, s, i);
1246
1283
  }
1247
1284
  async toggle(e, s, i) {
1248
- const n = l$1.call(this, e);
1249
- return E$2(n, s, i);
1285
+ const o = this.getOrThrow(e);
1286
+ return m$1(o, s, i);
1250
1287
  }
1251
1288
  async afterMount() {
1252
1289
  document.addEventListener("click", this.#t, false), document.addEventListener("keydown", this.#e, false);
@@ -1255,145 +1292,164 @@ let z$2 = class z2 extends T$2 {
1255
1292
  document.removeEventListener("click", this.#t, false), document.removeEventListener("keydown", this.#e, false);
1256
1293
  }
1257
1294
  };
1258
- function C(e, t = "config") {
1259
- const s = (e.getAttribute(`data-${t}`) || "").replace(/'/g, '"');
1260
- return s ? JSON.parse(s) : {};
1261
- }
1262
- function p(e) {
1263
- if (typeof e == "string") {
1264
- const t = document.getElementById(e);
1295
+ function p(s) {
1296
+ if (typeof s == "string") {
1297
+ const t = document.getElementById(s);
1265
1298
  if (t) return t;
1266
- throw new Error(`Element not found with ID: "${e}"`);
1267
- } else if (e instanceof HTMLElement) {
1268
- if (!e.id)
1299
+ throw new Error(`Element not found with ID: "${s}"`);
1300
+ } else if (s instanceof HTMLElement) {
1301
+ if (!s.id)
1269
1302
  throw new Error("HTMLElement must have an ID");
1270
- return e;
1303
+ return s;
1271
1304
  } else
1272
1305
  throw new Error("Invalid argument: query must be a string or HTMLElement");
1273
1306
  }
1274
- async function r(e, t, ...s) {
1275
- t in e && typeof e[t] == "function" && await e[t](...s);
1276
- }
1277
- function S2(e) {
1278
- return e.split("-").map(
1279
- (t, s) => s === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1)
1280
- ).join("");
1281
- }
1282
- function m(e) {
1283
- return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
1307
+ async function a(s, t, ...e) {
1308
+ t in s && typeof s[t] == "function" && await s[t](...e);
1284
1309
  }
1285
- function E$1(e) {
1286
- if (typeof e == "number")
1287
- return e;
1288
- const t = parseFloat(e);
1310
+ function m(s) {
1311
+ if (typeof s == "number")
1312
+ return s;
1313
+ const t = parseFloat(s);
1289
1314
  if (!Number.isNaN(t)) {
1290
- const s = e.includes("ms");
1291
- return t * (s ? 1 : 1e3);
1315
+ const e = s.includes("ms");
1316
+ return t * (e ? 1 : 1e3);
1292
1317
  }
1293
- throw new Error(`Could not convert value to milliseconds: ${e}`);
1318
+ throw new Error(`Could not convert value to milliseconds: ${s}`);
1294
1319
  }
1295
- function w(e, t, s, i, n = 0) {
1296
- return new Promise((o2) => {
1297
- e.classList.remove(t), e.classList.add(s), setTimeout(() => {
1298
- e.classList.add(i), e.classList.remove(s), o2(e);
1299
- }, E$1(n));
1320
+ function u(s, t, e, i, n = 0) {
1321
+ return new Promise((o) => {
1322
+ s.classList.remove(t), s.classList.add(e), setTimeout(() => {
1323
+ s.classList.add(i), s.classList.remove(e), o(s);
1324
+ }, m(n));
1300
1325
  });
1301
1326
  }
1302
- async function a(e, t, s) {
1303
- await r(t, e, s), s && await r(s, e);
1304
- for (const i of t.plugins)
1305
- await r(i, e, { plugin: i, parent: t, entry: s });
1306
- await t.emit(e, s);
1307
- }
1308
- function b(e) {
1309
- const t = getComputedStyle(e.el), s = {}, i = e.getSetting("customProps");
1310
- for (let n = 0; n < i.length; n++) {
1311
- const o2 = A(), c = e.parent.module.toLowerCase(), g2 = m(i[n]), f2 = t.getPropertyValue(`--${o2}${c}-${g2}`).trim();
1312
- f2 && (s[g2] = f2);
1327
+ function w(s, t = {}) {
1328
+ const e = {
1329
+ fallback: null,
1330
+ element: document.body,
1331
+ ...t
1332
+ };
1333
+ if (!s.startsWith("--")) {
1334
+ const n = v();
1335
+ n && (s = `${n}${s}`), s = `--${s}`;
1313
1336
  }
1314
- return s;
1315
- }
1316
- function A() {
1317
- return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim();
1337
+ const i = getComputedStyle(e.element).getPropertyValue(s).trim();
1338
+ if (i)
1339
+ return i;
1340
+ if (e.fallback)
1341
+ return e.fallback;
1342
+ throw new Error(`CSS variable "${s}" was not found!`);
1318
1343
  }
1319
- function x(e, t, s = "camel") {
1320
- return t = s === "camel" ? S2(t) : m(t), e.split(".").concat(t).reduce((i, n) => i?.[n], this);
1344
+ async function r(s, t, e) {
1345
+ await a(t, s, e), e && await a(e, s);
1346
+ for (const i of t.plugins)
1347
+ await a(i, s, { parent: t, entry: e });
1348
+ await t.emit(s, { parent: t, entry: e });
1321
1349
  }
1322
- function L(e, t = {}) {
1323
- const {
1324
- fallback: s,
1325
- props: i = ["dataConfig", "customProps", "settings", "parent.settings"]
1326
- } = t;
1327
- for (const n of i) {
1328
- const o2 = n !== "customProps" ? "camel" : "kebab", c = x.call(this, n, e, o2);
1329
- if (c !== void 0)
1330
- return c;
1331
- }
1332
- if (s !== void 0)
1333
- return s;
1334
- throw new Error(`${this.parent.module} setting does not exist: ${e}`);
1350
+ function v() {
1351
+ return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim();
1335
1352
  }
1336
- function O2(e, t) {
1337
- t && document.querySelectorAll(t).forEach((s) => {
1338
- e ? s.style.overflow = "hidden" : s.style.removeProperty("overflow");
1353
+ function y(s, t) {
1354
+ t && document.querySelectorAll(t).forEach((e) => {
1355
+ s ? e.style.overflow = "hidden" : e.style.removeProperty("overflow");
1339
1356
  });
1340
1357
  }
1341
- function P$1(e, t) {
1342
- t && document.querySelectorAll(t).forEach((s) => {
1343
- e ? (s.inert = true, s.setAttribute("aria-hidden", "true")) : (s.inert = false, s.removeAttribute("aria-hidden"));
1358
+ function E(s, t) {
1359
+ t && document.querySelectorAll(t).forEach((e) => {
1360
+ e.inert = s;
1344
1361
  });
1345
1362
  }
1346
- function $(e, t, s) {
1347
- P$1(!!e, t), O2(!!e, s);
1363
+ function b(s, t, e) {
1364
+ E(!!s, t), y(!!s, e);
1348
1365
  }
1349
- const I$1 = {
1350
- events: {},
1351
- on(e, t, ...s) {
1352
- this.events[e] || (this.events[e] = []), this.events[e].some(
1353
- (i) => i.listener === t
1354
- ) || this.events[e].push({ listener: t, args: s });
1355
- },
1356
- off(e, t) {
1357
- this.events[e] && (this.events[e] = this.events[e].filter(
1358
- (s) => s.listener !== t
1366
+ class C {
1367
+ #t;
1368
+ #e;
1369
+ constructor() {
1370
+ this.#t = {}, this.#e = [];
1371
+ }
1372
+ get(t, e) {
1373
+ const { fallback: i, source: n } = e ?? {};
1374
+ if (n) {
1375
+ const o = this.#t?.[n]?.[t];
1376
+ if (o !== void 0)
1377
+ return o;
1378
+ } else
1379
+ for (const o of this.#e) {
1380
+ const f2 = this.#t?.[o]?.[t];
1381
+ if (f2 !== void 0)
1382
+ return f2;
1383
+ }
1384
+ if (i !== void 0)
1385
+ return i;
1386
+ throw new Error(`Config does not exist: ${t}`);
1387
+ }
1388
+ set(t, e = {}) {
1389
+ let i, n;
1390
+ return typeof t == "string" ? (i = t, n = e) : (i = "entry", n = t), this.#t[i] ? Object.assign(this.#t[i], n) : (this.#e.unshift(i), this.#t[i] = n), this.#t[i];
1391
+ }
1392
+ remove(t) {
1393
+ const e = this.#e.indexOf(t);
1394
+ e !== -1 && this.#e.splice(e, 1), delete this.#t[t];
1395
+ }
1396
+ setSourceOrder(t) {
1397
+ const e = Object.keys(this.#t).reverse(), i = t.filter((n) => e.includes(n));
1398
+ for (const n of e)
1399
+ i.includes(n) || i.push(n);
1400
+ return this.#e = i;
1401
+ }
1402
+ }
1403
+ class x2 {
1404
+ constructor() {
1405
+ this.events = {};
1406
+ }
1407
+ on(t, e, ...i) {
1408
+ this.events[t] || (this.events[t] = []), this.events[t].some(
1409
+ (n) => n.listener === e
1410
+ ) || this.events[t].push({ listener: e, args: i });
1411
+ }
1412
+ off(t, e) {
1413
+ this.events[t] && (this.events[t] = this.events[t].filter(
1414
+ (i) => i.listener !== e
1359
1415
  ));
1360
- },
1361
- async emit(e, t) {
1362
- if (e = e.startsWith("on") ? e.slice(2, 3).toLowerCase() + e.slice(3) : e, !!this.events[e])
1363
- for (const { listener: s, args: i } of this.events[e])
1364
- await s(t, ...i);
1365
1416
  }
1366
- };
1367
- class M extends Array {
1417
+ async emit(t, ...e) {
1418
+ if (t = t.startsWith("on") ? t.slice(2, 3).toLowerCase() + t.slice(3) : t, !!this.events[t])
1419
+ for (const { listener: i, args: n } of this.events[t])
1420
+ await i(...e, ...n);
1421
+ }
1422
+ }
1423
+ class O2 extends Array {
1368
1424
  constructor(t = {}) {
1369
1425
  super(), this.presets = t;
1370
1426
  }
1371
- applySettings(t) {
1372
- const s = t?.defaults || {}, i = this.presets?.[t.name] || {}, n = t?.options || {};
1373
- t.settings = { ...s, ...i, ...n };
1427
+ #t(t) {
1428
+ const e = this.presets?.[t.name] || {}, i = t?.options || {};
1429
+ t.config = { ...t.config, ...e, ...i };
1374
1430
  }
1375
- validate(t) {
1431
+ #e(t) {
1376
1432
  return !("name" in t) || typeof t.name != "string" ? (console.error("Plugin requires a name!"), false) : true;
1377
1433
  }
1378
1434
  get(t) {
1379
- return this.find((s) => s.name === t);
1435
+ return this.find((e) => e.name === t) || null;
1380
1436
  }
1381
1437
  add(t) {
1382
1438
  if (Array.isArray(t))
1383
- t.forEach((s) => this.add(s));
1384
- else if (this.applySettings(t), this.validate(t)) {
1385
- const s = this.findIndex((i) => i.name === t.name);
1386
- ~s ? this[s] = t : this.push(t);
1439
+ t.forEach((e) => this.add(e));
1440
+ else if (this.#t(t), this.#e(t)) {
1441
+ const e = this.findIndex((i) => i.name === t.name);
1442
+ ~e ? this[e] = t : this.push(t);
1387
1443
  }
1388
1444
  }
1389
1445
  remove(t) {
1390
- const s = this.findIndex((i) => i.name === t);
1391
- ~s && this.splice(s, 1);
1446
+ const e = this.findIndex((i) => i.name === t);
1447
+ ~e && this.splice(e, 1);
1392
1448
  }
1393
1449
  }
1394
- let k$1 = class k extends Array {
1450
+ class L3 extends Array {
1395
1451
  constructor(t = {}) {
1396
- super(), this.settings = t;
1452
+ super(), this.config = t;
1397
1453
  }
1398
1454
  get copy() {
1399
1455
  return [...this];
@@ -1402,129 +1458,108 @@ let k$1 = class k extends Array {
1402
1458
  return this[this.length - 1] || null;
1403
1459
  }
1404
1460
  updateIndex() {
1405
- this.forEach((t, s) => {
1461
+ this.forEach((t, e) => {
1406
1462
  t.el.style.zIndex = "";
1407
- const i = getComputedStyle(t.el)["z-index"];
1408
- t.el.style.zIndex = String(parseInt(i, 10) + s + 1);
1463
+ const i = getComputedStyle(t.el).getPropertyValue("z-index"), n = parseInt(i, 10), o = String((Number.isNaN(n) ? 0 : n) + e + 1);
1464
+ t.el.style.zIndex = o;
1409
1465
  });
1410
1466
  }
1411
1467
  onChange() {
1412
- this.updateIndex(), typeof this.settings.onChange == "function" && this.settings.onChange();
1468
+ this.updateIndex(), typeof this.config.onChange == "function" && this.config.onChange();
1413
1469
  }
1414
1470
  add(t) {
1415
1471
  this.push(t), this.onChange();
1416
1472
  }
1417
1473
  remove(t) {
1418
- const s = this.findIndex((i) => i.id === t.id);
1419
- ~s && (t.el.style.zIndex = "", this.splice(s, 1), this.onChange());
1474
+ const e = this.findIndex((i) => i.id === t.id);
1475
+ ~e && (t.el.style.zIndex = "", this.splice(e, 1), this.onChange());
1420
1476
  }
1421
1477
  moveToTop(t) {
1422
- const s = this.findIndex((i) => i.id === t.id);
1423
- ~s && (this.splice(s, 1), this.add(t));
1424
- }
1425
- };
1426
- const D$1 = {
1427
- dataConfig: "config",
1428
- customProps: []
1429
- };
1430
- class v {
1431
- constructor(t, s, i = {}) {
1432
- this.parent = t, this.el = p(s), this.settings = { ...i }, this.dataConfig = {}, this.customProps = {};
1433
- }
1434
- get id() {
1435
- return this.el.id;
1436
- }
1437
- applySettings(t) {
1438
- return Object.assign(this.settings, t);
1439
- }
1440
- getSetting(t, s) {
1441
- return L.call(this, t, s);
1442
- }
1443
- buildDataConfig() {
1444
- return Object.assign(
1445
- this.dataConfig,
1446
- C(this.el, this.getSetting("dataConfig"))
1447
- );
1448
- }
1449
- buildCustomProps() {
1450
- return Object.assign(this.customProps, b(this));
1451
- }
1452
- async init(t = {}) {
1453
- this.applySettings(t), this.buildDataConfig(), this.buildCustomProps();
1478
+ const e = this.findIndex((i) => i.id === t.id);
1479
+ ~e && (this.splice(e, 1), this.add(t));
1454
1480
  }
1455
- async destroy() {
1456
- Object.getOwnPropertyNames(this).forEach((t) => {
1457
- delete this[t];
1458
- });
1481
+ }
1482
+ class d {
1483
+ constructor(t, e) {
1484
+ this.config = new C(), this.parent = t, this.el = p(e), this.id = this.el.id, this.config.set("parent", this.parent.config), this.config.set("entry", {});
1459
1485
  }
1460
1486
  }
1461
- let q$1 = class q {
1487
+ const k$1 = {
1488
+ selector: "",
1489
+ plugins: [],
1490
+ presets: {}
1491
+ };
1492
+ let A$1 = class A2 {
1462
1493
  constructor(t = {}) {
1463
- this.module = this.constructor.name, this.collection = [], this.entryClass = v, this.settings = { ...D$1, ...t }, this.plugins = new M(this.settings.presets), this.events = {}, Object.assign(this, I$1);
1494
+ this.#t = new x2(), this.events = this.#t.events, this.on = this.#t.on.bind(this.#t), this.off = this.#t.off.bind(this.#t), this.emit = this.#t.emit.bind(this.#t), this.collection = [], this.entryClass = d, this.name = this.constructor.name, this.config = { ...k$1, ...t }, this.plugins = new O2(this.config.presets);
1464
1495
  }
1465
- get(t, s = "id") {
1466
- return this.collection.find((i) => i[s] === t);
1496
+ #t;
1497
+ get(t, e = "id") {
1498
+ return this.collection.find((i) => i[e] === t);
1499
+ }
1500
+ getOrThrow(t, e = "id") {
1501
+ const i = this.get(t, e);
1502
+ if (i)
1503
+ return i;
1504
+ throw new Error(
1505
+ `${this.name} entry not found in collection with ${String(e)} of "${t}"`
1506
+ );
1467
1507
  }
1468
- applySettings(t) {
1469
- return Object.assign(this.settings, t);
1508
+ updateConfig(t = {}) {
1509
+ return Object.assign(this.config, t);
1470
1510
  }
1471
- async createEntry(t, s) {
1472
- const i = new this.entryClass(this, t, s);
1473
- return await r(i, "init"), await a("onCreateEntry", this, i), i;
1511
+ async createEntry(t) {
1512
+ const e = new this.entryClass(this, t);
1513
+ return await a(e, "init"), await r("onCreateEntry", this, e), e;
1474
1514
  }
1475
1515
  async destroyEntry(t) {
1476
- return await a("onDestroyEntry", this, t), await r(t, "destroy"), t;
1516
+ return await r("onDestroyEntry", this, t), await a(t, "destroy"), t;
1477
1517
  }
1478
- async register(t, s = {}) {
1479
- const i = p(t), n = this.collection.findIndex((o2) => o2.id === i.id);
1480
- if (~n) {
1481
- const o2 = this.collection[n];
1482
- return o2.el = i, typeof o2.init == "function" && await o2.init(s), o2;
1483
- } else {
1484
- const o2 = await this.createEntry(i, s);
1485
- return this.collection.push(o2), await a("onRegisterEntry", this, o2), o2;
1486
- }
1518
+ async register(t) {
1519
+ const e = this.collection.findIndex((i) => i.id === t.id);
1520
+ return ~e ? this.collection[e] = t : this.collection.push(t), await r("onRegisterEntry", this, t), t;
1487
1521
  }
1488
1522
  async deregister(t) {
1489
- const s = this.collection.findIndex((i) => i.id === t);
1490
- if (~s) {
1491
- const i = await this.destroyEntry(this.collection[s]);
1492
- return await a(
1523
+ const e = this.collection.findIndex((i) => i.id === t.id);
1524
+ if (~e) {
1525
+ await r(
1493
1526
  "onDeregisterEntry",
1494
1527
  this,
1495
- this.collection[s]
1496
- ), this.collection.splice(s, 1), i;
1528
+ this.collection[e]
1529
+ );
1530
+ const [i] = this.collection.splice(e, 1);
1497
1531
  }
1498
- return null;
1532
+ return t;
1533
+ }
1534
+ async mount(t = (e) => e) {
1535
+ for (const e of this.config?.plugins || [])
1536
+ this.plugins.add(e);
1537
+ for (const e of this.plugins)
1538
+ await a(e, "setup", this);
1539
+ if (await r("beforeMount", this), this.config.selector) {
1540
+ const e = document.querySelectorAll(this.config.selector);
1541
+ for (const i of e)
1542
+ await this.createEntry(i).then((n) => t(n)).then((n) => this.register(n));
1543
+ }
1544
+ return await r("afterMount", this), this;
1499
1545
  }
1500
- async mount(t = {}) {
1501
- this.applySettings(t);
1502
- for (const i of this.settings?.plugins || [])
1503
- this.plugins.add(i);
1504
- for (const i of this.plugins)
1505
- await r(i, "setup", { plugin: i, parent: this });
1506
- await a("beforeMount", this);
1507
- const s = document.querySelectorAll(this.settings.selector);
1508
- for (const i of s)
1509
- await this.register(i);
1510
- return await a("afterMount", this), this;
1511
- }
1512
- async unmount() {
1513
- for (await a("beforeUnmount", this); this.collection.length > 0; )
1514
- await this.deregister(this.collection[0].id);
1515
- await a("afterUnmount", this);
1516
- for (const t of this.plugins)
1517
- await r(t, "teardown", { plugin: t, parent: this });
1518
- for (const t of [...this.plugins])
1519
- this.plugins.remove(t.name);
1546
+ async unmount(t = (e) => e) {
1547
+ for (await r("beforeUnmount", this); this.collection.length > 0; )
1548
+ await this.destroyEntry(this.collection[0]).then((e) => t(e)).then((e) => this.deregister(e));
1549
+ await r("afterUnmount", this);
1550
+ for (const e of this.plugins)
1551
+ await a(e, "teardown", this);
1552
+ for (const e of [...this.plugins])
1553
+ this.plugins.remove(e.name);
1520
1554
  return this;
1521
1555
  }
1522
1556
  };
1523
- const T$1 = {
1557
+ w("theme-prefix", { fallback: "vb-theme-" });
1558
+ const I$1 = {
1524
1559
  // Data attributes
1525
- dataOpen: "modal-open",
1526
- dataClose: "modal-close",
1527
- dataReplace: "modal-replace",
1560
+ attrOpen: "modal-open",
1561
+ attrClose: "modal-close",
1562
+ attrReplace: "modal-replace",
1528
1563
  // Selectors
1529
1564
  selector: ".modal",
1530
1565
  selectorDialog: ".modal__dialog",
@@ -1538,156 +1573,154 @@ const T$1 = {
1538
1573
  stateOpening: "is-opening",
1539
1574
  stateClosing: "is-closing",
1540
1575
  stateClosed: "is-closed",
1541
- // Feature settings
1576
+ // Feature configurations
1542
1577
  customProps: ["transition-duration"],
1543
1578
  customEventPrefix: "modal:",
1544
1579
  setTabindex: true,
1545
1580
  transition: true,
1546
1581
  transitionDuration: 300
1547
1582
  };
1548
- function d(e) {
1549
- e.active ? (e.active.dialog.querySelector(e.settings.selectorFocus) || e.active.dialog).focus() : e.trigger && (e.trigger.focus(), e.trigger = null);
1550
- }
1551
- async function u(e, t, s = true) {
1552
- return e.parent.stack.moveToTop(e), e.state === "closed" && (e.state = "opening", e.parent.stack.add(e), t ?? e.getSetting("transition") ? await w(
1553
- e.el,
1554
- e.getSetting("stateClosed"),
1555
- e.getSetting("stateOpening"),
1556
- e.getSetting("stateOpened"),
1557
- e.getSetting("transitionDuration")
1558
- ) : (e.el.classList.add(e.getSetting("stateOpened")), e.el.classList.remove(e.getSetting("stateClosed"))), e.state = "opened"), s && d(e.parent), e.el.dispatchEvent(
1559
- new CustomEvent(e.getSetting("customEventPrefix") + "opened", {
1560
- detail: e.parent,
1583
+ function c(s) {
1584
+ if (s.active) {
1585
+ const t = s.active.dialog.querySelector(s.config.selectorFocus) || s.active.dialog;
1586
+ "focus" in t && typeof t.focus == "function" && t.focus();
1587
+ } else
1588
+ s.trigger && (s.trigger.focus(), s.trigger = null);
1589
+ }
1590
+ async function l(s, t, e = true) {
1591
+ return s.parent.stack.moveToTop(s), s.state === "closed" && (s.state = "opening", s.parent.stack.add(s), t ?? s.config.get("transition") ? await u(
1592
+ s.el,
1593
+ s.config.get("stateClosed"),
1594
+ s.config.get("stateOpening"),
1595
+ s.config.get("stateOpened"),
1596
+ s.config.get("transitionDuration")
1597
+ ) : (s.el.classList.add(s.config.get("stateOpened")), s.el.classList.remove(s.config.get("stateClosed"))), s.state = "opened"), e && c(s.parent), s.el.dispatchEvent(
1598
+ new CustomEvent(s.config.get("customEventPrefix") + "opened", {
1599
+ detail: s.parent,
1561
1600
  bubbles: true
1562
1601
  })
1563
- ), await e.parent.emit("opened", e), e;
1564
- }
1565
- async function h(e, t, s = true) {
1566
- return e && e.state === "opened" && (e.state = "closing", document.activeElement && document.activeElement instanceof HTMLElement && document.activeElement.blur(), t ?? e.getSetting("transition") ? await w(
1567
- e.el,
1568
- e.getSetting("stateOpened"),
1569
- e.getSetting("stateClosing"),
1570
- e.getSetting("stateClosed"),
1571
- e.getSetting("transitionDuration")
1572
- ) : (e.el.classList.add(e.getSetting("stateClosed")), e.el.classList.remove(e.getSetting("stateOpened"))), e.parent.stack.remove(e), e.state = "closed", s && d(e.parent), e.el.dispatchEvent(
1573
- new CustomEvent(e.getSetting("customEventPrefix") + "closed", {
1574
- detail: e.parent,
1602
+ ), await s.parent.emit("opened", s), s;
1603
+ }
1604
+ async function h(s, t, e = true) {
1605
+ return s && s.state === "opened" && (s.state = "closing", document.activeElement && document.activeElement instanceof HTMLElement && document.activeElement.blur(), t ?? s.config.get("transition") ? await u(
1606
+ s.el,
1607
+ s.config.get("stateOpened"),
1608
+ s.config.get("stateClosing"),
1609
+ s.config.get("stateClosed"),
1610
+ s.config.get("transitionDuration")
1611
+ ) : (s.el.classList.add(s.config.get("stateClosed")), s.el.classList.remove(s.config.get("stateOpened"))), s.parent.stack.remove(s), s.state = "closed", e && c(s.parent), s.el.dispatchEvent(
1612
+ new CustomEvent(s.config.get("customEventPrefix") + "closed", {
1613
+ detail: s.parent,
1575
1614
  bubbles: true
1576
1615
  })
1577
- ), await e.parent.emit("closed", e)), e;
1616
+ ), await s.parent.emit("closed", s)), s;
1578
1617
  }
1579
- async function y2(e, t, s = true) {
1618
+ async function g2(s, t, e = true) {
1580
1619
  let i, n;
1581
- return e.state === "opened" ? (i = e, n = await e.parent.closeAll(e.id, t)) : [n, i] = await Promise.all([
1582
- e.parent.closeAll("", t),
1583
- u(e, t, false)
1584
- ]), s && d(e.parent), { opened: i, closed: n };
1620
+ return s.state === "opened" ? (i = s, n = await s.parent.closeAll(s.id, t)) : [n, i] = await Promise.all([
1621
+ s.parent.closeAll("", t),
1622
+ l(s, t, false)
1623
+ ]), e && c(s.parent), { opened: i, closed: n };
1585
1624
  }
1586
- let R$1 = class R extends v {
1587
- constructor(t, s, i = {}) {
1588
- super(t, s, i), this.state = "closed", this.dialog = this.el.querySelector(this.getSetting("selectorDialog")) || this.el;
1625
+ class $ extends d {
1626
+ constructor(t, e) {
1627
+ super(t, e), this.state = "closed", this.dialog = this.el.querySelector(this.config.get("selectorDialog")) || this.el;
1589
1628
  }
1590
1629
  get isRequired() {
1591
- return this.dialog.matches(this.getSetting("selectorRequired"));
1630
+ return this.dialog.matches(this.config.get("selectorRequired"));
1592
1631
  }
1593
- async open(t, s) {
1594
- return u(this, t, s);
1632
+ async open(t, e) {
1633
+ return l(this, t, e);
1595
1634
  }
1596
- async close(t, s) {
1597
- return h(this, t, s);
1635
+ async close(t, e) {
1636
+ return h(this, t, e);
1598
1637
  }
1599
- async replace(t, s) {
1600
- return y2(this, t, s);
1638
+ async replace(t, e) {
1639
+ return g2(this, t, e);
1601
1640
  }
1602
1641
  async deregister() {
1603
- return this.parent.deregister(this.id);
1642
+ return this.parent.deregister(this);
1604
1643
  }
1605
1644
  async onCreateEntry() {
1606
- this.dialog.setAttribute("aria-modal", "true"), this.dialog.hasAttribute("role") || this.dialog.setAttribute("role", "dialog"), this.getSetting("setTabindex") && this.dialog.setAttribute("tabindex", "-1");
1645
+ this.dialog.setAttribute("aria-modal", "true"), this.dialog.hasAttribute("role") || this.dialog.setAttribute("role", "dialog"), this.config.get("setTabindex") && this.dialog.setAttribute("tabindex", "-1");
1607
1646
  }
1608
1647
  async onRegisterEntry() {
1609
- this.el.classList.contains(this.getSetting("stateOpened")) ? await this.open(false) : (this.el.classList.remove(this.getSetting("stateOpening")), this.el.classList.remove(this.getSetting("stateClosing")), this.el.classList.add(this.getSetting("stateClosed")));
1648
+ this.el.classList.contains(this.config.get("stateOpened")) ? await this.open(false) : (this.el.classList.remove(this.config.get("stateOpening")), this.el.classList.remove(this.config.get("stateClosing")), this.el.classList.add(this.config.get("stateClosed")));
1610
1649
  }
1611
1650
  async onDestroyEntry() {
1612
1651
  this.state === "opened" && await this.close(false);
1613
1652
  }
1614
- };
1615
- function l(e) {
1616
- const t = this.get(e);
1617
- if (t)
1618
- return t;
1619
- throw new Error(`Modal not found in collection with id of "${e}".`);
1620
1653
  }
1621
- async function j$1(e) {
1622
- const t = e.target;
1654
+ async function T(s) {
1655
+ const t = s.target;
1623
1656
  if (t) {
1624
- const s = t.closest(`
1625
- [data-${this.settings.dataOpen}],
1626
- [data-${this.settings.dataReplace}],
1627
- [data-${this.settings.dataClose}]
1657
+ const e = t.closest(`
1658
+ [data-${this.config.attrOpen}],
1659
+ [data-${this.config.attrReplace}],
1660
+ [data-${this.config.attrClose}]
1628
1661
  `);
1629
- if (s) {
1630
- if (e.preventDefault(), s.matches(`[data-${this.settings.dataOpen}]`)) {
1631
- const i = s.getAttribute(`data-${this.settings.dataOpen}`)?.trim(), n = l.call(this, i);
1632
- return t.closest(this.settings.selector) || (this.trigger = s), n.open();
1662
+ if (e) {
1663
+ if (s.preventDefault(), e.matches(`[data-${this.config.attrOpen}]`)) {
1664
+ const i = e.getAttribute(`data-${this.config.attrOpen}`)?.trim(), n = this.getOrThrow(i);
1665
+ return t.closest(this.config.selector) || (this.trigger = e), n.open();
1633
1666
  }
1634
- if (s.matches(`[data-${this.settings.dataReplace}]`)) {
1635
- const i = s.getAttribute(`data-${this.settings.dataReplace}`)?.trim(), n = l.call(this, i);
1636
- return t.closest(this.settings.selector) || (this.trigger = s), n.replace();
1667
+ if (e.matches(`[data-${this.config.attrReplace}]`)) {
1668
+ const i = e.getAttribute(`data-${this.config.attrReplace}`)?.trim(), n = this.getOrThrow(i);
1669
+ return t.closest(this.config.selector) || (this.trigger = e), n.replace();
1637
1670
  }
1638
- if (s.matches(`[data-${this.settings.dataClose}]`)) {
1639
- const i = s.getAttribute(`data-${this.settings.dataClose}`)?.trim();
1671
+ if (e.matches(`[data-${this.config.attrClose}]`)) {
1672
+ const i = e.getAttribute(`data-${this.config.attrClose}`)?.trim();
1640
1673
  return i === "*" ? this.closeAll() : this.close(i || "");
1641
1674
  }
1642
1675
  }
1643
- if (this.active && t.matches(this.settings.selectorScreen) && !this.active.isRequired)
1676
+ if (this.active && t.matches(this.config.selectorScreen) && !this.active.isRequired)
1644
1677
  return this.close();
1645
1678
  }
1646
1679
  }
1647
- function z$1(e) {
1648
- if (e.key === "Escape" && this.active && !this.active.dialog.matches(this.settings.selectorRequired))
1680
+ function S$1(s) {
1681
+ if (s.key === "Escape" && this.active && !this.active.dialog.matches(this.config.selectorRequired))
1649
1682
  return this.close();
1650
1683
  }
1651
- async function H$1(e = "", t) {
1652
- const s = [];
1684
+ async function M(s = "", t) {
1685
+ const e = [];
1653
1686
  return await Promise.all(
1654
1687
  this.stack.copy.map(async (i) => {
1655
- e && e === i.id || s.push(await h(i, t, false));
1688
+ s && s === i.id || e.push(await h(i, t, false));
1656
1689
  })
1657
- ), s;
1690
+ ), e;
1658
1691
  }
1659
- let N$1 = class N extends q$1 {
1660
- #t;
1661
- #e;
1692
+ let P$1 = class P extends A$1 {
1662
1693
  constructor(t) {
1663
- super({ ...T$1, ...t }), this.module = "Modal", this.entryClass = R$1, this.trigger = null, this.#t = j$1.bind(this), this.#e = z$1.bind(this), this.stack = new k$1({
1694
+ super({ ...I$1, ...t }), this.entryClass = $, this.name = "Modal", this.trigger = null, this.#t = T.bind(this), this.#e = S$1.bind(this), this.stack = new L3({
1664
1695
  onChange: () => {
1665
- $(
1696
+ b(
1666
1697
  !!this.stack.top,
1667
- this.settings.selectorInert,
1668
- this.settings.selectorOverflow
1698
+ this.config.selectorInert,
1699
+ this.config.selectorOverflow
1669
1700
  );
1670
1701
  }
1671
1702
  });
1672
1703
  }
1704
+ #t;
1705
+ #e;
1673
1706
  get active() {
1674
1707
  return this.stack.top;
1675
1708
  }
1676
- async open(t, s, i) {
1677
- const n = l.call(this, t);
1678
- return u(n, s, i);
1709
+ async open(t, e, i) {
1710
+ const n = this.getOrThrow(t);
1711
+ return l(n, e, i);
1679
1712
  }
1680
- async close(t, s, i) {
1681
- const n = t ? l.call(this, t) : this.active;
1682
- return h(n, s, i);
1713
+ async close(t, e, i) {
1714
+ const n = t ? this.getOrThrow(t) : this.active;
1715
+ return h(n, e, i);
1683
1716
  }
1684
- async replace(t, s, i) {
1685
- const n = l.call(this, t);
1686
- return y2(n, s, i);
1717
+ async replace(t, e, i) {
1718
+ const n = this.getOrThrow(t);
1719
+ return g2(n, e, i);
1687
1720
  }
1688
- async closeAll(t, s, i = true) {
1689
- const n = await H$1.call(this, t, s);
1690
- return i && d(this), n;
1721
+ async closeAll(t, e, i = true) {
1722
+ const n = await M.call(this, t, e);
1723
+ return i && c(this), n;
1691
1724
  }
1692
1725
  async afterMount() {
1693
1726
  document.addEventListener("click", this.#t, false), document.addEventListener("keydown", this.#e, false);
@@ -1699,11 +1732,7 @@ let N$1 = class N extends q$1 {
1699
1732
  document.removeEventListener("click", this.#t, false), document.removeEventListener("keydown", this.#e, false);
1700
1733
  }
1701
1734
  };
1702
- function Jt(t, e = "config") {
1703
- const n = (t.getAttribute(`data-${e}`) || "").replace(/'/g, '"');
1704
- return n ? JSON.parse(n) : {};
1705
- }
1706
- function Rt(t) {
1735
+ function jt(t) {
1707
1736
  if (typeof t == "string") {
1708
1737
  const e = document.getElementById(t);
1709
1738
  if (e) return e;
@@ -1715,87 +1744,110 @@ function Rt(t) {
1715
1744
  } else
1716
1745
  throw new Error("Invalid argument: query must be a string or HTMLElement");
1717
1746
  }
1718
- async function z3(t, e, ...n) {
1747
+ async function z2(t, e, ...n) {
1719
1748
  e in t && typeof t[e] == "function" && await t[e](...n);
1720
1749
  }
1721
- function Zt(t) {
1722
- return t.split("-").map(
1723
- (e, n) => n === 0 ? e : e.charAt(0).toUpperCase() + e.slice(1)
1724
- ).join("");
1725
- }
1726
- function kt(t) {
1727
- return t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
1728
- }
1729
- async function H2(t, e, n) {
1730
- await z3(e, t, n), n && await z3(n, t);
1750
+ function Kt(t, e = {}) {
1751
+ const n = {
1752
+ fallback: null,
1753
+ element: document.body,
1754
+ ...e
1755
+ };
1756
+ if (!t.startsWith("--")) {
1757
+ const s = Jt();
1758
+ s && (t = `${s}${t}`), t = `--${t}`;
1759
+ }
1760
+ const i = getComputedStyle(n.element).getPropertyValue(t).trim();
1761
+ if (i)
1762
+ return i;
1763
+ if (n.fallback)
1764
+ return n.fallback;
1765
+ throw new Error(`CSS variable "${t}" was not found!`);
1766
+ }
1767
+ async function N(t, e, n) {
1768
+ await z2(e, t, n), n && await z2(n, t);
1731
1769
  for (const i of e.plugins)
1732
- await z3(i, t, { plugin: i, parent: e, entry: n });
1733
- await e.emit(t, n);
1734
- }
1735
- function Gt(t) {
1736
- const e = getComputedStyle(t.el), n = {}, i = t.getSetting("customProps");
1737
- for (let s = 0; s < i.length; s++) {
1738
- const o2 = Qt(), r2 = t.parent.module.toLowerCase(), c = kt(i[s]), l2 = e.getPropertyValue(`--${o2}${r2}-${c}`).trim();
1739
- l2 && (n[c] = l2);
1740
- }
1741
- return n;
1770
+ await z2(i, t, { parent: e, entry: n });
1771
+ await e.emit(t, { parent: e, entry: n });
1742
1772
  }
1743
- function Qt() {
1773
+ function Jt() {
1744
1774
  return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim();
1745
1775
  }
1746
- function te(t, e, n = "camel") {
1747
- return e = n === "camel" ? Zt(e) : kt(e), t.split(".").concat(e).reduce((i, s) => i?.[s], this);
1748
- }
1749
- function ee(t, e = {}) {
1750
- const {
1751
- fallback: n,
1752
- props: i = ["dataConfig", "customProps", "settings", "parent.settings"]
1753
- } = e;
1754
- for (const s of i) {
1755
- const o2 = s !== "customProps" ? "camel" : "kebab", r2 = te.call(this, s, t, o2);
1756
- if (r2 !== void 0)
1757
- return r2;
1758
- }
1759
- if (n !== void 0)
1760
- return n;
1761
- throw new Error(`${this.parent.module} setting does not exist: ${t}`);
1776
+ class Gt {
1777
+ #t;
1778
+ #e;
1779
+ constructor() {
1780
+ this.#t = {}, this.#e = [];
1781
+ }
1782
+ get(e, n) {
1783
+ const { fallback: i, source: s } = n ?? {};
1784
+ if (s) {
1785
+ const o = this.#t?.[s]?.[e];
1786
+ if (o !== void 0)
1787
+ return o;
1788
+ } else
1789
+ for (const o of this.#e) {
1790
+ const r2 = this.#t?.[o]?.[e];
1791
+ if (r2 !== void 0)
1792
+ return r2;
1793
+ }
1794
+ if (i !== void 0)
1795
+ return i;
1796
+ throw new Error(`Config does not exist: ${e}`);
1797
+ }
1798
+ set(e, n = {}) {
1799
+ let i, s;
1800
+ return typeof e == "string" ? (i = e, s = n) : (i = "entry", s = e), this.#t[i] ? Object.assign(this.#t[i], s) : (this.#e.unshift(i), this.#t[i] = s), this.#t[i];
1801
+ }
1802
+ remove(e) {
1803
+ const n = this.#e.indexOf(e);
1804
+ n !== -1 && this.#e.splice(n, 1), delete this.#t[e];
1805
+ }
1806
+ setSourceOrder(e) {
1807
+ const n = Object.keys(this.#t).reverse(), i = e.filter((s) => n.includes(s));
1808
+ for (const s of n)
1809
+ i.includes(s) || i.push(s);
1810
+ return this.#e = i;
1811
+ }
1762
1812
  }
1763
- const ne = {
1764
- events: {},
1765
- on(t, e, ...n) {
1766
- this.events[t] || (this.events[t] = []), this.events[t].some(
1767
- (i) => i.listener === e
1768
- ) || this.events[t].push({ listener: e, args: n });
1769
- },
1770
- off(t, e) {
1771
- this.events[t] && (this.events[t] = this.events[t].filter(
1772
- (n) => n.listener !== e
1813
+ class Qt {
1814
+ constructor() {
1815
+ this.events = {};
1816
+ }
1817
+ on(e, n, ...i) {
1818
+ this.events[e] || (this.events[e] = []), this.events[e].some(
1819
+ (s) => s.listener === n
1820
+ ) || this.events[e].push({ listener: n, args: i });
1821
+ }
1822
+ off(e, n) {
1823
+ this.events[e] && (this.events[e] = this.events[e].filter(
1824
+ (i) => i.listener !== n
1773
1825
  ));
1774
- },
1775
- async emit(t, e) {
1776
- if (t = t.startsWith("on") ? t.slice(2, 3).toLowerCase() + t.slice(3) : t, !!this.events[t])
1777
- for (const { listener: n, args: i } of this.events[t])
1778
- await n(e, ...i);
1779
1826
  }
1780
- };
1781
- class ie extends Array {
1827
+ async emit(e, ...n) {
1828
+ if (e = e.startsWith("on") ? e.slice(2, 3).toLowerCase() + e.slice(3) : e, !!this.events[e])
1829
+ for (const { listener: i, args: s } of this.events[e])
1830
+ await i(...n, ...s);
1831
+ }
1832
+ }
1833
+ class Zt extends Array {
1782
1834
  constructor(e = {}) {
1783
1835
  super(), this.presets = e;
1784
1836
  }
1785
- applySettings(e) {
1786
- const n = e?.defaults || {}, i = this.presets?.[e.name] || {}, s = e?.options || {};
1787
- e.settings = { ...n, ...i, ...s };
1837
+ #t(e) {
1838
+ const n = this.presets?.[e.name] || {}, i = e?.options || {};
1839
+ e.config = { ...e.config, ...n, ...i };
1788
1840
  }
1789
- validate(e) {
1841
+ #e(e) {
1790
1842
  return !("name" in e) || typeof e.name != "string" ? (console.error("Plugin requires a name!"), false) : true;
1791
1843
  }
1792
1844
  get(e) {
1793
- return this.find((n) => n.name === e);
1845
+ return this.find((n) => n.name === e) || null;
1794
1846
  }
1795
1847
  add(e) {
1796
1848
  if (Array.isArray(e))
1797
1849
  e.forEach((n) => this.add(n));
1798
- else if (this.applySettings(e), this.validate(e)) {
1850
+ else if (this.#t(e), this.#e(e)) {
1799
1851
  const n = this.findIndex((i) => i.name === e.name);
1800
1852
  ~n ? this[n] = e : this.push(e);
1801
1853
  }
@@ -1805,104 +1857,83 @@ class ie extends Array {
1805
1857
  ~n && this.splice(n, 1);
1806
1858
  }
1807
1859
  }
1808
- const se = {
1809
- dataConfig: "config",
1810
- customProps: []
1811
- };
1812
- class Dt {
1813
- constructor(e, n, i = {}) {
1814
- this.parent = e, this.el = Rt(n), this.settings = { ...i }, this.dataConfig = {}, this.customProps = {};
1815
- }
1816
- get id() {
1817
- return this.el.id;
1818
- }
1819
- applySettings(e) {
1820
- return Object.assign(this.settings, e);
1821
- }
1822
- getSetting(e, n) {
1823
- return ee.call(this, e, n);
1824
- }
1825
- buildDataConfig() {
1826
- return Object.assign(
1827
- this.dataConfig,
1828
- Jt(this.el, this.getSetting("dataConfig"))
1829
- );
1830
- }
1831
- buildCustomProps() {
1832
- return Object.assign(this.customProps, Gt(this));
1833
- }
1834
- async init(e = {}) {
1835
- this.applySettings(e), this.buildDataConfig(), this.buildCustomProps();
1836
- }
1837
- async destroy() {
1838
- Object.getOwnPropertyNames(this).forEach((e) => {
1839
- delete this[e];
1840
- });
1860
+ class Pt {
1861
+ constructor(e, n) {
1862
+ this.config = new Gt(), this.parent = e, this.el = jt(n), this.id = this.el.id, this.config.set("parent", this.parent.config), this.config.set("entry", {});
1841
1863
  }
1842
1864
  }
1843
- class oe {
1865
+ const te = {
1866
+ selector: "",
1867
+ plugins: [],
1868
+ presets: {}
1869
+ };
1870
+ class ee {
1844
1871
  constructor(e = {}) {
1845
- this.module = this.constructor.name, this.collection = [], this.entryClass = Dt, this.settings = { ...se, ...e }, this.plugins = new ie(this.settings.presets), this.events = {}, Object.assign(this, ne);
1872
+ this.#t = new Qt(), this.events = this.#t.events, this.on = this.#t.on.bind(this.#t), this.off = this.#t.off.bind(this.#t), this.emit = this.#t.emit.bind(this.#t), this.collection = [], this.entryClass = Pt, this.name = this.constructor.name, this.config = { ...te, ...e }, this.plugins = new Zt(this.config.presets);
1846
1873
  }
1874
+ #t;
1847
1875
  get(e, n = "id") {
1848
1876
  return this.collection.find((i) => i[n] === e);
1849
1877
  }
1850
- applySettings(e) {
1851
- return Object.assign(this.settings, e);
1878
+ getOrThrow(e, n = "id") {
1879
+ const i = this.get(e, n);
1880
+ if (i)
1881
+ return i;
1882
+ throw new Error(
1883
+ `${this.name} entry not found in collection with ${String(n)} of "${e}"`
1884
+ );
1885
+ }
1886
+ updateConfig(e = {}) {
1887
+ return Object.assign(this.config, e);
1852
1888
  }
1853
- async createEntry(e, n) {
1854
- const i = new this.entryClass(this, e, n);
1855
- return await z3(i, "init"), await H2("onCreateEntry", this, i), i;
1889
+ async createEntry(e) {
1890
+ const n = new this.entryClass(this, e);
1891
+ return await z2(n, "init"), await N("onCreateEntry", this, n), n;
1856
1892
  }
1857
1893
  async destroyEntry(e) {
1858
- return await H2("onDestroyEntry", this, e), await z3(e, "destroy"), e;
1894
+ return await N("onDestroyEntry", this, e), await z2(e, "destroy"), e;
1859
1895
  }
1860
- async register(e, n = {}) {
1861
- const i = Rt(e), s = this.collection.findIndex((o2) => o2.id === i.id);
1862
- if (~s) {
1863
- const o2 = this.collection[s];
1864
- return o2.el = i, typeof o2.init == "function" && await o2.init(n), o2;
1865
- } else {
1866
- const o2 = await this.createEntry(i, n);
1867
- return this.collection.push(o2), await H2("onRegisterEntry", this, o2), o2;
1868
- }
1896
+ async register(e) {
1897
+ const n = this.collection.findIndex((i) => i.id === e.id);
1898
+ return ~n ? this.collection[n] = e : this.collection.push(e), await N("onRegisterEntry", this, e), e;
1869
1899
  }
1870
1900
  async deregister(e) {
1871
- const n = this.collection.findIndex((i) => i.id === e);
1901
+ const n = this.collection.findIndex((i) => i.id === e.id);
1872
1902
  if (~n) {
1873
- const i = await this.destroyEntry(this.collection[n]);
1874
- return await H2(
1903
+ await N(
1875
1904
  "onDeregisterEntry",
1876
1905
  this,
1877
1906
  this.collection[n]
1878
- ), this.collection.splice(n, 1), i;
1907
+ );
1908
+ const [i] = this.collection.splice(n, 1);
1879
1909
  }
1880
- return null;
1910
+ return e;
1881
1911
  }
1882
- async mount(e = {}) {
1883
- this.applySettings(e);
1884
- for (const i of this.settings?.plugins || [])
1885
- this.plugins.add(i);
1886
- for (const i of this.plugins)
1887
- await z3(i, "setup", { plugin: i, parent: this });
1888
- await H2("beforeMount", this);
1889
- const n = document.querySelectorAll(this.settings.selector);
1890
- for (const i of n)
1891
- await this.register(i);
1892
- return await H2("afterMount", this), this;
1893
- }
1894
- async unmount() {
1895
- for (await H2("beforeUnmount", this); this.collection.length > 0; )
1896
- await this.deregister(this.collection[0].id);
1897
- await H2("afterUnmount", this);
1898
- for (const e of this.plugins)
1899
- await z3(e, "teardown", { plugin: e, parent: this });
1900
- for (const e of [...this.plugins])
1901
- this.plugins.remove(e.name);
1912
+ async mount(e = (n) => n) {
1913
+ for (const n of this.config?.plugins || [])
1914
+ this.plugins.add(n);
1915
+ for (const n of this.plugins)
1916
+ await z2(n, "setup", this);
1917
+ if (await N("beforeMount", this), this.config.selector) {
1918
+ const n = document.querySelectorAll(this.config.selector);
1919
+ for (const i of n)
1920
+ await this.createEntry(i).then((s) => e(s)).then((s) => this.register(s));
1921
+ }
1922
+ return await N("afterMount", this), this;
1923
+ }
1924
+ async unmount(e = (n) => n) {
1925
+ for (await N("beforeUnmount", this); this.collection.length > 0; )
1926
+ await this.destroyEntry(this.collection[0]).then((n) => e(n)).then((n) => this.deregister(n));
1927
+ await N("afterUnmount", this);
1928
+ for (const n of this.plugins)
1929
+ await z2(n, "teardown", this);
1930
+ for (const n of [...this.plugins])
1931
+ this.plugins.remove(n.name);
1902
1932
  return this;
1903
1933
  }
1904
1934
  }
1905
- const re = {
1935
+ Kt("theme-prefix", { fallback: "vb-theme-" });
1936
+ const ne = {
1906
1937
  // Selectors
1907
1938
  selector: ".popover",
1908
1939
  selectorTooltip: ".popover_tooltip",
@@ -1927,78 +1958,78 @@ const re = {
1927
1958
  shiftPadding: 0,
1928
1959
  arrowPadding: 0,
1929
1960
  toggleDelay: 0
1930
- }, K = Math.min, j = Math.max, st = Math.round, it = Math.floor, R2 = (t) => ({
1961
+ }, j = Math.min, q2 = Math.max, st2 = Math.round, it = Math.floor, P2 = (t) => ({
1931
1962
  x: t,
1932
1963
  y: t
1933
- }), ce = {
1964
+ }), ie = {
1934
1965
  left: "right",
1935
1966
  right: "left",
1936
1967
  bottom: "top",
1937
1968
  top: "bottom"
1938
- }, le = {
1969
+ }, se = {
1939
1970
  start: "end",
1940
1971
  end: "start"
1941
1972
  };
1942
- function dt(t, e, n) {
1943
- return j(t, K(e, n));
1973
+ function ht(t, e, n) {
1974
+ return q2(t, j(e, n));
1944
1975
  }
1945
- function q2(t, e) {
1976
+ function X(t, e) {
1946
1977
  return typeof t == "function" ? t(e) : t;
1947
1978
  }
1948
- function I(t) {
1979
+ function I2(t) {
1949
1980
  return t.split("-")[0];
1950
1981
  }
1951
- function et2(t) {
1982
+ function et(t) {
1952
1983
  return t.split("-")[1];
1953
1984
  }
1954
- function mt(t) {
1985
+ function pt(t) {
1955
1986
  return t === "x" ? "y" : "x";
1956
1987
  }
1957
- function pt(t) {
1988
+ function wt(t) {
1958
1989
  return t === "y" ? "height" : "width";
1959
1990
  }
1960
- const ae = /* @__PURE__ */ new Set(["top", "bottom"]);
1961
- function N2(t) {
1962
- return ae.has(I(t)) ? "y" : "x";
1991
+ const oe = /* @__PURE__ */ new Set(["top", "bottom"]);
1992
+ function F(t) {
1993
+ return oe.has(I2(t)) ? "y" : "x";
1963
1994
  }
1964
- function wt(t) {
1965
- return mt(N2(t));
1995
+ function yt(t) {
1996
+ return pt(F(t));
1966
1997
  }
1967
- function fe(t, e, n) {
1998
+ function re(t, e, n) {
1968
1999
  n === void 0 && (n = false);
1969
- const i = et2(t), s = wt(t), o2 = pt(s);
2000
+ const i = et(t), s = yt(t), o = wt(s);
1970
2001
  let r2 = s === "x" ? i === (n ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
1971
- return e.reference[o2] > e.floating[o2] && (r2 = ot(r2)), [r2, ot(r2)];
2002
+ return e.reference[o] > e.floating[o] && (r2 = ot(r2)), [r2, ot(r2)];
1972
2003
  }
1973
- function ue(t) {
2004
+ function ce(t) {
1974
2005
  const e = ot(t);
1975
2006
  return [gt(t), e, gt(e)];
1976
2007
  }
1977
2008
  function gt(t) {
1978
- return t.replace(/start|end/g, (e) => le[e]);
2009
+ return t.replace(/start|end/g, (e) => se[e]);
1979
2010
  }
1980
- const At = ["left", "right"], Et = ["right", "left"], de = ["top", "bottom"], ge = ["bottom", "top"];
1981
- function he(t, e, n) {
2011
+ const Et = ["left", "right"], At = ["right", "left"], le = ["top", "bottom"], ae = ["bottom", "top"];
2012
+ function fe(t, e, n) {
1982
2013
  switch (t) {
1983
2014
  case "top":
1984
2015
  case "bottom":
1985
- return n ? e ? Et : At : e ? At : Et;
2016
+ return n ? e ? At : Et : e ? Et : At;
1986
2017
  case "left":
1987
2018
  case "right":
1988
- return e ? de : ge;
2019
+ return e ? le : ae;
1989
2020
  default:
1990
2021
  return [];
1991
2022
  }
1992
2023
  }
1993
- function me(t, e, n, i) {
1994
- const s = et2(t);
1995
- let o2 = he(I(t), n === "start", i);
1996
- return s && (o2 = o2.map((r2) => r2 + "-" + s), e && (o2 = o2.concat(o2.map(gt)))), o2;
2024
+ function ue(t, e, n, i) {
2025
+ const s = et(t);
2026
+ let o = fe(I2(t), n === "start", i);
2027
+ return s && (o = o.map((r2) => r2 + "-" + s), e && (o = o.concat(o.map(gt)))), o;
1997
2028
  }
1998
2029
  function ot(t) {
1999
- return t.replace(/left|right|bottom|top/g, (e) => ce[e]);
2030
+ return t.replace(/left|right|bottom|top/g, (e) => ie[e]);
2000
2031
  }
2001
- function pe(t) {
2032
+ function de(t) {
2002
2033
  return {
2003
2034
  top: 0,
2004
2035
  right: 0,
@@ -2007,8 +2038,8 @@ function pe(t) {
2007
2038
  ...t
2008
2039
  };
2009
2040
  }
2010
- function Mt(t) {
2011
- return typeof t != "number" ? pe(t) : {
2041
+ function kt(t) {
2042
+ return typeof t != "number" ? de(t) : {
2012
2043
  top: t,
2013
2044
  right: t,
2014
2045
  bottom: t,
@@ -2038,9 +2069,9 @@ function Ct(t, e, n) {
2038
2069
  reference: i,
2039
2070
  floating: s
2040
2071
  } = t;
2041
- const o2 = N2(e), r2 = wt(e), c = pt(r2), l2 = I(e), a2 = o2 === "y", d2 = i.x + i.width / 2 - s.width / 2, u2 = i.y + i.height / 2 - s.height / 2, g2 = i[c] / 2 - s[c] / 2;
2072
+ const o = F(e), r2 = yt(e), c2 = wt(r2), a2 = I2(e), l2 = o === "y", d2 = i.x + i.width / 2 - s.width / 2, u2 = i.y + i.height / 2 - s.height / 2, h2 = i[c2] / 2 - s[c2] / 2;
2042
2073
  let f2;
2043
- switch (l2) {
2074
+ switch (a2) {
2044
2075
  case "top":
2045
2076
  f2 = {
2046
2077
  x: d2,
@@ -2071,123 +2102,123 @@ function Ct(t, e, n) {
2071
2102
  y: i.y
2072
2103
  };
2073
2104
  }
2074
- switch (et2(e)) {
2105
+ switch (et(e)) {
2075
2106
  case "start":
2076
- f2[r2] -= g2 * (n && a2 ? -1 : 1);
2107
+ f2[r2] -= h2 * (n && l2 ? -1 : 1);
2077
2108
  break;
2078
2109
  case "end":
2079
- f2[r2] += g2 * (n && a2 ? -1 : 1);
2110
+ f2[r2] += h2 * (n && l2 ? -1 : 1);
2080
2111
  break;
2081
2112
  }
2082
2113
  return f2;
2083
2114
  }
2084
- const we = async (t, e, n) => {
2115
+ const he = async (t, e, n) => {
2085
2116
  const {
2086
2117
  placement: i = "bottom",
2087
2118
  strategy: s = "absolute",
2088
- middleware: o2 = [],
2119
+ middleware: o = [],
2089
2120
  platform: r2
2090
- } = n, c = o2.filter(Boolean), l2 = await (r2.isRTL == null ? void 0 : r2.isRTL(e));
2091
- let a2 = await r2.getElementRects({
2121
+ } = n, c2 = o.filter(Boolean), a2 = await (r2.isRTL == null ? void 0 : r2.isRTL(e));
2122
+ let l2 = await r2.getElementRects({
2092
2123
  reference: t,
2093
2124
  floating: e,
2094
2125
  strategy: s
2095
2126
  }), {
2096
2127
  x: d2,
2097
2128
  y: u2
2098
- } = Ct(a2, i, l2), g2 = i, f2 = {}, h2 = 0;
2099
- for (let m2 = 0; m2 < c.length; m2++) {
2129
+ } = Ct(l2, i, a2), h2 = i, f2 = {}, g3 = 0;
2130
+ for (let m2 = 0; m2 < c2.length; m2++) {
2100
2131
  const {
2101
2132
  name: p2,
2102
2133
  fn: w2
2103
- } = c[m2], {
2104
- x: y3,
2105
- y: x2,
2134
+ } = c2[m2], {
2135
+ x: y2,
2136
+ y: x3,
2106
2137
  data: b2,
2107
2138
  reset: v2
2108
2139
  } = await w2({
2109
2140
  x: d2,
2110
2141
  y: u2,
2111
2142
  initialPlacement: i,
2112
- placement: g2,
2143
+ placement: h2,
2113
2144
  strategy: s,
2114
2145
  middlewareData: f2,
2115
- rects: a2,
2146
+ rects: l2,
2116
2147
  platform: r2,
2117
2148
  elements: {
2118
2149
  reference: t,
2119
2150
  floating: e
2120
2151
  }
2121
2152
  });
2122
- d2 = y3 ?? d2, u2 = x2 ?? u2, f2 = {
2153
+ d2 = y2 ?? d2, u2 = x3 ?? u2, f2 = {
2123
2154
  ...f2,
2124
2155
  [p2]: {
2125
2156
  ...f2[p2],
2126
2157
  ...b2
2127
2158
  }
2128
- }, v2 && h2 <= 50 && (h2++, typeof v2 == "object" && (v2.placement && (g2 = v2.placement), v2.rects && (a2 = v2.rects === true ? await r2.getElementRects({
2159
+ }, v2 && g3 <= 50 && (g3++, typeof v2 == "object" && (v2.placement && (h2 = v2.placement), v2.rects && (l2 = v2.rects === true ? await r2.getElementRects({
2129
2160
  reference: t,
2130
2161
  floating: e,
2131
2162
  strategy: s
2132
2163
  }) : v2.rects), {
2133
2164
  x: d2,
2134
2165
  y: u2
2135
- } = Ct(a2, g2, l2)), m2 = -1);
2166
+ } = Ct(l2, h2, a2)), m2 = -1);
2136
2167
  }
2137
2168
  return {
2138
2169
  x: d2,
2139
2170
  y: u2,
2140
- placement: g2,
2171
+ placement: h2,
2141
2172
  strategy: s,
2142
2173
  middlewareData: f2
2143
2174
  };
2144
2175
  };
2145
- async function $t(t, e) {
2176
+ async function Dt(t, e) {
2146
2177
  var n;
2147
2178
  e === void 0 && (e = {});
2148
2179
  const {
2149
2180
  x: i,
2150
2181
  y: s,
2151
- platform: o2,
2182
+ platform: o,
2152
2183
  rects: r2,
2153
- elements: c,
2154
- strategy: l2
2184
+ elements: c2,
2185
+ strategy: a2
2155
2186
  } = t, {
2156
- boundary: a2 = "clippingAncestors",
2187
+ boundary: l2 = "clippingAncestors",
2157
2188
  rootBoundary: d2 = "viewport",
2158
2189
  elementContext: u2 = "floating",
2159
- altBoundary: g2 = false,
2190
+ altBoundary: h2 = false,
2160
2191
  padding: f2 = 0
2161
- } = q2(e, t), h2 = Mt(f2), p2 = c[g2 ? u2 === "floating" ? "reference" : "floating" : u2], w2 = rt(await o2.getClippingRect({
2162
- element: (n = await (o2.isElement == null ? void 0 : o2.isElement(p2))) == null || n ? p2 : p2.contextElement || await (o2.getDocumentElement == null ? void 0 : o2.getDocumentElement(c.floating)),
2163
- boundary: a2,
2192
+ } = X(e, t), g3 = kt(f2), p2 = c2[h2 ? u2 === "floating" ? "reference" : "floating" : u2], w2 = rt(await o.getClippingRect({
2193
+ element: (n = await (o.isElement == null ? void 0 : o.isElement(p2))) == null || n ? p2 : p2.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(c2.floating)),
2194
+ boundary: l2,
2164
2195
  rootBoundary: d2,
2165
- strategy: l2
2166
- })), y3 = u2 === "floating" ? {
2196
+ strategy: a2
2197
+ })), y2 = u2 === "floating" ? {
2167
2198
  x: i,
2168
2199
  y: s,
2169
2200
  width: r2.floating.width,
2170
2201
  height: r2.floating.height
2171
- } : r2.reference, x2 = await (o2.getOffsetParent == null ? void 0 : o2.getOffsetParent(c.floating)), b2 = await (o2.isElement == null ? void 0 : o2.isElement(x2)) ? await (o2.getScale == null ? void 0 : o2.getScale(x2)) || {
2202
+ } : r2.reference, x3 = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(c2.floating)), b2 = await (o.isElement == null ? void 0 : o.isElement(x3)) ? await (o.getScale == null ? void 0 : o.getScale(x3)) || {
2172
2203
  x: 1,
2173
2204
  y: 1
2174
2205
  } : {
2175
2206
  x: 1,
2176
2207
  y: 1
2177
- }, v2 = rt(o2.convertOffsetParentRelativeRectToViewportRelativeRect ? await o2.convertOffsetParentRelativeRectToViewportRelativeRect({
2178
- elements: c,
2179
- rect: y3,
2180
- offsetParent: x2,
2181
- strategy: l2
2182
- }) : y3);
2208
+ }, v2 = rt(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
2209
+ elements: c2,
2210
+ rect: y2,
2211
+ offsetParent: x3,
2212
+ strategy: a2
2213
+ }) : y2);
2183
2214
  return {
2184
- top: (w2.top - v2.top + h2.top) / b2.y,
2185
- bottom: (v2.bottom - w2.bottom + h2.bottom) / b2.y,
2186
- left: (w2.left - v2.left + h2.left) / b2.x,
2187
- right: (v2.right - w2.right + h2.right) / b2.x
2215
+ top: (w2.top - v2.top + g3.top) / b2.y,
2216
+ bottom: (v2.bottom - w2.bottom + g3.bottom) / b2.y,
2217
+ left: (w2.left - v2.left + g3.left) / b2.x,
2218
+ right: (v2.right - w2.right + g3.right) / b2.x
2188
2219
  };
2189
2220
  }
2190
- const ye = (t) => ({
2221
+ const ge = (t) => ({
2191
2222
  name: "arrow",
2192
2223
  options: t,
2193
2224
  async fn(e) {
@@ -2195,36 +2226,36 @@ const ye = (t) => ({
2195
2226
  x: n,
2196
2227
  y: i,
2197
2228
  placement: s,
2198
- rects: o2,
2229
+ rects: o,
2199
2230
  platform: r2,
2200
- elements: c,
2201
- middlewareData: l2
2231
+ elements: c2,
2232
+ middlewareData: a2
2202
2233
  } = e, {
2203
- element: a2,
2234
+ element: l2,
2204
2235
  padding: d2 = 0
2205
- } = q2(t, e) || {};
2206
- if (a2 == null)
2236
+ } = X(t, e) || {};
2237
+ if (l2 == null)
2207
2238
  return {};
2208
- const u2 = Mt(d2), g2 = {
2239
+ const u2 = kt(d2), h2 = {
2209
2240
  x: n,
2210
2241
  y: i
2211
- }, f2 = wt(s), h2 = pt(f2), m2 = await r2.getDimensions(a2), p2 = f2 === "y", w2 = p2 ? "top" : "left", y3 = p2 ? "bottom" : "right", x2 = p2 ? "clientHeight" : "clientWidth", b2 = o2.reference[h2] + o2.reference[f2] - g2[f2] - o2.floating[h2], v2 = g2[f2] - o2.reference[f2], C2 = await (r2.getOffsetParent == null ? void 0 : r2.getOffsetParent(a2));
2212
- let S3 = C2 ? C2[x2] : 0;
2213
- (!S3 || !await (r2.isElement == null ? void 0 : r2.isElement(C2))) && (S3 = c.floating[x2] || o2.floating[h2]);
2214
- const Z2 = b2 / 2 - v2 / 2, B2 = S3 / 2 - m2[h2] / 2 - 1, M2 = K(u2[w2], B2), G2 = K(u2[y3], B2), W2 = M2, Q2 = S3 - m2[h2] - G2, A2 = S3 / 2 - m2[h2] / 2 + Z2, _2 = dt(W2, A2, Q2), $2 = !l2.arrow && et2(s) != null && A2 !== _2 && o2.reference[h2] / 2 - (A2 < W2 ? M2 : G2) - m2[h2] / 2 < 0, L2 = $2 ? A2 < W2 ? A2 - W2 : A2 - Q2 : 0;
2242
+ }, f2 = yt(s), g3 = wt(f2), m2 = await r2.getDimensions(l2), p2 = f2 === "y", w2 = p2 ? "top" : "left", y2 = p2 ? "bottom" : "right", x3 = p2 ? "clientHeight" : "clientWidth", b2 = o.reference[g3] + o.reference[f2] - h2[f2] - o.floating[g3], v2 = h2[f2] - o.reference[f2], C2 = await (r2.getOffsetParent == null ? void 0 : r2.getOffsetParent(l2));
2243
+ let L4 = C2 ? C2[x3] : 0;
2244
+ (!L4 || !await (r2.isElement == null ? void 0 : r2.isElement(C2))) && (L4 = c2.floating[x3] || o.floating[g3]);
2245
+ const G2 = b2 / 2 - v2 / 2, V2 = L4 / 2 - m2[g3] / 2 - 1, M2 = j(u2[w2], V2), Q2 = j(u2[y2], V2), B2 = M2, Z2 = L4 - m2[g3] - Q2, E2 = L4 / 2 - m2[g3] / 2 + G2, _2 = ht(B2, E2, Z2), $2 = !a2.arrow && et(s) != null && E2 !== _2 && o.reference[g3] / 2 - (E2 < B2 ? M2 : Q2) - m2[g3] / 2 < 0, O3 = $2 ? E2 < B2 ? E2 - B2 : E2 - Z2 : 0;
2215
2246
  return {
2216
- [f2]: g2[f2] + L2,
2247
+ [f2]: h2[f2] + O3,
2217
2248
  data: {
2218
2249
  [f2]: _2,
2219
- centerOffset: A2 - _2 - L2,
2250
+ centerOffset: E2 - _2 - O3,
2220
2251
  ...$2 && {
2221
- alignmentOffset: L2
2252
+ alignmentOffset: O3
2222
2253
  }
2223
2254
  },
2224
2255
  reset: $2
2225
2256
  };
2226
2257
  }
2227
- }), xe = function(t) {
2258
+ }), me = function(t) {
2228
2259
  return t === void 0 && (t = {}), {
2229
2260
  name: "flip",
2230
2261
  options: t,
@@ -2232,67 +2263,67 @@ const ye = (t) => ({
2232
2263
  var n, i;
2233
2264
  const {
2234
2265
  placement: s,
2235
- middlewareData: o2,
2266
+ middlewareData: o,
2236
2267
  rects: r2,
2237
- initialPlacement: c,
2238
- platform: l2,
2239
- elements: a2
2268
+ initialPlacement: c2,
2269
+ platform: a2,
2270
+ elements: l2
2240
2271
  } = e, {
2241
2272
  mainAxis: d2 = true,
2242
2273
  crossAxis: u2 = true,
2243
- fallbackPlacements: g2,
2274
+ fallbackPlacements: h2,
2244
2275
  fallbackStrategy: f2 = "bestFit",
2245
- fallbackAxisSideDirection: h2 = "none",
2276
+ fallbackAxisSideDirection: g3 = "none",
2246
2277
  flipAlignment: m2 = true,
2247
2278
  ...p2
2248
- } = q2(t, e);
2249
- if ((n = o2.arrow) != null && n.alignmentOffset)
2279
+ } = X(t, e);
2280
+ if ((n = o.arrow) != null && n.alignmentOffset)
2250
2281
  return {};
2251
- const w2 = I(s), y3 = N2(c), x2 = I(c) === c, b2 = await (l2.isRTL == null ? void 0 : l2.isRTL(a2.floating)), v2 = g2 || (x2 || !m2 ? [ot(c)] : ue(c)), C2 = h2 !== "none";
2252
- !g2 && C2 && v2.push(...me(c, m2, h2, b2));
2253
- const S3 = [c, ...v2], Z2 = await $t(e, p2), B2 = [];
2254
- let M2 = ((i = o2.flip) == null ? void 0 : i.overflows) || [];
2255
- if (d2 && B2.push(Z2[w2]), u2) {
2256
- const A2 = fe(s, r2, b2);
2257
- B2.push(Z2[A2[0]], Z2[A2[1]]);
2282
+ const w2 = I2(s), y2 = F(c2), x3 = I2(c2) === c2, b2 = await (a2.isRTL == null ? void 0 : a2.isRTL(l2.floating)), v2 = h2 || (x3 || !m2 ? [ot(c2)] : ce(c2)), C2 = g3 !== "none";
2283
+ !h2 && C2 && v2.push(...ue(c2, m2, g3, b2));
2284
+ const L4 = [c2, ...v2], G2 = await Dt(e, p2), V2 = [];
2285
+ let M2 = ((i = o.flip) == null ? void 0 : i.overflows) || [];
2286
+ if (d2 && V2.push(G2[w2]), u2) {
2287
+ const E2 = re(s, r2, b2);
2288
+ V2.push(G2[E2[0]], G2[E2[1]]);
2258
2289
  }
2259
2290
  if (M2 = [...M2, {
2260
2291
  placement: s,
2261
- overflows: B2
2262
- }], !B2.every((A2) => A2 <= 0)) {
2263
- var G2, W2;
2264
- const A2 = (((G2 = o2.flip) == null ? void 0 : G2.index) || 0) + 1, _2 = S3[A2];
2265
- if (_2 && (!(u2 === "alignment" ? y3 !== N2(_2) : false) || // We leave the current main axis only if every placement on that axis
2292
+ overflows: V2
2293
+ }], !V2.every((E2) => E2 <= 0)) {
2294
+ var Q2, B2;
2295
+ const E2 = (((Q2 = o.flip) == null ? void 0 : Q2.index) || 0) + 1, _2 = L4[E2];
2296
+ if (_2 && (!(u2 === "alignment" ? y2 !== F(_2) : false) || // We leave the current main axis only if every placement on that axis
2266
2297
  // overflows the main axis.
2267
- M2.every((O3) => O3.overflows[0] > 0 && N2(O3.placement) === y3)))
2298
+ M2.every((T2) => F(T2.placement) === y2 ? T2.overflows[0] > 0 : true)))
2268
2299
  return {
2269
2300
  data: {
2270
- index: A2,
2301
+ index: E2,
2271
2302
  overflows: M2
2272
2303
  },
2273
2304
  reset: {
2274
2305
  placement: _2
2275
2306
  }
2276
2307
  };
2277
- let $2 = (W2 = M2.filter((L2) => L2.overflows[0] <= 0).sort((L2, O3) => L2.overflows[1] - O3.overflows[1])[0]) == null ? void 0 : W2.placement;
2308
+ let $2 = (B2 = M2.filter((O3) => O3.overflows[0] <= 0).sort((O3, T2) => O3.overflows[1] - T2.overflows[1])[0]) == null ? void 0 : B2.placement;
2278
2309
  if (!$2)
2279
2310
  switch (f2) {
2280
2311
  case "bestFit": {
2281
- var Q2;
2282
- const L2 = (Q2 = M2.filter((O3) => {
2312
+ var Z2;
2313
+ const O3 = (Z2 = M2.filter((T2) => {
2283
2314
  if (C2) {
2284
- const F2 = N2(O3.placement);
2285
- return F2 === y3 || // Create a bias to the `y` side axis due to horizontal
2315
+ const H2 = F(T2.placement);
2316
+ return H2 === y2 || // Create a bias to the `y` side axis due to horizontal
2286
2317
  // reading directions favoring greater width.
2287
- F2 === "y";
2318
+ H2 === "y";
2288
2319
  }
2289
2320
  return true;
2290
- }).map((O3) => [O3.placement, O3.overflows.filter((F2) => F2 > 0).reduce((F2, Xt) => F2 + Xt, 0)]).sort((O3, F2) => O3[1] - F2[1])[0]) == null ? void 0 : Q2[0];
2291
- L2 && ($2 = L2);
2321
+ }).map((T2) => [T2.placement, T2.overflows.filter((H2) => H2 > 0).reduce((H2, Yt) => H2 + Yt, 0)]).sort((T2, H2) => T2[1] - H2[1])[0]) == null ? void 0 : Z2[0];
2322
+ O3 && ($2 = O3);
2292
2323
  break;
2293
2324
  }
2294
2325
  case "initialPlacement":
2295
- $2 = c;
2326
+ $2 = c2;
2296
2327
  break;
2297
2328
  }
2298
2329
  if (s !== $2)
@@ -2305,17 +2336,17 @@ const ye = (t) => ({
2305
2336
  return {};
2306
2337
  }
2307
2338
  };
2308
- }, Nt = /* @__PURE__ */ new Set(["left", "top"]);
2309
- async function ve(t, e) {
2339
+ }, Mt = /* @__PURE__ */ new Set(["left", "top"]);
2340
+ async function pe(t, e) {
2310
2341
  const {
2311
2342
  placement: n,
2312
2343
  platform: i,
2313
2344
  elements: s
2314
- } = t, o2 = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r2 = I(n), c = et2(n), l2 = N2(n) === "y", a2 = Nt.has(r2) ? -1 : 1, d2 = o2 && l2 ? -1 : 1, u2 = q2(e, t);
2345
+ } = t, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r2 = I2(n), c2 = et(n), a2 = F(n) === "y", l2 = Mt.has(r2) ? -1 : 1, d2 = o && a2 ? -1 : 1, u2 = X(e, t);
2315
2346
  let {
2316
- mainAxis: g2,
2347
+ mainAxis: h2,
2317
2348
  crossAxis: f2,
2318
- alignmentAxis: h2
2349
+ alignmentAxis: g3
2319
2350
  } = typeof u2 == "number" ? {
2320
2351
  mainAxis: u2,
2321
2352
  crossAxis: 0,
@@ -2325,15 +2356,15 @@ async function ve(t, e) {
2325
2356
  crossAxis: u2.crossAxis || 0,
2326
2357
  alignmentAxis: u2.alignmentAxis
2327
2358
  };
2328
- return c && typeof h2 == "number" && (f2 = c === "end" ? h2 * -1 : h2), l2 ? {
2359
+ return c2 && typeof g3 == "number" && (f2 = c2 === "end" ? g3 * -1 : g3), a2 ? {
2329
2360
  x: f2 * d2,
2330
- y: g2 * a2
2361
+ y: h2 * l2
2331
2362
  } : {
2332
- x: g2 * a2,
2363
+ x: h2 * l2,
2333
2364
  y: f2 * d2
2334
2365
  };
2335
2366
  }
2336
- const be = function(t) {
2367
+ const we = function(t) {
2337
2368
  return t === void 0 && (t = 0), {
2338
2369
  name: "offset",
2339
2370
  options: t,
@@ -2341,21 +2372,21 @@ const be = function(t) {
2341
2372
  var n, i;
2342
2373
  const {
2343
2374
  x: s,
2344
- y: o2,
2375
+ y: o,
2345
2376
  placement: r2,
2346
- middlewareData: c
2347
- } = e, l2 = await ve(e, t);
2348
- return r2 === ((n = c.offset) == null ? void 0 : n.placement) && (i = c.arrow) != null && i.alignmentOffset ? {} : {
2349
- x: s + l2.x,
2350
- y: o2 + l2.y,
2377
+ middlewareData: c2
2378
+ } = e, a2 = await pe(e, t);
2379
+ return r2 === ((n = c2.offset) == null ? void 0 : n.placement) && (i = c2.arrow) != null && i.alignmentOffset ? {} : {
2380
+ x: s + a2.x,
2381
+ y: o + a2.y,
2351
2382
  data: {
2352
- ...l2,
2383
+ ...a2,
2353
2384
  placement: r2
2354
2385
  }
2355
2386
  };
2356
2387
  }
2357
2388
  };
2358
- }, Ae = function(t) {
2389
+ }, ye = function(t) {
2359
2390
  return t === void 0 && (t = {}), {
2360
2391
  name: "shift",
2361
2392
  options: t,
@@ -2365,38 +2396,38 @@ const be = function(t) {
2365
2396
  y: i,
2366
2397
  placement: s
2367
2398
  } = e, {
2368
- mainAxis: o2 = true,
2399
+ mainAxis: o = true,
2369
2400
  crossAxis: r2 = false,
2370
- limiter: c = {
2401
+ limiter: c2 = {
2371
2402
  fn: (p2) => {
2372
2403
  let {
2373
2404
  x: w2,
2374
- y: y3
2405
+ y: y2
2375
2406
  } = p2;
2376
2407
  return {
2377
2408
  x: w2,
2378
- y: y3
2409
+ y: y2
2379
2410
  };
2380
2411
  }
2381
2412
  },
2382
- ...l2
2383
- } = q2(t, e), a2 = {
2413
+ ...a2
2414
+ } = X(t, e), l2 = {
2384
2415
  x: n,
2385
2416
  y: i
2386
- }, d2 = await $t(e, l2), u2 = N2(I(s)), g2 = mt(u2);
2387
- let f2 = a2[g2], h2 = a2[u2];
2388
- if (o2) {
2389
- const p2 = g2 === "y" ? "top" : "left", w2 = g2 === "y" ? "bottom" : "right", y3 = f2 + d2[p2], x2 = f2 - d2[w2];
2390
- f2 = dt(y3, f2, x2);
2417
+ }, d2 = await Dt(e, a2), u2 = F(I2(s)), h2 = pt(u2);
2418
+ let f2 = l2[h2], g3 = l2[u2];
2419
+ if (o) {
2420
+ const p2 = h2 === "y" ? "top" : "left", w2 = h2 === "y" ? "bottom" : "right", y2 = f2 + d2[p2], x3 = f2 - d2[w2];
2421
+ f2 = ht(y2, f2, x3);
2391
2422
  }
2392
2423
  if (r2) {
2393
- const p2 = u2 === "y" ? "top" : "left", w2 = u2 === "y" ? "bottom" : "right", y3 = h2 + d2[p2], x2 = h2 - d2[w2];
2394
- h2 = dt(y3, h2, x2);
2424
+ const p2 = u2 === "y" ? "top" : "left", w2 = u2 === "y" ? "bottom" : "right", y2 = g3 + d2[p2], x3 = g3 - d2[w2];
2425
+ g3 = ht(y2, g3, x3);
2395
2426
  }
2396
- const m2 = c.fn({
2427
+ const m2 = c2.fn({
2397
2428
  ...e,
2398
- [g2]: f2,
2399
- [u2]: h2
2429
+ [h2]: f2,
2430
+ [u2]: g3
2400
2431
  });
2401
2432
  return {
2402
2433
  ...m2,
@@ -2404,14 +2435,14 @@ const be = function(t) {
2404
2435
  x: m2.x - n,
2405
2436
  y: m2.y - i,
2406
2437
  enabled: {
2407
- [g2]: o2,
2438
+ [h2]: o,
2408
2439
  [u2]: r2
2409
2440
  }
2410
2441
  }
2411
2442
  };
2412
2443
  }
2413
2444
  };
2414
- }, Ee = function(t) {
2445
+ }, xe = function(t) {
2415
2446
  return t === void 0 && (t = {}), {
2416
2447
  options: t,
2417
2448
  fn(e) {
@@ -2419,18 +2450,18 @@ const be = function(t) {
2419
2450
  x: n,
2420
2451
  y: i,
2421
2452
  placement: s,
2422
- rects: o2,
2453
+ rects: o,
2423
2454
  middlewareData: r2
2424
2455
  } = e, {
2425
- offset: c = 0,
2426
- mainAxis: l2 = true,
2427
- crossAxis: a2 = true
2428
- } = q2(t, e), d2 = {
2456
+ offset: c2 = 0,
2457
+ mainAxis: a2 = true,
2458
+ crossAxis: l2 = true
2459
+ } = X(t, e), d2 = {
2429
2460
  x: n,
2430
2461
  y: i
2431
- }, u2 = N2(s), g2 = mt(u2);
2432
- let f2 = d2[g2], h2 = d2[u2];
2433
- const m2 = q2(c, e), p2 = typeof m2 == "number" ? {
2462
+ }, u2 = F(s), h2 = pt(u2);
2463
+ let f2 = d2[h2], g3 = d2[u2];
2464
+ const m2 = X(c2, e), p2 = typeof m2 == "number" ? {
2434
2465
  mainAxis: m2,
2435
2466
  crossAxis: 0
2436
2467
  } : {
@@ -2438,18 +2469,18 @@ const be = function(t) {
2438
2469
  crossAxis: 0,
2439
2470
  ...m2
2440
2471
  };
2441
- if (l2) {
2442
- const x2 = g2 === "y" ? "height" : "width", b2 = o2.reference[g2] - o2.floating[x2] + p2.mainAxis, v2 = o2.reference[g2] + o2.reference[x2] - p2.mainAxis;
2472
+ if (a2) {
2473
+ const x3 = h2 === "y" ? "height" : "width", b2 = o.reference[h2] - o.floating[x3] + p2.mainAxis, v2 = o.reference[h2] + o.reference[x3] - p2.mainAxis;
2443
2474
  f2 < b2 ? f2 = b2 : f2 > v2 && (f2 = v2);
2444
2475
  }
2445
- if (a2) {
2446
- var w2, y3;
2447
- const x2 = g2 === "y" ? "width" : "height", b2 = Nt.has(I(s)), v2 = o2.reference[u2] - o2.floating[x2] + (b2 && ((w2 = r2.offset) == null ? void 0 : w2[u2]) || 0) + (b2 ? 0 : p2.crossAxis), C2 = o2.reference[u2] + o2.reference[x2] + (b2 ? 0 : ((y3 = r2.offset) == null ? void 0 : y3[u2]) || 0) - (b2 ? p2.crossAxis : 0);
2448
- h2 < v2 ? h2 = v2 : h2 > C2 && (h2 = C2);
2476
+ if (l2) {
2477
+ var w2, y2;
2478
+ const x3 = h2 === "y" ? "width" : "height", b2 = Mt.has(I2(s)), v2 = o.reference[u2] - o.floating[x3] + (b2 && ((w2 = r2.offset) == null ? void 0 : w2[u2]) || 0) + (b2 ? 0 : p2.crossAxis), C2 = o.reference[u2] + o.reference[x3] + (b2 ? 0 : ((y2 = r2.offset) == null ? void 0 : y2[u2]) || 0) - (b2 ? p2.crossAxis : 0);
2479
+ g3 < v2 ? g3 = v2 : g3 > C2 && (g3 = C2);
2449
2480
  }
2450
2481
  return {
2451
- [g2]: f2,
2452
- [u2]: h2
2482
+ [h2]: f2,
2483
+ [u2]: g3
2453
2484
  };
2454
2485
  }
2455
2486
  };
@@ -2458,45 +2489,45 @@ function ct() {
2458
2489
  return typeof window < "u";
2459
2490
  }
2460
2491
  function J(t) {
2461
- return Ft(t) ? (t.nodeName || "").toLowerCase() : "#document";
2492
+ return $t(t) ? (t.nodeName || "").toLowerCase() : "#document";
2462
2493
  }
2463
- function E(t) {
2494
+ function A3(t) {
2464
2495
  var e;
2465
2496
  return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
2466
2497
  }
2467
- function D(t) {
2498
+ function D2(t) {
2468
2499
  var e;
2469
- return (e = (Ft(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
2500
+ return (e = ($t(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
2470
2501
  }
2471
- function Ft(t) {
2472
- return ct() ? t instanceof Node || t instanceof E(t).Node : false;
2502
+ function $t(t) {
2503
+ return ct() ? t instanceof Node || t instanceof A3(t).Node : false;
2473
2504
  }
2474
- function P(t) {
2475
- return ct() ? t instanceof Element || t instanceof E(t).Element : false;
2505
+ function S2(t) {
2506
+ return ct() ? t instanceof Element || t instanceof A3(t).Element : false;
2476
2507
  }
2477
- function k2(t) {
2478
- return ct() ? t instanceof HTMLElement || t instanceof E(t).HTMLElement : false;
2508
+ function k(t) {
2509
+ return ct() ? t instanceof HTMLElement || t instanceof A3(t).HTMLElement : false;
2479
2510
  }
2480
- function St(t) {
2481
- return !ct() || typeof ShadowRoot > "u" ? false : t instanceof ShadowRoot || t instanceof E(t).ShadowRoot;
2511
+ function Lt(t) {
2512
+ return !ct() || typeof ShadowRoot > "u" ? false : t instanceof ShadowRoot || t instanceof A3(t).ShadowRoot;
2482
2513
  }
2483
- const Ce = /* @__PURE__ */ new Set(["inline", "contents"]);
2514
+ const ve = /* @__PURE__ */ new Set(["inline", "contents"]);
2484
2515
  function nt(t) {
2485
2516
  const {
2486
2517
  overflow: e,
2487
2518
  overflowX: n,
2488
2519
  overflowY: i,
2489
2520
  display: s
2490
- } = T2(t);
2491
- return /auto|scroll|overlay|hidden|clip/.test(e + i + n) && !Ce.has(s);
2521
+ } = R(t);
2522
+ return /auto|scroll|overlay|hidden|clip/.test(e + i + n) && !ve.has(s);
2492
2523
  }
2493
- const Se = /* @__PURE__ */ new Set(["table", "td", "th"]);
2494
- function Le(t) {
2495
- return Se.has(J(t));
2524
+ const be = /* @__PURE__ */ new Set(["table", "td", "th"]);
2525
+ function Ee(t) {
2526
+ return be.has(J(t));
2496
2527
  }
2497
- const Oe = [":popover-open", ":modal"];
2528
+ const Ae = [":popover-open", ":modal"];
2498
2529
  function lt(t) {
2499
- return Oe.some((e) => {
2530
+ return Ae.some((e) => {
2500
2531
  try {
2501
2532
  return t.matches(e);
2502
2533
  } catch {
@@ -2504,34 +2535,34 @@ function lt(t) {
2504
2535
  }
2505
2536
  });
2506
2537
  }
2507
- const Pe = ["transform", "translate", "scale", "rotate", "perspective"], Te = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Re = ["paint", "layout", "strict", "content"];
2508
- function yt(t) {
2509
- const e = xt(), n = P(t) ? T2(t) : t;
2510
- return Pe.some((i) => n[i] ? n[i] !== "none" : false) || (n.containerType ? n.containerType !== "normal" : false) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : false) || !e && (n.filter ? n.filter !== "none" : false) || Te.some((i) => (n.willChange || "").includes(i)) || Re.some((i) => (n.contain || "").includes(i));
2538
+ const Ce = ["transform", "translate", "scale", "rotate", "perspective"], Le = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Oe = ["paint", "layout", "strict", "content"];
2539
+ function xt(t) {
2540
+ const e = vt(), n = S2(t) ? R(t) : t;
2541
+ return Ce.some((i) => n[i] ? n[i] !== "none" : false) || (n.containerType ? n.containerType !== "normal" : false) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : false) || !e && (n.filter ? n.filter !== "none" : false) || Le.some((i) => (n.willChange || "").includes(i)) || Oe.some((i) => (n.contain || "").includes(i));
2511
2542
  }
2512
- function ke(t) {
2513
- let e = V(t);
2514
- for (; k2(e) && !X(e); ) {
2515
- if (yt(e))
2543
+ function Te(t) {
2544
+ let e = W(t);
2545
+ for (; k(e) && !K(e); ) {
2546
+ if (xt(e))
2516
2547
  return e;
2517
2548
  if (lt(e))
2518
2549
  return null;
2519
- e = V(e);
2550
+ e = W(e);
2520
2551
  }
2521
2552
  return null;
2522
2553
  }
2523
- function xt() {
2554
+ function vt() {
2524
2555
  return typeof CSS > "u" || !CSS.supports ? false : CSS.supports("-webkit-backdrop-filter", "none");
2525
2556
  }
2526
- const De = /* @__PURE__ */ new Set(["html", "body", "#document"]);
2527
- function X(t) {
2528
- return De.has(J(t));
2557
+ const Se = /* @__PURE__ */ new Set(["html", "body", "#document"]);
2558
+ function K(t) {
2559
+ return Se.has(J(t));
2529
2560
  }
2530
- function T2(t) {
2531
- return E(t).getComputedStyle(t);
2561
+ function R(t) {
2562
+ return A3(t).getComputedStyle(t);
2532
2563
  }
2533
2564
  function at(t) {
2534
- return P(t) ? {
2565
+ return S2(t) ? {
2535
2566
  scrollLeft: t.scrollLeft,
2536
2567
  scrollTop: t.scrollTop
2537
2568
  } : {
@@ -2539,187 +2570,189 @@ function at(t) {
2539
2570
  scrollTop: t.scrollY
2540
2571
  };
2541
2572
  }
2542
- function V(t) {
2573
+ function W(t) {
2543
2574
  if (J(t) === "html")
2544
2575
  return t;
2545
2576
  const e = (
2546
2577
  // Step into the shadow DOM of the parent of a slotted node.
2547
2578
  t.assignedSlot || // DOM Element detected.
2548
2579
  t.parentNode || // ShadowRoot detected.
2549
- St(t) && t.host || // Fallback.
2550
- D(t)
2580
+ Lt(t) && t.host || // Fallback.
2581
+ D2(t)
2551
2582
  );
2552
- return St(e) ? e.host : e;
2583
+ return Lt(e) ? e.host : e;
2553
2584
  }
2554
- function Ht(t) {
2555
- const e = V(t);
2556
- return X(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : k2(e) && nt(e) ? e : Ht(e);
2585
+ function Ft(t) {
2586
+ const e = W(t);
2587
+ return K(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : k(e) && nt(e) ? e : Ft(e);
2557
2588
  }
2558
2589
  function tt(t, e, n) {
2559
2590
  var i;
2560
2591
  e === void 0 && (e = []), n === void 0 && (n = true);
2561
- const s = Ht(t), o2 = s === ((i = t.ownerDocument) == null ? void 0 : i.body), r2 = E(s);
2562
- if (o2) {
2563
- const c = ht(r2);
2564
- return e.concat(r2, r2.visualViewport || [], nt(s) ? s : [], c && n ? tt(c) : []);
2592
+ const s = Ft(t), o = s === ((i = t.ownerDocument) == null ? void 0 : i.body), r2 = A3(s);
2593
+ if (o) {
2594
+ const c2 = mt(r2);
2595
+ return e.concat(r2, r2.visualViewport || [], nt(s) ? s : [], c2 && n ? tt(c2) : []);
2565
2596
  }
2566
2597
  return e.concat(s, tt(s, [], n));
2567
2598
  }
2568
- function ht(t) {
2599
+ function mt(t) {
2569
2600
  return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
2570
2601
  }
2571
- function It(t) {
2572
- const e = T2(t);
2602
+ function Ht(t) {
2603
+ const e = R(t);
2573
2604
  let n = parseFloat(e.width) || 0, i = parseFloat(e.height) || 0;
2574
- const s = k2(t), o2 = s ? t.offsetWidth : n, r2 = s ? t.offsetHeight : i, c = st(n) !== o2 || st(i) !== r2;
2575
- return c && (n = o2, i = r2), {
2605
+ const s = k(t), o = s ? t.offsetWidth : n, r2 = s ? t.offsetHeight : i, c2 = st2(n) !== o || st2(i) !== r2;
2606
+ return c2 && (n = o, i = r2), {
2576
2607
  width: n,
2577
2608
  height: i,
2578
- $: c
2609
+ $: c2
2579
2610
  };
2580
2611
  }
2581
- function vt(t) {
2582
- return P(t) ? t : t.contextElement;
2612
+ function bt(t) {
2613
+ return S2(t) ? t : t.contextElement;
2583
2614
  }
2584
2615
  function Y(t) {
2585
- const e = vt(t);
2586
- if (!k2(e))
2587
- return R2(1);
2616
+ const e = bt(t);
2617
+ if (!k(e))
2618
+ return P2(1);
2588
2619
  const n = e.getBoundingClientRect(), {
2589
2620
  width: i,
2590
2621
  height: s,
2591
- $: o2
2592
- } = It(e);
2593
- let r2 = (o2 ? st(n.width) : n.width) / i, c = (o2 ? st(n.height) : n.height) / s;
2594
- return (!r2 || !Number.isFinite(r2)) && (r2 = 1), (!c || !Number.isFinite(c)) && (c = 1), {
2622
+ $: o
2623
+ } = Ht(e);
2624
+ let r2 = (o ? st2(n.width) : n.width) / i, c2 = (o ? st2(n.height) : n.height) / s;
2625
+ return (!r2 || !Number.isFinite(r2)) && (r2 = 1), (!c2 || !Number.isFinite(c2)) && (c2 = 1), {
2595
2626
  x: r2,
2596
- y: c
2627
+ y: c2
2597
2628
  };
2598
2629
  }
2599
- const Me = /* @__PURE__ */ R2(0);
2600
- function Vt(t) {
2601
- const e = E(t);
2602
- return !xt() || !e.visualViewport ? Me : {
2630
+ const Re = /* @__PURE__ */ P2(0);
2631
+ function Nt(t) {
2632
+ const e = A3(t);
2633
+ return !vt() || !e.visualViewport ? Re : {
2603
2634
  x: e.visualViewport.offsetLeft,
2604
2635
  y: e.visualViewport.offsetTop
2605
2636
  };
2606
2637
  }
2607
- function $e(t, e, n) {
2608
- return e === void 0 && (e = false), !n || e && n !== E(t) ? false : e;
2638
+ function Pe(t, e, n) {
2639
+ return e === void 0 && (e = false), !n || e && n !== A3(t) ? false : e;
2609
2640
  }
2610
2641
  function U2(t, e, n, i) {
2611
2642
  e === void 0 && (e = false), n === void 0 && (n = false);
2612
- const s = t.getBoundingClientRect(), o2 = vt(t);
2613
- let r2 = R2(1);
2614
- e && (i ? P(i) && (r2 = Y(i)) : r2 = Y(t));
2615
- const c = $e(o2, n, i) ? Vt(o2) : R2(0);
2616
- let l2 = (s.left + c.x) / r2.x, a2 = (s.top + c.y) / r2.y, d2 = s.width / r2.x, u2 = s.height / r2.y;
2617
- if (o2) {
2618
- const g2 = E(o2), f2 = i && P(i) ? E(i) : i;
2619
- let h2 = g2, m2 = ht(h2);
2620
- for (; m2 && i && f2 !== h2; ) {
2621
- const p2 = Y(m2), w2 = m2.getBoundingClientRect(), y3 = T2(m2), x2 = w2.left + (m2.clientLeft + parseFloat(y3.paddingLeft)) * p2.x, b2 = w2.top + (m2.clientTop + parseFloat(y3.paddingTop)) * p2.y;
2622
- l2 *= p2.x, a2 *= p2.y, d2 *= p2.x, u2 *= p2.y, l2 += x2, a2 += b2, h2 = E(m2), m2 = ht(h2);
2643
+ const s = t.getBoundingClientRect(), o = bt(t);
2644
+ let r2 = P2(1);
2645
+ e && (i ? S2(i) && (r2 = Y(i)) : r2 = Y(t));
2646
+ const c2 = Pe(o, n, i) ? Nt(o) : P2(0);
2647
+ let a2 = (s.left + c2.x) / r2.x, l2 = (s.top + c2.y) / r2.y, d2 = s.width / r2.x, u2 = s.height / r2.y;
2648
+ if (o) {
2649
+ const h2 = A3(o), f2 = i && S2(i) ? A3(i) : i;
2650
+ let g3 = h2, m2 = mt(g3);
2651
+ for (; m2 && i && f2 !== g3; ) {
2652
+ const p2 = Y(m2), w2 = m2.getBoundingClientRect(), y2 = R(m2), x3 = w2.left + (m2.clientLeft + parseFloat(y2.paddingLeft)) * p2.x, b2 = w2.top + (m2.clientTop + parseFloat(y2.paddingTop)) * p2.y;
2653
+ a2 *= p2.x, l2 *= p2.y, d2 *= p2.x, u2 *= p2.y, a2 += x3, l2 += b2, g3 = A3(m2), m2 = mt(g3);
2623
2654
  }
2624
2655
  }
2625
2656
  return rt({
2626
2657
  width: d2,
2627
2658
  height: u2,
2628
- x: l2,
2629
- y: a2
2659
+ x: a2,
2660
+ y: l2
2630
2661
  });
2631
2662
  }
2632
- function bt(t, e) {
2663
+ function ft(t, e) {
2633
2664
  const n = at(t).scrollLeft;
2634
- return e ? e.left + n : U2(D(t)).left + n;
2665
+ return e ? e.left + n : U2(D2(t)).left + n;
2635
2666
  }
2636
- function Bt(t, e, n) {
2637
- n === void 0 && (n = false);
2638
- const i = t.getBoundingClientRect(), s = i.left + e.scrollLeft - (n ? 0 : (
2639
- // RTL <body> scrollbar.
2640
- bt(t, i)
2641
- )), o2 = i.top + e.scrollTop;
2667
+ function It(t, e) {
2668
+ const n = t.getBoundingClientRect(), i = n.left + e.scrollLeft - ft(t, n), s = n.top + e.scrollTop;
2642
2669
  return {
2643
- x: s,
2644
- y: o2
2670
+ x: i,
2671
+ y: s
2645
2672
  };
2646
2673
  }
2647
- function Ne(t) {
2674
+ function ke(t) {
2648
2675
  let {
2649
2676
  elements: e,
2650
2677
  rect: n,
2651
2678
  offsetParent: i,
2652
2679
  strategy: s
2653
2680
  } = t;
2654
- const o2 = s === "fixed", r2 = D(i), c = e ? lt(e.floating) : false;
2655
- if (i === r2 || c && o2)
2681
+ const o = s === "fixed", r2 = D2(i), c2 = e ? lt(e.floating) : false;
2682
+ if (i === r2 || c2 && o)
2656
2683
  return n;
2657
- let l2 = {
2684
+ let a2 = {
2658
2685
  scrollLeft: 0,
2659
2686
  scrollTop: 0
2660
- }, a2 = R2(1);
2661
- const d2 = R2(0), u2 = k2(i);
2662
- if ((u2 || !u2 && !o2) && ((J(i) !== "body" || nt(r2)) && (l2 = at(i)), k2(i))) {
2687
+ }, l2 = P2(1);
2688
+ const d2 = P2(0), u2 = k(i);
2689
+ if ((u2 || !u2 && !o) && ((J(i) !== "body" || nt(r2)) && (a2 = at(i)), k(i))) {
2663
2690
  const f2 = U2(i);
2664
- a2 = Y(i), d2.x = f2.x + i.clientLeft, d2.y = f2.y + i.clientTop;
2691
+ l2 = Y(i), d2.x = f2.x + i.clientLeft, d2.y = f2.y + i.clientTop;
2665
2692
  }
2666
- const g2 = r2 && !u2 && !o2 ? Bt(r2, l2, true) : R2(0);
2693
+ const h2 = r2 && !u2 && !o ? It(r2, a2) : P2(0);
2667
2694
  return {
2668
- width: n.width * a2.x,
2669
- height: n.height * a2.y,
2670
- x: n.x * a2.x - l2.scrollLeft * a2.x + d2.x + g2.x,
2671
- y: n.y * a2.y - l2.scrollTop * a2.y + d2.y + g2.y
2695
+ width: n.width * l2.x,
2696
+ height: n.height * l2.y,
2697
+ x: n.x * l2.x - a2.scrollLeft * l2.x + d2.x + h2.x,
2698
+ y: n.y * l2.y - a2.scrollTop * l2.y + d2.y + h2.y
2672
2699
  };
2673
2700
  }
2674
- function Fe(t) {
2701
+ function De(t) {
2675
2702
  return Array.from(t.getClientRects());
2676
2703
  }
2677
- function He(t) {
2678
- const e = D(t), n = at(t), i = t.ownerDocument.body, s = j(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth), o2 = j(e.scrollHeight, e.clientHeight, i.scrollHeight, i.clientHeight);
2679
- let r2 = -n.scrollLeft + bt(t);
2680
- const c = -n.scrollTop;
2681
- return T2(i).direction === "rtl" && (r2 += j(e.clientWidth, i.clientWidth) - s), {
2704
+ function Me(t) {
2705
+ const e = D2(t), n = at(t), i = t.ownerDocument.body, s = q2(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth), o = q2(e.scrollHeight, e.clientHeight, i.scrollHeight, i.clientHeight);
2706
+ let r2 = -n.scrollLeft + ft(t);
2707
+ const c2 = -n.scrollTop;
2708
+ return R(i).direction === "rtl" && (r2 += q2(e.clientWidth, i.clientWidth) - s), {
2682
2709
  width: s,
2683
- height: o2,
2710
+ height: o,
2684
2711
  x: r2,
2685
- y: c
2712
+ y: c2
2686
2713
  };
2687
2714
  }
2688
- function Ie(t, e) {
2689
- const n = E(t), i = D(t), s = n.visualViewport;
2690
- let o2 = i.clientWidth, r2 = i.clientHeight, c = 0, l2 = 0;
2715
+ const Ot = 25;
2716
+ function $e(t, e) {
2717
+ const n = A3(t), i = D2(t), s = n.visualViewport;
2718
+ let o = i.clientWidth, r2 = i.clientHeight, c2 = 0, a2 = 0;
2691
2719
  if (s) {
2692
- o2 = s.width, r2 = s.height;
2693
- const a2 = xt();
2694
- (!a2 || a2 && e === "fixed") && (c = s.offsetLeft, l2 = s.offsetTop);
2695
- }
2720
+ o = s.width, r2 = s.height;
2721
+ const d2 = vt();
2722
+ (!d2 || d2 && e === "fixed") && (c2 = s.offsetLeft, a2 = s.offsetTop);
2723
+ }
2724
+ const l2 = ft(i);
2725
+ if (l2 <= 0) {
2726
+ const d2 = i.ownerDocument, u2 = d2.body, h2 = getComputedStyle(u2), f2 = d2.compatMode === "CSS1Compat" && parseFloat(h2.marginLeft) + parseFloat(h2.marginRight) || 0, g3 = Math.abs(i.clientWidth - u2.clientWidth - f2);
2727
+ g3 <= Ot && (o -= g3);
2728
+ } else l2 <= Ot && (o += l2);
2696
2729
  return {
2697
- width: o2,
2730
+ width: o,
2698
2731
  height: r2,
2699
- x: c,
2700
- y: l2
2732
+ x: c2,
2733
+ y: a2
2701
2734
  };
2702
2735
  }
2703
- const Ve = /* @__PURE__ */ new Set(["absolute", "fixed"]);
2704
- function Be(t, e) {
2705
- const n = U2(t, true, e === "fixed"), i = n.top + t.clientTop, s = n.left + t.clientLeft, o2 = k2(t) ? Y(t) : R2(1), r2 = t.clientWidth * o2.x, c = t.clientHeight * o2.y, l2 = s * o2.x, a2 = i * o2.y;
2736
+ const Fe = /* @__PURE__ */ new Set(["absolute", "fixed"]);
2737
+ function He(t, e) {
2738
+ const n = U2(t, true, e === "fixed"), i = n.top + t.clientTop, s = n.left + t.clientLeft, o = k(t) ? Y(t) : P2(1), r2 = t.clientWidth * o.x, c2 = t.clientHeight * o.y, a2 = s * o.x, l2 = i * o.y;
2706
2739
  return {
2707
2740
  width: r2,
2708
- height: c,
2709
- x: l2,
2710
- y: a2
2741
+ height: c2,
2742
+ x: a2,
2743
+ y: l2
2711
2744
  };
2712
2745
  }
2713
- function Lt(t, e, n) {
2746
+ function Tt(t, e, n) {
2714
2747
  let i;
2715
2748
  if (e === "viewport")
2716
- i = Ie(t, n);
2749
+ i = $e(t, n);
2717
2750
  else if (e === "document")
2718
- i = He(D(t));
2719
- else if (P(e))
2720
- i = Be(e, n);
2751
+ i = Me(D2(t));
2752
+ else if (S2(e))
2753
+ i = He(e, n);
2721
2754
  else {
2722
- const s = Vt(t);
2755
+ const s = Nt(t);
2723
2756
  i = {
2724
2757
  x: e.x - s.x,
2725
2758
  y: e.y - s.y,
@@ -2730,107 +2763,107 @@ function Lt(t, e, n) {
2730
2763
  return rt(i);
2731
2764
  }
2732
2765
  function Wt(t, e) {
2733
- const n = V(t);
2734
- return n === e || !P(n) || X(n) ? false : T2(n).position === "fixed" || Wt(n, e);
2766
+ const n = W(t);
2767
+ return n === e || !S2(n) || K(n) ? false : R(n).position === "fixed" || Wt(n, e);
2735
2768
  }
2736
- function We(t, e) {
2769
+ function Ne(t, e) {
2737
2770
  const n = e.get(t);
2738
2771
  if (n)
2739
2772
  return n;
2740
- let i = tt(t, [], false).filter((c) => P(c) && J(c) !== "body"), s = null;
2741
- const o2 = T2(t).position === "fixed";
2742
- let r2 = o2 ? V(t) : t;
2743
- for (; P(r2) && !X(r2); ) {
2744
- const c = T2(r2), l2 = yt(r2);
2745
- !l2 && c.position === "fixed" && (s = null), (o2 ? !l2 && !s : !l2 && c.position === "static" && !!s && Ve.has(s.position) || nt(r2) && !l2 && Wt(t, r2)) ? i = i.filter((d2) => d2 !== r2) : s = c, r2 = V(r2);
2773
+ let i = tt(t, [], false).filter((c2) => S2(c2) && J(c2) !== "body"), s = null;
2774
+ const o = R(t).position === "fixed";
2775
+ let r2 = o ? W(t) : t;
2776
+ for (; S2(r2) && !K(r2); ) {
2777
+ const c2 = R(r2), a2 = xt(r2);
2778
+ !a2 && c2.position === "fixed" && (s = null), (o ? !a2 && !s : !a2 && c2.position === "static" && !!s && Fe.has(s.position) || nt(r2) && !a2 && Wt(t, r2)) ? i = i.filter((d2) => d2 !== r2) : s = c2, r2 = W(r2);
2746
2779
  }
2747
2780
  return e.set(t, i), i;
2748
2781
  }
2749
- function _e(t) {
2782
+ function Ie(t) {
2750
2783
  let {
2751
2784
  element: e,
2752
2785
  boundary: n,
2753
2786
  rootBoundary: i,
2754
2787
  strategy: s
2755
2788
  } = t;
2756
- const r2 = [...n === "clippingAncestors" ? lt(e) ? [] : We(e, this._c) : [].concat(n), i], c = r2[0], l2 = r2.reduce((a2, d2) => {
2757
- const u2 = Lt(e, d2, s);
2758
- return a2.top = j(u2.top, a2.top), a2.right = K(u2.right, a2.right), a2.bottom = K(u2.bottom, a2.bottom), a2.left = j(u2.left, a2.left), a2;
2759
- }, Lt(e, c, s));
2789
+ const r2 = [...n === "clippingAncestors" ? lt(e) ? [] : Ne(e, this._c) : [].concat(n), i], c2 = r2[0], a2 = r2.reduce((l2, d2) => {
2790
+ const u2 = Tt(e, d2, s);
2791
+ return l2.top = q2(u2.top, l2.top), l2.right = j(u2.right, l2.right), l2.bottom = j(u2.bottom, l2.bottom), l2.left = q2(u2.left, l2.left), l2;
2792
+ }, Tt(e, c2, s));
2760
2793
  return {
2761
- width: l2.right - l2.left,
2762
- height: l2.bottom - l2.top,
2763
- x: l2.left,
2764
- y: l2.top
2794
+ width: a2.right - a2.left,
2795
+ height: a2.bottom - a2.top,
2796
+ x: a2.left,
2797
+ y: a2.top
2765
2798
  };
2766
2799
  }
2767
- function ze(t) {
2800
+ function We(t) {
2768
2801
  const {
2769
2802
  width: e,
2770
2803
  height: n
2771
- } = It(t);
2804
+ } = Ht(t);
2772
2805
  return {
2773
2806
  width: e,
2774
2807
  height: n
2775
2808
  };
2776
2809
  }
2777
- function je(t, e, n) {
2778
- const i = k2(e), s = D(e), o2 = n === "fixed", r2 = U2(t, true, o2, e);
2779
- let c = {
2810
+ function Ve(t, e, n) {
2811
+ const i = k(e), s = D2(e), o = n === "fixed", r2 = U2(t, true, o, e);
2812
+ let c2 = {
2780
2813
  scrollLeft: 0,
2781
2814
  scrollTop: 0
2782
2815
  };
2783
- const l2 = R2(0);
2784
- function a2() {
2785
- l2.x = bt(s);
2786
- }
2787
- if (i || !i && !o2)
2788
- if ((J(e) !== "body" || nt(s)) && (c = at(e)), i) {
2789
- const f2 = U2(e, true, o2, e);
2790
- l2.x = f2.x + e.clientLeft, l2.y = f2.y + e.clientTop;
2791
- } else s && a2();
2792
- o2 && !i && s && a2();
2793
- const d2 = s && !i && !o2 ? Bt(s, c) : R2(0), u2 = r2.left + c.scrollLeft - l2.x - d2.x, g2 = r2.top + c.scrollTop - l2.y - d2.y;
2816
+ const a2 = P2(0);
2817
+ function l2() {
2818
+ a2.x = ft(s);
2819
+ }
2820
+ if (i || !i && !o)
2821
+ if ((J(e) !== "body" || nt(s)) && (c2 = at(e)), i) {
2822
+ const f2 = U2(e, true, o, e);
2823
+ a2.x = f2.x + e.clientLeft, a2.y = f2.y + e.clientTop;
2824
+ } else s && l2();
2825
+ o && !i && s && l2();
2826
+ const d2 = s && !i && !o ? It(s, c2) : P2(0), u2 = r2.left + c2.scrollLeft - a2.x - d2.x, h2 = r2.top + c2.scrollTop - a2.y - d2.y;
2794
2827
  return {
2795
2828
  x: u2,
2796
- y: g2,
2829
+ y: h2,
2797
2830
  width: r2.width,
2798
2831
  height: r2.height
2799
2832
  };
2800
2833
  }
2801
- function ft(t) {
2802
- return T2(t).position === "static";
2834
+ function ut(t) {
2835
+ return R(t).position === "static";
2803
2836
  }
2804
- function Ot(t, e) {
2805
- if (!k2(t) || T2(t).position === "fixed")
2837
+ function St(t, e) {
2838
+ if (!k(t) || R(t).position === "fixed")
2806
2839
  return null;
2807
2840
  if (e)
2808
2841
  return e(t);
2809
2842
  let n = t.offsetParent;
2810
- return D(t) === n && (n = n.ownerDocument.body), n;
2843
+ return D2(t) === n && (n = n.ownerDocument.body), n;
2811
2844
  }
2812
- function _t(t, e) {
2813
- const n = E(t);
2845
+ function Vt(t, e) {
2846
+ const n = A3(t);
2814
2847
  if (lt(t))
2815
2848
  return n;
2816
- if (!k2(t)) {
2817
- let s = V(t);
2818
- for (; s && !X(s); ) {
2819
- if (P(s) && !ft(s))
2849
+ if (!k(t)) {
2850
+ let s = W(t);
2851
+ for (; s && !K(s); ) {
2852
+ if (S2(s) && !ut(s))
2820
2853
  return s;
2821
- s = V(s);
2854
+ s = W(s);
2822
2855
  }
2823
2856
  return n;
2824
2857
  }
2825
- let i = Ot(t, e);
2826
- for (; i && Le(i) && ft(i); )
2827
- i = Ot(i, e);
2828
- return i && X(i) && ft(i) && !yt(i) ? n : i || ke(t) || n;
2858
+ let i = St(t, e);
2859
+ for (; i && Ee(i) && ut(i); )
2860
+ i = St(i, e);
2861
+ return i && K(i) && ut(i) && !xt(i) ? n : i || Te(t) || n;
2829
2862
  }
2830
- const qe = async function(t) {
2831
- const e = this.getOffsetParent || _t, n = this.getDimensions, i = await n(t.floating);
2863
+ const Be = async function(t) {
2864
+ const e = this.getOffsetParent || Vt, n = this.getDimensions, i = await n(t.floating);
2832
2865
  return {
2833
- reference: je(t.reference, await e(t.floating), t.strategy),
2866
+ reference: Ve(t.reference, await e(t.floating), t.strategy),
2834
2867
  floating: {
2835
2868
  x: 0,
2836
2869
  y: 0,
@@ -2839,134 +2872,134 @@ const qe = async function(t) {
2839
2872
  }
2840
2873
  };
2841
2874
  };
2842
- function Ue(t) {
2843
- return T2(t).direction === "rtl";
2844
- }
2845
- const Ye = {
2846
- convertOffsetParentRelativeRectToViewportRelativeRect: Ne,
2847
- getDocumentElement: D,
2848
- getClippingRect: _e,
2849
- getOffsetParent: _t,
2850
- getElementRects: qe,
2851
- getClientRects: Fe,
2852
- getDimensions: ze,
2875
+ function _e(t) {
2876
+ return R(t).direction === "rtl";
2877
+ }
2878
+ const ze = {
2879
+ convertOffsetParentRelativeRectToViewportRelativeRect: ke,
2880
+ getDocumentElement: D2,
2881
+ getClippingRect: Ie,
2882
+ getOffsetParent: Vt,
2883
+ getElementRects: Be,
2884
+ getClientRects: De,
2885
+ getDimensions: We,
2853
2886
  getScale: Y,
2854
- isElement: P,
2855
- isRTL: Ue
2887
+ isElement: S2,
2888
+ isRTL: _e
2856
2889
  };
2857
- function zt(t, e) {
2890
+ function Bt(t, e) {
2858
2891
  return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
2859
2892
  }
2860
- function Ke(t, e) {
2893
+ function qe(t, e) {
2861
2894
  let n = null, i;
2862
- const s = D(t);
2863
- function o2() {
2864
- var c;
2865
- clearTimeout(i), (c = n) == null || c.disconnect(), n = null;
2866
- }
2867
- function r2(c, l2) {
2868
- c === void 0 && (c = false), l2 === void 0 && (l2 = 1), o2();
2869
- const a2 = t.getBoundingClientRect(), {
2895
+ const s = D2(t);
2896
+ function o() {
2897
+ var c2;
2898
+ clearTimeout(i), (c2 = n) == null || c2.disconnect(), n = null;
2899
+ }
2900
+ function r2(c2, a2) {
2901
+ c2 === void 0 && (c2 = false), a2 === void 0 && (a2 = 1), o();
2902
+ const l2 = t.getBoundingClientRect(), {
2870
2903
  left: d2,
2871
2904
  top: u2,
2872
- width: g2,
2905
+ width: h2,
2873
2906
  height: f2
2874
- } = a2;
2875
- if (c || e(), !g2 || !f2)
2907
+ } = l2;
2908
+ if (c2 || e(), !h2 || !f2)
2876
2909
  return;
2877
- const h2 = it(u2), m2 = it(s.clientWidth - (d2 + g2)), p2 = it(s.clientHeight - (u2 + f2)), w2 = it(d2), x2 = {
2878
- rootMargin: -h2 + "px " + -m2 + "px " + -p2 + "px " + -w2 + "px",
2879
- threshold: j(0, K(1, l2)) || 1
2910
+ const g3 = it(u2), m2 = it(s.clientWidth - (d2 + h2)), p2 = it(s.clientHeight - (u2 + f2)), w2 = it(d2), x3 = {
2911
+ rootMargin: -g3 + "px " + -m2 + "px " + -p2 + "px " + -w2 + "px",
2912
+ threshold: q2(0, j(1, a2)) || 1
2880
2913
  };
2881
2914
  let b2 = true;
2882
2915
  function v2(C2) {
2883
- const S3 = C2[0].intersectionRatio;
2884
- if (S3 !== l2) {
2916
+ const L4 = C2[0].intersectionRatio;
2917
+ if (L4 !== a2) {
2885
2918
  if (!b2)
2886
2919
  return r2();
2887
- S3 ? r2(false, S3) : i = setTimeout(() => {
2920
+ L4 ? r2(false, L4) : i = setTimeout(() => {
2888
2921
  r2(false, 1e-7);
2889
2922
  }, 1e3);
2890
2923
  }
2891
- S3 === 1 && !zt(a2, t.getBoundingClientRect()) && r2(), b2 = false;
2924
+ L4 === 1 && !Bt(l2, t.getBoundingClientRect()) && r2(), b2 = false;
2892
2925
  }
2893
2926
  try {
2894
2927
  n = new IntersectionObserver(v2, {
2895
- ...x2,
2928
+ ...x3,
2896
2929
  // Handle <iframe>s
2897
2930
  root: s.ownerDocument
2898
2931
  });
2899
2932
  } catch {
2900
- n = new IntersectionObserver(v2, x2);
2933
+ n = new IntersectionObserver(v2, x3);
2901
2934
  }
2902
2935
  n.observe(t);
2903
2936
  }
2904
- return r2(true), o2;
2937
+ return r2(true), o;
2905
2938
  }
2906
2939
  function Xe(t, e, n, i) {
2907
2940
  i === void 0 && (i = {});
2908
2941
  const {
2909
2942
  ancestorScroll: s = true,
2910
- ancestorResize: o2 = true,
2943
+ ancestorResize: o = true,
2911
2944
  elementResize: r2 = typeof ResizeObserver == "function",
2912
- layoutShift: c = typeof IntersectionObserver == "function",
2913
- animationFrame: l2 = false
2914
- } = i, a2 = vt(t), d2 = s || o2 ? [...a2 ? tt(a2) : [], ...tt(e)] : [];
2945
+ layoutShift: c2 = typeof IntersectionObserver == "function",
2946
+ animationFrame: a2 = false
2947
+ } = i, l2 = bt(t), d2 = s || o ? [...l2 ? tt(l2) : [], ...tt(e)] : [];
2915
2948
  d2.forEach((w2) => {
2916
2949
  s && w2.addEventListener("scroll", n, {
2917
2950
  passive: true
2918
- }), o2 && w2.addEventListener("resize", n);
2951
+ }), o && w2.addEventListener("resize", n);
2919
2952
  });
2920
- const u2 = a2 && c ? Ke(a2, n) : null;
2921
- let g2 = -1, f2 = null;
2953
+ const u2 = l2 && c2 ? qe(l2, n) : null;
2954
+ let h2 = -1, f2 = null;
2922
2955
  r2 && (f2 = new ResizeObserver((w2) => {
2923
- let [y3] = w2;
2924
- y3 && y3.target === a2 && f2 && (f2.unobserve(e), cancelAnimationFrame(g2), g2 = requestAnimationFrame(() => {
2925
- var x2;
2926
- (x2 = f2) == null || x2.observe(e);
2956
+ let [y2] = w2;
2957
+ y2 && y2.target === l2 && f2 && (f2.unobserve(e), cancelAnimationFrame(h2), h2 = requestAnimationFrame(() => {
2958
+ var x3;
2959
+ (x3 = f2) == null || x3.observe(e);
2927
2960
  })), n();
2928
- }), a2 && !l2 && f2.observe(a2), f2.observe(e));
2929
- let h2, m2 = l2 ? U2(t) : null;
2930
- l2 && p2();
2961
+ }), l2 && !a2 && f2.observe(l2), f2.observe(e));
2962
+ let g3, m2 = a2 ? U2(t) : null;
2963
+ a2 && p2();
2931
2964
  function p2() {
2932
2965
  const w2 = U2(t);
2933
- m2 && !zt(m2, w2) && n(), m2 = w2, h2 = requestAnimationFrame(p2);
2966
+ m2 && !Bt(m2, w2) && n(), m2 = w2, g3 = requestAnimationFrame(p2);
2934
2967
  }
2935
2968
  return n(), () => {
2936
2969
  var w2;
2937
- d2.forEach((y3) => {
2938
- s && y3.removeEventListener("scroll", n), o2 && y3.removeEventListener("resize", n);
2939
- }), u2?.(), (w2 = f2) == null || w2.disconnect(), f2 = null, l2 && cancelAnimationFrame(h2);
2970
+ d2.forEach((y2) => {
2971
+ s && y2.removeEventListener("scroll", n), o && y2.removeEventListener("resize", n);
2972
+ }), u2?.(), (w2 = f2) == null || w2.disconnect(), f2 = null, a2 && cancelAnimationFrame(g3);
2940
2973
  };
2941
2974
  }
2942
- const Je = be, Ze = Ae, Ge = xe, Qe = ye, tn = Ee, en = (t, e, n) => {
2975
+ const Ue = we, Ye = ye, je = me, Ke = ge, Je = xe, Ge = (t, e, n) => {
2943
2976
  const i = /* @__PURE__ */ new Map(), s = {
2944
- platform: Ye,
2977
+ platform: ze,
2945
2978
  ...n
2946
- }, o2 = {
2979
+ }, o = {
2947
2980
  ...s.platform,
2948
2981
  _c: i
2949
2982
  };
2950
- return we(t, e, {
2983
+ return he(t, e, {
2951
2984
  ...s,
2952
- platform: o2
2985
+ platform: o
2953
2986
  });
2954
2987
  };
2955
- function Pt(t, e, n) {
2988
+ function Rt(t, e, n) {
2956
2989
  Object.assign(t.style, {
2957
2990
  left: e != null ? `${e}px` : "",
2958
2991
  top: n != null ? `${n}px` : ""
2959
2992
  });
2960
2993
  }
2961
- function jt(t, e) {
2962
- let n = t.getSetting("toggle-delay");
2994
+ function _t(t, e) {
2995
+ let n = t.config.get("toggleDelay");
2963
2996
  typeof n == "string" && (n.indexOf(",") > -1 && (n = n.split(",")), n.indexOf(" ") > -1 && (n = n.split(" "))), Array.isArray(n) && (n = n[e]);
2964
2997
  const i = Number(n);
2965
2998
  if (Number.isNaN(i))
2966
2999
  throw new Error(`Provided delay value is not a number: "${n}"`);
2967
3000
  return i;
2968
3001
  }
2969
- function ut(t) {
3002
+ function dt(t) {
2970
3003
  let e;
2971
3004
  const n = typeof t == "string" ? t.trim().split(" ").map((i) => parseFloat(i)).filter((i) => !isNaN(i)) : [t];
2972
3005
  for (let i = 0; i < n.length; i++)
@@ -3005,142 +3038,135 @@ function ut(t) {
3005
3038
  }
3006
3039
  return e;
3007
3040
  }
3008
- function nn(t) {
3041
+ function Qe(t) {
3009
3042
  return {
3010
- offset: Number(t.getSetting("offset")),
3043
+ offset: Number(t.config.get("offset")),
3011
3044
  flip: {
3012
- padding: ut(t.getSetting("flip-padding"))
3045
+ padding: dt(t.config.get("flipPadding"))
3013
3046
  },
3014
3047
  shift: {
3015
- padding: ut(t.getSetting("shift-padding"))
3048
+ padding: dt(t.config.get("shiftPadding"))
3016
3049
  },
3017
3050
  arrow: {
3018
- selector: t.getSetting("selectorArrow"),
3051
+ selector: t.config.get("selectorArrow"),
3019
3052
  element: null,
3020
- padding: ut(t.getSetting("arrow-padding"))
3053
+ padding: dt(t.config.get("arrowPadding"))
3021
3054
  }
3022
3055
  };
3023
3056
  }
3024
- function Tt(t) {
3025
- const e = this.get(t);
3026
- if (e)
3027
- return e;
3028
- throw new Error(`Popover not found in collection with id of "${t}".`);
3029
- }
3030
- async function qt(t) {
3031
- return t && t.state === "opened" && (t.el.inert = true, t.el.classList.remove(t.parent.settings.stateActive), t.isTooltip || t.trigger?.setAttribute("aria-expanded", "false"), t.floatingCleanup(), t.state = "closed", t.trigger === t.parent.trigger && (t.parent.trigger = null), t.el.dispatchEvent(
3032
- new CustomEvent(t.getSetting("customEventPrefix") + "closed", {
3057
+ async function zt(t) {
3058
+ return t && t.state === "opened" && (t.el.inert = true, t.el.classList.remove(t.config.get("stateActive")), t.isTooltip || t.trigger?.setAttribute("aria-expanded", "false"), t.floatingCleanup(), t.state = "closed", t.trigger === t.parent.trigger && (t.parent.trigger = null), t.el.dispatchEvent(
3059
+ new CustomEvent(t.config.get("customEventPrefix") + "closed", {
3033
3060
  detail: t.parent,
3034
3061
  bubbles: true
3035
3062
  })
3036
3063
  ), await t.parent.emit("closed", t)), t;
3037
3064
  }
3038
- async function Ut(t) {
3065
+ async function qt(t) {
3039
3066
  const e = [];
3040
3067
  for (const n of t.collection)
3041
3068
  n.state === "opened" && e.push(await n.close());
3042
3069
  return e;
3043
3070
  }
3044
- function Yt(t) {
3071
+ function Xt(t) {
3045
3072
  t.state == "opened" && setTimeout(() => (document.activeElement?.closest(
3046
3073
  `#${t.id}, [aria-controls="${t.id}"], [aria-describedby="${t.id}"]`
3047
3074
  ) || t.close(), t), 1);
3048
3075
  }
3049
- function sn(t) {
3076
+ function Ze(t) {
3050
3077
  t.state === "opened" ? t.close() : (this.trigger = t.trigger, t.open());
3051
3078
  }
3052
- function on(t) {
3079
+ function tn(t) {
3053
3080
  t.isTooltip && (t.toggleDelayId && clearTimeout(t.toggleDelayId), t.close());
3054
3081
  }
3055
- function rn(t, e) {
3056
- if (t.isHovered = e, e.type == "focus" && t.trigger && !t.trigger.matches(":focus-visible"))
3082
+ function en(t, e) {
3083
+ if (!(e instanceof MouseEvent) || (t.isHovered = e, e.type == "focus" && t.trigger && !t.trigger.matches(":focus-visible")))
3057
3084
  return;
3058
3085
  t.toggleDelayId && clearTimeout(t.toggleDelayId);
3059
3086
  const n = t.trigger?.getAttribute("aria-expanded");
3060
3087
  if (n && n == "true") return;
3061
- const i = this.activeHover ? 0 : jt(t, 0);
3088
+ const i = this.activeHover ? 0 : _t(t, 0);
3062
3089
  this.activeHover && this.activeHover.close(), t.toggleDelayId = setTimeout(() => {
3063
3090
  t.id && t.open();
3064
3091
  }, i);
3065
3092
  }
3066
- function cn(t, e) {
3067
- setTimeout(() => {
3093
+ function nn(t, e) {
3094
+ e instanceof MouseEvent && setTimeout(() => {
3068
3095
  t.isHovered = e, !t.isHovered && (t.toggleDelayId && clearTimeout(t.toggleDelayId), t.toggleDelayId = setTimeout(
3069
- () => Yt(t),
3070
- jt(t, 1)
3096
+ () => Xt(t),
3097
+ _t(t, 1)
3071
3098
  ));
3072
3099
  }, 1);
3073
3100
  }
3074
- function ln(t) {
3101
+ function sn(t) {
3075
3102
  switch (t.key) {
3076
3103
  case "Escape":
3077
- this.trigger && this.trigger.focus(), Ut(this);
3104
+ this.trigger && this.trigger.focus(), qt(this);
3078
3105
  return;
3079
3106
  case "Tab":
3080
3107
  this.collection.forEach((e) => {
3081
- Yt(e);
3108
+ Xt(e);
3082
3109
  });
3083
3110
  return;
3084
3111
  default:
3085
3112
  return;
3086
3113
  }
3087
3114
  }
3088
- function an(t) {
3089
- const e = this;
3090
- document.addEventListener("click", function n(i) {
3091
- const s = i.target;
3092
- s && (s.closest(
3115
+ function on(t) {
3116
+ document.addEventListener("click", function e(n) {
3117
+ const i = n.target;
3118
+ i && (i.closest(
3093
3119
  `#${t.id}, [aria-controls="${t.id}"], [aria-describedby="${t.id}"]`
3094
- ) ? t.el && !t.el.classList.contains(e.settings.stateActive) && this.removeEventListener("click", n) : (t.el && t.el.classList.contains(e.settings.stateActive) && t.close(), this.removeEventListener("click", n)));
3120
+ ) ? t.el && !t.el.classList.contains(t.config.get("stateActive")) && this.removeEventListener("click", e) : (t.el && t.el.classList.contains(t.config.get("stateActive")) && t.close(), this.removeEventListener("click", e)));
3095
3121
  });
3096
3122
  }
3097
- async function Kt(t) {
3098
- t.el.inert = false, t.el.classList.add(t.parent.settings.stateActive), t.isTooltip || t.trigger?.setAttribute("aria-expanded", "true"), t.buildCustomProps();
3099
- const e = nn(t), n = t.el.querySelector(
3123
+ async function Ut(t) {
3124
+ t.el.inert = false, t.el.classList.add(t.config.get("stateActive")), t.isTooltip || t.trigger?.setAttribute("aria-expanded", "true"), await t.parent.emit("updateCustomProps", t);
3125
+ const e = Qe(t), n = t.el.querySelector(
3100
3126
  e.arrow.selector
3101
3127
  );
3102
3128
  return e.arrow.element = n || null, t.trigger instanceof HTMLElement && (t.floatingCleanup = Xe(t.trigger, t.el, () => {
3103
3129
  const i = [
3104
- Ge(e.flip),
3105
- Ze({ ...e.shift, limiter: tn() }),
3106
- Je(e.offset)
3130
+ je(e.flip),
3131
+ Ye({ ...e.shift, limiter: Je() }),
3132
+ Ue(e.offset)
3107
3133
  ];
3108
3134
  e.arrow.element && i.push(
3109
- Qe({
3135
+ Ke({
3110
3136
  ...e.arrow,
3111
3137
  element: e.arrow.element
3112
3138
  })
3113
- ), en(t.trigger, t.el, {
3114
- placement: t.getSetting("placement"),
3139
+ ), Ge(t.trigger, t.el, {
3140
+ placement: t.config.get("placement"),
3115
3141
  middleware: i
3116
- }).then(({ x: s, y: o2, placement: r2, middlewareData: c }) => {
3142
+ }).then(({ x: s, y: o, placement: r2, middlewareData: c2 }) => {
3117
3143
  if (t.el) {
3118
- if (Pt(t.el, s, o2), e.arrow.element && c.arrow) {
3119
- const { x: l2, y: a2 } = c.arrow;
3120
- Pt(e.arrow.element, l2, a2);
3144
+ if (Rt(t.el, s, o), e.arrow.element && c2.arrow) {
3145
+ const { x: a2, y: l2 } = c2.arrow;
3146
+ Rt(e.arrow.element, a2, l2);
3121
3147
  }
3122
3148
  t.el.setAttribute("data-floating-placement", r2);
3123
3149
  }
3124
3150
  });
3125
- })), t.state = "opened", t.getSetting("event") === "click" && an.call(t.parent, t), t.el.dispatchEvent(
3126
- new CustomEvent(t.getSetting("customEventPrefix") + "opened", {
3151
+ })), t.state = "opened", t.config.get("event") === "click" && on.call(t.parent, t), t.el.dispatchEvent(
3152
+ new CustomEvent(t.config.get("customEventPrefix") + "opened", {
3127
3153
  detail: t.parent,
3128
3154
  bubbles: true
3129
3155
  })
3130
3156
  ), await t.parent.emit("opened", t), t;
3131
3157
  }
3132
- class fn extends Dt {
3133
- #t;
3134
- #e;
3135
- constructor(e, n, i = {}) {
3136
- super(e, n, i), this.state = "closed", this.toggleDelayId = null, this.trigger = null, this.#t = null, this.#e = {
3158
+ class rn extends Pt {
3159
+ constructor(e, n) {
3160
+ super(e, n), this.#t = [], this.#e = {
3137
3161
  el: false,
3138
3162
  trigger: false
3139
- }, this.floatingCleanup = () => {
3163
+ }, this.state = "closed", this.trigger = null, this.toggleDelayId = null, this.floatingCleanup = () => {
3140
3164
  };
3141
3165
  }
3166
+ #t;
3167
+ #e;
3142
3168
  get isTooltip() {
3143
- return !!this.el.closest(this.getSetting("selectorTooltip")) || this.el.getAttribute("role") == "tooltip";
3169
+ return !!this.el.closest(this.config.get("selectorTooltip")) || this.el.getAttribute("role") == "tooltip";
3144
3170
  }
3145
3171
  get isHovered() {
3146
3172
  return this.#e.el || this.#e.trigger;
@@ -3158,47 +3184,55 @@ class fn extends Dt {
3158
3184
  }
3159
3185
  }
3160
3186
  async open() {
3161
- return Kt(this);
3187
+ return Ut(this);
3162
3188
  }
3163
3189
  async close() {
3164
- return qt(this);
3190
+ return zt(this);
3165
3191
  }
3166
3192
  async deregister() {
3167
- return this.parent.deregister(this.id);
3193
+ return this.parent.deregister(this);
3168
3194
  }
3169
3195
  registerEventListeners() {
3170
- this.#t || (this.getSetting("event") === "hover" ? (this.#t = [
3196
+ this.#t.length || (this.config.get("event") === "hover" ? (this.#t = [
3171
3197
  {
3172
3198
  el: ["el", "trigger"],
3173
3199
  type: ["mouseenter", "focus"],
3174
- listener: rn.bind(this.parent, this)
3200
+ listener: en.bind(this.parent, this)
3175
3201
  },
3176
3202
  {
3177
3203
  el: ["el", "trigger"],
3178
3204
  type: ["mouseleave", "focusout"],
3179
- listener: cn.bind(this.parent, this)
3205
+ listener: nn.bind(this.parent, this)
3180
3206
  },
3181
3207
  {
3182
3208
  el: ["trigger"],
3183
3209
  type: ["click"],
3184
- listener: on.bind(this.parent, this)
3210
+ listener: tn.bind(this.parent, this)
3185
3211
  }
3186
3212
  ], this.#t.forEach((n) => {
3187
3213
  n.el.forEach((i) => {
3188
3214
  n.type.forEach((s) => {
3189
- this[i].addEventListener(s, n.listener, false);
3215
+ this[i].addEventListener(
3216
+ s,
3217
+ n.listener,
3218
+ false
3219
+ );
3190
3220
  });
3191
3221
  });
3192
3222
  })) : (this.#t = [
3193
3223
  {
3194
3224
  el: ["trigger"],
3195
3225
  type: ["click"],
3196
- listener: sn.bind(this.parent, this)
3226
+ listener: Ze.bind(this.parent, this)
3197
3227
  }
3198
3228
  ], this.#t.forEach((n) => {
3199
3229
  n.el.forEach((i) => {
3200
3230
  n.type.forEach((s) => {
3201
- this[i].addEventListener(s, n.listener, false);
3231
+ this[i].addEventListener(
3232
+ s,
3233
+ n.listener,
3234
+ false
3235
+ );
3202
3236
  });
3203
3237
  });
3204
3238
  })));
@@ -3207,41 +3241,45 @@ class fn extends Dt {
3207
3241
  this.#t && (this.#t.forEach((e) => {
3208
3242
  e.el.forEach((n) => {
3209
3243
  e.type.forEach((i) => {
3210
- this[n].removeEventListener(i, e.listener, false);
3244
+ this[n].removeEventListener(
3245
+ i,
3246
+ e.listener,
3247
+ false
3248
+ );
3211
3249
  });
3212
3250
  });
3213
- }), this.#t = null);
3251
+ }), this.#t = []);
3214
3252
  }
3215
3253
  async onCreateEntry() {
3216
3254
  this.trigger = document.querySelector(
3217
3255
  `[aria-controls="${this.id}"], [aria-describedby="${this.id}"]`
3218
- ), this.isTooltip ? (this.settings.event = "hover", this.el.setAttribute("role", "tooltip")) : this.trigger && this.trigger instanceof HTMLElement && this.trigger.setAttribute("aria-expanded", "false"), this.registerEventListeners();
3256
+ ), this.isTooltip ? (this.config.set({ event: "hover" }), this.el.setAttribute("role", "tooltip")) : this.trigger && this.trigger instanceof HTMLElement && this.trigger.setAttribute("aria-expanded", "false");
3219
3257
  }
3220
3258
  async onRegisterEntry() {
3221
- this.el.classList.contains(this.getSetting("stateActive")) ? await this.open() : this.el.inert = true;
3259
+ this.registerEventListeners(), this.el.classList.contains(this.config.get("stateActive")) ? await this.open() : this.el.inert = true;
3222
3260
  }
3223
3261
  async onDestroyEntry() {
3224
3262
  this.state === "opened" && await this.close(), this.floatingCleanup(), this.deregisterEventListeners();
3225
3263
  }
3226
3264
  }
3227
- class un extends oe {
3228
- #t;
3265
+ class cn extends ee {
3229
3266
  constructor(e) {
3230
- super({ ...re, ...e }), this.module = "Popover", this.entryClass = fn, this.trigger = null, this.#t = ln.bind(this);
3267
+ super({ ...ne, ...e }), this.entryClass = rn, this.name = "Popover", this.trigger = null, this.#t = sn.bind(this);
3231
3268
  }
3269
+ #t;
3232
3270
  get active() {
3233
3271
  return this.get("opened", "state");
3234
3272
  }
3235
3273
  get activeHover() {
3236
- return this.collection.find((e) => e.state == "opened" && e.getSetting("event") == "hover");
3274
+ return this.collection.find((e) => e.state == "opened" && e.config.get("event") == "hover");
3237
3275
  }
3238
3276
  async open(e) {
3239
- const n = Tt.call(this, e);
3240
- return Kt(n);
3277
+ const n = this.getOrThrow(e);
3278
+ return Ut(n);
3241
3279
  }
3242
3280
  async close(e) {
3243
- const n = e ? Tt.call(this, e) : void 0;
3244
- return n ? qt(n) : Ut(this);
3281
+ const n = e ? this.getOrThrow(e) : void 0;
3282
+ return n ? zt(n) : qt(this);
3245
3283
  }
3246
3284
  async afterMount() {
3247
3285
  document.addEventListener("keydown", this.#t, false);
@@ -3254,9 +3292,9 @@ class un extends oe {
3254
3292
  }
3255
3293
  }
3256
3294
  export {
3257
- z$2 as Drawer,
3258
- N$1 as Modal,
3259
- un as Popover,
3295
+ q$1 as Drawer,
3296
+ P$1 as Modal,
3297
+ cn as Popover,
3260
3298
  index as core
3261
3299
  };
3262
3300
  //# sourceMappingURL=index.js.map