@anu3ev/fabric-image-editor 0.1.60 → 0.1.62

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,49 +1,49 @@
1
- var fe = Object.defineProperty, je = Object.defineProperties;
2
- var be = Object.getOwnPropertyDescriptors;
3
- var H = Object.getOwnPropertySymbols;
4
- var ce = Object.prototype.hasOwnProperty, de = Object.prototype.propertyIsEnumerable;
5
- var re = (c, e, t) => e in c ? fe(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t, y = (c, e) => {
1
+ var be = Object.defineProperty, ye = Object.defineProperties;
2
+ var pe = Object.getOwnPropertyDescriptors;
3
+ var Y = Object.getOwnPropertySymbols;
4
+ var de = Object.prototype.hasOwnProperty, le = Object.prototype.propertyIsEnumerable;
5
+ var ce = (r, e, t) => e in r ? be(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, y = (r, e) => {
6
6
  for (var t in e || (e = {}))
7
- ce.call(e, t) && re(c, t, e[t]);
8
- if (H)
9
- for (var t of H(e))
10
- de.call(e, t) && re(c, t, e[t]);
11
- return c;
12
- }, le = (c, e) => je(c, be(e));
13
- var Y = (c, e) => {
7
+ de.call(e, t) && ce(r, t, e[t]);
8
+ if (Y)
9
+ for (var t of Y(e))
10
+ le.call(e, t) && ce(r, t, e[t]);
11
+ return r;
12
+ }, he = (r, e) => ye(r, pe(e));
13
+ var _ = (r, e) => {
14
14
  var t = {};
15
- for (var s in c)
16
- ce.call(c, s) && e.indexOf(s) < 0 && (t[s] = c[s]);
17
- if (c != null && H)
18
- for (var s of H(c))
19
- e.indexOf(s) < 0 && de.call(c, s) && (t[s] = c[s]);
15
+ for (var s in r)
16
+ de.call(r, s) && e.indexOf(s) < 0 && (t[s] = r[s]);
17
+ if (r != null && Y)
18
+ for (var s of Y(r))
19
+ e.indexOf(s) < 0 && le.call(r, s) && (t[s] = r[s]);
20
20
  return t;
21
21
  };
22
- var I = (c, e, t) => new Promise((s, n) => {
22
+ var v = (r, e, t) => new Promise((s, n) => {
23
23
  var i = (d) => {
24
24
  try {
25
25
  o(t.next(d));
26
- } catch (r) {
27
- n(r);
26
+ } catch (c) {
27
+ n(c);
28
28
  }
29
29
  }, a = (d) => {
30
30
  try {
31
31
  o(t.throw(d));
32
- } catch (r) {
33
- n(r);
32
+ } catch (c) {
33
+ n(c);
34
34
  }
35
35
  }, o = (d) => d.done ? s(d.value) : Promise.resolve(d.value).then(i, a);
36
- o((t = t.apply(c, e)).next());
36
+ o((t = t.apply(r, e)).next());
37
37
  });
38
- import { ActiveSelection as v, util as R, controlsUtils as ye, InteractiveFabricObject as pe, loadSVGFromURL as Ie, FabricImage as Z, Point as _, Rect as ve, Circle as Ae, Triangle as Se, Group as X, Canvas as Ce, Pattern as Ne } from "fabric";
39
- import { create as De } from "jsondiffpatch";
40
- import Le from "diff-match-patch";
41
- var we = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", L = function() {
38
+ import { ActiveSelection as p, util as H, controlsUtils as Ie, InteractiveFabricObject as ve, loadSVGFromURL as Ae, FabricImage as U, Point as P, Rect as Se, Circle as Ce, Triangle as Ne, Group as $, Canvas as De, Pattern as Le } from "fabric";
39
+ import { create as we } from "jsondiffpatch";
40
+ import Ee from "diff-match-patch";
41
+ var Oe = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", L = function() {
42
42
  for (var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21, t = "", s = crypto.getRandomValues(new Uint8Array(e |= 0)); e--; )
43
- t += we[s[e] & 63];
43
+ t += Oe[s[e] & 63];
44
44
  return t;
45
45
  };
46
- class z {
46
+ class R {
47
47
  /**
48
48
  * Конструктор принимает редактор и опции.
49
49
  * @param params
@@ -61,7 +61,7 @@ class z {
61
61
  * @param params.options.adaptCanvasToContainerOnResize — адаптировать канвас к размерам контейнера при изменении размеров окна
62
62
  */
63
63
  constructor({ editor: e, options: t = {} }) {
64
- this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, 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 = e, this.canvas = e.canvas, this.options = t, this.handleContainerResizeBound = z.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 = z.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = z.debounce(this.handleObjectRotatingHistory.bind(this), 300), this.handleObjectAddedHistoryBound = this.handleObjectAddedHistory.bind(this), this.handleObjectRemovedHistoryBound = this.handleObjectRemovedHistory.bind(this), this.handleOverlayUpdateBound = this.handleOverlayUpdate.bind(this), this.handleCanvasDragStartBound = this.handleCanvasDragStart.bind(this), this.handleCanvasDraggingBound = this.handleCanvasDragging.bind(this), this.handleCanvasDragEndBound = this.handleCanvasDragEnd.bind(this), this.handleMouseWheelZoomBound = this.handleMouseWheelZoom.bind(this), this.handleBringToFrontBound = this.handleBringToFront.bind(this), this.handleResetObjectFitBound = this.handleResetObjectFit.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.init();
64
+ this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, this.savedSelection = [], this.canvasDragging = !1, this.mouseWheelZooming = !1, this.bringToFrontOnSelection = !1, this.resetObjectFitByDoubleClick = !1, this.copyObjectsByHotkey = !1, this.pasteImageFromClipboard = !1, this.undoRedoByHotKeys = !1, this.selectAllByHotkey = !1, this.deleteObjectsByHotkey = !1, this.adaptCanvasToContainerOnResize = !1, this.editor = e, this.canvas = e.canvas, this.options = t, this.handleContainerResizeBound = R.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 = R.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = R.debounce(this.handleObjectRotatingHistory.bind(this), 300), this.handleObjectAddedHistoryBound = this.handleObjectAddedHistory.bind(this), this.handleObjectRemovedHistoryBound = this.handleObjectRemovedHistory.bind(this), this.handleOverlayUpdateBound = this.handleOverlayUpdate.bind(this), this.handleCanvasDragStartBound = this.handleCanvasDragStart.bind(this), this.handleCanvasDraggingBound = this.handleCanvasDragging.bind(this), this.handleCanvasDragEndBound = this.handleCanvasDragEnd.bind(this), this.handleMouseWheelZoomBound = this.handleMouseWheelZoom.bind(this), this.handleBringToFrontBound = this.handleBringToFront.bind(this), this.handleResetObjectFitBound = this.handleResetObjectFit.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.init();
65
65
  }
66
66
  /**
67
67
  * Инициализация всех обработчиков согласно опциям.
@@ -76,10 +76,10 @@ class z {
76
76
  pasteImageFromClipboard: a,
77
77
  undoRedoByHotKeys: o,
78
78
  selectAllByHotkey: d,
79
- deleteObjectsByHotkey: r,
79
+ deleteObjectsByHotkey: c,
80
80
  resetObjectFitByDoubleClick: l
81
81
  } = this.options;
82
- t && (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 })), s && this.canvas.on("mouse:wheel", this.handleMouseWheelZoomBound), n && (this.canvas.on("selection:created", this.handleBringToFrontBound), this.canvas.on("selection:updated", this.handleBringToFrontBound)), l && this.canvas.on("mouse:dblclick", this.handleResetObjectFitBound), e && window.addEventListener("resize", this.handleContainerResizeBound, { capture: !0 }), i && document.addEventListener("keydown", this.handleCopyEventBound, { capture: !0 }), a && document.addEventListener("paste", this.handlePasteEventBound, { capture: !0 }), o && (document.addEventListener("keydown", this.handleUndoRedoEventBound, { capture: !0 }), document.addEventListener("keyup", this.handleUndoRedoKeyUpBound, { capture: !0 })), d && 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:added", this.handleOverlayUpdateBound), this.canvas.on("selection:created", this.handleOverlayUpdateBound), this.canvas.on("selection:created", this.handleLockedSelectionBound), this.canvas.on("selection:updated", this.handleLockedSelectionBound);
82
+ t && (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 })), s && this.canvas.on("mouse:wheel", this.handleMouseWheelZoomBound), n && (this.canvas.on("selection:created", this.handleBringToFrontBound), this.canvas.on("selection:updated", this.handleBringToFrontBound)), l && this.canvas.on("mouse:dblclick", this.handleResetObjectFitBound), e && window.addEventListener("resize", this.handleContainerResizeBound, { capture: !0 }), i && document.addEventListener("keydown", this.handleCopyEventBound, { capture: !0 }), a && document.addEventListener("paste", this.handlePasteEventBound, { capture: !0 }), o && (document.addEventListener("keydown", this.handleUndoRedoEventBound, { capture: !0 }), document.addEventListener("keyup", this.handleUndoRedoKeyUpBound, { capture: !0 })), d && 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:added", this.handleOverlayUpdateBound), this.canvas.on("selection:created", this.handleOverlayUpdateBound), this.canvas.on("selection:created", this.handleLockedSelectionBound), this.canvas.on("selection:updated", this.handleLockedSelectionBound);
83
83
  }
84
84
  /**
85
85
  * При массовом выделении объектов удаляем из него залоченные.
@@ -88,20 +88,29 @@ class z {
88
88
  * @param params.e - событие указателя (опционально)
89
89
  */
90
90
  _filterLockedSelection({ selected: e, e: t }) {
91
- if (!(e != null && e.length) || !(t instanceof MouseEvent) || e.length === 1 || !e.some((a) => a.locked)) return;
92
- const n = e.filter((a) => !a.locked);
93
- if (n.length === 0) {
94
- this.canvas.discardActiveObject();
95
- return;
96
- }
97
- if (n.length === 1) {
98
- this.canvas.setActiveObject(n[0]);
91
+ if (!(e != null && e.length) || !(t instanceof MouseEvent) || e.length === 1) return;
92
+ const s = e.filter((a) => a.locked), n = e.filter((a) => !a.locked);
93
+ if (s.length === 0) return;
94
+ if (n.length > 0) {
95
+ if (n.length === 1)
96
+ this.canvas.setActiveObject(n[0]);
97
+ else {
98
+ const a = new p(n, {
99
+ canvas: this.canvas
100
+ });
101
+ this.canvas.setActiveObject(a);
102
+ }
103
+ this.canvas.requestRenderAll();
99
104
  return;
100
105
  }
101
- const i = new v(n, {
106
+ const i = new p(e, {
102
107
  canvas: this.canvas
103
108
  });
104
- this.canvas.setActiveObject(i), this.canvas.requestRenderAll();
109
+ this.editor.objectLockManager.lockObject({
110
+ object: i,
111
+ skipInnerObjects: !0,
112
+ withoutSave: !0
113
+ }), this.canvas.setActiveObject(i), this.canvas.requestRenderAll();
105
114
  }
106
115
  /**
107
116
  * Обработчики для сохранения состояния редактора в истории.
@@ -160,7 +169,7 @@ class z {
160
169
  * @param event.code — код клавиши
161
170
  */
162
171
  handleUndoRedoEvent(e) {
163
- return I(this, null, function* () {
172
+ return v(this, null, function* () {
164
173
  const { ctrlKey: t, metaKey: s, code: n, repeat: i } = e;
165
174
  this._shouldIgnoreKeyboardEvent(e) || !t && !s || i || !/Mac/i.test(navigator.userAgent) && this.isUndoRedoKeyPressed || (n === "KeyZ" ? (e.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.undo()) : n === "KeyY" && (e.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.redo()));
166
175
  });
@@ -195,27 +204,30 @@ class z {
195
204
  }
196
205
  /**
197
206
  * Обработчик для нажатия пробела.
198
- * Отключает выделение объектов и делает курсор "grab" для перетаскивания канваса.
207
+ * Отключает взаимодействие с объектами и делает курсор "grab" для перетаскивания канваса.
199
208
  * @param event — объект события
200
209
  * @param event.code — код клавиши
201
210
  */
202
211
  handleSpaceKeyDown(e) {
203
212
  if (e.code !== "Space" || this._shouldIgnoreKeyboardEvent(e)) return;
204
213
  const { canvas: t, editor: s, isSpacePressed: n, isDragging: i } = this;
205
- n || i || (this.isSpacePressed = !0, e.preventDefault(), t.set({
214
+ if (n || i) return;
215
+ this.isSpacePressed = !0, e.preventDefault();
216
+ const a = t.getActiveObject() || null;
217
+ a instanceof p ? this.savedSelection = a.getObjects().slice() : a && (this.savedSelection = [a]), t.discardActiveObject(), t.set({
206
218
  selection: !1,
207
219
  defaultCursor: "grab"
208
- }), t.setCursor("grab"), s.canvasManager.getObjects().forEach((a) => {
209
- a.set({
220
+ }), t.setCursor("grab"), s.canvasManager.getObjects().forEach((o) => {
221
+ o.set({
210
222
  selectable: !1,
211
223
  evented: !1
212
224
  });
213
- }));
225
+ }), t.requestRenderAll();
214
226
  }
215
227
  /**
216
228
  * Обработчик для отпускания пробела.
217
229
  * Завершает перетаскивание канваса, если оно активно.
218
- * Включает выделение объектов и возвращает курсор в состояние "default".
230
+ * Восстанавливает нормальное взаимодействие с объектами.
219
231
  * @param event — объект события
220
232
  * @param event.code — код клавиши
221
233
  */
@@ -228,7 +240,21 @@ class z {
228
240
  selectable: !0,
229
241
  evented: !0
230
242
  });
231
- }));
243
+ }), this._restoreSelection(this.savedSelection), this.savedSelection = [], this.canvas.requestRenderAll());
244
+ }
245
+ /**
246
+ * Восстанавливает выделение с проверкой корректности объектов
247
+ * @param selection - объекты для восстановления выделения
248
+ */
249
+ _restoreSelection(e) {
250
+ const { canvas: t, editor: s } = this;
251
+ if (e.length === 0) return;
252
+ if (e.length === 1) {
253
+ t.setActiveObject(e[0]);
254
+ return;
255
+ }
256
+ const n = e.filter((a) => s.canvasManager.getObjects().includes(a)), i = new p(n, { canvas: t });
257
+ t.setActiveObject(i);
232
258
  }
233
259
  // --- Обработчики для событий canvas (Fabric) ---
234
260
  /**
@@ -237,7 +263,7 @@ class z {
237
263
  * @param options.e — объект события (MouseEvent или TouchEvent)
238
264
  */
239
265
  handleCanvasDragStart({ e }) {
240
- !this.isSpacePressed || !(e instanceof MouseEvent) || (this.isDragging = !0, this.lastMouseX = e.clientX, this.lastMouseY = e.clientY, this.canvas.setCursor("grabbing"));
266
+ !this.isSpacePressed || !(e instanceof MouseEvent) || (this.isDragging = !0, this.lastMouseX = e.clientX, this.lastMouseY = e.clientY, this.canvas.set("defaultCursor", "grabbing"), this.canvas.setCursor("grabbing"));
241
267
  }
242
268
  /**
243
269
  * Перетаскивание канваса (mouse:move).
@@ -308,7 +334,6 @@ class z {
308
334
  origin: "Listeners",
309
335
  method: "_shouldIgnoreKeyboardEvent",
310
336
  code: "INVALID_SELECTOR",
311
- // eslint-disable-next-line max-len
312
337
  message: `Invalid keyboard ignore selector: "${a}". Error: ${o.message}`,
313
338
  data: o
314
339
  });
@@ -336,7 +361,7 @@ class z {
336
361
  };
337
362
  }
338
363
  }
339
- class Ee {
364
+ class Te {
340
365
  /**
341
366
  * Класс для динамической загрузки внешних модулей.
342
367
  */
@@ -354,21 +379,21 @@ class Ee {
354
379
  return this.loaders[e] ? (this.cache.has(e) || this.cache.set(e, this.loaders[e]()), this.cache.get(e)) : Promise.reject(new Error(`Unknown module "${e}"`));
355
380
  }
356
381
  }
357
- function Oe(c) {
382
+ function ke(r) {
358
383
  return new Worker(
359
- "" + new URL("assets/worker-Cmho-Hr0.js", import.meta.url).href,
384
+ "" + new URL("assets/worker-CN39s7P7.js", import.meta.url).href,
360
385
  {
361
- name: c == null ? void 0 : c.name
386
+ name: r == null ? void 0 : r.name
362
387
  }
363
388
  );
364
389
  }
365
- class Te {
390
+ class xe {
366
391
  /**
367
392
  * @param scriptUrl — URL скрипта воркера.
368
393
  * По-умолчанию использует DefaultWorker из соседнего файла
369
394
  */
370
395
  constructor(e) {
371
- e ? this.worker = new Worker(e, { type: "module" }) : this.worker = new Oe(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
396
+ e ? this.worker = new Worker(e, { type: "module" }) : this.worker = new ke(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
372
397
  }
373
398
  /**
374
399
  * Обработчик сообщений от воркера
@@ -408,26 +433,26 @@ class Te {
408
433
  this.worker.terminate();
409
434
  }
410
435
  }
411
- const N = 12, ke = 2, Q = 8, $ = 20, xe = 100, J = 20, K = 8, Be = 100, q = 32, ee = 1, Ze = "#2B2D33", te = "#3D8BF4", se = "#FFFFFF";
412
- function W(c, e, t, s, n) {
413
- const i = N, a = ke;
414
- c.save(), c.translate(e, t), c.rotate(R.degreesToRadians(n.angle)), c.fillStyle = se, c.strokeStyle = te, c.lineWidth = ee, c.beginPath(), c.roundRect(-12 / 2, -12 / 2, i, i, a), c.fill(), c.stroke(), c.restore();
436
+ const N = 12, Be = 2, J = 8, K = 20, Ze = 100, q = 20, ee = 8, Ue = 100, F = 32, te = 1, ze = "#2B2D33", se = "#3D8BF4", ne = "#FFFFFF";
437
+ function W(r, e, t, s, n) {
438
+ const i = N, a = Be;
439
+ r.save(), r.translate(e, t), r.rotate(H.degreesToRadians(n.angle)), r.fillStyle = ne, r.strokeStyle = se, r.lineWidth = te, r.beginPath(), r.roundRect(-i / 2, -i / 2, i, i, a), r.fill(), r.stroke(), r.restore();
415
440
  }
416
- function he(c, e, t, s, n) {
417
- const i = Q, a = $, o = xe;
418
- c.save(), c.translate(e, t), c.rotate(R.degreesToRadians(n.angle)), c.fillStyle = se, c.strokeStyle = te, c.lineWidth = ee, c.beginPath(), c.roundRect(-8 / 2, -20 / 2, i, a, o), c.fill(), c.stroke(), c.restore();
441
+ function ge(r, e, t, s, n) {
442
+ const i = J, a = K, o = Ze;
443
+ r.save(), r.translate(e, t), r.rotate(H.degreesToRadians(n.angle)), r.fillStyle = ne, r.strokeStyle = se, r.lineWidth = te, r.beginPath(), r.roundRect(-i / 2, -a / 2, i, a, o), r.fill(), r.stroke(), r.restore();
419
444
  }
420
- function ge(c, e, t, s, n) {
421
- const i = J, a = K, o = Be;
422
- c.save(), c.translate(e, t), c.rotate(R.degreesToRadians(n.angle)), c.fillStyle = se, c.strokeStyle = te, c.lineWidth = ee, c.beginPath(), c.roundRect(-20 / 2, -8 / 2, i, a, o), c.fill(), c.stroke(), c.restore();
445
+ function ue(r, e, t, s, n) {
446
+ const i = q, a = ee, o = Ue;
447
+ r.save(), r.translate(e, t), r.rotate(H.degreesToRadians(n.angle)), r.fillStyle = ne, r.strokeStyle = se, r.lineWidth = te, r.beginPath(), r.roundRect(-i / 2, -a / 2, i, a, o), r.fill(), r.stroke(), r.restore();
423
448
  }
424
- const Ue = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", ue = new Image();
425
- ue.src = Ue;
426
- function ze(c, e, t, s, n) {
427
- const a = q / 2;
428
- c.save(), c.translate(e, t), c.rotate(R.degreesToRadians(n.angle)), c.fillStyle = Ze, c.beginPath(), c.arc(0, 0, a, 0, 2 * Math.PI), c.fill(), c.drawImage(ue, -16 / 2, -16 / 2, a, a), c.restore();
449
+ const Re = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", me = new Image();
450
+ me.src = Re;
451
+ function He(r, e, t, s, n) {
452
+ const a = F / 2;
453
+ r.save(), r.translate(e, t), r.rotate(H.degreesToRadians(n.angle)), r.fillStyle = ze, r.beginPath(), r.arc(0, 0, a, 0, 2 * Math.PI), r.fill(), r.drawImage(me, -a / 2, -a / 2, a, a), r.restore();
429
454
  }
430
- const Re = {
455
+ const Ye = {
431
456
  // Угловые точки
432
457
  tl: {
433
458
  render: W,
@@ -459,47 +484,47 @@ const Re = {
459
484
  },
460
485
  // Середина вертикалей
461
486
  ml: {
462
- render: he,
463
- sizeX: Q,
464
- sizeY: $,
487
+ render: ge,
488
+ sizeX: J,
489
+ sizeY: K,
465
490
  offsetX: 0,
466
491
  offsetY: 0
467
492
  },
468
493
  mr: {
469
- render: he,
470
- sizeX: Q,
471
- sizeY: $,
494
+ render: ge,
495
+ sizeX: J,
496
+ sizeY: K,
472
497
  offsetX: 0,
473
498
  offsetY: 0
474
499
  },
475
500
  // Середина горизонталей
476
501
  mt: {
477
- render: ge,
478
- sizeX: J,
479
- sizeY: K,
502
+ render: ue,
503
+ sizeX: q,
504
+ sizeY: ee,
480
505
  offsetX: 0,
481
506
  offsetY: 0
482
507
  },
483
508
  mb: {
484
- render: ge,
485
- sizeX: J,
486
- sizeY: K,
509
+ render: ue,
510
+ sizeX: q,
511
+ sizeY: ee,
487
512
  offsetX: 0,
488
513
  offsetY: 0
489
514
  },
490
515
  // Специальный «rotate» контрол
491
516
  mtr: {
492
- render: ze,
493
- sizeX: q,
494
- sizeY: q,
517
+ render: He,
518
+ sizeX: F,
519
+ sizeY: F,
495
520
  offsetX: 0,
496
- offsetY: -32
521
+ offsetY: -F
497
522
  }
498
523
  };
499
- class He {
524
+ class _e {
500
525
  static apply() {
501
- const e = ye.createObjectDefaultControls();
502
- Object.entries(Re).forEach(([t, s]) => {
526
+ const e = Ie.createObjectDefaultControls();
527
+ Object.entries(Ye).forEach(([t, s]) => {
503
528
  Object.assign(e[t], {
504
529
  render: s.render,
505
530
  sizeX: s.sizeX,
@@ -510,10 +535,10 @@ class He {
510
535
  var l;
511
536
  (l = a.target.canvas) == null || l.setCursor("grabbing");
512
537
  });
513
- }), pe.ownDefaults.controls = e;
538
+ }), ve.ownDefaults.controls = e;
514
539
  }
515
540
  }
516
- const Ye = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIM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MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", z = {
517
542
  style: {
518
543
  position: "absolute",
519
544
  display: "none",
@@ -580,56 +605,56 @@ const Ye = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
580
605
  ],
581
606
  offsetTop: 50,
582
607
  icons: {
583
- copyPaste: Ye,
584
- delete: Xe,
585
- lock: We,
586
- unlock: _e,
587
- bringToFront: Ve,
588
- sendToBack: Ge,
589
- bringForward: Pe,
590
- sendBackwards: Fe
608
+ copyPaste: We,
609
+ delete: $e,
610
+ lock: Pe,
611
+ unlock: Fe,
612
+ bringToFront: Xe,
613
+ sendToBack: Qe,
614
+ bringForward: Ve,
615
+ sendBackwards: Ge
591
616
  },
592
617
  handlers: {
593
- copyPaste: (c) => I(void 0, null, function* () {
594
- yield c.clipboardManager.copy(), yield c.clipboardManager.paste(), c.clipboardManager.clipboard && c.canvas.fire("editor:object-duplicated", {
595
- object: c.clipboardManager.clipboard
618
+ copyPaste: (r) => v(null, null, function* () {
619
+ yield r.clipboardManager.copy(), yield r.clipboardManager.paste(), r.clipboardManager.clipboard && r.canvas.fire("editor:object-duplicated", {
620
+ object: r.clipboardManager.clipboard
596
621
  });
597
622
  }),
598
- delete: (c) => {
599
- c.deletionManager.deleteSelectedObjects();
623
+ delete: (r) => {
624
+ r.deletionManager.deleteSelectedObjects();
600
625
  },
601
- lock: (c) => {
602
- c.objectLockManager.lockObject();
626
+ lock: (r) => {
627
+ r.objectLockManager.lockObject();
603
628
  },
604
- unlock: (c) => {
605
- c.objectLockManager.unlockObject();
629
+ unlock: (r) => {
630
+ r.objectLockManager.unlockObject();
606
631
  },
607
- bringForward: (c) => {
608
- c.layerManager.bringForward();
632
+ bringForward: (r) => {
633
+ r.layerManager.bringForward();
609
634
  },
610
- bringToFront: (c) => {
611
- c.layerManager.bringToFront();
635
+ bringToFront: (r) => {
636
+ r.layerManager.bringToFront();
612
637
  },
613
- sendToBack: (c) => {
614
- c.layerManager.sendToBack();
638
+ sendToBack: (r) => {
639
+ r.layerManager.sendToBack();
615
640
  },
616
- sendBackwards: (c) => {
617
- c.layerManager.sendBackwards();
641
+ sendBackwards: (r) => {
642
+ r.layerManager.sendBackwards();
618
643
  }
619
644
  }
620
645
  };
621
- class Qe {
646
+ class Je {
622
647
  constructor({ editor: e }) {
623
648
  this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.editor = e, this.canvas = e.canvas, this.options = e.options, this._initToolbar();
624
649
  }
625
650
  _initToolbar() {
626
651
  if (!this.options.showToolbar) return;
627
652
  const e = this.options.toolbar || {};
628
- this.config = le(y(y({}, U), e), {
629
- style: y(y({}, U.style), e.style || {}),
630
- btnStyle: y(y({}, U.btnStyle), e.btnStyle || {}),
631
- icons: y(y({}, U.icons), e.icons || {}),
632
- handlers: y(y({}, U.handlers), e.handlers || {})
653
+ this.config = he(y(y({}, z), e), {
654
+ style: y(y({}, z.style), e.style || {}),
655
+ btnStyle: y(y({}, z.btnStyle), e.btnStyle || {}),
656
+ icons: y(y({}, z.icons), e.icons || {}),
657
+ handlers: y(y({}, z.handlers), e.handlers || {})
633
658
  }), this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !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 = () => {
634
659
  this.el.style.display = "none";
635
660
  }, this._createDOM(), this._bindEvents();
@@ -658,8 +683,8 @@ class Qe {
658
683
  for (const t of e) {
659
684
  const { name: s, handle: n } = t, { icons: i = {}, btnStyle: a, handlers: o = {} } = this.config, d = document.createElement("button");
660
685
  d.innerHTML = i[n] ? `<img src="${i[n]}" title="${s}" />` : s, Object.assign(d.style, a), d.onclick = () => {
661
- var r;
662
- return (r = o[n]) == null ? void 0 : r.call(o, this.editor);
686
+ var c;
687
+ return (c = o[n]) == null ? void 0 : c.call(o, this.editor);
663
688
  }, this.el.appendChild(d);
664
689
  }
665
690
  }
@@ -718,7 +743,7 @@ class Qe {
718
743
  }
719
744
  const { el: t, config: s, canvas: n } = this;
720
745
  e.setCoords();
721
- const i = n.getZoom(), [, , , , a, o] = n.viewportTransform, { x: d } = e.getCenterPoint(), { top: r, height: l } = e.getBoundingRect(), g = d * i + a - t.offsetWidth / 2, u = s.offsetTop || 0, m = (r + l) * i + o + u;
746
+ const i = n.getZoom(), [, , , , a, o] = n.viewportTransform, { x: d } = e.getCenterPoint(), { top: c, height: l } = e.getBoundingRect(), g = d * i + a - t.offsetWidth / 2, u = s.offsetTop || 0, m = (c + l) * i + o + u;
722
747
  Object.assign(t.style, {
723
748
  left: `${g}px`,
724
749
  top: `${m}px`,
@@ -732,7 +757,7 @@ class Qe {
732
757
  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();
733
758
  }
734
759
  }
735
- class $e {
760
+ class Ke {
736
761
  constructor({ editor: e }) {
737
762
  this.editor = e, this.canvas = e.canvas, this._historySuspendCount = 0, this.baseState = null, this.patches = [], this.currentIndex = 0, this.maxHistoryLength = e.options.maxHistoryLength, this.totalChangesCount = 0, this.baseStateChangesCount = 0, this._createDiffPatcher();
738
763
  }
@@ -744,7 +769,7 @@ class $e {
744
769
  return this.patches[this.currentIndex - 1] || null;
745
770
  }
746
771
  _createDiffPatcher() {
747
- this.diffPatcher = De({
772
+ this.diffPatcher = we({
748
773
  objectHash(e) {
749
774
  const t = e;
750
775
  return [
@@ -768,7 +793,7 @@ class $e {
768
793
  includeValueOnMove: !1
769
794
  },
770
795
  textDiff: {
771
- diffMatchPatch: Le,
796
+ diffMatchPatch: Ee,
772
797
  minLength: 60
773
798
  }
774
799
  });
@@ -842,14 +867,14 @@ class $e {
842
867
  * @fires editor:history-state-loaded
843
868
  */
844
869
  loadStateFromFullState(e) {
845
- return I(this, null, function* () {
870
+ return v(this, null, function* () {
846
871
  if (!e) return;
847
872
  console.log("loadStateFromFullState fullState", e);
848
873
  const { canvas: t, canvasManager: s, interactionBlocker: n } = this.editor, { width: i, height: a } = t;
849
874
  yield t.loadFromJSON(e);
850
- const o = t.getObjects().find((r) => r.id === "montage-area");
875
+ const o = t.getObjects().find((c) => c.id === "montage-area");
851
876
  o && (this.editor.montageArea = o, (i !== t.getWidth() || a !== t.getHeight()) && s.updateCanvas());
852
- const d = t.getObjects().find((r) => r.id === "overlay-mask");
877
+ const d = t.getObjects().find((c) => c.id === "overlay-mask");
853
878
  d && (n.overlayMask = d, n.overlayMask.visible = !1), t.renderAll(), t.fire("editor:history-state-loaded", {
854
879
  fullState: e,
855
880
  currentIndex: this.currentIndex,
@@ -865,7 +890,7 @@ class $e {
865
890
  * @fires editor:undo
866
891
  */
867
892
  undo() {
868
- return I(this, null, function* () {
893
+ return v(this, null, function* () {
869
894
  if (!this.skipHistory) {
870
895
  if (this.currentIndex <= 0) {
871
896
  console.log("Нет предыдущих состояний для отмены.");
@@ -902,7 +927,7 @@ class $e {
902
927
  * @fires editor:redo
903
928
  */
904
929
  redo() {
905
- return I(this, null, function* () {
930
+ return v(this, null, function* () {
906
931
  if (!this.skipHistory) {
907
932
  if (this.currentIndex >= this.patches.length) {
908
933
  console.log("Нет состояний для повтора.");
@@ -935,7 +960,7 @@ class $e {
935
960
  });
936
961
  }
937
962
  }
938
- const Je = 0.1, Ke = 2, qe = 0.1, et = 90, x = 16, B = 16, O = 4096, T = 4096;
963
+ const qe = 0.1, et = 2, tt = 0.1, st = 90, B = 16, Z = 16, O = 4096, T = 4096;
939
964
  class D {
940
965
  constructor({ editor: e }) {
941
966
  this.editor = e, this.options = e.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
@@ -953,17 +978,17 @@ class D {
953
978
  * @returns возвращает Promise с объектом изображения или null в случае ошибки
954
979
  */
955
980
  importImage(e) {
956
- return I(this, null, function* () {
981
+ return v(this, null, function* () {
957
982
  const {
958
983
  source: t,
959
984
  scale: s = `image-${this.options.scaleType}`,
960
985
  withoutSave: n = !1
961
986
  } = e;
962
987
  if (!t) return null;
963
- const { canvas: i, montageArea: a, transformManager: o, historyManager: d, errorManager: r } = this.editor, l = yield this.getContentType(t), h = D.getFormatFromContentType(l), { acceptContentTypes: g, acceptFormats: u } = this;
988
+ const { canvas: i, montageArea: a, transformManager: o, historyManager: d, errorManager: c } = this.editor, l = yield this.getContentType(t), h = D.getFormatFromContentType(l), { acceptContentTypes: g, acceptFormats: u } = this;
964
989
  if (!this.isAllowedContentType(l)) {
965
990
  const m = `Неверный contentType для изображения: ${l}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
966
- return r.emitError({
991
+ return c.emitError({
967
992
  origin: "ImageManager",
968
993
  method: "importImage",
969
994
  code: "INVALID_CONTENT_TYPE",
@@ -980,7 +1005,7 @@ class D {
980
1005
  const S = yield (yield fetch(t, { mode: "cors" })).blob();
981
1006
  m = URL.createObjectURL(S);
982
1007
  } else
983
- return r.emitError({
1008
+ return c.emitError({
984
1009
  origin: "ImageManager",
985
1010
  method: "importImage",
986
1011
  code: "INVALID_SOURCE_TYPE",
@@ -988,20 +1013,20 @@ class D {
988
1013
  data: { source: t, format: h, contentType: l, acceptContentTypes: g, acceptFormats: u }
989
1014
  }), null;
990
1015
  if (this._createdBlobUrls.push(m), h === "svg") {
991
- const b = yield Ie(m);
992
- M = R.groupSVGElements(b.objects, b.options);
1016
+ const b = yield Ae(m);
1017
+ M = H.groupSVGElements(b.objects, b.options);
993
1018
  } else
994
- M = yield Z.fromURL(m, { crossOrigin: "anonymous" });
1019
+ M = yield U.fromURL(m, { crossOrigin: "anonymous" });
995
1020
  const { width: f, height: j } = M;
996
- if (M instanceof Z) {
1021
+ if (M instanceof U) {
997
1022
  const b = M.getElement();
998
1023
  let S = "";
999
1024
  if (b instanceof HTMLImageElement ? S = b.src : b instanceof HTMLCanvasElement && (S = b.toDataURL()), j > T || f > O) {
1000
1025
  const w = yield this.resizeImageToBoundaries(S, "max"), E = URL.createObjectURL(w);
1001
- this._createdBlobUrls.push(E), M = yield Z.fromURL(E, { crossOrigin: "anonymous" });
1002
- } else if (j < B || f < x) {
1026
+ this._createdBlobUrls.push(E), M = yield U.fromURL(E, { crossOrigin: "anonymous" });
1027
+ } else if (j < Z || f < B) {
1003
1028
  const w = yield this.resizeImageToBoundaries(S, "min"), E = URL.createObjectURL(w);
1004
- this._createdBlobUrls.push(E), M = yield Z.fromURL(E, { crossOrigin: "anonymous" });
1029
+ this._createdBlobUrls.push(E), M = yield U.fromURL(E, { crossOrigin: "anonymous" });
1005
1030
  }
1006
1031
  }
1007
1032
  if (M.set("id", `${M.type}-${L()}`), M.set("format", h), s === "scale-montage")
@@ -1021,7 +1046,7 @@ class D {
1021
1046
  };
1022
1047
  return i.fire("editor:image-imported", A), A;
1023
1048
  } catch (m) {
1024
- return r.emitError({
1049
+ return c.emitError({
1025
1050
  origin: "ImageManager",
1026
1051
  method: "importImage",
1027
1052
  code: "IMPORT_FAILED",
@@ -1040,16 +1065,16 @@ class D {
1040
1065
  * @returns возвращает Promise с Blob-объектом уменьшенного изображения
1041
1066
  */
1042
1067
  resizeImageToBoundaries(e, t = "max") {
1043
- return I(this, null, function* () {
1068
+ return v(this, null, function* () {
1044
1069
  let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${O}x${T}`;
1045
- t === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${x}x${B}`);
1070
+ t === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${B}x${Z}`);
1046
1071
  const n = {
1047
1072
  dataURL: e,
1048
1073
  sizeType: t,
1049
1074
  maxWidth: O,
1050
1075
  maxHeight: T,
1051
- minWidth: x,
1052
- minHeight: B
1076
+ minWidth: B,
1077
+ minHeight: Z
1053
1078
  };
1054
1079
  return this.editor.errorManager.emitWarning({
1055
1080
  origin: "ImageManager",
@@ -1072,7 +1097,7 @@ class D {
1072
1097
  * @fires editor:canvas-exported
1073
1098
  */
1074
1099
  exportCanvasAsImageFile() {
1075
- return I(this, arguments, function* (e = {}) {
1100
+ return v(this, arguments, function* (e = {}) {
1076
1101
  const {
1077
1102
  fileName: t = "image.png",
1078
1103
  contentType: s = "image/png",
@@ -1080,18 +1105,18 @@ class D {
1080
1105
  exportAsBlob: i = !1
1081
1106
  } = e, { canvas: a, montageArea: o, workerManager: d } = this.editor;
1082
1107
  try {
1083
- const r = s === "application/pdf", l = r ? "image/jpg" : s, h = D.getFormatFromContentType(l);
1108
+ const c = s === "application/pdf", l = c ? "image/jpg" : s, h = D.getFormatFromContentType(l);
1084
1109
  o.setCoords();
1085
1110
  const { left: g, top: u, width: m, height: M } = o.getBoundingRect(), f = yield a.clone(["id", "format", "locked"]);
1086
1111
  ["image/jpg", "image/jpeg"].includes(l) && (f.backgroundColor = "#ffffff");
1087
- const j = f.getObjects().find((p) => p.id === o.id);
1112
+ const j = f.getObjects().find((I) => I.id === o.id);
1088
1113
  j && (j.visible = !1), f.viewportTransform = [1, 0, 0, 1, -g, -u], f.setDimensions({ width: m, height: M }, { backstoreOnly: !0 }), f.renderAll();
1089
- const A = f.getObjects().filter((p) => p.format).every((p) => p.format === "svg");
1114
+ const A = f.getObjects().filter((I) => I.format).every((I) => I.format === "svg");
1090
1115
  if (h === "svg" && A) {
1091
- const p = f.toSVG();
1116
+ const I = f.toSVG();
1092
1117
  f.dispose();
1093
1118
  const C = {
1094
- image: D._exportSVGStringAsFile(p, {
1119
+ image: D._exportSVGStringAsFile(I, {
1095
1120
  exportAsBase64: n,
1096
1121
  exportAsBlob: i,
1097
1122
  fileName: t
@@ -1102,70 +1127,70 @@ class D {
1102
1127
  };
1103
1128
  return a.fire("editor:canvas-exported", C), C;
1104
1129
  }
1105
- const b = yield new Promise((p, k) => {
1130
+ const b = yield new Promise((I, k) => {
1106
1131
  f.getElement().toBlob((C) => {
1107
- C ? p(C) : k(new Error("Failed to create Blob from canvas"));
1132
+ C ? I(C) : k(new Error("Failed to create Blob from canvas"));
1108
1133
  });
1109
1134
  });
1110
1135
  if (f.dispose(), i) {
1111
- const p = {
1136
+ const I = {
1112
1137
  image: b,
1113
1138
  format: h,
1114
1139
  contentType: l,
1115
1140
  fileName: t
1116
1141
  };
1117
- return a.fire("editor:canvas-exported", p), p;
1142
+ return a.fire("editor:canvas-exported", I), I;
1118
1143
  }
1119
1144
  const S = yield createImageBitmap(b), w = yield d.post(
1120
1145
  "toDataURL",
1121
1146
  { format: h, quality: 1, bitmap: S },
1122
1147
  [S]
1123
1148
  );
1124
- if (r) {
1125
- const k = m * 0.264583, C = M * 0.264583, Me = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, G = new Me({
1149
+ if (c) {
1150
+ const k = m * 0.264583, C = M * 0.264583, fe = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, Q = new fe({
1126
1151
  orientation: k > C ? "landscape" : "portrait",
1127
1152
  unit: "mm",
1128
1153
  format: [k, C]
1129
1154
  });
1130
- if (G.addImage(String(w), "JPG", 0, 0, k, C), n) {
1131
- const oe = {
1132
- image: G.output("datauristring"),
1155
+ if (Q.addImage(String(w), "JPG", 0, 0, k, C), n) {
1156
+ const re = {
1157
+ image: Q.output("datauristring"),
1133
1158
  format: "pdf",
1134
1159
  contentType: "application/pdf",
1135
1160
  fileName: t
1136
1161
  };
1137
- return a.fire("editor:canvas-exported", oe), oe;
1162
+ return a.fire("editor:canvas-exported", re), re;
1138
1163
  }
1139
- const me = G.output("blob"), ae = {
1140
- image: new File([me], t, { type: "application/pdf" }),
1164
+ const je = Q.output("blob"), oe = {
1165
+ image: new File([je], t, { type: "application/pdf" }),
1141
1166
  format: "pdf",
1142
1167
  contentType: "application/pdf",
1143
1168
  fileName: t
1144
1169
  };
1145
- return a.fire("editor:canvas-exported", ae), ae;
1170
+ return a.fire("editor:canvas-exported", oe), oe;
1146
1171
  }
1147
1172
  if (n) {
1148
- const p = {
1173
+ const I = {
1149
1174
  image: w,
1150
1175
  format: h,
1151
1176
  contentType: l,
1152
1177
  fileName: t
1153
1178
  };
1154
- return a.fire("editor:canvas-exported", p), p;
1179
+ return a.fire("editor:canvas-exported", I), I;
1155
1180
  }
1156
- const E = h === "svg" && !A ? t.replace(/\.[^/.]+$/, ".png") : t, ie = {
1181
+ const E = h === "svg" && !A ? t.replace(/\.[^/.]+$/, ".png") : t, ae = {
1157
1182
  image: new File([b], E, { type: l }),
1158
1183
  format: h,
1159
1184
  contentType: l,
1160
1185
  fileName: E
1161
1186
  };
1162
- return a.fire("editor:canvas-exported", ie), ie;
1163
- } catch (r) {
1187
+ return a.fire("editor:canvas-exported", ae), ae;
1188
+ } catch (c) {
1164
1189
  return this.editor.errorManager.emitError({
1165
1190
  origin: "ImageManager",
1166
1191
  method: "exportCanvasAsImageFile",
1167
1192
  code: "IMAGE_EXPORT_FAILED",
1168
- message: `Ошибка экспорта изображения: ${r.message}`,
1193
+ message: `Ошибка экспорта изображения: ${c.message}`,
1169
1194
  data: { contentType: s, fileName: t, exportAsBase64: n, exportAsBlob: i }
1170
1195
  }), null;
1171
1196
  }
@@ -1183,15 +1208,15 @@ class D {
1183
1208
  * @fires editor:object-exported
1184
1209
  */
1185
1210
  exportObjectAsImageFile() {
1186
- return I(this, arguments, function* (e = {}) {
1211
+ return v(this, arguments, function* (e = {}) {
1187
1212
  const {
1188
1213
  object: t,
1189
1214
  fileName: s = "image.png",
1190
1215
  contentType: n = "image/png",
1191
1216
  exportAsBase64: i = !1,
1192
1217
  exportAsBlob: a = !1
1193
- } = e, { canvas: o, workerManager: d } = this.editor, r = t || o.getActiveObject();
1194
- if (!r)
1218
+ } = e, { canvas: o, workerManager: d } = this.editor, c = t || o.getActiveObject();
1219
+ if (!c)
1195
1220
  return this.editor.errorManager.emitError({
1196
1221
  origin: "ImageManager",
1197
1222
  method: "exportObjectAsImageFile",
@@ -1202,12 +1227,12 @@ class D {
1202
1227
  try {
1203
1228
  const l = D.getFormatFromContentType(n);
1204
1229
  if (l === "svg") {
1205
- const M = r.toSVG(), f = D._exportSVGStringAsFile(M, {
1230
+ const M = c.toSVG(), f = D._exportSVGStringAsFile(M, {
1206
1231
  exportAsBase64: i,
1207
1232
  exportAsBlob: a,
1208
1233
  fileName: s
1209
1234
  }), j = {
1210
- object: r,
1235
+ object: c,
1211
1236
  image: f,
1212
1237
  format: l,
1213
1238
  contentType: "image/svg+xml",
@@ -1215,8 +1240,8 @@ class D {
1215
1240
  };
1216
1241
  return o.fire("editor:object-exported", j), j;
1217
1242
  }
1218
- if (i && r instanceof Z) {
1219
- const M = yield createImageBitmap(r.getElement()), f = yield d.post(
1243
+ if (i && c instanceof U) {
1244
+ const M = yield createImageBitmap(c.getElement()), f = yield d.post(
1220
1245
  "toDataURL",
1221
1246
  {
1222
1247
  format: l,
@@ -1225,7 +1250,7 @@ class D {
1225
1250
  },
1226
1251
  [M]
1227
1252
  ), j = {
1228
- object: r,
1253
+ object: c,
1229
1254
  image: f,
1230
1255
  format: l,
1231
1256
  contentType: n,
@@ -1233,14 +1258,14 @@ class D {
1233
1258
  };
1234
1259
  return o.fire("editor:object-exported", j), j;
1235
1260
  }
1236
- const h = r.toCanvasElement(), g = yield new Promise((M, f) => {
1261
+ const h = c.toCanvasElement(), g = yield new Promise((M, f) => {
1237
1262
  h.toBlob((j) => {
1238
1263
  j ? M(j) : f(new Error("Failed to create Blob from canvas"));
1239
1264
  });
1240
1265
  });
1241
1266
  if (a) {
1242
1267
  const M = {
1243
- object: r,
1268
+ object: c,
1244
1269
  image: g,
1245
1270
  format: l,
1246
1271
  contentType: n,
@@ -1249,7 +1274,7 @@ class D {
1249
1274
  return o.fire("editor:object-exported", M), M;
1250
1275
  }
1251
1276
  const u = new File([g], s, { type: n }), m = {
1252
- object: r,
1277
+ object: c,
1253
1278
  image: u,
1254
1279
  format: l,
1255
1280
  contentType: n,
@@ -1294,7 +1319,7 @@ class D {
1294
1319
  * @public
1295
1320
  */
1296
1321
  getContentType(e) {
1297
- return I(this, null, function* () {
1322
+ return v(this, null, function* () {
1298
1323
  return typeof e == "string" ? this.getContentTypeFromUrl(e) : e.type || "application/octet-stream";
1299
1324
  });
1300
1325
  }
@@ -1305,7 +1330,7 @@ class D {
1305
1330
  * @public
1306
1331
  */
1307
1332
  getContentTypeFromUrl(e) {
1308
- return I(this, null, function* () {
1333
+ return v(this, null, function* () {
1309
1334
  if (e.startsWith("data:")) {
1310
1335
  const t = e.match(/^data:([^;]+)/);
1311
1336
  return t ? t[1] : "application/octet-stream";
@@ -1384,7 +1409,11 @@ class D {
1384
1409
  return t ? t[1] : "";
1385
1410
  }
1386
1411
  }
1387
- class tt {
1412
+ const x = (r, e, t) => Math.max(Math.min(r, t), e), Me = (r, e) => r * e, nt = (r, e) => new P(r / 2, e / 2);
1413
+ function it(r) {
1414
+ return ((r == null ? void 0 : r.type) === "image" || (r == null ? void 0 : r.format) === "svg") && typeof (r == null ? void 0 : r.width) == "number" && typeof (r == null ? void 0 : r.height) == "number";
1415
+ }
1416
+ class at {
1388
1417
  /**
1389
1418
  * @param options
1390
1419
  * @param options.editor – экземпляр редактора
@@ -1392,6 +1421,13 @@ class tt {
1392
1421
  constructor({ editor: e }) {
1393
1422
  this.editor = e;
1394
1423
  }
1424
+ /**
1425
+ * Возвращает контейнер редактора
1426
+ */
1427
+ getEditorContainer() {
1428
+ const { canvas: e, options: { editorContainer: t } } = this.editor;
1429
+ return e.editorContainer || t;
1430
+ }
1395
1431
  /**
1396
1432
  * Устанавливаем внутреннюю ширину канваса (для экспорта)
1397
1433
  * @param width - ширина канваса
@@ -1408,9 +1444,9 @@ class tt {
1408
1444
  canvas: i,
1409
1445
  montageArea: a,
1410
1446
  options: { canvasBackstoreWidth: o }
1411
- } = this.editor, { width: d, height: r } = a, l = Math.max(Math.min(Number(e), O), x);
1447
+ } = this.editor, { width: d, height: c } = a, l = x(Number(e), B, O);
1412
1448
  if (!o || o === "auto" || n ? this.adaptCanvasToContainer() : o ? this.setCanvasBackstoreWidth(Number(o)) : this.setCanvasBackstoreWidth(l), a.set({ width: l }), (m = i.clipPath) == null || m.set({ width: l }), t) {
1413
- const M = l / d, f = r * M;
1449
+ const M = l / d, f = Me(c, M);
1414
1450
  this.setResolutionHeight(f);
1415
1451
  return;
1416
1452
  }
@@ -1438,9 +1474,9 @@ class tt {
1438
1474
  canvas: i,
1439
1475
  montageArea: a,
1440
1476
  options: { canvasBackstoreHeight: o }
1441
- } = this.editor, { width: d, height: r } = a, l = Math.max(Math.min(Number(e), T), B);
1477
+ } = this.editor, { width: d, height: c } = a, l = x(Number(e), Z, T);
1442
1478
  if (!o || o === "auto" || n ? this.adaptCanvasToContainer() : o ? this.setCanvasBackstoreHeight(Number(o)) : this.setCanvasBackstoreHeight(l), a.set({ height: l }), (m = i.clipPath) == null || m.set({ height: l }), t) {
1443
- const M = l / r, f = d * M;
1479
+ const M = l / c, f = Me(d, M);
1444
1480
  this.setResolutionWidth(f);
1445
1481
  return;
1446
1482
  }
@@ -1458,7 +1494,7 @@ class tt {
1458
1494
  */
1459
1495
  centerMontageArea() {
1460
1496
  var d;
1461
- const { canvas: e, montageArea: t } = this.editor, s = e.getWidth(), n = e.getHeight(), i = e.getZoom(), a = new _(s / 2, n / 2);
1497
+ const { canvas: e, montageArea: t } = this.editor, s = e.getWidth(), n = e.getHeight(), i = e.getZoom(), a = nt(s, n);
1462
1498
  t.set({
1463
1499
  left: s / 2,
1464
1500
  top: n / 2
@@ -1491,7 +1527,7 @@ class tt {
1491
1527
  */
1492
1528
  setCanvasBackstoreWidth(e) {
1493
1529
  if (!e || typeof e != "number") return;
1494
- const t = Math.max(Math.min(e, O), x);
1530
+ const t = x(e, B, O);
1495
1531
  this.editor.canvas.setDimensions({ width: t }, { backstoreOnly: !0 });
1496
1532
  }
1497
1533
  /**
@@ -1500,7 +1536,7 @@ class tt {
1500
1536
  */
1501
1537
  setCanvasBackstoreHeight(e) {
1502
1538
  if (!e || typeof e != "number") return;
1503
- const t = Math.max(Math.min(e, T), B);
1539
+ const t = x(e, Z, T);
1504
1540
  this.editor.canvas.setDimensions({ height: t }, { backstoreOnly: !0 });
1505
1541
  }
1506
1542
  /**
@@ -1509,8 +1545,8 @@ class tt {
1509
1545
  * с учётом минимальных и максимальных значений.
1510
1546
  */
1511
1547
  adaptCanvasToContainer() {
1512
- const { canvas: e } = this.editor, t = e.editorContainer, s = t.clientWidth, n = t.clientHeight, i = Math.max(Math.min(s, O), x), a = Math.max(Math.min(n, T), B);
1513
- console.log("adaptCanvasToContainer newWidth", i), console.log("adaptCanvasToContainer newHeight", a), e.setDimensions({ width: i, height: a }, { backstoreOnly: !0 });
1548
+ const { canvas: e } = this.editor, t = this.getEditorContainer(), s = t.clientWidth, n = t.clientHeight, i = x(s, B, O), a = x(n, Z, T);
1549
+ e.setDimensions({ width: i, height: a }, { backstoreOnly: !0 });
1514
1550
  }
1515
1551
  /**
1516
1552
  * Обновляет размеры канваса без изменения позиций объектов.
@@ -1529,9 +1565,9 @@ class tt {
1529
1565
  this.setResolutionWidth(s, { adaptCanvasToContainer: !0, withoutSave: !0 }), this.setResolutionHeight(n, { adaptCanvasToContainer: !0, withoutSave: !0 }), this.centerMontageArea();
1530
1566
  const o = t.left - i, d = t.top - a;
1531
1567
  if (o !== 0 || d !== 0) {
1532
- const r = e.getActiveObject(), l = [];
1533
- if ((r == null ? void 0 : r.type) === "activeselection") {
1534
- const h = r;
1568
+ const c = e.getActiveObject(), l = [];
1569
+ if ((c == null ? void 0 : c.type) === "activeselection") {
1570
+ const h = c;
1535
1571
  l.push(...h.getObjects()), e.discardActiveObject();
1536
1572
  }
1537
1573
  if (e.getObjects().forEach((h) => {
@@ -1543,7 +1579,7 @@ class tt {
1543
1579
  if (l.length === 1)
1544
1580
  e.setActiveObject(l[0]);
1545
1581
  else {
1546
- const h = new v(l, {
1582
+ const h = new p(l, {
1547
1583
  canvas: e
1548
1584
  });
1549
1585
  e.setActiveObject(h);
@@ -1565,15 +1601,19 @@ class tt {
1565
1601
  *
1566
1602
  * @param zoom — текущее значение zoom (например, 1, 1.2, 2 и т.д.)
1567
1603
  */
1568
- updateCssDimensionsForZoom(e) {
1569
- const { canvas: t, montageArea: s } = this.editor, n = s.width * e, i = s.height * e, a = t.wrapperEl.parentNode;
1570
- if (!(a instanceof HTMLElement)) return;
1571
- const o = n <= a.clientWidth ? "100%" : n, d = i <= a.clientHeight ? "100%" : i;
1572
- t.setDimensions(
1573
- { width: o, height: d },
1574
- { cssOnly: !0 }
1575
- );
1576
- }
1604
+ // public updateCssDimensionsForZoom(zoom: number): void {
1605
+ // const { canvas, montageArea } = this.editor
1606
+ // const zoomedWidth = montageArea.width * zoom
1607
+ // const zoomedHeight = montageArea.height * zoom
1608
+ // const scrollContainer = canvas.wrapperEl.parentNode
1609
+ // if (!(scrollContainer instanceof HTMLElement)) return
1610
+ // const cssWidth = zoomedWidth <= scrollContainer.clientWidth ? '100%' : zoomedWidth
1611
+ // const cssHeight = zoomedHeight <= scrollContainer.clientHeight ? '100%' : zoomedHeight
1612
+ // canvas.setDimensions(
1613
+ // { width: cssWidth, height: cssHeight },
1614
+ // { cssOnly: true }
1615
+ // )
1616
+ // }
1577
1617
  /**
1578
1618
  * Устанавливаем CSS ширину канваса для отображения
1579
1619
  * @param width
@@ -1657,32 +1697,32 @@ class tt {
1657
1697
  */
1658
1698
  setDisplayDimension({ element: e = "canvas", dimension: t, value: s } = {}) {
1659
1699
  if (!s) return;
1660
- const { canvas: n, options: { editorContainer: i } } = this.editor, a = [];
1700
+ const { canvas: n } = this.editor, i = [];
1661
1701
  switch (e) {
1662
1702
  case "canvas":
1663
- a.push(n.lowerCanvasEl, n.upperCanvasEl);
1703
+ i.push(n.lowerCanvasEl, n.upperCanvasEl);
1664
1704
  break;
1665
1705
  case "wrapper":
1666
- a.push(n.wrapperEl);
1706
+ i.push(n.wrapperEl);
1667
1707
  break;
1668
1708
  case "container":
1669
- a.push(i);
1709
+ i.push(this.getEditorContainer());
1670
1710
  break;
1671
1711
  default:
1672
- a.push(n.lowerCanvasEl, n.upperCanvasEl);
1712
+ i.push(n.lowerCanvasEl, n.upperCanvasEl);
1673
1713
  }
1674
- const o = t === "width" ? "width" : "height";
1714
+ const a = t === "width" ? "width" : "height";
1675
1715
  if (typeof s == "string") {
1676
- a.forEach((r) => {
1677
- r.style[o] = s;
1716
+ i.forEach((d) => {
1717
+ d.style[a] = s;
1678
1718
  });
1679
1719
  return;
1680
1720
  }
1681
1721
  if (isNaN(s)) return;
1682
- const d = `${s}px`;
1683
- a.forEach((r) => {
1684
- r.style[o] = d;
1685
- }), n.fire(`editor:display-${e}-${o}-changed`, {
1722
+ const o = `${s}px`;
1723
+ i.forEach((d) => {
1724
+ d.style[a] = o;
1725
+ }), n.fire(`editor:display-${e}-${a}-changed`, {
1686
1726
  element: e,
1687
1727
  value: s
1688
1728
  });
@@ -1704,9 +1744,9 @@ class tt {
1704
1744
  montageAreaWidth: o,
1705
1745
  montageAreaHeight: d
1706
1746
  }
1707
- } = this.editor, r = e || n.getActiveObject();
1708
- if (!r || r.type !== "image" && r.format !== "svg") return;
1709
- const { width: l, height: h } = r;
1747
+ } = this.editor, c = e || n.getActiveObject();
1748
+ if (!it(c)) return;
1749
+ const { width: l, height: h } = c;
1710
1750
  let g = Math.min(l, O), u = Math.min(h, T);
1711
1751
  if (t) {
1712
1752
  const {
@@ -1715,8 +1755,8 @@ class tt {
1715
1755
  } = i, f = l / m, j = h / M, A = Math.max(f, j);
1716
1756
  g = m * A, u = M * A;
1717
1757
  }
1718
- this.setResolutionWidth(g, { withoutSave: !0 }), this.setResolutionHeight(u, { withoutSave: !0 }), (l > o || h > d) && a.calculateAndApplyDefaultZoom(), a.resetObject(r, { withoutSave: !0 }), n.centerObject(r), n.renderAll(), s || this.editor.historyManager.saveState(), n.fire("editor:montage-area-scaled-to-image", {
1719
- object: r,
1758
+ this.setResolutionWidth(g, { withoutSave: !0 }), this.setResolutionHeight(u, { withoutSave: !0 }), (l > o || h > d) && a.calculateAndApplyDefaultZoom(), a.resetObject(c, { withoutSave: !0 }), n.centerObject(c), n.renderAll(), s || this.editor.historyManager.saveState(), n.fire("editor:montage-area-scaled-to-image", {
1759
+ object: c,
1720
1760
  width: g,
1721
1761
  height: u,
1722
1762
  preserveAspectRatio: t,
@@ -1758,9 +1798,9 @@ class tt {
1758
1798
  return e.getObjects().filter((i) => i.id !== t.id && i.id !== (s == null ? void 0 : s.id));
1759
1799
  }
1760
1800
  }
1761
- class st {
1801
+ class ot {
1762
1802
  constructor({ editor: e }) {
1763
- this.editor = e, this.options = e.options, this.minZoom = this.options.minZoom || Je, this.maxZoom = this.options.maxZoom || Ke, this.defaultZoom = this.options.defaultScale, this.maxZoomFactor = this.options.maxZoomFactor;
1803
+ this.editor = e, this.options = e.options, this.minZoom = this.options.minZoom || qe, this.maxZoom = this.options.maxZoom || et, this.defaultZoom = this.options.defaultScale, this.maxZoomFactor = this.options.maxZoomFactor;
1764
1804
  }
1765
1805
  /**
1766
1806
  * Метод рассчитывает и применяет зум по умолчанию для монтажной области редактора.
@@ -1770,8 +1810,8 @@ class st {
1770
1810
  * @param scale - Желаемый масштаб относительно размеров контейнера редактора.
1771
1811
  */
1772
1812
  calculateAndApplyDefaultZoom(e = this.options.defaultScale) {
1773
- const { canvas: t } = this.editor, s = t.editorContainer, n = s.clientWidth, i = s.clientHeight, { width: a, height: o } = this.editor.montageArea, d = n / a * e, r = i / o * e;
1774
- this.defaultZoom = Math.min(d, r);
1813
+ const { canvas: t } = this.editor, s = t.editorContainer, n = s.clientWidth, i = s.clientHeight, { width: a, height: o } = this.editor.montageArea, d = n / a * e, c = i / o * e;
1814
+ this.defaultZoom = Math.min(d, c);
1775
1815
  const { defaultZoom: l, maxZoomFactor: h, minZoom: g, maxZoom: u } = this;
1776
1816
  this.minZoom = Math.min(l / h, g), this.maxZoom = Math.max(l * h, u), this.setZoom();
1777
1817
  }
@@ -1784,10 +1824,10 @@ class st {
1784
1824
  * @fires editor:zoom-changed
1785
1825
  * Если передавать координаты курсора, то нужно быть аккуратнее, так как юзер может выйти за пределы рабочей области
1786
1826
  */
1787
- zoom(e = qe, t = {}) {
1827
+ zoom(e = tt, t = {}) {
1788
1828
  var g, u;
1789
1829
  if (!e) return;
1790
- const { minZoom: s, maxZoom: n } = this, { canvas: i } = this.editor, a = i.getZoom(), o = i.getCenterPoint(), d = (g = t.pointX) != null ? g : o.x, r = (u = t.pointY) != null ? u : o.y, l = new _(d, r);
1830
+ const { minZoom: s, maxZoom: n } = this, { canvas: i } = this.editor, a = i.getZoom(), o = i.getCenterPoint(), d = (g = t.pointX) != null ? g : o.x, c = (u = t.pointY) != null ? u : o.y, l = new P(d, c);
1791
1831
  let h = Number((a + Number(e)).toFixed(2));
1792
1832
  h > n && (h = n), h < s && (h = s), i.zoomToPoint(l, h), console.log({
1793
1833
  currentZoom: a,
@@ -1805,7 +1845,7 @@ class st {
1805
1845
  * @fires editor:zoom-changed
1806
1846
  */
1807
1847
  setZoom(e = this.defaultZoom) {
1808
- const { minZoom: t, maxZoom: s } = this, { canvas: n } = this.editor, i = new _(n.getCenterPoint());
1848
+ const { minZoom: t, maxZoom: s } = this, { canvas: n } = this.editor, i = new P(n.getCenterPoint());
1809
1849
  let a = e;
1810
1850
  e > s && (a = s), e < t && (a = t), n.zoomToPoint(i, a), n.fire("editor:zoom-changed", {
1811
1851
  currentZoom: n.getZoom(),
@@ -1818,7 +1858,7 @@ class st {
1818
1858
  * @fires editor:zoom-changed
1819
1859
  */
1820
1860
  resetZoom() {
1821
- const { canvas: e } = this.editor, t = new _(e.getCenterPoint());
1861
+ const { canvas: e } = this.editor, t = new P(e.getCenterPoint());
1822
1862
  e.zoomToPoint(t, this.defaultZoom), this.editor.canvas.fire("editor:zoom-changed", {
1823
1863
  currentZoom: e.getZoom(),
1824
1864
  point: t
@@ -1831,7 +1871,7 @@ class st {
1831
1871
  * @param options.withoutSave - Не сохранять состояние
1832
1872
  * @fires editor:object-rotated
1833
1873
  */
1834
- rotate(e = et, { withoutSave: t } = {}) {
1874
+ rotate(e = st, { withoutSave: t } = {}) {
1835
1875
  const { canvas: s, historyManager: n } = this.editor, i = s.getActiveObject();
1836
1876
  if (!i) return;
1837
1877
  const a = i.angle + e;
@@ -1881,7 +1921,7 @@ class st {
1881
1921
  withoutSave: s
1882
1922
  } = {}) {
1883
1923
  const { canvas: n, historyManager: i } = this.editor, a = e || n.getActiveObject();
1884
- a && (a instanceof v ? a.getObjects().forEach((o) => {
1924
+ a && (a instanceof p ? a.getObjects().forEach((o) => {
1885
1925
  o.set("opacity", t);
1886
1926
  }) : a.set("opacity", t), n.renderAll(), s || i.saveState(), n.fire("editor:object-opacity-changed", {
1887
1927
  object: a,
@@ -1908,13 +1948,13 @@ class st {
1908
1948
  } = {}) {
1909
1949
  const { canvas: i, historyManager: a } = this.editor, o = e || i.getActiveObject();
1910
1950
  if (o) {
1911
- if (o instanceof v && !n) {
1951
+ if (o instanceof p && !n) {
1912
1952
  const d = o.getObjects();
1913
1953
  i.discardActiveObject(), d.forEach((l) => {
1914
1954
  this._fitSingleObject(l, t);
1915
1955
  });
1916
- const r = new v(d, { canvas: i });
1917
- i.setActiveObject(r);
1956
+ const c = new p(d, { canvas: i });
1957
+ i.setActiveObject(c);
1918
1958
  } else
1919
1959
  this._fitSingleObject(o, t);
1920
1960
  i.renderAll(), s || a.saveState(), i.fire("editor:object-fitted", {
@@ -1932,7 +1972,7 @@ class st {
1932
1972
  * @private
1933
1973
  */
1934
1974
  _fitSingleObject(e, t) {
1935
- const { canvas: s, montageArea: n } = this.editor, { width: i, height: a, scaleX: o = 1, scaleY: d = 1, angle: r = 0 } = e, l = i * Math.abs(o), h = a * Math.abs(d), g = r * Math.PI / 180, u = Math.abs(Math.cos(g)), m = Math.abs(Math.sin(g)), M = l * u + h * m, f = l * m + h * u, j = n.width, A = n.height;
1975
+ const { canvas: s, montageArea: n } = this.editor, { width: i, height: a, scaleX: o = 1, scaleY: d = 1, angle: c = 0 } = e, l = i * Math.abs(o), h = a * Math.abs(d), g = c * Math.PI / 180, u = Math.abs(Math.cos(g)), m = Math.abs(Math.sin(g)), M = l * u + h * m, f = l * m + h * u, j = n.width, A = n.height;
1936
1976
  let b;
1937
1977
  t === "contain" ? b = Math.min(j / M, A / f) : b = Math.max(j / M, A / f), e.set({
1938
1978
  scaleX: o * b,
@@ -1962,31 +2002,31 @@ class st {
1962
2002
  imageManager: a,
1963
2003
  historyManager: o,
1964
2004
  options: { scaleType: d }
1965
- } = this.editor, r = e || n.getActiveObject();
1966
- if (!r || r.locked) return;
1967
- if (o.suspendHistory(), r.type === "image" || r.format === "svg" || r.set({
2005
+ } = this.editor, c = e || n.getActiveObject();
2006
+ if (!c || c.locked) return;
2007
+ if (o.suspendHistory(), c.type === "image" || c.format === "svg" || c.set({
1968
2008
  scaleX: 1,
1969
2009
  scaleY: 1,
1970
2010
  flipX: !1,
1971
2011
  flipY: !1,
1972
2012
  angle: 0
1973
2013
  }), t)
1974
- this.fitObject({ object: r, withoutSave: !0, fitAsOneObject: !0 });
2014
+ this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 });
1975
2015
  else {
1976
- const { width: h, height: g } = i, { width: u, height: m } = r, M = a.calculateScaleFactor({
1977
- imageObject: r,
2016
+ const { width: h, height: g } = i, { width: u, height: m } = c, M = a.calculateScaleFactor({
2017
+ imageObject: c,
1978
2018
  scaleType: d
1979
2019
  });
1980
- d === "contain" && M < 1 || d === "cover" && (u > h || m > g) ? this.fitObject({ object: r, withoutSave: !0, fitAsOneObject: !0 }) : r.set({ scaleX: 1, scaleY: 1 });
2020
+ d === "contain" && M < 1 || d === "cover" && (u > h || m > g) ? this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 }) : c.set({ scaleX: 1, scaleY: 1 });
1981
2021
  }
1982
- r.set({ flipX: !1, flipY: !1, angle: 0 }), n.centerObject(r), n.renderAll(), o.resumeHistory(), s || o.saveState(), n.fire("editor:object-reset", {
1983
- object: r,
2022
+ c.set({ flipX: !1, flipY: !1, angle: 0 }), n.centerObject(c), n.renderAll(), o.resumeHistory(), s || o.saveState(), n.fire("editor:object-reset", {
2023
+ object: c,
1984
2024
  withoutSave: s,
1985
2025
  alwaysFitObject: t
1986
2026
  });
1987
2027
  }
1988
2028
  }
1989
- class nt {
2029
+ class rt {
1990
2030
  constructor({ editor: e }) {
1991
2031
  this.editor = e, this.isBlocked = !1, this.overlayMask = null, this._createOverlay();
1992
2032
  }
@@ -2043,7 +2083,7 @@ class nt {
2043
2083
  }), e.upperCanvasEl.style.pointerEvents = "", e.lowerCanvasEl.style.pointerEvents = "", this.overlayMask.visible = !1, e.requestRenderAll(), e.fire("editor:enabled"), s.resumeHistory();
2044
2084
  }
2045
2085
  }
2046
- class P {
2086
+ class V {
2047
2087
  constructor({ editor: e }) {
2048
2088
  this.editor = e;
2049
2089
  }
@@ -2058,7 +2098,7 @@ class P {
2058
2098
  const { canvas: s, historyManager: n } = this.editor;
2059
2099
  n.suspendHistory();
2060
2100
  const i = e || s.getActiveObject();
2061
- i && (i instanceof v ? i.getObjects().forEach((a) => {
2101
+ i && (i instanceof p ? i.getObjects().forEach((a) => {
2062
2102
  s.bringObjectToFront(a);
2063
2103
  }) : s.bringObjectToFront(i), s.renderAll(), n.resumeHistory(), t || n.saveState(), s.fire("editor:object-bring-to-front", {
2064
2104
  object: i,
@@ -2076,7 +2116,7 @@ class P {
2076
2116
  const { canvas: s, historyManager: n } = this.editor;
2077
2117
  n.suspendHistory();
2078
2118
  const i = e || s.getActiveObject();
2079
- i && (i instanceof v ? P._moveSelectionForward(s, i) : s.bringObjectForward(i), s.renderAll(), n.resumeHistory(), t || n.saveState(), s.fire("editor:object-bring-forward", {
2119
+ i && (i instanceof p ? V._moveSelectionForward(s, i) : s.bringObjectForward(i), s.renderAll(), n.resumeHistory(), t || n.saveState(), s.fire("editor:object-bring-forward", {
2080
2120
  object: i,
2081
2121
  withoutSave: t
2082
2122
  }));
@@ -2098,10 +2138,10 @@ class P {
2098
2138
  i.suspendHistory();
2099
2139
  const o = e || s.getActiveObject();
2100
2140
  if (o) {
2101
- if (o instanceof v) {
2141
+ if (o instanceof p) {
2102
2142
  const d = o.getObjects();
2103
- for (let r = d.length - 1; r >= 0; r -= 1)
2104
- s.sendObjectToBack(d[r]);
2143
+ for (let c = d.length - 1; c >= 0; c -= 1)
2144
+ s.sendObjectToBack(d[c]);
2105
2145
  } else
2106
2146
  s.sendObjectToBack(o);
2107
2147
  s.sendObjectToBack(n), a && s.sendObjectToBack(a), s.renderAll(), i.resumeHistory(), t || i.saveState(), s.fire("editor:object-send-to-back", {
@@ -2125,7 +2165,7 @@ class P {
2125
2165
  } = this.editor;
2126
2166
  i.suspendHistory();
2127
2167
  const o = e || s.getActiveObject();
2128
- o && (o instanceof v ? P._moveSelectionBackwards(s, o) : s.sendObjectBackwards(o), s.sendObjectToBack(n), a && s.sendObjectToBack(a), s.renderAll(), i.resumeHistory(), t || i.saveState(), s.fire("editor:object-send-backwards", {
2168
+ o && (o instanceof p ? V._moveSelectionBackwards(s, o) : s.sendObjectBackwards(o), s.sendObjectToBack(n), a && s.sendObjectToBack(a), s.renderAll(), i.resumeHistory(), t || i.saveState(), s.fire("editor:object-send-backwards", {
2129
2169
  object: o,
2130
2170
  withoutSave: t
2131
2171
  }));
@@ -2140,8 +2180,8 @@ class P {
2140
2180
  const s = e.getObjects(), n = t.getObjects();
2141
2181
  if (!n.some((o) => {
2142
2182
  const d = s.indexOf(o);
2143
- for (let r = d + 1; r < s.length; r += 1)
2144
- if (!n.includes(s[r]))
2183
+ for (let c = d + 1; c < s.length; c += 1)
2184
+ if (!n.includes(s[c]))
2145
2185
  return !0;
2146
2186
  return !1;
2147
2187
  })) return;
@@ -2159,8 +2199,8 @@ class P {
2159
2199
  const s = e.getObjects(), n = t.getObjects();
2160
2200
  if (!n.some((o) => {
2161
2201
  const d = s.indexOf(o);
2162
- for (let r = d - 1; r >= 0; r -= 1)
2163
- if (!n.includes(s[r]))
2202
+ for (let c = d - 1; c >= 0; c -= 1)
2203
+ if (!n.includes(s[c]))
2164
2204
  return !0;
2165
2205
  return !1;
2166
2206
  })) return;
@@ -2169,7 +2209,7 @@ class P {
2169
2209
  });
2170
2210
  }
2171
2211
  }
2172
- class it {
2212
+ class ct {
2173
2213
  /**
2174
2214
  * Менеджер фигур для редактора.
2175
2215
  * @param options - Опции и настройки менеджера фигур.
@@ -2193,7 +2233,7 @@ class it {
2193
2233
  * @param flags.withoutSelection - Не выделять объект
2194
2234
  * @param flags.withoutAdding - Не добавлять объект в canvas
2195
2235
  */
2196
- addRectangle(l = {}, { withoutSelection: d, withoutAdding: r } = {}) {
2236
+ addRectangle(l = {}, { withoutSelection: d, withoutAdding: c } = {}) {
2197
2237
  var h = l, {
2198
2238
  id: e = `rect-${L()}`,
2199
2239
  left: t,
@@ -2201,7 +2241,7 @@ class it {
2201
2241
  width: n = 100,
2202
2242
  height: i = 100,
2203
2243
  fill: a = "blue"
2204
- } = h, o = Y(h, [
2244
+ } = h, o = _(h, [
2205
2245
  "id",
2206
2246
  "left",
2207
2247
  "top",
@@ -2209,7 +2249,7 @@ class it {
2209
2249
  "height",
2210
2250
  "fill"
2211
2251
  ]);
2212
- const { canvas: g } = this.editor, u = new ve(y({
2252
+ const { canvas: g } = this.editor, u = new Se(y({
2213
2253
  id: e,
2214
2254
  left: t,
2215
2255
  top: s,
@@ -2217,7 +2257,7 @@ class it {
2217
2257
  height: i,
2218
2258
  fill: a
2219
2259
  }, o));
2220
- return !t && !s && g.centerObject(u), r || (g.add(u), d || g.setActiveObject(u), g.renderAll()), u;
2260
+ return !t && !s && g.centerObject(u), c || (g.add(u), d || g.setActiveObject(u), g.renderAll()), u;
2221
2261
  }
2222
2262
  /**
2223
2263
  * Добавление круга
@@ -2235,21 +2275,21 @@ class it {
2235
2275
  * @param flags.withoutSelection - Не выделять объект
2236
2276
  * @param flags.withoutAdding - Не добавлять объект в canvas
2237
2277
  */
2238
- addCircle(r = {}, { withoutSelection: o, withoutAdding: d } = {}) {
2239
- var l = r, {
2278
+ addCircle(c = {}, { withoutSelection: o, withoutAdding: d } = {}) {
2279
+ var l = c, {
2240
2280
  id: e = `circle-${L()}`,
2241
2281
  left: t,
2242
2282
  top: s,
2243
2283
  radius: n = 50,
2244
2284
  fill: i = "green"
2245
- } = l, a = Y(l, [
2285
+ } = l, a = _(l, [
2246
2286
  "id",
2247
2287
  "left",
2248
2288
  "top",
2249
2289
  "radius",
2250
2290
  "fill"
2251
2291
  ]);
2252
- const { canvas: h } = this.editor, g = new Ae(y({
2292
+ const { canvas: h } = this.editor, g = new Ce(y({
2253
2293
  id: e,
2254
2294
  left: t,
2255
2295
  top: s,
@@ -2275,7 +2315,7 @@ class it {
2275
2315
  * @param flags.withoutSelection - Не выделять объект
2276
2316
  * @param flags.withoutAdding - Не добавлять объект в canvas
2277
2317
  */
2278
- addTriangle(l = {}, { withoutSelection: d, withoutAdding: r } = {}) {
2318
+ addTriangle(l = {}, { withoutSelection: d, withoutAdding: c } = {}) {
2279
2319
  var h = l, {
2280
2320
  id: e = `triangle-${L()}`,
2281
2321
  left: t,
@@ -2283,7 +2323,7 @@ class it {
2283
2323
  width: n = 100,
2284
2324
  height: i = 100,
2285
2325
  fill: a = "yellow"
2286
- } = h, o = Y(h, [
2326
+ } = h, o = _(h, [
2287
2327
  "id",
2288
2328
  "left",
2289
2329
  "top",
@@ -2291,7 +2331,7 @@ class it {
2291
2331
  "height",
2292
2332
  "fill"
2293
2333
  ]);
2294
- const { canvas: g } = this.editor, u = new Se(y({
2334
+ const { canvas: g } = this.editor, u = new Ne(y({
2295
2335
  id: e,
2296
2336
  left: t,
2297
2337
  top: s,
@@ -2299,10 +2339,10 @@ class it {
2299
2339
  width: n,
2300
2340
  height: i
2301
2341
  }, o));
2302
- return !t && !s && g.centerObject(u), r || (g.add(u), d || g.setActiveObject(u), g.renderAll()), u;
2342
+ return !t && !s && g.centerObject(u), c || (g.add(u), d || g.setActiveObject(u), g.renderAll()), u;
2303
2343
  }
2304
2344
  }
2305
- class at {
2345
+ class dt {
2306
2346
  /**
2307
2347
  * @param options
2308
2348
  * @param options.editor - экземпляр редактора с доступом к canvas
@@ -2315,7 +2355,7 @@ class at {
2315
2355
  * @fires editor:object-copied
2316
2356
  */
2317
2357
  copy() {
2318
- return I(this, null, function* () {
2358
+ return v(this, null, function* () {
2319
2359
  const { canvas: e, errorManager: t } = this.editor, s = e.getActiveObject();
2320
2360
  if (!s) return;
2321
2361
  try {
@@ -2354,10 +2394,10 @@ class at {
2354
2394
  });
2355
2395
  return;
2356
2396
  }
2357
- const i = s.toCanvasElement().toDataURL(), a = i.slice(5).split(";")[0], o = i.split(",")[1], d = atob(o), r = new Uint8Array(d.length);
2397
+ const i = s.toCanvasElement().toDataURL(), a = i.slice(5).split(";")[0], o = i.split(",")[1], d = atob(o), c = new Uint8Array(d.length);
2358
2398
  for (let g = 0; g < d.length; g += 1)
2359
- r[g] = d.charCodeAt(g);
2360
- const l = new Blob([r.buffer], { type: a }), h = new ClipboardItem({ [a]: l });
2399
+ c[g] = d.charCodeAt(g);
2400
+ const l = new Blob([c.buffer], { type: a }), h = new ClipboardItem({ [a]: l });
2361
2401
  navigator.clipboard.write([h]).catch((g) => {
2362
2402
  t.emitWarning({
2363
2403
  origin: "ClipboardManager",
@@ -2382,16 +2422,16 @@ class at {
2382
2422
  const o = n.getAsFile();
2383
2423
  if (!o) return;
2384
2424
  const d = new FileReader();
2385
- d.onload = (r) => {
2386
- r.target && this.editor.imageManager.importImage({ source: r.target.result });
2425
+ d.onload = (c) => {
2426
+ c.target && this.editor.imageManager.importImage({ source: c.target.result });
2387
2427
  }, d.readAsDataURL(o);
2388
2428
  return;
2389
2429
  }
2390
2430
  const i = e.getData("text/html");
2391
2431
  if (i) {
2392
- const r = new DOMParser().parseFromString(i, "text/html").querySelector("img");
2393
- if (r != null && r.src) {
2394
- t.importImage({ source: r.src });
2432
+ const c = new DOMParser().parseFromString(i, "text/html").querySelector("img");
2433
+ if (c != null && c.src) {
2434
+ t.importImage({ source: c.src });
2395
2435
  return;
2396
2436
  }
2397
2437
  }
@@ -2402,7 +2442,7 @@ class at {
2402
2442
  * @fires editor:object-pasted
2403
2443
  */
2404
2444
  paste() {
2405
- return I(this, null, function* () {
2445
+ return v(this, null, function* () {
2406
2446
  const { canvas: e } = this.editor;
2407
2447
  if (!this.clipboard) return;
2408
2448
  const t = yield this.clipboard.clone(["format"]);
@@ -2411,13 +2451,13 @@ class at {
2411
2451
  left: t.left + 10,
2412
2452
  top: t.top + 10,
2413
2453
  evented: !0
2414
- }), t instanceof v ? (t.canvas = e, t.forEachObject((s) => {
2454
+ }), t instanceof p ? (t.canvas = e, t.forEachObject((s) => {
2415
2455
  e.add(s);
2416
2456
  })) : e.add(t), e.setActiveObject(t), e.requestRenderAll(), e.fire("editor:object-pasted", { object: t });
2417
2457
  });
2418
2458
  }
2419
2459
  }
2420
- class F {
2460
+ class G {
2421
2461
  constructor({ editor: e }) {
2422
2462
  this.editor = e;
2423
2463
  }
@@ -2442,8 +2482,8 @@ class F {
2442
2482
  lockSkewingY: !0,
2443
2483
  locked: !0
2444
2484
  };
2445
- a.set(o), !t && F._isGroupOrSelection(a) && a.getObjects().forEach((r) => {
2446
- r.set(o);
2485
+ a.set(o), !t && G._isGroupOrSelection(a) && a.getObjects().forEach((c) => {
2486
+ c.set(o);
2447
2487
  }), n.renderAll(), s || i.saveState(), n.fire("editor:object-locked", {
2448
2488
  object: a,
2449
2489
  skipInnerObjects: t,
@@ -2470,7 +2510,7 @@ class F {
2470
2510
  lockSkewingY: !1,
2471
2511
  locked: !1
2472
2512
  };
2473
- i.set(a), F._isGroupOrSelection(i) && i.getObjects().forEach((o) => {
2513
+ i.set(a), G._isGroupOrSelection(i) && i.getObjects().forEach((o) => {
2474
2514
  o.set(a);
2475
2515
  }), s.renderAll(), t || n.saveState(), s.fire("editor:object-unlocked", {
2476
2516
  object: i,
@@ -2478,10 +2518,10 @@ class F {
2478
2518
  });
2479
2519
  }
2480
2520
  static _isGroupOrSelection(e) {
2481
- return e instanceof v || e instanceof X;
2521
+ return e instanceof p || e instanceof $;
2482
2522
  }
2483
2523
  }
2484
- class ot {
2524
+ class lt {
2485
2525
  constructor({ editor: e }) {
2486
2526
  this.editor = e;
2487
2527
  }
@@ -2499,8 +2539,8 @@ class ot {
2499
2539
  const { canvas: s, historyManager: n } = this.editor;
2500
2540
  n.suspendHistory();
2501
2541
  const i = e || s.getActiveObject();
2502
- if (!i || !(i instanceof v)) return;
2503
- const a = i.getObjects(), o = new X(a);
2542
+ if (!i || !(i instanceof p)) return;
2543
+ const a = i.getObjects(), o = new $(a);
2504
2544
  a.forEach((d) => s.remove(d)), o.set("id", `${o.type}-${L()}`), s.add(o), s.setActiveObject(o), s.renderAll(), n.resumeHistory(), t || n.saveState(), s.fire("editor:objects-grouped", {
2505
2545
  object: i,
2506
2546
  group: o,
@@ -2521,10 +2561,10 @@ class ot {
2521
2561
  const { canvas: s, historyManager: n } = this.editor;
2522
2562
  n.suspendHistory();
2523
2563
  const i = e || s.getActiveObject();
2524
- if (!(i instanceof X)) return;
2564
+ if (!(i instanceof $)) return;
2525
2565
  const a = i.removeAll();
2526
2566
  s.remove(i), a.forEach((d) => s.add(d));
2527
- const o = new v(a, {
2567
+ const o = new p(a, {
2528
2568
  canvas: s
2529
2569
  });
2530
2570
  s.setActiveObject(o), s.renderAll(), n.resumeHistory(), t || n.saveState(), s.fire("editor:objects-ungrouped", {
@@ -2534,7 +2574,7 @@ class ot {
2534
2574
  });
2535
2575
  }
2536
2576
  }
2537
- class rt {
2577
+ class ht {
2538
2578
  constructor({ editor: e }) {
2539
2579
  this.editor = e;
2540
2580
  }
@@ -2545,11 +2585,11 @@ class rt {
2545
2585
  selectAll() {
2546
2586
  const { canvas: e, canvasManager: t, objectLockManager: s } = this.editor;
2547
2587
  e.discardActiveObject();
2548
- const n = t.getObjects(), i = n.some((o) => o.locked), a = n.length > 1 ? new v(t.getObjects(), { canvas: e }) : n[0];
2588
+ const n = t.getObjects(), i = n.some((o) => o.locked), a = n.length > 1 ? new p(t.getObjects(), { canvas: e }) : n[0];
2549
2589
  i && s.lockObject({ object: a, skipInnerObjects: !0, withoutSave: !0 }), e.setActiveObject(a), e.requestRenderAll(), e.fire("editor:all-objects-selected", { selected: a });
2550
2590
  }
2551
2591
  }
2552
- class ct {
2592
+ class gt {
2553
2593
  constructor({ editor: e }) {
2554
2594
  this.editor = e;
2555
2595
  }
@@ -2577,7 +2617,7 @@ class ct {
2577
2617
  }));
2578
2618
  }
2579
2619
  }
2580
- const dt = {
2620
+ const ut = {
2581
2621
  IMAGE_MANAGER: {
2582
2622
  /**
2583
2623
  * Некорректный Content-Type изображения
@@ -2639,7 +2679,7 @@ const dt = {
2639
2679
  REDO_ERROR: "REDO_ERROR"
2640
2680
  }
2641
2681
  };
2642
- class V {
2682
+ class X {
2643
2683
  constructor({ editor: e }) {
2644
2684
  this._buffer = [], this.editor = e;
2645
2685
  }
@@ -2666,7 +2706,7 @@ class V {
2666
2706
  * @fires editor:error
2667
2707
  */
2668
2708
  emitError({ origin: e = "ImageEditor", method: t = "Unknown Method", code: s, data: n, message: i }) {
2669
- if (!V.isValidErrorCode(s)) {
2709
+ if (!X.isValidErrorCode(s)) {
2670
2710
  console.warn("Неизвестный код ошибки: ", { code: s, origin: e, method: t });
2671
2711
  return;
2672
2712
  }
@@ -2695,7 +2735,7 @@ class V {
2695
2735
  * @fires editor:warning
2696
2736
  */
2697
2737
  emitWarning({ origin: e = "ImageEditor", method: t = "Unknown Method", code: s, message: n, data: i }) {
2698
- if (!V.isValidErrorCode(s)) {
2738
+ if (!X.isValidErrorCode(s)) {
2699
2739
  console.warn("Неизвестный код предупреждения: ", { code: s, origin: e, method: t });
2700
2740
  return;
2701
2741
  }
@@ -2718,10 +2758,10 @@ class V {
2718
2758
  * @returns true, если код допустим, иначе false
2719
2759
  */
2720
2760
  static isValidErrorCode(e) {
2721
- return e ? Object.values(dt).some((t) => Object.values(t).includes(e)) : !1;
2761
+ return e ? Object.values(ut).some((t) => Object.values(t).includes(e)) : !1;
2722
2762
  }
2723
2763
  }
2724
- class ne {
2764
+ class ie {
2725
2765
  /**
2726
2766
  * Конструктор класса ImageEditor.
2727
2767
  * @param canvasId - идентификатор канваса, в котором будет создан редактор
@@ -2736,7 +2776,7 @@ class ne {
2736
2776
  * @fires editor:ready
2737
2777
  */
2738
2778
  init() {
2739
- return I(this, null, function* () {
2779
+ return v(this, null, function* () {
2740
2780
  const {
2741
2781
  editorContainerWidth: e,
2742
2782
  editorContainerHeight: t,
@@ -2746,13 +2786,13 @@ class ne {
2746
2786
  canvasCSSHeight: a,
2747
2787
  initialImage: o,
2748
2788
  initialStateJSON: d,
2749
- scaleType: r,
2789
+ scaleType: c,
2750
2790
  _onReadyCallback: l
2751
2791
  } = this.options;
2752
- if (He.apply(), this.canvas = new Ce(this.containerId, this.options), this.moduleLoader = new Ee(), this.workerManager = new Te(), this.errorManager = new V({ editor: this }), this.historyManager = new $e({ editor: this }), this.toolbar = new Qe({ editor: this }), this.transformManager = new st({ editor: this }), this.canvasManager = new tt({ editor: this }), this.imageManager = new D({ editor: this }), this.layerManager = new P({ editor: this }), this.shapeManager = new it({ editor: this }), this.interactionBlocker = new nt({ editor: this }), this.clipboardManager = new at({ editor: this }), this.objectLockManager = new F({ editor: this }), this.groupingManager = new ot({ editor: this }), this.selectionManager = new rt({ editor: this }), this.deletionManager = new ct({ editor: this }), this._createMontageArea(), this._createClippingArea(), this.listeners = new z({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(e), this.canvasManager.setEditorContainerHeight(t), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(n), this.canvasManager.setCanvasCSSWidth(i), this.canvasManager.setCanvasCSSHeight(a), o != null && o.source) {
2792
+ if (_e.apply(), this.canvas = new De(this.containerId, this.options), this.moduleLoader = new Te(), this.workerManager = new xe(), this.errorManager = new X({ editor: this }), this.historyManager = new Ke({ editor: this }), this.toolbar = new Je({ editor: this }), this.transformManager = new ot({ editor: this }), this.canvasManager = new at({ editor: this }), this.imageManager = new D({ editor: this }), this.layerManager = new V({ editor: this }), this.shapeManager = new ct({ editor: this }), this.interactionBlocker = new rt({ editor: this }), this.clipboardManager = new dt({ editor: this }), this.objectLockManager = new G({ editor: this }), this.groupingManager = new lt({ editor: this }), this.selectionManager = new ht({ editor: this }), this.deletionManager = new gt({ editor: this }), this._createMontageArea(), this._createClippingArea(), this.listeners = new R({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(e), this.canvasManager.setEditorContainerHeight(t), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(n), this.canvasManager.setCanvasCSSWidth(i), this.canvasManager.setCanvasCSSHeight(a), o != null && o.source) {
2753
2793
  const {
2754
2794
  source: h,
2755
- scale: g = `image-${r}`,
2795
+ scale: g = `image-${c}`,
2756
2796
  withoutSave: u = !0
2757
2797
  } = o;
2758
2798
  yield this.imageManager.importImage({ source: h, scale: g, withoutSave: u });
@@ -2772,7 +2812,7 @@ class ne {
2772
2812
  this.montageArea = this.shapeManager.addRectangle({
2773
2813
  width: e,
2774
2814
  height: t,
2775
- fill: ne._createMosaicPattern(),
2815
+ fill: ie._createMosaicPattern(),
2776
2816
  stroke: null,
2777
2817
  strokeWidth: 0,
2778
2818
  selectable: !1,
@@ -2822,13 +2862,13 @@ class ne {
2822
2862
  const e = document.createElement("canvas");
2823
2863
  e.width = 20, e.height = 20;
2824
2864
  const t = e.getContext("2d");
2825
- return t.fillStyle = "#ddd", t.fillRect(0, 0, 40, 40), t.fillStyle = "#ccc", t.fillRect(0, 0, 10, 10), t.fillRect(10, 10, 10, 10), new Ne({
2865
+ return t.fillStyle = "#ddd", t.fillRect(0, 0, 40, 40), t.fillStyle = "#ccc", t.fillRect(0, 0, 10, 10), t.fillRect(10, 10, 10, 10), new Le({
2826
2866
  source: e,
2827
2867
  repeat: "repeat"
2828
2868
  });
2829
2869
  }
2830
2870
  }
2831
- const lt = {
2871
+ const Mt = {
2832
2872
  /**
2833
2873
  * Опции редактора
2834
2874
  */
@@ -2917,18 +2957,18 @@ const lt = {
2917
2957
  resetObjectFitByDoubleClick: !0,
2918
2958
  keyboardIgnoreSelectors: []
2919
2959
  };
2920
- function bt(c, e = {}) {
2921
- const t = y(y({}, lt), e), s = document.getElementById(c);
2960
+ function vt(r, e = {}) {
2961
+ const t = y(y({}, Mt), e), s = document.getElementById(r);
2922
2962
  if (!s)
2923
- return Promise.reject(new Error(`Контейнер с ID "${c}" не найден.`));
2963
+ return Promise.reject(new Error(`Контейнер с ID "${r}" не найден.`));
2924
2964
  const n = document.createElement("canvas");
2925
- return n.id = `${c}-canvas`, s.appendChild(n), t.editorContainer = s, new Promise((i) => {
2965
+ return n.id = `${r}-canvas`, s.appendChild(n), t.editorContainer = s, new Promise((i) => {
2926
2966
  t._onReadyCallback = i;
2927
- const a = new ne(n.id, t);
2928
- window[c] = a;
2967
+ const a = new ie(n.id, t);
2968
+ window[r] = a;
2929
2969
  });
2930
2970
  }
2931
2971
  export {
2932
- bt as default
2972
+ vt as default
2933
2973
  };
2934
2974
  //# sourceMappingURL=main.js.map