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