@anu3ev/fabric-image-editor 0.5.3 → 0.5.5

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 +576 -577
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,22 +1,22 @@
1
- var rs = Object.defineProperty, cs = Object.defineProperties;
2
- var ds = Object.getOwnPropertyDescriptors;
3
- var Wt = Object.getOwnPropertySymbols;
4
- var De = Object.prototype.hasOwnProperty, Re = Object.prototype.propertyIsEnumerable;
5
- var Le = (h, t, e) => t in h ? rs(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, B = (h, t) => {
1
+ var hs = Object.defineProperty, us = Object.defineProperties;
2
+ var gs = Object.getOwnPropertyDescriptors;
3
+ var Vt = Object.getOwnPropertySymbols;
4
+ var Be = Object.prototype.hasOwnProperty, ze = Object.prototype.propertyIsEnumerable;
5
+ var ke = (h, t, e) => t in h ? hs(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, k = (h, t) => {
6
6
  for (var e in t || (t = {}))
7
- De.call(t, e) && Le(h, e, t[e]);
8
- if (Wt)
9
- for (var e of Wt(t))
10
- Re.call(t, e) && Le(h, e, t[e]);
7
+ Be.call(t, e) && ke(h, e, t[e]);
8
+ if (Vt)
9
+ for (var e of Vt(t))
10
+ ze.call(t, e) && ke(h, e, t[e]);
11
11
  return h;
12
- }, bt = (h, t) => cs(h, ds(t));
13
- var ut = (h, t) => {
12
+ }, jt = (h, t) => us(h, gs(t));
13
+ var gt = (h, t) => {
14
14
  var e = {};
15
15
  for (var s in h)
16
- De.call(h, s) && t.indexOf(s) < 0 && (e[s] = h[s]);
17
- if (h != null && Wt)
18
- for (var s of Wt(h))
19
- t.indexOf(s) < 0 && Re.call(h, s) && (e[s] = h[s]);
16
+ Be.call(h, s) && t.indexOf(s) < 0 && (e[s] = h[s]);
17
+ if (h != null && Vt)
18
+ for (var s of Vt(h))
19
+ t.indexOf(s) < 0 && ze.call(h, s) && (e[s] = h[s]);
20
20
  return e;
21
21
  };
22
22
  var _ = (h, t, e) => new Promise((s, o) => {
@@ -35,15 +35,15 @@ var _ = (h, t, e) => new Promise((s, o) => {
35
35
  }, a = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(n, i);
36
36
  a((e = e.apply(h, t)).next());
37
37
  });
38
- import { ActiveSelection as k, Textbox as st, util as rt, controlsUtils as _e, InteractiveFabricObject as Ne, Point as $, FitContentLayout as Be, loadSVGFromURL as ls, FabricImage as Bt, Gradient as ke, Rect as hs, Circle as us, Triangle as gs, Group as wt, Color as fs, classRegistry as xe, loadSVGFromString as ps, Canvas as ms, Pattern as ys } from "fabric";
39
- import { create as vs } from "jsondiffpatch";
40
- import bs from "diff-match-patch";
41
- var Ms = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", Y = function() {
38
+ import { ActiveSelection as x, Textbox as st, util as ct, controlsUtils as Pe, InteractiveFabricObject as Ue, Point as J, FitContentLayout as Ye, loadSVGFromURL as fs, FabricImage as Bt, Gradient as Fe, Rect as ps, Circle as ms, Triangle as ys, Group as Ct, Color as vs, classRegistry as He, loadSVGFromString as bs, Canvas as Ms, Pattern as ws } from "fabric";
39
+ import { create as Ss } from "jsondiffpatch";
40
+ import As from "diff-match-patch";
41
+ var js = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", Y = function() {
42
42
  for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21, e = "", s = crypto.getRandomValues(new Uint8Array(t |= 0)); t--; )
43
- e += Ms[s[t] & 63];
43
+ e += js[s[t] & 63];
44
44
  return e;
45
45
  };
46
- class xt {
46
+ class Pt {
47
47
  /**
48
48
  * Конструктор принимает редактор и опции.
49
49
  * @param params
@@ -61,7 +61,7 @@ class xt {
61
61
  * @param params.options.adaptCanvasToContainerOnResize — адаптировать канвас к размерам контейнера при изменении размеров окна
62
62
  */
63
63
  constructor({ editor: t, options: e = {} }) {
64
- 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 = xt.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 = xt.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = xt.debounce(this.handleObjectRotatingHistory.bind(this), 300), 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();
64
+ 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 = Pt.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 = Pt.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = Pt.debounce(this.handleObjectRotatingHistory.bind(this), 300), 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
65
  }
66
66
  /**
67
67
  * Инициализация всех обработчиков согласно опциям.
@@ -98,7 +98,7 @@ class xt {
98
98
  if (o.length === 1)
99
99
  this.canvas.setActiveObject(o[0]);
100
100
  else {
101
- const i = new k(o, {
101
+ const i = new x(o, {
102
102
  canvas: this.canvas
103
103
  });
104
104
  this.canvas.setActiveObject(i);
@@ -106,7 +106,7 @@ class xt {
106
106
  this.canvas.requestRenderAll();
107
107
  return;
108
108
  }
109
- const n = new k(t, {
109
+ const n = new x(t, {
110
110
  canvas: this.canvas
111
111
  });
112
112
  this.editor.objectLockManager.lockObject({
@@ -220,7 +220,7 @@ class xt {
220
220
  if (o || n) return;
221
221
  this.isSpacePressed = !0, t.preventDefault();
222
222
  const i = e.getActiveObject() || null;
223
- i instanceof k ? this.savedSelection = i.getObjects().slice() : i && (this.savedSelection = [i]), e.discardActiveObject(), e.set({
223
+ i instanceof x ? this.savedSelection = i.getObjects().slice() : i && (this.savedSelection = [i]), e.discardActiveObject(), e.set({
224
224
  selection: !1,
225
225
  defaultCursor: "grab"
226
226
  }), e.setCursor("grab"), s.canvasManager.getObjects().forEach((a) => {
@@ -259,7 +259,7 @@ class xt {
259
259
  e.setActiveObject(t[0]);
260
260
  return;
261
261
  }
262
- const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new k(o, { canvas: e });
262
+ const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new x(o, { canvas: e });
263
263
  e.setActiveObject(n);
264
264
  }
265
265
  // --- Обработчики для событий canvas (Fabric) ---
@@ -391,7 +391,7 @@ class xt {
391
391
  };
392
392
  }
393
393
  }
394
- class ws {
394
+ class Is {
395
395
  /**
396
396
  * Класс для динамической загрузки внешних модулей.
397
397
  */
@@ -409,7 +409,7 @@ class ws {
409
409
  return this.loaders[t] ? (this.cache.has(t) || this.cache.set(t, this.loaders[t]()), this.cache.get(t)) : Promise.reject(new Error(`Unknown module "${t}"`));
410
410
  }
411
411
  }
412
- function Ss(h) {
412
+ function Cs(h) {
413
413
  return new Worker(
414
414
  "" + new URL("assets/worker-CN39s7P7.js", import.meta.url).href,
415
415
  {
@@ -417,13 +417,13 @@ function Ss(h) {
417
417
  }
418
418
  );
419
419
  }
420
- class As {
420
+ class Ts {
421
421
  /**
422
422
  * @param scriptUrl — URL скрипта воркера.
423
423
  * По-умолчанию использует DefaultWorker из соседнего файла
424
424
  */
425
425
  constructor(t) {
426
- t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new Ss(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
426
+ t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new Cs(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
427
427
  }
428
428
  /**
429
429
  * Обработчик сообщений от воркера
@@ -463,65 +463,65 @@ class As {
463
463
  this.worker.terminate();
464
464
  }
465
465
  }
466
- const it = 12, js = 2, de = 8, le = 20, Is = 100, he = 20, ue = 8, Cs = 100, Kt = 32, me = 1, Ts = "#2B2D33", ye = "#3D8BF4", ve = "#FFFFFF";
467
- function Zt(h, t, e, s, o) {
468
- const n = it, i = js;
469
- h.save(), h.translate(t, e), h.rotate(rt.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -n / 2, n, n, i), h.fill(), h.stroke(), h.restore();
466
+ const at = 12, Es = 2, de = 8, le = 20, Os = 100, he = 20, ue = 8, Ds = 100, $t = 32, me = 1, Ls = "#2B2D33", ye = "#3D8BF4", ve = "#FFFFFF";
467
+ function Xt(h, t, e, s, o) {
468
+ const n = at, i = Es;
469
+ h.save(), h.translate(t, e), h.rotate(ct.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -n / 2, n, n, i), h.fill(), h.stroke(), h.restore();
470
470
  }
471
- function ze(h, t, e, s, o) {
472
- const n = de, i = le, a = Is;
473
- h.save(), h.translate(t, e), h.rotate(rt.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
471
+ function We(h, t, e, s, o) {
472
+ const n = de, i = le, a = Os;
473
+ h.save(), h.translate(t, e), h.rotate(ct.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
474
474
  }
475
- function Pe(h, t, e, s, o) {
476
- const n = he, i = ue, a = Cs;
477
- h.save(), h.translate(t, e), h.rotate(rt.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
475
+ function Ze(h, t, e, s, o) {
476
+ const n = he, i = ue, a = Ds;
477
+ h.save(), h.translate(t, e), h.rotate(ct.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
478
478
  }
479
- const Es = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", Je = new Image();
480
- Je.src = Es;
481
- function Os(h, t, e, s, o) {
482
- const i = Kt / 2;
483
- h.save(), h.translate(t, e), h.rotate(rt.degreesToRadians(o.angle)), h.fillStyle = Ts, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(Je, -i / 2, -i / 2, i, i), h.restore();
479
+ const Rs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", is = new Image();
480
+ is.src = Rs;
481
+ function _s(h, t, e, s, o) {
482
+ const i = $t / 2;
483
+ h.save(), h.translate(t, e), h.rotate(ct.degreesToRadians(o.angle)), h.fillStyle = Ls, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(is, -i / 2, -i / 2, i, i), h.restore();
484
484
  }
485
- const Ls = {
485
+ const Ns = {
486
486
  // Угловые точки
487
487
  tl: {
488
- render: Zt,
489
- sizeX: it,
490
- sizeY: it,
488
+ render: Xt,
489
+ sizeX: at,
490
+ sizeY: at,
491
491
  offsetX: 0,
492
492
  offsetY: 0
493
493
  },
494
494
  tr: {
495
- render: Zt,
496
- sizeX: it,
497
- sizeY: it,
495
+ render: Xt,
496
+ sizeX: at,
497
+ sizeY: at,
498
498
  offsetX: 0,
499
499
  offsetY: 0
500
500
  },
501
501
  bl: {
502
- render: Zt,
503
- sizeX: it,
504
- sizeY: it,
502
+ render: Xt,
503
+ sizeX: at,
504
+ sizeY: at,
505
505
  offsetX: 0,
506
506
  offsetY: 0
507
507
  },
508
508
  br: {
509
- render: Zt,
510
- sizeX: it,
511
- sizeY: it,
509
+ render: Xt,
510
+ sizeX: at,
511
+ sizeY: at,
512
512
  offsetX: 0,
513
513
  offsetY: 0
514
514
  },
515
515
  // Середина вертикалей
516
516
  ml: {
517
- render: ze,
517
+ render: We,
518
518
  sizeX: de,
519
519
  sizeY: le,
520
520
  offsetX: 0,
521
521
  offsetY: 0
522
522
  },
523
523
  mr: {
524
- render: ze,
524
+ render: We,
525
525
  sizeX: de,
526
526
  sizeY: le,
527
527
  offsetX: 0,
@@ -529,14 +529,14 @@ const Ls = {
529
529
  },
530
530
  // Середина горизонталей
531
531
  mt: {
532
- render: Pe,
532
+ render: Ze,
533
533
  sizeX: he,
534
534
  sizeY: ue,
535
535
  offsetX: 0,
536
536
  offsetY: 0
537
537
  },
538
538
  mb: {
539
- render: Pe,
539
+ render: Ze,
540
540
  sizeX: he,
541
541
  sizeY: ue,
542
542
  offsetX: 0,
@@ -544,14 +544,14 @@ const Ls = {
544
544
  },
545
545
  // Специальный «rotate» контрол
546
546
  mtr: {
547
- render: Os,
548
- sizeX: Kt,
549
- sizeY: Kt,
547
+ render: _s,
548
+ sizeX: $t,
549
+ sizeY: $t,
550
550
  offsetX: 0,
551
- offsetY: -Kt
551
+ offsetY: -$t
552
552
  }
553
553
  };
554
- class Q {
554
+ class $ {
555
555
  /**
556
556
  * Отключает изменение ширины по оси X для заблокированных объектов, сохраняя поведение остального хэндлера.
557
557
  */
@@ -567,7 +567,7 @@ class Q {
567
567
  * Применяет конфигурацию контролов к набору по ключам из DEFAULT_CONTROLS.
568
568
  */
569
569
  static applyControlOverrides(t) {
570
- Object.entries(Ls).forEach(([e, s]) => {
570
+ Object.entries(Ns).forEach(([e, s]) => {
571
571
  const o = t[e];
572
572
  o && (Object.assign(o, s), e === "mtr" && (o.cursorStyle = "grab", o.mouseDownHandler = (n, i, a, r) => {
573
573
  var d;
@@ -580,24 +580,24 @@ class Q {
580
580
  * Регистрирует контролы и настройки поведения выделений.
581
581
  */
582
582
  static apply() {
583
- const t = _e.createObjectDefaultControls();
584
- Q.applyControlOverrides(t), Ne.ownDefaults.controls = t;
585
- const e = _e.createTextboxDefaultControls();
586
- Q.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), Q.wrapWidthControl(e.ml), Q.wrapWidthControl(e.mr), st.ownDefaults.controls = e, Q.patchActiveSelectionBounds(), Ne.ownDefaults.snapAngle = 1;
583
+ const t = Pe.createObjectDefaultControls();
584
+ $.applyControlOverrides(t), Ue.ownDefaults.controls = t;
585
+ const e = Pe.createTextboxDefaultControls();
586
+ $.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), $.wrapWidthControl(e.ml), $.wrapWidthControl(e.mr), st.ownDefaults.controls = e, $.patchActiveSelectionBounds(), Ue.ownDefaults.snapAngle = 1;
587
587
  }
588
588
  /**
589
589
  * Обновляет алгоритм расчёта границ ActiveSelection, чтобы учитывать фон и отступы текстовых объектов.
590
590
  */
591
591
  static patchActiveSelectionBounds() {
592
- const t = k.prototype, e = t._calcBoundsFromObjects;
592
+ const t = x.prototype, e = t._calcBoundsFromObjects;
593
593
  t._calcBoundsFromObjects = function(...n) {
594
594
  var g, f;
595
595
  const i = (f = (g = this.getObjects) == null ? void 0 : g.call(this)) != null ? f : [];
596
- Q.applyTextSelectionScalingLock({
596
+ $.applyTextSelectionScalingLock({
597
597
  selection: this,
598
598
  objects: i
599
599
  });
600
- const a = Q.calculateActiveSelectionBounds({
600
+ const a = $.calculateActiveSelectionBounds({
601
601
  objects: i
602
602
  });
603
603
  if (!a)
@@ -609,45 +609,45 @@ class Q {
609
609
  width: d,
610
610
  height: l
611
611
  });
612
- const u = new $(r + d / 2, c + l / 2);
612
+ const u = new J(r + d / 2, c + l / 2);
613
613
  return this.setPositionByOrigin(u, "center", "center"), a;
614
614
  };
615
615
  const s = t._onAfterObjectsChange;
616
616
  t._onAfterObjectsChange = function(n, i) {
617
617
  var p, m;
618
618
  const a = s ? s.call(this, n, i) : void 0, r = (m = (p = this.getObjects) == null ? void 0 : p.call(this)) != null ? m : [];
619
- Q.applyTextSelectionScalingLock({
619
+ $.applyTextSelectionScalingLock({
620
620
  selection: this,
621
621
  objects: r
622
622
  });
623
- const c = Q.calculateActiveSelectionBounds({
623
+ const c = $.calculateActiveSelectionBounds({
624
624
  objects: r
625
625
  });
626
626
  if (!c) return a;
627
- const { left: d, top: l, width: u, height: g } = c, f = new $(d + u / 2, l + g / 2);
627
+ const { left: d, top: l, width: u, height: g } = c, f = new J(d + u / 2, l + g / 2);
628
628
  return this.set({
629
629
  width: u,
630
630
  height: g
631
631
  }), this.setPositionByOrigin(f, "center", "center"), this.setCoords(), a;
632
632
  };
633
- const o = Be.prototype.calcBoundingBox;
634
- Be.prototype.calcBoundingBox = function(n, i) {
633
+ const o = Ye.prototype.calcBoundingBox;
634
+ Ye.prototype.calcBoundingBox = function(n, i) {
635
635
  const { target: a, type: r, overrides: c } = i;
636
636
  if (r === "imperative" && c)
637
637
  return c;
638
- if (!(a instanceof k))
638
+ if (!(a instanceof x))
639
639
  return o.call(this, n, i);
640
- Q.applyTextSelectionScalingLock({
640
+ $.applyTextSelectionScalingLock({
641
641
  selection: a,
642
642
  objects: n
643
643
  });
644
- const d = Q.calculateActiveSelectionBounds({ objects: n });
644
+ const d = $.calculateActiveSelectionBounds({ objects: n });
645
645
  if (!d)
646
646
  return o.call(this, n, i);
647
- const { left: l, top: u, width: g, height: f } = d, p = new $(g, f), m = new $(l + g / 2, u + f / 2);
647
+ const { left: l, top: u, width: g, height: f } = d, p = new J(g, f), m = new J(l + g / 2, u + f / 2);
648
648
  return r === "initialization" ? {
649
649
  center: m,
650
- relativeCorrection: new $(0, 0),
650
+ relativeCorrection: new J(0, 0),
651
651
  size: p
652
652
  } : {
653
653
  center: m,
@@ -671,18 +671,21 @@ class Q {
671
671
  };
672
672
  }
673
673
  /**
674
- * Блокирует вертикальное масштабирование для ActiveSelection, если в нём есть текстовые объекты.
674
+ * Блокирует горизонтальное масштабирование ActiveSelection, если в выделении есть текстовые объекты.
675
675
  */
676
676
  static applyTextSelectionScalingLock({
677
677
  selection: t,
678
678
  objects: e
679
679
  }) {
680
- const s = e.some((o) => o instanceof st);
680
+ const s = e.some((i) => i instanceof st), o = t instanceof x && e.length > 1, n = s && o;
681
681
  t.set({
682
- lockScalingY: s
682
+ lockScalingY: s,
683
+ lockScalingX: n
683
684
  }), t.setControlsVisibility({
684
685
  mt: !s,
685
- mb: !s
686
+ mb: !s,
687
+ ml: !n,
688
+ mr: !n
686
689
  });
687
690
  }
688
691
  }
@@ -855,7 +858,7 @@ N.registeredFontKeys = /* @__PURE__ */ new Set(), N.descriptorDefaults = {
855
858
  display: "auto"
856
859
  };
857
860
  let ge = N;
858
- const Ds = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42M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1IDAgMCAwIDUgMTcuNWgxMGExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjVoLjYyNWEuNjI1LjYyNSAwIDAgMCAwLTEuMjVIMTMuNzV2LS42MjVhMS44NzUgMS44NzUgMCAwIDAtMS44NzUtMS44NzVoLTMuNzVabTQuMzc1IDIuNXYtLjYyNWEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2LjYyNWg1Wk01IDE2LjI1VjVoMTB2MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", zt = {
859
862
  style: {
860
863
  position: "absolute",
861
864
  display: "none",
@@ -922,14 +925,14 @@ const Ds = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
922
925
  ],
923
926
  offsetTop: 50,
924
927
  icons: {
925
- copyPaste: Ds,
926
- delete: zs,
927
- lock: Rs,
928
- unlock: _s,
929
- bringToFront: ks,
930
- sendToBack: xs,
931
- bringForward: Ns,
932
- sendBackwards: Bs
928
+ copyPaste: xs,
929
+ delete: Fs,
930
+ lock: ks,
931
+ unlock: Bs,
932
+ bringToFront: Us,
933
+ sendToBack: Ys,
934
+ bringForward: zs,
935
+ sendBackwards: Ps
933
936
  },
934
937
  handlers: {
935
938
  copyPaste: (h) => _(null, null, function* () {
@@ -958,18 +961,18 @@ const Ds = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
958
961
  }
959
962
  }
960
963
  };
961
- class Ps {
964
+ class Hs {
962
965
  constructor({ editor: t }) {
963
966
  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();
964
967
  }
965
968
  _initToolbar() {
966
969
  if (!this.options.showToolbar) return;
967
970
  const t = this.options.toolbar || {};
968
- this.config = bt(B(B({}, kt), t), {
969
- style: B(B({}, kt.style), t.style || {}),
970
- btnStyle: B(B({}, kt.btnStyle), t.btnStyle || {}),
971
- icons: B(B({}, kt.icons), t.icons || {}),
972
- handlers: B(B({}, kt.handlers), t.handlers || {})
971
+ this.config = jt(k(k({}, zt), t), {
972
+ style: k(k({}, zt.style), t.style || {}),
973
+ btnStyle: k(k({}, zt.btnStyle), t.btnStyle || {}),
974
+ icons: k(k({}, zt.icons), t.icons || {}),
975
+ handlers: k(k({}, zt.handlers), t.handlers || {})
973
976
  }), this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this._onMouseDown = this._handleMouseDown.bind(this), this._onObjectMoving = this._startTransform.bind(this), this._onObjectScaling = this._startTransform.bind(this), this._onObjectRotating = this._startTransform.bind(this), this._onMouseUp = this._endTransform.bind(this), this._onObjectModified = this._endTransform.bind(this), this._onSelectionChange = this._updateToolbar.bind(this), this._onSelectionClear = () => {
974
977
  this.el.style.display = "none";
975
978
  }, this._createDOM(), this._bindEvents();
@@ -1086,7 +1089,7 @@ class Ps {
1086
1089
  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();
1087
1090
  }
1088
1091
  }
1089
- const Us = {
1092
+ const Ws = {
1090
1093
  position: "absolute",
1091
1094
  display: "none",
1092
1095
  background: "#2B2D33",
@@ -1100,7 +1103,7 @@ const Us = {
1100
1103
  "pointer-events": "none",
1101
1104
  "white-space": "nowrap",
1102
1105
  "box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
1103
- }, Ue = 16, Ye = 16, Ys = "fabric-editor-angle-indicator";
1106
+ }, Ge = 16, Ve = 16, Zs = "fabric-editor-angle-indicator";
1104
1107
  class be {
1105
1108
  constructor({ editor: t }) {
1106
1109
  this.isActive = !1, this.currentAngle = 0, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._createDOM(), this._bindEvents();
@@ -1109,7 +1112,7 @@ class be {
1109
1112
  * Создание DOM-элемента индикатора
1110
1113
  */
1111
1114
  _createDOM() {
1112
- this.el = document.createElement("div"), this.el.className = Ys, Object.entries(Us).forEach(([t, e]) => {
1115
+ this.el = document.createElement("div"), this.el.className = Zs, Object.entries(Ws).forEach(([t, e]) => {
1113
1116
  this.el.style.setProperty(t, e);
1114
1117
  }), this.canvas.wrapperEl.appendChild(this.el);
1115
1118
  }
@@ -1160,9 +1163,9 @@ class be {
1160
1163
  */
1161
1164
  _positionIndicator(t) {
1162
1165
  const e = this.canvas.wrapperEl.getBoundingClientRect();
1163
- let s = t.clientX - e.left + Ue, o = t.clientY - e.top + Ye;
1166
+ let s = t.clientX - e.left + Ge, o = t.clientY - e.top + Ve;
1164
1167
  const n = this.el.getBoundingClientRect(), i = n.width, a = n.height;
1165
- s + i > e.width && (s = t.clientX - e.left - i - Ue), o + a > e.height && (o = t.clientY - e.top - a - Ye), this.el.style.left = `${s}px`, this.el.style.top = `${o}px`;
1168
+ s + i > e.width && (s = t.clientX - e.left - i - Ge), o + a > e.height && (o = t.clientY - e.top - a - Ve), this.el.style.left = `${s}px`, this.el.style.top = `${o}px`;
1166
1169
  }
1167
1170
  /**
1168
1171
  * Показать индикатор
@@ -1193,7 +1196,7 @@ class be {
1193
1196
  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;
1194
1197
  }
1195
1198
  }
1196
- const ts = [
1199
+ const as = [
1197
1200
  "selectable",
1198
1201
  "evented",
1199
1202
  "id",
@@ -1229,7 +1232,7 @@ const ts = [
1229
1232
  "radiusBottomRight",
1230
1233
  "radiusBottomLeft"
1231
1234
  ];
1232
- class Qt {
1235
+ class Jt {
1233
1236
  constructor({ editor: t }) {
1234
1237
  this.editor = t, this.canvas = t.canvas, this._historySuspendCount = 0, this.baseState = null, this.patches = [], this.currentIndex = 0, this.maxHistoryLength = t.options.maxHistoryLength, this.totalChangesCount = 0, this.baseStateChangesCount = 0, this._createDiffPatcher();
1235
1238
  }
@@ -1241,7 +1244,7 @@ class Qt {
1241
1244
  return this.patches[this.currentIndex - 1] || null;
1242
1245
  }
1243
1246
  _createDiffPatcher() {
1244
- this.diffPatcher = vs({
1247
+ this.diffPatcher = Ss({
1245
1248
  objectHash(t) {
1246
1249
  const e = t, s = t, o = s.styles ? JSON.stringify(s.styles) : "";
1247
1250
  return [
@@ -1291,7 +1294,7 @@ class Qt {
1291
1294
  includeValueOnMove: !1
1292
1295
  },
1293
1296
  textDiff: {
1294
- diffMatchPatch: bs,
1297
+ diffMatchPatch: As,
1295
1298
  minLength: 60
1296
1299
  }
1297
1300
  });
@@ -1333,7 +1336,7 @@ class Qt {
1333
1336
  if (console.log("saveState"), this.skipHistory) return;
1334
1337
  console.time("saveState");
1335
1338
  const t = this._withTemporaryUnlock(
1336
- () => this.canvas.toDatalessObject([...ts])
1339
+ () => this.canvas.toDatalessObject([...as])
1337
1340
  );
1338
1341
  if (console.timeEnd("saveState"), !this.baseState) {
1339
1342
  this.baseState = t, this.patches = [], this.currentIndex = 0, console.log("Базовое состояние сохранено.");
@@ -1381,8 +1384,8 @@ class Qt {
1381
1384
  if (!t) return;
1382
1385
  console.log("loadStateFromFullState fullState", t);
1383
1386
  const { canvas: e, canvasManager: s, interactionBlocker: o, backgroundManager: n } = this.editor, { width: i, height: a } = e;
1384
- o.overlayMask = null, Qt._serializeCustomData(t), yield e.loadFromJSON(t, (l, u) => {
1385
- Qt._deserializeCustomData(l, u);
1387
+ o.overlayMask = null, Jt._serializeCustomData(t), yield e.loadFromJSON(t, (l, u) => {
1388
+ Jt._deserializeCustomData(l, u);
1386
1389
  });
1387
1390
  const r = e.getObjects().find((l) => l.id === "montage-area");
1388
1391
  r && (this.editor.montageArea = r, (i !== e.getWidth() || a !== e.getHeight()) && s.updateCanvas());
@@ -1496,7 +1499,7 @@ class Qt {
1496
1499
  }
1497
1500
  }
1498
1501
  }
1499
- const Fs = 0.1, Hs = 2, Fe = 0.1, Ws = 90, It = 16, Ct = 16, ft = 4096, pt = 4096, He = "application/image-editor:", Gt = [
1502
+ const Gs = 0.1, Vs = 2, Xe = 0.1, Xs = 90, Dt = 16, Lt = 16, pt = 4096, mt = 4096, Ke = "application/image-editor:", Kt = [
1500
1503
  "format",
1501
1504
  "uppercase",
1502
1505
  "textCaseRaw",
@@ -1510,8 +1513,8 @@ const Fs = 0.1, Hs = 2, Fe = 0.1, Ws = 90, It = 16, Ct = 16, ft = 4096, pt = 409
1510
1513
  "radiusTopRight",
1511
1514
  "radiusBottomRight",
1512
1515
  "radiusBottomLeft"
1513
- ], Zs = 50;
1514
- class at {
1516
+ ], Ks = 50;
1517
+ class rt {
1515
1518
  constructor({ editor: t }) {
1516
1519
  this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
1517
1520
  }
@@ -1538,7 +1541,7 @@ class at {
1538
1541
  withoutSelection: a = !1
1539
1542
  } = t;
1540
1543
  if (!e) return null;
1541
- const { canvas: r, montageArea: c, transformManager: d, historyManager: l, errorManager: u } = this.editor, g = yield this.getContentType(e), f = at.getFormatFromContentType(g), { acceptContentTypes: p, acceptFormats: m } = this;
1544
+ const { canvas: r, montageArea: c, transformManager: d, historyManager: l, errorManager: u } = this.editor, g = yield this.getContentType(e), f = rt.getFormatFromContentType(g), { acceptContentTypes: p, acceptFormats: m } = this;
1542
1545
  if (!this.isAllowedContentType(g)) {
1543
1546
  const v = `Неверный contentType для изображения: ${g}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1544
1547
  return u.emitError({
@@ -1584,18 +1587,18 @@ class at {
1584
1587
  }
1585
1588
  }), null;
1586
1589
  if (this._createdBlobUrls.push(v), f === "svg") {
1587
- const S = yield ls(v);
1588
- b = rt.groupSVGElements(S.objects, S.options);
1590
+ const S = yield fs(v);
1591
+ b = ct.groupSVGElements(S.objects, S.options);
1589
1592
  } else
1590
1593
  b = yield Bt.fromURL(v, { crossOrigin: "anonymous" });
1591
1594
  const { width: I, height: y } = b;
1592
1595
  if (b instanceof Bt) {
1593
1596
  const S = b.getElement();
1594
1597
  let A = "";
1595
- if (S instanceof HTMLImageElement ? A = S.src : S instanceof HTMLCanvasElement && (A = S.toDataURL()), y > pt || I > ft) {
1598
+ if (S instanceof HTMLImageElement ? A = S.src : S instanceof HTMLCanvasElement && (A = S.toDataURL()), y > mt || I > pt) {
1596
1599
  const M = yield this.resizeImageToBoundaries(A, "max"), C = URL.createObjectURL(M);
1597
1600
  this._createdBlobUrls.push(C), b = yield Bt.fromURL(C, { crossOrigin: "anonymous" });
1598
- } else if (y < Ct || I < It) {
1601
+ } else if (y < Lt || I < Dt) {
1599
1602
  const M = yield this.resizeImageToBoundaries(A, "min"), C = URL.createObjectURL(M);
1600
1603
  this._createdBlobUrls.push(C), b = yield Bt.fromURL(C, { crossOrigin: "anonymous" });
1601
1604
  }
@@ -1649,15 +1652,15 @@ class at {
1649
1652
  */
1650
1653
  resizeImageToBoundaries(t, e = "max") {
1651
1654
  return _(this, null, function* () {
1652
- let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${ft}x${pt}`;
1653
- e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${It}x${Ct}`);
1655
+ let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${pt}x${mt}`;
1656
+ e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${Dt}x${Lt}`);
1654
1657
  const o = {
1655
1658
  dataURL: t,
1656
1659
  sizeType: e,
1657
- maxWidth: ft,
1658
- maxHeight: pt,
1659
- minWidth: It,
1660
- minHeight: Ct
1660
+ maxWidth: pt,
1661
+ maxHeight: mt,
1662
+ minWidth: Dt,
1663
+ minHeight: Lt
1661
1664
  };
1662
1665
  return this.editor.errorManager.emitWarning({
1663
1666
  origin: "ImageManager",
@@ -1688,7 +1691,7 @@ class at {
1688
1691
  exportAsBlob: n = !1
1689
1692
  } = t, { canvas: i, montageArea: a, workerManager: r, interactionBlocker: c } = this.editor;
1690
1693
  try {
1691
- const d = s === "application/pdf", l = d ? "image/jpg" : s, u = at.getFormatFromContentType(l);
1694
+ const d = s === "application/pdf", l = d ? "image/jpg" : s, u = rt.getFormatFromContentType(l);
1692
1695
  a.setCoords();
1693
1696
  const { left: g, top: f, width: p, height: m } = a.getBoundingRect(), v = yield i.clone(["id", "format", "locked"]);
1694
1697
  v.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(l) && (v.backgroundColor = "#ffffff");
@@ -1702,8 +1705,8 @@ class at {
1702
1705
  if (u === "svg" && I) {
1703
1706
  const j = v.toSVG();
1704
1707
  v.dispose();
1705
- const x = {
1706
- image: at._exportSVGStringAsFile(j, {
1708
+ const B = {
1709
+ image: rt._exportSVGStringAsFile(j, {
1707
1710
  exportAsBase64: o,
1708
1711
  exportAsBlob: n,
1709
1712
  fileName: e
@@ -1712,11 +1715,11 @@ class at {
1712
1715
  contentType: "image/svg+xml",
1713
1716
  fileName: e.replace(/\.[^/.]+$/, ".svg")
1714
1717
  };
1715
- return i.fire("editor:canvas-exported", x), x;
1718
+ return i.fire("editor:canvas-exported", B), B;
1716
1719
  }
1717
1720
  const y = yield new Promise((j, T) => {
1718
- v.getElement().toBlob((x) => {
1719
- x ? j(x) : T(new Error("Failed to create Blob from canvas"));
1721
+ v.getElement().toBlob((B) => {
1722
+ B ? j(B) : T(new Error("Failed to create Blob from canvas"));
1720
1723
  });
1721
1724
  });
1722
1725
  if (v.dispose(), n) {
@@ -1734,27 +1737,27 @@ class at {
1734
1737
  [w]
1735
1738
  );
1736
1739
  if (d) {
1737
- const T = p * 0.264583, x = m * 0.264583, Z = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, U = new Z({
1738
- orientation: T > x ? "landscape" : "portrait",
1740
+ const T = p * 0.264583, B = m * 0.264583, Z = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, U = new Z({
1741
+ orientation: T > B ? "landscape" : "portrait",
1739
1742
  unit: "mm",
1740
- format: [T, x]
1743
+ format: [T, B]
1741
1744
  });
1742
- if (U.addImage(String(S), "JPG", 0, 0, T, x), o) {
1743
- const X = {
1745
+ if (U.addImage(String(S), "JPG", 0, 0, T, B), o) {
1746
+ const K = {
1744
1747
  image: U.output("datauristring"),
1745
1748
  format: "pdf",
1746
1749
  contentType: "application/pdf",
1747
1750
  fileName: e
1748
1751
  };
1749
- return i.fire("editor:canvas-exported", X), X;
1752
+ return i.fire("editor:canvas-exported", K), K;
1750
1753
  }
1751
- const F = U.output("blob"), L = {
1754
+ const F = U.output("blob"), D = {
1752
1755
  image: new File([F], e, { type: "application/pdf" }),
1753
1756
  format: "pdf",
1754
1757
  contentType: "application/pdf",
1755
1758
  fileName: e
1756
1759
  };
1757
- return i.fire("editor:canvas-exported", L), L;
1760
+ return i.fire("editor:canvas-exported", D), D;
1758
1761
  }
1759
1762
  if (o) {
1760
1763
  const j = {
@@ -1812,9 +1815,9 @@ class at {
1812
1815
  data: { contentType: o, fileName: s, exportAsBase64: n, exportAsBlob: i }
1813
1816
  }), null;
1814
1817
  try {
1815
- const d = at.getFormatFromContentType(o);
1818
+ const d = rt.getFormatFromContentType(o);
1816
1819
  if (d === "svg") {
1817
- const p = c.toSVG(), m = at._exportSVGStringAsFile(p, {
1820
+ const p = c.toSVG(), m = rt._exportSVGStringAsFile(p, {
1818
1821
  exportAsBase64: n,
1819
1822
  exportAsBlob: i,
1820
1823
  fileName: s
@@ -1892,7 +1895,7 @@ class at {
1892
1895
  * @returns массив допустимых форматов изображений
1893
1896
  */
1894
1897
  getAllowedFormatsFromContentTypes() {
1895
- return this.acceptContentTypes.map((t) => at.getFormatFromContentType(t)).filter((t) => t);
1898
+ return this.acceptContentTypes.map((t) => rt.getFormatFromContentType(t)).filter((t) => t);
1896
1899
  }
1897
1900
  /**
1898
1901
  * Проверяет, является ли contentType допустимым типом изображения.
@@ -1945,7 +1948,7 @@ class at {
1945
1948
  try {
1946
1949
  const o = (e = new URL(t).pathname.split(".").pop()) == null ? void 0 : e.toLowerCase(), n = {};
1947
1950
  return this.acceptContentTypes.forEach((i) => {
1948
- const a = at.getFormatFromContentType(i);
1951
+ const a = rt.getFormatFromContentType(i);
1949
1952
  a && (n[a] = i);
1950
1953
  }), o && n[o] || "application/octet-stream";
1951
1954
  } catch (s) {
@@ -1998,11 +2001,11 @@ class at {
1998
2001
  return e ? e[1] : "";
1999
2002
  }
2000
2003
  }
2001
- const Mt = (h, t, e) => Math.max(Math.min(h, e), t), We = (h, t) => h * t, Gs = (h, t) => new $(h / 2, t / 2);
2002
- function Vs(h) {
2004
+ const It = (h, t, e) => Math.max(Math.min(h, e), t), Qe = (h, t) => h * t, Qs = (h, t) => new J(h / 2, t / 2);
2005
+ function qs(h) {
2003
2006
  return ((h == null ? void 0 : h.type) === "image" || (h == null ? void 0 : h.format) === "svg") && typeof (h == null ? void 0 : h.width) == "number" && typeof (h == null ? void 0 : h.height) == "number";
2004
2007
  }
2005
- class Xs {
2008
+ class $s {
2006
2009
  /**
2007
2010
  * @param options
2008
2011
  * @param options.editor – экземпляр редактора
@@ -2033,9 +2036,9 @@ class Xs {
2033
2036
  canvas: n,
2034
2037
  montageArea: i,
2035
2038
  options: { canvasBackstoreWidth: a }
2036
- } = this.editor, { width: r, height: c } = i, d = Mt(Number(t), It, ft);
2039
+ } = this.editor, { width: r, height: c } = i, d = It(Number(t), Dt, pt);
2037
2040
  if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(d), i.set({ width: d }), (f = n.clipPath) == null || f.set({ width: d }), e) {
2038
- const p = d / r, m = We(c, p);
2041
+ const p = d / r, m = Qe(c, p);
2039
2042
  this.setResolutionHeight(m);
2040
2043
  return;
2041
2044
  }
@@ -2063,9 +2066,9 @@ class Xs {
2063
2066
  canvas: n,
2064
2067
  montageArea: i,
2065
2068
  options: { canvasBackstoreHeight: a }
2066
- } = this.editor, { width: r, height: c } = i, d = Mt(Number(t), Ct, pt);
2069
+ } = this.editor, { width: r, height: c } = i, d = It(Number(t), Lt, mt);
2067
2070
  if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(d), i.set({ height: d }), (f = n.clipPath) == null || f.set({ height: d }), e) {
2068
- const p = d / c, m = We(r, p);
2071
+ const p = d / c, m = Qe(r, p);
2069
2072
  this.setResolutionWidth(m);
2070
2073
  return;
2071
2074
  }
@@ -2083,7 +2086,7 @@ class Xs {
2083
2086
  */
2084
2087
  centerMontageArea() {
2085
2088
  var r;
2086
- const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(), n = t.getZoom(), i = Gs(s, o);
2089
+ const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(), n = t.getZoom(), i = Qs(s, o);
2087
2090
  e.set({
2088
2091
  left: s / 2,
2089
2092
  top: o / 2
@@ -2116,7 +2119,7 @@ class Xs {
2116
2119
  */
2117
2120
  setCanvasBackstoreWidth(t) {
2118
2121
  if (!t || typeof t != "number") return;
2119
- const e = Mt(t, It, ft);
2122
+ const e = It(t, Dt, pt);
2120
2123
  this.editor.canvas.setDimensions({ width: e }, { backstoreOnly: !0 });
2121
2124
  }
2122
2125
  /**
@@ -2125,7 +2128,7 @@ class Xs {
2125
2128
  */
2126
2129
  setCanvasBackstoreHeight(t) {
2127
2130
  if (!t || typeof t != "number") return;
2128
- const e = Mt(t, Ct, pt);
2131
+ const e = It(t, Lt, mt);
2129
2132
  this.editor.canvas.setDimensions({ height: e }, { backstoreOnly: !0 });
2130
2133
  }
2131
2134
  /**
@@ -2134,7 +2137,7 @@ class Xs {
2134
2137
  * с учётом минимальных и максимальных значений.
2135
2138
  */
2136
2139
  adaptCanvasToContainer() {
2137
- const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, o = e.clientHeight, n = Mt(s, It, ft), i = Mt(o, Ct, pt);
2140
+ const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, o = e.clientHeight, n = It(s, Dt, pt), i = It(o, Lt, mt);
2138
2141
  t.setDimensions({ width: n, height: i }, { backstoreOnly: !0 });
2139
2142
  }
2140
2143
  /**
@@ -2168,7 +2171,7 @@ class Xs {
2168
2171
  if (d.length === 1)
2169
2172
  t.setActiveObject(d[0]);
2170
2173
  else {
2171
- const l = new k(d, {
2174
+ const l = new x(d, {
2172
2175
  canvas: t
2173
2176
  });
2174
2177
  t.setActiveObject(l);
@@ -2334,9 +2337,9 @@ class Xs {
2334
2337
  montageAreaHeight: r
2335
2338
  }
2336
2339
  } = this.editor, c = t || o.getActiveObject();
2337
- if (!Vs(c)) return;
2340
+ if (!qs(c)) return;
2338
2341
  const { width: d, height: l } = c;
2339
- let u = Math.min(d, ft), g = Math.min(l, pt);
2342
+ let u = Math.min(d, pt), g = Math.min(l, mt);
2340
2343
  if (e) {
2341
2344
  const {
2342
2345
  width: f,
@@ -2394,7 +2397,7 @@ class Xs {
2394
2397
  );
2395
2398
  }
2396
2399
  }
2397
- class Ks {
2400
+ class Js {
2398
2401
  constructor({ editor: t }) {
2399
2402
  this.editor = t, this.options = t.options;
2400
2403
  }
@@ -2405,7 +2408,7 @@ class Ks {
2405
2408
  * @param options.withoutSave - Не сохранять состояние
2406
2409
  * @fires editor:object-rotated
2407
2410
  */
2408
- rotate(t = Ws, { withoutSave: e } = {}) {
2411
+ rotate(t = Xs, { withoutSave: e } = {}) {
2409
2412
  const { canvas: s, historyManager: o } = this.editor, n = s.getActiveObject();
2410
2413
  if (!n) return;
2411
2414
  const i = n.angle + t;
@@ -2455,7 +2458,7 @@ class Ks {
2455
2458
  withoutSave: s
2456
2459
  } = {}) {
2457
2460
  const { canvas: o, historyManager: n } = this.editor, i = t || o.getActiveObject();
2458
- i && (i instanceof k ? i.getObjects().forEach((a) => {
2461
+ i && (i instanceof x ? i.getObjects().forEach((a) => {
2459
2462
  a.set("opacity", e);
2460
2463
  }) : i.set("opacity", e), o.renderAll(), s || n.saveState(), o.fire("editor:object-opacity-changed", {
2461
2464
  object: i,
@@ -2482,12 +2485,12 @@ class Ks {
2482
2485
  } = {}) {
2483
2486
  const { canvas: n, historyManager: i } = this.editor, a = t || n.getActiveObject();
2484
2487
  if (a) {
2485
- if (a instanceof k && !o) {
2488
+ if (a instanceof x && !o) {
2486
2489
  const r = a.getObjects();
2487
2490
  n.discardActiveObject(), r.forEach((d) => {
2488
2491
  this._fitSingleObject(d, e);
2489
2492
  });
2490
- const c = new k(r, { canvas: n });
2493
+ const c = new x(r, { canvas: n });
2491
2494
  n.setActiveObject(c);
2492
2495
  } else
2493
2496
  this._fitSingleObject(a, e);
@@ -2560,9 +2563,9 @@ class Ks {
2560
2563
  });
2561
2564
  }
2562
2565
  }
2563
- class Qs {
2566
+ class to {
2564
2567
  constructor({ editor: t }) {
2565
- this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || Fs, this.maxZoom = this.options.maxZoom || Hs, this.defaultZoom = this.options.defaultScale;
2568
+ this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || Gs, this.maxZoom = this.options.maxZoom || Vs, this.defaultZoom = this.options.defaultScale;
2566
2569
  }
2567
2570
  /**
2568
2571
  * Вспомогательный метод для вычисления размеров масштабированной монтажной области
@@ -2638,8 +2641,8 @@ class Qs {
2638
2641
  const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), d = i.getHeight(), l = t.x - r[4], u = t.y - r[5], g = Math.abs(o), f = e - s;
2639
2642
  if (Math.abs(f) / g <= 0.1)
2640
2643
  return { x: l, y: u };
2641
- const m = c / 2, v = d / 2, b = a.left, I = a.top, y = m - b * s, w = v - I * s, S = (y - r[4]) / (e - s), A = (w - r[5]) / (e - s), M = S * g, C = A * g, j = M * n, T = C * n, x = Math.abs(j) > Math.abs(l) ? l : j, Z = Math.abs(T) > Math.abs(u) ? u : T;
2642
- return { x, y: Z };
2644
+ const m = c / 2, v = d / 2, b = a.left, I = a.top, y = m - b * s, w = v - I * s, S = (y - r[4]) / (e - s), A = (w - r[5]) / (e - s), M = S * g, C = A * g, j = M * n, T = C * n, B = Math.abs(j) > Math.abs(l) ? l : j, Z = Math.abs(T) > Math.abs(u) ? u : T;
2645
+ return { x: B, y: Z };
2643
2646
  }
2644
2647
  /**
2645
2648
  * Применяет плавное центрирование viewport при приближении к defaultZoom.
@@ -2651,7 +2654,7 @@ class Qs {
2651
2654
  * @returns true если центрирование было применено
2652
2655
  * @private
2653
2656
  */
2654
- _applyViewportCentering(t, e = !1, s = Fe) {
2657
+ _applyViewportCentering(t, e = !1, s = Xe) {
2655
2658
  const { canvas: o } = this.editor, n = this._getScaledMontageDimensions(t), i = o.getWidth(), a = o.getHeight(), r = n.width > i || n.height > a, c = this._calculateFitZoom(), d = t - c;
2656
2659
  if (!(!r || d) && !e)
2657
2660
  return !1;
@@ -2726,10 +2729,10 @@ class Qs {
2726
2729
  * @param options.pointY - Координата Y точки зума
2727
2730
  * @fires editor:zoom-changed
2728
2731
  */
2729
- zoom(t = Fe, e = {}) {
2732
+ zoom(t = Xe, e = {}) {
2730
2733
  var g, f;
2731
2734
  if (!t) return;
2732
- const { minZoom: s, maxZoom: o } = this, { canvas: n } = this.editor, i = t < 0, a = n.getZoom(), r = n.getCenterPoint(), c = (g = e.pointX) != null ? g : r.x, d = (f = e.pointY) != null ? f : r.y, l = new $(c, d);
2735
+ const { minZoom: s, maxZoom: o } = this, { canvas: n } = this.editor, i = t < 0, a = n.getZoom(), r = n.getCenterPoint(), c = (g = e.pointX) != null ? g : r.x, d = (f = e.pointY) != null ? f : r.y, l = new J(c, d);
2733
2736
  this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
2734
2737
  let u = Number((a + Number(t)).toFixed(3));
2735
2738
  u > o && (u = o), u < s && (u = s), n.zoomToPoint(l, u), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(u, i, t), n.fire("editor:zoom-changed", {
@@ -2744,7 +2747,7 @@ class Qs {
2744
2747
  * @fires editor:zoom-changed
2745
2748
  */
2746
2749
  setZoom(t = this.defaultZoom) {
2747
- const { minZoom: e, maxZoom: s } = this, { canvas: o } = this.editor, n = new $(o.getCenterPoint());
2750
+ const { minZoom: e, maxZoom: s } = this, { canvas: o } = this.editor, n = new J(o.getCenterPoint());
2748
2751
  let i = t;
2749
2752
  t > s && (i = s), t < e && (i = e), o.zoomToPoint(n, i), o.fire("editor:zoom-changed", {
2750
2753
  currentZoom: o.getZoom(),
@@ -2757,14 +2760,14 @@ class Qs {
2757
2760
  * @fires editor:zoom-changed
2758
2761
  */
2759
2762
  resetZoom() {
2760
- const { canvas: t } = this.editor, e = new $(t.getCenterPoint());
2763
+ const { canvas: t } = this.editor, e = new J(t.getCenterPoint());
2761
2764
  t.zoomToPoint(e, this.defaultZoom), this.editor.canvas.fire("editor:zoom-changed", {
2762
2765
  currentZoom: t.getZoom(),
2763
2766
  point: e
2764
2767
  }), this.editor.panConstraintManager.updateBounds();
2765
2768
  }
2766
2769
  }
2767
- class qs {
2770
+ class eo {
2768
2771
  constructor({ editor: t }) {
2769
2772
  this.editor = t, this.isBlocked = !1, this.overlayMask = null, this._createOverlay();
2770
2773
  }
@@ -2821,7 +2824,7 @@ class qs {
2821
2824
  }), t.upperCanvasEl.style.pointerEvents = "", t.lowerCanvasEl.style.pointerEvents = "", this.overlayMask.visible = !1, t.requestRenderAll(), t.fire("editor:enabled"), s.resumeHistory();
2822
2825
  }
2823
2826
  }
2824
- class St {
2827
+ class Tt {
2825
2828
  constructor({ editor: t }) {
2826
2829
  this.editor = t, this.backgroundObject = null;
2827
2830
  }
@@ -2876,8 +2879,8 @@ class St {
2876
2879
  try {
2877
2880
  const { historyManager: n } = this.editor, { backgroundObject: i } = this;
2878
2881
  if (n.suspendHistory(), i && i.backgroundType === "gradient") {
2879
- const a = St._createFabricGradient(t);
2880
- if (St._isGradientEqual(i.fill, a)) {
2882
+ const a = Tt._createFabricGradient(t);
2883
+ if (Tt._isGradientEqual(i.fill, a)) {
2881
2884
  n.resumeHistory();
2882
2885
  return;
2883
2886
  }
@@ -3049,7 +3052,7 @@ class St {
3049
3052
  backgroundType: "gradient",
3050
3053
  backgroundId: `background-${Y()}`
3051
3054
  }, { withoutSelection: !0 }), this.refresh();
3052
- const e = St._createFabricGradient(t);
3055
+ const e = Tt._createFabricGradient(t);
3053
3056
  this.backgroundObject.set("fill", e), this.editor.canvas.requestRenderAll();
3054
3057
  }
3055
3058
  /**
@@ -3101,8 +3104,8 @@ class St {
3101
3104
  { offset: n / 100, color: s }
3102
3105
  ];
3103
3106
  if (t.type === "linear") {
3104
- const l = t.angle * Math.PI / 180, u = St._angleToCoords(l);
3105
- return new ke({
3107
+ const l = t.angle * Math.PI / 180, u = Tt._angleToCoords(l);
3108
+ return new Fe({
3106
3109
  type: "linear",
3107
3110
  gradientUnits: "percentage",
3108
3111
  coords: u,
@@ -3121,7 +3124,7 @@ class St {
3121
3124
  r1: 0,
3122
3125
  r2: c / 100
3123
3126
  };
3124
- return new ke({
3127
+ return new Fe({
3125
3128
  type: "radial",
3126
3129
  gradientUnits: "percentage",
3127
3130
  coords: d,
@@ -3156,7 +3159,7 @@ class St {
3156
3159
  }) ? !1 : t.type === "linear" && e.type === "linear" ? Math.abs(t.coords.x1 - e.coords.x1) < 1e-4 && Math.abs(t.coords.y1 - e.coords.y1) < 1e-4 && Math.abs(t.coords.x2 - e.coords.x2) < 1e-4 && Math.abs(t.coords.y2 - e.coords.y2) < 1e-4 : t.type === "radial" && e.type === "radial" ? Math.abs(t.coords.x1 - e.coords.x1) < 1e-4 && Math.abs(t.coords.y1 - e.coords.y1) < 1e-4 && Math.abs(t.coords.x2 - e.coords.x2) < 1e-4 && Math.abs(t.coords.y2 - e.coords.y2) < 1e-4 && Math.abs(t.coords.r1 - e.coords.r1) < 1e-4 && Math.abs(t.coords.r2 - e.coords.r2) < 1e-4 : !1;
3157
3160
  }
3158
3161
  }
3159
- class qt {
3162
+ class te {
3160
3163
  constructor({ editor: t }) {
3161
3164
  this.editor = t;
3162
3165
  }
@@ -3171,7 +3174,7 @@ class qt {
3171
3174
  const { canvas: s, historyManager: o } = this.editor;
3172
3175
  o.suspendHistory();
3173
3176
  const n = t || s.getActiveObject();
3174
- n && (n instanceof k ? n.getObjects().forEach((i) => {
3177
+ n && (n instanceof x ? n.getObjects().forEach((i) => {
3175
3178
  s.bringObjectToFront(i);
3176
3179
  }) : s.bringObjectToFront(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-to-front", {
3177
3180
  object: n,
@@ -3189,7 +3192,7 @@ class qt {
3189
3192
  const { canvas: s, historyManager: o } = this.editor;
3190
3193
  o.suspendHistory();
3191
3194
  const n = t || s.getActiveObject();
3192
- n && (n instanceof k ? qt._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
3195
+ n && (n instanceof x ? te._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
3193
3196
  object: n,
3194
3197
  withoutSave: e
3195
3198
  }));
@@ -3212,7 +3215,7 @@ class qt {
3212
3215
  n.suspendHistory();
3213
3216
  const r = t || s.getActiveObject();
3214
3217
  if (r) {
3215
- if (r instanceof k) {
3218
+ if (r instanceof x) {
3216
3219
  const c = r.getObjects();
3217
3220
  for (let d = c.length - 1; d >= 0; d -= 1)
3218
3221
  s.sendObjectToBack(c[d]);
@@ -3240,7 +3243,7 @@ class qt {
3240
3243
  } = this.editor;
3241
3244
  n.suspendHistory();
3242
3245
  const r = t || s.getActiveObject();
3243
- r && (r instanceof k ? qt._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(o), i && s.sendObjectToBack(i), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-send-backwards", {
3246
+ r && (r instanceof x ? te._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(o), i && s.sendObjectToBack(i), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-send-backwards", {
3244
3247
  object: r,
3245
3248
  withoutSave: e
3246
3249
  }));
@@ -3284,7 +3287,7 @@ class qt {
3284
3287
  });
3285
3288
  }
3286
3289
  }
3287
- class $s {
3290
+ class so {
3288
3291
  /**
3289
3292
  * Менеджер фигур для редактора.
3290
3293
  * @param options - Опции и настройки менеджера фигур.
@@ -3316,7 +3319,7 @@ class $s {
3316
3319
  width: o = 100,
3317
3320
  height: n = 100,
3318
3321
  fill: i = "blue"
3319
- } = l, a = ut(l, [
3322
+ } = l, a = gt(l, [
3320
3323
  "id",
3321
3324
  "left",
3322
3325
  "top",
@@ -3324,7 +3327,7 @@ class $s {
3324
3327
  "height",
3325
3328
  "fill"
3326
3329
  ]);
3327
- const { canvas: u } = this.editor, g = new hs(B({
3330
+ const { canvas: u } = this.editor, g = new ps(k({
3328
3331
  id: t,
3329
3332
  left: e,
3330
3333
  top: s,
@@ -3357,14 +3360,14 @@ class $s {
3357
3360
  top: s,
3358
3361
  radius: o = 50,
3359
3362
  fill: n = "green"
3360
- } = d, i = ut(d, [
3363
+ } = d, i = gt(d, [
3361
3364
  "id",
3362
3365
  "left",
3363
3366
  "top",
3364
3367
  "radius",
3365
3368
  "fill"
3366
3369
  ]);
3367
- const { canvas: l } = this.editor, u = new us(B({
3370
+ const { canvas: l } = this.editor, u = new ms(k({
3368
3371
  id: t,
3369
3372
  left: e,
3370
3373
  top: s,
@@ -3398,7 +3401,7 @@ class $s {
3398
3401
  width: o = 100,
3399
3402
  height: n = 100,
3400
3403
  fill: i = "yellow"
3401
- } = l, a = ut(l, [
3404
+ } = l, a = gt(l, [
3402
3405
  "id",
3403
3406
  "left",
3404
3407
  "top",
@@ -3406,7 +3409,7 @@ class $s {
3406
3409
  "height",
3407
3410
  "fill"
3408
3411
  ]);
3409
- const { canvas: u } = this.editor, g = new gs(B({
3412
+ const { canvas: u } = this.editor, g = new ys(k({
3410
3413
  id: t,
3411
3414
  left: e,
3412
3415
  top: s,
@@ -3417,7 +3420,7 @@ class $s {
3417
3420
  return !e && !s && u.centerObject(g), c || (u.add(g), r || u.setActiveObject(g), u.renderAll()), g;
3418
3421
  }
3419
3422
  }
3420
- class Js {
3423
+ class oo {
3421
3424
  /**
3422
3425
  * @param options
3423
3426
  * @param options.editor - экземпляр редактора с доступом к canvas
@@ -3448,7 +3451,7 @@ class Js {
3448
3451
  return _(this, null, function* () {
3449
3452
  const { canvas: e, errorManager: s } = this.editor;
3450
3453
  try {
3451
- const o = yield t.clone(Gt);
3454
+ const o = yield t.clone(Kt);
3452
3455
  this.clipboard = o, e.fire("editor:object-copied", { object: o });
3453
3456
  } catch (o) {
3454
3457
  s.emitError({
@@ -3475,7 +3478,7 @@ class Js {
3475
3478
  message: "navigator.clipboard не поддерживается в этом браузере или отсутствует HTTPS-соединение."
3476
3479
  }), !1;
3477
3480
  try {
3478
- const s = t.toObject(Gt), o = JSON.stringify(s);
3481
+ const s = t.toObject(Kt), o = JSON.stringify(s);
3479
3482
  return t.type === "image" ? this._copyImageToClipboard(t, o) : this._copyTextToClipboard(o);
3480
3483
  } catch (s) {
3481
3484
  return e.emitError({
@@ -3516,7 +3519,7 @@ class Js {
3516
3519
  _copyTextToClipboard(t) {
3517
3520
  return _(this, null, function* () {
3518
3521
  try {
3519
- const e = `${He}${t}`;
3522
+ const e = `${Ke}${t}`;
3520
3523
  return yield navigator.clipboard.writeText(e), console.info("Text copied to clipboard successfully"), !0;
3521
3524
  } catch (e) {
3522
3525
  const { errorManager: s } = this.editor;
@@ -3536,7 +3539,7 @@ class Js {
3536
3539
  */
3537
3540
  _addClonedObjectToCanvas(t) {
3538
3541
  const { canvas: e, historyManager: s } = this.editor;
3539
- if (e.discardActiveObject(), t instanceof k) {
3542
+ if (e.discardActiveObject(), t instanceof x) {
3540
3543
  s.suspendHistory(), t.canvas = e, t.forEachObject((o) => {
3541
3544
  e.add(o);
3542
3545
  }), e.setActiveObject(t), e.requestRenderAll(), s.resumeHistory(), s.saveState();
@@ -3569,8 +3572,8 @@ class Js {
3569
3572
  const { canvas: e } = this.editor, s = t || e.getActiveObject();
3570
3573
  if (!s || s.locked) return !1;
3571
3574
  try {
3572
- const o = yield s.clone(Gt);
3573
- return o instanceof k && o.forEachObject((n) => {
3575
+ const o = yield s.clone(Kt);
3576
+ return o instanceof x && o.forEachObject((n) => {
3574
3577
  n.set({
3575
3578
  id: `${n.type}-${Y()}`,
3576
3579
  evented: !0
@@ -3607,7 +3610,7 @@ class Js {
3607
3610
  return;
3608
3611
  }
3609
3612
  const s = t.getData("text/plain");
3610
- if (s && s.startsWith(He)) {
3613
+ if (s && s.startsWith(Ke)) {
3611
3614
  this.paste();
3612
3615
  return;
3613
3616
  }
@@ -3655,8 +3658,8 @@ class Js {
3655
3658
  const { canvas: t } = this.editor;
3656
3659
  if (!this.clipboard) return !1;
3657
3660
  try {
3658
- const e = yield this.clipboard.clone(Gt);
3659
- return t.discardActiveObject(), e instanceof k && e.forEachObject((s) => {
3661
+ const e = yield this.clipboard.clone(Kt);
3662
+ return t.discardActiveObject(), e instanceof x && e.forEachObject((s) => {
3660
3663
  s.set({
3661
3664
  id: `${s.type}-${Y()}`,
3662
3665
  evented: !0
@@ -3680,7 +3683,7 @@ class Js {
3680
3683
  });
3681
3684
  }
3682
3685
  }
3683
- class $t {
3686
+ class ee {
3684
3687
  constructor({ editor: t }) {
3685
3688
  this.editor = t;
3686
3689
  }
@@ -3706,7 +3709,7 @@ class $t {
3706
3709
  editable: !1,
3707
3710
  locked: !0
3708
3711
  };
3709
- i.set(a), !e && $t._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
3712
+ i.set(a), !e && ee._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
3710
3713
  c.set(a);
3711
3714
  }), o.renderAll(), s || n.saveState(), o.fire("editor:object-locked", {
3712
3715
  object: i,
@@ -3735,7 +3738,7 @@ class $t {
3735
3738
  editable: !0,
3736
3739
  locked: !1
3737
3740
  };
3738
- n.set(i), $t._isGroupOrSelection(n) && n.getObjects().forEach((a) => {
3741
+ n.set(i), ee._isGroupOrSelection(n) && n.getObjects().forEach((a) => {
3739
3742
  a.set(i);
3740
3743
  }), s.renderAll(), e || o.saveState(), s.fire("editor:object-unlocked", {
3741
3744
  object: n,
@@ -3743,10 +3746,10 @@ class $t {
3743
3746
  });
3744
3747
  }
3745
3748
  static _isGroupOrSelection(t) {
3746
- return t instanceof k || t instanceof wt;
3749
+ return t instanceof x || t instanceof Ct;
3747
3750
  }
3748
3751
  }
3749
- class to {
3752
+ class no {
3750
3753
  constructor({ editor: t }) {
3751
3754
  this.editor = t;
3752
3755
  }
@@ -3758,7 +3761,7 @@ class to {
3758
3761
  if (Array.isArray(t))
3759
3762
  return t.length > 0 ? t : null;
3760
3763
  const e = t || this.editor.canvas.getActiveObject();
3761
- return !e || !(e instanceof k) ? null : e.getObjects();
3764
+ return !e || !(e instanceof x) ? null : e.getObjects();
3762
3765
  }
3763
3766
  /**
3764
3767
  * Получить группы для разгруппировки
@@ -3766,20 +3769,20 @@ class to {
3766
3769
  */
3767
3770
  _getGroupsToUngroup(t) {
3768
3771
  if (Array.isArray(t)) {
3769
- const s = t.filter((o) => o instanceof wt);
3772
+ const s = t.filter((o) => o instanceof Ct);
3770
3773
  return s.length > 0 ? s : null;
3771
3774
  }
3772
- if (t instanceof k) {
3773
- const s = t.getObjects().filter((o) => o instanceof wt);
3775
+ if (t instanceof x) {
3776
+ const s = t.getObjects().filter((o) => o instanceof Ct);
3774
3777
  return s.length > 0 ? s : null;
3775
3778
  }
3776
3779
  const e = t || this.editor.canvas.getActiveObject();
3777
3780
  if (!e) return null;
3778
- if (e instanceof k) {
3779
- const s = e.getObjects().filter((o) => o instanceof wt);
3781
+ if (e instanceof x) {
3782
+ const s = e.getObjects().filter((o) => o instanceof Ct);
3780
3783
  return s.length > 0 ? s : null;
3781
3784
  }
3782
- return e instanceof wt ? [e] : null;
3785
+ return e instanceof Ct ? [e] : null;
3783
3786
  }
3784
3787
  /**
3785
3788
  * Группировка объектов
@@ -3796,7 +3799,7 @@ class to {
3796
3799
  if (!n) return null;
3797
3800
  try {
3798
3801
  o.suspendHistory();
3799
- const i = new wt(n, {
3802
+ const i = new Ct(n, {
3800
3803
  id: `group-${Y()}`
3801
3804
  });
3802
3805
  n.forEach((r) => s.remove(r)), s.add(i), s.setActiveObject(i), s.requestRenderAll();
@@ -3832,7 +3835,7 @@ class to {
3832
3835
  s.add(l), i.push(l);
3833
3836
  });
3834
3837
  });
3835
- const a = new k(i, {
3838
+ const a = new x(i, {
3836
3839
  canvas: s
3837
3840
  });
3838
3841
  s.setActiveObject(a), s.requestRenderAll();
@@ -3847,7 +3850,7 @@ class to {
3847
3850
  }
3848
3851
  }
3849
3852
  }
3850
- class eo {
3853
+ class io {
3851
3854
  constructor({ editor: t }) {
3852
3855
  this.editor = t;
3853
3856
  }
@@ -3858,7 +3861,7 @@ class eo {
3858
3861
  selectAll() {
3859
3862
  const { canvas: t, canvasManager: e, objectLockManager: s } = this.editor;
3860
3863
  t.discardActiveObject();
3861
- const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new k(e.getObjects(), { canvas: t }) : o[0];
3864
+ const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new x(e.getObjects(), { canvas: t }) : o[0];
3862
3865
  n && s.lockObject({ object: i, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(i), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: i });
3863
3866
  }
3864
3867
  }
@@ -3924,7 +3927,7 @@ class Me {
3924
3927
  return o.fire("editor:objects-deleted", c), c;
3925
3928
  }
3926
3929
  }
3927
- const gt = {
3930
+ const ft = {
3928
3931
  IMAGE_MANAGER: {
3929
3932
  /**
3930
3933
  * Некорректный Content-Type изображения
@@ -4029,7 +4032,7 @@ const gt = {
4029
4032
  APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
4030
4033
  }
4031
4034
  };
4032
- class zt {
4035
+ class Ut {
4033
4036
  constructor({ editor: t }) {
4034
4037
  this._buffer = [], this.editor = t;
4035
4038
  }
@@ -4056,7 +4059,7 @@ class zt {
4056
4059
  * @fires editor:error
4057
4060
  */
4058
4061
  emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, data: o, message: n }) {
4059
- if (!zt.isValidErrorCode(s)) {
4062
+ if (!Ut.isValidErrorCode(s)) {
4060
4063
  console.warn("Неизвестный код ошибки: ", { code: s, origin: t, method: e });
4061
4064
  return;
4062
4065
  }
@@ -4070,7 +4073,7 @@ class zt {
4070
4073
  message: i,
4071
4074
  data: o
4072
4075
  };
4073
- this._buffer.push(B({
4076
+ this._buffer.push(k({
4074
4077
  type: "editor:error"
4075
4078
  }, a)), this.editor.canvas.fire("editor:error", a);
4076
4079
  }
@@ -4085,7 +4088,7 @@ class zt {
4085
4088
  * @fires editor:warning
4086
4089
  */
4087
4090
  emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, message: o, data: n }) {
4088
- if (!zt.isValidErrorCode(s)) {
4091
+ if (!Ut.isValidErrorCode(s)) {
4089
4092
  console.warn("Неизвестный код предупреждения: ", { code: s, origin: t, method: e });
4090
4093
  return;
4091
4094
  }
@@ -4098,7 +4101,7 @@ class zt {
4098
4101
  message: i,
4099
4102
  data: n
4100
4103
  };
4101
- this._buffer.push(B({
4104
+ this._buffer.push(k({
4102
4105
  type: "editor:warning"
4103
4106
  }, a)), this.editor.canvas.fire("editor:warning", a);
4104
4107
  }
@@ -4108,10 +4111,10 @@ class zt {
4108
4111
  * @returns true, если код допустим, иначе false
4109
4112
  */
4110
4113
  static isValidErrorCode(t) {
4111
- return t ? Object.values(gt).some((e) => Object.values(e).includes(t)) : !1;
4114
+ return t ? Object.values(ft).some((e) => Object.values(e).includes(t)) : !1;
4112
4115
  }
4113
4116
  }
4114
- class so {
4117
+ class ao {
4115
4118
  constructor({ editor: t }) {
4116
4119
  this.currentBounds = null, this.editor = t;
4117
4120
  }
@@ -4200,10 +4203,16 @@ const nt = ({
4200
4203
  value: h,
4201
4204
  min: t,
4202
4205
  max: e
4203
- }) => Math.min(Math.max(h, t), e), jt = class jt extends st {
4206
+ }) => Math.min(Math.max(h, t), e), Ot = class Ot extends st {
4204
4207
  constructor(t, e = {}) {
4205
4208
  var s, o, n, i, a, r, c, d, l;
4206
- super(t, e), this.backgroundOpacity = (s = e.backgroundOpacity) != null ? s : 1, this.paddingTop = (o = e.paddingTop) != null ? o : 0, this.paddingRight = (n = e.paddingRight) != null ? n : 0, this.paddingBottom = (i = e.paddingBottom) != null ? i : 0, this.paddingLeft = (a = e.paddingLeft) != null ? a : 0, this.radiusTopLeft = (r = e.radiusTopLeft) != null ? r : 0, this.radiusTopRight = (c = e.radiusTopRight) != null ? c : 0, this.radiusBottomRight = (d = e.radiusBottomRight) != null ? d : 0, this.radiusBottomLeft = (l = e.radiusBottomLeft) != null ? l : 0;
4209
+ super(t, e), this.backgroundOpacity = (s = e.backgroundOpacity) != null ? s : 1, this.paddingTop = (o = e.paddingTop) != null ? o : 0, this.paddingRight = (n = e.paddingRight) != null ? n : 0, this.paddingBottom = (i = e.paddingBottom) != null ? i : 0, this.paddingLeft = (a = e.paddingLeft) != null ? a : 0, this.radiusTopLeft = (r = e.radiusTopLeft) != null ? r : 0, this.radiusTopRight = (c = e.radiusTopRight) != null ? c : 0, this.radiusBottomRight = (d = e.radiusBottomRight) != null ? d : 0, this.radiusBottomLeft = (l = e.radiusBottomLeft) != null ? l : 0, this._roundDimensions();
4210
+ }
4211
+ /**
4212
+ * Пересчитывает размеры текста и округляет их до целых значений.
4213
+ */
4214
+ initDimensions() {
4215
+ super.initDimensions(), this._roundDimensions();
4207
4216
  }
4208
4217
  _getLeftOffset() {
4209
4218
  const { width: t } = this._getBackgroundDimensions(), { left: e } = this._getPadding();
@@ -4215,11 +4224,11 @@ const nt = ({
4215
4224
  }
4216
4225
  _getNonTransformedDimensions() {
4217
4226
  const { width: t, height: e } = this._getBackgroundDimensions();
4218
- return new $(t, e).scalarAdd(this.strokeWidth);
4227
+ return new J(t, e).scalarAdd(this.strokeWidth);
4219
4228
  }
4220
4229
  _getTransformedDimensions(t = {}) {
4221
4230
  const { width: e, height: s } = this._getBackgroundDimensions();
4222
- return super._getTransformedDimensions(bt(B({}, t), {
4231
+ return super._getTransformedDimensions(jt(k({}, t), {
4223
4232
  width: e,
4224
4233
  height: s
4225
4234
  }));
@@ -4229,7 +4238,7 @@ const nt = ({
4229
4238
  */
4230
4239
  toObject(t = []) {
4231
4240
  const e = super.toObject(t);
4232
- return bt(B({}, e), {
4241
+ return jt(k({}, e), {
4233
4242
  backgroundOpacity: this.backgroundOpacity,
4234
4243
  paddingTop: this.paddingTop,
4235
4244
  paddingRight: this.paddingRight,
@@ -4246,7 +4255,7 @@ const nt = ({
4246
4255
  const e = this._getEffectiveBackgroundFill();
4247
4256
  if (e && e) {
4248
4257
  const n = this._getPadding(), i = (s = this.width) != null ? s : 0, a = (o = this.height) != null ? o : 0, r = i + n.left + n.right, c = a + n.top + n.bottom, d = this._getCornerRadii({ width: r, height: c }), l = this._getLeftOffset() - n.left, u = this._getTopOffset() - n.top;
4249
- t.save(), jt._renderRoundedRect({
4258
+ t.save(), Ot._renderRoundedRect({
4250
4259
  ctx: t,
4251
4260
  height: c,
4252
4261
  left: l,
@@ -4290,9 +4299,9 @@ const nt = ({
4290
4299
  const e = nt({ value: (o = this.backgroundOpacity) != null ? o : 1, min: 0, max: 1 });
4291
4300
  let s;
4292
4301
  try {
4293
- s = new fs(t);
4302
+ s = new vs(t);
4294
4303
  } catch (n) {
4295
- return zt.emitError({
4304
+ return Ut.emitError({
4296
4305
  origin: "BackgroundTextbox",
4297
4306
  method: "_getEffectiveBackgroundFill",
4298
4307
  code: "INVALID_COLOR_VALUE",
@@ -4318,8 +4327,18 @@ const nt = ({
4318
4327
  } = o, g = nt({ value: c, min: 0, max: i }), f = nt({ value: d, min: 0, max: i }), p = nt({ value: l, min: 0, max: i }), m = nt({ value: u, min: 0, max: i });
4319
4328
  t.beginPath(), t.moveTo(s + g, n), t.lineTo(a - f, n), t.quadraticCurveTo(a, n, a, n + f), t.lineTo(a, r - p), t.quadraticCurveTo(a, r, a - p, r), t.lineTo(s + m, r), t.quadraticCurveTo(s, r, s, r - m), t.lineTo(s, n + g), t.quadraticCurveTo(s, n, s + g, n), t.closePath();
4320
4329
  }
4330
+ /**
4331
+ * Округляет текущие значения ширины и высоты до ближайших целых.
4332
+ */
4333
+ _roundDimensions() {
4334
+ const {
4335
+ width: t = 0,
4336
+ height: e = 0
4337
+ } = this, s = Math.round(t), o = Math.round(e);
4338
+ s !== t && (this.width = Math.max(0, s)), o !== e && (this.height = Math.max(0, o));
4339
+ }
4321
4340
  };
4322
- jt.type = "background-textbox", jt.cacheProperties = [
4341
+ Ot.type = "background-textbox", Ot.cacheProperties = [
4323
4342
  ...Array.isArray(st.cacheProperties) ? st.cacheProperties : [],
4324
4343
  "backgroundColor",
4325
4344
  "backgroundOpacity",
@@ -4331,7 +4350,7 @@ jt.type = "background-textbox", jt.cacheProperties = [
4331
4350
  "radiusTopRight",
4332
4351
  "radiusBottomRight",
4333
4352
  "radiusBottomLeft"
4334
- ], jt.stateProperties = [
4353
+ ], Ot.stateProperties = [
4335
4354
  ...Array.isArray(st.stateProperties) ? st.stateProperties : [],
4336
4355
  "backgroundColor",
4337
4356
  "backgroundOpacity",
@@ -4344,11 +4363,11 @@ jt.type = "background-textbox", jt.cacheProperties = [
4344
4363
  "radiusBottomRight",
4345
4364
  "radiusBottomLeft"
4346
4365
  ];
4347
- let Jt = jt;
4348
- const oo = () => {
4366
+ let se = Ot;
4367
+ const ro = () => {
4349
4368
  var h;
4350
- (h = xe) != null && h.setClass && xe.setClass(Jt, "background-textbox");
4351
- }, no = ({ textbox: h }) => {
4369
+ (h = He) != null && h.setClass && He.setClass(se, "background-textbox");
4370
+ }, co = ({ textbox: h }) => {
4352
4371
  var s, o;
4353
4372
  if (!h.isEditing) return null;
4354
4373
  const t = (s = h.selectionStart) != null ? s : 0, e = (o = h.selectionEnd) != null ? o : t;
@@ -4356,11 +4375,11 @@ const oo = () => {
4356
4375
  start: Math.min(t, e),
4357
4376
  end: Math.max(t, e)
4358
4377
  };
4359
- }, io = ({ textbox: h }) => {
4378
+ }, lo = ({ textbox: h }) => {
4360
4379
  var e, s;
4361
4380
  const t = (s = (e = h.text) == null ? void 0 : e.length) != null ? s : 0;
4362
4381
  return t <= 0 ? null : { start: 0, end: t };
4363
- }, ao = ({ textbox: h, range: t }) => {
4382
+ }, ho = ({ textbox: h, range: t }) => {
4364
4383
  var s, o;
4365
4384
  if (!t) return !1;
4366
4385
  const e = (o = (s = h.text) == null ? void 0 : s.length) != null ? o : 0;
@@ -4373,7 +4392,7 @@ const oo = () => {
4373
4392
  if (!t || !Object.keys(t).length) return !1;
4374
4393
  const { start: s, end: o } = e;
4375
4394
  return o <= s ? !1 : (h.setSelectionStyles(t, s, o), !0);
4376
- }, Ze = ({
4395
+ }, qe = ({
4377
4396
  textbox: h,
4378
4397
  range: t,
4379
4398
  property: e
@@ -4387,42 +4406,57 @@ const oo = () => {
4387
4406
  );
4388
4407
  if (s.length)
4389
4408
  return (o = s[0]) == null ? void 0 : o[e];
4390
- }, Ge = ({ strokeColor: h, width: t }) => {
4409
+ }, $e = ({ strokeColor: h, width: t }) => {
4391
4410
  if (!(t <= 0))
4392
4411
  return h != null ? h : "#000000";
4393
- }, Ve = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, ne = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", J = 0.01;
4394
- class q {
4412
+ }, Je = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, ne = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", it = 0.01;
4413
+ class G {
4395
4414
  constructor({ editor: t }) {
4396
4415
  var e;
4397
4416
  this._handleTextEditingEntered = () => {
4398
4417
  this.isTextEditingActive = !0;
4418
+ }, this._handleTextChanged = (s) => {
4419
+ const { target: o } = s;
4420
+ if (!G._isTextbox(o)) return;
4421
+ const { text: n = "", uppercase: i } = o, a = !!i, r = n.toLocaleLowerCase();
4422
+ if (a) {
4423
+ const d = ne({ value: r });
4424
+ d !== n && o.set({ text: d }), o.textCaseRaw = r;
4425
+ } else
4426
+ o.textCaseRaw = n;
4427
+ G._roundTextboxDimensions({ textbox: o }) && (o.setCoords(), o.dirty = !0);
4399
4428
  }, this._handleTextEditingExited = (s) => {
4400
- var a, r;
4429
+ var r, c;
4401
4430
  const { target: o } = s;
4402
- if (!q._isTextbox(o)) return;
4403
- const n = (a = o.text) != null ? a : "";
4431
+ if (!G._isTextbox(o)) return;
4432
+ const n = (r = o.text) != null ? r : "";
4404
4433
  if (!!o.uppercase) {
4405
- const c = (r = o.textCaseRaw) != null ? r : n.toLocaleLowerCase();
4406
- o.textCaseRaw = c;
4434
+ const d = (c = o.textCaseRaw) != null ? c : n.toLocaleLowerCase();
4435
+ o.textCaseRaw = d;
4407
4436
  } else
4408
4437
  o.textCaseRaw = n;
4409
- o.locked || o.set({
4438
+ G._roundTextboxDimensions({ textbox: o }) && (o.setCoords(), o.dirty = !0, this.canvas.requestRenderAll()), o.locked || o.set({
4410
4439
  lockMovementX: !1,
4411
4440
  lockMovementY: !1
4412
4441
  }), setTimeout(() => {
4413
4442
  this.isTextEditingActive = !1, this.editor.historyManager.saveState();
4414
- }, Zs);
4443
+ }, Ks);
4415
4444
  }, this._handleObjectScaling = (s) => {
4416
- var Nt, W, yt, Yt, ht, Ft, vt, Se, Ae, je, Ie, Ce, Te;
4445
+ var W, Mt, Ht, ut, Wt, wt, je, Ie, Ce, Te, Ee, Oe, De, Le, Re;
4417
4446
  const { target: o, transform: n } = s;
4418
- if (o instanceof k) {
4419
- this._handleActiveSelectionScaling({
4420
- selection: o,
4421
- transform: n
4422
- });
4447
+ if (o instanceof x) {
4448
+ if (!((Mt = (W = o.getObjects) == null ? void 0 : W.call(o)) != null ? Mt : []).some((At) => G._isTextbox(At))) return;
4449
+ const {
4450
+ corner: Gt = "",
4451
+ action: St = ""
4452
+ } = n != null ? n : {};
4453
+ if (!(["ml", "mr", "tl", "tr", "bl", "br"].includes(Gt) || St === "scaleX" || St === "scale") || !n) return;
4454
+ o.set({
4455
+ scaleX: 1
4456
+ }), n.scaleX = 1, n.original && (n.original.scaleX = 1), o.setCoords(), this.canvas.requestRenderAll();
4423
4457
  return;
4424
4458
  }
4425
- if (!q._isTextbox(o) || !n) return;
4459
+ if (!G._isTextbox(o) || !n) return;
4426
4460
  o.isScaling = !0;
4427
4461
  const i = this._ensureScalingState(o), {
4428
4462
  baseWidth: a,
@@ -4431,88 +4465,84 @@ class q {
4431
4465
  basePadding: d,
4432
4466
  baseRadii: l,
4433
4467
  baseStyles: u
4434
- } = i, g = typeof ((Nt = n.original) == null ? void 0 : Nt.width) == "number" ? n.original.width : void 0, f = typeof ((W = n.original) == null ? void 0 : W.left) == "number" ? n.original.left : void 0, p = g != null ? g : a, m = f != null ? f : r, v = (yt = n.corner) != null ? yt : "", b = (Yt = n.action) != null ? Yt : "", I = ["ml", "mr"].includes(v) || b === "scaleX", y = ["mt", "mb"].includes(v) || b === "scaleY", w = ["tl", "tr", "bl", "br"].includes(v) || b === "scale", S = w || y;
4468
+ } = i, g = typeof ((Ht = n.original) == null ? void 0 : Ht.width) == "number" ? n.original.width : void 0, f = typeof ((ut = n.original) == null ? void 0 : ut.left) == "number" ? n.original.left : void 0, p = g != null ? g : a, m = f != null ? f : r, v = (Wt = n.corner) != null ? Wt : "", b = (wt = n.action) != null ? wt : "", I = ["ml", "mr"].includes(v) || b === "scaleX", y = ["mt", "mb"].includes(v) || b === "scaleY", w = ["tl", "tr", "bl", "br"].includes(v) || b === "scale", S = w || y;
4435
4469
  if (!I && !y && !w) return;
4436
- const A = Math.abs((Ft = (ht = o.scaleX) != null ? ht : n.scaleX) != null ? Ft : 1) || 1, M = Math.abs((Se = (vt = o.scaleY) != null ? vt : n.scaleY) != null ? Se : 1) || 1, C = Math.max(1, p * A), j = Math.max(1, c * M), {
4437
- paddingTop: T = 0,
4438
- paddingRight: x = 0,
4439
- paddingBottom: Z = 0,
4440
- paddingLeft: U = 0,
4441
- radiusTopLeft: F = 0,
4442
- radiusTopRight: K = 0,
4443
- radiusBottomRight: L = 0,
4444
- radiusBottomLeft: R = 0,
4445
- fontSize: X,
4446
- width: H,
4447
- originX: G = "left"
4448
- } = o, V = w || y, et = w || y, z = V ? {
4470
+ const A = Math.abs((Ie = (je = o.scaleX) != null ? je : n.scaleX) != null ? Ie : 1) || 1, M = Math.abs((Te = (Ce = o.scaleY) != null ? Ce : n.scaleY) != null ? Te : 1) || 1, C = Math.max(1, p * A), j = Math.max(1, Math.round(C)), T = Math.max(1, c * M), {
4471
+ paddingTop: B = 0,
4472
+ paddingRight: Z = 0,
4473
+ paddingBottom: U = 0,
4474
+ paddingLeft: F = 0,
4475
+ radiusTopLeft: V = 0,
4476
+ radiusTopRight: D = 0,
4477
+ radiusBottomRight: R = 0,
4478
+ radiusBottomLeft: K = 0,
4479
+ fontSize: H,
4480
+ width: z,
4481
+ originX: X = "left"
4482
+ } = o, et = w || y, q = w || y, P = et ? {
4449
4483
  top: Math.max(0, d.top * M),
4450
4484
  right: Math.max(0, d.right * M),
4451
4485
  bottom: Math.max(0, d.bottom * M),
4452
4486
  left: Math.max(0, d.left * M)
4453
- } : d, P = et ? {
4487
+ } : d, Q = q ? {
4454
4488
  topLeft: Math.max(0, l.topLeft * M),
4455
4489
  topRight: Math.max(0, l.topRight * M),
4456
4490
  bottomRight: Math.max(0, l.bottomRight * M),
4457
4491
  bottomLeft: Math.max(0, l.bottomLeft * M)
4458
- } : l, Pt = Object.keys(u).length > 0;
4459
- let mt;
4460
- if (S && Pt) {
4461
- const ee = {};
4462
- Object.entries(u).forEach(([is, Ee]) => {
4463
- if (!Ee) return;
4464
- const se = {};
4465
- Object.entries(Ee).forEach(([as, Ht]) => {
4466
- if (!Ht) return;
4467
- const Oe = B({}, Ht);
4468
- typeof Ht.fontSize == "number" && (Oe.fontSize = Math.max(1, Ht.fontSize * M)), se[as] = Oe;
4469
- }), Object.keys(se).length && (ee[is] = se);
4470
- }), Object.keys(ee).length && (mt = ee);
4492
+ } : l, Yt = Object.keys(u).length > 0;
4493
+ let yt;
4494
+ if (S && Yt) {
4495
+ const Zt = {};
4496
+ Object.entries(u).forEach(([_e, Gt]) => {
4497
+ if (!Gt) return;
4498
+ const St = {};
4499
+ Object.entries(Gt).forEach(([Ne, At]) => {
4500
+ if (!At) return;
4501
+ const xe = k({}, At);
4502
+ typeof At.fontSize == "number" && (xe.fontSize = Math.max(1, At.fontSize * M)), St[Ne] = xe;
4503
+ }), Object.keys(St).length && (Zt[_e] = St);
4504
+ }), Object.keys(Zt).length && (yt = Zt);
4471
4505
  }
4472
- const Tt = (je = (Ae = n.originX) != null ? Ae : G) != null ? je : "left", Et = m + p, Ot = m + p / 2, te = H != null ? H : p, Lt = Math.abs(C - te) > J, Ut = Math.abs(j - (X != null ? X : c)) > J, Dt = Math.abs(z.top - T) > J || Math.abs(z.right - x) > J || Math.abs(z.bottom - Z) > J || Math.abs(z.left - U) > J, Rt = Math.abs(P.topLeft - F) > J || Math.abs(P.topRight - K) > J || Math.abs(P.bottomRight - L) > J || Math.abs(P.bottomLeft - R) > J;
4473
- if (!Lt && !Ut && !Dt && !Rt) {
4506
+ const vt = (Oe = (Ee = n.originX) != null ? Ee : X) != null ? Oe : "left", Rt = m + p, Se = m + p / 2, bt = z != null ? z : p, Ae = j !== bt, Ft = Math.abs(T - (H != null ? H : c)) > it, _t = Math.abs(P.top - B) > it || Math.abs(P.right - Z) > it || Math.abs(P.bottom - U) > it || Math.abs(P.left - F) > it, Nt = Math.abs(Q.topLeft - V) > it || Math.abs(Q.topRight - D) > it || Math.abs(Q.bottomRight - R) > it || Math.abs(Q.bottomLeft - K) > it;
4507
+ if (!Ae && !Ft && !_t && !Nt) {
4474
4508
  o.set({ scaleX: 1, scaleY: 1 }), n.scaleX = 1, n.scaleY = 1;
4475
4509
  return;
4476
4510
  }
4477
- mt && (o.styles = mt), o.set({
4478
- width: C,
4479
- fontSize: S ? j : c,
4480
- paddingTop: z.top,
4481
- paddingRight: z.right,
4482
- paddingBottom: z.bottom,
4483
- paddingLeft: z.left,
4484
- radiusTopLeft: P.topLeft,
4485
- radiusTopRight: P.topRight,
4486
- radiusBottomRight: P.bottomRight,
4487
- radiusBottomLeft: P.bottomLeft,
4511
+ yt && (o.styles = yt), o.set({
4512
+ width: j,
4513
+ fontSize: S ? T : c,
4514
+ paddingTop: P.top,
4515
+ paddingRight: P.right,
4516
+ paddingBottom: P.bottom,
4517
+ paddingLeft: P.left,
4518
+ radiusTopLeft: Q.topLeft,
4519
+ radiusTopRight: Q.topRight,
4520
+ radiusBottomRight: Q.bottomRight,
4521
+ radiusBottomLeft: Q.bottomLeft,
4488
4522
  scaleX: 1,
4489
4523
  scaleY: 1
4490
4524
  });
4491
- const ct = (Ie = o.width) != null ? Ie : C, _t = Math.abs(ct - te) > J;
4492
- let dt = m;
4493
- _t && (I || w) && (Tt === "right" ? dt = Et - ct : Tt === "center" && (dt = Ot - ct / 2)), o.set({ left: dt }), i.baseLeft = dt, n.scaleX = 1, n.scaleY = 1;
4525
+ const xt = G._roundTextboxDimensions({ textbox: o });
4526
+ xt && (o.dirty = !0);
4527
+ const dt = (De = o.width) != null ? De : j, kt = dt !== bt;
4528
+ let lt = m;
4529
+ kt && (I || w) && (vt === "right" ? lt = Rt - dt : vt === "center" && (lt = Se - dt / 2)), o.set({ left: lt }), i.baseLeft = lt, n.scaleX = 1, n.scaleY = 1;
4494
4530
  const { original: ot } = n;
4495
- ot && (ot.scaleX = 1, ot.scaleY = 1, ot.width = ct, ot.height = o.height, ot.left = dt), o.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = ct, i.baseFontSize = (Ce = o.fontSize) != null ? Ce : j, i.baseStyles = JSON.parse(JSON.stringify((Te = o.styles) != null ? Te : {})), i.basePadding = {
4496
- top: z.top,
4497
- right: z.right,
4498
- bottom: z.bottom,
4499
- left: z.left
4531
+ ot && (ot.scaleX = 1, ot.scaleY = 1, ot.width = dt, ot.height = o.height, ot.left = lt), o.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = dt, i.baseFontSize = (Le = o.fontSize) != null ? Le : T, i.baseStyles = JSON.parse(JSON.stringify((Re = o.styles) != null ? Re : {})), i.basePadding = {
4532
+ top: P.top,
4533
+ right: P.right,
4534
+ bottom: P.bottom,
4535
+ left: P.left
4500
4536
  }, i.baseRadii = {
4501
- topLeft: P.topLeft,
4502
- topRight: P.topRight,
4503
- bottomRight: P.bottomRight,
4504
- bottomLeft: P.bottomLeft
4505
- }, i.hasWidthChange = _t || Ut || Dt || Rt;
4537
+ topLeft: Q.topLeft,
4538
+ topRight: Q.topRight,
4539
+ bottomRight: Q.bottomRight,
4540
+ bottomLeft: Q.bottomLeft
4541
+ }, i.hasWidthChange = kt || Ft || _t || Nt || xt;
4506
4542
  }, this._handleObjectModified = (s) => {
4507
4543
  var b, I, y;
4508
4544
  const { target: o } = s;
4509
- if (o instanceof k) {
4510
- this._finalizeActiveSelectionScaling({
4511
- selection: o
4512
- });
4513
- return;
4514
- }
4515
- if (!q._isTextbox(o)) return;
4545
+ if (o instanceof x || !G._isTextbox(o)) return;
4516
4546
  o.isScaling = !1;
4517
4547
  const n = this.scalingState.get(o);
4518
4548
  if (this.scalingState.delete(o), !(n != null && n.hasWidthChange)) return;
@@ -4540,14 +4570,14 @@ class q {
4540
4570
  target: o,
4541
4571
  style: v
4542
4572
  }), o.set({ scaleX: 1, scaleY: 1 }), o.setCoords();
4543
- }, this.editor = t, this.canvas = t.canvas, this.fonts = (e = t.options.fonts) != null ? e : [], this.scalingState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(), oo();
4573
+ }, this.editor = t, this.canvas = t.canvas, this.fonts = (e = t.options.fonts) != null ? e : [], this.scalingState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(), ro();
4544
4574
  }
4545
4575
  /**
4546
4576
  * Добавляет новый текстовый объект на канвас.
4547
4577
  * @param options — настройки текста
4548
4578
  * @param flags — флаги поведения
4549
4579
  */
4550
- addText(Z = {}, { withoutSelection: j = !1, withoutSave: T = !1, withoutAdding: x = !1 } = {}) {
4580
+ addText(Z = {}, { withoutSelection: j = !1, withoutSave: T = !1, withoutAdding: B = !1 } = {}) {
4551
4581
  var U = Z, {
4552
4582
  id: t = `text-${Y()}`,
4553
4583
  text: e = "Новый текст",
@@ -4573,7 +4603,7 @@ class q {
4573
4603
  radiusTopRight: S = 0,
4574
4604
  radiusBottomRight: A = 0,
4575
4605
  radiusBottomLeft: M = 0
4576
- } = U, C = ut(U, [
4606
+ } = U, C = gt(U, [
4577
4607
  "id",
4578
4608
  "text",
4579
4609
  "fontFamily",
@@ -4599,15 +4629,15 @@ class q {
4599
4629
  "radiusBottomRight",
4600
4630
  "radiusBottomLeft"
4601
4631
  ]);
4602
- var V;
4603
- const { historyManager: F } = this.editor, { canvas: K } = this;
4632
+ var et;
4633
+ const { historyManager: F } = this.editor, { canvas: V } = this;
4604
4634
  F.suspendHistory();
4605
- const L = s != null ? s : this._getDefaultFontFamily(), R = Ve({ width: g }), X = Ge({
4635
+ const D = s != null ? s : this._getDefaultFontFamily(), R = Je({ width: g }), K = $e({
4606
4636
  strokeColor: u,
4607
4637
  width: R
4608
- }), H = B({
4638
+ }), H = k({
4609
4639
  id: t,
4610
- fontFamily: L,
4640
+ fontFamily: D,
4611
4641
  fontSize: o,
4612
4642
  fontWeight: n ? "bold" : "normal",
4613
4643
  fontStyle: i ? "italic" : "normal",
@@ -4616,7 +4646,7 @@ class q {
4616
4646
  linethrough: c,
4617
4647
  textAlign: d,
4618
4648
  fill: l,
4619
- stroke: X,
4649
+ stroke: K,
4620
4650
  strokeWidth: R,
4621
4651
  strokeUniform: !0,
4622
4652
  opacity: f,
@@ -4630,29 +4660,29 @@ class q {
4630
4660
  radiusTopRight: S,
4631
4661
  radiusBottomRight: A,
4632
4662
  radiusBottomLeft: M
4633
- }, C), G = new Jt(e, H);
4634
- if (G.textCaseRaw = (V = G.text) != null ? V : "", r) {
4635
- const et = ne({ value: G.textCaseRaw });
4636
- et !== G.text && G.set({ text: et });
4637
- }
4638
- return C.left === void 0 && C.top === void 0 && K.centerObject(G), x || K.add(G), j || K.setActiveObject(G), K.requestRenderAll(), F.resumeHistory(), T || F.saveState(), K.fire("editor:text-added", {
4639
- textbox: G,
4640
- options: bt(B({}, H), {
4663
+ }, C), z = new se(e, H);
4664
+ if (z.textCaseRaw = (et = z.text) != null ? et : "", r) {
4665
+ const q = ne({ value: z.textCaseRaw });
4666
+ q !== z.text && z.set({ text: q });
4667
+ }
4668
+ return G._roundTextboxDimensions({ textbox: z }) && (z.dirty = !0), C.left === void 0 && C.top === void 0 && V.centerObject(z), B || V.add(z), j || V.setActiveObject(z), V.requestRenderAll(), F.resumeHistory(), T || F.saveState(), V.fire("editor:text-added", {
4669
+ textbox: z,
4670
+ options: jt(k({}, H), {
4641
4671
  text: e,
4642
4672
  bold: n,
4643
4673
  italic: i,
4644
4674
  strikethrough: c,
4645
4675
  align: d,
4646
4676
  color: l,
4647
- strokeColor: X,
4677
+ strokeColor: K,
4648
4678
  strokeWidth: R
4649
4679
  }),
4650
4680
  flags: {
4651
4681
  withoutSelection: !!j,
4652
4682
  withoutSave: !!T,
4653
- withoutAdding: !!x
4683
+ withoutAdding: !!B
4654
4684
  }
4655
- }), G;
4685
+ }), z;
4656
4686
  }
4657
4687
  /**
4658
4688
  * Обновляет текстовый объект.
@@ -4663,12 +4693,12 @@ class q {
4663
4693
  * @param options.skipRender — не вызывать перерисовку канваса
4664
4694
  */
4665
4695
  updateText({ target: t, style: e = {}, withoutSave: s, skipRender: o } = {}) {
4666
- var Rt, ct, _t, dt, ot, Nt;
4696
+ var Nt, xt, dt, kt, lt, ot;
4667
4697
  const n = this._resolveTextObject(t);
4668
4698
  if (!n) return null;
4669
4699
  const { historyManager: i } = this.editor, { canvas: a } = this;
4670
4700
  i.suspendHistory();
4671
- const r = q._getSnapshot(n), Dt = e, {
4701
+ const r = G._getSnapshot(n), _t = e, {
4672
4702
  text: c,
4673
4703
  fontFamily: d,
4674
4704
  fontSize: l,
@@ -4688,11 +4718,11 @@ class q {
4688
4718
  paddingRight: C,
4689
4719
  paddingBottom: j,
4690
4720
  paddingLeft: T,
4691
- radiusTopLeft: x,
4721
+ radiusTopLeft: B,
4692
4722
  radiusTopRight: Z,
4693
4723
  radiusBottomRight: U,
4694
4724
  radiusBottomLeft: F
4695
- } = Dt, K = ut(Dt, [
4725
+ } = _t, V = gt(_t, [
4696
4726
  "text",
4697
4727
  "fontFamily",
4698
4728
  "fontSize",
@@ -4716,39 +4746,39 @@ class q {
4716
4746
  "radiusTopRight",
4717
4747
  "radiusBottomRight",
4718
4748
  "radiusBottomLeft"
4719
- ]), L = B({}, K), R = no({ textbox: n }), X = R ? this._expandRangeToFullLines({ textbox: n, range: R }) : null, H = {}, G = {}, V = {}, et = ao({ textbox: n, range: R }), z = !R || et, P = !R;
4720
- if (d !== void 0 && (X && (G.fontFamily = d), z && (L.fontFamily = d, P && (V.fontFamily = d))), l !== void 0 && (X && (G.fontSize = l), z && (L.fontSize = l, P && (V.fontSize = l))), u !== void 0) {
4749
+ ]), D = k({}, V), R = co({ textbox: n }), K = R ? this._expandRangeToFullLines({ textbox: n, range: R }) : null, H = {}, z = {}, X = {}, et = ho({ textbox: n, range: R }), q = !R || et, P = !R;
4750
+ if (d !== void 0 && (K && (z.fontFamily = d), q && (D.fontFamily = d, P && (X.fontFamily = d))), l !== void 0 && (K && (z.fontSize = l), q && (D.fontSize = l, P && (X.fontSize = l))), u !== void 0) {
4721
4751
  const W = u ? "bold" : "normal";
4722
- R && (H.fontWeight = W), z && (L.fontWeight = W, P && (V.fontWeight = W));
4752
+ R && (H.fontWeight = W), q && (D.fontWeight = W, P && (X.fontWeight = W));
4723
4753
  }
4724
4754
  if (g !== void 0) {
4725
4755
  const W = g ? "italic" : "normal";
4726
- R && (H.fontStyle = W), z && (L.fontStyle = W, P && (V.fontStyle = W));
4756
+ R && (H.fontStyle = W), q && (D.fontStyle = W, P && (X.fontStyle = W));
4727
4757
  }
4728
- if (f !== void 0 && (R && (H.underline = f), z && (L.underline = f, P && (V.underline = f))), m !== void 0 && (R && (H.linethrough = m), z && (L.linethrough = m, P && (V.linethrough = m))), v !== void 0 && (L.textAlign = v), b !== void 0 && (R && (H.fill = b), z && (L.fill = b, P && (V.fill = b))), I !== void 0 || y !== void 0) {
4729
- const W = R ? Ze({ textbox: n, range: R, property: "strokeWidth" }) : void 0, yt = R ? Ze({ textbox: n, range: R, property: "stroke" }) : void 0, Yt = (ct = (Rt = y != null ? y : W) != null ? Rt : n.strokeWidth) != null ? ct : 0, ht = Ve({ width: Yt }), Ft = (dt = (_t = I != null ? I : yt) != null ? _t : n.stroke) != null ? dt : void 0, vt = Ge({
4730
- strokeColor: Ft,
4731
- width: ht
4758
+ if (f !== void 0 && (R && (H.underline = f), q && (D.underline = f, P && (X.underline = f))), m !== void 0 && (R && (H.linethrough = m), q && (D.linethrough = m, P && (X.linethrough = m))), v !== void 0 && (D.textAlign = v), b !== void 0 && (R && (H.fill = b), q && (D.fill = b, P && (X.fill = b))), I !== void 0 || y !== void 0) {
4759
+ const W = R ? qe({ textbox: n, range: R, property: "strokeWidth" }) : void 0, Mt = R ? qe({ textbox: n, range: R, property: "stroke" }) : void 0, Ht = (xt = (Nt = y != null ? y : W) != null ? Nt : n.strokeWidth) != null ? xt : 0, ut = Je({ width: Ht }), Wt = (kt = (dt = I != null ? I : Mt) != null ? dt : n.stroke) != null ? kt : void 0, wt = $e({
4760
+ strokeColor: Wt,
4761
+ width: ut
4732
4762
  });
4733
- R && (H.stroke = vt, H.strokeWidth = ht), z && (L.stroke = vt, L.strokeWidth = ht, P && (V.stroke = vt, V.strokeWidth = ht));
4734
- }
4735
- w !== void 0 && (L.opacity = w), S !== void 0 && (L.backgroundColor = S), A !== void 0 && (L.backgroundOpacity = A), M !== void 0 && (L.paddingTop = M), C !== void 0 && (L.paddingRight = C), j !== void 0 && (L.paddingBottom = j), T !== void 0 && (L.paddingLeft = T), x !== void 0 && (L.radiusTopLeft = x), Z !== void 0 && (L.radiusTopRight = Z), U !== void 0 && (L.radiusBottomRight = U), F !== void 0 && (L.radiusBottomLeft = F);
4736
- const Pt = (Nt = n.textCaseRaw) != null ? Nt : (ot = n.text) != null ? ot : "", mt = !!n.uppercase, Tt = c !== void 0, Et = Tt ? c != null ? c : "" : Pt, Ot = p != null ? p : mt;
4737
- if (Tt || Ot !== mt) {
4738
- const W = Ot ? ne({ value: Et }) : Et;
4739
- L.text = W, n.textCaseRaw = Et;
4740
- } else n.textCaseRaw === void 0 && (n.textCaseRaw = Pt);
4741
- n.uppercase = Ot, n.set(L);
4742
- let Lt = !1;
4763
+ R && (H.stroke = wt, H.strokeWidth = ut), q && (D.stroke = wt, D.strokeWidth = ut, P && (X.stroke = wt, X.strokeWidth = ut));
4764
+ }
4765
+ w !== void 0 && (D.opacity = w), S !== void 0 && (D.backgroundColor = S), A !== void 0 && (D.backgroundOpacity = A), M !== void 0 && (D.paddingTop = M), C !== void 0 && (D.paddingRight = C), j !== void 0 && (D.paddingBottom = j), T !== void 0 && (D.paddingLeft = T), B !== void 0 && (D.radiusTopLeft = B), Z !== void 0 && (D.radiusTopRight = Z), U !== void 0 && (D.radiusBottomRight = U), F !== void 0 && (D.radiusBottomLeft = F);
4766
+ const Q = (ot = n.textCaseRaw) != null ? ot : (lt = n.text) != null ? lt : "", Yt = !!n.uppercase, yt = c !== void 0, vt = yt ? c != null ? c : "" : Q, Rt = p != null ? p : Yt;
4767
+ if (yt || Rt !== Yt) {
4768
+ const W = Rt ? ne({ value: vt }) : vt;
4769
+ D.text = W, n.textCaseRaw = vt;
4770
+ } else n.textCaseRaw === void 0 && (n.textCaseRaw = Q);
4771
+ n.uppercase = Rt, n.set(D);
4772
+ let bt = !1;
4743
4773
  if (R) {
4744
- const W = oe({ textbox: n, styles: H, range: R }), yt = X ? oe({ textbox: n, styles: G, range: X }) : !1;
4745
- Lt = W || yt;
4746
- } else if (Object.keys(V).length) {
4747
- const W = io({ textbox: n });
4748
- W && (Lt = oe({ textbox: n, styles: V, range: W }));
4749
- }
4750
- Lt && (n.dirty = !0), (S !== void 0 || A !== void 0 || M !== void 0 || C !== void 0 || j !== void 0 || T !== void 0 || x !== void 0 || Z !== void 0 || U !== void 0 || F !== void 0) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4751
- const Ut = q._getSnapshot(n);
4774
+ const W = oe({ textbox: n, styles: H, range: R }), Mt = K ? oe({ textbox: n, styles: z, range: K }) : !1;
4775
+ bt = W || Mt;
4776
+ } else if (Object.keys(X).length) {
4777
+ const W = lo({ textbox: n });
4778
+ W && (bt = oe({ textbox: n, styles: X, range: W }));
4779
+ }
4780
+ bt && (n.dirty = !0), (S !== void 0 || A !== void 0 || M !== void 0 || C !== void 0 || j !== void 0 || T !== void 0 || B !== void 0 || Z !== void 0 || U !== void 0 || F !== void 0) && (n.dirty = !0), G._roundTextboxDimensions({ textbox: n }) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4781
+ const Ft = G._getSnapshot(n);
4752
4782
  return a.fire("editor:text-updated", {
4753
4783
  textbox: n,
4754
4784
  target: t,
@@ -4757,9 +4787,9 @@ class q {
4757
4787
  withoutSave: !!s,
4758
4788
  skipRender: !!o
4759
4789
  },
4760
- updates: L,
4790
+ updates: D,
4761
4791
  before: r,
4762
- after: Ut,
4792
+ after: Ft,
4763
4793
  selectionRange: R != null ? R : void 0,
4764
4794
  selectionStyles: R && Object.keys(H).length ? H : void 0
4765
4795
  }), n;
@@ -4779,10 +4809,10 @@ class q {
4779
4809
  const { canvas: e } = this;
4780
4810
  if (!t) {
4781
4811
  const s = e.getActiveObject();
4782
- return q._isTextbox(s) ? s : null;
4812
+ return G._isTextbox(s) ? s : null;
4783
4813
  }
4784
4814
  if (typeof t == "string") {
4785
- const s = e.getObjects().find((o) => q._isTextbox(o) && o.id === t);
4815
+ const s = e.getObjects().find((o) => G._isTextbox(o) && o.id === t);
4786
4816
  return s != null ? s : null;
4787
4817
  }
4788
4818
  return null;
@@ -4798,62 +4828,7 @@ class q {
4798
4828
  */
4799
4829
  _bindEvents() {
4800
4830
  const { canvas: t } = this;
4801
- t.on("object:scaling", this._handleObjectScaling), t.on("object:modified", this._handleObjectModified), t.on("text:editing:entered", this._handleTextEditingEntered), t.on("text:editing:exited", this._handleTextEditingExited), t.on("text:changed", q._handleTextChanged);
4802
- }
4803
- /**
4804
- * Реагирует на изменение текста в режиме редактирования: синхронизирует textCaseRaw и uppercase.
4805
- */
4806
- static _handleTextChanged(t) {
4807
- var i;
4808
- const { target: e } = t;
4809
- if (!q._isTextbox(e)) return;
4810
- const s = (i = e.text) != null ? i : "", o = !!e.uppercase, n = s.toLocaleLowerCase();
4811
- if (o) {
4812
- const a = ne({ value: n });
4813
- a !== s && e.set({ text: a }), e.textCaseRaw = n;
4814
- return;
4815
- }
4816
- e.textCaseRaw = s;
4817
- }
4818
- /**
4819
- * Обрабатывает горизонтальное масштабирование ActiveSelection: расширяет текстовые блоки по ширине без растяжения шрифта.
4820
- */
4821
- _handleActiveSelectionScaling({
4822
- selection: t,
4823
- transform: e
4824
- }) {
4825
- var r, c, d, l;
4826
- const s = (r = e == null ? void 0 : e.corner) != null ? r : "", o = (c = e == null ? void 0 : e.action) != null ? c : "";
4827
- if (!(["ml", "mr", "tl", "tr", "bl", "br"].includes(s) || o === "scaleX" || o === "scale")) return;
4828
- const i = Math.abs((l = (d = t.scaleX) != null ? d : e == null ? void 0 : e.scaleX) != null ? l : 1) || 1, a = i === 0 ? 1 : 1 / i;
4829
- t.getObjects().forEach((u) => {
4830
- if (!q._isTextbox(u)) return;
4831
- const g = this._ensureScalingState(u), f = Math.max(1, g.baseWidth * i);
4832
- u.set({
4833
- width: f,
4834
- scaleX: a,
4835
- scaleY: 1
4836
- }), u.setCoords(), u.dirty = !0;
4837
- }), t.setCoords(), this.canvas.requestRenderAll();
4838
- }
4839
- /**
4840
- * Завершает масштабирование ActiveSelection: фиксирует новую ширину текстовых объектов и сбрасывает компенсационный scale.
4841
- */
4842
- _finalizeActiveSelectionScaling({
4843
- selection: t
4844
- }) {
4845
- var o;
4846
- const e = Math.abs((o = t.scaleX) != null ? o : 1) || 1, s = t.getObjects().filter((n) => q._isTextbox(n));
4847
- s.length && (s.forEach((n) => {
4848
- const i = this._ensureScalingState(n), a = Math.max(1, i.baseWidth * e);
4849
- n.set({
4850
- width: a,
4851
- scaleX: 1,
4852
- scaleY: 1
4853
- }), n.setCoords(), n.dirty = !0, this.scalingState.delete(n);
4854
- }), t.set({
4855
- scaleX: 1
4856
- }), t.setCoords(), this.canvas.requestRenderAll());
4831
+ t.on("object:scaling", this._handleObjectScaling), t.on("object:modified", this._handleObjectModified), t.on("text:editing:entered", this._handleTextEditingEntered), t.on("text:editing:exited", this._handleTextEditingExited), t.on("text:changed", this._handleTextChanged);
4857
4832
  }
4858
4833
  /**
4859
4834
  * Возвращает диапазоны символов для каждой строки текста без учёта символов переноса.
@@ -4879,7 +4854,7 @@ class q {
4879
4854
  }) {
4880
4855
  const s = this._getLineRanges({ textbox: t });
4881
4856
  if (!s.length) return e;
4882
- let o = e.start, n = e.end;
4857
+ let { start: o } = e, { end: n } = e;
4883
4858
  return s.forEach(({ start: i, end: a }) => {
4884
4859
  e.end > i && e.start < a && (o = Math.min(o, i), n = Math.max(n, a));
4885
4860
  }), { start: o, end: n };
@@ -4924,16 +4899,40 @@ class q {
4924
4899
  }
4925
4900
  return e;
4926
4901
  }
4902
+ /**
4903
+ * Возвращает числовое значение размера, используя исходное значение или заранее вычисленное.
4904
+ */
4905
+ static _resolveDimension({
4906
+ rawValue: t,
4907
+ calculatedValue: e
4908
+ }) {
4909
+ return typeof t == "number" ? t : typeof e == "number" ? e : 0;
4910
+ }
4911
+ /**
4912
+ * Округляет ширину и высоту текстового блока до ближайших целых значений.
4913
+ */
4914
+ static _roundTextboxDimensions({
4915
+ textbox: t
4916
+ }) {
4917
+ const { width: e, height: s, calcTextWidth: o, calcTextHeight: n } = t, i = typeof o == "function" ? o.call(t) : void 0, a = typeof n == "function" ? n.call(t) : void 0, r = G._resolveDimension({
4918
+ rawValue: e,
4919
+ calculatedValue: i
4920
+ }), c = G._resolveDimension({
4921
+ rawValue: s,
4922
+ calculatedValue: a
4923
+ }), d = Number.isFinite(r) ? Math.round(r) : null, l = Number.isFinite(c) ? Math.round(c) : null, u = {};
4924
+ return d !== null && d !== r && (u.width = Math.max(0, d)), l !== null && l !== c && (u.height = Math.max(0, l)), Object.keys(u).length ? (t.set(u), !0) : !1;
4925
+ }
4927
4926
  /**
4928
4927
  * Формирует снимок текущих свойств текстового объекта для истории и событий.
4929
4928
  */
4930
4929
  static _getSnapshot(t) {
4931
4930
  const e = ({
4932
4931
  snapshot: H,
4933
- entries: G
4932
+ entries: z
4934
4933
  }) => {
4935
- Object.entries(G).forEach(([V, et]) => {
4936
- et != null && (H[V] = et);
4934
+ Object.entries(z).forEach(([X, et]) => {
4935
+ et != null && (H[X] = et);
4937
4936
  });
4938
4937
  }, {
4939
4938
  id: s,
@@ -4961,20 +4960,20 @@ class q {
4961
4960
  radiusTopRight: C,
4962
4961
  radiusBottomRight: j,
4963
4962
  radiusBottomLeft: T,
4964
- left: x,
4963
+ left: B,
4965
4964
  top: Z,
4966
4965
  width: U,
4967
4966
  height: F,
4968
- angle: K,
4969
- scaleX: L,
4967
+ angle: V,
4968
+ scaleX: D,
4970
4969
  scaleY: R
4971
- } = t, X = {
4970
+ } = t, K = {
4972
4971
  id: s,
4973
4972
  uppercase: !!i,
4974
4973
  textAlign: g
4975
4974
  };
4976
4975
  return e({
4977
- snapshot: X,
4976
+ snapshot: K,
4978
4977
  entries: {
4979
4978
  text: o,
4980
4979
  textCaseRaw: n,
@@ -4998,15 +4997,15 @@ class q {
4998
4997
  radiusTopRight: C,
4999
4998
  radiusBottomRight: j,
5000
4999
  radiusBottomLeft: T,
5001
- left: x,
5000
+ left: B,
5002
5001
  top: Z,
5003
5002
  width: U,
5004
5003
  height: F,
5005
- angle: K,
5006
- scaleX: L,
5004
+ angle: V,
5005
+ scaleX: D,
5007
5006
  scaleY: R
5008
5007
  }
5009
- }), X;
5008
+ }), K;
5010
5009
  }
5011
5010
  /**
5012
5011
  * Возвращает первый доступный шрифт или дефолтный Arial.
@@ -5019,14 +5018,14 @@ class q {
5019
5018
  const tt = ({
5020
5019
  value: h,
5021
5020
  fallback: t = 0
5022
- }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, Vt = ({
5021
+ }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, Qt = ({
5023
5022
  value: h,
5024
5023
  dimension: t,
5025
5024
  useRelativePositions: e
5026
5025
  }) => {
5027
5026
  const s = tt({ value: h });
5028
5027
  return e ? s : s / (t || 1);
5029
- }, ro = ({
5028
+ }, uo = ({
5030
5029
  object: h,
5031
5030
  baseWidth: t,
5032
5031
  baseHeight: e,
@@ -5036,22 +5035,22 @@ const tt = ({
5036
5035
  const n = h;
5037
5036
  if (typeof n[o.x] == "number" && typeof n[o.y] == "number")
5038
5037
  return {
5039
- x: Vt({
5038
+ x: Qt({
5040
5039
  value: n[o.x],
5041
5040
  dimension: t,
5042
5041
  useRelativePositions: s
5043
5042
  }),
5044
- y: Vt({
5043
+ y: Qt({
5045
5044
  value: n[o.y],
5046
5045
  dimension: e,
5047
5046
  useRelativePositions: s
5048
5047
  })
5049
5048
  };
5050
- const { left: a, top: r, width: c, height: d } = h, l = Vt({
5049
+ const { left: a, top: r, width: c, height: d } = h, l = Qt({
5051
5050
  value: a,
5052
5051
  dimension: t,
5053
5052
  useRelativePositions: s
5054
- }), u = Vt({
5053
+ }), u = Qt({
5055
5054
  value: r,
5056
5055
  dimension: e,
5057
5056
  useRelativePositions: s
@@ -5060,7 +5059,7 @@ const tt = ({
5060
5059
  x: l + g / 2,
5061
5060
  y: u + f / 2
5062
5061
  };
5063
- }, co = ({
5062
+ }, go = ({
5064
5063
  normalizedX: h,
5065
5064
  normalizedY: t,
5066
5065
  bounds: e,
@@ -5070,11 +5069,11 @@ const tt = ({
5070
5069
  const { left: n, top: i, width: a, height: r } = e;
5071
5070
  if (!o) {
5072
5071
  const { width: l, height: u } = s, g = n + h * (l || a), f = i + t * (u || r);
5073
- return new $(g, f);
5072
+ return new J(g, f);
5074
5073
  }
5075
5074
  const c = n + h * a, d = i + t * r;
5076
- return new $(c, d);
5077
- }, lo = ({
5075
+ return new J(c, d);
5076
+ }, fo = ({
5078
5077
  object: h,
5079
5078
  montageArea: t,
5080
5079
  bounds: e
@@ -5089,7 +5088,7 @@ const tt = ({
5089
5088
  } catch (s) {
5090
5089
  return null;
5091
5090
  }
5092
- }, lt = ({
5091
+ }, ht = ({
5093
5092
  object: h
5094
5093
  }) => {
5095
5094
  if (!h) return null;
@@ -5112,12 +5111,12 @@ const tt = ({
5112
5111
  } catch (t) {
5113
5112
  return null;
5114
5113
  }
5115
- }, ho = ({
5114
+ }, po = ({
5116
5115
  x1: h,
5117
5116
  y1: t,
5118
5117
  x2: e,
5119
5118
  y2: s
5120
- }) => (Math.atan2(s - t, e - h) * 180 / Math.PI + 360) % 360, uo = (h) => {
5119
+ }) => (Math.atan2(s - t, e - h) * 180 / Math.PI + 360) % 360, mo = (h) => {
5121
5120
  if (!h || typeof h != "object") return null;
5122
5121
  const { type: t, coords: e, colorStops: s } = h, o = Array.isArray(s) ? s : [], n = o[0], i = o[o.length - 1], a = typeof (n == null ? void 0 : n.color) == "string" ? n.color : void 0, r = typeof (i == null ? void 0 : i.color) == "string" ? i.color : a, c = typeof (n == null ? void 0 : n.offset) == "number" ? n.offset * 100 : void 0, d = typeof (i == null ? void 0 : i.offset) == "number" ? i.offset * 100 : void 0;
5123
5122
  if (!a || !r || !e) return null;
@@ -5126,7 +5125,7 @@ const tt = ({
5126
5125
  if (typeof l == "number" && typeof u == "number" && typeof g == "number" && typeof f == "number")
5127
5126
  return {
5128
5127
  type: "linear",
5129
- angle: ho({ x1: l, y1: u, x2: g, y2: f }),
5128
+ angle: po({ x1: l, y1: u, x2: g, y2: f }),
5130
5129
  startColor: a,
5131
5130
  endColor: r,
5132
5131
  startPosition: c,
@@ -5149,7 +5148,7 @@ const tt = ({
5149
5148
  }
5150
5149
  return null;
5151
5150
  }, ie = "_templateCenterX", ae = "_templateCenterY", re = "_templateAnchorX", ce = "_templateAnchorY";
5152
- class D {
5151
+ class L {
5153
5152
  constructor({ editor: t }) {
5154
5153
  this.editor = t;
5155
5154
  }
@@ -5168,21 +5167,21 @@ class D {
5168
5167
  montageArea: i,
5169
5168
  errorManager: a,
5170
5169
  backgroundManager: r
5171
- } = this.editor, c = n.getActiveObject(), d = D._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, u = o && l ? [l] : [], g = [...d, ...u];
5170
+ } = this.editor, c = n.getActiveObject(), d = L._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, u = o && l ? [l] : [], g = [...d, ...u];
5172
5171
  if (!g.length)
5173
5172
  return a.emitWarning({
5174
5173
  origin: "TemplateManager",
5175
5174
  method: "serializeSelection",
5176
- code: gt.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
5175
+ code: ft.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
5177
5176
  message: "Нет объектов для сериализации шаблона"
5178
5177
  }), null;
5179
- const f = D._getBounds(i), p = D._getMontageSize({ montageArea: i, bounds: f }), m = p.width, v = p.height, b = g.map((w) => D._serializeObject({
5178
+ const f = L._getBounds(i), p = L._getMontageSize({ montageArea: i, bounds: f }), m = p.width, v = p.height, b = g.map((w) => L._serializeObject({
5180
5179
  object: w,
5181
5180
  bounds: f,
5182
5181
  baseWidth: m,
5183
5182
  baseHeight: v,
5184
5183
  montageArea: i != null ? i : null
5185
- })), I = bt(B({}, s), {
5184
+ })), I = jt(k({}, s), {
5186
5185
  baseWidth: m,
5187
5186
  baseHeight: v,
5188
5187
  positionsNormalized: !0,
@@ -5216,36 +5215,36 @@ class D {
5216
5215
  return a.emitWarning({
5217
5216
  origin: "TemplateManager",
5218
5217
  method: "applyTemplate",
5219
- code: gt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5218
+ code: ft.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5220
5219
  message: "Шаблон не содержит объектов"
5221
5220
  }), null;
5222
- const u = D._getBounds(n);
5221
+ const u = L._getBounds(n);
5223
5222
  if (!u)
5224
5223
  return a.emitWarning({
5225
5224
  origin: "TemplateManager",
5226
5225
  method: "applyTemplate",
5227
- code: gt.TEMPLATE_MANAGER.INVALID_TARGET,
5226
+ code: ft.TEMPLATE_MANAGER.INVALID_TARGET,
5228
5227
  message: "Не удалось определить границы монтажной области"
5229
5228
  }), null;
5230
- const g = D._getMontageSize({ montageArea: n, bounds: u }), f = D._normalizeMeta({ meta: d, fallback: g }), p = D._calculateScale({ meta: f, target: g }), m = !!f.positionsNormalized;
5229
+ const g = L._getMontageSize({ montageArea: n, bounds: u }), f = L._normalizeMeta({ meta: d, fallback: g }), p = L._calculateScale({ meta: f, target: g }), m = !!f.positionsNormalized;
5231
5230
  let v = !1, b = !1;
5232
5231
  i.suspendHistory();
5233
5232
  try {
5234
- const I = yield D._enlivenObjects(c);
5233
+ const I = yield L._enlivenObjects(c);
5235
5234
  if (!I.length)
5236
5235
  return a.emitWarning({
5237
5236
  origin: "TemplateManager",
5238
5237
  method: "applyTemplate",
5239
- code: gt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5238
+ code: ft.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5240
5239
  message: "Не удалось создать объекты шаблона"
5241
5240
  }), null;
5242
- const { backgroundObject: y, contentObjects: w } = D._extractBackgroundObject(I);
5243
- y && (b = yield D._applyBackgroundFromObject({
5241
+ const { backgroundObject: y, contentObjects: w } = L._extractBackgroundObject(I);
5242
+ y && (b = yield L._applyBackgroundFromObject({
5244
5243
  backgroundObject: y,
5245
5244
  backgroundManager: r,
5246
5245
  errorManager: a
5247
5246
  }));
5248
- const S = w.map((A) => (D._applyTextOverrides({ object: A, data: e }), D._transformObject({
5247
+ const S = w.map((A) => (L._applyTextOverrides({ object: A, data: e }), L._transformObject({
5249
5248
  object: A,
5250
5249
  scale: p,
5251
5250
  bounds: u,
@@ -5258,7 +5257,7 @@ class D {
5258
5257
  id: `${A.type}-${Y()}`,
5259
5258
  evented: !0
5260
5259
  }), o.add(A), A));
5261
- return !S.length && !b ? null : (v = S.length > 0 || b, S.length && D._activateObjects({ canvas: o, objects: S }), o.requestRenderAll(), o.fire("editor:template-applied", {
5260
+ return !S.length && !b ? null : (v = S.length > 0 || b, S.length && L._activateObjects({ canvas: o, objects: S }), o.requestRenderAll(), o.fire("editor:template-applied", {
5262
5261
  template: t,
5263
5262
  objects: S,
5264
5263
  bounds: u
@@ -5267,7 +5266,7 @@ class D {
5267
5266
  return a.emitError({
5268
5267
  origin: "TemplateManager",
5269
5268
  method: "applyTemplate",
5270
- code: gt.TEMPLATE_MANAGER.APPLY_FAILED,
5269
+ code: ft.TEMPLATE_MANAGER.APPLY_FAILED,
5271
5270
  message: "Ошибка применения шаблона",
5272
5271
  data: {
5273
5272
  templateId: l,
@@ -5283,7 +5282,7 @@ class D {
5283
5282
  * Подготавливает объекты для сериализации.
5284
5283
  */
5285
5284
  static _collectObjects(t) {
5286
- return t ? t instanceof k ? t.getObjects() : [t] : [];
5285
+ return t ? t instanceof x ? t.getObjects() : [t] : [];
5287
5286
  }
5288
5287
  /**
5289
5288
  * Возвращает габариты объекта.
@@ -5309,13 +5308,13 @@ class D {
5309
5308
  static _enlivenObjects(t) {
5310
5309
  return _(this, null, function* () {
5311
5310
  return (yield Promise.all(t.map((s) => _(null, null, function* () {
5312
- if (D._hasSerializedSvgMarkup(s)) {
5313
- const i = yield D._reviveSvgObject(s);
5311
+ if (L._hasSerializedSvgMarkup(s)) {
5312
+ const i = yield L._reviveSvgObject(s);
5314
5313
  if (i)
5315
- return D._restoreImageScale({ revived: i, serialized: s }), i;
5314
+ return L._restoreImageScale({ revived: i, serialized: s }), i;
5316
5315
  }
5317
- const o = yield rt.enlivenObjects([s]), n = o == null ? void 0 : o[0];
5318
- return n ? (D._restoreImageScale({ revived: n, serialized: s }), n) : null;
5316
+ const o = yield ct.enlivenObjects([s]), n = o == null ? void 0 : o[0];
5317
+ return n ? (L._restoreImageScale({ revived: n, serialized: s }), n) : null;
5319
5318
  })))).filter((s) => !!s);
5320
5319
  });
5321
5320
  }
@@ -5359,8 +5358,8 @@ class D {
5359
5358
  const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
5360
5359
  if (!e) return null;
5361
5360
  try {
5362
- const s = yield ps(e), o = rt.groupSVGElements(s.objects, s.options), n = yield rt.enlivenObjectEnlivables(
5363
- D._prepareSerializableProps(t)
5361
+ const s = yield bs(e), o = ct.groupSVGElements(s.objects, s.options), n = yield ct.enlivenObjectEnlivables(
5362
+ L._prepareSerializableProps(t)
5364
5363
  );
5365
5364
  return o.set(n), o.setCoords(), o;
5366
5365
  } catch (s) {
@@ -5372,7 +5371,7 @@ class D {
5372
5371
  * Убирает технические поля сериализации, оставляя только применимые свойства.
5373
5372
  */
5374
5373
  static _prepareSerializableProps(t) {
5375
- const e = B({}, t);
5374
+ const e = k({}, t);
5376
5375
  return delete e.svgMarkup, delete e.objects, delete e.path, delete e.paths, delete e.type, delete e.version, e;
5377
5376
  }
5378
5377
  /**
@@ -5418,7 +5417,7 @@ class D {
5418
5417
  montageArea: a,
5419
5418
  useRelativePositions: r
5420
5419
  }) {
5421
- const c = t, { x: d, y: l } = ro({
5420
+ const c = t, { x: d, y: l } = uo({
5422
5421
  object: t,
5423
5422
  baseWidth: n,
5424
5423
  baseHeight: i,
@@ -5427,15 +5426,15 @@ class D {
5427
5426
  x: ie,
5428
5427
  y: ae
5429
5428
  }
5430
- }), { scaleX: u, scaleY: g } = t, f = tt({ value: u, fallback: 1 }), p = tt({ value: g, fallback: 1 }), m = D._getPositioningBounds({
5429
+ }), { scaleX: u, scaleY: g } = t, f = tt({ value: u, fallback: 1 }), p = tt({ value: g, fallback: 1 }), m = L._getPositioningBounds({
5431
5430
  bounds: s,
5432
5431
  baseWidth: n,
5433
5432
  baseHeight: i,
5434
5433
  scale: e,
5435
5434
  useRelativePositions: r,
5436
- anchorX: D._resolveAnchor(c, re),
5437
- anchorY: D._resolveAnchor(c, ce)
5438
- }), v = co({
5435
+ anchorX: L._resolveAnchor(c, re),
5436
+ anchorY: L._resolveAnchor(c, ce)
5437
+ }), v = go({
5439
5438
  normalizedX: d,
5440
5439
  normalizedY: l,
5441
5440
  bounds: m,
@@ -5461,7 +5460,7 @@ class D {
5461
5460
  anchorY: a
5462
5461
  }) {
5463
5462
  if (!n) return t;
5464
- const r = (e || t.width) * o, c = (s || t.height) * o, d = t.width - r, l = t.height - c, u = t.left + D._calculateAnchorOffset(i, d), g = t.top + D._calculateAnchorOffset(a, l);
5463
+ const r = (e || t.width) * o, c = (s || t.height) * o, d = t.width - r, l = t.height - c, u = t.left + L._calculateAnchorOffset(i, d), g = t.top + L._calculateAnchorOffset(a, l);
5465
5464
  return {
5466
5465
  left: u,
5467
5466
  top: g,
@@ -5495,8 +5494,8 @@ class D {
5495
5494
  meta: t,
5496
5495
  fallback: e
5497
5496
  }) {
5498
- const { width: s, height: o } = e, r = t || {}, { baseWidth: n = s, baseHeight: i = o } = r, a = ut(r, ["baseWidth", "baseHeight"]);
5499
- return B({
5497
+ const { width: s, height: o } = e, r = t || {}, { baseWidth: n = s, baseHeight: i = o } = r, a = gt(r, ["baseWidth", "baseHeight"]);
5498
+ return k({
5500
5499
  baseWidth: n,
5501
5500
  baseHeight: i
5502
5501
  }, a);
@@ -5523,7 +5522,7 @@ class D {
5523
5522
  t.setActiveObject(e[0]);
5524
5523
  return;
5525
5524
  }
5526
- const s = new k(e, { canvas: t });
5525
+ const s = new x(e, { canvas: t });
5527
5526
  t.setActiveObject(s);
5528
5527
  }
5529
5528
  /**
@@ -5547,9 +5546,9 @@ class D {
5547
5546
  baseHeight: o,
5548
5547
  montageArea: n
5549
5548
  }) {
5550
- const i = t.toDatalessObject([...ts]);
5551
- if (D._isSvgObject(t)) {
5552
- const y = D._extractSvgMarkup(t);
5549
+ const i = t.toDatalessObject([...as]);
5550
+ if (L._isSvgObject(t)) {
5551
+ const y = L._extractSvgMarkup(t);
5553
5552
  y && (i.svgMarkup = y, delete i.objects, delete i.path);
5554
5553
  }
5555
5554
  if (!e) return i;
@@ -5558,7 +5557,7 @@ class D {
5558
5557
  top: r,
5559
5558
  width: c,
5560
5559
  height: d
5561
- } = e, l = t.getBoundingRect(!1, !0), u = s || c || 1, g = o || d || 1, f = lo({
5560
+ } = e, l = t.getBoundingRect(!1, !0), u = s || c || 1, g = o || d || 1, f = fo({
5562
5561
  object: t,
5563
5562
  montageArea: n,
5564
5563
  bounds: e
@@ -5569,11 +5568,11 @@ class D {
5569
5568
  y: (y.y - r) / g
5570
5569
  };
5571
5570
  })(), m = (l.left - a) / u, v = (l.top - r) / g, b = m + l.width / u, I = v + l.height / g;
5572
- return i[ie] = p.x, i[ae] = p.y, i[re] = D._detectAnchor({
5571
+ return i[ie] = p.x, i[ae] = p.y, i[re] = L._detectAnchor({
5573
5572
  center: p.x,
5574
5573
  start: m,
5575
5574
  end: b
5576
- }), i[ce] = D._detectAnchor({
5575
+ }), i[ce] = L._detectAnchor({
5577
5576
  center: p.y,
5578
5577
  start: v,
5579
5578
  end: I
@@ -5599,7 +5598,7 @@ class D {
5599
5598
  errorManager: s
5600
5599
  }) {
5601
5600
  try {
5602
- const { fill: n, customData: i } = t, { backgroundType: a } = t, r = D._cloneCustomData(i);
5601
+ const { fill: n, customData: i } = t, { backgroundType: a } = t, r = L._cloneCustomData(i);
5603
5602
  if (a === "color" && typeof n == "string")
5604
5603
  return e.setColorBackground({
5605
5604
  color: n,
@@ -5607,7 +5606,7 @@ class D {
5607
5606
  withoutSave: !0
5608
5607
  }), !0;
5609
5608
  if (a === "gradient") {
5610
- const c = uo(n);
5609
+ const c = mo(n);
5611
5610
  if (c)
5612
5611
  return e.setGradientBackground({
5613
5612
  gradient: c,
@@ -5616,7 +5615,7 @@ class D {
5616
5615
  }), !0;
5617
5616
  }
5618
5617
  if (a === "image") {
5619
- const c = D._getImageSource(t);
5618
+ const c = L._getImageSource(t);
5620
5619
  if (c)
5621
5620
  return yield e.setImageBackground({
5622
5621
  imageSource: c,
@@ -5628,7 +5627,7 @@ class D {
5628
5627
  s.emitWarning({
5629
5628
  origin: "TemplateManager",
5630
5629
  method: "applyTemplate",
5631
- code: gt.TEMPLATE_MANAGER.APPLY_FAILED,
5630
+ code: ft.TEMPLATE_MANAGER.APPLY_FAILED,
5632
5631
  message: "Не удалось применить фон из шаблона",
5633
5632
  data: n
5634
5633
  });
@@ -5658,7 +5657,7 @@ class D {
5658
5657
  */
5659
5658
  static _cloneCustomData(t) {
5660
5659
  if (!(!t || typeof t != "object"))
5661
- return B({}, t);
5660
+ return k({}, t);
5662
5661
  }
5663
5662
  /**
5664
5663
  * Извлекает src изображения из FabricImage или его исходного элемента.
@@ -5684,10 +5683,10 @@ class D {
5684
5683
  */
5685
5684
  // eslint-disable-next-line class-methods-use-this
5686
5685
  enlivenObjectEnlivables(t) {
5687
- return rt.enlivenObjectEnlivables(t);
5686
+ return ct.enlivenObjectEnlivables(t);
5688
5687
  }
5689
5688
  }
5690
- const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
5689
+ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
5691
5690
  anchors: h,
5692
5691
  positions: t,
5693
5692
  threshold: e
@@ -5702,16 +5701,16 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
5702
5701
  delta: s,
5703
5702
  guidePosition: n
5704
5703
  };
5705
- }, fo = ({
5704
+ }, vo = ({
5706
5705
  activeBounds: h,
5707
5706
  threshold: t,
5708
5707
  anchors: e
5709
5708
  }) => {
5710
- const { left: s, right: o, centerX: n, top: i, bottom: a, centerY: r } = h, c = Xe({
5709
+ const { left: s, right: o, centerX: n, top: i, bottom: a, centerY: r } = h, c = ts({
5711
5710
  anchors: e.vertical,
5712
5711
  positions: [s, n, o],
5713
5712
  threshold: t
5714
- }), d = Xe({
5713
+ }), d = ts({
5715
5714
  anchors: e.horizontal,
5716
5715
  positions: [i, r, a],
5717
5716
  threshold: t
@@ -5727,7 +5726,7 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
5727
5726
  deltaY: d.delta,
5728
5727
  guides: l
5729
5728
  };
5730
- }, ss = ({
5729
+ }, cs = ({
5731
5730
  activeBounds: h,
5732
5731
  aligned: t,
5733
5732
  threshold: e,
@@ -5799,7 +5798,7 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
5799
5798
  }
5800
5799
  }
5801
5800
  return c;
5802
- }, po = ({
5801
+ }, bo = ({
5803
5802
  activeBounds: h,
5804
5803
  candidates: t,
5805
5804
  threshold: e,
@@ -5856,9 +5855,9 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
5856
5855
  if (u && f) {
5857
5856
  const { bounds: y } = u, { bounds: w } = f, A = w.top - y.bottom - v;
5858
5857
  if (A >= 0) {
5859
- const M = A / 2, C = n - y.bottom, j = w.top - i, T = Math.abs(C - M), x = Math.abs(j - M), Z = Math.max(T, x);
5858
+ const M = A / 2, C = n - y.bottom, j = w.top - i, T = Math.abs(C - M), B = Math.abs(j - M), Z = Math.max(T, B);
5860
5859
  if (Z <= e) {
5861
- const U = M - C, F = i + U, K = {
5860
+ const U = M - C, F = i + U, V = {
5862
5861
  type: "vertical",
5863
5862
  axis: o,
5864
5863
  refStart: y.bottom,
@@ -5867,11 +5866,11 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
5867
5866
  activeEnd: F + M,
5868
5867
  distance: M
5869
5868
  };
5870
- m.push({ delta: U, guide: K, diff: Z });
5869
+ m.push({ delta: U, guide: V, diff: Z });
5871
5870
  }
5872
5871
  }
5873
5872
  }
5874
- const b = ss({
5873
+ const b = cs({
5875
5874
  activeBounds: h,
5876
5875
  aligned: c,
5877
5876
  threshold: e,
@@ -5885,7 +5884,7 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
5885
5884
  delta: I.delta,
5886
5885
  guide: I.guide
5887
5886
  };
5888
- }, mo = ({
5887
+ }, Mo = ({
5889
5888
  activeBounds: h,
5890
5889
  candidates: t,
5891
5890
  threshold: e,
@@ -5942,9 +5941,9 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
5942
5941
  if (u && f) {
5943
5942
  const { bounds: y } = u, { bounds: w } = f, A = w.left - y.right - v;
5944
5943
  if (A >= 0) {
5945
- const M = A / 2, C = n - y.right, j = w.left - i, T = Math.abs(C - M), x = Math.abs(j - M), Z = Math.max(T, x);
5944
+ const M = A / 2, C = n - y.right, j = w.left - i, T = Math.abs(C - M), B = Math.abs(j - M), Z = Math.max(T, B);
5946
5945
  if (Z <= e) {
5947
- const U = M - C, F = i + U, K = {
5946
+ const U = M - C, F = i + U, V = {
5948
5947
  type: "horizontal",
5949
5948
  axis: o,
5950
5949
  refStart: y.right,
@@ -5953,11 +5952,11 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
5953
5952
  activeEnd: F + M,
5954
5953
  distance: M
5955
5954
  };
5956
- m.push({ delta: U, guide: K, diff: Z });
5955
+ m.push({ delta: U, guide: V, diff: Z });
5957
5956
  }
5958
5957
  }
5959
5958
  }
5960
- const b = ss({
5959
+ const b = cs({
5961
5960
  activeBounds: h,
5962
5961
  aligned: c,
5963
5962
  threshold: e,
@@ -5971,18 +5970,18 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
5971
5970
  delta: I.delta,
5972
5971
  guide: I.guide
5973
5972
  };
5974
- }, yo = ({
5973
+ }, wo = ({
5975
5974
  activeBounds: h,
5976
5975
  candidates: t,
5977
5976
  threshold: e,
5978
5977
  spacingPatterns: s
5979
5978
  }) => {
5980
- const o = po({
5979
+ const o = bo({
5981
5980
  activeBounds: h,
5982
5981
  candidates: t,
5983
5982
  threshold: e,
5984
5983
  patterns: s.vertical
5985
- }), n = mo({
5984
+ }), n = Mo({
5986
5985
  activeBounds: h,
5987
5986
  candidates: t,
5988
5987
  threshold: e,
@@ -5993,7 +5992,7 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
5993
5992
  deltaY: o.delta,
5994
5993
  guides: i
5995
5994
  };
5996
- }, vo = ({
5995
+ }, So = ({
5997
5996
  context: h,
5998
5997
  x: t,
5999
5998
  y: e,
@@ -6023,7 +6022,7 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
6023
6022
  const p = i || 1, m = 12 / p, v = l / p, b = u / p, I = (s + o) / 2 + g, y = t === "vertical" ? e + f : I, w = t === "vertical" ? I : e + f;
6024
6023
  h.save(), h.setLineDash([]), h.fillStyle = a, h.strokeStyle = a, h.lineWidth = d / p, h.font = `${m}px ${c}`, h.textAlign = "center", h.textBaseline = "middle";
6025
6024
  const A = h.measureText(n).width + v * 2, M = m + v * 2, C = y - A / 2, j = w - M / 2;
6026
- h.beginPath(), vo({
6025
+ h.beginPath(), So({
6027
6026
  context: h,
6028
6027
  x: C,
6029
6028
  y: j,
@@ -6031,7 +6030,7 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
6031
6030
  height: M,
6032
6031
  radius: b
6033
6032
  }), h.fill(), h.fillStyle = r, h.fillText(n, y, w), h.restore();
6034
- }, bo = ({
6033
+ }, Ao = ({
6035
6034
  context: h,
6036
6035
  guide: t,
6037
6036
  zoom: e
@@ -6046,7 +6045,7 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
6046
6045
  distance: c
6047
6046
  } = t, d = Math.round(c).toString();
6048
6047
  h.beginPath(), s === "vertical" ? (h.moveTo(o, n), h.lineTo(o, i), h.moveTo(o, a), h.lineTo(o, r)) : (h.moveTo(n, o), h.lineTo(i, o), h.moveTo(a, o), h.lineTo(r, o)), h.stroke();
6049
- const l = es;
6048
+ const l = rs;
6050
6049
  pe({
6051
6050
  context: h,
6052
6051
  type: s,
@@ -6068,7 +6067,7 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
6068
6067
  color: l,
6069
6068
  lineWidth: fe
6070
6069
  });
6071
- }, Ke = ({
6070
+ }, es = ({
6072
6071
  anchors: h,
6073
6072
  bounds: t
6074
6073
  }) => {
@@ -6081,7 +6080,7 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
6081
6080
  centerY: a
6082
6081
  } = t;
6083
6082
  h.vertical.push(e, o, s), h.horizontal.push(n, a, i);
6084
- }, Qe = ({
6083
+ }, ss = ({
6085
6084
  bounds: h,
6086
6085
  type: t,
6087
6086
  primaryStart: e,
@@ -6108,30 +6107,30 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
6108
6107
  });
6109
6108
  }
6110
6109
  return o;
6111
- }, Mo = ({
6110
+ }, jo = ({
6112
6111
  bounds: h
6113
6112
  }) => {
6114
- const t = Qe({
6113
+ const t = ss({
6115
6114
  bounds: h,
6116
6115
  type: "vertical",
6117
6116
  primaryStart: "top",
6118
6117
  primaryEnd: "bottom"
6119
- }), e = Qe({
6118
+ }), e = ss({
6120
6119
  bounds: h,
6121
6120
  type: "horizontal",
6122
6121
  primaryStart: "left",
6123
6122
  primaryEnd: "right"
6124
6123
  });
6125
6124
  return { vertical: t, horizontal: e };
6126
- }, wo = ["montage-area", "background", "interaction-blocker"], os = ({
6125
+ }, Io = ["montage-area", "background", "interaction-blocker"], ds = ({
6127
6126
  activeObject: h
6128
6127
  }) => {
6129
6128
  const t = /* @__PURE__ */ new Set();
6130
- return h && (t.add(h), h instanceof k && h.getObjects().forEach((e) => t.add(e))), t;
6131
- }, ns = ({
6129
+ return h && (t.add(h), h instanceof x && h.getObjects().forEach((e) => t.add(e))), t;
6130
+ }, ls = ({
6132
6131
  object: h,
6133
6132
  excluded: t,
6134
- ignoredIds: e = wo
6133
+ ignoredIds: e = Io
6135
6134
  }) => {
6136
6135
  if (t.has(h)) return !0;
6137
6136
  const { visible: s = !0 } = h;
@@ -6139,7 +6138,7 @@ const go = 5, es = "#3D8BF4", fe = 1, Xt = 1, Xe = ({
6139
6138
  const { id: o } = h;
6140
6139
  return !!(o && e.includes(o));
6141
6140
  };
6142
- class So {
6141
+ class Co {
6143
6142
  /**
6144
6143
  * Создаёт менеджер прилипания и инициализирует слушатели событий.
6145
6144
  */
@@ -6197,12 +6196,12 @@ class So {
6197
6196
  return;
6198
6197
  }
6199
6198
  !this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: e });
6200
- let n = lt({ object: e });
6199
+ let n = ht({ object: e });
6201
6200
  if (!n) {
6202
6201
  this._clearGuides();
6203
6202
  return;
6204
6203
  }
6205
- const { canvas: i } = this, a = i.getZoom() || 1, r = go / a, c = fo({
6204
+ const { canvas: i } = this, a = i.getZoom() || 1, r = yo / a, c = vo({
6206
6205
  activeBounds: n,
6207
6206
  threshold: r,
6208
6207
  anchors: this.anchors
@@ -6212,9 +6211,9 @@ class So {
6212
6211
  e.set({
6213
6212
  left: v + d,
6214
6213
  top: b + l
6215
- }), e.setCoords(), n = (p = lt({ object: e })) != null ? p : n;
6214
+ }), e.setCoords(), n = (p = ht({ object: e })) != null ? p : n;
6216
6215
  }
6217
- const g = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => lt({ object: v })).filter((v) => !!v), f = yo({
6216
+ const g = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => ht({ object: v })).filter((v) => !!v), f = wo({
6218
6217
  activeBounds: n,
6219
6218
  candidates: g,
6220
6219
  threshold: r,
@@ -6225,7 +6224,7 @@ class So {
6225
6224
  e.set({
6226
6225
  left: v + f.deltaX,
6227
6226
  top: b + f.deltaY
6228
- }), e.setCoords(), n = (m = lt({ object: e })) != null ? m : n;
6227
+ }), e.setCoords(), n = (m = ht({ object: e })) != null ? m : n;
6229
6228
  }
6230
6229
  this._applyGuides({
6231
6230
  guides: u,
@@ -6253,11 +6252,11 @@ class So {
6253
6252
  const { canvas: t, guideBounds: e } = this, s = t.getSelectionContext();
6254
6253
  if (!s) return;
6255
6254
  const o = e != null ? e : this._calculateViewportBounds(), { left: n, right: i, top: a, bottom: r } = o, { viewportTransform: c } = t, d = t.getZoom() || 1;
6256
- s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = fe / d, s.strokeStyle = es, s.setLineDash([4, 4]);
6255
+ s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = fe / d, s.strokeStyle = rs, s.setLineDash([4, 4]);
6257
6256
  for (const l of this.activeGuides)
6258
6257
  s.beginPath(), l.type === "vertical" ? (s.moveTo(l.position, a), s.lineTo(l.position, r)) : (s.moveTo(n, l.position), s.lineTo(i, l.position)), s.stroke();
6259
6258
  for (const l of this.activeSpacingGuides)
6260
- bo({
6259
+ Ao({
6261
6260
  context: s,
6262
6261
  guide: l,
6263
6262
  zoom: d
@@ -6293,7 +6292,7 @@ class So {
6293
6292
  * Применяет шаг перемещения, округляя координаты объекта к сетке MOVE_SNAP_STEP.
6294
6293
  */
6295
6294
  _applyMovementStep({ target: t }) {
6296
- const { left: e = 0, top: s = 0 } = t, o = Math.round(e / Xt) * Xt, n = Math.round(s / Xt) * Xt;
6295
+ const { left: e = 0, top: s = 0 } = t, o = Math.round(e / qt) * qt, n = Math.round(s / qt) * qt;
6297
6296
  o === e && n === s || (t.set({
6298
6297
  left: o,
6299
6298
  top: n
@@ -6305,12 +6304,12 @@ class So {
6305
6304
  _cacheAnchors({ activeObject: t }) {
6306
6305
  const e = this._collectTargets({ activeObject: t }), s = { vertical: [], horizontal: [] }, o = [];
6307
6306
  for (const a of e) {
6308
- const r = lt({ object: a });
6309
- r && (Ke({ anchors: s, bounds: r }), o.push(r));
6307
+ const r = ht({ object: a });
6308
+ r && (es({ anchors: s, bounds: r }), o.push(r));
6310
6309
  }
6311
- const { montageArea: n } = this.editor, i = lt({ object: n });
6310
+ const { montageArea: n } = this.editor, i = ht({ object: n });
6312
6311
  if (i) {
6313
- Ke({ anchors: s, bounds: i });
6312
+ es({ anchors: s, bounds: i });
6314
6313
  const { left: a, right: r, top: c, bottom: d } = i;
6315
6314
  this.guideBounds = {
6316
6315
  left: a,
@@ -6320,15 +6319,15 @@ class So {
6320
6319
  };
6321
6320
  } else
6322
6321
  this.guideBounds = this._calculateViewportBounds();
6323
- this.anchors = s, this.spacingPatterns = Mo({ bounds: o }), this.cachedTargetBounds = o;
6322
+ this.anchors = s, this.spacingPatterns = jo({ bounds: o }), this.cachedTargetBounds = o;
6324
6323
  }
6325
6324
  /**
6326
6325
  * Собирает объекты, подходящие для прилипания, исключая активный объект и запрещённые id.
6327
6326
  */
6328
6327
  _collectTargets({ activeObject: t }) {
6329
- const e = os({ activeObject: t }), s = [];
6328
+ const e = ds({ activeObject: t }), s = [];
6330
6329
  return this.canvas.forEachObject((o) => {
6331
- ns({ object: o, excluded: e }) || s.push(o);
6330
+ ls({ object: o, excluded: e }) || s.push(o);
6332
6331
  }), s;
6333
6332
  }
6334
6333
  /**
@@ -6351,8 +6350,8 @@ class So {
6351
6350
  };
6352
6351
  }
6353
6352
  }
6354
- const qe = "#3D8BF4", $e = 1;
6355
- class At {
6353
+ const os = "#3D8BF4", ns = 1;
6354
+ class Et {
6356
6355
  /**
6357
6356
  * Создаёт менеджер измерений и инициализирует события.
6358
6357
  */
@@ -6457,15 +6456,15 @@ class At {
6457
6456
  this._clearGuides();
6458
6457
  return;
6459
6458
  }
6460
- const n = lt({ object: o });
6459
+ const n = ht({ object: o });
6461
6460
  if (!n) {
6462
6461
  this._clearGuides();
6463
6462
  return;
6464
6463
  }
6465
- const i = At._resolveTarget({
6464
+ const i = Et._resolveTarget({
6466
6465
  event: t,
6467
6466
  activeObject: o
6468
- }), { montageArea: a } = s, r = i != null ? i : a, c = r === a, d = lt({ object: r });
6467
+ }), { montageArea: a } = s, r = i != null ? i : a, c = r === a, d = ht({ object: r });
6469
6468
  if (!d) {
6470
6469
  this._clearGuides();
6471
6470
  return;
@@ -6474,7 +6473,7 @@ class At {
6474
6473
  this._clearGuides();
6475
6474
  return;
6476
6475
  }
6477
- const u = At._buildGuides({
6476
+ const u = Et._buildGuides({
6478
6477
  activeBounds: n,
6479
6478
  targetBounds: d,
6480
6479
  targetIsMontageArea: c
@@ -6492,8 +6491,8 @@ class At {
6492
6491
  event: t,
6493
6492
  activeObject: e
6494
6493
  }) {
6495
- const { target: s } = t, o = os({ activeObject: e });
6496
- return s && !ns({ object: s, excluded: o }) ? s : null;
6494
+ const { target: s } = t, o = ds({ activeObject: e });
6495
+ return s && !ls({ object: s, excluded: o }) ? s : null;
6497
6496
  }
6498
6497
  /**
6499
6498
  * Собирает вертикальные и горизонтальные направляющие расстояний.
@@ -6503,11 +6502,11 @@ class At {
6503
6502
  targetBounds: e,
6504
6503
  targetIsMontageArea: s
6505
6504
  }) {
6506
- const o = At._buildHorizontalGuides({
6505
+ const o = Et._buildHorizontalGuides({
6507
6506
  activeBounds: t,
6508
6507
  targetBounds: e,
6509
6508
  targetIsMontageArea: s
6510
- }), n = At._buildVerticalGuides({
6509
+ }), n = Et._buildVerticalGuides({
6511
6510
  activeBounds: t,
6512
6511
  targetBounds: e,
6513
6512
  targetIsMontageArea: s
@@ -6661,7 +6660,7 @@ class At {
6661
6660
  const { canvas: t } = this, e = t.getSelectionContext();
6662
6661
  if (!e) return;
6663
6662
  const { viewportTransform: s } = t, o = t.getZoom() || 1, n = this.activeGuides.some((c) => c.type === "vertical"), i = this.activeGuides.some((c) => c.type === "horizontal"), a = n && i && !this.isTargetMontageArea, r = a ? 12 / o : 0;
6664
- e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = $e / o, e.strokeStyle = qe, e.setLineDash([]);
6663
+ e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = ns / o, e.strokeStyle = os, e.setLineDash([]);
6665
6664
  for (const c of this.activeGuides) {
6666
6665
  const { type: d, axis: l, start: u, end: g, distance: f } = c, p = Math.abs(g - u), m = u <= g ? -1 : 1, v = a ? m * (p / 2 + r) : 0, b = 0;
6667
6666
  e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, g)) : (e.moveTo(u, l), e.lineTo(g, l)), e.stroke(), pe({
@@ -6672,8 +6671,8 @@ class At {
6672
6671
  end: g,
6673
6672
  text: Math.round(f).toString(),
6674
6673
  zoom: o,
6675
- color: qe,
6676
- lineWidth: $e,
6674
+ color: os,
6675
+ lineWidth: ns,
6677
6676
  offsetAlongAxis: v,
6678
6677
  offsetPerpendicular: b
6679
6678
  });
@@ -6729,7 +6728,7 @@ class we {
6729
6728
  showRotationAngle: d,
6730
6729
  _onReadyCallback: l
6731
6730
  } = this.options;
6732
- if (Q.apply(), this.canvas = new ms(this.containerId, this.options), this.moduleLoader = new ws(), this.workerManager = new As(), this.errorManager = new zt({ editor: this }), this.historyManager = new Qt({ editor: this }), this.toolbar = new Ps({ editor: this }), this.transformManager = new Ks({ editor: this }), this.zoomManager = new Qs({ editor: this }), this.canvasManager = new Xs({ editor: this }), this.imageManager = new at({ editor: this }), this.layerManager = new qt({ editor: this }), this.shapeManager = new $s({ editor: this }), this.interactionBlocker = new qs({ editor: this }), this.backgroundManager = new St({ editor: this }), this.clipboardManager = new Js({ editor: this }), this.objectLockManager = new $t({ editor: this }), this.groupingManager = new to({ editor: this }), this.selectionManager = new eo({ editor: this }), this.deletionManager = new Me({ editor: this }), this.panConstraintManager = new so({ editor: this }), this.snappingManager = new So({ editor: this }), this.measurementManager = new At({ editor: this }), this.fontManager = new ge((u = this.options.fonts) != null ? u : []), this.textManager = new q({ editor: this }), this.templateManager = new D({ editor: this }), d && (this.angleIndicator = new be({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new xt({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(o), this.canvasManager.setCanvasCSSWidth(n), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
6731
+ if ($.apply(), this.canvas = new Ms(this.containerId, this.options), this.moduleLoader = new Is(), this.workerManager = new Ts(), this.errorManager = new Ut({ editor: this }), this.historyManager = new Jt({ editor: this }), this.toolbar = new Hs({ editor: this }), this.transformManager = new Js({ editor: this }), this.zoomManager = new to({ editor: this }), this.canvasManager = new $s({ editor: this }), this.imageManager = new rt({ editor: this }), this.layerManager = new te({ editor: this }), this.shapeManager = new so({ editor: this }), this.interactionBlocker = new eo({ editor: this }), this.backgroundManager = new Tt({ editor: this }), this.clipboardManager = new oo({ editor: this }), this.objectLockManager = new ee({ editor: this }), this.groupingManager = new no({ editor: this }), this.selectionManager = new io({ editor: this }), this.deletionManager = new Me({ editor: this }), this.panConstraintManager = new ao({ editor: this }), this.snappingManager = new Co({ editor: this }), this.measurementManager = new Et({ editor: this }), this.fontManager = new ge((u = this.options.fonts) != null ? u : []), this.textManager = new G({ editor: this }), this.templateManager = new L({ editor: this }), d && (this.angleIndicator = new be({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Pt({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(o), this.canvasManager.setCanvasCSSWidth(n), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
6733
6732
  const {
6734
6733
  source: g,
6735
6734
  scale: f = `image-${c}`,
@@ -6802,7 +6801,7 @@ class we {
6802
6801
  const t = document.createElement("canvas");
6803
6802
  t.width = 20, t.height = 20;
6804
6803
  const e = t.getContext("2d");
6805
- 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 ys({
6804
+ 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 ws({
6806
6805
  source: t,
6807
6806
  repeat: "repeat"
6808
6807
  });
@@ -6834,7 +6833,7 @@ const E = [
6834
6833
  "U+0490-0491",
6835
6834
  "U+04B0-04B1",
6836
6835
  "U+2116"
6837
- ].join(", "), Ao = [
6836
+ ].join(", "), To = [
6838
6837
  {
6839
6838
  family: "Arial",
6840
6839
  source: 'local("Arial"), local("Liberation Sans"), local("DejaVu Sans")',
@@ -7624,7 +7623,7 @@ const E = [
7624
7623
  unicodeRange: E
7625
7624
  }
7626
7625
  }
7627
- ], jo = {
7626
+ ], Eo = {
7628
7627
  /**
7629
7628
  * Опции редактора
7630
7629
  */
@@ -7716,10 +7715,10 @@ const E = [
7716
7715
  /**
7717
7716
  * Список шрифтов, которые будут доступны в редакторе по умолчанию.
7718
7717
  */
7719
- fonts: Ao
7718
+ fonts: To
7720
7719
  };
7721
- function Oo(h, t = {}) {
7722
- const e = B(B({}, jo), t), s = document.getElementById(h);
7720
+ function _o(h, t = {}) {
7721
+ const e = k(k({}, Eo), t), s = document.getElementById(h);
7723
7722
  if (!s)
7724
7723
  return Promise.reject(new Error(`Контейнер с ID "${h}" не найден.`));
7725
7724
  const o = document.createElement("canvas");
@@ -7730,6 +7729,6 @@ function Oo(h, t = {}) {
7730
7729
  });
7731
7730
  }
7732
7731
  export {
7733
- Oo as default
7732
+ _o as default
7734
7733
  };
7735
7734
  //# sourceMappingURL=main.js.map