@anu3ev/fabric-image-editor 0.5.32 → 0.5.34

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.
package/dist/main.js CHANGED
@@ -1,22 +1,22 @@
1
- var In = Object.defineProperty, Tn = Object.defineProperties;
2
- var On = Object.getOwnPropertyDescriptors;
3
- var ce = Object.getOwnPropertySymbols;
4
- var Ge = Object.prototype.hasOwnProperty, Ve = Object.prototype.propertyIsEnumerable;
5
- var Ze = (h, t, e) => t in h ? In(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, F = (h, t) => {
1
+ var On = Object.defineProperty, Tn = Object.defineProperties;
2
+ var En = Object.getOwnPropertyDescriptors;
3
+ var le = Object.getOwnPropertySymbols;
4
+ var Ve = Object.prototype.hasOwnProperty, Xe = Object.prototype.propertyIsEnumerable;
5
+ var Ge = (h, t, e) => t in h ? On(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, F = (h, t) => {
6
6
  for (var e in t || (t = {}))
7
- Ge.call(t, e) && Ze(h, e, t[e]);
8
- if (ce)
9
- for (var e of ce(t))
10
- Ve.call(t, e) && Ze(h, e, t[e]);
7
+ Ve.call(t, e) && Ge(h, e, t[e]);
8
+ if (le)
9
+ for (var e of le(t))
10
+ Xe.call(t, e) && Ge(h, e, t[e]);
11
11
  return h;
12
- }, Ot = (h, t) => Tn(h, On(t));
13
- var jt = (h, t) => {
12
+ }, Et = (h, t) => Tn(h, En(t));
13
+ var Ct = (h, t) => {
14
14
  var e = {};
15
15
  for (var n in h)
16
- Ge.call(h, n) && t.indexOf(n) < 0 && (e[n] = h[n]);
17
- if (h != null && ce)
18
- for (var n of ce(h))
19
- t.indexOf(n) < 0 && Ve.call(h, n) && (e[n] = h[n]);
16
+ Ve.call(h, n) && t.indexOf(n) < 0 && (e[n] = h[n]);
17
+ if (h != null && le)
18
+ for (var n of le(h))
19
+ t.indexOf(n) < 0 && Xe.call(h, n) && (e[n] = h[n]);
20
20
  return e;
21
21
  };
22
22
  var G = (h, t, e) => new Promise((n, s) => {
@@ -35,16 +35,16 @@ var G = (h, t, e) => new Promise((n, s) => {
35
35
  }, a = (r) => r.done ? n(r.value) : Promise.resolve(r.value).then(o, i);
36
36
  a((e = e.apply(h, t)).next());
37
37
  });
38
- import { ActiveSelection as X, Textbox as ct, util as vt, controlsUtils as Xe, InteractiveFabricObject as Ke, Point as lt, FitContentLayout as qe, loadSVGFromURL as En, FabricImage as Kt, Gradient as Je, Rect as Dn, Circle as Ln, Triangle as _n, Group as Nt, Color as xn, classRegistry as Qe, loadSVGFromString as Rn, Canvas as kn, Pattern as Bn } from "fabric";
39
- import { create as Nn } from "jsondiffpatch";
38
+ import { ActiveSelection as X, Textbox as ct, util as bt, controlsUtils as Ke, InteractiveFabricObject as qe, Point as lt, FitContentLayout as Je, loadSVGFromURL as _n, FabricImage as qt, Gradient as Qe, Rect as Ln, Circle as Dn, Triangle as xn, Group as Pt, Color as Rn, classRegistry as $e, loadSVGFromString as kn, Canvas as Bn, Pattern as Nn } from "fabric";
39
+ import { create as Pn } from "jsondiffpatch";
40
40
  import zn from "diff-match-patch";
41
- var Pn = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", et = function() {
41
+ var Fn = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", et = function() {
42
42
  for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21, e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0)); t--; )
43
- e += Pn[n[t] & 63];
43
+ e += Fn[n[t] & 63];
44
44
  return e;
45
45
  };
46
- const $e = 300;
47
- class Be {
46
+ const tn = 300;
47
+ class Ne {
48
48
  /**
49
49
  * Конструктор принимает редактор и опции.
50
50
  * @param params
@@ -52,7 +52,6 @@ class Be {
52
52
  * @param params.options — настройки редактора (см. defaults.js)
53
53
  * @param params.options.canvasDragging — включить перетаскивание канваса
54
54
  * @param params.options.mouseWheelZooming — включить зум колесом мыши
55
- * @param params.options.bringToFrontOnSelection — поднимать объект на передний план при выборе
56
55
  * @param params.options.copyObjectsByHotkey — копировать объекты по Ctrl+C
57
56
  * @param params.options.pasteImageFromClipboard — вставлять изображения и объекты из буфера обмена
58
57
  * @param params.options.undoRedoByHotKeys — отмена/повтор по Ctrl+Z/Ctrl+Y
@@ -62,7 +61,7 @@ class Be {
62
61
  * @param params.options.adaptCanvasToContainerOnResize — адаптировать канвас к размерам контейнера при изменении размеров окна
63
62
  */
64
63
  constructor({ editor: t, options: e = {} }) {
65
- this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, this.savedSelection = [], this.canvasDragging = !1, this.mouseWheelZooming = !1, this.bringToFrontOnSelection = !1, this.resetObjectFitByDoubleClick = !1, this.copyObjectsByHotkey = !1, this.pasteImageFromClipboard = !1, this.undoRedoByHotKeys = !1, this.selectAllByHotkey = !1, this.deleteObjectsByHotkey = !1, this.adaptCanvasToContainerOnResize = !1, this.editor = t, this.canvas = t.canvas, this.options = e, this.handleContainerResizeBound = Be.debounce(this.handleContainerResize.bind(this), 500), this.handleCopyEventBound = this.handleCopyEvent.bind(this), this.handlePasteEventBound = this.handlePasteEvent.bind(this), this.handleUndoRedoEventBound = this.handleUndoRedoEvent.bind(this), this.handleUndoRedoKeyUpBound = this.handleUndoRedoKeyUp.bind(this), this.handleSelectAllEventBound = this.handleSelectAllEvent.bind(this), this.handleDeleteObjectsEventBound = this.handleDeleteObjectsEvent.bind(this), this.handleSpaceKeyDownBound = this.handleSpaceKeyDown.bind(this), this.handleSpaceKeyUpBound = this.handleSpaceKeyUp.bind(this), this.handleObjectModifiedHistoryBound = this.handleObjectModifiedHistory.bind(this), this.handleObjectRotatingHistoryBound = this.handleObjectRotatingHistory.bind(this), this.handleObjectTransformStartBound = this.handleObjectTransformStart.bind(this), this.handleObjectTransformEndBound = this.handleObjectTransformEnd.bind(this), this.handleObjectAddedHistoryBound = this.handleObjectAddedHistory.bind(this), this.handleObjectRemovedHistoryBound = this.handleObjectRemovedHistory.bind(this), this.handleOverlayUpdateBound = this.handleOverlayUpdate.bind(this), this.handleBackgroundUpdateBound = this.handleBackgroundUpdate.bind(this), this.handleCanvasDragStartBound = this.handleCanvasDragStart.bind(this), this.handleCanvasDraggingBound = this.handleCanvasDragging.bind(this), this.handleCanvasDragEndBound = this.handleCanvasDragEnd.bind(this), this.handleMouseWheelZoomBound = this.handleMouseWheelZoom.bind(this), this.handleBringToFrontBound = this.handleBringToFront.bind(this), this.handleResetObjectFitBound = this.handleResetObjectFit.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.init();
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.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 = Ne.debounce(this.handleContainerResize.bind(this), 500), this.handleCopyEventBound = this.handleCopyEvent.bind(this), this.handlePasteEventBound = this.handlePasteEvent.bind(this), this.handleUndoRedoEventBound = this.handleUndoRedoEvent.bind(this), this.handleUndoRedoKeyUpBound = this.handleUndoRedoKeyUp.bind(this), this.handleSelectAllEventBound = this.handleSelectAllEvent.bind(this), this.handleDeleteObjectsEventBound = this.handleDeleteObjectsEvent.bind(this), this.handleSpaceKeyDownBound = this.handleSpaceKeyDown.bind(this), this.handleSpaceKeyUpBound = this.handleSpaceKeyUp.bind(this), this.handleObjectModifiedHistoryBound = this.handleObjectModifiedHistory.bind(this), this.handleObjectRotatingHistoryBound = this.handleObjectRotatingHistory.bind(this), this.handleObjectTransformStartBound = this.handleObjectTransformStart.bind(this), this.handleObjectTransformEndBound = this.handleObjectTransformEnd.bind(this), this.handleObjectAddedHistoryBound = this.handleObjectAddedHistory.bind(this), this.handleObjectRemovedHistoryBound = this.handleObjectRemovedHistory.bind(this), this.handleOverlayUpdateBound = this.handleOverlayUpdate.bind(this), this.handleBackgroundUpdateBound = this.handleBackgroundUpdate.bind(this), this.handleCanvasDragStartBound = this.handleCanvasDragStart.bind(this), this.handleCanvasDraggingBound = this.handleCanvasDragging.bind(this), this.handleCanvasDragEndBound = this.handleCanvasDragEnd.bind(this), this.handleMouseWheelZoomBound = this.handleMouseWheelZoom.bind(this), this.handleResetObjectFitBound = this.handleResetObjectFit.bind(this), this.init();
66
65
  }
67
66
  /**
68
67
  * Инициализация всех обработчиков согласно опциям.
@@ -72,49 +71,14 @@ class Be {
72
71
  adaptCanvasToContainerOnResize: t,
73
72
  canvasDragging: e,
74
73
  mouseWheelZooming: n,
75
- bringToFrontOnSelection: s,
76
- copyObjectsByHotkey: o,
77
- pasteImageFromClipboard: i,
78
- undoRedoByHotKeys: a,
79
- selectAllByHotkey: r,
80
- deleteObjectsByHotkey: c,
81
- resetObjectFitByDoubleClick: l
74
+ copyObjectsByHotkey: s,
75
+ pasteImageFromClipboard: o,
76
+ undoRedoByHotKeys: i,
77
+ selectAllByHotkey: a,
78
+ deleteObjectsByHotkey: r,
79
+ resetObjectFitByDoubleClick: c
82
80
  } = this.options;
83
- e && (this.canvas.on("mouse:down", this.handleCanvasDragStartBound), this.canvas.on("mouse:move", this.handleCanvasDraggingBound), this.canvas.on("mouse:up", this.handleCanvasDragEndBound), document.addEventListener("keydown", this.handleSpaceKeyDownBound, { capture: !0 }), document.addEventListener("keyup", this.handleSpaceKeyUpBound, { capture: !0 })), n && this.canvas.on("mouse:wheel", this.handleMouseWheelZoomBound), s && (this.canvas.on("selection:created", this.handleBringToFrontBound), this.canvas.on("selection:updated", this.handleBringToFrontBound)), l && this.canvas.on("mouse:dblclick", this.handleResetObjectFitBound), t && window.addEventListener("resize", this.handleContainerResizeBound, { capture: !0 }), o && document.addEventListener("keydown", this.handleCopyEventBound, { capture: !0 }), i && document.addEventListener("paste", this.handlePasteEventBound, { capture: !0 }), a && (document.addEventListener("keydown", this.handleUndoRedoEventBound, { capture: !0 }), document.addEventListener("keyup", this.handleUndoRedoKeyUpBound, { capture: !0 })), r && document.addEventListener("keydown", this.handleSelectAllEventBound, { capture: !0 }), c && document.addEventListener("keydown", this.handleDeleteObjectsEventBound, { capture: !0 }), this.canvas.on("object:modified", this.handleObjectModifiedHistoryBound), this.canvas.on("object:rotating", this.handleObjectRotatingHistoryBound), this.canvas.on("object:added", this.handleObjectAddedHistoryBound), this.canvas.on("object:removed", this.handleObjectRemovedHistoryBound), this.canvas.on("object:moving", this.handleObjectTransformStartBound), this.canvas.on("object:scaling", this.handleObjectTransformStartBound), this.canvas.on("object:rotating", this.handleObjectTransformStartBound), this.canvas.on("object:skewing", this.handleObjectTransformStartBound), this.canvas.on("object:resizing", this.handleObjectTransformStartBound), this.canvas.on("object:modified", this.handleObjectTransformEndBound), this.canvas.on("object:added", this.handleOverlayUpdateBound), this.canvas.on("selection:created", this.handleOverlayUpdateBound), this.canvas.on("selection:created", this.handleLockedSelectionBound), this.canvas.on("selection:updated", this.handleLockedSelectionBound), this.canvas.on("object:added", this.handleBackgroundUpdateBound), this.canvas.on("selection:created", this.handleBackgroundUpdateBound);
84
- }
85
- /**
86
- * При массовом выделении объектов удаляем из него залоченные.
87
- * @param params - параметры события
88
- * @param params.selected - массив выделенных объектов
89
- * @param params.e - событие указателя (опционально)
90
- */
91
- _filterLockedSelection({ selected: t, e }) {
92
- if (!(t != null && t.length) || !(e instanceof MouseEvent) || t.length === 1) return;
93
- const { lockedObjects: n, unlockedObjects: s } = t.reduce(
94
- (i, a) => a.locked ? (i.lockedObjects.push(a), i) : (i.unlockedObjects.push(a), i),
95
- { lockedObjects: [], unlockedObjects: [] }
96
- );
97
- if (n.length === 0) return;
98
- if (s.length > 0) {
99
- if (s.length === 1)
100
- this.canvas.setActiveObject(s[0]);
101
- else {
102
- const i = new X(s, {
103
- canvas: this.canvas
104
- });
105
- this.canvas.setActiveObject(i);
106
- }
107
- this.canvas.requestRenderAll();
108
- return;
109
- }
110
- const o = new X(t, {
111
- canvas: this.canvas
112
- });
113
- this.editor.objectLockManager.lockObject({
114
- object: o,
115
- skipInnerObjects: !0,
116
- withoutSave: !0
117
- }), this.canvas.setActiveObject(o), this.canvas.requestRenderAll();
81
+ e && (this.canvas.on("mouse:down", this.handleCanvasDragStartBound), this.canvas.on("mouse:move", this.handleCanvasDraggingBound), this.canvas.on("mouse:up", this.handleCanvasDragEndBound), document.addEventListener("keydown", this.handleSpaceKeyDownBound, { capture: !0 }), document.addEventListener("keyup", this.handleSpaceKeyUpBound, { capture: !0 })), n && this.canvas.on("mouse:wheel", this.handleMouseWheelZoomBound), c && this.canvas.on("mouse:dblclick", this.handleResetObjectFitBound), t && window.addEventListener("resize", this.handleContainerResizeBound, { capture: !0 }), s && document.addEventListener("keydown", this.handleCopyEventBound, { capture: !0 }), o && document.addEventListener("paste", this.handlePasteEventBound, { capture: !0 }), i && (document.addEventListener("keydown", this.handleUndoRedoEventBound, { capture: !0 }), document.addEventListener("keyup", this.handleUndoRedoKeyUpBound, { capture: !0 })), a && document.addEventListener("keydown", this.handleSelectAllEventBound, { capture: !0 }), r && document.addEventListener("keydown", this.handleDeleteObjectsEventBound, { capture: !0 }), this.canvas.on("object:modified", this.handleObjectModifiedHistoryBound), this.canvas.on("object:rotating", this.handleObjectRotatingHistoryBound), this.canvas.on("object:added", this.handleObjectAddedHistoryBound), this.canvas.on("object:removed", this.handleObjectRemovedHistoryBound), this.canvas.on("object:moving", this.handleObjectTransformStartBound), this.canvas.on("object:scaling", this.handleObjectTransformStartBound), this.canvas.on("object:rotating", this.handleObjectTransformStartBound), this.canvas.on("object:skewing", this.handleObjectTransformStartBound), this.canvas.on("object:resizing", this.handleObjectTransformStartBound), this.canvas.on("object:modified", this.handleObjectTransformEndBound), this.canvas.on("object:added", this.handleOverlayUpdateBound), this.canvas.on("selection:created", this.handleOverlayUpdateBound), this.canvas.on("object:added", this.handleBackgroundUpdateBound), this.canvas.on("selection:created", this.handleBackgroundUpdateBound);
118
82
  }
119
83
  /**
120
84
  * Обработчики для сохранения состояния редактора в истории.
@@ -123,14 +87,14 @@ class Be {
123
87
  handleObjectModifiedHistory() {
124
88
  const { historyManager: t, textManager: e } = this.editor;
125
89
  t.skipHistory || e.isTextEditingActive || t.scheduleSaveState({
126
- delayMs: $e,
90
+ delayMs: tn,
127
91
  reason: "object-modified"
128
92
  });
129
93
  }
130
94
  handleObjectRotatingHistory() {
131
95
  const { historyManager: t, textManager: e } = this.editor;
132
96
  t.skipHistory || e.isTextEditingActive || t.scheduleSaveState({
133
- delayMs: $e,
97
+ delayMs: tn,
134
98
  reason: "object-rotating"
135
99
  });
136
100
  }
@@ -354,23 +318,13 @@ class Be {
354
318
  const e = this._calculateAdaptiveZoomStep(t.deltaY);
355
319
  this.editor.zoomManager.handleMouseWheelZoom(e, t), t.preventDefault(), t.stopPropagation();
356
320
  }
357
- /**
358
- * Обработчик, поднимающий выделенные объекты на передний план.
359
- * @param event - объект события выделения
360
- * @param event.selected - массив выбранных объектов
361
- */
362
- handleBringToFront({ selected: t }) {
363
- t != null && t.length && t.forEach((e) => {
364
- this.editor.layerManager.bringToFront(e);
365
- });
366
- }
367
321
  /**
368
322
  * Обработчик сброса объекта по двойному клику.
369
323
  * @param options - объект события fabric
370
324
  */
371
325
  handleResetObjectFit(t) {
372
- const e = t == null ? void 0 : t.target;
373
- !e || e instanceof ct || this.editor.transformManager.resetObject({ object: e });
326
+ const { target: e, e: n } = t;
327
+ n && (n.ctrlKey || n.metaKey) || !e || e instanceof ct || this.editor.transformManager.resetObject({ object: e });
374
328
  }
375
329
  /**
376
330
  * Проверяет, должно ли событие клавиатуры быть проигнорировано
@@ -414,7 +368,7 @@ class Be {
414
368
  * Метод для удаления всех слушателей
415
369
  */
416
370
  destroy() {
417
- window.removeEventListener("resize", this.handleContainerResizeBound, { capture: !0 }), document.removeEventListener("keydown", this.handleCopyEventBound, { capture: !0 }), document.removeEventListener("paste", this.handlePasteEventBound, { capture: !0 }), document.removeEventListener("keydown", this.handleUndoRedoEventBound, { capture: !0 }), document.removeEventListener("keyup", this.handleUndoRedoKeyUpBound, { capture: !0 }), document.removeEventListener("keydown", this.handleSelectAllEventBound, { capture: !0 }), document.removeEventListener("keydown", this.handleDeleteObjectsEventBound, { capture: !0 }), this.options.canvasDragging && (this.canvas.off("mouse:down", this.handleCanvasDragStartBound), this.canvas.off("mouse:move", this.handleCanvasDraggingBound), this.canvas.off("mouse:up", this.handleCanvasDragEndBound), document.removeEventListener("keydown", this.handleSpaceKeyDownBound, { capture: !0 }), document.removeEventListener("keyup", this.handleSpaceKeyUpBound, { capture: !0 })), this.options.mouseWheelZooming && this.canvas.off("mouse:wheel", this.handleMouseWheelZoomBound), this.options.bringToFrontOnSelection && (this.canvas.off("selection:created", this.handleBringToFrontBound), this.canvas.off("selection:updated", this.handleBringToFrontBound)), this.options.resetObjectFitByDoubleClick && this.canvas.off("mouse:dblclick", this.handleResetObjectFitBound), this.canvas.off("object:modified", this.handleObjectModifiedHistoryBound), this.canvas.off("object:rotating", this.handleObjectRotatingHistoryBound), this.canvas.off("object:added", this.handleObjectAddedHistoryBound), this.canvas.off("object:removed", this.handleObjectRemovedHistoryBound), this.canvas.off("object:moving", this.handleObjectTransformStartBound), this.canvas.off("object:scaling", this.handleObjectTransformStartBound), this.canvas.off("object:rotating", this.handleObjectTransformStartBound), this.canvas.off("object:skewing", this.handleObjectTransformStartBound), this.canvas.off("object:resizing", this.handleObjectTransformStartBound), this.canvas.off("object:modified", this.handleObjectTransformEndBound), this.canvas.off("object:added", this.handleOverlayUpdateBound), this.canvas.off("selection:created", this.handleOverlayUpdateBound), this.canvas.off("object:added", this.handleBackgroundUpdateBound), this.canvas.off("selection:created", this.handleBackgroundUpdateBound), this.canvas.off("selection:created", this.handleLockedSelectionBound), this.canvas.off("selection:updated", this.handleLockedSelectionBound);
371
+ window.removeEventListener("resize", this.handleContainerResizeBound, { capture: !0 }), document.removeEventListener("keydown", this.handleCopyEventBound, { capture: !0 }), document.removeEventListener("paste", this.handlePasteEventBound, { capture: !0 }), document.removeEventListener("keydown", this.handleUndoRedoEventBound, { capture: !0 }), document.removeEventListener("keyup", this.handleUndoRedoKeyUpBound, { capture: !0 }), document.removeEventListener("keydown", this.handleSelectAllEventBound, { capture: !0 }), document.removeEventListener("keydown", this.handleDeleteObjectsEventBound, { capture: !0 }), this.options.canvasDragging && (this.canvas.off("mouse:down", this.handleCanvasDragStartBound), this.canvas.off("mouse:move", this.handleCanvasDraggingBound), this.canvas.off("mouse:up", this.handleCanvasDragEndBound), document.removeEventListener("keydown", this.handleSpaceKeyDownBound, { capture: !0 }), document.removeEventListener("keyup", this.handleSpaceKeyUpBound, { capture: !0 })), this.options.mouseWheelZooming && this.canvas.off("mouse:wheel", this.handleMouseWheelZoomBound), this.options.resetObjectFitByDoubleClick && this.canvas.off("mouse:dblclick", this.handleResetObjectFitBound), this.canvas.off("object:modified", this.handleObjectModifiedHistoryBound), this.canvas.off("object:rotating", this.handleObjectRotatingHistoryBound), this.canvas.off("object:added", this.handleObjectAddedHistoryBound), this.canvas.off("object:removed", this.handleObjectRemovedHistoryBound), this.canvas.off("object:moving", this.handleObjectTransformStartBound), this.canvas.off("object:scaling", this.handleObjectTransformStartBound), this.canvas.off("object:rotating", this.handleObjectTransformStartBound), this.canvas.off("object:skewing", this.handleObjectTransformStartBound), this.canvas.off("object:resizing", this.handleObjectTransformStartBound), this.canvas.off("object:modified", this.handleObjectTransformEndBound), this.canvas.off("object:added", this.handleOverlayUpdateBound), this.canvas.off("selection:created", this.handleOverlayUpdateBound), this.canvas.off("object:added", this.handleBackgroundUpdateBound), this.canvas.off("selection:created", this.handleBackgroundUpdateBound);
418
372
  }
419
373
  /**
420
374
  * Дебаунс для снижения частоты вызова функции.
@@ -431,7 +385,7 @@ class Be {
431
385
  };
432
386
  }
433
387
  }
434
- class Fn {
388
+ class Wn {
435
389
  /**
436
390
  * Класс для динамической загрузки внешних модулей.
437
391
  */
@@ -449,21 +403,21 @@ class Fn {
449
403
  return this.loaders[t] ? (this.cache.has(t) || this.cache.set(t, this.loaders[t]()), this.cache.get(t)) : Promise.reject(new Error(`Unknown module "${t}"`));
450
404
  }
451
405
  }
452
- function Wn(h) {
406
+ function Un(h) {
453
407
  return new Worker(
454
- "" + new URL("assets/worker-CN39s7P7.js", import.meta.url).href,
408
+ "" + new URL("assets/worker-2TM2HcqM.js", import.meta.url).href,
455
409
  {
456
410
  name: h == null ? void 0 : h.name
457
411
  }
458
412
  );
459
413
  }
460
- class Un {
414
+ class Yn {
461
415
  /**
462
416
  * @param scriptUrl — URL скрипта воркера.
463
417
  * По-умолчанию использует DefaultWorker из соседнего файла
464
418
  */
465
419
  constructor(t) {
466
- t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new Wn(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
420
+ t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new Un(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
467
421
  }
468
422
  /**
469
423
  * Обработчик сообщений от воркера
@@ -503,92 +457,92 @@ class Un {
503
457
  this.worker.terminate();
504
458
  }
505
459
  }
506
- const St = 12, Yn = 2, Ie = 8, Te = 20, Hn = 100, Oe = 20, Ee = 8, Zn = 100, ge = 32, Ne = 1, Gn = "#2B2D33", ze = "#3D8BF4", Pe = "#FFFFFF";
507
- function le(h, t, e, n, s) {
508
- const o = St, i = Yn;
509
- h.save(), h.translate(t, e), h.rotate(vt.degreesToRadians(s.angle)), h.fillStyle = Pe, h.strokeStyle = ze, h.lineWidth = Ne, h.beginPath(), h.roundRect(-o / 2, -o / 2, o, o, i), h.fill(), h.stroke(), h.restore();
510
- }
511
- function tn(h, t, e, n, s) {
512
- const o = Ie, i = Te, a = Hn;
513
- h.save(), h.translate(t, e), h.rotate(vt.degreesToRadians(s.angle)), h.fillStyle = Pe, h.strokeStyle = ze, h.lineWidth = Ne, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
460
+ const wt = 12, Hn = 2, Oe = 8, Te = 20, Zn = 100, Ee = 20, _e = 8, Gn = 100, pe = 32, Pe = 1, Vn = "#2B2D33", ze = "#3D8BF4", Fe = "#FFFFFF";
461
+ function de(h, t, e, n, s) {
462
+ const o = wt, i = Hn;
463
+ h.save(), h.translate(t, e), h.rotate(bt.degreesToRadians(s.angle)), h.fillStyle = Fe, h.strokeStyle = ze, h.lineWidth = Pe, h.beginPath(), h.roundRect(-o / 2, -o / 2, o, o, i), h.fill(), h.stroke(), h.restore();
514
464
  }
515
465
  function en(h, t, e, n, s) {
516
- const o = Oe, i = Ee, a = Zn;
517
- h.save(), h.translate(t, e), h.rotate(vt.degreesToRadians(s.angle)), h.fillStyle = Pe, h.strokeStyle = ze, h.lineWidth = Ne, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
466
+ const o = Oe, i = Te, a = Zn;
467
+ h.save(), h.translate(t, e), h.rotate(bt.degreesToRadians(s.angle)), h.fillStyle = Fe, h.strokeStyle = ze, h.lineWidth = Pe, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
468
+ }
469
+ function nn(h, t, e, n, s) {
470
+ const o = Ee, i = _e, a = Gn;
471
+ h.save(), h.translate(t, e), h.rotate(bt.degreesToRadians(s.angle)), h.fillStyle = Fe, h.strokeStyle = ze, h.lineWidth = Pe, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
518
472
  }
519
- const Vn = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", bn = new Image();
520
- bn.src = Vn;
521
- function Xn(h, t, e, n, s) {
522
- const i = ge / 2;
523
- h.save(), h.translate(t, e), h.rotate(vt.degreesToRadians(s.angle)), h.fillStyle = Gn, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(bn, -i / 2, -i / 2, i, i), h.restore();
473
+ const Xn = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", Mn = new Image();
474
+ Mn.src = Xn;
475
+ function Kn(h, t, e, n, s) {
476
+ const i = pe / 2;
477
+ h.save(), h.translate(t, e), h.rotate(bt.degreesToRadians(s.angle)), h.fillStyle = Vn, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(Mn, -i / 2, -i / 2, i, i), h.restore();
524
478
  }
525
- const Kn = {
479
+ const qn = {
526
480
  // Угловые точки
527
481
  tl: {
528
- render: le,
529
- sizeX: St,
530
- sizeY: St,
482
+ render: de,
483
+ sizeX: wt,
484
+ sizeY: wt,
531
485
  offsetX: 0,
532
486
  offsetY: 0
533
487
  },
534
488
  tr: {
535
- render: le,
536
- sizeX: St,
537
- sizeY: St,
489
+ render: de,
490
+ sizeX: wt,
491
+ sizeY: wt,
538
492
  offsetX: 0,
539
493
  offsetY: 0
540
494
  },
541
495
  bl: {
542
- render: le,
543
- sizeX: St,
544
- sizeY: St,
496
+ render: de,
497
+ sizeX: wt,
498
+ sizeY: wt,
545
499
  offsetX: 0,
546
500
  offsetY: 0
547
501
  },
548
502
  br: {
549
- render: le,
550
- sizeX: St,
551
- sizeY: St,
503
+ render: de,
504
+ sizeX: wt,
505
+ sizeY: wt,
552
506
  offsetX: 0,
553
507
  offsetY: 0
554
508
  },
555
509
  // Середина вертикалей
556
510
  ml: {
557
- render: tn,
558
- sizeX: Ie,
511
+ render: en,
512
+ sizeX: Oe,
559
513
  sizeY: Te,
560
514
  offsetX: 0,
561
515
  offsetY: 0
562
516
  },
563
517
  mr: {
564
- render: tn,
565
- sizeX: Ie,
518
+ render: en,
519
+ sizeX: Oe,
566
520
  sizeY: Te,
567
521
  offsetX: 0,
568
522
  offsetY: 0
569
523
  },
570
524
  // Середина горизонталей
571
525
  mt: {
572
- render: en,
573
- sizeX: Oe,
574
- sizeY: Ee,
526
+ render: nn,
527
+ sizeX: Ee,
528
+ sizeY: _e,
575
529
  offsetX: 0,
576
530
  offsetY: 0
577
531
  },
578
532
  mb: {
579
- render: en,
580
- sizeX: Oe,
581
- sizeY: Ee,
533
+ render: nn,
534
+ sizeX: Ee,
535
+ sizeY: _e,
582
536
  offsetX: 0,
583
537
  offsetY: 0
584
538
  },
585
539
  // Специальный «rotate» контрол
586
540
  mtr: {
587
- render: Xn,
588
- sizeX: ge,
589
- sizeY: ge,
541
+ render: Kn,
542
+ sizeX: pe,
543
+ sizeY: pe,
590
544
  offsetX: 0,
591
- offsetY: -ge
545
+ offsetY: -pe
592
546
  }
593
547
  };
594
548
  class ut {
@@ -607,7 +561,7 @@ class ut {
607
561
  * Применяет конфигурацию контролов к набору по ключам из DEFAULT_CONTROLS.
608
562
  */
609
563
  static applyControlOverrides(t) {
610
- Object.entries(Kn).forEach(([e, n]) => {
564
+ Object.entries(qn).forEach(([e, n]) => {
611
565
  const s = t[e];
612
566
  s && (Object.assign(s, n), e === "mtr" && (s.cursorStyle = "grab", s.mouseDownHandler = (o, i, a, r) => {
613
567
  var l;
@@ -620,10 +574,10 @@ class ut {
620
574
  * Регистрирует контролы и настройки поведения выделений.
621
575
  */
622
576
  static apply() {
623
- const t = Xe.createObjectDefaultControls();
624
- ut.applyControlOverrides(t), Ke.ownDefaults.controls = t;
625
- const e = Xe.createTextboxDefaultControls();
626
- ut.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), ut.wrapWidthControl(e.ml), ut.wrapWidthControl(e.mr), ct.ownDefaults.controls = e, ut.patchActiveSelectionBounds(), Ke.ownDefaults.snapAngle = 1;
577
+ const t = Ke.createObjectDefaultControls();
578
+ ut.applyControlOverrides(t), qe.ownDefaults.controls = t;
579
+ const e = Ke.createTextboxDefaultControls();
580
+ ut.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), ut.wrapWidthControl(e.ml), ut.wrapWidthControl(e.mr), ct.ownDefaults.controls = e, ut.patchActiveSelectionBounds(), qe.ownDefaults.snapAngle = 1;
627
581
  }
628
582
  /**
629
583
  * Обновляет алгоритм расчёта границ ActiveSelection, чтобы учитывать фон и отступы текстовых объектов.
@@ -670,8 +624,8 @@ class ut {
670
624
  height: f
671
625
  }), this.setPositionByOrigin(g, "center", "center"), this.setCoords(), a;
672
626
  };
673
- const s = qe.prototype.calcBoundingBox;
674
- qe.prototype.calcBoundingBox = function(o, i) {
627
+ const s = Je.prototype.calcBoundingBox;
628
+ Je.prototype.calcBoundingBox = function(o, i) {
675
629
  const { target: a, type: r, overrides: c } = i;
676
630
  if (r === "imperative" && c)
677
631
  return c;
@@ -894,8 +848,8 @@ V.registeredFontKeys = /* @__PURE__ */ new Set(), V.descriptorDefaults = {
894
848
  featureSettings: "normal",
895
849
  display: "auto"
896
850
  };
897
- let De = V;
898
- const qn = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Jn = "data:image/svg+xml;base64,PHN2ZyB4bW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EgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Jt = {
899
853
  style: {
900
854
  position: "absolute",
901
855
  display: "none",
@@ -962,14 +916,14 @@ const qn = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
962
916
  ],
963
917
  offsetTop: 50,
964
918
  icons: {
965
- copyPaste: qn,
966
- delete: ss,
967
- lock: Jn,
968
- unlock: Qn,
969
- bringToFront: es,
970
- sendToBack: ns,
971
- bringForward: $n,
972
- sendBackwards: ts
919
+ copyPaste: Jn,
920
+ delete: is,
921
+ lock: Qn,
922
+ unlock: $n,
923
+ bringToFront: ns,
924
+ sendToBack: ss,
925
+ bringForward: ts,
926
+ sendBackwards: es
973
927
  },
974
928
  handlers: {
975
929
  copyPaste: (h) => G(null, null, function* () {
@@ -998,18 +952,18 @@ const qn = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
998
952
  }
999
953
  }
1000
954
  };
1001
- class is {
955
+ class os {
1002
956
  constructor({ editor: t }) {
1003
957
  this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._initToolbar();
1004
958
  }
1005
959
  _initToolbar() {
1006
960
  if (!this.options.showToolbar) return;
1007
961
  const t = this.options.toolbar || {};
1008
- this.config = Ot(F(F({}, qt), t), {
1009
- style: F(F({}, qt.style), t.style || {}),
1010
- btnStyle: F(F({}, qt.btnStyle), t.btnStyle || {}),
1011
- icons: F(F({}, qt.icons), t.icons || {}),
1012
- handlers: F(F({}, qt.handlers), t.handlers || {})
962
+ this.config = Et(F(F({}, Jt), t), {
963
+ style: F(F({}, Jt.style), t.style || {}),
964
+ btnStyle: F(F({}, Jt.btnStyle), t.btnStyle || {}),
965
+ icons: F(F({}, Jt.icons), t.icons || {}),
966
+ handlers: F(F({}, Jt.handlers), t.handlers || {})
1013
967
  }), this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this._onMouseDown = this._handleMouseDown.bind(this), this._onObjectMoving = this._startTransform.bind(this), this._onObjectScaling = this._startTransform.bind(this), this._onObjectRotating = this._startTransform.bind(this), this._onMouseUp = this._endTransform.bind(this), this._onObjectModified = this._endTransform.bind(this), this._onSelectionChange = this._updateToolbar.bind(this), this._onSelectionClear = () => {
1014
968
  this.el.style.display = "none";
1015
969
  }, this._createDOM(), this._bindEvents();
@@ -1126,7 +1080,7 @@ class is {
1126
1080
  this.el.removeEventListener("mouseover", this._onBtnOver), this.el.removeEventListener("mouseout", this._onBtnOut), this.canvas.off("mouse:down", this._onMouseDown), this.canvas.off("object:moving", this._onObjectMoving), this.canvas.off("object:scaling", this._onObjectScaling), this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:created", this._onSelectionChange), this.canvas.off("selection:updated", this._onSelectionChange), this.canvas.off("after:render", this._onSelectionChange), this.canvas.off("selection:cleared", this._onSelectionClear), this.el.remove();
1127
1081
  }
1128
1082
  }
1129
- const os = {
1083
+ const as = {
1130
1084
  position: "absolute",
1131
1085
  display: "none",
1132
1086
  background: "#2B2D33",
@@ -1140,8 +1094,8 @@ const os = {
1140
1094
  "pointer-events": "none",
1141
1095
  "white-space": "nowrap",
1142
1096
  "box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
1143
- }, nn = 16, sn = 16, as = "fabric-editor-angle-indicator";
1144
- class Fe {
1097
+ }, sn = 16, on = 16, rs = "fabric-editor-angle-indicator";
1098
+ class We {
1145
1099
  constructor({ editor: t }) {
1146
1100
  this.isActive = !1, this.currentAngle = 0, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._createDOM(), this._bindEvents();
1147
1101
  }
@@ -1149,7 +1103,7 @@ class Fe {
1149
1103
  * Создание DOM-элемента индикатора
1150
1104
  */
1151
1105
  _createDOM() {
1152
- this.el = document.createElement("div"), this.el.className = as, Object.entries(os).forEach(([t, e]) => {
1106
+ this.el = document.createElement("div"), this.el.className = rs, Object.entries(as).forEach(([t, e]) => {
1153
1107
  this.el.style.setProperty(t, e);
1154
1108
  }), this.canvas.wrapperEl.appendChild(this.el);
1155
1109
  }
@@ -1169,7 +1123,7 @@ class Fe {
1169
1123
  return;
1170
1124
  }
1171
1125
  const n = e.angle || 0;
1172
- this.currentAngle = Fe._normalizeAngle(n), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
1126
+ this.currentAngle = We._normalizeAngle(n), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
1173
1127
  }
1174
1128
  /**
1175
1129
  * Обработчик отпускания кнопки мыши
@@ -1200,9 +1154,9 @@ class Fe {
1200
1154
  */
1201
1155
  _positionIndicator(t) {
1202
1156
  const e = this.canvas.wrapperEl.getBoundingClientRect();
1203
- let n = t.clientX - e.left + nn, s = t.clientY - e.top + sn;
1157
+ let n = t.clientX - e.left + sn, s = t.clientY - e.top + on;
1204
1158
  const o = this.el.getBoundingClientRect(), i = o.width, a = o.height;
1205
- n + i > e.width && (n = t.clientX - e.left - i - nn), s + a > e.height && (s = t.clientY - e.top - a - sn), this.el.style.left = `${n}px`, this.el.style.top = `${s}px`;
1159
+ n + i > e.width && (n = t.clientX - e.left - i - sn), s + a > e.height && (s = t.clientY - e.top - a - on), this.el.style.left = `${n}px`, this.el.style.top = `${s}px`;
1206
1160
  }
1207
1161
  /**
1208
1162
  * Показать индикатор
@@ -1233,12 +1187,13 @@ class Fe {
1233
1187
  this.canvas && (this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:cleared", this._onSelectionCleared)), (t = this.el) != null && t.parentNode && this.el.parentNode.removeChild(this.el), this.el = null, this.editor = null, this.canvas = null, this.options = null;
1234
1188
  }
1235
1189
  }
1236
- const Le = [
1190
+ const De = [
1237
1191
  "id",
1238
1192
  "backgroundId",
1239
1193
  "customData",
1240
1194
  "backgroundType",
1241
1195
  "format",
1196
+ "contentType",
1242
1197
  "width",
1243
1198
  "height",
1244
1199
  "locked",
@@ -1283,7 +1238,7 @@ class J {
1283
1238
  return this.patches[this.currentIndex - 1] || null;
1284
1239
  }
1285
1240
  _createDiffPatcher() {
1286
- this.diffPatcher = Nn({
1241
+ this.diffPatcher = Pn({
1287
1242
  objectHash(t) {
1288
1243
  return [JSON.stringify(t)].join("-");
1289
1244
  },
@@ -1368,7 +1323,7 @@ class J {
1368
1323
  */
1369
1324
  _serializeCanvasState() {
1370
1325
  const { canvas: t } = this;
1371
- return t.toDatalessObject([...Le]);
1326
+ return t.toDatalessObject([...De]);
1372
1327
  }
1373
1328
  /**
1374
1329
  * Обрабатывает срабатывание отложенного сохранения.
@@ -1429,7 +1384,7 @@ class J {
1429
1384
  this._isSavingState = !0, console.time("saveState");
1430
1385
  try {
1431
1386
  const t = this._withTemporaryUnlock(
1432
- () => this.canvas.toDatalessObject([...Le])
1387
+ () => this.canvas.toDatalessObject([...De])
1433
1388
  );
1434
1389
  if (console.timeEnd("saveState"), !this.baseState) {
1435
1390
  this.baseState = t, this.patches = [], this.currentIndex = 0, console.log("Базовое состояние сохранено.");
@@ -1822,7 +1777,7 @@ class J {
1822
1777
  }
1823
1778
  }
1824
1779
  }
1825
- const rs = 0.1, cs = 2, on = 0.1, ls = 90, Qt = 16, $t = 16, zt = 4096, Pt = 4096, an = "application/image-editor:", de = [
1780
+ const cs = 0.1, ls = 2, an = 0.1, ds = 90, $t = 16, te = 16, zt = 4096, Ft = 4096, rn = "application/image-editor:", he = [
1826
1781
  "format",
1827
1782
  "uppercase",
1828
1783
  "textCaseRaw",
@@ -1837,8 +1792,8 @@ const rs = 0.1, cs = 2, on = 0.1, ls = 90, Qt = 16, $t = 16, zt = 4096, Pt = 409
1837
1792
  "radiusBottomRight",
1838
1793
  "radiusBottomLeft",
1839
1794
  "lineFontDefaults"
1840
- ], ds = 50;
1841
- class pt {
1795
+ ], hs = 50;
1796
+ class mt {
1842
1797
  constructor({ editor: t }) {
1843
1798
  this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
1844
1799
  }
@@ -1867,14 +1822,14 @@ class pt {
1867
1822
  customData: c = null
1868
1823
  } = t;
1869
1824
  if (!e) return null;
1870
- const { canvas: l, montageArea: d, transformManager: u, historyManager: f, errorManager: g } = this.editor, m = yield this.getContentType(e), p = pt.getFormatFromContentType(m), { acceptContentTypes: y, acceptFormats: v } = this;
1825
+ const { canvas: l, montageArea: d, transformManager: u, historyManager: f, errorManager: g } = this.editor, m = yield this.getContentType(e), p = mt.getFormatFromContentType(m), { acceptContentTypes: y, acceptFormats: v } = this;
1871
1826
  if (!this.isAllowedContentType(m)) {
1872
- const C = `Неверный contentType для изображения: ${m}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1827
+ const A = `Неверный contentType для изображения: ${m}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1873
1828
  return g.emitError({
1874
1829
  origin: "ImageManager",
1875
1830
  method: "importImage",
1876
1831
  code: "INVALID_CONTENT_TYPE",
1877
- message: C,
1832
+ message: A,
1878
1833
  data: {
1879
1834
  source: e,
1880
1835
  format: p,
@@ -1891,12 +1846,12 @@ class pt {
1891
1846
  }
1892
1847
  f.suspendHistory();
1893
1848
  try {
1894
- let C, b;
1849
+ let A, b;
1895
1850
  if (e instanceof File)
1896
- C = URL.createObjectURL(e);
1851
+ A = URL.createObjectURL(e);
1897
1852
  else if (typeof e == "string") {
1898
- const I = yield (yield fetch(e, { mode: "cors" })).blob();
1899
- C = URL.createObjectURL(I);
1853
+ const C = yield (yield fetch(e, { mode: "cors" })).blob();
1854
+ A = URL.createObjectURL(C);
1900
1855
  } else
1901
1856
  return g.emitError({
1902
1857
  origin: "ImageManager",
@@ -1916,36 +1871,38 @@ class pt {
1916
1871
  customData: c
1917
1872
  }
1918
1873
  }), f.resumeHistory(), null;
1919
- if (this._createdBlobUrls.push(C), p === "svg") {
1920
- const w = yield En(C);
1921
- b = vt.groupSVGElements(w.objects, w.options);
1874
+ if (this._createdBlobUrls.push(A), p === "svg") {
1875
+ const w = yield _n(A);
1876
+ b = bt.groupSVGElements(w.objects, w.options);
1922
1877
  } else
1923
- b = yield Kt.fromURL(C, { crossOrigin: "anonymous" });
1924
- const { width: T, height: M } = b;
1925
- if (b instanceof Kt) {
1878
+ b = yield qt.fromURL(A, { crossOrigin: "anonymous" });
1879
+ const { width: O, height: S } = b;
1880
+ if (b instanceof qt) {
1926
1881
  const w = b.getElement();
1927
- let I = "";
1928
- if (w instanceof HTMLImageElement ? I = w.src : w instanceof HTMLCanvasElement && (I = w.toDataURL()), M > Pt || T > zt) {
1929
- const S = yield this.resizeImageToBoundaries({
1930
- dataURL: I,
1931
- sizeType: "max"
1932
- }), j = URL.createObjectURL(S);
1933
- this._createdBlobUrls.push(j), b = yield Kt.fromURL(j, { crossOrigin: "anonymous" });
1934
- } else if (M < $t || T < Qt) {
1935
- const S = yield this.resizeImageToBoundaries({
1936
- dataURL: I,
1937
- sizeType: "min"
1938
- }), j = URL.createObjectURL(S);
1939
- this._createdBlobUrls.push(j), b = yield Kt.fromURL(j, { crossOrigin: "anonymous" });
1882
+ let C = "";
1883
+ if (w instanceof HTMLImageElement ? C = w.src : w instanceof HTMLCanvasElement && (C = w.toDataURL()), S > Ft || O > zt) {
1884
+ const j = yield this.resizeImageToBoundaries({
1885
+ dataURL: C,
1886
+ sizeType: "max",
1887
+ contentType: m
1888
+ }), I = URL.createObjectURL(j);
1889
+ this._createdBlobUrls.push(I), b = yield qt.fromURL(I, { crossOrigin: "anonymous" });
1890
+ } else if (S < te || O < $t) {
1891
+ const j = yield this.resizeImageToBoundaries({
1892
+ dataURL: C,
1893
+ sizeType: "min",
1894
+ contentType: m
1895
+ }), I = URL.createObjectURL(j);
1896
+ this._createdBlobUrls.push(I), b = yield qt.fromURL(I, { crossOrigin: "anonymous" });
1940
1897
  }
1941
1898
  }
1942
- if (b.set("id", `${b.type}-${et()}`), b.set("format", p), b.set("customData", c || null), n === "scale-montage")
1899
+ if (b.set("id", `${b.type}-${et()}`), b.set("format", p), b.set("contentType", m), b.set("customData", c || null), n === "scale-montage")
1943
1900
  this.editor.canvasManager.scaleMontageAreaToImage({ object: b, withoutSave: !0 });
1944
1901
  else {
1945
- const { width: w, height: I } = d, S = this.calculateScaleFactor({ imageObject: b, scaleType: n });
1946
- n === "image-contain" && S < 1 ? u.fitObject({ object: b, type: "contain", withoutSave: !0 }) : n === "image-cover" && (T > w || M > I) && u.fitObject({ object: b, type: "cover", withoutSave: !0 });
1902
+ const { width: w, height: C } = d, j = this.calculateScaleFactor({ imageObject: b, scaleType: n });
1903
+ n === "image-contain" && j < 1 ? u.fitObject({ object: b, type: "contain", withoutSave: !0 }) : n === "image-cover" && (O > w || S > C) && u.fitObject({ object: b, type: "cover", withoutSave: !0 });
1947
1904
  }
1948
- const A = {
1905
+ const M = {
1949
1906
  image: b,
1950
1907
  format: p,
1951
1908
  contentType: m,
@@ -1958,13 +1915,13 @@ class pt {
1958
1915
  withoutAdding: r,
1959
1916
  customData: c
1960
1917
  };
1961
- return r ? (f.resumeHistory(), l.fire("editor:image-imported", A), A) : (l.add(b), l.centerObject(b), a || l.setActiveObject(b), l.renderAll(), f.resumeHistory(), s || f.saveState(), l.fire("editor:image-imported", A), A);
1962
- } catch (C) {
1918
+ return r ? (f.resumeHistory(), l.fire("editor:image-imported", M), M) : (l.add(b), l.centerObject(b), a || l.setActiveObject(b), l.renderAll(), f.resumeHistory(), s || f.saveState(), l.fire("editor:image-imported", M), M);
1919
+ } catch (A) {
1963
1920
  return g.emitError({
1964
1921
  origin: "ImageManager",
1965
1922
  method: "importImage",
1966
1923
  code: "IMPORT_FAILED",
1967
- message: `Ошибка импорта изображения: ${C.message}`,
1924
+ message: `Ошибка импорта изображения: ${A.message}`,
1968
1925
  data: {
1969
1926
  source: e,
1970
1927
  format: p,
@@ -1994,6 +1951,8 @@ class pt {
1994
1951
  * @param options.minHeight - минимальная высота (по умолчанию CANVAS_MIN_HEIGHT)
1995
1952
  * @param options.asBase64 - вернуть base64 вместо Blob
1996
1953
  * @param options.emitMessage - выводить предупреждение в случае ресайза
1954
+ * @param options.contentType - тип контента
1955
+ * @param options.quality - качество изображения от 0 до 1 (для JPEG/WebP)
1997
1956
  * @returns возвращает Promise с Blob или base64 в зависимости от опций
1998
1957
  */
1999
1958
  resizeImageToBoundaries(t) {
@@ -2001,40 +1960,44 @@ class pt {
2001
1960
  const {
2002
1961
  dataURL: e,
2003
1962
  sizeType: n = "max",
2004
- maxWidth: s = zt,
2005
- maxHeight: o = Pt,
2006
- minWidth: i = Qt,
2007
- minHeight: a = $t,
2008
- asBase64: r = !1,
2009
- emitMessage: c = !0
2010
- } = t, { errorManager: l, workerManager: d } = this.editor, u = {
1963
+ contentType: s = "image/png",
1964
+ quality: o = 1,
1965
+ maxWidth: i = zt,
1966
+ maxHeight: a = Ft,
1967
+ minWidth: r = $t,
1968
+ minHeight: c = te,
1969
+ asBase64: l = !1,
1970
+ emitMessage: d = !0
1971
+ } = t, { errorManager: u, workerManager: f } = this.editor, g = {
2011
1972
  dataURL: e,
2012
1973
  sizeType: n,
2013
- maxWidth: s,
2014
- maxHeight: o,
2015
- minWidth: i,
2016
- minHeight: a
1974
+ contentType: s,
1975
+ quality: o,
1976
+ maxWidth: i,
1977
+ maxHeight: a,
1978
+ minWidth: r,
1979
+ minHeight: c
2017
1980
  };
2018
- if (c) {
2019
- let g = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${s}x${o}`;
2020
- n === "min" && (g = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${i}x${a}`), l.emitWarning({
1981
+ if (d) {
1982
+ let p = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${i}x${a}`;
1983
+ n === "min" && (p = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${r}x${c}`), u.emitWarning({
2021
1984
  origin: "ImageManager",
2022
1985
  method: "resizeImageToBoundaries",
2023
1986
  code: "IMAGE_RESIZE_WARNING",
2024
- message: g,
2025
- data: u
1987
+ message: p,
1988
+ data: g
2026
1989
  });
2027
1990
  }
2028
- const f = yield d.post("resizeImage", u);
2029
- if (r) {
2030
- const g = yield this.getContentTypeFromUrl(e), p = pt.getFormatFromContentType(g) || "png", y = yield createImageBitmap(f);
2031
- return yield d.post(
1991
+ const m = yield f.post("resizeImage", g);
1992
+ if (l) {
1993
+ const p = yield createImageBitmap(m);
1994
+ return yield f.post(
2032
1995
  "toDataURL",
2033
- { format: p, quality: 1, bitmap: y },
2034
- [y]
1996
+ { contentType: s, quality: o, bitmap: p },
1997
+ [p]
2035
1998
  );
2036
1999
  }
2037
- return f;
2000
+ return m;
2038
2001
  });
2039
2002
  }
2040
2003
  /**
@@ -2057,22 +2020,22 @@ class pt {
2057
2020
  exportAsBlob: o = !1
2058
2021
  } = t, { canvas: i, montageArea: a, workerManager: r, interactionBlocker: c } = this.editor;
2059
2022
  try {
2060
- const l = n === "application/pdf", d = l ? "image/jpg" : n, u = pt.getFormatFromContentType(d);
2023
+ const l = n === "application/pdf", d = l ? "image/jpg" : n, u = mt.getFormatFromContentType(d);
2061
2024
  a.setCoords();
2062
2025
  const { left: f, top: g, width: m, height: p } = a.getBoundingRect(), y = yield i.clone(["id", "format", "locked"]);
2063
2026
  y.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(d) && (y.backgroundColor = "#ffffff");
2064
- const v = y.getObjects().find((S) => S.id === a.id);
2027
+ const v = y.getObjects().find((j) => j.id === a.id);
2065
2028
  if (v && (v.visible = !1), c != null && c.isBlocked) {
2066
- const S = y.getObjects().find((j) => j.id === c.overlayMask.id);
2067
- S && (S.visible = !1);
2029
+ const j = y.getObjects().find((I) => I.id === c.overlayMask.id);
2030
+ j && (j.visible = !1);
2068
2031
  }
2069
2032
  y.viewportTransform = [1, 0, 0, 1, -f, -g], y.setDimensions({ width: m, height: p }, { backstoreOnly: !0 }), y.renderAll();
2070
- const C = y.getObjects().filter((S) => S.format).every((S) => S.format === "svg");
2071
- if (u === "svg" && C) {
2072
- const S = y.toSVG();
2033
+ const A = y.getObjects().filter((j) => j.format).every((j) => j.format === "svg");
2034
+ if (u === "svg" && A) {
2035
+ const j = y.toSVG();
2073
2036
  y.dispose();
2074
- const O = {
2075
- image: pt._exportSVGStringAsFile(S, {
2037
+ const T = {
2038
+ image: mt._exportSVGStringAsFile(j, {
2076
2039
  exportAsBase64: s,
2077
2040
  exportAsBlob: o,
2078
2041
  fileName: e
@@ -2081,43 +2044,51 @@ class pt {
2081
2044
  contentType: "image/svg+xml",
2082
2045
  fileName: e.replace(/\.[^/.]+$/, ".svg")
2083
2046
  };
2084
- return i.fire("editor:canvas-exported", O), O;
2047
+ return i.fire("editor:canvas-exported", T), T;
2085
2048
  }
2086
- const b = yield new Promise((S, j) => {
2087
- y.getElement().toBlob((O) => {
2088
- O ? S(O) : j(new Error("Failed to create Blob from canvas"));
2089
- });
2049
+ const b = yield new Promise((j, I) => {
2050
+ y.getElement().toBlob(
2051
+ (T) => {
2052
+ T ? j(T) : I(new Error("Failed to create Blob from canvas"));
2053
+ },
2054
+ d,
2055
+ 1
2056
+ );
2090
2057
  });
2091
2058
  if (y.dispose(), o) {
2092
- const S = {
2059
+ const j = {
2093
2060
  image: b,
2094
2061
  format: u,
2095
2062
  contentType: d,
2096
2063
  fileName: e
2097
2064
  };
2098
- return i.fire("editor:canvas-exported", S), S;
2065
+ return i.fire("editor:canvas-exported", j), j;
2099
2066
  }
2100
- const T = yield createImageBitmap(b), M = yield r.post(
2067
+ const O = yield createImageBitmap(b), S = yield r.post(
2101
2068
  "toDataURL",
2102
- { format: u, quality: 1, bitmap: T },
2103
- [T]
2069
+ {
2070
+ contentType: d,
2071
+ quality: 1,
2072
+ bitmap: O
2073
+ },
2074
+ [O]
2104
2075
  );
2105
2076
  if (l) {
2106
- const j = m * 0.264583, O = p * 0.264583, k = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, D = new k({
2107
- orientation: j > O ? "landscape" : "portrait",
2077
+ const I = m * 0.264583, T = p * 0.264583, k = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, _ = new k({
2078
+ orientation: I > T ? "landscape" : "portrait",
2108
2079
  unit: "mm",
2109
- format: [j, O]
2080
+ format: [I, T]
2110
2081
  });
2111
- if (D.addImage(String(M), "JPG", 0, 0, j, O), s) {
2082
+ if (_.addImage(String(S), "JPG", 0, 0, I, T), s) {
2112
2083
  const B = {
2113
- image: D.output("datauristring"),
2084
+ image: _.output("datauristring"),
2114
2085
  format: "pdf",
2115
2086
  contentType: "application/pdf",
2116
2087
  fileName: e
2117
2088
  };
2118
2089
  return i.fire("editor:canvas-exported", B), B;
2119
2090
  }
2120
- const W = D.output("blob"), L = {
2091
+ const W = _.output("blob"), L = {
2121
2092
  image: new File([W], e, { type: "application/pdf" }),
2122
2093
  format: "pdf",
2123
2094
  contentType: "application/pdf",
@@ -2126,21 +2097,21 @@ class pt {
2126
2097
  return i.fire("editor:canvas-exported", L), L;
2127
2098
  }
2128
2099
  if (s) {
2129
- const S = {
2130
- image: M,
2100
+ const j = {
2101
+ image: S,
2131
2102
  format: u,
2132
2103
  contentType: d,
2133
2104
  fileName: e
2134
2105
  };
2135
- return i.fire("editor:canvas-exported", S), S;
2106
+ return i.fire("editor:canvas-exported", j), j;
2136
2107
  }
2137
- const A = u === "svg" && !C ? e.replace(/\.[^/.]+$/, ".png") : e, I = {
2138
- image: new File([b], A, { type: d }),
2108
+ const M = u === "svg" && !A ? e.replace(/\.[^/.]+$/, ".png") : e, C = {
2109
+ image: new File([b], M, { type: d }),
2139
2110
  format: u,
2140
2111
  contentType: d,
2141
- fileName: A
2112
+ fileName: M
2142
2113
  };
2143
- return i.fire("editor:canvas-exported", I), I;
2114
+ return i.fire("editor:canvas-exported", C), C;
2144
2115
  } catch (l) {
2145
2116
  return this.editor.errorManager.emitError({
2146
2117
  origin: "ImageManager",
@@ -2165,87 +2136,93 @@ class pt {
2165
2136
  */
2166
2137
  exportObjectAsImageFile() {
2167
2138
  return G(this, arguments, function* (t = {}) {
2139
+ var v;
2168
2140
  const {
2169
2141
  object: e,
2170
- fileName: n = "image.png",
2171
- contentType: s = "image/png",
2142
+ fileName: n,
2143
+ contentType: s,
2172
2144
  exportAsBase64: o = !1,
2173
2145
  exportAsBlob: i = !1
2174
- } = t, { canvas: a, workerManager: r } = this.editor, c = e || a.getActiveObject();
2146
+ } = t, { canvas: a, workerManager: r } = this.editor, c = e || a.getActiveObject(), l = s != null ? s : "image/png", d = mt.getFormatFromContentType(l) || "png", u = n != null ? n : `image.${d}`;
2175
2147
  if (!c)
2176
2148
  return this.editor.errorManager.emitError({
2177
2149
  origin: "ImageManager",
2178
2150
  method: "exportObjectAsImageFile",
2179
2151
  code: "NO_OBJECT_SELECTED",
2180
2152
  message: "Не выбран объект для экспорта",
2181
- data: { contentType: s, fileName: n, exportAsBase64: o, exportAsBlob: i }
2153
+ data: { contentType: l, fileName: u, exportAsBase64: o, exportAsBlob: i }
2182
2154
  }), null;
2155
+ const { contentType: f, format: g = "" } = c, m = (v = s != null ? s : f) != null ? v : "image/png", p = mt.getFormatFromContentType(m) || g || "png", y = n != null ? n : `image.${p}`;
2183
2156
  try {
2184
- const l = pt.getFormatFromContentType(s);
2185
- if (l === "svg") {
2186
- const m = c.toSVG(), p = pt._exportSVGStringAsFile(m, {
2157
+ if (p === "svg") {
2158
+ const M = c.toSVG(), w = mt._exportSVGStringAsFile(M, {
2187
2159
  exportAsBase64: o,
2188
2160
  exportAsBlob: i,
2189
- fileName: n
2190
- }), y = {
2161
+ fileName: y
2162
+ }), C = {
2191
2163
  object: c,
2192
- image: p,
2193
- format: l,
2164
+ image: w,
2165
+ format: p,
2194
2166
  contentType: "image/svg+xml",
2195
- fileName: n.replace(/\.[^/.]+$/, ".svg")
2167
+ fileName: y.replace(/\.[^/.]+$/, ".svg")
2196
2168
  };
2197
- return a.fire("editor:object-exported", y), y;
2169
+ return a.fire("editor:object-exported", C), C;
2198
2170
  }
2199
- if (o && c instanceof Kt) {
2200
- const m = yield createImageBitmap(c.getElement()), p = yield r.post(
2171
+ if (o && c instanceof qt) {
2172
+ const M = yield createImageBitmap(c.getElement()), w = yield r.post(
2201
2173
  "toDataURL",
2202
2174
  {
2203
- format: l,
2175
+ contentType: m,
2204
2176
  quality: 1,
2205
- bitmap: m
2177
+ bitmap: M
2206
2178
  },
2207
- [m]
2208
- ), y = {
2179
+ [M]
2180
+ ), C = {
2209
2181
  object: c,
2210
- image: p,
2211
- format: l,
2212
- contentType: s,
2213
- fileName: n
2182
+ image: w,
2183
+ format: p,
2184
+ contentType: m,
2185
+ fileName: y
2214
2186
  };
2215
- return a.fire("editor:object-exported", y), y;
2187
+ return a.fire("editor:object-exported", C), C;
2216
2188
  }
2217
- const d = c.toCanvasElement({
2189
+ const A = c.toCanvasElement({
2218
2190
  enableRetinaScaling: !1
2219
- }), u = yield new Promise((m, p) => {
2220
- d.toBlob((y) => {
2221
- y ? m(y) : p(new Error("Failed to create Blob from canvas"));
2191
+ }), b = yield new Promise((M, w) => {
2192
+ A.toBlob((C) => {
2193
+ C ? M(C) : w(new Error("Failed to create Blob from canvas"));
2222
2194
  });
2223
2195
  });
2224
2196
  if (i) {
2225
- const m = {
2197
+ const M = {
2226
2198
  object: c,
2227
- image: u,
2228
- format: l,
2229
- contentType: s,
2230
- fileName: n
2199
+ image: b,
2200
+ format: p,
2201
+ contentType: m,
2202
+ fileName: y
2231
2203
  };
2232
- return a.fire("editor:object-exported", m), m;
2204
+ return a.fire("editor:object-exported", M), M;
2233
2205
  }
2234
- const f = new File([u], n, { type: s }), g = {
2206
+ const O = new File([b], y, { type: m }), S = {
2235
2207
  object: c,
2236
- image: f,
2237
- format: l,
2238
- contentType: s,
2239
- fileName: n
2208
+ image: O,
2209
+ format: p,
2210
+ contentType: m,
2211
+ fileName: y
2240
2212
  };
2241
- return a.fire("editor:object-exported", g), g;
2242
- } catch (l) {
2213
+ return a.fire("editor:object-exported", S), S;
2214
+ } catch (A) {
2243
2215
  return this.editor.errorManager.emitError({
2244
2216
  origin: "ImageManager",
2245
2217
  method: "exportObjectAsImageFile",
2246
2218
  code: "IMAGE_EXPORT_FAILED",
2247
- message: `Ошибка экспорта объекта: ${l.message}`,
2248
- data: { contentType: s, fileName: n, exportAsBase64: o, exportAsBlob: i }
2219
+ message: `Ошибка экспорта объекта: ${A.message}`,
2220
+ data: {
2221
+ contentType: m,
2222
+ fileName: y,
2223
+ exportAsBase64: o,
2224
+ exportAsBlob: i
2225
+ }
2249
2226
  }), null;
2250
2227
  }
2251
2228
  });
@@ -2261,7 +2238,7 @@ class pt {
2261
2238
  * @returns массив допустимых форматов изображений
2262
2239
  */
2263
2240
  getAllowedFormatsFromContentTypes() {
2264
- return this.acceptContentTypes.map((t) => pt.getFormatFromContentType(t)).filter((t) => t);
2241
+ return this.acceptContentTypes.map((t) => mt.getFormatFromContentType(t)).filter((t) => t);
2265
2242
  }
2266
2243
  /**
2267
2244
  * Проверяет, является ли contentType допустимым типом изображения.
@@ -2314,7 +2291,7 @@ class pt {
2314
2291
  try {
2315
2292
  const s = (e = new URL(t).pathname.split(".").pop()) == null ? void 0 : e.toLowerCase(), o = {};
2316
2293
  return this.acceptContentTypes.forEach((i) => {
2317
- const a = pt.getFormatFromContentType(i);
2294
+ const a = mt.getFormatFromContentType(i);
2318
2295
  a && (o[a] = i);
2319
2296
  }), s && o[s] || "application/octet-stream";
2320
2297
  } catch (n) {
@@ -2367,11 +2344,11 @@ class pt {
2367
2344
  return e ? e[1] : "";
2368
2345
  }
2369
2346
  }
2370
- const Ct = (h, t, e) => Math.max(Math.min(h, e), t), rn = (h, t) => h * t, hs = (h, t) => new lt(h / 2, t / 2);
2371
- function us(h) {
2347
+ const It = (h, t, e) => Math.max(Math.min(h, e), t), cn = (h, t) => h * t, us = (h, t) => new lt(h / 2, t / 2);
2348
+ function fs(h) {
2372
2349
  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";
2373
2350
  }
2374
- class fs {
2351
+ class gs {
2375
2352
  /**
2376
2353
  * @param options
2377
2354
  * @param options.editor – экземпляр редактора
@@ -2391,11 +2368,11 @@ class fs {
2391
2368
  * Если точка находится за пределами монтажной области, она проецируется на ближайшую границу монтажной области.
2392
2369
  */
2393
2370
  getVisibleCenterPoint() {
2394
- const { canvas: t, montageArea: e } = this.editor, n = t.getZoom(), s = t.viewportTransform, o = t.getWidth(), i = t.getHeight(), a = (o / 2 - s[4]) / n, r = (i / 2 - s[5]) / n, c = e.width / 2, l = e.height / 2, d = Ct(
2371
+ const { canvas: t, montageArea: e } = this.editor, n = t.getZoom(), s = t.viewportTransform, o = t.getWidth(), i = t.getHeight(), a = (o / 2 - s[4]) / n, r = (i / 2 - s[5]) / n, c = e.width / 2, l = e.height / 2, d = It(
2395
2372
  a,
2396
2373
  e.left - c,
2397
2374
  e.left + c
2398
- ), u = Ct(
2375
+ ), u = It(
2399
2376
  r,
2400
2377
  e.top - l,
2401
2378
  e.top + l
@@ -2418,9 +2395,9 @@ class fs {
2418
2395
  canvas: o,
2419
2396
  montageArea: i,
2420
2397
  options: { canvasBackstoreWidth: a }
2421
- } = this.editor, { width: r, height: c } = i, l = Ct(Number(t), Qt, zt);
2398
+ } = this.editor, { width: r, height: c } = i, l = It(Number(t), $t, zt);
2422
2399
  if (!a || a === "auto" || s ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(l), i.set({ width: l }), (g = o.clipPath) == null || g.set({ width: l }), e) {
2423
- const m = l / r, p = rn(c, m);
2400
+ const m = l / r, p = cn(c, m);
2424
2401
  this.setResolutionHeight(p);
2425
2402
  return;
2426
2403
  }
@@ -2448,9 +2425,9 @@ class fs {
2448
2425
  canvas: o,
2449
2426
  montageArea: i,
2450
2427
  options: { canvasBackstoreHeight: a }
2451
- } = this.editor, { width: r, height: c } = i, l = Ct(Number(t), $t, Pt);
2428
+ } = this.editor, { width: r, height: c } = i, l = It(Number(t), te, Ft);
2452
2429
  if (!a || a === "auto" || s ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(l), i.set({ height: l }), (g = o.clipPath) == null || g.set({ height: l }), e) {
2453
- const m = l / c, p = rn(r, m);
2430
+ const m = l / c, p = cn(r, m);
2454
2431
  this.setResolutionWidth(p);
2455
2432
  return;
2456
2433
  }
@@ -2468,7 +2445,7 @@ class fs {
2468
2445
  */
2469
2446
  centerMontageArea() {
2470
2447
  var r;
2471
- const { canvas: t, montageArea: e } = this.editor, n = t.getWidth(), s = t.getHeight(), o = t.getZoom(), i = hs(n, s);
2448
+ const { canvas: t, montageArea: e } = this.editor, n = t.getWidth(), s = t.getHeight(), o = t.getZoom(), i = us(n, s);
2472
2449
  e.set({
2473
2450
  left: n / 2,
2474
2451
  top: s / 2
@@ -2501,7 +2478,7 @@ class fs {
2501
2478
  */
2502
2479
  setCanvasBackstoreWidth(t) {
2503
2480
  if (!t || typeof t != "number") return;
2504
- const e = Ct(t, Qt, zt);
2481
+ const e = It(t, $t, zt);
2505
2482
  this.editor.canvas.setDimensions({ width: e }, { backstoreOnly: !0 });
2506
2483
  }
2507
2484
  /**
@@ -2510,7 +2487,7 @@ class fs {
2510
2487
  */
2511
2488
  setCanvasBackstoreHeight(t) {
2512
2489
  if (!t || typeof t != "number") return;
2513
- const e = Ct(t, $t, Pt);
2490
+ const e = It(t, te, Ft);
2514
2491
  this.editor.canvas.setDimensions({ height: e }, { backstoreOnly: !0 });
2515
2492
  }
2516
2493
  /**
@@ -2519,7 +2496,7 @@ class fs {
2519
2496
  * с учётом минимальных и максимальных значений.
2520
2497
  */
2521
2498
  adaptCanvasToContainer() {
2522
- const { canvas: t } = this.editor, e = this.getEditorContainer(), n = e.clientWidth, s = e.clientHeight, o = Ct(n, Qt, zt), i = Ct(s, $t, Pt);
2499
+ const { canvas: t } = this.editor, e = this.getEditorContainer(), n = e.clientWidth, s = e.clientHeight, o = It(n, $t, zt), i = It(s, te, Ft);
2523
2500
  t.setDimensions({ width: o, height: i }, { backstoreOnly: !0 });
2524
2501
  }
2525
2502
  /**
@@ -2719,9 +2696,9 @@ class fs {
2719
2696
  montageAreaHeight: r
2720
2697
  }
2721
2698
  } = this.editor, c = t || s.getActiveObject();
2722
- if (!us(c)) return;
2699
+ if (!fs(c)) return;
2723
2700
  const { width: l, height: d } = c;
2724
- let u = Math.min(l, zt), f = Math.min(d, Pt);
2701
+ let u = Math.min(l, zt), f = Math.min(d, Ft);
2725
2702
  if (e) {
2726
2703
  const {
2727
2704
  width: g,
@@ -2779,7 +2756,7 @@ class fs {
2779
2756
  );
2780
2757
  }
2781
2758
  }
2782
- class gs {
2759
+ class ps {
2783
2760
  constructor({ editor: t }) {
2784
2761
  this.editor = t, this.options = t.options;
2785
2762
  }
@@ -2790,7 +2767,7 @@ class gs {
2790
2767
  * @param options.withoutSave - Не сохранять состояние
2791
2768
  * @fires editor:object-rotated
2792
2769
  */
2793
- rotate(t = ls, { withoutSave: e } = {}) {
2770
+ rotate(t = ds, { withoutSave: e } = {}) {
2794
2771
  const { canvas: n, historyManager: s } = this.editor, o = n.getActiveObject();
2795
2772
  if (!o) return;
2796
2773
  const i = o.angle + t;
@@ -2892,10 +2869,10 @@ class gs {
2892
2869
  */
2893
2870
  _fitSingleObject(t, e) {
2894
2871
  const { canvas: n, montageArea: s } = this.editor, { width: o, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, l = o * Math.abs(a), d = i * Math.abs(r), u = c * Math.PI / 180, f = Math.abs(Math.cos(u)), g = Math.abs(Math.sin(u)), m = l * f + d * g, p = l * g + d * f, y = s.width, v = s.height;
2895
- let C;
2896
- e === "contain" ? C = Math.min(y / m, v / p) : C = Math.max(y / m, v / p), t.set({
2897
- scaleX: a * C,
2898
- scaleY: r * C
2872
+ let A;
2873
+ e === "contain" ? A = Math.min(y / m, v / p) : A = Math.max(y / m, v / p), t.set({
2874
+ scaleX: a * A,
2875
+ scaleY: r * A
2899
2876
  }), n.centerObject(t);
2900
2877
  }
2901
2878
  /**
@@ -2945,9 +2922,9 @@ class gs {
2945
2922
  });
2946
2923
  }
2947
2924
  }
2948
- class ps {
2925
+ class ms {
2949
2926
  constructor({ editor: t }) {
2950
- this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || rs, this.maxZoom = this.options.maxZoom || cs, this.defaultZoom = this._normalizeDefaultZoom(this.options.defaultScale);
2927
+ this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || cs, this.maxZoom = this.options.maxZoom || ls, this.defaultZoom = this._normalizeDefaultZoom(this.options.defaultScale);
2951
2928
  }
2952
2929
  /**
2953
2930
  * Приводит значение defaultZoom к числу с двумя знаками после запятой, а также учитывает минимальное и максимальное значения.
@@ -3015,8 +2992,8 @@ class ps {
3015
2992
  _calculateEmptySpaceRatio(t) {
3016
2993
  const { canvas: e, montageArea: n } = this.editor, s = e.viewportTransform, o = e.getWidth(), i = e.getHeight(), a = n.left - n.width / 2, r = n.left + n.width / 2, c = n.top - n.height / 2, l = n.top + n.height / 2, d = -s[4] / t, u = (-s[4] + o) / t, f = -s[5] / t, g = (-s[5] + i) / t, m = d < a, p = u > r, y = f < c, v = g > l;
3017
2994
  if (!(m || p || y || v)) return 0;
3018
- const b = Math.max(0, a - d), T = Math.max(0, u - r), M = Math.max(0, c - f), A = Math.max(0, g - l), w = Math.max(b, T), I = Math.max(M, A), S = w / o, j = I / i;
3019
- return Math.max(S, j);
2995
+ const b = Math.max(0, a - d), O = Math.max(0, u - r), S = Math.max(0, c - f), M = Math.max(0, g - l), w = Math.max(b, O), C = Math.max(S, M), j = w / o, I = C / i;
2996
+ return Math.max(j, I);
3020
2997
  }
3021
2998
  /**
3022
2999
  * Вычисляет плавный шаг перемещения viewport к центру с ускорением
@@ -3032,8 +3009,8 @@ class ps {
3032
3009
  const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), l = i.getHeight(), d = t.x - r[4], u = t.y - r[5], f = Math.abs(s), g = e - n;
3033
3010
  if (Math.abs(g) / f <= 0.1)
3034
3011
  return { x: d, y: u };
3035
- const p = c / 2, y = l / 2, v = a.left, C = a.top, b = p - v * n, T = y - C * n, M = (b - r[4]) / (e - n), A = (T - r[5]) / (e - n), w = M * f, I = A * f, S = w * o, j = I * o, O = Math.abs(S) > Math.abs(d) ? d : S, k = Math.abs(j) > Math.abs(u) ? u : j;
3036
- return { x: O, y: k };
3012
+ const p = c / 2, y = l / 2, v = a.left, A = a.top, b = p - v * n, O = y - A * n, S = (b - r[4]) / (e - n), M = (O - r[5]) / (e - n), w = S * f, C = M * f, j = w * o, I = C * o, T = Math.abs(j) > Math.abs(d) ? d : j, k = Math.abs(I) > Math.abs(u) ? u : I;
3013
+ return { x: T, y: k };
3037
3014
  }
3038
3015
  /**
3039
3016
  * Применяет плавное центрирование viewport при приближении к defaultZoom.
@@ -3045,7 +3022,7 @@ class ps {
3045
3022
  * @returns true если центрирование было применено
3046
3023
  * @private
3047
3024
  */
3048
- _applyViewportCentering(t, e = !1, n = on) {
3025
+ _applyViewportCentering(t, e = !1, n = an) {
3049
3026
  const { canvas: s } = this.editor, o = this._getScaledMontageDimensions(t), i = s.getWidth(), a = s.getHeight(), r = o.width > i || o.height > a, c = this._calculateFitZoom(), l = t - c;
3050
3027
  if (!(!r || l) && !e)
3051
3028
  return !1;
@@ -3120,7 +3097,7 @@ class ps {
3120
3097
  * @param options.pointY - Координата Y точки зума
3121
3098
  * @fires editor:zoom-changed
3122
3099
  */
3123
- zoom(t = on, e = {}) {
3100
+ zoom(t = an, e = {}) {
3124
3101
  var f, g;
3125
3102
  if (!t) return;
3126
3103
  const { minZoom: n, maxZoom: s } = this, { canvas: o } = this.editor, i = t < 0, a = o.getZoom(), r = o.getCenterPoint(), c = (f = e.pointX) != null ? f : r.x, l = (g = e.pointY) != null ? g : r.y, d = new lt(c, l);
@@ -3158,7 +3135,7 @@ class ps {
3158
3135
  }), this.editor.panConstraintManager.updateBounds();
3159
3136
  }
3160
3137
  }
3161
- class ms {
3138
+ class ys {
3162
3139
  constructor({ editor: t }) {
3163
3140
  this.editor = t, this.isBlocked = !1, this.overlayMask = null, this._createOverlay();
3164
3141
  }
@@ -3215,7 +3192,7 @@ class ms {
3215
3192
  }), t.upperCanvasEl.style.pointerEvents = "", t.lowerCanvasEl.style.pointerEvents = "", this.overlayMask.visible = !1, t.requestRenderAll(), t.fire("editor:enabled"), n.resumeHistory();
3216
3193
  }
3217
3194
  }
3218
- class Ft {
3195
+ class Wt {
3219
3196
  constructor({ editor: t }) {
3220
3197
  this.editor = t, this.backgroundObject = null;
3221
3198
  }
@@ -3278,8 +3255,8 @@ class Ft {
3278
3255
  try {
3279
3256
  const { historyManager: i } = this.editor, { backgroundObject: a } = this;
3280
3257
  if (i.suspendHistory(), a && a.backgroundType === "gradient") {
3281
- const r = Ft._createFabricGradient(t);
3282
- if (Ft._isGradientEqual(a.fill, r)) {
3258
+ const r = Wt._createFabricGradient(t);
3259
+ if (Wt._isGradientEqual(a.fill, r)) {
3283
3260
  i.resumeHistory();
3284
3261
  return;
3285
3262
  }
@@ -3462,7 +3439,7 @@ class Ft {
3462
3439
  backgroundType: "gradient",
3463
3440
  backgroundId: `background-${et()}`
3464
3441
  }, { withoutSelection: !0 }), this.refresh();
3465
- const e = Ft._createFabricGradient(t);
3442
+ const e = Wt._createFabricGradient(t);
3466
3443
  this.backgroundObject.set("fill", e), this.editor.canvas.requestRenderAll();
3467
3444
  }
3468
3445
  /**
@@ -3522,8 +3499,8 @@ class Ft {
3522
3499
  { offset: 0, color: "#000000" },
3523
3500
  { offset: 1, color: "#ffffff" }
3524
3501
  ], t.type === "linear") {
3525
- const u = t.angle * Math.PI / 180, f = Ft._angleToCoords(u);
3526
- return new Je({
3502
+ const u = t.angle * Math.PI / 180, f = Wt._angleToCoords(u);
3503
+ return new Qe({
3527
3504
  type: "linear",
3528
3505
  gradientUnits: "percentage",
3529
3506
  coords: f,
@@ -3542,7 +3519,7 @@ class Ft {
3542
3519
  r1: 0,
3543
3520
  r2: l / 100
3544
3521
  };
3545
- return new Je({
3522
+ return new Qe({
3546
3523
  type: "radial",
3547
3524
  gradientUnits: "percentage",
3548
3525
  coords: d,
@@ -3577,7 +3554,7 @@ class Ft {
3577
3554
  }) ? !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;
3578
3555
  }
3579
3556
  }
3580
- class pe {
3557
+ class me {
3581
3558
  constructor({ editor: t }) {
3582
3559
  this.editor = t;
3583
3560
  }
@@ -3610,7 +3587,7 @@ class pe {
3610
3587
  const { canvas: n, historyManager: s } = this.editor;
3611
3588
  s.suspendHistory();
3612
3589
  const o = t || n.getActiveObject();
3613
- o && (o instanceof X ? pe._moveSelectionForward(n, o) : n.bringObjectForward(o), n.renderAll(), s.resumeHistory(), e || s.saveState(), n.fire("editor:object-bring-forward", {
3590
+ o && (o instanceof X ? me._moveSelectionForward(n, o) : n.bringObjectForward(o), n.renderAll(), s.resumeHistory(), e || s.saveState(), n.fire("editor:object-bring-forward", {
3614
3591
  object: o,
3615
3592
  withoutSave: e
3616
3593
  }));
@@ -3661,7 +3638,7 @@ class pe {
3661
3638
  } = this.editor;
3662
3639
  o.suspendHistory();
3663
3640
  const r = t || n.getActiveObject();
3664
- r && (r instanceof X ? pe._moveSelectionBackwards(n, r) : n.sendObjectBackwards(r), a && n.sendObjectToBack(a), n.sendObjectToBack(s), i && n.sendObjectToBack(i), n.renderAll(), o.resumeHistory(), e || o.saveState(), n.fire("editor:object-send-backwards", {
3641
+ r && (r instanceof X ? me._moveSelectionBackwards(n, r) : n.sendObjectBackwards(r), a && n.sendObjectToBack(a), n.sendObjectToBack(s), i && n.sendObjectToBack(i), n.renderAll(), o.resumeHistory(), e || o.saveState(), n.fire("editor:object-send-backwards", {
3665
3642
  object: r,
3666
3643
  withoutSave: e
3667
3644
  }));
@@ -3705,7 +3682,7 @@ class pe {
3705
3682
  });
3706
3683
  }
3707
3684
  }
3708
- class ys {
3685
+ class vs {
3709
3686
  /**
3710
3687
  * Менеджер фигур для редактора.
3711
3688
  * @param options - Опции и настройки менеджера фигур.
@@ -3737,7 +3714,7 @@ class ys {
3737
3714
  width: s = 100,
3738
3715
  height: o = 100,
3739
3716
  fill: i = "blue"
3740
- } = d, a = jt(d, [
3717
+ } = d, a = Ct(d, [
3741
3718
  "id",
3742
3719
  "left",
3743
3720
  "top",
@@ -3745,7 +3722,7 @@ class ys {
3745
3722
  "height",
3746
3723
  "fill"
3747
3724
  ]);
3748
- const { canvas: u } = this.editor, f = new Dn(F({
3725
+ const { canvas: u } = this.editor, f = new Ln(F({
3749
3726
  id: t,
3750
3727
  left: e,
3751
3728
  top: n,
@@ -3778,14 +3755,14 @@ class ys {
3778
3755
  top: n,
3779
3756
  radius: s = 50,
3780
3757
  fill: o = "green"
3781
- } = l, i = jt(l, [
3758
+ } = l, i = Ct(l, [
3782
3759
  "id",
3783
3760
  "left",
3784
3761
  "top",
3785
3762
  "radius",
3786
3763
  "fill"
3787
3764
  ]);
3788
- const { canvas: d } = this.editor, u = new Ln(F({
3765
+ const { canvas: d } = this.editor, u = new Dn(F({
3789
3766
  id: t,
3790
3767
  left: e,
3791
3768
  top: n,
@@ -3819,7 +3796,7 @@ class ys {
3819
3796
  width: s = 100,
3820
3797
  height: o = 100,
3821
3798
  fill: i = "yellow"
3822
- } = d, a = jt(d, [
3799
+ } = d, a = Ct(d, [
3823
3800
  "id",
3824
3801
  "left",
3825
3802
  "top",
@@ -3827,7 +3804,7 @@ class ys {
3827
3804
  "height",
3828
3805
  "fill"
3829
3806
  ]);
3830
- const { canvas: u } = this.editor, f = new _n(F({
3807
+ const { canvas: u } = this.editor, f = new xn(F({
3831
3808
  id: t,
3832
3809
  left: e,
3833
3810
  top: n,
@@ -3838,7 +3815,7 @@ class ys {
3838
3815
  return !e && !n && u.centerObject(f), c || (u.add(f), r || u.setActiveObject(f), u.renderAll()), f;
3839
3816
  }
3840
3817
  }
3841
- class vs {
3818
+ class bs {
3842
3819
  /**
3843
3820
  * @param options
3844
3821
  * @param options.editor - экземпляр редактора с доступом к canvas
@@ -3869,7 +3846,7 @@ class vs {
3869
3846
  return G(this, null, function* () {
3870
3847
  const { canvas: e, errorManager: n } = this.editor;
3871
3848
  try {
3872
- const s = yield t.clone(de);
3849
+ const s = yield t.clone(he);
3873
3850
  this.clipboard = s, e.fire("editor:object-copied", { object: s });
3874
3851
  } catch (s) {
3875
3852
  n.emitError({
@@ -3896,7 +3873,7 @@ class vs {
3896
3873
  message: "navigator.clipboard не поддерживается в этом браузере или отсутствует HTTPS-соединение."
3897
3874
  }), !1;
3898
3875
  try {
3899
- const n = t.toObject(de), s = JSON.stringify(n);
3876
+ const n = t.toObject(he), s = JSON.stringify(n);
3900
3877
  return t.type === "image" ? this._copyImageToClipboard(t, s) : this._copyTextToClipboard(s);
3901
3878
  } catch (n) {
3902
3879
  return e.emitError({
@@ -3937,7 +3914,7 @@ class vs {
3937
3914
  _copyTextToClipboard(t) {
3938
3915
  return G(this, null, function* () {
3939
3916
  try {
3940
- const e = `${an}${t}`;
3917
+ const e = `${rn}${t}`;
3941
3918
  return yield navigator.clipboard.writeText(e), console.info("Text copied to clipboard successfully"), !0;
3942
3919
  } catch (e) {
3943
3920
  const { errorManager: n } = this.editor;
@@ -3990,7 +3967,7 @@ class vs {
3990
3967
  const { canvas: e } = this.editor, n = t || e.getActiveObject();
3991
3968
  if (!n || n.locked) return !1;
3992
3969
  try {
3993
- const s = yield n.clone(de);
3970
+ const s = yield n.clone(he);
3994
3971
  return s instanceof X && s.forEachObject((o) => {
3995
3972
  o.set({
3996
3973
  id: `${o.type}-${et()}`,
@@ -4028,7 +4005,7 @@ class vs {
4028
4005
  return;
4029
4006
  }
4030
4007
  const n = t.getData("text/plain");
4031
- if (n && n.startsWith(an)) {
4008
+ if (n && n.startsWith(rn)) {
4032
4009
  this.paste();
4033
4010
  return;
4034
4011
  }
@@ -4076,7 +4053,7 @@ class vs {
4076
4053
  const { canvas: t } = this.editor;
4077
4054
  if (!this.clipboard) return !1;
4078
4055
  try {
4079
- const e = yield this.clipboard.clone(de);
4056
+ const e = yield this.clipboard.clone(he);
4080
4057
  return t.discardActiveObject(), e instanceof X && e.forEachObject((n) => {
4081
4058
  n.set({
4082
4059
  id: `${n.type}-${et()}`,
@@ -4101,7 +4078,7 @@ class vs {
4101
4078
  });
4102
4079
  }
4103
4080
  }
4104
- class me {
4081
+ class ye {
4105
4082
  constructor({ editor: t }) {
4106
4083
  this.editor = t;
4107
4084
  }
@@ -4127,7 +4104,7 @@ class me {
4127
4104
  editable: !1,
4128
4105
  locked: !0
4129
4106
  };
4130
- i.set(a), !e && me._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
4107
+ i.set(a), !e && ye._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
4131
4108
  c.set(a);
4132
4109
  }), i instanceof ct && i.isEditing && i.exitEditing(), s.renderAll(), n || o.saveState(), s.fire("editor:object-locked", {
4133
4110
  object: i,
@@ -4156,7 +4133,7 @@ class me {
4156
4133
  editable: !0,
4157
4134
  locked: !1
4158
4135
  };
4159
- o.set(i), me._isGroupOrSelection(o) && o.getObjects().forEach((a) => {
4136
+ o.set(i), ye._isGroupOrSelection(o) && o.getObjects().forEach((a) => {
4160
4137
  a.set(i);
4161
4138
  }), n.renderAll(), e || s.saveState(), n.fire("editor:object-unlocked", {
4162
4139
  object: o,
@@ -4164,10 +4141,10 @@ class me {
4164
4141
  });
4165
4142
  }
4166
4143
  static _isGroupOrSelection(t) {
4167
- return t instanceof X || t instanceof Nt;
4144
+ return t instanceof X || t instanceof Pt;
4168
4145
  }
4169
4146
  }
4170
- class bs {
4147
+ class Ms {
4171
4148
  constructor({ editor: t }) {
4172
4149
  this.editor = t;
4173
4150
  }
@@ -4187,20 +4164,20 @@ class bs {
4187
4164
  */
4188
4165
  _getGroupsToUngroup(t) {
4189
4166
  if (Array.isArray(t)) {
4190
- const n = t.filter((s) => s instanceof Nt);
4167
+ const n = t.filter((s) => s instanceof Pt);
4191
4168
  return n.length > 0 ? n : null;
4192
4169
  }
4193
4170
  if (t instanceof X) {
4194
- const n = t.getObjects().filter((s) => s instanceof Nt);
4171
+ const n = t.getObjects().filter((s) => s instanceof Pt);
4195
4172
  return n.length > 0 ? n : null;
4196
4173
  }
4197
4174
  const e = t || this.editor.canvas.getActiveObject();
4198
4175
  if (!e) return null;
4199
4176
  if (e instanceof X) {
4200
- const n = e.getObjects().filter((s) => s instanceof Nt);
4177
+ const n = e.getObjects().filter((s) => s instanceof Pt);
4201
4178
  return n.length > 0 ? n : null;
4202
4179
  }
4203
- return e instanceof Nt ? [e] : null;
4180
+ return e instanceof Pt ? [e] : null;
4204
4181
  }
4205
4182
  /**
4206
4183
  * Группировка объектов
@@ -4217,7 +4194,7 @@ class bs {
4217
4194
  if (!o) return null;
4218
4195
  try {
4219
4196
  s.suspendHistory();
4220
- const i = new Nt(o, {
4197
+ const i = new Pt(o, {
4221
4198
  id: `group-${et()}`
4222
4199
  });
4223
4200
  o.forEach((r) => n.remove(r)), n.add(i), n.setActiveObject(i), n.requestRenderAll();
@@ -4268,9 +4245,9 @@ class bs {
4268
4245
  }
4269
4246
  }
4270
4247
  }
4271
- class Ms {
4248
+ class ft {
4272
4249
  constructor({ editor: t }) {
4273
- this.editor = t;
4250
+ this.lastSelection = [], this.isCtrlSelectionBoxActive = !1, this.isSelectionMergeInProgress = !1, this.editor = t, this.selectionKey = this._resolveSelectionKey(), this.handleTextEditingEnteredBound = this._handleTextEditingEntered.bind(this), this.handleTextEditingExitedBound = this._handleTextEditingExited.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.handleSelectionMergeBound = this._handleSelectionMerge.bind(this), this.handleSelectionChangeBound = this._handleSelectionChange.bind(this), this.handleSelectionClearedBound = this._handleSelectionCleared.bind(this), this.handleSelectionBoxStartBound = this._handleSelectionBoxStart.bind(this), this.handleSelectionBoxEndBound = this._handleSelectionBoxEnd.bind(this), this._applySelectionKey({ selectionKey: this.selectionKey }), this._bindEvents();
4274
4251
  }
4275
4252
  /**
4276
4253
  * Выделить все объекты
@@ -4282,8 +4259,286 @@ class Ms {
4282
4259
  const s = e.getObjects(), o = s.some((a) => a.locked), i = s.length > 1 ? new X(e.getObjects(), { canvas: t }) : s[0];
4283
4260
  o && n.lockObject({ object: i, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(i), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: i });
4284
4261
  }
4262
+ /**
4263
+ * Снимает подписки SelectionManager.
4264
+ */
4265
+ destroy() {
4266
+ const { canvas: t } = this.editor;
4267
+ t.off("mouse:down", this.handleSelectionBoxStartBound), t.off("mouse:up", this.handleSelectionBoxEndBound), t.off("text:editing:entered", this.handleTextEditingEnteredBound), t.off("text:editing:exited", this.handleTextEditingExitedBound), t.off("selection:created", this.handleSelectionMergeBound), t.off("selection:updated", this.handleSelectionMergeBound), t.off("selection:created", this.handleLockedSelectionBound), t.off("selection:updated", this.handleLockedSelectionBound), t.off("selection:created", this.handleSelectionChangeBound), t.off("selection:updated", this.handleSelectionChangeBound), t.off("selection:cleared", this.handleSelectionClearedBound);
4268
+ }
4269
+ /**
4270
+ * Назначает ключ для мультивыделения.
4271
+ */
4272
+ _applySelectionKey({ selectionKey: t }) {
4273
+ const { canvas: e } = this.editor;
4274
+ e.selectionKey = t;
4275
+ }
4276
+ /**
4277
+ * Подписывается на события редактирования текста и выделения объектов.
4278
+ */
4279
+ _bindEvents() {
4280
+ const { canvas: t } = this.editor;
4281
+ t.on("text:editing:entered", this.handleTextEditingEnteredBound), t.on("text:editing:exited", this.handleTextEditingExitedBound), t.on("mouse:down", this.handleSelectionBoxStartBound), t.on("mouse:up", this.handleSelectionBoxEndBound), t.on("selection:created", this.handleSelectionMergeBound), t.on("selection:updated", this.handleSelectionMergeBound), t.on("selection:created", this.handleLockedSelectionBound), t.on("selection:updated", this.handleLockedSelectionBound), t.on("selection:created", this.handleSelectionChangeBound), t.on("selection:updated", this.handleSelectionChangeBound), t.on("selection:cleared", this.handleSelectionClearedBound);
4282
+ }
4283
+ /**
4284
+ * Отключает мультивыделение при входе в режим редактирования текста.
4285
+ */
4286
+ _handleTextEditingEntered(t) {
4287
+ this._applySelectionKey({ selectionKey: null });
4288
+ }
4289
+ /**
4290
+ * Восстанавливает мультивыделение после выхода из редактирования текста.
4291
+ */
4292
+ _handleTextEditingExited(t) {
4293
+ const { selectionKey: e } = this;
4294
+ this._applySelectionKey({ selectionKey: e });
4295
+ }
4296
+ /**
4297
+ * При массовом выделении объектов удаляет из него залоченные.
4298
+ * @param params - параметры события
4299
+ * @param params.selected - массив выделенных объектов
4300
+ * @param params.e - событие указателя (опционально)
4301
+ */
4302
+ _filterLockedSelection({ selected: t, e }) {
4303
+ const { editor: n } = this, { canvas: s } = n;
4304
+ if (!(e instanceof MouseEvent)) return;
4305
+ const o = s.getActiveObject();
4306
+ if (!o) return;
4307
+ const i = ft._collectSelectionObjects({ activeObject: o });
4308
+ if (i.length <= 1) return;
4309
+ const { lockedObjects: a, unlockedObjects: r } = ft._splitLockedObjects({ objects: i });
4310
+ if (a.length !== 0) {
4311
+ if (r.length > 0) {
4312
+ const c = t != null ? t : [];
4313
+ if (ft._shouldKeepLockedSelection({
4314
+ addedObjects: c,
4315
+ currentSelection: i,
4316
+ pointerEvent: e
4317
+ })) {
4318
+ this._applySelectionObjects({ objects: a }), s.requestRenderAll();
4319
+ return;
4320
+ }
4321
+ this._applySelectionObjects({ objects: r }), s.requestRenderAll();
4322
+ return;
4323
+ }
4324
+ this._applySelectionObjects({ objects: a }), s.requestRenderAll();
4325
+ }
4326
+ }
4327
+ /**
4328
+ * Объединяет выделение при выделении областью с зажатым Ctrl/Cmd.
4329
+ * @param params - параметры события
4330
+ * @param params.selected - массив новых объектов выделения
4331
+ * @param params.e - событие указателя (опционально)
4332
+ */
4333
+ _handleSelectionMerge({
4334
+ selected: t,
4335
+ e
4336
+ }) {
4337
+ const { canvas: n } = this.editor, { lastSelection: s, isCtrlSelectionBoxActive: o, isSelectionMergeInProgress: i } = this;
4338
+ if (i || !o || !(e instanceof MouseEvent)) return;
4339
+ const { ctrlKey: a, metaKey: r } = e;
4340
+ if (!!!(a || r) || s.length === 0 || t.length === 0) return;
4341
+ const l = n.getActiveObject(), d = ft._collectSelectionObjects({ activeObject: l });
4342
+ if (d.length === 0) return;
4343
+ const u = s, g = ft._isSelectionLockedOnly({ objects: u }) ? ft._filterLockedSelectionObjects({ objects: d }) : d, m = ft._mergeSelections({
4344
+ baseSelection: u,
4345
+ addedSelection: g
4346
+ });
4347
+ if (ft._areSelectionsEqual({
4348
+ left: m,
4349
+ right: d
4350
+ })) {
4351
+ this.isCtrlSelectionBoxActive = !1;
4352
+ return;
4353
+ }
4354
+ this.isSelectionMergeInProgress = !0, this._applySelectionObjects({ objects: m }), n.requestRenderAll(), this.isSelectionMergeInProgress = !1, this.isCtrlSelectionBoxActive = !1;
4355
+ }
4356
+ /**
4357
+ * Обрабатывает начало выделения областью при зажатом Ctrl/Cmd.
4358
+ * @param options - объект события fabric
4359
+ */
4360
+ _handleSelectionBoxStart({ e: t, target: e }) {
4361
+ if (!(t instanceof MouseEvent) || e) return;
4362
+ const { editor: n } = this, { canvas: s, textManager: o } = n;
4363
+ if (!s.selection || o.isTextEditingActive) return;
4364
+ const { ctrlKey: i, metaKey: a } = t;
4365
+ if (!!!(i || a)) return;
4366
+ const c = s.getActiveObject(), l = ft._collectSelectionObjects({ activeObject: c });
4367
+ this.lastSelection = l.slice(), this.isCtrlSelectionBoxActive = l.length > 0;
4368
+ }
4369
+ /**
4370
+ * Сбрасывает флаг выделения областью при зажатом Ctrl/Cmd.
4371
+ * @param options - объект события fabric
4372
+ */
4373
+ _handleSelectionBoxEnd({ e: t }) {
4374
+ t instanceof MouseEvent && (this.isCtrlSelectionBoxActive = !1);
4375
+ }
4376
+ /**
4377
+ * Сохраняет текущее выделение для возможного восстановления.
4378
+ */
4379
+ _handleSelectionChange() {
4380
+ const { canvas: t } = this.editor, e = t.getActiveObject(), n = ft._collectSelectionObjects({ activeObject: e });
4381
+ this.lastSelection = n.slice();
4382
+ }
4383
+ /**
4384
+ * Восстанавливает выделение при клике по пустой области с зажатым Ctrl/Cmd.
4385
+ * @param params - параметры события
4386
+ * @param params.e - событие указателя (опционально)
4387
+ */
4388
+ _handleSelectionCleared({ e: t }) {
4389
+ const { lastSelection: e } = this;
4390
+ if (e.length === 0) return;
4391
+ if (!(t instanceof MouseEvent)) {
4392
+ this.lastSelection = [];
4393
+ return;
4394
+ }
4395
+ const { ctrlKey: n, metaKey: s } = t;
4396
+ if (!!!(n || s)) {
4397
+ this.lastSelection = [];
4398
+ return;
4399
+ }
4400
+ const i = this._filterExistingObjects({ objects: e });
4401
+ if (i.length === 0) {
4402
+ this.lastSelection = [];
4403
+ return;
4404
+ }
4405
+ this._applySelectionObjects({ objects: i });
4406
+ }
4407
+ /**
4408
+ * Собирает объекты активного выделения.
4409
+ */
4410
+ static _collectSelectionObjects({ activeObject: t }) {
4411
+ return t ? t instanceof X ? t.getObjects() : [t] : [];
4412
+ }
4413
+ /**
4414
+ * Проверяет, что выборка состоит только из заблокированных объектов.
4415
+ */
4416
+ static _isSelectionLockedOnly({ objects: t }) {
4417
+ if (t.length === 0) return !1;
4418
+ for (const e of t)
4419
+ if (!e.locked) return !1;
4420
+ return !0;
4421
+ }
4422
+ /**
4423
+ * Оставляет только заблокированные объекты в выборке.
4424
+ */
4425
+ static _filterLockedSelectionObjects({ objects: t }) {
4426
+ const e = [];
4427
+ for (const n of t)
4428
+ n.locked && e.push(n);
4429
+ return e;
4430
+ }
4431
+ /**
4432
+ * Фильтрует объекты, которые ещё существуют на канвасе.
4433
+ */
4434
+ _filterExistingObjects({ objects: t }) {
4435
+ const { canvasManager: e } = this.editor, n = e.getObjects(), s = [];
4436
+ for (const o of t)
4437
+ n.includes(o) && s.push(o);
4438
+ return s;
4439
+ }
4440
+ /**
4441
+ * Проверяет равенство двух выборок без учёта порядка.
4442
+ */
4443
+ static _areSelectionsEqual({
4444
+ left: t,
4445
+ right: e
4446
+ }) {
4447
+ if (t.length !== e.length) return !1;
4448
+ if (t.length === 0) return !0;
4449
+ for (const n of t)
4450
+ if (!e.includes(n)) return !1;
4451
+ return !0;
4452
+ }
4453
+ /**
4454
+ * Объединяет список объектов без дубликатов.
4455
+ */
4456
+ static _mergeSelections({
4457
+ baseSelection: t,
4458
+ addedSelection: e
4459
+ }) {
4460
+ const n = [];
4461
+ for (const s of t)
4462
+ n.includes(s) || n.push(s);
4463
+ for (const s of e)
4464
+ n.includes(s) || n.push(s);
4465
+ return n;
4466
+ }
4467
+ /**
4468
+ * Делит объекты на заблокированные и доступные для редактирования.
4469
+ */
4470
+ static _splitLockedObjects({
4471
+ objects: t
4472
+ }) {
4473
+ const e = [], n = [];
4474
+ for (const s of t) {
4475
+ if (s.locked) {
4476
+ e.push(s);
4477
+ continue;
4478
+ }
4479
+ n.push(s);
4480
+ }
4481
+ return { lockedObjects: e, unlockedObjects: n };
4482
+ }
4483
+ /**
4484
+ * Определяет, нужно ли сохранить только заблокированное выделение при попытке добавить обычные объекты.
4485
+ */
4486
+ static _shouldKeepLockedSelection({
4487
+ addedObjects: t,
4488
+ currentSelection: e,
4489
+ pointerEvent: n
4490
+ }) {
4491
+ const { ctrlKey: s, metaKey: o } = n;
4492
+ if (!!!(s || o) || t.length === 0) return !1;
4493
+ let a = !1;
4494
+ for (const c of t)
4495
+ if (!c.locked) {
4496
+ a = !0;
4497
+ break;
4498
+ }
4499
+ if (!a) return !1;
4500
+ const r = [];
4501
+ for (const c of e)
4502
+ t.includes(c) || r.push(c);
4503
+ if (r.length === 0) return !1;
4504
+ for (const c of r)
4505
+ if (!c.locked) return !1;
4506
+ return !0;
4507
+ }
4508
+ /**
4509
+ * Применяет выделение и блокирует его, если в нём есть заблокированные объекты.
4510
+ */
4511
+ _applySelectionObjects({ objects: t }) {
4512
+ const { editor: e } = this, { canvas: n, objectLockManager: s } = e, o = this._filterExistingObjects({ objects: t });
4513
+ if (o.length === 0) return;
4514
+ if (o.length === 1) {
4515
+ n.setActiveObject(o[0]);
4516
+ return;
4517
+ }
4518
+ const i = new X(o, { canvas: n });
4519
+ ft._hasLockedObjects({ objects: o }) && s.lockObject({
4520
+ object: i,
4521
+ skipInnerObjects: !0,
4522
+ withoutSave: !0
4523
+ }), n.setActiveObject(i);
4524
+ }
4525
+ /**
4526
+ * Проверяет, есть ли среди объектов заблокированные.
4527
+ */
4528
+ static _hasLockedObjects({ objects: t }) {
4529
+ for (const e of t)
4530
+ if (e.locked) return !0;
4531
+ return !1;
4532
+ }
4533
+ /**
4534
+ * Определяет ключи для мультивыделения.
4535
+ */
4536
+ _resolveSelectionKey() {
4537
+ const { options: t } = this.editor, { selectionKey: e } = t;
4538
+ return e !== void 0 ? e : ["ctrlKey", "metaKey"];
4539
+ }
4285
4540
  }
4286
- class We {
4541
+ class Ue {
4287
4542
  constructor({ editor: t }) {
4288
4543
  this.editor = t;
4289
4544
  }
@@ -4330,7 +4585,7 @@ class We {
4330
4585
  n || o.suspendHistory();
4331
4586
  const r = [];
4332
4587
  if (a.forEach((l) => {
4333
- if (We._isUngroupableGroup(l)) {
4588
+ if (Ue._isUngroupableGroup(l)) {
4334
4589
  const d = this._handleGroupDeletion(l);
4335
4590
  r.push(...d);
4336
4591
  return;
@@ -4345,7 +4600,7 @@ class We {
4345
4600
  return s.fire("editor:objects-deleted", c), c;
4346
4601
  }
4347
4602
  }
4348
- const Dt = {
4603
+ const Lt = {
4349
4604
  IMAGE_MANAGER: {
4350
4605
  /**
4351
4606
  * Некорректный Content-Type изображения
@@ -4450,7 +4705,7 @@ const Dt = {
4450
4705
  APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
4451
4706
  }
4452
4707
  };
4453
- class te {
4708
+ class ee {
4454
4709
  constructor({ editor: t }) {
4455
4710
  this._buffer = [], this.editor = t;
4456
4711
  }
@@ -4477,7 +4732,7 @@ class te {
4477
4732
  * @fires editor:error
4478
4733
  */
4479
4734
  emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: n, data: s, message: o }) {
4480
- if (!te.isValidErrorCode(n)) {
4735
+ if (!ee.isValidErrorCode(n)) {
4481
4736
  console.warn("Неизвестный код ошибки: ", { code: n, origin: t, method: e });
4482
4737
  return;
4483
4738
  }
@@ -4506,7 +4761,7 @@ class te {
4506
4761
  * @fires editor:warning
4507
4762
  */
4508
4763
  emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: n, message: s, data: o }) {
4509
- if (!te.isValidErrorCode(n)) {
4764
+ if (!ee.isValidErrorCode(n)) {
4510
4765
  console.warn("Неизвестный код предупреждения: ", { code: n, origin: t, method: e });
4511
4766
  return;
4512
4767
  }
@@ -4529,7 +4784,7 @@ class te {
4529
4784
  * @returns true, если код допустим, иначе false
4530
4785
  */
4531
4786
  static isValidErrorCode(t) {
4532
- return t ? Object.values(Dt).some((e) => Object.values(e).includes(t)) : !1;
4787
+ return t ? Object.values(Lt).some((e) => Object.values(e).includes(t)) : !1;
4533
4788
  }
4534
4789
  }
4535
4790
  class Ss {
@@ -4625,16 +4880,16 @@ const ws = ({ textbox: h }) => {
4625
4880
  start: Math.min(t, e),
4626
4881
  end: Math.max(t, e)
4627
4882
  };
4628
- }, As = ({ textbox: h }) => {
4883
+ }, js = ({ textbox: h }) => {
4629
4884
  var e, n;
4630
4885
  const t = (n = (e = h.text) == null ? void 0 : e.length) != null ? n : 0;
4631
4886
  return t <= 0 ? null : { start: 0, end: t };
4632
- }, js = ({ textbox: h, range: t }) => {
4887
+ }, As = ({ textbox: h, range: t }) => {
4633
4888
  var n, s;
4634
4889
  if (!t) return !1;
4635
4890
  const e = (s = (n = h.text) == null ? void 0 : n.length) != null ? s : 0;
4636
4891
  return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
4637
- }, Se = ({
4892
+ }, we = ({
4638
4893
  textbox: h,
4639
4894
  styles: t,
4640
4895
  range: e
@@ -4642,7 +4897,7 @@ const ws = ({ textbox: h }) => {
4642
4897
  if (!t || !Object.keys(t).length) return !1;
4643
4898
  const { start: n, end: s } = e;
4644
4899
  return s <= n ? !1 : (h.setSelectionStyles(t, n, s), !0);
4645
- }, cn = ({
4900
+ }, ln = ({
4646
4901
  textbox: h,
4647
4902
  range: t,
4648
4903
  property: e
@@ -4656,11 +4911,11 @@ const ws = ({ textbox: h }) => {
4656
4911
  );
4657
4912
  if (n.length)
4658
4913
  return (s = n[0]) == null ? void 0 : s[e];
4659
- }, _e = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", xe = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, we = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", Mt = ({
4914
+ }, xe = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", Re = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, je = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", St = ({
4660
4915
  value: h,
4661
4916
  min: t,
4662
4917
  max: e
4663
- }) => Math.min(Math.max(h, t), e), Ut = class Ut extends ct {
4918
+ }) => Math.min(Math.max(h, t), e), Yt = class Yt extends ct {
4664
4919
  constructor(t, e = {}) {
4665
4920
  var n, s, o, i, a, r, c, l, d, u;
4666
4921
  super(t, e), this.backgroundOpacity = (n = e.backgroundOpacity) != null ? n : 1, this.lineFontDefaults = (s = e.lineFontDefaults) != null ? s : void 0, this.paddingTop = (o = e.paddingTop) != null ? o : 0, this.paddingRight = (i = e.paddingRight) != null ? i : 0, this.paddingBottom = (a = e.paddingBottom) != null ? a : 0, this.paddingLeft = (r = e.paddingLeft) != null ? r : 0, this.radiusTopLeft = (c = e.radiusTopLeft) != null ? c : 0, this.radiusTopRight = (l = e.radiusTopRight) != null ? l : 0, this.radiusBottomRight = (d = e.radiusBottomRight) != null ? d : 0, this.radiusBottomLeft = (u = e.radiusBottomLeft) != null ? u : 0, this._roundDimensions();
@@ -4685,7 +4940,7 @@ const ws = ({ textbox: h }) => {
4685
4940
  }
4686
4941
  _getTransformedDimensions(t = {}) {
4687
4942
  const { width: e, height: n } = this._getBackgroundDimensions();
4688
- return super._getTransformedDimensions(Ot(F({}, t), {
4943
+ return super._getTransformedDimensions(Et(F({}, t), {
4689
4944
  width: e,
4690
4945
  height: n
4691
4946
  }));
@@ -4695,7 +4950,7 @@ const ws = ({ textbox: h }) => {
4695
4950
  */
4696
4951
  toObject(t = []) {
4697
4952
  const e = super.toObject(t);
4698
- return Ot(F({}, e), {
4953
+ return Et(F({}, e), {
4699
4954
  backgroundOpacity: this.backgroundOpacity,
4700
4955
  lineFontDefaults: this.lineFontDefaults,
4701
4956
  paddingTop: this.paddingTop,
@@ -4713,7 +4968,7 @@ const ws = ({ textbox: h }) => {
4713
4968
  const e = this._getEffectiveBackgroundFill();
4714
4969
  if (e && e) {
4715
4970
  const o = this._getPadding(), i = (n = this.width) != null ? n : 0, a = (s = this.height) != null ? s : 0, r = i + o.left + o.right, c = a + o.top + o.bottom, l = this._getCornerRadii({ width: r, height: c }), d = this._getLeftOffset() - o.left, u = this._getTopOffset() - o.top;
4716
- t.save(), Ut._renderRoundedRect({
4971
+ t.save(), Yt._renderRoundedRect({
4717
4972
  ctx: t,
4718
4973
  height: c,
4719
4974
  left: d,
@@ -4748,42 +5003,42 @@ const ws = ({ textbox: h }) => {
4748
5003
  l += v;
4749
5004
  continue;
4750
5005
  }
4751
- const C = c[p], b = v / o, T = this._getLineLeftOffset(p);
4752
- let M = 0, A = 0, w = this.getValueOfPropertyAt(p, 0, e), I = this._getDecorationColorAt(p, 0), S = this.getValueOfPropertyAt(p, 0, "textDecorationThickness"), j = w, O = I, k = S;
4753
- const D = l + b * (1 - r);
5006
+ const A = c[p], b = v / o, O = this._getLineLeftOffset(p);
5007
+ let S = 0, M = 0, w = this.getValueOfPropertyAt(p, 0, e), C = this._getDecorationColorAt(p, 0), j = this.getValueOfPropertyAt(p, 0, "textDecorationThickness"), I = w, T = C, k = j;
5008
+ const _ = l + b * (1 - r);
4754
5009
  let W = this.getHeightOfChar(p, 0), E = this.getValueOfPropertyAt(p, 0, "deltaY");
4755
- for (let B = 0, P = C.length; B < P; B += 1) {
5010
+ for (let B = 0, z = A.length; B < z; B += 1) {
4756
5011
  const x = this.__charBounds[p][B];
4757
- j = this.getValueOfPropertyAt(p, B, e), O = this._getDecorationColorAt(p, B), k = this.getValueOfPropertyAt(p, B, "textDecorationThickness");
4758
- const _ = this.getHeightOfChar(p, B), R = this.getValueOfPropertyAt(p, B, "deltaY");
4759
- if (u && j && O) {
5012
+ I = this.getValueOfPropertyAt(p, B, e), T = this._getDecorationColorAt(p, B), k = this.getValueOfPropertyAt(p, B, "textDecorationThickness");
5013
+ const D = this.getHeightOfChar(p, B), R = this.getValueOfPropertyAt(p, B, "deltaY");
5014
+ if (u && I && T) {
4760
5015
  const N = s * k / 1e3;
4761
- t.save(), t.fillStyle = I, t.translate(x.renderLeft, x.renderTop), t.rotate(x.angle), t.fillRect(
5016
+ t.save(), t.fillStyle = C, t.translate(x.renderLeft, x.renderTop), t.rotate(x.angle), t.fillRect(
4762
5017
  -x.kernedWidth / 2,
4763
- g * _ + R - m * N,
5018
+ g * D + R - m * N,
4764
5019
  x.kernedWidth,
4765
5020
  N
4766
5021
  ), t.restore();
4767
- } else if ((j !== w || O !== I || _ !== W || k !== S || R !== E) && A > 0) {
4768
- const N = s * S / 1e3;
4769
- let K = d + T + M;
4770
- n === "rtl" && (K = a - K - A), w && I && S && (t.fillStyle = I, t.fillRect(
5022
+ } else if ((I !== w || T !== C || D !== W || k !== j || R !== E) && M > 0) {
5023
+ const N = s * j / 1e3;
5024
+ let K = d + O + S;
5025
+ n === "rtl" && (K = a - K - M), w && C && j && (t.fillStyle = C, t.fillRect(
4771
5026
  K,
4772
- D + g * W + E - m * N,
4773
- A,
5027
+ _ + g * W + E - m * N,
5028
+ M,
4774
5029
  N
4775
- )), M = x.left, A = x.width, w = j, S = k, I = O, W = _, E = R;
5030
+ )), S = x.left, M = x.width, w = I, j = k, C = T, W = D, E = R;
4776
5031
  } else
4777
- A += x.kernedWidth;
5032
+ M += x.kernedWidth;
4778
5033
  }
4779
- let L = d + T + M;
4780
- n === "rtl" && (L = a - L - A), t.fillStyle = O;
4781
- const z = s * k / 1e3;
4782
- j && O && k && t.fillRect(
5034
+ let L = d + O + S;
5035
+ n === "rtl" && (L = a - L - M), t.fillStyle = T;
5036
+ const P = s * k / 1e3;
5037
+ I && T && k && t.fillRect(
4783
5038
  L,
4784
- D + g * W + E - m * z,
4785
- A - f,
4786
- z
5039
+ _ + g * W + E - m * P,
5040
+ M - f,
5041
+ P
4787
5042
  ), l += v;
4788
5043
  }
4789
5044
  this._removeShadow(t);
@@ -4792,9 +5047,9 @@ const ws = ({ textbox: h }) => {
4792
5047
  * Возвращает цвет линии декорации для символа, учитывая обводку и заливку.
4793
5048
  */
4794
5049
  _getDecorationColorAt(t, e) {
4795
- const n = this.getValueOfPropertyAt(t, e, "strokeWidth"), s = xe({
5050
+ const n = this.getValueOfPropertyAt(t, e, "strokeWidth"), s = Re({
4796
5051
  width: typeof n == "number" && Number.isFinite(n) ? n : 0
4797
- }), o = this.getValueOfPropertyAt(t, e, "stroke"), i = o == null ? null : _e({ strokeColor: o, width: s });
5052
+ }), o = this.getValueOfPropertyAt(t, e, "stroke"), i = o == null ? null : xe({ strokeColor: o, width: s });
4798
5053
  if (s > 0 && i != null)
4799
5054
  return i;
4800
5055
  const a = this.getValueOfPropertyAt(t, e, "fill");
@@ -4812,10 +5067,10 @@ const ws = ({ textbox: h }) => {
4812
5067
  var i, a, r, c;
4813
5068
  const n = t / 2, s = e / 2, o = Math.min(n, s);
4814
5069
  return {
4815
- bottomLeft: Mt({ value: (i = this.radiusBottomLeft) != null ? i : 0, min: 0, max: o }),
4816
- bottomRight: Mt({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: o }),
4817
- topLeft: Mt({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: o }),
4818
- topRight: Mt({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: o })
5070
+ bottomLeft: St({ value: (i = this.radiusBottomLeft) != null ? i : 0, min: 0, max: o }),
5071
+ bottomRight: St({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: o }),
5072
+ topLeft: St({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: o }),
5073
+ topRight: St({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: o })
4819
5074
  };
4820
5075
  }
4821
5076
  _getPadding() {
@@ -4831,12 +5086,12 @@ const ws = ({ textbox: h }) => {
4831
5086
  var s;
4832
5087
  const t = this.backgroundColor;
4833
5088
  if (!t) return null;
4834
- const e = Mt({ value: (s = this.backgroundOpacity) != null ? s : 1, min: 0, max: 1 });
5089
+ const e = St({ value: (s = this.backgroundOpacity) != null ? s : 1, min: 0, max: 1 });
4835
5090
  let n;
4836
5091
  try {
4837
- n = new xn(t);
5092
+ n = new Rn(t);
4838
5093
  } catch (o) {
4839
- return te.emitError({
5094
+ return ee.emitError({
4840
5095
  origin: "BackgroundTextbox",
4841
5096
  method: "_getEffectiveBackgroundFill",
4842
5097
  code: "INVALID_COLOR_VALUE",
@@ -4859,7 +5114,7 @@ const ws = ({ textbox: h }) => {
4859
5114
  topRight: l,
4860
5115
  bottomRight: d,
4861
5116
  bottomLeft: u
4862
- } = s, f = Mt({ value: c, min: 0, max: i }), g = Mt({ value: l, min: 0, max: i }), m = Mt({ value: d, min: 0, max: i }), p = Mt({ value: u, min: 0, max: i });
5117
+ } = s, f = St({ value: c, min: 0, max: i }), g = St({ value: l, min: 0, max: i }), m = St({ value: d, min: 0, max: i }), p = St({ value: u, min: 0, max: i });
4863
5118
  t.beginPath(), t.moveTo(n + f, o), t.lineTo(a - g, o), t.quadraticCurveTo(a, o, a, o + g), t.lineTo(a, r - m), t.quadraticCurveTo(a, r, a - m, r), t.lineTo(n + p, r), t.quadraticCurveTo(n, r, n, r - p), t.lineTo(n, o + f), t.quadraticCurveTo(n, o, n + f, o), t.closePath();
4864
5119
  }
4865
5120
  /**
@@ -4873,7 +5128,7 @@ const ws = ({ textbox: h }) => {
4873
5128
  n !== t && (this.width = Math.max(0, n)), s !== e && (this.height = Math.max(0, s));
4874
5129
  }
4875
5130
  };
4876
- Ut.type = "background-textbox", Ut.cacheProperties = [
5131
+ Yt.type = "background-textbox", Yt.cacheProperties = [
4877
5132
  ...Array.isArray(ct.cacheProperties) ? ct.cacheProperties : [],
4878
5133
  "backgroundColor",
4879
5134
  "backgroundOpacity",
@@ -4886,7 +5141,7 @@ Ut.type = "background-textbox", Ut.cacheProperties = [
4886
5141
  "radiusTopRight",
4887
5142
  "radiusBottomRight",
4888
5143
  "radiusBottomLeft"
4889
- ], Ut.stateProperties = [
5144
+ ], Yt.stateProperties = [
4890
5145
  ...Array.isArray(ct.stateProperties) ? ct.stateProperties : [],
4891
5146
  "backgroundColor",
4892
5147
  "backgroundOpacity",
@@ -4900,11 +5155,11 @@ Ut.type = "background-textbox", Ut.cacheProperties = [
4900
5155
  "radiusBottomRight",
4901
5156
  "radiusBottomLeft"
4902
5157
  ];
4903
- let ye = Ut;
5158
+ let ve = Yt;
4904
5159
  const Cs = () => {
4905
5160
  var h;
4906
- (h = Qe) != null && h.setClass && Qe.setClass(ye, "background-textbox");
4907
- }, it = 0.01, ln = ({
5161
+ (h = $e) != null && h.setClass && $e.setClass(ve, "background-textbox");
5162
+ }, it = 0.01, dn = ({
4908
5163
  textbox: h,
4909
5164
  lineIndices: t,
4910
5165
  updates: e
@@ -4965,7 +5220,7 @@ const Cs = () => {
4965
5220
  lineStyles: l,
4966
5221
  changed: d
4967
5222
  };
4968
- }, dn = ({
5223
+ }, hn = ({
4969
5224
  lineFontDefaults: h
4970
5225
  }) => {
4971
5226
  if (!h) return;
@@ -4978,7 +5233,7 @@ const Cs = () => {
4978
5233
  s && (t[n] = F({}, s));
4979
5234
  }
4980
5235
  return t;
4981
- }, hn = ({
5236
+ }, un = ({
4982
5237
  lineFontDefaults: h,
4983
5238
  scale: t
4984
5239
  }) => {
@@ -4996,7 +5251,7 @@ const Cs = () => {
4996
5251
  }
4997
5252
  if (!(!n || !s))
4998
5253
  return e;
4999
- }, Ts = ({
5254
+ }, Os = ({
5000
5255
  textbox: h
5001
5256
  }) => {
5002
5257
  var o, i;
@@ -5010,7 +5265,7 @@ const Cs = () => {
5010
5265
  s = l + 1, n.push({ start: c, end: l });
5011
5266
  }
5012
5267
  return n;
5013
- }, Os = ({
5268
+ }, Ts = ({
5014
5269
  range: h,
5015
5270
  text: t
5016
5271
  }) => {
@@ -5023,7 +5278,7 @@ const Cs = () => {
5023
5278
  textbox: h,
5024
5279
  range: t
5025
5280
  }) => {
5026
- const e = Ts({ textbox: h });
5281
+ const e = Os({ textbox: h });
5027
5282
  if (!e.length) return t;
5028
5283
  let { start: n } = t, { end: s } = t;
5029
5284
  for (let o = 0; o < e.length; o += 1) {
@@ -5033,7 +5288,7 @@ const Cs = () => {
5033
5288
  t.end > a && t.start < r && (n = Math.min(n, a), s = Math.max(s, r));
5034
5289
  }
5035
5290
  return { start: n, end: s };
5036
- }, Ds = ({
5291
+ }, _s = ({
5037
5292
  textbox: h,
5038
5293
  range: t
5039
5294
  }) => {
@@ -5063,7 +5318,7 @@ const Cs = () => {
5063
5318
  n <= u && s >= f && i.push(l), a = f + 1;
5064
5319
  }
5065
5320
  return i;
5066
- }, _s = ({
5321
+ }, Ds = ({
5067
5322
  previous: h,
5068
5323
  next: t
5069
5324
  }) => {
@@ -5116,10 +5371,10 @@ const Cs = () => {
5116
5371
  return !1;
5117
5372
  let a = 0;
5118
5373
  return s < t ? a = t - s : o > e && (a = e - o), Math.abs(a) <= it ? !1 : (h.set({ left: ((d = h.left) != null ? d : 0) + a }), !0);
5119
- }, un = ({
5374
+ }, fn = ({
5120
5375
  rawValue: h,
5121
5376
  calculatedValue: t
5122
- }) => typeof h == "number" ? h : typeof t == "number" ? t : 0, fn = ({
5377
+ }) => typeof h == "number" ? h : typeof t == "number" ? t : 0, gn = ({
5123
5378
  stylesList: h
5124
5379
  }) => {
5125
5380
  const t = h.length;
@@ -5138,13 +5393,13 @@ const Cs = () => {
5138
5393
  if (s !== void 0 || o !== void 0 || i !== void 0 || a !== void 0 || r !== void 0 || c !== void 0) return !0;
5139
5394
  }
5140
5395
  return !1;
5141
- }, Et = ({
5396
+ }, _t = ({
5142
5397
  textbox: h
5143
5398
  }) => {
5144
- const { width: t, height: e, calcTextWidth: n, calcTextHeight: s } = h, o = typeof n == "function" ? n.call(h) : void 0, i = typeof s == "function" ? s.call(h) : void 0, a = un({
5399
+ const { width: t, height: e, calcTextWidth: n, calcTextHeight: s } = h, o = typeof n == "function" ? n.call(h) : void 0, i = typeof s == "function" ? s.call(h) : void 0, a = fn({
5145
5400
  rawValue: t,
5146
5401
  calculatedValue: o
5147
- }), r = un({
5402
+ }), r = fn({
5148
5403
  rawValue: e,
5149
5404
  calculatedValue: i
5150
5405
  }), c = Number.isFinite(a) ? Math.round(a) : null, l = Number.isFinite(r) ? Math.round(r) : null, d = {};
@@ -5171,7 +5426,7 @@ class rt {
5171
5426
  if (!rt._isTextbox(s) || this.lineDefaultsSyncing.has(s)) return;
5172
5427
  const { text: o = "", uppercase: i, autoExpand: a } = s, r = !!i, c = a !== !1, l = o.toLocaleLowerCase();
5173
5428
  if (r) {
5174
- const f = we({ value: l });
5429
+ const f = je({ value: l });
5175
5430
  f !== o && s.set({ text: f }), s.textCaseRaw = l;
5176
5431
  } else
5177
5432
  s.textCaseRaw = o;
@@ -5179,7 +5434,7 @@ class rt {
5179
5434
  let d = !1;
5180
5435
  c && (d = this._autoExpandTextboxWidth(s));
5181
5436
  let u = !1;
5182
- d || (u = Et({ textbox: s })), (d || u) && (s.setCoords(), s.dirty = !0), this._syncLineFontDefaultsOnTextChanged({ textbox: s });
5437
+ d || (u = _t({ textbox: s })), (d || u) && (s.setCoords(), s.dirty = !0), this._syncLineFontDefaultsOnTextChanged({ textbox: s });
5183
5438
  }, this._handleTextEditingExited = (n) => {
5184
5439
  var c, l, d;
5185
5440
  const { target: s } = n;
@@ -5191,13 +5446,13 @@ class rt {
5191
5446
  s.textCaseRaw = u;
5192
5447
  } else
5193
5448
  s.textCaseRaw = o;
5194
- Et({ textbox: s }) && (s.setCoords(), s.dirty = !0, this.canvas.requestRenderAll()), s.locked || s.set({
5449
+ _t({ textbox: s }) && (s.setCoords(), s.dirty = !0, this.canvas.requestRenderAll()), s.locked || s.set({
5195
5450
  lockMovementX: !1,
5196
5451
  lockMovementY: !1
5197
5452
  });
5198
5453
  const { historyManager: r } = this.editor;
5199
5454
  r.endAction({ reason: "text-edit" }), r.scheduleSaveState({
5200
- delayMs: ds,
5455
+ delayMs: hs,
5201
5456
  reason: "text-edit"
5202
5457
  });
5203
5458
  }, this._handleObjectResizing = (n) => {
@@ -5214,10 +5469,10 @@ class rt {
5214
5469
  s.set({ width: m });
5215
5470
  const { width: p = 0 } = s, y = g - p;
5216
5471
  if (y !== 0 && o && o.corner === "ml") {
5217
- const C = ((l = s.angle) != null ? l : 0) * Math.PI / 180, b = Math.cos(C), T = Math.sin(C), M = (d = s.scaleX) != null ? d : 1, A = y * M;
5472
+ const A = ((l = s.angle) != null ? l : 0) * Math.PI / 180, b = Math.cos(A), O = Math.sin(A), S = (d = s.scaleX) != null ? d : 1, M = y * S;
5218
5473
  s.set({
5219
- left: ((u = s.left) != null ? u : 0) + A * b,
5220
- top: ((f = s.top) != null ? f : 0) + A * T
5474
+ left: ((u = s.left) != null ? u : 0) + M * b,
5475
+ top: ((f = s.top) != null ? f : 0) + M * O
5221
5476
  });
5222
5477
  }
5223
5478
  }
@@ -5228,7 +5483,7 @@ class rt {
5228
5483
  event: i != null ? i : null
5229
5484
  });
5230
5485
  }, this._handleObjectScaling = (n) => {
5231
- var ne, ve, se, ie, oe, Rt, be, ae, Ht, Zt, Gt, Vt, Xt;
5486
+ var se, be, ie, oe, ae, kt, Me, re, Zt, Gt, Vt, Xt, Kt;
5232
5487
  const { target: s, transform: o } = n;
5233
5488
  if (s instanceof X || !rt._isTextbox(s) || !o) return;
5234
5489
  s.isScaling = !0;
@@ -5240,57 +5495,57 @@ class rt {
5240
5495
  baseRadii: d,
5241
5496
  baseStyles: u,
5242
5497
  baseLineFontDefaults: f
5243
- } = i, g = typeof ((ne = o.original) == null ? void 0 : ne.width) == "number" ? o.original.width : void 0, m = typeof ((ve = o.original) == null ? void 0 : ve.left) == "number" ? o.original.left : void 0, p = g != null ? g : a, y = m != null ? m : r, v = (se = o.corner) != null ? se : "", C = (ie = o.action) != null ? ie : "", b = ["ml", "mr"].includes(v) || C === "scaleX", T = ["mt", "mb"].includes(v) || C === "scaleY", M = ["tl", "tr", "bl", "br"].includes(v) || C === "scale", A = M || T;
5244
- if (!b && !T && !M) return;
5245
- const w = Math.abs((Rt = (oe = s.scaleX) != null ? oe : o.scaleX) != null ? Rt : 1) || 1, I = Math.abs((ae = (be = s.scaleY) != null ? be : o.scaleY) != null ? ae : 1) || 1, S = Math.max(1, p * w), j = Math.max(1, Math.round(S)), O = Math.max(1, c * I), {
5498
+ } = i, g = typeof ((se = o.original) == null ? void 0 : se.width) == "number" ? o.original.width : void 0, m = typeof ((be = o.original) == null ? void 0 : be.left) == "number" ? o.original.left : void 0, p = g != null ? g : a, y = m != null ? m : r, v = (ie = o.corner) != null ? ie : "", A = (oe = o.action) != null ? oe : "", b = ["ml", "mr"].includes(v) || A === "scaleX", O = ["mt", "mb"].includes(v) || A === "scaleY", S = ["tl", "tr", "bl", "br"].includes(v) || A === "scale", M = S || O;
5499
+ if (!b && !O && !S) return;
5500
+ const w = Math.abs((kt = (ae = s.scaleX) != null ? ae : o.scaleX) != null ? kt : 1) || 1, C = Math.abs((re = (Me = s.scaleY) != null ? Me : o.scaleY) != null ? re : 1) || 1, j = Math.max(1, p * w), I = Math.max(1, Math.round(j)), T = Math.max(1, c * C), {
5246
5501
  paddingTop: k = 0,
5247
- paddingRight: D = 0,
5502
+ paddingRight: _ = 0,
5248
5503
  paddingBottom: W = 0,
5249
5504
  paddingLeft: E = 0,
5250
5505
  radiusTopLeft: L = 0,
5251
- radiusTopRight: z = 0,
5506
+ radiusTopRight: P = 0,
5252
5507
  radiusBottomRight: B = 0,
5253
- radiusBottomLeft: P = 0,
5508
+ radiusBottomLeft: z = 0,
5254
5509
  fontSize: x,
5255
- width: _,
5510
+ width: D,
5256
5511
  originX: R = "left"
5257
- } = s, N = M || T, K = M || T, H = N ? {
5258
- top: Math.max(0, l.top * I),
5259
- right: Math.max(0, l.right * I),
5260
- bottom: Math.max(0, l.bottom * I),
5261
- left: Math.max(0, l.left * I)
5512
+ } = s, N = S || O, K = S || O, H = N ? {
5513
+ top: Math.max(0, l.top * C),
5514
+ right: Math.max(0, l.right * C),
5515
+ bottom: Math.max(0, l.bottom * C),
5516
+ left: Math.max(0, l.left * C)
5262
5517
  } : l, q = K ? {
5263
- topLeft: Math.max(0, d.topLeft * I),
5264
- topRight: Math.max(0, d.topRight * I),
5265
- bottomRight: Math.max(0, d.bottomRight * I),
5266
- bottomLeft: Math.max(0, d.bottomLeft * I)
5518
+ topLeft: Math.max(0, d.topLeft * C),
5519
+ topRight: Math.max(0, d.topRight * C),
5520
+ bottomRight: Math.max(0, d.bottomRight * C),
5521
+ bottomLeft: Math.max(0, d.bottomLeft * C)
5267
5522
  } : d, tt = Object.keys(u).length > 0;
5268
5523
  let at;
5269
- if (A && tt) {
5270
- const kt = {};
5271
- Object.entries(u).forEach(([re, Q]) => {
5524
+ if (M && tt) {
5525
+ const Bt = {};
5526
+ Object.entries(u).forEach(([ce, Q]) => {
5272
5527
  if (!Q) return;
5273
5528
  const st = {};
5274
- Object.entries(Q).forEach(([Me, Bt]) => {
5275
- if (!Bt) return;
5276
- const He = F({}, Bt);
5277
- typeof Bt.fontSize == "number" && (He.fontSize = Math.max(1, Bt.fontSize * I)), st[Me] = He;
5278
- }), Object.keys(st).length && (kt[re] = st);
5279
- }), Object.keys(kt).length && (at = kt);
5529
+ Object.entries(Q).forEach(([Se, Nt]) => {
5530
+ if (!Nt) return;
5531
+ const Ze = F({}, Nt);
5532
+ typeof Nt.fontSize == "number" && (Ze.fontSize = Math.max(1, Nt.fontSize * C)), st[Se] = Ze;
5533
+ }), Object.keys(st).length && (Bt[ce] = st);
5534
+ }), Object.keys(Bt).length && (at = Bt);
5280
5535
  }
5281
- let ft;
5282
- A && (ft = hn({
5536
+ let gt;
5537
+ M && (gt = un({
5283
5538
  lineFontDefaults: f,
5284
- scale: I
5539
+ scale: C
5285
5540
  }));
5286
- const wt = (Zt = (Ht = o.originX) != null ? Ht : R) != null ? Zt : "left", dt = y + p, ht = y + p / 2, It = _ != null ? _ : p, At = j !== It, Lt = Math.abs(O - (x != null ? x : c)) > it, _t = Math.abs(H.top - k) > it || Math.abs(H.right - D) > it || Math.abs(H.bottom - W) > it || Math.abs(H.left - E) > it, xt = Math.abs(q.topLeft - L) > it || Math.abs(q.topRight - z) > it || Math.abs(q.bottomRight - B) > it || Math.abs(q.bottomLeft - P) > it;
5287
- if (!At && !Lt && !_t && !xt) {
5541
+ const jt = (Gt = (Zt = o.originX) != null ? Zt : R) != null ? Gt : "left", dt = y + p, ht = y + p / 2, Ot = D != null ? D : p, At = I !== Ot, Dt = Math.abs(T - (x != null ? x : c)) > it, xt = Math.abs(H.top - k) > it || Math.abs(H.right - _) > it || Math.abs(H.bottom - W) > it || Math.abs(H.left - E) > it, Rt = Math.abs(q.topLeft - L) > it || Math.abs(q.topRight - P) > it || Math.abs(q.bottomRight - B) > it || Math.abs(q.bottomLeft - z) > it;
5542
+ if (!At && !Dt && !xt && !Rt) {
5288
5543
  s.set({ scaleX: 1, scaleY: 1 }), o.scaleX = 1, o.scaleY = 1;
5289
5544
  return;
5290
5545
  }
5291
- at && (s.styles = at), ft && (s.lineFontDefaults = ft), s.set({
5292
- width: j,
5293
- fontSize: A ? O : c,
5546
+ at && (s.styles = at), gt && (s.lineFontDefaults = gt), s.set({
5547
+ width: I,
5548
+ fontSize: M ? T : c,
5294
5549
  paddingTop: H.top,
5295
5550
  paddingRight: H.right,
5296
5551
  paddingBottom: H.bottom,
@@ -5302,13 +5557,13 @@ class rt {
5302
5557
  scaleX: 1,
5303
5558
  scaleY: 1
5304
5559
  });
5305
- const Yt = Et({ textbox: s });
5306
- Yt && (s.dirty = !0);
5307
- const gt = (Gt = s.width) != null ? Gt : j, ee = gt !== It;
5560
+ const Ht = _t({ textbox: s });
5561
+ Ht && (s.dirty = !0);
5562
+ const pt = (Vt = s.width) != null ? Vt : I, ne = pt !== Ot;
5308
5563
  let Tt = y;
5309
- ee && (b || M) && (wt === "right" ? Tt = dt - gt : wt === "center" && (Tt = ht - gt / 2)), s.set({ left: Tt }), i.baseLeft = Tt, o.scaleX = 1, o.scaleY = 1;
5310
- const { original: bt } = o;
5311
- bt && (bt.scaleX = 1, bt.scaleY = 1, bt.width = gt, bt.height = s.height, bt.left = Tt), s.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = gt, i.baseFontSize = (Vt = s.fontSize) != null ? Vt : O, i.baseStyles = JSON.parse(JSON.stringify((Xt = s.styles) != null ? Xt : {})), i.baseLineFontDefaults = dn({
5564
+ ne && (b || S) && (jt === "right" ? Tt = dt - pt : jt === "center" && (Tt = ht - pt / 2)), s.set({ left: Tt }), i.baseLeft = Tt, o.scaleX = 1, o.scaleY = 1;
5565
+ const { original: Mt } = o;
5566
+ Mt && (Mt.scaleX = 1, Mt.scaleY = 1, Mt.width = pt, Mt.height = s.height, Mt.left = Tt), s.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = pt, i.baseFontSize = (Xt = s.fontSize) != null ? Xt : T, i.baseStyles = JSON.parse(JSON.stringify((Kt = s.styles) != null ? Kt : {})), i.baseLineFontDefaults = hn({
5312
5567
  lineFontDefaults: s.lineFontDefaults
5313
5568
  }), i.basePadding = {
5314
5569
  top: H.top,
@@ -5320,71 +5575,71 @@ class rt {
5320
5575
  topRight: q.topRight,
5321
5576
  bottomRight: q.bottomRight,
5322
5577
  bottomLeft: q.bottomLeft
5323
- }, i.hasWidthChange = ee || Lt || _t || xt || Yt;
5578
+ }, i.hasWidthChange = ne || Dt || xt || Rt || Ht;
5324
5579
  }, this._handleObjectModified = (n) => {
5325
- var v, C, b;
5580
+ var v, A, b;
5326
5581
  const { target: s } = n;
5327
5582
  if (s instanceof X) {
5328
- const T = s.getObjects();
5329
- if (!T.some((S) => rt._isTextbox(S))) return;
5330
- const { scaleX: A = 1, scaleY: w = 1 } = s;
5331
- if (Math.abs(A - 1) < it && Math.abs(w - 1) < it) return;
5332
- this.canvas.discardActiveObject(), T.forEach((S) => {
5333
- var j, O, k, D;
5334
- if (rt._isTextbox(S)) {
5335
- const W = (j = S.scaleX) != null ? j : 1, E = (O = S.scaleY) != null ? O : 1, L = ((k = S.fontSize) != null ? k : 16) * E, z = ((D = S.width) != null ? D : 0) * W, B = E, {
5336
- paddingTop: P = 0,
5583
+ const O = s.getObjects();
5584
+ if (!O.some((j) => rt._isTextbox(j))) return;
5585
+ const { scaleX: M = 1, scaleY: w = 1 } = s;
5586
+ if (Math.abs(M - 1) < it && Math.abs(w - 1) < it) return;
5587
+ this.canvas.discardActiveObject(), O.forEach((j) => {
5588
+ var I, T, k, _;
5589
+ if (rt._isTextbox(j)) {
5590
+ const W = (I = j.scaleX) != null ? I : 1, E = (T = j.scaleY) != null ? T : 1, L = ((k = j.fontSize) != null ? k : 16) * E, P = ((_ = j.width) != null ? _ : 0) * W, B = E, {
5591
+ paddingTop: z = 0,
5337
5592
  paddingRight: x = 0,
5338
- paddingBottom: _ = 0,
5593
+ paddingBottom: D = 0,
5339
5594
  paddingLeft: R = 0,
5340
5595
  radiusTopLeft: N = 0,
5341
5596
  radiusTopRight: K = 0,
5342
5597
  radiusBottomRight: H = 0,
5343
5598
  radiusBottomLeft: q = 0,
5344
5599
  styles: tt
5345
- } = S, at = {
5346
- paddingTop: Math.max(0, P * B),
5600
+ } = j, at = {
5601
+ paddingTop: Math.max(0, z * B),
5347
5602
  paddingRight: Math.max(0, x * B),
5348
- paddingBottom: Math.max(0, _ * B),
5603
+ paddingBottom: Math.max(0, D * B),
5349
5604
  paddingLeft: Math.max(0, R * B)
5350
- }, ft = {
5605
+ }, gt = {
5351
5606
  radiusTopLeft: Math.max(0, N * B),
5352
5607
  radiusTopRight: Math.max(0, K * B),
5353
5608
  radiusBottomRight: Math.max(0, H * B),
5354
5609
  radiusBottomLeft: Math.max(0, q * B)
5355
5610
  };
5356
- let wt = tt;
5357
- tt && Object.keys(tt).length > 0 && (wt = JSON.parse(JSON.stringify(tt)), Object.values(wt).forEach((It) => {
5358
- Object.values(It).forEach((At) => {
5611
+ let jt = tt;
5612
+ tt && Object.keys(tt).length > 0 && (jt = JSON.parse(JSON.stringify(tt)), Object.values(jt).forEach((Ot) => {
5613
+ Object.values(Ot).forEach((At) => {
5359
5614
  typeof At.fontSize == "number" && (At.fontSize = Math.max(1, At.fontSize * B));
5360
5615
  });
5361
5616
  }));
5362
- const dt = hn({
5363
- lineFontDefaults: S.lineFontDefaults,
5617
+ const dt = un({
5618
+ lineFontDefaults: j.lineFontDefaults,
5364
5619
  scale: B
5365
- }), ht = Ot(F(F({
5620
+ }), ht = Et(F(F({
5366
5621
  fontSize: L,
5367
- width: z,
5622
+ width: P,
5368
5623
  scaleX: 1,
5369
5624
  scaleY: 1
5370
- }, at), ft), {
5371
- styles: wt
5625
+ }, at), gt), {
5626
+ styles: jt
5372
5627
  });
5373
- dt && (ht.lineFontDefaults = dt), S.set(ht), Et({ textbox: S });
5628
+ dt && (ht.lineFontDefaults = dt), j.set(ht), _t({ textbox: j });
5374
5629
  }
5375
- S.setCoords();
5630
+ j.setCoords();
5376
5631
  });
5377
- const I = new X(T, {
5632
+ const C = new X(O, {
5378
5633
  canvas: this.canvas
5379
5634
  });
5380
- this.canvas.setActiveObject(I), this.canvas.requestRenderAll();
5635
+ this.canvas.setActiveObject(C), this.canvas.requestRenderAll();
5381
5636
  return;
5382
5637
  }
5383
5638
  if (!rt._isTextbox(s)) return;
5384
5639
  s.isScaling = !1;
5385
5640
  const o = this.scalingState.get(s);
5386
5641
  if (this.scalingState.delete(s), !(o != null && o.hasWidthChange)) return;
5387
- const i = (v = s.width) != null ? v : s.calcTextWidth(), a = (b = (C = s.fontSize) != null ? C : o == null ? void 0 : o.baseFontSize) != null ? b : 16, r = !!(o.baseStyles && Object.keys(o.baseStyles).length), {
5642
+ const i = (v = s.width) != null ? v : s.calcTextWidth(), a = (b = (A = s.fontSize) != null ? A : o == null ? void 0 : o.baseFontSize) != null ? b : 16, r = !!(o.baseStyles && Object.keys(o.baseStyles).length), {
5388
5643
  paddingTop: c = 0,
5389
5644
  paddingRight: l = 0,
5390
5645
  paddingBottom: d = 0,
@@ -5415,8 +5670,8 @@ class rt {
5415
5670
  * @param options — настройки текста
5416
5671
  * @param flags — флаги поведения
5417
5672
  */
5418
- addText(D = {}, { withoutSelection: j = !1, withoutSave: O = !1, withoutAdding: k = !1 } = {}) {
5419
- var W = D, {
5673
+ addText(_ = {}, { withoutSelection: I = !1, withoutSave: T = !1, withoutAdding: k = !1 } = {}) {
5674
+ var W = _, {
5420
5675
  id: t = `text-${et()}`,
5421
5676
  text: e = "Новый текст",
5422
5677
  autoExpand: n = !0,
@@ -5435,14 +5690,14 @@ class rt {
5435
5690
  backgroundColor: p,
5436
5691
  backgroundOpacity: y = 1,
5437
5692
  paddingTop: v = 0,
5438
- paddingRight: C = 0,
5693
+ paddingRight: A = 0,
5439
5694
  paddingBottom: b = 0,
5440
- paddingLeft: T = 0,
5441
- radiusTopLeft: M = 0,
5442
- radiusTopRight: A = 0,
5695
+ paddingLeft: O = 0,
5696
+ radiusTopLeft: S = 0,
5697
+ radiusTopRight: M = 0,
5443
5698
  radiusBottomRight: w = 0,
5444
- radiusBottomLeft: I = 0
5445
- } = W, S = jt(W, [
5699
+ radiusBottomLeft: C = 0
5700
+ } = W, j = Ct(W, [
5446
5701
  "id",
5447
5702
  "text",
5448
5703
  "autoExpand",
@@ -5472,12 +5727,12 @@ class rt {
5472
5727
  var K;
5473
5728
  const { historyManager: E } = this.editor, { canvas: L } = this;
5474
5729
  E.suspendHistory();
5475
- const z = s != null ? s : this._getDefaultFontFamily(), B = xe({ width: g }), P = _e({
5730
+ const P = s != null ? s : this._getDefaultFontFamily(), B = Re({ width: g }), z = xe({
5476
5731
  strokeColor: f,
5477
5732
  width: B
5478
5733
  }), x = F({
5479
5734
  id: t,
5480
- fontFamily: z,
5735
+ fontFamily: P,
5481
5736
  fontSize: o,
5482
5737
  fontWeight: i ? "bold" : "normal",
5483
5738
  fontStyle: a ? "italic" : "normal",
@@ -5486,43 +5741,43 @@ class rt {
5486
5741
  linethrough: l,
5487
5742
  textAlign: d,
5488
5743
  fill: u,
5489
- stroke: P,
5744
+ stroke: z,
5490
5745
  strokeWidth: B,
5491
5746
  strokeUniform: !0,
5492
5747
  opacity: m,
5493
5748
  backgroundColor: p,
5494
5749
  backgroundOpacity: y,
5495
5750
  paddingTop: v,
5496
- paddingRight: C,
5751
+ paddingRight: A,
5497
5752
  paddingBottom: b,
5498
- paddingLeft: T,
5499
- radiusTopLeft: M,
5500
- radiusTopRight: A,
5753
+ paddingLeft: O,
5754
+ radiusTopLeft: S,
5755
+ radiusTopRight: M,
5501
5756
  radiusBottomRight: w,
5502
- radiusBottomLeft: I
5503
- }, S), _ = new ye(e, x), R = n !== !1;
5504
- if (_.autoExpand = R, _.textCaseRaw = (K = _.text) != null ? K : "", c) {
5505
- const H = we({ value: _.textCaseRaw });
5506
- H !== _.text && _.set({ text: H });
5507
- }
5508
- return Et({ textbox: _ }) && (_.dirty = !0), S.left === void 0 && S.top === void 0 && L.centerObject(_), k || L.add(_), j || L.setActiveObject(_), L.requestRenderAll(), E.resumeHistory(), O || E.saveState(), L.fire("editor:text-added", {
5509
- textbox: _,
5510
- options: Ot(F({}, x), {
5757
+ radiusBottomLeft: C
5758
+ }, j), D = new ve(e, x), R = n !== !1;
5759
+ if (D.autoExpand = R, D.textCaseRaw = (K = D.text) != null ? K : "", c) {
5760
+ const H = je({ value: D.textCaseRaw });
5761
+ H !== D.text && D.set({ text: H });
5762
+ }
5763
+ return _t({ textbox: D }) && (D.dirty = !0), j.left === void 0 && j.top === void 0 && L.centerObject(D), k || L.add(D), I || L.setActiveObject(D), L.requestRenderAll(), E.resumeHistory(), T || E.saveState(), L.fire("editor:text-added", {
5764
+ textbox: D,
5765
+ options: Et(F({}, x), {
5511
5766
  text: e,
5512
5767
  bold: i,
5513
5768
  italic: a,
5514
5769
  strikethrough: l,
5515
5770
  align: d,
5516
5771
  color: u,
5517
- strokeColor: P,
5772
+ strokeColor: z,
5518
5773
  strokeWidth: B
5519
5774
  }),
5520
5775
  flags: {
5521
- withoutSelection: !!j,
5522
- withoutSave: !!O,
5776
+ withoutSelection: !!I,
5777
+ withoutSave: !!T,
5523
5778
  withoutAdding: !!k
5524
5779
  }
5525
- }), _;
5780
+ }), D;
5526
5781
  }
5527
5782
  /**
5528
5783
  * Обновляет текстовый объект.
@@ -5540,41 +5795,41 @@ class rt {
5540
5795
  skipRender: s,
5541
5796
  selectionRange: o
5542
5797
  } = {}) {
5543
- var Ht, Gt, Vt, Xt, kt, re;
5798
+ var Zt, Vt, Xt, Kt, Bt, ce;
5544
5799
  const i = this._resolveTextObject(t);
5545
5800
  if (!i) return null;
5546
5801
  const { text: a = "" } = i, { historyManager: r } = this.editor, { canvas: c } = this;
5547
5802
  r.suspendHistory();
5548
- const l = rt._getSnapshot(i), d = (Ht = i.originY) != null ? Ht : "top", u = i.getPointByOrigin("center", d), f = {
5803
+ const l = rt._getSnapshot(i), d = (Zt = i.originY) != null ? Zt : "top", u = i.getPointByOrigin("center", d), f = {
5549
5804
  originY: d,
5550
5805
  x: u.x,
5551
5806
  y: u.y
5552
- }, Zt = e, {
5807
+ }, Gt = e, {
5553
5808
  text: g,
5554
5809
  autoExpand: m,
5555
5810
  fontFamily: p,
5556
5811
  fontSize: y,
5557
5812
  bold: v,
5558
- italic: C,
5813
+ italic: A,
5559
5814
  underline: b,
5560
- uppercase: T,
5561
- strikethrough: M,
5562
- align: A,
5815
+ uppercase: O,
5816
+ strikethrough: S,
5817
+ align: M,
5563
5818
  color: w,
5564
- strokeColor: I,
5565
- strokeWidth: S,
5566
- opacity: j,
5567
- backgroundColor: O,
5819
+ strokeColor: C,
5820
+ strokeWidth: j,
5821
+ opacity: I,
5822
+ backgroundColor: T,
5568
5823
  backgroundOpacity: k,
5569
- paddingTop: D,
5824
+ paddingTop: _,
5570
5825
  paddingRight: W,
5571
5826
  paddingBottom: E,
5572
5827
  paddingLeft: L,
5573
- radiusTopLeft: z,
5828
+ radiusTopLeft: P,
5574
5829
  radiusTopRight: B,
5575
- radiusBottomRight: P,
5830
+ radiusBottomRight: z,
5576
5831
  radiusBottomLeft: x
5577
- } = Zt, _ = jt(Zt, [
5832
+ } = Gt, D = Ct(Gt, [
5578
5833
  "text",
5579
5834
  "autoExpand",
5580
5835
  "fontFamily",
@@ -5599,89 +5854,89 @@ class rt {
5599
5854
  "radiusTopRight",
5600
5855
  "radiusBottomRight",
5601
5856
  "radiusBottomLeft"
5602
- ]), R = F({}, _), N = o !== void 0 ? Os({
5857
+ ]), R = F({}, D), N = o !== void 0 ? Ts({
5603
5858
  text: a,
5604
5859
  range: o
5605
5860
  }) : ws({ textbox: i }), K = N ? Es({ textbox: i, range: N }) : null, H = {}, q = {}, tt = {};
5606
- let at, ft;
5607
- const wt = js({ textbox: i, range: N }), dt = !N || wt, ht = !N;
5861
+ let at, gt;
5862
+ const jt = As({ textbox: i, range: N }), dt = !N || jt, ht = !N;
5608
5863
  if (p !== void 0 && (K && (q.fontFamily = p), dt && (R.fontFamily = p, ht && (tt.fontFamily = p))), y !== void 0 && (K && (q.fontSize = y), dt && (R.fontSize = y, ht && (tt.fontSize = y))), v !== void 0) {
5609
5864
  const Q = v ? "bold" : "normal";
5610
5865
  N && (H.fontWeight = Q), dt && (R.fontWeight = Q, ht && (tt.fontWeight = Q));
5611
5866
  }
5612
- if (C !== void 0) {
5613
- const Q = C ? "italic" : "normal";
5867
+ if (A !== void 0) {
5868
+ const Q = A ? "italic" : "normal";
5614
5869
  N && (H.fontStyle = Q), dt && (R.fontStyle = Q, ht && (tt.fontStyle = Q));
5615
5870
  }
5616
- if (b !== void 0 && (N && (H.underline = b), dt && (R.underline = b, ht && (tt.underline = b))), M !== void 0 && (N && (H.linethrough = M), dt && (R.linethrough = M, ht && (tt.linethrough = M))), A !== void 0 && (R.textAlign = A), w !== void 0 && (N && (H.fill = w), dt && (R.fill = w, ht && (tt.fill = w))), I !== void 0 || S !== void 0) {
5617
- const Q = N ? cn({ textbox: i, range: N, property: "strokeWidth" }) : void 0, st = N ? cn({ textbox: i, range: N, property: "stroke" }) : void 0, Me = (Vt = (Gt = S != null ? S : Q) != null ? Gt : i.strokeWidth) != null ? Vt : 0;
5618
- ft = xe({ width: Me });
5619
- const Bt = (kt = (Xt = I != null ? I : st) != null ? Xt : i.stroke) != null ? kt : void 0;
5620
- at = _e({
5621
- strokeColor: Bt,
5622
- width: ft
5623
- }), N && (H.stroke = at, H.strokeWidth = ft), dt && (R.stroke = at, R.strokeWidth = ft, ht && (tt.stroke = at, tt.strokeWidth = ft));
5624
- }
5625
- j !== void 0 && (R.opacity = j), O !== void 0 && (R.backgroundColor = O), k !== void 0 && (R.backgroundOpacity = k), D !== void 0 && (R.paddingTop = D), W !== void 0 && (R.paddingRight = W), E !== void 0 && (R.paddingBottom = E), L !== void 0 && (R.paddingLeft = L), z !== void 0 && (R.radiusTopLeft = z), B !== void 0 && (R.radiusTopRight = B), P !== void 0 && (R.radiusBottomRight = P), x !== void 0 && (R.radiusBottomLeft = x);
5626
- const It = (re = i.textCaseRaw) != null ? re : a, At = !!i.uppercase, Lt = g !== void 0, _t = Lt ? g != null ? g : "" : It, xt = T != null ? T : At, Yt = xt !== At;
5627
- if (Lt || Yt) {
5628
- const Q = xt ? we({ value: _t }) : _t;
5629
- R.text = Q, i.textCaseRaw = _t;
5630
- } else i.textCaseRaw === void 0 && (i.textCaseRaw = It);
5631
- i.uppercase = xt, i.set(R);
5632
- let gt = !1;
5871
+ if (b !== void 0 && (N && (H.underline = b), dt && (R.underline = b, ht && (tt.underline = b))), S !== void 0 && (N && (H.linethrough = S), dt && (R.linethrough = S, ht && (tt.linethrough = S))), M !== void 0 && (R.textAlign = M), w !== void 0 && (N && (H.fill = w), dt && (R.fill = w, ht && (tt.fill = w))), C !== void 0 || j !== void 0) {
5872
+ const Q = N ? ln({ textbox: i, range: N, property: "strokeWidth" }) : void 0, st = N ? ln({ textbox: i, range: N, property: "stroke" }) : void 0, Se = (Xt = (Vt = j != null ? j : Q) != null ? Vt : i.strokeWidth) != null ? Xt : 0;
5873
+ gt = Re({ width: Se });
5874
+ const Nt = (Bt = (Kt = C != null ? C : st) != null ? Kt : i.stroke) != null ? Bt : void 0;
5875
+ at = xe({
5876
+ strokeColor: Nt,
5877
+ width: gt
5878
+ }), N && (H.stroke = at, H.strokeWidth = gt), dt && (R.stroke = at, R.strokeWidth = gt, ht && (tt.stroke = at, tt.strokeWidth = gt));
5879
+ }
5880
+ I !== void 0 && (R.opacity = I), T !== void 0 && (R.backgroundColor = T), k !== void 0 && (R.backgroundOpacity = k), _ !== void 0 && (R.paddingTop = _), W !== void 0 && (R.paddingRight = W), E !== void 0 && (R.paddingBottom = E), L !== void 0 && (R.paddingLeft = L), P !== void 0 && (R.radiusTopLeft = P), B !== void 0 && (R.radiusTopRight = B), z !== void 0 && (R.radiusBottomRight = z), x !== void 0 && (R.radiusBottomLeft = x);
5881
+ const Ot = (ce = i.textCaseRaw) != null ? ce : a, At = !!i.uppercase, Dt = g !== void 0, xt = Dt ? g != null ? g : "" : Ot, Rt = O != null ? O : At, Ht = Rt !== At;
5882
+ if (Dt || Ht) {
5883
+ const Q = Rt ? je({ value: xt }) : xt;
5884
+ R.text = Q, i.textCaseRaw = xt;
5885
+ } else i.textCaseRaw === void 0 && (i.textCaseRaw = Ot);
5886
+ i.uppercase = Rt, i.set(R);
5887
+ let pt = !1;
5633
5888
  if (N) {
5634
- const Q = Se({ textbox: i, styles: H, range: N }), st = K ? Se({ textbox: i, styles: q, range: K }) : !1;
5635
- gt = Q || st;
5889
+ const Q = we({ textbox: i, styles: H, range: N }), st = K ? we({ textbox: i, styles: q, range: K }) : !1;
5890
+ pt = Q || st;
5636
5891
  } else if (Object.keys(tt).length) {
5637
- const Q = As({ textbox: i });
5638
- Q && (gt = Se({ textbox: i, styles: tt, range: Q }));
5892
+ const Q = js({ textbox: i });
5893
+ Q && (pt = we({ textbox: i, styles: tt, range: Q }));
5639
5894
  }
5640
- const ee = gt && fn({
5895
+ const ne = pt && gn({
5641
5896
  stylesList: [
5642
5897
  H,
5643
5898
  q,
5644
5899
  tt
5645
5900
  ]
5646
5901
  });
5647
- if (gt && (i.dirty = !0), K && (p !== void 0 || y !== void 0)) {
5648
- const Q = Ds({
5902
+ if (pt && (i.dirty = !0), K && (p !== void 0 || y !== void 0)) {
5903
+ const Q = _s({
5649
5904
  textbox: i,
5650
5905
  range: K
5651
5906
  }), st = {};
5652
- p !== void 0 && (st.fontFamily = p), y !== void 0 && (st.fontSize = y), ln({
5907
+ p !== void 0 && (st.fontFamily = p), y !== void 0 && (st.fontSize = y), dn({
5653
5908
  textbox: i,
5654
5909
  lineIndices: Q,
5655
5910
  updates: st
5656
5911
  });
5657
5912
  }
5658
- if (N && (w !== void 0 || I !== void 0 || S !== void 0)) {
5913
+ if (N && (w !== void 0 || C !== void 0 || j !== void 0)) {
5659
5914
  const Q = Ls({
5660
5915
  textbox: i,
5661
5916
  range: N
5662
5917
  }), st = {};
5663
- w !== void 0 && (st.fill = w), (I !== void 0 || S !== void 0) && (at === null && (st.stroke = null), at != null && (st.stroke = at)), ln({
5918
+ w !== void 0 && (st.fill = w), (C !== void 0 || j !== void 0) && (at === null && (st.stroke = null), at != null && (st.stroke = at)), dn({
5664
5919
  textbox: i,
5665
5920
  lineIndices: Q,
5666
5921
  updates: st
5667
5922
  });
5668
5923
  }
5669
- ee && (i.initDimensions(), i.dirty = !0), (O !== void 0 || k !== void 0 || D !== void 0 || W !== void 0 || E !== void 0 || L !== void 0 || z !== void 0 || B !== void 0 || P !== void 0 || x !== void 0) && (i.dirty = !0);
5670
- const Tt = fn({
5924
+ ne && (i.initDimensions(), i.dirty = !0), (T !== void 0 || k !== void 0 || _ !== void 0 || W !== void 0 || E !== void 0 || L !== void 0 || P !== void 0 || B !== void 0 || z !== void 0 || x !== void 0) && (i.dirty = !0);
5925
+ const Tt = gn({
5671
5926
  stylesList: [
5672
5927
  R,
5673
5928
  H,
5674
5929
  q,
5675
5930
  tt
5676
5931
  ]
5677
- }), { autoExpand: bt } = i, ne = m !== void 0, se = (m != null ? m : bt) !== !1;
5678
- ne ? i.autoExpand = m !== !1 : bt === void 0 && (i.autoExpand = !0);
5679
- const ie = Object.prototype.hasOwnProperty.call(R, "width"), oe = se && !ie && (Lt || Yt || Tt);
5680
- let Rt = !1;
5681
- oe && (Rt = this._autoExpandTextboxWidth(i, {
5932
+ }), { autoExpand: Mt } = i, se = m !== void 0, ie = (m != null ? m : Mt) !== !1;
5933
+ se ? i.autoExpand = m !== !1 : Mt === void 0 && (i.autoExpand = !0);
5934
+ const oe = Object.prototype.hasOwnProperty.call(R, "width"), ae = ie && !oe && (Dt || Ht || Tt);
5935
+ let kt = !1;
5936
+ ae && (kt = this._autoExpandTextboxWidth(i, {
5682
5937
  anchor: f
5683
- }), Rt && (i.dirty = !0)), (Rt ? !1 : Et({ textbox: i })) && (i.dirty = !0), i.setCoords(), s || c.requestRenderAll(), r.resumeHistory(), n || r.saveState();
5684
- const ae = rt._getSnapshot(i);
5938
+ }), kt && (i.dirty = !0)), (kt ? !1 : _t({ textbox: i })) && (i.dirty = !0), i.setCoords(), s || c.requestRenderAll(), r.resumeHistory(), n || r.saveState();
5939
+ const re = rt._getSnapshot(i);
5685
5940
  return c.fire("editor:text-updated", {
5686
5941
  textbox: i,
5687
5942
  target: t,
@@ -5692,7 +5947,7 @@ class rt {
5692
5947
  },
5693
5948
  updates: R,
5694
5949
  before: l,
5695
- after: ae,
5950
+ after: re,
5696
5951
  selectionRange: N != null ? N : void 0,
5697
5952
  selectionStyles: N && Object.keys(H).length ? H : void 0
5698
5953
  }), i;
@@ -5702,7 +5957,7 @@ class rt {
5702
5957
  */
5703
5958
  // eslint-disable-next-line class-methods-use-this
5704
5959
  stylesFromArray(t, e) {
5705
- return vt.stylesFromArray(t, e);
5960
+ return bt.stylesFromArray(t, e);
5706
5961
  }
5707
5962
  /**
5708
5963
  * Уничтожает менеджер и снимает слушатели.
@@ -5744,7 +5999,7 @@ class rt {
5744
5999
  * Синхронизирует lineFontDefaults при изменении текста и сохраняет typing style для пустых строк.
5745
6000
  */
5746
6001
  _syncLineFontDefaultsOnTextChanged({ textbox: t }) {
5747
- var k, D, W;
6002
+ var k, _, W;
5748
6003
  const {
5749
6004
  text: e = "",
5750
6005
  lineFontDefaults: n,
@@ -5758,10 +6013,10 @@ class rt {
5758
6013
  } = t, d = e, u = (k = t.__lineDefaultsPrevText) != null ? k : d, f = u.split(`
5759
6014
  `), g = d.split(`
5760
6015
  `), m = f.length, y = g.length - m;
5761
- let v = n, C = !1, b = !1;
5762
- const T = typeof a == "string" ? a : void 0, M = typeof r == "string" ? r : void 0;
6016
+ let v = n, A = !1, b = !1;
6017
+ const O = typeof a == "string" ? a : void 0, S = typeof r == "string" ? r : void 0;
5763
6018
  if (y !== 0 && n && Object.keys(n).length) {
5764
- const E = _s({
6019
+ const E = Ds({
5765
6020
  previous: u,
5766
6021
  next: d
5767
6022
  }), L = xs({
@@ -5769,69 +6024,69 @@ class rt {
5769
6024
  charIndex: E
5770
6025
  });
5771
6026
  if (y > 0) {
5772
- const z = Rs({
6027
+ const P = Rs({
5773
6028
  text: u,
5774
6029
  lineIndex: L
5775
6030
  });
5776
6031
  let B = L + 1;
5777
- E === z && (B = L);
5778
- const P = {};
6032
+ E === P && (B = L);
6033
+ const z = {};
5779
6034
  for (const x in n) {
5780
6035
  if (!Object.prototype.hasOwnProperty.call(n, x)) continue;
5781
- const _ = Number(x);
5782
- if (!Number.isFinite(_)) continue;
5783
- const R = n[_];
6036
+ const D = Number(x);
6037
+ if (!Number.isFinite(D)) continue;
6038
+ const R = n[D];
5784
6039
  if (!R) continue;
5785
- const N = _ >= B ? _ + y : _;
5786
- P[N] = F({}, R);
6040
+ const N = D >= B ? D + y : D;
6041
+ z[N] = F({}, R);
5787
6042
  }
5788
- v = P, C = !0, b = !0;
6043
+ v = z, A = !0, b = !0;
5789
6044
  }
5790
6045
  if (y < 0) {
5791
- const z = Math.abs(y);
6046
+ const P = Math.abs(y);
5792
6047
  let B = L;
5793
6048
  u[E] === `
5794
- ` && ((D = f[L]) != null ? D : "").length > 0 && (B = L + 1);
5795
- const x = B + z - 1, _ = {};
6049
+ ` && ((_ = f[L]) != null ? _ : "").length > 0 && (B = L + 1);
6050
+ const x = B + P - 1, D = {};
5796
6051
  for (const R in n) {
5797
6052
  if (!Object.prototype.hasOwnProperty.call(n, R)) continue;
5798
6053
  const N = Number(R);
5799
6054
  if (!Number.isFinite(N)) continue;
5800
6055
  const K = n[N];
5801
- K && (N < B && (_[N] = F({}, K)), N > x && (_[N + y] = F({}, K)));
6056
+ K && (N < B && (D[N] = F({}, K)), N > x && (D[N + y] = F({}, K)));
5802
6057
  }
5803
- v = _, C = !0, b = !0;
6058
+ v = D, A = !0, b = !0;
5804
6059
  }
5805
6060
  }
5806
- let A = null;
6061
+ let M = null;
5807
6062
  if (l && typeof c == "number") {
5808
6063
  const E = t.get2DCursorLocation(c), { lineIndex: L } = E;
5809
- Number.isFinite(L) && (A = L);
6064
+ Number.isFinite(L) && (M = L);
5810
6065
  }
5811
- let w = s, I = !1, S = !1, j, O = null;
6066
+ let w = s, C = !1, j = !1, I, T = null;
5812
6067
  for (let E = 0; E < g.length; E += 1) {
5813
- const L = (W = g[E]) != null ? W : "", z = v ? v[E] : void 0;
5814
- if (z && (j = z), L.length !== 0) {
5815
- if (z) {
6068
+ const L = (W = g[E]) != null ? W : "", P = v ? v[E] : void 0;
6069
+ if (P && (I = P), L.length !== 0) {
6070
+ if (P) {
5816
6071
  const N = Is({
5817
6072
  lineText: L,
5818
6073
  lineStyles: w ? w[E] : void 0,
5819
- lineDefaults: z
6074
+ lineDefaults: P
5820
6075
  });
5821
- N.changed && (w || (w = {}, S = !0), S || (w = F({}, w), S = !0), N.lineStyles && (w[E] = N.lineStyles), !N.lineStyles && w[E] && delete w[E], I = !0);
6076
+ N.changed && (w || (w = {}, j = !0), j || (w = F({}, w), j = !0), N.lineStyles && (w[E] = N.lineStyles), !N.lineStyles && w[E] && delete w[E], C = !0);
5822
6077
  }
5823
6078
  continue;
5824
6079
  }
5825
- const P = z != null ? z : j, x = {};
5826
- (P == null ? void 0 : P.fontFamily) !== void 0 ? x.fontFamily = P.fontFamily : o !== void 0 && (x.fontFamily = o), (P == null ? void 0 : P.fontSize) !== void 0 ? x.fontSize = P.fontSize : i !== void 0 && (x.fontSize = i), (P == null ? void 0 : P.fill) !== void 0 ? x.fill = P.fill : T !== void 0 && (x.fill = T), (P == null ? void 0 : P.stroke) !== void 0 ? x.stroke = P.stroke : M !== void 0 && (x.stroke = M), !z && Object.keys(x).length && (v || (v = {}, b = !0), b || (v = F({}, v), b = !0), v[E] = x, C = !0, j = x), z && (j = z), A !== null && A === E && (O = x);
5827
- const _ = {};
5828
- x.fontFamily !== void 0 && (_.fontFamily = x.fontFamily), x.fontSize !== void 0 && (_.fontSize = x.fontSize), x.fill !== void 0 && (_.fill = x.fill), x.stroke !== void 0 && (_.stroke = x.stroke);
5829
- const R = Object.keys(_).length > 0;
5830
- (R || w && w[E]) && (w || (w = {}, S = !0), S || (w = F({}, w), S = !0), R && (w[E] = { 0: _ }), !R && w[E] && delete w[E], I = !0);
5831
- }
5832
- if (C && v && (t.lineFontDefaults = v), I && (t.styles = w, t.dirty = !0), O && typeof c == "number") {
6080
+ const z = P != null ? P : I, x = {};
6081
+ (z == null ? void 0 : z.fontFamily) !== void 0 ? x.fontFamily = z.fontFamily : o !== void 0 && (x.fontFamily = o), (z == null ? void 0 : z.fontSize) !== void 0 ? x.fontSize = z.fontSize : i !== void 0 && (x.fontSize = i), (z == null ? void 0 : z.fill) !== void 0 ? x.fill = z.fill : O !== void 0 && (x.fill = O), (z == null ? void 0 : z.stroke) !== void 0 ? x.stroke = z.stroke : S !== void 0 && (x.stroke = S), !P && Object.keys(x).length && (v || (v = {}, b = !0), b || (v = F({}, v), b = !0), v[E] = x, A = !0, I = x), P && (I = P), M !== null && M === E && (T = x);
6082
+ const D = {};
6083
+ x.fontFamily !== void 0 && (D.fontFamily = x.fontFamily), x.fontSize !== void 0 && (D.fontSize = x.fontSize), x.fill !== void 0 && (D.fill = x.fill), x.stroke !== void 0 && (D.stroke = x.stroke);
6084
+ const R = Object.keys(D).length > 0;
6085
+ (R || w && w[E]) && (w || (w = {}, j = !0), j || (w = F({}, w), j = !0), R && (w[E] = { 0: D }), !R && w[E] && delete w[E], C = !0);
6086
+ }
6087
+ if (A && v && (t.lineFontDefaults = v), C && (t.styles = w, t.dirty = !0), T && typeof c == "number") {
5833
6088
  const E = {};
5834
- if (O.fontFamily !== void 0 && (E.fontFamily = O.fontFamily), O.fontSize !== void 0 && (E.fontSize = O.fontSize), O.fill !== void 0 && (E.fill = O.fill), O.stroke !== void 0 && (E.stroke = O.stroke), Object.keys(E).length) {
6089
+ if (T.fontFamily !== void 0 && (E.fontFamily = T.fontFamily), T.fontSize !== void 0 && (E.fontSize = T.fontSize), T.fill !== void 0 && (E.fill = T.fill), T.stroke !== void 0 && (E.stroke = T.stroke), Object.keys(E).length) {
5835
6090
  this.lineDefaultsSyncing.add(t);
5836
6091
  try {
5837
6092
  t.setSelectionStyles(E, c, c);
@@ -5847,15 +6102,15 @@ class rt {
5847
6102
  * но не шире монтажной области, и удерживает объект в её пределах.
5848
6103
  */
5849
6104
  _autoExpandTextboxWidth(t, { anchor: e } = {}) {
5850
- var A, w, I, S, j, O, k, D, W, E, L, z, B;
6105
+ var M, w, C, j, I, T, k, _, W, E, L, P, B;
5851
6106
  const { montageArea: n } = this.editor;
5852
6107
  if (!n) return !1;
5853
6108
  const s = typeof t.text == "string" ? t.text : "";
5854
6109
  if (!s.length) return !1;
5855
6110
  n.setCoords();
5856
- const o = n.getBoundingRect(!1, !0), i = (A = o.width) != null ? A : 0;
6111
+ const o = n.getBoundingRect(!1, !0), i = (M = o.width) != null ? M : 0;
5857
6112
  if (!Number.isFinite(i) || i <= 0) return !1;
5858
- const a = e != null ? e : (w = this.editingAnchorState) == null ? void 0 : w.get(t), r = (S = (I = a == null ? void 0 : a.originY) != null ? I : t.originY) != null ? S : "top", c = Math.abs((j = t.scaleX) != null ? j : 1) || 1, l = (O = t.paddingLeft) != null ? O : 0, d = (k = t.paddingRight) != null ? k : 0, u = (D = t.strokeWidth) != null ? D : 0, f = Math.max(
6113
+ const a = e != null ? e : (w = this.editingAnchorState) == null ? void 0 : w.get(t), r = (j = (C = a == null ? void 0 : a.originY) != null ? C : t.originY) != null ? j : "top", c = Math.abs((I = t.scaleX) != null ? I : 1) || 1, l = (T = t.paddingLeft) != null ? T : 0, d = (k = t.paddingRight) != null ? k : 0, u = (_ = t.strokeWidth) != null ? _ : 0, f = Math.max(
5859
6114
  1,
5860
6115
  i / c - l - d - u
5861
6116
  );
@@ -5866,18 +6121,18 @@ class rt {
5866
6121
  Math.abs(((W = t.width) != null ? W : 0) - f) > it && (t.set({ width: f }), m = !0), t.initDimensions();
5867
6122
  const { textLines: p } = t, y = Array.isArray(p) && p.length > g, v = Math.ceil(
5868
6123
  ks({ textbox: t, text: s })
5869
- ), C = Math.min((E = t.minWidth) != null ? E : 1, f);
6124
+ ), A = Math.min((E = t.minWidth) != null ? E : 1, f);
5870
6125
  let b = Math.min(
5871
6126
  f,
5872
- Math.max(v, C)
6127
+ Math.max(v, A)
5873
6128
  );
5874
- y && (b = f), Math.abs(((L = t.width) != null ? L : 0) - b) > it && (t.set({ width: b }), t.initDimensions(), m = !0), Et({ textbox: t }) && (m = !0), a && (t.setPositionByOrigin(new lt(a.x, a.y), "center", r), m = !0);
5875
- const M = Bs({
6129
+ y && (b = f), Math.abs(((L = t.width) != null ? L : 0) - b) > it && (t.set({ width: b }), t.initDimensions(), m = !0), _t({ textbox: t }) && (m = !0), a && (t.setPositionByOrigin(new lt(a.x, a.y), "center", r), m = !0);
6130
+ const S = Bs({
5876
6131
  textbox: t,
5877
- montageLeft: (z = o.left) != null ? z : 0,
6132
+ montageLeft: (P = o.left) != null ? P : 0,
5878
6133
  montageRight: ((B = o.left) != null ? B : 0) + i
5879
6134
  });
5880
- return m || M;
6135
+ return m || S;
5881
6136
  }
5882
6137
  /**
5883
6138
  * Возвращает хранилище якорей редактирования, создавая его при необходимости.
@@ -5920,7 +6175,7 @@ class rt {
5920
6175
  bottomLeft: v
5921
6176
  },
5922
6177
  baseStyles: JSON.parse(JSON.stringify(c)),
5923
- baseLineFontDefaults: dn({ lineFontDefaults: l }),
6178
+ baseLineFontDefaults: hn({ lineFontDefaults: l }),
5924
6179
  hasWidthChange: !1
5925
6180
  }, this.scalingState.set(t, e);
5926
6181
  }
@@ -5932,9 +6187,9 @@ class rt {
5932
6187
  static _getSnapshot(t) {
5933
6188
  const e = ({
5934
6189
  snapshot: x,
5935
- entries: _
6190
+ entries: D
5936
6191
  }) => {
5937
- Object.entries(_).forEach(([R, N]) => {
6192
+ Object.entries(D).forEach(([R, N]) => {
5938
6193
  N != null && (x[R] = N);
5939
6194
  });
5940
6195
  }, {
@@ -5954,30 +6209,30 @@ class rt {
5954
6209
  stroke: p,
5955
6210
  strokeWidth: y,
5956
6211
  opacity: v,
5957
- backgroundColor: C,
6212
+ backgroundColor: A,
5958
6213
  backgroundOpacity: b,
5959
- paddingTop: T,
5960
- paddingRight: M,
5961
- paddingBottom: A,
6214
+ paddingTop: O,
6215
+ paddingRight: S,
6216
+ paddingBottom: M,
5962
6217
  paddingLeft: w,
5963
- radiusTopLeft: I,
5964
- radiusTopRight: S,
5965
- radiusBottomRight: j,
5966
- radiusBottomLeft: O,
6218
+ radiusTopLeft: C,
6219
+ radiusTopRight: j,
6220
+ radiusBottomRight: I,
6221
+ radiusBottomLeft: T,
5967
6222
  left: k,
5968
- top: D,
6223
+ top: _,
5969
6224
  width: W,
5970
6225
  height: E,
5971
6226
  angle: L,
5972
- scaleX: z,
6227
+ scaleX: P,
5973
6228
  scaleY: B
5974
- } = t, P = {
6229
+ } = t, z = {
5975
6230
  id: n,
5976
6231
  uppercase: !!i,
5977
6232
  textAlign: g
5978
6233
  };
5979
6234
  return e({
5980
- snapshot: P,
6235
+ snapshot: z,
5981
6236
  entries: {
5982
6237
  text: s,
5983
6238
  textCaseRaw: o,
@@ -5992,25 +6247,25 @@ class rt {
5992
6247
  stroke: p,
5993
6248
  strokeWidth: y,
5994
6249
  opacity: v,
5995
- backgroundColor: C,
6250
+ backgroundColor: A,
5996
6251
  backgroundOpacity: b,
5997
- paddingTop: T,
5998
- paddingRight: M,
5999
- paddingBottom: A,
6252
+ paddingTop: O,
6253
+ paddingRight: S,
6254
+ paddingBottom: M,
6000
6255
  paddingLeft: w,
6001
- radiusTopLeft: I,
6002
- radiusTopRight: S,
6003
- radiusBottomRight: j,
6004
- radiusBottomLeft: O,
6256
+ radiusTopLeft: C,
6257
+ radiusTopRight: j,
6258
+ radiusBottomRight: I,
6259
+ radiusBottomLeft: T,
6005
6260
  left: k,
6006
- top: D,
6261
+ top: _,
6007
6262
  width: W,
6008
6263
  height: E,
6009
6264
  angle: L,
6010
- scaleX: z,
6265
+ scaleX: P,
6011
6266
  scaleY: B
6012
6267
  }
6013
- }), P;
6268
+ }), z;
6014
6269
  }
6015
6270
  /**
6016
6271
  * Возвращает первый доступный шрифт или дефолтный Arial.
@@ -6020,12 +6275,12 @@ class rt {
6020
6275
  return (e = (t = this.fonts[0]) == null ? void 0 : t.family) != null ? e : "Arial";
6021
6276
  }
6022
6277
  }
6023
- const he = ({
6278
+ const ue = ({
6024
6279
  value: h
6025
6280
  }) => Math.round(h / 2) * 2, nt = ({
6026
6281
  value: h,
6027
6282
  fallback: t = 0
6028
- }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, ue = ({
6283
+ }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, fe = ({
6029
6284
  value: h,
6030
6285
  dimension: t,
6031
6286
  useRelativePositions: e
@@ -6042,22 +6297,22 @@ const he = ({
6042
6297
  const o = h;
6043
6298
  if (typeof o[s.x] == "number" && typeof o[s.y] == "number")
6044
6299
  return {
6045
- x: ue({
6300
+ x: fe({
6046
6301
  value: o[s.x],
6047
6302
  dimension: t,
6048
6303
  useRelativePositions: n
6049
6304
  }),
6050
- y: ue({
6305
+ y: fe({
6051
6306
  value: o[s.y],
6052
6307
  dimension: e,
6053
6308
  useRelativePositions: n
6054
6309
  })
6055
6310
  };
6056
- const { left: a, top: r, width: c, height: l } = h, d = ue({
6311
+ const { left: a, top: r, width: c, height: l } = h, d = fe({
6057
6312
  value: a,
6058
6313
  dimension: t,
6059
6314
  useRelativePositions: n
6060
- }), u = ue({
6315
+ }), u = fe({
6061
6316
  value: r,
6062
6317
  dimension: e,
6063
6318
  useRelativePositions: n
@@ -6066,7 +6321,7 @@ const he = ({
6066
6321
  x: d + f / 2,
6067
6322
  y: u + g / 2
6068
6323
  };
6069
- }, zs = ({
6324
+ }, Ps = ({
6070
6325
  normalizedX: h,
6071
6326
  normalizedY: t,
6072
6327
  bounds: e,
@@ -6080,7 +6335,7 @@ const he = ({
6080
6335
  }
6081
6336
  const c = o + h * a, l = i + t * r;
6082
6337
  return new lt(c, l);
6083
- }, Ps = ({
6338
+ }, zs = ({
6084
6339
  object: h,
6085
6340
  montageArea: t,
6086
6341
  bounds: e
@@ -6095,7 +6350,7 @@ const he = ({
6095
6350
  } catch (n) {
6096
6351
  return null;
6097
6352
  }
6098
- }, mt = ({
6353
+ }, yt = ({
6099
6354
  object: h
6100
6355
  }) => {
6101
6356
  if (!h) return null;
@@ -6106,7 +6361,7 @@ const he = ({
6106
6361
  top: n = 0,
6107
6362
  width: s = 0,
6108
6363
  height: o = 0
6109
- } = t, i = e + s, a = n + o, r = he({ value: e }), c = he({ value: n }), l = he({ value: i }), d = he({ value: a }), u = l - r, f = d - c, g = r + u / 2, m = c + f / 2;
6364
+ } = t, i = e + s, a = n + o, r = ue({ value: e }), c = ue({ value: n }), l = ue({ value: i }), d = ue({ value: a }), u = l - r, f = d - c, g = r + u / 2, m = c + f / 2;
6110
6365
  return {
6111
6366
  left: r,
6112
6367
  right: l,
@@ -6159,7 +6414,7 @@ const he = ({
6159
6414
  };
6160
6415
  }
6161
6416
  return null;
6162
- }, Jt = "_templateCenterX", Ae = "_templateCenterY", fe = "_templateAnchorX", je = "_templateAnchorY";
6417
+ }, Qt = "_templateCenterX", Ae = "_templateCenterY", ge = "_templateAnchorX", Ce = "_templateAnchorY";
6163
6418
  class Z {
6164
6419
  constructor({ editor: t }) {
6165
6420
  this.editor = t;
@@ -6184,16 +6439,16 @@ class Z {
6184
6439
  return a.emitWarning({
6185
6440
  origin: "TemplateManager",
6186
6441
  method: "serializeSelection",
6187
- code: Dt.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
6442
+ code: Lt.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
6188
6443
  message: "Нет объектов для сериализации шаблона"
6189
6444
  }), null;
6190
- const g = Z._getBounds(i), m = Z._getMontageSize({ montageArea: i, bounds: g }), p = m.width, y = m.height, v = f.map((T) => Z._serializeObject({
6191
- object: T,
6445
+ const g = Z._getBounds(i), m = Z._getMontageSize({ montageArea: i, bounds: g }), p = m.width, y = m.height, v = f.map((O) => Z._serializeObject({
6446
+ object: O,
6192
6447
  bounds: g,
6193
6448
  baseWidth: p,
6194
6449
  baseHeight: y,
6195
6450
  montageArea: i != null ? i : null
6196
- })), C = Ot(F({}, n), {
6451
+ })), A = Et(F({}, n), {
6197
6452
  baseWidth: p,
6198
6453
  baseHeight: y,
6199
6454
  positionsNormalized: !0,
@@ -6201,7 +6456,7 @@ class Z {
6201
6456
  });
6202
6457
  return {
6203
6458
  id: t != null ? t : `template-${et()}`,
6204
- meta: C,
6459
+ meta: A,
6205
6460
  objects: v
6206
6461
  };
6207
6462
  }
@@ -6225,7 +6480,7 @@ class Z {
6225
6480
  return i.emitWarning({
6226
6481
  origin: "TemplateManager",
6227
6482
  method: "applyTemplate",
6228
- code: Dt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
6483
+ code: Lt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
6229
6484
  message: "Шаблон не содержит объектов"
6230
6485
  }), null;
6231
6486
  const d = Z._getBounds(s);
@@ -6233,7 +6488,7 @@ class Z {
6233
6488
  return i.emitWarning({
6234
6489
  origin: "TemplateManager",
6235
6490
  method: "applyTemplate",
6236
- code: Dt.TEMPLATE_MANAGER.INVALID_TARGET,
6491
+ code: Lt.TEMPLATE_MANAGER.INVALID_TARGET,
6237
6492
  message: "Не удалось определить границы монтажной области"
6238
6493
  }), null;
6239
6494
  const u = Z._getMontageSize({ montageArea: s, bounds: d }), f = Z._normalizeMeta({ meta: c, fallback: u }), g = Z._calculateScale({ meta: f, target: u }), m = !!f.positionsNormalized;
@@ -6245,20 +6500,20 @@ class Z {
6245
6500
  return i.emitWarning({
6246
6501
  origin: "TemplateManager",
6247
6502
  method: "applyTemplate",
6248
- code: Dt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
6503
+ code: Lt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
6249
6504
  message: "Не удалось создать объекты шаблона"
6250
6505
  }), null;
6251
- const { backgroundObject: C, contentObjects: b } = Z._extractBackgroundObject(v);
6252
- C && (y = yield Z._applyBackgroundFromObject({
6253
- backgroundObject: C,
6506
+ const { backgroundObject: A, contentObjects: b } = Z._extractBackgroundObject(v);
6507
+ A && (y = yield Z._applyBackgroundFromObject({
6508
+ backgroundObject: A,
6254
6509
  backgroundManager: a,
6255
6510
  errorManager: i
6256
6511
  }));
6257
- const T = b.map((M) => (this._adaptTextboxWidth({
6258
- object: M,
6512
+ const O = b.map((S) => (this._adaptTextboxWidth({
6513
+ object: S,
6259
6514
  baseWidth: f.baseWidth
6260
6515
  }), Z._transformObject({
6261
- object: M,
6516
+ object: S,
6262
6517
  scale: g,
6263
6518
  bounds: d,
6264
6519
  targetSize: u,
@@ -6266,20 +6521,20 @@ class Z {
6266
6521
  baseHeight: f.baseHeight,
6267
6522
  montageArea: s,
6268
6523
  useRelativePositions: m
6269
- }), M.set({
6270
- id: `${M.type}-${et()}`,
6524
+ }), S.set({
6525
+ id: `${S.type}-${et()}`,
6271
6526
  evented: !0
6272
- }), n.add(M), M));
6273
- return !T.length && !y ? null : (p = T.length > 0 || y, T.length && Z._activateObjects({ canvas: n, objects: T }), n.requestRenderAll(), n.fire("editor:template-applied", {
6527
+ }), n.add(S), S));
6528
+ return !O.length && !y ? null : (p = O.length > 0 || y, O.length && Z._activateObjects({ canvas: n, objects: O }), n.requestRenderAll(), n.fire("editor:template-applied", {
6274
6529
  template: t,
6275
- objects: T,
6530
+ objects: O,
6276
6531
  bounds: d
6277
- }), T);
6532
+ }), O);
6278
6533
  } catch (v) {
6279
6534
  return i.emitError({
6280
6535
  origin: "TemplateManager",
6281
6536
  method: "applyTemplate",
6282
- code: Dt.TEMPLATE_MANAGER.APPLY_FAILED,
6537
+ code: Lt.TEMPLATE_MANAGER.APPLY_FAILED,
6283
6538
  message: "Ошибка применения шаблона",
6284
6539
  data: {
6285
6540
  templateId: l,
@@ -6326,7 +6581,7 @@ class Z {
6326
6581
  if (i)
6327
6582
  return Z._restoreImageScale({ revived: i, serialized: n }), i;
6328
6583
  }
6329
- const s = yield vt.enlivenObjects([n]), o = s == null ? void 0 : s[0];
6584
+ const s = yield bt.enlivenObjects([n]), o = s == null ? void 0 : s[0];
6330
6585
  return o ? (Z._restoreImageScale({ revived: o, serialized: n }), o) : null;
6331
6586
  })))).filter((n) => !!n);
6332
6587
  });
@@ -6355,22 +6610,22 @@ class Z {
6355
6610
  naturalHeight: 0,
6356
6611
  width: 0,
6357
6612
  height: 0
6358
- }, m = nt({ value: d || f || c.width, fallback: 0 }), p = nt({ value: u || g || c.height, fallback: 0 }), y = nt({ value: s, fallback: m }), v = nt({ value: o, fallback: p }), C = nt({ value: i, fallback: c.scaleX || 1 }), b = nt({ value: a, fallback: c.scaleY || 1 }), T = y * C, M = v * b, A = m > 0, w = p > 0, I = T > 0, S = M > 0, j = Z._resolveImageFit({ customData: r }), O = {};
6359
- if (A && (O.width = m), w && (O.height = p), !A || !w) {
6360
- c.set(O);
6613
+ }, m = nt({ value: d || f || c.width, fallback: 0 }), p = nt({ value: u || g || c.height, fallback: 0 }), y = nt({ value: s, fallback: m }), v = nt({ value: o, fallback: p }), A = nt({ value: i, fallback: c.scaleX || 1 }), b = nt({ value: a, fallback: c.scaleY || 1 }), O = y * A, S = v * b, M = m > 0, w = p > 0, C = O > 0, j = S > 0, I = Z._resolveImageFit({ customData: r }), T = {};
6614
+ if (M && (T.width = m), w && (T.height = p), !M || !w) {
6615
+ c.set(T);
6361
6616
  return;
6362
6617
  }
6363
- if (j === "stretch") {
6364
- const D = I ? T / m : null, W = S ? M / p : null;
6365
- D && D > 0 && (O.scaleX = D), W && W > 0 && (O.scaleY = W), c.set(O);
6618
+ if (I === "stretch") {
6619
+ const _ = C ? O / m : null, W = j ? S / p : null;
6620
+ _ && _ > 0 && (T.scaleX = _), W && W > 0 && (T.scaleY = W), c.set(T);
6366
6621
  return;
6367
6622
  }
6368
- if (!I || !S) {
6369
- c.set(O);
6623
+ if (!C || !j) {
6624
+ c.set(T);
6370
6625
  return;
6371
6626
  }
6372
- const k = Math.min(T / m, M / p);
6373
- Number.isFinite(k) && k > 0 && (O.scaleX = k, O.scaleY = k), c.set(O);
6627
+ const k = Math.min(O / m, S / p);
6628
+ Number.isFinite(k) && k > 0 && (T.scaleX = k, T.scaleY = k), c.set(T);
6374
6629
  }
6375
6630
  /**
6376
6631
  * Определяет режим вписывания изображения при восстановлении.
@@ -6396,7 +6651,7 @@ class Z {
6396
6651
  const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
6397
6652
  if (!e) return null;
6398
6653
  try {
6399
- const n = yield Rn(e), s = vt.groupSVGElements(n.objects, n.options), o = yield vt.enlivenObjectEnlivables(
6654
+ const n = yield kn(e), s = bt.groupSVGElements(n.objects, n.options), o = yield bt.enlivenObjectEnlivables(
6400
6655
  Z._prepareSerializableProps(t)
6401
6656
  );
6402
6657
  return s.set(o), s.setCoords(), s;
@@ -6461,7 +6716,7 @@ class Z {
6461
6716
  baseHeight: i,
6462
6717
  useRelativePositions: r,
6463
6718
  centerKeys: {
6464
- x: Jt,
6719
+ x: Qt,
6465
6720
  y: Ae
6466
6721
  }
6467
6722
  }), { scaleX: u, scaleY: f } = t, g = nt({ value: u, fallback: 1 }), m = nt({ value: f, fallback: 1 }), p = Z._getPositioningBounds({
@@ -6470,19 +6725,19 @@ class Z {
6470
6725
  baseHeight: i,
6471
6726
  scale: e,
6472
6727
  useRelativePositions: r,
6473
- anchorX: Z._resolveAnchor(c, fe),
6474
- anchorY: Z._resolveAnchor(c, je)
6475
- }), y = zs({
6728
+ anchorX: Z._resolveAnchor(c, ge),
6729
+ anchorY: Z._resolveAnchor(c, Ce)
6730
+ }), y = Ps({
6476
6731
  normalizedX: l,
6477
6732
  normalizedY: d,
6478
6733
  bounds: p,
6479
6734
  targetSize: s,
6480
6735
  montageArea: a
6481
- }), v = g * e, C = m * e;
6736
+ }), v = g * e, A = m * e;
6482
6737
  t.set({
6483
6738
  scaleX: v,
6484
- scaleY: C
6485
- }), t.setPositionByOrigin(y, "center", "center"), t.setCoords(), delete c[Jt], delete c[Ae], delete c[fe], delete c[je];
6739
+ scaleY: A
6740
+ }), t.setPositionByOrigin(y, "center", "center"), t.setCoords(), delete c[Qt], delete c[Ae], delete c[ge], delete c[Ce];
6486
6741
  }
6487
6742
  /**
6488
6743
  * Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
@@ -6529,7 +6784,7 @@ class Z {
6529
6784
  meta: t,
6530
6785
  fallback: e
6531
6786
  }) {
6532
- const { width: n, height: s } = e, r = t || {}, { baseWidth: o = n, baseHeight: i = s } = r, a = jt(r, ["baseWidth", "baseHeight"]);
6787
+ const { width: n, height: s } = e, r = t || {}, { baseWidth: o = n, baseHeight: i = s } = r, a = Ct(r, ["baseWidth", "baseHeight"]);
6533
6788
  return F({
6534
6789
  baseWidth: o,
6535
6790
  baseHeight: i
@@ -6581,16 +6836,16 @@ class Z {
6581
6836
  } = t, r = nt({ value: e, fallback: 0 }), c = t, l = nt({ value: c.paddingLeft, fallback: 0 }), d = nt({ value: c.paddingRight, fallback: 0 }), u = nt({ value: i, fallback: 1 }), f = nt({ value: a, fallback: 0 }) * u, g = nt({ value: o, fallback: 0 }), m = g * u, p = l * u, y = d * u, v = m + p + y + f;
6582
6837
  if (!s || !g || !r) return;
6583
6838
  t.setCoords();
6584
- const C = t, b = C[Jt], T = typeof b == "number" ? b : null, M = Z._resolveAnchor(C, fe), A = v / r, w = T !== null ? T - A / 2 : null, I = T !== null ? T + A / 2 : null, S = t.getCenterPoint();
6839
+ const A = t, b = A[Qt], O = typeof b == "number" ? b : null, S = Z._resolveAnchor(A, ge), M = v / r, w = O !== null ? O - M / 2 : null, C = O !== null ? O + M / 2 : null, j = t.getCenterPoint();
6585
6840
  t.set("width", s), t.initDimensions();
6586
- const j = Z._getLongestLineWidth({
6841
+ const I = Z._getLongestLineWidth({
6587
6842
  textbox: t,
6588
6843
  text: n
6589
- }), O = j > g ? j + 1 : g;
6590
- t.set("width", O), t.initDimensions(), t.setPositionByOrigin(S, "center", "center"), t.setCoords();
6591
- const D = (O * u + p + y + f) / r;
6592
- let W = T;
6593
- M === "start" && w !== null ? W = Math.max(0, w) + D / 2 : M === "end" && I !== null && (W = Math.min(1, I) - D / 2), typeof W == "number" && (C[Jt] = W);
6844
+ }), T = I > g ? I + 1 : g;
6845
+ t.set("width", T), t.initDimensions(), t.setPositionByOrigin(j, "center", "center"), t.setCoords();
6846
+ const _ = (T * u + p + y + f) / r;
6847
+ let W = O;
6848
+ S === "start" && w !== null ? W = Math.max(0, w) + _ / 2 : S === "end" && C !== null && (W = Math.min(1, C) - _ / 2), typeof W == "number" && (A[Qt] = W);
6594
6849
  }
6595
6850
  /**
6596
6851
  * Возвращает ширину самой длинной строки текстового объекта.
@@ -6620,7 +6875,7 @@ class Z {
6620
6875
  baseHeight: s,
6621
6876
  montageArea: o
6622
6877
  }) {
6623
- const i = t.toDatalessObject([...Le]);
6878
+ const i = t.toDatalessObject([...De]);
6624
6879
  if (Z._isSvgObject(t)) {
6625
6880
  const b = Z._extractSvgMarkup(t);
6626
6881
  b && (i.svgMarkup = b, delete i.objects, delete i.path);
@@ -6631,7 +6886,7 @@ class Z {
6631
6886
  top: r,
6632
6887
  width: c,
6633
6888
  height: l
6634
- } = e, d = t.getBoundingRect(!1, !0), u = n || c || 1, f = s || l || 1, g = Ps({
6889
+ } = e, d = t.getBoundingRect(!1, !0), u = n || c || 1, f = s || l || 1, g = zs({
6635
6890
  object: t,
6636
6891
  montageArea: o,
6637
6892
  bounds: e
@@ -6641,15 +6896,15 @@ class Z {
6641
6896
  x: (b.x - a) / u,
6642
6897
  y: (b.y - r) / f
6643
6898
  };
6644
- })(), p = (d.left - a) / u, y = (d.top - r) / f, v = p + d.width / u, C = y + d.height / f;
6645
- return i[Jt] = m.x, i[Ae] = m.y, i[fe] = Z._detectAnchor({
6899
+ })(), p = (d.left - a) / u, y = (d.top - r) / f, v = p + d.width / u, A = y + d.height / f;
6900
+ return i[Qt] = m.x, i[Ae] = m.y, i[ge] = Z._detectAnchor({
6646
6901
  center: m.x,
6647
6902
  start: p,
6648
6903
  end: v
6649
- }), i[je] = Z._detectAnchor({
6904
+ }), i[Ce] = Z._detectAnchor({
6650
6905
  center: m.y,
6651
6906
  start: y,
6652
- end: C
6907
+ end: A
6653
6908
  }), i.left = p, i.top = y, i;
6654
6909
  }
6655
6910
  /**
@@ -6704,7 +6959,7 @@ class Z {
6704
6959
  n.emitWarning({
6705
6960
  origin: "TemplateManager",
6706
6961
  method: "applyTemplate",
6707
- code: Dt.TEMPLATE_MANAGER.APPLY_FAILED,
6962
+ code: Lt.TEMPLATE_MANAGER.APPLY_FAILED,
6708
6963
  message: "Не удалось применить фон из шаблона",
6709
6964
  data: o
6710
6965
  });
@@ -6760,16 +7015,16 @@ class Z {
6760
7015
  */
6761
7016
  // eslint-disable-next-line class-methods-use-this
6762
7017
  enlivenObjectEnlivables(t) {
6763
- return vt.enlivenObjectEnlivables(t);
7018
+ return bt.enlivenObjectEnlivables(t);
6764
7019
  }
6765
7020
  }
6766
- const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
7021
+ const Ie = 5, Sn = "#3D8BF4", ke = 1, ot = 2, Ye = ({
6767
7022
  value: h,
6768
7023
  step: t
6769
- }) => Math.round(h / t) * t, yt = ({
7024
+ }) => Math.round(h / t) * t, vt = ({
6770
7025
  value: h,
6771
7026
  step: t
6772
- }) => Ue({ value: h, step: t }) === h, Sn = ({
7027
+ }) => Ye({ value: h, step: t }) === h, wn = ({
6773
7028
  items: h,
6774
7029
  axis: t
6775
7030
  }) => {
@@ -6783,7 +7038,7 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
6783
7038
  }
6784
7039
  h[i + 1] = n;
6785
7040
  }
6786
- }, wn = ({
7041
+ }, jn = ({
6787
7042
  items: h
6788
7043
  }) => {
6789
7044
  for (let t = 0; t < h.length; t += 1) {
@@ -6807,7 +7062,7 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
6807
7062
  });
6808
7063
  }
6809
7064
  return e;
6810
- }, gn = ({
7065
+ }, pn = ({
6811
7066
  anchors: h,
6812
7067
  positions: t,
6813
7068
  threshold: e
@@ -6827,11 +7082,11 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
6827
7082
  threshold: t,
6828
7083
  anchors: e
6829
7084
  }) => {
6830
- const { left: n, right: s, centerX: o, top: i, bottom: a, centerY: r } = h, c = gn({
7085
+ const { left: n, right: s, centerX: o, top: i, bottom: a, centerY: r } = h, c = pn({
6831
7086
  anchors: e.vertical,
6832
7087
  positions: [n, o, s],
6833
7088
  threshold: t
6834
- }), l = gn({
7089
+ }), l = pn({
6835
7090
  anchors: e.horizontal,
6836
7091
  positions: [i, r, a],
6837
7092
  threshold: t
@@ -6860,111 +7115,111 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
6860
7115
  left: a,
6861
7116
  right: r
6862
7117
  } = h, c = [];
6863
- for (const M of t) {
6864
- const { left: A, right: w } = M;
6865
- Math.min(w, r) - Math.max(A, a) > 0 && c.push(M);
7118
+ for (const S of t) {
7119
+ const { left: M, right: w } = S;
7120
+ Math.min(w, r) - Math.max(M, a) > 0 && c.push(S);
6866
7121
  }
6867
7122
  if (!c.length)
6868
7123
  return { delta: 0, guide: null };
6869
7124
  const l = [];
6870
- for (const M of c)
6871
- l.push({ bounds: M, isActive: !1 });
6872
- l.push({ bounds: h, isActive: !0 }), Sn({ items: l, axis: "top" });
6873
- const d = wn({ items: l });
7125
+ for (const S of c)
7126
+ l.push({ bounds: S, isActive: !1 });
7127
+ l.push({ bounds: h, isActive: !0 }), wn({ items: l, axis: "top" });
7128
+ const d = jn({ items: l });
6874
7129
  if (d === -1)
6875
7130
  return { delta: 0, guide: null };
6876
7131
  const u = [], f = i - o, g = l[d - 1], m = l[d + 1];
6877
7132
  if (g && m) {
6878
- const { bounds: M } = g, { bounds: A } = m, { bottom: w } = M, { top: I } = A, j = I - w - f;
6879
- if (j >= 0) {
6880
- const O = j / 2;
6881
- if (yt({ value: O, step: ot })) {
6882
- const D = Ue({ value: O, step: ot }), W = o - w, E = I - i, L = Math.abs(W - D), z = Math.abs(E - D), B = Math.max(L, z);
7133
+ const { bounds: S } = g, { bounds: M } = m, { bottom: w } = S, { top: C } = M, I = C - w - f;
7134
+ if (I >= 0) {
7135
+ const T = I / 2;
7136
+ if (vt({ value: T, step: ot })) {
7137
+ const _ = Ye({ value: T, step: ot }), W = o - w, E = C - i, L = Math.abs(W - _), P = Math.abs(E - _), B = Math.max(L, P);
6883
7138
  if (B <= e) {
6884
- const P = D - W;
6885
- if (yt({ value: P, step: ot })) {
6886
- const _ = i + P, R = {
7139
+ const z = _ - W;
7140
+ if (vt({ value: z, step: ot })) {
7141
+ const D = i + z, R = {
6887
7142
  type: "vertical",
6888
7143
  axis: s,
6889
7144
  refStart: w,
6890
- refEnd: w + D,
6891
- activeStart: _,
6892
- activeEnd: _ + D,
6893
- distance: D
7145
+ refEnd: w + _,
7146
+ activeStart: D,
7147
+ activeEnd: D + _,
7148
+ distance: _
6894
7149
  };
6895
- u.push({ delta: P, guide: R, diff: B });
7150
+ u.push({ delta: z, guide: R, diff: B });
6896
7151
  }
6897
7152
  }
6898
7153
  }
6899
7154
  }
6900
7155
  }
6901
7156
  const p = An({ items: l, axis: "vertical" });
6902
- let y = null, v = null, C = null, b = null;
7157
+ let y = null, v = null, A = null, b = null;
6903
7158
  if (g) {
6904
- C = g.bounds;
6905
- const { bottom: M } = C, A = o - M;
6906
- A >= 0 && (y = A);
7159
+ A = g.bounds;
7160
+ const { bottom: S } = A, M = o - S;
7161
+ M >= 0 && (y = M);
6907
7162
  }
6908
7163
  if (m) {
6909
7164
  b = m.bounds;
6910
- const { top: M } = b, A = M - i;
6911
- A >= 0 && (v = A);
7165
+ const { top: S } = b, M = S - i;
7166
+ M >= 0 && (v = M);
6912
7167
  }
6913
- for (const M of p) {
7168
+ for (const S of p) {
6914
7169
  const {
6915
- beforeIndex: A,
7170
+ beforeIndex: M,
6916
7171
  afterIndex: w,
6917
- start: I,
6918
- end: S,
6919
- distance: j
6920
- } = M;
6921
- if (!(A === d || w === d || !yt({ value: j, step: ot }))) {
6922
- if (y !== null && C) {
6923
- const k = Math.abs(y - j);
7172
+ start: C,
7173
+ end: j,
7174
+ distance: I
7175
+ } = S;
7176
+ if (!(M === d || w === d || !vt({ value: I, step: ot }))) {
7177
+ if (y !== null && A) {
7178
+ const k = Math.abs(y - I);
6924
7179
  if (k <= e) {
6925
- const D = j - y;
6926
- if (!yt({ value: D, step: ot })) continue;
6927
- const E = o + D, { bottom: L } = C, z = {
7180
+ const _ = I - y;
7181
+ if (!vt({ value: _, step: ot })) continue;
7182
+ const E = o + _, { bottom: L } = A, P = {
6928
7183
  type: "vertical",
6929
7184
  axis: s,
6930
- refStart: I,
6931
- refEnd: S,
7185
+ refStart: C,
7186
+ refEnd: j,
6932
7187
  activeStart: L,
6933
7188
  activeEnd: E,
6934
- distance: j
7189
+ distance: I
6935
7190
  };
6936
- u.push({ delta: D, guide: z, diff: k });
7191
+ u.push({ delta: _, guide: P, diff: k });
6937
7192
  }
6938
7193
  }
6939
7194
  if (v !== null && b) {
6940
- const k = Math.abs(v - j);
7195
+ const k = Math.abs(v - I);
6941
7196
  if (k <= e) {
6942
- const D = v - j;
6943
- if (!yt({ value: D, step: ot })) continue;
6944
- const E = i + D, { top: L } = b, z = {
7197
+ const _ = v - I;
7198
+ if (!vt({ value: _, step: ot })) continue;
7199
+ const E = i + _, { top: L } = b, P = {
6945
7200
  type: "vertical",
6946
7201
  axis: s,
6947
- refStart: I,
6948
- refEnd: S,
7202
+ refStart: C,
7203
+ refEnd: j,
6949
7204
  activeStart: E,
6950
7205
  activeEnd: L,
6951
- distance: j
7206
+ distance: I
6952
7207
  };
6953
- u.push({ delta: D, guide: z, diff: k });
7208
+ u.push({ delta: _, guide: P, diff: k });
6954
7209
  }
6955
7210
  }
6956
7211
  }
6957
7212
  }
6958
7213
  if (!u.length)
6959
7214
  return { delta: 0, guide: null };
6960
- let T = u[0];
6961
- for (let M = 1; M < u.length; M += 1) {
6962
- const A = u[M];
6963
- A.diff < T.diff && (T = A);
7215
+ let O = u[0];
7216
+ for (let S = 1; S < u.length; S += 1) {
7217
+ const M = u[S];
7218
+ M.diff < O.diff && (O = M);
6964
7219
  }
6965
7220
  return {
6966
- delta: T.delta,
6967
- guide: T.guide
7221
+ delta: O.delta,
7222
+ guide: O.guide
6968
7223
  };
6969
7224
  }, Hs = ({
6970
7225
  activeBounds: h,
@@ -6979,111 +7234,111 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
6979
7234
  top: a,
6980
7235
  bottom: r
6981
7236
  } = h, c = [];
6982
- for (const M of t) {
6983
- const { top: A, bottom: w } = M;
6984
- Math.min(w, r) - Math.max(A, a) > 0 && c.push(M);
7237
+ for (const S of t) {
7238
+ const { top: M, bottom: w } = S;
7239
+ Math.min(w, r) - Math.max(M, a) > 0 && c.push(S);
6985
7240
  }
6986
7241
  if (!c.length)
6987
7242
  return { delta: 0, guide: null };
6988
7243
  const l = [];
6989
- for (const M of c)
6990
- l.push({ bounds: M, isActive: !1 });
6991
- l.push({ bounds: h, isActive: !0 }), Sn({ items: l, axis: "left" });
6992
- const d = wn({ items: l });
7244
+ for (const S of c)
7245
+ l.push({ bounds: S, isActive: !1 });
7246
+ l.push({ bounds: h, isActive: !0 }), wn({ items: l, axis: "left" });
7247
+ const d = jn({ items: l });
6993
7248
  if (d === -1)
6994
7249
  return { delta: 0, guide: null };
6995
7250
  const u = [], f = i - o, g = l[d - 1], m = l[d + 1];
6996
7251
  if (g && m) {
6997
- const { bounds: M } = g, { bounds: A } = m, { right: w } = M, { left: I } = A, j = I - w - f;
6998
- if (j >= 0) {
6999
- const O = j / 2;
7000
- if (yt({ value: O, step: ot })) {
7001
- const D = Ue({ value: O, step: ot }), W = o - w, E = I - i, L = Math.abs(W - D), z = Math.abs(E - D), B = Math.max(L, z);
7252
+ const { bounds: S } = g, { bounds: M } = m, { right: w } = S, { left: C } = M, I = C - w - f;
7253
+ if (I >= 0) {
7254
+ const T = I / 2;
7255
+ if (vt({ value: T, step: ot })) {
7256
+ const _ = Ye({ value: T, step: ot }), W = o - w, E = C - i, L = Math.abs(W - _), P = Math.abs(E - _), B = Math.max(L, P);
7002
7257
  if (B <= e) {
7003
- const P = D - W;
7004
- if (yt({ value: P, step: ot })) {
7005
- const _ = i + P, R = {
7258
+ const z = _ - W;
7259
+ if (vt({ value: z, step: ot })) {
7260
+ const D = i + z, R = {
7006
7261
  type: "horizontal",
7007
7262
  axis: s,
7008
7263
  refStart: w,
7009
- refEnd: w + D,
7010
- activeStart: _,
7011
- activeEnd: _ + D,
7012
- distance: D
7264
+ refEnd: w + _,
7265
+ activeStart: D,
7266
+ activeEnd: D + _,
7267
+ distance: _
7013
7268
  };
7014
- u.push({ delta: P, guide: R, diff: B });
7269
+ u.push({ delta: z, guide: R, diff: B });
7015
7270
  }
7016
7271
  }
7017
7272
  }
7018
7273
  }
7019
7274
  }
7020
7275
  const p = An({ items: l, axis: "horizontal" });
7021
- let y = null, v = null, C = null, b = null;
7276
+ let y = null, v = null, A = null, b = null;
7022
7277
  if (g) {
7023
- C = g.bounds;
7024
- const { right: M } = C, A = o - M;
7025
- A >= 0 && (y = A);
7278
+ A = g.bounds;
7279
+ const { right: S } = A, M = o - S;
7280
+ M >= 0 && (y = M);
7026
7281
  }
7027
7282
  if (m) {
7028
7283
  b = m.bounds;
7029
- const { left: M } = b, A = M - i;
7030
- A >= 0 && (v = A);
7284
+ const { left: S } = b, M = S - i;
7285
+ M >= 0 && (v = M);
7031
7286
  }
7032
- for (const M of p) {
7287
+ for (const S of p) {
7033
7288
  const {
7034
- beforeIndex: A,
7289
+ beforeIndex: M,
7035
7290
  afterIndex: w,
7036
- start: I,
7037
- end: S,
7038
- distance: j
7039
- } = M;
7040
- if (!(A === d || w === d || !yt({ value: j, step: ot }))) {
7041
- if (y !== null && C) {
7042
- const k = Math.abs(y - j);
7291
+ start: C,
7292
+ end: j,
7293
+ distance: I
7294
+ } = S;
7295
+ if (!(M === d || w === d || !vt({ value: I, step: ot }))) {
7296
+ if (y !== null && A) {
7297
+ const k = Math.abs(y - I);
7043
7298
  if (k <= e) {
7044
- const D = j - y;
7045
- if (!yt({ value: D, step: ot })) continue;
7046
- const E = o + D, { right: L } = C, z = {
7299
+ const _ = I - y;
7300
+ if (!vt({ value: _, step: ot })) continue;
7301
+ const E = o + _, { right: L } = A, P = {
7047
7302
  type: "horizontal",
7048
7303
  axis: s,
7049
- refStart: I,
7050
- refEnd: S,
7304
+ refStart: C,
7305
+ refEnd: j,
7051
7306
  activeStart: L,
7052
7307
  activeEnd: E,
7053
- distance: j
7308
+ distance: I
7054
7309
  };
7055
- u.push({ delta: D, guide: z, diff: k });
7310
+ u.push({ delta: _, guide: P, diff: k });
7056
7311
  }
7057
7312
  }
7058
7313
  if (v !== null && b) {
7059
- const k = Math.abs(v - j);
7314
+ const k = Math.abs(v - I);
7060
7315
  if (k <= e) {
7061
- const D = v - j;
7062
- if (!yt({ value: D, step: ot })) continue;
7063
- const E = i + D, { left: L } = b, z = {
7316
+ const _ = v - I;
7317
+ if (!vt({ value: _, step: ot })) continue;
7318
+ const E = i + _, { left: L } = b, P = {
7064
7319
  type: "horizontal",
7065
7320
  axis: s,
7066
- refStart: I,
7067
- refEnd: S,
7321
+ refStart: C,
7322
+ refEnd: j,
7068
7323
  activeStart: E,
7069
7324
  activeEnd: L,
7070
- distance: j
7325
+ distance: I
7071
7326
  };
7072
- u.push({ delta: D, guide: z, diff: k });
7327
+ u.push({ delta: _, guide: P, diff: k });
7073
7328
  }
7074
7329
  }
7075
7330
  }
7076
7331
  }
7077
7332
  if (!u.length)
7078
7333
  return { delta: 0, guide: null };
7079
- let T = u[0];
7080
- for (let M = 1; M < u.length; M += 1) {
7081
- const A = u[M];
7082
- A.diff < T.diff && (T = A);
7334
+ let O = u[0];
7335
+ for (let S = 1; S < u.length; S += 1) {
7336
+ const M = u[S];
7337
+ M.diff < O.diff && (O = M);
7083
7338
  }
7084
7339
  return {
7085
- delta: T.delta,
7086
- guide: T.guide
7340
+ delta: O.delta,
7341
+ guide: O.guide
7087
7342
  };
7088
7343
  }, Zs = ({
7089
7344
  activeBounds: h,
@@ -7117,7 +7372,7 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
7117
7372
  }) => {
7118
7373
  const i = Math.min(o, n / 2, s / 2);
7119
7374
  h.moveTo(t + i, e), h.lineTo(t + n - i, e), h.quadraticCurveTo(t + n, e, t + n, e + i), h.lineTo(t + n, e + s - i), h.quadraticCurveTo(t + n, e + s, t + n - i, e + s), h.lineTo(t + i, e + s), h.quadraticCurveTo(t, e + s, t, e + s - i), h.lineTo(t, e + i), h.quadraticCurveTo(t, e, t + i, e), h.closePath();
7120
- }, ke = ({
7375
+ }, Be = ({
7121
7376
  context: h,
7122
7377
  type: t,
7123
7378
  axis: e,
@@ -7134,17 +7389,17 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
7134
7389
  offsetAlongAxis: f = 0,
7135
7390
  offsetPerpendicular: g = 0
7136
7391
  }) => {
7137
- const m = i || 1, p = 12 / m, y = d / m, v = u / m, C = (n + s) / 2 + f, b = t === "vertical" ? e + g : C, T = t === "vertical" ? C : e + g;
7392
+ const m = i || 1, p = 12 / m, y = d / m, v = u / m, A = (n + s) / 2 + f, b = t === "vertical" ? e + g : A, O = t === "vertical" ? A : e + g;
7138
7393
  h.save(), h.setLineDash([]), h.fillStyle = a, h.strokeStyle = a, h.lineWidth = l / m, h.font = `${p}px ${c}`, h.textAlign = "center", h.textBaseline = "middle";
7139
- const A = h.measureText(o).width + y * 2, w = p + y * 2, I = b - A / 2, S = T - w / 2;
7394
+ const M = h.measureText(o).width + y * 2, w = p + y * 2, C = b - M / 2, j = O - w / 2;
7140
7395
  h.beginPath(), Gs({
7141
7396
  context: h,
7142
- x: I,
7143
- y: S,
7144
- width: A,
7397
+ x: C,
7398
+ y: j,
7399
+ width: M,
7145
7400
  height: w,
7146
7401
  radius: v
7147
- }), h.fill(), h.fillStyle = r, h.fillText(o, b, T), h.restore();
7402
+ }), h.fill(), h.fillStyle = r, h.fillText(o, b, O), h.restore();
7148
7403
  }, Vs = ({
7149
7404
  context: h,
7150
7405
  guide: t,
@@ -7160,8 +7415,8 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
7160
7415
  distance: c
7161
7416
  } = t, l = Math.round(c).toString();
7162
7417
  h.beginPath(), n === "vertical" ? (h.moveTo(s, o), h.lineTo(s, i), h.moveTo(s, a), h.lineTo(s, r)) : (h.moveTo(o, s), h.lineTo(i, s), h.moveTo(a, s), h.lineTo(r, s)), h.stroke();
7163
- const d = Mn;
7164
- ke({
7418
+ const d = Sn;
7419
+ Be({
7165
7420
  context: h,
7166
7421
  type: n,
7167
7422
  axis: s,
@@ -7170,8 +7425,8 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
7170
7425
  text: l,
7171
7426
  zoom: e,
7172
7427
  color: d,
7173
- lineWidth: Re
7174
- }), ke({
7428
+ lineWidth: ke
7429
+ }), Be({
7175
7430
  context: h,
7176
7431
  type: n,
7177
7432
  axis: s,
@@ -7180,9 +7435,9 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
7180
7435
  text: l,
7181
7436
  zoom: e,
7182
7437
  color: d,
7183
- lineWidth: Re
7438
+ lineWidth: ke
7184
7439
  });
7185
- }, pn = ({
7440
+ }, mn = ({
7186
7441
  anchors: h,
7187
7442
  bounds: t
7188
7443
  }) => {
@@ -7195,7 +7450,7 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
7195
7450
  centerY: a
7196
7451
  } = t;
7197
7452
  h.vertical.push(e, s, n), h.horizontal.push(o, a, i);
7198
- }, mn = ({
7453
+ }, yn = ({
7199
7454
  bounds: h,
7200
7455
  type: t,
7201
7456
  primaryStart: e,
@@ -7225,24 +7480,24 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
7225
7480
  }, Xs = ({
7226
7481
  bounds: h
7227
7482
  }) => {
7228
- const t = mn({
7483
+ const t = yn({
7229
7484
  bounds: h,
7230
7485
  type: "vertical",
7231
7486
  primaryStart: "top",
7232
7487
  primaryEnd: "bottom"
7233
- }), e = mn({
7488
+ }), e = yn({
7234
7489
  bounds: h,
7235
7490
  type: "horizontal",
7236
7491
  primaryStart: "left",
7237
7492
  primaryEnd: "right"
7238
7493
  });
7239
7494
  return { vertical: t, horizontal: e };
7240
- }, Ks = ["montage-area", "background", "interaction-blocker"], jn = ({
7495
+ }, Ks = ["montage-area", "background", "interaction-blocker"], Cn = ({
7241
7496
  activeObject: h
7242
7497
  }) => {
7243
7498
  const t = /* @__PURE__ */ new Set();
7244
7499
  return h && (t.add(h), h instanceof X && h.getObjects().forEach((e) => t.add(e))), t;
7245
- }, Cn = ({
7500
+ }, In = ({
7246
7501
  object: h,
7247
7502
  excluded: t,
7248
7503
  ignoredIds: e = Ks
@@ -7311,12 +7566,12 @@ class $ {
7311
7566
  return;
7312
7567
  }
7313
7568
  $._applyMovementStep({ target: e }), !this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: e });
7314
- let o = mt({ object: e });
7569
+ let o = yt({ object: e });
7315
7570
  if (!o) {
7316
7571
  this._clearGuides();
7317
7572
  return;
7318
7573
  }
7319
- const { canvas: i } = this, a = i.getZoom() || 1, r = Ce / a, c = Us({
7574
+ const { canvas: i } = this, a = i.getZoom() || 1, r = Ie / a, c = Us({
7320
7575
  activeBounds: o,
7321
7576
  threshold: r,
7322
7577
  anchors: this.anchors
@@ -7326,9 +7581,9 @@ class $ {
7326
7581
  e.set({
7327
7582
  left: y + l,
7328
7583
  top: v + d
7329
- }), e.setCoords(), o = (m = mt({ object: e })) != null ? m : o;
7584
+ }), e.setCoords(), o = (m = yt({ object: e })) != null ? m : o;
7330
7585
  }
7331
- const f = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((y) => mt({ object: y })).filter((y) => !!y), g = Zs({
7586
+ const f = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((y) => yt({ object: y })).filter((y) => !!y), g = Zs({
7332
7587
  activeBounds: o,
7333
7588
  candidates: f,
7334
7589
  threshold: r,
@@ -7339,7 +7594,7 @@ class $ {
7339
7594
  e.set({
7340
7595
  left: y + g.deltaX,
7341
7596
  top: v + g.deltaY
7342
- }), e.setCoords(), o = (p = mt({ object: e })) != null ? p : o;
7597
+ }), e.setCoords(), o = (p = yt({ object: e })) != null ? p : o;
7343
7598
  }
7344
7599
  this._applyGuides({
7345
7600
  guides: u,
@@ -7373,76 +7628,76 @@ class $ {
7373
7628
  horizontal: d
7374
7629
  } = c;
7375
7630
  !l.length && !d.length && this._cacheAnchors({ activeObject: e });
7376
- const u = mt({ object: e });
7631
+ const u = yt({ object: e });
7377
7632
  if (!u) {
7378
7633
  this._clearGuides();
7379
7634
  return;
7380
7635
  }
7381
- const { canvas: f } = this, g = f.getZoom() || 1, m = Ce / g, {
7636
+ const { canvas: f } = this, g = f.getZoom() || 1, m = Ie / g, {
7382
7637
  originX: p,
7383
7638
  originY: y
7384
7639
  } = s, {
7385
7640
  originX: v = "left",
7386
- originY: C = "top",
7641
+ originY: A = "top",
7387
7642
  scaleX: b = 1,
7388
- scaleY: T = 1
7389
- } = e, M = p != null ? p : v, A = y != null ? y : C, w = $._collectVerticalSnapCandidates({
7643
+ scaleY: O = 1
7644
+ } = e, S = p != null ? p : v, M = y != null ? y : A, w = $._collectVerticalSnapCandidates({
7390
7645
  bounds: u,
7391
- originX: M,
7646
+ originX: S,
7392
7647
  shouldSnapX: i
7393
- }), I = $._collectHorizontalSnapCandidates({
7648
+ }), C = $._collectHorizontalSnapCandidates({
7394
7649
  bounds: u,
7395
- originY: A,
7650
+ originY: M,
7396
7651
  shouldSnapY: a
7397
- }), S = $._findAxisSnapCandidate({
7652
+ }), j = $._findAxisSnapCandidate({
7398
7653
  anchors: l,
7399
7654
  candidates: w,
7400
7655
  threshold: m
7401
- }), j = $._findAxisSnapCandidate({
7656
+ }), I = $._findAxisSnapCandidate({
7402
7657
  anchors: d,
7403
- candidates: I,
7658
+ candidates: C,
7404
7659
  threshold: m
7405
- }), { guidePosition: O } = S, { guidePosition: k } = j, D = O !== null, W = k !== null;
7406
- if (!D && !W) {
7660
+ }), { guidePosition: T } = j, { guidePosition: k } = I, _ = T !== null, W = k !== null;
7661
+ if (!_ && !W) {
7407
7662
  this._clearGuides();
7408
7663
  return;
7409
7664
  }
7410
7665
  const E = [];
7411
- let L = null, z = null;
7666
+ let L = null, P = null;
7412
7667
  if (r) {
7413
- const P = $._resolveUniformScale({
7668
+ const z = $._resolveUniformScale({
7414
7669
  bounds: u,
7415
- originX: M,
7416
- originY: A,
7417
- verticalSnap: S,
7418
- horizontalSnap: j
7670
+ originX: S,
7671
+ originY: M,
7672
+ verticalSnap: j,
7673
+ horizontalSnap: I
7419
7674
  });
7420
- if (P) {
7421
- const { scaleFactor: x, guide: _ } = P;
7422
- L = b * x, z = T * x, E.push(_);
7675
+ if (z) {
7676
+ const { scaleFactor: x, guide: D } = z;
7677
+ L = b * x, P = O * x, E.push(D);
7423
7678
  }
7424
7679
  }
7425
7680
  if (!r) {
7426
- const { angle: P = 0 } = e, { width: x, height: _ } = $._resolveBaseDimensions({ target: e }), R = Math.abs(b) || 1, N = Math.abs(T) || 1;
7427
- if (D) {
7681
+ const { angle: z = 0 } = e, { width: x, height: D } = $._resolveBaseDimensions({ target: e }), R = Math.abs(b) || 1, N = Math.abs(O) || 1;
7682
+ if (_) {
7428
7683
  const K = $._resolveDesiredWidth({
7429
7684
  bounds: u,
7430
- originX: M,
7431
- snap: S
7685
+ originX: S,
7686
+ snap: j
7432
7687
  });
7433
7688
  if (K !== null) {
7434
7689
  const H = $._resolveScaleForWidth({
7435
7690
  desiredWidth: K,
7436
7691
  baseWidth: x,
7437
- baseHeight: _,
7692
+ baseHeight: D,
7438
7693
  scaleY: N,
7439
- angle: P
7694
+ angle: z
7440
7695
  });
7441
7696
  if (H !== null) {
7442
7697
  const q = b < 0 ? -1 : 1;
7443
- L = H * q, O !== null && E.push({
7698
+ L = H * q, T !== null && E.push({
7444
7699
  type: "vertical",
7445
- position: O
7700
+ position: T
7446
7701
  });
7447
7702
  }
7448
7703
  }
@@ -7450,20 +7705,20 @@ class $ {
7450
7705
  if (W) {
7451
7706
  const K = $._resolveDesiredHeight({
7452
7707
  bounds: u,
7453
- originY: A,
7454
- snap: j
7708
+ originY: M,
7709
+ snap: I
7455
7710
  });
7456
7711
  if (K !== null) {
7457
7712
  const H = $._resolveScaleForHeight({
7458
7713
  desiredHeight: K,
7459
7714
  baseWidth: x,
7460
- baseHeight: _,
7715
+ baseHeight: D,
7461
7716
  scaleX: R,
7462
- angle: P
7717
+ angle: z
7463
7718
  });
7464
7719
  if (H !== null) {
7465
- const q = T < 0 ? -1 : 1;
7466
- z = H * q, k !== null && E.push({
7720
+ const q = O < 0 ? -1 : 1;
7721
+ P = H * q, k !== null && E.push({
7467
7722
  type: "horizontal",
7468
7723
  position: k
7469
7724
  });
@@ -7471,14 +7726,14 @@ class $ {
7471
7726
  }
7472
7727
  }
7473
7728
  }
7474
- const B = L !== null || z !== null;
7729
+ const B = L !== null || P !== null;
7475
7730
  if (!B && !E.length) {
7476
7731
  this._clearGuides();
7477
7732
  return;
7478
7733
  }
7479
7734
  if (B) {
7480
- const P = e.getRelativeCenterPoint(), x = e.translateToOriginPoint(P, M, A), _ = {};
7481
- L !== null && (_.scaleX = L, s.scaleX = L), z !== null && (_.scaleY = z, s.scaleY = z), Object.keys(_).length && (e.set(_), e.setPositionByOrigin(x, M, A), e.setCoords());
7735
+ const z = e.getRelativeCenterPoint(), x = e.translateToOriginPoint(z, S, M), D = {};
7736
+ L !== null && (D.scaleX = L, s.scaleX = L), P !== null && (D.scaleY = P, s.scaleY = P), Object.keys(D).length && (e.set(D), e.setPositionByOrigin(x, S, M), e.setCoords());
7482
7737
  }
7483
7738
  this._applyGuides({
7484
7739
  guides: E,
@@ -7512,54 +7767,54 @@ class $ {
7512
7767
  horizontal: c
7513
7768
  } = a;
7514
7769
  !r.length && !c.length && this._cacheAnchors({ activeObject: t });
7515
- const l = mt({ object: t });
7770
+ const l = yt({ object: t });
7516
7771
  if (!l) {
7517
7772
  this._clearGuides();
7518
7773
  return;
7519
7774
  }
7520
- const { canvas: d } = this, u = d.getZoom() || 1, f = Ce / u, { originX: g, originY: m } = e, {
7775
+ const { canvas: d } = this, u = d.getZoom() || 1, f = Ie / u, { originX: g, originY: m } = e, {
7521
7776
  originX: p = "left",
7522
7777
  originY: y = "top"
7523
- } = t, v = g != null ? g : p, C = m != null ? m : y, b = $._collectVerticalSnapCandidates({
7778
+ } = t, v = g != null ? g : p, A = m != null ? m : y, b = $._collectVerticalSnapCandidates({
7524
7779
  bounds: l,
7525
7780
  originX: v,
7526
7781
  shouldSnapX: !0
7527
- }), T = $._findAxisSnapCandidate({
7782
+ }), O = $._findAxisSnapCandidate({
7528
7783
  anchors: r,
7529
7784
  candidates: b,
7530
7785
  threshold: f
7531
- }), { guidePosition: M } = T;
7532
- if (M === null) {
7786
+ }), { guidePosition: S } = O;
7787
+ if (S === null) {
7533
7788
  this._clearGuides();
7534
7789
  return;
7535
7790
  }
7536
- const A = $._resolveDesiredWidth({
7791
+ const M = $._resolveDesiredWidth({
7537
7792
  bounds: l,
7538
7793
  originX: v,
7539
- snap: T
7794
+ snap: O
7540
7795
  });
7541
- if (A === null) {
7796
+ if (M === null) {
7542
7797
  this._clearGuides();
7543
7798
  return;
7544
7799
  }
7545
7800
  const w = $._resolveTextWidthForBounds({
7546
7801
  target: t,
7547
- boundsWidth: A
7802
+ boundsWidth: M
7548
7803
  });
7549
7804
  if (w === null) {
7550
7805
  this._clearGuides();
7551
7806
  return;
7552
7807
  }
7553
- const { width: I = 0 } = t;
7554
- if (w !== I) {
7555
- const S = t.getRelativeCenterPoint(), j = t.translateToOriginPoint(S, v, C);
7556
- t.set({ width: w }), t.setPositionByOrigin(j, v, C), t.setCoords();
7808
+ const { width: C = 0 } = t;
7809
+ if (w !== C) {
7810
+ const j = t.getRelativeCenterPoint(), I = t.translateToOriginPoint(j, v, A);
7811
+ t.set({ width: w }), t.setPositionByOrigin(I, v, A), t.setCoords();
7557
7812
  }
7558
7813
  this._applyGuides({
7559
7814
  guides: [
7560
7815
  {
7561
7816
  type: "vertical",
7562
- position: M
7817
+ position: S
7563
7818
  }
7564
7819
  ],
7565
7820
  spacingGuides: []
@@ -7586,7 +7841,7 @@ class $ {
7586
7841
  const { canvas: t, guideBounds: e } = this, n = t.getSelectionContext();
7587
7842
  if (!n) return;
7588
7843
  const s = e != null ? e : this._calculateViewportBounds(), { left: o, right: i, top: a, bottom: r } = s, { viewportTransform: c } = t, l = t.getZoom() || 1;
7589
- n.save(), Array.isArray(c) && n.transform(...c), n.lineWidth = Re / l, n.strokeStyle = Mn, n.setLineDash([4, 4]);
7844
+ n.save(), Array.isArray(c) && n.transform(...c), n.lineWidth = ke / l, n.strokeStyle = Sn, n.setLineDash([4, 4]);
7590
7845
  for (const d of this.activeGuides)
7591
7846
  n.beginPath(), d.type === "vertical" ? (n.moveTo(d.position, a), n.lineTo(d.position, r)) : (n.moveTo(o, d.position), n.lineTo(i, d.position)), n.stroke();
7592
7847
  for (const d of this.activeSpacingGuides)
@@ -7731,31 +7986,31 @@ class $ {
7731
7986
  } = o;
7732
7987
  let p = null, y = null;
7733
7988
  if (u !== null && l > 0) {
7734
- const C = $._resolveDesiredWidth({
7989
+ const A = $._resolveDesiredWidth({
7735
7990
  bounds: t,
7736
7991
  originX: e,
7737
7992
  snap: s
7738
7993
  });
7739
- if (C !== null) {
7740
- const b = C / l;
7994
+ if (A !== null) {
7995
+ const b = A / l;
7741
7996
  Number.isFinite(b) && b > 0 && (p = b);
7742
7997
  }
7743
7998
  }
7744
7999
  if (g !== null && d > 0) {
7745
- const C = $._resolveDesiredHeight({
8000
+ const A = $._resolveDesiredHeight({
7746
8001
  bounds: t,
7747
8002
  originY: n,
7748
8003
  snap: o
7749
8004
  });
7750
- if (C !== null) {
7751
- const b = C / d;
8005
+ if (A !== null) {
8006
+ const b = A / d;
7752
8007
  Number.isFinite(b) && b > 0 && (y = b);
7753
8008
  }
7754
8009
  }
7755
8010
  let v = null;
7756
8011
  if (p !== null && y === null && (v = "x"), y !== null && p === null && (v = "y"), p !== null && y !== null) {
7757
- const C = Math.abs(f), b = Math.abs(m);
7758
- C <= b && (v = "x"), C > b && (v = "y");
8012
+ const A = Math.abs(f), b = Math.abs(m);
8013
+ A <= b && (v = "x"), A > b && (v = "y");
7759
8014
  }
7760
8015
  return v === "x" && p !== null && u !== null ? {
7761
8016
  scaleFactor: p,
@@ -7887,12 +8142,12 @@ class $ {
7887
8142
  _cacheAnchors({ activeObject: t }) {
7888
8143
  const e = this._collectTargets({ activeObject: t }), n = { vertical: [], horizontal: [] }, s = [];
7889
8144
  for (const a of e) {
7890
- const r = mt({ object: a });
7891
- r && (pn({ anchors: n, bounds: r }), s.push(r));
8145
+ const r = yt({ object: a });
8146
+ r && (mn({ anchors: n, bounds: r }), s.push(r));
7892
8147
  }
7893
- const { montageArea: o } = this.editor, i = mt({ object: o });
8148
+ const { montageArea: o } = this.editor, i = yt({ object: o });
7894
8149
  if (i) {
7895
- pn({ anchors: n, bounds: i });
8150
+ mn({ anchors: n, bounds: i });
7896
8151
  const { left: a, right: r, top: c, bottom: l } = i;
7897
8152
  this.guideBounds = {
7898
8153
  left: a,
@@ -7908,9 +8163,9 @@ class $ {
7908
8163
  * Собирает объекты, подходящие для прилипания, исключая активный объект и запрещённые id.
7909
8164
  */
7910
8165
  _collectTargets({ activeObject: t }) {
7911
- const e = jn({ activeObject: t }), n = [];
8166
+ const e = Cn({ activeObject: t }), n = [];
7912
8167
  return this.canvas.forEachObject((s) => {
7913
- Cn({ object: s, excluded: e }) || n.push(s);
8168
+ In({ object: s, excluded: e }) || n.push(s);
7914
8169
  }), n;
7915
8170
  }
7916
8171
  /**
@@ -7933,8 +8188,8 @@ class $ {
7933
8188
  };
7934
8189
  }
7935
8190
  }
7936
- const yn = "#3D8BF4", vn = 1;
7937
- class Wt {
8191
+ const vn = "#3D8BF4", bn = 1;
8192
+ class Ut {
7938
8193
  /**
7939
8194
  * Создаёт менеджер измерений и инициализирует события.
7940
8195
  */
@@ -8039,15 +8294,15 @@ class Wt {
8039
8294
  this._clearGuides();
8040
8295
  return;
8041
8296
  }
8042
- const o = mt({ object: s });
8297
+ const o = yt({ object: s });
8043
8298
  if (!o) {
8044
8299
  this._clearGuides();
8045
8300
  return;
8046
8301
  }
8047
- const i = Wt._resolveTarget({
8302
+ const i = Ut._resolveTarget({
8048
8303
  event: t,
8049
8304
  activeObject: s
8050
- }), { montageArea: a } = n, r = i != null ? i : a, c = r === a, l = mt({ object: r });
8305
+ }), { montageArea: a } = n, r = i != null ? i : a, c = r === a, l = yt({ object: r });
8051
8306
  if (!l) {
8052
8307
  this._clearGuides();
8053
8308
  return;
@@ -8056,7 +8311,7 @@ class Wt {
8056
8311
  this._clearGuides();
8057
8312
  return;
8058
8313
  }
8059
- const u = Wt._buildGuides({
8314
+ const u = Ut._buildGuides({
8060
8315
  activeBounds: o,
8061
8316
  targetBounds: l,
8062
8317
  targetIsMontageArea: c
@@ -8074,8 +8329,8 @@ class Wt {
8074
8329
  event: t,
8075
8330
  activeObject: e
8076
8331
  }) {
8077
- const { target: n } = t, s = jn({ activeObject: e });
8078
- return n && !Cn({ object: n, excluded: s }) ? n : null;
8332
+ const { target: n } = t, s = Cn({ activeObject: e });
8333
+ return n && !In({ object: n, excluded: s }) ? n : null;
8079
8334
  }
8080
8335
  /**
8081
8336
  * Собирает вертикальные и горизонтальные направляющие расстояний.
@@ -8085,11 +8340,11 @@ class Wt {
8085
8340
  targetBounds: e,
8086
8341
  targetIsMontageArea: n
8087
8342
  }) {
8088
- const s = Wt._buildHorizontalGuides({
8343
+ const s = Ut._buildHorizontalGuides({
8089
8344
  activeBounds: t,
8090
8345
  targetBounds: e,
8091
8346
  targetIsMontageArea: n
8092
- }), o = Wt._buildVerticalGuides({
8347
+ }), o = Ut._buildVerticalGuides({
8093
8348
  activeBounds: t,
8094
8349
  targetBounds: e,
8095
8350
  targetIsMontageArea: n
@@ -8119,42 +8374,42 @@ class Wt {
8119
8374
  } = e, m = Math.max(a, u), p = Math.min(r, f), v = p >= m ? (m + p) / 2 : (c + g) / 2;
8120
8375
  if (l >= i) {
8121
8376
  if (n) return s;
8122
- const j = l - i;
8123
- return j > 0 && s.push({
8377
+ const I = l - i;
8378
+ return I > 0 && s.push({
8124
8379
  type: "horizontal",
8125
8380
  axis: v,
8126
8381
  start: i,
8127
8382
  end: l,
8128
- distance: j
8383
+ distance: I
8129
8384
  }), s;
8130
8385
  }
8131
8386
  if (d <= o) {
8132
8387
  if (n) return s;
8133
- const j = o - d;
8134
- return j > 0 && s.push({
8388
+ const I = o - d;
8389
+ return I > 0 && s.push({
8135
8390
  type: "horizontal",
8136
8391
  axis: v,
8137
8392
  start: d,
8138
8393
  end: o,
8139
- distance: j
8394
+ distance: I
8140
8395
  }), s;
8141
8396
  }
8142
8397
  if (!n) return s;
8143
- const C = o < l, b = i > d, T = Math.min(o, l), M = Math.max(o, l), A = M - T;
8144
- A > 0 && !C && s.push({
8398
+ const A = o < l, b = i > d, O = Math.min(o, l), S = Math.max(o, l), M = S - O;
8399
+ M > 0 && !A && s.push({
8145
8400
  type: "horizontal",
8146
8401
  axis: v,
8147
- start: T,
8148
- end: M,
8149
- distance: A
8402
+ start: O,
8403
+ end: S,
8404
+ distance: M
8150
8405
  });
8151
- const w = Math.min(i, d), I = Math.max(i, d), S = I - w;
8152
- return S > 0 && !b && s.push({
8406
+ const w = Math.min(i, d), C = Math.max(i, d), j = C - w;
8407
+ return j > 0 && !b && s.push({
8153
8408
  type: "horizontal",
8154
8409
  axis: v,
8155
8410
  start: w,
8156
- end: I,
8157
- distance: S
8411
+ end: C,
8412
+ distance: j
8158
8413
  }), s;
8159
8414
  }
8160
8415
  /**
@@ -8180,42 +8435,42 @@ class Wt {
8180
8435
  } = e, m = Math.max(a, u), p = Math.min(r, f), v = p >= m ? (m + p) / 2 : (c + g) / 2;
8181
8436
  if (l >= i) {
8182
8437
  if (n) return s;
8183
- const j = l - i;
8184
- return j > 0 && s.push({
8438
+ const I = l - i;
8439
+ return I > 0 && s.push({
8185
8440
  type: "vertical",
8186
8441
  axis: v,
8187
8442
  start: i,
8188
8443
  end: l,
8189
- distance: j
8444
+ distance: I
8190
8445
  }), s;
8191
8446
  }
8192
8447
  if (d <= o) {
8193
8448
  if (n) return s;
8194
- const j = o - d;
8195
- return j > 0 && s.push({
8449
+ const I = o - d;
8450
+ return I > 0 && s.push({
8196
8451
  type: "vertical",
8197
8452
  axis: v,
8198
8453
  start: d,
8199
8454
  end: o,
8200
- distance: j
8455
+ distance: I
8201
8456
  }), s;
8202
8457
  }
8203
8458
  if (!n) return s;
8204
- const C = o < l, b = i > d, T = Math.min(o, l), M = Math.max(o, l), A = M - T;
8205
- A > 0 && !C && s.push({
8459
+ const A = o < l, b = i > d, O = Math.min(o, l), S = Math.max(o, l), M = S - O;
8460
+ M > 0 && !A && s.push({
8206
8461
  type: "vertical",
8207
8462
  axis: v,
8208
- start: T,
8209
- end: M,
8210
- distance: A
8463
+ start: O,
8464
+ end: S,
8465
+ distance: M
8211
8466
  });
8212
- const w = Math.min(i, d), I = Math.max(i, d), S = I - w;
8213
- return S > 0 && !b && s.push({
8467
+ const w = Math.min(i, d), C = Math.max(i, d), j = C - w;
8468
+ return j > 0 && !b && s.push({
8214
8469
  type: "vertical",
8215
8470
  axis: v,
8216
8471
  start: w,
8217
- end: I,
8218
- distance: S
8472
+ end: C,
8473
+ distance: j
8219
8474
  }), s;
8220
8475
  }
8221
8476
  /**
@@ -8243,10 +8498,10 @@ class Wt {
8243
8498
  const { canvas: t } = this, e = t.getSelectionContext();
8244
8499
  if (!e) return;
8245
8500
  const { viewportTransform: n } = t, s = t.getZoom() || 1, o = this.activeGuides.some((c) => c.type === "vertical"), i = this.activeGuides.some((c) => c.type === "horizontal"), a = o && i && !this.isTargetMontageArea, r = a ? 12 / s : 0;
8246
- e.save(), Array.isArray(n) && e.transform(...n), e.lineWidth = vn / s, e.strokeStyle = yn, e.setLineDash([]);
8501
+ e.save(), Array.isArray(n) && e.transform(...n), e.lineWidth = bn / s, e.strokeStyle = vn, e.setLineDash([]);
8247
8502
  for (const c of this.activeGuides) {
8248
8503
  const { type: l, axis: d, start: u, end: f, distance: g } = c, m = Math.abs(f - u), p = u <= f ? -1 : 1, y = a ? p * (m / 2 + r) : 0, v = 0;
8249
- e.beginPath(), l === "vertical" ? (e.moveTo(d, u), e.lineTo(d, f)) : (e.moveTo(u, d), e.lineTo(f, d)), e.stroke(), ke({
8504
+ e.beginPath(), l === "vertical" ? (e.moveTo(d, u), e.lineTo(d, f)) : (e.moveTo(u, d), e.lineTo(f, d)), e.stroke(), Be({
8250
8505
  context: e,
8251
8506
  type: l,
8252
8507
  axis: d,
@@ -8254,8 +8509,8 @@ class Wt {
8254
8509
  end: f,
8255
8510
  text: Math.round(g).toString(),
8256
8511
  zoom: s,
8257
- color: yn,
8258
- lineWidth: vn,
8512
+ color: vn,
8513
+ lineWidth: bn,
8259
8514
  offsetAlongAxis: y,
8260
8515
  offsetPerpendicular: v
8261
8516
  });
@@ -8281,7 +8536,7 @@ class Wt {
8281
8536
  (e = t == null ? void 0 : t.showAfterTemporary) == null || e.call(t), this.isToolbarHidden = !1;
8282
8537
  }
8283
8538
  }
8284
- class Ye {
8539
+ class He {
8285
8540
  /**
8286
8541
  * Конструктор класса ImageEditor.
8287
8542
  * @param canvasId - идентификатор канваса, в котором будет создан редактор
@@ -8311,12 +8566,12 @@ class Ye {
8311
8566
  showRotationAngle: l,
8312
8567
  _onReadyCallback: d
8313
8568
  } = this.options;
8314
- if (ut.apply(), this.canvas = new kn(this.containerId, this.options), this.moduleLoader = new Fn(), this.workerManager = new Un(), this.errorManager = new te({ editor: this }), this.historyManager = new J({ editor: this }), this.toolbar = new is({ editor: this }), this.transformManager = new gs({ editor: this }), this.zoomManager = new ps({ editor: this }), this.canvasManager = new fs({ editor: this }), this.imageManager = new pt({ editor: this }), this.layerManager = new pe({ editor: this }), this.shapeManager = new ys({ editor: this }), this.interactionBlocker = new ms({ editor: this }), this.backgroundManager = new Ft({ editor: this }), this.clipboardManager = new vs({ editor: this }), this.objectLockManager = new me({ editor: this }), this.groupingManager = new bs({ editor: this }), this.selectionManager = new Ms({ editor: this }), this.deletionManager = new We({ editor: this }), this.panConstraintManager = new Ss({ editor: this }), this.snappingManager = new $({ editor: this }), this.measurementManager = new Wt({ editor: this }), this.fontManager = new De((u = this.options.fonts) != null ? u : []), this.textManager = new rt({ editor: this }), this.templateManager = new Z({ editor: this }), l && (this.angleIndicator = new Fe({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Be({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(n), this.canvasManager.setCanvasWrapperHeight(s), this.canvasManager.setCanvasCSSWidth(o), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
8569
+ if (ut.apply(), this.canvas = new Bn(this.containerId, this.options), this.moduleLoader = new Wn(), this.workerManager = new Yn(), this.errorManager = new ee({ editor: this }), this.historyManager = new J({ editor: this }), this.toolbar = new os({ editor: this }), this.transformManager = new ps({ editor: this }), this.zoomManager = new ms({ editor: this }), this.canvasManager = new gs({ editor: this }), this.imageManager = new mt({ editor: this }), this.layerManager = new me({ editor: this }), this.shapeManager = new vs({ editor: this }), this.interactionBlocker = new ys({ editor: this }), this.backgroundManager = new Wt({ editor: this }), this.clipboardManager = new bs({ editor: this }), this.objectLockManager = new ye({ editor: this }), this.groupingManager = new Ms({ editor: this }), this.selectionManager = new ft({ editor: this }), this.deletionManager = new Ue({ editor: this }), this.panConstraintManager = new Ss({ editor: this }), this.snappingManager = new $({ editor: this }), this.measurementManager = new Ut({ editor: this }), this.fontManager = new Le((u = this.options.fonts) != null ? u : []), this.textManager = new rt({ editor: this }), this.templateManager = new Z({ editor: this }), l && (this.angleIndicator = new We({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Ne({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(n), this.canvasManager.setCanvasWrapperHeight(s), this.canvasManager.setCanvasCSSWidth(o), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
8315
8570
  const f = a, {
8316
8571
  source: g,
8317
8572
  scale: m = `image-${c}`,
8318
8573
  withoutSave: p = !0
8319
- } = f, y = jt(f, [
8574
+ } = f, y = Ct(f, [
8320
8575
  "source",
8321
8576
  "scale",
8322
8577
  "withoutSave"
@@ -8337,7 +8592,7 @@ class Ye {
8337
8592
  this.montageArea = this.shapeManager.addRectangle({
8338
8593
  width: t,
8339
8594
  height: e,
8340
- fill: Ye._createMosaicPattern(),
8595
+ fill: He._createMosaicPattern(),
8341
8596
  stroke: null,
8342
8597
  strokeWidth: 0,
8343
8598
  selectable: !1,
@@ -8378,7 +8633,7 @@ class Ye {
8378
8633
  */
8379
8634
  destroy() {
8380
8635
  var t, e, n, s;
8381
- this.listeners.destroy(), (t = this.snappingManager) == null || t.destroy(), (e = this.measurementManager) == null || e.destroy(), this.toolbar.destroy(), (n = this.angleIndicator) == null || n.destroy(), (s = this.textManager) == null || s.destroy(), this.canvas.dispose(), this.workerManager.worker.terminate(), this.imageManager.revokeBlobUrls(), this.errorManager.cleanBuffer();
8636
+ this.listeners.destroy(), (t = this.snappingManager) == null || t.destroy(), (e = this.measurementManager) == null || e.destroy(), this.toolbar.destroy(), (n = this.angleIndicator) == null || n.destroy(), (s = this.textManager) == null || s.destroy(), this.selectionManager.destroy(), this.canvas.dispose(), this.workerManager.worker.terminate(), this.imageManager.revokeBlobUrls(), this.errorManager.cleanBuffer();
8382
8637
  }
8383
8638
  /**
8384
8639
  * Создает паттерн мозаики.
@@ -8388,7 +8643,7 @@ class Ye {
8388
8643
  const t = document.createElement("canvas");
8389
8644
  t.width = 20, t.height = 20;
8390
8645
  const e = t.getContext("2d");
8391
- 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 Bn({
8646
+ 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 Nn({
8392
8647
  source: t,
8393
8648
  repeat: "repeat"
8394
8649
  });
@@ -9231,6 +9486,7 @@ const U = [
9231
9486
  controlsAboveOverlay: !0,
9232
9487
  centeredRotation: !0,
9233
9488
  enableRetinaScaling: !1,
9489
+ selectionKey: ["ctrlKey", "metaKey"],
9234
9490
  /*
9235
9491
  * Кастомные опции
9236
9492
  */
@@ -9302,7 +9558,6 @@ const U = [
9302
9558
  * Настройки слушателей событий
9303
9559
  */
9304
9560
  adaptCanvasToContainerOnResize: !0,
9305
- bringToFrontOnSelection: !1,
9306
9561
  mouseWheelZooming: !0,
9307
9562
  canvasDragging: !0,
9308
9563
  copyObjectsByHotkey: !0,
@@ -9324,7 +9579,7 @@ function ni(h, t = {}) {
9324
9579
  const s = document.createElement("canvas");
9325
9580
  return s.id = `${h}-canvas`, n.appendChild(s), e.editorContainer = n, new Promise((o) => {
9326
9581
  e._onReadyCallback = o;
9327
- const i = new Ye(s.id, e);
9582
+ const i = new He(s.id, e);
9328
9583
  window[h] = i;
9329
9584
  });
9330
9585
  }