@anu3ev/fabric-image-editor 0.5.27 → 0.5.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +1018 -943
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,22 +1,22 @@
1
- var bn = Object.defineProperty, Mn = Object.defineProperties;
2
- var Sn = Object.getOwnPropertyDescriptors;
1
+ var Mn = Object.defineProperty, Sn = Object.defineProperties;
2
+ var wn = Object.getOwnPropertyDescriptors;
3
3
  var oe = Object.getOwnPropertySymbols;
4
- var Pe = Object.prototype.hasOwnProperty, Fe = Object.prototype.propertyIsEnumerable;
5
- var ze = (d, t, e) => t in d ? bn(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e, L = (d, t) => {
4
+ var Ue = Object.prototype.hasOwnProperty, Ye = Object.prototype.propertyIsEnumerable;
5
+ var We = (d, t, e) => t in d ? Mn(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e, x = (d, t) => {
6
6
  for (var e in t || (t = {}))
7
- Pe.call(t, e) && ze(d, e, t[e]);
7
+ Ue.call(t, e) && We(d, e, t[e]);
8
8
  if (oe)
9
9
  for (var e of oe(t))
10
- Fe.call(t, e) && ze(d, e, t[e]);
10
+ Ye.call(t, e) && We(d, e, t[e]);
11
11
  return d;
12
- }, It = (d, t) => Mn(d, Sn(t));
12
+ }, It = (d, t) => Sn(d, wn(t));
13
13
  var Mt = (d, t) => {
14
14
  var e = {};
15
15
  for (var n in d)
16
- Pe.call(d, n) && t.indexOf(n) < 0 && (e[n] = d[n]);
16
+ Ue.call(d, n) && t.indexOf(n) < 0 && (e[n] = d[n]);
17
17
  if (d != null && oe)
18
18
  for (var n of oe(d))
19
- t.indexOf(n) < 0 && Fe.call(d, n) && (e[n] = d[n]);
19
+ t.indexOf(n) < 0 && Ye.call(d, n) && (e[n] = d[n]);
20
20
  return e;
21
21
  };
22
22
  var Z = (d, t, e) => new Promise((n, s) => {
@@ -35,16 +35,16 @@ var Z = (d, t, e) => new Promise((n, s) => {
35
35
  }, a = (r) => r.done ? n(r.value) : Promise.resolve(r.value).then(o, i);
36
36
  a((e = e.apply(d, t)).next());
37
37
  });
38
- import { ActiveSelection as X, Textbox as dt, util as yt, controlsUtils as Ue, InteractiveFabricObject as We, Point as at, FitContentLayout as Ye, loadSVGFromURL as wn, FabricImage as Xt, Gradient as He, Rect as An, Circle as jn, Triangle as In, Group as Nt, Color as Cn, classRegistry as Ze, loadSVGFromString as Tn, Canvas as On, Pattern as En } from "fabric";
39
- import { create as Ln } from "jsondiffpatch";
40
- import Dn from "diff-match-patch";
41
- var _n = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", $ = function() {
38
+ import { ActiveSelection as X, Textbox as dt, util as yt, controlsUtils as He, InteractiveFabricObject as Ze, Point as at, FitContentLayout as Ge, loadSVGFromURL as An, FabricImage as Xt, Gradient as Ve, Rect as jn, Circle as In, Triangle as Cn, Group as Nt, Color as Tn, classRegistry as Xe, loadSVGFromString as On, Canvas as En, Pattern as Ln } from "fabric";
39
+ import { create as Dn } from "jsondiffpatch";
40
+ import _n from "diff-match-patch";
41
+ var xn = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", tt = function() {
42
42
  for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21, e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0)); t--; )
43
- e += _n[n[t] & 63];
43
+ e += xn[n[t] & 63];
44
44
  return e;
45
45
  };
46
- const Ge = 300;
47
- class Le {
46
+ const Ke = 300;
47
+ class xe {
48
48
  /**
49
49
  * Конструктор принимает редактор и опции.
50
50
  * @param params
@@ -62,7 +62,7 @@ class Le {
62
62
  * @param params.options.adaptCanvasToContainerOnResize — адаптировать канвас к размерам контейнера при изменении размеров окна
63
63
  */
64
64
  constructor({ editor: t, options: e = {} }) {
65
- this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, this.savedSelection = [], this.canvasDragging = !1, this.mouseWheelZooming = !1, this.bringToFrontOnSelection = !1, this.resetObjectFitByDoubleClick = !1, this.copyObjectsByHotkey = !1, this.pasteImageFromClipboard = !1, this.undoRedoByHotKeys = !1, this.selectAllByHotkey = !1, this.deleteObjectsByHotkey = !1, this.adaptCanvasToContainerOnResize = !1, this.editor = t, this.canvas = t.canvas, this.options = e, this.handleContainerResizeBound = Le.debounce(this.handleContainerResize.bind(this), 500), this.handleCopyEventBound = this.handleCopyEvent.bind(this), this.handlePasteEventBound = this.handlePasteEvent.bind(this), this.handleUndoRedoEventBound = this.handleUndoRedoEvent.bind(this), this.handleUndoRedoKeyUpBound = this.handleUndoRedoKeyUp.bind(this), this.handleSelectAllEventBound = this.handleSelectAllEvent.bind(this), this.handleDeleteObjectsEventBound = this.handleDeleteObjectsEvent.bind(this), this.handleSpaceKeyDownBound = this.handleSpaceKeyDown.bind(this), this.handleSpaceKeyUpBound = this.handleSpaceKeyUp.bind(this), this.handleObjectModifiedHistoryBound = this.handleObjectModifiedHistory.bind(this), this.handleObjectRotatingHistoryBound = this.handleObjectRotatingHistory.bind(this), this.handleObjectTransformStartBound = this.handleObjectTransformStart.bind(this), this.handleObjectTransformEndBound = this.handleObjectTransformEnd.bind(this), this.handleObjectAddedHistoryBound = this.handleObjectAddedHistory.bind(this), this.handleObjectRemovedHistoryBound = this.handleObjectRemovedHistory.bind(this), this.handleOverlayUpdateBound = this.handleOverlayUpdate.bind(this), this.handleBackgroundUpdateBound = this.handleBackgroundUpdate.bind(this), this.handleCanvasDragStartBound = this.handleCanvasDragStart.bind(this), this.handleCanvasDraggingBound = this.handleCanvasDragging.bind(this), this.handleCanvasDragEndBound = this.handleCanvasDragEnd.bind(this), this.handleMouseWheelZoomBound = this.handleMouseWheelZoom.bind(this), this.handleBringToFrontBound = this.handleBringToFront.bind(this), this.handleResetObjectFitBound = this.handleResetObjectFit.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.init();
65
+ this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, this.savedSelection = [], this.canvasDragging = !1, this.mouseWheelZooming = !1, this.bringToFrontOnSelection = !1, this.resetObjectFitByDoubleClick = !1, this.copyObjectsByHotkey = !1, this.pasteImageFromClipboard = !1, this.undoRedoByHotKeys = !1, this.selectAllByHotkey = !1, this.deleteObjectsByHotkey = !1, this.adaptCanvasToContainerOnResize = !1, this.editor = t, this.canvas = t.canvas, this.options = e, this.handleContainerResizeBound = xe.debounce(this.handleContainerResize.bind(this), 500), this.handleCopyEventBound = this.handleCopyEvent.bind(this), this.handlePasteEventBound = this.handlePasteEvent.bind(this), this.handleUndoRedoEventBound = this.handleUndoRedoEvent.bind(this), this.handleUndoRedoKeyUpBound = this.handleUndoRedoKeyUp.bind(this), this.handleSelectAllEventBound = this.handleSelectAllEvent.bind(this), this.handleDeleteObjectsEventBound = this.handleDeleteObjectsEvent.bind(this), this.handleSpaceKeyDownBound = this.handleSpaceKeyDown.bind(this), this.handleSpaceKeyUpBound = this.handleSpaceKeyUp.bind(this), this.handleObjectModifiedHistoryBound = this.handleObjectModifiedHistory.bind(this), this.handleObjectRotatingHistoryBound = this.handleObjectRotatingHistory.bind(this), this.handleObjectTransformStartBound = this.handleObjectTransformStart.bind(this), this.handleObjectTransformEndBound = this.handleObjectTransformEnd.bind(this), this.handleObjectAddedHistoryBound = this.handleObjectAddedHistory.bind(this), this.handleObjectRemovedHistoryBound = this.handleObjectRemovedHistory.bind(this), this.handleOverlayUpdateBound = this.handleOverlayUpdate.bind(this), this.handleBackgroundUpdateBound = this.handleBackgroundUpdate.bind(this), this.handleCanvasDragStartBound = this.handleCanvasDragStart.bind(this), this.handleCanvasDraggingBound = this.handleCanvasDragging.bind(this), this.handleCanvasDragEndBound = this.handleCanvasDragEnd.bind(this), this.handleMouseWheelZoomBound = this.handleMouseWheelZoom.bind(this), this.handleBringToFrontBound = this.handleBringToFront.bind(this), this.handleResetObjectFitBound = this.handleResetObjectFit.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.init();
66
66
  }
67
67
  /**
68
68
  * Инициализация всех обработчиков согласно опциям.
@@ -123,14 +123,14 @@ class Le {
123
123
  handleObjectModifiedHistory() {
124
124
  const { historyManager: t, textManager: e } = this.editor;
125
125
  t.skipHistory || e.isTextEditingActive || t.scheduleSaveState({
126
- delayMs: Ge,
126
+ delayMs: Ke,
127
127
  reason: "object-modified"
128
128
  });
129
129
  }
130
130
  handleObjectRotatingHistory() {
131
131
  const { historyManager: t, textManager: e } = this.editor;
132
132
  t.skipHistory || e.isTextEditingActive || t.scheduleSaveState({
133
- delayMs: Ge,
133
+ delayMs: Ke,
134
134
  reason: "object-rotating"
135
135
  });
136
136
  }
@@ -431,7 +431,7 @@ class Le {
431
431
  };
432
432
  }
433
433
  }
434
- class xn {
434
+ class Rn {
435
435
  /**
436
436
  * Класс для динамической загрузки внешних модулей.
437
437
  */
@@ -449,7 +449,7 @@ class xn {
449
449
  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}"`));
450
450
  }
451
451
  }
452
- function Rn(d) {
452
+ function kn(d) {
453
453
  return new Worker(
454
454
  "" + new URL("assets/worker-CN39s7P7.js", import.meta.url).href,
455
455
  {
@@ -457,13 +457,13 @@ function Rn(d) {
457
457
  }
458
458
  );
459
459
  }
460
- class kn {
460
+ class Nn {
461
461
  /**
462
462
  * @param scriptUrl — URL скрипта воркера.
463
463
  * По-умолчанию использует DefaultWorker из соседнего файла
464
464
  */
465
465
  constructor(t) {
466
- t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new Rn(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
466
+ t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new kn(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
467
467
  }
468
468
  /**
469
469
  * Обработчик сообщений от воркера
@@ -491,7 +491,7 @@ class kn {
491
491
  * @returns Promise, который будет выполнен, когда воркер вернет ответ
492
492
  */
493
493
  post(t, e, n = []) {
494
- const s = `${t}:${$(8)}`;
494
+ const s = `${t}:${tt(8)}`;
495
495
  return new Promise((o, i) => {
496
496
  this._callbacks.set(s, { resolve: o, reject: i }), this.worker.postMessage({ action: t, payload: e, requestId: s }, n);
497
497
  });
@@ -503,26 +503,26 @@ class kn {
503
503
  this.worker.terminate();
504
504
  }
505
505
  }
506
- const pt = 12, Nn = 2, we = 8, Ae = 20, Bn = 100, je = 20, Ie = 8, zn = 100, he = 32, De = 1, Pn = "#2B2D33", _e = "#3D8BF4", xe = "#FFFFFF";
506
+ const pt = 12, Bn = 2, Ae = 8, je = 20, zn = 100, Ie = 20, Ce = 8, Pn = 100, he = 32, Re = 1, Fn = "#2B2D33", ke = "#3D8BF4", Ne = "#FFFFFF";
507
507
  function ae(d, t, e, n, s) {
508
- const o = pt, i = Nn;
509
- d.save(), d.translate(t, e), d.rotate(yt.degreesToRadians(s.angle)), d.fillStyle = xe, d.strokeStyle = _e, d.lineWidth = De, d.beginPath(), d.roundRect(-o / 2, -o / 2, o, o, i), d.fill(), d.stroke(), d.restore();
508
+ const o = pt, i = Bn;
509
+ d.save(), d.translate(t, e), d.rotate(yt.degreesToRadians(s.angle)), d.fillStyle = Ne, d.strokeStyle = ke, d.lineWidth = Re, d.beginPath(), d.roundRect(-o / 2, -o / 2, o, o, i), d.fill(), d.stroke(), d.restore();
510
510
  }
511
- function Ve(d, t, e, n, s) {
512
- const o = we, i = Ae, a = Bn;
513
- d.save(), d.translate(t, e), d.rotate(yt.degreesToRadians(s.angle)), d.fillStyle = xe, d.strokeStyle = _e, d.lineWidth = De, d.beginPath(), d.roundRect(-o / 2, -i / 2, o, i, a), d.fill(), d.stroke(), d.restore();
511
+ function qe(d, t, e, n, s) {
512
+ const o = Ae, i = je, a = zn;
513
+ d.save(), d.translate(t, e), d.rotate(yt.degreesToRadians(s.angle)), d.fillStyle = Ne, d.strokeStyle = ke, d.lineWidth = Re, d.beginPath(), d.roundRect(-o / 2, -i / 2, o, i, a), d.fill(), d.stroke(), d.restore();
514
514
  }
515
- function Xe(d, t, e, n, s) {
516
- const o = je, i = Ie, a = zn;
517
- d.save(), d.translate(t, e), d.rotate(yt.degreesToRadians(s.angle)), d.fillStyle = xe, d.strokeStyle = _e, d.lineWidth = De, d.beginPath(), d.roundRect(-o / 2, -i / 2, o, i, a), d.fill(), d.stroke(), d.restore();
515
+ function Je(d, t, e, n, s) {
516
+ const o = Ie, i = Ce, a = Pn;
517
+ d.save(), d.translate(t, e), d.rotate(yt.degreesToRadians(s.angle)), d.fillStyle = Ne, d.strokeStyle = ke, d.lineWidth = Re, d.beginPath(), d.roundRect(-o / 2, -i / 2, o, i, a), d.fill(), d.stroke(), d.restore();
518
518
  }
519
- const Fn = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", gn = new Image();
520
- gn.src = Fn;
519
+ const Wn = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", pn = new Image();
520
+ pn.src = Wn;
521
521
  function Un(d, t, e, n, s) {
522
522
  const i = he / 2;
523
- d.save(), d.translate(t, e), d.rotate(yt.degreesToRadians(s.angle)), d.fillStyle = Pn, d.beginPath(), d.arc(0, 0, i, 0, 2 * Math.PI), d.fill(), d.drawImage(gn, -i / 2, -i / 2, i, i), d.restore();
523
+ d.save(), d.translate(t, e), d.rotate(yt.degreesToRadians(s.angle)), d.fillStyle = Fn, d.beginPath(), d.arc(0, 0, i, 0, 2 * Math.PI), d.fill(), d.drawImage(pn, -i / 2, -i / 2, i, i), d.restore();
524
524
  }
525
- const Wn = {
525
+ const Yn = {
526
526
  // Угловые точки
527
527
  tl: {
528
528
  render: ae,
@@ -554,31 +554,31 @@ const Wn = {
554
554
  },
555
555
  // Середина вертикалей
556
556
  ml: {
557
- render: Ve,
558
- sizeX: we,
559
- sizeY: Ae,
557
+ render: qe,
558
+ sizeX: Ae,
559
+ sizeY: je,
560
560
  offsetX: 0,
561
561
  offsetY: 0
562
562
  },
563
563
  mr: {
564
- render: Ve,
565
- sizeX: we,
566
- sizeY: Ae,
564
+ render: qe,
565
+ sizeX: Ae,
566
+ sizeY: je,
567
567
  offsetX: 0,
568
568
  offsetY: 0
569
569
  },
570
570
  // Середина горизонталей
571
571
  mt: {
572
- render: Xe,
573
- sizeX: je,
574
- sizeY: Ie,
572
+ render: Je,
573
+ sizeX: Ie,
574
+ sizeY: Ce,
575
575
  offsetX: 0,
576
576
  offsetY: 0
577
577
  },
578
578
  mb: {
579
- render: Xe,
580
- sizeX: je,
581
- sizeY: Ie,
579
+ render: Je,
580
+ sizeX: Ie,
581
+ sizeY: Ce,
582
582
  offsetX: 0,
583
583
  offsetY: 0
584
584
  },
@@ -607,7 +607,7 @@ class lt {
607
607
  * Применяет конфигурацию контролов к набору по ключам из DEFAULT_CONTROLS.
608
608
  */
609
609
  static applyControlOverrides(t) {
610
- Object.entries(Wn).forEach(([e, n]) => {
610
+ Object.entries(Yn).forEach(([e, n]) => {
611
611
  const s = t[e];
612
612
  s && (Object.assign(s, n), e === "mtr" && (s.cursorStyle = "grab", s.mouseDownHandler = (o, i, a, r) => {
613
613
  var l;
@@ -620,10 +620,10 @@ class lt {
620
620
  * Регистрирует контролы и настройки поведения выделений.
621
621
  */
622
622
  static apply() {
623
- const t = Ue.createObjectDefaultControls();
624
- lt.applyControlOverrides(t), We.ownDefaults.controls = t;
625
- const e = Ue.createTextboxDefaultControls();
626
- lt.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), lt.wrapWidthControl(e.ml), lt.wrapWidthControl(e.mr), dt.ownDefaults.controls = e, lt.patchActiveSelectionBounds(), We.ownDefaults.snapAngle = 1;
623
+ const t = He.createObjectDefaultControls();
624
+ lt.applyControlOverrides(t), Ze.ownDefaults.controls = t;
625
+ const e = He.createTextboxDefaultControls();
626
+ lt.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), lt.wrapWidthControl(e.ml), lt.wrapWidthControl(e.mr), dt.ownDefaults.controls = e, lt.patchActiveSelectionBounds(), Ze.ownDefaults.snapAngle = 1;
627
627
  }
628
628
  /**
629
629
  * Обновляет алгоритм расчёта границ ActiveSelection, чтобы учитывать фон и отступы текстовых объектов.
@@ -631,8 +631,8 @@ class lt {
631
631
  static patchActiveSelectionBounds() {
632
632
  const t = X.prototype, e = t._calcBoundsFromObjects;
633
633
  t._calcBoundsFromObjects = function(...o) {
634
- var f, g;
635
- const i = (g = (f = this.getObjects) == null ? void 0 : f.call(this)) != null ? g : [];
634
+ var f, p;
635
+ const i = (p = (f = this.getObjects) == null ? void 0 : f.call(this)) != null ? p : [];
636
636
  lt.applyTextSelectionScalingLock({
637
637
  selection: this,
638
638
  objects: i
@@ -654,8 +654,8 @@ class lt {
654
654
  };
655
655
  const n = t._onAfterObjectsChange;
656
656
  t._onAfterObjectsChange = function(o, i) {
657
- var m, p;
658
- const a = n ? n.call(this, o, i) : void 0, r = (p = (m = this.getObjects) == null ? void 0 : m.call(this)) != null ? p : [];
657
+ var m, g;
658
+ const a = n ? n.call(this, o, i) : void 0, r = (g = (m = this.getObjects) == null ? void 0 : m.call(this)) != null ? g : [];
659
659
  lt.applyTextSelectionScalingLock({
660
660
  selection: this,
661
661
  objects: r
@@ -664,14 +664,14 @@ class lt {
664
664
  objects: r
665
665
  });
666
666
  if (!c) return a;
667
- const { left: l, top: h, width: u, height: f } = c, g = new at(l + u / 2, h + f / 2);
667
+ const { left: l, top: h, width: u, height: f } = c, p = new at(l + u / 2, h + f / 2);
668
668
  return this.set({
669
669
  width: u,
670
670
  height: f
671
- }), this.setPositionByOrigin(g, "center", "center"), this.setCoords(), a;
671
+ }), this.setPositionByOrigin(p, "center", "center"), this.setCoords(), a;
672
672
  };
673
- const s = Ye.prototype.calcBoundingBox;
674
- Ye.prototype.calcBoundingBox = function(o, i) {
673
+ const s = Ge.prototype.calcBoundingBox;
674
+ Ge.prototype.calcBoundingBox = function(o, i) {
675
675
  const { target: a, type: r, overrides: c } = i;
676
676
  if (r === "imperative" && c)
677
677
  return c;
@@ -684,13 +684,13 @@ class lt {
684
684
  const l = lt.calculateActiveSelectionBounds({ objects: o });
685
685
  if (!l)
686
686
  return s.call(this, o, i);
687
- const { left: h, top: u, width: f, height: g } = l, m = new at(f, g), p = new at(h + f / 2, u + g / 2);
687
+ const { left: h, top: u, width: f, height: p } = l, m = new at(f, p), g = new at(h + f / 2, u + p / 2);
688
688
  return r === "initialization" ? {
689
- center: p,
689
+ center: g,
690
690
  relativeCorrection: new at(0, 0),
691
691
  size: m
692
692
  } : {
693
- center: p,
693
+ center: g,
694
694
  size: m
695
695
  };
696
696
  };
@@ -894,8 +894,8 @@ V.registeredFontKeys = /* @__PURE__ */ new Set(), V.descriptorDefaults = {
894
894
  featureSettings: "normal",
895
895
  display: "auto"
896
896
  };
897
- let Ce = V;
898
- const Yn = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Hn = "data:image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1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Kt = {
899
899
  style: {
900
900
  position: "absolute",
901
901
  display: "none",
@@ -962,14 +962,14 @@ const Yn = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
962
962
  ],
963
963
  offsetTop: 50,
964
964
  icons: {
965
- copyPaste: Yn,
966
- delete: qn,
967
- lock: Hn,
968
- unlock: Zn,
969
- bringToFront: Xn,
970
- sendToBack: Kn,
971
- bringForward: Gn,
972
- sendBackwards: Vn
965
+ copyPaste: Hn,
966
+ delete: Jn,
967
+ lock: Zn,
968
+ unlock: Gn,
969
+ bringToFront: Kn,
970
+ sendToBack: qn,
971
+ bringForward: Vn,
972
+ sendBackwards: Xn
973
973
  },
974
974
  handlers: {
975
975
  copyPaste: (d) => Z(null, null, function* () {
@@ -998,18 +998,18 @@ const Yn = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
998
998
  }
999
999
  }
1000
1000
  };
1001
- class Jn {
1001
+ class Qn {
1002
1002
  constructor({ editor: t }) {
1003
1003
  this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._initToolbar();
1004
1004
  }
1005
1005
  _initToolbar() {
1006
1006
  if (!this.options.showToolbar) return;
1007
1007
  const t = this.options.toolbar || {};
1008
- this.config = It(L(L({}, Kt), t), {
1009
- style: L(L({}, Kt.style), t.style || {}),
1010
- btnStyle: L(L({}, Kt.btnStyle), t.btnStyle || {}),
1011
- icons: L(L({}, Kt.icons), t.icons || {}),
1012
- handlers: L(L({}, Kt.handlers), t.handlers || {})
1008
+ this.config = It(x(x({}, Kt), t), {
1009
+ style: x(x({}, Kt.style), t.style || {}),
1010
+ btnStyle: x(x({}, Kt.btnStyle), t.btnStyle || {}),
1011
+ icons: x(x({}, Kt.icons), t.icons || {}),
1012
+ handlers: x(x({}, Kt.handlers), t.handlers || {})
1013
1013
  }), 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 = () => {
1014
1014
  this.el.style.display = "none";
1015
1015
  }, this._createDOM(), this._bindEvents();
@@ -1112,10 +1112,10 @@ class Jn {
1112
1112
  }
1113
1113
  const { el: e, config: n, canvas: s } = this;
1114
1114
  t.setCoords();
1115
- const o = s.getZoom(), [, , , , i, a] = s.viewportTransform, { x: r } = t.getCenterPoint(), { top: c, height: l } = t.getBoundingRect(), u = r * o + i - e.offsetWidth / 2, f = n.offsetTop || 0, g = (c + l) * o + a + f;
1115
+ const o = s.getZoom(), [, , , , i, a] = s.viewportTransform, { x: r } = t.getCenterPoint(), { top: c, height: l } = t.getBoundingRect(), u = r * o + i - e.offsetWidth / 2, f = n.offsetTop || 0, p = (c + l) * o + a + f;
1116
1116
  Object.assign(e.style, {
1117
1117
  left: `${u}px`,
1118
- top: `${g}px`,
1118
+ top: `${p}px`,
1119
1119
  display: "flex"
1120
1120
  });
1121
1121
  }
@@ -1126,7 +1126,7 @@ class Jn {
1126
1126
  this.el.removeEventListener("mouseover", this._onBtnOver), this.el.removeEventListener("mouseout", this._onBtnOut), this.canvas.off("mouse:down", this._onMouseDown), this.canvas.off("object:moving", this._onObjectMoving), this.canvas.off("object:scaling", this._onObjectScaling), this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:created", this._onSelectionChange), this.canvas.off("selection:updated", this._onSelectionChange), this.canvas.off("after:render", this._onSelectionChange), this.canvas.off("selection:cleared", this._onSelectionClear), this.el.remove();
1127
1127
  }
1128
1128
  }
1129
- const Qn = {
1129
+ const $n = {
1130
1130
  position: "absolute",
1131
1131
  display: "none",
1132
1132
  background: "#2B2D33",
@@ -1140,8 +1140,8 @@ const Qn = {
1140
1140
  "pointer-events": "none",
1141
1141
  "white-space": "nowrap",
1142
1142
  "box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
1143
- }, Ke = 16, qe = 16, $n = "fabric-editor-angle-indicator";
1144
- class Re {
1143
+ }, Qe = 16, $e = 16, ts = "fabric-editor-angle-indicator";
1144
+ class Be {
1145
1145
  constructor({ editor: t }) {
1146
1146
  this.isActive = !1, this.currentAngle = 0, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._createDOM(), this._bindEvents();
1147
1147
  }
@@ -1149,7 +1149,7 @@ class Re {
1149
1149
  * Создание DOM-элемента индикатора
1150
1150
  */
1151
1151
  _createDOM() {
1152
- this.el = document.createElement("div"), this.el.className = $n, Object.entries(Qn).forEach(([t, e]) => {
1152
+ this.el = document.createElement("div"), this.el.className = ts, Object.entries($n).forEach(([t, e]) => {
1153
1153
  this.el.style.setProperty(t, e);
1154
1154
  }), this.canvas.wrapperEl.appendChild(this.el);
1155
1155
  }
@@ -1169,7 +1169,7 @@ class Re {
1169
1169
  return;
1170
1170
  }
1171
1171
  const n = e.angle || 0;
1172
- this.currentAngle = Re._normalizeAngle(n), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
1172
+ this.currentAngle = Be._normalizeAngle(n), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
1173
1173
  }
1174
1174
  /**
1175
1175
  * Обработчик отпускания кнопки мыши
@@ -1200,9 +1200,9 @@ class Re {
1200
1200
  */
1201
1201
  _positionIndicator(t) {
1202
1202
  const e = this.canvas.wrapperEl.getBoundingClientRect();
1203
- let n = t.clientX - e.left + Ke, s = t.clientY - e.top + qe;
1203
+ let n = t.clientX - e.left + Qe, s = t.clientY - e.top + $e;
1204
1204
  const o = this.el.getBoundingClientRect(), i = o.width, a = o.height;
1205
- n + i > e.width && (n = t.clientX - e.left - i - Ke), s + a > e.height && (s = t.clientY - e.top - a - qe), this.el.style.left = `${n}px`, this.el.style.top = `${s}px`;
1205
+ n + i > e.width && (n = t.clientX - e.left - i - Qe), s + a > e.height && (s = t.clientY - e.top - a - $e), this.el.style.left = `${n}px`, this.el.style.top = `${s}px`;
1206
1206
  }
1207
1207
  /**
1208
1208
  * Показать индикатор
@@ -1233,7 +1233,7 @@ class Re {
1233
1233
  this.canvas && (this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:cleared", this._onSelectionCleared)), (t = this.el) != null && t.parentNode && this.el.parentNode.removeChild(this.el), this.el = null, this.editor = null, this.canvas = null, this.options = null;
1234
1234
  }
1235
1235
  }
1236
- const Te = [
1236
+ const Oe = [
1237
1237
  "id",
1238
1238
  "backgroundId",
1239
1239
  "customData",
@@ -1283,7 +1283,7 @@ class K {
1283
1283
  return this.patches[this.currentIndex - 1] || null;
1284
1284
  }
1285
1285
  _createDiffPatcher() {
1286
- this.diffPatcher = Ln({
1286
+ this.diffPatcher = Dn({
1287
1287
  objectHash(t) {
1288
1288
  return [JSON.stringify(t)].join("-");
1289
1289
  },
@@ -1292,7 +1292,7 @@ class K {
1292
1292
  includeValueOnMove: !1
1293
1293
  },
1294
1294
  textDiff: {
1295
- diffMatchPatch: Dn,
1295
+ diffMatchPatch: _n,
1296
1296
  minLength: 60
1297
1297
  }
1298
1298
  });
@@ -1368,7 +1368,7 @@ class K {
1368
1368
  */
1369
1369
  _serializeCanvasState() {
1370
1370
  const { canvas: t } = this;
1371
- return t.toDatalessObject([...Te]);
1371
+ return t.toDatalessObject([...Oe]);
1372
1372
  }
1373
1373
  /**
1374
1374
  * Обрабатывает срабатывание отложенного сохранения.
@@ -1429,7 +1429,7 @@ class K {
1429
1429
  this._isSavingState = !0, console.time("saveState");
1430
1430
  try {
1431
1431
  const t = this._withTemporaryUnlock(
1432
- () => this.canvas.toDatalessObject([...Te])
1432
+ () => this.canvas.toDatalessObject([...Oe])
1433
1433
  );
1434
1434
  if (console.timeEnd("saveState"), !this.baseState) {
1435
1435
  this.baseState = t, this.patches = [], this.currentIndex = 0, console.log("Базовое состояние сохранено.");
@@ -1453,7 +1453,7 @@ class K {
1453
1453
  console.log("statesEqual. Нет изменений для сохранения.");
1454
1454
  return;
1455
1455
  }
1456
- console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", o), this.totalChangesCount += 1, this.patches.push({ id: $(), diff: o }), this.currentIndex += 1, this.patches.length > this.maxHistoryLength && (this.baseState = this.diffPatcher.patch(this.baseState, this.patches[0].diff), this.patches.shift(), this.currentIndex -= 1, this.baseStateChangesCount += 1), console.log("Состояние сохранено. Текущий индекс истории:", this.currentIndex);
1456
+ console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", o), this.totalChangesCount += 1, this.patches.push({ id: tt(), diff: o }), this.currentIndex += 1, this.patches.length > this.maxHistoryLength && (this.baseState = this.diffPatcher.patch(this.baseState, this.patches[0].diff), this.patches.shift(), this.currentIndex -= 1, this.baseStateChangesCount += 1), console.log("Состояние сохранено. Текущий индекс истории:", this.currentIndex);
1457
1457
  } finally {
1458
1458
  this._isSavingState = !1;
1459
1459
  }
@@ -1576,14 +1576,14 @@ class K {
1576
1576
  id: "montage-area"
1577
1577
  });
1578
1578
  f && (f.left = a, f.top = r);
1579
- const g = K._getClipPathPosition({ clipPath: s });
1580
- if (g && i && typeof i == "object") {
1581
- const { left: p, top: v } = g, M = i;
1582
- M.left = p, M.top = v;
1579
+ const p = K._getClipPathPosition({ clipPath: s });
1580
+ if (p && i && typeof i == "object") {
1581
+ const { left: g, top: v } = p, M = i;
1582
+ M.left = g, M.top = v;
1583
1583
  }
1584
1584
  const m = K._getTranslationIgnoredIds();
1585
- for (let p = 0; p < o.length; p += 1) {
1586
- const v = o[p], { id: M } = v;
1585
+ for (let g = 0; g < o.length; g += 1) {
1586
+ const v = o[g], { id: M } = v;
1587
1587
  M && m.has(M) || (typeof v.left == "number" && (v.left -= h), typeof v.top == "number" && (v.top -= u));
1588
1588
  }
1589
1589
  }
@@ -1822,7 +1822,7 @@ class K {
1822
1822
  }
1823
1823
  }
1824
1824
  }
1825
- const ts = 0.1, es = 2, Je = 0.1, ns = 90, Ft = 16, Ut = 16, Ot = 4096, Et = 4096, Qe = "application/image-editor:", re = [
1825
+ const es = 0.1, ns = 2, tn = 0.1, ss = 90, Ft = 16, Wt = 16, Ot = 4096, Et = 4096, en = "application/image-editor:", re = [
1826
1826
  "format",
1827
1827
  "uppercase",
1828
1828
  "textCaseRaw",
@@ -1837,7 +1837,7 @@ const ts = 0.1, es = 2, Je = 0.1, ns = 90, Ft = 16, Ut = 16, Ot = 4096, Et = 409
1837
1837
  "radiusBottomRight",
1838
1838
  "radiusBottomLeft",
1839
1839
  "lineFontDefaults"
1840
- ], ss = 50;
1840
+ ], is = 50;
1841
1841
  class mt {
1842
1842
  constructor({ editor: t }) {
1843
1843
  this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
@@ -1867,17 +1867,17 @@ class mt {
1867
1867
  customData: c = null
1868
1868
  } = t;
1869
1869
  if (!e) return null;
1870
- const { canvas: l, montageArea: h, transformManager: u, historyManager: f, errorManager: g } = this.editor, m = yield this.getContentType(e), p = mt.getFormatFromContentType(m), { acceptContentTypes: v, acceptFormats: M } = this;
1870
+ const { canvas: l, montageArea: h, transformManager: u, historyManager: f, errorManager: p } = this.editor, m = yield this.getContentType(e), g = mt.getFormatFromContentType(m), { acceptContentTypes: v, acceptFormats: M } = this;
1871
1871
  if (!this.isAllowedContentType(m)) {
1872
- const j = `Неверный contentType для изображения: ${m}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1873
- return g.emitError({
1872
+ const C = `Неверный contentType для изображения: ${m}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1873
+ return p.emitError({
1874
1874
  origin: "ImageManager",
1875
1875
  method: "importImage",
1876
1876
  code: "INVALID_CONTENT_TYPE",
1877
- message: j,
1877
+ message: C,
1878
1878
  data: {
1879
1879
  source: e,
1880
- format: p,
1880
+ format: g,
1881
1881
  contentType: m,
1882
1882
  acceptContentTypes: v,
1883
1883
  acceptFormats: M,
@@ -1891,21 +1891,21 @@ class mt {
1891
1891
  }
1892
1892
  f.suspendHistory();
1893
1893
  try {
1894
- let j, y;
1894
+ let C, y;
1895
1895
  if (e instanceof File)
1896
- j = URL.createObjectURL(e);
1896
+ C = URL.createObjectURL(e);
1897
1897
  else if (typeof e == "string") {
1898
1898
  const A = yield (yield fetch(e, { mode: "cors" })).blob();
1899
- j = URL.createObjectURL(A);
1899
+ C = URL.createObjectURL(A);
1900
1900
  } else
1901
- return g.emitError({
1901
+ return p.emitError({
1902
1902
  origin: "ImageManager",
1903
1903
  method: "importImage",
1904
1904
  code: "INVALID_SOURCE_TYPE",
1905
1905
  message: "Неверный тип источника изображения. Ожидается URL или объект File.",
1906
1906
  data: {
1907
1907
  source: e,
1908
- format: p,
1908
+ format: g,
1909
1909
  contentType: m,
1910
1910
  acceptContentTypes: v,
1911
1911
  acceptFormats: M,
@@ -1916,32 +1916,32 @@ class mt {
1916
1916
  customData: c
1917
1917
  }
1918
1918
  }), null;
1919
- if (this._createdBlobUrls.push(j), p === "svg") {
1920
- const b = yield wn(j);
1919
+ if (this._createdBlobUrls.push(C), g === "svg") {
1920
+ const b = yield An(C);
1921
1921
  y = yt.groupSVGElements(b.objects, b.options);
1922
1922
  } else
1923
- y = yield Xt.fromURL(j, { crossOrigin: "anonymous" });
1924
- const { width: w, height: I } = y;
1923
+ y = yield Xt.fromURL(C, { crossOrigin: "anonymous" });
1924
+ const { width: w, height: j } = y;
1925
1925
  if (y instanceof Xt) {
1926
1926
  const b = y.getElement();
1927
1927
  let A = "";
1928
- if (b instanceof HTMLImageElement ? A = b.src : b instanceof HTMLCanvasElement && (A = b.toDataURL()), I > Et || w > Ot) {
1929
- const S = yield this.resizeImageToBoundaries(A, "max"), T = URL.createObjectURL(S);
1930
- this._createdBlobUrls.push(T), y = yield Xt.fromURL(T, { crossOrigin: "anonymous" });
1931
- } else if (I < Ut || w < Ft) {
1932
- const S = yield this.resizeImageToBoundaries(A, "min"), T = URL.createObjectURL(S);
1933
- this._createdBlobUrls.push(T), y = yield Xt.fromURL(T, { crossOrigin: "anonymous" });
1928
+ if (b instanceof HTMLImageElement ? A = b.src : b instanceof HTMLCanvasElement && (A = b.toDataURL()), j > Et || w > Ot) {
1929
+ const S = yield this.resizeImageToBoundaries(A, "max"), I = URL.createObjectURL(S);
1930
+ this._createdBlobUrls.push(I), y = yield Xt.fromURL(I, { crossOrigin: "anonymous" });
1931
+ } else if (j < Wt || w < Ft) {
1932
+ const S = yield this.resizeImageToBoundaries(A, "min"), I = URL.createObjectURL(S);
1933
+ this._createdBlobUrls.push(I), y = yield Xt.fromURL(I, { crossOrigin: "anonymous" });
1934
1934
  }
1935
1935
  }
1936
- if (y.set("id", `${y.type}-${$()}`), y.set("format", p), y.set("customData", c || null), n === "scale-montage")
1936
+ if (y.set("id", `${y.type}-${tt()}`), y.set("format", g), y.set("customData", c || null), n === "scale-montage")
1937
1937
  this.editor.canvasManager.scaleMontageAreaToImage({ object: y, withoutSave: !0 });
1938
1938
  else {
1939
1939
  const { width: b, height: A } = h, S = this.calculateScaleFactor({ imageObject: y, scaleType: n });
1940
- n === "image-contain" && S < 1 ? u.fitObject({ object: y, type: "contain", withoutSave: !0 }) : n === "image-cover" && (w > b || I > A) && u.fitObject({ object: y, type: "cover", withoutSave: !0 });
1940
+ n === "image-contain" && S < 1 ? u.fitObject({ object: y, type: "contain", withoutSave: !0 }) : n === "image-cover" && (w > b || j > A) && u.fitObject({ object: y, type: "cover", withoutSave: !0 });
1941
1941
  }
1942
- const C = {
1942
+ const T = {
1943
1943
  image: y,
1944
- format: p,
1944
+ format: g,
1945
1945
  contentType: m,
1946
1946
  scale: n,
1947
1947
  withoutSave: s,
@@ -1952,16 +1952,16 @@ class mt {
1952
1952
  withoutAdding: r,
1953
1953
  customData: c
1954
1954
  };
1955
- return r ? (f.resumeHistory(), l.fire("editor:image-imported", C), C) : (l.add(y), l.centerObject(y), a || l.setActiveObject(y), l.renderAll(), f.resumeHistory(), s || f.saveState(), l.fire("editor:image-imported", C), C);
1956
- } catch (j) {
1957
- return g.emitError({
1955
+ return r ? (f.resumeHistory(), l.fire("editor:image-imported", T), T) : (l.add(y), l.centerObject(y), a || l.setActiveObject(y), l.renderAll(), f.resumeHistory(), s || f.saveState(), l.fire("editor:image-imported", T), T);
1956
+ } catch (C) {
1957
+ return p.emitError({
1958
1958
  origin: "ImageManager",
1959
1959
  method: "importImage",
1960
1960
  code: "IMPORT_FAILED",
1961
- message: `Ошибка импорта изображения: ${j.message}`,
1961
+ message: `Ошибка импорта изображения: ${C.message}`,
1962
1962
  data: {
1963
1963
  source: e,
1964
- format: p,
1964
+ format: g,
1965
1965
  contentType: m,
1966
1966
  scale: n,
1967
1967
  withoutSave: s,
@@ -1986,14 +1986,14 @@ class mt {
1986
1986
  resizeImageToBoundaries(t, e = "max") {
1987
1987
  return Z(this, null, function* () {
1988
1988
  let n = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${Ot}x${Et}`;
1989
- e === "min" && (n = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${Ft}x${Ut}`);
1989
+ e === "min" && (n = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${Ft}x${Wt}`);
1990
1990
  const s = {
1991
1991
  dataURL: t,
1992
1992
  sizeType: e,
1993
1993
  maxWidth: Ot,
1994
1994
  maxHeight: Et,
1995
1995
  minWidth: Ft,
1996
- minHeight: Ut
1996
+ minHeight: Wt
1997
1997
  };
1998
1998
  return this.editor.errorManager.emitWarning({
1999
1999
  origin: "ImageManager",
@@ -2026,16 +2026,16 @@ class mt {
2026
2026
  try {
2027
2027
  const l = n === "application/pdf", h = l ? "image/jpg" : n, u = mt.getFormatFromContentType(h);
2028
2028
  a.setCoords();
2029
- const { left: f, top: g, width: m, height: p } = a.getBoundingRect(), v = yield i.clone(["id", "format", "locked"]);
2029
+ const { left: f, top: p, width: m, height: g } = a.getBoundingRect(), v = yield i.clone(["id", "format", "locked"]);
2030
2030
  v.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(h) && (v.backgroundColor = "#ffffff");
2031
2031
  const M = v.getObjects().find((S) => S.id === a.id);
2032
2032
  if (M && (M.visible = !1), c != null && c.isBlocked) {
2033
- const S = v.getObjects().find((T) => T.id === c.overlayMask.id);
2033
+ const S = v.getObjects().find((I) => I.id === c.overlayMask.id);
2034
2034
  S && (S.visible = !1);
2035
2035
  }
2036
- v.viewportTransform = [1, 0, 0, 1, -f, -g], v.setDimensions({ width: m, height: p }, { backstoreOnly: !0 }), v.renderAll();
2037
- const j = v.getObjects().filter((S) => S.format).every((S) => S.format === "svg");
2038
- if (u === "svg" && j) {
2036
+ v.viewportTransform = [1, 0, 0, 1, -f, -p], v.setDimensions({ width: m, height: g }, { backstoreOnly: !0 }), v.renderAll();
2037
+ const C = v.getObjects().filter((S) => S.format).every((S) => S.format === "svg");
2038
+ if (u === "svg" && C) {
2039
2039
  const S = v.toSVG();
2040
2040
  v.dispose();
2041
2041
  const O = {
@@ -2050,9 +2050,9 @@ class mt {
2050
2050
  };
2051
2051
  return i.fire("editor:canvas-exported", O), O;
2052
2052
  }
2053
- const y = yield new Promise((S, T) => {
2053
+ const y = yield new Promise((S, I) => {
2054
2054
  v.getElement().toBlob((O) => {
2055
- O ? S(O) : T(new Error("Failed to create Blob from canvas"));
2055
+ O ? S(O) : I(new Error("Failed to create Blob from canvas"));
2056
2056
  });
2057
2057
  });
2058
2058
  if (v.dispose(), o) {
@@ -2064,28 +2064,28 @@ class mt {
2064
2064
  };
2065
2065
  return i.fire("editor:canvas-exported", S), S;
2066
2066
  }
2067
- const w = yield createImageBitmap(y), I = yield r.post(
2067
+ const w = yield createImageBitmap(y), j = yield r.post(
2068
2068
  "toDataURL",
2069
2069
  { format: u, quality: 1, bitmap: w },
2070
2070
  [w]
2071
2071
  );
2072
2072
  if (l) {
2073
- const T = m * 0.264583, O = p * 0.264583, P = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, U = new P({
2074
- orientation: T > O ? "landscape" : "portrait",
2073
+ const I = m * 0.264583, O = g * 0.264583, N = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, W = new N({
2074
+ orientation: I > O ? "landscape" : "portrait",
2075
2075
  unit: "mm",
2076
- format: [T, O]
2076
+ format: [I, O]
2077
2077
  });
2078
- if (U.addImage(String(I), "JPG", 0, 0, T, O), s) {
2079
- const z = {
2080
- image: U.output("datauristring"),
2078
+ if (W.addImage(String(j), "JPG", 0, 0, I, O), s) {
2079
+ const R = {
2080
+ image: W.output("datauristring"),
2081
2081
  format: "pdf",
2082
2082
  contentType: "application/pdf",
2083
2083
  fileName: e
2084
2084
  };
2085
- return i.fire("editor:canvas-exported", z), z;
2085
+ return i.fire("editor:canvas-exported", R), R;
2086
2086
  }
2087
- const F = U.output("blob"), B = {
2088
- image: new File([F], e, { type: "application/pdf" }),
2087
+ const z = W.output("blob"), B = {
2088
+ image: new File([z], e, { type: "application/pdf" }),
2089
2089
  format: "pdf",
2090
2090
  contentType: "application/pdf",
2091
2091
  fileName: e
@@ -2094,18 +2094,18 @@ class mt {
2094
2094
  }
2095
2095
  if (s) {
2096
2096
  const S = {
2097
- image: I,
2097
+ image: j,
2098
2098
  format: u,
2099
2099
  contentType: h,
2100
2100
  fileName: e
2101
2101
  };
2102
2102
  return i.fire("editor:canvas-exported", S), S;
2103
2103
  }
2104
- const C = u === "svg" && !j ? e.replace(/\.[^/.]+$/, ".png") : e, A = {
2105
- image: new File([y], C, { type: h }),
2104
+ const T = u === "svg" && !C ? e.replace(/\.[^/.]+$/, ".png") : e, A = {
2105
+ image: new File([y], T, { type: h }),
2106
2106
  format: u,
2107
2107
  contentType: h,
2108
- fileName: C
2108
+ fileName: T
2109
2109
  };
2110
2110
  return i.fire("editor:canvas-exported", A), A;
2111
2111
  } catch (l) {
@@ -2150,13 +2150,13 @@ class mt {
2150
2150
  try {
2151
2151
  const l = mt.getFormatFromContentType(s);
2152
2152
  if (l === "svg") {
2153
- const m = c.toSVG(), p = mt._exportSVGStringAsFile(m, {
2153
+ const m = c.toSVG(), g = mt._exportSVGStringAsFile(m, {
2154
2154
  exportAsBase64: o,
2155
2155
  exportAsBlob: i,
2156
2156
  fileName: n
2157
2157
  }), v = {
2158
2158
  object: c,
2159
- image: p,
2159
+ image: g,
2160
2160
  format: l,
2161
2161
  contentType: "image/svg+xml",
2162
2162
  fileName: n.replace(/\.[^/.]+$/, ".svg")
@@ -2164,7 +2164,7 @@ class mt {
2164
2164
  return a.fire("editor:object-exported", v), v;
2165
2165
  }
2166
2166
  if (o && c instanceof Xt) {
2167
- const m = yield createImageBitmap(c.getElement()), p = yield r.post(
2167
+ const m = yield createImageBitmap(c.getElement()), g = yield r.post(
2168
2168
  "toDataURL",
2169
2169
  {
2170
2170
  format: l,
@@ -2174,7 +2174,7 @@ class mt {
2174
2174
  [m]
2175
2175
  ), v = {
2176
2176
  object: c,
2177
- image: p,
2177
+ image: g,
2178
2178
  format: l,
2179
2179
  contentType: s,
2180
2180
  fileName: n
@@ -2183,9 +2183,9 @@ class mt {
2183
2183
  }
2184
2184
  const h = c.toCanvasElement({
2185
2185
  enableRetinaScaling: !1
2186
- }), u = yield new Promise((m, p) => {
2186
+ }), u = yield new Promise((m, g) => {
2187
2187
  h.toBlob((v) => {
2188
- v ? m(v) : p(new Error("Failed to create Blob from canvas"));
2188
+ v ? m(v) : g(new Error("Failed to create Blob from canvas"));
2189
2189
  });
2190
2190
  });
2191
2191
  if (i) {
@@ -2198,14 +2198,14 @@ class mt {
2198
2198
  };
2199
2199
  return a.fire("editor:object-exported", m), m;
2200
2200
  }
2201
- const f = new File([u], n, { type: s }), g = {
2201
+ const f = new File([u], n, { type: s }), p = {
2202
2202
  object: c,
2203
2203
  image: f,
2204
2204
  format: l,
2205
2205
  contentType: s,
2206
2206
  fileName: n
2207
2207
  };
2208
- return a.fire("editor:object-exported", g), g;
2208
+ return a.fire("editor:object-exported", p), p;
2209
2209
  } catch (l) {
2210
2210
  return this.editor.errorManager.emitError({
2211
2211
  origin: "ImageManager",
@@ -2334,11 +2334,11 @@ class mt {
2334
2334
  return e ? e[1] : "";
2335
2335
  }
2336
2336
  }
2337
- const St = (d, t, e) => Math.max(Math.min(d, e), t), $e = (d, t) => d * t, is = (d, t) => new at(d / 2, t / 2);
2338
- function os(d) {
2337
+ const St = (d, t, e) => Math.max(Math.min(d, e), t), nn = (d, t) => d * t, os = (d, t) => new at(d / 2, t / 2);
2338
+ function as(d) {
2339
2339
  return ((d == null ? void 0 : d.type) === "image" || (d == null ? void 0 : d.format) === "svg") && typeof (d == null ? void 0 : d.width) == "number" && typeof (d == null ? void 0 : d.height) == "number";
2340
2340
  }
2341
- class as {
2341
+ class rs {
2342
2342
  /**
2343
2343
  * @param options
2344
2344
  * @param options.editor – экземпляр редактора
@@ -2379,16 +2379,16 @@ class as {
2379
2379
  * @fires editor:resolution-width-changed
2380
2380
  */
2381
2381
  setResolutionWidth(t, { preserveProportional: e, withoutSave: n, adaptCanvasToContainer: s } = {}) {
2382
- var g;
2382
+ var p;
2383
2383
  if (!t) return;
2384
2384
  const {
2385
2385
  canvas: o,
2386
2386
  montageArea: i,
2387
2387
  options: { canvasBackstoreWidth: a }
2388
2388
  } = this.editor, { width: r, height: c } = i, l = St(Number(t), Ft, Ot);
2389
- if (!a || a === "auto" || s ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(l), i.set({ width: l }), (g = o.clipPath) == null || g.set({ width: l }), e) {
2390
- const m = l / r, p = $e(c, m);
2391
- this.setResolutionHeight(p);
2389
+ if (!a || a === "auto" || s ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(l), i.set({ width: l }), (p = o.clipPath) == null || p.set({ width: l }), e) {
2390
+ const m = l / r, g = nn(c, m);
2391
+ this.setResolutionHeight(g);
2392
2392
  return;
2393
2393
  }
2394
2394
  const { left: h, top: u } = this.getObjectDefaultCoords(i), f = o.getZoom();
@@ -2409,16 +2409,16 @@ class as {
2409
2409
  * @fires editor:resolution-height-changed
2410
2410
  */
2411
2411
  setResolutionHeight(t, { preserveProportional: e, withoutSave: n, adaptCanvasToContainer: s } = {}) {
2412
- var g;
2412
+ var p;
2413
2413
  if (!t) return;
2414
2414
  const {
2415
2415
  canvas: o,
2416
2416
  montageArea: i,
2417
2417
  options: { canvasBackstoreHeight: a }
2418
- } = this.editor, { width: r, height: c } = i, l = St(Number(t), Ut, Et);
2419
- if (!a || a === "auto" || s ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(l), i.set({ height: l }), (g = o.clipPath) == null || g.set({ height: l }), e) {
2420
- const m = l / c, p = $e(r, m);
2421
- this.setResolutionWidth(p);
2418
+ } = this.editor, { width: r, height: c } = i, l = St(Number(t), Wt, Et);
2419
+ if (!a || a === "auto" || s ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(l), i.set({ height: l }), (p = o.clipPath) == null || p.set({ height: l }), e) {
2420
+ const m = l / c, g = nn(r, m);
2421
+ this.setResolutionWidth(g);
2422
2422
  return;
2423
2423
  }
2424
2424
  const { left: h, top: u } = this.getObjectDefaultCoords(i), f = o.getZoom();
@@ -2435,7 +2435,7 @@ class as {
2435
2435
  */
2436
2436
  centerMontageArea() {
2437
2437
  var r;
2438
- const { canvas: t, montageArea: e } = this.editor, n = t.getWidth(), s = t.getHeight(), o = t.getZoom(), i = is(n, s);
2438
+ const { canvas: t, montageArea: e } = this.editor, n = t.getWidth(), s = t.getHeight(), o = t.getZoom(), i = os(n, s);
2439
2439
  e.set({
2440
2440
  left: n / 2,
2441
2441
  top: s / 2
@@ -2477,7 +2477,7 @@ class as {
2477
2477
  */
2478
2478
  setCanvasBackstoreHeight(t) {
2479
2479
  if (!t || typeof t != "number") return;
2480
- const e = St(t, Ut, Et);
2480
+ const e = St(t, Wt, Et);
2481
2481
  this.editor.canvas.setDimensions({ height: e }, { backstoreOnly: !0 });
2482
2482
  }
2483
2483
  /**
@@ -2486,7 +2486,7 @@ class as {
2486
2486
  * с учётом минимальных и максимальных значений.
2487
2487
  */
2488
2488
  adaptCanvasToContainer() {
2489
- const { canvas: t } = this.editor, e = this.getEditorContainer(), n = e.clientWidth, s = e.clientHeight, o = St(n, Ft, Ot), i = St(s, Ut, Et);
2489
+ const { canvas: t } = this.editor, e = this.getEditorContainer(), n = e.clientWidth, s = e.clientHeight, o = St(n, Ft, Ot), i = St(s, Wt, Et);
2490
2490
  t.setDimensions({ width: o, height: i }, { backstoreOnly: !0 });
2491
2491
  }
2492
2492
  /**
@@ -2686,15 +2686,15 @@ class as {
2686
2686
  montageAreaHeight: r
2687
2687
  }
2688
2688
  } = this.editor, c = t || s.getActiveObject();
2689
- if (!os(c)) return;
2689
+ if (!as(c)) return;
2690
2690
  const { width: l, height: h } = c;
2691
2691
  let u = Math.min(l, Ot), f = Math.min(h, Et);
2692
2692
  if (e) {
2693
2693
  const {
2694
- width: g,
2694
+ width: p,
2695
2695
  height: m
2696
- } = o, p = l / g, v = h / m, M = Math.max(p, v);
2697
- u = g * M, f = m * M;
2696
+ } = o, g = l / p, v = h / m, M = Math.max(g, v);
2697
+ u = p * M, f = m * M;
2698
2698
  }
2699
2699
  this.setResolutionWidth(u, { withoutSave: !0 }), this.setResolutionHeight(f, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (l > a || h > r) && this.editor.zoomManager.calculateAndApplyDefaultZoom(), i.resetObject({ object: c, withoutSave: !0 }), s.centerObject(c), s.renderAll(), n || this.editor.historyManager.saveState(), s.fire("editor:montage-area-scaled-to-image", {
2700
2700
  object: c,
@@ -2746,7 +2746,7 @@ class as {
2746
2746
  );
2747
2747
  }
2748
2748
  }
2749
- class rs {
2749
+ class cs {
2750
2750
  constructor({ editor: t }) {
2751
2751
  this.editor = t, this.options = t.options;
2752
2752
  }
@@ -2757,7 +2757,7 @@ class rs {
2757
2757
  * @param options.withoutSave - Не сохранять состояние
2758
2758
  * @fires editor:object-rotated
2759
2759
  */
2760
- rotate(t = ns, { withoutSave: e } = {}) {
2760
+ rotate(t = ss, { withoutSave: e } = {}) {
2761
2761
  const { canvas: n, historyManager: s } = this.editor, o = n.getActiveObject();
2762
2762
  if (!o) return;
2763
2763
  const i = o.angle + t;
@@ -2858,11 +2858,11 @@ class rs {
2858
2858
  * @private
2859
2859
  */
2860
2860
  _fitSingleObject(t, e) {
2861
- const { canvas: n, montageArea: s } = this.editor, { width: o, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, l = o * Math.abs(a), h = i * Math.abs(r), u = c * Math.PI / 180, f = Math.abs(Math.cos(u)), g = Math.abs(Math.sin(u)), m = l * f + h * g, p = l * g + h * f, v = s.width, M = s.height;
2862
- let j;
2863
- e === "contain" ? j = Math.min(v / m, M / p) : j = Math.max(v / m, M / p), t.set({
2864
- scaleX: a * j,
2865
- scaleY: r * j
2861
+ const { canvas: n, montageArea: s } = this.editor, { width: o, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, l = o * Math.abs(a), h = i * Math.abs(r), u = c * Math.PI / 180, f = Math.abs(Math.cos(u)), p = Math.abs(Math.sin(u)), m = l * f + h * p, g = l * p + h * f, v = s.width, M = s.height;
2862
+ let C;
2863
+ e === "contain" ? C = Math.min(v / m, M / g) : C = Math.max(v / m, M / g), t.set({
2864
+ scaleX: a * C,
2865
+ scaleY: r * C
2866
2866
  }), n.centerObject(t);
2867
2867
  }
2868
2868
  /**
@@ -2899,11 +2899,11 @@ class rs {
2899
2899
  }), e)
2900
2900
  this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 });
2901
2901
  else {
2902
- const { width: h, height: u } = o, { width: f, height: g } = c, m = i.calculateScaleFactor({
2902
+ const { width: h, height: u } = o, { width: f, height: p } = c, m = i.calculateScaleFactor({
2903
2903
  imageObject: c,
2904
2904
  scaleType: r
2905
2905
  });
2906
- r === "contain" && m < 1 || r === "cover" && (f > h || g > u) ? this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 }) : c.set({ scaleX: 1, scaleY: 1 });
2906
+ r === "contain" && m < 1 || r === "cover" && (f > h || p > u) ? this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 }) : c.set({ scaleX: 1, scaleY: 1 });
2907
2907
  }
2908
2908
  c.set({ flipX: !1, flipY: !1, angle: 0 }), s.centerObject(c), s.renderAll(), a.resumeHistory(), n || a.saveState(), s.fire("editor:object-reset", {
2909
2909
  object: c,
@@ -2912,9 +2912,9 @@ class rs {
2912
2912
  });
2913
2913
  }
2914
2914
  }
2915
- class cs {
2915
+ class ls {
2916
2916
  constructor({ editor: t }) {
2917
- this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || ts, this.maxZoom = this.options.maxZoom || es, this.defaultZoom = this._normalizeDefaultZoom(this.options.defaultScale);
2917
+ this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || es, this.maxZoom = this.options.maxZoom || ns, this.defaultZoom = this._normalizeDefaultZoom(this.options.defaultScale);
2918
2918
  }
2919
2919
  /**
2920
2920
  * Приводит значение defaultZoom к числу с двумя знаками после запятой, а также учитывает минимальное и максимальное значения.
@@ -2945,10 +2945,10 @@ class cs {
2945
2945
  * @private
2946
2946
  */
2947
2947
  _getClampedPointerCoordinates(t) {
2948
- const { canvas: e, montageArea: n } = this.editor, s = e.getPointer(t, !0), o = e.viewportTransform, i = e.getZoom(), a = n.left - n.width / 2, r = n.left + n.width / 2, c = n.top - n.height / 2, l = n.top + n.height / 2, h = a * i + o[4], u = r * i + o[4], f = c * i + o[5], g = l * i + o[5], m = Math.max(h, Math.min(u, s.x)), p = Math.max(f, Math.min(g, s.y));
2948
+ const { canvas: e, montageArea: n } = this.editor, s = e.getPointer(t, !0), o = e.viewportTransform, i = e.getZoom(), a = n.left - n.width / 2, r = n.left + n.width / 2, c = n.top - n.height / 2, l = n.top + n.height / 2, h = a * i + o[4], u = r * i + o[4], f = c * i + o[5], p = l * i + o[5], m = Math.max(h, Math.min(u, s.x)), g = Math.max(f, Math.min(p, s.y));
2949
2949
  return {
2950
2950
  x: m,
2951
- y: p
2951
+ y: g
2952
2952
  };
2953
2953
  }
2954
2954
  /**
@@ -2980,10 +2980,10 @@ class cs {
2980
2980
  * @private
2981
2981
  */
2982
2982
  _calculateEmptySpaceRatio(t) {
2983
- const { canvas: e, montageArea: n } = this.editor, s = e.viewportTransform, o = e.getWidth(), i = e.getHeight(), a = n.left - n.width / 2, r = n.left + n.width / 2, c = n.top - n.height / 2, l = n.top + n.height / 2, h = -s[4] / t, u = (-s[4] + o) / t, f = -s[5] / t, g = (-s[5] + i) / t, m = h < a, p = u > r, v = f < c, M = g > l;
2984
- if (!(m || p || v || M)) return 0;
2985
- const y = Math.max(0, a - h), w = Math.max(0, u - r), I = Math.max(0, c - f), C = Math.max(0, g - l), b = Math.max(y, w), A = Math.max(I, C), S = b / o, T = A / i;
2986
- return Math.max(S, T);
2983
+ const { canvas: e, montageArea: n } = this.editor, s = e.viewportTransform, o = e.getWidth(), i = e.getHeight(), a = n.left - n.width / 2, r = n.left + n.width / 2, c = n.top - n.height / 2, l = n.top + n.height / 2, h = -s[4] / t, u = (-s[4] + o) / t, f = -s[5] / t, p = (-s[5] + i) / t, m = h < a, g = u > r, v = f < c, M = p > l;
2984
+ if (!(m || g || v || M)) return 0;
2985
+ const y = Math.max(0, a - h), w = Math.max(0, u - r), j = Math.max(0, c - f), T = Math.max(0, p - l), b = Math.max(y, w), A = Math.max(j, T), S = b / o, I = A / i;
2986
+ return Math.max(S, I);
2987
2987
  }
2988
2988
  /**
2989
2989
  * Вычисляет плавный шаг перемещения viewport к центру с ускорением
@@ -2996,11 +2996,11 @@ class cs {
2996
2996
  * @private
2997
2997
  */
2998
2998
  _calculateSmoothCenteringStep(t, e, n, s, o) {
2999
- const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), l = i.getHeight(), h = t.x - r[4], u = t.y - r[5], f = Math.abs(s), g = e - n;
3000
- if (Math.abs(g) / f <= 0.1)
2999
+ const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), l = i.getHeight(), h = t.x - r[4], u = t.y - r[5], f = Math.abs(s), p = e - n;
3000
+ if (Math.abs(p) / f <= 0.1)
3001
3001
  return { x: h, y: u };
3002
- const p = c / 2, v = l / 2, M = a.left, j = a.top, y = p - M * n, w = v - j * n, I = (y - r[4]) / (e - n), C = (w - r[5]) / (e - n), b = I * f, A = C * f, S = b * o, T = A * o, O = Math.abs(S) > Math.abs(h) ? h : S, P = Math.abs(T) > Math.abs(u) ? u : T;
3003
- return { x: O, y: P };
3002
+ const g = c / 2, v = l / 2, M = a.left, C = a.top, y = g - M * n, w = v - C * n, j = (y - r[4]) / (e - n), T = (w - r[5]) / (e - n), b = j * f, A = T * f, S = b * o, I = A * o, O = Math.abs(S) > Math.abs(h) ? h : S, N = Math.abs(I) > Math.abs(u) ? u : I;
3003
+ return { x: O, y: N };
3004
3004
  }
3005
3005
  /**
3006
3006
  * Применяет плавное центрирование viewport при приближении к defaultZoom.
@@ -3012,7 +3012,7 @@ class cs {
3012
3012
  * @returns true если центрирование было применено
3013
3013
  * @private
3014
3014
  */
3015
- _applyViewportCentering(t, e = !1, n = Je) {
3015
+ _applyViewportCentering(t, e = !1, n = tn) {
3016
3016
  const { canvas: s } = this.editor, o = this._getScaledMontageDimensions(t), i = s.getWidth(), a = s.getHeight(), r = o.width > i || o.height > a, c = this._calculateFitZoom(), l = t - c;
3017
3017
  if (!(!r || l) && !e)
3018
3018
  return !1;
@@ -3020,9 +3020,9 @@ class cs {
3020
3020
  if (!r)
3021
3021
  return u[4] = f.x, u[5] = f.y, s.setViewportTransform(u), !0;
3022
3022
  if (e && !r) {
3023
- const g = this._calculateEmptySpaceRatio(t);
3024
- if (g > 0) {
3025
- const m = this._calculateSmoothCenteringStep(f, t, c, n, g);
3023
+ const p = this._calculateEmptySpaceRatio(t);
3024
+ if (p > 0) {
3025
+ const m = this._calculateSmoothCenteringStep(f, t, c, n, p);
3026
3026
  return u[4] += m.x, u[5] += m.y, s.setViewportTransform(u), !0;
3027
3027
  }
3028
3028
  }
@@ -3087,10 +3087,10 @@ class cs {
3087
3087
  * @param options.pointY - Координата Y точки зума
3088
3088
  * @fires editor:zoom-changed
3089
3089
  */
3090
- zoom(t = Je, e = {}) {
3091
- var f, g;
3090
+ zoom(t = tn, e = {}) {
3091
+ var f, p;
3092
3092
  if (!t) return;
3093
- const { minZoom: n, maxZoom: s } = this, { canvas: o } = this.editor, i = t < 0, a = o.getZoom(), r = o.getCenterPoint(), c = (f = e.pointX) != null ? f : r.x, l = (g = e.pointY) != null ? g : r.y, h = new at(c, l);
3093
+ const { minZoom: n, maxZoom: s } = this, { canvas: o } = this.editor, i = t < 0, a = o.getZoom(), r = o.getCenterPoint(), c = (f = e.pointX) != null ? f : r.x, l = (p = e.pointY) != null ? p : r.y, h = new at(c, l);
3094
3094
  this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
3095
3095
  let u = Number((a + Number(t)).toFixed(2));
3096
3096
  u > s && (u = s), u < n && (u = n), o.zoomToPoint(h, u), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(u, i, t), o.fire("editor:zoom-changed", {
@@ -3125,7 +3125,7 @@ class cs {
3125
3125
  }), this.editor.panConstraintManager.updateBounds();
3126
3126
  }
3127
3127
  }
3128
- class ls {
3128
+ class ds {
3129
3129
  constructor({ editor: t }) {
3130
3130
  this.editor = t, this.isBlocked = !1, this.overlayMask = null, this._createOverlay();
3131
3131
  }
@@ -3208,7 +3208,7 @@ class Bt {
3208
3208
  }
3209
3209
  a.set({
3210
3210
  fill: t,
3211
- backgroundId: `background-${$()}`
3211
+ backgroundId: `background-${tt()}`
3212
3212
  }), this.editor.canvas.requestRenderAll();
3213
3213
  } else
3214
3214
  this._removeCurrentBackground(), this._createColorBackground(t);
@@ -3252,7 +3252,7 @@ class Bt {
3252
3252
  }
3253
3253
  a.set({
3254
3254
  fill: r,
3255
- backgroundId: `background-${$()}`
3255
+ backgroundId: `background-${tt()}`
3256
3256
  }), this.editor.canvas.requestRenderAll();
3257
3257
  } else
3258
3258
  this._removeCurrentBackground(), this._createGradientBackground(t);
@@ -3410,7 +3410,7 @@ class Bt {
3410
3410
  hasControls: !1,
3411
3411
  id: "background",
3412
3412
  backgroundType: "color",
3413
- backgroundId: `background-${$()}`
3413
+ backgroundId: `background-${tt()}`
3414
3414
  }, { withoutSelection: !0 }), this.refresh();
3415
3415
  }
3416
3416
  /**
@@ -3427,7 +3427,7 @@ class Bt {
3427
3427
  hasControls: !1,
3428
3428
  id: "background",
3429
3429
  backgroundType: "gradient",
3430
- backgroundId: `background-${$()}`
3430
+ backgroundId: `background-${tt()}`
3431
3431
  }, { withoutSelection: !0 }), this.refresh();
3432
3432
  const e = Bt._createFabricGradient(t);
3433
3433
  this.backgroundObject.set("fill", e), this.editor.canvas.requestRenderAll();
@@ -3455,7 +3455,7 @@ class Bt {
3455
3455
  hasControls: !1,
3456
3456
  id: "background",
3457
3457
  backgroundType: "image",
3458
- backgroundId: `background-${$()}`,
3458
+ backgroundId: `background-${tt()}`,
3459
3459
  customData: e
3460
3460
  }), this._removeCurrentBackground(), this.backgroundObject = n, this.refresh();
3461
3461
  });
@@ -3490,7 +3490,7 @@ class Bt {
3490
3490
  { offset: 1, color: "#ffffff" }
3491
3491
  ], t.type === "linear") {
3492
3492
  const u = t.angle * Math.PI / 180, f = Bt._angleToCoords(u);
3493
- return new He({
3493
+ return new Ve({
3494
3494
  type: "linear",
3495
3495
  gradientUnits: "percentage",
3496
3496
  coords: f,
@@ -3509,7 +3509,7 @@ class Bt {
3509
3509
  r1: 0,
3510
3510
  r2: l / 100
3511
3511
  };
3512
- return new He({
3512
+ return new Ve({
3513
3513
  type: "radial",
3514
3514
  gradientUnits: "percentage",
3515
3515
  coords: h,
@@ -3672,7 +3672,7 @@ class ue {
3672
3672
  });
3673
3673
  }
3674
3674
  }
3675
- class ds {
3675
+ class hs {
3676
3676
  /**
3677
3677
  * Менеджер фигур для редактора.
3678
3678
  * @param options - Опции и настройки менеджера фигур.
@@ -3698,7 +3698,7 @@ class ds {
3698
3698
  */
3699
3699
  addRectangle(l = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3700
3700
  var h = l, {
3701
- id: t = `rect-${$()}`,
3701
+ id: t = `rect-${tt()}`,
3702
3702
  left: e,
3703
3703
  top: n,
3704
3704
  width: s = 100,
@@ -3712,7 +3712,7 @@ class ds {
3712
3712
  "height",
3713
3713
  "fill"
3714
3714
  ]);
3715
- const { canvas: u } = this.editor, f = new An(L({
3715
+ const { canvas: u } = this.editor, f = new jn(x({
3716
3716
  id: t,
3717
3717
  left: e,
3718
3718
  top: n,
@@ -3740,7 +3740,7 @@ class ds {
3740
3740
  */
3741
3741
  addCircle(c = {}, { withoutSelection: a, withoutAdding: r } = {}) {
3742
3742
  var l = c, {
3743
- id: t = `circle-${$()}`,
3743
+ id: t = `circle-${tt()}`,
3744
3744
  left: e,
3745
3745
  top: n,
3746
3746
  radius: s = 50,
@@ -3752,7 +3752,7 @@ class ds {
3752
3752
  "radius",
3753
3753
  "fill"
3754
3754
  ]);
3755
- const { canvas: h } = this.editor, u = new jn(L({
3755
+ const { canvas: h } = this.editor, u = new In(x({
3756
3756
  id: t,
3757
3757
  left: e,
3758
3758
  top: n,
@@ -3780,7 +3780,7 @@ class ds {
3780
3780
  */
3781
3781
  addTriangle(l = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3782
3782
  var h = l, {
3783
- id: t = `triangle-${$()}`,
3783
+ id: t = `triangle-${tt()}`,
3784
3784
  left: e,
3785
3785
  top: n,
3786
3786
  width: s = 100,
@@ -3794,7 +3794,7 @@ class ds {
3794
3794
  "height",
3795
3795
  "fill"
3796
3796
  ]);
3797
- const { canvas: u } = this.editor, f = new In(L({
3797
+ const { canvas: u } = this.editor, f = new Cn(x({
3798
3798
  id: t,
3799
3799
  left: e,
3800
3800
  top: n,
@@ -3805,7 +3805,7 @@ class ds {
3805
3805
  return !e && !n && u.centerObject(f), c || (u.add(f), r || u.setActiveObject(f), u.renderAll()), f;
3806
3806
  }
3807
3807
  }
3808
- class hs {
3808
+ class us {
3809
3809
  /**
3810
3810
  * @param options
3811
3811
  * @param options.editor - экземпляр редактора с доступом к canvas
@@ -3904,7 +3904,7 @@ class hs {
3904
3904
  _copyTextToClipboard(t) {
3905
3905
  return Z(this, null, function* () {
3906
3906
  try {
3907
- const e = `${Qe}${t}`;
3907
+ const e = `${en}${t}`;
3908
3908
  return yield navigator.clipboard.writeText(e), console.info("Text copied to clipboard successfully"), !0;
3909
3909
  } catch (e) {
3910
3910
  const { errorManager: n } = this.editor;
@@ -3960,11 +3960,11 @@ class hs {
3960
3960
  const s = yield n.clone(re);
3961
3961
  return s instanceof X && s.forEachObject((o) => {
3962
3962
  o.set({
3963
- id: `${o.type}-${$()}`,
3963
+ id: `${o.type}-${tt()}`,
3964
3964
  evented: !0
3965
3965
  });
3966
3966
  }), s.set({
3967
- id: `${s.type}-${$()}`,
3967
+ id: `${s.type}-${tt()}`,
3968
3968
  left: s.left + 10,
3969
3969
  top: s.top + 10,
3970
3970
  evented: !0
@@ -3995,7 +3995,7 @@ class hs {
3995
3995
  return;
3996
3996
  }
3997
3997
  const n = t.getData("text/plain");
3998
- if (n && n.startsWith(Qe)) {
3998
+ if (n && n.startsWith(en)) {
3999
3999
  this.paste();
4000
4000
  return;
4001
4001
  }
@@ -4046,11 +4046,11 @@ class hs {
4046
4046
  const e = yield this.clipboard.clone(re);
4047
4047
  return t.discardActiveObject(), e instanceof X && e.forEachObject((n) => {
4048
4048
  n.set({
4049
- id: `${n.type}-${$()}`,
4049
+ id: `${n.type}-${tt()}`,
4050
4050
  evented: !0
4051
4051
  });
4052
4052
  }), e.set({
4053
- id: `${e.type}-${$()}`,
4053
+ id: `${e.type}-${tt()}`,
4054
4054
  left: e.left + 10,
4055
4055
  top: e.top + 10,
4056
4056
  evented: !0
@@ -4134,7 +4134,7 @@ class fe {
4134
4134
  return t instanceof X || t instanceof Nt;
4135
4135
  }
4136
4136
  }
4137
- class us {
4137
+ class fs {
4138
4138
  constructor({ editor: t }) {
4139
4139
  this.editor = t;
4140
4140
  }
@@ -4185,7 +4185,7 @@ class us {
4185
4185
  try {
4186
4186
  s.suspendHistory();
4187
4187
  const i = new Nt(o, {
4188
- id: `group-${$()}`
4188
+ id: `group-${tt()}`
4189
4189
  });
4190
4190
  o.forEach((r) => n.remove(r)), n.add(i), n.setActiveObject(i), n.requestRenderAll();
4191
4191
  const a = {
@@ -4235,7 +4235,7 @@ class us {
4235
4235
  }
4236
4236
  }
4237
4237
  }
4238
- class fs {
4238
+ class gs {
4239
4239
  constructor({ editor: t }) {
4240
4240
  this.editor = t;
4241
4241
  }
@@ -4250,7 +4250,7 @@ class fs {
4250
4250
  o && n.lockObject({ object: i, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(i), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: i });
4251
4251
  }
4252
4252
  }
4253
- class ke {
4253
+ class ze {
4254
4254
  constructor({ editor: t }) {
4255
4255
  this.editor = t;
4256
4256
  }
@@ -4297,7 +4297,7 @@ class ke {
4297
4297
  n || o.suspendHistory();
4298
4298
  const r = [];
4299
4299
  if (a.forEach((l) => {
4300
- if (ke._isUngroupableGroup(l)) {
4300
+ if (ze._isUngroupableGroup(l)) {
4301
4301
  const h = this._handleGroupDeletion(l);
4302
4302
  r.push(...h);
4303
4303
  return;
@@ -4458,7 +4458,7 @@ class Jt {
4458
4458
  message: i,
4459
4459
  data: s
4460
4460
  };
4461
- this._buffer.push(L({
4461
+ this._buffer.push(x({
4462
4462
  type: "editor:error"
4463
4463
  }, a)), this.editor.canvas.fire("editor:error", a);
4464
4464
  }
@@ -4486,7 +4486,7 @@ class Jt {
4486
4486
  message: i,
4487
4487
  data: o
4488
4488
  };
4489
- this._buffer.push(L({
4489
+ this._buffer.push(x({
4490
4490
  type: "editor:warning"
4491
4491
  }, a)), this.editor.canvas.fire("editor:warning", a);
4492
4492
  }
@@ -4499,7 +4499,7 @@ class Jt {
4499
4499
  return t ? Object.values(Tt).some((e) => Object.values(e).includes(t)) : !1;
4500
4500
  }
4501
4501
  }
4502
- class gs {
4502
+ class ps {
4503
4503
  constructor({ editor: t }) {
4504
4504
  this.currentBounds = null, this.editor = t;
4505
4505
  }
@@ -4555,9 +4555,9 @@ class gs {
4555
4555
  ), f = Math.max(
4556
4556
  this.currentBounds.minY,
4557
4557
  Math.min(this.currentBounds.maxY, h)
4558
- ), g = u + r - i * o, m = f + c - a * o;
4558
+ ), p = u + r - i * o, m = f + c - a * o;
4559
4559
  return {
4560
- x: g,
4560
+ x: p,
4561
4561
  y: m
4562
4562
  };
4563
4563
  }
@@ -4584,7 +4584,46 @@ class gs {
4584
4584
  this.currentBounds = this.calculatePanBounds();
4585
4585
  }
4586
4586
  }
4587
- const gt = ({
4587
+ const ms = ({ textbox: d }) => {
4588
+ var n, s;
4589
+ if (!d.isEditing) return null;
4590
+ const t = (n = d.selectionStart) != null ? n : 0, e = (s = d.selectionEnd) != null ? s : t;
4591
+ return t === e ? null : {
4592
+ start: Math.min(t, e),
4593
+ end: Math.max(t, e)
4594
+ };
4595
+ }, ys = ({ textbox: d }) => {
4596
+ var e, n;
4597
+ const t = (n = (e = d.text) == null ? void 0 : e.length) != null ? n : 0;
4598
+ return t <= 0 ? null : { start: 0, end: t };
4599
+ }, vs = ({ textbox: d, range: t }) => {
4600
+ var n, s;
4601
+ if (!t) return !1;
4602
+ const e = (s = (n = d.text) == null ? void 0 : n.length) != null ? s : 0;
4603
+ return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
4604
+ }, be = ({
4605
+ textbox: d,
4606
+ styles: t,
4607
+ range: e
4608
+ }) => {
4609
+ if (!t || !Object.keys(t).length) return !1;
4610
+ const { start: n, end: s } = e;
4611
+ return s <= n ? !1 : (d.setSelectionStyles(t, n, s), !0);
4612
+ }, sn = ({
4613
+ textbox: d,
4614
+ range: t,
4615
+ property: e
4616
+ }) => {
4617
+ var s;
4618
+ if (!t) return;
4619
+ const n = d.getSelectionStyles(
4620
+ t.start,
4621
+ t.end,
4622
+ !0
4623
+ );
4624
+ if (n.length)
4625
+ return (s = n[0]) == null ? void 0 : s[e];
4626
+ }, Ee = ({ strokeColor: d, width: t }) => t <= 0 ? null : d != null ? d : "#000000", Le = ({ width: d = 0 }) => d ? Math.max(0, d) : 0, Me = ({ value: d }) => typeof d == "string" ? d.toLocaleUpperCase() : "", gt = ({
4588
4627
  value: d,
4589
4628
  min: t,
4590
4629
  max: e
@@ -4613,7 +4652,7 @@ const gt = ({
4613
4652
  }
4614
4653
  _getTransformedDimensions(t = {}) {
4615
4654
  const { width: e, height: n } = this._getBackgroundDimensions();
4616
- return super._getTransformedDimensions(It(L({}, t), {
4655
+ return super._getTransformedDimensions(It(x({}, t), {
4617
4656
  width: e,
4618
4657
  height: n
4619
4658
  }));
@@ -4623,7 +4662,7 @@ const gt = ({
4623
4662
  */
4624
4663
  toObject(t = []) {
4625
4664
  const e = super.toObject(t);
4626
- return It(L({}, e), {
4665
+ return It(x({}, e), {
4627
4666
  backgroundOpacity: this.backgroundOpacity,
4628
4667
  lineFontDefaults: this.lineFontDefaults,
4629
4668
  paddingTop: this.paddingTop,
@@ -4651,6 +4690,83 @@ const gt = ({
4651
4690
  }), t.fillStyle = e, t.fill(), t.restore();
4652
4691
  }
4653
4692
  }
4693
+ /**
4694
+ * Рисует линии декорации текста с учетом активной обводки или заливки.
4695
+ */
4696
+ _renderTextDecoration(t, e) {
4697
+ if (!this[e] && !this.styleHas(e))
4698
+ return;
4699
+ const {
4700
+ direction: n,
4701
+ fontSize: s,
4702
+ lineHeight: o,
4703
+ offsets: i,
4704
+ width: a,
4705
+ _fontSizeFraction: r,
4706
+ _textLines: c
4707
+ } = this;
4708
+ let l = this._getTopOffset();
4709
+ const h = this._getLeftOffset(), { path: u } = this, f = this._getWidthOfCharSpacing(), p = i[e];
4710
+ let m = 0;
4711
+ e === "linethrough" ? m = 0.5 : e === "overline" && (m = 1);
4712
+ for (let g = 0, v = c.length; g < v; g += 1) {
4713
+ const M = this.getHeightOfLine(g);
4714
+ if (!this[e] && !this.styleHas(e, g)) {
4715
+ l += M;
4716
+ continue;
4717
+ }
4718
+ const C = c[g], y = M / o, w = this._getLineLeftOffset(g);
4719
+ let j = 0, T = 0, b = this.getValueOfPropertyAt(g, 0, e), A = this._getDecorationColorAt(g, 0), S = this.getValueOfPropertyAt(g, 0, "textDecorationThickness"), I = b, O = A, N = S;
4720
+ const W = l + y * (1 - r);
4721
+ let z = this.getHeightOfChar(g, 0), E = this.getValueOfPropertyAt(g, 0, "deltaY");
4722
+ for (let R = 0, U = C.length; R < U; R += 1) {
4723
+ const D = this.__charBounds[g][R];
4724
+ I = this.getValueOfPropertyAt(g, R, e), O = this._getDecorationColorAt(g, R), N = this.getValueOfPropertyAt(g, R, "textDecorationThickness");
4725
+ const k = this.getHeightOfChar(g, R), _ = this.getValueOfPropertyAt(g, R, "deltaY");
4726
+ if (u && I && O) {
4727
+ const L = s * N / 1e3;
4728
+ t.save(), t.fillStyle = A, t.translate(D.renderLeft, D.renderTop), t.rotate(D.angle), t.fillRect(
4729
+ -D.kernedWidth / 2,
4730
+ p * k + _ - m * L,
4731
+ D.kernedWidth,
4732
+ L
4733
+ ), t.restore();
4734
+ } else if ((I !== b || O !== A || k !== z || N !== S || _ !== E) && T > 0) {
4735
+ const L = s * S / 1e3;
4736
+ let J = h + w + j;
4737
+ n === "rtl" && (J = a - J - T), b && A && S && (t.fillStyle = A, t.fillRect(
4738
+ J,
4739
+ W + p * z + E - m * L,
4740
+ T,
4741
+ L
4742
+ )), j = D.left, T = D.width, b = I, S = N, A = O, z = k, E = _;
4743
+ } else
4744
+ T += D.kernedWidth;
4745
+ }
4746
+ let B = h + w + j;
4747
+ n === "rtl" && (B = a - B - T), t.fillStyle = O;
4748
+ const Y = s * N / 1e3;
4749
+ I && O && N && t.fillRect(
4750
+ B,
4751
+ W + p * z + E - m * Y,
4752
+ T - f,
4753
+ Y
4754
+ ), l += M;
4755
+ }
4756
+ this._removeShadow(t);
4757
+ }
4758
+ /**
4759
+ * Возвращает цвет линии декорации для символа, учитывая обводку и заливку.
4760
+ */
4761
+ _getDecorationColorAt(t, e) {
4762
+ const n = this.getValueOfPropertyAt(t, e, "strokeWidth"), s = Le({
4763
+ width: typeof n == "number" && Number.isFinite(n) ? n : 0
4764
+ }), o = this.getValueOfPropertyAt(t, e, "stroke"), i = o == null ? null : Ee({ strokeColor: o, width: s });
4765
+ if (s > 0 && i != null)
4766
+ return i;
4767
+ const a = this.getValueOfPropertyAt(t, e, "fill");
4768
+ return a != null ? a : null;
4769
+ }
4654
4770
  _getBackgroundDimensions() {
4655
4771
  var s, o, i, a;
4656
4772
  const t = (o = (s = this.width) != null ? s : this.calcTextWidth()) != null ? o : 0, e = (a = (i = this.height) != null ? i : this.calcTextHeight()) != null ? a : 0, n = this._getPadding();
@@ -4685,7 +4801,7 @@ const gt = ({
4685
4801
  const e = gt({ value: (s = this.backgroundOpacity) != null ? s : 1, min: 0, max: 1 });
4686
4802
  let n;
4687
4803
  try {
4688
- n = new Cn(t);
4804
+ n = new Tn(t);
4689
4805
  } catch (o) {
4690
4806
  return Jt.emitError({
4691
4807
  origin: "BackgroundTextbox",
@@ -4710,8 +4826,8 @@ const gt = ({
4710
4826
  topRight: l,
4711
4827
  bottomRight: h,
4712
4828
  bottomLeft: u
4713
- } = s, f = gt({ value: c, min: 0, max: i }), g = gt({ value: l, min: 0, max: i }), m = gt({ value: h, min: 0, max: i }), p = gt({ value: u, min: 0, max: i });
4714
- t.beginPath(), t.moveTo(n + f, o), t.lineTo(a - g, o), t.quadraticCurveTo(a, o, a, o + g), t.lineTo(a, r - m), t.quadraticCurveTo(a, r, a - m, r), t.lineTo(n + p, r), t.quadraticCurveTo(n, r, n, r - p), t.lineTo(n, o + f), t.quadraticCurveTo(n, o, n + f, o), t.closePath();
4829
+ } = s, f = gt({ value: c, min: 0, max: i }), p = gt({ value: l, min: 0, max: i }), m = gt({ value: h, min: 0, max: i }), g = gt({ value: u, min: 0, max: i });
4830
+ t.beginPath(), t.moveTo(n + f, o), t.lineTo(a - p, o), t.quadraticCurveTo(a, o, a, o + p), t.lineTo(a, r - m), t.quadraticCurveTo(a, r, a - m, r), t.lineTo(n + g, r), t.quadraticCurveTo(n, r, n, r - g), t.lineTo(n, o + f), t.quadraticCurveTo(n, o, n + f, o), t.closePath();
4715
4831
  }
4716
4832
  /**
4717
4833
  * Округляет текущие значения ширины и высоты до ближайших целых.
@@ -4752,10 +4868,10 @@ Pt.type = "background-textbox", Pt.cacheProperties = [
4752
4868
  "radiusBottomLeft"
4753
4869
  ];
4754
4870
  let ge = Pt;
4755
- const ps = () => {
4871
+ const bs = () => {
4756
4872
  var d;
4757
- (d = Ze) != null && d.setClass && Ze.setClass(ge, "background-textbox");
4758
- }, it = 0.01, tn = ({
4873
+ (d = Xe) != null && d.setClass && Xe.setClass(ge, "background-textbox");
4874
+ }, it = 0.01, on = ({
4759
4875
  textbox: d,
4760
4876
  lineIndices: t,
4761
4877
  updates: e
@@ -4773,12 +4889,12 @@ const ps = () => {
4773
4889
  for (let u = 0; u < t.length; u += 1) {
4774
4890
  const f = t[u];
4775
4891
  if (!Number.isFinite(f)) continue;
4776
- const g = h ? c[f] : r == null ? void 0 : r[f], m = g ? L({}, g) : {};
4777
- let p = !1;
4778
- n !== void 0 && (g == null ? void 0 : g.fontFamily) !== n && (m.fontFamily = n, p = !0), s !== void 0 && (g == null ? void 0 : g.fontSize) !== s && (m.fontSize = s, p = !0), o !== void 0 && (g == null ? void 0 : g.fill) !== o && (m.fill = o, p = !0), i !== void 0 && (i === null && (g == null ? void 0 : g.stroke) !== void 0 && (delete m.stroke, p = !0), i !== null && (g == null ? void 0 : g.stroke) !== i && (m.stroke = i, p = !0)), p && (h || (c = L({}, c), h = !0), c[f] = m, l = !0);
4892
+ const p = h ? c[f] : r == null ? void 0 : r[f], m = p ? x({}, p) : {};
4893
+ let g = !1;
4894
+ n !== void 0 && (p == null ? void 0 : p.fontFamily) !== n && (m.fontFamily = n, g = !0), s !== void 0 && (p == null ? void 0 : p.fontSize) !== s && (m.fontSize = s, g = !0), o !== void 0 && (p == null ? void 0 : p.fill) !== o && (m.fill = o, g = !0), i !== void 0 && (i === null && (p == null ? void 0 : p.stroke) !== void 0 && (delete m.stroke, g = !0), i !== null && (p == null ? void 0 : p.stroke) !== i && (m.stroke = i, g = !0)), g && (h || (c = x({}, c), h = !0), c[f] = m, l = !0);
4779
4895
  }
4780
4896
  return l && (d.lineFontDefaults = c), l;
4781
- }, ms = ({
4897
+ }, Ms = ({
4782
4898
  lineText: d,
4783
4899
  lineStyles: t,
4784
4900
  lineDefaults: e
@@ -4800,23 +4916,23 @@ const ps = () => {
4800
4916
  if (t)
4801
4917
  for (const f in t) {
4802
4918
  if (!Object.prototype.hasOwnProperty.call(t, f)) continue;
4803
- const g = Number(f);
4804
- Number.isInteger(g) && g >= 0 && g < n || (u || (l = L({}, t), u = !0), l && Object.prototype.hasOwnProperty.call(l, f) && delete l[f], h = !0);
4919
+ const p = Number(f);
4920
+ Number.isInteger(p) && p >= 0 && p < n || (u || (l = x({}, t), u = !0), l && Object.prototype.hasOwnProperty.call(l, f) && delete l[f], h = !0);
4805
4921
  }
4806
4922
  for (let f = 0; f < n; f += 1) {
4807
- const g = l != null ? l : t, m = g ? g[f] : void 0;
4923
+ const p = l != null ? l : t, m = p ? p[f] : void 0;
4808
4924
  if (!m) {
4809
- l || (l = {}, u = !0), u || (l = L({}, l), u = !0), l[f] = L({}, c), h = !0;
4925
+ l || (l = {}, u = !0), u || (l = x({}, l), u = !0), l[f] = x({}, c), h = !0;
4810
4926
  continue;
4811
4927
  }
4812
- let p = null;
4813
- s !== void 0 && m.fontFamily === void 0 && (p = L({}, m), p.fontFamily = s), o !== void 0 && m.fontSize === void 0 && (p || (p = L({}, m)), p.fontSize = o), i !== void 0 && m.fill === void 0 && (p || (p = L({}, m)), p.fill = i), a !== void 0 && m.stroke === void 0 && (p || (p = L({}, m)), p.stroke = a), p && (l || (l = {}, u = !0), u || (l = L({}, l), u = !0), l[f] = p, h = !0);
4928
+ let g = null;
4929
+ s !== void 0 && m.fontFamily === void 0 && (g = x({}, m), g.fontFamily = s), o !== void 0 && m.fontSize === void 0 && (g || (g = x({}, m)), g.fontSize = o), i !== void 0 && m.fill === void 0 && (g || (g = x({}, m)), g.fill = i), a !== void 0 && m.stroke === void 0 && (g || (g = x({}, m)), g.stroke = a), g && (l || (l = {}, u = !0), u || (l = x({}, l), u = !0), l[f] = g, h = !0);
4814
4930
  }
4815
4931
  return {
4816
4932
  lineStyles: l,
4817
4933
  changed: h
4818
4934
  };
4819
- }, en = ({
4935
+ }, an = ({
4820
4936
  lineFontDefaults: d
4821
4937
  }) => {
4822
4938
  if (!d) return;
@@ -4826,10 +4942,10 @@ const ps = () => {
4826
4942
  const n = Number(e);
4827
4943
  if (!Number.isFinite(n)) continue;
4828
4944
  const s = d[n];
4829
- s && (t[n] = L({}, s));
4945
+ s && (t[n] = x({}, s));
4830
4946
  }
4831
4947
  return t;
4832
- }, nn = ({
4948
+ }, rn = ({
4833
4949
  lineFontDefaults: d,
4834
4950
  scale: t
4835
4951
  }) => {
@@ -4842,12 +4958,12 @@ const ps = () => {
4842
4958
  if (!Number.isFinite(i)) continue;
4843
4959
  const a = d[i];
4844
4960
  if (!a) continue;
4845
- const r = L({}, a);
4961
+ const r = x({}, a);
4846
4962
  typeof a.fontSize == "number" && (r.fontSize = Math.max(1, a.fontSize * t), s = !0), e[i] = r, n = !0;
4847
4963
  }
4848
4964
  if (!(!n || !s))
4849
4965
  return e;
4850
- }, ys = ({
4966
+ }, Ss = ({
4851
4967
  textbox: d
4852
4968
  }) => {
4853
4969
  var o, i;
@@ -4861,7 +4977,7 @@ const ps = () => {
4861
4977
  s = l + 1, n.push({ start: c, end: l });
4862
4978
  }
4863
4979
  return n;
4864
- }, vs = ({
4980
+ }, ws = ({
4865
4981
  range: d,
4866
4982
  text: t
4867
4983
  }) => {
@@ -4870,11 +4986,11 @@ const ps = () => {
4870
4986
  if (e <= 0) return null;
4871
4987
  const { start: n, end: s } = d, o = Number.isFinite(n) ? n : 0, i = Number.isFinite(s) ? s : o, a = Math.max(0, Math.min(o, e)), r = Math.max(0, Math.min(i, e)), c = Math.min(a, r), l = Math.max(a, r);
4872
4988
  return c === l ? null : { start: c, end: l };
4873
- }, bs = ({
4989
+ }, As = ({
4874
4990
  textbox: d,
4875
4991
  range: t
4876
4992
  }) => {
4877
- const e = ys({ textbox: d });
4993
+ const e = Ss({ textbox: d });
4878
4994
  if (!e.length) return t;
4879
4995
  let { start: n } = t, { end: s } = t;
4880
4996
  for (let o = 0; o < e.length; o += 1) {
@@ -4884,7 +5000,7 @@ const ps = () => {
4884
5000
  t.end > a && t.start < r && (n = Math.min(n, a), s = Math.max(s, r));
4885
5001
  }
4886
5002
  return { start: n, end: s };
4887
- }, Ms = ({
5003
+ }, js = ({
4888
5004
  textbox: d,
4889
5005
  range: t
4890
5006
  }) => {
@@ -4899,7 +5015,7 @@ const ps = () => {
4899
5015
  s > u && n < f && i.push(l), a = f + 1;
4900
5016
  }
4901
5017
  return i;
4902
- }, Ss = ({
5018
+ }, Is = ({
4903
5019
  textbox: d,
4904
5020
  range: t
4905
5021
  }) => {
@@ -4914,7 +5030,7 @@ const ps = () => {
4914
5030
  n <= u && s >= f && i.push(l), a = f + 1;
4915
5031
  }
4916
5032
  return i;
4917
- }, ws = ({
5033
+ }, Cs = ({
4918
5034
  previous: d,
4919
5035
  next: t
4920
5036
  }) => {
@@ -4922,7 +5038,7 @@ const ps = () => {
4922
5038
  for (let n = 0; n < e; n += 1)
4923
5039
  if (d[n] !== t[n]) return n;
4924
5040
  return e;
4925
- }, As = ({
5041
+ }, Ts = ({
4926
5042
  text: d,
4927
5043
  charIndex: t
4928
5044
  }) => {
@@ -4932,7 +5048,7 @@ const ps = () => {
4932
5048
  d[s] === `
4933
5049
  ` && (n += 1);
4934
5050
  return n;
4935
- }, js = ({
5051
+ }, Os = ({
4936
5052
  text: d,
4937
5053
  lineIndex: t
4938
5054
  }) => {
@@ -4943,7 +5059,7 @@ const ps = () => {
4943
5059
  ` && (e += 1, e === t))
4944
5060
  return n + 1;
4945
5061
  return d.length;
4946
- }, Is = ({
5062
+ }, Es = ({
4947
5063
  textbox: d,
4948
5064
  text: t
4949
5065
  }) => {
@@ -4955,7 +5071,7 @@ const ps = () => {
4955
5071
  i > s && (s = i);
4956
5072
  }
4957
5073
  return s;
4958
- }, Cs = ({
5074
+ }, Ls = ({
4959
5075
  textbox: d,
4960
5076
  montageLeft: t,
4961
5077
  montageRight: e
@@ -4967,10 +5083,10 @@ const ps = () => {
4967
5083
  return !1;
4968
5084
  let a = 0;
4969
5085
  return s < t ? a = t - s : o > e && (a = e - o), Math.abs(a) <= it ? !1 : (d.set({ left: ((h = d.left) != null ? h : 0) + a }), !0);
4970
- }, sn = ({
5086
+ }, cn = ({
4971
5087
  rawValue: d,
4972
5088
  calculatedValue: t
4973
- }) => typeof d == "number" ? d : typeof t == "number" ? t : 0, on = ({
5089
+ }) => typeof d == "number" ? d : typeof t == "number" ? t : 0, ln = ({
4974
5090
  stylesList: d
4975
5091
  }) => {
4976
5092
  const t = d.length;
@@ -4992,54 +5108,15 @@ const ps = () => {
4992
5108
  }, Ct = ({
4993
5109
  textbox: d
4994
5110
  }) => {
4995
- const { width: t, height: e, calcTextWidth: n, calcTextHeight: s } = d, o = typeof n == "function" ? n.call(d) : void 0, i = typeof s == "function" ? s.call(d) : void 0, a = sn({
5111
+ const { width: t, height: e, calcTextWidth: n, calcTextHeight: s } = d, o = typeof n == "function" ? n.call(d) : void 0, i = typeof s == "function" ? s.call(d) : void 0, a = cn({
4996
5112
  rawValue: t,
4997
5113
  calculatedValue: o
4998
- }), r = sn({
5114
+ }), r = cn({
4999
5115
  rawValue: e,
5000
5116
  calculatedValue: i
5001
5117
  }), c = Number.isFinite(a) ? Math.round(a) : null, l = Number.isFinite(r) ? Math.round(r) : null, h = {};
5002
5118
  return c !== null && c !== a && (h.width = Math.max(0, c)), l !== null && l !== r && (h.height = Math.max(0, l)), Object.keys(h).length ? (d.set(h), !0) : !1;
5003
- }, Ts = ({ textbox: d }) => {
5004
- var n, s;
5005
- if (!d.isEditing) return null;
5006
- const t = (n = d.selectionStart) != null ? n : 0, e = (s = d.selectionEnd) != null ? s : t;
5007
- return t === e ? null : {
5008
- start: Math.min(t, e),
5009
- end: Math.max(t, e)
5010
- };
5011
- }, Os = ({ textbox: d }) => {
5012
- var e, n;
5013
- const t = (n = (e = d.text) == null ? void 0 : e.length) != null ? n : 0;
5014
- return t <= 0 ? null : { start: 0, end: t };
5015
- }, Es = ({ textbox: d, range: t }) => {
5016
- var n, s;
5017
- if (!t) return !1;
5018
- const e = (s = (n = d.text) == null ? void 0 : n.length) != null ? s : 0;
5019
- return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
5020
- }, ve = ({
5021
- textbox: d,
5022
- styles: t,
5023
- range: e
5024
- }) => {
5025
- if (!t || !Object.keys(t).length) return !1;
5026
- const { start: n, end: s } = e;
5027
- return s <= n ? !1 : (d.setSelectionStyles(t, n, s), !0);
5028
- }, an = ({
5029
- textbox: d,
5030
- range: t,
5031
- property: e
5032
- }) => {
5033
- var s;
5034
- if (!t) return;
5035
- const n = d.getSelectionStyles(
5036
- t.start,
5037
- t.end,
5038
- !0
5039
- );
5040
- if (n.length)
5041
- return (s = n[0]) == null ? void 0 : s[e];
5042
- }, rn = ({ strokeColor: d, width: t }) => t <= 0 ? null : d != null ? d : "#000000", cn = ({ width: d = 0 }) => d ? Math.max(0, d) : 0, be = ({ value: d }) => typeof d == "string" ? d.toLocaleUpperCase() : "";
5119
+ };
5043
5120
  class st {
5044
5121
  constructor({ editor: t }) {
5045
5122
  var e;
@@ -5061,7 +5138,7 @@ class st {
5061
5138
  if (!st._isTextbox(s) || this.lineDefaultsSyncing.has(s)) return;
5062
5139
  const { text: o = "", uppercase: i, autoExpand: a } = s, r = !!i, c = a !== !1, l = o.toLocaleLowerCase();
5063
5140
  if (r) {
5064
- const f = be({ value: l });
5141
+ const f = Me({ value: l });
5065
5142
  f !== o && s.set({ text: f }), s.textCaseRaw = l;
5066
5143
  } else
5067
5144
  s.textCaseRaw = o;
@@ -5087,11 +5164,11 @@ class st {
5087
5164
  });
5088
5165
  const { historyManager: r } = this.editor;
5089
5166
  r.endAction({ reason: "text-edit" }), r.scheduleSaveState({
5090
- delayMs: ss,
5167
+ delayMs: is,
5091
5168
  reason: "text-edit"
5092
5169
  });
5093
5170
  }, this._handleObjectScaling = (n) => {
5094
- var $t, pe, te, ee, ne, xt, me, se, Yt, Ht, Zt, Gt, Vt;
5171
+ var $t, me, te, ee, ne, xt, ye, se, Yt, Ht, Zt, Gt, Vt;
5095
5172
  const { target: s, transform: o } = n;
5096
5173
  if (s instanceof X || !st._isTextbox(s) || !o) return;
5097
5174
  s.isScaling = !0;
@@ -5103,75 +5180,75 @@ class st {
5103
5180
  baseRadii: h,
5104
5181
  baseStyles: u,
5105
5182
  baseLineFontDefaults: f
5106
- } = i, g = typeof (($t = o.original) == null ? void 0 : $t.width) == "number" ? o.original.width : void 0, m = typeof ((pe = o.original) == null ? void 0 : pe.left) == "number" ? o.original.left : void 0, p = g != null ? g : a, v = m != null ? m : r, M = (te = o.corner) != null ? te : "", j = (ee = o.action) != null ? ee : "", y = ["ml", "mr"].includes(M) || j === "scaleX", w = ["mt", "mb"].includes(M) || j === "scaleY", I = ["tl", "tr", "bl", "br"].includes(M) || j === "scale", C = I || w;
5107
- if (!y && !w && !I) return;
5108
- const b = Math.abs((xt = (ne = s.scaleX) != null ? ne : o.scaleX) != null ? xt : 1) || 1, A = Math.abs((se = (me = s.scaleY) != null ? me : o.scaleY) != null ? se : 1) || 1, S = Math.max(1, p * b), T = Math.max(1, Math.round(S)), O = Math.max(1, c * A), {
5109
- paddingTop: P = 0,
5110
- paddingRight: U = 0,
5111
- paddingBottom: F = 0,
5183
+ } = i, p = typeof (($t = o.original) == null ? void 0 : $t.width) == "number" ? o.original.width : void 0, m = typeof ((me = o.original) == null ? void 0 : me.left) == "number" ? o.original.left : void 0, g = p != null ? p : a, v = m != null ? m : r, M = (te = o.corner) != null ? te : "", C = (ee = o.action) != null ? ee : "", y = ["ml", "mr"].includes(M) || C === "scaleX", w = ["mt", "mb"].includes(M) || C === "scaleY", j = ["tl", "tr", "bl", "br"].includes(M) || C === "scale", T = j || w;
5184
+ if (!y && !w && !j) return;
5185
+ const b = Math.abs((xt = (ne = s.scaleX) != null ? ne : o.scaleX) != null ? xt : 1) || 1, A = Math.abs((se = (ye = s.scaleY) != null ? ye : o.scaleY) != null ? se : 1) || 1, S = Math.max(1, g * b), I = Math.max(1, Math.round(S)), O = Math.max(1, c * A), {
5186
+ paddingTop: N = 0,
5187
+ paddingRight: W = 0,
5188
+ paddingBottom: z = 0,
5112
5189
  paddingLeft: E = 0,
5113
5190
  radiusTopLeft: B = 0,
5114
- radiusTopRight: H = 0,
5115
- radiusBottomRight: z = 0,
5116
- radiusBottomLeft: W = 0,
5117
- fontSize: x,
5118
- width: R,
5191
+ radiusTopRight: Y = 0,
5192
+ radiusBottomRight: R = 0,
5193
+ radiusBottomLeft: U = 0,
5194
+ fontSize: D,
5195
+ width: k,
5119
5196
  originX: _ = "left"
5120
- } = s, D = I || w, et = I || w, G = D ? {
5197
+ } = s, L = j || w, J = j || w, G = L ? {
5121
5198
  top: Math.max(0, l.top * A),
5122
5199
  right: Math.max(0, l.right * A),
5123
5200
  bottom: Math.max(0, l.bottom * A),
5124
5201
  left: Math.max(0, l.left * A)
5125
- } : l, J = et ? {
5202
+ } : l, Q = J ? {
5126
5203
  topLeft: Math.max(0, h.topLeft * A),
5127
5204
  topRight: Math.max(0, h.topRight * A),
5128
5205
  bottomRight: Math.max(0, h.bottomRight * A),
5129
5206
  bottomLeft: Math.max(0, h.bottomLeft * A)
5130
- } : h, Q = Object.keys(u).length > 0;
5207
+ } : h, $ = Object.keys(u).length > 0;
5131
5208
  let ot;
5132
- if (C && Q) {
5209
+ if (T && $) {
5133
5210
  const Rt = {};
5134
5211
  Object.entries(u).forEach(([ie, q]) => {
5135
5212
  if (!q) return;
5136
5213
  const nt = {};
5137
- Object.entries(q).forEach(([ye, kt]) => {
5214
+ Object.entries(q).forEach(([ve, kt]) => {
5138
5215
  if (!kt) return;
5139
- const Be = L({}, kt);
5140
- typeof kt.fontSize == "number" && (Be.fontSize = Math.max(1, kt.fontSize * A)), nt[ye] = Be;
5216
+ const Fe = x({}, kt);
5217
+ typeof kt.fontSize == "number" && (Fe.fontSize = Math.max(1, kt.fontSize * A)), nt[ve] = Fe;
5141
5218
  }), Object.keys(nt).length && (Rt[ie] = nt);
5142
5219
  }), Object.keys(Rt).length && (ot = Rt);
5143
5220
  }
5144
5221
  let ht;
5145
- C && (ht = nn({
5222
+ T && (ht = rn({
5146
5223
  lineFontDefaults: f,
5147
5224
  scale: A
5148
5225
  }));
5149
- const vt = (Ht = (Yt = o.originX) != null ? Yt : _) != null ? Ht : "left", rt = v + p, ct = v + p / 2, At = R != null ? R : p, bt = T !== At, Lt = Math.abs(O - (x != null ? x : c)) > it, Dt = Math.abs(G.top - P) > it || Math.abs(G.right - U) > it || Math.abs(G.bottom - F) > it || Math.abs(G.left - E) > it, _t = Math.abs(J.topLeft - B) > it || Math.abs(J.topRight - H) > it || Math.abs(J.bottomRight - z) > it || Math.abs(J.bottomLeft - W) > it;
5226
+ const vt = (Ht = (Yt = o.originX) != null ? Yt : _) != null ? Ht : "left", rt = v + g, ct = v + g / 2, At = k != null ? k : g, bt = I !== At, Lt = Math.abs(O - (D != null ? D : c)) > it, Dt = Math.abs(G.top - N) > it || Math.abs(G.right - W) > it || Math.abs(G.bottom - z) > it || Math.abs(G.left - E) > it, _t = Math.abs(Q.topLeft - B) > it || Math.abs(Q.topRight - Y) > it || Math.abs(Q.bottomRight - R) > it || Math.abs(Q.bottomLeft - U) > it;
5150
5227
  if (!bt && !Lt && !Dt && !_t) {
5151
5228
  s.set({ scaleX: 1, scaleY: 1 }), o.scaleX = 1, o.scaleY = 1;
5152
5229
  return;
5153
5230
  }
5154
5231
  ot && (s.styles = ot), ht && (s.lineFontDefaults = ht), s.set({
5155
- width: T,
5156
- fontSize: C ? O : c,
5232
+ width: I,
5233
+ fontSize: T ? O : c,
5157
5234
  paddingTop: G.top,
5158
5235
  paddingRight: G.right,
5159
5236
  paddingBottom: G.bottom,
5160
5237
  paddingLeft: G.left,
5161
- radiusTopLeft: J.topLeft,
5162
- radiusTopRight: J.topRight,
5163
- radiusBottomRight: J.bottomRight,
5164
- radiusBottomLeft: J.bottomLeft,
5238
+ radiusTopLeft: Q.topLeft,
5239
+ radiusTopRight: Q.topRight,
5240
+ radiusBottomRight: Q.bottomRight,
5241
+ radiusBottomLeft: Q.bottomLeft,
5165
5242
  scaleX: 1,
5166
5243
  scaleY: 1
5167
5244
  });
5168
- const Wt = Ct({ textbox: s });
5169
- Wt && (s.dirty = !0);
5170
- const ut = (Zt = s.width) != null ? Zt : T, Qt = ut !== At;
5245
+ const Ut = Ct({ textbox: s });
5246
+ Ut && (s.dirty = !0);
5247
+ const ut = (Zt = s.width) != null ? Zt : I, Qt = ut !== At;
5171
5248
  let jt = v;
5172
- Qt && (y || I) && (vt === "right" ? jt = rt - ut : vt === "center" && (jt = ct - ut / 2)), s.set({ left: jt }), i.baseLeft = jt, o.scaleX = 1, o.scaleY = 1;
5249
+ Qt && (y || j) && (vt === "right" ? jt = rt - ut : vt === "center" && (jt = ct - ut / 2)), s.set({ left: jt }), i.baseLeft = jt, o.scaleX = 1, o.scaleY = 1;
5173
5250
  const { original: ft } = o;
5174
- ft && (ft.scaleX = 1, ft.scaleY = 1, ft.width = ut, ft.height = s.height, ft.left = jt), s.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = ut, i.baseFontSize = (Gt = s.fontSize) != null ? Gt : O, i.baseStyles = JSON.parse(JSON.stringify((Vt = s.styles) != null ? Vt : {})), i.baseLineFontDefaults = en({
5251
+ ft && (ft.scaleX = 1, ft.scaleY = 1, ft.width = ut, ft.height = s.height, ft.left = jt), s.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = ut, i.baseFontSize = (Gt = s.fontSize) != null ? Gt : O, i.baseStyles = JSON.parse(JSON.stringify((Vt = s.styles) != null ? Vt : {})), i.baseLineFontDefaults = an({
5175
5252
  lineFontDefaults: s.lineFontDefaults
5176
5253
  }), i.basePadding = {
5177
5254
  top: G.top,
@@ -5179,55 +5256,55 @@ class st {
5179
5256
  bottom: G.bottom,
5180
5257
  left: G.left
5181
5258
  }, i.baseRadii = {
5182
- topLeft: J.topLeft,
5183
- topRight: J.topRight,
5184
- bottomRight: J.bottomRight,
5185
- bottomLeft: J.bottomLeft
5186
- }, i.hasWidthChange = Qt || Lt || Dt || _t || Wt;
5259
+ topLeft: Q.topLeft,
5260
+ topRight: Q.topRight,
5261
+ bottomRight: Q.bottomRight,
5262
+ bottomLeft: Q.bottomLeft
5263
+ }, i.hasWidthChange = Qt || Lt || Dt || _t || Ut;
5187
5264
  }, this._handleObjectModified = (n) => {
5188
- var M, j, y;
5265
+ var M, C, y;
5189
5266
  const { target: s } = n;
5190
5267
  if (s instanceof X) {
5191
5268
  const w = s.getObjects();
5192
5269
  if (!w.some((S) => st._isTextbox(S))) return;
5193
- const { scaleX: C = 1, scaleY: b = 1 } = s;
5194
- if (Math.abs(C - 1) < it && Math.abs(b - 1) < it) return;
5270
+ const { scaleX: T = 1, scaleY: b = 1 } = s;
5271
+ if (Math.abs(T - 1) < it && Math.abs(b - 1) < it) return;
5195
5272
  this.canvas.discardActiveObject(), w.forEach((S) => {
5196
- var T, O, P, U;
5273
+ var I, O, N, W;
5197
5274
  if (st._isTextbox(S)) {
5198
- const F = (T = S.scaleX) != null ? T : 1, E = (O = S.scaleY) != null ? O : 1, B = ((P = S.fontSize) != null ? P : 16) * E, H = ((U = S.width) != null ? U : 0) * F, z = E, {
5199
- paddingTop: W = 0,
5200
- paddingRight: x = 0,
5201
- paddingBottom: R = 0,
5275
+ const z = (I = S.scaleX) != null ? I : 1, E = (O = S.scaleY) != null ? O : 1, B = ((N = S.fontSize) != null ? N : 16) * E, Y = ((W = S.width) != null ? W : 0) * z, R = E, {
5276
+ paddingTop: U = 0,
5277
+ paddingRight: D = 0,
5278
+ paddingBottom: k = 0,
5202
5279
  paddingLeft: _ = 0,
5203
- radiusTopLeft: D = 0,
5204
- radiusTopRight: et = 0,
5280
+ radiusTopLeft: L = 0,
5281
+ radiusTopRight: J = 0,
5205
5282
  radiusBottomRight: G = 0,
5206
- radiusBottomLeft: J = 0,
5207
- styles: Q
5283
+ radiusBottomLeft: Q = 0,
5284
+ styles: $
5208
5285
  } = S, ot = {
5209
- paddingTop: Math.max(0, W * z),
5210
- paddingRight: Math.max(0, x * z),
5211
- paddingBottom: Math.max(0, R * z),
5212
- paddingLeft: Math.max(0, _ * z)
5286
+ paddingTop: Math.max(0, U * R),
5287
+ paddingRight: Math.max(0, D * R),
5288
+ paddingBottom: Math.max(0, k * R),
5289
+ paddingLeft: Math.max(0, _ * R)
5213
5290
  }, ht = {
5214
- radiusTopLeft: Math.max(0, D * z),
5215
- radiusTopRight: Math.max(0, et * z),
5216
- radiusBottomRight: Math.max(0, G * z),
5217
- radiusBottomLeft: Math.max(0, J * z)
5291
+ radiusTopLeft: Math.max(0, L * R),
5292
+ radiusTopRight: Math.max(0, J * R),
5293
+ radiusBottomRight: Math.max(0, G * R),
5294
+ radiusBottomLeft: Math.max(0, Q * R)
5218
5295
  };
5219
- let vt = Q;
5220
- Q && Object.keys(Q).length > 0 && (vt = JSON.parse(JSON.stringify(Q)), Object.values(vt).forEach((At) => {
5296
+ let vt = $;
5297
+ $ && Object.keys($).length > 0 && (vt = JSON.parse(JSON.stringify($)), Object.values(vt).forEach((At) => {
5221
5298
  Object.values(At).forEach((bt) => {
5222
- typeof bt.fontSize == "number" && (bt.fontSize = Math.max(1, bt.fontSize * z));
5299
+ typeof bt.fontSize == "number" && (bt.fontSize = Math.max(1, bt.fontSize * R));
5223
5300
  });
5224
5301
  }));
5225
- const rt = nn({
5302
+ const rt = rn({
5226
5303
  lineFontDefaults: S.lineFontDefaults,
5227
- scale: z
5228
- }), ct = It(L(L({
5304
+ scale: R
5305
+ }), ct = It(x(x({
5229
5306
  fontSize: B,
5230
- width: H,
5307
+ width: Y,
5231
5308
  scaleX: 1,
5232
5309
  scaleY: 1
5233
5310
  }, ot), ht), {
@@ -5247,15 +5324,15 @@ class st {
5247
5324
  s.isScaling = !1;
5248
5325
  const o = this.scalingState.get(s);
5249
5326
  if (this.scalingState.delete(s), !(o != null && o.hasWidthChange)) return;
5250
- const i = (M = s.width) != null ? M : s.calcTextWidth(), a = (y = (j = s.fontSize) != null ? j : o == null ? void 0 : o.baseFontSize) != null ? y : 16, r = !!(o.baseStyles && Object.keys(o.baseStyles).length), {
5327
+ const i = (M = s.width) != null ? M : s.calcTextWidth(), a = (y = (C = s.fontSize) != null ? C : o == null ? void 0 : o.baseFontSize) != null ? y : 16, r = !!(o.baseStyles && Object.keys(o.baseStyles).length), {
5251
5328
  paddingTop: c = 0,
5252
5329
  paddingRight: l = 0,
5253
5330
  paddingBottom: h = 0,
5254
5331
  paddingLeft: u = 0,
5255
5332
  radiusTopLeft: f = 0,
5256
- radiusTopRight: g = 0,
5333
+ radiusTopRight: p = 0,
5257
5334
  radiusBottomRight: m = 0,
5258
- radiusBottomLeft: p = 0
5335
+ radiusBottomLeft: g = 0
5259
5336
  } = s, v = {
5260
5337
  width: i,
5261
5338
  paddingTop: c,
@@ -5263,24 +5340,24 @@ class st {
5263
5340
  paddingBottom: h,
5264
5341
  paddingLeft: u,
5265
5342
  radiusTopLeft: f,
5266
- radiusTopRight: g,
5343
+ radiusTopRight: p,
5267
5344
  radiusBottomRight: m,
5268
- radiusBottomLeft: p
5345
+ radiusBottomLeft: g
5269
5346
  };
5270
5347
  r || (v.fontSize = a), this.updateText({
5271
5348
  target: s,
5272
5349
  style: v
5273
5350
  }), s.set({ scaleX: 1, scaleY: 1 }), s.setCoords();
5274
- }, this.editor = t, this.canvas = t.canvas, this.fonts = (e = t.options.fonts) != null ? e : [], this.scalingState = /* @__PURE__ */ new WeakMap(), this.editingAnchorState = /* @__PURE__ */ new WeakMap(), this.lineDefaultsSyncing = /* @__PURE__ */ new WeakSet(), this.isTextEditingActive = !1, this._bindEvents(), ps();
5351
+ }, this.editor = t, this.canvas = t.canvas, this.fonts = (e = t.options.fonts) != null ? e : [], this.scalingState = /* @__PURE__ */ new WeakMap(), this.editingAnchorState = /* @__PURE__ */ new WeakMap(), this.lineDefaultsSyncing = /* @__PURE__ */ new WeakSet(), this.isTextEditingActive = !1, this._bindEvents(), bs();
5275
5352
  }
5276
5353
  /**
5277
5354
  * Добавляет новый текстовый объект на канвас.
5278
5355
  * @param options — настройки текста
5279
5356
  * @param flags — флаги поведения
5280
5357
  */
5281
- addText(U = {}, { withoutSelection: T = !1, withoutSave: O = !1, withoutAdding: P = !1 } = {}) {
5282
- var F = U, {
5283
- id: t = `text-${$()}`,
5358
+ addText(W = {}, { withoutSelection: I = !1, withoutSave: O = !1, withoutAdding: N = !1 } = {}) {
5359
+ var z = W, {
5360
+ id: t = `text-${tt()}`,
5284
5361
  text: e = "Новый текст",
5285
5362
  autoExpand: n = !0,
5286
5363
  fontFamily: s,
@@ -5293,19 +5370,19 @@ class st {
5293
5370
  align: h = "left",
5294
5371
  color: u = "#000000",
5295
5372
  strokeColor: f,
5296
- strokeWidth: g = 0,
5373
+ strokeWidth: p = 0,
5297
5374
  opacity: m = 1,
5298
- backgroundColor: p,
5375
+ backgroundColor: g,
5299
5376
  backgroundOpacity: v = 1,
5300
5377
  paddingTop: M = 0,
5301
- paddingRight: j = 0,
5378
+ paddingRight: C = 0,
5302
5379
  paddingBottom: y = 0,
5303
5380
  paddingLeft: w = 0,
5304
- radiusTopLeft: I = 0,
5305
- radiusTopRight: C = 0,
5381
+ radiusTopLeft: j = 0,
5382
+ radiusTopRight: T = 0,
5306
5383
  radiusBottomRight: b = 0,
5307
5384
  radiusBottomLeft: A = 0
5308
- } = F, S = Mt(F, [
5385
+ } = z, S = Mt(z, [
5309
5386
  "id",
5310
5387
  "text",
5311
5388
  "autoExpand",
@@ -5332,15 +5409,15 @@ class st {
5332
5409
  "radiusBottomRight",
5333
5410
  "radiusBottomLeft"
5334
5411
  ]);
5335
- var et;
5412
+ var J;
5336
5413
  const { historyManager: E } = this.editor, { canvas: B } = this;
5337
5414
  E.suspendHistory();
5338
- const H = s != null ? s : this._getDefaultFontFamily(), z = cn({ width: g }), W = rn({
5415
+ const Y = s != null ? s : this._getDefaultFontFamily(), R = Le({ width: p }), U = Ee({
5339
5416
  strokeColor: f,
5340
- width: z
5341
- }), x = L({
5417
+ width: R
5418
+ }), D = x({
5342
5419
  id: t,
5343
- fontFamily: H,
5420
+ fontFamily: Y,
5344
5421
  fontSize: o,
5345
5422
  fontWeight: i ? "bold" : "normal",
5346
5423
  fontStyle: a ? "italic" : "normal",
@@ -5349,43 +5426,43 @@ class st {
5349
5426
  linethrough: l,
5350
5427
  textAlign: h,
5351
5428
  fill: u,
5352
- stroke: W,
5353
- strokeWidth: z,
5429
+ stroke: U,
5430
+ strokeWidth: R,
5354
5431
  strokeUniform: !0,
5355
5432
  opacity: m,
5356
- backgroundColor: p,
5433
+ backgroundColor: g,
5357
5434
  backgroundOpacity: v,
5358
5435
  paddingTop: M,
5359
- paddingRight: j,
5436
+ paddingRight: C,
5360
5437
  paddingBottom: y,
5361
5438
  paddingLeft: w,
5362
- radiusTopLeft: I,
5363
- radiusTopRight: C,
5439
+ radiusTopLeft: j,
5440
+ radiusTopRight: T,
5364
5441
  radiusBottomRight: b,
5365
5442
  radiusBottomLeft: A
5366
- }, S), R = new ge(e, x), _ = n !== !1;
5367
- if (R.autoExpand = _, R.textCaseRaw = (et = R.text) != null ? et : "", c) {
5368
- const G = be({ value: R.textCaseRaw });
5369
- G !== R.text && R.set({ text: G });
5370
- }
5371
- return Ct({ textbox: R }) && (R.dirty = !0), S.left === void 0 && S.top === void 0 && B.centerObject(R), P || B.add(R), T || B.setActiveObject(R), B.requestRenderAll(), E.resumeHistory(), O || E.saveState(), B.fire("editor:text-added", {
5372
- textbox: R,
5373
- options: It(L({}, x), {
5443
+ }, S), k = new ge(e, D), _ = n !== !1;
5444
+ if (k.autoExpand = _, k.textCaseRaw = (J = k.text) != null ? J : "", c) {
5445
+ const G = Me({ value: k.textCaseRaw });
5446
+ G !== k.text && k.set({ text: G });
5447
+ }
5448
+ return Ct({ textbox: k }) && (k.dirty = !0), S.left === void 0 && S.top === void 0 && B.centerObject(k), N || B.add(k), I || B.setActiveObject(k), B.requestRenderAll(), E.resumeHistory(), O || E.saveState(), B.fire("editor:text-added", {
5449
+ textbox: k,
5450
+ options: It(x({}, D), {
5374
5451
  text: e,
5375
5452
  bold: i,
5376
5453
  italic: a,
5377
5454
  strikethrough: l,
5378
5455
  align: h,
5379
5456
  color: u,
5380
- strokeColor: W,
5381
- strokeWidth: z
5457
+ strokeColor: U,
5458
+ strokeWidth: R
5382
5459
  }),
5383
5460
  flags: {
5384
- withoutSelection: !!T,
5461
+ withoutSelection: !!I,
5385
5462
  withoutSave: !!O,
5386
- withoutAdding: !!P
5463
+ withoutAdding: !!N
5387
5464
  }
5388
- }), R;
5465
+ }), k;
5389
5466
  }
5390
5467
  /**
5391
5468
  * Обновляет текстовый объект.
@@ -5413,31 +5490,31 @@ class st {
5413
5490
  x: u.x,
5414
5491
  y: u.y
5415
5492
  }, Ht = e, {
5416
- text: g,
5493
+ text: p,
5417
5494
  autoExpand: m,
5418
- fontFamily: p,
5495
+ fontFamily: g,
5419
5496
  fontSize: v,
5420
5497
  bold: M,
5421
- italic: j,
5498
+ italic: C,
5422
5499
  underline: y,
5423
5500
  uppercase: w,
5424
- strikethrough: I,
5425
- align: C,
5501
+ strikethrough: j,
5502
+ align: T,
5426
5503
  color: b,
5427
5504
  strokeColor: A,
5428
5505
  strokeWidth: S,
5429
- opacity: T,
5506
+ opacity: I,
5430
5507
  backgroundColor: O,
5431
- backgroundOpacity: P,
5432
- paddingTop: U,
5433
- paddingRight: F,
5508
+ backgroundOpacity: N,
5509
+ paddingTop: W,
5510
+ paddingRight: z,
5434
5511
  paddingBottom: E,
5435
5512
  paddingLeft: B,
5436
- radiusTopLeft: H,
5437
- radiusTopRight: z,
5438
- radiusBottomRight: W,
5439
- radiusBottomLeft: x
5440
- } = Ht, R = Mt(Ht, [
5513
+ radiusTopLeft: Y,
5514
+ radiusTopRight: R,
5515
+ radiusBottomRight: U,
5516
+ radiusBottomLeft: D
5517
+ } = Ht, k = Mt(Ht, [
5441
5518
  "text",
5442
5519
  "autoExpand",
5443
5520
  "fontFamily",
@@ -5462,84 +5539,84 @@ class st {
5462
5539
  "radiusTopRight",
5463
5540
  "radiusBottomRight",
5464
5541
  "radiusBottomLeft"
5465
- ]), _ = L({}, R), D = o !== void 0 ? vs({
5542
+ ]), _ = x({}, k), L = o !== void 0 ? ws({
5466
5543
  text: a,
5467
5544
  range: o
5468
- }) : Ts({ textbox: i }), et = D ? bs({ textbox: i, range: D }) : null, G = {}, J = {}, Q = {};
5545
+ }) : ms({ textbox: i }), J = L ? As({ textbox: i, range: L }) : null, G = {}, Q = {}, $ = {};
5469
5546
  let ot, ht;
5470
- const vt = Es({ textbox: i, range: D }), rt = !D || vt, ct = !D;
5471
- if (p !== void 0 && (et && (J.fontFamily = p), rt && (_.fontFamily = p, ct && (Q.fontFamily = p))), v !== void 0 && (et && (J.fontSize = v), rt && (_.fontSize = v, ct && (Q.fontSize = v))), M !== void 0) {
5547
+ const vt = vs({ textbox: i, range: L }), rt = !L || vt, ct = !L;
5548
+ if (g !== void 0 && (J && (Q.fontFamily = g), rt && (_.fontFamily = g, ct && ($.fontFamily = g))), v !== void 0 && (J && (Q.fontSize = v), rt && (_.fontSize = v, ct && ($.fontSize = v))), M !== void 0) {
5472
5549
  const q = M ? "bold" : "normal";
5473
- D && (G.fontWeight = q), rt && (_.fontWeight = q, ct && (Q.fontWeight = q));
5550
+ L && (G.fontWeight = q), rt && (_.fontWeight = q, ct && ($.fontWeight = q));
5474
5551
  }
5475
- if (j !== void 0) {
5476
- const q = j ? "italic" : "normal";
5477
- D && (G.fontStyle = q), rt && (_.fontStyle = q, ct && (Q.fontStyle = q));
5552
+ if (C !== void 0) {
5553
+ const q = C ? "italic" : "normal";
5554
+ L && (G.fontStyle = q), rt && (_.fontStyle = q, ct && ($.fontStyle = q));
5478
5555
  }
5479
- if (y !== void 0 && (D && (G.underline = y), rt && (_.underline = y, ct && (Q.underline = y))), I !== void 0 && (D && (G.linethrough = I), rt && (_.linethrough = I, ct && (Q.linethrough = I))), C !== void 0 && (_.textAlign = C), b !== void 0 && (D && (G.fill = b), rt && (_.fill = b, ct && (Q.fill = b))), A !== void 0 || S !== void 0) {
5480
- const q = D ? an({ textbox: i, range: D, property: "strokeWidth" }) : void 0, nt = D ? an({ textbox: i, range: D, property: "stroke" }) : void 0, ye = (Gt = (Zt = S != null ? S : q) != null ? Zt : i.strokeWidth) != null ? Gt : 0;
5481
- ht = cn({ width: ye });
5556
+ if (y !== void 0 && (L && (G.underline = y), rt && (_.underline = y, ct && ($.underline = y))), j !== void 0 && (L && (G.linethrough = j), rt && (_.linethrough = j, ct && ($.linethrough = j))), T !== void 0 && (_.textAlign = T), b !== void 0 && (L && (G.fill = b), rt && (_.fill = b, ct && ($.fill = b))), A !== void 0 || S !== void 0) {
5557
+ const q = L ? sn({ textbox: i, range: L, property: "strokeWidth" }) : void 0, nt = L ? sn({ textbox: i, range: L, property: "stroke" }) : void 0, ve = (Gt = (Zt = S != null ? S : q) != null ? Zt : i.strokeWidth) != null ? Gt : 0;
5558
+ ht = Le({ width: ve });
5482
5559
  const kt = (Rt = (Vt = A != null ? A : nt) != null ? Vt : i.stroke) != null ? Rt : void 0;
5483
- ot = rn({
5560
+ ot = Ee({
5484
5561
  strokeColor: kt,
5485
5562
  width: ht
5486
- }), D && (G.stroke = ot, G.strokeWidth = ht), rt && (_.stroke = ot, _.strokeWidth = ht, ct && (Q.stroke = ot, Q.strokeWidth = ht));
5563
+ }), L && (G.stroke = ot, G.strokeWidth = ht), rt && (_.stroke = ot, _.strokeWidth = ht, ct && ($.stroke = ot, $.strokeWidth = ht));
5487
5564
  }
5488
- T !== void 0 && (_.opacity = T), O !== void 0 && (_.backgroundColor = O), P !== void 0 && (_.backgroundOpacity = P), U !== void 0 && (_.paddingTop = U), F !== void 0 && (_.paddingRight = F), E !== void 0 && (_.paddingBottom = E), B !== void 0 && (_.paddingLeft = B), H !== void 0 && (_.radiusTopLeft = H), z !== void 0 && (_.radiusTopRight = z), W !== void 0 && (_.radiusBottomRight = W), x !== void 0 && (_.radiusBottomLeft = x);
5489
- const At = (ie = i.textCaseRaw) != null ? ie : a, bt = !!i.uppercase, Lt = g !== void 0, Dt = Lt ? g != null ? g : "" : At, _t = w != null ? w : bt, Wt = _t !== bt;
5490
- if (Lt || Wt) {
5491
- const q = _t ? be({ value: Dt }) : Dt;
5565
+ I !== void 0 && (_.opacity = I), O !== void 0 && (_.backgroundColor = O), N !== void 0 && (_.backgroundOpacity = N), W !== void 0 && (_.paddingTop = W), z !== void 0 && (_.paddingRight = z), E !== void 0 && (_.paddingBottom = E), B !== void 0 && (_.paddingLeft = B), Y !== void 0 && (_.radiusTopLeft = Y), R !== void 0 && (_.radiusTopRight = R), U !== void 0 && (_.radiusBottomRight = U), D !== void 0 && (_.radiusBottomLeft = D);
5566
+ const At = (ie = i.textCaseRaw) != null ? ie : a, bt = !!i.uppercase, Lt = p !== void 0, Dt = Lt ? p != null ? p : "" : At, _t = w != null ? w : bt, Ut = _t !== bt;
5567
+ if (Lt || Ut) {
5568
+ const q = _t ? Me({ value: Dt }) : Dt;
5492
5569
  _.text = q, i.textCaseRaw = Dt;
5493
5570
  } else i.textCaseRaw === void 0 && (i.textCaseRaw = At);
5494
5571
  i.uppercase = _t, i.set(_);
5495
5572
  let ut = !1;
5496
- if (D) {
5497
- const q = ve({ textbox: i, styles: G, range: D }), nt = et ? ve({ textbox: i, styles: J, range: et }) : !1;
5573
+ if (L) {
5574
+ const q = be({ textbox: i, styles: G, range: L }), nt = J ? be({ textbox: i, styles: Q, range: J }) : !1;
5498
5575
  ut = q || nt;
5499
- } else if (Object.keys(Q).length) {
5500
- const q = Os({ textbox: i });
5501
- q && (ut = ve({ textbox: i, styles: Q, range: q }));
5576
+ } else if (Object.keys($).length) {
5577
+ const q = ys({ textbox: i });
5578
+ q && (ut = be({ textbox: i, styles: $, range: q }));
5502
5579
  }
5503
- const Qt = ut && on({
5580
+ const Qt = ut && ln({
5504
5581
  stylesList: [
5505
5582
  G,
5506
- J,
5507
- Q
5583
+ Q,
5584
+ $
5508
5585
  ]
5509
5586
  });
5510
- if (ut && (i.dirty = !0), et && (p !== void 0 || v !== void 0)) {
5511
- const q = Ms({
5587
+ if (ut && (i.dirty = !0), J && (g !== void 0 || v !== void 0)) {
5588
+ const q = js({
5512
5589
  textbox: i,
5513
- range: et
5590
+ range: J
5514
5591
  }), nt = {};
5515
- p !== void 0 && (nt.fontFamily = p), v !== void 0 && (nt.fontSize = v), tn({
5592
+ g !== void 0 && (nt.fontFamily = g), v !== void 0 && (nt.fontSize = v), on({
5516
5593
  textbox: i,
5517
5594
  lineIndices: q,
5518
5595
  updates: nt
5519
5596
  });
5520
5597
  }
5521
- if (D && (b !== void 0 || A !== void 0 || S !== void 0)) {
5522
- const q = Ss({
5598
+ if (L && (b !== void 0 || A !== void 0 || S !== void 0)) {
5599
+ const q = Is({
5523
5600
  textbox: i,
5524
- range: D
5601
+ range: L
5525
5602
  }), nt = {};
5526
- b !== void 0 && (nt.fill = b), (A !== void 0 || S !== void 0) && (ot === null && (nt.stroke = null), ot != null && (nt.stroke = ot)), tn({
5603
+ b !== void 0 && (nt.fill = b), (A !== void 0 || S !== void 0) && (ot === null && (nt.stroke = null), ot != null && (nt.stroke = ot)), on({
5527
5604
  textbox: i,
5528
5605
  lineIndices: q,
5529
5606
  updates: nt
5530
5607
  });
5531
5608
  }
5532
- Qt && (i.initDimensions(), i.dirty = !0), (O !== void 0 || P !== void 0 || U !== void 0 || F !== void 0 || E !== void 0 || B !== void 0 || H !== void 0 || z !== void 0 || W !== void 0 || x !== void 0) && (i.dirty = !0);
5533
- const jt = on({
5609
+ Qt && (i.initDimensions(), i.dirty = !0), (O !== void 0 || N !== void 0 || W !== void 0 || z !== void 0 || E !== void 0 || B !== void 0 || Y !== void 0 || R !== void 0 || U !== void 0 || D !== void 0) && (i.dirty = !0);
5610
+ const jt = ln({
5534
5611
  stylesList: [
5535
5612
  _,
5536
5613
  G,
5537
- J,
5538
- Q
5614
+ Q,
5615
+ $
5539
5616
  ]
5540
5617
  }), { autoExpand: ft } = i, $t = m !== void 0, te = (m != null ? m : ft) !== !1;
5541
5618
  $t ? i.autoExpand = m !== !1 : ft === void 0 && (i.autoExpand = !0);
5542
- const ee = Object.prototype.hasOwnProperty.call(_, "width"), ne = te && !ee && (Lt || Wt || jt);
5619
+ const ee = Object.prototype.hasOwnProperty.call(_, "width"), ne = te && !ee && (Lt || Ut || jt);
5543
5620
  let xt = !1;
5544
5621
  ne && (xt = this._autoExpandTextboxWidth(i, {
5545
5622
  anchor: f
@@ -5556,8 +5633,8 @@ class st {
5556
5633
  updates: _,
5557
5634
  before: l,
5558
5635
  after: se,
5559
- selectionRange: D != null ? D : void 0,
5560
- selectionStyles: D && Object.keys(G).length ? G : void 0
5636
+ selectionRange: L != null ? L : void 0,
5637
+ selectionStyles: L && Object.keys(G).length ? G : void 0
5561
5638
  }), i;
5562
5639
  }
5563
5640
  /**
@@ -5600,7 +5677,7 @@ class st {
5600
5677
  * Синхронизирует lineFontDefaults при изменении текста и сохраняет typing style для пустых строк.
5601
5678
  */
5602
5679
  _syncLineFontDefaultsOnTextChanged({ textbox: t }) {
5603
- var P, U, F;
5680
+ var N, W, z;
5604
5681
  const {
5605
5682
  text: e = "",
5606
5683
  lineFontDefaults: n,
@@ -5611,81 +5688,81 @@ class st {
5611
5688
  stroke: r,
5612
5689
  selectionStart: c,
5613
5690
  isEditing: l
5614
- } = t, h = e, u = (P = t.__lineDefaultsPrevText) != null ? P : h, f = u.split(`
5615
- `), g = h.split(`
5616
- `), m = f.length, v = g.length - m;
5617
- let M = n, j = !1, y = !1;
5618
- const w = typeof a == "string" ? a : void 0, I = typeof r == "string" ? r : void 0;
5691
+ } = t, h = e, u = (N = t.__lineDefaultsPrevText) != null ? N : h, f = u.split(`
5692
+ `), p = h.split(`
5693
+ `), m = f.length, v = p.length - m;
5694
+ let M = n, C = !1, y = !1;
5695
+ const w = typeof a == "string" ? a : void 0, j = typeof r == "string" ? r : void 0;
5619
5696
  if (v !== 0 && n && Object.keys(n).length) {
5620
- const E = ws({
5697
+ const E = Cs({
5621
5698
  previous: u,
5622
5699
  next: h
5623
- }), B = As({
5700
+ }), B = Ts({
5624
5701
  text: u,
5625
5702
  charIndex: E
5626
5703
  });
5627
5704
  if (v > 0) {
5628
- const H = js({
5705
+ const Y = Os({
5629
5706
  text: u,
5630
5707
  lineIndex: B
5631
5708
  });
5632
- let z = B + 1;
5633
- E === H && (z = B);
5634
- const W = {};
5635
- for (const x in n) {
5636
- if (!Object.prototype.hasOwnProperty.call(n, x)) continue;
5637
- const R = Number(x);
5638
- if (!Number.isFinite(R)) continue;
5639
- const _ = n[R];
5709
+ let R = B + 1;
5710
+ E === Y && (R = B);
5711
+ const U = {};
5712
+ for (const D in n) {
5713
+ if (!Object.prototype.hasOwnProperty.call(n, D)) continue;
5714
+ const k = Number(D);
5715
+ if (!Number.isFinite(k)) continue;
5716
+ const _ = n[k];
5640
5717
  if (!_) continue;
5641
- const D = R >= z ? R + v : R;
5642
- W[D] = L({}, _);
5718
+ const L = k >= R ? k + v : k;
5719
+ U[L] = x({}, _);
5643
5720
  }
5644
- M = W, j = !0, y = !0;
5721
+ M = U, C = !0, y = !0;
5645
5722
  }
5646
5723
  if (v < 0) {
5647
- const H = Math.abs(v);
5648
- let z = B;
5724
+ const Y = Math.abs(v);
5725
+ let R = B;
5649
5726
  u[E] === `
5650
- ` && ((U = f[B]) != null ? U : "").length > 0 && (z = B + 1);
5651
- const x = z + H - 1, R = {};
5727
+ ` && ((W = f[B]) != null ? W : "").length > 0 && (R = B + 1);
5728
+ const D = R + Y - 1, k = {};
5652
5729
  for (const _ in n) {
5653
5730
  if (!Object.prototype.hasOwnProperty.call(n, _)) continue;
5654
- const D = Number(_);
5655
- if (!Number.isFinite(D)) continue;
5656
- const et = n[D];
5657
- et && (D < z && (R[D] = L({}, et)), D > x && (R[D + v] = L({}, et)));
5731
+ const L = Number(_);
5732
+ if (!Number.isFinite(L)) continue;
5733
+ const J = n[L];
5734
+ J && (L < R && (k[L] = x({}, J)), L > D && (k[L + v] = x({}, J)));
5658
5735
  }
5659
- M = R, j = !0, y = !0;
5736
+ M = k, C = !0, y = !0;
5660
5737
  }
5661
5738
  }
5662
- let C = null;
5739
+ let T = null;
5663
5740
  if (l && typeof c == "number") {
5664
5741
  const E = t.get2DCursorLocation(c), { lineIndex: B } = E;
5665
- Number.isFinite(B) && (C = B);
5666
- }
5667
- let b = s, A = !1, S = !1, T, O = null;
5668
- for (let E = 0; E < g.length; E += 1) {
5669
- const B = (F = g[E]) != null ? F : "", H = M ? M[E] : void 0;
5670
- if (H && (T = H), B.length !== 0) {
5671
- if (H) {
5672
- const D = ms({
5742
+ Number.isFinite(B) && (T = B);
5743
+ }
5744
+ let b = s, A = !1, S = !1, I, O = null;
5745
+ for (let E = 0; E < p.length; E += 1) {
5746
+ const B = (z = p[E]) != null ? z : "", Y = M ? M[E] : void 0;
5747
+ if (Y && (I = Y), B.length !== 0) {
5748
+ if (Y) {
5749
+ const L = Ms({
5673
5750
  lineText: B,
5674
5751
  lineStyles: b ? b[E] : void 0,
5675
- lineDefaults: H
5752
+ lineDefaults: Y
5676
5753
  });
5677
- D.changed && (b || (b = {}, S = !0), S || (b = L({}, b), S = !0), D.lineStyles && (b[E] = D.lineStyles), !D.lineStyles && b[E] && delete b[E], A = !0);
5754
+ L.changed && (b || (b = {}, S = !0), S || (b = x({}, b), S = !0), L.lineStyles && (b[E] = L.lineStyles), !L.lineStyles && b[E] && delete b[E], A = !0);
5678
5755
  }
5679
5756
  continue;
5680
5757
  }
5681
- const W = H != null ? H : T, x = {};
5682
- (W == null ? void 0 : W.fontFamily) !== void 0 ? x.fontFamily = W.fontFamily : o !== void 0 && (x.fontFamily = o), (W == null ? void 0 : W.fontSize) !== void 0 ? x.fontSize = W.fontSize : i !== void 0 && (x.fontSize = i), (W == null ? void 0 : W.fill) !== void 0 ? x.fill = W.fill : w !== void 0 && (x.fill = w), (W == null ? void 0 : W.stroke) !== void 0 ? x.stroke = W.stroke : I !== void 0 && (x.stroke = I), !H && Object.keys(x).length && (M || (M = {}, y = !0), y || (M = L({}, M), y = !0), M[E] = x, j = !0, T = x), H && (T = H), C !== null && C === E && (O = x);
5683
- const R = {};
5684
- x.fontFamily !== void 0 && (R.fontFamily = x.fontFamily), x.fontSize !== void 0 && (R.fontSize = x.fontSize), x.fill !== void 0 && (R.fill = x.fill), x.stroke !== void 0 && (R.stroke = x.stroke);
5685
- const _ = Object.keys(R).length > 0;
5686
- (_ || b && b[E]) && (b || (b = {}, S = !0), S || (b = L({}, b), S = !0), _ && (b[E] = { 0: R }), !_ && b[E] && delete b[E], A = !0);
5687
- }
5688
- if (j && M && (t.lineFontDefaults = M), A && (t.styles = b, t.dirty = !0), O && typeof c == "number") {
5758
+ const U = Y != null ? Y : I, D = {};
5759
+ (U == null ? void 0 : U.fontFamily) !== void 0 ? D.fontFamily = U.fontFamily : o !== void 0 && (D.fontFamily = o), (U == null ? void 0 : U.fontSize) !== void 0 ? D.fontSize = U.fontSize : i !== void 0 && (D.fontSize = i), (U == null ? void 0 : U.fill) !== void 0 ? D.fill = U.fill : w !== void 0 && (D.fill = w), (U == null ? void 0 : U.stroke) !== void 0 ? D.stroke = U.stroke : j !== void 0 && (D.stroke = j), !Y && Object.keys(D).length && (M || (M = {}, y = !0), y || (M = x({}, M), y = !0), M[E] = D, C = !0, I = D), Y && (I = Y), T !== null && T === E && (O = D);
5760
+ const k = {};
5761
+ D.fontFamily !== void 0 && (k.fontFamily = D.fontFamily), D.fontSize !== void 0 && (k.fontSize = D.fontSize), D.fill !== void 0 && (k.fill = D.fill), D.stroke !== void 0 && (k.stroke = D.stroke);
5762
+ const _ = Object.keys(k).length > 0;
5763
+ (_ || b && b[E]) && (b || (b = {}, S = !0), S || (b = x({}, b), S = !0), _ && (b[E] = { 0: k }), !_ && b[E] && delete b[E], A = !0);
5764
+ }
5765
+ if (C && M && (t.lineFontDefaults = M), A && (t.styles = b, t.dirty = !0), O && typeof c == "number") {
5689
5766
  const E = {};
5690
5767
  if (O.fontFamily !== void 0 && (E.fontFamily = O.fontFamily), O.fontSize !== void 0 && (E.fontSize = O.fontSize), O.fill !== void 0 && (E.fill = O.fill), O.stroke !== void 0 && (E.stroke = O.stroke), Object.keys(E).length) {
5691
5768
  this.lineDefaultsSyncing.add(t);
@@ -5703,37 +5780,37 @@ class st {
5703
5780
  * но не шире монтажной области, и удерживает объект в её пределах.
5704
5781
  */
5705
5782
  _autoExpandTextboxWidth(t, { anchor: e } = {}) {
5706
- var C, b, A, S, T, O, P, U, F, E, B, H, z;
5783
+ var T, b, A, S, I, O, N, W, z, E, B, Y, R;
5707
5784
  const { montageArea: n } = this.editor;
5708
5785
  if (!n) return !1;
5709
5786
  const s = typeof t.text == "string" ? t.text : "";
5710
5787
  if (!s.length) return !1;
5711
5788
  n.setCoords();
5712
- const o = n.getBoundingRect(!1, !0), i = (C = o.width) != null ? C : 0;
5789
+ const o = n.getBoundingRect(!1, !0), i = (T = o.width) != null ? T : 0;
5713
5790
  if (!Number.isFinite(i) || i <= 0) return !1;
5714
- const a = e != null ? e : (b = this.editingAnchorState) == null ? void 0 : b.get(t), r = (S = (A = a == null ? void 0 : a.originY) != null ? A : t.originY) != null ? S : "top", c = Math.abs((T = t.scaleX) != null ? T : 1) || 1, l = (O = t.paddingLeft) != null ? O : 0, h = (P = t.paddingRight) != null ? P : 0, u = (U = t.strokeWidth) != null ? U : 0, f = Math.max(
5791
+ const a = e != null ? e : (b = this.editingAnchorState) == null ? void 0 : b.get(t), r = (S = (A = a == null ? void 0 : a.originY) != null ? A : t.originY) != null ? S : "top", c = Math.abs((I = t.scaleX) != null ? I : 1) || 1, l = (O = t.paddingLeft) != null ? O : 0, h = (N = t.paddingRight) != null ? N : 0, u = (W = t.strokeWidth) != null ? W : 0, f = Math.max(
5715
5792
  1,
5716
5793
  i / c - l - h - u
5717
5794
  );
5718
5795
  if (!Number.isFinite(f) || f <= 0) return !1;
5719
- const g = s.split(`
5796
+ const p = s.split(`
5720
5797
  `).length;
5721
5798
  let m = !1;
5722
- Math.abs(((F = t.width) != null ? F : 0) - f) > it && (t.set({ width: f }), m = !0), t.initDimensions();
5723
- const { textLines: p } = t, v = Array.isArray(p) && p.length > g, M = Math.ceil(
5724
- Is({ textbox: t, text: s })
5725
- ), j = Math.min((E = t.minWidth) != null ? E : 1, f);
5799
+ Math.abs(((z = t.width) != null ? z : 0) - f) > it && (t.set({ width: f }), m = !0), t.initDimensions();
5800
+ const { textLines: g } = t, v = Array.isArray(g) && g.length > p, M = Math.ceil(
5801
+ Es({ textbox: t, text: s })
5802
+ ), C = Math.min((E = t.minWidth) != null ? E : 1, f);
5726
5803
  let y = Math.min(
5727
5804
  f,
5728
- Math.max(M, j)
5805
+ Math.max(M, C)
5729
5806
  );
5730
5807
  v && (y = f), Math.abs(((B = t.width) != null ? B : 0) - y) > it && (t.set({ width: y }), t.initDimensions(), m = !0), Ct({ textbox: t }) && (m = !0), a && (t.setPositionByOrigin(new at(a.x, a.y), "center", r), m = !0);
5731
- const I = Cs({
5808
+ const j = Ls({
5732
5809
  textbox: t,
5733
- montageLeft: (H = o.left) != null ? H : 0,
5734
- montageRight: ((z = o.left) != null ? z : 0) + i
5810
+ montageLeft: (Y = o.left) != null ? Y : 0,
5811
+ montageRight: ((R = o.left) != null ? R : 0) + i
5735
5812
  });
5736
- return m || I;
5813
+ return m || j;
5737
5814
  }
5738
5815
  /**
5739
5816
  * Обрабатывает изменение ширины текстового объекта (resizing).
@@ -5742,7 +5819,7 @@ class st {
5742
5819
  * Также корректирует позицию при ресайзе слева, чтобы компенсировать смещение.
5743
5820
  */
5744
5821
  static _handleObjectResizing(t) {
5745
- var h, u, f, g, m, p;
5822
+ var h, u, f, p, m, g;
5746
5823
  const { target: e, transform: n } = t;
5747
5824
  if (!st._isTextbox(e)) return;
5748
5825
  const {
@@ -5755,10 +5832,10 @@ class st {
5755
5832
  e.set({ width: r });
5756
5833
  const c = (u = e.width) != null ? u : 0, l = a - c;
5757
5834
  if (l !== 0 && n && n.corner === "ml") {
5758
- const M = ((f = e.angle) != null ? f : 0) * Math.PI / 180, j = Math.cos(M), y = Math.sin(M), w = (g = e.scaleX) != null ? g : 1, I = l * w;
5835
+ const M = ((f = e.angle) != null ? f : 0) * Math.PI / 180, C = Math.cos(M), y = Math.sin(M), w = (p = e.scaleX) != null ? p : 1, j = l * w;
5759
5836
  e.set({
5760
- left: ((m = e.left) != null ? m : 0) + I * j,
5761
- top: ((p = e.top) != null ? p : 0) + I * y
5837
+ left: ((m = e.left) != null ? m : 0) + j * C,
5838
+ top: ((g = e.top) != null ? g : 0) + j * y
5762
5839
  });
5763
5840
  }
5764
5841
  }
@@ -5779,10 +5856,10 @@ class st {
5779
5856
  paddingTop: h = 0,
5780
5857
  paddingRight: u = 0,
5781
5858
  paddingBottom: f = 0,
5782
- paddingLeft: g = 0
5859
+ paddingLeft: p = 0
5783
5860
  } = t, {
5784
5861
  radiusTopLeft: m = 0,
5785
- radiusTopRight: p = 0,
5862
+ radiusTopRight: g = 0,
5786
5863
  radiusBottomRight: v = 0,
5787
5864
  radiusBottomLeft: M = 0
5788
5865
  } = t;
@@ -5794,16 +5871,16 @@ class st {
5794
5871
  top: h,
5795
5872
  right: u,
5796
5873
  bottom: f,
5797
- left: g
5874
+ left: p
5798
5875
  },
5799
5876
  baseRadii: {
5800
5877
  topLeft: m,
5801
- topRight: p,
5878
+ topRight: g,
5802
5879
  bottomRight: v,
5803
5880
  bottomLeft: M
5804
5881
  },
5805
5882
  baseStyles: JSON.parse(JSON.stringify(c)),
5806
- baseLineFontDefaults: en({ lineFontDefaults: l }),
5883
+ baseLineFontDefaults: an({ lineFontDefaults: l }),
5807
5884
  hasWidthChange: !1
5808
5885
  }, this.scalingState.set(t, e);
5809
5886
  }
@@ -5814,11 +5891,11 @@ class st {
5814
5891
  */
5815
5892
  static _getSnapshot(t) {
5816
5893
  const e = ({
5817
- snapshot: x,
5818
- entries: R
5894
+ snapshot: D,
5895
+ entries: k
5819
5896
  }) => {
5820
- Object.entries(R).forEach(([_, D]) => {
5821
- D != null && (x[_] = D);
5897
+ Object.entries(k).forEach(([_, L]) => {
5898
+ L != null && (D[_] = L);
5822
5899
  });
5823
5900
  }, {
5824
5901
  id: n,
@@ -5832,35 +5909,35 @@ class st {
5832
5909
  fontStyle: h,
5833
5910
  underline: u,
5834
5911
  linethrough: f,
5835
- textAlign: g,
5912
+ textAlign: p,
5836
5913
  fill: m,
5837
- stroke: p,
5914
+ stroke: g,
5838
5915
  strokeWidth: v,
5839
5916
  opacity: M,
5840
- backgroundColor: j,
5917
+ backgroundColor: C,
5841
5918
  backgroundOpacity: y,
5842
5919
  paddingTop: w,
5843
- paddingRight: I,
5844
- paddingBottom: C,
5920
+ paddingRight: j,
5921
+ paddingBottom: T,
5845
5922
  paddingLeft: b,
5846
5923
  radiusTopLeft: A,
5847
5924
  radiusTopRight: S,
5848
- radiusBottomRight: T,
5925
+ radiusBottomRight: I,
5849
5926
  radiusBottomLeft: O,
5850
- left: P,
5851
- top: U,
5852
- width: F,
5927
+ left: N,
5928
+ top: W,
5929
+ width: z,
5853
5930
  height: E,
5854
5931
  angle: B,
5855
- scaleX: H,
5856
- scaleY: z
5857
- } = t, W = {
5932
+ scaleX: Y,
5933
+ scaleY: R
5934
+ } = t, U = {
5858
5935
  id: n,
5859
5936
  uppercase: !!i,
5860
- textAlign: g
5937
+ textAlign: p
5861
5938
  };
5862
5939
  return e({
5863
- snapshot: W,
5940
+ snapshot: U,
5864
5941
  entries: {
5865
5942
  text: s,
5866
5943
  textCaseRaw: o,
@@ -5872,28 +5949,28 @@ class st {
5872
5949
  underline: u,
5873
5950
  linethrough: f,
5874
5951
  fill: m,
5875
- stroke: p,
5952
+ stroke: g,
5876
5953
  strokeWidth: v,
5877
5954
  opacity: M,
5878
- backgroundColor: j,
5955
+ backgroundColor: C,
5879
5956
  backgroundOpacity: y,
5880
5957
  paddingTop: w,
5881
- paddingRight: I,
5882
- paddingBottom: C,
5958
+ paddingRight: j,
5959
+ paddingBottom: T,
5883
5960
  paddingLeft: b,
5884
5961
  radiusTopLeft: A,
5885
5962
  radiusTopRight: S,
5886
- radiusBottomRight: T,
5963
+ radiusBottomRight: I,
5887
5964
  radiusBottomLeft: O,
5888
- left: P,
5889
- top: U,
5890
- width: F,
5965
+ left: N,
5966
+ top: W,
5967
+ width: z,
5891
5968
  height: E,
5892
5969
  angle: B,
5893
- scaleX: H,
5894
- scaleY: z
5970
+ scaleX: Y,
5971
+ scaleY: R
5895
5972
  }
5896
- }), W;
5973
+ }), U;
5897
5974
  }
5898
5975
  /**
5899
5976
  * Возвращает первый доступный шрифт или дефолтный Arial.
@@ -5903,7 +5980,7 @@ class st {
5903
5980
  return (e = (t = this.fonts[0]) == null ? void 0 : t.family) != null ? e : "Arial";
5904
5981
  }
5905
5982
  }
5906
- const tt = ({
5983
+ const et = ({
5907
5984
  value: d,
5908
5985
  fallback: t = 0
5909
5986
  }) => typeof d == "number" && Number.isFinite(d) ? d : typeof t == "number" && Number.isFinite(t) ? t : 0, ce = ({
@@ -5911,9 +5988,9 @@ const tt = ({
5911
5988
  dimension: t,
5912
5989
  useRelativePositions: e
5913
5990
  }) => {
5914
- const n = tt({ value: d });
5991
+ const n = et({ value: d });
5915
5992
  return e ? n : n / (t || 1);
5916
- }, Ls = ({
5993
+ }, Ds = ({
5917
5994
  object: d,
5918
5995
  baseWidth: t,
5919
5996
  baseHeight: e,
@@ -5942,12 +6019,12 @@ const tt = ({
5942
6019
  value: r,
5943
6020
  dimension: e,
5944
6021
  useRelativePositions: n
5945
- }), f = tt({ value: c }) / (t || 1), g = tt({ value: l }) / (e || 1);
6022
+ }), f = et({ value: c }) / (t || 1), p = et({ value: l }) / (e || 1);
5946
6023
  return {
5947
6024
  x: h + f / 2,
5948
- y: u + g / 2
6025
+ y: u + p / 2
5949
6026
  };
5950
- }, Ds = ({
6027
+ }, _s = ({
5951
6028
  normalizedX: d,
5952
6029
  normalizedY: t,
5953
6030
  bounds: e,
@@ -5956,12 +6033,12 @@ const tt = ({
5956
6033
  }) => {
5957
6034
  const { left: o, top: i, width: a, height: r } = e;
5958
6035
  if (!s) {
5959
- const { width: h, height: u } = n, f = o + d * (h || a), g = i + t * (u || r);
5960
- return new at(f, g);
6036
+ const { width: h, height: u } = n, f = o + d * (h || a), p = i + t * (u || r);
6037
+ return new at(f, p);
5961
6038
  }
5962
6039
  const c = o + d * a, l = i + t * r;
5963
6040
  return new at(c, l);
5964
- }, _s = ({
6041
+ }, xs = ({
5965
6042
  object: d,
5966
6043
  montageArea: t,
5967
6044
  bounds: e
@@ -5999,12 +6076,12 @@ const tt = ({
5999
6076
  } catch (t) {
6000
6077
  return null;
6001
6078
  }
6002
- }, xs = ({
6079
+ }, Rs = ({
6003
6080
  x1: d,
6004
6081
  y1: t,
6005
6082
  x2: e,
6006
6083
  y2: n
6007
- }) => (Math.atan2(n - t, e - d) * 180 / Math.PI + 360) % 360, Rs = (d) => {
6084
+ }) => (Math.atan2(n - t, e - d) * 180 / Math.PI + 360) % 360, ks = (d) => {
6008
6085
  if (!d || typeof d != "object") return null;
6009
6086
  const { type: t, coords: e, colorStops: n } = d, s = Array.isArray(n) ? n : [], o = s[0], i = s[s.length - 1], a = typeof (o == null ? void 0 : o.color) == "string" ? o.color : void 0, r = typeof (i == null ? void 0 : i.color) == "string" ? i.color : a, c = typeof (o == null ? void 0 : o.offset) == "number" ? o.offset * 100 : void 0, l = typeof (i == null ? void 0 : i.offset) == "number" ? i.offset * 100 : void 0, h = s.map((u) => ({
6010
6087
  color: typeof u.color == "string" ? u.color : "#000000",
@@ -6012,11 +6089,11 @@ const tt = ({
6012
6089
  }));
6013
6090
  if (!a || !r || !e) return null;
6014
6091
  if (t === "linear") {
6015
- const { x1: u, y1: f, x2: g, y2: m } = e;
6016
- if (typeof u == "number" && typeof f == "number" && typeof g == "number" && typeof m == "number")
6092
+ const { x1: u, y1: f, x2: p, y2: m } = e;
6093
+ if (typeof u == "number" && typeof f == "number" && typeof p == "number" && typeof m == "number")
6017
6094
  return {
6018
6095
  type: "linear",
6019
- angle: xs({ x1: u, y1: f, x2: g, y2: m }),
6096
+ angle: Rs({ x1: u, y1: f, x2: p, y2: m }),
6020
6097
  startColor: a,
6021
6098
  endColor: r,
6022
6099
  startPosition: c,
@@ -6025,13 +6102,13 @@ const tt = ({
6025
6102
  };
6026
6103
  }
6027
6104
  if (t === "radial") {
6028
- const { x1: u, y1: f, r2: g } = e;
6029
- if (typeof u == "number" && typeof f == "number" && typeof g == "number")
6105
+ const { x1: u, y1: f, r2: p } = e;
6106
+ if (typeof u == "number" && typeof f == "number" && typeof p == "number")
6030
6107
  return {
6031
6108
  type: "radial",
6032
6109
  centerX: u * 100,
6033
6110
  centerY: f * 100,
6034
- radius: g * 100,
6111
+ radius: p * 100,
6035
6112
  startColor: a,
6036
6113
  endColor: r,
6037
6114
  startPosition: c,
@@ -6040,8 +6117,8 @@ const tt = ({
6040
6117
  };
6041
6118
  }
6042
6119
  return null;
6043
- }, qt = "_templateCenterX", Me = "_templateCenterY", le = "_templateAnchorX", Se = "_templateAnchorY";
6044
- class Y {
6120
+ }, qt = "_templateCenterX", Se = "_templateCenterY", le = "_templateAnchorX", we = "_templateAnchorY";
6121
+ class H {
6045
6122
  constructor({ editor: t }) {
6046
6123
  this.editor = t;
6047
6124
  }
@@ -6060,7 +6137,7 @@ class Y {
6060
6137
  montageArea: i,
6061
6138
  errorManager: a,
6062
6139
  backgroundManager: r
6063
- } = this.editor, c = o.getActiveObject(), l = Y._collectObjects(c), { backgroundObject: h } = r != null ? r : {}, u = s && h ? [h] : [], f = [...l, ...u];
6140
+ } = this.editor, c = o.getActiveObject(), l = H._collectObjects(c), { backgroundObject: h } = r != null ? r : {}, u = s && h ? [h] : [], f = [...l, ...u];
6064
6141
  if (!f.length)
6065
6142
  return a.emitWarning({
6066
6143
  origin: "TemplateManager",
@@ -6068,21 +6145,21 @@ class Y {
6068
6145
  code: Tt.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
6069
6146
  message: "Нет объектов для сериализации шаблона"
6070
6147
  }), null;
6071
- const g = Y._getBounds(i), m = Y._getMontageSize({ montageArea: i, bounds: g }), p = m.width, v = m.height, M = f.map((w) => Y._serializeObject({
6148
+ const p = H._getBounds(i), m = H._getMontageSize({ montageArea: i, bounds: p }), g = m.width, v = m.height, M = f.map((w) => H._serializeObject({
6072
6149
  object: w,
6073
- bounds: g,
6074
- baseWidth: p,
6150
+ bounds: p,
6151
+ baseWidth: g,
6075
6152
  baseHeight: v,
6076
6153
  montageArea: i != null ? i : null
6077
- })), j = It(L({}, n), {
6078
- baseWidth: p,
6154
+ })), C = It(x({}, n), {
6155
+ baseWidth: g,
6079
6156
  baseHeight: v,
6080
6157
  positionsNormalized: !0,
6081
6158
  previewId: e != null ? e : n.previewId
6082
6159
  });
6083
6160
  return {
6084
- id: t != null ? t : `template-${$()}`,
6085
- meta: j,
6161
+ id: t != null ? t : `template-${tt()}`,
6162
+ meta: C,
6086
6163
  objects: M
6087
6164
  };
6088
6165
  }
@@ -6090,87 +6167,85 @@ class Y {
6090
6167
  * Применяет шаблон к монтажной области без очистки текущих объектов.
6091
6168
  * @param options
6092
6169
  * @param options.template - описание шаблона
6093
- * @param options.data - данные для заполнения текстов по customData.templateField
6094
6170
  */
6095
- applyTemplate(n) {
6171
+ applyTemplate(e) {
6096
6172
  return Z(this, arguments, function* ({
6097
- template: t,
6098
- data: e
6173
+ template: t
6099
6174
  }) {
6100
6175
  const {
6101
- canvas: s,
6102
- montageArea: o,
6103
- historyManager: i,
6104
- errorManager: a,
6105
- backgroundManager: r
6106
- } = this.editor, { objects: c, meta: l, id: h } = t != null ? t : {};
6107
- if (!(c != null && c.length))
6108
- return a.emitWarning({
6176
+ canvas: n,
6177
+ montageArea: s,
6178
+ historyManager: o,
6179
+ errorManager: i,
6180
+ backgroundManager: a
6181
+ } = this.editor, { objects: r, meta: c, id: l } = t != null ? t : {};
6182
+ if (!(r != null && r.length))
6183
+ return i.emitWarning({
6109
6184
  origin: "TemplateManager",
6110
6185
  method: "applyTemplate",
6111
6186
  code: Tt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
6112
6187
  message: "Шаблон не содержит объектов"
6113
6188
  }), null;
6114
- const u = Y._getBounds(o);
6115
- if (!u)
6116
- return a.emitWarning({
6189
+ const h = H._getBounds(s);
6190
+ if (!h)
6191
+ return i.emitWarning({
6117
6192
  origin: "TemplateManager",
6118
6193
  method: "applyTemplate",
6119
6194
  code: Tt.TEMPLATE_MANAGER.INVALID_TARGET,
6120
6195
  message: "Не удалось определить границы монтажной области"
6121
6196
  }), null;
6122
- const f = Y._getMontageSize({ montageArea: o, bounds: u }), g = Y._normalizeMeta({ meta: l, fallback: f }), m = Y._calculateScale({ meta: g, target: f }), p = !!g.positionsNormalized;
6123
- let v = !1, M = !1;
6124
- i.suspendHistory();
6197
+ const u = H._getMontageSize({ montageArea: s, bounds: h }), f = H._normalizeMeta({ meta: c, fallback: u }), p = H._calculateScale({ meta: f, target: u }), m = !!f.positionsNormalized;
6198
+ let g = !1, v = !1;
6199
+ o.suspendHistory();
6125
6200
  try {
6126
- const j = yield Y._enlivenObjects(c);
6127
- if (!j.length)
6128
- return a.emitWarning({
6201
+ const M = yield H._enlivenObjects(r);
6202
+ if (!M.length)
6203
+ return i.emitWarning({
6129
6204
  origin: "TemplateManager",
6130
6205
  method: "applyTemplate",
6131
6206
  code: Tt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
6132
6207
  message: "Не удалось создать объекты шаблона"
6133
6208
  }), null;
6134
- const { backgroundObject: y, contentObjects: w } = Y._extractBackgroundObject(j);
6135
- y && (M = yield Y._applyBackgroundFromObject({
6136
- backgroundObject: y,
6137
- backgroundManager: r,
6138
- errorManager: a
6209
+ const { backgroundObject: C, contentObjects: y } = H._extractBackgroundObject(M);
6210
+ C && (v = yield H._applyBackgroundFromObject({
6211
+ backgroundObject: C,
6212
+ backgroundManager: a,
6213
+ errorManager: i
6139
6214
  }));
6140
- const I = w.map((C) => (this._adaptTextboxWidth({
6141
- object: C,
6142
- baseWidth: g.baseWidth
6143
- }), Y._transformObject({
6144
- object: C,
6145
- scale: m,
6146
- bounds: u,
6147
- targetSize: f,
6148
- baseWidth: g.baseWidth,
6149
- baseHeight: g.baseHeight,
6150
- montageArea: o,
6151
- useRelativePositions: p
6152
- }), C.set({
6153
- id: `${C.type}-${$()}`,
6215
+ const w = y.map((j) => (this._adaptTextboxWidth({
6216
+ object: j,
6217
+ baseWidth: f.baseWidth
6218
+ }), H._transformObject({
6219
+ object: j,
6220
+ scale: p,
6221
+ bounds: h,
6222
+ targetSize: u,
6223
+ baseWidth: f.baseWidth,
6224
+ baseHeight: f.baseHeight,
6225
+ montageArea: s,
6226
+ useRelativePositions: m
6227
+ }), j.set({
6228
+ id: `${j.type}-${tt()}`,
6154
6229
  evented: !0
6155
- }), s.add(C), C));
6156
- return !I.length && !M ? null : (v = I.length > 0 || M, I.length && Y._activateObjects({ canvas: s, objects: I }), s.requestRenderAll(), s.fire("editor:template-applied", {
6230
+ }), n.add(j), j));
6231
+ return !w.length && !v ? null : (g = w.length > 0 || v, w.length && H._activateObjects({ canvas: n, objects: w }), n.requestRenderAll(), n.fire("editor:template-applied", {
6157
6232
  template: t,
6158
- objects: I,
6159
- bounds: u
6160
- }), I);
6161
- } catch (j) {
6162
- return a.emitError({
6233
+ objects: w,
6234
+ bounds: h
6235
+ }), w);
6236
+ } catch (M) {
6237
+ return i.emitError({
6163
6238
  origin: "TemplateManager",
6164
6239
  method: "applyTemplate",
6165
6240
  code: Tt.TEMPLATE_MANAGER.APPLY_FAILED,
6166
6241
  message: "Ошибка применения шаблона",
6167
6242
  data: {
6168
- templateId: h,
6169
- error: j
6243
+ templateId: l,
6244
+ error: M
6170
6245
  }
6171
6246
  }), null;
6172
6247
  } finally {
6173
- i.resumeHistory(), v && i.saveState();
6248
+ o.resumeHistory(), g && o.saveState();
6174
6249
  }
6175
6250
  });
6176
6251
  }
@@ -6204,13 +6279,13 @@ class Y {
6204
6279
  static _enlivenObjects(t) {
6205
6280
  return Z(this, null, function* () {
6206
6281
  return (yield Promise.all(t.map((n) => Z(null, null, function* () {
6207
- if (Y._hasSerializedSvgMarkup(n)) {
6208
- const i = yield Y._reviveSvgObject(n);
6282
+ if (H._hasSerializedSvgMarkup(n)) {
6283
+ const i = yield H._reviveSvgObject(n);
6209
6284
  if (i)
6210
- return Y._restoreImageScale({ revived: i, serialized: n }), i;
6285
+ return H._restoreImageScale({ revived: i, serialized: n }), i;
6211
6286
  }
6212
6287
  const s = yield yt.enlivenObjects([n]), o = s == null ? void 0 : s[0];
6213
- return o ? (Y._restoreImageScale({ revived: o, serialized: n }), o) : null;
6288
+ return o ? (H._restoreImageScale({ revived: o, serialized: n }), o) : null;
6214
6289
  })))).filter((n) => !!n);
6215
6290
  });
6216
6291
  }
@@ -6232,28 +6307,28 @@ class Y {
6232
6307
  naturalWidth: h = 0,
6233
6308
  naturalHeight: u = 0,
6234
6309
  width: f = 0,
6235
- height: g = 0
6310
+ height: p = 0
6236
6311
  } = l instanceof HTMLImageElement ? l : {
6237
6312
  naturalWidth: 0,
6238
6313
  naturalHeight: 0,
6239
6314
  width: 0,
6240
6315
  height: 0
6241
- }, m = tt({ value: h || f || c.width, fallback: 0 }), p = tt({ value: u || g || c.height, fallback: 0 }), v = tt({ value: s, fallback: m }), M = tt({ value: o, fallback: p }), j = tt({ value: i, fallback: c.scaleX || 1 }), y = tt({ value: a, fallback: c.scaleY || 1 }), w = v * j, I = M * y, C = m > 0, b = p > 0, A = w > 0, S = I > 0, T = Y._resolveImageFit({ customData: r }), O = {};
6242
- if (C && (O.width = m), b && (O.height = p), !C || !b) {
6316
+ }, m = et({ value: h || f || c.width, fallback: 0 }), g = et({ value: u || p || c.height, fallback: 0 }), v = et({ value: s, fallback: m }), M = et({ value: o, fallback: g }), C = et({ value: i, fallback: c.scaleX || 1 }), y = et({ value: a, fallback: c.scaleY || 1 }), w = v * C, j = M * y, T = m > 0, b = g > 0, A = w > 0, S = j > 0, I = H._resolveImageFit({ customData: r }), O = {};
6317
+ if (T && (O.width = m), b && (O.height = g), !T || !b) {
6243
6318
  c.set(O);
6244
6319
  return;
6245
6320
  }
6246
- if (T === "stretch") {
6247
- const U = A ? w / m : null, F = S ? I / p : null;
6248
- U && U > 0 && (O.scaleX = U), F && F > 0 && (O.scaleY = F), c.set(O);
6321
+ if (I === "stretch") {
6322
+ const W = A ? w / m : null, z = S ? j / g : null;
6323
+ W && W > 0 && (O.scaleX = W), z && z > 0 && (O.scaleY = z), c.set(O);
6249
6324
  return;
6250
6325
  }
6251
6326
  if (!A || !S) {
6252
6327
  c.set(O);
6253
6328
  return;
6254
6329
  }
6255
- const P = Math.min(w / m, I / p);
6256
- Number.isFinite(P) && P > 0 && (O.scaleX = P, O.scaleY = P), c.set(O);
6330
+ const N = Math.min(w / m, j / g);
6331
+ Number.isFinite(N) && N > 0 && (O.scaleX = N, O.scaleY = N), c.set(O);
6257
6332
  }
6258
6333
  /**
6259
6334
  * Определяет режим вписывания изображения при восстановлении.
@@ -6279,8 +6354,8 @@ class Y {
6279
6354
  const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
6280
6355
  if (!e) return null;
6281
6356
  try {
6282
- const n = yield Tn(e), s = yt.groupSVGElements(n.objects, n.options), o = yield yt.enlivenObjectEnlivables(
6283
- Y._prepareSerializableProps(t)
6357
+ const n = yield On(e), s = yt.groupSVGElements(n.objects, n.options), o = yield yt.enlivenObjectEnlivables(
6358
+ H._prepareSerializableProps(t)
6284
6359
  );
6285
6360
  return s.set(o), s.setCoords(), s;
6286
6361
  } catch (n) {
@@ -6292,7 +6367,7 @@ class Y {
6292
6367
  * Убирает технические поля сериализации, оставляя только применимые свойства.
6293
6368
  */
6294
6369
  static _prepareSerializableProps(t) {
6295
- const e = L({}, t);
6370
+ const e = x({}, t);
6296
6371
  return delete e.svgMarkup, delete e.objects, delete e.path, delete e.paths, delete e.type, delete e.version, e;
6297
6372
  }
6298
6373
  /**
@@ -6338,34 +6413,34 @@ class Y {
6338
6413
  montageArea: a,
6339
6414
  useRelativePositions: r
6340
6415
  }) {
6341
- const c = t, { x: l, y: h } = Ls({
6416
+ const c = t, { x: l, y: h } = Ds({
6342
6417
  object: t,
6343
6418
  baseWidth: o,
6344
6419
  baseHeight: i,
6345
6420
  useRelativePositions: r,
6346
6421
  centerKeys: {
6347
6422
  x: qt,
6348
- y: Me
6423
+ y: Se
6349
6424
  }
6350
- }), { scaleX: u, scaleY: f } = t, g = tt({ value: u, fallback: 1 }), m = tt({ value: f, fallback: 1 }), p = Y._getPositioningBounds({
6425
+ }), { scaleX: u, scaleY: f } = t, p = et({ value: u, fallback: 1 }), m = et({ value: f, fallback: 1 }), g = H._getPositioningBounds({
6351
6426
  bounds: n,
6352
6427
  baseWidth: o,
6353
6428
  baseHeight: i,
6354
6429
  scale: e,
6355
6430
  useRelativePositions: r,
6356
- anchorX: Y._resolveAnchor(c, le),
6357
- anchorY: Y._resolveAnchor(c, Se)
6358
- }), v = Ds({
6431
+ anchorX: H._resolveAnchor(c, le),
6432
+ anchorY: H._resolveAnchor(c, we)
6433
+ }), v = _s({
6359
6434
  normalizedX: l,
6360
6435
  normalizedY: h,
6361
- bounds: p,
6436
+ bounds: g,
6362
6437
  targetSize: s,
6363
6438
  montageArea: a
6364
- }), M = g * e, j = m * e;
6439
+ }), M = p * e, C = m * e;
6365
6440
  t.set({
6366
6441
  scaleX: M,
6367
- scaleY: j
6368
- }), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[qt], delete c[Me], delete c[le], delete c[Se];
6442
+ scaleY: C
6443
+ }), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[qt], delete c[Se], delete c[le], delete c[we];
6369
6444
  }
6370
6445
  /**
6371
6446
  * Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
@@ -6381,7 +6456,7 @@ class Y {
6381
6456
  anchorY: a
6382
6457
  }) {
6383
6458
  if (!o) return t;
6384
- const r = (e || t.width) * s, c = (n || t.height) * s, l = t.width - r, h = t.height - c, u = t.left + Y._calculateAnchorOffset(i, l), f = t.top + Y._calculateAnchorOffset(a, h);
6459
+ const r = (e || t.width) * s, c = (n || t.height) * s, l = t.width - r, h = t.height - c, u = t.left + H._calculateAnchorOffset(i, l), f = t.top + H._calculateAnchorOffset(a, h);
6385
6460
  return {
6386
6461
  left: u,
6387
6462
  top: f,
@@ -6413,7 +6488,7 @@ class Y {
6413
6488
  fallback: e
6414
6489
  }) {
6415
6490
  const { width: n, height: s } = e, r = t || {}, { baseWidth: o = n, baseHeight: i = s } = r, a = Mt(r, ["baseWidth", "baseHeight"]);
6416
- return L({
6491
+ return x({
6417
6492
  baseWidth: o,
6418
6493
  baseHeight: i
6419
6494
  }, a);
@@ -6454,26 +6529,26 @@ class Y {
6454
6529
  if (!(t instanceof dt)) return;
6455
6530
  const n = typeof t.text == "string" ? t.text : "";
6456
6531
  if (!n) return;
6457
- const s = tt({
6532
+ const s = et({
6458
6533
  value: (B = (E = this.editor) == null ? void 0 : E.montageArea) == null ? void 0 : B.width,
6459
6534
  fallback: 0
6460
6535
  }), {
6461
6536
  width: o = 0,
6462
6537
  scaleX: i = 1,
6463
6538
  strokeWidth: a = 0
6464
- } = t, r = tt({ value: e, fallback: 0 }), c = t, l = tt({ value: c.paddingLeft, fallback: 0 }), h = tt({ value: c.paddingRight, fallback: 0 }), u = tt({ value: i, fallback: 1 }), f = tt({ value: a, fallback: 0 }) * u, g = tt({ value: o, fallback: 0 }), m = g * u, p = l * u, v = h * u, M = m + p + v + f;
6465
- if (!s || !g || !r) return;
6539
+ } = t, r = et({ value: e, fallback: 0 }), c = t, l = et({ value: c.paddingLeft, fallback: 0 }), h = et({ value: c.paddingRight, fallback: 0 }), u = et({ value: i, fallback: 1 }), f = et({ value: a, fallback: 0 }) * u, p = et({ value: o, fallback: 0 }), m = p * u, g = l * u, v = h * u, M = m + g + v + f;
6540
+ if (!s || !p || !r) return;
6466
6541
  t.setCoords();
6467
- const j = t, y = j[qt], w = typeof y == "number" ? y : null, I = Y._resolveAnchor(j, le), C = M / r, b = w !== null ? w - C / 2 : null, A = w !== null ? w + C / 2 : null, S = t.getCenterPoint();
6542
+ const C = t, y = C[qt], w = typeof y == "number" ? y : null, j = H._resolveAnchor(C, le), T = M / r, b = w !== null ? w - T / 2 : null, A = w !== null ? w + T / 2 : null, S = t.getCenterPoint();
6468
6543
  t.set("width", s), t.initDimensions();
6469
- const T = Y._getLongestLineWidth({
6544
+ const I = H._getLongestLineWidth({
6470
6545
  textbox: t,
6471
6546
  text: n
6472
- }), O = T > g ? T + 1 : g;
6547
+ }), O = I > p ? I + 1 : p;
6473
6548
  t.set("width", O), t.initDimensions(), t.setPositionByOrigin(S, "center", "center"), t.setCoords();
6474
- const U = (O * u + p + v + f) / r;
6475
- let F = w;
6476
- I === "start" && b !== null ? F = Math.max(0, b) + U / 2 : I === "end" && A !== null && (F = Math.min(1, A) - U / 2), typeof F == "number" && (j[qt] = F);
6549
+ const W = (O * u + g + v + f) / r;
6550
+ let z = w;
6551
+ j === "start" && b !== null ? z = Math.max(0, b) + W / 2 : j === "end" && A !== null && (z = Math.min(1, A) - W / 2), typeof z == "number" && (C[qt] = z);
6477
6552
  }
6478
6553
  /**
6479
6554
  * Возвращает ширину самой длинной строки текстового объекта.
@@ -6503,9 +6578,9 @@ class Y {
6503
6578
  baseHeight: s,
6504
6579
  montageArea: o
6505
6580
  }) {
6506
- const i = t.toDatalessObject([...Te]);
6507
- if (Y._isSvgObject(t)) {
6508
- const y = Y._extractSvgMarkup(t);
6581
+ const i = t.toDatalessObject([...Oe]);
6582
+ if (H._isSvgObject(t)) {
6583
+ const y = H._extractSvgMarkup(t);
6509
6584
  y && (i.svgMarkup = y, delete i.objects, delete i.path);
6510
6585
  }
6511
6586
  if (!e) return i;
@@ -6514,26 +6589,26 @@ class Y {
6514
6589
  top: r,
6515
6590
  width: c,
6516
6591
  height: l
6517
- } = e, h = t.getBoundingRect(!1, !0), u = n || c || 1, f = s || l || 1, g = _s({
6592
+ } = e, h = t.getBoundingRect(!1, !0), u = n || c || 1, f = s || l || 1, p = xs({
6518
6593
  object: t,
6519
6594
  montageArea: o,
6520
6595
  bounds: e
6521
- }), m = g != null ? g : (() => {
6596
+ }), m = p != null ? p : (() => {
6522
6597
  const y = t.getCenterPoint();
6523
6598
  return {
6524
6599
  x: (y.x - a) / u,
6525
6600
  y: (y.y - r) / f
6526
6601
  };
6527
- })(), p = (h.left - a) / u, v = (h.top - r) / f, M = p + h.width / u, j = v + h.height / f;
6528
- return i[qt] = m.x, i[Me] = m.y, i[le] = Y._detectAnchor({
6602
+ })(), g = (h.left - a) / u, v = (h.top - r) / f, M = g + h.width / u, C = v + h.height / f;
6603
+ return i[qt] = m.x, i[Se] = m.y, i[le] = H._detectAnchor({
6529
6604
  center: m.x,
6530
- start: p,
6605
+ start: g,
6531
6606
  end: M
6532
- }), i[Se] = Y._detectAnchor({
6607
+ }), i[we] = H._detectAnchor({
6533
6608
  center: m.y,
6534
6609
  start: v,
6535
- end: j
6536
- }), i.left = p, i.top = v, i;
6610
+ end: C
6611
+ }), i.left = g, i.top = v, i;
6537
6612
  }
6538
6613
  /**
6539
6614
  * Делит список объектов на фон и контент по id === 'background'.
@@ -6555,7 +6630,7 @@ class Y {
6555
6630
  errorManager: n
6556
6631
  }) {
6557
6632
  try {
6558
- const { fill: o, customData: i } = t, { backgroundType: a } = t, r = Y._cloneCustomData(i);
6633
+ const { fill: o, customData: i } = t, { backgroundType: a } = t, r = H._cloneCustomData(i);
6559
6634
  if (a === "color" && typeof o == "string")
6560
6635
  return e.setColorBackground({
6561
6636
  color: o,
@@ -6564,7 +6639,7 @@ class Y {
6564
6639
  withoutSave: !0
6565
6640
  }), !0;
6566
6641
  if (a === "gradient") {
6567
- const c = Rs(o);
6642
+ const c = ks(o);
6568
6643
  if (c)
6569
6644
  return e.setGradientBackground({
6570
6645
  gradient: c,
@@ -6574,7 +6649,7 @@ class Y {
6574
6649
  }), !0;
6575
6650
  }
6576
6651
  if (a === "image") {
6577
- const c = Y._getImageSource(t);
6652
+ const c = H._getImageSource(t);
6578
6653
  if (c)
6579
6654
  return yield e.setImageBackground({
6580
6655
  imageSource: c,
@@ -6617,7 +6692,7 @@ class Y {
6617
6692
  */
6618
6693
  static _cloneCustomData(t) {
6619
6694
  if (!(!t || typeof t != "object"))
6620
- return L({}, t);
6695
+ return x({}, t);
6621
6696
  }
6622
6697
  /**
6623
6698
  * Извлекает src изображения из FabricImage или его исходного элемента.
@@ -6646,7 +6721,7 @@ class Y {
6646
6721
  return yt.enlivenObjectEnlivables(t);
6647
6722
  }
6648
6723
  }
6649
- const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
6724
+ const Ns = 5, mn = "#3D8BF4", De = 1, de = 1, dn = ({
6650
6725
  anchors: d,
6651
6726
  positions: t,
6652
6727
  threshold: e
@@ -6661,16 +6736,16 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
6661
6736
  delta: n,
6662
6737
  guidePosition: o
6663
6738
  };
6664
- }, Ns = ({
6739
+ }, Bs = ({
6665
6740
  activeBounds: d,
6666
6741
  threshold: t,
6667
6742
  anchors: e
6668
6743
  }) => {
6669
- const { left: n, right: s, centerX: o, top: i, bottom: a, centerY: r } = d, c = ln({
6744
+ const { left: n, right: s, centerX: o, top: i, bottom: a, centerY: r } = d, c = dn({
6670
6745
  anchors: e.vertical,
6671
6746
  positions: [n, o, s],
6672
6747
  threshold: t
6673
- }), l = ln({
6748
+ }), l = dn({
6674
6749
  anchors: e.horizontal,
6675
6750
  positions: [i, r, a],
6676
6751
  threshold: t
@@ -6686,7 +6761,7 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
6686
6761
  deltaY: l.delta,
6687
6762
  guides: h
6688
6763
  };
6689
- }, mn = ({
6764
+ }, yn = ({
6690
6765
  activeBounds: d,
6691
6766
  aligned: t,
6692
6767
  threshold: e,
@@ -6705,7 +6780,7 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
6705
6780
  if (s === "vertical") {
6706
6781
  const u = o - h.bottom, f = Math.abs(u - l.distance);
6707
6782
  if (f <= e) {
6708
- const p = l.distance - u, v = {
6783
+ const g = l.distance - u, v = {
6709
6784
  type: s,
6710
6785
  axis: l.axis,
6711
6786
  refStart: l.start,
@@ -6714,11 +6789,11 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
6714
6789
  activeEnd: h.bottom + l.distance,
6715
6790
  distance: l.distance
6716
6791
  };
6717
- c.push({ delta: p, guide: v, diff: f });
6792
+ c.push({ delta: g, guide: v, diff: f });
6718
6793
  }
6719
- const g = h.top - i, m = Math.abs(g - l.distance);
6794
+ const p = h.top - i, m = Math.abs(p - l.distance);
6720
6795
  if (m <= e) {
6721
- const p = l.distance - g, v = {
6796
+ const g = l.distance - p, v = {
6722
6797
  type: s,
6723
6798
  axis: l.axis,
6724
6799
  refStart: l.start,
@@ -6727,12 +6802,12 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
6727
6802
  activeEnd: h.top,
6728
6803
  distance: l.distance
6729
6804
  };
6730
- c.push({ delta: p, guide: v, diff: m });
6805
+ c.push({ delta: g, guide: v, diff: m });
6731
6806
  }
6732
6807
  } else {
6733
6808
  const u = a - h.right, f = Math.abs(u - l.distance);
6734
6809
  if (f <= e) {
6735
- const p = l.distance - u, v = {
6810
+ const g = l.distance - u, v = {
6736
6811
  type: s,
6737
6812
  axis: l.axis,
6738
6813
  refStart: l.start,
@@ -6741,11 +6816,11 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
6741
6816
  activeEnd: h.right + l.distance,
6742
6817
  distance: l.distance
6743
6818
  };
6744
- c.push({ delta: p, guide: v, diff: f });
6819
+ c.push({ delta: g, guide: v, diff: f });
6745
6820
  }
6746
- const g = h.left - r, m = Math.abs(g - l.distance);
6821
+ const p = h.left - r, m = Math.abs(p - l.distance);
6747
6822
  if (m <= e) {
6748
- const p = l.distance - g, v = {
6823
+ const g = l.distance - p, v = {
6749
6824
  type: s,
6750
6825
  axis: l.axis,
6751
6826
  refStart: l.start,
@@ -6754,11 +6829,11 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
6754
6829
  activeEnd: h.left,
6755
6830
  distance: l.distance
6756
6831
  };
6757
- c.push({ delta: p, guide: v, diff: m });
6832
+ c.push({ delta: g, guide: v, diff: m });
6758
6833
  }
6759
6834
  }
6760
6835
  return c;
6761
- }, Bs = ({
6836
+ }, zs = ({
6762
6837
  activeBounds: d,
6763
6838
  candidates: t,
6764
6839
  threshold: e,
@@ -6781,70 +6856,70 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
6781
6856
  const h = l.findIndex((y) => y.isActive);
6782
6857
  if (h === -1)
6783
6858
  return { delta: 0, guide: null };
6784
- const u = l[h - 1], f = l[h - 2], g = l[h + 1], m = l[h + 2], p = [], v = i - o;
6859
+ const u = l[h - 1], f = l[h - 2], p = l[h + 1], m = l[h + 2], g = [], v = i - o;
6785
6860
  if (u && f) {
6786
- const { bounds: y } = u, { bounds: w } = f, I = y.top - w.bottom, C = o - y.bottom, b = Math.abs(C - I);
6861
+ const { bounds: y } = u, { bounds: w } = f, j = y.top - w.bottom, T = o - y.bottom, b = Math.abs(T - j);
6787
6862
  if (b <= e) {
6788
- const A = I - C, S = o + A, T = {
6863
+ const A = j - T, S = o + A, I = {
6789
6864
  type: "vertical",
6790
6865
  axis: s,
6791
6866
  refStart: w.bottom,
6792
6867
  refEnd: y.top,
6793
6868
  activeStart: y.bottom,
6794
6869
  activeEnd: S,
6795
- distance: I
6870
+ distance: j
6796
6871
  };
6797
- p.push({ delta: A, guide: T, diff: b });
6872
+ g.push({ delta: A, guide: I, diff: b });
6798
6873
  }
6799
6874
  }
6800
- if (g && m) {
6801
- const { bounds: y } = g, { bounds: w } = m, I = w.top - y.bottom, C = y.top - i, b = Math.abs(C - I);
6875
+ if (p && m) {
6876
+ const { bounds: y } = p, { bounds: w } = m, j = w.top - y.bottom, T = y.top - i, b = Math.abs(T - j);
6802
6877
  if (b <= e) {
6803
- const A = C - I, S = i + A, T = {
6878
+ const A = T - j, S = i + A, I = {
6804
6879
  type: "vertical",
6805
6880
  axis: s,
6806
6881
  refStart: y.bottom,
6807
6882
  refEnd: w.top,
6808
6883
  activeStart: S,
6809
6884
  activeEnd: y.top,
6810
- distance: I
6885
+ distance: j
6811
6886
  };
6812
- p.push({ delta: A, guide: T, diff: b });
6887
+ g.push({ delta: A, guide: I, diff: b });
6813
6888
  }
6814
6889
  }
6815
- if (u && g) {
6816
- const { bounds: y } = u, { bounds: w } = g, C = w.top - y.bottom - v;
6817
- if (C >= 0) {
6818
- const b = C / 2, A = o - y.bottom, S = w.top - i, T = Math.abs(A - b), O = Math.abs(S - b), P = Math.max(T, O);
6819
- if (P <= e) {
6820
- const U = b - A, F = i + U, E = {
6890
+ if (u && p) {
6891
+ const { bounds: y } = u, { bounds: w } = p, T = w.top - y.bottom - v;
6892
+ if (T >= 0) {
6893
+ const b = T / 2, A = o - y.bottom, S = w.top - i, I = Math.abs(A - b), O = Math.abs(S - b), N = Math.max(I, O);
6894
+ if (N <= e) {
6895
+ const W = b - A, z = i + W, E = {
6821
6896
  type: "vertical",
6822
6897
  axis: s,
6823
6898
  refStart: y.bottom,
6824
6899
  refEnd: y.bottom + b,
6825
- activeStart: F,
6826
- activeEnd: F + b,
6900
+ activeStart: z,
6901
+ activeEnd: z + b,
6827
6902
  distance: b
6828
6903
  };
6829
- p.push({ delta: U, guide: E, diff: P });
6904
+ g.push({ delta: W, guide: E, diff: N });
6830
6905
  }
6831
6906
  }
6832
6907
  }
6833
- const M = mn({
6908
+ const M = yn({
6834
6909
  activeBounds: d,
6835
6910
  aligned: c,
6836
6911
  threshold: e,
6837
6912
  patterns: n,
6838
6913
  type: "vertical"
6839
6914
  });
6840
- if (p.push(...M), !p.length)
6915
+ if (g.push(...M), !g.length)
6841
6916
  return { delta: 0, guide: null };
6842
- const j = p.reduce((y, w) => w.diff < y.diff ? w : y, p[0]);
6917
+ const C = g.reduce((y, w) => w.diff < y.diff ? w : y, g[0]);
6843
6918
  return {
6844
- delta: j.delta,
6845
- guide: j.guide
6919
+ delta: C.delta,
6920
+ guide: C.guide
6846
6921
  };
6847
- }, zs = ({
6922
+ }, Ps = ({
6848
6923
  activeBounds: d,
6849
6924
  candidates: t,
6850
6925
  threshold: e,
@@ -6867,81 +6942,81 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
6867
6942
  const h = l.findIndex((y) => y.isActive);
6868
6943
  if (h === -1)
6869
6944
  return { delta: 0, guide: null };
6870
- const u = l[h - 1], f = l[h - 2], g = l[h + 1], m = l[h + 2], p = [], v = i - o;
6945
+ const u = l[h - 1], f = l[h - 2], p = l[h + 1], m = l[h + 2], g = [], v = i - o;
6871
6946
  if (u && f) {
6872
- const { bounds: y } = u, { bounds: w } = f, I = y.left - w.right, C = o - y.right, b = Math.abs(C - I);
6947
+ const { bounds: y } = u, { bounds: w } = f, j = y.left - w.right, T = o - y.right, b = Math.abs(T - j);
6873
6948
  if (b <= e) {
6874
- const A = I - C, S = o + A, T = {
6949
+ const A = j - T, S = o + A, I = {
6875
6950
  type: "horizontal",
6876
6951
  axis: s,
6877
6952
  refStart: w.right,
6878
6953
  refEnd: y.left,
6879
6954
  activeStart: y.right,
6880
6955
  activeEnd: S,
6881
- distance: I
6956
+ distance: j
6882
6957
  };
6883
- p.push({ delta: A, guide: T, diff: b });
6958
+ g.push({ delta: A, guide: I, diff: b });
6884
6959
  }
6885
6960
  }
6886
- if (g && m) {
6887
- const { bounds: y } = g, { bounds: w } = m, I = w.left - y.right, C = y.left - i, b = Math.abs(C - I);
6961
+ if (p && m) {
6962
+ const { bounds: y } = p, { bounds: w } = m, j = w.left - y.right, T = y.left - i, b = Math.abs(T - j);
6888
6963
  if (b <= e) {
6889
- const A = C - I, S = i + A, T = {
6964
+ const A = T - j, S = i + A, I = {
6890
6965
  type: "horizontal",
6891
6966
  axis: s,
6892
6967
  refStart: y.right,
6893
6968
  refEnd: w.left,
6894
6969
  activeStart: S,
6895
6970
  activeEnd: y.left,
6896
- distance: I
6971
+ distance: j
6897
6972
  };
6898
- p.push({ delta: A, guide: T, diff: b });
6973
+ g.push({ delta: A, guide: I, diff: b });
6899
6974
  }
6900
6975
  }
6901
- if (u && g) {
6902
- const { bounds: y } = u, { bounds: w } = g, C = w.left - y.right - v;
6903
- if (C >= 0) {
6904
- const b = C / 2, A = o - y.right, S = w.left - i, T = Math.abs(A - b), O = Math.abs(S - b), P = Math.max(T, O);
6905
- if (P <= e) {
6906
- const U = b - A, F = i + U, E = {
6976
+ if (u && p) {
6977
+ const { bounds: y } = u, { bounds: w } = p, T = w.left - y.right - v;
6978
+ if (T >= 0) {
6979
+ const b = T / 2, A = o - y.right, S = w.left - i, I = Math.abs(A - b), O = Math.abs(S - b), N = Math.max(I, O);
6980
+ if (N <= e) {
6981
+ const W = b - A, z = i + W, E = {
6907
6982
  type: "horizontal",
6908
6983
  axis: s,
6909
6984
  refStart: y.right,
6910
6985
  refEnd: y.right + b,
6911
- activeStart: F,
6912
- activeEnd: F + b,
6986
+ activeStart: z,
6987
+ activeEnd: z + b,
6913
6988
  distance: b
6914
6989
  };
6915
- p.push({ delta: U, guide: E, diff: P });
6990
+ g.push({ delta: W, guide: E, diff: N });
6916
6991
  }
6917
6992
  }
6918
6993
  }
6919
- const M = mn({
6994
+ const M = yn({
6920
6995
  activeBounds: d,
6921
6996
  aligned: c,
6922
6997
  threshold: e,
6923
6998
  patterns: n,
6924
6999
  type: "horizontal"
6925
7000
  });
6926
- if (p.push(...M), !p.length)
7001
+ if (g.push(...M), !g.length)
6927
7002
  return { delta: 0, guide: null };
6928
- const j = p.reduce((y, w) => w.diff < y.diff ? w : y, p[0]);
7003
+ const C = g.reduce((y, w) => w.diff < y.diff ? w : y, g[0]);
6929
7004
  return {
6930
- delta: j.delta,
6931
- guide: j.guide
7005
+ delta: C.delta,
7006
+ guide: C.guide
6932
7007
  };
6933
- }, Ps = ({
7008
+ }, Fs = ({
6934
7009
  activeBounds: d,
6935
7010
  candidates: t,
6936
7011
  threshold: e,
6937
7012
  spacingPatterns: n
6938
7013
  }) => {
6939
- const s = Bs({
7014
+ const s = zs({
6940
7015
  activeBounds: d,
6941
7016
  candidates: t,
6942
7017
  threshold: e,
6943
7018
  patterns: n.vertical
6944
- }), o = zs({
7019
+ }), o = Ps({
6945
7020
  activeBounds: d,
6946
7021
  candidates: t,
6947
7022
  threshold: e,
@@ -6952,7 +7027,7 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
6952
7027
  deltaY: s.delta,
6953
7028
  guides: i
6954
7029
  };
6955
- }, Fs = ({
7030
+ }, Ws = ({
6956
7031
  context: d,
6957
7032
  x: t,
6958
7033
  y: e,
@@ -6962,7 +7037,7 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
6962
7037
  }) => {
6963
7038
  const i = Math.min(o, n / 2, s / 2);
6964
7039
  d.moveTo(t + i, e), d.lineTo(t + n - i, e), d.quadraticCurveTo(t + n, e, t + n, e + i), d.lineTo(t + n, e + s - i), d.quadraticCurveTo(t + n, e + s, t + n - i, e + s), d.lineTo(t + i, e + s), d.quadraticCurveTo(t, e + s, t, e + s - i), d.lineTo(t, e + i), d.quadraticCurveTo(t, e, t + i, e), d.closePath();
6965
- }, Ee = ({
7040
+ }, _e = ({
6966
7041
  context: d,
6967
7042
  type: t,
6968
7043
  axis: e,
@@ -6977,16 +7052,16 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
6977
7052
  padding: h = 4,
6978
7053
  radius: u = 4,
6979
7054
  offsetAlongAxis: f = 0,
6980
- offsetPerpendicular: g = 0
7055
+ offsetPerpendicular: p = 0
6981
7056
  }) => {
6982
- const m = i || 1, p = 12 / m, v = h / m, M = u / m, j = (n + s) / 2 + f, y = t === "vertical" ? e + g : j, w = t === "vertical" ? j : e + g;
6983
- d.save(), d.setLineDash([]), d.fillStyle = a, d.strokeStyle = a, d.lineWidth = l / m, d.font = `${p}px ${c}`, d.textAlign = "center", d.textBaseline = "middle";
6984
- const C = d.measureText(o).width + v * 2, b = p + v * 2, A = y - C / 2, S = w - b / 2;
6985
- d.beginPath(), Fs({
7057
+ const m = i || 1, g = 12 / m, v = h / m, M = u / m, C = (n + s) / 2 + f, y = t === "vertical" ? e + p : C, w = t === "vertical" ? C : e + p;
7058
+ d.save(), d.setLineDash([]), d.fillStyle = a, d.strokeStyle = a, d.lineWidth = l / m, d.font = `${g}px ${c}`, d.textAlign = "center", d.textBaseline = "middle";
7059
+ const T = d.measureText(o).width + v * 2, b = g + v * 2, A = y - T / 2, S = w - b / 2;
7060
+ d.beginPath(), Ws({
6986
7061
  context: d,
6987
7062
  x: A,
6988
7063
  y: S,
6989
- width: C,
7064
+ width: T,
6990
7065
  height: b,
6991
7066
  radius: M
6992
7067
  }), d.fill(), d.fillStyle = r, d.fillText(o, y, w), d.restore();
@@ -7005,8 +7080,8 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
7005
7080
  distance: c
7006
7081
  } = t, l = Math.round(c).toString();
7007
7082
  d.beginPath(), n === "vertical" ? (d.moveTo(s, o), d.lineTo(s, i), d.moveTo(s, a), d.lineTo(s, r)) : (d.moveTo(o, s), d.lineTo(i, s), d.moveTo(a, s), d.lineTo(r, s)), d.stroke();
7008
- const h = pn;
7009
- Ee({
7083
+ const h = mn;
7084
+ _e({
7010
7085
  context: d,
7011
7086
  type: n,
7012
7087
  axis: s,
@@ -7015,8 +7090,8 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
7015
7090
  text: l,
7016
7091
  zoom: e,
7017
7092
  color: h,
7018
- lineWidth: Oe
7019
- }), Ee({
7093
+ lineWidth: De
7094
+ }), _e({
7020
7095
  context: d,
7021
7096
  type: n,
7022
7097
  axis: s,
@@ -7025,9 +7100,9 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
7025
7100
  text: l,
7026
7101
  zoom: e,
7027
7102
  color: h,
7028
- lineWidth: Oe
7103
+ lineWidth: De
7029
7104
  });
7030
- }, dn = ({
7105
+ }, hn = ({
7031
7106
  anchors: d,
7032
7107
  bounds: t
7033
7108
  }) => {
@@ -7040,7 +7115,7 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
7040
7115
  centerY: a
7041
7116
  } = t;
7042
7117
  d.vertical.push(e, s, n), d.horizontal.push(o, a, i);
7043
- }, hn = ({
7118
+ }, un = ({
7044
7119
  bounds: d,
7045
7120
  type: t,
7046
7121
  primaryStart: e,
@@ -7051,46 +7126,46 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
7051
7126
  const c = a[r];
7052
7127
  let l = null, h = Number.POSITIVE_INFINITY;
7053
7128
  for (let m = r + 1; m < a.length; m += 1) {
7054
- const p = a[m];
7055
- if (Math.min(c[i], p[i]) - Math.max(c[o], p[o]) < 0) continue;
7056
- const M = p[e] - c[n];
7057
- M < 0 || M < h && (h = M, l = p);
7129
+ const g = a[m];
7130
+ if (Math.min(c[i], g[i]) - Math.max(c[o], g[o]) < 0) continue;
7131
+ const M = g[e] - c[n];
7132
+ M < 0 || M < h && (h = M, l = g);
7058
7133
  }
7059
7134
  if (!l || h === Number.POSITIVE_INFINITY) continue;
7060
- const u = Math.max(c[o], l[o]), f = Math.min(c[i], l[i]), g = (u + f) / 2;
7135
+ const u = Math.max(c[o], l[o]), f = Math.min(c[i], l[i]), p = (u + f) / 2;
7061
7136
  s.push({
7062
7137
  type: t,
7063
- axis: g,
7138
+ axis: p,
7064
7139
  start: c[n],
7065
7140
  end: l[e],
7066
7141
  distance: l[e] - c[n]
7067
7142
  });
7068
7143
  }
7069
7144
  return s;
7070
- }, Ws = ({
7145
+ }, Ys = ({
7071
7146
  bounds: d
7072
7147
  }) => {
7073
- const t = hn({
7148
+ const t = un({
7074
7149
  bounds: d,
7075
7150
  type: "vertical",
7076
7151
  primaryStart: "top",
7077
7152
  primaryEnd: "bottom"
7078
- }), e = hn({
7153
+ }), e = un({
7079
7154
  bounds: d,
7080
7155
  type: "horizontal",
7081
7156
  primaryStart: "left",
7082
7157
  primaryEnd: "right"
7083
7158
  });
7084
7159
  return { vertical: t, horizontal: e };
7085
- }, Ys = ["montage-area", "background", "interaction-blocker"], yn = ({
7160
+ }, Hs = ["montage-area", "background", "interaction-blocker"], vn = ({
7086
7161
  activeObject: d
7087
7162
  }) => {
7088
7163
  const t = /* @__PURE__ */ new Set();
7089
7164
  return d && (t.add(d), d instanceof X && d.getObjects().forEach((e) => t.add(e))), t;
7090
- }, vn = ({
7165
+ }, bn = ({
7091
7166
  object: d,
7092
7167
  excluded: t,
7093
- ignoredIds: e = Ys
7168
+ ignoredIds: e = Hs
7094
7169
  }) => {
7095
7170
  if (t.has(d)) return !0;
7096
7171
  const { visible: n = !0 } = d;
@@ -7098,7 +7173,7 @@ const ks = 5, pn = "#3D8BF4", Oe = 1, de = 1, ln = ({
7098
7173
  const { id: s } = d;
7099
7174
  return !!(s && e.includes(s));
7100
7175
  };
7101
- class Hs {
7176
+ class pe {
7102
7177
  /**
7103
7178
  * Создаёт менеджер прилипания и инициализирует слушатели событий.
7104
7179
  */
@@ -7145,14 +7220,14 @@ class Hs {
7145
7220
  * Выполняет привязку объекта к ближайшим линиям при его перемещении.
7146
7221
  */
7147
7222
  _handleObjectMoving(t) {
7148
- var m, p;
7223
+ var m, g;
7149
7224
  const { target: e, e: n } = t;
7150
7225
  if (!e) {
7151
7226
  this._clearGuides();
7152
7227
  return;
7153
7228
  }
7154
7229
  if (!!(n != null && n.ctrlKey)) {
7155
- this._clearGuides(), this._applyMovementStep({ target: e });
7230
+ this._clearGuides(), pe._applyMovementStep({ target: e });
7156
7231
  return;
7157
7232
  }
7158
7233
  !this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: e });
@@ -7161,7 +7236,7 @@ class Hs {
7161
7236
  this._clearGuides();
7162
7237
  return;
7163
7238
  }
7164
- const { canvas: i } = this, a = i.getZoom() || 1, r = ks / a, c = Ns({
7239
+ const { canvas: i } = this, a = i.getZoom() || 1, r = Ns / a, c = Bs({
7165
7240
  activeBounds: o,
7166
7241
  threshold: r,
7167
7242
  anchors: this.anchors
@@ -7173,23 +7248,23 @@ class Hs {
7173
7248
  top: M + h
7174
7249
  }), e.setCoords(), o = (m = wt({ object: e })) != null ? m : o;
7175
7250
  }
7176
- const f = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => wt({ object: v })).filter((v) => !!v), g = Ps({
7251
+ const f = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => wt({ object: v })).filter((v) => !!v), p = Fs({
7177
7252
  activeBounds: o,
7178
7253
  candidates: f,
7179
7254
  threshold: r,
7180
7255
  spacingPatterns: this.spacingPatterns
7181
7256
  });
7182
- if (g.deltaX !== 0 || g.deltaY !== 0) {
7257
+ if (p.deltaX !== 0 || p.deltaY !== 0) {
7183
7258
  const { left: v = 0, top: M = 0 } = e;
7184
7259
  e.set({
7185
- left: v + g.deltaX,
7186
- top: M + g.deltaY
7187
- }), e.setCoords(), o = (p = wt({ object: e })) != null ? p : o;
7260
+ left: v + p.deltaX,
7261
+ top: M + p.deltaY
7262
+ }), e.setCoords(), o = (g = wt({ object: e })) != null ? g : o;
7188
7263
  }
7189
7264
  this._applyGuides({
7190
7265
  guides: u,
7191
- spacingGuides: g.guides
7192
- }), this._applyMovementStep({ target: e });
7266
+ spacingGuides: p.guides
7267
+ }), pe._applyMovementStep({ target: e });
7193
7268
  }
7194
7269
  /**
7195
7270
  * Очищает направляющие и кеш после окончания перетаскивания.
@@ -7212,7 +7287,7 @@ class Hs {
7212
7287
  const { canvas: t, guideBounds: e } = this, n = t.getSelectionContext();
7213
7288
  if (!n) return;
7214
7289
  const s = e != null ? e : this._calculateViewportBounds(), { left: o, right: i, top: a, bottom: r } = s, { viewportTransform: c } = t, l = t.getZoom() || 1;
7215
- n.save(), Array.isArray(c) && n.transform(...c), n.lineWidth = Oe / l, n.strokeStyle = pn, n.setLineDash([4, 4]);
7290
+ n.save(), Array.isArray(c) && n.transform(...c), n.lineWidth = De / l, n.strokeStyle = mn, n.setLineDash([4, 4]);
7216
7291
  for (const h of this.activeGuides)
7217
7292
  n.beginPath(), h.type === "vertical" ? (n.moveTo(h.position, a), n.lineTo(h.position, r)) : (n.moveTo(o, h.position), n.lineTo(i, h.position)), n.stroke();
7218
7293
  for (const h of this.activeSpacingGuides)
@@ -7251,7 +7326,7 @@ class Hs {
7251
7326
  /**
7252
7327
  * Применяет шаг перемещения, округляя координаты объекта к сетке MOVE_SNAP_STEP.
7253
7328
  */
7254
- _applyMovementStep({ target: t }) {
7329
+ static _applyMovementStep({ target: t }) {
7255
7330
  const { left: e = 0, top: n = 0 } = t, s = Math.round(e / de) * de, o = Math.round(n / de) * de;
7256
7331
  s === e && o === n || (t.set({
7257
7332
  left: s,
@@ -7265,11 +7340,11 @@ class Hs {
7265
7340
  const e = this._collectTargets({ activeObject: t }), n = { vertical: [], horizontal: [] }, s = [];
7266
7341
  for (const a of e) {
7267
7342
  const r = wt({ object: a });
7268
- r && (dn({ anchors: n, bounds: r }), s.push(r));
7343
+ r && (hn({ anchors: n, bounds: r }), s.push(r));
7269
7344
  }
7270
7345
  const { montageArea: o } = this.editor, i = wt({ object: o });
7271
7346
  if (i) {
7272
- dn({ anchors: n, bounds: i });
7347
+ hn({ anchors: n, bounds: i });
7273
7348
  const { left: a, right: r, top: c, bottom: l } = i;
7274
7349
  this.guideBounds = {
7275
7350
  left: a,
@@ -7279,15 +7354,15 @@ class Hs {
7279
7354
  };
7280
7355
  } else
7281
7356
  this.guideBounds = this._calculateViewportBounds();
7282
- this.anchors = n, this.spacingPatterns = Ws({ bounds: s }), this.cachedTargetBounds = s;
7357
+ this.anchors = n, this.spacingPatterns = Ys({ bounds: s }), this.cachedTargetBounds = s;
7283
7358
  }
7284
7359
  /**
7285
7360
  * Собирает объекты, подходящие для прилипания, исключая активный объект и запрещённые id.
7286
7361
  */
7287
7362
  _collectTargets({ activeObject: t }) {
7288
- const e = yn({ activeObject: t }), n = [];
7363
+ const e = vn({ activeObject: t }), n = [];
7289
7364
  return this.canvas.forEachObject((s) => {
7290
- vn({ object: s, excluded: e }) || n.push(s);
7365
+ bn({ object: s, excluded: e }) || n.push(s);
7291
7366
  }), n;
7292
7367
  }
7293
7368
  /**
@@ -7310,7 +7385,7 @@ class Hs {
7310
7385
  };
7311
7386
  }
7312
7387
  }
7313
- const un = "#3D8BF4", fn = 1;
7388
+ const fn = "#3D8BF4", gn = 1;
7314
7389
  class zt {
7315
7390
  /**
7316
7391
  * Создаёт менеджер измерений и инициализирует события.
@@ -7451,8 +7526,8 @@ class zt {
7451
7526
  event: t,
7452
7527
  activeObject: e
7453
7528
  }) {
7454
- const { target: n } = t, s = yn({ activeObject: e });
7455
- return n && !vn({ object: n, excluded: s }) ? n : null;
7529
+ const { target: n } = t, s = vn({ activeObject: e });
7530
+ return n && !bn({ object: n, excluded: s }) ? n : null;
7456
7531
  }
7457
7532
  /**
7458
7533
  * Собирает вертикальные и горизонтальные направляющие расстояний.
@@ -7492,38 +7567,38 @@ class zt {
7492
7567
  right: h = 0,
7493
7568
  top: u = 0,
7494
7569
  bottom: f = 0,
7495
- centerY: g = 0
7496
- } = e, m = Math.max(a, u), p = Math.min(r, f), M = p >= m ? (m + p) / 2 : (c + g) / 2;
7570
+ centerY: p = 0
7571
+ } = e, m = Math.max(a, u), g = Math.min(r, f), M = g >= m ? (m + g) / 2 : (c + p) / 2;
7497
7572
  if (l >= i) {
7498
7573
  if (n) return s;
7499
- const T = l - i;
7500
- return T > 0 && s.push({
7574
+ const I = l - i;
7575
+ return I > 0 && s.push({
7501
7576
  type: "horizontal",
7502
7577
  axis: M,
7503
7578
  start: i,
7504
7579
  end: l,
7505
- distance: T
7580
+ distance: I
7506
7581
  }), s;
7507
7582
  }
7508
7583
  if (h <= o) {
7509
7584
  if (n) return s;
7510
- const T = o - h;
7511
- return T > 0 && s.push({
7585
+ const I = o - h;
7586
+ return I > 0 && s.push({
7512
7587
  type: "horizontal",
7513
7588
  axis: M,
7514
7589
  start: h,
7515
7590
  end: o,
7516
- distance: T
7591
+ distance: I
7517
7592
  }), s;
7518
7593
  }
7519
7594
  if (!n) return s;
7520
- const j = o < l, y = i > h, w = Math.min(o, l), I = Math.max(o, l), C = I - w;
7521
- C > 0 && !j && s.push({
7595
+ const C = o < l, y = i > h, w = Math.min(o, l), j = Math.max(o, l), T = j - w;
7596
+ T > 0 && !C && s.push({
7522
7597
  type: "horizontal",
7523
7598
  axis: M,
7524
7599
  start: w,
7525
- end: I,
7526
- distance: C
7600
+ end: j,
7601
+ distance: T
7527
7602
  });
7528
7603
  const b = Math.min(i, h), A = Math.max(i, h), S = A - b;
7529
7604
  return S > 0 && !y && s.push({
@@ -7553,38 +7628,38 @@ class zt {
7553
7628
  bottom: h = 0,
7554
7629
  left: u = 0,
7555
7630
  right: f = 0,
7556
- centerX: g = 0
7557
- } = e, m = Math.max(a, u), p = Math.min(r, f), M = p >= m ? (m + p) / 2 : (c + g) / 2;
7631
+ centerX: p = 0
7632
+ } = e, m = Math.max(a, u), g = Math.min(r, f), M = g >= m ? (m + g) / 2 : (c + p) / 2;
7558
7633
  if (l >= i) {
7559
7634
  if (n) return s;
7560
- const T = l - i;
7561
- return T > 0 && s.push({
7635
+ const I = l - i;
7636
+ return I > 0 && s.push({
7562
7637
  type: "vertical",
7563
7638
  axis: M,
7564
7639
  start: i,
7565
7640
  end: l,
7566
- distance: T
7641
+ distance: I
7567
7642
  }), s;
7568
7643
  }
7569
7644
  if (h <= o) {
7570
7645
  if (n) return s;
7571
- const T = o - h;
7572
- return T > 0 && s.push({
7646
+ const I = o - h;
7647
+ return I > 0 && s.push({
7573
7648
  type: "vertical",
7574
7649
  axis: M,
7575
7650
  start: h,
7576
7651
  end: o,
7577
- distance: T
7652
+ distance: I
7578
7653
  }), s;
7579
7654
  }
7580
7655
  if (!n) return s;
7581
- const j = o < l, y = i > h, w = Math.min(o, l), I = Math.max(o, l), C = I - w;
7582
- C > 0 && !j && s.push({
7656
+ const C = o < l, y = i > h, w = Math.min(o, l), j = Math.max(o, l), T = j - w;
7657
+ T > 0 && !C && s.push({
7583
7658
  type: "vertical",
7584
7659
  axis: M,
7585
7660
  start: w,
7586
- end: I,
7587
- distance: C
7661
+ end: j,
7662
+ distance: T
7588
7663
  });
7589
7664
  const b = Math.min(i, h), A = Math.max(i, h), S = A - b;
7590
7665
  return S > 0 && !y && s.push({
@@ -7620,19 +7695,19 @@ class zt {
7620
7695
  const { canvas: t } = this, e = t.getSelectionContext();
7621
7696
  if (!e) return;
7622
7697
  const { viewportTransform: n } = t, s = t.getZoom() || 1, o = this.activeGuides.some((c) => c.type === "vertical"), i = this.activeGuides.some((c) => c.type === "horizontal"), a = o && i && !this.isTargetMontageArea, r = a ? 12 / s : 0;
7623
- e.save(), Array.isArray(n) && e.transform(...n), e.lineWidth = fn / s, e.strokeStyle = un, e.setLineDash([]);
7698
+ e.save(), Array.isArray(n) && e.transform(...n), e.lineWidth = gn / s, e.strokeStyle = fn, e.setLineDash([]);
7624
7699
  for (const c of this.activeGuides) {
7625
- const { type: l, axis: h, start: u, end: f, distance: g } = c, m = Math.abs(f - u), p = u <= f ? -1 : 1, v = a ? p * (m / 2 + r) : 0, M = 0;
7626
- e.beginPath(), l === "vertical" ? (e.moveTo(h, u), e.lineTo(h, f)) : (e.moveTo(u, h), e.lineTo(f, h)), e.stroke(), Ee({
7700
+ const { type: l, axis: h, start: u, end: f, distance: p } = c, m = Math.abs(f - u), g = u <= f ? -1 : 1, v = a ? g * (m / 2 + r) : 0, M = 0;
7701
+ e.beginPath(), l === "vertical" ? (e.moveTo(h, u), e.lineTo(h, f)) : (e.moveTo(u, h), e.lineTo(f, h)), e.stroke(), _e({
7627
7702
  context: e,
7628
7703
  type: l,
7629
7704
  axis: h,
7630
7705
  start: u,
7631
7706
  end: f,
7632
- text: Math.round(g).toString(),
7707
+ text: Math.round(p).toString(),
7633
7708
  zoom: s,
7634
- color: un,
7635
- lineWidth: fn,
7709
+ color: fn,
7710
+ lineWidth: gn,
7636
7711
  offsetAlongAxis: v,
7637
7712
  offsetPerpendicular: M
7638
7713
  });
@@ -7658,14 +7733,14 @@ class zt {
7658
7733
  (e = t == null ? void 0 : t.showAfterTemporary) == null || e.call(t), this.isToolbarHidden = !1;
7659
7734
  }
7660
7735
  }
7661
- class Ne {
7736
+ class Pe {
7662
7737
  /**
7663
7738
  * Конструктор класса ImageEditor.
7664
7739
  * @param canvasId - идентификатор канваса, в котором будет создан редактор
7665
7740
  * @param options - опции и настройки редактора
7666
7741
  */
7667
7742
  constructor(t, e) {
7668
- this.options = e, this.containerId = t, this.editorId = `${t}-${$()}`, this.clipboard = null, this.init();
7743
+ this.options = e, this.containerId = t, this.editorId = `${t}-${tt()}`, this.clipboard = null, this.init();
7669
7744
  }
7670
7745
  /**
7671
7746
  * Инициализация редактора.
@@ -7688,17 +7763,17 @@ class Ne {
7688
7763
  showRotationAngle: l,
7689
7764
  _onReadyCallback: h
7690
7765
  } = this.options;
7691
- if (lt.apply(), this.canvas = new On(this.containerId, this.options), this.moduleLoader = new xn(), this.workerManager = new kn(), this.errorManager = new Jt({ editor: this }), this.historyManager = new K({ editor: this }), this.toolbar = new Jn({ editor: this }), this.transformManager = new rs({ editor: this }), this.zoomManager = new cs({ editor: this }), this.canvasManager = new as({ editor: this }), this.imageManager = new mt({ editor: this }), this.layerManager = new ue({ editor: this }), this.shapeManager = new ds({ editor: this }), this.interactionBlocker = new ls({ editor: this }), this.backgroundManager = new Bt({ editor: this }), this.clipboardManager = new hs({ editor: this }), this.objectLockManager = new fe({ editor: this }), this.groupingManager = new us({ editor: this }), this.selectionManager = new fs({ editor: this }), this.deletionManager = new ke({ editor: this }), this.panConstraintManager = new gs({ editor: this }), this.snappingManager = new Hs({ editor: this }), this.measurementManager = new zt({ editor: this }), this.fontManager = new Ce((u = this.options.fonts) != null ? u : []), this.textManager = new st({ editor: this }), this.templateManager = new Y({ editor: this }), l && (this.angleIndicator = new Re({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Le({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(n), this.canvasManager.setCanvasWrapperHeight(s), this.canvasManager.setCanvasCSSWidth(o), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
7766
+ if (lt.apply(), this.canvas = new En(this.containerId, this.options), this.moduleLoader = new Rn(), this.workerManager = new Nn(), this.errorManager = new Jt({ editor: this }), this.historyManager = new K({ editor: this }), this.toolbar = new Qn({ editor: this }), this.transformManager = new cs({ editor: this }), this.zoomManager = new ls({ editor: this }), this.canvasManager = new rs({ editor: this }), this.imageManager = new mt({ editor: this }), this.layerManager = new ue({ editor: this }), this.shapeManager = new hs({ editor: this }), this.interactionBlocker = new ds({ editor: this }), this.backgroundManager = new Bt({ editor: this }), this.clipboardManager = new us({ editor: this }), this.objectLockManager = new fe({ editor: this }), this.groupingManager = new fs({ editor: this }), this.selectionManager = new gs({ editor: this }), this.deletionManager = new ze({ editor: this }), this.panConstraintManager = new ps({ editor: this }), this.snappingManager = new pe({ editor: this }), this.measurementManager = new zt({ editor: this }), this.fontManager = new Te((u = this.options.fonts) != null ? u : []), this.textManager = new st({ editor: this }), this.templateManager = new H({ editor: this }), l && (this.angleIndicator = new Be({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new xe({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(n), this.canvasManager.setCanvasWrapperHeight(s), this.canvasManager.setCanvasCSSWidth(o), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
7692
7767
  const f = a, {
7693
- source: g,
7768
+ source: p,
7694
7769
  scale: m = `image-${c}`,
7695
- withoutSave: p = !0
7770
+ withoutSave: g = !0
7696
7771
  } = f, v = Mt(f, [
7697
7772
  "source",
7698
7773
  "scale",
7699
7774
  "withoutSave"
7700
7775
  ]);
7701
- yield this.imageManager.importImage(L({ source: g, scale: m, withoutSave: p }, v));
7776
+ yield this.imageManager.importImage(x({ source: p, scale: m, withoutSave: g }, v));
7702
7777
  }
7703
7778
  r && this.historyManager.loadStateFromFullState(r), this.historyManager.saveState(), console.log("editor:ready"), this.canvas.fire("editor:ready", this), typeof h == "function" && h(this);
7704
7779
  });
@@ -7714,7 +7789,7 @@ class Ne {
7714
7789
  this.montageArea = this.shapeManager.addRectangle({
7715
7790
  width: t,
7716
7791
  height: e,
7717
- fill: Ne._createMosaicPattern(),
7792
+ fill: Pe._createMosaicPattern(),
7718
7793
  stroke: null,
7719
7794
  strokeWidth: 0,
7720
7795
  selectable: !1,
@@ -7765,13 +7840,13 @@ class Ne {
7765
7840
  const t = document.createElement("canvas");
7766
7841
  t.width = 20, t.height = 20;
7767
7842
  const e = t.getContext("2d");
7768
- return e.fillStyle = "#ddd", e.fillRect(0, 0, 40, 40), e.fillStyle = "#ccc", e.fillRect(0, 0, 10, 10), e.fillRect(10, 10, 10, 10), new En({
7843
+ return e.fillStyle = "#ddd", e.fillRect(0, 0, 40, 40), e.fillStyle = "#ccc", e.fillRect(0, 0, 10, 10), e.fillRect(10, 10, 10, 10), new Ln({
7769
7844
  source: t,
7770
7845
  repeat: "repeat"
7771
7846
  });
7772
7847
  }
7773
7848
  }
7774
- const k = [
7849
+ const P = [
7775
7850
  "U+0000-00FF",
7776
7851
  "U+0100-02BA",
7777
7852
  "U+02BB-02BC",
@@ -7801,7 +7876,7 @@ const k = [
7801
7876
  "U+A720-A7FF",
7802
7877
  "U+FEFF",
7803
7878
  "U+FFFD"
7804
- ].join(", "), N = [
7879
+ ].join(", "), F = [
7805
7880
  "U+0301",
7806
7881
  "U+0400-052F",
7807
7882
  "U+1C80-1C8A",
@@ -7827,7 +7902,7 @@ const k = [
7827
7902
  style: "normal",
7828
7903
  weight: "400",
7829
7904
  display: "swap",
7830
- unicodeRange: N
7905
+ unicodeRange: F
7831
7906
  }
7832
7907
  },
7833
7908
  {
@@ -7837,7 +7912,7 @@ const k = [
7837
7912
  style: "normal",
7838
7913
  weight: "400",
7839
7914
  display: "swap",
7840
- unicodeRange: k
7915
+ unicodeRange: P
7841
7916
  }
7842
7917
  },
7843
7918
  {
@@ -7847,7 +7922,7 @@ const k = [
7847
7922
  style: "normal",
7848
7923
  weight: "700",
7849
7924
  display: "swap",
7850
- unicodeRange: N
7925
+ unicodeRange: F
7851
7926
  }
7852
7927
  },
7853
7928
  {
@@ -7857,7 +7932,7 @@ const k = [
7857
7932
  style: "normal",
7858
7933
  weight: "700",
7859
7934
  display: "swap",
7860
- unicodeRange: k
7935
+ unicodeRange: P
7861
7936
  }
7862
7937
  },
7863
7938
  {
@@ -7867,7 +7942,7 @@ const k = [
7867
7942
  style: "normal",
7868
7943
  weight: "200 700",
7869
7944
  display: "swap",
7870
- unicodeRange: N
7945
+ unicodeRange: F
7871
7946
  }
7872
7947
  },
7873
7948
  {
@@ -7877,7 +7952,7 @@ const k = [
7877
7952
  style: "normal",
7878
7953
  weight: "200 700",
7879
7954
  display: "swap",
7880
- unicodeRange: k
7955
+ unicodeRange: P
7881
7956
  }
7882
7957
  },
7883
7958
  {
@@ -7887,7 +7962,7 @@ const k = [
7887
7962
  style: "normal",
7888
7963
  weight: "300 900",
7889
7964
  display: "swap",
7890
- unicodeRange: N
7965
+ unicodeRange: F
7891
7966
  }
7892
7967
  },
7893
7968
  {
@@ -7897,7 +7972,7 @@ const k = [
7897
7972
  style: "normal",
7898
7973
  weight: "300 900",
7899
7974
  display: "swap",
7900
- unicodeRange: k
7975
+ unicodeRange: P
7901
7976
  }
7902
7977
  },
7903
7978
  {
@@ -7907,7 +7982,7 @@ const k = [
7907
7982
  style: "normal",
7908
7983
  weight: "400 700",
7909
7984
  display: "swap",
7910
- unicodeRange: N
7985
+ unicodeRange: F
7911
7986
  }
7912
7987
  },
7913
7988
  {
@@ -7917,7 +7992,7 @@ const k = [
7917
7992
  style: "normal",
7918
7993
  weight: "400 700",
7919
7994
  display: "swap",
7920
- unicodeRange: k
7995
+ unicodeRange: P
7921
7996
  }
7922
7997
  },
7923
7998
  {
@@ -7927,7 +8002,7 @@ const k = [
7927
8002
  style: "normal",
7928
8003
  weight: "300 700",
7929
8004
  display: "swap",
7930
- unicodeRange: N
8005
+ unicodeRange: F
7931
8006
  }
7932
8007
  },
7933
8008
  {
@@ -7937,7 +8012,7 @@ const k = [
7937
8012
  style: "normal",
7938
8013
  weight: "300 700",
7939
8014
  display: "swap",
7940
- unicodeRange: k
8015
+ unicodeRange: P
7941
8016
  }
7942
8017
  },
7943
8018
  {
@@ -7947,7 +8022,7 @@ const k = [
7947
8022
  style: "normal",
7948
8023
  weight: "300 700",
7949
8024
  display: "swap",
7950
- unicodeRange: N
8025
+ unicodeRange: F
7951
8026
  }
7952
8027
  },
7953
8028
  {
@@ -7957,7 +8032,7 @@ const k = [
7957
8032
  style: "normal",
7958
8033
  weight: "300 700",
7959
8034
  display: "swap",
7960
- unicodeRange: k
8035
+ unicodeRange: P
7961
8036
  }
7962
8037
  },
7963
8038
  {
@@ -7967,7 +8042,7 @@ const k = [
7967
8042
  style: "normal",
7968
8043
  weight: "400",
7969
8044
  display: "swap",
7970
- unicodeRange: N
8045
+ unicodeRange: F
7971
8046
  }
7972
8047
  },
7973
8048
  {
@@ -7977,7 +8052,7 @@ const k = [
7977
8052
  style: "normal",
7978
8053
  weight: "400",
7979
8054
  display: "swap",
7980
- unicodeRange: k
8055
+ unicodeRange: P
7981
8056
  }
7982
8057
  },
7983
8058
  {
@@ -7987,7 +8062,7 @@ const k = [
7987
8062
  style: "normal",
7988
8063
  weight: "400 700",
7989
8064
  display: "swap",
7990
- unicodeRange: N
8065
+ unicodeRange: F
7991
8066
  }
7992
8067
  },
7993
8068
  {
@@ -7997,7 +8072,7 @@ const k = [
7997
8072
  style: "normal",
7998
8073
  weight: "400 700",
7999
8074
  display: "swap",
8000
- unicodeRange: k
8075
+ unicodeRange: P
8001
8076
  }
8002
8077
  },
8003
8078
  {
@@ -8007,7 +8082,7 @@ const k = [
8007
8082
  style: "normal",
8008
8083
  weight: "100 900",
8009
8084
  display: "swap",
8010
- unicodeRange: N
8085
+ unicodeRange: F
8011
8086
  }
8012
8087
  },
8013
8088
  {
@@ -8017,7 +8092,7 @@ const k = [
8017
8092
  style: "normal",
8018
8093
  weight: "100 900",
8019
8094
  display: "swap",
8020
- unicodeRange: k
8095
+ unicodeRange: P
8021
8096
  }
8022
8097
  },
8023
8098
  {
@@ -8027,7 +8102,7 @@ const k = [
8027
8102
  style: "normal",
8028
8103
  weight: "400",
8029
8104
  display: "swap",
8030
- unicodeRange: N
8105
+ unicodeRange: F
8031
8106
  }
8032
8107
  },
8033
8108
  {
@@ -8037,7 +8112,7 @@ const k = [
8037
8112
  style: "normal",
8038
8113
  weight: "400",
8039
8114
  display: "swap",
8040
- unicodeRange: k
8115
+ unicodeRange: P
8041
8116
  }
8042
8117
  },
8043
8118
  {
@@ -8047,7 +8122,7 @@ const k = [
8047
8122
  style: "normal",
8048
8123
  weight: "700",
8049
8124
  display: "swap",
8050
- unicodeRange: N
8125
+ unicodeRange: F
8051
8126
  }
8052
8127
  },
8053
8128
  {
@@ -8057,7 +8132,7 @@ const k = [
8057
8132
  style: "normal",
8058
8133
  weight: "700",
8059
8134
  display: "swap",
8060
- unicodeRange: k
8135
+ unicodeRange: P
8061
8136
  }
8062
8137
  },
8063
8138
  {
@@ -8067,7 +8142,7 @@ const k = [
8067
8142
  style: "normal",
8068
8143
  weight: "400 700",
8069
8144
  display: "swap",
8070
- unicodeRange: N
8145
+ unicodeRange: F
8071
8146
  }
8072
8147
  },
8073
8148
  {
@@ -8077,7 +8152,7 @@ const k = [
8077
8152
  style: "normal",
8078
8153
  weight: "400 700",
8079
8154
  display: "swap",
8080
- unicodeRange: k
8155
+ unicodeRange: P
8081
8156
  }
8082
8157
  },
8083
8158
  {
@@ -8087,7 +8162,7 @@ const k = [
8087
8162
  style: "normal",
8088
8163
  weight: "100 900",
8089
8164
  display: "swap",
8090
- unicodeRange: N
8165
+ unicodeRange: F
8091
8166
  }
8092
8167
  },
8093
8168
  {
@@ -8097,7 +8172,7 @@ const k = [
8097
8172
  style: "normal",
8098
8173
  weight: "100 900",
8099
8174
  display: "swap",
8100
- unicodeRange: k
8175
+ unicodeRange: P
8101
8176
  }
8102
8177
  },
8103
8178
  {
@@ -8107,7 +8182,7 @@ const k = [
8107
8182
  style: "normal",
8108
8183
  weight: "100",
8109
8184
  display: "swap",
8110
- unicodeRange: N
8185
+ unicodeRange: F
8111
8186
  }
8112
8187
  },
8113
8188
  {
@@ -8117,7 +8192,7 @@ const k = [
8117
8192
  style: "normal",
8118
8193
  weight: "100",
8119
8194
  display: "swap",
8120
- unicodeRange: k
8195
+ unicodeRange: P
8121
8196
  }
8122
8197
  },
8123
8198
  {
@@ -8127,7 +8202,7 @@ const k = [
8127
8202
  style: "normal",
8128
8203
  weight: "200",
8129
8204
  display: "swap",
8130
- unicodeRange: N
8205
+ unicodeRange: F
8131
8206
  }
8132
8207
  },
8133
8208
  {
@@ -8137,7 +8212,7 @@ const k = [
8137
8212
  style: "normal",
8138
8213
  weight: "200",
8139
8214
  display: "swap",
8140
- unicodeRange: k
8215
+ unicodeRange: P
8141
8216
  }
8142
8217
  },
8143
8218
  {
@@ -8147,7 +8222,7 @@ const k = [
8147
8222
  style: "normal",
8148
8223
  weight: "300",
8149
8224
  display: "swap",
8150
- unicodeRange: N
8225
+ unicodeRange: F
8151
8226
  }
8152
8227
  },
8153
8228
  {
@@ -8157,7 +8232,7 @@ const k = [
8157
8232
  style: "normal",
8158
8233
  weight: "300",
8159
8234
  display: "swap",
8160
- unicodeRange: k
8235
+ unicodeRange: P
8161
8236
  }
8162
8237
  },
8163
8238
  {
@@ -8167,7 +8242,7 @@ const k = [
8167
8242
  style: "normal",
8168
8243
  weight: "400",
8169
8244
  display: "swap",
8170
- unicodeRange: N
8245
+ unicodeRange: F
8171
8246
  }
8172
8247
  },
8173
8248
  {
@@ -8177,7 +8252,7 @@ const k = [
8177
8252
  style: "normal",
8178
8253
  weight: "400",
8179
8254
  display: "swap",
8180
- unicodeRange: k
8255
+ unicodeRange: P
8181
8256
  }
8182
8257
  },
8183
8258
  {
@@ -8187,7 +8262,7 @@ const k = [
8187
8262
  style: "normal",
8188
8263
  weight: "500",
8189
8264
  display: "swap",
8190
- unicodeRange: N
8265
+ unicodeRange: F
8191
8266
  }
8192
8267
  },
8193
8268
  {
@@ -8197,7 +8272,7 @@ const k = [
8197
8272
  style: "normal",
8198
8273
  weight: "500",
8199
8274
  display: "swap",
8200
- unicodeRange: k
8275
+ unicodeRange: P
8201
8276
  }
8202
8277
  },
8203
8278
  {
@@ -8207,7 +8282,7 @@ const k = [
8207
8282
  style: "normal",
8208
8283
  weight: "600",
8209
8284
  display: "swap",
8210
- unicodeRange: N
8285
+ unicodeRange: F
8211
8286
  }
8212
8287
  },
8213
8288
  {
@@ -8217,7 +8292,7 @@ const k = [
8217
8292
  style: "normal",
8218
8293
  weight: "600",
8219
8294
  display: "swap",
8220
- unicodeRange: k
8295
+ unicodeRange: P
8221
8296
  }
8222
8297
  },
8223
8298
  {
@@ -8227,7 +8302,7 @@ const k = [
8227
8302
  style: "normal",
8228
8303
  weight: "700",
8229
8304
  display: "swap",
8230
- unicodeRange: N
8305
+ unicodeRange: F
8231
8306
  }
8232
8307
  },
8233
8308
  {
@@ -8237,7 +8312,7 @@ const k = [
8237
8312
  style: "normal",
8238
8313
  weight: "700",
8239
8314
  display: "swap",
8240
- unicodeRange: k
8315
+ unicodeRange: P
8241
8316
  }
8242
8317
  },
8243
8318
  {
@@ -8247,7 +8322,7 @@ const k = [
8247
8322
  style: "normal",
8248
8323
  weight: "800",
8249
8324
  display: "swap",
8250
- unicodeRange: N
8325
+ unicodeRange: F
8251
8326
  }
8252
8327
  },
8253
8328
  {
@@ -8257,7 +8332,7 @@ const k = [
8257
8332
  style: "normal",
8258
8333
  weight: "800",
8259
8334
  display: "swap",
8260
- unicodeRange: k
8335
+ unicodeRange: P
8261
8336
  }
8262
8337
  },
8263
8338
  {
@@ -8267,7 +8342,7 @@ const k = [
8267
8342
  style: "normal",
8268
8343
  weight: "900",
8269
8344
  display: "swap",
8270
- unicodeRange: N
8345
+ unicodeRange: F
8271
8346
  }
8272
8347
  },
8273
8348
  {
@@ -8277,7 +8352,7 @@ const k = [
8277
8352
  style: "normal",
8278
8353
  weight: "900",
8279
8354
  display: "swap",
8280
- unicodeRange: k
8355
+ unicodeRange: P
8281
8356
  }
8282
8357
  },
8283
8358
  {
@@ -8287,7 +8362,7 @@ const k = [
8287
8362
  style: "normal",
8288
8363
  weight: "400",
8289
8364
  display: "swap",
8290
- unicodeRange: N
8365
+ unicodeRange: F
8291
8366
  }
8292
8367
  },
8293
8368
  {
@@ -8297,7 +8372,7 @@ const k = [
8297
8372
  style: "normal",
8298
8373
  weight: "400",
8299
8374
  display: "swap",
8300
- unicodeRange: k
8375
+ unicodeRange: P
8301
8376
  }
8302
8377
  },
8303
8378
  {
@@ -8307,7 +8382,7 @@ const k = [
8307
8382
  style: "normal",
8308
8383
  weight: "700",
8309
8384
  display: "swap",
8310
- unicodeRange: N
8385
+ unicodeRange: F
8311
8386
  }
8312
8387
  },
8313
8388
  {
@@ -8317,7 +8392,7 @@ const k = [
8317
8392
  style: "normal",
8318
8393
  weight: "700",
8319
8394
  display: "swap",
8320
- unicodeRange: k
8395
+ unicodeRange: P
8321
8396
  }
8322
8397
  },
8323
8398
  {
@@ -8327,7 +8402,7 @@ const k = [
8327
8402
  style: "normal",
8328
8403
  weight: "100 900",
8329
8404
  display: "swap",
8330
- unicodeRange: N
8405
+ unicodeRange: F
8331
8406
  }
8332
8407
  },
8333
8408
  {
@@ -8337,7 +8412,7 @@ const k = [
8337
8412
  style: "normal",
8338
8413
  weight: "100 900",
8339
8414
  display: "swap",
8340
- unicodeRange: k
8415
+ unicodeRange: P
8341
8416
  }
8342
8417
  },
8343
8418
  {
@@ -8347,7 +8422,7 @@ const k = [
8347
8422
  style: "normal",
8348
8423
  weight: "300 700",
8349
8424
  display: "swap",
8350
- unicodeRange: N
8425
+ unicodeRange: F
8351
8426
  }
8352
8427
  },
8353
8428
  {
@@ -8357,7 +8432,7 @@ const k = [
8357
8432
  style: "normal",
8358
8433
  weight: "300 700",
8359
8434
  display: "swap",
8360
- unicodeRange: k
8435
+ unicodeRange: P
8361
8436
  }
8362
8437
  },
8363
8438
  {
@@ -8367,7 +8442,7 @@ const k = [
8367
8442
  style: "normal",
8368
8443
  weight: "400",
8369
8444
  display: "swap",
8370
- unicodeRange: N
8445
+ unicodeRange: F
8371
8446
  }
8372
8447
  },
8373
8448
  {
@@ -8377,7 +8452,7 @@ const k = [
8377
8452
  style: "normal",
8378
8453
  weight: "400",
8379
8454
  display: "swap",
8380
- unicodeRange: k
8455
+ unicodeRange: P
8381
8456
  }
8382
8457
  },
8383
8458
  {
@@ -8387,7 +8462,7 @@ const k = [
8387
8462
  style: "normal",
8388
8463
  weight: "200 800",
8389
8464
  display: "swap",
8390
- unicodeRange: N
8465
+ unicodeRange: F
8391
8466
  }
8392
8467
  },
8393
8468
  {
@@ -8397,7 +8472,7 @@ const k = [
8397
8472
  style: "normal",
8398
8473
  weight: "200 800",
8399
8474
  display: "swap",
8400
- unicodeRange: k
8475
+ unicodeRange: P
8401
8476
  }
8402
8477
  },
8403
8478
  {
@@ -8407,7 +8482,7 @@ const k = [
8407
8482
  style: "normal",
8408
8483
  weight: "100 900",
8409
8484
  display: "swap",
8410
- unicodeRange: N
8485
+ unicodeRange: F
8411
8486
  }
8412
8487
  },
8413
8488
  {
@@ -8417,7 +8492,7 @@ const k = [
8417
8492
  style: "normal",
8418
8493
  weight: "100 900",
8419
8494
  display: "swap",
8420
- unicodeRange: k
8495
+ unicodeRange: P
8421
8496
  }
8422
8497
  },
8423
8498
  {
@@ -8427,7 +8502,7 @@ const k = [
8427
8502
  style: "normal",
8428
8503
  weight: "400",
8429
8504
  display: "swap",
8430
- unicodeRange: N
8505
+ unicodeRange: F
8431
8506
  }
8432
8507
  },
8433
8508
  {
@@ -8437,7 +8512,7 @@ const k = [
8437
8512
  style: "normal",
8438
8513
  weight: "400",
8439
8514
  display: "swap",
8440
- unicodeRange: k
8515
+ unicodeRange: P
8441
8516
  }
8442
8517
  },
8443
8518
  {
@@ -8447,7 +8522,7 @@ const k = [
8447
8522
  style: "normal",
8448
8523
  weight: "100 900",
8449
8524
  display: "swap",
8450
- unicodeRange: N
8525
+ unicodeRange: F
8451
8526
  }
8452
8527
  },
8453
8528
  {
@@ -8457,7 +8532,7 @@ const k = [
8457
8532
  style: "normal",
8458
8533
  weight: "100 900",
8459
8534
  display: "swap",
8460
- unicodeRange: k
8535
+ unicodeRange: P
8461
8536
  }
8462
8537
  },
8463
8538
  {
@@ -8467,7 +8542,7 @@ const k = [
8467
8542
  style: "normal",
8468
8543
  weight: "300 800",
8469
8544
  display: "swap",
8470
- unicodeRange: N
8545
+ unicodeRange: F
8471
8546
  }
8472
8547
  },
8473
8548
  {
@@ -8477,7 +8552,7 @@ const k = [
8477
8552
  style: "normal",
8478
8553
  weight: "300 800",
8479
8554
  display: "swap",
8480
- unicodeRange: k
8555
+ unicodeRange: P
8481
8556
  }
8482
8557
  },
8483
8558
  {
@@ -8487,7 +8562,7 @@ const k = [
8487
8562
  style: "normal",
8488
8563
  weight: "400",
8489
8564
  display: "swap",
8490
- unicodeRange: N
8565
+ unicodeRange: F
8491
8566
  }
8492
8567
  },
8493
8568
  {
@@ -8497,7 +8572,7 @@ const k = [
8497
8572
  style: "normal",
8498
8573
  weight: "400",
8499
8574
  display: "swap",
8500
- unicodeRange: k
8575
+ unicodeRange: P
8501
8576
  }
8502
8577
  },
8503
8578
  {
@@ -8507,7 +8582,7 @@ const k = [
8507
8582
  style: "normal",
8508
8583
  weight: "700",
8509
8584
  display: "swap",
8510
- unicodeRange: N
8585
+ unicodeRange: F
8511
8586
  }
8512
8587
  },
8513
8588
  {
@@ -8517,7 +8592,7 @@ const k = [
8517
8592
  style: "normal",
8518
8593
  weight: "700",
8519
8594
  display: "swap",
8520
- unicodeRange: k
8595
+ unicodeRange: P
8521
8596
  }
8522
8597
  },
8523
8598
  {
@@ -8527,7 +8602,7 @@ const k = [
8527
8602
  style: "normal",
8528
8603
  weight: "300 900",
8529
8604
  display: "swap",
8530
- unicodeRange: N
8605
+ unicodeRange: F
8531
8606
  }
8532
8607
  },
8533
8608
  {
@@ -8537,7 +8612,7 @@ const k = [
8537
8612
  style: "normal",
8538
8613
  weight: "300 900",
8539
8614
  display: "swap",
8540
- unicodeRange: k
8615
+ unicodeRange: P
8541
8616
  }
8542
8617
  },
8543
8618
  {
@@ -8547,7 +8622,7 @@ const k = [
8547
8622
  style: "normal",
8548
8623
  weight: "400",
8549
8624
  display: "swap",
8550
- unicodeRange: N
8625
+ unicodeRange: F
8551
8626
  }
8552
8627
  },
8553
8628
  {
@@ -8557,7 +8632,7 @@ const k = [
8557
8632
  style: "normal",
8558
8633
  weight: "400",
8559
8634
  display: "swap",
8560
- unicodeRange: k
8635
+ unicodeRange: P
8561
8636
  }
8562
8637
  },
8563
8638
  {
@@ -8567,7 +8642,7 @@ const k = [
8567
8642
  style: "normal",
8568
8643
  weight: "100 900",
8569
8644
  display: "swap",
8570
- unicodeRange: N
8645
+ unicodeRange: F
8571
8646
  }
8572
8647
  },
8573
8648
  {
@@ -8577,7 +8652,7 @@ const k = [
8577
8652
  style: "normal",
8578
8653
  weight: "100 900",
8579
8654
  display: "swap",
8580
- unicodeRange: k
8655
+ unicodeRange: P
8581
8656
  }
8582
8657
  },
8583
8658
  {
@@ -8587,7 +8662,7 @@ const k = [
8587
8662
  style: "normal",
8588
8663
  weight: "100 900",
8589
8664
  display: "swap",
8590
- unicodeRange: N
8665
+ unicodeRange: F
8591
8666
  }
8592
8667
  },
8593
8668
  {
@@ -8597,7 +8672,7 @@ const k = [
8597
8672
  style: "normal",
8598
8673
  weight: "100 900",
8599
8674
  display: "swap",
8600
- unicodeRange: k
8675
+ unicodeRange: P
8601
8676
  }
8602
8677
  }
8603
8678
  ], Gs = {
@@ -8695,13 +8770,13 @@ const k = [
8695
8770
  fonts: Zs
8696
8771
  };
8697
8772
  function Js(d, t = {}) {
8698
- const e = L(L({}, Gs), t), n = document.getElementById(d);
8773
+ const e = x(x({}, Gs), t), n = document.getElementById(d);
8699
8774
  if (!n)
8700
8775
  return Promise.reject(new Error(`Контейнер с ID "${d}" не найден.`));
8701
8776
  const s = document.createElement("canvas");
8702
8777
  return s.id = `${d}-canvas`, n.appendChild(s), e.editorContainer = n, new Promise((o) => {
8703
8778
  e._onReadyCallback = o;
8704
- const i = new Ne(s.id, e);
8779
+ const i = new Pe(s.id, e);
8705
8780
  window[d] = i;
8706
8781
  });
8707
8782
  }