builder-settings-types 0.0.312 → 0.0.314

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.
@@ -348,30 +348,30 @@ const Y = class Y {
348
348
  updateVisibility() {
349
349
  this.elementRef;
350
350
  }
351
- updateSettings(t) {
352
- var o;
353
- const e = new Set(Object.keys(this.settings)), i = Object.keys(t), s = {};
354
- i.forEach((a) => {
355
- const l = this.settings[a];
356
- l && (L(l) ? s[a] = l.getValues() : A(l) ? s[a] = l.value : typeof l.getValues == "function" ? s[a] = l.getValues() : l.value !== void 0 && (s[a] = l.value));
357
- }), e.forEach((a) => {
358
- i.includes(a) || this.removeSetting(a);
359
- }), i.forEach((a) => {
351
+ updateSettings(t, e) {
352
+ var l;
353
+ const i = (e == null ? void 0 : e.preserveValues) ?? !0, s = new Set(Object.keys(this.settings)), n = Object.keys(t), o = {};
354
+ i && n.forEach((r) => {
355
+ const h = this.settings[r];
356
+ h && (L(h) ? o[r] = h.getValues() : A(h) ? o[r] = h.value : typeof h.getValues == "function" ? o[r] = h.getValues() : h.value !== void 0 && (o[r] = h.value));
357
+ }), s.forEach((r) => {
358
+ n.includes(r) || this.removeSetting(r);
359
+ }), n.forEach((r) => {
360
360
  var p;
361
- const l = t[a], r = this.settings[a];
362
- if (r !== l && (r && this.removeSetting(a), this.addSetting(a, l), a in s)) {
363
- const h = s[a];
361
+ const h = t[r], d = this.settings[r];
362
+ if (d !== h && (d && this.removeSetting(r), this.addSetting(r, h), i && r in o)) {
363
+ const g = o[r];
364
364
  try {
365
- L(l) ? l.setValue(
366
- h
367
- ) : A(l) ? (p = l.setValue) == null || p.call(l, h) : l.setValue && l.setValue(h);
368
- } catch (d) {
369
- console.warn(`Could not preserve value for setting ${a}:`, d);
365
+ L(h) ? h.setValue(
366
+ g
367
+ ) : A(h) ? (p = h.setValue) == null || p.call(h, g) : h.setValue && h.setValue(g);
368
+ } catch (v) {
369
+ console.warn(`Could not preserve value for setting ${r}:`, v);
370
370
  }
371
371
  }
372
372
  }), this.settings = t, this.propagateNestingLevel(), this.propagateDataPropsPath();
373
- const n = this.getValues();
374
- this.initialValues = n, (o = this.onChange) == null || o.call(this, n);
373
+ const a = this.getValues();
374
+ this.initialValues = a, (l = this.onChange) == null || l.call(this, a);
375
375
  }
376
376
  clone() {
377
377
  const t = {};
@@ -497,13 +497,13 @@ const Y = class Y {
497
497
  L(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
498
498
  const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
499
499
  if (l) {
500
- const h = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
501
- h && t.startsWith(h) && this.addDeleteButtonToElement(a, t);
500
+ const d = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
501
+ d && t.startsWith(d) && this.addDeleteButtonToElement(a, t);
502
502
  }
503
503
  const r = o.querySelector(".sg-add-button-bottom");
504
504
  r ? o.insertBefore(a, r) : o.appendChild(a), at.trackElement(a), _(a, this.nestingLevel + 1), tt(a, this.nestingLevel + 1);
505
- const p = a.style.display;
506
- a.style.display = "none", a.offsetHeight, a.style.display = p, this.updateNestingStyles();
505
+ const h = a.style.display;
506
+ a.style.display = "none", a.offsetHeight, a.style.display = h, this.updateNestingStyles();
507
507
  }
508
508
  }
509
509
  const i = this.getValues();
@@ -520,9 +520,9 @@ const Y = class Y {
520
520
  const r = Array.from(
521
521
  t.querySelectorAll(".setting-group-title")
522
522
  );
523
- for (const p of r)
524
- if (p.closest(".setting-group") === t) {
525
- s = p;
523
+ for (const h of r)
524
+ if (h.closest(".setting-group") === t) {
525
+ s = h;
526
526
  break;
527
527
  }
528
528
  s || (s = r[0] ?? null);
@@ -555,8 +555,8 @@ const Y = class Y {
555
555
  }), o.addEventListener("mouseleave", () => {
556
556
  o.style.backgroundColor = "transparent";
557
557
  }), o.addEventListener("click", (r) => {
558
- r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((p) => {
559
- p && (i && i.deleteItemCfg ? this.removeSetting(e) : this.removeSetting(e));
558
+ r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((h) => {
559
+ h && (i && i.deleteItemCfg ? this.removeSetting(e) : this.removeSetting(e));
560
560
  });
561
561
  });
562
562
  const l = n.querySelector(".setting-group-arrow");
@@ -650,13 +650,13 @@ const Y = class Y {
650
650
  r(), t(!1);
651
651
  }), l.addEventListener("click", () => {
652
652
  r(), t(!0);
653
- }), e.addEventListener("click", (h) => {
654
- h.target === e && (r(), t(!1));
653
+ }), e.addEventListener("click", (d) => {
654
+ d.target === e && (r(), t(!1));
655
655
  });
656
- const p = (h) => {
657
- h.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", p));
656
+ const h = (d) => {
657
+ d.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", h));
658
658
  };
659
- document.addEventListener("keydown", p), o.appendChild(a), o.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(o), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
659
+ document.addEventListener("keydown", h), o.appendChild(a), o.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(o), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
660
660
  e.style.opacity = "1", i.style.transform = "scale(1)";
661
661
  }), setTimeout(() => l.focus(), 100);
662
662
  });
@@ -778,41 +778,41 @@ const Y = class Y {
778
778
  (!this.isCollapsed).toString()
779
779
  );
780
780
  };
781
- if (e.onclick = l, e.onkeydown = (p) => {
782
- (p.key === "Enter" || p.key === " ") && (p.preventDefault(), l());
781
+ if (e.onclick = l, e.onkeydown = (h) => {
782
+ (h.key === "Enter" || h.key === " ") && (h.preventDefault(), l());
783
783
  }, Object.keys(this.settings).length > 0) {
784
- for (const p in this.settings)
785
- if (Object.prototype.hasOwnProperty.call(this.settings, p)) {
786
- const h = this.settings[p];
787
- L(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.nestingLevel + 1);
788
- const d = h.draw();
789
- L(h) && h.deleteItemCfg && this.addDeleteButtonToElement(
790
- d,
784
+ for (const h in this.settings)
785
+ if (Object.prototype.hasOwnProperty.call(this.settings, h)) {
786
+ const d = this.settings[h];
787
+ L(d) && typeof d.setNestingLevel == "function" && d.setNestingLevel(this.nestingLevel + 1);
788
+ const p = d.draw();
789
+ L(d) && d.deleteItemCfg && this.addDeleteButtonToElement(
791
790
  p,
792
- h
793
- ), a.appendChild(d);
791
+ h,
792
+ d
793
+ ), a.appendChild(p);
794
794
  }
795
795
  } else {
796
- const p = document.createElement("div");
797
- p.className = "setting-group-empty", p.textContent = "No settings in this group", a.appendChild(p);
796
+ const h = document.createElement("div");
797
+ h.className = "setting-group-empty", h.textContent = "No settings in this group", a.appendChild(h);
798
798
  }
799
799
  if (this.addItemCfg) {
800
- const p = document.createElement("button");
801
- p.type = "button", p.className = "sg-add-button-bottom", p.style.marginTop = "8px";
802
- const h = `
800
+ const h = document.createElement("button");
801
+ h.type = "button", h.className = "sg-add-button-bottom", h.style.marginTop = "8px";
802
+ const d = `
803
803
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
804
804
  xmlns="http://www.w3.org/2000/svg">
805
805
  <path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
806
806
  stroke-width="1.5" stroke-linecap="round"/>
807
807
  </svg>`;
808
- p.innerHTML = `${h}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, p.addEventListener("click", (d) => {
809
- d.stopPropagation(), d.preventDefault();
810
- const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), g = this.addItemCfg.createItem(u);
811
- if (lt(g)) {
812
- const m = `${this.addItemCfg.keyPrefix}${u}`;
813
- this.addSetting(m, g);
808
+ h.innerHTML = `${d}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, h.addEventListener("click", (p) => {
809
+ p.stopPropagation(), p.preventDefault();
810
+ const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), v = this.addItemCfg.createItem(g);
811
+ if (lt(v)) {
812
+ const m = `${this.addItemCfg.keyPrefix}${g}`;
813
+ this.addSetting(m, v);
814
814
  }
815
- }), a.appendChild(p);
815
+ }), a.appendChild(h);
816
816
  }
817
817
  return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t, at.trackElement(t), setTimeout(() => {
818
818
  this.updateNestingStyles();
@@ -909,12 +909,12 @@ class Lt extends T {
909
909
  if (o.className = "tab-content", this.contentContainers = {}, Object.keys(this.settings).forEach((a, l) => {
910
910
  const r = document.createElement("button");
911
911
  r.className = "tab-button", r.type = "button", r.setAttribute("data-tab-id", a), r.textContent = a, r.addEventListener("click", () => this.switchToTab(a)), n.appendChild(r);
912
- const p = document.createElement("div");
913
- p.className = "tab-panel", this.contentContainers[a] = p;
914
- const h = this.settings[a];
915
- h && (L(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.getNestingLevel() + 1), p.appendChild(
916
- h.draw()
917
- )), o.appendChild(p), l === 0 && !this.activeTabId && (this.activeTabId = a);
912
+ const h = document.createElement("div");
913
+ h.className = "tab-panel", this.contentContainers[a] = h;
914
+ const d = this.settings[a];
915
+ d && (L(d) && typeof d.setNestingLevel == "function" && d.setNestingLevel(this.getNestingLevel() + 1), h.appendChild(
916
+ d.draw()
917
+ )), o.appendChild(h), l === 0 && !this.activeTabId && (this.activeTabId = a);
918
918
  }), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
919
919
  const a = Object.keys(this.settings)[0];
920
920
  this.activeTabId = a || "";
@@ -949,28 +949,28 @@ class Mt extends x {
949
949
  }
950
950
  }
951
951
  const St = "<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";
952
- class I extends Mt {
952
+ class V extends Mt {
953
953
  constructor(t) {
954
954
  super({
955
955
  ...t,
956
956
  icon: t.icon || St,
957
957
  title: t.title || "Color",
958
- default: t.default ? I.normalizeColorValue(t.default) : "#000000"
958
+ default: t.default ? V.normalizeColorValue(t.default) : "#000000"
959
959
  }), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
960
960
  }
961
961
  static normalizeColorValue(t) {
962
- return t.startsWith("var(--") ? t : t.startsWith("#") ? I.normalizeHexValue(t) : t.includes(",") ? I.rgbToHexStatic(t) : I.normalizeHexValue(t);
962
+ return t.startsWith("var(--") ? t : t.startsWith("#") ? V.normalizeHexValue(t) : t.includes(",") ? V.rgbToHexStatic(t) : V.normalizeHexValue(t);
963
963
  }
964
964
  static normalizeHexValue(t) {
965
965
  return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length !== 6 ? (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000") : /^[0-9A-Fa-f]{6}$/.test(t) ? `#${t.toLowerCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000");
966
966
  }
967
967
  static rgbToHexStatic(t) {
968
- const e = t.split(",").map((p) => parseInt(p.trim()));
968
+ const e = t.split(",").map((h) => parseInt(h.trim()));
969
969
  if (e.length !== 3 || e.some(isNaN))
970
970
  return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
971
- const [i, s, n] = e, o = Math.max(0, Math.min(255, i)), a = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)), r = (p) => {
972
- const h = p.toString(16);
973
- return h.length === 1 ? "0" + h : h;
971
+ const [i, s, n] = e, o = Math.max(0, Math.min(255, i)), a = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)), r = (h) => {
972
+ const d = h.toString(16);
973
+ return d.length === 1 ? "0" + d : d;
974
974
  };
975
975
  return `#${r(o)}${r(a)}${r(l)}`;
976
976
  }
@@ -980,7 +980,7 @@ class I extends Mt {
980
980
  return;
981
981
  }
982
982
  if (typeof t == "string") {
983
- const e = I.normalizeColorValue(t);
983
+ const e = V.normalizeColorValue(t);
984
984
  this.value = e, this.colorInputEl && (this.colorInputEl.value = e), this.textInputEl && (this.textInputEl.value = e), this.onChange && this.onChange(e), this.props.detectChange && this.props.detectChange(e);
985
985
  } else
986
986
  this.value = "#000000", this.colorInputEl && (this.colorInputEl.value = "#000000"), this.textInputEl && (this.textInputEl.value = "#000000"), this.onChange && this.onChange("#000000"), this.props.detectChange && this.props.detectChange("#000000");
@@ -993,16 +993,16 @@ class I extends Mt {
993
993
  draw() {
994
994
  const t = document.createElement("div");
995
995
  if (t.className = "color-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
996
- const g = document.createElement("div");
997
- if (g.className = "icon-container", this.props.icon) {
998
- const m = document.createElement("span");
999
- m.className = "input-icon", m.innerHTML = this.props.icon, g.appendChild(m);
996
+ const m = document.createElement("div");
997
+ if (m.className = "icon-container", this.props.icon) {
998
+ const u = document.createElement("span");
999
+ u.className = "input-icon", u.innerHTML = this.props.icon, m.appendChild(u);
1000
1000
  }
1001
1001
  if (this.props.title) {
1002
- const m = document.createElement("span");
1003
- m.className = "input-label", m.textContent = this.props.title, g.appendChild(m);
1002
+ const u = document.createElement("span");
1003
+ u.className = "input-label", u.textContent = this.props.title, m.appendChild(u);
1004
1004
  }
1005
- t.appendChild(g);
1005
+ t.appendChild(m);
1006
1006
  }
1007
1007
  const e = document.createElement("div");
1008
1008
  e.className = "color-input-wrapper";
@@ -1020,76 +1020,89 @@ class I extends Mt {
1020
1020
  try {
1021
1021
  if (console.log("ColorSetting: renderGlobalOptions called"), a.innerHTML = "", !x) {
1022
1022
  console.error("ColorSetting: Setting class is undefined");
1023
- const m = document.createElement("div");
1024
- m.textContent = "Error: System error (Setting undefined)", a.appendChild(m);
1023
+ const u = document.createElement("div");
1024
+ u.textContent = "Error: System error (Setting undefined)", a.appendChild(u);
1025
1025
  return;
1026
1026
  }
1027
- const g = x.GlobalVariables || {};
1028
- if (console.log("ColorSetting: GlobalVariables:", g), !g || Object.keys(g).length === 0) {
1029
- const m = document.createElement("div");
1030
- m.textContent = "No global colors defined", m.style.gridColumn = "1 / -1", m.style.fontSize = "12px", m.style.color = "#666", a.appendChild(m);
1027
+ const m = x.GlobalVariables || {};
1028
+ if (console.log("ColorSetting: GlobalVariables:", m), !m || Object.keys(m).length === 0) {
1029
+ const u = document.createElement("div");
1030
+ u.textContent = "No global colors defined", u.style.gridColumn = "1 / -1", u.style.fontSize = "12px", u.style.color = "#666", a.appendChild(u);
1031
1031
  return;
1032
1032
  }
1033
- Object.entries(g).forEach(([m, f]) => {
1034
- const v = document.createElement("button");
1035
- v.className = "global-color-btn", v.title = m, v.style.width = "30px", v.style.height = "30px", v.style.borderRadius = "50%", v.style.border = "1px solid #ddd", v.style.backgroundColor = f, v.style.cursor = "pointer", this.value === `var(--${m})` && (v.style.border = "2px solid #2196f3"), v.addEventListener("click", (C) => {
1036
- var w, k;
1037
- C.preventDefault();
1038
- const y = `var(--${m})`;
1039
- this.value = y, (w = this.onChange) == null || w.call(this, y), (k = this.detectChange) == null || k.call(this, y), Array.from(a.children).forEach((S) => {
1040
- S.style.border = "1px solid #ddd";
1041
- }), v.style.border = "2px solid #2196f3", h.style.backgroundColor = f;
1042
- }), a.appendChild(v);
1033
+ Object.entries(m).forEach(([u, f]) => {
1034
+ const C = document.createElement("button");
1035
+ C.className = "global-color-btn", C.title = u, C.style.width = "30px", C.style.height = "30px", C.style.borderRadius = "50%", C.style.border = "1px solid #ddd", C.style.backgroundColor = f, C.style.cursor = "pointer", this.value === `var(--${u})` && (C.style.border = "2px solid #2196f3"), C.addEventListener("click", (y) => {
1036
+ var k, S;
1037
+ y.preventDefault();
1038
+ const w = `var(--${u})`;
1039
+ this.value = w, (k = this.onChange) == null || k.call(this, w), (S = this.detectChange) == null || S.call(this, w), Array.from(a.children).forEach((b) => {
1040
+ b.style.border = "1px solid #ddd";
1041
+ }), C.style.border = "2px solid #2196f3", d.style.backgroundColor = f;
1042
+ }), a.appendChild(C);
1043
1043
  });
1044
- } catch (g) {
1045
- console.error("ColorSetting: Error in renderGlobalOptions", g), a.innerHTML = "Error loading global options";
1044
+ } catch (m) {
1045
+ console.error("ColorSetting: Error in renderGlobalOptions", m), a.innerHTML = "Error loading global options";
1046
1046
  }
1047
1047
  };
1048
- l(), s.addEventListener("click", (g) => {
1049
- g.preventDefault(), s.classList.add("active"), n.classList.remove("active"), o.style.display = "flex", a.style.display = "none", this.value && this.value.startsWith("var(--");
1050
- }), n.addEventListener("click", (g) => {
1051
- g.preventDefault(), n.classList.add("active"), s.classList.remove("active"), o.style.display = "none", a.style.display = "grid", l();
1048
+ l(), s.addEventListener("click", (m) => {
1049
+ m.preventDefault(), s.classList.add("active"), n.classList.remove("active"), o.style.display = "flex", a.style.display = "none", this.value && this.value.startsWith("var(--");
1050
+ }), n.addEventListener("click", (m) => {
1051
+ m.preventDefault(), n.classList.add("active"), s.classList.remove("active"), o.style.display = "none", a.style.display = "grid", l();
1052
1052
  }), this.value && this.value.startsWith("var(--") ? n.click() : s.click();
1053
- const r = (g) => {
1054
- const m = g.value.trim();
1055
- if (!m)
1053
+ const r = (m) => {
1054
+ const u = m.value.trim();
1055
+ if (!u)
1056
1056
  return e.classList.remove("error"), !0;
1057
- const v = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(m);
1058
- return v ? e.classList.remove("error") : e.classList.add("error"), v;
1059
- }, p = document.createElement("input");
1060
- p.type = "color", p.className = "color-picker", p.value = this.value && !this.value.startsWith("var(--") ? this.value : "#000000", p.setAttribute("aria-label", "Choose color"), p.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && p.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = p;
1061
- const h = document.createElement("div");
1062
- h.className = "color-preview";
1063
- let d = this.value || "#000000";
1064
- if (d.startsWith("var(--")) {
1065
- const g = d.replace("var(--", "").replace(")", "");
1066
- d = (x.GlobalVariables || {})[g] || "#000000";
1057
+ const C = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(u);
1058
+ return C ? e.classList.remove("error") : e.classList.add("error"), C;
1059
+ }, h = document.createElement("input");
1060
+ h.type = "color", h.className = "color-picker", h.value = this.value && !this.value.startsWith("var(--") ? this.value : "#000000", h.setAttribute("aria-label", "Choose color"), h.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && h.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = h;
1061
+ const d = document.createElement("div");
1062
+ d.className = "color-preview";
1063
+ let p = this.value || "#000000";
1064
+ if (p.startsWith("var(--")) {
1065
+ const m = p.replace("var(--", "").replace(")", "");
1066
+ p = (x.GlobalVariables || {})[m] || "#000000";
1067
1067
  }
1068
- h.style.backgroundColor = d;
1069
- const u = document.createElement("input");
1070
- return u.type = "text", u.className = "color-text-input", u.value = this.value || "", u.placeholder = "#000000", u.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), u.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), u.setAttribute("aria-label", "Hex color value"), u.setAttribute("maxlength", "7"), this.getDataPropsPath() && u.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = u, this.textInputEl.addEventListener("input", (g) => {
1071
- var f, v;
1072
- let m = g.target.value.trim();
1073
- if (this.textInputEl && r(this.textInputEl)) {
1074
- const C = I.normalizeColorValue(m);
1075
- this.value = C, (f = this.onChange) == null || f.call(this, C), (v = this.detectChange) == null || v.call(this, C), this.colorInputEl && (this.colorInputEl.value = C), h.style.backgroundColor = C;
1068
+ d.style.backgroundColor = p;
1069
+ const g = document.createElement("input");
1070
+ g.type = "text", g.className = "color-text-input", g.value = this.value || "", g.placeholder = "#000000", g.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), g.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), g.setAttribute("aria-label", "Hex color value"), g.setAttribute("maxlength", "7"), this.getDataPropsPath() && g.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = g;
1071
+ const v = (m) => {
1072
+ var f, C;
1073
+ let u = m.trim();
1074
+ if (u && !u.startsWith("#") && !u.startsWith("var(") && /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(u) && (u = "#" + u, this.textInputEl && (this.textInputEl.value = u)), this.textInputEl && r(this.textInputEl)) {
1075
+ const y = V.normalizeColorValue(u);
1076
+ this.value = y, (f = this.onChange) == null || f.call(this, y), (C = this.detectChange) == null || C.call(this, y), this.colorInputEl && (this.colorInputEl.value = y), d.style.backgroundColor = y;
1076
1077
  }
1077
- }), this.colorInputEl.addEventListener("input", (g) => {
1078
- var v, C;
1079
- const m = g.target.value, f = I.normalizeColorValue(m);
1080
- this.value = f, (v = this.onChange) == null || v.call(this, f), (C = this.detectChange) == null || C.call(this, f), this.textInputEl && (this.textInputEl.value = f), h.style.backgroundColor = f, e.classList.remove("error");
1081
- }), this.colorInputEl.addEventListener("change", (g) => {
1082
- var v, C;
1083
- const m = g.target.value, f = I.normalizeColorValue(m);
1084
- this.value = f, (v = this.onChange) == null || v.call(this, f), (C = this.detectChange) == null || C.call(this, f), this.textInputEl && (this.textInputEl.value = f), h.style.backgroundColor = f;
1085
- }), o.appendChild(p), o.appendChild(h), o.appendChild(u), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.element = t, t;
1078
+ };
1079
+ return this.textInputEl.addEventListener("input", (m) => {
1080
+ const u = m.target.value;
1081
+ v(u);
1082
+ }), this.textInputEl.addEventListener("paste", (m) => {
1083
+ var f;
1084
+ m.preventDefault();
1085
+ const u = ((f = m.clipboardData) == null ? void 0 : f.getData("text")) || "";
1086
+ this.textInputEl && (this.textInputEl.value = u.trim(), v(u));
1087
+ }), this.textInputEl.addEventListener("keydown", (m) => {
1088
+ var u, f, C;
1089
+ m.key === "Enter" && (m.preventDefault(), v(((u = this.textInputEl) == null ? void 0 : u.value) || ""), (f = this.textInputEl) == null || f.blur()), m.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (C = this.textInputEl) == null || C.blur(), e.classList.remove("error"));
1090
+ }), this.colorInputEl.addEventListener("input", (m) => {
1091
+ var C, y;
1092
+ const u = m.target.value, f = V.normalizeColorValue(u);
1093
+ this.value = f, (C = this.onChange) == null || C.call(this, f), (y = this.detectChange) == null || y.call(this, f), this.textInputEl && (this.textInputEl.value = f), d.style.backgroundColor = f, e.classList.remove("error");
1094
+ }), this.colorInputEl.addEventListener("change", (m) => {
1095
+ var C, y;
1096
+ const u = m.target.value, f = V.normalizeColorValue(u);
1097
+ this.value = f, (C = this.onChange) == null || C.call(this, f), (y = this.detectChange) == null || y.call(this, f), this.textInputEl && (this.textInputEl.value = f), d.style.backgroundColor = f;
1098
+ }), o.appendChild(h), o.appendChild(d), o.appendChild(g), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.element = t, t;
1086
1099
  }
1087
1100
  getElement() {
1088
1101
  return this.element;
1089
1102
  }
1090
1103
  // Helper method to get normalized hex value
1091
1104
  getNormalizedValue() {
1092
- return this.value ? I.normalizeColorValue(this.value) : "#000000";
1105
+ return this.value ? V.normalizeColorValue(this.value) : "#000000";
1093
1106
  }
1094
1107
  // Helper method to check if current value is valid hex
1095
1108
  isValidHex() {
@@ -1100,7 +1113,7 @@ class I extends Mt {
1100
1113
  return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
1101
1114
  }
1102
1115
  }
1103
- const Nt = `
1116
+ const It = `
1104
1117
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1105
1118
  <path d="M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
1106
1119
  <path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
@@ -1110,7 +1123,7 @@ class F extends x {
1110
1123
  constructor(t = {}) {
1111
1124
  super({
1112
1125
  ...t,
1113
- icon: t.icon || Nt,
1126
+ icon: t.icon || It,
1114
1127
  title: t.title || "Color & Opacity",
1115
1128
  default: t.default || "#000000FF"
1116
1129
  }), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange, this.value && (this.value = F.normalizeHexWithOpacity(this.value));
@@ -1162,16 +1175,16 @@ class F extends x {
1162
1175
  draw() {
1163
1176
  const t = document.createElement("div");
1164
1177
  if (t.className = "color-with-opacity-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
1165
- const o = document.createElement("div");
1166
- if (o.className = "icon-container", this.props.icon) {
1167
- const a = document.createElement("span");
1168
- a.className = "input-icon", a.innerHTML = this.props.icon, o.appendChild(a);
1178
+ const a = document.createElement("div");
1179
+ if (a.className = "icon-container", this.props.icon) {
1180
+ const l = document.createElement("span");
1181
+ l.className = "input-icon", l.innerHTML = this.props.icon, a.appendChild(l);
1169
1182
  }
1170
1183
  if (this.props.title) {
1171
- const a = document.createElement("span");
1172
- a.className = "input-label", a.textContent = this.props.title, o.appendChild(a);
1184
+ const l = document.createElement("span");
1185
+ l.className = "input-label", l.textContent = this.props.title, a.appendChild(l);
1173
1186
  }
1174
- t.appendChild(o);
1187
+ t.appendChild(a);
1175
1188
  }
1176
1189
  const e = document.createElement("div");
1177
1190
  e.className = "color-with-opacity-input-wrapper", this.colorInputEl = document.createElement("input"), this.colorInputEl.type = "color", this.colorInputEl.className = "color-with-opacity-picker", this.getDataPropsPath() && this.colorInputEl.setAttribute(
@@ -1180,35 +1193,50 @@ class F extends x {
1180
1193
  ), this.colorPreviewEl = document.createElement("div"), this.colorPreviewEl.className = "color-with-opacity-preview", this.textInputEl = document.createElement("input"), this.textInputEl.type = "text", this.textInputEl.className = "color-with-opacity-text-input", this.textInputEl.placeholder = "#000000FF", this.getDataPropsPath() && this.textInputEl.setAttribute(
1181
1194
  "data-test-id",
1182
1195
  `${this.getDataPropsPath()}_text`
1183
- ), this.updateInputElements(), this.updateColorPreview(), this.colorInputEl.addEventListener("input", (o) => {
1184
- const a = o.target;
1185
- this.handleColorChange(a.value), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
1186
- }), this.textInputEl.addEventListener("input", (o) => {
1187
- const a = o.target;
1188
- this.handleTextInput(a.value) ? (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.updateColorPreview(), e.classList.remove("error")) : a.value.trim() === "" ? e.classList.remove("error") : e.classList.add("error");
1189
- }), this.textInputEl.addEventListener("blur", (o) => {
1190
- const a = o.target;
1191
- a.value.trim() === "" && (a.value = this.value || "#000000FF", e.classList.remove("error"));
1196
+ ), this.updateInputElements(), this.updateColorPreview();
1197
+ const i = (a) => {
1198
+ let l = a.trim();
1199
+ l && !l.startsWith("#") && /^[0-9A-Fa-f]{6}$|^[0-9A-Fa-f]{8}$/.test(l) && (l = "#" + l, this.textInputEl && (this.textInputEl.value = l));
1200
+ const r = this.handleTextInput(l);
1201
+ return r ? (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.updateColorPreview(), e.classList.remove("error")) : l === "" ? e.classList.remove("error") : e.classList.add("error"), r;
1202
+ };
1203
+ this.colorInputEl.addEventListener("input", (a) => {
1204
+ const l = a.target;
1205
+ this.handleColorChange(l.value), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
1206
+ }), this.textInputEl.addEventListener("input", (a) => {
1207
+ const l = a.target;
1208
+ i(l.value);
1209
+ }), this.textInputEl.addEventListener("paste", (a) => {
1210
+ var r;
1211
+ a.preventDefault();
1212
+ const l = ((r = a.clipboardData) == null ? void 0 : r.getData("text")) || "";
1213
+ this.textInputEl && (this.textInputEl.value = l.trim(), i(l));
1214
+ }), this.textInputEl.addEventListener("keydown", (a) => {
1215
+ var l, r, h;
1216
+ a.key === "Enter" && (a.preventDefault(), i(((l = this.textInputEl) == null ? void 0 : l.value) || ""), (r = this.textInputEl) == null || r.blur()), a.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (h = this.textInputEl) == null || h.blur(), e.classList.remove("error"));
1217
+ }), this.textInputEl.addEventListener("blur", (a) => {
1218
+ const l = a.target;
1219
+ l.value.trim() === "" && (l.value = this.value || "#000000FF", e.classList.remove("error"));
1192
1220
  }), this.colorPreviewEl.addEventListener("click", () => {
1193
- var o;
1194
- (o = this.colorInputEl) == null || o.click();
1221
+ var a;
1222
+ (a = this.colorInputEl) == null || a.click();
1195
1223
  }), e.appendChild(this.colorInputEl), e.appendChild(this.colorPreviewEl), e.appendChild(this.textInputEl);
1196
- const i = document.createElement("div");
1197
- i.className = "color-with-opacity-opacity-wrapper", this.opacityInputEl = document.createElement("input"), this.opacityInputEl.type = "number", this.opacityInputEl.className = "color-with-opacity-opacity-input", this.opacityInputEl.value = this.getOpacityPercent().toString(), this.opacityInputEl.min = "0", this.opacityInputEl.max = "100", this.opacityInputEl.step = "1", this.opacityInputEl.placeholder = "100", this.getDataPropsPath() && this.opacityInputEl.setAttribute(
1224
+ const s = document.createElement("div");
1225
+ s.className = "color-with-opacity-opacity-wrapper", this.opacityInputEl = document.createElement("input"), this.opacityInputEl.type = "number", this.opacityInputEl.className = "color-with-opacity-opacity-input", this.opacityInputEl.value = this.getOpacityPercent().toString(), this.opacityInputEl.min = "0", this.opacityInputEl.max = "100", this.opacityInputEl.step = "1", this.opacityInputEl.placeholder = "100", this.getDataPropsPath() && this.opacityInputEl.setAttribute(
1198
1226
  "data-test-id",
1199
1227
  `${this.getDataPropsPath()}_opacity`
1200
1228
  );
1201
- const s = document.createElement("span");
1202
- s.className = "color-with-opacity-opacity-suffix", s.textContent = "%", this.opacityInputEl.addEventListener("input", (o) => {
1203
- const a = o.target, l = parseFloat(a.value);
1204
- isNaN(l) || (this.handleOpacityChange(l), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview());
1205
- }), this.opacityInputEl.addEventListener("blur", (o) => {
1206
- const a = o.target;
1207
- let l = parseFloat(a.value);
1208
- isNaN(l) && (l = this.getOpacityPercent()), l = Math.max(0, Math.min(100, l)), a.value = l.toString(), this.handleOpacityChange(l), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
1209
- }), i.appendChild(this.opacityInputEl), i.appendChild(s);
1210
- const n = document.createElement("div");
1211
- return n.className = "color-with-opacity-controls-wrapper", n.appendChild(e), n.appendChild(i), t.appendChild(n), this.element = t, this.updateInputElements(), this.updateColorPreview(), t;
1229
+ const n = document.createElement("span");
1230
+ n.className = "color-with-opacity-opacity-suffix", n.textContent = "%", this.opacityInputEl.addEventListener("input", (a) => {
1231
+ const l = a.target, r = parseFloat(l.value);
1232
+ isNaN(r) || (this.handleOpacityChange(r), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview());
1233
+ }), this.opacityInputEl.addEventListener("blur", (a) => {
1234
+ const l = a.target;
1235
+ let r = parseFloat(l.value);
1236
+ isNaN(r) && (r = this.getOpacityPercent()), r = Math.max(0, Math.min(100, r)), l.value = r.toString(), this.handleOpacityChange(r), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
1237
+ }), s.appendChild(this.opacityInputEl), s.appendChild(n);
1238
+ const o = document.createElement("div");
1239
+ return o.className = "color-with-opacity-controls-wrapper", o.appendChild(e), o.appendChild(s), t.appendChild(o), this.element = t, this.updateInputElements(), this.updateColorPreview(), t;
1212
1240
  }
1213
1241
  getElement() {
1214
1242
  return this.element;
@@ -1319,12 +1347,12 @@ class P extends x {
1319
1347
  );
1320
1348
  }
1321
1349
  }
1322
- const Vt = `
1350
+ const Nt = `
1323
1351
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1324
1352
  <path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
1325
1353
  <path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
1326
1354
  </svg>`;
1327
- class It extends P {
1355
+ class Vt extends P {
1328
1356
  constructor(t = {}) {
1329
1357
  const e = {
1330
1358
  title: "Opacity",
@@ -1333,7 +1361,7 @@ class It extends P {
1333
1361
  maxValue: 100,
1334
1362
  step: 1,
1335
1363
  default: t.default ?? 100,
1336
- icon: Vt,
1364
+ icon: Nt,
1337
1365
  ...t
1338
1366
  };
1339
1367
  super(e), this.inputType = "number", this.mobileValue = t.mobile;
@@ -1527,8 +1555,8 @@ class me extends x {
1527
1555
  /^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i
1528
1556
  );
1529
1557
  if (n) {
1530
- let a = +n[1], l = +n[2], r = +n[3], p = +n[4];
1531
- p >= 1 ? (a = Math.round(a * 0.9), l = Math.round(l * 0.9), r = Math.round(r * 0.9)) : p = Math.min(1, p + 0.12), s = `rgba(${a},${l},${r},${p})`;
1558
+ let a = +n[1], l = +n[2], r = +n[3], h = +n[4];
1559
+ h >= 1 ? (a = Math.round(a * 0.9), l = Math.round(l * 0.9), r = Math.round(r * 0.9)) : h = Math.min(1, h + 0.12), s = `rgba(${a},${l},${r},${h})`;
1532
1560
  }
1533
1561
  t.addEventListener("mouseenter", () => {
1534
1562
  console.log("hoverBg", s), t.style.setProperty("background-color", s, "important");
@@ -1562,7 +1590,7 @@ class fe extends x {
1562
1590
  suffix: "px",
1563
1591
  minValue: this.minHeight,
1564
1592
  maxValue: this.maxHeight,
1565
- icon: Ht
1593
+ icon: $t
1566
1594
  }), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
1567
1595
  }
1568
1596
  handleWidthChange(t) {
@@ -1658,13 +1686,13 @@ class fe extends x {
1658
1686
  }
1659
1687
  const Ot = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1660
1688
  <path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
1661
- </svg>`, Ht = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1689
+ </svg>`, $t = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1662
1690
  <path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
1663
1691
  </svg>`, Q = `
1664
1692
  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
1665
1693
  <path d="M5 10.5L7.5 8M7.5 8L10 10.5M7.5 8V13.625M12.5 10.9643C13.2634 10.3338 13.75 9.37996 13.75 8.3125C13.75 6.41402 12.211 4.875 10.3125 4.875C10.1759 4.875 10.0482 4.80375 9.97882 4.68609C9.16379 3.30302 7.65902 2.375 5.9375 2.375C3.34867 2.375 1.25 4.47367 1.25 7.0625C1.25 8.35381 1.77215 9.52317 2.61684 10.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
1666
1694
  </svg>
1667
- `, $t = `
1695
+ `, Ht = `
1668
1696
  <svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
1669
1697
  <rect width="91" height="71" rx="4" fill="#F2F4F7"/>
1670
1698
  <path d="M37 31.5L39.5 29M39.5 29L42 31.5M39.5 29V34.625M44.5 31.9643C45.2634 31.3338 45.75 30.38 45.75 29.3125C45.75 27.414 44.211 25.875 42.3125 25.875C42.1759 25.875 42.0482 25.8037 41.9788 25.6861C41.1638 24.303 39.659 23.375 37.9375 23.375C35.3487 23.375 33.25 25.4737 33.25 28.0625C33.25 29.3538 33.7721 30.5232 34.6168 31.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
@@ -1790,7 +1818,7 @@ class nt extends x {
1790
1818
  const s = this.value && this.value !== "";
1791
1819
  s || i.classList.add("no-image");
1792
1820
  const n = document.createElement("div");
1793
- if (n.className = "preview-placeholder", n.innerHTML = $t, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = At, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
1821
+ if (n.className = "preview-placeholder", n.innerHTML = Ht, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = At, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
1794
1822
  const a = document.createElement("button");
1795
1823
  a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = Bt, this.previewWrapper.appendChild(a), a.onclick = (l) => {
1796
1824
  var r;
@@ -1854,7 +1882,7 @@ class Ft extends P {
1854
1882
  }
1855
1883
  const Rt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1856
1884
  <path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
1857
- </svg>`, Ut = `
1885
+ </svg>`, Wt = `
1858
1886
  <svg xmlns="http://www.w3.org/2000/svg" class="svg-select-api" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
1859
1887
  <polyline points="6 9 12 15 18 9"></polyline>
1860
1888
  </svg>
@@ -1914,7 +1942,7 @@ class ve extends x {
1914
1942
  a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
1915
1943
  }), t.appendChild(i);
1916
1944
  const s = document.createElement("div");
1917
- return s.classList.add("svg-container"), s.innerHTML = Ut, t.appendChild(s), s.onclick = () => {
1945
+ return s.classList.add("svg-container"), s.innerHTML = Wt, t.appendChild(s), s.onclick = () => {
1918
1946
  var n, o;
1919
1947
  this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
1920
1948
  }, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
@@ -2031,19 +2059,19 @@ class Ce extends x {
2031
2059
  i.className = "toggle-switch";
2032
2060
  const s = document.createElement("input");
2033
2061
  s.type = "checkbox", s.checked = ((a = (o = this.props.options) == null ? void 0 : o.find((l) => l.value === this.value)) == null ? void 0 : a.status) ?? !1, this.getDataPropsPath() && s.setAttribute("data-test-id", this.getDataPropsPath()), s.addEventListener("change", () => {
2034
- var r, p;
2035
- const l = ((p = (r = this.props.options) == null ? void 0 : r.find((h) => h.status === s.checked)) == null ? void 0 : p.value) ?? "";
2062
+ var r, h;
2063
+ const l = ((h = (r = this.props.options) == null ? void 0 : r.find((d) => d.status === s.checked)) == null ? void 0 : h.value) ?? "";
2036
2064
  this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
2037
2065
  });
2038
2066
  const n = document.createElement("span");
2039
2067
  if (n.className = "toggle-slider", this.props.activeColor || this.props.inactiveColor) {
2040
- const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50", p = this.props.inactiveColor || "#ccc";
2068
+ const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50", h = this.props.inactiveColor || "#ccc";
2041
2069
  l.textContent = `
2042
2070
  .toggle-switch input:checked + .toggle-slider {
2043
2071
  background-color: ${r};
2044
2072
  }
2045
2073
  .toggle-switch .toggle-slider {
2046
- background-color: ${p};
2074
+ background-color: ${h};
2047
2075
  }
2048
2076
  `, document.head.appendChild(l);
2049
2077
  }
@@ -2058,13 +2086,13 @@ class Ce extends x {
2058
2086
  this.detectChangeCallback = t;
2059
2087
  }
2060
2088
  }
2061
- const Wt = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2089
+ const Ut = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2062
2090
  <path d="M13.3334 5.99996H2.66675M13.3334 9.99996H2.66675M5.33341 12.6666V3.33329M10.6667 12.6666V3.33329" stroke="#667085" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
2063
2091
  </svg>`;
2064
2092
  class ye extends x {
2065
2093
  // Store mobile value
2066
2094
  constructor(t = {}) {
2067
- t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Wt, t.suffix = t.suffix ?? "px", t.minValue = t.minValue ?? 0, super(t), this.inputType = "number", this.inputValues = {}, this.mobileValue = t.mobile, this.value = this.validateValue(t.default ?? 0), t.rowGap && (this.inputValues.row = this.value), t.columnGap && (this.inputValues.column = this.value);
2095
+ t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Ut, t.suffix = t.suffix ?? "px", t.minValue = t.minValue ?? 0, super(t), this.inputType = "number", this.inputValues = {}, this.mobileValue = t.mobile, this.value = this.validateValue(t.default ?? 0), t.rowGap && (this.inputValues.row = this.value), t.columnGap && (this.inputValues.column = this.value);
2068
2096
  }
2069
2097
  draw() {
2070
2098
  const t = document.createElement("div");
@@ -2180,14 +2208,14 @@ class we extends x {
2180
2208
  t.placeholder = e;
2181
2209
  return;
2182
2210
  }
2183
- const p = "...";
2184
- let h = 0, d = e.length, u = 0;
2185
- for (; h <= d; ) {
2186
- const m = Math.floor((h + d) / 2), f = e.slice(0, m).trimEnd() + p;
2187
- this.measureTextWidth(f, i) <= l ? (u = m, h = m + 1) : d = m - 1;
2211
+ const h = "...";
2212
+ let d = 0, p = e.length, g = 0;
2213
+ for (; d <= p; ) {
2214
+ const m = Math.floor((d + p) / 2), u = e.slice(0, m).trimEnd() + h;
2215
+ this.measureTextWidth(u, i) <= l ? (g = m, d = m + 1) : p = m - 1;
2188
2216
  }
2189
- const g = e.slice(0, u).trimEnd() + p;
2190
- t.placeholder = g;
2217
+ const v = e.slice(0, g).trimEnd() + h;
2218
+ t.placeholder = v;
2191
2219
  }
2192
2220
  autosizeTextarea(t, e = 3) {
2193
2221
  t.style.height = "auto";
@@ -2222,8 +2250,8 @@ class we extends x {
2222
2250
  ), n.addEventListener("input", (l) => {
2223
2251
  const r = l.target;
2224
2252
  this.updateLanguageValue(t, r.value), t === this.defaultLanguage && this.updateOtherLanguagePlaceholders(r.value), this.autosizeTextarea(r, 3);
2225
- const p = n.getAttribute("data-full-placeholder") || "";
2226
- p && this.adaptPlaceholderToSingleLine(n, p);
2253
+ const h = n.getAttribute("data-full-placeholder") || "";
2254
+ h && this.adaptPlaceholderToSingleLine(n, h);
2227
2255
  }), i.appendChild(n), ((l) => (typeof queueMicrotask == "function" ? queueMicrotask : (r) => setTimeout(r, 0))(l))(() => {
2228
2256
  this.autosizeTextarea(n, 3);
2229
2257
  const l = n.getAttribute("data-full-placeholder") || "";
@@ -2324,25 +2352,25 @@ class xe extends x {
2324
2352
  }
2325
2353
  const ut = (c, t, e) => {
2326
2354
  let i = !1, s = 0, n = 0, o = 0, a = 0;
2327
- const l = (h) => {
2328
- if (h.target.closest("button")) return;
2329
- i = !0, s = h.clientX, n = h.clientY;
2330
- const d = t.getBoundingClientRect();
2331
- o = d.left, a = d.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", p), document.body.style.userSelect = "none";
2332
- }, r = (h) => {
2355
+ const l = (d) => {
2356
+ if (d.target.closest("button")) return;
2357
+ i = !0, s = d.clientX, n = d.clientY;
2358
+ const p = t.getBoundingClientRect();
2359
+ o = p.left, a = p.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", h), document.body.style.userSelect = "none";
2360
+ }, r = (d) => {
2333
2361
  if (!i) return;
2334
- const d = h.clientX - s, u = h.clientY - n, g = window.innerWidth, m = window.innerHeight, f = t.offsetWidth, v = t.offsetHeight;
2335
- let C = o + d, y = a + u;
2336
- C = Math.max(8, Math.min(g - f - 8, C)), y = Math.max(8, Math.min(m - v - 8, y)), t.style.left = `${C}px`, t.style.top = `${y}px`, e == null || e(C, y);
2337
- }, p = () => {
2338
- i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", p), document.body.style.userSelect = "";
2362
+ const p = d.clientX - s, g = d.clientY - n, v = window.innerWidth, m = window.innerHeight, u = t.offsetWidth, f = t.offsetHeight;
2363
+ let C = o + p, y = a + g;
2364
+ C = Math.max(8, Math.min(v - u - 8, C)), y = Math.max(8, Math.min(m - f - 8, y)), t.style.left = `${C}px`, t.style.top = `${y}px`, e == null || e(C, y);
2365
+ }, h = () => {
2366
+ i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", h), document.body.style.userSelect = "";
2339
2367
  };
2340
2368
  c.addEventListener("mousedown", l);
2341
- }, W = (c) => {
2369
+ }, U = (c) => {
2342
2370
  if (!c) return null;
2343
2371
  let t = c.trim();
2344
2372
  return !t.startsWith("#") || (t = t.slice(1), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), !/^[0-9a-fA-F]{6}$/.test(t)) ? null : `#${t.toUpperCase()}`;
2345
- }, J = (c, t, e) => `#${[c, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, V = (c) => {
2373
+ }, J = (c, t, e) => `#${[c, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, N = (c) => {
2346
2374
  const t = c.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
2347
2375
  return {
2348
2376
  r: parseInt(e.slice(0, 2), 16),
@@ -2350,12 +2378,12 @@ const ut = (c, t, e) => {
2350
2378
  b: parseInt(e.slice(4, 6), 16)
2351
2379
  };
2352
2380
  }, R = (c) => {
2353
- const { r: t, g: e, b: i } = V(c), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
2354
- let p = 0;
2355
- r !== 0 && (a === s ? p = (n - o) / r % 6 : a === n ? p = (o - s) / r + 2 : p = (s - n) / r + 4), p < 0 && (p += 6);
2356
- const h = a === 0 ? 0 : r / a, d = a;
2357
- return { h: p * 60, s: h, v: d };
2358
- }, U = (c, t, e) => {
2381
+ const { r: t, g: e, b: i } = N(c), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
2382
+ let h = 0;
2383
+ r !== 0 && (a === s ? h = (n - o) / r % 6 : a === n ? h = (o - s) / r + 2 : h = (s - n) / r + 4), h < 0 && (h += 6);
2384
+ const d = a === 0 ? 0 : r / a, p = a;
2385
+ return { h: h * 60, s: d, v: p };
2386
+ }, W = (c, t, e) => {
2359
2387
  const i = (c % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), o = e - s;
2360
2388
  let a = 0, l = 0, r = 0;
2361
2389
  return i < 60 ? (a = s, l = n, r = 0) : i < 120 ? (a = n, l = s, r = 0) : i < 180 ? (a = 0, l = s, r = n) : i < 240 ? (a = 0, l = n, r = s) : i < 300 ? (a = n, l = 0, r = s) : (a = s, l = 0, r = n), J(
@@ -2377,7 +2405,7 @@ const ut = (c, t, e) => {
2377
2405
  }, st = (c, t) => {
2378
2406
  const e = Math.max(0, Math.min(100, t)) / 100;
2379
2407
  if (c.startsWith("#")) {
2380
- const { r: s, g: n, b: o } = V(c);
2408
+ const { r: s, g: n, b: o } = N(c);
2381
2409
  return `rgba(${s}, ${n}, ${o}, ${e})`;
2382
2410
  }
2383
2411
  if (c.startsWith("rgba("))
@@ -2406,9 +2434,9 @@ const ut = (c, t, e) => {
2406
2434
  return `rgba(${n}, ${o}, ${a}, ${e})`;
2407
2435
  }
2408
2436
  }
2409
- const i = W(c);
2437
+ const i = U(c);
2410
2438
  if (i) {
2411
- const { r: s, g: n, b: o } = V(i);
2439
+ const { r: s, g: n, b: o } = N(i);
2412
2440
  return `rgba(${s}, ${n}, ${o}, ${e})`;
2413
2441
  }
2414
2442
  return c;
@@ -2443,7 +2471,7 @@ const ut = (c, t, e) => {
2443
2471
  /^[a-zA-Z]+$/
2444
2472
  ].some((e) => e.test(c.trim())), _t = (c) => {
2445
2473
  if (typeof document > "u")
2446
- return mt(c) || !!W(c);
2474
+ return mt(c) || !!U(c);
2447
2475
  const t = document.createElement("div");
2448
2476
  return t.style.color = c, t.style.color !== "";
2449
2477
  }, ft = (c) => {
@@ -2482,7 +2510,7 @@ const ut = (c, t, e) => {
2482
2510
  opacity: Math.round(l * 100)
2483
2511
  };
2484
2512
  }
2485
- return { color: W(t) || t, position: 0, opacity: 100 };
2513
+ return { color: U(t) || t, position: 0, opacity: 100 };
2486
2514
  }, rt = (c) => {
2487
2515
  const t = [];
2488
2516
  let e = "", i = 0;
@@ -2529,7 +2557,7 @@ const ut = (c, t, e) => {
2529
2557
  const l = ft(n);
2530
2558
  l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
2531
2559
  }), t;
2532
- }, $ = (c) => {
2560
+ }, H = (c) => {
2533
2561
  const t = c.stops && c.stops.length ? c.stops : [{ color: "#000000", position: 0, opacity: 100 }];
2534
2562
  return {
2535
2563
  type: c.type && ["linear", "radial", "solid"].includes(c.type) ? c.type : "linear",
@@ -2540,11 +2568,11 @@ const ut = (c, t, e) => {
2540
2568
  opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
2541
2569
  }))
2542
2570
  };
2543
- }, N = (c) => {
2571
+ }, I = (c) => {
2544
2572
  const t = c.replace(/;$/, "").trim();
2545
2573
  if (_t(t)) {
2546
2574
  const s = ft(t);
2547
- return $({ type: "solid", angle: 0, stops: [s] });
2575
+ return H({ type: "solid", angle: 0, stops: [s] });
2548
2576
  }
2549
2577
  const e = ct(t, "linear-gradient");
2550
2578
  if (e) {
@@ -2565,12 +2593,12 @@ const ut = (c, t, e) => {
2565
2593
  "to top left": 315
2566
2594
  }[a] ?? 90, o = s.slice(1));
2567
2595
  const l = ht(o);
2568
- return l.length ? $({ type: "linear", angle: n, stops: l }) : null;
2596
+ return l.length ? H({ type: "linear", angle: n, stops: l }) : null;
2569
2597
  }
2570
2598
  const i = ct(t, "radial-gradient");
2571
2599
  if (i) {
2572
2600
  const s = rt(i), n = s[0] && !Jt(s[0]) ? s.slice(1) : s, o = ht(n);
2573
- return o.length ? $({ type: "radial", angle: 0, stops: o }) : null;
2601
+ return o.length ? H({ type: "radial", angle: 0, stops: o }) : null;
2574
2602
  }
2575
2603
  return null;
2576
2604
  }, O = (c) => {
@@ -2614,8 +2642,8 @@ const ut = (c, t, e) => {
2614
2642
  static normalizeList(t) {
2615
2643
  const e = /* @__PURE__ */ new Set(), i = [];
2616
2644
  return t.forEach((s) => {
2617
- let n = W(s);
2618
- n || N(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
2645
+ let n = U(s);
2646
+ n || I(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
2619
2647
  }), i.slice(0, this.MAX_COLORS);
2620
2648
  }
2621
2649
  static ensureLoaded() {
@@ -2660,11 +2688,11 @@ const ut = (c, t, e) => {
2660
2688
  }
2661
2689
  static addColor(t, e) {
2662
2690
  if (!t) return;
2663
- let i = W(t), s = "solid";
2691
+ let i = U(t), s = "solid";
2664
2692
  if (i)
2665
2693
  s = "solid";
2666
2694
  else {
2667
- const l = N(t);
2695
+ const l = I(t);
2668
2696
  l && (i = t, s = l.type === "solid" ? "solid" : "gradient");
2669
2697
  }
2670
2698
  if (!i) return;
@@ -2683,51 +2711,51 @@ const ot = (c, t) => {
2683
2711
  s.className = "color-picker-tooltip", s.style.display = "none", e.appendChild(s);
2684
2712
  const n = () => {
2685
2713
  s.style.display = "none";
2686
- }, o = (p, h) => {
2687
- const d = p.getBoundingClientRect();
2688
- s.textContent = h, s.style.left = `${d.left + d.width / 2}px`, s.style.top = `${d.bottom + 8}px`, s.style.display = "block";
2714
+ }, o = (h, d) => {
2715
+ const p = h.getBoundingClientRect();
2716
+ s.textContent = d, s.style.left = `${p.left + p.width / 2}px`, s.style.top = `${p.bottom + 8}px`, s.style.display = "block";
2689
2717
  }, a = document.createElement("div");
2690
2718
  a.className = "color-picker-recent-grid";
2691
2719
  const l = document.createElement("div");
2692
2720
  l.className = "color-picker-recent-placeholder", l.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(a), e.appendChild(l);
2693
2721
  const r = () => {
2694
2722
  n(), a.innerHTML = "";
2695
- const p = D.getColors(t);
2696
- if (p.length === 0) {
2723
+ const h = D.getColors(t);
2724
+ if (h.length === 0) {
2697
2725
  a.style.display = "none", l.style.display = "block";
2698
2726
  return;
2699
2727
  }
2700
- a.style.display = "grid", l.style.display = "none", p.forEach((h) => {
2701
- const d = document.createElement("button");
2702
- d.type = "button", d.className = "color-picker-recent-swatch";
2703
- const u = Xt(h);
2704
- if (d.title = u, d.setAttribute("aria-label", `Use color: ${u}`), h.includes("gradient(")) {
2705
- d.style.backgroundImage = h, d.style.backgroundColor = "transparent";
2706
- const m = N(h);
2707
- m && m.stops && m.stops.length > 0 && (d.style.borderColor = m.stops[0].color);
2728
+ a.style.display = "grid", l.style.display = "none", h.forEach((d) => {
2729
+ const p = document.createElement("button");
2730
+ p.type = "button", p.className = "color-picker-recent-swatch";
2731
+ const g = Xt(d);
2732
+ if (p.title = g, p.setAttribute("aria-label", `Use color: ${g}`), d.includes("gradient(")) {
2733
+ p.style.backgroundImage = d, p.style.backgroundColor = "transparent";
2734
+ const m = I(d);
2735
+ m && m.stops && m.stops.length > 0 && (p.style.borderColor = m.stops[0].color);
2708
2736
  } else
2709
- d.style.backgroundColor = h, d.style.borderColor = h;
2710
- d.addEventListener("mouseenter", () => o(d, u)), d.addEventListener("mouseleave", () => {
2711
- n(), d.style.boxShadow = "";
2712
- }), d.addEventListener("mousedown", () => {
2713
- d.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
2714
- }), d.addEventListener("mouseup", () => {
2737
+ p.style.backgroundColor = d, p.style.borderColor = d;
2738
+ p.addEventListener("mouseenter", () => o(p, g)), p.addEventListener("mouseleave", () => {
2739
+ n(), p.style.boxShadow = "";
2740
+ }), p.addEventListener("mousedown", () => {
2741
+ p.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
2742
+ }), p.addEventListener("mouseup", () => {
2715
2743
  setTimeout(() => {
2716
- d.style.boxShadow = "";
2744
+ p.style.boxShadow = "";
2717
2745
  }, 150);
2718
- }), d.addEventListener("click", () => {
2719
- n(), c(h);
2720
- }), a.appendChild(d);
2746
+ }), p.addEventListener("click", () => {
2747
+ n(), c(d);
2748
+ }), a.appendChild(p);
2721
2749
  });
2722
2750
  };
2723
2751
  return r(), { container: e, refresh: r };
2724
2752
  }, Xt = (c) => {
2725
- const t = N(c);
2753
+ const t = I(c);
2726
2754
  if (t)
2727
2755
  return Z(t);
2728
- const e = W(c);
2756
+ const e = U(c);
2729
2757
  if (e) {
2730
- const i = V(e);
2758
+ const i = N(e);
2731
2759
  return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
2732
2760
  }
2733
2761
  return c;
@@ -2809,79 +2837,79 @@ class dt {
2809
2837
  l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = Ct;
2810
2838
  const r = document.createElement("div");
2811
2839
  r.className = "color-picker-sliders-group";
2812
- const p = document.createElement("div");
2813
- p.className = "color-picker-hue", this.hueSlider = p;
2814
2840
  const h = document.createElement("div");
2815
- h.className = "color-picker-hue-marker", this.hueMarker = h, p.appendChild(h);
2841
+ h.className = "color-picker-hue", this.hueSlider = h;
2816
2842
  const d = document.createElement("div");
2817
- d.className = "color-picker-opacity", this.opacitySlider = d;
2818
- const u = document.createElement("div");
2819
- u.className = "color-picker-opacity-marker", this.opacityMarker = u, d.appendChild(u), r.appendChild(p), r.appendChild(d), a.appendChild(l), a.appendChild(r);
2820
- const g = ot((b) => {
2843
+ d.className = "color-picker-hue-marker", this.hueMarker = d, h.appendChild(d);
2844
+ const p = document.createElement("div");
2845
+ p.className = "color-picker-opacity", this.opacitySlider = p;
2846
+ const g = document.createElement("div");
2847
+ g.className = "color-picker-opacity-marker", this.opacityMarker = g, p.appendChild(g), r.appendChild(h), r.appendChild(p), a.appendChild(l), a.appendChild(r);
2848
+ const v = ot((b) => {
2821
2849
  var E;
2822
2850
  this.setColor(b), (E = this.onChange) == null || E.call(this, b, this.currentOpacity);
2823
2851
  }, this.recentScope);
2824
- this.recentSectionRefresh = g.refresh;
2852
+ this.recentSectionRefresh = v.refresh;
2825
2853
  const m = document.createElement("div");
2826
2854
  m.className = "color-picker-format-section";
2827
- const f = document.createElement("select");
2828
- f.className = "color-picker-format-select", this.select = f;
2829
- const v = document.createElement("option");
2830
- v.value = "hex", v.textContent = "HEX";
2855
+ const u = document.createElement("select");
2856
+ u.className = "color-picker-format-select", this.select = u;
2857
+ const f = document.createElement("option");
2858
+ f.value = "hex", f.textContent = "HEX";
2831
2859
  const C = document.createElement("option");
2832
2860
  C.value = "rgb", C.textContent = "RGB";
2833
2861
  const y = document.createElement("option");
2834
- y.value = "hsl", y.textContent = "HSL", f.appendChild(v), f.appendChild(C), f.appendChild(y);
2862
+ y.value = "hsl", y.textContent = "HSL", u.appendChild(f), u.appendChild(C), u.appendChild(y);
2835
2863
  const w = document.createElement("input");
2836
2864
  w.type = "text", w.className = "color-picker-color-input", w.value = this.currentColor, this.input = w;
2837
2865
  const k = document.createElement("div");
2838
2866
  k.className = "color-picker-input-container";
2839
2867
  const S = document.createElement("button");
2840
- return S.className = "color-picker-copy-inside", S.textContent = "Copy", k.appendChild(w), k.appendChild(S), m.appendChild(f), m.appendChild(k), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(g.container), t.appendChild(m), t.addEventListener("click", (b) => b.stopPropagation()), this.bind(n, p, d, w, f, S, l), t;
2868
+ return S.className = "color-picker-copy-inside", S.textContent = "Copy", k.appendChild(w), k.appendChild(S), m.appendChild(u), m.appendChild(k), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(v.container), t.appendChild(m), t.addEventListener("click", (b) => b.stopPropagation()), this.bind(n, h, p, w, u, S, l), t;
2841
2869
  }
2842
2870
  createBackdrop() {
2843
2871
  const t = document.createElement("div");
2844
2872
  return t.className = "color-picker-backdrop", t.style.display = "none", t.style.pointerEvents = "none", t;
2845
2873
  }
2846
2874
  bind(t, e, i, s, n, o, a) {
2847
- const l = (h) => {
2875
+ const l = (d) => {
2848
2876
  var C;
2849
- const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width)), g = Math.max(0, Math.min(1, (h.clientY - d.top) / d.height));
2850
- this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
2851
- const f = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = U(f, u, 1 - g);
2852
- this.currentColor = v, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
2853
- }, r = (h) => {
2877
+ const p = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width)), v = Math.max(0, Math.min(1, (d.clientY - p.top) / p.height));
2878
+ this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${v * 100}%`;
2879
+ const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, f = W(u, g, 1 - v);
2880
+ this.currentColor = f, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, f, this.currentOpacity);
2881
+ }, r = (d) => {
2854
2882
  var C;
2855
- const d = e.getBoundingClientRect();
2856
- let u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
2857
- this.hueMarker.style.left = `${u * 100}%`;
2858
- const g = u * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), f = this.parsePercentage(this.colorMarker.style.top || "0%"), v = U(g, m, 1 - f);
2859
- this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
2860
- }, p = (h) => {
2861
- var g;
2862
- const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
2863
- this.opacityMarker.style.left = `${u * 100}%`, this.currentOpacity = Math.round(u * 100), (g = this.onChange) == null || g.call(this, this.currentColor, this.currentOpacity);
2883
+ const p = e.getBoundingClientRect();
2884
+ let g = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width));
2885
+ this.hueMarker.style.left = `${g * 100}%`;
2886
+ const v = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), f = W(v, m, 1 - u);
2887
+ this.currentColor = f, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${v}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, f, this.currentOpacity);
2888
+ }, h = (d) => {
2889
+ var v;
2890
+ const p = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width));
2891
+ this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), (v = this.onChange) == null || v.call(this, this.currentColor, this.currentOpacity);
2864
2892
  };
2865
- t.addEventListener("mousedown", (h) => {
2866
- h.preventDefault(), l(h);
2867
- const d = (g) => l(g), u = () => {
2868
- document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
2893
+ t.addEventListener("mousedown", (d) => {
2894
+ d.preventDefault(), l(d);
2895
+ const p = (v) => l(v), g = () => {
2896
+ document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
2869
2897
  };
2870
- document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
2871
- }), e.addEventListener("mousedown", (h) => {
2872
- h.preventDefault(), r(h);
2873
- const d = (g) => r(g), u = () => {
2874
- document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
2898
+ document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
2899
+ }), e.addEventListener("mousedown", (d) => {
2900
+ d.preventDefault(), r(d);
2901
+ const p = (v) => r(v), g = () => {
2902
+ document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
2875
2903
  };
2876
- document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
2877
- }), i.addEventListener("mousedown", (h) => {
2878
- h.preventDefault(), p(h);
2879
- const d = (g) => p(g), u = () => {
2880
- document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
2904
+ document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
2905
+ }), i.addEventListener("mousedown", (d) => {
2906
+ d.preventDefault(), h(d);
2907
+ const p = (v) => h(v), g = () => {
2908
+ document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
2881
2909
  };
2882
- document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
2883
- }), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (h) => {
2884
- h.key === "Enter" && (h.preventDefault(), this.syncInput(), s.blur());
2910
+ document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
2911
+ }), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (d) => {
2912
+ d.key === "Enter" && (d.preventDefault(), this.syncInput(), s.blur());
2885
2913
  }), o.addEventListener("click", async () => {
2886
2914
  try {
2887
2915
  await navigator.clipboard.writeText(s.value);
@@ -2889,14 +2917,14 @@ class dt {
2889
2917
  s.select(), document.execCommand("copy");
2890
2918
  }
2891
2919
  }), a.addEventListener("click", async () => {
2892
- var h;
2920
+ var d;
2893
2921
  if (!("EyeDropper" in window)) {
2894
2922
  alert("EyeDropper API is not supported in this browser.");
2895
2923
  return;
2896
2924
  }
2897
2925
  try {
2898
- const d = new window.EyeDropper(), { sRGBHex: u } = await d.open();
2899
- this.setColor(u), (h = this.onChange) == null || h.call(this, u, this.currentOpacity);
2926
+ const p = new window.EyeDropper(), { sRGBHex: g } = await p.open();
2927
+ this.setColor(g), (d = this.onChange) == null || d.call(this, g, this.currentOpacity);
2900
2928
  } catch {
2901
2929
  }
2902
2930
  }), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
@@ -2914,7 +2942,7 @@ class dt {
2914
2942
  const t = this.select.value, { h: e, s: i, v: s } = R(this.currentColor);
2915
2943
  if (t === "hex") this.input.value = this.currentColor;
2916
2944
  else if (t === "rgb") {
2917
- const { r: n, g: o, b: a } = V(this.currentColor);
2945
+ const { r: n, g: o, b: a } = N(this.currentColor);
2918
2946
  this.input.value = `rgb(${n}, ${o}, ${a})`;
2919
2947
  } else {
2920
2948
  const { hue: n, sat: o, lightness: a } = gt(e, i, s);
@@ -2936,14 +2964,14 @@ class dt {
2936
2964
  const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
2937
2965
  if (s) {
2938
2966
  const n = parseInt(s[1]), o = parseInt(s[2]) / 100, a = parseInt(s[3]) / 100, l = a + o * Math.min(a, 1 - a), r = l === 0 ? 0 : 2 * (1 - a / l);
2939
- e = U(n, r, l);
2967
+ e = W(n, r, l);
2940
2968
  }
2941
2969
  }
2942
2970
  }
2943
2971
  e && this.setColor(e);
2944
2972
  }
2945
2973
  updateOpacityBg() {
2946
- const { r: t, g: e, b: i } = V(this.currentColor);
2974
+ const { r: t, g: e, b: i } = N(this.currentColor);
2947
2975
  this.opacitySlider.style.setProperty(
2948
2976
  "--base-color",
2949
2977
  `rgb(${t}, ${e}, ${i})`
@@ -2954,12 +2982,12 @@ class dt {
2954
2982
  this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
2955
2983
  const { h: s, s: n, v: o } = R(t);
2956
2984
  this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 - o) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${s}, 100%, 50%))`, this.updateOpacityBg(), this.opacityMarker.style.left = `${this.currentOpacity}%`, (y = this.recentSectionRefresh) == null || y.call(this), this.isOpen = !0, this.backdrop.style.display = "block", this.backdrop.parentElement || document.body.appendChild(this.backdrop), this.element.style.display = "block", this.element.style.position = "fixed", this.element.style.zIndex = "10002", this.element.style.left = "-9999px", this.element.style.top = "0px", this.element.parentElement || document.body.appendChild(this.element);
2957
- const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), p = window.innerWidth, h = window.innerHeight, d = 16;
2958
- let u = r.right + 8, g = r.top;
2959
- const m = p - r.right, f = r.left;
2960
- m >= a + d ? u = r.right + 8 : f >= a + d ? u = r.left - a - 8 : u = Math.max(d, (p - a) / 2);
2961
- const v = h - r.bottom, C = r.top;
2962
- v >= l + d ? g = r.bottom + 8 : C >= l + d ? g = r.top - l - 8 : v > C ? (g = r.bottom + 8, g + l > h - d && (g = h - l - d)) : (g = r.top - l - 8, g < d && (g = d)), this.element.style.left = `${u}px`, this.element.style.top = `${g}px`;
2985
+ const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), h = window.innerWidth, d = window.innerHeight, p = 16;
2986
+ let g = r.right + 8, v = r.top;
2987
+ const m = h - r.right, u = r.left;
2988
+ m >= a + p ? g = r.right + 8 : u >= a + p ? g = r.left - a - 8 : g = Math.max(p, (h - a) / 2);
2989
+ const f = d - r.bottom, C = r.top;
2990
+ f >= l + p ? v = r.bottom + 8 : C >= l + p ? v = r.top - l - 8 : f > C ? (v = r.bottom + 8, v + l > d - p && (v = d - l - p)) : (v = r.top - l - 8, v < p && (v = p)), this.element.style.left = `${g}px`, this.element.style.top = `${v}px`;
2963
2991
  }
2964
2992
  close(t) {
2965
2993
  var e;
@@ -2996,72 +3024,72 @@ class ie {
2996
3024
  l.className = "color-picker-hue-marker", this.hueMarker = l, a.appendChild(l);
2997
3025
  const r = document.createElement("div");
2998
3026
  r.className = "color-picker-opacity embedded", this.opacitySlider = r;
2999
- const p = document.createElement("div");
3000
- p.className = "color-picker-opacity-marker", this.opacityMarker = p, r.appendChild(p), o.appendChild(a), o.appendChild(r), s.appendChild(n), s.appendChild(o);
3001
- const h = ot((w) => {
3002
- const k = N(w);
3027
+ const h = document.createElement("div");
3028
+ h.className = "color-picker-opacity-marker", this.opacityMarker = h, r.appendChild(h), o.appendChild(a), o.appendChild(r), s.appendChild(n), s.appendChild(o);
3029
+ const d = ot((w) => {
3030
+ const k = I(w);
3003
3031
  k && k.type !== "solid" ? this.onColorChange(w, this.currentOpacity) : (this.setColor(w), this.onColorChange(this.currentColor, this.currentOpacity));
3004
3032
  }, "all");
3005
- this.recentSectionRefresh = h.refresh;
3006
- const d = document.createElement("div");
3007
- d.className = "color-picker-format-section embedded";
3008
- const u = document.createElement("select");
3009
- u.className = "color-picker-format-select", this.select = u;
3010
- const g = document.createElement("option");
3011
- g.value = "hex", g.textContent = "HEX";
3033
+ this.recentSectionRefresh = d.refresh;
3034
+ const p = document.createElement("div");
3035
+ p.className = "color-picker-format-section embedded";
3036
+ const g = document.createElement("select");
3037
+ g.className = "color-picker-format-select", this.select = g;
3038
+ const v = document.createElement("option");
3039
+ v.value = "hex", v.textContent = "HEX";
3012
3040
  const m = document.createElement("option");
3013
3041
  m.value = "rgb", m.textContent = "RGB";
3014
- const f = document.createElement("option");
3015
- f.value = "hsl", f.textContent = "HSL", u.appendChild(g), u.appendChild(m), u.appendChild(f);
3016
- const v = document.createElement("input");
3017
- v.type = "text", v.className = "color-picker-color-input", this.input = v;
3042
+ const u = document.createElement("option");
3043
+ u.value = "hsl", u.textContent = "HSL", g.appendChild(v), g.appendChild(m), g.appendChild(u);
3044
+ const f = document.createElement("input");
3045
+ f.type = "text", f.className = "color-picker-color-input", this.input = f;
3018
3046
  const C = document.createElement("div");
3019
3047
  C.className = "color-picker-input-container";
3020
3048
  const y = document.createElement("button");
3021
- return y.className = "color-picker-copy-inside", y.textContent = "Copy", C.appendChild(v), C.appendChild(y), d.appendChild(u), d.appendChild(C), t.appendChild(e), t.appendChild(s), t.appendChild(d), t.appendChild(h.container), this.bind(e, a, r, v, u, y, n), t;
3049
+ return y.className = "color-picker-copy-inside", y.textContent = "Copy", C.appendChild(f), C.appendChild(y), p.appendChild(g), p.appendChild(C), t.appendChild(e), t.appendChild(s), t.appendChild(p), t.appendChild(d.container), this.bind(e, a, r, f, g, y, n), t;
3022
3050
  }
3023
3051
  bind(t, e, i, s, n, o, a) {
3024
- const l = (h) => {
3025
- const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width)), g = Math.max(0, Math.min(1, (h.clientY - d.top) / d.height));
3026
- this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
3027
- const f = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = U(f, u, 1 - g);
3028
- this.currentColor = v, this.syncInput(), this.updateOpacityBg(), this.queueChange();
3029
- }, r = (h) => {
3030
- const d = e.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
3031
- this.hueMarker.style.left = `${u * 100}%`;
3032
- const g = u * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), f = this.parsePercentage(this.colorMarker.style.top || "0%"), v = U(g, m, 1 - f);
3033
- this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
3034
- linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
3035
- }, p = (h) => {
3036
- const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
3037
- this.opacityMarker.style.left = `${u * 100}%`, this.currentOpacity = Math.round(u * 100), this.queueChange();
3052
+ const l = (d) => {
3053
+ const p = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width)), v = Math.max(0, Math.min(1, (d.clientY - p.top) / p.height));
3054
+ this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${v * 100}%`;
3055
+ const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, f = W(u, g, 1 - v);
3056
+ this.currentColor = f, this.syncInput(), this.updateOpacityBg(), this.queueChange();
3057
+ }, r = (d) => {
3058
+ const p = e.getBoundingClientRect(), g = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width));
3059
+ this.hueMarker.style.left = `${g * 100}%`;
3060
+ const v = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), f = W(v, m, 1 - u);
3061
+ this.currentColor = f, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
3062
+ linear-gradient(to right, #fff, hsl(${v}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
3063
+ }, h = (d) => {
3064
+ const p = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width));
3065
+ this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), this.queueChange();
3038
3066
  };
3039
- t.addEventListener("mousedown", (h) => {
3040
- h.preventDefault(), this.isDragging = !0, l(h);
3041
- const d = (g) => l(g), u = () => {
3042
- this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
3067
+ t.addEventListener("mousedown", (d) => {
3068
+ d.preventDefault(), this.isDragging = !0, l(d);
3069
+ const p = (v) => l(v), g = () => {
3070
+ this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
3043
3071
  };
3044
- document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
3045
- }), e.addEventListener("mousedown", (h) => {
3046
- h.preventDefault(), this.isDragging = !0, r(h);
3047
- const d = (g) => r(g), u = () => {
3048
- this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
3072
+ document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
3073
+ }), e.addEventListener("mousedown", (d) => {
3074
+ d.preventDefault(), this.isDragging = !0, r(d);
3075
+ const p = (v) => r(v), g = () => {
3076
+ this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
3049
3077
  };
3050
- document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
3051
- }), i.addEventListener("mousedown", (h) => {
3052
- h.preventDefault(), this.isDragging = !0, p(h);
3053
- const d = (g) => p(g), u = () => {
3054
- this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
3078
+ document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
3079
+ }), i.addEventListener("mousedown", (d) => {
3080
+ d.preventDefault(), this.isDragging = !0, h(d);
3081
+ const p = (v) => h(v), g = () => {
3082
+ this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
3055
3083
  };
3056
- document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
3084
+ document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
3057
3085
  }), n.addEventListener("change", () => {
3058
3086
  this.syncInput();
3059
3087
  }), s.addEventListener("input", () => {
3060
3088
  this.applyFromInput();
3061
3089
  }), s.addEventListener("blur", () => {
3062
3090
  this.syncInput();
3063
- }), s.addEventListener("keydown", (h) => {
3064
- h.key === "Enter" && (h.preventDefault(), this.syncInput(), s.blur());
3091
+ }), s.addEventListener("keydown", (d) => {
3092
+ d.key === "Enter" && (d.preventDefault(), this.syncInput(), s.blur());
3065
3093
  }), o.addEventListener("click", async () => {
3066
3094
  try {
3067
3095
  await navigator.clipboard.writeText(s.value);
@@ -3074,8 +3102,8 @@ class ie {
3074
3102
  return;
3075
3103
  }
3076
3104
  try {
3077
- const h = new window.EyeDropper(), { sRGBHex: d } = await h.open();
3078
- this.setColor(d), this.onColorChange(this.currentColor, this.currentOpacity);
3105
+ const d = new window.EyeDropper(), { sRGBHex: p } = await d.open();
3106
+ this.setColor(p), this.onColorChange(this.currentColor, this.currentOpacity);
3079
3107
  } catch {
3080
3108
  }
3081
3109
  });
@@ -3091,7 +3119,7 @@ class ie {
3091
3119
  if (t === "hex")
3092
3120
  this.input.value = this.currentColor;
3093
3121
  else if (t === "rgb") {
3094
- const { r: n, g: o, b: a } = V(this.currentColor);
3122
+ const { r: n, g: o, b: a } = N(this.currentColor);
3095
3123
  this.input.value = `rgb(${n}, ${o}, ${a})`;
3096
3124
  } else {
3097
3125
  const { hue: n, sat: o, lightness: a } = gt(e, i, s);
@@ -3114,14 +3142,14 @@ class ie {
3114
3142
  const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
3115
3143
  if (s) {
3116
3144
  const n = parseInt(s[1], 10), o = parseInt(s[2], 10) / 100, a = parseInt(s[3], 10) / 100, l = a + o * Math.min(a, 1 - a), r = l === 0 ? 0 : 2 * (1 - a / l);
3117
- e = U(n, r, l);
3145
+ e = W(n, r, l);
3118
3146
  }
3119
3147
  }
3120
3148
  }
3121
3149
  e && (this.setColor(e), this.onColorChange(this.currentColor, this.currentOpacity));
3122
3150
  }
3123
3151
  updateOpacityBg() {
3124
- const { r: t, g: e, b: i } = V(this.currentColor);
3152
+ const { r: t, g: e, b: i } = N(this.currentColor);
3125
3153
  this.opacitySlider.style.setProperty(
3126
3154
  "--base-color",
3127
3155
  `rgb(${t}, ${e}, ${i})`
@@ -3162,7 +3190,7 @@ class ie {
3162
3190
  this.initFromColor(t, e);
3163
3191
  }
3164
3192
  }
3165
- const H = class H extends x {
3193
+ const $ = class $ extends x {
3166
3194
  constructor(t = {}) {
3167
3195
  const e = typeof t.default == "string" ? void 0 : t.default;
3168
3196
  super({
@@ -3174,16 +3202,16 @@ const H = class H extends x {
3174
3202
  angle: "number",
3175
3203
  stops: "text"
3176
3204
  }, this.element = null, this.previewEl = null, this.inputEl = void 0, this.popoverEl = null, this.backdropEl = null, this.isPopoverOpen = !1, this.isEditing = !1, this.popoverPosition = null, this.previewUpdateTimeout = null, this.solidPicker = null, this.pendingSolidColor = null, this.variant = "default", this.globalLayoutMode = "list", this.globalSearchQuery = "", this.currentMode = "custom", this.linkedGlobalVariable = null, this.unlinkButton = null, this.onBackgroundClick = (i) => {
3177
- var d;
3205
+ var p;
3178
3206
  if (!this.popoverEl || !this.isPopoverOpen) return;
3179
- const s = i.target, n = this.popoverEl.contains(s), o = (d = this.element) == null ? void 0 : d.contains(s), a = document.querySelectorAll(".custom-color-picker"), l = Array.from(a).some((u) => u.contains(s)), r = s.closest(
3207
+ const s = i.target, n = this.popoverEl.contains(s), o = (p = this.element) == null ? void 0 : p.contains(s), a = document.querySelectorAll(".custom-color-picker"), l = Array.from(a).some((g) => g.contains(s)), r = s.closest(
3180
3208
  ".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"
3181
- ), p = s.classList.contains(
3182
- "color-picker-backdrop"
3183
3209
  ), h = s.classList.contains(
3210
+ "color-picker-backdrop"
3211
+ ), d = s.classList.contains(
3184
3212
  "gradient-popover-backdrop"
3185
3213
  );
3186
- !n && !o && !l && !r && !p && !h && this.closePopover();
3214
+ !n && !o && !l && !r && !h && !d && this.closePopover();
3187
3215
  }, this.handlePopoverKeydown = (i) => {
3188
3216
  if (this.isPopoverOpen) {
3189
3217
  if (i.key === "Escape") {
@@ -3236,16 +3264,16 @@ const H = class H extends x {
3236
3264
  const t = this.originalDefault;
3237
3265
  if (typeof t == "string") {
3238
3266
  if (t.startsWith("var(--"))
3239
- return $({
3267
+ return H({
3240
3268
  type: "solid",
3241
3269
  angle: 0,
3242
3270
  stops: [{ color: t, position: 0, opacity: 100 }]
3243
3271
  });
3244
- const i = N(t);
3272
+ const i = I(t);
3245
3273
  if (i)
3246
- return $(i);
3274
+ return H(i);
3247
3275
  }
3248
- return $(t && typeof t == "object" ? t : {
3276
+ return H(t && typeof t == "object" ? t : {
3249
3277
  type: "linear",
3250
3278
  angle: 90,
3251
3279
  stops: [
@@ -3256,11 +3284,11 @@ const H = class H extends x {
3256
3284
  }
3257
3285
  setValue(t) {
3258
3286
  let e = null;
3259
- typeof t == "string" ? t.startsWith("var(--") ? e = $({
3287
+ typeof t == "string" ? t.startsWith("var(--") ? e = H({
3260
3288
  type: "solid",
3261
3289
  angle: 0,
3262
3290
  stops: [{ color: t, position: 0, opacity: 100 }]
3263
- }) : e = N(t) : t && typeof t == "object" && (e = $(t)), e || (e = this.defaultValue()), this.value = e, this.setLinkedGlobalVariableFrom(t ?? e), this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent(), this.triggerChange(), this.pendingSolidColor = null, this.updateUnlinkButtonVisibility();
3291
+ }) : e = I(t) : t && typeof t == "object" && (e = H(t)), e || (e = this.defaultValue()), this.value = e, this.setLinkedGlobalVariableFrom(t ?? e), this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent(), this.triggerChange(), this.pendingSolidColor = null, this.updateUnlinkButtonVisibility();
3264
3292
  }
3265
3293
  updateUI() {
3266
3294
  if (this.previewEl && this.value)
@@ -3368,10 +3396,10 @@ const H = class H extends x {
3368
3396
  n.appendChild(o), s.appendChild(n);
3369
3397
  const a = document.createElement("div");
3370
3398
  if (a.className = "gradient-editor-content", this.updatePopoverContent(a), s.appendChild(a), this.variant !== "global" && e) {
3371
- const l = e.children[0], r = e.children[1], p = (h) => {
3372
- this.currentMode = h, h === "custom" ? (l.classList.add("active"), r.classList.remove("active"), n.style.display = "block") : (r.classList.add("active"), l.classList.remove("active"), n.style.display = "none"), this.updatePopoverContent(a);
3399
+ const l = e.children[0], r = e.children[1], h = (d) => {
3400
+ this.currentMode = d, d === "custom" ? (l.classList.add("active"), r.classList.remove("active"), n.style.display = "block") : (r.classList.add("active"), l.classList.remove("active"), n.style.display = "none"), this.updatePopoverContent(a);
3373
3401
  };
3374
- l.addEventListener("click", () => p("custom")), r.addEventListener("click", () => p("global")), this.isBoundToGlobal() ? (this.currentMode = "global", p("global")) : (this.currentMode = "custom", p("custom"));
3402
+ l.addEventListener("click", () => h("custom")), r.addEventListener("click", () => h("global")), this.isBoundToGlobal() ? (this.currentMode = "global", h("global")) : (this.currentMode = "custom", h("custom"));
3375
3403
  }
3376
3404
  this.popoverEl.appendChild(t), this.popoverEl.appendChild(s), document.body.appendChild(this.backdropEl), document.body.appendChild(this.popoverEl);
3377
3405
  }
@@ -3398,7 +3426,7 @@ const H = class H extends x {
3398
3426
  ]), t !== "solid" && this.value.stops.length === 1) {
3399
3427
  const a = this.value.stops[0].color;
3400
3428
  if (a.startsWith("var(--")) {
3401
- const l = this.resolveGlobalVarColor(a), r = N(l);
3429
+ const l = this.resolveGlobalVarColor(a), r = I(l);
3402
3430
  r && r.type !== "solid" && r.stops.length >= 2 ? (this.value.stops = r.stops, this.value.angle = r.angle, this.value.type = r.type) : (this.value.stops.push({
3403
3431
  color: "#786666",
3404
3432
  position: 100,
@@ -3438,20 +3466,20 @@ const H = class H extends x {
3438
3466
  }
3439
3467
  renderGlobalColors(t) {
3440
3468
  (!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
3441
- const e = this.value.stops[0], i = (h) => {
3442
- h.innerHTML = "";
3443
- let d = {};
3469
+ const e = this.value.stops[0], i = (d) => {
3470
+ d.innerHTML = "";
3471
+ let p = {};
3444
3472
  try {
3445
- d = x.GlobalVariables || {};
3446
- } catch (f) {
3447
- console.warn("Could not access Setting.GlobalVariables", f);
3473
+ p = x.GlobalVariables || {};
3474
+ } catch (u) {
3475
+ console.warn("Could not access Setting.GlobalVariables", u);
3448
3476
  }
3449
- if (!d || Object.keys(d).length === 0) {
3450
- const f = document.createElement("div");
3451
- f.textContent = "No global colors defined", f.style.fontSize = "12px", f.style.color = "#666", f.style.padding = "8px", h.appendChild(f);
3477
+ if (!p || Object.keys(p).length === 0) {
3478
+ const u = document.createElement("div");
3479
+ u.textContent = "No global colors defined", u.style.fontSize = "12px", u.style.color = "#666", u.style.padding = "8px", d.appendChild(u);
3452
3480
  return;
3453
3481
  }
3454
- const u = [
3482
+ const g = [
3455
3483
  {
3456
3484
  title: "Global Colors",
3457
3485
  keys: ["primary", "secondary", "tertiary", "accent", "background"]
@@ -3460,11 +3488,11 @@ const H = class H extends x {
3460
3488
  title: "Text Color",
3461
3489
  keys: ["text-dark", "text-light"]
3462
3490
  }
3463
- ], g = this.globalSearchQuery.toLowerCase();
3491
+ ], v = this.globalSearchQuery.toLowerCase();
3464
3492
  let m;
3465
- this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"), h.appendChild(m), u.forEach((f) => {
3466
- const v = Object.entries(d).filter(([C]) => !f.keys.includes(C) && f.title !== "Global Colors" ? !1 : f.keys.includes(C) && C.toLowerCase().includes(g));
3467
- v.length !== 0 && v.forEach(([C, y]) => {
3493
+ this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"), d.appendChild(m), g.forEach((u) => {
3494
+ const f = Object.entries(p).filter(([C]) => !u.keys.includes(C) && u.title !== "Global Colors" ? !1 : u.keys.includes(C) && C.toLowerCase().includes(v));
3495
+ f.length !== 0 && f.forEach(([C, y]) => {
3468
3496
  if (this.globalLayoutMode === "list") {
3469
3497
  const w = document.createElement("div");
3470
3498
  w.className = "global-color-row";
@@ -3476,7 +3504,7 @@ const H = class H extends x {
3476
3504
  E.className = "global-color-label", E.textContent = C.split("-").map((M) => M.charAt(0).toUpperCase() + M.slice(1)).join(" "), w.appendChild(k), w.appendChild(E), w.addEventListener("click", (M) => {
3477
3505
  M.preventDefault();
3478
3506
  const B = `var(--${C})`;
3479
- this.setValue(B), this.pendingSolidColor = B, i(h);
3507
+ this.setValue(B), this.pendingSolidColor = B, i(d);
3480
3508
  }), m.appendChild(w);
3481
3509
  } else {
3482
3510
  const w = document.createElement("div");
@@ -3485,7 +3513,7 @@ const H = class H extends x {
3485
3513
  w.style.background = k, w.title = C.split("-").map((b) => b.charAt(0).toUpperCase() + b.slice(1)).join(" "), (this.linkedGlobalVariable === `var(--${C})` || e.color === `var(--${C})`) && w.classList.add("selected"), w.addEventListener("click", (b) => {
3486
3514
  b.preventDefault();
3487
3515
  const E = `var(--${C})`;
3488
- this.setValue(E), this.pendingSolidColor = E, i(h);
3516
+ this.setValue(E), this.pendingSolidColor = E, i(d);
3489
3517
  }), m.appendChild(w);
3490
3518
  }
3491
3519
  });
@@ -3499,16 +3527,16 @@ const H = class H extends x {
3499
3527
  const a = document.createElement("input");
3500
3528
  a.type = "text", a.className = "global-search-input", a.placeholder = "Search", a.value = this.globalSearchQuery;
3501
3529
  const l = document.createElement("div");
3502
- a.addEventListener("input", (h) => {
3503
- this.globalSearchQuery = h.target.value, i(l);
3530
+ a.addEventListener("input", (d) => {
3531
+ this.globalSearchQuery = d.target.value, i(l);
3504
3532
  }), n.appendChild(o), n.appendChild(a);
3505
3533
  const r = document.createElement("button");
3506
3534
  r.className = "global-layout-toggle", r.type = "button";
3507
- const p = () => {
3535
+ const h = () => {
3508
3536
  r.innerHTML = this.globalLayoutMode === "list" ? '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>' : '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3.01" y2="6"></line><line x1="3" y1="12" x2="3.01" y2="12"></line><line x1="3" y1="18" x2="3.01" y2="18"></line></svg>';
3509
3537
  };
3510
- p(), r.addEventListener("click", () => {
3511
- this.globalLayoutMode = this.globalLayoutMode === "list" ? "grid" : "list", p(), i(l);
3538
+ h(), r.addEventListener("click", () => {
3539
+ this.globalLayoutMode = this.globalLayoutMode === "list" ? "grid" : "list", h(), i(l);
3512
3540
  }), s.appendChild(n), s.appendChild(r), t.appendChild(s), t.appendChild(l), i(l);
3513
3541
  }
3514
3542
  renderSolid(t) {
@@ -3518,7 +3546,7 @@ const H = class H extends x {
3518
3546
  initialOpacity: e.opacity ?? 100,
3519
3547
  onColorChange: (s, n) => {
3520
3548
  if (this.clearGlobalBindingForCustomChange(), this.value) {
3521
- const o = N(s);
3549
+ const o = I(s);
3522
3550
  if (o && o.type !== "solid") {
3523
3551
  this.value = o, this.switchType(o.type);
3524
3552
  return;
@@ -3533,35 +3561,35 @@ const H = class H extends x {
3533
3561
  this.solidPicker = null;
3534
3562
  let e = null;
3535
3563
  {
3536
- const p = document.createElement("div");
3537
- p.className = "gradient-subtype-inline";
3538
- const h = document.createElement("select");
3539
- h.className = "gradient-subtype-select";
3540
- const d = document.createElement("option");
3541
- d.value = "linear", d.textContent = "Linear";
3542
- const u = document.createElement("option");
3543
- u.value = "radial", u.textContent = "Radial", h.appendChild(d), h.appendChild(u), h.value = this.value.type === "radial" ? "radial" : "linear", e = document.createElement("input"), e.type = "text", e.inputMode = "numeric", e.className = "gradient-degree-input", e.value = `${this.value.angle ?? 90}°`, e.style.width = "75px", e.style.textAlign = "center", (!this.value.angle || this.value.stops.length < 2) && (this.value.angle = 90, e.value = "90°");
3544
- const g = document.createElement("button");
3545
- g.type = "button", g.className = "gradient-flip-btn", g.innerHTML = Kt, h.addEventListener("change", () => {
3546
- this.clearGlobalBindingForCustomChange(), this.switchType(h.value === "radial" ? "radial" : "linear"), e && this.updateDegreeVisibility(e);
3564
+ const h = document.createElement("div");
3565
+ h.className = "gradient-subtype-inline";
3566
+ const d = document.createElement("select");
3567
+ d.className = "gradient-subtype-select";
3568
+ const p = document.createElement("option");
3569
+ p.value = "linear", p.textContent = "Linear";
3570
+ const g = document.createElement("option");
3571
+ g.value = "radial", g.textContent = "Radial", d.appendChild(p), d.appendChild(g), d.value = this.value.type === "radial" ? "radial" : "linear", e = document.createElement("input"), e.type = "text", e.inputMode = "numeric", e.className = "gradient-degree-input", e.value = `${this.value.angle ?? 90}°`, e.style.width = "75px", e.style.textAlign = "center", (!this.value.angle || this.value.stops.length < 2) && (this.value.angle = 90, e.value = "90°");
3572
+ const v = document.createElement("button");
3573
+ v.type = "button", v.className = "gradient-flip-btn", v.innerHTML = Kt, d.addEventListener("change", () => {
3574
+ this.clearGlobalBindingForCustomChange(), this.switchType(d.value === "radial" ? "radial" : "linear"), e && this.updateDegreeVisibility(e);
3547
3575
  }), e.addEventListener("focus", (m) => {
3548
- const f = m.target;
3549
- f.value = f.value.replace(/[^0-9-]/g, ""), setTimeout(() => f.select(), 0);
3576
+ const u = m.target;
3577
+ u.value = u.value.replace(/[^0-9-]/g, ""), setTimeout(() => u.select(), 0);
3550
3578
  }), e.addEventListener("input", (m) => {
3551
3579
  this.clearGlobalBindingForCustomChange();
3552
- const f = parseInt(m.target.value);
3553
- !Number.isNaN(f) && this.value && (this.value.angle = Math.max(0, Math.min(360, f)), this.debouncedPreviewUpdate());
3580
+ const u = parseInt(m.target.value);
3581
+ !Number.isNaN(u) && this.value && (this.value.angle = Math.max(0, Math.min(360, u)), this.debouncedPreviewUpdate());
3554
3582
  }), e.addEventListener("blur", (m) => {
3555
3583
  var C;
3556
3584
  this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
3557
- const f = m.target;
3558
- let v = parseInt(f.value);
3559
- Number.isNaN(v) && (v = ((C = this.value) == null ? void 0 : C.angle) ?? 0), v = Math.max(0, Math.min(360, v)), this.value && (this.value.angle = v), f.value = `${v}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
3560
- }), g.addEventListener("click", () => {
3585
+ const u = m.target;
3586
+ let f = parseInt(u.value);
3587
+ Number.isNaN(f) && (f = ((C = this.value) == null ? void 0 : C.angle) ?? 0), f = Math.max(0, Math.min(360, f)), this.value && (this.value.angle = f), u.value = `${f}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
3588
+ }), v.addEventListener("click", () => {
3561
3589
  this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((m) => {
3562
3590
  m.position = 100 - m.position;
3563
- }), this.value.stops.sort((m, f) => m.position - f.position), this.updateGradientPreview(i), this.createHandles(s, i), this.updateStopsList(l), this.updateUI(), this.triggerChange());
3564
- }), p.appendChild(h), p.appendChild(e), p.appendChild(g), t.appendChild(p), this.updateDegreeVisibility(e);
3591
+ }), this.value.stops.sort((m, u) => m.position - u.position), this.updateGradientPreview(i), this.createHandles(s, i), this.updateStopsList(l), this.updateUI(), this.triggerChange());
3592
+ }), h.appendChild(d), h.appendChild(e), h.appendChild(v), t.appendChild(h), this.updateDegreeVisibility(e);
3565
3593
  }
3566
3594
  const i = document.createElement("div");
3567
3595
  i.className = "gradient-preview", this.updateGradientPreview(i);
@@ -3575,13 +3603,13 @@ const H = class H extends x {
3575
3603
  a.type = "button", a.className = "gradient-add-stop", a.textContent = "+", n.appendChild(o), n.appendChild(a);
3576
3604
  const l = document.createElement("div");
3577
3605
  l.className = "gradient-stops", t.appendChild(n), t.appendChild(l), this.updateStopsList(l);
3578
- const r = ot((p) => {
3579
- const h = N(p);
3580
- h && (this.clearGlobalBindingForCustomChange(), this.value = h, this.switchType(h.type), this.updateUI(), this.triggerChange());
3606
+ const r = ot((h) => {
3607
+ const d = I(h);
3608
+ d && (this.clearGlobalBindingForCustomChange(), this.value = d, this.switchType(d.type), this.updateUI(), this.triggerChange());
3581
3609
  }, "all");
3582
3610
  this.recentGradientRefresh = r.refresh, t.appendChild(r.container), a.addEventListener("click", () => {
3583
- var p;
3584
- this.clearGlobalBindingForCustomChange(), this.addStop(), this.updateStopsList(l), this.updateGradientPreview(i), this.createHandles(s, i), this.updateUI(), ((p = document.activeElement) == null ? void 0 : p.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange();
3611
+ var h;
3612
+ this.clearGlobalBindingForCustomChange(), this.addStop(), this.updateStopsList(l), this.updateGradientPreview(i), this.createHandles(s, i), this.updateUI(), ((h = document.activeElement) == null ? void 0 : h.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange();
3585
3613
  });
3586
3614
  }
3587
3615
  updateDegreeVisibility(t) {
@@ -3614,36 +3642,36 @@ const H = class H extends x {
3614
3642
  o.className = "gstop-chip";
3615
3643
  const a = this.resolveGlobalVarColor(i.color);
3616
3644
  o.style.backgroundColor = a, n.appendChild(o);
3617
- const l = new dt((f, v) => {
3618
- this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color = f, v !== void 0 && (this.value.stops[s].opacity = v), o.style.backgroundColor = f, this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
3645
+ const l = new dt((u, f) => {
3646
+ this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color = u, f !== void 0 && (this.value.stops[s].opacity = f), o.style.backgroundColor = u, this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
3619
3647
  }, "solid");
3620
- let r = !1, p = !1, h = 0, d = 0;
3621
- const u = (f) => {
3622
- r = !0, p = !1, h = f.clientX, d = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", g), document.addEventListener("mouseup", m), f.preventDefault(), f.stopPropagation();
3623
- }, g = (f) => {
3648
+ let r = !1, h = !1, d = 0, p = 0;
3649
+ const g = (u) => {
3650
+ r = !0, h = !1, d = u.clientX, p = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", v), document.addEventListener("mouseup", m), u.preventDefault(), u.stopPropagation();
3651
+ }, v = (u) => {
3624
3652
  if (!r || !this.value) return;
3625
- const v = f.clientX - h;
3626
- if (Math.abs(v) > 3 && (p = !0), p) {
3653
+ const f = u.clientX - d;
3654
+ if (Math.abs(f) > 3 && (h = !0), h) {
3627
3655
  this.clearGlobalBindingForCustomChange();
3628
3656
  const C = e.getBoundingClientRect();
3629
- let y = d + v / C.width * 100;
3657
+ let y = p + f / C.width * 100;
3630
3658
  y = Math.max(0, Math.min(100, y)), this.value.stops[s].position = Math.round(y), n.style.left = `${y}%`, this.updateGradientPreview();
3631
3659
  }
3632
- }, m = (f) => {
3633
- var v;
3660
+ }, m = (u) => {
3661
+ var f;
3634
3662
  if (r)
3635
- if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", m), p)
3663
+ if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", m), h)
3636
3664
  this.value && (this.value.stops.sort((C, y) => C.position - y.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
3637
3665
  else {
3638
- f.stopPropagation();
3639
- const C = (v = this.value) == null ? void 0 : v.stops[s];
3666
+ u.stopPropagation();
3667
+ const C = (f = this.value) == null ? void 0 : f.stops[s];
3640
3668
  C && setTimeout(() => {
3641
3669
  const y = this.resolveGlobalVarColor(C.color);
3642
3670
  l.open(y, o, C.opacity ?? 100);
3643
3671
  }, 0);
3644
3672
  }
3645
3673
  };
3646
- n.addEventListener("mousedown", u), t.appendChild(n);
3674
+ n.addEventListener("mousedown", g), t.appendChild(n);
3647
3675
  });
3648
3676
  }
3649
3677
  updateStopsList(t) {
@@ -3659,31 +3687,31 @@ const H = class H extends x {
3659
3687
  l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px", a.appendChild(l);
3660
3688
  const r = document.createElement("div");
3661
3689
  r.className = "gstop-color-container";
3662
- const p = this.resolveGlobalVarColor(s.color), h = document.createElement("div");
3663
- h.className = "gstop-color-preview", h.style.backgroundColor = p;
3664
- const d = document.createElement("input");
3665
- d.type = "text", d.className = "gstop-color-input", d.value = p.replace("#", "").toUpperCase();
3666
- const u = document.createElement("button");
3667
- u.type = "button", u.className = "gstop-color-copy", u.textContent = "Copy", r.appendChild(h), r.appendChild(d), r.appendChild(u);
3690
+ const h = this.resolveGlobalVarColor(s.color), d = document.createElement("div");
3691
+ d.className = "gstop-color-preview", d.style.backgroundColor = h;
3692
+ const p = document.createElement("input");
3693
+ p.type = "text", p.className = "gstop-color-input", p.value = h.replace("#", "").toUpperCase();
3668
3694
  const g = document.createElement("button");
3669
- g.type = "button", g.className = "gstop-del", g.innerHTML = Yt, g.disabled = (((S = (k = this.value) == null ? void 0 : k.stops) == null ? void 0 : S.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(g), e.appendChild(o);
3695
+ g.type = "button", g.className = "gstop-color-copy", g.textContent = "Copy", r.appendChild(d), r.appendChild(p), r.appendChild(g);
3696
+ const v = document.createElement("button");
3697
+ v.type = "button", v.className = "gstop-del", v.innerHTML = Yt, v.disabled = (((S = (k = this.value) == null ? void 0 : k.stops) == null ? void 0 : S.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(v), e.appendChild(o);
3670
3698
  const m = document.createElement("span");
3671
3699
  m.className = "gstop-opacity-label", m.textContent = "Opacity";
3672
- const f = document.createElement("div");
3673
- f.className = "gstop-opacity-group";
3674
- const v = document.createElement("input");
3675
- v.type = "range", v.className = "gstop-opacity-slider", v.min = "0", v.max = "100", v.value = String(s.opacity ?? 100);
3676
- const C = V(p);
3677
- v.style.setProperty(
3700
+ const u = document.createElement("div");
3701
+ u.className = "gstop-opacity-group";
3702
+ const f = document.createElement("input");
3703
+ f.type = "range", f.className = "gstop-opacity-slider", f.min = "0", f.max = "100", f.value = String(s.opacity ?? 100);
3704
+ const C = N(h);
3705
+ f.style.setProperty(
3678
3706
  "--slider-color",
3679
3707
  `rgb(${C.r}, ${C.g}, ${C.b})`
3680
3708
  );
3681
3709
  const y = document.createElement("span");
3682
- y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, f.appendChild(v), f.appendChild(y);
3710
+ y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, u.appendChild(f), u.appendChild(y);
3683
3711
  const w = new dt((b, E) => {
3684
- this.clearGlobalBindingForCustomChange(), d.value = b.replace("#", "").toUpperCase(), h.style.backgroundColor = b, this.value.stops[n].color = b, E !== void 0 && (this.value.stops[n].opacity = E, v.value = String(E), y.textContent = `${E}%`);
3685
- const M = V(b);
3686
- v.style.setProperty(
3712
+ this.clearGlobalBindingForCustomChange(), p.value = b.replace("#", "").toUpperCase(), d.style.backgroundColor = b, this.value.stops[n].color = b, E !== void 0 && (this.value.stops[n].opacity = E, f.value = String(E), y.textContent = `${E}%`);
3713
+ const M = N(b);
3714
+ f.style.setProperty(
3687
3715
  "--slider-color",
3688
3716
  `rgb(${M.r}, ${M.g}, ${M.b})`
3689
3717
  ), this.updateGradientPreview(), this.createHandles(
@@ -3691,27 +3719,27 @@ const H = class H extends x {
3691
3719
  this.popoverEl.querySelector(".gradient-preview")
3692
3720
  ), this.updateUI(), this.triggerChange();
3693
3721
  }, "solid");
3694
- d.addEventListener("click", (b) => {
3722
+ p.addEventListener("click", (b) => {
3695
3723
  b.preventDefault(), b.stopPropagation();
3696
3724
  const E = this.resolveGlobalVarColor(s.color);
3697
- w.open(E, d, s.opacity ?? 100);
3698
- }), d.addEventListener("input", () => {
3725
+ w.open(E, p, s.opacity ?? 100);
3726
+ }), p.addEventListener("input", () => {
3699
3727
  this.clearGlobalBindingForCustomChange();
3700
- const b = d.value.trim(), E = b.startsWith("#") ? b : `#${b}`;
3728
+ const b = p.value.trim(), E = b.startsWith("#") ? b : `#${b}`;
3701
3729
  if (/^#[0-9A-Fa-f]{6}$/.test(E)) {
3702
- this.value.stops[n].color = E, h.style.backgroundColor = E;
3703
- const M = V(E);
3704
- v.style.setProperty(
3730
+ this.value.stops[n].color = E, d.style.backgroundColor = E;
3731
+ const M = N(E);
3732
+ f.style.setProperty(
3705
3733
  "--slider-color",
3706
3734
  `rgb(${M.r}, ${M.g}, ${M.b})`
3707
3735
  ), this.debouncedPreviewUpdate();
3708
3736
  }
3709
- }), d.addEventListener("blur", () => {
3737
+ }), p.addEventListener("blur", () => {
3710
3738
  this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
3711
- }), u.addEventListener("click", async (b) => {
3739
+ }), g.addEventListener("click", async (b) => {
3712
3740
  b.stopPropagation();
3713
3741
  try {
3714
- await navigator.clipboard.writeText(`#${d.value}`);
3742
+ await navigator.clipboard.writeText(`#${p.value}`);
3715
3743
  } catch {
3716
3744
  }
3717
3745
  }), l.addEventListener("focus", (b) => {
@@ -3737,17 +3765,17 @@ const H = class H extends x {
3737
3765
  this.popoverEl.querySelector(".gradient-handles"),
3738
3766
  this.popoverEl.querySelector(".gradient-preview")
3739
3767
  ), this.updateStopsList(), this.updateUI(), this.triggerChange();
3740
- }), g.addEventListener("click", () => {
3768
+ }), v.addEventListener("click", () => {
3741
3769
  var b;
3742
3770
  (this.value.stops.length || 0) <= 2 || (this.clearGlobalBindingForCustomChange(), this.value.stops.splice(n, 1), this.createHandles(
3743
3771
  this.popoverEl.querySelector(".gradient-handles"),
3744
3772
  this.popoverEl.querySelector(".gradient-preview")
3745
3773
  ), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((b = document.activeElement) == null ? void 0 : b.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
3746
- }), v.addEventListener("input", () => {
3774
+ }), f.addEventListener("input", () => {
3747
3775
  this.clearGlobalBindingForCustomChange();
3748
- const b = parseInt(v.value, 10);
3776
+ const b = parseInt(f.value, 10);
3749
3777
  this.value.stops[n].opacity = Math.max(0, Math.min(100, b)), y.textContent = `${this.value.stops[n].opacity}%`, this.debouncedPreviewUpdate();
3750
- }), v.addEventListener("change", () => {
3778
+ }), f.addEventListener("change", () => {
3751
3779
  this.clearGlobalBindingForCustomChange(), this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
3752
3780
  });
3753
3781
  }));
@@ -3770,16 +3798,16 @@ const H = class H extends x {
3770
3798
  this.value.stops.push(n), this.value.stops.sort((o, a) => o.position - a.position);
3771
3799
  }
3772
3800
  openPopover() {
3773
- if (this.popoverEl && (H.openInstance && H.openInstance !== this && H.openInstance.closePopover(), !this.isPopoverOpen)) {
3774
- if (this.isPopoverOpen = !0, H.openInstance = this, this.backdropEl && (this.backdropEl.style.display = "block", this.backdropEl.parentElement || document.body.appendChild(this.backdropEl)), this.popoverEl.style.display = "flex", this.refreshPopoverContent(), this.element) {
3801
+ if (this.popoverEl && ($.openInstance && $.openInstance !== this && $.openInstance.closePopover(), !this.isPopoverOpen)) {
3802
+ if (this.isPopoverOpen = !0, $.openInstance = this, this.backdropEl && (this.backdropEl.style.display = "block", this.backdropEl.parentElement || document.body.appendChild(this.backdropEl)), this.popoverEl.style.display = "flex", this.refreshPopoverContent(), this.element) {
3775
3803
  const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
3776
3804
  this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
3777
3805
  const o = this.popoverEl.offsetHeight;
3778
3806
  let a = t.right + 8, l = t.top;
3779
- const r = i - t.right, p = t.left, h = e + n;
3780
- r < h && p > r + 100 && (a = t.left - e - 8);
3781
- const d = s - t.bottom, u = t.top;
3782
- u >= o + n ? l = t.top - o - 8 : d >= o + n ? l = t.bottom + 8 : u > d ? (l = t.top - o - 8, l < n && (l = n)) : (l = t.bottom + 8, l + o > s - n && (l = s - o - n)), this.popoverEl.style.left = `${a}px`, this.popoverEl.style.top = `${l}px`, this.popoverPosition = { left: a, top: l };
3807
+ const r = i - t.right, h = t.left, d = e + n;
3808
+ r < d && h > r + 100 && (a = t.left - e - 8);
3809
+ const p = s - t.bottom, g = t.top;
3810
+ g >= o + n ? l = t.top - o - 8 : p >= o + n ? l = t.bottom + 8 : g > p ? (l = t.top - o - 8, l < n && (l = n)) : (l = t.bottom + 8, l + o > s - n && (l = s - o - n)), this.popoverEl.style.left = `${a}px`, this.popoverEl.style.top = `${l}px`, this.popoverPosition = { left: a, top: l };
3783
3811
  }
3784
3812
  setTimeout(
3785
3813
  () => document.addEventListener("click", this.onBackgroundClick, !0),
@@ -3800,10 +3828,10 @@ const H = class H extends x {
3800
3828
  this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
3801
3829
  const a = this.popoverEl.offsetHeight;
3802
3830
  let l = e.right + 8, r = e.top;
3803
- const p = s - e.right, h = e.left, d = i + o;
3804
- p < d && h > p + 100 && (l = e.left - i - 8);
3805
- const u = n - e.bottom, g = e.top;
3806
- g >= a + o ? r = e.top - a - 8 : u >= a + o ? r = e.bottom + 8 : g > u ? (r = e.top - a - 8, r < o && (r = o)) : (r = e.bottom + 8, r + a > n - o && (r = n - a - o)), this.popoverEl.style.left = `${l}px`, this.popoverEl.style.top = `${r}px`;
3831
+ const h = s - e.right, d = e.left, p = i + o;
3832
+ h < p && d > h + 100 && (l = e.left - i - 8);
3833
+ const g = n - e.bottom, v = e.top;
3834
+ v >= a + o ? r = e.top - a - 8 : g >= a + o ? r = e.bottom + 8 : v > g ? (r = e.top - a - 8, r < o && (r = o)) : (r = e.bottom + 8, r + a > n - o && (r = n - a - o)), this.popoverEl.style.left = `${l}px`, this.popoverEl.style.top = `${r}px`;
3807
3835
  });
3808
3836
  }
3809
3837
  }
@@ -3824,7 +3852,7 @@ const H = class H extends x {
3824
3852
  const e = O(this.value);
3825
3853
  D.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
3826
3854
  }
3827
- this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), H.openInstance === this && (H.openInstance = null);
3855
+ this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), $.openInstance === this && ($.openInstance = null);
3828
3856
  }
3829
3857
  }
3830
3858
  commitPendingSolidColor() {
@@ -3841,8 +3869,10 @@ const H = class H extends x {
3841
3869
  this.parseAndSet(e.value);
3842
3870
  }
3843
3871
  parseAndSet(t) {
3844
- const e = N(t.trim());
3845
- e && this.setValue(e);
3872
+ let e = t.trim();
3873
+ e && !e.startsWith("#") && !e.startsWith("var(") && !e.startsWith("rgb") && !e.startsWith("hsl") && !e.includes("gradient") && /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$|^[0-9A-Fa-f]{8}$/.test(e) && (e = "#" + e, this.inputEl && (this.inputEl.value = e));
3874
+ const i = I(e);
3875
+ i && this.setValue(i);
3846
3876
  }
3847
3877
  getChangePayload() {
3848
3878
  var t;
@@ -3874,8 +3904,8 @@ const H = class H extends x {
3874
3904
  return this.value;
3875
3905
  }
3876
3906
  };
3877
- H.openInstance = null;
3878
- let K = H;
3907
+ $.openInstance = null;
3908
+ let K = $;
3879
3909
  const se = `
3880
3910
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
3881
3911
  <path d="M5.625 9.5H5.6325M12.375 9.5H12.3825M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 6.35L2.25 12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75L5.85 2.75C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
@@ -4030,8 +4060,8 @@ class q extends x {
4030
4060
  const t = this.value === "auto" ? "text" : "number", e = (a) => {
4031
4061
  this.value !== "auto" && (this.props.minValue !== void 0 && (a.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (a.max = String(this.props.maxValue)), this.props.className && a.classList.add(this.props.className), a.addEventListener("input", () => {
4032
4062
  const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, r = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
4033
- let p = Number(a.value);
4034
- p < l && (p = l), p > r && (p = r), a.value = String(p);
4063
+ let h = Number(a.value);
4064
+ h < l && (h = l), h > r && (h = r), a.value = String(h);
4035
4065
  }));
4036
4066
  }, i = this.createInput({
4037
4067
  value: this.value,
@@ -4127,7 +4157,7 @@ class Se extends T {
4127
4157
  ...t == null ? void 0 : t.uploadProps,
4128
4158
  default: (t == null ? void 0 : t.backgroundImage) ?? ""
4129
4159
  }),
4130
- opacity: new It({
4160
+ opacity: new Vt({
4131
4161
  default: (t == null ? void 0 : t.opacity) ?? 100
4132
4162
  }),
4133
4163
  backgroundColor: new F({
@@ -4156,7 +4186,7 @@ class Se extends T {
4156
4186
  `;
4157
4187
  }
4158
4188
  }
4159
- class Ne extends T {
4189
+ class Ie extends T {
4160
4190
  constructor(t) {
4161
4191
  super({
4162
4192
  title: (t == null ? void 0 : t.title) ?? "Image",
@@ -4184,7 +4214,7 @@ export {
4184
4214
  Se as BackgroundSettingSet,
4185
4215
  Le as BorderSettingSet,
4186
4216
  me as ButtonSetting,
4187
- I as ColorSetting,
4217
+ V as ColorSetting,
4188
4218
  F as ColorWithOpacitySetting,
4189
4219
  fe as DimensionSetting,
4190
4220
  ye as GapSetting,
@@ -4192,13 +4222,13 @@ export {
4192
4222
  ke as HeaderTypographySettingSet,
4193
4223
  Gt as HeightSetting,
4194
4224
  ge as HtmlSetting,
4195
- Ne as ImageSettingSet,
4225
+ Ie as ImageSettingSet,
4196
4226
  be as MarginBottomSetting,
4197
4227
  Me as MarginSettingGroup,
4198
4228
  Ee as MarginTopSetting,
4199
4229
  we as MultiLanguageSetting,
4200
4230
  P as NumberSetting,
4201
- It as OpacitySetting,
4231
+ Vt as OpacitySetting,
4202
4232
  ve as SelectApiSettings,
4203
4233
  et as SelectSetting,
4204
4234
  x as Setting,