exodeui 6.3.29 → 6.3.31

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.
Files changed (3) hide show
  1. package/dist/index.js +26 -26
  2. package/dist/index.mjs +996 -993
  3. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -40,15 +40,15 @@ function us(g) {
40
40
  lineHeight: n = 1.2,
41
41
  width: a = 200,
42
42
  letterSpacing: r = 0,
43
- paragraphSpacing: l = 0,
44
- paragraphIndent: c = 0,
43
+ paragraphSpacing: c = 0,
44
+ paragraphIndent: l = 0,
45
45
  textCase: f = "none",
46
46
  segments: u = [],
47
47
  enableSegments: h = !1
48
48
  } = g;
49
49
  let d = String(t || "");
50
50
  f === "uppercase" ? d = d.toUpperCase() : f === "lowercase" ? d = d.toLowerCase() : f === "capitalize" && (d = d.replace(/\b\w/g, (k) => k.toUpperCase())), g.hyphenation === !0 && (d = Ts(d));
51
- const p = `${s} ${e} ${o}px "${i}", sans-serif`, y = `${d}|${p}|${r}|${l}|${c}|${h}|${JSON.stringify(u)}|hyp:${!!g.hyphenation}|comp:${g.composer}|bal:${!!g.balanceRaggedLines}`;
51
+ const p = `${s} ${e} ${o}px "${i}", sans-serif`, y = `${d}|${p}|${r}|${c}|${l}|${h}|${JSON.stringify(u)}|hyp:${!!g.hyphenation}|comp:${g.composer}|bal:${!!g.balanceRaggedLines}`;
52
52
  let m = Ye.get(y);
53
53
  const b = typeof CanvasRenderingContext2D < "u" ? CanvasRenderingContext2D.prototype.measureText : null, v = function(k) {
54
54
  if (!b) return { width: 0, fontBoundingBoxAscent: 0, fontBoundingBoxDescent: 0 };
@@ -62,19 +62,19 @@ function us(g) {
62
62
  try {
63
63
  if (r !== 0 && typeof CanvasRenderingContext2D < "u" && (CanvasRenderingContext2D.prototype.measureText = v), h && u && u.length > 0) {
64
64
  const k = u.map((T) => {
65
- let R = T.text || "";
65
+ let x = T.text || "";
66
66
  const P = T.textCase || f || "none";
67
- return P === "uppercase" ? R.toUpperCase() : P === "lowercase" ? R.toLowerCase() : P === "capitalize" ? R.replace(/\b\w/g, (E) => E.toUpperCase()) : R;
67
+ return P === "uppercase" ? x.toUpperCase() : P === "lowercase" ? x.toLowerCase() : P === "capitalize" ? x.replace(/\b\w/g, (E) => E.toUpperCase()) : x;
68
68
  }).join("");
69
69
  if (m = Qe(k, p), m) {
70
- let T = 0, R = o;
70
+ let T = 0, x = o;
71
71
  for (const P of u) {
72
72
  let E = P.text || "";
73
73
  if (!E) continue;
74
- const x = P.textCase || f || "none";
75
- x === "uppercase" ? E = E.toUpperCase() : x === "lowercase" ? E = E.toLowerCase() : x === "capitalize" && (E = E.replace(/\b\w/g, ($) => $.toUpperCase()));
74
+ const R = P.textCase || f || "none";
75
+ R === "uppercase" ? E = E.toUpperCase() : R === "lowercase" ? E = E.toLowerCase() : R === "capitalize" && (E = E.replace(/\b\w/g, ($) => $.toUpperCase()));
76
76
  const O = P.fontSize || o;
77
- O > R && (R = O);
77
+ O > x && (x = O);
78
78
  const W = `${P.fontStyle || s} ${P.fontWeight || e} ${O}px "${P.fontFamily || i}", sans-serif`, B = Qe(E, W);
79
79
  if (B && B.widths)
80
80
  for (let $ = 0; $ < B.widths.length; $++) {
@@ -92,7 +92,7 @@ function us(g) {
92
92
  }
93
93
  T += E.length;
94
94
  }
95
- m.fullText = k, m.maxFontSize = R;
95
+ m.fullText = k, m.maxFontSize = x;
96
96
  }
97
97
  } else
98
98
  m = Qe(d, p);
@@ -107,12 +107,12 @@ function us(g) {
107
107
  k && Ye.delete(k);
108
108
  }
109
109
  }
110
- if (c > 0 && m && m.widths && !m.indentApplied) {
110
+ if (l > 0 && m && m.widths && !m.indentApplied) {
111
111
  const k = [...m.widths], T = m.fullText || d;
112
- let R = !0;
112
+ let x = !0;
113
113
  for (let P = 0; P < T.length; P++)
114
- R && k[P] !== void 0 && (k[P] += c, R = !1), (T[P] === `
115
- ` || T[P] === "\r") && (R = !0, T[P] === "\r" && T[P + 1] === `
114
+ x && k[P] !== void 0 && (k[P] += l, x = !1), (T[P] === `
115
+ ` || T[P] === "\r") && (x = !0, T[P] === "\r" && T[P + 1] === `
116
116
  ` && P++);
117
117
  m = { ...m, widths: k, indentApplied: !0 };
118
118
  }
@@ -125,7 +125,7 @@ function us(g) {
125
125
  if (a >= 1e5) {
126
126
  const T = d.split(/\r\n|\r|\n/);
127
127
  C = {
128
- lines: T.map((R) => ({ text: R, width: 0 })),
128
+ lines: T.map((x) => ({ text: x, width: 0 })),
129
129
  // Width will be measured below
130
130
  height: T.length * (S * k),
131
131
  lineCount: T.length
@@ -136,12 +136,12 @@ function us(g) {
136
136
  r !== 0 && b && (CanvasRenderingContext2D.prototype.measureText = b);
137
137
  }
138
138
  let w = (C == null ? void 0 : C.height) !== void 0 && C.height > 0 ? C.height : (((M = C == null ? void 0 : C.lines) == null ? void 0 : M.length) || 0) * S * o;
139
- if (l > 0 && C && C.lines && C.lines.length > 1) {
139
+ if (c > 0 && C && C.lines && C.lines.length > 1) {
140
140
  let k = 0;
141
141
  const T = m.fullText || t;
142
- for (let R = 0; R < C.lines.length - 1; R++)
143
- k += C.lines[R].text.length, (T[k] === `
144
- ` || T[k] === "\r") && (w += l, k++, T[k - 1] === "\r" && T[k] === `
142
+ for (let x = 0; x < C.lines.length - 1; x++)
143
+ k += C.lines[x].text.length, (T[k] === `
144
+ ` || T[k] === "\r") && (w += c, k++, T[k - 1] === "\r" && T[k] === `
145
145
  ` && k++);
146
146
  }
147
147
  let I = (C == null ? void 0 : C.lines) || [];
@@ -160,15 +160,15 @@ function es(g, t, i) {
160
160
  }
161
161
  const e = o.split(/\s+/).filter(Boolean), s = new Array(e.length).fill(0);
162
162
  let n = t - (e.length - 1) * i, a = 0;
163
- if (e.forEach((r, l) => {
163
+ if (e.forEach((r, c) => {
164
164
  if (r.endsWith("px")) {
165
- const c = parseFloat(r);
166
- s[l] = c, n -= c;
167
- } else r.endsWith("fr") ? a += parseFloat(r) : r === "auto" && (s[l] = 100, n -= 100);
165
+ const l = parseFloat(r);
166
+ s[c] = l, n -= l;
167
+ } else r.endsWith("fr") ? a += parseFloat(r) : r === "auto" && (s[c] = 100, n -= 100);
168
168
  }), a > 0 && n > 0) {
169
169
  const r = n / a;
170
- e.forEach((l, c) => {
171
- l.endsWith("fr") && (s[c] = r * parseFloat(l));
170
+ e.forEach((c, l) => {
171
+ c.endsWith("fr") && (s[l] = r * parseFloat(c));
172
172
  });
173
173
  }
174
174
  return s;
@@ -182,8 +182,8 @@ function ss(g, t, i) {
182
182
  }
183
183
  }
184
184
  function Es(g, t, i) {
185
- var E, x;
186
- const o = g.autoLayout, { direction: e, spacing: s, padding: n, align: a, wrap: r } = o, l = e === "vertical", c = t.map((O) => {
185
+ var E, R;
186
+ const o = g.autoLayout, { direction: e, spacing: s, padding: n, align: a, wrap: r } = o, c = e === "vertical", l = t.map((O) => {
187
187
  const W = i(O.id), B = O.geometry;
188
188
  let $ = (W == null ? void 0 : W.width) ?? B.width ?? 100, Y = (W == null ? void 0 : W.height) ?? B.height ?? 100;
189
189
  if (B.type === "Ellipse" || B.type === "Polygon" || B.type === "Star") {
@@ -210,46 +210,46 @@ function Es(g, t, i) {
210
210
  return $ *= O.transform.scale_x || 1, Y *= O.transform.scale_y || 1, { id: O.id, w: $, h: Y, original: O };
211
211
  });
212
212
  let f = g.width, u = g.height;
213
- const h = ((E = g.layoutProps) == null ? void 0 : E.width) === "hug", d = ((x = g.layoutProps) == null ? void 0 : x.height) === "hug", p = [];
213
+ const h = ((E = g.layoutProps) == null ? void 0 : E.width) === "hug", d = ((R = g.layoutProps) == null ? void 0 : R.height) === "hug", p = [];
214
214
  let y = [], m = 0, b = 0;
215
215
  const v = f - n.left - n.right, S = u - n.top - n.bottom;
216
- c.forEach((O) => {
217
- r && y.length > 0 && (l ? b + s + O.h > S : m + s + O.w > v) ? (p.push({ children: y, width: m, height: b }), y = [O], m = O.w, b = O.h) : (y.push(O), l ? (m = Math.max(m, O.w), b += (y.length > 1 ? s : 0) + O.h) : (m += (y.length > 1 ? s : 0) + O.w, b = Math.max(b, O.h)));
218
- }), y.length > 0 && p.push({ children: y, width: m, height: b }), h && !l && (f = Math.max(...p.map((O) => O.width), 0) + n.left + n.right), d && l && (u = Math.max(...p.map((O) => O.height), 0) + n.top + n.bottom);
216
+ l.forEach((O) => {
217
+ r && y.length > 0 && (c ? b + s + O.h > S : m + s + O.w > v) ? (p.push({ children: y, width: m, height: b }), y = [O], m = O.w, b = O.h) : (y.push(O), c ? (m = Math.max(m, O.w), b += (y.length > 1 ? s : 0) + O.h) : (m += (y.length > 1 ? s : 0) + O.w, b = Math.max(b, O.h)));
218
+ }), y.length > 0 && p.push({ children: y, width: m, height: b }), h && !c && (f = Math.max(...p.map((O) => O.width), 0) + n.left + n.right), d && c && (u = Math.max(...p.map((O) => O.height), 0) + n.top + n.bottom);
219
219
  const C = [];
220
220
  let w = n.left, I = n.top;
221
- const M = a.toLowerCase(), k = M === "center" || M.endsWith("-center"), T = M.endsWith("-right"), R = M === "center" || M.startsWith("center-"), P = M.startsWith("bottom-");
221
+ const M = a.toLowerCase(), k = M === "center" || M.endsWith("-center"), T = M.endsWith("-right"), x = M === "center" || M.startsWith("center-"), P = M.startsWith("bottom-");
222
222
  return p.forEach((O) => {
223
223
  let W = w, B = I;
224
- l ? R ? B = n.top + (u - n.top - n.bottom - O.height) / 2 : P && (B = u - n.bottom - O.height) : k ? W = n.left + (f - n.left - n.right - O.width) / 2 : T && (W = f - n.right - O.width), O.children.forEach(($) => {
224
+ c ? x ? B = n.top + (u - n.top - n.bottom - O.height) / 2 : P && (B = u - n.bottom - O.height) : k ? W = n.left + (f - n.left - n.right - O.width) / 2 : T && (W = f - n.right - O.width), O.children.forEach(($) => {
225
225
  var _, L;
226
226
  let Y = W, H = B;
227
- l ? k ? Y += (O.width - $.w) / 2 : T && (Y += O.width - $.w) : R ? H += (O.height - $.h) / 2 : P && (H += O.height - $.h);
227
+ c ? k ? Y += (O.width - $.w) / 2 : T && (Y += O.width - $.w) : x ? H += (O.height - $.h) / 2 : P && (H += O.height - $.h);
228
228
  const K = ((_ = $.original.layoutProps) == null ? void 0 : _.width) === "fill", A = ((L = $.original.layoutProps) == null ? void 0 : L.height) === "fill";
229
229
  C.push({
230
230
  id: $.id,
231
231
  x: Y + $.w / 2 - f / 2,
232
232
  y: H + $.h / 2 - u / 2,
233
- width: K && l ? O.width : void 0,
234
- height: A ? l ? void 0 : O.height : void 0
235
- }), l ? B += $.h + s : W += $.w + s;
236
- }), l ? w += O.width + s : I += O.height + s;
233
+ width: K && c ? O.width : void 0,
234
+ height: A ? c ? void 0 : O.height : void 0
235
+ }), c ? B += $.h + s : W += $.w + s;
236
+ }), c ? w += O.width + s : I += O.height + s;
237
237
  }), { frameWidth: h ? f : void 0, frameHeight: d ? u : void 0, childUpdates: C };
238
238
  }
239
239
  function As(g, t, i) {
240
240
  const o = g.autoLayout;
241
241
  if (!o) return { childUpdates: [] };
242
- const { gridColumns: e, gridRows: s, columnGap: n = 0, rowGap: a = 0, padding: r, align: l } = o;
243
- let c = g.width, f = g.height;
244
- const u = c - r.left - r.right, h = f - r.top - r.bottom, d = es(e || "1fr", u, n), p = es(s || "auto", h, a), y = d.length > 0 ? d.reduce((T, R) => T + R, 0) + (d.length - 1) * n : 0, m = p.length > 0 ? p.reduce((T, R) => T + R, 0) + (p.length - 1) * a : 0, b = l.toLowerCase(), v = b === "center" || b.endsWith("-center"), S = b.endsWith("-right"), C = b === "center" || b.startsWith("center-"), w = b.startsWith("bottom-");
242
+ const { gridColumns: e, gridRows: s, columnGap: n = 0, rowGap: a = 0, padding: r, align: c } = o;
243
+ let l = g.width, f = g.height;
244
+ const u = l - r.left - r.right, h = f - r.top - r.bottom, d = es(e || "1fr", u, n), p = es(s || "auto", h, a), y = d.length > 0 ? d.reduce((T, x) => T + x, 0) + (d.length - 1) * n : 0, m = p.length > 0 ? p.reduce((T, x) => T + x, 0) + (p.length - 1) * a : 0, b = c.toLowerCase(), v = b === "center" || b.endsWith("-center"), S = b.endsWith("-right"), C = b === "center" || b.startsWith("center-"), w = b.startsWith("bottom-");
245
245
  let I = 0, M = 0;
246
246
  v ? I = (u - y) / 2 : S && (I = u - y), C ? M = (h - m) / 2 : w && (M = h - m);
247
247
  const k = [];
248
- return t.forEach((T, R) => {
248
+ return t.forEach((T, x) => {
249
249
  var L, X;
250
- const P = R % d.length || 0, E = Math.floor(R / d.length) || 0;
250
+ const P = x % d.length || 0, E = Math.floor(x / d.length) || 0;
251
251
  E >= p.length && p.push(100);
252
- const x = d[P], O = p[E];
252
+ const R = d[P], O = p[E];
253
253
  let W = r.left + I + d.slice(0, P).reduce((V, it) => V + it + n, 0), B = r.top + M + p.slice(0, E).reduce((V, it) => V + it + a, 0);
254
254
  const $ = i(T.id), Y = T.geometry;
255
255
  let H = ($ == null ? void 0 : $.width) ?? Y.width ?? 100, K = ($ == null ? void 0 : $.height) ?? Y.height ?? 100;
@@ -259,11 +259,11 @@ function As(g, t, i) {
259
259
  }
260
260
  H *= T.transform.scale_x || 1, K *= T.transform.scale_y || 1;
261
261
  let A = W, _ = B;
262
- v ? A += (x - H) / 2 : S && (A += x - H), C ? _ += (O - K) / 2 : w && (_ += O - K), k.push({
262
+ v ? A += (R - H) / 2 : S && (A += R - H), C ? _ += (O - K) / 2 : w && (_ += O - K), k.push({
263
263
  id: T.id,
264
- x: A + H / 2 - c / 2,
264
+ x: A + H / 2 - l / 2,
265
265
  y: _ + K / 2 - f / 2,
266
- width: ((L = T.layoutProps) == null ? void 0 : L.width) === "fill" ? x : void 0,
266
+ width: ((L = T.layoutProps) == null ? void 0 : L.width) === "fill" ? R : void 0,
267
267
  height: ((X = T.layoutProps) == null ? void 0 : X.height) === "fill" ? O : void 0
268
268
  });
269
269
  }), { childUpdates: k };
@@ -404,8 +404,8 @@ class Os {
404
404
  const e = new Jt.Vector2(t.anchorA.x, t.anchorA.y), s = new Jt.Vector2(t.anchorB.x, t.anchorB.y);
405
405
  let n;
406
406
  if (t.type === "Distance") {
407
- const a = t.length ?? 100, r = t.stiffness ?? 100, l = t.damping ?? 10;
408
- n = Jt.JointData.spring(a, r, l, e, s);
407
+ const a = t.length ?? 100, r = t.stiffness ?? 100, c = t.damping ?? 10;
408
+ n = Jt.JointData.spring(a, r, c, e, s);
409
409
  } else
410
410
  n = Jt.JointData.revolute(e, s);
411
411
  try {
@@ -427,21 +427,21 @@ class Os {
427
427
  }
428
428
  }
429
429
  }
430
- const ps = (g) => g, Rs = (g) => g > 0 ? 1 : 0, xs = (g) => g < 1 ? 0 : 1, is = (g) => g * g, ns = (g) => g * (2 - g), os = (g) => g < 0.5 ? 2 * g * g : -1 + (4 - 2 * g) * g, Ls = (g) => g * g * g, Fs = (g) => --g * g * g + 1, $s = (g) => g < 0.5 ? 4 * g * g * g : (g - 1) * (2 * g - 2) * (2 * g - 2) + 1, Ws = (g) => g * g * g * g, Bs = (g) => 1 - --g * g * g * g, Ys = (g) => g < 0.5 ? 8 * g * g * g * g : 1 - 8 * --g * g * g * g, Xs = (g) => g * g * g * g * g, Gs = (g) => 1 + --g * g * g * g * g, Ds = (g) => g < 0.5 ? 16 * g * g * g * g * g : 1 + 16 * --g * g * g * g * g, zs = (g) => 1 - Math.cos(g * Math.PI / 2), Vs = (g) => Math.sin(g * Math.PI / 2), Ns = (g) => -(Math.cos(Math.PI * g) - 1) / 2, Hs = (g) => g === 0 ? 0 : Math.pow(2, 10 * (g - 1)), Us = (g) => g === 1 ? 1 : 1 - Math.pow(2, -10 * g), qs = (g) => g === 0 ? 0 : g === 1 ? 1 : g < 0.5 ? Math.pow(2, 20 * g - 10) / 2 : (2 - Math.pow(2, -20 * g + 10)) / 2, Js = (g) => 1 - Math.sqrt(1 - g * g), Qs = (g) => Math.sqrt(1 - --g * g), Ks = (g) => g < 0.5 ? (1 - Math.sqrt(1 - 4 * g * g)) / 2 : (Math.sqrt(1 - (-2 * g + 2) * (-2 * g + 2)) + 1) / 2, Je = 1.70158, He = Je * 1.525, gs = Je + 1, Zs = (g) => gs * g * g * g - Je * g * g, js = (g) => 1 + gs * Math.pow(g - 1, 3) + Je * Math.pow(g - 1, 2), ti = (g) => g < 0.5 ? Math.pow(2 * g, 2) * ((He + 1) * 2 * g - He) / 2 : (Math.pow(2 * g - 2, 2) * ((He + 1) * (g * 2 - 2) + He) + 2) / 2, ms = 2 * Math.PI / 3, as = 2 * Math.PI / 4.5, ei = (g) => g === 0 ? 0 : g === 1 ? 1 : -Math.pow(2, 10 * g - 10) * Math.sin((g * 10 - 10.75) * ms), si = (g) => g === 0 ? 0 : g === 1 ? 1 : Math.pow(2, -10 * g) * Math.sin((g * 10 - 0.75) * ms) + 1, ii = (g) => g === 0 ? 0 : g === 1 ? 1 : g < 0.5 ? -(Math.pow(2, 20 * g - 10) * Math.sin((20 * g - 11.125) * as)) / 2 : Math.pow(2, -20 * g + 10) * Math.sin((20 * g - 11.125) * as) / 2 + 1, qe = (g) => g < 1 / 2.75 ? 7.5625 * g * g : g < 2 / 2.75 ? 7.5625 * (g -= 1.5 / 2.75) * g + 0.75 : g < 2.5 / 2.75 ? 7.5625 * (g -= 2.25 / 2.75) * g + 0.9375 : 7.5625 * (g -= 2.625 / 2.75) * g + 0.984375, ni = (g) => 1 - qe(1 - g), oi = qe, ai = (g) => g < 0.5 ? (1 - qe(1 - 2 * g)) / 2 : (1 + qe(2 * g - 1)) / 2, Ke = /* @__PURE__ */ new Map(), Xe = (g, t, i, o) => {
430
+ const ps = (g) => g, xs = (g) => g > 0 ? 1 : 0, Rs = (g) => g < 1 ? 0 : 1, is = (g) => g * g, ns = (g) => g * (2 - g), os = (g) => g < 0.5 ? 2 * g * g : -1 + (4 - 2 * g) * g, Ls = (g) => g * g * g, Fs = (g) => --g * g * g + 1, $s = (g) => g < 0.5 ? 4 * g * g * g : (g - 1) * (2 * g - 2) * (2 * g - 2) + 1, Ws = (g) => g * g * g * g, Bs = (g) => 1 - --g * g * g * g, Ys = (g) => g < 0.5 ? 8 * g * g * g * g : 1 - 8 * --g * g * g * g, Xs = (g) => g * g * g * g * g, Gs = (g) => 1 + --g * g * g * g * g, Ds = (g) => g < 0.5 ? 16 * g * g * g * g * g : 1 + 16 * --g * g * g * g * g, zs = (g) => 1 - Math.cos(g * Math.PI / 2), Vs = (g) => Math.sin(g * Math.PI / 2), Ns = (g) => -(Math.cos(Math.PI * g) - 1) / 2, Hs = (g) => g === 0 ? 0 : Math.pow(2, 10 * (g - 1)), Us = (g) => g === 1 ? 1 : 1 - Math.pow(2, -10 * g), qs = (g) => g === 0 ? 0 : g === 1 ? 1 : g < 0.5 ? Math.pow(2, 20 * g - 10) / 2 : (2 - Math.pow(2, -20 * g + 10)) / 2, Js = (g) => 1 - Math.sqrt(1 - g * g), Qs = (g) => Math.sqrt(1 - --g * g), Ks = (g) => g < 0.5 ? (1 - Math.sqrt(1 - 4 * g * g)) / 2 : (Math.sqrt(1 - (-2 * g + 2) * (-2 * g + 2)) + 1) / 2, Je = 1.70158, He = Je * 1.525, gs = Je + 1, Zs = (g) => gs * g * g * g - Je * g * g, js = (g) => 1 + gs * Math.pow(g - 1, 3) + Je * Math.pow(g - 1, 2), ti = (g) => g < 0.5 ? Math.pow(2 * g, 2) * ((He + 1) * 2 * g - He) / 2 : (Math.pow(2 * g - 2, 2) * ((He + 1) * (g * 2 - 2) + He) + 2) / 2, ms = 2 * Math.PI / 3, as = 2 * Math.PI / 4.5, ei = (g) => g === 0 ? 0 : g === 1 ? 1 : -Math.pow(2, 10 * g - 10) * Math.sin((g * 10 - 10.75) * ms), si = (g) => g === 0 ? 0 : g === 1 ? 1 : Math.pow(2, -10 * g) * Math.sin((g * 10 - 0.75) * ms) + 1, ii = (g) => g === 0 ? 0 : g === 1 ? 1 : g < 0.5 ? -(Math.pow(2, 20 * g - 10) * Math.sin((20 * g - 11.125) * as)) / 2 : Math.pow(2, -20 * g + 10) * Math.sin((20 * g - 11.125) * as) / 2 + 1, qe = (g) => g < 1 / 2.75 ? 7.5625 * g * g : g < 2 / 2.75 ? 7.5625 * (g -= 1.5 / 2.75) * g + 0.75 : g < 2.5 / 2.75 ? 7.5625 * (g -= 2.25 / 2.75) * g + 0.9375 : 7.5625 * (g -= 2.625 / 2.75) * g + 0.984375, ni = (g) => 1 - qe(1 - g), oi = qe, ai = (g) => g < 0.5 ? (1 - qe(1 - 2 * g)) / 2 : (1 + qe(2 * g - 1)) / 2, Ke = /* @__PURE__ */ new Map(), Xe = (g, t, i, o) => {
431
431
  const e = `${g},${t},${i},${o}`;
432
432
  if (Ke.has(e)) return Ke.get(e);
433
- const s = (c) => (1 - 3 * i + 3 * g) * c * c * c + (3 * i - 6 * g) * c * c + 3 * g * c, n = (c) => (1 - 3 * o + 3 * t) * c * c * c + (3 * o - 6 * t) * c * c + 3 * t * c, a = (c) => 3 * (1 - 3 * i + 3 * g) * c * c + 2 * (3 * i - 6 * g) * c + 3 * g, r = (c) => {
434
- let f = c;
433
+ const s = (l) => (1 - 3 * i + 3 * g) * l * l * l + (3 * i - 6 * g) * l * l + 3 * g * l, n = (l) => (1 - 3 * o + 3 * t) * l * l * l + (3 * o - 6 * t) * l * l + 3 * t * l, a = (l) => 3 * (1 - 3 * i + 3 * g) * l * l + 2 * (3 * i - 6 * g) * l + 3 * g, r = (l) => {
434
+ let f = l;
435
435
  for (let u = 0; u < 8; u++) {
436
- const h = s(f) - c;
436
+ const h = s(f) - l;
437
437
  if (Math.abs(h) < 1e-6) return f;
438
438
  const d = a(f);
439
439
  if (Math.abs(d) < 1e-6) break;
440
440
  f = f - h / d;
441
441
  }
442
442
  return f;
443
- }, l = (c) => c === 0 ? 0 : c === 1 ? 1 : n(r(c));
444
- return Ke.set(e, l), l;
443
+ }, c = (l) => l === 0 ? 0 : l === 1 ? 1 : n(r(l));
444
+ return Ke.set(e, c), c;
445
445
  }, rs = (g) => {
446
446
  const t = g.match(/cubic-bezier\s*\(\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*\)/);
447
447
  if (!t) return null;
@@ -500,8 +500,8 @@ const ps = (g) => g, Rs = (g) => g > 0 ? 1 : 0, xs = (g) => g < 1 ? 0 : 1, is =
500
500
  EaseOut: ns,
501
501
  EaseInOut: os,
502
502
  // Discrete
503
- StepStart: Rs,
504
- StepEnd: xs
503
+ StepStart: xs,
504
+ StepEnd: Rs
505
505
  }, ri = (g) => {
506
506
  const t = g.trim(), i = t.toLowerCase();
507
507
  if (Ue[t]) return Ue[t];
@@ -572,10 +572,10 @@ const ps = (g) => g, Rs = (g) => g > 0 ? 1 : 0, xs = (g) => g < 1 ? 0 : 1, is =
572
572
  }
573
573
  }, li = (g, t, i, o, e) => {
574
574
  if (!g || !t || !i) return g;
575
- const s = o.scale_x ?? 1, n = o.scale_y ?? 1, a = (r, l, c) => {
575
+ const s = o.scale_x ?? 1, n = o.scale_y ?? 1, a = (r, c, l) => {
576
576
  let f = 0, u = 0;
577
- const h = o.rotation * Math.PI / 180, d = Math.cos(h), p = Math.sin(h), y = r * s * d - l * n * p + o.x, m = r * s * p + l * n * d + o.y;
578
- c.forEach((M) => {
577
+ const h = o.rotation * Math.PI / 180, d = Math.cos(h), p = Math.sin(h), y = r * s * d - c * n * p + o.x, m = r * s * p + c * n * d + o.y;
578
+ l.forEach((M) => {
579
579
  const k = e(M.boneId);
580
580
  if (!k) return;
581
581
  const T = {
@@ -584,30 +584,30 @@ const ps = (g) => g, Rs = (g) => g > 0 ? 1 : 0, xs = (g) => g < 1 ? 0 : 1, is =
584
584
  rotation: k.rotation,
585
585
  scaleX: k.scale_x ?? 1,
586
586
  scaleY: k.scale_y ?? 1
587
- }, R = i[M.boneId] || [1, 0, 0, 1, 0, 0], P = y * R[0] + m * R[2] + R[4], E = y * R[1] + m * R[3] + R[5], x = T.rotation * Math.PI / 180, O = Math.cos(x), W = Math.sin(x), B = P * T.scaleX * O - E * T.scaleY * W + T.x, $ = P * T.scaleX * W + E * T.scaleY * O + T.y;
587
+ }, x = i[M.boneId] || [1, 0, 0, 1, 0, 0], P = y * x[0] + m * x[2] + x[4], E = y * x[1] + m * x[3] + x[5], R = T.rotation * Math.PI / 180, O = Math.cos(R), W = Math.sin(R), B = P * T.scaleX * O - E * T.scaleY * W + T.x, $ = P * T.scaleX * W + E * T.scaleY * O + T.y;
588
588
  f += B * M.amount, u += $ * M.amount;
589
589
  });
590
- const b = [...c].sort((M, k) => k.amount - M.amount);
590
+ const b = [...l].sort((M, k) => k.amount - M.amount);
591
591
  if (b.length >= 2 && b[0].amount > 0 && b[1].amount > 0) {
592
592
  const M = e(b[0].boneId), k = e(b[1].boneId);
593
593
  if (M && k && M.length !== void 0 && k.length !== void 0) {
594
- const T = M.length * (M.scale_y ?? 1), R = M.rotation * Math.PI / 180, P = M.x - T * Math.sin(R), E = M.y + T * Math.cos(R), x = k.length * (k.scale_y ?? 1), O = k.rotation * Math.PI / 180, W = k.x - x * Math.sin(O), B = k.y + x * Math.cos(O);
594
+ const T = M.length * (M.scale_y ?? 1), x = M.rotation * Math.PI / 180, P = M.x - T * Math.sin(x), E = M.y + T * Math.cos(x), R = k.length * (k.scale_y ?? 1), O = k.rotation * Math.PI / 180, W = k.x - R * Math.sin(O), B = k.y + R * Math.cos(O);
595
595
  let $ = null, Y = null, H = !1;
596
596
  const K = 1;
597
597
  if (Math.hypot(M.x - k.x, M.y - k.y) < K || Math.hypot(M.x - W, M.y - B) < K ? ($ = M.x, Y = M.y) : (Math.hypot(P - k.x, E - k.y) < K || Math.hypot(P - W, E - B) < K) && ($ = P, Y = E, H = !0), $ !== null && Y !== null) {
598
598
  const A = i[b[0].boneId] || [1, 0, 0, 1, 0, 0], _ = A[0] * A[3] - A[1] * A[2];
599
599
  let L = 0, X = 0;
600
600
  if (_ !== 0) {
601
- const V = (A[2] * A[5] - A[3] * A[4]) / _, it = (A[1] * A[4] - A[0] * A[5]) / _, rt = Math.atan2(-A[1], A[3]);
601
+ const V = (A[2] * A[5] - A[3] * A[4]) / _, it = (A[1] * A[4] - A[0] * A[5]) / _, lt = Math.atan2(-A[1], A[3]);
602
602
  if (!H)
603
603
  L = V, X = it;
604
604
  else {
605
- const ct = -A[2] / _, wt = A[0] / _, Mt = Math.hypot(ct, wt), It = M.length * Mt;
606
- L = V - It * Math.sin(rt), X = it + It * Math.cos(rt);
605
+ const ht = -A[2] / _, wt = A[0] / _, Mt = Math.hypot(ht, wt), It = M.length * Mt;
606
+ L = V - It * Math.sin(lt), X = it + It * Math.cos(lt);
607
607
  }
608
- const nt = Math.hypot(y - L, m - X), yt = Math.hypot(f - $, u - Y);
609
- if (yt > 0 && nt > 0) {
610
- const ct = Math.max(yt, 0.01), wt = Math.min(nt / ct, 3), Mt = $ + (f - $) * wt, It = Y + (u - Y) * wt, Ot = b[0].amount, At = b[1].amount, Tt = Math.min(Ot, At) * 2, zt = 1 - Math.pow(1 - Tt, 4);
608
+ const nt = Math.hypot(y - L, m - X), bt = Math.hypot(f - $, u - Y);
609
+ if (bt > 0 && nt > 0) {
610
+ const ht = Math.max(bt, 0.01), wt = Math.min(nt / ht, 3), Mt = $ + (f - $) * wt, It = Y + (u - Y) * wt, Ot = b[0].amount, At = b[1].amount, Tt = Math.min(Ot, At) * 2, zt = 1 - Math.pow(1 - Tt, 4);
611
611
  f = f * (1 - zt) + Mt * zt, u = u * (1 - zt) + It * zt;
612
612
  }
613
613
  }
@@ -620,16 +620,16 @@ const ps = (g) => g, Rs = (g) => g > 0 ? 1 : 0, xs = (g) => g < 1 ? 0 : 1, is =
620
620
  y: (-w * C + I * S) / n
621
621
  };
622
622
  };
623
- return g.map((r, l) => {
624
- const c = t[l];
625
- if (!c || c.length === 0) return { ...r };
626
- const f = { ...r, ...a(r.x, r.y, c) };
623
+ return g.map((r, c) => {
624
+ const l = t[c];
625
+ if (!l || l.length === 0) return { ...r };
626
+ const f = { ...r, ...a(r.x, r.y, l) };
627
627
  if (r.in_x !== void 0 && r.in_y !== void 0) {
628
- const u = a(r.in_x, r.in_y, c);
628
+ const u = a(r.in_x, r.in_y, l);
629
629
  f.in_x = u.x, f.in_y = u.y;
630
630
  }
631
631
  if (r.out_x !== void 0 && r.out_y !== void 0) {
632
- const u = a(r.out_x, r.out_y, c);
632
+ const u = a(r.out_x, r.out_y, l);
633
633
  f.out_x = u.x, f.out_y = u.y;
634
634
  }
635
635
  return f;
@@ -905,7 +905,7 @@ class ci {
905
905
  }
906
906
  svgPathToPoints(t) {
907
907
  const i = /([MLHVCSQTAZmlhvcsqtaz])([^MLHVCSQTAZmlhvcsqtaz]*)/g, o = /[-+]?(?:\d*\.\d+|\d+)(?:[eE][-+]?\d+)?/g, e = [];
908
- let s = !1, n = 0, a = 0, r = 0, l = 0, c = 0, f = 0, u;
908
+ let s = !1, n = 0, a = 0, r = 0, c = 0, l = 0, f = 0, u;
909
909
  for (; (u = i.exec(t)) !== null; ) {
910
910
  const h = u[1], d = (u[2].match(o) || []).map(parseFloat), p = h === h.toLowerCase(), y = h.toUpperCase();
911
911
  let m = 0;
@@ -916,7 +916,7 @@ class ci {
916
916
  switch (y) {
917
917
  case "M": {
918
918
  const S = v();
919
- for (c = n = S.x, f = a = S.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a, moveTo: !0 }); m < d.length; ) {
919
+ for (l = n = S.x, f = a = S.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a, moveTo: !0 }); m < d.length; ) {
920
920
  const C = v();
921
921
  n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a });
922
922
  }
@@ -943,17 +943,17 @@ class ci {
943
943
  const I = e[e.length - 1];
944
944
  I.out_x = S.x, I.out_y = S.y;
945
945
  }
946
- n = w.x, a = w.y, e.push({ x: n, y: a, in_x: C.x, in_y: C.y, out_x: n, out_y: a }), r = C.x, l = C.y;
946
+ n = w.x, a = w.y, e.push({ x: n, y: a, in_x: C.x, in_y: C.y, out_x: n, out_y: a }), r = C.x, c = C.y;
947
947
  }
948
948
  break;
949
949
  case "S":
950
950
  for (; m < d.length; ) {
951
- const S = { x: 2 * n - r, y: 2 * a - l }, C = v(), w = v();
951
+ const S = { x: 2 * n - r, y: 2 * a - c }, C = v(), w = v();
952
952
  if (e.length > 0) {
953
953
  const I = e[e.length - 1];
954
954
  I.out_x = S.x, I.out_y = S.y;
955
955
  }
956
- n = w.x, a = w.y, e.push({ x: n, y: a, in_x: C.x, in_y: C.y, out_x: n, out_y: a }), r = C.x, l = C.y;
956
+ n = w.x, a = w.y, e.push({ x: n, y: a, in_x: C.x, in_y: C.y, out_x: n, out_y: a }), r = C.x, c = C.y;
957
957
  }
958
958
  break;
959
959
  case "Q":
@@ -963,17 +963,17 @@ class ci {
963
963
  const w = e[e.length - 1];
964
964
  w.out_x = w.x + 2 / 3 * (S.x - w.x), w.out_y = w.y + 2 / 3 * (S.y - w.y);
965
965
  }
966
- n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n + 2 / 3 * (S.x - n), in_y: a + 2 / 3 * (S.y - a), out_x: n, out_y: a }), r = S.x, l = S.y;
966
+ n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n + 2 / 3 * (S.x - n), in_y: a + 2 / 3 * (S.y - a), out_x: n, out_y: a }), r = S.x, c = S.y;
967
967
  }
968
968
  break;
969
969
  case "T":
970
970
  for (; m < d.length; ) {
971
- const S = { x: 2 * n - r, y: 2 * a - l }, C = v();
971
+ const S = { x: 2 * n - r, y: 2 * a - c }, C = v();
972
972
  if (e.length > 0) {
973
973
  const w = e[e.length - 1];
974
974
  w.out_x = w.x + 2 / 3 * (S.x - w.x), w.out_y = w.y + 2 / 3 * (S.y - w.y);
975
975
  }
976
- n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n + 2 / 3 * (S.x - n), in_y: a + 2 / 3 * (S.y - a), out_x: n, out_y: a }), r = S.x, l = S.y;
976
+ n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n + 2 / 3 * (S.x - n), in_y: a + 2 / 3 * (S.y - a), out_x: n, out_y: a }), r = S.x, c = S.y;
977
977
  }
978
978
  break;
979
979
  case "Z":
@@ -983,7 +983,7 @@ class ci {
983
983
  const C = [...e].reverse().find((w) => w.moveTo) || e[0];
984
984
  C && Math.hypot(C.x - S.x, C.y - S.y) < 0.1 && (C.in_x = S.in_x, C.in_y = S.in_y, e.pop(), e.length > 0 && (e[e.length - 1].closePath = !0));
985
985
  }
986
- n = c, a = f;
986
+ n = l, a = f;
987
987
  break;
988
988
  default:
989
989
  if (d.length >= 2) {
@@ -1060,20 +1060,20 @@ class ci {
1060
1060
  if (!t) return;
1061
1061
  let i = this.decompressStrings(t);
1062
1062
  const o = [], e = /* @__PURE__ */ new Set(), s = (r) => {
1063
- r && r.forEach((l) => {
1064
- if (e.has(l.id)) return;
1065
- const c = { ...l }, f = c.childrenObjects || [];
1066
- e.add(c.id), o.push(c), s(f);
1063
+ r && r.forEach((c) => {
1064
+ if (e.has(c.id)) return;
1065
+ const l = { ...c }, f = l.childrenObjects || [];
1066
+ e.add(l.id), o.push(l), s(f);
1067
1067
  });
1068
1068
  };
1069
1069
  if (s(i.objects || []), o.length > (i.objects || []).length && this.log(`[Engine] Flattened artboard from ${(i.objects || []).length} to ${o.length} objects.`), i.objects = o, this.artboard = i, this.currentTime = 0, this.objectStates.clear(), this.log(`[ExodeUIEngine] Loading artboard: "${(n = this.artboard) == null ? void 0 : n.name}" with ${(a = this.artboard) == null ? void 0 : a.objects.length} objects`), this.artboard && this.artboard.objects) {
1070
1070
  const r = /* @__PURE__ */ new Map();
1071
- this.artboard.objects.forEach((l) => {
1072
- r.set(l.id, l), l.children || (l.children = []);
1073
- }), this.artboard.objects.forEach((l) => {
1074
- if (l.parentId) {
1075
- const c = r.get(l.parentId);
1076
- c && (c.children || (c.children = []), c.children.includes(l.id) || c.children.push(l.id));
1071
+ this.artboard.objects.forEach((c) => {
1072
+ r.set(c.id, c), c.children || (c.children = []);
1073
+ }), this.artboard.objects.forEach((c) => {
1074
+ if (c.parentId) {
1075
+ const l = r.get(c.parentId);
1076
+ l && (l.children || (l.children = []), l.children.includes(c.id) || l.children.push(c.id));
1077
1077
  }
1078
1078
  });
1079
1079
  }
@@ -1123,11 +1123,11 @@ class ci {
1123
1123
  reset() {
1124
1124
  if (!this.artboard) return;
1125
1125
  if (this.objectStates.clear(), this.objectVelocities.clear(), this.currentTime = 0, this.inputs.clear(), this.inputNameMap.clear(), this.layerStates.clear(), this.logicNodeValues.clear(), this.justFiredTriggers.clear(), this.inputs.set("mouseX", 0), this.inputs.set("mouseY", 0), this.inputs.set("scrollX", 0), this.inputs.set("scrollY", 0), this.inputs.set("isMouseDown", !1), this.physicsEngine && (this.physicsEngine.destroy(), this.physicsEngine = null), this._layoutAnimCache.clear(), this._springChainState.clear(), this._emitterPools.clear(), this.artboard.objects.forEach((i) => {
1126
- var n, a, r, l, c, f, u;
1127
- const o = i.width ?? ((n = i.geometry) == null ? void 0 : n.width) ?? 0, e = i.height ?? ((a = i.geometry) == null ? void 0 : a.height) ?? 0, s = i.cornerRadius ?? i.corner_radius ?? ((r = i.geometry) == null ? void 0 : r.corner_radius) ?? ((l = i.geometry) == null ? void 0 : l.cornerRadius) ?? 0;
1126
+ var n, a, r, c, l, f, u;
1127
+ const o = i.width ?? ((n = i.geometry) == null ? void 0 : n.width) ?? 0, e = i.height ?? ((a = i.geometry) == null ? void 0 : a.height) ?? 0, s = i.cornerRadius ?? i.corner_radius ?? ((r = i.geometry) == null ? void 0 : r.corner_radius) ?? ((c = i.geometry) == null ? void 0 : c.cornerRadius) ?? 0;
1128
1128
  this.objectStates.set(i.id, {
1129
1129
  ...i.transform || {},
1130
- x: ((c = i.transform) == null ? void 0 : c.x) ?? i.x ?? 0,
1130
+ x: ((l = i.transform) == null ? void 0 : l.x) ?? i.x ?? 0,
1131
1131
  y: ((f = i.transform) == null ? void 0 : f.y) ?? i.y ?? 0,
1132
1132
  width: o,
1133
1133
  height: e,
@@ -1164,14 +1164,14 @@ class ci {
1164
1164
  if ((s = e.physics) != null && s.enabled && e.type === "Shape") {
1165
1165
  const a = this.objectStates.get(e.id);
1166
1166
  if (!a) return;
1167
- const r = e.geometry.width || 100, l = e.geometry.height || 100;
1167
+ const r = e.geometry.width || 100, c = e.geometry.height || 100;
1168
1168
  this.physicsEngine.createBody({
1169
1169
  id: e.id,
1170
1170
  type: ((n = e.geometry) == null ? void 0 : n.type) || "Rectangle",
1171
1171
  x: a.x,
1172
1172
  y: a.y,
1173
1173
  width: r,
1174
- height: l,
1174
+ height: c,
1175
1175
  rotation: a.rotation * (Math.PI / 180),
1176
1176
  // Convert deg to rad
1177
1177
  isStatic: e.physics.bodyType === "Static",
@@ -1208,8 +1208,8 @@ class ci {
1208
1208
  n.forEach((a) => {
1209
1209
  const r = this.objectStates.get(a.id);
1210
1210
  if (r) {
1211
- const l = Math.abs(r.x - a.x), c = Math.abs(r.y - a.y);
1212
- !t && (l > 20 || c > 20) ? (r.x += (a.x - r.x) * o, r.y += (a.y - r.y) * o) : (r.x = a.x, r.y = a.y), a.width !== void 0 && (r.width = a.width), a.height !== void 0 && (r.height = a.height);
1211
+ const c = Math.abs(r.x - a.x), l = Math.abs(r.y - a.y);
1212
+ !t && (c > 20 || l > 20) ? (r.x += (a.x - r.x) * o, r.y += (a.y - r.y) * o) : (r.x = a.x, r.y = a.y), a.width !== void 0 && (r.width = a.width), a.height !== void 0 && (r.height = a.height);
1213
1213
  }
1214
1214
  });
1215
1215
  };
@@ -1220,10 +1220,10 @@ class ci {
1220
1220
  this.artboard.objects.forEach((n) => {
1221
1221
  var a;
1222
1222
  if (n.type === "Frame" && ((a = n.autoLayout) != null && a.enabled) && n.children && n.children.length > 0) {
1223
- const r = n.children.map((f) => i.get(f)).filter((f) => !!f), l = this.objectStates.get(n.id);
1224
- if (!l) return;
1225
- const c = ss(l, r, (f) => this.objectStates.get(f));
1226
- c.frameWidth !== void 0 && (l.width = c.frameWidth), c.frameHeight !== void 0 && (l.height = c.frameHeight), e(c.childUpdates);
1223
+ const r = n.children.map((f) => i.get(f)).filter((f) => !!f), c = this.objectStates.get(n.id);
1224
+ if (!c) return;
1225
+ const l = ss(c, r, (f) => this.objectStates.get(f));
1226
+ l.frameWidth !== void 0 && (c.width = l.frameWidth), l.frameHeight !== void 0 && (c.height = l.frameHeight), e(l.childUpdates);
1227
1227
  }
1228
1228
  });
1229
1229
  }
@@ -1274,21 +1274,21 @@ class ci {
1274
1274
  const a = this.activeStateMachine.layers.find((r) => r.name === t);
1275
1275
  if (a)
1276
1276
  for (const r of i) {
1277
- const l = a.states.find((c) => c.id === r);
1278
- if (l)
1279
- if (l.isBlendState && l.blendAnimations && l.blendAnimations.length > 0)
1280
- e.push({ animation: null, state: l }), l.blendAnimations.forEach((c) => {
1281
- const f = this.artboard.animations.find((u) => u.id === c.animationId);
1277
+ const c = a.states.find((l) => l.id === r);
1278
+ if (c)
1279
+ if (c.isBlendState && c.blendAnimations && c.blendAnimations.length > 0)
1280
+ e.push({ animation: null, state: c }), c.blendAnimations.forEach((l) => {
1281
+ const f = this.artboard.animations.find((u) => u.id === l.animationId);
1282
1282
  f && (s = Math.max(s, f.duration));
1283
1283
  });
1284
1284
  else {
1285
- let c = null;
1286
- l.animationId && (c = this.artboard.animations.find((f) => f.id === l.animationId) || null), c || (c = this.artboard.animations.find(
1285
+ let l = null;
1286
+ c.animationId && (l = this.artboard.animations.find((f) => f.id === c.animationId) || null), l || (l = this.artboard.animations.find(
1287
1287
  (f) => {
1288
1288
  var u, h;
1289
- return f.name === l.name || f.id === l.name || (l.name === "Entry" || l.id === "entry") && (((u = f.name) == null ? void 0 : u.toLowerCase()) === "onload" || ((h = f.name) == null ? void 0 : h.toLowerCase()) === "intro");
1289
+ return f.name === c.name || f.id === c.name || (c.name === "Entry" || c.id === "entry") && (((u = f.name) == null ? void 0 : u.toLowerCase()) === "onload" || ((h = f.name) == null ? void 0 : h.toLowerCase()) === "intro");
1290
1290
  }
1291
- ) || null), c && ((n = this.artboard.animationFlow) != null && n.some((u) => (u.trigger === "on_load" || u.trigger === "after_delay") && u.targetAnimationId === (c == null ? void 0 : c.id)) || (e.push({ animation: c, state: l }), s = Math.max(s, c.duration)));
1291
+ ) || null), l && ((n = this.artboard.animationFlow) != null && n.some((u) => (u.trigger === "on_load" || u.trigger === "after_delay") && u.targetAnimationId === (l == null ? void 0 : l.id)) || (e.push({ animation: l, state: c }), s = Math.max(s, l.duration)));
1292
1292
  }
1293
1293
  }
1294
1294
  }
@@ -1334,22 +1334,22 @@ class ci {
1334
1334
  var n, a, r;
1335
1335
  let o;
1336
1336
  if (this.inputs.has(t)) {
1337
- const l = (n = this.activeStateMachine) == null ? void 0 : n.inputs.find((c) => c.id === t);
1338
- l && typeof l.value == "object" && (o = l.value.type);
1337
+ const c = (n = this.activeStateMachine) == null ? void 0 : n.inputs.find((l) => l.id === t);
1338
+ c && typeof c.value == "object" && (o = c.value.type);
1339
1339
  } else {
1340
- const l = this.inputNameMap.get(t);
1341
- if (l && l.length > 0) {
1342
- const c = (a = this.activeStateMachine) == null ? void 0 : a.inputs.find((f) => f.id === l[0]);
1343
- c && typeof c.value == "object" && (o = c.value.type);
1340
+ const c = this.inputNameMap.get(t);
1341
+ if (c && c.length > 0) {
1342
+ const l = (a = this.activeStateMachine) == null ? void 0 : a.inputs.find((f) => f.id === c[0]);
1343
+ l && typeof l.value == "object" && (o = l.value.type);
1344
1344
  }
1345
1345
  }
1346
1346
  let e = i;
1347
1347
  o === "Trigger" && (i === 1 ? e = !0 : i === 0 && (e = !1)), this.inputs.has(t) && this.setInternalInput(t, e);
1348
1348
  const s = this.inputNameMap.get(t);
1349
- s && s.forEach((l) => this.setInternalInput(l, e)), o === "Trigger" && e === !0 && (this.justFiredTriggers.add(t), s && s.forEach((l) => this.justFiredTriggers.add(l))), Array.isArray(e) && ((r = this.artboard) == null || r.objects.forEach((l) => {
1350
- if (l.inputId === t || l.name === t) {
1351
- const c = this.objectStates.get(l.id);
1352
- c && c.options && (l.type === "ListView" || l.variant === "listview" ? c.options.items = e : (l.type === "Dropdown" || l.variant === "dropdown") && (c.options.optionsList = e));
1349
+ s && s.forEach((c) => this.setInternalInput(c, e)), o === "Trigger" && e === !0 && (this.justFiredTriggers.add(t), s && s.forEach((c) => this.justFiredTriggers.add(c))), Array.isArray(e) && ((r = this.artboard) == null || r.objects.forEach((c) => {
1350
+ if (c.inputId === t || c.name === t) {
1351
+ const l = this.objectStates.get(c.id);
1352
+ l && l.options && (c.type === "ListView" || c.variant === "listview" ? l.options.items = e : (c.type === "Dropdown" || c.variant === "dropdown") && (l.options.optionsList = e));
1353
1353
  }
1354
1354
  })), this.evaluateTransitions(), this.evaluateVariableTriggers(t, e);
1355
1355
  }
@@ -1359,42 +1359,42 @@ class ci {
1359
1359
  o.forEach((s) => {
1360
1360
  if (s.trigger === "variable" && s.conditionVariableId && s.targetAnimationId && (s.conditionVariableId === t || e && e.includes(s.conditionVariableId))) {
1361
1361
  const a = s.conditionOperator || "IsTrue", r = s.conditionValue;
1362
- let l = !1;
1362
+ let c = !1;
1363
1363
  switch (a) {
1364
1364
  case "Equal":
1365
1365
  case "==":
1366
- l = i == r;
1366
+ c = i == r;
1367
1367
  break;
1368
1368
  case "NotEqual":
1369
1369
  case "!=":
1370
- l = i != r;
1370
+ c = i != r;
1371
1371
  break;
1372
1372
  case "GreaterThan":
1373
1373
  case ">":
1374
- l = i > r;
1374
+ c = i > r;
1375
1375
  break;
1376
1376
  case "LessThan":
1377
1377
  case "<":
1378
- l = i < r;
1378
+ c = i < r;
1379
1379
  break;
1380
1380
  case "GreaterEqual":
1381
1381
  case ">=":
1382
- l = i >= r;
1382
+ c = i >= r;
1383
1383
  break;
1384
1384
  case "LessEqual":
1385
1385
  case "<=":
1386
- l = i <= r;
1386
+ c = i <= r;
1387
1387
  break;
1388
1388
  case "IsTrue":
1389
- l = !!i;
1389
+ c = !!i;
1390
1390
  break;
1391
1391
  case "IsFalse":
1392
- l = !i;
1392
+ c = !i;
1393
1393
  break;
1394
1394
  }
1395
- if (l) {
1396
- const c = s.delay || 0;
1397
- c <= 0 ? this.triggerGlobalAnimation(s.targetAnimationId, s.subAnimationIds, s.loop, s.id) : setTimeout(() => this.triggerGlobalAnimation(s.targetAnimationId, s.subAnimationIds, s.loop, s.id), c);
1395
+ if (c) {
1396
+ const l = s.delay || 0;
1397
+ l <= 0 ? this.triggerGlobalAnimation(s.targetAnimationId, s.subAnimationIds, s.loop, s.id) : setTimeout(() => this.triggerGlobalAnimation(s.targetAnimationId, s.subAnimationIds, s.loop, s.id), l);
1398
1398
  }
1399
1399
  }
1400
1400
  });
@@ -1417,7 +1417,7 @@ class ci {
1417
1417
  const s = this.findGlobalTransition(t, i.currentStateIds);
1418
1418
  s && (o.length = 0, o.push(s.targetStateId), e = !0, s.conditions && (s.conditions || []).forEach((n) => {
1419
1419
  var r;
1420
- const a = (r = this.activeStateMachine) == null ? void 0 : r.inputs.find((l) => l.id === n.inputId);
1420
+ const a = (r = this.activeStateMachine) == null ? void 0 : r.inputs.find((c) => c.id === n.inputId);
1421
1421
  a && typeof a.value == "object" && a.value.type === "Trigger" && this.setInternalInput(n.inputId, !1);
1422
1422
  }));
1423
1423
  }
@@ -1494,7 +1494,7 @@ class ci {
1494
1494
  });
1495
1495
  }
1496
1496
  evaluateLogicTree(t, i = null, o = /* @__PURE__ */ new Set()) {
1497
- var a, r, l, c, f, u;
1497
+ var a, r, c, l, f, u;
1498
1498
  if (o.has(t))
1499
1499
  return this.inputs.get(t) ?? this.logicNodeValues.get(t) ?? 0;
1500
1500
  o.add(t);
@@ -1704,7 +1704,7 @@ class ci {
1704
1704
  }
1705
1705
  case St.SPRING_PULL: {
1706
1706
  const p = h("objectId", ""), y = h("forceX", 0), m = h("forceY", 0);
1707
- p && ((l = this.artboard) == null || l.objects.forEach((b) => {
1707
+ p && ((c = this.artboard) == null || c.objects.forEach((b) => {
1708
1708
  b.behaviors && b.behaviors.forEach((v) => {
1709
1709
  var S;
1710
1710
  if (v.type === N.SpringChain && ((S = v.settings) != null && S.connections) && (v.settings.connections.some((w) => w.targetId === p) || b.id === p)) {
@@ -1741,7 +1741,7 @@ class ci {
1741
1741
  }
1742
1742
  case St.EMIT: {
1743
1743
  const p = h("objectId", ""), y = h("count", 20);
1744
- p && ((c = this.artboard) == null || c.objects.forEach((m) => {
1744
+ p && ((l = this.artboard) == null || l.objects.forEach((m) => {
1745
1745
  m.behaviors && m.behaviors.forEach((b) => {
1746
1746
  b.type === N.ParticleEmitter && m.id === p && (b._pendingBurst = (b._pendingBurst || 0) + y);
1747
1747
  });
@@ -1837,11 +1837,11 @@ class ci {
1837
1837
  }), i.forEach((o) => {
1838
1838
  this.layerStates.delete(o), this.debugLog(`[Engine] Cleaned up completed global layer: ${o}`);
1839
1839
  }), this.solveConstraints(t), this.solveBehaviors(t), this.activeTriggers.forEach((o, e) => {
1840
- var s, n, a, r, l, c, f;
1840
+ var s, n, a, r, c, l, f;
1841
1841
  if (o.phase === "entry")
1842
1842
  o.time += t, o.time >= o.animation.duration && ((a = (n = (s = this.artboard) == null ? void 0 : s.objects.find((u) => u.id === e)) == null ? void 0 : n.triggers) == null || a.find((u) => u.id === o.triggerId), o.phase = "hold", o.elapsedHold = 0, o.time = o.animation.duration), this.applyAnimation(o.animation, o.time, o.filterObjectIds || o.filterObjectId || void 0);
1843
1843
  else if (o.phase === "hold") {
1844
- const u = (c = (l = (r = this.artboard) == null ? void 0 : r.objects.find((p) => p.id === e)) == null ? void 0 : l.triggers) == null ? void 0 : c.find((p) => p.id === o.triggerId), h = (u == null ? void 0 : u.duration) || 0;
1844
+ const u = (l = (c = (r = this.artboard) == null ? void 0 : r.objects.find((p) => p.id === e)) == null ? void 0 : c.triggers) == null ? void 0 : l.find((p) => p.id === o.triggerId), h = (u == null ? void 0 : u.duration) || 0;
1845
1845
  o.elapsedHold += t * 1e3;
1846
1846
  let d = o.elapsedHold >= h;
1847
1847
  if ((u == null ? void 0 : u.eventType) === "hover" && !this.activeHoverIds.has(e) && (d = !0), ((u == null ? void 0 : u.eventType) === "onHold" || (u == null ? void 0 : u.eventType) === "pointerDown") && !this.isMouseDown && (d = !0), d)
@@ -1860,7 +1860,7 @@ class ci {
1860
1860
  if (o && o.isEnabled && o.triggerType === "visible") {
1861
1861
  const a = this.objectStates.get(i.id);
1862
1862
  if (a && a.visible !== !1) {
1863
- const r = this.getGlobalTransform(i.id), l = (((s = i.geometry) == null ? void 0 : s.width) || 100) * (r.scale_x || 1), c = (((n = i.geometry) == null ? void 0 : n.height) || 100) * (r.scale_y || 1), f = 50, u = r.x + l / 2 >= -this.canvasWidth / 2 - f && r.x - l / 2 <= this.canvasWidth / 2 + f && r.y + c / 2 >= -this.canvasHeight / 2 - f && r.y - c / 2 <= this.canvasHeight / 2 + f, h = `analytics_${i.id}`, d = this.wasInView.has(h);
1863
+ const r = this.getGlobalTransform(i.id), c = (((s = i.geometry) == null ? void 0 : s.width) || 100) * (r.scale_x || 1), l = (((n = i.geometry) == null ? void 0 : n.height) || 100) * (r.scale_y || 1), f = 50, u = r.x + c / 2 >= -this.canvasWidth / 2 - f && r.x - c / 2 <= this.canvasWidth / 2 + f && r.y + l / 2 >= -this.canvasHeight / 2 - f && r.y - l / 2 <= this.canvasHeight / 2 + f, h = `analytics_${i.id}`, d = this.wasInView.has(h);
1864
1864
  u && !d && this.fireAnalyticsEvent(i.id, "visible"), u ? this.wasInView.add(h) : this.wasInView.delete(h);
1865
1865
  }
1866
1866
  }
@@ -1869,7 +1869,7 @@ class ci {
1869
1869
  o.length !== 0 && o.forEach((e) => {
1870
1870
  const s = e.triggers || [e.event || e.trigger];
1871
1871
  s && s.forEach((n) => {
1872
- var r, l, c;
1872
+ var r, c, l;
1873
1873
  const a = n.toLowerCase();
1874
1874
  if (a === "on interval" || a === "oninterval") {
1875
1875
  const f = e.intervalValue || 2e3, u = this.periodicTriggerTimes.get(e.id) || 0;
@@ -1882,12 +1882,12 @@ class ci {
1882
1882
  if (a === "scroll into view" || a === "scrollintoview") {
1883
1883
  const f = this.objectStates.get(i.id);
1884
1884
  if (f && f.visible !== !1) {
1885
- const u = this.getGlobalTransform(i.id), h = (((r = i.geometry) == null ? void 0 : r.width) || 100) * (u.scale_x || 1), d = (((l = i.geometry) == null ? void 0 : l.height) || 100) * (u.scale_y || 1), p = 50, y = u.x + h / 2 >= -this.canvasWidth / 2 - p && u.x - h / 2 <= this.canvasWidth / 2 + p && u.y + d / 2 >= -this.canvasHeight / 2 - p && u.y - d / 2 <= this.canvasHeight / 2 + p, m = this.wasInView.has(i.id);
1885
+ const u = this.getGlobalTransform(i.id), h = (((r = i.geometry) == null ? void 0 : r.width) || 100) * (u.scale_x || 1), d = (((c = i.geometry) == null ? void 0 : c.height) || 100) * (u.scale_y || 1), p = 50, y = u.x + h / 2 >= -this.canvasWidth / 2 - p && u.x - h / 2 <= this.canvasWidth / 2 + p && u.y + d / 2 >= -this.canvasHeight / 2 - p && u.y - d / 2 <= this.canvasHeight / 2 + p, m = this.wasInView.has(i.id);
1886
1886
  y && !m && (!e.conditions || this.checkConditions(e.conditions)) && this.fireEventForObject(i.id, "Scroll Into View"), y ? this.wasInView.add(i.id) : this.wasInView.delete(i.id);
1887
1887
  }
1888
1888
  }
1889
1889
  if (a === "scroll progress" || a === "scrollprogress") {
1890
- const f = Math.abs(this.scrollOffset.y) / (((c = this.artboard) == null ? void 0 : c.height) || 1e3), u = this.scrollProgressLastValue.get(e.id) || 0;
1890
+ const f = Math.abs(this.scrollOffset.y) / (((l = this.artboard) == null ? void 0 : l.height) || 1e3), u = this.scrollProgressLastValue.get(e.id) || 0;
1891
1891
  Math.abs(f - u) > 1e-3 && (this.scrollProgressLastValue.set(e.id, f), (e.action === "Set Input" || e.action === "setInput") && this.updateInput(e.targetInputId, f));
1892
1892
  }
1893
1893
  });
@@ -1901,17 +1901,17 @@ class ci {
1901
1901
  if (!o) return;
1902
1902
  const e = this.getGlobalTransform(i.id);
1903
1903
  if (i.constraints.forEach((s, n) => {
1904
- var c, f, u, h, d, p, y, m, b;
1905
- const a = ((c = o.constraints) == null ? void 0 : c[n]) || {}, r = { ...s, ...a }, l = r.strength ?? 1;
1904
+ var l, f, u, h, d, p, y, m, b;
1905
+ const a = ((l = o.constraints) == null ? void 0 : l[n]) || {}, r = { ...s, ...a }, c = r.strength ?? 1;
1906
1906
  if (r.type === "Translation") {
1907
1907
  const v = this.getGlobalTransform(r.targetId);
1908
1908
  if (v) {
1909
1909
  const S = r.offsetX || 0, C = r.offsetY || 0, w = v.x + S, I = v.y + C, M = r.useSpring;
1910
1910
  if (M) {
1911
- const T = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x: R, y: P, vx: E, vy: x } = this.computeSpring(e.x, e.y, T.vx, T.vy, w, I, r, t);
1912
- r.copyX && (e.x = e.x + (R - e.x) * l), r.copyY && (e.y = e.y + (P - e.y) * l), this.objectVelocities.set(i.id, { vx: E, vy: x });
1911
+ const T = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x, y: P, vx: E, vy: R } = this.computeSpring(e.x, e.y, T.vx, T.vy, w, I, r, t);
1912
+ r.copyX && (e.x = e.x + (x - e.x) * c), r.copyY && (e.y = e.y + (P - e.y) * c), this.objectVelocities.set(i.id, { vx: E, vy: R });
1913
1913
  } else
1914
- r.copyX && (e.x = e.x + (w - e.x) * l), r.copyY && (e.y = e.y + (I - e.y) * l);
1914
+ r.copyX && (e.x = e.x + (w - e.x) * c), r.copyY && (e.y = e.y + (I - e.y) * c);
1915
1915
  let k = !1;
1916
1916
  if ((f = r.limitX) != null && f.enabled) {
1917
1917
  const T = e.x;
@@ -1927,25 +1927,25 @@ class ci {
1927
1927
  const v = this.getGlobalTransform(r.targetId);
1928
1928
  if (v) {
1929
1929
  let C = (v.rotation + (r.offset || 0) - e.rotation) % 360;
1930
- C > 180 && (C -= 360), C < -180 && (C += 360), e.rotation = e.rotation + C * l;
1930
+ C > 180 && (C -= 360), C < -180 && (C += 360), e.rotation = e.rotation + C * c;
1931
1931
  }
1932
1932
  } else if (r.type === "Scale") {
1933
1933
  const v = this.getGlobalTransform(r.targetId);
1934
- v && (r.copyX && (e.scale_x = e.scale_x + (v.scale_x - e.scale_x) * l), r.copyY && (e.scale_y = e.scale_y + (v.scale_y - e.scale_y) * l));
1934
+ v && (r.copyX && (e.scale_x = e.scale_x + (v.scale_x - e.scale_x) * c), r.copyY && (e.scale_y = e.scale_y + (v.scale_y - e.scale_y) * c));
1935
1935
  } else if (r.type === "Transform") {
1936
1936
  const v = this.getGlobalTransform(r.targetId);
1937
1937
  if (v) {
1938
- e.x = e.x + (v.x - e.x) * l, e.y = e.y + (v.y - e.y) * l;
1938
+ e.x = e.x + (v.x - e.x) * c, e.y = e.y + (v.y - e.y) * c;
1939
1939
  let S = (v.rotation - e.rotation) % 360;
1940
- S > 180 && (S -= 360), S < -180 && (S += 360), e.rotation = e.rotation + S * l, e.scale_x = e.scale_x + (v.scale_x - e.scale_x) * l, e.scale_y = e.scale_y + (v.scale_y - e.scale_y) * l;
1940
+ S > 180 && (S -= 360), S < -180 && (S += 360), e.rotation = e.rotation + S * c, e.scale_x = e.scale_x + (v.scale_x - e.scale_x) * c, e.scale_y = e.scale_y + (v.scale_y - e.scale_y) * c;
1941
1941
  }
1942
1942
  } else if (r.type === "FollowPointer") {
1943
1943
  const v = ((h = this._lastPointerPos) == null ? void 0 : h.x) ?? e.x, S = ((d = this._lastPointerPos) == null ? void 0 : d.y) ?? e.y, C = r.useSpring;
1944
1944
  if (C) {
1945
- const I = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x: M, y: k, vx: T, vy: R } = this.computeSpring(e.x, e.y, I.vx, I.vy, v, S, r, t);
1946
- e.x = M, e.y = k, this.objectVelocities.set(i.id, { vx: T, vy: R });
1945
+ const I = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x: M, y: k, vx: T, vy: x } = this.computeSpring(e.x, e.y, I.vx, I.vy, v, S, r, t);
1946
+ e.x = M, e.y = k, this.objectVelocities.set(i.id, { vx: T, vy: x });
1947
1947
  } else
1948
- e.x = e.x + (v - e.x) * l, e.y = e.y + (S - e.y) * l;
1948
+ e.x = e.x + (v - e.x) * c, e.y = e.y + (S - e.y) * c;
1949
1949
  let w = !1;
1950
1950
  if ((p = r.limitX) != null && p.enabled) {
1951
1951
  const I = e.x;
@@ -1977,7 +1977,7 @@ class ci {
1977
1977
  }
1978
1978
  if (w > 0) {
1979
1979
  const k = e.x === v.x && e.y === v.y ? 1 : M / w;
1980
- e.x = e.x + (v.x + S * k - e.x) * l, e.y = e.y + (v.y + C * k - e.y) * l;
1980
+ e.x = e.x + (v.x + S * k - e.x) * c, e.y = e.y + (v.y + C * k - e.y) * c;
1981
1981
  }
1982
1982
  }
1983
1983
  } else if (r.type === "FollowPath") {
@@ -1993,22 +1993,22 @@ class ci {
1993
1993
  _ && (C = _.geometry);
1994
1994
  }
1995
1995
  if (!C) return;
1996
- const w = (r.distance || 0) / 100, I = S.width || C.width || 0, M = S.height || C.height || 0, k = this.getPointOnPath(C, I, M, w), T = S.rotation * Math.PI / 180, R = Math.cos(T), P = Math.sin(T), E = k.x * S.scale_x * R - k.y * S.scale_y * P, x = k.x * S.scale_x * P + k.y * S.scale_y * R;
1996
+ const w = (r.distance || 0) / 100, I = S.width || C.width || 0, M = S.height || C.height || 0, k = this.getPointOnPath(C, I, M, w), T = S.rotation * Math.PI / 180, x = Math.cos(T), P = Math.sin(T), E = k.x * S.scale_x * x - k.y * S.scale_y * P, R = k.x * S.scale_x * P + k.y * S.scale_y * x;
1997
1997
  let O = S.rotation + (r.offsetRotation || 0);
1998
1998
  if (r.orient) {
1999
- const _ = Math.cos(k.angle), L = Math.sin(k.angle), X = _ * S.scale_x * R - L * S.scale_y * P, V = _ * S.scale_x * P + L * S.scale_y * R;
1999
+ const _ = Math.cos(k.angle), L = Math.sin(k.angle), X = _ * S.scale_x * x - L * S.scale_y * P, V = _ * S.scale_x * P + L * S.scale_y * x;
2000
2000
  O = Math.atan2(V, X) * 180 / Math.PI + (r.offsetRotation || 0);
2001
2001
  }
2002
- const W = O * Math.PI / 180, B = Math.cos(W), $ = Math.sin(W), Y = (r.offsetX || 0) * B - (r.offsetY || 0) * $, H = (r.offsetX || 0) * $ + (r.offsetY || 0) * B, K = S.x + E + Y, A = S.y + x + H;
2003
- if (e.x = e.x + (K - e.x) * l, e.y = e.y + (A - e.y) * l, r.orient) {
2002
+ const W = O * Math.PI / 180, B = Math.cos(W), $ = Math.sin(W), Y = (r.offsetX || 0) * B - (r.offsetY || 0) * $, H = (r.offsetX || 0) * $ + (r.offsetY || 0) * B, K = S.x + E + Y, A = S.y + R + H;
2003
+ if (e.x = e.x + (K - e.x) * c, e.y = e.y + (A - e.y) * c, r.orient) {
2004
2004
  let _ = (O - e.rotation) % 360;
2005
- _ > 180 && (_ -= 360), _ < -180 && (_ += 360), e.rotation = e.rotation + _ * l;
2005
+ _ > 180 && (_ -= 360), _ < -180 && (_ += 360), e.rotation = e.rotation + _ * c;
2006
2006
  }
2007
2007
  }
2008
2008
  }
2009
2009
  } else if (r.type === "IK") {
2010
2010
  const v = this.getGlobalTransform(r.targetId);
2011
- v && this.solveIK(i, v, r.boneCount || 2, l);
2011
+ v && this.solveIK(i, v, r.boneCount || 2, c);
2012
2012
  }
2013
2013
  }), i.constraints.some((s) => s.type !== "IK")) {
2014
2014
  const s = this.globalToLocal(i.parentId, e);
@@ -2030,10 +2030,10 @@ class ci {
2030
2030
  scale_y: (i.scale_y ?? 1) * (i.flip_y ? -1 : 1),
2031
2031
  length: e
2032
2032
  };
2033
- const s = this.getGlobalTransform(o.parentId), n = s.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n), l = s.x + (i.x * s.scale_x * a - i.y * s.scale_y * r), c = s.y + (i.x * s.scale_x * r + i.y * s.scale_y * a);
2033
+ const s = this.getGlobalTransform(o.parentId), n = s.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n), c = s.x + (i.x * s.scale_x * a - i.y * s.scale_y * r), l = s.y + (i.x * s.scale_x * r + i.y * s.scale_y * a);
2034
2034
  return {
2035
- x: l,
2036
- y: c,
2035
+ x: c,
2036
+ y: l,
2037
2037
  rotation: s.rotation + i.rotation,
2038
2038
  scale_x: s.scale_x * (i.scale_x ?? 1) * (i.flip_x ? -1 : 1),
2039
2039
  scale_y: s.scale_y * (i.scale_y ?? 1) * (i.flip_y ? -1 : 1),
@@ -2042,7 +2042,7 @@ class ci {
2042
2042
  }
2043
2043
  globalToLocal(t, i) {
2044
2044
  if (!t) return i;
2045
- const o = this.getGlobalTransform(t), e = o.scale_x === 0 ? 0 : 1 / o.scale_x, s = o.scale_y === 0 ? 0 : 1 / o.scale_y, n = -o.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n), l = i.x - o.x, c = i.y - o.y, f = (l * a - c * r) * e, u = (l * r + c * a) * s;
2045
+ const o = this.getGlobalTransform(t), e = o.scale_x === 0 ? 0 : 1 / o.scale_x, s = o.scale_y === 0 ? 0 : 1 / o.scale_y, n = -o.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n), c = i.x - o.x, l = i.y - o.y, f = (c * a - l * r) * e, u = (c * r + l * a) * s;
2046
2046
  return {
2047
2047
  x: f,
2048
2048
  y: u,
@@ -2052,11 +2052,11 @@ class ci {
2052
2052
  };
2053
2053
  }
2054
2054
  solveIK(t, i, o, e) {
2055
- var l;
2055
+ var c;
2056
2056
  const s = [];
2057
2057
  let n = t.id;
2058
- for (let c = 0; c < o && n; c++) {
2059
- const f = (l = this.artboard) == null ? void 0 : l.objects.find((u) => u.id === n);
2058
+ for (let l = 0; l < o && n; l++) {
2059
+ const f = (c = this.artboard) == null ? void 0 : c.objects.find((u) => u.id === n);
2060
2060
  if (!f) break;
2061
2061
  s.push({
2062
2062
  id: n,
@@ -2066,7 +2066,7 @@ class ci {
2066
2066
  }
2067
2067
  if (s.length < 2) return;
2068
2068
  const a = s.reverse(), r = 5;
2069
- for (let c = 0; c < r; c++) {
2069
+ for (let l = 0; l < r; l++) {
2070
2070
  const f = this.getGlobalTransform(t.id);
2071
2071
  for (let u = a.length - 2; u >= 0; u--) {
2072
2072
  const h = a[u], d = this.getGlobalTransform(h.id), p = f.x - d.x, y = f.y - d.y, m = i.x - d.x, b = i.y - d.y, v = Math.sqrt(p * p + y * y), S = Math.sqrt(m * m + b * b);
@@ -2081,7 +2081,7 @@ class ci {
2081
2081
  }
2082
2082
  }
2083
2083
  computeSpring(t, i, o, e, s, n, a, r) {
2084
- const l = a.stiffness ?? 100, c = a.damping ?? 10, f = a.mass ?? 1, u = -l * (t - s), h = -l * (i - n), d = -c * o, p = -c * e, y = (u + d) / f, m = (h + p) / f, b = o + y * r, v = e + m * r, S = t + b * r, C = i + v * r;
2084
+ const c = a.stiffness ?? 100, l = a.damping ?? 10, f = a.mass ?? 1, u = -c * (t - s), h = -c * (i - n), d = -l * o, p = -l * e, y = (u + d) / f, m = (h + p) / f, b = o + y * r, v = e + m * r, S = t + b * r, C = i + v * r;
2085
2085
  return { x: S, y: C, vx: b, vy: v };
2086
2086
  }
2087
2087
  handlePointerInput(t, i, o, e, s) {
@@ -2105,7 +2105,7 @@ class ci {
2105
2105
  this._totalScroll.x += t, this._totalScroll.y += i, this.scrollOffset = { x: this._totalScroll.x, y: this._totalScroll.y }, this.updateInput("scrollX", this._totalScroll.x), this.updateInput("scrollY", this._totalScroll.y);
2106
2106
  }
2107
2107
  handlePointerEvent(t, i, o) {
2108
- var r, l, c, f, u;
2108
+ var r, c, l, f, u;
2109
2109
  if (!this.artboard) return;
2110
2110
  t === "down" ? (this.isMouseDown = !0, this.updateInput("isMouseDown", !0)) : (t === "up" || t === "blur") && (this.isMouseDown = !1, this.updateInput("isMouseDown", !1));
2111
2111
  let e = null;
@@ -2152,9 +2152,9 @@ class ci {
2152
2152
  })) : t === "blur" && this.activeHoverIds.clear(), this.activeDropdownId && t === "down") {
2153
2153
  const h = this.artboard.objects.find((d) => d.id === this.activeDropdownId);
2154
2154
  if (h && (h.type === "Dropdown" || h.variant === "dropdown")) {
2155
- const d = this.objectStates.get(h.id), p = (d == null ? void 0 : d.options) || h.options || {}, y = h.geometry || {}, m = y.width ?? h.width ?? 200, b = y.height ?? h.height ?? 40, v = p.optionsList || [], S = p.itemHeight || 32, C = p.listPadding ?? 4, w = v.length * S + C * 2, I = this.getWorldTransform(h.id), M = m * Math.abs(I.scaleX), k = b * Math.abs(I.scaleY), T = I.y + k / 2 + 4, R = Math.abs(i - I.x) <= M / 2, P = o >= T && o <= T + w * Math.abs(I.scaleY);
2156
- if (R && P) {
2157
- const E = Math.abs(I.scaleY), x = o - (T + C * E), O = Math.floor(x / (S * E));
2155
+ const d = this.objectStates.get(h.id), p = (d == null ? void 0 : d.options) || h.options || {}, y = h.geometry || {}, m = y.width ?? h.width ?? 200, b = y.height ?? h.height ?? 40, v = p.optionsList || [], S = p.itemHeight || 32, C = p.listPadding ?? 4, w = v.length * S + C * 2, I = this.getWorldTransform(h.id), M = m * Math.abs(I.scaleX), k = b * Math.abs(I.scaleY), T = I.y + k / 2 + 4, x = Math.abs(i - I.x) <= M / 2, P = o >= T && o <= T + w * Math.abs(I.scaleY);
2156
+ if (x && P) {
2157
+ const E = Math.abs(I.scaleY), R = o - (T + C * E), O = Math.floor(R / (S * E));
2158
2158
  if (O >= 0 && O < v.length) {
2159
2159
  const W = v[O];
2160
2160
  p.selectedOption = W, p.isOpen = !1, this.activeDropdownId = null, h.inputId && this.setInternalInput(h.inputId, W), this.onComponentChange && this.onComponentChange({
@@ -2273,24 +2273,24 @@ class ci {
2273
2273
  const y = h.geometry, m = (y == null ? void 0 : y.datasets) || [], b = this.objectStates.get(h.id), v = (b == null ? void 0 : b.width) || (y == null ? void 0 : y.width) || 200, S = (b == null ? void 0 : b.height) || (y == null ? void 0 : y.height) || 150, C = this.getWorldTransform(h.id), w = 30, I = 20, M = v - w, k = S - I;
2274
2274
  let T = 1;
2275
2275
  m.forEach((E) => {
2276
- const x = Math.max(...E.data || [0]);
2277
- x > T && (T = x);
2276
+ const R = Math.max(...E.data || [0]);
2277
+ R > T && (T = R);
2278
2278
  });
2279
- let R = 1 / 0, P = null;
2280
- m.forEach((E, x) => {
2279
+ let x = 1 / 0, P = null;
2280
+ m.forEach((E, R) => {
2281
2281
  const O = E.data || [], W = M / Math.max(O.length - 1, 1);
2282
2282
  O.forEach((B, $) => {
2283
2283
  const Y = C.x - v / 2 + w + $ * W, H = C.y + S / 2 - I - B / T * k, K = Math.sqrt((i - Y) ** 2 + (o - H) ** 2);
2284
- K < R && (R = K, P = { dIdx: x, pIdx: $, val: B, label: E.label || `Dataset ${x + 1}` });
2284
+ K < x && (x = K, P = { dIdx: R, pIdx: $, val: B, label: E.label || `Dataset ${R + 1}` });
2285
2285
  });
2286
- }), P && R < 20 && this.onGraphPointClick && this.onGraphPointClick({ objectId: h.id, componentName: h.name, datasetIndex: P.dIdx, pointIndex: P.pIdx, value: P.val, label: P.label }), this.onComponentChange && this.onComponentChange({ objectId: h.id, componentName: h.name, variant: "linegraph", property: "click", value: (P == null ? void 0 : P.val) ?? null });
2286
+ }), P && x < 20 && this.onGraphPointClick && this.onGraphPointClick({ objectId: h.id, componentName: h.name, datasetIndex: P.dIdx, pointIndex: P.pIdx, value: P.val, label: P.label }), this.onComponentChange && this.onComponentChange({ objectId: h.id, componentName: h.name, variant: "linegraph", property: "click", value: (P == null ? void 0 : P.val) ?? null });
2287
2287
  }
2288
2288
  if (t === "click") {
2289
- const y = (l = this.artboard) == null ? void 0 : l.objects.find((v) => v.id === e.id), m = this.focusedId, b = (y == null ? void 0 : y.type) === "InputBox" || (y == null ? void 0 : y.type) === "Component" && y.variant === "inputbox";
2289
+ const y = (c = this.artboard) == null ? void 0 : c.objects.find((v) => v.id === e.id), m = this.focusedId, b = (y == null ? void 0 : y.type) === "InputBox" || (y == null ? void 0 : y.type) === "Component" && y.variant === "inputbox";
2290
2290
  if (y && b) {
2291
2291
  if (this.focusedId = e.id, this.log(`[Engine] Focus set to: ${e.id}`), m !== this.focusedId) {
2292
2292
  if (m) {
2293
- const v = (c = this.artboard) == null ? void 0 : c.objects.find((S) => S.id === m);
2293
+ const v = (l = this.artboard) == null ? void 0 : l.objects.find((S) => S.id === m);
2294
2294
  v && this.onInputBlur && this.onInputBlur(v.name);
2295
2295
  }
2296
2296
  this.onInputFocus && this.onInputFocus(y.name);
@@ -2342,8 +2342,8 @@ class ci {
2342
2342
  this.artboard && (this.activeKeys.delete(t.key.toLowerCase()), this.activeKeys.delete(t.code));
2343
2343
  }
2344
2344
  fireEventForObject(t, i) {
2345
- var c, f, u, h, d;
2346
- const o = (c = this.artboard) == null ? void 0 : c.objects.find((p) => p.id === t);
2345
+ var l, f, u, h, d;
2346
+ const o = (l = this.artboard) == null ? void 0 : l.objects.find((p) => p.id === t);
2347
2347
  if (!o) return;
2348
2348
  const e = /* @__PURE__ */ new Set([i, i.toLowerCase()]), s = i.toLowerCase();
2349
2349
  s === "onclick" || s === "click" || s === "onpointerdown" || s === "pointerdown" ? this.fireAnalyticsEvent(t, "click") : (s === "onpointerenter" || s === "hover" || s === "move") && this.fireAnalyticsEvent(t, "hover"), s === "onclick" || s === "click" ? (e.add("click"), e.add("onclick")) : s === "onpointerdown" || s === "pointerdown" ? (e.add("pointerdown"), e.add("onpointerdown")) : s === "onpointerup" || s === "pointerup" ? (e.add("pointerup"), e.add("onpointerup")) : s === "onpointerenter" || s === "hover" || s === "move" ? (e.add("hover"), e.add("onpointerenter")) : s === "onpointerleave" || s === "blur" ? (e.add("onpointerleave"), e.add("blur")) : s === "drag" || s === "ondrag" ? (e.add("drag"), e.add("ondrag")) : s === "toggle" || s === "ontoggle" ? (e.add("toggle"), e.add("ontoggle")) : s === "toggle true" || s === "toggle_true" || s === "toggletrue" ? (e.add("toggle true"), e.add("toggle_true"), e.add("toggletrue")) : (s === "toggle false" || s === "toggle_false" || s === "togglefalse") && (e.add("toggle false"), e.add("toggle_false"), e.add("togglefalse"));
@@ -2390,51 +2390,51 @@ class ci {
2390
2390
  }
2391
2391
  this.onTrigger && this.onTrigger(i, a.action);
2392
2392
  }
2393
- const l = (o.triggers || []).find((p) => {
2393
+ const c = (o.triggers || []).find((p) => {
2394
2394
  const y = p.eventType.toLowerCase();
2395
2395
  let m = !1;
2396
2396
  return (e.has(y) || y === "click" && e.has("onclick") || y === "hover" && (e.has("onpointerenter") || e.has("hover")) || y === "pointerdown" && e.has("onpointerdown") || y === "pointerup" && e.has("onpointerup")) && (m = !0), m && p.conditions && p.conditions.length > 0 ? this.checkConditions(p.conditions) : m;
2397
2397
  });
2398
- if (l && l.entryAnimationId) {
2399
- this.log(`[Engine] Trigger matched: ${i} (as ${l.eventType}) -> Animation ${l.entryAnimationId}`);
2400
- const p = (d = (h = this.artboard) == null ? void 0 : h.animations) == null ? void 0 : d.find((y) => y.id === l.entryAnimationId);
2398
+ if (c && c.entryAnimationId) {
2399
+ this.log(`[Engine] Trigger matched: ${i} (as ${c.eventType}) -> Animation ${c.entryAnimationId}`);
2400
+ const p = (d = (h = this.artboard) == null ? void 0 : h.animations) == null ? void 0 : d.find((y) => y.id === c.entryAnimationId);
2401
2401
  p && (this.activeTriggers.set(o.id, {
2402
- triggerId: l.id,
2402
+ triggerId: c.id,
2403
2403
  animation: p,
2404
2404
  time: 0,
2405
2405
  phase: "entry",
2406
2406
  elapsedHold: 0,
2407
- filterObjectId: l.targetObjectId
2408
- }), this.onTrigger && this.onTrigger(l.name, p.name));
2407
+ filterObjectId: c.targetObjectId
2408
+ }), this.onTrigger && this.onTrigger(c.name, p.name));
2409
2409
  }
2410
2410
  }
2411
2411
  fireAnalyticsEvent(t, i) {
2412
- var r, l;
2413
- const o = (r = this.artboard) == null ? void 0 : r.objects.find((c) => c.id === t);
2412
+ var r, c;
2413
+ const o = (r = this.artboard) == null ? void 0 : r.objects.find((l) => l.id === t);
2414
2414
  if (!o) return;
2415
- const e = (l = o.style) == null ? void 0 : l.analytics;
2415
+ const e = (c = o.style) == null ? void 0 : c.analytics;
2416
2416
  if (!e || !e.isEnabled || e.triggerType !== i) return;
2417
2417
  const s = e.eventName || `${o.name.toLowerCase().replace(/\s+/g, "_")}_interacted`, n = {};
2418
- e.parameters && Array.isArray(e.parameters) && e.parameters.forEach((c) => {
2419
- if (c.type === "literal")
2420
- n[c.key] = c.value;
2421
- else if (c.type === "variable") {
2422
- const f = this.inputs.get(c.value);
2423
- n[c.key] = f !== void 0 ? f : "";
2418
+ e.parameters && Array.isArray(e.parameters) && e.parameters.forEach((l) => {
2419
+ if (l.type === "literal")
2420
+ n[l.key] = l.value;
2421
+ else if (l.type === "variable") {
2422
+ const f = this.inputs.get(l.value);
2423
+ n[l.key] = f !== void 0 ? f : "";
2424
2424
  }
2425
2425
  }), this.log(`[ExodeUI Analytics] Dispatching event "${s}" via ${i} trigger:`, n);
2426
2426
  const a = e.platforms || { ga4: !0, meta: !0, mixpanel: !1 };
2427
2427
  if (a.ga4) {
2428
- const c = window;
2429
- typeof c.gtag == "function" ? (c.gtag("event", s, n), this.log(`[ExodeUI Analytics] GA4: Event "${s}" sent successfully.`)) : this.warn(`[ExodeUI Analytics] GA4: window.gtag is not a function. Event "${s}" skipped.`);
2428
+ const l = window;
2429
+ typeof l.gtag == "function" ? (l.gtag("event", s, n), this.log(`[ExodeUI Analytics] GA4: Event "${s}" sent successfully.`)) : this.warn(`[ExodeUI Analytics] GA4: window.gtag is not a function. Event "${s}" skipped.`);
2430
2430
  }
2431
2431
  if (a.meta) {
2432
- const c = window;
2433
- typeof c.fbq == "function" ? (c.fbq("track", s, n), this.log(`[ExodeUI Analytics] Meta Pixel: Event "${s}" sent successfully.`)) : this.warn(`[ExodeUI Analytics] Meta Pixel: window.fbq is not a function. Event "${s}" skipped.`);
2432
+ const l = window;
2433
+ typeof l.fbq == "function" ? (l.fbq("track", s, n), this.log(`[ExodeUI Analytics] Meta Pixel: Event "${s}" sent successfully.`)) : this.warn(`[ExodeUI Analytics] Meta Pixel: window.fbq is not a function. Event "${s}" skipped.`);
2434
2434
  }
2435
2435
  if (a.mixpanel) {
2436
- const c = window;
2437
- c.mixpanel && typeof c.mixpanel.track == "function" ? (c.mixpanel.track(s, n), this.log(`[ExodeUI Analytics] Mixpanel: Event "${s}" sent successfully.`)) : this.warn(`[ExodeUI Analytics] Mixpanel: window.mixpanel.track is not a function. Event "${s}" skipped.`);
2436
+ const l = window;
2437
+ l.mixpanel && typeof l.mixpanel.track == "function" ? (l.mixpanel.track(s, n), this.log(`[ExodeUI Analytics] Mixpanel: Event "${s}" sent successfully.`)) : this.warn(`[ExodeUI Analytics] Mixpanel: window.mixpanel.track is not a function. Event "${s}" skipped.`);
2438
2438
  }
2439
2439
  }
2440
2440
  initGlobalAnimationTriggers() {
@@ -2484,9 +2484,9 @@ class ci {
2484
2484
  scaleY: i.scale_y ?? 1,
2485
2485
  rotation: i.rotation ?? 0
2486
2486
  };
2487
- const e = this.getWorldTransform(o.parentId), s = e.rotation * (Math.PI / 180), n = Math.cos(s), a = Math.sin(s), r = i.x * e.scaleX, l = i.y * e.scaleY, c = e.x + (r * n - l * a), f = e.y + (r * a + l * n);
2487
+ const e = this.getWorldTransform(o.parentId), s = e.rotation * (Math.PI / 180), n = Math.cos(s), a = Math.sin(s), r = i.x * e.scaleX, c = i.y * e.scaleY, l = e.x + (r * n - c * a), f = e.y + (r * a + c * n);
2488
2488
  return {
2489
- x: c,
2489
+ x: l,
2490
2490
  y: f,
2491
2491
  scaleX: (i.scale_x ?? 1) * e.scaleX,
2492
2492
  scaleY: (i.scale_y ?? 1) * e.scaleY,
@@ -2496,14 +2496,14 @@ class ci {
2496
2496
  hitTest(t, i, o) {
2497
2497
  var v, S;
2498
2498
  if (!this.objectStates.get(t.id)) return !1;
2499
- const s = ((v = t.geometry) == null ? void 0 : v.width) ?? t.width ?? 100, n = ((S = t.geometry) == null ? void 0 : S.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = i - a.x, l = o - a.y, c = -a.rotation * (Math.PI / 180), f = Math.cos(c), u = Math.sin(c), h = r * f - l * u, d = r * u + l * f, p = a.scaleX, y = a.scaleY, m = s * Math.abs(p), b = n * Math.abs(y);
2499
+ const s = ((v = t.geometry) == null ? void 0 : v.width) ?? t.width ?? 100, n = ((S = t.geometry) == null ? void 0 : S.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = i - a.x, c = o - a.y, l = -a.rotation * (Math.PI / 180), f = Math.cos(l), u = Math.sin(l), h = r * f - c * u, d = r * u + c * f, p = a.scaleX, y = a.scaleY, m = s * Math.abs(p), b = n * Math.abs(y);
2500
2500
  return Math.abs(h) <= m / 2 && Math.abs(d) <= b / 2;
2501
2501
  }
2502
2502
  updateSliderValueFromPointer(t, i, o) {
2503
2503
  var I;
2504
2504
  const e = this.objectStates.get(t.id);
2505
2505
  if (!e) return;
2506
- const s = t.options || {}, n = ((I = t.geometry) == null ? void 0 : I.width) ?? t.width ?? 200, a = this.getWorldTransform(t.id), r = i - a.x, l = o - a.y, c = -a.rotation * (Math.PI / 180), f = Math.cos(c), u = Math.sin(c), h = r * f - l * u, d = s.thumbWidth ?? 16, p = n - d;
2506
+ const s = t.options || {}, n = ((I = t.geometry) == null ? void 0 : I.width) ?? t.width ?? 200, a = this.getWorldTransform(t.id), r = i - a.x, c = o - a.y, l = -a.rotation * (Math.PI / 180), f = Math.cos(l), u = Math.sin(l), h = r * f - c * u, d = s.thumbWidth ?? 16, p = n - d;
2507
2507
  let m = (h + p / 2) / p;
2508
2508
  m = Math.max(0, Math.min(1, m));
2509
2509
  const b = s.min ?? 0, v = s.max ?? 100, S = s.step || 1;
@@ -2522,8 +2522,8 @@ class ci {
2522
2522
  var I, M;
2523
2523
  const e = this.objectStates.get(t.id);
2524
2524
  if (!e) return;
2525
- const s = (e == null ? void 0 : e.width) !== void 0 ? e.width : ((I = t.geometry) == null ? void 0 : I.width) ?? t.width ?? 100, n = (e == null ? void 0 : e.height) !== void 0 ? e.height : ((M = t.geometry) == null ? void 0 : M.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = i - a.x, l = o - a.y, c = -a.rotation * (Math.PI / 180), f = Math.cos(c), u = Math.sin(c);
2526
- let h = (r * f - l * u) / Math.max(1e-3, Math.abs(a.scaleX || 1)), d = (r * u + l * f) / Math.max(1e-3, Math.abs(a.scaleY || 1));
2525
+ const s = (e == null ? void 0 : e.width) !== void 0 ? e.width : ((I = t.geometry) == null ? void 0 : I.width) ?? t.width ?? 100, n = (e == null ? void 0 : e.height) !== void 0 ? e.height : ((M = t.geometry) == null ? void 0 : M.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = i - a.x, c = o - a.y, l = -a.rotation * (Math.PI / 180), f = Math.cos(l), u = Math.sin(l);
2526
+ let h = (r * f - c * u) / Math.max(1e-3, Math.abs(a.scaleX || 1)), d = (r * u + c * f) / Math.max(1e-3, Math.abs(a.scaleY || 1));
2527
2527
  t.handleOrigin === "top-left" ? (h -= s / 2, d -= n / 2) : t.handleOrigin === "bottom-right" && (h += s / 2, d += n / 2);
2528
2528
  const p = Math.min(s, n) * 0.45, y = Math.min(s, n) * 0.15, m = p - y;
2529
2529
  let b = h / m, v = d / m;
@@ -2541,39 +2541,39 @@ class ci {
2541
2541
  let s = e.handleX ?? o.handleX ?? 0, n = e.handleY ?? o.handleY ?? 0;
2542
2542
  if (((a = o.inputBinding) == null ? void 0 : a.type) === "keyboard" && o.inputBinding.keyboardConfig) {
2543
2543
  const r = o.inputBinding.keyboardConfig;
2544
- let l = s, c = n;
2544
+ let c = s, l = n;
2545
2545
  const u = (r.speed || 5) * t;
2546
2546
  let h = !1;
2547
- this.activeKeys.has(r.upKey.toLowerCase()) && (c -= u, h = !0), this.activeKeys.has(r.downKey.toLowerCase()) && (c += u, h = !0), this.activeKeys.has(r.leftKey.toLowerCase()) && (l -= u, h = !0), this.activeKeys.has(r.rightKey.toLowerCase()) && (l += u, h = !0), o.joystickType === "1D_X" && (c = 0), o.joystickType === "1D_Y" && (l = 0);
2548
- const d = Math.sqrt(l * l + c * c);
2549
- d > 1 && (l /= d, c /= d), !h && o.isSpringReturn !== !1 && (l += (0 - l) * (10 * t), c += (0 - c) * (10 * t), Math.abs(l) < 0.01 && (l = 0), Math.abs(c) < 0.01 && (c = 0)), s = l, n = c;
2547
+ this.activeKeys.has(r.upKey.toLowerCase()) && (l -= u, h = !0), this.activeKeys.has(r.downKey.toLowerCase()) && (l += u, h = !0), this.activeKeys.has(r.leftKey.toLowerCase()) && (c -= u, h = !0), this.activeKeys.has(r.rightKey.toLowerCase()) && (c += u, h = !0), o.joystickType === "1D_X" && (l = 0), o.joystickType === "1D_Y" && (c = 0);
2548
+ const d = Math.sqrt(c * c + l * l);
2549
+ d > 1 && (c /= d, l /= d), !h && o.isSpringReturn !== !1 && (c += (0 - c) * (10 * t), l += (0 - l) * (10 * t), Math.abs(c) < 0.01 && (c = 0), Math.abs(l) < 0.01 && (l = 0)), s = c, n = l;
2550
2550
  }
2551
2551
  if (e.handleX = s, e.handleY = n, o.handleX = s, o.handleY = n, o.bindings && o.bindings.length > 0) {
2552
2552
  const r = Math.sqrt(s * s + n * n);
2553
- let l = Math.atan2(n, s) * (180 / Math.PI);
2554
- l < 0 && (l += 360), o.bindings.forEach((c) => {
2553
+ let c = Math.atan2(n, s) * (180 / Math.PI);
2554
+ c < 0 && (c += 360), o.bindings.forEach((l) => {
2555
2555
  var h, d;
2556
2556
  let f = 0;
2557
- c.sourceAxis === "x" ? f = o.invertX ? -s : s : c.sourceAxis === "y" ? f = o.invertY ? -n : n : c.sourceAxis === "distance" ? f = r : c.sourceAxis === "angle" && (f = l);
2558
- const u = (h = this.artboard) == null ? void 0 : h.objects.find((p) => p.id === c.targetObjectId);
2557
+ l.sourceAxis === "x" ? f = o.invertX ? -s : s : l.sourceAxis === "y" ? f = o.invertY ? -n : n : l.sourceAxis === "distance" ? f = r : l.sourceAxis === "angle" && (f = c);
2558
+ const u = (h = this.artboard) == null ? void 0 : h.objects.find((p) => p.id === l.targetObjectId);
2559
2559
  if (u) {
2560
- if (c.actionType === "bind" && c.targetProperty && c.isContinuous !== !1) {
2561
- const p = c.sourceMin ?? -1, y = c.sourceMax ?? 1, m = c.targetMin ?? 0, b = c.targetMax ?? 100, v = (f - p) / (y - p), S = Math.max(0, Math.min(1, v));
2560
+ if (l.actionType === "bind" && l.targetProperty && l.isContinuous !== !1) {
2561
+ const p = l.sourceMin ?? -1, y = l.sourceMax ?? 1, m = l.targetMin ?? 0, b = l.targetMax ?? 100, v = (f - p) / (y - p), S = Math.max(0, Math.min(1, v));
2562
2562
  let C = m + S * (b - m);
2563
- c.step && c.step > 0 && (C = Math.round(C / c.step) * c.step);
2563
+ l.step && l.step > 0 && (C = Math.round(C / l.step) * l.step);
2564
2564
  const w = this.objectStates.get(u.id);
2565
2565
  if (w) {
2566
- const I = c.isRelative !== !1, M = I ? u.x ?? 0 : 0, k = I ? u.y ?? 0 : 0, T = I ? u.rotation ?? 0 : 0, R = I ? u.scale_x ?? 1 : 0, P = I ? u.scale_y ?? 1 : 0, E = I ? u.opacity ?? 100 : 0;
2567
- c.targetProperty === "x" ? w.x = M + C : c.targetProperty === "y" ? w.y = k + C : c.targetProperty === "rotation" || c.targetProperty === "r" ? w.rotation = T + C : c.targetProperty === "scaleX" ? w.scale_x = R + C : c.targetProperty === "scaleY" ? w.scale_y = P + C : c.targetProperty === "opacity" && (w.opacity = E + C);
2566
+ const I = l.isRelative !== !1, M = I ? u.x ?? 0 : 0, k = I ? u.y ?? 0 : 0, T = I ? u.rotation ?? 0 : 0, x = I ? u.scale_x ?? 1 : 0, P = I ? u.scale_y ?? 1 : 0, E = I ? u.opacity ?? 100 : 0;
2567
+ l.targetProperty === "x" || l.targetProperty === "transform.x" ? w.x = M + C : l.targetProperty === "y" || l.targetProperty === "transform.y" ? w.y = k + C : l.targetProperty === "rotation" || l.targetProperty === "r" || l.targetProperty === "transform.rotation" ? w.rotation = T + C : l.targetProperty === "scaleX" || l.targetProperty === "transform.scale_x" ? w.scale_x = x + C : l.targetProperty === "scaleY" || l.targetProperty === "transform.scale_y" ? w.scale_y = P + C : (l.targetProperty === "opacity" || l.targetProperty === "transform.opacity") && (w.opacity = E + C);
2568
2568
  }
2569
- (d = u.physics) != null && d.enabled && this.physicsEngine && (c.targetProperty === "x" || c.targetProperty === "y") && (c.targetProperty === "x" ? this.physicsEngine.applyForce(u.id, (C - ((w == null ? void 0 : w.x) || 0)) * 10, 0) : c.targetProperty === "y" && this.physicsEngine.applyForce(u.id, 0, (C - ((w == null ? void 0 : w.y) || 0)) * 10));
2570
- } else if (c.actionType === "playAnimation" || c.actionType === "stopAnimation" || c.actionType === "pauseAnimation") {
2569
+ (d = u.physics) != null && d.enabled && this.physicsEngine && (l.targetProperty === "x" || l.targetProperty === "transform.x" || l.targetProperty === "y" || l.targetProperty === "transform.y") && (l.targetProperty === "x" || l.targetProperty === "transform.x" ? this.physicsEngine.applyForce(u.id, (C - ((w == null ? void 0 : w.x) || 0)) * 10, 0) : (l.targetProperty === "y" || l.targetProperty === "transform.y") && this.physicsEngine.applyForce(u.id, 0, (C - ((w == null ? void 0 : w.y) || 0)) * 10));
2570
+ } else if (l.actionType === "playAnimation" || l.actionType === "stopAnimation" || l.actionType === "pauseAnimation") {
2571
2571
  let p = !1;
2572
- const y = c.threshold ?? 0;
2573
- c.condition === "always" ? p = !0 : c.condition === ">" ? p = f > y : c.condition === "<" ? p = f < y : c.condition === "==" && (p = Math.abs(f - y) < 0.01);
2574
- const m = e[`_prev_src_${c.id}`] ?? f;
2572
+ const y = l.threshold ?? 0;
2573
+ l.condition === "always" ? p = !0 : l.condition === ">" ? p = f > y : l.condition === "<" ? p = f < y : l.condition === "==" && (p = Math.abs(f - y) < 0.01);
2574
+ const m = e[`_prev_src_${l.id}`] ?? f;
2575
2575
  let b = !1;
2576
- c.condition === "always" ? b = !0 : c.condition === ">" ? b = m > y : c.condition === "<" ? b = m < y : c.condition === "==" && (b = Math.abs(m - y) < 0.01), e[`_prev_src_${c.id}`] = f, p && !b && c.targetAnimationId && (c.actionType === "playAnimation" || c.actionType);
2576
+ l.condition === "always" ? b = !0 : l.condition === ">" ? b = m > y : l.condition === "<" ? b = m < y : l.condition === "==" && (b = Math.abs(m - y) < 0.01), e[`_prev_src_${l.id}`] = f, p && !b && l.targetAnimationId && (l.actionType === "playAnimation" || l.actionType);
2577
2577
  }
2578
2578
  }
2579
2579
  });
@@ -2581,7 +2581,7 @@ class ci {
2581
2581
  });
2582
2582
  }
2583
2583
  applyBlendState(t, i) {
2584
- var l, c, f, u, h, d, p, y;
2584
+ var c, l, f, u, h, d, p, y;
2585
2585
  if (!t.blendAnimations || t.blendAnimations.length === 0) return;
2586
2586
  let o = 0, e = 0;
2587
2587
  t.blendInputX && (o = this.inputs.get(t.blendInputX) ?? 0), t.blendInputY && (e = this.inputs.get(t.blendInputY) ?? 0);
@@ -2590,7 +2590,7 @@ class ci {
2590
2590
  if (t.blendType === "1D") {
2591
2591
  const m = [...t.blendAnimations].sort((b, v) => b.position[0] - v.position[0]);
2592
2592
  if (m.length === 1) {
2593
- const b = (c = (l = this.artboard) == null ? void 0 : l.animations) == null ? void 0 : c.find((v) => v.id === m[0].animationId);
2593
+ const b = (l = (c = this.artboard) == null ? void 0 : c.animations) == null ? void 0 : l.find((v) => v.id === m[0].animationId);
2594
2594
  b && (s.push({ anim: b, weight: 1 }), n = 1);
2595
2595
  } else {
2596
2596
  let b = 0;
@@ -2628,8 +2628,8 @@ class ci {
2628
2628
  };
2629
2629
  s.forEach(({ anim: m, weight: b }) => {
2630
2630
  m.tracks && m.tracks.forEach((v) => {
2631
- var R, P;
2632
- const S = v.object_id || v.objectId, C = v.property, w = (R = this.artboard) == null ? void 0 : R.objects.find((E) => E.id === S);
2631
+ var x, P;
2632
+ const S = v.object_id || v.objectId, C = v.property, w = (x = this.artboard) == null ? void 0 : x.objects.find((E) => E.id === S);
2633
2633
  if (((P = w == null ? void 0 : w.physics) == null ? void 0 : P.enabled) && w.physics.bodyType !== "Static" && (C === "x" || C === "y" || C === "rotation")) return;
2634
2634
  const M = this.interpolate(v.keyframes, i);
2635
2635
  if (M === void 0) return;
@@ -2658,24 +2658,24 @@ class ci {
2658
2658
  !v || !S || m.forEach((w, I) => {
2659
2659
  let M = w.value;
2660
2660
  if (w.type === "color" && w.colorAcc) {
2661
- const k = Math.round(w.colorAcc.r).toString(16).padStart(2, "0"), T = Math.round(w.colorAcc.g).toString(16).padStart(2, "0"), R = Math.round(w.colorAcc.b).toString(16).padStart(2, "0");
2662
- M = `#${k}${T}${R}`;
2661
+ const k = Math.round(w.colorAcc.r).toString(16).padStart(2, "0"), T = Math.round(w.colorAcc.g).toString(16).padStart(2, "0"), x = Math.round(w.colorAcc.b).toString(16).padStart(2, "0");
2662
+ M = `#${k}${T}${x}`;
2663
2663
  }
2664
2664
  if (I.includes(".")) {
2665
2665
  const k = (I || "").split(".");
2666
2666
  let T = v;
2667
- for (let R = 0; R < k.length - 1; R++) {
2668
- if (typeof T[k[R]] != "object" || T[k[R]] === null) {
2667
+ for (let x = 0; x < k.length - 1; x++) {
2668
+ if (typeof T[k[x]] != "object" || T[k[x]] === null) {
2669
2669
  let P = S;
2670
- for (let E = 0; E <= R; E++)
2670
+ for (let E = 0; E <= x; E++)
2671
2671
  P = P ? P[k[E]] : null;
2672
- if (k[R] === "corner_radius" || k[R] === "cornerRadius") {
2673
- const E = typeof T[k[R]] == "number" ? T[k[R]] : typeof P == "number" ? P : 0;
2674
- T[k[R]] = { tl: E, tr: E, bl: E, br: E };
2672
+ if (k[x] === "corner_radius" || k[x] === "cornerRadius") {
2673
+ const E = typeof T[k[x]] == "number" ? T[k[x]] : typeof P == "number" ? P : 0;
2674
+ T[k[x]] = { tl: E, tr: E, bl: E, br: E };
2675
2675
  } else
2676
- T[k[R]] = P ? JSON.parse(JSON.stringify(P)) : {};
2676
+ T[k[x]] = P ? JSON.parse(JSON.stringify(P)) : {};
2677
2677
  }
2678
- T = T[k[R]];
2678
+ T = T[k[x]];
2679
2679
  }
2680
2680
  T[k[k.length - 1]] = M, k[k.length - 1] === "color" && (k[k.length - 2] === "fill" || k[k.length - 2] === "stroke") && (T.type = "Solid");
2681
2681
  } else
@@ -2697,20 +2697,20 @@ class ci {
2697
2697
  let r = e.property;
2698
2698
  if (a && (r === "x" || r === "y" || r === "rotation"))
2699
2699
  return;
2700
- const l = this.objectStates.get(s);
2701
- if (!l) {
2700
+ const c = this.objectStates.get(s);
2701
+ if (!c) {
2702
2702
  this.frameCount % 600 === 0 && this.debugLog(`Skipping track: Object ${s} not found in state`);
2703
2703
  return;
2704
2704
  }
2705
- const c = this.interpolate(e.keyframes, i);
2706
- if (c !== void 0) {
2705
+ const l = this.interpolate(e.keyframes, i);
2706
+ if (l !== void 0) {
2707
2707
  if (this.frameCount % 240 === 0) {
2708
- const d = (n == null ? void 0 : n.name) || s, p = typeof c == "object" ? JSON.stringify(c).slice(0, 50) : c;
2708
+ const d = (n == null ? void 0 : n.name) || s, p = typeof l == "object" ? JSON.stringify(l).slice(0, 50) : l;
2709
2709
  this.debugLog(`[Anim] Applying ${r} = ${p} to ${d}`);
2710
2710
  }
2711
2711
  if (r.includes(".")) {
2712
2712
  const d = (r || "").split(".");
2713
- let p = l;
2713
+ let p = c;
2714
2714
  for (let y = 0; y < d.length - 1; y++) {
2715
2715
  if (typeof p[d[y]] != "object" || p[d[y]] === null) {
2716
2716
  let m = n;
@@ -2724,17 +2724,17 @@ class ci {
2724
2724
  }
2725
2725
  p = p[d[y]];
2726
2726
  }
2727
- p[d[d.length - 1]] = c, d[d.length - 1] === "color" && (d[d.length - 2] === "fill" || d[d.length - 2] === "stroke") && (p.type = "Solid");
2727
+ p[d[d.length - 1]] = l, d[d.length - 1] === "color" && (d[d.length - 2] === "fill" || d[d.length - 2] === "stroke") && (p.type = "Solid");
2728
2728
  } else
2729
- r === "fill" ? (l.style || (l.style = {}), l.style.fill = c) : r === "stroke" ? (l.style || (l.style = {}), l.style.stroke = c) : l[r] = c;
2729
+ r === "fill" ? (c.style || (c.style = {}), c.style.fill = l) : r === "stroke" ? (c.style || (c.style = {}), c.style.stroke = l) : c[r] = l;
2730
2730
  if (this.physicsEngine && ((h = n == null ? void 0 : n.physics) != null && h.enabled) && n.physics.bodyType === "Static")
2731
2731
  if (r === "x") {
2732
2732
  const d = this.physicsEngine.getPosition(s);
2733
- d && this.physicsEngine.setPosition(s, c, d.y);
2733
+ d && this.physicsEngine.setPosition(s, l, d.y);
2734
2734
  } else if (r === "y") {
2735
2735
  const d = this.physicsEngine.getPosition(s);
2736
- d && this.physicsEngine.setPosition(s, d.x, c);
2737
- } else r === "rotation" && this.physicsEngine.setRotation(s, c * (Math.PI / 180));
2736
+ d && this.physicsEngine.setPosition(s, d.x, l);
2737
+ } else r === "rotation" && this.physicsEngine.setRotation(s, l * (Math.PI / 180));
2738
2738
  }
2739
2739
  });
2740
2740
  }
@@ -2758,8 +2758,8 @@ class ci {
2758
2758
  }
2759
2759
  if (Array.isArray(o.value) && Array.isArray(e.value))
2760
2760
  return o.value.length === e.value.length ? o.value.map((a, r) => {
2761
- const l = e.value[r];
2762
- return typeof a == "number" && typeof l == "number" ? a + (l - a) * n : n < 0.5 ? a : l;
2761
+ const c = e.value[r];
2762
+ return typeof a == "number" && typeof c == "number" ? a + (c - a) * n : n < 0.5 ? a : c;
2763
2763
  }) : n < 0.5 ? o.value : e.value;
2764
2764
  if (typeof o.value == "object" && typeof e.value == "object" && o.value !== null && e.value !== null) {
2765
2765
  if (o.value.width !== void 0 && o.value.color !== void 0)
@@ -2767,9 +2767,9 @@ class ci {
2767
2767
  if (o.value.type && e.value.type)
2768
2768
  return this.interpolateFill(o.value, e.value, n);
2769
2769
  const a = {};
2770
- return (/* @__PURE__ */ new Set([...Object.keys(o.value), ...Object.keys(e.value)])).forEach((l) => {
2771
- const c = o.value[l], f = e.value[l];
2772
- typeof c == "number" && typeof f == "number" ? a[l] = c + (f - c) * n : c === void 0 ? a[l] = f : f === void 0 ? a[l] = c : a[l] = n < 0.5 ? c : f;
2770
+ return (/* @__PURE__ */ new Set([...Object.keys(o.value), ...Object.keys(e.value)])).forEach((c) => {
2771
+ const l = o.value[c], f = e.value[c];
2772
+ typeof l == "number" && typeof f == "number" ? a[c] = l + (f - l) * n : l === void 0 ? a[c] = f : f === void 0 ? a[c] = l : a[c] = n < 0.5 ? l : f;
2773
2773
  }), a;
2774
2774
  }
2775
2775
  return typeof o.value == "number" && typeof e.value == "number" ? o.value + (e.value - o.value) * n : n < 0.5 ? o.value : e.value;
@@ -2788,11 +2788,11 @@ class ci {
2788
2788
  g: parseInt(m.substring(2, 4), 16),
2789
2789
  b: parseInt(m.substring(4, 6), 16)
2790
2790
  };
2791
- }, r = a(s), l = a(n), c = Math.round(r.r + (l.r - r.r) * o), f = Math.round(r.g + (l.g - r.g) * o), u = Math.round(r.b + (l.b - r.b) * o), h = (y) => {
2791
+ }, r = a(s), c = a(n), l = Math.round(r.r + (c.r - r.r) * o), f = Math.round(r.g + (c.g - r.g) * o), u = Math.round(r.b + (c.b - r.b) * o), h = (y) => {
2792
2792
  const m = Math.max(0, Math.min(255, y)).toString(16);
2793
2793
  return m.length === 1 ? "0" + m : m;
2794
2794
  };
2795
- return `#${h(c)}${h(f)}${h(u)}`;
2795
+ return `#${h(l)}${h(f)}${h(u)}`;
2796
2796
  }
2797
2797
  interpolateStops(t, i, o) {
2798
2798
  return !t || !i || t.length !== i.length ? o < 0.5 ? t : i : t.map((e, s) => {
@@ -2849,46 +2849,46 @@ class ci {
2849
2849
  }
2850
2850
  }
2851
2851
  (this.artboard.clipContent === !0 || this.artboard.clip_content === !0) && (t.beginPath(), t.rect(0, 0, s, n), t.clip());
2852
- const l = /* @__PURE__ */ new Map();
2853
- this.artboard.objects.forEach((u) => l.set(u.id, u)), this.artboard.objects.filter((u) => !u.parentId).map((u, h) => {
2852
+ const c = /* @__PURE__ */ new Map();
2853
+ this.artboard.objects.forEach((u) => c.set(u.id, u)), this.artboard.objects.filter((u) => !u.parentId).map((u, h) => {
2854
2854
  const d = this.objectStates.get(u.id), p = (d == null ? void 0 : d.zIndex) ?? h;
2855
2855
  return { obj: u, zIndex: p };
2856
2856
  }).sort((u, h) => u.zIndex - h.zIndex).forEach(({ obj: u }) => {
2857
- this.renderObject(t, u, l);
2857
+ this.renderObject(t, u, c);
2858
2858
  }), this._emitterPools.forEach((u, h) => {
2859
- if (!(u.length === 0 || !l.get(h)))
2859
+ if (!(u.length === 0 || !c.get(h)))
2860
2860
  for (const p of u)
2861
2861
  t.save(), t.globalAlpha = p.opacity, t.fillStyle = p.color, t.beginPath(), t.arc(p.x, p.y, Math.max(1, p.size * p.opacity), 0, Math.PI * 2), t.fill(), t.restore();
2862
2862
  }), this.lastRenderTime = performance.now() - e, this.debugMode && this.frameCount % 60 === 0 && this.log(`[Engine Debug] Rendered ${this.debug_objectsRendered}/${this.debug_objectsTotal} objects in ${this.lastRenderTime.toFixed(2)}ms`), t.restore();
2863
2863
  }
2864
2864
  isObjectInView(t, i, o, e, s, n = 0) {
2865
- const a = t.getTransform(), r = i * a.a + o * a.c + a.e, l = i * a.b + o * a.d + a.f, c = Math.sqrt(a.a * a.a + a.b * a.b), f = Math.sqrt(a.c * a.c + a.d * a.d), u = (e / 2 + n) * c, h = (s / 2 + n) * f;
2866
- return r + u >= 0 && r - u <= this.canvasWidth && l + h >= 0 && l - h <= this.canvasHeight;
2865
+ const a = t.getTransform(), r = i * a.a + o * a.c + a.e, c = i * a.b + o * a.d + a.f, l = Math.sqrt(a.a * a.a + a.b * a.b), f = Math.sqrt(a.c * a.c + a.d * a.d), u = (e / 2 + n) * l, h = (s / 2 + n) * f;
2866
+ return r + u >= 0 && r - u <= this.canvasWidth && c + h >= 0 && c - h <= this.canvasHeight;
2867
2867
  }
2868
2868
  calculateTransform(t, i, o, e, s, n) {
2869
- let a = 1, r = 1, l = 1;
2870
- const c = o / e, f = t / i;
2869
+ let a = 1, r = 1, c = 1;
2870
+ const l = o / e, f = t / i;
2871
2871
  switch (s) {
2872
2872
  case "Contain":
2873
- f > c ? l = i / e : l = t / o, a = r = l;
2873
+ f > l ? c = i / e : c = t / o, a = r = c;
2874
2874
  break;
2875
2875
  case "Cover":
2876
- f > c ? l = t / o : l = i / e, a = r = l;
2876
+ f > l ? c = t / o : c = i / e, a = r = c;
2877
2877
  break;
2878
2878
  case "Fill":
2879
2879
  a = t / o, r = i / e;
2880
2880
  break;
2881
2881
  case "FitWidth":
2882
- l = t / o, a = r = l;
2882
+ c = t / o, a = r = c;
2883
2883
  break;
2884
2884
  case "FitHeight":
2885
- l = i / e, a = r = l;
2885
+ c = i / e, a = r = c;
2886
2886
  break;
2887
2887
  case "None":
2888
2888
  a = r = 1;
2889
2889
  break;
2890
2890
  case "ScaleDown":
2891
- l = Math.min(t / o, i / e), l > 1 && (l = 1), a = r = l;
2891
+ c = Math.min(t / o, i / e), c > 1 && (c = 1), a = r = c;
2892
2892
  break;
2893
2893
  default:
2894
2894
  a = r = 1;
@@ -2918,27 +2918,27 @@ class ci {
2918
2918
  }
2919
2919
  */
2920
2920
  renderObject(t, i, o) {
2921
- var p, y, m, b, v, S, C, w, I, M, k, T, R, P, E, x, O, W, B, $, Y, H, K, A, _;
2921
+ var p, y, m, b, v, S, C, w, I, M, k, T, x, P, E, R, O, W, B, $, Y, H, K, A, _;
2922
2922
  const e = this.objectStates.get(i.id);
2923
2923
  if (!e) {
2924
2924
  this.warn("No state for object:", i.id);
2925
2925
  return;
2926
2926
  }
2927
- this.frameCount % 60, t.roundRect || (t.roundRect = (L, X, V, it, rt) => (this.drawRoundRect(t, L, X, V, it, rt), t));
2927
+ this.frameCount % 60, t.roundRect || (t.roundRect = (L, X, V, it, lt) => (this.drawRoundRect(t, L, X, V, it, lt), t));
2928
2928
  const s = e.geometry ? this.deepMerge(i.geometry, e.geometry) : i.geometry, n = e.style ? this.deepMerge(i.style, e.style) : i.style;
2929
2929
  let a = (s == null ? void 0 : s.width) || ((p = i.geometry) == null ? void 0 : p.width) || i.width || 0, r = (s == null ? void 0 : s.height) || ((y = i.geometry) == null ? void 0 : y.height) || i.height || 0;
2930
2930
  if ((a === 0 || r === 0) && (s != null && s.points) && Array.isArray(s.points) && s.points.length > 0) {
2931
2931
  let L = 1 / 0, X = -1 / 0, V = 1 / 0, it = -1 / 0;
2932
- s.points.forEach((rt) => {
2933
- L = Math.min(L, rt.x), X = Math.max(X, rt.x), V = Math.min(V, rt.y), it = Math.max(it, rt.y);
2932
+ s.points.forEach((lt) => {
2933
+ L = Math.min(L, lt.x), X = Math.max(X, lt.x), V = Math.min(V, lt.y), it = Math.max(it, lt.y);
2934
2934
  }), a === 0 && (a = X - L), r === 0 && (r = it - V);
2935
2935
  }
2936
- const l = (L) => {
2936
+ const c = (L) => {
2937
2937
  if (L)
2938
2938
  return L.corner_radius ?? L.cornerRadius;
2939
- }, c = l(e) ?? l(n) ?? l(s) ?? l(i.style) ?? l(i.geometry) ?? 0;
2939
+ }, l = c(e) ?? c(n) ?? c(s) ?? c(i.style) ?? c(i.geometry) ?? 0;
2940
2940
  let f = { ...s, width: a, height: r };
2941
- if (delete f.cornerRadius, f.corner_radius = c, f.type === "Path" && i.weights && i.bindMatrices && f.points) {
2941
+ if (delete f.cornerRadius, f.corner_radius = l, f.type === "Path" && i.weights && i.bindMatrices && f.points) {
2942
2942
  const L = this.getGlobalTransform(i.id);
2943
2943
  if (L) {
2944
2944
  const X = li(
@@ -2955,29 +2955,29 @@ class ci {
2955
2955
  return;
2956
2956
  const u = i.repeaterConfig, h = u && u.isEnabled && u.count > 1, d = h ? u.count : 1;
2957
2957
  for (let L = 0; L < d; L++) {
2958
- let X = e.x !== void 0 ? e.x : ((m = e.transform) == null ? void 0 : m.x) ?? 0, V = e.y !== void 0 ? e.y : ((b = e.transform) == null ? void 0 : b.y) ?? 0, it = e.rotation !== void 0 ? e.rotation : ((v = e.transform) == null ? void 0 : v.rotation) ?? 0, rt = e.scale_x !== void 0 ? e.scale_x : ((S = e.transform) == null ? void 0 : S.scale_x) ?? 1, nt = e.scale_y !== void 0 ? e.scale_y : ((C = e.transform) == null ? void 0 : C.scale_y) ?? 1;
2958
+ let X = e.x !== void 0 ? e.x : ((m = e.transform) == null ? void 0 : m.x) ?? 0, V = e.y !== void 0 ? e.y : ((b = e.transform) == null ? void 0 : b.y) ?? 0, it = e.rotation !== void 0 ? e.rotation : ((v = e.transform) == null ? void 0 : v.rotation) ?? 0, lt = e.scale_x !== void 0 ? e.scale_x : ((S = e.transform) == null ? void 0 : S.scale_x) ?? 1, nt = e.scale_y !== void 0 ? e.scale_y : ((C = e.transform) == null ? void 0 : C.scale_y) ?? 1;
2959
2959
  if (h && L > 0) {
2960
2960
  if (u.type === "Linear") {
2961
- const ht = u.offsetX || 0, bt = u.offsetY || 0, j = u.rotation || 0, z = u.scale !== void 0 ? u.scale : 1;
2962
- X += L * ht, V += L * bt, it += L * j, rt *= Math.pow(z, L), nt *= Math.pow(z, L);
2961
+ const at = u.offsetX || 0, gt = u.offsetY || 0, j = u.rotation || 0, z = u.scale !== void 0 ? u.scale : 1;
2962
+ X += L * at, V += L * gt, it += L * j, lt *= Math.pow(z, L), nt *= Math.pow(z, L);
2963
2963
  } else if (u.type === "Grid") {
2964
- const ht = u.cols || Math.ceil(Math.sqrt(u.count)), bt = u.gapX || 0, j = u.gapY || 0, z = Math.floor(L / ht), D = L % ht, et = a + bt, gt = r + j;
2965
- X += D * et, V += z * gt;
2964
+ const at = u.cols || Math.ceil(Math.sqrt(u.count)), gt = u.gapX || 0, j = u.gapY || 0, z = Math.floor(L / at), D = L % at, et = a + gt, mt = r + j;
2965
+ X += D * et, V += z * mt;
2966
2966
  } else if (u.type === "Radial") {
2967
- const ht = u.radius || 100, bt = u.startAngle || 0, z = (u.endAngle || 360) - bt, D = u.count > 1 ? z / (z === 360 ? u.count : u.count - 1) : 0, et = bt + L * D, gt = et * Math.PI / 180;
2968
- X = e.x + ht * Math.cos(gt), V = e.y + ht * Math.sin(gt), it += et;
2967
+ const at = u.radius || 100, gt = u.startAngle || 0, z = (u.endAngle || 360) - gt, D = u.count > 1 ? z / (z === 360 ? u.count : u.count - 1) : 0, et = gt + L * D, mt = et * Math.PI / 180;
2968
+ X = e.x + at * Math.cos(mt), V = e.y + at * Math.sin(mt), it += et;
2969
2969
  }
2970
2970
  }
2971
- const yt = i.type === "Group" || i.type === "Frame" || i.type === "Component", ct = a > 0 && r > 0;
2972
- if (!yt && ct) {
2973
- const ht = (((w = n.shadow) == null ? void 0 : w.isEnabled) !== !1 ? (((I = n.shadow) == null ? void 0 : I.blur) || 0) + 10 : 0) + (((M = n.blur) == null ? void 0 : M.isEnabled) !== !1 && ((k = n.blur) == null ? void 0 : k.radius) || 0) + 20;
2974
- if (!this.isObjectInView(t, X, V, a, r, ht))
2971
+ const bt = i.type === "Group" || i.type === "Frame" || i.type === "Component", ht = a > 0 && r > 0;
2972
+ if (!bt && ht) {
2973
+ const at = (((w = n.shadow) == null ? void 0 : w.isEnabled) !== !1 ? (((I = n.shadow) == null ? void 0 : I.blur) || 0) + 10 : 0) + (((M = n.blur) == null ? void 0 : M.isEnabled) !== !1 && ((k = n.blur) == null ? void 0 : k.radius) || 0) + 20;
2974
+ if (!this.isObjectInView(t, X, V, a, r, at))
2975
2975
  continue;
2976
2976
  }
2977
2977
  this.debug_objectsRendered++, t.save();
2978
2978
  const wt = [], Mt = n.blur || ((T = i.style) == null ? void 0 : T.blur);
2979
2979
  Mt && Mt.amount > 0 && wt.push(`blur(${Mt.amount}px)`);
2980
- const It = n.effect || ((R = i.style) == null ? void 0 : R.effect), Ot = (It == null ? void 0 : It.isEnabled) === !0, At = It == null ? void 0 : It.type, Tt = (It == null ? void 0 : It.radius) ?? 10;
2980
+ const It = n.effect || ((x = i.style) == null ? void 0 : x.effect), Ot = (It == null ? void 0 : It.isEnabled) === !0, At = It == null ? void 0 : It.type, Tt = (It == null ? void 0 : It.radius) ?? 10;
2981
2981
  Ot && At === "LayerBlur" && wt.push(`blur(${Tt}px)`);
2982
2982
  const zt = ((P = s == null ? void 0 : s.type) == null ? void 0 : P.toLowerCase().includes("image")) || ((E = i.type) == null ? void 0 : E.toLowerCase().includes("image")), Z = n.adjustments && Object.keys(n.adjustments).length > 0 ? n.adjustments : null, pt = s != null && s.adjustments && Object.keys(s.adjustments).length > 0 ? s.adjustments : null, Et = zt ? pt || Z : Z || pt, ut = zt && !Et ? {
2983
2983
  exposure: 0,
@@ -2992,33 +2992,33 @@ class ci {
2992
2992
  hue: 0
2993
2993
  } : Et;
2994
2994
  if (e && ut && (e.geometry = e.geometry || {}, e.geometry.adjustments = { ...ut }), ut) {
2995
- const ht = (ut.exposure || 0) / 100, bt = ut.contrast || 0, j = 1 + (ut.saturation || 0) / 100, z = (ut.temperature || 0) / 200, D = (ut.tint || 0) / 200, et = (ut.highlights || 0) / 500, gt = (ut.shadows || 0) / 500;
2995
+ const at = (ut.exposure || 0) / 100, gt = ut.contrast || 0, j = 1 + (ut.saturation || 0) / 100, z = (ut.temperature || 0) / 200, D = (ut.tint || 0) / 200, et = (ut.highlights || 0) / 500, mt = (ut.shadows || 0) / 500;
2996
2996
  let Pt = "", Ct = "SourceGraphic";
2997
- if (ht !== 0 && (Pt += `
2997
+ if (at !== 0 && (Pt += `
2998
2998
  <feComponentTransfer in="${Ct}" result="exposure">
2999
- <feFuncR type="linear" slope="1" intercept="${ht}"/>
3000
- <feFuncG type="linear" slope="1" intercept="${ht}"/>
3001
- <feFuncB type="linear" slope="1" intercept="${ht}"/>
3002
- </feComponentTransfer>`, Ct = "exposure"), bt !== 0) {
3003
- const mt = (bt + 100) / 100, F = 0.5 * (1 - mt);
2999
+ <feFuncR type="linear" slope="1" intercept="${at}"/>
3000
+ <feFuncG type="linear" slope="1" intercept="${at}"/>
3001
+ <feFuncB type="linear" slope="1" intercept="${at}"/>
3002
+ </feComponentTransfer>`, Ct = "exposure"), gt !== 0) {
3003
+ const yt = (gt + 100) / 100, F = 0.5 * (1 - yt);
3004
3004
  Pt += `
3005
3005
  <feComponentTransfer in="${Ct}" result="contrast">
3006
- <feFuncR type="linear" slope="${mt}" intercept="${F}"/>
3007
- <feFuncG type="linear" slope="${mt}" intercept="${F}"/>
3008
- <feFuncB type="linear" slope="${mt}" intercept="${F}"/>
3006
+ <feFuncR type="linear" slope="${yt}" intercept="${F}"/>
3007
+ <feFuncG type="linear" slope="${yt}" intercept="${F}"/>
3008
+ <feFuncB type="linear" slope="${yt}" intercept="${F}"/>
3009
3009
  </feComponentTransfer>`, Ct = "contrast";
3010
3010
  }
3011
3011
  if (j !== 1 && (Pt += `<feColorMatrix in="${Ct}" type="saturate" values="${j}" result="saturate"/>`, Ct = "saturate"), ut.hue && (Pt += `<feColorMatrix in="${Ct}" type="hueRotate" values="${ut.hue}" result="hue"/>`, Ct = "hue"), ut.negative) {
3012
- const mt = 1 - ut.negative / 50;
3012
+ const yt = 1 - ut.negative / 50;
3013
3013
  Pt += `
3014
3014
  <feColorMatrix in="${Ct}" type="matrix" result="invert"
3015
- values="${mt} 0 0 0 ${1 - mt}
3016
- 0 ${mt} 0 0 ${1 - mt}
3017
- 0 0 ${mt} 0 ${1 - mt}
3015
+ values="${yt} 0 0 0 ${1 - yt}
3016
+ 0 ${yt} 0 0 ${1 - yt}
3017
+ 0 0 ${yt} 0 ${1 - yt}
3018
3018
  0 0 0 1 0"/>`, Ct = "invert";
3019
3019
  }
3020
- if (z !== 0 || D !== 0 || et !== 0 || gt !== 0) {
3021
- const mt = 1 + et + gt, F = mt * (1 + z - D / 2), Lt = mt * (1 + D), jt = mt * (1 - z - D / 2), Vt = ut.shadows * 0.1 / 255, ce = [
3020
+ if (z !== 0 || D !== 0 || et !== 0 || mt !== 0) {
3021
+ const yt = 1 + et + mt, F = yt * (1 + z - D / 2), Lt = yt * (1 + D), jt = yt * (1 - z - D / 2), Vt = ut.shadows * 0.1 / 255, ce = [
3022
3022
  F,
3023
3023
  0,
3024
3024
  0,
@@ -3043,16 +3043,16 @@ class ci {
3043
3043
  Pt += `<feColorMatrix in="${Ct}" type="matrix" values="${ce}" result="advanced"/>`, Ct = "advanced";
3044
3044
  }
3045
3045
  if (ut.blur && (Pt += `<feGaussianBlur in="${Ct}" stdDeviation="${ut.blur}" result="blur"/>`, Ct = "blur"), Pt) {
3046
- const mt = `<svg xmlns="http://www.w3.org/2000/svg"><filter id="f" color-interpolation-filters="sRGB">${Pt}</filter></svg>`, F = btoa(mt);
3046
+ const yt = `<svg xmlns="http://www.w3.org/2000/svg"><filter id="f" color-interpolation-filters="sRGB">${Pt}</filter></svg>`, F = btoa(yt);
3047
3047
  wt.push(`url('data:image/svg+xml;base64,${F}#f')`);
3048
3048
  }
3049
3049
  }
3050
3050
  wt.length > 0 ? t.filter = wt.join(" ") : t.filter = "none", t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high";
3051
- const vt = t.globalAlpha, xt = this.normalizeOpacity(e.opacity !== void 0 ? e.opacity : 100);
3052
- t.globalAlpha = vt * xt;
3051
+ const vt = t.globalAlpha, Rt = this.normalizeOpacity(e.opacity !== void 0 ? e.opacity : 100);
3052
+ t.globalAlpha = vt * Rt;
3053
3053
  const Xt = e.compositeOperation || e.blendMode;
3054
3054
  if (Xt && Xt !== "Normal") {
3055
- const ht = Xt.toLowerCase();
3055
+ const at = Xt.toLowerCase();
3056
3056
  [
3057
3057
  "multiply",
3058
3058
  "screen",
@@ -3082,7 +3082,7 @@ class ci {
3082
3082
  "xor",
3083
3083
  "multiply",
3084
3084
  "screen"
3085
- ].includes(ht) && (t.globalCompositeOperation = ht);
3085
+ ].includes(at) && (t.globalCompositeOperation = at);
3086
3086
  }
3087
3087
  const Bt = t, Dt = e.masks || (i.maskedBy ? [{
3088
3088
  maskId: i.maskedBy,
@@ -3093,69 +3093,72 @@ class ci {
3093
3093
  isVisible: !0
3094
3094
  }] : []);
3095
3095
  let Ht = !1;
3096
- const te = Dt.filter((ht) => ht.isVisible !== !1 && o.has(ht.maskId));
3096
+ const te = Dt.filter((at) => at.isVisible !== !1 && o.has(at.maskId));
3097
3097
  if (te.length > 0) {
3098
- const ht = te[0], bt = o.get(ht.maskId), j = this.objectStates.get(bt.id);
3098
+ const at = te[0], gt = o.get(at.maskId), j = this.objectStates.get(gt.id);
3099
3099
  j && j.visible !== !1 && (Ht = !0, (!this.maskBuffer || this.maskBuffer.width !== this.canvasWidth || this.maskBuffer.height !== this.canvasHeight) && (this.maskBuffer = document.createElement("canvas"), this.maskBuffer.width = this.canvasWidth, this.maskBuffer.height = this.canvasHeight, this.maskCtx = this.maskBuffer.getContext("2d", { willReadFrequently: !0 }), this.maskCtx && (this.maskCtx.imageSmoothingEnabled = !0, this.maskCtx.imageSmoothingQuality = "high")), this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, this.maskBuffer.width, this.maskBuffer.height), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), i.parentId && this.applyAbsoluteTransform(this.maskCtx, i.parentId, o), this.maskCtx.save(), this.maskCtx.globalAlpha = 1, t = this.maskCtx, t.filter = Bt.filter);
3100
3100
  }
3101
3101
  t.translate(Math.round(X), Math.round(V)), t.rotate(it * Math.PI / 180);
3102
3102
  const ue = e.skew_x || 0, pe = e.skew_y || 0;
3103
- (ue !== 0 || pe !== 0) && t.transform(1, Math.tan(pe * Math.PI / 180), Math.tan(ue * Math.PI / 180), 1, 0, 0);
3104
- const Qt = e.rotate_x !== void 0 ? e.rotate_x : ((x = e.transform) == null ? void 0 : x.rotate_x) ?? 0, me = e.rotate_y !== void 0 ? e.rotate_y : ((O = e.transform) == null ? void 0 : O.rotate_y) ?? 0, ye = 1 + (e.translate_z !== void 0 ? e.translate_z : ((W = e.transform) == null ? void 0 : W.translate_z) ?? 0) / 1e3, Se = (e.flip_x === !0 ? -1 : 1) * Math.cos(me * Math.PI / 180) * ye, Pe = (e.flip_y === !0 ? -1 : 1) * Math.cos(Qt * Math.PI / 180) * ye;
3103
+ if (ue !== 0 || pe !== 0) {
3104
+ const at = Math.tan(ue * Math.PI / 180), gt = Math.tan(pe * Math.PI / 180);
3105
+ t.transform(1 + at * gt, gt, at, 1, 0, 0);
3106
+ }
3107
+ const Qt = e.rotate_x !== void 0 ? e.rotate_x : ((R = e.transform) == null ? void 0 : R.rotate_x) ?? 0, me = e.rotate_y !== void 0 ? e.rotate_y : ((O = e.transform) == null ? void 0 : O.rotate_y) ?? 0, ye = 1 + (e.translate_z !== void 0 ? e.translate_z : ((W = e.transform) == null ? void 0 : W.translate_z) ?? 0) / 1e3, Se = (e.flip_x === !0 ? -1 : 1) * Math.cos(me * Math.PI / 180) * ye, Pe = (e.flip_y === !0 ? -1 : 1) * Math.cos(Qt * Math.PI / 180) * ye;
3105
3108
  t.scale(
3106
- rt * Se,
3109
+ lt * Se,
3107
3110
  nt * Pe
3108
3111
  ), n.shadow && n.shadow.isEnabled !== !0 && ((n.shadow.blur || 0) > 0 || Math.abs(n.shadow.offsetX || 0) > 0 || Math.abs(n.shadow.offsetY || 0) > 0) && (n.shadow.isEnabled = !0);
3109
3112
  const ae = n.shadow;
3110
3113
  if (ae && ae.isEnabled !== !1) {
3111
- let ht = ae.color || "#000000";
3112
- ($ = (B = this.artboard) == null ? void 0 : B.tokens) != null && $.colors && this.artboard.tokens.colors[ht] && (ht = this.artboard.tokens.colors[ht]);
3113
- const bt = this.normalizeOpacity(ae.opacity ?? 100), j = ae.spread || 0, D = (ae.blur || 0) + j * 1.5;
3114
- let et = ht;
3115
- if (ht.startsWith("#")) {
3116
- const Ct = ht.replace("#", ""), Wt = parseInt(Ct.substring(0, 2), 16), mt = parseInt(Ct.substring(2, 4), 16), F = parseInt(Ct.substring(4, 6), 16);
3117
- et = `rgba(${Wt}, ${mt}, ${F}, ${bt})`;
3118
- } else if (ht.startsWith("rgba")) {
3119
- const Ct = ht.match(/[\d.]+/g);
3114
+ let at = ae.color || "#000000";
3115
+ ($ = (B = this.artboard) == null ? void 0 : B.tokens) != null && $.colors && this.artboard.tokens.colors[at] && (at = this.artboard.tokens.colors[at]);
3116
+ const gt = this.normalizeOpacity(ae.opacity ?? 100), j = ae.spread || 0, D = (ae.blur || 0) + j * 1.5;
3117
+ let et = at;
3118
+ if (at.startsWith("#")) {
3119
+ const Ct = at.replace("#", ""), Wt = parseInt(Ct.substring(0, 2), 16), yt = parseInt(Ct.substring(2, 4), 16), F = parseInt(Ct.substring(4, 6), 16);
3120
+ et = `rgba(${Wt}, ${yt}, ${F}, ${gt})`;
3121
+ } else if (at.startsWith("rgba")) {
3122
+ const Ct = at.match(/[\d.]+/g);
3120
3123
  if (Ct && Ct.length >= 4) {
3121
- const Wt = Ct[0], mt = Ct[1], F = Ct[2], Lt = Ct[3];
3122
- et = `rgba(${Wt}, ${mt}, ${F}, ${parseFloat(Lt) * bt})`;
3124
+ const Wt = Ct[0], yt = Ct[1], F = Ct[2], Lt = Ct[3];
3125
+ et = `rgba(${Wt}, ${yt}, ${F}, ${parseFloat(Lt) * gt})`;
3123
3126
  }
3124
3127
  }
3125
- const gt = t.getTransform(), Pt = Math.sqrt(gt.a * gt.a + gt.b * gt.b) || 1;
3128
+ const mt = t.getTransform(), Pt = Math.sqrt(mt.a * mt.a + mt.b * mt.b) || 1;
3126
3129
  t.shadowColor = et, t.shadowBlur = D * Pt, t.shadowOffsetX = (ae.offsetX || 0) * Pt, t.shadowOffsetY = (ae.offsetY || 0) * Pt;
3127
3130
  }
3128
3131
  const ee = i.liquidFill || ((Y = i.style) == null ? void 0 : Y.liquidFill);
3129
3132
  if (ee && ee.enabled) {
3130
3133
  t.save();
3131
- const ht = ee.fillLevel ?? 0.5;
3134
+ const at = ee.fillLevel ?? 0.5;
3132
3135
  t.beginPath();
3133
- const bt = r / 2 - r * ht;
3134
- t.rect(-a / 2, bt, a, r * ht), t.clip(), t.fillStyle = ee.color || "#3b82f6", t.globalAlpha = t.globalAlpha * (ee.opacity ?? 1);
3136
+ const gt = r / 2 - r * at;
3137
+ t.rect(-a / 2, gt, a, r * at), t.clip(), t.fillStyle = ee.color || "#3b82f6", t.globalAlpha = t.globalAlpha * (ee.opacity ?? 1);
3135
3138
  }
3136
3139
  if ((s == null ? void 0 : s.type) === "Text")
3137
3140
  this._renderText(t, i, f, n, e, a, r);
3138
3141
  else if ((s == null ? void 0 : s.type) === "Image") {
3139
- const ht = s.originalSrc || s.src;
3140
- if (ht) {
3141
- let bt = this.imageCache.get(ht);
3142
- bt || (bt = new Image(), bt.onload = () => {
3143
- this.log(`[ExodeUI] Image loaded successfully, size: ${bt.naturalWidth}x${bt.naturalHeight}`);
3144
- }, bt.onerror = (D) => {
3145
- console.error("[ExodeUI] Image load failed:", D, `Src preview: ${ht.substring(0, 100)}...`);
3146
- }, bt.src = ht, this.imageCache.set(ht, bt));
3142
+ const at = s.originalSrc || s.src;
3143
+ if (at) {
3144
+ let gt = this.imageCache.get(at);
3145
+ gt || (gt = new Image(), gt.onload = () => {
3146
+ this.log(`[ExodeUI] Image loaded successfully, size: ${gt.naturalWidth}x${gt.naturalHeight}`);
3147
+ }, gt.onerror = (D) => {
3148
+ console.error("[ExodeUI] Image load failed:", D, `Src preview: ${at.substring(0, 100)}...`);
3149
+ }, gt.src = at, this.imageCache.set(at, gt));
3147
3150
  const j = n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1, z = (((H = n.stroke) == null ? void 0 : H.alignment) || "center").toLowerCase();
3148
- if (j && (z === "outside" || z === "center") && this.applyStrokeAlignment(t, n, f, a, r, c), n.fill && n.fill.type !== "None") {
3151
+ if (j && (z === "outside" || z === "center") && this.applyStrokeAlignment(t, n, f, a, r, l), n.fill && n.fill.type !== "None") {
3149
3152
  t.save();
3150
3153
  const D = t.globalAlpha, et = this.createCanvasFill(t, n.fill, a, r);
3151
- t.fillStyle = et || n.fill.color || "transparent", t.globalAlpha = D * this.normalizeOpacity(n.fill.opacity ?? 100), c !== 0 ? (this.drawRoundRect(t, -a / 2, -r / 2, a, r, c), t.fill()) : t.fillRect(-a / 2, -r / 2, a, r), t.globalAlpha = D, t.restore();
3154
+ t.fillStyle = et || n.fill.color || "transparent", t.globalAlpha = D * this.normalizeOpacity(n.fill.opacity ?? 100), l !== 0 ? (this.drawRoundRect(t, -a / 2, -r / 2, a, r, l), t.fill()) : t.fillRect(-a / 2, -r / 2, a, r), t.globalAlpha = D, t.restore();
3152
3155
  }
3153
- bt.complete && bt.naturalWidth > 0 ? (c !== 0 ? (t.save(), this.drawRoundRect(t, -a / 2, -r / 2, a, r, c), t.clip(), t.drawImage(bt, -a / 2, -r / 2, a, r), t.restore()) : t.drawImage(bt, -a / 2, -r / 2, a, r), j && z === "inside" && this.applyStrokeAlignment(t, n, f, a, r, c)) : j && z === "inside" && this.applyStrokeAlignment(t, n, f, a, r, c);
3156
+ gt.complete && gt.naturalWidth > 0 ? (l !== 0 ? (t.save(), this.drawRoundRect(t, -a / 2, -r / 2, a, r, l), t.clip(), t.drawImage(gt, -a / 2, -r / 2, a, r), t.restore()) : t.drawImage(gt, -a / 2, -r / 2, a, r), j && z === "inside" && this.applyStrokeAlignment(t, n, f, a, r, l)) : j && z === "inside" && this.applyStrokeAlignment(t, n, f, a, r, l);
3154
3157
  }
3155
3158
  } else if (s.type === "SVG") {
3156
- const ht = s.svgContent;
3157
- if (ht) {
3158
- const bt = n.palette || [], j = n.fill, z = n.stroke, D = j ? this.normalizeOpacity(j.opacity ?? 100) : 1, et = (j == null ? void 0 : j.type) === "Solid" && (!z || z.isEnabled === !1 || z.type === "Solid" && z.color === j.color), gt = j && j.type !== "None" ? et ? "monochrome" : j.type === "Solid" ? (j.color || "") + "|opacity:" + D : JSON.stringify(j.stops || []) + "|opacity:" + D : "", Pt = z && z.isEnabled !== !1 && (z.width || 0) > 0 ? et ? [
3159
+ const at = s.svgContent;
3160
+ if (at) {
3161
+ const gt = n.palette || [], j = n.fill, z = n.stroke, D = j ? this.normalizeOpacity(j.opacity ?? 100) : 1, et = (j == null ? void 0 : j.type) === "Solid" && (!z || z.isEnabled === !1 || z.type === "Solid" && z.color === j.color), mt = j && j.type !== "None" ? et ? "monochrome" : j.type === "Solid" ? (j.color || "") + "|opacity:" + D : JSON.stringify(j.stops || []) + "|opacity:" + D : "", Pt = z && z.isEnabled !== !1 && (z.width || 0) > 0 ? et ? [
3159
3162
  "monochrome",
3160
3163
  z.width || 0,
3161
3164
  z.trimStart ?? 0,
@@ -3176,8 +3179,8 @@ class ci {
3176
3179
  z.dashOffset ?? 0
3177
3180
  ].join("|") : "nostroke", Ct = [
3178
3181
  i.id,
3179
- bt.join("_"),
3180
- gt,
3182
+ gt.join("_"),
3183
+ mt,
3181
3184
  Pt,
3182
3185
  e.opacity ?? 100,
3183
3186
  e.visible !== !1 ? "v" : "h"
@@ -3185,17 +3188,17 @@ class ci {
3185
3188
  let Wt = this.imageCache.get(Ct);
3186
3189
  if (!Wt) {
3187
3190
  Wt = new Image(), Wt.crossOrigin = "anonymous";
3188
- let F = ht;
3191
+ let F = at;
3189
3192
  F.match(/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/i) || (F = F.replace(/<svg([^>]*)>/i, (tt, dt) => `<svg xmlns="http://www.w3.org/2000/svg"${dt}>`));
3190
3193
  let Lt = s.width || a || 100, jt = s.height || r || 100;
3191
3194
  const Vt = F.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
3192
3195
  if (Vt && (Lt = parseFloat(Vt[1]), jt = parseFloat(Vt[2])), F = F.replace(/<svg([^>]*)>/i, (tt, dt) => {
3193
3196
  let G = dt.replace(/\b(?:width|height)=["'][^"']*["']/gi, " ");
3194
3197
  return G.match(/\bviewBox=/i) || (G += ` viewBox="0 0 ${Lt} ${jt}"`), G.match(/\bpreserveAspectRatio=/i) || (G += ' preserveAspectRatio="none"'), G += ' width="100%" height="100%"', `<svg${G}>`;
3195
- }), s.colors && s.colors.length > 0 && bt.length > 0 && s.colors.forEach((tt, dt) => {
3196
- if (bt[dt]) {
3198
+ }), s.colors && s.colors.length > 0 && gt.length > 0 && s.colors.forEach((tt, dt) => {
3199
+ if (gt[dt]) {
3197
3200
  const G = tt.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), st = new RegExp(G, "gi");
3198
- F = F.replace(st, bt[dt]);
3201
+ F = F.replace(st, gt[dt]);
3199
3202
  }
3200
3203
  }), j && j.type && j.type !== "None") {
3201
3204
  if (j.type === "Solid" && j.color) {
@@ -3228,7 +3231,7 @@ class ci {
3228
3231
  }
3229
3232
  const Ft = J(tt.center, 0, 0.5) * 100, Ut = J(tt.center, 1, 0.5) * 100, se = (tt.radius ?? 0.5) * 100;
3230
3233
  return `<radialGradient id="${dt}" cx="${Ft}%" cy="${Ut}%" r="${se}%" gradientUnits="objectBoundingBox">${st}</radialGradient>`;
3231
- }, Rt = (tt, dt) => /<defs>/i.test(tt) ? tt.replace(/<defs>/i, `<defs>${dt}`) : tt.replace(/(<svg[^>]*>)/i, `$1<defs>${dt}</defs>`);
3234
+ }, xt = (tt, dt) => /<defs>/i.test(tt) ? tt.replace(/<defs>/i, `<defs>${dt}`) : tt.replace(/(<svg[^>]*>)/i, `$1<defs>${dt}</defs>`);
3232
3235
  if (z && z.isEnabled !== !1 && (z.width || 0) > 0) {
3233
3236
  const tt = et ? 1 : this.normalizeOpacity(z.opacity ?? 100), dt = et ? "#FFFFFF" : z.color || (j == null ? void 0 : j.color) || "#000000";
3234
3237
  let G = "";
@@ -3238,7 +3241,7 @@ class ci {
3238
3241
  G = st.color || z.color || "#000000";
3239
3242
  else if (st.type === "LinearGradient" || st.type === "RadialGradient" || st.type === "Linear" || st.type === "Radial") {
3240
3243
  const Gt = "exode-stroke";
3241
- F = Rt(F, ce(st, Gt, tt)), G = `url(#${Gt})`;
3244
+ F = xt(F, ce(st, Gt, tt)), G = `url(#${Gt})`;
3242
3245
  }
3243
3246
  }
3244
3247
  G || (G = dt), F.match(/\bstroke\s*=\s*["']/i) ? F = F.replace(
@@ -3249,7 +3252,7 @@ class ci {
3249
3252
  `stroke:${G}`
3250
3253
  );
3251
3254
  let J = s.width || a || 100, Ft = s.height || r || 100;
3252
- const Ut = ht.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
3255
+ const Ut = at.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
3253
3256
  if (Ut) {
3254
3257
  const Gt = parseFloat(Ut[1]), ie = parseFloat(Ut[2]);
3255
3258
  !isNaN(Gt) && !isNaN(ie) && (J = Gt, Ft = ie);
@@ -3260,11 +3263,11 @@ class ci {
3260
3263
  F.match(/\bstroke-linecap\s*=\s*["']/i) ? F = F.replace(/\bstroke-linecap\s*=\s*["'][^"']*["']/gi, `stroke-linecap="${Ce}"`) : F = F.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linecap="${Ce}"`), F = F.replace(/stroke-linecap\s*:\s*[^;"')]+/gi, `stroke-linecap:${Ce}`);
3261
3264
  const Ee = z.lineJoin || "round";
3262
3265
  F.match(/\bstroke-linejoin\s*=\s*["']/i) ? F = F.replace(/\bstroke-linejoin\s*=\s*["'][^"']*["']/gi, `stroke-linejoin="${Ee}"`) : F = F.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linejoin="${Ee}"`), F = F.replace(/stroke-linejoin\s*:\s*[^;"')]+/gi, `stroke-linejoin:${Ee}`);
3263
- const Ae = z.trimStart ?? 0, Oe = z.trimEnd ?? 1, Re = z.trimOffset ?? 0, xe = z.dashOffset ?? 0, $e = Ae !== 0 || Oe !== 1 || Re !== 0 || xe !== 0;
3266
+ const Ae = z.trimStart ?? 0, Oe = z.trimEnd ?? 1, xe = z.trimOffset ?? 0, Re = z.dashOffset ?? 0, $e = Ae !== 0 || Oe !== 1 || xe !== 0 || Re !== 0;
3264
3267
  if ($e) {
3265
3268
  const Gt = Math.max(0, Math.min(1, Ae)), ie = Math.max(0, Math.min(1, Oe));
3266
3269
  this.frameCount % 600 === 0 && this.debugLog(`SVG Trim - Object: ${i.name || i.id}, Start: ${Gt}, End: ${ie}`);
3267
- const be = (J + Ft) * 2, Le = (Re % 1 + 1) % 1, Fe = (xe % 1 + 1) % 1;
3270
+ const be = (J + Ft) * 2, Le = (xe % 1 + 1) % 1, Fe = (Re % 1 + 1) % 1;
3268
3271
  let he = "", re = 0;
3269
3272
  if (Gt >= ie)
3270
3273
  he = `0 ${be}`, re = 0;
@@ -3277,10 +3280,10 @@ class ci {
3277
3280
  const Gt = z.dashArray.join(" ");
3278
3281
  F = F.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${Gt}"`), F = F.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${Gt}`), z.dashOffset && (F = F.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${z.dashOffset}"`), F = F.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${z.dashOffset}`));
3279
3282
  }
3280
- if (!/\bstroke\s*=\s*["']/i.test(ht) && !new RegExp("(?<![a-z-])stroke\\s*:", "i").test(ht)) {
3283
+ if (!/\bstroke\s*=\s*["']/i.test(at) && !new RegExp("(?<![a-z-])stroke\\s*:", "i").test(at)) {
3281
3284
  let Gt = "", ie = "";
3282
3285
  if ($e) {
3283
- const he = s.width || a || 100, re = s.height || r || 100, le = (he + re) * 2, we = Math.max(0, Math.min(1, Ae)), We = Math.max(0, Math.min(1, Oe)), Ge = (Re % 1 + 1) % 1, De = (xe % 1 + 1) % 1;
3286
+ const he = s.width || a || 100, re = s.height || r || 100, le = (he + re) * 2, we = Math.max(0, Math.min(1, Ae)), We = Math.max(0, Math.min(1, Oe)), Ge = (xe % 1 + 1) % 1, De = (Re % 1 + 1) % 1;
3284
3287
  if (we >= We)
3285
3288
  Gt = ` stroke-dasharray="0 ${le}"`, ie = ' stroke-dashoffset="0"';
3286
3289
  else {
@@ -3295,70 +3298,70 @@ class ci {
3295
3298
  ), F = F.replace(/<\/svg>/i, "</g></svg>");
3296
3299
  }
3297
3300
  } else z && z.isEnabled === !1 && (F = F.replace(/\bstroke\s*=\s*["'][^"']*["']/gi, 'stroke="none"'), F = F.replace(new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"), "stroke:none"));
3298
- const ft = new Blob([F], { type: "image/svg+xml" }), lt = URL.createObjectURL(ft);
3301
+ const ft = new Blob([F], { type: "image/svg+xml" }), ct = URL.createObjectURL(ft);
3299
3302
  Wt.onload = () => {
3300
- if (URL.revokeObjectURL(lt), this.frameCount % 900 === 0) {
3303
+ if (URL.revokeObjectURL(ct), this.frameCount % 900 === 0) {
3301
3304
  const tt = this.imageCache.get(Ct);
3302
3305
  tt && this.debugLog(`SVG Payload Ready: ${i.name || i.id} (${tt.naturalWidth}x${tt.naturalHeight})`);
3303
3306
  }
3304
3307
  }, Wt.onerror = () => {
3305
- URL.revokeObjectURL(lt), this.debugLog(`SVG Error: Failed to load payload for ${i.name || i.id}`);
3306
- }, Wt.src = lt, this.imageCache.set(Ct, Wt);
3308
+ URL.revokeObjectURL(ct), this.debugLog(`SVG Error: Failed to load payload for ${i.name || i.id}`);
3309
+ }, Wt.src = ct, this.imageCache.set(Ct, Wt);
3307
3310
  }
3308
- let mt = null;
3309
- if (Wt.complete && Wt.naturalWidth > 0 ? (mt = Wt, this.lastValidSvgImgMap.set(i.id, Wt)) : mt = this.lastValidSvgImgMap.get(i.id) || null, mt && mt.complete && mt.naturalWidth > 0) {
3311
+ let yt = null;
3312
+ if (Wt.complete && Wt.naturalWidth > 0 ? (yt = Wt, this.lastValidSvgImgMap.set(i.id, Wt)) : yt = this.lastValidSvgImgMap.get(i.id) || null, yt && yt.complete && yt.naturalWidth > 0) {
3310
3313
  const F = Math.max(1, a), Lt = Math.max(1, r);
3311
3314
  if (et && (j == null ? void 0 : j.type) === "Solid") {
3312
- this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width = F, this.maskBuffer.height = Lt, this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, F, Lt), this.maskCtx.drawImage(mt, 0, 0, F, Lt), this.maskCtx.globalCompositeOperation = "source-in";
3315
+ this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width = F, this.maskBuffer.height = Lt, this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, F, Lt), this.maskCtx.drawImage(yt, 0, 0, F, Lt), this.maskCtx.globalCompositeOperation = "source-in";
3313
3316
  const jt = j.color || "#000000", Vt = this.normalizeOpacity(j.opacity ?? 100);
3314
3317
  this.maskCtx.fillStyle = jt, this.maskCtx.globalAlpha = Vt, this.maskCtx.fillRect(0, 0, F, Lt), t.drawImage(this.maskBuffer, -F / 2, -Lt / 2, F, Lt);
3315
- } else c !== 0 ? (t.save(), this.drawRoundRect(t, -F / 2, -Lt / 2, F, Lt, c), t.clip(), t.drawImage(mt, -F / 2, -Lt / 2, F, Lt), t.restore()) : t.drawImage(mt, -F / 2, -Lt / 2, F, Lt);
3318
+ } else l !== 0 ? (t.save(), this.drawRoundRect(t, -F / 2, -Lt / 2, F, Lt, l), t.clip(), t.drawImage(yt, -F / 2, -Lt / 2, F, Lt), t.restore()) : t.drawImage(yt, -F / 2, -Lt / 2, F, Lt);
3316
3319
  }
3317
3320
  }
3318
3321
  } else if (f.type === "LineGraph")
3319
3322
  this.renderLineGraph(t, f, a, r);
3320
3323
  else if (i.type === "Shape") {
3321
- if (this.applyPath(t, f, a, r, c), t.save(), n.blur && n.blur.amount > 0 && (t.filter = `blur(${n.blur.amount}px)`), n.fill) {
3322
- const ht = t.globalAlpha;
3324
+ if (this.applyPath(t, f, a, r, l), t.save(), n.blur && n.blur.amount > 0 && (t.filter = `blur(${n.blur.amount}px)`), n.fill) {
3325
+ const at = t.globalAlpha;
3323
3326
  if (((A = n.fill) == null ? void 0 : A.type) === "Image" && (n.fill.originalSrc || n.fill.src)) {
3324
- const bt = n.fill.originalSrc || n.fill.src;
3325
- let j = this.imageCache.get(bt);
3326
- j || (j = new Image(), j.src = bt, this.imageCache.set(bt, j)), j.complete && j.naturalWidth > 0 && (t.save(), this.applyPath(t, f, a, r, c), t.clip(), this.renderFittedImage(t, j, -a / 2, -r / 2, a, r, n.fill.fillMode), t.restore());
3327
+ const gt = n.fill.originalSrc || n.fill.src;
3328
+ let j = this.imageCache.get(gt);
3329
+ j || (j = new Image(), j.src = gt, this.imageCache.set(gt, j)), j.complete && j.naturalWidth > 0 && (t.save(), this.applyPath(t, f, a, r, l), t.clip(), this.renderFittedImage(t, j, -a / 2, -r / 2, a, r, n.fill.fillMode), t.restore());
3327
3330
  } else {
3328
- const bt = this.createCanvasFill(t, n.fill, a, r);
3329
- t.fillStyle = bt || (typeof n.fill == "string" ? n.fill : n.fill.color || "transparent"), t.globalAlpha = ht * this.normalizeOpacity(n.fill.opacity ?? 100), this.applyPath(t, f, a, r, c), t.fill();
3331
+ const gt = this.createCanvasFill(t, n.fill, a, r);
3332
+ t.fillStyle = gt || (typeof n.fill == "string" ? n.fill : n.fill.color || "transparent"), t.globalAlpha = at * this.normalizeOpacity(n.fill.opacity ?? 100), this.applyPath(t, f, a, r, l), t.fill();
3330
3333
  }
3331
- t.globalAlpha = ht;
3334
+ t.globalAlpha = at;
3332
3335
  }
3333
- t.restore(), n.stroke && n.stroke.width > 0 && this.applyStrokeAlignment(t, n, f, a, r, c);
3336
+ t.restore(), n.stroke && n.stroke.width > 0 && this.applyStrokeAlignment(t, n, f, a, r, l);
3334
3337
  } else if (i.type === "Frame" || i.type === "Group" && !i.isStructuralGroup) {
3335
- const ht = e.width ?? s.width ?? i.width ?? a, bt = e.height ?? s.height ?? i.height ?? r, j = c;
3336
- if (t.save(), t.beginPath(), this.drawRoundRect(t, -ht / 2, -bt / 2, ht, bt, j), n.fill && n.fill.type !== "None") {
3337
- const z = t.globalAlpha, D = this.createCanvasFill(t, n.fill, ht, bt);
3338
+ const at = e.width ?? s.width ?? i.width ?? a, gt = e.height ?? s.height ?? i.height ?? r, j = l;
3339
+ if (t.save(), t.beginPath(), this.drawRoundRect(t, -at / 2, -gt / 2, at, gt, j), n.fill && n.fill.type !== "None") {
3340
+ const z = t.globalAlpha, D = this.createCanvasFill(t, n.fill, at, gt);
3338
3341
  t.fillStyle = D || n.fill.color || "transparent", t.globalAlpha = z * this.normalizeOpacity(n.fill.opacity ?? 100), t.fill(), t.globalAlpha = z;
3339
3342
  }
3340
3343
  if (t.restore(), n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1) {
3341
3344
  const z = { type: "Rectangle" };
3342
- this.applyStrokeAlignment(t, n, z, ht, bt, j);
3345
+ this.applyStrokeAlignment(t, n, z, at, gt, j);
3343
3346
  }
3344
3347
  } else i.type === "Group" && i.isStructuralGroup || (i.type === "Component" && i.variant === "inputbox" ? this.renderInputBox(t, i) : i.type === "Component" && i.variant === "button" ? this.renderButton(t, i) : i.type === "Component" && i.variant === "toggle_button" ? this.renderToggleButton(t, i) : i.type === "Toggle" || i.type === "Component" && i.variant === "toggle" ? this.renderToggle(t, i) : i.type === "Slider" || i.type === "Component" && i.variant === "slider" ? this.renderSlider(t, i) : i.type === "Dropdown" || i.type === "Component" && i.variant === "dropdown" ? this.renderDropdown(t, i) : i.type === "ListView" || i.type === "Component" && i.variant === "listview" ? this.renderListView(t, i) : i.type === "Checkbox" || i.type === "Component" && i.variant === "checkbox" ? this.renderCheckbox(t, i) : i.type === "RadioGroup" || i.type === "Component" && i.variant === "radiogroup" ? this.renderRadioGroup(t, i) : i.type === "BarChart" || i.type === "Component" && i.variant === "barchart" ? this.renderBarChart(t, i) : i.type === "PieChart" || i.type === "Component" && i.variant === "piechart" ? this.renderPieChart(t, i) : i.type === "Joystick" || i.type === "Component" && i.variant === "joystick" ? this.renderJoystick(t, i) : this.frameCount % 300 === 0 && this.warn("[Engine] Unhandled object type in renderObject:", i.type, "Geo:", (_ = i.geometry) == null ? void 0 : _.type));
3345
- if (this.applyArtEffectOverlay(t, i, f, a, r, c), Ot && At === "BackgroundBlur" && this.applyBackgroundBlurGlass(t, f, a, r, c, It), ee && ee.enabled && t.restore(), i.children && i.children.length > 0) {
3346
- const bt = i.type === "Frame", j = i.clipsContent !== void 0 ? i.clipsContent : i.clipContent !== void 0 ? i.clipContent : bt;
3348
+ if (this.applyArtEffectOverlay(t, i, f, a, r, l), Ot && At === "BackgroundBlur" && this.applyBackgroundBlurGlass(t, f, a, r, l, It), ee && ee.enabled && t.restore(), i.children && i.children.length > 0) {
3349
+ const gt = i.type === "Frame", j = i.clipsContent !== void 0 ? i.clipsContent : i.clipContent !== void 0 ? i.clipContent : gt;
3347
3350
  if (t.save(), j) {
3348
3351
  t.beginPath();
3349
- const D = e.width ?? (s == null ? void 0 : s.width) ?? i.width ?? 0, et = e.height ?? (s == null ? void 0 : s.height) ?? i.height ?? 0, gt = e.cornerRadius ?? (s == null ? void 0 : s.corner_radius) ?? i.cornerRadius ?? 0;
3350
- this.drawRoundRect(t, -D / 2, -et / 2, D, et, gt), t.clip();
3352
+ const D = e.width ?? (s == null ? void 0 : s.width) ?? i.width ?? 0, et = e.height ?? (s == null ? void 0 : s.height) ?? i.height ?? 0, mt = e.cornerRadius ?? (s == null ? void 0 : s.corner_radius) ?? i.cornerRadius ?? 0;
3353
+ this.drawRoundRect(t, -D / 2, -et / 2, D, et, mt), t.clip();
3351
3354
  }
3352
3355
  let z = 0;
3353
3356
  for (i.children.forEach((D) => {
3354
3357
  const et = o.get(D);
3355
3358
  if (!et) return;
3356
- const gt = this.objectStates.get(D), Pt = (gt == null ? void 0 : gt.geometry) || et.geometry;
3357
- if (Pt && Pt.isMask && (gt == null ? void 0 : gt.visible) !== !1) {
3359
+ const mt = this.objectStates.get(D), Pt = (mt == null ? void 0 : mt.geometry) || et.geometry;
3360
+ if (Pt && Pt.isMask && (mt == null ? void 0 : mt.visible) !== !1) {
3358
3361
  const Ct = Pt.width || 0, Wt = Pt.height || 0;
3359
3362
  this.applyObjectTransform(t, D);
3360
- const mt = (gt == null ? void 0 : gt.corner_radius) ?? (Pt == null ? void 0 : Pt.corner_radius) ?? 0;
3361
- this.applyPath(t, Pt, Ct, Wt, mt), t.clip(), z++;
3363
+ const yt = (mt == null ? void 0 : mt.corner_radius) ?? (Pt == null ? void 0 : Pt.corner_radius) ?? 0;
3364
+ this.applyPath(t, Pt, Ct, Wt, yt), t.clip(), z++;
3362
3365
  } else
3363
3366
  this.renderObject(t, et, o);
3364
3367
  }); z > 0; )
@@ -3374,19 +3377,19 @@ class ci {
3374
3377
  feather: i.maskFeather || 0,
3375
3378
  isVisible: !0
3376
3379
  }] : [])).filter((z) => z.isVisible !== !1 && o.has(z.maskId)).forEach((z) => {
3377
- var mt, F, Lt, jt, Vt, ce;
3378
- const D = o.get(z.maskId), et = this.objectStates.get(D.id), gt = z.feather || 0, Pt = z.inverted === !0, Ct = z.opacity !== void 0 ? typeof z.opacity == "number" ? z.opacity : z.opacity / 100 : 1;
3380
+ var yt, F, Lt, jt, Vt, ce;
3381
+ const D = o.get(z.maskId), et = this.objectStates.get(D.id), mt = z.feather || 0, Pt = z.inverted === !0, Ct = z.opacity !== void 0 ? typeof z.opacity == "number" ? z.opacity : z.opacity / 100 : 1;
3379
3382
  if ((z.type || "alpha") === "luma") {
3380
- (!this.lumaBuffer || this.lumaBuffer.width !== this.maskBuffer.width || this.lumaBuffer.height !== this.maskBuffer.height) && (this.lumaBuffer = document.createElement("canvas"), this.lumaBuffer.width = this.maskBuffer.width, this.lumaBuffer.height = this.maskBuffer.height, this.lumaCtx = this.lumaBuffer.getContext("2d", { willReadFrequently: !0 }), this.lumaCtx && (this.lumaCtx.imageSmoothingEnabled = !0, this.lumaCtx.imageSmoothingQuality = "high")), this.lumaCtx.setTransform(1, 0, 0, 1, 0, 0), this.lumaCtx.globalCompositeOperation = "source-over", this.lumaCtx.globalAlpha = 1, this.lumaCtx.filter = "none", this.lumaCtx.clearRect(0, 0, this.lumaBuffer.width, this.lumaBuffer.height), this.lumaCtx.save(), this.rootTransform && this.lumaCtx.setTransform(this.rootTransform), this.applyAbsoluteTransform(this.lumaCtx, D.id, o), gt > 0 && (this.lumaCtx.filter = `blur(${gt}px)`), this.lumaCtx.globalAlpha = Ct;
3381
- const Rt = (et == null ? void 0 : et.width) || D.geometry.width || 0, ft = (et == null ? void 0 : et.height) || D.geometry.height || 0, lt = (et == null ? void 0 : et.corner_radius) ?? D.corner_radius ?? 0;
3382
- if (((mt = D.geometry) == null ? void 0 : mt.type) === "Text") {
3383
+ (!this.lumaBuffer || this.lumaBuffer.width !== this.maskBuffer.width || this.lumaBuffer.height !== this.maskBuffer.height) && (this.lumaBuffer = document.createElement("canvas"), this.lumaBuffer.width = this.maskBuffer.width, this.lumaBuffer.height = this.maskBuffer.height, this.lumaCtx = this.lumaBuffer.getContext("2d", { willReadFrequently: !0 }), this.lumaCtx && (this.lumaCtx.imageSmoothingEnabled = !0, this.lumaCtx.imageSmoothingQuality = "high")), this.lumaCtx.setTransform(1, 0, 0, 1, 0, 0), this.lumaCtx.globalCompositeOperation = "source-over", this.lumaCtx.globalAlpha = 1, this.lumaCtx.filter = "none", this.lumaCtx.clearRect(0, 0, this.lumaBuffer.width, this.lumaBuffer.height), this.lumaCtx.save(), this.rootTransform && this.lumaCtx.setTransform(this.rootTransform), this.applyAbsoluteTransform(this.lumaCtx, D.id, o), mt > 0 && (this.lumaCtx.filter = `blur(${mt}px)`), this.lumaCtx.globalAlpha = Ct;
3384
+ const xt = (et == null ? void 0 : et.width) || D.geometry.width || 0, ft = (et == null ? void 0 : et.height) || D.geometry.height || 0, ct = (et == null ? void 0 : et.corner_radius) ?? D.corner_radius ?? 0;
3385
+ if (((yt = D.geometry) == null ? void 0 : yt.type) === "Text") {
3383
3386
  const st = et != null && et.geometry ? this.deepMerge(D.geometry, et.geometry) : D.geometry, J = et != null && et.style ? this.deepMerge(D.style, et.style) : D.style;
3384
- this._renderText(this.lumaCtx, D, { ...st, width: Rt, height: ft, corner_radius: lt }, J, et, Rt, ft, !0);
3387
+ this._renderText(this.lumaCtx, D, { ...st, width: xt, height: ft, corner_radius: ct }, J, et, xt, ft, !0);
3385
3388
  } else if (((F = D.geometry) == null ? void 0 : F.type) === "Image") {
3386
3389
  const st = D.geometry.src;
3387
3390
  if (st) {
3388
3391
  let J = this.imageCache.get(st);
3389
- J || (J = new Image(), J.src = st, this.imageCache.set(st, J)), J.complete && J.naturalWidth > 0 ? this.lumaCtx.drawImage(J, -Rt / 2, -ft / 2, Rt, ft) : (this.applyPath(this.lumaCtx, D.geometry, Rt, ft, lt), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
3392
+ J || (J = new Image(), J.src = st, this.imageCache.set(st, J)), J.complete && J.naturalWidth > 0 ? this.lumaCtx.drawImage(J, -xt / 2, -ft / 2, xt, ft) : (this.applyPath(this.lumaCtx, D.geometry, xt, ft, ct), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
3390
3393
  }
3391
3394
  } else if (((Lt = D.geometry) == null ? void 0 : Lt.type) === "SVG") {
3392
3395
  const st = D.geometry.svgContent;
@@ -3400,10 +3403,10 @@ class ci {
3400
3403
  this.artboard && this.reset();
3401
3404
  }, this.imageCache.set(J, Ft);
3402
3405
  }
3403
- Ft.complete && Ft.naturalWidth > 0 ? this.lumaCtx.drawImage(Ft, -Rt / 2, -ft / 2, Rt, ft) : (this.applyPath(this.lumaCtx, D.geometry, Rt, ft, lt), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
3406
+ Ft.complete && Ft.naturalWidth > 0 ? this.lumaCtx.drawImage(Ft, -xt / 2, -ft / 2, xt, ft) : (this.applyPath(this.lumaCtx, D.geometry, xt, ft, ct), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
3404
3407
  }
3405
3408
  } else
3406
- this.applyPath(this.lumaCtx, D.geometry, Rt, ft, lt), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill();
3409
+ this.applyPath(this.lumaCtx, D.geometry, xt, ft, ct), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill();
3407
3410
  this.lumaCtx.restore();
3408
3411
  const tt = this.maskCtx.getImageData(0, 0, this.canvasWidth, this.canvasHeight), dt = this.lumaCtx.getImageData(0, 0, this.canvasWidth, this.canvasHeight).data, G = tt.data;
3409
3412
  for (let st = 0; st < G.length; st += 4) {
@@ -3413,16 +3416,16 @@ class ci {
3413
3416
  }
3414
3417
  this.maskCtx.putImageData(tt, 0, 0);
3415
3418
  } else {
3416
- this.maskCtx.save(), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), this.maskCtx.globalCompositeOperation = Pt ? "destination-out" : "destination-in", gt > 0 && (this.maskCtx.filter = `blur(${gt}px)`), this.maskCtx.globalAlpha = Ct, this.applyAbsoluteTransform(this.maskCtx, D.id, o);
3417
- const Rt = (et == null ? void 0 : et.width) || D.geometry.width || 0, ft = (et == null ? void 0 : et.height) || D.geometry.height || 0, lt = (et == null ? void 0 : et.corner_radius) ?? D.corner_radius ?? 0;
3419
+ this.maskCtx.save(), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), this.maskCtx.globalCompositeOperation = Pt ? "destination-out" : "destination-in", mt > 0 && (this.maskCtx.filter = `blur(${mt}px)`), this.maskCtx.globalAlpha = Ct, this.applyAbsoluteTransform(this.maskCtx, D.id, o);
3420
+ const xt = (et == null ? void 0 : et.width) || D.geometry.width || 0, ft = (et == null ? void 0 : et.height) || D.geometry.height || 0, ct = (et == null ? void 0 : et.corner_radius) ?? D.corner_radius ?? 0;
3418
3421
  if (((jt = D.geometry) == null ? void 0 : jt.type) === "Text") {
3419
3422
  const tt = et != null && et.geometry ? this.deepMerge(D.geometry, et.geometry) : D.geometry, dt = et != null && et.style ? this.deepMerge(D.style, et.style) : D.style;
3420
- this._renderText(this.maskCtx, D, { ...tt, width: Rt, height: ft, corner_radius: lt }, dt, et, Rt, ft, !0);
3423
+ this._renderText(this.maskCtx, D, { ...tt, width: xt, height: ft, corner_radius: ct }, dt, et, xt, ft, !0);
3421
3424
  } else if (((Vt = D.geometry) == null ? void 0 : Vt.type) === "Image") {
3422
3425
  const tt = D.geometry.src;
3423
3426
  if (tt) {
3424
3427
  let dt = this.imageCache.get(tt);
3425
- dt || (dt = new Image(), dt.src = tt, this.imageCache.set(tt, dt)), dt.complete && dt.naturalWidth > 0 ? this.maskCtx.drawImage(dt, -Rt / 2, -ft / 2, Rt, ft) : (this.applyPath(this.maskCtx, D.geometry, Rt, ft, lt), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
3428
+ dt || (dt = new Image(), dt.src = tt, this.imageCache.set(tt, dt)), dt.complete && dt.naturalWidth > 0 ? this.maskCtx.drawImage(dt, -xt / 2, -ft / 2, xt, ft) : (this.applyPath(this.maskCtx, D.geometry, xt, ft, ct), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
3426
3429
  }
3427
3430
  } else if (((ce = D.geometry) == null ? void 0 : ce.type) === "SVG") {
3428
3431
  const tt = D.geometry.svgContent;
@@ -3436,10 +3439,10 @@ class ci {
3436
3439
  this.artboard && this.reset();
3437
3440
  }, this.imageCache.set(dt, G);
3438
3441
  }
3439
- G.complete && G.naturalWidth > 0 ? this.maskCtx.drawImage(G, -Rt / 2, -ft / 2, Rt, ft) : (this.applyPath(this.maskCtx, D.geometry, Rt, ft, lt), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
3442
+ G.complete && G.naturalWidth > 0 ? this.maskCtx.drawImage(G, -xt / 2, -ft / 2, xt, ft) : (this.applyPath(this.maskCtx, D.geometry, xt, ft, ct), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
3440
3443
  }
3441
3444
  } else
3442
- this.applyPath(this.maskCtx, D.geometry, Rt, ft, lt), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill();
3445
+ this.applyPath(this.maskCtx, D.geometry, xt, ft, ct), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill();
3443
3446
  this.maskCtx.restore();
3444
3447
  }
3445
3448
  }), Bt.save(), Bt.setTransform(1, 0, 0, 1, 0, 0);
@@ -3449,23 +3452,23 @@ class ci {
3449
3452
  t.restore();
3450
3453
  }
3451
3454
  }
3452
- _renderText(t, i, o, e, s, n, a, r = !1, l = !1) {
3453
- var yt, ct, wt, Mt, It, Ot, At, Tt, zt;
3454
- let c = o.text || "";
3455
+ _renderText(t, i, o, e, s, n, a, r = !1, c = !1) {
3456
+ var bt, ht, wt, Mt, It, Ot, At, Tt, zt;
3457
+ let l = o.text || "";
3455
3458
  if (o.textInputId && !r) {
3456
3459
  const Z = this.inputs.get(o.textInputId);
3457
- Z !== void 0 && (c = String(Z), s.geometry && s.geometry.type === "Text" && (s.geometry.text = c));
3460
+ Z !== void 0 && (l = String(Z), s.geometry && s.geometry.type === "Text" && (s.geometry.text = l));
3458
3461
  }
3459
3462
  if (o.svgPath) {
3460
3463
  const Z = o.svgPath;
3461
3464
  t.save();
3462
- const pt = ((yt = e == null ? void 0 : e.fill) == null ? void 0 : yt.color) || "#000000", Et = ((ct = e == null ? void 0 : e.fill) == null ? void 0 : ct.opacity) !== void 0 ? (wt = e == null ? void 0 : e.fill) == null ? void 0 : wt.opacity : 1;
3465
+ const pt = ((bt = e == null ? void 0 : e.fill) == null ? void 0 : bt.color) || "#000000", Et = ((ht = e == null ? void 0 : e.fill) == null ? void 0 : ht.opacity) !== void 0 ? (wt = e == null ? void 0 : e.fill) == null ? void 0 : wt.opacity : 1;
3463
3466
  t.fillStyle = pt, t.globalAlpha *= Et;
3464
3467
  const ut = new Path2D(Z);
3465
3468
  t.fill(ut), t.restore();
3466
3469
  return;
3467
3470
  }
3468
- let f = c || "";
3471
+ let f = l || "";
3469
3472
  o.enableSegments === !0 && o.segments && Array.isArray(o.segments) && (f = o.segments.map((Z) => Z && Z.text ? Z.text : "").join(""));
3470
3473
  const u = o.textCase || "none";
3471
3474
  u === "uppercase" ? f = f.toUpperCase() : u === "lowercase" ? f = f.toLowerCase() : u === "capitalize" && (f = f.replace(/\b\w/g, (Z) => Z.toUpperCase()));
@@ -3494,10 +3497,10 @@ class ci {
3494
3497
  t.letterSpacing !== void 0 && (t.letterSpacing = `${M}px`);
3495
3498
  const k = o.kerning || "auto", T = o.kerningValue || 0;
3496
3499
  k === "manual" && T !== 0 && (t.letterSpacing = `${M + T}px`);
3497
- const R = o.paragraphSpacing || 0;
3500
+ const x = o.paragraphSpacing || 0;
3498
3501
  let P = o.lineHeight ?? 1.2;
3499
3502
  typeof P == "string" && (P = parseFloat(P)), P > 5 && y > 0 && (P = P / y);
3500
- const E = (P || 1.2) * y, x = o.isPointText === !0 || !o.width || o.width <= 0, O = ((It = o.padding) == null ? void 0 : It.left) || ((Ot = o.padding) == null ? void 0 : Ot.right) || 0, W = x ? 1e5 : o.width && o.width > 0 ? Math.ceil(o.width) - O * 2 : 1e5;
3503
+ const E = (P || 1.2) * y, R = o.isPointText === !0 || !o.width || o.width <= 0, O = ((It = o.padding) == null ? void 0 : It.left) || ((Ot = o.padding) == null ? void 0 : Ot.right) || 0, W = R ? 1e5 : o.width && o.width > 0 ? Math.ceil(o.width) - O * 2 : 1e5;
3501
3504
  o.autoHeight;
3502
3505
  const B = us({
3503
3506
  text: f,
@@ -3508,7 +3511,7 @@ class ci {
3508
3511
  lineHeight: P,
3509
3512
  width: W,
3510
3513
  letterSpacing: M,
3511
- paragraphSpacing: R,
3514
+ paragraphSpacing: x,
3512
3515
  paragraphIndent: o.paragraphIndent || 0,
3513
3516
  segments: o.segments,
3514
3517
  enableSegments: o.enableSegments,
@@ -3522,8 +3525,8 @@ class ci {
3522
3525
  let Z = 0, pt = 0;
3523
3526
  const Et = B.fullText || f;
3524
3527
  ($ || []).forEach((ut) => {
3525
- const vt = ut.text || "", xt = t.measureText(vt).width + (vt.length > 0 ? (vt.length - 1) * M : 0);
3526
- xt > Z && (Z = xt), pt += vt.length, pt < Et.length && (Et[pt] === `
3528
+ const vt = ut.text || "", Rt = t.measureText(vt).width + (vt.length > 0 ? (vt.length - 1) * M : 0);
3529
+ Rt > Z && (Z = Rt), pt += vt.length, pt < Et.length && (Et[pt] === `
3527
3530
  ` || Et[pt] === "\r") && (pt++, Et[pt - 1] === "\r" && Et[pt] === `
3528
3531
  ` && pt++);
3529
3532
  }), (_ === 0 || _ >= 1e5) && (_ = Z), L === 0 && (L = A || 0);
@@ -3538,12 +3541,12 @@ class ci {
3538
3541
  V = { geo: Et, obj: Z, w: ut, h: vt }, it = this.getPerimeter(Et, ut, vt);
3539
3542
  }
3540
3543
  }
3541
- const rt = (Z, pt) => {
3544
+ const lt = (Z, pt) => {
3542
3545
  var ut, vt;
3543
3546
  if (M === 0 && (!o.enableSegments || !((ut = o.segments) != null && ut.length))) return t.measureText(Z).width;
3544
3547
  let Et = 0;
3545
- for (let xt = 0; xt < Z.length; xt++) {
3546
- const Xt = pt + xt;
3548
+ for (let Rt = 0; Rt < Z.length; Rt++) {
3549
+ const Xt = pt + Rt;
3547
3550
  let Bt = 0;
3548
3551
  if (o.enableSegments === !0 && ((vt = o.segments) == null ? void 0 : vt.length) > 0) {
3549
3552
  let Dt = 0, Ht = null;
@@ -3558,24 +3561,24 @@ class ci {
3558
3561
  t.save();
3559
3562
  let te = Ht.fontFamily || o.fontFamily || "Inter";
3560
3563
  const ue = this.mapFontWeight((Ht.fontWeight || o.fontWeight || "400").toString()), pe = Ht.fontStyle || d, Qt = Ht.fontSize || y;
3561
- t.font = `${pe} ${ue} ${Qt}px "${te}", sans-serif`, Bt = t.measureText(Z[xt]).width, t.restore();
3564
+ t.font = `${pe} ${ue} ${Qt}px "${te}", sans-serif`, Bt = t.measureText(Z[Rt]).width, t.restore();
3562
3565
  } else
3563
- Bt = t.measureText(Z[xt]).width;
3566
+ Bt = t.measureText(Z[Rt]).width;
3564
3567
  } else
3565
- Bt = t.measureText(Z[xt]).width;
3568
+ Bt = t.measureText(Z[Rt]).width;
3566
3569
  Et += Bt + M;
3567
3570
  }
3568
3571
  return Et - (Z.length > 0 ? M : 0);
3569
3572
  }, nt = (Z, pt, Et, ut, vt) => {
3570
3573
  var ue, pe;
3571
3574
  const Xt = (vt === 0 || f[vt - 1] === `
3572
- ` || f[vt - 1] === "\r") && o.paragraphIndent ? o.paragraphIndent : 0, Bt = (!r || l) && (i.behaviors || []).some(
3575
+ ` || f[vt - 1] === "\r") && o.paragraphIndent ? o.paragraphIndent : 0, Bt = (!r || c) && (i.behaviors || []).some(
3573
3576
  (Qt) => Qt.enabled && (Qt.type.toString().includes("Text") || ["Typewriter", "Scramble", "Wave", "Bounce", "GlitchText", "Reveal3D", "RevealSlide", "RevealBlur"].includes(Qt.type))
3574
3577
  ), Dt = !o.pathId && !Bt && (o.enableSegments !== !0 || !o.segments || o.segments.length === 0), Ht = o.baselineShift || 0, te = Et + Ht;
3575
3578
  if (Dt)
3576
3579
  t.font = C, ut ? t.strokeText(Z, pt + Xt, te) : t.fillText(Z, pt + Xt, te);
3577
3580
  else {
3578
- const Qt = rt(Z, vt);
3581
+ const Qt = lt(Z, vt);
3579
3582
  let me = pt + Xt;
3580
3583
  I === "center" ? me -= Qt / 2 : I === "right" && (me -= Qt);
3581
3584
  const _e = vt + Z.length >= f.length || f[vt + Z.length] === `
@@ -3583,19 +3586,19 @@ class ci {
3583
3586
  let ye = 0, Se = 0;
3584
3587
  const Pe = o.justifyMinWordSpacing, ae = o.justifyMaxWordSpacing;
3585
3588
  if (I === "justify" && !_e && Qt > 0 && !o.pathId) {
3586
- const j = x ? Qt : W - O * 2 + 0, z = Math.max(0, j - Qt);
3589
+ const j = R ? Qt : W - O * 2 + 0, z = Math.max(0, j - Qt);
3587
3590
  for (let D = 0; D < Z.length; D++)
3588
3591
  Z[D] === " " && Se++;
3589
3592
  if (Se > 0) {
3590
3593
  const D = t.measureText(" ").width;
3591
- let et = Pe || D * 0.5, gt = ae || D * 2.5;
3592
- ye = Math.max(0, Math.min(z / Se, gt - et));
3594
+ let et = Pe || D * 0.5, mt = ae || D * 2.5;
3595
+ ye = Math.max(0, Math.min(z / Se, mt - et));
3593
3596
  }
3594
3597
  }
3595
3598
  let ee = o.pathOffset || 0;
3596
3599
  o.pathId && it > 0 && V && (I === "center" ? ee += it / 2 - Qt / 2 : I === "right" && (ee += it - Qt));
3597
- let ht = me;
3598
- const bt = r && !l ? [] : ((ue = i.behaviors) == null ? void 0 : ue.filter(
3600
+ let at = me;
3601
+ const gt = r && !c ? [] : ((ue = i.behaviors) == null ? void 0 : ue.filter(
3599
3602
  (j) => [
3600
3603
  N.Typewriter,
3601
3604
  N.Scramble,
@@ -3631,145 +3634,145 @@ class ci {
3631
3634
  for (let j = 0; j < Z.length; j++) {
3632
3635
  let z = Z[j];
3633
3636
  const D = vt + j;
3634
- let et = 0, gt = 0, Pt = 1, Ct = 1, Wt = 0, mt = 1, F = z;
3635
- bt.forEach((ft) => {
3636
- const lt = ft.settings || {}, tt = lt.strength || 1, dt = Date.now();
3637
+ let et = 0, mt = 0, Pt = 1, Ct = 1, Wt = 0, yt = 1, F = z;
3638
+ gt.forEach((ft) => {
3639
+ const ct = ft.settings || {}, tt = ct.strength || 1, dt = Date.now();
3637
3640
  if (ft.type === N.Typewriter)
3638
- this.currentTime * (lt.speed || 1) - D * (lt.stagger || 0.05) < 0 && (mt = 0);
3641
+ this.currentTime * (ct.speed || 1) - D * (ct.stagger || 0.05) < 0 && (yt = 0);
3639
3642
  else if (ft.type === N.Scramble)
3640
- Math.max(0, Math.min(1, this.currentTime / (lt.duration || 1.5)) - D * 0.02) < 1 && Math.random() < 0.3 && (F = "$%#@!*&"[Math.floor(Math.random() * 7)]);
3643
+ Math.max(0, Math.min(1, this.currentTime / (ct.duration || 1.5)) - D * 0.02) < 1 && Math.random() < 0.3 && (F = "$%#@!*&"[Math.floor(Math.random() * 7)]);
3641
3644
  else if (ft.type === N.Wave)
3642
- gt += Math.sin(this.currentTime * 5 * (lt.speed || 1) + D * (lt.frequency || 1)) * (lt.amplitude || 20) * tt;
3645
+ mt += Math.sin(this.currentTime * 5 * (ct.speed || 1) + D * (ct.frequency || 1)) * (ct.amplitude || 20) * tt;
3643
3646
  else if (ft.type === N.Bounce) {
3644
- const G = Math.max(0, this.currentTime % 2 - D * (lt.stagger || 0.1));
3645
- G < 1 && (gt -= Math.abs(Math.sin(G * Math.PI)) * (lt.height || 50) * tt);
3647
+ const G = Math.max(0, this.currentTime % 2 - D * (ct.stagger || 0.1));
3648
+ G < 1 && (mt -= Math.abs(Math.sin(G * Math.PI)) * (ct.height || 50) * tt);
3646
3649
  } else if (ft.type === N.TextTrail) {
3647
- const G = this.pointerHistory[Math.max(0, this.pointerHistory.length - 1 - D * (lt.delay || 5))];
3648
- G && (et += (G.x - (s.x + ht)) * tt * 0.2, gt += (G.y - (s.y + Et + gt)) * tt * 0.2);
3650
+ const G = this.pointerHistory[Math.max(0, this.pointerHistory.length - 1 - D * (ct.delay || 5))];
3651
+ G && (et += (G.x - (s.x + at)) * tt * 0.2, mt += (G.y - (s.y + Et + mt)) * tt * 0.2);
3649
3652
  } else if (ft.type === N.Reveal3D) {
3650
- const G = Math.max(0, Math.min(1, this.currentTime * (lt.speed || 1) - D * (lt.stagger || 0.1)));
3651
- Pt *= G, Ct *= G, mt = G;
3653
+ const G = Math.max(0, Math.min(1, this.currentTime * (ct.speed || 1) - D * (ct.stagger || 0.1)));
3654
+ Pt *= G, Ct *= G, yt = G;
3652
3655
  } else if (ft.type === N.RevealSlide) {
3653
- const G = Math.max(0, Math.min(1, this.currentTime * 1.5 - D * 0.05)), st = (1 - G) * (lt.distance || 40) * tt, J = lt.direction || "up";
3654
- J === "up" ? gt -= st : J === "down" ? gt += st : J === "left" ? et -= st : J === "right" && (et += st), mt = G;
3656
+ const G = Math.max(0, Math.min(1, this.currentTime * 1.5 - D * 0.05)), st = (1 - G) * (ct.distance || 40) * tt, J = ct.direction || "up";
3657
+ J === "up" ? mt -= st : J === "down" ? mt += st : J === "left" ? et -= st : J === "right" && (et += st), yt = G;
3655
3658
  } else if (ft.type === N.RevealBlur) {
3656
3659
  const G = Math.max(0, Math.min(1, this.currentTime * 1.2 - D * 0.1));
3657
- mt = G, et += (1 - G) * 5;
3660
+ yt = G, et += (1 - G) * 5;
3658
3661
  } else if (ft.type === N.TextLiquid) {
3659
- const G = Math.max(0, Math.sin(dt * 1e-3 * (lt.speed || 1) + D * 0.5));
3660
- gt += G * (lt.amplitude || 10) * tt, Ct *= 1 + G * 0.2;
3662
+ const G = Math.max(0, Math.sin(dt * 1e-3 * (ct.speed || 1) + D * 0.5));
3663
+ mt += G * (ct.amplitude || 10) * tt, Ct *= 1 + G * 0.2;
3661
3664
  } else if (ft.type === N.TextVortex) {
3662
- const G = dt * 2e-3 * (lt.speed || 1) + D * 0.2, st = (1 - (Math.sin(dt * 1e-3) * 0.5 + 0.5)) * (lt.radius || 50);
3663
- et += Math.cos(G) * st * tt, gt += Math.sin(G) * st * tt;
3665
+ const G = dt * 2e-3 * (ct.speed || 1) + D * 0.2, st = (1 - (Math.sin(dt * 1e-3) * 0.5 + 0.5)) * (ct.radius || 50);
3666
+ et += Math.cos(G) * st * tt, mt += Math.sin(G) * st * tt;
3664
3667
  } else if (ft.type === N.TextExplosion) {
3665
- const G = lt.force || 1, st = this.currentTime % 2;
3668
+ const G = ct.force || 1, st = this.currentTime % 2;
3666
3669
  if (st < 1) {
3667
3670
  const J = (D / Z.length - 0.5) * Math.PI * 2, Ft = st * 100 * G;
3668
- et += Math.cos(J) * Ft * tt, gt += Math.sin(J) * Ft * tt, mt = 1 - st;
3671
+ et += Math.cos(J) * Ft * tt, mt += Math.sin(J) * Ft * tt, yt = 1 - st;
3669
3672
  }
3670
3673
  } else if (ft.type === N.TextRain) {
3671
- const G = lt.speed || 1, st = lt.height || 100, J = (dt * 1e-3 * G + D * 0.1) % 1;
3672
- gt -= (1 - J) * st * tt, mt = J > 0.1 ? 1 : J * 10;
3674
+ const G = ct.speed || 1, st = ct.height || 100, J = (dt * 1e-3 * G + D * 0.1) % 1;
3675
+ mt -= (1 - J) * st * tt, yt = J > 0.1 ? 1 : J * 10;
3673
3676
  } else if (ft.type === N.TextGravity) {
3674
- const G = lt.gravity || 9.8, st = this.currentTime % 3 / 3, J = 0.5 * G * Math.pow(st * 10, 2);
3675
- J < 100 ? gt += J * tt : gt += 100 * tt;
3677
+ const G = ct.gravity || 9.8, st = this.currentTime % 3 / 3, J = 0.5 * G * Math.pow(st * 10, 2);
3678
+ J < 100 ? mt += J * tt : mt += 100 * tt;
3676
3679
  } else if (ft.type === N.TextMatrix) {
3677
- const G = lt.speed || 1;
3680
+ const G = ct.speed || 1;
3678
3681
  if (Math.random() < 0.1 * G) {
3679
3682
  const J = "0123456789ABCDEF!@#$%^&*";
3680
3683
  F = J[Math.floor(Math.random() * J.length)];
3681
3684
  }
3682
- mt = 0.3 + (Math.sin(dt * 0.01 * G + D) + 1) / 2 * 0.7;
3685
+ yt = 0.3 + (Math.sin(dt * 0.01 * G + D) + 1) / 2 * 0.7;
3683
3686
  } else if (ft.type === N.TextNeon) {
3684
3687
  const G = Math.random() > 0.95 ? 0.5 : 1;
3685
- mt = (0.7 + (Math.sin(dt * 5e-3) + 1) / 2 * 0.3) * G;
3688
+ yt = (0.7 + (Math.sin(dt * 5e-3) + 1) / 2 * 0.3) * G;
3686
3689
  } else if (ft.type === N.TextDissolve)
3687
- Math.sin(D * 1.5 + dt * 2e-3 * (lt.speed || 1)) > 0.5 && (mt = 0);
3690
+ Math.sin(D * 1.5 + dt * 2e-3 * (ct.speed || 1)) > 0.5 && (yt = 0);
3688
3691
  else if (ft.type === N.TextOrganic) {
3689
- const G = lt.speed || 1, st = lt.amplitude || 10;
3690
- et += Math.sin(dt * 2e-3 * G + D) * st * tt, gt += Math.cos(dt * 15e-4 * G + D * 0.7) * st * tt;
3692
+ const G = ct.speed || 1, st = ct.amplitude || 10;
3693
+ et += Math.sin(dt * 2e-3 * G + D) * st * tt, mt += Math.cos(dt * 15e-4 * G + D * 0.7) * st * tt;
3691
3694
  } else if (ft.type === N.TextBreathe) {
3692
3695
  const st = 1 + (Math.sin(dt * 3e-3 + D * 0.2) + 1) / 2 * 0.2 * tt;
3693
3696
  Pt *= st, Ct *= st;
3694
3697
  } else if (ft.type === N.TextSpin) {
3695
- const G = lt.speed || 1;
3698
+ const G = ct.speed || 1;
3696
3699
  Wt += dt * 0.01 * G + D;
3697
3700
  } else if (ft.type === N.TextMagnet) {
3698
3701
  const G = this.pointerHistory[this.pointerHistory.length - 1];
3699
3702
  if (G) {
3700
- const st = G.x - (s.x + ht), J = G.y - (s.y + Et);
3703
+ const st = G.x - (s.x + at), J = G.y - (s.y + Et);
3701
3704
  Wt = Math.atan2(J, st);
3702
3705
  }
3703
3706
  } else if (ft.type === N.TextPerspective) {
3704
3707
  const G = Z.length / 2, st = (D - G) / G, J = 1 - Math.abs(st) * 0.3 * tt;
3705
3708
  Pt *= J, Ct *= J, et += st * 20 * tt;
3706
3709
  } else if (ft.type === N.TextMirror)
3707
- mt *= 0.8;
3710
+ yt *= 0.8;
3708
3711
  else if (ft.type === N.TextFloral) {
3709
- const G = lt.speed || 1, st = lt.stagger || 0.1, J = (dt * 1e-3 * G + D * st) % 2;
3712
+ const G = ct.speed || 1, st = ct.stagger || 0.1, J = (dt * 1e-3 * G + D * st) % 2;
3710
3713
  J < 1 && (Pt *= J, Ct *= J, Wt += J * Math.PI);
3711
3714
  } else if (ft.type === N.TextSmoke) {
3712
- const G = lt.speed || 1, st = lt.height || 50, J = (dt * 5e-4 * G + D * 0.2) % 1;
3713
- gt -= J * st * tt, et += Math.sin(dt * 2e-3 + D) * 5 * tt, mt = 1 - J;
3715
+ const G = ct.speed || 1, st = ct.height || 50, J = (dt * 5e-4 * G + D * 0.2) % 1;
3716
+ mt -= J * st * tt, et += Math.sin(dt * 2e-3 + D) * 5 * tt, yt = 1 - J;
3714
3717
  } else if (ft.type === N.TextVariable) {
3715
- const G = lt.speed || 1, st = lt.intensity || 1.5, J = (Math.sin(dt * 4e-3 * G + D * 0.3) + 1) / 2;
3718
+ const G = ct.speed || 1, st = ct.intensity || 1.5, J = (Math.sin(dt * 4e-3 * G + D * 0.3) + 1) / 2;
3716
3719
  Pt *= 1 + J * (st - 1) * tt;
3717
3720
  } else if (ft.type === N.TextZing) {
3718
- const G = lt.speed || 2, st = lt.distance || 100, J = (dt * 2e-3 * G + D * 0.05) % 1;
3719
- et += (1 - J) * st * tt, mt = J;
3721
+ const G = ct.speed || 2, st = ct.distance || 100, J = (dt * 2e-3 * G + D * 0.05) % 1;
3722
+ et += (1 - J) * st * tt, yt = J;
3720
3723
  } else if (ft.type === N.TextElastic) {
3721
- const G = lt.stiffness || 0.2, st = lt.damping || 0.1, J = Math.sin(dt * 0.01) * Math.exp(-dt * 1e-3 * st);
3724
+ const G = ct.stiffness || 0.2, st = ct.damping || 0.1, J = Math.sin(dt * 0.01) * Math.exp(-dt * 1e-3 * st);
3722
3725
  Ct *= 1 + J * G * tt;
3723
3726
  } else if (ft.type === N.TextGlitch3D) {
3724
- const G = lt.intensity || 5;
3725
- Math.random() < 0.2 && (et += (Math.random() - 0.5) * G, gt += (Math.random() - 0.5) * G, mt = 0.8);
3727
+ const G = ct.intensity || 5;
3728
+ Math.random() < 0.2 && (et += (Math.random() - 0.5) * G, mt += (Math.random() - 0.5) * G, yt = 0.8);
3726
3729
  } else if (ft.type === N.GlitchText) {
3727
- const G = lt.intensity || 5;
3728
- Math.random() < 0.1 && (et += (Math.random() - 0.5) * G, gt += (Math.random() - 0.5) * G, Math.random() < 0.05 && (mt = 0.5));
3730
+ const G = ct.intensity || 5;
3731
+ Math.random() < 0.1 && (et += (Math.random() - 0.5) * G, mt += (Math.random() - 0.5) * G, Math.random() < 0.05 && (yt = 0.5));
3729
3732
  }
3730
3733
  });
3731
3734
  let Lt = null, jt = o.textDecoration || "none", Vt = y;
3732
3735
  if (o.enableSegments === !0 && ((pe = o.segments) == null ? void 0 : pe.length) > 0) {
3733
- let ft = 0, lt = null;
3736
+ let ft = 0, ct = null;
3734
3737
  for (const tt of o.segments) {
3735
3738
  if (D < ft + (tt.text || "").length) {
3736
- lt = tt;
3739
+ ct = tt;
3737
3740
  break;
3738
3741
  }
3739
3742
  ft += (tt.text || "").length;
3740
3743
  }
3741
- if (lt) {
3742
- let tt = lt.fontFamily || o.fontFamily || "Inter";
3744
+ if (ct) {
3745
+ let tt = ct.fontFamily || o.fontFamily || "Inter";
3743
3746
  b.forEach((st) => {
3744
3747
  const J = new RegExp(`[\\s-]${st}$`, "i");
3745
3748
  J.test(tt) && (tt = tt.replace(J, "").trim());
3746
3749
  });
3747
- const dt = this.mapFontWeight((lt.fontWeight || o.fontWeight || "400").toString()), G = lt.fontStyle || d;
3748
- Vt = lt.fontSize || y, t.font = `${G} ${dt} ${Vt}px "${tt}", sans-serif`, lt.fill && (Lt = lt.fill), lt.textDecoration && (jt = lt.textDecoration), Vt < Y && (gt += (Y - Vt) * 0.85);
3750
+ const dt = this.mapFontWeight((ct.fontWeight || o.fontWeight || "400").toString()), G = ct.fontStyle || d;
3751
+ Vt = ct.fontSize || y, t.font = `${G} ${dt} ${Vt}px "${tt}", sans-serif`, ct.fill && (Lt = ct.fill), ct.textDecoration && (jt = ct.textDecoration), Vt < Y && (mt += (Y - Vt) * 0.85);
3749
3752
  }
3750
3753
  } else
3751
3754
  t.font = C;
3752
3755
  const ce = t.globalAlpha;
3753
- t.globalAlpha *= mt, t.save();
3754
- const Rt = t.measureText(F).width;
3756
+ t.globalAlpha *= yt, t.save();
3757
+ const xt = t.measureText(F).width;
3755
3758
  if (V && it > 0) {
3756
- const ft = ht - me + Rt / 2, tt = (ee + ft) / it, dt = this.getPointOnPath(V.geo, V.w, V.h, Math.abs(tt % 1)), G = dt.angle, st = Et + gt + (o.pathOffsetY || 0), J = o.pathSide === "right" ? -1 : 1, Ft = Math.cos(G + Math.PI / 2) * st * J, Ut = Math.sin(G + Math.PI / 2) * st * J;
3759
+ const ft = at - me + xt / 2, tt = (ee + ft) / it, dt = this.getPointOnPath(V.geo, V.w, V.h, Math.abs(tt % 1)), G = dt.angle, st = Et + mt + (o.pathOffsetY || 0), J = o.pathSide === "right" ? -1 : 1, Ft = Math.cos(G + Math.PI / 2) * st * J, Ut = Math.sin(G + Math.PI / 2) * st * J;
3757
3760
  t.translate(dt.x + Ft + et, dt.y + Ut), t.rotate(G + Wt + (J === -1 ? Math.PI : 0));
3758
3761
  } else
3759
- t.translate(ht + et + Rt / 2, Et + gt), Wt !== 0 && t.rotate(Wt);
3760
- if (t.scale(Pt, Ct), Lt && !r && !l) {
3762
+ t.translate(at + et + xt / 2, Et + mt), Wt !== 0 && t.rotate(Wt);
3763
+ if (t.scale(Pt, Ct), Lt && !r && !c) {
3761
3764
  const ft = this.createCanvasFill(t, Lt, _, L);
3762
3765
  t.fillStyle = ft || Lt.color || "#000000";
3763
- } else if (!r && !l) {
3766
+ } else if (!r && !c) {
3764
3767
  const ft = this.createCanvasFill(t, e.fill, _, L);
3765
3768
  t.fillStyle = ft || e.fill.color || "#000000";
3766
3769
  }
3767
- if (mt > 0)
3768
- if (r || l) {
3769
- const ft = l ? "#000000" : this.createCanvasFill(t, e.fill, _, L);
3770
- t.fillStyle = ft || e.fill.color || "#ffffff", t.fillText(F, -Rt / 2, 0);
3771
- } else ut ? t.strokeText(F, -Rt / 2, 0) : t.fillText(F, -Rt / 2, 0);
3772
- jt !== "none" && !r && this.drawTextDecoration(t, jt, 0, 0, Rt, Vt), t.restore(), t.globalAlpha = ce, I === "justify" && ye > 0 && F === " " && !_e ? ht += Rt + M + ye : ht += Rt + M;
3770
+ if (yt > 0)
3771
+ if (r || c) {
3772
+ const ft = c ? "#000000" : this.createCanvasFill(t, e.fill, _, L);
3773
+ t.fillStyle = ft || e.fill.color || "#ffffff", t.fillText(F, -xt / 2, 0);
3774
+ } else ut ? t.strokeText(F, -xt / 2, 0) : t.fillText(F, -xt / 2, 0);
3775
+ jt !== "none" && !r && this.drawTextDecoration(t, jt, 0, 0, xt, Vt), t.restore(), t.globalAlpha = ce, I === "justify" && ye > 0 && F === " " && !_e ? at += xt + M + ye : at += xt + M;
3773
3776
  }
3774
3777
  }
3775
3778
  };
@@ -3778,10 +3781,10 @@ class ci {
3778
3781
  ($ || []).forEach((Et) => {
3779
3782
  const ut = Et.text || "", vt = f.indexOf(ut, Z);
3780
3783
  vt !== -1 && (Z = vt);
3781
- let xt = -_ / 2;
3782
- I === "center" ? xt = 0 : I === "right" && (xt = _ / 2), nt(ut, xt, pt, !1, Z), Z += ut.length, pt += E;
3784
+ let Rt = -_ / 2;
3785
+ I === "center" ? Rt = 0 : I === "right" && (Rt = _ / 2), nt(ut, Rt, pt, !1, Z), Z += ut.length, pt += E;
3783
3786
  });
3784
- } else if (l) {
3787
+ } else if (c) {
3785
3788
  let Z = 0, pt = X;
3786
3789
  ($ || []).forEach((Et) => {
3787
3790
  const ut = Et.text || "";
@@ -3799,12 +3802,12 @@ class ci {
3799
3802
  const Dt = Xt.textCase || o.textCase || "none";
3800
3803
  return Dt === "uppercase" ? Bt.toUpperCase() : Dt === "lowercase" ? Bt.toLowerCase() : Dt === "capitalize" ? Bt.replace(/\b\w/g, (Ht) => Ht.toUpperCase()) : Bt;
3801
3804
  }).join("") : f);
3802
- let vt = 0, xt = X;
3805
+ let vt = 0, Rt = X;
3803
3806
  ($ || []).forEach((Xt) => {
3804
3807
  const Bt = Xt.text || "";
3805
3808
  let Dt = -_ / 2;
3806
- I === "center" ? Dt = 0 : I === "right" && (Dt = _ / 2), nt(Bt, Dt, xt, !1, vt), vt += Bt.length, xt += E, vt < ut.length && (ut[vt] === `
3807
- ` || ut[vt] === "\r") && (R > 0 && (xt += R), vt++, ut[vt - 1] === "\r" && ut[vt] === `
3809
+ I === "center" ? Dt = 0 : I === "right" && (Dt = _ / 2), nt(Bt, Dt, Rt, !1, vt), vt += Bt.length, Rt += E, vt < ut.length && (ut[vt] === `
3810
+ ` || ut[vt] === "\r") && (x > 0 && (Rt += x), vt++, ut[vt - 1] === "\r" && ut[vt] === `
3808
3811
  ` && vt++);
3809
3812
  }), t.globalAlpha = pt;
3810
3813
  }
@@ -3813,9 +3816,9 @@ class ci {
3813
3816
  let pt = 0;
3814
3817
  ($ || []).forEach((Et, ut) => {
3815
3818
  var Xt, Bt;
3816
- const xt = pt === 0 || pt < f.length && (f[pt] === `
3819
+ const Rt = pt === 0 || pt < f.length && (f[pt] === `
3817
3820
  ` || f[pt] === "\r");
3818
- if (xt && ut > 0 && pt++, xt) {
3821
+ if (Rt && ut > 0 && pt++, Rt) {
3819
3822
  if (((Xt = Z.top) == null ? void 0 : Xt.width) > 0) {
3820
3823
  const Dt = X + ut * E - Z.top.offset;
3821
3824
  t.strokeStyle = Z.top.color || "#000000", t.lineWidth = Z.top.width, t.beginPath();
@@ -3836,10 +3839,10 @@ class ci {
3836
3839
  const pt = t.globalAlpha;
3837
3840
  e.fill && e.fill.type !== "None" && e.fill.isEnabled !== !1 && e.fill.opacity !== 0 && e.fill.color !== "transparent" && e.fill.color !== "rgba(0,0,0,0)" && (t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetX = 0, t.shadowOffsetY = 0), t.strokeStyle = e.stroke.color, t.lineWidth = e.stroke.width, t.globalAlpha = pt * this.normalizeOpacity(e.stroke.opacity ?? 100);
3838
3841
  let ut = 0, vt = X;
3839
- ($ || []).forEach((xt) => {
3842
+ ($ || []).forEach((Rt) => {
3840
3843
  let Xt = -_ / 2;
3841
- I === "center" ? Xt = 0 : I === "right" && (Xt = _ / 2), nt(xt.text, Xt, vt, !0, ut), ut += (xt.text || "").length, vt += E, ut < f.length && (f[ut] === `
3842
- ` || f[ut] === "\r") && (R > 0 && (vt += R), ut++, f[ut - 1] === "\r" && f[ut] === `
3844
+ I === "center" ? Xt = 0 : I === "right" && (Xt = _ / 2), nt(Rt.text, Xt, vt, !0, ut), ut += (Rt.text || "").length, vt += E, ut < f.length && (f[ut] === `
3845
+ ` || f[ut] === "\r") && (x > 0 && (vt += x), ut++, f[ut - 1] === "\r" && f[ut] === `
3843
3846
  ` && ut++);
3844
3847
  }), t.globalAlpha = pt;
3845
3848
  }
@@ -3847,7 +3850,7 @@ class ci {
3847
3850
  }
3848
3851
  applyStrokeAlignment(t, i, o, e, s, n) {
3849
3852
  if (!i.stroke || i.stroke.width <= 0 || i.stroke.isEnabled === !1) return;
3850
- const a = i.stroke, r = a.width, l = (a.alignment || "center").toLowerCase();
3853
+ const a = i.stroke, r = a.width, c = (a.alignment || "center").toLowerCase();
3851
3854
  if (t.save(), i.fill && i.fill.type !== "None" && i.fill.isEnabled !== !1 && i.fill.opacity !== 0 && i.fill.color !== "transparent" && i.fill.color !== "rgba(0,0,0,0)" && (t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetX = 0, t.shadowOffsetY = 0), a.fill) {
3852
3855
  const m = this.createCanvasFill(t, a.fill, e, s);
3853
3856
  m ? t.strokeStyle = m : t.strokeStyle = a.color || "#000000";
@@ -3871,7 +3874,7 @@ class ci {
3871
3874
  }
3872
3875
  }
3873
3876
  } else y.length > 0 && (t.setLineDash(y), t.lineDashOffset = p);
3874
- (o == null ? void 0 : o.type) === "Line" || e === 0 || s === 0 ? (this.applyPath(t, o, e, s, n), t.stroke()) : l === "inside" ? (t.lineWidth = r * 2, t.save(), this.applyPath(t, o, e, s, n), t.clip(), t.stroke(), t.restore()) : l === "outside" ? (t.lineWidth = r * 2, this.applyPath(t, o, e, s, n), t.stroke(), t.save(), t.globalCompositeOperation = "destination-out", this.applyPath(t, o, e, s, n), t.fill(), t.restore()) : (t.lineWidth = r, this.applyPath(t, o, e, s, n), t.stroke()), t.restore();
3877
+ (o == null ? void 0 : o.type) === "Line" || e === 0 || s === 0 ? (this.applyPath(t, o, e, s, n), t.stroke()) : c === "inside" ? (t.lineWidth = r * 2, t.save(), this.applyPath(t, o, e, s, n), t.clip(), t.stroke(), t.restore()) : c === "outside" ? (t.lineWidth = r * 2, this.applyPath(t, o, e, s, n), t.stroke(), t.save(), t.globalCompositeOperation = "destination-out", this.applyPath(t, o, e, s, n), t.fill(), t.restore()) : (t.lineWidth = r, this.applyPath(t, o, e, s, n), t.stroke()), t.restore();
3875
3878
  }
3876
3879
  getPerimeter(t, i, o) {
3877
3880
  switch (this.ensurePathPoints(t), t == null ? void 0 : t.type) {
@@ -3880,12 +3883,12 @@ class ci {
3880
3883
  case "Ellipse": {
3881
3884
  const e = Math.abs(i) / 2, s = Math.abs(o) / 2, n = Math.abs(t.sweepAngle ?? 360), a = t.ratio || 0, r = Math.PI * (3 * (e + s) - Math.sqrt((3 * e + s) * (e + 3 * s)));
3882
3885
  if (n >= 360 && a <= 0) return r;
3883
- let l = n / 360 * r;
3886
+ let c = n / 360 * r;
3884
3887
  if (a > 0) {
3885
- const c = Math.PI * (3 * (e * a + s * a) - Math.sqrt((3 * e * a + s * a) * (e * a + 3 * s * a)));
3886
- l += n / 360 * c, n < 360 && (l += 2 * Math.sqrt((e - e * a) ** 2 + (s - s * a) ** 2));
3887
- } else n < 360 && (l += 2 * Math.max(e, s));
3888
- return isNaN(l) ? 0 : l;
3888
+ const l = Math.PI * (3 * (e * a + s * a) - Math.sqrt((3 * e * a + s * a) * (e * a + 3 * s * a)));
3889
+ c += n / 360 * l, n < 360 && (c += 2 * Math.sqrt((e - e * a) ** 2 + (s - s * a) ** 2));
3890
+ } else n < 360 && (c += 2 * Math.max(e, s));
3891
+ return isNaN(c) ? 0 : c;
3889
3892
  }
3890
3893
  case "Line":
3891
3894
  return t.length || Math.sqrt(i * i + o * o);
@@ -3904,22 +3907,22 @@ class ci {
3904
3907
  if (e.length < 2) return t.length || 0;
3905
3908
  let s = 0, n = e[0].x, a = e[0].y;
3906
3909
  for (let r = 1; r < e.length; r++) {
3907
- const l = e[r];
3908
- if (l.moveTo) {
3909
- n = l.x, a = l.y;
3910
+ const c = e[r];
3911
+ if (c.moveTo) {
3912
+ n = c.x, a = c.y;
3910
3913
  continue;
3911
3914
  }
3912
- const c = n, f = a, u = e[r - 1].out_x, h = e[r - 1].out_y;
3913
- if (u !== void 0 || l.in_x !== void 0 ? s += this.getBezierLength(
3914
- c,
3915
+ const l = n, f = a, u = e[r - 1].out_x, h = e[r - 1].out_y;
3916
+ if (u !== void 0 || c.in_x !== void 0 ? s += this.getBezierLength(
3917
+ l,
3915
3918
  f,
3916
- u ?? c,
3919
+ u ?? l,
3917
3920
  h ?? f,
3918
- l.in_x ?? l.x,
3919
- l.in_y ?? l.y,
3920
- l.x,
3921
- l.y
3922
- ) : s += Math.sqrt((l.x - c) ** 2 + (l.y - f) ** 2), n = l.x, a = l.y, l.closePath || r === e.length - 1 && (t.is_closed || t.isClosed)) {
3921
+ c.in_x ?? c.x,
3922
+ c.in_y ?? c.y,
3923
+ c.x,
3924
+ c.y
3925
+ ) : s += Math.sqrt((c.x - l) ** 2 + (c.y - f) ** 2), n = c.x, a = c.y, c.closePath || r === e.length - 1 && (t.is_closed || t.isClosed)) {
3923
3926
  const d = n, p = a, y = [...e.slice(0, r + 1)].reverse().find((I) => I.moveTo) || e[0], m = y.x, b = y.y, v = e[r].out_x, S = e[r].out_y, C = y.in_x, w = y.in_y;
3924
3927
  v !== void 0 || C !== void 0 ? s += this.getBezierLength(
3925
3928
  d,
@@ -3939,22 +3942,22 @@ class ci {
3939
3942
  return (i + o) * 2;
3940
3943
  }
3941
3944
  }
3942
- getBezierLength(t, i, o, e, s, n, a, r, l = 10) {
3943
- let c = 0, f = t, u = i;
3944
- for (let h = 1; h <= l; h++) {
3945
- const d = h / l, p = 1 - d, y = d * d, m = p * p, b = m * p, v = y * d, S = b * t + 3 * m * d * o + 3 * p * y * s + v * a, C = b * i + 3 * m * d * e + 3 * p * y * n + v * r, w = S - f, I = C - u;
3946
- c += Math.sqrt(w * w + I * I), f = S, u = C;
3945
+ getBezierLength(t, i, o, e, s, n, a, r, c = 10) {
3946
+ let l = 0, f = t, u = i;
3947
+ for (let h = 1; h <= c; h++) {
3948
+ const d = h / c, p = 1 - d, y = d * d, m = p * p, b = m * p, v = y * d, S = b * t + 3 * m * d * o + 3 * p * y * s + v * a, C = b * i + 3 * m * d * e + 3 * p * y * n + v * r, w = S - f, I = C - u;
3949
+ l += Math.sqrt(w * w + I * I), f = S, u = C;
3947
3950
  }
3948
- return c;
3951
+ return l;
3949
3952
  }
3950
- getBezierTAtLength(t, i, o, e, s, n, a, r, l, c = 20) {
3953
+ getBezierTAtLength(t, i, o, e, s, n, a, r, c, l = 20) {
3951
3954
  if (t <= 0) return 0;
3952
3955
  let f = 0, u = i, h = o;
3953
- for (let d = 1; d <= c; d++) {
3954
- const p = d / c, y = 1 - p, m = p * p, b = y * y, v = b * y, S = m * p, C = v * i + 3 * b * p * e + 3 * y * m * n + S * r, w = v * o + 3 * b * p * s + 3 * y * m * a + S * l, I = C - u, M = w - h, k = Math.sqrt(I * I + M * M);
3956
+ for (let d = 1; d <= l; d++) {
3957
+ const p = d / l, y = 1 - p, m = p * p, b = y * y, v = b * y, S = m * p, C = v * i + 3 * b * p * e + 3 * y * m * n + S * r, w = v * o + 3 * b * p * s + 3 * y * m * a + S * c, I = C - u, M = w - h, k = Math.sqrt(I * I + M * M);
3955
3958
  if (f + k >= t) {
3956
- const T = t - f, R = k === 0 ? 0 : T / k;
3957
- return (d - 1 + R) / c;
3959
+ const T = t - f, x = k === 0 ? 0 : T / k;
3960
+ return (d - 1 + x) / l;
3958
3961
  }
3959
3962
  f += k, u = C, h = w;
3960
3963
  }
@@ -3964,11 +3967,11 @@ class ci {
3964
3967
  if (this.ensurePathPoints(t), (t == null ? void 0 : t.type) === "Path") {
3965
3968
  const s = t.points || [];
3966
3969
  if (s.length < 2) return { x: 0, y: 0, angle: 0 };
3967
- let n = 1 / 0, a = -1 / 0, r = 1 / 0, l = -1 / 0;
3970
+ let n = 1 / 0, a = -1 / 0, r = 1 / 0, c = -1 / 0;
3968
3971
  s.forEach((b) => {
3969
- typeof b.x == "number" && typeof b.y == "number" && (n = Math.min(n, b.x), a = Math.max(a, b.x), r = Math.min(r, b.y), l = Math.max(l, b.y), b.out_x !== void 0 && (n = Math.min(n, b.out_x), a = Math.max(a, b.out_x)), b.out_y !== void 0 && (r = Math.min(r, b.out_y), l = Math.max(l, b.out_y)), b.in_x !== void 0 && (n = Math.min(n, b.in_x), a = Math.max(a, b.in_x)), b.in_y !== void 0 && (r = Math.min(r, b.in_y), l = Math.max(l, b.in_y)));
3972
+ typeof b.x == "number" && typeof b.y == "number" && (n = Math.min(n, b.x), a = Math.max(a, b.x), r = Math.min(r, b.y), c = Math.max(c, b.y), b.out_x !== void 0 && (n = Math.min(n, b.out_x), a = Math.max(a, b.out_x)), b.out_y !== void 0 && (r = Math.min(r, b.out_y), c = Math.max(c, b.out_y)), b.in_x !== void 0 && (n = Math.min(n, b.in_x), a = Math.max(a, b.in_x)), b.in_y !== void 0 && (r = Math.min(r, b.in_y), c = Math.max(c, b.in_y)));
3970
3973
  });
3971
- const c = (n + a) / 2, f = (r + l) / 2, h = this.getPerimeter(t, i, o) * e;
3974
+ const l = (n + a) / 2, f = (r + c) / 2, h = this.getPerimeter(t, i, o) * e;
3972
3975
  let d = 0;
3973
3976
  const p = [];
3974
3977
  let y = s[0], m = s[0];
@@ -3987,27 +3990,27 @@ class ci {
3987
3990
  if (w ? C = this.getBezierLength(v.x, v.y, v.out_x ?? v.x, v.out_y ?? v.y, S.in_x ?? S.x, S.in_y ?? S.y, S.x, S.y) : C = Math.sqrt((S.x - v.x) ** 2 + (S.y - v.y) ** 2), d + C >= h || b === p[p.length - 1]) {
3988
3991
  let I = 0;
3989
3992
  if (w)
3990
- return I = this.getBezierTAtLength(h - d, v.x, v.y, v.out_x ?? v.x, v.out_y ?? v.y, S.in_x ?? S.x, S.in_y ?? S.y, S.x, S.y, 20), this.getBezierPointAndAngle(I, v, S, c, f);
3993
+ return I = this.getBezierTAtLength(h - d, v.x, v.y, v.out_x ?? v.x, v.out_y ?? v.y, S.in_x ?? S.x, S.in_y ?? S.y, S.x, S.y, 20), this.getBezierPointAndAngle(I, v, S, l, f);
3991
3994
  {
3992
3995
  I = C === 0 ? 0 : (h - d) / C;
3993
- const M = v.x + (S.x - v.x) * I - c, k = v.y + (S.y - v.y) * I - f, T = Math.atan2(S.y - v.y, S.x - v.x);
3996
+ const M = v.x + (S.x - v.x) * I - l, k = v.y + (S.y - v.y) * I - f, T = Math.atan2(S.y - v.y, S.x - v.x);
3994
3997
  return { x: M, y: k, angle: T };
3995
3998
  }
3996
3999
  }
3997
4000
  d += C;
3998
4001
  }
3999
4002
  } else if (t.type === "Ellipse") {
4000
- const s = Math.abs(i) / 2, n = Math.abs(o) / 2, a = t.sweepAngle ?? 360, l = ((t.startAngle ?? 0) + a * e) * Math.PI / 180, c = s * Math.cos(l), f = n * Math.sin(l), u = -s * Math.sin(l), h = n * Math.cos(l), d = Math.atan2(h, u);
4001
- return { x: c, y: f, angle: d };
4003
+ const s = Math.abs(i) / 2, n = Math.abs(o) / 2, a = t.sweepAngle ?? 360, c = ((t.startAngle ?? 0) + a * e) * Math.PI / 180, l = s * Math.cos(c), f = n * Math.sin(c), u = -s * Math.sin(c), h = n * Math.cos(c), d = Math.atan2(h, u);
4004
+ return { x: l, y: f, angle: d };
4002
4005
  } else if ((t == null ? void 0 : t.type) === "Rectangle") {
4003
4006
  const s = Math.abs(i), n = Math.abs(o), r = (s + n) * 2 * e;
4004
- let l = 0, c = 0, f = 0;
4005
- return r < s ? (l = -s / 2 + r, c = -n / 2, f = 0) : r < s + n ? (l = s / 2, c = -n / 2 + (r - s), f = Math.PI / 2) : r < 2 * s + n ? (l = s / 2 - (r - (s + n)), c = n / 2, f = Math.PI) : (l = -s / 2, c = n / 2 - (r - (2 * s + n)), f = -Math.PI / 2), { x: l, y: c, angle: f };
4007
+ let c = 0, l = 0, f = 0;
4008
+ return r < s ? (c = -s / 2 + r, l = -n / 2, f = 0) : r < s + n ? (c = s / 2, l = -n / 2 + (r - s), f = Math.PI / 2) : r < 2 * s + n ? (c = s / 2 - (r - (s + n)), l = n / 2, f = Math.PI) : (c = -s / 2, l = n / 2 - (r - (2 * s + n)), f = -Math.PI / 2), { x: c, y: l, angle: f };
4006
4009
  }
4007
4010
  return { x: 0, y: 0, angle: 0 };
4008
4011
  }
4009
4012
  getBezierPointAndAngle(t, i, o, e, s) {
4010
- const n = i.x, a = i.y, r = i.out_x ?? i.x, l = i.out_y ?? i.y, c = o.in_x ?? o.x, f = o.in_y ?? o.y, u = o.x, h = o.y, d = 1 - t, p = t * t, y = d * d, m = y * d, b = p * t, v = m * n + 3 * y * t * r + 3 * d * p * c + b * u - e, S = m * a + 3 * y * t * l + 3 * d * p * f + b * h - s, C = 3 * y * (r - n) + 6 * d * t * (c - r) + 3 * p * (u - c), w = 3 * y * (l - a) + 6 * d * t * (f - l) + 3 * p * (h - f), I = Math.atan2(w, C);
4013
+ const n = i.x, a = i.y, r = i.out_x ?? i.x, c = i.out_y ?? i.y, l = o.in_x ?? o.x, f = o.in_y ?? o.y, u = o.x, h = o.y, d = 1 - t, p = t * t, y = d * d, m = y * d, b = p * t, v = m * n + 3 * y * t * r + 3 * d * p * l + b * u - e, S = m * a + 3 * y * t * c + 3 * d * p * f + b * h - s, C = 3 * y * (r - n) + 6 * d * t * (l - r) + 3 * p * (u - l), w = 3 * y * (c - a) + 6 * d * t * (f - c) + 3 * p * (h - f), I = Math.atan2(w, C);
4011
4014
  return { x: v, y: S, angle: I };
4012
4015
  }
4013
4016
  applyAbsoluteTransform(t, i, o) {
@@ -4034,50 +4037,50 @@ class ci {
4034
4037
  var h, d, p, y, m;
4035
4038
  const a = this.objectStates.get(i.id), r = ((h = a == null ? void 0 : a.style) == null ? void 0 : h.artEffect) || i.artEffect || ((d = i.style) == null ? void 0 : d.artEffect);
4036
4039
  if (!r || !r.enabled) return;
4037
- const l = r.type, c = r.intensity ?? 0.5, f = r.speed ?? 1, u = r.scale ?? 10;
4038
- if (l === "acid_gradient" || l === "acid_rave" || l === "shimmer" || l === "glint_overlay" || l === "halftone" || l === "noise" || l === "scanlines" || l === "chromatic_aberration" || l === "pixelate" || l === "glitch" || l === "fold_overlay" || l === "crumple_overlay") {
4039
- if (t.save(), this.applyPath(t, o, e, s, n), t.clip(), l === "shimmer") {
4040
+ const c = r.type, l = r.intensity ?? 0.5, f = r.speed ?? 1, u = r.scale ?? 10;
4041
+ if (c === "acid_gradient" || c === "acid_rave" || c === "shimmer" || c === "glint_overlay" || c === "halftone" || c === "noise" || c === "scanlines" || c === "chromatic_aberration" || c === "pixelate" || c === "glitch" || c === "fold_overlay" || c === "crumple_overlay") {
4042
+ if (t.save(), this.applyPath(t, o, e, s, n), t.clip(), c === "shimmer") {
4040
4043
  const v = this.currentTime * f % 2 / 2, S = t.createLinearGradient(-e, -s, e, s);
4041
- S.addColorStop(Math.max(0, v - 0.2), "rgba(255,255,255,0)"), S.addColorStop(v, `rgba(255,255,255,${c * 0.8})`), S.addColorStop(Math.min(1, v + 0.2), "rgba(255,255,255,0)"), t.fillStyle = S, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -s / 2, e, s), t.globalCompositeOperation = "source-over";
4042
- } else if (l === "glint_overlay") {
4044
+ S.addColorStop(Math.max(0, v - 0.2), "rgba(255,255,255,0)"), S.addColorStop(v, `rgba(255,255,255,${l * 0.8})`), S.addColorStop(Math.min(1, v + 0.2), "rgba(255,255,255,0)"), t.fillStyle = S, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -s / 2, e, s), t.globalCompositeOperation = "source-over";
4045
+ } else if (c === "glint_overlay") {
4043
4046
  let S = ((this._lastPointerPos || { x: 0 }).x - (((p = i.transform) == null ? void 0 : p.x) ?? 0) + 300) / 600;
4044
4047
  S = Math.max(-0.2, Math.min(1.2, S));
4045
4048
  const C = t.createLinearGradient(-e, -s, e, s);
4046
- C.addColorStop(Math.max(0, S - 0.15), "rgba(255,255,255,0)"), C.addColorStop(Math.max(0, Math.min(1, S)), `rgba(255,255,255,${c})`), C.addColorStop(Math.min(1, S + 0.15), "rgba(255,255,255,0)"), t.fillStyle = C, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -s / 2, e, s), t.globalCompositeOperation = "source-over";
4047
- } else if (l === "fold_overlay") {
4049
+ C.addColorStop(Math.max(0, S - 0.15), "rgba(255,255,255,0)"), C.addColorStop(Math.max(0, Math.min(1, S)), `rgba(255,255,255,${l})`), C.addColorStop(Math.min(1, S + 0.15), "rgba(255,255,255,0)"), t.fillStyle = C, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -s / 2, e, s), t.globalCompositeOperation = "source-over";
4050
+ } else if (c === "fold_overlay") {
4048
4051
  const b = this._lastPointerPos || { x: 0, y: 0 }, v = b.x - (((y = i.transform) == null ? void 0 : y.x) ?? 0), S = b.y - (((m = i.transform) == null ? void 0 : m.y) ?? 0), C = t.createLinearGradient(v > 0 ? -e / 2 : e / 2, S > 0 ? -s / 2 : s / 2, v > 0 ? e / 2 : -e / 2, S > 0 ? s / 2 : -s / 2);
4049
- C.addColorStop(0, `rgba(0,0,0,${c * 0.6})`), C.addColorStop(0.4, "rgba(0,0,0,0)"), C.addColorStop(0.5, `rgba(255,255,255,${c * 0.4})`), C.addColorStop(1, `rgba(0,0,0,${c * 0.2})`), t.fillStyle = C, t.globalCompositeOperation = "overlay", t.fillRect(-e / 2, -s / 2, e, s), t.globalCompositeOperation = "source-over", t.beginPath(), v > 0 && S > 0 ? (t.moveTo(e / 2 - 40, s / 2), t.lineTo(e / 2, s / 2 - 40), t.lineTo(e / 2 - 40, s / 2 - 40)) : v < 0 && S > 0 ? (t.moveTo(-e / 2 + 40, s / 2), t.lineTo(-e / 2, s / 2 - 40), t.lineTo(-e / 2 + 40, s / 2 - 40)) : v > 0 && S < 0 ? (t.moveTo(e / 2 - 40, -s / 2), t.lineTo(e / 2, -s / 2 + 40), t.lineTo(e / 2 - 40, -s / 2 + 40)) : (t.moveTo(-e / 2 + 40, -s / 2), t.lineTo(-e / 2, -s / 2 + 40), t.lineTo(-e / 2 + 40, -s / 2 + 40)), t.closePath(), t.fillStyle = "#ffffff", t.shadowColor = "rgba(0,0,0,0.5)", t.shadowBlur = 10, t.shadowOffsetX = v > 0 ? -2 : 2, t.shadowOffsetY = S > 0 ? -2 : 2, t.fill();
4050
- } else if (l === "crumple_overlay") {
4052
+ C.addColorStop(0, `rgba(0,0,0,${l * 0.6})`), C.addColorStop(0.4, "rgba(0,0,0,0)"), C.addColorStop(0.5, `rgba(255,255,255,${l * 0.4})`), C.addColorStop(1, `rgba(0,0,0,${l * 0.2})`), t.fillStyle = C, t.globalCompositeOperation = "overlay", t.fillRect(-e / 2, -s / 2, e, s), t.globalCompositeOperation = "source-over", t.beginPath(), v > 0 && S > 0 ? (t.moveTo(e / 2 - 40, s / 2), t.lineTo(e / 2, s / 2 - 40), t.lineTo(e / 2 - 40, s / 2 - 40)) : v < 0 && S > 0 ? (t.moveTo(-e / 2 + 40, s / 2), t.lineTo(-e / 2, s / 2 - 40), t.lineTo(-e / 2 + 40, s / 2 - 40)) : v > 0 && S < 0 ? (t.moveTo(e / 2 - 40, -s / 2), t.lineTo(e / 2, -s / 2 + 40), t.lineTo(e / 2 - 40, -s / 2 + 40)) : (t.moveTo(-e / 2 + 40, -s / 2), t.lineTo(-e / 2, -s / 2 + 40), t.lineTo(-e / 2 + 40, -s / 2 + 40)), t.closePath(), t.fillStyle = "#ffffff", t.shadowColor = "rgba(0,0,0,0.5)", t.shadowBlur = 10, t.shadowOffsetX = v > 0 ? -2 : 2, t.shadowOffsetY = S > 0 ? -2 : 2, t.fill();
4053
+ } else if (c === "crumple_overlay") {
4051
4054
  const b = Math.floor(e / u), v = document.createElement("canvas");
4052
4055
  v.width = b, v.height = Math.floor(s / u);
4053
4056
  const S = v.getContext("2d"), C = S.createImageData(v.width, v.height);
4054
4057
  for (let w = 0; w < C.data.length; w += 4) {
4055
4058
  const I = Math.random() > 0.95 ? 150 : 255;
4056
- C.data[w] = I, C.data[w + 1] = I, C.data[w + 2] = I, C.data[w + 3] = 255 * c;
4059
+ C.data[w] = I, C.data[w + 1] = I, C.data[w + 2] = I, C.data[w + 3] = 255 * l;
4057
4060
  }
4058
4061
  S.putImageData(C, 0, 0), t.globalCompositeOperation = "multiply", t.imageSmoothingEnabled = !1, t.drawImage(v, -e / 2, -s / 2, e, s);
4059
- } else if (l === "acid_gradient" || l === "acid_rave") {
4062
+ } else if (c === "acid_gradient" || c === "acid_rave") {
4060
4063
  const b = this.currentTime * f, v = r.color1, S = r.color2, C = t.createLinearGradient(-e / 2, -s / 2, e / 2, s / 2);
4061
4064
  if (v && S) {
4062
4065
  const w = b * 60 % 360;
4063
- C.addColorStop(0, this._shiftHue(v, w, c * 0.7)), C.addColorStop(1, this._shiftHue(S, (w + 180) % 360, c * 0.7));
4066
+ C.addColorStop(0, this._shiftHue(v, w, l * 0.7)), C.addColorStop(1, this._shiftHue(S, (w + 180) % 360, l * 0.7));
4064
4067
  } else {
4065
4068
  const w = b * 100 % 360, I = (w + 180) % 360;
4066
- C.addColorStop(0, `hsla(${w}, 80%, 50%, ${c * 0.5})`), C.addColorStop(1, `hsla(${I}, 80%, 50%, ${c * 0.5})`);
4069
+ C.addColorStop(0, `hsla(${w}, 80%, 50%, ${l * 0.5})`), C.addColorStop(1, `hsla(${I}, 80%, 50%, ${l * 0.5})`);
4067
4070
  }
4068
4071
  t.fillStyle = C, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -s / 2, e, s);
4069
- } else if (l === "halftone") {
4070
- const b = Math.max(2, u * (1 - c * 0.8)), v = document.createElement("canvas");
4072
+ } else if (c === "halftone") {
4073
+ const b = Math.max(2, u * (1 - l * 0.8)), v = document.createElement("canvas");
4071
4074
  v.width = b, v.height = b;
4072
4075
  const S = v.getContext("2d");
4073
4076
  if (S) {
4074
- S.fillStyle = "black", S.beginPath(), S.arc(b / 2, b / 2, b / 2 * c, 0, Math.PI * 2), S.fill();
4077
+ S.fillStyle = "black", S.beginPath(), S.arc(b / 2, b / 2, b / 2 * l, 0, Math.PI * 2), S.fill();
4075
4078
  const C = t.createPattern(v, "repeat");
4076
- C && (t.globalAlpha = 0.3 * c, t.fillStyle = C, t.fillRect(-e / 2, -s / 2, e, s));
4079
+ C && (t.globalAlpha = 0.3 * l, t.fillStyle = C, t.fillRect(-e / 2, -s / 2, e, s));
4077
4080
  }
4078
- } else if (l === "noise") {
4079
- const b = Math.floor(e * s * c * 0.02);
4080
- t.globalAlpha = 0.4 * c;
4081
+ } else if (c === "noise") {
4082
+ const b = Math.floor(e * s * l * 0.02);
4083
+ t.globalAlpha = 0.4 * l;
4081
4084
  for (let v = 0; v < b; v++) {
4082
4085
  const S = Math.random() > 0.5 ? 255 : 0;
4083
4086
  t.fillStyle = `rgba(${S}, ${S}, ${S}, ${0.5 + Math.random() * 0.5})`, t.fillRect(
@@ -4087,15 +4090,15 @@ class ci {
4087
4090
  2
4088
4091
  );
4089
4092
  }
4090
- } else if (l === "scanlines") {
4091
- t.globalAlpha = 0.2 * c, t.strokeStyle = "rgba(0,0,0,0.5)", t.lineWidth = 1;
4093
+ } else if (c === "scanlines") {
4094
+ t.globalAlpha = 0.2 * l, t.strokeStyle = "rgba(0,0,0,0.5)", t.lineWidth = 1;
4092
4095
  for (let b = -s / 2; b < s / 2; b += 4)
4093
4096
  t.beginPath(), t.moveTo(-e / 2, b), t.lineTo(e / 2, b), t.stroke();
4094
- } else if (l === "chromatic_aberration") {
4095
- const b = 5 * c;
4097
+ } else if (c === "chromatic_aberration") {
4098
+ const b = 5 * l;
4096
4099
  t.globalCompositeOperation = "screen", t.globalAlpha = 0.5, t.fillStyle = "cyan", t.fillRect(-e / 2 - b, -s / 2, e, s), t.fillStyle = "magenta", t.fillRect(-e / 2 + b, -s / 2, e, s);
4097
- } else if (l === "pixelate") {
4098
- const b = Math.max(2, Math.round(u * (1 - c * 0.5))), v = document.createElement("canvas"), S = Math.max(1, Math.ceil(e / b)), C = Math.max(1, Math.ceil(s / b));
4100
+ } else if (c === "pixelate") {
4101
+ const b = Math.max(2, Math.round(u * (1 - l * 0.5))), v = document.createElement("canvas"), S = Math.max(1, Math.ceil(e / b)), C = Math.max(1, Math.ceil(s / b));
4099
4102
  v.width = S, v.height = C;
4100
4103
  const w = v.getContext("2d");
4101
4104
  if (w) {
@@ -4103,17 +4106,17 @@ class ci {
4103
4106
  const I = t.getTransform(), M = I.e - e / 2, k = I.f - s / 2;
4104
4107
  w.drawImage(t.canvas, M, k, e, s, 0, 0, S, C), t.imageSmoothingEnabled = !1, t.drawImage(v, 0, 0, S, C, -e / 2, -s / 2, e, s), t.imageSmoothingEnabled = !0;
4105
4108
  }
4106
- } else if (l === "glitch") {
4107
- const b = this.currentTime * f, v = r.chaosAmount ?? 0.2, S = Math.max(3, Math.floor(8 * c)), C = c * e * 0.15;
4108
- t.globalCompositeOperation = "screen", t.globalAlpha = c * 0.4;
4109
+ } else if (c === "glitch") {
4110
+ const b = this.currentTime * f, v = r.chaosAmount ?? 0.2, S = Math.max(3, Math.floor(8 * l)), C = l * e * 0.15;
4111
+ t.globalCompositeOperation = "screen", t.globalAlpha = l * 0.4;
4109
4112
  const w = C * 0.3;
4110
4113
  t.fillStyle = "rgba(255, 0, 0, 0.4)", t.fillRect(-e / 2 + w, -s / 2, e, s), t.fillStyle = "rgba(0, 255, 255, 0.4)", t.fillRect(-e / 2 - w, -s / 2, e, s), t.globalCompositeOperation = "source-over", t.globalAlpha = 1;
4111
4114
  const I = s / S;
4112
4115
  for (let M = 0; M < S; M++) {
4113
4116
  const k = Math.sin(M * 127.1 + b * 311.7 * f) * 43758.5, T = k - Math.floor(k);
4114
4117
  if (T > 1 - v) {
4115
- const R = (T - (1 - v)) / v * C * (Math.random() > 0.5 ? 1 : -1), P = -s / 2 + M * I, E = t.getTransform(), x = E.e - e / 2 + R, O = E.f + P;
4116
- t.save(), t.beginPath(), t.rect(-e / 2, P, e, I), t.clip(), t.globalAlpha = 0.8, t.drawImage(t.canvas, x, O, e, I, -e / 2 + R, P, e, I), t.restore();
4118
+ const x = (T - (1 - v)) / v * C * (Math.random() > 0.5 ? 1 : -1), P = -s / 2 + M * I, E = t.getTransform(), R = E.e - e / 2 + x, O = E.f + P;
4119
+ t.save(), t.beginPath(), t.rect(-e / 2, P, e, I), t.clip(), t.globalAlpha = 0.8, t.drawImage(t.canvas, R, O, e, I, -e / 2 + x, P, e, I), t.restore();
4117
4120
  }
4118
4121
  }
4119
4122
  }
@@ -4128,22 +4131,22 @@ class ci {
4128
4131
  e = parseInt(h.substring(0, 2), 16) / 255, s = parseInt(h.substring(2, 4), 16) / 255, n = parseInt(h.substring(4, 6), 16) / 255;
4129
4132
  }
4130
4133
  const a = Math.max(e, s, n), r = Math.min(e, s, n);
4131
- let l = 0, c = 0, f = (a + r) / 2;
4134
+ let c = 0, l = 0, f = (a + r) / 2;
4132
4135
  if (a !== r) {
4133
4136
  const h = a - r;
4134
- switch (c = f > 0.5 ? h / (2 - a - r) : h / (a + r), a) {
4137
+ switch (l = f > 0.5 ? h / (2 - a - r) : h / (a + r), a) {
4135
4138
  case e:
4136
- l = ((s - n) / h + (s < n ? 6 : 0)) / 6;
4139
+ c = ((s - n) / h + (s < n ? 6 : 0)) / 6;
4137
4140
  break;
4138
4141
  case s:
4139
- l = ((n - e) / h + 2) / 6;
4142
+ c = ((n - e) / h + 2) / 6;
4140
4143
  break;
4141
4144
  case n:
4142
- l = ((e - s) / h + 4) / 6;
4145
+ c = ((e - s) / h + 4) / 6;
4143
4146
  break;
4144
4147
  }
4145
4148
  }
4146
- return `hsla(${(((l * 360 + i) % 360 + 360) % 360).toFixed(0)}, ${(c * 100).toFixed(0)}%, ${(f * 100).toFixed(0)}%, ${o})`;
4149
+ return `hsla(${(((c * 360 + i) % 360 + 360) % 360).toFixed(0)}, ${(l * 100).toFixed(0)}%, ${(f * 100).toFixed(0)}%, ${o})`;
4147
4150
  }
4148
4151
  /**
4149
4152
  * Simulate CSS `backdrop-filter: blur()` + glass overlay on Canvas2D.
@@ -4154,7 +4157,7 @@ class ci {
4154
4157
  * 4. Apply the overlay color tint, sheen highlight, noise grain, and glass border
4155
4158
  */
4156
4159
  applyBackgroundBlurGlass(t, i, o, e, s, n) {
4157
- const a = n.radius ?? 10, r = n.color ?? "rgba(255,255,255,0.2)", l = n.opacity ?? 0.5, c = n.noise ?? 0;
4160
+ const a = n.radius ?? 10, r = n.color ?? "rgba(255,255,255,0.2)", c = n.opacity ?? 0.5, l = n.noise ?? 0;
4158
4161
  t.save(), this.applyPath(t, i, o, e, s), t.clip();
4159
4162
  const f = t.getTransform(), u = f.e - o / 2, h = f.f - e / 2;
4160
4163
  try {
@@ -4170,10 +4173,10 @@ class ci {
4170
4173
  }
4171
4174
  } catch {
4172
4175
  }
4173
- t.globalCompositeOperation = "source-over", t.globalAlpha = l, t.fillStyle = r, t.fillRect(-o / 2, -e / 2, o, e), t.globalAlpha = 1, t.globalCompositeOperation = "source-atop";
4176
+ t.globalCompositeOperation = "source-over", t.globalAlpha = c, t.fillStyle = r, t.fillRect(-o / 2, -e / 2, o, e), t.globalAlpha = 1, t.globalCompositeOperation = "source-atop";
4174
4177
  const d = t.createLinearGradient(-o / 2, -e / 2, o / 2, e / 2);
4175
- if (d.addColorStop(0, "rgba(255,255,255,0.12)"), d.addColorStop(0.3, "rgba(255,255,255,0.04)"), d.addColorStop(0.5, "rgba(255,255,255,0.0)"), d.addColorStop(1, "rgba(255,255,255,0.0)"), t.fillStyle = d, t.fillRect(-o / 2, -e / 2, o, e), c > 0) {
4176
- if (t.globalAlpha = c / 100, !this._noiseTileCanvas) {
4178
+ if (d.addColorStop(0, "rgba(255,255,255,0.12)"), d.addColorStop(0.3, "rgba(255,255,255,0.04)"), d.addColorStop(0.5, "rgba(255,255,255,0.0)"), d.addColorStop(1, "rgba(255,255,255,0.0)"), t.fillStyle = d, t.fillRect(-o / 2, -e / 2, o, e), l > 0) {
4179
+ if (t.globalAlpha = l / 100, !this._noiseTileCanvas) {
4177
4180
  const y = document.createElement("canvas");
4178
4181
  y.width = 64, y.height = 64;
4179
4182
  const m = y.getContext("2d"), b = m.createImageData(64, 64), v = b.data;
@@ -4199,76 +4202,76 @@ class ci {
4199
4202
  } else if (i.type === "Line")
4200
4203
  t.moveTo(-o / 2, 0), t.lineTo(o / 2, 0);
4201
4204
  else if (i.type === "Ellipse") {
4202
- const { startAngle: n = 0, sweepAngle: a = 360, ratio: r = 0 } = i, l = o / 2, c = e / 2, f = n * Math.PI / 180, u = a * Math.PI / 180, h = f + u;
4203
- a >= 360 && r <= 0 ? t.ellipse(0, 0, l, c, 0, 0, Math.PI * 2) : (t.ellipse(0, 0, l, c, 0, f, h, !1), r > 0 ? t.ellipse(0, 0, l * r, c * r, 0, h, f, !0) : t.lineTo(0, 0), t.closePath());
4205
+ const { startAngle: n = 0, sweepAngle: a = 360, ratio: r = 0 } = i, c = o / 2, l = e / 2, f = n * Math.PI / 180, u = a * Math.PI / 180, h = f + u;
4206
+ a >= 360 && r <= 0 ? t.ellipse(0, 0, c, l, 0, 0, Math.PI * 2) : (t.ellipse(0, 0, c, l, 0, f, h, !1), r > 0 ? t.ellipse(0, 0, c * r, l * r, 0, h, f, !0) : t.lineTo(0, 0), t.closePath());
4204
4207
  } else if (i.type === "Triangle")
4205
4208
  t.moveTo(0, -e / 2), t.lineTo(o / 2, e / 2), t.lineTo(-o / 2, e / 2), t.closePath();
4206
4209
  else if (i.type === "Polygon") {
4207
4210
  const n = i.sides || 3, a = i.radius || Math.min(o, e) / 2;
4208
4211
  for (let r = 0; r < n; r++) {
4209
- const l = r * 2 * Math.PI / n - Math.PI / 2, c = a * Math.cos(l), f = a * Math.sin(l);
4210
- r === 0 ? t.moveTo(c, f) : t.lineTo(c, f);
4212
+ const c = r * 2 * Math.PI / n - Math.PI / 2, l = a * Math.cos(c), f = a * Math.sin(c);
4213
+ r === 0 ? t.moveTo(l, f) : t.lineTo(l, f);
4211
4214
  }
4212
4215
  t.closePath();
4213
4216
  } else if (i.type === "Star") {
4214
4217
  const n = i.points || 5, a = i.outer_radius || Math.min(o, e) / 2;
4215
4218
  let r = i.inner_radius;
4216
4219
  r == null ? r = a * 0.382 : r <= 1 && (r = a * r);
4217
- for (let l = 0; l < n * 2; l++) {
4218
- const c = l * Math.PI / n - Math.PI / 2, f = l % 2 === 0 ? a : r, u = f * Math.cos(c), h = f * Math.sin(c);
4219
- l === 0 ? t.moveTo(u, h) : t.lineTo(u, h);
4220
+ for (let c = 0; c < n * 2; c++) {
4221
+ const l = c * Math.PI / n - Math.PI / 2, f = c % 2 === 0 ? a : r, u = f * Math.cos(l), h = f * Math.sin(l);
4222
+ c === 0 ? t.moveTo(u, h) : t.lineTo(u, h);
4220
4223
  }
4221
4224
  t.closePath();
4222
4225
  } else if (((i == null ? void 0 : i.type) === "Path" || i.type === "Subtract" || i.type === "Union" || i.type === "Intersect" || i.type === "Exclude" || i.type === "BooleanOperation") && i.points) {
4223
4226
  this.frameCount % 300 === 0 && this.log("[Engine] Tracing Path:", i.points.length, "points");
4224
- let n = 1 / 0, a = -1 / 0, r = 1 / 0, l = -1 / 0;
4227
+ let n = 1 / 0, a = -1 / 0, r = 1 / 0, c = -1 / 0;
4225
4228
  if (i.points.forEach((u) => {
4226
- typeof u.x == "number" && typeof u.y == "number" && (n = Math.min(n, u.x), a = Math.max(a, u.x), r = Math.min(r, u.y), l = Math.max(l, u.y), u.out_x !== void 0 && (n = Math.min(n, u.out_x), a = Math.max(a, u.out_x)), u.out_y !== void 0 && (r = Math.min(r, u.out_y), l = Math.max(l, u.out_y)), u.in_x !== void 0 && (n = Math.min(n, u.in_x), a = Math.max(a, u.in_x)), u.in_y !== void 0 && (r = Math.min(r, u.in_y), l = Math.max(l, u.in_y)));
4229
+ typeof u.x == "number" && typeof u.y == "number" && (n = Math.min(n, u.x), a = Math.max(a, u.x), r = Math.min(r, u.y), c = Math.max(c, u.y), u.out_x !== void 0 && (n = Math.min(n, u.out_x), a = Math.max(a, u.out_x)), u.out_y !== void 0 && (r = Math.min(r, u.out_y), c = Math.max(c, u.out_y)), u.in_x !== void 0 && (n = Math.min(n, u.in_x), a = Math.max(a, u.in_x)), u.in_y !== void 0 && (r = Math.min(r, u.in_y), c = Math.max(c, u.in_y)));
4227
4230
  }), n === 1 / 0) return;
4228
- const c = (n + a) / 2, f = (r + l) / 2;
4229
- if (isNaN(c) || isNaN(f)) {
4230
- this.warn("[Engine] Invalid path center:", c, f);
4231
+ const l = (n + a) / 2, f = (r + c) / 2;
4232
+ if (isNaN(l) || isNaN(f)) {
4233
+ this.warn("[Engine] Invalid path center:", l, f);
4231
4234
  return;
4232
4235
  }
4233
4236
  i.points.forEach((u, h) => {
4234
4237
  if (h === 0 || u.moveTo)
4235
- t.moveTo(u.x - c, u.y - f);
4238
+ t.moveTo(u.x - l, u.y - f);
4236
4239
  else {
4237
4240
  const d = i.points[h - 1];
4238
4241
  if (!d) return;
4239
- const p = (d.out_x ?? d.x) - c, y = (d.out_y ?? d.y) - f, m = (u.in_x ?? u.x) - c, b = (u.in_y ?? u.y) - f;
4240
- isNaN(p) || isNaN(m) || isNaN(u.x) ? t.lineTo(u.x - c, u.y - f) : t.bezierCurveTo(p, y, m, b, u.x - c, u.y - f);
4242
+ const p = (d.out_x ?? d.x) - l, y = (d.out_y ?? d.y) - f, m = (u.in_x ?? u.x) - l, b = (u.in_y ?? u.y) - f;
4243
+ isNaN(p) || isNaN(m) || isNaN(u.x) ? t.lineTo(u.x - l, u.y - f) : t.bezierCurveTo(p, y, m, b, u.x - l, u.y - f);
4241
4244
  }
4242
4245
  if (u.closePath || h === i.points.length - 1 && (i.is_closed || i.isClosed)) {
4243
4246
  const d = [...i.points.slice(0, h + 1)].reverse().find((p) => p.moveTo) || i.points[0];
4244
4247
  d && (u.out_x !== void 0 || d.in_x !== void 0) && t.bezierCurveTo(
4245
- (u.out_x ?? u.x) - c,
4248
+ (u.out_x ?? u.x) - l,
4246
4249
  (u.out_y ?? u.y) - f,
4247
- (d.in_x ?? d.x) - c,
4250
+ (d.in_x ?? d.x) - l,
4248
4251
  (d.in_y ?? d.y) - f,
4249
- d.x - c,
4252
+ d.x - l,
4250
4253
  d.y - f
4251
4254
  ), t.closePath();
4252
4255
  }
4253
4256
  });
4254
4257
  } else if (i.points && Array.isArray(i.points)) {
4255
- let n = 1 / 0, a = -1 / 0, r = 1 / 0, l = -1 / 0;
4258
+ let n = 1 / 0, a = -1 / 0, r = 1 / 0, c = -1 / 0;
4256
4259
  i.points.forEach((u) => {
4257
- n = Math.min(n, u.x), a = Math.max(a, u.x), r = Math.min(r, u.y), l = Math.max(l, u.y);
4260
+ n = Math.min(n, u.x), a = Math.max(a, u.x), r = Math.min(r, u.y), c = Math.max(c, u.y);
4258
4261
  });
4259
- const c = (n + a) / 2, f = (r + l) / 2;
4262
+ const l = (n + a) / 2, f = (r + c) / 2;
4260
4263
  i.points.forEach((u, h) => {
4261
- if (h === 0) t.moveTo(u.x - c, u.y - f);
4264
+ if (h === 0) t.moveTo(u.x - l, u.y - f);
4262
4265
  else {
4263
4266
  const d = i.points[h - 1];
4264
4267
  d.out_x !== void 0 || u.in_x !== void 0 ? t.bezierCurveTo(
4265
- (d.out_x ?? d.x) - c,
4268
+ (d.out_x ?? d.x) - l,
4266
4269
  (d.out_y ?? d.y) - f,
4267
- (u.in_x ?? u.x) - c,
4270
+ (u.in_x ?? u.x) - l,
4268
4271
  (u.in_y ?? u.y) - f,
4269
- u.x - c,
4272
+ u.x - l,
4270
4273
  u.y - f
4271
- ) : t.lineTo(u.x - c, u.y - f);
4274
+ ) : t.lineTo(u.x - l, u.y - f);
4272
4275
  }
4273
4276
  (u.closePath || h === i.points.length - 1 && (i.is_closed || i.isClosed)) && t.closePath();
4274
4277
  });
@@ -4276,76 +4279,76 @@ class ci {
4276
4279
  }
4277
4280
  }
4278
4281
  renderInputBox(t, i) {
4279
- var it, rt;
4280
- const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((it = i.geometry) == null ? void 0 : it.width) || 250, n = ((rt = i.geometry) == null ? void 0 : rt.height) || 45, a = this.focusedId === i.id, r = this.lastHoveredObjectId === i.id, l = e.previewState || "default", c = l !== "default" ? l : a ? "focused" : r ? "hovered" : "default", f = e.label || { visible: !0, text: "Label" }, u = e.helperText || { visible: !1, text: "Helper text" }, h = e.leftIcon || { visible: !1 }, d = e.rightIcon || { visible: !1 }, p = e.multiline === !0, y = e.corner_radius ?? 8, m = e.corners || { tl: y, tr: y, bl: y, br: y }, b = [m.tl, m.tr, m.br, m.bl];
4282
+ var it, lt;
4283
+ const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((it = i.geometry) == null ? void 0 : it.width) || 250, n = ((lt = i.geometry) == null ? void 0 : lt.height) || 45, a = this.focusedId === i.id, r = this.lastHoveredObjectId === i.id, c = e.previewState || "default", l = c !== "default" ? c : a ? "focused" : r ? "hovered" : "default", f = e.label || { visible: !0, text: "Label" }, u = e.helperText || { visible: !1, text: "Helper text" }, h = e.leftIcon || { visible: !1 }, d = e.rightIcon || { visible: !1 }, p = e.multiline === !0, y = e.corner_radius ?? 8, m = e.corners || { tl: y, tr: y, bl: y, br: y }, b = [m.tl, m.tr, m.br, m.bl];
4281
4284
  let v = e.backgroundColor || "rgba(31, 41, 55, 1)", S = e.borderColor || "rgba(55, 65, 81, 1)", C = e.borderWidth ?? 1.5, w = e.color || "#ffffff", I = e.placeholderColor || "rgba(156, 163, 175, 1)", M = e.fontSize || 14;
4282
- const k = `${c}Style`, T = e[k];
4283
- T ? (T.backgroundColor !== void 0 && (v = T.backgroundColor), T.borderColor !== void 0 && (S = T.borderColor), T.borderWidth !== void 0 && (C = T.borderWidth), T.color !== void 0 && (w = T.color), T.placeholderColor !== void 0 && (I = T.placeholderColor), T.fontSize !== void 0 && (M = T.fontSize)) : c === "focused" ? (S = e.focusBorderColor || "rgba(59, 130, 246, 1)", C = Math.max(C, 2)) : c === "hovered" || c === "hover" ? (S = e.hoverBorderColor || S, v = e.hoverBackgroundColor || v) : c === "disabled" ? (v = e.disabledBackgroundColor || "rgba(31, 41, 55, 0.6)", S = e.disabledBorderColor || "rgba(55, 65, 81, 0.4)") : c === "error" && (S = "rgba(239, 68, 68, 1)", C = Math.max(C, 2)), t.beginPath(), this.drawRoundRect(t, -s / 2, -n / 2, s, n, b);
4284
- const R = this.createCanvasFill(t, v, s, n);
4285
- if (R && (t.fillStyle = R, t.fill()), C > 0) {
4285
+ const k = `${l}Style`, T = e[k];
4286
+ T ? (T.backgroundColor !== void 0 && (v = T.backgroundColor), T.borderColor !== void 0 && (S = T.borderColor), T.borderWidth !== void 0 && (C = T.borderWidth), T.color !== void 0 && (w = T.color), T.placeholderColor !== void 0 && (I = T.placeholderColor), T.fontSize !== void 0 && (M = T.fontSize)) : l === "focused" ? (S = e.focusBorderColor || "rgba(59, 130, 246, 1)", C = Math.max(C, 2)) : l === "hovered" || l === "hover" ? (S = e.hoverBorderColor || S, v = e.hoverBackgroundColor || v) : l === "disabled" ? (v = e.disabledBackgroundColor || "rgba(31, 41, 55, 0.6)", S = e.disabledBorderColor || "rgba(55, 65, 81, 0.4)") : l === "error" && (S = "rgba(239, 68, 68, 1)", C = Math.max(C, 2)), t.beginPath(), this.drawRoundRect(t, -s / 2, -n / 2, s, n, b);
4287
+ const x = this.createCanvasFill(t, v, s, n);
4288
+ if (x && (t.fillStyle = x, t.fill()), C > 0) {
4286
4289
  const nt = this.createCanvasFill(t, S, s, n);
4287
- if (nt && (t.strokeStyle = nt, t.lineWidth = C, t.stroke()), c === "focused" || c === "focus") {
4290
+ if (nt && (t.strokeStyle = nt, t.lineWidth = C, t.stroke()), l === "focused" || l === "focus") {
4288
4291
  t.save(), t.beginPath();
4289
- const yt = b.map((ct) => ct + 2);
4290
- this.drawRoundRect(t, -s / 2 - 2, -n / 2 - 2, s + 4, n + 4, yt), t.strokeStyle = "rgba(59, 130, 246, 0.3)", t.lineWidth = 2, t.stroke(), t.restore();
4292
+ const bt = b.map((ht) => ht + 2);
4293
+ this.drawRoundRect(t, -s / 2 - 2, -n / 2 - 2, s + 4, n + 4, bt), t.strokeStyle = "rgba(59, 130, 246, 0.3)", t.lineWidth = 2, t.stroke(), t.restore();
4291
4294
  }
4292
4295
  }
4293
- const P = (nt, yt) => {
4296
+ const P = (nt, bt) => {
4294
4297
  if (!nt.visible || !nt.svgPath) return;
4295
- const ct = nt.size || 14, wt = nt.offset ?? 16, Mt = nt.color || "#ffffff", It = yt ? -(s / 2) + wt : s / 2 - wt, Ot = nt.svgPath;
4298
+ const ht = nt.size || 14, wt = nt.offset ?? 16, Mt = nt.color || "#ffffff", It = bt ? -(s / 2) + wt : s / 2 - wt, Ot = nt.svgPath;
4296
4299
  if (t.save(), t.translate(It, 0), !Ot.startsWith("<svg")) {
4297
- const At = new Path2D(Ot), Tt = ct / 24;
4300
+ const At = new Path2D(Ot), Tt = ht / 24;
4298
4301
  t.scale(Tt, Tt), t.translate(-12, -12), t.fillStyle = Mt, t.fill(At);
4299
4302
  }
4300
4303
  t.restore();
4301
4304
  };
4302
4305
  P(h, !0), P(d, !1);
4303
- const E = e.text || "", x = e.placeholder || "Enter text...", O = !E, W = E || x, B = O ? I : w, $ = M, Y = e.fontFamily || "Inter", H = e.fontWeight || 400;
4306
+ const E = e.text || "", R = e.placeholder || "Enter text...", O = !E, W = E || R, B = O ? I : w, $ = M, Y = e.fontFamily || "Inter", H = e.fontWeight || 400;
4304
4307
  t.font = `${H} ${$}px "${Y}", sans-serif`, t.fillStyle = B, t.textAlign = "left", t.textBaseline = p ? "top" : "middle";
4305
4308
  const K = e.inputPadding ?? 16, A = h.visible ? (h.offset ?? 16) + (h.size || 14) / 2 + 8 : K, _ = d.visible ? (d.offset ?? 16) + (d.size || 14) / 2 + 8 : K, L = -(s / 2) + A, X = s - A - _, V = e.inputType === "password" ? "•".repeat(W.length) : W;
4306
4309
  if (t.save(), t.beginPath(), t.rect(L - 2, -n / 2 + 4, X + 4, n - 8), t.clip(), p) {
4307
4310
  const nt = V.split(`
4308
4311
  `);
4309
- let yt = -n / 2 + K;
4310
- const ct = $ * 1.2;
4312
+ let bt = -n / 2 + K;
4313
+ const ht = $ * 1.2;
4311
4314
  let wt = 0;
4312
4315
  nt.forEach((Mt, It) => {
4313
4316
  const Ot = Mt.split(" ");
4314
4317
  let At = "";
4315
4318
  for (let Tt = 0; Tt < Ot.length; Tt++) {
4316
4319
  const zt = At + Ot[Tt] + " ";
4317
- t.measureText(zt).width > X && Tt > 0 ? (t.fillText(At, L, yt), At = Ot[Tt] + " ", yt += ct) : At = zt;
4320
+ t.measureText(zt).width > X && Tt > 0 ? (t.fillText(At, L, bt), At = Ot[Tt] + " ", bt += ht) : At = zt;
4318
4321
  }
4319
- t.fillText(At, L, yt), wt = t.measureText(At).width, It < nt.length - 1 && (yt += ct, wt = 0);
4320
- }), a && !O && Math.floor(performance.now() / 500) % 2 === 0 && t.fillRect(L + wt, yt, 1.5, $);
4322
+ t.fillText(At, L, bt), wt = t.measureText(At).width, It < nt.length - 1 && (bt += ht, wt = 0);
4323
+ }), a && !O && Math.floor(performance.now() / 500) % 2 === 0 && t.fillRect(L + wt, bt, 1.5, $);
4321
4324
  } else {
4322
- const yt = t.measureText(V).width;
4323
- let ct = 0;
4324
- if (yt > X && (ct = yt - X), t.fillText(V, L - ct, 0), a && !O && Math.floor(performance.now() / 500) % 2 === 0) {
4325
- const Mt = L + yt - ct;
4325
+ const bt = t.measureText(V).width;
4326
+ let ht = 0;
4327
+ if (bt > X && (ht = bt - X), t.fillText(V, L - ht, 0), a && !O && Math.floor(performance.now() / 500) % 2 === 0) {
4328
+ const Mt = L + bt - ht;
4326
4329
  t.fillRect(Mt, -($ / 2), 1.5, $);
4327
4330
  }
4328
4331
  }
4329
4332
  if (t.restore(), f.visible !== !1) {
4330
- const nt = f.text || "Label", yt = f.fontSize || 12, ct = f.color || "rgba(156, 163, 175, 1)", wt = f.offset ?? 8;
4331
- t.font = `600 ${yt}px "${Y}", sans-serif`, t.fillStyle = ct, t.textAlign = "left", t.textBaseline = "bottom";
4333
+ const nt = f.text || "Label", bt = f.fontSize || 12, ht = f.color || "rgba(156, 163, 175, 1)", wt = f.offset ?? 8;
4334
+ t.font = `600 ${bt}px "${Y}", sans-serif`, t.fillStyle = ht, t.textAlign = "left", t.textBaseline = "bottom";
4332
4335
  const Mt = -(s / 2), It = -(n / 2) - wt;
4333
4336
  t.fillText(nt, Mt, It);
4334
4337
  }
4335
4338
  if (u.visible === !0) {
4336
- const nt = u.text || "Helper text", yt = u.fontSize || 11, ct = c === "error" ? "rgba(239, 68, 68, 1)" : u.color || "rgba(156, 163, 175, 1)", wt = u.offset ?? 6;
4337
- t.font = `400 ${yt}px "${Y}", sans-serif`, t.fillStyle = ct, t.textAlign = "left", t.textBaseline = "top";
4339
+ const nt = u.text || "Helper text", bt = u.fontSize || 11, ht = l === "error" ? "rgba(239, 68, 68, 1)" : u.color || "rgba(156, 163, 175, 1)", wt = u.offset ?? 6;
4340
+ t.font = `400 ${bt}px "${Y}", sans-serif`, t.fillStyle = ht, t.textAlign = "left", t.textBaseline = "top";
4338
4341
  const Mt = -(s / 2), It = n / 2 + wt;
4339
4342
  t.fillText(nt, Mt, It);
4340
4343
  }
4341
4344
  }
4342
4345
  renderSlider(t, i) {
4343
- const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.geometry) || i.geometry, s = (o == null ? void 0 : o.options) || i.options || {}, n = e.width || 200, a = s.value ?? 50, r = s.min ?? 0, c = (s.max ?? 100) - r, f = c === 0 ? 0 : (a - r) / c, u = s.trackHeight || 4, h = s.trackRoundedness ?? 2, d = s.trackShape ?? "Rectangle", p = s.trackPath || "", y = s.accentColor || "#3b82f6", m = s.inactiveColor || "#374151", b = s.thumbShape || "Ellipse", v = s.thumbWidth ?? 16, S = s.thumbHeight ?? 16, C = s.thumbRoundedness ?? 0, w = s.thumbColor || "#ffffff", I = s.thumbPath || "", M = s.thumbIcon || "", k = s.showValueTooltip ?? !1, T = s.tooltipBgColor || "#333333", R = s.tooltipColor || "#ffffff", P = s.tooltipOffsetX ?? 0, E = s.tooltipOffsetY ?? -25, x = (X, V, it, rt, nt, yt, ct) => {
4344
- if ((X === "Custom" || X === "Icon") && ct)
4346
+ const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.geometry) || i.geometry, s = (o == null ? void 0 : o.options) || i.options || {}, n = e.width || 200, a = s.value ?? 50, r = s.min ?? 0, l = (s.max ?? 100) - r, f = l === 0 ? 0 : (a - r) / l, u = s.trackHeight || 4, h = s.trackRoundedness ?? 2, d = s.trackShape ?? "Rectangle", p = s.trackPath || "", y = s.accentColor || "#3b82f6", m = s.inactiveColor || "#374151", b = s.thumbShape || "Ellipse", v = s.thumbWidth ?? 16, S = s.thumbHeight ?? 16, C = s.thumbRoundedness ?? 0, w = s.thumbColor || "#ffffff", I = s.thumbPath || "", M = s.thumbIcon || "", k = s.showValueTooltip ?? !1, T = s.tooltipBgColor || "#333333", x = s.tooltipColor || "#ffffff", P = s.tooltipOffsetX ?? 0, E = s.tooltipOffsetY ?? -25, R = (X, V, it, lt, nt, bt, ht) => {
4347
+ if ((X === "Custom" || X === "Icon") && ht)
4345
4348
  try {
4346
- const wt = new Path2D(ct);
4349
+ const wt = new Path2D(ht);
4347
4350
  if (t.save(), t.translate(V, it), X === "Icon") {
4348
- const Mt = Math.min(rt, nt) / 24;
4351
+ const Mt = Math.min(lt, nt) / 24;
4349
4352
  t.scale(Mt, Mt), t.translate(-12, -12);
4350
4353
  }
4351
4354
  t.fill(wt), t.restore();
@@ -4354,31 +4357,31 @@ class ci {
4354
4357
  console.error("Error drawing slider shape in engine:", wt);
4355
4358
  }
4356
4359
  if (t.beginPath(), X === "Ellipse")
4357
- t.ellipse(V, it, rt / 2, nt / 2, 0, 0, Math.PI * 2);
4360
+ t.ellipse(V, it, lt / 2, nt / 2, 0, 0, Math.PI * 2);
4358
4361
  else if (X === "Rectangle")
4359
- this.drawRoundRect(t, V - rt / 2, it - nt / 2, rt, nt, yt);
4362
+ this.drawRoundRect(t, V - lt / 2, it - nt / 2, lt, nt, bt);
4360
4363
  else if (X === "Triangle")
4361
- t.moveTo(V, it - nt / 2), t.lineTo(V + rt / 2, it + nt / 2), t.lineTo(V - rt / 2, it + nt / 2), t.closePath();
4364
+ t.moveTo(V, it - nt / 2), t.lineTo(V + lt / 2, it + nt / 2), t.lineTo(V - lt / 2, it + nt / 2), t.closePath();
4362
4365
  else if (X === "Diamond")
4363
- t.moveTo(V, it - nt / 2), t.lineTo(V + rt / 2, it), t.lineTo(V, it + nt / 2), t.lineTo(V - rt / 2, it), t.closePath();
4366
+ t.moveTo(V, it - nt / 2), t.lineTo(V + lt / 2, it), t.lineTo(V, it + nt / 2), t.lineTo(V - lt / 2, it), t.closePath();
4364
4367
  else if (X === "Polygon") {
4365
- const wt = i.geometry.sides || 3, Mt = i.geometry.radius || Math.min(rt, nt) / 2;
4368
+ const wt = i.geometry.sides || 3, Mt = i.geometry.radius || Math.min(lt, nt) / 2;
4366
4369
  for (let It = 0; It < wt; It++) {
4367
4370
  const Ot = It * 2 * Math.PI / wt - Math.PI / 2, At = V + Mt * Math.cos(Ot), Tt = it + Mt * Math.sin(Ot);
4368
4371
  It === 0 ? t.moveTo(At, Tt) : t.lineTo(At, Tt);
4369
4372
  }
4370
4373
  t.closePath();
4371
4374
  } else if (X === "Star") {
4372
- const Mt = Math.min(rt, nt) / 2, It = Mt / 2;
4375
+ const Mt = Math.min(lt, nt) / 2, It = Mt / 2;
4373
4376
  for (let Ot = 0; Ot < 10; Ot++) {
4374
4377
  const At = Ot % 2 === 0 ? Mt : It, Tt = Ot * Math.PI / 5 - Math.PI / 2;
4375
4378
  t.lineTo(V + At * Math.cos(Tt), it + At * Math.sin(Tt));
4376
4379
  }
4377
4380
  t.closePath();
4378
- } else X === "Line" && (t.moveTo(V - rt / 2, it), t.lineTo(V + rt / 2, it));
4381
+ } else X === "Line" && (t.moveTo(V - lt / 2, it), t.lineTo(V + lt / 2, it));
4379
4382
  t.fill();
4380
4383
  }, O = this.createCanvasFill(t, m, n, u);
4381
- O && (t.fillStyle = O, t.strokeStyle = O), d === "Line" ? (t.lineWidth = u, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(n / 2, 0), t.stroke()) : x(d, 0, 0, n, u, h, p);
4384
+ O && (t.fillStyle = O, t.strokeStyle = O), d === "Line" ? (t.lineWidth = u, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(n / 2, 0), t.stroke()) : R(d, 0, 0, n, u, h, p);
4382
4385
  const W = n - v, B = -n / 2 + v / 2 + f * W, $ = B - -n / 2;
4383
4386
  if ($ > 0) {
4384
4387
  const X = this.createCanvasFill(t, y, n, u);
@@ -4388,42 +4391,42 @@ class ci {
4388
4391
  const Y = t.getTransform(), H = Math.sqrt(Y.a * Y.a + Y.b * Y.b) || 1;
4389
4392
  t.shadowColor = "rgba(0,0,0,0.2)", t.shadowBlur = 4 * H, t.shadowOffsetY = 1 * H;
4390
4393
  const K = this.createCanvasFill(t, w, v, S);
4391
- if (K && (t.fillStyle = K), x(b, 0, 0, v, S, C, b === "Icon" ? M : I), t.restore(), k) {
4394
+ if (K && (t.fillStyle = K), R(b, 0, 0, v, S, C, b === "Icon" ? M : I), t.restore(), k) {
4392
4395
  t.save(), t.translate(B + P, E);
4393
4396
  const X = Math.round(a).toString();
4394
4397
  t.font = "10px Inter, sans-serif";
4395
- const V = t.measureText(X), it = 6, rt = 4, nt = V.width + it * 2, yt = 14 + rt;
4396
- t.beginPath(), this.drawRoundRect(t, -nt / 2, -yt / 2, nt, yt, 4), t.fillStyle = T, t.fill(), t.fillStyle = R, t.textAlign = "center", t.textBaseline = "middle", t.fillText(X, 0, 0), t.restore();
4398
+ const V = t.measureText(X), it = 6, lt = 4, nt = V.width + it * 2, bt = 14 + lt;
4399
+ t.beginPath(), this.drawRoundRect(t, -nt / 2, -bt / 2, nt, bt, 4), t.fillStyle = T, t.fill(), t.fillStyle = x, t.textAlign = "center", t.textBaseline = "middle", t.fillText(X, 0, 0), t.restore();
4397
4400
  }
4398
4401
  const A = s.label || {}, _ = s.helperText || {}, L = s.fontFamily || "Inter";
4399
4402
  if (A.visible !== !1) {
4400
- const X = A.text || "Label", V = A.fontSize || 12, it = A.color || "rgba(156, 163, 175, 1)", rt = A.offset ?? 8;
4403
+ const X = A.text || "Label", V = A.fontSize || 12, it = A.color || "rgba(156, 163, 175, 1)", lt = A.offset ?? 8;
4401
4404
  t.font = `600 ${V}px "${L}", sans-serif`, t.fillStyle = it, t.textAlign = "left", t.textBaseline = "bottom";
4402
- const nt = -(n / 2), yt = -(u / 2) - rt;
4403
- t.fillText(X, nt, yt);
4405
+ const nt = -(n / 2), bt = -(u / 2) - lt;
4406
+ t.fillText(X, nt, bt);
4404
4407
  }
4405
4408
  if (_.visible === !0) {
4406
- const X = _.text || "Helper text", V = _.fontSize || 11, it = _.color || "rgba(156, 163, 175, 1)", rt = _.offset ?? 6;
4409
+ const X = _.text || "Helper text", V = _.fontSize || 11, it = _.color || "rgba(156, 163, 175, 1)", lt = _.offset ?? 6;
4407
4410
  t.font = `400 ${V}px "${L}", sans-serif`, t.fillStyle = it, t.textAlign = "left", t.textBaseline = "top";
4408
- const nt = -(n / 2), yt = u / 2 + rt;
4409
- t.fillText(X, nt, yt);
4411
+ const nt = -(n / 2), bt = u / 2 + lt;
4412
+ t.fillText(X, nt, bt);
4410
4413
  }
4411
4414
  }
4412
4415
  renderDropdown(t, i) {
4413
4416
  var E;
4414
4417
  const o = this.objectStates.get(i.id);
4415
4418
  if (!o) return;
4416
- const e = o.options || i.options || {}, s = i.geometry.width || 160, n = i.geometry.height || 40, a = -s / 2, r = -n / 2, l = e.corner_radius ?? 6, c = e.disabled || e.previewState === "disabled", f = this.lastHoveredObjectId === i.id || e.previewState === "hover", u = (e.isOpen || e.previewState === "active") && !c;
4419
+ const e = o.options || i.options || {}, s = i.geometry.width || 160, n = i.geometry.height || 40, a = -s / 2, r = -n / 2, c = e.corner_radius ?? 6, l = e.disabled || e.previewState === "disabled", f = this.lastHoveredObjectId === i.id || e.previewState === "hover", u = (e.isOpen || e.previewState === "active") && !l;
4417
4420
  let h = e.backgroundColor, d = e.borderColor, p = e.color || "#333333";
4418
- c ? (h = e.disabledBackgroundColor || "#f3f4f6", d = e.disabledBorderColor || "#e5e7eb", p = e.disabledColor || "#9ca3af") : u ? (h = e.activeBackgroundColor || h, d = e.activeBorderColor || d, p = e.activeColor || p) : f && (h = e.hoverBackgroundColor || h, d = e.hoverBorderColor || d, p = e.hoverColor || p), h || (h = "#ffffff"), d || (d = "#e5e7eb");
4421
+ l ? (h = e.disabledBackgroundColor || "#f3f4f6", d = e.disabledBorderColor || "#e5e7eb", p = e.disabledColor || "#9ca3af") : u ? (h = e.activeBackgroundColor || h, d = e.activeBorderColor || d, p = e.activeColor || p) : f && (h = e.hoverBackgroundColor || h, d = e.hoverBorderColor || d, p = e.hoverColor || p), h || (h = "#ffffff"), d || (d = "#e5e7eb");
4419
4422
  const y = t.globalAlpha;
4420
- t.globalAlpha = y * (e.opacity ?? 1), this.drawRoundRect(t, a, r, s, n, l), t.fillStyle = this.createCanvasFill(t, typeof h == "string" ? { type: "Solid", color: h } : h, s, n) || "#ffffff", t.fill();
4423
+ t.globalAlpha = y * (e.opacity ?? 1), this.drawRoundRect(t, a, r, s, n, c), t.fillStyle = this.createCanvasFill(t, typeof h == "string" ? { type: "Solid", color: h } : h, s, n) || "#ffffff", t.fill();
4421
4424
  const m = e.borderWidth ?? 1;
4422
4425
  m > 0 && (t.strokeStyle = this.createCanvasFill(t, typeof d == "string" ? { type: "Solid", color: d } : d, s, n) || "#e5e7eb", t.lineWidth = m, t.stroke());
4423
4426
  const b = 12, v = e.chevronType || "chevron", S = e.chevronSize || 16, C = (u ? e.openIconColor : e.closedIconColor) || e.chevronColor || "#6b7280";
4424
4427
  if (v !== "none") {
4425
- const x = a + s - b - S / 2;
4426
- t.save(), t.translate(x, 0);
4428
+ const R = a + s - b - S / 2;
4429
+ t.save(), t.translate(R, 0);
4427
4430
  const O = u ? e.openIconAngle ?? 180 : e.closedIconAngle ?? 0;
4428
4431
  if (t.rotate(O * Math.PI / 180), t.strokeStyle = C, t.fillStyle = C, t.lineWidth = 1.5, t.lineCap = "round", t.lineJoin = "round", v === "chevron")
4429
4432
  t.beginPath(), t.moveTo(-S / 2, -S * 0.2), t.lineTo(0, S * 0.2), t.lineTo(S / 2, -S * 0.2), t.stroke();
@@ -4440,110 +4443,110 @@ class ci {
4440
4443
  }
4441
4444
  const w = e.selectedOption || e.placeholder || "Select...", I = e.fontSize || 14, M = e.fontWeight || 400, k = e.fontFamily || "Inter, sans-serif";
4442
4445
  t.font = `${M} ${I}px ${k}`;
4443
- const T = c ? e.disabledColor || "#9ca3af" : !e.selectedOption && e.placeholder ? "#9ca3af" : p;
4446
+ const T = l ? e.disabledColor || "#9ca3af" : !e.selectedOption && e.placeholder ? "#9ca3af" : p;
4444
4447
  t.fillStyle = this.createCanvasFill(t, typeof T == "string" ? { type: "Solid", color: T } : T, s, n) || "#333333", t.textAlign = "left", t.textBaseline = "middle";
4445
- const R = v === "none" ? 0 : S + 8, P = s - b * 2 - R;
4446
- if (t.save(), t.beginPath(), t.rect(a + b, r, P, n), t.clip(), t.fillText(w, a + b, 0), t.restore(), u && !c) {
4447
- const x = r + n + 4, O = e.optionsList || [], W = e.itemHeight || 32, B = e.listPadding ?? 4, $ = O.length * W + B * 2, Y = e.listCornerRadius ?? l;
4448
+ const x = v === "none" ? 0 : S + 8, P = s - b * 2 - x;
4449
+ if (t.save(), t.beginPath(), t.rect(a + b, r, P, n), t.clip(), t.fillText(w, a + b, 0), t.restore(), u && !l) {
4450
+ const R = r + n + 4, O = e.optionsList || [], W = e.itemHeight || 32, B = e.listPadding ?? 4, $ = O.length * W + B * 2, Y = e.listCornerRadius ?? c;
4448
4451
  t.save();
4449
4452
  const H = e.listShadow || {}, K = t.getTransform(), A = Math.sqrt(K.a * K.a + K.b * K.b) || 1;
4450
- t.shadowColor = typeof H.color == "string" ? H.color : ((E = H.color) == null ? void 0 : E.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (H.blur ?? 12) * A, t.shadowOffsetY = (H.offsetY ?? 6) * A, t.shadowOffsetX = (H.offsetX ?? 0) * A, t.beginPath(), this.drawRoundRect(t, a, x, s, $, Y), t.fillStyle = this.createCanvasFill(t, typeof e.listBackgroundColor == "string" ? { type: "Solid", color: e.listBackgroundColor } : e.listBackgroundColor || { type: "Solid", color: "#ffffff" }, s, $) || "#ffffff", t.fill();
4453
+ t.shadowColor = typeof H.color == "string" ? H.color : ((E = H.color) == null ? void 0 : E.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (H.blur ?? 12) * A, t.shadowOffsetY = (H.offsetY ?? 6) * A, t.shadowOffsetX = (H.offsetX ?? 0) * A, t.beginPath(), this.drawRoundRect(t, a, R, s, $, Y), t.fillStyle = this.createCanvasFill(t, typeof e.listBackgroundColor == "string" ? { type: "Solid", color: e.listBackgroundColor } : e.listBackgroundColor || { type: "Solid", color: "#ffffff" }, s, $) || "#ffffff", t.fill();
4451
4454
  const _ = e.listBorderWidth ?? 1;
4452
4455
  _ > 0 && (t.shadowColor = "transparent", t.strokeStyle = this.createCanvasFill(t, typeof e.listBorderColor == "string" ? { type: "Solid", color: e.listBorderColor } : e.listBorderColor || { type: "Solid", color: d }, s, $) || "#e5e7eb", t.lineWidth = _, t.stroke()), t.restore();
4453
4456
  const L = e.itemFontSize || I, X = e.itemFontFamily || k;
4454
4457
  t.font = `${M} ${L}px ${X}`, O.forEach((V, it) => {
4455
- const rt = x + B + it * W;
4458
+ const lt = R + B + it * W;
4456
4459
  if (V === e.selectedOption)
4457
- t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, s, W) || "#f3f4f6", t.fillRect(a + _, rt, s - _ * 2, W), t.fillStyle = e.itemSelectedColor || e.accentColor || p || "#374151";
4460
+ t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, s, W) || "#f3f4f6", t.fillRect(a + _, lt, s - _ * 2, W), t.fillStyle = e.itemSelectedColor || e.accentColor || p || "#374151";
4458
4461
  else if (t.fillStyle = e.listTextColor || p || "#333333", this.activeDropdownId === i.id && this._lastPointerPos) {
4459
- const yt = this._lastPointerPos.y - (x + B), ct = Math.floor(yt / W);
4460
- it === ct && (t.fillStyle = this.createCanvasFill(t, typeof e.itemHoverBackgroundColor == "string" ? { type: "Solid", color: e.itemHoverBackgroundColor } : e.itemHoverBackgroundColor || { type: "Solid", color: "#f9fafb" }, s, W) || "#f9fafb", t.fillRect(a + _, rt, s - _ * 2, W), t.fillStyle = e.itemHoverColor || p);
4462
+ const bt = this._lastPointerPos.y - (R + B), ht = Math.floor(bt / W);
4463
+ it === ht && (t.fillStyle = this.createCanvasFill(t, typeof e.itemHoverBackgroundColor == "string" ? { type: "Solid", color: e.itemHoverBackgroundColor } : e.itemHoverBackgroundColor || { type: "Solid", color: "#f9fafb" }, s, W) || "#f9fafb", t.fillRect(a + _, lt, s - _ * 2, W), t.fillStyle = e.itemHoverColor || p);
4461
4464
  }
4462
- t.fillText(V, a + b, rt + W / 2);
4465
+ t.fillText(V, a + b, lt + W / 2);
4463
4466
  });
4464
4467
  }
4465
4468
  t.globalAlpha = y;
4466
4469
  }
4467
4470
  renderButton(t, i) {
4468
4471
  if (i.children && i.children.length > 0) return;
4469
- const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = i.geometry || {}, n = s.width || 120, a = s.height || 40, r = this.lastHoveredObjectId === i.id, l = this.activeObjectId === i.id, c = e.label || {}, f = e.hoverStyle || {}, u = e.activeStyle || {}, h = e.icon || { enabled: !1 };
4470
- let d = e.backgroundColor || "#3b82f6", p = c.color || "#ffffff", y = c.text || "Button", m = s.cornerRadius ?? 8, b = e.borderColor || "transparent", v = e.borderWidth || 0, S = 1;
4471
- l && u ? (d = u.backgroundColor || d, p = u.color || p, y = u.text || y, S = u.scale ?? 0.95, m = u.cornerRadius ?? m) : r && f && (d = f.backgroundColor || d, p = f.color || p, y = f.text || y, S = f.scale ?? 1, m = f.cornerRadius ?? m, b = f.borderColor || b);
4472
+ const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = i.geometry || {}, n = s.width || 120, a = s.height || 40, r = this.lastHoveredObjectId === i.id, c = this.activeObjectId === i.id, l = e.label || {}, f = e.hoverStyle || {}, u = e.activeStyle || {}, h = e.icon || { enabled: !1 };
4473
+ let d = e.backgroundColor || "#3b82f6", p = l.color || "#ffffff", y = l.text || "Button", m = s.cornerRadius ?? 8, b = e.borderColor || "transparent", v = e.borderWidth || 0, S = 1;
4474
+ c && u ? (d = u.backgroundColor || d, p = u.color || p, y = u.text || y, S = u.scale ?? 0.95, m = u.cornerRadius ?? m) : r && f && (d = f.backgroundColor || d, p = f.color || p, y = f.text || y, S = f.scale ?? 1, m = f.cornerRadius ?? m, b = f.borderColor || b);
4472
4475
  const C = -n / 2, w = -a / 2;
4473
4476
  t.save(), t.scale(S, S), t.beginPath(), this.drawRoundRect(t, C, w, n, a, m);
4474
4477
  const I = this.createCanvasFill(t, d, n, a);
4475
4478
  I && (t.fillStyle = I, t.fill()), (v > 0 || r && f.borderColor) && (t.strokeStyle = b, t.lineWidth = v || (r ? 1 : 0), t.stroke());
4476
- const M = c.fontSize || 14, k = c.fontFamily || "Inter", T = c.fontWeight || 600;
4479
+ const M = l.fontSize || 14, k = l.fontFamily || "Inter", T = l.fontWeight || 600;
4477
4480
  t.font = `${T} ${M}px "${k}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, t.fillStyle = p, t.textAlign = "center", t.textBaseline = "middle";
4478
- let R = 0;
4481
+ let x = 0;
4479
4482
  if (h.enabled && h.svgPath) {
4480
- const P = M * 1.1, E = h.gap || 8, x = t.measureText(y), W = -(x.width + P + E) / 2, B = h.position === "left" ? W + P / 2 : W + x.width + E + P / 2;
4481
- R = h.position === "left" ? W + P + E + x.width / 2 : W + x.width / 2, t.save(), t.translate(B, 0);
4483
+ const P = M * 1.1, E = h.gap || 8, R = t.measureText(y), W = -(R.width + P + E) / 2, B = h.position === "left" ? W + P / 2 : W + R.width + E + P / 2;
4484
+ x = h.position === "left" ? W + P + E + R.width / 2 : W + R.width / 2, t.save(), t.translate(B, 0);
4482
4485
  const $ = new Path2D(h.svgPath), Y = P / 24;
4483
4486
  t.scale(Y, Y), t.translate(-12, -12), t.fillStyle = p, t.fill($), t.restore();
4484
4487
  }
4485
- t.fillText(y, R, 0), t.restore();
4488
+ t.fillText(y, x, 0), t.restore();
4486
4489
  }
4487
4490
  renderToggleButton(t, i) {
4488
4491
  var y, m;
4489
- const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = e.checked ?? !1, n = ((y = i.geometry) == null ? void 0 : y.width) || 120, a = ((m = i.geometry) == null ? void 0 : m.height) || 40, r = -n / 2, l = -a / 2, c = e.corner_radius ?? 8, f = e.label || {}, u = s ? e.accentColor || "#3b82f6" : e.inactiveColor || "#374151", h = s ? e.activeTextColor || "#ffffff" : e.inactiveTextColor || "#9ca3af";
4490
- t.save(), t.beginPath(), this.drawRoundRect(t, r, l, n, a, c), t.fillStyle = u, t.fill();
4492
+ const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = e.checked ?? !1, n = ((y = i.geometry) == null ? void 0 : y.width) || 120, a = ((m = i.geometry) == null ? void 0 : m.height) || 40, r = -n / 2, c = -a / 2, l = e.corner_radius ?? 8, f = e.label || {}, u = s ? e.accentColor || "#3b82f6" : e.inactiveColor || "#374151", h = s ? e.activeTextColor || "#ffffff" : e.inactiveTextColor || "#9ca3af";
4493
+ t.save(), t.beginPath(), this.drawRoundRect(t, r, c, n, a, l), t.fillStyle = u, t.fill();
4491
4494
  const d = f.fontSize || 14, p = f.fontFamily || "Inter";
4492
4495
  t.font = `${f.fontWeight || 600} ${d}px "${p}", sans-serif`, t.fillStyle = h, t.textAlign = "center", t.textBaseline = "middle", t.fillText(f.text || "Toggle", 0, 0), t.restore();
4493
4496
  }
4494
4497
  renderToggle(t, i) {
4495
- var Y, H, K, A, _, L, X, V, it, rt, nt, yt;
4496
- const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((Y = i.geometry) == null ? void 0 : Y.width) || 52, n = ((H = i.geometry) == null ? void 0 : H.height) || 30, a = -s / 2, r = -n / 2, l = e.checked ?? !1, c = e.cornerRadius ?? e.corner_radius ?? n / 2, f = e.toggleStyle || {}, u = f.backgroundColor || e.activeColor || "#10b981", h = f.borderColor || e.borderColor || "transparent", d = f.borderWidth ?? e.borderWidth ?? 0, p = f.knobColor || e.knobColor || "#ffffff", y = l ? u : e.inactiveColor || "#374151", m = l ? h : e.borderColor || "transparent", b = l ? d : e.borderWidth ?? 0, v = l ? p : e.knobColor || "#ffffff";
4497
- e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n, c);
4498
+ var Y, H, K, A, _, L, X, V, it, lt, nt, bt;
4499
+ const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((Y = i.geometry) == null ? void 0 : Y.width) || 52, n = ((H = i.geometry) == null ? void 0 : H.height) || 30, a = -s / 2, r = -n / 2, c = e.checked ?? !1, l = e.cornerRadius ?? e.corner_radius ?? n / 2, f = e.toggleStyle || {}, u = f.backgroundColor || e.activeColor || "#10b981", h = f.borderColor || e.borderColor || "transparent", d = f.borderWidth ?? e.borderWidth ?? 0, p = f.knobColor || e.knobColor || "#ffffff", y = c ? u : e.inactiveColor || "#374151", m = c ? h : e.borderColor || "transparent", b = c ? d : e.borderWidth ?? 0, v = c ? p : e.knobColor || "#ffffff";
4500
+ e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n, l);
4498
4501
  const S = this.createCanvasFill(t, y, s, n);
4499
4502
  if (S && (t.fillStyle = S, t.fill()), b > 0) {
4500
4503
  t.lineWidth = b;
4501
- const ct = this.createCanvasFill(t, m, s, n);
4502
- ct && (t.strokeStyle = ct, t.stroke());
4504
+ const ht = this.createCanvasFill(t, m, s, n);
4505
+ ht && (t.strokeStyle = ht, t.stroke());
4503
4506
  }
4504
- const C = 2, w = n - C * 2, I = w / 2, M = a + C, k = a + s - C - w, T = l ? k : M, R = r + C;
4505
- t.beginPath(), t.arc(T + I, R + I, I, 0, Math.PI * 2);
4507
+ const C = 2, w = n - C * 2, I = w / 2, M = a + C, k = a + s - C - w, T = c ? k : M, x = r + C;
4508
+ t.beginPath(), t.arc(T + I, x + I, I, 0, Math.PI * 2);
4506
4509
  const P = this.createCanvasFill(t, v, w, w);
4507
4510
  P && (t.fillStyle = P, t.fill()), e.disabled && (t.globalAlpha *= 2);
4508
- let E = !1, x = !1;
4509
- const O = (l ? (K = f.leftLabel) == null ? void 0 : K.text : null) || ((A = e.leftLabel) == null ? void 0 : A.text) || "", W = (l ? (_ = f.leftLabel) == null ? void 0 : _.color : null) || ((L = e.leftLabel) == null ? void 0 : L.color) || "#f3f4f6";
4511
+ let E = !1, R = !1;
4512
+ const O = (c ? (K = f.leftLabel) == null ? void 0 : K.text : null) || ((A = e.leftLabel) == null ? void 0 : A.text) || "", W = (c ? (_ = f.leftLabel) == null ? void 0 : _.color : null) || ((L = e.leftLabel) == null ? void 0 : L.color) || "#f3f4f6";
4510
4513
  if ((X = e.leftLabel) != null && X.enabled && O) {
4511
- const ct = e.leftLabel;
4512
- t.font = `${ct.fontWeight || 400} ${ct.fontSize || 12}px "${ct.fontFamily || "Inter"}", sans-serif`, t.fillStyle = W, t.textBaseline = "middle", t.textAlign = "right", t.fillText(O, a - (ct.gap || 8), 0), E = !0;
4514
+ const ht = e.leftLabel;
4515
+ t.font = `${ht.fontWeight || 400} ${ht.fontSize || 12}px "${ht.fontFamily || "Inter"}", sans-serif`, t.fillStyle = W, t.textBaseline = "middle", t.textAlign = "right", t.fillText(O, a - (ht.gap || 8), 0), E = !0;
4513
4516
  }
4514
- const B = (l ? (V = f.rightLabel) == null ? void 0 : V.text : null) || ((it = e.rightLabel) == null ? void 0 : it.text) || "", $ = (l ? (rt = f.rightLabel) == null ? void 0 : rt.color : null) || ((nt = e.rightLabel) == null ? void 0 : nt.color) || "#f3f4f6";
4515
- if ((yt = e.rightLabel) != null && yt.enabled && B) {
4516
- const ct = e.rightLabel;
4517
- t.font = `${ct.fontWeight || 400} ${ct.fontSize || 12}px "${ct.fontFamily || "Inter"}", sans-serif`, t.fillStyle = $, t.textBaseline = "middle", t.textAlign = "left", t.fillText(B, a + s + (ct.gap || 8), 0), x = !0;
4517
+ const B = (c ? (V = f.rightLabel) == null ? void 0 : V.text : null) || ((it = e.rightLabel) == null ? void 0 : it.text) || "", $ = (c ? (lt = f.rightLabel) == null ? void 0 : lt.color : null) || ((nt = e.rightLabel) == null ? void 0 : nt.color) || "#f3f4f6";
4518
+ if ((bt = e.rightLabel) != null && bt.enabled && B) {
4519
+ const ht = e.rightLabel;
4520
+ t.font = `${ht.fontWeight || 400} ${ht.fontSize || 12}px "${ht.fontFamily || "Inter"}", sans-serif`, t.fillStyle = $, t.textBaseline = "middle", t.textAlign = "left", t.fillText(B, a + s + (ht.gap || 8), 0), R = !0;
4518
4521
  }
4519
- if (!E && !x && e.label && e.label.text) {
4520
- const ct = e.label, wt = ct.fontSize || 14, Mt = ct.fontWeight || 400, It = ct.fontFamily || "Inter";
4521
- t.font = `${Mt} ${wt}px "${It}", sans-serif`, t.fillStyle = ct.color || "#f3f4f6", t.textBaseline = "middle";
4522
- const Ot = ct.gap || 10;
4522
+ if (!E && !R && e.label && e.label.text) {
4523
+ const ht = e.label, wt = ht.fontSize || 14, Mt = ht.fontWeight || 400, It = ht.fontFamily || "Inter";
4524
+ t.font = `${Mt} ${wt}px "${It}", sans-serif`, t.fillStyle = ht.color || "#f3f4f6", t.textBaseline = "middle";
4525
+ const Ot = ht.gap || 10;
4523
4526
  let At = 0, Tt = 0;
4524
- ct.position === "left" ? (t.textAlign = "right", At = a - Ot, Tt = 0) : ct.position === "right" ? (t.textAlign = "left", At = a + s + Ot, Tt = 0) : ct.position === "top" ? (t.textAlign = "center", At = 0, Tt = r - Ot, t.textBaseline = "bottom") : ct.position === "bottom" ? (t.textAlign = "center", At = 0, Tt = r + n + Ot, t.textBaseline = "top") : (t.textAlign = "left", At = a + s + Ot, Tt = 0), t.fillText(ct.text, At, Tt);
4527
+ ht.position === "left" ? (t.textAlign = "right", At = a - Ot, Tt = 0) : ht.position === "right" ? (t.textAlign = "left", At = a + s + Ot, Tt = 0) : ht.position === "top" ? (t.textAlign = "center", At = 0, Tt = r - Ot, t.textBaseline = "bottom") : ht.position === "bottom" ? (t.textAlign = "center", At = 0, Tt = r + n + Ot, t.textBaseline = "top") : (t.textAlign = "left", At = a + s + Ot, Tt = 0), t.fillText(ht.text, At, Tt);
4525
4528
  }
4526
4529
  }
4527
4530
  renderCheckbox(t, i) {
4528
4531
  var S, C;
4529
- const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((S = i.geometry) == null ? void 0 : S.width) || 20, n = ((C = i.geometry) == null ? void 0 : C.height) || 20, a = -s / 2, r = -n / 2, l = e.cornerRadius ?? 4, c = e.checked ?? !1, f = e.activeColor || "#3b82f6", u = e.inactiveColor || "transparent", h = e.checkColor || "#ffffff", d = e.borderColor || "#4b5563", p = e.borderWidth ?? 2, y = c ? f : u, m = c ? "transparent" : d, b = c ? 0 : p;
4530
- e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n, l);
4532
+ const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((S = i.geometry) == null ? void 0 : S.width) || 20, n = ((C = i.geometry) == null ? void 0 : C.height) || 20, a = -s / 2, r = -n / 2, c = e.cornerRadius ?? 4, l = e.checked ?? !1, f = e.activeColor || "#3b82f6", u = e.inactiveColor || "transparent", h = e.checkColor || "#ffffff", d = e.borderColor || "#4b5563", p = e.borderWidth ?? 2, y = l ? f : u, m = l ? "transparent" : d, b = l ? 0 : p;
4533
+ e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n, c);
4531
4534
  const v = this.createCanvasFill(t, y, s, n);
4532
4535
  if (v && (t.fillStyle = v, t.fill()), b > 0) {
4533
4536
  t.lineWidth = b;
4534
4537
  const w = this.createCanvasFill(t, m, s, n);
4535
4538
  w && (t.strokeStyle = w, t.stroke());
4536
- } else if (c) {
4539
+ } else if (l) {
4537
4540
  t.lineWidth = 1;
4538
4541
  const w = this.createCanvasFill(t, f, s, n);
4539
4542
  w && (t.strokeStyle = w, t.stroke());
4540
4543
  }
4541
- if (c) {
4544
+ if (l) {
4542
4545
  t.save(), t.beginPath();
4543
4546
  const w = this.createCanvasFill(t, h, s, n);
4544
4547
  t.strokeStyle = w || h, t.lineWidth = Math.max(2, s * 0.12), t.lineCap = "round", t.lineJoin = "round";
4545
- const I = a + s * 0.25, M = r + n * 0.5, k = a + s * 0.45, T = r + n * 0.7, R = a + s * 0.75, P = r + n * 0.25;
4546
- t.moveTo(I, M), t.lineTo(k, T), t.lineTo(R, P), t.stroke(), t.restore();
4548
+ const I = a + s * 0.25, M = r + n * 0.5, k = a + s * 0.45, T = r + n * 0.7, x = a + s * 0.75, P = r + n * 0.25;
4549
+ t.moveTo(I, M), t.lineTo(k, T), t.lineTo(x, P), t.stroke(), t.restore();
4547
4550
  }
4548
4551
  if (e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
4549
4552
  const w = e.label;
@@ -4555,24 +4558,24 @@ class ci {
4555
4558
  }
4556
4559
  renderRadioGroup(t, i) {
4557
4560
  var C, w;
4558
- const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((C = i.geometry) == null ? void 0 : C.width) || 180, n = ((w = i.geometry) == null ? void 0 : w.height) || 100, a = -s / 2, r = -n / 2, l = e.selectedValue, c = e.optionsList || ["Option 1", "Option 2", "Option 3"], f = e.orientation || "vertical", u = e.itemGap !== void 0 ? e.itemGap : 16, h = e.activeColor || "#3b82f6", d = e.inactiveColor || "#4b5563", p = e.textColor || "#ffffff", y = e.fontSize || 14, m = e.fontFamily || "Inter", b = e.fontWeight || 400;
4561
+ const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((C = i.geometry) == null ? void 0 : C.width) || 180, n = ((w = i.geometry) == null ? void 0 : w.height) || 100, a = -s / 2, r = -n / 2, c = e.selectedValue, l = e.optionsList || ["Option 1", "Option 2", "Option 3"], f = e.orientation || "vertical", u = e.itemGap !== void 0 ? e.itemGap : 16, h = e.activeColor || "#3b82f6", d = e.inactiveColor || "#4b5563", p = e.textColor || "#ffffff", y = e.fontSize || 14, m = e.fontFamily || "Inter", b = e.fontWeight || 400;
4559
4562
  e.disabled && (t.globalAlpha *= 0.5);
4560
4563
  const v = 8, S = v * 2;
4561
4564
  if (t.save(), t.font = `${b} ${y}px "${m}", sans-serif`, t.textBaseline = "middle", t.textAlign = "left", f === "vertical") {
4562
4565
  const I = Math.max(S, y) + u;
4563
- c.forEach((M, k) => {
4566
+ l.forEach((M, k) => {
4564
4567
  const T = r + k * I + v;
4565
4568
  t.beginPath(), t.arc(a + v, T, v, 0, Math.PI * 2);
4566
- const R = l === M, P = this.createCanvasFill(t, h, S, S), E = this.createCanvasFill(t, d, S, S);
4567
- R ? (t.strokeStyle = P || h, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a + v, T, v / 2, 0, Math.PI * 2), t.fillStyle = P || h, t.fill()) : (t.strokeStyle = E || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = p, t.fillText(M, a + S + 8, T);
4569
+ const x = c === M, P = this.createCanvasFill(t, h, S, S), E = this.createCanvasFill(t, d, S, S);
4570
+ x ? (t.strokeStyle = P || h, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a + v, T, v / 2, 0, Math.PI * 2), t.fillStyle = P || h, t.fill()) : (t.strokeStyle = E || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = p, t.fillText(M, a + S + 8, T);
4568
4571
  });
4569
4572
  } else {
4570
4573
  let I = a;
4571
- c.forEach((M) => {
4572
- const k = l === M, T = t.measureText(M).width;
4574
+ l.forEach((M) => {
4575
+ const k = c === M, T = t.measureText(M).width;
4573
4576
  t.beginPath(), t.arc(I + v, 0, v, 0, Math.PI * 2);
4574
- const R = this.createCanvasFill(t, h, S, S), P = this.createCanvasFill(t, d, S, S);
4575
- k ? (t.strokeStyle = R || h, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(I + v, 0, v / 2, 0, Math.PI * 2), t.fillStyle = R || h, t.fill()) : (t.strokeStyle = P || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = p, t.fillText(M, I + S + 6, 0), I += S + 6 + T + u;
4577
+ const x = this.createCanvasFill(t, h, S, S), P = this.createCanvasFill(t, d, S, S);
4578
+ k ? (t.strokeStyle = x || h, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(I + v, 0, v / 2, 0, Math.PI * 2), t.fillStyle = x || h, t.fill()) : (t.strokeStyle = P || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = p, t.fillText(M, I + S + 6, 0), I += S + 6 + T + u;
4576
4579
  });
4577
4580
  }
4578
4581
  if (t.restore(), e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
@@ -4584,10 +4587,10 @@ class ci {
4584
4587
  }
4585
4588
  }
4586
4589
  renderBarChart(t, i) {
4587
- var T, R;
4590
+ var T, x;
4588
4591
  const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = {
4589
4592
  width: ((T = i.geometry) == null ? void 0 : T.width) || 300,
4590
- height: ((R = i.geometry) == null ? void 0 : R.height) || 180,
4593
+ height: ((x = i.geometry) == null ? void 0 : x.height) || 180,
4591
4594
  chartType: e.chartType || "grouped",
4592
4595
  stylePreset: e.stylePreset || "default",
4593
4596
  datasets: e.datasets || [{ id: "ds-1", label: "Revenue", data: [42, 67, 31, 55, 78, 48], color: "#6366f1" }],
@@ -4632,36 +4635,36 @@ class ci {
4632
4635
  return hs[this.stylePreset] || hs.default;
4633
4636
  },
4634
4637
  _resolveColor: function(P, E) {
4635
- const x = this._getPreset();
4636
- return ["#6366f1", "#f59e0b", "#10b981", "#3b82f6", "#a855f7"].includes(P) ? x.colors[E % x.colors.length] : typeof P == "string" ? P : x.colors[E % x.colors.length];
4638
+ const R = this._getPreset();
4639
+ return ["#6366f1", "#f59e0b", "#10b981", "#3b82f6", "#a855f7"].includes(P) ? R.colors[E % R.colors.length] : typeof P == "string" ? P : R.colors[E % R.colors.length];
4637
4640
  },
4638
- _makeGradient: function(P, E, x, O, W, B) {
4641
+ _makeGradient: function(P, E, R, O, W, B) {
4639
4642
  if (!this._getPreset().barGradient && !this.barGradient) return E;
4640
- const Y = P.createLinearGradient(x, O, W, B);
4643
+ const Y = P.createLinearGradient(R, O, W, B);
4641
4644
  return Y.addColorStop(0, E), Y.addColorStop(1, E + "44"), Y;
4642
4645
  },
4643
- _drawRoundedBar: function(P, E, x, O, W, B, $) {
4646
+ _drawRoundedBar: function(P, E, R, O, W, B, $) {
4644
4647
  if (B = Math.min(B, Math.min(Math.abs(O), Math.abs(W)) / 2), B <= 0 || O === 0 || W === 0) {
4645
- P.rect(E, x, O, W);
4648
+ P.rect(E, R, O, W);
4646
4649
  return;
4647
4650
  }
4648
- P.beginPath(), $ ? (P.moveTo(E, x + W), P.lineTo(E, x + B), P.quadraticCurveTo(E, x, E + B, x), P.lineTo(E + O - B, x), P.quadraticCurveTo(E + O, x, E + O, x + B), P.lineTo(E + O, x + W), P.lineTo(E, x + W)) : (P.moveTo(E, x), P.lineTo(E + O - B, x), P.quadraticCurveTo(E + O, x, E + O, x + B), P.lineTo(E + O, x + W - B), P.quadraticCurveTo(E + O, x + W, E + O - B, x + W), P.lineTo(E, x + W), P.lineTo(E, x)), P.closePath();
4651
+ P.beginPath(), $ ? (P.moveTo(E, R + W), P.lineTo(E, R + B), P.quadraticCurveTo(E, R, E + B, R), P.lineTo(E + O - B, R), P.quadraticCurveTo(E + O, R, E + O, R + B), P.lineTo(E + O, R + W), P.lineTo(E, R + W)) : (P.moveTo(E, R), P.lineTo(E + O - B, R), P.quadraticCurveTo(E + O, R, E + O, R + B), P.lineTo(E + O, R + W - B), P.quadraticCurveTo(E + O, R + W, E + O - B, R + W), P.lineTo(E, R + W), P.lineTo(E, R)), P.closePath();
4649
4652
  }
4650
- }, n = s.width, a = s.height, r = -n / 2, l = -a / 2;
4653
+ }, n = s.width, a = s.height, r = -n / 2, c = -a / 2;
4651
4654
  if (!s.datasets || s.datasets.length === 0 || s.categories.length === 0) {
4652
4655
  t.save(), t.fillStyle = "rgba(99,102,241,0.7)", t.font = "bold 11px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "middle", t.fillText("NO CHART DATA", 0, 0), t.restore();
4653
4656
  return;
4654
4657
  }
4655
- const c = s._getPreset();
4658
+ const l = s._getPreset();
4656
4659
  let f = -1 / 0, u = 1 / 0;
4657
4660
  const h = s.categories.length, d = s.datasets.length;
4658
4661
  if (s.chartType === "stacked")
4659
4662
  for (let P = 0; P < h; P++) {
4660
- let E = 0, x = 0;
4663
+ let E = 0, R = 0;
4661
4664
  s.datasets.forEach((O) => {
4662
4665
  const W = O.data[P] ?? 0;
4663
- W >= 0 ? E += W : x += W;
4664
- }), E > f && (f = E), x < u && (u = x);
4666
+ W >= 0 ? E += W : R += W;
4667
+ }), E > f && (f = E), R < u && (u = R);
4665
4668
  }
4666
4669
  else
4667
4670
  s.datasets.forEach((P) => {
@@ -4672,19 +4675,19 @@ class ci {
4672
4675
  isFinite(f) || (f = 10), isFinite(u) || (u = 0), f = Math.max(f, 0), u = Math.min(u, 0);
4673
4676
  const p = f - u || 10;
4674
4677
  t.save(), s.enableShadows && (t.shadowColor = s.shadowColor, t.shadowBlur = s.shadowBlur, t.shadowOffsetY = s.shadowOffsetY), t.font = s.axisLabelFontSize + "px Inter, sans-serif";
4675
- const y = s.showYLabels ? t.measureText(f.toFixed(0)).width + 14 : 10, m = s.showXLabels ? s.axisLabelFontSize + 12 : 8, v = (s.showLegend && d > 0 ? s.legendFontSize + 10 : 0) + 8, S = 10, C = r + y, w = l + v, I = n - y - S, M = a - v - m;
4676
- if (s.enableShadows && (t.shadowColor = "transparent"), t.beginPath(), t.roundRect(r, l, n, a, 10), t.fillStyle = c.cardBackground, t.fill(), t.strokeStyle = c.cardBorderColor, t.lineWidth = 1, t.stroke(), s.chartBackground && s.chartBackground !== "transparent" && (t.beginPath(), t.rect(C, w, I, M), t.fillStyle = s.chartBackground, t.fill()), s.showLegend && d > 0) {
4678
+ const y = s.showYLabels ? t.measureText(f.toFixed(0)).width + 14 : 10, m = s.showXLabels ? s.axisLabelFontSize + 12 : 8, v = (s.showLegend && d > 0 ? s.legendFontSize + 10 : 0) + 8, S = 10, C = r + y, w = c + v, I = n - y - S, M = a - v - m;
4679
+ if (s.enableShadows && (t.shadowColor = "transparent"), t.beginPath(), t.roundRect(r, c, n, a, 10), t.fillStyle = l.cardBackground, t.fill(), t.strokeStyle = l.cardBorderColor, t.lineWidth = 1, t.stroke(), s.chartBackground && s.chartBackground !== "transparent" && (t.beginPath(), t.rect(C, w, I, M), t.fillStyle = s.chartBackground, t.fill()), s.showLegend && d > 0) {
4677
4680
  t.font = s.legendFontSize + "px Inter, sans-serif", t.textBaseline = "middle";
4678
- const P = l + 12;
4681
+ const P = c + 12;
4679
4682
  let E = C;
4680
- s.datasets.forEach((x, O) => {
4681
- const W = s._resolveColor(x.color, O), B = x.label || "Series " + (O + 1), $ = 7;
4682
- t.beginPath(), t.roundRect(E, P - $ / 2, $, $, 2), t.fillStyle = W, t.fill(), t.fillStyle = c.legendColor, t.textAlign = "left", t.fillText(B, E + $ + 4, P), E += t.measureText(B).width + $ + 16;
4683
+ s.datasets.forEach((R, O) => {
4684
+ const W = s._resolveColor(R.color, O), B = R.label || "Series " + (O + 1), $ = 7;
4685
+ t.beginPath(), t.roundRect(E, P - $ / 2, $, $, 2), t.fillStyle = W, t.fill(), t.fillStyle = l.legendColor, t.textAlign = "left", t.fillText(B, E + $ + 4, P), E += t.measureText(B).width + $ + 16;
4683
4686
  });
4684
4687
  }
4685
4688
  const k = 4;
4686
4689
  if (s.showGridLines) {
4687
- t.setLineDash(s.gridLineDash || []), t.lineWidth = s.gridLineWidth || 1, t.strokeStyle = c.gridColor;
4690
+ t.setLineDash(s.gridLineDash || []), t.lineWidth = s.gridLineWidth || 1, t.strokeStyle = l.gridColor;
4688
4691
  for (let P = 0; P <= k; P++)
4689
4692
  if (s.orientation === "horizontal") {
4690
4693
  const E = C + P / k * I;
@@ -4696,27 +4699,27 @@ class ci {
4696
4699
  t.setLineDash([]);
4697
4700
  }
4698
4701
  if (s.showYLabels) {
4699
- t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = c.axisLabelColor;
4702
+ t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = l.axisLabelColor;
4700
4703
  for (let P = 0; P <= k; P++)
4701
4704
  if (s.orientation === "horizontal") {
4702
- const E = u + P / k * p, x = C + P / k * I;
4703
- t.textAlign = "center", t.fillText(E.toFixed(0), x, w + M + s.axisLabelFontSize);
4705
+ const E = u + P / k * p, R = C + P / k * I;
4706
+ t.textAlign = "center", t.fillText(E.toFixed(0), R, w + M + s.axisLabelFontSize);
4704
4707
  } else {
4705
- const E = f - P / k * p, x = w + P / k * M;
4706
- t.textAlign = "right", t.fillText(E.toFixed(0), C - 6, x);
4708
+ const E = f - P / k * p, R = w + P / k * M;
4709
+ t.textAlign = "right", t.fillText(E.toFixed(0), C - 6, R);
4707
4710
  }
4708
4711
  }
4709
4712
  if (t.setLineDash([]), s.showXAxis && (t.lineWidth = s.xAxisLineWidth || 1, t.strokeStyle = s.xAxisColor, t.beginPath(), t.moveTo(C, w + M), t.lineTo(C + I, w + M), t.stroke()), s.showYAxis && (t.lineWidth = s.yAxisLineWidth || 1, t.strokeStyle = s.yAxisColor, t.beginPath(), t.moveTo(C, w), t.lineTo(C, w + M), t.stroke()), s.enableShadows && (t.shadowColor = s.shadowColor), s.chartType === "stacked")
4710
4713
  if (s.orientation === "horizontal") {
4711
4714
  const P = M / h;
4712
4715
  for (let E = 0; E < h; E++) {
4713
- const x = w + E * P + P / 2;
4714
- s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = c.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[E] || "", C - 5, x), s.enableShadows && (t.shadowColor = s.shadowColor));
4716
+ const R = w + E * P + P / 2;
4717
+ s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = l.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[E] || "", C - 5, R), s.enableShadows && (t.shadowColor = s.shadowColor));
4715
4718
  let O = C;
4716
4719
  s.datasets.forEach((W, B) => {
4717
4720
  const $ = W.data[E] ?? 0;
4718
4721
  if ($ === 0) return;
4719
- const Y = $ / p * I, H = Math.min(s.barWidth * d + s.barGap, P - 8), K = x - H / 2, A = O;
4722
+ const Y = $ / p * I, H = Math.min(s.barWidth * d + s.barGap, P - 8), K = R - H / 2, A = O;
4720
4723
  O += Y;
4721
4724
  const _ = s._resolveColor(W.color, B);
4722
4725
  t.beginPath(), t.fillStyle = s._makeGradient(t, _, A, K, A + Y, K), s._drawRoundedBar(t, A, K, Y, H, B === d - 1 ? s.barCornerRadius : 0, !1), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? _ : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill();
@@ -4725,13 +4728,13 @@ class ci {
4725
4728
  } else {
4726
4729
  const P = I / h;
4727
4730
  for (let E = 0; E < h; E++) {
4728
- const x = C + E * P + P / 2;
4729
- s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle = c.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[E] || "", x, w + M + 5), s.enableShadows && (t.shadowColor = s.shadowColor));
4731
+ const R = C + E * P + P / 2;
4732
+ s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle = l.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[E] || "", R, w + M + 5), s.enableShadows && (t.shadowColor = s.shadowColor));
4730
4733
  let O = w + M;
4731
4734
  s.datasets.forEach((W, B) => {
4732
4735
  const $ = W.data[E] ?? 0;
4733
4736
  if ($ === 0) return;
4734
- const Y = $ / p * M, H = Math.min(s.barWidth * d + s.barGap, P - 8), K = x - H / 2, A = O - Y;
4737
+ const Y = $ / p * M, H = Math.min(s.barWidth * d + s.barGap, P - 8), K = R - H / 2, A = O - Y;
4735
4738
  O -= Y;
4736
4739
  const _ = s._resolveColor(W.color, B);
4737
4740
  t.beginPath(), t.fillStyle = s._makeGradient(t, _, K, A, K, A + Y), s._drawRoundedBar(t, K, A, H, Y, B === d - 1 ? s.barCornerRadius : 0, !0), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? _ : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill();
@@ -4739,28 +4742,28 @@ class ci {
4739
4742
  }
4740
4743
  }
4741
4744
  else if (s.orientation === "horizontal") {
4742
- const P = M / h, E = d * s.barWidth + Math.max(0, (d - 1) * s.barGap), x = C + (0 - u) / p * I;
4745
+ const P = M / h, E = d * s.barWidth + Math.max(0, (d - 1) * s.barGap), R = C + (0 - u) / p * I;
4743
4746
  for (let O = 0; O < h; O++) {
4744
4747
  const W = w + O * P + P / 2;
4745
- s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = c.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[O] || "", C - 5, W), s.enableShadows && (t.shadowColor = s.shadowColor));
4748
+ s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = l.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[O] || "", C - 5, W), s.enableShadows && (t.shadowColor = s.shadowColor));
4746
4749
  const B = W - E / 2;
4747
4750
  s.datasets.forEach(($, Y) => {
4748
4751
  const H = $.data[O] ?? 0, K = Math.abs(H / p * I);
4749
4752
  if (K < 1) return;
4750
- const A = B + Y * (s.barWidth + s.barGap), _ = H >= 0 ? x : x - K, L = s._resolveColor($.color, Y);
4753
+ const A = B + Y * (s.barWidth + s.barGap), _ = H >= 0 ? R : R - K, L = s._resolveColor($.color, Y);
4751
4754
  t.beginPath(), t.fillStyle = s._makeGradient(t, L, _, A, _ + K, A), s._drawRoundedBar(t, _, A, K, s.barWidth, s.barCornerRadius, !1), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? L : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill(), s.showValueOnTop && H !== 0 && (t.font = (s.valueFontWeight || "bold") + " " + (s.valueFontSize || 10) + "px Inter, sans-serif", t.textAlign = H >= 0 ? "left" : "right", t.textBaseline = "middle", t.fillStyle = s.valueColor === "auto" ? L : s.valueColor || "#fff", t.shadowColor = "transparent", t.fillText(H.toString(), H >= 0 ? _ + K + 4 : _ - 4, A + s.barWidth / 2), s.enableShadows && (t.shadowColor = s.shadowColor));
4752
4755
  });
4753
4756
  }
4754
4757
  } else {
4755
- const P = I / h, E = d * s.barWidth + Math.max(0, (d - 1) * s.barGap), x = w + M - (0 - u) / p * M;
4758
+ const P = I / h, E = d * s.barWidth + Math.max(0, (d - 1) * s.barGap), R = w + M - (0 - u) / p * M;
4756
4759
  for (let O = 0; O < h; O++) {
4757
4760
  const W = C + O * P + P / 2;
4758
- s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle = c.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[O] || "", W, w + M + 5), s.enableShadows && (t.shadowColor = s.shadowColor));
4761
+ s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle = l.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[O] || "", W, w + M + 5), s.enableShadows && (t.shadowColor = s.shadowColor));
4759
4762
  const B = W - E / 2;
4760
4763
  s.datasets.forEach(($, Y) => {
4761
4764
  const H = $.data[O] ?? 0, K = Math.abs(H / p * M);
4762
4765
  if (K < 1) return;
4763
- const A = B + Y * (s.barWidth + s.barGap), _ = H >= 0 ? x - K : x, L = s._resolveColor($.color, Y);
4766
+ const A = B + Y * (s.barWidth + s.barGap), _ = H >= 0 ? R - K : R, L = s._resolveColor($.color, Y);
4764
4767
  t.beginPath(), t.fillStyle = s._makeGradient(t, L, A, _, A, _ + K), s._drawRoundedBar(t, A, _, s.barWidth, K, s.barCornerRadius, !0), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? L : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill(), s.showValueOnTop && H !== 0 && (t.font = (s.valueFontWeight || "bold") + " " + (s.valueFontSize || 10) + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = H >= 0 ? "bottom" : "top", t.fillStyle = s.valueColor === "auto" ? L : s.valueColor || "#fff", t.shadowColor = "transparent", t.fillText(H.toString(), A + s.barWidth / 2, H >= 0 ? _ - 4 : _ + K + 4), s.enableShadows && (t.shadowColor = s.shadowColor));
4765
4768
  });
4766
4769
  }
@@ -4804,18 +4807,18 @@ class ci {
4804
4807
  t.save(), t.fillStyle = "rgba(99,102,241,0.8)", t.font = "bold 11px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "middle", t.fillText("EMPTY DATA", 0, 0), t.restore();
4805
4808
  return;
4806
4809
  }
4807
- const l = s._getPreset();
4808
- t.save(), t.beginPath(), t.roundRect(-n / 2, -a / 2, n, a, 10), t.fillStyle = l.cardBackground, t.fill(), t.strokeStyle = l.cardBorderColor, t.lineWidth = 1, t.stroke();
4809
- const c = s.showLegend ? Math.ceil(s.slices.length / 2) : 0, f = c > 0 ? c * (s.legendFontSize + 8) + 10 : 0, u = a - f - 16, h = Math.min(n - 24, u) / 2, d = 0, p = -f / 2;
4810
+ const c = s._getPreset();
4811
+ t.save(), t.beginPath(), t.roundRect(-n / 2, -a / 2, n, a, 10), t.fillStyle = c.cardBackground, t.fill(), t.strokeStyle = c.cardBorderColor, t.lineWidth = 1, t.stroke();
4812
+ const l = s.showLegend ? Math.ceil(s.slices.length / 2) : 0, f = l > 0 ? l * (s.legendFontSize + 8) + 10 : 0, u = a - f - 16, h = Math.min(n - 24, u) / 2, d = 0, p = -f / 2;
4810
4813
  if (s.chartType === "rose") {
4811
4814
  const b = Math.max(...s.slices.map((C) => C.value || 0)), v = Math.PI * 2 / s.slices.length, S = h > 0 ? s.sliceGap / h : 0;
4812
4815
  s.slices.forEach((C, w) => {
4813
4816
  const I = C.value || 0;
4814
4817
  if (I === 0) return;
4815
- const M = I / b * h, k = -Math.PI / 2 + w * v + S / 2, T = k + v - S, R = s._resolveSliceColor(C, w);
4816
- if (t.beginPath(), t.moveTo(d, p), t.arc(d, p, M, k, T), t.closePath(), t.fillStyle = R + "cc", t.fill(), t.strokeStyle = R, t.lineWidth = 1.5, t.stroke(), s.showLabels) {
4817
- const P = k + (T - k) / 2, E = d + M * 0.65 * Math.cos(P), x = p + M * 0.65 * Math.sin(P), O = Math.round(I / r * 100);
4818
- t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${O}%`, E, x), t.restore();
4818
+ const M = I / b * h, k = -Math.PI / 2 + w * v + S / 2, T = k + v - S, x = s._resolveSliceColor(C, w);
4819
+ if (t.beginPath(), t.moveTo(d, p), t.arc(d, p, M, k, T), t.closePath(), t.fillStyle = x + "cc", t.fill(), t.strokeStyle = x, t.lineWidth = 1.5, t.stroke(), s.showLabels) {
4820
+ const P = k + (T - k) / 2, E = d + M * 0.65 * Math.cos(P), R = p + M * 0.65 * Math.sin(P), O = Math.round(I / r * 100);
4821
+ t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle = c.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${O}%`, E, R), t.restore();
4819
4822
  }
4820
4823
  });
4821
4824
  } else {
@@ -4827,33 +4830,33 @@ class ci {
4827
4830
  C += M / r * Math.PI * 2;
4828
4831
  return;
4829
4832
  }
4830
- const k = M / r * Math.PI * 2, T = C + S / 2, R = C + k - S / 2;
4831
- if (R <= T) {
4833
+ const k = M / r * Math.PI * 2, T = C + S / 2, x = C + k - S / 2;
4834
+ if (x <= T) {
4832
4835
  C += k;
4833
4836
  return;
4834
4837
  }
4835
4838
  const P = s._resolveSliceColor(w, I);
4836
- if (t.beginPath(), t.fillStyle = P, v <= 0 ? (t.moveTo(d, p), t.arc(d, p, h, T, R), t.lineTo(d, p)) : (t.moveTo(d + h * Math.cos(T), p + h * Math.sin(T)), t.arc(d, p, h, T, R), t.arc(d, p, v, R, T, !0), t.closePath()), t.fill(), s.showLabels) {
4837
- const E = T + (R - T) / 2, x = v + (h - v) / 2, O = d + x * Math.cos(E), W = p + x * Math.sin(E), B = Math.round(M / r * 100);
4838
- t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${B}%`, O, W), t.restore();
4839
+ if (t.beginPath(), t.fillStyle = P, v <= 0 ? (t.moveTo(d, p), t.arc(d, p, h, T, x), t.lineTo(d, p)) : (t.moveTo(d + h * Math.cos(T), p + h * Math.sin(T)), t.arc(d, p, h, T, x), t.arc(d, p, v, x, T, !0), t.closePath()), t.fill(), s.showLabels) {
4840
+ const E = T + (x - T) / 2, R = v + (h - v) / 2, O = d + R * Math.cos(E), W = p + R * Math.sin(E), B = Math.round(M / r * 100);
4841
+ t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle = c.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${B}%`, O, W), t.restore();
4839
4842
  }
4840
4843
  C += k;
4841
4844
  }), s.chartType === "donut" && s.showCenterText && v > 14) {
4842
4845
  const w = Math.round(r), I = Math.min(Math.floor(v * 0.52), 20), M = Math.min(Math.floor(v * 0.26), 10);
4843
- t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${I}px Inter, sans-serif`, t.fillStyle = l.centerTextColor, t.fillText(w.toString(), d, p - M * 0.5), s.centerLabel && (t.font = `${M}px Inter, sans-serif`, t.fillStyle = l.centerLabelColor, t.fillText(s.centerLabel, d, p + I * 0.6));
4846
+ t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${I}px Inter, sans-serif`, t.fillStyle = c.centerTextColor, t.fillText(w.toString(), d, p - M * 0.5), s.centerLabel && (t.font = `${M}px Inter, sans-serif`, t.fillStyle = c.centerLabelColor, t.fillText(s.centerLabel, d, p + I * 0.6));
4844
4847
  }
4845
4848
  }
4846
4849
  if (s.showLegend && s.slices.length > 0) {
4847
4850
  t.font = `${s.legendFontSize}px Inter, sans-serif`;
4848
4851
  const b = 2, v = n / b, S = s.legendFontSize + 8, C = a / 2 - f + 10, w = -n / 2 + 10;
4849
4852
  s.slices.forEach((I, M) => {
4850
- const k = M % b, T = Math.floor(M / b), R = w + k * v, P = C + T * S, E = s._resolveSliceColor(I, M), x = 7;
4851
- t.beginPath(), t.roundRect(R, P - x / 2, x, x, 2), t.fillStyle = E, t.fill(), t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = l.legendColor;
4852
- const O = Math.round((I.value || 0) / r * 100), W = `${I.label || "Item"} ${O}%`, B = v - x - 20;
4853
+ const k = M % b, T = Math.floor(M / b), x = w + k * v, P = C + T * S, E = s._resolveSliceColor(I, M), R = 7;
4854
+ t.beginPath(), t.roundRect(x, P - R / 2, R, R, 2), t.fillStyle = E, t.fill(), t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = c.legendColor;
4855
+ const O = Math.round((I.value || 0) / r * 100), W = `${I.label || "Item"} ${O}%`, B = v - R - 20;
4853
4856
  let $ = W;
4854
4857
  for (; t.measureText($).width > B && $.length > 4; )
4855
4858
  $ = $.slice(0, -4) + "…";
4856
- t.fillText($, R + x + 4, P);
4859
+ t.fillText($, x + R + 4, P);
4857
4860
  });
4858
4861
  }
4859
4862
  t.restore();
@@ -4861,33 +4864,33 @@ class ci {
4861
4864
  renderJoystick(t, i) {
4862
4865
  var p, y, m, b, v;
4863
4866
  const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.width) !== void 0 ? o.width : ((p = i.geometry) == null ? void 0 : p.width) ?? i.width ?? 100, s = (o == null ? void 0 : o.height) !== void 0 ? o.height : ((y = i.geometry) == null ? void 0 : y.height) ?? i.height ?? 100, n = Math.min(e, s) * 0.45, a = Math.min(e, s) * 0.15;
4864
- let r = i.handleX || 0, l = i.handleY || 0;
4865
- o && o.handleX !== void 0 && (r = o.handleX), o && o.handleY !== void 0 && (l = o.handleY), t.save();
4866
- let c = 0, f = 0;
4867
- i.handleOrigin === "top-left" ? (c = e / 2, f = s / 2) : i.handleOrigin === "bottom-right" && (c = -e / 2, f = -s / 2), t.translate(c, f), t.beginPath(), i.boundsShape === "square" ? t.rect(-n, -n, n * 2, n * 2) : t.arc(0, 0, n, 0, Math.PI * 2), t.fillStyle = "rgba(0,0,0,0.2)", (m = i.style) != null && m.fill && typeof i.style.fill == "string" ? t.fillStyle = i.style.fill : (b = i.style) != null && b.fill && i.style.fill.type === "solid" && (t.fillStyle = i.style.fill.color), t.fill(), (v = i.style) != null && v.stroke && i.style.stroke.isEnabled !== !1 && (t.lineWidth = i.style.stroke.width || 1, t.strokeStyle = i.style.stroke.color || "#000", t.stroke());
4867
+ let r = i.handleX || 0, c = i.handleY || 0;
4868
+ o && o.handleX !== void 0 && (r = o.handleX), o && o.handleY !== void 0 && (c = o.handleY), t.save();
4869
+ let l = 0, f = 0;
4870
+ i.handleOrigin === "top-left" ? (l = e / 2, f = s / 2) : i.handleOrigin === "bottom-right" && (l = -e / 2, f = -s / 2), t.translate(l, f), t.beginPath(), i.boundsShape === "square" ? t.rect(-n, -n, n * 2, n * 2) : t.arc(0, 0, n, 0, Math.PI * 2), t.fillStyle = "rgba(0,0,0,0.2)", (m = i.style) != null && m.fill && typeof i.style.fill == "string" ? t.fillStyle = i.style.fill : (b = i.style) != null && b.fill && i.style.fill.type === "solid" && (t.fillStyle = i.style.fill.color), t.fill(), (v = i.style) != null && v.stroke && i.style.stroke.isEnabled !== !1 && (t.lineWidth = i.style.stroke.width || 1, t.strokeStyle = i.style.stroke.color || "#000", t.stroke());
4868
4871
  const u = n - a;
4869
4872
  let h = 0, d = 0;
4870
- i.joystickType === "2D" ? (h = r * u, d = l * u) : i.joystickType === "1D_X" ? (h = r * u, d = 0) : i.joystickType === "1D_Y" && (h = 0, d = l * u), t.beginPath(), t.arc(h, d, a, 0, Math.PI * 2), t.fillStyle = "#fff", t.fill(), t.strokeStyle = "rgba(0,0,0,0.5)", t.lineWidth = 1, t.stroke(), t.restore();
4873
+ i.joystickType === "2D" ? (h = r * u, d = c * u) : i.joystickType === "1D_X" ? (h = r * u, d = 0) : i.joystickType === "1D_Y" && (h = 0, d = c * u), t.beginPath(), t.arc(h, d, a, 0, Math.PI * 2), t.fillStyle = "#fff", t.fill(), t.strokeStyle = "rgba(0,0,0,0.5)", t.lineWidth = 1, t.stroke(), t.restore();
4871
4874
  }
4872
4875
  getRadioGroupItemIndexAtPointer(t, i, o) {
4873
4876
  var M, k;
4874
4877
  const e = t.options || {}, s = this.objectStates.get(t.id) || {}, n = e.optionsList || [];
4875
4878
  if (n.length === 0) return null;
4876
- const a = s.width !== void 0 ? s.width : ((M = t.geometry) == null ? void 0 : M.width) || 180, r = s.height !== void 0 ? s.height : ((k = t.geometry) == null ? void 0 : k.height) || 100, l = e.orientation || "vertical", c = e.itemGap !== void 0 ? e.itemGap : 16, f = e.fontSize || 14, u = this.getWorldTransform(t.id), h = i - u.x, d = o - u.y, p = -u.rotation * (Math.PI / 180), y = Math.cos(p), m = Math.sin(p), b = h * y - d * m, v = h * m + d * y, C = 8 * 2, w = -a / 2, I = -r / 2;
4877
- if (l === "vertical") {
4878
- const T = Math.max(C, f) + c;
4879
- for (let R = 0; R < n.length; R++) {
4880
- const P = I + R * T;
4879
+ const a = s.width !== void 0 ? s.width : ((M = t.geometry) == null ? void 0 : M.width) || 180, r = s.height !== void 0 ? s.height : ((k = t.geometry) == null ? void 0 : k.height) || 100, c = e.orientation || "vertical", l = e.itemGap !== void 0 ? e.itemGap : 16, f = e.fontSize || 14, u = this.getWorldTransform(t.id), h = i - u.x, d = o - u.y, p = -u.rotation * (Math.PI / 180), y = Math.cos(p), m = Math.sin(p), b = h * y - d * m, v = h * m + d * y, C = 8 * 2, w = -a / 2, I = -r / 2;
4880
+ if (c === "vertical") {
4881
+ const T = Math.max(C, f) + l;
4882
+ for (let x = 0; x < n.length; x++) {
4883
+ const P = I + x * T;
4881
4884
  if (b >= w && b <= w + a && v >= P && v <= P + T)
4882
- return R;
4885
+ return x;
4883
4886
  }
4884
4887
  } else {
4885
4888
  let T = w;
4886
- for (let R = 0; R < n.length; R++) {
4887
- const E = n[R].length * 8, x = C + 6 + E + c;
4888
- if (b >= T && b <= T + x && v >= I && v <= I + r)
4889
- return R;
4890
- T += x;
4889
+ for (let x = 0; x < n.length; x++) {
4890
+ const E = n[x].length * 8, R = C + 6 + E + l;
4891
+ if (b >= T && b <= T + R && v >= I && v <= I + r)
4892
+ return x;
4893
+ T += R;
4891
4894
  }
4892
4895
  }
4893
4896
  return null;
@@ -4929,10 +4932,10 @@ class ci {
4929
4932
  }
4930
4933
  p._resolvedData = y;
4931
4934
  }), r < 2) return;
4932
- const l = a - n, c = o / (r - 1), f = (p) => {
4933
- const y = l === 0 ? 0.5 : (p - n) / l;
4935
+ const c = a - n, l = o / (r - 1), f = (p) => {
4936
+ const y = c === 0 ? 0.5 : (p - n) / c;
4934
4937
  return e / 2 - y * e;
4935
- }, u = (p) => p * c - o / 2, h = i.axisColor || "#333333";
4938
+ }, u = (p) => p * l - o / 2, h = i.axisColor || "#333333";
4936
4939
  if (i.showXAxis && (t.beginPath(), t.strokeStyle = i.xAxisColor || h, t.lineWidth = 1, t.moveTo(-o / 2, e / 2), t.lineTo(o / 2, e / 2), t.stroke()), i.showYAxis && (t.beginPath(), t.strokeStyle = i.yAxisColor || h, t.lineWidth = 1, t.moveTo(-o / 2, -e / 2), t.lineTo(-o / 2, e / 2), t.stroke()), t.fillStyle = i.axisLabelColor || "#333333", t.font = `${i.axisLabelFontSize || 10}px Inter, sans-serif`, i.showXLabels) {
4937
4940
  t.textAlign = "center", t.textBaseline = "top";
4938
4941
  for (let p = 0; p < r; p++) {
@@ -4992,8 +4995,8 @@ class ci {
4992
4995
  }
4993
4996
  }
4994
4997
  _catmullRom(t, i, o, e, s) {
4995
- const n = (o - t) * 0.5, a = (e - i) * 0.5, r = s * s, l = s * r;
4996
- return (2 * i - 2 * o + n + a) * l + (-3 * i + 3 * o - 2 * n - a) * r + n * s + i;
4998
+ const n = (o - t) * 0.5, a = (e - i) * 0.5, r = s * s, c = s * r;
4999
+ return (2 * i - 2 * o + n + a) * c + (-3 * i + 3 * o - 2 * n - a) * r + n * s + i;
4997
5000
  }
4998
5001
  normalizeOpacity(t) {
4999
5002
  const i = typeof t == "number" ? t : parseFloat(String(t));
@@ -5004,19 +5007,19 @@ class ci {
5004
5007
  if (!i || i.type === "None") return null;
5005
5008
  if (typeof i == "string") return i;
5006
5009
  if (i.type === "Solid" && i.color) {
5007
- const r = i.color, c = (((n = (s = this.artboard) == null ? void 0 : s.tokens) == null ? void 0 : n.colors) || {})[r] || r;
5008
- return t.fillStyle = c, c;
5010
+ const r = i.color, l = (((n = (s = this.artboard) == null ? void 0 : s.tokens) == null ? void 0 : n.colors) || {})[r] || r;
5011
+ return t.fillStyle = l, l;
5009
5012
  }
5010
5013
  if ((i.type === "LinearGradient" || i.type === "RadialGradient" || i.type === "AngularGradient" || i.type === "DiamondGradient") && i.stops) {
5011
- const r = (l, c = 100) => {
5014
+ const r = (c, l = 100) => {
5012
5015
  var S, C;
5013
- const u = (((C = (S = this.artboard) == null ? void 0 : S.tokens) == null ? void 0 : C.colors) || {})[l] || l, h = this.normalizeOpacity(i.opacity ?? 100), p = this.normalizeOpacity(c) * h;
5016
+ const u = (((C = (S = this.artboard) == null ? void 0 : S.tokens) == null ? void 0 : C.colors) || {})[c] || c, h = this.normalizeOpacity(i.opacity ?? 100), p = this.normalizeOpacity(l) * h;
5014
5017
  if (p >= 1 && u.startsWith("#")) return u;
5015
5018
  const y = u.startsWith("#") ? u.replace("#", "") : "ffffff", m = parseInt(y.substring(0, 2), 16), b = parseInt(y.substring(2, 4), 16), v = parseInt(y.substring(4, 6), 16);
5016
5019
  return `rgba(${m}, ${b}, ${v}, ${p})`;
5017
5020
  };
5018
5021
  if (i.type === "LinearGradient") {
5019
- const l = (p, y, m) => Array.isArray(p) ? p[y] ?? (y === 0 ? 0 : 1) : p && typeof p == "object" ? p[m] ?? (y === 0 ? 0 : 1) : y === 0 ? 0 : 1, c = l(i.start, 0, "x") * o - o / 2, f = l(i.start, 1, "y") * e - e / 2, u = l(i.end, 0, "x") * o - o / 2, h = l(i.end, 1, "y") * e - e / 2, d = t.createLinearGradient(c, f, u, h);
5022
+ const c = (p, y, m) => Array.isArray(p) ? p[y] ?? (y === 0 ? 0 : 1) : p && typeof p == "object" ? p[m] ?? (y === 0 ? 0 : 1) : y === 0 ? 0 : 1, l = c(i.start, 0, "x") * o - o / 2, f = c(i.start, 1, "y") * e - e / 2, u = c(i.end, 0, "x") * o - o / 2, h = c(i.end, 1, "y") * e - e / 2, d = t.createLinearGradient(l, f, u, h);
5020
5023
  if (i.stops.forEach((p) => {
5021
5024
  const y = p.offset !== void 0 ? p.offset : p.pos !== void 0 ? p.pos : p.position !== void 0 ? p.position : 0, m = r(p.color || "#000000", p.opacity ?? 100);
5022
5025
  d.addColorStop(Math.max(0, Math.min(1, y)), m);
@@ -5026,7 +5029,7 @@ class ci {
5026
5029
  }
5027
5030
  return d;
5028
5031
  } else if (i.type === "RadialGradient") {
5029
- const l = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, c = l(i.center, 0, "x") * o - o / 2, f = l(i.center, 1, "y") * e - e / 2, u = (i.radius ?? 0.5) * Math.max(o, e), h = t.createRadialGradient(c, f, 0, c, f, u);
5032
+ const c = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, l = c(i.center, 0, "x") * o - o / 2, f = c(i.center, 1, "y") * e - e / 2, u = (i.radius ?? 0.5) * Math.max(o, e), h = t.createRadialGradient(l, f, 0, l, f, u);
5030
5033
  if (i.stops.forEach((d) => {
5031
5034
  const p = d.offset !== void 0 ? d.offset : d.pos !== void 0 ? d.pos : d.position !== void 0 ? d.position : 0, y = r(d.color || "#000000", d.opacity ?? 100);
5032
5035
  h.addColorStop(Math.max(0, Math.min(1, p)), y);
@@ -5036,7 +5039,7 @@ class ci {
5036
5039
  }
5037
5040
  return h;
5038
5041
  } else if (i.type === "AngularGradient") {
5039
- const l = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, c = l(i.center || [0.5, 0.5], 0, "x") * o - o / 2, f = l(i.center || [0.5, 0.5], 1, "y") * e - e / 2, u = (i.degree || i.angle || 0) * (Math.PI / 180), h = (a = t.createConicGradient) == null ? void 0 : a.call(t, u, c, f);
5042
+ const c = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, l = c(i.center || [0.5, 0.5], 0, "x") * o - o / 2, f = c(i.center || [0.5, 0.5], 1, "y") * e - e / 2, u = (i.degree || i.angle || 0) * (Math.PI / 180), h = (a = t.createConicGradient) == null ? void 0 : a.call(t, u, l, f);
5040
5043
  if (h) {
5041
5044
  if (i.stops.forEach((d) => {
5042
5045
  const p = d.offset !== void 0 ? d.offset : d.pos !== void 0 ? d.pos : d.position !== void 0 ? d.position : 0, y = r(d.color || "#000000", d.opacity ?? 100);
@@ -5048,8 +5051,8 @@ class ci {
5048
5051
  return h;
5049
5052
  }
5050
5053
  } else if (i.type === "DiamondGradient") {
5051
- const l = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, c = l(i.center || [0.5, 0.5], 0, "x") * o - o / 2, f = l(i.center || [0.5, 0.5], 1, "y") * e - e / 2, u = (i.radius ?? 0.5) * Math.max(o, e);
5052
- t.save(), t.translate(c, f), t.rotate(Math.PI / 4);
5054
+ const c = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, l = c(i.center || [0.5, 0.5], 0, "x") * o - o / 2, f = c(i.center || [0.5, 0.5], 1, "y") * e - e / 2, u = (i.radius ?? 0.5) * Math.max(o, e);
5055
+ t.save(), t.translate(l, f), t.rotate(Math.PI / 4);
5053
5056
  const h = t.createRadialGradient(0, 0, 0, 0, 0, u);
5054
5057
  if (i.stops.forEach((d) => {
5055
5058
  const p = d.offset !== void 0 ? d.offset : d.pos !== void 0 ? d.pos : d.position !== void 0 ? d.position : 0, y = r(d.color || "#000000", d.opacity ?? 100);
@@ -5064,12 +5067,12 @@ class ci {
5064
5067
  if (i.type === "Pattern" && i.url) {
5065
5068
  let r = this.imageCache.get(i.url);
5066
5069
  if (r || (r = new Image(), r.src = i.url, this.imageCache.set(i.url, r)), r.complete && r.naturalWidth > 0) {
5067
- const l = t.createPattern(r, "repeat");
5068
- if (l && (i.scaleX !== void 0 || i.offsetX !== void 0)) {
5069
- const c = new DOMMatrix(), f = i.scaleX ?? 1, u = i.scaleY ?? 1, h = i.offsetX ?? 0, d = i.offsetY ?? 0, p = i.rotation ?? 0;
5070
- c.translateSelf(h, d), c.rotateSelf(p), c.scaleSelf(f, u), l.setTransform(c);
5070
+ const c = t.createPattern(r, "repeat");
5071
+ if (c && (i.scaleX !== void 0 || i.offsetX !== void 0)) {
5072
+ const l = new DOMMatrix(), f = i.scaleX ?? 1, u = i.scaleY ?? 1, h = i.offsetX ?? 0, d = i.offsetY ?? 0, p = i.rotation ?? 0;
5073
+ l.translateSelf(h, d), l.rotateSelf(p), l.scaleSelf(f, u), c.setTransform(l);
5071
5074
  }
5072
- return l;
5075
+ return c;
5073
5076
  }
5074
5077
  }
5075
5078
  return i.color || null;
@@ -5086,45 +5089,45 @@ class ci {
5086
5089
  } catch {
5087
5090
  a = parseFloat(a) || 0;
5088
5091
  }
5089
- let r = 0, l = 0, c = 0, f = 0;
5090
- typeof a == "number" ? r = l = c = f = a : Array.isArray(a) ? a.length === 1 ? r = l = c = f = a[0] : a.length === 2 ? (r = c = a[0], l = f = a[1]) : a.length === 3 ? (r = a[0], l = f = a[1], c = a[2]) : a.length >= 4 && (r = a[0], l = a[1], c = a[2], f = a[3]) : a && typeof a == "object" && (r = a.tl ?? a.corner_radius ?? a.cornerRadius ?? 0, l = a.tr ?? a.corner_radius ?? a.cornerRadius ?? 0, c = a.br ?? a.corner_radius ?? a.cornerRadius ?? 0, f = a.bl ?? a.corner_radius ?? a.cornerRadius ?? 0);
5092
+ let r = 0, c = 0, l = 0, f = 0;
5093
+ typeof a == "number" ? r = c = l = f = a : Array.isArray(a) ? a.length === 1 ? r = c = l = f = a[0] : a.length === 2 ? (r = l = a[0], c = f = a[1]) : a.length === 3 ? (r = a[0], c = f = a[1], l = a[2]) : a.length >= 4 && (r = a[0], c = a[1], l = a[2], f = a[3]) : a && typeof a == "object" && (r = a.tl ?? a.corner_radius ?? a.cornerRadius ?? 0, c = a.tr ?? a.corner_radius ?? a.cornerRadius ?? 0, l = a.br ?? a.corner_radius ?? a.cornerRadius ?? 0, f = a.bl ?? a.corner_radius ?? a.cornerRadius ?? 0);
5091
5094
  const u = Math.min(Math.abs(e) / 2, Math.abs(s) / 2);
5092
- if (r = Math.min(Math.max(0, r), u), l = Math.min(Math.max(0, l), u), c = Math.min(Math.max(0, c), u), f = Math.min(Math.max(0, f), u), t.roundRect) {
5093
- t.roundRect(i, o, e, s, [r, l, c, f]);
5095
+ if (r = Math.min(Math.max(0, r), u), c = Math.min(Math.max(0, c), u), l = Math.min(Math.max(0, l), u), f = Math.min(Math.max(0, f), u), t.roundRect) {
5096
+ t.roundRect(i, o, e, s, [r, c, l, f]);
5094
5097
  return;
5095
5098
  }
5096
- t.moveTo(i + r, o), t.lineTo(i + e - l, o), t.arcTo(i + e, o, i + e, o + l, l), t.lineTo(i + e, o + s - c), t.arcTo(i + e, o + s, i + e - c, o + s, c), t.lineTo(i + f, o + s), t.arcTo(i, o + s, i, o + s - f, f), t.lineTo(i, o + r), t.arcTo(i, o, i + r, o, r), t.closePath();
5099
+ t.moveTo(i + r, o), t.lineTo(i + e - c, o), t.arcTo(i + e, o, i + e, o + c, c), t.lineTo(i + e, o + s - l), t.arcTo(i + e, o + s, i + e - l, o + s, l), t.lineTo(i + f, o + s), t.arcTo(i, o + s, i, o + s - f, f), t.lineTo(i, o + r), t.arcTo(i, o, i + r, o, r), t.closePath();
5097
5100
  }
5098
5101
  renderListView(t, i) {
5099
5102
  var O, W, B, $;
5100
- const o = this.objectStates.get(i.id) || {}, e = o.options || i.options || {}, s = o.width !== void 0 ? o.width : ((O = i.geometry) == null ? void 0 : O.width) || 200, n = o.height !== void 0 ? o.height : ((W = i.geometry) == null ? void 0 : W.height) || 300, a = -s / 2, r = -n / 2, l = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0, c = e.orientation || "vertical", f = e.items || [], u = e.itemGap ?? 10, h = e.itemHeight ?? 50, d = e.itemWidth ?? 200, p = e.scrollOffset ?? 0, y = e.padding ?? 0, m = e.glassEffect !== !1, b = e.accentColor || "#3b82f6", v = e.itemTextColor || "#333333", S = e.itemBackgroundColor || "#ffffff", C = e.hoveredIndex ?? null, w = e.activeItemIndex ?? null, I = e.glowIntensity ?? 0, M = e.glowColor || "#3b82f6", k = typeof M == "string" ? M : M.color || (($ = (B = M.stops) == null ? void 0 : B[0]) == null ? void 0 : $.color) || "#3b82f6", T = e.opacity !== void 0 ? e.opacity : i.opacity !== void 0 ? i.opacity : 1;
5103
+ const o = this.objectStates.get(i.id) || {}, e = o.options || i.options || {}, s = o.width !== void 0 ? o.width : ((O = i.geometry) == null ? void 0 : O.width) || 200, n = o.height !== void 0 ? o.height : ((W = i.geometry) == null ? void 0 : W.height) || 300, a = -s / 2, r = -n / 2, c = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0, l = e.orientation || "vertical", f = e.items || [], u = e.itemGap ?? 10, h = e.itemHeight ?? 50, d = e.itemWidth ?? 200, p = e.scrollOffset ?? 0, y = e.padding ?? 0, m = e.glassEffect !== !1, b = e.accentColor || "#3b82f6", v = e.itemTextColor || "#333333", S = e.itemBackgroundColor || "#ffffff", C = e.hoveredIndex ?? null, w = e.activeItemIndex ?? null, I = e.glowIntensity ?? 0, M = e.glowColor || "#3b82f6", k = typeof M == "string" ? M : M.color || (($ = (B = M.stops) == null ? void 0 : B[0]) == null ? void 0 : $.color) || "#3b82f6", T = e.opacity !== void 0 ? e.opacity : i.opacity !== void 0 ? i.opacity : 1;
5101
5104
  if (t.save(), t.globalAlpha *= T, I > 0) {
5102
5105
  const Y = t.getTransform(), H = Math.sqrt(Y.a * Y.a + Y.b * Y.b) || 1;
5103
5106
  t.shadowColor = k, t.shadowBlur = I * 2 * H, t.shadowOffsetX = 0, t.shadowOffsetY = 0;
5104
5107
  }
5105
5108
  if (m) {
5106
5109
  const Y = e.listBackgroundColor || "rgba(31, 41, 55, 0.4)", H = this.createCanvasFill(t, Y, s, n);
5107
- t.fillStyle = H || "rgba(31, 41, 55, 0.4)", t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, l) || t.fill();
5110
+ t.fillStyle = H || "rgba(31, 41, 55, 0.4)", t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c) || t.fill();
5108
5111
  const A = t.createLinearGradient(a, r, a + s, r + n);
5109
- A.addColorStop(0, "rgba(255, 255, 255, 0.15)"), A.addColorStop(0.5, "rgba(255, 255, 255, 0.08)"), A.addColorStop(1, "rgba(255, 255, 255, 0.03)"), t.fillStyle = A, t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, l) || t.fill(), t.strokeStyle = "rgba(255, 255, 255, 0.25)", t.lineWidth = 1, t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, l) || t.stroke();
5112
+ A.addColorStop(0, "rgba(255, 255, 255, 0.15)"), A.addColorStop(0.5, "rgba(255, 255, 255, 0.08)"), A.addColorStop(1, "rgba(255, 255, 255, 0.03)"), t.fillStyle = A, t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c) || t.fill(), t.strokeStyle = "rgba(255, 255, 255, 0.25)", t.lineWidth = 1, t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c) || t.stroke();
5110
5113
  } else {
5111
5114
  const Y = e.backgroundColor || e.listBackgroundColor || "transparent", H = this.createCanvasFill(t, Y, s, n);
5112
5115
  if (H) {
5113
5116
  t.fillStyle = H, t.beginPath();
5114
- const A = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, l);
5117
+ const A = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c);
5115
5118
  t.fill();
5116
5119
  }
5117
5120
  const K = e.borderWidth ?? 0;
5118
5121
  if (K > 0) {
5119
5122
  t.strokeStyle = e.borderColor || "#cccccc", t.lineWidth = K, t.beginPath();
5120
- const A = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, l);
5123
+ const A = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c);
5121
5124
  t.stroke();
5122
5125
  }
5123
5126
  }
5124
5127
  t.shadowBlur = 0, t.save(), t.beginPath();
5125
- const R = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, l);
5128
+ const x = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c);
5126
5129
  if (e.listLayout !== "circular")
5127
- if (R && e.containerShape === "custom")
5130
+ if (x && e.containerShape === "custom")
5128
5131
  try {
5129
5132
  const Y = new Path2D(e.containerPath);
5130
5133
  t.translate(a, r), t.scale(s / 100, n / 100), t.clip(Y), t.scale(100 / s, 100 / n), t.translate(-a, -r);
@@ -5132,55 +5135,55 @@ class ci {
5132
5135
  }
5133
5136
  else
5134
5137
  t.clip();
5135
- const P = typeof y == "number" ? y : c === "vertical" ? y[0] : y[3];
5136
- let E = (c === "vertical" ? r : a) + p + P;
5138
+ const P = typeof y == "number" ? y : l === "vertical" ? y[0] : y[3];
5139
+ let E = (l === "vertical" ? r : a) + p + P;
5137
5140
  if (t.textBaseline = "middle", f.forEach((Y, H) => {
5138
- const K = e.listLayout || "linear", A = K === "circular" ? d : c === "vertical" ? s : d, _ = K === "circular" || c === "vertical" ? h : n;
5141
+ const K = e.listLayout || "linear", A = K === "circular" ? d : l === "vertical" ? s : d, _ = K === "circular" || l === "vertical" ? h : n;
5139
5142
  let L = 0, X = 0, V = 0;
5140
5143
  if (K === "circular") {
5141
- const Tt = f.length || 1, zt = Math.PI * 2 / Tt, Z = e.circularStartAngle || 0, pt = e.circularRadius || 100, Et = p * 0.01 + Z * Math.PI / 180, ut = H * zt + Et, vt = a + s / 2, xt = r + n / 2;
5142
- L = vt + Math.cos(ut) * pt - A / 2, X = xt + Math.sin(ut) * pt - _ / 2, V = ut + (e.itemRotation || 0) * Math.PI / 180;
5144
+ const Tt = f.length || 1, zt = Math.PI * 2 / Tt, Z = e.circularStartAngle || 0, pt = e.circularRadius || 100, Et = p * 0.01 + Z * Math.PI / 180, ut = H * zt + Et, vt = a + s / 2, Rt = r + n / 2;
5145
+ L = vt + Math.cos(ut) * pt - A / 2, X = Rt + Math.sin(ut) * pt - _ / 2, V = ut + (e.itemRotation || 0) * Math.PI / 180;
5143
5146
  } else
5144
- L = c === "vertical" ? a : E, X = c === "vertical" ? E : r, V = (e.itemRotation || 0) * Math.PI / 180;
5145
- const it = C === H, rt = w === H, nt = rt && e.activeItemShape ? e.activeItemShape : e.itemShape || "rectangle", yt = rt && e.activeItemShape ? e.activeItemPath : e.itemPath || "", ct = e.itemCornerRadius || 0;
5146
- if (t.save(), V !== 0 && (t.translate(L + A / 2, X + _ / 2), t.rotate(V), t.translate(-(L + A / 2), -(X + _ / 2))), rt) {
5147
+ L = l === "vertical" ? a : E, X = l === "vertical" ? E : r, V = (e.itemRotation || 0) * Math.PI / 180;
5148
+ const it = C === H, lt = w === H, nt = lt && e.activeItemShape ? e.activeItemShape : e.itemShape || "rectangle", bt = lt && e.activeItemShape ? e.activeItemPath : e.itemPath || "", ht = e.itemCornerRadius || 0;
5149
+ if (t.save(), V !== 0 && (t.translate(L + A / 2, X + _ / 2), t.rotate(V), t.translate(-(L + A / 2), -(X + _ / 2))), lt) {
5147
5150
  const Tt = this.createCanvasFill(t, b, A, _);
5148
5151
  t.fillStyle = Tt || b;
5149
5152
  const zt = t.globalAlpha;
5150
- t.globalAlpha = zt * 0.8, t.beginPath(), this.drawCustomShape(t, nt, yt, L, X, A, _, ct) || (t.rect(L, X, A, _), t.fill()), t.globalAlpha = zt;
5153
+ t.globalAlpha = zt * 0.8, t.beginPath(), this.drawCustomShape(t, nt, bt, L, X, A, _, ht) || (t.rect(L, X, A, _), t.fill()), t.globalAlpha = zt;
5151
5154
  } else if (it)
5152
- t.fillStyle = m ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.beginPath(), this.drawCustomShape(t, nt, yt, L, X, A, _, ct) || (t.rect(L, X, A, _), t.fill());
5155
+ t.fillStyle = m ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.beginPath(), this.drawCustomShape(t, nt, bt, L, X, A, _, ht) || (t.rect(L, X, A, _), t.fill());
5153
5156
  else if (S !== "transparent") {
5154
5157
  const Tt = this.createCanvasFill(t, S, A, _);
5155
- t.fillStyle = Tt || S, t.beginPath(), this.drawCustomShape(t, nt, yt, L, X, A, _, ct) || (t.rect(L, X, A, _), t.fill());
5158
+ t.fillStyle = Tt || S, t.beginPath(), this.drawCustomShape(t, nt, bt, L, X, A, _, ht) || (t.rect(L, X, A, _), t.fill());
5156
5159
  }
5157
- if (rt || it) {
5158
- const Tt = this.createCanvasFill(t, b, c === "vertical" ? 3 : A, c === "vertical" ? _ : 3);
5159
- t.fillStyle = Tt || b, c === "vertical" ? t.fillRect(L, X, 3, _) : t.fillRect(L, X + _ - 3, A, 3);
5160
+ if (lt || it) {
5161
+ const Tt = this.createCanvasFill(t, b, l === "vertical" ? 3 : A, l === "vertical" ? _ : 3);
5162
+ t.fillStyle = Tt || b, l === "vertical" ? t.fillRect(L, X, 3, _) : t.fillRect(L, X + _ - 3, A, 3);
5160
5163
  }
5161
- const wt = rt ? "#ffffff" : m ? "rgba(255, 255, 255, 0.9)" : v;
5162
- t.fillStyle = wt, t.font = rt || it ? "600 14px Inter, sans-serif" : "400 14px Inter, sans-serif";
5163
- const Mt = typeof Y == "string" ? Y : (Y == null ? void 0 : Y.label) || `Item ${H + 1}`, It = L + (c === "vertical" ? 16 : A / 2), Ot = X + _ / 2;
5164
- c === "horizontal" || K === "circular" ? t.textAlign = "center" : t.textAlign = "left";
5164
+ const wt = lt ? "#ffffff" : m ? "rgba(255, 255, 255, 0.9)" : v;
5165
+ t.fillStyle = wt, t.font = lt || it ? "600 14px Inter, sans-serif" : "400 14px Inter, sans-serif";
5166
+ const Mt = typeof Y == "string" ? Y : (Y == null ? void 0 : Y.label) || `Item ${H + 1}`, It = L + (l === "vertical" ? 16 : A / 2), Ot = X + _ / 2;
5167
+ l === "horizontal" || K === "circular" ? t.textAlign = "center" : t.textAlign = "left";
5165
5168
  const At = K === "circular" ? L + A / 2 : It;
5166
- t.fillText(Mt, At, Ot), t.restore(), E += (c === "vertical" ? h : d) + u;
5169
+ t.fillText(Mt, At, Ot), t.restore(), E += (l === "vertical" ? h : d) + u;
5167
5170
  }), t.restore(), e.showScrollbar !== !1) {
5168
- const Y = (f.length || 0) * (c === "vertical" ? h : d) + ((f.length || 0) - 1) * u, H = c === "vertical" ? n : s, K = e.listLayout || "linear", A = e.containerShape === "circle" || K === "circular";
5171
+ const Y = (f.length || 0) * (l === "vertical" ? h : d) + ((f.length || 0) - 1) * u, H = l === "vertical" ? n : s, K = e.listLayout || "linear", A = e.containerShape === "circle" || K === "circular";
5169
5172
  if (Y > H || K === "circular" && f.length > 0) {
5170
5173
  const _ = e.scrollbarColor || "rgba(255,255,255,0.3)", L = e.scrollbarWidth || 4;
5171
5174
  if (A) {
5172
5175
  const X = Math.min(s, n) / 2 - L / 2 - 2, V = a + s / 2, it = r + n / 2;
5173
5176
  if (t.strokeStyle = _, t.lineWidth = L, t.lineCap = "round", t.beginPath(), K === "circular") {
5174
- const rt = Math.PI / 4, nt = -(p * 0.01) - Math.PI / 2;
5175
- t.arc(V, it, X, nt, nt + rt);
5177
+ const lt = Math.PI / 4, nt = -(p * 0.01) - Math.PI / 2;
5178
+ t.arc(V, it, X, nt, nt + lt);
5176
5179
  } else {
5177
- const rt = Math.PI / 2, nt = H / Y, yt = rt * nt, ct = -p / Y * rt, Mt = -Math.PI / 4 + ct;
5178
- t.arc(V, it, X, Mt, Mt + yt);
5180
+ const lt = Math.PI / 2, nt = H / Y, bt = lt * nt, ht = -p / Y * lt, Mt = -Math.PI / 4 + ht;
5181
+ t.arc(V, it, X, Mt, Mt + bt);
5179
5182
  }
5180
5183
  t.stroke();
5181
5184
  } else {
5182
5185
  const X = H / Y, V = H * X, it = -p / Y * H;
5183
- t.fillStyle = _, c === "vertical" ? t.fillRect(a + s - L - 2, r + it, L, V) : t.fillRect(a + it, r + n - L - 2, V, L);
5186
+ t.fillStyle = _, l === "vertical" ? t.fillRect(a + s - L - 2, r + it, L, V) : t.fillRect(a + it, r + n - L - 2, V, L);
5184
5187
  }
5185
5188
  }
5186
5189
  }
@@ -5188,15 +5191,15 @@ class ci {
5188
5191
  }
5189
5192
  drawCustomShape(t, i, o, e, s, n, a, r) {
5190
5193
  if (i === "circle") {
5191
- const l = Math.min(n, a) / 2;
5192
- return t.arc(e + n / 2, s + a / 2, l, 0, Math.PI * 2), !1;
5194
+ const c = Math.min(n, a) / 2;
5195
+ return t.arc(e + n / 2, s + a / 2, c, 0, Math.PI * 2), !1;
5193
5196
  } else if (i === "pill") {
5194
- const l = Math.min(n, a) / 2;
5195
- return this.drawListViewRect(t, e, s, n, a, l), !1;
5197
+ const c = Math.min(n, a) / 2;
5198
+ return this.drawListViewRect(t, e, s, n, a, c), !1;
5196
5199
  } else if (i === "custom" && o)
5197
5200
  try {
5198
- const l = new Path2D(o);
5199
- return t.save(), t.translate(e, s), t.scale(n / 100, a / 100), t.fill(l), t.restore(), !0;
5201
+ const c = new Path2D(o);
5202
+ return t.save(), t.translate(e, s), t.scale(n / 100, a / 100), t.fill(c), t.restore(), !0;
5200
5203
  } catch {
5201
5204
  return this.drawListViewRect(t, e, s, n, a, r), !1;
5202
5205
  }
@@ -5207,10 +5210,10 @@ class ci {
5207
5210
  if (!this._lastPointerPos || !this._prevPointerPos) return;
5208
5211
  const i = t.options || {}, o = i.orientation || "vertical", e = this._lastPointerPos.x - this._prevPointerPos.x, s = this._lastPointerPos.y - this._prevPointerPos.y;
5209
5212
  o === "vertical" ? i.scrollOffset = (i.scrollOffset || 0) + s : i.scrollOffset = (i.scrollOffset || 0) + e;
5210
- const n = i.listLayout || "linear", a = this.objectStates.get(t.id) || {}, r = i.items || [], l = i.itemGap ?? 10, c = i.itemHeight ?? 50, f = i.itemWidth ?? 200, u = a.width !== void 0 ? a.width : ((m = t.geometry) == null ? void 0 : m.width) || 200, h = a.height !== void 0 ? a.height : ((b = t.geometry) == null ? void 0 : b.height) || 300;
5213
+ const n = i.listLayout || "linear", a = this.objectStates.get(t.id) || {}, r = i.items || [], c = i.itemGap ?? 10, l = i.itemHeight ?? 50, f = i.itemWidth ?? 200, u = a.width !== void 0 ? a.width : ((m = t.geometry) == null ? void 0 : m.width) || 200, h = a.height !== void 0 ? a.height : ((b = t.geometry) == null ? void 0 : b.height) || 300;
5211
5214
  if (n === "circular")
5212
5215
  return;
5213
- const d = (r.length || 0) * (o === "vertical" ? c : f) + ((r.length || 0) - 1) * l, y = Math.max(0, d - (o === "vertical" ? h : u) + (i.padding * 2 || 0));
5216
+ const d = (r.length || 0) * (o === "vertical" ? l : f) + ((r.length || 0) - 1) * c, y = Math.max(0, d - (o === "vertical" ? h : u) + (i.padding * 2 || 0));
5214
5217
  i.scrollOffset > 0 && (i.scrollOffset = 0), i.scrollOffset < -y && (i.scrollOffset = -y);
5215
5218
  }
5216
5219
  updateListViewHoverFromPointer(t, i, o) {
@@ -5221,24 +5224,24 @@ class ci {
5221
5224
  var B, $;
5222
5225
  const e = t.options || {}, s = this.objectStates.get(t.id) || {}, n = e.items || [];
5223
5226
  if (n.length === 0) return null;
5224
- const a = s.width !== void 0 ? s.width : ((B = t.geometry) == null ? void 0 : B.width) || 200, r = s.height !== void 0 ? s.height : (($ = t.geometry) == null ? void 0 : $.height) || 300, l = e.orientation || "vertical", c = e.itemGap ?? 10, f = e.itemHeight ?? 50, u = e.itemWidth ?? 200, h = e.scrollOffset ?? 0, d = e.padding ?? 0, p = this.getWorldTransform(t.id), y = i - p.x, m = o - p.y, b = -p.rotation * (Math.PI / 180), v = Math.cos(b), S = Math.sin(b), C = y * v - m * S, w = y * S + m * v, I = -a / 2, M = -r / 2, k = typeof d == "number" ? d : l === "vertical" ? d[0] : d[3];
5225
- let T = (l === "vertical" ? M : I) + h + k;
5226
- const R = e.listLayout || "linear", P = n.length || 1, E = Math.PI * 2 / P, x = e.circularStartAngle || 0, O = e.circularRadius || 100, W = h * 0.01 + x * Math.PI / 180;
5227
+ const a = s.width !== void 0 ? s.width : ((B = t.geometry) == null ? void 0 : B.width) || 200, r = s.height !== void 0 ? s.height : (($ = t.geometry) == null ? void 0 : $.height) || 300, c = e.orientation || "vertical", l = e.itemGap ?? 10, f = e.itemHeight ?? 50, u = e.itemWidth ?? 200, h = e.scrollOffset ?? 0, d = e.padding ?? 0, p = this.getWorldTransform(t.id), y = i - p.x, m = o - p.y, b = -p.rotation * (Math.PI / 180), v = Math.cos(b), S = Math.sin(b), C = y * v - m * S, w = y * S + m * v, I = -a / 2, M = -r / 2, k = typeof d == "number" ? d : c === "vertical" ? d[0] : d[3];
5228
+ let T = (c === "vertical" ? M : I) + h + k;
5229
+ const x = e.listLayout || "linear", P = n.length || 1, E = Math.PI * 2 / P, R = e.circularStartAngle || 0, O = e.circularRadius || 100, W = h * 0.01 + R * Math.PI / 180;
5227
5230
  for (let Y = 0; Y < n.length; Y++) {
5228
- const H = R === "circular" ? u : l === "vertical" ? a : u, K = R === "circular" || l === "vertical" ? f : r;
5231
+ const H = x === "circular" ? u : c === "vertical" ? a : u, K = x === "circular" || c === "vertical" ? f : r;
5229
5232
  let A = 0, _ = 0, L = 0;
5230
- if (R === "circular") {
5233
+ if (x === "circular") {
5231
5234
  const X = Y * E + W, V = I + a / 2, it = M + r / 2;
5232
5235
  A = V + Math.cos(X) * O - H / 2, _ = it + Math.sin(X) * O - K / 2, L = X + (e.itemRotation || 0) * Math.PI / 180;
5233
5236
  } else
5234
- A = l === "vertical" ? I : T, _ = l === "vertical" ? T : M, L = (e.itemRotation || 0) * Math.PI / 180;
5237
+ A = c === "vertical" ? I : T, _ = c === "vertical" ? T : M, L = (e.itemRotation || 0) * Math.PI / 180;
5235
5238
  if (L !== 0) {
5236
- const X = A + H / 2, V = _ + K / 2, it = C - X, rt = w - V, nt = -L, yt = it * Math.cos(nt) - rt * Math.sin(nt) + X, ct = it * Math.sin(nt) + rt * Math.cos(nt) + V;
5237
- if (yt >= A && yt <= A + H && ct >= _ && ct <= _ + K)
5239
+ const X = A + H / 2, V = _ + K / 2, it = C - X, lt = w - V, nt = -L, bt = it * Math.cos(nt) - lt * Math.sin(nt) + X, ht = it * Math.sin(nt) + lt * Math.cos(nt) + V;
5240
+ if (bt >= A && bt <= A + H && ht >= _ && ht <= _ + K)
5238
5241
  return Y;
5239
5242
  } else if (C >= A && C <= A + H && w >= _ && w <= _ + K)
5240
5243
  return Y;
5241
- T += (l === "vertical" ? f : u) + c;
5244
+ T += (c === "vertical" ? f : u) + l;
5242
5245
  }
5243
5246
  return null;
5244
5247
  }
@@ -5256,28 +5259,28 @@ class ci {
5256
5259
  if (!e.behaviors || e.behaviors.length === 0) return;
5257
5260
  const s = this.objectStates.get(e.id);
5258
5261
  s && e.behaviors.forEach((n) => {
5259
- var u, h, d, p, y, m, b, v, S, C, w, I, M, k, T, R, P, E, x, O, W, B, $, Y, H, K, A, _, L, X, V, it, rt, nt, yt, ct, wt, Mt, It, Ot, At, Tt, zt, Z, pt, Et, ut, vt, xt, Xt, Bt, Dt, Ht, te, ue, pe, Qt, me, _e, ye, Se, Pe, ae, ee, ht, bt, j, z, D, et, gt, Pt, Ct, Wt, mt, F, Lt, jt, Vt, ce, Rt, ft, lt, tt, dt, G, st, J, Ft, Ut, se, Yt, qt, Nt, Ce, Ee, Ae, Oe, Re, xe, $e, Gt, ie, be, Le, Fe, he, re, le, we, We, Ge, De, Be, ze, Ve, Ze, je;
5262
+ var u, h, d, p, y, m, b, v, S, C, w, I, M, k, T, x, P, E, R, O, W, B, $, Y, H, K, A, _, L, X, V, it, lt, nt, bt, ht, wt, Mt, It, Ot, At, Tt, zt, Z, pt, Et, ut, vt, Rt, Xt, Bt, Dt, Ht, te, ue, pe, Qt, me, _e, ye, Se, Pe, ae, ee, at, gt, j, z, D, et, mt, Pt, Ct, Wt, yt, F, Lt, jt, Vt, ce, xt, ft, ct, tt, dt, G, st, J, Ft, Ut, se, Yt, qt, Nt, Ce, Ee, Ae, Oe, xe, Re, $e, Gt, ie, be, Le, Fe, he, re, le, we, We, Ge, De, Be, ze, Ve, Ze, je;
5260
5263
  if (!n.enabled) return;
5261
5264
  const a = n.startTime || 0, r = n.endTime || 1 / 0;
5262
5265
  if (this.currentTime < a || this.currentTime > r) return;
5263
- const l = s.x - i, c = s.y - o, f = Math.sqrt(l * l + c * c);
5266
+ const c = s.x - i, l = s.y - o, f = Math.sqrt(c * c + l * l);
5264
5267
  if (this.frameCount % 240 === 0 && Math.random() < 0.1 && this.log(`[ExodeUI] Executing ${n.type} on ${e.name}`), n.type === N.Proximity) {
5265
5268
  const U = ((u = n.settings) == null ? void 0 : u.radius) || 300, Q = ((h = n.settings) == null ? void 0 : h.falloff) || "smooth";
5266
5269
  let q = 0;
5267
- f < U && (Q === "linear" ? q = 1 - f / U : q = Math.pow(1 - f / U, 2)), n.sensors.forEach((at) => {
5268
- this.applyBehaviorSensor(s, at, q, t, n.settings, e, l, c, f);
5270
+ f < U && (Q === "linear" ? q = 1 - f / U : q = Math.pow(1 - f / U, 2)), n.sensors.forEach((rt) => {
5271
+ this.applyBehaviorSensor(s, rt, q, t, n.settings, e, c, l, f);
5269
5272
  });
5270
5273
  } else if (n.type === N.Magnetic) {
5271
5274
  const U = ((d = n.settings) == null ? void 0 : d.radius) || 400, Q = ((p = n.settings) == null ? void 0 : p.strength) || 0.5;
5272
5275
  if (f < U && f > 5) {
5273
- const q = 1 - f / U, at = l * q * Q, kt = c * q * Q;
5274
- s.x -= at * t * 10, s.y -= kt * t * 10;
5276
+ const q = 1 - f / U, rt = c * q * Q, kt = l * q * Q;
5277
+ s.x -= rt * t * 10, s.y -= kt * t * 10;
5275
5278
  }
5276
5279
  } else if (n.type === N.Repel) {
5277
5280
  const U = ((y = n.settings) == null ? void 0 : y.radius) || 300, Q = ((m = n.settings) == null ? void 0 : m.strength) || 1;
5278
5281
  if (f < U) {
5279
5282
  const q = Math.pow(1 - f / U, 2);
5280
- s.x += l / (f || 1) * q * 60 * Q * t * 5, s.y += c / (f || 1) * q * 60 * Q * t * 5;
5283
+ s.x += c / (f || 1) * q * 60 * Q * t * 5, s.y += l / (f || 1) * q * 60 * Q * t * 5;
5281
5284
  }
5282
5285
  } else if (n.type === N.Orbit) {
5283
5286
  const U = ((b = n.settings) == null ? void 0 : b.speed) || 1, Q = ((v = n.settings) == null ? void 0 : v.radius) || 30, q = this.currentTime * U * Math.PI * 2;
@@ -5285,14 +5288,14 @@ class ci {
5285
5288
  } else if (n.type === N.Vortex) {
5286
5289
  const U = ((S = n.settings) == null ? void 0 : S.radius) || 400, Q = ((C = n.settings) == null ? void 0 : C.speed) || 2, q = ((w = n.settings) == null ? void 0 : w.strength) || 1;
5287
5290
  if (f < U) {
5288
- const at = Math.pow(1 - f / U, 1.5), kt = this.currentTime * Q * Math.PI * 2, _t = Math.cos(kt) * 30 - l * 0.4, $t = Math.sin(kt) * 30 - c * 0.4;
5289
- s.x += _t * at * q * t * 5, s.y += $t * at * q * t * 5, s.rotation += 5 * at * q * t * 5, s.scale_x *= 1 - at * 0.1 * q * t, s.scale_y *= 1 - at * 0.1 * q * t;
5291
+ const rt = Math.pow(1 - f / U, 1.5), kt = this.currentTime * Q * Math.PI * 2, _t = Math.cos(kt) * 30 - c * 0.4, $t = Math.sin(kt) * 30 - l * 0.4;
5292
+ s.x += _t * rt * q * t * 5, s.y += $t * rt * q * t * 5, s.rotation += 5 * rt * q * t * 5, s.scale_x *= 1 - rt * 0.1 * q * t, s.scale_y *= 1 - rt * 0.1 * q * t;
5290
5293
  }
5291
5294
  } else if (n.type === N.Fluid) {
5292
5295
  const U = ((I = n.settings) == null ? void 0 : I.radius) || 300, Q = ((M = n.settings) == null ? void 0 : M.strength) || 1;
5293
5296
  if (f < U) {
5294
- const q = Math.pow(1 - f / U, 1.2), at = l / (f || 1) * q * 1.2 * Q, kt = c / (f || 1) * q * 1.2 * Q;
5295
- s.x += at * 10 * t * 5, s.y += kt * 10 * t * 5, s.scale_x *= 1 + q * 0.3 * Q * t, s.scale_y *= 1 + q * 0.3 * Q * t;
5297
+ const q = Math.pow(1 - f / U, 1.2), rt = c / (f || 1) * q * 1.2 * Q, kt = l / (f || 1) * q * 1.2 * Q;
5298
+ s.x += rt * 10 * t * 5, s.y += kt * 10 * t * 5, s.scale_x *= 1 + q * 0.3 * Q * t, s.scale_y *= 1 + q * 0.3 * Q * t;
5296
5299
  }
5297
5300
  } else if (n.type === N.Elastic) {
5298
5301
  const U = ((k = n.settings) == null ? void 0 : k.radius) || 300, Q = ((T = n.settings) == null ? void 0 : T.strength) || 1;
@@ -5301,43 +5304,43 @@ class ci {
5301
5304
  s.scale_x *= 1 + q * 0.4 * Q * t, s.scale_y *= 1 + q * 0.4 * Q * t;
5302
5305
  }
5303
5306
  } else if (n.type === N.Holographic) {
5304
- const U = s.x - this.canvasWidth / 2, Q = s.y - this.canvasHeight / 2, q = ((R = n.settings) == null ? void 0 : R.factor) || 25;
5307
+ const U = s.x - this.canvasWidth / 2, Q = s.y - this.canvasHeight / 2, q = ((x = n.settings) == null ? void 0 : x.factor) || 25;
5305
5308
  if (s.x -= U / 1e3 * q * t * 5, s.y -= Q / 1e3 * q * t * 5, s.style) {
5306
- const at = 1 - Math.min(1, f / 400);
5307
- s.style.exposure = (s.style.exposure || 1) + at * 0.5 * t;
5309
+ const rt = 1 - Math.min(1, f / 400);
5310
+ s.style.exposure = (s.style.exposure || 1) + rt * 0.5 * t;
5308
5311
  }
5309
5312
  } else if (n.type === N.Sticky) {
5310
5313
  const U = ((P = n.settings) == null ? void 0 : P.radius) || 80, Q = ((E = n.settings) == null ? void 0 : E.strength) || 1;
5311
5314
  if (f < U) {
5312
5315
  const q = Math.pow(1 - f / U, 2);
5313
- s.x -= l * q * Q * t * 10, s.y -= c * q * Q * t * 10, s.scale_x *= 1 - q * 0.1 * Q * t, s.scale_y *= 1 - q * 0.1 * Q * t;
5316
+ s.x -= c * q * Q * t * 10, s.y -= l * q * Q * t * 10, s.scale_x *= 1 - q * 0.1 * Q * t, s.scale_y *= 1 - q * 0.1 * Q * t;
5314
5317
  }
5315
5318
  } else if (n.type === N.Dilation) {
5316
- const U = ((x = n.settings) == null ? void 0 : x.size) || 120, Q = ((O = n.settings) == null ? void 0 : O.strength) || 1;
5319
+ const U = ((R = n.settings) == null ? void 0 : R.size) || 120, Q = ((O = n.settings) == null ? void 0 : O.strength) || 1;
5317
5320
  if (f < U) {
5318
5321
  const q = 1 - f / U;
5319
5322
  s.scale_x *= 1 + q * 0.5 * Q * t, s.scale_y *= 1 + q * 0.5 * Q * t;
5320
5323
  }
5321
5324
  } else if (n.type === N.Parallax) {
5322
- const U = ((W = n.settings) == null ? void 0 : W.factor) || 15, Q = ((B = n.settings) == null ? void 0 : B.strength) || 1, q = this.canvasWidth / 2, at = this.canvasHeight / 2, kt = this._lastPointerPos || { x: q, y: at }, _t = (kt.x - q) / q, $t = (kt.y - at) / at, Zt = ((($ = e.transform) == null ? void 0 : $.x) ?? 0) + _t * U * Q, fe = (((Y = e.transform) == null ? void 0 : Y.y) ?? 0) + $t * U * Q, Ie = (((H = e.transform) == null ? void 0 : H.rotate_x) ?? 0) - $t * U * 1.5 * Q, ne = (((K = e.transform) == null ? void 0 : K.rotate_y) ?? 0) + _t * U * 1.5 * Q, ge = Math.min(1, 10 * t);
5325
+ const U = ((W = n.settings) == null ? void 0 : W.factor) || 15, Q = ((B = n.settings) == null ? void 0 : B.strength) || 1, q = this.canvasWidth / 2, rt = this.canvasHeight / 2, kt = this._lastPointerPos || { x: q, y: rt }, _t = (kt.x - q) / q, $t = (kt.y - rt) / rt, Zt = ((($ = e.transform) == null ? void 0 : $.x) ?? 0) + _t * U * Q, fe = (((Y = e.transform) == null ? void 0 : Y.y) ?? 0) + $t * U * Q, Ie = (((H = e.transform) == null ? void 0 : H.rotate_x) ?? 0) - $t * U * 1.5 * Q, ne = (((K = e.transform) == null ? void 0 : K.rotate_y) ?? 0) + _t * U * 1.5 * Q, ge = Math.min(1, 10 * t);
5323
5326
  s.x = this.lerp(s.x ?? ((A = e.transform) == null ? void 0 : A.x) ?? 0, Zt, ge), s.y = this.lerp(s.y ?? ((_ = e.transform) == null ? void 0 : _.y) ?? 0, fe, ge), s.rotate_x = this.lerp(s.rotate_x ?? ((L = e.transform) == null ? void 0 : L.rotate_x) ?? 0, Ie, ge), s.rotate_y = this.lerp(s.rotate_y ?? ((X = e.transform) == null ? void 0 : X.rotate_y) ?? 0, ne, ge);
5324
5327
  } else if (n.type === N.Fold) {
5325
5328
  if (f < 300) {
5326
- const U = 1 - f / 300, Q = (l > 0 ? -1 : 1) * U * 10, q = 1 - U * 0.1, at = c / 300 * U * 20, kt = -(l / 300) * U * 20, _t = Math.min(1, 10 * t);
5327
- s.skew_x = this.lerp(s.skew_x ?? ((V = e.transform) == null ? void 0 : V.skew_x) ?? 0, Q, _t), s.scale_y = this.lerp(s.scale_y ?? ((it = e.transform) == null ? void 0 : it.scale_y) ?? 1, (((rt = e.transform) == null ? void 0 : rt.scale_y) ?? 1) * q, _t), s.rotate_x = this.lerp(s.rotate_x ?? ((nt = e.transform) == null ? void 0 : nt.rotate_x) ?? 0, at, _t), s.rotate_y = this.lerp(s.rotate_y ?? ((yt = e.transform) == null ? void 0 : yt.rotate_y) ?? 0, kt, _t), s.style = s.style || { ...e.style }, s.style.artEffect = { enabled: !0, type: "fold_overlay", intensity: ((ct = n.settings) == null ? void 0 : ct.opacity) ?? 0.5 };
5329
+ const U = 1 - f / 300, Q = (c > 0 ? -1 : 1) * U * 10, q = 1 - U * 0.1, rt = l / 300 * U * 20, kt = -(c / 300) * U * 20, _t = Math.min(1, 10 * t);
5330
+ s.skew_x = this.lerp(s.skew_x ?? ((V = e.transform) == null ? void 0 : V.skew_x) ?? 0, Q, _t), s.scale_y = this.lerp(s.scale_y ?? ((it = e.transform) == null ? void 0 : it.scale_y) ?? 1, (((lt = e.transform) == null ? void 0 : lt.scale_y) ?? 1) * q, _t), s.rotate_x = this.lerp(s.rotate_x ?? ((nt = e.transform) == null ? void 0 : nt.rotate_x) ?? 0, rt, _t), s.rotate_y = this.lerp(s.rotate_y ?? ((bt = e.transform) == null ? void 0 : bt.rotate_y) ?? 0, kt, _t), s.style = s.style || { ...e.style }, s.style.artEffect = { enabled: !0, type: "fold_overlay", intensity: ((ht = n.settings) == null ? void 0 : ht.opacity) ?? 0.5 };
5328
5331
  }
5329
5332
  } else if (n.type === N.Crumple) {
5330
5333
  if (f < 300) {
5331
- const U = 1 - f / 300, Q = U * (Math.random() - 0.5) * 5, q = U * (Math.random() - 0.5) * 0.05, at = Math.min(1, 15 * t);
5332
- s.skew_x = this.lerp(s.skew_x ?? ((wt = e.transform) == null ? void 0 : wt.skew_x) ?? 0, Q, at), s.scale_x = this.lerp(s.scale_x ?? ((Mt = e.transform) == null ? void 0 : Mt.scale_x) ?? 1, (((It = e.transform) == null ? void 0 : It.scale_x) ?? 1) * (1 + q), at), s.scale_y = this.lerp(s.scale_y ?? ((Ot = e.transform) == null ? void 0 : Ot.scale_y) ?? 1, (((At = e.transform) == null ? void 0 : At.scale_y) ?? 1) * (1 + q), at), s.style = s.style || { ...e.style }, s.style.artEffect = { enabled: !0, type: "crumple_overlay", intensity: ((Tt = n.settings) == null ? void 0 : Tt.intensity) ?? 1, scale: ((zt = n.settings) == null ? void 0 : zt.scale) ?? 2 };
5334
+ const U = 1 - f / 300, Q = U * (Math.random() - 0.5) * 5, q = U * (Math.random() - 0.5) * 0.05, rt = Math.min(1, 15 * t);
5335
+ s.skew_x = this.lerp(s.skew_x ?? ((wt = e.transform) == null ? void 0 : wt.skew_x) ?? 0, Q, rt), s.scale_x = this.lerp(s.scale_x ?? ((Mt = e.transform) == null ? void 0 : Mt.scale_x) ?? 1, (((It = e.transform) == null ? void 0 : It.scale_x) ?? 1) * (1 + q), rt), s.scale_y = this.lerp(s.scale_y ?? ((Ot = e.transform) == null ? void 0 : Ot.scale_y) ?? 1, (((At = e.transform) == null ? void 0 : At.scale_y) ?? 1) * (1 + q), rt), s.style = s.style || { ...e.style }, s.style.artEffect = { enabled: !0, type: "crumple_overlay", intensity: ((Tt = n.settings) == null ? void 0 : Tt.intensity) ?? 1, scale: ((zt = n.settings) == null ? void 0 : zt.scale) ?? 2 };
5333
5336
  }
5334
5337
  } else if (n.type === N.Squash) {
5335
5338
  const U = ((Z = n.settings) == null ? void 0 : Z.strength) || 0.8;
5336
5339
  f < (e.width || 100) && this.isMouseDown ? (s.scale_y = this.lerp(s.scale_y ?? 1, (((pt = e.transform) == null ? void 0 : pt.scale_y) ?? 1) * U, 0.3), s.scale_x = this.lerp(s.scale_x ?? 1, (((Et = e.transform) == null ? void 0 : Et.scale_x) ?? 1) * (1 + (1 - U) * 0.4), 0.3)) : (s.scale_y = this.lerp(s.scale_y ?? 1, ((ut = e.transform) == null ? void 0 : ut.scale_y) ?? 1, 0.2), s.scale_x = this.lerp(s.scale_x ?? 1, ((vt = e.transform) == null ? void 0 : vt.scale_x) ?? 1, 0.2));
5337
5340
  } else if (n.type === N.TextCounter) {
5338
- const U = ((xt = n.settings) == null ? void 0 : xt.duration) || 2, Q = ((Xt = n.settings) == null ? void 0 : Xt.from) || 0, q = ((Bt = n.settings) == null ? void 0 : Bt.to) || 100;
5341
+ const U = ((Rt = n.settings) == null ? void 0 : Rt.duration) || 2, Q = ((Xt = n.settings) == null ? void 0 : Xt.from) || 0, q = ((Bt = n.settings) == null ? void 0 : Bt.to) || 100;
5339
5342
  n._runtimeStart === void 0 && (n._runtimeStart = this.currentTime);
5340
- const at = this.currentTime - n._runtimeStart, kt = Math.min(1, at / U), _t = Math.floor(Q + (q - Q) * kt);
5343
+ const rt = this.currentTime - n._runtimeStart, kt = Math.min(1, rt / U), _t = Math.floor(Q + (q - Q) * kt);
5341
5344
  if (((Dt = e.geometry) == null ? void 0 : Dt.type) === "Text") {
5342
5345
  const $t = ((Ht = n.settings) == null ? void 0 : Ht.prefix) || "", Zt = ((te = n.settings) == null ? void 0 : te.suffix) || "";
5343
5346
  s.geometry || (s.geometry = { ...e.geometry }), s.geometry.text = `${$t}${_t}${Zt}`;
@@ -5350,22 +5353,22 @@ class ci {
5350
5353
  } else
5351
5354
  (ye = s.style) != null && ye.adjustments && (s.style.adjustments.exposure = this.lerp(s.style.adjustments.exposure || 0, ((Pe = (Se = e.style) == null ? void 0 : Se.adjustments) == null ? void 0 : Pe.exposure) || 0, 0.1));
5352
5355
  } else if (n.type === N.Noise || n.type === N.Float) {
5353
- const U = (((ae = n.settings) == null ? void 0 : ae.frequency) || ((ee = n.settings) == null ? void 0 : ee.speed) || 1) * 2e-3, Q = (((ht = n.settings) == null ? void 0 : ht.amplitude) || ((bt = n.settings) == null ? void 0 : bt.range) || 50) * (((j = n.settings) == null ? void 0 : j.strength) || 1), q = Date.now();
5356
+ const U = (((ae = n.settings) == null ? void 0 : ae.frequency) || ((ee = n.settings) == null ? void 0 : ee.speed) || 1) * 2e-3, Q = (((at = n.settings) == null ? void 0 : at.amplitude) || ((gt = n.settings) == null ? void 0 : gt.range) || 50) * (((j = n.settings) == null ? void 0 : j.strength) || 1), q = Date.now();
5354
5357
  s.x += Math.sin(q * U) * Q * t, s.y += Math.cos(q * U * 0.8) * Q * t, s.rotation += Math.sin(q * U * 0.5) * 5 * t;
5355
5358
  } else if (n.type === N.Pulse) {
5356
- const U = (((z = n.settings) == null ? void 0 : z.speed) || 1) * 5e-3, Q = (((D = n.settings) == null ? void 0 : D.scale) || 1.2) - 1, q = Math.sin(Date.now() * U), at = ((et = n.settings) == null ? void 0 : et.strength) || 1;
5357
- s.scale_x *= 1 + q * Q * at * t, s.scale_y *= 1 + q * Q * at * t, s.style && (s.style.exposure = (s.style.exposure || 1) + Math.max(0, q) * 0.1 * at * t);
5359
+ const U = (((z = n.settings) == null ? void 0 : z.speed) || 1) * 5e-3, Q = (((D = n.settings) == null ? void 0 : D.scale) || 1.2) - 1, q = Math.sin(Date.now() * U), rt = ((et = n.settings) == null ? void 0 : et.strength) || 1;
5360
+ s.scale_x *= 1 + q * Q * rt * t, s.scale_y *= 1 + q * Q * rt * t, s.style && (s.style.exposure = (s.style.exposure || 1) + Math.max(0, q) * 0.1 * rt * t);
5358
5361
  } else if (n.type === N.Draggable) {
5359
- const U = ((gt = n.settings) == null ? void 0 : gt.radius) || 150, Q = this.draggingBehaviors.has(e.id);
5362
+ const U = ((mt = n.settings) == null ? void 0 : mt.radius) || 150, Q = this.draggingBehaviors.has(e.id);
5360
5363
  if (f < U || Q) {
5361
- const q = ((Pt = n.settings) == null ? void 0 : Pt.strength) || 1, at = Q ? 1 : Math.max(0, 1 - f / U);
5362
- this.applyBehaviorSensor(s, Kt.PositionX, at * q, t, n.settings), this.applyBehaviorSensor(s, Kt.PositionY, at * q, t, n.settings);
5364
+ const q = ((Pt = n.settings) == null ? void 0 : Pt.strength) || 1, rt = Q ? 1 : Math.max(0, 1 - f / U);
5365
+ this.applyBehaviorSensor(s, Kt.PositionX, rt * q, t, n.settings), this.applyBehaviorSensor(s, Kt.PositionY, rt * q, t, n.settings);
5363
5366
  }
5364
5367
  } else if (n.type === N.Scroll) {
5365
- const U = ((Ct = n.settings) == null ? void 0 : Ct.axis) || "vertical", Q = ((Wt = n.settings) == null ? void 0 : Wt.factor) || 0.5, q = ((mt = n.settings) == null ? void 0 : mt.strength) || 1, at = ((F = n.settings) == null ? void 0 : F.scaleFactor) || 0;
5366
- (U === "vertical" || U === "both") && (s.y += this.scrollOffset.y * Q * q * t), (U === "horizontal" || U === "both") && (s.x += this.scrollOffset.x * Q * q * t), at !== 0 && (s.scale_x *= 1 + this.scrollOffset.y * at * t, s.scale_y *= 1 + this.scrollOffset.y * at * t);
5368
+ const U = ((Ct = n.settings) == null ? void 0 : Ct.axis) || "vertical", Q = ((Wt = n.settings) == null ? void 0 : Wt.factor) || 0.5, q = ((yt = n.settings) == null ? void 0 : yt.strength) || 1, rt = ((F = n.settings) == null ? void 0 : F.scaleFactor) || 0;
5369
+ (U === "vertical" || U === "both") && (s.y += this.scrollOffset.y * Q * q * t), (U === "horizontal" || U === "both") && (s.x += this.scrollOffset.x * Q * q * t), rt !== 0 && (s.scale_x *= 1 + this.scrollOffset.y * rt * t, s.scale_y *= 1 + this.scrollOffset.y * rt * t);
5367
5370
  } else if (n.type === N.LookAt) {
5368
- const U = ((Lt = n.settings) == null ? void 0 : Lt.factor) || 1, Q = ((jt = n.settings) == null ? void 0 : jt.strength) || 1, q = Math.atan2(-c, -l) * (180 / Math.PI), at = s.rotation, kt = (q - at + 180) % 360 - 180;
5371
+ const U = ((Lt = n.settings) == null ? void 0 : Lt.factor) || 1, Q = ((jt = n.settings) == null ? void 0 : jt.strength) || 1, q = Math.atan2(-l, -c) * (180 / Math.PI), rt = s.rotation, kt = (q - rt + 180) % 360 - 180;
5369
5372
  s.rotation += kt * U * Q * t * 10;
5370
5373
  } else if (n.type === N.Scan) {
5371
5374
  const U = (((Vt = n.settings) == null ? void 0 : Vt.speed) || 1) * 4e-3, Q = ((ce = n.settings) == null ? void 0 : ce.strength) || 1, q = (Math.sin(Date.now() * U) + 1) / 2;
@@ -5374,10 +5377,10 @@ class ci {
5374
5377
  s.style = s.style || { ...e.style }, s.style.artEffect = {
5375
5378
  enabled: !0,
5376
5379
  type: "glint_overlay",
5377
- intensity: ((Rt = n.settings) == null ? void 0 : Rt.strength) ?? 0.8
5380
+ intensity: ((xt = n.settings) == null ? void 0 : xt.strength) ?? 0.8
5378
5381
  };
5379
5382
  else if (n.type === N.Ratchet) {
5380
- const U = ((ft = n.settings) == null ? void 0 : ft.steps) || 12, Q = (((lt = n.settings) == null ? void 0 : lt.speed) || 1) * 30, q = Math.floor(s.rotation / (360 / U)) * (360 / U);
5383
+ const U = ((ft = n.settings) == null ? void 0 : ft.steps) || 12, Q = (((ct = n.settings) == null ? void 0 : ct.speed) || 1) * 30, q = Math.floor(s.rotation / (360 / U)) * (360 / U);
5381
5384
  s.rotation = this.lerp(s.rotation, q + Q * t, 0.1);
5382
5385
  } else if (n.type === N.Jitter && f < 300) {
5383
5386
  const U = ((tt = n.settings) == null ? void 0 : tt.strength) || 1, Q = (((dt = n.settings) == null ? void 0 : dt.intensity) || 5) * U;
@@ -5387,8 +5390,8 @@ class ci {
5387
5390
  if (U) {
5388
5391
  const Q = this.objectStates.get(U);
5389
5392
  if (Q) {
5390
- const q = ((st = n.settings) == null ? void 0 : st.stiffness) || 0.1, at = Q.x - s.x, kt = Q.y - s.y;
5391
- s.x += at * q * t * 60, s.y += kt * q * t * 60;
5393
+ const q = ((st = n.settings) == null ? void 0 : st.stiffness) || 0.1, rt = Q.x - s.x, kt = Q.y - s.y;
5394
+ s.x += rt * q * t * 60, s.y += kt * q * t * 60;
5392
5395
  }
5393
5396
  }
5394
5397
  } else if (n.type === N.Wrap)
@@ -5412,35 +5415,35 @@ class ci {
5412
5415
  const q = Math.pow(1 - f / U, 2);
5413
5416
  s.scale_x = this.lerp(s.scale_x ?? 1, (((Ae = e.transform) == null ? void 0 : Ae.scale_x) ?? 1) * (1 + q * Q), 0.2), s.scale_y = this.lerp(s.scale_y ?? 1, (((Oe = e.transform) == null ? void 0 : Oe.scale_y) ?? 1) * (1 + q * Q), 0.2);
5414
5417
  } else
5415
- s.scale_x = this.lerp(s.scale_x ?? 1, ((Re = e.transform) == null ? void 0 : Re.scale_x) ?? 1, 0.1), s.scale_y = this.lerp(s.scale_y ?? 1, ((xe = e.transform) == null ? void 0 : xe.scale_y) ?? 1, 0.1);
5418
+ s.scale_x = this.lerp(s.scale_x ?? 1, ((xe = e.transform) == null ? void 0 : xe.scale_x) ?? 1, 0.1), s.scale_y = this.lerp(s.scale_y ?? 1, ((Re = e.transform) == null ? void 0 : Re.scale_y) ?? 1, 0.1);
5416
5419
  } else if (n.type === N.LayoutAnimation) {
5417
5420
  const U = (($e = n.settings) == null ? void 0 : $e.watchProperties) || ["x", "y", "scale_x", "scale_y", "opacity", "rotation"], Q = ((Gt = n.settings) == null ? void 0 : Gt.duration) || 0.3;
5418
5421
  this._layoutAnimCache.has(e.id) || this._layoutAnimCache.set(e.id, /* @__PURE__ */ new Map());
5419
5422
  const q = this._layoutAnimCache.get(e.id);
5420
- for (const at of U) {
5421
- const kt = this.getObjectProperty(s, e, at);
5423
+ for (const rt of U) {
5424
+ const kt = this.getObjectProperty(s, e, rt);
5422
5425
  if (kt === void 0) continue;
5423
- const _t = q.get(at);
5426
+ const _t = q.get(rt);
5424
5427
  if (!_t)
5425
- q.set(at, {
5428
+ q.set(rt, {
5426
5429
  from: kt,
5427
5430
  to: kt,
5428
5431
  startTime: this.currentTime,
5429
5432
  duration: 0
5430
5433
  });
5431
5434
  else if (_t.to !== kt) {
5432
- const Zt = this.getObjectProperty(s, e, at);
5433
- q.set(at, {
5435
+ const Zt = this.getObjectProperty(s, e, rt);
5436
+ q.set(rt, {
5434
5437
  from: Zt ?? _t.from,
5435
5438
  to: kt,
5436
5439
  startTime: this.currentTime,
5437
5440
  duration: ((ie = n.settings) == null ? void 0 : ie.duration) ?? Q
5438
5441
  });
5439
5442
  }
5440
- const $t = q.get(at);
5443
+ const $t = q.get(rt);
5441
5444
  if ($t.duration > 0 && $t.from !== $t.to) {
5442
5445
  const Zt = this.currentTime - $t.startTime, fe = Math.min(1, Zt / $t.duration), Ie = this.applyEasing(fe, ((be = n.settings) == null ? void 0 : be.easing) || "easeOutCubic"), ne = $t.from + ($t.to - $t.from) * Ie;
5443
- this.setObjectProperty(s, e, at, ne);
5446
+ this.setObjectProperty(s, e, rt, ne);
5444
5447
  }
5445
5448
  }
5446
5449
  } else if (n.type === N.StateReactive) {
@@ -5460,30 +5463,30 @@ class ci {
5460
5463
  "style.shadow.offsetX",
5461
5464
  "style.shadow.offsetY"
5462
5465
  ];
5463
- for (const at of q) {
5464
- const kt = this.getObjectProperty(s, e, at);
5466
+ for (const rt of q) {
5467
+ const kt = this.getObjectProperty(s, e, rt);
5465
5468
  if (kt === void 0 || typeof kt != "number") continue;
5466
- const _t = U.get(at);
5469
+ const _t = U.get(rt);
5467
5470
  if (!_t)
5468
- U.set(at, {
5471
+ U.set(rt, {
5469
5472
  from: kt,
5470
5473
  to: kt,
5471
5474
  startTime: this.currentTime,
5472
5475
  duration: 0
5473
5476
  });
5474
5477
  else if (_t.to !== kt) {
5475
- const Zt = this.getObjectProperty(s, e, at);
5476
- U.set(at, {
5478
+ const Zt = this.getObjectProperty(s, e, rt);
5479
+ U.set(rt, {
5477
5480
  from: Zt ?? _t.from,
5478
5481
  to: kt,
5479
5482
  startTime: this.currentTime,
5480
5483
  duration: Q
5481
5484
  });
5482
5485
  }
5483
- const $t = U.get(at);
5486
+ const $t = U.get(rt);
5484
5487
  if ($t.duration > 0 && $t.from !== $t.to) {
5485
5488
  const Zt = this.currentTime - $t.startTime, fe = Math.min(1, Zt / $t.duration), Ie = this.applyEasing(fe, ((Fe = n.settings) == null ? void 0 : Fe.defaultEasing) || "easeOutCubic"), ne = $t.from + ($t.to - $t.from) * Ie;
5486
- this.setObjectProperty(s, e, at, ne);
5489
+ this.setObjectProperty(s, e, rt, ne);
5487
5490
  }
5488
5491
  }
5489
5492
  } else if (n.type === N.SpringChain) {
@@ -5502,21 +5505,21 @@ class ci {
5502
5505
  }
5503
5506
  q.has(e.id) || q.set(e.id, { x: s.x, y: s.y, vx: 0, vy: 0 });
5504
5507
  }
5505
- const at = q.get(e.id);
5506
- if (at) {
5507
- at.x = s.x, at.y = s.y;
5508
+ const rt = q.get(e.id);
5509
+ if (rt) {
5510
+ rt.x = s.x, rt.y = s.y;
5508
5511
  for (const kt of U) {
5509
5512
  const _t = q.get(kt.targetId);
5510
5513
  if (!_t) continue;
5511
- const $t = _t.x - at.x, Zt = _t.y - at.y, fe = Math.sqrt($t * $t + Zt * Zt) || 1e-3, ne = (fe - (kt.restLength || 50)) * (kt.stiffness || 0.8), ge = $t / fe * ne, Ne = Zt / fe * ne;
5512
- at.vx += ge * t * 10, at.vy += Ne * t * 10, _t.vx -= ge * t * 10, _t.vy -= Ne * t * 10, at.vx *= 1 - Q * t * 10, at.vy *= 1 - Q * t * 10, _t.vx *= 1 - Q * t * 10, _t.vy *= 1 - Q * t * 10;
5514
+ const $t = _t.x - rt.x, Zt = _t.y - rt.y, fe = Math.sqrt($t * $t + Zt * Zt) || 1e-3, ne = (fe - (kt.restLength || 50)) * (kt.stiffness || 0.8), ge = $t / fe * ne, Ne = Zt / fe * ne;
5515
+ rt.vx += ge * t * 10, rt.vy += Ne * t * 10, _t.vx -= ge * t * 10, _t.vy -= Ne * t * 10, rt.vx *= 1 - Q * t * 10, rt.vy *= 1 - Q * t * 10, _t.vx *= 1 - Q * t * 10, _t.vy *= 1 - Q * t * 10;
5513
5516
  const de = this.objectStates.get(kt.targetId);
5514
5517
  de && (de.x += _t.vx * t, de.y += _t.vy * t);
5515
5518
  }
5516
- s.x += at.vx * t, s.y += at.vy * t;
5519
+ s.x += rt.vx * t, s.y += rt.vy * t;
5517
5520
  }
5518
5521
  } else if (n.type === N.ParticleEmitter) {
5519
- const U = ((le = n.settings) == null ? void 0 : le.rate) || 10, Q = ((we = n.settings) == null ? void 0 : we.speed) || 100, q = ((We = n.settings) == null ? void 0 : We.size) || 5, at = ((Ge = n.settings) == null ? void 0 : Ge.lifetime) || 2, kt = ((De = n.settings) == null ? void 0 : De.gravity) || 0, _t = ((Be = n.settings) == null ? void 0 : Be.color) || "#ffffff", $t = ((ze = n.settings) == null ? void 0 : ze.maxParticles) || 200, Zt = (Ve = n.settings) != null && Ve.rateInputId ? this.inputs.get(n.settings.rateInputId) ?? U : U, fe = (Ze = n.settings) != null && Ze.gravityInputId ? this.inputs.get(n.settings.gravityInputId) ?? kt : kt, Ie = (je = n.settings) != null && je.speedInputId ? this.inputs.get(n.settings.speedInputId) ?? Q : Q;
5522
+ const U = ((le = n.settings) == null ? void 0 : le.rate) || 10, Q = ((we = n.settings) == null ? void 0 : we.speed) || 100, q = ((We = n.settings) == null ? void 0 : We.size) || 5, rt = ((Ge = n.settings) == null ? void 0 : Ge.lifetime) || 2, kt = ((De = n.settings) == null ? void 0 : De.gravity) || 0, _t = ((Be = n.settings) == null ? void 0 : Be.color) || "#ffffff", $t = ((ze = n.settings) == null ? void 0 : ze.maxParticles) || 200, Zt = (Ve = n.settings) != null && Ve.rateInputId ? this.inputs.get(n.settings.rateInputId) ?? U : U, fe = (Ze = n.settings) != null && Ze.gravityInputId ? this.inputs.get(n.settings.gravityInputId) ?? kt : kt, Ie = (je = n.settings) != null && je.speedInputId ? this.inputs.get(n.settings.speedInputId) ?? Q : Q;
5520
5523
  this._emitterPools.has(e.id) || this._emitterPools.set(e.id, []);
5521
5524
  const ne = this._emitterPools.get(e.id);
5522
5525
  let ge = 0;
@@ -5530,7 +5533,7 @@ class ci {
5530
5533
  vx: Math.cos(oe) * ts,
5531
5534
  vy: Math.sin(oe) * ts,
5532
5535
  life: 0,
5533
- maxLife: at * (0.5 + Math.random() * 0.5),
5536
+ maxLife: rt * (0.5 + Math.random() * 0.5),
5534
5537
  size: q * (0.5 + Math.random()),
5535
5538
  color: _t,
5536
5539
  opacity: 1
@@ -5544,88 +5547,88 @@ class ci {
5544
5547
  });
5545
5548
  });
5546
5549
  }
5547
- applyBehaviorSensor(t, i, o, e, s, n, a = 0, r = 0, l = 1) {
5548
- var d, p, y, m, b, v, S, C, w, I, M, k, T, R, P, E, x, O, W, B, $, Y, H, K;
5549
- const c = (s == null ? void 0 : s.intensity) || (s == null ? void 0 : s.strength) || 1, f = Math.min(1, 15 * e), u = l > 0 ? a / l : 0, h = l > 0 ? r / l : 0;
5550
+ applyBehaviorSensor(t, i, o, e, s, n, a = 0, r = 0, c = 1) {
5551
+ var d, p, y, m, b, v, S, C, w, I, M, k, T, x, P, E, R, O, W, B, $, Y, H, K;
5552
+ const l = (s == null ? void 0 : s.intensity) || (s == null ? void 0 : s.strength) || 1, f = Math.min(1, 15 * e), u = c > 0 ? a / c : 0, h = c > 0 ? r / c : 0;
5550
5553
  switch (i) {
5551
5554
  case Kt.Scale: {
5552
- const A = ((d = n == null ? void 0 : n.transform) == null ? void 0 : d.scale_x) ?? 1, _ = ((p = n == null ? void 0 : n.transform) == null ? void 0 : p.scale_y) ?? 1, L = A * (1 + o * c * 0.4), X = _ * (1 + o * c * 0.4);
5555
+ const A = ((d = n == null ? void 0 : n.transform) == null ? void 0 : d.scale_x) ?? 1, _ = ((p = n == null ? void 0 : n.transform) == null ? void 0 : p.scale_y) ?? 1, L = A * (1 + o * l * 0.4), X = _ * (1 + o * l * 0.4);
5553
5556
  t.scale_x = (t.scale_x ?? A) * (1 - f) + L * f, t.scale_y = (t.scale_y ?? _) * (1 - f) + X * f;
5554
5557
  break;
5555
5558
  }
5556
5559
  case Kt.Opacity: {
5557
- const A = ((y = n == null ? void 0 : n.transform) == null ? void 0 : y.opacity) ?? 100, _ = Math.max(0, Math.min(100, A - o * c * 100));
5560
+ const A = ((y = n == null ? void 0 : n.transform) == null ? void 0 : y.opacity) ?? 100, _ = Math.max(0, Math.min(100, A - o * l * 100));
5558
5561
  t.opacity = (t.opacity ?? A) * (1 - f) + _ * f;
5559
5562
  break;
5560
5563
  }
5561
5564
  case Kt.RotateZ: {
5562
- const A = ((m = n == null ? void 0 : n.transform) == null ? void 0 : m.rotation) ?? 0, _ = A + o * c * 45;
5565
+ const A = ((m = n == null ? void 0 : n.transform) == null ? void 0 : m.rotation) ?? 0, _ = A + o * l * 45;
5563
5566
  t.rotation = (t.rotation ?? A) * (1 - f) + _ * f;
5564
5567
  break;
5565
5568
  }
5566
5569
  case Kt.RotateX: {
5567
- const A = ((b = n == null ? void 0 : n.transform) == null ? void 0 : b.rotate_x) ?? 0, _ = A - h * o * c * 60;
5570
+ const A = ((b = n == null ? void 0 : n.transform) == null ? void 0 : b.rotate_x) ?? 0, _ = A - h * o * l * 60;
5568
5571
  t.rotate_x = (t.rotate_x ?? A) * (1 - f) + _ * f;
5569
5572
  break;
5570
5573
  }
5571
5574
  case Kt.RotateY: {
5572
- const A = ((v = n == null ? void 0 : n.transform) == null ? void 0 : v.rotate_y) ?? 0, _ = A + u * o * c * 60;
5575
+ const A = ((v = n == null ? void 0 : n.transform) == null ? void 0 : v.rotate_y) ?? 0, _ = A + u * o * l * 60;
5573
5576
  t.rotate_y = (t.rotate_y ?? A) * (1 - f) + _ * f;
5574
5577
  break;
5575
5578
  }
5576
5579
  case Kt.PositionX: {
5577
- const A = ((S = n == null ? void 0 : n.transform) == null ? void 0 : S.x) ?? 0, _ = A - u * o * c * 40;
5580
+ const A = ((S = n == null ? void 0 : n.transform) == null ? void 0 : S.x) ?? 0, _ = A - u * o * l * 40;
5578
5581
  t.x = (t.x ?? A) * (1 - f) + _ * f;
5579
5582
  break;
5580
5583
  }
5581
5584
  case Kt.PositionY: {
5582
- const A = ((C = n == null ? void 0 : n.transform) == null ? void 0 : C.y) ?? 0, _ = A - h * o * c * 40;
5585
+ const A = ((C = n == null ? void 0 : n.transform) == null ? void 0 : C.y) ?? 0, _ = A - h * o * l * 40;
5583
5586
  t.y = (t.y ?? A) * (1 - f) + _ * f;
5584
5587
  break;
5585
5588
  }
5586
5589
  case Kt.SkewX: {
5587
- const A = ((w = n == null ? void 0 : n.transform) == null ? void 0 : w.skew_x) ?? 0, _ = A + u * o * c * 45;
5590
+ const A = ((w = n == null ? void 0 : n.transform) == null ? void 0 : w.skew_x) ?? 0, _ = A + u * o * l * 45;
5588
5591
  t.skew_x = (t.skew_x ?? A) * (1 - f) + _ * f, t.skew_x > 85 && (t.skew_x = 85), t.skew_x < -85 && (t.skew_x = -85);
5589
5592
  break;
5590
5593
  }
5591
5594
  case Kt.Blur: {
5592
5595
  t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.blur || (t.style.blur = { ...(I = n == null ? void 0 : n.style) == null ? void 0 : I.blur });
5593
- const A = ((k = (M = n == null ? void 0 : n.style) == null ? void 0 : M.blur) == null ? void 0 : k.amount) || 0, _ = A + o * ((s == null ? void 0 : s.blur) || 20) * c;
5596
+ const A = ((k = (M = n == null ? void 0 : n.style) == null ? void 0 : M.blur) == null ? void 0 : k.amount) || 0, _ = A + o * ((s == null ? void 0 : s.blur) || 20) * l;
5594
5597
  t.style.blur.amount = (t.style.blur.amount ?? A) * (1 - f) + _ * f;
5595
5598
  break;
5596
5599
  }
5597
5600
  case Kt.Exposure: {
5598
5601
  t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(T = n == null ? void 0 : n.style) == null ? void 0 : T.adjustments });
5599
- const A = ((P = (R = n == null ? void 0 : n.style) == null ? void 0 : R.adjustments) == null ? void 0 : P.exposure) || 0, _ = A + o * ((s == null ? void 0 : s.exposure) || 50) * c;
5602
+ const A = ((P = (x = n == null ? void 0 : n.style) == null ? void 0 : x.adjustments) == null ? void 0 : P.exposure) || 0, _ = A + o * ((s == null ? void 0 : s.exposure) || 50) * l;
5600
5603
  t.style.adjustments.exposure = (t.style.adjustments.exposure ?? A) * (1 - f) + _ * f;
5601
5604
  break;
5602
5605
  }
5603
5606
  case Kt.HueShift: {
5604
5607
  t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(E = n == null ? void 0 : n.style) == null ? void 0 : E.adjustments });
5605
- const A = ((O = (x = n == null ? void 0 : n.style) == null ? void 0 : x.adjustments) == null ? void 0 : O.hue) || 0, _ = A + o * ((s == null ? void 0 : s.hue) || 180) * c;
5608
+ const A = ((O = (R = n == null ? void 0 : n.style) == null ? void 0 : R.adjustments) == null ? void 0 : O.hue) || 0, _ = A + o * ((s == null ? void 0 : s.hue) || 180) * l;
5606
5609
  t.style.adjustments.hue = (t.style.adjustments.hue ?? A) * (1 - f) + _ * f;
5607
5610
  break;
5608
5611
  }
5609
5612
  case Kt.Negative: {
5610
5613
  t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(W = n == null ? void 0 : n.style) == null ? void 0 : W.adjustments });
5611
- const A = (($ = (B = n == null ? void 0 : n.style) == null ? void 0 : B.adjustments) == null ? void 0 : $.negative) || 0, _ = A + o * ((s == null ? void 0 : s.negative) || 100) * c;
5614
+ const A = (($ = (B = n == null ? void 0 : n.style) == null ? void 0 : B.adjustments) == null ? void 0 : $.negative) || 0, _ = A + o * ((s == null ? void 0 : s.negative) || 100) * l;
5612
5615
  t.style.adjustments.negative = (t.style.adjustments.negative ?? A) * (1 - f) + _ * f;
5613
5616
  break;
5614
5617
  }
5615
5618
  case Kt.CornerRadius: {
5616
- const A = ((Y = n == null ? void 0 : n.transform) == null ? void 0 : Y.corner_radius) || 0, _ = A + o * c * 50;
5619
+ const A = ((Y = n == null ? void 0 : n.transform) == null ? void 0 : Y.corner_radius) || 0, _ = A + o * l * 50;
5617
5620
  t.corner_radius = (t.corner_radius ?? A) * (1 - f) + _ * f;
5618
5621
  break;
5619
5622
  }
5620
5623
  case Kt.StrokeWidth: {
5621
5624
  t.style || (t.style = { ...n == null ? void 0 : n.style });
5622
- const A = ((H = n == null ? void 0 : n.style) == null ? void 0 : H.borderWidth) || 0, _ = A + o * c * 10;
5625
+ const A = ((H = n == null ? void 0 : n.style) == null ? void 0 : H.borderWidth) || 0, _ = A + o * l * 10;
5623
5626
  t.style.borderWidth = (t.style.borderWidth ?? A) * (1 - f) + _ * f;
5624
5627
  break;
5625
5628
  }
5626
5629
  case Kt.LetterSpacing: {
5627
5630
  t.geometry || (t.geometry = {});
5628
- const A = ((K = n == null ? void 0 : n.geometry) == null ? void 0 : K.letterSpacing) || 0, _ = A + o * c * 10;
5631
+ const A = ((K = n == null ? void 0 : n.geometry) == null ? void 0 : K.letterSpacing) || 0, _ = A + o * l * 10;
5629
5632
  t.geometry.letterSpacing = (t.geometry.letterSpacing ?? A) * (1 - f) + _ * f;
5630
5633
  break;
5631
5634
  }
@@ -5648,12 +5651,12 @@ class ci {
5648
5651
  const s = o.split(".");
5649
5652
  let n = t;
5650
5653
  for (let r = 0; r < s.length - 1; r++) {
5651
- const l = s[r];
5652
- if (n[l] === void 0 || n[l] === null) {
5653
- const c = i, f = s.slice(0, r + 1).reduce((u, h) => u == null ? void 0 : u[h], c);
5654
- n[l] = f !== void 0 ? { ...f } : {};
5654
+ const c = s[r];
5655
+ if (n[c] === void 0 || n[c] === null) {
5656
+ const l = i, f = s.slice(0, r + 1).reduce((u, h) => u == null ? void 0 : u[h], l);
5657
+ n[c] = f !== void 0 ? { ...f } : {};
5655
5658
  }
5656
- n = n[l];
5659
+ n = n[c];
5657
5660
  }
5658
5661
  const a = s[s.length - 1];
5659
5662
  n != null && (n[a] = e);
@@ -5701,9 +5704,9 @@ class ci {
5701
5704
  return o;
5702
5705
  }
5703
5706
  renderFittedImage(t, i, o, e, s, n, a = "cover") {
5704
- const r = i.naturalWidth, l = i.naturalHeight, c = r / l, f = s / n;
5707
+ const r = i.naturalWidth, c = i.naturalHeight, l = r / c, f = s / n;
5705
5708
  let u = s, h = n, d = o, p = e;
5706
- a === "cover" ? c > f ? (u = n * c, d = o - (u - s) / 2) : (h = s / c, p = e - (h - n) / 2) : a === "contain" && (c > f ? (h = s / c, p = e + (n - h) / 2) : (u = n * c, d = o + (s - u) / 2)), t.drawImage(i, d, p, u, h);
5709
+ a === "cover" ? l > f ? (u = n * l, d = o - (u - s) / 2) : (h = s / l, p = e - (h - n) / 2) : a === "contain" && (l > f ? (h = s / l, p = e + (n - h) / 2) : (u = n * l, d = o + (s - u) / 2)), t.drawImage(i, d, p, u, h);
5707
5710
  }
5708
5711
  }
5709
5712
  const yi = Ss(({
@@ -5716,8 +5719,8 @@ const yi = Ss(({
5716
5719
  onReady: n,
5717
5720
  onTrigger: a,
5718
5721
  onInputUpdate: r,
5719
- onComponentChange: l,
5720
- onToggle: c,
5722
+ onComponentChange: c,
5723
+ onToggle: l,
5721
5724
  onInputChange: f,
5722
5725
  onInputFocus: u,
5723
5726
  onInputBlur: h,
@@ -5734,19 +5737,19 @@ const yi = Ss(({
5734
5737
  isMouseDown: M,
5735
5738
  inputs: k,
5736
5739
  interactive: T = !0,
5737
- onNavigation: R
5740
+ onNavigation: x
5738
5741
  }, P) => {
5739
- const E = Me(null), x = Me(null);
5740
- x.current || (x.current = new ci());
5742
+ const E = Me(null), R = Me(null);
5743
+ R.current || (R.current = new ci());
5741
5744
  const O = Me(void 0), W = Me(0), B = Me(null), $ = Me(v), Y = Me(null), [, H] = ds(g || null), K = Me(!0);
5742
5745
  Cs(P, () => E.current), Te(() => (K.current = !0, () => {
5743
5746
  K.current = !1, O.current && cancelAnimationFrame(O.current);
5744
5747
  }), []), Te(() => {
5745
- x.current.setLayout(e, s);
5748
+ R.current.setLayout(e, s);
5746
5749
  }, [e, s]), Te(() => {
5747
- const _ = x.current;
5748
- a && _.setTriggerCallback(a), r && _.setInputUpdateCallback((L, X) => r({ [L]: X })), l && _.setComponentChangeCallback((L) => l(L)), c && _.setToggleCallback(c), f && _.setInputChangeCallback(f), u && _.setInputFocusCallback(u), h && _.setInputBlurCallback(h), d && _.setOnLogCallback((L) => d(L, "info")), p && _.setLogicUpdateCallback(p), y && _.setButtonClickCallback(y), m && _.setGraphPointClickCallback((L) => m(L.objectId, L)), R && _.setNavigationCallback(R);
5749
- }, [a, r, l, c, f, u, h, d, p, y, m, R]), Te(() => {
5750
+ const _ = R.current;
5751
+ a && _.setTriggerCallback(a), r && _.setInputUpdateCallback((L, X) => r({ [L]: X })), c && _.setComponentChangeCallback((L) => c(L)), l && _.setToggleCallback(l), f && _.setInputChangeCallback(f), u && _.setInputFocusCallback(u), h && _.setInputBlurCallback(h), d && _.setOnLogCallback((L) => d(L, "info")), p && _.setLogicUpdateCallback(p), y && _.setButtonClickCallback(y), m && _.setGraphPointClickCallback((L) => m(L.objectId, L)), x && _.setNavigationCallback(x);
5752
+ }, [a, r, c, l, f, u, h, d, p, y, m, x]), Te(() => {
5750
5753
  (async () => {
5751
5754
  let L = g;
5752
5755
  if (t && !g)
@@ -5756,22 +5759,22 @@ const yi = Ss(({
5756
5759
  console.error("[ExodeUI] Failed to load src:", X);
5757
5760
  }
5758
5761
  if (L) {
5759
- const X = x.current, V = L.id || L.name || "default";
5762
+ const X = R.current, V = L.id || L.name || "default";
5760
5763
  (B.current !== V || $.current !== v || Y.current !== L) && (X.load(L), B.current = V, $.current = v, Y.current = L, H(L), W.current = 0, X.advance(0)), n && n(X);
5761
5764
  }
5762
5765
  })();
5763
5766
  }, [g, t, v]), Te(() => {
5764
5767
  const _ = (L) => {
5765
- if (!x.current || !K.current) return;
5766
- const X = x.current, V = E.current;
5768
+ if (!R.current || !K.current) return;
5769
+ const X = R.current, V = E.current;
5767
5770
  if (!V) return;
5768
5771
  const it = V.getContext("2d");
5769
5772
  if (!it) return;
5770
- const rt = L / 1e3;
5771
- W.current === 0 && (W.current = rt);
5772
- let nt = rt - W.current;
5773
- nt > 0.1 && (nt = 0.1), W.current = rt;
5774
- const yt = V.getBoundingClientRect(), ct = window.devicePixelRatio || 1, wt = Math.round(yt.width * ct), Mt = Math.round(yt.height * ct);
5773
+ const lt = L / 1e3;
5774
+ W.current === 0 && (W.current = lt);
5775
+ let nt = lt - W.current;
5776
+ nt > 0.1 && (nt = 0.1), W.current = lt;
5777
+ const bt = V.getBoundingClientRect(), ht = window.devicePixelRatio || 1, wt = Math.round(bt.width * ht), Mt = Math.round(bt.height * ht);
5775
5778
  (V.width !== wt || V.height !== Mt) && (V.width = wt, V.height = Mt);
5776
5779
  try {
5777
5780
  o ? X.advance(nt) : b !== void 0 && X.seek(b), X.render(it, V.width, V.height);
@@ -5784,14 +5787,14 @@ const yi = Ss(({
5784
5787
  O.current && cancelAnimationFrame(O.current);
5785
5788
  };
5786
5789
  }, [o, b]), Te(() => {
5787
- const _ = x.current;
5790
+ const _ = R.current;
5788
5791
  S !== void 0 && _.updateInput("scrollY", S), C !== void 0 && _.updateInput("scrollX", C), w !== void 0 && _.updateInput("mouseX", w), I !== void 0 && _.updateInput("mouseY", I), M !== void 0 && _.updateInput("isMouseDown", M), k && Object.entries(k).forEach(([L, X]) => _.updateInput(L, X));
5789
5792
  }, [S, C, w, I, M, k]);
5790
5793
  const A = (_, L) => {
5791
5794
  if (!T || !E.current) return;
5792
5795
  _.stopPropagation(), "nativeEvent" in _ && _.nativeEvent && typeof _.nativeEvent.stopImmediatePropagation == "function" ? _.nativeEvent.stopImmediatePropagation() : typeof _.stopImmediatePropagation == "function" && _.stopImmediatePropagation();
5793
- const X = E.current, V = X.getBoundingClientRect(), it = _.clientX - V.left, rt = _.clientY - V.top, nt = window.devicePixelRatio || 1;
5794
- (L === "click" || L === "down" || L === "up") && d && d(`[Canvas] Pointer ${L} at rect(${Math.round(it)},${Math.round(rt)}) mapped to buffer(${Math.round(it * nt)},${Math.round(rt * nt)})`, "info"), x.current.handlePointerInput(L, it * nt, rt * nt, X.width, X.height);
5796
+ const X = E.current, V = X.getBoundingClientRect(), it = _.clientX - V.left, lt = _.clientY - V.top, nt = window.devicePixelRatio || 1;
5797
+ (L === "click" || L === "down" || L === "up") && d && d(`[Canvas] Pointer ${L} at rect(${Math.round(it)},${Math.round(lt)}) mapped to buffer(${Math.round(it * nt)},${Math.round(lt * nt)})`, "info"), R.current.handlePointerInput(L, it * nt, lt * nt, X.width, X.height);
5795
5798
  };
5796
5799
  return /* @__PURE__ */ ke(
5797
5800
  "canvas",
@@ -5806,9 +5809,9 @@ const yi = Ss(({
5806
5809
  onPointerCancel: (_) => A(_, "up"),
5807
5810
  onClick: (_) => A(_, "click"),
5808
5811
  onWheel: (_) => {
5809
- x.current.handleWheel(_.deltaX, _.deltaY);
5812
+ R.current.handleWheel(_.deltaX, _.deltaY);
5810
5813
  },
5811
- onKeyDown: (_) => x.current.handleKeyDown(_.nativeEvent),
5814
+ onKeyDown: (_) => R.current.handleKeyDown(_.nativeEvent),
5812
5815
  onContextMenu: (_) => _.preventDefault(),
5813
5816
  tabIndex: 0,
5814
5817
  style: {
@@ -5838,9 +5841,9 @@ function bi() {
5838
5841
  g == null || g.setInputStringArray(f, u);
5839
5842
  }, [g]), r = ve((f, u) => {
5840
5843
  g == null || g.updateObjectOptions(f, u);
5841
- }, [g]), l = ve((f, u, h) => {
5844
+ }, [g]), c = ve((f, u, h) => {
5842
5845
  g == null || g.updateConstraint(f, u, h);
5843
- }, [g]), c = ve((f, u) => {
5846
+ }, [g]), l = ve((f, u) => {
5844
5847
  g == null || g.updateGraphData(f, u);
5845
5848
  }, [g]);
5846
5849
  return {
@@ -5853,8 +5856,8 @@ function bi() {
5853
5856
  setInputText: s,
5854
5857
  setInputNumberArray: n,
5855
5858
  setInputStringArray: a,
5856
- updateConstraint: l,
5857
- updateGraphData: c,
5859
+ updateConstraint: c,
5860
+ updateGraphData: l,
5858
5861
  updateObjectOptions: r
5859
5862
  };
5860
5863
  }
@@ -5877,24 +5880,24 @@ const vi = ({ artboard: g, config: t }) => {
5877
5880
  f.length > 0 && (r = f[0].geometry.text);
5878
5881
  }
5879
5882
  r && (e("name", "description", r), e("property", "og:description", r)), i.keywords && i.keywords.length > 0 && e("name", "keywords", i.keywords.join(", "));
5880
- const l = i.ogImage || g.backgroundImage;
5881
- l && e("property", "og:image", l), a && e("property", "og:title", a), e("property", "og:type", "website");
5883
+ const c = i.ogImage || g.backgroundImage;
5884
+ c && e("property", "og:image", c), a && e("property", "og:title", a), e("property", "og:type", "website");
5882
5885
  }, [i, g, o]);
5883
- const e = (a, r, l) => {
5884
- let c = document.querySelector(`meta[${a}="${r}"]`);
5885
- c || (c = document.createElement("meta"), c.setAttribute(a, r), document.head.appendChild(c)), c.setAttribute("content", l);
5886
+ const e = (a, r, c) => {
5887
+ let l = document.querySelector(`meta[${a}="${r}"]`);
5888
+ l || (l = document.createElement("meta"), l.setAttribute(a, r), document.head.appendChild(l)), l.setAttribute("content", c);
5886
5889
  }, s = () => {
5887
5890
  const a = [];
5888
- return a.push(/* @__PURE__ */ ke("h1", { children: i.title || g.name }, "artboard-title")), g.objects.forEach((l, c) => {
5891
+ return a.push(/* @__PURE__ */ ke("h1", { children: i.title || g.name }, "artboard-title")), g.objects.forEach((c, l) => {
5889
5892
  var f, u;
5890
- if (!(l.visible === !1 || l.isVisible === !1))
5891
- if (((f = l.geometry) == null ? void 0 : f.type) === "Text") {
5892
- const h = l.geometry.text;
5893
- h && (l.geometry.fontSize > 24 ? a.push(/* @__PURE__ */ ke("h2", { children: h }, l.id || c)) : a.push(/* @__PURE__ */ ke("p", { children: h }, l.id || c)));
5894
- } else if (((u = l.geometry) == null ? void 0 : u.type) === "Image") {
5895
- const h = l.geometry.src, d = l.altText || l.name || "Illustration";
5896
- a.push(/* @__PURE__ */ ke("img", { src: h, alt: d }, l.id || c));
5897
- } else l.type === "Button" && a.push(/* @__PURE__ */ ke("button", { children: l.name || "Button" }, l.id || c));
5893
+ if (!(c.visible === !1 || c.isVisible === !1))
5894
+ if (((f = c.geometry) == null ? void 0 : f.type) === "Text") {
5895
+ const h = c.geometry.text;
5896
+ h && (c.geometry.fontSize > 24 ? a.push(/* @__PURE__ */ ke("h2", { children: h }, c.id || l)) : a.push(/* @__PURE__ */ ke("p", { children: h }, c.id || l)));
5897
+ } else if (((u = c.geometry) == null ? void 0 : u.type) === "Image") {
5898
+ const h = c.geometry.src, d = c.altText || c.name || "Illustration";
5899
+ a.push(/* @__PURE__ */ ke("img", { src: h, alt: d }, c.id || l));
5900
+ } else c.type === "Button" && a.push(/* @__PURE__ */ ke("button", { children: c.name || "Button" }, c.id || l));
5898
5901
  }), a;
5899
5902
  }, n = i.jsonLd || {
5900
5903
  "@context": "https://schema.org",
@@ -5927,7 +5930,7 @@ const vi = ({ artboard: g, config: t }) => {
5927
5930
  ]
5928
5931
  }
5929
5932
  );
5930
- }, hi = "6.3.29", fi = {
5933
+ }, hi = "6.3.31", fi = {
5931
5934
  version: hi
5932
5935
  }, Si = fi.version;
5933
5936
  export {