@anu3ev/fabric-image-editor 0.5.5 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +800 -764
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,25 +1,25 @@
1
- var hs = Object.defineProperty, us = Object.defineProperties;
2
- var gs = Object.getOwnPropertyDescriptors;
3
- var Vt = Object.getOwnPropertySymbols;
4
- var Be = Object.prototype.hasOwnProperty, ze = Object.prototype.propertyIsEnumerable;
5
- var ke = (h, t, e) => t in h ? hs(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, k = (h, t) => {
1
+ var ds = Object.defineProperty, ls = Object.defineProperties;
2
+ var hs = Object.getOwnPropertyDescriptors;
3
+ var Gt = Object.getOwnPropertySymbols;
4
+ var _e = Object.prototype.hasOwnProperty, Ne = Object.prototype.propertyIsEnumerable;
5
+ var Re = (h, t, e) => t in h ? ds(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, _ = (h, t) => {
6
6
  for (var e in t || (t = {}))
7
- Be.call(t, e) && ke(h, e, t[e]);
8
- if (Vt)
9
- for (var e of Vt(t))
10
- ze.call(t, e) && ke(h, e, t[e]);
7
+ _e.call(t, e) && Re(h, e, t[e]);
8
+ if (Gt)
9
+ for (var e of Gt(t))
10
+ Ne.call(t, e) && Re(h, e, t[e]);
11
11
  return h;
12
- }, jt = (h, t) => us(h, gs(t));
13
- var gt = (h, t) => {
12
+ }, yt = (h, t) => ls(h, hs(t));
13
+ var vt = (h, t) => {
14
14
  var e = {};
15
15
  for (var s in h)
16
- Be.call(h, s) && t.indexOf(s) < 0 && (e[s] = h[s]);
17
- if (h != null && Vt)
18
- for (var s of Vt(h))
19
- t.indexOf(s) < 0 && ze.call(h, s) && (e[s] = h[s]);
16
+ _e.call(h, s) && t.indexOf(s) < 0 && (e[s] = h[s]);
17
+ if (h != null && Gt)
18
+ for (var s of Gt(h))
19
+ t.indexOf(s) < 0 && Ne.call(h, s) && (e[s] = h[s]);
20
20
  return e;
21
21
  };
22
- var _ = (h, t, e) => new Promise((s, o) => {
22
+ var N = (h, t, e) => new Promise((s, o) => {
23
23
  var n = (r) => {
24
24
  try {
25
25
  a(e.next(r));
@@ -35,15 +35,15 @@ var _ = (h, t, e) => new Promise((s, o) => {
35
35
  }, a = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(n, i);
36
36
  a((e = e.apply(h, t)).next());
37
37
  });
38
- import { ActiveSelection as x, Textbox as st, util as ct, controlsUtils as Pe, InteractiveFabricObject as Ue, Point as J, FitContentLayout as Ye, loadSVGFromURL as fs, FabricImage as Bt, Gradient as Fe, Rect as ps, Circle as ms, Triangle as ys, Group as Ct, Color as vs, classRegistry as He, loadSVGFromString as bs, Canvas as Ms, Pattern as ws } from "fabric";
39
- import { create as Ss } from "jsondiffpatch";
40
- import As from "diff-match-patch";
41
- var js = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", Y = function() {
38
+ import { ActiveSelection as k, Textbox as nt, util as dt, controlsUtils as xe, InteractiveFabricObject as Be, Point as tt, FitContentLayout as ke, loadSVGFromURL as us, FabricImage as zt, Gradient as ze, Rect as gs, Circle as fs, Triangle as ps, Group as Et, Color as ms, classRegistry as Pe, loadSVGFromString as ys, Canvas as vs, Pattern as bs } from "fabric";
39
+ import { create as Ms } from "jsondiffpatch";
40
+ import ws from "diff-match-patch";
41
+ var Ss = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", G = function() {
42
42
  for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21, e = "", s = crypto.getRandomValues(new Uint8Array(t |= 0)); t--; )
43
- e += js[s[t] & 63];
43
+ e += Ss[s[t] & 63];
44
44
  return e;
45
45
  };
46
- class Pt {
46
+ class Ut {
47
47
  /**
48
48
  * Конструктор принимает редактор и опции.
49
49
  * @param params
@@ -61,7 +61,7 @@ class Pt {
61
61
  * @param params.options.adaptCanvasToContainerOnResize — адаптировать канвас к размерам контейнера при изменении размеров окна
62
62
  */
63
63
  constructor({ editor: t, options: e = {} }) {
64
- this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, this.savedSelection = [], this.canvasDragging = !1, this.mouseWheelZooming = !1, this.bringToFrontOnSelection = !1, this.resetObjectFitByDoubleClick = !1, this.copyObjectsByHotkey = !1, this.pasteImageFromClipboard = !1, this.undoRedoByHotKeys = !1, this.selectAllByHotkey = !1, this.deleteObjectsByHotkey = !1, this.adaptCanvasToContainerOnResize = !1, this.editor = t, this.canvas = t.canvas, this.options = e, this.handleContainerResizeBound = Pt.debounce(this.handleContainerResize.bind(this), 500), this.handleCopyEventBound = this.handleCopyEvent.bind(this), this.handlePasteEventBound = this.handlePasteEvent.bind(this), this.handleUndoRedoEventBound = this.handleUndoRedoEvent.bind(this), this.handleUndoRedoKeyUpBound = this.handleUndoRedoKeyUp.bind(this), this.handleSelectAllEventBound = this.handleSelectAllEvent.bind(this), this.handleDeleteObjectsEventBound = this.handleDeleteObjectsEvent.bind(this), this.handleSpaceKeyDownBound = this.handleSpaceKeyDown.bind(this), this.handleSpaceKeyUpBound = this.handleSpaceKeyUp.bind(this), this.handleObjectModifiedHistoryBound = Pt.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = Pt.debounce(this.handleObjectRotatingHistory.bind(this), 300), this.handleObjectAddedHistoryBound = this.handleObjectAddedHistory.bind(this), this.handleObjectRemovedHistoryBound = this.handleObjectRemovedHistory.bind(this), this.handleOverlayUpdateBound = this.handleOverlayUpdate.bind(this), this.handleBackgroundUpdateBound = this.handleBackgroundUpdate.bind(this), this.handleCanvasDragStartBound = this.handleCanvasDragStart.bind(this), this.handleCanvasDraggingBound = this.handleCanvasDragging.bind(this), this.handleCanvasDragEndBound = this.handleCanvasDragEnd.bind(this), this.handleMouseWheelZoomBound = this.handleMouseWheelZoom.bind(this), this.handleBringToFrontBound = this.handleBringToFront.bind(this), this.handleResetObjectFitBound = this.handleResetObjectFit.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.init();
64
+ this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, this.savedSelection = [], this.canvasDragging = !1, this.mouseWheelZooming = !1, this.bringToFrontOnSelection = !1, this.resetObjectFitByDoubleClick = !1, this.copyObjectsByHotkey = !1, this.pasteImageFromClipboard = !1, this.undoRedoByHotKeys = !1, this.selectAllByHotkey = !1, this.deleteObjectsByHotkey = !1, this.adaptCanvasToContainerOnResize = !1, this.editor = t, this.canvas = t.canvas, this.options = e, this.handleContainerResizeBound = Ut.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 = Ut.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = Ut.debounce(this.handleObjectRotatingHistory.bind(this), 300), this.handleObjectAddedHistoryBound = this.handleObjectAddedHistory.bind(this), this.handleObjectRemovedHistoryBound = this.handleObjectRemovedHistory.bind(this), this.handleOverlayUpdateBound = this.handleOverlayUpdate.bind(this), this.handleBackgroundUpdateBound = this.handleBackgroundUpdate.bind(this), this.handleCanvasDragStartBound = this.handleCanvasDragStart.bind(this), this.handleCanvasDraggingBound = this.handleCanvasDragging.bind(this), this.handleCanvasDragEndBound = this.handleCanvasDragEnd.bind(this), this.handleMouseWheelZoomBound = this.handleMouseWheelZoom.bind(this), this.handleBringToFrontBound = this.handleBringToFront.bind(this), this.handleResetObjectFitBound = this.handleResetObjectFit.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.init();
65
65
  }
66
66
  /**
67
67
  * Инициализация всех обработчиков согласно опциям.
@@ -98,7 +98,7 @@ class Pt {
98
98
  if (o.length === 1)
99
99
  this.canvas.setActiveObject(o[0]);
100
100
  else {
101
- const i = new x(o, {
101
+ const i = new k(o, {
102
102
  canvas: this.canvas
103
103
  });
104
104
  this.canvas.setActiveObject(i);
@@ -106,7 +106,7 @@ class Pt {
106
106
  this.canvas.requestRenderAll();
107
107
  return;
108
108
  }
109
- const n = new x(t, {
109
+ const n = new k(t, {
110
110
  canvas: this.canvas
111
111
  });
112
112
  this.editor.objectLockManager.lockObject({
@@ -175,7 +175,7 @@ class Pt {
175
175
  * @param event.code — код клавиши
176
176
  */
177
177
  handleUndoRedoEvent(t) {
178
- return _(this, null, function* () {
178
+ return N(this, null, function* () {
179
179
  const { ctrlKey: e, metaKey: s, code: o, repeat: n } = t;
180
180
  this._shouldIgnoreKeyboardEvent(t) || !e && !s || n || !/Mac/i.test(navigator.userAgent) && this.isUndoRedoKeyPressed || (o === "KeyZ" ? (t.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.undo()) : o === "KeyY" && (t.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.redo()));
181
181
  });
@@ -220,7 +220,7 @@ class Pt {
220
220
  if (o || n) return;
221
221
  this.isSpacePressed = !0, t.preventDefault();
222
222
  const i = e.getActiveObject() || null;
223
- i instanceof x ? this.savedSelection = i.getObjects().slice() : i && (this.savedSelection = [i]), e.discardActiveObject(), e.set({
223
+ i instanceof k ? this.savedSelection = i.getObjects().slice() : i && (this.savedSelection = [i]), e.discardActiveObject(), e.set({
224
224
  selection: !1,
225
225
  defaultCursor: "grab"
226
226
  }), e.setCursor("grab"), s.canvasManager.getObjects().forEach((a) => {
@@ -259,7 +259,7 @@ class Pt {
259
259
  e.setActiveObject(t[0]);
260
260
  return;
261
261
  }
262
- const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new x(o, { canvas: e });
262
+ const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new k(o, { canvas: e });
263
263
  e.setActiveObject(n);
264
264
  }
265
265
  // --- Обработчики для событий canvas (Fabric) ---
@@ -330,7 +330,7 @@ class Pt {
330
330
  */
331
331
  handleResetObjectFit(t) {
332
332
  const e = t == null ? void 0 : t.target;
333
- !e || e instanceof st || this.editor.transformManager.resetObject({ object: e });
333
+ !e || e instanceof nt || this.editor.transformManager.resetObject({ object: e });
334
334
  }
335
335
  /**
336
336
  * Проверяет, должно ли событие клавиатуры быть проигнорировано
@@ -391,7 +391,7 @@ class Pt {
391
391
  };
392
392
  }
393
393
  }
394
- class Is {
394
+ class As {
395
395
  /**
396
396
  * Класс для динамической загрузки внешних модулей.
397
397
  */
@@ -409,7 +409,7 @@ class Is {
409
409
  return this.loaders[t] ? (this.cache.has(t) || this.cache.set(t, this.loaders[t]()), this.cache.get(t)) : Promise.reject(new Error(`Unknown module "${t}"`));
410
410
  }
411
411
  }
412
- function Cs(h) {
412
+ function js(h) {
413
413
  return new Worker(
414
414
  "" + new URL("assets/worker-CN39s7P7.js", import.meta.url).href,
415
415
  {
@@ -417,13 +417,13 @@ function Cs(h) {
417
417
  }
418
418
  );
419
419
  }
420
- class Ts {
420
+ class Is {
421
421
  /**
422
422
  * @param scriptUrl — URL скрипта воркера.
423
423
  * По-умолчанию использует DefaultWorker из соседнего файла
424
424
  */
425
425
  constructor(t) {
426
- t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new Cs(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
426
+ t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new js(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
427
427
  }
428
428
  /**
429
429
  * Обработчик сообщений от воркера
@@ -451,7 +451,7 @@ class Ts {
451
451
  * @returns Promise, который будет выполнен, когда воркер вернет ответ
452
452
  */
453
453
  post(t, e, s = []) {
454
- const o = `${t}:${Y(8)}`;
454
+ const o = `${t}:${G(8)}`;
455
455
  return new Promise((n, i) => {
456
456
  this._callbacks.set(o, { resolve: n, reject: i }), this.worker.postMessage({ action: t, payload: e, requestId: o }, s);
457
457
  });
@@ -463,95 +463,95 @@ class Ts {
463
463
  this.worker.terminate();
464
464
  }
465
465
  }
466
- const at = 12, Es = 2, de = 8, le = 20, Os = 100, he = 20, ue = 8, Ds = 100, $t = 32, me = 1, Ls = "#2B2D33", ye = "#3D8BF4", ve = "#FFFFFF";
467
- function Xt(h, t, e, s, o) {
468
- const n = at, i = Es;
469
- h.save(), h.translate(t, e), h.rotate(ct.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -n / 2, n, n, i), h.fill(), h.stroke(), h.restore();
466
+ const rt = 12, Cs = 2, le = 8, he = 20, Ts = 100, ue = 20, ge = 8, Es = 100, qt = 32, ye = 1, Os = "#2B2D33", ve = "#3D8BF4", be = "#FFFFFF";
467
+ function Vt(h, t, e, s, o) {
468
+ const n = rt, i = Cs;
469
+ h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = be, h.strokeStyle = ve, h.lineWidth = ye, h.beginPath(), h.roundRect(-n / 2, -n / 2, n, n, i), h.fill(), h.stroke(), h.restore();
470
470
  }
471
- function We(h, t, e, s, o) {
472
- const n = de, i = le, a = Os;
473
- h.save(), h.translate(t, e), h.rotate(ct.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
471
+ function Ue(h, t, e, s, o) {
472
+ const n = le, i = he, a = Ts;
473
+ h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = be, h.strokeStyle = ve, h.lineWidth = ye, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
474
474
  }
475
- function Ze(h, t, e, s, o) {
476
- const n = he, i = ue, a = Ds;
477
- h.save(), h.translate(t, e), h.rotate(ct.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
475
+ function Ye(h, t, e, s, o) {
476
+ const n = ue, i = ge, a = Es;
477
+ h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = be, h.strokeStyle = ve, h.lineWidth = ye, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
478
478
  }
479
- const Rs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", is = new Image();
480
- is.src = Rs;
481
- function _s(h, t, e, s, o) {
482
- const i = $t / 2;
483
- h.save(), h.translate(t, e), h.rotate(ct.degreesToRadians(o.angle)), h.fillStyle = Ls, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(is, -i / 2, -i / 2, i, i), h.restore();
479
+ const Ls = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", es = new Image();
480
+ es.src = Ls;
481
+ function Ds(h, t, e, s, o) {
482
+ const i = qt / 2;
483
+ h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = Os, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(es, -i / 2, -i / 2, i, i), h.restore();
484
484
  }
485
- const Ns = {
485
+ const Rs = {
486
486
  // Угловые точки
487
487
  tl: {
488
- render: Xt,
489
- sizeX: at,
490
- sizeY: at,
488
+ render: Vt,
489
+ sizeX: rt,
490
+ sizeY: rt,
491
491
  offsetX: 0,
492
492
  offsetY: 0
493
493
  },
494
494
  tr: {
495
- render: Xt,
496
- sizeX: at,
497
- sizeY: at,
495
+ render: Vt,
496
+ sizeX: rt,
497
+ sizeY: rt,
498
498
  offsetX: 0,
499
499
  offsetY: 0
500
500
  },
501
501
  bl: {
502
- render: Xt,
503
- sizeX: at,
504
- sizeY: at,
502
+ render: Vt,
503
+ sizeX: rt,
504
+ sizeY: rt,
505
505
  offsetX: 0,
506
506
  offsetY: 0
507
507
  },
508
508
  br: {
509
- render: Xt,
510
- sizeX: at,
511
- sizeY: at,
509
+ render: Vt,
510
+ sizeX: rt,
511
+ sizeY: rt,
512
512
  offsetX: 0,
513
513
  offsetY: 0
514
514
  },
515
515
  // Середина вертикалей
516
516
  ml: {
517
- render: We,
518
- sizeX: de,
519
- sizeY: le,
517
+ render: Ue,
518
+ sizeX: le,
519
+ sizeY: he,
520
520
  offsetX: 0,
521
521
  offsetY: 0
522
522
  },
523
523
  mr: {
524
- render: We,
525
- sizeX: de,
526
- sizeY: le,
524
+ render: Ue,
525
+ sizeX: le,
526
+ sizeY: he,
527
527
  offsetX: 0,
528
528
  offsetY: 0
529
529
  },
530
530
  // Середина горизонталей
531
531
  mt: {
532
- render: Ze,
533
- sizeX: he,
534
- sizeY: ue,
532
+ render: Ye,
533
+ sizeX: ue,
534
+ sizeY: ge,
535
535
  offsetX: 0,
536
536
  offsetY: 0
537
537
  },
538
538
  mb: {
539
- render: Ze,
540
- sizeX: he,
541
- sizeY: ue,
539
+ render: Ye,
540
+ sizeX: ue,
541
+ sizeY: ge,
542
542
  offsetX: 0,
543
543
  offsetY: 0
544
544
  },
545
545
  // Специальный «rotate» контрол
546
546
  mtr: {
547
- render: _s,
548
- sizeX: $t,
549
- sizeY: $t,
547
+ render: Ds,
548
+ sizeX: qt,
549
+ sizeY: qt,
550
550
  offsetX: 0,
551
- offsetY: -$t
551
+ offsetY: -qt
552
552
  }
553
553
  };
554
- class $ {
554
+ class J {
555
555
  /**
556
556
  * Отключает изменение ширины по оси X для заблокированных объектов, сохраняя поведение остального хэндлера.
557
557
  */
@@ -567,7 +567,7 @@ class $ {
567
567
  * Применяет конфигурацию контролов к набору по ключам из DEFAULT_CONTROLS.
568
568
  */
569
569
  static applyControlOverrides(t) {
570
- Object.entries(Ns).forEach(([e, s]) => {
570
+ Object.entries(Rs).forEach(([e, s]) => {
571
571
  const o = t[e];
572
572
  o && (Object.assign(o, s), e === "mtr" && (o.cursorStyle = "grab", o.mouseDownHandler = (n, i, a, r) => {
573
573
  var d;
@@ -580,24 +580,24 @@ class $ {
580
580
  * Регистрирует контролы и настройки поведения выделений.
581
581
  */
582
582
  static apply() {
583
- const t = Pe.createObjectDefaultControls();
584
- $.applyControlOverrides(t), Ue.ownDefaults.controls = t;
585
- const e = Pe.createTextboxDefaultControls();
586
- $.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), $.wrapWidthControl(e.ml), $.wrapWidthControl(e.mr), st.ownDefaults.controls = e, $.patchActiveSelectionBounds(), Ue.ownDefaults.snapAngle = 1;
583
+ const t = xe.createObjectDefaultControls();
584
+ J.applyControlOverrides(t), Be.ownDefaults.controls = t;
585
+ const e = xe.createTextboxDefaultControls();
586
+ J.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), J.wrapWidthControl(e.ml), J.wrapWidthControl(e.mr), nt.ownDefaults.controls = e, J.patchActiveSelectionBounds(), Be.ownDefaults.snapAngle = 1;
587
587
  }
588
588
  /**
589
589
  * Обновляет алгоритм расчёта границ ActiveSelection, чтобы учитывать фон и отступы текстовых объектов.
590
590
  */
591
591
  static patchActiveSelectionBounds() {
592
- const t = x.prototype, e = t._calcBoundsFromObjects;
592
+ const t = k.prototype, e = t._calcBoundsFromObjects;
593
593
  t._calcBoundsFromObjects = function(...n) {
594
594
  var g, f;
595
595
  const i = (f = (g = this.getObjects) == null ? void 0 : g.call(this)) != null ? f : [];
596
- $.applyTextSelectionScalingLock({
596
+ J.applyTextSelectionScalingLock({
597
597
  selection: this,
598
598
  objects: i
599
599
  });
600
- const a = $.calculateActiveSelectionBounds({
600
+ const a = J.calculateActiveSelectionBounds({
601
601
  objects: i
602
602
  });
603
603
  if (!a)
@@ -609,45 +609,45 @@ class $ {
609
609
  width: d,
610
610
  height: l
611
611
  });
612
- const u = new J(r + d / 2, c + l / 2);
612
+ const u = new tt(r + d / 2, c + l / 2);
613
613
  return this.setPositionByOrigin(u, "center", "center"), a;
614
614
  };
615
615
  const s = t._onAfterObjectsChange;
616
616
  t._onAfterObjectsChange = function(n, i) {
617
617
  var p, m;
618
618
  const a = s ? s.call(this, n, i) : void 0, r = (m = (p = this.getObjects) == null ? void 0 : p.call(this)) != null ? m : [];
619
- $.applyTextSelectionScalingLock({
619
+ J.applyTextSelectionScalingLock({
620
620
  selection: this,
621
621
  objects: r
622
622
  });
623
- const c = $.calculateActiveSelectionBounds({
623
+ const c = J.calculateActiveSelectionBounds({
624
624
  objects: r
625
625
  });
626
626
  if (!c) return a;
627
- const { left: d, top: l, width: u, height: g } = c, f = new J(d + u / 2, l + g / 2);
627
+ const { left: d, top: l, width: u, height: g } = c, f = new tt(d + u / 2, l + g / 2);
628
628
  return this.set({
629
629
  width: u,
630
630
  height: g
631
631
  }), this.setPositionByOrigin(f, "center", "center"), this.setCoords(), a;
632
632
  };
633
- const o = Ye.prototype.calcBoundingBox;
634
- Ye.prototype.calcBoundingBox = function(n, i) {
633
+ const o = ke.prototype.calcBoundingBox;
634
+ ke.prototype.calcBoundingBox = function(n, i) {
635
635
  const { target: a, type: r, overrides: c } = i;
636
636
  if (r === "imperative" && c)
637
637
  return c;
638
- if (!(a instanceof x))
638
+ if (!(a instanceof k))
639
639
  return o.call(this, n, i);
640
- $.applyTextSelectionScalingLock({
640
+ J.applyTextSelectionScalingLock({
641
641
  selection: a,
642
642
  objects: n
643
643
  });
644
- const d = $.calculateActiveSelectionBounds({ objects: n });
644
+ const d = J.calculateActiveSelectionBounds({ objects: n });
645
645
  if (!d)
646
646
  return o.call(this, n, i);
647
- const { left: l, top: u, width: g, height: f } = d, p = new J(g, f), m = new J(l + g / 2, u + f / 2);
647
+ const { left: l, top: u, width: g, height: f } = d, p = new tt(g, f), m = new tt(l + g / 2, u + f / 2);
648
648
  return r === "initialization" ? {
649
649
  center: m,
650
- relativeCorrection: new J(0, 0),
650
+ relativeCorrection: new tt(0, 0),
651
651
  size: p
652
652
  } : {
653
653
  center: m,
@@ -677,19 +677,16 @@ class $ {
677
677
  selection: t,
678
678
  objects: e
679
679
  }) {
680
- const s = e.some((i) => i instanceof st), o = t instanceof x && e.length > 1, n = s && o;
681
- t.set({
682
- lockScalingY: s,
683
- lockScalingX: n
684
- }), t.setControlsVisibility({
680
+ const s = e.some((o) => o instanceof nt);
681
+ t.setControlsVisibility({
685
682
  mt: !s,
686
683
  mb: !s,
687
- ml: !n,
688
- mr: !n
684
+ ml: !0,
685
+ mr: !0
689
686
  });
690
687
  }
691
688
  }
692
- const N = class N {
689
+ const B = class B {
693
690
  constructor(t = []) {
694
691
  this.fonts = t;
695
692
  }
@@ -697,36 +694,36 @@ const N = class N {
697
694
  this.fonts = t;
698
695
  }
699
696
  loadFonts() {
700
- return _(this, null, function* () {
697
+ return N(this, null, function* () {
701
698
  var o;
702
699
  const t = (o = this.fonts) != null ? o : [];
703
700
  if (!t.length) return;
704
701
  const e = typeof document != "undefined" ? document : void 0;
705
702
  if (!e) return;
706
- const s = t.map((n) => N.loadFont(n, e));
703
+ const s = t.map((n) => B.loadFont(n, e));
707
704
  yield Promise.allSettled(s);
708
705
  });
709
706
  }
710
707
  static loadFont(t, e) {
711
- return _(this, null, function* () {
708
+ return N(this, null, function* () {
712
709
  var c, d;
713
710
  const s = typeof FontFace != "undefined", o = (c = t.family) == null ? void 0 : c.trim(), n = (d = t.source) == null ? void 0 : d.trim();
714
711
  if (!o || !n) return;
715
- const i = N.normalizeFontSource(n), a = N.getDescriptorSnapshot(t.descriptors), r = N.getFontRegistrationKey(o, i, a);
716
- if (!N.registeredFontKeys.has(r)) {
717
- if (N.isFontFaceAlreadyApplied(e, o, a)) {
718
- N.registeredFontKeys.add(r);
712
+ const i = B.normalizeFontSource(n), a = B.getDescriptorSnapshot(t.descriptors), r = B.getFontRegistrationKey(o, i, a);
713
+ if (!B.registeredFontKeys.has(r)) {
714
+ if (B.isFontFaceAlreadyApplied(e, o, a)) {
715
+ B.registeredFontKeys.add(r);
719
716
  return;
720
717
  }
721
718
  if (s && e.fonts && typeof e.fonts.add == "function")
722
719
  try {
723
720
  const u = yield new FontFace(o, i, t.descriptors).load();
724
- e.fonts.add(u), N.registeredFontKeys.add(r);
721
+ e.fonts.add(u), B.registeredFontKeys.add(r);
725
722
  return;
726
723
  } catch (l) {
727
724
  console.warn(`Не удалось загрузить шрифт "${o}" через FontFace API`, l);
728
725
  }
729
- N.injectFontFace({
726
+ B.injectFontFace({
730
727
  font: t,
731
728
  source: i,
732
729
  doc: e,
@@ -746,15 +743,15 @@ const N = class N {
746
743
  if (!i) return;
747
744
  const a = s.createElement("style");
748
745
  a.setAttribute("data-editor-font", i), a.setAttribute("data-editor-font-key", o);
749
- const r = N.descriptorsToCss(n), c = [
746
+ const r = B.descriptorsToCss(n), c = [
750
747
  "@font-face {",
751
- ` font-family: ${N.formatFontFamilyForCss(i)};`,
748
+ ` font-family: ${B.formatFontFamilyForCss(i)};`,
752
749
  ` src: ${e};`,
753
750
  ...r.map((l) => ` ${l}`),
754
751
  "}"
755
752
  ];
756
753
  a.textContent = c.join(`
757
- `), s.head.appendChild(a), N.registeredFontKeys.add(o);
754
+ `), s.head.appendChild(a), B.registeredFontKeys.add(o);
758
755
  }
759
756
  static normalizeFontSource(t) {
760
757
  const e = t.trim();
@@ -777,15 +774,15 @@ const N = class N {
777
774
  return t ? t.trim().replace(/^['"]+|['"]+$/g, "").toLowerCase() : "";
778
775
  }
779
776
  static getDescriptorSnapshot(t) {
780
- const e = N.descriptorDefaults;
777
+ const e = B.descriptorDefaults;
781
778
  return {
782
- style: N.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
783
- weight: N.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
784
- stretch: N.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
785
- unicodeRange: N.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
786
- variant: N.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
787
- featureSettings: N.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
788
- display: N.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
779
+ style: B.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
780
+ weight: B.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
781
+ stretch: B.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
782
+ unicodeRange: B.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
783
+ variant: B.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
784
+ featureSettings: B.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
785
+ display: B.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
789
786
  };
790
787
  }
791
788
  static areDescriptorSnapshotsEqual(t, e) {
@@ -793,7 +790,7 @@ const N = class N {
793
790
  }
794
791
  static getFontRegistrationKey(t, e, s) {
795
792
  return [
796
- N.normalizeFamilyName(t),
793
+ B.normalizeFamilyName(t),
797
794
  e,
798
795
  s.style,
799
796
  s.weight,
@@ -807,12 +804,12 @@ const N = class N {
807
804
  static isFontFaceAlreadyApplied(t, e, s) {
808
805
  const o = t.fonts;
809
806
  if (!o || typeof o.forEach != "function") return !1;
810
- const n = N.normalizeFamilyName(e);
807
+ const n = B.normalizeFamilyName(e);
811
808
  let i = !1;
812
809
  try {
813
810
  o.forEach((a) => {
814
- if (i || N.normalizeFamilyName(a.family) !== n) return;
815
- const c = N.getDescriptorSnapshot({
811
+ if (i || B.normalizeFamilyName(a.family) !== n) return;
812
+ const c = B.getDescriptorSnapshot({
816
813
  style: a.style,
817
814
  weight: a.weight,
818
815
  stretch: a.stretch,
@@ -821,7 +818,7 @@ const N = class N {
821
818
  featureSettings: a.featureSettings,
822
819
  display: a.display
823
820
  });
824
- N.areDescriptorSnapshotsEqual(s, c) && (i = !0);
821
+ B.areDescriptorSnapshotsEqual(s, c) && (i = !0);
825
822
  });
826
823
  } catch (a) {
827
824
  return console.warn("Не удалось проверить, загружен ли шрифт ранее через FontFaceSet", a), !1;
@@ -848,7 +845,7 @@ const N = class N {
848
845
  });
849
846
  }
850
847
  };
851
- N.registeredFontKeys = /* @__PURE__ */ new Set(), N.descriptorDefaults = {
848
+ B.registeredFontKeys = /* @__PURE__ */ new Set(), B.descriptorDefaults = {
852
849
  style: "normal",
853
850
  weight: "normal",
854
851
  stretch: "normal",
@@ -857,8 +854,8 @@ N.registeredFontKeys = /* @__PURE__ */ new Set(), N.descriptorDefaults = {
857
854
  featureSettings: "normal",
858
855
  display: "auto"
859
856
  };
860
- let ge = N;
861
- const xs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==",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I1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Pt = {
862
859
  style: {
863
860
  position: "absolute",
864
861
  display: "none",
@@ -925,17 +922,17 @@ const xs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
925
922
  ],
926
923
  offsetTop: 50,
927
924
  icons: {
928
- copyPaste: xs,
929
- delete: Fs,
930
- lock: ks,
931
- unlock: Bs,
932
- bringToFront: Us,
933
- sendToBack: Ys,
934
- bringForward: zs,
935
- sendBackwards: Ps
925
+ copyPaste: _s,
926
+ delete: Us,
927
+ lock: Ns,
928
+ unlock: xs,
929
+ bringToFront: zs,
930
+ sendToBack: Ps,
931
+ bringForward: Bs,
932
+ sendBackwards: ks
936
933
  },
937
934
  handlers: {
938
- copyPaste: (h) => _(null, null, function* () {
935
+ copyPaste: (h) => N(null, null, function* () {
939
936
  h.clipboardManager.copyPaste();
940
937
  }),
941
938
  delete: (h) => {
@@ -961,18 +958,18 @@ const xs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
961
958
  }
962
959
  }
963
960
  };
964
- class Hs {
961
+ class Ys {
965
962
  constructor({ editor: t }) {
966
963
  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();
967
964
  }
968
965
  _initToolbar() {
969
966
  if (!this.options.showToolbar) return;
970
967
  const t = this.options.toolbar || {};
971
- this.config = jt(k(k({}, zt), t), {
972
- style: k(k({}, zt.style), t.style || {}),
973
- btnStyle: k(k({}, zt.btnStyle), t.btnStyle || {}),
974
- icons: k(k({}, zt.icons), t.icons || {}),
975
- handlers: k(k({}, zt.handlers), t.handlers || {})
968
+ this.config = yt(_(_({}, Pt), t), {
969
+ style: _(_({}, Pt.style), t.style || {}),
970
+ btnStyle: _(_({}, Pt.btnStyle), t.btnStyle || {}),
971
+ icons: _(_({}, Pt.icons), t.icons || {}),
972
+ handlers: _(_({}, Pt.handlers), t.handlers || {})
976
973
  }), this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this._onMouseDown = this._handleMouseDown.bind(this), this._onObjectMoving = this._startTransform.bind(this), this._onObjectScaling = this._startTransform.bind(this), this._onObjectRotating = this._startTransform.bind(this), this._onMouseUp = this._endTransform.bind(this), this._onObjectModified = this._endTransform.bind(this), this._onSelectionChange = this._updateToolbar.bind(this), this._onSelectionClear = () => {
977
974
  this.el.style.display = "none";
978
975
  }, this._createDOM(), this._bindEvents();
@@ -1089,7 +1086,7 @@ class Hs {
1089
1086
  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();
1090
1087
  }
1091
1088
  }
1092
- const Ws = {
1089
+ const Fs = {
1093
1090
  position: "absolute",
1094
1091
  display: "none",
1095
1092
  background: "#2B2D33",
@@ -1103,8 +1100,8 @@ const Ws = {
1103
1100
  "pointer-events": "none",
1104
1101
  "white-space": "nowrap",
1105
1102
  "box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
1106
- }, Ge = 16, Ve = 16, Zs = "fabric-editor-angle-indicator";
1107
- class be {
1103
+ }, Fe = 16, We = 16, Ws = "fabric-editor-angle-indicator";
1104
+ class Me {
1108
1105
  constructor({ editor: t }) {
1109
1106
  this.isActive = !1, this.currentAngle = 0, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._createDOM(), this._bindEvents();
1110
1107
  }
@@ -1112,7 +1109,7 @@ class be {
1112
1109
  * Создание DOM-элемента индикатора
1113
1110
  */
1114
1111
  _createDOM() {
1115
- this.el = document.createElement("div"), this.el.className = Zs, Object.entries(Ws).forEach(([t, e]) => {
1112
+ this.el = document.createElement("div"), this.el.className = Ws, Object.entries(Fs).forEach(([t, e]) => {
1116
1113
  this.el.style.setProperty(t, e);
1117
1114
  }), this.canvas.wrapperEl.appendChild(this.el);
1118
1115
  }
@@ -1132,7 +1129,7 @@ class be {
1132
1129
  return;
1133
1130
  }
1134
1131
  const s = e.angle || 0;
1135
- this.currentAngle = be._normalizeAngle(s), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
1132
+ this.currentAngle = Me._normalizeAngle(s), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
1136
1133
  }
1137
1134
  /**
1138
1135
  * Обработчик отпускания кнопки мыши
@@ -1163,9 +1160,9 @@ class be {
1163
1160
  */
1164
1161
  _positionIndicator(t) {
1165
1162
  const e = this.canvas.wrapperEl.getBoundingClientRect();
1166
- let s = t.clientX - e.left + Ge, o = t.clientY - e.top + Ve;
1163
+ let s = t.clientX - e.left + Fe, o = t.clientY - e.top + We;
1167
1164
  const n = this.el.getBoundingClientRect(), i = n.width, a = n.height;
1168
- s + i > e.width && (s = t.clientX - e.left - i - Ge), o + a > e.height && (o = t.clientY - e.top - a - Ve), this.el.style.left = `${s}px`, this.el.style.top = `${o}px`;
1165
+ s + i > e.width && (s = t.clientX - e.left - i - Fe), o + a > e.height && (o = t.clientY - e.top - a - We), this.el.style.left = `${s}px`, this.el.style.top = `${o}px`;
1169
1166
  }
1170
1167
  /**
1171
1168
  * Показать индикатор
@@ -1196,7 +1193,7 @@ class be {
1196
1193
  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;
1197
1194
  }
1198
1195
  }
1199
- const as = [
1196
+ const ss = [
1200
1197
  "selectable",
1201
1198
  "evented",
1202
1199
  "id",
@@ -1244,7 +1241,7 @@ class Jt {
1244
1241
  return this.patches[this.currentIndex - 1] || null;
1245
1242
  }
1246
1243
  _createDiffPatcher() {
1247
- this.diffPatcher = Ss({
1244
+ this.diffPatcher = Ms({
1248
1245
  objectHash(t) {
1249
1246
  const e = t, s = t, o = s.styles ? JSON.stringify(s.styles) : "";
1250
1247
  return [
@@ -1294,7 +1291,7 @@ class Jt {
1294
1291
  includeValueOnMove: !1
1295
1292
  },
1296
1293
  textDiff: {
1297
- diffMatchPatch: As,
1294
+ diffMatchPatch: ws,
1298
1295
  minLength: 60
1299
1296
  }
1300
1297
  });
@@ -1336,7 +1333,7 @@ class Jt {
1336
1333
  if (console.log("saveState"), this.skipHistory) return;
1337
1334
  console.time("saveState");
1338
1335
  const t = this._withTemporaryUnlock(
1339
- () => this.canvas.toDatalessObject([...as])
1336
+ () => this.canvas.toDatalessObject([...ss])
1340
1337
  );
1341
1338
  if (console.timeEnd("saveState"), !this.baseState) {
1342
1339
  this.baseState = t, this.patches = [], this.currentIndex = 0, console.log("Базовое состояние сохранено.");
@@ -1347,7 +1344,7 @@ class Jt {
1347
1344
  console.log("Нет изменений для сохранения.");
1348
1345
  return;
1349
1346
  }
1350
- console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", s), this.totalChangesCount += 1, this.patches.push({ id: Y(), diff: s }), this.currentIndex += 1, this.patches.length > this.maxHistoryLength && (this.baseState = this.diffPatcher.patch(this.baseState, this.patches[0].diff), this.patches.shift(), this.currentIndex -= 1, this.baseStateChangesCount += 1), console.log("Состояние сохранено. Текущий индекс истории:", this.currentIndex);
1347
+ console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", s), this.totalChangesCount += 1, this.patches.push({ id: G(), diff: s }), this.currentIndex += 1, this.patches.length > this.maxHistoryLength && (this.baseState = this.diffPatcher.patch(this.baseState, this.patches[0].diff), this.patches.shift(), this.currentIndex -= 1, this.baseStateChangesCount += 1), console.log("Состояние сохранено. Текущий индекс истории:", this.currentIndex);
1351
1348
  }
1352
1349
  /**
1353
1350
  * Сериализует customData объектов в строку. Это необходимо чтобы при вызове loadFromJSON fabricjs не пытался обрабатывать свойства внутри customData, как свойства FabricObject, если их названия совпадают с зарезервированными.
@@ -1380,7 +1377,7 @@ class Jt {
1380
1377
  * @fires editor:history-state-loaded
1381
1378
  */
1382
1379
  loadStateFromFullState(t) {
1383
- return _(this, null, function* () {
1380
+ return N(this, null, function* () {
1384
1381
  if (!t) return;
1385
1382
  console.log("loadStateFromFullState fullState", t);
1386
1383
  const { canvas: e, canvasManager: s, interactionBlocker: o, backgroundManager: n } = this.editor, { width: i, height: a } = e;
@@ -1407,7 +1404,7 @@ class Jt {
1407
1404
  * @fires editor:undo
1408
1405
  */
1409
1406
  undo() {
1410
- return _(this, null, function* () {
1407
+ return N(this, null, function* () {
1411
1408
  if (!this.skipHistory) {
1412
1409
  if (this.currentIndex <= 0) {
1413
1410
  console.log("Нет предыдущих состояний для отмены.");
@@ -1444,7 +1441,7 @@ class Jt {
1444
1441
  * @fires editor:redo
1445
1442
  */
1446
1443
  redo() {
1447
- return _(this, null, function* () {
1444
+ return N(this, null, function* () {
1448
1445
  if (!this.skipHistory) {
1449
1446
  if (this.currentIndex >= this.patches.length) {
1450
1447
  console.log("Нет состояний для повтора.");
@@ -1499,7 +1496,7 @@ class Jt {
1499
1496
  }
1500
1497
  }
1501
1498
  }
1502
- const Gs = 0.1, Vs = 2, Xe = 0.1, Xs = 90, Dt = 16, Lt = 16, pt = 4096, mt = 4096, Ke = "application/image-editor:", Kt = [
1499
+ const Hs = 0.1, Zs = 2, He = 0.1, Gs = 90, Rt = 16, _t = 16, Mt = 4096, wt = 4096, Ze = "application/image-editor:", Xt = [
1503
1500
  "format",
1504
1501
  "uppercase",
1505
1502
  "textCaseRaw",
@@ -1513,8 +1510,8 @@ const Gs = 0.1, Vs = 2, Xe = 0.1, Xs = 90, Dt = 16, Lt = 16, pt = 4096, mt = 409
1513
1510
  "radiusTopRight",
1514
1511
  "radiusBottomRight",
1515
1512
  "radiusBottomLeft"
1516
- ], Ks = 50;
1517
- class rt {
1513
+ ], Vs = 50;
1514
+ class ct {
1518
1515
  constructor({ editor: t }) {
1519
1516
  this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
1520
1517
  }
@@ -1531,7 +1528,7 @@ class rt {
1531
1528
  * @returns возвращает Promise с объектом изображения или null в случае ошибки
1532
1529
  */
1533
1530
  importImage(t) {
1534
- return _(this, null, function* () {
1531
+ return N(this, null, function* () {
1535
1532
  const {
1536
1533
  source: e,
1537
1534
  scale: s = `image-${this.options.scaleType}`,
@@ -1541,7 +1538,7 @@ class rt {
1541
1538
  withoutSelection: a = !1
1542
1539
  } = t;
1543
1540
  if (!e) return null;
1544
- const { canvas: r, montageArea: c, transformManager: d, historyManager: l, errorManager: u } = this.editor, g = yield this.getContentType(e), f = rt.getFormatFromContentType(g), { acceptContentTypes: p, acceptFormats: m } = this;
1541
+ const { canvas: r, montageArea: c, transformManager: d, historyManager: l, errorManager: u } = this.editor, g = yield this.getContentType(e), f = ct.getFormatFromContentType(g), { acceptContentTypes: p, acceptFormats: m } = this;
1545
1542
  if (!this.isAllowedContentType(g)) {
1546
1543
  const v = `Неверный contentType для изображения: ${g}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1547
1544
  return u.emitError({
@@ -1567,8 +1564,8 @@ class rt {
1567
1564
  if (e instanceof File)
1568
1565
  v = URL.createObjectURL(e);
1569
1566
  else if (typeof e == "string") {
1570
- const A = yield (yield fetch(e, { mode: "cors" })).blob();
1571
- v = URL.createObjectURL(A);
1567
+ const j = yield (yield fetch(e, { mode: "cors" })).blob();
1568
+ v = URL.createObjectURL(j);
1572
1569
  } else
1573
1570
  return u.emitError({
1574
1571
  origin: "ImageManager",
@@ -1587,27 +1584,27 @@ class rt {
1587
1584
  }
1588
1585
  }), null;
1589
1586
  if (this._createdBlobUrls.push(v), f === "svg") {
1590
- const S = yield fs(v);
1591
- b = ct.groupSVGElements(S.objects, S.options);
1587
+ const A = yield us(v);
1588
+ b = dt.groupSVGElements(A.objects, A.options);
1592
1589
  } else
1593
- b = yield Bt.fromURL(v, { crossOrigin: "anonymous" });
1590
+ b = yield zt.fromURL(v, { crossOrigin: "anonymous" });
1594
1591
  const { width: I, height: y } = b;
1595
- if (b instanceof Bt) {
1596
- const S = b.getElement();
1597
- let A = "";
1598
- if (S instanceof HTMLImageElement ? A = S.src : S instanceof HTMLCanvasElement && (A = S.toDataURL()), y > mt || I > pt) {
1599
- const M = yield this.resizeImageToBoundaries(A, "max"), C = URL.createObjectURL(M);
1600
- this._createdBlobUrls.push(C), b = yield Bt.fromURL(C, { crossOrigin: "anonymous" });
1601
- } else if (y < Lt || I < Dt) {
1602
- const M = yield this.resizeImageToBoundaries(A, "min"), C = URL.createObjectURL(M);
1603
- this._createdBlobUrls.push(C), b = yield Bt.fromURL(C, { crossOrigin: "anonymous" });
1592
+ if (b instanceof zt) {
1593
+ const A = b.getElement();
1594
+ let j = "";
1595
+ if (A instanceof HTMLImageElement ? j = A.src : A instanceof HTMLCanvasElement && (j = A.toDataURL()), y > wt || I > Mt) {
1596
+ const M = yield this.resizeImageToBoundaries(j, "max"), T = URL.createObjectURL(M);
1597
+ this._createdBlobUrls.push(T), b = yield zt.fromURL(T, { crossOrigin: "anonymous" });
1598
+ } else if (y < _t || I < Rt) {
1599
+ const M = yield this.resizeImageToBoundaries(j, "min"), T = URL.createObjectURL(M);
1600
+ this._createdBlobUrls.push(T), b = yield zt.fromURL(T, { crossOrigin: "anonymous" });
1604
1601
  }
1605
1602
  }
1606
- if (b.set("id", `${b.type}-${Y()}`), b.set("format", f), s === "scale-montage")
1603
+ if (b.set("id", `${b.type}-${G()}`), b.set("format", f), s === "scale-montage")
1607
1604
  this.editor.canvasManager.scaleMontageAreaToImage({ object: b, withoutSave: !0 });
1608
1605
  else {
1609
- const { width: S, height: A } = c, M = this.calculateScaleFactor({ imageObject: b, scaleType: s });
1610
- s === "image-contain" && M < 1 ? d.fitObject({ object: b, type: "contain", withoutSave: !0 }) : s === "image-cover" && (I > S || y > A) && d.fitObject({ object: b, type: "cover", withoutSave: !0 });
1606
+ const { width: A, height: j } = c, M = this.calculateScaleFactor({ imageObject: b, scaleType: s });
1607
+ s === "image-contain" && M < 1 ? d.fitObject({ object: b, type: "contain", withoutSave: !0 }) : s === "image-cover" && (I > A || y > j) && d.fitObject({ object: b, type: "cover", withoutSave: !0 });
1611
1608
  }
1612
1609
  r.add(b), r.centerObject(b), a || r.setActiveObject(b), r.renderAll(), l.resumeHistory(), o || l.saveState();
1613
1610
  const w = {
@@ -1651,16 +1648,16 @@ class rt {
1651
1648
  * @returns возвращает Promise с Blob-объектом уменьшенного изображения
1652
1649
  */
1653
1650
  resizeImageToBoundaries(t, e = "max") {
1654
- return _(this, null, function* () {
1655
- let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${pt}x${mt}`;
1656
- e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${Dt}x${Lt}`);
1651
+ return N(this, null, function* () {
1652
+ let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${Mt}x${wt}`;
1653
+ e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${Rt}x${_t}`);
1657
1654
  const o = {
1658
1655
  dataURL: t,
1659
1656
  sizeType: e,
1660
- maxWidth: pt,
1661
- maxHeight: mt,
1662
- minWidth: Dt,
1663
- minHeight: Lt
1657
+ maxWidth: Mt,
1658
+ maxHeight: wt,
1659
+ minWidth: Rt,
1660
+ minHeight: _t
1664
1661
  };
1665
1662
  return this.editor.errorManager.emitWarning({
1666
1663
  origin: "ImageManager",
@@ -1683,7 +1680,7 @@ class rt {
1683
1680
  * @fires editor:canvas-exported
1684
1681
  */
1685
1682
  exportCanvasAsImageFile() {
1686
- return _(this, arguments, function* (t = {}) {
1683
+ return N(this, arguments, function* (t = {}) {
1687
1684
  const {
1688
1685
  fileName: e = "image.png",
1689
1686
  contentType: s = "image/png",
@@ -1691,22 +1688,22 @@ class rt {
1691
1688
  exportAsBlob: n = !1
1692
1689
  } = t, { canvas: i, montageArea: a, workerManager: r, interactionBlocker: c } = this.editor;
1693
1690
  try {
1694
- const d = s === "application/pdf", l = d ? "image/jpg" : s, u = rt.getFormatFromContentType(l);
1691
+ const d = s === "application/pdf", l = d ? "image/jpg" : s, u = ct.getFormatFromContentType(l);
1695
1692
  a.setCoords();
1696
1693
  const { left: g, top: f, width: p, height: m } = a.getBoundingRect(), v = yield i.clone(["id", "format", "locked"]);
1697
1694
  v.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(l) && (v.backgroundColor = "#ffffff");
1698
- const b = v.getObjects().find((j) => j.id === a.id);
1695
+ const b = v.getObjects().find((S) => S.id === a.id);
1699
1696
  if (b && (b.visible = !1), c != null && c.isBlocked) {
1700
- const j = v.getObjects().find((T) => T.id === c.overlayMask.id);
1701
- j && (j.visible = !1);
1697
+ const S = v.getObjects().find((C) => C.id === c.overlayMask.id);
1698
+ S && (S.visible = !1);
1702
1699
  }
1703
1700
  v.viewportTransform = [1, 0, 0, 1, -g, -f], v.setDimensions({ width: p, height: m }, { backstoreOnly: !0 }), v.renderAll();
1704
- const I = v.getObjects().filter((j) => j.format).every((j) => j.format === "svg");
1701
+ const I = v.getObjects().filter((S) => S.format).every((S) => S.format === "svg");
1705
1702
  if (u === "svg" && I) {
1706
- const j = v.toSVG();
1703
+ const S = v.toSVG();
1707
1704
  v.dispose();
1708
- const B = {
1709
- image: rt._exportSVGStringAsFile(j, {
1705
+ const x = {
1706
+ image: ct._exportSVGStringAsFile(S, {
1710
1707
  exportAsBase64: o,
1711
1708
  exportAsBlob: n,
1712
1709
  fileName: e
@@ -1715,66 +1712,66 @@ class rt {
1715
1712
  contentType: "image/svg+xml",
1716
1713
  fileName: e.replace(/\.[^/.]+$/, ".svg")
1717
1714
  };
1718
- return i.fire("editor:canvas-exported", B), B;
1715
+ return i.fire("editor:canvas-exported", x), x;
1719
1716
  }
1720
- const y = yield new Promise((j, T) => {
1721
- v.getElement().toBlob((B) => {
1722
- B ? j(B) : T(new Error("Failed to create Blob from canvas"));
1717
+ const y = yield new Promise((S, C) => {
1718
+ v.getElement().toBlob((x) => {
1719
+ x ? S(x) : C(new Error("Failed to create Blob from canvas"));
1723
1720
  });
1724
1721
  });
1725
1722
  if (v.dispose(), n) {
1726
- const j = {
1723
+ const S = {
1727
1724
  image: y,
1728
1725
  format: u,
1729
1726
  contentType: l,
1730
1727
  fileName: e
1731
1728
  };
1732
- return i.fire("editor:canvas-exported", j), j;
1729
+ return i.fire("editor:canvas-exported", S), S;
1733
1730
  }
1734
- const w = yield createImageBitmap(y), S = yield r.post(
1731
+ const w = yield createImageBitmap(y), A = yield r.post(
1735
1732
  "toDataURL",
1736
1733
  { format: u, quality: 1, bitmap: w },
1737
1734
  [w]
1738
1735
  );
1739
1736
  if (d) {
1740
- const T = p * 0.264583, B = m * 0.264583, Z = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, U = new Z({
1741
- orientation: T > B ? "landscape" : "portrait",
1737
+ const C = p * 0.264583, x = m * 0.264583, F = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, U = new F({
1738
+ orientation: C > x ? "landscape" : "portrait",
1742
1739
  unit: "mm",
1743
- format: [T, B]
1740
+ format: [C, x]
1744
1741
  });
1745
- if (U.addImage(String(S), "JPG", 0, 0, T, B), o) {
1746
- const K = {
1742
+ if (U.addImage(String(A), "JPG", 0, 0, C, x), o) {
1743
+ const z = {
1747
1744
  image: U.output("datauristring"),
1748
1745
  format: "pdf",
1749
1746
  contentType: "application/pdf",
1750
1747
  fileName: e
1751
1748
  };
1752
- return i.fire("editor:canvas-exported", K), K;
1749
+ return i.fire("editor:canvas-exported", z), z;
1753
1750
  }
1754
- const F = U.output("blob"), D = {
1755
- image: new File([F], e, { type: "application/pdf" }),
1751
+ const W = U.output("blob"), L = {
1752
+ image: new File([W], e, { type: "application/pdf" }),
1756
1753
  format: "pdf",
1757
1754
  contentType: "application/pdf",
1758
1755
  fileName: e
1759
1756
  };
1760
- return i.fire("editor:canvas-exported", D), D;
1757
+ return i.fire("editor:canvas-exported", L), L;
1761
1758
  }
1762
1759
  if (o) {
1763
- const j = {
1764
- image: S,
1760
+ const S = {
1761
+ image: A,
1765
1762
  format: u,
1766
1763
  contentType: l,
1767
1764
  fileName: e
1768
1765
  };
1769
- return i.fire("editor:canvas-exported", j), j;
1766
+ return i.fire("editor:canvas-exported", S), S;
1770
1767
  }
1771
- const A = u === "svg" && !I ? e.replace(/\.[^/.]+$/, ".png") : e, C = {
1772
- image: new File([y], A, { type: l }),
1768
+ const j = u === "svg" && !I ? e.replace(/\.[^/.]+$/, ".png") : e, T = {
1769
+ image: new File([y], j, { type: l }),
1773
1770
  format: u,
1774
1771
  contentType: l,
1775
- fileName: A
1772
+ fileName: j
1776
1773
  };
1777
- return i.fire("editor:canvas-exported", C), C;
1774
+ return i.fire("editor:canvas-exported", T), T;
1778
1775
  } catch (d) {
1779
1776
  return this.editor.errorManager.emitError({
1780
1777
  origin: "ImageManager",
@@ -1798,7 +1795,7 @@ class rt {
1798
1795
  * @fires editor:object-exported
1799
1796
  */
1800
1797
  exportObjectAsImageFile() {
1801
- return _(this, arguments, function* (t = {}) {
1798
+ return N(this, arguments, function* (t = {}) {
1802
1799
  const {
1803
1800
  object: e,
1804
1801
  fileName: s = "image.png",
@@ -1815,9 +1812,9 @@ class rt {
1815
1812
  data: { contentType: o, fileName: s, exportAsBase64: n, exportAsBlob: i }
1816
1813
  }), null;
1817
1814
  try {
1818
- const d = rt.getFormatFromContentType(o);
1815
+ const d = ct.getFormatFromContentType(o);
1819
1816
  if (d === "svg") {
1820
- const p = c.toSVG(), m = rt._exportSVGStringAsFile(p, {
1817
+ const p = c.toSVG(), m = ct._exportSVGStringAsFile(p, {
1821
1818
  exportAsBase64: n,
1822
1819
  exportAsBlob: i,
1823
1820
  fileName: s
@@ -1830,7 +1827,7 @@ class rt {
1830
1827
  };
1831
1828
  return a.fire("editor:object-exported", v), v;
1832
1829
  }
1833
- if (n && c instanceof Bt) {
1830
+ if (n && c instanceof zt) {
1834
1831
  const p = yield createImageBitmap(c.getElement()), m = yield r.post(
1835
1832
  "toDataURL",
1836
1833
  {
@@ -1895,7 +1892,7 @@ class rt {
1895
1892
  * @returns массив допустимых форматов изображений
1896
1893
  */
1897
1894
  getAllowedFormatsFromContentTypes() {
1898
- return this.acceptContentTypes.map((t) => rt.getFormatFromContentType(t)).filter((t) => t);
1895
+ return this.acceptContentTypes.map((t) => ct.getFormatFromContentType(t)).filter((t) => t);
1899
1896
  }
1900
1897
  /**
1901
1898
  * Проверяет, является ли contentType допустимым типом изображения.
@@ -1911,7 +1908,7 @@ class rt {
1911
1908
  * @public
1912
1909
  */
1913
1910
  getContentType(t) {
1914
- return _(this, null, function* () {
1911
+ return N(this, null, function* () {
1915
1912
  return typeof t == "string" ? this.getContentTypeFromUrl(t) : t.type || "application/octet-stream";
1916
1913
  });
1917
1914
  }
@@ -1922,7 +1919,7 @@ class rt {
1922
1919
  * @public
1923
1920
  */
1924
1921
  getContentTypeFromUrl(t) {
1925
- return _(this, null, function* () {
1922
+ return N(this, null, function* () {
1926
1923
  if (t.startsWith("data:")) {
1927
1924
  const e = t.match(/^data:([^;]+)/);
1928
1925
  return e ? e[1] : "application/octet-stream";
@@ -1948,7 +1945,7 @@ class rt {
1948
1945
  try {
1949
1946
  const o = (e = new URL(t).pathname.split(".").pop()) == null ? void 0 : e.toLowerCase(), n = {};
1950
1947
  return this.acceptContentTypes.forEach((i) => {
1951
- const a = rt.getFormatFromContentType(i);
1948
+ const a = ct.getFormatFromContentType(i);
1952
1949
  a && (n[a] = i);
1953
1950
  }), o && n[o] || "application/octet-stream";
1954
1951
  } catch (s) {
@@ -2001,11 +1998,11 @@ class rt {
2001
1998
  return e ? e[1] : "";
2002
1999
  }
2003
2000
  }
2004
- const It = (h, t, e) => Math.max(Math.min(h, e), t), Qe = (h, t) => h * t, Qs = (h, t) => new J(h / 2, t / 2);
2005
- function qs(h) {
2001
+ const Tt = (h, t, e) => Math.max(Math.min(h, e), t), Ge = (h, t) => h * t, Xs = (h, t) => new tt(h / 2, t / 2);
2002
+ function Ks(h) {
2006
2003
  return ((h == null ? void 0 : h.type) === "image" || (h == null ? void 0 : h.format) === "svg") && typeof (h == null ? void 0 : h.width) == "number" && typeof (h == null ? void 0 : h.height) == "number";
2007
2004
  }
2008
- class $s {
2005
+ class Qs {
2009
2006
  /**
2010
2007
  * @param options
2011
2008
  * @param options.editor – экземпляр редактора
@@ -2036,9 +2033,9 @@ class $s {
2036
2033
  canvas: n,
2037
2034
  montageArea: i,
2038
2035
  options: { canvasBackstoreWidth: a }
2039
- } = this.editor, { width: r, height: c } = i, d = It(Number(t), Dt, pt);
2036
+ } = this.editor, { width: r, height: c } = i, d = Tt(Number(t), Rt, Mt);
2040
2037
  if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(d), i.set({ width: d }), (f = n.clipPath) == null || f.set({ width: d }), e) {
2041
- const p = d / r, m = Qe(c, p);
2038
+ const p = d / r, m = Ge(c, p);
2042
2039
  this.setResolutionHeight(m);
2043
2040
  return;
2044
2041
  }
@@ -2066,9 +2063,9 @@ class $s {
2066
2063
  canvas: n,
2067
2064
  montageArea: i,
2068
2065
  options: { canvasBackstoreHeight: a }
2069
- } = this.editor, { width: r, height: c } = i, d = It(Number(t), Lt, mt);
2066
+ } = this.editor, { width: r, height: c } = i, d = Tt(Number(t), _t, wt);
2070
2067
  if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(d), i.set({ height: d }), (f = n.clipPath) == null || f.set({ height: d }), e) {
2071
- const p = d / c, m = Qe(r, p);
2068
+ const p = d / c, m = Ge(r, p);
2072
2069
  this.setResolutionWidth(m);
2073
2070
  return;
2074
2071
  }
@@ -2086,7 +2083,7 @@ class $s {
2086
2083
  */
2087
2084
  centerMontageArea() {
2088
2085
  var r;
2089
- const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(), n = t.getZoom(), i = Qs(s, o);
2086
+ const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(), n = t.getZoom(), i = Xs(s, o);
2090
2087
  e.set({
2091
2088
  left: s / 2,
2092
2089
  top: o / 2
@@ -2119,7 +2116,7 @@ class $s {
2119
2116
  */
2120
2117
  setCanvasBackstoreWidth(t) {
2121
2118
  if (!t || typeof t != "number") return;
2122
- const e = It(t, Dt, pt);
2119
+ const e = Tt(t, Rt, Mt);
2123
2120
  this.editor.canvas.setDimensions({ width: e }, { backstoreOnly: !0 });
2124
2121
  }
2125
2122
  /**
@@ -2128,7 +2125,7 @@ class $s {
2128
2125
  */
2129
2126
  setCanvasBackstoreHeight(t) {
2130
2127
  if (!t || typeof t != "number") return;
2131
- const e = It(t, Lt, mt);
2128
+ const e = Tt(t, _t, wt);
2132
2129
  this.editor.canvas.setDimensions({ height: e }, { backstoreOnly: !0 });
2133
2130
  }
2134
2131
  /**
@@ -2137,7 +2134,7 @@ class $s {
2137
2134
  * с учётом минимальных и максимальных значений.
2138
2135
  */
2139
2136
  adaptCanvasToContainer() {
2140
- const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, o = e.clientHeight, n = It(s, Dt, pt), i = It(o, Lt, mt);
2137
+ const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, o = e.clientHeight, n = Tt(s, Rt, Mt), i = Tt(o, _t, wt);
2141
2138
  t.setDimensions({ width: n, height: i }, { backstoreOnly: !0 });
2142
2139
  }
2143
2140
  /**
@@ -2171,7 +2168,7 @@ class $s {
2171
2168
  if (d.length === 1)
2172
2169
  t.setActiveObject(d[0]);
2173
2170
  else {
2174
- const l = new x(d, {
2171
+ const l = new k(d, {
2175
2172
  canvas: t
2176
2173
  });
2177
2174
  t.setActiveObject(l);
@@ -2337,9 +2334,9 @@ class $s {
2337
2334
  montageAreaHeight: r
2338
2335
  }
2339
2336
  } = this.editor, c = t || o.getActiveObject();
2340
- if (!qs(c)) return;
2337
+ if (!Ks(c)) return;
2341
2338
  const { width: d, height: l } = c;
2342
- let u = Math.min(d, pt), g = Math.min(l, mt);
2339
+ let u = Math.min(d, Mt), g = Math.min(l, wt);
2343
2340
  if (e) {
2344
2341
  const {
2345
2342
  width: f,
@@ -2397,7 +2394,7 @@ class $s {
2397
2394
  );
2398
2395
  }
2399
2396
  }
2400
- class Js {
2397
+ class qs {
2401
2398
  constructor({ editor: t }) {
2402
2399
  this.editor = t, this.options = t.options;
2403
2400
  }
@@ -2408,7 +2405,7 @@ class Js {
2408
2405
  * @param options.withoutSave - Не сохранять состояние
2409
2406
  * @fires editor:object-rotated
2410
2407
  */
2411
- rotate(t = Xs, { withoutSave: e } = {}) {
2408
+ rotate(t = Gs, { withoutSave: e } = {}) {
2412
2409
  const { canvas: s, historyManager: o } = this.editor, n = s.getActiveObject();
2413
2410
  if (!n) return;
2414
2411
  const i = n.angle + t;
@@ -2458,7 +2455,7 @@ class Js {
2458
2455
  withoutSave: s
2459
2456
  } = {}) {
2460
2457
  const { canvas: o, historyManager: n } = this.editor, i = t || o.getActiveObject();
2461
- i && (i instanceof x ? i.getObjects().forEach((a) => {
2458
+ i && (i instanceof k ? i.getObjects().forEach((a) => {
2462
2459
  a.set("opacity", e);
2463
2460
  }) : i.set("opacity", e), o.renderAll(), s || n.saveState(), o.fire("editor:object-opacity-changed", {
2464
2461
  object: i,
@@ -2485,12 +2482,12 @@ class Js {
2485
2482
  } = {}) {
2486
2483
  const { canvas: n, historyManager: i } = this.editor, a = t || n.getActiveObject();
2487
2484
  if (a) {
2488
- if (a instanceof x && !o) {
2485
+ if (a instanceof k && !o) {
2489
2486
  const r = a.getObjects();
2490
2487
  n.discardActiveObject(), r.forEach((d) => {
2491
2488
  this._fitSingleObject(d, e);
2492
2489
  });
2493
- const c = new x(r, { canvas: n });
2490
+ const c = new k(r, { canvas: n });
2494
2491
  n.setActiveObject(c);
2495
2492
  } else
2496
2493
  this._fitSingleObject(a, e);
@@ -2563,9 +2560,9 @@ class Js {
2563
2560
  });
2564
2561
  }
2565
2562
  }
2566
- class to {
2563
+ class Js {
2567
2564
  constructor({ editor: t }) {
2568
- this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || Gs, this.maxZoom = this.options.maxZoom || Vs, this.defaultZoom = this.options.defaultScale;
2565
+ this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || Hs, this.maxZoom = this.options.maxZoom || Zs, this.defaultZoom = this.options.defaultScale;
2569
2566
  }
2570
2567
  /**
2571
2568
  * Вспомогательный метод для вычисления размеров масштабированной монтажной области
@@ -2624,8 +2621,8 @@ class to {
2624
2621
  _calculateEmptySpaceRatio(t) {
2625
2622
  const { canvas: e, montageArea: s } = this.editor, o = e.viewportTransform, n = e.getWidth(), i = e.getHeight(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, l = -o[4] / t, u = (-o[4] + n) / t, g = -o[5] / t, f = (-o[5] + i) / t, p = l < a, m = u > r, v = g < c, b = f > d;
2626
2623
  if (!(p || m || v || b)) return 0;
2627
- const y = Math.max(0, a - l), w = Math.max(0, u - r), S = Math.max(0, c - g), A = Math.max(0, f - d), M = Math.max(y, w), C = Math.max(S, A), j = M / n, T = C / i;
2628
- return Math.max(j, T);
2624
+ const y = Math.max(0, a - l), w = Math.max(0, u - r), A = Math.max(0, c - g), j = Math.max(0, f - d), M = Math.max(y, w), T = Math.max(A, j), S = M / n, C = T / i;
2625
+ return Math.max(S, C);
2629
2626
  }
2630
2627
  /**
2631
2628
  * Вычисляет плавный шаг перемещения viewport к центру с ускорением
@@ -2641,8 +2638,8 @@ class to {
2641
2638
  const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), d = i.getHeight(), l = t.x - r[4], u = t.y - r[5], g = Math.abs(o), f = e - s;
2642
2639
  if (Math.abs(f) / g <= 0.1)
2643
2640
  return { x: l, y: u };
2644
- const m = c / 2, v = d / 2, b = a.left, I = a.top, y = m - b * s, w = v - I * s, S = (y - r[4]) / (e - s), A = (w - r[5]) / (e - s), M = S * g, C = A * g, j = M * n, T = C * n, B = Math.abs(j) > Math.abs(l) ? l : j, Z = Math.abs(T) > Math.abs(u) ? u : T;
2645
- return { x: B, y: Z };
2641
+ const m = c / 2, v = d / 2, b = a.left, I = a.top, y = m - b * s, w = v - I * s, A = (y - r[4]) / (e - s), j = (w - r[5]) / (e - s), M = A * g, T = j * g, S = M * n, C = T * n, x = Math.abs(S) > Math.abs(l) ? l : S, F = Math.abs(C) > Math.abs(u) ? u : C;
2642
+ return { x, y: F };
2646
2643
  }
2647
2644
  /**
2648
2645
  * Применяет плавное центрирование viewport при приближении к defaultZoom.
@@ -2654,7 +2651,7 @@ class to {
2654
2651
  * @returns true если центрирование было применено
2655
2652
  * @private
2656
2653
  */
2657
- _applyViewportCentering(t, e = !1, s = Xe) {
2654
+ _applyViewportCentering(t, e = !1, s = He) {
2658
2655
  const { canvas: o } = this.editor, n = this._getScaledMontageDimensions(t), i = o.getWidth(), a = o.getHeight(), r = n.width > i || n.height > a, c = this._calculateFitZoom(), d = t - c;
2659
2656
  if (!(!r || d) && !e)
2660
2657
  return !1;
@@ -2729,10 +2726,10 @@ class to {
2729
2726
  * @param options.pointY - Координата Y точки зума
2730
2727
  * @fires editor:zoom-changed
2731
2728
  */
2732
- zoom(t = Xe, e = {}) {
2729
+ zoom(t = He, e = {}) {
2733
2730
  var g, f;
2734
2731
  if (!t) return;
2735
- const { minZoom: s, maxZoom: o } = this, { canvas: n } = this.editor, i = t < 0, a = n.getZoom(), r = n.getCenterPoint(), c = (g = e.pointX) != null ? g : r.x, d = (f = e.pointY) != null ? f : r.y, l = new J(c, d);
2732
+ const { minZoom: s, maxZoom: o } = this, { canvas: n } = this.editor, i = t < 0, a = n.getZoom(), r = n.getCenterPoint(), c = (g = e.pointX) != null ? g : r.x, d = (f = e.pointY) != null ? f : r.y, l = new tt(c, d);
2736
2733
  this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
2737
2734
  let u = Number((a + Number(t)).toFixed(3));
2738
2735
  u > o && (u = o), u < s && (u = s), n.zoomToPoint(l, u), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(u, i, t), n.fire("editor:zoom-changed", {
@@ -2747,7 +2744,7 @@ class to {
2747
2744
  * @fires editor:zoom-changed
2748
2745
  */
2749
2746
  setZoom(t = this.defaultZoom) {
2750
- const { minZoom: e, maxZoom: s } = this, { canvas: o } = this.editor, n = new J(o.getCenterPoint());
2747
+ const { minZoom: e, maxZoom: s } = this, { canvas: o } = this.editor, n = new tt(o.getCenterPoint());
2751
2748
  let i = t;
2752
2749
  t > s && (i = s), t < e && (i = e), o.zoomToPoint(n, i), o.fire("editor:zoom-changed", {
2753
2750
  currentZoom: o.getZoom(),
@@ -2760,14 +2757,14 @@ class to {
2760
2757
  * @fires editor:zoom-changed
2761
2758
  */
2762
2759
  resetZoom() {
2763
- const { canvas: t } = this.editor, e = new J(t.getCenterPoint());
2760
+ const { canvas: t } = this.editor, e = new tt(t.getCenterPoint());
2764
2761
  t.zoomToPoint(e, this.defaultZoom), this.editor.canvas.fire("editor:zoom-changed", {
2765
2762
  currentZoom: t.getZoom(),
2766
2763
  point: e
2767
2764
  }), this.editor.panConstraintManager.updateBounds();
2768
2765
  }
2769
2766
  }
2770
- class eo {
2767
+ class $s {
2771
2768
  constructor({ editor: t }) {
2772
2769
  this.editor = t, this.isBlocked = !1, this.overlayMask = null, this._createOverlay();
2773
2770
  }
@@ -2824,7 +2821,7 @@ class eo {
2824
2821
  }), t.upperCanvasEl.style.pointerEvents = "", t.lowerCanvasEl.style.pointerEvents = "", this.overlayMask.visible = !1, t.requestRenderAll(), t.fire("editor:enabled"), s.resumeHistory();
2825
2822
  }
2826
2823
  }
2827
- class Tt {
2824
+ class Ot {
2828
2825
  constructor({ editor: t }) {
2829
2826
  this.editor = t, this.backgroundObject = null;
2830
2827
  }
@@ -2849,7 +2846,7 @@ class Tt {
2849
2846
  }
2850
2847
  i.set({
2851
2848
  fill: t,
2852
- backgroundId: `background-${Y()}`
2849
+ backgroundId: `background-${G()}`
2853
2850
  }), this.editor.canvas.requestRenderAll();
2854
2851
  } else
2855
2852
  this._removeCurrentBackground(), this._createColorBackground(t);
@@ -2879,14 +2876,14 @@ class Tt {
2879
2876
  try {
2880
2877
  const { historyManager: n } = this.editor, { backgroundObject: i } = this;
2881
2878
  if (n.suspendHistory(), i && i.backgroundType === "gradient") {
2882
- const a = Tt._createFabricGradient(t);
2883
- if (Tt._isGradientEqual(i.fill, a)) {
2879
+ const a = Ot._createFabricGradient(t);
2880
+ if (Ot._isGradientEqual(i.fill, a)) {
2884
2881
  n.resumeHistory();
2885
2882
  return;
2886
2883
  }
2887
2884
  i.set({
2888
2885
  fill: a,
2889
- backgroundId: `background-${Y()}`
2886
+ backgroundId: `background-${G()}`
2890
2887
  }), this.editor.canvas.requestRenderAll();
2891
2888
  } else
2892
2889
  this._removeCurrentBackground(), this._createGradientBackground(t);
@@ -2967,7 +2964,7 @@ class Tt {
2967
2964
  * @param options.withoutSave - Если true, не сохранять состояние в историю
2968
2965
  */
2969
2966
  setImageBackground(o) {
2970
- return _(this, arguments, function* ({
2967
+ return N(this, arguments, function* ({
2971
2968
  imageSource: t,
2972
2969
  customData: e = {},
2973
2970
  withoutSave: s = !1
@@ -3033,7 +3030,7 @@ class Tt {
3033
3030
  hasControls: !1,
3034
3031
  id: "background",
3035
3032
  backgroundType: "color",
3036
- backgroundId: `background-${Y()}`
3033
+ backgroundId: `background-${G()}`
3037
3034
  }, { withoutSelection: !0 }), this.refresh();
3038
3035
  }
3039
3036
  /**
@@ -3050,9 +3047,9 @@ class Tt {
3050
3047
  hasControls: !1,
3051
3048
  id: "background",
3052
3049
  backgroundType: "gradient",
3053
- backgroundId: `background-${Y()}`
3050
+ backgroundId: `background-${G()}`
3054
3051
  }, { withoutSelection: !0 }), this.refresh();
3055
- const e = Tt._createFabricGradient(t);
3052
+ const e = Ot._createFabricGradient(t);
3056
3053
  this.backgroundObject.set("fill", e), this.editor.canvas.requestRenderAll();
3057
3054
  }
3058
3055
  /**
@@ -3060,7 +3057,7 @@ class Tt {
3060
3057
  * @param source - источник изображения (URL или File)
3061
3058
  */
3062
3059
  _createImageBackground(t, e) {
3063
- return _(this, null, function* () {
3060
+ return N(this, null, function* () {
3064
3061
  var o;
3065
3062
  const { image: s } = (o = yield this.editor.imageManager.importImage({
3066
3063
  source: t,
@@ -3078,7 +3075,7 @@ class Tt {
3078
3075
  hasControls: !1,
3079
3076
  id: "background",
3080
3077
  backgroundType: "image",
3081
- backgroundId: `background-${Y()}`,
3078
+ backgroundId: `background-${G()}`,
3082
3079
  customData: e
3083
3080
  }), this._removeCurrentBackground(), this.backgroundObject = s, this.refresh();
3084
3081
  });
@@ -3104,8 +3101,8 @@ class Tt {
3104
3101
  { offset: n / 100, color: s }
3105
3102
  ];
3106
3103
  if (t.type === "linear") {
3107
- const l = t.angle * Math.PI / 180, u = Tt._angleToCoords(l);
3108
- return new Fe({
3104
+ const l = t.angle * Math.PI / 180, u = Ot._angleToCoords(l);
3105
+ return new ze({
3109
3106
  type: "linear",
3110
3107
  gradientUnits: "percentage",
3111
3108
  coords: u,
@@ -3124,7 +3121,7 @@ class Tt {
3124
3121
  r1: 0,
3125
3122
  r2: c / 100
3126
3123
  };
3127
- return new Fe({
3124
+ return new ze({
3128
3125
  type: "radial",
3129
3126
  gradientUnits: "percentage",
3130
3127
  coords: d,
@@ -3159,7 +3156,7 @@ class Tt {
3159
3156
  }) ? !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;
3160
3157
  }
3161
3158
  }
3162
- class te {
3159
+ class $t {
3163
3160
  constructor({ editor: t }) {
3164
3161
  this.editor = t;
3165
3162
  }
@@ -3174,7 +3171,7 @@ class te {
3174
3171
  const { canvas: s, historyManager: o } = this.editor;
3175
3172
  o.suspendHistory();
3176
3173
  const n = t || s.getActiveObject();
3177
- n && (n instanceof x ? n.getObjects().forEach((i) => {
3174
+ n && (n instanceof k ? n.getObjects().forEach((i) => {
3178
3175
  s.bringObjectToFront(i);
3179
3176
  }) : s.bringObjectToFront(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-to-front", {
3180
3177
  object: n,
@@ -3192,7 +3189,7 @@ class te {
3192
3189
  const { canvas: s, historyManager: o } = this.editor;
3193
3190
  o.suspendHistory();
3194
3191
  const n = t || s.getActiveObject();
3195
- n && (n instanceof x ? te._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
3192
+ n && (n instanceof k ? $t._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
3196
3193
  object: n,
3197
3194
  withoutSave: e
3198
3195
  }));
@@ -3215,7 +3212,7 @@ class te {
3215
3212
  n.suspendHistory();
3216
3213
  const r = t || s.getActiveObject();
3217
3214
  if (r) {
3218
- if (r instanceof x) {
3215
+ if (r instanceof k) {
3219
3216
  const c = r.getObjects();
3220
3217
  for (let d = c.length - 1; d >= 0; d -= 1)
3221
3218
  s.sendObjectToBack(c[d]);
@@ -3243,7 +3240,7 @@ class te {
3243
3240
  } = this.editor;
3244
3241
  n.suspendHistory();
3245
3242
  const r = t || s.getActiveObject();
3246
- r && (r instanceof x ? te._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(o), i && s.sendObjectToBack(i), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-send-backwards", {
3243
+ r && (r instanceof k ? $t._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(o), i && s.sendObjectToBack(i), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-send-backwards", {
3247
3244
  object: r,
3248
3245
  withoutSave: e
3249
3246
  }));
@@ -3287,7 +3284,7 @@ class te {
3287
3284
  });
3288
3285
  }
3289
3286
  }
3290
- class so {
3287
+ class to {
3291
3288
  /**
3292
3289
  * Менеджер фигур для редактора.
3293
3290
  * @param options - Опции и настройки менеджера фигур.
@@ -3313,13 +3310,13 @@ class so {
3313
3310
  */
3314
3311
  addRectangle(d = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3315
3312
  var l = d, {
3316
- id: t = `rect-${Y()}`,
3313
+ id: t = `rect-${G()}`,
3317
3314
  left: e,
3318
3315
  top: s,
3319
3316
  width: o = 100,
3320
3317
  height: n = 100,
3321
3318
  fill: i = "blue"
3322
- } = l, a = gt(l, [
3319
+ } = l, a = vt(l, [
3323
3320
  "id",
3324
3321
  "left",
3325
3322
  "top",
@@ -3327,7 +3324,7 @@ class so {
3327
3324
  "height",
3328
3325
  "fill"
3329
3326
  ]);
3330
- const { canvas: u } = this.editor, g = new ps(k({
3327
+ const { canvas: u } = this.editor, g = new gs(_({
3331
3328
  id: t,
3332
3329
  left: e,
3333
3330
  top: s,
@@ -3355,19 +3352,19 @@ class so {
3355
3352
  */
3356
3353
  addCircle(c = {}, { withoutSelection: a, withoutAdding: r } = {}) {
3357
3354
  var d = c, {
3358
- id: t = `circle-${Y()}`,
3355
+ id: t = `circle-${G()}`,
3359
3356
  left: e,
3360
3357
  top: s,
3361
3358
  radius: o = 50,
3362
3359
  fill: n = "green"
3363
- } = d, i = gt(d, [
3360
+ } = d, i = vt(d, [
3364
3361
  "id",
3365
3362
  "left",
3366
3363
  "top",
3367
3364
  "radius",
3368
3365
  "fill"
3369
3366
  ]);
3370
- const { canvas: l } = this.editor, u = new ms(k({
3367
+ const { canvas: l } = this.editor, u = new fs(_({
3371
3368
  id: t,
3372
3369
  left: e,
3373
3370
  top: s,
@@ -3395,13 +3392,13 @@ class so {
3395
3392
  */
3396
3393
  addTriangle(d = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3397
3394
  var l = d, {
3398
- id: t = `triangle-${Y()}`,
3395
+ id: t = `triangle-${G()}`,
3399
3396
  left: e,
3400
3397
  top: s,
3401
3398
  width: o = 100,
3402
3399
  height: n = 100,
3403
3400
  fill: i = "yellow"
3404
- } = l, a = gt(l, [
3401
+ } = l, a = vt(l, [
3405
3402
  "id",
3406
3403
  "left",
3407
3404
  "top",
@@ -3409,7 +3406,7 @@ class so {
3409
3406
  "height",
3410
3407
  "fill"
3411
3408
  ]);
3412
- const { canvas: u } = this.editor, g = new ys(k({
3409
+ const { canvas: u } = this.editor, g = new ps(_({
3413
3410
  id: t,
3414
3411
  left: e,
3415
3412
  top: s,
@@ -3420,7 +3417,7 @@ class so {
3420
3417
  return !e && !s && u.centerObject(g), c || (u.add(g), r || u.setActiveObject(g), u.renderAll()), g;
3421
3418
  }
3422
3419
  }
3423
- class oo {
3420
+ class eo {
3424
3421
  /**
3425
3422
  * @param options
3426
3423
  * @param options.editor - экземпляр редактора с доступом к canvas
@@ -3448,10 +3445,10 @@ class oo {
3448
3445
  * Асинхронное клонирование для внутреннего буфера
3449
3446
  */
3450
3447
  _cloneToInternalClipboard(t) {
3451
- return _(this, null, function* () {
3448
+ return N(this, null, function* () {
3452
3449
  const { canvas: e, errorManager: s } = this.editor;
3453
3450
  try {
3454
- const o = yield t.clone(Kt);
3451
+ const o = yield t.clone(Xt);
3455
3452
  this.clipboard = o, e.fire("editor:object-copied", { object: o });
3456
3453
  } catch (o) {
3457
3454
  s.emitError({
@@ -3468,7 +3465,7 @@ class oo {
3468
3465
  * Копирование в системный буфер обмена
3469
3466
  */
3470
3467
  _copyToSystemClipboard(t) {
3471
- return _(this, null, function* () {
3468
+ return N(this, null, function* () {
3472
3469
  const { errorManager: e } = this.editor;
3473
3470
  if (typeof ClipboardItem == "undefined" || !navigator.clipboard)
3474
3471
  return e.emitWarning({
@@ -3478,7 +3475,7 @@ class oo {
3478
3475
  message: "navigator.clipboard не поддерживается в этом браузере или отсутствует HTTPS-соединение."
3479
3476
  }), !1;
3480
3477
  try {
3481
- const s = t.toObject(Kt), o = JSON.stringify(s);
3478
+ const s = t.toObject(Xt), o = JSON.stringify(s);
3482
3479
  return t.type === "image" ? this._copyImageToClipboard(t, o) : this._copyTextToClipboard(o);
3483
3480
  } catch (s) {
3484
3481
  return e.emitError({
@@ -3495,7 +3492,7 @@ class oo {
3495
3492
  * Копирование изображения в буфер обмена
3496
3493
  */
3497
3494
  _copyImageToClipboard(t, e) {
3498
- return _(this, null, function* () {
3495
+ return N(this, null, function* () {
3499
3496
  try {
3500
3497
  const o = t.toCanvasElement({ enableRetinaScaling: !1 }).toDataURL(), n = o.slice(5).split(";")[0], i = o.split(",")[1], a = atob(i), r = new Uint8Array(a.length);
3501
3498
  for (let l = 0; l < a.length; l += 1)
@@ -3517,9 +3514,9 @@ class oo {
3517
3514
  * Копирование текста в буфер обмена
3518
3515
  */
3519
3516
  _copyTextToClipboard(t) {
3520
- return _(this, null, function* () {
3517
+ return N(this, null, function* () {
3521
3518
  try {
3522
- const e = `${Ke}${t}`;
3519
+ const e = `${Ze}${t}`;
3523
3520
  return yield navigator.clipboard.writeText(e), console.info("Text copied to clipboard successfully"), !0;
3524
3521
  } catch (e) {
3525
3522
  const { errorManager: s } = this.editor;
@@ -3539,7 +3536,7 @@ class oo {
3539
3536
  */
3540
3537
  _addClonedObjectToCanvas(t) {
3541
3538
  const { canvas: e, historyManager: s } = this.editor;
3542
- if (e.discardActiveObject(), t instanceof x) {
3539
+ if (e.discardActiveObject(), t instanceof k) {
3543
3540
  s.suspendHistory(), t.canvas = e, t.forEachObject((o) => {
3544
3541
  e.add(o);
3545
3542
  }), e.setActiveObject(t), e.requestRenderAll(), s.resumeHistory(), s.saveState();
@@ -3552,7 +3549,7 @@ class oo {
3552
3549
  * @param source - источник изображения (data URL или URL)
3553
3550
  */
3554
3551
  _handleImageImport(t) {
3555
- return _(this, null, function* () {
3552
+ return N(this, null, function* () {
3556
3553
  var s;
3557
3554
  const { image: e } = (s = yield this.editor.imageManager.importImage({
3558
3555
  source: t,
@@ -3568,18 +3565,18 @@ class oo {
3568
3565
  * @fires editor:object-pasted
3569
3566
  */
3570
3567
  copyPaste(t) {
3571
- return _(this, null, function* () {
3568
+ return N(this, null, function* () {
3572
3569
  const { canvas: e } = this.editor, s = t || e.getActiveObject();
3573
3570
  if (!s || s.locked) return !1;
3574
3571
  try {
3575
- const o = yield s.clone(Kt);
3576
- return o instanceof x && o.forEachObject((n) => {
3572
+ const o = yield s.clone(Xt);
3573
+ return o instanceof k && o.forEachObject((n) => {
3577
3574
  n.set({
3578
- id: `${n.type}-${Y()}`,
3575
+ id: `${n.type}-${G()}`,
3579
3576
  evented: !0
3580
3577
  });
3581
3578
  }), o.set({
3582
- id: `${o.type}-${Y()}`,
3579
+ id: `${o.type}-${G()}`,
3583
3580
  left: o.left + 10,
3584
3581
  top: o.top + 10,
3585
3582
  evented: !0
@@ -3603,14 +3600,14 @@ class oo {
3603
3600
  * @param event.clipboardData.items — элементы буфера обмена
3604
3601
  */
3605
3602
  handlePasteEvent(e) {
3606
- return _(this, arguments, function* ({ clipboardData: t }) {
3603
+ return N(this, arguments, function* ({ clipboardData: t }) {
3607
3604
  var r;
3608
3605
  if (!((r = t == null ? void 0 : t.items) != null && r.length)) {
3609
3606
  this.paste();
3610
3607
  return;
3611
3608
  }
3612
3609
  const s = t.getData("text/plain");
3613
- if (s && s.startsWith(Ke)) {
3610
+ if (s && s.startsWith(Ze)) {
3614
3611
  this.paste();
3615
3612
  return;
3616
3613
  }
@@ -3654,18 +3651,18 @@ class oo {
3654
3651
  * @fires editor:object-pasted
3655
3652
  */
3656
3653
  paste() {
3657
- return _(this, null, function* () {
3654
+ return N(this, null, function* () {
3658
3655
  const { canvas: t } = this.editor;
3659
3656
  if (!this.clipboard) return !1;
3660
3657
  try {
3661
- const e = yield this.clipboard.clone(Kt);
3662
- return t.discardActiveObject(), e instanceof x && e.forEachObject((s) => {
3658
+ const e = yield this.clipboard.clone(Xt);
3659
+ return t.discardActiveObject(), e instanceof k && e.forEachObject((s) => {
3663
3660
  s.set({
3664
- id: `${s.type}-${Y()}`,
3661
+ id: `${s.type}-${G()}`,
3665
3662
  evented: !0
3666
3663
  });
3667
3664
  }), e.set({
3668
- id: `${e.type}-${Y()}`,
3665
+ id: `${e.type}-${G()}`,
3669
3666
  left: e.left + 10,
3670
3667
  top: e.top + 10,
3671
3668
  evented: !0
@@ -3683,7 +3680,7 @@ class oo {
3683
3680
  });
3684
3681
  }
3685
3682
  }
3686
- class ee {
3683
+ class te {
3687
3684
  constructor({ editor: t }) {
3688
3685
  this.editor = t;
3689
3686
  }
@@ -3709,7 +3706,7 @@ class ee {
3709
3706
  editable: !1,
3710
3707
  locked: !0
3711
3708
  };
3712
- i.set(a), !e && ee._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
3709
+ i.set(a), !e && te._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
3713
3710
  c.set(a);
3714
3711
  }), o.renderAll(), s || n.saveState(), o.fire("editor:object-locked", {
3715
3712
  object: i,
@@ -3738,7 +3735,7 @@ class ee {
3738
3735
  editable: !0,
3739
3736
  locked: !1
3740
3737
  };
3741
- n.set(i), ee._isGroupOrSelection(n) && n.getObjects().forEach((a) => {
3738
+ n.set(i), te._isGroupOrSelection(n) && n.getObjects().forEach((a) => {
3742
3739
  a.set(i);
3743
3740
  }), s.renderAll(), e || o.saveState(), s.fire("editor:object-unlocked", {
3744
3741
  object: n,
@@ -3746,10 +3743,10 @@ class ee {
3746
3743
  });
3747
3744
  }
3748
3745
  static _isGroupOrSelection(t) {
3749
- return t instanceof x || t instanceof Ct;
3746
+ return t instanceof k || t instanceof Et;
3750
3747
  }
3751
3748
  }
3752
- class no {
3749
+ class so {
3753
3750
  constructor({ editor: t }) {
3754
3751
  this.editor = t;
3755
3752
  }
@@ -3761,7 +3758,7 @@ class no {
3761
3758
  if (Array.isArray(t))
3762
3759
  return t.length > 0 ? t : null;
3763
3760
  const e = t || this.editor.canvas.getActiveObject();
3764
- return !e || !(e instanceof x) ? null : e.getObjects();
3761
+ return !e || !(e instanceof k) ? null : e.getObjects();
3765
3762
  }
3766
3763
  /**
3767
3764
  * Получить группы для разгруппировки
@@ -3769,20 +3766,20 @@ class no {
3769
3766
  */
3770
3767
  _getGroupsToUngroup(t) {
3771
3768
  if (Array.isArray(t)) {
3772
- const s = t.filter((o) => o instanceof Ct);
3769
+ const s = t.filter((o) => o instanceof Et);
3773
3770
  return s.length > 0 ? s : null;
3774
3771
  }
3775
- if (t instanceof x) {
3776
- const s = t.getObjects().filter((o) => o instanceof Ct);
3772
+ if (t instanceof k) {
3773
+ const s = t.getObjects().filter((o) => o instanceof Et);
3777
3774
  return s.length > 0 ? s : null;
3778
3775
  }
3779
3776
  const e = t || this.editor.canvas.getActiveObject();
3780
3777
  if (!e) return null;
3781
- if (e instanceof x) {
3782
- const s = e.getObjects().filter((o) => o instanceof Ct);
3778
+ if (e instanceof k) {
3779
+ const s = e.getObjects().filter((o) => o instanceof Et);
3783
3780
  return s.length > 0 ? s : null;
3784
3781
  }
3785
- return e instanceof Ct ? [e] : null;
3782
+ return e instanceof Et ? [e] : null;
3786
3783
  }
3787
3784
  /**
3788
3785
  * Группировка объектов
@@ -3799,8 +3796,8 @@ class no {
3799
3796
  if (!n) return null;
3800
3797
  try {
3801
3798
  o.suspendHistory();
3802
- const i = new Ct(n, {
3803
- id: `group-${Y()}`
3799
+ const i = new Et(n, {
3800
+ id: `group-${G()}`
3804
3801
  });
3805
3802
  n.forEach((r) => s.remove(r)), s.add(i), s.setActiveObject(i), s.requestRenderAll();
3806
3803
  const a = {
@@ -3835,7 +3832,7 @@ class no {
3835
3832
  s.add(l), i.push(l);
3836
3833
  });
3837
3834
  });
3838
- const a = new x(i, {
3835
+ const a = new k(i, {
3839
3836
  canvas: s
3840
3837
  });
3841
3838
  s.setActiveObject(a), s.requestRenderAll();
@@ -3850,7 +3847,7 @@ class no {
3850
3847
  }
3851
3848
  }
3852
3849
  }
3853
- class io {
3850
+ class oo {
3854
3851
  constructor({ editor: t }) {
3855
3852
  this.editor = t;
3856
3853
  }
@@ -3861,11 +3858,11 @@ class io {
3861
3858
  selectAll() {
3862
3859
  const { canvas: t, canvasManager: e, objectLockManager: s } = this.editor;
3863
3860
  t.discardActiveObject();
3864
- const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new x(e.getObjects(), { canvas: t }) : o[0];
3861
+ const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new k(e.getObjects(), { canvas: t }) : o[0];
3865
3862
  n && s.lockObject({ object: i, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(i), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: i });
3866
3863
  }
3867
3864
  }
3868
- class Me {
3865
+ class we {
3869
3866
  constructor({ editor: t }) {
3870
3867
  this.editor = t;
3871
3868
  }
@@ -3912,7 +3909,7 @@ class Me {
3912
3909
  s || n.suspendHistory();
3913
3910
  const r = [];
3914
3911
  if (a.forEach((d) => {
3915
- if (Me._isUngroupableGroup(d)) {
3912
+ if (we._isUngroupableGroup(d)) {
3916
3913
  const l = this._handleGroupDeletion(d);
3917
3914
  r.push(...l);
3918
3915
  return;
@@ -3927,7 +3924,7 @@ class Me {
3927
3924
  return o.fire("editor:objects-deleted", c), c;
3928
3925
  }
3929
3926
  }
3930
- const ft = {
3927
+ const bt = {
3931
3928
  IMAGE_MANAGER: {
3932
3929
  /**
3933
3930
  * Некорректный Content-Type изображения
@@ -4032,7 +4029,7 @@ const ft = {
4032
4029
  APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
4033
4030
  }
4034
4031
  };
4035
- class Ut {
4032
+ class Yt {
4036
4033
  constructor({ editor: t }) {
4037
4034
  this._buffer = [], this.editor = t;
4038
4035
  }
@@ -4059,7 +4056,7 @@ class Ut {
4059
4056
  * @fires editor:error
4060
4057
  */
4061
4058
  emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, data: o, message: n }) {
4062
- if (!Ut.isValidErrorCode(s)) {
4059
+ if (!Yt.isValidErrorCode(s)) {
4063
4060
  console.warn("Неизвестный код ошибки: ", { code: s, origin: t, method: e });
4064
4061
  return;
4065
4062
  }
@@ -4073,7 +4070,7 @@ class Ut {
4073
4070
  message: i,
4074
4071
  data: o
4075
4072
  };
4076
- this._buffer.push(k({
4073
+ this._buffer.push(_({
4077
4074
  type: "editor:error"
4078
4075
  }, a)), this.editor.canvas.fire("editor:error", a);
4079
4076
  }
@@ -4088,7 +4085,7 @@ class Ut {
4088
4085
  * @fires editor:warning
4089
4086
  */
4090
4087
  emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, message: o, data: n }) {
4091
- if (!Ut.isValidErrorCode(s)) {
4088
+ if (!Yt.isValidErrorCode(s)) {
4092
4089
  console.warn("Неизвестный код предупреждения: ", { code: s, origin: t, method: e });
4093
4090
  return;
4094
4091
  }
@@ -4101,7 +4098,7 @@ class Ut {
4101
4098
  message: i,
4102
4099
  data: n
4103
4100
  };
4104
- this._buffer.push(k({
4101
+ this._buffer.push(_({
4105
4102
  type: "editor:warning"
4106
4103
  }, a)), this.editor.canvas.fire("editor:warning", a);
4107
4104
  }
@@ -4111,10 +4108,10 @@ class Ut {
4111
4108
  * @returns true, если код допустим, иначе false
4112
4109
  */
4113
4110
  static isValidErrorCode(t) {
4114
- return t ? Object.values(ft).some((e) => Object.values(e).includes(t)) : !1;
4111
+ return t ? Object.values(bt).some((e) => Object.values(e).includes(t)) : !1;
4115
4112
  }
4116
4113
  }
4117
- class ao {
4114
+ class no {
4118
4115
  constructor({ editor: t }) {
4119
4116
  this.currentBounds = null, this.editor = t;
4120
4117
  }
@@ -4199,11 +4196,11 @@ class ao {
4199
4196
  this.currentBounds = this.calculatePanBounds();
4200
4197
  }
4201
4198
  }
4202
- const nt = ({
4199
+ const at = ({
4203
4200
  value: h,
4204
4201
  min: t,
4205
4202
  max: e
4206
- }) => Math.min(Math.max(h, t), e), Ot = class Ot extends st {
4203
+ }) => Math.min(Math.max(h, t), e), Dt = class Dt extends nt {
4207
4204
  constructor(t, e = {}) {
4208
4205
  var s, o, n, i, a, r, c, d, l;
4209
4206
  super(t, e), this.backgroundOpacity = (s = e.backgroundOpacity) != null ? s : 1, this.paddingTop = (o = e.paddingTop) != null ? o : 0, this.paddingRight = (n = e.paddingRight) != null ? n : 0, this.paddingBottom = (i = e.paddingBottom) != null ? i : 0, this.paddingLeft = (a = e.paddingLeft) != null ? a : 0, this.radiusTopLeft = (r = e.radiusTopLeft) != null ? r : 0, this.radiusTopRight = (c = e.radiusTopRight) != null ? c : 0, this.radiusBottomRight = (d = e.radiusBottomRight) != null ? d : 0, this.radiusBottomLeft = (l = e.radiusBottomLeft) != null ? l : 0, this._roundDimensions();
@@ -4224,11 +4221,11 @@ const nt = ({
4224
4221
  }
4225
4222
  _getNonTransformedDimensions() {
4226
4223
  const { width: t, height: e } = this._getBackgroundDimensions();
4227
- return new J(t, e).scalarAdd(this.strokeWidth);
4224
+ return new tt(t, e).scalarAdd(this.strokeWidth);
4228
4225
  }
4229
4226
  _getTransformedDimensions(t = {}) {
4230
4227
  const { width: e, height: s } = this._getBackgroundDimensions();
4231
- return super._getTransformedDimensions(jt(k({}, t), {
4228
+ return super._getTransformedDimensions(yt(_({}, t), {
4232
4229
  width: e,
4233
4230
  height: s
4234
4231
  }));
@@ -4238,7 +4235,7 @@ const nt = ({
4238
4235
  */
4239
4236
  toObject(t = []) {
4240
4237
  const e = super.toObject(t);
4241
- return jt(k({}, e), {
4238
+ return yt(_({}, e), {
4242
4239
  backgroundOpacity: this.backgroundOpacity,
4243
4240
  paddingTop: this.paddingTop,
4244
4241
  paddingRight: this.paddingRight,
@@ -4255,7 +4252,7 @@ const nt = ({
4255
4252
  const e = this._getEffectiveBackgroundFill();
4256
4253
  if (e && e) {
4257
4254
  const n = this._getPadding(), i = (s = this.width) != null ? s : 0, a = (o = this.height) != null ? o : 0, r = i + n.left + n.right, c = a + n.top + n.bottom, d = this._getCornerRadii({ width: r, height: c }), l = this._getLeftOffset() - n.left, u = this._getTopOffset() - n.top;
4258
- t.save(), Ot._renderRoundedRect({
4255
+ t.save(), Dt._renderRoundedRect({
4259
4256
  ctx: t,
4260
4257
  height: c,
4261
4258
  left: l,
@@ -4277,10 +4274,10 @@ const nt = ({
4277
4274
  var i, a, r, c;
4278
4275
  const s = t / 2, o = e / 2, n = Math.min(s, o);
4279
4276
  return {
4280
- bottomLeft: nt({ value: (i = this.radiusBottomLeft) != null ? i : 0, min: 0, max: n }),
4281
- bottomRight: nt({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: n }),
4282
- topLeft: nt({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: n }),
4283
- topRight: nt({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: n })
4277
+ bottomLeft: at({ value: (i = this.radiusBottomLeft) != null ? i : 0, min: 0, max: n }),
4278
+ bottomRight: at({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: n }),
4279
+ topLeft: at({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: n }),
4280
+ topRight: at({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: n })
4284
4281
  };
4285
4282
  }
4286
4283
  _getPadding() {
@@ -4296,12 +4293,12 @@ const nt = ({
4296
4293
  var o;
4297
4294
  const t = this.backgroundColor;
4298
4295
  if (!t) return null;
4299
- const e = nt({ value: (o = this.backgroundOpacity) != null ? o : 1, min: 0, max: 1 });
4296
+ const e = at({ value: (o = this.backgroundOpacity) != null ? o : 1, min: 0, max: 1 });
4300
4297
  let s;
4301
4298
  try {
4302
- s = new vs(t);
4299
+ s = new ms(t);
4303
4300
  } catch (n) {
4304
- return Ut.emitError({
4301
+ return Yt.emitError({
4305
4302
  origin: "BackgroundTextbox",
4306
4303
  method: "_getEffectiveBackgroundFill",
4307
4304
  code: "INVALID_COLOR_VALUE",
@@ -4324,7 +4321,7 @@ const nt = ({
4324
4321
  topRight: d,
4325
4322
  bottomRight: l,
4326
4323
  bottomLeft: u
4327
- } = o, g = nt({ value: c, min: 0, max: i }), f = nt({ value: d, min: 0, max: i }), p = nt({ value: l, min: 0, max: i }), m = nt({ value: u, min: 0, max: i });
4324
+ } = o, g = at({ value: c, min: 0, max: i }), f = at({ value: d, min: 0, max: i }), p = at({ value: l, min: 0, max: i }), m = at({ value: u, min: 0, max: i });
4328
4325
  t.beginPath(), t.moveTo(s + g, n), t.lineTo(a - f, n), t.quadraticCurveTo(a, n, a, n + f), t.lineTo(a, r - p), t.quadraticCurveTo(a, r, a - p, r), t.lineTo(s + m, r), t.quadraticCurveTo(s, r, s, r - m), t.lineTo(s, n + g), t.quadraticCurveTo(s, n, s + g, n), t.closePath();
4329
4326
  }
4330
4327
  /**
@@ -4338,8 +4335,8 @@ const nt = ({
4338
4335
  s !== t && (this.width = Math.max(0, s)), o !== e && (this.height = Math.max(0, o));
4339
4336
  }
4340
4337
  };
4341
- Ot.type = "background-textbox", Ot.cacheProperties = [
4342
- ...Array.isArray(st.cacheProperties) ? st.cacheProperties : [],
4338
+ Dt.type = "background-textbox", Dt.cacheProperties = [
4339
+ ...Array.isArray(nt.cacheProperties) ? nt.cacheProperties : [],
4343
4340
  "backgroundColor",
4344
4341
  "backgroundOpacity",
4345
4342
  "paddingTop",
@@ -4350,8 +4347,8 @@ Ot.type = "background-textbox", Ot.cacheProperties = [
4350
4347
  "radiusTopRight",
4351
4348
  "radiusBottomRight",
4352
4349
  "radiusBottomLeft"
4353
- ], Ot.stateProperties = [
4354
- ...Array.isArray(st.stateProperties) ? st.stateProperties : [],
4350
+ ], Dt.stateProperties = [
4351
+ ...Array.isArray(nt.stateProperties) ? nt.stateProperties : [],
4355
4352
  "backgroundColor",
4356
4353
  "backgroundOpacity",
4357
4354
  "paddingTop",
@@ -4363,11 +4360,11 @@ Ot.type = "background-textbox", Ot.cacheProperties = [
4363
4360
  "radiusBottomRight",
4364
4361
  "radiusBottomLeft"
4365
4362
  ];
4366
- let se = Ot;
4367
- const ro = () => {
4363
+ let ee = Dt;
4364
+ const io = () => {
4368
4365
  var h;
4369
- (h = He) != null && h.setClass && He.setClass(se, "background-textbox");
4370
- }, co = ({ textbox: h }) => {
4366
+ (h = Pe) != null && h.setClass && Pe.setClass(ee, "background-textbox");
4367
+ }, ao = ({ textbox: h }) => {
4371
4368
  var s, o;
4372
4369
  if (!h.isEditing) return null;
4373
4370
  const t = (s = h.selectionStart) != null ? s : 0, e = (o = h.selectionEnd) != null ? o : t;
@@ -4375,16 +4372,16 @@ const ro = () => {
4375
4372
  start: Math.min(t, e),
4376
4373
  end: Math.max(t, e)
4377
4374
  };
4378
- }, lo = ({ textbox: h }) => {
4375
+ }, ro = ({ textbox: h }) => {
4379
4376
  var e, s;
4380
4377
  const t = (s = (e = h.text) == null ? void 0 : e.length) != null ? s : 0;
4381
4378
  return t <= 0 ? null : { start: 0, end: t };
4382
- }, ho = ({ textbox: h, range: t }) => {
4379
+ }, co = ({ textbox: h, range: t }) => {
4383
4380
  var s, o;
4384
4381
  if (!t) return !1;
4385
4382
  const e = (o = (s = h.text) == null ? void 0 : s.length) != null ? o : 0;
4386
4383
  return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
4387
- }, oe = ({
4384
+ }, ne = ({
4388
4385
  textbox: h,
4389
4386
  styles: t,
4390
4387
  range: e
@@ -4392,7 +4389,7 @@ const ro = () => {
4392
4389
  if (!t || !Object.keys(t).length) return !1;
4393
4390
  const { start: s, end: o } = e;
4394
4391
  return o <= s ? !1 : (h.setSelectionStyles(t, s, o), !0);
4395
- }, qe = ({
4392
+ }, Ve = ({
4396
4393
  textbox: h,
4397
4394
  range: t,
4398
4395
  property: e
@@ -4406,57 +4403,45 @@ const ro = () => {
4406
4403
  );
4407
4404
  if (s.length)
4408
4405
  return (o = s[0]) == null ? void 0 : o[e];
4409
- }, $e = ({ strokeColor: h, width: t }) => {
4406
+ }, Xe = ({ strokeColor: h, width: t }) => {
4410
4407
  if (!(t <= 0))
4411
4408
  return h != null ? h : "#000000";
4412
- }, Je = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, ne = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", it = 0.01;
4413
- class G {
4409
+ }, Ke = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, ie = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", st = 0.01;
4410
+ class Z {
4414
4411
  constructor({ editor: t }) {
4415
4412
  var e;
4416
4413
  this._handleTextEditingEntered = () => {
4417
4414
  this.isTextEditingActive = !0;
4418
4415
  }, this._handleTextChanged = (s) => {
4419
4416
  const { target: o } = s;
4420
- if (!G._isTextbox(o)) return;
4417
+ if (!Z._isTextbox(o)) return;
4421
4418
  const { text: n = "", uppercase: i } = o, a = !!i, r = n.toLocaleLowerCase();
4422
4419
  if (a) {
4423
- const d = ne({ value: r });
4420
+ const d = ie({ value: r });
4424
4421
  d !== n && o.set({ text: d }), o.textCaseRaw = r;
4425
4422
  } else
4426
4423
  o.textCaseRaw = n;
4427
- G._roundTextboxDimensions({ textbox: o }) && (o.setCoords(), o.dirty = !0);
4424
+ Z._roundTextboxDimensions({ textbox: o }) && (o.setCoords(), o.dirty = !0);
4428
4425
  }, this._handleTextEditingExited = (s) => {
4429
4426
  var r, c;
4430
4427
  const { target: o } = s;
4431
- if (!G._isTextbox(o)) return;
4428
+ if (!Z._isTextbox(o)) return;
4432
4429
  const n = (r = o.text) != null ? r : "";
4433
4430
  if (!!o.uppercase) {
4434
4431
  const d = (c = o.textCaseRaw) != null ? c : n.toLocaleLowerCase();
4435
4432
  o.textCaseRaw = d;
4436
4433
  } else
4437
4434
  o.textCaseRaw = n;
4438
- G._roundTextboxDimensions({ textbox: o }) && (o.setCoords(), o.dirty = !0, this.canvas.requestRenderAll()), o.locked || o.set({
4435
+ Z._roundTextboxDimensions({ textbox: o }) && (o.setCoords(), o.dirty = !0, this.canvas.requestRenderAll()), o.locked || o.set({
4439
4436
  lockMovementX: !1,
4440
4437
  lockMovementY: !1
4441
4438
  }), setTimeout(() => {
4442
4439
  this.isTextEditingActive = !1, this.editor.historyManager.saveState();
4443
- }, Ks);
4440
+ }, Vs);
4444
4441
  }, this._handleObjectScaling = (s) => {
4445
- var W, Mt, Ht, ut, Wt, wt, je, Ie, Ce, Te, Ee, Oe, De, Le, Re;
4442
+ var X, It, Wt, mt, Ht, Ct, Ae, je, Ie, Ce, Te, Ee, Oe;
4446
4443
  const { target: o, transform: n } = s;
4447
- if (o instanceof x) {
4448
- if (!((Mt = (W = o.getObjects) == null ? void 0 : W.call(o)) != null ? Mt : []).some((At) => G._isTextbox(At))) return;
4449
- const {
4450
- corner: Gt = "",
4451
- action: St = ""
4452
- } = n != null ? n : {};
4453
- if (!(["ml", "mr", "tl", "tr", "bl", "br"].includes(Gt) || St === "scaleX" || St === "scale") || !n) return;
4454
- o.set({
4455
- scaleX: 1
4456
- }), n.scaleX = 1, n.original && (n.original.scaleX = 1), o.setCoords(), this.canvas.requestRenderAll();
4457
- return;
4458
- }
4459
- if (!G._isTextbox(o) || !n) return;
4444
+ if (o instanceof k || !Z._isTextbox(o) || !n) return;
4460
4445
  o.isScaling = !0;
4461
4446
  const i = this._ensureScalingState(o), {
4462
4447
  baseWidth: a,
@@ -4465,21 +4450,21 @@ class G {
4465
4450
  basePadding: d,
4466
4451
  baseRadii: l,
4467
4452
  baseStyles: u
4468
- } = i, g = typeof ((Ht = n.original) == null ? void 0 : Ht.width) == "number" ? n.original.width : void 0, f = typeof ((ut = n.original) == null ? void 0 : ut.left) == "number" ? n.original.left : void 0, p = g != null ? g : a, m = f != null ? f : r, v = (Wt = n.corner) != null ? Wt : "", b = (wt = n.action) != null ? wt : "", I = ["ml", "mr"].includes(v) || b === "scaleX", y = ["mt", "mb"].includes(v) || b === "scaleY", w = ["tl", "tr", "bl", "br"].includes(v) || b === "scale", S = w || y;
4453
+ } = i, g = typeof ((X = n.original) == null ? void 0 : X.width) == "number" ? n.original.width : void 0, f = typeof ((It = n.original) == null ? void 0 : It.left) == "number" ? n.original.left : void 0, p = g != null ? g : a, m = f != null ? f : r, v = (Wt = n.corner) != null ? Wt : "", b = (mt = n.action) != null ? mt : "", I = ["ml", "mr"].includes(v) || b === "scaleX", y = ["mt", "mb"].includes(v) || b === "scaleY", w = ["tl", "tr", "bl", "br"].includes(v) || b === "scale", A = w || y;
4469
4454
  if (!I && !y && !w) return;
4470
- const A = Math.abs((Ie = (je = o.scaleX) != null ? je : n.scaleX) != null ? Ie : 1) || 1, M = Math.abs((Te = (Ce = o.scaleY) != null ? Ce : n.scaleY) != null ? Te : 1) || 1, C = Math.max(1, p * A), j = Math.max(1, Math.round(C)), T = Math.max(1, c * M), {
4471
- paddingTop: B = 0,
4472
- paddingRight: Z = 0,
4455
+ const j = Math.abs((Ct = (Ht = o.scaleX) != null ? Ht : n.scaleX) != null ? Ct : 1) || 1, M = Math.abs((je = (Ae = o.scaleY) != null ? Ae : n.scaleY) != null ? je : 1) || 1, T = Math.max(1, p * j), S = Math.max(1, Math.round(T)), C = Math.max(1, c * M), {
4456
+ paddingTop: x = 0,
4457
+ paddingRight: F = 0,
4473
4458
  paddingBottom: U = 0,
4474
- paddingLeft: F = 0,
4459
+ paddingLeft: W = 0,
4475
4460
  radiusTopLeft: V = 0,
4476
- radiusTopRight: D = 0,
4477
- radiusBottomRight: R = 0,
4478
- radiusBottomLeft: K = 0,
4461
+ radiusTopRight: L = 0,
4462
+ radiusBottomRight: D = 0,
4463
+ radiusBottomLeft: z = 0,
4479
4464
  fontSize: H,
4480
- width: z,
4481
- originX: X = "left"
4482
- } = o, et = w || y, q = w || y, P = et ? {
4465
+ width: P,
4466
+ originX: K = "left"
4467
+ } = o, $ = w || y, q = w || y, Y = $ ? {
4483
4468
  top: Math.max(0, d.top * M),
4484
4469
  right: Math.max(0, d.right * M),
4485
4470
  bottom: Math.max(0, d.bottom * M),
@@ -4489,32 +4474,32 @@ class G {
4489
4474
  topRight: Math.max(0, l.topRight * M),
4490
4475
  bottomRight: Math.max(0, l.bottomRight * M),
4491
4476
  bottomLeft: Math.max(0, l.bottomLeft * M)
4492
- } : l, Yt = Object.keys(u).length > 0;
4493
- let yt;
4494
- if (S && Yt) {
4495
- const Zt = {};
4496
- Object.entries(u).forEach(([_e, Gt]) => {
4497
- if (!Gt) return;
4498
- const St = {};
4499
- Object.entries(Gt).forEach(([Ne, At]) => {
4500
- if (!At) return;
4501
- const xe = k({}, At);
4502
- typeof At.fontSize == "number" && (xe.fontSize = Math.max(1, At.fontSize * M)), St[Ne] = xe;
4503
- }), Object.keys(St).length && (Zt[_e] = St);
4504
- }), Object.keys(Zt).length && (yt = Zt);
4477
+ } : l, St = Object.keys(u).length > 0;
4478
+ let et;
4479
+ if (A && St) {
4480
+ const se = {};
4481
+ Object.entries(u).forEach(([rs, Le]) => {
4482
+ if (!Le) return;
4483
+ const oe = {};
4484
+ Object.entries(Le).forEach(([cs, Zt]) => {
4485
+ if (!Zt) return;
4486
+ const De = _({}, Zt);
4487
+ typeof Zt.fontSize == "number" && (De.fontSize = Math.max(1, Zt.fontSize * M)), oe[cs] = De;
4488
+ }), Object.keys(oe).length && (se[rs] = oe);
4489
+ }), Object.keys(se).length && (et = se);
4505
4490
  }
4506
- const vt = (Oe = (Ee = n.originX) != null ? Ee : X) != null ? Oe : "left", Rt = m + p, Se = m + p / 2, bt = z != null ? z : p, Ae = j !== bt, Ft = Math.abs(T - (H != null ? H : c)) > it, _t = Math.abs(P.top - B) > it || Math.abs(P.right - Z) > it || Math.abs(P.bottom - U) > it || Math.abs(P.left - F) > it, Nt = Math.abs(Q.topLeft - V) > it || Math.abs(Q.topRight - D) > it || Math.abs(Q.bottomRight - R) > it || Math.abs(Q.bottomLeft - K) > it;
4507
- if (!Ae && !Ft && !_t && !Nt) {
4491
+ const lt = (Ce = (Ie = n.originX) != null ? Ie : K) != null ? Ce : "left", pt = m + p, At = m + p / 2, ht = P != null ? P : p, jt = S !== ht, Ft = Math.abs(C - (H != null ? H : c)) > st, Nt = Math.abs(Y.top - x) > st || Math.abs(Y.right - F) > st || Math.abs(Y.bottom - U) > st || Math.abs(Y.left - W) > st, xt = Math.abs(Q.topLeft - V) > st || Math.abs(Q.topRight - L) > st || Math.abs(Q.bottomRight - D) > st || Math.abs(Q.bottomLeft - z) > st;
4492
+ if (!jt && !Ft && !Nt && !xt) {
4508
4493
  o.set({ scaleX: 1, scaleY: 1 }), n.scaleX = 1, n.scaleY = 1;
4509
4494
  return;
4510
4495
  }
4511
- yt && (o.styles = yt), o.set({
4512
- width: j,
4513
- fontSize: S ? T : c,
4514
- paddingTop: P.top,
4515
- paddingRight: P.right,
4516
- paddingBottom: P.bottom,
4517
- paddingLeft: P.left,
4496
+ et && (o.styles = et), o.set({
4497
+ width: S,
4498
+ fontSize: A ? C : c,
4499
+ paddingTop: Y.top,
4500
+ paddingRight: Y.right,
4501
+ paddingBottom: Y.bottom,
4502
+ paddingLeft: Y.left,
4518
4503
  radiusTopLeft: Q.topLeft,
4519
4504
  radiusTopRight: Q.topRight,
4520
4505
  radiusBottomRight: Q.bottomRight,
@@ -4522,27 +4507,78 @@ class G {
4522
4507
  scaleX: 1,
4523
4508
  scaleY: 1
4524
4509
  });
4525
- const xt = G._roundTextboxDimensions({ textbox: o });
4526
- xt && (o.dirty = !0);
4527
- const dt = (De = o.width) != null ? De : j, kt = dt !== bt;
4528
- let lt = m;
4529
- kt && (I || w) && (vt === "right" ? lt = Rt - dt : vt === "center" && (lt = Se - dt / 2)), o.set({ left: lt }), i.baseLeft = lt, n.scaleX = 1, n.scaleY = 1;
4530
- const { original: ot } = n;
4531
- ot && (ot.scaleX = 1, ot.scaleY = 1, ot.width = dt, ot.height = o.height, ot.left = lt), o.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = dt, i.baseFontSize = (Le = o.fontSize) != null ? Le : T, i.baseStyles = JSON.parse(JSON.stringify((Re = o.styles) != null ? Re : {})), i.basePadding = {
4532
- top: P.top,
4533
- right: P.right,
4534
- bottom: P.bottom,
4535
- left: P.left
4510
+ const Bt = Z._roundTextboxDimensions({ textbox: o });
4511
+ Bt && (o.dirty = !0);
4512
+ const ut = (Te = o.width) != null ? Te : S, kt = ut !== ht;
4513
+ let gt = m;
4514
+ kt && (I || w) && (lt === "right" ? gt = pt - ut : lt === "center" && (gt = At - ut / 2)), o.set({ left: gt }), i.baseLeft = gt, n.scaleX = 1, n.scaleY = 1;
4515
+ const { original: it } = n;
4516
+ it && (it.scaleX = 1, it.scaleY = 1, it.width = ut, it.height = o.height, it.left = gt), o.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = ut, i.baseFontSize = (Ee = o.fontSize) != null ? Ee : C, i.baseStyles = JSON.parse(JSON.stringify((Oe = o.styles) != null ? Oe : {})), i.basePadding = {
4517
+ top: Y.top,
4518
+ right: Y.right,
4519
+ bottom: Y.bottom,
4520
+ left: Y.left
4536
4521
  }, i.baseRadii = {
4537
4522
  topLeft: Q.topLeft,
4538
4523
  topRight: Q.topRight,
4539
4524
  bottomRight: Q.bottomRight,
4540
4525
  bottomLeft: Q.bottomLeft
4541
- }, i.hasWidthChange = kt || Ft || _t || Nt || xt;
4526
+ }, i.hasWidthChange = kt || Ft || Nt || xt || Bt;
4542
4527
  }, this._handleObjectModified = (s) => {
4543
4528
  var b, I, y;
4544
4529
  const { target: o } = s;
4545
- if (o instanceof x || !G._isTextbox(o)) return;
4530
+ if (o instanceof k) {
4531
+ const w = o.getObjects();
4532
+ if (!w.some((S) => Z._isTextbox(S))) return;
4533
+ const { scaleX: j = 1, scaleY: M = 1 } = o;
4534
+ if (Math.abs(j - 1) < st && Math.abs(M - 1) < st) return;
4535
+ this.canvas.discardActiveObject(), w.forEach((S) => {
4536
+ var C, x, F, U;
4537
+ if (Z._isTextbox(S)) {
4538
+ const W = (C = S.scaleX) != null ? C : 1, V = (x = S.scaleY) != null ? x : 1, L = ((F = S.fontSize) != null ? F : 16) * V, D = ((U = S.width) != null ? U : 0) * W, z = V, {
4539
+ paddingTop: H = 0,
4540
+ paddingRight: P = 0,
4541
+ paddingBottom: K = 0,
4542
+ paddingLeft: $ = 0,
4543
+ radiusTopLeft: q = 0,
4544
+ radiusTopRight: Y = 0,
4545
+ radiusBottomRight: Q = 0,
4546
+ radiusBottomLeft: St = 0,
4547
+ styles: et
4548
+ } = S, lt = {
4549
+ paddingTop: Math.max(0, H * z),
4550
+ paddingRight: Math.max(0, P * z),
4551
+ paddingBottom: Math.max(0, K * z),
4552
+ paddingLeft: Math.max(0, $ * z)
4553
+ }, pt = {
4554
+ radiusTopLeft: Math.max(0, q * z),
4555
+ radiusTopRight: Math.max(0, Y * z),
4556
+ radiusBottomRight: Math.max(0, Q * z),
4557
+ radiusBottomLeft: Math.max(0, St * z)
4558
+ };
4559
+ let At = et;
4560
+ et && Object.keys(et).length > 0 && (At = JSON.parse(JSON.stringify(et)), Object.values(At).forEach((ht) => {
4561
+ Object.values(ht).forEach((jt) => {
4562
+ typeof jt.fontSize == "number" && (jt.fontSize = Math.max(1, jt.fontSize * z));
4563
+ });
4564
+ })), S.set(yt(_(_({
4565
+ fontSize: L,
4566
+ width: D,
4567
+ scaleX: 1,
4568
+ scaleY: 1
4569
+ }, lt), pt), {
4570
+ styles: At
4571
+ })), Z._roundTextboxDimensions({ textbox: S });
4572
+ }
4573
+ S.setCoords();
4574
+ });
4575
+ const T = new k(w, {
4576
+ canvas: this.canvas
4577
+ });
4578
+ this.canvas.setActiveObject(T), this.canvas.requestRenderAll();
4579
+ return;
4580
+ }
4581
+ if (!Z._isTextbox(o)) return;
4546
4582
  o.isScaling = !1;
4547
4583
  const n = this.scalingState.get(o);
4548
4584
  if (this.scalingState.delete(o), !(n != null && n.hasWidthChange)) return;
@@ -4570,16 +4606,16 @@ class G {
4570
4606
  target: o,
4571
4607
  style: v
4572
4608
  }), o.set({ scaleX: 1, scaleY: 1 }), o.setCoords();
4573
- }, this.editor = t, this.canvas = t.canvas, this.fonts = (e = t.options.fonts) != null ? e : [], this.scalingState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(), ro();
4609
+ }, this.editor = t, this.canvas = t.canvas, this.fonts = (e = t.options.fonts) != null ? e : [], this.scalingState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(), io();
4574
4610
  }
4575
4611
  /**
4576
4612
  * Добавляет новый текстовый объект на канвас.
4577
4613
  * @param options — настройки текста
4578
4614
  * @param flags — флаги поведения
4579
4615
  */
4580
- addText(Z = {}, { withoutSelection: j = !1, withoutSave: T = !1, withoutAdding: B = !1 } = {}) {
4581
- var U = Z, {
4582
- id: t = `text-${Y()}`,
4616
+ addText(F = {}, { withoutSelection: S = !1, withoutSave: C = !1, withoutAdding: x = !1 } = {}) {
4617
+ var U = F, {
4618
+ id: t = `text-${G()}`,
4583
4619
  text: e = "Новый текст",
4584
4620
  fontFamily: s,
4585
4621
  fontSize: o = 48,
@@ -4600,10 +4636,10 @@ class G {
4600
4636
  paddingBottom: I = 0,
4601
4637
  paddingLeft: y = 0,
4602
4638
  radiusTopLeft: w = 0,
4603
- radiusTopRight: S = 0,
4604
- radiusBottomRight: A = 0,
4639
+ radiusTopRight: A = 0,
4640
+ radiusBottomRight: j = 0,
4605
4641
  radiusBottomLeft: M = 0
4606
- } = U, C = gt(U, [
4642
+ } = U, T = vt(U, [
4607
4643
  "id",
4608
4644
  "text",
4609
4645
  "fontFamily",
@@ -4629,15 +4665,15 @@ class G {
4629
4665
  "radiusBottomRight",
4630
4666
  "radiusBottomLeft"
4631
4667
  ]);
4632
- var et;
4633
- const { historyManager: F } = this.editor, { canvas: V } = this;
4634
- F.suspendHistory();
4635
- const D = s != null ? s : this._getDefaultFontFamily(), R = Je({ width: g }), K = $e({
4668
+ var $;
4669
+ const { historyManager: W } = this.editor, { canvas: V } = this;
4670
+ W.suspendHistory();
4671
+ const L = s != null ? s : this._getDefaultFontFamily(), D = Ke({ width: g }), z = Xe({
4636
4672
  strokeColor: u,
4637
- width: R
4638
- }), H = k({
4673
+ width: D
4674
+ }), H = _({
4639
4675
  id: t,
4640
- fontFamily: D,
4676
+ fontFamily: L,
4641
4677
  fontSize: o,
4642
4678
  fontWeight: n ? "bold" : "normal",
4643
4679
  fontStyle: i ? "italic" : "normal",
@@ -4646,8 +4682,8 @@ class G {
4646
4682
  linethrough: c,
4647
4683
  textAlign: d,
4648
4684
  fill: l,
4649
- stroke: K,
4650
- strokeWidth: R,
4685
+ stroke: z,
4686
+ strokeWidth: D,
4651
4687
  strokeUniform: !0,
4652
4688
  opacity: f,
4653
4689
  backgroundColor: p,
@@ -4657,32 +4693,32 @@ class G {
4657
4693
  paddingBottom: I,
4658
4694
  paddingLeft: y,
4659
4695
  radiusTopLeft: w,
4660
- radiusTopRight: S,
4661
- radiusBottomRight: A,
4696
+ radiusTopRight: A,
4697
+ radiusBottomRight: j,
4662
4698
  radiusBottomLeft: M
4663
- }, C), z = new se(e, H);
4664
- if (z.textCaseRaw = (et = z.text) != null ? et : "", r) {
4665
- const q = ne({ value: z.textCaseRaw });
4666
- q !== z.text && z.set({ text: q });
4667
- }
4668
- return G._roundTextboxDimensions({ textbox: z }) && (z.dirty = !0), C.left === void 0 && C.top === void 0 && V.centerObject(z), B || V.add(z), j || V.setActiveObject(z), V.requestRenderAll(), F.resumeHistory(), T || F.saveState(), V.fire("editor:text-added", {
4669
- textbox: z,
4670
- options: jt(k({}, H), {
4699
+ }, T), P = new ee(e, H);
4700
+ if (P.textCaseRaw = ($ = P.text) != null ? $ : "", r) {
4701
+ const q = ie({ value: P.textCaseRaw });
4702
+ q !== P.text && P.set({ text: q });
4703
+ }
4704
+ return Z._roundTextboxDimensions({ textbox: P }) && (P.dirty = !0), T.left === void 0 && T.top === void 0 && V.centerObject(P), x || V.add(P), S || V.setActiveObject(P), V.requestRenderAll(), W.resumeHistory(), C || W.saveState(), V.fire("editor:text-added", {
4705
+ textbox: P,
4706
+ options: yt(_({}, H), {
4671
4707
  text: e,
4672
4708
  bold: n,
4673
4709
  italic: i,
4674
4710
  strikethrough: c,
4675
4711
  align: d,
4676
4712
  color: l,
4677
- strokeColor: K,
4678
- strokeWidth: R
4713
+ strokeColor: z,
4714
+ strokeWidth: D
4679
4715
  }),
4680
4716
  flags: {
4681
- withoutSelection: !!j,
4682
- withoutSave: !!T,
4683
- withoutAdding: !!B
4717
+ withoutSelection: !!S,
4718
+ withoutSave: !!C,
4719
+ withoutAdding: !!x
4684
4720
  }
4685
- }), z;
4721
+ }), P;
4686
4722
  }
4687
4723
  /**
4688
4724
  * Обновляет текстовый объект.
@@ -4693,12 +4729,12 @@ class G {
4693
4729
  * @param options.skipRender — не вызывать перерисовку канваса
4694
4730
  */
4695
4731
  updateText({ target: t, style: e = {}, withoutSave: s, skipRender: o } = {}) {
4696
- var Nt, xt, dt, kt, lt, ot;
4732
+ var xt, Bt, ut, kt, gt, it;
4697
4733
  const n = this._resolveTextObject(t);
4698
4734
  if (!n) return null;
4699
4735
  const { historyManager: i } = this.editor, { canvas: a } = this;
4700
4736
  i.suspendHistory();
4701
- const r = G._getSnapshot(n), _t = e, {
4737
+ const r = Z._getSnapshot(n), Nt = e, {
4702
4738
  text: c,
4703
4739
  fontFamily: d,
4704
4740
  fontSize: l,
@@ -4712,17 +4748,17 @@ class G {
4712
4748
  strokeColor: I,
4713
4749
  strokeWidth: y,
4714
4750
  opacity: w,
4715
- backgroundColor: S,
4716
- backgroundOpacity: A,
4751
+ backgroundColor: A,
4752
+ backgroundOpacity: j,
4717
4753
  paddingTop: M,
4718
- paddingRight: C,
4719
- paddingBottom: j,
4720
- paddingLeft: T,
4721
- radiusTopLeft: B,
4722
- radiusTopRight: Z,
4754
+ paddingRight: T,
4755
+ paddingBottom: S,
4756
+ paddingLeft: C,
4757
+ radiusTopLeft: x,
4758
+ radiusTopRight: F,
4723
4759
  radiusBottomRight: U,
4724
- radiusBottomLeft: F
4725
- } = _t, V = gt(_t, [
4760
+ radiusBottomLeft: W
4761
+ } = Nt, V = vt(Nt, [
4726
4762
  "text",
4727
4763
  "fontFamily",
4728
4764
  "fontSize",
@@ -4746,39 +4782,39 @@ class G {
4746
4782
  "radiusTopRight",
4747
4783
  "radiusBottomRight",
4748
4784
  "radiusBottomLeft"
4749
- ]), D = k({}, V), R = co({ textbox: n }), K = R ? this._expandRangeToFullLines({ textbox: n, range: R }) : null, H = {}, z = {}, X = {}, et = ho({ textbox: n, range: R }), q = !R || et, P = !R;
4750
- if (d !== void 0 && (K && (z.fontFamily = d), q && (D.fontFamily = d, P && (X.fontFamily = d))), l !== void 0 && (K && (z.fontSize = l), q && (D.fontSize = l, P && (X.fontSize = l))), u !== void 0) {
4751
- const W = u ? "bold" : "normal";
4752
- R && (H.fontWeight = W), q && (D.fontWeight = W, P && (X.fontWeight = W));
4785
+ ]), L = _({}, V), D = ao({ textbox: n }), z = D ? this._expandRangeToFullLines({ textbox: n, range: D }) : null, H = {}, P = {}, K = {}, $ = co({ textbox: n, range: D }), q = !D || $, Y = !D;
4786
+ if (d !== void 0 && (z && (P.fontFamily = d), q && (L.fontFamily = d, Y && (K.fontFamily = d))), l !== void 0 && (z && (P.fontSize = l), q && (L.fontSize = l, Y && (K.fontSize = l))), u !== void 0) {
4787
+ const X = u ? "bold" : "normal";
4788
+ D && (H.fontWeight = X), q && (L.fontWeight = X, Y && (K.fontWeight = X));
4753
4789
  }
4754
4790
  if (g !== void 0) {
4755
- const W = g ? "italic" : "normal";
4756
- R && (H.fontStyle = W), q && (D.fontStyle = W, P && (X.fontStyle = W));
4791
+ const X = g ? "italic" : "normal";
4792
+ D && (H.fontStyle = X), q && (L.fontStyle = X, Y && (K.fontStyle = X));
4757
4793
  }
4758
- if (f !== void 0 && (R && (H.underline = f), q && (D.underline = f, P && (X.underline = f))), m !== void 0 && (R && (H.linethrough = m), q && (D.linethrough = m, P && (X.linethrough = m))), v !== void 0 && (D.textAlign = v), b !== void 0 && (R && (H.fill = b), q && (D.fill = b, P && (X.fill = b))), I !== void 0 || y !== void 0) {
4759
- const W = R ? qe({ textbox: n, range: R, property: "strokeWidth" }) : void 0, Mt = R ? qe({ textbox: n, range: R, property: "stroke" }) : void 0, Ht = (xt = (Nt = y != null ? y : W) != null ? Nt : n.strokeWidth) != null ? xt : 0, ut = Je({ width: Ht }), Wt = (kt = (dt = I != null ? I : Mt) != null ? dt : n.stroke) != null ? kt : void 0, wt = $e({
4760
- strokeColor: Wt,
4761
- width: ut
4794
+ if (f !== void 0 && (D && (H.underline = f), q && (L.underline = f, Y && (K.underline = f))), m !== void 0 && (D && (H.linethrough = m), q && (L.linethrough = m, Y && (K.linethrough = m))), v !== void 0 && (L.textAlign = v), b !== void 0 && (D && (H.fill = b), q && (L.fill = b, Y && (K.fill = b))), I !== void 0 || y !== void 0) {
4795
+ const X = D ? Ve({ textbox: n, range: D, property: "strokeWidth" }) : void 0, It = D ? Ve({ textbox: n, range: D, property: "stroke" }) : void 0, Wt = (Bt = (xt = y != null ? y : X) != null ? xt : n.strokeWidth) != null ? Bt : 0, mt = Ke({ width: Wt }), Ht = (kt = (ut = I != null ? I : It) != null ? ut : n.stroke) != null ? kt : void 0, Ct = Xe({
4796
+ strokeColor: Ht,
4797
+ width: mt
4762
4798
  });
4763
- R && (H.stroke = wt, H.strokeWidth = ut), q && (D.stroke = wt, D.strokeWidth = ut, P && (X.stroke = wt, X.strokeWidth = ut));
4799
+ D && (H.stroke = Ct, H.strokeWidth = mt), q && (L.stroke = Ct, L.strokeWidth = mt, Y && (K.stroke = Ct, K.strokeWidth = mt));
4764
4800
  }
4765
- w !== void 0 && (D.opacity = w), S !== void 0 && (D.backgroundColor = S), A !== void 0 && (D.backgroundOpacity = A), M !== void 0 && (D.paddingTop = M), C !== void 0 && (D.paddingRight = C), j !== void 0 && (D.paddingBottom = j), T !== void 0 && (D.paddingLeft = T), B !== void 0 && (D.radiusTopLeft = B), Z !== void 0 && (D.radiusTopRight = Z), U !== void 0 && (D.radiusBottomRight = U), F !== void 0 && (D.radiusBottomLeft = F);
4766
- const Q = (ot = n.textCaseRaw) != null ? ot : (lt = n.text) != null ? lt : "", Yt = !!n.uppercase, yt = c !== void 0, vt = yt ? c != null ? c : "" : Q, Rt = p != null ? p : Yt;
4767
- if (yt || Rt !== Yt) {
4768
- const W = Rt ? ne({ value: vt }) : vt;
4769
- D.text = W, n.textCaseRaw = vt;
4801
+ w !== void 0 && (L.opacity = w), A !== void 0 && (L.backgroundColor = A), j !== void 0 && (L.backgroundOpacity = j), M !== void 0 && (L.paddingTop = M), T !== void 0 && (L.paddingRight = T), S !== void 0 && (L.paddingBottom = S), C !== void 0 && (L.paddingLeft = C), x !== void 0 && (L.radiusTopLeft = x), F !== void 0 && (L.radiusTopRight = F), U !== void 0 && (L.radiusBottomRight = U), W !== void 0 && (L.radiusBottomLeft = W);
4802
+ const Q = (it = n.textCaseRaw) != null ? it : (gt = n.text) != null ? gt : "", St = !!n.uppercase, et = c !== void 0, lt = et ? c != null ? c : "" : Q, pt = p != null ? p : St;
4803
+ if (et || pt !== St) {
4804
+ const X = pt ? ie({ value: lt }) : lt;
4805
+ L.text = X, n.textCaseRaw = lt;
4770
4806
  } else n.textCaseRaw === void 0 && (n.textCaseRaw = Q);
4771
- n.uppercase = Rt, n.set(D);
4772
- let bt = !1;
4773
- if (R) {
4774
- const W = oe({ textbox: n, styles: H, range: R }), Mt = K ? oe({ textbox: n, styles: z, range: K }) : !1;
4775
- bt = W || Mt;
4776
- } else if (Object.keys(X).length) {
4777
- const W = lo({ textbox: n });
4778
- W && (bt = oe({ textbox: n, styles: X, range: W }));
4779
- }
4780
- bt && (n.dirty = !0), (S !== void 0 || A !== void 0 || M !== void 0 || C !== void 0 || j !== void 0 || T !== void 0 || B !== void 0 || Z !== void 0 || U !== void 0 || F !== void 0) && (n.dirty = !0), G._roundTextboxDimensions({ textbox: n }) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4781
- const Ft = G._getSnapshot(n);
4807
+ n.uppercase = pt, n.set(L);
4808
+ let ht = !1;
4809
+ if (D) {
4810
+ const X = ne({ textbox: n, styles: H, range: D }), It = z ? ne({ textbox: n, styles: P, range: z }) : !1;
4811
+ ht = X || It;
4812
+ } else if (Object.keys(K).length) {
4813
+ const X = ro({ textbox: n });
4814
+ X && (ht = ne({ textbox: n, styles: K, range: X }));
4815
+ }
4816
+ ht && (n.dirty = !0), (A !== void 0 || j !== void 0 || M !== void 0 || T !== void 0 || S !== void 0 || C !== void 0 || x !== void 0 || F !== void 0 || U !== void 0 || W !== void 0) && (n.dirty = !0), Z._roundTextboxDimensions({ textbox: n }) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4817
+ const Ft = Z._getSnapshot(n);
4782
4818
  return a.fire("editor:text-updated", {
4783
4819
  textbox: n,
4784
4820
  target: t,
@@ -4787,11 +4823,11 @@ class G {
4787
4823
  withoutSave: !!s,
4788
4824
  skipRender: !!o
4789
4825
  },
4790
- updates: D,
4826
+ updates: L,
4791
4827
  before: r,
4792
4828
  after: Ft,
4793
- selectionRange: R != null ? R : void 0,
4794
- selectionStyles: R && Object.keys(H).length ? H : void 0
4829
+ selectionRange: D != null ? D : void 0,
4830
+ selectionStyles: D && Object.keys(H).length ? H : void 0
4795
4831
  }), n;
4796
4832
  }
4797
4833
  /**
@@ -4805,14 +4841,14 @@ class G {
4805
4841
  * Возвращает активный текст или ищет по id.
4806
4842
  */
4807
4843
  _resolveTextObject(t) {
4808
- if (t instanceof st) return t;
4844
+ if (t instanceof nt) return t;
4809
4845
  const { canvas: e } = this;
4810
4846
  if (!t) {
4811
4847
  const s = e.getActiveObject();
4812
- return G._isTextbox(s) ? s : null;
4848
+ return Z._isTextbox(s) ? s : null;
4813
4849
  }
4814
4850
  if (typeof t == "string") {
4815
- const s = e.getObjects().find((o) => G._isTextbox(o) && o.id === t);
4851
+ const s = e.getObjects().find((o) => Z._isTextbox(o) && o.id === t);
4816
4852
  return s != null ? s : null;
4817
4853
  }
4818
4854
  return null;
@@ -4821,7 +4857,7 @@ class G {
4821
4857
  * Проверяет, является ли объект текстовым блоком редактора.
4822
4858
  */
4823
4859
  static _isTextbox(t) {
4824
- return !!t && t instanceof st;
4860
+ return !!t && t instanceof nt;
4825
4861
  }
4826
4862
  /**
4827
4863
  * Вешает обработчики событий Fabric для работы с текстом.
@@ -4914,10 +4950,10 @@ class G {
4914
4950
  static _roundTextboxDimensions({
4915
4951
  textbox: t
4916
4952
  }) {
4917
- const { width: e, height: s, calcTextWidth: o, calcTextHeight: n } = t, i = typeof o == "function" ? o.call(t) : void 0, a = typeof n == "function" ? n.call(t) : void 0, r = G._resolveDimension({
4953
+ const { width: e, height: s, calcTextWidth: o, calcTextHeight: n } = t, i = typeof o == "function" ? o.call(t) : void 0, a = typeof n == "function" ? n.call(t) : void 0, r = Z._resolveDimension({
4918
4954
  rawValue: e,
4919
4955
  calculatedValue: i
4920
- }), c = G._resolveDimension({
4956
+ }), c = Z._resolveDimension({
4921
4957
  rawValue: s,
4922
4958
  calculatedValue: a
4923
4959
  }), d = Number.isFinite(r) ? Math.round(r) : null, l = Number.isFinite(c) ? Math.round(c) : null, u = {};
@@ -4929,10 +4965,10 @@ class G {
4929
4965
  static _getSnapshot(t) {
4930
4966
  const e = ({
4931
4967
  snapshot: H,
4932
- entries: z
4968
+ entries: P
4933
4969
  }) => {
4934
- Object.entries(z).forEach(([X, et]) => {
4935
- et != null && (H[X] = et);
4970
+ Object.entries(P).forEach(([K, $]) => {
4971
+ $ != null && (H[K] = $);
4936
4972
  });
4937
4973
  }, {
4938
4974
  id: s,
@@ -4954,26 +4990,26 @@ class G {
4954
4990
  backgroundOpacity: I,
4955
4991
  paddingTop: y,
4956
4992
  paddingRight: w,
4957
- paddingBottom: S,
4958
- paddingLeft: A,
4993
+ paddingBottom: A,
4994
+ paddingLeft: j,
4959
4995
  radiusTopLeft: M,
4960
- radiusTopRight: C,
4961
- radiusBottomRight: j,
4962
- radiusBottomLeft: T,
4963
- left: B,
4964
- top: Z,
4996
+ radiusTopRight: T,
4997
+ radiusBottomRight: S,
4998
+ radiusBottomLeft: C,
4999
+ left: x,
5000
+ top: F,
4965
5001
  width: U,
4966
- height: F,
5002
+ height: W,
4967
5003
  angle: V,
4968
- scaleX: D,
4969
- scaleY: R
4970
- } = t, K = {
5004
+ scaleX: L,
5005
+ scaleY: D
5006
+ } = t, z = {
4971
5007
  id: s,
4972
5008
  uppercase: !!i,
4973
5009
  textAlign: g
4974
5010
  };
4975
5011
  return e({
4976
- snapshot: K,
5012
+ snapshot: z,
4977
5013
  entries: {
4978
5014
  text: o,
4979
5015
  textCaseRaw: n,
@@ -4991,21 +5027,21 @@ class G {
4991
5027
  backgroundOpacity: I,
4992
5028
  paddingTop: y,
4993
5029
  paddingRight: w,
4994
- paddingBottom: S,
4995
- paddingLeft: A,
5030
+ paddingBottom: A,
5031
+ paddingLeft: j,
4996
5032
  radiusTopLeft: M,
4997
- radiusTopRight: C,
4998
- radiusBottomRight: j,
4999
- radiusBottomLeft: T,
5000
- left: B,
5001
- top: Z,
5033
+ radiusTopRight: T,
5034
+ radiusBottomRight: S,
5035
+ radiusBottomLeft: C,
5036
+ left: x,
5037
+ top: F,
5002
5038
  width: U,
5003
- height: F,
5039
+ height: W,
5004
5040
  angle: V,
5005
- scaleX: D,
5006
- scaleY: R
5041
+ scaleX: L,
5042
+ scaleY: D
5007
5043
  }
5008
- }), K;
5044
+ }), z;
5009
5045
  }
5010
5046
  /**
5011
5047
  * Возвращает первый доступный шрифт или дефолтный Arial.
@@ -5015,17 +5051,17 @@ class G {
5015
5051
  return (e = (t = this.fonts[0]) == null ? void 0 : t.family) != null ? e : "Arial";
5016
5052
  }
5017
5053
  }
5018
- const tt = ({
5054
+ const ot = ({
5019
5055
  value: h,
5020
5056
  fallback: t = 0
5021
- }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, Qt = ({
5057
+ }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, Kt = ({
5022
5058
  value: h,
5023
5059
  dimension: t,
5024
5060
  useRelativePositions: e
5025
5061
  }) => {
5026
- const s = tt({ value: h });
5062
+ const s = ot({ value: h });
5027
5063
  return e ? s : s / (t || 1);
5028
- }, uo = ({
5064
+ }, lo = ({
5029
5065
  object: h,
5030
5066
  baseWidth: t,
5031
5067
  baseHeight: e,
@@ -5035,31 +5071,31 @@ const tt = ({
5035
5071
  const n = h;
5036
5072
  if (typeof n[o.x] == "number" && typeof n[o.y] == "number")
5037
5073
  return {
5038
- x: Qt({
5074
+ x: Kt({
5039
5075
  value: n[o.x],
5040
5076
  dimension: t,
5041
5077
  useRelativePositions: s
5042
5078
  }),
5043
- y: Qt({
5079
+ y: Kt({
5044
5080
  value: n[o.y],
5045
5081
  dimension: e,
5046
5082
  useRelativePositions: s
5047
5083
  })
5048
5084
  };
5049
- const { left: a, top: r, width: c, height: d } = h, l = Qt({
5085
+ const { left: a, top: r, width: c, height: d } = h, l = Kt({
5050
5086
  value: a,
5051
5087
  dimension: t,
5052
5088
  useRelativePositions: s
5053
- }), u = Qt({
5089
+ }), u = Kt({
5054
5090
  value: r,
5055
5091
  dimension: e,
5056
5092
  useRelativePositions: s
5057
- }), g = tt({ value: c }) / (t || 1), f = tt({ value: d }) / (e || 1);
5093
+ }), g = ot({ value: c }) / (t || 1), f = ot({ value: d }) / (e || 1);
5058
5094
  return {
5059
5095
  x: l + g / 2,
5060
5096
  y: u + f / 2
5061
5097
  };
5062
- }, go = ({
5098
+ }, ho = ({
5063
5099
  normalizedX: h,
5064
5100
  normalizedY: t,
5065
5101
  bounds: e,
@@ -5069,11 +5105,11 @@ const tt = ({
5069
5105
  const { left: n, top: i, width: a, height: r } = e;
5070
5106
  if (!o) {
5071
5107
  const { width: l, height: u } = s, g = n + h * (l || a), f = i + t * (u || r);
5072
- return new J(g, f);
5108
+ return new tt(g, f);
5073
5109
  }
5074
5110
  const c = n + h * a, d = i + t * r;
5075
- return new J(c, d);
5076
- }, fo = ({
5111
+ return new tt(c, d);
5112
+ }, uo = ({
5077
5113
  object: h,
5078
5114
  montageArea: t,
5079
5115
  bounds: e
@@ -5088,7 +5124,7 @@ const tt = ({
5088
5124
  } catch (s) {
5089
5125
  return null;
5090
5126
  }
5091
- }, ht = ({
5127
+ }, ft = ({
5092
5128
  object: h
5093
5129
  }) => {
5094
5130
  if (!h) return null;
@@ -5111,12 +5147,12 @@ const tt = ({
5111
5147
  } catch (t) {
5112
5148
  return null;
5113
5149
  }
5114
- }, po = ({
5150
+ }, go = ({
5115
5151
  x1: h,
5116
5152
  y1: t,
5117
5153
  x2: e,
5118
5154
  y2: s
5119
- }) => (Math.atan2(s - t, e - h) * 180 / Math.PI + 360) % 360, mo = (h) => {
5155
+ }) => (Math.atan2(s - t, e - h) * 180 / Math.PI + 360) % 360, fo = (h) => {
5120
5156
  if (!h || typeof h != "object") return null;
5121
5157
  const { type: t, coords: e, colorStops: s } = h, o = Array.isArray(s) ? s : [], n = o[0], i = o[o.length - 1], a = typeof (n == null ? void 0 : n.color) == "string" ? n.color : void 0, r = typeof (i == null ? void 0 : i.color) == "string" ? i.color : a, c = typeof (n == null ? void 0 : n.offset) == "number" ? n.offset * 100 : void 0, d = typeof (i == null ? void 0 : i.offset) == "number" ? i.offset * 100 : void 0;
5122
5158
  if (!a || !r || !e) return null;
@@ -5125,7 +5161,7 @@ const tt = ({
5125
5161
  if (typeof l == "number" && typeof u == "number" && typeof g == "number" && typeof f == "number")
5126
5162
  return {
5127
5163
  type: "linear",
5128
- angle: po({ x1: l, y1: u, x2: g, y2: f }),
5164
+ angle: go({ x1: l, y1: u, x2: g, y2: f }),
5129
5165
  startColor: a,
5130
5166
  endColor: r,
5131
5167
  startPosition: c,
@@ -5147,8 +5183,8 @@ const tt = ({
5147
5183
  };
5148
5184
  }
5149
5185
  return null;
5150
- }, ie = "_templateCenterX", ae = "_templateCenterY", re = "_templateAnchorX", ce = "_templateAnchorY";
5151
- class L {
5186
+ }, ae = "_templateCenterX", re = "_templateCenterY", ce = "_templateAnchorX", de = "_templateAnchorY";
5187
+ class R {
5152
5188
  constructor({ editor: t }) {
5153
5189
  this.editor = t;
5154
5190
  }
@@ -5167,28 +5203,28 @@ class L {
5167
5203
  montageArea: i,
5168
5204
  errorManager: a,
5169
5205
  backgroundManager: r
5170
- } = this.editor, c = n.getActiveObject(), d = L._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, u = o && l ? [l] : [], g = [...d, ...u];
5206
+ } = this.editor, c = n.getActiveObject(), d = R._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, u = o && l ? [l] : [], g = [...d, ...u];
5171
5207
  if (!g.length)
5172
5208
  return a.emitWarning({
5173
5209
  origin: "TemplateManager",
5174
5210
  method: "serializeSelection",
5175
- code: ft.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
5211
+ code: bt.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
5176
5212
  message: "Нет объектов для сериализации шаблона"
5177
5213
  }), null;
5178
- const f = L._getBounds(i), p = L._getMontageSize({ montageArea: i, bounds: f }), m = p.width, v = p.height, b = g.map((w) => L._serializeObject({
5214
+ const f = R._getBounds(i), p = R._getMontageSize({ montageArea: i, bounds: f }), m = p.width, v = p.height, b = g.map((w) => R._serializeObject({
5179
5215
  object: w,
5180
5216
  bounds: f,
5181
5217
  baseWidth: m,
5182
5218
  baseHeight: v,
5183
5219
  montageArea: i != null ? i : null
5184
- })), I = jt(k({}, s), {
5220
+ })), I = yt(_({}, s), {
5185
5221
  baseWidth: m,
5186
5222
  baseHeight: v,
5187
5223
  positionsNormalized: !0,
5188
5224
  previewId: e != null ? e : s.previewId
5189
5225
  });
5190
5226
  return {
5191
- id: t != null ? t : `template-${Y()}`,
5227
+ id: t != null ? t : `template-${G()}`,
5192
5228
  meta: I,
5193
5229
  objects: b
5194
5230
  };
@@ -5200,7 +5236,7 @@ class L {
5200
5236
  * @param options.data - данные для заполнения текстов по customData.templateField
5201
5237
  */
5202
5238
  applyTemplate(s) {
5203
- return _(this, arguments, function* ({
5239
+ return N(this, arguments, function* ({
5204
5240
  template: t,
5205
5241
  data: e
5206
5242
  }) {
@@ -5215,37 +5251,37 @@ class L {
5215
5251
  return a.emitWarning({
5216
5252
  origin: "TemplateManager",
5217
5253
  method: "applyTemplate",
5218
- code: ft.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5254
+ code: bt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5219
5255
  message: "Шаблон не содержит объектов"
5220
5256
  }), null;
5221
- const u = L._getBounds(n);
5257
+ const u = R._getBounds(n);
5222
5258
  if (!u)
5223
5259
  return a.emitWarning({
5224
5260
  origin: "TemplateManager",
5225
5261
  method: "applyTemplate",
5226
- code: ft.TEMPLATE_MANAGER.INVALID_TARGET,
5262
+ code: bt.TEMPLATE_MANAGER.INVALID_TARGET,
5227
5263
  message: "Не удалось определить границы монтажной области"
5228
5264
  }), null;
5229
- const g = L._getMontageSize({ montageArea: n, bounds: u }), f = L._normalizeMeta({ meta: d, fallback: g }), p = L._calculateScale({ meta: f, target: g }), m = !!f.positionsNormalized;
5265
+ const g = R._getMontageSize({ montageArea: n, bounds: u }), f = R._normalizeMeta({ meta: d, fallback: g }), p = R._calculateScale({ meta: f, target: g }), m = !!f.positionsNormalized;
5230
5266
  let v = !1, b = !1;
5231
5267
  i.suspendHistory();
5232
5268
  try {
5233
- const I = yield L._enlivenObjects(c);
5269
+ const I = yield R._enlivenObjects(c);
5234
5270
  if (!I.length)
5235
5271
  return a.emitWarning({
5236
5272
  origin: "TemplateManager",
5237
5273
  method: "applyTemplate",
5238
- code: ft.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5274
+ code: bt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5239
5275
  message: "Не удалось создать объекты шаблона"
5240
5276
  }), null;
5241
- const { backgroundObject: y, contentObjects: w } = L._extractBackgroundObject(I);
5242
- y && (b = yield L._applyBackgroundFromObject({
5277
+ const { backgroundObject: y, contentObjects: w } = R._extractBackgroundObject(I);
5278
+ y && (b = yield R._applyBackgroundFromObject({
5243
5279
  backgroundObject: y,
5244
5280
  backgroundManager: r,
5245
5281
  errorManager: a
5246
5282
  }));
5247
- const S = w.map((A) => (L._applyTextOverrides({ object: A, data: e }), L._transformObject({
5248
- object: A,
5283
+ const A = w.map((j) => (R._applyTextOverrides({ object: j, data: e }), R._transformObject({
5284
+ object: j,
5249
5285
  scale: p,
5250
5286
  bounds: u,
5251
5287
  targetSize: g,
@@ -5253,20 +5289,20 @@ class L {
5253
5289
  baseHeight: f.baseHeight,
5254
5290
  montageArea: n,
5255
5291
  useRelativePositions: m
5256
- }), A.set({
5257
- id: `${A.type}-${Y()}`,
5292
+ }), j.set({
5293
+ id: `${j.type}-${G()}`,
5258
5294
  evented: !0
5259
- }), o.add(A), A));
5260
- return !S.length && !b ? null : (v = S.length > 0 || b, S.length && L._activateObjects({ canvas: o, objects: S }), o.requestRenderAll(), o.fire("editor:template-applied", {
5295
+ }), o.add(j), j));
5296
+ return !A.length && !b ? null : (v = A.length > 0 || b, A.length && R._activateObjects({ canvas: o, objects: A }), o.requestRenderAll(), o.fire("editor:template-applied", {
5261
5297
  template: t,
5262
- objects: S,
5298
+ objects: A,
5263
5299
  bounds: u
5264
- }), S);
5300
+ }), A);
5265
5301
  } catch (I) {
5266
5302
  return a.emitError({
5267
5303
  origin: "TemplateManager",
5268
5304
  method: "applyTemplate",
5269
- code: ft.TEMPLATE_MANAGER.APPLY_FAILED,
5305
+ code: bt.TEMPLATE_MANAGER.APPLY_FAILED,
5270
5306
  message: "Ошибка применения шаблона",
5271
5307
  data: {
5272
5308
  templateId: l,
@@ -5282,7 +5318,7 @@ class L {
5282
5318
  * Подготавливает объекты для сериализации.
5283
5319
  */
5284
5320
  static _collectObjects(t) {
5285
- return t ? t instanceof x ? t.getObjects() : [t] : [];
5321
+ return t ? t instanceof k ? t.getObjects() : [t] : [];
5286
5322
  }
5287
5323
  /**
5288
5324
  * Возвращает габариты объекта.
@@ -5306,15 +5342,15 @@ class L {
5306
5342
  * Превращает plain-описание объектов в Fabric объекты.
5307
5343
  */
5308
5344
  static _enlivenObjects(t) {
5309
- return _(this, null, function* () {
5310
- return (yield Promise.all(t.map((s) => _(null, null, function* () {
5311
- if (L._hasSerializedSvgMarkup(s)) {
5312
- const i = yield L._reviveSvgObject(s);
5345
+ return N(this, null, function* () {
5346
+ return (yield Promise.all(t.map((s) => N(null, null, function* () {
5347
+ if (R._hasSerializedSvgMarkup(s)) {
5348
+ const i = yield R._reviveSvgObject(s);
5313
5349
  if (i)
5314
- return L._restoreImageScale({ revived: i, serialized: s }), i;
5350
+ return R._restoreImageScale({ revived: i, serialized: s }), i;
5315
5351
  }
5316
- const o = yield ct.enlivenObjects([s]), n = o == null ? void 0 : o[0];
5317
- return n ? (L._restoreImageScale({ revived: n, serialized: s }), n) : null;
5352
+ const o = yield dt.enlivenObjects([s]), n = o == null ? void 0 : o[0];
5353
+ return n ? (R._restoreImageScale({ revived: n, serialized: s }), n) : null;
5318
5354
  })))).filter((s) => !!s);
5319
5355
  });
5320
5356
  }
@@ -5341,8 +5377,8 @@ class L {
5341
5377
  naturalHeight: 0,
5342
5378
  width: 0,
5343
5379
  height: 0
5344
- }, f = tt({ value: d || u || r.width, fallback: 0 }), p = tt({ value: l || g || r.height, fallback: 0 }), m = tt({ value: o, fallback: f }), v = tt({ value: n, fallback: p }), b = tt({ value: i, fallback: r.scaleX || 1 }), I = tt({ value: a, fallback: r.scaleY || 1 }), y = m * b, w = v * I, S = f ? y / f : null, A = p ? w / p : null, M = {};
5345
- f > 0 && (M.width = f), p > 0 && (M.height = p), S && S > 0 && (M.scaleX = S), A && A > 0 && (M.scaleY = A), r.set(M);
5380
+ }, f = ot({ value: d || u || r.width, fallback: 0 }), p = ot({ value: l || g || r.height, fallback: 0 }), m = ot({ value: o, fallback: f }), v = ot({ value: n, fallback: p }), b = ot({ value: i, fallback: r.scaleX || 1 }), I = ot({ value: a, fallback: r.scaleY || 1 }), y = m * b, w = v * I, A = f ? y / f : null, j = p ? w / p : null, M = {};
5381
+ f > 0 && (M.width = f), p > 0 && (M.height = p), A && A > 0 && (M.scaleX = A), j && j > 0 && (M.scaleY = j), r.set(M);
5346
5382
  }
5347
5383
  /**
5348
5384
  * Проверяет, содержит ли сериализованный объект инлайн SVG.
@@ -5354,12 +5390,12 @@ class L {
5354
5390
  * Восстанавливает SVG-объект из компактного описания.
5355
5391
  */
5356
5392
  static _reviveSvgObject(t) {
5357
- return _(this, null, function* () {
5393
+ return N(this, null, function* () {
5358
5394
  const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
5359
5395
  if (!e) return null;
5360
5396
  try {
5361
- const s = yield bs(e), o = ct.groupSVGElements(s.objects, s.options), n = yield ct.enlivenObjectEnlivables(
5362
- L._prepareSerializableProps(t)
5397
+ const s = yield ys(e), o = dt.groupSVGElements(s.objects, s.options), n = yield dt.enlivenObjectEnlivables(
5398
+ R._prepareSerializableProps(t)
5363
5399
  );
5364
5400
  return o.set(n), o.setCoords(), o;
5365
5401
  } catch (s) {
@@ -5371,7 +5407,7 @@ class L {
5371
5407
  * Убирает технические поля сериализации, оставляя только применимые свойства.
5372
5408
  */
5373
5409
  static _prepareSerializableProps(t) {
5374
- const e = k({}, t);
5410
+ const e = _({}, t);
5375
5411
  return delete e.svgMarkup, delete e.objects, delete e.path, delete e.paths, delete e.type, delete e.version, e;
5376
5412
  }
5377
5413
  /**
@@ -5417,24 +5453,24 @@ class L {
5417
5453
  montageArea: a,
5418
5454
  useRelativePositions: r
5419
5455
  }) {
5420
- const c = t, { x: d, y: l } = uo({
5456
+ const c = t, { x: d, y: l } = lo({
5421
5457
  object: t,
5422
5458
  baseWidth: n,
5423
5459
  baseHeight: i,
5424
5460
  useRelativePositions: r,
5425
5461
  centerKeys: {
5426
- x: ie,
5427
- y: ae
5462
+ x: ae,
5463
+ y: re
5428
5464
  }
5429
- }), { scaleX: u, scaleY: g } = t, f = tt({ value: u, fallback: 1 }), p = tt({ value: g, fallback: 1 }), m = L._getPositioningBounds({
5465
+ }), { scaleX: u, scaleY: g } = t, f = ot({ value: u, fallback: 1 }), p = ot({ value: g, fallback: 1 }), m = R._getPositioningBounds({
5430
5466
  bounds: s,
5431
5467
  baseWidth: n,
5432
5468
  baseHeight: i,
5433
5469
  scale: e,
5434
5470
  useRelativePositions: r,
5435
- anchorX: L._resolveAnchor(c, re),
5436
- anchorY: L._resolveAnchor(c, ce)
5437
- }), v = go({
5471
+ anchorX: R._resolveAnchor(c, ce),
5472
+ anchorY: R._resolveAnchor(c, de)
5473
+ }), v = ho({
5438
5474
  normalizedX: d,
5439
5475
  normalizedY: l,
5440
5476
  bounds: m,
@@ -5444,7 +5480,7 @@ class L {
5444
5480
  t.set({
5445
5481
  scaleX: b,
5446
5482
  scaleY: I
5447
- }), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[ie], delete c[ae], delete c[re], delete c[ce];
5483
+ }), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[ae], delete c[re], delete c[ce], delete c[de];
5448
5484
  }
5449
5485
  /**
5450
5486
  * Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
@@ -5460,7 +5496,7 @@ class L {
5460
5496
  anchorY: a
5461
5497
  }) {
5462
5498
  if (!n) return t;
5463
- const r = (e || t.width) * o, c = (s || t.height) * o, d = t.width - r, l = t.height - c, u = t.left + L._calculateAnchorOffset(i, d), g = t.top + L._calculateAnchorOffset(a, l);
5499
+ const r = (e || t.width) * o, c = (s || t.height) * o, d = t.width - r, l = t.height - c, u = t.left + R._calculateAnchorOffset(i, d), g = t.top + R._calculateAnchorOffset(a, l);
5464
5500
  return {
5465
5501
  left: u,
5466
5502
  top: g,
@@ -5494,8 +5530,8 @@ class L {
5494
5530
  meta: t,
5495
5531
  fallback: e
5496
5532
  }) {
5497
- const { width: s, height: o } = e, r = t || {}, { baseWidth: n = s, baseHeight: i = o } = r, a = gt(r, ["baseWidth", "baseHeight"]);
5498
- return k({
5533
+ const { width: s, height: o } = e, r = t || {}, { baseWidth: n = s, baseHeight: i = o } = r, a = vt(r, ["baseWidth", "baseHeight"]);
5534
+ return _({
5499
5535
  baseWidth: n,
5500
5536
  baseHeight: i
5501
5537
  }, a);
@@ -5522,7 +5558,7 @@ class L {
5522
5558
  t.setActiveObject(e[0]);
5523
5559
  return;
5524
5560
  }
5525
- const s = new x(e, { canvas: t });
5561
+ const s = new k(e, { canvas: t });
5526
5562
  t.setActiveObject(s);
5527
5563
  }
5528
5564
  /**
@@ -5546,9 +5582,9 @@ class L {
5546
5582
  baseHeight: o,
5547
5583
  montageArea: n
5548
5584
  }) {
5549
- const i = t.toDatalessObject([...as]);
5550
- if (L._isSvgObject(t)) {
5551
- const y = L._extractSvgMarkup(t);
5585
+ const i = t.toDatalessObject([...ss]);
5586
+ if (R._isSvgObject(t)) {
5587
+ const y = R._extractSvgMarkup(t);
5552
5588
  y && (i.svgMarkup = y, delete i.objects, delete i.path);
5553
5589
  }
5554
5590
  if (!e) return i;
@@ -5557,7 +5593,7 @@ class L {
5557
5593
  top: r,
5558
5594
  width: c,
5559
5595
  height: d
5560
- } = e, l = t.getBoundingRect(!1, !0), u = s || c || 1, g = o || d || 1, f = fo({
5596
+ } = e, l = t.getBoundingRect(!1, !0), u = s || c || 1, g = o || d || 1, f = uo({
5561
5597
  object: t,
5562
5598
  montageArea: n,
5563
5599
  bounds: e
@@ -5568,11 +5604,11 @@ class L {
5568
5604
  y: (y.y - r) / g
5569
5605
  };
5570
5606
  })(), m = (l.left - a) / u, v = (l.top - r) / g, b = m + l.width / u, I = v + l.height / g;
5571
- return i[ie] = p.x, i[ae] = p.y, i[re] = L._detectAnchor({
5607
+ return i[ae] = p.x, i[re] = p.y, i[ce] = R._detectAnchor({
5572
5608
  center: p.x,
5573
5609
  start: m,
5574
5610
  end: b
5575
- }), i[ce] = L._detectAnchor({
5611
+ }), i[de] = R._detectAnchor({
5576
5612
  center: p.y,
5577
5613
  start: v,
5578
5614
  end: I
@@ -5592,13 +5628,13 @@ class L {
5592
5628
  * Применяет фоновый объект шаблона к текущему холсту через BackgroundManager.
5593
5629
  */
5594
5630
  static _applyBackgroundFromObject(o) {
5595
- return _(this, arguments, function* ({
5631
+ return N(this, arguments, function* ({
5596
5632
  backgroundObject: t,
5597
5633
  backgroundManager: e,
5598
5634
  errorManager: s
5599
5635
  }) {
5600
5636
  try {
5601
- const { fill: n, customData: i } = t, { backgroundType: a } = t, r = L._cloneCustomData(i);
5637
+ const { fill: n, customData: i } = t, { backgroundType: a } = t, r = R._cloneCustomData(i);
5602
5638
  if (a === "color" && typeof n == "string")
5603
5639
  return e.setColorBackground({
5604
5640
  color: n,
@@ -5606,7 +5642,7 @@ class L {
5606
5642
  withoutSave: !0
5607
5643
  }), !0;
5608
5644
  if (a === "gradient") {
5609
- const c = mo(n);
5645
+ const c = fo(n);
5610
5646
  if (c)
5611
5647
  return e.setGradientBackground({
5612
5648
  gradient: c,
@@ -5615,7 +5651,7 @@ class L {
5615
5651
  }), !0;
5616
5652
  }
5617
5653
  if (a === "image") {
5618
- const c = L._getImageSource(t);
5654
+ const c = R._getImageSource(t);
5619
5655
  if (c)
5620
5656
  return yield e.setImageBackground({
5621
5657
  imageSource: c,
@@ -5627,7 +5663,7 @@ class L {
5627
5663
  s.emitWarning({
5628
5664
  origin: "TemplateManager",
5629
5665
  method: "applyTemplate",
5630
- code: ft.TEMPLATE_MANAGER.APPLY_FAILED,
5666
+ code: bt.TEMPLATE_MANAGER.APPLY_FAILED,
5631
5667
  message: "Не удалось применить фон из шаблона",
5632
5668
  data: n
5633
5669
  });
@@ -5657,7 +5693,7 @@ class L {
5657
5693
  */
5658
5694
  static _cloneCustomData(t) {
5659
5695
  if (!(!t || typeof t != "object"))
5660
- return k({}, t);
5696
+ return _({}, t);
5661
5697
  }
5662
5698
  /**
5663
5699
  * Извлекает src изображения из FabricImage или его исходного элемента.
@@ -5683,10 +5719,10 @@ class L {
5683
5719
  */
5684
5720
  // eslint-disable-next-line class-methods-use-this
5685
5721
  enlivenObjectEnlivables(t) {
5686
- return ct.enlivenObjectEnlivables(t);
5722
+ return dt.enlivenObjectEnlivables(t);
5687
5723
  }
5688
5724
  }
5689
- const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
5725
+ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5690
5726
  anchors: h,
5691
5727
  positions: t,
5692
5728
  threshold: e
@@ -5701,16 +5737,16 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
5701
5737
  delta: s,
5702
5738
  guidePosition: n
5703
5739
  };
5704
- }, vo = ({
5740
+ }, mo = ({
5705
5741
  activeBounds: h,
5706
5742
  threshold: t,
5707
5743
  anchors: e
5708
5744
  }) => {
5709
- const { left: s, right: o, centerX: n, top: i, bottom: a, centerY: r } = h, c = ts({
5745
+ const { left: s, right: o, centerX: n, top: i, bottom: a, centerY: r } = h, c = Qe({
5710
5746
  anchors: e.vertical,
5711
5747
  positions: [s, n, o],
5712
5748
  threshold: t
5713
- }), d = ts({
5749
+ }), d = Qe({
5714
5750
  anchors: e.horizontal,
5715
5751
  positions: [i, r, a],
5716
5752
  threshold: t
@@ -5726,7 +5762,7 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
5726
5762
  deltaY: d.delta,
5727
5763
  guides: l
5728
5764
  };
5729
- }, cs = ({
5765
+ }, ns = ({
5730
5766
  activeBounds: h,
5731
5767
  aligned: t,
5732
5768
  threshold: e,
@@ -5798,7 +5834,7 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
5798
5834
  }
5799
5835
  }
5800
5836
  return c;
5801
- }, bo = ({
5837
+ }, yo = ({
5802
5838
  activeBounds: h,
5803
5839
  candidates: t,
5804
5840
  threshold: e,
@@ -5823,54 +5859,54 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
5823
5859
  return { delta: 0, guide: null };
5824
5860
  const u = d[l - 1], g = d[l - 2], f = d[l + 1], p = d[l + 2], m = [], v = i - n;
5825
5861
  if (u && g) {
5826
- const { bounds: y } = u, { bounds: w } = g, S = y.top - w.bottom, A = n - y.bottom, M = Math.abs(A - S);
5862
+ const { bounds: y } = u, { bounds: w } = g, A = y.top - w.bottom, j = n - y.bottom, M = Math.abs(j - A);
5827
5863
  if (M <= e) {
5828
- const C = S - A, j = n + C, T = {
5864
+ const T = A - j, S = n + T, C = {
5829
5865
  type: "vertical",
5830
5866
  axis: o,
5831
5867
  refStart: w.bottom,
5832
5868
  refEnd: y.top,
5833
5869
  activeStart: y.bottom,
5834
- activeEnd: j,
5835
- distance: S
5870
+ activeEnd: S,
5871
+ distance: A
5836
5872
  };
5837
- m.push({ delta: C, guide: T, diff: M });
5873
+ m.push({ delta: T, guide: C, diff: M });
5838
5874
  }
5839
5875
  }
5840
5876
  if (f && p) {
5841
- const { bounds: y } = f, { bounds: w } = p, S = w.top - y.bottom, A = y.top - i, M = Math.abs(A - S);
5877
+ const { bounds: y } = f, { bounds: w } = p, A = w.top - y.bottom, j = y.top - i, M = Math.abs(j - A);
5842
5878
  if (M <= e) {
5843
- const C = A - S, j = i + C, T = {
5879
+ const T = j - A, S = i + T, C = {
5844
5880
  type: "vertical",
5845
5881
  axis: o,
5846
5882
  refStart: y.bottom,
5847
5883
  refEnd: w.top,
5848
- activeStart: j,
5884
+ activeStart: S,
5849
5885
  activeEnd: y.top,
5850
- distance: S
5886
+ distance: A
5851
5887
  };
5852
- m.push({ delta: C, guide: T, diff: M });
5888
+ m.push({ delta: T, guide: C, diff: M });
5853
5889
  }
5854
5890
  }
5855
5891
  if (u && f) {
5856
- const { bounds: y } = u, { bounds: w } = f, A = w.top - y.bottom - v;
5857
- if (A >= 0) {
5858
- const M = A / 2, C = n - y.bottom, j = w.top - i, T = Math.abs(C - M), B = Math.abs(j - M), Z = Math.max(T, B);
5859
- if (Z <= e) {
5860
- const U = M - C, F = i + U, V = {
5892
+ const { bounds: y } = u, { bounds: w } = f, j = w.top - y.bottom - v;
5893
+ if (j >= 0) {
5894
+ const M = j / 2, T = n - y.bottom, S = w.top - i, C = Math.abs(T - M), x = Math.abs(S - M), F = Math.max(C, x);
5895
+ if (F <= e) {
5896
+ const U = M - T, W = i + U, V = {
5861
5897
  type: "vertical",
5862
5898
  axis: o,
5863
5899
  refStart: y.bottom,
5864
5900
  refEnd: y.bottom + M,
5865
- activeStart: F,
5866
- activeEnd: F + M,
5901
+ activeStart: W,
5902
+ activeEnd: W + M,
5867
5903
  distance: M
5868
5904
  };
5869
- m.push({ delta: U, guide: V, diff: Z });
5905
+ m.push({ delta: U, guide: V, diff: F });
5870
5906
  }
5871
5907
  }
5872
5908
  }
5873
- const b = cs({
5909
+ const b = ns({
5874
5910
  activeBounds: h,
5875
5911
  aligned: c,
5876
5912
  threshold: e,
@@ -5884,7 +5920,7 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
5884
5920
  delta: I.delta,
5885
5921
  guide: I.guide
5886
5922
  };
5887
- }, Mo = ({
5923
+ }, vo = ({
5888
5924
  activeBounds: h,
5889
5925
  candidates: t,
5890
5926
  threshold: e,
@@ -5909,54 +5945,54 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
5909
5945
  return { delta: 0, guide: null };
5910
5946
  const u = d[l - 1], g = d[l - 2], f = d[l + 1], p = d[l + 2], m = [], v = i - n;
5911
5947
  if (u && g) {
5912
- const { bounds: y } = u, { bounds: w } = g, S = y.left - w.right, A = n - y.right, M = Math.abs(A - S);
5948
+ const { bounds: y } = u, { bounds: w } = g, A = y.left - w.right, j = n - y.right, M = Math.abs(j - A);
5913
5949
  if (M <= e) {
5914
- const C = S - A, j = n + C, T = {
5950
+ const T = A - j, S = n + T, C = {
5915
5951
  type: "horizontal",
5916
5952
  axis: o,
5917
5953
  refStart: w.right,
5918
5954
  refEnd: y.left,
5919
5955
  activeStart: y.right,
5920
- activeEnd: j,
5921
- distance: S
5956
+ activeEnd: S,
5957
+ distance: A
5922
5958
  };
5923
- m.push({ delta: C, guide: T, diff: M });
5959
+ m.push({ delta: T, guide: C, diff: M });
5924
5960
  }
5925
5961
  }
5926
5962
  if (f && p) {
5927
- const { bounds: y } = f, { bounds: w } = p, S = w.left - y.right, A = y.left - i, M = Math.abs(A - S);
5963
+ const { bounds: y } = f, { bounds: w } = p, A = w.left - y.right, j = y.left - i, M = Math.abs(j - A);
5928
5964
  if (M <= e) {
5929
- const C = A - S, j = i + C, T = {
5965
+ const T = j - A, S = i + T, C = {
5930
5966
  type: "horizontal",
5931
5967
  axis: o,
5932
5968
  refStart: y.right,
5933
5969
  refEnd: w.left,
5934
- activeStart: j,
5970
+ activeStart: S,
5935
5971
  activeEnd: y.left,
5936
- distance: S
5972
+ distance: A
5937
5973
  };
5938
- m.push({ delta: C, guide: T, diff: M });
5974
+ m.push({ delta: T, guide: C, diff: M });
5939
5975
  }
5940
5976
  }
5941
5977
  if (u && f) {
5942
- const { bounds: y } = u, { bounds: w } = f, A = w.left - y.right - v;
5943
- if (A >= 0) {
5944
- const M = A / 2, C = n - y.right, j = w.left - i, T = Math.abs(C - M), B = Math.abs(j - M), Z = Math.max(T, B);
5945
- if (Z <= e) {
5946
- const U = M - C, F = i + U, V = {
5978
+ const { bounds: y } = u, { bounds: w } = f, j = w.left - y.right - v;
5979
+ if (j >= 0) {
5980
+ const M = j / 2, T = n - y.right, S = w.left - i, C = Math.abs(T - M), x = Math.abs(S - M), F = Math.max(C, x);
5981
+ if (F <= e) {
5982
+ const U = M - T, W = i + U, V = {
5947
5983
  type: "horizontal",
5948
5984
  axis: o,
5949
5985
  refStart: y.right,
5950
5986
  refEnd: y.right + M,
5951
- activeStart: F,
5952
- activeEnd: F + M,
5987
+ activeStart: W,
5988
+ activeEnd: W + M,
5953
5989
  distance: M
5954
5990
  };
5955
- m.push({ delta: U, guide: V, diff: Z });
5991
+ m.push({ delta: U, guide: V, diff: F });
5956
5992
  }
5957
5993
  }
5958
5994
  }
5959
- const b = cs({
5995
+ const b = ns({
5960
5996
  activeBounds: h,
5961
5997
  aligned: c,
5962
5998
  threshold: e,
@@ -5970,18 +6006,18 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
5970
6006
  delta: I.delta,
5971
6007
  guide: I.guide
5972
6008
  };
5973
- }, wo = ({
6009
+ }, bo = ({
5974
6010
  activeBounds: h,
5975
6011
  candidates: t,
5976
6012
  threshold: e,
5977
6013
  spacingPatterns: s
5978
6014
  }) => {
5979
- const o = bo({
6015
+ const o = yo({
5980
6016
  activeBounds: h,
5981
6017
  candidates: t,
5982
6018
  threshold: e,
5983
6019
  patterns: s.vertical
5984
- }), n = Mo({
6020
+ }), n = vo({
5985
6021
  activeBounds: h,
5986
6022
  candidates: t,
5987
6023
  threshold: e,
@@ -5992,7 +6028,7 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
5992
6028
  deltaY: o.delta,
5993
6029
  guides: i
5994
6030
  };
5995
- }, So = ({
6031
+ }, Mo = ({
5996
6032
  context: h,
5997
6033
  x: t,
5998
6034
  y: e,
@@ -6002,7 +6038,7 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
6002
6038
  }) => {
6003
6039
  const i = Math.min(n, s / 2, o / 2);
6004
6040
  h.moveTo(t + i, e), h.lineTo(t + s - i, e), h.quadraticCurveTo(t + s, e, t + s, e + i), h.lineTo(t + s, e + o - i), h.quadraticCurveTo(t + s, e + o, t + s - i, e + o), h.lineTo(t + i, e + o), h.quadraticCurveTo(t, e + o, t, e + o - i), h.lineTo(t, e + i), h.quadraticCurveTo(t, e, t + i, e), h.closePath();
6005
- }, pe = ({
6041
+ }, me = ({
6006
6042
  context: h,
6007
6043
  type: t,
6008
6044
  axis: e,
@@ -6021,16 +6057,16 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
6021
6057
  }) => {
6022
6058
  const p = i || 1, m = 12 / p, v = l / p, b = u / p, I = (s + o) / 2 + g, y = t === "vertical" ? e + f : I, w = t === "vertical" ? I : e + f;
6023
6059
  h.save(), h.setLineDash([]), h.fillStyle = a, h.strokeStyle = a, h.lineWidth = d / p, h.font = `${m}px ${c}`, h.textAlign = "center", h.textBaseline = "middle";
6024
- const A = h.measureText(n).width + v * 2, M = m + v * 2, C = y - A / 2, j = w - M / 2;
6025
- h.beginPath(), So({
6060
+ const j = h.measureText(n).width + v * 2, M = m + v * 2, T = y - j / 2, S = w - M / 2;
6061
+ h.beginPath(), Mo({
6026
6062
  context: h,
6027
- x: C,
6028
- y: j,
6029
- width: A,
6063
+ x: T,
6064
+ y: S,
6065
+ width: j,
6030
6066
  height: M,
6031
6067
  radius: b
6032
6068
  }), h.fill(), h.fillStyle = r, h.fillText(n, y, w), h.restore();
6033
- }, Ao = ({
6069
+ }, wo = ({
6034
6070
  context: h,
6035
6071
  guide: t,
6036
6072
  zoom: e
@@ -6045,8 +6081,8 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
6045
6081
  distance: c
6046
6082
  } = t, d = Math.round(c).toString();
6047
6083
  h.beginPath(), s === "vertical" ? (h.moveTo(o, n), h.lineTo(o, i), h.moveTo(o, a), h.lineTo(o, r)) : (h.moveTo(n, o), h.lineTo(i, o), h.moveTo(a, o), h.lineTo(r, o)), h.stroke();
6048
- const l = rs;
6049
- pe({
6084
+ const l = os;
6085
+ me({
6050
6086
  context: h,
6051
6087
  type: s,
6052
6088
  axis: o,
@@ -6055,8 +6091,8 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
6055
6091
  text: d,
6056
6092
  zoom: e,
6057
6093
  color: l,
6058
- lineWidth: fe
6059
- }), pe({
6094
+ lineWidth: pe
6095
+ }), me({
6060
6096
  context: h,
6061
6097
  type: s,
6062
6098
  axis: o,
@@ -6065,9 +6101,9 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
6065
6101
  text: d,
6066
6102
  zoom: e,
6067
6103
  color: l,
6068
- lineWidth: fe
6104
+ lineWidth: pe
6069
6105
  });
6070
- }, es = ({
6106
+ }, qe = ({
6071
6107
  anchors: h,
6072
6108
  bounds: t
6073
6109
  }) => {
@@ -6080,7 +6116,7 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
6080
6116
  centerY: a
6081
6117
  } = t;
6082
6118
  h.vertical.push(e, o, s), h.horizontal.push(n, a, i);
6083
- }, ss = ({
6119
+ }, Je = ({
6084
6120
  bounds: h,
6085
6121
  type: t,
6086
6122
  primaryStart: e,
@@ -6107,30 +6143,30 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
6107
6143
  });
6108
6144
  }
6109
6145
  return o;
6110
- }, jo = ({
6146
+ }, So = ({
6111
6147
  bounds: h
6112
6148
  }) => {
6113
- const t = ss({
6149
+ const t = Je({
6114
6150
  bounds: h,
6115
6151
  type: "vertical",
6116
6152
  primaryStart: "top",
6117
6153
  primaryEnd: "bottom"
6118
- }), e = ss({
6154
+ }), e = Je({
6119
6155
  bounds: h,
6120
6156
  type: "horizontal",
6121
6157
  primaryStart: "left",
6122
6158
  primaryEnd: "right"
6123
6159
  });
6124
6160
  return { vertical: t, horizontal: e };
6125
- }, Io = ["montage-area", "background", "interaction-blocker"], ds = ({
6161
+ }, Ao = ["montage-area", "background", "interaction-blocker"], is = ({
6126
6162
  activeObject: h
6127
6163
  }) => {
6128
6164
  const t = /* @__PURE__ */ new Set();
6129
- return h && (t.add(h), h instanceof x && h.getObjects().forEach((e) => t.add(e))), t;
6130
- }, ls = ({
6165
+ return h && (t.add(h), h instanceof k && h.getObjects().forEach((e) => t.add(e))), t;
6166
+ }, as = ({
6131
6167
  object: h,
6132
6168
  excluded: t,
6133
- ignoredIds: e = Io
6169
+ ignoredIds: e = Ao
6134
6170
  }) => {
6135
6171
  if (t.has(h)) return !0;
6136
6172
  const { visible: s = !0 } = h;
@@ -6138,7 +6174,7 @@ const yo = 5, rs = "#3D8BF4", fe = 1, qt = 1, ts = ({
6138
6174
  const { id: o } = h;
6139
6175
  return !!(o && e.includes(o));
6140
6176
  };
6141
- class Co {
6177
+ class jo {
6142
6178
  /**
6143
6179
  * Создаёт менеджер прилипания и инициализирует слушатели событий.
6144
6180
  */
@@ -6196,12 +6232,12 @@ class Co {
6196
6232
  return;
6197
6233
  }
6198
6234
  !this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: e });
6199
- let n = ht({ object: e });
6235
+ let n = ft({ object: e });
6200
6236
  if (!n) {
6201
6237
  this._clearGuides();
6202
6238
  return;
6203
6239
  }
6204
- const { canvas: i } = this, a = i.getZoom() || 1, r = yo / a, c = vo({
6240
+ const { canvas: i } = this, a = i.getZoom() || 1, r = po / a, c = mo({
6205
6241
  activeBounds: n,
6206
6242
  threshold: r,
6207
6243
  anchors: this.anchors
@@ -6211,9 +6247,9 @@ class Co {
6211
6247
  e.set({
6212
6248
  left: v + d,
6213
6249
  top: b + l
6214
- }), e.setCoords(), n = (p = ht({ object: e })) != null ? p : n;
6250
+ }), e.setCoords(), n = (p = ft({ object: e })) != null ? p : n;
6215
6251
  }
6216
- const g = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => ht({ object: v })).filter((v) => !!v), f = wo({
6252
+ const g = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => ft({ object: v })).filter((v) => !!v), f = bo({
6217
6253
  activeBounds: n,
6218
6254
  candidates: g,
6219
6255
  threshold: r,
@@ -6224,7 +6260,7 @@ class Co {
6224
6260
  e.set({
6225
6261
  left: v + f.deltaX,
6226
6262
  top: b + f.deltaY
6227
- }), e.setCoords(), n = (m = ht({ object: e })) != null ? m : n;
6263
+ }), e.setCoords(), n = (m = ft({ object: e })) != null ? m : n;
6228
6264
  }
6229
6265
  this._applyGuides({
6230
6266
  guides: u,
@@ -6252,11 +6288,11 @@ class Co {
6252
6288
  const { canvas: t, guideBounds: e } = this, s = t.getSelectionContext();
6253
6289
  if (!s) return;
6254
6290
  const o = e != null ? e : this._calculateViewportBounds(), { left: n, right: i, top: a, bottom: r } = o, { viewportTransform: c } = t, d = t.getZoom() || 1;
6255
- s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = fe / d, s.strokeStyle = rs, s.setLineDash([4, 4]);
6291
+ s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = pe / d, s.strokeStyle = os, s.setLineDash([4, 4]);
6256
6292
  for (const l of this.activeGuides)
6257
6293
  s.beginPath(), l.type === "vertical" ? (s.moveTo(l.position, a), s.lineTo(l.position, r)) : (s.moveTo(n, l.position), s.lineTo(i, l.position)), s.stroke();
6258
6294
  for (const l of this.activeSpacingGuides)
6259
- Ao({
6295
+ wo({
6260
6296
  context: s,
6261
6297
  guide: l,
6262
6298
  zoom: d
@@ -6292,7 +6328,7 @@ class Co {
6292
6328
  * Применяет шаг перемещения, округляя координаты объекта к сетке MOVE_SNAP_STEP.
6293
6329
  */
6294
6330
  _applyMovementStep({ target: t }) {
6295
- const { left: e = 0, top: s = 0 } = t, o = Math.round(e / qt) * qt, n = Math.round(s / qt) * qt;
6331
+ const { left: e = 0, top: s = 0 } = t, o = Math.round(e / Qt) * Qt, n = Math.round(s / Qt) * Qt;
6296
6332
  o === e && n === s || (t.set({
6297
6333
  left: o,
6298
6334
  top: n
@@ -6304,12 +6340,12 @@ class Co {
6304
6340
  _cacheAnchors({ activeObject: t }) {
6305
6341
  const e = this._collectTargets({ activeObject: t }), s = { vertical: [], horizontal: [] }, o = [];
6306
6342
  for (const a of e) {
6307
- const r = ht({ object: a });
6308
- r && (es({ anchors: s, bounds: r }), o.push(r));
6343
+ const r = ft({ object: a });
6344
+ r && (qe({ anchors: s, bounds: r }), o.push(r));
6309
6345
  }
6310
- const { montageArea: n } = this.editor, i = ht({ object: n });
6346
+ const { montageArea: n } = this.editor, i = ft({ object: n });
6311
6347
  if (i) {
6312
- es({ anchors: s, bounds: i });
6348
+ qe({ anchors: s, bounds: i });
6313
6349
  const { left: a, right: r, top: c, bottom: d } = i;
6314
6350
  this.guideBounds = {
6315
6351
  left: a,
@@ -6319,15 +6355,15 @@ class Co {
6319
6355
  };
6320
6356
  } else
6321
6357
  this.guideBounds = this._calculateViewportBounds();
6322
- this.anchors = s, this.spacingPatterns = jo({ bounds: o }), this.cachedTargetBounds = o;
6358
+ this.anchors = s, this.spacingPatterns = So({ bounds: o }), this.cachedTargetBounds = o;
6323
6359
  }
6324
6360
  /**
6325
6361
  * Собирает объекты, подходящие для прилипания, исключая активный объект и запрещённые id.
6326
6362
  */
6327
6363
  _collectTargets({ activeObject: t }) {
6328
- const e = ds({ activeObject: t }), s = [];
6364
+ const e = is({ activeObject: t }), s = [];
6329
6365
  return this.canvas.forEachObject((o) => {
6330
- ls({ object: o, excluded: e }) || s.push(o);
6366
+ as({ object: o, excluded: e }) || s.push(o);
6331
6367
  }), s;
6332
6368
  }
6333
6369
  /**
@@ -6350,8 +6386,8 @@ class Co {
6350
6386
  };
6351
6387
  }
6352
6388
  }
6353
- const os = "#3D8BF4", ns = 1;
6354
- class Et {
6389
+ const $e = "#3D8BF4", ts = 1;
6390
+ class Lt {
6355
6391
  /**
6356
6392
  * Создаёт менеджер измерений и инициализирует события.
6357
6393
  */
@@ -6456,15 +6492,15 @@ class Et {
6456
6492
  this._clearGuides();
6457
6493
  return;
6458
6494
  }
6459
- const n = ht({ object: o });
6495
+ const n = ft({ object: o });
6460
6496
  if (!n) {
6461
6497
  this._clearGuides();
6462
6498
  return;
6463
6499
  }
6464
- const i = Et._resolveTarget({
6500
+ const i = Lt._resolveTarget({
6465
6501
  event: t,
6466
6502
  activeObject: o
6467
- }), { montageArea: a } = s, r = i != null ? i : a, c = r === a, d = ht({ object: r });
6503
+ }), { montageArea: a } = s, r = i != null ? i : a, c = r === a, d = ft({ object: r });
6468
6504
  if (!d) {
6469
6505
  this._clearGuides();
6470
6506
  return;
@@ -6473,7 +6509,7 @@ class Et {
6473
6509
  this._clearGuides();
6474
6510
  return;
6475
6511
  }
6476
- const u = Et._buildGuides({
6512
+ const u = Lt._buildGuides({
6477
6513
  activeBounds: n,
6478
6514
  targetBounds: d,
6479
6515
  targetIsMontageArea: c
@@ -6491,8 +6527,8 @@ class Et {
6491
6527
  event: t,
6492
6528
  activeObject: e
6493
6529
  }) {
6494
- const { target: s } = t, o = ds({ activeObject: e });
6495
- return s && !ls({ object: s, excluded: o }) ? s : null;
6530
+ const { target: s } = t, o = is({ activeObject: e });
6531
+ return s && !as({ object: s, excluded: o }) ? s : null;
6496
6532
  }
6497
6533
  /**
6498
6534
  * Собирает вертикальные и горизонтальные направляющие расстояний.
@@ -6502,11 +6538,11 @@ class Et {
6502
6538
  targetBounds: e,
6503
6539
  targetIsMontageArea: s
6504
6540
  }) {
6505
- const o = Et._buildHorizontalGuides({
6541
+ const o = Lt._buildHorizontalGuides({
6506
6542
  activeBounds: t,
6507
6543
  targetBounds: e,
6508
6544
  targetIsMontageArea: s
6509
- }), n = Et._buildVerticalGuides({
6545
+ }), n = Lt._buildVerticalGuides({
6510
6546
  activeBounds: t,
6511
6547
  targetBounds: e,
6512
6548
  targetIsMontageArea: s
@@ -6536,42 +6572,42 @@ class Et {
6536
6572
  } = e, p = Math.max(a, u), m = Math.min(r, g), b = m >= p ? (p + m) / 2 : (c + f) / 2;
6537
6573
  if (d >= i) {
6538
6574
  if (s) return o;
6539
- const T = d - i;
6540
- return T > 0 && o.push({
6575
+ const C = d - i;
6576
+ return C > 0 && o.push({
6541
6577
  type: "horizontal",
6542
6578
  axis: b,
6543
6579
  start: i,
6544
6580
  end: d,
6545
- distance: T
6581
+ distance: C
6546
6582
  }), o;
6547
6583
  }
6548
6584
  if (l <= n) {
6549
6585
  if (s) return o;
6550
- const T = n - l;
6551
- return T > 0 && o.push({
6586
+ const C = n - l;
6587
+ return C > 0 && o.push({
6552
6588
  type: "horizontal",
6553
6589
  axis: b,
6554
6590
  start: l,
6555
6591
  end: n,
6556
- distance: T
6592
+ distance: C
6557
6593
  }), o;
6558
6594
  }
6559
6595
  if (!s) return o;
6560
- const I = n < d, y = i > l, w = Math.min(n, d), S = Math.max(n, d), A = S - w;
6561
- A > 0 && !I && o.push({
6596
+ const I = n < d, y = i > l, w = Math.min(n, d), A = Math.max(n, d), j = A - w;
6597
+ j > 0 && !I && o.push({
6562
6598
  type: "horizontal",
6563
6599
  axis: b,
6564
6600
  start: w,
6565
- end: S,
6566
- distance: A
6601
+ end: A,
6602
+ distance: j
6567
6603
  });
6568
- const M = Math.min(i, l), C = Math.max(i, l), j = C - M;
6569
- return j > 0 && !y && o.push({
6604
+ const M = Math.min(i, l), T = Math.max(i, l), S = T - M;
6605
+ return S > 0 && !y && o.push({
6570
6606
  type: "horizontal",
6571
6607
  axis: b,
6572
6608
  start: M,
6573
- end: C,
6574
- distance: j
6609
+ end: T,
6610
+ distance: S
6575
6611
  }), o;
6576
6612
  }
6577
6613
  /**
@@ -6597,42 +6633,42 @@ class Et {
6597
6633
  } = e, p = Math.max(a, u), m = Math.min(r, g), b = m >= p ? (p + m) / 2 : (c + f) / 2;
6598
6634
  if (d >= i) {
6599
6635
  if (s) return o;
6600
- const T = d - i;
6601
- return T > 0 && o.push({
6636
+ const C = d - i;
6637
+ return C > 0 && o.push({
6602
6638
  type: "vertical",
6603
6639
  axis: b,
6604
6640
  start: i,
6605
6641
  end: d,
6606
- distance: T
6642
+ distance: C
6607
6643
  }), o;
6608
6644
  }
6609
6645
  if (l <= n) {
6610
6646
  if (s) return o;
6611
- const T = n - l;
6612
- return T > 0 && o.push({
6647
+ const C = n - l;
6648
+ return C > 0 && o.push({
6613
6649
  type: "vertical",
6614
6650
  axis: b,
6615
6651
  start: l,
6616
6652
  end: n,
6617
- distance: T
6653
+ distance: C
6618
6654
  }), o;
6619
6655
  }
6620
6656
  if (!s) return o;
6621
- const I = n < d, y = i > l, w = Math.min(n, d), S = Math.max(n, d), A = S - w;
6622
- A > 0 && !I && o.push({
6657
+ const I = n < d, y = i > l, w = Math.min(n, d), A = Math.max(n, d), j = A - w;
6658
+ j > 0 && !I && o.push({
6623
6659
  type: "vertical",
6624
6660
  axis: b,
6625
6661
  start: w,
6626
- end: S,
6627
- distance: A
6662
+ end: A,
6663
+ distance: j
6628
6664
  });
6629
- const M = Math.min(i, l), C = Math.max(i, l), j = C - M;
6630
- return j > 0 && !y && o.push({
6665
+ const M = Math.min(i, l), T = Math.max(i, l), S = T - M;
6666
+ return S > 0 && !y && o.push({
6631
6667
  type: "vertical",
6632
6668
  axis: b,
6633
6669
  start: M,
6634
- end: C,
6635
- distance: j
6670
+ end: T,
6671
+ distance: S
6636
6672
  }), o;
6637
6673
  }
6638
6674
  /**
@@ -6660,10 +6696,10 @@ class Et {
6660
6696
  const { canvas: t } = this, e = t.getSelectionContext();
6661
6697
  if (!e) return;
6662
6698
  const { viewportTransform: s } = t, o = t.getZoom() || 1, n = this.activeGuides.some((c) => c.type === "vertical"), i = this.activeGuides.some((c) => c.type === "horizontal"), a = n && i && !this.isTargetMontageArea, r = a ? 12 / o : 0;
6663
- e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = ns / o, e.strokeStyle = os, e.setLineDash([]);
6699
+ e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = ts / o, e.strokeStyle = $e, e.setLineDash([]);
6664
6700
  for (const c of this.activeGuides) {
6665
6701
  const { type: d, axis: l, start: u, end: g, distance: f } = c, p = Math.abs(g - u), m = u <= g ? -1 : 1, v = a ? m * (p / 2 + r) : 0, b = 0;
6666
- e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, g)) : (e.moveTo(u, l), e.lineTo(g, l)), e.stroke(), pe({
6702
+ e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, g)) : (e.moveTo(u, l), e.lineTo(g, l)), e.stroke(), me({
6667
6703
  context: e,
6668
6704
  type: d,
6669
6705
  axis: l,
@@ -6671,8 +6707,8 @@ class Et {
6671
6707
  end: g,
6672
6708
  text: Math.round(f).toString(),
6673
6709
  zoom: o,
6674
- color: os,
6675
- lineWidth: ns,
6710
+ color: $e,
6711
+ lineWidth: ts,
6676
6712
  offsetAlongAxis: v,
6677
6713
  offsetPerpendicular: b
6678
6714
  });
@@ -6698,14 +6734,14 @@ class Et {
6698
6734
  (e = t == null ? void 0 : t.showAfterTemporary) == null || e.call(t), this.isToolbarHidden = !1;
6699
6735
  }
6700
6736
  }
6701
- class we {
6737
+ class Se {
6702
6738
  /**
6703
6739
  * Конструктор класса ImageEditor.
6704
6740
  * @param canvasId - идентификатор канваса, в котором будет создан редактор
6705
6741
  * @param options - опции и настройки редактора
6706
6742
  */
6707
6743
  constructor(t, e) {
6708
- this.options = e, this.containerId = t, this.editorId = `${t}-${Y()}`, this.clipboard = null, this.init();
6744
+ this.options = e, this.containerId = t, this.editorId = `${t}-${G()}`, this.clipboard = null, this.init();
6709
6745
  }
6710
6746
  /**
6711
6747
  * Инициализация редактора.
@@ -6713,7 +6749,7 @@ class we {
6713
6749
  * @fires editor:ready
6714
6750
  */
6715
6751
  init() {
6716
- return _(this, null, function* () {
6752
+ return N(this, null, function* () {
6717
6753
  var u;
6718
6754
  const {
6719
6755
  editorContainerWidth: t,
@@ -6728,7 +6764,7 @@ class we {
6728
6764
  showRotationAngle: d,
6729
6765
  _onReadyCallback: l
6730
6766
  } = this.options;
6731
- if ($.apply(), this.canvas = new Ms(this.containerId, this.options), this.moduleLoader = new Is(), this.workerManager = new Ts(), this.errorManager = new Ut({ editor: this }), this.historyManager = new Jt({ editor: this }), this.toolbar = new Hs({ editor: this }), this.transformManager = new Js({ editor: this }), this.zoomManager = new to({ editor: this }), this.canvasManager = new $s({ editor: this }), this.imageManager = new rt({ editor: this }), this.layerManager = new te({ editor: this }), this.shapeManager = new so({ editor: this }), this.interactionBlocker = new eo({ editor: this }), this.backgroundManager = new Tt({ editor: this }), this.clipboardManager = new oo({ editor: this }), this.objectLockManager = new ee({ editor: this }), this.groupingManager = new no({ editor: this }), this.selectionManager = new io({ editor: this }), this.deletionManager = new Me({ editor: this }), this.panConstraintManager = new ao({ editor: this }), this.snappingManager = new Co({ editor: this }), this.measurementManager = new Et({ editor: this }), this.fontManager = new ge((u = this.options.fonts) != null ? u : []), this.textManager = new G({ editor: this }), this.templateManager = new L({ editor: this }), d && (this.angleIndicator = new be({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Pt({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(o), this.canvasManager.setCanvasCSSWidth(n), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
6767
+ if (J.apply(), this.canvas = new vs(this.containerId, this.options), this.moduleLoader = new As(), this.workerManager = new Is(), this.errorManager = new Yt({ editor: this }), this.historyManager = new Jt({ editor: this }), this.toolbar = new Ys({ editor: this }), this.transformManager = new qs({ editor: this }), this.zoomManager = new Js({ editor: this }), this.canvasManager = new Qs({ editor: this }), this.imageManager = new ct({ editor: this }), this.layerManager = new $t({ editor: this }), this.shapeManager = new to({ editor: this }), this.interactionBlocker = new $s({ editor: this }), this.backgroundManager = new Ot({ editor: this }), this.clipboardManager = new eo({ editor: this }), this.objectLockManager = new te({ editor: this }), this.groupingManager = new so({ editor: this }), this.selectionManager = new oo({ editor: this }), this.deletionManager = new we({ editor: this }), this.panConstraintManager = new no({ editor: this }), this.snappingManager = new jo({ editor: this }), this.measurementManager = new Lt({ editor: this }), this.fontManager = new fe((u = this.options.fonts) != null ? u : []), this.textManager = new Z({ editor: this }), this.templateManager = new R({ editor: this }), d && (this.angleIndicator = new Me({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Ut({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(o), this.canvasManager.setCanvasCSSWidth(n), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
6732
6768
  const {
6733
6769
  source: g,
6734
6770
  scale: f = `image-${c}`,
@@ -6750,7 +6786,7 @@ class we {
6750
6786
  this.montageArea = this.shapeManager.addRectangle({
6751
6787
  width: t,
6752
6788
  height: e,
6753
- fill: we._createMosaicPattern(),
6789
+ fill: Se._createMosaicPattern(),
6754
6790
  stroke: null,
6755
6791
  strokeWidth: 0,
6756
6792
  selectable: !1,
@@ -6801,7 +6837,7 @@ class we {
6801
6837
  const t = document.createElement("canvas");
6802
6838
  t.width = 20, t.height = 20;
6803
6839
  const e = t.getContext("2d");
6804
- return e.fillStyle = "#ddd", e.fillRect(0, 0, 40, 40), e.fillStyle = "#ccc", e.fillRect(0, 0, 10, 10), e.fillRect(10, 10, 10, 10), new ws({
6840
+ 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 bs({
6805
6841
  source: t,
6806
6842
  repeat: "repeat"
6807
6843
  });
@@ -6833,7 +6869,7 @@ const E = [
6833
6869
  "U+0490-0491",
6834
6870
  "U+04B0-04B1",
6835
6871
  "U+2116"
6836
- ].join(", "), To = [
6872
+ ].join(", "), Io = [
6837
6873
  {
6838
6874
  family: "Arial",
6839
6875
  source: 'local("Arial"), local("Liberation Sans"), local("DejaVu Sans")',
@@ -7623,7 +7659,7 @@ const E = [
7623
7659
  unicodeRange: E
7624
7660
  }
7625
7661
  }
7626
- ], Eo = {
7662
+ ], Co = {
7627
7663
  /**
7628
7664
  * Опции редактора
7629
7665
  */
@@ -7715,20 +7751,20 @@ const E = [
7715
7751
  /**
7716
7752
  * Список шрифтов, которые будут доступны в редакторе по умолчанию.
7717
7753
  */
7718
- fonts: To
7754
+ fonts: Io
7719
7755
  };
7720
- function _o(h, t = {}) {
7721
- const e = k(k({}, Eo), t), s = document.getElementById(h);
7756
+ function Do(h, t = {}) {
7757
+ const e = _(_({}, Co), t), s = document.getElementById(h);
7722
7758
  if (!s)
7723
7759
  return Promise.reject(new Error(`Контейнер с ID "${h}" не найден.`));
7724
7760
  const o = document.createElement("canvas");
7725
7761
  return o.id = `${h}-canvas`, s.appendChild(o), e.editorContainer = s, new Promise((n) => {
7726
7762
  e._onReadyCallback = n;
7727
- const i = new we(o.id, e);
7763
+ const i = new Se(o.id, e);
7728
7764
  window[h] = i;
7729
7765
  });
7730
7766
  }
7731
7767
  export {
7732
- _o as default
7768
+ Do as default
7733
7769
  };
7734
7770
  //# sourceMappingURL=main.js.map