builder-settings-types 0.0.302 → 0.0.303

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.
@@ -142,15 +142,15 @@ function Ct(c) {
142
142
  return "";
143
143
  }
144
144
  }
145
- class b {
145
+ class w {
146
146
  constructor(t = {}) {
147
147
  this.props = t, this.dataPropsPath = "", this.id = t.id || lt(), this.value = this.props.default, this.desktop = this.props.default, this.title = t.title || "", this.includeGetJson = t.includeGetJson !== void 0 ? t.includeGetJson : !0;
148
148
  }
149
149
  static SetUploadUrl(t) {
150
- globalThis.DefaultUploadUrl = t, b.DefaultUploadUrl = t;
150
+ globalThis.DefaultUploadUrl = t, w.DefaultUploadUrl = t;
151
151
  }
152
152
  static SetDefaultLanguage(t) {
153
- globalThis.DefaultLanguage = t, b.DefaultLanguage = t;
153
+ globalThis.DefaultLanguage = t, w.DefaultLanguage = t;
154
154
  }
155
155
  destroy() {
156
156
  throw new Error("Method not implemented.");
@@ -233,14 +233,14 @@ class b {
233
233
  return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
234
234
  }
235
235
  }
236
- function D(c) {
237
- return c instanceof b;
236
+ function O(c) {
237
+ return c instanceof w;
238
238
  }
239
- function w(c) {
239
+ function b(c) {
240
240
  return c instanceof T;
241
241
  }
242
242
  function st(c) {
243
- return D(c) || w(c);
243
+ return O(c) || b(c);
244
244
  }
245
245
  function W(c, t) {
246
246
  for (const e in c)
@@ -257,7 +257,7 @@ const K = class K {
257
257
  propagateNestingLevel() {
258
258
  const t = this.nestingLevel + 1;
259
259
  W(this.settings, (e, i) => {
260
- w(i) && (i.nestingLevel = t, i.propagateNestingLevel());
260
+ b(i) && (i.nestingLevel = t, i.propagateNestingLevel());
261
261
  });
262
262
  }
263
263
  getNestingLevel() {
@@ -275,7 +275,7 @@ const K = class K {
275
275
  propagateDataPropsPath() {
276
276
  W(this.settings, (t, e) => {
277
277
  const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
278
- (w(e) || D(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
278
+ (b(e) || O(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
279
279
  });
280
280
  }
281
281
  updateNestingStyles() {
@@ -284,7 +284,7 @@ const K = class K {
284
284
  forceChildUIRefresh() {
285
285
  Object.entries(this.settings).forEach(([t, e]) => {
286
286
  try {
287
- if (w(e)) {
287
+ if (b(e)) {
288
288
  const i = e.getValues();
289
289
  e.setValue(i);
290
290
  } else if (typeof e.setValue == "function") {
@@ -308,7 +308,9 @@ const K = class K {
308
308
  );
309
309
  if (n) {
310
310
  const o = Array.from(
311
- n.querySelectorAll(".setting-group, .setting, [data-setting-id]")
311
+ n.querySelectorAll(
312
+ ".setting-group, .setting, [data-setting-id]"
313
+ )
312
314
  );
313
315
  for (const a of o) {
314
316
  const l = a.id, r = a.getAttribute(
@@ -333,16 +335,29 @@ const K = class K {
333
335
  this.elementRef;
334
336
  }
335
337
  updateSettings(t) {
336
- var n;
337
- const e = new Set(Object.keys(this.settings)), i = Object.keys(t);
338
- e.forEach((o) => {
339
- i.includes(o) || this.removeSetting(o);
340
- }), i.forEach((o) => {
341
- const a = t[o], l = this.settings[o];
342
- l !== a && (l && this.removeSetting(o), this.addSetting(o, a));
338
+ var o;
339
+ const e = new Set(Object.keys(this.settings)), i = Object.keys(t), s = {};
340
+ i.forEach((a) => {
341
+ const l = this.settings[a];
342
+ l && (b(l) ? s[a] = l.getValues() : O(l) ? s[a] = l.value : typeof l.getValues == "function" ? s[a] = l.getValues() : l.value !== void 0 && (s[a] = l.value));
343
+ }), e.forEach((a) => {
344
+ i.includes(a) || this.removeSetting(a);
345
+ }), i.forEach((a) => {
346
+ var h;
347
+ const l = t[a], r = this.settings[a];
348
+ if (r !== l && (r && this.removeSetting(a), this.addSetting(a, l), a in s)) {
349
+ const p = s[a];
350
+ try {
351
+ b(l) ? l.setValue(
352
+ p
353
+ ) : O(l) ? (h = l.setValue) == null || h.call(l, p) : l.setValue && l.setValue(p);
354
+ } catch (d) {
355
+ console.warn(`Could not preserve value for setting ${a}:`, d);
356
+ }
357
+ }
343
358
  }), this.settings = t, this.propagateNestingLevel(), this.propagateDataPropsPath();
344
- const s = this.getValues();
345
- this.initialValues = s, (n = this.onChange) == null || n.call(this, s);
359
+ const n = this.getValues();
360
+ this.initialValues = n, (o = this.onChange) == null || o.call(this, n);
346
361
  }
347
362
  clone() {
348
363
  const t = {};
@@ -373,7 +388,7 @@ const K = class K {
373
388
  setMobileValues(t) {
374
389
  !t || typeof t != "object" || (Object.entries(t).forEach(([e, i]) => {
375
390
  const s = this.settings[e];
376
- s && (w(s) || D(s)) && typeof s.setMobileValue == "function" && s.setMobileValue(i);
391
+ s && (b(s) || O(s)) && typeof s.setMobileValue == "function" && s.setMobileValue(i);
377
392
  }), this.setValue(t), this.onChange && this.onChange(this.getValues()));
378
393
  }
379
394
  getMobileValues(t) {
@@ -382,7 +397,7 @@ const K = class K {
382
397
  for (const i in this.settings)
383
398
  if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
384
399
  const s = this.settings[i];
385
- if (w(s))
400
+ if (b(s))
386
401
  e[i] = s.getMobileValues();
387
402
  else {
388
403
  const n = s;
@@ -393,7 +408,7 @@ const K = class K {
393
408
  } else {
394
409
  const e = this.settings[t];
395
410
  if (!e) return;
396
- if (w(e)) return e.getMobileValues();
411
+ if (b(e)) return e.getMobileValues();
397
412
  const i = e;
398
413
  return i.mobileValue !== void 0 ? i.mobileValue : i.value;
399
414
  }
@@ -411,12 +426,12 @@ const K = class K {
411
426
  };
412
427
  return this.changeHandlers.clear(), W(this.settings, (i, s) => {
413
428
  var n;
414
- if (w(s))
429
+ if (b(s))
415
430
  s.setOnChange(() => {
416
431
  const o = this.getValues();
417
432
  this.initialValues = o, t(o);
418
433
  }), this.changeHandlers.add(() => t(this.getValues()));
419
- else if (D(s)) {
434
+ else if (O(s)) {
420
435
  const o = () => e();
421
436
  this.changeHandlers.add(o), s.setOnChange(o);
422
437
  } else {
@@ -442,7 +457,7 @@ const K = class K {
442
457
  st(l) && (this.addSetting(i, l), n = l);
443
458
  }
444
459
  }
445
- n && (w(n) || D(n)) && typeof n.setValue == "function" && n.setValue(s);
460
+ n && (b(n) || O(n)) && typeof n.setValue == "function" && n.setValue(s);
446
461
  }), setTimeout(() => {
447
462
  this.forceChildUIRefresh();
448
463
  }, 0);
@@ -456,7 +471,7 @@ const K = class K {
456
471
  const s = this.getValues();
457
472
  this.initialValues = s, (n = this.onChange) == null || n.call(this, s), this.updateVisibility();
458
473
  };
459
- w(t) ? t.setOnChange(() => e()) : D(t) ? t.setOnChange(() => e()) : (i = t.setOnChange) == null || i.call(t, () => e());
474
+ b(t) ? t.setOnChange(() => e()) : O(t) ? t.setOnChange(() => e()) : (i = t.setOnChange) == null || i.call(t, () => e());
460
475
  }
461
476
  addSetting(t, e) {
462
477
  var s, n;
@@ -465,7 +480,7 @@ const K = class K {
465
480
  ".setting-group-content"
466
481
  );
467
482
  if (o) {
468
- w(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
483
+ b(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
469
484
  const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
470
485
  if (l) {
471
486
  const p = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
@@ -655,7 +670,7 @@ const K = class K {
655
670
  for (const i in this.settings)
656
671
  if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
657
672
  const s = this.settings[i];
658
- if (w(s))
673
+ if (b(s))
659
674
  e[i] = s.getValues();
660
675
  else {
661
676
  const n = s;
@@ -666,7 +681,7 @@ const K = class K {
666
681
  } else {
667
682
  const e = this.settings[t];
668
683
  if (!e) return;
669
- if (w(e)) return e.getValues();
684
+ if (b(e)) return e.getValues();
670
685
  const i = e;
671
686
  return i.getValue ? i.getValue() : i.value;
672
687
  }
@@ -679,7 +694,7 @@ const K = class K {
679
694
  for (const s in this.settings)
680
695
  if (Object.prototype.hasOwnProperty.call(this.settings, s)) {
681
696
  const n = this.settings[s];
682
- if (w(n)) {
697
+ if (b(n)) {
683
698
  const o = n.getValuesForJson();
684
699
  o !== null && (i[s] = o);
685
700
  } else {
@@ -691,7 +706,7 @@ const K = class K {
691
706
  } else {
692
707
  const i = this.settings[t];
693
708
  if (!i) return;
694
- if (w(i))
709
+ if (b(i))
695
710
  return i.includeGetJson === !1 ? null : i.getValuesForJson();
696
711
  {
697
712
  const s = i;
@@ -705,7 +720,7 @@ const K = class K {
705
720
  for (const i in this.settings)
706
721
  if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
707
722
  const s = this.settings[i];
708
- if (w(s))
723
+ if (b(s))
709
724
  e[i] = s.getDefaultValues();
710
725
  else {
711
726
  const n = s;
@@ -716,7 +731,7 @@ const K = class K {
716
731
  } else {
717
732
  const e = this.settings[t];
718
733
  if (!e) return;
719
- if (w(e)) return e.getDefaultValues();
734
+ if (b(e)) return e.getDefaultValues();
720
735
  const i = e;
721
736
  return i.default !== void 0 ? i.default : i.value;
722
737
  }
@@ -755,9 +770,9 @@ const K = class K {
755
770
  for (const h in this.settings)
756
771
  if (Object.prototype.hasOwnProperty.call(this.settings, h)) {
757
772
  const p = this.settings[h];
758
- w(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.nestingLevel + 1);
773
+ b(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.nestingLevel + 1);
759
774
  const d = p.draw();
760
- w(p) && p.deleteItemCfg && this.addDeleteButtonToElement(
775
+ b(p) && p.deleteItemCfg && this.addDeleteButtonToElement(
761
776
  d,
762
777
  h,
763
778
  p
@@ -873,7 +888,7 @@ class yt extends T {
873
888
  const h = document.createElement("div");
874
889
  h.className = "tab-panel", this.contentContainers[a] = h;
875
890
  const p = this.settings[a];
876
- p && (w(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.getNestingLevel() + 1), h.appendChild(
891
+ p && (b(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.getNestingLevel() + 1), h.appendChild(
877
892
  p.draw()
878
893
  )), o.appendChild(h), l === 0 && !this.activeTabId && (this.activeTabId = a);
879
894
  }), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
@@ -889,7 +904,7 @@ function Et(c) {
889
904
  function ae(c) {
890
905
  return c;
891
906
  }
892
- class bt extends b {
907
+ class bt extends w {
893
908
  constructor(t = {}) {
894
909
  super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
895
910
  }
@@ -1019,7 +1034,7 @@ const xt = `
1019
1034
  <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"/>
1020
1035
  <path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
1021
1036
  </svg>`;
1022
- class R extends b {
1037
+ class R extends w {
1023
1038
  constructor(t = {}) {
1024
1039
  super({
1025
1040
  ...t,
@@ -1141,7 +1156,7 @@ class R extends b {
1141
1156
  };
1142
1157
  }
1143
1158
  }
1144
- class le extends b {
1159
+ class le extends w {
1145
1160
  constructor(t = {}) {
1146
1161
  super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
1147
1162
  }
@@ -1173,7 +1188,7 @@ class le extends b {
1173
1188
  return e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("blur", s), t.appendChild(e), t;
1174
1189
  }
1175
1190
  }
1176
- class S extends b {
1191
+ class S extends w {
1177
1192
  constructor(t) {
1178
1193
  super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
1179
1194
  }
@@ -1263,7 +1278,7 @@ const Mt = `
1263
1278
  <polyline points="6 9 12 15 18 9"></polyline>
1264
1279
  </svg>
1265
1280
  `;
1266
- class tt extends b {
1281
+ class tt extends w {
1267
1282
  constructor(t = {}) {
1268
1283
  if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.clickOutsideListener = null, this.resizeListener = null, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && (this.isLoading = !0), this.value !== void 0) {
1269
1284
  const e = this._options.findIndex((i) => i.value === this.value);
@@ -1370,7 +1385,7 @@ class tt extends b {
1370
1385
  this.clickOutsideListener && (document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = null), this.resizeListener && (window.removeEventListener("resize", this.resizeListener), this.resizeListener = null), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.parentNode && this.optionsListEl.parentNode.removeChild(this.optionsListEl), super.destroy();
1371
1386
  }
1372
1387
  }
1373
- class St extends b {
1388
+ class St extends w {
1374
1389
  constructor(t = {}) {
1375
1390
  super(t), this.inputType = "button", this.value || (this.value = "center");
1376
1391
  }
@@ -1426,7 +1441,7 @@ class St extends b {
1426
1441
  }), t.appendChild(i), t;
1427
1442
  }
1428
1443
  }
1429
- class re extends b {
1444
+ class re extends w {
1430
1445
  constructor(t) {
1431
1446
  super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
1432
1447
  }
@@ -1455,7 +1470,7 @@ class re extends b {
1455
1470
  return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
1456
1471
  }
1457
1472
  }
1458
- class ce extends b {
1473
+ class ce extends w {
1459
1474
  constructor(t = {}) {
1460
1475
  super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
1461
1476
  const e = t.width || 0, i = t.height || 0;
@@ -1606,7 +1621,7 @@ const It = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
1606
1621
  <circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
1607
1622
  </svg>
1608
1623
  `;
1609
- class rt extends b {
1624
+ class rt extends w {
1610
1625
  constructor(t = {}) {
1611
1626
  super(t), this.inputType = "button", this.previewWrapper = null, this.previewEl = null, this.emptyStateEl = null, this.errorContainer = null, this.messageListener = null, this.loadingSpinner = null, this.props.delete === void 0 && (this.props.delete = !0), this.props.maxFileSizeMB === void 0 && (this.props.maxFileSizeMB = 5), !this.value && t.defaultUrl && t.defaultUrl !== "" && (this.value = t.defaultUrl), this.setupMessageListener();
1612
1627
  }
@@ -1772,7 +1787,7 @@ const Ht = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
1772
1787
  <polyline points="6 9 12 15 18 9"></polyline>
1773
1788
  </svg>
1774
1789
  `;
1775
- class de extends b {
1790
+ class de extends w {
1776
1791
  constructor(t = {}) {
1777
1792
  if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.hasInitializedOptions = !1, this.selectedOptionIndex = null, t.default !== void 0 && (this.value = t.default), this.initializeOptions(t), !t.getOptionsAsync && this.value !== void 0) {
1778
1793
  const e = this._options.findIndex(
@@ -1921,7 +1936,7 @@ class de extends b {
1921
1936
  ), this.updateButtonText(), this.updateOptionsList(), this.detectChangeCallback && this.detectChangeCallback !== this.props.detectChange && this.detectChangeCallback(t);
1922
1937
  }
1923
1938
  }
1924
- class ue extends b {
1939
+ class ue extends w {
1925
1940
  constructor(t) {
1926
1941
  var e, i;
1927
1942
  super(t), this.inputType = "text", this.value = t.default ?? ((i = (e = t.options) == null ? void 0 : e[0]) == null ? void 0 : i.value) ?? "", this.detectChangeCallback = t.detectChange;
@@ -1974,7 +1989,7 @@ class ue extends b {
1974
1989
  const At = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1975
1990
  <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"/>
1976
1991
  </svg>`;
1977
- class ge extends b {
1992
+ class ge extends w {
1978
1993
  // Store mobile value
1979
1994
  constructor(t = {}) {
1980
1995
  t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? At, 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);
@@ -2061,9 +2076,9 @@ class fe extends S {
2061
2076
  }), this.inputType = "number";
2062
2077
  }
2063
2078
  }
2064
- class ve extends b {
2079
+ class ve extends w {
2065
2080
  constructor(t) {
2066
- super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), t.default ? this.value = { ...t.default } : this.value || (this.value = {}), this.defaultLanguage = t.languages.includes(b.DefaultLanguage) ? b.DefaultLanguage : t.languages[0];
2081
+ super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), t.default ? this.value = { ...t.default } : this.value || (this.value = {}), this.defaultLanguage = t.languages.includes(w.DefaultLanguage) ? w.DefaultLanguage : t.languages[0];
2067
2082
  const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
2068
2083
  t.languages.forEach((i) => {
2069
2084
  var s, n;
@@ -2208,7 +2223,7 @@ class ve extends b {
2208
2223
  });
2209
2224
  }
2210
2225
  }
2211
- class Ce extends b {
2226
+ class Ce extends w {
2212
2227
  constructor(t = {}) {
2213
2228
  super(t), this.inputType = "select";
2214
2229
  const e = [
@@ -2251,7 +2266,7 @@ const ct = (c, t, e) => {
2251
2266
  i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", h), document.body.style.userSelect = "";
2252
2267
  };
2253
2268
  c.addEventListener("mousedown", l);
2254
- }, A = (c) => {
2269
+ }, B = (c) => {
2255
2270
  if (!c) return null;
2256
2271
  let t = c.trim();
2257
2272
  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()}`;
@@ -2262,7 +2277,7 @@ const ct = (c, t, e) => {
2262
2277
  g: parseInt(e.slice(2, 4), 16),
2263
2278
  b: parseInt(e.slice(4, 6), 16)
2264
2279
  };
2265
- }, H = (c) => {
2280
+ }, $ = (c) => {
2266
2281
  const { r: t, g: e, b: i } = k(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;
2267
2282
  let h = 0;
2268
2283
  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);
@@ -2319,7 +2334,7 @@ const ct = (c, t, e) => {
2319
2334
  return `rgba(${n}, ${o}, ${a}, ${e})`;
2320
2335
  }
2321
2336
  }
2322
- const i = A(c);
2337
+ const i = B(c);
2323
2338
  if (i) {
2324
2339
  const { r: s, g: n, b: o } = k(i);
2325
2340
  return `rgba(${s}, ${n}, ${o}, ${e})`;
@@ -2356,7 +2371,7 @@ const ct = (c, t, e) => {
2356
2371
  /^[a-zA-Z]+$/
2357
2372
  ].some((e) => e.test(c.trim())), Ut = (c) => {
2358
2373
  if (typeof document > "u")
2359
- return pt(c) || !!A(c);
2374
+ return pt(c) || !!B(c);
2360
2375
  const t = document.createElement("div");
2361
2376
  return t.style.color = c, t.style.color !== "";
2362
2377
  }, dt = (c) => {
@@ -2395,7 +2410,7 @@ const ct = (c, t, e) => {
2395
2410
  opacity: Math.round(l * 100)
2396
2411
  };
2397
2412
  }
2398
- return { color: A(t) || t, position: 0, opacity: 100 };
2413
+ return { color: B(t) || t, position: 0, opacity: 100 };
2399
2414
  }, nt = (c) => {
2400
2415
  const t = [];
2401
2416
  let e = "", i = 0;
@@ -2442,7 +2457,7 @@ const ct = (c, t, e) => {
2442
2457
  const l = dt(n);
2443
2458
  l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
2444
2459
  }), t;
2445
- }, $ = (c) => {
2460
+ }, A = (c) => {
2446
2461
  const t = c.stops && c.stops.length ? c.stops : [{ color: "#000000", position: 0, opacity: 100 }];
2447
2462
  return {
2448
2463
  type: c.type && ["linear", "radial", "solid"].includes(c.type) ? c.type : "linear",
@@ -2453,11 +2468,11 @@ const ct = (c, t, e) => {
2453
2468
  opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
2454
2469
  }))
2455
2470
  };
2456
- }, O = (c) => {
2471
+ }, P = (c) => {
2457
2472
  const t = c.replace(/;$/, "").trim();
2458
2473
  if (Ut(t)) {
2459
2474
  const s = dt(t);
2460
- return $({ type: "solid", angle: 0, stops: [s] });
2475
+ return A({ type: "solid", angle: 0, stops: [s] });
2461
2476
  }
2462
2477
  const e = ot(t, "linear-gradient");
2463
2478
  if (e) {
@@ -2478,12 +2493,12 @@ const ct = (c, t, e) => {
2478
2493
  "to top left": 315
2479
2494
  }[a] ?? 90, o = s.slice(1));
2480
2495
  const l = at(o);
2481
- return l.length ? $({ type: "linear", angle: n, stops: l }) : null;
2496
+ return l.length ? A({ type: "linear", angle: n, stops: l }) : null;
2482
2497
  }
2483
2498
  const i = ot(t, "radial-gradient");
2484
2499
  if (i) {
2485
2500
  const s = nt(i), n = s[0] && !Gt(s[0]) ? s.slice(1) : s, o = at(n);
2486
- return o.length ? $({ type: "radial", angle: 0, stops: o }) : null;
2501
+ return o.length ? A({ type: "radial", angle: 0, stops: o }) : null;
2487
2502
  }
2488
2503
  return null;
2489
2504
  }, N = (c) => {
@@ -2520,8 +2535,8 @@ const ct = (c, t, e) => {
2520
2535
  static normalizeList(t) {
2521
2536
  const e = /* @__PURE__ */ new Set(), i = [];
2522
2537
  return t.forEach((s) => {
2523
- let n = A(s);
2524
- n || O(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
2538
+ let n = B(s);
2539
+ n || P(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
2525
2540
  }), i.slice(0, this.MAX_COLORS);
2526
2541
  }
2527
2542
  static ensureLoaded() {
@@ -2564,11 +2579,11 @@ const ct = (c, t, e) => {
2564
2579
  }
2565
2580
  static addColor(t, e) {
2566
2581
  if (!t) return;
2567
- let i = A(t), s = "solid";
2582
+ let i = B(t), s = "solid";
2568
2583
  if (i)
2569
2584
  s = "solid";
2570
2585
  else {
2571
- const l = O(t);
2586
+ const l = P(t);
2572
2587
  l && (i = t, s = l.type === "solid" ? "solid" : "gradient");
2573
2588
  }
2574
2589
  if (!i) return;
@@ -2577,7 +2592,7 @@ const ct = (c, t, e) => {
2577
2592
  }
2578
2593
  };
2579
2594
  z.STORAGE_KEY = "settingsLib_recentColors", z.MAX_COLORS = 12, z.colors = null;
2580
- let B = z;
2595
+ let D = z;
2581
2596
  const et = (c, t) => {
2582
2597
  const e = document.createElement("div");
2583
2598
  e.className = "color-picker-recent-section";
@@ -2589,7 +2604,7 @@ const et = (c, t) => {
2589
2604
  n.className = "color-picker-recent-placeholder", n.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(s), e.appendChild(n);
2590
2605
  const o = () => {
2591
2606
  s.innerHTML = "";
2592
- const a = B.getColors(t);
2607
+ const a = D.getColors(t);
2593
2608
  if (a.length === 0) {
2594
2609
  s.style.display = "none", n.style.display = "block";
2595
2610
  return;
@@ -2618,10 +2633,10 @@ const et = (c, t) => {
2618
2633
  };
2619
2634
  return o(), { container: e, refresh: o };
2620
2635
  }, Wt = (c) => {
2621
- const t = O(c);
2636
+ const t = P(c);
2622
2637
  if (t)
2623
2638
  return _(t);
2624
- const e = A(c);
2639
+ const e = B(c);
2625
2640
  if (e) {
2626
2641
  const i = k(e);
2627
2642
  return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
@@ -2708,10 +2723,10 @@ class Jt {
2708
2723
  L.value = "hsl", L.textContent = "HSL", g.appendChild(C), g.appendChild(y), g.appendChild(L);
2709
2724
  const I = document.createElement("input");
2710
2725
  I.type = "text", I.className = "color-picker-color-input", I.value = this.currentColor, this.input = I;
2711
- const P = document.createElement("div");
2712
- P.className = "color-picker-input-container";
2726
+ const H = document.createElement("div");
2727
+ H.className = "color-picker-input-container";
2713
2728
  const v = document.createElement("button");
2714
- return v.className = "color-picker-copy-inside", v.textContent = "Copy", P.appendChild(I), P.appendChild(v), f.appendChild(g), f.appendChild(P), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(m.container), t.appendChild(f), t.addEventListener("click", (E) => E.stopPropagation()), this.bind(n, h, d, I, g, v, l), t;
2729
+ return v.className = "color-picker-copy-inside", v.textContent = "Copy", H.appendChild(I), H.appendChild(v), f.appendChild(g), f.appendChild(H), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(m.container), t.appendChild(f), t.addEventListener("click", (E) => E.stopPropagation()), this.bind(n, h, d, I, g, v, l), t;
2715
2730
  }
2716
2731
  createBackdrop() {
2717
2732
  const t = document.createElement("div");
@@ -2783,11 +2798,11 @@ class Jt {
2783
2798
  setColor(t) {
2784
2799
  var o;
2785
2800
  this.currentColor = t;
2786
- const { h: e, s: i, v: s } = H(t), n = e >= 360 ? e % 360 : e;
2801
+ const { h: e, s: i, v: s } = $(t), n = e >= 360 ? e % 360 : e;
2787
2802
  this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (o = this.onChange) == null || o.call(this, t, this.currentOpacity);
2788
2803
  }
2789
2804
  syncInput() {
2790
- const t = this.select.value, { h: e, s: i, v: s } = H(this.currentColor);
2805
+ const t = this.select.value, { h: e, s: i, v: s } = $(this.currentColor);
2791
2806
  if (t === "hex") this.input.value = this.currentColor;
2792
2807
  else if (t === "rgb") {
2793
2808
  const { r: n, g: o, b: a } = k(this.currentColor);
@@ -2828,7 +2843,7 @@ class Jt {
2828
2843
  open(t, e, i) {
2829
2844
  var L;
2830
2845
  this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
2831
- const { h: s, s: n, v: o } = H(t);
2846
+ const { h: s, s: n, v: o } = $(t);
2832
2847
  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}%`, (L = this.recentSectionRefresh) == null || L.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);
2833
2848
  const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), h = window.innerWidth, p = window.innerHeight, d = 16;
2834
2849
  let u = r.right + 8, m = r.top;
@@ -2839,7 +2854,7 @@ class Jt {
2839
2854
  }
2840
2855
  close(t) {
2841
2856
  var e;
2842
- this.isOpen && (this.isOpen = !1, this.backdrop.style.display = "none", this.element.style.display = "none", document.removeEventListener("click", this.outsideClick, !0), document.removeEventListener("keydown", this.keyDown, !0), t && this.onChange && this.recentScope === "solid" && (B.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
2857
+ this.isOpen && (this.isOpen = !1, this.backdrop.style.display = "none", this.element.style.display = "none", document.removeEventListener("click", this.outsideClick, !0), document.removeEventListener("keydown", this.keyDown, !0), t && this.onChange && this.recentScope === "solid" && (D.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
2843
2858
  }
2844
2859
  getElement() {
2845
2860
  return this.element;
@@ -2907,7 +2922,7 @@ class Xt {
2907
2922
  );
2908
2923
  const t = this.container.querySelector(
2909
2924
  ".color-picker-copy-inside"
2910
- ), { h: e, s: i, v: s } = H(this.currentColor);
2925
+ ), { h: e, s: i, v: s } = $(this.currentColor);
2911
2926
  this.hueMarker.style.left = `${e / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${e}, 100%, 50%))`, this.opacityMarker.style.left = `${this.currentOpacity}%`, this.updateOpacityBackground(this.opacitySlider), this.updateColorInput(this.formatSelect, this.colorInput), this.setupColorAreaEvents(), this.setupHueSliderEvents(), this.setupOpacitySliderEvents(), this.setupFormatEvents(t);
2912
2927
  }
2913
2928
  scheduleInputUpdate() {
@@ -2932,7 +2947,7 @@ class Xt {
2932
2947
  e.value = `rgb(${s.r}, ${s.g}, ${s.b})`;
2933
2948
  break;
2934
2949
  case "hsl":
2935
- const { h: n, s: o, v: a } = H(this.currentColor), l = a * (1 - o / 2), r = l === 0 || l === 1 ? 0 : (a - l) / Math.min(l, 1 - l);
2950
+ const { h: n, s: o, v: a } = $(this.currentColor), l = a * (1 - o / 2), r = l === 0 || l === 1 ? 0 : (a - l) / Math.min(l, 1 - l);
2936
2951
  e.value = `hsl(${Math.round(n)}, ${Math.round(
2937
2952
  r * 100
2938
2953
  )}%, ${Math.round(l * 100)}%)`;
@@ -2944,7 +2959,7 @@ class Xt {
2944
2959
  }
2945
2960
  commitRecentColor() {
2946
2961
  var t;
2947
- B.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this);
2962
+ D.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this);
2948
2963
  }
2949
2964
  setupColorAreaEvents() {
2950
2965
  const t = (e) => {
@@ -3031,7 +3046,7 @@ class Xt {
3031
3046
  }
3032
3047
  parseHexInput(t) {
3033
3048
  const e = t.startsWith("#") ? t : `#${t}`;
3034
- return A(e);
3049
+ return B(e);
3035
3050
  }
3036
3051
  parseRgbInput(t) {
3037
3052
  const e = t.match(
@@ -3066,7 +3081,7 @@ class Xt {
3066
3081
  return s || null;
3067
3082
  }
3068
3083
  updatePickerVisualState() {
3069
- const { h: t, s: e, v: i } = H(this.currentColor);
3084
+ const { h: t, s: e, v: i } = $(this.currentColor);
3070
3085
  this.hueMarker.style.left = `${t / 360 * 100}%`, this.colorMarker.style.left = `${e * 100}%`, this.colorMarker.style.top = `${(1 - i) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${t}, 100%, 50%))`, this.updateOpacityBackground(this.opacitySlider);
3071
3086
  }
3072
3087
  triggerChange() {
@@ -3077,11 +3092,11 @@ class Xt {
3077
3092
  }
3078
3093
  updateColor(t, e) {
3079
3094
  this.currentColor = t, this.currentOpacity = e;
3080
- const { h: i, s, v: n } = H(t), o = i >= 360 ? i % 360 : i;
3095
+ const { h: i, s, v: n } = $(t), o = i >= 360 ? i % 360 : i;
3081
3096
  this.hueMarker.style.left = `${o / 360 * 100}%`, this.colorMarker.style.left = `${s * 100}%`, this.colorMarker.style.top = `${(1 - n) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${o}, 100%, 50%))`, this.opacityMarker.style.left = `${e}%`, this.updateOpacityBackground(this.opacitySlider), this.updateColorInput(this.formatSelect, this.colorInput);
3082
3097
  }
3083
3098
  }
3084
- const V = class V extends b {
3099
+ const V = class V extends w {
3085
3100
  constructor(t = {}) {
3086
3101
  const e = typeof t.default == "string" ? void 0 : t.default;
3087
3102
  super({
@@ -3121,11 +3136,11 @@ const V = class V extends b {
3121
3136
  defaultValue() {
3122
3137
  const t = this.originalDefault;
3123
3138
  if (typeof t == "string") {
3124
- const i = O(t);
3139
+ const i = P(t);
3125
3140
  if (i)
3126
- return $(i);
3141
+ return A(i);
3127
3142
  }
3128
- return $(t && typeof t == "object" ? t : {
3143
+ return A(t && typeof t == "object" ? t : {
3129
3144
  type: "linear",
3130
3145
  angle: 90,
3131
3146
  stops: [
@@ -3137,7 +3152,7 @@ const V = class V extends b {
3137
3152
  setValue(t) {
3138
3153
  var i, s;
3139
3154
  let e = null;
3140
- typeof t == "string" ? e = O(t) : t && typeof t == "object" && (e = $(t)), e || (e = this.defaultValue()), this.value = e, this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent(), (i = this.onChange) == null || i.call(this, this.value), (s = this.detectChange) == null || s.call(this, this.value), this.pendingSolidColor = null;
3155
+ typeof t == "string" ? e = P(t) : t && typeof t == "object" && (e = A(t)), e || (e = this.defaultValue()), this.value = e, this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent(), (i = this.onChange) == null || i.call(this, this.value), (s = this.detectChange) == null || s.call(this, this.value), this.pendingSolidColor = null;
3141
3156
  }
3142
3157
  updateUI() {
3143
3158
  if (this.previewEl && this.value)
@@ -3252,7 +3267,7 @@ const V = class V extends b {
3252
3267
  initialOpacity: e.opacity ?? 100,
3253
3268
  onColorChange: (s, n) => {
3254
3269
  if (this.value) {
3255
- const o = O(s);
3270
+ const o = P(s);
3256
3271
  if (o && o.type !== "solid") {
3257
3272
  this.value = o, this.switchType(o.type);
3258
3273
  return;
@@ -3308,7 +3323,7 @@ const V = class V extends b {
3308
3323
  const u = document.createElement("div");
3309
3324
  u.className = "gradient-stops", t.appendChild(h), t.appendChild(u), this.updateStopsList(u);
3310
3325
  const m = et((f) => {
3311
- const g = O(f);
3326
+ const g = P(f);
3312
3327
  g && (this.value = g, this.switchType(g.type), this.updateUI(), this.triggerChange());
3313
3328
  }, "all");
3314
3329
  this.recentGradientRefresh = m.refresh, t.appendChild(m.container), d.addEventListener("click", () => {
@@ -3354,7 +3369,7 @@ const V = class V extends b {
3354
3369
  var i;
3355
3370
  const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-stops"));
3356
3371
  !e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
3357
- var I, P;
3372
+ var I, H;
3358
3373
  const o = document.createElement("div");
3359
3374
  o.className = "gstop-row";
3360
3375
  const a = document.createElement("div");
@@ -3370,7 +3385,7 @@ const V = class V extends b {
3370
3385
  const d = document.createElement("button");
3371
3386
  d.type = "button", d.className = "gstop-color-copy", d.textContent = "Copy", r.appendChild(h), r.appendChild(p), r.appendChild(d);
3372
3387
  const u = document.createElement("button");
3373
- u.type = "button", u.className = "gstop-del", u.innerHTML = _t, u.disabled = (((P = (I = this.value) == null ? void 0 : I.stops) == null ? void 0 : P.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(u), e.appendChild(o);
3388
+ u.type = "button", u.className = "gstop-del", u.innerHTML = _t, u.disabled = (((H = (I = this.value) == null ? void 0 : I.stops) == null ? void 0 : H.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(u), e.appendChild(o);
3374
3389
  const m = document.createElement("span");
3375
3390
  m.className = "gstop-opacity-label", m.textContent = "Opacity";
3376
3391
  const f = document.createElement("div");
@@ -3521,13 +3536,13 @@ const V = class V extends b {
3521
3536
  if (!(!this.popoverEl || !this.isPopoverOpen)) {
3522
3537
  if (this.isPopoverOpen = !1, this.popoverPosition = null, this.backdropEl && (this.backdropEl.style.display = "none"), this.popoverEl.style.display = "none", document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), this.commitPendingSolidColor(), this.value && this.value.type !== "solid") {
3523
3538
  const e = N(this.value);
3524
- B.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
3539
+ D.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
3525
3540
  }
3526
3541
  this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), V.openInstance === this && (V.openInstance = null);
3527
3542
  }
3528
3543
  }
3529
3544
  commitPendingSolidColor() {
3530
- this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : B.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
3545
+ this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : D.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
3531
3546
  }
3532
3547
  handlePaste(t) {
3533
3548
  var i;
@@ -3540,7 +3555,7 @@ const V = class V extends b {
3540
3555
  this.parseAndSet(e.value);
3541
3556
  }
3542
3557
  parseAndSet(t) {
3543
- const e = O(t.trim());
3558
+ const e = P(t.trim());
3544
3559
  e && this.setValue(e);
3545
3560
  }
3546
3561
  triggerChange() {
@@ -3708,7 +3723,7 @@ class Ee extends T {
3708
3723
  `;
3709
3724
  }
3710
3725
  }
3711
- class j extends b {
3726
+ class j extends w {
3712
3727
  constructor(t) {
3713
3728
  super({
3714
3729
  ...t,
@@ -3867,7 +3882,7 @@ export {
3867
3882
  kt as OpacitySetting,
3868
3883
  de as SelectApiSettings,
3869
3884
  tt as SelectSetting,
3870
- b as Setting,
3885
+ w as Setting,
3871
3886
  T as SettingGroup,
3872
3887
  bt as StringSetting,
3873
3888
  yt as TabSettingGroup,
@@ -3878,8 +3893,8 @@ export {
3878
3893
  ae as asSettingGroupWithSettings,
3879
3894
  Et as createSettingGroup,
3880
3895
  oe as createTabSettingGroup,
3881
- D as isSetting,
3896
+ O as isSetting,
3882
3897
  st as isSettingChild,
3883
- w as isSettingGroup,
3898
+ b as isSettingGroup,
3884
3899
  W as iterateSettings
3885
3900
  };