monobill-mintui 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -32,13 +32,13 @@ class O extends HTMLElement {
32
32
  return t[e] || t.default;
33
33
  }
34
34
  render() {
35
- const e = this.getSize(), t = this.getAttribute("size") || "default", i = !!(this.style.width && this.style.height), s = this.getAttribute("data-button-variant"), r = document.documentElement.classList.contains("dark");
36
- let n;
35
+ const e = this.getSize(), t = this.getAttribute("size") || "default", i = !!(this.style.width && this.style.height), s = this.getAttribute("data-button-variant"), n = document.documentElement.classList.contains("dark");
36
+ let r;
37
37
  if (i) {
38
38
  const h = this.getAttribute("data-button-tone") || "neutral";
39
- s === "solid" ? h === "neutral" ? n = r ? "#ffffff" : "#0f172a" : n = "#ffffff" : n = r ? "#ffffff" : "#0f172a";
39
+ s === "solid" ? h === "neutral" ? r = n ? "#ffffff" : "#0f172a" : r = "#ffffff" : r = n ? "#ffffff" : "#0f172a";
40
40
  } else
41
- n = r ? "#e2e8f0" : "#0f172a";
41
+ r = n ? "#e2e8f0" : "#0f172a";
42
42
  const a = t === "large" ? "2" : "4", l = !!(this.style.width && this.style.height), o = `
43
43
  <svg
44
44
  xmlns="http://www.w3.org/2000/svg"
@@ -51,7 +51,7 @@ class O extends HTMLElement {
51
51
  cx="12"
52
52
  cy="12"
53
53
  r="10"
54
- stroke="${n}"
54
+ stroke="${r}"
55
55
  stroke-width="${a}"
56
56
  opacity="0.25"
57
57
  class="opacity-25"
@@ -60,7 +60,7 @@ class O extends HTMLElement {
60
60
  cx="12"
61
61
  cy="12"
62
62
  r="10"
63
- stroke="${n}"
63
+ stroke="${r}"
64
64
  stroke-width="${a}"
65
65
  stroke-linecap="round"
66
66
  fill="none"
@@ -134,10 +134,10 @@ class B extends HTMLElement {
134
134
  console.warn(`Icon "${e}" not found. Make sure you've imported the icon: import '@monobill-mintui/icon/icons/${e}'`), this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "";
135
135
  return;
136
136
  }
137
- const i = this.closest("mint-button") || ((l = this.parentElement) == null ? void 0 : l.closest("mint-button")), s = this.closest("mint-switch") || ((o = this.parentElement) == null ? void 0 : o.closest("mint-switch")), r = this.closest("mint-select") || ((h = this.parentElement) == null ? void 0 : h.closest("mint-select"));
137
+ const i = this.closest("mint-button") || ((l = this.parentElement) == null ? void 0 : l.closest("mint-button")), s = this.closest("mint-switch") || ((o = this.parentElement) == null ? void 0 : o.closest("mint-switch")), n = this.closest("mint-select") || ((h = this.parentElement) == null ? void 0 : h.closest("mint-select"));
138
138
  if (!Array.from(this.classList).some(
139
139
  (c) => c.startsWith("w-") || c.startsWith("h-")
140
- ) && !r) {
140
+ ) && !n) {
141
141
  let c;
142
142
  s ? c = "w-3 h-3" : i ? c = "w-5 h-5" : c = "w-[1.3em] h-[1.3em]", this.classList.remove("w-4", "h-4", "w-5", "h-5", "w-[1em]", "h-[1em]", "w-[1.3em]", "h-[1.3em]", "w-3", "h-3"), c.split(" ").forEach((u) => {
143
143
  u && this.classList.add(u);
@@ -211,13 +211,13 @@ class z extends HTMLElement {
211
211
  return this.getAttribute("icon") || "";
212
212
  }
213
213
  isIconOnly() {
214
- var i, s, r, n, a;
214
+ var i, s, n, r, a;
215
215
  if (!(this.getIcon() || ((i = this._button) == null ? void 0 : i.querySelector('[slot="icon"], .mint-button-icon, mint-icon')))) return !1;
216
216
  const t = (s = this._button) == null ? void 0 : s.querySelector(".mint-button-content");
217
- if (t && ((r = t.textContent) != null && r.trim())) return !1;
217
+ if (t && ((n = t.textContent) != null && n.trim())) return !1;
218
218
  if (this._button)
219
219
  for (let l = this._button.firstChild; l; l = l.nextSibling) {
220
- if (l.nodeType === Node.TEXT_NODE && ((n = l.textContent) != null && n.trim()))
220
+ if (l.nodeType === Node.TEXT_NODE && ((r = l.textContent) != null && r.trim()))
221
221
  return !1;
222
222
  if (l.nodeType === Node.ELEMENT_NODE) {
223
223
  const o = l;
@@ -251,7 +251,7 @@ class z extends HTMLElement {
251
251
  "[&>*]:duration-100",
252
252
  "disabled:opacity-50",
253
253
  "disabled:cursor-not-allowed"
254
- ], s = this.getTone(), r = {
254
+ ], s = this.getTone(), n = {
255
255
  "solid-action": [
256
256
  "bg-slate-800",
257
257
  "dark:bg-slate-600",
@@ -536,7 +536,7 @@ class z extends HTMLElement {
536
536
  "border-transparent"
537
537
  // Match other button border width
538
538
  ]
539
- }, n = `${t}-${s}`, a = r[n] || r["solid-neutral"], l = [
539
+ }, r = `${t}-${s}`, a = n[r] || n["solid-neutral"], l = [
540
540
  ...i,
541
541
  ...a
542
542
  ];
@@ -565,20 +565,20 @@ class z extends HTMLElement {
565
565
  for (; this.firstChild && this.firstChild !== this._button; )
566
566
  this._button.appendChild(this.firstChild);
567
567
  const s = this.getIcon();
568
- let r = this._button.querySelector('[slot="icon"], .mint-button-icon, mint-icon');
569
- s ? (r && r.tagName !== "MINT-ICON" && (r.remove(), r = null), !r || r.tagName !== "MINT-ICON" ? (r = document.createElement("mint-icon"), r.setAttribute("name", s), r.className = "mint-button-icon") : r.setAttribute("name", s)) : r && r.tagName === "MINT-ICON" && (r.remove(), r = null), r || (r = this._button.querySelector('[slot="icon"], .mint-button-icon'));
570
- const n = this.getIconPosition();
568
+ let n = this._button.querySelector('[slot="icon"], .mint-button-icon, mint-icon');
569
+ s ? (n && n.tagName !== "MINT-ICON" && (n.remove(), n = null), !n || n.tagName !== "MINT-ICON" ? (n = document.createElement("mint-icon"), n.setAttribute("name", s), n.className = "mint-button-icon") : n.setAttribute("name", s)) : n && n.tagName === "MINT-ICON" && (n.remove(), n = null), n || (n = this._button.querySelector('[slot="icon"], .mint-button-icon'));
570
+ const r = this.getIconPosition();
571
571
  let a = this._button.querySelector(".mint-button-content");
572
572
  if (a) {
573
- const p = r && r.tagName === "MINT-ICON";
574
- if (r && !r.parentElement) {
573
+ const p = n && n.tagName === "MINT-ICON";
574
+ if (n && !n.parentElement) {
575
575
  const m = (d = this._button.querySelector("mint-spinner")) == null ? void 0 : d.parentElement;
576
- p || n === "left" ? m ? m.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, a) : a.insertAdjacentElement("afterend", r);
577
- } else if (r && (p || n === "left") && r.nextSibling !== a) {
578
- r.remove();
576
+ p || r === "left" ? m ? m.insertAdjacentElement("afterend", n) : this._button.insertBefore(n, a) : a.insertAdjacentElement("afterend", n);
577
+ } else if (n && (p || r === "left") && n.nextSibling !== a) {
578
+ n.remove();
579
579
  const m = (f = this._button.querySelector("mint-spinner")) == null ? void 0 : f.parentElement;
580
- m ? m.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, a);
581
- } else r && !p && n === "right" && r.previousSibling !== a && (r.remove(), a.insertAdjacentElement("afterend", r));
580
+ m ? m.insertAdjacentElement("afterend", n) : this._button.insertBefore(n, a);
581
+ } else n && !p && r === "right" && n.previousSibling !== a && (n.remove(), a.insertAdjacentElement("afterend", n));
582
582
  } else {
583
583
  const p = [];
584
584
  for (let m = this._button.firstChild; m; m = m.nextSibling) {
@@ -587,21 +587,21 @@ class z extends HTMLElement {
587
587
  continue;
588
588
  }
589
589
  const k = m;
590
- k.tagName !== "MINT-SPINNER" && !k.querySelector("mint-spinner") && m !== r && !k.hasAttribute("slot") && !(k.className === "mr-2" && k.querySelector("mint-spinner")) && p.push(m);
590
+ k.tagName !== "MINT-SPINNER" && !k.querySelector("mint-spinner") && m !== n && !k.hasAttribute("slot") && !(k.className === "mr-2" && k.querySelector("mint-spinner")) && p.push(m);
591
591
  }
592
592
  if (p.length > 0) {
593
593
  a = document.createElement("span"), a.className = "mint-button-content inline-flex items-center", p.forEach((k) => {
594
594
  a.appendChild(k);
595
595
  });
596
596
  const m = (c = this._button.querySelector("mint-spinner")) == null ? void 0 : c.parentElement;
597
- r && n === "left" ? m ? (m.insertAdjacentElement("afterend", r), r.insertAdjacentElement("afterend", a)) : (this._button.insertBefore(r, this._button.firstChild), r.insertAdjacentElement("afterend", a)) : r && n === "right" ? m ? (m.insertAdjacentElement("afterend", a), a.insertAdjacentElement("afterend", r)) : (this._button.insertBefore(a, this._button.firstChild), a.insertAdjacentElement("afterend", r)) : m ? m.insertAdjacentElement("afterend", a) : this._button.insertBefore(a, this._button.firstChild);
598
- } else if (r && r.tagName === "MINT-ICON" && !r.parentElement) {
597
+ n && r === "left" ? m ? (m.insertAdjacentElement("afterend", n), n.insertAdjacentElement("afterend", a)) : (this._button.insertBefore(n, this._button.firstChild), n.insertAdjacentElement("afterend", a)) : n && r === "right" ? m ? (m.insertAdjacentElement("afterend", a), a.insertAdjacentElement("afterend", n)) : (this._button.insertBefore(a, this._button.firstChild), a.insertAdjacentElement("afterend", n)) : m ? m.insertAdjacentElement("afterend", a) : this._button.insertBefore(a, this._button.firstChild);
598
+ } else if (n && n.tagName === "MINT-ICON" && !n.parentElement) {
599
599
  const m = (u = this._button.querySelector("mint-spinner")) == null ? void 0 : u.parentElement;
600
- m ? m.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, this._button.firstChild);
600
+ m ? m.insertAdjacentElement("afterend", n) : this._button.insertBefore(n, this._button.firstChild);
601
601
  }
602
602
  }
603
603
  const l = this.isIconOnly();
604
- r && (r.classList.contains("mint-button-icon") || r.classList.add("mint-button-icon"), r.classList.remove("mr-1.5", "ml-1.5"), l ? r.tagName === "MINT-ICON" ? (r.style.width = "1rem", r.style.height = "1rem", r.style.maxWidth = "1rem", r.style.maxHeight = "1rem", r.style.flexShrink = "0") : (r.style.maxWidth = "1rem", r.style.maxHeight = "1rem", r.style.flexShrink = "0", r.tagName === "svg" && (r.style.width = "1rem", r.style.height = "1rem")) : n === "left" ? r.classList.add("mr-1.5") : r.classList.add("ml-1.5"));
604
+ n && (n.classList.contains("mint-button-icon") || n.classList.add("mint-button-icon"), n.classList.remove("mr-1.5", "ml-1.5"), l ? n.tagName === "MINT-ICON" ? (n.style.width = "1rem", n.style.height = "1rem", n.style.maxWidth = "1rem", n.style.maxHeight = "1rem", n.style.flexShrink = "0") : (n.style.maxWidth = "1rem", n.style.maxHeight = "1rem", n.style.flexShrink = "0", n.tagName === "svg" && (n.style.width = "1rem", n.style.height = "1rem")) : r === "left" ? n.classList.add("mr-1.5") : n.classList.add("ml-1.5"));
605
605
  const o = this.getButtonClasses();
606
606
  this._button.className = o;
607
607
  }
@@ -771,7 +771,7 @@ class W extends HTMLElement {
771
771
  ].join(" ");
772
772
  }
773
773
  render() {
774
- const e = this.isLoading(), t = this.getSwitchClasses(), i = this.getThumbClasses(), s = this.getLabel(), r = this.getInfo(), n = this.getIcon(), a = this.getAttribute("id") || `mint-switch-${Math.random().toString(36).substr(2, 9)}`;
774
+ const e = this.isLoading(), t = this.getSwitchClasses(), i = this.getThumbClasses(), s = this.getLabel(), n = this.getInfo(), r = this.getIcon(), a = this.getAttribute("id") || `mint-switch-${Math.random().toString(36).substr(2, 9)}`;
775
775
  this.getAttribute("id") || this.setAttribute("id", a);
776
776
  const l = this._getSwitchContainer();
777
777
  this._button ? this._button.parentElement !== l && l.appendChild(this._button) : (this._button = document.createElement("button"), l.appendChild(this._button), this.setupEventListeners());
@@ -780,14 +780,14 @@ class W extends HTMLElement {
780
780
  let h = this._button.querySelector("span");
781
781
  h || (h = document.createElement("span"), this._button.appendChild(h)), h.className = i;
782
782
  const c = h.querySelector("span");
783
- if (n) {
783
+ if (r) {
784
784
  let d = c;
785
785
  d || (d = document.createElement("span"), d.className = this.getIconClasses(), h.appendChild(d));
786
786
  let f = d.querySelector("mint-icon");
787
- f || (f = document.createElement("mint-icon"), d.appendChild(f)), f.setAttribute("name", n);
787
+ f || (f = document.createElement("mint-icon"), d.appendChild(f)), f.setAttribute("name", r);
788
788
  } else c && c.remove();
789
789
  let u = this.querySelector(".mint-switch-info");
790
- r ? (u || (u = document.createElement("span"), u.className = "mint-switch-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block", l && l.parentElement === this ? this.insertBefore(u, l.nextSibling) : this.appendChild(u)), u.textContent = r, this.isDisabled() ? u.classList.add("opacity-40") : u.classList.remove("opacity-40")) : u && u.remove(), this._renderErrorState(), this._renderSkeleton(e);
790
+ n ? (u || (u = document.createElement("span"), u.className = "mint-switch-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block", l && l.parentElement === this ? this.insertBefore(u, l.nextSibling) : this.appendChild(u)), u.textContent = n, this.isDisabled() ? u.classList.add("opacity-40") : u.classList.remove("opacity-40")) : u && u.remove(), this._renderErrorState(), this._renderSkeleton(e);
791
791
  }
792
792
  setupEventListeners() {
793
793
  this._button && this._button.addEventListener("click", this.handleToggle.bind(this));
@@ -812,27 +812,27 @@ class W extends HTMLElement {
812
812
  }
813
813
  _renderSkeleton(e) {
814
814
  const t = this._getSwitchContainer(), i = this.getLabel(), s = this.getInfo();
815
- let r = t.querySelector(".mint-switch-skeleton-container"), n = this.querySelector(".mint-switch-info-skeleton");
815
+ let n = t.querySelector(".mint-switch-skeleton-container"), r = this.querySelector(".mint-switch-info-skeleton");
816
816
  if (e) {
817
- t.classList.contains("relative") || t.classList.add("relative"), r || (r = document.createElement("div"), r.className = "mint-switch-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2", t.appendChild(r));
818
- let a = r.querySelector(".mint-switch-skeleton-box");
819
- if (a || (a = document.createElement("div"), a.className = "mint-switch-skeleton-box flex-shrink-0 w-10 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse", r.appendChild(a)), i) {
820
- let o = r.querySelector(".mint-switch-skeleton-label");
821
- o || (o = document.createElement("div"), o.className = "mint-switch-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-gray-700 animate-pulse", r.appendChild(o));
817
+ t.classList.contains("relative") || t.classList.add("relative"), n || (n = document.createElement("div"), n.className = "mint-switch-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2", t.appendChild(n));
818
+ let a = n.querySelector(".mint-switch-skeleton-box");
819
+ if (a || (a = document.createElement("div"), a.className = "mint-switch-skeleton-box flex-shrink-0 w-10 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse", n.appendChild(a)), i) {
820
+ let o = n.querySelector(".mint-switch-skeleton-label");
821
+ o || (o = document.createElement("div"), o.className = "mint-switch-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-gray-700 animate-pulse", n.appendChild(o));
822
822
  } else {
823
- const o = r.querySelector(".mint-switch-skeleton-label");
823
+ const o = n.querySelector(".mint-switch-skeleton-label");
824
824
  o && o.remove();
825
825
  }
826
- r.style.display = "flex", this._button && (this._button.style.visibility = "hidden", this._button.style.pointerEvents = "none");
826
+ n.style.display = "flex", this._button && (this._button.style.visibility = "hidden", this._button.style.pointerEvents = "none");
827
827
  const l = t.querySelector(".mint-switch-label");
828
828
  if (l && (l.style.visibility = "hidden", l.style.pointerEvents = "none"), s) {
829
- n || (n = document.createElement("div"), n.className = "mint-switch-info-skeleton h-3 w-32 rounded bg-gray-200 dark:bg-gray-700 animate-pulse mt-2", t && t.parentElement === this ? this.insertBefore(n, t.nextSibling) : this.appendChild(n)), n.style.display = "block";
829
+ r || (r = document.createElement("div"), r.className = "mint-switch-info-skeleton h-3 w-32 rounded bg-gray-200 dark:bg-gray-700 animate-pulse mt-2", t && t.parentElement === this ? this.insertBefore(r, t.nextSibling) : this.appendChild(r)), r.style.display = "block";
830
830
  const o = this.querySelector(".mint-switch-info");
831
831
  o && (o.style.display = "none");
832
832
  } else
833
- n && (n.style.display = "none");
833
+ r && (r.style.display = "none");
834
834
  } else {
835
- r && (r.style.display = "none"), n && (n.style.display = "none"), this._button && (this._button.style.visibility = "visible", this._button.style.pointerEvents = "auto");
835
+ n && (n.style.display = "none"), r && (r.style.display = "none"), this._button && (this._button.style.visibility = "visible", this._button.style.pointerEvents = "auto");
836
836
  const a = t.querySelector(".mint-switch-label");
837
837
  a && (a.style.visibility = "visible", a.style.pointerEvents = "auto");
838
838
  const l = this.querySelector(".mint-switch-info");
@@ -906,19 +906,19 @@ class V extends HTMLElement {
906
906
  regular: [
907
907
  // No default margin for regular text
908
908
  ]
909
- }, r = {
909
+ }, n = {
910
910
  default: i ? ["text-gray-100"] : ["text-gray-900"],
911
911
  muted: i ? ["text-gray-400"] : ["text-gray-400"],
912
912
  danger: i ? ["text-red-400"] : ["text-red-600"],
913
913
  success: i ? ["text-green-400"] : ["text-green-600"]
914
- }, n = [];
915
- this.isBold() && n.push("font-bold"), this.isUnderline() && n.push("underline"), this.isStrike() && n.push("line-through"), this.isItalic() && n.push("italic");
914
+ }, r = [];
915
+ this.isBold() && r.push("font-bold"), this.isUnderline() && r.push("underline"), this.isStrike() && r.push("line-through"), this.isItalic() && r.push("italic");
916
916
  const a = this.getDisplay();
917
917
  return [
918
918
  a === "block" ? "block" : a === "inline" ? "inline" : "inline-block",
919
919
  ...s[e] || s.regular,
920
- ...r[t] || r.default,
921
- ...n
920
+ ...n[t] || n.default,
921
+ ...r
922
922
  ].join(" ");
923
923
  }
924
924
  render() {
@@ -943,8 +943,8 @@ class V extends HTMLElement {
943
943
  Array.from(this.classList).forEach((o) => {
944
944
  !t.includes(o) && !i.includes(o) && this._userClasses.add(o);
945
945
  });
946
- const n = [.../* @__PURE__ */ new Set([...s, ...Array.from(this._userClasses)])];
947
- this.className = n.join(" ");
946
+ const r = [.../* @__PURE__ */ new Set([...s, ...Array.from(this._userClasses)])];
947
+ this.className = r.join(" ");
948
948
  const a = {
949
949
  heading: "clamp(1.25rem, 2.5vw + 0.5rem, 1.5rem)",
950
950
  // Scales between 1.25rem (20px) and 1.5rem (24px)
@@ -1029,10 +1029,10 @@ class R extends HTMLElement {
1029
1029
  "[&>mint-button>button]:!justify-start",
1030
1030
  "[&>mint-button>button]:!justify-center",
1031
1031
  "[&>mint-button>button]:!justify-end"
1032
- ].forEach((r) => this.classList.remove(r)), e.split(" ").forEach((r) => {
1033
- r && this.classList.add(r);
1034
- }), ["box-border", "m-0", "p-0", "border-0", "align-baseline", "block"].forEach((r) => {
1035
- this.classList.contains(r) || this.classList.add(r);
1032
+ ].forEach((n) => this.classList.remove(n)), e.split(" ").forEach((n) => {
1033
+ n && this.classList.add(n);
1034
+ }), ["box-border", "m-0", "p-0", "border-0", "align-baseline", "block"].forEach((n) => {
1035
+ this.classList.contains(n) || this.classList.add(n);
1036
1036
  }), t ? this._applyTextAlignToChildren(t) : this._removeTextAlignFromChildren();
1037
1037
  }
1038
1038
  _applyTextAlignToChildren(e) {
@@ -1041,8 +1041,8 @@ class R extends HTMLElement {
1041
1041
  const s = i.querySelector("button");
1042
1042
  if (s) {
1043
1043
  s.classList.remove("justify-start", "justify-center", "justify-end"), e === "left" ? s.classList.add("justify-start") : e === "right" ? s.classList.add("justify-end") : e === "center" && s.classList.add("justify-center");
1044
- const r = s.querySelector(".mint-button-content");
1045
- r && (r.classList.remove("text-left", "text-center", "text-right", "text-justify"), r.classList.add(`text-${e}`));
1044
+ const n = s.querySelector(".mint-button-content");
1045
+ n && (n.classList.remove("text-left", "text-center", "text-right", "text-justify"), n.classList.add(`text-${e}`));
1046
1046
  }
1047
1047
  } else
1048
1048
  i.classList.remove("text-left", "text-center", "text-right", "text-justify"), i.classList.add(`text-${e}`);
@@ -1202,7 +1202,7 @@ class Y extends HTMLElement {
1202
1202
  } catch {
1203
1203
  return !1;
1204
1204
  }
1205
- })(), r = new CustomEvent("back", {
1205
+ })(), n = new CustomEvent("back", {
1206
1206
  detail: {
1207
1207
  url: t,
1208
1208
  isFromReferrer: s,
@@ -1213,7 +1213,7 @@ class Y extends HTMLElement {
1213
1213
  cancelable: !0,
1214
1214
  composed: !0
1215
1215
  });
1216
- this.dispatchEvent(r);
1216
+ this.dispatchEvent(n);
1217
1217
  }
1218
1218
  render() {
1219
1219
  this._button || (this._button = document.createElement("mint-button"), this._button.setAttribute("variant", "neutral"), this._button.setAttribute("icon", "arrow-left"), this._button.addEventListener("click", (e) => this.handleClick(e)), this.appendChild(this._button));
@@ -1251,15 +1251,15 @@ class U extends HTMLElement {
1251
1251
  let t = this._titleElement.querySelector("mint-back-button");
1252
1252
  if (this.shouldShowBackButton()) {
1253
1253
  t || (t = document.createElement("mint-back-button"), this._titleElement.insertBefore(t, this._titleElement.firstChild));
1254
- const n = this.getFallbackHref();
1255
- t.setAttribute("fallback-href", n), this._backButton = t;
1254
+ const r = this.getFallbackHref();
1255
+ t.setAttribute("fallback-href", r), this._backButton = t;
1256
1256
  } else t && (t.remove(), t = null, this._backButton = null);
1257
1257
  e ? (this._headingText ? (this._headingText.classList.add("truncate", "min-w-0"), t && t.parentElement === this._titleElement ? this._headingText.previousSibling !== t && this._titleElement.insertBefore(this._headingText, t.nextSibling) : this._headingText.previousSibling && this._titleElement.insertBefore(this._headingText, this._titleElement.firstChild)) : (this._headingText = document.createElement("mint-text"), this._headingText.setAttribute("size", "heading"), this._headingText.setAttribute("bold", ""), this._headingText.classList.add("truncate", "min-w-0"), t && t.parentElement === this._titleElement ? this._titleElement.insertBefore(this._headingText, t.nextSibling) : this._titleElement.insertBefore(this._headingText, this._titleElement.firstChild)), this._headingText.textContent = e) : this._headingText && (this._headingText.remove(), this._headingText = null), this._actionsSlot ? this._actionsSlot.classList.contains("ml-4") || this._actionsSlot.classList.add("ml-4") : (this._actionsSlot = document.createElement("div"), this._actionsSlot.className = "flex gap-2 items-center ml-4", this._actionsSlot.setAttribute("slot", "actions"), this._header.appendChild(this._actionsSlot)), Array.from(this.children).filter(
1258
- (n) => n !== this._pageContainer && n !== this._actionsSlot && n.getAttribute("slot") === "actions"
1259
- ).forEach((n) => {
1260
- this._actionsSlot && n.parentElement !== this._actionsSlot && this._actionsSlot.appendChild(n);
1261
- }), this._bodySlot || (this._bodySlot = document.createElement("div"), this._pageContainer.appendChild(this._bodySlot)), Array.from(this.children).forEach((n) => {
1262
- n !== this._pageContainer && n.getAttribute("slot") !== "actions" && n !== this._actionsSlot && n !== this._header && n !== this._bodySlot && n !== this._headingText && n.parentElement !== this._bodySlot && n.parentElement !== this._pageContainer && this._bodySlot.appendChild(n);
1258
+ (r) => r !== this._pageContainer && r !== this._actionsSlot && r.getAttribute("slot") === "actions"
1259
+ ).forEach((r) => {
1260
+ this._actionsSlot && r.parentElement !== this._actionsSlot && this._actionsSlot.appendChild(r);
1261
+ }), this._bodySlot || (this._bodySlot = document.createElement("div"), this._pageContainer.appendChild(this._bodySlot)), Array.from(this.children).forEach((r) => {
1262
+ r !== this._pageContainer && r.getAttribute("slot") !== "actions" && r !== this._actionsSlot && r !== this._header && r !== this._bodySlot && r !== this._headingText && r.parentElement !== this._bodySlot && r.parentElement !== this._pageContainer && this._bodySlot.appendChild(r);
1263
1263
  }), this._updateBackgroundColor();
1264
1264
  }
1265
1265
  _applyContainerClasses() {
@@ -1335,10 +1335,10 @@ class G extends HTMLElement {
1335
1335
  i && e.push(`sm:grid-cols-${i}`);
1336
1336
  const s = this.getMd();
1337
1337
  s && e.push(`md:grid-cols-${s}`);
1338
- const r = this.getLg();
1339
- r && e.push(`lg:grid-cols-${r}`);
1340
- const n = this.getXl();
1341
- n && e.push(`xl:grid-cols-${n}`);
1338
+ const n = this.getLg();
1339
+ n && e.push(`lg:grid-cols-${n}`);
1340
+ const r = this.getXl();
1341
+ r && e.push(`xl:grid-cols-${r}`);
1342
1342
  const a = this.getGap();
1343
1343
  return e.push(`gap-${a}`), e;
1344
1344
  }
@@ -1391,8 +1391,8 @@ class J extends HTMLElement {
1391
1391
  this._animateExit();
1392
1392
  let s = this._modal.querySelector(".modal-content");
1393
1393
  s || (s = document.createElement("div"), s.className = "modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform", this._modal.appendChild(s)), this._header || (this._header = document.createElement("div"), this._header.className = "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700", s.appendChild(this._header)), this._headingSlot || (this._headingSlot = document.createElement("div"), this._headingSlot.className = "flex-1", this._headingSlot.setAttribute("slot", "heading"), this._header.appendChild(this._headingSlot));
1394
- let r = this._headingSlot.querySelector("mint-text");
1395
- t ? (r || (r = document.createElement("mint-text"), r.setAttribute("size", "sub-heading"), r.setAttribute("bold", ""), this._headingSlot.appendChild(r)), r.textContent = t) : r && r.remove(), Array.from(this.children).filter(
1394
+ let n = this._headingSlot.querySelector("mint-text");
1395
+ t ? (n || (n = document.createElement("mint-text"), n.setAttribute("size", "sub-heading"), n.setAttribute("bold", ""), this._headingSlot.appendChild(n)), n.textContent = t) : n && n.remove(), Array.from(this.children).filter(
1396
1396
  (c) => c !== this._overlay && c !== this._modal && c !== this._headingSlot && c.getAttribute("slot") === "heading"
1397
1397
  ).forEach((c) => {
1398
1398
  this._headingSlot && c.parentElement !== this._headingSlot && this._headingSlot.appendChild(c);
@@ -1558,36 +1558,36 @@ class X extends HTMLElement {
1558
1558
  const e = this._triggerElement.getBoundingClientRect(), t = this._popover.querySelector(".popover-content");
1559
1559
  if (!t) return { top: 0, left: 0, direction: "down" };
1560
1560
  this.classList.contains("hidden") && (this.classList.remove("hidden"), this._popover.style.visibility = "hidden");
1561
- const s = t.getBoundingClientRect(), r = window.innerWidth, n = window.innerHeight, a = 8;
1561
+ const s = t.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight, a = 8;
1562
1562
  let l = this.getDirection(), o = 0, h = 0;
1563
1563
  switch (l) {
1564
1564
  case "down":
1565
- if (o = e.bottom + a, h = e.left + e.width / 2 - s.width / 2, o + s.height > n) {
1565
+ if (o = e.bottom + a, h = e.left + e.width / 2 - s.width / 2, o + s.height > r) {
1566
1566
  const c = e.top - s.height - a;
1567
- c >= 0 ? (l = "up", o = c) : (o = Math.max(0, n - s.height - a), o + s.height > n && (o = 0));
1567
+ c >= 0 ? (l = "up", o = c) : (o = Math.max(0, r - s.height - a), o + s.height > r && (o = 0));
1568
1568
  }
1569
- h < 0 && (h = a), h + s.width > r && (h = Math.max(a, r - s.width - a), h + s.width > r && (h = r - s.width));
1569
+ h < 0 && (h = a), h + s.width > n && (h = Math.max(a, n - s.width - a), h + s.width > n && (h = n - s.width));
1570
1570
  break;
1571
1571
  case "up":
1572
1572
  if (o = e.top - s.height - a, h = e.left + e.width / 2 - s.width / 2, o < 0) {
1573
1573
  const c = e.bottom + a;
1574
- c + s.height <= n ? (l = "down", o = c) : (o = Math.min(n - s.height - a, n - s.height), o < 0 && (o = n - s.height));
1574
+ c + s.height <= r ? (l = "down", o = c) : (o = Math.min(r - s.height - a, r - s.height), o < 0 && (o = r - s.height));
1575
1575
  }
1576
- h < 0 && (h = a), h + s.width > r && (h = Math.max(a, r - s.width - a), h + s.width > r && (h = r - s.width));
1576
+ h < 0 && (h = a), h + s.width > n && (h = Math.max(a, n - s.width - a), h + s.width > n && (h = n - s.width));
1577
1577
  break;
1578
1578
  case "right":
1579
- if (o = e.top + e.height / 2 - s.height / 2, h = e.right + a, h + s.width > r) {
1579
+ if (o = e.top + e.height / 2 - s.height / 2, h = e.right + a, h + s.width > n) {
1580
1580
  const c = e.left - s.width - a;
1581
- c >= 0 ? (l = "left", h = c) : (h = Math.max(0, r - s.width - a), h + s.width > r && (h = r - s.width));
1581
+ c >= 0 ? (l = "left", h = c) : (h = Math.max(0, n - s.width - a), h + s.width > n && (h = n - s.width));
1582
1582
  }
1583
- o < 0 && (o = a), o + s.height > n && (o = Math.max(a, n - s.height - a), o + s.height > n && (o = n - s.height));
1583
+ o < 0 && (o = a), o + s.height > r && (o = Math.max(a, r - s.height - a), o + s.height > r && (o = r - s.height));
1584
1584
  break;
1585
1585
  case "left":
1586
1586
  if (o = e.top + e.height / 2 - s.height / 2, h = e.left - s.width - a, h < 0) {
1587
1587
  const c = e.right + a;
1588
- c + s.width <= r ? (l = "right", h = c) : (h = Math.min(r - s.width - a, r - s.width), h < 0 && (h = 0));
1588
+ c + s.width <= n ? (l = "right", h = c) : (h = Math.min(n - s.width - a, n - s.width), h < 0 && (h = 0));
1589
1589
  }
1590
- o < 0 && (o = a), o + s.height > n && (o = Math.max(a, n - s.height - a), o + s.height > n && (o = n - s.height));
1590
+ o < 0 && (o = a), o + s.height > r && (o = Math.max(a, r - s.height - a), o + s.height > r && (o = r - s.height));
1591
1591
  break;
1592
1592
  }
1593
1593
  return { top: o, left: h, direction: l };
@@ -1596,11 +1596,11 @@ class X extends HTMLElement {
1596
1596
  const e = this.getId(), t = this.isOpen(), i = this.getPadding();
1597
1597
  if (e && (this.id = e), t) {
1598
1598
  if (this.classList.remove("hidden"), this.style.pointerEvents = "auto", !this._clickOutsideHandler) {
1599
- const n = this;
1599
+ const r = this;
1600
1600
  this._clickOutsideHandler = function(a) {
1601
- const l = a.composedPath(), o = l.includes(n);
1602
- if (!(n._triggerElement && l.includes(n._triggerElement)) && !o) {
1603
- n.close();
1601
+ const l = a.composedPath(), o = l.includes(r);
1602
+ if (!(r._triggerElement && l.includes(r._triggerElement)) && !o) {
1603
+ r.close();
1604
1604
  return;
1605
1605
  }
1606
1606
  }, setTimeout(() => {
@@ -1614,11 +1614,11 @@ class X extends HTMLElement {
1614
1614
  if (!s)
1615
1615
  s = document.createElement("div"), s.className = `popover-content bg-white dark:bg-gray-800 rounded-lg shadow-xl ${i} transition-all duration-200 ease-out transform`, this._popover.appendChild(s);
1616
1616
  else {
1617
- const n = s.className.split(" "), a = ["p-0", "p-0.5", "p-1", "p-1.5", "p-2", "p-2.5", "p-3", "p-3.5", "p-4", "p-5", "p-6", "p-8", "p-10", "p-12", "p-16", "p-20", "p-24"], l = n.filter((o) => !a.includes(o));
1617
+ const r = s.className.split(" "), a = ["p-0", "p-0.5", "p-1", "p-1.5", "p-2", "p-2.5", "p-3", "p-3.5", "p-4", "p-5", "p-6", "p-8", "p-10", "p-12", "p-16", "p-20", "p-24"], l = r.filter((o) => !a.includes(o));
1618
1618
  s.className = [...l, i].join(" ");
1619
1619
  }
1620
- Array.from(this.children).forEach((n) => {
1621
- n !== this._overlay && n !== this._popover && n.parentElement === this && s.appendChild(n);
1620
+ Array.from(this.children).forEach((r) => {
1621
+ r !== this._overlay && r !== this._popover && r.parentElement === this && s.appendChild(r);
1622
1622
  }), t ? (this._triggerElement || this._setupTrigger(), this._setupPositionListeners(), this.offsetHeight, this._triggerElement ? this._updatePosition(s) : (this._popover.style.top = "50%", this._popover.style.left = "50%", this._popover.style.transform = "translate(-50%, -50%)", this._popover.style.visibility = "visible", this._popover.style.display = "block", s.style.transform = "scale(0.97) translateY(10px)", s.style.opacity = "0", s.style.transition = "all 200ms ease-out", requestAnimationFrame(() => {
1623
1623
  requestAnimationFrame(() => {
1624
1624
  s.style.transform = "scale(1) translateY(0)", s.style.opacity = "1";
@@ -1782,18 +1782,18 @@ class K extends HTMLElement {
1782
1782
  }
1783
1783
  render() {
1784
1784
  const e = this.isLoading(), t = this.getLabel(), i = this.getInfo(), s = this.isDisabled();
1785
- let r = this.querySelector(".mint-checkbox-container");
1786
- r || (r = document.createElement("div"), r.className = "mint-checkbox-container relative inline-flex items-start gap-2", this.insertBefore(r, this.firstChild));
1787
- let n = this.querySelector(".mint-checkbox-wrapper");
1788
- n ? n.parentElement !== r && r.appendChild(n) : (n = document.createElement("div"), n.className = "mint-checkbox-wrapper", r.appendChild(n)), this._checkbox ? this._checkbox.parentElement !== n && n.appendChild(this._checkbox) : (this._checkbox = document.createElement("input"), this._checkbox.type = "checkbox", n.appendChild(this._checkbox), this.setupEventListeners()), this._checkbox.className = "absolute inset-0 w-full h-full opacity-0 cursor-pointer", this._checkbox.style.cssText = "position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;", this._checkbox.checked = this._checked, this._checkbox.disabled = s, this._changeHandler || this.setupEventListeners();
1785
+ let n = this.querySelector(".mint-checkbox-container");
1786
+ n || (n = document.createElement("div"), n.className = "mint-checkbox-container relative inline-flex items-start gap-2", this.insertBefore(n, this.firstChild));
1787
+ let r = this.querySelector(".mint-checkbox-wrapper");
1788
+ r ? r.parentElement !== n && n.appendChild(r) : (r = document.createElement("div"), r.className = "mint-checkbox-wrapper", n.appendChild(r)), this._checkbox ? this._checkbox.parentElement !== r && r.appendChild(this._checkbox) : (this._checkbox = document.createElement("input"), this._checkbox.type = "checkbox", r.appendChild(this._checkbox), this.setupEventListeners()), this._checkbox.className = "absolute inset-0 w-full h-full opacity-0 cursor-pointer", this._checkbox.style.cssText = "position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;", this._checkbox.checked = this._checked, this._checkbox.disabled = s, this._changeHandler || this.setupEventListeners();
1789
1789
  const a = this.getId();
1790
1790
  a ? this._checkbox.id = a : this._checkbox.removeAttribute("id");
1791
1791
  const l = this.getName();
1792
1792
  l ? this._checkbox.name = l : this._checkbox.removeAttribute("name");
1793
1793
  const o = this.getValue();
1794
- o ? this._checkbox.value = o : this._checkbox.removeAttribute("value"), t ? this._checkbox.setAttribute("aria-label", t) : this._checkbox.removeAttribute("aria-label"), n.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`, n.style.pointerEvents = "none", this._checkbox.style.pointerEvents = "auto";
1795
- let h = n.querySelector("mint-icon");
1796
- h || (h = document.createElement("mint-icon"), h.setAttribute("name", "check"), h.className = "w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto", h.style.transition = "opacity 200ms ease-out, transform 200ms ease-out", h.style.zIndex = "1", n.appendChild(h)), this.updateVisualState();
1794
+ o ? this._checkbox.value = o : this._checkbox.removeAttribute("value"), t ? this._checkbox.setAttribute("aria-label", t) : this._checkbox.removeAttribute("aria-label"), r.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`, r.style.pointerEvents = "none", this._checkbox.style.pointerEvents = "auto";
1795
+ let h = r.querySelector("mint-icon");
1796
+ h || (h = document.createElement("mint-icon"), h.setAttribute("name", "check"), h.className = "w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto", h.style.transition = "opacity 200ms ease-out, transform 200ms ease-out", h.style.zIndex = "1", r.appendChild(h)), this.updateVisualState();
1797
1797
  let c = this.querySelector(".mint-checkbox-label-container");
1798
1798
  const u = this.querySelector(".mint-checkbox-container");
1799
1799
  if (t || i) {
@@ -1871,17 +1871,17 @@ class K extends HTMLElement {
1871
1871
  }
1872
1872
  _renderSkeleton(e) {
1873
1873
  let t = this.querySelector(".mint-checkbox-skeleton-container");
1874
- const i = this.querySelector(".mint-checkbox-container"), s = this.querySelector(".mint-checkbox-wrapper"), r = this.querySelector(".mint-checkbox-label-container");
1874
+ const i = this.querySelector(".mint-checkbox-container"), s = this.querySelector(".mint-checkbox-wrapper"), n = this.querySelector(".mint-checkbox-label-container");
1875
1875
  if (e) {
1876
1876
  t || (t = document.createElement("div"), t.className = "mint-checkbox-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2", i ? i.appendChild(t) : (this.style.position = "relative", this.appendChild(t)));
1877
- let n = t.querySelector(".mint-checkbox-skeleton-box");
1878
- if (n || (n = document.createElement("div"), n.className = "mint-checkbox-skeleton-box flex-shrink-0 w-5 h-5 rounded bg-gray-200 dark:bg-gray-700 animate-pulse", t.appendChild(n)), r) {
1877
+ let r = t.querySelector(".mint-checkbox-skeleton-box");
1878
+ if (r || (r = document.createElement("div"), r.className = "mint-checkbox-skeleton-box flex-shrink-0 w-5 h-5 rounded bg-gray-200 dark:bg-gray-700 animate-pulse", t.appendChild(r)), n) {
1879
1879
  let a = t.querySelector(".mint-checkbox-skeleton-label");
1880
1880
  a || (a = document.createElement("div"), a.className = "mint-checkbox-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-gray-700 animate-pulse", t.appendChild(a));
1881
1881
  }
1882
- t.style.display = "flex", s && (s.style.visibility = "hidden", s.style.pointerEvents = "none"), r && (r.style.visibility = "hidden", r.style.pointerEvents = "none");
1882
+ t.style.display = "flex", s && (s.style.visibility = "hidden", s.style.pointerEvents = "none"), n && (n.style.visibility = "hidden", n.style.pointerEvents = "none");
1883
1883
  } else
1884
- t && (t.style.display = "none"), s && (s.style.visibility = "visible", s.style.pointerEvents = "auto"), r && (r.style.visibility = "visible", r.style.pointerEvents = "auto");
1884
+ t && (t.style.display = "none"), s && (s.style.visibility = "visible", s.style.pointerEvents = "auto"), n && (n.style.visibility = "visible", n.style.pointerEvents = "auto");
1885
1885
  }
1886
1886
  _renderErrorState() {
1887
1887
  const e = this.hasError(), t = this.getErrorMessage();
@@ -1889,8 +1889,8 @@ class K extends HTMLElement {
1889
1889
  !i && e && t && (i = document.createElement("div"), i.className = "mint-checkbox-label-container flex flex-col gap-0.5 flex-1", this.appendChild(i));
1890
1890
  let s = this.querySelector(".mint-checkbox-error");
1891
1891
  e && t ? (s ? (s.classList.add("block", "w-full"), s.style.display = "block", (i && s.parentElement !== i || i && s.parentElement === i) && i.appendChild(s)) : (s = document.createElement("div"), s.className = "mint-checkbox-error text-xs text-red-600 dark:text-red-400 block w-full", s.style.display = "block", i ? i.appendChild(s) : this.appendChild(s)), s.textContent = t) : s && s.remove();
1892
- const r = this.querySelector(".mint-checkbox-wrapper");
1893
- r && (r.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`);
1892
+ const n = this.querySelector(".mint-checkbox-wrapper");
1893
+ n && (n.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`);
1894
1894
  }
1895
1895
  }
1896
1896
  customElements.get("mint-checkbox") || customElements.define("mint-checkbox", K);
@@ -1953,14 +1953,14 @@ class Z extends HTMLElement {
1953
1953
  }
1954
1954
  render() {
1955
1955
  var f;
1956
- const e = this.isLoading(), t = this.isDisabled(), i = this.getValue(), s = this.closest("mint-choice"), r = (s == null ? void 0 : s.getAttribute("name")) || "";
1957
- let n = "";
1956
+ const e = this.isLoading(), t = this.isDisabled(), i = this.getValue(), s = this.closest("mint-choice"), n = (s == null ? void 0 : s.getAttribute("name")) || "";
1957
+ let r = "";
1958
1958
  const a = this.querySelector(".mint-choice-option-label");
1959
- a ? n = ((f = a.textContent) == null ? void 0 : f.trim()) || "" : Array.from(this.childNodes).forEach((p) => {
1959
+ a ? r = ((f = a.textContent) == null ? void 0 : f.trim()) || "" : Array.from(this.childNodes).forEach((p) => {
1960
1960
  var m;
1961
1961
  if (p.nodeType === Node.TEXT_NODE) {
1962
1962
  const k = (m = p.textContent) == null ? void 0 : m.trim();
1963
- k && (n += k);
1963
+ k && (r += k);
1964
1964
  }
1965
1965
  });
1966
1966
  const l = this.querySelectorAll(".mint-choice-option-wrapper");
@@ -2005,16 +2005,16 @@ class Z extends HTMLElement {
2005
2005
  this.isDisabled() || (m.key === "ArrowDown" || m.key === "ArrowRight" ? (m.preventDefault(), this._focusNextOption()) : (m.key === "ArrowUp" || m.key === "ArrowLeft") && (m.preventDefault(), this._focusPreviousOption()));
2006
2006
  }, this._radio.addEventListener("keydown", this._keydownHandler);
2007
2007
  }
2008
- this._radio.name = r, this._radio.value = i, this._radio.checked !== this._checked ? (this._checked = this._radio.checked, this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked")) : this._radio.checked = this._checked, this._radio.disabled = t, t ? this._radio.setAttribute("tabindex", "-1") : this._radio.removeAttribute("tabindex"), n ? this._radio.setAttribute("aria-label", n) : this._radio.removeAttribute("aria-label"), o.querySelectorAll(".mint-choice-option-indicator").forEach((p, m) => {
2008
+ this._radio.name = n, this._radio.value = i, this._radio.checked !== this._checked ? (this._checked = this._radio.checked, this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked")) : this._radio.checked = this._checked, this._radio.disabled = t, t ? this._radio.setAttribute("tabindex", "-1") : this._radio.removeAttribute("tabindex"), r ? this._radio.setAttribute("aria-label", r) : this._radio.removeAttribute("aria-label"), o.querySelectorAll(".mint-choice-option-indicator").forEach((p, m) => {
2009
2009
  m > 0 && p.remove();
2010
2010
  });
2011
2011
  let u = o.querySelector(".mint-choice-option-indicator");
2012
2012
  u || (u = document.createElement("div"), u.className = "mint-choice-option-indicator", o.appendChild(u)), u.className = "mint-choice-option-indicator w-2 h-2 rounded-full bg-white transition-all duration-200 pointer-events-none", u.style.position = "absolute", u.style.top = "50%", u.style.left = "50%", u.style.transform = this._checked ? "translate(-50%, -50%) scale(1)" : "translate(-50%, -50%) scale(0)", u.style.opacity = this._checked ? "1" : "0", this._updateVisualState(), this._renderSkeleton(e);
2013
2013
  let d = this.querySelector(".mint-choice-option-label");
2014
- n && (d || (d = document.createElement("span"), d.className = "mint-choice-option-label", this.appendChild(d), Array.from(this.childNodes).forEach((p) => {
2014
+ r && (d || (d = document.createElement("span"), d.className = "mint-choice-option-label", this.appendChild(d), Array.from(this.childNodes).forEach((p) => {
2015
2015
  var m;
2016
2016
  p.nodeType === Node.TEXT_NODE && ((m = p.textContent) != null && m.trim()) && (p.textContent = "");
2017
- })), d.className = `mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${t ? "opacity-40" : ""}`, d.textContent = n), t ? (this.classList.add("cursor-not-allowed"), this.classList.remove("cursor-pointer")) : (this.classList.add("cursor-pointer"), this.classList.remove("cursor-not-allowed")), this._updateVisualState();
2017
+ })), d.className = `mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${t ? "opacity-40" : ""}`, d.textContent = r), t ? (this.classList.add("cursor-not-allowed"), this.classList.remove("cursor-pointer")) : (this.classList.add("cursor-pointer"), this.classList.remove("cursor-not-allowed")), this._updateVisualState();
2018
2018
  }
2019
2019
  _getWrapperClasses() {
2020
2020
  const e = this.isDisabled(), t = [
@@ -2054,13 +2054,13 @@ class Z extends HTMLElement {
2054
2054
  t || (t = document.createElement("div"), t.className = "mint-choice-option-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2", i ? (i.classList.contains("relative") || i.classList.add("relative"), i.appendChild(t)) : (this.style.position = "relative", this.appendChild(t)));
2055
2055
  let s = t.querySelector(".mint-choice-option-skeleton-radio");
2056
2056
  if (s || (s = document.createElement("div"), s.className = "mint-choice-option-skeleton-radio flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse", t.appendChild(s)), t.style.display = "flex", i) {
2057
- const r = i.querySelector('input[type="radio"]'), n = i.querySelector(".mint-choice-option-indicator");
2058
- r && (r.style.visibility = "hidden"), n && (n.style.visibility = "hidden"), i.style.pointerEvents = "none";
2057
+ const n = i.querySelector('input[type="radio"]'), r = i.querySelector(".mint-choice-option-indicator");
2058
+ n && (n.style.visibility = "hidden"), r && (r.style.visibility = "hidden"), i.style.pointerEvents = "none";
2059
2059
  }
2060
2060
  } else {
2061
2061
  if (t && (t.style.display = "none"), i) {
2062
- const r = i.querySelector('input[type="radio"]'), n = i.querySelector(".mint-choice-option-indicator");
2063
- r && (r.style.visibility = "visible"), n && (n.style.visibility = "visible"), i.style.pointerEvents = "auto";
2062
+ const n = i.querySelector('input[type="radio"]'), r = i.querySelector(".mint-choice-option-indicator");
2063
+ n && (n.style.visibility = "visible"), r && (r.style.visibility = "visible"), i.style.pointerEvents = "auto";
2064
2064
  }
2065
2065
  const s = this.querySelector(".mint-choice-option-label");
2066
2066
  s && !(i != null && i.contains(s)) && (s.style.visibility = "visible", s.style.pointerEvents = "auto");
@@ -2082,21 +2082,21 @@ class Z extends HTMLElement {
2082
2082
  if (!((s = this._radio) != null && s.name)) return;
2083
2083
  const e = Array.from(document.querySelectorAll(
2084
2084
  `input[type="radio"][name="${this._radio.name}"]`
2085
- )).filter((r) => !r.disabled), t = e.indexOf(this._radio);
2085
+ )).filter((n) => !n.disabled), t = e.indexOf(this._radio);
2086
2086
  let i = null;
2087
2087
  if (t >= 0 && t < e.length - 1 ? i = e[t + 1] : e.length > 0 && (i = e[0]), i) {
2088
- const r = i.closest("mint-choice-option");
2089
- if (i.checked = !0, r) {
2090
- const n = r._checked;
2091
- if (r._checked = !0, r.setAttribute("checked", ""), r._changeHandler) {
2088
+ const n = i.closest("mint-choice-option");
2089
+ if (i.checked = !0, n) {
2090
+ const r = n._checked;
2091
+ if (n._checked = !0, n.setAttribute("checked", ""), n._changeHandler) {
2092
2092
  const l = new Event("change", { bubbles: !0 });
2093
- r._changeHandler.call(r, l);
2093
+ n._changeHandler.call(n, l);
2094
2094
  } else
2095
- r._updateVisualState(), r._updateGroupState();
2096
- const a = r.closest("mint-choice");
2097
- a && !n && setTimeout(() => {
2095
+ n._updateVisualState(), n._updateGroupState();
2096
+ const a = n.closest("mint-choice");
2097
+ a && !r && setTimeout(() => {
2098
2098
  a.dispatchEvent(new CustomEvent("choice-change", {
2099
- detail: { checked: !0, value: r.getValue() },
2099
+ detail: { checked: !0, value: n.getValue() },
2100
2100
  bubbles: !0,
2101
2101
  cancelable: !0
2102
2102
  }));
@@ -2110,21 +2110,21 @@ class Z extends HTMLElement {
2110
2110
  if (!((s = this._radio) != null && s.name)) return;
2111
2111
  const e = Array.from(document.querySelectorAll(
2112
2112
  `input[type="radio"][name="${this._radio.name}"]`
2113
- )).filter((r) => !r.disabled), t = e.indexOf(this._radio);
2113
+ )).filter((n) => !n.disabled), t = e.indexOf(this._radio);
2114
2114
  let i = null;
2115
2115
  if (t > 0 ? i = e[t - 1] : e.length > 0 && (i = e[e.length - 1]), i) {
2116
- const r = i.closest("mint-choice-option");
2117
- if (i.checked = !0, r) {
2118
- const n = r._checked;
2119
- if (r._checked = !0, r.setAttribute("checked", ""), r._changeHandler) {
2116
+ const n = i.closest("mint-choice-option");
2117
+ if (i.checked = !0, n) {
2118
+ const r = n._checked;
2119
+ if (n._checked = !0, n.setAttribute("checked", ""), n._changeHandler) {
2120
2120
  const l = new Event("change", { bubbles: !0 });
2121
- r._changeHandler.call(r, l);
2121
+ n._changeHandler.call(n, l);
2122
2122
  } else
2123
- r._updateVisualState(), r._updateGroupState();
2124
- const a = r.closest("mint-choice");
2125
- a && !n && setTimeout(() => {
2123
+ n._updateVisualState(), n._updateGroupState();
2124
+ const a = n.closest("mint-choice");
2125
+ a && !r && setTimeout(() => {
2126
2126
  a.dispatchEvent(new CustomEvent("choice-change", {
2127
- detail: { checked: !0, value: r.getValue() },
2127
+ detail: { checked: !0, value: n.getValue() },
2128
2128
  bubbles: !0,
2129
2129
  cancelable: !0
2130
2130
  }));
@@ -2151,10 +2151,10 @@ class Q extends HTMLElement {
2151
2151
  return this.hasAttribute("loading");
2152
2152
  }
2153
2153
  attributeChangedCallback(e, t, i) {
2154
- t !== i && (e === "error" || e === "error-message" ? this._renderErrorState() : e === "loading" ? (this.render(), this.querySelectorAll("mint-choice-option").forEach((r) => {
2155
- this.isLoading() ? r.setAttribute("loading", "") : r.removeAttribute("loading");
2156
- })) : (this.render(), e === "name" && this.querySelectorAll("mint-choice-option").forEach((r) => {
2157
- typeof r.render == "function" && r.render();
2154
+ t !== i && (e === "error" || e === "error-message" ? this._renderErrorState() : e === "loading" ? (this.render(), this.querySelectorAll("mint-choice-option").forEach((n) => {
2155
+ this.isLoading() ? n.setAttribute("loading", "") : n.removeAttribute("loading");
2156
+ })) : (this.render(), e === "name" && this.querySelectorAll("mint-choice-option").forEach((n) => {
2157
+ typeof n.render == "function" && n.render();
2158
2158
  })));
2159
2159
  }
2160
2160
  getLabel() {
@@ -2189,23 +2189,23 @@ class Q extends HTMLElement {
2189
2189
  const t = this.querySelectorAll("mint-choice-option");
2190
2190
  t.forEach((i) => {
2191
2191
  if ((i.getAttribute("value") || "") === e) {
2192
- const r = i;
2193
- r.checked = !0;
2194
- const n = i.querySelector('input[type="radio"]');
2195
- n && (n.checked = !0, n.dispatchEvent(new Event("change", { bubbles: !0 })));
2192
+ const n = i;
2193
+ n.checked = !0;
2194
+ const r = i.querySelector('input[type="radio"]');
2195
+ r && (r.checked = !0, r.dispatchEvent(new Event("change", { bubbles: !0 })));
2196
2196
  } else {
2197
- const r = i;
2198
- r.checked = !1;
2199
- const n = i.querySelector('input[type="radio"]');
2200
- n && (n.checked = !1);
2197
+ const n = i;
2198
+ n.checked = !1;
2199
+ const r = i.querySelector('input[type="radio"]');
2200
+ r && (r.checked = !1);
2201
2201
  }
2202
2202
  }), requestAnimationFrame(() => {
2203
2203
  t.forEach((i) => {
2204
2204
  typeof i._updateVisualState == "function" && i._updateVisualState();
2205
2205
  const s = i.querySelector('input[type="radio"]');
2206
2206
  if (s) {
2207
- const r = i;
2208
- s.checked !== r.checked && (s.checked = r.checked);
2207
+ const n = i;
2208
+ s.checked !== n.checked && (s.checked = n.checked);
2209
2209
  }
2210
2210
  });
2211
2211
  });
@@ -2213,15 +2213,15 @@ class Q extends HTMLElement {
2213
2213
  render() {
2214
2214
  const e = this.isLoading(), t = this.getLabel(), i = this.getInfo(), s = this.getId() || `mint-choice-${Math.random().toString(36).substr(2, 9)}`;
2215
2215
  this.getId() || this.setAttribute("id", s);
2216
- const r = this.isDisabled();
2217
- let n = this.querySelector(".mint-choice-label-container");
2216
+ const n = this.isDisabled();
2217
+ let r = this.querySelector(".mint-choice-label-container");
2218
2218
  if (t || i) {
2219
- n || (n = document.createElement("div"), n.className = "mint-choice-label-container flex flex-col gap-0.5 mb-2", this.insertBefore(n, this.firstChild));
2220
- let o = n.querySelector(".mint-choice-label");
2221
- t ? (o || (o = document.createElement("label"), o.className = "mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", n.insertBefore(o, n.firstChild)), o.textContent = t, o.setAttribute("for", s), r ? o.classList.add("opacity-40") : o.classList.remove("opacity-40")) : o && o.remove();
2222
- let h = n.querySelector(".mint-choice-info");
2223
- i ? (h || (h = document.createElement("span"), h.className = "mint-choice-info text-xs text-gray-500 dark:text-gray-400 select-none", n.appendChild(h)), h.textContent = i, r ? h.classList.add("opacity-40") : h.classList.remove("opacity-40")) : h && h.remove();
2224
- } else n && n.remove();
2219
+ r || (r = document.createElement("div"), r.className = "mint-choice-label-container flex flex-col gap-0.5 mb-2", this.insertBefore(r, this.firstChild));
2220
+ let o = r.querySelector(".mint-choice-label");
2221
+ t ? (o || (o = document.createElement("label"), o.className = "mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", r.insertBefore(o, r.firstChild)), o.textContent = t, o.setAttribute("for", s), n ? o.classList.add("opacity-40") : o.classList.remove("opacity-40")) : o && o.remove();
2222
+ let h = r.querySelector(".mint-choice-info");
2223
+ i ? (h || (h = document.createElement("span"), h.className = "mint-choice-info text-xs text-gray-500 dark:text-gray-400 select-none", r.appendChild(h)), h.textContent = i, n ? h.classList.add("opacity-40") : h.classList.remove("opacity-40")) : h && h.remove();
2224
+ } else r && r.remove();
2225
2225
  let a = this.querySelector(".mint-choice-options-wrapper");
2226
2226
  if (!a) {
2227
2227
  a = document.createElement("div"), a.className = "mint-choice-options-wrapper relative";
@@ -2239,7 +2239,7 @@ class Q extends HTMLElement {
2239
2239
  const i = this.querySelector(".mint-choice-options-wrapper"), s = this.querySelector(".mint-choice-options-container");
2240
2240
  if (e) {
2241
2241
  if (t || (t = document.createElement("div"), t.className = "mint-choice-skeleton-container absolute inset-0 z-10 pointer-events-none flex flex-col gap-3", i ? i.appendChild(t) : (this.style.position = "relative", this.appendChild(t))), t.querySelectorAll(".mint-choice-option-skeleton").length === 0)
2242
- for (let n = 0; n < 3; n++) {
2242
+ for (let r = 0; r < 3; r++) {
2243
2243
  const a = document.createElement("div");
2244
2244
  a.className = "mint-choice-option-skeleton flex items-center gap-3";
2245
2245
  const l = document.createElement("div");
@@ -2351,7 +2351,7 @@ class ee extends HTMLElement {
2351
2351
  return this.getAttribute("info") || "";
2352
2352
  }
2353
2353
  getInputClasses() {
2354
- const e = this._isTextarea(), t = !!this.getIcon(), i = this._isColor(), s = this._isNumber(), r = this.hasError(), n = [
2354
+ const e = this._isTextarea(), t = !!this.getIcon(), i = this._isColor(), s = this._isNumber(), n = this.hasError(), r = [
2355
2355
  "w-full",
2356
2356
  t || i ? "pl-10" : "px-3.5",
2357
2357
  t || i ? "pr-3.5" : s ? "pr-10" : "",
@@ -2378,13 +2378,13 @@ class ee extends HTMLElement {
2378
2378
  s ? "[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none" : ""
2379
2379
  ], a = [
2380
2380
  "border-2",
2381
- r ? "border-red-300 dark:border-red-300" : "border-gray-200 dark:border-gray-600"
2381
+ n ? "border-red-300 dark:border-red-300" : "border-gray-200 dark:border-gray-600"
2382
2382
  ], l = [
2383
2383
  "focus-visible:ring-2",
2384
2384
  "focus-visible:ring-offset-1",
2385
- r ? "focus-visible:ring-red-400 dark:focus-visible:ring-red-500" : "focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500"
2385
+ n ? "focus-visible:ring-red-400 dark:focus-visible:ring-red-500" : "focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500"
2386
2386
  ];
2387
- return [...n, ...a, ...l].filter(Boolean).join(" ");
2387
+ return [...r, ...a, ...l].filter(Boolean).join(" ");
2388
2388
  }
2389
2389
  isLoading() {
2390
2390
  return this.hasAttribute("loading");
@@ -2392,7 +2392,7 @@ class ee extends HTMLElement {
2392
2392
  render() {
2393
2393
  var E, C, v, y;
2394
2394
  this.getType();
2395
- const e = this._getNormalizedType(), t = this._isTextarea(), i = this._isMoney(), s = this._isColor(), r = this.getPlaceholder(), n = this.isDisabled(), a = this.isReadonly(), l = this.isRequired(), o = this.getId(), h = this.getName(), c = this.getAttribute("value") || (s ? "#000000" : ""), u = this.getRows(), d = this.getIcon(), f = this.getLabel(), p = this.getInfo(), m = this.isLoading();
2395
+ const e = this._getNormalizedType(), t = this._isTextarea(), i = this._isMoney(), s = this._isColor(), n = this.getPlaceholder(), r = this.isDisabled(), a = this.isReadonly(), l = this.isRequired(), o = this.getId(), h = this.getName(), c = this.getAttribute("value") || (s ? "#000000" : ""), u = this.getRows(), d = this.getIcon(), f = this.getLabel(), p = this.getInfo(), m = this.isLoading();
2396
2396
  if (this._renderSkeleton(m), s) {
2397
2397
  this._input && (this._input.remove(), this._input = null), this._textarea && (this._textarea.remove(), this._textarea = null), this._wrapper || (this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper)), this._colorContainer && (this._colorContainer.remove(), this._colorContainer = null), this._colorPickerWrapper && !s && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null), this._colorPickerWrapper || (this._colorPickerWrapper = document.createElement("div"), this._colorPickerWrapper.className = "mint-color-picker-wrapper absolute left-[.65rem] top-1/2 -translate-y-1/2 w-6 h-6 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", this._colorPickerWrapper.style.backgroundColor = c || "#000000", this._wrapper.appendChild(this._colorPickerWrapper), this._colorPicker = document.createElement("input"), this._colorPicker.type = "color", this._colorPicker.className = "absolute inset-0 w-full h-full opacity-0 cursor-pointer", this._colorPicker.style.cssText = "position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0; border: none;", this._colorPickerWrapper.appendChild(this._colorPicker), this._focusHandler = (g) => {
2398
2398
  this._colorPickerWrapper && this._colorPicker && this._colorPicker.matches(":focus-visible") && requestAnimationFrame(() => {
@@ -2417,7 +2417,7 @@ class ee extends HTMLElement {
2417
2417
  bubbles: !0,
2418
2418
  cancelable: !0
2419
2419
  }));
2420
- })), this._colorTextInput || (this._colorTextInput = document.createElement("input"), this._colorTextInput.type = "text", this._colorTextInput.className = this.getInputClasses(), this._colorTextInput.placeholder = r || "#000000", this._colorTextInput.pattern = "^#[0-9A-Fa-f]{6}$", this._wrapper.appendChild(this._colorTextInput), this._colorTextInput.addEventListener("input", () => {
2420
+ })), this._colorTextInput || (this._colorTextInput = document.createElement("input"), this._colorTextInput.type = "text", this._colorTextInput.className = this.getInputClasses(), this._colorTextInput.placeholder = n || "#000000", this._colorTextInput.pattern = "^#[0-9A-Fa-f]{6}$", this._wrapper.appendChild(this._colorTextInput), this._colorTextInput.addEventListener("input", () => {
2421
2421
  var x;
2422
2422
  const g = ((x = this._colorTextInput) == null ? void 0 : x.value) || "";
2423
2423
  /^#[0-9A-Fa-f]{6}$/.test(g) && (this._colorPicker && (this._colorPicker.value = g), this.setAttribute("value", g), this.dispatchEvent(new CustomEvent("input", {
@@ -2435,7 +2435,7 @@ class ee extends HTMLElement {
2435
2435
  }));
2436
2436
  }));
2437
2437
  const b = c || "#000000";
2438
- if (this._colorPicker && this._colorPicker.value !== b && (this._colorPicker.value = b), this._colorPickerWrapper && (this._colorPickerWrapper.style.backgroundColor = b), this._colorTextInput && this._colorTextInput.value !== b && (this._colorTextInput.value = b), this._colorPicker && (this._colorPicker.disabled = n), this._colorPickerWrapper && (n ? (this._colorPickerWrapper.classList.add("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.remove("cursor-pointer")) : (this._colorPickerWrapper.classList.remove("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.add("cursor-pointer"))), this._colorTextInput && (this._colorTextInput.disabled = n, this._colorTextInput.readOnly = a, this._colorTextInput.required = l), this._colorTextInput) {
2438
+ if (this._colorPicker && this._colorPicker.value !== b && (this._colorPicker.value = b), this._colorPickerWrapper && (this._colorPickerWrapper.style.backgroundColor = b), this._colorTextInput && this._colorTextInput.value !== b && (this._colorTextInput.value = b), this._colorPicker && (this._colorPicker.disabled = r), this._colorPickerWrapper && (r ? (this._colorPickerWrapper.classList.add("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.remove("cursor-pointer")) : (this._colorPickerWrapper.classList.remove("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.add("cursor-pointer"))), this._colorTextInput && (this._colorTextInput.disabled = r, this._colorTextInput.readOnly = a, this._colorTextInput.required = l), this._colorTextInput) {
2439
2439
  const g = this._colorTextInput;
2440
2440
  o ? g.id = o : g.removeAttribute("id"), h ? g.name = h : g.removeAttribute("name"), g.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), this._element = g;
2441
2441
  }
@@ -2462,14 +2462,14 @@ class ee extends HTMLElement {
2462
2462
  }
2463
2463
  });
2464
2464
  }
2465
- this._numberIncrementButton && (this._numberIncrementButton.disabled = n || a), this._numberDecrementButton && (this._numberDecrementButton.disabled = n || a);
2465
+ this._numberIncrementButton && (this._numberIncrementButton.disabled = r || a), this._numberDecrementButton && (this._numberDecrementButton.disabled = r || a);
2466
2466
  } else this._numberSpinnerContainer && (this._numberSpinnerContainer.remove(), this._numberSpinnerContainer = null, this._numberIncrementButton = null, this._numberDecrementButton = null);
2467
2467
  if (t) {
2468
- if (this._input && (this._input.remove(), this._input = null), this._textarea || (this._textarea = document.createElement("textarea"), this._wrapper.appendChild(this._textarea), this.setupEventListeners()), this._element = this._textarea, this._textarea.placeholder = r, this._textarea.disabled = n, this._textarea.readOnly = a, this._textarea.required = l, this._textarea.rows = u, this._textarea.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), c !== this._textarea.value && (this._textarea.value = c), o ? this._textarea.id = o : this._textarea.removeAttribute("id"), h ? this._textarea.name = h : this._textarea.removeAttribute("name"), this._textarea.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
2468
+ if (this._input && (this._input.remove(), this._input = null), this._textarea || (this._textarea = document.createElement("textarea"), this._wrapper.appendChild(this._textarea), this.setupEventListeners()), this._element = this._textarea, this._textarea.placeholder = n, this._textarea.disabled = r, this._textarea.readOnly = a, this._textarea.required = l, this._textarea.rows = u, this._textarea.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), c !== this._textarea.value && (this._textarea.value = c), o ? this._textarea.id = o : this._textarea.removeAttribute("id"), h ? this._textarea.name = h : this._textarea.removeAttribute("name"), this._textarea.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
2469
2469
  const b = this.firstChild.textContent;
2470
2470
  b && !this._textarea.value && (this._textarea.value = b.trim()), this.removeChild(this.firstChild);
2471
2471
  }
2472
- } else if (this._textarea && (this._textarea.remove(), this._textarea = null), this._input || (this._input = document.createElement("input"), this._wrapper.appendChild(this._input), this.setupEventListeners()), this._element = this._input, this._input.type = e, this._input.placeholder = r, this._input.disabled = n, this._input.readOnly = a, this._input.required = l, this._input.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), i ? (this._input.inputMode = "decimal", this._input.pattern = "[0-9]*\\.?[0-9]*") : (this._input.removeAttribute("inputmode"), this._input.removeAttribute("pattern")), c !== this._input.value && (this._input.value = c), o ? this._input.id = o : this._input.removeAttribute("id"), h ? this._input.name = h : this._input.removeAttribute("name"), this._input.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
2472
+ } else if (this._textarea && (this._textarea.remove(), this._textarea = null), this._input || (this._input = document.createElement("input"), this._wrapper.appendChild(this._input), this.setupEventListeners()), this._element = this._input, this._input.type = e, this._input.placeholder = n, this._input.disabled = r, this._input.readOnly = a, this._input.required = l, this._input.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), i ? (this._input.inputMode = "decimal", this._input.pattern = "[0-9]*\\.?[0-9]*") : (this._input.removeAttribute("inputmode"), this._input.removeAttribute("pattern")), c !== this._input.value && (this._input.value = c), o ? this._input.id = o : this._input.removeAttribute("id"), h ? this._input.name = h : this._input.removeAttribute("name"), this._input.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
2473
2473
  const b = this.firstChild.textContent;
2474
2474
  b && !this._input.value && (this._input.value = b.trim()), this.removeChild(this.firstChild);
2475
2475
  }
@@ -2486,10 +2486,10 @@ class ee extends HTMLElement {
2486
2486
  const w = `mint-input-${Math.random().toString(36).substr(2, 9)}`;
2487
2487
  this._element ? this._element.id = w : this._colorTextInput ? this._colorTextInput.id = w : this._input ? this._input.id = w : this._textarea && (this._textarea.id = w), b.setAttribute("for", w);
2488
2488
  }
2489
- n ? b.classList.add("opacity-40") : b.classList.remove("opacity-40");
2489
+ r ? b.classList.add("opacity-40") : b.classList.remove("opacity-40");
2490
2490
  } else b && b.remove();
2491
2491
  let g = _.querySelector(".mint-input-info");
2492
- p ? (g || (g = document.createElement("span"), g.className = "mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none", _.appendChild(g)), g.textContent = p, n ? g.classList.add("opacity-40") : g.classList.remove("opacity-40")) : g && g.remove();
2492
+ p ? (g || (g = document.createElement("span"), g.className = "mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none", _.appendChild(g)), g.textContent = p, r ? g.classList.add("opacity-40") : g.classList.remove("opacity-40")) : g && g.remove();
2493
2493
  } else _ && _.remove();
2494
2494
  this._renderErrorState(), this._renderSkeleton(m);
2495
2495
  }
@@ -2536,9 +2536,9 @@ class ee extends HTMLElement {
2536
2536
  let s = t.querySelector(".mint-input-skeleton");
2537
2537
  if (!s) {
2538
2538
  s = document.createElement("div"), s.className = "mint-input-skeleton w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse";
2539
- const r = this._isTextarea(), n = this.getRows();
2540
- if (r) {
2541
- const a = n * 24 + 12;
2539
+ const n = this._isTextarea(), r = this.getRows();
2540
+ if (n) {
2541
+ const a = r * 24 + 12;
2542
2542
  s.style.height = `${a}px`;
2543
2543
  } else
2544
2544
  s.style.height = "2.2rem";
@@ -2572,8 +2572,8 @@ class te extends HTMLElement {
2572
2572
  attributeChangedCallback(e, t, i) {
2573
2573
  if (t !== i) {
2574
2574
  if (e === "error" || e === "error-message") {
2575
- const s = this.hasError(), r = this.getErrorMessage();
2576
- this._applyErrorVisuals(s, r, this.isDisabled());
2575
+ const s = this.hasError(), n = this.getErrorMessage();
2576
+ this._applyErrorVisuals(s, n, this.isDisabled());
2577
2577
  return;
2578
2578
  }
2579
2579
  if (e === "loading") {
@@ -2647,9 +2647,9 @@ class te extends HTMLElement {
2647
2647
  if (i && typeof window[i] == "function") {
2648
2648
  const s = window[i]();
2649
2649
  if (Array.isArray(s))
2650
- return s.map((r) => ({
2651
- label: r.label,
2652
- action: typeof r.action == "function" ? r.action : this._createShortcutAction(r.action)
2650
+ return s.map((n) => ({
2651
+ label: n.label,
2652
+ action: typeof n.action == "function" ? n.action : this._createShortcutAction(n.action)
2653
2653
  }));
2654
2654
  }
2655
2655
  }
@@ -2671,8 +2671,8 @@ class te extends HTMLElement {
2671
2671
  action: () => {
2672
2672
  const t = /* @__PURE__ */ new Date(), i = t.getDay(), s = new Date(t);
2673
2673
  s.setDate(t.getDate() - i), s.setHours(0, 0, 0, 0);
2674
- const r = new Date(s);
2675
- return r.setDate(s.getDate() + 6), r.setHours(23, 59, 59, 999), { start: s, end: r };
2674
+ const n = new Date(s);
2675
+ return n.setDate(s.getDate() + 6), n.setHours(23, 59, 59, 999), { start: s, end: n };
2676
2676
  }
2677
2677
  },
2678
2678
  {
@@ -2689,28 +2689,28 @@ class te extends HTMLElement {
2689
2689
  let i = 0;
2690
2690
  const s = e.toLowerCase();
2691
2691
  for (; i < s.length; ) {
2692
- const r = s[i];
2693
- if (r === "d" || r === "m" || r === "y") {
2694
- let n = 1, a = i + 1;
2695
- for (; a < s.length && s[a] === r; )
2696
- n++, a++;
2697
- t.push({ type: "part", part: r, len: n }), i = a;
2692
+ const n = s[i];
2693
+ if (n === "d" || n === "m" || n === "y") {
2694
+ let r = 1, a = i + 1;
2695
+ for (; a < s.length && s[a] === n; )
2696
+ r++, a++;
2697
+ t.push({ type: "part", part: n, len: r }), i = a;
2698
2698
  } else
2699
2699
  t.push({ type: "sep", value: e[i] }), i++;
2700
2700
  }
2701
2701
  return t;
2702
2702
  }
2703
- _createPartInput(e, t, i, s, r) {
2704
- const n = document.createElement("input");
2705
- return n.type = "text", n.inputMode = "numeric", n.pattern = "\\d*", n.maxLength = e, n.placeholder = t, n.className = "bg-transparent border-none outline-none text-center text-sm font-medium p-0 m-0 focus:outline-none focus:ring-0 disabled:opacity-40 disabled:cursor-not-allowed", n.disabled = i || s, n.readOnly = s, n.required = r, e === 4 ? n.className += " w-[40px]" : e === 2 && (n.className += " w-[30px]"), n;
2703
+ _createPartInput(e, t, i, s, n) {
2704
+ const r = document.createElement("input");
2705
+ return r.type = "text", r.inputMode = "numeric", r.pattern = "\\d*", r.maxLength = e, r.placeholder = t, r.className = "bg-transparent border-none outline-none text-center text-sm font-medium p-0 m-0 focus:outline-none focus:ring-0 disabled:opacity-40 disabled:cursor-not-allowed", r.disabled = i || s, r.readOnly = s, r.required = n, e === 4 ? r.className += " w-[40px]" : e === 2 && (r.className += " w-[30px]"), r;
2706
2706
  }
2707
2707
  _buildValueFromParts(e, t) {
2708
2708
  let i = 0;
2709
2709
  return t.map((s) => {
2710
- var n;
2710
+ var r;
2711
2711
  if (s.type === "sep") return s.value;
2712
- const r = ((n = e[i]) == null ? void 0 : n.value) || "";
2713
- return i++, r;
2712
+ const n = ((r = e[i]) == null ? void 0 : r.value) || "";
2713
+ return i++, n;
2714
2714
  }).join("");
2715
2715
  }
2716
2716
  _applyDateToParts(e, t, i, s) {
@@ -2719,14 +2719,14 @@ class te extends HTMLElement {
2719
2719
  t.forEach((l) => l.value = "");
2720
2720
  return;
2721
2721
  }
2722
- const r = this._formatDate(e, s);
2723
- let n = 0, a = 0;
2722
+ const n = this._formatDate(e, s);
2723
+ let r = 0, a = 0;
2724
2724
  i.forEach((l) => {
2725
2725
  if (l.type === "sep")
2726
- n += l.value.length;
2726
+ r += l.value.length;
2727
2727
  else {
2728
- const o = r.substr(n, l.len);
2729
- t[a] && (t[a].value = o), a++, n += l.len;
2728
+ const o = n.substr(r, l.len);
2729
+ t[a] && (t[a].value = o), a++, r += l.len;
2730
2730
  }
2731
2731
  });
2732
2732
  }
@@ -2752,12 +2752,12 @@ class te extends HTMLElement {
2752
2752
  }
2753
2753
  }
2754
2754
  _attachPartInputHandlers(e, t, i) {
2755
- e.forEach((s, r) => {
2756
- const n = s.maxLength || 2;
2755
+ e.forEach((s, n) => {
2756
+ const r = s.maxLength || 2;
2757
2757
  s.addEventListener("input", () => {
2758
- s.value = s.value.replace(/\D/g, "").slice(0, n), s.value.length >= n && this._focusNext(e, r), this._syncHiddenInput();
2758
+ s.value = s.value.replace(/\D/g, "").slice(0, r), s.value.length >= r && this._focusNext(e, n), this._syncHiddenInput();
2759
2759
  }), s.addEventListener("keydown", (a) => {
2760
- a.key === "Backspace" && s.selectionStart === 0 && s.selectionEnd === 0 && this._focusPrev(e, r), a.key === "ArrowLeft" && s.selectionStart === 0 && s.selectionEnd === 0 && (this._focusPrev(e, r), a.preventDefault()), a.key === "ArrowRight" && s.selectionStart === s.value.length && s.selectionEnd === s.value.length && (this._focusNext(e, r), a.preventDefault());
2760
+ a.key === "Backspace" && s.selectionStart === 0 && s.selectionEnd === 0 && this._focusPrev(e, n), a.key === "ArrowLeft" && s.selectionStart === 0 && s.selectionEnd === 0 && (this._focusPrev(e, n), a.preventDefault()), a.key === "ArrowRight" && s.selectionStart === s.value.length && s.selectionEnd === s.value.length && (this._focusNext(e, n), a.preventDefault());
2761
2761
  }), s.addEventListener("blur", (a) => {
2762
2762
  var h, c;
2763
2763
  this._syncHiddenInput();
@@ -2782,11 +2782,11 @@ class te extends HTMLElement {
2782
2782
  _parseValue(e) {
2783
2783
  const t = this.getFormat(), i = this._getFormatTokens(t);
2784
2784
  if (this._isRange) {
2785
- const [s, r] = this._splitRangeInput(e, t), n = s ? this._parseDateString(s, t) : null, a = r ? this._parseDateString(r, t) : null;
2786
- if (n && a) {
2787
- const [l, o] = n <= a ? [n, a] : [a, n];
2785
+ const [s, n] = this._splitRangeInput(e, t), r = s ? this._parseDateString(s, t) : null, a = n ? this._parseDateString(n, t) : null;
2786
+ if (r && a) {
2787
+ const [l, o] = r <= a ? [r, a] : [a, r];
2788
2788
  this._selectedStartDate = l, this._selectedEndDate = o, this._currentMonth = l.getMonth(), this._currentYear = l.getFullYear();
2789
- } else n && (this._selectedStartDate = n, this._selectedEndDate = null, this._currentMonth = n.getMonth(), this._currentYear = n.getFullYear());
2789
+ } else r && (this._selectedStartDate = r, this._selectedEndDate = null, this._currentMonth = r.getMonth(), this._currentYear = r.getFullYear());
2790
2790
  this._applyDateToParts(this._selectedStartDate, this._startPartInputs, i, t), this._applyDateToParts(this._selectedEndDate, this._endPartInputs, i, t);
2791
2791
  } else {
2792
2792
  const s = this._parseDateString(e, t);
@@ -2819,26 +2819,26 @@ class te extends HTMLElement {
2819
2819
  }
2820
2820
  }
2821
2821
  }
2822
- const r = e.replace(/[\/\-\.]/g, ""), n = t.replace(/[\/\-\.]/g, "").toLowerCase();
2823
- let a = n.indexOf("d"), l = n.indexOf("m"), o = n.indexOf("y");
2822
+ const n = e.replace(/[\/\-\.]/g, ""), r = t.replace(/[\/\-\.]/g, "").toLowerCase();
2823
+ let a = r.indexOf("d"), l = r.indexOf("m"), o = r.indexOf("y");
2824
2824
  const h = [
2825
2825
  { char: "d", index: a },
2826
2826
  { char: "m", index: l },
2827
2827
  { char: "y", index: o }
2828
2828
  ].sort((m, k) => m.index - k.index);
2829
2829
  let c = 0, u = 0, d = 0, f = 0;
2830
- n.length, r.length;
2830
+ r.length, n.length;
2831
2831
  for (const m of h)
2832
2832
  if (m.char === "d") {
2833
- const k = n.lastIndexOf("d") - n.indexOf("d") + 1, _ = r.substr(f, k);
2833
+ const k = r.lastIndexOf("d") - r.indexOf("d") + 1, _ = n.substr(f, k);
2834
2834
  if (_.length === 0) return null;
2835
2835
  c = parseInt(_, 10), f += _.length;
2836
2836
  } else if (m.char === "m") {
2837
- const k = n.lastIndexOf("m") - n.indexOf("m") + 1, _ = r.substr(f, k);
2837
+ const k = r.lastIndexOf("m") - r.indexOf("m") + 1, _ = n.substr(f, k);
2838
2838
  if (_.length === 0) return null;
2839
2839
  u = parseInt(_, 10) - 1, f += _.length;
2840
2840
  } else if (m.char === "y") {
2841
- const k = n.lastIndexOf("y") - n.indexOf("y") + 1, _ = r.substr(f), E = Math.min(k, _.length), C = _.substr(0, E);
2841
+ const k = r.lastIndexOf("y") - r.indexOf("y") + 1, _ = n.substr(f), E = Math.min(k, _.length), C = _.substr(0, E);
2842
2842
  if (C.length === 0) return null;
2843
2843
  let v = parseInt(C, 10);
2844
2844
  E === 2 && k === 4 ? v = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + v : E === 2 && k === 2 && (v = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + v), d = v, f += E;
@@ -2848,13 +2848,13 @@ class te extends HTMLElement {
2848
2848
  return isNaN(p.getTime()) || p.getDate() !== c || p.getMonth() !== u || p.getFullYear() !== d ? null : p;
2849
2849
  }
2850
2850
  _formatDate(e, t) {
2851
- const i = e.getDate(), s = e.getMonth() + 1, r = e.getFullYear(), n = t.toLowerCase();
2851
+ const i = e.getDate(), s = e.getMonth() + 1, n = e.getFullYear(), r = t.toLowerCase();
2852
2852
  let a = t;
2853
- return n.includes("dd") ? a = a.replace(/dd/gi, String(i).padStart(2, "0")) : n.includes("d") && (a = a.replace(/d/gi, String(i))), n.includes("mm") ? a = a.replace(/mm/gi, String(s).padStart(2, "0")) : n.includes("m") && (a = a.replace(/m/gi, String(s))), n.includes("yyyy") ? a = a.replace(/yyyy/gi, String(r)) : n.includes("yy") && (a = a.replace(/yy/gi, String(r).substr(2))), a;
2853
+ return r.includes("dd") ? a = a.replace(/dd/gi, String(i).padStart(2, "0")) : r.includes("d") && (a = a.replace(/d/gi, String(i))), r.includes("mm") ? a = a.replace(/mm/gi, String(s).padStart(2, "0")) : r.includes("m") && (a = a.replace(/m/gi, String(s))), r.includes("yyyy") ? a = a.replace(/yyyy/gi, String(n)) : r.includes("yy") && (a = a.replace(/yy/gi, String(n).substr(2))), a;
2854
2854
  }
2855
2855
  // PHP-style formatter for display mode
2856
2856
  _formatDatePhp(e, t) {
2857
- const i = e.getDate(), s = e.getMonth() + 1, r = e.getFullYear(), n = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], a = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], l = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], o = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], h = (d, f = 2) => d.toString().padStart(f, "0"), c = (d) => {
2857
+ const i = e.getDate(), s = e.getMonth() + 1, n = e.getFullYear(), r = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], a = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], l = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], o = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], h = (d, f = 2) => d.toString().padStart(f, "0"), c = (d) => {
2858
2858
  const f = d % 10, p = d % 100;
2859
2859
  return f === 1 && p !== 11 ? "st" : f === 2 && p !== 12 ? "nd" : f === 3 && p !== 13 ? "rd" : "th";
2860
2860
  };
@@ -2867,10 +2867,10 @@ class te extends HTMLElement {
2867
2867
  }
2868
2868
  switch (f) {
2869
2869
  case "Y":
2870
- u += r.toString();
2870
+ u += n.toString();
2871
2871
  break;
2872
2872
  case "y":
2873
- u += r.toString().slice(-2);
2873
+ u += n.toString().slice(-2);
2874
2874
  break;
2875
2875
  case "m":
2876
2876
  u += h(s);
@@ -2894,7 +2894,7 @@ class te extends HTMLElement {
2894
2894
  u += a[e.getDay()];
2895
2895
  break;
2896
2896
  case "l":
2897
- u += n[e.getDay()];
2897
+ u += r[e.getDay()];
2898
2898
  break;
2899
2899
  case "S":
2900
2900
  u += c(i);
@@ -2911,7 +2911,7 @@ class te extends HTMLElement {
2911
2911
  return i !== null && !isNaN(i.getTime());
2912
2912
  }
2913
2913
  render() {
2914
- const e = this.isLoading(), t = this.getLabel(), i = this.getInfo(), s = this.getValue(), r = this.isDisabled(), n = this.isReadonly(), a = this.isRequired(), l = this.getId(), o = this.getName(), h = this.getFormat(), c = this.hasError(), u = this.getErrorMessage();
2914
+ const e = this.isLoading(), t = this.getLabel(), i = this.getInfo(), s = this.getValue(), n = this.isDisabled(), r = this.isReadonly(), a = this.isRequired(), l = this.getId(), o = this.getName(), h = this.getFormat(), c = this.hasError(), u = this.getErrorMessage();
2915
2915
  this._isRange = this.isRange(), this._input || (this._input = document.createElement("div"), this._input.className = "relative w-full", this.appendChild(this._input));
2916
2916
  let d = this.querySelector(".mint-date-picker-label-container");
2917
2917
  if (t || i) {
@@ -2923,12 +2923,12 @@ class te extends HTMLElement {
2923
2923
  } else d && d.remove();
2924
2924
  this._hiddenInput || (this._hiddenInput = document.createElement("input"), this._hiddenInput.type = "hidden", this._hiddenInput.value = s || "", this._textInput = this._hiddenInput, this._input.appendChild(this._hiddenInput)), l && (this._hiddenInput.id = l), o && (this._hiddenInput.name = o), this._hiddenInput.value = s || "", this._hiddenInput.setAttribute("aria-invalid", c ? "true" : "false");
2925
2925
  let f = this._input.querySelector(".mint-date-fields");
2926
- f || (f = document.createElement("div"), this._input.appendChild(f)), this._fieldsContainer = f, this._applyErrorVisuals(c, u, r), f.innerHTML = "", this._displayEl = document.createElement("div");
2927
- const p = n ? "select-text" : "select-none";
2928
- this._displayEl.className = `flex-1 text-gray-900 dark:text-white ${n ? "cursor-default" : "cursor-text"} ${p} focus:outline-none`, this._displayEl.tabIndex = r || n ? -1 : 0, this._displayEl.addEventListener("click", () => {
2929
- r || n || this._enterInputMode();
2926
+ f || (f = document.createElement("div"), this._input.appendChild(f)), this._fieldsContainer = f, this._applyErrorVisuals(c, u, n), f.innerHTML = "", this._displayEl = document.createElement("div");
2927
+ const p = r ? "select-text" : "select-none";
2928
+ this._displayEl.className = `flex-1 text-gray-900 dark:text-white ${r ? "cursor-default" : "cursor-text"} ${p} focus:outline-none`, this._displayEl.tabIndex = n || r ? -1 : 0, this._displayEl.addEventListener("click", () => {
2929
+ n || r || this._enterInputMode();
2930
2930
  }), this._displayEl.addEventListener("keydown", (E) => {
2931
- r || n || (E.key === "Enter" || E.key === " ") && (E.preventDefault(), this._enterInputMode());
2931
+ n || r || (E.key === "Enter" || E.key === " ") && (E.preventDefault(), this._enterInputMode());
2932
2932
  }), this._inputsWrapperEl = document.createElement("div"), this._inputsWrapperEl.className = "flex items-center gap-1 w-full";
2933
2933
  const m = this._getFormatTokens(h);
2934
2934
  this._startPartInputs = [], this._endPartInputs = [];
@@ -2939,7 +2939,7 @@ class te extends HTMLElement {
2939
2939
  const y = document.createElement("span");
2940
2940
  y.textContent = v.value, y.className = "text-gray-400 dark:text-gray-500 select-none", C.appendChild(y);
2941
2941
  } else {
2942
- const y = v.part === "d" ? "dd" : v.part === "m" ? "mm" : v.len === 2 ? "yy" : "yyyy", b = this._createPartInput(v.len, y, r, n, a);
2942
+ const y = v.part === "d" ? "dd" : v.part === "m" ? "mm" : v.len === 2 ? "yy" : "yyyy", b = this._createPartInput(v.len, y, n, r, a);
2943
2943
  E === "start" ? this._startPartInputs.push(b) : this._endPartInputs.push(b), C.appendChild(b);
2944
2944
  }
2945
2945
  }), C;
@@ -2950,17 +2950,17 @@ class te extends HTMLElement {
2950
2950
  }
2951
2951
  const _ = document.createElement("div");
2952
2952
  if (_.className = "flex flex-col w-full", this._displayEl.style.display = this._isInputMode ? "none" : "flex", this._inputsWrapperEl.style.display = this._isInputMode ? "flex" : "none", _.appendChild(this._displayEl), _.appendChild(this._inputsWrapperEl), f.appendChild(_), f.addEventListener("click", () => {
2953
- this._isInputMode || r || n || this._enterInputMode();
2953
+ this._isInputMode || n || r || this._enterInputMode();
2954
2954
  }), this._attachPartInputHandlers(this._startPartInputs, m, f), this._isRange && this._attachPartInputHandlers(this._endPartInputs, m, f), this._parseValue(s), this._syncHiddenInput(), this._updateDisplayText(), this._iconButton)
2955
- this._iconButton.disabled = r || n, !r && !n ? this._iconButton.tabIndex = 0 : this._iconButton.tabIndex = -1;
2955
+ this._iconButton.disabled = n || r, !n && !r ? this._iconButton.tabIndex = 0 : this._iconButton.tabIndex = -1;
2956
2956
  else {
2957
2957
  this._iconButton = document.createElement("button"), this._iconButton.type = "button", this._iconButton.tabIndex = 0, this._iconButton.className = "absolute left-2 top-[.55rem] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 pointer-events-auto disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center rounded-sm";
2958
2958
  const E = `date-icon-${Math.random().toString(36).substr(2, 9)}`;
2959
2959
  this._iconButton.id = E;
2960
2960
  const C = document.createElement("mint-icon");
2961
2961
  C.setAttribute("name", "calendar"), C.className = "w-4 h-4 pointer-events-none", this._iconButton.appendChild(C), this._iconButton.addEventListener("click", () => {
2962
- r || n || this._enterInputMode();
2963
- }), this._input.prepend(this._iconButton), this._iconButton.disabled = r || n;
2962
+ n || r || this._enterInputMode();
2963
+ }), this._input.prepend(this._iconButton), this._iconButton.disabled = n || r;
2964
2964
  }
2965
2965
  this._renderErrorState(c, u), this._renderSkeleton(e);
2966
2966
  }
@@ -3008,13 +3008,13 @@ class te extends HTMLElement {
3008
3008
  return;
3009
3009
  }
3010
3010
  if (this._isRange) {
3011
- const [i, s] = this._splitRangeInput(e, t), r = i ? this._parseDateString(i, t) : null, n = s ? this._parseDateString(s, t) : null;
3012
- if (r && n) {
3013
- const [a, l] = r <= n ? [r, n] : [n, r], o = this._formatDate(a, t), h = this._formatDate(l, t), c = `${o} - ${h}`;
3011
+ const [i, s] = this._splitRangeInput(e, t), n = i ? this._parseDateString(i, t) : null, r = s ? this._parseDateString(s, t) : null;
3012
+ if (n && r) {
3013
+ const [a, l] = n <= r ? [n, r] : [r, n], o = this._formatDate(a, t), h = this._formatDate(l, t), c = `${o} - ${h}`;
3014
3014
  this.setValue(c), this._applyDateToParts(a, this._startPartInputs, this._getFormatTokens(t), t), this._applyDateToParts(l, this._endPartInputs, this._getFormatTokens(t), t), this._selectedStartDate = a, this._selectedEndDate = l, this._currentMonth = a.getMonth(), this._currentYear = a.getFullYear();
3015
- } else if (r) {
3016
- const a = this._formatDate(r, t);
3017
- this.setValue(a), this._applyDateToParts(r, this._startPartInputs, this._getFormatTokens(t), t), this._applyDateToParts(null, this._endPartInputs, this._getFormatTokens(t), t), this._selectedStartDate = r, this._selectedEndDate = null, this._currentMonth = r.getMonth(), this._currentYear = r.getFullYear();
3015
+ } else if (n) {
3016
+ const a = this._formatDate(n, t);
3017
+ this.setValue(a), this._applyDateToParts(n, this._startPartInputs, this._getFormatTokens(t), t), this._applyDateToParts(null, this._endPartInputs, this._getFormatTokens(t), t), this._selectedStartDate = n, this._selectedEndDate = null, this._currentMonth = n.getMonth(), this._currentYear = n.getFullYear();
3018
3018
  } else
3019
3019
  this.setValue(""), this._applyDateToParts(null, this._startPartInputs, this._getFormatTokens(t), t), this._applyDateToParts(null, this._endPartInputs, this._getFormatTokens(t), t), this._selectedStartDate = null, this._selectedEndDate = null;
3020
3020
  } else if (this._validateDateString(e, t)) {
@@ -3053,9 +3053,9 @@ class te extends HTMLElement {
3053
3053
  requestAnimationFrame(() => {
3054
3054
  this._popover && this._popover.isConnected && (this._popover.setAttribute("trigger-id", e), this._popoverObserver || (this._popoverObserver = new MutationObserver((i) => {
3055
3055
  i.forEach((s) => {
3056
- var r;
3056
+ var n;
3057
3057
  if (s.type === "attributes" && s.attributeName === "open")
3058
- if ((r = this._popover) == null ? void 0 : r.hasAttribute("open"))
3058
+ if ((n = this._popover) == null ? void 0 : n.hasAttribute("open"))
3059
3059
  requestAnimationFrame(() => {
3060
3060
  this._buildCalendar();
3061
3061
  const a = this._popover;
@@ -3114,8 +3114,8 @@ class te extends HTMLElement {
3114
3114
  }
3115
3115
  _buildCalendarView() {
3116
3116
  if (!this._calendarContainer) return;
3117
- const e = this._getDaysInMonth(this._currentMonth, this._currentYear), t = this._getFirstDayOfMonth(this._currentMonth, this._currentYear), i = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], s = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], r = this.getShortcuts(), n = r.length > 0;
3118
- this._calendarContainer.className = n ? "mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]" : "mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:min-w-[18rem]";
3117
+ const e = this._getDaysInMonth(this._currentMonth, this._currentYear), t = this._getFirstDayOfMonth(this._currentMonth, this._currentYear), i = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], s = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], n = this.getShortcuts(), r = n.length > 0;
3118
+ this._calendarContainer.className = r ? "mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]" : "mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:min-w-[18rem]";
3119
3119
  const a = document.createElement("div");
3120
3120
  a.className = "flex flex-col md:flex-row md:gap-6 md:items-start";
3121
3121
  const l = document.createElement("div");
@@ -3168,7 +3168,7 @@ class te extends HTMLElement {
3168
3168
  this._handleDateClick(y);
3169
3169
  }), _.appendChild(S);
3170
3170
  }
3171
- if (n) {
3171
+ if (r) {
3172
3172
  const v = document.createElement("div");
3173
3173
  v.className = "mb-4 pb-4 border-b border-gray-200 dark:border-gray-700 md:mb-0 md:pb-0 md:border-b-0 md:border-r md:border-r-gray-200 dark:md:border-r-gray-700 md:pr-6 md:mr-0 md:w-32 md:flex-shrink-0 md:h-full md:flex md:flex-col";
3174
3174
  const y = document.createElement("div");
@@ -3218,7 +3218,7 @@ class te extends HTMLElement {
3218
3218
  D > 0 ? x.style.opacity = "1" : x.style.opacity = "0", D + N < I - 1 ? w.style.opacity = "1" : w.style.opacity = "0", T.style.opacity = "0", S.style.opacity = "0";
3219
3219
  }
3220
3220
  };
3221
- b.addEventListener("scroll", H), window.addEventListener("resize", H), setTimeout(H, 0), r.forEach((L) => {
3221
+ b.addEventListener("scroll", H), window.addEventListener("resize", H), setTimeout(H, 0), n.forEach((L) => {
3222
3222
  const D = document.createElement("button");
3223
3223
  D.type = "button", D.tabIndex = 0, D.className = "px-3 py-1.5 text-xs font-medium rounded-md bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors whitespace-nowrap flex-shrink-0 md:w-full md:text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", D.textContent = L.label, D.setAttribute("data-keep-popover-open", "true"), D.addEventListener("click", () => {
3224
3224
  const I = L.action();
@@ -3257,16 +3257,16 @@ class te extends HTMLElement {
3257
3257
  s.setAttribute("name", "caret-left"), s.className = "w-4 h-4", i.appendChild(s), i.addEventListener("click", () => {
3258
3258
  this._currentYear--, this._buildCalendar();
3259
3259
  }), t.appendChild(i);
3260
- const r = document.createElement("button");
3261
- r.type = "button", r.tabIndex = 0, r.className = "text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 rounded px-1", r.setAttribute("data-keep-popover-open", "true"), r.textContent = String(this._currentYear), r.addEventListener("click", () => {
3262
- this._viewMode = "year", this._buildCalendar();
3263
- }), t.appendChild(r);
3264
3260
  const n = document.createElement("button");
3265
- n.type = "button", n.tabIndex = 0, n.className = "p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", n.setAttribute("data-keep-popover-open", "true");
3261
+ n.type = "button", n.tabIndex = 0, n.className = "text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 rounded px-1", n.setAttribute("data-keep-popover-open", "true"), n.textContent = String(this._currentYear), n.addEventListener("click", () => {
3262
+ this._viewMode = "year", this._buildCalendar();
3263
+ }), t.appendChild(n);
3264
+ const r = document.createElement("button");
3265
+ r.type = "button", r.tabIndex = 0, r.className = "p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", r.setAttribute("data-keep-popover-open", "true");
3266
3266
  const a = document.createElement("mint-icon");
3267
- a.setAttribute("name", "caret-right"), a.className = "w-4 h-4", n.appendChild(a), n.addEventListener("click", () => {
3267
+ a.setAttribute("name", "caret-right"), a.className = "w-4 h-4", r.appendChild(a), r.addEventListener("click", () => {
3268
3268
  this._currentYear++, this._buildCalendar();
3269
- }), t.appendChild(n);
3269
+ }), t.appendChild(r);
3270
3270
  const l = document.createElement("div");
3271
3271
  l.className = "grid grid-cols-3 gap-2", e.forEach((o, h) => {
3272
3272
  const c = document.createElement("button");
@@ -3283,12 +3283,12 @@ class te extends HTMLElement {
3283
3283
  i.className = "flex items-center justify-between mb-4";
3284
3284
  const s = document.createElement("button");
3285
3285
  s.type = "button", s.tabIndex = 0, s.className = "p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", s.setAttribute("data-keep-popover-open", "true");
3286
- const r = document.createElement("mint-icon");
3287
- r.setAttribute("name", "caret-left"), r.className = "w-4 h-4", s.appendChild(r), s.addEventListener("click", () => {
3286
+ const n = document.createElement("mint-icon");
3287
+ n.setAttribute("name", "caret-left"), n.className = "w-4 h-4", s.appendChild(n), s.addEventListener("click", () => {
3288
3288
  this._currentYear -= 12, this._buildCalendar();
3289
3289
  }), i.appendChild(s);
3290
- const n = document.createElement("div");
3291
- n.className = "text-sm font-medium text-gray-900 dark:text-gray-100", n.textContent = `${e} - ${t}`, i.appendChild(n);
3290
+ const r = document.createElement("div");
3291
+ r.className = "text-sm font-medium text-gray-900 dark:text-gray-100", r.textContent = `${e} - ${t}`, i.appendChild(r);
3292
3292
  const a = document.createElement("button");
3293
3293
  a.type = "button", a.tabIndex = 0, a.className = "p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", a.setAttribute("data-keep-popover-open", "true");
3294
3294
  const l = document.createElement("mint-icon");
@@ -3333,8 +3333,8 @@ class te extends HTMLElement {
3333
3333
  const t = this.getFormat();
3334
3334
  if (this._isRange) {
3335
3335
  if (!this._selectedStartDate || this._selectedStartDate && this._selectedEndDate ? (this._selectedStartDate = e, this._selectedEndDate = null) : this._selectedStartDate && !this._selectedEndDate && (e < this._selectedStartDate ? (this._selectedEndDate = this._selectedStartDate, this._selectedStartDate = e) : this._selectedEndDate = e), this._selectedStartDate && this._selectedEndDate) {
3336
- const i = this._formatDate(this._selectedStartDate, t), s = this._formatDate(this._selectedEndDate, t), r = `${i} - ${s}`;
3337
- this.setValue(r), this._textInput && (this._textInput.value = r), this._popover && typeof this._popover.close == "function" && this._popover.close();
3336
+ const i = this._formatDate(this._selectedStartDate, t), s = this._formatDate(this._selectedEndDate, t), n = `${i} - ${s}`;
3337
+ this.setValue(n), this._textInput && (this._textInput.value = n), this._popover && typeof this._popover.close == "function" && this._popover.close();
3338
3338
  } else if (this._selectedStartDate) {
3339
3339
  const i = this._formatDate(this._selectedStartDate, t);
3340
3340
  this.setValue(i), this._textInput && (this._textInput.value = i);
@@ -3381,8 +3381,8 @@ class te extends HTMLElement {
3381
3381
  const i = this._fieldsContainer, s = this._input;
3382
3382
  if (e) {
3383
3383
  t || (t = document.createElement("div"), t.className = "mint-date-picker-skeleton-container absolute inset-0 z-10 pointer-events-none", s ? (s.classList.contains("relative") || s.classList.add("relative"), s.appendChild(t)) : (this.style.position = "relative", this.appendChild(t)));
3384
- let r = t.querySelector(".mint-date-picker-skeleton");
3385
- r || (r = document.createElement("div"), r.className = "mint-date-picker-skeleton w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse", r.style.height = "2.25rem", t.appendChild(r)), t.style.display = "block", i && (i.style.visibility = "hidden", i.style.pointerEvents = "none"), this._displayEl && (this._displayEl.style.visibility = "hidden", this._displayEl.style.pointerEvents = "none");
3384
+ let n = t.querySelector(".mint-date-picker-skeleton");
3385
+ n || (n = document.createElement("div"), n.className = "mint-date-picker-skeleton w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse", n.style.height = "2.25rem", t.appendChild(n)), t.style.display = "block", i && (i.style.visibility = "hidden", i.style.pointerEvents = "none"), this._displayEl && (this._displayEl.style.visibility = "hidden", this._displayEl.style.pointerEvents = "none");
3386
3386
  } else
3387
3387
  t && (t.style.display = "none"), i && (i.style.visibility = "visible", i.style.pointerEvents = "auto"), this._displayEl && (this._displayEl.style.visibility = "visible", this._displayEl.style.pointerEvents = "auto");
3388
3388
  }
@@ -3414,16 +3414,16 @@ class te extends HTMLElement {
3414
3414
  }
3415
3415
  const i = e._getFocusableElements();
3416
3416
  if (i.length === 0) return;
3417
- const s = i[0], r = i[i.length - 1], n = document.activeElement;
3418
- if (!(((l = e._calendarContainer) == null ? void 0 : l.contains(n)) || !1)) {
3417
+ const s = i[0], n = i[i.length - 1], r = document.activeElement;
3418
+ if (!(((l = e._calendarContainer) == null ? void 0 : l.contains(r)) || !1)) {
3419
3419
  t.preventDefault(), s.focus();
3420
3420
  return;
3421
3421
  }
3422
- if (t.shiftKey && n === s) {
3423
- t.preventDefault(), r.focus();
3422
+ if (t.shiftKey && r === s) {
3423
+ t.preventDefault(), n.focus();
3424
3424
  return;
3425
3425
  }
3426
- if (!t.shiftKey && n === r) {
3426
+ if (!t.shiftKey && r === n) {
3427
3427
  t.preventDefault(), s.focus();
3428
3428
  return;
3429
3429
  }
@@ -3533,12 +3533,12 @@ class ie extends HTMLElement {
3533
3533
  ], s = [
3534
3534
  "border-2",
3535
3535
  e ? "border-red-300 dark:border-red-300" : "border-gray-200 dark:border-gray-600"
3536
- ], r = [
3536
+ ], n = [
3537
3537
  "focus-visible:ring-2",
3538
3538
  "focus-visible:ring-offset-1",
3539
3539
  e ? "focus-visible:ring-red-400 dark:focus-visible:ring-red-500" : "focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500"
3540
3540
  ];
3541
- return [...i, ...s, ...r].filter(Boolean).join(" ");
3541
+ return [...i, ...s, ...n].filter(Boolean).join(" ");
3542
3542
  }
3543
3543
  render() {
3544
3544
  const e = this.isLoading(), t = [];
@@ -3549,14 +3549,14 @@ class ie extends HTMLElement {
3549
3549
  for (; this.firstChild; )
3550
3550
  this.removeChild(this.firstChild);
3551
3551
  this._wrapper = null, this._select = null;
3552
- const s = this.getLabel(), r = this.getInfo(), n = this.getId(), a = this.getName(), l = this.getValue(), o = this.isDisabled(), h = this.isMultiple(), c = this.hasError();
3552
+ const s = this.getLabel(), n = this.getInfo(), r = this.getId(), a = this.getName(), l = this.getValue(), o = this.isDisabled(), h = this.isMultiple(), c = this.hasError();
3553
3553
  if (s) {
3554
3554
  const d = document.createElement("label");
3555
- d.className = "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", n && d.setAttribute("for", n);
3555
+ d.className = "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", r && d.setAttribute("for", r);
3556
3556
  const f = document.createTextNode(s);
3557
3557
  d.appendChild(f), this.appendChild(d);
3558
3558
  }
3559
- this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper), this._select = document.createElement("select"), this._select.className = this.getSelectClasses(), n && (this._select.id = n), a && (this._select.name = a), o && (this._select.disabled = !0), h && (this._select.multiple = !0), this._select.setAttribute("aria-invalid", c ? "true" : "false");
3559
+ this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper), this._select = document.createElement("select"), this._select.className = this.getSelectClasses(), r && (this._select.id = r), a && (this._select.name = a), o && (this._select.disabled = !0), h && (this._select.multiple = !0), this._select.setAttribute("aria-invalid", c ? "true" : "false");
3560
3560
  const u = t.length > 0 ? t : i;
3561
3561
  if (u.length > 0 && u.forEach((d) => {
3562
3562
  this._select.appendChild(d);
@@ -3578,9 +3578,9 @@ class ie extends HTMLElement {
3578
3578
  const d = document.createElement("div");
3579
3579
  d.className = "absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none z-10 flex flex-col", this._caretUpIcon = document.createElement("mint-icon"), this._caretUpIcon.setAttribute("name", "caret-up"), this._caretUpIcon.className = "w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mb-[-.2rem]", d.appendChild(this._caretUpIcon), this._caretDownIcon = document.createElement("mint-icon"), this._caretDownIcon.setAttribute("name", "caret-down"), this._caretDownIcon.className = "w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mt-[-.2rem]", d.appendChild(this._caretDownIcon), this._wrapper.appendChild(d);
3580
3580
  }
3581
- if (r) {
3581
+ if (n) {
3582
3582
  const d = document.createElement("div");
3583
- d.className = "mt-1 text-xs text-gray-500 dark:text-gray-400", d.textContent = r, this.appendChild(d);
3583
+ d.className = "mt-1 text-xs text-gray-500 dark:text-gray-400", d.textContent = n, this.appendChild(d);
3584
3584
  }
3585
3585
  this._renderErrorState(), this._renderSkeleton(e);
3586
3586
  }
@@ -3592,8 +3592,8 @@ class ie extends HTMLElement {
3592
3592
  let s = t.querySelector(".mint-select-skeleton");
3593
3593
  if (!s) {
3594
3594
  s = document.createElement("div"), s.className = "mint-select-skeleton w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse";
3595
- const r = this.isMultiple();
3596
- s.style.height = r ? "6rem" : "2.25rem", t.appendChild(s);
3595
+ const n = this.isMultiple();
3596
+ s.style.height = n ? "6rem" : "2.25rem", t.appendChild(s);
3597
3597
  }
3598
3598
  t.style.display = "block", this._select && (this._select.style.opacity = "0", this._select.style.pointerEvents = "none");
3599
3599
  } else
@@ -3657,15 +3657,15 @@ class se extends HTMLElement {
3657
3657
  t || (t = document.createElement("div"), t.className = "mint-dropzone-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center justify-center", i ? (i.classList.contains("relative") || i.classList.add("relative"), i.appendChild(t)) : (this.style.position = "relative", this.appendChild(t)));
3658
3658
  let s = t.querySelector(".mint-dropzone-skeleton");
3659
3659
  if (s || (s = document.createElement("div"), s.className = "mint-dropzone-skeleton rounded-lg border-2 border-dashed border-gray-300 dark:border-gray-600 bg-gray-200 dark:bg-gray-700 animate-pulse", s.style.width = "100%", s.style.height = "100%", t.appendChild(s)), t.style.display = "flex", i) {
3660
- const r = i.querySelector(".mint-dropzone-icon"), n = i.querySelector(".mint-dropzone-label"), a = i.querySelector(".mint-dropzone-previews-wrapper"), l = this._fileInput;
3661
- if (r) {
3662
- const o = r;
3663
- o.style.visibility = "hidden", o.style.pointerEvents = "none";
3664
- }
3660
+ const n = i.querySelector(".mint-dropzone-icon"), r = i.querySelector(".mint-dropzone-label"), a = i.querySelector(".mint-dropzone-previews-wrapper"), l = this._fileInput;
3665
3661
  if (n) {
3666
3662
  const o = n;
3667
3663
  o.style.visibility = "hidden", o.style.pointerEvents = "none";
3668
3664
  }
3665
+ if (r) {
3666
+ const o = r;
3667
+ o.style.visibility = "hidden", o.style.pointerEvents = "none";
3668
+ }
3669
3669
  if (a) {
3670
3670
  const o = a;
3671
3671
  o.style.visibility = "hidden", o.style.pointerEvents = "none";
@@ -3673,19 +3673,19 @@ class se extends HTMLElement {
3673
3673
  l && (l.style.visibility = "hidden", l.style.pointerEvents = "none"), i.style.pointerEvents = "none";
3674
3674
  }
3675
3675
  } else if (t && (t.style.display = "none"), i) {
3676
- const s = i.querySelector(".mint-dropzone-icon"), r = i.querySelector(".mint-dropzone-label"), n = i.querySelector(".mint-dropzone-previews-wrapper"), a = this._fileInput;
3676
+ const s = i.querySelector(".mint-dropzone-icon"), n = i.querySelector(".mint-dropzone-label"), r = i.querySelector(".mint-dropzone-previews-wrapper"), a = this._fileInput;
3677
3677
  if (s) {
3678
3678
  const l = s;
3679
3679
  l.style.visibility = "visible", l.style.pointerEvents = "auto";
3680
3680
  }
3681
- if (r) {
3682
- const l = r;
3683
- l.style.visibility = "visible", l.style.pointerEvents = "auto";
3684
- }
3685
3681
  if (n) {
3686
3682
  const l = n;
3687
3683
  l.style.visibility = "visible", l.style.pointerEvents = "auto";
3688
3684
  }
3685
+ if (r) {
3686
+ const l = r;
3687
+ l.style.visibility = "visible", l.style.pointerEvents = "auto";
3688
+ }
3689
3689
  a && (a.style.visibility = "visible", a.style.pointerEvents = "auto"), i.style.pointerEvents = "auto";
3690
3690
  }
3691
3691
  }
@@ -3705,8 +3705,8 @@ class se extends HTMLElement {
3705
3705
  return this.hasAttribute("loading");
3706
3706
  }
3707
3707
  render() {
3708
- const e = this.isLoading(), t = this.getLabel(), i = this.getAccept(), s = this.isMultiple(), r = this.isDisabled(), n = this.getWidth(), a = this.getHeight(), l = this.getName(), o = this.hasError(), h = this.getErrorMessage();
3709
- this._dropzone || (this._dropzone = document.createElement("div"), this.appendChild(this._dropzone)), this._updateDragStateClass(), this._dropzone.setAttribute("aria-invalid", o ? "true" : "false"), r ? (this._dropzone.setAttribute("tabindex", "-1"), this._dropzone.removeAttribute("role")) : (this._dropzone.setAttribute("tabindex", "0"), this._dropzone.setAttribute("role", "button"), this._dropzone.setAttribute("aria-label", t || "File upload dropzone")), this._dropzone.style.width = n, this._dropzone.style.height = a, this._dropzone.style.minWidth = n, this._dropzone.style.minHeight = a, this._fileInput || (this._fileInput = document.createElement("input"), this._fileInput.type = "file", this._fileInput.style.display = "none", this._fileInput.setAttribute("tabindex", "-1"), this._fileInput.setAttribute("aria-hidden", "true"), this._dropzone.appendChild(this._fileInput)), this._fileInput.accept = i, this._fileInput.multiple = s, this._fileInput.disabled = r, l ? this._fileInput.name = l : this._fileInput.removeAttribute("name"), this._fileInput.setAttribute("aria-invalid", o ? "true" : "false");
3708
+ const e = this.isLoading(), t = this.getLabel(), i = this.getAccept(), s = this.isMultiple(), n = this.isDisabled(), r = this.getWidth(), a = this.getHeight(), l = this.getName(), o = this.hasError(), h = this.getErrorMessage();
3709
+ this._dropzone || (this._dropzone = document.createElement("div"), this.appendChild(this._dropzone)), this._updateDragStateClass(), this._dropzone.setAttribute("aria-invalid", o ? "true" : "false"), n ? (this._dropzone.setAttribute("tabindex", "-1"), this._dropzone.removeAttribute("role")) : (this._dropzone.setAttribute("tabindex", "0"), this._dropzone.setAttribute("role", "button"), this._dropzone.setAttribute("aria-label", t || "File upload dropzone")), this._dropzone.style.width = r, this._dropzone.style.height = a, this._dropzone.style.minWidth = r, this._dropzone.style.minHeight = a, this._fileInput || (this._fileInput = document.createElement("input"), this._fileInput.type = "file", this._fileInput.style.display = "none", this._fileInput.setAttribute("tabindex", "-1"), this._fileInput.setAttribute("aria-hidden", "true"), this._dropzone.appendChild(this._fileInput)), this._fileInput.accept = i, this._fileInput.multiple = s, this._fileInput.disabled = n, l ? this._fileInput.name = l : this._fileInput.removeAttribute("name"), this._fileInput.setAttribute("aria-invalid", o ? "true" : "false");
3710
3710
  const c = this._dropzone.querySelector(".mint-dropzone-icon"), u = this._dropzone.querySelector(".mint-dropzone-label");
3711
3711
  c && c.remove(), u && u.remove();
3712
3712
  const d = document.createElement("div");
@@ -3727,8 +3727,8 @@ class se extends HTMLElement {
3727
3727
  }
3728
3728
  _updateDragStateClass() {
3729
3729
  if (!this._dropzone) return;
3730
- const e = this.isDisabled(), t = this.hasError(), r = `relative border-2 border-dashed rounded-lg transition-all duration-200 flex flex-col items-center ${this._selectedFiles.length > 0 ? "justify-start" : "justify-center"} cursor-pointer overflow-hidden`, n = this._isDragging ? "border-gray-400 dark:border-gray-500 bg-gray-50 dark:bg-gray-800" : "border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 hover:border-gray-400 dark:hover:border-gray-500", a = t ? "border-red-300 dark:border-red-300 bg-red-50/50 dark:bg-red-900/30" : "", l = e ? "opacity-40 cursor-not-allowed" : "", o = "focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500";
3731
- this._dropzone.className = `${r} ${t ? a : n} ${l} ${o}`.trim();
3730
+ const e = this.isDisabled(), t = this.hasError(), n = `relative border-2 border-dashed rounded-lg transition-all duration-200 flex flex-col items-center ${this._selectedFiles.length > 0 ? "justify-start" : "justify-center"} cursor-pointer overflow-hidden`, r = this._isDragging ? "border-gray-400 dark:border-gray-500 bg-gray-50 dark:bg-gray-800" : "border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 hover:border-gray-400 dark:hover:border-gray-500", a = t ? "border-red-300 dark:border-red-300 bg-red-50/50 dark:bg-red-900/30" : "", l = e ? "opacity-40 cursor-not-allowed" : "", o = "focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500";
3731
+ this._dropzone.className = `${n} ${t ? a : r} ${l} ${o}`.trim();
3732
3732
  }
3733
3733
  setupEventListeners() {
3734
3734
  this._listenersInitialized || (this._listenersInitialized = !0, this.removeEventListeners(), !(!this._dropzone || !this._fileInput || this.isDisabled()) && (this._onDropzoneClick || (this._onDropzoneClick = (e) => {
@@ -3768,12 +3768,12 @@ class se extends HTMLElement {
3768
3768
  return;
3769
3769
  const i = e.target.files;
3770
3770
  if (i && i.length > 0) {
3771
- const s = this.getAccept(), r = this.isMultiple(), n = [], a = [];
3771
+ const s = this.getAccept(), n = this.isMultiple(), r = [], a = [];
3772
3772
  for (let l = 0; l < i.length; l++) {
3773
3773
  const o = i[l];
3774
- this._isFileAccepted(o, s) ? n.push(o) : a.push(o);
3774
+ this._isFileAccepted(o, s) ? r.push(o) : a.push(o);
3775
3775
  }
3776
- if (!r && n.length > 1 && (a.push(...n.slice(1)), n.splice(1)), a.length > 0) {
3776
+ if (!n && r.length > 1 && (a.push(...r.slice(1)), r.splice(1)), a.length > 0) {
3777
3777
  const l = new CustomEvent("dropRejected", {
3778
3778
  detail: { files: a, reason: "File type not accepted or multiple files not allowed" },
3779
3779
  bubbles: !0,
@@ -3781,7 +3781,7 @@ class se extends HTMLElement {
3781
3781
  });
3782
3782
  this.dispatchEvent(l);
3783
3783
  }
3784
- n.length > 0 && this._applyValidFiles(n);
3784
+ r.length > 0 && this._applyValidFiles(r);
3785
3785
  }
3786
3786
  }), this._dropzone.addEventListener("click", this._onDropzoneClick), this._dropzone.addEventListener("dragover", this._onDragOver), this._dropzone.addEventListener("dragleave", this._onDragLeave), this._dropzone.addEventListener("drop", this._onDrop), this._dropzone.addEventListener("keydown", this._onKeyDown), this._dropzone.addEventListener("focus", this._onFocus), this._dropzone.addEventListener("blur", this._onBlur), this._fileInput.addEventListener("change", this._onFileInputChange), this._fileInput.addEventListener("input", this._onFileInputInput, !0)));
3787
3787
  }
@@ -3789,32 +3789,32 @@ class se extends HTMLElement {
3789
3789
  this._dropzone && (this._onDropzoneClick && this._dropzone.removeEventListener("click", this._onDropzoneClick), this._onDragOver && this._dropzone.removeEventListener("dragover", this._onDragOver), this._onDragLeave && this._dropzone.removeEventListener("dragleave", this._onDragLeave), this._onDrop && this._dropzone.removeEventListener("drop", this._onDrop), this._onKeyDown && this._dropzone.removeEventListener("keydown", this._onKeyDown), this._onFocus && this._dropzone.removeEventListener("focus", this._onFocus), this._onBlur && this._dropzone.removeEventListener("blur", this._onBlur)), this._fileInput && (this._onFileInputChange && this._fileInput.removeEventListener("change", this._onFileInputChange), this._onFileInputInput && this._fileInput.removeEventListener("input", this._onFileInputInput, !0)), this._isDragging = !1, this._listenersInitialized = !1;
3790
3790
  }
3791
3791
  _handleFiles(e) {
3792
- const t = this.getAccept(), i = this.isMultiple(), s = [], r = [];
3793
- for (let n = 0; n < e.length; n++) {
3794
- const a = e[n];
3795
- this._isFileAccepted(a, t) ? s.push(a) : r.push(a);
3792
+ const t = this.getAccept(), i = this.isMultiple(), s = [], n = [];
3793
+ for (let r = 0; r < e.length; r++) {
3794
+ const a = e[r];
3795
+ this._isFileAccepted(a, t) ? s.push(a) : n.push(a);
3796
3796
  }
3797
- if (!i && s.length > 1 && (r.push(...s.slice(1)), s.splice(1)), r.length > 0) {
3798
- const n = new CustomEvent("dropRejected", {
3799
- detail: { files: r, reason: "File type not accepted or multiple files not allowed" },
3797
+ if (!i && s.length > 1 && (n.push(...s.slice(1)), s.splice(1)), n.length > 0) {
3798
+ const r = new CustomEvent("dropRejected", {
3799
+ detail: { files: n, reason: "File type not accepted or multiple files not allowed" },
3800
3800
  bubbles: !0,
3801
3801
  cancelable: !0
3802
3802
  });
3803
- this.dispatchEvent(n);
3803
+ this.dispatchEvent(r);
3804
3804
  }
3805
3805
  s.length > 0 && this._applyValidFiles(s);
3806
3806
  }
3807
3807
  _isFileAccepted(e, t) {
3808
3808
  var s;
3809
3809
  if (!t) return !0;
3810
- const i = t.split(",").map((r) => r.trim().toLowerCase());
3811
- for (const r of i)
3812
- if (r.startsWith(".")) {
3813
- if ("." + ((s = e.name.split(".").pop()) == null ? void 0 : s.toLowerCase()) === r) return !0;
3814
- } else if (r.includes("/*")) {
3815
- const n = r.split("/")[0], a = e.type.split("/")[0];
3816
- if (n === a) return !0;
3817
- } else if (e.type === r) return !0;
3810
+ const i = t.split(",").map((n) => n.trim().toLowerCase());
3811
+ for (const n of i)
3812
+ if (n.startsWith(".")) {
3813
+ if ("." + ((s = e.name.split(".").pop()) == null ? void 0 : s.toLowerCase()) === n) return !0;
3814
+ } else if (n.includes("/*")) {
3815
+ const r = n.split("/")[0], a = e.type.split("/")[0];
3816
+ if (r === a) return !0;
3817
+ } else if (e.type === n) return !0;
3818
3818
  return !1;
3819
3819
  }
3820
3820
  _dispatchEvent(e, t) {
@@ -3890,15 +3890,15 @@ class se extends HTMLElement {
3890
3890
  }), c.appendChild(d), t.appendChild(c);
3891
3891
  });
3892
3892
  const i = this.hasError(), s = this._isDragging;
3893
- let r = "from-white dark:from-gray-700";
3894
- i ? r = "from-red-50 dark:from-red-900/30" : s && (r = "from-gray-50 dark:from-gray-800");
3895
- const n = document.createElement("div");
3896
- n.className = `absolute top-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-b ${r} to-transparent opacity-0 transition-opacity duration-200`, e.appendChild(n);
3893
+ let n = "from-white dark:from-gray-700";
3894
+ i ? n = "from-red-50 dark:from-red-900/30" : s && (n = "from-gray-50 dark:from-gray-800");
3895
+ const r = document.createElement("div");
3896
+ r.className = `absolute top-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-b ${n} to-transparent opacity-0 transition-opacity duration-200`, e.appendChild(r);
3897
3897
  const a = document.createElement("div");
3898
- a.className = `absolute bottom-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-t ${r} to-transparent opacity-100 transition-opacity duration-200`, e.appendChild(a);
3898
+ a.className = `absolute bottom-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-t ${n} to-transparent opacity-100 transition-opacity duration-200`, e.appendChild(a);
3899
3899
  const l = () => {
3900
3900
  const o = t.scrollTop, h = t.scrollHeight, c = t.clientHeight;
3901
- o > 0 ? n.style.opacity = "1" : n.style.opacity = "0", o + c < h - 1 ? a.style.opacity = "1" : a.style.opacity = "0";
3901
+ o > 0 ? r.style.opacity = "1" : r.style.opacity = "0", o + c < h - 1 ? a.style.opacity = "1" : a.style.opacity = "0";
3902
3902
  };
3903
3903
  l(), t.addEventListener("scroll", l), e.appendChild(t), this._previewContainer = e, this._dropzone.appendChild(e), this._updateDragStateClass();
3904
3904
  }
@@ -3939,7 +3939,7 @@ class re extends HTMLElement {
3939
3939
  return ["action", "method", "enctype", "data-form-data", "loading"];
3940
3940
  }
3941
3941
  connectedCallback() {
3942
- this._render(), this._setupBlurValidation(), requestAnimationFrame(() => {
3942
+ this._render(), this._ensureSubmitHandler(), this._setupBlurValidation(), requestAnimationFrame(() => {
3943
3943
  requestAnimationFrame(() => {
3944
3944
  if (this._formData)
3945
3945
  this._applyFormData();
@@ -3994,17 +3994,22 @@ class re extends HTMLElement {
3994
3994
  if (this.classList.add("block", "w-full"), !this._form) {
3995
3995
  for (this._form = document.createElement("form"), this._form.noValidate = !0; this.firstChild; )
3996
3996
  this._form.appendChild(this.firstChild);
3997
- this.appendChild(this._form), this._submitHandler = (e) => this._handleSubmit(e), this._form.addEventListener("submit", this._submitHandler, !0);
3997
+ this.appendChild(this._form);
3998
3998
  }
3999
- this._applyFormAttributes();
3999
+ this._ensureSubmitHandler(), this._applyFormAttributes();
4000
+ }
4001
+ _ensureSubmitHandler() {
4002
+ this._form && (this._submitHandler && this._form.removeEventListener("submit", this._submitHandler, !0), this._submitHandler = (e) => {
4003
+ e.preventDefault(), e.stopImmediatePropagation(), this._handleSubmit(e);
4004
+ }, this._form.addEventListener("submit", this._submitHandler, !0));
4000
4005
  }
4001
4006
  _applyFormAttributes() {
4002
4007
  if (!this._form) return;
4003
- const e = this.getAttribute("action") || "", t = (this.getAttribute("method") || "POST").toUpperCase(), i = this.getAttribute("enctype") || "application/x-www-form-urlencoded";
4004
- e && (this._form.action = e), this._form.method = t, this._form.enctype = i;
4008
+ const e = this.getAttribute("action") || "", t = this.getAttribute("method") || "", i = this.getAttribute("enctype") || "application/x-www-form-urlencoded";
4009
+ e && (this._form.action = e), t && (this._form.method = t), this._form.enctype = i;
4005
4010
  }
4006
4011
  async _handleSubmit(e) {
4007
- if (e.preventDefault(), e.stopPropagation(), !this._form) return;
4012
+ if (e.preventDefault(), !this._form) return;
4008
4013
  this._clearErrors(), this._syncDropzoneFiles();
4009
4014
  const t = this._collectValidationRules(), i = new FormData(this._form), s = this._formDataToValues(i);
4010
4015
  if (!this._validate(s, t)) {
@@ -4016,13 +4021,13 @@ class re extends HTMLElement {
4016
4021
  }));
4017
4022
  return;
4018
4023
  }
4019
- const n = new CustomEvent("submit", {
4024
+ const r = new CustomEvent("submit", {
4020
4025
  detail: { formData: i, values: s },
4021
4026
  bubbles: !0,
4022
4027
  cancelable: !0,
4023
4028
  composed: !0
4024
4029
  });
4025
- if (this.dispatchEvent(n), n.defaultPrevented)
4030
+ if (this.dispatchEvent(r), r.defaultPrevented)
4026
4031
  return;
4027
4032
  const a = this.getAttribute("action"), l = this.getAttribute("method");
4028
4033
  if (!(!a || !l))
@@ -4042,10 +4047,10 @@ class re extends HTMLElement {
4042
4047
  }
4043
4048
  }
4044
4049
  async _submitData(e, t) {
4045
- const i = this.getAttribute("action"), s = (this.getAttribute("method") || "POST").toUpperCase(), r = this.getAttribute("enctype") || "application/x-www-form-urlencoded";
4050
+ const i = this.getAttribute("action"), s = this.getAttribute("method"), n = this.getAttribute("enctype") || "application/x-www-form-urlencoded";
4046
4051
  if (!i)
4047
4052
  return { status: 0, ok: !0, data: { values: t } };
4048
- const n = Array.from(e.values()).some((h) => h instanceof File);
4053
+ const r = Array.from(e.values()).some((h) => h instanceof File);
4049
4054
  let a = null;
4050
4055
  const l = {};
4051
4056
  let o = i;
@@ -4054,9 +4059,9 @@ class re extends HTMLElement {
4054
4059
  e.forEach((c, u) => {
4055
4060
  c instanceof File || h.append(u, String(c));
4056
4061
  }), o += (i.includes("?") ? "&" : "?") + h.toString();
4057
- } else if (r === "multipart/form-data" || n)
4062
+ } else if (n === "multipart/form-data" || r)
4058
4063
  a = e;
4059
- else if (r === "application/json")
4064
+ else if (n === "application/json")
4060
4065
  a = JSON.stringify(t), l["Content-Type"] = "application/json";
4061
4066
  else {
4062
4067
  const h = new URLSearchParams();
@@ -4066,7 +4071,7 @@ class re extends HTMLElement {
4066
4071
  }
4067
4072
  if (typeof fetch == "function") {
4068
4073
  const h = await fetch(o, {
4069
- method: s,
4074
+ method: s || "POST",
4070
4075
  body: s === "GET" ? null : a,
4071
4076
  headers: l
4072
4077
  }), c = await h.text().catch(() => "");
@@ -4081,7 +4086,7 @@ class re extends HTMLElement {
4081
4086
  }
4082
4087
  return await new Promise((h, c) => {
4083
4088
  const u = new XMLHttpRequest();
4084
- u.open(s, o, !0), Object.entries(l).forEach(([d, f]) => u.setRequestHeader(d, f)), u.onload = function() {
4089
+ u.open(s || "POST", o, !0), Object.entries(l).forEach(([d, f]) => u.setRequestHeader(d, f)), u.onload = function() {
4085
4090
  const { status: d, responseText: f } = u;
4086
4091
  if (d >= 200 && d < 300) {
4087
4092
  let p = f;
@@ -4101,10 +4106,10 @@ class re extends HTMLElement {
4101
4106
  const t = {};
4102
4107
  return e.forEach((i, s) => {
4103
4108
  i instanceof File ? (t[s] || (t[s] = []), t[s].push(i)) : s in t ? Array.isArray(t[s]) ? (t[s].length > 0 && t[s][0] instanceof File, t[s].push(i)) : t[s] = [t[s], i] : t[s] = i;
4104
- }), this._form && (Array.from(this._form.querySelectorAll("mint-dropzone[name]")).forEach((n) => {
4105
- const a = n.getAttribute("name");
4106
- if (a && typeof n.files < "u" && n.files) {
4107
- const l = n.files;
4109
+ }), this._form && (Array.from(this._form.querySelectorAll("mint-dropzone[name]")).forEach((r) => {
4110
+ const a = r.getAttribute("name");
4111
+ if (a && typeof r.files < "u" && r.files) {
4112
+ const l = r.files;
4108
4113
  if (l.length > 0) {
4109
4114
  const o = Array.from(l);
4110
4115
  t[a] && Array.isArray(t[a]) ? o.forEach((h) => {
@@ -4114,21 +4119,21 @@ class re extends HTMLElement {
4114
4119
  }) : t[a] = o;
4115
4120
  }
4116
4121
  }
4117
- }), Array.from(this._form.querySelectorAll('input[type="file"][name]')).forEach((n) => {
4118
- const a = n.name;
4119
- if (a && n.files && n.files.length > 0) {
4120
- const l = Array.from(n.files);
4122
+ }), Array.from(this._form.querySelectorAll('input[type="file"][name]')).forEach((r) => {
4123
+ const a = r.name;
4124
+ if (a && r.files && r.files.length > 0) {
4125
+ const l = Array.from(r.files);
4121
4126
  t[a] && Array.isArray(t[a]) ? l.forEach((o) => {
4122
4127
  t[a].some(
4123
4128
  (c) => c.name === o.name && c.size === o.size && c.lastModified === o.lastModified
4124
4129
  ) || t[a].push(o);
4125
4130
  }) : t[a] = l;
4126
4131
  }
4127
- }), Array.from(this._form.querySelectorAll("mint-tags[name]")).forEach((n) => {
4128
- const a = n.getAttribute("name");
4132
+ }), Array.from(this._form.querySelectorAll("mint-tags[name]")).forEach((r) => {
4133
+ const a = r.getAttribute("name");
4129
4134
  if (a) {
4130
4135
  let l = [];
4131
- if (typeof n.tags < "u" ? l = n.tags : typeof n.getTags == "function" && (l = n.getTags()), Array.isArray(l) && l.length > 0) {
4136
+ if (typeof r.tags < "u" ? l = r.tags : typeof r.getTags == "function" && (l = r.getTags()), Array.isArray(l) && l.length > 0) {
4132
4137
  const o = l.map((h) => typeof h == "string" ? h : (h == null ? void 0 : h.value) || (h == null ? void 0 : h.label) || "").filter((h) => h.trim() !== "");
4133
4138
  t[a] = o;
4134
4139
  } else
@@ -4139,10 +4144,10 @@ class re extends HTMLElement {
4139
4144
  _collectValidationRules() {
4140
4145
  const e = {};
4141
4146
  return this._form && Array.from(this._form.querySelectorAll("[name][validation]")).forEach((i) => {
4142
- const s = i.getAttribute("name") || "", r = i.getAttribute("validation");
4143
- if (!s || !r) return;
4144
- const n = this._parseRules(r);
4145
- n.length && (e[s] = n);
4147
+ const s = i.getAttribute("name") || "", n = i.getAttribute("validation");
4148
+ if (!s || !n) return;
4149
+ const r = this._parseRules(n);
4150
+ r.length && (e[s] = r);
4146
4151
  }), e;
4147
4152
  }
4148
4153
  _parseRules(e) {
@@ -4157,20 +4162,20 @@ class re extends HTMLElement {
4157
4162
  }
4158
4163
  _validate(e, t) {
4159
4164
  let i = !0;
4160
- return this._errors = {}, Object.entries(t || {}).forEach(([s, r]) => {
4161
- const n = Array.isArray(r) ? r : [r], a = this._getFieldElements(s), l = this._extractFieldValue(a), o = this._validateRules(l, n);
4165
+ return this._errors = {}, Object.entries(t || {}).forEach(([s, n]) => {
4166
+ const r = Array.isArray(n) ? n : [n], a = this._getFieldElements(s), l = this._extractFieldValue(a), o = this._validateRules(l, r);
4162
4167
  o ? (i = !1, this._errors[s] = o, this._flagFieldError(a, o)) : this._clearFieldError(a);
4163
4168
  }), i;
4164
4169
  }
4165
4170
  _validateField(e) {
4166
4171
  const t = this._collectValidationRules();
4167
4172
  if (!t[e]) return;
4168
- const i = t[e], s = Array.isArray(i) ? i : [i], r = this._getFieldElements(e), n = this._extractFieldValue(r), a = this._validateRules(n, s);
4169
- a ? (this._errors[e] = a, this._flagFieldError(r, a)) : (this._clearFieldError(r), delete this._errors[e]);
4173
+ const i = t[e], s = Array.isArray(i) ? i : [i], n = this._getFieldElements(e), r = this._extractFieldValue(n), a = this._validateRules(r, s);
4174
+ a ? (this._errors[e] = a, this._flagFieldError(n, a)) : (this._clearFieldError(n), delete this._errors[e]);
4170
4175
  }
4171
4176
  _validateRules(e, t) {
4172
4177
  for (const i of t) {
4173
- const [s, r] = i.split(":");
4178
+ const [s, n] = i.split(":");
4174
4179
  switch (s) {
4175
4180
  case "required": {
4176
4181
  if (e == null || typeof e == "string" && e.trim() === "" || e instanceof FileList && e.length === 0 || Array.isArray(e) && e.length === 0) return "This field is required.";
@@ -4186,26 +4191,26 @@ class re extends HTMLElement {
4186
4191
  break;
4187
4192
  }
4188
4193
  case "number": {
4189
- const n = Number(e);
4190
- if (Number.isNaN(n)) return "Must be a number.";
4194
+ const r = Number(e);
4195
+ if (Number.isNaN(r)) return "Must be a number.";
4191
4196
  break;
4192
4197
  }
4193
4198
  case "min": {
4194
- const n = Number(r);
4195
- if (Number.isNaN(n)) break;
4196
- if (typeof e == "string" && e.trim().length < n) return `Must be at least ${n} characters.`;
4197
- if (Array.isArray(e) && e.length < n) return `Select at least ${n}.`;
4198
- if (e instanceof FileList && e.length < n) return `Upload at least ${n} files.`;
4199
- if (e != null && !Number.isNaN(Number(e)) && Number(e) < n) return `Must be at least ${n}.`;
4199
+ const r = Number(n);
4200
+ if (Number.isNaN(r)) break;
4201
+ if (typeof e == "string" && e.trim().length < r) return `Must be at least ${r} characters.`;
4202
+ if (Array.isArray(e) && e.length < r) return `Select at least ${r}.`;
4203
+ if (e instanceof FileList && e.length < r) return `Upload at least ${r} files.`;
4204
+ if (e != null && !Number.isNaN(Number(e)) && Number(e) < r) return `Must be at least ${r}.`;
4200
4205
  break;
4201
4206
  }
4202
4207
  case "max": {
4203
- const n = Number(r);
4204
- if (Number.isNaN(n)) break;
4205
- if (typeof e == "string" && e.trim().length > n) return `Must be at most ${n} characters.`;
4206
- if (Array.isArray(e) && e.length > n) return `Select no more than ${n}.`;
4207
- if (e instanceof FileList && e.length > n) return `Upload no more than ${n} files.`;
4208
- if (e != null && !Number.isNaN(Number(e)) && Number(e) > n) return `Must be at most ${n}.`;
4208
+ const r = Number(n);
4209
+ if (Number.isNaN(r)) break;
4210
+ if (typeof e == "string" && e.trim().length > r) return `Must be at most ${r} characters.`;
4211
+ if (Array.isArray(e) && e.length > r) return `Select no more than ${r}.`;
4212
+ if (e instanceof FileList && e.length > r) return `Upload no more than ${r} files.`;
4213
+ if (e != null && !Number.isNaN(Number(e)) && Number(e) > r) return `Must be at most ${r}.`;
4209
4214
  break;
4210
4215
  }
4211
4216
  }
@@ -4214,23 +4219,23 @@ class re extends HTMLElement {
4214
4219
  }
4215
4220
  _getFieldElements(e) {
4216
4221
  if (!this._form) return [];
4217
- const t = Array.from(this._form.querySelectorAll(`[name="${e}"]`)), i = t.filter((n) => n.tagName === "MINT-SELECT");
4222
+ const t = Array.from(this._form.querySelectorAll(`[name="${e}"]`)), i = t.filter((r) => r.tagName === "MINT-SELECT");
4218
4223
  if (i.length > 0) {
4219
- const n = [];
4224
+ const r = [];
4220
4225
  return i.forEach((a) => {
4221
4226
  const l = a.querySelector('select[name="' + e + '"]');
4222
- l && n.push(l);
4223
- }), t.filter((a) => a.tagName !== "MINT-SELECT").concat(n);
4227
+ l && r.push(l);
4228
+ }), t.filter((a) => a.tagName !== "MINT-SELECT").concat(r);
4224
4229
  }
4225
- if (t.filter((n) => n.tagName === "MINT-TAGS").length > 0)
4226
- return t.filter((n) => n.tagName !== "INPUT" || !n.closest("mint-tags"));
4227
- const r = t.filter((n) => n.tagName === "INPUT" && n.closest("mint-tags"));
4228
- if (r.length > 0) {
4229
- const n = [];
4230
- return r.forEach((a) => {
4230
+ if (t.filter((r) => r.tagName === "MINT-TAGS").length > 0)
4231
+ return t.filter((r) => r.tagName !== "INPUT" || !r.closest("mint-tags"));
4232
+ const n = t.filter((r) => r.tagName === "INPUT" && r.closest("mint-tags"));
4233
+ if (n.length > 0) {
4234
+ const r = [];
4235
+ return n.forEach((a) => {
4231
4236
  const l = a.closest("mint-tags");
4232
- l && !n.includes(l) && n.push(l);
4233
- }), t.filter((a) => a.tagName !== "INPUT" || !a.closest("mint-tags")).concat(n);
4237
+ l && !r.includes(l) && r.push(l);
4238
+ }), t.filter((a) => a.tagName !== "INPUT" || !a.closest("mint-tags")).concat(r);
4234
4239
  }
4235
4240
  return t;
4236
4241
  }
@@ -4248,9 +4253,9 @@ class re extends HTMLElement {
4248
4253
  if (s.every((l) => l.type === "checkbox"))
4249
4254
  return a.map((l) => l.value || "on");
4250
4255
  }
4251
- const r = e.filter((a) => a.tagName === "MINT-CHOICE");
4252
- if (r.length > 0 && r.length === e.length) {
4253
- const a = r.find((l) => typeof l.getValue == "function" ? l.getValue() !== "" : l.querySelector("mint-choice-option[checked]") !== null);
4256
+ const n = e.filter((a) => a.tagName === "MINT-CHOICE");
4257
+ if (n.length > 0 && n.length === e.length) {
4258
+ const a = n.find((l) => typeof l.getValue == "function" ? l.getValue() !== "" : l.querySelector("mint-choice-option[checked]") !== null);
4254
4259
  if (a) {
4255
4260
  if (typeof a.getValue == "function")
4256
4261
  return a.getValue();
@@ -4260,9 +4265,9 @@ class re extends HTMLElement {
4260
4265
  }
4261
4266
  return "";
4262
4267
  }
4263
- const n = e.filter((a) => a.tagName === "MINT-CHECKBOX");
4264
- if (n.length > 0 && n.length === e.length)
4265
- return n.filter((l) => typeof l.checked < "u" ? l.checked : l.hasAttribute("checked")).map((l) => l.getAttribute("value") || "on");
4268
+ const r = e.filter((a) => a.tagName === "MINT-CHECKBOX");
4269
+ if (r.length > 0 && r.length === e.length)
4270
+ return r.filter((l) => typeof l.checked < "u" ? l.checked : l.hasAttribute("checked")).map((l) => l.getAttribute("value") || "on");
4266
4271
  }
4267
4272
  const i = e[0];
4268
4273
  if (i instanceof HTMLInputElement)
@@ -4274,18 +4279,18 @@ class re extends HTMLElement {
4274
4279
  if (s)
4275
4280
  return s.value;
4276
4281
  if (typeof i.getValue == "function") {
4277
- const n = i.getValue();
4278
- if (n != null && n !== "")
4279
- return n;
4282
+ const r = i.getValue();
4283
+ if (r != null && r !== "")
4284
+ return r;
4280
4285
  }
4281
- const r = i.getAttribute("value");
4282
- return r || "";
4286
+ const n = i.getAttribute("value");
4287
+ return n || "";
4283
4288
  }
4284
4289
  if (i.tagName === "MINT-DROPZONE" && typeof i.files < "u")
4285
4290
  return i.files;
4286
4291
  if (i.tagName === "MINT-TAGS") {
4287
4292
  let s = null;
4288
- return typeof i.tags < "u" ? s = i.tags : typeof i.getTags == "function" && (s = i.getTags()), Array.isArray(s) ? s.map((n) => typeof n == "string" ? n : (n == null ? void 0 : n.value) || (n == null ? void 0 : n.label) || "").filter((n) => n.trim() !== "") : [];
4293
+ return typeof i.tags < "u" ? s = i.tags : typeof i.getTags == "function" && (s = i.getTags()), Array.isArray(s) ? s.map((r) => typeof r == "string" ? r : (r == null ? void 0 : r.value) || (r == null ? void 0 : r.label) || "").filter((r) => r.trim() !== "") : [];
4289
4294
  }
4290
4295
  return i.tagName === "MINT-CHECKBOX" || i.tagName === "MINT-SWITCH" ? (typeof i.checked < "u" ? i.checked : i.hasAttribute("checked")) ? i.getAttribute("value") || "on" : "" : i.tagName === "MINT-CHOICE" ? (typeof i.getValue == "function" ? i.getValue() : "") || "" : typeof i.value < "u" ? i.value : i.getAttribute("value") || "";
4291
4296
  }
@@ -4336,8 +4341,8 @@ class re extends HTMLElement {
4336
4341
  const s = this._getFieldElements(t);
4337
4342
  if (s.length === 0) {
4338
4343
  setTimeout(() => {
4339
- const r = this._getFieldElements(t);
4340
- r.length > 0 && this._applyValueToField(r, t, i);
4344
+ const n = this._getFieldElements(t);
4345
+ n.length > 0 && this._applyValueToField(n, t, i);
4341
4346
  }, 300);
4342
4347
  return;
4343
4348
  }
@@ -4352,24 +4357,23 @@ class re extends HTMLElement {
4352
4357
  }
4353
4358
  _applyValueToField(e, t, i) {
4354
4359
  e.forEach((s) => {
4355
- var n;
4356
- const r = s.tagName;
4357
- console.log(r);
4360
+ var r;
4361
+ const n = s.tagName;
4358
4362
  try {
4359
- if (r === "MINT-INPUT")
4363
+ if (n === "MINT-INPUT")
4360
4364
  typeof s.value < "u" && (s.value = i || "");
4361
- else if (r === "MINT-DATE-PICKER")
4365
+ else if (n === "MINT-DATE-PICKER")
4362
4366
  typeof s.setValue == "function" && s.setValue(i || "");
4363
- else if (r === "MINT-SELECT" || r === "SELECT")
4364
- r === "SELECT" ? (n = s.closest("mint-select")) == null || n.setValue(i || "") : typeof s.setValue == "function" && s.setValue(i || "");
4365
- else if (r === "MINT-CHOICE")
4367
+ else if (n === "MINT-SELECT" || n === "SELECT")
4368
+ n === "SELECT" ? (r = s.closest("mint-select")) == null || r.setValue(i || "") : typeof s.setValue == "function" && s.setValue(i || "");
4369
+ else if (n === "MINT-CHOICE")
4366
4370
  typeof s.setValue == "function" ? s.setValue(i || "") : s.querySelectorAll("mint-choice-option").forEach((l) => {
4367
4371
  l.checked = l.getAttribute("value") === i;
4368
4372
  });
4369
- else if (r === "MINT-CHECKBOX" || r === "MINT-SWITCH") {
4373
+ else if (n === "MINT-CHECKBOX" || n === "MINT-SWITCH") {
4370
4374
  const a = i === !0 || i === "true" || i === "on" || i === 1 || i === "1";
4371
4375
  typeof s.checked < "u" ? s.checked = a : a ? s.setAttribute("checked", "") : s.removeAttribute("checked");
4372
- } else r === "MINT-TAGS" ? Array.isArray(i) && typeof s.tags < "u" && (s.tags = i.map((a) => typeof a == "string" ? { value: a, label: a, dismissable: !0 } : a)) : s instanceof HTMLInputElement ? s.type === "checkbox" || s.type === "radio" ? s.checked = i === !0 || i === "true" || i === "on" || i === 1 || i === "1" : s.value = i || "" : (s instanceof HTMLTextAreaElement || s instanceof HTMLSelectElement) && (s.value = i || "");
4376
+ } else n === "MINT-TAGS" ? Array.isArray(i) && typeof s.tags < "u" && (s.tags = i.map((a) => typeof a == "string" ? { value: a, label: a, dismissable: !0 } : a)) : s instanceof HTMLInputElement ? s.type === "checkbox" || s.type === "radio" ? s.checked = i === !0 || i === "true" || i === "on" || i === 1 || i === "1" : s.value = i || "" : (s instanceof HTMLTextAreaElement || s instanceof HTMLSelectElement) && (s.value = i || "");
4373
4377
  } catch (a) {
4374
4378
  console.warn(`Failed to set value for field ${t}:`, a);
4375
4379
  }
@@ -4377,7 +4381,7 @@ class re extends HTMLElement {
4377
4381
  }
4378
4382
  _resetCustomFields() {
4379
4383
  this.querySelectorAll("mint-input, mint-date-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags").forEach((t) => {
4380
- var s, r;
4384
+ var s, n;
4381
4385
  t.removeAttribute("error"), t.removeAttribute("error-message");
4382
4386
  const i = t.tagName;
4383
4387
  if (i === "MINT-INPUT")
@@ -4392,20 +4396,20 @@ class re extends HTMLElement {
4392
4396
  }
4393
4397
  else if (i === "MINT-SELECT")
4394
4398
  try {
4395
- (r = t.setValue) == null || r.call(t, "");
4399
+ (n = t.setValue) == null || n.call(t, "");
4396
4400
  } catch {
4397
4401
  }
4398
4402
  else if (i === "MINT-DROPZONE") {
4399
- const n = t.querySelector('input[type="file"]');
4400
- n && (n.value = "");
4403
+ const r = t.querySelector('input[type="file"]');
4404
+ r && (r.value = "");
4401
4405
  } else if (i === "MINT-CHECKBOX" || i === "MINT-SWITCH")
4402
4406
  try {
4403
4407
  if (typeof t.checked < "u")
4404
4408
  t.checked = !1;
4405
4409
  else {
4406
4410
  t.removeAttribute("checked");
4407
- const n = t.querySelector('input[type="checkbox"], input[type="radio"]');
4408
- n && (n.checked = !1);
4411
+ const r = t.querySelector('input[type="checkbox"], input[type="radio"]');
4412
+ r && (r.checked = !1);
4409
4413
  }
4410
4414
  } catch {
4411
4415
  }
@@ -4436,13 +4440,13 @@ class re extends HTMLElement {
4436
4440
  const e = (i) => {
4437
4441
  const s = i.target;
4438
4442
  if (!s) return;
4439
- const r = this._findFieldElement(s);
4440
- if (!r) return;
4441
- const n = this._getFieldName(r);
4442
- if (!n || !this._collectValidationRules()[n]) return;
4443
- const l = this._extractFieldValue([r]), o = l != null && (typeof l == "string" ? l.trim() !== "" : l instanceof FileList || Array.isArray(l) ? l.length > 0 : !0), h = r.hasAttribute("data-mint-form-error") || s instanceof HTMLElement && (s.hasAttribute("aria-invalid") || s.closest("[data-mint-form-error]")), c = !!r.closest("mint-tags"), u = r.tagName === "MINT-CHECKBOX" || r.tagName === "MINT-SWITCH" || r.tagName === "MINT-CHOICE" || s instanceof HTMLElement && (s.closest("mint-checkbox, mint-switch, mint-choice") || s.closest("mint-choice-option")), d = r.tagName === "MINT-DATE-PICKER" || s instanceof HTMLElement && s.closest("mint-date-picker");
4443
+ const n = this._findFieldElement(s);
4444
+ if (!n) return;
4445
+ const r = this._getFieldName(n);
4446
+ if (!r || !this._collectValidationRules()[r]) return;
4447
+ const l = this._extractFieldValue([n]), o = l != null && (typeof l == "string" ? l.trim() !== "" : l instanceof FileList || Array.isArray(l) ? l.length > 0 : !0), h = n.hasAttribute("data-mint-form-error") || s instanceof HTMLElement && (s.hasAttribute("aria-invalid") || s.closest("[data-mint-form-error]")), c = !!n.closest("mint-tags"), u = n.tagName === "MINT-CHECKBOX" || n.tagName === "MINT-SWITCH" || n.tagName === "MINT-CHOICE" || s instanceof HTMLElement && (s.closest("mint-checkbox, mint-switch, mint-choice") || s.closest("mint-choice-option")), d = n.tagName === "MINT-DATE-PICKER" || s instanceof HTMLElement && s.closest("mint-date-picker");
4444
4448
  (o || h || c || u || d) && setTimeout(() => {
4445
- this._validateField(n);
4449
+ this._validateField(r);
4446
4450
  }, 0);
4447
4451
  };
4448
4452
  this._form.addEventListener("blur", e, !0), this._fieldBlurHandlers.set(this._form, e);
@@ -4587,8 +4591,8 @@ class ne extends HTMLElement {
4587
4591
  }
4588
4592
  const t = this.hasAttribute("collapse") && !this.hasAttribute("scroll"), i = this.hasAttribute("scroll");
4589
4593
  i ? this.classList.add("relative") : this.classList.remove("relative");
4590
- const s = [], r = e.querySelector("thead tr");
4591
- r && r.querySelectorAll("th").forEach((h) => s.push((h.textContent || "").trim())), this._setClasses(e, [
4594
+ const s = [], n = e.querySelector("thead tr");
4595
+ n && n.querySelectorAll("th").forEach((h) => s.push((h.textContent || "").trim())), this._setClasses(e, [
4592
4596
  "w-full",
4593
4597
  i ? "min-w-[1200px]" : "",
4594
4598
  "border-collapse",
@@ -4600,11 +4604,11 @@ class ne extends HTMLElement {
4600
4604
  "dark:border-gray-700",
4601
4605
  "overflow-hidden"
4602
4606
  ]);
4603
- const n = e.querySelector("thead");
4604
- n && (this._setClasses(n, [
4607
+ const r = e.querySelector("thead");
4608
+ r && (this._setClasses(r, [
4605
4609
  "bg-[#F7F7F7]",
4606
4610
  "dark:bg-gray-800"
4607
- ]), n.querySelectorAll("th").forEach((h) => {
4611
+ ]), r.querySelectorAll("th").forEach((h) => {
4608
4612
  this._setClasses(h, [
4609
4613
  "text-left",
4610
4614
  "font-semibold",
@@ -4656,12 +4660,12 @@ class ne extends HTMLElement {
4656
4660
  }
4657
4661
  _applyMobileCell(e, t) {
4658
4662
  if (e.closest("tfoot") || e.dataset.mtProcessed === "true") return;
4659
- const i = t[e.cellIndex] || "", s = e.getAttribute("data-original"), r = s !== null ? s : e.innerHTML;
4660
- e.setAttribute("data-original", r), e.dataset.mtProcessed = "true", e.innerHTML = "";
4661
- const n = document.createElement("span");
4662
- n.className = "mt-label font-semibold text-gray-700 dark:text-gray-200 hidden", n.textContent = i;
4663
+ const i = t[e.cellIndex] || "", s = e.getAttribute("data-original"), n = s !== null ? s : e.innerHTML;
4664
+ e.setAttribute("data-original", n), e.dataset.mtProcessed = "true", e.innerHTML = "";
4665
+ const r = document.createElement("span");
4666
+ r.className = "mt-label font-semibold text-gray-700 dark:text-gray-200 hidden", r.textContent = i;
4663
4667
  const a = document.createElement("span");
4664
- a.className = "mt-value text-gray-900 dark:text-gray-100 text-right md:text-left w-full", a.innerHTML = r, e.appendChild(n), e.appendChild(a);
4668
+ a.className = "mt-value text-gray-900 dark:text-gray-100 text-right md:text-left w-full", a.innerHTML = n, e.appendChild(r), e.appendChild(a);
4665
4669
  }
4666
4670
  _restoreCell(e) {
4667
4671
  if (e.dataset.mtProcessed !== "true") return;
@@ -4831,7 +4835,7 @@ class oe extends HTMLElement {
4831
4835
  if (t !== i) {
4832
4836
  if (e === "error" || e === "error-message") {
4833
4837
  if (this._renderErrorState(), this._container) {
4834
- const s = this.hasError(), r = [
4838
+ const s = this.hasError(), n = [
4835
4839
  "flex",
4836
4840
  "flex-wrap",
4837
4841
  "items-center",
@@ -4851,7 +4855,7 @@ class oe extends HTMLElement {
4851
4855
  "transition-colors",
4852
4856
  "duration-200"
4853
4857
  ];
4854
- this._container.className = r.join(" ");
4858
+ this._container.className = n.join(" ");
4855
4859
  }
4856
4860
  return;
4857
4861
  }
@@ -4909,8 +4913,8 @@ class oe extends HTMLElement {
4909
4913
  }
4910
4914
  _render() {
4911
4915
  this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "block", "w-full");
4912
- const e = this.isLoading(), t = this.getLabel(), i = this.getInfo(), s = this.hasError(), r = this.getId() || `mint-tags-${Math.random().toString(36).substr(2, 9)}`;
4913
- if (this.getId() || this.setAttribute("id", r), this._container)
4916
+ const e = this.isLoading(), t = this.getLabel(), i = this.getInfo(), s = this.hasError(), n = this.getId() || `mint-tags-${Math.random().toString(36).substr(2, 9)}`;
4917
+ if (this.getId() || this.setAttribute("id", n), this._container)
4914
4918
  this._input && (this._input.placeholder = this._placeholder);
4915
4919
  else {
4916
4920
  this._container = document.createElement("div");
@@ -4977,16 +4981,16 @@ class oe extends HTMLElement {
4977
4981
  ];
4978
4982
  this._container.className = o.join(" ");
4979
4983
  }
4980
- let n = this.querySelector(".mint-tags-label-container");
4984
+ let r = this.querySelector(".mint-tags-label-container");
4981
4985
  if (t) {
4982
- n || (n = document.createElement("div"), n.className = "mint-tags-label-container mb-[.25rem]", this._container && this._container.parentElement === this ? this.insertBefore(n, this._container) : this.insertBefore(n, this.firstChild));
4983
- let o = n.querySelector(".mint-tags-label");
4984
- t ? (o || (o = document.createElement("label"), o.className = "mint-tags-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", n.appendChild(o)), o.textContent = t, o.setAttribute("for", r)) : o && o.remove();
4985
- } else n && n.remove();
4986
+ r || (r = document.createElement("div"), r.className = "mint-tags-label-container mb-[.25rem]", this._container && this._container.parentElement === this ? this.insertBefore(r, this._container) : this.insertBefore(r, this.firstChild));
4987
+ let o = r.querySelector(".mint-tags-label");
4988
+ t ? (o || (o = document.createElement("label"), o.className = "mint-tags-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", r.appendChild(o)), o.textContent = t, o.setAttribute("for", n)) : o && o.remove();
4989
+ } else r && r.remove();
4986
4990
  let a = this.querySelector(".mint-tags-info");
4987
4991
  i ? (a || (a = document.createElement("span"), a.className = "mint-tags-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block", this._container && this._container.parentElement === this ? this.insertBefore(a, this._container.nextSibling) : this.appendChild(a)), a.textContent = i) : a && a.remove();
4988
4992
  const l = this.getName();
4989
- l ? (this.setAttribute("name", l), this._input && (this._input.name = l, this._input.id = r)) : (this.removeAttribute("name"), this._input && (this._input.removeAttribute("name"), this._input.id = r)), this._wireInputBackspace(), this._renderChips(), this._renderErrorState(), this._renderSkeleton(e);
4993
+ l ? (this.setAttribute("name", l), this._input && (this._input.name = l, this._input.id = n)) : (this.removeAttribute("name"), this._input && (this._input.removeAttribute("name"), this._input.id = n)), this._wireInputBackspace(), this._renderChips(), this._renderErrorState(), this._renderSkeleton(e);
4990
4994
  }
4991
4995
  _renderSkeleton(e) {
4992
4996
  const t = this._container;
@@ -5008,7 +5012,7 @@ class oe extends HTMLElement {
5008
5012
  const i = document.createElement("mint-chip");
5009
5013
  i.dataset.index = String(e++), i.dataset.value = t.value, i.draggable = this.hasAttribute("sortable"), i.draggable && i.classList.add("cursor-move"), t.dismissable && (i.setAttribute("dismissable", ""), i.addEventListener("dismissed", () => this._removeTag(t.value))), this._chipsWrap.appendChild(i);
5010
5014
  const s = i.querySelector("[data-mt-chip-text]");
5011
- s && (s.textContent = t.label || t.value), this._setupChipEvents(i, t), i.draggable && (i.addEventListener("dragstart", (r) => this._onDragStart(r, i)), i.addEventListener("dragover", (r) => this._onDragOverChip(r, i)), i.addEventListener("drop", (r) => this._onDrop(r)), i.addEventListener("dragend", () => this._onDragEnd())), this.hasAttribute("sortable") && i.addEventListener("pointerdown", (r) => this._onPointerDown(r, i));
5015
+ s && (s.textContent = t.label || t.value), this._setupChipEvents(i, t), i.draggable && (i.addEventListener("dragstart", (n) => this._onDragStart(n, i)), i.addEventListener("dragover", (n) => this._onDragOverChip(n, i)), i.addEventListener("drop", (n) => this._onDrop(n)), i.addEventListener("dragend", () => this._onDragEnd())), this.hasAttribute("sortable") && i.addEventListener("pointerdown", (n) => this._onPointerDown(n, i));
5012
5016
  }), this._input && (this.hasAttribute("sortable") && (this._input.addEventListener("dragover", (t) => this._onDragOverInput(t)), this._input.addEventListener("drop", (t) => this._onDrop(t)), this._input.addEventListener("dragend", () => this._onDragEnd())), this._chipsWrap.appendChild(this._input));
5013
5017
  }
5014
5018
  _addFromInput() {
@@ -5071,14 +5075,14 @@ class oe extends HTMLElement {
5071
5075
  }
5072
5076
  _onDragOverChip(e, t) {
5073
5077
  if (!this.hasAttribute("sortable") || (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "move"), !this._dragChip || !this._chipsWrap) || t === this._dragChip) return;
5074
- const i = t.getBoundingClientRect(), s = e.clientX, r = i.left + i.width * 0.5;
5075
- if (s < r) {
5078
+ const i = t.getBoundingClientRect(), s = e.clientX, n = i.left + i.width * 0.5;
5079
+ if (s < n) {
5076
5080
  if (this._dragChip.nextSibling === t) return;
5077
5081
  this._chipsWrap.insertBefore(this._dragChip, t);
5078
5082
  } else {
5079
5083
  if (t.nextSibling === this._dragChip) return;
5080
- const n = t.nextSibling;
5081
- n ? this._chipsWrap.insertBefore(this._dragChip, n) : this._chipsWrap.appendChild(this._dragChip);
5084
+ const r = t.nextSibling;
5085
+ r ? this._chipsWrap.insertBefore(this._dragChip, r) : this._chipsWrap.appendChild(this._dragChip);
5082
5086
  }
5083
5087
  }
5084
5088
  _onDrop(e) {
@@ -5095,8 +5099,8 @@ class oe extends HTMLElement {
5095
5099
  e.forEach((i) => {
5096
5100
  const s = i.dataset.value;
5097
5101
  if (!s) return;
5098
- const r = this._tags.find((n) => n.value === s);
5099
- r && t.push(r);
5102
+ const n = this._tags.find((r) => r.value === s);
5103
+ n && t.push(n);
5100
5104
  }), t.length === this._tags.length && (this._tags = t, this._syncAttr(), this._renderChips(), this._emitChange());
5101
5105
  }
5102
5106
  // Pointer-based sortable for touch (and optionally mouse)
@@ -5116,8 +5120,8 @@ class oe extends HTMLElement {
5116
5120
  if (!t) return;
5117
5121
  const i = t.closest("mint-chip");
5118
5122
  if (i && i !== this._dragChip) {
5119
- const s = i.getBoundingClientRect(), r = e.clientX, n = s.left + s.width * 0.5;
5120
- if (r < n)
5123
+ const s = i.getBoundingClientRect(), n = e.clientX, r = s.left + s.width * 0.5;
5124
+ if (n < r)
5121
5125
  this._dragChip.nextSibling !== i && this._chipsWrap.insertBefore(this._dragChip, i);
5122
5126
  else if (i.nextSibling !== this._dragChip) {
5123
5127
  const a = i.nextSibling;
@@ -5291,25 +5295,25 @@ class ce extends HTMLElement {
5291
5295
  this.className = `box-border m-0 p-0 border-0 align-baseline block rounded-lg border shadow-sm overflow-hidden transition-colors duration-200 ${this.getBorderClasses()}`;
5292
5296
  const s = this.getAriaLive();
5293
5297
  this.setAttribute("role", "alert"), this.setAttribute("aria-live", s), e === "danger" ? this.setAttribute("aria-atomic", "true") : this.removeAttribute("aria-atomic");
5294
- const r = [];
5298
+ const n = [];
5295
5299
  for (this._bodyWrapper ? Array.from(this._bodyWrapper.childNodes).forEach((a) => {
5296
- r.push(a);
5297
- }) : Array.from(this.childNodes).forEach((n) => {
5298
- n !== this._headerWrapper && n !== this._bodyWrapper && n !== this._iconElement && n !== this._headingElement && n !== this._dismissButton && r.push(n);
5300
+ n.push(a);
5301
+ }) : Array.from(this.childNodes).forEach((r) => {
5302
+ r !== this._headerWrapper && r !== this._bodyWrapper && r !== this._iconElement && r !== this._headingElement && r !== this._dismissButton && n.push(r);
5299
5303
  }), this._dismissButton && this._dismissHandler && this._dismissButton.removeEventListener("click", this._dismissHandler); this.firstChild; )
5300
5304
  this.removeChild(this.firstChild);
5301
5305
  if (this._headerWrapper = null, this._bodyWrapper = null, this._iconElement = null, this._headingElement = null, this._dismissButton = null, this._headerWrapper = document.createElement("div"), this._headerWrapper.className = `px-4 py-3 flex items-center gap-3 ${this.getHeaderBackgroundClasses()}`, this._iconElement = document.createElement("mint-icon"), this._iconElement.setAttribute("name", this.getIconName()), this._iconElement.className = `flex-shrink-0 w-5 h-5 ${this.getIconColorClasses()}`, this._headerWrapper.appendChild(this._iconElement), this._headingElement = document.createElement("mint-text"), this._headingElement.className = `font-semibold flex-1 ${this.getHeadingColorClasses()}`, this._headingElement.textContent = t || "", this._headerWrapper.appendChild(this._headingElement), i) {
5302
5306
  this._dismissButton = document.createElement("button"), this._dismissButton.className = "flex-shrink-0 p-1 rounded hover:bg-black/10 dark:hover:bg-white/10 transition-colors", this._dismissButton.setAttribute("aria-label", "Dismiss alert"), this._dismissButton.setAttribute("type", "button");
5303
- const n = document.createElement("mint-icon");
5304
- n.setAttribute("name", "close"), n.className = "w-4 h-4 text-gray-700 dark:text-gray-300", this._dismissButton.appendChild(n), this._dismissHandler = (a) => {
5307
+ const r = document.createElement("mint-icon");
5308
+ r.setAttribute("name", "close"), r.className = "w-4 h-4 text-gray-700 dark:text-gray-300", this._dismissButton.appendChild(r), this._dismissHandler = (a) => {
5305
5309
  a.preventDefault(), a.stopPropagation(), this.dispatchEvent(new CustomEvent("dismissed", {
5306
5310
  bubbles: !0,
5307
5311
  composed: !0
5308
5312
  })), this.remove();
5309
5313
  }, this._dismissButton.addEventListener("click", this._dismissHandler), this._headerWrapper.appendChild(this._dismissButton);
5310
5314
  }
5311
- this._bodyWrapper = document.createElement("div"), this._bodyWrapper.className = "px-4 py-3 bg-white dark:bg-gray-800", r.forEach((n) => {
5312
- this._bodyWrapper.appendChild(n);
5315
+ this._bodyWrapper = document.createElement("div"), this._bodyWrapper.className = "px-4 py-3 bg-white dark:bg-gray-800", n.forEach((r) => {
5316
+ this._bodyWrapper.appendChild(r);
5313
5317
  }), this.appendChild(this._headerWrapper), this.appendChild(this._bodyWrapper);
5314
5318
  }
5315
5319
  }