@webority/ui-elements 0.7.8 → 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";
@@ -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,20 +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 = () => {
266
+ }, u = () => {
236
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();
237
- }, u = (t) => {
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
- }, f = () => {
278
+ })), u();
279
+ }, p = () => {
249
280
  let t = e.input.value;
250
281
  if (e.clear && (e.clear.hidden = !t), o() || s(), this._remote) {
251
282
  if (this._renderOptions(t), clearTimeout(this._timer), t.trim().length < this._minChars) {
@@ -258,42 +289,43 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
258
289
  seq: e
259
290
  }, this._timer = setTimeout(() => this._fireSearch(t, e), this._debounceMs);
260
291
  } else this._renderOptions(t);
261
- }, p = () => {
262
- clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
263
- }, m = (t) => {
264
- let i = n(), a = t.target?.tagName === "INPUT" || t.target?.tagName === "TEXTAREA";
265
- if (t.key === "ArrowDown") t.preventDefault(), o() || s(), r(Math.min(this._active + 1, i.length - 1));
266
- else if (t.key === "ArrowUp") t.preventDefault(), r(Math.max(this._active - 1, 0));
267
- else if (t.key === "Home" && o() && !a) t.preventDefault(), i.length && r(0);
268
- else if (t.key === "End" && o() && !a) t.preventDefault(), i.length && r(i.length - 1);
269
- else if (t.key === "PageDown" && o() && !a) {
270
- if (t.preventDefault(), !i.length) return;
271
- let e = this._active < 0 ? 0 : this._active;
272
- r(Math.min(e + 8, i.length - 1));
273
- } else if (t.key === "PageUp" && o() && !a) {
274
- if (t.preventDefault(), !i.length) return;
275
- let e = this._active < 0 ? 0 : this._active;
276
- r(Math.max(e - 8, 0));
277
- } else if (t.key === "Enter") {
278
- 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]);
279
299
  else if (this._allowCustom) {
280
- let n = e.input.value.trim();
281
- n && !this._matchesKnownOption(n) && (t.preventDefault(), d(n));
300
+ let t = e.input.value.trim();
301
+ t && !this._matchesKnownOption(t) && f(t);
282
302
  }
283
- } else if (t.key === "Escape") l();
284
- else if (o() && t.key.length === 1 && !t.ctrlKey && !t.metaKey && !t.altKey && t.target?.tagName !== "INPUT" && t.target?.tagName !== "TEXTAREA") {
285
- t.preventDefault(), clearTimeout(this._typeaheadTimer), this._typeahead += t.key.toLowerCase(), this._typeaheadTimer = setTimeout(p, 500);
286
- let e = i.findIndex((e) => e.textContent.trim().toLowerCase().startsWith(this._typeahead));
287
- e >= 0 && r(e);
303
+ },
304
+ onEscape: () => {
305
+ this._navHandler.clearTypeahead(), u();
288
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);
289
321
  };
290
- e.input.addEventListener("focus", () => s()), e.input.addEventListener("input", f), e.input.addEventListener("keydown", m), e.menu.addEventListener("keydown", m), e.input.addEventListener("blur", (t) => {
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) => {
291
323
  if (!this._allowCustom || t.relatedTarget && this.contains(t.relatedTarget)) return;
292
324
  let n = e.input.value.trim();
293
- !n || n === this._label || this._matchesKnownOption(n) || d(n);
325
+ !n || n === this._label || this._matchesKnownOption(n) || f(n);
294
326
  }), e.optionsWrap.addEventListener("click", (e) => {
295
327
  let t = e.target.closest(".search-select-option");
296
- t && u(t);
328
+ t && d(t);
297
329
  }), e.optionsWrap.addEventListener("mousemove", (e) => {
298
330
  let t = e.target.closest(".search-select-option");
299
331
  t && r(this._optionEls().indexOf(t));
@@ -301,7 +333,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
301
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();
302
334
  }), this._bindGlobal = () => {
303
335
  this._teardown(), this._onDocClick = (e) => {
304
- o() && !this.contains(e.target) && l();
336
+ o() && !this.contains(e.target) && u();
305
337
  }, document.addEventListener("click", this._onDocClick), a(this, () => {
306
338
  o() && t();
307
339
  });
@@ -317,12 +349,12 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
317
349
  }));
318
350
  }
319
351
  _teardown() {
320
- this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), o(this), clearTimeout(this._timer), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
352
+ this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), o(this), clearTimeout(this._timer), this._navHandler?.teardown();
321
353
  }
322
354
  disconnectedCallback() {
323
355
  this._teardown();
324
356
  }
325
- }, 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, ""), _ = [
326
358
  "January",
327
359
  "February",
328
360
  "March",
@@ -335,7 +367,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
335
367
  "October",
336
368
  "November",
337
369
  "December"
338
- ], _ = [
370
+ ], v = [
339
371
  "Su",
340
372
  "Mo",
341
373
  "Tu",
@@ -343,24 +375,24 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
343
375
  "Th",
344
376
  "Fr",
345
377
  "Sa"
346
- ], 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) => {
347
379
  let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e || "");
348
380
  return t ? {
349
381
  y: +t[1],
350
382
  m: t[2] - 1,
351
383
  d: +t[3]
352
384
  } : null;
353
- }, x = (e) => {
354
- let t = b(e);
355
- return t ? `${v(t.d)} ${g[t.m].slice(0, 3)} ${t.y}` : "";
356
- }, 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) => {
357
389
  for (; t < 0;) t += 12, --e;
358
390
  for (; t > 11;) t -= 12, e += 1;
359
391
  return {
360
392
  y: e,
361
393
  m: t
362
394
  };
363
- }, ee = class extends HTMLElement {
395
+ }, T = class extends HTMLElement {
364
396
  static formAssociated = !0;
365
397
  static get observedAttributes() {
366
398
  return [
@@ -411,13 +443,13 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
411
443
  }
412
444
  render() {
413
445
  this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "", this._value = this._defaultValue || this._value);
414
- let e = this.getAttribute("placeholder") || "Enter Date", t = b(this._value);
446
+ let e = this.getAttribute("placeholder") || "Enter Date", t = x(this._value);
415
447
  t && (this._viewY = t.y, this._viewM = t.m);
416
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");
417
449
  this.innerHTML = `
418
450
  <div class="datepicker">
419
- <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)}"` : ""}>
420
- <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>
421
453
  <i class="bi bi-calendar3" aria-hidden="true"></i>
422
454
  </button>
423
455
  <div class="datepicker-pop" role="dialog" aria-modal="false" hidden></div>
@@ -429,11 +461,11 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
429
461
  _syncTrigger() {
430
462
  let e = this.querySelector(".datepicker-trigger"), t = this.querySelector("[data-trigger-label]");
431
463
  if (!t) return;
432
- let n = b(this._value);
433
- 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);
434
466
  }
435
467
  _limits() {
436
- 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;
437
469
  return {
438
470
  dayDisabled: (e, t, i) => {
439
471
  let a = new Date(e, t, i).getTime();
@@ -441,7 +473,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
441
473
  },
442
474
  monthDisabled: (e, t) => {
443
475
  let i = new Date(e, t, 1).getTime();
444
- 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;
445
477
  },
446
478
  yearDisabled: (e) => {
447
479
  let t = new Date(e, 0, 1).getTime();
@@ -454,28 +486,28 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
454
486
  e && (this._mode === "months" ? e.innerHTML = this._monthsHtml() : this._mode === "years" ? e.innerHTML = this._yearsHtml() : e.innerHTML = this._daysHtml(), this._focusActive());
455
487
  }
456
488
  _daysHtml() {
457
- 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 || {
458
490
  y: this._viewY,
459
491
  m: this._viewM,
460
492
  d: 1
461
493
  }, s = (e, t, n, s) => {
462
- 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);
463
495
  return `<button type="button" class="${[
464
496
  "datepicker-day",
465
497
  s ? "is-outside" : "",
466
498
  u ? "is-today" : "",
467
499
  l ? "is-selected" : ""
468
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>`;
469
- }, 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);
470
502
  for (let e = t - 1; e >= 0; e--) c += s(l.y, l.m, u - e, !0);
471
503
  for (let e = 1; e <= n; e++) c += s(this._viewY, this._viewM, e, !1);
472
- 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;
473
505
  for (let e = 1; e <= f; e++) c += s(d.y, d.m, e, !0);
474
- 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("");
475
507
  return `
476
508
  <div class="datepicker-head">
477
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>
478
- <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>
479
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>
480
512
  </div>
481
513
  <div class="datepicker-weekdays">${p}</div>
@@ -486,14 +518,14 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
486
518
  </div>`;
487
519
  }
488
520
  _monthsHtml() {
489
- 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 = "";
490
522
  for (let i = 0; i < 12; i++) {
491
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 = [
492
524
  "datepicker-cell",
493
525
  o ? "is-today" : "",
494
526
  a ? "is-selected" : ""
495
527
  ].filter(Boolean).join(" ");
496
- 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>`;
497
529
  }
498
530
  return `
499
531
  <div class="datepicker-head">
@@ -504,7 +536,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
504
536
  <div class="datepicker-cells">${r}</div>`;
505
537
  }
506
538
  _yearsHtml() {
507
- 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 = "";
508
540
  for (let a = 0; a < 12; a++) {
509
541
  let o = r + a, s = e && e.y === o, c = t === o, l = n(o), u = [
510
542
  "datepicker-cell",
@@ -529,21 +561,21 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
529
561
  i(e, t);
530
562
  }
531
563
  _setFocus(e, t, n, r) {
532
- let { y: i, m: a } = C(e, t);
564
+ let { y: i, m: a } = w(e, t);
533
565
  this._focus = {
534
566
  y: i,
535
567
  m: a,
536
568
  d: n
537
569
  };
538
570
  let o = i !== this._viewY || a !== this._viewM;
539
- 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();
540
572
  }
541
573
  _onKey(e) {
542
574
  if (this._mode !== "days") {
543
575
  e.key === "Escape" && this._close();
544
576
  return;
545
577
  }
546
- let t = this._focus || b(this._value) || {
578
+ let t = this._focus || x(this._value) || {
547
579
  y: this._viewY,
548
580
  m: this._viewM,
549
581
  d: 1
@@ -561,17 +593,17 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
561
593
  case "End": return n(6 - (new Date(t.y, t.m, t.d).getDay() - this._firstDay() + 7) % 7, "slide-next");
562
594
  case "PageUp": {
563
595
  e.preventDefault();
564
- let n = C(t.y, t.m - (e.shiftKey ? 12 : 1));
565
- 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");
566
598
  }
567
599
  case "PageDown": {
568
600
  e.preventDefault();
569
- let n = C(t.y, t.m + (e.shiftKey ? 12 : 1));
570
- 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");
571
603
  }
572
604
  case "Enter":
573
605
  case " ":
574
- 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());
575
607
  return;
576
608
  case "Escape": return this._close();
577
609
  default:
@@ -583,11 +615,11 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
583
615
  if (!e || !t) return;
584
616
  let r = () => !t.hidden;
585
617
  this._open = () => {
586
- if (!b(this._value) && !this._viewNavigated) {
618
+ if (!x(this._value) && !this._viewNavigated) {
587
619
  let e = /* @__PURE__ */ new Date();
588
620
  this._viewY = e.getFullYear(), this._viewM = e.getMonth();
589
621
  }
590
- let r = b(this._value), i = /* @__PURE__ */ new Date();
622
+ let r = x(this._value), i = /* @__PURE__ */ new Date();
591
623
  this._mode = "days", this._focus = r || {
592
624
  y: this._viewY,
593
625
  m: this._viewM,
@@ -600,7 +632,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
600
632
  let t = e.target.closest("[data-nav]");
601
633
  if (t) {
602
634
  this._viewNavigated = !0, this._slide = Number(t.dataset.nav) < 0 ? "slide-prev" : "slide-next";
603
- let e = C(this._viewY, this._viewM + Number(t.dataset.nav));
635
+ let e = w(this._viewY, this._viewM + Number(t.dataset.nav));
604
636
  this._viewY = e.y, this._viewM = e.m, this._focus = {
605
637
  y: e.y,
606
638
  m: e.m,
@@ -639,7 +671,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
639
671
  }
640
672
  if (e.target.closest("[data-today]")) {
641
673
  let e = /* @__PURE__ */ new Date();
642
- 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();
643
675
  return;
644
676
  }
645
677
  if (e.target.closest("[data-clear]")) {
@@ -667,45 +699,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
667
699
  disconnectedCallback() {
668
700
  this._teardown();
669
701
  }
670
- }, w = [
671
- "January",
672
- "February",
673
- "March",
674
- "April",
675
- "May",
676
- "June",
677
- "July",
678
- "August",
679
- "September",
680
- "October",
681
- "November",
682
- "December"
683
- ], T = [
684
- "Su",
685
- "Mo",
686
- "Tu",
687
- "We",
688
- "Th",
689
- "Fr",
690
- "Sa"
691
- ], E = (e) => String(e).padStart(2, "0"), te = (e, t, n) => `${e}-${E(t + 1)}-${E(n)}`, D = (e) => {
692
- let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e || "");
693
- return t ? {
694
- y: +t[1],
695
- m: t[2] - 1,
696
- d: +t[3]
697
- } : null;
698
- }, O = (e) => {
699
- let t = D(e);
700
- return t ? `${E(t.d)} ${w[t.m].slice(0, 3)} ${t.y}` : "";
701
- }, k = (e, t) => new Date(e, t + 1, 0).getDate(), A = (e, t) => {
702
- for (; t < 0;) t += 12, --e;
703
- for (; t > 11;) t -= 12, e += 1;
704
- return {
705
- y: e,
706
- m: t
707
- };
708
- }, j = class extends HTMLElement {
702
+ }, ee = class extends HTMLElement {
709
703
  static formAssociated = !0;
710
704
  static get observedAttributes() {
711
705
  return [
@@ -764,19 +758,19 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
764
758
  text: e,
765
759
  empty: !0
766
760
  } : {
767
- text: `${O(this._start) || "Start"} – ${O(this._end) || "End"}`,
761
+ text: `${S(this._start) || "Start"} – ${S(this._end) || "End"}`,
768
762
  empty: !1
769
763
  };
770
764
  }
771
765
  render() {
772
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);
773
- let e = D(this._start);
767
+ let e = x(this._start);
774
768
  e && (this._viewY = e.y, this._viewM = e.m);
775
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");
776
770
  this.innerHTML = `
777
771
  <div class="daterange">
778
- <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)}"` : ""}>
779
- <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>
780
774
  <i class="bi bi-calendar-range" aria-hidden="true"></i>
781
775
  </button>
782
776
  <div class="daterange-pop" role="dialog" aria-modal="false" hidden></div>
@@ -804,24 +798,24 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
804
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");
805
799
  }
806
800
  _limits() {
807
- let e = D(this.getAttribute("min")), t = D(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;
808
802
  return (e, t, i) => {
809
803
  let a = new Date(e, t, i).getTime();
810
804
  return a < n || a > r;
811
805
  };
812
806
  }
813
807
  _monthHtml(e, t) {
814
- let n = this._firstDay(), r = (new Date(e, t, 1).getDay() - n + 7) % 7, i = k(e, t), a = this._limits(), o = T.map((e, t) => T[(t + n) % 7]).map((e) => `<span>${e}</span>`).join(""), s = (e, t, n, r) => {
815
- let i = te(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);
816
810
  return `<button type="button" class="${["datepicker-day", r ? "is-outside" : ""].filter(Boolean).join(" ")}" data-iso="${i}"${o ? " disabled" : ""}>${n}</button>`;
817
- }, c = "", l = A(e, t - 1), u = k(l.y, l.m);
811
+ }, c = "", l = w(e, t - 1), u = C(l.y, l.m);
818
812
  for (let e = r - 1; e >= 0; e--) c += s(l.y, l.m, u - e, !0);
819
813
  for (let n = 1; n <= i; n++) c += s(e, t, n, !1);
820
- let d = A(e, t + 1), f = (7 - (r + i) % 7) % 7;
814
+ let d = w(e, t + 1), f = (7 - (r + i) % 7) % 7;
821
815
  for (let e = 1; e <= f; e++) c += s(d.y, d.m, e, !0);
822
816
  return `
823
817
  <div class="daterange-cal">
824
- <div class="datepicker-month-label">${w[t]} ${e}</div>
818
+ <div class="datepicker-month-label">${_[t]} ${e}</div>
825
819
  <div class="datepicker-weekdays">${o}</div>
826
820
  <div class="datepicker-grid" role="grid">${c}</div>
827
821
  </div>`;
@@ -829,7 +823,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
829
823
  _renderView() {
830
824
  let e = this.querySelector(".daterange-pop");
831
825
  if (!e) return;
832
- let t = A(this._viewY, this._viewM + 1);
826
+ let t = w(this._viewY, this._viewM + 1);
833
827
  e.innerHTML = `
834
828
  <div class="daterange-head">
835
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>
@@ -855,7 +849,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
855
849
  n.classList.toggle("is-range-start", i), n.classList.toggle("is-range-end", a), n.classList.toggle("in-range", o);
856
850
  }
857
851
  let i = e.querySelector("[data-range-hint]");
858
- i && (i.textContent = this._start ? this._end ? `${O(this._start)} – ${O(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");
859
853
  }
860
854
  _position(e, t) {
861
855
  i(e, t);
@@ -877,7 +871,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
877
871
  if (!e || !t) return;
878
872
  let r = () => !t.hidden;
879
873
  this._open = () => {
880
- let r = D(this._start);
874
+ let r = x(this._start);
881
875
  if (r) this._viewY = r.y, this._viewM = r.m;
882
876
  else {
883
877
  let e = /* @__PURE__ */ new Date();
@@ -890,7 +884,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
890
884
  this._popClick = !0;
891
885
  let t = e.target.closest("[data-nav]");
892
886
  if (t) {
893
- let e = A(this._viewY, this._viewM + Number(t.dataset.nav));
887
+ let e = w(this._viewY, this._viewM + Number(t.dataset.nav));
894
888
  this._viewY = e.y, this._viewM = e.m, this._renderView();
895
889
  return;
896
890
  }
@@ -920,7 +914,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
920
914
  disconnectedCallback() {
921
915
  this._teardown();
922
916
  }
923
- }, ne = class extends HTMLElement {
917
+ }, E = class extends HTMLElement {
924
918
  static formAssociated = !0;
925
919
  _accessibleName() {
926
920
  return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
@@ -989,7 +983,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
989
983
  value: e.getAttribute("value") ?? e.textContent.trim(),
990
984
  label: e.innerHTML,
991
985
  icon: e.getAttribute("icon") || void 0,
992
- [l]: !0,
986
+ [u]: !0,
993
987
  selected: e.hasAttribute("selected")
994
988
  })));
995
989
  }
@@ -1002,7 +996,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
1002
996
  }
1003
997
  _labelHtmlFor(e) {
1004
998
  let t = this._readOptions().find((t) => String(t.value) === String(e));
1005
- return t ? f(t) : u(e);
999
+ return t ? p(t) : d(e);
1006
1000
  }
1007
1001
  render() {
1008
1002
  this._snapshotDeclared();
@@ -1011,13 +1005,13 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
1011
1005
  let a = `${this.id}-listbox`;
1012
1006
  this._listboxId = a, this.innerHTML = `
1013
1007
  <div class="search-select${i}">
1014
- <div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${M(a)}" aria-label="${M(this._accessibleName())}"${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : " tabindex=\"0\""}>
1015
- ${n ? `<i class="bi bi-${M(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>` : ""}
1016
1010
  <div class="ms-chips" data-chips></div>
1017
1011
  <i class="bi bi-chevron-down search-select-caret" aria-hidden="true"></i>
1018
1012
  </div>
1019
- <div class="search-select-menu search-select-menu-fixed" role="listbox" id="${M(a)}" aria-multiselectable="true" tabindex="-1" hidden>
1020
- ${e ? `<div class="search-select-search"><i class="bi bi-search" aria-hidden="true"></i><input class="search-select-input" placeholder="${M(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>` : ""}
1021
1015
  <div class="search-select-options"></div>
1022
1016
  <div class="search-select-empty" hidden>No matches</div>
1023
1017
  </div>
@@ -1028,10 +1022,10 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
1028
1022
  if (!e) return;
1029
1023
  let t = this.getAttribute("placeholder") || "Select…";
1030
1024
  if (!this._values.length) {
1031
- e.innerHTML = `<span class="search-select-placeholder">${u(t)}</span>`;
1025
+ e.innerHTML = `<span class="search-select-placeholder">${d(t)}</span>`;
1032
1026
  return;
1033
1027
  }
1034
- 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="${M(e)}" aria-label="Remove ${M(re(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();
1035
1029
  }
1036
1030
  _collapseChips() {
1037
1031
  let e = this.querySelector("[data-chips]");
@@ -1055,99 +1049,91 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
1055
1049
  let t = this.querySelector(".search-select-options"), n = this.querySelector(".search-select-empty");
1056
1050
  if (!t) return;
1057
1051
  let r = (e || "").trim().toLowerCase(), i = this._readOptions();
1058
- r && (i = i.filter((e) => re(e.label).toLowerCase().includes(r)));
1052
+ r && (i = i.filter((e) => O(e.label).toLowerCase().includes(r)));
1059
1053
  let a = this._listboxId || `${this.id || "wui-multiselect"}-listbox`;
1060
1054
  t.innerHTML = i.map((e, t) => {
1061
1055
  let n = this._values.includes(String(e.value));
1062
- return `<button type="button" role="option" id="${M(`${a}-opt-${t}`)}" class="search-select-option${n ? " selected" : ""}" data-value="${M(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>`;
1063
1057
  }).join(""), n && (n.hidden = i.length > 0), this._active = -1, this.querySelector(".search-select-control")?.removeAttribute("aria-activedescendant");
1064
1058
  }
1065
1059
  _wire() {
1066
1060
  this._teardown();
1067
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");
1068
1062
  if (!e || !t) return;
1069
- 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) => {
1070
- 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();
1071
1065
  this._active = t;
1072
- for (let e of u()) e.classList.remove("is-active");
1066
+ for (let e of d()) e.classList.remove("is-active");
1073
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");
1074
- }, p = () => !t.hidden, m = () => {
1075
- s() || (t.hidden = !1, e.setAttribute("aria-expanded", "true"), e.classList.add("open"), l(), n && (n.value = "", this._renderOptions(""), n.focus()));
1076
- }, h = () => {
1077
- t.hidden = !0, e.setAttribute("aria-expanded", "false"), e.classList.remove("open"), f(-1), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
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()));
1078
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
+ }, _ = () => {
1079
1073
  c(this, this._values.join(",")), this.dispatchEvent(new Event("change", { bubbles: !0 }));
1080
- }, _ = (e) => {
1081
- let t = String(e);
1082
- 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();
1083
1074
  }, v = (e) => {
1084
- 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 : ""), _();
1085
1079
  };
1086
1080
  e.addEventListener("click", (e) => {
1087
1081
  if (s()) return;
1088
1082
  let t = e.target.closest("[data-remove]");
1089
1083
  if (t) {
1090
- e.stopPropagation(), v(t.dataset.remove);
1084
+ e.stopPropagation(), y(t.dataset.remove);
1091
1085
  return;
1092
1086
  }
1093
- p() ? h() : m();
1087
+ m() ? g() : h();
1094
1088
  }), o.addEventListener("click", (e) => {
1095
1089
  let t = e.target.closest(".search-select-option");
1096
- t && (_(t.dataset.value), n?.focus());
1090
+ t && (v(t.dataset.value), n?.focus());
1097
1091
  }), o.addEventListener("mousemove", (e) => {
1098
1092
  let t = e.target.closest(".search-select-option");
1099
- t && f(d().indexOf(t));
1100
- }), o.addEventListener("mouseleave", () => f(-1)), n?.addEventListener("input", () => {
1101
- 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
+ }
1102
1106
  });
1103
- let y = () => {
1104
- clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
1105
- }, b = (t) => {
1106
- let r = d(), i = t.target?.tagName === "INPUT" || t.target?.tagName === "TEXTAREA";
1107
- if (t.key === "ArrowDown") t.preventDefault(), f(Math.min(this._active + 1, r.length - 1));
1108
- else if (t.key === "ArrowUp") t.preventDefault(), f(Math.max(this._active - 1, 0));
1109
- else if (t.key === "Home" && !i) t.preventDefault(), r.length && f(0);
1110
- else if (t.key === "End" && !i) t.preventDefault(), r.length && f(r.length - 1);
1111
- else if (t.key === "PageDown" && !i) {
1112
- if (t.preventDefault(), !r.length) return;
1113
- let e = this._active < 0 ? 0 : this._active;
1114
- f(Math.min(e + 8, r.length - 1));
1115
- } else if (t.key === "PageUp" && !i) {
1116
- if (t.preventDefault(), !r.length) return;
1117
- let e = this._active < 0 ? 0 : this._active;
1118
- f(Math.max(e - 8, 0));
1119
- } else if (t.key === "Enter") t.preventDefault(), r[this._active] && _(r[this._active].dataset.value);
1120
- else if (t.key === "Escape") h(), e.focus();
1121
- else if (t.key === "Backspace" && !n?.value && this._values.length) v(this._values[this._values.length - 1]);
1122
- else if (t.key.length === 1 && !t.ctrlKey && !t.metaKey && !t.altKey && t.target?.tagName !== "INPUT" && t.target?.tagName !== "TEXTAREA") {
1123
- t.preventDefault(), clearTimeout(this._typeaheadTimer), this._typeahead += t.key.toLowerCase(), this._typeaheadTimer = setTimeout(y, 500);
1124
- let e = r.findIndex((e) => e.textContent.trim().toLowerCase().startsWith(this._typeahead));
1125
- e >= 0 && f(e);
1107
+ let b = (e) => {
1108
+ if (e.key === "Backspace" && !n?.value && this._values.length) {
1109
+ y(this._values[this._values.length - 1]);
1110
+ return;
1126
1111
  }
1112
+ this._navHandler.handler(e);
1127
1113
  };
1128
1114
  n?.addEventListener("keydown", b), r?.addEventListener("click", () => {
1129
1115
  n.value = "", this._renderOptions(""), r.hidden = !0, n.focus();
1130
1116
  }), e.addEventListener("keydown", (e) => {
1131
- if (p()) {
1117
+ if (m()) {
1132
1118
  b(e);
1133
1119
  return;
1134
1120
  }
1135
- (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), m());
1121
+ (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), h());
1136
1122
  }), this._bindGlobal = () => {
1137
1123
  this._teardown(), !this._ro && typeof ResizeObserver < "u" && (this._ro = new ResizeObserver(() => this._collapseChips()), this._ro.observe(this)), this._onDocClick = (e) => {
1138
- p() && !this.contains(e.target) && h();
1124
+ m() && !this.contains(e.target) && g();
1139
1125
  }, document.addEventListener("click", this._onDocClick), a(this, () => {
1140
- p() && l();
1126
+ m() && u();
1141
1127
  });
1142
1128
  }, this._bindGlobal();
1143
1129
  }
1144
1130
  _teardown() {
1145
- this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), o(this), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
1131
+ this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), o(this), this._navHandler?.teardown();
1146
1132
  }
1147
1133
  disconnectedCallback() {
1148
1134
  this._teardown(), this._ro?.disconnect(), this._ro = null;
1149
1135
  }
1150
- }, M = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;"), re = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), ie = /[^0-9]/g, ae = /[^0-9a-zA-Z]/g, N = 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 {
1151
1137
  static formAssociated = !0;
1152
1138
  static get observedAttributes() {
1153
1139
  return [
@@ -1178,7 +1164,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
1178
1164
  this._value = this._clean(e), c(this, this._value), this._paint();
1179
1165
  }
1180
1166
  _clean(e) {
1181
- return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ? ae : ie, "").slice(0, this.length);
1167
+ return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ? ne : te, "").slice(0, this.length);
1182
1168
  }
1183
1169
  constructor() {
1184
1170
  super();
@@ -1258,7 +1244,7 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
1258
1244
  disconnectedCallback() {
1259
1245
  this._onSelectionChange && document.removeEventListener("selectionchange", this._onSelectionChange);
1260
1246
  }
1261
- }, oe = [
1247
+ }, re = [
1262
1248
  [
1263
1249
  "AF",
1264
1250
  "Afghanistan",
@@ -2484,56 +2470,56 @@ var l = Symbol("wui.trustedHtml"), u = (e) => String(e ?? "").replace(/&/g, "&am
2484
2470
  "Zimbabwe",
2485
2471
  "263"
2486
2472
  ]
2487
- ], P = (e) => (oe.find((t) => t[0] === e) || [
2473
+ ], A = (e) => (re.find((t) => t[0] === e) || [
2488
2474
  "",
2489
2475
  "",
2490
2476
  ""
2491
- ])[2], F = (e) => `wui-flag wui-flag-${String(e).toLowerCase()}`, I = null, se = null;
2492
- function ce() {
2493
- return I ? Promise.resolve(I) : (se ||= Promise.all([import("./libphonenumber-js-BcNT8oq0.js"), import("./examples.mobile.json-BMXTGiGC.js")]).then(([e, t]) => (I = {
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 = {
2494
2480
  AsYouType: e.AsYouType,
2495
2481
  getExampleNumber: e.getExampleNumber,
2496
2482
  isValidPhoneNumber: e.isValidPhoneNumber,
2497
2483
  examples: t.default || t
2498
- }, I)).catch(() => null), se);
2484
+ }, M)).catch(() => null), N);
2499
2485
  }
2500
- function L(e, t) {
2501
- if (!I || !t) return t;
2486
+ function P(e, t) {
2487
+ if (!M || !t) return t;
2502
2488
  try {
2503
- return new I.AsYouType(e).input(t);
2489
+ return new M.AsYouType(e).input(t);
2504
2490
  } catch {
2505
2491
  return t;
2506
2492
  }
2507
2493
  }
2508
- function R(e) {
2509
- if (!I) return null;
2494
+ function F(e) {
2495
+ if (!M) return null;
2510
2496
  try {
2511
- return I.getExampleNumber(e, I.examples)?.formatNational() || null;
2497
+ return M.getExampleNumber(e, M.examples)?.formatNational() || null;
2512
2498
  } catch {
2513
2499
  return null;
2514
2500
  }
2515
2501
  }
2516
- function z(e) {
2517
- if (!I || !e) return null;
2502
+ function ae(e) {
2503
+ if (!M || !e) return null;
2518
2504
  try {
2519
- return I.isValidPhoneNumber(e);
2505
+ return M.isValidPhoneNumber(e);
2520
2506
  } catch {
2521
2507
  return null;
2522
2508
  }
2523
2509
  }
2524
- function le(e) {
2525
- if (!I) return null;
2510
+ function oe(e) {
2511
+ if (!M) return null;
2526
2512
  try {
2527
- let t = I.getExampleNumber(e, I.examples);
2513
+ let t = M.getExampleNumber(e, M.examples);
2528
2514
  return t?.nationalNumber ? t.nationalNumber.length : null;
2529
2515
  } catch {
2530
2516
  return null;
2531
2517
  }
2532
2518
  }
2533
- function B(e) {
2534
- if (!I || !e?.trim().startsWith("+")) return null;
2519
+ function I(e) {
2520
+ if (!M || !e?.trim().startsWith("+")) return null;
2535
2521
  try {
2536
- let t = new I.AsYouType();
2522
+ let t = new M.AsYouType();
2537
2523
  t.input(e.trim());
2538
2524
  let n = t.getCountry();
2539
2525
  return n ? {
@@ -2544,7 +2530,7 @@ function B(e) {
2544
2530
  return null;
2545
2531
  }
2546
2532
  }
2547
- var V = class extends HTMLElement {
2533
+ var L = class extends HTMLElement {
2548
2534
  static formAssociated = !0;
2549
2535
  static get observedAttributes() {
2550
2536
  return [
@@ -2584,13 +2570,13 @@ var V = class extends HTMLElement {
2584
2570
  this.value = this._defaultValue || "";
2585
2571
  }
2586
2572
  get value() {
2587
- return this._national ? `+${P(this._country)}${this._national}` : "";
2573
+ return this._national ? `+${A(this._country)}${this._national}` : "";
2588
2574
  }
2589
2575
  set value(e) {
2590
- let t = String(e ?? "").trim(), n = B(t);
2576
+ let t = String(e ?? "").trim(), n = I(t);
2591
2577
  if (n) this._country = n.country, this._national = n.national.replace(/[^0-9]/g, "");
2592
2578
  else if (t.startsWith("+")) {
2593
- let e = t.replace(/[^0-9]/g, ""), n = String(P(this._country));
2579
+ let e = t.replace(/[^0-9]/g, ""), n = String(A(this._country));
2594
2580
  n && e.startsWith(n) && (e = e.slice(n.length)), this._national = e;
2595
2581
  } else this._national = t.replace(/[^0-9]/g, "");
2596
2582
  n && this.getAttribute("country") !== this._country ? this.setAttribute("country", this._country) : this._rendered && this.render(), this._committedValue = this.value, this._syncMirror();
@@ -2606,25 +2592,25 @@ var V = class extends HTMLElement {
2606
2592
  }
2607
2593
  render() {
2608
2594
  this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || ""), this._country = this.getAttribute("country") || this._country;
2609
- let e = this.getAttribute("placeholder") || R(this._country) || "Enter phone number";
2595
+ let e = this.getAttribute("placeholder") || F(this._country) || "Enter phone number";
2610
2596
  this.id ||= `wui-phone-${Math.random().toString(36).slice(2, 9)}`;
2611
2597
  let t = `${this.id}-listbox`;
2612
2598
  this._listboxId = t;
2613
- let n = oe.map(([e, n, r], i) => `<button type="button" role="option" id="${H(`${t}-opt-${i}`)}" class="country-dropdown-item${e === this._country ? " selected" : ""}" data-iso="${e}" aria-selected="${e === this._country}"><span class="${F(e)}" aria-hidden="true"></span><span class="country-name-text">${n}<span class="country-code-text">+${r}</span></span></button>`).join("");
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("");
2614
2600
  this.innerHTML = `
2615
2601
  <div class="phone-input-wrap">
2616
2602
  <div class="phone-country-adornment">
2617
- <button type="button" class="country-toggle" aria-haspopup="listbox" aria-expanded="false" aria-controls="${H(t)}"${this.hasAttribute("disabled") ? " disabled" : ""}>
2618
- <span class="${F(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>
2619
2605
  <i class="bi bi-chevron-down phone-chevron" aria-hidden="true"></i>
2620
- <span class="phone-dial" data-dial>+${P(this._country)}</span>
2606
+ <span class="phone-dial" data-dial>+${A(this._country)}</span>
2621
2607
  </button>
2622
- <div class="country-dropdown-menu" role="listbox" id="${H(t)}" tabindex="-1" hidden>
2623
- <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="${H(t)}" aria-autocomplete="list" /></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>
2624
2610
  <div class="country-list-scroll">${n}<div class="country-empty" hidden>No countries found</div></div>
2625
2611
  </div>
2626
2612
  </div>
2627
- <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" : ""} />
2628
2614
  </div>
2629
2615
  <div class="field-error" data-phone-error hidden></div>`, this._rendered = !0, c(this, this.value), this._wire();
2630
2616
  }
@@ -2655,12 +2641,12 @@ var V = class extends HTMLElement {
2655
2641
  }
2656
2642
  c && (c.hidden = n > 0);
2657
2643
  }, v = (e) => {
2658
- this._country = e, this.getAttribute("country") !== e && (this._suppressCountryRender = !0, this.setAttribute("country", e), this._suppressCountryRender = !1), u && (u.className = F(e)), d && (d.textContent = `+${P(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)}`);
2659
2645
  for (let t of this._itemEls()) {
2660
2646
  let n = t.dataset.iso === e;
2661
2647
  t.classList.toggle("selected", n), t.setAttribute("aria-selected", String(n));
2662
2648
  }
2663
- !this.getAttribute("placeholder") && l && (l.placeholder = R(e) || "Enter phone number"), l && this._national && (l.value = L(e, this._national)), g(), this._syncMirror(), this._emitChange(), l?.focus();
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();
2664
2650
  }, y = (t) => {
2665
2651
  let n = this._visibleItems();
2666
2652
  if (t.key === "ArrowDown") {
@@ -2694,7 +2680,7 @@ var V = class extends HTMLElement {
2694
2680
  let b = this.querySelector("[data-phone-error]"), x = (e) => {
2695
2681
  if (l.classList.toggle("is-invalid", e), e ? l.setAttribute("aria-invalid", "true") : l.removeAttribute("aria-invalid"), b) {
2696
2682
  if (e) {
2697
- let e = R(this._country);
2683
+ let e = F(this._country);
2698
2684
  b.textContent = e ? `Enter a valid phone number, e.g. ${e}` : "Enter a valid phone number";
2699
2685
  }
2700
2686
  b.hidden = !e;
@@ -2702,15 +2688,15 @@ var V = class extends HTMLElement {
2702
2688
  };
2703
2689
  l.addEventListener("input", (e) => {
2704
2690
  e.stopPropagation();
2705
- let t = l.value.replace(/[^0-9]/g, ""), n = le(this._country);
2691
+ let t = l.value.replace(/[^0-9]/g, ""), n = oe(this._country);
2706
2692
  n && t.length > n && (t = t.slice(0, n)), this._national = t;
2707
- let r = L(this._country, this._national);
2708
- l.value !== r && (l.value = r), this._syncMirror(), this._emitInput(), l.classList.contains("is-invalid") && (!this._national || z(this.value) === !0) && x(!1);
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);
2709
2695
  }), l.addEventListener("change", (e) => e.stopPropagation()), l.addEventListener("blur", () => {
2710
- x(this._national.length > 0 && z(this.value) === !1), this.value !== this._committedValue && this._emitChange();
2696
+ x(this._national.length > 0 && ae(this.value) === !1), this.value !== this._committedValue && this._emitChange();
2711
2697
  }), l.addEventListener("paste", (e) => {
2712
- let t = B(e.clipboardData?.getData("text"));
2713
- t && (e.preventDefault(), this._national = t.national.replace(/[^0-9]/g, ""), t.country === this._country ? l.value = L(this._country, this._national) : this.setAttribute("country", t.country), this._syncMirror(), this._emitInput(), this._emitChange(), this.querySelector("input[type=tel]")?.focus());
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());
2714
2700
  }), this._bindGlobal = () => {
2715
2701
  this._teardownGlobals?.(), this._onDocClick = (e) => {
2716
2702
  f() && !this.contains(e.target) && g();
@@ -2719,9 +2705,9 @@ var V = class extends HTMLElement {
2719
2705
  });
2720
2706
  }, this._teardownGlobals = () => {
2721
2707
  this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), o(this);
2722
- }, this._bindGlobal(), ce().then((e) => {
2723
- if (!(!e || !l.isConnected) && (this._national && (l.value = L(this._country, this._national)), !this.getAttribute("placeholder"))) {
2724
- let e = R(this._country);
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);
2725
2711
  e && (l.placeholder = e);
2726
2712
  }
2727
2713
  }), this._syncMirror();
@@ -2732,7 +2718,7 @@ var V = class extends HTMLElement {
2732
2718
  disconnectedCallback() {
2733
2719
  this._teardown();
2734
2720
  }
2735
- }, 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 {
2736
2722
  static formAssociated = !0;
2737
2723
  static get observedAttributes() {
2738
2724
  return [
@@ -2797,7 +2783,7 @@ var V = class extends HTMLElement {
2797
2783
  value: e.getAttribute("value") ?? e.textContent.trim(),
2798
2784
  label: e.innerHTML,
2799
2785
  icon: e.getAttribute("icon") || void 0,
2800
- [l]: !0,
2786
+ [u]: !0,
2801
2787
  selected: e.hasAttribute("selected")
2802
2788
  })));
2803
2789
  }
@@ -2806,25 +2792,25 @@ var V = class extends HTMLElement {
2806
2792
  }
2807
2793
  render() {
2808
2794
  this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || ""), this._snapshotDeclared();
2809
- 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);
2810
- d && (this._value = String(d.value)), c(this, this._value), this.id ||= `wui-select-${Math.random().toString(36).slice(2, 9)}`;
2811
- let p = `${this.id}-listbox`;
2812
- 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;
2813
2799
  let m = e.map((e, t) => {
2814
2800
  let n = String(e.value) === String(this._value);
2815
- 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>`;
2816
2802
  }).join("");
2817
2803
  this.innerHTML = `
2818
2804
  <div class="search-select${this.hasAttribute("compact") ? " search-select-compact" : ""}${i}">
2819
- <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" : ""}>
2820
- ${a ? `<i class="bi bi-${W(a)} search-select-icon" aria-hidden="true"></i>` : ""}
2821
- ${o ? `<span class="search-select-prefix">${u(o)}</span>` : ""}
2822
- <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>
2823
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>" : ""}
2824
2810
  <i class="bi bi-chevron-down search-select-caret" aria-hidden="true"></i>
2825
2811
  </button>
2826
- <div class="search-select-menu search-select-menu-fixed" role="listbox" id="${W(p)}" tabindex="-1" hidden>
2827
- ${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>` : ""}
2828
2814
  <div class="search-select-options">${m}<div class="search-select-empty" hidden>No matches</div></div>
2829
2815
  </div>
2830
2816
  </div>`, this._rendered = !0, c(this, this._value), this._wire(), this._syncReset();
@@ -2853,7 +2839,7 @@ var V = class extends HTMLElement {
2853
2839
  let t = e.dataset.value === String(this._value);
2854
2840
  e.classList.toggle("selected", t), e.setAttribute("aria-selected", String(t));
2855
2841
  }
2856
- 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));
2857
2843
  }
2858
2844
  _syncReset() {
2859
2845
  let { reset: e } = this._refs();
@@ -2883,44 +2869,31 @@ var V = class extends HTMLElement {
2883
2869
  }, o = () => !e.menu.hidden, s = () => {
2884
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")));
2885
2871
  }, c = () => {
2886
- e.menu.hidden = !0, e.control.setAttribute("aria-expanded", "false"), e.control.classList.remove("open"), n(-1), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
2887
- }, l = (t) => {
2872
+ e.menu.hidden = !0, e.control.setAttribute("aria-expanded", "false"), e.control.classList.remove("open"), n(-1);
2873
+ }, u = (t) => {
2888
2874
  this.value = t.dataset.value, this.dispatchEvent(new Event("change", { bubbles: !0 })), c(), e.control.focus();
2889
- }, u = () => {
2890
- clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
2891
- }, d = (t) => {
2892
- let r = this._visible(), i = t.target?.tagName === "INPUT" || t.target?.tagName === "TEXTAREA";
2893
- if (t.key === "ArrowDown") t.preventDefault(), n(Math.min(this._active + 1, r.length - 1));
2894
- else if (t.key === "ArrowUp") t.preventDefault(), n(Math.max(this._active - 1, 0));
2895
- else if (t.key === "Home" && !i) t.preventDefault(), r.length && n(0);
2896
- else if (t.key === "End" && !i) t.preventDefault(), r.length && n(r.length - 1);
2897
- else if (t.key === "PageDown" && !i) {
2898
- if (t.preventDefault(), !r.length) return;
2899
- let e = this._active < 0 ? 0 : this._active;
2900
- n(Math.min(e + 8, r.length - 1));
2901
- } else if (t.key === "PageUp" && !i) {
2902
- if (t.preventDefault(), !r.length) return;
2903
- let e = this._active < 0 ? 0 : this._active;
2904
- n(Math.max(e - 8, 0));
2905
- } else if (t.key === "Enter") t.preventDefault(), r[this._active] && l(r[this._active]);
2906
- else if (t.key === "Escape") c(), e.control.focus();
2907
- else if (t.key.length === 1 && !t.ctrlKey && !t.metaKey && !t.altKey && t.target?.tagName !== "INPUT" && t.target?.tagName !== "TEXTAREA") {
2908
- t.preventDefault(), clearTimeout(this._typeaheadTimer), this._typeahead += t.key.toLowerCase(), this._typeaheadTimer = setTimeout(u, 500);
2909
- let e = r.findIndex((e) => e.textContent.trim().toLowerCase().startsWith(this._typeahead));
2910
- e >= 0 && n(e);
2911
- }
2912
2875
  };
2913
- 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) => {
2914
2887
  t.stopPropagation(), this.value = "", this.dispatchEvent(new Event("change", { bubbles: !0 })), e.control.focus();
2915
2888
  }), e.control.addEventListener("click", () => o() ? c() : s()), e.control.addEventListener("keydown", (e) => {
2916
2889
  if (o()) {
2917
- d(e);
2890
+ this._navHandler.handler(e);
2918
2891
  return;
2919
2892
  }
2920
2893
  (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), s());
2921
2894
  }), e.optionsWrap.addEventListener("click", (e) => {
2922
2895
  let t = e.target.closest(".search-select-option");
2923
- t && l(t);
2896
+ t && u(t);
2924
2897
  }), e.optionsWrap.addEventListener("mousemove", (e) => {
2925
2898
  let t = e.target.closest(".search-select-option");
2926
2899
  t && n(this._visible().indexOf(t));
@@ -2928,7 +2901,7 @@ var V = class extends HTMLElement {
2928
2901
  r(e.search.value), n(-1);
2929
2902
  }), e.clear?.addEventListener("click", () => {
2930
2903
  e.search.value = "", r(""), e.search.focus();
2931
- }), e.menu.addEventListener("keydown", d), this._bindGlobal = () => {
2904
+ }), e.menu.addEventListener("keydown", this._navHandler.handler), this._bindGlobal = () => {
2932
2905
  this._teardown(), this._onDocClick = (e) => {
2933
2906
  o() && !this.contains(e.target) && c();
2934
2907
  }, document.addEventListener("click", this._onDocClick), a(this, () => {
@@ -2937,12 +2910,12 @@ var V = class extends HTMLElement {
2937
2910
  }, this._bindGlobal();
2938
2911
  }
2939
2912
  _teardown() {
2940
- this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), o(this), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
2913
+ this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), o(this), this._navHandler?.teardown();
2941
2914
  }
2942
2915
  disconnectedCallback() {
2943
2916
  this._teardown();
2944
2917
  }
2945
- }, 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 {
2946
2919
  static formAssociated = !0;
2947
2920
  static get observedAttributes() {
2948
2921
  return [
@@ -2982,19 +2955,19 @@ var V = class extends HTMLElement {
2982
2955
  return this._value;
2983
2956
  }
2984
2957
  set value(e) {
2985
- 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();
2986
2959
  }
2987
2960
  get start() {
2988
2961
  return this._start;
2989
2962
  }
2990
2963
  set start(e) {
2991
- 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();
2992
2965
  }
2993
2966
  get end() {
2994
2967
  return this._end;
2995
2968
  }
2996
2969
  set end(e) {
2997
- 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();
2998
2971
  }
2999
2972
  attributeChangedCallback(e, t, n) {
3000
2973
  if (e === "value" || e === "start" || e === "end" || e === "min" || e === "max" || e === "step") {
@@ -3007,19 +2980,19 @@ var V = class extends HTMLElement {
3007
2980
  this._isRange() ? this._resetRange() : this._resetSingle();
3008
2981
  }
3009
2982
  _updateFromAttribute(e) {
3010
- 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))));
3011
2984
  }
3012
2985
  _isRange() {
3013
2986
  return this.hasAttribute("range");
3014
2987
  }
3015
2988
  _min() {
3016
- return K(this.getAttribute("min"), 0);
2989
+ return H(this.getAttribute("min"), 0);
3017
2990
  }
3018
2991
  _max() {
3019
- return K(this.getAttribute("max"), 100);
2992
+ return H(this.getAttribute("max"), 100);
3020
2993
  }
3021
2994
  _step() {
3022
- return K(this.getAttribute("step"), 1);
2995
+ return H(this.getAttribute("step"), 1);
3023
2996
  }
3024
2997
  _clamp(e) {
3025
2998
  return Math.max(this._min(), Math.min(e, this._max()));
@@ -3084,7 +3057,7 @@ var V = class extends HTMLElement {
3084
3057
  aria-valuenow="${this._value}"
3085
3058
  aria-valuetext="${this._formatValue(this._value)}"
3086
3059
  ${a ? "disabled" : ""}
3087
- aria-label="${ue(this.getAttribute("aria-label") || "Value")}"
3060
+ aria-label="${se(this.getAttribute("aria-label") || "Value")}"
3088
3061
  ></button>
3089
3062
  `}
3090
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>` : ""}
@@ -3184,10 +3157,10 @@ var V = class extends HTMLElement {
3184
3157
  disconnectedCallback() {
3185
3158
  this._teardown();
3186
3159
  }
3187
- }, K = (e, t) => {
3160
+ }, H = (e, t) => {
3188
3161
  let n = Number.parseFloat(e);
3189
3162
  return Number.isFinite(n) ? n : t;
3190
- }, 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 {
3191
3164
  static formAssociated = !0;
3192
3165
  _accessibleName() {
3193
3166
  return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Add tags";
@@ -3251,8 +3224,8 @@ var V = class extends HTMLElement {
3251
3224
  c(this, this._values.join(",")), this.innerHTML = `
3252
3225
  <div class="search-select${t}">
3253
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" : ""}/>
3254
3228
  <div class="ms-chips" data-chips></div>
3255
- <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" : ""}/>
3256
3229
  </div>
3257
3230
  </div>`, this._rendered = !0, c(this, this._values.join(",")), this._renderControl(), this._wire();
3258
3231
  }
@@ -3263,7 +3236,7 @@ var V = class extends HTMLElement {
3263
3236
  e.innerHTML = "";
3264
3237
  return;
3265
3238
  }
3266
- 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("");
3267
3240
  }
3268
3241
  }
3269
3242
  _wire() {
@@ -3334,18 +3307,18 @@ var V = class extends HTMLElement {
3334
3307
  disconnectedCallback() {
3335
3308
  this._teardown();
3336
3309
  }
3337
- }, 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) => {
3338
3311
  let t = /^(\d{2}):(\d{2})$/.exec(e || "");
3339
3312
  return t ? {
3340
3313
  h: +t[1],
3341
3314
  m: +t[2]
3342
3315
  } : null;
3343
- }, X = (e, t = "24") => {
3316
+ }, J = (e, t = "24") => {
3344
3317
  if (!e) return "";
3345
- if (t === "24") return pe(e.h, e.m);
3318
+ if (t === "24") return K(e.h, e.m);
3346
3319
  let n = e.h % 12 || 12, r = e.h >= 12 ? "PM" : "AM";
3347
- return `${n}:${J(e.m)} ${r}`;
3348
- }, me = class extends HTMLElement {
3320
+ return `${n}:${G(e.m)} ${r}`;
3321
+ }, Y = class extends HTMLElement {
3349
3322
  static formAssociated = !0;
3350
3323
  static get observedAttributes() {
3351
3324
  return [
@@ -3392,11 +3365,11 @@ var V = class extends HTMLElement {
3392
3365
  }
3393
3366
  render() {
3394
3367
  this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "", this._value = this._defaultValue || this._value);
3395
- 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");
3396
3369
  this.innerHTML = `
3397
3370
  <div class="timepicker">
3398
- <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)}"` : ""}>
3399
- <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>
3400
3373
  <i class="bi bi-clock" aria-hidden="true"></i>
3401
3374
  </button>
3402
3375
  <div class="timepicker-pop" role="listbox" tabindex="-1" hidden></div>
@@ -3408,14 +3381,14 @@ var V = class extends HTMLElement {
3408
3381
  _syncTrigger() {
3409
3382
  let e = this.querySelector(".timepicker-trigger"), t = this.querySelector("[data-trigger-label]");
3410
3383
  if (!t) return;
3411
- let n = Y(this._value), r = this.getAttribute("format") || "24";
3412
- 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);
3413
3386
  }
3414
3387
  _buildTimes() {
3415
- 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) || {
3416
3389
  h: 0,
3417
3390
  m: 0
3418
- }, i = Y(n) || {
3391
+ }, i = q(n) || {
3419
3392
  h: 23,
3420
3393
  m: 59
3421
3394
  }, a = [], o = r.h, s = r.m;
@@ -3428,10 +3401,10 @@ var V = class extends HTMLElement {
3428
3401
  _renderOptions() {
3429
3402
  let e = this.querySelector(".timepicker-pop");
3430
3403
  if (!e) return;
3431
- 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 = "";
3432
3405
  for (let e = 0; e < n.length; e++) {
3433
- let o = n[e], s = pe(o.h, o.m), c = r && r.h === o.h && r.m === o.m;
3434
- 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>`;
3435
3408
  }
3436
3409
  e.innerHTML = a, this._focusActive();
3437
3410
  }
@@ -3529,14 +3502,194 @@ var V = class extends HTMLElement {
3529
3502
  disconnectedCallback() {
3530
3503
  this._teardown();
3531
3504
  }
3532
- }, he = "image/png,image/jpeg,image/webp", ge = 5, _e = {
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
+ }
3549
+ }
3550
+ disconnectedCallback() {
3551
+ this._teardown();
3552
+ }
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 = {
3533
3686
  "image/png": [".png"],
3534
3687
  "image/jpeg": [".jpg", ".jpeg"],
3535
3688
  "image/webp": [".webp"],
3536
3689
  "image/gif": [".gif"],
3537
3690
  "image/svg+xml": [".svg"],
3538
3691
  "application/pdf": [".pdf"]
3539
- }, ve = {
3692
+ }, he = {
3540
3693
  "image/png": "PNG",
3541
3694
  "image/jpeg": "JPG",
3542
3695
  "image/webp": "WEBP",
@@ -3550,7 +3703,7 @@ var V = class extends HTMLElement {
3550
3703
  ".gif": "GIF",
3551
3704
  ".svg": "SVG",
3552
3705
  ".pdf": "PDF"
3553
- }, 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 = [
3554
3707
  ".png",
3555
3708
  ".jpg",
3556
3709
  ".jpeg",
@@ -3561,44 +3714,44 @@ var V = class extends HTMLElement {
3561
3714
  ".avif",
3562
3715
  ".heic"
3563
3716
  ];
3564
- function be(e) {
3717
+ function _e(e) {
3565
3718
  if (!e) return !1;
3566
3719
  let t = typeof e == "object" && e.type ? String(e.type).toLowerCase() : "";
3567
3720
  if (t) return t.startsWith("image/");
3568
3721
  let n = typeof e == "string" ? e : e.name || e.url || "", r = String(n).toLowerCase();
3569
- return ye.some((e) => r.endsWith(e));
3722
+ return ge.some((e) => r.endsWith(e));
3570
3723
  }
3571
- function xe(e) {
3572
- let t = Z(e);
3573
- 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;
3574
3727
  }
3575
- function Se(e) {
3728
+ function ye(e) {
3576
3729
  let t = [];
3577
- for (let n of Z(e)) {
3578
- 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());
3579
3732
  t.includes(e) || t.push(e);
3580
3733
  }
3581
3734
  return t.length <= 1 ? t[0] || "supported" : `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
3582
3735
  }
3583
- function Ce(e, t) {
3584
- let n = Z(t);
3736
+ function be(e, t) {
3737
+ let n = Q(t);
3585
3738
  if (!n.length) return !0;
3586
3739
  let r = (e.type || "").toLowerCase(), i = (e.name || "").toLowerCase();
3587
- 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)));
3588
3741
  }
3589
- function we(e, t = {}) {
3742
+ function xe(e, t = {}) {
3590
3743
  if (!e) return null;
3591
- let n = t.accept === void 0 ? he : t.accept, r = t.maxSizeMb || 5;
3592
- 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.`;
3593
3746
  }
3594
3747
  //#endregion
3595
3748
  //#region src/index.js
3596
- var Q = (e, t) => {
3749
+ var $ = (e, t) => {
3597
3750
  typeof customElements < "u" && !customElements.get(e) && customElements.define(e, t);
3598
3751
  };
3599
- function $() {
3600
- Q("wui-select", U), Q("wui-phone", V), Q("wui-datepicker", ee), Q("wui-date-range", j), Q("wui-slider", G), Q("wui-timepicker", me), Q("wui-autocomplete", p), Q("wui-multiselect", ne), Q("wui-taginput", de), Q("wui-otp", N), 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);
3601
3754
  }
3602
- $();
3755
+ Se();
3603
3756
  //#endregion
3604
- export { he as DEFAULT_IMAGE_ACCEPT, ge as DEFAULT_MAX_SIZE_MB, t as STATUS_TONES, p as WuiAutocomplete, ee as WuiDatePicker, j as WuiDateRange, ne as WuiMultiSelect, N 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 };