@anu3ev/fabric-image-editor 0.5.6 → 0.5.8

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 (2) hide show
  1. package/dist/main.js +480 -463
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -2,24 +2,24 @@ var ds = Object.defineProperty, ls = Object.defineProperties;
2
2
  var hs = Object.getOwnPropertyDescriptors;
3
3
  var Gt = Object.getOwnPropertySymbols;
4
4
  var _e = Object.prototype.hasOwnProperty, Ne = Object.prototype.propertyIsEnumerable;
5
- var Re = (h, t, e) => t in h ? ds(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, _ = (h, t) => {
5
+ var Re = (l, t, e) => t in l ? ds(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e, _ = (l, t) => {
6
6
  for (var e in t || (t = {}))
7
- _e.call(t, e) && Re(h, e, t[e]);
7
+ _e.call(t, e) && Re(l, e, t[e]);
8
8
  if (Gt)
9
9
  for (var e of Gt(t))
10
- Ne.call(t, e) && Re(h, e, t[e]);
11
- return h;
12
- }, yt = (h, t) => ls(h, hs(t));
13
- var vt = (h, t) => {
10
+ Ne.call(t, e) && Re(l, e, t[e]);
11
+ return l;
12
+ }, yt = (l, t) => ls(l, hs(t));
13
+ var vt = (l, t) => {
14
14
  var e = {};
15
- for (var s in h)
16
- _e.call(h, s) && t.indexOf(s) < 0 && (e[s] = h[s]);
17
- if (h != null && Gt)
18
- for (var s of Gt(h))
19
- t.indexOf(s) < 0 && Ne.call(h, s) && (e[s] = h[s]);
15
+ for (var s in l)
16
+ _e.call(l, s) && t.indexOf(s) < 0 && (e[s] = l[s]);
17
+ if (l != null && Gt)
18
+ for (var s of Gt(l))
19
+ t.indexOf(s) < 0 && Ne.call(l, s) && (e[s] = l[s]);
20
20
  return e;
21
21
  };
22
- var N = (h, t, e) => new Promise((s, o) => {
22
+ var N = (l, t, e) => new Promise((s, o) => {
23
23
  var n = (r) => {
24
24
  try {
25
25
  a(e.next(r));
@@ -33,9 +33,9 @@ var N = (h, t, e) => new Promise((s, o) => {
33
33
  o(c);
34
34
  }
35
35
  }, a = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(n, i);
36
- a((e = e.apply(h, t)).next());
36
+ a((e = e.apply(l, t)).next());
37
37
  });
38
- import { ActiveSelection as x, Textbox as nt, util as dt, controlsUtils as xe, InteractiveFabricObject as Be, Point as tt, FitContentLayout as ke, loadSVGFromURL as us, FabricImage as zt, Gradient as ze, Rect as gs, Circle as fs, Triangle as ps, Group as Et, Color as ms, classRegistry as Pe, loadSVGFromString as ys, Canvas as vs, Pattern as bs } from "fabric";
38
+ import { ActiveSelection as k, Textbox as nt, util as dt, controlsUtils as xe, InteractiveFabricObject as Be, Point as tt, FitContentLayout as ke, loadSVGFromURL as us, FabricImage as zt, Gradient as ze, Rect as gs, Circle as fs, Triangle as ps, Group as Et, Color as ms, classRegistry as Pe, loadSVGFromString as ys, Canvas as vs, Pattern as bs } from "fabric";
39
39
  import { create as Ms } from "jsondiffpatch";
40
40
  import ws from "diff-match-patch";
41
41
  var Ss = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", G = function() {
@@ -98,7 +98,7 @@ class Ut {
98
98
  if (o.length === 1)
99
99
  this.canvas.setActiveObject(o[0]);
100
100
  else {
101
- const i = new x(o, {
101
+ const i = new k(o, {
102
102
  canvas: this.canvas
103
103
  });
104
104
  this.canvas.setActiveObject(i);
@@ -106,7 +106,7 @@ class Ut {
106
106
  this.canvas.requestRenderAll();
107
107
  return;
108
108
  }
109
- const n = new x(t, {
109
+ const n = new k(t, {
110
110
  canvas: this.canvas
111
111
  });
112
112
  this.editor.objectLockManager.lockObject({
@@ -220,7 +220,7 @@ class Ut {
220
220
  if (o || n) return;
221
221
  this.isSpacePressed = !0, t.preventDefault();
222
222
  const i = e.getActiveObject() || null;
223
- i instanceof x ? this.savedSelection = i.getObjects().slice() : i && (this.savedSelection = [i]), e.discardActiveObject(), e.set({
223
+ i instanceof k ? this.savedSelection = i.getObjects().slice() : i && (this.savedSelection = [i]), e.discardActiveObject(), e.set({
224
224
  selection: !1,
225
225
  defaultCursor: "grab"
226
226
  }), e.setCursor("grab"), s.canvasManager.getObjects().forEach((a) => {
@@ -259,7 +259,7 @@ class Ut {
259
259
  e.setActiveObject(t[0]);
260
260
  return;
261
261
  }
262
- const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new x(o, { canvas: e });
262
+ const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new k(o, { canvas: e });
263
263
  e.setActiveObject(n);
264
264
  }
265
265
  // --- Обработчики для событий canvas (Fabric) ---
@@ -361,11 +361,11 @@ class Ut {
361
361
  if (c != null && c.length && r)
362
362
  for (const d of c)
363
363
  try {
364
- const l = r;
365
- if (l.matches && l.matches(d) || l.closest && l.closest(d))
364
+ const h = r;
365
+ if (h.matches && h.matches(d) || h.closest && h.closest(d))
366
366
  return !0;
367
- } catch (l) {
368
- console.warn(`Error checking selection container with selector "${d}":`, l);
367
+ } catch (h) {
368
+ console.warn(`Error checking selection container with selector "${d}":`, h);
369
369
  }
370
370
  }
371
371
  return !1;
@@ -409,11 +409,11 @@ class As {
409
409
  return this.loaders[t] ? (this.cache.has(t) || this.cache.set(t, this.loaders[t]()), this.cache.get(t)) : Promise.reject(new Error(`Unknown module "${t}"`));
410
410
  }
411
411
  }
412
- function js(h) {
412
+ function js(l) {
413
413
  return new Worker(
414
414
  "" + new URL("assets/worker-CN39s7P7.js", import.meta.url).href,
415
415
  {
416
- name: h == null ? void 0 : h.name
416
+ name: l == null ? void 0 : l.name
417
417
  }
418
418
  );
419
419
  }
@@ -464,23 +464,23 @@ class Is {
464
464
  }
465
465
  }
466
466
  const rt = 12, Cs = 2, le = 8, he = 20, Ts = 100, ue = 20, ge = 8, Es = 100, qt = 32, ye = 1, Os = "#2B2D33", ve = "#3D8BF4", be = "#FFFFFF";
467
- function Vt(h, t, e, s, o) {
467
+ function Vt(l, t, e, s, o) {
468
468
  const n = rt, i = Cs;
469
- h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = be, h.strokeStyle = ve, h.lineWidth = ye, h.beginPath(), h.roundRect(-n / 2, -n / 2, n, n, i), h.fill(), h.stroke(), h.restore();
469
+ l.save(), l.translate(t, e), l.rotate(dt.degreesToRadians(o.angle)), l.fillStyle = be, l.strokeStyle = ve, l.lineWidth = ye, l.beginPath(), l.roundRect(-n / 2, -n / 2, n, n, i), l.fill(), l.stroke(), l.restore();
470
470
  }
471
- function Ue(h, t, e, s, o) {
471
+ function Ue(l, t, e, s, o) {
472
472
  const n = le, i = he, a = Ts;
473
- h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = be, h.strokeStyle = ve, h.lineWidth = ye, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
473
+ l.save(), l.translate(t, e), l.rotate(dt.degreesToRadians(o.angle)), l.fillStyle = be, l.strokeStyle = ve, l.lineWidth = ye, l.beginPath(), l.roundRect(-n / 2, -i / 2, n, i, a), l.fill(), l.stroke(), l.restore();
474
474
  }
475
- function Ye(h, t, e, s, o) {
475
+ function Ye(l, t, e, s, o) {
476
476
  const n = ue, i = ge, a = Es;
477
- h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = be, h.strokeStyle = ve, h.lineWidth = ye, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
477
+ l.save(), l.translate(t, e), l.rotate(dt.degreesToRadians(o.angle)), l.fillStyle = be, l.strokeStyle = ve, l.lineWidth = ye, l.beginPath(), l.roundRect(-n / 2, -i / 2, n, i, a), l.fill(), l.stroke(), l.restore();
478
478
  }
479
479
  const Ls = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", es = new Image();
480
480
  es.src = Ls;
481
- function Ds(h, t, e, s, o) {
481
+ function Ds(l, t, e, s, o) {
482
482
  const i = qt / 2;
483
- h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = Os, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(es, -i / 2, -i / 2, i, i), h.restore();
483
+ l.save(), l.translate(t, e), l.rotate(dt.degreesToRadians(o.angle)), l.fillStyle = Os, l.beginPath(), l.arc(0, 0, i, 0, 2 * Math.PI), l.fill(), l.drawImage(es, -i / 2, -i / 2, i, i), l.restore();
484
484
  }
485
485
  const Rs = {
486
486
  // Угловые точки
@@ -589,7 +589,7 @@ class J {
589
589
  * Обновляет алгоритм расчёта границ ActiveSelection, чтобы учитывать фон и отступы текстовых объектов.
590
590
  */
591
591
  static patchActiveSelectionBounds() {
592
- const t = x.prototype, e = t._calcBoundsFromObjects;
592
+ const t = k.prototype, e = t._calcBoundsFromObjects;
593
593
  t._calcBoundsFromObjects = function(...n) {
594
594
  var g, f;
595
595
  const i = (f = (g = this.getObjects) == null ? void 0 : g.call(this)) != null ? f : [];
@@ -602,14 +602,14 @@ class J {
602
602
  });
603
603
  if (!a)
604
604
  return e ? e.apply(this, n) : void 0;
605
- const { left: r, top: c, width: d, height: l } = a;
605
+ const { left: r, top: c, width: d, height: h } = a;
606
606
  this.set({
607
607
  flipX: !1,
608
608
  flipY: !1,
609
609
  width: d,
610
- height: l
610
+ height: h
611
611
  });
612
- const u = new tt(r + d / 2, c + l / 2);
612
+ const u = new tt(r + d / 2, c + h / 2);
613
613
  return this.setPositionByOrigin(u, "center", "center"), a;
614
614
  };
615
615
  const s = t._onAfterObjectsChange;
@@ -624,7 +624,7 @@ class J {
624
624
  objects: r
625
625
  });
626
626
  if (!c) return a;
627
- const { left: d, top: l, width: u, height: g } = c, f = new tt(d + u / 2, l + g / 2);
627
+ const { left: d, top: h, width: u, height: g } = c, f = new tt(d + u / 2, h + g / 2);
628
628
  return this.set({
629
629
  width: u,
630
630
  height: g
@@ -635,7 +635,7 @@ class J {
635
635
  const { target: a, type: r, overrides: c } = i;
636
636
  if (r === "imperative" && c)
637
637
  return c;
638
- if (!(a instanceof x))
638
+ if (!(a instanceof k))
639
639
  return o.call(this, n, i);
640
640
  J.applyTextSelectionScalingLock({
641
641
  selection: a,
@@ -644,7 +644,7 @@ class J {
644
644
  const d = J.calculateActiveSelectionBounds({ objects: n });
645
645
  if (!d)
646
646
  return o.call(this, n, i);
647
- const { left: l, top: u, width: g, height: f } = d, p = new tt(g, f), m = new tt(l + g / 2, u + f / 2);
647
+ const { left: h, top: u, width: g, height: f } = d, p = new tt(g, f), m = new tt(h + g / 2, u + f / 2);
648
648
  return r === "initialization" ? {
649
649
  center: m,
650
650
  relativeCorrection: new tt(0, 0),
@@ -677,16 +677,16 @@ class J {
677
677
  selection: t,
678
678
  objects: e
679
679
  }) {
680
- const s = e.some((i) => i instanceof nt), o = t instanceof x && e.length > 1, n = s && o;
680
+ const s = e.some((o) => o instanceof nt);
681
681
  t.setControlsVisibility({
682
682
  mt: !s,
683
683
  mb: !s,
684
- ml: !n,
685
- mr: !n
684
+ ml: !0,
685
+ mr: !0
686
686
  });
687
687
  }
688
688
  }
689
- const k = class k {
689
+ const B = class B {
690
690
  constructor(t = []) {
691
691
  this.fonts = t;
692
692
  }
@@ -700,7 +700,7 @@ const k = class k {
700
700
  if (!t.length) return;
701
701
  const e = typeof document != "undefined" ? document : void 0;
702
702
  if (!e) return;
703
- const s = t.map((n) => k.loadFont(n, e));
703
+ const s = t.map((n) => B.loadFont(n, e));
704
704
  yield Promise.allSettled(s);
705
705
  });
706
706
  }
@@ -709,21 +709,21 @@ const k = class k {
709
709
  var c, d;
710
710
  const s = typeof FontFace != "undefined", o = (c = t.family) == null ? void 0 : c.trim(), n = (d = t.source) == null ? void 0 : d.trim();
711
711
  if (!o || !n) return;
712
- const i = k.normalizeFontSource(n), a = k.getDescriptorSnapshot(t.descriptors), r = k.getFontRegistrationKey(o, i, a);
713
- if (!k.registeredFontKeys.has(r)) {
714
- if (k.isFontFaceAlreadyApplied(e, o, a)) {
715
- k.registeredFontKeys.add(r);
712
+ const i = B.normalizeFontSource(n), a = B.getDescriptorSnapshot(t.descriptors), r = B.getFontRegistrationKey(o, i, a);
713
+ if (!B.registeredFontKeys.has(r)) {
714
+ if (B.isFontFaceAlreadyApplied(e, o, a)) {
715
+ B.registeredFontKeys.add(r);
716
716
  return;
717
717
  }
718
718
  if (s && e.fonts && typeof e.fonts.add == "function")
719
719
  try {
720
720
  const u = yield new FontFace(o, i, t.descriptors).load();
721
- e.fonts.add(u), k.registeredFontKeys.add(r);
721
+ e.fonts.add(u), B.registeredFontKeys.add(r);
722
722
  return;
723
- } catch (l) {
724
- console.warn(`Не удалось загрузить шрифт "${o}" через FontFace API`, l);
723
+ } catch (h) {
724
+ console.warn(`Не удалось загрузить шрифт "${o}" через FontFace API`, h);
725
725
  }
726
- k.injectFontFace({
726
+ B.injectFontFace({
727
727
  font: t,
728
728
  source: i,
729
729
  doc: e,
@@ -743,15 +743,15 @@ const k = class k {
743
743
  if (!i) return;
744
744
  const a = s.createElement("style");
745
745
  a.setAttribute("data-editor-font", i), a.setAttribute("data-editor-font-key", o);
746
- const r = k.descriptorsToCss(n), c = [
746
+ const r = B.descriptorsToCss(n), c = [
747
747
  "@font-face {",
748
- ` font-family: ${k.formatFontFamilyForCss(i)};`,
748
+ ` font-family: ${B.formatFontFamilyForCss(i)};`,
749
749
  ` src: ${e};`,
750
- ...r.map((l) => ` ${l}`),
750
+ ...r.map((h) => ` ${h}`),
751
751
  "}"
752
752
  ];
753
753
  a.textContent = c.join(`
754
- `), s.head.appendChild(a), k.registeredFontKeys.add(o);
754
+ `), s.head.appendChild(a), B.registeredFontKeys.add(o);
755
755
  }
756
756
  static normalizeFontSource(t) {
757
757
  const e = t.trim();
@@ -774,15 +774,15 @@ const k = class k {
774
774
  return t ? t.trim().replace(/^['"]+|['"]+$/g, "").toLowerCase() : "";
775
775
  }
776
776
  static getDescriptorSnapshot(t) {
777
- const e = k.descriptorDefaults;
777
+ const e = B.descriptorDefaults;
778
778
  return {
779
- style: k.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
780
- weight: k.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
781
- stretch: k.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
782
- unicodeRange: k.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
783
- variant: k.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
784
- featureSettings: k.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
785
- display: k.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
779
+ style: B.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
780
+ weight: B.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
781
+ stretch: B.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
782
+ unicodeRange: B.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
783
+ variant: B.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
784
+ featureSettings: B.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
785
+ display: B.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
786
786
  };
787
787
  }
788
788
  static areDescriptorSnapshotsEqual(t, e) {
@@ -790,7 +790,7 @@ const k = class k {
790
790
  }
791
791
  static getFontRegistrationKey(t, e, s) {
792
792
  return [
793
- k.normalizeFamilyName(t),
793
+ B.normalizeFamilyName(t),
794
794
  e,
795
795
  s.style,
796
796
  s.weight,
@@ -804,12 +804,12 @@ const k = class k {
804
804
  static isFontFaceAlreadyApplied(t, e, s) {
805
805
  const o = t.fonts;
806
806
  if (!o || typeof o.forEach != "function") return !1;
807
- const n = k.normalizeFamilyName(e);
807
+ const n = B.normalizeFamilyName(e);
808
808
  let i = !1;
809
809
  try {
810
810
  o.forEach((a) => {
811
- if (i || k.normalizeFamilyName(a.family) !== n) return;
812
- const c = k.getDescriptorSnapshot({
811
+ if (i || B.normalizeFamilyName(a.family) !== n) return;
812
+ const c = B.getDescriptorSnapshot({
813
813
  style: a.style,
814
814
  weight: a.weight,
815
815
  stretch: a.stretch,
@@ -818,7 +818,7 @@ const k = class k {
818
818
  featureSettings: a.featureSettings,
819
819
  display: a.display
820
820
  });
821
- k.areDescriptorSnapshotsEqual(s, c) && (i = !0);
821
+ B.areDescriptorSnapshotsEqual(s, c) && (i = !0);
822
822
  });
823
823
  } catch (a) {
824
824
  return console.warn("Не удалось проверить, загружен ли шрифт ранее через FontFaceSet", a), !1;
@@ -845,7 +845,7 @@ const k = class k {
845
845
  });
846
846
  }
847
847
  };
848
- k.registeredFontKeys = /* @__PURE__ */ new Set(), k.descriptorDefaults = {
848
+ B.registeredFontKeys = /* @__PURE__ */ new Set(), B.descriptorDefaults = {
849
849
  style: "normal",
850
850
  weight: "normal",
851
851
  stretch: "normal",
@@ -854,7 +854,7 @@ k.registeredFontKeys = /* @__PURE__ */ new Set(), k.descriptorDefaults = {
854
854
  featureSettings: "normal",
855
855
  display: "auto"
856
856
  };
857
- let fe = k;
857
+ let fe = B;
858
858
  const _s = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Ns = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMi41IDcuNWMwLS42OS41Ni0xLjI1IDEuMjUtMS4yNWgxMi41Yy42OSAwIDEuMjUuNTYgMS4yNSAxLjI1djguNzVjMCAuNjktLjU2IDEuMjUtMS4yNSAxLjI1SDMuNzVjLS42OSAwLTEuMjUtLjU2LTEuMjUtMS4yNVY3LjVabTEzLjc1IDBIMy43NXY4Ljc1aDEyLjVWNy41WiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAgMS44NzVhMi4xODggMi4xODggMCAwIDAtMi4xODggMi4xODh2Mi44MTJhLjYyNS42MjUgMCAxIDEtMS4yNSAwVjQuMDYyYTMuNDM3IDMuNDM3IDAgMSAxIDYuODc1IDB2Mi44MTNhLjYyNS42MjUgMCAxIDEtMS4yNSAwVjQuMDYyQTIuMTg4IDIuMTg4IDAgMCAwIDEwIDEuODc2WiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTEwIDEyLjgxM2EuOTM3LjkzNyAwIDEgMCAwLTEuODc1LjkzNy45MzcgMCAwIDAgMCAxLjg3NFoiLz48L3N2Zz4=", xs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE2LjI1IDYuMjVINy41VjQuMzc1YTIuNSAyLjUgMCAwIDEgMi41LTIuNWMxLjIgMCAyLjI4MS44NiAyLjUxMiAyYS42MjUuNjI1IDAgMCAwIDEuMjI2LS4yNWMtLjM1NC0xLjczOC0xLjkyNS0zLTMuNzM4LTNhMy43NTQgMy43NTQgMCAwIDAtMy43NSAzLjc1VjYuMjVoLTIuNUExLjI1IDEuMjUgMCAwIDAgMi41IDcuNXY4Ljc1YTEuMjUgMS4yNSAwIDAgMCAxLjI1IDEuMjVoMTIuNWExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjcuNWExLjI1IDEuMjUgMCAwIDAtMS4yNS0xLjI1Wm0wIDEwSDMuNzVWNy41aDEyLjV2OC43NVptLTUuMzEzLTQuMzc1YS45MzcuOTM3IDAgMSAxLTEuODc0IDAgLjkzNy45MzcgMCAwIDEgMS44NzQgMFoiLz48L3N2Zz4K", Bs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTIuNSA4LjEyNSAxMCAxMi41bDcuNS00LjM3NUwxMCAzLjc1IDIuNSA4LjEyNVoiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik05LjY4NSAzLjIxYS42MjUuNjI1IDAgMCAxIC42MyAwbDcuNSA0LjM3NWEuNjI1LjYyNSAwIDAgMSAwIDEuMDhsLTcuNSA0LjM3NWEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtNy41LTQuMzc1YS42MjUuNjI1IDAgMCAxIDAtMS4wOGw3LjUtNC4zNzVaTTMuNzQgOC4xMjUgMTAgMTEuNzc2bDYuMjYtMy42NTFMMTAgNC40NzQgMy43NCA4LjEyNVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiNmZmYiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTUuNCA5LjQ2YS42MjUuNjI1IDAgMCAxIC42MyAwTDEwIDExLjc3NmwzLjk3LTIuMzE2YS42MjUuNjI1IDAgMCAxIC42MyAwbDMuMjE1IDEuODc1YS42MjUuNjI1IDAgMCAxIDAgMS4wOGwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEgMC0xLjA4TDUuNCA5LjQ2Wm0tMS42NiAyLjQxNUwxMCAxNS41MjZsNi4yNi0zLjY1MS0xLjk3NC0xLjE1MS0zLjk3MSAyLjMxNmEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtMy45Ny0yLjMxNi0xLjk3NSAxLjE1MVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", ks = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOS42ODUgMy4yMWEuNjI1LjYyNSAwIDAgMSAuNjMgMGw3LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEgMCAxLjA4bC03LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEtLjYzIDBsLTcuNS00LjM3NWEuNjI1LjYyNSAwIDAgMSAwLTEuMDhsNy41LTQuMzc1Wk0zLjc0IDguMTI1IDEwIDExLjc3Nmw2LjI2LTMuNjUxTDEwIDQuNDc0IDMuNzQgOC4xMjVaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik01LjcxNCAxMCAxMCAxMi41bDQuMjg2LTIuNSAzLjIxNCAxLjg3NUwxMCAxNi4yNWwtNy41LTQuMzc1TDUuNzE0IDEwWiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNS40IDkuNDZhLjYyNS42MjUgMCAwIDEgLjYzIDBMMTAgMTEuNzc2bDMuOTctMi4zMTZhLjYyNS42MjUgMCAwIDEgLjYzIDBsMy4yMTUgMS44NzVhLjYyNS42MjUgMCAwIDEgMCAxLjA4bC03LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEtLjYzIDBsLTcuNS00LjM3NWEuNjI1LjYyNSAwIDAgMSAwLTEuMDhMNS40IDkuNDZabS0xLjY2IDIuNDE1TDEwIDE1LjUyNmw2LjI2LTMuNjUxLTEuOTc0LTEuMTUxLTMuOTcxIDIuMzE2YS42MjUuNjI1IDAgMCAxLS42MyAwbC0zLjk3LTIuMzE2LTEuOTc1IDEuMTUxWiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+", zs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0ibTIuNSA2LjI1IDcuNSA0LjM3NSA3LjUtNC4zNzVMMTAgMS44NzUgMi41IDYuMjVaIi8+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOS42ODUgMS4zMzVhLjYyNS42MjUgMCAwIDEgLjYzIDBsNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxIDAgMS4wOGwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEgMC0xLjA4bDcuNS00LjM3NVpNMy43NCA2LjI1IDEwIDkuOTAxbDYuMjYtMy42NTFMMTAgMi41OTkgMy43NCA2LjI1WiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNS40IDExLjMzNWEuNjI1LjYyNSAwIDAgMSAuNjMgMEwxMCAxMy42NTFsMy45Ny0yLjMxNmEuNjI1LjYyNSAwIDAgMSAuNjMgMGwzLjIxNSAxLjg3NWEuNjI1LjYyNSAwIDAgMSAwIDEuMDhsLTcuNSA0LjM3NWEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtNy41LTQuMzc1YS42MjUuNjI1IDAgMCAxIDAtMS4wOEw1LjQgMTEuMzM1Wk0zLjc0IDEzLjc1IDEwIDE3LjQwMWw2LjI2LTMuNjUxLTEuOTc0LTEuMTUxLTMuOTcxIDIuMzE2YS42MjUuNjI1IDAgMCAxLS42MyAwbC0zLjk3LTIuMzE2TDMuNzQgMTMuNzVaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik01LjQgNy41ODVhLjYyNS42MjUgMCAwIDEgLjYzIDBMMTAgOS45MDFsMy45Ny0yLjMxNmEuNjI1LjYyNSAwIDAgMSAuNjMgMGwzLjIxNSAxLjg3NWEuNjI1LjYyNSAwIDAgMSAwIDEuMDhsLTcuNSA0LjM3NWEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtNy41LTQuMzc1YS42MjUuNjI1IDAgMCAxIDAtMS4wOEw1LjQgNy41ODVaTTMuNzQgMTAgMTAgMTMuNjUxIDE2LjI2IDEwbC0xLjk3NC0xLjE1MS0zLjk3MSAyLjMxNmEuNjI1LjYyNSAwIDAgMS0uNjMgMGwtMy45Ny0yLjMxNkwzLjc0IDEwWiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+", Ps = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMS45NiAxMy40MzVhLjYyNS42MjUgMCAwIDEgLjg1NS0uMjI1TDEwIDE3LjQwMWw3LjE4NS00LjE5YS42MjUuNjI1IDAgMCAxIC42MyAxLjA3OWwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEtLjIyNS0uODU1Wk05LjY4NSAxLjMzNWEuNjI1LjYyNSAwIDAgMSAuNjMgMGw3LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEgMCAxLjA4bC03LjUgNC4zNzVhLjYyNS42MjUgMCAwIDEtLjYzIDBsLTcuNS00LjM3NWEuNjI1LjYyNSAwIDAgMSAwLTEuMDhsNy41LTQuMzc1Wk0zLjc0IDYuMjUgMTAgOS45MDFsNi4yNi0zLjY1MUwxMCAyLjU5OSAzLjc0IDYuMjVaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Im01LjcxNCAxMS44NzUgNC4yODYgMi41IDQuMjg2LTIuNUwxNy41IDEzLjc1IDEwIDE4LjEyNSAyLjUgMTMuNzVsMy4yMTQtMS44NzVaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48cGF0aCBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik01LjQgMTEuMzM1YS42MjUuNjI1IDAgMCAxIC42MyAwTDEwIDEzLjY1MWwzLjk3LTIuMzE2YS42MjUuNjI1IDAgMCAxIC42MyAwbDMuMjE1IDEuODc1YS42MjUuNjI1IDAgMCAxIDAgMS4wOGwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEgMC0xLjA4TDUuNCAxMS4zMzVaTTMuNzQgMTMuNzUgMTAgMTcuNDAxbDYuMjYtMy42NTEtMS45NzQtMS4xNTEtMy45NzEgMi4zMTZhLjYyNS42MjUgMCAwIDEtLjYzIDBsLTMuOTctMi4zMTZMMy43NCAxMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiNmZmYiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTUuNCA3LjU4NWEuNjI1LjYyNSAwIDAgMSAuNjMgMEwxMCA5LjkwMWwzLjk3LTIuMzE2YS42MjUuNjI1IDAgMCAxIC42MyAwbDMuMjE1IDEuODc1YS42MjUuNjI1IDAgMCAxIDAgMS4wOGwtNy41IDQuMzc1YS42MjUuNjI1IDAgMCAxLS42MyAwbC03LjUtNC4zNzVhLjYyNS42MjUgMCAwIDEgMC0xLjA4TDUuNCA3LjU4NVpNMy43NCAxMCAxMCAxMy42NTEgMTYuMjYgMTBsLTEuOTc0LTEuMTUxLTMuOTcxIDIuMzE2YS42MjUuNjI1IDAgMCAxLS42MyAwbC0zLjk3LTIuMzE2TDMuNzQgMTBaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=", Us = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI0VDNEU0MCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOC4xMjUgMS4yNUExLjg3NSAxLjg3NSAwIDAgMCA2LjI1IDMuMTI1di42MjVIMy4xMjVhLjYyNS42MjUgMCAwIDAgMCAxLjI1aC42MjV2MTEuMjVBMS4yNSAxLjI1IDAgMCAwIDUgMTcuNWgxMGExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjVoLjYyNWEuNjI1LjYyNSAwIDAgMCAwLTEuMjVIMTMuNzV2LS42MjVhMS44NzUgMS44NzUgMCAwIDAtMS44NzUtMS44NzVoLTMuNzVabTQuMzc1IDIuNXYtLjYyNWEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2LjYyNWg1Wk01IDE2LjI1VjVoMTB2MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Pt = {
859
859
  style: {
860
860
  position: "absolute",
@@ -932,29 +932,29 @@ const _s = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
932
932
  sendBackwards: ks
933
933
  },
934
934
  handlers: {
935
- copyPaste: (h) => N(null, null, function* () {
936
- h.clipboardManager.copyPaste();
935
+ copyPaste: (l) => N(null, null, function* () {
936
+ l.clipboardManager.copyPaste();
937
937
  }),
938
- delete: (h) => {
939
- h.deletionManager.deleteSelectedObjects();
938
+ delete: (l) => {
939
+ l.deletionManager.deleteSelectedObjects();
940
940
  },
941
- lock: (h) => {
942
- h.objectLockManager.lockObject();
941
+ lock: (l) => {
942
+ l.objectLockManager.lockObject();
943
943
  },
944
- unlock: (h) => {
945
- h.objectLockManager.unlockObject();
944
+ unlock: (l) => {
945
+ l.objectLockManager.unlockObject();
946
946
  },
947
- bringForward: (h) => {
948
- h.layerManager.bringForward();
947
+ bringForward: (l) => {
948
+ l.layerManager.bringForward();
949
949
  },
950
- bringToFront: (h) => {
951
- h.layerManager.bringToFront();
950
+ bringToFront: (l) => {
951
+ l.layerManager.bringToFront();
952
952
  },
953
- sendToBack: (h) => {
954
- h.layerManager.sendToBack();
953
+ sendToBack: (l) => {
954
+ l.layerManager.sendToBack();
955
955
  },
956
- sendBackwards: (h) => {
957
- h.layerManager.sendBackwards();
956
+ sendBackwards: (l) => {
957
+ l.layerManager.sendBackwards();
958
958
  }
959
959
  }
960
960
  };
@@ -1100,7 +1100,7 @@ const Fs = {
1100
1100
  "pointer-events": "none",
1101
1101
  "white-space": "nowrap",
1102
1102
  "box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
1103
- }, Fe = 16, He = 16, Hs = "fabric-editor-angle-indicator";
1103
+ }, Fe = 16, We = 16, Ws = "fabric-editor-angle-indicator";
1104
1104
  class Me {
1105
1105
  constructor({ editor: t }) {
1106
1106
  this.isActive = !1, this.currentAngle = 0, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._createDOM(), this._bindEvents();
@@ -1109,7 +1109,7 @@ class Me {
1109
1109
  * Создание DOM-элемента индикатора
1110
1110
  */
1111
1111
  _createDOM() {
1112
- this.el = document.createElement("div"), this.el.className = Hs, Object.entries(Fs).forEach(([t, e]) => {
1112
+ this.el = document.createElement("div"), this.el.className = Ws, Object.entries(Fs).forEach(([t, e]) => {
1113
1113
  this.el.style.setProperty(t, e);
1114
1114
  }), this.canvas.wrapperEl.appendChild(this.el);
1115
1115
  }
@@ -1160,9 +1160,9 @@ class Me {
1160
1160
  */
1161
1161
  _positionIndicator(t) {
1162
1162
  const e = this.canvas.wrapperEl.getBoundingClientRect();
1163
- let s = t.clientX - e.left + Fe, o = t.clientY - e.top + He;
1163
+ let s = t.clientX - e.left + Fe, o = t.clientY - e.top + We;
1164
1164
  const n = this.el.getBoundingClientRect(), i = n.width, a = n.height;
1165
- s + i > e.width && (s = t.clientX - e.left - i - Fe), o + a > e.height && (o = t.clientY - e.top - a - He), this.el.style.left = `${s}px`, this.el.style.top = `${o}px`;
1165
+ s + i > e.width && (s = t.clientX - e.left - i - Fe), o + a > e.height && (o = t.clientY - e.top - a - We), this.el.style.left = `${s}px`, this.el.style.top = `${o}px`;
1166
1166
  }
1167
1167
  /**
1168
1168
  * Показать индикатор
@@ -1381,14 +1381,14 @@ class Jt {
1381
1381
  if (!t) return;
1382
1382
  console.log("loadStateFromFullState fullState", t);
1383
1383
  const { canvas: e, canvasManager: s, interactionBlocker: o, backgroundManager: n } = this.editor, { width: i, height: a } = e;
1384
- o.overlayMask = null, Jt._serializeCustomData(t), yield e.loadFromJSON(t, (l, u) => {
1385
- Jt._deserializeCustomData(l, u);
1384
+ o.overlayMask = null, Jt._serializeCustomData(t), yield e.loadFromJSON(t, (h, u) => {
1385
+ Jt._deserializeCustomData(h, u);
1386
1386
  });
1387
- const r = e.getObjects().find((l) => l.id === "montage-area");
1387
+ const r = e.getObjects().find((h) => h.id === "montage-area");
1388
1388
  r && (this.editor.montageArea = r, (i !== e.getWidth() || a !== e.getHeight()) && s.updateCanvas());
1389
- const c = e.getObjects().find((l) => l.id === "overlay-mask");
1389
+ const c = e.getObjects().find((h) => h.id === "overlay-mask");
1390
1390
  c && (o.overlayMask = c, o.overlayMask.visible = !1);
1391
- const d = e.getObjects().find((l) => l.id === "background");
1391
+ const d = e.getObjects().find((h) => h.id === "background");
1392
1392
  d ? (n.backgroundObject = d, n.refresh()) : n.removeBackground({ withoutSave: !0 }), e.renderAll(), e.fire("editor:history-state-loaded", {
1393
1393
  fullState: t,
1394
1394
  currentIndex: this.currentIndex,
@@ -1479,8 +1479,8 @@ class Jt {
1479
1479
  ((i = (n = (o = this.canvas).getObjects) == null ? void 0 : n.call(o)) != null ? i : []).forEach((a) => {
1480
1480
  const r = typeof a.type == "string" ? a.type.toLowerCase() : "";
1481
1481
  if (!(r === "textbox" || r === "i-text" || typeof a.isEditing == "boolean") || a.locked) return;
1482
- const d = !!a.lockMovementX, l = !!a.lockMovementY;
1483
- !d && !l || (e.push({
1482
+ const d = !!a.lockMovementX, h = !!a.lockMovementY;
1483
+ !d && !h || (e.push({
1484
1484
  object: a,
1485
1485
  lockMovementX: a.lockMovementX,
1486
1486
  lockMovementY: a.lockMovementY,
@@ -1496,7 +1496,7 @@ class Jt {
1496
1496
  }
1497
1497
  }
1498
1498
  }
1499
- const Ws = 0.1, Zs = 2, We = 0.1, Gs = 90, Rt = 16, _t = 16, Mt = 4096, wt = 4096, Ze = "application/image-editor:", Xt = [
1499
+ const Hs = 0.1, Zs = 2, He = 0.1, Gs = 90, Rt = 16, _t = 16, Mt = 4096, wt = 4096, Ze = "application/image-editor:", Xt = [
1500
1500
  "format",
1501
1501
  "uppercase",
1502
1502
  "textCaseRaw",
@@ -1538,7 +1538,7 @@ class ct {
1538
1538
  withoutSelection: a = !1
1539
1539
  } = t;
1540
1540
  if (!e) return null;
1541
- const { canvas: r, montageArea: c, transformManager: d, historyManager: l, errorManager: u } = this.editor, g = yield this.getContentType(e), f = ct.getFormatFromContentType(g), { acceptContentTypes: p, acceptFormats: m } = this;
1541
+ const { canvas: r, montageArea: c, transformManager: d, historyManager: h, errorManager: u } = this.editor, g = yield this.getContentType(e), f = ct.getFormatFromContentType(g), { acceptContentTypes: p, acceptFormats: m } = this;
1542
1542
  if (!this.isAllowedContentType(g)) {
1543
1543
  const v = `Неверный contentType для изображения: ${g}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1544
1544
  return u.emitError({
@@ -1558,7 +1558,7 @@ class ct {
1558
1558
  }
1559
1559
  }), null;
1560
1560
  }
1561
- l.suspendHistory();
1561
+ h.suspendHistory();
1562
1562
  try {
1563
1563
  let v, b;
1564
1564
  if (e instanceof File)
@@ -1606,7 +1606,7 @@ class ct {
1606
1606
  const { width: A, height: j } = c, M = this.calculateScaleFactor({ imageObject: b, scaleType: s });
1607
1607
  s === "image-contain" && M < 1 ? d.fitObject({ object: b, type: "contain", withoutSave: !0 }) : s === "image-cover" && (I > A || y > j) && d.fitObject({ object: b, type: "cover", withoutSave: !0 });
1608
1608
  }
1609
- r.add(b), r.centerObject(b), a || r.setActiveObject(b), r.renderAll(), l.resumeHistory(), o || l.saveState();
1609
+ r.add(b), r.centerObject(b), a || r.setActiveObject(b), r.renderAll(), h.resumeHistory(), o || h.saveState();
1610
1610
  const w = {
1611
1611
  image: b,
1612
1612
  format: f,
@@ -1635,7 +1635,7 @@ class ct {
1635
1635
  isBackground: i,
1636
1636
  withoutSelection: a
1637
1637
  }
1638
- }), l.resumeHistory(), null;
1638
+ }), h.resumeHistory(), null;
1639
1639
  }
1640
1640
  });
1641
1641
  }
@@ -1688,10 +1688,10 @@ class ct {
1688
1688
  exportAsBlob: n = !1
1689
1689
  } = t, { canvas: i, montageArea: a, workerManager: r, interactionBlocker: c } = this.editor;
1690
1690
  try {
1691
- const d = s === "application/pdf", l = d ? "image/jpg" : s, u = ct.getFormatFromContentType(l);
1691
+ const d = s === "application/pdf", h = d ? "image/jpg" : s, u = ct.getFormatFromContentType(h);
1692
1692
  a.setCoords();
1693
1693
  const { left: g, top: f, width: p, height: m } = a.getBoundingRect(), v = yield i.clone(["id", "format", "locked"]);
1694
- v.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(l) && (v.backgroundColor = "#ffffff");
1694
+ v.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(h) && (v.backgroundColor = "#ffffff");
1695
1695
  const b = v.getObjects().find((S) => S.id === a.id);
1696
1696
  if (b && (b.visible = !1), c != null && c.isBlocked) {
1697
1697
  const S = v.getObjects().find((C) => C.id === c.overlayMask.id);
@@ -1702,7 +1702,7 @@ class ct {
1702
1702
  if (u === "svg" && I) {
1703
1703
  const S = v.toSVG();
1704
1704
  v.dispose();
1705
- const B = {
1705
+ const x = {
1706
1706
  image: ct._exportSVGStringAsFile(S, {
1707
1707
  exportAsBase64: o,
1708
1708
  exportAsBlob: n,
@@ -1712,18 +1712,18 @@ class ct {
1712
1712
  contentType: "image/svg+xml",
1713
1713
  fileName: e.replace(/\.[^/.]+$/, ".svg")
1714
1714
  };
1715
- return i.fire("editor:canvas-exported", B), B;
1715
+ return i.fire("editor:canvas-exported", x), x;
1716
1716
  }
1717
1717
  const y = yield new Promise((S, C) => {
1718
- v.getElement().toBlob((B) => {
1719
- B ? S(B) : C(new Error("Failed to create Blob from canvas"));
1718
+ v.getElement().toBlob((x) => {
1719
+ x ? S(x) : C(new Error("Failed to create Blob from canvas"));
1720
1720
  });
1721
1721
  });
1722
1722
  if (v.dispose(), n) {
1723
1723
  const S = {
1724
1724
  image: y,
1725
1725
  format: u,
1726
- contentType: l,
1726
+ contentType: h,
1727
1727
  fileName: e
1728
1728
  };
1729
1729
  return i.fire("editor:canvas-exported", S), S;
@@ -1734,12 +1734,12 @@ class ct {
1734
1734
  [w]
1735
1735
  );
1736
1736
  if (d) {
1737
- const C = p * 0.264583, B = m * 0.264583, F = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, U = new F({
1738
- orientation: C > B ? "landscape" : "portrait",
1737
+ const C = p * 0.264583, x = m * 0.264583, F = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, U = new F({
1738
+ orientation: C > x ? "landscape" : "portrait",
1739
1739
  unit: "mm",
1740
- format: [C, B]
1740
+ format: [C, x]
1741
1741
  });
1742
- if (U.addImage(String(A), "JPG", 0, 0, C, B), o) {
1742
+ if (U.addImage(String(A), "JPG", 0, 0, C, x), o) {
1743
1743
  const z = {
1744
1744
  image: U.output("datauristring"),
1745
1745
  format: "pdf",
@@ -1748,8 +1748,8 @@ class ct {
1748
1748
  };
1749
1749
  return i.fire("editor:canvas-exported", z), z;
1750
1750
  }
1751
- const H = U.output("blob"), L = {
1752
- image: new File([H], e, { type: "application/pdf" }),
1751
+ const W = U.output("blob"), L = {
1752
+ image: new File([W], e, { type: "application/pdf" }),
1753
1753
  format: "pdf",
1754
1754
  contentType: "application/pdf",
1755
1755
  fileName: e
@@ -1760,15 +1760,15 @@ class ct {
1760
1760
  const S = {
1761
1761
  image: A,
1762
1762
  format: u,
1763
- contentType: l,
1763
+ contentType: h,
1764
1764
  fileName: e
1765
1765
  };
1766
1766
  return i.fire("editor:canvas-exported", S), S;
1767
1767
  }
1768
1768
  const j = u === "svg" && !I ? e.replace(/\.[^/.]+$/, ".png") : e, T = {
1769
- image: new File([y], j, { type: l }),
1769
+ image: new File([y], j, { type: h }),
1770
1770
  format: u,
1771
- contentType: l,
1771
+ contentType: h,
1772
1772
  fileName: j
1773
1773
  };
1774
1774
  return i.fire("editor:canvas-exported", T), T;
@@ -1845,10 +1845,10 @@ class ct {
1845
1845
  };
1846
1846
  return a.fire("editor:object-exported", v), v;
1847
1847
  }
1848
- const l = c.toCanvasElement({
1848
+ const h = c.toCanvasElement({
1849
1849
  enableRetinaScaling: !1
1850
1850
  }), u = yield new Promise((p, m) => {
1851
- l.toBlob((v) => {
1851
+ h.toBlob((v) => {
1852
1852
  v ? p(v) : m(new Error("Failed to create Blob from canvas"));
1853
1853
  });
1854
1854
  });
@@ -1998,9 +1998,9 @@ class ct {
1998
1998
  return e ? e[1] : "";
1999
1999
  }
2000
2000
  }
2001
- const Tt = (h, t, e) => Math.max(Math.min(h, e), t), Ge = (h, t) => h * t, Xs = (h, t) => new tt(h / 2, t / 2);
2002
- function Ks(h) {
2003
- return ((h == null ? void 0 : h.type) === "image" || (h == null ? void 0 : h.format) === "svg") && typeof (h == null ? void 0 : h.width) == "number" && typeof (h == null ? void 0 : h.height) == "number";
2001
+ const Tt = (l, t, e) => Math.max(Math.min(l, e), t), Ge = (l, t) => l * t, Xs = (l, t) => new tt(l / 2, t / 2);
2002
+ function Ks(l) {
2003
+ return ((l == null ? void 0 : l.type) === "image" || (l == null ? void 0 : l.format) === "svg") && typeof (l == null ? void 0 : l.width) == "number" && typeof (l == null ? void 0 : l.height) == "number";
2004
2004
  }
2005
2005
  class Qs {
2006
2006
  /**
@@ -2039,8 +2039,8 @@ class Qs {
2039
2039
  this.setResolutionHeight(m);
2040
2040
  return;
2041
2041
  }
2042
- const { left: l, top: u } = this.getObjectDefaultCoords(i), g = n.getZoom();
2043
- n.setViewportTransform([g, 0, 0, g, l, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), n.fire("editor:resolution-width-changed", {
2042
+ const { left: h, top: u } = this.getObjectDefaultCoords(i), g = n.getZoom();
2043
+ n.setViewportTransform([g, 0, 0, g, h, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), n.fire("editor:resolution-width-changed", {
2044
2044
  width: d,
2045
2045
  preserveProportional: e,
2046
2046
  withoutSave: s,
@@ -2069,8 +2069,8 @@ class Qs {
2069
2069
  this.setResolutionWidth(m);
2070
2070
  return;
2071
2071
  }
2072
- const { left: l, top: u } = this.getObjectDefaultCoords(i), g = n.getZoom();
2073
- n.setViewportTransform([g, 0, 0, g, l, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), n.fire("editor:resolution-height-changed", {
2072
+ const { left: h, top: u } = this.getObjectDefaultCoords(i), g = n.getZoom();
2073
+ n.setViewportTransform([g, 0, 0, g, h, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), n.fire("editor:resolution-height-changed", {
2074
2074
  height: d,
2075
2075
  preserveProportional: e,
2076
2076
  withoutSave: s,
@@ -2156,22 +2156,22 @@ class Qs {
2156
2156
  if (a !== 0 || r !== 0) {
2157
2157
  const c = t.getActiveObject(), d = [];
2158
2158
  if ((c == null ? void 0 : c.type) === "activeselection") {
2159
- const l = c;
2160
- d.push(...l.getObjects()), t.discardActiveObject();
2159
+ const h = c;
2160
+ d.push(...h.getObjects()), t.discardActiveObject();
2161
2161
  }
2162
- if (t.getObjects().forEach((l) => {
2163
- l.id === "montage-area" || l.id === "overlay-mask" || l.id === "background" || (l.set({
2164
- left: l.left + a,
2165
- top: l.top + r
2166
- }), l.setCoords());
2162
+ if (t.getObjects().forEach((h) => {
2163
+ h.id === "montage-area" || h.id === "overlay-mask" || h.id === "background" || (h.set({
2164
+ left: h.left + a,
2165
+ top: h.top + r
2166
+ }), h.setCoords());
2167
2167
  }), d.length > 0)
2168
2168
  if (d.length === 1)
2169
2169
  t.setActiveObject(d[0]);
2170
2170
  else {
2171
- const l = new x(d, {
2171
+ const h = new k(d, {
2172
2172
  canvas: t
2173
2173
  });
2174
- t.setActiveObject(l);
2174
+ t.setActiveObject(h);
2175
2175
  }
2176
2176
  }
2177
2177
  t.renderAll(), t.fire("editor:canvas-updated", {
@@ -2335,16 +2335,16 @@ class Qs {
2335
2335
  }
2336
2336
  } = this.editor, c = t || o.getActiveObject();
2337
2337
  if (!Ks(c)) return;
2338
- const { width: d, height: l } = c;
2339
- let u = Math.min(d, Mt), g = Math.min(l, wt);
2338
+ const { width: d, height: h } = c;
2339
+ let u = Math.min(d, Mt), g = Math.min(h, wt);
2340
2340
  if (e) {
2341
2341
  const {
2342
2342
  width: f,
2343
2343
  height: p
2344
- } = n, m = d / f, v = l / p, b = Math.max(m, v);
2344
+ } = n, m = d / f, v = h / p, b = Math.max(m, v);
2345
2345
  u = f * b, g = p * b;
2346
2346
  }
2347
- this.setResolutionWidth(u, { withoutSave: !0 }), this.setResolutionHeight(g, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (d > a || l > r) && this.editor.zoomManager.calculateAndApplyDefaultZoom(), i.resetObject({ object: c, withoutSave: !0 }), o.centerObject(c), o.renderAll(), s || this.editor.historyManager.saveState(), o.fire("editor:montage-area-scaled-to-image", {
2347
+ this.setResolutionWidth(u, { withoutSave: !0 }), this.setResolutionHeight(g, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (d > a || h > r) && this.editor.zoomManager.calculateAndApplyDefaultZoom(), i.resetObject({ object: c, withoutSave: !0 }), o.centerObject(c), o.renderAll(), s || this.editor.historyManager.saveState(), o.fire("editor:montage-area-scaled-to-image", {
2348
2348
  object: c,
2349
2349
  width: u,
2350
2350
  height: g,
@@ -2455,7 +2455,7 @@ class qs {
2455
2455
  withoutSave: s
2456
2456
  } = {}) {
2457
2457
  const { canvas: o, historyManager: n } = this.editor, i = t || o.getActiveObject();
2458
- i && (i instanceof x ? i.getObjects().forEach((a) => {
2458
+ i && (i instanceof k ? i.getObjects().forEach((a) => {
2459
2459
  a.set("opacity", e);
2460
2460
  }) : i.set("opacity", e), o.renderAll(), s || n.saveState(), o.fire("editor:object-opacity-changed", {
2461
2461
  object: i,
@@ -2482,12 +2482,12 @@ class qs {
2482
2482
  } = {}) {
2483
2483
  const { canvas: n, historyManager: i } = this.editor, a = t || n.getActiveObject();
2484
2484
  if (a) {
2485
- if (a instanceof x && !o) {
2485
+ if (a instanceof k && !o) {
2486
2486
  const r = a.getObjects();
2487
2487
  n.discardActiveObject(), r.forEach((d) => {
2488
2488
  this._fitSingleObject(d, e);
2489
2489
  });
2490
- const c = new x(r, { canvas: n });
2490
+ const c = new k(r, { canvas: n });
2491
2491
  n.setActiveObject(c);
2492
2492
  } else
2493
2493
  this._fitSingleObject(a, e);
@@ -2506,7 +2506,7 @@ class qs {
2506
2506
  * @private
2507
2507
  */
2508
2508
  _fitSingleObject(t, e) {
2509
- const { canvas: s, montageArea: o } = this.editor, { width: n, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, d = n * Math.abs(a), l = i * Math.abs(r), u = c * Math.PI / 180, g = Math.abs(Math.cos(u)), f = Math.abs(Math.sin(u)), p = d * g + l * f, m = d * f + l * g, v = o.width, b = o.height;
2509
+ const { canvas: s, montageArea: o } = this.editor, { width: n, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, d = n * Math.abs(a), h = i * Math.abs(r), u = c * Math.PI / 180, g = Math.abs(Math.cos(u)), f = Math.abs(Math.sin(u)), p = d * g + h * f, m = d * f + h * g, v = o.width, b = o.height;
2510
2510
  let I;
2511
2511
  e === "contain" ? I = Math.min(v / p, b / m) : I = Math.max(v / p, b / m), t.set({
2512
2512
  scaleX: a * I,
@@ -2547,11 +2547,11 @@ class qs {
2547
2547
  }), e)
2548
2548
  this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 });
2549
2549
  else {
2550
- const { width: l, height: u } = n, { width: g, height: f } = c, p = i.calculateScaleFactor({
2550
+ const { width: h, height: u } = n, { width: g, height: f } = c, p = i.calculateScaleFactor({
2551
2551
  imageObject: c,
2552
2552
  scaleType: r
2553
2553
  });
2554
- r === "contain" && p < 1 || r === "cover" && (g > l || f > u) ? this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 }) : c.set({ scaleX: 1, scaleY: 1 });
2554
+ r === "contain" && p < 1 || r === "cover" && (g > h || f > u) ? this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 }) : c.set({ scaleX: 1, scaleY: 1 });
2555
2555
  }
2556
2556
  c.set({ flipX: !1, flipY: !1, angle: 0 }), o.centerObject(c), o.renderAll(), a.resumeHistory(), s || a.saveState(), o.fire("editor:object-reset", {
2557
2557
  object: c,
@@ -2562,7 +2562,7 @@ class qs {
2562
2562
  }
2563
2563
  class Js {
2564
2564
  constructor({ editor: t }) {
2565
- this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || Ws, this.maxZoom = this.options.maxZoom || Zs, this.defaultZoom = this.options.defaultScale;
2565
+ this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || Hs, this.maxZoom = this.options.maxZoom || Zs, this.defaultZoom = this.options.defaultScale;
2566
2566
  }
2567
2567
  /**
2568
2568
  * Вспомогательный метод для вычисления размеров масштабированной монтажной области
@@ -2584,7 +2584,7 @@ class Js {
2584
2584
  * @private
2585
2585
  */
2586
2586
  _getClampedPointerCoordinates(t) {
2587
- const { canvas: e, montageArea: s } = this.editor, o = e.getPointer(t, !0), n = e.viewportTransform, i = e.getZoom(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, l = a * i + n[4], u = r * i + n[4], g = c * i + n[5], f = d * i + n[5], p = Math.max(l, Math.min(u, o.x)), m = Math.max(g, Math.min(f, o.y));
2587
+ const { canvas: e, montageArea: s } = this.editor, o = e.getPointer(t, !0), n = e.viewportTransform, i = e.getZoom(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, h = a * i + n[4], u = r * i + n[4], g = c * i + n[5], f = d * i + n[5], p = Math.max(h, Math.min(u, o.x)), m = Math.max(g, Math.min(f, o.y));
2588
2588
  return {
2589
2589
  x: p,
2590
2590
  y: m
@@ -2619,9 +2619,9 @@ class Js {
2619
2619
  * @private
2620
2620
  */
2621
2621
  _calculateEmptySpaceRatio(t) {
2622
- const { canvas: e, montageArea: s } = this.editor, o = e.viewportTransform, n = e.getWidth(), i = e.getHeight(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, l = -o[4] / t, u = (-o[4] + n) / t, g = -o[5] / t, f = (-o[5] + i) / t, p = l < a, m = u > r, v = g < c, b = f > d;
2622
+ const { canvas: e, montageArea: s } = this.editor, o = e.viewportTransform, n = e.getWidth(), i = e.getHeight(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, h = -o[4] / t, u = (-o[4] + n) / t, g = -o[5] / t, f = (-o[5] + i) / t, p = h < a, m = u > r, v = g < c, b = f > d;
2623
2623
  if (!(p || m || v || b)) return 0;
2624
- const y = Math.max(0, a - l), w = Math.max(0, u - r), A = Math.max(0, c - g), j = Math.max(0, f - d), M = Math.max(y, w), T = Math.max(A, j), S = M / n, C = T / i;
2624
+ const y = Math.max(0, a - h), w = Math.max(0, u - r), A = Math.max(0, c - g), j = Math.max(0, f - d), M = Math.max(y, w), T = Math.max(A, j), S = M / n, C = T / i;
2625
2625
  return Math.max(S, C);
2626
2626
  }
2627
2627
  /**
@@ -2635,11 +2635,11 @@ class Js {
2635
2635
  * @private
2636
2636
  */
2637
2637
  _calculateSmoothCenteringStep(t, e, s, o, n) {
2638
- const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), d = i.getHeight(), l = t.x - r[4], u = t.y - r[5], g = Math.abs(o), f = e - s;
2638
+ const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), d = i.getHeight(), h = t.x - r[4], u = t.y - r[5], g = Math.abs(o), f = e - s;
2639
2639
  if (Math.abs(f) / g <= 0.1)
2640
- return { x: l, y: u };
2641
- const m = c / 2, v = d / 2, b = a.left, I = a.top, y = m - b * s, w = v - I * s, A = (y - r[4]) / (e - s), j = (w - r[5]) / (e - s), M = A * g, T = j * g, S = M * n, C = T * n, B = Math.abs(S) > Math.abs(l) ? l : S, F = Math.abs(C) > Math.abs(u) ? u : C;
2642
- return { x: B, y: F };
2640
+ return { x: h, y: u };
2641
+ const m = c / 2, v = d / 2, b = a.left, I = a.top, y = m - b * s, w = v - I * s, A = (y - r[4]) / (e - s), j = (w - r[5]) / (e - s), M = A * g, T = j * g, S = M * n, C = T * n, x = Math.abs(S) > Math.abs(h) ? h : S, F = Math.abs(C) > Math.abs(u) ? u : C;
2642
+ return { x, y: F };
2643
2643
  }
2644
2644
  /**
2645
2645
  * Применяет плавное центрирование viewport при приближении к defaultZoom.
@@ -2651,7 +2651,7 @@ class Js {
2651
2651
  * @returns true если центрирование было применено
2652
2652
  * @private
2653
2653
  */
2654
- _applyViewportCentering(t, e = !1, s = We) {
2654
+ _applyViewportCentering(t, e = !1, s = He) {
2655
2655
  const { canvas: o } = this.editor, n = this._getScaledMontageDimensions(t), i = o.getWidth(), a = o.getHeight(), r = n.width > i || n.height > a, c = this._calculateFitZoom(), d = t - c;
2656
2656
  if (!(!r || d) && !e)
2657
2657
  return !1;
@@ -2712,10 +2712,10 @@ class Js {
2712
2712
  });
2713
2713
  return;
2714
2714
  }
2715
- const l = this._getClampedPointerCoordinates(e);
2715
+ const h = this._getClampedPointerCoordinates(e);
2716
2716
  this.zoom(t, {
2717
- pointX: l.x,
2718
- pointY: l.y
2717
+ pointX: h.x,
2718
+ pointY: h.y
2719
2719
  });
2720
2720
  }
2721
2721
  /**
@@ -2726,16 +2726,16 @@ class Js {
2726
2726
  * @param options.pointY - Координата Y точки зума
2727
2727
  * @fires editor:zoom-changed
2728
2728
  */
2729
- zoom(t = We, e = {}) {
2729
+ zoom(t = He, e = {}) {
2730
2730
  var g, f;
2731
2731
  if (!t) return;
2732
- const { minZoom: s, maxZoom: o } = this, { canvas: n } = this.editor, i = t < 0, a = n.getZoom(), r = n.getCenterPoint(), c = (g = e.pointX) != null ? g : r.x, d = (f = e.pointY) != null ? f : r.y, l = new tt(c, d);
2732
+ const { minZoom: s, maxZoom: o } = this, { canvas: n } = this.editor, i = t < 0, a = n.getZoom(), r = n.getCenterPoint(), c = (g = e.pointX) != null ? g : r.x, d = (f = e.pointY) != null ? f : r.y, h = new tt(c, d);
2733
2733
  this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
2734
2734
  let u = Number((a + Number(t)).toFixed(3));
2735
- u > o && (u = o), u < s && (u = s), n.zoomToPoint(l, u), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(u, i, t), n.fire("editor:zoom-changed", {
2735
+ u > o && (u = o), u < s && (u = s), n.zoomToPoint(h, u), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(u, i, t), n.fire("editor:zoom-changed", {
2736
2736
  currentZoom: n.getZoom(),
2737
2737
  zoom: u,
2738
- point: l
2738
+ point: h
2739
2739
  });
2740
2740
  }
2741
2741
  /**
@@ -2911,8 +2911,9 @@ class Ot {
2911
2911
  endColor: s,
2912
2912
  startPosition: o,
2913
2913
  endPosition: n,
2914
- customData: i = {},
2915
- withoutSave: a = !1
2914
+ colorStops: i,
2915
+ customData: a = {},
2916
+ withoutSave: r = !1
2916
2917
  }) {
2917
2918
  this.setGradientBackground({
2918
2919
  gradient: {
@@ -2921,10 +2922,11 @@ class Ot {
2921
2922
  startColor: e,
2922
2923
  endColor: s,
2923
2924
  startPosition: o,
2924
- endPosition: n
2925
+ endPosition: n,
2926
+ colorStops: i
2925
2927
  },
2926
- customData: i,
2927
- withoutSave: a
2928
+ customData: a,
2929
+ withoutSave: r
2928
2930
  });
2929
2931
  }
2930
2932
  /**
@@ -2939,8 +2941,9 @@ class Ot {
2939
2941
  endColor: n,
2940
2942
  startPosition: i,
2941
2943
  endPosition: a,
2942
- customData: r = {},
2943
- withoutSave: c = !1
2944
+ colorStops: r,
2945
+ customData: c = {},
2946
+ withoutSave: d = !1
2944
2947
  }) {
2945
2948
  this.setGradientBackground({
2946
2949
  gradient: {
@@ -2951,10 +2954,11 @@ class Ot {
2951
2954
  startColor: o,
2952
2955
  endColor: n,
2953
2956
  startPosition: i,
2954
- endPosition: a
2957
+ endPosition: a,
2958
+ colorStops: r
2955
2959
  },
2956
- customData: r,
2957
- withoutSave: c
2960
+ customData: c,
2961
+ withoutSave: d
2958
2962
  });
2959
2963
  }
2960
2964
  /**
@@ -3095,37 +3099,45 @@ class Ot {
3095
3099
  startColor: e,
3096
3100
  endColor: s,
3097
3101
  startPosition: o = 0,
3098
- endPosition: n = 100
3099
- } = t, i = [
3102
+ endPosition: n = 100,
3103
+ colorStops: i
3104
+ } = t;
3105
+ let a;
3106
+ if (i && i.length > 0 ? a = i.map((u) => ({
3107
+ offset: u.offset / 100,
3108
+ color: u.color
3109
+ })) : e && s ? a = [
3100
3110
  { offset: o / 100, color: e },
3101
3111
  { offset: n / 100, color: s }
3102
- ];
3103
- if (t.type === "linear") {
3104
- const l = t.angle * Math.PI / 180, u = Ot._angleToCoords(l);
3112
+ ] : a = [
3113
+ { offset: 0, color: "#000000" },
3114
+ { offset: 1, color: "#ffffff" }
3115
+ ], t.type === "linear") {
3116
+ const u = t.angle * Math.PI / 180, g = Ot._angleToCoords(u);
3105
3117
  return new ze({
3106
3118
  type: "linear",
3107
3119
  gradientUnits: "percentage",
3108
- coords: u,
3109
- colorStops: i
3120
+ coords: g,
3121
+ colorStops: a
3110
3122
  });
3111
3123
  }
3112
3124
  const {
3113
- centerX: a = 50,
3114
- centerY: r = 50,
3115
- radius: c = 50
3116
- } = t, d = {
3117
- x1: a / 100,
3118
- y1: r / 100,
3119
- x2: a / 100,
3120
- y2: r / 100,
3125
+ centerX: r = 50,
3126
+ centerY: c = 50,
3127
+ radius: d = 50
3128
+ } = t, h = {
3129
+ x1: r / 100,
3130
+ y1: c / 100,
3131
+ x2: r / 100,
3132
+ y2: c / 100,
3121
3133
  r1: 0,
3122
- r2: c / 100
3134
+ r2: d / 100
3123
3135
  };
3124
3136
  return new ze({
3125
3137
  type: "radial",
3126
3138
  gradientUnits: "percentage",
3127
- coords: d,
3128
- colorStops: i
3139
+ coords: h,
3140
+ colorStops: a
3129
3141
  });
3130
3142
  }
3131
3143
  /**
@@ -3171,7 +3183,7 @@ class $t {
3171
3183
  const { canvas: s, historyManager: o } = this.editor;
3172
3184
  o.suspendHistory();
3173
3185
  const n = t || s.getActiveObject();
3174
- n && (n instanceof x ? n.getObjects().forEach((i) => {
3186
+ n && (n instanceof k ? n.getObjects().forEach((i) => {
3175
3187
  s.bringObjectToFront(i);
3176
3188
  }) : s.bringObjectToFront(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-to-front", {
3177
3189
  object: n,
@@ -3189,7 +3201,7 @@ class $t {
3189
3201
  const { canvas: s, historyManager: o } = this.editor;
3190
3202
  o.suspendHistory();
3191
3203
  const n = t || s.getActiveObject();
3192
- n && (n instanceof x ? $t._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
3204
+ n && (n instanceof k ? $t._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
3193
3205
  object: n,
3194
3206
  withoutSave: e
3195
3207
  }));
@@ -3212,7 +3224,7 @@ class $t {
3212
3224
  n.suspendHistory();
3213
3225
  const r = t || s.getActiveObject();
3214
3226
  if (r) {
3215
- if (r instanceof x) {
3227
+ if (r instanceof k) {
3216
3228
  const c = r.getObjects();
3217
3229
  for (let d = c.length - 1; d >= 0; d -= 1)
3218
3230
  s.sendObjectToBack(c[d]);
@@ -3240,7 +3252,7 @@ class $t {
3240
3252
  } = this.editor;
3241
3253
  n.suspendHistory();
3242
3254
  const r = t || s.getActiveObject();
3243
- r && (r instanceof x ? $t._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(o), i && s.sendObjectToBack(i), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-send-backwards", {
3255
+ r && (r instanceof k ? $t._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(o), i && s.sendObjectToBack(i), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-send-backwards", {
3244
3256
  object: r,
3245
3257
  withoutSave: e
3246
3258
  }));
@@ -3309,14 +3321,14 @@ class to {
3309
3321
  * @param flags.withoutAdding - Не добавлять объект в canvas
3310
3322
  */
3311
3323
  addRectangle(d = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3312
- var l = d, {
3324
+ var h = d, {
3313
3325
  id: t = `rect-${G()}`,
3314
3326
  left: e,
3315
3327
  top: s,
3316
3328
  width: o = 100,
3317
3329
  height: n = 100,
3318
3330
  fill: i = "blue"
3319
- } = l, a = vt(l, [
3331
+ } = h, a = vt(h, [
3320
3332
  "id",
3321
3333
  "left",
3322
3334
  "top",
@@ -3364,14 +3376,14 @@ class to {
3364
3376
  "radius",
3365
3377
  "fill"
3366
3378
  ]);
3367
- const { canvas: l } = this.editor, u = new fs(_({
3379
+ const { canvas: h } = this.editor, u = new fs(_({
3368
3380
  id: t,
3369
3381
  left: e,
3370
3382
  top: s,
3371
3383
  fill: n,
3372
3384
  radius: o
3373
3385
  }, i));
3374
- return !e && !s && l.centerObject(u), r || (l.add(u), a || l.setActiveObject(u), l.renderAll()), u;
3386
+ return !e && !s && h.centerObject(u), r || (h.add(u), a || h.setActiveObject(u), h.renderAll()), u;
3375
3387
  }
3376
3388
  /**
3377
3389
  * Добавление треугольника
@@ -3391,14 +3403,14 @@ class to {
3391
3403
  * @param flags.withoutAdding - Не добавлять объект в canvas
3392
3404
  */
3393
3405
  addTriangle(d = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3394
- var l = d, {
3406
+ var h = d, {
3395
3407
  id: t = `triangle-${G()}`,
3396
3408
  left: e,
3397
3409
  top: s,
3398
3410
  width: o = 100,
3399
3411
  height: n = 100,
3400
3412
  fill: i = "yellow"
3401
- } = l, a = vt(l, [
3413
+ } = h, a = vt(h, [
3402
3414
  "id",
3403
3415
  "left",
3404
3416
  "top",
@@ -3495,8 +3507,8 @@ class eo {
3495
3507
  return N(this, null, function* () {
3496
3508
  try {
3497
3509
  const o = t.toCanvasElement({ enableRetinaScaling: !1 }).toDataURL(), n = o.slice(5).split(";")[0], i = o.split(",")[1], a = atob(i), r = new Uint8Array(a.length);
3498
- for (let l = 0; l < a.length; l += 1)
3499
- r[l] = a.charCodeAt(l);
3510
+ for (let h = 0; h < a.length; h += 1)
3511
+ r[h] = a.charCodeAt(h);
3500
3512
  const c = new Blob([r.buffer], { type: n }), d = new ClipboardItem({ [n]: c });
3501
3513
  return yield navigator.clipboard.write([d]), console.info("Image copied to clipboard successfully"), !0;
3502
3514
  } catch (s) {
@@ -3536,7 +3548,7 @@ class eo {
3536
3548
  */
3537
3549
  _addClonedObjectToCanvas(t) {
3538
3550
  const { canvas: e, historyManager: s } = this.editor;
3539
- if (e.discardActiveObject(), t instanceof x) {
3551
+ if (e.discardActiveObject(), t instanceof k) {
3540
3552
  s.suspendHistory(), t.canvas = e, t.forEachObject((o) => {
3541
3553
  e.add(o);
3542
3554
  }), e.setActiveObject(t), e.requestRenderAll(), s.resumeHistory(), s.saveState();
@@ -3570,7 +3582,7 @@ class eo {
3570
3582
  if (!s || s.locked) return !1;
3571
3583
  try {
3572
3584
  const o = yield s.clone(Xt);
3573
- return o instanceof x && o.forEachObject((n) => {
3585
+ return o instanceof k && o.forEachObject((n) => {
3574
3586
  n.set({
3575
3587
  id: `${n.type}-${G()}`,
3576
3588
  evented: !0
@@ -3615,13 +3627,13 @@ class eo {
3615
3627
  if (n.type !== "text/html" && i) {
3616
3628
  const c = new FileReader();
3617
3629
  c.onload = (d) => {
3618
- d.target && this._handleImageImport(d.target.result).catch((l) => {
3630
+ d.target && this._handleImageImport(d.target.result).catch((h) => {
3619
3631
  this.editor.errorManager.emitError({
3620
3632
  origin: "ClipboardManager",
3621
3633
  method: "handlePasteEvent",
3622
3634
  code: "PASTE_IMAGE_FAILED",
3623
3635
  message: "Ошибка вставки изображения из буфера обмена",
3624
- data: l
3636
+ data: h
3625
3637
  });
3626
3638
  });
3627
3639
  }, c.readAsDataURL(i);
@@ -3629,9 +3641,9 @@ class eo {
3629
3641
  }
3630
3642
  const a = t.getData("text/html");
3631
3643
  if (a) {
3632
- const l = new DOMParser().parseFromString(a, "text/html").querySelector("img");
3633
- if (l != null && l.src) {
3634
- this._handleImageImport(l.src).catch((u) => {
3644
+ const h = new DOMParser().parseFromString(a, "text/html").querySelector("img");
3645
+ if (h != null && h.src) {
3646
+ this._handleImageImport(h.src).catch((u) => {
3635
3647
  this.editor.errorManager.emitError({
3636
3648
  origin: "ClipboardManager",
3637
3649
  method: "handlePasteEvent",
@@ -3656,7 +3668,7 @@ class eo {
3656
3668
  if (!this.clipboard) return !1;
3657
3669
  try {
3658
3670
  const e = yield this.clipboard.clone(Xt);
3659
- return t.discardActiveObject(), e instanceof x && e.forEachObject((s) => {
3671
+ return t.discardActiveObject(), e instanceof k && e.forEachObject((s) => {
3660
3672
  s.set({
3661
3673
  id: `${s.type}-${G()}`,
3662
3674
  evented: !0
@@ -3743,7 +3755,7 @@ class te {
3743
3755
  });
3744
3756
  }
3745
3757
  static _isGroupOrSelection(t) {
3746
- return t instanceof x || t instanceof Et;
3758
+ return t instanceof k || t instanceof Et;
3747
3759
  }
3748
3760
  }
3749
3761
  class so {
@@ -3758,7 +3770,7 @@ class so {
3758
3770
  if (Array.isArray(t))
3759
3771
  return t.length > 0 ? t : null;
3760
3772
  const e = t || this.editor.canvas.getActiveObject();
3761
- return !e || !(e instanceof x) ? null : e.getObjects();
3773
+ return !e || !(e instanceof k) ? null : e.getObjects();
3762
3774
  }
3763
3775
  /**
3764
3776
  * Получить группы для разгруппировки
@@ -3769,13 +3781,13 @@ class so {
3769
3781
  const s = t.filter((o) => o instanceof Et);
3770
3782
  return s.length > 0 ? s : null;
3771
3783
  }
3772
- if (t instanceof x) {
3784
+ if (t instanceof k) {
3773
3785
  const s = t.getObjects().filter((o) => o instanceof Et);
3774
3786
  return s.length > 0 ? s : null;
3775
3787
  }
3776
3788
  const e = t || this.editor.canvas.getActiveObject();
3777
3789
  if (!e) return null;
3778
- if (e instanceof x) {
3790
+ if (e instanceof k) {
3779
3791
  const s = e.getObjects().filter((o) => o instanceof Et);
3780
3792
  return s.length > 0 ? s : null;
3781
3793
  }
@@ -3828,11 +3840,11 @@ class so {
3828
3840
  const i = [];
3829
3841
  n.forEach((c) => {
3830
3842
  const d = c.removeAll();
3831
- s.remove(c), d.forEach((l) => {
3832
- s.add(l), i.push(l);
3843
+ s.remove(c), d.forEach((h) => {
3844
+ s.add(h), i.push(h);
3833
3845
  });
3834
3846
  });
3835
- const a = new x(i, {
3847
+ const a = new k(i, {
3836
3848
  canvas: s
3837
3849
  });
3838
3850
  s.setActiveObject(a), s.requestRenderAll();
@@ -3858,7 +3870,7 @@ class oo {
3858
3870
  selectAll() {
3859
3871
  const { canvas: t, canvasManager: e, objectLockManager: s } = this.editor;
3860
3872
  t.discardActiveObject();
3861
- const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new x(e.getObjects(), { canvas: t }) : o[0];
3873
+ const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new k(e.getObjects(), { canvas: t }) : o[0];
3862
3874
  n && s.lockObject({ object: i, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(i), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: i });
3863
3875
  }
3864
3876
  }
@@ -3910,8 +3922,8 @@ class we {
3910
3922
  const r = [];
3911
3923
  if (a.forEach((d) => {
3912
3924
  if (we._isUngroupableGroup(d)) {
3913
- const l = this._handleGroupDeletion(d);
3914
- r.push(...l);
3925
+ const h = this._handleGroupDeletion(d);
3926
+ r.push(...h);
3915
3927
  return;
3916
3928
  }
3917
3929
  o.remove(d), r.push(d);
@@ -4161,12 +4173,12 @@ class no {
4161
4173
  constrainPan(t, e) {
4162
4174
  if (!this.currentBounds || !this.currentBounds.canPan)
4163
4175
  return { x: 0, y: 0 };
4164
- const { canvas: s, montageArea: o } = this.editor, n = s.getZoom(), i = o.left, a = o.top, r = s.getWidth() / 2, c = s.getHeight() / 2, d = i * n + t - r, l = a * n + e - c, u = Math.max(
4176
+ const { canvas: s, montageArea: o } = this.editor, n = s.getZoom(), i = o.left, a = o.top, r = s.getWidth() / 2, c = s.getHeight() / 2, d = i * n + t - r, h = a * n + e - c, u = Math.max(
4165
4177
  this.currentBounds.minX,
4166
4178
  Math.min(this.currentBounds.maxX, d)
4167
4179
  ), g = Math.max(
4168
4180
  this.currentBounds.minY,
4169
- Math.min(this.currentBounds.maxY, l)
4181
+ Math.min(this.currentBounds.maxY, h)
4170
4182
  ), f = u + r - i * n, p = g + c - a * n;
4171
4183
  return {
4172
4184
  x: f,
@@ -4197,13 +4209,13 @@ class no {
4197
4209
  }
4198
4210
  }
4199
4211
  const at = ({
4200
- value: h,
4212
+ value: l,
4201
4213
  min: t,
4202
4214
  max: e
4203
- }) => Math.min(Math.max(h, t), e), Dt = class Dt extends nt {
4215
+ }) => Math.min(Math.max(l, t), e), Dt = class Dt extends nt {
4204
4216
  constructor(t, e = {}) {
4205
- var s, o, n, i, a, r, c, d, l;
4206
- super(t, e), this.backgroundOpacity = (s = e.backgroundOpacity) != null ? s : 1, this.paddingTop = (o = e.paddingTop) != null ? o : 0, this.paddingRight = (n = e.paddingRight) != null ? n : 0, this.paddingBottom = (i = e.paddingBottom) != null ? i : 0, this.paddingLeft = (a = e.paddingLeft) != null ? a : 0, this.radiusTopLeft = (r = e.radiusTopLeft) != null ? r : 0, this.radiusTopRight = (c = e.radiusTopRight) != null ? c : 0, this.radiusBottomRight = (d = e.radiusBottomRight) != null ? d : 0, this.radiusBottomLeft = (l = e.radiusBottomLeft) != null ? l : 0, this._roundDimensions();
4217
+ var s, o, n, i, a, r, c, d, h;
4218
+ super(t, e), this.backgroundOpacity = (s = e.backgroundOpacity) != null ? s : 1, this.paddingTop = (o = e.paddingTop) != null ? o : 0, this.paddingRight = (n = e.paddingRight) != null ? n : 0, this.paddingBottom = (i = e.paddingBottom) != null ? i : 0, this.paddingLeft = (a = e.paddingLeft) != null ? a : 0, this.radiusTopLeft = (r = e.radiusTopLeft) != null ? r : 0, this.radiusTopRight = (c = e.radiusTopRight) != null ? c : 0, this.radiusBottomRight = (d = e.radiusBottomRight) != null ? d : 0, this.radiusBottomLeft = (h = e.radiusBottomLeft) != null ? h : 0, this._roundDimensions();
4207
4219
  }
4208
4220
  /**
4209
4221
  * Пересчитывает размеры текста и округляет их до целых значений.
@@ -4251,11 +4263,11 @@ const at = ({
4251
4263
  var s, o;
4252
4264
  const e = this._getEffectiveBackgroundFill();
4253
4265
  if (e && e) {
4254
- const n = this._getPadding(), i = (s = this.width) != null ? s : 0, a = (o = this.height) != null ? o : 0, r = i + n.left + n.right, c = a + n.top + n.bottom, d = this._getCornerRadii({ width: r, height: c }), l = this._getLeftOffset() - n.left, u = this._getTopOffset() - n.top;
4266
+ const n = this._getPadding(), i = (s = this.width) != null ? s : 0, a = (o = this.height) != null ? o : 0, r = i + n.left + n.right, c = a + n.top + n.bottom, d = this._getCornerRadii({ width: r, height: c }), h = this._getLeftOffset() - n.left, u = this._getTopOffset() - n.top;
4255
4267
  t.save(), Dt._renderRoundedRect({
4256
4268
  ctx: t,
4257
4269
  height: c,
4258
- left: l,
4270
+ left: h,
4259
4271
  radii: d,
4260
4272
  top: u,
4261
4273
  width: r
@@ -4319,9 +4331,9 @@ const at = ({
4319
4331
  const a = s + i, r = n + e, {
4320
4332
  topLeft: c,
4321
4333
  topRight: d,
4322
- bottomRight: l,
4334
+ bottomRight: h,
4323
4335
  bottomLeft: u
4324
- } = o, g = at({ value: c, min: 0, max: i }), f = at({ value: d, min: 0, max: i }), p = at({ value: l, min: 0, max: i }), m = at({ value: u, min: 0, max: i });
4336
+ } = o, g = at({ value: c, min: 0, max: i }), f = at({ value: d, min: 0, max: i }), p = at({ value: h, min: 0, max: i }), m = at({ value: u, min: 0, max: i });
4325
4337
  t.beginPath(), t.moveTo(s + g, n), t.lineTo(a - f, n), t.quadraticCurveTo(a, n, a, n + f), t.lineTo(a, r - p), t.quadraticCurveTo(a, r, a - p, r), t.lineTo(s + m, r), t.quadraticCurveTo(s, r, s, r - m), t.lineTo(s, n + g), t.quadraticCurveTo(s, n, s + g, n), t.closePath();
4326
4338
  }
4327
4339
  /**
@@ -4362,51 +4374,51 @@ Dt.type = "background-textbox", Dt.cacheProperties = [
4362
4374
  ];
4363
4375
  let ee = Dt;
4364
4376
  const io = () => {
4365
- var h;
4366
- (h = Pe) != null && h.setClass && Pe.setClass(ee, "background-textbox");
4367
- }, ao = ({ textbox: h }) => {
4377
+ var l;
4378
+ (l = Pe) != null && l.setClass && Pe.setClass(ee, "background-textbox");
4379
+ }, ao = ({ textbox: l }) => {
4368
4380
  var s, o;
4369
- if (!h.isEditing) return null;
4370
- const t = (s = h.selectionStart) != null ? s : 0, e = (o = h.selectionEnd) != null ? o : t;
4381
+ if (!l.isEditing) return null;
4382
+ const t = (s = l.selectionStart) != null ? s : 0, e = (o = l.selectionEnd) != null ? o : t;
4371
4383
  return t === e ? null : {
4372
4384
  start: Math.min(t, e),
4373
4385
  end: Math.max(t, e)
4374
4386
  };
4375
- }, ro = ({ textbox: h }) => {
4387
+ }, ro = ({ textbox: l }) => {
4376
4388
  var e, s;
4377
- const t = (s = (e = h.text) == null ? void 0 : e.length) != null ? s : 0;
4389
+ const t = (s = (e = l.text) == null ? void 0 : e.length) != null ? s : 0;
4378
4390
  return t <= 0 ? null : { start: 0, end: t };
4379
- }, co = ({ textbox: h, range: t }) => {
4391
+ }, co = ({ textbox: l, range: t }) => {
4380
4392
  var s, o;
4381
4393
  if (!t) return !1;
4382
- const e = (o = (s = h.text) == null ? void 0 : s.length) != null ? o : 0;
4394
+ const e = (o = (s = l.text) == null ? void 0 : s.length) != null ? o : 0;
4383
4395
  return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
4384
4396
  }, ne = ({
4385
- textbox: h,
4397
+ textbox: l,
4386
4398
  styles: t,
4387
4399
  range: e
4388
4400
  }) => {
4389
4401
  if (!t || !Object.keys(t).length) return !1;
4390
4402
  const { start: s, end: o } = e;
4391
- return o <= s ? !1 : (h.setSelectionStyles(t, s, o), !0);
4403
+ return o <= s ? !1 : (l.setSelectionStyles(t, s, o), !0);
4392
4404
  }, Ve = ({
4393
- textbox: h,
4405
+ textbox: l,
4394
4406
  range: t,
4395
4407
  property: e
4396
4408
  }) => {
4397
4409
  var o;
4398
4410
  if (!t) return;
4399
- const s = h.getSelectionStyles(
4411
+ const s = l.getSelectionStyles(
4400
4412
  t.start,
4401
4413
  t.end,
4402
4414
  !0
4403
4415
  );
4404
4416
  if (s.length)
4405
4417
  return (o = s[0]) == null ? void 0 : o[e];
4406
- }, Xe = ({ strokeColor: h, width: t }) => {
4418
+ }, Xe = ({ strokeColor: l, width: t }) => {
4407
4419
  if (!(t <= 0))
4408
- return h != null ? h : "#000000";
4409
- }, Ke = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, ie = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", st = 0.01;
4420
+ return l != null ? l : "#000000";
4421
+ }, Ke = ({ width: l = 0 }) => l ? Math.max(0, l) : 0, ie = ({ value: l }) => typeof l == "string" ? l.toLocaleUpperCase() : "", st = 0.01;
4410
4422
  class Z {
4411
4423
  constructor({ editor: t }) {
4412
4424
  var e;
@@ -4439,29 +4451,29 @@ class Z {
4439
4451
  this.isTextEditingActive = !1, this.editor.historyManager.saveState();
4440
4452
  }, Vs);
4441
4453
  }, this._handleObjectScaling = (s) => {
4442
- var X, It, Ht, mt, Wt, Ct, Ae, je, Ie, Ce, Te, Ee, Oe;
4454
+ var X, It, Wt, mt, Ht, Ct, Ae, je, Ie, Ce, Te, Ee, Oe;
4443
4455
  const { target: o, transform: n } = s;
4444
- if (o instanceof x || !Z._isTextbox(o) || !n) return;
4456
+ if (o instanceof k || !Z._isTextbox(o) || !n) return;
4445
4457
  o.isScaling = !0;
4446
4458
  const i = this._ensureScalingState(o), {
4447
4459
  baseWidth: a,
4448
4460
  baseLeft: r,
4449
4461
  baseFontSize: c,
4450
4462
  basePadding: d,
4451
- baseRadii: l,
4463
+ baseRadii: h,
4452
4464
  baseStyles: u
4453
- } = i, g = typeof ((X = n.original) == null ? void 0 : X.width) == "number" ? n.original.width : void 0, f = typeof ((It = n.original) == null ? void 0 : It.left) == "number" ? n.original.left : void 0, p = g != null ? g : a, m = f != null ? f : r, v = (Ht = n.corner) != null ? Ht : "", b = (mt = n.action) != null ? mt : "", I = ["ml", "mr"].includes(v) || b === "scaleX", y = ["mt", "mb"].includes(v) || b === "scaleY", w = ["tl", "tr", "bl", "br"].includes(v) || b === "scale", A = w || y;
4465
+ } = i, g = typeof ((X = n.original) == null ? void 0 : X.width) == "number" ? n.original.width : void 0, f = typeof ((It = n.original) == null ? void 0 : It.left) == "number" ? n.original.left : void 0, p = g != null ? g : a, m = f != null ? f : r, v = (Wt = n.corner) != null ? Wt : "", b = (mt = n.action) != null ? mt : "", I = ["ml", "mr"].includes(v) || b === "scaleX", y = ["mt", "mb"].includes(v) || b === "scaleY", w = ["tl", "tr", "bl", "br"].includes(v) || b === "scale", A = w || y;
4454
4466
  if (!I && !y && !w) return;
4455
- const j = Math.abs((Ct = (Wt = o.scaleX) != null ? Wt : n.scaleX) != null ? Ct : 1) || 1, M = Math.abs((je = (Ae = o.scaleY) != null ? Ae : n.scaleY) != null ? je : 1) || 1, T = Math.max(1, p * j), S = Math.max(1, Math.round(T)), C = Math.max(1, c * M), {
4456
- paddingTop: B = 0,
4467
+ const j = Math.abs((Ct = (Ht = o.scaleX) != null ? Ht : n.scaleX) != null ? Ct : 1) || 1, M = Math.abs((je = (Ae = o.scaleY) != null ? Ae : n.scaleY) != null ? je : 1) || 1, T = Math.max(1, p * j), S = Math.max(1, Math.round(T)), C = Math.max(1, c * M), {
4468
+ paddingTop: x = 0,
4457
4469
  paddingRight: F = 0,
4458
4470
  paddingBottom: U = 0,
4459
- paddingLeft: H = 0,
4471
+ paddingLeft: W = 0,
4460
4472
  radiusTopLeft: V = 0,
4461
4473
  radiusTopRight: L = 0,
4462
4474
  radiusBottomRight: D = 0,
4463
4475
  radiusBottomLeft: z = 0,
4464
- fontSize: W,
4476
+ fontSize: H,
4465
4477
  width: P,
4466
4478
  originX: K = "left"
4467
4479
  } = o, $ = w || y, q = w || y, Y = $ ? {
@@ -4470,11 +4482,11 @@ class Z {
4470
4482
  bottom: Math.max(0, d.bottom * M),
4471
4483
  left: Math.max(0, d.left * M)
4472
4484
  } : d, Q = q ? {
4473
- topLeft: Math.max(0, l.topLeft * M),
4474
- topRight: Math.max(0, l.topRight * M),
4475
- bottomRight: Math.max(0, l.bottomRight * M),
4476
- bottomLeft: Math.max(0, l.bottomLeft * M)
4477
- } : l, St = Object.keys(u).length > 0;
4485
+ topLeft: Math.max(0, h.topLeft * M),
4486
+ topRight: Math.max(0, h.topRight * M),
4487
+ bottomRight: Math.max(0, h.bottomRight * M),
4488
+ bottomLeft: Math.max(0, h.bottomLeft * M)
4489
+ } : h, St = Object.keys(u).length > 0;
4478
4490
  let et;
4479
4491
  if (A && St) {
4480
4492
  const se = {};
@@ -4488,7 +4500,7 @@ class Z {
4488
4500
  }), Object.keys(oe).length && (se[rs] = oe);
4489
4501
  }), Object.keys(se).length && (et = se);
4490
4502
  }
4491
- const lt = (Ce = (Ie = n.originX) != null ? Ie : K) != null ? Ce : "left", pt = m + p, At = m + p / 2, ht = P != null ? P : p, jt = S !== ht, Ft = Math.abs(C - (W != null ? W : c)) > st, Nt = Math.abs(Y.top - B) > st || Math.abs(Y.right - F) > st || Math.abs(Y.bottom - U) > st || Math.abs(Y.left - H) > st, xt = Math.abs(Q.topLeft - V) > st || Math.abs(Q.topRight - L) > st || Math.abs(Q.bottomRight - D) > st || Math.abs(Q.bottomLeft - z) > st;
4503
+ const lt = (Ce = (Ie = n.originX) != null ? Ie : K) != null ? Ce : "left", pt = m + p, At = m + p / 2, ht = P != null ? P : p, jt = S !== ht, Ft = Math.abs(C - (H != null ? H : c)) > st, Nt = Math.abs(Y.top - x) > st || Math.abs(Y.right - F) > st || Math.abs(Y.bottom - U) > st || Math.abs(Y.left - W) > st, xt = Math.abs(Q.topLeft - V) > st || Math.abs(Q.topRight - L) > st || Math.abs(Q.bottomRight - D) > st || Math.abs(Q.bottomLeft - z) > st;
4492
4504
  if (!jt && !Ft && !Nt && !xt) {
4493
4505
  o.set({ scaleX: 1, scaleY: 1 }), n.scaleX = 1, n.scaleY = 1;
4494
4506
  return;
@@ -4527,16 +4539,16 @@ class Z {
4527
4539
  }, this._handleObjectModified = (s) => {
4528
4540
  var b, I, y;
4529
4541
  const { target: o } = s;
4530
- if (o instanceof x) {
4542
+ if (o instanceof k) {
4531
4543
  const w = o.getObjects();
4532
4544
  if (!w.some((S) => Z._isTextbox(S))) return;
4533
4545
  const { scaleX: j = 1, scaleY: M = 1 } = o;
4534
4546
  if (Math.abs(j - 1) < st && Math.abs(M - 1) < st) return;
4535
4547
  this.canvas.discardActiveObject(), w.forEach((S) => {
4536
- var C, B, F, U;
4548
+ var C, x, F, U;
4537
4549
  if (Z._isTextbox(S)) {
4538
- const H = (C = S.scaleX) != null ? C : 1, V = (B = S.scaleY) != null ? B : 1, L = ((F = S.fontSize) != null ? F : 16) * V, D = ((U = S.width) != null ? U : 0) * H, z = V, {
4539
- paddingTop: W = 0,
4550
+ const W = (C = S.scaleX) != null ? C : 1, V = (x = S.scaleY) != null ? x : 1, L = ((F = S.fontSize) != null ? F : 16) * V, D = ((U = S.width) != null ? U : 0) * W, z = V, {
4551
+ paddingTop: H = 0,
4540
4552
  paddingRight: P = 0,
4541
4553
  paddingBottom: K = 0,
4542
4554
  paddingLeft: $ = 0,
@@ -4546,7 +4558,7 @@ class Z {
4546
4558
  radiusBottomLeft: St = 0,
4547
4559
  styles: et
4548
4560
  } = S, lt = {
4549
- paddingTop: Math.max(0, W * z),
4561
+ paddingTop: Math.max(0, H * z),
4550
4562
  paddingRight: Math.max(0, P * z),
4551
4563
  paddingBottom: Math.max(0, K * z),
4552
4564
  paddingLeft: Math.max(0, $ * z)
@@ -4572,7 +4584,7 @@ class Z {
4572
4584
  }
4573
4585
  S.setCoords();
4574
4586
  });
4575
- const T = new x(w, {
4587
+ const T = new k(w, {
4576
4588
  canvas: this.canvas
4577
4589
  });
4578
4590
  this.canvas.setActiveObject(T), this.canvas.requestRenderAll();
@@ -4585,7 +4597,7 @@ class Z {
4585
4597
  const i = (b = o.width) != null ? b : o.calcTextWidth(), a = (y = (I = o.fontSize) != null ? I : n == null ? void 0 : n.baseFontSize) != null ? y : 16, r = !!(n.baseStyles && Object.keys(n.baseStyles).length), {
4586
4598
  paddingTop: c = 0,
4587
4599
  paddingRight: d = 0,
4588
- paddingBottom: l = 0,
4600
+ paddingBottom: h = 0,
4589
4601
  paddingLeft: u = 0,
4590
4602
  radiusTopLeft: g = 0,
4591
4603
  radiusTopRight: f = 0,
@@ -4595,7 +4607,7 @@ class Z {
4595
4607
  width: i,
4596
4608
  paddingTop: c,
4597
4609
  paddingRight: d,
4598
- paddingBottom: l,
4610
+ paddingBottom: h,
4599
4611
  paddingLeft: u,
4600
4612
  radiusTopLeft: g,
4601
4613
  radiusTopRight: f,
@@ -4613,7 +4625,7 @@ class Z {
4613
4625
  * @param options — настройки текста
4614
4626
  * @param flags — флаги поведения
4615
4627
  */
4616
- addText(F = {}, { withoutSelection: S = !1, withoutSave: C = !1, withoutAdding: B = !1 } = {}) {
4628
+ addText(F = {}, { withoutSelection: S = !1, withoutSave: C = !1, withoutAdding: x = !1 } = {}) {
4617
4629
  var U = F, {
4618
4630
  id: t = `text-${G()}`,
4619
4631
  text: e = "Новый текст",
@@ -4625,7 +4637,7 @@ class Z {
4625
4637
  uppercase: r = !1,
4626
4638
  strikethrough: c = !1,
4627
4639
  align: d = "left",
4628
- color: l = "#000000",
4640
+ color: h = "#000000",
4629
4641
  strokeColor: u,
4630
4642
  strokeWidth: g = 0,
4631
4643
  opacity: f = 1,
@@ -4666,12 +4678,12 @@ class Z {
4666
4678
  "radiusBottomLeft"
4667
4679
  ]);
4668
4680
  var $;
4669
- const { historyManager: H } = this.editor, { canvas: V } = this;
4670
- H.suspendHistory();
4681
+ const { historyManager: W } = this.editor, { canvas: V } = this;
4682
+ W.suspendHistory();
4671
4683
  const L = s != null ? s : this._getDefaultFontFamily(), D = Ke({ width: g }), z = Xe({
4672
4684
  strokeColor: u,
4673
4685
  width: D
4674
- }), W = _({
4686
+ }), H = _({
4675
4687
  id: t,
4676
4688
  fontFamily: L,
4677
4689
  fontSize: o,
@@ -4681,7 +4693,7 @@ class Z {
4681
4693
  uppercase: r,
4682
4694
  linethrough: c,
4683
4695
  textAlign: d,
4684
- fill: l,
4696
+ fill: h,
4685
4697
  stroke: z,
4686
4698
  strokeWidth: D,
4687
4699
  strokeUniform: !0,
@@ -4696,27 +4708,27 @@ class Z {
4696
4708
  radiusTopRight: A,
4697
4709
  radiusBottomRight: j,
4698
4710
  radiusBottomLeft: M
4699
- }, T), P = new ee(e, W);
4711
+ }, T), P = new ee(e, H);
4700
4712
  if (P.textCaseRaw = ($ = P.text) != null ? $ : "", r) {
4701
4713
  const q = ie({ value: P.textCaseRaw });
4702
4714
  q !== P.text && P.set({ text: q });
4703
4715
  }
4704
- return Z._roundTextboxDimensions({ textbox: P }) && (P.dirty = !0), T.left === void 0 && T.top === void 0 && V.centerObject(P), B || V.add(P), S || V.setActiveObject(P), V.requestRenderAll(), H.resumeHistory(), C || H.saveState(), V.fire("editor:text-added", {
4716
+ return Z._roundTextboxDimensions({ textbox: P }) && (P.dirty = !0), T.left === void 0 && T.top === void 0 && V.centerObject(P), x || V.add(P), S || V.setActiveObject(P), V.requestRenderAll(), W.resumeHistory(), C || W.saveState(), V.fire("editor:text-added", {
4705
4717
  textbox: P,
4706
- options: yt(_({}, W), {
4718
+ options: yt(_({}, H), {
4707
4719
  text: e,
4708
4720
  bold: n,
4709
4721
  italic: i,
4710
4722
  strikethrough: c,
4711
4723
  align: d,
4712
- color: l,
4724
+ color: h,
4713
4725
  strokeColor: z,
4714
4726
  strokeWidth: D
4715
4727
  }),
4716
4728
  flags: {
4717
4729
  withoutSelection: !!S,
4718
4730
  withoutSave: !!C,
4719
- withoutAdding: !!B
4731
+ withoutAdding: !!x
4720
4732
  }
4721
4733
  }), P;
4722
4734
  }
@@ -4737,7 +4749,7 @@ class Z {
4737
4749
  const r = Z._getSnapshot(n), Nt = e, {
4738
4750
  text: c,
4739
4751
  fontFamily: d,
4740
- fontSize: l,
4752
+ fontSize: h,
4741
4753
  bold: u,
4742
4754
  italic: g,
4743
4755
  underline: f,
@@ -4754,10 +4766,10 @@ class Z {
4754
4766
  paddingRight: T,
4755
4767
  paddingBottom: S,
4756
4768
  paddingLeft: C,
4757
- radiusTopLeft: B,
4769
+ radiusTopLeft: x,
4758
4770
  radiusTopRight: F,
4759
4771
  radiusBottomRight: U,
4760
- radiusBottomLeft: H
4772
+ radiusBottomLeft: W
4761
4773
  } = Nt, V = vt(Nt, [
4762
4774
  "text",
4763
4775
  "fontFamily",
@@ -4782,23 +4794,23 @@ class Z {
4782
4794
  "radiusTopRight",
4783
4795
  "radiusBottomRight",
4784
4796
  "radiusBottomLeft"
4785
- ]), L = _({}, V), D = ao({ textbox: n }), z = D ? this._expandRangeToFullLines({ textbox: n, range: D }) : null, W = {}, P = {}, K = {}, $ = co({ textbox: n, range: D }), q = !D || $, Y = !D;
4786
- if (d !== void 0 && (z && (P.fontFamily = d), q && (L.fontFamily = d, Y && (K.fontFamily = d))), l !== void 0 && (z && (P.fontSize = l), q && (L.fontSize = l, Y && (K.fontSize = l))), u !== void 0) {
4797
+ ]), L = _({}, V), D = ao({ textbox: n }), z = D ? this._expandRangeToFullLines({ textbox: n, range: D }) : null, H = {}, P = {}, K = {}, $ = co({ textbox: n, range: D }), q = !D || $, Y = !D;
4798
+ if (d !== void 0 && (z && (P.fontFamily = d), q && (L.fontFamily = d, Y && (K.fontFamily = d))), h !== void 0 && (z && (P.fontSize = h), q && (L.fontSize = h, Y && (K.fontSize = h))), u !== void 0) {
4787
4799
  const X = u ? "bold" : "normal";
4788
- D && (W.fontWeight = X), q && (L.fontWeight = X, Y && (K.fontWeight = X));
4800
+ D && (H.fontWeight = X), q && (L.fontWeight = X, Y && (K.fontWeight = X));
4789
4801
  }
4790
4802
  if (g !== void 0) {
4791
4803
  const X = g ? "italic" : "normal";
4792
- D && (W.fontStyle = X), q && (L.fontStyle = X, Y && (K.fontStyle = X));
4804
+ D && (H.fontStyle = X), q && (L.fontStyle = X, Y && (K.fontStyle = X));
4793
4805
  }
4794
- if (f !== void 0 && (D && (W.underline = f), q && (L.underline = f, Y && (K.underline = f))), m !== void 0 && (D && (W.linethrough = m), q && (L.linethrough = m, Y && (K.linethrough = m))), v !== void 0 && (L.textAlign = v), b !== void 0 && (D && (W.fill = b), q && (L.fill = b, Y && (K.fill = b))), I !== void 0 || y !== void 0) {
4795
- const X = D ? Ve({ textbox: n, range: D, property: "strokeWidth" }) : void 0, It = D ? Ve({ textbox: n, range: D, property: "stroke" }) : void 0, Ht = (Bt = (xt = y != null ? y : X) != null ? xt : n.strokeWidth) != null ? Bt : 0, mt = Ke({ width: Ht }), Wt = (kt = (ut = I != null ? I : It) != null ? ut : n.stroke) != null ? kt : void 0, Ct = Xe({
4796
- strokeColor: Wt,
4806
+ if (f !== void 0 && (D && (H.underline = f), q && (L.underline = f, Y && (K.underline = f))), m !== void 0 && (D && (H.linethrough = m), q && (L.linethrough = m, Y && (K.linethrough = m))), v !== void 0 && (L.textAlign = v), b !== void 0 && (D && (H.fill = b), q && (L.fill = b, Y && (K.fill = b))), I !== void 0 || y !== void 0) {
4807
+ const X = D ? Ve({ textbox: n, range: D, property: "strokeWidth" }) : void 0, It = D ? Ve({ textbox: n, range: D, property: "stroke" }) : void 0, Wt = (Bt = (xt = y != null ? y : X) != null ? xt : n.strokeWidth) != null ? Bt : 0, mt = Ke({ width: Wt }), Ht = (kt = (ut = I != null ? I : It) != null ? ut : n.stroke) != null ? kt : void 0, Ct = Xe({
4808
+ strokeColor: Ht,
4797
4809
  width: mt
4798
4810
  });
4799
- D && (W.stroke = Ct, W.strokeWidth = mt), q && (L.stroke = Ct, L.strokeWidth = mt, Y && (K.stroke = Ct, K.strokeWidth = mt));
4811
+ D && (H.stroke = Ct, H.strokeWidth = mt), q && (L.stroke = Ct, L.strokeWidth = mt, Y && (K.stroke = Ct, K.strokeWidth = mt));
4800
4812
  }
4801
- w !== void 0 && (L.opacity = w), A !== void 0 && (L.backgroundColor = A), j !== void 0 && (L.backgroundOpacity = j), M !== void 0 && (L.paddingTop = M), T !== void 0 && (L.paddingRight = T), S !== void 0 && (L.paddingBottom = S), C !== void 0 && (L.paddingLeft = C), B !== void 0 && (L.radiusTopLeft = B), F !== void 0 && (L.radiusTopRight = F), U !== void 0 && (L.radiusBottomRight = U), H !== void 0 && (L.radiusBottomLeft = H);
4813
+ w !== void 0 && (L.opacity = w), A !== void 0 && (L.backgroundColor = A), j !== void 0 && (L.backgroundOpacity = j), M !== void 0 && (L.paddingTop = M), T !== void 0 && (L.paddingRight = T), S !== void 0 && (L.paddingBottom = S), C !== void 0 && (L.paddingLeft = C), x !== void 0 && (L.radiusTopLeft = x), F !== void 0 && (L.radiusTopRight = F), U !== void 0 && (L.radiusBottomRight = U), W !== void 0 && (L.radiusBottomLeft = W);
4802
4814
  const Q = (it = n.textCaseRaw) != null ? it : (gt = n.text) != null ? gt : "", St = !!n.uppercase, et = c !== void 0, lt = et ? c != null ? c : "" : Q, pt = p != null ? p : St;
4803
4815
  if (et || pt !== St) {
4804
4816
  const X = pt ? ie({ value: lt }) : lt;
@@ -4807,13 +4819,13 @@ class Z {
4807
4819
  n.uppercase = pt, n.set(L);
4808
4820
  let ht = !1;
4809
4821
  if (D) {
4810
- const X = ne({ textbox: n, styles: W, range: D }), It = z ? ne({ textbox: n, styles: P, range: z }) : !1;
4822
+ const X = ne({ textbox: n, styles: H, range: D }), It = z ? ne({ textbox: n, styles: P, range: z }) : !1;
4811
4823
  ht = X || It;
4812
4824
  } else if (Object.keys(K).length) {
4813
4825
  const X = ro({ textbox: n });
4814
4826
  X && (ht = ne({ textbox: n, styles: K, range: X }));
4815
4827
  }
4816
- ht && (n.dirty = !0), (A !== void 0 || j !== void 0 || M !== void 0 || T !== void 0 || S !== void 0 || C !== void 0 || B !== void 0 || F !== void 0 || U !== void 0 || H !== void 0) && (n.dirty = !0), Z._roundTextboxDimensions({ textbox: n }) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4828
+ ht && (n.dirty = !0), (A !== void 0 || j !== void 0 || M !== void 0 || T !== void 0 || S !== void 0 || C !== void 0 || x !== void 0 || F !== void 0 || U !== void 0 || W !== void 0) && (n.dirty = !0), Z._roundTextboxDimensions({ textbox: n }) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4817
4829
  const Ft = Z._getSnapshot(n);
4818
4830
  return a.fire("editor:text-updated", {
4819
4831
  textbox: n,
@@ -4827,7 +4839,7 @@ class Z {
4827
4839
  before: r,
4828
4840
  after: Ft,
4829
4841
  selectionRange: D != null ? D : void 0,
4830
- selectionStyles: D && Object.keys(W).length ? W : void 0
4842
+ selectionStyles: D && Object.keys(H).length ? H : void 0
4831
4843
  }), n;
4832
4844
  }
4833
4845
  /**
@@ -4904,7 +4916,7 @@ class Z {
4904
4916
  if (!e) {
4905
4917
  const i = (s = t.width) != null ? s : t.calcTextWidth(), a = (o = t.left) != null ? o : 0, r = (n = t.fontSize) != null ? n : 16, { styles: c = {} } = t, {
4906
4918
  paddingTop: d = 0,
4907
- paddingRight: l = 0,
4919
+ paddingRight: h = 0,
4908
4920
  paddingBottom: u = 0,
4909
4921
  paddingLeft: g = 0
4910
4922
  } = t, {
@@ -4919,7 +4931,7 @@ class Z {
4919
4931
  baseLeft: a,
4920
4932
  basePadding: {
4921
4933
  top: d,
4922
- right: l,
4934
+ right: h,
4923
4935
  bottom: u,
4924
4936
  left: g
4925
4937
  },
@@ -4956,19 +4968,19 @@ class Z {
4956
4968
  }), c = Z._resolveDimension({
4957
4969
  rawValue: s,
4958
4970
  calculatedValue: a
4959
- }), d = Number.isFinite(r) ? Math.round(r) : null, l = Number.isFinite(c) ? Math.round(c) : null, u = {};
4960
- return d !== null && d !== r && (u.width = Math.max(0, d)), l !== null && l !== c && (u.height = Math.max(0, l)), Object.keys(u).length ? (t.set(u), !0) : !1;
4971
+ }), d = Number.isFinite(r) ? Math.round(r) : null, h = Number.isFinite(c) ? Math.round(c) : null, u = {};
4972
+ return d !== null && d !== r && (u.width = Math.max(0, d)), h !== null && h !== c && (u.height = Math.max(0, h)), Object.keys(u).length ? (t.set(u), !0) : !1;
4961
4973
  }
4962
4974
  /**
4963
4975
  * Формирует снимок текущих свойств текстового объекта для истории и событий.
4964
4976
  */
4965
4977
  static _getSnapshot(t) {
4966
4978
  const e = ({
4967
- snapshot: W,
4979
+ snapshot: H,
4968
4980
  entries: P
4969
4981
  }) => {
4970
4982
  Object.entries(P).forEach(([K, $]) => {
4971
- $ != null && (W[K] = $);
4983
+ $ != null && (H[K] = $);
4972
4984
  });
4973
4985
  }, {
4974
4986
  id: s,
@@ -4979,7 +4991,7 @@ class Z {
4979
4991
  fontSize: r,
4980
4992
  fontWeight: c,
4981
4993
  fontStyle: d,
4982
- underline: l,
4994
+ underline: h,
4983
4995
  linethrough: u,
4984
4996
  textAlign: g,
4985
4997
  fill: f,
@@ -4996,10 +5008,10 @@ class Z {
4996
5008
  radiusTopRight: T,
4997
5009
  radiusBottomRight: S,
4998
5010
  radiusBottomLeft: C,
4999
- left: B,
5011
+ left: x,
5000
5012
  top: F,
5001
5013
  width: U,
5002
- height: H,
5014
+ height: W,
5003
5015
  angle: V,
5004
5016
  scaleX: L,
5005
5017
  scaleY: D
@@ -5017,7 +5029,7 @@ class Z {
5017
5029
  fontSize: r,
5018
5030
  fontWeight: c,
5019
5031
  fontStyle: d,
5020
- underline: l,
5032
+ underline: h,
5021
5033
  linethrough: u,
5022
5034
  fill: f,
5023
5035
  stroke: p,
@@ -5033,10 +5045,10 @@ class Z {
5033
5045
  radiusTopRight: T,
5034
5046
  radiusBottomRight: S,
5035
5047
  radiusBottomLeft: C,
5036
- left: B,
5048
+ left: x,
5037
5049
  top: F,
5038
5050
  width: U,
5039
- height: H,
5051
+ height: W,
5040
5052
  angle: V,
5041
5053
  scaleX: L,
5042
5054
  scaleY: D
@@ -5052,23 +5064,23 @@ class Z {
5052
5064
  }
5053
5065
  }
5054
5066
  const ot = ({
5055
- value: h,
5067
+ value: l,
5056
5068
  fallback: t = 0
5057
- }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, Kt = ({
5058
- value: h,
5069
+ }) => typeof l == "number" && Number.isFinite(l) ? l : typeof t == "number" && Number.isFinite(t) ? t : 0, Kt = ({
5070
+ value: l,
5059
5071
  dimension: t,
5060
5072
  useRelativePositions: e
5061
5073
  }) => {
5062
- const s = ot({ value: h });
5074
+ const s = ot({ value: l });
5063
5075
  return e ? s : s / (t || 1);
5064
5076
  }, lo = ({
5065
- object: h,
5077
+ object: l,
5066
5078
  baseWidth: t,
5067
5079
  baseHeight: e,
5068
5080
  useRelativePositions: s,
5069
5081
  centerKeys: o
5070
5082
  }) => {
5071
- const n = h;
5083
+ const n = l;
5072
5084
  if (typeof n[o.x] == "number" && typeof n[o.y] == "number")
5073
5085
  return {
5074
5086
  x: Kt({
@@ -5082,7 +5094,7 @@ const ot = ({
5082
5094
  useRelativePositions: s
5083
5095
  })
5084
5096
  };
5085
- const { left: a, top: r, width: c, height: d } = h, l = Kt({
5097
+ const { left: a, top: r, width: c, height: d } = l, h = Kt({
5086
5098
  value: a,
5087
5099
  dimension: t,
5088
5100
  useRelativePositions: s
@@ -5092,11 +5104,11 @@ const ot = ({
5092
5104
  useRelativePositions: s
5093
5105
  }), g = ot({ value: c }) / (t || 1), f = ot({ value: d }) / (e || 1);
5094
5106
  return {
5095
- x: l + g / 2,
5107
+ x: h + g / 2,
5096
5108
  y: u + f / 2
5097
5109
  };
5098
5110
  }, ho = ({
5099
- normalizedX: h,
5111
+ normalizedX: l,
5100
5112
  normalizedY: t,
5101
5113
  bounds: e,
5102
5114
  targetSize: s,
@@ -5104,33 +5116,33 @@ const ot = ({
5104
5116
  }) => {
5105
5117
  const { left: n, top: i, width: a, height: r } = e;
5106
5118
  if (!o) {
5107
- const { width: l, height: u } = s, g = n + h * (l || a), f = i + t * (u || r);
5119
+ const { width: h, height: u } = s, g = n + l * (h || a), f = i + t * (u || r);
5108
5120
  return new tt(g, f);
5109
5121
  }
5110
- const c = n + h * a, d = i + t * r;
5122
+ const c = n + l * a, d = i + t * r;
5111
5123
  return new tt(c, d);
5112
5124
  }, uo = ({
5113
- object: h,
5125
+ object: l,
5114
5126
  montageArea: t,
5115
5127
  bounds: e
5116
5128
  }) => {
5117
5129
  if (!t || !e) return null;
5118
5130
  try {
5119
- const s = h.getCenterPoint(), { left: o, top: n, width: i, height: a } = e, r = s.x - o, c = s.y - n, d = r / i, l = c / a;
5131
+ const s = l.getCenterPoint(), { left: o, top: n, width: i, height: a } = e, r = s.x - o, c = s.y - n, d = r / i, h = c / a;
5120
5132
  return {
5121
5133
  x: d,
5122
- y: l
5134
+ y: h
5123
5135
  };
5124
5136
  } catch (s) {
5125
5137
  return null;
5126
5138
  }
5127
5139
  }, ft = ({
5128
- object: h
5140
+ object: l
5129
5141
  }) => {
5130
- if (!h) return null;
5142
+ if (!l) return null;
5131
5143
  try {
5132
- h.setCoords();
5133
- const t = h.getBoundingRect(!1, !0), {
5144
+ l.setCoords();
5145
+ const t = l.getBoundingRect(!1, !0), {
5134
5146
  left: e = 0,
5135
5147
  top: s = 0,
5136
5148
  width: o = 0,
@@ -5148,38 +5160,43 @@ const ot = ({
5148
5160
  return null;
5149
5161
  }
5150
5162
  }, go = ({
5151
- x1: h,
5163
+ x1: l,
5152
5164
  y1: t,
5153
5165
  x2: e,
5154
5166
  y2: s
5155
- }) => (Math.atan2(s - t, e - h) * 180 / Math.PI + 360) % 360, fo = (h) => {
5156
- if (!h || typeof h != "object") return null;
5157
- const { type: t, coords: e, colorStops: s } = h, o = Array.isArray(s) ? s : [], n = o[0], i = o[o.length - 1], a = typeof (n == null ? void 0 : n.color) == "string" ? n.color : void 0, r = typeof (i == null ? void 0 : i.color) == "string" ? i.color : a, c = typeof (n == null ? void 0 : n.offset) == "number" ? n.offset * 100 : void 0, d = typeof (i == null ? void 0 : i.offset) == "number" ? i.offset * 100 : void 0;
5167
+ }) => (Math.atan2(s - t, e - l) * 180 / Math.PI + 360) % 360, fo = (l) => {
5168
+ if (!l || typeof l != "object") return null;
5169
+ const { type: t, coords: e, colorStops: s } = l, o = Array.isArray(s) ? s : [], n = o[0], i = o[o.length - 1], a = typeof (n == null ? void 0 : n.color) == "string" ? n.color : void 0, r = typeof (i == null ? void 0 : i.color) == "string" ? i.color : a, c = typeof (n == null ? void 0 : n.offset) == "number" ? n.offset * 100 : void 0, d = typeof (i == null ? void 0 : i.offset) == "number" ? i.offset * 100 : void 0, h = o.map((u) => ({
5170
+ color: typeof u.color == "string" ? u.color : "#000000",
5171
+ offset: typeof u.offset == "number" ? u.offset * 100 : 0
5172
+ }));
5158
5173
  if (!a || !r || !e) return null;
5159
5174
  if (t === "linear") {
5160
- const { x1: l, y1: u, x2: g, y2: f } = e;
5161
- if (typeof l == "number" && typeof u == "number" && typeof g == "number" && typeof f == "number")
5175
+ const { x1: u, y1: g, x2: f, y2: p } = e;
5176
+ if (typeof u == "number" && typeof g == "number" && typeof f == "number" && typeof p == "number")
5162
5177
  return {
5163
5178
  type: "linear",
5164
- angle: go({ x1: l, y1: u, x2: g, y2: f }),
5179
+ angle: go({ x1: u, y1: g, x2: f, y2: p }),
5165
5180
  startColor: a,
5166
5181
  endColor: r,
5167
5182
  startPosition: c,
5168
- endPosition: d
5183
+ endPosition: d,
5184
+ colorStops: h
5169
5185
  };
5170
5186
  }
5171
5187
  if (t === "radial") {
5172
- const { x1: l, y1: u, r2: g } = e;
5173
- if (typeof l == "number" && typeof u == "number" && typeof g == "number")
5188
+ const { x1: u, y1: g, r2: f } = e;
5189
+ if (typeof u == "number" && typeof g == "number" && typeof f == "number")
5174
5190
  return {
5175
5191
  type: "radial",
5176
- centerX: l * 100,
5177
- centerY: u * 100,
5178
- radius: g * 100,
5192
+ centerX: u * 100,
5193
+ centerY: g * 100,
5194
+ radius: f * 100,
5179
5195
  startColor: a,
5180
5196
  endColor: r,
5181
5197
  startPosition: c,
5182
- endPosition: d
5198
+ endPosition: d,
5199
+ colorStops: h
5183
5200
  };
5184
5201
  }
5185
5202
  return null;
@@ -5203,7 +5220,7 @@ class R {
5203
5220
  montageArea: i,
5204
5221
  errorManager: a,
5205
5222
  backgroundManager: r
5206
- } = this.editor, c = n.getActiveObject(), d = R._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, u = o && l ? [l] : [], g = [...d, ...u];
5223
+ } = this.editor, c = n.getActiveObject(), d = R._collectObjects(c), { backgroundObject: h } = r != null ? r : {}, u = o && h ? [h] : [], g = [...d, ...u];
5207
5224
  if (!g.length)
5208
5225
  return a.emitWarning({
5209
5226
  origin: "TemplateManager",
@@ -5246,7 +5263,7 @@ class R {
5246
5263
  historyManager: i,
5247
5264
  errorManager: a,
5248
5265
  backgroundManager: r
5249
- } = this.editor, { objects: c, meta: d, id: l } = t != null ? t : {};
5266
+ } = this.editor, { objects: c, meta: d, id: h } = t != null ? t : {};
5250
5267
  if (!(c != null && c.length))
5251
5268
  return a.emitWarning({
5252
5269
  origin: "TemplateManager",
@@ -5305,7 +5322,7 @@ class R {
5305
5322
  code: bt.TEMPLATE_MANAGER.APPLY_FAILED,
5306
5323
  message: "Ошибка применения шаблона",
5307
5324
  data: {
5308
- templateId: l,
5325
+ templateId: h,
5309
5326
  error: I
5310
5327
  }
5311
5328
  }), null;
@@ -5318,7 +5335,7 @@ class R {
5318
5335
  * Подготавливает объекты для сериализации.
5319
5336
  */
5320
5337
  static _collectObjects(t) {
5321
- return t ? t instanceof x ? t.getObjects() : [t] : [];
5338
+ return t ? t instanceof k ? t.getObjects() : [t] : [];
5322
5339
  }
5323
5340
  /**
5324
5341
  * Возвращает габариты объекта.
@@ -5369,7 +5386,7 @@ class R {
5369
5386
  scaleY: a
5370
5387
  } = e, r = t, c = "getElement" in r && typeof r.getElement == "function" ? r.getElement() : null, {
5371
5388
  naturalWidth: d = 0,
5372
- naturalHeight: l = 0,
5389
+ naturalHeight: h = 0,
5373
5390
  width: u = 0,
5374
5391
  height: g = 0
5375
5392
  } = c instanceof HTMLImageElement ? c : {
@@ -5377,7 +5394,7 @@ class R {
5377
5394
  naturalHeight: 0,
5378
5395
  width: 0,
5379
5396
  height: 0
5380
- }, f = ot({ value: d || u || r.width, fallback: 0 }), p = ot({ value: l || g || r.height, fallback: 0 }), m = ot({ value: o, fallback: f }), v = ot({ value: n, fallback: p }), b = ot({ value: i, fallback: r.scaleX || 1 }), I = ot({ value: a, fallback: r.scaleY || 1 }), y = m * b, w = v * I, A = f ? y / f : null, j = p ? w / p : null, M = {};
5397
+ }, f = ot({ value: d || u || r.width, fallback: 0 }), p = ot({ value: h || g || r.height, fallback: 0 }), m = ot({ value: o, fallback: f }), v = ot({ value: n, fallback: p }), b = ot({ value: i, fallback: r.scaleX || 1 }), I = ot({ value: a, fallback: r.scaleY || 1 }), y = m * b, w = v * I, A = f ? y / f : null, j = p ? w / p : null, M = {};
5381
5398
  f > 0 && (M.width = f), p > 0 && (M.height = p), A && A > 0 && (M.scaleX = A), j && j > 0 && (M.scaleY = j), r.set(M);
5382
5399
  }
5383
5400
  /**
@@ -5453,7 +5470,7 @@ class R {
5453
5470
  montageArea: a,
5454
5471
  useRelativePositions: r
5455
5472
  }) {
5456
- const c = t, { x: d, y: l } = lo({
5473
+ const c = t, { x: d, y: h } = lo({
5457
5474
  object: t,
5458
5475
  baseWidth: n,
5459
5476
  baseHeight: i,
@@ -5472,7 +5489,7 @@ class R {
5472
5489
  anchorY: R._resolveAnchor(c, de)
5473
5490
  }), v = ho({
5474
5491
  normalizedX: d,
5475
- normalizedY: l,
5492
+ normalizedY: h,
5476
5493
  bounds: m,
5477
5494
  targetSize: o,
5478
5495
  montageArea: a
@@ -5496,7 +5513,7 @@ class R {
5496
5513
  anchorY: a
5497
5514
  }) {
5498
5515
  if (!n) return t;
5499
- const r = (e || t.width) * o, c = (s || t.height) * o, d = t.width - r, l = t.height - c, u = t.left + R._calculateAnchorOffset(i, d), g = t.top + R._calculateAnchorOffset(a, l);
5516
+ const r = (e || t.width) * o, c = (s || t.height) * o, d = t.width - r, h = t.height - c, u = t.left + R._calculateAnchorOffset(i, d), g = t.top + R._calculateAnchorOffset(a, h);
5500
5517
  return {
5501
5518
  left: u,
5502
5519
  top: g,
@@ -5558,7 +5575,7 @@ class R {
5558
5575
  t.setActiveObject(e[0]);
5559
5576
  return;
5560
5577
  }
5561
- const s = new x(e, { canvas: t });
5578
+ const s = new k(e, { canvas: t });
5562
5579
  t.setActiveObject(s);
5563
5580
  }
5564
5581
  /**
@@ -5593,7 +5610,7 @@ class R {
5593
5610
  top: r,
5594
5611
  width: c,
5595
5612
  height: d
5596
- } = e, l = t.getBoundingRect(!1, !0), u = s || c || 1, g = o || d || 1, f = uo({
5613
+ } = e, h = t.getBoundingRect(!1, !0), u = s || c || 1, g = o || d || 1, f = uo({
5597
5614
  object: t,
5598
5615
  montageArea: n,
5599
5616
  bounds: e
@@ -5603,7 +5620,7 @@ class R {
5603
5620
  x: (y.x - a) / u,
5604
5621
  y: (y.y - r) / g
5605
5622
  };
5606
- })(), m = (l.left - a) / u, v = (l.top - r) / g, b = m + l.width / u, I = v + l.height / g;
5623
+ })(), m = (h.left - a) / u, v = (h.top - r) / g, b = m + h.width / u, I = v + h.height / g;
5607
5624
  return i[ae] = p.x, i[re] = p.y, i[ce] = R._detectAnchor({
5608
5625
  center: p.x,
5609
5626
  start: m,
@@ -5723,13 +5740,13 @@ class R {
5723
5740
  }
5724
5741
  }
5725
5742
  const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5726
- anchors: h,
5743
+ anchors: l,
5727
5744
  positions: t,
5728
5745
  threshold: e
5729
5746
  }) => {
5730
5747
  let s = 0, o = e + 1, n = null;
5731
5748
  for (const i of t)
5732
- for (const a of h) {
5749
+ for (const a of l) {
5733
5750
  const r = Math.abs(a - i);
5734
5751
  r > e || r >= o || (s = a - i, o = r, n = a);
5735
5752
  }
@@ -5738,11 +5755,11 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5738
5755
  guidePosition: n
5739
5756
  };
5740
5757
  }, mo = ({
5741
- activeBounds: h,
5758
+ activeBounds: l,
5742
5759
  threshold: t,
5743
5760
  anchors: e
5744
5761
  }) => {
5745
- const { left: s, right: o, centerX: n, top: i, bottom: a, centerY: r } = h, c = Qe({
5762
+ const { left: s, right: o, centerX: n, top: i, bottom: a, centerY: r } = l, c = Qe({
5746
5763
  anchors: e.vertical,
5747
5764
  positions: [s, n, o],
5748
5765
  threshold: t
@@ -5750,20 +5767,20 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5750
5767
  anchors: e.horizontal,
5751
5768
  positions: [i, r, a],
5752
5769
  threshold: t
5753
- }), l = [];
5754
- return c.guidePosition !== null && l.push({
5770
+ }), h = [];
5771
+ return c.guidePosition !== null && h.push({
5755
5772
  type: "vertical",
5756
5773
  position: c.guidePosition
5757
- }), d.guidePosition !== null && l.push({
5774
+ }), d.guidePosition !== null && h.push({
5758
5775
  type: "horizontal",
5759
5776
  position: d.guidePosition
5760
5777
  }), {
5761
5778
  deltaX: c.delta,
5762
5779
  deltaY: d.delta,
5763
- guides: l
5780
+ guides: h
5764
5781
  };
5765
5782
  }, ns = ({
5766
- activeBounds: h,
5783
+ activeBounds: l,
5767
5784
  aligned: t,
5768
5785
  threshold: e,
5769
5786
  patterns: s,
@@ -5775,59 +5792,59 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5775
5792
  bottom: i,
5776
5793
  left: a,
5777
5794
  right: r
5778
- } = h, c = [];
5795
+ } = l, c = [];
5779
5796
  for (const d of s)
5780
- for (const l of t)
5797
+ for (const h of t)
5781
5798
  if (o === "vertical") {
5782
- const u = n - l.bottom, g = Math.abs(u - d.distance);
5799
+ const u = n - h.bottom, g = Math.abs(u - d.distance);
5783
5800
  if (g <= e) {
5784
5801
  const m = d.distance - u, v = {
5785
5802
  type: o,
5786
5803
  axis: d.axis,
5787
5804
  refStart: d.start,
5788
5805
  refEnd: d.end,
5789
- activeStart: l.bottom,
5790
- activeEnd: l.bottom + d.distance,
5806
+ activeStart: h.bottom,
5807
+ activeEnd: h.bottom + d.distance,
5791
5808
  distance: d.distance
5792
5809
  };
5793
5810
  c.push({ delta: m, guide: v, diff: g });
5794
5811
  }
5795
- const f = l.top - i, p = Math.abs(f - d.distance);
5812
+ const f = h.top - i, p = Math.abs(f - d.distance);
5796
5813
  if (p <= e) {
5797
5814
  const m = d.distance - f, v = {
5798
5815
  type: o,
5799
5816
  axis: d.axis,
5800
5817
  refStart: d.start,
5801
5818
  refEnd: d.end,
5802
- activeStart: l.top - d.distance,
5803
- activeEnd: l.top,
5819
+ activeStart: h.top - d.distance,
5820
+ activeEnd: h.top,
5804
5821
  distance: d.distance
5805
5822
  };
5806
5823
  c.push({ delta: m, guide: v, diff: p });
5807
5824
  }
5808
5825
  } else {
5809
- const u = a - l.right, g = Math.abs(u - d.distance);
5826
+ const u = a - h.right, g = Math.abs(u - d.distance);
5810
5827
  if (g <= e) {
5811
5828
  const m = d.distance - u, v = {
5812
5829
  type: o,
5813
5830
  axis: d.axis,
5814
5831
  refStart: d.start,
5815
5832
  refEnd: d.end,
5816
- activeStart: l.right,
5817
- activeEnd: l.right + d.distance,
5833
+ activeStart: h.right,
5834
+ activeEnd: h.right + d.distance,
5818
5835
  distance: d.distance
5819
5836
  };
5820
5837
  c.push({ delta: m, guide: v, diff: g });
5821
5838
  }
5822
- const f = l.left - r, p = Math.abs(f - d.distance);
5839
+ const f = h.left - r, p = Math.abs(f - d.distance);
5823
5840
  if (p <= e) {
5824
5841
  const m = d.distance - f, v = {
5825
5842
  type: o,
5826
5843
  axis: d.axis,
5827
5844
  refStart: d.start,
5828
5845
  refEnd: d.end,
5829
- activeStart: l.left - d.distance,
5830
- activeEnd: l.left,
5846
+ activeStart: h.left - d.distance,
5847
+ activeEnd: h.left,
5831
5848
  distance: d.distance
5832
5849
  };
5833
5850
  c.push({ delta: m, guide: v, diff: p });
@@ -5835,7 +5852,7 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5835
5852
  }
5836
5853
  return c;
5837
5854
  }, yo = ({
5838
- activeBounds: h,
5855
+ activeBounds: l,
5839
5856
  candidates: t,
5840
5857
  threshold: e,
5841
5858
  patterns: s
@@ -5846,18 +5863,18 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5846
5863
  bottom: i,
5847
5864
  left: a,
5848
5865
  right: r
5849
- } = h, c = t.filter((y) => Math.min(y.right, r) - Math.max(y.left, a) >= -e);
5866
+ } = l, c = t.filter((y) => Math.min(y.right, r) - Math.max(y.left, a) >= -e);
5850
5867
  if (!c.length)
5851
5868
  return { delta: 0, guide: null };
5852
5869
  const d = [
5853
5870
  ...c.map((y) => ({ bounds: y, isActive: !1 })),
5854
- { bounds: h, isActive: !0 }
5871
+ { bounds: l, isActive: !0 }
5855
5872
  ];
5856
5873
  d.sort((y, w) => y.bounds.top - w.bounds.top);
5857
- const l = d.findIndex((y) => y.isActive);
5858
- if (l === -1)
5874
+ const h = d.findIndex((y) => y.isActive);
5875
+ if (h === -1)
5859
5876
  return { delta: 0, guide: null };
5860
- const u = d[l - 1], g = d[l - 2], f = d[l + 1], p = d[l + 2], m = [], v = i - n;
5877
+ const u = d[h - 1], g = d[h - 2], f = d[h + 1], p = d[h + 2], m = [], v = i - n;
5861
5878
  if (u && g) {
5862
5879
  const { bounds: y } = u, { bounds: w } = g, A = y.top - w.bottom, j = n - y.bottom, M = Math.abs(j - A);
5863
5880
  if (M <= e) {
@@ -5891,15 +5908,15 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5891
5908
  if (u && f) {
5892
5909
  const { bounds: y } = u, { bounds: w } = f, j = w.top - y.bottom - v;
5893
5910
  if (j >= 0) {
5894
- const M = j / 2, T = n - y.bottom, S = w.top - i, C = Math.abs(T - M), B = Math.abs(S - M), F = Math.max(C, B);
5911
+ const M = j / 2, T = n - y.bottom, S = w.top - i, C = Math.abs(T - M), x = Math.abs(S - M), F = Math.max(C, x);
5895
5912
  if (F <= e) {
5896
- const U = M - T, H = i + U, V = {
5913
+ const U = M - T, W = i + U, V = {
5897
5914
  type: "vertical",
5898
5915
  axis: o,
5899
5916
  refStart: y.bottom,
5900
5917
  refEnd: y.bottom + M,
5901
- activeStart: H,
5902
- activeEnd: H + M,
5918
+ activeStart: W,
5919
+ activeEnd: W + M,
5903
5920
  distance: M
5904
5921
  };
5905
5922
  m.push({ delta: U, guide: V, diff: F });
@@ -5907,7 +5924,7 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5907
5924
  }
5908
5925
  }
5909
5926
  const b = ns({
5910
- activeBounds: h,
5927
+ activeBounds: l,
5911
5928
  aligned: c,
5912
5929
  threshold: e,
5913
5930
  patterns: s,
@@ -5921,7 +5938,7 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5921
5938
  guide: I.guide
5922
5939
  };
5923
5940
  }, vo = ({
5924
- activeBounds: h,
5941
+ activeBounds: l,
5925
5942
  candidates: t,
5926
5943
  threshold: e,
5927
5944
  patterns: s
@@ -5932,18 +5949,18 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5932
5949
  right: i,
5933
5950
  top: a,
5934
5951
  bottom: r
5935
- } = h, c = t.filter((y) => Math.min(y.bottom, r) - Math.max(y.top, a) >= -e);
5952
+ } = l, c = t.filter((y) => Math.min(y.bottom, r) - Math.max(y.top, a) >= -e);
5936
5953
  if (!c.length)
5937
5954
  return { delta: 0, guide: null };
5938
5955
  const d = [
5939
5956
  ...c.map((y) => ({ bounds: y, isActive: !1 })),
5940
- { bounds: h, isActive: !0 }
5957
+ { bounds: l, isActive: !0 }
5941
5958
  ];
5942
5959
  d.sort((y, w) => y.bounds.left - w.bounds.left);
5943
- const l = d.findIndex((y) => y.isActive);
5944
- if (l === -1)
5960
+ const h = d.findIndex((y) => y.isActive);
5961
+ if (h === -1)
5945
5962
  return { delta: 0, guide: null };
5946
- const u = d[l - 1], g = d[l - 2], f = d[l + 1], p = d[l + 2], m = [], v = i - n;
5963
+ const u = d[h - 1], g = d[h - 2], f = d[h + 1], p = d[h + 2], m = [], v = i - n;
5947
5964
  if (u && g) {
5948
5965
  const { bounds: y } = u, { bounds: w } = g, A = y.left - w.right, j = n - y.right, M = Math.abs(j - A);
5949
5966
  if (M <= e) {
@@ -5977,15 +5994,15 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5977
5994
  if (u && f) {
5978
5995
  const { bounds: y } = u, { bounds: w } = f, j = w.left - y.right - v;
5979
5996
  if (j >= 0) {
5980
- const M = j / 2, T = n - y.right, S = w.left - i, C = Math.abs(T - M), B = Math.abs(S - M), F = Math.max(C, B);
5997
+ const M = j / 2, T = n - y.right, S = w.left - i, C = Math.abs(T - M), x = Math.abs(S - M), F = Math.max(C, x);
5981
5998
  if (F <= e) {
5982
- const U = M - T, H = i + U, V = {
5999
+ const U = M - T, W = i + U, V = {
5983
6000
  type: "horizontal",
5984
6001
  axis: o,
5985
6002
  refStart: y.right,
5986
6003
  refEnd: y.right + M,
5987
- activeStart: H,
5988
- activeEnd: H + M,
6004
+ activeStart: W,
6005
+ activeEnd: W + M,
5989
6006
  distance: M
5990
6007
  };
5991
6008
  m.push({ delta: U, guide: V, diff: F });
@@ -5993,7 +6010,7 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5993
6010
  }
5994
6011
  }
5995
6012
  const b = ns({
5996
- activeBounds: h,
6013
+ activeBounds: l,
5997
6014
  aligned: c,
5998
6015
  threshold: e,
5999
6016
  patterns: s,
@@ -6007,18 +6024,18 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6007
6024
  guide: I.guide
6008
6025
  };
6009
6026
  }, bo = ({
6010
- activeBounds: h,
6027
+ activeBounds: l,
6011
6028
  candidates: t,
6012
6029
  threshold: e,
6013
6030
  spacingPatterns: s
6014
6031
  }) => {
6015
6032
  const o = yo({
6016
- activeBounds: h,
6033
+ activeBounds: l,
6017
6034
  candidates: t,
6018
6035
  threshold: e,
6019
6036
  patterns: s.vertical
6020
6037
  }), n = vo({
6021
- activeBounds: h,
6038
+ activeBounds: l,
6022
6039
  candidates: t,
6023
6040
  threshold: e,
6024
6041
  patterns: s.horizontal
@@ -6029,7 +6046,7 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6029
6046
  guides: i
6030
6047
  };
6031
6048
  }, Mo = ({
6032
- context: h,
6049
+ context: l,
6033
6050
  x: t,
6034
6051
  y: e,
6035
6052
  width: s,
@@ -6037,9 +6054,9 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6037
6054
  radius: n
6038
6055
  }) => {
6039
6056
  const i = Math.min(n, s / 2, o / 2);
6040
- h.moveTo(t + i, e), h.lineTo(t + s - i, e), h.quadraticCurveTo(t + s, e, t + s, e + i), h.lineTo(t + s, e + o - i), h.quadraticCurveTo(t + s, e + o, t + s - i, e + o), h.lineTo(t + i, e + o), h.quadraticCurveTo(t, e + o, t, e + o - i), h.lineTo(t, e + i), h.quadraticCurveTo(t, e, t + i, e), h.closePath();
6057
+ l.moveTo(t + i, e), l.lineTo(t + s - i, e), l.quadraticCurveTo(t + s, e, t + s, e + i), l.lineTo(t + s, e + o - i), l.quadraticCurveTo(t + s, e + o, t + s - i, e + o), l.lineTo(t + i, e + o), l.quadraticCurveTo(t, e + o, t, e + o - i), l.lineTo(t, e + i), l.quadraticCurveTo(t, e, t + i, e), l.closePath();
6041
6058
  }, me = ({
6042
- context: h,
6059
+ context: l,
6043
6060
  type: t,
6044
6061
  axis: e,
6045
6062
  start: s,
@@ -6050,24 +6067,24 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6050
6067
  textColor: r = "#ffffff",
6051
6068
  fontFamily: c = "sans-serif",
6052
6069
  lineWidth: d = 1,
6053
- padding: l = 4,
6070
+ padding: h = 4,
6054
6071
  radius: u = 4,
6055
6072
  offsetAlongAxis: g = 0,
6056
6073
  offsetPerpendicular: f = 0
6057
6074
  }) => {
6058
- const p = i || 1, m = 12 / p, v = l / p, b = u / p, I = (s + o) / 2 + g, y = t === "vertical" ? e + f : I, w = t === "vertical" ? I : e + f;
6059
- h.save(), h.setLineDash([]), h.fillStyle = a, h.strokeStyle = a, h.lineWidth = d / p, h.font = `${m}px ${c}`, h.textAlign = "center", h.textBaseline = "middle";
6060
- const j = h.measureText(n).width + v * 2, M = m + v * 2, T = y - j / 2, S = w - M / 2;
6061
- h.beginPath(), Mo({
6062
- context: h,
6075
+ const p = i || 1, m = 12 / p, v = h / p, b = u / p, I = (s + o) / 2 + g, y = t === "vertical" ? e + f : I, w = t === "vertical" ? I : e + f;
6076
+ l.save(), l.setLineDash([]), l.fillStyle = a, l.strokeStyle = a, l.lineWidth = d / p, l.font = `${m}px ${c}`, l.textAlign = "center", l.textBaseline = "middle";
6077
+ const j = l.measureText(n).width + v * 2, M = m + v * 2, T = y - j / 2, S = w - M / 2;
6078
+ l.beginPath(), Mo({
6079
+ context: l,
6063
6080
  x: T,
6064
6081
  y: S,
6065
6082
  width: j,
6066
6083
  height: M,
6067
6084
  radius: b
6068
- }), h.fill(), h.fillStyle = r, h.fillText(n, y, w), h.restore();
6085
+ }), l.fill(), l.fillStyle = r, l.fillText(n, y, w), l.restore();
6069
6086
  }, wo = ({
6070
- context: h,
6087
+ context: l,
6071
6088
  guide: t,
6072
6089
  zoom: e
6073
6090
  }) => {
@@ -6080,31 +6097,31 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6080
6097
  activeEnd: r,
6081
6098
  distance: c
6082
6099
  } = t, d = Math.round(c).toString();
6083
- h.beginPath(), s === "vertical" ? (h.moveTo(o, n), h.lineTo(o, i), h.moveTo(o, a), h.lineTo(o, r)) : (h.moveTo(n, o), h.lineTo(i, o), h.moveTo(a, o), h.lineTo(r, o)), h.stroke();
6084
- const l = os;
6100
+ l.beginPath(), s === "vertical" ? (l.moveTo(o, n), l.lineTo(o, i), l.moveTo(o, a), l.lineTo(o, r)) : (l.moveTo(n, o), l.lineTo(i, o), l.moveTo(a, o), l.lineTo(r, o)), l.stroke();
6101
+ const h = os;
6085
6102
  me({
6086
- context: h,
6103
+ context: l,
6087
6104
  type: s,
6088
6105
  axis: o,
6089
6106
  start: n,
6090
6107
  end: i,
6091
6108
  text: d,
6092
6109
  zoom: e,
6093
- color: l,
6110
+ color: h,
6094
6111
  lineWidth: pe
6095
6112
  }), me({
6096
- context: h,
6113
+ context: l,
6097
6114
  type: s,
6098
6115
  axis: o,
6099
6116
  start: a,
6100
6117
  end: r,
6101
6118
  text: d,
6102
6119
  zoom: e,
6103
- color: l,
6120
+ color: h,
6104
6121
  lineWidth: pe
6105
6122
  });
6106
6123
  }, qe = ({
6107
- anchors: h,
6124
+ anchors: l,
6108
6125
  bounds: t
6109
6126
  }) => {
6110
6127
  const {
@@ -6115,24 +6132,24 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6115
6132
  bottom: i,
6116
6133
  centerY: a
6117
6134
  } = t;
6118
- h.vertical.push(e, o, s), h.horizontal.push(n, a, i);
6135
+ l.vertical.push(e, o, s), l.horizontal.push(n, a, i);
6119
6136
  }, Je = ({
6120
- bounds: h,
6137
+ bounds: l,
6121
6138
  type: t,
6122
6139
  primaryStart: e,
6123
6140
  primaryEnd: s
6124
6141
  }) => {
6125
- const o = [], n = e === "top" ? "left" : "top", i = s === "bottom" ? "right" : "bottom", a = [...h].sort((r, c) => r[e] - c[e]);
6142
+ const o = [], n = e === "top" ? "left" : "top", i = s === "bottom" ? "right" : "bottom", a = [...l].sort((r, c) => r[e] - c[e]);
6126
6143
  for (let r = 0; r < a.length; r += 1) {
6127
6144
  const c = a[r];
6128
- let d = null, l = Number.POSITIVE_INFINITY;
6145
+ let d = null, h = Number.POSITIVE_INFINITY;
6129
6146
  for (let p = r + 1; p < a.length; p += 1) {
6130
6147
  const m = a[p];
6131
6148
  if (Math.min(c[i], m[i]) - Math.max(c[n], m[n]) < 0) continue;
6132
6149
  const b = m[e] - c[s];
6133
- b < 0 || b < l && (l = b, d = m);
6150
+ b < 0 || b < h && (h = b, d = m);
6134
6151
  }
6135
- if (!d || l === Number.POSITIVE_INFINITY) continue;
6152
+ if (!d || h === Number.POSITIVE_INFINITY) continue;
6136
6153
  const u = Math.max(c[n], d[n]), g = Math.min(c[i], d[i]), f = (u + g) / 2;
6137
6154
  o.push({
6138
6155
  type: t,
@@ -6144,34 +6161,34 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6144
6161
  }
6145
6162
  return o;
6146
6163
  }, So = ({
6147
- bounds: h
6164
+ bounds: l
6148
6165
  }) => {
6149
6166
  const t = Je({
6150
- bounds: h,
6167
+ bounds: l,
6151
6168
  type: "vertical",
6152
6169
  primaryStart: "top",
6153
6170
  primaryEnd: "bottom"
6154
6171
  }), e = Je({
6155
- bounds: h,
6172
+ bounds: l,
6156
6173
  type: "horizontal",
6157
6174
  primaryStart: "left",
6158
6175
  primaryEnd: "right"
6159
6176
  });
6160
6177
  return { vertical: t, horizontal: e };
6161
6178
  }, Ao = ["montage-area", "background", "interaction-blocker"], is = ({
6162
- activeObject: h
6179
+ activeObject: l
6163
6180
  }) => {
6164
6181
  const t = /* @__PURE__ */ new Set();
6165
- return h && (t.add(h), h instanceof x && h.getObjects().forEach((e) => t.add(e))), t;
6182
+ return l && (t.add(l), l instanceof k && l.getObjects().forEach((e) => t.add(e))), t;
6166
6183
  }, as = ({
6167
- object: h,
6184
+ object: l,
6168
6185
  excluded: t,
6169
6186
  ignoredIds: e = Ao
6170
6187
  }) => {
6171
- if (t.has(h)) return !0;
6172
- const { visible: s = !0 } = h;
6188
+ if (t.has(l)) return !0;
6189
+ const { visible: s = !0 } = l;
6173
6190
  if (!s) return !0;
6174
- const { id: o } = h;
6191
+ const { id: o } = l;
6175
6192
  return !!(o && e.includes(o));
6176
6193
  };
6177
6194
  class jo {
@@ -6241,12 +6258,12 @@ class jo {
6241
6258
  activeBounds: n,
6242
6259
  threshold: r,
6243
6260
  anchors: this.anchors
6244
- }), { deltaX: d, deltaY: l, guides: u } = c;
6245
- if (d !== 0 || l !== 0) {
6261
+ }), { deltaX: d, deltaY: h, guides: u } = c;
6262
+ if (d !== 0 || h !== 0) {
6246
6263
  const { left: v = 0, top: b = 0 } = e;
6247
6264
  e.set({
6248
6265
  left: v + d,
6249
- top: b + l
6266
+ top: b + h
6250
6267
  }), e.setCoords(), n = (p = ft({ object: e })) != null ? p : n;
6251
6268
  }
6252
6269
  const g = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => ft({ object: v })).filter((v) => !!v), f = bo({
@@ -6289,12 +6306,12 @@ class jo {
6289
6306
  if (!s) return;
6290
6307
  const o = e != null ? e : this._calculateViewportBounds(), { left: n, right: i, top: a, bottom: r } = o, { viewportTransform: c } = t, d = t.getZoom() || 1;
6291
6308
  s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = pe / d, s.strokeStyle = os, s.setLineDash([4, 4]);
6292
- for (const l of this.activeGuides)
6293
- s.beginPath(), l.type === "vertical" ? (s.moveTo(l.position, a), s.lineTo(l.position, r)) : (s.moveTo(n, l.position), s.lineTo(i, l.position)), s.stroke();
6294
- for (const l of this.activeSpacingGuides)
6309
+ for (const h of this.activeGuides)
6310
+ s.beginPath(), h.type === "vertical" ? (s.moveTo(h.position, a), s.lineTo(h.position, r)) : (s.moveTo(n, h.position), s.lineTo(i, h.position)), s.stroke();
6311
+ for (const h of this.activeSpacingGuides)
6295
6312
  wo({
6296
6313
  context: s,
6297
- guide: l,
6314
+ guide: h,
6298
6315
  zoom: d
6299
6316
  });
6300
6317
  s.restore();
@@ -6377,10 +6394,10 @@ class jo {
6377
6394
  i = 1,
6378
6395
  a = 0,
6379
6396
  r = 0
6380
- ] = e != null ? e : [], c = (0 - a) / n, d = (0 - r) / i, l = (s - a) / n, u = (o - r) / i;
6397
+ ] = e != null ? e : [], c = (0 - a) / n, d = (0 - r) / i, h = (s - a) / n, u = (o - r) / i;
6381
6398
  return {
6382
6399
  left: c,
6383
- right: l,
6400
+ right: h,
6384
6401
  top: d,
6385
6402
  bottom: u
6386
6403
  };
@@ -6565,7 +6582,7 @@ class Lt {
6565
6582
  centerY: c = 0
6566
6583
  } = t, {
6567
6584
  left: d = 0,
6568
- right: l = 0,
6585
+ right: h = 0,
6569
6586
  top: u = 0,
6570
6587
  bottom: g = 0,
6571
6588
  centerY: f = 0
@@ -6581,19 +6598,19 @@ class Lt {
6581
6598
  distance: C
6582
6599
  }), o;
6583
6600
  }
6584
- if (l <= n) {
6601
+ if (h <= n) {
6585
6602
  if (s) return o;
6586
- const C = n - l;
6603
+ const C = n - h;
6587
6604
  return C > 0 && o.push({
6588
6605
  type: "horizontal",
6589
6606
  axis: b,
6590
- start: l,
6607
+ start: h,
6591
6608
  end: n,
6592
6609
  distance: C
6593
6610
  }), o;
6594
6611
  }
6595
6612
  if (!s) return o;
6596
- const I = n < d, y = i > l, w = Math.min(n, d), A = Math.max(n, d), j = A - w;
6613
+ const I = n < d, y = i > h, w = Math.min(n, d), A = Math.max(n, d), j = A - w;
6597
6614
  j > 0 && !I && o.push({
6598
6615
  type: "horizontal",
6599
6616
  axis: b,
@@ -6601,7 +6618,7 @@ class Lt {
6601
6618
  end: A,
6602
6619
  distance: j
6603
6620
  });
6604
- const M = Math.min(i, l), T = Math.max(i, l), S = T - M;
6621
+ const M = Math.min(i, h), T = Math.max(i, h), S = T - M;
6605
6622
  return S > 0 && !y && o.push({
6606
6623
  type: "horizontal",
6607
6624
  axis: b,
@@ -6626,7 +6643,7 @@ class Lt {
6626
6643
  centerX: c = 0
6627
6644
  } = t, {
6628
6645
  top: d = 0,
6629
- bottom: l = 0,
6646
+ bottom: h = 0,
6630
6647
  left: u = 0,
6631
6648
  right: g = 0,
6632
6649
  centerX: f = 0
@@ -6642,19 +6659,19 @@ class Lt {
6642
6659
  distance: C
6643
6660
  }), o;
6644
6661
  }
6645
- if (l <= n) {
6662
+ if (h <= n) {
6646
6663
  if (s) return o;
6647
- const C = n - l;
6664
+ const C = n - h;
6648
6665
  return C > 0 && o.push({
6649
6666
  type: "vertical",
6650
6667
  axis: b,
6651
- start: l,
6668
+ start: h,
6652
6669
  end: n,
6653
6670
  distance: C
6654
6671
  }), o;
6655
6672
  }
6656
6673
  if (!s) return o;
6657
- const I = n < d, y = i > l, w = Math.min(n, d), A = Math.max(n, d), j = A - w;
6674
+ const I = n < d, y = i > h, w = Math.min(n, d), A = Math.max(n, d), j = A - w;
6658
6675
  j > 0 && !I && o.push({
6659
6676
  type: "vertical",
6660
6677
  axis: b,
@@ -6662,7 +6679,7 @@ class Lt {
6662
6679
  end: A,
6663
6680
  distance: j
6664
6681
  });
6665
- const M = Math.min(i, l), T = Math.max(i, l), S = T - M;
6682
+ const M = Math.min(i, h), T = Math.max(i, h), S = T - M;
6666
6683
  return S > 0 && !y && o.push({
6667
6684
  type: "vertical",
6668
6685
  axis: b,
@@ -6698,11 +6715,11 @@ class Lt {
6698
6715
  const { viewportTransform: s } = t, o = t.getZoom() || 1, n = this.activeGuides.some((c) => c.type === "vertical"), i = this.activeGuides.some((c) => c.type === "horizontal"), a = n && i && !this.isTargetMontageArea, r = a ? 12 / o : 0;
6699
6716
  e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = ts / o, e.strokeStyle = $e, e.setLineDash([]);
6700
6717
  for (const c of this.activeGuides) {
6701
- const { type: d, axis: l, start: u, end: g, distance: f } = c, p = Math.abs(g - u), m = u <= g ? -1 : 1, v = a ? m * (p / 2 + r) : 0, b = 0;
6702
- e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, g)) : (e.moveTo(u, l), e.lineTo(g, l)), e.stroke(), me({
6718
+ const { type: d, axis: h, start: u, end: g, distance: f } = c, p = Math.abs(g - u), m = u <= g ? -1 : 1, v = a ? m * (p / 2 + r) : 0, b = 0;
6719
+ e.beginPath(), d === "vertical" ? (e.moveTo(h, u), e.lineTo(h, g)) : (e.moveTo(u, h), e.lineTo(g, h)), e.stroke(), me({
6703
6720
  context: e,
6704
6721
  type: d,
6705
- axis: l,
6722
+ axis: h,
6706
6723
  start: u,
6707
6724
  end: g,
6708
6725
  text: Math.round(f).toString(),
@@ -6762,7 +6779,7 @@ class Se {
6762
6779
  initialStateJSON: r,
6763
6780
  scaleType: c,
6764
6781
  showRotationAngle: d,
6765
- _onReadyCallback: l
6782
+ _onReadyCallback: h
6766
6783
  } = this.options;
6767
6784
  if (J.apply(), this.canvas = new vs(this.containerId, this.options), this.moduleLoader = new As(), this.workerManager = new Is(), this.errorManager = new Yt({ editor: this }), this.historyManager = new Jt({ editor: this }), this.toolbar = new Ys({ editor: this }), this.transformManager = new qs({ editor: this }), this.zoomManager = new Js({ editor: this }), this.canvasManager = new Qs({ editor: this }), this.imageManager = new ct({ editor: this }), this.layerManager = new $t({ editor: this }), this.shapeManager = new to({ editor: this }), this.interactionBlocker = new $s({ editor: this }), this.backgroundManager = new Ot({ editor: this }), this.clipboardManager = new eo({ editor: this }), this.objectLockManager = new te({ editor: this }), this.groupingManager = new so({ editor: this }), this.selectionManager = new oo({ editor: this }), this.deletionManager = new we({ editor: this }), this.panConstraintManager = new no({ editor: this }), this.snappingManager = new jo({ editor: this }), this.measurementManager = new Lt({ editor: this }), this.fontManager = new fe((u = this.options.fonts) != null ? u : []), this.textManager = new Z({ editor: this }), this.templateManager = new R({ editor: this }), d && (this.angleIndicator = new Me({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Ut({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(o), this.canvasManager.setCanvasCSSWidth(n), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
6768
6785
  const {
@@ -6772,7 +6789,7 @@ class Se {
6772
6789
  } = a;
6773
6790
  yield this.imageManager.importImage({ source: g, scale: f, withoutSave: p });
6774
6791
  }
6775
- r && this.historyManager.loadStateFromFullState(r), this.historyManager.saveState(), console.log("editor:ready"), this.canvas.fire("editor:ready", this), typeof l == "function" && l(this);
6792
+ r && this.historyManager.loadStateFromFullState(r), this.historyManager.saveState(), console.log("editor:ready"), this.canvas.fire("editor:ready", this), typeof h == "function" && h(this);
6776
6793
  });
6777
6794
  }
6778
6795
  /**
@@ -7753,15 +7770,15 @@ const E = [
7753
7770
  */
7754
7771
  fonts: Io
7755
7772
  };
7756
- function Do(h, t = {}) {
7757
- const e = _(_({}, Co), t), s = document.getElementById(h);
7773
+ function Do(l, t = {}) {
7774
+ const e = _(_({}, Co), t), s = document.getElementById(l);
7758
7775
  if (!s)
7759
- return Promise.reject(new Error(`Контейнер с ID "${h}" не найден.`));
7776
+ return Promise.reject(new Error(`Контейнер с ID "${l}" не найден.`));
7760
7777
  const o = document.createElement("canvas");
7761
- return o.id = `${h}-canvas`, s.appendChild(o), e.editorContainer = s, new Promise((n) => {
7778
+ return o.id = `${l}-canvas`, s.appendChild(o), e.editorContainer = s, new Promise((n) => {
7762
7779
  e._onReadyCallback = n;
7763
7780
  const i = new Se(o.id, e);
7764
- window[h] = i;
7781
+ window[l] = i;
7765
7782
  });
7766
7783
  }
7767
7784
  export {