@anu3ev/fabric-image-editor 0.5.8 → 0.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/main.js +782 -729
  2. package/package.json +1 -1
  3. package/readme.md +27 -8
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 = (l, t, e) => t in l ? ds(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e, _ = (l, t) => {
5
+ var Re = (h, t, e) => t in h ? ds(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, N = (h, t) => {
6
6
  for (var e in t || (t = {}))
7
- _e.call(t, e) && Re(l, e, t[e]);
7
+ _e.call(t, e) && Re(h, e, t[e]);
8
8
  if (Gt)
9
9
  for (var e of Gt(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) => {
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) => {
14
14
  var e = {};
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]);
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]);
20
20
  return e;
21
21
  };
22
- var N = (l, t, e) => new Promise((s, o) => {
22
+ var x = (h, t, e) => new Promise((s, o) => {
23
23
  var n = (r) => {
24
24
  try {
25
25
  a(e.next(r));
@@ -33,7 +33,7 @@ var N = (l, 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(l, t)).next());
36
+ a((e = e.apply(h, t)).next());
37
37
  });
38
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";
@@ -175,7 +175,7 @@ class Ut {
175
175
  * @param event.code — код клавиши
176
176
  */
177
177
  handleUndoRedoEvent(t) {
178
- return N(this, null, function* () {
178
+ return x(this, null, function* () {
179
179
  const { ctrlKey: e, metaKey: s, code: o, repeat: n } = t;
180
180
  this._shouldIgnoreKeyboardEvent(t) || !e && !s || n || !/Mac/i.test(navigator.userAgent) && this.isUndoRedoKeyPressed || (o === "KeyZ" ? (t.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.undo()) : o === "KeyY" && (t.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.redo()));
181
181
  });
@@ -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 h = r;
365
- if (h.matches && h.matches(d) || h.closest && h.closest(d))
364
+ const l = r;
365
+ if (l.matches && l.matches(d) || l.closest && l.closest(d))
366
366
  return !0;
367
- } catch (h) {
368
- console.warn(`Error checking selection container with selector "${d}":`, h);
367
+ } catch (l) {
368
+ console.warn(`Error checking selection container with selector "${d}":`, l);
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(l) {
412
+ function js(h) {
413
413
  return new Worker(
414
414
  "" + new URL("assets/worker-CN39s7P7.js", import.meta.url).href,
415
415
  {
416
- name: l == null ? void 0 : l.name
416
+ name: h == null ? void 0 : h.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(l, t, e, s, o) {
467
+ function Vt(h, t, e, s, o) {
468
468
  const n = rt, i = Cs;
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();
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();
470
470
  }
471
- function Ue(l, t, e, s, o) {
471
+ function Ue(h, t, e, s, o) {
472
472
  const n = le, i = he, a = Ts;
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();
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();
474
474
  }
475
- function Ye(l, t, e, s, o) {
475
+ function Ye(h, t, e, s, o) {
476
476
  const n = ue, i = ge, a = Es;
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();
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();
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(l, t, e, s, o) {
481
+ function Ds(h, t, e, s, o) {
482
482
  const i = qt / 2;
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();
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();
484
484
  }
485
485
  const Rs = {
486
486
  // Угловые точки
@@ -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: h } = a;
605
+ const { left: r, top: c, width: d, height: l } = a;
606
606
  this.set({
607
607
  flipX: !1,
608
608
  flipY: !1,
609
609
  width: d,
610
- height: h
610
+ height: l
611
611
  });
612
- const u = new tt(r + d / 2, c + h / 2);
612
+ const u = new tt(r + d / 2, c + l / 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: h, width: u, height: g } = c, f = new tt(d + u / 2, h + g / 2);
627
+ const { left: d, top: l, width: u, height: g } = c, f = new tt(d + u / 2, l + g / 2);
628
628
  return this.set({
629
629
  width: u,
630
630
  height: g
@@ -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: h, top: u, width: g, height: f } = d, p = new tt(g, f), m = new tt(h + g / 2, u + f / 2);
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);
648
648
  return r === "initialization" ? {
649
649
  center: m,
650
650
  relativeCorrection: new tt(0, 0),
@@ -694,7 +694,7 @@ const B = class B {
694
694
  this.fonts = t;
695
695
  }
696
696
  loadFonts() {
697
- return N(this, null, function* () {
697
+ return x(this, null, function* () {
698
698
  var o;
699
699
  const t = (o = this.fonts) != null ? o : [];
700
700
  if (!t.length) return;
@@ -705,7 +705,7 @@ const B = class B {
705
705
  });
706
706
  }
707
707
  static loadFont(t, e) {
708
- return N(this, null, function* () {
708
+ return x(this, null, function* () {
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;
@@ -720,8 +720,8 @@ const B = class B {
720
720
  const u = yield new FontFace(o, i, t.descriptors).load();
721
721
  e.fonts.add(u), B.registeredFontKeys.add(r);
722
722
  return;
723
- } catch (h) {
724
- console.warn(`Не удалось загрузить шрифт "${o}" через FontFace API`, h);
723
+ } catch (l) {
724
+ console.warn(`Не удалось загрузить шрифт "${o}" через FontFace API`, l);
725
725
  }
726
726
  B.injectFontFace({
727
727
  font: t,
@@ -747,7 +747,7 @@ const B = class B {
747
747
  "@font-face {",
748
748
  ` font-family: ${B.formatFontFamilyForCss(i)};`,
749
749
  ` src: ${e};`,
750
- ...r.map((h) => ` ${h}`),
750
+ ...r.map((l) => ` ${l}`),
751
751
  "}"
752
752
  ];
753
753
  a.textContent = c.join(`
@@ -932,29 +932,29 @@ const _s = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
932
932
  sendBackwards: ks
933
933
  },
934
934
  handlers: {
935
- copyPaste: (l) => N(null, null, function* () {
936
- l.clipboardManager.copyPaste();
935
+ copyPaste: (h) => x(null, null, function* () {
936
+ h.clipboardManager.copyPaste();
937
937
  }),
938
- delete: (l) => {
939
- l.deletionManager.deleteSelectedObjects();
938
+ delete: (h) => {
939
+ h.deletionManager.deleteSelectedObjects();
940
940
  },
941
- lock: (l) => {
942
- l.objectLockManager.lockObject();
941
+ lock: (h) => {
942
+ h.objectLockManager.lockObject();
943
943
  },
944
- unlock: (l) => {
945
- l.objectLockManager.unlockObject();
944
+ unlock: (h) => {
945
+ h.objectLockManager.unlockObject();
946
946
  },
947
- bringForward: (l) => {
948
- l.layerManager.bringForward();
947
+ bringForward: (h) => {
948
+ h.layerManager.bringForward();
949
949
  },
950
- bringToFront: (l) => {
951
- l.layerManager.bringToFront();
950
+ bringToFront: (h) => {
951
+ h.layerManager.bringToFront();
952
952
  },
953
- sendToBack: (l) => {
954
- l.layerManager.sendToBack();
953
+ sendToBack: (h) => {
954
+ h.layerManager.sendToBack();
955
955
  },
956
- sendBackwards: (l) => {
957
- l.layerManager.sendBackwards();
956
+ sendBackwards: (h) => {
957
+ h.layerManager.sendBackwards();
958
958
  }
959
959
  }
960
960
  };
@@ -965,11 +965,11 @@ class Ys {
965
965
  _initToolbar() {
966
966
  if (!this.options.showToolbar) return;
967
967
  const t = this.options.toolbar || {};
968
- this.config = yt(_(_({}, Pt), t), {
969
- style: _(_({}, Pt.style), t.style || {}),
970
- btnStyle: _(_({}, Pt.btnStyle), t.btnStyle || {}),
971
- icons: _(_({}, Pt.icons), t.icons || {}),
972
- handlers: _(_({}, Pt.handlers), t.handlers || {})
968
+ this.config = yt(N(N({}, Pt), t), {
969
+ style: N(N({}, Pt.style), t.style || {}),
970
+ btnStyle: N(N({}, Pt.btnStyle), t.btnStyle || {}),
971
+ icons: N(N({}, Pt.icons), t.icons || {}),
972
+ handlers: N(N({}, Pt.handlers), t.handlers || {})
973
973
  }), this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this._onMouseDown = this._handleMouseDown.bind(this), this._onObjectMoving = this._startTransform.bind(this), this._onObjectScaling = this._startTransform.bind(this), this._onObjectRotating = this._startTransform.bind(this), this._onMouseUp = this._endTransform.bind(this), this._onObjectModified = this._endTransform.bind(this), this._onSelectionChange = this._updateToolbar.bind(this), this._onSelectionClear = () => {
974
974
  this.el.style.display = "none";
975
975
  }, this._createDOM(), this._bindEvents();
@@ -1377,18 +1377,18 @@ class Jt {
1377
1377
  * @fires editor:history-state-loaded
1378
1378
  */
1379
1379
  loadStateFromFullState(t) {
1380
- return N(this, null, function* () {
1380
+ return x(this, null, function* () {
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, (h, u) => {
1385
- Jt._deserializeCustomData(h, u);
1384
+ o.overlayMask = null, Jt._serializeCustomData(t), yield e.loadFromJSON(t, (l, u) => {
1385
+ Jt._deserializeCustomData(l, u);
1386
1386
  });
1387
- const r = e.getObjects().find((h) => h.id === "montage-area");
1387
+ const r = e.getObjects().find((l) => l.id === "montage-area");
1388
1388
  r && (this.editor.montageArea = r, (i !== e.getWidth() || a !== e.getHeight()) && s.updateCanvas());
1389
- const c = e.getObjects().find((h) => h.id === "overlay-mask");
1389
+ const c = e.getObjects().find((l) => l.id === "overlay-mask");
1390
1390
  c && (o.overlayMask = c, o.overlayMask.visible = !1);
1391
- const d = e.getObjects().find((h) => h.id === "background");
1391
+ const d = e.getObjects().find((l) => l.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,
@@ -1404,7 +1404,7 @@ class Jt {
1404
1404
  * @fires editor:undo
1405
1405
  */
1406
1406
  undo() {
1407
- return N(this, null, function* () {
1407
+ return x(this, null, function* () {
1408
1408
  if (!this.skipHistory) {
1409
1409
  if (this.currentIndex <= 0) {
1410
1410
  console.log("Нет предыдущих состояний для отмены.");
@@ -1441,7 +1441,7 @@ class Jt {
1441
1441
  * @fires editor:redo
1442
1442
  */
1443
1443
  redo() {
1444
- return N(this, null, function* () {
1444
+ return x(this, null, function* () {
1445
1445
  if (!this.skipHistory) {
1446
1446
  if (this.currentIndex >= this.patches.length) {
1447
1447
  console.log("Нет состояний для повтора.");
@@ -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, h = !!a.lockMovementY;
1483
- !d && !h || (e.push({
1482
+ const d = !!a.lockMovementX, l = !!a.lockMovementY;
1483
+ !d && !l || (e.push({
1484
1484
  object: a,
1485
1485
  lockMovementX: a.lockMovementX,
1486
1486
  lockMovementY: a.lockMovementY,
@@ -1528,7 +1528,7 @@ class ct {
1528
1528
  * @returns возвращает Promise с объектом изображения или null в случае ошибки
1529
1529
  */
1530
1530
  importImage(t) {
1531
- return N(this, null, function* () {
1531
+ return x(this, null, function* () {
1532
1532
  const {
1533
1533
  source: e,
1534
1534
  scale: s = `image-${this.options.scaleType}`,
@@ -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: h, 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: l, 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
- h.suspendHistory();
1561
+ l.suspendHistory();
1562
1562
  try {
1563
1563
  let v, b;
1564
1564
  if (e instanceof File)
@@ -1593,21 +1593,21 @@ class ct {
1593
1593
  const A = b.getElement();
1594
1594
  let j = "";
1595
1595
  if (A instanceof HTMLImageElement ? j = A.src : A instanceof HTMLCanvasElement && (j = A.toDataURL()), y > wt || I > Mt) {
1596
- const M = yield this.resizeImageToBoundaries(j, "max"), T = URL.createObjectURL(M);
1597
- this._createdBlobUrls.push(T), b = yield zt.fromURL(T, { crossOrigin: "anonymous" });
1596
+ const S = yield this.resizeImageToBoundaries(j, "max"), C = URL.createObjectURL(S);
1597
+ this._createdBlobUrls.push(C), b = yield zt.fromURL(C, { crossOrigin: "anonymous" });
1598
1598
  } else if (y < _t || I < Rt) {
1599
- const M = yield this.resizeImageToBoundaries(j, "min"), T = URL.createObjectURL(M);
1600
- this._createdBlobUrls.push(T), b = yield zt.fromURL(T, { crossOrigin: "anonymous" });
1599
+ const S = yield this.resizeImageToBoundaries(j, "min"), C = URL.createObjectURL(S);
1600
+ this._createdBlobUrls.push(C), b = yield zt.fromURL(C, { crossOrigin: "anonymous" });
1601
1601
  }
1602
1602
  }
1603
1603
  if (b.set("id", `${b.type}-${G()}`), b.set("format", f), s === "scale-montage")
1604
1604
  this.editor.canvasManager.scaleMontageAreaToImage({ object: b, withoutSave: !0 });
1605
1605
  else {
1606
- const { width: A, height: j } = c, M = this.calculateScaleFactor({ imageObject: b, scaleType: s });
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 });
1606
+ const { width: A, height: j } = c, S = this.calculateScaleFactor({ imageObject: b, scaleType: s });
1607
+ s === "image-contain" && S < 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(), h.resumeHistory(), o || h.saveState();
1610
- const w = {
1609
+ r.add(b), r.centerObject(b), a || r.setActiveObject(b), r.renderAll(), l.resumeHistory(), o || l.saveState();
1610
+ const M = {
1611
1611
  image: b,
1612
1612
  format: f,
1613
1613
  contentType: g,
@@ -1618,7 +1618,7 @@ class ct {
1618
1618
  isBackground: i,
1619
1619
  withoutSelection: a
1620
1620
  };
1621
- return r.fire("editor:image-imported", w), w;
1621
+ return r.fire("editor:image-imported", M), M;
1622
1622
  } catch (v) {
1623
1623
  return u.emitError({
1624
1624
  origin: "ImageManager",
@@ -1635,7 +1635,7 @@ class ct {
1635
1635
  isBackground: i,
1636
1636
  withoutSelection: a
1637
1637
  }
1638
- }), h.resumeHistory(), null;
1638
+ }), l.resumeHistory(), null;
1639
1639
  }
1640
1640
  });
1641
1641
  }
@@ -1648,7 +1648,7 @@ class ct {
1648
1648
  * @returns возвращает Promise с Blob-объектом уменьшенного изображения
1649
1649
  */
1650
1650
  resizeImageToBoundaries(t, e = "max") {
1651
- return N(this, null, function* () {
1651
+ return x(this, null, function* () {
1652
1652
  let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${Mt}x${wt}`;
1653
1653
  e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${Rt}x${_t}`);
1654
1654
  const o = {
@@ -1680,7 +1680,7 @@ class ct {
1680
1680
  * @fires editor:canvas-exported
1681
1681
  */
1682
1682
  exportCanvasAsImageFile() {
1683
- return N(this, arguments, function* (t = {}) {
1683
+ return x(this, arguments, function* (t = {}) {
1684
1684
  const {
1685
1685
  fileName: e = "image.png",
1686
1686
  contentType: s = "image/png",
@@ -1688,22 +1688,22 @@ 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", h = d ? "image/jpg" : s, u = ct.getFormatFromContentType(h);
1691
+ const d = s === "application/pdf", l = d ? "image/jpg" : s, u = ct.getFormatFromContentType(l);
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(h) && (v.backgroundColor = "#ffffff");
1695
- const b = v.getObjects().find((S) => S.id === a.id);
1694
+ v.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(l) && (v.backgroundColor = "#ffffff");
1695
+ const b = v.getObjects().find((w) => w.id === a.id);
1696
1696
  if (b && (b.visible = !1), c != null && c.isBlocked) {
1697
- const S = v.getObjects().find((C) => C.id === c.overlayMask.id);
1698
- S && (S.visible = !1);
1697
+ const w = v.getObjects().find((T) => T.id === c.overlayMask.id);
1698
+ w && (w.visible = !1);
1699
1699
  }
1700
1700
  v.viewportTransform = [1, 0, 0, 1, -g, -f], v.setDimensions({ width: p, height: m }, { backstoreOnly: !0 }), v.renderAll();
1701
- const I = v.getObjects().filter((S) => S.format).every((S) => S.format === "svg");
1701
+ const I = v.getObjects().filter((w) => w.format).every((w) => w.format === "svg");
1702
1702
  if (u === "svg" && I) {
1703
- const S = v.toSVG();
1703
+ const w = v.toSVG();
1704
1704
  v.dispose();
1705
- const x = {
1706
- image: ct._exportSVGStringAsFile(S, {
1705
+ const E = {
1706
+ image: ct._exportSVGStringAsFile(w, {
1707
1707
  exportAsBase64: o,
1708
1708
  exportAsBlob: n,
1709
1709
  fileName: e
@@ -1712,66 +1712,66 @@ class ct {
1712
1712
  contentType: "image/svg+xml",
1713
1713
  fileName: e.replace(/\.[^/.]+$/, ".svg")
1714
1714
  };
1715
- return i.fire("editor:canvas-exported", x), x;
1715
+ return i.fire("editor:canvas-exported", E), E;
1716
1716
  }
1717
- const y = yield new Promise((S, C) => {
1718
- v.getElement().toBlob((x) => {
1719
- x ? S(x) : C(new Error("Failed to create Blob from canvas"));
1717
+ const y = yield new Promise((w, T) => {
1718
+ v.getElement().toBlob((E) => {
1719
+ E ? w(E) : T(new Error("Failed to create Blob from canvas"));
1720
1720
  });
1721
1721
  });
1722
1722
  if (v.dispose(), n) {
1723
- const S = {
1723
+ const w = {
1724
1724
  image: y,
1725
1725
  format: u,
1726
- contentType: h,
1726
+ contentType: l,
1727
1727
  fileName: e
1728
1728
  };
1729
- return i.fire("editor:canvas-exported", S), S;
1729
+ return i.fire("editor:canvas-exported", w), w;
1730
1730
  }
1731
- const w = yield createImageBitmap(y), A = yield r.post(
1731
+ const M = yield createImageBitmap(y), A = yield r.post(
1732
1732
  "toDataURL",
1733
- { format: u, quality: 1, bitmap: w },
1734
- [w]
1733
+ { format: u, quality: 1, bitmap: M },
1734
+ [M]
1735
1735
  );
1736
1736
  if (d) {
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",
1737
+ const T = p * 0.264583, E = m * 0.264583, U = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, z = new U({
1738
+ orientation: T > E ? "landscape" : "portrait",
1739
1739
  unit: "mm",
1740
- format: [C, x]
1740
+ format: [T, E]
1741
1741
  });
1742
- if (U.addImage(String(A), "JPG", 0, 0, C, x), o) {
1743
- const z = {
1744
- image: U.output("datauristring"),
1742
+ if (z.addImage(String(A), "JPG", 0, 0, T, E), o) {
1743
+ const F = {
1744
+ image: z.output("datauristring"),
1745
1745
  format: "pdf",
1746
1746
  contentType: "application/pdf",
1747
1747
  fileName: e
1748
1748
  };
1749
- return i.fire("editor:canvas-exported", z), z;
1749
+ return i.fire("editor:canvas-exported", F), F;
1750
1750
  }
1751
- const W = U.output("blob"), L = {
1752
- image: new File([W], e, { type: "application/pdf" }),
1751
+ const Y = z.output("blob"), D = {
1752
+ image: new File([Y], e, { type: "application/pdf" }),
1753
1753
  format: "pdf",
1754
1754
  contentType: "application/pdf",
1755
1755
  fileName: e
1756
1756
  };
1757
- return i.fire("editor:canvas-exported", L), L;
1757
+ return i.fire("editor:canvas-exported", D), D;
1758
1758
  }
1759
1759
  if (o) {
1760
- const S = {
1760
+ const w = {
1761
1761
  image: A,
1762
1762
  format: u,
1763
- contentType: h,
1763
+ contentType: l,
1764
1764
  fileName: e
1765
1765
  };
1766
- return i.fire("editor:canvas-exported", S), S;
1766
+ return i.fire("editor:canvas-exported", w), w;
1767
1767
  }
1768
- const j = u === "svg" && !I ? e.replace(/\.[^/.]+$/, ".png") : e, T = {
1769
- image: new File([y], j, { type: h }),
1768
+ const j = u === "svg" && !I ? e.replace(/\.[^/.]+$/, ".png") : e, C = {
1769
+ image: new File([y], j, { type: l }),
1770
1770
  format: u,
1771
- contentType: h,
1771
+ contentType: l,
1772
1772
  fileName: j
1773
1773
  };
1774
- return i.fire("editor:canvas-exported", T), T;
1774
+ return i.fire("editor:canvas-exported", C), C;
1775
1775
  } catch (d) {
1776
1776
  return this.editor.errorManager.emitError({
1777
1777
  origin: "ImageManager",
@@ -1795,7 +1795,7 @@ class ct {
1795
1795
  * @fires editor:object-exported
1796
1796
  */
1797
1797
  exportObjectAsImageFile() {
1798
- return N(this, arguments, function* (t = {}) {
1798
+ return x(this, arguments, function* (t = {}) {
1799
1799
  const {
1800
1800
  object: e,
1801
1801
  fileName: s = "image.png",
@@ -1845,10 +1845,10 @@ class ct {
1845
1845
  };
1846
1846
  return a.fire("editor:object-exported", v), v;
1847
1847
  }
1848
- const h = c.toCanvasElement({
1848
+ const l = c.toCanvasElement({
1849
1849
  enableRetinaScaling: !1
1850
1850
  }), u = yield new Promise((p, m) => {
1851
- h.toBlob((v) => {
1851
+ l.toBlob((v) => {
1852
1852
  v ? p(v) : m(new Error("Failed to create Blob from canvas"));
1853
1853
  });
1854
1854
  });
@@ -1908,7 +1908,7 @@ class ct {
1908
1908
  * @public
1909
1909
  */
1910
1910
  getContentType(t) {
1911
- return N(this, null, function* () {
1911
+ return x(this, null, function* () {
1912
1912
  return typeof t == "string" ? this.getContentTypeFromUrl(t) : t.type || "application/octet-stream";
1913
1913
  });
1914
1914
  }
@@ -1919,7 +1919,7 @@ class ct {
1919
1919
  * @public
1920
1920
  */
1921
1921
  getContentTypeFromUrl(t) {
1922
- return N(this, null, function* () {
1922
+ return x(this, null, function* () {
1923
1923
  if (t.startsWith("data:")) {
1924
1924
  const e = t.match(/^data:([^;]+)/);
1925
1925
  return e ? e[1] : "application/octet-stream";
@@ -1998,9 +1998,9 @@ class ct {
1998
1998
  return e ? e[1] : "";
1999
1999
  }
2000
2000
  }
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";
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";
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: 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", {
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", {
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: 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", {
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", {
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 h = c;
2160
- d.push(...h.getObjects()), t.discardActiveObject();
2159
+ const l = c;
2160
+ d.push(...l.getObjects()), t.discardActiveObject();
2161
2161
  }
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());
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());
2167
2167
  }), d.length > 0)
2168
2168
  if (d.length === 1)
2169
2169
  t.setActiveObject(d[0]);
2170
2170
  else {
2171
- const h = new k(d, {
2171
+ const l = new k(d, {
2172
2172
  canvas: t
2173
2173
  });
2174
- t.setActiveObject(h);
2174
+ t.setActiveObject(l);
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: h } = c;
2339
- let u = Math.min(d, Mt), g = Math.min(h, wt);
2338
+ const { width: d, height: l } = c;
2339
+ let u = Math.min(d, Mt), g = Math.min(l, wt);
2340
2340
  if (e) {
2341
2341
  const {
2342
2342
  width: f,
2343
2343
  height: p
2344
- } = n, m = d / f, v = h / p, b = Math.max(m, v);
2344
+ } = n, m = d / f, v = l / 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 || 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", {
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", {
2348
2348
  object: c,
2349
2349
  width: u,
2350
2350
  height: g,
@@ -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), 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;
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;
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: h, height: u } = n, { width: g, height: f } = c, p = i.calculateScaleFactor({
2550
+ const { width: l, 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 > h || f > u) ? this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 }) : c.set({ scaleX: 1, scaleY: 1 });
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 });
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,
@@ -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, 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));
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));
2588
2588
  return {
2589
2589
  x: p,
2590
2590
  y: m
@@ -2619,10 +2619,10 @@ 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, 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;
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;
2623
2623
  if (!(p || m || v || b)) return 0;
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
- return Math.max(S, C);
2624
+ const y = Math.max(0, a - l), M = Math.max(0, u - r), A = Math.max(0, c - g), j = Math.max(0, f - d), S = Math.max(y, M), C = Math.max(A, j), w = S / n, T = C / i;
2625
+ return Math.max(w, T);
2626
2626
  }
2627
2627
  /**
2628
2628
  * Вычисляет плавный шаг перемещения viewport к центру с ускорением
@@ -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(), h = 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(), l = 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: 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 };
2640
+ return { x: l, y: u };
2641
+ const m = c / 2, v = d / 2, b = a.left, I = a.top, y = m - b * s, M = v - I * s, A = (y - r[4]) / (e - s), j = (M - r[5]) / (e - s), S = A * g, C = j * g, w = S * n, T = C * n, E = Math.abs(w) > Math.abs(l) ? l : w, U = Math.abs(T) > Math.abs(u) ? u : T;
2642
+ return { x: E, y: U };
2643
2643
  }
2644
2644
  /**
2645
2645
  * Применяет плавное центрирование viewport при приближении к defaultZoom.
@@ -2712,10 +2712,10 @@ class Js {
2712
2712
  });
2713
2713
  return;
2714
2714
  }
2715
- const h = this._getClampedPointerCoordinates(e);
2715
+ const l = this._getClampedPointerCoordinates(e);
2716
2716
  this.zoom(t, {
2717
- pointX: h.x,
2718
- pointY: h.y
2717
+ pointX: l.x,
2718
+ pointY: l.y
2719
2719
  });
2720
2720
  }
2721
2721
  /**
@@ -2729,13 +2729,13 @@ class Js {
2729
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, h = 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, l = 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(h, 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(l, 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: h
2738
+ point: l
2739
2739
  });
2740
2740
  }
2741
2741
  /**
@@ -2968,7 +2968,7 @@ class Ot {
2968
2968
  * @param options.withoutSave - Если true, не сохранять состояние в историю
2969
2969
  */
2970
2970
  setImageBackground(o) {
2971
- return N(this, arguments, function* ({
2971
+ return x(this, arguments, function* ({
2972
2972
  imageSource: t,
2973
2973
  customData: e = {},
2974
2974
  withoutSave: s = !1
@@ -3061,7 +3061,7 @@ class Ot {
3061
3061
  * @param source - источник изображения (URL или File)
3062
3062
  */
3063
3063
  _createImageBackground(t, e) {
3064
- return N(this, null, function* () {
3064
+ return x(this, null, function* () {
3065
3065
  var o;
3066
3066
  const { image: s } = (o = yield this.editor.imageManager.importImage({
3067
3067
  source: t,
@@ -3125,7 +3125,7 @@ class Ot {
3125
3125
  centerX: r = 50,
3126
3126
  centerY: c = 50,
3127
3127
  radius: d = 50
3128
- } = t, h = {
3128
+ } = t, l = {
3129
3129
  x1: r / 100,
3130
3130
  y1: c / 100,
3131
3131
  x2: r / 100,
@@ -3136,7 +3136,7 @@ class Ot {
3136
3136
  return new ze({
3137
3137
  type: "radial",
3138
3138
  gradientUnits: "percentage",
3139
- coords: h,
3139
+ coords: l,
3140
3140
  colorStops: a
3141
3141
  });
3142
3142
  }
@@ -3321,14 +3321,14 @@ class to {
3321
3321
  * @param flags.withoutAdding - Не добавлять объект в canvas
3322
3322
  */
3323
3323
  addRectangle(d = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3324
- var h = d, {
3324
+ var l = d, {
3325
3325
  id: t = `rect-${G()}`,
3326
3326
  left: e,
3327
3327
  top: s,
3328
3328
  width: o = 100,
3329
3329
  height: n = 100,
3330
3330
  fill: i = "blue"
3331
- } = h, a = vt(h, [
3331
+ } = l, a = vt(l, [
3332
3332
  "id",
3333
3333
  "left",
3334
3334
  "top",
@@ -3336,7 +3336,7 @@ class to {
3336
3336
  "height",
3337
3337
  "fill"
3338
3338
  ]);
3339
- const { canvas: u } = this.editor, g = new gs(_({
3339
+ const { canvas: u } = this.editor, g = new gs(N({
3340
3340
  id: t,
3341
3341
  left: e,
3342
3342
  top: s,
@@ -3376,14 +3376,14 @@ class to {
3376
3376
  "radius",
3377
3377
  "fill"
3378
3378
  ]);
3379
- const { canvas: h } = this.editor, u = new fs(_({
3379
+ const { canvas: l } = this.editor, u = new fs(N({
3380
3380
  id: t,
3381
3381
  left: e,
3382
3382
  top: s,
3383
3383
  fill: n,
3384
3384
  radius: o
3385
3385
  }, i));
3386
- return !e && !s && h.centerObject(u), r || (h.add(u), a || h.setActiveObject(u), h.renderAll()), u;
3386
+ return !e && !s && l.centerObject(u), r || (l.add(u), a || l.setActiveObject(u), l.renderAll()), u;
3387
3387
  }
3388
3388
  /**
3389
3389
  * Добавление треугольника
@@ -3403,14 +3403,14 @@ class to {
3403
3403
  * @param flags.withoutAdding - Не добавлять объект в canvas
3404
3404
  */
3405
3405
  addTriangle(d = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3406
- var h = d, {
3406
+ var l = d, {
3407
3407
  id: t = `triangle-${G()}`,
3408
3408
  left: e,
3409
3409
  top: s,
3410
3410
  width: o = 100,
3411
3411
  height: n = 100,
3412
3412
  fill: i = "yellow"
3413
- } = h, a = vt(h, [
3413
+ } = l, a = vt(l, [
3414
3414
  "id",
3415
3415
  "left",
3416
3416
  "top",
@@ -3418,7 +3418,7 @@ class to {
3418
3418
  "height",
3419
3419
  "fill"
3420
3420
  ]);
3421
- const { canvas: u } = this.editor, g = new ps(_({
3421
+ const { canvas: u } = this.editor, g = new ps(N({
3422
3422
  id: t,
3423
3423
  left: e,
3424
3424
  top: s,
@@ -3457,7 +3457,7 @@ class eo {
3457
3457
  * Асинхронное клонирование для внутреннего буфера
3458
3458
  */
3459
3459
  _cloneToInternalClipboard(t) {
3460
- return N(this, null, function* () {
3460
+ return x(this, null, function* () {
3461
3461
  const { canvas: e, errorManager: s } = this.editor;
3462
3462
  try {
3463
3463
  const o = yield t.clone(Xt);
@@ -3477,7 +3477,7 @@ class eo {
3477
3477
  * Копирование в системный буфер обмена
3478
3478
  */
3479
3479
  _copyToSystemClipboard(t) {
3480
- return N(this, null, function* () {
3480
+ return x(this, null, function* () {
3481
3481
  const { errorManager: e } = this.editor;
3482
3482
  if (typeof ClipboardItem == "undefined" || !navigator.clipboard)
3483
3483
  return e.emitWarning({
@@ -3504,11 +3504,11 @@ class eo {
3504
3504
  * Копирование изображения в буфер обмена
3505
3505
  */
3506
3506
  _copyImageToClipboard(t, e) {
3507
- return N(this, null, function* () {
3507
+ return x(this, null, function* () {
3508
3508
  try {
3509
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);
3510
- for (let h = 0; h < a.length; h += 1)
3511
- r[h] = a.charCodeAt(h);
3510
+ for (let l = 0; l < a.length; l += 1)
3511
+ r[l] = a.charCodeAt(l);
3512
3512
  const c = new Blob([r.buffer], { type: n }), d = new ClipboardItem({ [n]: c });
3513
3513
  return yield navigator.clipboard.write([d]), console.info("Image copied to clipboard successfully"), !0;
3514
3514
  } catch (s) {
@@ -3526,7 +3526,7 @@ class eo {
3526
3526
  * Копирование текста в буфер обмена
3527
3527
  */
3528
3528
  _copyTextToClipboard(t) {
3529
- return N(this, null, function* () {
3529
+ return x(this, null, function* () {
3530
3530
  try {
3531
3531
  const e = `${Ze}${t}`;
3532
3532
  return yield navigator.clipboard.writeText(e), console.info("Text copied to clipboard successfully"), !0;
@@ -3561,7 +3561,7 @@ class eo {
3561
3561
  * @param source - источник изображения (data URL или URL)
3562
3562
  */
3563
3563
  _handleImageImport(t) {
3564
- return N(this, null, function* () {
3564
+ return x(this, null, function* () {
3565
3565
  var s;
3566
3566
  const { image: e } = (s = yield this.editor.imageManager.importImage({
3567
3567
  source: t,
@@ -3577,7 +3577,7 @@ class eo {
3577
3577
  * @fires editor:object-pasted
3578
3578
  */
3579
3579
  copyPaste(t) {
3580
- return N(this, null, function* () {
3580
+ return x(this, null, function* () {
3581
3581
  const { canvas: e } = this.editor, s = t || e.getActiveObject();
3582
3582
  if (!s || s.locked) return !1;
3583
3583
  try {
@@ -3612,7 +3612,7 @@ class eo {
3612
3612
  * @param event.clipboardData.items — элементы буфера обмена
3613
3613
  */
3614
3614
  handlePasteEvent(e) {
3615
- return N(this, arguments, function* ({ clipboardData: t }) {
3615
+ return x(this, arguments, function* ({ clipboardData: t }) {
3616
3616
  var r;
3617
3617
  if (!((r = t == null ? void 0 : t.items) != null && r.length)) {
3618
3618
  this.paste();
@@ -3627,13 +3627,13 @@ class eo {
3627
3627
  if (n.type !== "text/html" && i) {
3628
3628
  const c = new FileReader();
3629
3629
  c.onload = (d) => {
3630
- d.target && this._handleImageImport(d.target.result).catch((h) => {
3630
+ d.target && this._handleImageImport(d.target.result).catch((l) => {
3631
3631
  this.editor.errorManager.emitError({
3632
3632
  origin: "ClipboardManager",
3633
3633
  method: "handlePasteEvent",
3634
3634
  code: "PASTE_IMAGE_FAILED",
3635
3635
  message: "Ошибка вставки изображения из буфера обмена",
3636
- data: h
3636
+ data: l
3637
3637
  });
3638
3638
  });
3639
3639
  }, c.readAsDataURL(i);
@@ -3641,9 +3641,9 @@ class eo {
3641
3641
  }
3642
3642
  const a = t.getData("text/html");
3643
3643
  if (a) {
3644
- const h = new DOMParser().parseFromString(a, "text/html").querySelector("img");
3645
- if (h != null && h.src) {
3646
- this._handleImageImport(h.src).catch((u) => {
3644
+ const l = new DOMParser().parseFromString(a, "text/html").querySelector("img");
3645
+ if (l != null && l.src) {
3646
+ this._handleImageImport(l.src).catch((u) => {
3647
3647
  this.editor.errorManager.emitError({
3648
3648
  origin: "ClipboardManager",
3649
3649
  method: "handlePasteEvent",
@@ -3663,7 +3663,7 @@ class eo {
3663
3663
  * @fires editor:object-pasted
3664
3664
  */
3665
3665
  paste() {
3666
- return N(this, null, function* () {
3666
+ return x(this, null, function* () {
3667
3667
  const { canvas: t } = this.editor;
3668
3668
  if (!this.clipboard) return !1;
3669
3669
  try {
@@ -3840,8 +3840,8 @@ class so {
3840
3840
  const i = [];
3841
3841
  n.forEach((c) => {
3842
3842
  const d = c.removeAll();
3843
- s.remove(c), d.forEach((h) => {
3844
- s.add(h), i.push(h);
3843
+ s.remove(c), d.forEach((l) => {
3844
+ s.add(l), i.push(l);
3845
3845
  });
3846
3846
  });
3847
3847
  const a = new k(i, {
@@ -3922,8 +3922,8 @@ class we {
3922
3922
  const r = [];
3923
3923
  if (a.forEach((d) => {
3924
3924
  if (we._isUngroupableGroup(d)) {
3925
- const h = this._handleGroupDeletion(d);
3926
- r.push(...h);
3925
+ const l = this._handleGroupDeletion(d);
3926
+ r.push(...l);
3927
3927
  return;
3928
3928
  }
3929
3929
  o.remove(d), r.push(d);
@@ -4082,7 +4082,7 @@ class Yt {
4082
4082
  message: i,
4083
4083
  data: o
4084
4084
  };
4085
- this._buffer.push(_({
4085
+ this._buffer.push(N({
4086
4086
  type: "editor:error"
4087
4087
  }, a)), this.editor.canvas.fire("editor:error", a);
4088
4088
  }
@@ -4110,7 +4110,7 @@ class Yt {
4110
4110
  message: i,
4111
4111
  data: n
4112
4112
  };
4113
- this._buffer.push(_({
4113
+ this._buffer.push(N({
4114
4114
  type: "editor:warning"
4115
4115
  }, a)), this.editor.canvas.fire("editor:warning", a);
4116
4116
  }
@@ -4173,12 +4173,12 @@ class no {
4173
4173
  constrainPan(t, e) {
4174
4174
  if (!this.currentBounds || !this.currentBounds.canPan)
4175
4175
  return { x: 0, y: 0 };
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(
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, l = a * n + e - c, u = Math.max(
4177
4177
  this.currentBounds.minX,
4178
4178
  Math.min(this.currentBounds.maxX, d)
4179
4179
  ), g = Math.max(
4180
4180
  this.currentBounds.minY,
4181
- Math.min(this.currentBounds.maxY, h)
4181
+ Math.min(this.currentBounds.maxY, l)
4182
4182
  ), f = u + r - i * n, p = g + c - a * n;
4183
4183
  return {
4184
4184
  x: f,
@@ -4209,13 +4209,13 @@ class no {
4209
4209
  }
4210
4210
  }
4211
4211
  const at = ({
4212
- value: l,
4212
+ value: h,
4213
4213
  min: t,
4214
4214
  max: e
4215
- }) => Math.min(Math.max(l, t), e), Dt = class Dt extends nt {
4215
+ }) => Math.min(Math.max(h, t), e), Dt = class Dt extends nt {
4216
4216
  constructor(t, e = {}) {
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();
4217
+ var s, o, n, i, a, r, c, d, l;
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 = (l = e.radiusBottomLeft) != null ? l : 0, this._roundDimensions();
4219
4219
  }
4220
4220
  /**
4221
4221
  * Пересчитывает размеры текста и округляет их до целых значений.
@@ -4237,7 +4237,7 @@ const at = ({
4237
4237
  }
4238
4238
  _getTransformedDimensions(t = {}) {
4239
4239
  const { width: e, height: s } = this._getBackgroundDimensions();
4240
- return super._getTransformedDimensions(yt(_({}, t), {
4240
+ return super._getTransformedDimensions(yt(N({}, t), {
4241
4241
  width: e,
4242
4242
  height: s
4243
4243
  }));
@@ -4247,7 +4247,7 @@ const at = ({
4247
4247
  */
4248
4248
  toObject(t = []) {
4249
4249
  const e = super.toObject(t);
4250
- return yt(_({}, e), {
4250
+ return yt(N({}, e), {
4251
4251
  backgroundOpacity: this.backgroundOpacity,
4252
4252
  paddingTop: this.paddingTop,
4253
4253
  paddingRight: this.paddingRight,
@@ -4263,11 +4263,11 @@ const at = ({
4263
4263
  var s, o;
4264
4264
  const e = this._getEffectiveBackgroundFill();
4265
4265
  if (e && e) {
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;
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 }), l = this._getLeftOffset() - n.left, u = this._getTopOffset() - n.top;
4267
4267
  t.save(), Dt._renderRoundedRect({
4268
4268
  ctx: t,
4269
4269
  height: c,
4270
- left: h,
4270
+ left: l,
4271
4271
  radii: d,
4272
4272
  top: u,
4273
4273
  width: r
@@ -4331,9 +4331,9 @@ const at = ({
4331
4331
  const a = s + i, r = n + e, {
4332
4332
  topLeft: c,
4333
4333
  topRight: d,
4334
- bottomRight: h,
4334
+ bottomRight: l,
4335
4335
  bottomLeft: u
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 });
4336
+ } = 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 });
4337
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();
4338
4338
  }
4339
4339
  /**
@@ -4374,77 +4374,67 @@ Dt.type = "background-textbox", Dt.cacheProperties = [
4374
4374
  ];
4375
4375
  let ee = Dt;
4376
4376
  const io = () => {
4377
- var l;
4378
- (l = Pe) != null && l.setClass && Pe.setClass(ee, "background-textbox");
4379
- }, ao = ({ textbox: l }) => {
4377
+ var h;
4378
+ (h = Pe) != null && h.setClass && Pe.setClass(ee, "background-textbox");
4379
+ }, ao = ({ textbox: h }) => {
4380
4380
  var s, o;
4381
- if (!l.isEditing) return null;
4382
- const t = (s = l.selectionStart) != null ? s : 0, e = (o = l.selectionEnd) != null ? o : t;
4381
+ if (!h.isEditing) return null;
4382
+ const t = (s = h.selectionStart) != null ? s : 0, e = (o = h.selectionEnd) != null ? o : t;
4383
4383
  return t === e ? null : {
4384
4384
  start: Math.min(t, e),
4385
4385
  end: Math.max(t, e)
4386
4386
  };
4387
- }, ro = ({ textbox: l }) => {
4387
+ }, ro = ({ textbox: h }) => {
4388
4388
  var e, s;
4389
- const t = (s = (e = l.text) == null ? void 0 : e.length) != null ? s : 0;
4389
+ const t = (s = (e = h.text) == null ? void 0 : e.length) != null ? s : 0;
4390
4390
  return t <= 0 ? null : { start: 0, end: t };
4391
- }, co = ({ textbox: l, range: t }) => {
4391
+ }, co = ({ textbox: h, range: t }) => {
4392
4392
  var s, o;
4393
4393
  if (!t) return !1;
4394
- const e = (o = (s = l.text) == null ? void 0 : s.length) != null ? o : 0;
4394
+ const e = (o = (s = h.text) == null ? void 0 : s.length) != null ? o : 0;
4395
4395
  return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
4396
4396
  }, ne = ({
4397
- textbox: l,
4397
+ textbox: h,
4398
4398
  styles: t,
4399
4399
  range: e
4400
4400
  }) => {
4401
4401
  if (!t || !Object.keys(t).length) return !1;
4402
4402
  const { start: s, end: o } = e;
4403
- return o <= s ? !1 : (l.setSelectionStyles(t, s, o), !0);
4403
+ return o <= s ? !1 : (h.setSelectionStyles(t, s, o), !0);
4404
4404
  }, Ve = ({
4405
- textbox: l,
4405
+ textbox: h,
4406
4406
  range: t,
4407
4407
  property: e
4408
4408
  }) => {
4409
4409
  var o;
4410
4410
  if (!t) return;
4411
- const s = l.getSelectionStyles(
4411
+ const s = h.getSelectionStyles(
4412
4412
  t.start,
4413
4413
  t.end,
4414
4414
  !0
4415
4415
  );
4416
4416
  if (s.length)
4417
4417
  return (o = s[0]) == null ? void 0 : o[e];
4418
- }, Xe = ({ strokeColor: l, width: t }) => {
4418
+ }, Xe = ({ strokeColor: h, width: t }) => {
4419
4419
  if (!(t <= 0))
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;
4422
- class Z {
4420
+ return h != null ? h : "#000000";
4421
+ }, Ke = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, ie = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", st = 0.01;
4422
+ class P {
4423
4423
  constructor({ editor: t }) {
4424
4424
  var e;
4425
4425
  this._handleTextEditingEntered = () => {
4426
4426
  this.isTextEditingActive = !0;
4427
- }, this._handleTextChanged = (s) => {
4428
- const { target: o } = s;
4429
- if (!Z._isTextbox(o)) return;
4430
- const { text: n = "", uppercase: i } = o, a = !!i, r = n.toLocaleLowerCase();
4431
- if (a) {
4432
- const d = ie({ value: r });
4433
- d !== n && o.set({ text: d }), o.textCaseRaw = r;
4434
- } else
4435
- o.textCaseRaw = n;
4436
- Z._roundTextboxDimensions({ textbox: o }) && (o.setCoords(), o.dirty = !0);
4437
4427
  }, this._handleTextEditingExited = (s) => {
4438
4428
  var r, c;
4439
4429
  const { target: o } = s;
4440
- if (!Z._isTextbox(o)) return;
4430
+ if (!P._isTextbox(o)) return;
4441
4431
  const n = (r = o.text) != null ? r : "";
4442
4432
  if (!!o.uppercase) {
4443
4433
  const d = (c = o.textCaseRaw) != null ? c : n.toLocaleLowerCase();
4444
4434
  o.textCaseRaw = d;
4445
4435
  } else
4446
4436
  o.textCaseRaw = n;
4447
- Z._roundTextboxDimensions({ textbox: o }) && (o.setCoords(), o.dirty = !0, this.canvas.requestRenderAll()), o.locked || o.set({
4437
+ P._roundTextboxDimensions({ textbox: o }) && (o.setCoords(), o.dirty = !0, this.canvas.requestRenderAll()), o.locked || o.set({
4448
4438
  lockMovementX: !1,
4449
4439
  lockMovementY: !1
4450
4440
  }), setTimeout(() => {
@@ -4453,40 +4443,40 @@ class Z {
4453
4443
  }, this._handleObjectScaling = (s) => {
4454
4444
  var X, It, Wt, mt, Ht, Ct, Ae, je, Ie, Ce, Te, Ee, Oe;
4455
4445
  const { target: o, transform: n } = s;
4456
- if (o instanceof k || !Z._isTextbox(o) || !n) return;
4446
+ if (o instanceof k || !P._isTextbox(o) || !n) return;
4457
4447
  o.isScaling = !0;
4458
4448
  const i = this._ensureScalingState(o), {
4459
4449
  baseWidth: a,
4460
4450
  baseLeft: r,
4461
4451
  baseFontSize: c,
4462
4452
  basePadding: d,
4463
- baseRadii: h,
4453
+ baseRadii: l,
4464
4454
  baseStyles: u
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;
4466
- if (!I && !y && !w) return;
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,
4469
- paddingRight: F = 0,
4470
- paddingBottom: U = 0,
4471
- paddingLeft: W = 0,
4455
+ } = 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", M = ["tl", "tr", "bl", "br"].includes(v) || b === "scale", A = M || y;
4456
+ if (!I && !y && !M) return;
4457
+ const j = Math.abs((Ct = (Ht = o.scaleX) != null ? Ht : n.scaleX) != null ? Ct : 1) || 1, S = Math.abs((je = (Ae = o.scaleY) != null ? Ae : n.scaleY) != null ? je : 1) || 1, C = Math.max(1, p * j), w = Math.max(1, Math.round(C)), T = Math.max(1, c * S), {
4458
+ paddingTop: E = 0,
4459
+ paddingRight: U = 0,
4460
+ paddingBottom: z = 0,
4461
+ paddingLeft: Y = 0,
4472
4462
  radiusTopLeft: V = 0,
4473
- radiusTopRight: L = 0,
4474
- radiusBottomRight: D = 0,
4475
- radiusBottomLeft: z = 0,
4476
- fontSize: H,
4477
- width: P,
4463
+ radiusTopRight: D = 0,
4464
+ radiusBottomRight: _ = 0,
4465
+ radiusBottomLeft: F = 0,
4466
+ fontSize: Z,
4467
+ width: W,
4478
4468
  originX: K = "left"
4479
- } = o, $ = w || y, q = w || y, Y = $ ? {
4480
- top: Math.max(0, d.top * M),
4481
- right: Math.max(0, d.right * M),
4482
- bottom: Math.max(0, d.bottom * M),
4483
- left: Math.max(0, d.left * M)
4469
+ } = o, $ = M || y, q = M || y, H = $ ? {
4470
+ top: Math.max(0, d.top * S),
4471
+ right: Math.max(0, d.right * S),
4472
+ bottom: Math.max(0, d.bottom * S),
4473
+ left: Math.max(0, d.left * S)
4484
4474
  } : d, Q = q ? {
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;
4475
+ topLeft: Math.max(0, l.topLeft * S),
4476
+ topRight: Math.max(0, l.topRight * S),
4477
+ bottomRight: Math.max(0, l.bottomRight * S),
4478
+ bottomLeft: Math.max(0, l.bottomLeft * S)
4479
+ } : l, St = Object.keys(u).length > 0;
4490
4480
  let et;
4491
4481
  if (A && St) {
4492
4482
  const se = {};
@@ -4495,23 +4485,23 @@ class Z {
4495
4485
  const oe = {};
4496
4486
  Object.entries(Le).forEach(([cs, Zt]) => {
4497
4487
  if (!Zt) return;
4498
- const De = _({}, Zt);
4499
- typeof Zt.fontSize == "number" && (De.fontSize = Math.max(1, Zt.fontSize * M)), oe[cs] = De;
4488
+ const De = N({}, Zt);
4489
+ typeof Zt.fontSize == "number" && (De.fontSize = Math.max(1, Zt.fontSize * S)), oe[cs] = De;
4500
4490
  }), Object.keys(oe).length && (se[rs] = oe);
4501
4491
  }), Object.keys(se).length && (et = se);
4502
4492
  }
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;
4493
+ const lt = (Ce = (Ie = n.originX) != null ? Ie : K) != null ? Ce : "left", pt = m + p, At = m + p / 2, ht = W != null ? W : p, jt = w !== ht, Ft = Math.abs(T - (Z != null ? Z : c)) > st, Nt = Math.abs(H.top - E) > st || Math.abs(H.right - U) > st || Math.abs(H.bottom - z) > st || Math.abs(H.left - Y) > st, xt = Math.abs(Q.topLeft - V) > st || Math.abs(Q.topRight - D) > st || Math.abs(Q.bottomRight - _) > st || Math.abs(Q.bottomLeft - F) > st;
4504
4494
  if (!jt && !Ft && !Nt && !xt) {
4505
4495
  o.set({ scaleX: 1, scaleY: 1 }), n.scaleX = 1, n.scaleY = 1;
4506
4496
  return;
4507
4497
  }
4508
4498
  et && (o.styles = et), o.set({
4509
- width: S,
4510
- fontSize: A ? C : c,
4511
- paddingTop: Y.top,
4512
- paddingRight: Y.right,
4513
- paddingBottom: Y.bottom,
4514
- paddingLeft: Y.left,
4499
+ width: w,
4500
+ fontSize: A ? T : c,
4501
+ paddingTop: H.top,
4502
+ paddingRight: H.right,
4503
+ paddingBottom: H.bottom,
4504
+ paddingLeft: H.left,
4515
4505
  radiusTopLeft: Q.topLeft,
4516
4506
  radiusTopRight: Q.topRight,
4517
4507
  radiusBottomRight: Q.bottomRight,
@@ -4519,17 +4509,17 @@ class Z {
4519
4509
  scaleX: 1,
4520
4510
  scaleY: 1
4521
4511
  });
4522
- const Bt = Z._roundTextboxDimensions({ textbox: o });
4512
+ const Bt = P._roundTextboxDimensions({ textbox: o });
4523
4513
  Bt && (o.dirty = !0);
4524
- const ut = (Te = o.width) != null ? Te : S, kt = ut !== ht;
4514
+ const ut = (Te = o.width) != null ? Te : w, kt = ut !== ht;
4525
4515
  let gt = m;
4526
- kt && (I || w) && (lt === "right" ? gt = pt - ut : lt === "center" && (gt = At - ut / 2)), o.set({ left: gt }), i.baseLeft = gt, n.scaleX = 1, n.scaleY = 1;
4516
+ kt && (I || M) && (lt === "right" ? gt = pt - ut : lt === "center" && (gt = At - ut / 2)), o.set({ left: gt }), i.baseLeft = gt, n.scaleX = 1, n.scaleY = 1;
4527
4517
  const { original: it } = n;
4528
- it && (it.scaleX = 1, it.scaleY = 1, it.width = ut, it.height = o.height, it.left = gt), o.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = ut, i.baseFontSize = (Ee = o.fontSize) != null ? Ee : C, i.baseStyles = JSON.parse(JSON.stringify((Oe = o.styles) != null ? Oe : {})), i.basePadding = {
4529
- top: Y.top,
4530
- right: Y.right,
4531
- bottom: Y.bottom,
4532
- left: Y.left
4518
+ it && (it.scaleX = 1, it.scaleY = 1, it.width = ut, it.height = o.height, it.left = gt), o.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = ut, i.baseFontSize = (Ee = o.fontSize) != null ? Ee : T, i.baseStyles = JSON.parse(JSON.stringify((Oe = o.styles) != null ? Oe : {})), i.basePadding = {
4519
+ top: H.top,
4520
+ right: H.right,
4521
+ bottom: H.bottom,
4522
+ left: H.left
4533
4523
  }, i.baseRadii = {
4534
4524
  topLeft: Q.topLeft,
4535
4525
  topRight: Q.topRight,
@@ -4540,64 +4530,64 @@ class Z {
4540
4530
  var b, I, y;
4541
4531
  const { target: o } = s;
4542
4532
  if (o instanceof k) {
4543
- const w = o.getObjects();
4544
- if (!w.some((S) => Z._isTextbox(S))) return;
4545
- const { scaleX: j = 1, scaleY: M = 1 } = o;
4546
- if (Math.abs(j - 1) < st && Math.abs(M - 1) < st) return;
4547
- this.canvas.discardActiveObject(), w.forEach((S) => {
4548
- var C, x, F, U;
4549
- if (Z._isTextbox(S)) {
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,
4552
- paddingRight: P = 0,
4533
+ const M = o.getObjects();
4534
+ if (!M.some((w) => P._isTextbox(w))) return;
4535
+ const { scaleX: j = 1, scaleY: S = 1 } = o;
4536
+ if (Math.abs(j - 1) < st && Math.abs(S - 1) < st) return;
4537
+ this.canvas.discardActiveObject(), M.forEach((w) => {
4538
+ var T, E, U, z;
4539
+ if (P._isTextbox(w)) {
4540
+ const Y = (T = w.scaleX) != null ? T : 1, V = (E = w.scaleY) != null ? E : 1, D = ((U = w.fontSize) != null ? U : 16) * V, _ = ((z = w.width) != null ? z : 0) * Y, F = V, {
4541
+ paddingTop: Z = 0,
4542
+ paddingRight: W = 0,
4553
4543
  paddingBottom: K = 0,
4554
4544
  paddingLeft: $ = 0,
4555
4545
  radiusTopLeft: q = 0,
4556
- radiusTopRight: Y = 0,
4546
+ radiusTopRight: H = 0,
4557
4547
  radiusBottomRight: Q = 0,
4558
4548
  radiusBottomLeft: St = 0,
4559
4549
  styles: et
4560
- } = S, lt = {
4561
- paddingTop: Math.max(0, H * z),
4562
- paddingRight: Math.max(0, P * z),
4563
- paddingBottom: Math.max(0, K * z),
4564
- paddingLeft: Math.max(0, $ * z)
4550
+ } = w, lt = {
4551
+ paddingTop: Math.max(0, Z * F),
4552
+ paddingRight: Math.max(0, W * F),
4553
+ paddingBottom: Math.max(0, K * F),
4554
+ paddingLeft: Math.max(0, $ * F)
4565
4555
  }, pt = {
4566
- radiusTopLeft: Math.max(0, q * z),
4567
- radiusTopRight: Math.max(0, Y * z),
4568
- radiusBottomRight: Math.max(0, Q * z),
4569
- radiusBottomLeft: Math.max(0, St * z)
4556
+ radiusTopLeft: Math.max(0, q * F),
4557
+ radiusTopRight: Math.max(0, H * F),
4558
+ radiusBottomRight: Math.max(0, Q * F),
4559
+ radiusBottomLeft: Math.max(0, St * F)
4570
4560
  };
4571
4561
  let At = et;
4572
4562
  et && Object.keys(et).length > 0 && (At = JSON.parse(JSON.stringify(et)), Object.values(At).forEach((ht) => {
4573
4563
  Object.values(ht).forEach((jt) => {
4574
- typeof jt.fontSize == "number" && (jt.fontSize = Math.max(1, jt.fontSize * z));
4564
+ typeof jt.fontSize == "number" && (jt.fontSize = Math.max(1, jt.fontSize * F));
4575
4565
  });
4576
- })), S.set(yt(_(_({
4577
- fontSize: L,
4578
- width: D,
4566
+ })), w.set(yt(N(N({
4567
+ fontSize: D,
4568
+ width: _,
4579
4569
  scaleX: 1,
4580
4570
  scaleY: 1
4581
4571
  }, lt), pt), {
4582
4572
  styles: At
4583
- })), Z._roundTextboxDimensions({ textbox: S });
4573
+ })), P._roundTextboxDimensions({ textbox: w });
4584
4574
  }
4585
- S.setCoords();
4575
+ w.setCoords();
4586
4576
  });
4587
- const T = new k(w, {
4577
+ const C = new k(M, {
4588
4578
  canvas: this.canvas
4589
4579
  });
4590
- this.canvas.setActiveObject(T), this.canvas.requestRenderAll();
4580
+ this.canvas.setActiveObject(C), this.canvas.requestRenderAll();
4591
4581
  return;
4592
4582
  }
4593
- if (!Z._isTextbox(o)) return;
4583
+ if (!P._isTextbox(o)) return;
4594
4584
  o.isScaling = !1;
4595
4585
  const n = this.scalingState.get(o);
4596
4586
  if (this.scalingState.delete(o), !(n != null && n.hasWidthChange)) return;
4597
4587
  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), {
4598
4588
  paddingTop: c = 0,
4599
4589
  paddingRight: d = 0,
4600
- paddingBottom: h = 0,
4590
+ paddingBottom: l = 0,
4601
4591
  paddingLeft: u = 0,
4602
4592
  radiusTopLeft: g = 0,
4603
4593
  radiusTopRight: f = 0,
@@ -4607,7 +4597,7 @@ class Z {
4607
4597
  width: i,
4608
4598
  paddingTop: c,
4609
4599
  paddingRight: d,
4610
- paddingBottom: h,
4600
+ paddingBottom: l,
4611
4601
  paddingLeft: u,
4612
4602
  radiusTopLeft: g,
4613
4603
  radiusTopRight: f,
@@ -4625,8 +4615,8 @@ class Z {
4625
4615
  * @param options — настройки текста
4626
4616
  * @param flags — флаги поведения
4627
4617
  */
4628
- addText(F = {}, { withoutSelection: S = !1, withoutSave: C = !1, withoutAdding: x = !1 } = {}) {
4629
- var U = F, {
4618
+ addText(U = {}, { withoutSelection: w = !1, withoutSave: T = !1, withoutAdding: E = !1 } = {}) {
4619
+ var z = U, {
4630
4620
  id: t = `text-${G()}`,
4631
4621
  text: e = "Новый текст",
4632
4622
  fontFamily: s,
@@ -4637,7 +4627,7 @@ class Z {
4637
4627
  uppercase: r = !1,
4638
4628
  strikethrough: c = !1,
4639
4629
  align: d = "left",
4640
- color: h = "#000000",
4630
+ color: l = "#000000",
4641
4631
  strokeColor: u,
4642
4632
  strokeWidth: g = 0,
4643
4633
  opacity: f = 1,
@@ -4647,11 +4637,11 @@ class Z {
4647
4637
  paddingRight: b = 0,
4648
4638
  paddingBottom: I = 0,
4649
4639
  paddingLeft: y = 0,
4650
- radiusTopLeft: w = 0,
4640
+ radiusTopLeft: M = 0,
4651
4641
  radiusTopRight: A = 0,
4652
4642
  radiusBottomRight: j = 0,
4653
- radiusBottomLeft: M = 0
4654
- } = U, T = vt(U, [
4643
+ radiusBottomLeft: S = 0
4644
+ } = z, C = vt(z, [
4655
4645
  "id",
4656
4646
  "text",
4657
4647
  "fontFamily",
@@ -4678,14 +4668,14 @@ class Z {
4678
4668
  "radiusBottomLeft"
4679
4669
  ]);
4680
4670
  var $;
4681
- const { historyManager: W } = this.editor, { canvas: V } = this;
4682
- W.suspendHistory();
4683
- const L = s != null ? s : this._getDefaultFontFamily(), D = Ke({ width: g }), z = Xe({
4671
+ const { historyManager: Y } = this.editor, { canvas: V } = this;
4672
+ Y.suspendHistory();
4673
+ const D = s != null ? s : this._getDefaultFontFamily(), _ = Ke({ width: g }), F = Xe({
4684
4674
  strokeColor: u,
4685
- width: D
4686
- }), H = _({
4675
+ width: _
4676
+ }), Z = N({
4687
4677
  id: t,
4688
- fontFamily: L,
4678
+ fontFamily: D,
4689
4679
  fontSize: o,
4690
4680
  fontWeight: n ? "bold" : "normal",
4691
4681
  fontStyle: i ? "italic" : "normal",
@@ -4693,9 +4683,9 @@ class Z {
4693
4683
  uppercase: r,
4694
4684
  linethrough: c,
4695
4685
  textAlign: d,
4696
- fill: h,
4697
- stroke: z,
4698
- strokeWidth: D,
4686
+ fill: l,
4687
+ stroke: F,
4688
+ strokeWidth: _,
4699
4689
  strokeUniform: !0,
4700
4690
  opacity: f,
4701
4691
  backgroundColor: p,
@@ -4704,33 +4694,33 @@ class Z {
4704
4694
  paddingRight: b,
4705
4695
  paddingBottom: I,
4706
4696
  paddingLeft: y,
4707
- radiusTopLeft: w,
4697
+ radiusTopLeft: M,
4708
4698
  radiusTopRight: A,
4709
4699
  radiusBottomRight: j,
4710
- radiusBottomLeft: M
4711
- }, T), P = new ee(e, H);
4712
- if (P.textCaseRaw = ($ = P.text) != null ? $ : "", r) {
4713
- const q = ie({ value: P.textCaseRaw });
4714
- q !== P.text && P.set({ text: q });
4715
- }
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", {
4717
- textbox: P,
4718
- options: yt(_({}, H), {
4700
+ radiusBottomLeft: S
4701
+ }, C), W = new ee(e, Z);
4702
+ if (W.textCaseRaw = ($ = W.text) != null ? $ : "", r) {
4703
+ const q = ie({ value: W.textCaseRaw });
4704
+ q !== W.text && W.set({ text: q });
4705
+ }
4706
+ return P._roundTextboxDimensions({ textbox: W }) && (W.dirty = !0), C.left === void 0 && C.top === void 0 && V.centerObject(W), E || V.add(W), w || V.setActiveObject(W), V.requestRenderAll(), Y.resumeHistory(), T || Y.saveState(), V.fire("editor:text-added", {
4707
+ textbox: W,
4708
+ options: yt(N({}, Z), {
4719
4709
  text: e,
4720
4710
  bold: n,
4721
4711
  italic: i,
4722
4712
  strikethrough: c,
4723
4713
  align: d,
4724
- color: h,
4725
- strokeColor: z,
4726
- strokeWidth: D
4714
+ color: l,
4715
+ strokeColor: F,
4716
+ strokeWidth: _
4727
4717
  }),
4728
4718
  flags: {
4729
- withoutSelection: !!S,
4730
- withoutSave: !!C,
4731
- withoutAdding: !!x
4719
+ withoutSelection: !!w,
4720
+ withoutSave: !!T,
4721
+ withoutAdding: !!E
4732
4722
  }
4733
- }), P;
4723
+ }), W;
4734
4724
  }
4735
4725
  /**
4736
4726
  * Обновляет текстовый объект.
@@ -4746,10 +4736,10 @@ class Z {
4746
4736
  if (!n) return null;
4747
4737
  const { historyManager: i } = this.editor, { canvas: a } = this;
4748
4738
  i.suspendHistory();
4749
- const r = Z._getSnapshot(n), Nt = e, {
4739
+ const r = P._getSnapshot(n), Nt = e, {
4750
4740
  text: c,
4751
4741
  fontFamily: d,
4752
- fontSize: h,
4742
+ fontSize: l,
4753
4743
  bold: u,
4754
4744
  italic: g,
4755
4745
  underline: f,
@@ -4759,17 +4749,17 @@ class Z {
4759
4749
  color: b,
4760
4750
  strokeColor: I,
4761
4751
  strokeWidth: y,
4762
- opacity: w,
4752
+ opacity: M,
4763
4753
  backgroundColor: A,
4764
4754
  backgroundOpacity: j,
4765
- paddingTop: M,
4766
- paddingRight: T,
4767
- paddingBottom: S,
4768
- paddingLeft: C,
4769
- radiusTopLeft: x,
4770
- radiusTopRight: F,
4771
- radiusBottomRight: U,
4772
- radiusBottomLeft: W
4755
+ paddingTop: S,
4756
+ paddingRight: C,
4757
+ paddingBottom: w,
4758
+ paddingLeft: T,
4759
+ radiusTopLeft: E,
4760
+ radiusTopRight: U,
4761
+ radiusBottomRight: z,
4762
+ radiusBottomLeft: Y
4773
4763
  } = Nt, V = vt(Nt, [
4774
4764
  "text",
4775
4765
  "fontFamily",
@@ -4794,39 +4784,39 @@ class Z {
4794
4784
  "radiusTopRight",
4795
4785
  "radiusBottomRight",
4796
4786
  "radiusBottomLeft"
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
+ ]), D = N({}, V), _ = ao({ textbox: n }), F = _ ? P._expandRangeToFullLines({ textbox: n, range: _ }) : null, Z = {}, W = {}, K = {}, $ = co({ textbox: n, range: _ }), q = !_ || $, H = !_;
4788
+ if (d !== void 0 && (F && (W.fontFamily = d), q && (D.fontFamily = d, H && (K.fontFamily = d))), l !== void 0 && (F && (W.fontSize = l), q && (D.fontSize = l, H && (K.fontSize = l))), u !== void 0) {
4799
4789
  const X = u ? "bold" : "normal";
4800
- D && (H.fontWeight = X), q && (L.fontWeight = X, Y && (K.fontWeight = X));
4790
+ _ && (Z.fontWeight = X), q && (D.fontWeight = X, H && (K.fontWeight = X));
4801
4791
  }
4802
4792
  if (g !== void 0) {
4803
4793
  const X = g ? "italic" : "normal";
4804
- D && (H.fontStyle = X), q && (L.fontStyle = X, Y && (K.fontStyle = X));
4794
+ _ && (Z.fontStyle = X), q && (D.fontStyle = X, H && (K.fontStyle = X));
4805
4795
  }
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({
4796
+ if (f !== void 0 && (_ && (Z.underline = f), q && (D.underline = f, H && (K.underline = f))), m !== void 0 && (_ && (Z.linethrough = m), q && (D.linethrough = m, H && (K.linethrough = m))), v !== void 0 && (D.textAlign = v), b !== void 0 && (_ && (Z.fill = b), q && (D.fill = b, H && (K.fill = b))), I !== void 0 || y !== void 0) {
4797
+ const X = _ ? Ve({ textbox: n, range: _, property: "strokeWidth" }) : void 0, It = _ ? Ve({ textbox: n, range: _, 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
4798
  strokeColor: Ht,
4809
4799
  width: mt
4810
4800
  });
4811
- D && (H.stroke = Ct, H.strokeWidth = mt), q && (L.stroke = Ct, L.strokeWidth = mt, Y && (K.stroke = Ct, K.strokeWidth = mt));
4801
+ _ && (Z.stroke = Ct, Z.strokeWidth = mt), q && (D.stroke = Ct, D.strokeWidth = mt, H && (K.stroke = Ct, K.strokeWidth = mt));
4812
4802
  }
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);
4803
+ M !== void 0 && (D.opacity = M), A !== void 0 && (D.backgroundColor = A), j !== void 0 && (D.backgroundOpacity = j), S !== void 0 && (D.paddingTop = S), C !== void 0 && (D.paddingRight = C), w !== void 0 && (D.paddingBottom = w), T !== void 0 && (D.paddingLeft = T), E !== void 0 && (D.radiusTopLeft = E), U !== void 0 && (D.radiusTopRight = U), z !== void 0 && (D.radiusBottomRight = z), Y !== void 0 && (D.radiusBottomLeft = Y);
4814
4804
  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;
4815
4805
  if (et || pt !== St) {
4816
4806
  const X = pt ? ie({ value: lt }) : lt;
4817
- L.text = X, n.textCaseRaw = lt;
4807
+ D.text = X, n.textCaseRaw = lt;
4818
4808
  } else n.textCaseRaw === void 0 && (n.textCaseRaw = Q);
4819
- n.uppercase = pt, n.set(L);
4809
+ n.uppercase = pt, n.set(D);
4820
4810
  let ht = !1;
4821
- if (D) {
4822
- const X = ne({ textbox: n, styles: H, range: D }), It = z ? ne({ textbox: n, styles: P, range: z }) : !1;
4811
+ if (_) {
4812
+ const X = ne({ textbox: n, styles: Z, range: _ }), It = F ? ne({ textbox: n, styles: W, range: F }) : !1;
4823
4813
  ht = X || It;
4824
4814
  } else if (Object.keys(K).length) {
4825
4815
  const X = ro({ textbox: n });
4826
4816
  X && (ht = ne({ textbox: n, styles: K, range: X }));
4827
4817
  }
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();
4829
- const Ft = Z._getSnapshot(n);
4818
+ ht && (n.dirty = !0), (A !== void 0 || j !== void 0 || S !== void 0 || C !== void 0 || w !== void 0 || T !== void 0 || E !== void 0 || U !== void 0 || z !== void 0 || Y !== void 0) && (n.dirty = !0), P._roundTextboxDimensions({ textbox: n }) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4819
+ const Ft = P._getSnapshot(n);
4830
4820
  return a.fire("editor:text-updated", {
4831
4821
  textbox: n,
4832
4822
  target: t,
@@ -4835,11 +4825,11 @@ class Z {
4835
4825
  withoutSave: !!s,
4836
4826
  skipRender: !!o
4837
4827
  },
4838
- updates: L,
4828
+ updates: D,
4839
4829
  before: r,
4840
4830
  after: Ft,
4841
- selectionRange: D != null ? D : void 0,
4842
- selectionStyles: D && Object.keys(H).length ? H : void 0
4831
+ selectionRange: _ != null ? _ : void 0,
4832
+ selectionStyles: _ && Object.keys(Z).length ? Z : void 0
4843
4833
  }), n;
4844
4834
  }
4845
4835
  /**
@@ -4847,7 +4837,7 @@ class Z {
4847
4837
  */
4848
4838
  destroy() {
4849
4839
  const { canvas: t } = this;
4850
- t.off("object:scaling", this._handleObjectScaling), t.off("object:modified", this._handleObjectModified), t.off("text:editing:exited", this._handleTextEditingExited), t.off("text:editing:entered", this._handleTextEditingEntered), t.off("text:changed", this._handleTextChanged);
4840
+ t.off("object:scaling", this._handleObjectScaling), t.off("object:resizing", P._handleObjectResizing), t.off("object:modified", this._handleObjectModified), t.off("text:editing:exited", this._handleTextEditingExited), t.off("text:editing:entered", this._handleTextEditingEntered), t.off("text:changed", P._handleTextChanged);
4851
4841
  }
4852
4842
  /**
4853
4843
  * Возвращает активный текст или ищет по id.
@@ -4857,10 +4847,10 @@ class Z {
4857
4847
  const { canvas: e } = this;
4858
4848
  if (!t) {
4859
4849
  const s = e.getActiveObject();
4860
- return Z._isTextbox(s) ? s : null;
4850
+ return P._isTextbox(s) ? s : null;
4861
4851
  }
4862
4852
  if (typeof t == "string") {
4863
- const s = e.getObjects().find((o) => Z._isTextbox(o) && o.id === t);
4853
+ const s = e.getObjects().find((o) => P._isTextbox(o) && o.id === t);
4864
4854
  return s != null ? s : null;
4865
4855
  }
4866
4856
  return null;
@@ -4876,12 +4866,53 @@ class Z {
4876
4866
  */
4877
4867
  _bindEvents() {
4878
4868
  const { canvas: t } = this;
4879
- t.on("object:scaling", this._handleObjectScaling), t.on("object:modified", this._handleObjectModified), t.on("text:editing:entered", this._handleTextEditingEntered), t.on("text:editing:exited", this._handleTextEditingExited), t.on("text:changed", this._handleTextChanged);
4869
+ t.on("object:scaling", this._handleObjectScaling), t.on("object:resizing", P._handleObjectResizing), t.on("object:modified", this._handleObjectModified), t.on("text:editing:entered", this._handleTextEditingEntered), t.on("text:editing:exited", this._handleTextEditingExited), t.on("text:changed", P._handleTextChanged);
4870
+ }
4871
+ /**
4872
+ * Реагирует на изменение текста в режиме редактирования: синхронизирует textCaseRaw и uppercase.
4873
+ */
4874
+ static _handleTextChanged(t) {
4875
+ const { target: e } = t;
4876
+ if (!P._isTextbox(e)) return;
4877
+ const { text: s = "", uppercase: o } = e, n = !!o, i = s.toLocaleLowerCase();
4878
+ if (n) {
4879
+ const r = ie({ value: i });
4880
+ r !== s && e.set({ text: r }), e.textCaseRaw = i;
4881
+ } else
4882
+ e.textCaseRaw = s;
4883
+ P._roundTextboxDimensions({ textbox: e }) && (e.setCoords(), e.dirty = !0);
4884
+ }
4885
+ /**
4886
+ * Обрабатывает изменение ширины текстового объекта (resizing).
4887
+ * Корректирует ширину, вычитая паддинги, так как Fabric при изменении ширины
4888
+ * устанавливает значение, включающее визуальные отступы.
4889
+ * Также корректирует позицию при ресайзе слева, чтобы компенсировать смещение.
4890
+ */
4891
+ static _handleObjectResizing(t) {
4892
+ var l, u, g, f, p, m;
4893
+ const { target: e, transform: s } = t;
4894
+ if (!P._isTextbox(e)) return;
4895
+ const {
4896
+ paddingLeft: o = 0,
4897
+ paddingRight: n = 0
4898
+ } = e, i = o + n;
4899
+ if (i === 0) return;
4900
+ const a = (l = e.width) != null ? l : 0, r = Math.max(0, a - i);
4901
+ if (a === r) return;
4902
+ e.set({ width: r });
4903
+ const c = (u = e.width) != null ? u : 0, d = a - c;
4904
+ if (d !== 0 && s && s.corner === "ml") {
4905
+ const b = ((g = e.angle) != null ? g : 0) * Math.PI / 180, I = Math.cos(b), y = Math.sin(b), M = (f = e.scaleX) != null ? f : 1, A = d * M;
4906
+ e.set({
4907
+ left: ((p = e.left) != null ? p : 0) + A * I,
4908
+ top: ((m = e.top) != null ? m : 0) + A * y
4909
+ });
4910
+ }
4880
4911
  }
4881
4912
  /**
4882
4913
  * Возвращает диапазоны символов для каждой строки текста без учёта символов переноса.
4883
4914
  */
4884
- _getLineRanges({ textbox: t }) {
4915
+ static _getLineRanges({ textbox: t }) {
4885
4916
  var n;
4886
4917
  const e = (n = t.text) != null ? n : "";
4887
4918
  if (!e.length) return [];
@@ -4896,11 +4927,11 @@ class Z {
4896
4927
  /**
4897
4928
  * Расширяет выделение до полных строк, которые оно пересекает.
4898
4929
  */
4899
- _expandRangeToFullLines({
4930
+ static _expandRangeToFullLines({
4900
4931
  textbox: t,
4901
4932
  range: e
4902
4933
  }) {
4903
- const s = this._getLineRanges({ textbox: t });
4934
+ const s = P._getLineRanges({ textbox: t });
4904
4935
  if (!s.length) return e;
4905
4936
  let { start: o } = e, { end: n } = e;
4906
4937
  return s.forEach(({ start: i, end: a }) => {
@@ -4916,7 +4947,7 @@ class Z {
4916
4947
  if (!e) {
4917
4948
  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, {
4918
4949
  paddingTop: d = 0,
4919
- paddingRight: h = 0,
4950
+ paddingRight: l = 0,
4920
4951
  paddingBottom: u = 0,
4921
4952
  paddingLeft: g = 0
4922
4953
  } = t, {
@@ -4931,7 +4962,7 @@ class Z {
4931
4962
  baseLeft: a,
4932
4963
  basePadding: {
4933
4964
  top: d,
4934
- right: h,
4965
+ right: l,
4935
4966
  bottom: u,
4936
4967
  left: g
4937
4968
  },
@@ -4962,25 +4993,25 @@ class Z {
4962
4993
  static _roundTextboxDimensions({
4963
4994
  textbox: t
4964
4995
  }) {
4965
- const { width: e, height: s, calcTextWidth: o, calcTextHeight: n } = t, i = typeof o == "function" ? o.call(t) : void 0, a = typeof n == "function" ? n.call(t) : void 0, r = Z._resolveDimension({
4996
+ const { width: e, height: s, calcTextWidth: o, calcTextHeight: n } = t, i = typeof o == "function" ? o.call(t) : void 0, a = typeof n == "function" ? n.call(t) : void 0, r = P._resolveDimension({
4966
4997
  rawValue: e,
4967
4998
  calculatedValue: i
4968
- }), c = Z._resolveDimension({
4999
+ }), c = P._resolveDimension({
4969
5000
  rawValue: s,
4970
5001
  calculatedValue: a
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;
5002
+ }), d = Number.isFinite(r) ? Math.round(r) : null, l = Number.isFinite(c) ? Math.round(c) : null, u = {};
5003
+ 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;
4973
5004
  }
4974
5005
  /**
4975
5006
  * Формирует снимок текущих свойств текстового объекта для истории и событий.
4976
5007
  */
4977
5008
  static _getSnapshot(t) {
4978
5009
  const e = ({
4979
- snapshot: H,
4980
- entries: P
5010
+ snapshot: Z,
5011
+ entries: W
4981
5012
  }) => {
4982
- Object.entries(P).forEach(([K, $]) => {
4983
- $ != null && (H[K] = $);
5013
+ Object.entries(W).forEach(([K, $]) => {
5014
+ $ != null && (Z[K] = $);
4984
5015
  });
4985
5016
  }, {
4986
5017
  id: s,
@@ -4991,7 +5022,7 @@ class Z {
4991
5022
  fontSize: r,
4992
5023
  fontWeight: c,
4993
5024
  fontStyle: d,
4994
- underline: h,
5025
+ underline: l,
4995
5026
  linethrough: u,
4996
5027
  textAlign: g,
4997
5028
  fill: f,
@@ -5001,27 +5032,27 @@ class Z {
5001
5032
  backgroundColor: b,
5002
5033
  backgroundOpacity: I,
5003
5034
  paddingTop: y,
5004
- paddingRight: w,
5035
+ paddingRight: M,
5005
5036
  paddingBottom: A,
5006
5037
  paddingLeft: j,
5007
- radiusTopLeft: M,
5008
- radiusTopRight: T,
5009
- radiusBottomRight: S,
5010
- radiusBottomLeft: C,
5011
- left: x,
5012
- top: F,
5013
- width: U,
5014
- height: W,
5038
+ radiusTopLeft: S,
5039
+ radiusTopRight: C,
5040
+ radiusBottomRight: w,
5041
+ radiusBottomLeft: T,
5042
+ left: E,
5043
+ top: U,
5044
+ width: z,
5045
+ height: Y,
5015
5046
  angle: V,
5016
- scaleX: L,
5017
- scaleY: D
5018
- } = t, z = {
5047
+ scaleX: D,
5048
+ scaleY: _
5049
+ } = t, F = {
5019
5050
  id: s,
5020
5051
  uppercase: !!i,
5021
5052
  textAlign: g
5022
5053
  };
5023
5054
  return e({
5024
- snapshot: z,
5055
+ snapshot: F,
5025
5056
  entries: {
5026
5057
  text: o,
5027
5058
  textCaseRaw: n,
@@ -5029,7 +5060,7 @@ class Z {
5029
5060
  fontSize: r,
5030
5061
  fontWeight: c,
5031
5062
  fontStyle: d,
5032
- underline: h,
5063
+ underline: l,
5033
5064
  linethrough: u,
5034
5065
  fill: f,
5035
5066
  stroke: p,
@@ -5038,22 +5069,22 @@ class Z {
5038
5069
  backgroundColor: b,
5039
5070
  backgroundOpacity: I,
5040
5071
  paddingTop: y,
5041
- paddingRight: w,
5072
+ paddingRight: M,
5042
5073
  paddingBottom: A,
5043
5074
  paddingLeft: j,
5044
- radiusTopLeft: M,
5045
- radiusTopRight: T,
5046
- radiusBottomRight: S,
5047
- radiusBottomLeft: C,
5048
- left: x,
5049
- top: F,
5050
- width: U,
5051
- height: W,
5075
+ radiusTopLeft: S,
5076
+ radiusTopRight: C,
5077
+ radiusBottomRight: w,
5078
+ radiusBottomLeft: T,
5079
+ left: E,
5080
+ top: U,
5081
+ width: z,
5082
+ height: Y,
5052
5083
  angle: V,
5053
- scaleX: L,
5054
- scaleY: D
5084
+ scaleX: D,
5085
+ scaleY: _
5055
5086
  }
5056
- }), z;
5087
+ }), F;
5057
5088
  }
5058
5089
  /**
5059
5090
  * Возвращает первый доступный шрифт или дефолтный Arial.
@@ -5064,23 +5095,23 @@ class Z {
5064
5095
  }
5065
5096
  }
5066
5097
  const ot = ({
5067
- value: l,
5098
+ value: h,
5068
5099
  fallback: t = 0
5069
- }) => typeof l == "number" && Number.isFinite(l) ? l : typeof t == "number" && Number.isFinite(t) ? t : 0, Kt = ({
5070
- value: l,
5100
+ }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, Kt = ({
5101
+ value: h,
5071
5102
  dimension: t,
5072
5103
  useRelativePositions: e
5073
5104
  }) => {
5074
- const s = ot({ value: l });
5105
+ const s = ot({ value: h });
5075
5106
  return e ? s : s / (t || 1);
5076
5107
  }, lo = ({
5077
- object: l,
5108
+ object: h,
5078
5109
  baseWidth: t,
5079
5110
  baseHeight: e,
5080
5111
  useRelativePositions: s,
5081
5112
  centerKeys: o
5082
5113
  }) => {
5083
- const n = l;
5114
+ const n = h;
5084
5115
  if (typeof n[o.x] == "number" && typeof n[o.y] == "number")
5085
5116
  return {
5086
5117
  x: Kt({
@@ -5094,7 +5125,7 @@ const ot = ({
5094
5125
  useRelativePositions: s
5095
5126
  })
5096
5127
  };
5097
- const { left: a, top: r, width: c, height: d } = l, h = Kt({
5128
+ const { left: a, top: r, width: c, height: d } = h, l = Kt({
5098
5129
  value: a,
5099
5130
  dimension: t,
5100
5131
  useRelativePositions: s
@@ -5104,11 +5135,11 @@ const ot = ({
5104
5135
  useRelativePositions: s
5105
5136
  }), g = ot({ value: c }) / (t || 1), f = ot({ value: d }) / (e || 1);
5106
5137
  return {
5107
- x: h + g / 2,
5138
+ x: l + g / 2,
5108
5139
  y: u + f / 2
5109
5140
  };
5110
5141
  }, ho = ({
5111
- normalizedX: l,
5142
+ normalizedX: h,
5112
5143
  normalizedY: t,
5113
5144
  bounds: e,
5114
5145
  targetSize: s,
@@ -5116,33 +5147,33 @@ const ot = ({
5116
5147
  }) => {
5117
5148
  const { left: n, top: i, width: a, height: r } = e;
5118
5149
  if (!o) {
5119
- const { width: h, height: u } = s, g = n + l * (h || a), f = i + t * (u || r);
5150
+ const { width: l, height: u } = s, g = n + h * (l || a), f = i + t * (u || r);
5120
5151
  return new tt(g, f);
5121
5152
  }
5122
- const c = n + l * a, d = i + t * r;
5153
+ const c = n + h * a, d = i + t * r;
5123
5154
  return new tt(c, d);
5124
5155
  }, uo = ({
5125
- object: l,
5156
+ object: h,
5126
5157
  montageArea: t,
5127
5158
  bounds: e
5128
5159
  }) => {
5129
5160
  if (!t || !e) return null;
5130
5161
  try {
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;
5162
+ 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;
5132
5163
  return {
5133
5164
  x: d,
5134
- y: h
5165
+ y: l
5135
5166
  };
5136
5167
  } catch (s) {
5137
5168
  return null;
5138
5169
  }
5139
5170
  }, ft = ({
5140
- object: l
5171
+ object: h
5141
5172
  }) => {
5142
- if (!l) return null;
5173
+ if (!h) return null;
5143
5174
  try {
5144
- l.setCoords();
5145
- const t = l.getBoundingRect(!1, !0), {
5175
+ h.setCoords();
5176
+ const t = h.getBoundingRect(!1, !0), {
5146
5177
  left: e = 0,
5147
5178
  top: s = 0,
5148
5179
  width: o = 0,
@@ -5160,13 +5191,13 @@ const ot = ({
5160
5191
  return null;
5161
5192
  }
5162
5193
  }, go = ({
5163
- x1: l,
5194
+ x1: h,
5164
5195
  y1: t,
5165
5196
  x2: e,
5166
5197
  y2: s
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) => ({
5198
+ }) => (Math.atan2(s - t, e - h) * 180 / Math.PI + 360) % 360, fo = (h) => {
5199
+ if (!h || typeof h != "object") return null;
5200
+ 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, l = o.map((u) => ({
5170
5201
  color: typeof u.color == "string" ? u.color : "#000000",
5171
5202
  offset: typeof u.offset == "number" ? u.offset * 100 : 0
5172
5203
  }));
@@ -5181,7 +5212,7 @@ const ot = ({
5181
5212
  endColor: r,
5182
5213
  startPosition: c,
5183
5214
  endPosition: d,
5184
- colorStops: h
5215
+ colorStops: l
5185
5216
  };
5186
5217
  }
5187
5218
  if (t === "radial") {
@@ -5196,7 +5227,7 @@ const ot = ({
5196
5227
  endColor: r,
5197
5228
  startPosition: c,
5198
5229
  endPosition: d,
5199
- colorStops: h
5230
+ colorStops: l
5200
5231
  };
5201
5232
  }
5202
5233
  return null;
@@ -5220,7 +5251,7 @@ class R {
5220
5251
  montageArea: i,
5221
5252
  errorManager: a,
5222
5253
  backgroundManager: r
5223
- } = this.editor, c = n.getActiveObject(), d = R._collectObjects(c), { backgroundObject: h } = r != null ? r : {}, u = o && h ? [h] : [], g = [...d, ...u];
5254
+ } = this.editor, c = n.getActiveObject(), d = R._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, u = o && l ? [l] : [], g = [...d, ...u];
5224
5255
  if (!g.length)
5225
5256
  return a.emitWarning({
5226
5257
  origin: "TemplateManager",
@@ -5228,13 +5259,13 @@ class R {
5228
5259
  code: bt.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
5229
5260
  message: "Нет объектов для сериализации шаблона"
5230
5261
  }), null;
5231
- const f = R._getBounds(i), p = R._getMontageSize({ montageArea: i, bounds: f }), m = p.width, v = p.height, b = g.map((w) => R._serializeObject({
5232
- object: w,
5262
+ const f = R._getBounds(i), p = R._getMontageSize({ montageArea: i, bounds: f }), m = p.width, v = p.height, b = g.map((M) => R._serializeObject({
5263
+ object: M,
5233
5264
  bounds: f,
5234
5265
  baseWidth: m,
5235
5266
  baseHeight: v,
5236
5267
  montageArea: i != null ? i : null
5237
- })), I = yt(_({}, s), {
5268
+ })), I = yt(N({}, s), {
5238
5269
  baseWidth: m,
5239
5270
  baseHeight: v,
5240
5271
  positionsNormalized: !0,
@@ -5253,7 +5284,7 @@ class R {
5253
5284
  * @param options.data - данные для заполнения текстов по customData.templateField
5254
5285
  */
5255
5286
  applyTemplate(s) {
5256
- return N(this, arguments, function* ({
5287
+ return x(this, arguments, function* ({
5257
5288
  template: t,
5258
5289
  data: e
5259
5290
  }) {
@@ -5263,7 +5294,7 @@ class R {
5263
5294
  historyManager: i,
5264
5295
  errorManager: a,
5265
5296
  backgroundManager: r
5266
- } = this.editor, { objects: c, meta: d, id: h } = t != null ? t : {};
5297
+ } = this.editor, { objects: c, meta: d, id: l } = t != null ? t : {};
5267
5298
  if (!(c != null && c.length))
5268
5299
  return a.emitWarning({
5269
5300
  origin: "TemplateManager",
@@ -5291,13 +5322,13 @@ class R {
5291
5322
  code: bt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5292
5323
  message: "Не удалось создать объекты шаблона"
5293
5324
  }), null;
5294
- const { backgroundObject: y, contentObjects: w } = R._extractBackgroundObject(I);
5325
+ const { backgroundObject: y, contentObjects: M } = R._extractBackgroundObject(I);
5295
5326
  y && (b = yield R._applyBackgroundFromObject({
5296
5327
  backgroundObject: y,
5297
5328
  backgroundManager: r,
5298
5329
  errorManager: a
5299
5330
  }));
5300
- const A = w.map((j) => (R._applyTextOverrides({ object: j, data: e }), R._transformObject({
5331
+ const A = M.map((j) => (R._applyTextOverrides({ object: j, data: e }), R._transformObject({
5301
5332
  object: j,
5302
5333
  scale: p,
5303
5334
  bounds: u,
@@ -5322,7 +5353,7 @@ class R {
5322
5353
  code: bt.TEMPLATE_MANAGER.APPLY_FAILED,
5323
5354
  message: "Ошибка применения шаблона",
5324
5355
  data: {
5325
- templateId: h,
5356
+ templateId: l,
5326
5357
  error: I
5327
5358
  }
5328
5359
  }), null;
@@ -5359,8 +5390,8 @@ class R {
5359
5390
  * Превращает plain-описание объектов в Fabric объекты.
5360
5391
  */
5361
5392
  static _enlivenObjects(t) {
5362
- return N(this, null, function* () {
5363
- return (yield Promise.all(t.map((s) => N(null, null, function* () {
5393
+ return x(this, null, function* () {
5394
+ return (yield Promise.all(t.map((s) => x(null, null, function* () {
5364
5395
  if (R._hasSerializedSvgMarkup(s)) {
5365
5396
  const i = yield R._reviveSvgObject(s);
5366
5397
  if (i)
@@ -5383,19 +5414,44 @@ class R {
5383
5414
  width: o,
5384
5415
  height: n,
5385
5416
  scaleX: i,
5386
- scaleY: a
5387
- } = e, r = t, c = "getElement" in r && typeof r.getElement == "function" ? r.getElement() : null, {
5388
- naturalWidth: d = 0,
5389
- naturalHeight: h = 0,
5390
- width: u = 0,
5391
- height: g = 0
5392
- } = c instanceof HTMLImageElement ? c : {
5417
+ scaleY: a,
5418
+ customData: r
5419
+ } = e, c = t, d = "getElement" in c && typeof c.getElement == "function" ? c.getElement() : null, {
5420
+ naturalWidth: l = 0,
5421
+ naturalHeight: u = 0,
5422
+ width: g = 0,
5423
+ height: f = 0
5424
+ } = d instanceof HTMLImageElement ? d : {
5393
5425
  naturalWidth: 0,
5394
5426
  naturalHeight: 0,
5395
5427
  width: 0,
5396
5428
  height: 0
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 = {};
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);
5429
+ }, p = ot({ value: l || g || c.width, fallback: 0 }), m = ot({ value: u || f || c.height, fallback: 0 }), v = ot({ value: o, fallback: p }), b = ot({ value: n, fallback: m }), I = ot({ value: i, fallback: c.scaleX || 1 }), y = ot({ value: a, fallback: c.scaleY || 1 }), M = v * I, A = b * y, j = p > 0, S = m > 0, C = M > 0, w = A > 0, T = R._resolveImageFit({ customData: r }), E = {};
5430
+ if (j && (E.width = p), S && (E.height = m), !j || !S) {
5431
+ c.set(E);
5432
+ return;
5433
+ }
5434
+ if (T === "stretch") {
5435
+ const z = C ? M / p : null, Y = w ? A / m : null;
5436
+ z && z > 0 && (E.scaleX = z), Y && Y > 0 && (E.scaleY = Y), c.set(E);
5437
+ return;
5438
+ }
5439
+ if (!C || !w) {
5440
+ c.set(E);
5441
+ return;
5442
+ }
5443
+ const U = Math.min(M / p, A / m);
5444
+ Number.isFinite(U) && U > 0 && (E.scaleX = U, E.scaleY = U), c.set(E);
5445
+ }
5446
+ /**
5447
+ * Определяет режим вписывания изображения при восстановлении.
5448
+ */
5449
+ static _resolveImageFit({
5450
+ customData: t
5451
+ }) {
5452
+ if (!t || typeof t != "object") return "contain";
5453
+ const { imageFit: e } = t;
5454
+ return e === "stretch" ? "stretch" : "contain";
5399
5455
  }
5400
5456
  /**
5401
5457
  * Проверяет, содержит ли сериализованный объект инлайн SVG.
@@ -5407,7 +5463,7 @@ class R {
5407
5463
  * Восстанавливает SVG-объект из компактного описания.
5408
5464
  */
5409
5465
  static _reviveSvgObject(t) {
5410
- return N(this, null, function* () {
5466
+ return x(this, null, function* () {
5411
5467
  const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
5412
5468
  if (!e) return null;
5413
5469
  try {
@@ -5424,7 +5480,7 @@ class R {
5424
5480
  * Убирает технические поля сериализации, оставляя только применимые свойства.
5425
5481
  */
5426
5482
  static _prepareSerializableProps(t) {
5427
- const e = _({}, t);
5483
+ const e = N({}, t);
5428
5484
  return delete e.svgMarkup, delete e.objects, delete e.path, delete e.paths, delete e.type, delete e.version, e;
5429
5485
  }
5430
5486
  /**
@@ -5470,7 +5526,7 @@ class R {
5470
5526
  montageArea: a,
5471
5527
  useRelativePositions: r
5472
5528
  }) {
5473
- const c = t, { x: d, y: h } = lo({
5529
+ const c = t, { x: d, y: l } = lo({
5474
5530
  object: t,
5475
5531
  baseWidth: n,
5476
5532
  baseHeight: i,
@@ -5489,7 +5545,7 @@ class R {
5489
5545
  anchorY: R._resolveAnchor(c, de)
5490
5546
  }), v = ho({
5491
5547
  normalizedX: d,
5492
- normalizedY: h,
5548
+ normalizedY: l,
5493
5549
  bounds: m,
5494
5550
  targetSize: o,
5495
5551
  montageArea: a
@@ -5513,7 +5569,7 @@ class R {
5513
5569
  anchorY: a
5514
5570
  }) {
5515
5571
  if (!n) return t;
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);
5572
+ 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);
5517
5573
  return {
5518
5574
  left: u,
5519
5575
  top: g,
@@ -5528,17 +5584,14 @@ class R {
5528
5584
  const s = t[e];
5529
5585
  return s === "center" || s === "end" || s === "start" ? s : "start";
5530
5586
  }
5531
- static _detectAnchor({
5532
- start: t,
5533
- end: e
5534
- }) {
5535
- const s = t <= 0.05, o = e >= 0.95, n = t < 0, i = e > 1, a = e - t, r = Math.max(0, t), c = Math.max(0, 1 - e);
5587
+ static _detectAnchor({ start: t, end: e }) {
5588
+ const s = t <= 0.05, o = e >= 0.95, n = t < 0, i = e > 1, a = e - t, r = Math.max(0, t), c = Math.max(0, 1 - e), d = Math.abs(r - c) <= 0.02;
5536
5589
  if (s && o || n && i)
5537
- return a >= 0.98 ? "center" : r <= c ? "start" : "end";
5590
+ return d || a >= 0.9 ? "center" : r <= c ? "start" : "end";
5538
5591
  if (s || n) return "start";
5539
5592
  if (o || i) return "end";
5540
- const d = r - c;
5541
- return Math.abs(d) <= 0.1 ? "center" : d < 0 ? "start" : "end";
5593
+ const l = r - c;
5594
+ return Math.abs(l) <= 0.1 ? "center" : l < 0 ? "start" : "end";
5542
5595
  }
5543
5596
  /**
5544
5597
  * Нормализует мета-данные шаблона.
@@ -5548,7 +5601,7 @@ class R {
5548
5601
  fallback: e
5549
5602
  }) {
5550
5603
  const { width: s, height: o } = e, r = t || {}, { baseWidth: n = s, baseHeight: i = o } = r, a = vt(r, ["baseWidth", "baseHeight"]);
5551
- return _({
5604
+ return N({
5552
5605
  baseWidth: n,
5553
5606
  baseHeight: i
5554
5607
  }, a);
@@ -5610,7 +5663,7 @@ class R {
5610
5663
  top: r,
5611
5664
  width: c,
5612
5665
  height: d
5613
- } = e, h = t.getBoundingRect(!1, !0), u = s || c || 1, g = o || d || 1, f = uo({
5666
+ } = e, l = t.getBoundingRect(!1, !0), u = s || c || 1, g = o || d || 1, f = uo({
5614
5667
  object: t,
5615
5668
  montageArea: n,
5616
5669
  bounds: e
@@ -5620,7 +5673,7 @@ class R {
5620
5673
  x: (y.x - a) / u,
5621
5674
  y: (y.y - r) / g
5622
5675
  };
5623
- })(), m = (h.left - a) / u, v = (h.top - r) / g, b = m + h.width / u, I = v + h.height / g;
5676
+ })(), m = (l.left - a) / u, v = (l.top - r) / g, b = m + l.width / u, I = v + l.height / g;
5624
5677
  return i[ae] = p.x, i[re] = p.y, i[ce] = R._detectAnchor({
5625
5678
  center: p.x,
5626
5679
  start: m,
@@ -5645,7 +5698,7 @@ class R {
5645
5698
  * Применяет фоновый объект шаблона к текущему холсту через BackgroundManager.
5646
5699
  */
5647
5700
  static _applyBackgroundFromObject(o) {
5648
- return N(this, arguments, function* ({
5701
+ return x(this, arguments, function* ({
5649
5702
  backgroundObject: t,
5650
5703
  backgroundManager: e,
5651
5704
  errorManager: s
@@ -5710,7 +5763,7 @@ class R {
5710
5763
  */
5711
5764
  static _cloneCustomData(t) {
5712
5765
  if (!(!t || typeof t != "object"))
5713
- return _({}, t);
5766
+ return N({}, t);
5714
5767
  }
5715
5768
  /**
5716
5769
  * Извлекает src изображения из FabricImage или его исходного элемента.
@@ -5740,13 +5793,13 @@ class R {
5740
5793
  }
5741
5794
  }
5742
5795
  const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5743
- anchors: l,
5796
+ anchors: h,
5744
5797
  positions: t,
5745
5798
  threshold: e
5746
5799
  }) => {
5747
5800
  let s = 0, o = e + 1, n = null;
5748
5801
  for (const i of t)
5749
- for (const a of l) {
5802
+ for (const a of h) {
5750
5803
  const r = Math.abs(a - i);
5751
5804
  r > e || r >= o || (s = a - i, o = r, n = a);
5752
5805
  }
@@ -5755,11 +5808,11 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5755
5808
  guidePosition: n
5756
5809
  };
5757
5810
  }, mo = ({
5758
- activeBounds: l,
5811
+ activeBounds: h,
5759
5812
  threshold: t,
5760
5813
  anchors: e
5761
5814
  }) => {
5762
- const { left: s, right: o, centerX: n, top: i, bottom: a, centerY: r } = l, c = Qe({
5815
+ const { left: s, right: o, centerX: n, top: i, bottom: a, centerY: r } = h, c = Qe({
5763
5816
  anchors: e.vertical,
5764
5817
  positions: [s, n, o],
5765
5818
  threshold: t
@@ -5767,20 +5820,20 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5767
5820
  anchors: e.horizontal,
5768
5821
  positions: [i, r, a],
5769
5822
  threshold: t
5770
- }), h = [];
5771
- return c.guidePosition !== null && h.push({
5823
+ }), l = [];
5824
+ return c.guidePosition !== null && l.push({
5772
5825
  type: "vertical",
5773
5826
  position: c.guidePosition
5774
- }), d.guidePosition !== null && h.push({
5827
+ }), d.guidePosition !== null && l.push({
5775
5828
  type: "horizontal",
5776
5829
  position: d.guidePosition
5777
5830
  }), {
5778
5831
  deltaX: c.delta,
5779
5832
  deltaY: d.delta,
5780
- guides: h
5833
+ guides: l
5781
5834
  };
5782
5835
  }, ns = ({
5783
- activeBounds: l,
5836
+ activeBounds: h,
5784
5837
  aligned: t,
5785
5838
  threshold: e,
5786
5839
  patterns: s,
@@ -5792,59 +5845,59 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5792
5845
  bottom: i,
5793
5846
  left: a,
5794
5847
  right: r
5795
- } = l, c = [];
5848
+ } = h, c = [];
5796
5849
  for (const d of s)
5797
- for (const h of t)
5850
+ for (const l of t)
5798
5851
  if (o === "vertical") {
5799
- const u = n - h.bottom, g = Math.abs(u - d.distance);
5852
+ const u = n - l.bottom, g = Math.abs(u - d.distance);
5800
5853
  if (g <= e) {
5801
5854
  const m = d.distance - u, v = {
5802
5855
  type: o,
5803
5856
  axis: d.axis,
5804
5857
  refStart: d.start,
5805
5858
  refEnd: d.end,
5806
- activeStart: h.bottom,
5807
- activeEnd: h.bottom + d.distance,
5859
+ activeStart: l.bottom,
5860
+ activeEnd: l.bottom + d.distance,
5808
5861
  distance: d.distance
5809
5862
  };
5810
5863
  c.push({ delta: m, guide: v, diff: g });
5811
5864
  }
5812
- const f = h.top - i, p = Math.abs(f - d.distance);
5865
+ const f = l.top - i, p = Math.abs(f - d.distance);
5813
5866
  if (p <= e) {
5814
5867
  const m = d.distance - f, v = {
5815
5868
  type: o,
5816
5869
  axis: d.axis,
5817
5870
  refStart: d.start,
5818
5871
  refEnd: d.end,
5819
- activeStart: h.top - d.distance,
5820
- activeEnd: h.top,
5872
+ activeStart: l.top - d.distance,
5873
+ activeEnd: l.top,
5821
5874
  distance: d.distance
5822
5875
  };
5823
5876
  c.push({ delta: m, guide: v, diff: p });
5824
5877
  }
5825
5878
  } else {
5826
- const u = a - h.right, g = Math.abs(u - d.distance);
5879
+ const u = a - l.right, g = Math.abs(u - d.distance);
5827
5880
  if (g <= e) {
5828
5881
  const m = d.distance - u, v = {
5829
5882
  type: o,
5830
5883
  axis: d.axis,
5831
5884
  refStart: d.start,
5832
5885
  refEnd: d.end,
5833
- activeStart: h.right,
5834
- activeEnd: h.right + d.distance,
5886
+ activeStart: l.right,
5887
+ activeEnd: l.right + d.distance,
5835
5888
  distance: d.distance
5836
5889
  };
5837
5890
  c.push({ delta: m, guide: v, diff: g });
5838
5891
  }
5839
- const f = h.left - r, p = Math.abs(f - d.distance);
5892
+ const f = l.left - r, p = Math.abs(f - d.distance);
5840
5893
  if (p <= e) {
5841
5894
  const m = d.distance - f, v = {
5842
5895
  type: o,
5843
5896
  axis: d.axis,
5844
5897
  refStart: d.start,
5845
5898
  refEnd: d.end,
5846
- activeStart: h.left - d.distance,
5847
- activeEnd: h.left,
5899
+ activeStart: l.left - d.distance,
5900
+ activeEnd: l.left,
5848
5901
  distance: d.distance
5849
5902
  };
5850
5903
  c.push({ delta: m, guide: v, diff: p });
@@ -5852,7 +5905,7 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5852
5905
  }
5853
5906
  return c;
5854
5907
  }, yo = ({
5855
- activeBounds: l,
5908
+ activeBounds: h,
5856
5909
  candidates: t,
5857
5910
  threshold: e,
5858
5911
  patterns: s
@@ -5863,68 +5916,68 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5863
5916
  bottom: i,
5864
5917
  left: a,
5865
5918
  right: r
5866
- } = l, c = t.filter((y) => Math.min(y.right, r) - Math.max(y.left, a) >= -e);
5919
+ } = h, c = t.filter((y) => Math.min(y.right, r) - Math.max(y.left, a) >= -e);
5867
5920
  if (!c.length)
5868
5921
  return { delta: 0, guide: null };
5869
5922
  const d = [
5870
5923
  ...c.map((y) => ({ bounds: y, isActive: !1 })),
5871
- { bounds: l, isActive: !0 }
5924
+ { bounds: h, isActive: !0 }
5872
5925
  ];
5873
- d.sort((y, w) => y.bounds.top - w.bounds.top);
5874
- const h = d.findIndex((y) => y.isActive);
5875
- if (h === -1)
5926
+ d.sort((y, M) => y.bounds.top - M.bounds.top);
5927
+ const l = d.findIndex((y) => y.isActive);
5928
+ if (l === -1)
5876
5929
  return { delta: 0, guide: null };
5877
- const u = d[h - 1], g = d[h - 2], f = d[h + 1], p = d[h + 2], m = [], v = i - n;
5930
+ const u = d[l - 1], g = d[l - 2], f = d[l + 1], p = d[l + 2], m = [], v = i - n;
5878
5931
  if (u && g) {
5879
- const { bounds: y } = u, { bounds: w } = g, A = y.top - w.bottom, j = n - y.bottom, M = Math.abs(j - A);
5880
- if (M <= e) {
5881
- const T = A - j, S = n + T, C = {
5932
+ const { bounds: y } = u, { bounds: M } = g, A = y.top - M.bottom, j = n - y.bottom, S = Math.abs(j - A);
5933
+ if (S <= e) {
5934
+ const C = A - j, w = n + C, T = {
5882
5935
  type: "vertical",
5883
5936
  axis: o,
5884
- refStart: w.bottom,
5937
+ refStart: M.bottom,
5885
5938
  refEnd: y.top,
5886
5939
  activeStart: y.bottom,
5887
- activeEnd: S,
5940
+ activeEnd: w,
5888
5941
  distance: A
5889
5942
  };
5890
- m.push({ delta: T, guide: C, diff: M });
5943
+ m.push({ delta: C, guide: T, diff: S });
5891
5944
  }
5892
5945
  }
5893
5946
  if (f && p) {
5894
- const { bounds: y } = f, { bounds: w } = p, A = w.top - y.bottom, j = y.top - i, M = Math.abs(j - A);
5895
- if (M <= e) {
5896
- const T = j - A, S = i + T, C = {
5947
+ const { bounds: y } = f, { bounds: M } = p, A = M.top - y.bottom, j = y.top - i, S = Math.abs(j - A);
5948
+ if (S <= e) {
5949
+ const C = j - A, w = i + C, T = {
5897
5950
  type: "vertical",
5898
5951
  axis: o,
5899
5952
  refStart: y.bottom,
5900
- refEnd: w.top,
5901
- activeStart: S,
5953
+ refEnd: M.top,
5954
+ activeStart: w,
5902
5955
  activeEnd: y.top,
5903
5956
  distance: A
5904
5957
  };
5905
- m.push({ delta: T, guide: C, diff: M });
5958
+ m.push({ delta: C, guide: T, diff: S });
5906
5959
  }
5907
5960
  }
5908
5961
  if (u && f) {
5909
- const { bounds: y } = u, { bounds: w } = f, j = w.top - y.bottom - v;
5962
+ const { bounds: y } = u, { bounds: M } = f, j = M.top - y.bottom - v;
5910
5963
  if (j >= 0) {
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);
5912
- if (F <= e) {
5913
- const U = M - T, W = i + U, V = {
5964
+ const S = j / 2, C = n - y.bottom, w = M.top - i, T = Math.abs(C - S), E = Math.abs(w - S), U = Math.max(T, E);
5965
+ if (U <= e) {
5966
+ const z = S - C, Y = i + z, V = {
5914
5967
  type: "vertical",
5915
5968
  axis: o,
5916
5969
  refStart: y.bottom,
5917
- refEnd: y.bottom + M,
5918
- activeStart: W,
5919
- activeEnd: W + M,
5920
- distance: M
5970
+ refEnd: y.bottom + S,
5971
+ activeStart: Y,
5972
+ activeEnd: Y + S,
5973
+ distance: S
5921
5974
  };
5922
- m.push({ delta: U, guide: V, diff: F });
5975
+ m.push({ delta: z, guide: V, diff: U });
5923
5976
  }
5924
5977
  }
5925
5978
  }
5926
5979
  const b = ns({
5927
- activeBounds: l,
5980
+ activeBounds: h,
5928
5981
  aligned: c,
5929
5982
  threshold: e,
5930
5983
  patterns: s,
@@ -5932,13 +5985,13 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5932
5985
  });
5933
5986
  if (m.push(...b), !m.length)
5934
5987
  return { delta: 0, guide: null };
5935
- const I = m.reduce((y, w) => w.diff < y.diff ? w : y, m[0]);
5988
+ const I = m.reduce((y, M) => M.diff < y.diff ? M : y, m[0]);
5936
5989
  return {
5937
5990
  delta: I.delta,
5938
5991
  guide: I.guide
5939
5992
  };
5940
5993
  }, vo = ({
5941
- activeBounds: l,
5994
+ activeBounds: h,
5942
5995
  candidates: t,
5943
5996
  threshold: e,
5944
5997
  patterns: s
@@ -5949,68 +6002,68 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5949
6002
  right: i,
5950
6003
  top: a,
5951
6004
  bottom: r
5952
- } = l, c = t.filter((y) => Math.min(y.bottom, r) - Math.max(y.top, a) >= -e);
6005
+ } = h, c = t.filter((y) => Math.min(y.bottom, r) - Math.max(y.top, a) >= -e);
5953
6006
  if (!c.length)
5954
6007
  return { delta: 0, guide: null };
5955
6008
  const d = [
5956
6009
  ...c.map((y) => ({ bounds: y, isActive: !1 })),
5957
- { bounds: l, isActive: !0 }
6010
+ { bounds: h, isActive: !0 }
5958
6011
  ];
5959
- d.sort((y, w) => y.bounds.left - w.bounds.left);
5960
- const h = d.findIndex((y) => y.isActive);
5961
- if (h === -1)
6012
+ d.sort((y, M) => y.bounds.left - M.bounds.left);
6013
+ const l = d.findIndex((y) => y.isActive);
6014
+ if (l === -1)
5962
6015
  return { delta: 0, guide: null };
5963
- const u = d[h - 1], g = d[h - 2], f = d[h + 1], p = d[h + 2], m = [], v = i - n;
6016
+ const u = d[l - 1], g = d[l - 2], f = d[l + 1], p = d[l + 2], m = [], v = i - n;
5964
6017
  if (u && g) {
5965
- const { bounds: y } = u, { bounds: w } = g, A = y.left - w.right, j = n - y.right, M = Math.abs(j - A);
5966
- if (M <= e) {
5967
- const T = A - j, S = n + T, C = {
6018
+ const { bounds: y } = u, { bounds: M } = g, A = y.left - M.right, j = n - y.right, S = Math.abs(j - A);
6019
+ if (S <= e) {
6020
+ const C = A - j, w = n + C, T = {
5968
6021
  type: "horizontal",
5969
6022
  axis: o,
5970
- refStart: w.right,
6023
+ refStart: M.right,
5971
6024
  refEnd: y.left,
5972
6025
  activeStart: y.right,
5973
- activeEnd: S,
6026
+ activeEnd: w,
5974
6027
  distance: A
5975
6028
  };
5976
- m.push({ delta: T, guide: C, diff: M });
6029
+ m.push({ delta: C, guide: T, diff: S });
5977
6030
  }
5978
6031
  }
5979
6032
  if (f && p) {
5980
- const { bounds: y } = f, { bounds: w } = p, A = w.left - y.right, j = y.left - i, M = Math.abs(j - A);
5981
- if (M <= e) {
5982
- const T = j - A, S = i + T, C = {
6033
+ const { bounds: y } = f, { bounds: M } = p, A = M.left - y.right, j = y.left - i, S = Math.abs(j - A);
6034
+ if (S <= e) {
6035
+ const C = j - A, w = i + C, T = {
5983
6036
  type: "horizontal",
5984
6037
  axis: o,
5985
6038
  refStart: y.right,
5986
- refEnd: w.left,
5987
- activeStart: S,
6039
+ refEnd: M.left,
6040
+ activeStart: w,
5988
6041
  activeEnd: y.left,
5989
6042
  distance: A
5990
6043
  };
5991
- m.push({ delta: T, guide: C, diff: M });
6044
+ m.push({ delta: C, guide: T, diff: S });
5992
6045
  }
5993
6046
  }
5994
6047
  if (u && f) {
5995
- const { bounds: y } = u, { bounds: w } = f, j = w.left - y.right - v;
6048
+ const { bounds: y } = u, { bounds: M } = f, j = M.left - y.right - v;
5996
6049
  if (j >= 0) {
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);
5998
- if (F <= e) {
5999
- const U = M - T, W = i + U, V = {
6050
+ const S = j / 2, C = n - y.right, w = M.left - i, T = Math.abs(C - S), E = Math.abs(w - S), U = Math.max(T, E);
6051
+ if (U <= e) {
6052
+ const z = S - C, Y = i + z, V = {
6000
6053
  type: "horizontal",
6001
6054
  axis: o,
6002
6055
  refStart: y.right,
6003
- refEnd: y.right + M,
6004
- activeStart: W,
6005
- activeEnd: W + M,
6006
- distance: M
6056
+ refEnd: y.right + S,
6057
+ activeStart: Y,
6058
+ activeEnd: Y + S,
6059
+ distance: S
6007
6060
  };
6008
- m.push({ delta: U, guide: V, diff: F });
6061
+ m.push({ delta: z, guide: V, diff: U });
6009
6062
  }
6010
6063
  }
6011
6064
  }
6012
6065
  const b = ns({
6013
- activeBounds: l,
6066
+ activeBounds: h,
6014
6067
  aligned: c,
6015
6068
  threshold: e,
6016
6069
  patterns: s,
@@ -6018,24 +6071,24 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6018
6071
  });
6019
6072
  if (m.push(...b), !m.length)
6020
6073
  return { delta: 0, guide: null };
6021
- const I = m.reduce((y, w) => w.diff < y.diff ? w : y, m[0]);
6074
+ const I = m.reduce((y, M) => M.diff < y.diff ? M : y, m[0]);
6022
6075
  return {
6023
6076
  delta: I.delta,
6024
6077
  guide: I.guide
6025
6078
  };
6026
6079
  }, bo = ({
6027
- activeBounds: l,
6080
+ activeBounds: h,
6028
6081
  candidates: t,
6029
6082
  threshold: e,
6030
6083
  spacingPatterns: s
6031
6084
  }) => {
6032
6085
  const o = yo({
6033
- activeBounds: l,
6086
+ activeBounds: h,
6034
6087
  candidates: t,
6035
6088
  threshold: e,
6036
6089
  patterns: s.vertical
6037
6090
  }), n = vo({
6038
- activeBounds: l,
6091
+ activeBounds: h,
6039
6092
  candidates: t,
6040
6093
  threshold: e,
6041
6094
  patterns: s.horizontal
@@ -6046,7 +6099,7 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6046
6099
  guides: i
6047
6100
  };
6048
6101
  }, Mo = ({
6049
- context: l,
6102
+ context: h,
6050
6103
  x: t,
6051
6104
  y: e,
6052
6105
  width: s,
@@ -6054,9 +6107,9 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6054
6107
  radius: n
6055
6108
  }) => {
6056
6109
  const i = Math.min(n, s / 2, o / 2);
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();
6110
+ 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();
6058
6111
  }, me = ({
6059
- context: l,
6112
+ context: h,
6060
6113
  type: t,
6061
6114
  axis: e,
6062
6115
  start: s,
@@ -6067,24 +6120,24 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6067
6120
  textColor: r = "#ffffff",
6068
6121
  fontFamily: c = "sans-serif",
6069
6122
  lineWidth: d = 1,
6070
- padding: h = 4,
6123
+ padding: l = 4,
6071
6124
  radius: u = 4,
6072
6125
  offsetAlongAxis: g = 0,
6073
6126
  offsetPerpendicular: f = 0
6074
6127
  }) => {
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,
6080
- x: T,
6081
- y: S,
6128
+ const p = i || 1, m = 12 / p, v = l / p, b = u / p, I = (s + o) / 2 + g, y = t === "vertical" ? e + f : I, M = t === "vertical" ? I : e + f;
6129
+ 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";
6130
+ const j = h.measureText(n).width + v * 2, S = m + v * 2, C = y - j / 2, w = M - S / 2;
6131
+ h.beginPath(), Mo({
6132
+ context: h,
6133
+ x: C,
6134
+ y: w,
6082
6135
  width: j,
6083
- height: M,
6136
+ height: S,
6084
6137
  radius: b
6085
- }), l.fill(), l.fillStyle = r, l.fillText(n, y, w), l.restore();
6138
+ }), h.fill(), h.fillStyle = r, h.fillText(n, y, M), h.restore();
6086
6139
  }, wo = ({
6087
- context: l,
6140
+ context: h,
6088
6141
  guide: t,
6089
6142
  zoom: e
6090
6143
  }) => {
@@ -6097,31 +6150,31 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6097
6150
  activeEnd: r,
6098
6151
  distance: c
6099
6152
  } = t, d = Math.round(c).toString();
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;
6153
+ 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();
6154
+ const l = os;
6102
6155
  me({
6103
- context: l,
6156
+ context: h,
6104
6157
  type: s,
6105
6158
  axis: o,
6106
6159
  start: n,
6107
6160
  end: i,
6108
6161
  text: d,
6109
6162
  zoom: e,
6110
- color: h,
6163
+ color: l,
6111
6164
  lineWidth: pe
6112
6165
  }), me({
6113
- context: l,
6166
+ context: h,
6114
6167
  type: s,
6115
6168
  axis: o,
6116
6169
  start: a,
6117
6170
  end: r,
6118
6171
  text: d,
6119
6172
  zoom: e,
6120
- color: h,
6173
+ color: l,
6121
6174
  lineWidth: pe
6122
6175
  });
6123
6176
  }, qe = ({
6124
- anchors: l,
6177
+ anchors: h,
6125
6178
  bounds: t
6126
6179
  }) => {
6127
6180
  const {
@@ -6132,24 +6185,24 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6132
6185
  bottom: i,
6133
6186
  centerY: a
6134
6187
  } = t;
6135
- l.vertical.push(e, o, s), l.horizontal.push(n, a, i);
6188
+ h.vertical.push(e, o, s), h.horizontal.push(n, a, i);
6136
6189
  }, Je = ({
6137
- bounds: l,
6190
+ bounds: h,
6138
6191
  type: t,
6139
6192
  primaryStart: e,
6140
6193
  primaryEnd: s
6141
6194
  }) => {
6142
- const o = [], n = e === "top" ? "left" : "top", i = s === "bottom" ? "right" : "bottom", a = [...l].sort((r, c) => r[e] - c[e]);
6195
+ const o = [], n = e === "top" ? "left" : "top", i = s === "bottom" ? "right" : "bottom", a = [...h].sort((r, c) => r[e] - c[e]);
6143
6196
  for (let r = 0; r < a.length; r += 1) {
6144
6197
  const c = a[r];
6145
- let d = null, h = Number.POSITIVE_INFINITY;
6198
+ let d = null, l = Number.POSITIVE_INFINITY;
6146
6199
  for (let p = r + 1; p < a.length; p += 1) {
6147
6200
  const m = a[p];
6148
6201
  if (Math.min(c[i], m[i]) - Math.max(c[n], m[n]) < 0) continue;
6149
6202
  const b = m[e] - c[s];
6150
- b < 0 || b < h && (h = b, d = m);
6203
+ b < 0 || b < l && (l = b, d = m);
6151
6204
  }
6152
- if (!d || h === Number.POSITIVE_INFINITY) continue;
6205
+ if (!d || l === Number.POSITIVE_INFINITY) continue;
6153
6206
  const u = Math.max(c[n], d[n]), g = Math.min(c[i], d[i]), f = (u + g) / 2;
6154
6207
  o.push({
6155
6208
  type: t,
@@ -6161,34 +6214,34 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6161
6214
  }
6162
6215
  return o;
6163
6216
  }, So = ({
6164
- bounds: l
6217
+ bounds: h
6165
6218
  }) => {
6166
6219
  const t = Je({
6167
- bounds: l,
6220
+ bounds: h,
6168
6221
  type: "vertical",
6169
6222
  primaryStart: "top",
6170
6223
  primaryEnd: "bottom"
6171
6224
  }), e = Je({
6172
- bounds: l,
6225
+ bounds: h,
6173
6226
  type: "horizontal",
6174
6227
  primaryStart: "left",
6175
6228
  primaryEnd: "right"
6176
6229
  });
6177
6230
  return { vertical: t, horizontal: e };
6178
6231
  }, Ao = ["montage-area", "background", "interaction-blocker"], is = ({
6179
- activeObject: l
6232
+ activeObject: h
6180
6233
  }) => {
6181
6234
  const t = /* @__PURE__ */ new Set();
6182
- return l && (t.add(l), l instanceof k && l.getObjects().forEach((e) => t.add(e))), t;
6235
+ return h && (t.add(h), h instanceof k && h.getObjects().forEach((e) => t.add(e))), t;
6183
6236
  }, as = ({
6184
- object: l,
6237
+ object: h,
6185
6238
  excluded: t,
6186
6239
  ignoredIds: e = Ao
6187
6240
  }) => {
6188
- if (t.has(l)) return !0;
6189
- const { visible: s = !0 } = l;
6241
+ if (t.has(h)) return !0;
6242
+ const { visible: s = !0 } = h;
6190
6243
  if (!s) return !0;
6191
- const { id: o } = l;
6244
+ const { id: o } = h;
6192
6245
  return !!(o && e.includes(o));
6193
6246
  };
6194
6247
  class jo {
@@ -6258,12 +6311,12 @@ class jo {
6258
6311
  activeBounds: n,
6259
6312
  threshold: r,
6260
6313
  anchors: this.anchors
6261
- }), { deltaX: d, deltaY: h, guides: u } = c;
6262
- if (d !== 0 || h !== 0) {
6314
+ }), { deltaX: d, deltaY: l, guides: u } = c;
6315
+ if (d !== 0 || l !== 0) {
6263
6316
  const { left: v = 0, top: b = 0 } = e;
6264
6317
  e.set({
6265
6318
  left: v + d,
6266
- top: b + h
6319
+ top: b + l
6267
6320
  }), e.setCoords(), n = (p = ft({ object: e })) != null ? p : n;
6268
6321
  }
6269
6322
  const g = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => ft({ object: v })).filter((v) => !!v), f = bo({
@@ -6306,12 +6359,12 @@ class jo {
6306
6359
  if (!s) return;
6307
6360
  const o = e != null ? e : this._calculateViewportBounds(), { left: n, right: i, top: a, bottom: r } = o, { viewportTransform: c } = t, d = t.getZoom() || 1;
6308
6361
  s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = pe / d, s.strokeStyle = os, s.setLineDash([4, 4]);
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)
6362
+ for (const l of this.activeGuides)
6363
+ 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();
6364
+ for (const l of this.activeSpacingGuides)
6312
6365
  wo({
6313
6366
  context: s,
6314
- guide: h,
6367
+ guide: l,
6315
6368
  zoom: d
6316
6369
  });
6317
6370
  s.restore();
@@ -6394,10 +6447,10 @@ class jo {
6394
6447
  i = 1,
6395
6448
  a = 0,
6396
6449
  r = 0
6397
- ] = e != null ? e : [], c = (0 - a) / n, d = (0 - r) / i, h = (s - a) / n, u = (o - r) / i;
6450
+ ] = e != null ? e : [], c = (0 - a) / n, d = (0 - r) / i, l = (s - a) / n, u = (o - r) / i;
6398
6451
  return {
6399
6452
  left: c,
6400
- right: h,
6453
+ right: l,
6401
6454
  top: d,
6402
6455
  bottom: u
6403
6456
  };
@@ -6582,49 +6635,49 @@ class Lt {
6582
6635
  centerY: c = 0
6583
6636
  } = t, {
6584
6637
  left: d = 0,
6585
- right: h = 0,
6638
+ right: l = 0,
6586
6639
  top: u = 0,
6587
6640
  bottom: g = 0,
6588
6641
  centerY: f = 0
6589
6642
  } = e, p = Math.max(a, u), m = Math.min(r, g), b = m >= p ? (p + m) / 2 : (c + f) / 2;
6590
6643
  if (d >= i) {
6591
6644
  if (s) return o;
6592
- const C = d - i;
6593
- return C > 0 && o.push({
6645
+ const T = d - i;
6646
+ return T > 0 && o.push({
6594
6647
  type: "horizontal",
6595
6648
  axis: b,
6596
6649
  start: i,
6597
6650
  end: d,
6598
- distance: C
6651
+ distance: T
6599
6652
  }), o;
6600
6653
  }
6601
- if (h <= n) {
6654
+ if (l <= n) {
6602
6655
  if (s) return o;
6603
- const C = n - h;
6604
- return C > 0 && o.push({
6656
+ const T = n - l;
6657
+ return T > 0 && o.push({
6605
6658
  type: "horizontal",
6606
6659
  axis: b,
6607
- start: h,
6660
+ start: l,
6608
6661
  end: n,
6609
- distance: C
6662
+ distance: T
6610
6663
  }), o;
6611
6664
  }
6612
6665
  if (!s) return o;
6613
- const I = n < d, y = i > h, w = Math.min(n, d), A = Math.max(n, d), j = A - w;
6666
+ const I = n < d, y = i > l, M = Math.min(n, d), A = Math.max(n, d), j = A - M;
6614
6667
  j > 0 && !I && o.push({
6615
6668
  type: "horizontal",
6616
6669
  axis: b,
6617
- start: w,
6670
+ start: M,
6618
6671
  end: A,
6619
6672
  distance: j
6620
6673
  });
6621
- const M = Math.min(i, h), T = Math.max(i, h), S = T - M;
6622
- return S > 0 && !y && o.push({
6674
+ const S = Math.min(i, l), C = Math.max(i, l), w = C - S;
6675
+ return w > 0 && !y && o.push({
6623
6676
  type: "horizontal",
6624
6677
  axis: b,
6625
- start: M,
6626
- end: T,
6627
- distance: S
6678
+ start: S,
6679
+ end: C,
6680
+ distance: w
6628
6681
  }), o;
6629
6682
  }
6630
6683
  /**
@@ -6643,49 +6696,49 @@ class Lt {
6643
6696
  centerX: c = 0
6644
6697
  } = t, {
6645
6698
  top: d = 0,
6646
- bottom: h = 0,
6699
+ bottom: l = 0,
6647
6700
  left: u = 0,
6648
6701
  right: g = 0,
6649
6702
  centerX: f = 0
6650
6703
  } = e, p = Math.max(a, u), m = Math.min(r, g), b = m >= p ? (p + m) / 2 : (c + f) / 2;
6651
6704
  if (d >= i) {
6652
6705
  if (s) return o;
6653
- const C = d - i;
6654
- return C > 0 && o.push({
6706
+ const T = d - i;
6707
+ return T > 0 && o.push({
6655
6708
  type: "vertical",
6656
6709
  axis: b,
6657
6710
  start: i,
6658
6711
  end: d,
6659
- distance: C
6712
+ distance: T
6660
6713
  }), o;
6661
6714
  }
6662
- if (h <= n) {
6715
+ if (l <= n) {
6663
6716
  if (s) return o;
6664
- const C = n - h;
6665
- return C > 0 && o.push({
6717
+ const T = n - l;
6718
+ return T > 0 && o.push({
6666
6719
  type: "vertical",
6667
6720
  axis: b,
6668
- start: h,
6721
+ start: l,
6669
6722
  end: n,
6670
- distance: C
6723
+ distance: T
6671
6724
  }), o;
6672
6725
  }
6673
6726
  if (!s) return o;
6674
- const I = n < d, y = i > h, w = Math.min(n, d), A = Math.max(n, d), j = A - w;
6727
+ const I = n < d, y = i > l, M = Math.min(n, d), A = Math.max(n, d), j = A - M;
6675
6728
  j > 0 && !I && o.push({
6676
6729
  type: "vertical",
6677
6730
  axis: b,
6678
- start: w,
6731
+ start: M,
6679
6732
  end: A,
6680
6733
  distance: j
6681
6734
  });
6682
- const M = Math.min(i, h), T = Math.max(i, h), S = T - M;
6683
- return S > 0 && !y && o.push({
6735
+ const S = Math.min(i, l), C = Math.max(i, l), w = C - S;
6736
+ return w > 0 && !y && o.push({
6684
6737
  type: "vertical",
6685
6738
  axis: b,
6686
- start: M,
6687
- end: T,
6688
- distance: S
6739
+ start: S,
6740
+ end: C,
6741
+ distance: w
6689
6742
  }), o;
6690
6743
  }
6691
6744
  /**
@@ -6715,11 +6768,11 @@ class Lt {
6715
6768
  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;
6716
6769
  e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = ts / o, e.strokeStyle = $e, e.setLineDash([]);
6717
6770
  for (const c of this.activeGuides) {
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({
6771
+ 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;
6772
+ e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, g)) : (e.moveTo(u, l), e.lineTo(g, l)), e.stroke(), me({
6720
6773
  context: e,
6721
6774
  type: d,
6722
- axis: h,
6775
+ axis: l,
6723
6776
  start: u,
6724
6777
  end: g,
6725
6778
  text: Math.round(f).toString(),
@@ -6766,7 +6819,7 @@ class Se {
6766
6819
  * @fires editor:ready
6767
6820
  */
6768
6821
  init() {
6769
- return N(this, null, function* () {
6822
+ return x(this, null, function* () {
6770
6823
  var u;
6771
6824
  const {
6772
6825
  editorContainerWidth: t,
@@ -6779,9 +6832,9 @@ class Se {
6779
6832
  initialStateJSON: r,
6780
6833
  scaleType: c,
6781
6834
  showRotationAngle: d,
6782
- _onReadyCallback: h
6835
+ _onReadyCallback: l
6783
6836
  } = this.options;
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) {
6837
+ 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 P({ 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) {
6785
6838
  const {
6786
6839
  source: g,
6787
6840
  scale: f = `image-${c}`,
@@ -6789,7 +6842,7 @@ class Se {
6789
6842
  } = a;
6790
6843
  yield this.imageManager.importImage({ source: g, scale: f, withoutSave: p });
6791
6844
  }
6792
- r && this.historyManager.loadStateFromFullState(r), this.historyManager.saveState(), console.log("editor:ready"), this.canvas.fire("editor:ready", this), typeof h == "function" && h(this);
6845
+ r && this.historyManager.loadStateFromFullState(r), this.historyManager.saveState(), console.log("editor:ready"), this.canvas.fire("editor:ready", this), typeof l == "function" && l(this);
6793
6846
  });
6794
6847
  }
6795
6848
  /**
@@ -6860,7 +6913,7 @@ class Se {
6860
6913
  });
6861
6914
  }
6862
6915
  }
6863
- const E = [
6916
+ const O = [
6864
6917
  "U+0000-00FF",
6865
6918
  "U+0131",
6866
6919
  "U+0152-0153",
@@ -6880,7 +6933,7 @@ const E = [
6880
6933
  "U+2215",
6881
6934
  "U+FEFF",
6882
6935
  "U+FFFD"
6883
- ].join(", "), O = [
6936
+ ].join(", "), L = [
6884
6937
  "U+0301",
6885
6938
  "U+0400-045F",
6886
6939
  "U+0490-0491",
@@ -6903,7 +6956,7 @@ const E = [
6903
6956
  style: "normal",
6904
6957
  weight: "400",
6905
6958
  display: "swap",
6906
- unicodeRange: O
6959
+ unicodeRange: L
6907
6960
  }
6908
6961
  },
6909
6962
  {
@@ -6913,7 +6966,7 @@ const E = [
6913
6966
  style: "normal",
6914
6967
  weight: "400",
6915
6968
  display: "swap",
6916
- unicodeRange: E
6969
+ unicodeRange: O
6917
6970
  }
6918
6971
  },
6919
6972
  {
@@ -6923,7 +6976,7 @@ const E = [
6923
6976
  style: "normal",
6924
6977
  weight: "700",
6925
6978
  display: "swap",
6926
- unicodeRange: O
6979
+ unicodeRange: L
6927
6980
  }
6928
6981
  },
6929
6982
  {
@@ -6933,7 +6986,7 @@ const E = [
6933
6986
  style: "normal",
6934
6987
  weight: "700",
6935
6988
  display: "swap",
6936
- unicodeRange: E
6989
+ unicodeRange: O
6937
6990
  }
6938
6991
  },
6939
6992
  {
@@ -6943,7 +6996,7 @@ const E = [
6943
6996
  style: "normal",
6944
6997
  weight: "200 700",
6945
6998
  display: "swap",
6946
- unicodeRange: O
6999
+ unicodeRange: L
6947
7000
  }
6948
7001
  },
6949
7002
  {
@@ -6953,7 +7006,7 @@ const E = [
6953
7006
  style: "normal",
6954
7007
  weight: "200 700",
6955
7008
  display: "swap",
6956
- unicodeRange: E
7009
+ unicodeRange: O
6957
7010
  }
6958
7011
  },
6959
7012
  {
@@ -6963,7 +7016,7 @@ const E = [
6963
7016
  style: "normal",
6964
7017
  weight: "300 900",
6965
7018
  display: "swap",
6966
- unicodeRange: O
7019
+ unicodeRange: L
6967
7020
  }
6968
7021
  },
6969
7022
  {
@@ -6973,7 +7026,7 @@ const E = [
6973
7026
  style: "normal",
6974
7027
  weight: "300 900",
6975
7028
  display: "swap",
6976
- unicodeRange: E
7029
+ unicodeRange: O
6977
7030
  }
6978
7031
  },
6979
7032
  {
@@ -6983,7 +7036,7 @@ const E = [
6983
7036
  style: "normal",
6984
7037
  weight: "400 700",
6985
7038
  display: "swap",
6986
- unicodeRange: O
7039
+ unicodeRange: L
6987
7040
  }
6988
7041
  },
6989
7042
  {
@@ -6993,7 +7046,7 @@ const E = [
6993
7046
  style: "normal",
6994
7047
  weight: "400 700",
6995
7048
  display: "swap",
6996
- unicodeRange: E
7049
+ unicodeRange: O
6997
7050
  }
6998
7051
  },
6999
7052
  {
@@ -7003,7 +7056,7 @@ const E = [
7003
7056
  style: "normal",
7004
7057
  weight: "300 700",
7005
7058
  display: "swap",
7006
- unicodeRange: O
7059
+ unicodeRange: L
7007
7060
  }
7008
7061
  },
7009
7062
  {
@@ -7013,7 +7066,7 @@ const E = [
7013
7066
  style: "normal",
7014
7067
  weight: "300 700",
7015
7068
  display: "swap",
7016
- unicodeRange: E
7069
+ unicodeRange: O
7017
7070
  }
7018
7071
  },
7019
7072
  {
@@ -7023,7 +7076,7 @@ const E = [
7023
7076
  style: "normal",
7024
7077
  weight: "300 700",
7025
7078
  display: "swap",
7026
- unicodeRange: O
7079
+ unicodeRange: L
7027
7080
  }
7028
7081
  },
7029
7082
  {
@@ -7033,7 +7086,7 @@ const E = [
7033
7086
  style: "normal",
7034
7087
  weight: "300 700",
7035
7088
  display: "swap",
7036
- unicodeRange: E
7089
+ unicodeRange: O
7037
7090
  }
7038
7091
  },
7039
7092
  {
@@ -7043,7 +7096,7 @@ const E = [
7043
7096
  style: "normal",
7044
7097
  weight: "400",
7045
7098
  display: "swap",
7046
- unicodeRange: O
7099
+ unicodeRange: L
7047
7100
  }
7048
7101
  },
7049
7102
  {
@@ -7053,7 +7106,7 @@ const E = [
7053
7106
  style: "normal",
7054
7107
  weight: "400",
7055
7108
  display: "swap",
7056
- unicodeRange: E
7109
+ unicodeRange: O
7057
7110
  }
7058
7111
  },
7059
7112
  {
@@ -7063,7 +7116,7 @@ const E = [
7063
7116
  style: "normal",
7064
7117
  weight: "400 700",
7065
7118
  display: "swap",
7066
- unicodeRange: O
7119
+ unicodeRange: L
7067
7120
  }
7068
7121
  },
7069
7122
  {
@@ -7073,7 +7126,7 @@ const E = [
7073
7126
  style: "normal",
7074
7127
  weight: "400 700",
7075
7128
  display: "swap",
7076
- unicodeRange: E
7129
+ unicodeRange: O
7077
7130
  }
7078
7131
  },
7079
7132
  {
@@ -7083,7 +7136,7 @@ const E = [
7083
7136
  style: "normal",
7084
7137
  weight: "100 900",
7085
7138
  display: "swap",
7086
- unicodeRange: O
7139
+ unicodeRange: L
7087
7140
  }
7088
7141
  },
7089
7142
  {
@@ -7093,7 +7146,7 @@ const E = [
7093
7146
  style: "normal",
7094
7147
  weight: "100 900",
7095
7148
  display: "swap",
7096
- unicodeRange: E
7149
+ unicodeRange: O
7097
7150
  }
7098
7151
  },
7099
7152
  {
@@ -7103,7 +7156,7 @@ const E = [
7103
7156
  style: "normal",
7104
7157
  weight: "400",
7105
7158
  display: "swap",
7106
- unicodeRange: O
7159
+ unicodeRange: L
7107
7160
  }
7108
7161
  },
7109
7162
  {
@@ -7113,7 +7166,7 @@ const E = [
7113
7166
  style: "normal",
7114
7167
  weight: "400",
7115
7168
  display: "swap",
7116
- unicodeRange: E
7169
+ unicodeRange: O
7117
7170
  }
7118
7171
  },
7119
7172
  {
@@ -7123,7 +7176,7 @@ const E = [
7123
7176
  style: "normal",
7124
7177
  weight: "700",
7125
7178
  display: "swap",
7126
- unicodeRange: O
7179
+ unicodeRange: L
7127
7180
  }
7128
7181
  },
7129
7182
  {
@@ -7133,7 +7186,7 @@ const E = [
7133
7186
  style: "normal",
7134
7187
  weight: "700",
7135
7188
  display: "swap",
7136
- unicodeRange: E
7189
+ unicodeRange: O
7137
7190
  }
7138
7191
  },
7139
7192
  {
@@ -7143,7 +7196,7 @@ const E = [
7143
7196
  style: "normal",
7144
7197
  weight: "400 700",
7145
7198
  display: "swap",
7146
- unicodeRange: O
7199
+ unicodeRange: L
7147
7200
  }
7148
7201
  },
7149
7202
  {
@@ -7153,7 +7206,7 @@ const E = [
7153
7206
  style: "normal",
7154
7207
  weight: "400 700",
7155
7208
  display: "swap",
7156
- unicodeRange: E
7209
+ unicodeRange: O
7157
7210
  }
7158
7211
  },
7159
7212
  {
@@ -7163,7 +7216,7 @@ const E = [
7163
7216
  style: "normal",
7164
7217
  weight: "100 900",
7165
7218
  display: "swap",
7166
- unicodeRange: O
7219
+ unicodeRange: L
7167
7220
  }
7168
7221
  },
7169
7222
  {
@@ -7173,7 +7226,7 @@ const E = [
7173
7226
  style: "normal",
7174
7227
  weight: "100 900",
7175
7228
  display: "swap",
7176
- unicodeRange: E
7229
+ unicodeRange: O
7177
7230
  }
7178
7231
  },
7179
7232
  {
@@ -7183,7 +7236,7 @@ const E = [
7183
7236
  style: "normal",
7184
7237
  weight: "100",
7185
7238
  display: "swap",
7186
- unicodeRange: O
7239
+ unicodeRange: L
7187
7240
  }
7188
7241
  },
7189
7242
  {
@@ -7193,7 +7246,7 @@ const E = [
7193
7246
  style: "normal",
7194
7247
  weight: "100",
7195
7248
  display: "swap",
7196
- unicodeRange: E
7249
+ unicodeRange: O
7197
7250
  }
7198
7251
  },
7199
7252
  {
@@ -7203,7 +7256,7 @@ const E = [
7203
7256
  style: "normal",
7204
7257
  weight: "200",
7205
7258
  display: "swap",
7206
- unicodeRange: O
7259
+ unicodeRange: L
7207
7260
  }
7208
7261
  },
7209
7262
  {
@@ -7213,7 +7266,7 @@ const E = [
7213
7266
  style: "normal",
7214
7267
  weight: "200",
7215
7268
  display: "swap",
7216
- unicodeRange: E
7269
+ unicodeRange: O
7217
7270
  }
7218
7271
  },
7219
7272
  {
@@ -7223,7 +7276,7 @@ const E = [
7223
7276
  style: "normal",
7224
7277
  weight: "300",
7225
7278
  display: "swap",
7226
- unicodeRange: O
7279
+ unicodeRange: L
7227
7280
  }
7228
7281
  },
7229
7282
  {
@@ -7233,7 +7286,7 @@ const E = [
7233
7286
  style: "normal",
7234
7287
  weight: "300",
7235
7288
  display: "swap",
7236
- unicodeRange: E
7289
+ unicodeRange: O
7237
7290
  }
7238
7291
  },
7239
7292
  {
@@ -7243,7 +7296,7 @@ const E = [
7243
7296
  style: "normal",
7244
7297
  weight: "400",
7245
7298
  display: "swap",
7246
- unicodeRange: O
7299
+ unicodeRange: L
7247
7300
  }
7248
7301
  },
7249
7302
  {
@@ -7253,7 +7306,7 @@ const E = [
7253
7306
  style: "normal",
7254
7307
  weight: "400",
7255
7308
  display: "swap",
7256
- unicodeRange: E
7309
+ unicodeRange: O
7257
7310
  }
7258
7311
  },
7259
7312
  {
@@ -7263,7 +7316,7 @@ const E = [
7263
7316
  style: "normal",
7264
7317
  weight: "500",
7265
7318
  display: "swap",
7266
- unicodeRange: O
7319
+ unicodeRange: L
7267
7320
  }
7268
7321
  },
7269
7322
  {
@@ -7273,7 +7326,7 @@ const E = [
7273
7326
  style: "normal",
7274
7327
  weight: "500",
7275
7328
  display: "swap",
7276
- unicodeRange: E
7329
+ unicodeRange: O
7277
7330
  }
7278
7331
  },
7279
7332
  {
@@ -7283,7 +7336,7 @@ const E = [
7283
7336
  style: "normal",
7284
7337
  weight: "600",
7285
7338
  display: "swap",
7286
- unicodeRange: O
7339
+ unicodeRange: L
7287
7340
  }
7288
7341
  },
7289
7342
  {
@@ -7293,7 +7346,7 @@ const E = [
7293
7346
  style: "normal",
7294
7347
  weight: "600",
7295
7348
  display: "swap",
7296
- unicodeRange: E
7349
+ unicodeRange: O
7297
7350
  }
7298
7351
  },
7299
7352
  {
@@ -7303,7 +7356,7 @@ const E = [
7303
7356
  style: "normal",
7304
7357
  weight: "700",
7305
7358
  display: "swap",
7306
- unicodeRange: O
7359
+ unicodeRange: L
7307
7360
  }
7308
7361
  },
7309
7362
  {
@@ -7313,7 +7366,7 @@ const E = [
7313
7366
  style: "normal",
7314
7367
  weight: "700",
7315
7368
  display: "swap",
7316
- unicodeRange: E
7369
+ unicodeRange: O
7317
7370
  }
7318
7371
  },
7319
7372
  {
@@ -7323,7 +7376,7 @@ const E = [
7323
7376
  style: "normal",
7324
7377
  weight: "800",
7325
7378
  display: "swap",
7326
- unicodeRange: O
7379
+ unicodeRange: L
7327
7380
  }
7328
7381
  },
7329
7382
  {
@@ -7333,7 +7386,7 @@ const E = [
7333
7386
  style: "normal",
7334
7387
  weight: "800",
7335
7388
  display: "swap",
7336
- unicodeRange: E
7389
+ unicodeRange: O
7337
7390
  }
7338
7391
  },
7339
7392
  {
@@ -7343,7 +7396,7 @@ const E = [
7343
7396
  style: "normal",
7344
7397
  weight: "900",
7345
7398
  display: "swap",
7346
- unicodeRange: O
7399
+ unicodeRange: L
7347
7400
  }
7348
7401
  },
7349
7402
  {
@@ -7353,7 +7406,7 @@ const E = [
7353
7406
  style: "normal",
7354
7407
  weight: "900",
7355
7408
  display: "swap",
7356
- unicodeRange: E
7409
+ unicodeRange: O
7357
7410
  }
7358
7411
  },
7359
7412
  {
@@ -7363,7 +7416,7 @@ const E = [
7363
7416
  style: "normal",
7364
7417
  weight: "400",
7365
7418
  display: "swap",
7366
- unicodeRange: O
7419
+ unicodeRange: L
7367
7420
  }
7368
7421
  },
7369
7422
  {
@@ -7373,7 +7426,7 @@ const E = [
7373
7426
  style: "normal",
7374
7427
  weight: "400",
7375
7428
  display: "swap",
7376
- unicodeRange: E
7429
+ unicodeRange: O
7377
7430
  }
7378
7431
  },
7379
7432
  {
@@ -7383,7 +7436,7 @@ const E = [
7383
7436
  style: "normal",
7384
7437
  weight: "700",
7385
7438
  display: "swap",
7386
- unicodeRange: O
7439
+ unicodeRange: L
7387
7440
  }
7388
7441
  },
7389
7442
  {
@@ -7393,7 +7446,7 @@ const E = [
7393
7446
  style: "normal",
7394
7447
  weight: "700",
7395
7448
  display: "swap",
7396
- unicodeRange: E
7449
+ unicodeRange: O
7397
7450
  }
7398
7451
  },
7399
7452
  {
@@ -7403,7 +7456,7 @@ const E = [
7403
7456
  style: "normal",
7404
7457
  weight: "100 900",
7405
7458
  display: "swap",
7406
- unicodeRange: O
7459
+ unicodeRange: L
7407
7460
  }
7408
7461
  },
7409
7462
  {
@@ -7413,7 +7466,7 @@ const E = [
7413
7466
  style: "normal",
7414
7467
  weight: "100 900",
7415
7468
  display: "swap",
7416
- unicodeRange: E
7469
+ unicodeRange: O
7417
7470
  }
7418
7471
  },
7419
7472
  {
@@ -7423,7 +7476,7 @@ const E = [
7423
7476
  style: "normal",
7424
7477
  weight: "300 700",
7425
7478
  display: "swap",
7426
- unicodeRange: O
7479
+ unicodeRange: L
7427
7480
  }
7428
7481
  },
7429
7482
  {
@@ -7433,7 +7486,7 @@ const E = [
7433
7486
  style: "normal",
7434
7487
  weight: "300 700",
7435
7488
  display: "swap",
7436
- unicodeRange: E
7489
+ unicodeRange: O
7437
7490
  }
7438
7491
  },
7439
7492
  {
@@ -7443,7 +7496,7 @@ const E = [
7443
7496
  style: "normal",
7444
7497
  weight: "400",
7445
7498
  display: "swap",
7446
- unicodeRange: O
7499
+ unicodeRange: L
7447
7500
  }
7448
7501
  },
7449
7502
  {
@@ -7453,7 +7506,7 @@ const E = [
7453
7506
  style: "normal",
7454
7507
  weight: "400",
7455
7508
  display: "swap",
7456
- unicodeRange: E
7509
+ unicodeRange: O
7457
7510
  }
7458
7511
  },
7459
7512
  {
@@ -7463,7 +7516,7 @@ const E = [
7463
7516
  style: "normal",
7464
7517
  weight: "200 800",
7465
7518
  display: "swap",
7466
- unicodeRange: O
7519
+ unicodeRange: L
7467
7520
  }
7468
7521
  },
7469
7522
  {
@@ -7473,7 +7526,7 @@ const E = [
7473
7526
  style: "normal",
7474
7527
  weight: "200 800",
7475
7528
  display: "swap",
7476
- unicodeRange: E
7529
+ unicodeRange: O
7477
7530
  }
7478
7531
  },
7479
7532
  {
@@ -7483,7 +7536,7 @@ const E = [
7483
7536
  style: "normal",
7484
7537
  weight: "100 900",
7485
7538
  display: "swap",
7486
- unicodeRange: O
7539
+ unicodeRange: L
7487
7540
  }
7488
7541
  },
7489
7542
  {
@@ -7493,7 +7546,7 @@ const E = [
7493
7546
  style: "normal",
7494
7547
  weight: "100 900",
7495
7548
  display: "swap",
7496
- unicodeRange: E
7549
+ unicodeRange: O
7497
7550
  }
7498
7551
  },
7499
7552
  {
@@ -7503,7 +7556,7 @@ const E = [
7503
7556
  style: "normal",
7504
7557
  weight: "400",
7505
7558
  display: "swap",
7506
- unicodeRange: O
7559
+ unicodeRange: L
7507
7560
  }
7508
7561
  },
7509
7562
  {
@@ -7513,7 +7566,7 @@ const E = [
7513
7566
  style: "normal",
7514
7567
  weight: "400",
7515
7568
  display: "swap",
7516
- unicodeRange: E
7569
+ unicodeRange: O
7517
7570
  }
7518
7571
  },
7519
7572
  {
@@ -7523,7 +7576,7 @@ const E = [
7523
7576
  style: "normal",
7524
7577
  weight: "100 900",
7525
7578
  display: "swap",
7526
- unicodeRange: O
7579
+ unicodeRange: L
7527
7580
  }
7528
7581
  },
7529
7582
  {
@@ -7533,7 +7586,7 @@ const E = [
7533
7586
  style: "normal",
7534
7587
  weight: "100 900",
7535
7588
  display: "swap",
7536
- unicodeRange: E
7589
+ unicodeRange: O
7537
7590
  }
7538
7591
  },
7539
7592
  {
@@ -7543,7 +7596,7 @@ const E = [
7543
7596
  style: "normal",
7544
7597
  weight: "300 800",
7545
7598
  display: "swap",
7546
- unicodeRange: O
7599
+ unicodeRange: L
7547
7600
  }
7548
7601
  },
7549
7602
  {
@@ -7553,7 +7606,7 @@ const E = [
7553
7606
  style: "normal",
7554
7607
  weight: "300 800",
7555
7608
  display: "swap",
7556
- unicodeRange: E
7609
+ unicodeRange: O
7557
7610
  }
7558
7611
  },
7559
7612
  {
@@ -7563,7 +7616,7 @@ const E = [
7563
7616
  style: "normal",
7564
7617
  weight: "400",
7565
7618
  display: "swap",
7566
- unicodeRange: O
7619
+ unicodeRange: L
7567
7620
  }
7568
7621
  },
7569
7622
  {
@@ -7573,7 +7626,7 @@ const E = [
7573
7626
  style: "normal",
7574
7627
  weight: "400",
7575
7628
  display: "swap",
7576
- unicodeRange: E
7629
+ unicodeRange: O
7577
7630
  }
7578
7631
  },
7579
7632
  {
@@ -7583,7 +7636,7 @@ const E = [
7583
7636
  style: "normal",
7584
7637
  weight: "700",
7585
7638
  display: "swap",
7586
- unicodeRange: O
7639
+ unicodeRange: L
7587
7640
  }
7588
7641
  },
7589
7642
  {
@@ -7593,7 +7646,7 @@ const E = [
7593
7646
  style: "normal",
7594
7647
  weight: "700",
7595
7648
  display: "swap",
7596
- unicodeRange: E
7649
+ unicodeRange: O
7597
7650
  }
7598
7651
  },
7599
7652
  {
@@ -7603,7 +7656,7 @@ const E = [
7603
7656
  style: "normal",
7604
7657
  weight: "300 900",
7605
7658
  display: "swap",
7606
- unicodeRange: O
7659
+ unicodeRange: L
7607
7660
  }
7608
7661
  },
7609
7662
  {
@@ -7613,7 +7666,7 @@ const E = [
7613
7666
  style: "normal",
7614
7667
  weight: "300 900",
7615
7668
  display: "swap",
7616
- unicodeRange: E
7669
+ unicodeRange: O
7617
7670
  }
7618
7671
  },
7619
7672
  {
@@ -7623,7 +7676,7 @@ const E = [
7623
7676
  style: "normal",
7624
7677
  weight: "400",
7625
7678
  display: "swap",
7626
- unicodeRange: O
7679
+ unicodeRange: L
7627
7680
  }
7628
7681
  },
7629
7682
  {
@@ -7633,7 +7686,7 @@ const E = [
7633
7686
  style: "normal",
7634
7687
  weight: "400",
7635
7688
  display: "swap",
7636
- unicodeRange: E
7689
+ unicodeRange: O
7637
7690
  }
7638
7691
  },
7639
7692
  {
@@ -7643,7 +7696,7 @@ const E = [
7643
7696
  style: "normal",
7644
7697
  weight: "100 900",
7645
7698
  display: "swap",
7646
- unicodeRange: O
7699
+ unicodeRange: L
7647
7700
  }
7648
7701
  },
7649
7702
  {
@@ -7653,7 +7706,7 @@ const E = [
7653
7706
  style: "normal",
7654
7707
  weight: "100 900",
7655
7708
  display: "swap",
7656
- unicodeRange: E
7709
+ unicodeRange: O
7657
7710
  }
7658
7711
  },
7659
7712
  {
@@ -7663,7 +7716,7 @@ const E = [
7663
7716
  style: "normal",
7664
7717
  weight: "100 900",
7665
7718
  display: "swap",
7666
- unicodeRange: O
7719
+ unicodeRange: L
7667
7720
  }
7668
7721
  },
7669
7722
  {
@@ -7673,7 +7726,7 @@ const E = [
7673
7726
  style: "normal",
7674
7727
  weight: "100 900",
7675
7728
  display: "swap",
7676
- unicodeRange: E
7729
+ unicodeRange: O
7677
7730
  }
7678
7731
  }
7679
7732
  ], Co = {
@@ -7770,15 +7823,15 @@ const E = [
7770
7823
  */
7771
7824
  fonts: Io
7772
7825
  };
7773
- function Do(l, t = {}) {
7774
- const e = _(_({}, Co), t), s = document.getElementById(l);
7826
+ function Do(h, t = {}) {
7827
+ const e = N(N({}, Co), t), s = document.getElementById(h);
7775
7828
  if (!s)
7776
- return Promise.reject(new Error(`Контейнер с ID "${l}" не найден.`));
7829
+ return Promise.reject(new Error(`Контейнер с ID "${h}" не найден.`));
7777
7830
  const o = document.createElement("canvas");
7778
- return o.id = `${l}-canvas`, s.appendChild(o), e.editorContainer = s, new Promise((n) => {
7831
+ return o.id = `${h}-canvas`, s.appendChild(o), e.editorContainer = s, new Promise((n) => {
7779
7832
  e._onReadyCallback = n;
7780
7833
  const i = new Se(o.id, e);
7781
- window[l] = i;
7834
+ window[h] = i;
7782
7835
  });
7783
7836
  }
7784
7837
  export {