@snowcone-app/canvas 0.30.0 → 0.31.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 (69) hide show
  1. package/STYLING_CONTRACT.md +2 -2
  2. package/dist/{CanvasRenderer-BEf0hXeF.js → CanvasRenderer-hpJ05JGO.js} +4 -4
  3. package/dist/{CanvasRenderer-BEf0hXeF.js.map → CanvasRenderer-hpJ05JGO.js.map} +1 -1
  4. package/dist/{CanvasStateV1-BDSyYo4A.js → CanvasStateV1-jLOibojY.js} +11 -4
  5. package/dist/{CanvasStateV1-BDSyYo4A.js.map → CanvasStateV1-jLOibojY.js.map} +1 -1
  6. package/dist/{ContextualToolbars-C3D_6sep.js → ContextualToolbars-DRbuUE7W.js} +2086 -1985
  7. package/dist/ContextualToolbars-DRbuUE7W.js.map +1 -0
  8. package/dist/{EditorCanvasImpl-DXeBz2CX.js → EditorCanvasImpl-P2GHPNA3.js} +19 -20
  9. package/dist/{EditorCanvasImpl-DXeBz2CX.js.map → EditorCanvasImpl-P2GHPNA3.js.map} +1 -1
  10. package/dist/{ExportManager-DUdis6se.js → ExportManager-Bkzzyxgw.js} +400 -261
  11. package/dist/ExportManager-Bkzzyxgw.js.map +1 -0
  12. package/dist/{FontAnalyzer-DKG5JK0x.js → FontAnalyzer-BYhwxDhe.js} +1084 -1034
  13. package/dist/FontAnalyzer-BYhwxDhe.js.map +1 -0
  14. package/dist/{ImagePanel-CBgGqmVV.js → ImagePanel-CEr0_FYy.js} +49 -49
  15. package/dist/{ImagePanel-CBgGqmVV.js.map → ImagePanel-CEr0_FYy.js.map} +1 -1
  16. package/dist/{SnowconeCanvas-BWPBngvI.js → SnowconeCanvas-Fa0isFpO.js} +27 -27
  17. package/dist/{SnowconeCanvas-BWPBngvI.js.map → SnowconeCanvas-Fa0isFpO.js.map} +1 -1
  18. package/dist/advanced.mjs +14 -14
  19. package/dist/components/ImageToolbar.d.ts +4 -0
  20. package/dist/components/toolbars/EmbeddedToolbarLayout.d.ts +2 -0
  21. package/dist/components/toolbars/SecondaryPanels.d.ts +17 -1
  22. package/dist/components/toolbars/index.d.ts +2 -2
  23. package/dist/components/ui/SliderRow.d.ts +6 -0
  24. package/dist/components/ui/toolbar-button.d.ts +2 -2
  25. package/dist/core/image-adjustments.d.ts +32 -0
  26. package/dist/{custom-icons-BIaRovwG.js → custom-icons-Co4rcW0S.js} +7 -7
  27. package/dist/{custom-icons-BIaRovwG.js.map → custom-icons-Co4rcW0S.js.map} +1 -1
  28. package/dist/design-builder-CBG2hKc8.js +1672 -0
  29. package/dist/design-builder-CBG2hKc8.js.map +1 -0
  30. package/dist/{embed-Csez1hui.js → embed-D4TIzO7g.js} +110 -111
  31. package/dist/{embed-Csez1hui.js.map → embed-D4TIzO7g.js.map} +1 -1
  32. package/dist/embed.mjs +53 -54
  33. package/dist/embed.mjs.map +1 -1
  34. package/dist/{guards-BSoX73yg.js → guards-DgZuwVgu.js} +2 -2
  35. package/dist/{guards-BSoX73yg.js.map → guards-DgZuwVgu.js.map} +1 -1
  36. package/dist/hooks/elementPatch.d.ts +7 -2
  37. package/dist/index.mjs +41 -41
  38. package/dist/internals.mjs +196 -127
  39. package/dist/internals.mjs.map +1 -1
  40. package/dist/rendering/element-painters.d.ts +0 -13
  41. package/dist/rendering/element-serializer.d.ts +3 -1
  42. package/dist/rendering/image-adjustments.d.ts +24 -0
  43. package/dist/rendering/renderer-types.d.ts +8 -1
  44. package/dist/state/CanvasStateV1.d.ts +5 -0
  45. package/dist/template-fields-CvFcr5zy.js +505 -0
  46. package/dist/template-fields-CvFcr5zy.js.map +1 -0
  47. package/dist/testing.mjs +40 -41
  48. package/dist/testing.mjs.map +1 -1
  49. package/dist/types/index.d.ts +21 -0
  50. package/dist/{UnifiedFontService-Co9tQ59z.js → useCommands-bPXY9rCh.js} +2344 -2103
  51. package/dist/useCommands-bPXY9rCh.js.map +1 -0
  52. package/dist/{usePieceGuideBundle-CRLY2iQa.js → usePieceGuideBundle-Bj98nPk0.js} +2 -2
  53. package/dist/{usePieceGuideBundle-CRLY2iQa.js.map → usePieceGuideBundle-Bj98nPk0.js.map} +1 -1
  54. package/dist/utils/featureApplied.d.ts +2 -0
  55. package/dist/{validation-BGEl9rrE.js → validation-CsTlSvJJ.js} +465 -465
  56. package/dist/{validation-BGEl9rrE.js.map → validation-CsTlSvJJ.js.map} +1 -1
  57. package/dist/workers/export-worker.bundle.string.d.ts +1 -1
  58. package/example/package.json +1 -1
  59. package/package.json +1 -1
  60. package/dist/ContextualToolbars-C3D_6sep.js.map +0 -1
  61. package/dist/ExportManager-DUdis6se.js.map +0 -1
  62. package/dist/FontAnalyzer-DKG5JK0x.js.map +0 -1
  63. package/dist/UnifiedFontService-Co9tQ59z.js.map +0 -1
  64. package/dist/design-builder-JYLO_Hyi.js +0 -470
  65. package/dist/design-builder-JYLO_Hyi.js.map +0 -1
  66. package/dist/editorErrors-WzaNxU1Y.js +0 -1206
  67. package/dist/editorErrors-WzaNxU1Y.js.map +0 -1
  68. package/dist/template-fields-DYPW7bVU.js +0 -716
  69. package/dist/template-fields-DYPW7bVU.js.map +0 -1
@@ -1,17 +1,17 @@
1
1
  import { jsx as r, jsxs as y, Fragment as Pn } from "react/jsx-runtime";
2
2
  import * as $n from "react";
3
3
  import je, { useState as ce, useEffect as Pe, useCallback as ft, useMemo as xs, useContext as Pr, createContext as Ar, useRef as we, useImperativeHandle as nr, forwardRef as Nr } from "react";
4
- import { u as rs, g as sr, l as _s, m as $s, a as Ts, s as Dr, e as Br, f as Or } from "./editorErrors-WzaNxU1Y.js";
5
- import { g as rr, I as ze, j as zr, n as or, z as Fn, l as Qt, A as _e, y as Xr, w as Hr, x as Yr, v as Lr, F as _r, T as dn, h as un, i as hn, B as Ct, G as $r, H as Fr, J as Wr, K as ir, f as Kr, u as ar } from "./UnifiedFontService-Co9tQ59z.js";
6
- import { I as Ht, G as Re, au as Is, a6 as ys, ab as cr, av as Fs, aw as Vr, ax as Cn, ay as Ur, az as us, P as wn, c as zn, aA as en, aB as ms, aC as Gr, T as Qe, at as qr, aD as Jn, aE as jr, aF as Zr, aG as Jr, aH as lr, aI as Qr, aJ as Es, aK as eo, N as to, S as Qn, R as no, C as Bn } from "./FontAnalyzer-DKG5JK0x.js";
4
+ import { u as rs, k as sr, t as _s, v as $s, a as Ts, b as Dr, g as Br, h as Or } from "./design-builder-CBG2hKc8.js";
5
+ import { h as rr, I as ze, k as zr, o as or, N as Fn, m as Qt, O as _e, z as Xr, x as Lr, y as Yr, w as Hr, P as _r, T as dn, i as un, j as hn, B as Ct, Q as $r, R as Fr, V as Wr, W as ir, g as Vr, u as ar } from "./useCommands-bPXY9rCh.js";
6
+ import { I as Lt, G as Re, ay as Is, aa as ys, af as cr, az as Fs, aA as Kr, aB as Cn, aC as Ur, aD as us, P as wn, c as zn, aE as en, aF as ms, aG as Gr, T as Qe, ax as qr, aH as Jn, aI as jr, aJ as Zr, aK as Jr, aL as lr, aM as Qr, aN as Es, aO as eo, W as to, S as Qn, R as no, C as Bn } from "./FontAnalyzer-BYhwxDhe.js";
7
7
  import { createPortal as dr } from "react-dom";
8
- import { g as _n, b as so, r as ro, c as oo, C as Ws, d as Ks, e as gs, T as io, a as ao, A as co, S as lo, I as uo } from "./CanvasRenderer-BEf0hXeF.js";
8
+ import { g as _n, b as so, r as ro, c as oo, C as Ws, d as Vs, e as gs, T as io, a as ao, A as co, S as lo, I as uo } from "./CanvasRenderer-hpJ05JGO.js";
9
9
  import { u as ho } from "./ThemeContext-Rjz25x9X.js";
10
10
  import { renderToStaticMarkup as fo } from "react-dom/server";
11
- import { D as Ps, n as As, o as ur, p as Ns, C as po, q as Mt } from "./ContextualToolbars-C3D_6sep.js";
12
- import { L as Tt, S as hr, T as Ot, I as mo } from "./custom-icons-BIaRovwG.js";
11
+ import { D as Ps, n as As, o as ur, p as Ns, C as po, q as Mt } from "./ContextualToolbars-DRbuUE7W.js";
12
+ import { L as Tt, S as hr, T as Ot, I as mo } from "./custom-icons-Co4rcW0S.js";
13
13
  import * as ts from "@radix-ui/react-radio-group";
14
- import { L as go, M as Vs, N as Us } from "./ExportManager-DUdis6se.js";
14
+ import { L as go, M as Ks, N as Us } from "./ExportManager-Bkzzyxgw.js";
15
15
  import { cva as fr } from "class-variance-authority";
16
16
  import { debounce as Gs } from "lodash-es";
17
17
  const xo = {
@@ -176,11 +176,11 @@ function Fa() {
176
176
  return e.capabilities;
177
177
  }
178
178
  function So(e, t) {
179
- if (t instanceof Ht && t.isCropping || e instanceof Ht && e.isCropping)
179
+ if (t instanceof Lt && t.isCropping || e instanceof Lt && e.isCropping)
180
180
  return !0;
181
181
  if (e instanceof Re) {
182
182
  for (const n of e.children)
183
- if (n instanceof Ht && n.isCropping)
183
+ if (n instanceof Lt && n.isCropping)
184
184
  return !0;
185
185
  }
186
186
  return !1;
@@ -286,8 +286,8 @@ function Eo(e) {
286
286
  const D = g.shiftKey ? 10 : 1;
287
287
  let w = 0, ne = 0;
288
288
  g.key === "ArrowLeft" && (w = -D), g.key === "ArrowRight" && (w = D), g.key === "ArrowUp" && (ne = -D), g.key === "ArrowDown" && (ne = D);
289
- const K = n.clone();
290
- K.x += w, K.y += ne, a(K);
289
+ const V = n.clone();
290
+ V.x += w, V.y += ne, a(V);
291
291
  return;
292
292
  }
293
293
  }
@@ -425,7 +425,7 @@ function To(e, t) {
425
425
  const D = Math.min(R, C.length);
426
426
  for (let w = 0; w < D; w++) {
427
427
  if (!T && w < A) continue;
428
- const ne = C[w], K = x + w, O = c.getStyleAt(K), u = O.fontSize || n, q = O.fontFamily || s, U = O.bold !== void 0 ? O.bold : o, te = O.italic !== void 0 ? O.italic : i, le = O.letterSpacing !== void 0 ? O.letterSpacing : l;
428
+ const ne = C[w], V = x + w, O = c.getStyleAt(V), u = O.fontSize || n, q = O.fontFamily || s, U = O.bold !== void 0 ? O.bold : o, te = O.italic !== void 0 ? O.italic : i, le = O.letterSpacing !== void 0 ? O.letterSpacing : l;
429
429
  N += ys(ne, u, q, U, te, le);
430
430
  }
431
431
  return {
@@ -494,13 +494,13 @@ function Sn(e, t) {
494
494
  return E + I;
495
495
  if (ne >= D)
496
496
  return E + A.length - g;
497
- let K = 0;
497
+ let V = 0;
498
498
  for (let O = 0; O < A.length; O++) {
499
499
  if (!P && O < I || !N && O >= A.length - g) continue;
500
- const u = A[O], q = E + O, U = c.getStyleAt(q), te = U.fontSize || n, le = U.fontFamily || s, L = U.bold !== void 0 ? U.bold : o, xe = U.italic !== void 0 ? U.italic : i, ie = U.letterSpacing !== void 0 ? U.letterSpacing : l, be = ys(u, te, le, L, xe, ie);
501
- if (ne < K + be / 2)
500
+ const u = A[O], q = E + O, U = c.getStyleAt(q), te = U.fontSize || n, le = U.fontFamily || s, H = U.bold !== void 0 ? U.bold : o, xe = U.italic !== void 0 ? U.italic : i, ie = U.letterSpacing !== void 0 ? U.letterSpacing : l, be = ys(u, te, le, H, xe, ie);
501
+ if (ne < V + be / 2)
502
502
  return q;
503
- K += be;
503
+ V += be;
504
504
  }
505
505
  return E + A.length;
506
506
  }
@@ -720,7 +720,7 @@ class Ao {
720
720
  var a, l, c, f, d, m, p, b;
721
721
  if (!this.state.active || this.state.points.length === 0) return;
722
722
  const { points: s, previewPoint: o, currentPoint: i } = this.state;
723
- if (t.save(), t.translate(n.x, n.y), t.strokeStyle = Vr(), t.lineWidth = 2, t.setLineDash([]), t.beginPath(), s.length > 0) {
723
+ if (t.save(), t.translate(n.x, n.y), t.strokeStyle = Kr(), t.lineWidth = 2, t.setLineDash([]), t.beginPath(), s.length > 0) {
724
724
  const x = s[0];
725
725
  t.moveTo(x.x, x.y);
726
726
  for (let C = 1; C < s.length; C++) {
@@ -949,13 +949,13 @@ class zo {
949
949
  const P = o.startX - p, N = o.startY - b;
950
950
  let D = P * v - N * C, w = P * C + N * v;
951
951
  D *= R, w *= E;
952
- const ne = I - D, K = g - w, O = l.cropX, u = l.cropY, q = l.cropWidth, U = l.cropHeight, te = l.width, le = l.height, L = ne / te, xe = K / le, ie = this._calculateNewCropValues(
952
+ const ne = I - D, V = g - w, O = l.cropX, u = l.cropY, q = l.cropWidth, U = l.cropHeight, te = l.width, le = l.height, H = ne / te, xe = V / le, ie = this._calculateNewCropValues(
953
953
  n,
954
954
  O,
955
955
  u,
956
956
  q,
957
957
  U,
958
- L,
958
+ H,
959
959
  xe
960
960
  ), be = this._calculateCropCenterOffset(
961
961
  O,
@@ -1044,7 +1044,7 @@ function Xo() {
1044
1044
  cropController: e
1045
1045
  };
1046
1046
  }
1047
- function Ho(e) {
1047
+ function Lo(e) {
1048
1048
  const t = we(null), n = we(null);
1049
1049
  return Pe(() => {
1050
1050
  n.current = null;
@@ -1061,13 +1061,13 @@ function Yo({ selectedElement: e, ref: t }) {
1061
1061
  (w) => {
1062
1062
  if (!n || !E)
1063
1063
  return;
1064
- const ne = Math.min(d, p), K = Math.max(d, p);
1065
- if (ne === K) {
1064
+ const ne = Math.min(d, p), V = Math.max(d, p);
1065
+ if (ne === V) {
1066
1066
  const O = E.clone(), u = O.getText().length;
1067
1067
  O.applyStyle(0, u, w), g.current = O, A(O), i(O.getText()), I((q) => ({ ...q, ...w }));
1068
1068
  } else {
1069
1069
  const O = E.clone();
1070
- O.applyStyle(ne, K, w), g.current = O, A(O), i(O.getText()), I((u) => ({ ...u, ...w }));
1070
+ O.applyStyle(ne, V, w), g.current = O, A(O), i(O.getText()), I((u) => ({ ...u, ...w }));
1071
1071
  }
1072
1072
  },
1073
1073
  [n, E, d, p]
@@ -1128,7 +1128,7 @@ function Yo({ selectedElement: e, ref: t }) {
1128
1128
  toggleFormattingProperty: D
1129
1129
  };
1130
1130
  }
1131
- function Lo({
1131
+ function Ho({
1132
1132
  width: e,
1133
1133
  height: t,
1134
1134
  zoom: n,
@@ -1143,18 +1143,18 @@ function Lo({
1143
1143
  }) {
1144
1144
  const [m, p] = ce(!1);
1145
1145
  Pe(() => {
1146
- const K = "ontouchstart" in window || navigator.maxTouchPoints > 0;
1147
- p(K);
1146
+ const V = "ontouchstart" in window || navigator.maxTouchPoints > 0;
1147
+ p(V);
1148
1148
  }, []);
1149
1149
  const b = we(null);
1150
1150
  Pe(() => {
1151
- const K = (O) => {
1151
+ const V = (O) => {
1152
1152
  b.current = O.target, setTimeout(() => {
1153
1153
  b.current = null;
1154
1154
  }, 500);
1155
1155
  };
1156
- return document.addEventListener("touchstart", K, { capture: !0, passive: !0 }), document.addEventListener("pointerdown", K, { capture: !0, passive: !0 }), () => {
1157
- document.removeEventListener("touchstart", K, { capture: !0 }), document.removeEventListener("pointerdown", K, { capture: !0 });
1156
+ return document.addEventListener("touchstart", V, { capture: !0, passive: !0 }), document.addEventListener("pointerdown", V, { capture: !0, passive: !0 }), () => {
1157
+ document.removeEventListener("touchstart", V, { capture: !0 }), document.removeEventListener("pointerdown", V, { capture: !0 });
1158
1158
  };
1159
1159
  }, []);
1160
1160
  const [x, v] = ce({
@@ -1170,10 +1170,10 @@ function Lo({
1170
1170
  v({ width: e, height: t });
1171
1171
  return;
1172
1172
  }
1173
- const K = f.getActiveArtboard();
1174
- K && v({ width: K.width, height: K.height });
1173
+ const V = f.getActiveArtboard();
1174
+ V && v({ width: V.width, height: V.height });
1175
1175
  }, [e, t, c, f, d]), Pe(() => {
1176
- const K = () => {
1176
+ const V = () => {
1177
1177
  if (d) {
1178
1178
  v({ width: d.width, height: d.height });
1179
1179
  return;
@@ -1183,7 +1183,7 @@ function Lo({
1183
1183
  v(O ? { width: O.width, height: O.height } : { width: window.innerWidth, height: window.innerHeight });
1184
1184
  }
1185
1185
  };
1186
- return window.addEventListener("resize", K), () => window.removeEventListener("resize", K);
1186
+ return window.addEventListener("resize", V), () => window.removeEventListener("resize", V);
1187
1187
  }, [e, t, f, d]);
1188
1188
  const C = Math.max(0.1, Math.min(1, s)), R = a ?? i, E = l ?? i, A = R !== void 0 && n > 0 ? R / n : 0, T = E !== void 0 && n > 0 ? E / n : 0, I = R !== void 0 ? x.width + A * 2 : x.width / C, g = E !== void 0 ? x.height + T * 2 : x.height / C, P = R !== void 0 ? A : (I - x.width) / 2, N = E !== void 0 ? T : (g - x.height) / 2, D = d ? P - d.x : P, w = d ? N - d.y : N, ne = n > 0 ? o / n : o;
1189
1189
  return {
@@ -1334,7 +1334,7 @@ function es(e, t) {
1334
1334
  }
1335
1335
  e.beginPath(), os(e, t), e.stroke();
1336
1336
  }
1337
- function Ko(e, t) {
1337
+ function Vo(e, t) {
1338
1338
  t.kind !== "path" && os(e, t);
1339
1339
  }
1340
1340
  function bs(e, t) {
@@ -1355,7 +1355,7 @@ function bs(e, t) {
1355
1355
  }
1356
1356
  e.addPath(new Path2D(t.d));
1357
1357
  }
1358
- function Vo(e, t, n) {
1358
+ function Ko(e, t, n) {
1359
1359
  return (e == null ? void 0 : e.boundary) ?? {
1360
1360
  kind: "rect",
1361
1361
  x: 0,
@@ -1409,16 +1409,16 @@ function Go(e) {
1409
1409
  continue;
1410
1410
  const D = s == null ? void 0 : s[N.id], w = (D == null ? void 0 : D.zones) ?? [], ne = (D == null ? void 0 : D.labels) ?? [];
1411
1411
  t.save(), t.translate(N.x, N.y);
1412
- const K = N.rotation ?? 0;
1413
- K === 90 ? (t.translate(N.width, 0), t.rotate(Math.PI / 2)) : K === 180 ? (t.translate(N.width, N.height), t.rotate(Math.PI)) : K === 270 && (t.translate(0, N.height), t.rotate(3 * Math.PI / 2));
1414
- const O = K === 90 || K === 270, u = O ? N.height : N.width, q = O ? N.width : N.height, U = Vo(D, u, q), te = Uo(D, N, u, q), le = !0, L = Math.max(0, (D == null ? void 0 : D.outerRadius) ?? 0), xe = L > 0 ? {
1412
+ const V = N.rotation ?? 0;
1413
+ V === 90 ? (t.translate(N.width, 0), t.rotate(Math.PI / 2)) : V === 180 ? (t.translate(N.width, N.height), t.rotate(Math.PI)) : V === 270 && (t.translate(0, N.height), t.rotate(3 * Math.PI / 2));
1414
+ const O = V === 90 || V === 270, u = O ? N.height : N.width, q = O ? N.width : N.height, U = Ko(D, u, q), te = Uo(D, N, u, q), le = !0, H = Math.max(0, (D == null ? void 0 : D.outerRadius) ?? 0), xe = H > 0 ? {
1415
1415
  kind: "roundedRect",
1416
1416
  x: 0,
1417
1417
  y: 0,
1418
1418
  width: u,
1419
1419
  height: q,
1420
- rx: L,
1421
- ry: L
1420
+ rx: H,
1421
+ ry: H
1422
1422
  } : {
1423
1423
  kind: "rect",
1424
1424
  x: 0,
@@ -1426,7 +1426,7 @@ function Go(e) {
1426
1426
  width: u,
1427
1427
  height: q
1428
1428
  };
1429
- if (L > 0 && (t.save(), t.beginPath(), Ko(t, xe), t.clip()), a.bleed && m.bleedOpacity > 0) {
1429
+ if (H > 0 && (t.save(), t.beginPath(), Vo(t, xe), t.clip()), a.bleed && m.bleedOpacity > 0) {
1430
1430
  const ie = m.bleedInnerEdge === "safeArea" && te ? te : U;
1431
1431
  if (ie) {
1432
1432
  const be = f ? "screen" : "multiply", Se = m.bleedOpacity;
@@ -1479,7 +1479,7 @@ function Go(e) {
1479
1479
  m.dieCutStroke,
1480
1480
  m.dieCutStrokeWidthPx
1481
1481
  ));
1482
- a.boundary && x && m.boundaryStrokeWidthPx > 0 && (t.save(), t.strokeStyle = x, Jn(t, m.boundaryStrokeWidthPx), es(t, U), t.restore()), a.safeArea && te && m.safeAreaStroke && (t.save(), t.strokeStyle = m.safeAreaStroke, Jn(t, m.safeAreaStrokeWidthPx, m.safeAreaDashPx), es(t, te), t.setLineDash([]), t.restore()), a.labels && ne.length > 0 && ti(t, ne, m, i), L > 0 && t.restore(), t.restore();
1482
+ a.boundary && x && m.boundaryStrokeWidthPx > 0 && (t.save(), t.strokeStyle = x, Jn(t, m.boundaryStrokeWidthPx), es(t, U), t.restore()), a.safeArea && te && m.safeAreaStroke && (t.save(), t.strokeStyle = m.safeAreaStroke, Jn(t, m.safeAreaStrokeWidthPx, m.safeAreaDashPx), es(t, te), t.setLineDash([]), t.restore()), a.labels && ne.length > 0 && ti(t, ne, m, i), H > 0 && t.restore(), t.restore();
1483
1483
  }
1484
1484
  t.restore();
1485
1485
  }
@@ -1616,11 +1616,11 @@ function ri(e) {
1616
1616
  } else
1617
1617
  P = { ...P, centerX: I, centerY: g };
1618
1618
  }
1619
- const w = l && i.getMode() === "rotate" ? P.rotation + c : P.rotation, ne = P.width, K = P.height, O = P.centerX, u = P.centerY, q = O - ne / 2, U = u - K / 2, te = O + ne / 2, le = u + K / 2;
1620
- let L = O, xe = le + jr;
1619
+ const w = l && i.getMode() === "rotate" ? P.rotation + c : P.rotation, ne = P.width, V = P.height, O = P.centerX, u = P.centerY, q = O - ne / 2, U = u - V / 2, te = O + ne / 2, le = u + V / 2;
1620
+ let H = O, xe = le + jr;
1621
1621
  if (w !== 0) {
1622
- const be = -w * Math.PI / 180, Se = Math.cos(be), Te = Math.sin(be), Oe = L - O, De = xe - u;
1623
- L = O + (Oe * Se - De * Te), xe = u + (Oe * Te + De * Se);
1622
+ const be = -w * Math.PI / 180, Se = Math.cos(be), Te = Math.sin(be), Oe = H - O, De = xe - u;
1623
+ H = O + (Oe * Se - De * Te), xe = u + (Oe * Te + De * Se);
1624
1624
  }
1625
1625
  const ie = {
1626
1626
  minX: q,
@@ -1629,11 +1629,11 @@ function ri(e) {
1629
1629
  maxY: le,
1630
1630
  centerX: O,
1631
1631
  centerY: u,
1632
- rotationHandleX: L,
1632
+ rotationHandleX: H,
1633
1633
  rotationHandleY: xe,
1634
1634
  rotation: w
1635
1635
  };
1636
- return t.save(), t.translate(O, u), t.rotate(-w * Math.PI / 180), t.translate(-O, -u), t.strokeStyle = Cn(), t.lineWidth = _n(d), t.setLineDash(so(d)), t.strokeRect(q, U, ne, K), t.restore(), f || oi(t, {
1636
+ return t.save(), t.translate(O, u), t.rotate(-w * Math.PI / 180), t.translate(-O, -u), t.strokeStyle = Cn(), t.lineWidth = _n(d), t.setLineDash(so(d)), t.strokeRect(q, U, ne, V), t.restore(), f || oi(t, {
1637
1637
  renderMinX: q,
1638
1638
  renderMinY: U,
1639
1639
  renderMaxX: te,
@@ -1641,9 +1641,9 @@ function ri(e) {
1641
1641
  renderCenterX: O,
1642
1642
  renderCenterY: u,
1643
1643
  renderWidth: ne,
1644
- renderHeight: K,
1644
+ renderHeight: V,
1645
1645
  groupRotation: w,
1646
- rotationHandleX: L,
1646
+ rotationHandleX: H,
1647
1647
  rotationHandleY: xe,
1648
1648
  stateMachine: i,
1649
1649
  zoom: d
@@ -1697,7 +1697,7 @@ function ci(e) {
1697
1697
  t.save(), t.translate(o.x + o.width / 2, o.y + o.height / 2), t.rotate(-n.rotation * Math.PI / 180), t.translate(-(o.x + o.width / 2), -(o.y + o.height / 2)), t.strokeStyle = Jr(), t.lineWidth = _n(s), t.setLineDash([]), t.strokeRect(o.x, o.y, o.width, o.height), t.restore();
1698
1698
  }
1699
1699
  const li = 60;
1700
- class Ln {
1700
+ class Hn {
1701
1701
  constructor() {
1702
1702
  this.frameTimes = [], this.metrics = {
1703
1703
  frameTime: 0,
@@ -1708,7 +1708,7 @@ class Ln {
1708
1708
  };
1709
1709
  }
1710
1710
  static getInstance() {
1711
- return Ln.instance || (Ln.instance = new Ln()), Ln.instance;
1711
+ return Hn.instance || (Hn.instance = new Hn()), Hn.instance;
1712
1712
  }
1713
1713
  /**
1714
1714
  * Record a single frame's render duration. Maintains a rolling window
@@ -1827,7 +1827,7 @@ function ui(e) {
1827
1827
  if (c.startTime !== null && c.type !== null && performance.now() - c.startTime < 150 && (n.current = !0), n.current) {
1828
1828
  n.current = !1;
1829
1829
  const f = performance.now();
1830
- hi(t.current, o, s), Ln.getInstance().recordFrameTime(performance.now() - f);
1830
+ hi(t.current, o, s), Hn.getInstance().recordFrameTime(performance.now() - f);
1831
1831
  }
1832
1832
  i = requestAnimationFrame(l);
1833
1833
  };
@@ -1862,14 +1862,14 @@ function hi(e, t, n) {
1862
1862
  hoverState: D,
1863
1863
  isEditing: w,
1864
1864
  editText: ne,
1865
- editRichText: K,
1865
+ editRichText: V,
1866
1866
  cursorPosition: O,
1867
1867
  selectionStart: u,
1868
1868
  selectionEnd: q,
1869
1869
  cursorOpacityRef: U,
1870
1870
  cursorStartTimeRef: te,
1871
1871
  isTouchDevice: le,
1872
- selectionHandlePositionsRef: L,
1872
+ selectionHandlePositionsRef: H,
1873
1873
  multiClickSelectionRef: xe,
1874
1874
  lastMultiClickTimeRef: ie,
1875
1875
  MULTI_CLICK_DEBOUNCE: be,
@@ -1891,31 +1891,31 @@ function hi(e, t, n) {
1891
1891
  const se = lt.getContext("2d");
1892
1892
  if (!se) return;
1893
1893
  if (w) {
1894
- const Ue = (me) => me < 0.5 ? 4 * me * me * me : 1 - Math.pow(-2 * me + 2, 3) / 2, V = (performance.now() - te.current) % 1060 / 1060, ue = V < 0.5 ? 1 - Ue(V * 2) : Ue((V - 0.5) * 2);
1894
+ const Ue = (me) => me < 0.5 ? 4 * me * me * me : 1 - Math.pow(-2 * me + 2, 3) / 2, K = (performance.now() - te.current) % 1060 / 1060, ue = K < 0.5 ? 1 - Ue(K * 2) : Ue((K - 0.5) * 2);
1895
1895
  U.current = ue;
1896
1896
  } else
1897
1897
  U.current = 1;
1898
1898
  const h = window.devicePixelRatio || 1, G = v * A, re = C * A;
1899
1899
  if (G <= 0 || re <= 0) return;
1900
- const he = 4096, _ = G * h, Ce = re * h, Ie = Math.max(_, Ce), Ke = Ie > he ? he / Ie : 1, Xe = h * Ke;
1900
+ const he = 4096, _ = G * h, Ce = re * h, Ie = Math.max(_, Ce), Ve = Ie > he ? he / Ie : 1, Xe = h * Ve;
1901
1901
  lt.width = G * Xe, lt.height = re * Xe, se.setTransform(1, 0, 0, 1, 0, 0), se.clearRect(0, 0, lt.width, lt.height);
1902
1902
  const Y = t.current;
1903
1903
  se.scale(Xe, Xe), A !== 1 && se.scale(A, A), (R !== 0 || E !== 0) && se.translate(R, E);
1904
- const $ = a.find((Ve) => Ve.id === l.getActiveArtboardId()), ot = ($ == null ? void 0 : $.id) ?? null, rt = Ee && $ ? di(
1904
+ const $ = a.find((Ke) => Ke.id === l.getActiveArtboardId()), ot = ($ == null ? void 0 : $.id) ?? null, rt = Ee && $ ? di(
1905
1905
  Ee.pieces,
1906
1906
  Ee.guides,
1907
1907
  e.focusedPieceId ?? null
1908
1908
  ) : void 0;
1909
1909
  let Ze = Ee ? 0 : T;
1910
1910
  if (Ee && Ee.pieces.length === 1 && $) {
1911
- const Ve = Ee.pieces[0].id, Ae = (rn = Ee.guides) == null ? void 0 : rn[Ve], V = Ae == null ? void 0 : Ae.outerRadius, ue = Ae == null ? void 0 : Ae.boundary, me = ue && typeof ue == "object" && ue.kind === "roundedRect" ? ue.rx ?? ue.ry : void 0, Be = typeof V == "number" && V > 0 ? V : typeof me == "number" && me > 0 ? me : 0;
1911
+ const Ke = Ee.pieces[0].id, Ae = (rn = Ee.guides) == null ? void 0 : rn[Ke], K = Ae == null ? void 0 : Ae.outerRadius, ue = Ae == null ? void 0 : Ae.boundary, me = ue && typeof ue == "object" && ue.kind === "roundedRect" ? ue.rx ?? ue.ry : void 0, Be = typeof K == "number" && K > 0 ? K : typeof me == "number" && me > 0 ? me : 0;
1912
1912
  Be > 0 && (Ze = Be);
1913
1913
  }
1914
1914
  if ($ && !Ee)
1915
1915
  if (se.fillStyle = Y, rt && typeof rt == "object" && rt.type === "path")
1916
1916
  try {
1917
- const Ve = new Path2D(rt.d);
1918
- se.save(), se.translate($.x, $.y), se.fill(Ve), se.restore();
1917
+ const Ke = new Path2D(rt.d);
1918
+ se.save(), se.translate($.x, $.y), se.fill(Ke), se.restore();
1919
1919
  } catch {
1920
1920
  se.fillRect(
1921
1921
  $.x,
@@ -1945,33 +1945,33 @@ function hi(e, t, n) {
1945
1945
  ), m || (gt = Ue[d.id]));
1946
1946
  }
1947
1947
  if (w && d) {
1948
- const Ve = p.current ?? null, Ue = n.current;
1949
- if (!(Ue !== null && Ue.elementId === d.id && Ue.childId === Ve && Ue.editRichText === K)) {
1950
- let V = null;
1951
- if (Ve && d instanceof Re) {
1948
+ const Ke = p.current ?? null, Ue = n.current;
1949
+ if (!(Ue !== null && Ue.elementId === d.id && Ue.childId === Ke && Ue.editRichText === V)) {
1950
+ let K = null;
1951
+ if (Ke && d instanceof Re) {
1952
1952
  const ue = Nt.find(
1953
1953
  (me) => me.id === d.id && me instanceof Re
1954
1954
  );
1955
1955
  if (ue) {
1956
1956
  const me = ue.clone();
1957
1957
  me.children = me.children.map((Be) => {
1958
- if (Be.id === Ve && K && Be instanceof Qe) {
1958
+ if (Be.id === Ke && V && Be instanceof Qe) {
1959
1959
  const Je = Be.clone();
1960
- return Je.setRichText(K), Je;
1960
+ return Je.setRichText(V), Je;
1961
1961
  }
1962
1962
  return Be;
1963
- }), V = me;
1963
+ }), K = me;
1964
1964
  }
1965
- } else if (K && d instanceof Qe) {
1965
+ } else if (V && d instanceof Qe) {
1966
1966
  const ue = d.clone();
1967
- ue.setRichText(K), V = ue;
1967
+ ue.setRichText(V), K = ue;
1968
1968
  }
1969
- V ? n.current = { elementId: d.id, childId: Ve, editRichText: K, clonedElement: V } : n.current = null;
1969
+ K ? n.current = { elementId: d.id, childId: Ke, editRichText: V, clonedElement: K } : n.current = null;
1970
1970
  }
1971
1971
  if (n.current) {
1972
- const { clonedElement: V } = n.current;
1972
+ const { clonedElement: K } = n.current;
1973
1973
  Nt = Nt.map(
1974
- (ue) => ue.id === d.id ? V : ue
1974
+ (ue) => ue.id === d.id ? K : ue
1975
1975
  );
1976
1976
  }
1977
1977
  } else
@@ -2016,20 +2016,20 @@ function hi(e, t, n) {
2016
2016
  suppressOverflowDim: !1,
2017
2017
  showRotationHandle: g,
2018
2018
  editModeData: w ? (() => {
2019
- const Ve = xe.current, Ue = Date.now() - ie.current < be, Ae = Ve && Ue;
2019
+ const Ke = xe.current, Ue = Date.now() - ie.current < be, Ae = Ke && Ue;
2020
2020
  return {
2021
- cursorPosition: Ae ? Ve.cursor : O,
2022
- selectionStart: Ae ? Ve.start : u,
2023
- selectionEnd: Ae ? Ve.end : q,
2021
+ cursorPosition: Ae ? Ke.cursor : O,
2022
+ selectionStart: Ae ? Ke.start : u,
2023
+ selectionEnd: Ae ? Ke.end : q,
2024
2024
  editText: ne,
2025
- editRichText: K,
2025
+ editRichText: V,
2026
2026
  cursorOpacity: U.current,
2027
2027
  isTouchDevice: le,
2028
- selectionHandlePositionsRef: L
2028
+ selectionHandlePositionsRef: H
2029
2029
  };
2030
2030
  })() : void 0
2031
2031
  }), Ee && Ee.pieces.length > 0 && $) {
2032
- let Ve = !1;
2032
+ let Ke = !1;
2033
2033
  const Ue = gt ?? null;
2034
2034
  if (Ue && Ee) {
2035
2035
  const ue = Ue.getVisualBoundingBox();
@@ -2039,19 +2039,19 @@ function hi(e, t, n) {
2039
2039
  if (Je.kind !== "dieCut") continue;
2040
2040
  const Ge = Je.path;
2041
2041
  if (Ge.kind !== "rect" && Ge.kind !== "roundedRect") {
2042
- Ve = !0;
2042
+ Ke = !0;
2043
2043
  break e;
2044
2044
  }
2045
2045
  const Fe = me.x + (Ge.x ?? 0), nt = me.y + (Ge.y ?? 0), st = Ge.width ?? 0, xt = Ge.height ?? 0;
2046
2046
  if (ue.x < Fe + st && ue.x + ue.width > Fe && ue.y < nt + xt && ue.y + ue.height > nt) {
2047
- Ve = !0;
2047
+ Ke = !0;
2048
2048
  break e;
2049
2049
  }
2050
2050
  }
2051
2051
  }
2052
2052
  }
2053
- const Ae = Ve, V = Ze > 0 && $ !== void 0;
2054
- if (V && (se.save(), se.beginPath(), se.roundRect(
2053
+ const Ae = Ke, K = Ze > 0 && $ !== void 0;
2054
+ if (K && (se.save(), se.beginPath(), se.roundRect(
2055
2055
  $.x,
2056
2056
  $.y,
2057
2057
  $.width,
@@ -2069,7 +2069,7 @@ function hi(e, t, n) {
2069
2069
  zoom: A,
2070
2070
  interacting: Ae,
2071
2071
  focusedPieceId: e.focusedPieceId ?? null
2072
- }), V && se.restore(), e.focusedPieceId && Ee.pieces.length > 1) {
2072
+ }), K && se.restore(), e.focusedPieceId && Ee.pieces.length > 1) {
2073
2073
  const ue = e.focusedPieceRect ?? Ee.pieces.find((me) => me.id === e.focusedPieceId) ?? null;
2074
2074
  if (ue) {
2075
2075
  se.save(), se.translate($.x, $.y), se.globalCompositeOperation = "destination-out";
@@ -2115,7 +2115,7 @@ function hi(e, t, n) {
2115
2115
  zoom: A,
2116
2116
  paddingOffset: { x: R, y: E }
2117
2117
  });
2118
- const tn = pt ? zt : De, Yt = new Set(Nt.map((Ve) => Ve.id)), { updatedOBB: wt, groupBounds: Xt } = ri({
2118
+ const tn = pt ? zt : De, Yt = new Set(Nt.map((Ke) => Ke.id)), { updatedOBB: wt, groupBounds: Xt } = ri({
2119
2119
  ctx: se,
2120
2120
  displaySelection: tn,
2121
2121
  elements: o,
@@ -2270,17 +2270,17 @@ function xi(e) {
2270
2270
  function yi(e) {
2271
2271
  const { selectedElement: t, activeChildElement: n } = e;
2272
2272
  let s = null, o = -1;
2273
- if (n instanceof Ht && n.isCropping)
2273
+ if (n instanceof Lt && n.isCropping)
2274
2274
  s = n, t instanceof Re && (o = t.children.findIndex((a) => a.id === n.id));
2275
2275
  else if (t instanceof Re)
2276
2276
  for (let a = 0; a < t.children.length; a++) {
2277
2277
  const l = t.children[a];
2278
- if (l.visible !== !1 && l instanceof Ht && l.isCropping) {
2278
+ if (l.visible !== !1 && l instanceof Lt && l.isCropping) {
2279
2279
  s = l, o = a;
2280
2280
  break;
2281
2281
  }
2282
2282
  }
2283
- const i = s || (t instanceof Ht && t.isCropping ? t : null);
2283
+ const i = s || (t instanceof Lt && t.isCropping ? t : null);
2284
2284
  return i ? {
2285
2285
  croppingImage: i,
2286
2286
  croppingChild: s,
@@ -2471,14 +2471,14 @@ function Mi(e) {
2471
2471
  selectionStart: D,
2472
2472
  selectionEnd: w,
2473
2473
  isRotating: ne,
2474
- isMarqueeSelecting: K,
2474
+ isMarqueeSelecting: V,
2475
2475
  isAltKeyPressed: O,
2476
2476
  selectedElement: u,
2477
2477
  activeChildElement: q,
2478
2478
  elements: U,
2479
2479
  multiSelection: te,
2480
2480
  multiSelectionOBBRef: le,
2481
- zoom: L,
2481
+ zoom: H,
2482
2482
  paddingOffsetX: xe,
2483
2483
  paddingOffsetY: ie,
2484
2484
  spacingIndicators: be,
@@ -2504,7 +2504,7 @@ function Mi(e) {
2504
2504
  penTool: _,
2505
2505
  cropController: Ce,
2506
2506
  onElementUpdate: Ie,
2507
- executeElementUpdate: Ke,
2507
+ executeElementUpdate: Ve,
2508
2508
  onSelectionChange: Xe,
2509
2509
  onMultiSelectionChange: Y,
2510
2510
  onRotationStateChange: $,
@@ -2521,9 +2521,9 @@ function Mi(e) {
2521
2521
  setEditRichText: rn,
2522
2522
  setIsEditing: on,
2523
2523
  setCurrentFormattingStyle: Ut,
2524
- getWrappedTextForEditing: Ve
2525
- } = e, Ue = we(null), Ae = we(/* @__PURE__ */ new Map()), V = we(null), ue = we(null), me = we(null), Be = we(null), Je = we(null), Ge = we(null), Fe = we(null), { userZoom: nt, setUserZoom: st, panOffset: xt, setPanOffset: yt } = Ts(), Lt = we(nt);
2526
- Lt.current = nt;
2524
+ getWrappedTextForEditing: Ke
2525
+ } = e, Ue = we(null), Ae = we(/* @__PURE__ */ new Map()), K = we(null), ue = we(null), me = we(null), Be = we(null), Je = we(null), Ge = we(null), Fe = we(null), { userZoom: nt, setUserZoom: st, panOffset: xt, setPanOffset: yt } = Ts(), Ht = we(nt);
2526
+ Ht.current = nt;
2527
2527
  const ve = we(xt);
2528
2528
  ve.current = xt, Pe(() => {
2529
2529
  const z = t.current;
@@ -2537,7 +2537,7 @@ function Mi(e) {
2537
2537
  }, [t]), Pe(() => {
2538
2538
  const z = t.current;
2539
2539
  z && (Ue.current = z.getBoundingClientRect());
2540
- }, [L, t]);
2540
+ }, [H, t]);
2541
2541
  const as = ft(
2542
2542
  (z) => {
2543
2543
  var j, pe, ke, ee, J;
@@ -2546,14 +2546,14 @@ function Mi(e) {
2546
2546
  if (!fe) return;
2547
2547
  const dt = fe.getBoundingClientRect();
2548
2548
  Ue.current = dt;
2549
- const W = (z.clientX - dt.left) / L - xe, Z = (z.clientY - dt.top) / L - ie;
2549
+ const W = (z.clientX - dt.left) / H - xe, Z = (z.clientY - dt.top) / H - ie;
2550
2550
  Ae.current.size === 0 && (me.current = (u == null ? void 0 : u.id) ?? null), Ae.current.set(z.pointerId, {
2551
2551
  x: W,
2552
2552
  y: Z,
2553
2553
  clientX: z.clientX,
2554
2554
  clientY: z.clientY
2555
2555
  });
2556
- const et = g || u instanceof Ht && u.isCropping || _.isActive();
2556
+ const et = g || u instanceof Lt && u.isCropping || _.isActive();
2557
2557
  if (Ae.current.size === 2 && !et) {
2558
2558
  const k = Array.from(Ae.current.keys()), X = Ae.current.get(k[0]), M = Ae.current.get(k[1]), F = me.current !== null;
2559
2559
  if (!(F && u && !u.locked && (u.hitTest(X.x, X.y) || u.hitTest(M.x, M.y)))) {
@@ -2567,17 +2567,17 @@ function Mi(e) {
2567
2567
  ), b.current = null;
2568
2568
  }
2569
2569
  !F && u && Xe(null), h.isInteracting() && h.end(), Fe.current = null, Be.current = null, Je.current = null, delete h._pendingTextEditMode, delete h._pendingChildSelection;
2570
- const oe = M.clientX - X.clientX, Me = M.clientY - X.clientY, He = Math.hypot(oe, Me), bt = (((j = fe.parentElement) == null ? void 0 : j.parentElement) ?? fe).getBoundingClientRect();
2570
+ const oe = M.clientX - X.clientX, Me = M.clientY - X.clientY, Le = Math.hypot(oe, Me), bt = (((j = fe.parentElement) == null ? void 0 : j.parentElement) ?? fe).getBoundingClientRect();
2571
2571
  Ge.current = {
2572
2572
  pointerA: k[0],
2573
2573
  pointerB: k[1],
2574
- startUserZoom: Lt.current,
2574
+ startUserZoom: Ht.current,
2575
2575
  startPanOffset: { ...ve.current },
2576
2576
  startCentroidClient: {
2577
2577
  x: (X.clientX + M.clientX) / 2,
2578
2578
  y: (X.clientY + M.clientY) / 2
2579
2579
  },
2580
- startDistance: Math.max(He, 1),
2580
+ startDistance: Math.max(Le, 1),
2581
2581
  containerRect: { left: bt.left, top: bt.top }
2582
2582
  };
2583
2583
  try {
@@ -2595,12 +2595,12 @@ function Mi(e) {
2595
2595
  const ae = gt().find(
2596
2596
  (oe) => oe.id === F.element.id
2597
2597
  );
2598
- Ke(ae, F.element);
2598
+ Ve(ae, F.element);
2599
2599
  }
2600
2600
  h.end();
2601
2601
  }
2602
2602
  const k = Array.from(Ae.current.keys());
2603
- V.current = { a: k[0], b: k[1] };
2603
+ K.current = { a: k[0], b: k[1] };
2604
2604
  const X = Ae.current.get(k[0]), M = Ae.current.get(k[1]);
2605
2605
  Be.current = null, Je.current = null, Fe.current = null, ue.current = u.clone(), h.startPinch(u, X, M);
2606
2606
  try {
@@ -2614,7 +2614,7 @@ function Mi(e) {
2614
2614
  if (N && D !== w) {
2615
2615
  const k = m.current;
2616
2616
  if (k.start || k.end) {
2617
- const X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x, ae = Z - M.y, oe = Math.cos(X), Me = Math.sin(X), He = F * oe - ae * Me, it = F * Me + ae * oe, bt = He, Bt = it, St = 44 / L;
2617
+ const X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x, ae = Z - M.y, oe = Math.cos(X), Me = Math.sin(X), Le = F * oe - ae * Me, it = F * Me + ae * oe, bt = Le, Bt = it, St = 44 / H;
2618
2618
  if (k.start && Math.sqrt(
2619
2619
  Math.pow(bt - k.start.center.x, 2) + Math.pow(Bt - k.start.center.y, 2)
2620
2620
  ) <= St) {
@@ -2631,7 +2631,7 @@ function Mi(e) {
2631
2631
  }
2632
2632
  if (u.hitTest(W, Z)) {
2633
2633
  z.preventDefault(), s.current = !0;
2634
- const k = u.getVisualBoundingBox(), X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x, ae = Z - M.y, oe = Math.cos(X), Me = Math.sin(X), He = F * oe - ae * Me, it = F * Me + ae * oe, bt = He + k.width / 2, Bt = it + k.height / 2, St = Sn(u, { x: bt, y: Bt }), Et = Date.now();
2634
+ const k = u.getVisualBoundingBox(), X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x, ae = Z - M.y, oe = Math.cos(X), Me = Math.sin(X), Le = F * oe - ae * Me, it = F * Me + ae * oe, bt = Le + k.width / 2, Bt = it + k.height / 2, St = Sn(u, { x: bt, y: Bt }), Et = Date.now();
2635
2635
  if (Et - a.current < I) {
2636
2636
  (ee = n.current) == null || ee.focus();
2637
2637
  return;
@@ -2662,7 +2662,7 @@ function Mi(e) {
2662
2662
  return;
2663
2663
  }
2664
2664
  if (te.length > 0 && E.current) {
2665
- const k = E.current, X = pi({ x: W, y: Z, bounds: k, zoom: L });
2665
+ const k = E.current, X = pi({ x: W, y: Z, bounds: k, zoom: H });
2666
2666
  if (X.type === "corner-handle") {
2667
2667
  if (mi({
2668
2668
  multiSelection: te,
@@ -2709,7 +2709,7 @@ function Mi(e) {
2709
2709
  if (B && B.visible !== !1 && !B.locked && (te.length === 0 || q)) {
2710
2710
  const k = yi({ selectedElement: u || null, activeChildElement: q });
2711
2711
  if (k) {
2712
- const M = bi({ x: W, y: Z, cropContext: k, transformHandles: G, zoom: L });
2712
+ const M = bi({ x: W, y: Z, cropContext: k, transformHandles: G, zoom: H });
2713
2713
  if (M.type === "crop-handle") {
2714
2714
  vi({
2715
2715
  cropContext: k,
@@ -2751,12 +2751,12 @@ function Mi(e) {
2751
2751
  onElementUpdate: Ie,
2752
2752
  transformHandles: G,
2753
2753
  updateActiveChild: Ze,
2754
- zoom: L
2754
+ zoom: H
2755
2755
  }), We((F) => F + 1);
2756
2756
  return;
2757
2757
  }
2758
2758
  }
2759
- if (G.hitTestRotation(W, Z, L)) {
2759
+ if (G.hitTestRotation(W, Z, H)) {
2760
2760
  if (B.locked) return;
2761
2761
  const M = B.getBoundingBox(), F = Es(M), ae = lr(F.x, F.y, W, Z);
2762
2762
  $e(!0), at(ae), pt(B.rotation), h.startRotate(B, W, Z, ae, B.rotation), q && u instanceof Re && (h._activeChildContext = {
@@ -2765,7 +2765,7 @@ function Mi(e) {
2765
2765
  }), Be.current = B.id, Je.current = { x: W, y: Z }, se({});
2766
2766
  return;
2767
2767
  }
2768
- const X = G.hitTestResize(W, Z, L);
2768
+ const X = G.hitTestResize(W, Z, H);
2769
2769
  if (X) {
2770
2770
  if (B.locked) return;
2771
2771
  const M = B.getBoundingBox(), F = B.getVisualBoundingBox();
@@ -2807,13 +2807,13 @@ function Mi(e) {
2807
2807
  dragOriginalElementsRef: b,
2808
2808
  setHoverState: Ee,
2809
2809
  forceUpdate: se,
2810
- zoom: L
2810
+ zoom: H
2811
2811
  })) return;
2812
- Zs({ updateActiveChild: Ze, selectedElement: u || null, transformHandles: G, setHandlesVersion: We, zoom: L });
2812
+ Zs({ updateActiveChild: Ze, selectedElement: u || null, transformHandles: G, setHandlesVersion: We, zoom: H });
2813
2813
  return;
2814
2814
  }
2815
2815
  if (q) {
2816
- Zs({ updateActiveChild: Ze, selectedElement: u || null, transformHandles: G, setHandlesVersion: We, zoom: L });
2816
+ Zs({ updateActiveChild: Ze, selectedElement: u || null, transformHandles: G, setHandlesVersion: We, zoom: H });
2817
2817
  return;
2818
2818
  }
2819
2819
  if (!z.shiftKey) {
@@ -2871,9 +2871,9 @@ function Mi(e) {
2871
2871
  setHoverState: Ee,
2872
2872
  forceUpdate: se
2873
2873
  })) return;
2874
- const H = zr.shouldProtectClick(), Q = Dr(z.target);
2875
- if (!H && !Q)
2876
- if (Lt.current > 1.001) {
2874
+ const L = zr.shouldProtectClick(), Q = Dr(z.target);
2875
+ if (!L && !Q)
2876
+ if (Ht.current > 1.001) {
2877
2877
  Fe.current = {
2878
2878
  pointerId: z.pointerId,
2879
2879
  startClientX: z.clientX,
@@ -2901,9 +2901,9 @@ function Mi(e) {
2901
2901
  te,
2902
2902
  h,
2903
2903
  _,
2904
- Ke,
2904
+ Ve,
2905
2905
  We,
2906
- L,
2906
+ H,
2907
2907
  Te,
2908
2908
  Oe,
2909
2909
  De,
@@ -2918,7 +2918,7 @@ function Mi(e) {
2918
2918
  if (z.buttons === 2) return;
2919
2919
  const fe = t.current;
2920
2920
  if (!fe) return;
2921
- const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) / L - xe, Z = (z.clientY - dt.top) / L - ie;
2921
+ const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) / H - xe, Z = (z.clientY - dt.top) / H - ie;
2922
2922
  if (p.current = { x: W, y: Z }, Ae.current.has(z.pointerId) && Ae.current.set(z.pointerId, {
2923
2923
  x: W,
2924
2924
  y: Z,
@@ -2927,12 +2927,12 @@ function Mi(e) {
2927
2927
  }), Ge.current) {
2928
2928
  const B = Ge.current, ge = Ae.current.get(B.pointerA), S = Ae.current.get(B.pointerB);
2929
2929
  if (ge && S) {
2930
- const H = S.clientX - ge.clientX, Q = S.clientY - ge.clientY, pe = Math.hypot(H, Q) / B.startDistance, ke = Math.min(
2930
+ const L = S.clientX - ge.clientX, Q = S.clientY - ge.clientY, pe = Math.hypot(L, Q) / B.startDistance, ke = Math.min(
2931
2931
  Math.max(B.startUserZoom * pe, 0.25),
2932
2932
  8
2933
2933
  ), ee = B.startCentroidClient.x - B.containerRect.left, J = B.startCentroidClient.y - B.containerRect.top, k = (ge.clientX + S.clientX) / 2 - B.containerRect.left, X = (ge.clientY + S.clientY) / 2 - B.containerRect.top, M = ke / B.startUserZoom, F = k - (ee - B.startPanOffset.x) * M, ae = X - (J - B.startPanOffset.y) * M, oe = t.current;
2934
2934
  if (oe) {
2935
- const Me = oe.getBoundingClientRect(), He = (et = oe.parentElement) == null ? void 0 : et.parentElement, it = (He == null ? void 0 : He.clientWidth) ?? Me.width, bt = (He == null ? void 0 : He.clientHeight) ?? Me.height, Bt = 80, St = ke / Math.max(Lt.current, 1e-4), Et = Me.width * St, Gt = Me.height * St, ut = ve.current.x, kt = ve.current.y, kn = Me.left - B.containerRect.left, Ft = Me.top - B.containerRect.top, qt = kn + (F - ut), jt = Ft + (ae - kt), _t = Math.min(
2935
+ const Me = oe.getBoundingClientRect(), Le = (et = oe.parentElement) == null ? void 0 : et.parentElement, it = (Le == null ? void 0 : Le.clientWidth) ?? Me.width, bt = (Le == null ? void 0 : Le.clientHeight) ?? Me.height, Bt = 80, St = ke / Math.max(Ht.current, 1e-4), Et = Me.width * St, Gt = Me.height * St, ut = ve.current.x, kt = ve.current.y, kn = Me.left - B.containerRect.left, Ft = Me.top - B.containerRect.top, qt = kn + (F - ut), jt = Ft + (ae - kt), _t = Math.min(
2936
2936
  Math.max(qt, -Et + Bt),
2937
2937
  it - Bt
2938
2938
  ), $t = Math.min(
@@ -2955,17 +2955,17 @@ function Mi(e) {
2955
2955
  B.movedPastThreshold = !0, B.pendingTap = null;
2956
2956
  else
2957
2957
  return;
2958
- if (Lt.current <= 1.001) return;
2958
+ if (Ht.current <= 1.001) return;
2959
2959
  yt({
2960
2960
  x: B.startPanOffset.x + ge,
2961
2961
  y: B.startPanOffset.y + S
2962
2962
  });
2963
2963
  return;
2964
2964
  }
2965
- if (h.getMode() === "pinch" && V.current) {
2966
- const { a: B, b: ge } = V.current, S = Ae.current.get(B), H = Ae.current.get(ge);
2967
- if (S && H) {
2968
- const Q = h.updatePinch(S, H), { element: j, startData: pe } = h.getPinchContext();
2965
+ if (h.getMode() === "pinch" && K.current) {
2966
+ const { a: B, b: ge } = K.current, S = Ae.current.get(B), L = Ae.current.get(ge);
2967
+ if (S && L) {
2968
+ const Q = h.updatePinch(S, L), { element: j, startData: pe } = h.getPinchContext();
2969
2969
  fi.calculatePinch({
2970
2970
  element: j,
2971
2971
  startData: pe,
@@ -2984,7 +2984,7 @@ function Mi(e) {
2984
2984
  return;
2985
2985
  }
2986
2986
  if (d.current && u instanceof Qe) {
2987
- const B = u.getVisualBoundingBox(), ge = u.getRotationAnchor(), S = en.toRadiansInverse(u.rotation), H = W - ge.x, Q = Z - ge.y, j = Math.cos(S), pe = Math.sin(S), ke = H * j - Q * pe, ee = H * pe + Q * j, J = m.current;
2987
+ const B = u.getVisualBoundingBox(), ge = u.getRotationAnchor(), S = en.toRadiansInverse(u.rotation), L = W - ge.x, Q = Z - ge.y, j = Math.cos(S), pe = Math.sin(S), ke = L * j - Q * pe, ee = L * pe + Q * j, J = m.current;
2988
2988
  let k = 0;
2989
2989
  d.current === "start" && (J != null && J.start) ? k = J.start.textEdge.y - J.start.center.y : d.current === "end" && (J != null && J.end) && (k = J.end.textEdge.y - J.end.center.y);
2990
2990
  const X = ke + B.width / 2, M = ee + k + B.height / 2, F = Sn(u, { x: X, y: M });
@@ -2998,59 +2998,59 @@ function Mi(e) {
2998
2998
  _.isDraggingHandle() ? (_.updateHandle(W - u.x, Z - u.y), We((B) => B + 1)) : (_.setPreviewPoint(W - u.x, Z - u.y), We((B) => B + 1));
2999
2999
  return;
3000
3000
  }
3001
- if (z.altKey !== O && Pt(z.altKey), K) {
3001
+ if (z.altKey !== O && Pt(z.altKey), V) {
3002
3002
  Dt(W, Z, U);
3003
3003
  return;
3004
3004
  }
3005
3005
  if (h.getMode() === "drag") {
3006
3006
  const B = h._multiSelectionDragContext;
3007
3007
  if (B && te.length > 0) {
3008
- const { dx: ge, dy: S } = Ks(
3008
+ const { dx: ge, dy: S } = Vs(
3009
3009
  W - B.startX,
3010
3010
  Z - B.startY,
3011
3011
  { shift: z.shiftKey }
3012
3012
  );
3013
3013
  B.currentElements || (B.currentElements = /* @__PURE__ */ new Map());
3014
- const H = [];
3014
+ const L = [];
3015
3015
  B.elementsStartData.forEach((Q) => {
3016
3016
  const j = Q.element, pe = Q.startData, ke = j.clone();
3017
- ke.x = pe.x + ge, ke.y = pe.y + S, B.currentElements.set(ke.id, ke), H.push(ke);
3018
- }), lt((Q) => Q.map((j) => H.find((pe) => pe.id === j.id) || j)), B.currentDelta = { dx: ge, dy: S }, !B.startOBB && le.current && (B.startOBB = { ...le.current }), We((Q) => Q + 1), se({});
3017
+ ke.x = pe.x + ge, ke.y = pe.y + S, B.currentElements.set(ke.id, ke), L.push(ke);
3018
+ }), lt((Q) => Q.map((j) => L.find((pe) => pe.id === j.id) || j)), B.currentDelta = { dx: ge, dy: S }, !B.startOBB && le.current && (B.startOBB = { ...le.current }), We((Q) => Q + 1), se({});
3019
3019
  return;
3020
3020
  }
3021
3021
  }
3022
3022
  if (h.getMode() === "drag" && u) {
3023
3023
  if (h.getDragMode() === "crop-image-drag") {
3024
3024
  const ee = h.getContext(), J = ee.element;
3025
- if (J instanceof Ht && J.isCropping) {
3025
+ if (J instanceof Lt && J.isCropping) {
3026
3026
  const k = Ce.handleCropImageDrag(J, ee, W, Z), X = h._cropGroupContext, M = h._activeChildContext, F = X || M;
3027
3027
  if (F && u instanceof Re) {
3028
3028
  const ae = J.clone();
3029
3029
  ae.x = k.x, ae.y = k.y, ae.updateCrop(k.cropX, k.cropY, k.cropWidth, k.cropHeight, !1);
3030
3030
  const oe = u.clone(), Me = X ? X.childIndex : oe.children.findIndex((it) => it.id === F.childId);
3031
3031
  Me >= 0 && (oe.children[Me] = ae, oe.updateBoundsFromChildren(!0)), lt((it) => it.map((bt) => bt.id === oe.id ? oe : bt));
3032
- const He = h.getContext();
3033
- He._cachedElement || (He._cachedElement = {}), He._cachedElement[oe.id] = oe, M && Me >= 0 && (Ze(oe.children[Me]), G.update(ae, L)), We((it) => it + 1);
3032
+ const Le = h.getContext();
3033
+ Le._cachedElement || (Le._cachedElement = {}), Le._cachedElement[oe.id] = oe, M && Me >= 0 && (Ze(oe.children[Me]), G.update(ae, H)), We((it) => it + 1);
3034
3034
  } else {
3035
3035
  const ae = J.clone();
3036
3036
  ae.x = k.x, ae.y = k.y, ae.updateCrop(k.cropX, k.cropY, k.cropWidth, k.cropHeight, !1), lt(
3037
- (Me) => Me.map((He) => He.id === ae.id ? ae : He)
3037
+ (Me) => Me.map((Le) => Le.id === ae.id ? ae : Le)
3038
3038
  );
3039
3039
  const oe = h.getContext();
3040
- oe._cachedElement || (oe._cachedElement = {}), oe._cachedElement[ae.id] = ae, G.update(ae, L), We((Me) => Me + 1);
3040
+ oe._cachedElement || (oe._cachedElement = {}), oe._cachedElement[ae.id] = ae, G.update(ae, H), We((Me) => Me + 1);
3041
3041
  }
3042
3042
  return;
3043
3043
  }
3044
3044
  }
3045
- const ge = h._activeChildContext, S = gt(), H = [];
3045
+ const ge = h._activeChildContext, S = gt(), L = [];
3046
3046
  S.forEach((ee) => {
3047
- ee instanceof Re ? H.push(...ee.children) : H.push(ee);
3047
+ ee instanceof Re ? L.push(...ee.children) : L.push(ee);
3048
3048
  });
3049
3049
  const Q = { shift: z.shiftKey };
3050
- let j = h.updateDrag(W, Z, H, Q);
3050
+ let j = h.updateDrag(W, Z, L, Q);
3051
3051
  const pe = ge && u instanceof Re ? u.children.find((ee) => ee.id === ge.childId) : u;
3052
- if (pe && (j = he.snapToSpacing(j, pe, H), Q.shift)) {
3053
- const ee = h.getContext(), J = ee.startData, { lockedAxis: k } = Ks(W - ee.startX, Z - ee.startY, Q);
3052
+ if (pe && (j = he.snapToSpacing(j, pe, L), Q.shift)) {
3053
+ const ee = h.getContext(), J = ee.startData, { lockedAxis: k } = Vs(W - ee.startX, Z - ee.startY, Q);
3054
3054
  k === "x" ? j.x = J.x : k === "y" && (j.y = J.y);
3055
3055
  }
3056
3056
  if (ge && u instanceof Re) {
@@ -3063,7 +3063,7 @@ function Mi(e) {
3063
3063
  const k = h.getContext();
3064
3064
  if (k._cachedElement || (k._cachedElement = {}), k._cachedElement[ee.id] = ee, J >= 0) {
3065
3065
  const X = ee.children[J];
3066
- Ze(X), G.update(X, L);
3066
+ Ze(X), G.update(X, H);
3067
3067
  }
3068
3068
  We((X) => X + 1), se({});
3069
3069
  } else {
@@ -3073,7 +3073,7 @@ function Mi(e) {
3073
3073
  J.move(F, ae);
3074
3074
  } else
3075
3075
  J.x = j.x, J.y = j.y;
3076
- lt((X) => X.map((M) => M.id === J.id ? J : M)), G.update(J, L);
3076
+ lt((X) => X.map((M) => M.id === J.id ? J : M)), G.update(J, H);
3077
3077
  const k = h.getContext();
3078
3078
  k._cachedElement || (k._cachedElement = {}), k._cachedElement[J.id] = J;
3079
3079
  }
@@ -3086,13 +3086,13 @@ function Mi(e) {
3086
3086
  ee._cachedElement && u ? ke = ee._cachedElement[u.id] : ke = u || void 0;
3087
3087
  }
3088
3088
  if (ke) {
3089
- const ee = he.detectSpacing(ke, H, O);
3089
+ const ee = he.detectSpacing(ke, L, O);
3090
3090
  At(ee);
3091
3091
  }
3092
3092
  } else if (h.getMode() === "resize") {
3093
- const { dx: B, dy: ge } = h.updateResize(W, Z), S = h.getResizeContext(), H = h._multiSelectionResizeContext;
3094
- if (H && te.length > 0) {
3095
- const k = H.startBounds, X = H.anchor;
3093
+ const { dx: B, dy: ge } = h.updateResize(W, Z), S = h.getResizeContext(), L = h._multiSelectionResizeContext;
3094
+ if (L && te.length > 0) {
3095
+ const k = L.startBounds, X = L.anchor;
3096
3096
  let M, F, ae, oe;
3097
3097
  switch (X) {
3098
3098
  case "top-left":
@@ -3110,7 +3110,7 @@ function Mi(e) {
3110
3110
  default:
3111
3111
  M = k.minX, F = k.minY, ae = k.maxX, oe = k.maxY;
3112
3112
  }
3113
- const Me = ae + B, He = oe + ge, it = Math.abs(ae - M), bt = Math.abs(oe - F), Bt = Math.abs(Me - M), St = Math.abs(He - F), Et = it > 0 ? Bt / it : 1, Gt = bt > 0 ? St / bt : 1, ut = (Et + Gt) / 2, kt = k.maxX - k.minX, kn = k.maxY - k.minY, Ft = kt * ut, qt = kn * ut;
3113
+ const Me = ae + B, Le = oe + ge, it = Math.abs(ae - M), bt = Math.abs(oe - F), Bt = Math.abs(Me - M), St = Math.abs(Le - F), Et = it > 0 ? Bt / it : 1, Gt = bt > 0 ? St / bt : 1, ut = (Et + Gt) / 2, kt = k.maxX - k.minX, kn = k.maxY - k.minY, Ft = kt * ut, qt = kn * ut;
3114
3114
  let jt = M, _t = F, $t = M, an = F;
3115
3115
  switch (X) {
3116
3116
  case "top-left":
@@ -3126,26 +3126,26 @@ function Mi(e) {
3126
3126
  jt = M, _t = F, $t = M + Ft, an = F + qt;
3127
3127
  break;
3128
3128
  }
3129
- if (H.elementsStartData.forEach((Hn) => {
3130
- const Kn = Hn.element, nn = Hn.startData, ls = nn.x - M, ds = nn.y - F, Vn = M + ls * ut, Un = F + ds * ut, Wt = Kn.clone();
3131
- if (Wt instanceof Ht) {
3132
- Wt.x = Vn, Wt.y = Un;
3129
+ if (L.elementsStartData.forEach((Ln) => {
3130
+ const Vn = Ln.element, nn = Ln.startData, ls = nn.x - M, ds = nn.y - F, Kn = M + ls * ut, Un = F + ds * ut, Wt = Vn.clone();
3131
+ if (Wt instanceof Lt) {
3132
+ Wt.x = Kn, Wt.y = Un;
3133
3133
  const Rn = Wt.transformData, yn = nn.transformData;
3134
3134
  Rn.width = yn.width * ut, Rn.height = yn.height * ut;
3135
3135
  } else if (Wt instanceof Re) {
3136
- Wt.x = Vn, Wt.y = Un;
3136
+ Wt.x = Kn, Wt.y = Un;
3137
3137
  const Rn = nn.width * ut, yn = nn.height * ut;
3138
3138
  Wt.resize(X, Rn, yn, nn);
3139
3139
  } else {
3140
3140
  const Rn = nn.width * ut, yn = nn.height * ut;
3141
- Wt.resize(X, Rn, yn, nn), Wt.x = Vn, Wt.y = Un;
3141
+ Wt.resize(X, Rn, yn, nn), Wt.x = Kn, Wt.y = Un;
3142
3142
  }
3143
3143
  Ie(Wt);
3144
3144
  }), le.current) {
3145
- const Hn = (jt + $t) / 2, Kn = (_t + an) / 2;
3145
+ const Ln = (jt + $t) / 2, Vn = (_t + an) / 2;
3146
3146
  le.current = {
3147
- centerX: Hn,
3148
- centerY: Kn,
3147
+ centerX: Ln,
3148
+ centerY: Vn,
3149
3149
  width: $t - jt,
3150
3150
  height: an - _t,
3151
3151
  rotation: le.current.rotation
@@ -3154,15 +3154,15 @@ function Mi(e) {
3154
3154
  return;
3155
3155
  }
3156
3156
  const Q = S.element;
3157
- if (Q instanceof Ht && Q.isCropping && S.handle.anchor && S.handle.anchor.startsWith("crop-")) {
3157
+ if (Q instanceof Lt && Q.isCropping && S.handle.anchor && S.handle.anchor.startsWith("crop-")) {
3158
3158
  const k = S.handle.anchor.replace("crop-", ""), X = h.getContext(), M = Ce.handleCropBoxResize(Q, k, S, X, W, Z);
3159
3159
  fe.style.cursor = M.cursor;
3160
3160
  const F = h._cropGroupContext, ae = h._activeChildContext, oe = F || ae;
3161
3161
  if (oe && u instanceof Re) {
3162
3162
  const Me = Q.clone();
3163
3163
  Me.x = M.x, Me.y = M.y, Me.rotation = M.rotation, Me.transformData.width = M.width, Me.transformData.height = M.height, Me.updateCrop(M.cropX, M.cropY, M.cropWidth, M.cropHeight, !1);
3164
- const He = u.clone(), it = F ? F.childIndex : He.children.findIndex((bt) => bt.id === oe.childId);
3165
- it >= 0 && (He.children[it] = Me, He.updateBoundsFromChildren(!0)), Ie(He), ae && it >= 0 && Ze(He.children[it]);
3164
+ const Le = u.clone(), it = F ? F.childIndex : Le.children.findIndex((bt) => bt.id === oe.childId);
3165
+ it >= 0 && (Le.children[it] = Me, Le.updateBoundsFromChildren(!0)), Ie(Le), ae && it >= 0 && Ze(Le.children[it]);
3166
3166
  } else {
3167
3167
  const Me = Q.clone();
3168
3168
  Me.x = M.x, Me.y = M.y, Me.rotation = M.rotation, Me.transformData.width = M.width, Me.transformData.height = M.height, Me.updateCrop(M.cropX, M.cropY, M.cropWidth, M.cropHeight, !1), Ie(Me);
@@ -3187,9 +3187,9 @@ function Mi(e) {
3187
3187
  }).element;
3188
3188
  if (h.updateResizeElement(J), pe) {
3189
3189
  const k = u.clone(), X = k.children.findIndex((M) => M.id === j.childId);
3190
- X >= 0 && (k.children[X] = J, k.updateBoundsFromChildren(!0)), Ie(k), X >= 0 && (Ze(k.children[X]), G.update(k.children[X], L));
3190
+ X >= 0 && (k.children[X] = J, k.updateBoundsFromChildren(!0)), Ie(k), X >= 0 && (Ze(k.children[X]), G.update(k.children[X], H));
3191
3191
  } else
3192
- Ie(J), G.update(J, L);
3192
+ Ie(J), G.update(J, H);
3193
3193
  We((k) => k + 1), zt(re.getGuides());
3194
3194
  } else if (h.getMode() === "rotate") {
3195
3195
  fe.style.cursor = "grabbing", ne || ($e(!0), $ == null || $(!0));
@@ -3210,20 +3210,20 @@ function Mi(e) {
3210
3210
  }
3211
3211
  const ge = h._activeChildContext, S = ge ? q : u;
3212
3212
  if (!S) return;
3213
- const H = S.getBoundingBox(), Q = Es(H), j = Q.x, pe = Q.y, ke = h.updateRotate(W, Z, Q.x, Q.y, { shift: z.shiftKey }), ee = S.clone();
3213
+ const L = S.getBoundingBox(), Q = Es(L), j = Q.x, pe = Q.y, ke = h.updateRotate(W, Z, Q.x, Q.y, { shift: z.shiftKey }), ee = S.clone();
3214
3214
  if (ee.setRotation(ke), !(ee instanceof Re)) {
3215
3215
  const J = ee.getBoundingBox(), k = Es(J), X = j - k.x, M = pe - k.y;
3216
3216
  ee.x += X, ee.y += M;
3217
3217
  }
3218
3218
  if (x.current = ee, pt(ee.rotation), ct((J) => J + 1), ge && u instanceof Re) {
3219
3219
  const J = u.clone(), k = J.children.findIndex((X) => X.id === ge.childId);
3220
- k >= 0 && (J.children[k] = ee, J.updateBoundsFromChildren(!0)), Ie(J), k >= 0 && (Ze(J.children[k]), G.update(J.children[k], L));
3220
+ k >= 0 && (J.children[k] = ee, J.updateBoundsFromChildren(!0)), Ie(J), k >= 0 && (Ze(J.children[k]), G.update(J.children[k], H));
3221
3221
  } else
3222
- Ie(ee), G.update(ee, L);
3222
+ Ie(ee), G.update(ee, H);
3223
3223
  We((J) => J + 1);
3224
3224
  } else {
3225
3225
  if (te.length > 0 && E.current) {
3226
- const S = E.current, H = 16 / L, Q = [
3226
+ const S = E.current, L = 16 / H, Q = [
3227
3227
  { x: S.minX, y: S.minY, anchor: "top-left", cursor: "nwse-resize" },
3228
3228
  { x: S.maxX, y: S.minY, anchor: "top-right", cursor: "nesw-resize" },
3229
3229
  { x: S.minX, y: S.maxY, anchor: "bottom-left", cursor: "nesw-resize" },
@@ -3242,12 +3242,12 @@ function Mi(e) {
3242
3242
  });
3243
3243
  for (const X of pe) {
3244
3244
  const M = W - X.x, F = Z - X.y;
3245
- if (Math.sqrt(M * M + F * F) <= H) {
3245
+ if (Math.sqrt(M * M + F * F) <= L) {
3246
3246
  fe.style.cursor = X.cursor, Ee({ type: "multi-selection-handle", data: X });
3247
3247
  return;
3248
3248
  }
3249
3249
  }
3250
- const ke = 18 / L;
3250
+ const ke = 18 / H;
3251
3251
  if (Math.sqrt(
3252
3252
  Math.pow(W - S.rotationHandleX, 2) + Math.pow(Z - S.rotationHandleY, 2)
3253
3253
  ) <= ke) {
@@ -3266,9 +3266,9 @@ function Mi(e) {
3266
3266
  }
3267
3267
  if (z.altKey) {
3268
3268
  let S = null;
3269
- const H = gt();
3270
- for (let Q = H.length - 1; Q >= 0; Q--) {
3271
- const j = H[Q];
3269
+ const L = gt();
3270
+ for (let Q = L.length - 1; Q >= 0; Q--) {
3271
+ const j = L[Q];
3272
3272
  if (j.visible !== !1) {
3273
3273
  if (j instanceof Re)
3274
3274
  for (let pe = j.children.length - 1; pe >= 0; pe--) {
@@ -3292,7 +3292,7 @@ function Mi(e) {
3292
3292
  }
3293
3293
  if (S) {
3294
3294
  const Q = [];
3295
- H.forEach((pe) => {
3295
+ L.forEach((pe) => {
3296
3296
  pe instanceof Re ? Q.push(...pe.children) : Q.push(pe);
3297
3297
  });
3298
3298
  const j = he.detectSpacing(S, Q, !0);
@@ -3303,8 +3303,8 @@ function Mi(e) {
3303
3303
  be.length > 0 && At([]);
3304
3304
  const B = q || u;
3305
3305
  if (B && B.visible !== !1)
3306
- if (B instanceof Ht && B.isCropping) {
3307
- const S = B.hitTestCropHandle(W, Z, L);
3306
+ if (B instanceof Lt && B.isCropping) {
3307
+ const S = B.hitTestCropHandle(W, Z, H);
3308
3308
  if (S) {
3309
3309
  const Q = eo(
3310
3310
  S.worldX,
@@ -3318,9 +3318,9 @@ function Mi(e) {
3318
3318
  fe.style.cursor = Q, Ee({ type: "crop-handle", data: S });
3319
3319
  return;
3320
3320
  }
3321
- const H = G.hitTestResize(W, Z, L);
3322
- if (H) {
3323
- fe.style.cursor = H.cursor, Ee({ type: "resize-handle", data: H });
3321
+ const L = G.hitTestResize(W, Z, H);
3322
+ if (L) {
3323
+ fe.style.cursor = L.cursor, Ee({ type: "resize-handle", data: L });
3324
3324
  return;
3325
3325
  }
3326
3326
  if (B.hitTest(W, Z)) {
@@ -3328,11 +3328,11 @@ function Mi(e) {
3328
3328
  return;
3329
3329
  }
3330
3330
  } else {
3331
- if (G.hitTestRotation(W, Z, L)) {
3331
+ if (G.hitTestRotation(W, Z, H)) {
3332
3332
  fe.style.cursor = "grab", Ee({ type: "rotation-handle", data: null });
3333
3333
  return;
3334
3334
  }
3335
- const S = G.hitTestResize(W, Z, L);
3335
+ const S = G.hitTestResize(W, Z, H);
3336
3336
  if (S) {
3337
3337
  fe.style.cursor = S.cursor, Ee({ type: "resize-handle", data: S });
3338
3338
  return;
@@ -3344,9 +3344,9 @@ function Mi(e) {
3344
3344
  }
3345
3345
  if (q && u instanceof Re)
3346
3346
  for (let S = u.children.length - 1; S >= 0; S--) {
3347
- const H = u.children[S];
3348
- if (!(H.visible === !1 || H.id === q.id) && H.hitTest(W, Z)) {
3349
- fe.style.cursor = "pointer", Ee({ type: "group-sibling", data: H });
3347
+ const L = u.children[S];
3348
+ if (!(L.visible === !1 || L.id === q.id) && L.hitTest(W, Z)) {
3349
+ fe.style.cursor = "pointer", Ee({ type: "group-sibling", data: L });
3350
3350
  return;
3351
3351
  }
3352
3352
  }
@@ -3367,14 +3367,14 @@ function Mi(e) {
3367
3367
  gt,
3368
3368
  Ie,
3369
3369
  G,
3370
- K,
3370
+ V,
3371
3371
  re,
3372
3372
  te,
3373
3373
  le,
3374
3374
  q,
3375
3375
  _,
3376
3376
  We,
3377
- L,
3377
+ H,
3378
3378
  xe,
3379
3379
  ie,
3380
3380
  Ee,
@@ -3398,54 +3398,54 @@ function Mi(e) {
3398
3398
  Fe.current = null, S.movedPastThreshold || (((W = S.pendingTap) == null ? void 0 : W.kind) === "select-element" ? (Xe(S.pendingTap.elementId), Y([])) : ((Z = S.pendingTap) == null ? void 0 : Z.kind) === "deselect" && (Xe(null), Y([])));
3399
3399
  return;
3400
3400
  }
3401
- if (h.getMode() === "pinch" && V.current) {
3402
- const { a: S, b: H } = V.current;
3403
- if (z.pointerId === S || z.pointerId === H) {
3401
+ if (h.getMode() === "pinch" && K.current) {
3402
+ const { a: S, b: L } = K.current;
3403
+ if (z.pointerId === S || z.pointerId === L) {
3404
3404
  const j = h.getContext().element, pe = ue.current ?? void 0;
3405
- j && Ke(
3405
+ j && Ve(
3406
3406
  pe,
3407
3407
  j
3408
- ), h.end(), V.current = null, ue.current = null, Ae.current.clear();
3408
+ ), h.end(), K.current = null, ue.current = null, Ae.current.clear();
3409
3409
  return;
3410
3410
  }
3411
3411
  }
3412
3412
  if (d.current && (d.current = null), _.isActive() && _.isDraggingHandle()) {
3413
3413
  const S = _.isClosingPath();
3414
3414
  if (_.finishDraggingHandle(), S && u instanceof wn) {
3415
- const H = u.clone();
3416
- Ke(u, H);
3415
+ const L = u.clone();
3416
+ Ve(u, L);
3417
3417
  }
3418
- We((H) => H + 1);
3418
+ We((L) => L + 1);
3419
3419
  return;
3420
3420
  }
3421
- if (K) {
3421
+ if (V) {
3422
3422
  tn(Y);
3423
3423
  return;
3424
3424
  }
3425
- b.current && h.getMode() === "drag" && (b.current.forEach((H, Q) => {
3425
+ b.current && h.getMode() === "drag" && (b.current.forEach((L, Q) => {
3426
3426
  const j = U.find((pe) => pe.id === Q);
3427
- j && (H.x !== j.x || H.y !== j.y || H instanceof Re && j instanceof Re && JSON.stringify(H.children.map((ke) => ({ x: ke.x, y: ke.y }))) !== JSON.stringify(j.children.map((ke) => ({ x: ke.x, y: ke.y })))) && Ke(H, j);
3427
+ j && (L.x !== j.x || L.y !== j.y || L instanceof Re && j instanceof Re && JSON.stringify(L.children.map((ke) => ({ x: ke.x, y: ke.y }))) !== JSON.stringify(j.children.map((ke) => ({ x: ke.x, y: ke.y })))) && Ve(L, j);
3428
3428
  }), b.current = null);
3429
3429
  const fe = t.current;
3430
3430
  if (fe && (fe.style.cursor = "default"), re.clearGuides(), re.clearSnapState(), zt([]), he.clearIndicators(), At([]), h._cropGroupContext && delete h._cropGroupContext, h._activeChildContext) {
3431
3431
  if (q && u instanceof Re) {
3432
3432
  const S = h.getContext(), j = (S._cachedElement && S._cachedElement[u.id] || u).children.find((pe) => pe.id === q.id);
3433
- j && (Ze(j), G.update(j, L));
3433
+ j && (Ze(j), G.update(j, H));
3434
3434
  }
3435
3435
  delete h._activeChildContext;
3436
3436
  }
3437
3437
  if (h._multiSelectionResizeContext && delete h._multiSelectionResizeContext, U.forEach((S) => {
3438
3438
  if (S instanceof to && S._lockedLineCount !== void 0) {
3439
- const H = S.clone();
3440
- H._lockedLineCount = void 0, Ie(H);
3439
+ const L = S.clone();
3440
+ L._lockedLineCount = void 0, Ie(L);
3441
3441
  }
3442
3442
  }), h._multiSelectionDragContext) {
3443
3443
  const S = h._multiSelectionDragContext;
3444
3444
  if (S.startOBB && S.currentDelta) {
3445
- const { dx: H, dy: Q } = S.currentDelta, j = S.startOBB;
3445
+ const { dx: L, dy: Q } = S.currentDelta, j = S.startOBB;
3446
3446
  le.current = {
3447
3447
  ...j,
3448
- centerX: j.centerX + H,
3448
+ centerX: j.centerX + L,
3449
3449
  centerY: j.centerY + Q
3450
3450
  };
3451
3451
  }
@@ -3464,27 +3464,27 @@ function Mi(e) {
3464
3464
  const dt = h.getContext();
3465
3465
  if (dt._cachedElement && delete dt._cachedElement, h._pendingChildSelection) {
3466
3466
  const S = h._pendingChildSelection;
3467
- let H = !0;
3467
+ let L = !0;
3468
3468
  if (u instanceof Re) {
3469
3469
  const Q = h._groupDragOriginalElement;
3470
- Q && (H = !(Math.abs(u.x - Q.x) > 0.1 || Math.abs(u.y - Q.y) > 0.1));
3470
+ Q && (L = !(Math.abs(u.x - Q.x) > 0.1 || Math.abs(u.y - Q.y) > 0.1));
3471
3471
  }
3472
- H && (Ze(S), G.update(S, L), We((Q) => Q + 1)), delete h._pendingChildSelection;
3472
+ L && (Ze(S), G.update(S, H), We((Q) => Q + 1)), delete h._pendingChildSelection;
3473
3473
  }
3474
3474
  if (h._pendingTextEditMode) {
3475
- const S = h._pendingTextEditMode, H = U.find((j) => j.id === S.elementId);
3476
- !(H && (Math.abs(H.x - S.originalX) > 0.1 || Math.abs(H.y - S.originalY) > 0.1)) && H instanceof Qe && !(H instanceof Ht) && !(H instanceof Qn) && Yt(H, S.clickX, S.clickY), delete h._pendingTextEditMode;
3475
+ const S = h._pendingTextEditMode, L = U.find((j) => j.id === S.elementId);
3476
+ !(L && (Math.abs(L.x - S.originalX) > 0.1 || Math.abs(L.y - S.originalY) > 0.1)) && L instanceof Qe && !(L instanceof Lt) && !(L instanceof Qn) && Yt(L, S.clickX, S.clickY), delete h._pendingTextEditMode;
3477
3477
  }
3478
3478
  if (Be.current) {
3479
- const S = Be.current, H = Je.current, Q = U.find((ee) => ee.id === S), j = (et = b.current) == null ? void 0 : et.get(S), pe = !!(Q && j && (Math.abs(Q.x - j.x) > 0.1 || Math.abs(Q.y - j.y) > 0.1)), ke = H ? Math.hypot(
3480
- (z.clientX - (((B = Ue.current) == null ? void 0 : B.left) ?? 0)) / L - xe - H.x,
3481
- (z.clientY - (((ge = Ue.current) == null ? void 0 : ge.top) ?? 0)) / L - ie - H.y
3482
- ) > 4 / Math.max(L, 1e-4) : !1;
3483
- if (!pe && !ke && S === (u == null ? void 0 : u.id) && H) {
3479
+ const S = Be.current, L = Je.current, Q = U.find((ee) => ee.id === S), j = (et = b.current) == null ? void 0 : et.get(S), pe = !!(Q && j && (Math.abs(Q.x - j.x) > 0.1 || Math.abs(Q.y - j.y) > 0.1)), ke = L ? Math.hypot(
3480
+ (z.clientX - (((B = Ue.current) == null ? void 0 : B.left) ?? 0)) / H - xe - L.x,
3481
+ (z.clientY - (((ge = Ue.current) == null ? void 0 : ge.top) ?? 0)) / H - ie - L.y
3482
+ ) > 4 / Math.max(H, 1e-4) : !1;
3483
+ if (!pe && !ke && S === (u == null ? void 0 : u.id) && L) {
3484
3484
  const ee = gt(), J = [];
3485
3485
  for (let X = ee.length - 1; X >= 0; X--) {
3486
3486
  const M = ee[X];
3487
- M.visible !== !1 && M.hitTest(H.x, H.y) && hs(M, H.x, H.y, Se) && J.push(M);
3487
+ M.visible !== !1 && M.hitTest(L.x, L.y) && hs(M, L.x, L.y, Se) && J.push(M);
3488
3488
  }
3489
3489
  const k = J.findIndex((X) => X.id === S);
3490
3490
  k !== -1 && k + 1 < J.length ? Xe(J[k + 1].id) : Xe(null);
@@ -3495,7 +3495,7 @@ function Mi(e) {
3495
3495
  }, [
3496
3496
  h,
3497
3497
  re,
3498
- K,
3498
+ V,
3499
3499
  Y,
3500
3500
  te,
3501
3501
  le,
@@ -3506,34 +3506,34 @@ function Mi(e) {
3506
3506
  t,
3507
3507
  _,
3508
3508
  We,
3509
- L,
3509
+ H,
3510
3510
  xe,
3511
3511
  ie,
3512
3512
  $,
3513
3513
  Yt,
3514
3514
  U,
3515
3515
  Xe,
3516
- Ke,
3516
+ Ve,
3517
3517
  Se
3518
3518
  ]), cs = ft(
3519
3519
  (z) => {
3520
3520
  if (!u) return;
3521
3521
  const fe = t.current;
3522
3522
  if (!fe) return;
3523
- const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) / L - xe, Z = (z.clientY - dt.top) / L - ie;
3523
+ const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) / H - xe, Z = (z.clientY - dt.top) / H - ie;
3524
3524
  if (u.hitTest(W, Z)) {
3525
3525
  if (u instanceof Re) {
3526
3526
  const oe = u.hitTestChild(W, Z);
3527
3527
  if (oe) {
3528
3528
  if (!(q && q.id === oe.id)) return;
3529
3529
  if (oe instanceof Qe && !(oe instanceof Re) && !(oe instanceof Qn)) {
3530
- const He = oe.getVisualBoundingBox(), it = en.toRadiansInverse(oe.rotation), bt = oe.getRotationAnchor(), Bt = W - bt.x, St = Z - bt.y, Et = Math.cos(it), Gt = Math.sin(it), ut = Bt * Et - St * Gt, kt = Bt * Gt + St * Et, kn = ut + He.width / 2, Ft = kt + He.height / 2, qt = Sn(oe, { x: kn, y: Ft }), jt = He.height + 16, _t = 6;
3530
+ const Le = oe.getVisualBoundingBox(), it = en.toRadiansInverse(oe.rotation), bt = oe.getRotationAnchor(), Bt = W - bt.x, St = Z - bt.y, Et = Math.cos(it), Gt = Math.sin(it), ut = Bt * Et - St * Gt, kt = Bt * Gt + St * Et, kn = ut + Le.width / 2, Ft = kt + Le.height / 2, qt = Sn(oe, { x: kn, y: Ft }), jt = Le.height + 16, _t = 6;
3531
3531
  wt({
3532
- x: dt.left + (He.x + xe) * L - _t,
3533
- y: dt.top + (He.y + ie) * L - _t,
3534
- width: Math.max(20, He.width * L),
3535
- height: Math.max(jt * L, 50)
3536
- }), Xt(Ve(oe));
3532
+ x: dt.left + (Le.x + xe) * H - _t,
3533
+ y: dt.top + (Le.y + ie) * H - _t,
3534
+ width: Math.max(20, Le.width * H),
3535
+ height: Math.max(jt * H, 50)
3536
+ }), Xt(Ke(oe));
3537
3537
  const $t = oe.getRichText().clone();
3538
3538
  C.current = $t, rn($t);
3539
3539
  const an = oe.getRichText().getStyleAt(Math.max(0, oe.text.length - 1));
@@ -3549,13 +3549,13 @@ function Mi(e) {
3549
3549
  }
3550
3550
  if (u instanceof Qn || !(u instanceof Qe))
3551
3551
  return;
3552
- const et = u.getVisualBoundingBox(), B = en.toRadiansInverse(u.rotation), ge = u.getRotationAnchor(), S = W - ge.x, H = Z - ge.y, Q = Math.cos(B), j = Math.sin(B), pe = S * Q - H * j, ke = S * j + H * Q, ee = pe + et.width / 2, J = ke + et.height / 2, k = Sn(u, { x: ee, y: J }), X = et.height + 16, M = 6;
3552
+ const et = u.getVisualBoundingBox(), B = en.toRadiansInverse(u.rotation), ge = u.getRotationAnchor(), S = W - ge.x, L = Z - ge.y, Q = Math.cos(B), j = Math.sin(B), pe = S * Q - L * j, ke = S * j + L * Q, ee = pe + et.width / 2, J = ke + et.height / 2, k = Sn(u, { x: ee, y: J }), X = et.height + 16, M = 6;
3553
3553
  wt({
3554
- x: dt.left + (et.x + xe) * L - M,
3555
- y: dt.top + (et.y + ie) * L - M,
3556
- width: Math.max(20, et.width * L),
3557
- height: Math.max(X * L, 50)
3558
- }), Xt(Ve(u));
3554
+ x: dt.left + (et.x + xe) * H - M,
3555
+ y: dt.top + (et.y + ie) * H - M,
3556
+ width: Math.max(20, et.width * H),
3557
+ height: Math.max(X * H, 50)
3558
+ }), Xt(Ke(u));
3559
3559
  const F = u.getRichText().clone();
3560
3560
  C.current = F, rn(F);
3561
3561
  const ae = u.getRichText().getStyleAt(Math.max(0, u.text.length - 1));
@@ -3569,7 +3569,7 @@ function Mi(e) {
3569
3569
  G,
3570
3570
  _,
3571
3571
  We,
3572
- L,
3572
+ H,
3573
3573
  xe,
3574
3574
  ie,
3575
3575
  wt,
@@ -3582,7 +3582,7 @@ function Mi(e) {
3582
3582
  on,
3583
3583
  Ze,
3584
3584
  ot,
3585
- Ve
3585
+ Ke
3586
3586
  ]
3587
3587
  ), Xn = ft(
3588
3588
  (z) => {
@@ -3617,7 +3617,7 @@ function Mi(e) {
3617
3617
  (z) => {
3618
3618
  const fe = t.current;
3619
3619
  if (!fe) return;
3620
- const dt = z.target, W = dt ? fe.contains(dt) : !1, Z = Ae.current.has(z.pointerId) || Ge.current !== null || Fe.current !== null || V.current !== null || h.isInteracting();
3620
+ const dt = z.target, W = dt ? fe.contains(dt) : !1, Z = Ae.current.has(z.pointerId) || Ge.current !== null || Fe.current !== null || K.current !== null || h.isInteracting();
3621
3621
  if (!W && !Z) return;
3622
3622
  const et = {
3623
3623
  clientX: z.clientX,
@@ -3642,19 +3642,19 @@ function Mi(e) {
3642
3642
  if (!rt) return;
3643
3643
  z.preventDefault();
3644
3644
  const fe = t.current;
3645
- if (!fe || g || u instanceof Ht && u.isCropping || _.isActive()) return;
3646
- const W = fe.getBoundingClientRect(), Z = (z.clientX - W.left) / L - xe, et = (z.clientY - W.top) / L - ie, B = gt();
3645
+ if (!fe || g || u instanceof Lt && u.isCropping || _.isActive()) return;
3646
+ const W = fe.getBoundingClientRect(), Z = (z.clientX - W.left) / H - xe, et = (z.clientY - W.top) / H - ie, B = gt();
3647
3647
  let ge = null;
3648
3648
  for (let S = B.length - 1; S >= 0; S--) {
3649
- const H = B[S];
3650
- if (H.visible !== !1 && H.hitTest(Z, et) && hs(H, Z, et, Se)) {
3651
- ge = H;
3649
+ const L = B[S];
3650
+ if (L.visible !== !1 && L.hitTest(Z, et) && hs(L, Z, et, Se)) {
3651
+ ge = L;
3652
3652
  break;
3653
3653
  }
3654
3654
  }
3655
3655
  if (ge) {
3656
- const S = te.includes(ge.id), H = (u == null ? void 0 : u.id) === ge.id;
3657
- !S && !H && (Xe(ge.id), Y([]));
3656
+ const S = te.includes(ge.id), L = (u == null ? void 0 : u.id) === ge.id;
3657
+ !S && !L && (Xe(ge.id), Y([]));
3658
3658
  }
3659
3659
  rt({
3660
3660
  clientX: z.clientX,
@@ -3670,7 +3670,7 @@ function Mi(e) {
3670
3670
  g,
3671
3671
  u,
3672
3672
  _,
3673
- L,
3673
+ H,
3674
3674
  xe,
3675
3675
  ie,
3676
3676
  gt,
@@ -3734,14 +3734,14 @@ function Ti(e) {
3734
3734
  elements: D,
3735
3735
  zoom: w,
3736
3736
  paddingOffsetX: ne,
3737
- paddingOffsetY: K,
3737
+ paddingOffsetY: V,
3738
3738
  setIsEditing: O,
3739
3739
  setEditText: u,
3740
3740
  setEditRichText: q,
3741
3741
  setCursorPosition: U,
3742
3742
  setSelectionStart: te,
3743
3743
  setSelectionEnd: le,
3744
- setEditPosition: L,
3744
+ setEditPosition: H,
3745
3745
  setCurrentFormattingStyle: xe,
3746
3746
  setCursorAnimationFrame: ie,
3747
3747
  setHandlesVersion: be,
@@ -3754,10 +3754,10 @@ function Ti(e) {
3754
3754
  (h, G, re) => {
3755
3755
  const he = t.current;
3756
3756
  if (!he) return;
3757
- const _ = he.getBoundingClientRect(), Ce = h.getVisualBoundingBox(), Ie = en.toRadiansInverse(h.rotation), Ke = h.getRotationAnchor(), Xe = G - Ke.x, Y = re - Ke.y, $ = Math.cos(Ie), ot = Math.sin(Ie), rt = Xe * $ - Y * ot, Ze = Xe * ot + Y * $, gt = rt + Ce.width / 2, Nt = Ze + Ce.height / 2, Dt = Sn(h, { x: gt, y: Nt }), tn = Ce.height + 16, Yt = 6;
3758
- L({
3757
+ const _ = he.getBoundingClientRect(), Ce = h.getVisualBoundingBox(), Ie = en.toRadiansInverse(h.rotation), Ve = h.getRotationAnchor(), Xe = G - Ve.x, Y = re - Ve.y, $ = Math.cos(Ie), ot = Math.sin(Ie), rt = Xe * $ - Y * ot, Ze = Xe * ot + Y * $, gt = rt + Ce.width / 2, Nt = Ze + Ce.height / 2, Dt = Sn(h, { x: gt, y: Nt }), tn = Ce.height + 16, Yt = 6;
3758
+ H({
3759
3759
  x: _.left + (Ce.x + ne) * w - Yt,
3760
- y: _.top + (Ce.y + K) * w - Yt,
3760
+ y: _.top + (Ce.y + V) * w - Yt,
3761
3761
  width: Math.max(20, Ce.width * w),
3762
3762
  height: Math.max(tn * w, 50)
3763
3763
  }), u(fs(h));
@@ -3766,7 +3766,7 @@ function Ti(e) {
3766
3766
  const Xt = h.getRichText().getStyleAt(Math.max(0, h.text.length - 1));
3767
3767
  xe({ ...h.getDefaultStyle(), ...Xt }), U(Dt), te(Dt), le(Dt), O(!0), p.current = Date.now();
3768
3768
  },
3769
- [w, L, u, q, xe, U, te, le, O]
3769
+ [w, H, u, q, xe, U, te, le, O]
3770
3770
  ), pt = ft(
3771
3771
  (h) => {
3772
3772
  if (!C || !E)
@@ -3822,13 +3822,13 @@ function Ti(e) {
3822
3822
  return;
3823
3823
  }
3824
3824
  setTimeout(() => {
3825
- var Ie, Ke, Xe;
3825
+ var Ie, Ve, Xe;
3826
3826
  if (Date.now() - p.current < v) {
3827
3827
  (Ie = n.current) == null || Ie.focus();
3828
3828
  return;
3829
3829
  }
3830
3830
  if (m.current) {
3831
- m.current = !1, (Ke = n.current) == null || Ke.focus(), n.current && n.current.setSelectionRange(T, I);
3831
+ m.current = !1, (Ve = n.current) == null || Ve.focus(), n.current && n.current.setSelectionRange(T, I);
3832
3832
  return;
3833
3833
  }
3834
3834
  let _ = document.activeElement, Ce = !1;
@@ -3946,24 +3946,24 @@ function Ti(e) {
3946
3946
  return f.current && clearTimeout(f.current), f.current = setTimeout(() => {
3947
3947
  let G = h;
3948
3948
  if (s.current && h instanceof Re) {
3949
- const Ke = h.children.find((Xe) => Xe.id === s.current);
3950
- Ke && (G = Ke);
3949
+ const Ve = h.children.find((Xe) => Xe.id === s.current);
3950
+ Ve && (G = Ve);
3951
3951
  }
3952
3952
  if (!(G instanceof Qe)) return;
3953
3953
  const re = G.clone();
3954
3954
  E && re.setRichText(E);
3955
3955
  const he = re.getVisualBoundingBox(), _ = t.current.getBoundingClientRect(), Ce = he.height + 16, Ie = 6;
3956
- if (L({
3956
+ if (H({
3957
3957
  x: _.left + (he.x + ne) * w - Ie,
3958
- y: _.top + (he.y + K) * w - Ie,
3958
+ y: _.top + (he.y + V) * w - Ie,
3959
3959
  width: Math.max(20, he.width * w),
3960
3960
  height: Math.max(Ce * w, 50)
3961
3961
  }), s.current && h instanceof Re) {
3962
- const Ke = h.clone(), Xe = Ke.children.findIndex((Y) => Y.id === s.current);
3963
- Xe >= 0 && (Ke.children[Xe] = re, Ke.updateBoundsFromChildren(!0)), Se((Y) => Y.map(($) => $.id === Ke.id ? Ke : $)), De.update(re, w);
3962
+ const Ve = h.clone(), Xe = Ve.children.findIndex((Y) => Y.id === s.current);
3963
+ Xe >= 0 && (Ve.children[Xe] = re, Ve.updateBoundsFromChildren(!0)), Se((Y) => Y.map(($) => $.id === Ve.id ? Ve : $)), De.update(re, w);
3964
3964
  } else
3965
- Se((Ke) => Ke.map((Xe) => Xe.id === re.id ? re : Xe)), De.update(re, w);
3966
- be((Ke) => Ke + 1);
3965
+ Se((Ve) => Ve.map((Xe) => Xe.id === re.id ? re : Xe)), De.update(re, w);
3966
+ be((Ve) => Ve + 1);
3967
3967
  }, 50), () => {
3968
3968
  f.current && clearTimeout(f.current);
3969
3969
  };
@@ -3987,23 +3987,23 @@ function Ti(e) {
3987
3987
  const re = G.target;
3988
3988
  if (re.tagName === "INPUT" || re.tagName === "TEXTAREA" || G.key !== "Enter" || C || !t.current) return;
3989
3989
  const he = t.current.getBoundingClientRect();
3990
- if (N && N instanceof Qe && !(N instanceof Re) && !(N instanceof Ht) && !(N instanceof Qn)) {
3990
+ if (N && N instanceof Qe && !(N instanceof Re) && !(N instanceof Lt) && !(N instanceof Qn)) {
3991
3991
  G.preventDefault();
3992
3992
  const _ = N.getVisualBoundingBox(), Ce = _.height + 16, Ie = 6;
3993
- L({
3993
+ H({
3994
3994
  x: he.left + (_.x + ne) * w - Ie,
3995
- y: he.top + (_.y + K) * w - Ie,
3995
+ y: he.top + (_.y + V) * w - Ie,
3996
3996
  width: Math.max(200, _.width * w),
3997
3997
  height: Math.max(Ce * w, 50)
3998
3998
  }), u(fs(N)), O(!0), p.current = Date.now(), s.current = N.id;
3999
3999
  return;
4000
4000
  }
4001
- if (P && P instanceof Qe && !(P instanceof Re) && !(P instanceof Ht) && !(P instanceof Qn)) {
4001
+ if (P && P instanceof Qe && !(P instanceof Re) && !(P instanceof Lt) && !(P instanceof Qn)) {
4002
4002
  G.preventDefault();
4003
4003
  const _ = P.getVisualBoundingBox(), Ce = _.height + 16, Ie = 6;
4004
- L({
4004
+ H({
4005
4005
  x: he.left + (_.x + ne) * w - Ie,
4006
- y: he.top + (_.y + K) * w - Ie,
4006
+ y: he.top + (_.y + V) * w - Ie,
4007
4007
  width: Math.max(200, _.width * w),
4008
4008
  height: Math.max(Ce * w, 50)
4009
4009
  }), u(fs(P)), O(!0), p.current = Date.now();
@@ -4051,13 +4051,13 @@ const yr = Nr(
4051
4051
  fixedMargin: D,
4052
4052
  fixedMarginX: w,
4053
4053
  fixedMarginY: ne,
4054
- showRotationHandle: K = !0,
4054
+ showRotationHandle: V = !0,
4055
4055
  canvasCutouts: O,
4056
4056
  pieceGuides: u,
4057
4057
  pieceFocus: q,
4058
4058
  focusedPieceRect: U
4059
4059
  }, te) => {
4060
- const { resolvedTheme: le } = ho(), L = we(null), xe = R || L, ie = we(null), be = we(!1), Se = we(0), Te = we(0), Oe = we(0), De = we(!1), $e = we(0), at = we(null), pt = we(0), ct = we(null), Pt = we({ start: null, end: null }), zt = we(null), At = we(null), We = we(null), Ee = we(null), lt = 400, se = 300, h = 50, G = 200, re = je.useMemo(() => {
4060
+ const { resolvedTheme: le } = ho(), H = we(null), xe = R || H, ie = we(null), be = we(!1), Se = we(0), Te = we(0), Oe = we(0), De = we(!1), $e = we(0), at = we(null), pt = we(0), ct = we(null), Pt = we({ start: null, end: null }), zt = we(null), At = we(null), We = we(null), Ee = we(null), lt = 400, se = 300, h = 50, G = 200, re = je.useMemo(() => {
4061
4061
  if (!q || q === "spread") return null;
4062
4062
  const ye = (u == null ? void 0 : u.pieces) ?? [];
4063
4063
  if (ye.length <= 1) return null;
@@ -4074,14 +4074,14 @@ const yr = Nr(
4074
4074
  }, [he, u]), {
4075
4075
  isTouchDevice: Ce,
4076
4076
  canvasSize: Ie,
4077
- lastTouchTargetRef: Ke,
4077
+ lastTouchTargetRef: Ve,
4078
4078
  effectiveViewPadding: Xe,
4079
4079
  paddedCanvasWidth: Y,
4080
4080
  paddedCanvasHeight: $,
4081
4081
  paddingOffsetX: ot,
4082
4082
  paddingOffsetY: rt,
4083
4083
  zoomInvariantBorderRadius: Ze
4084
- } = Lo({
4084
+ } = Ho({
4085
4085
  width: E,
4086
4086
  height: A,
4087
4087
  zoom: T,
@@ -4104,11 +4104,11 @@ const yr = Nr(
4104
4104
  setIsRotating: rn,
4105
4105
  setRotationStartAngle: on,
4106
4106
  currentRotation: Ut,
4107
- setCurrentRotation: Ve,
4107
+ setCurrentRotation: Ke,
4108
4108
  setRotatingElementVersion: Ue
4109
4109
  } = _o(), {
4110
4110
  renderVersion: Ae,
4111
- forceRender: V,
4111
+ forceRender: K,
4112
4112
  handlesVersion: ue,
4113
4113
  setHandlesVersion: me,
4114
4114
  forceUpdate: Be,
@@ -4126,8 +4126,8 @@ const yr = Nr(
4126
4126
  ye ? [{ id: "focused-piece", ...ye }] : []
4127
4127
  );
4128
4128
  }, [st, U, re]);
4129
- const Lt = we(e);
4130
- Lt.current = e;
4129
+ const Ht = we(e);
4130
+ Ht.current = e;
4131
4131
  const ve = e.find((ye) => ye.id === s), as = we(ve);
4132
4132
  as.current = ve;
4133
4133
  const [An, En] = ce("");
@@ -4139,14 +4139,14 @@ const yr = Nr(
4139
4139
  if (ye instanceof Qe) {
4140
4140
  const Ye = ((de = ye.text) == null ? void 0 : de.slice(0, 40)) || "empty";
4141
4141
  En(`Selected text element: ${Ye}`);
4142
- } else ye instanceof Ht ? En("Selected image element") : ye instanceof Re ? En("Selected group") : En("Selected element");
4142
+ } else ye instanceof Lt ? En("Selected image element") : ye instanceof Re ? En("Selected group") : En("Selected element");
4143
4143
  }, [s, e]);
4144
4144
  const cs = we(n);
4145
4145
  cs.current = n;
4146
4146
  const Xn = we(/* @__PURE__ */ new Map());
4147
4147
  Pe(() => {
4148
4148
  const ye = (de) => {
4149
- const Ye = de, Le = cs.current.getActiveArtboardId(), tt = Xn.current.get(Le) || [], vt = [];
4149
+ const Ye = de, He = cs.current.getActiveArtboardId(), tt = Xn.current.get(He) || [], vt = [];
4150
4150
  return tt.forEach((Rt) => {
4151
4151
  Rt instanceof Re ? vt.push(...Rt.children) : vt.push(Rt);
4152
4152
  }), st.snapDimensions(Ye, vt, Ye.startData);
@@ -4164,7 +4164,7 @@ const yr = Nr(
4164
4164
  setEditPosition: B,
4165
4165
  cursorPosition: ge,
4166
4166
  setCursorPosition: S,
4167
- selectionStart: H,
4167
+ selectionStart: L,
4168
4168
  setSelectionStart: Q,
4169
4169
  selectionEnd: j,
4170
4170
  setSelectionEnd: pe,
@@ -4180,17 +4180,17 @@ const yr = Nr(
4180
4180
  } = Yo({ selectedElement: ve, ref: te });
4181
4181
  Pe(() => {
4182
4182
  const ye = Date.now() - $e.current, de = at.current;
4183
- de && ye < se ? (H !== de.start || j !== de.end) && (S(de.cursor), Q(de.start), pe(de.end), ie.current && ie.current.setSelectionRange(de.start, de.end)) : de && ye >= se && (at.current = null);
4184
- }, [H, j, ge]), Pe(() => {
4183
+ de && ye < se ? (L !== de.start || j !== de.end) && (S(de.cursor), Q(de.start), pe(de.end), ie.current && ie.current.setSelectionRange(de.start, de.end)) : de && ye >= se && (at.current = null);
4184
+ }, [L, j, ge]), Pe(() => {
4185
4185
  if (!fe) return;
4186
4186
  const ye = xe.current;
4187
4187
  if (!ye) return;
4188
4188
  let de = ye.getBoundingClientRect();
4189
4189
  const Ye = () => {
4190
- const Le = ie.current, tt = xe.current;
4191
- if (!Le || !tt) return;
4190
+ const He = ie.current, tt = xe.current;
4191
+ if (!He || !tt) return;
4192
4192
  const vt = tt.getBoundingClientRect(), Rt = vt.left - de.left, ht = vt.top - de.top;
4193
- Rt === 0 && ht === 0 || (de = vt, Le.style.left = `${parseFloat(Le.style.left || "0") + Rt}px`, Le.style.top = `${parseFloat(Le.style.top || "0") + ht}px`);
4193
+ Rt === 0 && ht === 0 || (de = vt, He.style.left = `${parseFloat(He.style.left || "0") + Rt}px`, He.style.top = `${parseFloat(He.style.top || "0") + ht}px`);
4194
4194
  };
4195
4195
  return window.addEventListener("scroll", Ye, { passive: !0, capture: !0 }), window.addEventListener("resize", Ye), () => {
4196
4196
  window.removeEventListener("scroll", Ye, { capture: !0 }), window.removeEventListener("resize", Ye);
@@ -4198,7 +4198,7 @@ const yr = Nr(
4198
4198
  }, [fe]);
4199
4199
  const {
4200
4200
  isMarqueeSelecting: Me,
4201
- marqueeStart: He,
4201
+ marqueeStart: Le,
4202
4202
  marqueeEnd: it,
4203
4203
  marqueePreviewSelection: bt,
4204
4204
  startMarqueeSelection: Bt,
@@ -4207,7 +4207,7 @@ const yr = Nr(
4207
4207
  } = Po(), {
4208
4208
  multiSelectionGroupBoundsRef: Gt,
4209
4209
  multiSelectionOBBRef: ut
4210
- } = Ho(o), {
4210
+ } = Lo(o), {
4211
4211
  activeChildElement: kt,
4212
4212
  updateActiveChild: kn,
4213
4213
  editingChildIdRef: Ft
@@ -4224,25 +4224,25 @@ const yr = Nr(
4224
4224
  return _t.get(ye) || [];
4225
4225
  }, [_t, n]);
4226
4226
  Pe(() => {
4227
- const ye = (Le) => {
4227
+ const ye = (He) => {
4228
4228
  if (!fe) {
4229
4229
  if (xn.isActive() && ve instanceof wn) {
4230
- if (Le.key === "Escape") {
4231
- Le.preventDefault(), xn.finishPath();
4230
+ if (He.key === "Escape") {
4231
+ He.preventDefault(), xn.finishPath();
4232
4232
  const tt = ve.clone();
4233
4233
  l(ve, tt), me((vt) => vt + 1);
4234
4234
  return;
4235
- } else if (Le.key === "Backspace" || Le.key === "Delete") {
4236
- Le.preventDefault(), xn.deleteLastPoint(), me((tt) => tt + 1);
4235
+ } else if (He.key === "Backspace" || He.key === "Delete") {
4236
+ He.preventDefault(), xn.deleteLastPoint(), me((tt) => tt + 1);
4237
4237
  return;
4238
4238
  }
4239
4239
  }
4240
- Le.altKey && wt(!0);
4240
+ He.altKey && wt(!0);
4241
4241
  }
4242
- }, de = (Le) => {
4243
- Le.altKey || wt(!1);
4244
- }, Ye = (Le) => {
4245
- (!Le.relatedTarget || !Le.relatedTarget.ownerDocument) && wt(!1);
4242
+ }, de = (He) => {
4243
+ He.altKey || wt(!1);
4244
+ }, Ye = (He) => {
4245
+ (!He.relatedTarget || !He.relatedTarget.ownerDocument) && wt(!1);
4246
4246
  };
4247
4247
  return window.addEventListener("keydown", ye), window.addEventListener("keyup", de), window.addEventListener("blur", Ye), () => {
4248
4248
  window.removeEventListener("keydown", ye), window.removeEventListener("keyup", de), window.removeEventListener("blur", Ye);
@@ -4252,7 +4252,7 @@ const yr = Nr(
4252
4252
  return;
4253
4253
  const { x: de, y: Ye } = zt.current;
4254
4254
  if (Yt) {
4255
- let Le = null;
4255
+ let He = null;
4256
4256
  const tt = $t();
4257
4257
  for (let vt = tt.length - 1; vt >= 0; vt--) {
4258
4258
  const Rt = tt[vt];
@@ -4263,26 +4263,26 @@ const yr = Nr(
4263
4263
  if (qe.visible === !1) continue;
4264
4264
  const Ne = qe.getVisualBoundingBox();
4265
4265
  if (de >= Ne.x && de <= Ne.x + Ne.width && Ye >= Ne.y && Ye <= Ne.y + Ne.height) {
4266
- Le = qe;
4266
+ He = qe;
4267
4267
  break;
4268
4268
  }
4269
4269
  }
4270
4270
  else {
4271
4271
  const ht = Rt.getVisualBoundingBox();
4272
4272
  if (de >= ht.x && de <= ht.x + ht.width && Ye >= ht.y && Ye <= ht.y + ht.height) {
4273
- Le = Rt;
4273
+ He = Rt;
4274
4274
  break;
4275
4275
  }
4276
4276
  }
4277
- if (Le) break;
4277
+ if (He) break;
4278
4278
  }
4279
4279
  }
4280
- if (Le) {
4280
+ if (He) {
4281
4281
  const vt = [];
4282
4282
  tt.forEach((ht) => {
4283
4283
  ht instanceof Re ? vt.push(...ht.children) : vt.push(ht);
4284
4284
  });
4285
- const Rt = xt.detectSpacing(Le, vt, !0);
4285
+ const Rt = xt.detectSpacing(He, vt, !0);
4286
4286
  tn(Rt);
4287
4287
  }
4288
4288
  } else
@@ -4292,17 +4292,17 @@ const yr = Nr(
4292
4292
  Pe(() => {
4293
4293
  const ye = e.find((Ye) => Ye.id === s), de = kt || ye;
4294
4294
  if (de) {
4295
- const Ye = de.getBoundingBox(), Le = `${de.id}-${Ye.x}-${Ye.y}-${Ye.width}-${Ye.height}-${de.rotation}`;
4296
- an.current !== Le && (an.current = Le, Fe.update(de, T), me((tt) => tt + 1));
4295
+ const Ye = de.getBoundingBox(), He = `${de.id}-${Ye.x}-${Ye.y}-${Ye.width}-${Ye.height}-${de.rotation}`;
4296
+ an.current !== He && (an.current = He, Fe.update(de, T), me((tt) => tt + 1));
4297
4297
  }
4298
4298
  }, [s, kt, Fe, T, e]);
4299
4299
  const {
4300
- handleTextEditBlur: Hn,
4301
- handleTextKeyDown: Kn,
4300
+ handleTextEditBlur: Ln,
4301
+ handleTextKeyDown: Vn,
4302
4302
  applyFormattingToSelection: nn,
4303
4303
  getSelectionStyle: ls,
4304
4304
  toggleFormattingProperty: ds,
4305
- enterTextEditMode: Vn,
4305
+ enterTextEditMode: Kn,
4306
4306
  getWrappedTextForEditing: Un
4307
4307
  } = Ti({
4308
4308
  canvasRef: xe,
@@ -4317,14 +4317,14 @@ const yr = Nr(
4317
4317
  draggingSelectionHandleRef: ct,
4318
4318
  repositioningCursorRef: be,
4319
4319
  editModeEnteredAtRef: Oe,
4320
- lastTouchTargetRef: Ke,
4320
+ lastTouchTargetRef: Ve,
4321
4321
  MULTI_CLICK_DEBOUNCE: se,
4322
4322
  EDIT_MODE_BLUR_DEBOUNCE: G,
4323
4323
  isEditing: fe,
4324
4324
  editText: W,
4325
4325
  editRichText: X,
4326
4326
  cursorPosition: ge,
4327
- selectionStart: H,
4327
+ selectionStart: L,
4328
4328
  selectionEnd: j,
4329
4329
  selectedId: s,
4330
4330
  selectedElement: ve,
@@ -4379,7 +4379,7 @@ const yr = Nr(
4379
4379
  isEditing: fe,
4380
4380
  editText: W,
4381
4381
  isTouchDevice: Ce,
4382
- selectionStart: H,
4382
+ selectionStart: L,
4383
4383
  selectionEnd: j,
4384
4384
  isRotating: Xt,
4385
4385
  isMarqueeSelecting: Me,
@@ -4399,7 +4399,7 @@ const yr = Nr(
4399
4399
  setSelectionEnd: pe,
4400
4400
  setIsRotating: rn,
4401
4401
  setRotationStartAngle: on,
4402
- setCurrentRotation: Ve,
4402
+ setCurrentRotation: Ke,
4403
4403
  setRotatingElementVersion: Ue,
4404
4404
  setIsAltKeyPressed: wt,
4405
4405
  setSnapGuides: Nt,
@@ -4426,7 +4426,7 @@ const yr = Nr(
4426
4426
  startMarqueeSelection: Bt,
4427
4427
  updateMarqueeSelection: St,
4428
4428
  finishMarqueeSelection: Et,
4429
- enterTextEditMode: Vn,
4429
+ enterTextEditMode: Kn,
4430
4430
  setEditPosition: B,
4431
4431
  setEditText: Z,
4432
4432
  setEditRichText: M,
@@ -4455,7 +4455,7 @@ const yr = Nr(
4455
4455
  zoom: T,
4456
4456
  zoomInvariantBorderRadius: Ze,
4457
4457
  effectiveViewPadding: Xe,
4458
- showRotationHandle: K,
4458
+ showRotationHandle: V,
4459
4459
  isRotating: Xt,
4460
4460
  currentRotation: Ut,
4461
4461
  hoverState: qt,
@@ -4463,7 +4463,7 @@ const yr = Nr(
4463
4463
  editText: W,
4464
4464
  editRichText: X,
4465
4465
  cursorPosition: ge,
4466
- selectionStart: H,
4466
+ selectionStart: L,
4467
4467
  selectionEnd: j,
4468
4468
  cursorOpacityRef: ke,
4469
4469
  cursorStartTimeRef: ee,
@@ -4479,7 +4479,7 @@ const yr = Nr(
4479
4479
  multiSelectionOBBRef: ut,
4480
4480
  multiSelectionGroupBoundsRef: Gt,
4481
4481
  isMarqueeSelecting: Me,
4482
- marqueeStart: He,
4482
+ marqueeStart: Le,
4483
4483
  marqueeEnd: it,
4484
4484
  marqueePreviewSelection: bt,
4485
4485
  penTool: xn,
@@ -4504,25 +4504,25 @@ const yr = Nr(
4504
4504
  isRotating: () => Xt,
4505
4505
  getSelectionStyle: () => ls(),
4506
4506
  getZoom: () => T,
4507
- forceRender: V,
4507
+ forceRender: K,
4508
4508
  getEditingState: () => ({
4509
4509
  isEditing: fe,
4510
4510
  editText: W,
4511
4511
  cursorPosition: ge,
4512
- selectionStart: H,
4512
+ selectionStart: L,
4513
4513
  selectionEnd: j
4514
4514
  }),
4515
4515
  getCropState: () => ({
4516
- isCropping: ve instanceof Ht && ve.isCropping,
4516
+ isCropping: ve instanceof Lt && ve.isCropping,
4517
4517
  elementId: (ve == null ? void 0 : ve.id) || null
4518
4518
  }),
4519
4519
  getPaddingOffset: () => ({ x: ot, y: rt })
4520
4520
  }),
4521
- [nn, ds, fe, Xt, ls, T, V, W, ge, H, j, ve, ot, rt]
4521
+ [nn, ds, fe, Xt, ls, T, K, W, ge, L, j, ve, ot, rt]
4522
4522
  );
4523
4523
  const Sr = xs(() => {
4524
4524
  if (!O || O.length === 0) return;
4525
- const ye = Y * T, de = $ * T, Ye = `M 0 0 h ${ye} v ${de} h ${-ye} Z`, Le = O.map((tt) => {
4525
+ const ye = Y * T, de = $ * T, Ye = `M 0 0 h ${ye} v ${de} h ${-ye} Z`, He = O.map((tt) => {
4526
4526
  if (tt.kind === "rect" || tt.kind === "roundedRect") {
4527
4527
  const vt = (ot + tt.x) * T, Rt = (rt + tt.y) * T, ht = tt.width * T, qe = tt.height * T;
4528
4528
  if (tt.kind === "roundedRect") {
@@ -4545,8 +4545,8 @@ const yr = Nr(
4545
4545
  }
4546
4546
  return "";
4547
4547
  }).filter(Boolean);
4548
- if (Le.length !== 0)
4549
- return `path(evenodd, "${Ye} ${Le.join(" ")}")`;
4548
+ if (He.length !== 0)
4549
+ return `path(evenodd, "${Ye} ${He.join(" ")}")`;
4550
4550
  }, [O, Y, $, ot, rt, T]);
4551
4551
  return /* @__PURE__ */ y(Pn, { children: [
4552
4552
  /* @__PURE__ */ r(
@@ -4602,7 +4602,7 @@ const yr = Nr(
4602
4602
  const qe = ve.children.find((Ne) => Ne.id === Ft.current);
4603
4603
  qe && (ye = qe);
4604
4604
  }
4605
- const de = ye instanceof Qe ? ye : null, Ye = (de == null ? void 0 : de.fontSize) || 24, Le = (de == null ? void 0 : de.fontFamily) || "Arial", tt = (de == null ? void 0 : de.bold) || !1, vt = (de == null ? void 0 : de.italic) || !1, Rt = (de == null ? void 0 : de.textAlign) || "center", ht = /* @__PURE__ */ r(
4605
+ const de = ye instanceof Qe ? ye : null, Ye = (de == null ? void 0 : de.fontSize) || 24, He = (de == null ? void 0 : de.fontFamily) || "Arial", tt = (de == null ? void 0 : de.bold) || !1, vt = (de == null ? void 0 : de.italic) || !1, Rt = (de == null ? void 0 : de.textAlign) || "center", ht = /* @__PURE__ */ r(
4606
4606
  "textarea",
4607
4607
  {
4608
4608
  ref: ie,
@@ -4618,13 +4618,13 @@ const yr = Nr(
4618
4618
  return;
4619
4619
  }
4620
4620
  const mt = W, bn = X.clone();
4621
- let Kt = 0;
4622
- for (; Kt < mt.length && Kt < Ne.length && mt[Kt] === Ne[Kt]; )
4623
- Kt++;
4621
+ let Vt = 0;
4622
+ for (; Vt < mt.length && Vt < Ne.length && mt[Vt] === Ne[Vt]; )
4623
+ Vt++;
4624
4624
  let Zt = 0;
4625
- for (; Zt < mt.length - Kt && Zt < Ne.length - Kt && mt[mt.length - 1 - Zt] === Ne[Ne.length - 1 - Zt]; )
4625
+ for (; Zt < mt.length - Vt && Zt < Ne.length - Vt && mt[mt.length - 1 - Zt] === Ne[Ne.length - 1 - Zt]; )
4626
4626
  Zt++;
4627
- const cn = Kt, Mn = mt.length - Zt, Tn = Ne.substring(Kt, Ne.length - Zt);
4627
+ const cn = Vt, Mn = mt.length - Zt, Tn = Ne.substring(Vt, Ne.length - Zt);
4628
4628
  if (Mn > cn && bn.delete(cn, Mn), Tn.length > 0) {
4629
4629
  let Jt;
4630
4630
  ae ? Jt = ae : cn > 0 ? Jt = bn.getStyleAt(cn - 1) : ve instanceof Qe ? Jt = ve.getDefaultStyle() : Jt = {}, bn.insert(cn, Tn, Jt);
@@ -4637,14 +4637,14 @@ const yr = Nr(
4637
4637
  vn && document.activeElement === vn && vn.setSelectionRange(fn, fn);
4638
4638
  }, 0);
4639
4639
  },
4640
- onBlur: Hn,
4641
- onKeyDown: Kn,
4640
+ onBlur: Ln,
4641
+ onKeyDown: Vn,
4642
4642
  onPointerDown: (qe) => {
4643
4643
  if (qe.preventDefault(), !ve || !(ve instanceof Qe) || !xe.current) return;
4644
4644
  const Ne = Date.now();
4645
4645
  if (Ne - pt.current < h) return;
4646
4646
  pt.current = Ne, Ne - $e.current >= se && (at.current = null);
4647
- const mt = xe.current.getBoundingClientRect(), bn = (qe.clientX - mt.left) / T - ot, Kt = (qe.clientY - mt.top) / T - rt, Zt = ve.getVisualBoundingBox(), cn = ve.getRotationAnchor(), Mn = en.toRadiansInverse(ve.rotation), Tn = bn - cn.x, fn = Kt - cn.y, vn = Math.cos(Mn), Jt = Math.sin(Mn), Gn = Tn * vn - fn * Jt, Cs = Tn * Jt + fn * vn, ws = Gn + Zt.width / 2, Nn = Cs + Zt.height / 2, sn = Sn(ve, { x: ws, y: Nn });
4647
+ const mt = xe.current.getBoundingClientRect(), bn = (qe.clientX - mt.left) / T - ot, Vt = (qe.clientY - mt.top) / T - rt, Zt = ve.getVisualBoundingBox(), cn = ve.getRotationAnchor(), Mn = en.toRadiansInverse(ve.rotation), Tn = bn - cn.x, fn = Vt - cn.y, vn = Math.cos(Mn), Jt = Math.sin(Mn), Gn = Tn * vn - fn * Jt, Cs = Tn * Jt + fn * vn, ws = Gn + Zt.width / 2, Nn = Cs + Zt.height / 2, sn = Sn(ve, { x: ws, y: Nn });
4648
4648
  Ne - Se.current < lt ? Te.current += 1 : Te.current = 1, Se.current = Ne;
4649
4649
  const pn = W;
4650
4650
  if (k.current = !1, Te.current >= 3)
@@ -4659,18 +4659,18 @@ const yr = Nr(
4659
4659
  onPointerMove: (qe) => {
4660
4660
  if (qe.buttons !== 1) return;
4661
4661
  if (ct.current && ve instanceof Qe && xe.current) {
4662
- const qn = xe.current.getBoundingClientRect(), pn = (qe.clientX - qn.left) / T - ot, ln = (qe.clientY - qn.top) / T - rt, Bs = ve.getVisualBoundingBox(), Os = ve.getRotationAnchor(), zs = en.toRadiansInverse(ve.rotation), Xs = pn - Os.x, Hs = ln - Os.y, Ys = Math.cos(zs), Ls = Math.sin(zs), Er = Xs * Ys - Hs * Ls, kr = Xs * Ls + Hs * Ys, mn = Pt.current;
4662
+ const qn = xe.current.getBoundingClientRect(), pn = (qe.clientX - qn.left) / T - ot, ln = (qe.clientY - qn.top) / T - rt, Bs = ve.getVisualBoundingBox(), Os = ve.getRotationAnchor(), zs = en.toRadiansInverse(ve.rotation), Xs = pn - Os.x, Ls = ln - Os.y, Ys = Math.cos(zs), Hs = Math.sin(zs), Er = Xs * Ys - Ls * Hs, kr = Xs * Hs + Ls * Ys, mn = Pt.current;
4663
4663
  let Ss = 0;
4664
4664
  ct.current === "start" && (mn != null && mn.start) ? Ss = mn.start.textEdge.y - mn.start.center.y : ct.current === "end" && (mn != null && mn.end) && (Ss = mn.end.textEdge.y - mn.end.center.y);
4665
4665
  const Rr = Er + Bs.width / 2, Mr = kr + Ss + Bs.height / 2, gn = Sn(ve, { x: Rr, y: Mr });
4666
- if (ct.current === "start" ? gn <= j ? (Q(gn), S(gn)) : (Q(j), pe(gn), S(gn), ct.current = "end") : gn >= H ? (pe(gn), S(gn)) : (pe(H), Q(gn), S(gn), ct.current = "start"), ie.current) {
4667
- const Tr = Math.min(H, j), Ir = Math.max(H, j);
4666
+ if (ct.current === "start" ? gn <= j ? (Q(gn), S(gn)) : (Q(j), pe(gn), S(gn), ct.current = "end") : gn >= L ? (pe(gn), S(gn)) : (pe(L), Q(gn), S(gn), ct.current = "start"), ie.current) {
4667
+ const Tr = Math.min(L, j), Ir = Math.max(L, j);
4668
4668
  ie.current.setSelectionRange(Tr, Ir);
4669
4669
  }
4670
4670
  return;
4671
4671
  }
4672
4672
  if (De.current || !ve || !(ve instanceof Qe) || !xe.current) return;
4673
- const Ne = xe.current.getBoundingClientRect(), mt = (qe.clientX - Ne.left) / T - ot, bn = (qe.clientY - Ne.top) / T - rt, Kt = ve.getVisualBoundingBox(), Zt = ve.getRotationAnchor(), cn = en.toRadiansInverse(ve.rotation), Mn = mt - Zt.x, Tn = bn - Zt.y, fn = Math.cos(cn), vn = Math.sin(cn), Jt = Mn * fn - Tn * vn, Gn = Mn * vn + Tn * fn, Cs = Jt + Kt.width / 2, ws = Gn + Kt.height / 2, Nn = Sn(ve, { x: Cs, y: ws }), sn = J.current;
4673
+ const Ne = xe.current.getBoundingClientRect(), mt = (qe.clientX - Ne.left) / T - ot, bn = (qe.clientY - Ne.top) / T - rt, Vt = ve.getVisualBoundingBox(), Zt = ve.getRotationAnchor(), cn = en.toRadiansInverse(ve.rotation), Mn = mt - Zt.x, Tn = bn - Zt.y, fn = Math.cos(cn), vn = Math.sin(cn), Jt = Mn * fn - Tn * vn, Gn = Mn * vn + Tn * fn, Cs = Jt + Vt.width / 2, ws = Gn + Vt.height / 2, Nn = Sn(ve, { x: Cs, y: ws }), sn = J.current;
4674
4674
  if (sn !== Nn && (k.current = !0), pe(Nn), S(Nn), Q(sn), ie.current) {
4675
4675
  const qn = Math.min(sn, Nn), pn = Math.max(sn, Nn);
4676
4676
  ie.current.setSelectionRange(qn, pn);
@@ -4693,7 +4693,7 @@ const yr = Nr(
4693
4693
  width: `${et.width}px`,
4694
4694
  height: `${et.height || 50}px`,
4695
4695
  fontSize: `${Ye * T}px`,
4696
- fontFamily: `"${Le}", Arial, sans-serif`,
4696
+ fontFamily: `"${He}", Arial, sans-serif`,
4697
4697
  fontWeight: tt ? 700 : 400,
4698
4698
  fontStyle: vt ? "italic" : "normal",
4699
4699
  textAlign: Rt,
@@ -4868,7 +4868,7 @@ const Ms = $n.forwardRef(({ className: e, variant: t, ...n }, s) => {
4868
4868
  );
4869
4869
  });
4870
4870
  Ms.displayName = ts.Item.displayName;
4871
- const Vt = $n.forwardRef(
4871
+ const Kt = $n.forwardRef(
4872
4872
  ({ children: e, className: t, variant: n, ...s }, o) => e ? /* @__PURE__ */ y("div", { className: "sc:flex sc:items-center sc:space-x-2", children: [
4873
4873
  /* @__PURE__ */ r(Ms, { ref: o, variant: n, ...s }),
4874
4874
  /* @__PURE__ */ r(
@@ -4881,7 +4881,7 @@ const Vt = $n.forwardRef(
4881
4881
  )
4882
4882
  ] }) : /* @__PURE__ */ r(Ms, { ref: o, className: t, variant: n, ...s })
4883
4883
  );
4884
- Vt.displayName = "Radio";
4884
+ Kt.displayName = "Radio";
4885
4885
  const Ai = fr("sc:pointer-events-none sc:relative sc:origin-center sc:animate-spin sc:size-6 sc:text-primary", {
4886
4886
  variants: {
4887
4887
  size: {
@@ -4977,7 +4977,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
4977
4977
  const g = e.targetId ? A(e.targetId) : null, P = xs(() => e.targetId ? n.length > 1 && n.includes(e.targetId) ? n : [e.targetId] : [], [e.targetId, n]), N = !!(g != null && g.locked), D = P.some((u) => {
4978
4978
  var q;
4979
4979
  return !!((q = A(u)) != null && q.locked);
4980
- }), w = g instanceof Re, ne = P.length > 1, K = (u) => () => {
4980
+ }), w = g instanceof Re, ne = P.length > 1, V = (u) => () => {
4981
4981
  u(), t();
4982
4982
  }, O = /* @__PURE__ */ r(
4983
4983
  "div",
@@ -5005,7 +5005,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5005
5005
  icon: /* @__PURE__ */ r(ze, { icon: _e.copy, className: "sc:size-3.5" }),
5006
5006
  label: "Copy",
5007
5007
  shortcut: `${Zn}C`,
5008
- onClick: K(() => s())
5008
+ onClick: V(() => s())
5009
5009
  }
5010
5010
  ),
5011
5011
  /* @__PURE__ */ r(
@@ -5016,7 +5016,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5016
5016
  label: "Paste",
5017
5017
  shortcut: `${Zn}V`,
5018
5018
  disabled: !i,
5019
- onClick: K(() => o())
5019
+ onClick: V(() => o())
5020
5020
  }
5021
5021
  ),
5022
5022
  /* @__PURE__ */ r(
@@ -5026,7 +5026,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5026
5026
  icon: /* @__PURE__ */ r(ze, { icon: _e.copy, className: "sc:size-3.5" }),
5027
5027
  label: "Duplicate",
5028
5028
  shortcut: `${Zn}D`,
5029
- onClick: K(() => P.forEach((u) => d(u)))
5029
+ onClick: V(() => P.forEach((u) => d(u)))
5030
5030
  }
5031
5031
  ),
5032
5032
  /* @__PURE__ */ r(ps, {}),
@@ -5036,7 +5036,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5036
5036
  "data-testid": "context-menu-lock",
5037
5037
  icon: /* @__PURE__ */ r(ze, { icon: N ? _e.lockOpen : _e.lock, className: "sc:size-3.5" }),
5038
5038
  label: N ? "Unlock" : "Lock",
5039
- onClick: K(() => P.forEach((u) => p(u)))
5039
+ onClick: V(() => P.forEach((u) => p(u)))
5040
5040
  }
5041
5041
  ),
5042
5042
  /* @__PURE__ */ r(ps, {}),
@@ -5047,7 +5047,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5047
5047
  icon: /* @__PURE__ */ r(ze, { icon: _e.layerForward, className: "sc:size-3.5" }),
5048
5048
  label: "Bring to Front",
5049
5049
  disabled: N,
5050
- onClick: K(() => v(e.targetId))
5050
+ onClick: V(() => v(e.targetId))
5051
5051
  }
5052
5052
  ),
5053
5053
  /* @__PURE__ */ r(
@@ -5057,7 +5057,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5057
5057
  icon: /* @__PURE__ */ r(ze, { icon: _e.arrowUp, className: "sc:size-3.5" }),
5058
5058
  label: "Bring Forward",
5059
5059
  disabled: N,
5060
- onClick: K(() => b(e.targetId))
5060
+ onClick: V(() => b(e.targetId))
5061
5061
  }
5062
5062
  ),
5063
5063
  /* @__PURE__ */ r(
@@ -5067,7 +5067,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5067
5067
  icon: /* @__PURE__ */ r(ze, { icon: _e.arrowDown, className: "sc:size-3.5" }),
5068
5068
  label: "Send Backward",
5069
5069
  disabled: N,
5070
- onClick: K(() => x(e.targetId))
5070
+ onClick: V(() => x(e.targetId))
5071
5071
  }
5072
5072
  ),
5073
5073
  /* @__PURE__ */ r(
@@ -5077,7 +5077,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5077
5077
  icon: /* @__PURE__ */ r(ze, { icon: _e.layerBackward, className: "sc:size-3.5" }),
5078
5078
  label: "Send to Back",
5079
5079
  disabled: N,
5080
- onClick: K(() => C(e.targetId))
5080
+ onClick: V(() => C(e.targetId))
5081
5081
  }
5082
5082
  ),
5083
5083
  (ne || w) && /* @__PURE__ */ r(ps, {}),
@@ -5088,7 +5088,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5088
5088
  icon: /* @__PURE__ */ r(ze, { icon: _e.group, className: "sc:size-3.5" }),
5089
5089
  label: "Group",
5090
5090
  disabled: D,
5091
- onClick: K(() => R(P))
5091
+ onClick: V(() => R(P))
5092
5092
  }
5093
5093
  ),
5094
5094
  w && /* @__PURE__ */ r(
@@ -5098,7 +5098,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5098
5098
  icon: /* @__PURE__ */ r(ze, { icon: _e.ungroup, className: "sc:size-3.5" }),
5099
5099
  label: "Ungroup",
5100
5100
  disabled: N,
5101
- onClick: K(() => E(e.targetId))
5101
+ onClick: V(() => E(e.targetId))
5102
5102
  }
5103
5103
  ),
5104
5104
  /* @__PURE__ */ r(ps, {}),
@@ -5110,7 +5110,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5110
5110
  label: "Delete",
5111
5111
  shortcut: "Del",
5112
5112
  className: "sc:text-[#d32f2f] sc:hover:bg-[rgba(211,47,47,0.1)] sc:hover:text-[#c62828]",
5113
- onClick: K(() => {
5113
+ onClick: V(() => {
5114
5114
  P.filter((u) => {
5115
5115
  var q;
5116
5116
  return !T((q = A(u)) == null ? void 0 : q.name);
@@ -5127,7 +5127,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5127
5127
  label: "Paste",
5128
5128
  shortcut: `${Zn}V`,
5129
5129
  disabled: !i,
5130
- onClick: K(() => o())
5130
+ onClick: V(() => o())
5131
5131
  }
5132
5132
  ),
5133
5133
  /* @__PURE__ */ r(
@@ -5137,7 +5137,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5137
5137
  icon: /* @__PURE__ */ r(ze, { icon: _e.selectAll, className: "sc:size-3.5" }),
5138
5138
  label: "Select All",
5139
5139
  shortcut: `${Zn}A`,
5140
- onClick: K(
5140
+ onClick: V(
5141
5141
  () => gr({
5142
5142
  elements: a,
5143
5143
  artboardManager: l,
@@ -5154,7 +5154,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5154
5154
  /* @__PURE__ */ r("div", { className: "sc-root", style: { display: "contents" }, children: O }),
5155
5155
  document.body
5156
5156
  );
5157
- }, Oi = 0.25, zi = 8, Xi = 0.1, Hi = 4, Yi = 1e-3, Wa = ({
5157
+ }, Oi = 0.25, zi = 8, Xi = 0.1, Li = 4, Yi = 1e-3, Wa = ({
5158
5158
  className: e,
5159
5159
  style: t,
5160
5160
  width: n,
@@ -5187,7 +5187,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5187
5187
  panOffset: D,
5188
5188
  setPanOffset: w,
5189
5189
  isPanning: ne,
5190
- setIsPanning: K,
5190
+ setIsPanning: V,
5191
5191
  userZoom: O,
5192
5192
  setUserZoom: u,
5193
5193
  resetUserView: q
@@ -5195,7 +5195,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5195
5195
  selectedId: U,
5196
5196
  multiSelection: te,
5197
5197
  handleSelectionChange: le,
5198
- setMultiSelection: L,
5198
+ setMultiSelection: H,
5199
5199
  handleActiveChildChange: xe,
5200
5200
  setHoveredElementId: ie,
5201
5201
  hideHandles: be
@@ -5207,89 +5207,89 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5207
5207
  }, [Te]), De = je.useRef(null), [$e, at] = je.useState(0), [pt, ct] = je.useState(0), [Pt, zt] = je.useState(!1), At = je.useRef(P), We = je.useRef(!1), [Ee, lt] = je.useState(!1), se = je.useRef(null);
5208
5208
  Eo({ enabled: m });
5209
5209
  const [h, G] = je.useState(null), re = je.useCallback(
5210
- (V) => {
5210
+ (K) => {
5211
5211
  G({
5212
- x: V.clientX,
5213
- y: V.clientY,
5214
- targetId: V.elementId
5212
+ x: K.clientX,
5213
+ y: K.clientY,
5214
+ targetId: K.elementId
5215
5215
  });
5216
5216
  },
5217
5217
  []
5218
5218
  ), he = je.useCallback(() => G(null), []), _ = A.getActiveArtboard(), Ce = je.useCallback(
5219
- (V) => {
5220
- if (!(a || V.ctrlKey || V.metaKey)) return;
5221
- V.preventDefault();
5219
+ (K) => {
5220
+ if (!(a || K.ctrlKey || K.metaKey)) return;
5221
+ K.preventDefault();
5222
5222
  const me = De.current;
5223
5223
  if (!me) return;
5224
- const Be = me.getBoundingClientRect(), Je = V.clientX - Be.left, Ge = V.clientY - Be.top, Fe = -V.deltaY * Yi;
5224
+ const Be = me.getBoundingClientRect(), Je = K.clientX - Be.left, Ge = K.clientY - Be.top, Fe = -K.deltaY * Yi;
5225
5225
  if (a) {
5226
- const nt = $e, st = Math.min(Math.max(nt * (1 + Fe), Xi), Hi);
5226
+ const nt = $e, st = Math.min(Math.max(nt * (1 + Fe), Xi), Li);
5227
5227
  if (st === nt) return;
5228
- const xt = st / nt, yt = Je - (Je - D.x) * xt, Lt = Ge - (Ge - D.y) * xt;
5229
- at(st), w({ x: yt, y: Lt });
5228
+ const xt = st / nt, yt = Je - (Je - D.x) * xt, Ht = Ge - (Ge - D.y) * xt;
5229
+ at(st), w({ x: yt, y: Ht });
5230
5230
  } else {
5231
5231
  const nt = O, st = Math.min(
5232
5232
  Math.max(nt * (1 + Fe), Oi),
5233
5233
  zi
5234
5234
  );
5235
5235
  if (st === nt) return;
5236
- const xt = st / nt, yt = Je - (Je - D.x) * xt, Lt = Ge - (Ge - D.y) * xt;
5237
- u(st), w({ x: yt, y: Lt });
5236
+ const xt = st / nt, yt = Je - (Je - D.x) * xt, Ht = Ge - (Ge - D.y) * xt;
5237
+ u(st), w({ x: yt, y: Ht });
5238
5238
  }
5239
5239
  },
5240
5240
  [a, $e, D, w, O, u]
5241
5241
  );
5242
5242
  je.useEffect(() => {
5243
- const V = De.current;
5244
- if (V)
5245
- return V.addEventListener("wheel", Ce, { passive: !1 }), () => V.removeEventListener("wheel", Ce);
5243
+ const K = De.current;
5244
+ if (K)
5245
+ return K.addEventListener("wheel", Ce, { passive: !1 }), () => K.removeEventListener("wheel", Ce);
5246
5246
  }, [Ce]), je.useEffect(() => {
5247
5247
  if (!a) return;
5248
- const V = (me) => {
5248
+ const K = (me) => {
5249
5249
  me.code === "Space" && !me.repeat && lt(!0);
5250
5250
  }, ue = (me) => {
5251
5251
  me.code === "Space" && (lt(!1), se.current = null);
5252
5252
  };
5253
- return window.addEventListener("keydown", V), window.addEventListener("keyup", ue), () => {
5254
- window.removeEventListener("keydown", V), window.removeEventListener("keyup", ue);
5253
+ return window.addEventListener("keydown", K), window.addEventListener("keyup", ue), () => {
5254
+ window.removeEventListener("keydown", K), window.removeEventListener("keyup", ue);
5255
5255
  };
5256
5256
  }, [a]);
5257
5257
  const Ie = je.useCallback(
5258
- (V) => {
5258
+ (K) => {
5259
5259
  if (!a) return;
5260
- const ue = V.button === 1, me = Ee && V.button === 0;
5261
- (ue || me) && (V.preventDefault(), V.target.setPointerCapture(V.pointerId), K(!0), se.current = {
5262
- x: V.clientX,
5263
- y: V.clientY,
5260
+ const ue = K.button === 1, me = Ee && K.button === 0;
5261
+ (ue || me) && (K.preventDefault(), K.target.setPointerCapture(K.pointerId), V(!0), se.current = {
5262
+ x: K.clientX,
5263
+ y: K.clientY,
5264
5264
  panX: D.x,
5265
5265
  panY: D.y
5266
5266
  });
5267
5267
  },
5268
- [a, Ee, D, K]
5269
- ), Ke = je.useCallback(
5270
- (V) => {
5268
+ [a, Ee, D, V]
5269
+ ), Ve = je.useCallback(
5270
+ (K) => {
5271
5271
  if (!ne || !se.current) return;
5272
- const ue = V.clientX - se.current.x, me = V.clientY - se.current.y;
5272
+ const ue = K.clientX - se.current.x, me = K.clientY - se.current.y;
5273
5273
  w({
5274
5274
  x: se.current.panX + ue,
5275
5275
  y: se.current.panY + me
5276
5276
  });
5277
5277
  },
5278
5278
  [ne, w]
5279
- ), Xe = je.useCallback((V) => {
5280
- ne && (V && V.target.releasePointerCapture(V.pointerId), K(!1), se.current = null);
5281
- }, [ne, K]);
5279
+ ), Xe = je.useCallback((K) => {
5280
+ ne && (K && K.target.releasePointerCapture(K.pointerId), V(!1), se.current = null);
5281
+ }, [ne, V]);
5282
5282
  je.useEffect(() => {
5283
5283
  if (!a || !ne) return;
5284
- const V = () => {
5285
- K(!1), se.current = null;
5284
+ const K = () => {
5285
+ V(!1), se.current = null;
5286
5286
  };
5287
- return window.addEventListener("pointerup", V), () => window.removeEventListener("pointerup", V);
5288
- }, [a, ne, K]);
5287
+ return window.addEventListener("pointerup", K), () => window.removeEventListener("pointerup", K);
5288
+ }, [a, ne, V]);
5289
5289
  const Y = je.useMemo(() => {
5290
5290
  if (!x || !b) return null;
5291
- const V = b.pieces ?? [];
5292
- if (V.length <= 1) return null;
5291
+ const K = b.pieces ?? [];
5292
+ if (K.length <= 1) return null;
5293
5293
  if (x === "spread")
5294
5294
  return _ ? {
5295
5295
  x: 0,
@@ -5297,7 +5297,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5297
5297
  width: _.width,
5298
5298
  height: _.height
5299
5299
  } : null;
5300
- const ue = V.find((me) => me.id === x.pieceId);
5300
+ const ue = K.find((me) => me.id === x.pieceId);
5301
5301
  return ue ? { x: ue.x, y: ue.y, width: ue.width, height: ue.height } : null;
5302
5302
  }, [x, b, _]), $ = Mo(Y);
5303
5303
  je.useEffect(() => {
@@ -5307,7 +5307,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5307
5307
  }
5308
5308
  if (!De.current || !_)
5309
5309
  return;
5310
- let V = 0;
5310
+ let K = 0;
5311
5311
  const ue = () => {
5312
5312
  if (!De.current || !_) return;
5313
5313
  const Je = De.current.clientWidth;
@@ -5317,7 +5317,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5317
5317
  if (x && x !== "spread" && b) {
5318
5318
  const xt = b.pieces ?? [];
5319
5319
  if (xt.length > 1) {
5320
- const yt = xt.find((Lt) => Lt.id === x.pieceId);
5320
+ const yt = xt.find((Ht) => Ht.id === x.pieceId);
5321
5321
  yt && (Ge = yt.width, Fe = yt.height);
5322
5322
  }
5323
5323
  }
@@ -5325,7 +5325,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5325
5325
  if (c !== void 0) {
5326
5326
  const xt = Je - c * 2, yt = Math.min(xt / Ge, 1);
5327
5327
  if ($ && f !== void 0) {
5328
- const Lt = f - c * 2, ve = Math.min(Lt / Fe, 1);
5328
+ const Ht = f - c * 2, ve = Math.min(Ht / Fe, 1);
5329
5329
  nt = Math.min(yt, ve), st = ve <= yt;
5330
5330
  } else if (nt = yt, f !== void 0 && Fe * nt + c * 2 > f) {
5331
5331
  const An = (f - c * 2) / Fe;
@@ -5336,8 +5336,8 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5336
5336
  at(nt), ct(Je), zt(st);
5337
5337
  };
5338
5338
  let me = !1;
5339
- We.current ? ue() : V = requestAnimationFrame(() => {
5340
- V = requestAnimationFrame(() => {
5339
+ We.current ? ue() : K = requestAnimationFrame(() => {
5340
+ K = requestAnimationFrame(() => {
5341
5341
  me || (ue(), We.current = !0);
5342
5342
  });
5343
5343
  });
@@ -5345,7 +5345,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5345
5345
  ue();
5346
5346
  });
5347
5347
  return Be.observe(De.current), () => {
5348
- me = !0, cancelAnimationFrame(V), Be.disconnect();
5348
+ me = !0, cancelAnimationFrame(K), Be.disconnect();
5349
5349
  };
5350
5350
  }, [o, _, i, c, f, x, b, $]);
5351
5351
  const ot = $e > 0 && O > 0 ? $e * O : $e;
@@ -5364,8 +5364,8 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5364
5364
  }, [ot, N]);
5365
5365
  const rt = je.useRef(null);
5366
5366
  je.useEffect(() => {
5367
- const V = $ && "id" in $ ? $.id ?? null : null;
5368
- V !== rt.current && (rt.current !== null && q(), rt.current = V);
5367
+ const K = $ && "id" in $ ? $.id ?? null : null;
5368
+ K !== rt.current && (rt.current !== null && q(), rt.current = K);
5369
5369
  }, [$, q]);
5370
5370
  const Ze = $ ? $.width : (_ == null ? void 0 : _.width) ?? 0, gt = $ ? $.height : (_ == null ? void 0 : _.height) ?? 0, Nt = Ze * ot, Dt = gt * ot, tn = Ze * $e;
5371
5371
  let Yt = _ ? c !== void 0 ? Dt + c * 2 : Dt / i : 0;
@@ -5375,11 +5375,11 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5375
5375
  c !== void 0 && Pt && rn > 0 && tn > 0 && (wt = (rn - tn) / 2);
5376
5376
  const on = Yt, Ut = je.useRef({ w: 0, h: 0 });
5377
5377
  je.useEffect(() => {
5378
- const V = De.current;
5379
- if (!V) return;
5378
+ const K = De.current;
5379
+ if (!K) return;
5380
5380
  Ut.current = {
5381
- w: V.clientWidth,
5382
- h: V.clientHeight
5381
+ w: K.clientWidth,
5382
+ h: K.clientHeight
5383
5383
  };
5384
5384
  const ue = new ResizeObserver((me) => {
5385
5385
  const Be = me[0];
@@ -5388,16 +5388,16 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5388
5388
  h: Be.contentRect.height
5389
5389
  });
5390
5390
  });
5391
- return ue.observe(V), () => ue.disconnect();
5391
+ return ue.observe(K), () => ue.disconnect();
5392
5392
  }, []), je.useEffect(() => {
5393
5393
  if (a) return;
5394
5394
  if (O <= 1.001) {
5395
5395
  (D.x !== 0 || D.y !== 0) && w({ x: 0, y: 0 });
5396
5396
  return;
5397
5397
  }
5398
- const V = Ut.current.w, ue = Ut.current.h;
5399
- if (V === 0 || ue === 0 || Nt === 0 || Dt === 0) return;
5400
- const me = 0.25 * Math.min(Nt, V), Be = 0.25 * Math.min(Dt, ue), Je = me - (wt ?? 0) - Nt, Ge = V - me - (wt ?? 0), Fe = Be - (Xt ?? 0) - Dt, nt = ue - Be - (Xt ?? 0), st = Math.max(Je, Math.min(Ge, D.x)), xt = Math.max(Fe, Math.min(nt, D.y));
5398
+ const K = Ut.current.w, ue = Ut.current.h;
5399
+ if (K === 0 || ue === 0 || Nt === 0 || Dt === 0) return;
5400
+ const me = 0.25 * Math.min(Nt, K), Be = 0.25 * Math.min(Dt, ue), Je = me - (wt ?? 0) - Nt, Ge = K - me - (wt ?? 0), Fe = Be - (Xt ?? 0) - Dt, nt = ue - Be - (Xt ?? 0), st = Math.max(Je, Math.min(Ge, D.x)), xt = Math.max(Fe, Math.min(nt, D.y));
5401
5401
  (st !== D.x || xt !== D.y) && w({ x: st, y: xt });
5402
5402
  }, [
5403
5403
  a,
@@ -5409,7 +5409,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5409
5409
  Xt,
5410
5410
  w
5411
5411
  ]);
5412
- const Ve = a ? {
5412
+ const Ke = a ? {
5413
5413
  // Interactive mode: full viewport with overflow hidden for infinite canvas feel
5414
5414
  position: "relative",
5415
5415
  width: n ? `${n}px` : "100%",
@@ -5455,9 +5455,9 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5455
5455
  {
5456
5456
  ref: De,
5457
5457
  className: e,
5458
- style: Ve,
5458
+ style: Ke,
5459
5459
  onPointerDown: a ? Ie : void 0,
5460
- onPointerMove: a ? Ke : void 0,
5460
+ onPointerMove: a ? Ve : void 0,
5461
5461
  onPointerUp: a ? Xe : void 0,
5462
5462
  onPointerLeave: a ? Xe : void 0,
5463
5463
  onPointerCancel: a ? Xe : void 0,
@@ -5475,9 +5475,9 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5475
5475
  setElements: I,
5476
5476
  executeElementUpdate: g,
5477
5477
  onSelectionChange: le,
5478
- onMultiSelectionChange: L,
5478
+ onMultiSelectionChange: H,
5479
5479
  onActiveChildChange: xe,
5480
- onTextSelectionChange: () => Se((V) => V + 1),
5480
+ onTextSelectionChange: () => Se((K) => K + 1),
5481
5481
  onHoverChange: ie,
5482
5482
  onCropModeEnter: Oe,
5483
5483
  onContextMenuRequest: re,
@@ -5503,18 +5503,18 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5503
5503
  _i,
5504
5504
  {
5505
5505
  userZoom: O,
5506
- onSetZoom: (V) => {
5507
- if (V <= 1.001) {
5506
+ onSetZoom: (K) => {
5507
+ if (K <= 1.001) {
5508
5508
  q();
5509
5509
  return;
5510
5510
  }
5511
5511
  const ue = De.current;
5512
5512
  if (!ue) {
5513
- u(V);
5513
+ u(K);
5514
5514
  return;
5515
5515
  }
5516
- const me = ue.getBoundingClientRect(), Be = me.width / 2, Je = me.height / 2, Ge = V / Math.max(O, 1e-4);
5517
- u(V), w({
5516
+ const me = ue.getBoundingClientRect(), Be = me.width / 2, Je = me.height / 2, Ge = K / Math.max(O, 1e-4);
5517
+ u(K), w({
5518
5518
  x: Be - (Be - D.x) * Ge,
5519
5519
  y: Je - (Je - D.y) * Ge
5520
5520
  });
@@ -5524,7 +5524,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5524
5524
  ]
5525
5525
  }
5526
5526
  );
5527
- }, Li = [1, 2, 4, 8];
5527
+ }, Hi = [1, 2, 4, 8];
5528
5528
  function _i({
5529
5529
  userZoom: e,
5530
5530
  onSetZoom: t
@@ -5567,7 +5567,7 @@ function _i({
5567
5567
  backdropFilter: "blur(6px)"
5568
5568
  },
5569
5569
  className: "sc:flex sc:flex-col sc:rounded-2xl sc:border sc:border-border/40 sc:bg-popover/95 sc:p-1 sc:shadow-lg",
5570
- children: Li.map((i) => {
5570
+ children: Hi.map((i) => {
5571
5571
  const a = i * 100, l = Math.abs(e - i) < 0.05;
5572
5572
  return /* @__PURE__ */ y(
5573
5573
  "button",
@@ -5620,10 +5620,10 @@ const is = /* @__PURE__ */ new Map();
5620
5620
  function It(e, t) {
5621
5621
  is.set(e, t);
5622
5622
  }
5623
- function Ka(e) {
5623
+ function Va(e) {
5624
5624
  return is.get(e);
5625
5625
  }
5626
- function Va() {
5626
+ function Ka() {
5627
5627
  return Array.from(is.keys());
5628
5628
  }
5629
5629
  function Ua() {
@@ -5648,12 +5648,12 @@ async function qa() {
5648
5648
  ] = await Promise.all([
5649
5649
  Promise.resolve().then(() => xa),
5650
5650
  Promise.resolve().then(() => ba),
5651
- import("./ImagePanel-CBgGqmVV.js"),
5651
+ import("./ImagePanel-CEr0_FYy.js"),
5652
5652
  Promise.resolve().then(() => Sa),
5653
5653
  Promise.resolve().then(() => ka),
5654
- import("./ContextualToolbars-C3D_6sep.js").then((c) => c.s),
5654
+ import("./ContextualToolbars-DRbuUE7W.js").then((c) => c.s),
5655
5655
  Promise.resolve().then(() => Ra),
5656
- import("./ContextualToolbars-C3D_6sep.js").then((c) => c.r)
5656
+ import("./ContextualToolbars-DRbuUE7W.js").then((c) => c.r)
5657
5657
  ]);
5658
5658
  It("effects-panel", {
5659
5659
  component: e,
@@ -5703,7 +5703,7 @@ function br() {
5703
5703
  icon: "gravity-ui:layers",
5704
5704
  position: "left"
5705
5705
  }), It("menu-button", {
5706
- component: Hr,
5706
+ component: Lr,
5707
5707
  label: "Menu",
5708
5708
  icon: "gravity-ui:bars",
5709
5709
  position: "topbar"
@@ -5713,7 +5713,7 @@ function br() {
5713
5713
  icon: "lucide:undo-2",
5714
5714
  position: "topbar"
5715
5715
  }), It("add-element-menu", {
5716
- component: Lr,
5716
+ component: Hr,
5717
5717
  label: "Add Element",
5718
5718
  icon: "gravity-ui:plus",
5719
5719
  position: "topbar"
@@ -5846,15 +5846,15 @@ const $i = ({ stroke: e, onChange: t }) => {
5846
5846
  /* @__PURE__ */ r(Tt, { children: "Line Cap" }),
5847
5847
  /* @__PURE__ */ y(ss, { value: l, onValueChange: x, orientation: "horizontal", children: [
5848
5848
  /* @__PURE__ */ y(dn, { children: [
5849
- /* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Vt, { value: "butt", id: "cap-butt", children: "Butt" }) }) }),
5849
+ /* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Kt, { value: "butt", id: "cap-butt", children: "Butt" }) }) }),
5850
5850
  /* @__PURE__ */ r(hn, { children: "Butt - Flat edges" })
5851
5851
  ] }),
5852
5852
  /* @__PURE__ */ y(dn, { children: [
5853
- /* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Vt, { value: "round", id: "cap-round", children: "Round" }) }) }),
5853
+ /* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Kt, { value: "round", id: "cap-round", children: "Round" }) }) }),
5854
5854
  /* @__PURE__ */ r(hn, { children: "Round - Rounded edges" })
5855
5855
  ] }),
5856
5856
  /* @__PURE__ */ y(dn, { children: [
5857
- /* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Vt, { value: "square", id: "cap-square", children: "Square" }) }) }),
5857
+ /* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Kt, { value: "square", id: "cap-square", children: "Square" }) }) }),
5858
5858
  /* @__PURE__ */ r(hn, { children: "Square - Extended square edges" })
5859
5859
  ] })
5860
5860
  ] })
@@ -5863,15 +5863,15 @@ const $i = ({ stroke: e, onChange: t }) => {
5863
5863
  /* @__PURE__ */ r(Tt, { children: "Line Join" }),
5864
5864
  /* @__PURE__ */ y(ss, { value: c, onValueChange: v, orientation: "horizontal", children: [
5865
5865
  /* @__PURE__ */ y(dn, { children: [
5866
- /* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Vt, { value: "miter", id: "join-miter", children: "Miter" }) }) }),
5866
+ /* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Kt, { value: "miter", id: "join-miter", children: "Miter" }) }) }),
5867
5867
  /* @__PURE__ */ r(hn, { children: "Miter - Sharp corners" })
5868
5868
  ] }),
5869
5869
  /* @__PURE__ */ y(dn, { children: [
5870
- /* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Vt, { value: "round", id: "join-round", children: "Round" }) }) }),
5870
+ /* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Kt, { value: "round", id: "join-round", children: "Round" }) }) }),
5871
5871
  /* @__PURE__ */ r(hn, { children: "Round - Rounded corners" })
5872
5872
  ] }),
5873
5873
  /* @__PURE__ */ y(dn, { children: [
5874
- /* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Vt, { value: "bevel", id: "join-bevel", children: "Bevel" }) }) }),
5874
+ /* @__PURE__ */ r(un, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Kt, { value: "bevel", id: "join-bevel", children: "Bevel" }) }) }),
5875
5875
  /* @__PURE__ */ r(hn, { children: "Bevel - Beveled corners" })
5876
5876
  ] })
5877
5877
  ] })
@@ -6270,7 +6270,7 @@ const $i = ({ stroke: e, onChange: t }) => {
6270
6270
  const m = {
6271
6271
  id: `mask-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
6272
6272
  type: d,
6273
- maskElement: Ki(d),
6273
+ maskElement: Vi(d),
6274
6274
  inverted: !1,
6275
6275
  feather: 0,
6276
6276
  opacity: 1
@@ -6391,7 +6391,7 @@ const $i = ({ stroke: e, onChange: t }) => {
6391
6391
  ] })
6392
6392
  ] });
6393
6393
  };
6394
- function Ki(e) {
6394
+ function Vi(e) {
6395
6395
  switch (e) {
6396
6396
  case "clip":
6397
6397
  return {
@@ -6449,7 +6449,7 @@ function Ki(e) {
6449
6449
  };
6450
6450
  }
6451
6451
  }
6452
- const Vi = {
6452
+ const Ki = {
6453
6453
  enabled: !0,
6454
6454
  style: "worn",
6455
6455
  intensity: 30,
@@ -6539,7 +6539,7 @@ const Vi = {
6539
6539
  seed: void 0
6540
6540
  }, ra = {
6541
6541
  worn: {
6542
- light: Vi,
6542
+ light: Ki,
6543
6543
  medium: Ui,
6544
6544
  heavy: Gi
6545
6545
  },
@@ -6582,7 +6582,7 @@ const ia = ({ distressEffect: e, onChange: t }) => {
6582
6582
  }, b = (g) => {
6583
6583
  if (e)
6584
6584
  if (g === "custom") {
6585
- const P = e.textureUrl || Vs[0].textureUrl;
6585
+ const P = e.textureUrl || Ks[0].textureUrl;
6586
6586
  Us(P), t({
6587
6587
  ...e,
6588
6588
  style: "custom",
@@ -6794,15 +6794,15 @@ const ia = ({ distressEffect: e, onChange: t }) => {
6794
6794
  /* @__PURE__ */ y(On, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
6795
6795
  /* @__PURE__ */ r(Tt, { children: "Style" }),
6796
6796
  /* @__PURE__ */ y(ss, { value: i, onValueChange: b, orientation: "horizontal", children: [
6797
- /* @__PURE__ */ r(Vt, { value: "worn", id: "style-worn", children: "Worn" }),
6798
- /* @__PURE__ */ r(Vt, { value: "cracked", id: "style-cracked", children: "Cracked" }),
6799
- /* @__PURE__ */ r(Vt, { value: "grunge", id: "style-grunge", children: "Grunge" }),
6800
- /* @__PURE__ */ r(Vt, { value: "retro", id: "style-retro", children: "Retro" }),
6801
- /* @__PURE__ */ r(Vt, { value: "custom", id: "style-custom", children: "Custom" })
6797
+ /* @__PURE__ */ r(Kt, { value: "worn", id: "style-worn", children: "Worn" }),
6798
+ /* @__PURE__ */ r(Kt, { value: "cracked", id: "style-cracked", children: "Cracked" }),
6799
+ /* @__PURE__ */ r(Kt, { value: "grunge", id: "style-grunge", children: "Grunge" }),
6800
+ /* @__PURE__ */ r(Kt, { value: "retro", id: "style-retro", children: "Retro" }),
6801
+ /* @__PURE__ */ r(Kt, { value: "custom", id: "style-custom", children: "Custom" })
6802
6802
  ] })
6803
6803
  ] }),
6804
6804
  i === "custom" && /* @__PURE__ */ y(Pn, { children: [
6805
- /* @__PURE__ */ r("div", { className: "sc:grid sc:grid-cols-4 sc:gap-1.5", children: Vs.map((g) => /* @__PURE__ */ r(
6805
+ /* @__PURE__ */ r("div", { className: "sc:grid sc:grid-cols-4 sc:gap-1.5", children: Ks.map((g) => /* @__PURE__ */ r(
6806
6806
  "button",
6807
6807
  {
6808
6808
  onClick: () => x(g.textureUrl),
@@ -6979,8 +6979,8 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
6979
6979
  /* @__PURE__ */ y(On, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
6980
6980
  /* @__PURE__ */ r(Tt, { children: "Blend Mode" }),
6981
6981
  /* @__PURE__ */ y(ss, { value: e, onValueChange: d, orientation: "horizontal", children: [
6982
- /* @__PURE__ */ r(Vt, { value: "normal", id: "blend-normal", children: "Normal" }),
6983
- /* @__PURE__ */ r(Vt, { value: "knockout", id: "blend-knockout", children: "Knockout" })
6982
+ /* @__PURE__ */ r(Kt, { value: "normal", id: "blend-normal", children: "Normal" }),
6983
+ /* @__PURE__ */ r(Kt, { value: "knockout", id: "blend-knockout", children: "Knockout" })
6984
6984
  ] })
6985
6985
  ] }),
6986
6986
  a && /* @__PURE__ */ y(Pn, { children: [
@@ -7246,12 +7246,12 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7246
7246
  }
7247
7247
  N(!0), (async () => {
7248
7248
  const le = /* @__PURE__ */ new Map();
7249
- for (const L of U)
7249
+ for (const H of U)
7250
7250
  try {
7251
- const xe = await Bn.getGlyphAlternates(e, L, t), ie = xe.length > 0 ? xe.length - 1 : 0;
7252
- le.set(L, ie);
7251
+ const xe = await Bn.getGlyphAlternates(e, H, t), ie = xe.length > 0 ? xe.length - 1 : 0;
7252
+ le.set(H, ie);
7253
7253
  } catch (xe) {
7254
- Rs.error(`Error loading alternates for '${L}':`, xe), le.set(L, 0);
7254
+ Rs.error(`Error loading alternates for '${H}':`, xe), le.set(H, 0);
7255
7255
  }
7256
7256
  g(le), N(!1);
7257
7257
  })();
@@ -7261,20 +7261,20 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7261
7261
  ...s,
7262
7262
  [U]: !te
7263
7263
  };
7264
- Object.keys(le).forEach((L) => {
7265
- le[L] || delete le[L];
7266
- }), e && Object.keys(le).length > 0 && Bn.loadFont(e, t).catch((L) => {
7267
- Rs.error("Error pre-loading font for OpenType features:", L);
7264
+ Object.keys(le).forEach((H) => {
7265
+ le[H] || delete le[H];
7266
+ }), e && Object.keys(le).length > 0 && Bn.loadFont(e, t).catch((H) => {
7267
+ Rs.error("Error pre-loading font for OpenType features:", H);
7268
7268
  }), i(Object.keys(le).length > 0 ? le : void 0);
7269
7269
  }, w = (U, te) => {
7270
7270
  C(U), E(te), T(!1), x(!0);
7271
7271
  }, ne = () => {
7272
7272
  T(!0), x(!0);
7273
- }, K = (U) => {
7273
+ }, V = (U) => {
7274
7274
  if (!a) return;
7275
7275
  let te = [...o];
7276
7276
  if (U) {
7277
- const le = te.findIndex((L) => L.charIndex === U.charIndex);
7277
+ const le = te.findIndex((H) => H.charIndex === U.charIndex);
7278
7278
  le >= 0 ? te[le] = U : te.push(U);
7279
7279
  } else
7280
7280
  te = te.filter((le) => le.charIndex !== v);
@@ -7351,10 +7351,10 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7351
7351
  }) })
7352
7352
  ] }),
7353
7353
  !m && e && f.length > 0 && /* @__PURE__ */ r(Pn, { children: Object.entries(q).map(([U, te]) => {
7354
- const le = te.filter((L) => f.includes(L.tag));
7354
+ const le = te.filter((H) => f.includes(H.tag));
7355
7355
  return le.length === 0 ? null : /* @__PURE__ */ y("div", { className: "sc:mb-lg", children: [
7356
7356
  /* @__PURE__ */ r("div", { className: "sc:mb-sm sc:text-2xs sc:font-semibold sc:uppercase sc:tracking-wide sc:text-text-secondary", children: U }),
7357
- /* @__PURE__ */ r("div", { className: "sc:flex sc:flex-col sc:gap-sm", children: le.map((L) => /* @__PURE__ */ y(
7357
+ /* @__PURE__ */ r("div", { className: "sc:flex sc:flex-col sc:gap-sm", children: le.map((H) => /* @__PURE__ */ y(
7358
7358
  "label",
7359
7359
  {
7360
7360
  className: "sc:flex sc:cursor-pointer sc:items-start sc:gap-sm sc:rounded sc:p-xs sc:transition-colors sc:duration-fast sc:hover:bg-surface",
@@ -7363,18 +7363,18 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7363
7363
  "input",
7364
7364
  {
7365
7365
  type: "checkbox",
7366
- checked: (s == null ? void 0 : s[L.tag]) || !1,
7367
- onChange: () => D(L.tag),
7366
+ checked: (s == null ? void 0 : s[H.tag]) || !1,
7367
+ onChange: () => D(H.tag),
7368
7368
  className: "sc:mt-[2px] sc:h-4 sc:w-4 sc:cursor-pointer sc:rounded sc:border-border-primary sc:bg-bg-input sc:accent-accent-primary"
7369
7369
  }
7370
7370
  ),
7371
7371
  /* @__PURE__ */ y("div", { className: "sc:flex-1", children: [
7372
- /* @__PURE__ */ r("div", { className: "sc:text-sm sc:font-medium", children: L.label }),
7373
- /* @__PURE__ */ r("div", { className: "sc:mt-[2px] sc:text-2xs sc:text-text-secondary", children: L.description })
7372
+ /* @__PURE__ */ r("div", { className: "sc:text-sm sc:font-medium", children: H.label }),
7373
+ /* @__PURE__ */ r("div", { className: "sc:mt-[2px] sc:text-2xs sc:text-text-secondary", children: H.description })
7374
7374
  ] })
7375
7375
  ]
7376
7376
  },
7377
- L.tag
7377
+ H.tag
7378
7378
  )) })
7379
7379
  ] }, U);
7380
7380
  }) })
@@ -7389,7 +7389,7 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7389
7389
  fontFamily: e,
7390
7390
  fontWeight: t,
7391
7391
  currentGlyphOverride: o.find((U) => U.charIndex === v),
7392
- onSelectGlyph: K,
7392
+ onSelectGlyph: V,
7393
7393
  browseAll: A
7394
7394
  }
7395
7395
  )
@@ -7586,10 +7586,10 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7586
7586
  progress: p,
7587
7587
  supportsWorkerExport: b,
7588
7588
  workerStats: x
7589
- } = Kr(), { artboardsInfo: v, activeArtboardId: C } = ar(), [R, E] = ce(t), [A, T] = ce(n), [I, g] = ce(500), P = async () => {
7589
+ } = Vr(), { artboardsInfo: v, activeArtboardId: C } = ar(), [R, E] = ce(t), [A, T] = ce(n), [I, g] = ce(500), P = async () => {
7590
7590
  if (C)
7591
7591
  try {
7592
- const w = await a(C, { scale: R, format: A }), ne = document.createElement("a"), K = v.find((q) => q.id === C), O = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19), u = (K == null ? void 0 : K.name) || "artboard";
7592
+ const w = await a(C, { scale: R, format: A }), ne = document.createElement("a"), V = v.find((q) => q.id === C), O = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19), u = (V == null ? void 0 : V.name) || "artboard";
7593
7593
  ne.download = `${u}-${O}.${A}`, ne.href = w, ne.click(), s && s({ [C]: w });
7594
7594
  } catch (w) {
7595
7595
  Js.error("Export failed:", w), alert("Export failed. Please try again.");
@@ -7597,8 +7597,8 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7597
7597
  }, N = async () => {
7598
7598
  try {
7599
7599
  const w = await l({ scale: R, format: A }), ne = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
7600
- Object.entries(w).forEach(([K, O]) => {
7601
- const u = v.find((te) => te.id === K), q = (u == null ? void 0 : u.name) || K, U = document.createElement("a");
7600
+ Object.entries(w).forEach(([V, O]) => {
7601
+ const u = v.find((te) => te.id === V), q = (u == null ? void 0 : u.name) || V, U = document.createElement("a");
7602
7602
  U.download = `${q}-${ne}.${A}`, U.href = O, U.click();
7603
7603
  }), s && s(w);
7604
7604
  } catch (w) {
@@ -8671,8 +8671,8 @@ export {
8671
8671
  ya as f,
8672
8672
  $a as g,
8673
8673
  Ua as h,
8674
- Ka as i,
8675
- Va as j,
8674
+ Va as i,
8675
+ Ka as j,
8676
8676
  qa as k,
8677
8677
  ja as l,
8678
8678
  It as m,
@@ -8683,4 +8683,4 @@ export {
8683
8683
  Ga as u,
8684
8684
  nc as v
8685
8685
  };
8686
- //# sourceMappingURL=validation-BGEl9rrE.js.map
8686
+ //# sourceMappingURL=validation-CsTlSvJJ.js.map