@webority/ui-elements 0.7.7 → 0.7.9

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.
@@ -48,16 +48,47 @@ function c(e, t) {
48
48
  r.disabled = e.hasAttribute("disabled");
49
49
  }
50
50
  //#endregion
51
+ //#region src/listboxKeyNav.js
52
+ function l(e) {
53
+ let { getVisibleOptions: t, getActive: n, setActive: r, onEnter: i, onEscape: a, onTypeahead: o, typeaheadMs: s = 500 } = e, c = "", l = null, u = () => {
54
+ clearTimeout(l), l = null, c = "";
55
+ };
56
+ return {
57
+ handler: (e) => {
58
+ let d = t(), f = n(), p = e.target?.tagName === "INPUT" || e.target?.tagName === "TEXTAREA";
59
+ if (e.key === "ArrowDown") e.preventDefault(), r(Math.min(f + 1, d.length - 1));
60
+ else if (e.key === "ArrowUp") e.preventDefault(), r(Math.max(f - 1, 0));
61
+ else if (e.key === "Home" && !p) e.preventDefault(), d.length && r(0);
62
+ else if (e.key === "End" && !p) e.preventDefault(), d.length && r(d.length - 1);
63
+ else if (e.key === "PageDown" && !p) {
64
+ if (e.preventDefault(), !d.length) return;
65
+ r(Math.min((f < 0 ? 0 : f) + 8, d.length - 1));
66
+ } else if (e.key === "PageUp" && !p) {
67
+ if (e.preventDefault(), !d.length) return;
68
+ r(Math.max((f < 0 ? 0 : f) - 8, 0));
69
+ } else if (e.key === "Enter") i && (e.preventDefault(), i(d[f], d));
70
+ else if (e.key === "Escape") a && a();
71
+ else if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && e.target?.tagName !== "INPUT" && e.target?.tagName !== "TEXTAREA") {
72
+ e.preventDefault(), clearTimeout(l), c += e.key.toLowerCase(), l = setTimeout(u, s);
73
+ let t = d.findIndex((e) => e.textContent.trim().toLowerCase().startsWith(c));
74
+ t >= 0 && (r(t), o && o(e.key, t, d));
75
+ }
76
+ },
77
+ clearTypeahead: u,
78
+ teardown: u
79
+ };
80
+ }
81
+ //#endregion
51
82
  //#region src/optionLabel.js
52
- var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), d = (e) => {
83
+ var u = Symbol("wui.trustedHtml"), d = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), f = (e) => {
53
84
  if (!e) return "";
54
85
  let t = String(e).toLowerCase().replace(/[^a-z0-9-]/g, "");
55
86
  return t ? `<i class="bi bi-${t}" aria-hidden="true"></i>` : "";
56
- }, f = (e) => {
87
+ }, p = (e) => {
57
88
  if (e == null) return "";
58
- let t = e[l] ? String(e.label ?? "") : u(e.label), n = d(e.icon);
89
+ let t = e[u] ? String(e.label ?? "") : d(e.label), n = f(e.icon);
59
90
  return n ? `<span class="wui-opt-label">${n}${t}</span>` : t;
60
- }, p = class extends HTMLElement {
91
+ }, m = class extends HTMLElement {
61
92
  static formAssociated = !0;
62
93
  _accessibleName() {
63
94
  return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
@@ -76,7 +107,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
76
107
  ];
77
108
  }
78
109
  constructor() {
79
- super(), this._value = "", this._label = "", this._optionsProp = null, this._loading = !1, this._active = -1, this._timer = null, this._reqSeq = 0, this._pendingSearch = null;
110
+ super(), this._value = "", this._label = "", this._optionsProp = null, this._loading = !1, this._active = -1, this._timer = null, this._reqSeq = 0, this._pendingSearch = null, this._typeahead = "", this._typeaheadTimer = null;
80
111
  try {
81
112
  this._internals = this.attachInternals();
82
113
  } catch {
@@ -109,12 +140,12 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
109
140
  set value(e) {
110
141
  this._value = e == null ? "" : String(e), c(this, this._value);
111
142
  let t = this._readOptions().find((e) => String(e.value) === this._value);
112
- this._label = t ? h(t.label) : "", this._syncInput(), this._renderOptions("");
143
+ this._label = t ? g(t.label) : "", this._syncInput(), this._renderOptions("");
113
144
  }
114
145
  set options(e) {
115
146
  this._optionsProp = Array.isArray(e) ? e : [];
116
147
  let t = this._readOptions().find((e) => String(e.value) === this._value);
117
- t && (this._label = h(t.label)), this._renderOptions(), this._syncInput();
148
+ t && (this._label = g(t.label)), this._renderOptions(), this._syncInput();
118
149
  }
119
150
  get options() {
120
151
  return this._readOptions();
@@ -133,7 +164,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
133
164
  }
134
165
  _matchesKnownOption(e) {
135
166
  let t = e.toLowerCase();
136
- return this._readOptions().some((e) => h(e.label).toLowerCase() === t || String(e.value ?? "").toLowerCase() === t);
167
+ return this._readOptions().some((e) => g(e.label).toLowerCase() === t || String(e.value ?? "").toLowerCase() === t);
137
168
  }
138
169
  get _minChars() {
139
170
  return Math.max(0, Number(this.getAttribute("min-chars")) || +!!this._remote);
@@ -151,7 +182,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
151
182
  value: e.getAttribute("value") ?? e.textContent.trim(),
152
183
  label: e.innerHTML,
153
184
  icon: e.getAttribute("icon") || void 0,
154
- [l]: !0,
185
+ [u]: !0,
155
186
  selected: e.hasAttribute("selected")
156
187
  })));
157
188
  }
@@ -165,12 +196,12 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
165
196
  let r = `${this.id}-listbox`;
166
197
  this._listboxId = r, this.innerHTML = `
167
198
  <div class="search-select${n}">
168
- <div class="input search-select-control search-select-ac" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${m(r)}" aria-label="${m(this._accessibleName())}">
169
- <input class="search-select-input search-select-ac-input" placeholder="${m(e)}" aria-autocomplete="list" autocomplete="off"${this.hasAttribute("disabled") ? " disabled" : ""} />
199
+ <div class="input search-select-control search-select-ac" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${h(r)}" aria-label="${h(this._accessibleName())}">
200
+ <input class="search-select-input search-select-ac-input" placeholder="${h(e)}" aria-autocomplete="list" autocomplete="off"${this.hasAttribute("disabled") ? " disabled" : ""} />
170
201
  <span class="search-select-spinner spinner-border spinner-border-sm" role="status" aria-hidden="true" hidden></span>
171
202
  <button type="button" class="search-select-clear" aria-label="Clear" hidden><i class="bi bi-x" aria-hidden="true"></i></button>
172
203
  </div>
173
- <div class="search-select-menu search-select-menu-fixed" role="listbox" id="${m(r)}" tabindex="-1" hidden>
204
+ <div class="search-select-menu search-select-menu-fixed" role="listbox" id="${h(r)}" tabindex="-1" hidden>
174
205
  <div class="search-select-options"></div>
175
206
  <div class="search-select-empty" hidden>No matches</div>
176
207
  <div class="search-select-hint" hidden>Type to search…</div>
@@ -204,7 +235,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
204
235
  let t = this._refs();
205
236
  if (!t.optionsWrap) return;
206
237
  let n = e ?? (t.input ? t.input.value : ""), r = n.trim().toLowerCase(), i = this._readOptions();
207
- !this._remote && r && (i = i.filter((e) => h(e.label).toLowerCase().includes(r)));
238
+ !this._remote && r && (i = i.filter((e) => g(e.label).toLowerCase().includes(r)));
208
239
  let a = n.trim(), o = this._allowCustom && a && !this._matchesKnownOption(a) ? [...i, {
209
240
  value: a,
210
241
  custom: !0
@@ -212,11 +243,11 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
212
243
  t.optionsWrap.innerHTML = o.map((e, t) => {
213
244
  let n = `${s}-opt-${t}`;
214
245
  if (e.custom) {
215
- let t = `Add “${u(e.value)}”`;
216
- return `<button type="button" role="option" id="${m(n)}" class="search-select-option search-select-option-custom" data-value="${m(e.value)}" data-custom="true" aria-selected="false">${t}</button>`;
246
+ let t = `Add “${d(e.value)}”`;
247
+ return `<button type="button" role="option" id="${h(n)}" class="search-select-option search-select-option-custom" data-value="${h(e.value)}" data-custom="true" aria-selected="false">${t}</button>`;
217
248
  }
218
249
  let r = String(e.value) === String(this._value);
219
- return `<button type="button" role="option" id="${m(n)}" class="search-select-option${r ? " selected" : ""}" data-value="${m(e.value)}" aria-selected="${r}">${f(e)}</button>`;
250
+ return `<button type="button" role="option" id="${h(n)}" class="search-select-option${r ? " selected" : ""}" data-value="${h(e.value)}" aria-selected="${r}">${p(e)}</button>`;
220
251
  }).join(""), this._active = -1, t.control?.removeAttribute("aria-activedescendant");
221
252
  let c = r.length < this._minChars;
222
253
  t.hint && (t.hint.hidden = !(this._remote && c && !i.length)), t.empty && (t.empty.hidden = this._loading || o.length > 0 || this._remote && c);
@@ -232,21 +263,20 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
232
263
  t >= 0 && r[t] ? (r[t].classList.add("is-active"), r[t].scrollIntoView({ block: "nearest" }), e.control.setAttribute("aria-activedescendant", r[t].id)) : e.control.removeAttribute("aria-activedescendant");
233
264
  }, o = () => !e.menu.hidden, s = () => {
234
265
  e.menu.hidden = !1, e.control.setAttribute("aria-expanded", "true"), e.control.classList.add("open"), t(), this._renderOptions();
235
- }, l = () => {
236
- e.menu.hidden = !0, e.control.setAttribute("aria-expanded", "false"), e.control.classList.remove("open"), r(-1), this._syncInput();
237
- }, u = (t) => {
266
+ }, u = () => {
267
+ e.menu.hidden = !0, e.control.setAttribute("aria-expanded", "false"), e.control.classList.remove("open"), r(-1), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "", this._syncInput();
268
+ }, d = (t) => {
238
269
  let n = t.dataset.custom === "true";
239
- this._value = t.dataset.value, this._label = n ? t.dataset.value : h(t.innerHTML), c(this, this._value), e.input.value = this._label, this.dispatchEvent(new CustomEvent("change", {
270
+ this._value = t.dataset.value, this._label = n ? t.dataset.value : g(t.innerHTML), c(this, this._value), e.input.value = this._label, this.dispatchEvent(new CustomEvent("change", {
240
271
  bubbles: !0,
241
272
  detail: { isCustom: n }
242
- })), l(), e.input.focus();
243
- }, d = (t) => {
273
+ })), u(), e.input.focus();
274
+ }, f = (t) => {
244
275
  this._value = t, this._label = t, c(this, t), e.input.value = t, this.dispatchEvent(new CustomEvent("change", {
245
276
  bubbles: !0,
246
277
  detail: { isCustom: !0 }
247
- })), l();
248
- };
249
- e.input.addEventListener("focus", () => s()), e.input.addEventListener("input", () => {
278
+ })), u();
279
+ }, p = () => {
250
280
  let t = e.input.value;
251
281
  if (e.clear && (e.clear.hidden = !t), o() || s(), this._remote) {
252
282
  if (this._renderOptions(t), clearTimeout(this._timer), t.trim().length < this._minChars) {
@@ -259,24 +289,43 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
259
289
  seq: e
260
290
  }, this._timer = setTimeout(() => this._fireSearch(t, e), this._debounceMs);
261
291
  } else this._renderOptions(t);
262
- }), e.input.addEventListener("keydown", (t) => {
263
- let i = n();
264
- if (t.key === "ArrowDown") t.preventDefault(), o() || s(), r(Math.min(this._active + 1, i.length - 1));
265
- else if (t.key === "ArrowUp") t.preventDefault(), r(Math.max(this._active - 1, 0));
266
- else if (t.key === "Enter") {
267
- if (i[this._active]) t.preventDefault(), u(i[this._active]);
292
+ };
293
+ this._navHandler = l({
294
+ getVisibleOptions: n,
295
+ getActive: () => this._active,
296
+ setActive: (e) => r(e),
297
+ onEnter: (t, n) => {
298
+ if (n[this._active]) d(n[this._active]);
268
299
  else if (this._allowCustom) {
269
- let n = e.input.value.trim();
270
- n && !this._matchesKnownOption(n) && (t.preventDefault(), d(n));
300
+ let t = e.input.value.trim();
301
+ t && !this._matchesKnownOption(t) && f(t);
271
302
  }
272
- } else t.key === "Escape" && l();
273
- }), e.input.addEventListener("blur", (t) => {
303
+ },
304
+ onEscape: () => {
305
+ this._navHandler.clearTypeahead(), u();
306
+ }
307
+ });
308
+ let m = (e) => {
309
+ let t = e.target?.tagName === "INPUT" || e.target?.tagName === "TEXTAREA";
310
+ if (e.key === "ArrowDown") {
311
+ e.preventDefault(), o() || s();
312
+ let t = n();
313
+ r(Math.min(this._active + 1, t.length - 1));
314
+ return;
315
+ } else if (e.key === "ArrowUp") {
316
+ e.preventDefault(), r(Math.max(this._active - 1, 0));
317
+ return;
318
+ } else if ((e.key === "Home" || e.key === "End" || e.key === "PageDown" || e.key === "PageUp") && (!o() || t)) return;
319
+ else if (e.key.length === 1 && (e.ctrlKey || e.metaKey || e.altKey || !o() || e.target?.tagName === "INPUT" || e.target?.tagName === "TEXTAREA") && (!o() || e.target?.tagName === "INPUT" || e.target?.tagName === "TEXTAREA")) return;
320
+ this._navHandler.handler(e);
321
+ };
322
+ e.input.addEventListener("focus", () => s()), e.input.addEventListener("input", p), e.input.addEventListener("keydown", m), e.menu.addEventListener("keydown", m), e.input.addEventListener("blur", (t) => {
274
323
  if (!this._allowCustom || t.relatedTarget && this.contains(t.relatedTarget)) return;
275
324
  let n = e.input.value.trim();
276
- !n || n === this._label || this._matchesKnownOption(n) || d(n);
325
+ !n || n === this._label || this._matchesKnownOption(n) || f(n);
277
326
  }), e.optionsWrap.addEventListener("click", (e) => {
278
327
  let t = e.target.closest(".search-select-option");
279
- t && u(t);
328
+ t && d(t);
280
329
  }), e.optionsWrap.addEventListener("mousemove", (e) => {
281
330
  let t = e.target.closest(".search-select-option");
282
331
  t && r(this._optionEls().indexOf(t));
@@ -284,7 +333,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
284
333
  this._value = "", this._label = "", c(this, ""), e.input.value = "", e.clear.hidden = !0, this._renderOptions(""), this.dispatchEvent(new Event("change", { bubbles: !0 })), e.input.focus();
285
334
  }), this._bindGlobal = () => {
286
335
  this._teardown(), this._onDocClick = (e) => {
287
- o() && !this.contains(e.target) && l();
336
+ o() && !this.contains(e.target) && u();
288
337
  }, document.addEventListener("click", this._onDocClick), a(this, () => {
289
338
  o() && t();
290
339
  });
@@ -300,12 +349,12 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
300
349
  }));
301
350
  }
302
351
  _teardown() {
303
- this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), o(this), clearTimeout(this._timer);
352
+ this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), o(this), clearTimeout(this._timer), this._navHandler?.teardown();
304
353
  }
305
354
  disconnectedCallback() {
306
355
  this._teardown();
307
356
  }
308
- }, m = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;"), h = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), g = [
357
+ }, h = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;"), g = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), _ = [
309
358
  "January",
310
359
  "February",
311
360
  "March",
@@ -318,7 +367,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
318
367
  "October",
319
368
  "November",
320
369
  "December"
321
- ], _ = [
370
+ ], v = [
322
371
  "Su",
323
372
  "Mo",
324
373
  "Tu",
@@ -326,24 +375,24 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
326
375
  "Th",
327
376
  "Fr",
328
377
  "Sa"
329
- ], v = (e) => String(e).padStart(2, "0"), y = (e, t, n) => `${e}-${v(t + 1)}-${v(n)}`, b = (e) => {
378
+ ], y = (e) => String(e).padStart(2, "0"), b = (e, t, n) => `${e}-${y(t + 1)}-${y(n)}`, x = (e) => {
330
379
  let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e || "");
331
380
  return t ? {
332
381
  y: +t[1],
333
382
  m: t[2] - 1,
334
383
  d: +t[3]
335
384
  } : null;
336
- }, x = (e) => {
337
- let t = b(e);
338
- return t ? `${v(t.d)} ${g[t.m].slice(0, 3)} ${t.y}` : "";
339
- }, S = (e, t) => new Date(e, t + 1, 0).getDate(), C = (e, t) => {
385
+ }, S = (e) => {
386
+ let t = x(e);
387
+ return t ? `${y(t.d)} ${_[t.m].slice(0, 3)} ${t.y}` : "";
388
+ }, C = (e, t) => new Date(e, t + 1, 0).getDate(), w = (e, t) => {
340
389
  for (; t < 0;) t += 12, --e;
341
390
  for (; t > 11;) t -= 12, e += 1;
342
391
  return {
343
392
  y: e,
344
393
  m: t
345
394
  };
346
- }, w = class extends HTMLElement {
395
+ }, T = class extends HTMLElement {
347
396
  static formAssociated = !0;
348
397
  static get observedAttributes() {
349
398
  return [
@@ -394,13 +443,13 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
394
443
  }
395
444
  render() {
396
445
  this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "", this._value = this._defaultValue || this._value);
397
- let e = this.getAttribute("placeholder") || "Enter Date", t = b(this._value);
446
+ let e = this.getAttribute("placeholder") || "Enter Date", t = x(this._value);
398
447
  t && (this._viewY = t.y, this._viewM = t.m);
399
448
  let n = this.getAttribute("size"), r = n === "sm" ? " input-sm" : n === "lg" ? " input-lg" : "", i = this.getAttribute("aria-label"), a = this.getAttribute("aria-describedby");
400
449
  this.innerHTML = `
401
450
  <div class="datepicker">
402
- <button type="button" class="input datepicker-trigger${r}${t ? " has-value" : ""}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${i ? ` aria-label="${u(i)}"` : ""}${a ? ` aria-describedby="${u(a)}"` : ""}>
403
- <span data-trigger-label class="${t ? "" : "search-select-placeholder"}">${t ? x(this._value) : u(e)}</span>
451
+ <button type="button" class="input datepicker-trigger${r}${t ? " has-value" : ""}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${i ? ` aria-label="${d(i)}"` : ""}${a ? ` aria-describedby="${d(a)}"` : ""}>
452
+ <span data-trigger-label class="${t ? "" : "search-select-placeholder"}">${t ? S(this._value) : d(e)}</span>
404
453
  <i class="bi bi-calendar3" aria-hidden="true"></i>
405
454
  </button>
406
455
  <div class="datepicker-pop" role="dialog" aria-modal="false" hidden></div>
@@ -412,11 +461,11 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
412
461
  _syncTrigger() {
413
462
  let e = this.querySelector(".datepicker-trigger"), t = this.querySelector("[data-trigger-label]");
414
463
  if (!t) return;
415
- let n = b(this._value);
416
- t.textContent = n ? x(this._value) : this.getAttribute("placeholder") || "Enter Date", t.classList.toggle("search-select-placeholder", !n), e?.classList.toggle("has-value", !!n);
464
+ let n = x(this._value);
465
+ t.textContent = n ? S(this._value) : this.getAttribute("placeholder") || "Enter Date", t.classList.toggle("search-select-placeholder", !n), e?.classList.toggle("has-value", !!n);
417
466
  }
418
467
  _limits() {
419
- let e = b(this.getAttribute("min")), t = b(this.getAttribute("max")), n = e ? new Date(e.y, e.m, e.d).getTime() : -Infinity, r = t ? new Date(t.y, t.m, t.d).getTime() : Infinity;
468
+ let e = x(this.getAttribute("min")), t = x(this.getAttribute("max")), n = e ? new Date(e.y, e.m, e.d).getTime() : -Infinity, r = t ? new Date(t.y, t.m, t.d).getTime() : Infinity;
420
469
  return {
421
470
  dayDisabled: (e, t, i) => {
422
471
  let a = new Date(e, t, i).getTime();
@@ -424,7 +473,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
424
473
  },
425
474
  monthDisabled: (e, t) => {
426
475
  let i = new Date(e, t, 1).getTime();
427
- return new Date(e, t, S(e, t)).getTime() < n || i > r;
476
+ return new Date(e, t, C(e, t)).getTime() < n || i > r;
428
477
  },
429
478
  yearDisabled: (e) => {
430
479
  let t = new Date(e, 0, 1).getTime();
@@ -437,28 +486,28 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
437
486
  e && (this._mode === "months" ? e.innerHTML = this._monthsHtml() : this._mode === "years" ? e.innerHTML = this._yearsHtml() : e.innerHTML = this._daysHtml(), this._focusActive());
438
487
  }
439
488
  _daysHtml() {
440
- let e = this._firstDay(), t = (new Date(this._viewY, this._viewM, 1).getDay() - e + 7) % 7, n = S(this._viewY, this._viewM), r = b(this._value), i = /* @__PURE__ */ new Date(), { dayDisabled: a } = this._limits(), o = this._focus || r || {
489
+ let e = this._firstDay(), t = (new Date(this._viewY, this._viewM, 1).getDay() - e + 7) % 7, n = C(this._viewY, this._viewM), r = x(this._value), i = /* @__PURE__ */ new Date(), { dayDisabled: a } = this._limits(), o = this._focus || r || {
441
490
  y: this._viewY,
442
491
  m: this._viewM,
443
492
  d: 1
444
493
  }, s = (e, t, n, s) => {
445
- let c = y(e, t, n), l = r && r.y === e && r.m === t && r.d === n, u = i.getFullYear() === e && i.getMonth() === t && i.getDate() === n, d = o.y === e && o.m === t && o.d === n, f = a(e, t, n);
494
+ let c = b(e, t, n), l = r && r.y === e && r.m === t && r.d === n, u = i.getFullYear() === e && i.getMonth() === t && i.getDate() === n, d = o.y === e && o.m === t && o.d === n, f = a(e, t, n);
446
495
  return `<button type="button" class="${[
447
496
  "datepicker-day",
448
497
  s ? "is-outside" : "",
449
498
  u ? "is-today" : "",
450
499
  l ? "is-selected" : ""
451
500
  ].filter(Boolean).join(" ")}" data-iso="${c}" role="gridcell" tabindex="${d && !f ? "0" : "-1"}"${l ? " aria-selected=\"true\"" : ""}${f ? " disabled aria-disabled=\"true\"" : ""}>${n}</button>`;
452
- }, c = "", l = C(this._viewY, this._viewM - 1), u = S(l.y, l.m);
501
+ }, c = "", l = w(this._viewY, this._viewM - 1), u = C(l.y, l.m);
453
502
  for (let e = t - 1; e >= 0; e--) c += s(l.y, l.m, u - e, !0);
454
503
  for (let e = 1; e <= n; e++) c += s(this._viewY, this._viewM, e, !1);
455
- let d = C(this._viewY, this._viewM + 1), f = (7 - (t + n) % 7) % 7;
504
+ let d = w(this._viewY, this._viewM + 1), f = (7 - (t + n) % 7) % 7;
456
505
  for (let e = 1; e <= f; e++) c += s(d.y, d.m, e, !0);
457
- let p = _.map((t, n) => _[(n + e) % 7]).map((e) => `<span>${e}</span>`).join("");
506
+ let p = v.map((t, n) => v[(n + e) % 7]).map((e) => `<span>${e}</span>`).join("");
458
507
  return `
459
508
  <div class="datepicker-head">
460
509
  <button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month"><i class="bi bi-chevron-left" aria-hidden="true"></i></button>
461
- <button type="button" class="datepicker-month" data-view="months" aria-label="Choose month and year">${g[this._viewM]} ${this._viewY}</button>
510
+ <button type="button" class="datepicker-month" data-view="months" aria-label="Choose month and year">${_[this._viewM]} ${this._viewY}</button>
462
511
  <button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month"><i class="bi bi-chevron-right" aria-hidden="true"></i></button>
463
512
  </div>
464
513
  <div class="datepicker-weekdays">${p}</div>
@@ -469,14 +518,14 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
469
518
  </div>`;
470
519
  }
471
520
  _monthsHtml() {
472
- let e = b(this._value), t = /* @__PURE__ */ new Date(), { monthDisabled: n } = this._limits(), r = "";
521
+ let e = x(this._value), t = /* @__PURE__ */ new Date(), { monthDisabled: n } = this._limits(), r = "";
473
522
  for (let i = 0; i < 12; i++) {
474
523
  let a = e && e.y === this._viewY && e.m === i, o = t.getFullYear() === this._viewY && t.getMonth() === i, s = n(this._viewY, i), c = [
475
524
  "datepicker-cell",
476
525
  o ? "is-today" : "",
477
526
  a ? "is-selected" : ""
478
527
  ].filter(Boolean).join(" ");
479
- r += `<button type="button" class="${c}" data-month="${i}"${s ? " disabled" : ""}>${g[i].slice(0, 3)}</button>`;
528
+ r += `<button type="button" class="${c}" data-month="${i}"${s ? " disabled" : ""}>${_[i].slice(0, 3)}</button>`;
480
529
  }
481
530
  return `
482
531
  <div class="datepicker-head">
@@ -487,7 +536,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
487
536
  <div class="datepicker-cells">${r}</div>`;
488
537
  }
489
538
  _yearsHtml() {
490
- let e = b(this._value), t = (/* @__PURE__ */ new Date()).getFullYear(), { yearDisabled: n } = this._limits(), r = this._viewY - (this._viewY % 10 + 10) % 10 - 1, i = "";
539
+ let e = x(this._value), t = (/* @__PURE__ */ new Date()).getFullYear(), { yearDisabled: n } = this._limits(), r = this._viewY - (this._viewY % 10 + 10) % 10 - 1, i = "";
491
540
  for (let a = 0; a < 12; a++) {
492
541
  let o = r + a, s = e && e.y === o, c = t === o, l = n(o), u = [
493
542
  "datepicker-cell",
@@ -512,21 +561,21 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
512
561
  i(e, t);
513
562
  }
514
563
  _setFocus(e, t, n, r) {
515
- let { y: i, m: a } = C(e, t);
564
+ let { y: i, m: a } = w(e, t);
516
565
  this._focus = {
517
566
  y: i,
518
567
  m: a,
519
568
  d: n
520
569
  };
521
570
  let o = i !== this._viewY || a !== this._viewM;
522
- this._viewY = i, this._viewM = a, this._slide = o && r || "", this._renderView(), this._slide = "", this.querySelector(`.datepicker-day[data-iso="${y(i, a, n)}"]`)?.focus();
571
+ this._viewY = i, this._viewM = a, this._slide = o && r || "", this._renderView(), this._slide = "", this.querySelector(`.datepicker-day[data-iso="${b(i, a, n)}"]`)?.focus();
523
572
  }
524
573
  _onKey(e) {
525
574
  if (this._mode !== "days") {
526
575
  e.key === "Escape" && this._close();
527
576
  return;
528
577
  }
529
- let t = this._focus || b(this._value) || {
578
+ let t = this._focus || x(this._value) || {
530
579
  y: this._viewY,
531
580
  m: this._viewM,
532
581
  d: 1
@@ -544,17 +593,17 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
544
593
  case "End": return n(6 - (new Date(t.y, t.m, t.d).getDay() - this._firstDay() + 7) % 7, "slide-next");
545
594
  case "PageUp": {
546
595
  e.preventDefault();
547
- let n = C(t.y, t.m - (e.shiftKey ? 12 : 1));
548
- return this._setFocus(n.y, n.m, Math.min(t.d, S(n.y, n.m)), "slide-prev");
596
+ let n = w(t.y, t.m - (e.shiftKey ? 12 : 1));
597
+ return this._setFocus(n.y, n.m, Math.min(t.d, C(n.y, n.m)), "slide-prev");
549
598
  }
550
599
  case "PageDown": {
551
600
  e.preventDefault();
552
- let n = C(t.y, t.m + (e.shiftKey ? 12 : 1));
553
- return this._setFocus(n.y, n.m, Math.min(t.d, S(n.y, n.m)), "slide-next");
601
+ let n = w(t.y, t.m + (e.shiftKey ? 12 : 1));
602
+ return this._setFocus(n.y, n.m, Math.min(t.d, C(n.y, n.m)), "slide-next");
554
603
  }
555
604
  case "Enter":
556
605
  case " ":
557
- e.preventDefault(), this._limits().dayDisabled(t.y, t.m, t.d) || (this.value = y(t.y, t.m, t.d), this.dispatchEvent(new Event("change", { bubbles: !0 })), this._close());
606
+ e.preventDefault(), this._limits().dayDisabled(t.y, t.m, t.d) || (this.value = b(t.y, t.m, t.d), this.dispatchEvent(new Event("change", { bubbles: !0 })), this._close());
558
607
  return;
559
608
  case "Escape": return this._close();
560
609
  default:
@@ -566,11 +615,11 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
566
615
  if (!e || !t) return;
567
616
  let r = () => !t.hidden;
568
617
  this._open = () => {
569
- if (!b(this._value) && !this._viewNavigated) {
618
+ if (!x(this._value) && !this._viewNavigated) {
570
619
  let e = /* @__PURE__ */ new Date();
571
620
  this._viewY = e.getFullYear(), this._viewM = e.getMonth();
572
621
  }
573
- let r = b(this._value), i = /* @__PURE__ */ new Date();
622
+ let r = x(this._value), i = /* @__PURE__ */ new Date();
574
623
  this._mode = "days", this._focus = r || {
575
624
  y: this._viewY,
576
625
  m: this._viewM,
@@ -583,7 +632,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
583
632
  let t = e.target.closest("[data-nav]");
584
633
  if (t) {
585
634
  this._viewNavigated = !0, this._slide = Number(t.dataset.nav) < 0 ? "slide-prev" : "slide-next";
586
- let e = C(this._viewY, this._viewM + Number(t.dataset.nav));
635
+ let e = w(this._viewY, this._viewM + Number(t.dataset.nav));
587
636
  this._viewY = e.y, this._viewM = e.m, this._focus = {
588
637
  y: e.y,
589
638
  m: e.m,
@@ -622,7 +671,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
622
671
  }
623
672
  if (e.target.closest("[data-today]")) {
624
673
  let e = /* @__PURE__ */ new Date();
625
- this.value = y(e.getFullYear(), e.getMonth(), e.getDate()), this.dispatchEvent(new Event("change", { bubbles: !0 })), this._close();
674
+ this.value = b(e.getFullYear(), e.getMonth(), e.getDate()), this.dispatchEvent(new Event("change", { bubbles: !0 })), this._close();
626
675
  return;
627
676
  }
628
677
  if (e.target.closest("[data-clear]")) {
@@ -650,45 +699,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
650
699
  disconnectedCallback() {
651
700
  this._teardown();
652
701
  }
653
- }, ee = [
654
- "January",
655
- "February",
656
- "March",
657
- "April",
658
- "May",
659
- "June",
660
- "July",
661
- "August",
662
- "September",
663
- "October",
664
- "November",
665
- "December"
666
- ], te = [
667
- "Su",
668
- "Mo",
669
- "Tu",
670
- "We",
671
- "Th",
672
- "Fr",
673
- "Sa"
674
- ], T = (e) => String(e).padStart(2, "0"), ne = (e, t, n) => `${e}-${T(t + 1)}-${T(n)}`, E = (e) => {
675
- let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e || "");
676
- return t ? {
677
- y: +t[1],
678
- m: t[2] - 1,
679
- d: +t[3]
680
- } : null;
681
- }, D = (e) => {
682
- let t = E(e);
683
- return t ? `${T(t.d)} ${ee[t.m].slice(0, 3)} ${t.y}` : "";
684
- }, O = (e, t) => new Date(e, t + 1, 0).getDate(), k = (e, t) => {
685
- for (; t < 0;) t += 12, --e;
686
- for (; t > 11;) t -= 12, e += 1;
687
- return {
688
- y: e,
689
- m: t
690
- };
691
- }, re = class extends HTMLElement {
702
+ }, ee = class extends HTMLElement {
692
703
  static formAssociated = !0;
693
704
  static get observedAttributes() {
694
705
  return [
@@ -747,19 +758,19 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
747
758
  text: e,
748
759
  empty: !0
749
760
  } : {
750
- text: `${D(this._start) || "Start"} – ${D(this._end) || "End"}`,
761
+ text: `${S(this._start) || "Start"} – ${S(this._end) || "End"}`,
751
762
  empty: !1
752
763
  };
753
764
  }
754
765
  render() {
755
766
  this._defaultStart === void 0 && (this._defaultStart = this.getAttribute("start") || "", this._defaultEnd = this.getAttribute("end") || "", this._start = this._defaultStart || this._start, this._end = this._defaultEnd || this._end);
756
- let e = E(this._start);
767
+ let e = x(this._start);
757
768
  e && (this._viewY = e.y, this._viewM = e.m);
758
769
  let t = this.getAttribute("size"), n = t === "sm" ? " input-sm" : t === "lg" ? " input-lg" : "", { text: r, empty: i } = this._label(), a = this.getAttribute("aria-label"), o = this.getAttribute("aria-describedby");
759
770
  this.innerHTML = `
760
771
  <div class="daterange">
761
- <button type="button" class="input daterange-trigger${n}${i ? "" : " has-value"}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${a ? ` aria-label="${u(a)}"` : ""}${o ? ` aria-describedby="${u(o)}"` : ""}>
762
- <span data-range-label class="${i ? "search-select-placeholder" : ""}">${u(r)}</span>
772
+ <button type="button" class="input daterange-trigger${n}${i ? "" : " has-value"}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${a ? ` aria-label="${d(a)}"` : ""}${o ? ` aria-describedby="${d(o)}"` : ""}>
773
+ <span data-range-label class="${i ? "search-select-placeholder" : ""}">${d(r)}</span>
763
774
  <i class="bi bi-calendar-range" aria-hidden="true"></i>
764
775
  </button>
765
776
  <div class="daterange-pop" role="dialog" aria-modal="false" hidden></div>
@@ -787,24 +798,24 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
787
798
  r || (r = document.createElement("input"), r.type = "hidden", r.setAttribute("data-range-mirror", e), this.appendChild(r)), r.name = t, r.value = n || "", r.disabled = this.hasAttribute("disabled");
788
799
  }
789
800
  _limits() {
790
- let e = E(this.getAttribute("min")), t = E(this.getAttribute("max")), n = e ? new Date(e.y, e.m, e.d).getTime() : -Infinity, r = t ? new Date(t.y, t.m, t.d).getTime() : Infinity;
801
+ let e = x(this.getAttribute("min")), t = x(this.getAttribute("max")), n = e ? new Date(e.y, e.m, e.d).getTime() : -Infinity, r = t ? new Date(t.y, t.m, t.d).getTime() : Infinity;
791
802
  return (e, t, i) => {
792
803
  let a = new Date(e, t, i).getTime();
793
804
  return a < n || a > r;
794
805
  };
795
806
  }
796
807
  _monthHtml(e, t) {
797
- let n = this._firstDay(), r = (new Date(e, t, 1).getDay() - n + 7) % 7, i = O(e, t), a = this._limits(), o = te.map((e, t) => te[(t + n) % 7]).map((e) => `<span>${e}</span>`).join(""), s = (e, t, n, r) => {
798
- let i = ne(e, t, n), o = a(e, t, n);
808
+ let n = this._firstDay(), r = (new Date(e, t, 1).getDay() - n + 7) % 7, i = C(e, t), a = this._limits(), o = v.map((e, t) => v[(t + n) % 7]).map((e) => `<span>${e}</span>`).join(""), s = (e, t, n, r) => {
809
+ let i = b(e, t, n), o = a(e, t, n);
799
810
  return `<button type="button" class="${["datepicker-day", r ? "is-outside" : ""].filter(Boolean).join(" ")}" data-iso="${i}"${o ? " disabled" : ""}>${n}</button>`;
800
- }, c = "", l = k(e, t - 1), u = O(l.y, l.m);
811
+ }, c = "", l = w(e, t - 1), u = C(l.y, l.m);
801
812
  for (let e = r - 1; e >= 0; e--) c += s(l.y, l.m, u - e, !0);
802
813
  for (let n = 1; n <= i; n++) c += s(e, t, n, !1);
803
- let d = k(e, t + 1), f = (7 - (r + i) % 7) % 7;
814
+ let d = w(e, t + 1), f = (7 - (r + i) % 7) % 7;
804
815
  for (let e = 1; e <= f; e++) c += s(d.y, d.m, e, !0);
805
816
  return `
806
817
  <div class="daterange-cal">
807
- <div class="datepicker-month-label">${ee[t]} ${e}</div>
818
+ <div class="datepicker-month-label">${_[t]} ${e}</div>
808
819
  <div class="datepicker-weekdays">${o}</div>
809
820
  <div class="datepicker-grid" role="grid">${c}</div>
810
821
  </div>`;
@@ -812,7 +823,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
812
823
  _renderView() {
813
824
  let e = this.querySelector(".daterange-pop");
814
825
  if (!e) return;
815
- let t = k(this._viewY, this._viewM + 1);
826
+ let t = w(this._viewY, this._viewM + 1);
816
827
  e.innerHTML = `
817
828
  <div class="daterange-head">
818
829
  <button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month"><i class="bi bi-chevron-left" aria-hidden="true"></i></button>
@@ -838,7 +849,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
838
849
  n.classList.toggle("is-range-start", i), n.classList.toggle("is-range-end", a), n.classList.toggle("in-range", o);
839
850
  }
840
851
  let i = e.querySelector("[data-range-hint]");
841
- i && (i.textContent = this._start ? this._end ? `${D(this._start)} – ${D(this._end)}` : "Pick an end date" : "Pick a start date");
852
+ i && (i.textContent = this._start ? this._end ? `${S(this._start)} – ${S(this._end)}` : "Pick an end date" : "Pick a start date");
842
853
  }
843
854
  _position(e, t) {
844
855
  i(e, t);
@@ -860,7 +871,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
860
871
  if (!e || !t) return;
861
872
  let r = () => !t.hidden;
862
873
  this._open = () => {
863
- let r = E(this._start);
874
+ let r = x(this._start);
864
875
  if (r) this._viewY = r.y, this._viewM = r.m;
865
876
  else {
866
877
  let e = /* @__PURE__ */ new Date();
@@ -873,7 +884,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
873
884
  this._popClick = !0;
874
885
  let t = e.target.closest("[data-nav]");
875
886
  if (t) {
876
- let e = k(this._viewY, this._viewM + Number(t.dataset.nav));
887
+ let e = w(this._viewY, this._viewM + Number(t.dataset.nav));
877
888
  this._viewY = e.y, this._viewM = e.m, this._renderView();
878
889
  return;
879
890
  }
@@ -903,7 +914,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
903
914
  disconnectedCallback() {
904
915
  this._teardown();
905
916
  }
906
- }, ie = class extends HTMLElement {
917
+ }, E = class extends HTMLElement {
907
918
  static formAssociated = !0;
908
919
  _accessibleName() {
909
920
  return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
@@ -921,7 +932,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
921
932
  ];
922
933
  }
923
934
  constructor() {
924
- super(), this._values = [], this._optionsProp = null, this._active = -1;
935
+ super(), this._values = [], this._optionsProp = null, this._active = -1, this._typeahead = "", this._typeaheadTimer = null;
925
936
  try {
926
937
  this._internals = this.attachInternals();
927
938
  } catch {
@@ -972,7 +983,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
972
983
  value: e.getAttribute("value") ?? e.textContent.trim(),
973
984
  label: e.innerHTML,
974
985
  icon: e.getAttribute("icon") || void 0,
975
- [l]: !0,
986
+ [u]: !0,
976
987
  selected: e.hasAttribute("selected")
977
988
  })));
978
989
  }
@@ -985,7 +996,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
985
996
  }
986
997
  _labelHtmlFor(e) {
987
998
  let t = this._readOptions().find((t) => String(t.value) === String(e));
988
- return t ? f(t) : u(e);
999
+ return t ? p(t) : d(e);
989
1000
  }
990
1001
  render() {
991
1002
  this._snapshotDeclared();
@@ -994,13 +1005,13 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
994
1005
  let a = `${this.id}-listbox`;
995
1006
  this._listboxId = a, this.innerHTML = `
996
1007
  <div class="search-select${i}">
997
- <div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${A(a)}" aria-label="${A(this._accessibleName())}"${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : " tabindex=\"0\""}>
998
- ${n ? `<i class="bi bi-${A(n)} search-select-icon" aria-hidden="true"></i>` : ""}
1008
+ <div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${D(a)}" aria-label="${D(this._accessibleName())}"${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : " tabindex=\"0\""}>
1009
+ ${n ? `<i class="bi bi-${D(n)} search-select-icon" aria-hidden="true"></i>` : ""}
999
1010
  <div class="ms-chips" data-chips></div>
1000
1011
  <i class="bi bi-chevron-down search-select-caret" aria-hidden="true"></i>
1001
1012
  </div>
1002
- <div class="search-select-menu search-select-menu-fixed" role="listbox" id="${A(a)}" aria-multiselectable="true" tabindex="-1" hidden>
1003
- ${e ? `<div class="search-select-search"><i class="bi bi-search" aria-hidden="true"></i><input class="search-select-input" placeholder="${A(t)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden><i class="bi bi-x" aria-hidden="true"></i></button></div>` : ""}
1013
+ <div class="search-select-menu search-select-menu-fixed" role="listbox" id="${D(a)}" aria-multiselectable="true" tabindex="-1" hidden>
1014
+ ${e ? `<div class="search-select-search"><i class="bi bi-search" aria-hidden="true"></i><input class="search-select-input" placeholder="${D(t)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden><i class="bi bi-x" aria-hidden="true"></i></button></div>` : ""}
1004
1015
  <div class="search-select-options"></div>
1005
1016
  <div class="search-select-empty" hidden>No matches</div>
1006
1017
  </div>
@@ -1011,10 +1022,10 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
1011
1022
  if (!e) return;
1012
1023
  let t = this.getAttribute("placeholder") || "Select…";
1013
1024
  if (!this._values.length) {
1014
- e.innerHTML = `<span class="search-select-placeholder">${u(t)}</span>`;
1025
+ e.innerHTML = `<span class="search-select-placeholder">${d(t)}</span>`;
1015
1026
  return;
1016
1027
  }
1017
- e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${this._labelHtmlFor(e)}</span><button type="button" class="chip-remove" data-remove="${A(e)}" aria-label="Remove ${A(ae(this._labelFor(e)))}"><i class="bi bi-x" aria-hidden="true"></i></button></span>`).join(""), this._collapseChips();
1028
+ e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${this._labelHtmlFor(e)}</span><button type="button" class="chip-remove" data-remove="${D(e)}" aria-label="Remove ${D(O(this._labelFor(e)))}"><i class="bi bi-x" aria-hidden="true"></i></button></span>`).join(""), this._collapseChips();
1018
1029
  }
1019
1030
  _collapseChips() {
1020
1031
  let e = this.querySelector("[data-chips]");
@@ -1038,78 +1049,91 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
1038
1049
  let t = this.querySelector(".search-select-options"), n = this.querySelector(".search-select-empty");
1039
1050
  if (!t) return;
1040
1051
  let r = (e || "").trim().toLowerCase(), i = this._readOptions();
1041
- r && (i = i.filter((e) => ae(e.label).toLowerCase().includes(r)));
1052
+ r && (i = i.filter((e) => O(e.label).toLowerCase().includes(r)));
1042
1053
  let a = this._listboxId || `${this.id || "wui-multiselect"}-listbox`;
1043
1054
  t.innerHTML = i.map((e, t) => {
1044
1055
  let n = this._values.includes(String(e.value));
1045
- return `<button type="button" role="option" id="${A(`${a}-opt-${t}`)}" class="search-select-option${n ? " selected" : ""}" data-value="${A(e.value)}" aria-selected="${n}"><span class="ms-opt-label">${f(e)}</span><span class="ms-check"><i class="bi bi-check" aria-hidden="true"></i></span></button>`;
1056
+ return `<button type="button" role="option" id="${D(`${a}-opt-${t}`)}" class="search-select-option${n ? " selected" : ""}" data-value="${D(e.value)}" aria-selected="${n}"><span class="ms-opt-label">${p(e)}</span><span class="ms-check"><i class="bi bi-check" aria-hidden="true"></i></span></button>`;
1046
1057
  }).join(""), n && (n.hidden = i.length > 0), this._active = -1, this.querySelector(".search-select-control")?.removeAttribute("aria-activedescendant");
1047
1058
  }
1048
1059
  _wire() {
1049
1060
  this._teardown();
1050
1061
  let e = this.querySelector(".search-select-control"), t = this.querySelector(".search-select-menu"), n = this.querySelector(".search-select-input"), r = this.querySelector(".search-select-clear"), o = this.querySelector(".search-select-options");
1051
1062
  if (!e || !t) return;
1052
- let s = () => this.hasAttribute("disabled"), l = () => i(e, t, { matchWidth: !0 }), u = () => [...this.querySelectorAll(".search-select-option")], d = () => u().filter((e) => !e.hidden), f = (t) => {
1053
- let n = d();
1063
+ let s = () => this.hasAttribute("disabled"), u = () => i(e, t, { matchWidth: !0 }), d = () => [...this.querySelectorAll(".search-select-option")], f = () => d().filter((e) => !e.hidden), p = (t) => {
1064
+ let n = f();
1054
1065
  this._active = t;
1055
- for (let e of u()) e.classList.remove("is-active");
1066
+ for (let e of d()) e.classList.remove("is-active");
1056
1067
  t >= 0 && n[t] ? (n[t].classList.add("is-active"), n[t].scrollIntoView({ block: "nearest" }), e.setAttribute("aria-activedescendant", n[t].id)) : e.removeAttribute("aria-activedescendant");
1057
- }, p = () => !t.hidden, m = () => {
1058
- s() || (t.hidden = !1, e.setAttribute("aria-expanded", "true"), e.classList.add("open"), l(), n && (n.value = "", this._renderOptions(""), n.focus()));
1059
- }, h = () => {
1060
- t.hidden = !0, e.setAttribute("aria-expanded", "false"), e.classList.remove("open"), f(-1);
1068
+ }, m = () => !t.hidden, h = () => {
1069
+ s() || (t.hidden = !1, e.setAttribute("aria-expanded", "true"), e.classList.add("open"), u(), n && (n.value = "", this._renderOptions(""), n.focus()));
1061
1070
  }, g = () => {
1071
+ t.hidden = !0, e.setAttribute("aria-expanded", "false"), e.classList.remove("open"), p(-1), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
1072
+ }, _ = () => {
1062
1073
  c(this, this._values.join(",")), this.dispatchEvent(new Event("change", { bubbles: !0 }));
1063
- }, _ = (e) => {
1064
- let t = String(e);
1065
- this._values.includes(t) ? this._values = this._values.filter((e) => e !== t) : this._values = [...this._values, t], this._renderControl(), this._renderOptions(n ? n.value : ""), g();
1066
1074
  }, v = (e) => {
1067
- this._values = this._values.filter((t) => t !== String(e)), this._renderControl(), this._renderOptions(n ? n.value : ""), g();
1075
+ let t = String(e);
1076
+ this._values.includes(t) ? this._values = this._values.filter((e) => e !== t) : this._values = [...this._values, t], this._renderControl(), this._renderOptions(n ? n.value : ""), _();
1077
+ }, y = (e) => {
1078
+ this._values = this._values.filter((t) => t !== String(e)), this._renderControl(), this._renderOptions(n ? n.value : ""), _();
1068
1079
  };
1069
1080
  e.addEventListener("click", (e) => {
1070
1081
  if (s()) return;
1071
1082
  let t = e.target.closest("[data-remove]");
1072
1083
  if (t) {
1073
- e.stopPropagation(), v(t.dataset.remove);
1084
+ e.stopPropagation(), y(t.dataset.remove);
1074
1085
  return;
1075
1086
  }
1076
- p() ? h() : m();
1087
+ m() ? g() : h();
1077
1088
  }), o.addEventListener("click", (e) => {
1078
1089
  let t = e.target.closest(".search-select-option");
1079
- t && (_(t.dataset.value), n?.focus());
1090
+ t && (v(t.dataset.value), n?.focus());
1080
1091
  }), o.addEventListener("mousemove", (e) => {
1081
1092
  let t = e.target.closest(".search-select-option");
1082
- t && f(d().indexOf(t));
1083
- }), o.addEventListener("mouseleave", () => f(-1)), n?.addEventListener("input", () => {
1084
- this._renderOptions(n.value), r && (r.hidden = !n.value), f(-1);
1093
+ t && p(f().indexOf(t));
1094
+ }), o.addEventListener("mouseleave", () => p(-1)), n?.addEventListener("input", () => {
1095
+ this._renderOptions(n.value), r && (r.hidden = !n.value), p(-1);
1096
+ }), this._navHandler = l({
1097
+ getVisibleOptions: f,
1098
+ getActive: () => this._active,
1099
+ setActive: (e) => p(e),
1100
+ onEnter: (e) => {
1101
+ e && v(e.dataset.value);
1102
+ },
1103
+ onEscape: () => {
1104
+ this._navHandler.clearTypeahead(), g(), e.focus();
1105
+ }
1085
1106
  });
1086
- let y = (t) => {
1087
- let r = d();
1088
- t.key === "ArrowDown" ? (t.preventDefault(), f(Math.min(this._active + 1, r.length - 1))) : t.key === "ArrowUp" ? (t.preventDefault(), f(Math.max(this._active - 1, 0))) : t.key === "Enter" ? (t.preventDefault(), r[this._active] && _(r[this._active].dataset.value)) : t.key === "Escape" ? (h(), e.focus()) : t.key === "Backspace" && !n?.value && this._values.length && v(this._values[this._values.length - 1]);
1107
+ let b = (e) => {
1108
+ if (e.key === "Backspace" && !n?.value && this._values.length) {
1109
+ y(this._values[this._values.length - 1]);
1110
+ return;
1111
+ }
1112
+ this._navHandler.handler(e);
1089
1113
  };
1090
- n?.addEventListener("keydown", y), r?.addEventListener("click", () => {
1114
+ n?.addEventListener("keydown", b), r?.addEventListener("click", () => {
1091
1115
  n.value = "", this._renderOptions(""), r.hidden = !0, n.focus();
1092
1116
  }), e.addEventListener("keydown", (e) => {
1093
- if (p()) {
1094
- y(e);
1117
+ if (m()) {
1118
+ b(e);
1095
1119
  return;
1096
1120
  }
1097
- (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), m());
1121
+ (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), h());
1098
1122
  }), this._bindGlobal = () => {
1099
1123
  this._teardown(), !this._ro && typeof ResizeObserver < "u" && (this._ro = new ResizeObserver(() => this._collapseChips()), this._ro.observe(this)), this._onDocClick = (e) => {
1100
- p() && !this.contains(e.target) && h();
1124
+ m() && !this.contains(e.target) && g();
1101
1125
  }, document.addEventListener("click", this._onDocClick), a(this, () => {
1102
- p() && l();
1126
+ m() && u();
1103
1127
  });
1104
1128
  }, this._bindGlobal();
1105
1129
  }
1106
1130
  _teardown() {
1107
- this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), o(this);
1131
+ this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), o(this), this._navHandler?.teardown();
1108
1132
  }
1109
1133
  disconnectedCallback() {
1110
1134
  this._teardown(), this._ro?.disconnect(), this._ro = null;
1111
1135
  }
1112
- }, A = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;"), ae = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), oe = /[^0-9]/g, se = /[^0-9a-zA-Z]/g, j = class extends HTMLElement {
1136
+ }, D = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;"), O = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), te = /[^0-9]/g, ne = /[^0-9a-zA-Z]/g, k = class extends HTMLElement {
1113
1137
  static formAssociated = !0;
1114
1138
  static get observedAttributes() {
1115
1139
  return [
@@ -1140,7 +1164,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
1140
1164
  this._value = this._clean(e), c(this, this._value), this._paint();
1141
1165
  }
1142
1166
  _clean(e) {
1143
- return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ? se : oe, "").slice(0, this.length);
1167
+ return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ? ne : te, "").slice(0, this.length);
1144
1168
  }
1145
1169
  constructor() {
1146
1170
  super();
@@ -1220,7 +1244,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
1220
1244
  disconnectedCallback() {
1221
1245
  this._onSelectionChange && document.removeEventListener("selectionchange", this._onSelectionChange);
1222
1246
  }
1223
- }, M = [
1247
+ }, re = [
1224
1248
  [
1225
1249
  "AF",
1226
1250
  "Afghanistan",
@@ -2446,56 +2470,56 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
2446
2470
  "Zimbabwe",
2447
2471
  "263"
2448
2472
  ]
2449
- ], N = (e) => (M.find((t) => t[0] === e) || [
2473
+ ], A = (e) => (re.find((t) => t[0] === e) || [
2450
2474
  "",
2451
2475
  "",
2452
2476
  ""
2453
- ])[2], P = (e) => `wui-flag wui-flag-${String(e).toLowerCase()}`, F = null, I = null;
2454
- function ce() {
2455
- return F ? Promise.resolve(F) : (I ||= Promise.all([import("./libphonenumber-js-BcNT8oq0.js"), import("./examples.mobile.json-BMXTGiGC.js")]).then(([e, t]) => (F = {
2477
+ ])[2], j = (e) => `wui-flag wui-flag-${String(e).toLowerCase()}`, M = null, N = null;
2478
+ function ie() {
2479
+ return M ? Promise.resolve(M) : (N ||= Promise.all([import("./libphonenumber-js-BcNT8oq0.js"), import("./examples.mobile.json-BMXTGiGC.js")]).then(([e, t]) => (M = {
2456
2480
  AsYouType: e.AsYouType,
2457
2481
  getExampleNumber: e.getExampleNumber,
2458
2482
  isValidPhoneNumber: e.isValidPhoneNumber,
2459
2483
  examples: t.default || t
2460
- }, F)).catch(() => null), I);
2484
+ }, M)).catch(() => null), N);
2461
2485
  }
2462
- function L(e, t) {
2463
- if (!F || !t) return t;
2486
+ function P(e, t) {
2487
+ if (!M || !t) return t;
2464
2488
  try {
2465
- return new F.AsYouType(e).input(t);
2489
+ return new M.AsYouType(e).input(t);
2466
2490
  } catch {
2467
2491
  return t;
2468
2492
  }
2469
2493
  }
2470
- function R(e) {
2471
- if (!F) return null;
2494
+ function F(e) {
2495
+ if (!M) return null;
2472
2496
  try {
2473
- return F.getExampleNumber(e, F.examples)?.formatNational() || null;
2497
+ return M.getExampleNumber(e, M.examples)?.formatNational() || null;
2474
2498
  } catch {
2475
2499
  return null;
2476
2500
  }
2477
2501
  }
2478
- function z(e) {
2479
- if (!F || !e) return null;
2502
+ function ae(e) {
2503
+ if (!M || !e) return null;
2480
2504
  try {
2481
- return F.isValidPhoneNumber(e);
2505
+ return M.isValidPhoneNumber(e);
2482
2506
  } catch {
2483
2507
  return null;
2484
2508
  }
2485
2509
  }
2486
- function le(e) {
2487
- if (!F) return null;
2510
+ function oe(e) {
2511
+ if (!M) return null;
2488
2512
  try {
2489
- let t = F.getExampleNumber(e, F.examples);
2513
+ let t = M.getExampleNumber(e, M.examples);
2490
2514
  return t?.nationalNumber ? t.nationalNumber.length : null;
2491
2515
  } catch {
2492
2516
  return null;
2493
2517
  }
2494
2518
  }
2495
- function B(e) {
2496
- if (!F || !e?.trim().startsWith("+")) return null;
2519
+ function I(e) {
2520
+ if (!M || !e?.trim().startsWith("+")) return null;
2497
2521
  try {
2498
- let t = new F.AsYouType();
2522
+ let t = new M.AsYouType();
2499
2523
  t.input(e.trim());
2500
2524
  let n = t.getCountry();
2501
2525
  return n ? {
@@ -2506,7 +2530,7 @@ function B(e) {
2506
2530
  return null;
2507
2531
  }
2508
2532
  }
2509
- var V = class extends HTMLElement {
2533
+ var L = class extends HTMLElement {
2510
2534
  static formAssociated = !0;
2511
2535
  static get observedAttributes() {
2512
2536
  return [
@@ -2526,124 +2550,175 @@ var V = class extends HTMLElement {
2526
2550
  } catch {
2527
2551
  this._internals = null;
2528
2552
  }
2529
- this._country = "IN", this._national = "";
2553
+ this._country = "IN", this._national = "", this._active = -1, this._committedValue = "";
2530
2554
  }
2531
2555
  connectedCallback() {
2532
- this._rendered || this.render();
2556
+ if (!this._rendered) {
2557
+ this.render();
2558
+ return;
2559
+ }
2560
+ this._bindGlobal?.();
2533
2561
  }
2534
2562
  attributeChangedCallback(e, t, n) {
2535
2563
  if (e === "value") {
2536
2564
  this.value = n;
2537
2565
  return;
2538
2566
  }
2539
- this._rendered && (e === "country" && (this._country = n || "IN"), this.render());
2567
+ this._rendered && (e === "country" && (this._country = n || "IN", this._suppressCountryRender) || this.render());
2540
2568
  }
2541
2569
  formResetCallback() {
2542
2570
  this.value = this._defaultValue || "";
2543
2571
  }
2544
2572
  get value() {
2545
- return this._national ? `+${N(this._country)}${this._national}` : "";
2573
+ return this._national ? `+${A(this._country)}${this._national}` : "";
2546
2574
  }
2547
2575
  set value(e) {
2548
- let t = String(e ?? "").trim(), n = B(t);
2576
+ let t = String(e ?? "").trim(), n = I(t);
2549
2577
  if (n) this._country = n.country, this._national = n.national.replace(/[^0-9]/g, "");
2550
2578
  else if (t.startsWith("+")) {
2551
- let e = t.replace(/[^0-9]/g, ""), n = String(N(this._country));
2579
+ let e = t.replace(/[^0-9]/g, ""), n = String(A(this._country));
2552
2580
  n && e.startsWith(n) && (e = e.slice(n.length)), this._national = e;
2553
2581
  } else this._national = t.replace(/[^0-9]/g, "");
2554
- n && this.getAttribute("country") !== this._country ? this.setAttribute("country", this._country) : this._rendered && this.render(), this._syncMirror();
2582
+ n && this.getAttribute("country") !== this._country ? this.setAttribute("country", this._country) : this._rendered && this.render(), this._committedValue = this.value, this._syncMirror();
2555
2583
  }
2556
2584
  _syncMirror() {
2557
2585
  c(this, this.value);
2558
2586
  }
2587
+ _emitInput() {
2588
+ this.dispatchEvent(new Event("input", { bubbles: !0 }));
2589
+ }
2590
+ _emitChange() {
2591
+ this._committedValue = this.value, this.dispatchEvent(new Event("change", { bubbles: !0 }));
2592
+ }
2559
2593
  render() {
2560
- this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "");
2561
- let e = this.getAttribute("placeholder") || R(this._country) || "Enter phone number";
2562
- this._country = this.getAttribute("country") || this._country;
2563
- let t = M.map(([e, t, n]) => `<button type="button" role="option" class="country-dropdown-item${e === this._country ? " selected" : ""}" data-iso="${e}"><span class="${P(e)}" aria-hidden="true"></span><span class="country-name-text">${t}<span class="country-code-text">+${n}</span></span></button>`).join("");
2594
+ this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || ""), this._country = this.getAttribute("country") || this._country;
2595
+ let e = this.getAttribute("placeholder") || F(this._country) || "Enter phone number";
2596
+ this.id ||= `wui-phone-${Math.random().toString(36).slice(2, 9)}`;
2597
+ let t = `${this.id}-listbox`;
2598
+ this._listboxId = t;
2599
+ let n = re.map(([e, n, r], i) => `<button type="button" role="option" id="${R(`${t}-opt-${i}`)}" class="country-dropdown-item${e === this._country ? " selected" : ""}" data-iso="${e}" aria-selected="${e === this._country}"><span class="${j(e)}" aria-hidden="true"></span><span class="country-name-text">${n}<span class="country-code-text">+${r}</span></span></button>`).join("");
2564
2600
  this.innerHTML = `
2565
2601
  <div class="phone-input-wrap">
2566
2602
  <div class="phone-country-adornment">
2567
- <button type="button" class="country-toggle" aria-haspopup="listbox" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}>
2568
- <span class="${P(this._country)}" data-flag aria-hidden="true"></span>
2603
+ <button type="button" class="country-toggle" aria-haspopup="listbox" aria-expanded="false" aria-controls="${R(t)}"${this.hasAttribute("disabled") ? " disabled" : ""}>
2604
+ <span class="${j(this._country)}" data-flag aria-hidden="true"></span>
2569
2605
  <i class="bi bi-chevron-down phone-chevron" aria-hidden="true"></i>
2570
- <span class="phone-dial" data-dial>+${N(this._country)}</span>
2606
+ <span class="phone-dial" data-dial>+${A(this._country)}</span>
2571
2607
  </button>
2572
- <div class="country-dropdown-menu" role="listbox" hidden>
2573
- <div class="dropdown-search-wrapper"><span class="dropdown-search-icon"><i class="bi bi-search" aria-hidden="true"></i></span><input type="text" class="dropdown-search-input" placeholder="Search country or code" aria-label="Search countries" /></div>
2574
- <div class="country-list-scroll">${t}<div class="country-empty" hidden>No countries found</div></div>
2608
+ <div class="country-dropdown-menu" role="listbox" id="${R(t)}" tabindex="-1" hidden>
2609
+ <div class="dropdown-search-wrapper"><span class="dropdown-search-icon"><i class="bi bi-search" aria-hidden="true"></i></span><input type="text" class="dropdown-search-input" placeholder="Search country or code" aria-label="Search countries" aria-controls="${R(t)}" aria-autocomplete="list" /></div>
2610
+ <div class="country-list-scroll">${n}<div class="country-empty" hidden>No countries found</div></div>
2575
2611
  </div>
2576
2612
  </div>
2577
- <input type="tel" class="input" placeholder="${H(e)}" value="${H(L(this._country, this._national))}"${this.getAttribute("aria-label") ? ` aria-label="${H(this.getAttribute("aria-label"))}"` : ""}${this.getAttribute("aria-describedby") ? ` aria-describedby="${H(this.getAttribute("aria-describedby"))}"` : ""}${this.hasAttribute("required") ? " required aria-required=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""} />
2613
+ <input type="tel" class="input" placeholder="${R(e)}" value="${R(P(this._country, this._national))}"${this.getAttribute("aria-label") ? ` aria-label="${R(this.getAttribute("aria-label"))}"` : ""}${this.getAttribute("aria-describedby") ? ` aria-describedby="${R(this.getAttribute("aria-describedby"))}"` : ""}${this.hasAttribute("required") ? " required aria-required=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""} />
2578
2614
  </div>
2579
2615
  <div class="field-error" data-phone-error hidden></div>`, this._rendered = !0, c(this, this.value), this._wire();
2580
2616
  }
2617
+ _itemEls() {
2618
+ return [...this.querySelectorAll(".country-dropdown-item")];
2619
+ }
2620
+ _visibleItems() {
2621
+ return this._itemEls().filter((e) => !e.hidden);
2622
+ }
2581
2623
  _wire() {
2582
2624
  this._teardown();
2583
- let e = this.querySelector(".country-toggle"), t = this.querySelector(".phone-input-wrap"), n = this.querySelector(".country-dropdown-menu"), r = this.querySelector(".dropdown-search-input"), i = this.querySelector(".country-list-scroll"), a = this.querySelector(".country-empty"), o = this.querySelector("input[type=tel]"), s = this.querySelector("[data-flag]"), c = this.querySelector("[data-dial]");
2625
+ let e = this.querySelector(".country-toggle"), t = this.querySelector(".phone-input-wrap"), n = this.querySelector(".country-dropdown-menu"), r = this.querySelector(".dropdown-search-input"), s = this.querySelector(".country-list-scroll"), c = this.querySelector(".country-empty"), l = this.querySelector("input[type=tel]"), u = this.querySelector("[data-flag]"), d = this.querySelector("[data-dial]");
2584
2626
  if (!e || !n) return;
2585
- let l = () => !n.hidden, u = () => {
2586
- let r = (t || e).getBoundingClientRect(), i = n.offsetWidth || 320, a = n.offsetHeight || 320, o = window.innerHeight - r.bottom, s = o < a + 6 && r.top > o ? r.top - a - 6 : r.bottom + 6, c = Math.min(Math.max(8, r.left), Math.max(8, window.innerWidth - i - 8));
2587
- n.style.top = `${Math.max(8, s)}px`, n.style.left = `${c}px`;
2588
- }, d = () => {
2589
- n.hidden = !1, e.setAttribute("aria-expanded", "true"), r.value = "", p(""), u(), r.focus();
2590
- }, f = () => {
2591
- n.hidden = !0, e.setAttribute("aria-expanded", "false");
2592
- };
2593
- this._reposition = () => {
2594
- l() && u();
2595
- }, window.addEventListener("scroll", this._reposition, !0), window.addEventListener("resize", this._reposition);
2596
- let p = (e) => {
2627
+ let f = () => !n.hidden, p = () => i(t || e, n), m = (e) => {
2628
+ let t = this._visibleItems();
2629
+ this._active = e;
2630
+ for (let e of this._itemEls()) e.classList.remove("is-active");
2631
+ e >= 0 && t[e] ? (t[e].classList.add("is-active"), t[e].scrollIntoView({ block: "nearest" }), r?.setAttribute("aria-activedescendant", t[e].id)) : r?.removeAttribute("aria-activedescendant");
2632
+ }, h = () => {
2633
+ n.hidden = !1, e.setAttribute("aria-expanded", "true"), r.value = "", _(""), p(), r.focus(), m(this._visibleItems().findIndex((e) => e.classList.contains("selected")));
2634
+ }, g = () => {
2635
+ n.hidden = !0, e.setAttribute("aria-expanded", "false"), m(-1);
2636
+ }, _ = (e) => {
2597
2637
  let t = e.trim().toLowerCase(), n = 0;
2598
- for (let e of i.querySelectorAll(".country-dropdown-item")) {
2638
+ for (let e of this._itemEls()) {
2599
2639
  let r = !t || e.textContent.toLowerCase().includes(t);
2600
2640
  e.hidden = !r, r && (n += 1);
2601
2641
  }
2602
- a && (a.hidden = n > 0);
2603
- }, m = (e) => {
2604
- this._country = e, this.setAttribute("country", e), s && (s.className = P(e)), c && (c.textContent = `+${N(e)}`);
2605
- for (let t of i.querySelectorAll(".country-dropdown-item")) t.classList.toggle("selected", t.dataset.iso === e);
2606
- f(), this._syncMirror(), this.dispatchEvent(new Event("change", { bubbles: !0 }));
2642
+ c && (c.hidden = n > 0);
2643
+ }, v = (e) => {
2644
+ this._country = e, this.getAttribute("country") !== e && (this._suppressCountryRender = !0, this.setAttribute("country", e), this._suppressCountryRender = !1), u && (u.className = j(e)), d && (d.textContent = `+${A(e)}`);
2645
+ for (let t of this._itemEls()) {
2646
+ let n = t.dataset.iso === e;
2647
+ t.classList.toggle("selected", n), t.setAttribute("aria-selected", String(n));
2648
+ }
2649
+ !this.getAttribute("placeholder") && l && (l.placeholder = F(e) || "Enter phone number"), l && this._national && (l.value = P(e, this._national)), g(), this._syncMirror(), this._emitChange(), l?.focus();
2650
+ }, y = (t) => {
2651
+ let n = this._visibleItems();
2652
+ if (t.key === "ArrowDown") {
2653
+ if (t.preventDefault(), !f()) {
2654
+ h();
2655
+ return;
2656
+ }
2657
+ m(Math.min(this._active + 1, n.length - 1));
2658
+ } else if (t.key === "ArrowUp") {
2659
+ if (t.preventDefault(), !f()) return;
2660
+ m(Math.max(this._active - 1, 0));
2661
+ } else t.key === "Enter" ? (t.preventDefault(), f() && n[this._active] && v(n[this._active].dataset.iso)) : t.key === "Escape" && f() && (t.preventDefault(), g(), e.focus());
2607
2662
  };
2608
- e.addEventListener("click", () => l() ? f() : d()), r.addEventListener("input", () => p(r.value)), i.addEventListener("click", (e) => {
2663
+ e.addEventListener("click", () => f() ? g() : h()), e.addEventListener("keydown", (e) => {
2664
+ if (f()) {
2665
+ y(e);
2666
+ return;
2667
+ }
2668
+ (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), h());
2669
+ }), r.addEventListener("input", () => {
2670
+ _(r.value);
2671
+ let e = this._visibleItems();
2672
+ m(e.length ? 0 : -1);
2673
+ }), s.addEventListener("click", (e) => {
2609
2674
  let t = e.target.closest(".country-dropdown-item");
2610
- t && m(t.dataset.iso);
2611
- });
2612
- let h = this.querySelector("[data-phone-error]"), g = (e) => {
2613
- if (o.classList.toggle("is-invalid", e), e ? o.setAttribute("aria-invalid", "true") : o.removeAttribute("aria-invalid"), h) {
2675
+ t && v(t.dataset.iso);
2676
+ }), s.addEventListener("mousemove", (e) => {
2677
+ let t = e.target.closest(".country-dropdown-item");
2678
+ t && m(this._visibleItems().indexOf(t));
2679
+ }), s.addEventListener("mouseleave", () => m(-1)), n.addEventListener("keydown", y);
2680
+ let b = this.querySelector("[data-phone-error]"), x = (e) => {
2681
+ if (l.classList.toggle("is-invalid", e), e ? l.setAttribute("aria-invalid", "true") : l.removeAttribute("aria-invalid"), b) {
2614
2682
  if (e) {
2615
- let e = R(this._country);
2616
- h.textContent = e ? `Enter a valid phone number, e.g. ${e}` : "Enter a valid phone number";
2683
+ let e = F(this._country);
2684
+ b.textContent = e ? `Enter a valid phone number, e.g. ${e}` : "Enter a valid phone number";
2617
2685
  }
2618
- h.hidden = !e;
2686
+ b.hidden = !e;
2619
2687
  }
2620
2688
  };
2621
- o.addEventListener("input", () => {
2622
- let e = o.value.replace(/[^0-9]/g, ""), t = le(this._country);
2623
- t && e.length > t && (e = e.slice(0, t)), this._national = e;
2624
- let n = L(this._country, this._national);
2625
- o.value !== n && (o.value = n), this._syncMirror(), this.dispatchEvent(new Event("change", { bubbles: !0 })), o.classList.contains("is-invalid") && (!this._national || z(this.value) === !0) && g(!1);
2626
- }), o.addEventListener("blur", () => {
2627
- g(this._national.length > 0 && z(this.value) === !1);
2628
- }), o.addEventListener("paste", (e) => {
2629
- let t = B(e.clipboardData?.getData("text"));
2630
- t && (e.preventDefault(), this._national = t.national.replace(/[^0-9]/g, ""), t.country === this._country ? o.value = L(this._country, this._national) : this.setAttribute("country", t.country), this._syncMirror(), this.dispatchEvent(new Event("change", { bubbles: !0 })), this.querySelector("input[type=tel]")?.focus());
2631
- }), this._onDocClick = (e) => {
2632
- l() && !this.contains(e.target) && f();
2633
- }, document.addEventListener("click", this._onDocClick), ce().then((e) => {
2634
- if (!(!e || !o) && (this._national && (o.value = L(this._country, this._national)), !this.getAttribute("placeholder"))) {
2635
- let e = R(this._country);
2636
- e && (o.placeholder = e);
2689
+ l.addEventListener("input", (e) => {
2690
+ e.stopPropagation();
2691
+ let t = l.value.replace(/[^0-9]/g, ""), n = oe(this._country);
2692
+ n && t.length > n && (t = t.slice(0, n)), this._national = t;
2693
+ let r = P(this._country, this._national);
2694
+ l.value !== r && (l.value = r), this._syncMirror(), this._emitInput(), l.classList.contains("is-invalid") && (!this._national || ae(this.value) === !0) && x(!1);
2695
+ }), l.addEventListener("change", (e) => e.stopPropagation()), l.addEventListener("blur", () => {
2696
+ x(this._national.length > 0 && ae(this.value) === !1), this.value !== this._committedValue && this._emitChange();
2697
+ }), l.addEventListener("paste", (e) => {
2698
+ let t = I(e.clipboardData?.getData("text"));
2699
+ t && (e.preventDefault(), this._national = t.national.replace(/[^0-9]/g, ""), t.country === this._country ? l.value = P(this._country, this._national) : this.setAttribute("country", t.country), this._syncMirror(), this._emitInput(), this._emitChange(), this.querySelector("input[type=tel]")?.focus());
2700
+ }), this._bindGlobal = () => {
2701
+ this._teardownGlobals?.(), this._onDocClick = (e) => {
2702
+ f() && !this.contains(e.target) && g();
2703
+ }, document.addEventListener("click", this._onDocClick), a(this, () => {
2704
+ f() && p();
2705
+ });
2706
+ }, this._teardownGlobals = () => {
2707
+ this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), o(this);
2708
+ }, this._bindGlobal(), ie().then((e) => {
2709
+ if (!(!e || !l.isConnected) && (this._national && (l.value = P(this._country, this._national)), !this.getAttribute("placeholder"))) {
2710
+ let e = F(this._country);
2711
+ e && (l.placeholder = e);
2637
2712
  }
2638
2713
  }), this._syncMirror();
2639
2714
  }
2640
2715
  _teardown() {
2641
- this._reposition && (window.removeEventListener("scroll", this._reposition, !0), window.removeEventListener("resize", this._reposition)), this._onDocClick && document.removeEventListener("click", this._onDocClick);
2716
+ this._teardownGlobals?.();
2642
2717
  }
2643
2718
  disconnectedCallback() {
2644
2719
  this._teardown();
2645
2720
  }
2646
- }, H = (e) => String(e ?? "").replace(/"/g, "&quot;").replace(/</g, "&lt;"), U = class extends HTMLElement {
2721
+ }, R = (e) => String(e ?? "").replace(/"/g, "&quot;").replace(/</g, "&lt;"), z = class extends HTMLElement {
2647
2722
  static formAssociated = !0;
2648
2723
  static get observedAttributes() {
2649
2724
  return [
@@ -2670,7 +2745,7 @@ var V = class extends HTMLElement {
2670
2745
  } catch {
2671
2746
  this._internals = null;
2672
2747
  }
2673
- this._value = "", this._optionsProp = null, this._active = -1;
2748
+ this._value = "", this._optionsProp = null, this._active = -1, this._typeahead = "", this._typeaheadTimer = null;
2674
2749
  }
2675
2750
  connectedCallback() {
2676
2751
  if (!this._rendered) {
@@ -2708,7 +2783,7 @@ var V = class extends HTMLElement {
2708
2783
  value: e.getAttribute("value") ?? e.textContent.trim(),
2709
2784
  label: e.innerHTML,
2710
2785
  icon: e.getAttribute("icon") || void 0,
2711
- [l]: !0,
2786
+ [u]: !0,
2712
2787
  selected: e.hasAttribute("selected")
2713
2788
  })));
2714
2789
  }
@@ -2717,25 +2792,25 @@ var V = class extends HTMLElement {
2717
2792
  }
2718
2793
  render() {
2719
2794
  this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || ""), this._snapshotDeclared();
2720
- let e = this._readOptions(), t = this.hasAttribute("searchable"), n = this.hasAttribute("clearable"), r = this.getAttribute("size"), i = r === "sm" ? " search-select-sm" : r === "lg" ? " search-select-lg" : "", a = this.getAttribute("icon"), o = this.getAttribute("prefix"), s = this.getAttribute("placeholder") || "Select...", l = this.getAttribute("search-placeholder") || "Search...", d = e.find((e) => String(e.value) === String(this._value)) || e.find((e) => e.selected);
2721
- d && (this._value = String(d.value)), c(this, this._value), this.id ||= `wui-select-${Math.random().toString(36).slice(2, 9)}`;
2722
- let p = `${this.id}-listbox`;
2723
- this._listboxId = p;
2795
+ let e = this._readOptions(), t = this.hasAttribute("searchable"), n = this.hasAttribute("clearable"), r = this.getAttribute("size"), i = r === "sm" ? " search-select-sm" : r === "lg" ? " search-select-lg" : "", a = this.getAttribute("icon"), o = this.getAttribute("prefix"), s = this.getAttribute("placeholder") || "Select...", l = this.getAttribute("search-placeholder") || "Search...", u = e.find((e) => String(e.value) === String(this._value)) || e.find((e) => e.selected);
2796
+ u && (this._value = String(u.value)), c(this, this._value), this.id ||= `wui-select-${Math.random().toString(36).slice(2, 9)}`;
2797
+ let f = `${this.id}-listbox`;
2798
+ this._listboxId = f;
2724
2799
  let m = e.map((e, t) => {
2725
2800
  let n = String(e.value) === String(this._value);
2726
- return `<button type="button" role="option" id="${W(`${p}-opt-${t}`)}" class="search-select-option${n ? " selected" : ""}" data-value="${W(e.value)}" aria-selected="${n}">${f(e)}</button>`;
2801
+ return `<button type="button" role="option" id="${B(`${f}-opt-${t}`)}" class="search-select-option${n ? " selected" : ""}" data-value="${B(e.value)}" aria-selected="${n}">${p(e)}</button>`;
2727
2802
  }).join("");
2728
2803
  this.innerHTML = `
2729
2804
  <div class="search-select${this.hasAttribute("compact") ? " search-select-compact" : ""}${i}">
2730
- <button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${W(p)}" aria-label="${W(this._accessibleName())}"${this.hasAttribute("disabled") ? " disabled" : ""}>
2731
- ${a ? `<i class="bi bi-${W(a)} search-select-icon" aria-hidden="true"></i>` : ""}
2732
- ${o ? `<span class="search-select-prefix">${u(o)}</span>` : ""}
2733
- <span class="${d ? "" : "search-select-placeholder"}" data-label>${d ? f(d) : u(s)}</span>
2805
+ <button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${B(f)}" aria-label="${B(this._accessibleName())}"${this.hasAttribute("disabled") ? " disabled" : ""}>
2806
+ ${a ? `<i class="bi bi-${B(a)} search-select-icon" aria-hidden="true"></i>` : ""}
2807
+ ${o ? `<span class="search-select-prefix">${d(o)}</span>` : ""}
2808
+ <span class="${u ? "" : "search-select-placeholder"}" data-label>${u ? p(u) : d(s)}</span>
2734
2809
  ${n ? "<span class=\"search-select-reset\" role=\"button\" aria-label=\"Clear selection\" hidden><i class=\"bi bi-x-lg\" aria-hidden=\"true\"></i></span>" : ""}
2735
2810
  <i class="bi bi-chevron-down search-select-caret" aria-hidden="true"></i>
2736
2811
  </button>
2737
- <div class="search-select-menu search-select-menu-fixed" role="listbox" id="${W(p)}" tabindex="-1" hidden>
2738
- ${t ? `<div class="search-select-search"><i class="bi bi-search" aria-hidden="true"></i><input class="search-select-input" placeholder="${W(l)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden><i class="bi bi-x" aria-hidden="true"></i></button></div>` : ""}
2812
+ <div class="search-select-menu search-select-menu-fixed" role="listbox" id="${B(f)}" tabindex="-1" hidden>
2813
+ ${t ? `<div class="search-select-search"><i class="bi bi-search" aria-hidden="true"></i><input class="search-select-input" placeholder="${B(l)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden><i class="bi bi-x" aria-hidden="true"></i></button></div>` : ""}
2739
2814
  <div class="search-select-options">${m}<div class="search-select-empty" hidden>No matches</div></div>
2740
2815
  </div>
2741
2816
  </div>`, this._rendered = !0, c(this, this._value), this._wire(), this._syncReset();
@@ -2764,7 +2839,7 @@ var V = class extends HTMLElement {
2764
2839
  let t = e.dataset.value === String(this._value);
2765
2840
  e.classList.toggle("selected", t), e.setAttribute("aria-selected", String(t));
2766
2841
  }
2767
- e && (e.innerHTML = t ? f(t) : u(this.getAttribute("placeholder") || "Select..."), e.classList.toggle("search-select-placeholder", !t));
2842
+ e && (e.innerHTML = t ? p(t) : d(this.getAttribute("placeholder") || "Select..."), e.classList.toggle("search-select-placeholder", !t));
2768
2843
  }
2769
2844
  _syncReset() {
2770
2845
  let { reset: e } = this._refs();
@@ -2795,23 +2870,30 @@ var V = class extends HTMLElement {
2795
2870
  e.menu.hidden = !1, e.control.setAttribute("aria-expanded", "true"), e.control.classList.add("open"), t(), e.search && (e.search.value = "", r(""), e.search.focus()), n(this._optionEls().findIndex((e) => e.classList.contains("selected")));
2796
2871
  }, c = () => {
2797
2872
  e.menu.hidden = !0, e.control.setAttribute("aria-expanded", "false"), e.control.classList.remove("open"), n(-1);
2798
- }, l = (t) => {
2799
- this.value = t.dataset.value, this.dispatchEvent(new Event("change", { bubbles: !0 })), c(), e.control.focus();
2800
2873
  }, u = (t) => {
2801
- let r = this._visible();
2802
- t.key === "ArrowDown" ? (t.preventDefault(), n(Math.min(this._active + 1, r.length - 1))) : t.key === "ArrowUp" ? (t.preventDefault(), n(Math.max(this._active - 1, 0))) : t.key === "Enter" ? (t.preventDefault(), r[this._active] && l(r[this._active])) : t.key === "Escape" && (c(), e.control.focus());
2874
+ this.value = t.dataset.value, this.dispatchEvent(new Event("change", { bubbles: !0 })), c(), e.control.focus();
2803
2875
  };
2804
- e.reset?.addEventListener("click", (t) => {
2876
+ this._navHandler = l({
2877
+ getVisibleOptions: () => this._visible(),
2878
+ getActive: () => this._active,
2879
+ setActive: (e) => n(e),
2880
+ onEnter: (e) => {
2881
+ e && u(e);
2882
+ },
2883
+ onEscape: () => {
2884
+ this._navHandler.clearTypeahead(), c(), e.control.focus();
2885
+ }
2886
+ }), e.reset?.addEventListener("click", (t) => {
2805
2887
  t.stopPropagation(), this.value = "", this.dispatchEvent(new Event("change", { bubbles: !0 })), e.control.focus();
2806
2888
  }), e.control.addEventListener("click", () => o() ? c() : s()), e.control.addEventListener("keydown", (e) => {
2807
2889
  if (o()) {
2808
- u(e);
2890
+ this._navHandler.handler(e);
2809
2891
  return;
2810
2892
  }
2811
2893
  (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), s());
2812
2894
  }), e.optionsWrap.addEventListener("click", (e) => {
2813
2895
  let t = e.target.closest(".search-select-option");
2814
- t && l(t);
2896
+ t && u(t);
2815
2897
  }), e.optionsWrap.addEventListener("mousemove", (e) => {
2816
2898
  let t = e.target.closest(".search-select-option");
2817
2899
  t && n(this._visible().indexOf(t));
@@ -2819,7 +2901,7 @@ var V = class extends HTMLElement {
2819
2901
  r(e.search.value), n(-1);
2820
2902
  }), e.clear?.addEventListener("click", () => {
2821
2903
  e.search.value = "", r(""), e.search.focus();
2822
- }), e.menu.addEventListener("keydown", u), this._bindGlobal = () => {
2904
+ }), e.menu.addEventListener("keydown", this._navHandler.handler), this._bindGlobal = () => {
2823
2905
  this._teardown(), this._onDocClick = (e) => {
2824
2906
  o() && !this.contains(e.target) && c();
2825
2907
  }, document.addEventListener("click", this._onDocClick), a(this, () => {
@@ -2828,12 +2910,12 @@ var V = class extends HTMLElement {
2828
2910
  }, this._bindGlobal();
2829
2911
  }
2830
2912
  _teardown() {
2831
- this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), o(this);
2913
+ this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), o(this), this._navHandler?.teardown();
2832
2914
  }
2833
2915
  disconnectedCallback() {
2834
2916
  this._teardown();
2835
2917
  }
2836
- }, W = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;"), G = class extends HTMLElement {
2918
+ }, B = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;"), V = class extends HTMLElement {
2837
2919
  static formAssociated = !0;
2838
2920
  static get observedAttributes() {
2839
2921
  return [
@@ -2873,19 +2955,19 @@ var V = class extends HTMLElement {
2873
2955
  return this._value;
2874
2956
  }
2875
2957
  set value(e) {
2876
- this._value = this._snapToStep(this._clamp(K(e, this._value))), this._syncValue(), this._syncMirrors();
2958
+ this._value = this._snapToStep(this._clamp(H(e, this._value))), this._syncValue(), this._syncMirrors();
2877
2959
  }
2878
2960
  get start() {
2879
2961
  return this._start;
2880
2962
  }
2881
2963
  set start(e) {
2882
- this._start = Math.min(this._snapToStep(this._clamp(K(e, this._start))), this._end), this._syncValue(), this._syncMirrors();
2964
+ this._start = Math.min(this._snapToStep(this._clamp(H(e, this._start))), this._end), this._syncValue(), this._syncMirrors();
2883
2965
  }
2884
2966
  get end() {
2885
2967
  return this._end;
2886
2968
  }
2887
2969
  set end(e) {
2888
- this._end = Math.max(this._snapToStep(this._clamp(K(e, this._end))), this._start), this._syncValue(), this._syncMirrors();
2970
+ this._end = Math.max(this._snapToStep(this._clamp(H(e, this._end))), this._start), this._syncValue(), this._syncMirrors();
2889
2971
  }
2890
2972
  attributeChangedCallback(e, t, n) {
2891
2973
  if (e === "value" || e === "start" || e === "end" || e === "min" || e === "max" || e === "step") {
@@ -2898,19 +2980,19 @@ var V = class extends HTMLElement {
2898
2980
  this._isRange() ? this._resetRange() : this._resetSingle();
2899
2981
  }
2900
2982
  _updateFromAttribute(e) {
2901
- e === "value" ? this._value = this._snapToStep(this._clamp(K(this.getAttribute("value"), this._value))) : e === "start" ? this._start = this._snapToStep(this._clamp(K(this.getAttribute("start"), this._start))) : e === "end" && (this._end = this._snapToStep(this._clamp(K(this.getAttribute("end"), this._end))));
2983
+ e === "value" ? this._value = this._snapToStep(this._clamp(H(this.getAttribute("value"), this._value))) : e === "start" ? this._start = this._snapToStep(this._clamp(H(this.getAttribute("start"), this._start))) : e === "end" && (this._end = this._snapToStep(this._clamp(H(this.getAttribute("end"), this._end))));
2902
2984
  }
2903
2985
  _isRange() {
2904
2986
  return this.hasAttribute("range");
2905
2987
  }
2906
2988
  _min() {
2907
- return K(this.getAttribute("min"), 0);
2989
+ return H(this.getAttribute("min"), 0);
2908
2990
  }
2909
2991
  _max() {
2910
- return K(this.getAttribute("max"), 100);
2992
+ return H(this.getAttribute("max"), 100);
2911
2993
  }
2912
2994
  _step() {
2913
- return K(this.getAttribute("step"), 1);
2995
+ return H(this.getAttribute("step"), 1);
2914
2996
  }
2915
2997
  _clamp(e) {
2916
2998
  return Math.max(this._min(), Math.min(e, this._max()));
@@ -2975,7 +3057,7 @@ var V = class extends HTMLElement {
2975
3057
  aria-valuenow="${this._value}"
2976
3058
  aria-valuetext="${this._formatValue(this._value)}"
2977
3059
  ${a ? "disabled" : ""}
2978
- aria-label="${ue(this.getAttribute("aria-label") || "Value")}"
3060
+ aria-label="${se(this.getAttribute("aria-label") || "Value")}"
2979
3061
  ></button>
2980
3062
  `}
2981
3063
  ${this.hasAttribute("show-value") ? n ? `<span class="slider-value">${this._formatValue(this._start)} – ${this._formatValue(this._end)}</span>` : `<span class="slider-value">${this._formatValue(this._value)}</span>` : ""}
@@ -3075,10 +3157,10 @@ var V = class extends HTMLElement {
3075
3157
  disconnectedCallback() {
3076
3158
  this._teardown();
3077
3159
  }
3078
- }, K = (e, t) => {
3160
+ }, H = (e, t) => {
3079
3161
  let n = Number.parseFloat(e);
3080
3162
  return Number.isFinite(n) ? n : t;
3081
- }, ue = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;"), de = class extends HTMLElement {
3163
+ }, se = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;"), U = class extends HTMLElement {
3082
3164
  static formAssociated = !0;
3083
3165
  _accessibleName() {
3084
3166
  return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Add tags";
@@ -3142,8 +3224,8 @@ var V = class extends HTMLElement {
3142
3224
  c(this, this._values.join(",")), this.innerHTML = `
3143
3225
  <div class="search-select${t}">
3144
3226
  <div class="input search-select-control search-select-multi"${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : ""}>
3227
+ <input type="text" class="ms-input" data-input aria-label="${W(this._accessibleName())}" placeholder="${W(this.getAttribute("placeholder") || "Add…")}" autocomplete="off"${this.hasAttribute("disabled") ? " disabled" : ""}/>
3145
3228
  <div class="ms-chips" data-chips></div>
3146
- <input type="text" class="ms-input" data-input aria-label="${q(this._accessibleName())}" placeholder="${q(this.getAttribute("placeholder") || "Add…")}" autocomplete="off"${this.hasAttribute("disabled") ? " disabled" : ""}/>
3147
3229
  </div>
3148
3230
  </div>`, this._rendered = !0, c(this, this._values.join(",")), this._renderControl(), this._wire();
3149
3231
  }
@@ -3154,7 +3236,7 @@ var V = class extends HTMLElement {
3154
3236
  e.innerHTML = "";
3155
3237
  return;
3156
3238
  }
3157
- e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${fe(e)}</span><button type="button" class="chip-remove" data-remove="${q(e)}" aria-label="Remove ${q(e)}"><i class="bi bi-x" aria-hidden="true"></i></button></span>`).join("");
3239
+ e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${ce(e)}</span><button type="button" class="chip-remove" data-remove="${W(e)}" aria-label="Remove ${W(e)}"><i class="bi bi-x" aria-hidden="true"></i></button></span>`).join("");
3158
3240
  }
3159
3241
  }
3160
3242
  _wire() {
@@ -3225,18 +3307,18 @@ var V = class extends HTMLElement {
3225
3307
  disconnectedCallback() {
3226
3308
  this._teardown();
3227
3309
  }
3228
- }, fe = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), q = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;"), J = (e) => String(e).padStart(2, "0"), pe = (e, t) => `${J(e)}:${J(t)}`, Y = (e) => {
3310
+ }, ce = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), W = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;"), G = (e) => String(e).padStart(2, "0"), K = (e, t) => `${G(e)}:${G(t)}`, q = (e) => {
3229
3311
  let t = /^(\d{2}):(\d{2})$/.exec(e || "");
3230
3312
  return t ? {
3231
3313
  h: +t[1],
3232
3314
  m: +t[2]
3233
3315
  } : null;
3234
- }, X = (e, t = "24") => {
3316
+ }, J = (e, t = "24") => {
3235
3317
  if (!e) return "";
3236
- if (t === "24") return pe(e.h, e.m);
3318
+ if (t === "24") return K(e.h, e.m);
3237
3319
  let n = e.h % 12 || 12, r = e.h >= 12 ? "PM" : "AM";
3238
- return `${n}:${J(e.m)} ${r}`;
3239
- }, me = class extends HTMLElement {
3320
+ return `${n}:${G(e.m)} ${r}`;
3321
+ }, Y = class extends HTMLElement {
3240
3322
  static formAssociated = !0;
3241
3323
  static get observedAttributes() {
3242
3324
  return [
@@ -3260,7 +3342,7 @@ var V = class extends HTMLElement {
3260
3342
  } catch {
3261
3343
  this._internals = null;
3262
3344
  }
3263
- this._value = "", this._focus = null;
3345
+ this._value = "", this._focus = null, this._typeahead = "", this._typeaheadTimer = null;
3264
3346
  }
3265
3347
  connectedCallback() {
3266
3348
  if (!this._rendered) {
@@ -3283,11 +3365,11 @@ var V = class extends HTMLElement {
3283
3365
  }
3284
3366
  render() {
3285
3367
  this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "", this._value = this._defaultValue || this._value);
3286
- let e = this.getAttribute("placeholder") || "Select time", t = Y(this._value), n = this.getAttribute("format") || "24", r = this.getAttribute("size"), i = r === "sm" ? " input-sm" : r === "lg" ? " input-lg" : "", a = this.getAttribute("aria-label"), o = this.getAttribute("aria-describedby");
3368
+ let e = this.getAttribute("placeholder") || "Select time", t = q(this._value), n = this.getAttribute("format") || "24", r = this.getAttribute("size"), i = r === "sm" ? " input-sm" : r === "lg" ? " input-lg" : "", a = this.getAttribute("aria-label"), o = this.getAttribute("aria-describedby");
3287
3369
  this.innerHTML = `
3288
3370
  <div class="timepicker">
3289
- <button type="button" class="input timepicker-trigger${i}${t ? " has-value" : ""}" aria-haspopup="listbox" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${a ? ` aria-label="${u(a)}"` : ""}${o ? ` aria-describedby="${u(o)}"` : ""}>
3290
- <span data-trigger-label class="${t ? "" : "timepicker-placeholder"}">${t ? X(t, n) : u(e)}</span>
3371
+ <button type="button" class="input timepicker-trigger${i}${t ? " has-value" : ""}" aria-haspopup="listbox" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${a ? ` aria-label="${d(a)}"` : ""}${o ? ` aria-describedby="${d(o)}"` : ""}>
3372
+ <span data-trigger-label class="${t ? "" : "timepicker-placeholder"}">${t ? J(t, n) : d(e)}</span>
3291
3373
  <i class="bi bi-clock" aria-hidden="true"></i>
3292
3374
  </button>
3293
3375
  <div class="timepicker-pop" role="listbox" tabindex="-1" hidden></div>
@@ -3299,14 +3381,14 @@ var V = class extends HTMLElement {
3299
3381
  _syncTrigger() {
3300
3382
  let e = this.querySelector(".timepicker-trigger"), t = this.querySelector("[data-trigger-label]");
3301
3383
  if (!t) return;
3302
- let n = Y(this._value), r = this.getAttribute("format") || "24";
3303
- t.textContent = n ? X(n, r) : this.getAttribute("placeholder") || "Select time", t.classList.toggle("timepicker-placeholder", !n), e?.classList.toggle("has-value", !!n);
3384
+ let n = q(this._value), r = this.getAttribute("format") || "24";
3385
+ t.textContent = n ? J(n, r) : this.getAttribute("placeholder") || "Select time", t.classList.toggle("timepicker-placeholder", !n), e?.classList.toggle("has-value", !!n);
3304
3386
  }
3305
3387
  _buildTimes() {
3306
- let e = Math.max(1, parseInt(this.getAttribute("step") || "30", 10)), t = this.getAttribute("min") || "00:00", n = this.getAttribute("max") || "23:59", r = Y(t) || {
3388
+ let e = Math.max(1, parseInt(this.getAttribute("step") || "30", 10)), t = this.getAttribute("min") || "00:00", n = this.getAttribute("max") || "23:59", r = q(t) || {
3307
3389
  h: 0,
3308
3390
  m: 0
3309
- }, i = Y(n) || {
3391
+ }, i = q(n) || {
3310
3392
  h: 23,
3311
3393
  m: 59
3312
3394
  }, a = [], o = r.h, s = r.m;
@@ -3319,10 +3401,10 @@ var V = class extends HTMLElement {
3319
3401
  _renderOptions() {
3320
3402
  let e = this.querySelector(".timepicker-pop");
3321
3403
  if (!e) return;
3322
- let t = this.getAttribute("format") || "24", n = this._buildTimes(), r = Y(this._value), i = this._focus, a = "";
3404
+ let t = this.getAttribute("format") || "24", n = this._buildTimes(), r = q(this._value), i = this._focus, a = "";
3323
3405
  for (let e = 0; e < n.length; e++) {
3324
- let o = n[e], s = pe(o.h, o.m), c = r && r.h === o.h && r.m === o.m;
3325
- a += `<button type="button" class="timepicker-option${c ? " is-selected" : ""}" data-hm="${s}" role="option" tabindex="${i === e ? "0" : "-1"}"${c ? " aria-selected=\"true\"" : ""}>${X(o, t)}</button>`;
3406
+ let o = n[e], s = K(o.h, o.m), c = r && r.h === o.h && r.m === o.m;
3407
+ a += `<button type="button" class="timepicker-option${c ? " is-selected" : ""}" data-hm="${s}" role="option" tabindex="${i === e ? "0" : "-1"}"${c ? " aria-selected=\"true\"" : ""}>${J(o, t)}</button>`;
3326
3408
  }
3327
3409
  e.innerHTML = a, this._focusActive();
3328
3410
  }
@@ -3348,6 +3430,26 @@ var V = class extends HTMLElement {
3348
3430
  this._focus = n, this._renderOptions();
3349
3431
  break;
3350
3432
  }
3433
+ case "Home":
3434
+ if (e.preventDefault(), !t.length) return;
3435
+ this._focus = 0, this._renderOptions();
3436
+ break;
3437
+ case "End":
3438
+ if (e.preventDefault(), !t.length) return;
3439
+ this._focus = t.length - 1, this._renderOptions();
3440
+ break;
3441
+ case "PageUp": {
3442
+ if (e.preventDefault(), !t.length) return;
3443
+ let n = this._focus == null || this._focus < 0 ? 0 : this._focus;
3444
+ this._focus = Math.max(n - 8, 0), this._renderOptions();
3445
+ break;
3446
+ }
3447
+ case "PageDown": {
3448
+ if (e.preventDefault(), !t.length) return;
3449
+ let n = this._focus == null || this._focus < 0 ? 0 : this._focus;
3450
+ this._focus = Math.min(n + 8, t.length - 1), this._renderOptions();
3451
+ break;
3452
+ }
3351
3453
  case "Enter":
3352
3454
  case " ":
3353
3455
  e.preventDefault(), t[this._focus] && (this.value = t[this._focus].dataset.hm, this.dispatchEvent(new Event("change", { bubbles: !0 })), this._close());
@@ -3355,7 +3457,13 @@ var V = class extends HTMLElement {
3355
3457
  case "Escape":
3356
3458
  this._close();
3357
3459
  break;
3358
- default:
3460
+ default: if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
3461
+ e.preventDefault(), clearTimeout(this._typeaheadTimer), this._typeahead += e.key.toLowerCase(), this._typeaheadTimer = setTimeout(() => {
3462
+ this._typeahead = "", this._typeaheadTimer = null;
3463
+ }, 500);
3464
+ let n = t.findIndex((e) => e.textContent.trim().toLowerCase().startsWith(this._typeahead));
3465
+ n >= 0 && (this._focus = n, this._renderOptions());
3466
+ }
3359
3467
  }
3360
3468
  }
3361
3469
  _wire() {
@@ -3368,7 +3476,7 @@ var V = class extends HTMLElement {
3368
3476
  let n = t.querySelector(".is-selected");
3369
3477
  n ? this._focus = [...t.querySelectorAll(".timepicker-option")].indexOf(n) : this._focus = 0, this._renderOptions(), t.querySelector("[tabindex=\"0\"]")?.focus();
3370
3478
  }, this._close = () => {
3371
- t.hidden = !0, e.setAttribute("aria-expanded", "false"), e.focus();
3479
+ t.hidden = !0, e.setAttribute("aria-expanded", "false"), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "", e.focus();
3372
3480
  }, e.addEventListener("click", () => n() ? this._close() : this._open()), e.addEventListener("keydown", (e) => {
3373
3481
  (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), n() || this._open());
3374
3482
  }), t.addEventListener("click", (e) => {
@@ -3389,19 +3497,199 @@ var V = class extends HTMLElement {
3389
3497
  }, this._bindGlobal(), this._syncFormValue();
3390
3498
  }
3391
3499
  _teardown() {
3392
- this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), this._onDocKey &&= (document.removeEventListener("keydown", this._onDocKey), null), o(this);
3500
+ this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), this._onDocKey &&= (document.removeEventListener("keydown", this._onDocKey), null), o(this), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
3501
+ }
3502
+ disconnectedCallback() {
3503
+ this._teardown();
3504
+ }
3505
+ }, le = "wui-wizard-step", X = class extends HTMLElement {
3506
+ static get observedAttributes() {
3507
+ return [
3508
+ "active",
3509
+ "variant",
3510
+ "orientation",
3511
+ "non-linear",
3512
+ "hide-stepper",
3513
+ "disabled",
3514
+ "label",
3515
+ "back-label",
3516
+ "next-label",
3517
+ "skip-label",
3518
+ "finish-label"
3519
+ ];
3520
+ }
3521
+ constructor() {
3522
+ super(), this._active = 0, this._skipped = /* @__PURE__ */ new Set(), this._invalid = /* @__PURE__ */ new Set(), this._finished = !1, this._rendered = !1, this._reflecting = !1, this._beforeNext = null, this._header = null, this._footer = null;
3523
+ }
3524
+ get active() {
3525
+ return this._active;
3526
+ }
3527
+ set active(e) {
3528
+ let t = Number.parseInt(e, 10);
3529
+ Number.isFinite(t) && this._go(t, "set");
3530
+ }
3531
+ get beforeNext() {
3532
+ return this._beforeNext;
3533
+ }
3534
+ set beforeNext(e) {
3535
+ this._beforeNext = typeof e == "function" ? e : null;
3536
+ }
3537
+ get _steps() {
3538
+ return [...this.querySelectorAll(`:scope > ${le}`)];
3539
+ }
3540
+ refresh() {
3541
+ this._rendered && this._renderChrome();
3542
+ }
3543
+ connectedCallback() {
3544
+ if (this._rendered) this._wire();
3545
+ else {
3546
+ let e = Number.parseInt(this.getAttribute("active"), 10);
3547
+ this._active = Number.isFinite(e) && e >= 0 ? e : 0, this.render();
3548
+ }
3393
3549
  }
3394
3550
  disconnectedCallback() {
3395
3551
  this._teardown();
3396
3552
  }
3397
- }, he = "image/png,image/jpeg,image/webp", ge = 5, _e = {
3553
+ attributeChangedCallback(e, t, n) {
3554
+ if (!(!this._rendered || this._reflecting)) {
3555
+ if (e === "active") {
3556
+ let e = Number.parseInt(n, 10);
3557
+ Number.isFinite(e) && e !== this._active && this._go(e, "set");
3558
+ return;
3559
+ }
3560
+ this._renderChrome();
3561
+ }
3562
+ }
3563
+ render() {
3564
+ let e = this._steps;
3565
+ this._header || (this._header = document.createElement("nav"), this._header.className = "stepper wizard-stepper", this._footer = document.createElement("div"), this._footer.className = "form-actions wizard-footer form-actions-between", e.length ? (this.insertBefore(this._header, e[0]), e[e.length - 1].after(this._footer)) : (this.prepend(this._header), this.append(this._footer))), this._renderChrome(), this._rendered = !0, this._wire();
3566
+ }
3567
+ _renderChrome() {
3568
+ let e = this._steps;
3569
+ this._clampActive(e), this._syncPanels(e), this._header.innerHTML = this._headerHtml(e), this._footer.innerHTML = this._footerHtml(e), this._header.hidden = this.hasAttribute("hide-stepper");
3570
+ }
3571
+ _clampActive(e) {
3572
+ let t = Math.max(0, e.length - 1);
3573
+ this._active > t && (this._active = t), this._active < 0 && (this._active = 0);
3574
+ }
3575
+ _syncPanels(e) {
3576
+ e.forEach((e, t) => {
3577
+ let n = t === this._active;
3578
+ e.classList.add("wizard-panel"), e.hidden = !n, e.setAttribute("role", "tabpanel"), e.setAttribute("aria-hidden", n ? "false" : "true");
3579
+ });
3580
+ }
3581
+ _stepStatus(e, t) {
3582
+ return e.getAttribute("status") || (this._invalid.has(t) ? "error" : this._finished ? "done" : t === this._active ? "active" : t < this._active ? this._skipped.has(t) ? "skipped" : "done" : "pending");
3583
+ }
3584
+ _headerHtml(e) {
3585
+ let t = this.getAttribute("variant") === "journey", n = this.getAttribute("variant") === "icons", r = this.getAttribute("orientation") === "vertical";
3586
+ this._header.className = [
3587
+ "stepper",
3588
+ "wizard-stepper",
3589
+ t && "stepper-journey",
3590
+ n && "stepper-icons",
3591
+ r && "stepper-vertical"
3592
+ ].filter(Boolean).join(" "), this._header.setAttribute("aria-label", this.getAttribute("label") || "Progress");
3593
+ let i = this.hasAttribute("non-linear");
3594
+ return e.map((e, r) => {
3595
+ let a = this._stepStatus(e, r), o = e.getAttribute("label") || "", s = e.getAttribute("description") || "", c = e.getAttribute("icon") || "", l = r + 1, u;
3596
+ u = a === "done" ? "<i class=\"bi bi-check-lg\" aria-hidden=\"true\"></i>" : a === "error" ? "<i class=\"bi bi-exclamation-triangle\" aria-hidden=\"true\"></i>" : a === "skipped" ? "<i class=\"bi bi-dash-lg\" aria-hidden=\"true\"></i>" : c ? `<i class="bi bi-${ue(c)}" aria-hidden="true"></i>` : String(l);
3597
+ let d = a === "pending" ? "step" : `step ${a}`, f = a === "active" ? " aria-current=\"step\"" : "", p = i || r < this._active, m = s ? `<span class="step-desc">${Z(s)}</span>` : "", h;
3598
+ return h = t ? `<span class="step-circle">${u}</span><span class="step-text"><span class="step-index">Step ${l}</span><span class="step-label">${Z(o)}</span>${m}</span>` : n ? `<span class="step-circle">${u}</span><span class="step-index">Step ${l}</span><span class="step-label">${Z(o)}</span>${m}` : `<span class="step-circle">${u}</span><span class="step-label">${Z(o)}</span>${m}`, p ? `<button type="button" class="${d}" data-step="${r}"${f}>${h}</button>` : `<div class="${d}"${f}>${h}</div>`;
3599
+ }).join("");
3600
+ }
3601
+ _footerHtml(e) {
3602
+ let t = this._active, n = e.length - 1, r = this.hasAttribute("disabled") ? " disabled" : "", i = e[t]?.hasAttribute("optional"), a = this.getAttribute("back-label") || "Back", o = this.getAttribute("next-label") || "Next", s = this.getAttribute("skip-label") || "Skip", c = this.getAttribute("finish-label") || "Finish";
3603
+ return `${t > 0 ? `<button type="button" class="btn btn-ghost" data-nav="back"${r}>${Z(a)}</button>` : "<span></span>"}<span class="wizard-footer-actions">${i && t < n ? `<button type="button" class="btn btn-subtle" data-nav="skip"${r}>${Z(s)}</button>` : ""}${t < n ? `<button type="button" class="btn btn-primary" data-nav="next"${r}>${Z(o)}</button>` : `<button type="button" class="btn btn-primary" data-nav="finish"${r}>${Z(c)}</button>`}</span>`;
3604
+ }
3605
+ _wire() {
3606
+ this._teardown(), this._onHeaderClick = (e) => {
3607
+ let t = e.target.closest("[data-step]");
3608
+ t && this.contains(t) && this._stepTo(Number.parseInt(t.dataset.step, 10));
3609
+ }, this._onFooterClick = (e) => {
3610
+ let t = e.target.closest("[data-nav]");
3611
+ if (!t || !this.contains(t) || this.hasAttribute("disabled")) return;
3612
+ let n = t.dataset.nav;
3613
+ n === "back" ? this._back() : n === "skip" ? this._skip() : n === "next" ? this._next() : n === "finish" && this._finish();
3614
+ }, this._header.addEventListener("click", this._onHeaderClick), this._footer.addEventListener("click", this._onFooterClick);
3615
+ }
3616
+ _teardown() {
3617
+ this._header && this._onHeaderClick && this._header.removeEventListener("click", this._onHeaderClick), this._footer && this._onFooterClick && this._footer.removeEventListener("click", this._onFooterClick);
3618
+ }
3619
+ _stepTo(e) {
3620
+ this.hasAttribute("disabled") || !this.hasAttribute("non-linear") && e >= this._active || this._go(e, "step");
3621
+ }
3622
+ _back() {
3623
+ this._active > 0 && this._go(this._active - 1, "back");
3624
+ }
3625
+ async _next() {
3626
+ let e = this._active, t = this._steps;
3627
+ if (!this.dispatchEvent(new CustomEvent("wui-wizard:beforechange", {
3628
+ detail: {
3629
+ index: e,
3630
+ next: e + 1,
3631
+ reason: "next"
3632
+ },
3633
+ cancelable: !0
3634
+ }))) return this._flagInvalid(e);
3635
+ if (this._beforeNext) {
3636
+ let t;
3637
+ try {
3638
+ t = await this._beforeNext(e);
3639
+ } catch {
3640
+ t = !1;
3641
+ }
3642
+ if (t === !1) return this._flagInvalid(e);
3643
+ }
3644
+ if (this._invalid.delete(e), this._skipped.delete(e), e >= t.length - 1) return this._finish();
3645
+ this._go(e + 1, "next");
3646
+ }
3647
+ _skip() {
3648
+ let e = this._active, t = this._steps;
3649
+ if (t[e]?.hasAttribute("optional")) {
3650
+ if (this._invalid.delete(e), this._skipped.add(e), this.dispatchEvent(new CustomEvent("wui-wizard:skip", { detail: { index: e } })), e >= t.length - 1) return this._finish();
3651
+ this._go(e + 1, "skip");
3652
+ }
3653
+ }
3654
+ _flagInvalid(e) {
3655
+ this._invalid.add(e), this._renderChrome(), this.dispatchEvent(new CustomEvent("wui-wizard:invalid", { detail: { index: e } }));
3656
+ }
3657
+ _finish() {
3658
+ this._invalid.delete(this._active), this._finished = !0, this._renderChrome(), this.dispatchEvent(new CustomEvent("wui-wizard:finish", { detail: { index: this._active } }));
3659
+ }
3660
+ _go(e, t) {
3661
+ let n = this._steps, r = Math.max(0, n.length - 1), i = Math.min(Math.max(e, 0), r), a = this._active;
3662
+ this._finished = !1, this._invalid.delete(a), this._active = i, this._reflectActive(i), this._renderChrome(), t !== "silent" && i !== a && this.dispatchEvent(new CustomEvent("wui-wizard:change", { detail: {
3663
+ index: i,
3664
+ previous: a,
3665
+ reason: t
3666
+ } }));
3667
+ }
3668
+ _reflectActive(e) {
3669
+ this._reflecting = !0, this.setAttribute("active", String(e)), this._reflecting = !1;
3670
+ }
3671
+ }, Z = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), ue = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), de = class extends HTMLElement {
3672
+ static get observedAttributes() {
3673
+ return [
3674
+ "label",
3675
+ "description",
3676
+ "optional",
3677
+ "icon",
3678
+ "status"
3679
+ ];
3680
+ }
3681
+ attributeChangedCallback() {
3682
+ let e = this.closest("wui-wizard");
3683
+ e && typeof e.refresh == "function" && e.refresh();
3684
+ }
3685
+ }, fe = "image/png,image/jpeg,image/webp", pe = 5, me = {
3398
3686
  "image/png": [".png"],
3399
3687
  "image/jpeg": [".jpg", ".jpeg"],
3400
3688
  "image/webp": [".webp"],
3401
3689
  "image/gif": [".gif"],
3402
3690
  "image/svg+xml": [".svg"],
3403
3691
  "application/pdf": [".pdf"]
3404
- }, ve = {
3692
+ }, he = {
3405
3693
  "image/png": "PNG",
3406
3694
  "image/jpeg": "JPG",
3407
3695
  "image/webp": "WEBP",
@@ -3415,7 +3703,7 @@ var V = class extends HTMLElement {
3415
3703
  ".gif": "GIF",
3416
3704
  ".svg": "SVG",
3417
3705
  ".pdf": "PDF"
3418
- }, Z = (e) => String(e || "").split(",").map((e) => e.trim().toLowerCase()).filter(Boolean), ye = [
3706
+ }, Q = (e) => String(e || "").split(",").map((e) => e.trim().toLowerCase()).filter(Boolean), ge = [
3419
3707
  ".png",
3420
3708
  ".jpg",
3421
3709
  ".jpeg",
@@ -3426,44 +3714,44 @@ var V = class extends HTMLElement {
3426
3714
  ".avif",
3427
3715
  ".heic"
3428
3716
  ];
3429
- function be(e) {
3717
+ function _e(e) {
3430
3718
  if (!e) return !1;
3431
3719
  let t = typeof e == "object" && e.type ? String(e.type).toLowerCase() : "";
3432
3720
  if (t) return t.startsWith("image/");
3433
3721
  let n = typeof e == "string" ? e : e.name || e.url || "", r = String(n).toLowerCase();
3434
- return ye.some((e) => r.endsWith(e));
3722
+ return ge.some((e) => r.endsWith(e));
3435
3723
  }
3436
- function xe(e) {
3437
- let t = Z(e);
3438
- return t.length ? t.every((e) => e.startsWith(".") ? ye.includes(e) : e === "image/*" || e.startsWith("image/")) : !1;
3724
+ function ve(e) {
3725
+ let t = Q(e);
3726
+ return t.length ? t.every((e) => e.startsWith(".") ? ge.includes(e) : e === "image/*" || e.startsWith("image/")) : !1;
3439
3727
  }
3440
- function Se(e) {
3728
+ function ye(e) {
3441
3729
  let t = [];
3442
- for (let n of Z(e)) {
3443
- let e = ve[n] || (n.startsWith(".") ? n.slice(1).toUpperCase() : n.toUpperCase());
3730
+ for (let n of Q(e)) {
3731
+ let e = he[n] || (n.startsWith(".") ? n.slice(1).toUpperCase() : n.toUpperCase());
3444
3732
  t.includes(e) || t.push(e);
3445
3733
  }
3446
3734
  return t.length <= 1 ? t[0] || "supported" : `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
3447
3735
  }
3448
- function Ce(e, t) {
3449
- let n = Z(t);
3736
+ function be(e, t) {
3737
+ let n = Q(t);
3450
3738
  if (!n.length) return !0;
3451
3739
  let r = (e.type || "").toLowerCase(), i = (e.name || "").toLowerCase();
3452
- return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (_e[e] || []).some((e) => i.endsWith(e)));
3740
+ return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (me[e] || []).some((e) => i.endsWith(e)));
3453
3741
  }
3454
- function we(e, t = {}) {
3742
+ function xe(e, t = {}) {
3455
3743
  if (!e) return null;
3456
- let n = t.accept === void 0 ? he : t.accept, r = t.maxSizeMb || 5;
3457
- return Ce(e, n) ? e.size > r * 1024 * 1024 ? `Keep the file under ${r} MB.` : null : `Choose a ${Se(n)} file.`;
3744
+ let n = t.accept === void 0 ? fe : t.accept, r = t.maxSizeMb || 5;
3745
+ return be(e, n) ? e.size > r * 1024 * 1024 ? `Keep the file under ${r} MB.` : null : `Choose a ${ye(n)} file.`;
3458
3746
  }
3459
3747
  //#endregion
3460
3748
  //#region src/index.js
3461
- var Q = (e, t) => {
3749
+ var $ = (e, t) => {
3462
3750
  typeof customElements < "u" && !customElements.get(e) && customElements.define(e, t);
3463
3751
  };
3464
- function $() {
3465
- Q("wui-select", U), Q("wui-phone", V), Q("wui-datepicker", w), Q("wui-date-range", re), Q("wui-slider", G), Q("wui-timepicker", me), Q("wui-autocomplete", p), Q("wui-multiselect", ie), Q("wui-taginput", de), Q("wui-otp", j), Q("wui-status-icon", n);
3752
+ function Se() {
3753
+ $("wui-select", z), $("wui-phone", L), $("wui-datepicker", T), $("wui-date-range", ee), $("wui-slider", V), $("wui-timepicker", Y), $("wui-autocomplete", m), $("wui-multiselect", E), $("wui-taginput", U), $("wui-otp", k), $("wui-status-icon", n), $("wui-wizard-step", de), $("wui-wizard", X);
3466
3754
  }
3467
- $();
3755
+ Se();
3468
3756
  //#endregion
3469
- export { he as DEFAULT_IMAGE_ACCEPT, ge as DEFAULT_MAX_SIZE_MB, t as STATUS_TONES, p as WuiAutocomplete, w as WuiDatePicker, re as WuiDateRange, ie as WuiMultiSelect, j as WuiOtp, V as WuiPhone, U as WuiSelect, G as WuiSlider, n as WuiStatusIcon, de as WuiTagInput, me as WuiTimePicker, Se as acceptLabel, $ as defineWeborityElements, be as isImageFile, xe as isImageOnlyAccept, Ce as matchesAccept, we as validateFile };
3757
+ export { fe as DEFAULT_IMAGE_ACCEPT, pe as DEFAULT_MAX_SIZE_MB, t as STATUS_TONES, m as WuiAutocomplete, T as WuiDatePicker, ee as WuiDateRange, E as WuiMultiSelect, k as WuiOtp, L as WuiPhone, z as WuiSelect, V as WuiSlider, n as WuiStatusIcon, U as WuiTagInput, Y as WuiTimePicker, X as WuiWizard, de as WuiWizardStep, ye as acceptLabel, Se as defineWeborityElements, _e as isImageFile, ve as isImageOnlyAccept, be as matchesAccept, xe as validateFile };