builder-settings-types 0.0.324 → 0.0.326

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.
@@ -1,22 +1,22 @@
1
1
  const bt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
2
- let mt = (d = 21) => {
3
- let t = "", e = crypto.getRandomValues(new Uint8Array(d |= 0));
4
- for (; d--; )
5
- t += bt[e[d] & 63];
2
+ let mt = (h = 21) => {
3
+ let t = "", e = crypto.getRandomValues(new Uint8Array(h |= 0));
4
+ for (; h--; )
5
+ t += bt[e[h] & 63];
6
6
  return t;
7
7
  };
8
- function wt(d) {
9
- let t = 0, e = d.parentElement;
8
+ function wt(h) {
9
+ let t = 0, e = h.parentElement;
10
10
  for (; e; )
11
- e.classList.contains("setting-group") && e !== d && t++, e = e.parentElement;
11
+ e.classList.contains("setting-group") && e !== h && t++, e = e.parentElement;
12
12
  return t;
13
13
  }
14
- function Z(d, t) {
14
+ function Z(h, t) {
15
15
  const e = Math.min(Math.max(t, 0), 5);
16
- d.setAttribute("data-nesting-level", e.toString()), e > 0 ? d.style.setProperty("--visual-indent", `${e * 2}px`) : (d.style.removeProperty("--visual-indent"), d.style.marginLeft = "");
16
+ h.setAttribute("data-nesting-level", e.toString()), e > 0 ? h.style.setProperty("--visual-indent", `${e * 2}px`) : (h.style.removeProperty("--visual-indent"), h.style.marginLeft = "");
17
17
  }
18
- function et(d, t = 0) {
19
- d.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
18
+ function et(h, t = 0) {
19
+ h.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
20
20
  const s = i, n = t + 1;
21
21
  Z(s, n), et(s, n);
22
22
  });
@@ -112,20 +112,20 @@ class Lt {
112
112
  }
113
113
  }
114
114
  const rt = new Lt();
115
- function Y(d) {
116
- if (d === null || typeof d != "object") return d;
117
- if (d instanceof Date) return new Date(d.getTime());
118
- if (d instanceof Array) return d.map((t) => Y(t));
119
- if (typeof d == "object") {
115
+ function Y(h) {
116
+ if (h === null || typeof h != "object") return h;
117
+ if (h instanceof Date) return new Date(h.getTime());
118
+ if (h instanceof Array) return h.map((t) => Y(t));
119
+ if (typeof h == "object") {
120
120
  const t = {};
121
- for (const e in d)
122
- Object.prototype.hasOwnProperty.call(d, e) && (t[e] = Y(d[e]));
121
+ for (const e in h)
122
+ Object.prototype.hasOwnProperty.call(h, e) && (t[e] = Y(h[e]));
123
123
  return t;
124
124
  }
125
- return d;
125
+ return h;
126
126
  }
127
- function kt(d) {
128
- switch (d) {
127
+ function kt(h) {
128
+ switch (h) {
129
129
  case "number":
130
130
  return 0;
131
131
  case "text":
@@ -262,79 +262,79 @@ M.currentLanguageExplicitlySet = !1, M.languageChangeCallbacks = /* @__PURE__ */
262
262
  { title: "Text Color", keys: ["text-dark", "text-light"] }
263
263
  ];
264
264
  let x = M;
265
- function G(d) {
266
- return d instanceof x;
265
+ function G(h) {
266
+ return h instanceof x;
267
267
  }
268
- function k(d) {
269
- return d instanceof $;
268
+ function k(h) {
269
+ return h instanceof $;
270
270
  }
271
- function ct(d) {
272
- return G(d) || k(d);
271
+ function ct(h) {
272
+ return G(h) || k(h);
273
273
  }
274
- const ot = (d, t, e) => {
274
+ const ot = (h, t, e) => {
275
275
  let i = !1, s = 0, n = 0, o = 0, a = 0;
276
- const l = (h) => {
277
- if (h.target.closest("button")) return;
278
- i = !0, s = h.clientX, n = h.clientY;
279
- const p = t.getBoundingClientRect();
280
- o = p.left, a = p.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", c), document.body.style.userSelect = "none";
281
- }, r = (h) => {
276
+ const l = (p) => {
277
+ if (p.target.closest("button")) return;
278
+ i = !0, s = p.clientX, n = p.clientY;
279
+ const d = t.getBoundingClientRect();
280
+ o = d.left, a = d.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", c), document.body.style.userSelect = "none";
281
+ }, r = (p) => {
282
282
  if (!i) return;
283
- const p = h.clientX - s, g = h.clientY - n, f = window.innerWidth, m = window.innerHeight, u = t.offsetWidth, v = t.offsetHeight;
284
- let C = o + p, y = a + g;
285
- C = Math.max(8, Math.min(f - u - 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);
283
+ const d = p.clientX - s, g = p.clientY - n, C = window.innerWidth, m = window.innerHeight, u = t.offsetWidth, f = t.offsetHeight;
284
+ let v = o + d, y = a + g;
285
+ v = Math.max(8, Math.min(C - u - 8, v)), y = Math.max(8, Math.min(m - f - 8, y)), t.style.left = `${v}px`, t.style.top = `${y}px`, e == null || e(v, y);
286
286
  }, c = () => {
287
287
  i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", c), document.body.style.userSelect = "";
288
288
  };
289
- d.addEventListener("mousedown", l);
290
- }, W = (d) => {
291
- if (!d) return null;
292
- let t = d.trim();
289
+ h.addEventListener("mousedown", l);
290
+ }, F = (h) => {
291
+ if (!h) return null;
292
+ let t = h.trim();
293
293
  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()}`;
294
- }, X = (d, t, e) => `#${[d, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, P = (d) => {
295
- const t = d.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
294
+ }, X = (h, t, e) => `#${[h, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, P = (h) => {
295
+ const t = h.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
296
296
  return {
297
297
  r: parseInt(e.slice(0, 2), 16),
298
298
  g: parseInt(e.slice(2, 4), 16),
299
299
  b: parseInt(e.slice(4, 6), 16)
300
300
  };
301
- }, z = (d) => {
302
- const { r: t, g: e, b: i } = P(d), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
301
+ }, U = (h) => {
302
+ const { r: t, g: e, b: i } = P(h), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
303
303
  let c = 0;
304
304
  r !== 0 && (a === s ? c = (n - o) / r % 6 : a === n ? c = (o - s) / r + 2 : c = (s - n) / r + 4), c < 0 && (c += 6);
305
- const h = a === 0 ? 0 : r / a, p = a;
306
- return { h: c * 60, s: h, v: p };
307
- }, U = (d, t, e) => {
308
- const i = (d % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), o = e - s;
305
+ const p = a === 0 ? 0 : r / a, d = a;
306
+ return { h: c * 60, s: p, v: d };
307
+ }, W = (h, t, e) => {
308
+ const i = (h % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), o = e - s;
309
309
  let a = 0, l = 0, r = 0;
310
310
  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), X(
311
311
  Math.round((a + o) * 255),
312
312
  Math.round((l + o) * 255),
313
313
  Math.round((r + o) * 255)
314
314
  );
315
- }, vt = (d, t, e) => {
315
+ }, vt = (h, t, e) => {
316
316
  const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
317
- return { hue: d, sat: s, lightness: i };
318
- }, it = (d, t, e) => {
319
- const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(d / 60 % 2 - 1)), n = e - i / 2;
317
+ return { hue: h, sat: s, lightness: i };
318
+ }, it = (h, t, e) => {
319
+ const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(h / 60 % 2 - 1)), n = e - i / 2;
320
320
  let o = 0, a = 0, l = 0;
321
- return d < 60 ? (o = i, a = s, l = 0) : d < 120 ? (o = s, a = i, l = 0) : d < 180 ? (o = 0, a = i, l = s) : d < 240 ? (o = 0, a = s, l = i) : d < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), {
321
+ return h < 60 ? (o = i, a = s, l = 0) : h < 120 ? (o = s, a = i, l = 0) : h < 180 ? (o = 0, a = i, l = s) : h < 240 ? (o = 0, a = s, l = i) : h < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), {
322
322
  r: Math.round((o + n) * 255),
323
323
  g: Math.round((a + n) * 255),
324
324
  b: Math.round((l + n) * 255)
325
325
  };
326
- }, st = (d, t) => {
326
+ }, st = (h, t) => {
327
327
  const e = Math.max(0, Math.min(100, t)) / 100;
328
- if (d.startsWith("#")) {
329
- const { r: s, g: n, b: o } = P(d);
328
+ if (h.startsWith("#")) {
329
+ const { r: s, g: n, b: o } = P(h);
330
330
  return `rgba(${s}, ${n}, ${o}, ${e})`;
331
331
  }
332
- if (d.startsWith("rgba("))
333
- return d.replace(/,\s*[\d.]+\)$/, `, ${e})`);
334
- if (d.startsWith("rgb("))
335
- return d.replace("rgb(", "rgba(").replace(")", `, ${e})`);
336
- if (d.startsWith("hsl(")) {
337
- const s = d.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
332
+ if (h.startsWith("rgba("))
333
+ return h.replace(/,\s*[\d.]+\)$/, `, ${e})`);
334
+ if (h.startsWith("rgb("))
335
+ return h.replace("rgb(", "rgba(").replace(")", `, ${e})`);
336
+ if (h.startsWith("hsl(")) {
337
+ const s = h.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
338
338
  if (s) {
339
339
  const { r: n, g: o, b: a } = it(
340
340
  parseInt(s[1]),
@@ -344,8 +344,8 @@ const ot = (d, t, e) => {
344
344
  return `rgba(${n}, ${o}, ${a}, ${e})`;
345
345
  }
346
346
  }
347
- if (d.startsWith("hsla(")) {
348
- const s = d.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
347
+ if (h.startsWith("hsla(")) {
348
+ const s = h.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
349
349
  if (s) {
350
350
  const { r: n, g: o, b: a } = it(
351
351
  parseInt(s[1]),
@@ -355,13 +355,13 @@ const ot = (d, t, e) => {
355
355
  return `rgba(${n}, ${o}, ${a}, ${e})`;
356
356
  }
357
357
  }
358
- const i = W(d);
358
+ const i = F(h);
359
359
  if (i) {
360
360
  const { r: s, g: n, b: o } = P(i);
361
361
  return `rgba(${s}, ${n}, ${o}, ${e})`;
362
362
  }
363
- return d;
364
- }, Mt = (d) => [
363
+ return h;
364
+ }, Mt = (h) => [
365
365
  "red",
366
366
  "green",
367
367
  "blue",
@@ -385,18 +385,18 @@ const ot = (d, t, e) => {
385
385
  "teal",
386
386
  "fuchsia",
387
387
  "transparent"
388
- ].includes(d.toLowerCase()), ft = (d) => [
388
+ ].includes(h.toLowerCase()), ft = (h) => [
389
389
  /^#[0-9a-fA-F]{3,8}$/,
390
390
  /^rgba?\s*\([^)]+\)$/,
391
391
  /^hsla?\s*\([^)]+\)$/,
392
392
  /^[a-zA-Z]+$/
393
- ].some((e) => e.test(d.trim())), Nt = (d) => {
393
+ ].some((e) => e.test(h.trim())), It = (h) => {
394
394
  if (typeof document > "u")
395
- return ft(d) || !!W(d);
395
+ return ft(h) || !!F(h);
396
396
  const t = document.createElement("div");
397
- return t.style.color = d, t.style.color !== "";
398
- }, Ct = (d) => {
399
- const t = d.trim();
397
+ return t.style.color = h, t.style.color !== "";
398
+ }, Ct = (h) => {
399
+ const t = h.trim();
400
400
  if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
401
401
  const n = t.slice(1), o = parseInt(n.slice(0, 2), 16), a = parseInt(n.slice(2, 4), 16), l = parseInt(n.slice(4, 6), 16), r = parseInt(n.slice(6, 8), 16);
402
402
  return {
@@ -431,12 +431,12 @@ const ot = (d, t, e) => {
431
431
  opacity: Math.round(l * 100)
432
432
  };
433
433
  }
434
- return { color: W(t) || t, position: 0, opacity: 100 };
435
- }, ht = (d) => {
434
+ return { color: F(t) || t, position: 0, opacity: 100 };
435
+ }, ht = (h) => {
436
436
  const t = [];
437
437
  let e = "", i = 0;
438
- for (let s = 0; s < d.length; s++) {
439
- const n = d[s];
438
+ for (let s = 0; s < h.length; s++) {
439
+ const n = h[s];
440
440
  if (n === "(") i++;
441
441
  else if (n === ")") i--;
442
442
  else if (n === "," && i === 0) {
@@ -446,16 +446,16 @@ const ot = (d, t, e) => {
446
446
  e += n;
447
447
  }
448
448
  return e.trim() && t.push(e.trim()), t;
449
- }, dt = (d, t) => {
450
- const e = new RegExp(`${t}\\s*\\(`, "i"), i = d.match(e);
449
+ }, dt = (h, t) => {
450
+ const e = new RegExp(`${t}\\s*\\(`, "i"), i = h.match(e);
451
451
  if (!i) return null;
452
452
  const s = i.index + i[0].length;
453
453
  let n = 1, o = s;
454
- for (let a = s; a < d.length && n > 0; a++)
455
- d[a] === "(" ? n++ : d[a] === ")" && n--, o = a;
456
- return n === 0 ? d.substring(s, o) : null;
457
- }, It = (d) => {
458
- const t = d.split(" ")[0].toLowerCase();
454
+ for (let a = s; a < h.length && n > 0; a++)
455
+ h[a] === "(" ? n++ : h[a] === ")" && n--, o = a;
456
+ return n === 0 ? h.substring(s, o) : null;
457
+ }, Nt = (h) => {
458
+ const t = h.split(" ")[0].toLowerCase();
459
459
  return [
460
460
  "circle",
461
461
  "ellipse",
@@ -466,32 +466,32 @@ const ot = (d, t, e) => {
466
466
  "at",
467
467
  "contain",
468
468
  "cover"
469
- ].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(d) || /^hsl/i.test(d) || Mt(t);
470
- }, pt = (d) => {
469
+ ].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(h) || /^hsl/i.test(h) || Mt(t);
470
+ }, pt = (h) => {
471
471
  const t = [];
472
- return d.forEach((e, i) => {
472
+ return h.forEach((e, i) => {
473
473
  const s = e.trim();
474
474
  if (!s) return;
475
475
  let n = "", o = 0;
476
476
  const a = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
477
- a && ft(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = d.length === 1 ? 0 : i / (d.length - 1) * 100);
477
+ a && ft(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = h.length === 1 ? 0 : i / (h.length - 1) * 100);
478
478
  const l = Ct(n);
479
479
  l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
480
480
  }), t;
481
- }, A = (d) => {
482
- const t = d.stops && d.stops.length ? d.stops : [{ color: "#000000", position: 0, opacity: 100 }];
481
+ }, A = (h) => {
482
+ const t = h.stops && h.stops.length ? h.stops : [{ color: "#000000", position: 0, opacity: 100 }];
483
483
  return {
484
- type: d.type && ["linear", "radial", "solid"].includes(d.type) ? d.type : "linear",
485
- angle: typeof d.angle == "number" ? d.angle : 90,
484
+ type: h.type && ["linear", "radial", "solid"].includes(h.type) ? h.type : "linear",
485
+ angle: typeof h.angle == "number" ? h.angle : 90,
486
486
  stops: t.map((e, i) => ({
487
487
  color: e.color || "#000000",
488
488
  position: typeof e.position == "number" ? e.position : t.length === 1 ? 0 : Math.round(i / (t.length - 1) * 100),
489
489
  opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
490
490
  }))
491
491
  };
492
- }, T = (d) => {
493
- const t = d.replace(/;$/, "").trim();
494
- if (Nt(t)) {
492
+ }, T = (h) => {
493
+ const t = h.replace(/;$/, "").trim();
494
+ if (It(t)) {
495
495
  const s = Ct(t);
496
496
  return A({ type: "solid", angle: 0, stops: [s] });
497
497
  }
@@ -518,25 +518,25 @@ const ot = (d, t, e) => {
518
518
  }
519
519
  const i = dt(t, "radial-gradient");
520
520
  if (i) {
521
- const s = ht(i), n = s[0] && !It(s[0]) ? s.slice(1) : s, o = pt(n);
521
+ const s = ht(i), n = s[0] && !Nt(s[0]) ? s.slice(1) : s, o = pt(n);
522
522
  return o.length ? A({ type: "radial", angle: 0, stops: o }) : null;
523
523
  }
524
524
  return null;
525
- }, S = (d) => {
526
- if (d.type === "solid") {
527
- const e = d.stops[0], i = e.color;
525
+ }, S = (h) => {
526
+ if (h.type === "solid") {
527
+ const e = h.stops[0], i = e.color;
528
528
  if (i.startsWith("var(--"))
529
529
  return i;
530
530
  const s = e.opacity ?? 100, n = i.replace("#", ""), o = Math.round(s / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
531
531
  return `#${n}${o}`;
532
532
  }
533
- const t = d.stops.map(
533
+ const t = h.stops.map(
534
534
  (e) => `${st(e.color, e.opacity ?? 100)} ${e.position}%`
535
535
  ).join(", ");
536
- return d.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${d.angle}deg, ${t})`;
537
- }, St = (d) => Math.round(d / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), K = (d) => {
538
- if (d.type === "solid") {
539
- const t = d.stops[0];
536
+ return h.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${h.angle}deg, ${t})`;
537
+ }, St = (h) => Math.round(h / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), K = (h) => {
538
+ if (h.type === "solid") {
539
+ const t = h.stops[0];
540
540
  if (t) {
541
541
  const e = t.color;
542
542
  if (e.startsWith("var(--"))
@@ -552,7 +552,7 @@ const ot = (d, t, e) => {
552
552
  }
553
553
  return "#000000";
554
554
  }
555
- return d.type === "linear" ? `Linear ${d.angle}°` : "Radial Gradient";
555
+ return h.type === "linear" ? `Linear ${h.angle}°` : "Radial Gradient";
556
556
  }, q = class q {
557
557
  static defaults() {
558
558
  return {
@@ -563,7 +563,7 @@ const ot = (d, t, e) => {
563
563
  static normalizeList(t) {
564
564
  const e = /* @__PURE__ */ new Set(), i = [];
565
565
  return t.forEach((s) => {
566
- let n = W(s);
566
+ let n = F(s);
567
567
  n || T(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
568
568
  }), i.slice(0, this.MAX_COLORS);
569
569
  }
@@ -609,7 +609,7 @@ const ot = (d, t, e) => {
609
609
  }
610
610
  static addColor(t, e) {
611
611
  if (!t) return;
612
- let i = W(t), s = "solid";
612
+ let i = F(t), s = "solid";
613
613
  if (i)
614
614
  s = "solid";
615
615
  else {
@@ -622,8 +622,8 @@ const ot = (d, t, e) => {
622
622
  }
623
623
  };
624
624
  q.STORAGE_KEY = "settingsLib_recentColors", q.MAX_COLORS = 12, q.colors = null;
625
- let F = q;
626
- const at = (d, t) => {
625
+ let R = q;
626
+ const at = (h, t) => {
627
627
  const e = document.createElement("div");
628
628
  e.className = "color-picker-recent-section";
629
629
  const i = document.createElement("div");
@@ -632,54 +632,54 @@ const at = (d, t) => {
632
632
  s.className = "color-picker-tooltip", s.style.display = "none", e.appendChild(s);
633
633
  const n = () => {
634
634
  s.style.display = "none";
635
- }, o = (c, h) => {
636
- const p = c.getBoundingClientRect();
637
- s.textContent = h, s.style.left = `${p.left + p.width / 2}px`, s.style.top = `${p.bottom + 8}px`, s.style.display = "block";
635
+ }, o = (c, p) => {
636
+ const d = c.getBoundingClientRect();
637
+ s.textContent = p, s.style.left = `${d.left + d.width / 2}px`, s.style.top = `${d.bottom + 8}px`, s.style.display = "block";
638
638
  }, a = document.createElement("div");
639
639
  a.className = "color-picker-recent-grid";
640
640
  const l = document.createElement("div");
641
641
  l.className = "color-picker-recent-placeholder", l.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(a), e.appendChild(l);
642
642
  const r = () => {
643
643
  n(), a.innerHTML = "";
644
- const c = F.getColors(t);
644
+ const c = R.getColors(t);
645
645
  if (c.length === 0) {
646
646
  a.style.display = "none", l.style.display = "block";
647
647
  return;
648
648
  }
649
- a.style.display = "grid", l.style.display = "none", c.forEach((h) => {
650
- const p = document.createElement("button");
651
- p.type = "button", p.className = "color-picker-recent-swatch";
652
- const g = Vt(h);
653
- if (p.title = g, p.setAttribute("aria-label", `Use color: ${g}`), h.includes("gradient(")) {
654
- p.style.backgroundImage = h, p.style.backgroundColor = "transparent";
655
- const m = T(h);
656
- m && m.stops && m.stops.length > 0 && (p.style.borderColor = m.stops[0].color);
649
+ a.style.display = "grid", l.style.display = "none", c.forEach((p) => {
650
+ const d = document.createElement("button");
651
+ d.type = "button", d.className = "color-picker-recent-swatch";
652
+ const g = Vt(p);
653
+ if (d.title = g, d.setAttribute("aria-label", `Use color: ${g}`), p.includes("gradient(")) {
654
+ d.style.backgroundImage = p, d.style.backgroundColor = "transparent";
655
+ const m = T(p);
656
+ m && m.stops && m.stops.length > 0 && (d.style.borderColor = m.stops[0].color);
657
657
  } else
658
- p.style.backgroundColor = h, p.style.borderColor = h;
659
- p.addEventListener("mouseenter", () => o(p, g)), p.addEventListener("mouseleave", () => {
660
- n(), p.style.boxShadow = "";
661
- }), p.addEventListener("mousedown", () => {
662
- p.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
663
- }), p.addEventListener("mouseup", () => {
658
+ d.style.backgroundColor = p, d.style.borderColor = p;
659
+ d.addEventListener("mouseenter", () => o(d, g)), d.addEventListener("mouseleave", () => {
660
+ n(), d.style.boxShadow = "";
661
+ }), d.addEventListener("mousedown", () => {
662
+ d.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
663
+ }), d.addEventListener("mouseup", () => {
664
664
  setTimeout(() => {
665
- p.style.boxShadow = "";
665
+ d.style.boxShadow = "";
666
666
  }, 150);
667
- }), p.addEventListener("click", () => {
668
- n(), d(h);
669
- }), a.appendChild(p);
667
+ }), d.addEventListener("click", () => {
668
+ n(), h(p);
669
+ }), a.appendChild(d);
670
670
  });
671
671
  };
672
672
  return r(), { container: e, refresh: r };
673
- }, Vt = (d) => {
674
- const t = T(d);
673
+ }, Vt = (h) => {
674
+ const t = T(h);
675
675
  if (t)
676
676
  return K(t);
677
- const e = W(d);
677
+ const e = F(h);
678
678
  if (e) {
679
679
  const i = P(e);
680
680
  return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
681
681
  }
682
- return d;
682
+ return h;
683
683
  }, yt = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
684
684
  <path fill-rule="evenodd" clip-rule="evenodd"
685
685
  d="M6.12347 4.96653L1.41158 0.254304C1.25449 0.102568 1.04409 0.0186071 0.825694 0.0205049C0.607302 0.0224037 0.398393 0.110007 0.24396 0.26445C0.0895282 0.418893 0.0019303 0.627818 3.24698e-05 0.846225C-0.00186536 1.06463 0.0820894 1.27505 0.233815 1.43215L4.9457 6.14438L0.233814 10.8566C0.0820886 11.0137 -0.00186625 11.2241 3.15434e-05 11.4425C0.00192934 11.6609 0.0895272 11.8699 0.243959 12.0243C0.398392 12.1787 0.607301 12.2663 0.825693 12.2682C1.04408 12.2701 1.25449 12.1862 1.41158 12.0344L6.12347 7.32222L10.8354 12.0344C10.9932 12.1824 11.2023 12.2632 11.4186 12.2597C11.6349 12.2562 11.8414 12.1687 11.9943 12.0156C12.1472 11.8626 12.2346 11.6561 12.2379 11.4398C12.2413 11.2234 12.1604 11.0143 12.0123 10.8566L7.30123 6.14438L12.0131 1.43215C12.0927 1.35531 12.1561 1.2634 12.1998 1.16177C12.2434 1.06014 12.2664 0.950833 12.2674 0.84023C12.2683 0.729626 12.2473 0.61994 12.2054 0.517568C12.1635 0.415196 12.1017 0.322191 12.0234 0.243979C11.9452 0.165768 11.8522 0.103916 11.7499 0.0620327C11.6475 0.0201492 11.5378 -0.000927989 11.4272 3.33052e-05C11.3166 0.000993646 11.2073 0.0239743 11.1057 0.0676297C11.0041 0.111286 10.9122 0.174745 10.8354 0.254305L6.12347 4.96653Z"
@@ -760,77 +760,77 @@ class ut {
760
760
  r.className = "color-picker-sliders-group";
761
761
  const c = document.createElement("div");
762
762
  c.className = "color-picker-hue", this.hueSlider = c;
763
- const h = document.createElement("div");
764
- h.className = "color-picker-hue-marker", this.hueMarker = h, c.appendChild(h);
765
763
  const p = document.createElement("div");
766
- p.className = "color-picker-opacity", this.opacitySlider = p;
764
+ p.className = "color-picker-hue-marker", this.hueMarker = p, c.appendChild(p);
765
+ const d = document.createElement("div");
766
+ d.className = "color-picker-opacity", this.opacitySlider = d;
767
767
  const g = document.createElement("div");
768
- g.className = "color-picker-opacity-marker", this.opacityMarker = g, p.appendChild(g), r.appendChild(c), r.appendChild(p), a.appendChild(l), a.appendChild(r);
769
- const f = at((E) => {
768
+ g.className = "color-picker-opacity-marker", this.opacityMarker = g, d.appendChild(g), r.appendChild(c), r.appendChild(d), a.appendChild(l), a.appendChild(r);
769
+ const C = at((E) => {
770
770
  var w;
771
771
  this.setColor(E), (w = this.onChange) == null || w.call(this, E, this.currentOpacity);
772
772
  }, this.recentScope);
773
- this.recentSectionRefresh = f.refresh;
773
+ this.recentSectionRefresh = C.refresh;
774
774
  const m = document.createElement("div");
775
775
  m.className = "color-picker-format-section";
776
776
  const u = document.createElement("select");
777
777
  u.className = "color-picker-format-select", this.select = u;
778
+ const f = document.createElement("option");
779
+ f.value = "hex", f.textContent = "HEX";
778
780
  const v = document.createElement("option");
779
- v.value = "hex", v.textContent = "HEX";
780
- const C = document.createElement("option");
781
- C.value = "rgb", C.textContent = "RGB";
781
+ v.value = "rgb", v.textContent = "RGB";
782
782
  const y = document.createElement("option");
783
- y.value = "hsl", y.textContent = "HSL", u.appendChild(v), u.appendChild(C), u.appendChild(y);
783
+ y.value = "hsl", y.textContent = "HSL", u.appendChild(f), u.appendChild(v), u.appendChild(y);
784
784
  const b = document.createElement("input");
785
785
  b.type = "text", b.className = "color-picker-color-input", b.value = this.currentColor, this.input = b;
786
786
  const L = document.createElement("div");
787
787
  L.className = "color-picker-input-container";
788
- const I = document.createElement("button");
789
- return I.className = "color-picker-copy-inside", I.textContent = "Copy", L.appendChild(b), L.appendChild(I), m.appendChild(u), m.appendChild(L), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(f.container), t.appendChild(m), t.addEventListener("click", (E) => E.stopPropagation()), this.bind(n, c, p, b, u, I, l), t;
788
+ const N = document.createElement("button");
789
+ return N.className = "color-picker-copy-inside", N.textContent = "Copy", L.appendChild(b), L.appendChild(N), m.appendChild(u), m.appendChild(L), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(C.container), t.appendChild(m), t.addEventListener("click", (E) => E.stopPropagation()), this.bind(n, c, d, b, u, N, l), t;
790
790
  }
791
791
  createBackdrop() {
792
792
  const t = document.createElement("div");
793
793
  return t.className = "color-picker-backdrop", t.style.display = "none", t.style.pointerEvents = "none", t;
794
794
  }
795
795
  bind(t, e, i, s, n, o, a) {
796
- const l = (h) => {
797
- var C;
798
- const p = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width)), f = Math.max(0, Math.min(1, (h.clientY - p.top) / p.height));
799
- this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${f * 100}%`;
800
- const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = U(u, g, 1 - f);
801
- this.currentColor = v, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
802
- }, r = (h) => {
803
- var C;
804
- const p = e.getBoundingClientRect();
805
- let g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width));
796
+ const l = (p) => {
797
+ var v;
798
+ const d = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width)), C = Math.max(0, Math.min(1, (p.clientY - d.top) / d.height));
799
+ this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${C * 100}%`;
800
+ const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, f = W(u, g, 1 - C);
801
+ this.currentColor = f, this.syncInput(), this.updateOpacityBg(), (v = this.onChange) == null || v.call(this, f, this.currentOpacity);
802
+ }, r = (p) => {
803
+ var v;
804
+ const d = e.getBoundingClientRect();
805
+ let g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width));
806
806
  this.hueMarker.style.left = `${g * 100}%`;
807
- const f = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), v = U(f, m, 1 - u);
808
- this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${f}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
809
- }, c = (h) => {
810
- var f;
811
- const p = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width));
812
- this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), (f = this.onChange) == null || f.call(this, this.currentColor, this.currentOpacity);
807
+ const C = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), f = W(C, m, 1 - u);
808
+ this.currentColor = f, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${C}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (v = this.onChange) == null || v.call(this, f, this.currentOpacity);
809
+ }, c = (p) => {
810
+ var C;
811
+ const d = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width));
812
+ this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), (C = this.onChange) == null || C.call(this, this.currentColor, this.currentOpacity);
813
813
  };
814
- t.addEventListener("mousedown", (h) => {
815
- h.preventDefault(), l(h);
816
- const p = (f) => l(f), g = () => {
817
- document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
814
+ t.addEventListener("mousedown", (p) => {
815
+ p.preventDefault(), l(p);
816
+ const d = (C) => l(C), g = () => {
817
+ document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
818
818
  };
819
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
820
- }), e.addEventListener("mousedown", (h) => {
821
- h.preventDefault(), r(h);
822
- const p = (f) => r(f), g = () => {
823
- document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
819
+ document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
820
+ }), e.addEventListener("mousedown", (p) => {
821
+ p.preventDefault(), r(p);
822
+ const d = (C) => r(C), g = () => {
823
+ document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
824
824
  };
825
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
826
- }), i.addEventListener("mousedown", (h) => {
827
- h.preventDefault(), c(h);
828
- const p = (f) => c(f), g = () => {
829
- document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
825
+ document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
826
+ }), i.addEventListener("mousedown", (p) => {
827
+ p.preventDefault(), c(p);
828
+ const d = (C) => c(C), g = () => {
829
+ document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
830
830
  };
831
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
832
- }), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (h) => {
833
- h.key === "Enter" && (h.preventDefault(), this.syncInput(), s.blur());
831
+ document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
832
+ }), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (p) => {
833
+ p.key === "Enter" && (p.preventDefault(), this.syncInput(), s.blur());
834
834
  }), o.addEventListener("click", async () => {
835
835
  try {
836
836
  await navigator.clipboard.writeText(s.value);
@@ -838,14 +838,14 @@ class ut {
838
838
  s.select(), document.execCommand("copy");
839
839
  }
840
840
  }), a.addEventListener("click", async () => {
841
- var h;
841
+ var p;
842
842
  if (!("EyeDropper" in window)) {
843
843
  alert("EyeDropper API is not supported in this browser.");
844
844
  return;
845
845
  }
846
846
  try {
847
- const p = new window.EyeDropper(), { sRGBHex: g } = await p.open();
848
- this.setColor(g), (h = this.onChange) == null || h.call(this, g, this.currentOpacity);
847
+ const d = new window.EyeDropper(), { sRGBHex: g } = await d.open();
848
+ this.setColor(g), (p = this.onChange) == null || p.call(this, g, this.currentOpacity);
849
849
  } catch {
850
850
  }
851
851
  }), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
@@ -856,11 +856,11 @@ class ut {
856
856
  setColor(t) {
857
857
  var o;
858
858
  this.currentColor = t;
859
- const { h: e, s: i, v: s } = z(t), n = e >= 360 ? e % 360 : e;
859
+ const { h: e, s: i, v: s } = U(t), n = e >= 360 ? e % 360 : e;
860
860
  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);
861
861
  }
862
862
  syncInput() {
863
- const t = this.select.value, { h: e, s: i, v: s } = z(this.currentColor);
863
+ const t = this.select.value, { h: e, s: i, v: s } = U(this.currentColor);
864
864
  if (t === "hex") this.input.value = this.currentColor;
865
865
  else if (t === "rgb") {
866
866
  const { r: n, g: o, b: a } = P(this.currentColor);
@@ -885,7 +885,7 @@ class ut {
885
885
  const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
886
886
  if (s) {
887
887
  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);
888
- e = U(n, r, l);
888
+ e = W(n, r, l);
889
889
  }
890
890
  }
891
891
  }
@@ -901,18 +901,18 @@ class ut {
901
901
  open(t, e, i) {
902
902
  var y;
903
903
  this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
904
- const { h: s, s: n, v: o } = z(t);
904
+ const { h: s, s: n, v: o } = U(t);
905
905
  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);
906
- const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), c = window.innerWidth, h = window.innerHeight, p = 16;
907
- let g = r.right + 8, f = r.top;
906
+ const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), c = window.innerWidth, p = window.innerHeight, d = 16;
907
+ let g = r.right + 8, C = r.top;
908
908
  const m = c - r.right, u = r.left;
909
- m >= a + p ? g = r.right + 8 : u >= a + p ? g = r.left - a - 8 : g = Math.max(p, (c - a) / 2);
910
- const v = h - r.bottom, C = r.top;
911
- v >= l + p ? f = r.bottom + 8 : C >= l + p ? f = r.top - l - 8 : v > C ? (f = r.bottom + 8, f + l > h - p && (f = h - l - p)) : (f = r.top - l - 8, f < p && (f = p)), this.element.style.left = `${g}px`, this.element.style.top = `${f}px`;
909
+ m >= a + d ? g = r.right + 8 : u >= a + d ? g = r.left - a - 8 : g = Math.max(d, (c - a) / 2);
910
+ const f = p - r.bottom, v = r.top;
911
+ f >= l + d ? C = r.bottom + 8 : v >= l + d ? C = r.top - l - 8 : f > v ? (C = r.bottom + 8, C + l > p - d && (C = p - l - d)) : (C = r.top - l - 8, C < d && (C = d)), this.element.style.left = `${g}px`, this.element.style.top = `${C}px`;
912
912
  }
913
913
  close(t) {
914
914
  var e;
915
- 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" && (F.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
915
+ 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" && (R.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
916
916
  }
917
917
  getElement() {
918
918
  return this.element;
@@ -920,12 +920,19 @@ class ut {
920
920
  }
921
921
  class Bt {
922
922
  constructor(t) {
923
- this.isDragging = !1, this.currentColor = t.initialColor, this.currentOpacity = t.initialOpacity, this.onColorChange = t.onColorChange, this.recentScope = t.scope ?? "solid", this.element = this.build(), this.initFromColor(this.currentColor, this.currentOpacity);
923
+ this.isDragging = !1, this.currentColor = "#FFFFFF", this.currentColor = this.sanitizeColor(t.initialColor), this.currentOpacity = this.clampOpacity(t.initialOpacity), this.onColorChange = t.onColorChange, this.recentScope = t.scope ?? "solid", this.element = this.build(), this.initFromColor(this.currentColor, this.currentOpacity);
924
924
  }
925
925
  parsePercentage(t) {
926
926
  const e = parseFloat(t);
927
927
  return isNaN(e) ? 0 : e / 100;
928
928
  }
929
+ sanitizeColor(t) {
930
+ const e = this.currentColor || "#FFFFFF";
931
+ return F(t) ?? e;
932
+ }
933
+ clampOpacity(t) {
934
+ return Number.isFinite(t) ? Math.min(100, Math.max(0, Math.round(t))) : 100;
935
+ }
929
936
  build() {
930
937
  const t = document.createElement("div");
931
938
  t.className = "embedded-color-picker";
@@ -947,70 +954,75 @@ class Bt {
947
954
  r.className = "color-picker-opacity embedded", this.opacitySlider = r;
948
955
  const c = document.createElement("div");
949
956
  c.className = "color-picker-opacity-marker", this.opacityMarker = c, r.appendChild(c), o.appendChild(a), o.appendChild(r), s.appendChild(n), s.appendChild(o);
950
- const h = at((b) => {
957
+ const p = at((b) => {
951
958
  const L = T(b);
952
959
  L && L.type !== "solid" ? this.onColorChange(b, this.currentOpacity) : (this.setColor(b), this.onColorChange(this.currentColor, this.currentOpacity));
953
960
  }, "all");
954
- this.recentSectionRefresh = h.refresh;
955
- const p = document.createElement("div");
956
- p.className = "color-picker-format-section embedded";
961
+ this.recentSectionRefresh = p.refresh;
962
+ const d = document.createElement("div");
963
+ d.className = "color-picker-format-section embedded";
957
964
  const g = document.createElement("select");
958
965
  g.className = "color-picker-format-select", this.select = g;
959
- const f = document.createElement("option");
960
- f.value = "hex", f.textContent = "HEX";
966
+ const C = document.createElement("option");
967
+ C.value = "hex", C.textContent = "HEX";
961
968
  const m = document.createElement("option");
962
969
  m.value = "rgb", m.textContent = "RGB";
963
970
  const u = document.createElement("option");
964
- u.value = "hsl", u.textContent = "HSL", g.appendChild(f), g.appendChild(m), g.appendChild(u);
965
- const v = document.createElement("input");
966
- v.type = "text", v.className = "color-picker-color-input", this.input = v;
967
- const C = document.createElement("div");
968
- C.className = "color-picker-input-container";
971
+ u.value = "hsl", u.textContent = "HSL", g.appendChild(C), g.appendChild(m), g.appendChild(u);
972
+ const f = document.createElement("input");
973
+ f.type = "text", f.className = "color-picker-color-input", this.input = f;
974
+ const v = document.createElement("div");
975
+ v.className = "color-picker-input-container";
969
976
  const y = document.createElement("button");
970
- return y.className = "color-picker-copy-inside", y.textContent = "Copy", C.appendChild(v), C.appendChild(y), p.appendChild(g), p.appendChild(C), t.appendChild(e), t.appendChild(s), t.appendChild(p), t.appendChild(h.container), this.bind(e, a, r, v, g, y, n), t;
977
+ return y.className = "color-picker-copy-inside", y.textContent = "Copy", v.appendChild(f), v.appendChild(y), d.appendChild(g), d.appendChild(v), t.appendChild(e), t.appendChild(s), t.appendChild(d), t.appendChild(p.container), this.bind(e, a, r, f, g, y, n), t;
971
978
  }
972
979
  bind(t, e, i, s, n, o, a) {
973
- const l = (h) => {
974
- const p = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width)), f = Math.max(0, Math.min(1, (h.clientY - p.top) / p.height));
975
- this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${f * 100}%`;
976
- const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = U(u, g, 1 - f);
977
- this.currentColor = v, this.syncInput(), this.updateOpacityBg(), this.queueChange();
978
- }, r = (h) => {
979
- const p = e.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width));
980
- this.hueMarker.style.left = `${g * 100}%`;
981
- const f = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), v = U(f, m, 1 - u);
982
- this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
983
- linear-gradient(to right, #fff, hsl(${f}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
984
- }, c = (h) => {
985
- const p = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width));
986
- this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), this.queueChange();
987
- };
988
- t.addEventListener("mousedown", (h) => {
989
- h.preventDefault(), this.isDragging = !0, l(h);
990
- const p = (f) => l(f), g = () => {
991
- this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
992
- };
993
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
994
- }), e.addEventListener("mousedown", (h) => {
995
- h.preventDefault(), this.isDragging = !0, r(h);
996
- const p = (f) => r(f), g = () => {
997
- this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
980
+ const l = (d, g) => {
981
+ const C = g || t.getBoundingClientRect(), m = Math.max(0, Math.min(1, (d.clientX - C.left) / C.width)), u = Math.max(0, Math.min(1, (d.clientY - C.top) / C.height));
982
+ this.colorMarker.style.left = `${m * 100}%`, this.colorMarker.style.top = `${u * 100}%`;
983
+ const v = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, y = W(v, m, 1 - u);
984
+ this.currentColor = y, this.syncInput(), this.updateOpacityBg(), this.queueChange();
985
+ }, r = (d, g) => {
986
+ const C = g || e.getBoundingClientRect(), m = Math.max(0, Math.min(1, (d.clientX - C.left) / C.width));
987
+ this.hueMarker.style.left = `${m * 100}%`;
988
+ const u = m * 360, f = this.parsePercentage(this.colorMarker.style.left || "0%"), v = this.parsePercentage(this.colorMarker.style.top || "0%"), y = W(u, f, 1 - v);
989
+ this.currentColor = y, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
990
+ linear-gradient(to right, #fff, hsl(${u}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
991
+ }, c = (d, g) => {
992
+ const C = g || i.getBoundingClientRect(), m = Math.max(0, Math.min(1, (d.clientX - C.left) / C.width));
993
+ this.opacityMarker.style.left = `${m * 100}%`, this.currentOpacity = this.clampOpacity(m * 100), this.queueChange();
994
+ }, p = (d, g, C) => {
995
+ d.preventDefault(), this.isDragging = !0, this.cachedRect = C.getBoundingClientRect(), g(d, this.cachedRect);
996
+ let m = null, u;
997
+ const f = () => {
998
+ this.dragRafId === void 0 && (this.dragRafId = window.requestAnimationFrame(() => {
999
+ this.dragRafId = void 0, m && this.cachedRect && g(m, this.cachedRect);
1000
+ }));
1001
+ }, v = () => {
1002
+ this.isDragging && (this.isDragging = !1, this.dragRafId !== void 0 && (cancelAnimationFrame(this.dragRafId), this.dragRafId = void 0), this.cachedRect = void 0, m = null, this.flushChange(), document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", v), window.removeEventListener("blur", v), this.applyPendingExternal());
998
1003
  };
999
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
1000
- }), i.addEventListener("mousedown", (h) => {
1001
- h.preventDefault(), this.isDragging = !0, c(h);
1002
- const p = (f) => c(f), g = () => {
1003
- this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
1004
- };
1005
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
1004
+ u = (y) => {
1005
+ if (!y.buttons) {
1006
+ v();
1007
+ return;
1008
+ }
1009
+ m = y, f();
1010
+ }, document.addEventListener("mousemove", u), document.addEventListener("mouseup", v), window.addEventListener("blur", v);
1011
+ };
1012
+ t.addEventListener("mousedown", (d) => {
1013
+ p(d, l, t);
1014
+ }), e.addEventListener("mousedown", (d) => {
1015
+ p(d, r, e);
1016
+ }), i.addEventListener("mousedown", (d) => {
1017
+ p(d, c, i);
1006
1018
  }), n.addEventListener("change", () => {
1007
1019
  this.syncInput();
1008
1020
  }), s.addEventListener("input", () => {
1009
1021
  this.applyFromInput();
1010
1022
  }), s.addEventListener("blur", () => {
1011
1023
  this.syncInput();
1012
- }), s.addEventListener("keydown", (h) => {
1013
- h.key === "Enter" && (h.preventDefault(), this.syncInput(), s.blur());
1024
+ }), s.addEventListener("keydown", (d) => {
1025
+ d.key === "Enter" && (d.preventDefault(), this.syncInput(), s.blur());
1014
1026
  }), o.addEventListener("click", async () => {
1015
1027
  try {
1016
1028
  await navigator.clipboard.writeText(s.value);
@@ -1023,20 +1035,21 @@ class Bt {
1023
1035
  return;
1024
1036
  }
1025
1037
  try {
1026
- const h = new window.EyeDropper(), { sRGBHex: p } = await h.open();
1027
- this.setColor(p), this.onColorChange(this.currentColor, this.currentOpacity);
1038
+ const d = new window.EyeDropper(), { sRGBHex: g } = await d.open();
1039
+ this.setColor(g), this.onColorChange(this.currentColor, this.currentOpacity);
1028
1040
  } catch {
1029
1041
  }
1030
1042
  });
1031
1043
  }
1032
1044
  setColor(t) {
1033
- this.currentColor = t;
1034
- const { h: e, s: i, v: s } = z(t), n = e >= 360 ? e % 360 : e;
1035
- 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),
1036
- linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg();
1045
+ const e = this.sanitizeColor(t);
1046
+ this.currentColor = e;
1047
+ const { h: i, s, v: n } = U(e), o = i >= 360 ? i % 360 : i;
1048
+ 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),
1049
+ linear-gradient(to right, #fff, hsl(${o}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg();
1037
1050
  }
1038
1051
  syncInput() {
1039
- const t = this.select.value, { h: e, s: i, v: s } = z(this.currentColor);
1052
+ const t = this.select.value, { h: e, s: i, v: s } = U(this.currentColor);
1040
1053
  if (t === "hex")
1041
1054
  this.input.value = this.currentColor;
1042
1055
  else if (t === "rgb") {
@@ -1063,7 +1076,7 @@ class Bt {
1063
1076
  const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
1064
1077
  if (s) {
1065
1078
  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);
1066
- e = U(n, r, l);
1079
+ e = W(n, r, l);
1067
1080
  }
1068
1081
  }
1069
1082
  }
@@ -1090,15 +1103,16 @@ class Bt {
1090
1103
  this.pendingExternalUpdate = void 0, this.initFromColor(t, e);
1091
1104
  }
1092
1105
  initFromColor(t, e) {
1093
- var a;
1094
- this.currentColor = t, this.currentOpacity = e;
1095
- const { h: i, s, v: n } = z(t), o = i >= 360 ? i % 360 : i;
1096
- 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),
1097
- linear-gradient(to right, #fff, hsl(${o}, 100%, 50%))`, this.opacityMarker.style.left = `${e}%`, this.updateOpacityBg(), this.syncInput(), (a = this.recentSectionRefresh) == null || a.call(this);
1106
+ var l;
1107
+ const i = this.sanitizeColor(t);
1108
+ this.currentColor = i, this.currentOpacity = this.clampOpacity(e);
1109
+ const { h: s, s: n, v: o } = U(i), a = s >= 360 ? s % 360 : s;
1110
+ this.hueMarker.style.left = `${a / 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),
1111
+ linear-gradient(to right, #fff, hsl(${a}, 100%, 50%))`, this.opacityMarker.style.left = `${this.currentOpacity}%`, this.updateOpacityBg(), this.syncInput(), (l = this.recentSectionRefresh) == null || l.call(this);
1098
1112
  }
1099
1113
  commitRecentColor() {
1100
1114
  var t;
1101
- this.recentScope === "solid" && (F.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this));
1115
+ this.recentScope === "solid" && (R.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this));
1102
1116
  }
1103
1117
  getElement() {
1104
1118
  return this.element;
@@ -1123,10 +1137,10 @@ const V = class V extends x {
1123
1137
  angle: "number",
1124
1138
  stops: "text"
1125
1139
  }, 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.changeDebounceTimeout = 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) => {
1126
- var p;
1140
+ var d;
1127
1141
  if (!this.popoverEl || !this.isPopoverOpen) return;
1128
- 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(".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"), c = s.classList.contains("color-picker-backdrop"), h = s.classList.contains("gradient-popover-backdrop");
1129
- !n && !o && !l && !r && !c && !h && this.closePopover();
1142
+ 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((g) => g.contains(s)), r = s.closest(".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"), c = s.classList.contains("color-picker-backdrop"), p = s.classList.contains("gradient-popover-backdrop");
1143
+ !n && !o && !l && !r && !c && !p && this.closePopover();
1130
1144
  }, this.handlePopoverKeydown = (i) => {
1131
1145
  if (this.isPopoverOpen) {
1132
1146
  if (i.key === "Escape") {
@@ -1308,8 +1322,8 @@ const V = class V extends x {
1308
1322
  n.appendChild(o), s.appendChild(n);
1309
1323
  const a = document.createElement("div");
1310
1324
  if (a.className = "gradient-editor-content", this.updatePopoverContent(a), s.appendChild(a), this.variant !== "global" && e) {
1311
- const l = e.children[0], r = e.children[1], c = (h) => {
1312
- 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);
1325
+ const l = e.children[0], r = e.children[1], c = (p) => {
1326
+ this.currentMode = p, p === "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);
1313
1327
  };
1314
1328
  l.addEventListener("click", () => c("custom")), r.addEventListener("click", () => c("global")), this.isBoundToGlobal() ? (this.currentMode = "global", c("global")) : (this.currentMode = "custom", c("custom"));
1315
1329
  }
@@ -1376,48 +1390,48 @@ const V = class V extends x {
1376
1390
  }
1377
1391
  renderGlobalColors(t) {
1378
1392
  (!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
1379
- const e = this.value.stops[0], i = (h) => {
1380
- h.innerHTML = "";
1381
- let p = {};
1393
+ const e = this.value.stops[0], i = (p) => {
1394
+ p.innerHTML = "";
1395
+ let d = {};
1382
1396
  try {
1383
- p = x.GlobalVariables || {};
1397
+ d = x.GlobalVariables || {};
1384
1398
  } catch (u) {
1385
1399
  console.warn("Could not access Setting.GlobalVariables", u);
1386
1400
  }
1387
- if (!p || Object.keys(p).length === 0) {
1401
+ if (!d || Object.keys(d).length === 0) {
1388
1402
  const u = document.createElement("div");
1389
- u.textContent = "No global colors defined", u.style.fontSize = "12px", u.style.color = "#666", u.style.padding = "8px", h.appendChild(u);
1403
+ u.textContent = "No global colors defined", u.style.fontSize = "12px", u.style.color = "#666", u.style.padding = "8px", p.appendChild(u);
1390
1404
  return;
1391
1405
  }
1392
1406
  const g = x.GlobalVariableGroups || [
1393
1407
  { title: "Global Colors", keys: ["primary", "secondary", "tertiary", "accent"] },
1394
1408
  { title: "Text Color", keys: ["text-dark", "text-light"] }
1395
- ], f = this.globalSearchQuery.toLowerCase();
1409
+ ], C = this.globalSearchQuery.toLowerCase();
1396
1410
  let m;
1397
- this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"), h.appendChild(m), g.forEach((u) => {
1398
- const v = Object.entries(p).filter(([C]) => !u.keys.includes(C) && u.title !== "Global Colors" ? !1 : u.keys.includes(C) && C.toLowerCase().includes(f));
1399
- v.length !== 0 && v.forEach(([C, y]) => {
1411
+ this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"), p.appendChild(m), g.forEach((u) => {
1412
+ const f = Object.entries(d).filter(([v]) => !u.keys.includes(v) && u.title !== "Global Colors" ? !1 : u.keys.includes(v) && v.toLowerCase().includes(C));
1413
+ f.length !== 0 && f.forEach(([v, y]) => {
1400
1414
  if (this.globalLayoutMode === "list") {
1401
1415
  const b = document.createElement("div");
1402
1416
  b.className = "global-color-row";
1403
1417
  const L = document.createElement("div");
1404
1418
  L.className = "global-color-circle";
1405
- const I = this.resolveGlobalVarColor(y);
1406
- L.style.background = I, (this.linkedGlobalVariable === `var(--${C})` || e.color === `var(--${C})`) && L.classList.add("selected");
1419
+ const N = this.resolveGlobalVarColor(y);
1420
+ L.style.background = N, (this.linkedGlobalVariable === `var(--${v})` || e.color === `var(--${v})`) && L.classList.add("selected");
1407
1421
  const w = document.createElement("span");
1408
- w.className = "global-color-label", w.textContent = C.split("-").map((N) => N.charAt(0).toUpperCase() + N.slice(1)).join(" "), b.appendChild(L), b.appendChild(w), b.addEventListener("click", (N) => {
1409
- N.preventDefault();
1410
- const D = `var(--${C})`;
1411
- this.setValue(D), this.pendingSolidColor = D, i(h);
1422
+ w.className = "global-color-label", w.textContent = v.split("-").map((I) => I.charAt(0).toUpperCase() + I.slice(1)).join(" "), b.appendChild(L), b.appendChild(w), b.addEventListener("click", (I) => {
1423
+ I.preventDefault();
1424
+ const D = `var(--${v})`;
1425
+ this.setValue(D), this.pendingSolidColor = D, i(p);
1412
1426
  }), m.appendChild(b);
1413
1427
  } else {
1414
1428
  const b = document.createElement("div");
1415
1429
  b.className = "global-color-circle";
1416
1430
  const L = this.resolveGlobalVarColor(y);
1417
- b.style.background = L, b.title = C.split("-").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" "), (this.linkedGlobalVariable === `var(--${C})` || e.color === `var(--${C})`) && b.classList.add("selected"), b.addEventListener("click", (E) => {
1431
+ b.style.background = L, b.title = v.split("-").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" "), (this.linkedGlobalVariable === `var(--${v})` || e.color === `var(--${v})`) && b.classList.add("selected"), b.addEventListener("click", (E) => {
1418
1432
  E.preventDefault();
1419
- const w = `var(--${C})`;
1420
- this.setValue(w), this.pendingSolidColor = w, i(h);
1433
+ const w = `var(--${v})`;
1434
+ this.setValue(w), this.pendingSolidColor = w, i(p);
1421
1435
  }), m.appendChild(b);
1422
1436
  }
1423
1437
  });
@@ -1431,8 +1445,8 @@ const V = class V extends x {
1431
1445
  const a = document.createElement("input");
1432
1446
  a.type = "text", a.className = "global-search-input", a.placeholder = "Search", a.value = this.globalSearchQuery;
1433
1447
  const l = document.createElement("div");
1434
- a.addEventListener("input", (h) => {
1435
- this.globalSearchQuery = h.target.value, i(l);
1448
+ a.addEventListener("input", (p) => {
1449
+ this.globalSearchQuery = p.target.value, i(l);
1436
1450
  }), n.appendChild(o), n.appendChild(a);
1437
1451
  const r = document.createElement("button");
1438
1452
  r.className = "global-layout-toggle", r.type = "button";
@@ -1467,15 +1481,15 @@ const V = class V extends x {
1467
1481
  {
1468
1482
  const c = document.createElement("div");
1469
1483
  c.className = "gradient-subtype-inline";
1470
- const h = document.createElement("select");
1471
- h.className = "gradient-subtype-select";
1472
- const p = document.createElement("option");
1473
- p.value = "linear", p.textContent = "Linear";
1484
+ const p = document.createElement("select");
1485
+ p.className = "gradient-subtype-select";
1486
+ const d = document.createElement("option");
1487
+ d.value = "linear", d.textContent = "Linear";
1474
1488
  const g = document.createElement("option");
1475
- g.value = "radial", g.textContent = "Radial", h.appendChild(p), h.appendChild(g), 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°");
1476
- const f = document.createElement("button");
1477
- f.type = "button", f.className = "gradient-flip-btn", f.innerHTML = Tt, h.addEventListener("change", () => {
1478
- this.clearGlobalBindingForCustomChange(), this.switchType(h.value === "radial" ? "radial" : "linear", !0), e && this.updateDegreeVisibility(e);
1489
+ g.value = "radial", g.textContent = "Radial", p.appendChild(d), p.appendChild(g), p.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°");
1490
+ const C = document.createElement("button");
1491
+ C.type = "button", C.className = "gradient-flip-btn", C.innerHTML = Tt, p.addEventListener("change", () => {
1492
+ this.clearGlobalBindingForCustomChange(), this.switchType(p.value === "radial" ? "radial" : "linear", !0), e && this.updateDegreeVisibility(e);
1479
1493
  }), e.addEventListener("focus", (m) => {
1480
1494
  const u = m.target;
1481
1495
  u.value = u.value.replace(/[^0-9-]/g, ""), setTimeout(() => u.select(), 0);
@@ -1484,16 +1498,16 @@ const V = class V extends x {
1484
1498
  const u = parseInt(m.target.value);
1485
1499
  !Number.isNaN(u) && this.value && (this.value.angle = Math.max(0, Math.min(360, u)), this.debouncedPreviewUpdate());
1486
1500
  }), e.addEventListener("blur", (m) => {
1487
- var C;
1501
+ var v;
1488
1502
  this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
1489
1503
  const u = m.target;
1490
- let v = parseInt(u.value);
1491
- 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), u.value = `${v}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
1492
- }), f.addEventListener("click", () => {
1504
+ let f = parseInt(u.value);
1505
+ Number.isNaN(f) && (f = ((v = this.value) == null ? void 0 : v.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();
1506
+ }), C.addEventListener("click", () => {
1493
1507
  this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((m) => {
1494
1508
  m.position = 100 - m.position;
1495
1509
  }), this.value.stops.sort((m, u) => m.position - u.position), this.updateGradientPreview(i), this.createHandles(s, i), this.updateStopsList(l), this.updateUI(), this.triggerChange());
1496
- }), c.appendChild(h), c.appendChild(e), c.appendChild(f), t.appendChild(c), this.updateDegreeVisibility(e);
1510
+ }), c.appendChild(p), c.appendChild(e), c.appendChild(C), t.appendChild(c), this.updateDegreeVisibility(e);
1497
1511
  }
1498
1512
  const i = document.createElement("div");
1499
1513
  i.className = "gradient-preview", this.updateGradientPreview(i);
@@ -1508,8 +1522,8 @@ const V = class V extends x {
1508
1522
  const l = document.createElement("div");
1509
1523
  l.className = "gradient-stops", t.appendChild(n), t.appendChild(l), this.updateStopsList(l);
1510
1524
  const r = at((c) => {
1511
- const h = T(c);
1512
- h && (this.clearGlobalBindingForCustomChange(), this.value = h, this.switchType(h.type, !0), this.updateUI(), this.triggerChange());
1525
+ const p = T(c);
1526
+ p && (this.clearGlobalBindingForCustomChange(), this.value = p, this.switchType(p.type, !0), this.updateUI(), this.triggerChange());
1513
1527
  }, "all");
1514
1528
  this.recentGradientRefresh = r.refresh, t.appendChild(r.container), a.addEventListener("click", () => {
1515
1529
  var c;
@@ -1544,32 +1558,32 @@ const V = class V extends x {
1544
1558
  o.className = "gstop-chip";
1545
1559
  const a = this.resolveGlobalVarColor(i.color);
1546
1560
  o.style.backgroundColor = a, n.appendChild(o);
1547
- const l = new ut((u, v) => {
1548
- this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color = u, v !== void 0 && (this.value.stops[s].opacity = v), o.style.backgroundColor = u, this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
1561
+ const l = new ut((u, f) => {
1562
+ 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());
1549
1563
  }, "solid");
1550
- let r = !1, c = !1, h = 0, p = 0;
1564
+ let r = !1, c = !1, p = 0, d = 0;
1551
1565
  const g = (u) => {
1552
- r = !0, c = !1, h = u.clientX, p = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", f), document.addEventListener("mouseup", m), u.preventDefault(), u.stopPropagation();
1553
- }, f = (u) => {
1566
+ r = !0, c = !1, p = u.clientX, d = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", C), document.addEventListener("mouseup", m), u.preventDefault(), u.stopPropagation();
1567
+ }, C = (u) => {
1554
1568
  if (!r || !this.value) return;
1555
- const v = u.clientX - h;
1556
- if (Math.abs(v) > 3 && (c = !0), c) {
1569
+ const f = u.clientX - p;
1570
+ if (Math.abs(f) > 3 && (c = !0), c) {
1557
1571
  this.clearGlobalBindingForCustomChange();
1558
- const C = e.getBoundingClientRect();
1559
- let y = p + v / C.width * 100;
1572
+ const v = e.getBoundingClientRect();
1573
+ let y = d + f / v.width * 100;
1560
1574
  y = Math.max(0, Math.min(100, y)), this.value.stops[s].position = Math.round(y), n.style.left = `${y}%`, this.updateGradientPreview();
1561
1575
  }
1562
1576
  }, m = (u) => {
1563
- var v;
1577
+ var f;
1564
1578
  if (r)
1565
- if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", m), c)
1566
- this.value && (this.value.stops.sort((C, y) => C.position - y.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
1579
+ if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", C), document.removeEventListener("mouseup", m), c)
1580
+ this.value && (this.value.stops.sort((v, y) => v.position - y.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
1567
1581
  else {
1568
1582
  u.stopPropagation();
1569
- const C = (v = this.value) == null ? void 0 : v.stops[s];
1570
- C && setTimeout(() => {
1571
- const y = this.resolveGlobalVarColor(C.color);
1572
- l.open(y, o, C.opacity ?? 100);
1583
+ const v = (f = this.value) == null ? void 0 : f.stops[s];
1584
+ v && setTimeout(() => {
1585
+ const y = this.resolveGlobalVarColor(v.color);
1586
+ l.open(y, o, v.opacity ?? 100);
1573
1587
  }, 0);
1574
1588
  }
1575
1589
  };
@@ -1580,7 +1594,7 @@ const V = class V extends x {
1580
1594
  var i;
1581
1595
  const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-stops"));
1582
1596
  !e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
1583
- var L, I;
1597
+ var L, N;
1584
1598
  const o = document.createElement("div");
1585
1599
  o.className = "gstop-row";
1586
1600
  const a = document.createElement("div");
@@ -1589,50 +1603,50 @@ const V = class V extends x {
1589
1603
  l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px", a.appendChild(l);
1590
1604
  const r = document.createElement("div");
1591
1605
  r.className = "gstop-color-container";
1592
- const c = this.resolveGlobalVarColor(s.color), h = document.createElement("div");
1593
- h.className = "gstop-color-preview", h.style.backgroundColor = c;
1594
- const p = document.createElement("input");
1595
- p.type = "text", p.className = "gstop-color-input", p.value = c.replace("#", "").toUpperCase();
1606
+ const c = this.resolveGlobalVarColor(s.color), p = document.createElement("div");
1607
+ p.className = "gstop-color-preview", p.style.backgroundColor = c;
1608
+ const d = document.createElement("input");
1609
+ d.type = "text", d.className = "gstop-color-input", d.value = c.replace("#", "").toUpperCase();
1596
1610
  const g = document.createElement("button");
1597
- g.type = "button", g.className = "gstop-color-copy", g.textContent = "Copy", r.appendChild(h), r.appendChild(p), r.appendChild(g);
1598
- const f = document.createElement("button");
1599
- f.type = "button", f.className = "gstop-del", f.innerHTML = Pt, f.disabled = (((I = (L = this.value) == null ? void 0 : L.stops) == null ? void 0 : I.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(f), e.appendChild(o);
1611
+ g.type = "button", g.className = "gstop-color-copy", g.textContent = "Copy", r.appendChild(p), r.appendChild(d), r.appendChild(g);
1612
+ const C = document.createElement("button");
1613
+ C.type = "button", C.className = "gstop-del", C.innerHTML = Pt, C.disabled = (((N = (L = this.value) == null ? void 0 : L.stops) == null ? void 0 : N.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(C), e.appendChild(o);
1600
1614
  const m = document.createElement("span");
1601
1615
  m.className = "gstop-opacity-label", m.textContent = "Opacity";
1602
1616
  const u = document.createElement("div");
1603
1617
  u.className = "gstop-opacity-group";
1604
- const v = document.createElement("input");
1605
- v.type = "range", v.className = "gstop-opacity-slider", v.min = "0", v.max = "100", v.value = String(s.opacity ?? 100);
1606
- const C = P(c);
1607
- v.style.setProperty("--slider-color", `rgb(${C.r}, ${C.g}, ${C.b})`);
1618
+ const f = document.createElement("input");
1619
+ f.type = "range", f.className = "gstop-opacity-slider", f.min = "0", f.max = "100", f.value = String(s.opacity ?? 100);
1620
+ const v = P(c);
1621
+ f.style.setProperty("--slider-color", `rgb(${v.r}, ${v.g}, ${v.b})`);
1608
1622
  const y = document.createElement("span");
1609
- y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, u.appendChild(v), u.appendChild(y);
1623
+ y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, u.appendChild(f), u.appendChild(y);
1610
1624
  const b = new ut((E, w) => {
1611
- this.clearGlobalBindingForCustomChange(), p.value = E.replace("#", "").toUpperCase(), h.style.backgroundColor = E, this.value.stops[n].color = E, w !== void 0 && (this.value.stops[n].opacity = w, v.value = String(w), y.textContent = `${w}%`);
1612
- const N = P(E);
1613
- v.style.setProperty("--slider-color", `rgb(${N.r}, ${N.g}, ${N.b})`), this.updateGradientPreview(), this.createHandles(
1625
+ this.clearGlobalBindingForCustomChange(), d.value = E.replace("#", "").toUpperCase(), p.style.backgroundColor = E, this.value.stops[n].color = E, w !== void 0 && (this.value.stops[n].opacity = w, f.value = String(w), y.textContent = `${w}%`);
1626
+ const I = P(E);
1627
+ f.style.setProperty("--slider-color", `rgb(${I.r}, ${I.g}, ${I.b})`), this.updateGradientPreview(), this.createHandles(
1614
1628
  this.popoverEl.querySelector(".gradient-handles"),
1615
1629
  this.popoverEl.querySelector(".gradient-preview")
1616
1630
  ), this.updateUI(), this.triggerChange();
1617
1631
  }, "solid");
1618
- p.addEventListener("click", (E) => {
1632
+ d.addEventListener("click", (E) => {
1619
1633
  E.preventDefault(), E.stopPropagation();
1620
1634
  const w = this.resolveGlobalVarColor(s.color);
1621
- b.open(w, p, s.opacity ?? 100);
1622
- }), p.addEventListener("input", () => {
1635
+ b.open(w, d, s.opacity ?? 100);
1636
+ }), d.addEventListener("input", () => {
1623
1637
  this.clearGlobalBindingForCustomChange();
1624
- const E = p.value.trim(), w = E.startsWith("#") ? E : `#${E}`;
1638
+ const E = d.value.trim(), w = E.startsWith("#") ? E : `#${E}`;
1625
1639
  if (/^#[0-9A-Fa-f]{6}$/.test(w)) {
1626
- this.value.stops[n].color = w, h.style.backgroundColor = w;
1627
- const N = P(w);
1628
- v.style.setProperty("--slider-color", `rgb(${N.r}, ${N.g}, ${N.b})`), this.debouncedPreviewUpdate();
1640
+ this.value.stops[n].color = w, p.style.backgroundColor = w;
1641
+ const I = P(w);
1642
+ f.style.setProperty("--slider-color", `rgb(${I.r}, ${I.g}, ${I.b})`), this.debouncedPreviewUpdate();
1629
1643
  }
1630
- }), p.addEventListener("blur", () => {
1644
+ }), d.addEventListener("blur", () => {
1631
1645
  this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
1632
1646
  }), g.addEventListener("click", async (E) => {
1633
1647
  E.stopPropagation();
1634
1648
  try {
1635
- await navigator.clipboard.writeText(`#${p.value}`);
1649
+ await navigator.clipboard.writeText(`#${d.value}`);
1636
1650
  } catch {
1637
1651
  }
1638
1652
  }), l.addEventListener("focus", (E) => {
@@ -1640,35 +1654,35 @@ const V = class V extends x {
1640
1654
  w.value = w.value.replace("%", ""), w.select();
1641
1655
  }), l.addEventListener("input", (E) => {
1642
1656
  this.clearGlobalBindingForCustomChange();
1643
- const w = E.target, N = parseInt(w.value.replace(/[^\d]/g, ""), 10);
1644
- if (!Number.isNaN(N)) {
1645
- const D = Math.max(0, Math.min(100, N));
1657
+ const w = E.target, I = parseInt(w.value.replace(/[^\d]/g, ""), 10);
1658
+ if (!Number.isNaN(I)) {
1659
+ const D = Math.max(0, Math.min(100, I));
1646
1660
  this.value.stops[n].position = D, w.value = `${D}%`, this.debouncedPreviewUpdate();
1647
1661
  }
1648
1662
  }), l.addEventListener("blur", (E) => {
1649
1663
  this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
1650
- const w = E.target, N = parseInt(w.value.replace(/[^\d]/g, ""), 10);
1651
- if (Number.isNaN(N))
1664
+ const w = E.target, I = parseInt(w.value.replace(/[^\d]/g, ""), 10);
1665
+ if (Number.isNaN(I))
1652
1666
  w.value = `${this.value.stops[n].position}%`;
1653
1667
  else {
1654
- const D = Math.max(0, Math.min(100, N));
1668
+ const D = Math.max(0, Math.min(100, I));
1655
1669
  this.value.stops[n].position = D, w.value = `${D}%`;
1656
1670
  }
1657
1671
  this.updateGradientPreview(), this.createHandles(
1658
1672
  this.popoverEl.querySelector(".gradient-handles"),
1659
1673
  this.popoverEl.querySelector(".gradient-preview")
1660
1674
  ), this.updateStopsList(), this.updateUI(), this.triggerChange();
1661
- }), f.addEventListener("click", () => {
1675
+ }), C.addEventListener("click", () => {
1662
1676
  var E;
1663
1677
  (this.value.stops.length || 0) <= 2 || (this.clearGlobalBindingForCustomChange(), this.value.stops.splice(n, 1), this.createHandles(
1664
1678
  this.popoverEl.querySelector(".gradient-handles"),
1665
1679
  this.popoverEl.querySelector(".gradient-preview")
1666
1680
  ), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((E = document.activeElement) == null ? void 0 : E.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
1667
- }), v.addEventListener("input", () => {
1681
+ }), f.addEventListener("input", () => {
1668
1682
  this.clearGlobalBindingForCustomChange();
1669
- const E = parseInt(v.value, 10);
1683
+ const E = parseInt(f.value, 10);
1670
1684
  this.value.stops[n].opacity = Math.max(0, Math.min(100, E)), y.textContent = `${this.value.stops[n].opacity}%`, this.debouncedPreviewUpdate();
1671
- }), v.addEventListener("change", () => {
1685
+ }), f.addEventListener("change", () => {
1672
1686
  this.clearGlobalBindingForCustomChange(), this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
1673
1687
  });
1674
1688
  }));
@@ -1697,10 +1711,10 @@ const V = class V extends x {
1697
1711
  this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
1698
1712
  const o = this.popoverEl.offsetHeight;
1699
1713
  let a = t.right + 8, l = t.top;
1700
- const r = i - t.right, c = t.left, h = e + n;
1701
- r < h && c > r + 100 && (a = t.left - e - 8);
1702
- const p = s - t.bottom, g = t.top;
1703
- 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 };
1714
+ const r = i - t.right, c = t.left, p = e + n;
1715
+ r < p && c > r + 100 && (a = t.left - e - 8);
1716
+ const d = s - t.bottom, g = t.top;
1717
+ g >= o + n ? l = t.top - o - 8 : d >= o + n ? l = t.bottom + 8 : g > 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 };
1704
1718
  }
1705
1719
  setTimeout(() => document.addEventListener("click", this.onBackgroundClick, !0), 200), document.addEventListener("keydown", this.handlePopoverKeydown, !0);
1706
1720
  }
@@ -1718,10 +1732,10 @@ const V = class V extends x {
1718
1732
  this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
1719
1733
  const a = this.popoverEl.offsetHeight;
1720
1734
  let l = e.right + 8, r = e.top;
1721
- const c = s - e.right, h = e.left, p = i + o;
1722
- c < p && h > c + 100 && (l = e.left - i - 8);
1723
- const g = n - e.bottom, f = e.top;
1724
- f >= a + o ? r = e.top - a - 8 : g >= a + o ? r = e.bottom + 8 : f > 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`;
1735
+ const c = s - e.right, p = e.left, d = i + o;
1736
+ c < d && p > c + 100 && (l = e.left - i - 8);
1737
+ const g = n - e.bottom, C = e.top;
1738
+ C >= a + o ? r = e.top - a - 8 : g >= a + o ? r = e.bottom + 8 : C > 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`;
1725
1739
  });
1726
1740
  }
1727
1741
  }
@@ -1740,13 +1754,13 @@ const V = class V extends x {
1740
1754
  if (!(!this.popoverEl || !this.isPopoverOpen)) {
1741
1755
  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") {
1742
1756
  const e = S(this.value);
1743
- F.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
1757
+ R.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
1744
1758
  }
1745
1759
  this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), V.openInstance === this && (V.openInstance = null);
1746
1760
  }
1747
1761
  }
1748
1762
  commitPendingSolidColor() {
1749
- this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : F.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
1763
+ this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : R.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
1750
1764
  }
1751
1765
  handlePaste(t) {
1752
1766
  var i;
@@ -1796,10 +1810,10 @@ const V = class V extends x {
1796
1810
  };
1797
1811
  V.openInstance = null, V.CHANGE_DEBOUNCE_DELAY = 150;
1798
1812
  let j = V;
1799
- function J(d, t) {
1800
- for (const e in d)
1801
- if (Object.prototype.hasOwnProperty.call(d, e)) {
1802
- const i = d[e];
1813
+ function J(h, t) {
1814
+ for (const e in h)
1815
+ if (Object.prototype.hasOwnProperty.call(h, e)) {
1816
+ const i = h[e];
1803
1817
  t(e, i);
1804
1818
  }
1805
1819
  }
@@ -1820,6 +1834,14 @@ const Q = class Q {
1820
1834
  setNestingLevel(t) {
1821
1835
  this.nestingLevel = t, this.propagateNestingLevel(), this.elementRef && this.updateNestingStyles();
1822
1836
  }
1837
+ setTitle(t) {
1838
+ if (this.title = t, this.elementRef) {
1839
+ const e = this.elementRef.querySelector(
1840
+ ".setting-group-title h3"
1841
+ );
1842
+ e && (e.textContent = t);
1843
+ }
1844
+ }
1823
1845
  getDataPropsPath() {
1824
1846
  return this.dataPropsPath;
1825
1847
  }
@@ -1897,16 +1919,16 @@ const Q = class Q {
1897
1919
  }), s.forEach((r) => {
1898
1920
  n.includes(r) || this.removeSetting(r);
1899
1921
  }), n.forEach((r) => {
1900
- var p;
1901
- const c = t[r], h = this.settings[r];
1902
- if (h !== c && (h && this.removeSetting(r), this.addSetting(r, c), i && r in o)) {
1922
+ var d;
1923
+ const c = t[r], p = this.settings[r];
1924
+ if (p !== c && (p && this.removeSetting(r), this.addSetting(r, c), i && r in o)) {
1903
1925
  const g = o[r];
1904
1926
  try {
1905
1927
  k(c) ? c.setValue(
1906
1928
  g
1907
- ) : G(c) ? (p = c.setValue) == null || p.call(c, g) : c.setValue && c.setValue(g);
1908
- } catch (f) {
1909
- console.warn(`Could not preserve value for setting ${r}:`, f);
1929
+ ) : G(c) ? (d = c.setValue) == null || d.call(c, g) : c.setValue && c.setValue(g);
1930
+ } catch (C) {
1931
+ console.warn(`Could not preserve value for setting ${r}:`, C);
1910
1932
  }
1911
1933
  }
1912
1934
  }), this.settings = t, this.propagateNestingLevel(), this.propagateDataPropsPath();
@@ -2037,8 +2059,8 @@ const Q = class Q {
2037
2059
  k(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
2038
2060
  const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
2039
2061
  if (l) {
2040
- const h = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
2041
- h && t.startsWith(h) && this.addDeleteButtonToElement(a, t);
2062
+ const p = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
2063
+ p && t.startsWith(p) && this.addDeleteButtonToElement(a, t);
2042
2064
  }
2043
2065
  const r = o.querySelector(".sg-add-button-bottom");
2044
2066
  r ? o.insertBefore(a, r) : o.appendChild(a), rt.trackElement(a), Z(a, this.nestingLevel + 1), et(a, this.nestingLevel + 1);
@@ -2190,11 +2212,11 @@ const Q = class Q {
2190
2212
  r(), t(!1);
2191
2213
  }), l.addEventListener("click", () => {
2192
2214
  r(), t(!0);
2193
- }), e.addEventListener("click", (h) => {
2194
- h.target === e && (r(), t(!1));
2215
+ }), e.addEventListener("click", (p) => {
2216
+ p.target === e && (r(), t(!1));
2195
2217
  });
2196
- const c = (h) => {
2197
- h.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", c));
2218
+ const c = (p) => {
2219
+ p.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", c));
2198
2220
  };
2199
2221
  document.addEventListener("keydown", c), o.appendChild(a), o.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(o), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
2200
2222
  e.style.opacity = "1", i.style.transform = "scale(1)";
@@ -2338,14 +2360,14 @@ const Q = class Q {
2338
2360
  }, Object.keys(this.settings).length > 0) {
2339
2361
  for (const c in this.settings)
2340
2362
  if (Object.prototype.hasOwnProperty.call(this.settings, c)) {
2341
- const h = this.settings[c];
2342
- k(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.nestingLevel + 1);
2343
- const p = h.draw();
2344
- k(h) && h.deleteItemCfg && this.addDeleteButtonToElement(
2345
- p,
2363
+ const p = this.settings[c];
2364
+ k(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.nestingLevel + 1);
2365
+ const d = p.draw();
2366
+ k(p) && p.deleteItemCfg && this.addDeleteButtonToElement(
2367
+ d,
2346
2368
  c,
2347
- h
2348
- ), a.appendChild(p);
2369
+ p
2370
+ ), a.appendChild(d);
2349
2371
  }
2350
2372
  } else {
2351
2373
  const c = document.createElement("div");
@@ -2354,18 +2376,18 @@ const Q = class Q {
2354
2376
  if (this.addItemCfg) {
2355
2377
  const c = document.createElement("button");
2356
2378
  c.type = "button", c.className = "sg-add-button-bottom", c.style.marginTop = "8px";
2357
- const h = `
2379
+ const p = `
2358
2380
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
2359
2381
  xmlns="http://www.w3.org/2000/svg">
2360
2382
  <path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
2361
2383
  stroke-width="1.5" stroke-linecap="round"/>
2362
2384
  </svg>`;
2363
- c.innerHTML = `${h}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (p) => {
2364
- p.stopPropagation(), p.preventDefault();
2365
- const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), f = this.addItemCfg.createItem(g);
2366
- if (ct(f)) {
2385
+ c.innerHTML = `${p}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (d) => {
2386
+ d.stopPropagation(), d.preventDefault();
2387
+ const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), C = this.addItemCfg.createItem(g);
2388
+ if (ct(C)) {
2367
2389
  const m = `${this.addItemCfg.keyPrefix}${g}`;
2368
- this.addSetting(m, f);
2390
+ this.addSetting(m, C);
2369
2391
  }
2370
2392
  }), a.appendChild(c);
2371
2393
  }
@@ -2413,8 +2435,8 @@ const Q = class Q {
2413
2435
  };
2414
2436
  Q.hiddenElements = /* @__PURE__ */ new Set();
2415
2437
  let $ = Q;
2416
- function be(d) {
2417
- return new At(d);
2438
+ function be(h) {
2439
+ return new At(h);
2418
2440
  }
2419
2441
  class At extends $ {
2420
2442
  constructor(t) {
@@ -2466,9 +2488,9 @@ class At extends $ {
2466
2488
  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);
2467
2489
  const c = document.createElement("div");
2468
2490
  c.className = "tab-panel", this.contentContainers[a] = c;
2469
- const h = this.settings[a];
2470
- h && (k(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.getNestingLevel() + 1), c.appendChild(
2471
- h.draw()
2491
+ const p = this.settings[a];
2492
+ p && (k(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.getNestingLevel() + 1), c.appendChild(
2493
+ p.draw()
2472
2494
  )), o.appendChild(c), l === 0 && !this.activeTabId && (this.activeTabId = a);
2473
2495
  }), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
2474
2496
  const a = Object.keys(this.settings)[0];
@@ -2477,11 +2499,11 @@ class At extends $ {
2477
2499
  return this.updateTabUI(), t;
2478
2500
  }
2479
2501
  }
2480
- function Dt(d) {
2481
- return new $(d);
2502
+ function Dt(h) {
2503
+ return new $(h);
2482
2504
  }
2483
- function we(d) {
2484
- return d;
2505
+ function we(h) {
2506
+ return h;
2485
2507
  }
2486
2508
  class Gt extends x {
2487
2509
  constructor(t = {}) {
@@ -2524,8 +2546,8 @@ class O extends Gt {
2524
2546
  if (e.length !== 3 || e.some(isNaN))
2525
2547
  return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
2526
2548
  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 = (c) => {
2527
- const h = c.toString(16);
2528
- return h.length === 1 ? "0" + h : h;
2549
+ const p = c.toString(16);
2550
+ return p.length === 1 ? "0" + p : p;
2529
2551
  };
2530
2552
  return `#${r(o)}${r(a)}${r(l)}`;
2531
2553
  }
@@ -2585,16 +2607,16 @@ class O extends Gt {
2585
2607
  u.textContent = "No global colors defined", u.style.gridColumn = "1 / -1", u.style.fontSize = "12px", u.style.color = "#666", a.appendChild(u);
2586
2608
  return;
2587
2609
  }
2588
- Object.entries(m).forEach(([u, v]) => {
2589
- const C = document.createElement("button");
2590
- 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 = v, C.style.cursor = "pointer", this.value === `var(--${u})` && (C.style.border = "2px solid #2196f3"), C.addEventListener("click", (y) => {
2591
- var L, I;
2610
+ Object.entries(m).forEach(([u, f]) => {
2611
+ const v = document.createElement("button");
2612
+ v.className = "global-color-btn", v.title = u, 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(--${u})` && (v.style.border = "2px solid #2196f3"), v.addEventListener("click", (y) => {
2613
+ var L, N;
2592
2614
  y.preventDefault();
2593
2615
  const b = `var(--${u})`;
2594
- this.value = b, (L = this.onChange) == null || L.call(this, b), (I = this.detectChange) == null || I.call(this, b), Array.from(a.children).forEach((E) => {
2616
+ this.value = b, (L = this.onChange) == null || L.call(this, b), (N = this.detectChange) == null || N.call(this, b), Array.from(a.children).forEach((E) => {
2595
2617
  E.style.border = "1px solid #ddd";
2596
- }), C.style.border = "2px solid #2196f3", h.style.backgroundColor = v;
2597
- }), a.appendChild(C);
2618
+ }), v.style.border = "2px solid #2196f3", p.style.backgroundColor = f;
2619
+ }), a.appendChild(v);
2598
2620
  });
2599
2621
  } catch (m) {
2600
2622
  console.error("ColorSetting: Error in renderGlobalOptions", m), a.innerHTML = "Error loading global options";
@@ -2609,48 +2631,48 @@ class O extends Gt {
2609
2631
  const u = m.value.trim();
2610
2632
  if (!u)
2611
2633
  return e.classList.remove("error"), !0;
2612
- const C = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(u);
2613
- return C ? e.classList.remove("error") : e.classList.add("error"), C;
2634
+ const v = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(u);
2635
+ return v ? e.classList.remove("error") : e.classList.add("error"), v;
2614
2636
  }, c = document.createElement("input");
2615
2637
  c.type = "color", c.className = "color-picker", c.value = this.value && !this.value.startsWith("var(--") ? this.value : "#000000", c.setAttribute("aria-label", "Choose color"), c.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && c.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = c;
2616
- const h = document.createElement("div");
2617
- h.className = "color-preview";
2618
- let p = this.value || "#000000";
2619
- if (p.startsWith("var(--")) {
2620
- const m = p.replace("var(--", "").replace(")", "");
2621
- p = (x.GlobalVariables || {})[m] || "#000000";
2638
+ const p = document.createElement("div");
2639
+ p.className = "color-preview";
2640
+ let d = this.value || "#000000";
2641
+ if (d.startsWith("var(--")) {
2642
+ const m = d.replace("var(--", "").replace(")", "");
2643
+ d = (x.GlobalVariables || {})[m] || "#000000";
2622
2644
  }
2623
- h.style.backgroundColor = p;
2645
+ p.style.backgroundColor = d;
2624
2646
  const g = document.createElement("input");
2625
2647
  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;
2626
- const f = (m) => {
2627
- var v, C;
2648
+ const C = (m) => {
2649
+ var f, v;
2628
2650
  let u = m.trim();
2629
2651
  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)) {
2630
2652
  const y = O.normalizeColorValue(u);
2631
- this.value = y, (v = this.onChange) == null || v.call(this, y), (C = this.detectChange) == null || C.call(this, y), this.colorInputEl && (this.colorInputEl.value = y), h.style.backgroundColor = y;
2653
+ this.value = y, (f = this.onChange) == null || f.call(this, y), (v = this.detectChange) == null || v.call(this, y), this.colorInputEl && (this.colorInputEl.value = y), p.style.backgroundColor = y;
2632
2654
  }
2633
2655
  };
2634
2656
  return this.textInputEl.addEventListener("input", (m) => {
2635
2657
  const u = m.target.value;
2636
- f(u);
2658
+ C(u);
2637
2659
  }), this.textInputEl.addEventListener("paste", (m) => {
2638
- var v;
2660
+ var f;
2639
2661
  m.preventDefault();
2640
- const u = ((v = m.clipboardData) == null ? void 0 : v.getData("text")) || "";
2641
- this.textInputEl && (this.textInputEl.value = u.trim(), f(u));
2662
+ const u = ((f = m.clipboardData) == null ? void 0 : f.getData("text")) || "";
2663
+ this.textInputEl && (this.textInputEl.value = u.trim(), C(u));
2642
2664
  }), this.textInputEl.addEventListener("keydown", (m) => {
2643
- var u, v, C;
2644
- m.key === "Enter" && (m.preventDefault(), f(((u = this.textInputEl) == null ? void 0 : u.value) || ""), (v = this.textInputEl) == null || v.blur()), m.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (C = this.textInputEl) == null || C.blur(), e.classList.remove("error"));
2665
+ var u, f, v;
2666
+ m.key === "Enter" && (m.preventDefault(), C(((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), (v = this.textInputEl) == null || v.blur(), e.classList.remove("error"));
2645
2667
  }), this.colorInputEl.addEventListener("input", (m) => {
2646
- var C, y;
2647
- const u = m.target.value, v = O.normalizeColorValue(u);
2648
- this.value = v, (C = this.onChange) == null || C.call(this, v), (y = this.detectChange) == null || y.call(this, v), this.textInputEl && (this.textInputEl.value = v), h.style.backgroundColor = v, e.classList.remove("error");
2668
+ var v, y;
2669
+ const u = m.target.value, f = O.normalizeColorValue(u);
2670
+ this.value = f, (v = this.onChange) == null || v.call(this, f), (y = this.detectChange) == null || y.call(this, f), this.textInputEl && (this.textInputEl.value = f), p.style.backgroundColor = f, e.classList.remove("error");
2649
2671
  }), this.colorInputEl.addEventListener("change", (m) => {
2650
- var C, y;
2651
- const u = m.target.value, v = O.normalizeColorValue(u);
2652
- this.value = v, (C = this.onChange) == null || C.call(this, v), (y = this.detectChange) == null || y.call(this, v), this.textInputEl && (this.textInputEl.value = v), h.style.backgroundColor = v;
2653
- }), o.appendChild(c), o.appendChild(h), o.appendChild(g), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.element = t, t;
2672
+ var v, y;
2673
+ const u = m.target.value, f = O.normalizeColorValue(u);
2674
+ this.value = f, (v = this.onChange) == null || v.call(this, f), (y = this.detectChange) == null || y.call(this, f), this.textInputEl && (this.textInputEl.value = f), p.style.backgroundColor = f;
2675
+ }), o.appendChild(c), o.appendChild(p), o.appendChild(g), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.element = t, t;
2654
2676
  }
2655
2677
  getElement() {
2656
2678
  return this.element;
@@ -2674,14 +2696,14 @@ const Rt = `
2674
2696
  <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"/>
2675
2697
  <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"/>
2676
2698
  </svg>`;
2677
- class R extends x {
2699
+ class z extends x {
2678
2700
  constructor(t = {}) {
2679
2701
  super({
2680
2702
  ...t,
2681
2703
  icon: t.icon || Rt,
2682
2704
  title: t.title || "Color & Opacity",
2683
2705
  default: t.default || "#000000FF"
2684
- }), 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 = R.normalizeHexWithOpacity(this.value));
2706
+ }), 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 = z.normalizeHexWithOpacity(this.value));
2685
2707
  }
2686
2708
  static normalizeHexWithOpacity(t) {
2687
2709
  return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length === 6 && (t = t + "FF"), t.length === 8 && /^[0-9A-Fa-f]{8}$/.test(t) ? `#${t.toUpperCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000FF"`), "#000000FF");
@@ -2699,7 +2721,7 @@ class R extends x {
2699
2721
  return `#${i}${n}`;
2700
2722
  }
2701
2723
  setValue(t) {
2702
- t === void 0 || t === "" ? this.value = "#000000FF" : this.value = R.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
2724
+ t === void 0 || t === "" ? this.value = "#000000FF" : this.value = z.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
2703
2725
  }
2704
2726
  updateInputElements() {
2705
2727
  this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
@@ -2710,7 +2732,7 @@ class R extends x {
2710
2732
  this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
2711
2733
  }
2712
2734
  handleColorChange(t) {
2713
- const e = this.getOpacityPercent(), i = R.combineColorOpacity(
2735
+ const e = this.getOpacityPercent(), i = z.combineColorOpacity(
2714
2736
  t,
2715
2737
  e
2716
2738
  );
@@ -2721,7 +2743,7 @@ class R extends x {
2721
2743
  return e || i ? (this.setValue(t), !0) : !1;
2722
2744
  }
2723
2745
  handleOpacityChange(t) {
2724
- const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = R.combineColorOpacity(
2746
+ const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = z.combineColorOpacity(
2725
2747
  e,
2726
2748
  i
2727
2749
  );
@@ -3637,33 +3659,33 @@ const Kt = `
3637
3659
  "mousemove",
3638
3660
  (c) => this.updateCursorTooltip(c)
3639
3661
  ), this.value && this.value.markers && this.value.markers.forEach((c) => {
3640
- const h = this.createMarkerElement(c);
3641
- r.appendChild(h);
3662
+ const p = this.createMarkerElement(c);
3663
+ r.appendChild(p);
3642
3664
  }), l.appendChild(r), t.appendChild(l);
3643
3665
  }
3644
3666
  renderSidebar(t) {
3645
- var c, h;
3667
+ var c, p;
3646
3668
  const e = document.createElement("div");
3647
3669
  e.className = "prize-counter";
3648
3670
  const i = this.props.maxMarkers || 10, s = ((c = this.value) == null ? void 0 : c.markers.length) || 0, n = s === i;
3649
3671
  e.textContent = `Prizes ${s}/${i}`, n && e.classList.add("complete"), t.appendChild(e);
3650
3672
  const o = document.createElement("div");
3651
3673
  o.className = "prize-list";
3652
- const a = ((h = this.value) == null ? void 0 : h.markers) || [], l = /* @__PURE__ */ new Map();
3653
- a.forEach((p) => l.set(p.index, p));
3654
- for (let p = 1; p <= i; p++) {
3655
- const g = l.get(p), f = !!g, m = (g == null ? void 0 : g.prizeName) || this.props.prizeMap && this.props.prizeMap[p - 1] || `Prize #${p}`, u = document.createElement("div");
3656
- u.className = `prize-item ${f ? "placed" : "missing"}`;
3674
+ const a = ((p = this.value) == null ? void 0 : p.markers) || [], l = /* @__PURE__ */ new Map();
3675
+ a.forEach((d) => l.set(d.index, d));
3676
+ for (let d = 1; d <= i; d++) {
3677
+ const g = l.get(d), C = !!g, m = (g == null ? void 0 : g.prizeName) || this.props.prizeMap && this.props.prizeMap[d - 1] || `Prize #${d}`, u = document.createElement("div");
3678
+ u.className = `prize-item ${C ? "placed" : "missing"}`;
3679
+ const f = document.createElement("div");
3680
+ f.className = "prize-index", f.textContent = String(d);
3657
3681
  const v = document.createElement("div");
3658
- v.className = "prize-index", v.textContent = String(p);
3659
- const C = document.createElement("div");
3660
- C.className = "prize-label";
3682
+ v.className = "prize-label";
3661
3683
  const y = document.createElement("div");
3662
- y.className = "prize-title", y.textContent = `Prize #${p}`;
3684
+ y.className = "prize-title", y.textContent = `Prize #${d}`;
3663
3685
  const b = document.createElement("div");
3664
- b.className = "prize-subtitle", b.textContent = f ? m : "Not Placed", C.appendChild(y), C.appendChild(b);
3686
+ b.className = "prize-subtitle", b.textContent = C ? m : "Not Placed", v.appendChild(y), v.appendChild(b);
3665
3687
  const L = document.createElement("div");
3666
- L.className = `prize-status ${f ? "placed" : "missing"}`, L.innerHTML = f ? ie : se, u.appendChild(v), u.appendChild(C), u.appendChild(L), o.appendChild(u);
3688
+ L.className = `prize-status ${C ? "placed" : "missing"}`, L.innerHTML = C ? ie : se, u.appendChild(f), u.appendChild(v), u.appendChild(L), o.appendChild(u);
3667
3689
  }
3668
3690
  t.appendChild(o);
3669
3691
  const r = document.createElement("button");
@@ -3716,20 +3738,20 @@ const Kt = `
3716
3738
  if (typeof a == "string") {
3717
3739
  const r = new Image();
3718
3740
  r.onload = () => {
3719
- var p;
3741
+ var d;
3720
3742
  const c = {
3721
3743
  width: r.naturalWidth || 0,
3722
3744
  height: r.naturalHeight || 0
3723
- }, h = this.scaleMarkersForNewImage(
3724
- ((p = this.value) == null ? void 0 : p.markers) || [],
3745
+ }, p = this.scaleMarkersForNewImage(
3746
+ ((d = this.value) == null ? void 0 : d.markers) || [],
3725
3747
  e,
3726
3748
  c
3727
3749
  );
3728
3750
  this.value = {
3729
3751
  imageUrl: a,
3730
- markers: h
3752
+ markers: p
3731
3753
  }, this.lastImageNaturalSize = c, this.history = [
3732
- JSON.parse(JSON.stringify(h))
3754
+ JSON.parse(JSON.stringify(p))
3733
3755
  ], this.historyIndex = 0, this.updateUndoRedoButtons(), this.updateButtonDisplay(), this.refreshPopoverContent(), this.triggerChange();
3734
3756
  }, r.onerror = () => {
3735
3757
  this.showError("Failed to read image file.");
@@ -3747,7 +3769,7 @@ const Kt = `
3747
3769
  );
3748
3770
  return;
3749
3771
  }
3750
- const e = this.imageElement.getBoundingClientRect(), i = (t.clientX - e.left) / e.width * 100, s = (t.clientY - e.top) / e.height * 100, n = this.value.markers.map((c) => c.index).sort((c, h) => c - h);
3772
+ const e = this.imageElement.getBoundingClientRect(), i = (t.clientX - e.left) / e.width * 100, s = (t.clientY - e.top) / e.height * 100, n = this.value.markers.map((c) => c.index).sort((c, p) => c - p);
3751
3773
  let o = 1;
3752
3774
  for (const c of n)
3753
3775
  if (c === o)
@@ -3955,11 +3977,11 @@ const Kt = `
3955
3977
  r.type = "button", r.className = "confirm-btn ghost", r.textContent = "Cancel";
3956
3978
  const c = document.createElement("button");
3957
3979
  c.type = "button", c.className = "confirm-btn danger", c.textContent = "Discard";
3958
- const h = (p) => {
3959
- s.remove(), this.confirmOverlayEl = null, this.confirmPromise = null, i(p);
3980
+ const p = (d) => {
3981
+ s.remove(), this.confirmOverlayEl = null, this.confirmPromise = null, i(d);
3960
3982
  };
3961
- r.addEventListener("click", () => h(!1)), c.addEventListener("click", () => h(!0)), s.addEventListener("click", (p) => {
3962
- p.target === s && h(!1);
3983
+ r.addEventListener("click", () => p(!1)), c.addEventListener("click", () => p(!0)), s.addEventListener("click", (d) => {
3984
+ d.target === s && p(!1);
3963
3985
  }), l.appendChild(r), l.appendChild(c), n.appendChild(o), n.appendChild(a), n.appendChild(l), s.appendChild(n), document.body.appendChild(s), setTimeout(() => {
3964
3986
  n.classList.add("visible");
3965
3987
  }, 10);
@@ -4170,7 +4192,7 @@ class Me extends x {
4170
4192
  ), this.updateButtonText(), this.updateOptionsList(), this.detectChangeCallback && this.detectChangeCallback !== this.props.detectChange && this.detectChangeCallback(t);
4171
4193
  }
4172
4194
  }
4173
- class Ne extends x {
4195
+ class Ie extends x {
4174
4196
  constructor(t) {
4175
4197
  var e, i;
4176
4198
  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;
@@ -4194,7 +4216,7 @@ class Ne extends x {
4194
4216
  const s = document.createElement("input");
4195
4217
  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", () => {
4196
4218
  var r, c;
4197
- const l = ((c = (r = this.props.options) == null ? void 0 : r.find((h) => h.status === s.checked)) == null ? void 0 : c.value) ?? "";
4219
+ const l = ((c = (r = this.props.options) == null ? void 0 : r.find((p) => p.status === s.checked)) == null ? void 0 : c.value) ?? "";
4198
4220
  this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
4199
4221
  });
4200
4222
  const n = document.createElement("span");
@@ -4223,7 +4245,7 @@ class Ne extends x {
4223
4245
  const ce = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
4224
4246
  <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"/>
4225
4247
  </svg>`;
4226
- class Ie extends x {
4248
+ class Ne extends x {
4227
4249
  // Store mobile value
4228
4250
  constructor(t = {}) {
4229
4251
  t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? ce, 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);
@@ -4345,13 +4367,13 @@ class Te extends x {
4345
4367
  return;
4346
4368
  }
4347
4369
  const c = "...";
4348
- let h = 0, p = e.length, g = 0;
4349
- for (; h <= p; ) {
4350
- const m = Math.floor((h + p) / 2), u = e.slice(0, m).trimEnd() + c;
4351
- this.measureTextWidth(u, i) <= l ? (g = m, h = m + 1) : p = m - 1;
4370
+ let p = 0, d = e.length, g = 0;
4371
+ for (; p <= d; ) {
4372
+ const m = Math.floor((p + d) / 2), u = e.slice(0, m).trimEnd() + c;
4373
+ this.measureTextWidth(u, i) <= l ? (g = m, p = m + 1) : d = m - 1;
4352
4374
  }
4353
- const f = e.slice(0, g).trimEnd() + c;
4354
- t.placeholder = f;
4375
+ const C = e.slice(0, g).trimEnd() + c;
4376
+ t.placeholder = C;
4355
4377
  }
4356
4378
  autosizeTextarea(t, e = 3) {
4357
4379
  t.style.height = "auto";
@@ -4860,7 +4882,7 @@ class Be extends $ {
4860
4882
  opacity: new Ut({
4861
4883
  default: (t == null ? void 0 : t.opacity) ?? 100
4862
4884
  }),
4863
- backgroundColor: new R({
4885
+ backgroundColor: new z({
4864
4886
  default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
4865
4887
  })
4866
4888
  }
@@ -4915,9 +4937,9 @@ export {
4915
4937
  Oe as BorderSettingSet,
4916
4938
  Le as ButtonSetting,
4917
4939
  O as ColorSetting,
4918
- R as ColorWithOpacitySetting,
4940
+ z as ColorWithOpacitySetting,
4919
4941
  ke as DimensionSetting,
4920
- Ie as GapSetting,
4942
+ Ne as GapSetting,
4921
4943
  j as GradientSetting,
4922
4944
  $e as HeaderTypographySettingSet,
4923
4945
  ne as HeightSetting,
@@ -4937,7 +4959,7 @@ export {
4937
4959
  Gt as StringSetting,
4938
4960
  At as TabSettingGroup,
4939
4961
  At as TabsSettingGroup,
4940
- Ne as Toggle,
4962
+ Ie as Toggle,
4941
4963
  lt as UploadSetting,
4942
4964
  ae as WidthSetting,
4943
4965
  we as asSettingGroupWithSettings,