@snowcone-app/canvas 0.43.8 → 0.44.0

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 (66) hide show
  1. package/dist/{CanvasRenderer-DIug_mjX.js → CanvasRenderer-B8BADU_r.js} +876 -830
  2. package/dist/CanvasRenderer-B8BADU_r.js.map +1 -0
  3. package/dist/{CanvasStateV1-BWd358xJ.js → CanvasStateV1-BlDWgOzV.js} +3 -3
  4. package/dist/{CanvasStateV1-BWd358xJ.js.map → CanvasStateV1-BlDWgOzV.js.map} +1 -1
  5. package/dist/ContextualToolbars-rCZo-KCm.js +6808 -0
  6. package/dist/ContextualToolbars-rCZo-KCm.js.map +1 -0
  7. package/dist/EditorCanvasImpl-C63QS2OK.js +144 -0
  8. package/dist/EditorCanvasImpl-C63QS2OK.js.map +1 -0
  9. package/dist/{ExportManager-BDH9jW4Q.js → ExportManager-xRsXgyNo.js} +2 -2
  10. package/dist/{ExportManager-BDH9jW4Q.js.map → ExportManager-xRsXgyNo.js.map} +1 -1
  11. package/dist/{FontAnalyzer-CyhywbAM.js → FontAnalyzer-Ds3Wdba7.js} +239 -236
  12. package/dist/FontAnalyzer-Ds3Wdba7.js.map +1 -0
  13. package/dist/{ImagePanel-CIGpLY3B.js → ImagePanel-DhOWKvIN.js} +6 -6
  14. package/dist/{ImagePanel-CIGpLY3B.js.map → ImagePanel-DhOWKvIN.js.map} +1 -1
  15. package/dist/{SnowconeCanvas-DE0A9UwD.js → SnowconeCanvas-C-AGGT44.js} +478 -465
  16. package/dist/SnowconeCanvas-C-AGGT44.js.map +1 -0
  17. package/dist/adjust-CDVzlVBY.js +145 -0
  18. package/dist/adjust-CDVzlVBY.js.map +1 -0
  19. package/dist/advanced.mjs +15 -15
  20. package/dist/api/stable.d.ts +2 -0
  21. package/dist/components/ImageToolbar.d.ts +3 -0
  22. package/dist/components/ShapeToolbar.d.ts +2 -0
  23. package/dist/components/TextToolbar.d.ts +2 -1
  24. package/dist/components/embed/SnowconeCanvas.d.ts +8 -0
  25. package/dist/components/toolbars/SecondaryPanels.d.ts +24 -0
  26. package/dist/components/toolbars/index.d.ts +2 -2
  27. package/dist/core/ArtboardElement.d.ts +2 -0
  28. package/dist/core/CanvasRenderer.d.ts +3 -1
  29. package/dist/{custom-icons-sT5sNRcG.js → custom-icons-C4bzABm2.js} +2 -2
  30. package/dist/{custom-icons-sT5sNRcG.js.map → custom-icons-C4bzABm2.js.map} +1 -1
  31. package/dist/{design-builder-CwfefZJC.js → design-builder-DCHVrEFV.js} +315 -314
  32. package/dist/design-builder-DCHVrEFV.js.map +1 -0
  33. package/dist/{embed-rRSCS25g.js → embed-DnjyfavG.js} +10 -10
  34. package/dist/{embed-rRSCS25g.js.map → embed-DnjyfavG.js.map} +1 -1
  35. package/dist/embed.mjs +19 -19
  36. package/dist/engrave/EngraveSync.d.ts +5 -0
  37. package/dist/engrave/adjust.d.ts +36 -0
  38. package/dist/engrave/makeEngraved.d.ts +23 -0
  39. package/dist/engrave/types.d.ts +33 -0
  40. package/dist/{guards-Dvw7Qch0.js → guards-DwYEoqcn.js} +2 -2
  41. package/dist/{guards-Dvw7Qch0.js.map → guards-DwYEoqcn.js.map} +1 -1
  42. package/dist/index.mjs +57 -54
  43. package/dist/index.mjs.map +1 -1
  44. package/dist/internals.mjs +6 -6
  45. package/dist/rendering/EngraveViewRenderer.d.ts +15 -0
  46. package/dist/{template-fields-DF1ijCl9.js → template-fields-CK7Uvvc8.js} +5 -5
  47. package/dist/{template-fields-DF1ijCl9.js.map → template-fields-CK7Uvvc8.js.map} +1 -1
  48. package/dist/testing.mjs +3 -3
  49. package/dist/types/index.d.ts +5 -0
  50. package/dist/{useCommands-wwGeWCn6.js → useCommands-BrkGKdXr.js} +7 -7
  51. package/dist/{useCommands-wwGeWCn6.js.map → useCommands-BrkGKdXr.js.map} +1 -1
  52. package/dist/{usePieceGuideBundle-BWQINIJR.js → usePieceGuideBundle-BWdobHQE.js} +2 -2
  53. package/dist/{usePieceGuideBundle-BWQINIJR.js.map → usePieceGuideBundle-BWdobHQE.js.map} +1 -1
  54. package/dist/{validation-CXC34UhU.js → validation-DETfj7tg.js} +2206 -2201
  55. package/dist/validation-DETfj7tg.js.map +1 -0
  56. package/example/package.json +1 -1
  57. package/package.json +3 -3
  58. package/dist/CanvasRenderer-DIug_mjX.js.map +0 -1
  59. package/dist/ContextualToolbars-CspkC1T3.js +0 -6604
  60. package/dist/ContextualToolbars-CspkC1T3.js.map +0 -1
  61. package/dist/EditorCanvasImpl-Cn2fdo6a.js +0 -144
  62. package/dist/EditorCanvasImpl-Cn2fdo6a.js.map +0 -1
  63. package/dist/FontAnalyzer-CyhywbAM.js.map +0 -1
  64. package/dist/SnowconeCanvas-DE0A9UwD.js.map +0 -1
  65. package/dist/design-builder-CwfefZJC.js.map +0 -1
  66. package/dist/validation-CXC34UhU.js.map +0 -1
@@ -1,6 +1,8 @@
1
- import { k as le, l as he, a1 as nt, m as Ot, a2 as ce, a3 as de, a4 as Yt, a5 as fe, a6 as gt, a7 as ge, a8 as Gt, a9 as ue, aa as pe, c as te, ab as ye, ac as be, ad as Se, ae as me, v as ee, s as ne, af as pt, w as se, ag as Lt, ah as Xt, ai as Pt, aj as Nt, ak as Te, al as we, am as Kt, an as ve, ao as Me, ap as xe, I as Re, aq as Ce, ar as ke, as as tt } from "./FontAnalyzer-CyhywbAM.js";
2
- import { T as Wt, b as Pe, v as Ae, L as Ee, M as Dt, A as At, N as He, O as Ie, P as Be, Q as $t } from "./ExportManager-BDH9jW4Q.js";
3
- import { a as _t, i as jt } from "./guards-Dvw7Qch0.js";
1
+ import { k as pe, l as ye, a2 as nt, m as $t, a3 as be, a4 as Se, a5 as Kt, a6 as me, a7 as gt, a8 as Te, a9 as jt, aa as we, ab as ve, c as ae, ac as _t, ad as Me, ae as xe, af as Re, ag as Ce, v as re, s as le, ah as pt, w as he, ai as zt, aj as qt, ak as At, al as Ut, am as ke, an as Ae, ao as Zt, ap as Pe, aq as Ee, ar as He, I as Ie, as as Be, at as Le, au as tt } from "./FontAnalyzer-Ds3Wdba7.js";
2
+ import { T as Vt, b as De, v as We, L as _e, M as Ft, A as Pt, N as ze, O as Ve, P as Fe, Q as Jt } from "./ExportManager-xRsXgyNo.js";
3
+ import { a as Ot, i as Qt } from "./guards-DwYEoqcn.js";
4
+ import { cutValue as Oe, CUT_THRESHOLD as ce, hairlineMask as Ge } from "@snowcone-app/sdk/engrave";
5
+ import { m as Ye } from "./adjust-CDVzlVBY.js";
4
6
  const ct = {
5
7
  // Canvas-specific
6
8
  canvas: {
@@ -15,30 +17,30 @@ const ct = {
15
17
  spacingLabelFontSize: 11,
16
18
  spacingLabelFontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
17
19
  }
18
- }, Le = 2, Ct = 6, We = 16, De = 5, _e = 5, oe = 0.5;
19
- function qt(v) {
20
- return Le / v;
20
+ }, Xe = 2, Ct = 6, Ne = 16, $e = 5, Ke = 5, de = 0.5;
21
+ function te(T) {
22
+ return Xe / T;
21
23
  }
22
- function tn(v) {
23
- return Ct / v;
24
+ function bn(T) {
25
+ return Ct / T;
24
26
  }
25
- function ze(v) {
26
- return We / v;
27
+ function je(T) {
28
+ return Ne / T;
27
29
  }
28
- function en(v) {
29
- return [De / v, _e / v];
30
+ function Sn(T) {
31
+ return [$e / T, Ke / T];
30
32
  }
31
- function Ve(v, t, e, s) {
32
- v.save();
33
- const n = oe / s;
34
- v.translate(t, e), v.scale(n, n), v.strokeStyle = "#000", v.lineWidth = 1.5, v.lineCap = "round", v.lineJoin = "round", v.translate(-12, -12), v.beginPath(), v.moveTo(21, 12), v.arc(12, 12, 9, 0, -Math.PI / 2, !0), v.bezierCurveTo(3.5, 4.5, 4, 6, 3, 8), v.stroke(), v.beginPath(), v.moveTo(3, 3), v.lineTo(3, 8), v.lineTo(8, 8), v.stroke(), v.beginPath(), v.moveTo(3, 12), v.arc(12, 12, 9, Math.PI, Math.PI / 2, !0), v.bezierCurveTo(20.5, 19.5, 20, 18, 21, 16), v.stroke(), v.beginPath(), v.moveTo(16, 16), v.lineTo(21, 16), v.lineTo(21, 21), v.stroke(), v.restore();
33
+ function qe(T, t, e, s) {
34
+ T.save();
35
+ const n = de / s;
36
+ T.translate(t, e), T.scale(n, n), T.strokeStyle = "#000", T.lineWidth = 1.5, T.lineCap = "round", T.lineJoin = "round", T.translate(-12, -12), T.beginPath(), T.moveTo(21, 12), T.arc(12, 12, 9, 0, -Math.PI / 2, !0), T.bezierCurveTo(3.5, 4.5, 4, 6, 3, 8), T.stroke(), T.beginPath(), T.moveTo(3, 3), T.lineTo(3, 8), T.lineTo(8, 8), T.stroke(), T.beginPath(), T.moveTo(3, 12), T.arc(12, 12, 9, Math.PI, Math.PI / 2, !0), T.bezierCurveTo(20.5, 19.5, 20, 18, 21, 16), T.stroke(), T.beginPath(), T.moveTo(16, 16), T.lineTo(21, 16), T.lineTo(21, 21), T.stroke(), T.restore();
35
37
  }
36
- function nn(v, t, e, s = 1, n = "#3b82f6", o = !1) {
37
- const i = ze(s);
38
- v.save(), v.fillStyle = "#fff", v.strokeStyle = n, v.lineWidth = o ? qt(s) * 1.25 : qt(s), v.beginPath(), v.arc(t, e, i, 0, Math.PI * 2), v.fill(), v.stroke(), Ve(v, t, e, s), v.restore();
38
+ function mn(T, t, e, s = 1, n = "#3b82f6", o = !1) {
39
+ const i = je(s);
40
+ T.save(), T.fillStyle = "#fff", T.strokeStyle = n, T.lineWidth = o ? te(s) * 1.25 : te(s), T.beginPath(), T.arc(t, e, i, 0, Math.PI * 2), T.fill(), T.stroke(), qe(T, t, e, s), T.restore();
39
41
  }
40
- const Ut = Ct * 2;
41
- class sn {
42
+ const ee = Ct * 2;
43
+ class Tn {
42
44
  constructor() {
43
45
  this.resizeHandles = [], this.rotationHandle = null, this.elementRotation = 0, this.rotationAnchor = { x: 0, y: 0 };
44
46
  }
@@ -55,8 +57,8 @@ class sn {
55
57
  y: n.y - a,
56
58
  width: n.width + a * 2,
57
59
  height: n.height + a * 2
58
- }, l = le(r, t.rotation, o), h = Math.abs(t.rotation % 360) > 0.1;
59
- this.resizeHandles = l.filter((c) => !(!i.includes(c.anchor) || h && c.anchor.includes("middle"))), this.rotationHandle = he(
60
+ }, l = pe(r, t.rotation, o), h = Math.abs(t.rotation % 360) > 0.1;
61
+ this.resizeHandles = l.filter((c) => !(!i.includes(c.anchor) || h && c.anchor.includes("middle"))), this.rotationHandle = ye(
60
62
  r,
61
63
  t.rotation,
62
64
  o,
@@ -71,8 +73,8 @@ class sn {
71
73
  this.resizeHandles.forEach((c) => {
72
74
  if (a && r && c.anchor !== r.anchor)
73
75
  return;
74
- const d = !!(i && i.anchor === c.anchor), g = !!(a && r && r.anchor === c.anchor);
75
- this.renderResizeHandle(t, c, d, g, l);
76
+ const f = !!(i && i.anchor === c.anchor), d = !!(a && r && r.anchor === c.anchor);
77
+ this.renderResizeHandle(t, c, f, d, l);
76
78
  }), h && e && this.rotationHandle && !n && !a && this.renderRotationHandle(t, this.rotationHandle, o, l), h && e && this.rotationHandle && n && this.renderRotationTooltip(t, this.rotationHandle, s, l);
77
79
  }
78
80
  /**
@@ -85,8 +87,8 @@ class sn {
85
87
  if (e.anchor.includes("middle")) {
86
88
  const l = e.anchor === "middle-top" || e.anchor === "middle-bottom";
87
89
  t.translate(i, a), t.rotate(-this.elementRotation * Math.PI / 180), l && t.rotate(Math.PI / 2), t.translate(-i, -a);
88
- const h = Ut * 0.6, c = Ut * 1.4, d = h / 2, g = i - h / 2, b = a - c / 2;
89
- t.fillStyle = "#fff", t.strokeStyle = nt(t.canvas), t.lineWidth = s || n ? 2.5 : 2, t.beginPath(), t.roundRect(g, b, h, c, d), t.fill(), t.stroke();
90
+ const h = ee * 0.6, c = ee * 1.4, f = h / 2, d = i - h / 2, y = a - c / 2;
91
+ t.fillStyle = "#fff", t.strokeStyle = nt(t.canvas), t.lineWidth = s || n ? 2.5 : 2, t.beginPath(), t.roundRect(d, y, h, c, f), t.fill(), t.stroke();
90
92
  } else
91
93
  t.fillStyle = "#fff", t.strokeStyle = nt(t.canvas), t.lineWidth = s || n ? 2.5 : 2, t.beginPath(), t.arc(i, a, Ct, 0, Math.PI * 2), t.fill(), t.stroke();
92
94
  t.restore();
@@ -99,7 +101,7 @@ class sn {
99
101
  t.save();
100
102
  const o = e.x * n, i = e.y * n, a = Ct * 2.67;
101
103
  t.fillStyle = "#fff", t.strokeStyle = nt(t.canvas), t.lineWidth = s ? 2.5 : 2, t.beginPath(), t.arc(o, i, a, 0, Math.PI * 2), t.fill(), t.stroke();
102
- const r = oe;
104
+ const r = de;
103
105
  t.translate(o, i), t.scale(r, r), t.strokeStyle = "#000", t.lineWidth = 1.5, t.lineCap = "round", t.lineJoin = "round", t.translate(-12, -12), t.beginPath(), t.moveTo(21, 12), t.arc(12, 12, 9, 0, -Math.PI / 2, !0), t.bezierCurveTo(3.5, 4.5, 4, 6, 3, 8), t.stroke(), t.beginPath(), t.moveTo(3, 3), t.lineTo(3, 8), t.lineTo(8, 8), t.stroke(), t.beginPath(), t.moveTo(3, 12), t.arc(12, 12, 9, Math.PI, Math.PI / 2, !0), t.bezierCurveTo(20.5, 19.5, 20, 18, 21, 16), t.stroke(), t.beginPath(), t.moveTo(16, 16), t.lineTo(21, 16), t.lineTo(21, 21), t.stroke(), t.restore();
104
106
  }
105
107
  /**
@@ -115,9 +117,9 @@ class sn {
115
117
  * @param zoom - Current zoom level (radius scales inversely with zoom)
116
118
  */
117
119
  hitTestResize(t, e, s = 1) {
118
- const n = de / s;
120
+ const n = Se / s;
119
121
  for (const o of this.resizeHandles)
120
- if (Ot(t, e, o.x, o.y, n))
122
+ if ($t(t, e, o.x, o.y, n))
121
123
  return o;
122
124
  return null;
123
125
  }
@@ -128,7 +130,7 @@ class sn {
128
130
  hitTestRotation(t, e, s = 1) {
129
131
  if (!this.rotationHandle) return !1;
130
132
  const n = (Ct * 2.67 + 2) / s;
131
- return Ot(t, e, this.rotationHandle.x, this.rotationHandle.y, n);
133
+ return $t(t, e, this.rotationHandle.x, this.rotationHandle.y, n);
132
134
  }
133
135
  /**
134
136
  * Get rotation handle position (for React-based rendering)
@@ -143,7 +145,7 @@ class sn {
143
145
  */
144
146
  getCursor(t, e) {
145
147
  const s = t.anchor.includes("middle") ? "edge" : "corner";
146
- return ce(
148
+ return be(
147
149
  t.x,
148
150
  t.y,
149
151
  this.rotationAnchor.x,
@@ -154,19 +156,19 @@ class sn {
154
156
  );
155
157
  }
156
158
  }
157
- const Fe = 15;
158
- function Oe(v, t) {
159
- return Math.abs(v) >= Math.abs(t) ? "x" : "y";
159
+ const Ue = 15;
160
+ function Ze(T, t) {
161
+ return Math.abs(T) >= Math.abs(t) ? "x" : "y";
160
162
  }
161
- function Ye(v, t, e) {
162
- return e != null && e.shift ? Oe(v, t) === "x" ? { dx: v, dy: 0, lockedAxis: "y" } : { dx: 0, dy: t, lockedAxis: "x" } : { dx: v, dy: t, lockedAxis: null };
163
+ function Je(T, t, e) {
164
+ return e != null && e.shift ? Ze(T, t) === "x" ? { dx: T, dy: 0, lockedAxis: "y" } : { dx: 0, dy: t, lockedAxis: "x" } : { dx: T, dy: t, lockedAxis: null };
163
165
  }
164
- function Ge(v, t = Fe) {
165
- let s = (Math.round(v / t) * t % 360 + 360) % 360;
166
+ function Qe(T, t = Ue) {
167
+ let s = (Math.round(T / t) * t % 360 + 360) % 360;
166
168
  return s > 180 && (s -= 360), s === 0 ? 0 : s;
167
169
  }
168
- function Xe({
169
- anchor: v,
170
+ function tn({
171
+ anchor: T,
170
172
  startVisualWidth: t,
171
173
  startVisualHeight: e,
172
174
  newVisualWidth: s,
@@ -174,13 +176,13 @@ function Xe({
174
176
  }) {
175
177
  const o = t !== 0 ? t : 1, i = e !== 0 ? e : 1, a = s / o, r = n / i;
176
178
  let l;
177
- return v === "middle-left" || v === "middle-right" ? l = a : v === "middle-top" || v === "middle-bottom" ? l = r : l = Math.abs(a - 1) >= Math.abs(r - 1) ? a : r, {
179
+ return T === "middle-left" || T === "middle-right" ? l = a : T === "middle-top" || T === "middle-bottom" ? l = r : l = Math.abs(a - 1) >= Math.abs(r - 1) ? a : r, {
178
180
  scale: l,
179
181
  newVisualWidth: t * l,
180
182
  newVisualHeight: e * l
181
183
  };
182
184
  }
183
- class Ne {
185
+ class en {
184
186
  /**
185
187
  * Calculate new dimensions and position for a resize operation
186
188
  */
@@ -193,76 +195,76 @@ class Ne {
193
195
  snapSystem: i,
194
196
  modifiers: a
195
197
  }) {
196
- var _, G, V, j, H;
197
- const l = new Yt(t).worldDeltaToLocal(s, n), h = l.dx, c = l.dy, d = o.visualWidth ?? o.width ?? 0, g = o.visualHeight ?? o.height ?? 0, b = o.width ?? 0, u = o.height ?? 0;
198
- let p = d, f = g;
199
- e.anchor.includes("right") ? p = d + h : e.anchor.includes("left") && (p = d - h), e.anchor !== "middle-left" && e.anchor !== "middle-right" && (e.anchor.includes("bottom") ? f = g + c : e.anchor.includes("top") && (f = g - c));
200
- const y = (a == null ? void 0 : a.shift) === !0;
198
+ var _, Y, V, j, B;
199
+ const l = new Kt(t).worldDeltaToLocal(s, n), h = l.dx, c = l.dy, f = o.visualWidth ?? o.width ?? 0, d = o.visualHeight ?? o.height ?? 0, y = o.width ?? 0, p = o.height ?? 0;
200
+ let u = f, g = d;
201
+ e.anchor.includes("right") ? u = f + h : e.anchor.includes("left") && (u = f - h), e.anchor !== "middle-left" && e.anchor !== "middle-right" && (e.anchor.includes("bottom") ? g = d + c : e.anchor.includes("top") && (g = d - c));
202
+ const b = (a == null ? void 0 : a.shift) === !0;
201
203
  let S = null;
202
- if (y) {
203
- const z = Xe({
204
+ if (b) {
205
+ const z = tn({
204
206
  anchor: e.anchor,
205
- startVisualWidth: d,
206
- startVisualHeight: g,
207
- newVisualWidth: p,
208
- newVisualHeight: f
207
+ startVisualWidth: f,
208
+ startVisualHeight: d,
209
+ newVisualWidth: u,
210
+ newVisualHeight: g
209
211
  });
210
- S = z.scale, p = z.newVisualWidth, f = z.newVisualHeight;
212
+ S = z.scale, u = z.newVisualWidth, g = z.newVisualHeight;
211
213
  }
212
214
  let m, w;
213
215
  if (S !== null)
214
- m = b * S, w = u * S;
216
+ m = y * S, w = p * S;
215
217
  else if (e.anchor === "middle-left" || e.anchor === "middle-right") {
216
- const z = p - d;
217
- m = b + z, w = u;
218
+ const z = u - f;
219
+ m = y + z, w = p;
218
220
  } else if (e.anchor === "middle-top" || e.anchor === "middle-bottom") {
219
- const z = f - g;
220
- m = b, w = u + z;
221
+ const z = g - d;
222
+ m = y, w = p + z;
221
223
  } else {
222
- const z = p / d, K = f / g;
223
- m = b * z, w = u * K;
224
+ const z = u / f, $ = g / d;
225
+ m = y * z, w = p * $;
224
226
  }
225
- const T = p, R = f;
227
+ const v = u, M = g;
226
228
  let C = !1;
227
229
  if (i && t.transformType === "image") {
228
- const z = e.anchor ?? "", K = z === "top-left" || z === "top-right" || z === "bottom-left" || z === "bottom-right", Q = z.startsWith("crop-");
229
- if (K && !Q) {
230
- const L = (_ = i.activeSnaps) == null ? void 0 : _.x, P = (G = i.activeSnaps) == null ? void 0 : G.y;
231
- if (!!L || !!P) {
232
- const X = [L, P].find(
233
- (A) => typeof A == "object" && A !== null && "frozenWidth" in A
230
+ const z = e.anchor ?? "", $ = z === "top-left" || z === "top-right" || z === "bottom-left" || z === "bottom-right", Q = z.startsWith("crop-");
231
+ if ($ && !Q) {
232
+ const L = (_ = i.activeSnaps) == null ? void 0 : _.x, E = (Y = i.activeSnaps) == null ? void 0 : Y.y;
233
+ if (!!L || !!E) {
234
+ const X = [L, E].find(
235
+ (H) => typeof H == "object" && H !== null && "frozenWidth" in H
234
236
  );
235
237
  if (X) {
236
- const A = t, D = o.transformData, U = X.frozenWidth ?? ((V = A.transformData) == null ? void 0 : V.width) ?? b, ot = A.imageAspectRatio || (D != null && D.width && (D != null && D.height) ? D.width / D.height : null);
238
+ const H = t, W = o.transformData, U = X.frozenWidth ?? ((V = H.transformData) == null ? void 0 : V.width) ?? y, ot = H.imageAspectRatio || (W != null && W.width && (W != null && W.height) ? W.width / W.height : null);
237
239
  let et = X.frozenHeight;
238
- et == null && (ot && ot !== 0 ? et = U / ot : (j = A.transformData) != null && j.height ? et = A.transformData.height : et = u);
239
- const lt = b !== 0 ? U / b : 1, Y = u !== 0 ? et / u : 1;
240
- p = d * lt, f = g * Y, m = U, w = et, C = !0;
240
+ et == null && (ot && ot !== 0 ? et = U / ot : (j = H.transformData) != null && j.height ? et = H.transformData.height : et = p);
241
+ const lt = y !== 0 ? U / y : 1, G = p !== 0 ? et / p : 1;
242
+ u = f * lt, g = d * G, m = U, w = et, C = !0;
241
243
  }
242
244
  }
243
245
  }
244
246
  }
245
247
  m = Math.max(50, m), w = Math.max(40, w);
246
- const x = t.clone(), I = x.resize(e.anchor, m, w, o);
247
- if (!e.anchor.includes("middle") && ((H = x.stroke) != null && H.enabled) && o.strokeWidth !== void 0 && o.strokeWidth > 0) {
248
- const z = o.width ?? 1, K = o.height ?? 1, Q = Math.sqrt(m / z * (w / K)), L = Math.max(1, Math.round(o.strokeWidth * Q * 10) / 10);
249
- x.stroke = { ...x.stroke, width: L };
248
+ const R = t.clone(), I = R.resize(e.anchor, m, w, o);
249
+ if (!e.anchor.includes("middle") && ((B = R.stroke) != null && B.enabled) && o.strokeWidth !== void 0 && o.strokeWidth > 0) {
250
+ const z = o.width ?? 1, $ = o.height ?? 1, Q = Math.sqrt(m / z * (w / $)), L = Math.max(1, Math.round(o.strokeWidth * Q * 10) / 10);
251
+ R.stroke = { ...R.stroke, width: L };
250
252
  }
251
- const k = C || I === !1, E = e.anchor.includes("top") || e.anchor.includes("bottom"), B = "isCropping" in x && x.isCropping, W = "isGroup" in x && x.isGroup;
252
- if (E && !B && !W) {
253
- const z = t.getRotationAnchor(), K = this._calculateFixedCornerOffset({
253
+ const A = C || I === !1, k = e.anchor.includes("top") || e.anchor.includes("bottom"), P = "isCropping" in R && R.isCropping, D = "isGroup" in R && R.isGroup;
254
+ if (k && !P && !D) {
255
+ const z = t.getRotationAnchor(), $ = this._calculateFixedCornerOffset({
254
256
  element: t,
255
- updatedElement: x,
257
+ updatedElement: R,
256
258
  handle: e,
257
259
  rotationAnchor: z
258
260
  });
259
- x.x += K.x, x.y += K.y;
261
+ R.x += $.x, R.y += $.y;
260
262
  }
261
263
  return {
262
- element: x,
263
- isFrozen: k,
264
+ element: R,
265
+ isFrozen: A,
264
266
  // For snap system to detect break-free: dimensions before freeze was applied
265
- unfrozenDimensions: C ? { width: T, height: R } : void 0
267
+ unfrozenDimensions: C ? { width: v, height: M } : void 0
266
268
  };
267
269
  }
268
270
  /**
@@ -276,10 +278,10 @@ class Ne {
276
278
  handle: s,
277
279
  rotationAnchor: n
278
280
  }) {
279
- const o = new Yt(t), { cos: i, sin: a } = o.getRenderingCosSin(), r = t.getVisualBoundingBox(), l = e.getVisualBoundingBox(), h = n, c = e.getRotationAnchor(), d = this._getFixedLocalCoords(s.anchor, r.width, r.height), g = d.x, b = d.y, u = r.x - h.x, p = r.y - h.y, f = u + g, y = p + b, S = f * i - y * a, m = f * a + y * i, w = h.x + S, T = h.y + m, R = this._getFixedLocalCoords(s.anchor, l.width, l.height), C = R.x, x = R.y, I = l.x - c.x, M = l.y - c.y, k = I + C, E = M + x, B = k * i - E * a, W = k * a + E * i, _ = c.x + B, G = c.y + W;
281
+ const o = new Kt(t), { cos: i, sin: a } = o.getRenderingCosSin(), r = t.getVisualBoundingBox(), l = e.getVisualBoundingBox(), h = n, c = e.getRotationAnchor(), f = this._getFixedLocalCoords(s.anchor, r.width, r.height), d = f.x, y = f.y, p = r.x - h.x, u = r.y - h.y, g = p + d, b = u + y, S = g * i - b * a, m = g * a + b * i, w = h.x + S, v = h.y + m, M = this._getFixedLocalCoords(s.anchor, l.width, l.height), C = M.x, R = M.y, I = l.x - c.x, x = l.y - c.y, A = I + C, k = x + R, P = A * i - k * a, D = A * a + k * i, _ = c.x + P, Y = c.y + D;
280
282
  return {
281
283
  x: w - _,
282
- y: T - G
284
+ y: v - Y
283
285
  };
284
286
  }
285
287
  /**
@@ -317,7 +319,7 @@ class Ne {
317
319
  return n;
318
320
  }
319
321
  }
320
- class Ke {
322
+ class nn {
321
323
  constructor() {
322
324
  this.hooks = {
323
325
  beforeResize: [],
@@ -372,7 +374,7 @@ class Ke {
372
374
  */
373
375
  executeResize(t) {
374
376
  const e = this.runHooks("beforeResize", t);
375
- let s = Ne.calculateResize({
377
+ let s = en.calculateResize({
376
378
  ...e,
377
379
  snapSystem: t.snapSystem,
378
380
  modifiers: t.modifiers
@@ -388,8 +390,8 @@ class Ke {
388
390
  return this.runHooks("afterPositionUpdate", s).position;
389
391
  }
390
392
  }
391
- const on = new Ke();
392
- class an {
393
+ const wn = new nn();
394
+ class vn {
393
395
  constructor(t = null) {
394
396
  this.state = "IDLE", this.context = {
395
397
  mode: null,
@@ -484,13 +486,13 @@ class an {
484
486
  updateDrag(t, e, s = null, n) {
485
487
  if (this.state !== "DRAGGING")
486
488
  throw new Error("Cannot update drag: not in DRAGGING state");
487
- const o = t - this.context.startX, i = e - this.context.startY, { dx: a, dy: r, lockedAxis: l } = Ye(o, i, n), h = this.context.startData;
488
- let c = h.x + a, d = h.y + r;
489
+ const o = t - this.context.startX, i = e - this.context.startY, { dx: a, dy: r, lockedAxis: l } = Je(o, i, n), h = this.context.startData;
490
+ let c = h.x + a, f = h.y + r;
489
491
  if (this.snapHandler && this.snapHandler.snapPosition && this.context.element) {
490
- const g = this.snapHandler.snapPosition({ x: c, y: d }, this.context.element, s);
491
- c = g.x, d = g.y;
492
+ const d = this.snapHandler.snapPosition({ x: c, y: f }, this.context.element, s);
493
+ c = d.x, f = d.y;
492
494
  }
493
- return l === "x" ? c = h.x : l === "y" && (d = h.y), { x: c, y: d };
495
+ return l === "x" ? c = h.x : l === "y" && (f = h.y), { x: c, y: f };
494
496
  }
495
497
  /**
496
498
  * Start resize operation
@@ -600,9 +602,9 @@ class an {
600
602
  updateRotate(t, e, s, n, o) {
601
603
  if (this.state !== "ROTATING")
602
604
  throw new Error("Cannot update rotate: not in ROTATING state");
603
- const i = this.context.startData, r = (fe(s, n, t, e) - i.startAngle) * 180 / Math.PI;
605
+ const i = this.context.startData, r = (me(s, n, t, e) - i.startAngle) * 180 / Math.PI;
604
606
  let l = i.currentRotation - r;
605
- return l = (l % 360 + 360) % 360, l > 180 && (l -= 360), o != null && o.shift ? Ge(l) : this.snapHandler && this.snapHandler.snapRotation && this.context.element ? this.snapHandler.snapRotation(l, this.context.element) : l;
607
+ return l = (l % 360 + 360) % 360, l > 180 && (l -= 360), o != null && o.shift ? Qe(l) : this.snapHandler && this.snapHandler.snapRotation && this.context.element ? this.snapHandler.snapRotation(l, this.context.element) : l;
606
608
  }
607
609
  /**
608
610
  * Get rotation context
@@ -663,10 +665,10 @@ class an {
663
665
  const s = this.context.startData, n = {
664
666
  x: (t.x + e.x) / 2,
665
667
  y: (t.y + e.y) / 2
666
- }, o = e.x - t.x, i = e.y - t.y, a = Math.hypot(o, i), r = Math.atan2(i, o), l = Math.max(s.startDistance, 1e-4), h = a / l, c = Math.max(h, 0.05), d = r - s.startAngle;
668
+ }, o = e.x - t.x, i = e.y - t.y, a = Math.hypot(o, i), r = Math.atan2(i, o), l = Math.max(s.startDistance, 1e-4), h = a / l, c = Math.max(h, 0.05), f = r - s.startAngle;
667
669
  return {
668
670
  scale: c,
669
- rotationDelta: d,
671
+ rotationDelta: f,
670
672
  startCentroid: s.startCentroid,
671
673
  currentCentroid: n
672
674
  };
@@ -824,7 +826,7 @@ class mt {
824
826
  return Math.abs(n.x - s.x) > o || Math.abs(n.y - s.y) > o;
825
827
  }
826
828
  }
827
- class Zt {
829
+ class ne {
828
830
  constructor(t) {
829
831
  this.cellSize = t, this.cells = /* @__PURE__ */ new Map(), this.idIndex = /* @__PURE__ */ new Map();
830
832
  }
@@ -866,12 +868,12 @@ class Zt {
866
868
  const o = [], i = Math.floor((t - s) / this.cellSize), a = Math.floor((t + s) / this.cellSize), r = Math.floor((e - s) / this.cellSize), l = Math.floor((e + s) / this.cellSize);
867
869
  for (let h = i; h <= a; h++)
868
870
  for (let c = r; c <= l; c++) {
869
- const d = `${h},${c}`, g = this.cells.get(d);
870
- if (g)
871
- for (const b of g) {
872
- if (n !== void 0 && b.id === n) continue;
873
- const u = b.x - t, p = b.y - e;
874
- u * u + p * p <= s * s && o.push(b);
871
+ const f = `${h},${c}`, d = this.cells.get(f);
872
+ if (d)
873
+ for (const y of d) {
874
+ if (n !== void 0 && y.id === n) continue;
875
+ const p = y.x - t, u = y.y - e;
876
+ p * p + u * u <= s * s && o.push(y);
875
877
  }
876
878
  }
877
879
  return o;
@@ -895,16 +897,16 @@ class Zt {
895
897
  for (const [r, l] of this.cells) {
896
898
  const h = r.indexOf(","), c = parseInt(r.substring(0, h), 10);
897
899
  if (!(c < i || c > a))
898
- for (const d of l)
899
- n !== void 0 && d.id === n || Math.abs(d.x - e) <= s && o.push(d);
900
+ for (const f of l)
901
+ n !== void 0 && f.id === n || Math.abs(f.x - e) <= s && o.push(f);
900
902
  }
901
903
  } else {
902
904
  const i = Math.floor((e - s) / this.cellSize), a = Math.floor((e + s) / this.cellSize);
903
905
  for (const [r, l] of this.cells) {
904
906
  const h = r.indexOf(","), c = parseInt(r.substring(h + 1), 10);
905
907
  if (!(c < i || c > a))
906
- for (const d of l)
907
- n !== void 0 && d.id === n || Math.abs(d.y - e) <= s && o.push(d);
908
+ for (const f of l)
909
+ n !== void 0 && f.id === n || Math.abs(f.y - e) <= s && o.push(f);
908
910
  }
909
911
  }
910
912
  return o;
@@ -920,32 +922,32 @@ class Zt {
920
922
  return `${Math.floor(t / this.cellSize)},${Math.floor(e / this.cellSize)}`;
921
923
  }
922
924
  }
923
- function ft(v) {
924
- const t = v.transformData;
925
+ function ft(T) {
926
+ const t = T.transformData;
925
927
  if (t && "width" in t && typeof t.width == "number")
926
928
  return t.width;
927
929
  }
928
- function Tt(v) {
929
- const t = v.transformData;
930
+ function Tt(T) {
931
+ const t = T.transformData;
930
932
  if (t && "height" in t && typeof t.height == "number")
931
933
  return t.height;
932
934
  }
933
- function xt(v, t) {
934
- const e = v.transformData;
935
+ function xt(T, t) {
936
+ const e = T.transformData;
935
937
  return e && "width" in e ? (e.width = t, !0) : !1;
936
938
  }
937
- function Et(v, t) {
938
- const e = v.transformData;
939
+ function Et(T, t) {
940
+ const e = T.transformData;
939
941
  return e && "height" in e ? (e.height = t, !0) : !1;
940
942
  }
941
- class rn {
943
+ class Mn {
942
944
  constructor(t = {}) {
943
945
  this._extraSnapRects = [], this.snapThreshold = t.snapThreshold || ct.canvas.snapThreshold, this.enabled = t.enabled !== !1, this.showGuides = t.showGuides !== !1, this.guides = [], this.activeSnaps = {
944
946
  x: null,
945
947
  // { snapTo: number, anchorKey: string, frozenFontSize: number, frozenWidth: number, frozenPosition: {x, y}, isPositionBasedSnap: boolean }
946
948
  y: null
947
949
  // { snapTo: number, anchorKey: string, frozenFontSize: number, frozenWidth: number, frozenPosition: {x, y}, isPositionBasedSnap: boolean }
948
- }, this.stickyThreshold = t.stickyThreshold || 15, this._spatialGrid = new Zt(Math.max(this.snapThreshold * 2, 16)), this._anchorMetadata = /* @__PURE__ */ new Map();
950
+ }, this.stickyThreshold = t.stickyThreshold || 15, this._spatialGrid = new ne(Math.max(this.snapThreshold * 2, 16)), this._anchorMetadata = /* @__PURE__ */ new Map();
949
951
  }
950
952
  /**
951
953
  * Enable or disable snapping
@@ -957,7 +959,7 @@ class rn {
957
959
  * Set snap threshold in pixels
958
960
  */
959
961
  setSnapThreshold(t) {
960
- this.snapThreshold = t, this._spatialGrid = new Zt(Math.max(t * 2, 16));
962
+ this.snapThreshold = t, this._spatialGrid = new ne(Math.max(t * 2, 16));
961
963
  }
962
964
  /**
963
965
  * Get current snap guides for rendering
@@ -1045,18 +1047,18 @@ class rn {
1045
1047
  return this.clearGuides(), t;
1046
1048
  const n = e.clone();
1047
1049
  n.x = t.x, n.y = t.y;
1048
- const o = mt.getSnapAnchors(n), i = s.filter((y) => y.id !== e.id);
1050
+ const o = mt.getSnapAnchors(n), i = s.filter((b) => b.id !== e.id);
1049
1051
  this._populateSpatialGrid(i);
1050
1052
  let a = null, r = null, l = 1 / 0, h = 1 / 0;
1051
- const c = [], d = [], g = [];
1052
- for (const [y, S] of Object.entries(o)) {
1053
+ const c = [], f = [], d = [];
1054
+ for (const [b, S] of Object.entries(o)) {
1053
1055
  const m = this._spatialGrid.queryNearAxis("x", S.x, this.snapThreshold);
1054
- for (const T of m) {
1055
- const R = this._anchorMetadata.get(T.id);
1056
- if (!R) continue;
1057
- const C = R.point, x = R.anchorKey, I = Math.abs(S.x - C.x);
1056
+ for (const v of m) {
1057
+ const M = this._anchorMetadata.get(v.id);
1058
+ if (!M) continue;
1059
+ const C = M.point, R = M.anchorKey, I = Math.abs(S.x - C.x);
1058
1060
  if (I < this.snapThreshold) {
1059
- const M = {
1061
+ const x = {
1060
1062
  snapTo: C.x,
1061
1063
  offset: S.x - t.x,
1062
1064
  // How far anchor is from element position
@@ -1066,20 +1068,20 @@ class rn {
1066
1068
  x: C.x,
1067
1069
  y1: Math.min(S.y, C.y) - 50,
1068
1070
  y2: Math.max(S.y, C.y) + 50,
1069
- movingKey: y,
1070
- otherKey: x
1071
+ movingKey: b,
1072
+ otherKey: R
1071
1073
  }
1072
1074
  };
1073
- c.push(M), I < l && (l = I, a = M);
1075
+ c.push(x), I < l && (l = I, a = x);
1074
1076
  }
1075
1077
  }
1076
1078
  const w = this._spatialGrid.queryNearAxis("y", S.y, this.snapThreshold);
1077
- for (const T of w) {
1078
- const R = this._anchorMetadata.get(T.id);
1079
- if (!R) continue;
1080
- const C = R.point, x = R.anchorKey, I = Math.abs(S.y - C.y);
1079
+ for (const v of w) {
1080
+ const M = this._anchorMetadata.get(v.id);
1081
+ if (!M) continue;
1082
+ const C = M.point, R = M.anchorKey, I = Math.abs(S.y - C.y);
1081
1083
  if (I < this.snapThreshold) {
1082
- const M = {
1084
+ const x = {
1083
1085
  snapTo: C.y,
1084
1086
  offset: S.y - t.y,
1085
1087
  distance: I,
@@ -1088,30 +1090,30 @@ class rn {
1088
1090
  y: C.y,
1089
1091
  x1: Math.min(S.x, C.x) - 50,
1090
1092
  x2: Math.max(S.x, C.x) + 50,
1091
- movingKey: y,
1092
- otherKey: x
1093
+ movingKey: b,
1094
+ otherKey: R
1093
1095
  }
1094
1096
  };
1095
- d.push(M), I < h && (h = I, r = M);
1097
+ f.push(x), I < h && (h = I, r = x);
1096
1098
  }
1097
1099
  }
1098
1100
  }
1099
- let b = t.x, u = t.y;
1100
- a && (b = a.snapTo - a.offset), r && (u = r.snapTo - r.offset);
1101
- const p = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
1102
- for (const y of c) {
1103
- const S = p.get(y.snapTo);
1104
- (!S || y.distance < S.distance) && p.set(y.snapTo, y);
1101
+ let y = t.x, p = t.y;
1102
+ a && (y = a.snapTo - a.offset), r && (p = r.snapTo - r.offset);
1103
+ const u = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
1104
+ for (const b of c) {
1105
+ const S = u.get(b.snapTo);
1106
+ (!S || b.distance < S.distance) && u.set(b.snapTo, b);
1105
1107
  }
1106
- for (const y of d) {
1107
- const S = f.get(y.snapTo);
1108
- (!S || y.distance < S.distance) && f.set(y.snapTo, y);
1108
+ for (const b of f) {
1109
+ const S = g.get(b.snapTo);
1110
+ (!S || b.distance < S.distance) && g.set(b.snapTo, b);
1109
1111
  }
1110
- for (const y of p.values())
1111
- g.push(y.guide);
1112
- for (const y of f.values())
1113
- g.push(y.guide);
1114
- return this.guides = g, { x: b, y: u };
1112
+ for (const b of u.values())
1113
+ d.push(b.guide);
1114
+ for (const b of g.values())
1115
+ d.push(b.guide);
1116
+ return this.guides = d, { x: y, y: p };
1115
1117
  }
1116
1118
  /**
1117
1119
  * Calculate what the frozen font size should be at the snap point
@@ -1162,18 +1164,18 @@ class rn {
1162
1164
  for (const h of l) {
1163
1165
  const c = this._anchorMetadata.get(h.id);
1164
1166
  if (!c || !i.has(c.anchorKey)) continue;
1165
- const d = c.point, g = c.anchorKey, b = Math.abs(r.x - d.x);
1166
- b < this.snapThreshold && o.push({
1167
- distance: b,
1168
- snapTo: d.x,
1167
+ const f = c.point, d = c.anchorKey, y = Math.abs(r.x - f.x);
1168
+ y < this.snapThreshold && o.push({
1169
+ distance: y,
1170
+ snapTo: f.x,
1169
1171
  currentValue: r.x,
1170
1172
  guide: {
1171
1173
  type: "vertical",
1172
- x: d.x,
1173
- y1: Math.min(r.y, d.y) - 50,
1174
- y2: Math.max(r.y, d.y) + 50,
1174
+ x: f.x,
1175
+ y1: Math.min(r.y, f.y) - 50,
1176
+ y2: Math.max(r.y, f.y) + 50,
1175
1177
  movingKey: a,
1176
- otherKey: g
1178
+ otherKey: d
1177
1179
  }
1178
1180
  });
1179
1181
  }
@@ -1194,18 +1196,18 @@ class rn {
1194
1196
  for (const h of l) {
1195
1197
  const c = this._anchorMetadata.get(h.id);
1196
1198
  if (!c || !i.has(c.anchorKey)) continue;
1197
- const d = c.point, g = c.anchorKey, b = Math.abs(r.y - d.y);
1198
- b < this.snapThreshold && o.push({
1199
- distance: b,
1200
- snapTo: d.y,
1199
+ const f = c.point, d = c.anchorKey, y = Math.abs(r.y - f.y);
1200
+ y < this.snapThreshold && o.push({
1201
+ distance: y,
1202
+ snapTo: f.y,
1201
1203
  currentValue: r.y,
1202
1204
  guide: {
1203
1205
  type: "horizontal",
1204
- y: d.y,
1205
- x1: Math.min(r.x, d.x) - 50,
1206
- x2: Math.max(r.x, d.x) + 50,
1206
+ y: f.y,
1207
+ x1: Math.min(r.x, f.x) - 50,
1208
+ x2: Math.max(r.x, f.x) + 50,
1207
1209
  movingKey: a,
1208
- otherKey: g
1210
+ otherKey: d
1209
1211
  }
1210
1212
  });
1211
1213
  }
@@ -1316,8 +1318,8 @@ class rn {
1316
1318
  _calculateFrozenDimensionsAtSnap(t, e, s, n, o) {
1317
1319
  const i = ft(t) ?? t.width ?? 0, a = Tt(t) ?? t.height ?? 0;
1318
1320
  let r = i, l = a;
1319
- const h = t.transformType === "image", c = h ? t.imageAspectRatio || (i && a ? i / a : null) : null, d = n.toLowerCase();
1320
- return e === "x" ? d.includes("right") ? (r = i + s, h && c && (l = r / c)) : d.includes("left") && (r = i - s, h && c && (l = r / c)) : e === "y" && (d.includes("bottom") ? (l = a + s, h && c && (r = l * c)) : d.includes("top") && (l = a - s, h && c && (r = l * c))), { frozenWidth: r, frozenHeight: l };
1321
+ const h = t.transformType === "image", c = h ? t.imageAspectRatio || (i && a ? i / a : null) : null, f = n.toLowerCase();
1322
+ return e === "x" ? f.includes("right") ? (r = i + s, h && c && (l = r / c)) : f.includes("left") && (r = i - s, h && c && (l = r / c)) : e === "y" && (f.includes("bottom") ? (l = a + s, h && c && (r = l * c)) : f.includes("top") && (l = a - s, h && c && (r = l * c))), { frozenWidth: r, frozenHeight: l };
1321
1323
  }
1322
1324
  /**
1323
1325
  * Process sticky snapping for a single axis
@@ -1329,32 +1331,32 @@ class rn {
1329
1331
  if (r) {
1330
1332
  const c = e[r.anchorKey];
1331
1333
  if (c) {
1332
- const d = t === "x" ? c.x : c.y, g = Math.abs(d - r.snapTo), b = this._getAdjustedStickyThreshold(t, n);
1333
- if (g < b) {
1334
- if (l = r.snapTo - d, !(t === "y" && r.isPositionBasedSnap)) {
1335
- const p = this._calculateFrozenFontSizeAtSnap(
1334
+ const f = t === "x" ? c.x : c.y, d = Math.abs(f - r.snapTo), y = this._getAdjustedStickyThreshold(t, n);
1335
+ if (d < y) {
1336
+ if (l = r.snapTo - f, !(t === "y" && r.isPositionBasedSnap)) {
1337
+ const u = this._calculateFrozenFontSizeAtSnap(
1336
1338
  n,
1337
1339
  t === "x" ? l : 0,
1338
1340
  t === "y" ? l : 0,
1339
1341
  o,
1340
1342
  i
1341
1343
  );
1342
- p !== r.frozenFontSize && (r.frozenFontSize = p);
1344
+ u !== r.frozenFontSize && (r.frozenFontSize = u);
1343
1345
  }
1344
1346
  h = this._createGuideForSnap(r, r.anchorKey, e, a, t);
1345
1347
  } else {
1346
- const u = r;
1348
+ const p = r;
1347
1349
  if (this.activeSnaps[t] = null, s.length > 0 && s[0].distance < this.snapThreshold) {
1348
1350
  h = s[0], l = h.snapTo - h.currentValue;
1349
- const p = u && u.anchorKey === h.guide.movingKey && Math.abs(u.snapTo - h.snapTo) < 1, f = p ? u.frozenFontSize : this._calculateFrozenFontSizeAtSnap(
1351
+ const u = p && p.anchorKey === h.guide.movingKey && Math.abs(p.snapTo - h.snapTo) < 1, g = u ? p.frozenFontSize : this._calculateFrozenFontSizeAtSnap(
1350
1352
  n,
1351
1353
  t === "x" ? l : 0,
1352
1354
  t === "y" ? l : 0,
1353
1355
  o,
1354
1356
  i
1355
- ), y = this._isPositionBasedSnap(n, t);
1357
+ ), b = this._isPositionBasedSnap(n, t);
1356
1358
  let S;
1357
- p ? S = u.frozenPosition : y ? S = {
1359
+ u ? S = p.frozenPosition : b ? S = {
1358
1360
  x: t === "x" ? n.x + l : n.x,
1359
1361
  y: t === "y" ? n.y + l : n.y
1360
1362
  } : S = { x: n.x, y: n.y };
@@ -1368,11 +1370,11 @@ class rn {
1368
1370
  this.activeSnaps[t] = {
1369
1371
  snapTo: h.snapTo,
1370
1372
  anchorKey: h.guide.movingKey,
1371
- frozenFontSize: f,
1373
+ frozenFontSize: g,
1372
1374
  frozenWidth: m.frozenWidth,
1373
1375
  frozenHeight: m.frozenHeight,
1374
1376
  frozenPosition: S,
1375
- isPositionBasedSnap: y
1377
+ isPositionBasedSnap: b
1376
1378
  };
1377
1379
  }
1378
1380
  }
@@ -1380,19 +1382,19 @@ class rn {
1380
1382
  this.activeSnaps[t] = null;
1381
1383
  } else if (s.length > 0 && s[0].distance < this.snapThreshold) {
1382
1384
  h = s[0], l = h.snapTo - h.currentValue;
1383
- const c = this.activeSnaps[t], d = c && c.anchorKey === h.guide.movingKey && Math.abs(c.snapTo - h.snapTo) < 1, g = d ? c.frozenFontSize : this._calculateFrozenFontSizeAtSnap(
1385
+ const c = this.activeSnaps[t], f = c && c.anchorKey === h.guide.movingKey && Math.abs(c.snapTo - h.snapTo) < 1, d = f ? c.frozenFontSize : this._calculateFrozenFontSizeAtSnap(
1384
1386
  n,
1385
1387
  t === "x" ? l : 0,
1386
1388
  t === "y" ? l : 0,
1387
1389
  o,
1388
1390
  i
1389
- ), b = this._isPositionBasedSnap(n, t);
1390
- let u;
1391
- d ? u = c.frozenPosition : b ? u = {
1391
+ ), y = this._isPositionBasedSnap(n, t);
1392
+ let p;
1393
+ f ? p = c.frozenPosition : y ? p = {
1392
1394
  x: t === "x" ? n.x + l : n.x,
1393
1395
  y: t === "y" ? n.y + l : n.y
1394
- } : u = { x: n.x, y: n.y };
1395
- const p = this._calculateFrozenDimensionsAtSnap(
1396
+ } : p = { x: n.x, y: n.y };
1397
+ const u = this._calculateFrozenDimensionsAtSnap(
1396
1398
  n,
1397
1399
  t,
1398
1400
  l,
@@ -1402,11 +1404,11 @@ class rn {
1402
1404
  this.activeSnaps[t] = {
1403
1405
  snapTo: h.snapTo,
1404
1406
  anchorKey: h.guide.movingKey,
1405
- frozenFontSize: g,
1406
- frozenWidth: p.frozenWidth,
1407
- frozenHeight: p.frozenHeight,
1408
- frozenPosition: u,
1409
- isPositionBasedSnap: b
1407
+ frozenFontSize: d,
1408
+ frozenWidth: u.frozenWidth,
1409
+ frozenHeight: u.frozenHeight,
1410
+ frozenPosition: p,
1411
+ isPositionBasedSnap: y
1410
1412
  };
1411
1413
  }
1412
1414
  return { snapDelta: l, bestSnap: h };
@@ -1493,63 +1495,63 @@ class rn {
1493
1495
  * @returns {object} Modified resize result with adjusted element
1494
1496
  */
1495
1497
  snapDimensions(t, e, s = null) {
1496
- var T, R, C, x, I;
1498
+ var v, M, C, R, I;
1497
1499
  if (!this.enabled || !e)
1498
1500
  return this.clearGuides(), t;
1499
1501
  const { element: n } = t, o = t.handle;
1500
1502
  let i;
1501
1503
  const a = n.transformType === "image", r = this.activeSnaps.x !== null || this.activeSnaps.y !== null;
1502
1504
  if (a && r && t.isFrozen && t.unfrozenDimensions) {
1503
- const M = n.clone();
1504
- if (M.transformData) {
1505
- const k = n.getVisualBoundingBox(), E = k.width, B = k.height, W = (s == null ? void 0 : s.width) ?? n.width ?? 0, _ = (s == null ? void 0 : s.height) ?? n.height ?? 0, G = (s == null ? void 0 : s.visualWidth) ?? E, V = (s == null ? void 0 : s.visualHeight) ?? B, j = t.unfrozenDimensions.width / G, H = t.unfrozenDimensions.height / V;
1506
- xt(M, W * j), Et(M, _ * H);
1505
+ const x = n.clone();
1506
+ if (x.transformData) {
1507
+ const A = n.getVisualBoundingBox(), k = A.width, P = A.height, D = (s == null ? void 0 : s.width) ?? n.width ?? 0, _ = (s == null ? void 0 : s.height) ?? n.height ?? 0, Y = (s == null ? void 0 : s.visualWidth) ?? k, V = (s == null ? void 0 : s.visualHeight) ?? P, j = t.unfrozenDimensions.width / Y, B = t.unfrozenDimensions.height / V;
1508
+ xt(x, D * j), Et(x, _ * B);
1507
1509
  }
1508
- i = mt.getSnapAnchors(M);
1510
+ i = mt.getSnapAnchors(x);
1509
1511
  } else
1510
1512
  i = mt.getSnapAnchors(n);
1511
- const l = e.filter((M) => M.id !== n.id);
1513
+ const l = e.filter((x) => x.id !== n.id);
1512
1514
  if (l.length === 0)
1513
1515
  return this.clearGuides(), t;
1514
1516
  this._populateSpatialGrid(l);
1515
- const h = this._getSnapKeysForHandle(o), c = this._getTargetSnapKeys(), d = this._findXSnaps(i, l, h, c), g = this._findYSnaps(i, l, h, c);
1516
- this._prioritizeSnaps(d, o, "x"), this._prioritizeSnaps(g, o, "y");
1517
- const b = this._processStickySnap("x", i, d, n, o, s, l), u = this._processStickySnap("y", i, g, n, o, s, l), p = b.snapDelta, f = u.snapDelta, y = b.bestSnap, S = u.bestSnap, m = [];
1518
- y && m.push(y.guide), S && m.push(S.guide), this.guides = m, m.length > 0;
1517
+ const h = this._getSnapKeysForHandle(o), c = this._getTargetSnapKeys(), f = this._findXSnaps(i, l, h, c), d = this._findYSnaps(i, l, h, c);
1518
+ this._prioritizeSnaps(f, o, "x"), this._prioritizeSnaps(d, o, "y");
1519
+ const y = this._processStickySnap("x", i, f, n, o, s, l), p = this._processStickySnap("y", i, d, n, o, s, l), u = y.snapDelta, g = p.snapDelta, b = y.bestSnap, S = p.bestSnap, m = [];
1520
+ b && m.push(b.guide), S && m.push(S.guide), this.guides = m, m.length > 0;
1519
1521
  const w = o && (o.anchor === "top-left" || o.anchor === "top-right" || o.anchor === "bottom-left" || o.anchor === "bottom-right");
1520
- if (a && w && (p !== 0 || f !== 0))
1522
+ if (a && w && (u !== 0 || g !== 0))
1521
1523
  return t;
1522
- if (p !== 0 || f !== 0) {
1523
- const M = n.clone(), k = this.activeSnaps.x || this.activeSnaps.y, E = (k == null ? void 0 : k.frozenFontSize) ?? n.fontSize ?? 0, B = (k == null ? void 0 : k.frozenWidth) ?? ft(n) ?? n.width ?? 0, W = (k == null ? void 0 : k.frozenHeight) ?? Tt(n) ?? n.height ?? 0, _ = (k == null ? void 0 : k.frozenPosition) ?? { x: n.x, y: n.y }, G = M.isCropping && !String(o.anchor).startsWith("crop-");
1524
- if (!G)
1524
+ if (u !== 0 || g !== 0) {
1525
+ const x = n.clone(), A = this.activeSnaps.x || this.activeSnaps.y, k = (A == null ? void 0 : A.frozenFontSize) ?? n.fontSize ?? 0, P = (A == null ? void 0 : A.frozenWidth) ?? ft(n) ?? n.width ?? 0, D = (A == null ? void 0 : A.frozenHeight) ?? Tt(n) ?? n.height ?? 0, _ = (A == null ? void 0 : A.frozenPosition) ?? { x: n.x, y: n.y }, Y = x.isCropping && !String(o.anchor).startsWith("crop-");
1526
+ if (!Y)
1525
1527
  if (o && o.anchor) {
1526
- if (p !== 0) {
1527
- const L = (T = this.activeSnaps.x) == null ? void 0 : T.anchorKey, P = L == null ? void 0 : L.toLowerCase();
1528
- P && P.includes("right") ? this._adjustElementForRightResize(M, p, o) : P && P.includes("left") ? this._adjustElementForLeftResize(M, p, o) : M.x += p;
1528
+ if (u !== 0) {
1529
+ const L = (v = this.activeSnaps.x) == null ? void 0 : v.anchorKey, E = L == null ? void 0 : L.toLowerCase();
1530
+ E && E.includes("right") ? this._adjustElementForRightResize(x, u, o) : E && E.includes("left") ? this._adjustElementForLeftResize(x, u, o) : x.x += u;
1529
1531
  }
1530
- if (f !== 0) {
1531
- const L = (R = this.activeSnaps.y) == null ? void 0 : R.anchorKey, P = L == null ? void 0 : L.toLowerCase();
1532
- P && P.includes("bottom") ? this._adjustElementForBottomResize(M, f, o) : P && P.includes("top") ? this._adjustElementForTopResize(M, f, o) : M.y += f;
1532
+ if (g !== 0) {
1533
+ const L = (M = this.activeSnaps.y) == null ? void 0 : M.anchorKey, E = L == null ? void 0 : L.toLowerCase();
1534
+ E && E.includes("bottom") ? this._adjustElementForBottomResize(x, g, o) : E && E.includes("top") ? this._adjustElementForTopResize(x, g, o) : x.y += g;
1533
1535
  }
1534
1536
  } else
1535
- M.x += p, M.y += f;
1536
- M.fontSize !== void 0 && (M.fontSize = E);
1537
- const V = M.transformType === "image", j = this.activeSnaps.x !== null || this.activeSnaps.y !== null;
1537
+ x.x += u, x.y += g;
1538
+ x.fontSize !== void 0 && (x.fontSize = k);
1539
+ const V = x.transformType === "image", j = this.activeSnaps.x !== null || this.activeSnaps.y !== null;
1538
1540
  if (V && j) {
1539
- if (ft(M) !== void 0) {
1541
+ if (ft(x) !== void 0) {
1540
1542
  const L = this.activeSnaps.x || this.activeSnaps.y;
1541
- let P = B, O = W;
1542
- L && (P = L.frozenWidth ?? P, O = L.frozenHeight ?? O);
1543
- const X = ft(n), A = Tt(n), D = M.imageAspectRatio || (X && A ? X / A : null);
1544
- D && D !== 0 && (O = P / D), xt(M, P), Et(M, O), L && (L.frozenWidth = P, L.frozenHeight = O);
1543
+ let E = P, O = D;
1544
+ L && (E = L.frozenWidth ?? E, O = L.frozenHeight ?? O);
1545
+ const X = ft(n), H = Tt(n), W = x.imageAspectRatio || (X && H ? X / H : null);
1546
+ W && W !== 0 && (O = E / W), xt(x, E), Et(x, O), L && (L.frozenWidth = E, L.frozenHeight = O);
1545
1547
  }
1546
1548
  } else
1547
- (((C = this.activeSnaps.y) == null ? void 0 : C.isPositionBasedSnap) || !1) && (ft(M) !== void 0 ? xt(M, B) : M.width !== void 0 && (M.width = B));
1548
- const H = o && (o.anchor === "middle-left" || o.anchor === "middle-right"), z = o && (o.anchor === "middle-top" || o.anchor === "middle-bottom"), K = ((x = this.activeSnaps.x) == null ? void 0 : x.isPositionBasedSnap) || !1, Q = ((I = this.activeSnaps.y) == null ? void 0 : I.isPositionBasedSnap) || !1;
1549
- return (p === 0 || K) && !H && !z && !G && (M.x = _.x), (f === 0 || Q) && !z && !H && !G && (M.y = _.y), {
1549
+ (((C = this.activeSnaps.y) == null ? void 0 : C.isPositionBasedSnap) || !1) && (ft(x) !== void 0 ? xt(x, P) : x.width !== void 0 && (x.width = P));
1550
+ const B = o && (o.anchor === "middle-left" || o.anchor === "middle-right"), z = o && (o.anchor === "middle-top" || o.anchor === "middle-bottom"), $ = ((R = this.activeSnaps.x) == null ? void 0 : R.isPositionBasedSnap) || !1, Q = ((I = this.activeSnaps.y) == null ? void 0 : I.isPositionBasedSnap) || !1;
1551
+ return (u === 0 || $) && !B && !z && !Y && (x.x = _.x), (g === 0 || Q) && !z && !B && !Y && (x.y = _.y), {
1550
1552
  ...t,
1551
- element: M,
1552
- snapAdjustment: { dx: p, dy: f },
1553
+ element: x,
1554
+ snapAdjustment: { dx: u, dy: g },
1553
1555
  // Flag to indicate we're in sticky snap mode (used to freeze font size)
1554
1556
  isInStickySnap: !0
1555
1557
  };
@@ -1563,12 +1565,12 @@ class rn {
1563
1565
  if (!this.enabled) return t;
1564
1566
  const n = [0, 45, 90, 135, 180, 225, 270, 315, 360], o = 5;
1565
1567
  for (const i of n)
1566
- if (ge(t, i, o))
1568
+ if (Te(t, i, o))
1567
1569
  return i;
1568
1570
  return t;
1569
1571
  }
1570
1572
  }
1571
- class ln {
1573
+ class xn {
1572
1574
  constructor(t = {}) {
1573
1575
  this.lastSnapTarget = null, this.detectionThreshold = t.detectionThreshold || 100, this.minDistance = t.minDistance || 10, this.enabled = t.enabled !== !1, this.showLabels = t.showLabels !== !1, this.indicators = [];
1574
1576
  }
@@ -1603,106 +1605,106 @@ class ln {
1603
1605
  snapToSpacing(t, e, s) {
1604
1606
  if (!this.enabled || !s)
1605
1607
  return t;
1606
- const n = Gt, o = s.filter((p) => p.id !== e.id);
1608
+ const n = jt, o = s.filter((u) => u.id !== e.id);
1607
1609
  if (o.length === 0)
1608
1610
  return t;
1609
1611
  const i = e.clone();
1610
1612
  i.x = t.x, i.y = t.y;
1611
1613
  const a = i.getVisualBoundingBox(), r = a.x - t.x, l = a.y - t.y;
1612
- let h = t.x, c = t.y, d = !1, g = !1;
1613
- const b = o.filter((p) => {
1614
- const f = p.getVisualBoundingBox();
1615
- return !(a.x + a.width < f.x || a.x > f.x + f.width);
1614
+ let h = t.x, c = t.y, f = !1, d = !1;
1615
+ const y = o.filter((u) => {
1616
+ const g = u.getVisualBoundingBox();
1617
+ return !(a.x + a.width < g.x || a.x > g.x + g.width);
1616
1618
  });
1617
- if (b.sort((p, f) => {
1618
- const y = p.getVisualBoundingBox(), S = f.getVisualBoundingBox();
1619
- return y.y - S.y;
1620
- }), b.length >= 1) {
1621
- let p = null, f = null;
1622
- for (const m of b) {
1619
+ if (y.sort((u, g) => {
1620
+ const b = u.getVisualBoundingBox(), S = g.getVisualBoundingBox();
1621
+ return b.y - S.y;
1622
+ }), y.length >= 1) {
1623
+ let u = null, g = null;
1624
+ for (const m of y) {
1623
1625
  const w = m.getVisualBoundingBox();
1624
- w.y + w.height <= a.y ? (!p || w.y > p.getVisualBoundingBox().y) && (p = m) : w.y >= a.y + a.height && (!f || w.y < f.getVisualBoundingBox().y) && (f = m);
1626
+ w.y + w.height <= a.y ? (!u || w.y > u.getVisualBoundingBox().y) && (u = m) : w.y >= a.y + a.height && (!g || w.y < g.getVisualBoundingBox().y) && (g = m);
1625
1627
  }
1626
- const y = [];
1627
- for (let m = 0; m < b.length - 1; m++) {
1628
- const w = b[m].getVisualBoundingBox(), R = b[m + 1].getVisualBoundingBox().y - (w.y + w.height);
1629
- y.push(R);
1628
+ const b = [];
1629
+ for (let m = 0; m < y.length - 1; m++) {
1630
+ const w = y[m].getVisualBoundingBox(), M = y[m + 1].getVisualBoundingBox().y - (w.y + w.height);
1631
+ b.push(M);
1630
1632
  }
1631
1633
  let S = null;
1632
- if (p) {
1633
- const m = p.getVisualBoundingBox(), w = a.y - (m.y + m.height);
1634
- for (const T of y)
1635
- if (Math.abs(w - T) <= n) {
1636
- S = T;
1634
+ if (u) {
1635
+ const m = u.getVisualBoundingBox(), w = a.y - (m.y + m.height);
1636
+ for (const v of b)
1637
+ if (Math.abs(w - v) <= n) {
1638
+ S = v;
1637
1639
  break;
1638
1640
  }
1639
1641
  }
1640
- if (!S && f) {
1641
- const w = f.getVisualBoundingBox().y - (a.y + a.height);
1642
- for (const T of y)
1643
- if (Math.abs(w - T) <= n) {
1644
- S = T;
1642
+ if (!S && g) {
1643
+ const w = g.getVisualBoundingBox().y - (a.y + a.height);
1644
+ for (const v of b)
1645
+ if (Math.abs(w - v) <= n) {
1646
+ S = v;
1645
1647
  break;
1646
1648
  }
1647
1649
  }
1648
1650
  if (S !== null && S > 0) {
1649
- if (p) {
1650
- const m = p.getVisualBoundingBox(), w = a.y - (m.y + m.height);
1651
- Math.abs(w - S) <= n && (c = m.y + m.height + S - l, g = !0);
1651
+ if (u) {
1652
+ const m = u.getVisualBoundingBox(), w = a.y - (m.y + m.height);
1653
+ Math.abs(w - S) <= n && (c = m.y + m.height + S - l, d = !0);
1652
1654
  }
1653
- if (!g && f) {
1654
- const m = f.getVisualBoundingBox(), w = m.y - (a.y + a.height);
1655
- Math.abs(w - S) <= n && (c = m.y - a.height - S - l, g = !0);
1655
+ if (!d && g) {
1656
+ const m = g.getVisualBoundingBox(), w = m.y - (a.y + a.height);
1657
+ Math.abs(w - S) <= n && (c = m.y - a.height - S - l, d = !0);
1656
1658
  }
1657
1659
  }
1658
1660
  }
1659
- const u = o.filter((p) => {
1660
- const f = p.getVisualBoundingBox();
1661
- return !(a.y + a.height < f.y || a.y > f.y + f.height);
1661
+ const p = o.filter((u) => {
1662
+ const g = u.getVisualBoundingBox();
1663
+ return !(a.y + a.height < g.y || a.y > g.y + g.height);
1662
1664
  });
1663
- if (u.sort((p, f) => {
1664
- const y = p.getVisualBoundingBox(), S = f.getVisualBoundingBox();
1665
- return y.x - S.x;
1666
- }), u.length >= 1) {
1667
- let p = null, f = null;
1668
- for (const m of u) {
1665
+ if (p.sort((u, g) => {
1666
+ const b = u.getVisualBoundingBox(), S = g.getVisualBoundingBox();
1667
+ return b.x - S.x;
1668
+ }), p.length >= 1) {
1669
+ let u = null, g = null;
1670
+ for (const m of p) {
1669
1671
  const w = m.getVisualBoundingBox();
1670
- w.x + w.width <= a.x ? (!p || w.x > p.getVisualBoundingBox().x) && (p = m) : w.x >= a.x + a.width && (!f || w.x < f.getVisualBoundingBox().x) && (f = m);
1672
+ w.x + w.width <= a.x ? (!u || w.x > u.getVisualBoundingBox().x) && (u = m) : w.x >= a.x + a.width && (!g || w.x < g.getVisualBoundingBox().x) && (g = m);
1671
1673
  }
1672
- const y = [];
1673
- for (let m = 0; m < u.length - 1; m++) {
1674
- const w = u[m].getVisualBoundingBox(), R = u[m + 1].getVisualBoundingBox().x - (w.x + w.width);
1675
- y.push(R);
1674
+ const b = [];
1675
+ for (let m = 0; m < p.length - 1; m++) {
1676
+ const w = p[m].getVisualBoundingBox(), M = p[m + 1].getVisualBoundingBox().x - (w.x + w.width);
1677
+ b.push(M);
1676
1678
  }
1677
1679
  let S = null;
1678
- if (p) {
1679
- const m = p.getVisualBoundingBox(), w = a.x - (m.x + m.width);
1680
- for (const T of y)
1681
- if (Math.abs(w - T) <= n) {
1682
- S = T;
1680
+ if (u) {
1681
+ const m = u.getVisualBoundingBox(), w = a.x - (m.x + m.width);
1682
+ for (const v of b)
1683
+ if (Math.abs(w - v) <= n) {
1684
+ S = v;
1683
1685
  break;
1684
1686
  }
1685
1687
  }
1686
- if (!S && f) {
1687
- const w = f.getVisualBoundingBox().x - (a.x + a.width);
1688
- for (const T of y)
1689
- if (Math.abs(w - T) <= n) {
1690
- S = T;
1688
+ if (!S && g) {
1689
+ const w = g.getVisualBoundingBox().x - (a.x + a.width);
1690
+ for (const v of b)
1691
+ if (Math.abs(w - v) <= n) {
1692
+ S = v;
1691
1693
  break;
1692
1694
  }
1693
1695
  }
1694
1696
  if (S !== null && S > 0) {
1695
- if (p) {
1696
- const m = p.getVisualBoundingBox(), w = a.x - (m.x + m.width);
1697
- Math.abs(w - S) <= n && (h = m.x + m.width + S - r, d = !0);
1697
+ if (u) {
1698
+ const m = u.getVisualBoundingBox(), w = a.x - (m.x + m.width);
1699
+ Math.abs(w - S) <= n && (h = m.x + m.width + S - r, f = !0);
1698
1700
  }
1699
- if (!d && f) {
1700
- const m = f.getVisualBoundingBox(), w = m.x - (a.x + a.width);
1701
- Math.abs(w - S) <= n && (h = m.x - a.width - S - r, d = !0);
1701
+ if (!f && g) {
1702
+ const m = g.getVisualBoundingBox(), w = m.x - (a.x + a.width);
1703
+ Math.abs(w - S) <= n && (h = m.x - a.width - S - r, f = !0);
1702
1704
  }
1703
1705
  }
1704
1706
  }
1705
- return this.lastSnapTarget = d || g ? { x: h, y: c } : null, { x: h, y: c };
1707
+ return this.lastSnapTarget = f || d ? { x: h, y: c } : null, { x: h, y: c };
1706
1708
  }
1707
1709
  /**
1708
1710
  * Detect spacing between a moving element and other elements
@@ -1718,10 +1720,10 @@ class ln {
1718
1720
  return this.clearIndicators(), [];
1719
1721
  const o = t.getVisualBoundingBox(), i = [], a = [], r = [], l = [];
1720
1722
  for (const c of n) {
1721
- const d = c.getVisualBoundingBox(), g = o.x - (d.x + d.width), b = d.x - (o.x + o.width), u = o.y - (d.y + d.height), p = d.y - (o.y + o.height), f = !(o.y + o.height < d.y || o.y > d.y + d.height), y = !(o.x + o.width < d.x || o.x > d.x + d.width);
1722
- g >= this.minDistance && g < this.detectionThreshold && f && i.push({ element: c, distance: g }), b >= this.minDistance && b < this.detectionThreshold && f && a.push({ element: c, distance: b }), u >= this.minDistance && u < this.detectionThreshold && y && r.push({ element: c, distance: u }), p >= this.minDistance && p < this.detectionThreshold && y && l.push({ element: c, distance: p });
1723
+ const f = c.getVisualBoundingBox(), d = o.x - (f.x + f.width), y = f.x - (o.x + o.width), p = o.y - (f.y + f.height), u = f.y - (o.y + o.height), g = !(o.y + o.height < f.y || o.y > f.y + f.height), b = !(o.x + o.width < f.x || o.x > f.x + f.width);
1724
+ d >= this.minDistance && d < this.detectionThreshold && g && i.push({ element: c, distance: d }), y >= this.minDistance && y < this.detectionThreshold && g && a.push({ element: c, distance: y }), p >= this.minDistance && p < this.detectionThreshold && b && r.push({ element: c, distance: p }), u >= this.minDistance && u < this.detectionThreshold && b && l.push({ element: c, distance: u });
1723
1725
  }
1724
- i.sort((c, d) => c.distance - d.distance), a.sort((c, d) => c.distance - d.distance), r.sort((c, d) => c.distance - d.distance), l.sort((c, d) => c.distance - d.distance);
1726
+ i.sort((c, f) => c.distance - f.distance), a.sort((c, f) => c.distance - f.distance), r.sort((c, f) => c.distance - f.distance), l.sort((c, f) => c.distance - f.distance);
1725
1727
  const h = [];
1726
1728
  if (s) {
1727
1729
  const c = this.detectAllMeasurements(t, e);
@@ -1778,28 +1780,28 @@ class ln {
1778
1780
  // bottom
1779
1781
  ) > i)
1780
1782
  continue;
1781
- let d = 0, g = !1, b = 0, u = 0, p = 0;
1782
- const y = -30 * (a % 2 === 0 ? 1 : -1);
1783
- h.x >= n.x + n.width ? (d = h.x - (n.x + n.width), d >= this.minDistance && (g = !0, b = n.x + n.width, u = h.x, p = (n.y + n.height / 2 + h.y + h.height / 2) / 2 + y)) : n.x >= h.x + h.width && (d = n.x - (h.x + h.width), d >= this.minDistance && (g = !0, b = h.x + h.width, u = n.x, p = (n.y + n.height / 2 + h.y + h.height / 2) / 2 + y)), g && (s.push({
1783
+ let f = 0, d = !1, y = 0, p = 0, u = 0;
1784
+ const b = -30 * (a % 2 === 0 ? 1 : -1);
1785
+ h.x >= n.x + n.width ? (f = h.x - (n.x + n.width), f >= this.minDistance && (d = !0, y = n.x + n.width, p = h.x, u = (n.y + n.height / 2 + h.y + h.height / 2) / 2 + b)) : n.x >= h.x + h.width && (f = n.x - (h.x + h.width), f >= this.minDistance && (d = !0, y = h.x + h.width, p = n.x, u = (n.y + n.height / 2 + h.y + h.height / 2) / 2 + b)), d && (s.push({
1784
1786
  type: "horizontal",
1785
- distance: Math.round(d),
1786
- x1: b,
1787
- x2: u,
1788
- y: p,
1789
- labelX: (b + u) / 2,
1790
- labelY: p,
1787
+ distance: Math.round(f),
1788
+ x1: y,
1789
+ x2: p,
1790
+ y: u,
1791
+ labelX: (y + p) / 2,
1792
+ labelY: u,
1791
1793
  isAltHover: !0
1792
1794
  }), a++);
1793
- let S = 0, m = !1, w = 0, T = 0, R = 0;
1794
- const x = 30 * (r % 2 === 0 ? 1 : -1);
1795
- h.y >= n.y + n.height ? (S = h.y - (n.y + n.height), S >= this.minDistance && (m = !0, w = (n.x + n.width / 2 + h.x + h.width / 2) / 2 + x, T = n.y + n.height, R = h.y)) : n.y >= h.y + h.height && (S = n.y - (h.y + h.height), S >= this.minDistance && (m = !0, w = (n.x + n.width / 2 + h.x + h.width / 2) / 2 + x, T = h.y + h.height, R = n.y)), m && (s.push({
1795
+ let S = 0, m = !1, w = 0, v = 0, M = 0;
1796
+ const R = 30 * (r % 2 === 0 ? 1 : -1);
1797
+ h.y >= n.y + n.height ? (S = h.y - (n.y + n.height), S >= this.minDistance && (m = !0, w = (n.x + n.width / 2 + h.x + h.width / 2) / 2 + R, v = n.y + n.height, M = h.y)) : n.y >= h.y + h.height && (S = n.y - (h.y + h.height), S >= this.minDistance && (m = !0, w = (n.x + n.width / 2 + h.x + h.width / 2) / 2 + R, v = h.y + h.height, M = n.y)), m && (s.push({
1796
1798
  type: "vertical",
1797
1799
  distance: Math.round(S),
1798
1800
  x: w,
1799
- y1: T,
1800
- y2: R,
1801
+ y1: v,
1802
+ y2: M,
1801
1803
  labelX: w,
1802
- labelY: (T + R) / 2,
1804
+ labelY: (v + M) / 2,
1803
1805
  isAltHover: !0
1804
1806
  }), r++);
1805
1807
  }
@@ -1812,84 +1814,84 @@ class ln {
1812
1814
  detectConsistentSpacing(t, e, s, n, o) {
1813
1815
  const i = [], r = s[0], l = r.distance, h = r.element.getVisualBoundingBox(), c = this.checkIfWouldSnap(e, l, n, o);
1814
1816
  if (this.addIndicatorForDirection(i, e, h, l, n, c), n === "left" || n === "right") {
1815
- const d = o.filter((g) => {
1816
- if (g.id === t.id) return !1;
1817
- const b = g.getVisualBoundingBox();
1818
- return !(e.y + e.height < b.y || e.y > b.y + b.height);
1817
+ const f = o.filter((d) => {
1818
+ if (d.id === t.id) return !1;
1819
+ const y = d.getVisualBoundingBox();
1820
+ return !(e.y + e.height < y.y || e.y > y.y + y.height);
1819
1821
  });
1820
- if (d.sort((g, b) => {
1821
- const u = g.getVisualBoundingBox(), p = b.getVisualBoundingBox();
1822
- return u.x - p.x;
1822
+ if (f.sort((d, y) => {
1823
+ const p = d.getVisualBoundingBox(), u = y.getVisualBoundingBox();
1824
+ return p.x - u.x;
1823
1825
  }), n === "left")
1824
- for (let g = 0; g < d.length - 1; g++) {
1825
- const b = d[g], u = d[g + 1], p = b.getVisualBoundingBox(), f = u.getVisualBoundingBox(), y = f.x - (p.x + p.width);
1826
- if (Math.abs(y - l) <= 16 && y >= this.minDistance) {
1827
- const S = Math.max(p.y, f.y), m = Math.min(p.y + p.height, f.y + f.height), w = (S + m) / 2;
1826
+ for (let d = 0; d < f.length - 1; d++) {
1827
+ const y = f[d], p = f[d + 1], u = y.getVisualBoundingBox(), g = p.getVisualBoundingBox(), b = g.x - (u.x + u.width);
1828
+ if (Math.abs(b - l) <= 16 && b >= this.minDistance) {
1829
+ const S = Math.max(u.y, g.y), m = Math.min(u.y + u.height, g.y + g.height), w = (S + m) / 2;
1828
1830
  i.push({
1829
1831
  type: "horizontal",
1830
- distance: Math.round(y),
1831
- x1: p.x + p.width,
1832
- x2: f.x,
1832
+ distance: Math.round(b),
1833
+ x1: u.x + u.width,
1834
+ x2: g.x,
1833
1835
  y: w,
1834
- labelX: (p.x + p.width + f.x) / 2,
1836
+ labelX: (u.x + u.width + g.x) / 2,
1835
1837
  labelY: w
1836
1838
  });
1837
1839
  }
1838
1840
  }
1839
1841
  else
1840
- for (let g = 0; g < d.length - 1; g++) {
1841
- const b = d[g], u = d[g + 1], p = b.getVisualBoundingBox(), f = u.getVisualBoundingBox(), y = f.x - (p.x + p.width);
1842
- if (Math.abs(y - l) <= 16 && y >= this.minDistance) {
1843
- const S = Math.max(p.y, f.y), m = Math.min(p.y + p.height, f.y + f.height), w = (S + m) / 2;
1842
+ for (let d = 0; d < f.length - 1; d++) {
1843
+ const y = f[d], p = f[d + 1], u = y.getVisualBoundingBox(), g = p.getVisualBoundingBox(), b = g.x - (u.x + u.width);
1844
+ if (Math.abs(b - l) <= 16 && b >= this.minDistance) {
1845
+ const S = Math.max(u.y, g.y), m = Math.min(u.y + u.height, g.y + g.height), w = (S + m) / 2;
1844
1846
  i.push({
1845
1847
  type: "horizontal",
1846
- distance: Math.round(y),
1847
- x1: p.x + p.width,
1848
- x2: f.x,
1848
+ distance: Math.round(b),
1849
+ x1: u.x + u.width,
1850
+ x2: g.x,
1849
1851
  y: w,
1850
- labelX: (p.x + p.width + f.x) / 2,
1852
+ labelX: (u.x + u.width + g.x) / 2,
1851
1853
  labelY: w
1852
1854
  });
1853
1855
  }
1854
1856
  }
1855
1857
  } else {
1856
- const d = o.filter((g) => {
1857
- if (g.id === t.id) return !1;
1858
- const b = g.getVisualBoundingBox();
1859
- return !(e.x + e.width < b.x || e.x > b.x + b.width);
1858
+ const f = o.filter((d) => {
1859
+ if (d.id === t.id) return !1;
1860
+ const y = d.getVisualBoundingBox();
1861
+ return !(e.x + e.width < y.x || e.x > y.x + y.width);
1860
1862
  });
1861
- if (d.sort((g, b) => {
1862
- const u = g.getVisualBoundingBox(), p = b.getVisualBoundingBox();
1863
- return u.y - p.y;
1863
+ if (f.sort((d, y) => {
1864
+ const p = d.getVisualBoundingBox(), u = y.getVisualBoundingBox();
1865
+ return p.y - u.y;
1864
1866
  }), n === "top")
1865
- for (let g = 0; g < d.length - 1; g++) {
1866
- const b = d[g], u = d[g + 1], p = b.getVisualBoundingBox(), f = u.getVisualBoundingBox(), y = f.y - (p.y + p.height);
1867
- if (Math.abs(y - l) <= 16 && y >= this.minDistance) {
1868
- const S = Math.max(p.x, f.x), m = Math.min(p.x + p.width, f.x + f.width), w = (S + m) / 2;
1867
+ for (let d = 0; d < f.length - 1; d++) {
1868
+ const y = f[d], p = f[d + 1], u = y.getVisualBoundingBox(), g = p.getVisualBoundingBox(), b = g.y - (u.y + u.height);
1869
+ if (Math.abs(b - l) <= 16 && b >= this.minDistance) {
1870
+ const S = Math.max(u.x, g.x), m = Math.min(u.x + u.width, g.x + g.width), w = (S + m) / 2;
1869
1871
  i.push({
1870
1872
  type: "vertical",
1871
- distance: Math.round(y),
1873
+ distance: Math.round(b),
1872
1874
  x: w,
1873
- y1: p.y + p.height,
1874
- y2: f.y,
1875
+ y1: u.y + u.height,
1876
+ y2: g.y,
1875
1877
  labelX: w,
1876
- labelY: (p.y + p.height + f.y) / 2
1878
+ labelY: (u.y + u.height + g.y) / 2
1877
1879
  });
1878
1880
  }
1879
1881
  }
1880
1882
  else
1881
- for (let g = 0; g < d.length - 1; g++) {
1882
- const b = d[g], u = d[g + 1], p = b.getVisualBoundingBox(), f = u.getVisualBoundingBox(), y = f.y - (p.y + p.height);
1883
- if (Math.abs(y - l) <= 16 && y >= this.minDistance) {
1884
- const S = Math.max(p.x, f.x), m = Math.min(p.x + p.width, f.x + f.width), w = (S + m) / 2;
1883
+ for (let d = 0; d < f.length - 1; d++) {
1884
+ const y = f[d], p = f[d + 1], u = y.getVisualBoundingBox(), g = p.getVisualBoundingBox(), b = g.y - (u.y + u.height);
1885
+ if (Math.abs(b - l) <= 16 && b >= this.minDistance) {
1886
+ const S = Math.max(u.x, g.x), m = Math.min(u.x + u.width, g.x + g.width), w = (S + m) / 2;
1885
1887
  i.push({
1886
1888
  type: "vertical",
1887
- distance: Math.round(y),
1889
+ distance: Math.round(b),
1888
1890
  x: w,
1889
- y1: p.y + p.height,
1890
- y2: f.y,
1891
+ y1: u.y + u.height,
1892
+ y2: g.y,
1891
1893
  labelX: w,
1892
- labelY: (p.y + p.height + f.y) / 2
1894
+ labelY: (u.y + u.height + g.y) / 2
1893
1895
  });
1894
1896
  }
1895
1897
  }
@@ -1900,7 +1902,7 @@ class ln {
1900
1902
  * Check if spacing would snap to a pattern
1901
1903
  */
1902
1904
  checkIfWouldSnap(t, e, s, n) {
1903
- const o = Gt;
1905
+ const o = jt;
1904
1906
  if (s === "top" || s === "bottom") {
1905
1907
  const i = n.filter((a) => {
1906
1908
  const r = a.getVisualBoundingBox();
@@ -1917,7 +1919,7 @@ class ln {
1917
1919
  a.push(c);
1918
1920
  }
1919
1921
  if (a.length > 0) {
1920
- const r = a.reduce((c, d) => c + d, 0) / a.length;
1922
+ const r = a.reduce((c, f) => c + f, 0) / a.length;
1921
1923
  return Math.abs(e - r) <= o;
1922
1924
  }
1923
1925
  }
@@ -1938,7 +1940,7 @@ class ln {
1938
1940
  a.push(c);
1939
1941
  }
1940
1942
  if (a.length > 0) {
1941
- const r = a.reduce((c, d) => c + d, 0) / a.length;
1943
+ const r = a.reduce((c, f) => c + f, 0) / a.length;
1942
1944
  return Math.abs(e - r) <= o;
1943
1945
  }
1944
1946
  }
@@ -2000,7 +2002,7 @@ class ln {
2000
2002
  }
2001
2003
  }
2002
2004
  }
2003
- const zt = te("ArtboardRenderer"), $e = {
2005
+ const Gt = ae("ArtboardRenderer"), sn = {
2004
2006
  showLabel: !0,
2005
2007
  showBorder: !0,
2006
2008
  borderColor: "",
@@ -2018,9 +2020,9 @@ const zt = te("ArtboardRenderer"), $e = {
2018
2020
  borderRadius: 0
2019
2021
  // Default to no border radius (sharp corners)
2020
2022
  };
2021
- class ie {
2023
+ class fe {
2022
2024
  constructor(t = {}) {
2023
- this.options = { ...$e, ...t };
2025
+ this.options = { ...sn, ...t };
2024
2026
  }
2025
2027
  /**
2026
2028
  * Render an artboard
@@ -2042,10 +2044,10 @@ class ie {
2042
2044
  * Renders preset color as base layer, then texture on top
2043
2045
  */
2044
2046
  renderTextureBackground(t, e) {
2045
- const s = Wt.getTexture(e.backgroundTexture), n = Wt.getTexturePresetColor(e.backgroundTexture);
2047
+ const s = Vt.getTexture(e.backgroundTexture), n = Vt.getTexturePresetColor(e.backgroundTexture);
2046
2048
  if (t.fillStyle = n, t.fillRect(e.x, e.y, e.width, e.height), !s || !s.complete) {
2047
- Wt.loadTexture(e.backgroundTexture).catch((o) => {
2048
- zt.error("Failed to load texture:", o);
2049
+ Vt.loadTexture(e.backgroundTexture).catch((o) => {
2050
+ Gt.error("Failed to load texture:", o);
2049
2051
  });
2050
2052
  return;
2051
2053
  }
@@ -2066,7 +2068,7 @@ class ie {
2066
2068
  * Render artboard border (respects clipShape and borderRadius option)
2067
2069
  */
2068
2070
  renderBorder(t, e, s) {
2069
- const { x: n, y: o, width: i, height: a, clipShape: r } = e, l = this.options.borderColor || ue(), h = this.options.selectedBorderColor || nt();
2071
+ const { x: n, y: o, width: i, height: a, clipShape: r } = e, l = this.options.borderColor || we(), h = this.options.selectedBorderColor || nt();
2070
2072
  if (t.strokeStyle = s ? h : l, t.lineWidth = s ? this.options.selectedBorderWidth : this.options.borderWidth, t.beginPath(), !r || r === "rectangle")
2071
2073
  if (this.options.borderRadius > 0) {
2072
2074
  const c = Math.min(this.options.borderRadius, Math.min(i, a) / 2);
@@ -2074,8 +2076,8 @@ class ie {
2074
2076
  } else
2075
2077
  t.rect(n, o, i, a);
2076
2078
  else if (r === "circle") {
2077
- const c = n + i / 2, d = o + a / 2, g = Math.min(i, a) / 2;
2078
- t.arc(c, d, g, 0, Math.PI * 2);
2079
+ const c = n + i / 2, f = o + a / 2, d = Math.min(i, a) / 2;
2080
+ t.arc(c, f, d, 0, Math.PI * 2);
2079
2081
  } else if (typeof r == "object" && r.type === "rounded") {
2080
2082
  const c = Math.min(r.radius, Math.min(i, a) / 2);
2081
2083
  this.roundedRect(t, n, o, i, a, c);
@@ -2085,7 +2087,7 @@ class ie {
2085
2087
  t.save(), t.translate(n, o), t.stroke(c), t.restore();
2086
2088
  return;
2087
2089
  } catch (c) {
2088
- zt.warn("Invalid SVG path for border, falling back to rectangle:", c), t.rect(n, o, i, a);
2090
+ Gt.warn("Invalid SVG path for border, falling back to rectangle:", c), t.rect(n, o, i, a);
2089
2091
  }
2090
2092
  t.stroke();
2091
2093
  }
@@ -2095,7 +2097,7 @@ class ie {
2095
2097
  renderLabel(t, e, s) {
2096
2098
  const n = this.options.labelFontSize, o = this.options.labelPadding, i = `${e.name} (${Math.round(e.width)} × ${Math.round(e.height)})`, a = e.x, r = e.y - o;
2097
2099
  t.font = `${n}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`;
2098
- const l = this.options.selectedBorderColor || nt(), h = this.options.labelColor || pe();
2100
+ const l = this.options.selectedBorderColor || nt(), h = this.options.labelColor || ve();
2099
2101
  t.fillStyle = s ? l : h, t.textAlign = "left", t.textBaseline = "bottom", t.fillText(i, a, r);
2100
2102
  }
2101
2103
  /**
@@ -2139,7 +2141,7 @@ class ie {
2139
2141
  t.translate(s, n), t.clip(r), t.translate(-s, -n);
2140
2142
  return;
2141
2143
  } catch (r) {
2142
- zt.warn("Invalid SVG path, falling back to rectangle:", r), t.rect(s, n, o, i);
2144
+ Gt.warn("Invalid SVG path, falling back to rectangle:", r), t.rect(s, n, o, i);
2143
2145
  }
2144
2146
  t.clip();
2145
2147
  }
@@ -2198,7 +2200,7 @@ class ie {
2198
2200
  * Use this when exporting to ensure preview background is never included
2199
2201
  */
2200
2202
  static createForExport(t = {}) {
2201
- return new ie({
2203
+ return new fe({
2202
2204
  ...t,
2203
2205
  showPreviewBackground: !1
2204
2206
  // CRITICAL: Never show preview in exports
@@ -2211,8 +2213,50 @@ class ie {
2211
2213
  return !!(this.options.showPreviewBackground && t.previewBackgroundColor && t.previewBackgroundColor !== "transparent");
2212
2214
  }
2213
2215
  }
2214
- function je(v) {
2215
- const t = (v % 360 + 360) % 360;
2216
+ const on = 300, an = 15e5;
2217
+ let It = { sig: "", mask: null }, Bt = "", Ht = null, Xt = !1;
2218
+ function Rn() {
2219
+ const T = Xt;
2220
+ return Xt = !1, T;
2221
+ }
2222
+ function se(T) {
2223
+ const t = /^#?([0-9a-f]{6})$/i.exec(T.trim()), e = t ? parseInt(t[1], 16) : 0;
2224
+ return [e >> 16 & 255, e >> 8 & 255, e & 255];
2225
+ }
2226
+ function rn(T, t, e) {
2227
+ const s = T.getTransform(), n = Math.round(s.a * e.x + s.e), o = Math.round(s.d * e.y + s.f), i = Math.round(s.a * e.width), a = Math.round(s.d * e.height);
2228
+ if (i <= 0 || a <= 0) return;
2229
+ const r = T.canvas, l = Math.max(0, n), h = Math.max(0, o), c = Math.min(r.width, n + i), f = Math.min(r.height, o + a), d = c - l, y = f - h;
2230
+ if (d <= 0 || y <= 0) return;
2231
+ const p = T.getImageData(l, h, d, y), u = p.data, g = d * y, b = new Uint8Array(g);
2232
+ let S = 2166136261, m = 0;
2233
+ for (let k = 0; k < g; k++) {
2234
+ const P = k * 4;
2235
+ Oe(u[P], u[P + 1], u[P + 2], u[P + 3]) >= ce && (b[k] = 1, S = Math.imul(S ^ k, 16777619), m++);
2236
+ }
2237
+ const w = `${d}x${y}:${s.a * 1e3 | 0}:${t.dpi}:${S >>> 0}:${m}`, [v, M, C] = se(t.cut), [R, I, x] = se(t.coat), A = It.sig === w ? It.mask : null;
2238
+ for (let k = 0; k < g; k++) {
2239
+ const P = k * 4;
2240
+ b[k] ? A && A[k] ? (u[P] = _t[0], u[P + 1] = _t[1], u[P + 2] = _t[2]) : (u[P] = v, u[P + 1] = M, u[P + 2] = C) : (u[P] = R, u[P + 1] = I, u[P + 2] = x), u[P + 3] = 255;
2241
+ }
2242
+ T.putImageData(p, l, h), It.sig !== w && Bt !== w && ln(w, b, d, y, Ye(t.dpi) * s.a);
2243
+ }
2244
+ function ln(T, t, e, s, n) {
2245
+ Bt = T, Ht && clearTimeout(Ht), Ht = setTimeout(() => {
2246
+ if (Ht = null, Bt !== T) return;
2247
+ const o = Math.max(1, Math.ceil(Math.sqrt(e * s / an))), i = Math.ceil(e / o), a = Math.ceil(s / o), r = new Float32Array(i * a);
2248
+ for (let d = 0; d < s; d++) for (let y = 0; y < e; y++) t[d * e + y] && (r[(d / o | 0) * i + (y / o | 0)] += 1 / (o * o));
2249
+ const l = { width: i, height: a, value: r }, { mask: h, count: c } = Ge(l, ce, n / o);
2250
+ let f = null;
2251
+ if (c > 0) {
2252
+ f = new Uint8Array(e * s);
2253
+ for (let d = 0; d < s; d++) for (let y = 0; y < e; y++) f[d * e + y] = h[(d / o | 0) * i + (y / o | 0)];
2254
+ }
2255
+ It = { sig: T, mask: f, thinParts: c }, Bt = "", Xt = !0;
2256
+ }, on);
2257
+ }
2258
+ function hn(T) {
2259
+ const t = (T % 360 + 360) % 360;
2216
2260
  if (t === 0) return [1, 0];
2217
2261
  if (t === 90) return [0, 1];
2218
2262
  if (t === 180) return [-1, 0];
@@ -2220,28 +2264,28 @@ function je(v) {
2220
2264
  const e = t * Math.PI / 180;
2221
2265
  return [Math.cos(e), Math.sin(e)];
2222
2266
  }
2223
- function Jt(v, t, e) {
2224
- const [s, n] = je(e);
2225
- return { width: Math.abs(v * s) + Math.abs(t * n), height: Math.abs(v * n) + Math.abs(t * s) };
2267
+ function oe(T, t, e) {
2268
+ const [s, n] = hn(e);
2269
+ return { width: Math.abs(T * s) + Math.abs(t * n), height: Math.abs(T * n) + Math.abs(t * s) };
2226
2270
  }
2227
- function ae(v) {
2228
- if (v.naturalWidth && v.naturalHeight) return { width: v.naturalWidth, height: v.naturalHeight };
2229
- const t = ((v.rotation ?? 0) % 360 + 360) % 360;
2271
+ function ge(T) {
2272
+ if (T.naturalWidth && T.naturalHeight) return { width: T.naturalWidth, height: T.naturalHeight };
2273
+ const t = ((T.rotation ?? 0) % 360 + 360) % 360;
2230
2274
  if (t % 90 !== 0)
2231
- throw new Error(`E_PIECE_NATURAL_DIMS: piece "${v.id ?? "?"}" is turned ${t}° but carries no naturalWidth/naturalHeight — the displayed box of a non-right angle doesn't determine them. Send them with the piece (the /piece-guides endpoint does)`);
2232
- return t === 90 || t === 270 ? { width: v.height, height: v.width } : { width: v.width, height: v.height };
2275
+ throw new Error(`E_PIECE_NATURAL_DIMS: piece "${T.id ?? "?"}" is turned ${t}° but carries no naturalWidth/naturalHeight — the displayed box of a non-right angle doesn't determine them. Send them with the piece (the /piece-guides endpoint does)`);
2276
+ return t === 90 || t === 270 ? { width: T.height, height: T.width } : { width: T.width, height: T.height };
2233
2277
  }
2234
- function hn(v) {
2235
- const t = ((v.rotation ?? 0) % 360 + 360) % 360;
2278
+ function Cn(T) {
2279
+ const t = ((T.rotation ?? 0) % 360 + 360) % 360;
2236
2280
  if (!t) return "";
2237
- const e = ae(v);
2238
- return `translate(${v.width / 2} ${v.height / 2}) rotate(${t}) translate(${-e.width / 2} ${-e.height / 2})`;
2281
+ const e = ge(T);
2282
+ return `translate(${T.width / 2} ${T.height / 2}) rotate(${t}) translate(${-e.width / 2} ${-e.height / 2})`;
2239
2283
  }
2240
- function cn(v, t) {
2284
+ function kn(T, t) {
2241
2285
  const e = ((t.rotation ?? 0) % 360 + 360) % 360;
2242
2286
  if (!e) return;
2243
- const s = ae(t);
2244
- v.translate(t.width / 2, t.height / 2), v.rotate(e * Math.PI / 180), v.translate(-s.width / 2, -s.height / 2);
2287
+ const s = ge(t);
2288
+ T.translate(t.width / 2, t.height / 2), T.rotate(e * Math.PI / 180), T.translate(-s.width / 2, -s.height / 2);
2245
2289
  }
2246
2290
  class wt {
2247
2291
  /**
@@ -2265,40 +2309,40 @@ class wt {
2265
2309
  */
2266
2310
  static renderPositionSizeInfo(t, e, s, n, o = 1) {
2267
2311
  if (!e || !(s != null && s.rotationHandle) || (n == null ? void 0 : n.getMode()) !== "resize") return;
2268
- const i = e.getVisualBoundingBox(), a = Math.round(i.width), r = Math.round(i.height), l = `${a} × ${r}`, h = s.rotationHandle, c = h.x * o, d = h.y * o - 20;
2312
+ const i = e.getVisualBoundingBox(), a = Math.round(i.width), r = Math.round(i.height), l = `${a} × ${r}`, h = s.rotationHandle, c = h.x * o, f = h.y * o - 20;
2269
2313
  t.save(), t.font = "10px system-ui, -apple-system, sans-serif";
2270
- const b = t.measureText(l).width + 12, u = 18;
2271
- t.shadowColor = ye(t.canvas), t.shadowBlur = 4, t.shadowOffsetY = 1, t.fillStyle = be(t.canvas), t.beginPath(), t.roundRect(
2272
- c - b / 2,
2273
- d - u / 2,
2274
- b,
2275
- u,
2314
+ const y = t.measureText(l).width + 12, p = 18;
2315
+ t.shadowColor = Me(t.canvas), t.shadowBlur = 4, t.shadowOffsetY = 1, t.fillStyle = xe(t.canvas), t.beginPath(), t.roundRect(
2316
+ c - y / 2,
2317
+ f - p / 2,
2318
+ y,
2319
+ p,
2276
2320
  3
2277
2321
  // Smaller border radius
2278
- ), t.fill(), t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetY = 0, t.fillStyle = Se(t.canvas), t.textAlign = "center", t.textBaseline = "middle", t.fillText(l, c, d + 0.5), t.restore();
2322
+ ), t.fill(), t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetY = 0, t.fillStyle = Re(t.canvas), t.textAlign = "center", t.textBaseline = "middle", t.fillText(l, c, f + 0.5), t.restore();
2279
2323
  }
2280
2324
  /**
2281
2325
  * Render transform handles layer
2282
2326
  */
2283
2327
  static renderHandlesLayer(t, e, s, n, o, i, a, r = 1, l = !0) {
2284
2328
  if (!e || e.visible === !1 || a.getMode() === "drag") return;
2285
- const c = i.type === "rotation-handle", d = i.type === "resize-handle" ? i.data : null, g = a.getMode() === "resize", b = g ? a.getActiveHandle() : null;
2329
+ const c = i.type === "rotation-handle", f = i.type === "resize-handle" ? i.data : null, d = a.getMode() === "resize", y = d ? a.getActiveHandle() : null;
2286
2330
  s.render(
2287
2331
  t,
2288
2332
  l,
2289
2333
  n,
2290
2334
  o,
2291
2335
  c,
2336
+ f,
2292
2337
  d,
2293
- g,
2294
- b,
2338
+ y,
2295
2339
  r,
2296
2340
  !0
2297
2341
  // Render rotation handle on canvas (not React)
2298
2342
  );
2299
2343
  }
2300
2344
  }
2301
- class Ft {
2345
+ class Nt {
2302
2346
  /**
2303
2347
  * Render hover highlights layer with fade-in animation
2304
2348
  * Outlines the actual element shape instead of a rectangular border
@@ -2313,7 +2357,7 @@ class Ft {
2313
2357
  const c = performance.now() - e.startTime;
2314
2358
  h = Math.min(c / r, 1) * l;
2315
2359
  }
2316
- t.strokeStyle = me(t.canvas), t.globalAlpha = h, t.lineWidth = 3, this.renderElementOutline(t, a, o, i), t.restore();
2360
+ t.strokeStyle = Ce(t.canvas), t.globalAlpha = h, t.lineWidth = 3, this.renderElementOutline(t, a, o, i), t.restore();
2317
2361
  }
2318
2362
  /**
2319
2363
  * Render outline for a specific element type
@@ -2330,12 +2374,12 @@ class Ft {
2330
2374
  const n = e.transformData, o = n.width * s, i = n.height * s, a = 2, l = a + a / 2;
2331
2375
  switch (t.save(), t.translate(e.x * s, e.y * s), t.beginPath(), n.shapeType) {
2332
2376
  case "rectangle": {
2333
- const h = n.borderRadius || 0, c = -(o + l * 2) / 2, d = -(i + l * 2) / 2, g = o + l * 2, b = i + l * 2;
2377
+ const h = n.borderRadius || 0, c = -(o + l * 2) / 2, f = -(i + l * 2) / 2, d = o + l * 2, y = i + l * 2;
2334
2378
  if (h > 0) {
2335
- const u = Math.min(h / 100 * Math.min(g, b), g / 2, b / 2);
2336
- t.roundRect(c, d, g, b, u);
2379
+ const p = Math.min(h / 100 * Math.min(d, y), d / 2, y / 2);
2380
+ t.roundRect(c, f, d, y, p);
2337
2381
  } else
2338
- t.rect(c, d, g, b);
2382
+ t.rect(c, f, d, y);
2339
2383
  break;
2340
2384
  }
2341
2385
  case "circle": {
@@ -2349,40 +2393,40 @@ class Ft {
2349
2393
  break;
2350
2394
  }
2351
2395
  case "triangle": {
2352
- const h = o / 2, c = i / 2, d = [
2396
+ const h = o / 2, c = i / 2, f = [
2353
2397
  { x: 0, y: -c },
2354
2398
  // top
2355
2399
  { x: h, y: c },
2356
2400
  // bottom-right
2357
2401
  { x: -h, y: c }
2358
2402
  // bottom-left
2359
- ], g = d.map((u, p) => {
2360
- const f = d[(p + 1) % 3], y = f.x - u.x, S = f.y - u.y, m = Math.sqrt(y * y + S * S);
2361
- return { x: S / m, y: -y / m };
2362
- }), b = d.map((u, p) => {
2363
- const f = g[(p + 2) % 3], y = g[p], S = f.x + y.x, m = f.y + y.y, w = Math.sqrt(S * S + m * m), T = (S * f.x + m * f.y) / w, R = l / T;
2403
+ ], d = f.map((p, u) => {
2404
+ const g = f[(u + 1) % 3], b = g.x - p.x, S = g.y - p.y, m = Math.sqrt(b * b + S * S);
2405
+ return { x: S / m, y: -b / m };
2406
+ }), y = f.map((p, u) => {
2407
+ const g = d[(u + 2) % 3], b = d[u], S = g.x + b.x, m = g.y + b.y, w = Math.sqrt(S * S + m * m), v = (S * g.x + m * g.y) / w, M = l / v;
2364
2408
  return {
2365
- x: u.x + S / w * R,
2366
- y: u.y + m / w * R
2409
+ x: p.x + S / w * M,
2410
+ y: p.y + m / w * M
2367
2411
  };
2368
2412
  });
2369
- t.moveTo(b[0].x, b[0].y), t.lineTo(b[1].x, b[1].y), t.lineTo(b[2].x, b[2].y), t.closePath();
2413
+ t.moveTo(y[0].x, y[0].y), t.lineTo(y[1].x, y[1].y), t.lineTo(y[2].x, y[2].y), t.closePath();
2370
2414
  break;
2371
2415
  }
2372
2416
  case "star": {
2373
- const h = n.points ?? 5, c = n.innerRadius ?? 0.4, d = Math.min(o, i) / 2 + l, g = d * c;
2374
- for (let b = 0; b < h * 2; b++) {
2375
- const u = b * Math.PI / h - Math.PI / 2, p = b % 2 === 0 ? d : g, f = p * Math.cos(u), y = p * Math.sin(u);
2376
- b === 0 ? t.moveTo(f, y) : t.lineTo(f, y);
2417
+ const h = n.points ?? 5, c = n.innerRadius ?? 0.4, f = Math.min(o, i) / 2 + l, d = f * c;
2418
+ for (let y = 0; y < h * 2; y++) {
2419
+ const p = y * Math.PI / h - Math.PI / 2, u = y % 2 === 0 ? f : d, g = u * Math.cos(p), b = u * Math.sin(p);
2420
+ y === 0 ? t.moveTo(g, b) : t.lineTo(g, b);
2377
2421
  }
2378
2422
  t.closePath();
2379
2423
  break;
2380
2424
  }
2381
2425
  case "polygon": {
2382
2426
  const h = n.sides ?? 5, c = Math.min(o, i) / 2 + l;
2383
- for (let d = 0; d < h; d++) {
2384
- const g = d * 2 * Math.PI / h - Math.PI / 2, b = c * Math.cos(g), u = c * Math.sin(g);
2385
- d === 0 ? t.moveTo(b, u) : t.lineTo(b, u);
2427
+ for (let f = 0; f < h; f++) {
2428
+ const d = f * 2 * Math.PI / h - Math.PI / 2, y = c * Math.cos(d), p = c * Math.sin(d);
2429
+ f === 0 ? t.moveTo(y, p) : t.lineTo(y, p);
2386
2430
  }
2387
2431
  t.closePath();
2388
2432
  break;
@@ -2400,15 +2444,15 @@ class Ft {
2400
2444
  * Creates a ring effect with a gap between the element and the stroke
2401
2445
  */
2402
2446
  static renderImageOutline(t, e, s) {
2403
- var u;
2404
- const n = e.getVisualBoundingBox(), o = n.width * s, i = n.height * s, a = ((u = e.transformData) == null ? void 0 : u.borderRadius) || 0, r = 2, h = r + r / 2;
2447
+ var p;
2448
+ const n = e.getVisualBoundingBox(), o = n.width * s, i = n.height * s, a = ((p = e.transformData) == null ? void 0 : p.borderRadius) || 0, r = 2, h = r + r / 2;
2405
2449
  t.save(), t.translate(e.x * s, e.y * s);
2406
- const c = -(o + h * 2) / 2, d = -(i + h * 2) / 2, g = o + h * 2, b = i + h * 2;
2450
+ const c = -(o + h * 2) / 2, f = -(i + h * 2) / 2, d = o + h * 2, y = i + h * 2;
2407
2451
  if (t.beginPath(), a > 0) {
2408
- const p = Math.min(a / 100 * Math.min(g, b), g / 2, b / 2);
2409
- t.roundRect(c, d, g, b, p);
2452
+ const u = Math.min(a / 100 * Math.min(d, y), d / 2, y / 2);
2453
+ t.roundRect(c, f, d, y, u);
2410
2454
  } else
2411
- t.rect(c, d, g, b);
2455
+ t.rect(c, f, d, y);
2412
2456
  t.stroke(), t.restore();
2413
2457
  }
2414
2458
  /**
@@ -2441,100 +2485,100 @@ class Ft {
2441
2485
  */
2442
2486
  static renderHoverRingEffect(t, e, s) {
2443
2487
  t.save(), t.translate(e.x * s, e.y * s), s !== 1 && t.scale(s, s);
2444
- const n = e.fontSize, o = e.fontFamily, i = e.bold || !1, a = e.italic || !1, r = e.textAlign || "center", l = ee(n, o, i, a), h = n * (e.lineHeight ?? 1.2), c = e.letterSpacing ?? 0, d = 4 / s, g = 4 / s, b = document.createElement("canvas");
2445
- b.width = t.canvas.width, b.height = t.canvas.height;
2446
- const u = b.getContext("2d");
2447
- if (!u) {
2488
+ const n = e.fontSize, o = e.fontFamily, i = e.bold || !1, a = e.italic || !1, r = e.textAlign || "center", l = re(n, o, i, a), h = n * (e.lineHeight ?? 1.2), c = e.letterSpacing ?? 0, f = 4 / s, d = 4 / s, y = document.createElement("canvas");
2489
+ y.width = t.canvas.width, y.height = t.canvas.height;
2490
+ const p = y.getContext("2d");
2491
+ if (!p) {
2448
2492
  t.restore();
2449
2493
  return;
2450
2494
  }
2451
- u.setTransform(t.getTransform()), u.textBaseline = "alphabetic", u.lineJoin = "round";
2452
- const p = e.getRichText ? e.getRichText() : null;
2453
- if (p) {
2454
- const f = ne(p), y = [], S = [];
2455
- f.forEach((T) => {
2495
+ p.setTransform(t.getTransform()), p.textBaseline = "alphabetic", p.lineJoin = "round";
2496
+ const u = e.getRichText ? e.getRichText() : null;
2497
+ if (u) {
2498
+ const g = le(u), b = [], S = [];
2499
+ g.forEach((v) => {
2456
2500
  if (e.transformType === "custom" && e.transformData) {
2457
- const R = e.transformData.width - pt * 2, C = se(T, R, {
2501
+ const M = e.transformData.width - pt * 2, C = he(v, M, {
2458
2502
  fontSize: n,
2459
2503
  fontFamily: o,
2460
2504
  bold: i,
2461
2505
  italic: a,
2462
2506
  letterSpacing: e.letterSpacing
2463
2507
  });
2464
- C.forEach((x, I) => {
2465
- y.push(x), S.push({
2508
+ C.forEach((R, I) => {
2509
+ b.push(R), S.push({
2466
2510
  isParagraphStart: I === 0,
2467
2511
  isParagraphEnd: I === C.length - 1
2468
2512
  });
2469
2513
  });
2470
2514
  } else
2471
- y.push(T), S.push({
2515
+ b.push(v), S.push({
2472
2516
  isParagraphStart: !0,
2473
2517
  isParagraphEnd: !0
2474
2518
  });
2475
2519
  });
2476
2520
  let m;
2477
- y.length === 0 ? m = 0 : y.length === 1 ? m = l.height : m = (y.length - 1) * h + l.height;
2521
+ b.length === 0 ? m = 0 : b.length === 1 ? m = l.height : m = (b.length - 1) * h + l.height;
2478
2522
  const w = -m / 2;
2479
- y.forEach((T, R) => {
2523
+ b.forEach((v, M) => {
2480
2524
  var V, j;
2481
- const C = S[R].isParagraphStart, x = S[R].isParagraphEnd;
2525
+ const C = S[M].isParagraphStart, R = S[M].isParagraphEnd;
2482
2526
  let I = 0;
2483
- const M = T.map((H) => H.text).join(""), k = ((V = M.match(/^ +/)) == null ? void 0 : V[0].length) || 0, E = ((j = M.match(/ +$/)) == null ? void 0 : j[0].length) || 0;
2484
- let B = 0;
2485
- T.forEach((H) => {
2486
- const z = H.style.fontSize !== void 0 ? H.style.fontSize : n, K = H.style.fontFamily !== void 0 ? H.style.fontFamily : o, Q = H.style.bold !== void 0 ? H.style.bold : i, L = H.style.italic !== void 0 ? H.style.italic : a;
2487
- let P = H.text;
2488
- const O = B, X = B + H.text.length;
2489
- if (!C && k > 0 && O < k) {
2490
- const A = Math.min(k - O, H.text.length);
2491
- P = P.substring(A);
2527
+ const x = v.map((B) => B.text).join(""), A = ((V = x.match(/^ +/)) == null ? void 0 : V[0].length) || 0, k = ((j = x.match(/ +$/)) == null ? void 0 : j[0].length) || 0;
2528
+ let P = 0;
2529
+ v.forEach((B) => {
2530
+ const z = B.style.fontSize !== void 0 ? B.style.fontSize : n, $ = B.style.fontFamily !== void 0 ? B.style.fontFamily : o, Q = B.style.bold !== void 0 ? B.style.bold : i, L = B.style.italic !== void 0 ? B.style.italic : a;
2531
+ let E = B.text;
2532
+ const O = P, X = P + B.text.length;
2533
+ if (!C && A > 0 && O < A) {
2534
+ const H = Math.min(A - O, B.text.length);
2535
+ E = E.substring(H);
2492
2536
  }
2493
- if (!x && E > 0) {
2494
- const A = M.length - E;
2495
- if (X > A) {
2496
- const D = !C && O < k ? Math.min(k - O, H.text.length) : 0, U = Math.max(0, A - O - D);
2497
- P = P.substring(0, U);
2537
+ if (!R && k > 0) {
2538
+ const H = x.length - k;
2539
+ if (X > H) {
2540
+ const W = !C && O < A ? Math.min(A - O, B.text.length) : 0, U = Math.max(0, H - O - W);
2541
+ E = E.substring(0, U);
2498
2542
  }
2499
2543
  }
2500
- if (P.length > 0) {
2501
- const A = H.style.letterSpacing !== void 0 ? H.style.letterSpacing : c;
2502
- t.save(), t.font = Lt(z, K, Q, L), I += Xt(t.measureText(P).width, P, A), t.restore();
2544
+ if (E.length > 0) {
2545
+ const H = B.style.letterSpacing !== void 0 ? B.style.letterSpacing : c;
2546
+ t.save(), t.font = zt(z, $, Q, L), I += qt(t.measureText(E).width, E, H), t.restore();
2503
2547
  }
2504
- B += H.text.length;
2548
+ P += B.text.length;
2505
2549
  });
2506
- const W = e.transformType === "custom" && e.transformData ? e.transformData.width - pt * 2 : void 0;
2550
+ const D = e.transformType === "custom" && e.transformData ? e.transformData.width - pt * 2 : void 0;
2507
2551
  let _;
2508
- r === "center" ? _ = -I / 2 : r === "right" ? _ = W !== void 0 ? W / 2 - I : -I : _ = W !== void 0 ? -W / 2 : 0;
2509
- const G = w + l.ascent + R * h;
2510
- B = 0, T.forEach((H) => {
2511
- const z = H.style.fontSize !== void 0 ? H.style.fontSize : n, K = H.style.fontFamily !== void 0 ? H.style.fontFamily : o;
2512
- H.style.color !== void 0 ? H.style.color : e.color;
2513
- const Q = H.style.bold !== void 0 ? H.style.bold : i, L = H.style.italic !== void 0 ? H.style.italic : a;
2514
- let P = H.text;
2515
- const O = B, X = B + H.text.length;
2516
- if (!C && k > 0 && O < k) {
2517
- const A = Math.min(k - O, H.text.length);
2518
- P = P.substring(A);
2552
+ r === "center" ? _ = -I / 2 : r === "right" ? _ = D !== void 0 ? D / 2 - I : -I : _ = D !== void 0 ? -D / 2 : 0;
2553
+ const Y = w + l.ascent + M * h;
2554
+ P = 0, v.forEach((B) => {
2555
+ const z = B.style.fontSize !== void 0 ? B.style.fontSize : n, $ = B.style.fontFamily !== void 0 ? B.style.fontFamily : o;
2556
+ B.style.color !== void 0 ? B.style.color : e.color;
2557
+ const Q = B.style.bold !== void 0 ? B.style.bold : i, L = B.style.italic !== void 0 ? B.style.italic : a;
2558
+ let E = B.text;
2559
+ const O = P, X = P + B.text.length;
2560
+ if (!C && A > 0 && O < A) {
2561
+ const H = Math.min(A - O, B.text.length);
2562
+ E = E.substring(H);
2519
2563
  }
2520
- if (!x && E > 0) {
2521
- const A = M.length - E;
2522
- if (X > A) {
2523
- const D = !C && O < k ? Math.min(k - O, H.text.length) : 0, U = Math.max(0, A - O - D);
2524
- P = P.substring(0, U);
2564
+ if (!R && k > 0) {
2565
+ const H = x.length - k;
2566
+ if (X > H) {
2567
+ const W = !C && O < A ? Math.min(A - O, B.text.length) : 0, U = Math.max(0, H - O - W);
2568
+ E = E.substring(0, U);
2525
2569
  }
2526
2570
  }
2527
- if (B += H.text.length, P.length > 0) {
2528
- const A = H.style.letterSpacing !== void 0 ? H.style.letterSpacing : c;
2529
- u.font = Lt(z, K, Q, L), u.textAlign = "left", u.globalCompositeOperation = "source-over", u.strokeStyle = t.strokeStyle, u.globalAlpha = Math.min(t.globalAlpha * 1.6, 0.8), u.lineWidth = (g + d) * 2, Pt(u, P, _, G, A), u.globalCompositeOperation = "destination-out", u.globalAlpha = 1, u.lineWidth = g * 2, Pt(u, P, _, G, A), Nt(u, P, _, G, A), _ += Xt(u.measureText(P).width, P, A);
2571
+ if (P += B.text.length, E.length > 0) {
2572
+ const H = B.style.letterSpacing !== void 0 ? B.style.letterSpacing : c;
2573
+ p.font = zt(z, $, Q, L), p.textAlign = "left", p.globalCompositeOperation = "source-over", p.strokeStyle = t.strokeStyle, p.globalAlpha = Math.min(t.globalAlpha * 1.6, 0.8), p.lineWidth = (d + f) * 2, At(p, E, _, Y, H), p.globalCompositeOperation = "destination-out", p.globalAlpha = 1, p.lineWidth = d * 2, At(p, E, _, Y, H), Ut(p, E, _, Y, H), _ += qt(p.measureText(E).width, E, H);
2530
2574
  }
2531
2575
  });
2532
2576
  });
2533
2577
  } else {
2534
- t.font = Lt(n, o, i, a), u.font = t.font, u.textAlign = r;
2535
- let f, y;
2578
+ t.font = zt(n, o, i, a), p.font = t.font, p.textAlign = r;
2579
+ let g, b;
2536
2580
  if (e.transformType === "custom" && e.transformData) {
2537
- const C = e.transformData.width - pt * 2, { lines: x } = Te(
2581
+ const C = e.transformData.width - pt * 2, { lines: R } = ke(
2538
2582
  e.text,
2539
2583
  C,
2540
2584
  n,
@@ -2545,25 +2589,25 @@ class Ft {
2545
2589
  !0,
2546
2590
  { letterSpacing: c, lineHeight: e.lineHeight }
2547
2591
  );
2548
- f = x;
2592
+ g = R;
2549
2593
  } else {
2550
- f = e.text.split(`
2594
+ g = e.text.split(`
2551
2595
  `);
2552
2596
  const C = e.text.includes(`
2553
2597
  `);
2554
- f = Pe(f, C);
2598
+ g = De(g, C);
2555
2599
  }
2556
- f.length === 0 ? y = 0 : f.length === 1 ? y = l.height : y = (f.length - 1) * h + l.height;
2557
- const S = -y / 2, m = e.text.includes(`
2558
- `), w = e.transformType === "custom" && e.transformData ? e.transformData.width : 0, T = -w / 2;
2559
- let R = T + pt;
2560
- r === "center" ? R = T + w / 2 : r === "right" && (R = T + w - pt), f.forEach((C, x) => {
2561
- const I = S + l.ascent + x * h, M = m || x === 0, k = m || x === f.length - 1;
2562
- let E = C;
2563
- M || (E = E.replace(/^ +/, "")), k || (E = E.replace(/ +$/, "")), u.globalCompositeOperation = "source-over", u.strokeStyle = t.strokeStyle, u.globalAlpha = Math.min(t.globalAlpha * 1.6, 0.8), u.lineWidth = (g + d) * 2, u.lineJoin = "round", Pt(u, E, R, I, c), u.globalCompositeOperation = "destination-out", u.globalAlpha = 1, u.lineWidth = g * 2, Pt(u, E, R, I, c), Nt(u, E, R, I, c);
2600
+ g.length === 0 ? b = 0 : g.length === 1 ? b = l.height : b = (g.length - 1) * h + l.height;
2601
+ const S = -b / 2, m = e.text.includes(`
2602
+ `), w = e.transformType === "custom" && e.transformData ? e.transformData.width : 0, v = -w / 2;
2603
+ let M = v + pt;
2604
+ r === "center" ? M = v + w / 2 : r === "right" && (M = v + w - pt), g.forEach((C, R) => {
2605
+ const I = S + l.ascent + R * h, x = m || R === 0, A = m || R === g.length - 1;
2606
+ let k = C;
2607
+ x || (k = k.replace(/^ +/, "")), A || (k = k.replace(/ +$/, "")), p.globalCompositeOperation = "source-over", p.strokeStyle = t.strokeStyle, p.globalAlpha = Math.min(t.globalAlpha * 1.6, 0.8), p.lineWidth = (d + f) * 2, p.lineJoin = "round", At(p, k, M, I, c), p.globalCompositeOperation = "destination-out", p.globalAlpha = 1, p.lineWidth = d * 2, At(p, k, M, I, c), Ut(p, k, M, I, c);
2564
2608
  });
2565
2609
  }
2566
- t.setTransform(1, 0, 0, 1, 0, 0), t.drawImage(b, 0, 0), t.restore();
2610
+ t.setTransform(1, 0, 0, 1, 0, 0), t.drawImage(y, 0, 0), t.restore();
2567
2611
  }
2568
2612
  /**
2569
2613
  * HOVER RING EFFECT for transformed text (circle, wave, arch, lean, ascend, flag)
@@ -2591,19 +2635,19 @@ class Ft {
2591
2635
  * Helper to render text along a transform path with hover effect
2592
2636
  */
2593
2637
  static renderTransformWithHoverEffect(t, e, s, n, o) {
2594
- const i = e, a = i.fontSize, r = i.fontFamily, l = i.bold || !1, h = i.italic || !1, c = l ? "bold" : "normal", d = h ? "italic" : "normal";
2595
- if (t.font = `${d} ${c} ${a}px ${r}`, t.textAlign = "center", t.textBaseline = "middle", i.transformType === "lean") {
2596
- const y = -i.transformData.leanAmount * Math.PI / 4;
2597
- t.transform(1, 0, Math.tan(y), 1, 0, 0), t.globalCompositeOperation = "source-over", t.strokeStyle = o, t.globalAlpha = 0.8, t.lineWidth = (n + s) * 2, t.lineJoin = "round", t.strokeText(i.text, 0, 0), t.globalCompositeOperation = "destination-out", t.globalAlpha = 1, t.lineWidth = n * 2, t.strokeText(i.text, 0, 0), t.fillText(i.text, 0, 0);
2638
+ const i = e, a = i.fontSize, r = i.fontFamily, l = i.bold || !1, h = i.italic || !1, c = l ? "bold" : "normal", f = h ? "italic" : "normal";
2639
+ if (t.font = `${f} ${c} ${a}px ${r}`, t.textAlign = "center", t.textBaseline = "middle", i.transformType === "lean") {
2640
+ const b = -i.transformData.leanAmount * Math.PI / 4;
2641
+ t.transform(1, 0, Math.tan(b), 1, 0, 0), t.globalCompositeOperation = "source-over", t.strokeStyle = o, t.globalAlpha = 0.8, t.lineWidth = (n + s) * 2, t.lineJoin = "round", t.strokeText(i.text, 0, 0), t.globalCompositeOperation = "destination-out", t.globalAlpha = 1, t.lineWidth = n * 2, t.strokeText(i.text, 0, 0), t.fillText(i.text, 0, 0);
2598
2642
  return;
2599
2643
  }
2600
- const g = i.text.split(""), b = g.map((f) => t.measureText(f).width), u = this.calculateCharPositions(e, g, b), p = (f) => {
2601
- t.translate(f.x, f.y), f.angle && t.rotate(f.angle), f.skewY && t.transform(1, f.skewY, 0, 1, 0, 0);
2644
+ const d = i.text.split(""), y = d.map((g) => t.measureText(g).width), p = this.calculateCharPositions(e, d, y), u = (g) => {
2645
+ t.translate(g.x, g.y), g.angle && t.rotate(g.angle), g.skewY && t.transform(1, g.skewY, 0, 1, 0, 0);
2602
2646
  };
2603
- t.globalCompositeOperation = "source-over", t.strokeStyle = o, t.globalAlpha = 0.8, t.lineWidth = (n + s) * 2, t.lineJoin = "round", u.forEach((f, y) => {
2604
- t.save(), p(f), t.strokeText(g[y], 0, 0), t.restore();
2605
- }), t.globalCompositeOperation = "destination-out", t.globalAlpha = 1, t.lineWidth = n * 2, u.forEach((f, y) => {
2606
- t.save(), p(f), t.strokeText(g[y], 0, 0), t.fillText(g[y], 0, 0), t.restore();
2647
+ t.globalCompositeOperation = "source-over", t.strokeStyle = o, t.globalAlpha = 0.8, t.lineWidth = (n + s) * 2, t.lineJoin = "round", p.forEach((g, b) => {
2648
+ t.save(), u(g), t.strokeText(d[b], 0, 0), t.restore();
2649
+ }), t.globalCompositeOperation = "destination-out", t.globalAlpha = 1, t.lineWidth = n * 2, p.forEach((g, b) => {
2650
+ t.save(), u(g), t.strokeText(d[b], 0, 0), t.fillText(d[b], 0, 0), t.restore();
2607
2651
  });
2608
2652
  }
2609
2653
  /**
@@ -2623,14 +2667,14 @@ class Ft {
2623
2667
  if (t.reverse) {
2624
2668
  let a = Math.PI / 2 + o / (2 * i);
2625
2669
  e.forEach((r, l) => {
2626
- const c = s[l] / i, d = Math.cos(a - c / 2) * i, g = Math.sin(a - c / 2) * i, b = a - c / 2 - Math.PI / 2;
2627
- n.push({ x: d, y: g, angle: b }), a -= c;
2670
+ const c = s[l] / i, f = Math.cos(a - c / 2) * i, d = Math.sin(a - c / 2) * i, y = a - c / 2 - Math.PI / 2;
2671
+ n.push({ x: f, y: d, angle: y }), a -= c;
2628
2672
  });
2629
2673
  } else {
2630
2674
  let a = -Math.PI / 2 - o / (2 * i);
2631
2675
  e.forEach((r, l) => {
2632
- const c = s[l] / i, d = Math.cos(a + c / 2) * i, g = Math.sin(a + c / 2) * i, b = a + c / 2 + Math.PI / 2;
2633
- n.push({ x: d, y: g, angle: b }), a += c;
2676
+ const c = s[l] / i, f = Math.cos(a + c / 2) * i, d = Math.sin(a + c / 2) * i, y = a + c / 2 + Math.PI / 2;
2677
+ n.push({ x: f, y: d, angle: y }), a += c;
2634
2678
  });
2635
2679
  }
2636
2680
  return n;
@@ -2642,8 +2686,8 @@ class Ft {
2642
2686
  const o = [];
2643
2687
  let a = -s.reduce((r, l) => r + l, 0) / 2;
2644
2688
  return e.forEach((r, l) => {
2645
- const h = s[l], c = a + h / 2, d = c / (n.width / 2), g = n.amplitude * t.fontSize * Math.sin(n.frequency * Math.PI * d), b = n.amplitude * n.frequency * Math.PI * Math.cos(n.frequency * Math.PI * d);
2646
- o.push({ x: c, y: g, angle: 0, skewY: b * we }), a += h;
2689
+ const h = s[l], c = a + h / 2, f = c / (n.width / 2), d = n.amplitude * t.fontSize * Math.sin(n.frequency * Math.PI * f), y = n.amplitude * n.frequency * Math.PI * Math.cos(n.frequency * Math.PI * f);
2690
+ o.push({ x: c, y: d, angle: 0, skewY: y * Ae }), a += h;
2647
2691
  }), o;
2648
2692
  }
2649
2693
  /**
@@ -2653,8 +2697,8 @@ class Ft {
2653
2697
  const o = [], i = s.reduce((l, h) => l + h, 0), a = n.width / 2;
2654
2698
  let r = -i / 2;
2655
2699
  return e.forEach((l, h) => {
2656
- const c = s[h], d = r + c / 2, g = d / a, b = (Math.pow(g, 2) - 1) * n.archHeight * t.fontSize, u = 2 * g * n.archHeight;
2657
- o.push({ x: d, y: b, angle: 0, skewY: u * 0.3 }), r += c;
2700
+ const c = s[h], f = r + c / 2, d = f / a, y = (Math.pow(d, 2) - 1) * n.archHeight * t.fontSize, p = 2 * d * n.archHeight;
2701
+ o.push({ x: f, y, angle: 0, skewY: p * 0.3 }), r += c;
2658
2702
  }), o;
2659
2703
  }
2660
2704
  /**
@@ -2675,8 +2719,8 @@ class Ft {
2675
2719
  const o = [], i = s.reduce((h, c) => h + c, 0), a = n.ascendAngle * Math.PI / 180, r = Math.tan(a);
2676
2720
  let l = -i / 2;
2677
2721
  return e.forEach((h, c) => {
2678
- const d = s[c], g = l + d / 2, b = g * r;
2679
- o.push({ x: g, y: b, angle: 0, skewY: r * 1 }), l += d;
2722
+ const f = s[c], d = l + f / 2, y = d * r;
2723
+ o.push({ x: d, y, angle: 0, skewY: r * 1 }), l += f;
2680
2724
  }), o;
2681
2725
  }
2682
2726
  /**
@@ -2686,8 +2730,8 @@ class Ft {
2686
2730
  const o = [];
2687
2731
  let a = -s.reduce((r, l) => r + l, 0) / 2;
2688
2732
  return e.forEach((r, l) => {
2689
- const h = s[l], c = a + h / 2, d = c / (n.width / 2), g = Math.abs(d), b = n.amplitude * g, u = b * t.fontSize * Math.sin(n.frequency * Math.PI * d), p = b * n.frequency * Math.PI * Math.cos(n.frequency * Math.PI * d), f = n.amplitude * Math.sign(d) * Math.sin(n.frequency * Math.PI * d), y = p + f;
2690
- o.push({ x: c, y: u, angle: 0, skewY: y * 0.3 }), a += h;
2733
+ const h = s[l], c = a + h / 2, f = c / (n.width / 2), d = Math.abs(f), y = n.amplitude * d, p = y * t.fontSize * Math.sin(n.frequency * Math.PI * f), u = y * n.frequency * Math.PI * Math.cos(n.frequency * Math.PI * f), g = n.amplitude * Math.sign(f) * Math.sin(n.frequency * Math.PI * f), b = u + g;
2734
+ o.push({ x: c, y: p, angle: 0, skewY: b * 0.3 }), a += h;
2691
2735
  }), o;
2692
2736
  }
2693
2737
  }
@@ -2705,7 +2749,7 @@ class Rt {
2705
2749
  */
2706
2750
  static renderSpacingIndicatorsLayer(t, e = []) {
2707
2751
  e.length !== 0 && (t.save(), t.setLineDash([]), e.forEach((s) => {
2708
- const n = Kt(t.canvas);
2752
+ const n = Zt(t.canvas);
2709
2753
  if (t.strokeStyle = n, t.fillStyle = n, t.lineWidth = ct.canvas.spacingIndicatorWidth, t.beginPath(), s.type === "horizontal") {
2710
2754
  const o = s.x1 ?? 0, i = s.x2 ?? 0, a = s.y ?? 0;
2711
2755
  t.moveTo(o, a), t.lineTo(i, a), t.stroke();
@@ -2730,198 +2774,198 @@ class Rt {
2730
2774
  const o = `${n}`;
2731
2775
  t.font = `600 ${ct.canvas.spacingLabelFontSize}px ${ct.canvas.spacingLabelFontFamily}`;
2732
2776
  const a = t.measureText(o).width, r = ct.canvas.spacingLabelFontSize, l = 4, h = a + l * 2, c = r + l * 2;
2733
- t.fillStyle = Kt(t.canvas), t.beginPath(), t.roundRect(e - h / 2, s - c / 2, h, c, ve), t.fill(), t.fillStyle = Me, t.textAlign = "center", t.textBaseline = "middle", t.fillText(o, e, s);
2777
+ t.fillStyle = Zt(t.canvas), t.beginPath(), t.roundRect(e - h / 2, s - c / 2, h, c, Pe), t.fill(), t.fillStyle = Ee, t.textAlign = "center", t.textBaseline = "middle", t.fillText(o, e, s);
2734
2778
  }
2735
2779
  }
2736
- class Vt {
2780
+ class Yt {
2737
2781
  /**
2738
2782
  * Render edit mode features: cursor and text selection highlight
2739
2783
  * This renders on the main canvas at world coordinates (same as the element)
2740
2784
  */
2741
2785
  static renderEditModeLayer(t, e, s, n) {
2742
2786
  if (!e || e.transformType === "image" || e.transformType === "group") return;
2743
- const o = e, { cursorPosition: i, selectionStart: a, selectionEnd: r, editText: l, editRichText: h, cursorOpacity: c, isTouchDevice: d, selectionHandlePositionsRef: g } = s, b = n || 1, u = o.transformType;
2744
- if (u === "circle" || u === "wave" || u === "arch" || u === "lean" || u === "ascend" || u === "flag") {
2745
- this.renderTransformEditModeLayer(t, o, s, b);
2787
+ const o = e, { cursorPosition: i, selectionStart: a, selectionEnd: r, editText: l, editRichText: h, cursorOpacity: c, isTouchDevice: f, selectionHandlePositionsRef: d } = s, y = n || 1, p = o.transformType;
2788
+ if (p === "circle" || p === "wave" || p === "arch" || p === "lean" || p === "ascend" || p === "flag") {
2789
+ this.renderTransformEditModeLayer(t, o, s, y);
2746
2790
  return;
2747
2791
  }
2748
- const p = o.fontSize || 24, f = o.fontFamily || "Arial", y = o.bold || !1, S = o.italic || !1, m = o.underline || !1, w = o.strikethrough || !1, T = o.textAlign || "center", R = o.letterSpacing ?? 0;
2792
+ const u = o.fontSize || 24, g = o.fontFamily || "Arial", b = o.bold || !1, S = o.italic || !1, m = o.underline || !1, w = o.strikethrough || !1, v = o.textAlign || "center", M = o.letterSpacing ?? 0;
2749
2793
  t.save(), t.translate(o.x, o.y), t.rotate(-o.rotation * Math.PI / 180);
2750
- const C = ee(p, f, y, S), x = C.height, I = p * (o.lineHeight ?? 1.2);
2751
- let M, k, E;
2794
+ const C = re(u, g, b, S), R = C.height, I = u * (o.lineHeight ?? 1.2);
2795
+ let x, A, k;
2752
2796
  if (h && o.transformType === "custom" && o.transformData.width) {
2753
2797
  const L = o.transformData.width - pt * 2;
2754
- E = L;
2755
- const P = ne(h);
2756
- M = [], k = [], P.forEach((O) => {
2757
- const X = se(O, L, {
2798
+ k = L;
2799
+ const E = le(h);
2800
+ x = [], A = [], E.forEach((O) => {
2801
+ const X = he(O, L, {
2758
2802
  fontSize: o.fontSize,
2759
2803
  fontFamily: o.fontFamily,
2760
2804
  bold: o.bold,
2761
2805
  italic: o.italic,
2762
2806
  letterSpacing: o.letterSpacing
2763
2807
  });
2764
- X.forEach((A, D) => {
2765
- M.push(A), k.push({
2766
- isParagraphStart: D === 0,
2767
- isParagraphEnd: D === X.length - 1
2808
+ X.forEach((H, W) => {
2809
+ x.push(H), A.push({
2810
+ isParagraphStart: W === 0,
2811
+ isParagraphEnd: W === X.length - 1
2768
2812
  });
2769
2813
  });
2770
2814
  });
2771
2815
  } else
2772
- M = l.split(`
2773
- `).map((P) => [
2816
+ x = l.split(`
2817
+ `).map((E) => [
2774
2818
  {
2775
- text: P,
2776
- style: { fontSize: p, fontFamily: f, bold: y, italic: S }
2819
+ text: E,
2820
+ style: { fontSize: u, fontFamily: g, bold: b, italic: S }
2777
2821
  }
2778
- ]), k = M.map(() => ({
2822
+ ]), A = x.map(() => ({
2779
2823
  isParagraphStart: !0,
2780
2824
  // Each line is its own paragraph
2781
2825
  isParagraphEnd: !0
2782
2826
  }));
2783
- const B = M.length > 1 ? C.height + (M.length - 1) * I : C.height;
2784
- let W = -B / 2, _ = 0, G = W, V = x;
2827
+ const P = x.length > 1 ? C.height + (x.length - 1) * I : C.height;
2828
+ let D = -P / 2, _ = 0, Y = D, V = R;
2785
2829
  const j = [];
2786
- let H = 0;
2787
- M.forEach((L, P) => {
2788
- var D, U;
2789
- const O = k[P].isParagraphStart, X = k[P].isParagraphEnd, A = [];
2830
+ let B = 0;
2831
+ x.forEach((L, E) => {
2832
+ var W, U;
2833
+ const O = A[E].isParagraphStart, X = A[E].isParagraphEnd, H = [];
2790
2834
  L.forEach((ot) => {
2791
2835
  Array.from(ot.text).forEach((lt) => {
2792
- let Y = p, ht = f, it = y, Z = S, st = R;
2793
- if (h && H < l.length) {
2794
- const J = h.getStyleAt(H);
2795
- Y = J.fontSize || p, ht = J.fontFamily || f, it = J.bold !== void 0 ? J.bold : y, Z = J.italic !== void 0 ? J.italic : S, st = J.letterSpacing !== void 0 ? J.letterSpacing : R;
2836
+ let G = u, ht = g, it = b, Z = S, st = M;
2837
+ if (h && B < l.length) {
2838
+ const J = h.getStyleAt(B);
2839
+ G = J.fontSize || u, ht = J.fontFamily || g, it = J.bold !== void 0 ? J.bold : b, Z = J.italic !== void 0 ? J.italic : S, st = J.letterSpacing !== void 0 ? J.letterSpacing : M;
2796
2840
  }
2797
2841
  t.save();
2798
2842
  const F = it ? "bold" : "normal", q = Z ? "italic" : "normal";
2799
- t.font = `${q} ${F} ${Y}px "${ht}", Arial, sans-serif`;
2843
+ t.font = `${q} ${F} ${G}px "${ht}", Arial, sans-serif`;
2800
2844
  const at = t.measureText(lt).width + st;
2801
- t.restore(), A.push({ char: lt, width: at, fontSize: Y, index: H }), H++;
2845
+ t.restore(), H.push({ char: lt, width: at, fontSize: G, index: B }), B++;
2802
2846
  });
2803
2847
  });
2804
2848
  {
2805
- const ot = P === 0, et = P === M.length - 1, lt = A.map((F) => F.char).join(""), Y = ((D = lt.match(/^ +/)) == null ? void 0 : D[0].length) || 0, ht = ((U = lt.match(/ +$/)) == null ? void 0 : U[0].length) || 0;
2849
+ const ot = E === 0, et = E === x.length - 1, lt = H.map((F) => F.char).join(""), G = ((W = lt.match(/^ +/)) == null ? void 0 : W[0].length) || 0, ht = ((U = lt.match(/ +$/)) == null ? void 0 : U[0].length) || 0;
2806
2850
  let it = 0;
2807
- for (let F = 0; F < A.length; F++)
2808
- !ot && F < Y || !et && F >= A.length - ht || (it += A[F].width);
2851
+ for (let F = 0; F < H.length; F++)
2852
+ !ot && F < G || !et && F >= H.length - ht || (it += H[F].width);
2809
2853
  let Z;
2810
- T === "center" ? Z = -it / 2 : T === "right" ? Z = E !== void 0 ? E / 2 - it : -it : Z = E !== void 0 ? -E / 2 : 0;
2854
+ v === "center" ? Z = -it / 2 : v === "right" ? Z = k !== void 0 ? k / 2 - it : -it : Z = k !== void 0 ? -k / 2 : 0;
2811
2855
  let st = Z;
2812
- for (let F = 0; F < A.length; F++) {
2813
- const q = A[F];
2856
+ for (let F = 0; F < H.length; F++) {
2857
+ const q = H[F];
2814
2858
  j[q.index] = {
2815
2859
  x: st,
2816
- y: W,
2860
+ y: D,
2817
2861
  width: q.width,
2818
2862
  // All characters keep their width for cursor navigation
2819
2863
  height: q.fontSize
2820
2864
  }, st += q.width;
2821
2865
  }
2822
- if (A.length > 0) {
2823
- const F = A[0].index, q = A[A.length - 1].index, ut = P < M.length - 1 && q + 1 === H ? q : q + 1;
2866
+ if (H.length > 0) {
2867
+ const F = H[0].index, q = H[H.length - 1].index, ut = E < x.length - 1 && q + 1 === B ? q : q + 1;
2824
2868
  if (i >= F && i <= ut)
2825
2869
  if (i === F)
2826
- _ = Z, G = W, V = x;
2870
+ _ = Z, Y = D, V = R;
2827
2871
  else {
2828
2872
  let yt = 0;
2829
- for (let rt = 0; rt < A.length && A[rt].index < i; rt++) {
2830
- const dt = A[rt], bt = dt.char === " ";
2873
+ for (let rt = 0; rt < H.length && H[rt].index < i; rt++) {
2874
+ const dt = H[rt], bt = dt.char === " ";
2831
2875
  let St = !0;
2832
2876
  if (bt) {
2833
- const kt = rt < Y, N = rt >= A.length - ht, vt = !O && Y > 0, Mt = !X && ht > 0;
2877
+ const kt = rt < G, N = rt >= H.length - ht, vt = !O && G > 0, Mt = !X && ht > 0;
2834
2878
  St = !(kt && vt || N && Mt);
2835
2879
  }
2836
2880
  St && (yt += dt.width);
2837
2881
  }
2838
- _ = Z + yt, G = W, V = x;
2882
+ _ = Z + yt, Y = D, V = R;
2839
2883
  }
2840
2884
  }
2841
- P < M.length - 1 && (W += I);
2885
+ E < x.length - 1 && (D += I);
2842
2886
  }
2843
2887
  });
2844
2888
  const z = a !== r;
2845
- let K = null, Q = null;
2889
+ let $ = null, Q = null;
2846
2890
  if (z) {
2847
- const L = Math.min(a, r), P = Math.max(a, r);
2848
- t.save(), t.fillStyle = xe(t.canvas);
2849
- let O = 0, X = -B / 2;
2850
- if (M.forEach((A, D) => {
2891
+ const L = Math.min(a, r), E = Math.max(a, r);
2892
+ t.save(), t.fillStyle = He(t.canvas);
2893
+ let O = 0, X = -P / 2;
2894
+ if (x.forEach((H, W) => {
2851
2895
  var ht, it;
2852
- const U = k[D].isParagraphStart, ot = k[D].isParagraphEnd, et = D === 0, lt = D === M.length - 1, Y = [];
2853
- if (A.forEach((Z) => {
2896
+ const U = A[W].isParagraphStart, ot = A[W].isParagraphEnd, et = W === 0, lt = W === x.length - 1, G = [];
2897
+ if (H.forEach((Z) => {
2854
2898
  Array.from(Z.text).forEach((st) => {
2855
- const F = Z.style || {}, q = F.fontSize !== void 0 ? F.fontSize : p, at = F.fontFamily !== void 0 ? F.fontFamily : f, J = F.bold !== void 0 ? F.bold : y, ut = F.italic !== void 0 ? F.italic : S, yt = F.letterSpacing !== void 0 ? F.letterSpacing : R;
2899
+ const F = Z.style || {}, q = F.fontSize !== void 0 ? F.fontSize : u, at = F.fontFamily !== void 0 ? F.fontFamily : g, J = F.bold !== void 0 ? F.bold : b, ut = F.italic !== void 0 ? F.italic : S, yt = F.letterSpacing !== void 0 ? F.letterSpacing : M;
2856
2900
  t.save();
2857
2901
  const rt = J ? "bold" : "normal", dt = ut ? "italic" : "normal";
2858
2902
  t.font = `${dt} ${rt} ${q}px "${at}", Arial, sans-serif`;
2859
2903
  const bt = t.measureText(st).width + yt;
2860
- t.restore(), Y.push({ char: st, index: O, width: bt, style: F }), O++;
2904
+ t.restore(), G.push({ char: st, index: O, width: bt, style: F }), O++;
2861
2905
  });
2862
- }), Y.length > 0) {
2863
- const Z = Y[0].index, st = Y[Y.length - 1].index;
2864
- if (P > Z && L <= st) {
2906
+ }), G.length > 0) {
2907
+ const Z = G[0].index, st = G[G.length - 1].index;
2908
+ if (E > Z && L <= st) {
2865
2909
  t.save();
2866
- const F = Y.map((N) => N.char).join(""), q = ((ht = F.match(/^ +/)) == null ? void 0 : ht[0].length) || 0, at = ((it = F.match(/ +$/)) == null ? void 0 : it[0].length) || 0;
2910
+ const F = G.map((N) => N.char).join(""), q = ((ht = F.match(/^ +/)) == null ? void 0 : ht[0].length) || 0, at = ((it = F.match(/ +$/)) == null ? void 0 : it[0].length) || 0;
2867
2911
  let J = 0;
2868
- for (let N = 0; N < Y.length; N++)
2869
- !et && N < q || !lt && N >= Y.length - at || (J += Y[N].width);
2912
+ for (let N = 0; N < G.length; N++)
2913
+ !et && N < q || !lt && N >= G.length - at || (J += G[N].width);
2870
2914
  let ut = 0;
2871
- T === "center" ? ut = -J / 2 : T === "right" && (ut = -J);
2872
- const yt = Math.max(L, Z), rt = Math.min(P, st + 1);
2915
+ v === "center" ? ut = -J / 2 : v === "right" && (ut = -J);
2916
+ const yt = Math.max(L, Z), rt = Math.min(E, st + 1);
2873
2917
  let dt = 0;
2874
- for (let N = 0; N < Y.length && Y[N].index < yt; N++) {
2875
- const vt = Y[N], Mt = N < q, Ht = N >= Y.length - at, It = !U && q > 0, Bt = !ot && at > 0;
2876
- !(Mt && It || Ht && Bt) && (dt += vt.width);
2918
+ for (let N = 0; N < G.length && G[N].index < yt; N++) {
2919
+ const vt = G[N], Mt = N < q, Lt = N >= G.length - at, Dt = !U && q > 0, Wt = !ot && at > 0;
2920
+ !(Mt && Dt || Lt && Wt) && (dt += vt.width);
2877
2921
  }
2878
2922
  let bt = 0;
2879
- for (let N = 0; N < Y.length && Y[N].index < rt; N++) {
2880
- const vt = Y[N], Mt = N < q, Ht = N >= Y.length - at, It = !U && q > 0, Bt = !ot && at > 0;
2881
- !(Mt && It || Ht && Bt) && (bt += vt.width);
2923
+ for (let N = 0; N < G.length && G[N].index < rt; N++) {
2924
+ const vt = G[N], Mt = N < q, Lt = N >= G.length - at, Dt = !U && q > 0, Wt = !ot && at > 0;
2925
+ !(Mt && Dt || Lt && Wt) && (bt += vt.width);
2882
2926
  }
2883
2927
  const St = ut + dt, kt = bt - dt;
2884
- t.fillRect(St, X, kt, x), K === null && (K = { x: St, y: X }), Q = { x: St + kt, y: X + x }, t.restore();
2928
+ t.fillRect(St, X, kt, R), $ === null && ($ = { x: St, y: X }), Q = { x: St + kt, y: X + R }, t.restore();
2885
2929
  }
2886
2930
  }
2887
- D < M.length - 1 && (X += I);
2931
+ W < x.length - 1 && (X += I);
2888
2932
  }), t.restore(), h) {
2889
2933
  t.save();
2890
- const A = o.transformType === "custom" ? o.transformData : null, D = A != null && A.width ? A.width - pt * 2 : void 0;
2891
- Ae(t, h, {
2892
- fontSize: p,
2893
- fontFamily: f,
2934
+ const H = o.transformType === "custom" ? o.transformData : null, W = H != null && H.width ? H.width - pt * 2 : void 0;
2935
+ We(t, h, {
2936
+ fontSize: u,
2937
+ fontFamily: g,
2894
2938
  color: o.color || "#000000",
2895
- bold: y,
2939
+ bold: b,
2896
2940
  italic: S,
2897
2941
  underline: m,
2898
2942
  strikethrough: w,
2899
- textAlign: T,
2943
+ textAlign: v,
2900
2944
  letterSpacing: o.letterSpacing,
2901
2945
  lineHeight: o.lineHeight
2902
- }, D), t.restore();
2946
+ }, W), t.restore();
2903
2947
  }
2904
2948
  }
2905
- if (z && d && K && Q) {
2906
- const L = K, P = Q, O = 6 / b, X = 2 / b;
2949
+ if (z && f && $ && Q) {
2950
+ const L = $, E = Q, O = 6 / y, X = 2 / y;
2907
2951
  t.save();
2908
- const A = nt(t.canvas);
2909
- t.fillStyle = A, t.strokeStyle = A, t.lineWidth = X, t.lineCap = "round";
2910
- const D = { x: L.x, y: L.y - O }, U = { x: P.x, y: P.y + O };
2911
- t.beginPath(), t.moveTo(L.x, L.y), t.lineTo(L.x, L.y + x), t.stroke(), t.beginPath(), t.arc(D.x, D.y, O, 0, Math.PI * 2), t.fill(), t.strokeStyle = "white", t.lineWidth = 2 / b, t.stroke(), t.strokeStyle = A, t.lineWidth = X, t.beginPath(), t.moveTo(P.x, P.y - x), t.lineTo(P.x, P.y), t.stroke(), t.beginPath(), t.arc(U.x, U.y, O, 0, Math.PI * 2), t.fill(), t.strokeStyle = "white", t.lineWidth = 2 / b, t.stroke(), t.restore(), g && (g.current = {
2952
+ const H = nt(t.canvas);
2953
+ t.fillStyle = H, t.strokeStyle = H, t.lineWidth = X, t.lineCap = "round";
2954
+ const W = { x: L.x, y: L.y - O }, U = { x: E.x, y: E.y + O };
2955
+ t.beginPath(), t.moveTo(L.x, L.y), t.lineTo(L.x, L.y + R), t.stroke(), t.beginPath(), t.arc(W.x, W.y, O, 0, Math.PI * 2), t.fill(), t.strokeStyle = "white", t.lineWidth = 2 / y, t.stroke(), t.strokeStyle = H, t.lineWidth = X, t.beginPath(), t.moveTo(E.x, E.y - R), t.lineTo(E.x, E.y), t.stroke(), t.beginPath(), t.arc(U.x, U.y, O, 0, Math.PI * 2), t.fill(), t.strokeStyle = "white", t.lineWidth = 2 / y, t.stroke(), t.restore(), d && (d.current = {
2912
2956
  start: {
2913
- center: D,
2957
+ center: W,
2914
2958
  textEdge: L
2915
2959
  // Original selection edge (top-left of selection on first line)
2916
2960
  },
2917
2961
  end: {
2918
2962
  center: U,
2919
- textEdge: P
2963
+ textEdge: E
2920
2964
  // Original selection edge (bottom-right of selection on last line)
2921
2965
  }
2922
2966
  });
2923
- } else g && (g.current = { start: null, end: null });
2924
- !z && c > 0 && (t.save(), t.globalAlpha = c, t.strokeStyle = nt(t.canvas), t.lineWidth = 3 / b, t.lineCap = "round", t.beginPath(), t.moveTo(_, G), t.lineTo(_, G + V), t.stroke(), t.restore()), t.restore();
2967
+ } else d && (d.current = { start: null, end: null });
2968
+ !z && c > 0 && (t.save(), t.globalAlpha = c, t.strokeStyle = nt(t.canvas), t.lineWidth = 3 / y, t.lineCap = "round", t.beginPath(), t.moveTo(_, Y), t.lineTo(_, Y + V), t.stroke(), t.restore()), t.restore();
2925
2969
  }
2926
2970
  /**
2927
2971
  * Render edit mode features for transformed text (circle, wave, arch, etc.)
@@ -2930,39 +2974,39 @@ class Vt {
2930
2974
  static renderTransformEditModeLayer(t, e, s, n = 1) {
2931
2975
  const { cursorPosition: o, cursorOpacity: i } = s, a = e.fontSize || 24, r = e.fontFamily || "Arial", l = e.bold || !1, h = e.italic || !1;
2932
2976
  t.save(), t.translate(e.x, e.y), t.rotate(-e.rotation * Math.PI / 180);
2933
- const c = l ? "bold" : "normal", d = h ? "italic" : "normal";
2934
- t.font = `${d} ${c} ${a}px ${r}`;
2935
- const g = Array.from(e.text), b = g.map((p) => t.measureText(p).width), u = Ft.calculateCharPositions(e, g, b);
2936
- if (o >= 0 && o <= g.length && i > 0) {
2937
- let p;
2977
+ const c = l ? "bold" : "normal", f = h ? "italic" : "normal";
2978
+ t.font = `${f} ${c} ${a}px ${r}`;
2979
+ const d = Array.from(e.text), y = d.map((u) => t.measureText(u).width), p = Nt.calculateCharPositions(e, d, y);
2980
+ if (o >= 0 && o <= d.length && i > 0) {
2981
+ let u;
2938
2982
  if (o === 0)
2939
- if (u.length > 0) {
2940
- const y = u[0], S = b[0];
2941
- p = {
2942
- x: y.x - Math.cos(y.angle) * (S / 2),
2943
- y: y.y - Math.sin(y.angle) * (S / 2),
2944
- angle: y.angle
2983
+ if (p.length > 0) {
2984
+ const b = p[0], S = y[0];
2985
+ u = {
2986
+ x: b.x - Math.cos(b.angle) * (S / 2),
2987
+ y: b.y - Math.sin(b.angle) * (S / 2),
2988
+ angle: b.angle
2945
2989
  };
2946
2990
  } else
2947
- p = { x: 0, y: 0, angle: 0 };
2948
- else if (o >= u.length) {
2949
- const y = u[u.length - 1], S = b[b.length - 1];
2950
- p = {
2951
- x: y.x + Math.cos(y.angle) * (S / 2),
2952
- y: y.y + Math.sin(y.angle) * (S / 2),
2953
- angle: y.angle
2991
+ u = { x: 0, y: 0, angle: 0 };
2992
+ else if (o >= p.length) {
2993
+ const b = p[p.length - 1], S = y[y.length - 1];
2994
+ u = {
2995
+ x: b.x + Math.cos(b.angle) * (S / 2),
2996
+ y: b.y + Math.sin(b.angle) * (S / 2),
2997
+ angle: b.angle
2954
2998
  };
2955
2999
  } else {
2956
- const y = u[o], S = b[o];
2957
- p = {
2958
- x: y.x - Math.cos(y.angle) * (S / 2),
2959
- y: y.y - Math.sin(y.angle) * (S / 2),
2960
- angle: y.angle
3000
+ const b = p[o], S = y[o];
3001
+ u = {
3002
+ x: b.x - Math.cos(b.angle) * (S / 2),
3003
+ y: b.y - Math.sin(b.angle) * (S / 2),
3004
+ angle: b.angle
2961
3005
  };
2962
3006
  }
2963
- t.save(), t.translate(p.x, p.y), t.rotate(p.angle), t.globalAlpha = i, t.strokeStyle = nt(t.canvas), t.lineWidth = 2 / n;
2964
- const f = a * 1.2;
2965
- t.beginPath(), t.moveTo(0, -f / 2), t.lineTo(0, f / 2), t.stroke(), t.restore();
3007
+ t.save(), t.translate(u.x, u.y), t.rotate(u.angle), t.globalAlpha = i, t.strokeStyle = nt(t.canvas), t.lineWidth = 2 / n;
3008
+ const g = a * 1.2;
3009
+ t.beginPath(), t.moveTo(0, -g / 2), t.lineTo(0, g / 2), t.stroke(), t.restore();
2966
3010
  }
2967
3011
  t.restore();
2968
3012
  }
@@ -2971,30 +3015,30 @@ class Vt {
2971
3015
  * Shows both image resize handles and crop handles
2972
3016
  */
2973
3017
  static renderCropBoxLayer(t, e, s, n = 1) {
2974
- if (!(e instanceof Re) || !e.isCropping) return;
3018
+ if (!(e instanceof Ie) || !e.isCropping) return;
2975
3019
  const o = e, i = o.getCropBoxBounds();
2976
3020
  if (!i) return;
2977
- const a = 4 / n, r = 2 / n, l = Ce / n, h = ke / n, c = 1 / n;
3021
+ const a = 4 / n, r = 2 / n, l = Be / n, h = Le / n, c = 1 / n;
2978
3022
  t.save(), t.translate(e.x * n, e.y * n), t.rotate(gt.toRadians(e.rotation));
2979
- const d = o.transformData.flipHorizontal ? -1 : 1, g = o.transformData.flipVertical ? -1 : 1;
2980
- t.scale(d * n, g * n);
2981
- const b = o.transformData.width * o.transformData.cropWidth, u = o.transformData.height * o.transformData.cropHeight, p = o.transformData.width / 2 - (o.transformData.cropX * o.transformData.width + b / 2), f = o.transformData.height / 2 - (o.transformData.cropY * o.transformData.height + u / 2), y = o.transformData.width / 2, S = o.transformData.height / 2, m = {
2982
- x: p - y,
2983
- y: f - S,
3023
+ const f = o.transformData.flipHorizontal ? -1 : 1, d = o.transformData.flipVertical ? -1 : 1;
3024
+ t.scale(f * n, d * n);
3025
+ const y = o.transformData.width * o.transformData.cropWidth, p = o.transformData.height * o.transformData.cropHeight, u = o.transformData.width / 2 - (o.transformData.cropX * o.transformData.width + y / 2), g = o.transformData.height / 2 - (o.transformData.cropY * o.transformData.height + p / 2), b = o.transformData.width / 2, S = o.transformData.height / 2, m = {
3026
+ x: u - b,
3027
+ y: g - S,
2984
3028
  width: o.transformData.width,
2985
3029
  height: o.transformData.height
2986
3030
  };
2987
3031
  t.fillStyle = "rgba(0, 0, 0, 0.5)", i.y > m.y && t.fillRect(m.x, m.y, m.width, i.y - m.y);
2988
- const w = i.y + i.height, T = m.y + m.height;
2989
- w < T && t.fillRect(m.x, w, m.width, T - w), i.x > m.x && t.fillRect(m.x, i.y, i.x - m.x, i.height);
2990
- const R = i.x + i.width, C = m.x + m.width;
2991
- R < C && t.fillRect(R, i.y, C - R, i.height), t.strokeStyle = nt(t.canvas), t.lineWidth = r, t.strokeRect(i.x, i.y, i.width, i.height), t.strokeStyle = "rgba(255, 255, 255, 0.5)", t.lineWidth = c;
2992
- const x = i.width / 3;
2993
- t.beginPath(), t.moveTo(i.x + x, i.y), t.lineTo(i.x + x, i.y + i.height), t.moveTo(i.x + 2 * x, i.y), t.lineTo(i.x + 2 * x, i.y + i.height), t.stroke();
3032
+ const w = i.y + i.height, v = m.y + m.height;
3033
+ w < v && t.fillRect(m.x, w, m.width, v - w), i.x > m.x && t.fillRect(m.x, i.y, i.x - m.x, i.height);
3034
+ const M = i.x + i.width, C = m.x + m.width;
3035
+ M < C && t.fillRect(M, i.y, C - M, i.height), t.strokeStyle = nt(t.canvas), t.lineWidth = r, t.strokeRect(i.x, i.y, i.width, i.height), t.strokeStyle = "rgba(255, 255, 255, 0.5)", t.lineWidth = c;
3036
+ const R = i.width / 3;
3037
+ t.beginPath(), t.moveTo(i.x + R, i.y), t.lineTo(i.x + R, i.y + i.height), t.moveTo(i.x + 2 * R, i.y), t.lineTo(i.x + 2 * R, i.y + i.height), t.stroke();
2994
3038
  const I = i.height / 3;
2995
3039
  t.beginPath(), t.moveTo(i.x, i.y + I), t.lineTo(i.x + i.width, i.y + I), t.moveTo(i.x, i.y + 2 * I), t.lineTo(i.x + i.width, i.y + 2 * I), t.stroke();
2996
- const M = o.isFrameLockedInCrop();
2997
- if ((M ? [] : [
3040
+ const x = o.isFrameLockedInCrop();
3041
+ if ((x ? [] : [
2998
3042
  { x: i.x, y: i.y },
2999
3043
  // top-left
3000
3044
  { x: i.x + i.width, y: i.y },
@@ -3003,9 +3047,9 @@ class Vt {
3003
3047
  // bottom-right
3004
3048
  { x: i.x, y: i.y + i.height }
3005
3049
  // bottom-left
3006
- ]).forEach((B) => {
3007
- t.beginPath(), t.arc(B.x, B.y, l + 1 / n, 0, Math.PI * 2), t.fillStyle = "#bbb", t.fill(), t.beginPath(), t.arc(B.x, B.y, l, 0, Math.PI * 2), t.fillStyle = "#fff", t.fill();
3008
- }), (M ? [] : [
3050
+ ]).forEach((P) => {
3051
+ t.beginPath(), t.arc(P.x, P.y, l + 1 / n, 0, Math.PI * 2), t.fillStyle = "#bbb", t.fill(), t.beginPath(), t.arc(P.x, P.y, l, 0, Math.PI * 2), t.fillStyle = "#fff", t.fill();
3052
+ }), (x ? [] : [
3009
3053
  { x: i.x + i.width / 2, y: i.y, orientation: "horizontal" },
3010
3054
  // top
3011
3055
  { x: i.x + i.width / 2, y: i.y + i.height, orientation: "horizontal" },
@@ -3014,21 +3058,21 @@ class Vt {
3014
3058
  // left
3015
3059
  { x: i.x + i.width, y: i.y + i.height / 2, orientation: "vertical" }
3016
3060
  // right
3017
- ]).forEach((B) => {
3018
- let W, _;
3019
- B.orientation === "horizontal" ? (W = h, _ = a) : (W = a, _ = h);
3020
- const G = B.x - W / 2, V = B.y - _ / 2;
3021
- t.fillStyle = "#fff", t.fillRect(G, V, W, _), t.strokeStyle = "#bbb", t.lineWidth = c, t.strokeRect(G, V, W, _);
3061
+ ]).forEach((P) => {
3062
+ let D, _;
3063
+ P.orientation === "horizontal" ? (D = h, _ = a) : (D = a, _ = h);
3064
+ const Y = P.x - D / 2, V = P.y - _ / 2;
3065
+ t.fillStyle = "#fff", t.fillRect(Y, V, D, _), t.strokeStyle = "#bbb", t.lineWidth = c, t.strokeRect(Y, V, D, _);
3022
3066
  }), t.restore(), s && s.resizeHandles) {
3023
- const B = s.resizeHandles.filter(
3067
+ const P = s.resizeHandles.filter(
3024
3068
  (V) => V.anchor === "top-left" || V.anchor === "top-right" || V.anchor === "bottom-left" || V.anchor === "bottom-right"
3025
- ), W = o.getCropBoxWorldCorners(), _ = 6, G = 20;
3026
- B.forEach((V) => {
3069
+ ), D = o.getCropBoxWorldCorners(), _ = 6, Y = 20;
3070
+ P.forEach((V) => {
3027
3071
  let j = !1;
3028
- if (W)
3029
- for (const H of W) {
3030
- const z = V.x - H.x, K = V.y - H.y;
3031
- if (Math.sqrt(z * z + K * K) < G) {
3072
+ if (D)
3073
+ for (const B of D) {
3074
+ const z = V.x - B.x, $ = V.y - B.y;
3075
+ if (Math.sqrt(z * z + $ * $) < Y) {
3032
3076
  j = !0;
3033
3077
  break;
3034
3078
  }
@@ -3038,8 +3082,8 @@ class Vt {
3038
3082
  }
3039
3083
  }
3040
3084
  }
3041
- Be();
3042
- const qe = te("CanvasRenderer"), Ue = 0.35, $ = class $ {
3085
+ Fe();
3086
+ const cn = ae("CanvasRenderer"), dn = 0.35, K = class K {
3043
3087
  /**
3044
3088
  * Get a pooled offscreen canvas for clipping content, only recreating
3045
3089
  * when dimensions change. Eliminates per-frame canvas allocation.
@@ -3063,7 +3107,7 @@ const qe = te("CanvasRenderer"), Ue = 0.35, $ = class $ {
3063
3107
  e.render(t, s, n);
3064
3108
  } catch (o) {
3065
3109
  const i = o instanceof Error ? o : new Error(String(o));
3066
- qe.error(`Failed to render element ${e.id}:`, i), $.onRenderError && $.onRenderError({
3110
+ cn.error(`Failed to render element ${e.id}:`, i), K.onRenderError && K.onRenderError({
3067
3111
  category: "render",
3068
3112
  message: `Failed to render element: ${i.message}`,
3069
3113
  originalError: i,
@@ -3109,12 +3153,12 @@ const qe = te("CanvasRenderer"), Ue = 0.35, $ = class $ {
3109
3153
  try {
3110
3154
  const l = new Path2D();
3111
3155
  for (const h of a.pieces) {
3112
- const c = new Path2D(h.d), d = h.rotation ?? 0, g = new DOMMatrix();
3113
- if (g.translateSelf(h.x, h.y), d !== 0) {
3114
- const b = (h.baseWidth ?? 0) / 2, u = (h.baseHeight ?? 0) / 2, { width: p, height: f } = Jt(h.baseWidth ?? 0, h.baseHeight ?? 0, d);
3115
- g.translateSelf(p / 2, f / 2), g.rotateSelf(d), g.translateSelf(-b, -u);
3156
+ const c = new Path2D(h.d), f = h.rotation ?? 0, d = new DOMMatrix();
3157
+ if (d.translateSelf(h.x, h.y), f !== 0) {
3158
+ const y = (h.baseWidth ?? 0) / 2, p = (h.baseHeight ?? 0) / 2, { width: u, height: g } = oe(h.baseWidth ?? 0, h.baseHeight ?? 0, f);
3159
+ d.translateSelf(u / 2, g / 2), d.rotateSelf(f), d.translateSelf(-y, -p);
3116
3160
  }
3117
- l.addPath(c, g);
3161
+ l.addPath(c, d);
3118
3162
  }
3119
3163
  t.translate(s, n), t.clip(l), t.translate(-s, -n);
3120
3164
  return;
@@ -3130,21 +3174,21 @@ const qe = te("CanvasRenderer"), Ue = 0.35, $ = class $ {
3130
3174
  static renderElementWithOverflowDimming(t, e, s, n, o, i) {
3131
3175
  const a = t.getTransform(), r = s.borderRadius || 0;
3132
3176
  t.save(), t.globalAlpha = 0.3 * (i ? tt : 1), t.filter = "blur(4px)", t.beginPath();
3133
- const h = t.getTransform().inverse(), c = t.canvas.width, d = t.canvas.height, g = new DOMPoint(0, 0).matrixTransform(h), b = new DOMPoint(c, d).matrixTransform(h), u = Math.max(b.x - g.x, b.y - g.y), p = g.x - u, f = g.y - u, y = b.x + u, S = b.y + u, m = typeof s.clipShape == "object" && s.clipShape !== null && s.clipShape.type === "composite-path" ? s.clipShape : null;
3177
+ const h = t.getTransform().inverse(), c = t.canvas.width, f = t.canvas.height, d = new DOMPoint(0, 0).matrixTransform(h), y = new DOMPoint(c, f).matrixTransform(h), p = Math.max(y.x - d.x, y.y - d.y), u = d.x - p, g = d.y - p, b = y.x + p, S = y.y + p, m = typeof s.clipShape == "object" && s.clipShape !== null && s.clipShape.type === "composite-path" ? s.clipShape : null;
3134
3178
  if (m) {
3135
3179
  const w = new Path2D();
3136
- w.rect(p, f, y - p, S - f);
3137
- for (const T of m.pieces) {
3138
- const R = new Path2D(T.d), C = T.rotation ?? 0, x = new DOMMatrix();
3139
- if (x.translateSelf(s.x + T.x, s.y + T.y), C !== 0) {
3140
- const I = (T.baseWidth ?? 0) / 2, M = (T.baseHeight ?? 0) / 2, { width: k, height: E } = Jt(T.baseWidth ?? 0, T.baseHeight ?? 0, C);
3141
- x.translateSelf(k / 2, E / 2), x.rotateSelf(C), x.translateSelf(-I, -M);
3180
+ w.rect(u, g, b - u, S - g);
3181
+ for (const v of m.pieces) {
3182
+ const M = new Path2D(v.d), C = v.rotation ?? 0, R = new DOMMatrix();
3183
+ if (R.translateSelf(s.x + v.x, s.y + v.y), C !== 0) {
3184
+ const I = (v.baseWidth ?? 0) / 2, x = (v.baseHeight ?? 0) / 2, { width: A, height: k } = oe(v.baseWidth ?? 0, v.baseHeight ?? 0, C);
3185
+ R.translateSelf(A / 2, k / 2), R.rotateSelf(C), R.translateSelf(-I, -x);
3142
3186
  }
3143
- w.addPath(R, x);
3187
+ w.addPath(M, R);
3144
3188
  }
3145
3189
  t.clip(w, "evenodd");
3146
3190
  } else
3147
- t.rect(p, f, y - p, S - f), r > 0 ? t.roundRect(s.x, s.y, s.width, s.height, r) : t.rect(s.x, s.y, s.width, s.height), t.clip("evenodd");
3191
+ t.rect(u, g, b - u, S - g), r > 0 ? t.roundRect(s.x, s.y, s.width, s.height, r) : t.rect(s.x, s.y, s.width, s.height), t.clip("evenodd");
3148
3192
  e.render(t, !1, !1), t.restore(), t.save(), this.applyArtboardClipPath(t, s), i && (t.globalAlpha = tt), e.render(t, n, o), t.restore(), t.setTransform(a);
3149
3193
  }
3150
3194
  /**
@@ -3157,62 +3201,62 @@ const qe = te("CanvasRenderer"), Ue = 0.35, $ = class $ {
3157
3201
  * clipped-only branch which respects `clipShape` correctly.
3158
3202
  */
3159
3203
  static renderElementsLayer(t, e, s, n, o, i, a, r = !0, l = !1, h = !1) {
3160
- const c = o != null && o.getMode() === "drag", d = o == null ? void 0 : o._activeChildContext;
3161
- e !== $._cachedElementsRef && ($._cachedElementConfigs = e.map((f) => f.toJSON()), $._cachedElementMap = new Map(e.map((f) => [f.id, f])), $._cachedElementsRef = e);
3162
- const g = $._cachedElementConfigs, b = $._cachedElementMap, u = $._knockoutRenderedIds;
3163
- u.clear(), e.forEach((f, y) => {
3204
+ const c = o != null && o.getMode() === "drag", f = o == null ? void 0 : o._activeChildContext;
3205
+ e !== K._cachedElementsRef && (K._cachedElementConfigs = e.map((g) => g.toJSON()), K._cachedElementMap = new Map(e.map((g) => [g.id, g])), K._cachedElementsRef = e);
3206
+ const d = K._cachedElementConfigs, y = K._cachedElementMap, p = K._knockoutRenderedIds;
3207
+ p.clear(), e.forEach((g, b) => {
3164
3208
  var S, m, w;
3165
- if (f.blendMode === "knockout" || f.blendMode === "clip") {
3166
- const T = g[y], R = f.blendMode === "knockout" ? "destination-out" : "destination-in", C = ((S = T.knockoutParts) == null ? void 0 : S.scope) || "group", x = g.findIndex((E) => E.id === T.id), I = ((m = T.knockoutParts) == null ? void 0 : m.fill) || ((w = T.knockoutParts) == null ? void 0 : w.stroke), M = C === "artboard" && x !== -1 ? g.slice(0, x) : [];
3167
- I && (C === "artboard" || M.length > 0) && (M.forEach((E) => E.id && u.add(E.id)), Ee(
3209
+ if (g.blendMode === "knockout" || g.blendMode === "clip") {
3210
+ const v = d[b], M = g.blendMode === "knockout" ? "destination-out" : "destination-in", C = ((S = v.knockoutParts) == null ? void 0 : S.scope) || "group", R = d.findIndex((k) => k.id === v.id), I = ((m = v.knockoutParts) == null ? void 0 : m.fill) || ((w = v.knockoutParts) == null ? void 0 : w.stroke), x = C === "artboard" && R !== -1 ? d.slice(0, R) : [];
3211
+ I && (C === "artboard" || x.length > 0) && (x.forEach((k) => k.id && p.add(k.id)), _e(
3168
3212
  t,
3169
- T,
3170
- g,
3171
- (E, B) => {
3172
- const W = B.id && b.get(B.id);
3173
- W && this.renderElement(E, W, r);
3213
+ v,
3214
+ d,
3215
+ (k, P) => {
3216
+ const D = P.id && y.get(P.id);
3217
+ D && this.renderElement(k, D, r);
3174
3218
  },
3175
3219
  i,
3176
3220
  a,
3177
- R
3178
- ), u.add(f.id));
3221
+ M
3222
+ ), p.add(g.id));
3179
3223
  }
3180
- }), e.some((f) => !u.has(f.id) && f.isClipping) ? this._renderWithClipping(
3224
+ }), e.some((g) => !p.has(g.id) && g.isClipping) ? this._renderWithClipping(
3181
3225
  t,
3182
3226
  e,
3183
- u,
3227
+ p,
3184
3228
  s,
3185
3229
  n,
3186
3230
  c,
3231
+ f,
3187
3232
  d,
3188
- g,
3189
3233
  r
3190
- ) : e.forEach((f) => {
3191
- var x, I;
3192
- if (u.has(f.id) || f.visible === !1) return;
3193
- const y = f.id === s, S = (n == null ? void 0 : n.type) === "element" && ((x = n == null ? void 0 : n.data) == null ? void 0 : x.id) === f.id, m = c && d && _t(f) && f.id === s, w = y && !m, T = g[e.indexOf(f)], R = ((I = T == null ? void 0 : T.distressEffect) == null ? void 0 : I.enabled) && T.distressEffect.style === "custom" && T.distressEffect.textureUrl, C = (M) => {
3194
- if (T && T.masks && T.masks.length > 0)
3195
- jt(f) && f.isCropping && (M.save(), M.globalAlpha *= Ue, this.safeRender(M, f, w, S), M.restore()), At(M, T, (k) => {
3196
- const E = (B) => {
3197
- r && (B.save(), B.globalAlpha = tt), this.safeRender(B, f, w, S), r && B.restore();
3234
+ ) : e.forEach((g) => {
3235
+ var R, I;
3236
+ if (p.has(g.id) || g.visible === !1) return;
3237
+ const b = g.id === s, S = (n == null ? void 0 : n.type) === "element" && ((R = n == null ? void 0 : n.data) == null ? void 0 : R.id) === g.id, m = c && f && Ot(g) && g.id === s, w = b && !m, v = d[e.indexOf(g)], M = ((I = v == null ? void 0 : v.distressEffect) == null ? void 0 : I.enabled) && v.distressEffect.style === "custom" && v.distressEffect.textureUrl, C = (x) => {
3238
+ if (v && v.masks && v.masks.length > 0)
3239
+ Qt(g) && g.isCropping && (x.save(), x.globalAlpha *= dn, this.safeRender(x, g, w, S), x.restore()), Pt(x, v, (A) => {
3240
+ const k = (P) => {
3241
+ r && (P.save(), P.globalAlpha = tt), this.safeRender(P, g, w, S), r && P.restore();
3198
3242
  };
3199
- if (R) {
3200
- const B = f.getVisualBoundingBox();
3201
- $t(k, T.distressEffect, B, E);
3243
+ if (M) {
3244
+ const P = g.getVisualBoundingBox();
3245
+ Jt(A, v.distressEffect, P, k);
3202
3246
  } else
3203
- E(k);
3247
+ k(A);
3204
3248
  });
3205
- else if (R) {
3206
- const k = f.getVisualBoundingBox();
3207
- $t(M, T.distressEffect, k, (E) => {
3208
- r && (E.save(), E.globalAlpha = tt), this.safeRender(E, f, w, S), r && E.restore();
3249
+ else if (M) {
3250
+ const A = g.getVisualBoundingBox();
3251
+ Jt(x, v.distressEffect, A, (k) => {
3252
+ r && (k.save(), k.globalAlpha = tt), this.safeRender(k, g, w, S), r && k.restore();
3209
3253
  });
3210
- } else l && !h && a && w ? this.renderElementWithOverflowDimming(M, f, a, w, S, r) : l && a ? (M.save(), this.applyArtboardClipPath(M, a), r && (M.globalAlpha = tt), this.safeRender(M, f, w, S), M.restore()) : (r && (M.save(), M.globalAlpha = tt), this.safeRender(M, f, w, S), r && M.restore());
3254
+ } else l && !h && a && w ? this.renderElementWithOverflowDimming(x, g, a, w, S, r) : l && a ? (x.save(), this.applyArtboardClipPath(x, a), r && (x.globalAlpha = tt), this.safeRender(x, g, w, S), x.restore()) : (r && (x.save(), x.globalAlpha = tt), this.safeRender(x, g, w, S), r && x.restore());
3211
3255
  };
3212
- Dt(
3256
+ Ft(
3213
3257
  t,
3214
- T,
3215
- (M) => C(M)
3258
+ v,
3259
+ (x) => C(x)
3216
3260
  );
3217
3261
  });
3218
3262
  }
@@ -3221,57 +3265,57 @@ const qe = te("CanvasRenderer"), Ue = 0.35, $ = class $ {
3221
3265
  * Elements with isClipping=true clip all elements below them
3222
3266
  */
3223
3267
  static _renderWithClipping(t, e, s, n, o, i, a, r, l = !0) {
3224
- var f;
3225
- const h = t.canvas, c = h.width, d = h.height, g = t.getTransform(), b = [];
3226
- let u = [], p = [];
3227
- for (let y = 0; y < e.length; y++) {
3228
- const S = e[y], m = r[y];
3229
- s.has(S.id) || S.visible !== !1 && (S.isClipping ? u.length > 0 ? (b.push({
3230
- content: u,
3268
+ var g;
3269
+ const h = t.canvas, c = h.width, f = h.height, d = t.getTransform(), y = [];
3270
+ let p = [], u = [];
3271
+ for (let b = 0; b < e.length; b++) {
3272
+ const S = e[b], m = r[b];
3273
+ s.has(S.id) || S.visible !== !1 && (S.isClipping ? p.length > 0 ? (y.push({
3274
+ content: p,
3231
3275
  mask: S,
3232
- contentConfigs: p,
3276
+ contentConfigs: u,
3233
3277
  maskConfig: m
3234
- }), u = [], p = []) : b.push({
3278
+ }), p = [], u = []) : y.push({
3235
3279
  content: [S],
3236
3280
  contentConfigs: [m]
3237
- }) : (u.push(S), p.push(m)));
3281
+ }) : (p.push(S), u.push(m)));
3238
3282
  }
3239
- u.length > 0 && b.push({
3240
- content: u,
3241
- contentConfigs: p
3283
+ p.length > 0 && y.push({
3284
+ content: p,
3285
+ contentConfigs: u
3242
3286
  });
3243
- for (const y of b)
3244
- if (!y.mask)
3245
- y.content.forEach((S, m) => {
3287
+ for (const b of y)
3288
+ if (!b.mask)
3289
+ b.content.forEach((S, m) => {
3246
3290
  var I;
3247
- const w = S.id === n, T = (o == null ? void 0 : o.type) === "element" && ((I = o == null ? void 0 : o.data) == null ? void 0 : I.id) === S.id, R = i && a && _t(S) && S.id === n, C = w && !R, x = y.contentConfigs[m];
3248
- Dt(t, x, (M) => {
3249
- const k = M;
3250
- x && x.masks && x.masks.length > 0 ? At(k, x, (E) => {
3251
- l && (E.save(), E.globalAlpha = tt), S.render(E, C, T), l && E.restore();
3252
- }) : (l && (k.save(), k.globalAlpha = tt), S.render(k, C, T), l && k.restore());
3291
+ const w = S.id === n, v = (o == null ? void 0 : o.type) === "element" && ((I = o == null ? void 0 : o.data) == null ? void 0 : I.id) === S.id, M = i && a && Ot(S) && S.id === n, C = w && !M, R = b.contentConfigs[m];
3292
+ Ft(t, R, (x) => {
3293
+ const A = x;
3294
+ R && R.masks && R.masks.length > 0 ? Pt(A, R, (k) => {
3295
+ l && (k.save(), k.globalAlpha = tt), S.render(k, C, v), l && k.restore();
3296
+ }) : (l && (A.save(), A.globalAlpha = tt), S.render(A, C, v), l && A.restore());
3253
3297
  });
3254
3298
  });
3255
3299
  else {
3256
- const S = this._getContentCanvas(c, d), m = S.getContext("2d");
3300
+ const S = this._getContentCanvas(c, f), m = S.getContext("2d");
3257
3301
  if (!m) continue;
3258
- m.setTransform(1, 0, 0, 1, 0, 0), m.clearRect(0, 0, c, d), m.globalCompositeOperation = "source-over", m.setTransform(g), y.content.forEach((x, I) => {
3302
+ m.setTransform(1, 0, 0, 1, 0, 0), m.clearRect(0, 0, c, f), m.globalCompositeOperation = "source-over", m.setTransform(d), b.content.forEach((R, I) => {
3259
3303
  var _;
3260
- const M = x.id === n, k = (o == null ? void 0 : o.type) === "element" && ((_ = o == null ? void 0 : o.data) == null ? void 0 : _.id) === x.id, E = i && a && _t(x) && x.id === n, B = M && !E, W = y.contentConfigs[I];
3261
- Dt(m, W, (G) => {
3262
- const V = G;
3263
- W && W.masks && W.masks.length > 0 ? At(V, W, (j) => {
3264
- l && (j.save(), j.globalAlpha = tt), x.render(j, B, k), l && j.restore();
3265
- }) : (l && (V.save(), V.globalAlpha = tt), x.render(V, B, k), l && V.restore());
3304
+ const x = R.id === n, A = (o == null ? void 0 : o.type) === "element" && ((_ = o == null ? void 0 : o.data) == null ? void 0 : _.id) === R.id, k = i && a && Ot(R) && R.id === n, P = x && !k, D = b.contentConfigs[I];
3305
+ Ft(m, D, (Y) => {
3306
+ const V = Y;
3307
+ D && D.masks && D.masks.length > 0 ? Pt(V, D, (j) => {
3308
+ l && (j.save(), j.globalAlpha = tt), R.render(j, P, A), l && j.restore();
3309
+ }) : (l && (V.save(), V.globalAlpha = tt), R.render(V, P, A), l && V.restore());
3266
3310
  });
3267
3311
  });
3268
- const w = this._getMaskCanvas(c, d), T = w.getContext("2d");
3269
- if (!T) continue;
3270
- T.setTransform(1, 0, 0, 1, 0, 0), T.clearRect(0, 0, c, d), T.globalCompositeOperation = "source-over", T.setTransform(g);
3271
- const R = y.mask.id === n, C = (o == null ? void 0 : o.type) === "element" && ((f = o == null ? void 0 : o.data) == null ? void 0 : f.id) === y.mask.id;
3272
- y.maskConfig && y.maskConfig.masks && y.maskConfig.masks.length > 0 ? At(T, y.maskConfig, (x) => {
3273
- l && (x.save(), x.globalAlpha = tt), y.mask.render(x, R, C), l && x.restore();
3274
- }) : (l && (T.save(), T.globalAlpha = tt), y.mask.render(T, R, C), l && T.restore()), m.globalCompositeOperation = "destination-in", m.setTransform(1, 0, 0, 1, 0, 0), m.drawImage(w, 0, 0), t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.drawImage(S, 0, 0), t.restore();
3312
+ const w = this._getMaskCanvas(c, f), v = w.getContext("2d");
3313
+ if (!v) continue;
3314
+ v.setTransform(1, 0, 0, 1, 0, 0), v.clearRect(0, 0, c, f), v.globalCompositeOperation = "source-over", v.setTransform(d);
3315
+ const M = b.mask.id === n, C = (o == null ? void 0 : o.type) === "element" && ((g = o == null ? void 0 : o.data) == null ? void 0 : g.id) === b.mask.id;
3316
+ b.maskConfig && b.maskConfig.masks && b.maskConfig.masks.length > 0 ? Pt(v, b.maskConfig, (R) => {
3317
+ l && (R.save(), R.globalAlpha = tt), b.mask.render(R, M, C), l && R.restore();
3318
+ }) : (l && (v.save(), v.globalAlpha = tt), b.mask.render(v, M, C), l && v.restore()), m.globalCompositeOperation = "destination-in", m.setTransform(1, 0, 0, 1, 0, 0), m.drawImage(w, 0, 0), t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.drawImage(S, 0, 0), t.restore();
3275
3319
  }
3276
3320
  }
3277
3321
  // =========================================================================
@@ -3334,14 +3378,14 @@ const qe = te("CanvasRenderer"), Ue = 0.35, $ = class $ {
3334
3378
  * @see HoverRenderer.renderHoverLayer
3335
3379
  */
3336
3380
  static renderHoverLayer(t, e, s, n = !1, o = 1, i) {
3337
- Ft.renderHoverLayer(t, e, s, n, o, i);
3381
+ Nt.renderHoverLayer(t, e, s, n, o, i);
3338
3382
  }
3339
3383
  /**
3340
3384
  * Render crop box layer (for images in crop mode)
3341
3385
  * @see EditModeRenderer.renderCropBoxLayer
3342
3386
  */
3343
3387
  static renderCropBoxLayer(t, e, s, n = 1) {
3344
- Vt.renderCropBoxLayer(t, e, s, n);
3388
+ Yt.renderCropBoxLayer(t, e, s, n);
3345
3389
  }
3346
3390
  // =========================================================================
3347
3391
  // Main Render Orchestration
@@ -3369,14 +3413,15 @@ const qe = te("CanvasRenderer"), Ue = 0.35, $ = class $ {
3369
3413
  spacingIndicators: l = [],
3370
3414
  artboardBackgroundColor: h,
3371
3415
  artboard: c,
3372
- isPreview: d = !0,
3373
- zoom: g = 1,
3374
- paddingOffset: b = { x: 0, y: 0 },
3375
- showOverflowDimmed: u = !1,
3376
- suppressOverflowDim: p = !1,
3377
- distressTexture: f,
3378
- imageMask: y,
3379
- editModeData: S
3416
+ isPreview: f = !0,
3417
+ zoom: d = 1,
3418
+ paddingOffset: y = { x: 0, y: 0 },
3419
+ showOverflowDimmed: p = !1,
3420
+ suppressOverflowDim: u = !1,
3421
+ distressTexture: g,
3422
+ imageMask: b,
3423
+ engrave: S,
3424
+ editModeData: m
3380
3425
  }) {
3381
3426
  if (this.renderElementsLayer(
3382
3427
  t,
@@ -3386,34 +3431,34 @@ const qe = te("CanvasRenderer"), Ue = 0.35, $ = class $ {
3386
3431
  a ?? void 0,
3387
3432
  h,
3388
3433
  c,
3389
- d,
3390
- u,
3391
- p
3392
- ), f != null && f.enabled && c && He(t, f, c, h), y != null && y.enabled && c && Ie(t, y, c, h), i && S && n && Vt.renderEditModeLayer(t, n, S, g), g !== 1) {
3434
+ f,
3435
+ p,
3436
+ u
3437
+ ), g != null && g.enabled && c && ze(t, g, c, h), b != null && b.enabled && c && Ve(t, b, c, h), S && c && rn(t, S, c), i && m && n && Yt.renderEditModeLayer(t, n, m, d), d !== 1) {
3393
3438
  t.save();
3394
- const R = t.getTransform().a / g, C = b.x * g * R, x = b.y * g * R;
3395
- t.setTransform(R, 0, 0, R, C, x);
3439
+ const C = t.getTransform().a / d, R = y.x * d * C, I = y.y * d * C;
3440
+ t.setTransform(C, 0, 0, C, R, I);
3396
3441
  }
3397
- const m = r.map((T) => ({
3398
- ...T,
3399
- x: T.x !== void 0 ? T.x * g : void 0,
3400
- y: T.y !== void 0 ? T.y * g : void 0,
3401
- x1: T.x1 !== void 0 ? T.x1 * g : void 0,
3402
- y1: T.y1 !== void 0 ? T.y1 * g : void 0,
3403
- x2: T.x2 !== void 0 ? T.x2 * g : void 0,
3404
- y2: T.y2 !== void 0 ? T.y2 * g : void 0
3405
- })), w = l.map((T) => ({
3406
- ...T,
3407
- x: T.x !== void 0 ? T.x * g : void 0,
3408
- y: T.y !== void 0 ? T.y * g : void 0,
3409
- x1: T.x1 !== void 0 ? T.x1 * g : void 0,
3410
- y1: T.y1 !== void 0 ? T.y1 * g : void 0,
3411
- x2: T.x2 !== void 0 ? T.x2 * g : void 0,
3412
- y2: T.y2 !== void 0 ? T.y2 * g : void 0,
3413
- labelX: T.labelX * g,
3414
- labelY: T.labelY * g
3442
+ const w = r.map((M) => ({
3443
+ ...M,
3444
+ x: M.x !== void 0 ? M.x * d : void 0,
3445
+ y: M.y !== void 0 ? M.y * d : void 0,
3446
+ x1: M.x1 !== void 0 ? M.x1 * d : void 0,
3447
+ y1: M.y1 !== void 0 ? M.y1 * d : void 0,
3448
+ x2: M.x2 !== void 0 ? M.x2 * d : void 0,
3449
+ y2: M.y2 !== void 0 ? M.y2 * d : void 0
3450
+ })), v = l.map((M) => ({
3451
+ ...M,
3452
+ x: M.x !== void 0 ? M.x * d : void 0,
3453
+ y: M.y !== void 0 ? M.y * d : void 0,
3454
+ x1: M.x1 !== void 0 ? M.x1 * d : void 0,
3455
+ y1: M.y1 !== void 0 ? M.y1 * d : void 0,
3456
+ x2: M.x2 !== void 0 ? M.x2 * d : void 0,
3457
+ y2: M.y2 !== void 0 ? M.y2 * d : void 0,
3458
+ labelX: M.labelX * d,
3459
+ labelY: M.labelY * d
3415
3460
  }));
3416
- Rt.renderSnapGuidesLayer(t, m), Rt.renderSpacingIndicatorsLayer(t, w), g !== 1 && t.restore();
3461
+ Rt.renderSnapGuidesLayer(t, w), Rt.renderSpacingIndicatorsLayer(t, v), d !== 1 && t.restore();
3417
3462
  }
3418
3463
  /**
3419
3464
  * Single-selection interaction chrome: bbox, handles, position/size
@@ -3439,20 +3484,20 @@ const qe = te("CanvasRenderer"), Ue = 0.35, $ = class $ {
3439
3484
  hideHandles: l = !1,
3440
3485
  isEditing: h,
3441
3486
  isAltKeyPressed: c = !1,
3442
- artboardBackgroundColor: d,
3443
- hoverClipArtboard: g,
3444
- showRotationHandle: b = !0,
3445
- zoom: u = 1,
3446
- paddingOffset: p = { x: 0, y: 0 }
3487
+ artboardBackgroundColor: f,
3488
+ hoverClipArtboard: d,
3489
+ showRotationHandle: y = !0,
3490
+ zoom: p = 1,
3491
+ paddingOffset: u = { x: 0, y: 0 }
3447
3492
  }) {
3448
- if (u !== 1) {
3493
+ if (p !== 1) {
3449
3494
  t.save();
3450
- const S = t.getTransform().a / u, m = p.x * u * S, w = p.y * u * S;
3495
+ const S = t.getTransform().a / p, m = u.x * p * S, w = u.y * p * S;
3451
3496
  t.setTransform(S, 0, 0, S, m, w);
3452
3497
  }
3453
- if (e && jt(e) && e.isCropping)
3454
- s && Vt.renderCropBoxLayer(t, e, s, u);
3455
- else if (!l && n && wt.renderSelectionLayer(t, e, n, u), s && n && wt.renderPositionSizeInfo(t, e, s, n, u), !l && s && n && wt.renderHandlesLayer(
3498
+ if (e && Qt(e) && e.isCropping)
3499
+ s && Yt.renderCropBoxLayer(t, e, s, p);
3500
+ else if (!l && n && wt.renderSelectionLayer(t, e, n, p), s && n && wt.renderPositionSizeInfo(t, e, s, n, p), !l && s && n && wt.renderHandlesLayer(
3456
3501
  t,
3457
3502
  e,
3458
3503
  s,
@@ -3460,37 +3505,38 @@ const qe = te("CanvasRenderer"), Ue = 0.35, $ = class $ {
3460
3505
  i,
3461
3506
  a,
3462
3507
  n,
3463
- u,
3464
- b
3508
+ p,
3509
+ y
3465
3510
  ), !h) {
3466
- if (g) {
3511
+ if (d) {
3467
3512
  t.save();
3468
- const y = g, S = y.x * u, m = y.y * u, w = y.width * u, T = y.height * u, R = (y.borderRadius ?? 0) * u;
3469
- t.beginPath(), R > 0 ? t.roundRect(S, m, w, T, R) : t.rect(S, m, w, T), t.clip();
3513
+ const b = d, S = b.x * p, m = b.y * p, w = b.width * p, v = b.height * p, M = (b.borderRadius ?? 0) * p;
3514
+ t.beginPath(), M > 0 ? t.roundRect(S, m, w, v, M) : t.rect(S, m, w, v), t.clip();
3470
3515
  }
3471
- Ft.renderHoverLayer(t, a, r, c, u, d), g && t.restore();
3516
+ Nt.renderHoverLayer(t, a, r, c, p, f), d && t.restore();
3472
3517
  }
3473
- u !== 1 && t.restore();
3518
+ p !== 1 && t.restore();
3474
3519
  }
3475
3520
  };
3476
- $._contentCanvas = null, $._contentCanvasSize = { width: 0, height: 0 }, $._maskCanvas = null, $._maskCanvasSize = { width: 0, height: 0 }, $._cachedElementsRef = null, $._cachedElementConfigs = null, $._cachedElementMap = null, $._knockoutRenderedIds = /* @__PURE__ */ new Set(), $.onRenderError = null;
3477
- let Qt = $;
3521
+ K._contentCanvas = null, K._contentCanvasSize = { width: 0, height: 0 }, K._maskCanvas = null, K._maskCanvasSize = { width: 0, height: 0 }, K._cachedElementsRef = null, K._cachedElementConfigs = null, K._cachedElementMap = null, K._knockoutRenderedIds = /* @__PURE__ */ new Set(), K.onRenderError = null;
3522
+ let ie = K;
3478
3523
  export {
3479
- rn as A,
3480
- Qt as C,
3481
- an as I,
3482
- Ke as R,
3483
- ln as S,
3484
- sn as T,
3485
- ie as a,
3486
- cn as b,
3487
- en as c,
3488
- tn as d,
3489
- Ye as e,
3490
- on as f,
3491
- qt as g,
3492
- ae as n,
3493
- hn as p,
3494
- nn as r
3524
+ Mn as A,
3525
+ ie as C,
3526
+ vn as I,
3527
+ nn as R,
3528
+ xn as S,
3529
+ Tn as T,
3530
+ fe as a,
3531
+ kn as b,
3532
+ Sn as c,
3533
+ bn as d,
3534
+ Je as e,
3535
+ wn as f,
3536
+ te as g,
3537
+ ge as n,
3538
+ Cn as p,
3539
+ mn as r,
3540
+ Rn as t
3495
3541
  };
3496
- //# sourceMappingURL=CanvasRenderer-DIug_mjX.js.map
3542
+ //# sourceMappingURL=CanvasRenderer-B8BADU_r.js.map