@anu3ev/fabric-image-editor 0.5.9 → 0.5.13

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 (3) hide show
  1. package/dist/main.js +973 -918
  2. package/package.json +1 -1
  3. package/readme.md +27 -8
package/dist/main.js CHANGED
@@ -1,25 +1,25 @@
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) => {
1
+ var cs = Object.defineProperty, ds = Object.defineProperties;
2
+ var ls = Object.getOwnPropertyDescriptors;
3
+ var Vt = Object.getOwnPropertySymbols;
4
+ var Re = Object.prototype.hasOwnProperty, _e = Object.prototype.propertyIsEnumerable;
5
+ var De = (h, t, e) => t in h ? cs(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, B = (h, t) => {
6
6
  for (var e in t || (t = {}))
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]);
7
+ Re.call(t, e) && De(h, e, t[e]);
8
+ if (Vt)
9
+ for (var e of Vt(t))
10
+ _e.call(t, e) && De(h, e, t[e]);
11
11
  return h;
12
- }, yt = (h, t) => ls(h, hs(t));
12
+ }, yt = (h, t) => ds(h, ls(t));
13
13
  var vt = (h, t) => {
14
14
  var e = {};
15
15
  for (var s in h)
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]);
16
+ Re.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 && _e.call(h, s) && (e[s] = h[s]);
20
20
  return e;
21
21
  };
22
- var N = (h, t, e) => new Promise((s, o) => {
22
+ var k = (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 N = (h, t, e) => new Promise((s, o) => {
35
35
  }, a = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(n, i);
36
36
  a((e = e.apply(h, t)).next());
37
37
  });
38
- import { ActiveSelection as k, Textbox as 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() {
38
+ import { ActiveSelection as U, Textbox as nt, util as dt, controlsUtils as xe, InteractiveFabricObject as Ne, Point as et, FitContentLayout as Be, loadSVGFromURL as hs, FabricImage as zt, Gradient as ke, Rect as us, Circle as gs, Triangle as fs, Group as Et, Color as ps, classRegistry as ze, loadSVGFromString as ms, Canvas as ys, Pattern as vs } from "fabric";
39
+ import { create as bs } from "jsondiffpatch";
40
+ import Ms from "diff-match-patch";
41
+ var ws = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", V = 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 += Ss[s[t] & 63];
43
+ e += ws[s[t] & 63];
44
44
  return e;
45
45
  };
46
- class Ut {
46
+ class Ft {
47
47
  /**
48
48
  * Конструктор принимает редактор и опции.
49
49
  * @param params
@@ -61,7 +61,7 @@ class Ut {
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 = 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();
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 = Ft.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 = Ft.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = Ft.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 Ut {
98
98
  if (o.length === 1)
99
99
  this.canvas.setActiveObject(o[0]);
100
100
  else {
101
- const i = new k(o, {
101
+ const i = new U(o, {
102
102
  canvas: this.canvas
103
103
  });
104
104
  this.canvas.setActiveObject(i);
@@ -106,7 +106,7 @@ class Ut {
106
106
  this.canvas.requestRenderAll();
107
107
  return;
108
108
  }
109
- const n = new k(t, {
109
+ const n = new U(t, {
110
110
  canvas: this.canvas
111
111
  });
112
112
  this.editor.objectLockManager.lockObject({
@@ -175,7 +175,7 @@ class Ut {
175
175
  * @param event.code — код клавиши
176
176
  */
177
177
  handleUndoRedoEvent(t) {
178
- return N(this, null, function* () {
178
+ return k(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 Ut {
220
220
  if (o || n) return;
221
221
  this.isSpacePressed = !0, t.preventDefault();
222
222
  const i = e.getActiveObject() || null;
223
- i instanceof k ? this.savedSelection = i.getObjects().slice() : i && (this.savedSelection = [i]), e.discardActiveObject(), e.set({
223
+ i instanceof U ? 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 Ut {
259
259
  e.setActiveObject(t[0]);
260
260
  return;
261
261
  }
262
- const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new k(o, { canvas: e });
262
+ const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new U(o, { canvas: e });
263
263
  e.setActiveObject(n);
264
264
  }
265
265
  // --- Обработчики для событий canvas (Fabric) ---
@@ -391,7 +391,7 @@ class Ut {
391
391
  };
392
392
  }
393
393
  }
394
- class As {
394
+ class Ss {
395
395
  /**
396
396
  * Класс для динамической загрузки внешних модулей.
397
397
  */
@@ -409,7 +409,7 @@ class As {
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 js(h) {
412
+ function As(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 js(h) {
417
417
  }
418
418
  );
419
419
  }
420
- class Is {
420
+ class js {
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 js(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
426
+ t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new As(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
427
427
  }
428
428
  /**
429
429
  * Обработчик сообщений от воркера
@@ -451,7 +451,7 @@ class Is {
451
451
  * @returns Promise, который будет выполнен, когда воркер вернет ответ
452
452
  */
453
453
  post(t, e, s = []) {
454
- const o = `${t}:${G(8)}`;
454
+ const o = `${t}:${V(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,50 +463,50 @@ class Is {
463
463
  this.worker.terminate();
464
464
  }
465
465
  }
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();
466
+ const rt = 12, Is = 2, de = 8, le = 20, Cs = 100, he = 20, ue = 8, Ts = 100, $t = 32, me = 1, Es = "#2B2D33", ye = "#3D8BF4", ve = "#FFFFFF";
467
+ function Xt(h, t, e, s, o) {
468
+ const n = rt, i = Is;
469
+ h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -n / 2, n, n, i), h.fill(), h.stroke(), h.restore();
470
470
  }
471
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();
472
+ const n = de, i = le, a = Cs;
473
+ h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
474
474
  }
475
- function 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();
475
+ function Pe(h, t, e, s, o) {
476
+ const n = he, i = ue, a = Ts;
477
+ h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
478
478
  }
479
- const 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();
479
+ const Os = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", ts = new Image();
480
+ ts.src = Os;
481
+ function Ls(h, t, e, s, o) {
482
+ const i = $t / 2;
483
+ h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = Es, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(ts, -i / 2, -i / 2, i, i), h.restore();
484
484
  }
485
- const Rs = {
485
+ const Ds = {
486
486
  // Угловые точки
487
487
  tl: {
488
- render: Vt,
488
+ render: Xt,
489
489
  sizeX: rt,
490
490
  sizeY: rt,
491
491
  offsetX: 0,
492
492
  offsetY: 0
493
493
  },
494
494
  tr: {
495
- render: Vt,
495
+ render: Xt,
496
496
  sizeX: rt,
497
497
  sizeY: rt,
498
498
  offsetX: 0,
499
499
  offsetY: 0
500
500
  },
501
501
  bl: {
502
- render: Vt,
502
+ render: Xt,
503
503
  sizeX: rt,
504
504
  sizeY: rt,
505
505
  offsetX: 0,
506
506
  offsetY: 0
507
507
  },
508
508
  br: {
509
- render: Vt,
509
+ render: Xt,
510
510
  sizeX: rt,
511
511
  sizeY: rt,
512
512
  offsetX: 0,
@@ -515,43 +515,43 @@ const Rs = {
515
515
  // Середина вертикалей
516
516
  ml: {
517
517
  render: Ue,
518
- sizeX: le,
519
- sizeY: he,
518
+ sizeX: de,
519
+ sizeY: le,
520
520
  offsetX: 0,
521
521
  offsetY: 0
522
522
  },
523
523
  mr: {
524
524
  render: Ue,
525
- sizeX: le,
526
- sizeY: he,
525
+ sizeX: de,
526
+ sizeY: le,
527
527
  offsetX: 0,
528
528
  offsetY: 0
529
529
  },
530
530
  // Середина горизонталей
531
531
  mt: {
532
- render: Ye,
533
- sizeX: ue,
534
- sizeY: ge,
532
+ render: Pe,
533
+ sizeX: he,
534
+ sizeY: ue,
535
535
  offsetX: 0,
536
536
  offsetY: 0
537
537
  },
538
538
  mb: {
539
- render: Ye,
540
- sizeX: ue,
541
- sizeY: ge,
539
+ render: Pe,
540
+ sizeX: he,
541
+ sizeY: ue,
542
542
  offsetX: 0,
543
543
  offsetY: 0
544
544
  },
545
545
  // Специальный «rotate» контрол
546
546
  mtr: {
547
- render: Ds,
548
- sizeX: qt,
549
- sizeY: qt,
547
+ render: Ls,
548
+ sizeX: $t,
549
+ sizeY: $t,
550
550
  offsetX: 0,
551
- offsetY: -qt
551
+ offsetY: -$t
552
552
  }
553
553
  };
554
- class J {
554
+ class $ {
555
555
  /**
556
556
  * Отключает изменение ширины по оси X для заблокированных объектов, сохраняя поведение остального хэндлера.
557
557
  */
@@ -567,7 +567,7 @@ class J {
567
567
  * Применяет конфигурацию контролов к набору по ключам из DEFAULT_CONTROLS.
568
568
  */
569
569
  static applyControlOverrides(t) {
570
- Object.entries(Rs).forEach(([e, s]) => {
570
+ Object.entries(Ds).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;
@@ -581,23 +581,23 @@ class J {
581
581
  */
582
582
  static apply() {
583
583
  const t = xe.createObjectDefaultControls();
584
- J.applyControlOverrides(t), Be.ownDefaults.controls = t;
584
+ $.applyControlOverrides(t), Ne.ownDefaults.controls = t;
585
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;
586
+ $.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), $.wrapWidthControl(e.ml), $.wrapWidthControl(e.mr), nt.ownDefaults.controls = e, $.patchActiveSelectionBounds(), Ne.ownDefaults.snapAngle = 1;
587
587
  }
588
588
  /**
589
589
  * Обновляет алгоритм расчёта границ ActiveSelection, чтобы учитывать фон и отступы текстовых объектов.
590
590
  */
591
591
  static patchActiveSelectionBounds() {
592
- const t = k.prototype, e = t._calcBoundsFromObjects;
592
+ const t = U.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
- J.applyTextSelectionScalingLock({
596
+ $.applyTextSelectionScalingLock({
597
597
  selection: this,
598
598
  objects: i
599
599
  });
600
- const a = J.calculateActiveSelectionBounds({
600
+ const a = $.calculateActiveSelectionBounds({
601
601
  objects: i
602
602
  });
603
603
  if (!a)
@@ -609,45 +609,45 @@ class J {
609
609
  width: d,
610
610
  height: l
611
611
  });
612
- const u = new tt(r + d / 2, c + l / 2);
612
+ const u = new et(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
- J.applyTextSelectionScalingLock({
619
+ $.applyTextSelectionScalingLock({
620
620
  selection: this,
621
621
  objects: r
622
622
  });
623
- const c = J.calculateActiveSelectionBounds({
623
+ const c = $.calculateActiveSelectionBounds({
624
624
  objects: r
625
625
  });
626
626
  if (!c) return a;
627
- const { left: d, top: l, width: u, height: g } = c, f = new tt(d + u / 2, l + g / 2);
627
+ const { left: d, top: l, width: u, height: g } = c, f = new et(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 = ke.prototype.calcBoundingBox;
634
- ke.prototype.calcBoundingBox = function(n, i) {
633
+ const o = Be.prototype.calcBoundingBox;
634
+ Be.prototype.calcBoundingBox = function(n, i) {
635
635
  const { target: a, type: r, overrides: c } = i;
636
636
  if (r === "imperative" && c)
637
637
  return c;
638
- if (!(a instanceof k))
638
+ if (!(a instanceof U))
639
639
  return o.call(this, n, i);
640
- J.applyTextSelectionScalingLock({
640
+ $.applyTextSelectionScalingLock({
641
641
  selection: a,
642
642
  objects: n
643
643
  });
644
- const d = J.calculateActiveSelectionBounds({ objects: n });
644
+ const d = $.calculateActiveSelectionBounds({ objects: n });
645
645
  if (!d)
646
646
  return o.call(this, n, i);
647
- const { left: l, top: u, width: g, height: f } = d, p = new tt(g, f), m = new tt(l + g / 2, u + f / 2);
647
+ const { left: l, top: u, width: g, height: f } = d, p = new et(g, f), m = new et(l + g / 2, u + f / 2);
648
648
  return r === "initialization" ? {
649
649
  center: m,
650
- relativeCorrection: new tt(0, 0),
650
+ relativeCorrection: new et(0, 0),
651
651
  size: p
652
652
  } : {
653
653
  center: m,
@@ -686,7 +686,7 @@ class J {
686
686
  });
687
687
  }
688
688
  }
689
- const B = class B {
689
+ const z = class z {
690
690
  constructor(t = []) {
691
691
  this.fonts = t;
692
692
  }
@@ -694,36 +694,36 @@ const B = class B {
694
694
  this.fonts = t;
695
695
  }
696
696
  loadFonts() {
697
- return N(this, null, function* () {
697
+ return k(this, null, function* () {
698
698
  var o;
699
699
  const t = (o = this.fonts) != null ? o : [];
700
700
  if (!t.length) return;
701
701
  const e = typeof document != "undefined" ? document : void 0;
702
702
  if (!e) return;
703
- const s = t.map((n) => B.loadFont(n, e));
703
+ const s = t.map((n) => z.loadFont(n, e));
704
704
  yield Promise.allSettled(s);
705
705
  });
706
706
  }
707
707
  static loadFont(t, e) {
708
- return N(this, null, function* () {
708
+ return k(this, null, function* () {
709
709
  var c, d;
710
710
  const s = typeof FontFace != "undefined", o = (c = t.family) == null ? void 0 : c.trim(), n = (d = t.source) == null ? void 0 : d.trim();
711
711
  if (!o || !n) return;
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);
712
+ const i = z.normalizeFontSource(n), a = z.getDescriptorSnapshot(t.descriptors), r = z.getFontRegistrationKey(o, i, a);
713
+ if (!z.registeredFontKeys.has(r)) {
714
+ if (z.isFontFaceAlreadyApplied(e, o, a)) {
715
+ z.registeredFontKeys.add(r);
716
716
  return;
717
717
  }
718
718
  if (s && e.fonts && typeof e.fonts.add == "function")
719
719
  try {
720
720
  const u = yield new FontFace(o, i, t.descriptors).load();
721
- e.fonts.add(u), B.registeredFontKeys.add(r);
721
+ e.fonts.add(u), z.registeredFontKeys.add(r);
722
722
  return;
723
723
  } catch (l) {
724
724
  console.warn(`Не удалось загрузить шрифт "${o}" через FontFace API`, l);
725
725
  }
726
- B.injectFontFace({
726
+ z.injectFontFace({
727
727
  font: t,
728
728
  source: i,
729
729
  doc: e,
@@ -743,15 +743,15 @@ const B = class B {
743
743
  if (!i) return;
744
744
  const a = s.createElement("style");
745
745
  a.setAttribute("data-editor-font", i), a.setAttribute("data-editor-font-key", o);
746
- const r = B.descriptorsToCss(n), c = [
746
+ const r = z.descriptorsToCss(n), c = [
747
747
  "@font-face {",
748
- ` font-family: ${B.formatFontFamilyForCss(i)};`,
748
+ ` font-family: ${z.formatFontFamilyForCss(i)};`,
749
749
  ` src: ${e};`,
750
750
  ...r.map((l) => ` ${l}`),
751
751
  "}"
752
752
  ];
753
753
  a.textContent = c.join(`
754
- `), s.head.appendChild(a), B.registeredFontKeys.add(o);
754
+ `), s.head.appendChild(a), z.registeredFontKeys.add(o);
755
755
  }
756
756
  static normalizeFontSource(t) {
757
757
  const e = t.trim();
@@ -774,15 +774,15 @@ const B = class B {
774
774
  return t ? t.trim().replace(/^['"]+|['"]+$/g, "").toLowerCase() : "";
775
775
  }
776
776
  static getDescriptorSnapshot(t) {
777
- const e = B.descriptorDefaults;
777
+ const e = z.descriptorDefaults;
778
778
  return {
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)
779
+ style: z.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
780
+ weight: z.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
781
+ stretch: z.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
782
+ unicodeRange: z.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
783
+ variant: z.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
784
+ featureSettings: z.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
785
+ display: z.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
786
786
  };
787
787
  }
788
788
  static areDescriptorSnapshotsEqual(t, e) {
@@ -790,7 +790,7 @@ const B = class B {
790
790
  }
791
791
  static getFontRegistrationKey(t, e, s) {
792
792
  return [
793
- B.normalizeFamilyName(t),
793
+ z.normalizeFamilyName(t),
794
794
  e,
795
795
  s.style,
796
796
  s.weight,
@@ -804,12 +804,12 @@ const B = class B {
804
804
  static isFontFaceAlreadyApplied(t, e, s) {
805
805
  const o = t.fonts;
806
806
  if (!o || typeof o.forEach != "function") return !1;
807
- const n = B.normalizeFamilyName(e);
807
+ const n = z.normalizeFamilyName(e);
808
808
  let i = !1;
809
809
  try {
810
810
  o.forEach((a) => {
811
- if (i || B.normalizeFamilyName(a.family) !== n) return;
812
- const c = B.getDescriptorSnapshot({
811
+ if (i || z.normalizeFamilyName(a.family) !== n) return;
812
+ const c = z.getDescriptorSnapshot({
813
813
  style: a.style,
814
814
  weight: a.weight,
815
815
  stretch: a.stretch,
@@ -818,7 +818,7 @@ const B = class B {
818
818
  featureSettings: a.featureSettings,
819
819
  display: a.display
820
820
  });
821
- B.areDescriptorSnapshotsEqual(s, c) && (i = !0);
821
+ z.areDescriptorSnapshotsEqual(s, c) && (i = !0);
822
822
  });
823
823
  } catch (a) {
824
824
  return console.warn("Не удалось проверить, загружен ли шрифт ранее через FontFaceSet", a), !1;
@@ -845,7 +845,7 @@ const B = class B {
845
845
  });
846
846
  }
847
847
  };
848
- B.registeredFontKeys = /* @__PURE__ */ new Set(), B.descriptorDefaults = {
848
+ z.registeredFontKeys = /* @__PURE__ */ new Set(), z.descriptorDefaults = {
849
849
  style: "normal",
850
850
  weight: "normal",
851
851
  stretch: "normal",
@@ -854,8 +854,8 @@ B.registeredFontKeys = /* @__PURE__ */ new Set(), B.descriptorDefaults = {
854
854
  featureSettings: "normal",
855
855
  display: "auto"
856
856
  };
857
- let fe = B;
858
- const _s = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2R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Ljg3NSAxLjg3NSAwIDAgMCA2LjI1IDMuMTI1di42MjVIMy4xMjVhLjYyNS42MjUgMCAwIDAgMCAxLjI1aC42MjV2MTEuMjVBMS4yNSAxLjI1IDAgMCAwIDUgMTcuNWgxMGExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjVoLjYyNWEuNjI1LjYyNSAwIDAgMCAwLTEuMjVIMTMuNzV2LS42MjVhMS44NzUgMS44NzUgMCAwIDAtMS44NzUtMS44NzVoLTMuNzVabTQuMzc1IDIuNXYtLjYyNWEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2LjYyNWg1Wk01IDE2LjI1VjVoMTB2MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Ut = {
859
859
  style: {
860
860
  position: "absolute",
861
861
  display: "none",
@@ -922,17 +922,17 @@ const _s = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
922
922
  ],
923
923
  offsetTop: 50,
924
924
  icons: {
925
- copyPaste: _s,
925
+ copyPaste: Rs,
926
926
  delete: Us,
927
- lock: Ns,
927
+ lock: _s,
928
928
  unlock: xs,
929
- bringToFront: zs,
930
- sendToBack: Ps,
931
- bringForward: Bs,
932
- sendBackwards: ks
929
+ bringToFront: ks,
930
+ sendToBack: zs,
931
+ bringForward: Ns,
932
+ sendBackwards: Bs
933
933
  },
934
934
  handlers: {
935
- copyPaste: (h) => N(null, null, function* () {
935
+ copyPaste: (h) => k(null, null, function* () {
936
936
  h.clipboardManager.copyPaste();
937
937
  }),
938
938
  delete: (h) => {
@@ -958,18 +958,18 @@ const _s = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
958
958
  }
959
959
  }
960
960
  };
961
- class Ys {
961
+ class Ps {
962
962
  constructor({ editor: t }) {
963
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();
964
964
  }
965
965
  _initToolbar() {
966
966
  if (!this.options.showToolbar) return;
967
967
  const t = this.options.toolbar || {};
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 || {})
968
+ this.config = yt(B(B({}, Ut), t), {
969
+ style: B(B({}, Ut.style), t.style || {}),
970
+ btnStyle: B(B({}, Ut.btnStyle), t.btnStyle || {}),
971
+ icons: B(B({}, Ut.icons), t.icons || {}),
972
+ handlers: B(B({}, Ut.handlers), t.handlers || {})
973
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 = () => {
974
974
  this.el.style.display = "none";
975
975
  }, this._createDOM(), this._bindEvents();
@@ -1101,7 +1101,7 @@ const Fs = {
1101
1101
  "white-space": "nowrap",
1102
1102
  "box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
1103
1103
  }, Fe = 16, We = 16, Ws = "fabric-editor-angle-indicator";
1104
- class Me {
1104
+ class be {
1105
1105
  constructor({ editor: t }) {
1106
1106
  this.isActive = !1, this.currentAngle = 0, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._createDOM(), this._bindEvents();
1107
1107
  }
@@ -1129,7 +1129,7 @@ class Me {
1129
1129
  return;
1130
1130
  }
1131
1131
  const s = e.angle || 0;
1132
- this.currentAngle = Me._normalizeAngle(s), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
1132
+ this.currentAngle = be._normalizeAngle(s), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
1133
1133
  }
1134
1134
  /**
1135
1135
  * Обработчик отпускания кнопки мыши
@@ -1193,7 +1193,7 @@ class Me {
1193
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;
1194
1194
  }
1195
1195
  }
1196
- const ss = [
1196
+ const es = [
1197
1197
  "selectable",
1198
1198
  "evented",
1199
1199
  "id",
@@ -1218,7 +1218,6 @@ const ss = [
1218
1218
  "underline",
1219
1219
  "fontStyle",
1220
1220
  "fontWeight",
1221
- "backgroundColor",
1222
1221
  "backgroundOpacity",
1223
1222
  "paddingTop",
1224
1223
  "paddingRight",
@@ -1229,25 +1228,24 @@ const ss = [
1229
1228
  "radiusBottomRight",
1230
1229
  "radiusBottomLeft"
1231
1230
  ];
1232
- class Jt {
1231
+ class Ys {
1233
1232
  constructor({ editor: t }) {
1234
- this.editor = t, this.canvas = t.canvas, this._historySuspendCount = 0, this.baseState = null, this.patches = [], this.currentIndex = 0, this.maxHistoryLength = t.options.maxHistoryLength, this.totalChangesCount = 0, this.baseStateChangesCount = 0, this._createDiffPatcher();
1233
+ this.editor = t, this.canvas = t.canvas, this._isSavingState = !1, this._historySuspendCount = 0, this.baseState = null, this.patches = [], this.currentIndex = 0, this.maxHistoryLength = t.options.maxHistoryLength, this.totalChangesCount = 0, this.baseStateChangesCount = 0, this._createDiffPatcher();
1235
1234
  }
1236
1235
  /** Проверка, нужно ли пропускать сохранение истории */
1237
1236
  get skipHistory() {
1238
- return this._historySuspendCount > 0;
1237
+ return this._historySuspendCount > 0 || this._isSavingState;
1239
1238
  }
1240
1239
  get lastPatch() {
1241
1240
  return this.patches[this.currentIndex - 1] || null;
1242
1241
  }
1243
1242
  _createDiffPatcher() {
1244
- this.diffPatcher = Ms({
1243
+ this.diffPatcher = bs({
1245
1244
  objectHash(t) {
1246
- const e = t, s = t, o = s.styles ? JSON.stringify(s.styles) : "";
1245
+ const e = t, s = t, o = s.styles ? JSON.stringify(s.styles) : "", n = e.customData ? JSON.stringify(e.customData) : "";
1247
1246
  return [
1248
1247
  e.id,
1249
1248
  e.backgroundId,
1250
- e.customData,
1251
1249
  e.format,
1252
1250
  e.locked,
1253
1251
  e.left,
@@ -1260,6 +1258,7 @@ class Jt {
1260
1258
  e.scaleY,
1261
1259
  e.angle,
1262
1260
  e.opacity,
1261
+ n,
1263
1262
  s.text,
1264
1263
  s.textCaseRaw,
1265
1264
  s.uppercase,
@@ -1291,7 +1290,7 @@ class Jt {
1291
1290
  includeValueOnMove: !1
1292
1291
  },
1293
1292
  textDiff: {
1294
- diffMatchPatch: ws,
1293
+ diffMatchPatch: Ms,
1295
1294
  minLength: 60
1296
1295
  }
1297
1296
  });
@@ -1330,46 +1329,26 @@ class Jt {
1330
1329
  * Сохраняем текущее состояние в виде диффа от последнего сохранённого полного состояния.
1331
1330
  */
1332
1331
  saveState() {
1333
- if (console.log("saveState"), this.skipHistory) return;
1334
- console.time("saveState");
1335
- const t = this._withTemporaryUnlock(
1336
- () => this.canvas.toDatalessObject([...ss])
1337
- );
1338
- if (console.timeEnd("saveState"), !this.baseState) {
1339
- this.baseState = t, this.patches = [], this.currentIndex = 0, console.log("Базовое состояние сохранено.");
1340
- return;
1341
- }
1342
- const e = this.getFullState(), s = this.diffPatcher.diff(e, t);
1343
- if (!s) {
1344
- console.log("Нет изменений для сохранения.");
1345
- return;
1346
- }
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);
1348
- }
1349
- /**
1350
- * Сериализует customData объектов в строку. Это необходимо чтобы при вызове loadFromJSON fabricjs не пытался обрабатывать свойства внутри customData, как свойства FabricObject, если их названия совпадают с зарезервированными.
1351
- *
1352
- * @param state - состояние канваса для сериализации
1353
- */
1354
- static _serializeCustomData(t) {
1355
- t.objects && t.objects.forEach((e) => {
1356
- e.customData && typeof e.customData == "object" && (e._serializedCustomData = JSON.stringify(e.customData), delete e.customData);
1357
- });
1358
- }
1359
- /**
1360
- * Десериализует customData из строки обратно в объект
1361
- * @param serializedObj - сериализованный объект из JSON
1362
- * @param fabricObject - объект Fabric, в который нужно записать customData
1363
- */
1364
- static _deserializeCustomData(t, e) {
1365
- if (!(!t._serializedCustomData || !e))
1332
+ if (console.log("saveState"), !this.skipHistory) {
1333
+ this._isSavingState = !0, console.time("saveState");
1366
1334
  try {
1367
- e.customData = JSON.parse(
1368
- t._serializedCustomData
1335
+ const t = this._withTemporaryUnlock(
1336
+ () => this.canvas.toDatalessObject([...es])
1369
1337
  );
1370
- } catch (s) {
1371
- console.warn("Не удалось десериализовать customData:", s), e.customData = {};
1338
+ if (console.timeEnd("saveState"), !this.baseState) {
1339
+ this.baseState = t, this.patches = [], this.currentIndex = 0, console.log("Базовое состояние сохранено.");
1340
+ return;
1341
+ }
1342
+ const e = this.getFullState(), s = this.diffPatcher.diff(e, t);
1343
+ if (!s) {
1344
+ console.log("Нет изменений для сохранения.");
1345
+ return;
1346
+ }
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: V(), 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);
1348
+ } finally {
1349
+ this._isSavingState = !1;
1372
1350
  }
1351
+ }
1373
1352
  }
1374
1353
  /**
1375
1354
  * Функция загрузки состояния в канвас.
@@ -1377,13 +1356,11 @@ class Jt {
1377
1356
  * @fires editor:history-state-loaded
1378
1357
  */
1379
1358
  loadStateFromFullState(t) {
1380
- return N(this, null, function* () {
1359
+ return k(this, null, function* () {
1381
1360
  if (!t) return;
1382
1361
  console.log("loadStateFromFullState fullState", t);
1383
1362
  const { canvas: e, canvasManager: s, interactionBlocker: o, backgroundManager: n } = this.editor, { width: i, height: a } = e;
1384
- o.overlayMask = null, Jt._serializeCustomData(t), yield e.loadFromJSON(t, (l, u) => {
1385
- Jt._deserializeCustomData(l, u);
1386
- });
1363
+ o.overlayMask = null, yield e.loadFromJSON(t);
1387
1364
  const r = e.getObjects().find((l) => l.id === "montage-area");
1388
1365
  r && (this.editor.montageArea = r, (i !== e.getWidth() || a !== e.getHeight()) && s.updateCanvas());
1389
1366
  const c = e.getObjects().find((l) => l.id === "overlay-mask");
@@ -1404,9 +1381,9 @@ class Jt {
1404
1381
  * @fires editor:undo
1405
1382
  */
1406
1383
  undo() {
1407
- return N(this, null, function* () {
1384
+ return k(this, null, function* () {
1408
1385
  if (!this.skipHistory) {
1409
- if (this.currentIndex <= 0) {
1386
+ if (this.saveState(), this.currentIndex <= 0) {
1410
1387
  console.log("Нет предыдущих состояний для отмены.");
1411
1388
  return;
1412
1389
  }
@@ -1441,9 +1418,9 @@ class Jt {
1441
1418
  * @fires editor:redo
1442
1419
  */
1443
1420
  redo() {
1444
- return N(this, null, function* () {
1421
+ return k(this, null, function* () {
1445
1422
  if (!this.skipHistory) {
1446
- if (this.currentIndex >= this.patches.length) {
1423
+ if (this.saveState(), this.currentIndex >= this.patches.length) {
1447
1424
  console.log("Нет состояний для повтора.");
1448
1425
  return;
1449
1426
  }
@@ -1496,7 +1473,7 @@ class Jt {
1496
1473
  }
1497
1474
  }
1498
1475
  }
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 = [
1476
+ const Hs = 0.1, Zs = 2, Ye = 0.1, Gs = 90, Rt = 16, _t = 16, Mt = 4096, wt = 4096, He = "application/image-editor:", Kt = [
1500
1477
  "format",
1501
1478
  "uppercase",
1502
1479
  "textCaseRaw",
@@ -1528,114 +1505,118 @@ class ct {
1528
1505
  * @returns возвращает Promise с объектом изображения или null в случае ошибки
1529
1506
  */
1530
1507
  importImage(t) {
1531
- return N(this, null, function* () {
1508
+ return k(this, null, function* () {
1532
1509
  const {
1533
1510
  source: e,
1534
1511
  scale: s = `image-${this.options.scaleType}`,
1535
1512
  withoutSave: o = !1,
1536
1513
  fromClipboard: n = !1,
1537
1514
  isBackground: i = !1,
1538
- withoutSelection: a = !1
1515
+ withoutSelection: a = !1,
1516
+ withoutAdding: r = !1
1539
1517
  } = t;
1540
1518
  if (!e) return null;
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;
1542
- if (!this.isAllowedContentType(g)) {
1543
- const v = `Неверный contentType для изображения: ${g}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1544
- return u.emitError({
1519
+ const { canvas: c, montageArea: d, transformManager: l, historyManager: u, errorManager: g } = this.editor, f = yield this.getContentType(e), p = ct.getFormatFromContentType(f), { acceptContentTypes: m, acceptFormats: v } = this;
1520
+ if (!this.isAllowedContentType(f)) {
1521
+ const M = `Неверный contentType для изображения: ${f}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1522
+ return g.emitError({
1545
1523
  origin: "ImageManager",
1546
1524
  method: "importImage",
1547
1525
  code: "INVALID_CONTENT_TYPE",
1548
- message: v,
1526
+ message: M,
1549
1527
  data: {
1550
1528
  source: e,
1551
- format: f,
1552
- contentType: g,
1553
- acceptContentTypes: p,
1554
- acceptFormats: m,
1529
+ format: p,
1530
+ contentType: f,
1531
+ acceptContentTypes: m,
1532
+ acceptFormats: v,
1555
1533
  fromClipboard: n,
1556
1534
  isBackground: i,
1557
- withoutSelection: a
1535
+ withoutSelection: a,
1536
+ withoutAdding: r
1558
1537
  }
1559
1538
  }), null;
1560
1539
  }
1561
- l.suspendHistory();
1540
+ u.suspendHistory();
1562
1541
  try {
1563
- let v, b;
1542
+ let M, S;
1564
1543
  if (e instanceof File)
1565
- v = URL.createObjectURL(e);
1544
+ M = URL.createObjectURL(e);
1566
1545
  else if (typeof e == "string") {
1567
- const j = yield (yield fetch(e, { mode: "cors" })).blob();
1568
- v = URL.createObjectURL(j);
1546
+ const A = yield (yield fetch(e, { mode: "cors" })).blob();
1547
+ M = URL.createObjectURL(A);
1569
1548
  } else
1570
- return u.emitError({
1549
+ return g.emitError({
1571
1550
  origin: "ImageManager",
1572
1551
  method: "importImage",
1573
1552
  code: "INVALID_SOURCE_TYPE",
1574
1553
  message: "Неверный тип источника изображения. Ожидается URL или объект File.",
1575
1554
  data: {
1576
1555
  source: e,
1577
- format: f,
1578
- contentType: g,
1579
- acceptContentTypes: p,
1580
- acceptFormats: m,
1556
+ format: p,
1557
+ contentType: f,
1558
+ acceptContentTypes: m,
1559
+ acceptFormats: v,
1581
1560
  fromClipboard: n,
1582
1561
  isBackground: i,
1583
- withoutSelection: a
1562
+ withoutSelection: a,
1563
+ withoutAdding: r
1584
1564
  }
1585
1565
  }), null;
1586
- if (this._createdBlobUrls.push(v), f === "svg") {
1587
- const A = yield us(v);
1588
- b = dt.groupSVGElements(A.objects, A.options);
1566
+ if (this._createdBlobUrls.push(M), p === "svg") {
1567
+ const j = yield hs(M);
1568
+ S = dt.groupSVGElements(j.objects, j.options);
1589
1569
  } else
1590
- b = yield zt.fromURL(v, { crossOrigin: "anonymous" });
1591
- const { width: I, height: y } = b;
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 w = yield this.resizeImageToBoundaries(j, "max"), T = URL.createObjectURL(w);
1597
- this._createdBlobUrls.push(T), b = yield zt.fromURL(T, { crossOrigin: "anonymous" });
1598
- } else if (y < _t || I < Rt) {
1599
- const w = yield this.resizeImageToBoundaries(j, "min"), T = URL.createObjectURL(w);
1600
- this._createdBlobUrls.push(T), b = yield zt.fromURL(T, { crossOrigin: "anonymous" });
1570
+ S = yield zt.fromURL(M, { crossOrigin: "anonymous" });
1571
+ const { width: y, height: b } = S;
1572
+ if (S instanceof zt) {
1573
+ const j = S.getElement();
1574
+ let A = "";
1575
+ if (j instanceof HTMLImageElement ? A = j.src : j instanceof HTMLCanvasElement && (A = j.toDataURL()), b > wt || y > Mt) {
1576
+ const C = yield this.resizeImageToBoundaries(A, "max"), w = URL.createObjectURL(C);
1577
+ this._createdBlobUrls.push(w), S = yield zt.fromURL(w, { crossOrigin: "anonymous" });
1578
+ } else if (b < _t || y < Rt) {
1579
+ const C = yield this.resizeImageToBoundaries(A, "min"), w = URL.createObjectURL(C);
1580
+ this._createdBlobUrls.push(w), S = yield zt.fromURL(w, { crossOrigin: "anonymous" });
1601
1581
  }
1602
1582
  }
1603
- if (b.set("id", `${b.type}-${G()}`), b.set("format", f), s === "scale-montage")
1604
- this.editor.canvasManager.scaleMontageAreaToImage({ object: b, withoutSave: !0 });
1583
+ if (S.set("id", `${S.type}-${V()}`), S.set("format", p), s === "scale-montage")
1584
+ this.editor.canvasManager.scaleMontageAreaToImage({ object: S, withoutSave: !0 });
1605
1585
  else {
1606
- const { width: A, height: j } = c, w = this.calculateScaleFactor({ imageObject: b, scaleType: s });
1607
- s === "image-contain" && w < 1 ? d.fitObject({ object: b, type: "contain", withoutSave: !0 }) : s === "image-cover" && (I > A || y > j) && d.fitObject({ object: b, type: "cover", withoutSave: !0 });
1586
+ const { width: j, height: A } = d, C = this.calculateScaleFactor({ imageObject: S, scaleType: s });
1587
+ s === "image-contain" && C < 1 ? l.fitObject({ object: S, type: "contain", withoutSave: !0 }) : s === "image-cover" && (y > j || b > A) && l.fitObject({ object: S, type: "cover", withoutSave: !0 });
1608
1588
  }
1609
- r.add(b), r.centerObject(b), a || r.setActiveObject(b), r.renderAll(), l.resumeHistory(), o || l.saveState();
1610
- const M = {
1611
- image: b,
1612
- format: f,
1613
- contentType: g,
1589
+ const I = {
1590
+ image: S,
1591
+ format: p,
1592
+ contentType: f,
1614
1593
  scale: s,
1615
1594
  withoutSave: o,
1616
1595
  source: e,
1617
1596
  fromClipboard: n,
1618
1597
  isBackground: i,
1619
- withoutSelection: a
1598
+ withoutSelection: a,
1599
+ withoutAdding: r
1620
1600
  };
1621
- return r.fire("editor:image-imported", M), M;
1622
- } catch (v) {
1623
- return u.emitError({
1601
+ return r ? (u.resumeHistory(), c.fire("editor:image-imported", I), I) : (c.add(S), c.centerObject(S), a || c.setActiveObject(S), c.renderAll(), u.resumeHistory(), o || u.saveState(), c.fire("editor:image-imported", I), I);
1602
+ } catch (M) {
1603
+ return g.emitError({
1624
1604
  origin: "ImageManager",
1625
1605
  method: "importImage",
1626
1606
  code: "IMPORT_FAILED",
1627
- message: `Ошибка импорта изображения: ${v.message}`,
1607
+ message: `Ошибка импорта изображения: ${M.message}`,
1628
1608
  data: {
1629
1609
  source: e,
1630
- format: f,
1631
- contentType: g,
1610
+ format: p,
1611
+ contentType: f,
1632
1612
  scale: s,
1633
1613
  withoutSave: o,
1634
1614
  fromClipboard: n,
1635
1615
  isBackground: i,
1636
- withoutSelection: a
1616
+ withoutSelection: a,
1617
+ withoutAdding: r
1637
1618
  }
1638
- }), l.resumeHistory(), null;
1619
+ }), u.resumeHistory(), null;
1639
1620
  }
1640
1621
  });
1641
1622
  }
@@ -1648,7 +1629,7 @@ class ct {
1648
1629
  * @returns возвращает Promise с Blob-объектом уменьшенного изображения
1649
1630
  */
1650
1631
  resizeImageToBoundaries(t, e = "max") {
1651
- return N(this, null, function* () {
1632
+ return k(this, null, function* () {
1652
1633
  let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${Mt}x${wt}`;
1653
1634
  e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${Rt}x${_t}`);
1654
1635
  const o = {
@@ -1680,7 +1661,7 @@ class ct {
1680
1661
  * @fires editor:canvas-exported
1681
1662
  */
1682
1663
  exportCanvasAsImageFile() {
1683
- return N(this, arguments, function* (t = {}) {
1664
+ return k(this, arguments, function* (t = {}) {
1684
1665
  const {
1685
1666
  fileName: e = "image.png",
1686
1667
  contentType: s = "image/png",
@@ -1692,18 +1673,18 @@ class ct {
1692
1673
  a.setCoords();
1693
1674
  const { left: g, top: f, width: p, height: m } = a.getBoundingRect(), v = yield i.clone(["id", "format", "locked"]);
1694
1675
  v.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(l) && (v.backgroundColor = "#ffffff");
1695
- const b = v.getObjects().find((S) => S.id === a.id);
1696
- if (b && (b.visible = !1), c != null && c.isBlocked) {
1697
- const S = v.getObjects().find((C) => C.id === c.overlayMask.id);
1698
- S && (S.visible = !1);
1676
+ const M = v.getObjects().find((w) => w.id === a.id);
1677
+ if (M && (M.visible = !1), c != null && c.isBlocked) {
1678
+ const w = v.getObjects().find((T) => T.id === c.overlayMask.id);
1679
+ w && (w.visible = !1);
1699
1680
  }
1700
1681
  v.viewportTransform = [1, 0, 0, 1, -g, -f], v.setDimensions({ width: p, height: m }, { backstoreOnly: !0 }), v.renderAll();
1701
- const I = v.getObjects().filter((S) => S.format).every((S) => S.format === "svg");
1702
- if (u === "svg" && I) {
1703
- const S = v.toSVG();
1682
+ const S = v.getObjects().filter((w) => w.format).every((w) => w.format === "svg");
1683
+ if (u === "svg" && S) {
1684
+ const w = v.toSVG();
1704
1685
  v.dispose();
1705
- const x = {
1706
- image: ct._exportSVGStringAsFile(S, {
1686
+ const E = {
1687
+ image: ct._exportSVGStringAsFile(w, {
1707
1688
  exportAsBase64: o,
1708
1689
  exportAsBlob: n,
1709
1690
  fileName: e
@@ -1712,66 +1693,66 @@ class ct {
1712
1693
  contentType: "image/svg+xml",
1713
1694
  fileName: e.replace(/\.[^/.]+$/, ".svg")
1714
1695
  };
1715
- return i.fire("editor:canvas-exported", x), x;
1696
+ return i.fire("editor:canvas-exported", E), E;
1716
1697
  }
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"));
1698
+ const y = yield new Promise((w, T) => {
1699
+ v.getElement().toBlob((E) => {
1700
+ E ? w(E) : T(new Error("Failed to create Blob from canvas"));
1720
1701
  });
1721
1702
  });
1722
1703
  if (v.dispose(), n) {
1723
- const S = {
1704
+ const w = {
1724
1705
  image: y,
1725
1706
  format: u,
1726
1707
  contentType: l,
1727
1708
  fileName: e
1728
1709
  };
1729
- return i.fire("editor:canvas-exported", S), S;
1710
+ return i.fire("editor:canvas-exported", w), w;
1730
1711
  }
1731
- const M = yield createImageBitmap(y), A = yield r.post(
1712
+ const b = yield createImageBitmap(y), I = yield r.post(
1732
1713
  "toDataURL",
1733
- { format: u, quality: 1, bitmap: M },
1734
- [M]
1714
+ { format: u, quality: 1, bitmap: b },
1715
+ [b]
1735
1716
  );
1736
1717
  if (d) {
1737
- const C = p * 0.264583, x = m * 0.264583, W = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, Y = new W({
1738
- orientation: C > x ? "landscape" : "portrait",
1718
+ const T = p * 0.264583, E = m * 0.264583, P = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, x = new P({
1719
+ orientation: T > E ? "landscape" : "portrait",
1739
1720
  unit: "mm",
1740
- format: [C, x]
1721
+ format: [T, E]
1741
1722
  });
1742
- if (Y.addImage(String(A), "JPG", 0, 0, C, x), o) {
1743
- const P = {
1744
- image: Y.output("datauristring"),
1723
+ if (x.addImage(String(I), "JPG", 0, 0, T, E), o) {
1724
+ const W = {
1725
+ image: x.output("datauristring"),
1745
1726
  format: "pdf",
1746
1727
  contentType: "application/pdf",
1747
1728
  fileName: e
1748
1729
  };
1749
- return i.fire("editor:canvas-exported", P), P;
1730
+ return i.fire("editor:canvas-exported", W), W;
1750
1731
  }
1751
- const H = Y.output("blob"), L = {
1752
- image: new File([H], e, { type: "application/pdf" }),
1732
+ const N = x.output("blob"), D = {
1733
+ image: new File([N], e, { type: "application/pdf" }),
1753
1734
  format: "pdf",
1754
1735
  contentType: "application/pdf",
1755
1736
  fileName: e
1756
1737
  };
1757
- return i.fire("editor:canvas-exported", L), L;
1738
+ return i.fire("editor:canvas-exported", D), D;
1758
1739
  }
1759
1740
  if (o) {
1760
- const S = {
1761
- image: A,
1741
+ const w = {
1742
+ image: I,
1762
1743
  format: u,
1763
1744
  contentType: l,
1764
1745
  fileName: e
1765
1746
  };
1766
- return i.fire("editor:canvas-exported", S), S;
1747
+ return i.fire("editor:canvas-exported", w), w;
1767
1748
  }
1768
- const j = u === "svg" && !I ? e.replace(/\.[^/.]+$/, ".png") : e, T = {
1749
+ const j = u === "svg" && !S ? e.replace(/\.[^/.]+$/, ".png") : e, C = {
1769
1750
  image: new File([y], j, { type: l }),
1770
1751
  format: u,
1771
1752
  contentType: l,
1772
1753
  fileName: j
1773
1754
  };
1774
- return i.fire("editor:canvas-exported", T), T;
1755
+ return i.fire("editor:canvas-exported", C), C;
1775
1756
  } catch (d) {
1776
1757
  return this.editor.errorManager.emitError({
1777
1758
  origin: "ImageManager",
@@ -1795,7 +1776,7 @@ class ct {
1795
1776
  * @fires editor:object-exported
1796
1777
  */
1797
1778
  exportObjectAsImageFile() {
1798
- return N(this, arguments, function* (t = {}) {
1779
+ return k(this, arguments, function* (t = {}) {
1799
1780
  const {
1800
1781
  object: e,
1801
1782
  fileName: s = "image.png",
@@ -1908,7 +1889,7 @@ class ct {
1908
1889
  * @public
1909
1890
  */
1910
1891
  getContentType(t) {
1911
- return N(this, null, function* () {
1892
+ return k(this, null, function* () {
1912
1893
  return typeof t == "string" ? this.getContentTypeFromUrl(t) : t.type || "application/octet-stream";
1913
1894
  });
1914
1895
  }
@@ -1919,7 +1900,7 @@ class ct {
1919
1900
  * @public
1920
1901
  */
1921
1902
  getContentTypeFromUrl(t) {
1922
- return N(this, null, function* () {
1903
+ return k(this, null, function* () {
1923
1904
  if (t.startsWith("data:")) {
1924
1905
  const e = t.match(/^data:([^;]+)/);
1925
1906
  return e ? e[1] : "application/octet-stream";
@@ -1998,7 +1979,7 @@ class ct {
1998
1979
  return e ? e[1] : "";
1999
1980
  }
2000
1981
  }
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);
1982
+ const Tt = (h, t, e) => Math.max(Math.min(h, e), t), Ze = (h, t) => h * t, Xs = (h, t) => new et(h / 2, t / 2);
2002
1983
  function Ks(h) {
2003
1984
  return ((h == null ? void 0 : h.type) === "image" || (h == null ? void 0 : h.format) === "svg") && typeof (h == null ? void 0 : h.width) == "number" && typeof (h == null ? void 0 : h.height) == "number";
2004
1985
  }
@@ -2035,7 +2016,7 @@ class Qs {
2035
2016
  options: { canvasBackstoreWidth: a }
2036
2017
  } = this.editor, { width: r, height: c } = i, d = Tt(Number(t), Rt, Mt);
2037
2018
  if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(d), i.set({ width: d }), (f = n.clipPath) == null || f.set({ width: d }), e) {
2038
- const p = d / r, m = Ge(c, p);
2019
+ const p = d / r, m = Ze(c, p);
2039
2020
  this.setResolutionHeight(m);
2040
2021
  return;
2041
2022
  }
@@ -2065,7 +2046,7 @@ class Qs {
2065
2046
  options: { canvasBackstoreHeight: a }
2066
2047
  } = this.editor, { width: r, height: c } = i, d = Tt(Number(t), _t, wt);
2067
2048
  if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(d), i.set({ height: d }), (f = n.clipPath) == null || f.set({ height: d }), e) {
2068
- const p = d / c, m = Ge(r, p);
2049
+ const p = d / c, m = Ze(r, p);
2069
2050
  this.setResolutionWidth(m);
2070
2051
  return;
2071
2052
  }
@@ -2168,7 +2149,7 @@ class Qs {
2168
2149
  if (d.length === 1)
2169
2150
  t.setActiveObject(d[0]);
2170
2151
  else {
2171
- const l = new k(d, {
2152
+ const l = new U(d, {
2172
2153
  canvas: t
2173
2154
  });
2174
2155
  t.setActiveObject(l);
@@ -2341,8 +2322,8 @@ class Qs {
2341
2322
  const {
2342
2323
  width: f,
2343
2324
  height: p
2344
- } = n, m = d / f, v = l / p, b = Math.max(m, v);
2345
- u = f * b, g = p * b;
2325
+ } = n, m = d / f, v = l / p, M = Math.max(m, v);
2326
+ u = f * M, g = p * M;
2346
2327
  }
2347
2328
  this.setResolutionWidth(u, { withoutSave: !0 }), this.setResolutionHeight(g, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (d > a || l > r) && this.editor.zoomManager.calculateAndApplyDefaultZoom(), i.resetObject({ object: c, withoutSave: !0 }), o.centerObject(c), o.renderAll(), s || this.editor.historyManager.saveState(), o.fire("editor:montage-area-scaled-to-image", {
2348
2329
  object: c,
@@ -2455,7 +2436,7 @@ class qs {
2455
2436
  withoutSave: s
2456
2437
  } = {}) {
2457
2438
  const { canvas: o, historyManager: n } = this.editor, i = t || o.getActiveObject();
2458
- i && (i instanceof k ? i.getObjects().forEach((a) => {
2439
+ i && (i instanceof U ? i.getObjects().forEach((a) => {
2459
2440
  a.set("opacity", e);
2460
2441
  }) : i.set("opacity", e), o.renderAll(), s || n.saveState(), o.fire("editor:object-opacity-changed", {
2461
2442
  object: i,
@@ -2482,12 +2463,12 @@ class qs {
2482
2463
  } = {}) {
2483
2464
  const { canvas: n, historyManager: i } = this.editor, a = t || n.getActiveObject();
2484
2465
  if (a) {
2485
- if (a instanceof k && !o) {
2466
+ if (a instanceof U && !o) {
2486
2467
  const r = a.getObjects();
2487
2468
  n.discardActiveObject(), r.forEach((d) => {
2488
2469
  this._fitSingleObject(d, e);
2489
2470
  });
2490
- const c = new k(r, { canvas: n });
2471
+ const c = new U(r, { canvas: n });
2491
2472
  n.setActiveObject(c);
2492
2473
  } else
2493
2474
  this._fitSingleObject(a, e);
@@ -2506,11 +2487,11 @@ class qs {
2506
2487
  * @private
2507
2488
  */
2508
2489
  _fitSingleObject(t, e) {
2509
- const { canvas: s, montageArea: o } = this.editor, { width: n, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, d = n * Math.abs(a), l = i * Math.abs(r), u = c * Math.PI / 180, g = Math.abs(Math.cos(u)), f = Math.abs(Math.sin(u)), p = d * g + l * f, m = d * f + l * g, v = o.width, b = o.height;
2510
- let I;
2511
- e === "contain" ? I = Math.min(v / p, b / m) : I = Math.max(v / p, b / m), t.set({
2512
- scaleX: a * I,
2513
- scaleY: r * I
2490
+ const { canvas: s, montageArea: o } = this.editor, { width: n, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, d = n * Math.abs(a), l = i * Math.abs(r), u = c * Math.PI / 180, g = Math.abs(Math.cos(u)), f = Math.abs(Math.sin(u)), p = d * g + l * f, m = d * f + l * g, v = o.width, M = o.height;
2491
+ let S;
2492
+ e === "contain" ? S = Math.min(v / p, M / m) : S = Math.max(v / p, M / m), t.set({
2493
+ scaleX: a * S,
2494
+ scaleY: r * S
2514
2495
  }), s.centerObject(t);
2515
2496
  }
2516
2497
  /**
@@ -2619,10 +2600,10 @@ class Js {
2619
2600
  * @private
2620
2601
  */
2621
2602
  _calculateEmptySpaceRatio(t) {
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;
2623
- if (!(p || m || v || b)) return 0;
2624
- const y = Math.max(0, a - l), M = Math.max(0, u - r), A = Math.max(0, c - g), j = Math.max(0, f - d), w = Math.max(y, M), T = Math.max(A, j), S = w / n, C = T / i;
2625
- return Math.max(S, C);
2603
+ 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, M = f > d;
2604
+ if (!(p || m || v || M)) return 0;
2605
+ const y = Math.max(0, a - l), b = Math.max(0, u - r), I = Math.max(0, c - g), j = Math.max(0, f - d), A = Math.max(y, b), C = Math.max(I, j), w = A / n, T = C / i;
2606
+ return Math.max(w, T);
2626
2607
  }
2627
2608
  /**
2628
2609
  * Вычисляет плавный шаг перемещения viewport к центру с ускорением
@@ -2638,8 +2619,8 @@ class Js {
2638
2619
  const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), d = i.getHeight(), l = t.x - r[4], u = t.y - r[5], g = Math.abs(o), f = e - s;
2639
2620
  if (Math.abs(f) / g <= 0.1)
2640
2621
  return { x: l, y: u };
2641
- const m = c / 2, v = d / 2, b = a.left, I = a.top, y = m - b * s, M = v - I * s, A = (y - r[4]) / (e - s), j = (M - r[5]) / (e - s), w = A * g, T = j * g, S = w * n, C = T * n, x = Math.abs(S) > Math.abs(l) ? l : S, W = Math.abs(C) > Math.abs(u) ? u : C;
2642
- return { x, y: W };
2622
+ const m = c / 2, v = d / 2, M = a.left, S = a.top, y = m - M * s, b = v - S * s, I = (y - r[4]) / (e - s), j = (b - r[5]) / (e - s), A = I * g, C = j * g, w = A * n, T = C * n, E = Math.abs(w) > Math.abs(l) ? l : w, P = Math.abs(T) > Math.abs(u) ? u : T;
2623
+ return { x: E, y: P };
2643
2624
  }
2644
2625
  /**
2645
2626
  * Применяет плавное центрирование viewport при приближении к defaultZoom.
@@ -2651,7 +2632,7 @@ class Js {
2651
2632
  * @returns true если центрирование было применено
2652
2633
  * @private
2653
2634
  */
2654
- _applyViewportCentering(t, e = !1, s = He) {
2635
+ _applyViewportCentering(t, e = !1, s = Ye) {
2655
2636
  const { canvas: o } = this.editor, n = this._getScaledMontageDimensions(t), i = o.getWidth(), a = o.getHeight(), r = n.width > i || n.height > a, c = this._calculateFitZoom(), d = t - c;
2656
2637
  if (!(!r || d) && !e)
2657
2638
  return !1;
@@ -2726,10 +2707,10 @@ class Js {
2726
2707
  * @param options.pointY - Координата Y точки зума
2727
2708
  * @fires editor:zoom-changed
2728
2709
  */
2729
- zoom(t = He, e = {}) {
2710
+ zoom(t = Ye, e = {}) {
2730
2711
  var g, f;
2731
2712
  if (!t) return;
2732
- const { minZoom: s, maxZoom: o } = this, { canvas: n } = this.editor, i = t < 0, a = n.getZoom(), r = n.getCenterPoint(), c = (g = e.pointX) != null ? g : r.x, d = (f = e.pointY) != null ? f : r.y, l = new tt(c, d);
2713
+ 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 et(c, d);
2733
2714
  this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
2734
2715
  let u = Number((a + Number(t)).toFixed(3));
2735
2716
  u > o && (u = o), u < s && (u = s), n.zoomToPoint(l, u), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(u, i, t), n.fire("editor:zoom-changed", {
@@ -2744,7 +2725,7 @@ class Js {
2744
2725
  * @fires editor:zoom-changed
2745
2726
  */
2746
2727
  setZoom(t = this.defaultZoom) {
2747
- const { minZoom: e, maxZoom: s } = this, { canvas: o } = this.editor, n = new tt(o.getCenterPoint());
2728
+ const { minZoom: e, maxZoom: s } = this, { canvas: o } = this.editor, n = new et(o.getCenterPoint());
2748
2729
  let i = t;
2749
2730
  t > s && (i = s), t < e && (i = e), o.zoomToPoint(n, i), o.fire("editor:zoom-changed", {
2750
2731
  currentZoom: o.getZoom(),
@@ -2757,7 +2738,7 @@ class Js {
2757
2738
  * @fires editor:zoom-changed
2758
2739
  */
2759
2740
  resetZoom() {
2760
- const { canvas: t } = this.editor, e = new tt(t.getCenterPoint());
2741
+ const { canvas: t } = this.editor, e = new et(t.getCenterPoint());
2761
2742
  t.zoomToPoint(e, this.defaultZoom), this.editor.canvas.fire("editor:zoom-changed", {
2762
2743
  currentZoom: t.getZoom(),
2763
2744
  point: e
@@ -2846,7 +2827,7 @@ class Ot {
2846
2827
  }
2847
2828
  i.set({
2848
2829
  fill: t,
2849
- backgroundId: `background-${G()}`
2830
+ backgroundId: `background-${V()}`
2850
2831
  }), this.editor.canvas.requestRenderAll();
2851
2832
  } else
2852
2833
  this._removeCurrentBackground(), this._createColorBackground(t);
@@ -2883,7 +2864,7 @@ class Ot {
2883
2864
  }
2884
2865
  i.set({
2885
2866
  fill: a,
2886
- backgroundId: `background-${G()}`
2867
+ backgroundId: `background-${V()}`
2887
2868
  }), this.editor.canvas.requestRenderAll();
2888
2869
  } else
2889
2870
  this._removeCurrentBackground(), this._createGradientBackground(t);
@@ -2968,7 +2949,7 @@ class Ot {
2968
2949
  * @param options.withoutSave - Если true, не сохранять состояние в историю
2969
2950
  */
2970
2951
  setImageBackground(o) {
2971
- return N(this, arguments, function* ({
2952
+ return k(this, arguments, function* ({
2972
2953
  imageSource: t,
2973
2954
  customData: e = {},
2974
2955
  withoutSave: s = !1
@@ -3034,7 +3015,7 @@ class Ot {
3034
3015
  hasControls: !1,
3035
3016
  id: "background",
3036
3017
  backgroundType: "color",
3037
- backgroundId: `background-${G()}`
3018
+ backgroundId: `background-${V()}`
3038
3019
  }, { withoutSelection: !0 }), this.refresh();
3039
3020
  }
3040
3021
  /**
@@ -3051,7 +3032,7 @@ class Ot {
3051
3032
  hasControls: !1,
3052
3033
  id: "background",
3053
3034
  backgroundType: "gradient",
3054
- backgroundId: `background-${G()}`
3035
+ backgroundId: `background-${V()}`
3055
3036
  }, { withoutSelection: !0 }), this.refresh();
3056
3037
  const e = Ot._createFabricGradient(t);
3057
3038
  this.backgroundObject.set("fill", e), this.editor.canvas.requestRenderAll();
@@ -3061,7 +3042,7 @@ class Ot {
3061
3042
  * @param source - источник изображения (URL или File)
3062
3043
  */
3063
3044
  _createImageBackground(t, e) {
3064
- return N(this, null, function* () {
3045
+ return k(this, null, function* () {
3065
3046
  var o;
3066
3047
  const { image: s } = (o = yield this.editor.imageManager.importImage({
3067
3048
  source: t,
@@ -3079,7 +3060,7 @@ class Ot {
3079
3060
  hasControls: !1,
3080
3061
  id: "background",
3081
3062
  backgroundType: "image",
3082
- backgroundId: `background-${G()}`,
3063
+ backgroundId: `background-${V()}`,
3083
3064
  customData: e
3084
3065
  }), this._removeCurrentBackground(), this.backgroundObject = s, this.refresh();
3085
3066
  });
@@ -3114,7 +3095,7 @@ class Ot {
3114
3095
  { offset: 1, color: "#ffffff" }
3115
3096
  ], t.type === "linear") {
3116
3097
  const u = t.angle * Math.PI / 180, g = Ot._angleToCoords(u);
3117
- return new ze({
3098
+ return new ke({
3118
3099
  type: "linear",
3119
3100
  gradientUnits: "percentage",
3120
3101
  coords: g,
@@ -3133,7 +3114,7 @@ class Ot {
3133
3114
  r1: 0,
3134
3115
  r2: d / 100
3135
3116
  };
3136
- return new ze({
3117
+ return new ke({
3137
3118
  type: "radial",
3138
3119
  gradientUnits: "percentage",
3139
3120
  coords: l,
@@ -3168,7 +3149,7 @@ class Ot {
3168
3149
  }) ? !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;
3169
3150
  }
3170
3151
  }
3171
- class $t {
3152
+ class te {
3172
3153
  constructor({ editor: t }) {
3173
3154
  this.editor = t;
3174
3155
  }
@@ -3183,7 +3164,7 @@ class $t {
3183
3164
  const { canvas: s, historyManager: o } = this.editor;
3184
3165
  o.suspendHistory();
3185
3166
  const n = t || s.getActiveObject();
3186
- n && (n instanceof k ? n.getObjects().forEach((i) => {
3167
+ n && (n instanceof U ? n.getObjects().forEach((i) => {
3187
3168
  s.bringObjectToFront(i);
3188
3169
  }) : s.bringObjectToFront(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-to-front", {
3189
3170
  object: n,
@@ -3201,7 +3182,7 @@ class $t {
3201
3182
  const { canvas: s, historyManager: o } = this.editor;
3202
3183
  o.suspendHistory();
3203
3184
  const n = t || s.getActiveObject();
3204
- n && (n instanceof k ? $t._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
3185
+ n && (n instanceof U ? te._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
3205
3186
  object: n,
3206
3187
  withoutSave: e
3207
3188
  }));
@@ -3224,7 +3205,7 @@ class $t {
3224
3205
  n.suspendHistory();
3225
3206
  const r = t || s.getActiveObject();
3226
3207
  if (r) {
3227
- if (r instanceof k) {
3208
+ if (r instanceof U) {
3228
3209
  const c = r.getObjects();
3229
3210
  for (let d = c.length - 1; d >= 0; d -= 1)
3230
3211
  s.sendObjectToBack(c[d]);
@@ -3252,7 +3233,7 @@ class $t {
3252
3233
  } = this.editor;
3253
3234
  n.suspendHistory();
3254
3235
  const r = t || s.getActiveObject();
3255
- 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", {
3236
+ r && (r instanceof U ? 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", {
3256
3237
  object: r,
3257
3238
  withoutSave: e
3258
3239
  }));
@@ -3322,7 +3303,7 @@ class to {
3322
3303
  */
3323
3304
  addRectangle(d = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3324
3305
  var l = d, {
3325
- id: t = `rect-${G()}`,
3306
+ id: t = `rect-${V()}`,
3326
3307
  left: e,
3327
3308
  top: s,
3328
3309
  width: o = 100,
@@ -3336,7 +3317,7 @@ class to {
3336
3317
  "height",
3337
3318
  "fill"
3338
3319
  ]);
3339
- const { canvas: u } = this.editor, g = new gs(_({
3320
+ const { canvas: u } = this.editor, g = new us(B({
3340
3321
  id: t,
3341
3322
  left: e,
3342
3323
  top: s,
@@ -3364,7 +3345,7 @@ class to {
3364
3345
  */
3365
3346
  addCircle(c = {}, { withoutSelection: a, withoutAdding: r } = {}) {
3366
3347
  var d = c, {
3367
- id: t = `circle-${G()}`,
3348
+ id: t = `circle-${V()}`,
3368
3349
  left: e,
3369
3350
  top: s,
3370
3351
  radius: o = 50,
@@ -3376,7 +3357,7 @@ class to {
3376
3357
  "radius",
3377
3358
  "fill"
3378
3359
  ]);
3379
- const { canvas: l } = this.editor, u = new fs(_({
3360
+ const { canvas: l } = this.editor, u = new gs(B({
3380
3361
  id: t,
3381
3362
  left: e,
3382
3363
  top: s,
@@ -3404,7 +3385,7 @@ class to {
3404
3385
  */
3405
3386
  addTriangle(d = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3406
3387
  var l = d, {
3407
- id: t = `triangle-${G()}`,
3388
+ id: t = `triangle-${V()}`,
3408
3389
  left: e,
3409
3390
  top: s,
3410
3391
  width: o = 100,
@@ -3418,7 +3399,7 @@ class to {
3418
3399
  "height",
3419
3400
  "fill"
3420
3401
  ]);
3421
- const { canvas: u } = this.editor, g = new ps(_({
3402
+ const { canvas: u } = this.editor, g = new fs(B({
3422
3403
  id: t,
3423
3404
  left: e,
3424
3405
  top: s,
@@ -3457,10 +3438,10 @@ class eo {
3457
3438
  * Асинхронное клонирование для внутреннего буфера
3458
3439
  */
3459
3440
  _cloneToInternalClipboard(t) {
3460
- return N(this, null, function* () {
3441
+ return k(this, null, function* () {
3461
3442
  const { canvas: e, errorManager: s } = this.editor;
3462
3443
  try {
3463
- const o = yield t.clone(Xt);
3444
+ const o = yield t.clone(Kt);
3464
3445
  this.clipboard = o, e.fire("editor:object-copied", { object: o });
3465
3446
  } catch (o) {
3466
3447
  s.emitError({
@@ -3477,7 +3458,7 @@ class eo {
3477
3458
  * Копирование в системный буфер обмена
3478
3459
  */
3479
3460
  _copyToSystemClipboard(t) {
3480
- return N(this, null, function* () {
3461
+ return k(this, null, function* () {
3481
3462
  const { errorManager: e } = this.editor;
3482
3463
  if (typeof ClipboardItem == "undefined" || !navigator.clipboard)
3483
3464
  return e.emitWarning({
@@ -3487,7 +3468,7 @@ class eo {
3487
3468
  message: "navigator.clipboard не поддерживается в этом браузере или отсутствует HTTPS-соединение."
3488
3469
  }), !1;
3489
3470
  try {
3490
- const s = t.toObject(Xt), o = JSON.stringify(s);
3471
+ const s = t.toObject(Kt), o = JSON.stringify(s);
3491
3472
  return t.type === "image" ? this._copyImageToClipboard(t, o) : this._copyTextToClipboard(o);
3492
3473
  } catch (s) {
3493
3474
  return e.emitError({
@@ -3504,7 +3485,7 @@ class eo {
3504
3485
  * Копирование изображения в буфер обмена
3505
3486
  */
3506
3487
  _copyImageToClipboard(t, e) {
3507
- return N(this, null, function* () {
3488
+ return k(this, null, function* () {
3508
3489
  try {
3509
3490
  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);
3510
3491
  for (let l = 0; l < a.length; l += 1)
@@ -3526,9 +3507,9 @@ class eo {
3526
3507
  * Копирование текста в буфер обмена
3527
3508
  */
3528
3509
  _copyTextToClipboard(t) {
3529
- return N(this, null, function* () {
3510
+ return k(this, null, function* () {
3530
3511
  try {
3531
- const e = `${Ze}${t}`;
3512
+ const e = `${He}${t}`;
3532
3513
  return yield navigator.clipboard.writeText(e), console.info("Text copied to clipboard successfully"), !0;
3533
3514
  } catch (e) {
3534
3515
  const { errorManager: s } = this.editor;
@@ -3548,7 +3529,7 @@ class eo {
3548
3529
  */
3549
3530
  _addClonedObjectToCanvas(t) {
3550
3531
  const { canvas: e, historyManager: s } = this.editor;
3551
- if (e.discardActiveObject(), t instanceof k) {
3532
+ if (e.discardActiveObject(), t instanceof U) {
3552
3533
  s.suspendHistory(), t.canvas = e, t.forEachObject((o) => {
3553
3534
  e.add(o);
3554
3535
  }), e.setActiveObject(t), e.requestRenderAll(), s.resumeHistory(), s.saveState();
@@ -3561,7 +3542,7 @@ class eo {
3561
3542
  * @param source - источник изображения (data URL или URL)
3562
3543
  */
3563
3544
  _handleImageImport(t) {
3564
- return N(this, null, function* () {
3545
+ return k(this, null, function* () {
3565
3546
  var s;
3566
3547
  const { image: e } = (s = yield this.editor.imageManager.importImage({
3567
3548
  source: t,
@@ -3577,18 +3558,18 @@ class eo {
3577
3558
  * @fires editor:object-pasted
3578
3559
  */
3579
3560
  copyPaste(t) {
3580
- return N(this, null, function* () {
3561
+ return k(this, null, function* () {
3581
3562
  const { canvas: e } = this.editor, s = t || e.getActiveObject();
3582
3563
  if (!s || s.locked) return !1;
3583
3564
  try {
3584
- const o = yield s.clone(Xt);
3585
- return o instanceof k && o.forEachObject((n) => {
3565
+ const o = yield s.clone(Kt);
3566
+ return o instanceof U && o.forEachObject((n) => {
3586
3567
  n.set({
3587
- id: `${n.type}-${G()}`,
3568
+ id: `${n.type}-${V()}`,
3588
3569
  evented: !0
3589
3570
  });
3590
3571
  }), o.set({
3591
- id: `${o.type}-${G()}`,
3572
+ id: `${o.type}-${V()}`,
3592
3573
  left: o.left + 10,
3593
3574
  top: o.top + 10,
3594
3575
  evented: !0
@@ -3612,14 +3593,14 @@ class eo {
3612
3593
  * @param event.clipboardData.items — элементы буфера обмена
3613
3594
  */
3614
3595
  handlePasteEvent(e) {
3615
- return N(this, arguments, function* ({ clipboardData: t }) {
3596
+ return k(this, arguments, function* ({ clipboardData: t }) {
3616
3597
  var r;
3617
3598
  if (!((r = t == null ? void 0 : t.items) != null && r.length)) {
3618
3599
  this.paste();
3619
3600
  return;
3620
3601
  }
3621
3602
  const s = t.getData("text/plain");
3622
- if (s && s.startsWith(Ze)) {
3603
+ if (s && s.startsWith(He)) {
3623
3604
  this.paste();
3624
3605
  return;
3625
3606
  }
@@ -3663,18 +3644,18 @@ class eo {
3663
3644
  * @fires editor:object-pasted
3664
3645
  */
3665
3646
  paste() {
3666
- return N(this, null, function* () {
3647
+ return k(this, null, function* () {
3667
3648
  const { canvas: t } = this.editor;
3668
3649
  if (!this.clipboard) return !1;
3669
3650
  try {
3670
- const e = yield this.clipboard.clone(Xt);
3671
- return t.discardActiveObject(), e instanceof k && e.forEachObject((s) => {
3651
+ const e = yield this.clipboard.clone(Kt);
3652
+ return t.discardActiveObject(), e instanceof U && e.forEachObject((s) => {
3672
3653
  s.set({
3673
- id: `${s.type}-${G()}`,
3654
+ id: `${s.type}-${V()}`,
3674
3655
  evented: !0
3675
3656
  });
3676
3657
  }), e.set({
3677
- id: `${e.type}-${G()}`,
3658
+ id: `${e.type}-${V()}`,
3678
3659
  left: e.left + 10,
3679
3660
  top: e.top + 10,
3680
3661
  evented: !0
@@ -3692,7 +3673,7 @@ class eo {
3692
3673
  });
3693
3674
  }
3694
3675
  }
3695
- class te {
3676
+ class ee {
3696
3677
  constructor({ editor: t }) {
3697
3678
  this.editor = t;
3698
3679
  }
@@ -3718,7 +3699,7 @@ class te {
3718
3699
  editable: !1,
3719
3700
  locked: !0
3720
3701
  };
3721
- i.set(a), !e && te._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
3702
+ i.set(a), !e && ee._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
3722
3703
  c.set(a);
3723
3704
  }), o.renderAll(), s || n.saveState(), o.fire("editor:object-locked", {
3724
3705
  object: i,
@@ -3747,7 +3728,7 @@ class te {
3747
3728
  editable: !0,
3748
3729
  locked: !1
3749
3730
  };
3750
- n.set(i), te._isGroupOrSelection(n) && n.getObjects().forEach((a) => {
3731
+ n.set(i), ee._isGroupOrSelection(n) && n.getObjects().forEach((a) => {
3751
3732
  a.set(i);
3752
3733
  }), s.renderAll(), e || o.saveState(), s.fire("editor:object-unlocked", {
3753
3734
  object: n,
@@ -3755,7 +3736,7 @@ class te {
3755
3736
  });
3756
3737
  }
3757
3738
  static _isGroupOrSelection(t) {
3758
- return t instanceof k || t instanceof Et;
3739
+ return t instanceof U || t instanceof Et;
3759
3740
  }
3760
3741
  }
3761
3742
  class so {
@@ -3770,7 +3751,7 @@ class so {
3770
3751
  if (Array.isArray(t))
3771
3752
  return t.length > 0 ? t : null;
3772
3753
  const e = t || this.editor.canvas.getActiveObject();
3773
- return !e || !(e instanceof k) ? null : e.getObjects();
3754
+ return !e || !(e instanceof U) ? null : e.getObjects();
3774
3755
  }
3775
3756
  /**
3776
3757
  * Получить группы для разгруппировки
@@ -3781,13 +3762,13 @@ class so {
3781
3762
  const s = t.filter((o) => o instanceof Et);
3782
3763
  return s.length > 0 ? s : null;
3783
3764
  }
3784
- if (t instanceof k) {
3765
+ if (t instanceof U) {
3785
3766
  const s = t.getObjects().filter((o) => o instanceof Et);
3786
3767
  return s.length > 0 ? s : null;
3787
3768
  }
3788
3769
  const e = t || this.editor.canvas.getActiveObject();
3789
3770
  if (!e) return null;
3790
- if (e instanceof k) {
3771
+ if (e instanceof U) {
3791
3772
  const s = e.getObjects().filter((o) => o instanceof Et);
3792
3773
  return s.length > 0 ? s : null;
3793
3774
  }
@@ -3809,7 +3790,7 @@ class so {
3809
3790
  try {
3810
3791
  o.suspendHistory();
3811
3792
  const i = new Et(n, {
3812
- id: `group-${G()}`
3793
+ id: `group-${V()}`
3813
3794
  });
3814
3795
  n.forEach((r) => s.remove(r)), s.add(i), s.setActiveObject(i), s.requestRenderAll();
3815
3796
  const a = {
@@ -3844,7 +3825,7 @@ class so {
3844
3825
  s.add(l), i.push(l);
3845
3826
  });
3846
3827
  });
3847
- const a = new k(i, {
3828
+ const a = new U(i, {
3848
3829
  canvas: s
3849
3830
  });
3850
3831
  s.setActiveObject(a), s.requestRenderAll();
@@ -3870,11 +3851,11 @@ class oo {
3870
3851
  selectAll() {
3871
3852
  const { canvas: t, canvasManager: e, objectLockManager: s } = this.editor;
3872
3853
  t.discardActiveObject();
3873
- const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new k(e.getObjects(), { canvas: t }) : o[0];
3854
+ const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new U(e.getObjects(), { canvas: t }) : o[0];
3874
3855
  n && s.lockObject({ object: i, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(i), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: i });
3875
3856
  }
3876
3857
  }
3877
- class we {
3858
+ class Me {
3878
3859
  constructor({ editor: t }) {
3879
3860
  this.editor = t;
3880
3861
  }
@@ -3921,7 +3902,7 @@ class we {
3921
3902
  s || n.suspendHistory();
3922
3903
  const r = [];
3923
3904
  if (a.forEach((d) => {
3924
- if (we._isUngroupableGroup(d)) {
3905
+ if (Me._isUngroupableGroup(d)) {
3925
3906
  const l = this._handleGroupDeletion(d);
3926
3907
  r.push(...l);
3927
3908
  return;
@@ -4041,7 +4022,7 @@ const bt = {
4041
4022
  APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
4042
4023
  }
4043
4024
  };
4044
- class Yt {
4025
+ class Wt {
4045
4026
  constructor({ editor: t }) {
4046
4027
  this._buffer = [], this.editor = t;
4047
4028
  }
@@ -4068,7 +4049,7 @@ class Yt {
4068
4049
  * @fires editor:error
4069
4050
  */
4070
4051
  emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, data: o, message: n }) {
4071
- if (!Yt.isValidErrorCode(s)) {
4052
+ if (!Wt.isValidErrorCode(s)) {
4072
4053
  console.warn("Неизвестный код ошибки: ", { code: s, origin: t, method: e });
4073
4054
  return;
4074
4055
  }
@@ -4082,7 +4063,7 @@ class Yt {
4082
4063
  message: i,
4083
4064
  data: o
4084
4065
  };
4085
- this._buffer.push(_({
4066
+ this._buffer.push(B({
4086
4067
  type: "editor:error"
4087
4068
  }, a)), this.editor.canvas.fire("editor:error", a);
4088
4069
  }
@@ -4097,7 +4078,7 @@ class Yt {
4097
4078
  * @fires editor:warning
4098
4079
  */
4099
4080
  emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, message: o, data: n }) {
4100
- if (!Yt.isValidErrorCode(s)) {
4081
+ if (!Wt.isValidErrorCode(s)) {
4101
4082
  console.warn("Неизвестный код предупреждения: ", { code: s, origin: t, method: e });
4102
4083
  return;
4103
4084
  }
@@ -4110,7 +4091,7 @@ class Yt {
4110
4091
  message: i,
4111
4092
  data: n
4112
4093
  };
4113
- this._buffer.push(_({
4094
+ this._buffer.push(B({
4114
4095
  type: "editor:warning"
4115
4096
  }, a)), this.editor.canvas.fire("editor:warning", a);
4116
4097
  }
@@ -4233,11 +4214,11 @@ const at = ({
4233
4214
  }
4234
4215
  _getNonTransformedDimensions() {
4235
4216
  const { width: t, height: e } = this._getBackgroundDimensions();
4236
- return new tt(t, e).scalarAdd(this.strokeWidth);
4217
+ return new et(t, e).scalarAdd(this.strokeWidth);
4237
4218
  }
4238
4219
  _getTransformedDimensions(t = {}) {
4239
4220
  const { width: e, height: s } = this._getBackgroundDimensions();
4240
- return super._getTransformedDimensions(yt(_({}, t), {
4221
+ return super._getTransformedDimensions(yt(B({}, t), {
4241
4222
  width: e,
4242
4223
  height: s
4243
4224
  }));
@@ -4247,7 +4228,7 @@ const at = ({
4247
4228
  */
4248
4229
  toObject(t = []) {
4249
4230
  const e = super.toObject(t);
4250
- return yt(_({}, e), {
4231
+ return yt(B({}, e), {
4251
4232
  backgroundOpacity: this.backgroundOpacity,
4252
4233
  paddingTop: this.paddingTop,
4253
4234
  paddingRight: this.paddingRight,
@@ -4308,9 +4289,9 @@ const at = ({
4308
4289
  const e = at({ value: (o = this.backgroundOpacity) != null ? o : 1, min: 0, max: 1 });
4309
4290
  let s;
4310
4291
  try {
4311
- s = new ms(t);
4292
+ s = new ps(t);
4312
4293
  } catch (n) {
4313
- return Yt.emitError({
4294
+ return Wt.emitError({
4314
4295
  origin: "BackgroundTextbox",
4315
4296
  method: "_getEffectiveBackgroundFill",
4316
4297
  code: "INVALID_COLOR_VALUE",
@@ -4372,10 +4353,10 @@ Dt.type = "background-textbox", Dt.cacheProperties = [
4372
4353
  "radiusBottomRight",
4373
4354
  "radiusBottomLeft"
4374
4355
  ];
4375
- let ee = Dt;
4356
+ let se = Dt;
4376
4357
  const io = () => {
4377
4358
  var h;
4378
- (h = Pe) != null && h.setClass && Pe.setClass(ee, "background-textbox");
4359
+ (h = ze) != null && h.setClass && ze.setClass(se, "background-textbox");
4379
4360
  }, ao = ({ textbox: h }) => {
4380
4361
  var s, o;
4381
4362
  if (!h.isEditing) return null;
@@ -4393,7 +4374,7 @@ const io = () => {
4393
4374
  if (!t) return !1;
4394
4375
  const e = (o = (s = h.text) == null ? void 0 : s.length) != null ? o : 0;
4395
4376
  return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
4396
- }, ne = ({
4377
+ }, ie = ({
4397
4378
  textbox: h,
4398
4379
  styles: t,
4399
4380
  range: e
@@ -4401,7 +4382,7 @@ const io = () => {
4401
4382
  if (!t || !Object.keys(t).length) return !1;
4402
4383
  const { start: s, end: o } = e;
4403
4384
  return o <= s ? !1 : (h.setSelectionStyles(t, s, o), !0);
4404
- }, Ve = ({
4385
+ }, Ge = ({
4405
4386
  textbox: h,
4406
4387
  range: t,
4407
4388
  property: e
@@ -4415,11 +4396,8 @@ const io = () => {
4415
4396
  );
4416
4397
  if (s.length)
4417
4398
  return (o = s[0]) == null ? void 0 : o[e];
4418
- }, Xe = ({ strokeColor: h, width: t }) => {
4419
- if (!(t <= 0))
4420
- return h != null ? h : "#000000";
4421
- }, Ke = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, ie = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", st = 0.01;
4422
- class z {
4399
+ }, Ve = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", Xe = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, ae = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", ot = 0.01;
4400
+ class F {
4423
4401
  constructor({ editor: t }) {
4424
4402
  var e;
4425
4403
  this._handleTextEditingEntered = () => {
@@ -4427,23 +4405,23 @@ class z {
4427
4405
  }, this._handleTextEditingExited = (s) => {
4428
4406
  var r, c;
4429
4407
  const { target: o } = s;
4430
- if (!z._isTextbox(o)) return;
4408
+ if (!F._isTextbox(o)) return;
4431
4409
  const n = (r = o.text) != null ? r : "";
4432
4410
  if (!!o.uppercase) {
4433
4411
  const d = (c = o.textCaseRaw) != null ? c : n.toLocaleLowerCase();
4434
4412
  o.textCaseRaw = d;
4435
4413
  } else
4436
4414
  o.textCaseRaw = n;
4437
- z._roundTextboxDimensions({ textbox: o }) && (o.setCoords(), o.dirty = !0, this.canvas.requestRenderAll()), o.locked || o.set({
4415
+ F._roundTextboxDimensions({ textbox: o }) && (o.setCoords(), o.dirty = !0, this.canvas.requestRenderAll()), o.locked || o.set({
4438
4416
  lockMovementX: !1,
4439
4417
  lockMovementY: !1
4440
4418
  }), setTimeout(() => {
4441
4419
  this.isTextEditingActive = !1, this.editor.historyManager.saveState();
4442
4420
  }, Vs);
4443
4421
  }, this._handleObjectScaling = (s) => {
4444
- var X, It, Wt, mt, Ht, Ct, Ae, je, Ie, Ce, Te, Ee, Oe;
4422
+ var X, It, Ht, mt, Zt, Ct, Se, Ae, je, Ie, Ce, Te, Ee;
4445
4423
  const { target: o, transform: n } = s;
4446
- if (o instanceof k || !z._isTextbox(o) || !n) return;
4424
+ if (o instanceof U || !F._isTextbox(o) || !n) return;
4447
4425
  o.isScaling = !0;
4448
4426
  const i = this._ensureScalingState(o), {
4449
4427
  baseWidth: a,
@@ -4452,139 +4430,139 @@ class z {
4452
4430
  basePadding: d,
4453
4431
  baseRadii: l,
4454
4432
  baseStyles: u
4455
- } = 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", M = ["tl", "tr", "bl", "br"].includes(v) || b === "scale", A = M || y;
4456
- if (!I && !y && !M) return;
4457
- const j = Math.abs((Ct = (Ht = o.scaleX) != null ? Ht : n.scaleX) != null ? Ct : 1) || 1, w = 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 * w), {
4458
- paddingTop: x = 0,
4459
- paddingRight: W = 0,
4460
- paddingBottom: Y = 0,
4461
- paddingLeft: H = 0,
4462
- radiusTopLeft: V = 0,
4463
- radiusTopRight: L = 0,
4464
- radiusBottomRight: D = 0,
4465
- radiusBottomLeft: P = 0,
4466
- fontSize: Z,
4467
- width: U,
4433
+ } = 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 = (Ht = n.corner) != null ? Ht : "", M = (mt = n.action) != null ? mt : "", S = ["ml", "mr"].includes(v) || M === "scaleX", y = ["mt", "mb"].includes(v) || M === "scaleY", b = ["tl", "tr", "bl", "br"].includes(v) || M === "scale", I = b || y;
4434
+ if (!S && !y && !b) return;
4435
+ const j = Math.abs((Ct = (Zt = o.scaleX) != null ? Zt : n.scaleX) != null ? Ct : 1) || 1, A = Math.abs((Ae = (Se = o.scaleY) != null ? Se : n.scaleY) != null ? Ae : 1) || 1, C = Math.max(1, p * j), w = Math.max(1, Math.round(C)), T = Math.max(1, c * A), {
4436
+ paddingTop: E = 0,
4437
+ paddingRight: P = 0,
4438
+ paddingBottom: x = 0,
4439
+ paddingLeft: N = 0,
4440
+ radiusTopLeft: Z = 0,
4441
+ radiusTopRight: D = 0,
4442
+ radiusBottomRight: _ = 0,
4443
+ radiusBottomLeft: W = 0,
4444
+ fontSize: G,
4445
+ width: Y,
4468
4446
  originX: K = "left"
4469
- } = o, $ = M || y, q = M || y, F = $ ? {
4470
- top: Math.max(0, d.top * w),
4471
- right: Math.max(0, d.right * w),
4472
- bottom: Math.max(0, d.bottom * w),
4473
- left: Math.max(0, d.left * w)
4474
- } : d, Q = q ? {
4475
- topLeft: Math.max(0, l.topLeft * w),
4476
- topRight: Math.max(0, l.topRight * w),
4477
- bottomRight: Math.max(0, l.bottomRight * w),
4478
- bottomLeft: Math.max(0, l.bottomLeft * w)
4447
+ } = o, tt = b || y, J = b || y, H = tt ? {
4448
+ top: Math.max(0, d.top * A),
4449
+ right: Math.max(0, d.right * A),
4450
+ bottom: Math.max(0, d.bottom * A),
4451
+ left: Math.max(0, d.left * A)
4452
+ } : d, q = J ? {
4453
+ topLeft: Math.max(0, l.topLeft * A),
4454
+ topRight: Math.max(0, l.topRight * A),
4455
+ bottomRight: Math.max(0, l.bottomRight * A),
4456
+ bottomLeft: Math.max(0, l.bottomLeft * A)
4479
4457
  } : l, St = Object.keys(u).length > 0;
4480
- let et;
4481
- if (A && St) {
4482
- const se = {};
4483
- Object.entries(u).forEach(([rs, Le]) => {
4484
- if (!Le) return;
4485
- const oe = {};
4486
- Object.entries(Le).forEach(([cs, Zt]) => {
4487
- if (!Zt) return;
4488
- const De = _({}, Zt);
4489
- typeof Zt.fontSize == "number" && (De.fontSize = Math.max(1, Zt.fontSize * w)), oe[cs] = De;
4490
- }), Object.keys(oe).length && (se[rs] = oe);
4491
- }), Object.keys(se).length && (et = se);
4458
+ let st;
4459
+ if (I && St) {
4460
+ const oe = {};
4461
+ Object.entries(u).forEach(([as, Oe]) => {
4462
+ if (!Oe) return;
4463
+ const ne = {};
4464
+ Object.entries(Oe).forEach(([rs, Gt]) => {
4465
+ if (!Gt) return;
4466
+ const Le = B({}, Gt);
4467
+ typeof Gt.fontSize == "number" && (Le.fontSize = Math.max(1, Gt.fontSize * A)), ne[rs] = Le;
4468
+ }), Object.keys(ne).length && (oe[as] = ne);
4469
+ }), Object.keys(oe).length && (st = oe);
4492
4470
  }
4493
- const lt = (Ce = (Ie = n.originX) != null ? Ie : K) != null ? Ce : "left", pt = m + p, At = m + p / 2, ht = U != null ? U : p, jt = S !== ht, Ft = Math.abs(C - (Z != null ? Z : c)) > st, Nt = Math.abs(F.top - x) > st || Math.abs(F.right - W) > st || Math.abs(F.bottom - Y) > st || Math.abs(F.left - H) > st, xt = Math.abs(Q.topLeft - V) > st || Math.abs(Q.topRight - L) > st || Math.abs(Q.bottomRight - D) > st || Math.abs(Q.bottomLeft - P) > st;
4494
- if (!jt && !Ft && !Nt && !xt) {
4471
+ const lt = (Ie = (je = n.originX) != null ? je : K) != null ? Ie : "left", pt = m + p, At = m + p / 2, ht = Y != null ? Y : p, jt = w !== ht, Yt = Math.abs(T - (G != null ? G : c)) > ot, xt = Math.abs(H.top - E) > ot || Math.abs(H.right - P) > ot || Math.abs(H.bottom - x) > ot || Math.abs(H.left - N) > ot, Nt = Math.abs(q.topLeft - Z) > ot || Math.abs(q.topRight - D) > ot || Math.abs(q.bottomRight - _) > ot || Math.abs(q.bottomLeft - W) > ot;
4472
+ if (!jt && !Yt && !xt && !Nt) {
4495
4473
  o.set({ scaleX: 1, scaleY: 1 }), n.scaleX = 1, n.scaleY = 1;
4496
4474
  return;
4497
4475
  }
4498
- et && (o.styles = et), o.set({
4499
- width: S,
4500
- fontSize: A ? C : c,
4501
- paddingTop: F.top,
4502
- paddingRight: F.right,
4503
- paddingBottom: F.bottom,
4504
- paddingLeft: F.left,
4505
- radiusTopLeft: Q.topLeft,
4506
- radiusTopRight: Q.topRight,
4507
- radiusBottomRight: Q.bottomRight,
4508
- radiusBottomLeft: Q.bottomLeft,
4476
+ st && (o.styles = st), o.set({
4477
+ width: w,
4478
+ fontSize: I ? T : c,
4479
+ paddingTop: H.top,
4480
+ paddingRight: H.right,
4481
+ paddingBottom: H.bottom,
4482
+ paddingLeft: H.left,
4483
+ radiusTopLeft: q.topLeft,
4484
+ radiusTopRight: q.topRight,
4485
+ radiusBottomRight: q.bottomRight,
4486
+ radiusBottomLeft: q.bottomLeft,
4509
4487
  scaleX: 1,
4510
4488
  scaleY: 1
4511
4489
  });
4512
- const Bt = z._roundTextboxDimensions({ textbox: o });
4490
+ const Bt = F._roundTextboxDimensions({ textbox: o });
4513
4491
  Bt && (o.dirty = !0);
4514
- const ut = (Te = o.width) != null ? Te : S, kt = ut !== ht;
4492
+ const ut = (Ce = o.width) != null ? Ce : w, kt = ut !== ht;
4515
4493
  let gt = m;
4516
- kt && (I || M) && (lt === "right" ? gt = pt - ut : lt === "center" && (gt = At - ut / 2)), o.set({ left: gt }), i.baseLeft = gt, n.scaleX = 1, n.scaleY = 1;
4494
+ kt && (S || b) && (lt === "right" ? gt = pt - ut : lt === "center" && (gt = At - ut / 2)), o.set({ left: gt }), i.baseLeft = gt, n.scaleX = 1, n.scaleY = 1;
4517
4495
  const { original: it } = n;
4518
- 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 = {
4519
- top: F.top,
4520
- right: F.right,
4521
- bottom: F.bottom,
4522
- left: F.left
4496
+ 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 = (Te = o.fontSize) != null ? Te : T, i.baseStyles = JSON.parse(JSON.stringify((Ee = o.styles) != null ? Ee : {})), i.basePadding = {
4497
+ top: H.top,
4498
+ right: H.right,
4499
+ bottom: H.bottom,
4500
+ left: H.left
4523
4501
  }, i.baseRadii = {
4524
- topLeft: Q.topLeft,
4525
- topRight: Q.topRight,
4526
- bottomRight: Q.bottomRight,
4527
- bottomLeft: Q.bottomLeft
4528
- }, i.hasWidthChange = kt || Ft || Nt || xt || Bt;
4502
+ topLeft: q.topLeft,
4503
+ topRight: q.topRight,
4504
+ bottomRight: q.bottomRight,
4505
+ bottomLeft: q.bottomLeft
4506
+ }, i.hasWidthChange = kt || Yt || xt || Nt || Bt;
4529
4507
  }, this._handleObjectModified = (s) => {
4530
- var b, I, y;
4508
+ var M, S, y;
4531
4509
  const { target: o } = s;
4532
- if (o instanceof k) {
4533
- const M = o.getObjects();
4534
- if (!M.some((S) => z._isTextbox(S))) return;
4535
- const { scaleX: j = 1, scaleY: w = 1 } = o;
4536
- if (Math.abs(j - 1) < st && Math.abs(w - 1) < st) return;
4537
- this.canvas.discardActiveObject(), M.forEach((S) => {
4538
- var C, x, W, Y;
4539
- if (z._isTextbox(S)) {
4540
- const H = (C = S.scaleX) != null ? C : 1, V = (x = S.scaleY) != null ? x : 1, L = ((W = S.fontSize) != null ? W : 16) * V, D = ((Y = S.width) != null ? Y : 0) * H, P = V, {
4541
- paddingTop: Z = 0,
4542
- paddingRight: U = 0,
4510
+ if (o instanceof U) {
4511
+ const b = o.getObjects();
4512
+ if (!b.some((w) => F._isTextbox(w))) return;
4513
+ const { scaleX: j = 1, scaleY: A = 1 } = o;
4514
+ if (Math.abs(j - 1) < ot && Math.abs(A - 1) < ot) return;
4515
+ this.canvas.discardActiveObject(), b.forEach((w) => {
4516
+ var T, E, P, x;
4517
+ if (F._isTextbox(w)) {
4518
+ const N = (T = w.scaleX) != null ? T : 1, Z = (E = w.scaleY) != null ? E : 1, D = ((P = w.fontSize) != null ? P : 16) * Z, _ = ((x = w.width) != null ? x : 0) * N, W = Z, {
4519
+ paddingTop: G = 0,
4520
+ paddingRight: Y = 0,
4543
4521
  paddingBottom: K = 0,
4544
- paddingLeft: $ = 0,
4545
- radiusTopLeft: q = 0,
4546
- radiusTopRight: F = 0,
4547
- radiusBottomRight: Q = 0,
4522
+ paddingLeft: tt = 0,
4523
+ radiusTopLeft: J = 0,
4524
+ radiusTopRight: H = 0,
4525
+ radiusBottomRight: q = 0,
4548
4526
  radiusBottomLeft: St = 0,
4549
- styles: et
4550
- } = S, lt = {
4551
- paddingTop: Math.max(0, Z * P),
4552
- paddingRight: Math.max(0, U * P),
4553
- paddingBottom: Math.max(0, K * P),
4554
- paddingLeft: Math.max(0, $ * P)
4527
+ styles: st
4528
+ } = w, lt = {
4529
+ paddingTop: Math.max(0, G * W),
4530
+ paddingRight: Math.max(0, Y * W),
4531
+ paddingBottom: Math.max(0, K * W),
4532
+ paddingLeft: Math.max(0, tt * W)
4555
4533
  }, pt = {
4556
- radiusTopLeft: Math.max(0, q * P),
4557
- radiusTopRight: Math.max(0, F * P),
4558
- radiusBottomRight: Math.max(0, Q * P),
4559
- radiusBottomLeft: Math.max(0, St * P)
4534
+ radiusTopLeft: Math.max(0, J * W),
4535
+ radiusTopRight: Math.max(0, H * W),
4536
+ radiusBottomRight: Math.max(0, q * W),
4537
+ radiusBottomLeft: Math.max(0, St * W)
4560
4538
  };
4561
- let At = et;
4562
- et && Object.keys(et).length > 0 && (At = JSON.parse(JSON.stringify(et)), Object.values(At).forEach((ht) => {
4539
+ let At = st;
4540
+ st && Object.keys(st).length > 0 && (At = JSON.parse(JSON.stringify(st)), Object.values(At).forEach((ht) => {
4563
4541
  Object.values(ht).forEach((jt) => {
4564
- typeof jt.fontSize == "number" && (jt.fontSize = Math.max(1, jt.fontSize * P));
4542
+ typeof jt.fontSize == "number" && (jt.fontSize = Math.max(1, jt.fontSize * W));
4565
4543
  });
4566
- })), S.set(yt(_(_({
4567
- fontSize: L,
4568
- width: D,
4544
+ })), w.set(yt(B(B({
4545
+ fontSize: D,
4546
+ width: _,
4569
4547
  scaleX: 1,
4570
4548
  scaleY: 1
4571
4549
  }, lt), pt), {
4572
4550
  styles: At
4573
- })), z._roundTextboxDimensions({ textbox: S });
4551
+ })), F._roundTextboxDimensions({ textbox: w });
4574
4552
  }
4575
- S.setCoords();
4553
+ w.setCoords();
4576
4554
  });
4577
- const T = new k(M, {
4555
+ const C = new U(b, {
4578
4556
  canvas: this.canvas
4579
4557
  });
4580
- this.canvas.setActiveObject(T), this.canvas.requestRenderAll();
4558
+ this.canvas.setActiveObject(C), this.canvas.requestRenderAll();
4581
4559
  return;
4582
4560
  }
4583
- if (!z._isTextbox(o)) return;
4561
+ if (!F._isTextbox(o)) return;
4584
4562
  o.isScaling = !1;
4585
4563
  const n = this.scalingState.get(o);
4586
4564
  if (this.scalingState.delete(o), !(n != null && n.hasWidthChange)) return;
4587
- const i = (b = o.width) != null ? b : o.calcTextWidth(), a = (y = (I = o.fontSize) != null ? I : n == null ? void 0 : n.baseFontSize) != null ? y : 16, r = !!(n.baseStyles && Object.keys(n.baseStyles).length), {
4565
+ const i = (M = o.width) != null ? M : o.calcTextWidth(), a = (y = (S = o.fontSize) != null ? S : n == null ? void 0 : n.baseFontSize) != null ? y : 16, r = !!(n.baseStyles && Object.keys(n.baseStyles).length), {
4588
4566
  paddingTop: c = 0,
4589
4567
  paddingRight: d = 0,
4590
4568
  paddingBottom: l = 0,
@@ -4615,9 +4593,9 @@ class z {
4615
4593
  * @param options — настройки текста
4616
4594
  * @param flags — флаги поведения
4617
4595
  */
4618
- addText(W = {}, { withoutSelection: S = !1, withoutSave: C = !1, withoutAdding: x = !1 } = {}) {
4619
- var Y = W, {
4620
- id: t = `text-${G()}`,
4596
+ addText(P = {}, { withoutSelection: w = !1, withoutSave: T = !1, withoutAdding: E = !1 } = {}) {
4597
+ var x = P, {
4598
+ id: t = `text-${V()}`,
4621
4599
  text: e = "Новый текст",
4622
4600
  fontFamily: s,
4623
4601
  fontSize: o = 48,
@@ -4634,14 +4612,14 @@ class z {
4634
4612
  backgroundColor: p,
4635
4613
  backgroundOpacity: m = 1,
4636
4614
  paddingTop: v = 0,
4637
- paddingRight: b = 0,
4638
- paddingBottom: I = 0,
4615
+ paddingRight: M = 0,
4616
+ paddingBottom: S = 0,
4639
4617
  paddingLeft: y = 0,
4640
- radiusTopLeft: M = 0,
4641
- radiusTopRight: A = 0,
4618
+ radiusTopLeft: b = 0,
4619
+ radiusTopRight: I = 0,
4642
4620
  radiusBottomRight: j = 0,
4643
- radiusBottomLeft: w = 0
4644
- } = Y, T = vt(Y, [
4621
+ radiusBottomLeft: A = 0
4622
+ } = x, C = vt(x, [
4645
4623
  "id",
4646
4624
  "text",
4647
4625
  "fontFamily",
@@ -4667,15 +4645,15 @@ class z {
4667
4645
  "radiusBottomRight",
4668
4646
  "radiusBottomLeft"
4669
4647
  ]);
4670
- var $;
4671
- const { historyManager: H } = this.editor, { canvas: V } = this;
4672
- H.suspendHistory();
4673
- const L = s != null ? s : this._getDefaultFontFamily(), D = Ke({ width: g }), P = Xe({
4648
+ var tt;
4649
+ const { historyManager: N } = this.editor, { canvas: Z } = this;
4650
+ N.suspendHistory();
4651
+ const D = s != null ? s : this._getDefaultFontFamily(), _ = Xe({ width: g }), W = Ve({
4674
4652
  strokeColor: u,
4675
- width: D
4676
- }), Z = _({
4653
+ width: _
4654
+ }), G = B({
4677
4655
  id: t,
4678
- fontFamily: L,
4656
+ fontFamily: D,
4679
4657
  fontSize: o,
4680
4658
  fontWeight: n ? "bold" : "normal",
4681
4659
  fontStyle: i ? "italic" : "normal",
@@ -4684,43 +4662,43 @@ class z {
4684
4662
  linethrough: c,
4685
4663
  textAlign: d,
4686
4664
  fill: l,
4687
- stroke: P,
4688
- strokeWidth: D,
4665
+ stroke: W,
4666
+ strokeWidth: _,
4689
4667
  strokeUniform: !0,
4690
4668
  opacity: f,
4691
4669
  backgroundColor: p,
4692
4670
  backgroundOpacity: m,
4693
4671
  paddingTop: v,
4694
- paddingRight: b,
4695
- paddingBottom: I,
4672
+ paddingRight: M,
4673
+ paddingBottom: S,
4696
4674
  paddingLeft: y,
4697
- radiusTopLeft: M,
4698
- radiusTopRight: A,
4675
+ radiusTopLeft: b,
4676
+ radiusTopRight: I,
4699
4677
  radiusBottomRight: j,
4700
- radiusBottomLeft: w
4701
- }, T), U = new ee(e, Z);
4702
- if (U.textCaseRaw = ($ = U.text) != null ? $ : "", r) {
4703
- const q = ie({ value: U.textCaseRaw });
4704
- q !== U.text && U.set({ text: q });
4705
- }
4706
- return z._roundTextboxDimensions({ textbox: U }) && (U.dirty = !0), T.left === void 0 && T.top === void 0 && V.centerObject(U), x || V.add(U), S || V.setActiveObject(U), V.requestRenderAll(), H.resumeHistory(), C || H.saveState(), V.fire("editor:text-added", {
4707
- textbox: U,
4708
- options: yt(_({}, Z), {
4678
+ radiusBottomLeft: A
4679
+ }, C), Y = new se(e, G);
4680
+ if (Y.textCaseRaw = (tt = Y.text) != null ? tt : "", r) {
4681
+ const J = ae({ value: Y.textCaseRaw });
4682
+ J !== Y.text && Y.set({ text: J });
4683
+ }
4684
+ return F._roundTextboxDimensions({ textbox: Y }) && (Y.dirty = !0), C.left === void 0 && C.top === void 0 && Z.centerObject(Y), E || Z.add(Y), w || Z.setActiveObject(Y), Z.requestRenderAll(), N.resumeHistory(), T || N.saveState(), Z.fire("editor:text-added", {
4685
+ textbox: Y,
4686
+ options: yt(B({}, G), {
4709
4687
  text: e,
4710
4688
  bold: n,
4711
4689
  italic: i,
4712
4690
  strikethrough: c,
4713
4691
  align: d,
4714
4692
  color: l,
4715
- strokeColor: P,
4716
- strokeWidth: D
4693
+ strokeColor: W,
4694
+ strokeWidth: _
4717
4695
  }),
4718
4696
  flags: {
4719
- withoutSelection: !!S,
4720
- withoutSave: !!C,
4721
- withoutAdding: !!x
4697
+ withoutSelection: !!w,
4698
+ withoutSave: !!T,
4699
+ withoutAdding: !!E
4722
4700
  }
4723
- }), U;
4701
+ }), Y;
4724
4702
  }
4725
4703
  /**
4726
4704
  * Обновляет текстовый объект.
@@ -4731,12 +4709,12 @@ class z {
4731
4709
  * @param options.skipRender — не вызывать перерисовку канваса
4732
4710
  */
4733
4711
  updateText({ target: t, style: e = {}, withoutSave: s, skipRender: o } = {}) {
4734
- var xt, Bt, ut, kt, gt, it;
4712
+ var Nt, Bt, ut, kt, gt, it;
4735
4713
  const n = this._resolveTextObject(t);
4736
4714
  if (!n) return null;
4737
4715
  const { historyManager: i } = this.editor, { canvas: a } = this;
4738
4716
  i.suspendHistory();
4739
- const r = z._getSnapshot(n), Nt = e, {
4717
+ const r = F._getSnapshot(n), xt = e, {
4740
4718
  text: c,
4741
4719
  fontFamily: d,
4742
4720
  fontSize: l,
@@ -4746,21 +4724,21 @@ class z {
4746
4724
  uppercase: p,
4747
4725
  strikethrough: m,
4748
4726
  align: v,
4749
- color: b,
4750
- strokeColor: I,
4727
+ color: M,
4728
+ strokeColor: S,
4751
4729
  strokeWidth: y,
4752
- opacity: M,
4753
- backgroundColor: A,
4730
+ opacity: b,
4731
+ backgroundColor: I,
4754
4732
  backgroundOpacity: j,
4755
- paddingTop: w,
4756
- paddingRight: T,
4757
- paddingBottom: S,
4758
- paddingLeft: C,
4759
- radiusTopLeft: x,
4760
- radiusTopRight: W,
4761
- radiusBottomRight: Y,
4762
- radiusBottomLeft: H
4763
- } = Nt, V = vt(Nt, [
4733
+ paddingTop: A,
4734
+ paddingRight: C,
4735
+ paddingBottom: w,
4736
+ paddingLeft: T,
4737
+ radiusTopLeft: E,
4738
+ radiusTopRight: P,
4739
+ radiusBottomRight: x,
4740
+ radiusBottomLeft: N
4741
+ } = xt, Z = vt(xt, [
4764
4742
  "text",
4765
4743
  "fontFamily",
4766
4744
  "fontSize",
@@ -4784,39 +4762,39 @@ class z {
4784
4762
  "radiusTopRight",
4785
4763
  "radiusBottomRight",
4786
4764
  "radiusBottomLeft"
4787
- ]), L = _({}, V), D = ao({ textbox: n }), P = D ? z._expandRangeToFullLines({ textbox: n, range: D }) : null, Z = {}, U = {}, K = {}, $ = co({ textbox: n, range: D }), q = !D || $, F = !D;
4788
- if (d !== void 0 && (P && (U.fontFamily = d), q && (L.fontFamily = d, F && (K.fontFamily = d))), l !== void 0 && (P && (U.fontSize = l), q && (L.fontSize = l, F && (K.fontSize = l))), u !== void 0) {
4765
+ ]), D = B({}, Z), _ = ao({ textbox: n }), W = _ ? F._expandRangeToFullLines({ textbox: n, range: _ }) : null, G = {}, Y = {}, K = {}, tt = co({ textbox: n, range: _ }), J = !_ || tt, H = !_;
4766
+ if (d !== void 0 && (W && (Y.fontFamily = d), J && (D.fontFamily = d, H && (K.fontFamily = d))), l !== void 0 && (W && (Y.fontSize = l), J && (D.fontSize = l, H && (K.fontSize = l))), u !== void 0) {
4789
4767
  const X = u ? "bold" : "normal";
4790
- D && (Z.fontWeight = X), q && (L.fontWeight = X, F && (K.fontWeight = X));
4768
+ _ && (G.fontWeight = X), J && (D.fontWeight = X, H && (K.fontWeight = X));
4791
4769
  }
4792
4770
  if (g !== void 0) {
4793
4771
  const X = g ? "italic" : "normal";
4794
- D && (Z.fontStyle = X), q && (L.fontStyle = X, F && (K.fontStyle = X));
4772
+ _ && (G.fontStyle = X), J && (D.fontStyle = X, H && (K.fontStyle = X));
4795
4773
  }
4796
- if (f !== void 0 && (D && (Z.underline = f), q && (L.underline = f, F && (K.underline = f))), m !== void 0 && (D && (Z.linethrough = m), q && (L.linethrough = m, F && (K.linethrough = m))), v !== void 0 && (L.textAlign = v), b !== void 0 && (D && (Z.fill = b), q && (L.fill = b, F && (K.fill = b))), I !== void 0 || y !== void 0) {
4797
- 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({
4798
- strokeColor: Ht,
4774
+ if (f !== void 0 && (_ && (G.underline = f), J && (D.underline = f, H && (K.underline = f))), m !== void 0 && (_ && (G.linethrough = m), J && (D.linethrough = m, H && (K.linethrough = m))), v !== void 0 && (D.textAlign = v), M !== void 0 && (_ && (G.fill = M), J && (D.fill = M, H && (K.fill = M))), S !== void 0 || y !== void 0) {
4775
+ const X = _ ? Ge({ textbox: n, range: _, property: "strokeWidth" }) : void 0, It = _ ? Ge({ textbox: n, range: _, property: "stroke" }) : void 0, Ht = (Bt = (Nt = y != null ? y : X) != null ? Nt : n.strokeWidth) != null ? Bt : 0, mt = Xe({ width: Ht }), Zt = (kt = (ut = S != null ? S : It) != null ? ut : n.stroke) != null ? kt : void 0, Ct = Ve({
4776
+ strokeColor: Zt,
4799
4777
  width: mt
4800
4778
  });
4801
- D && (Z.stroke = Ct, Z.strokeWidth = mt), q && (L.stroke = Ct, L.strokeWidth = mt, F && (K.stroke = Ct, K.strokeWidth = mt));
4802
- }
4803
- M !== void 0 && (L.opacity = M), A !== void 0 && (L.backgroundColor = A), j !== void 0 && (L.backgroundOpacity = j), w !== void 0 && (L.paddingTop = w), T !== void 0 && (L.paddingRight = T), S !== void 0 && (L.paddingBottom = S), C !== void 0 && (L.paddingLeft = C), x !== void 0 && (L.radiusTopLeft = x), W !== void 0 && (L.radiusTopRight = W), Y !== void 0 && (L.radiusBottomRight = Y), H !== void 0 && (L.radiusBottomLeft = H);
4804
- 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;
4805
- if (et || pt !== St) {
4806
- const X = pt ? ie({ value: lt }) : lt;
4807
- L.text = X, n.textCaseRaw = lt;
4808
- } else n.textCaseRaw === void 0 && (n.textCaseRaw = Q);
4809
- n.uppercase = pt, n.set(L);
4779
+ _ && (G.stroke = Ct, G.strokeWidth = mt), J && (D.stroke = Ct, D.strokeWidth = mt, H && (K.stroke = Ct, K.strokeWidth = mt));
4780
+ }
4781
+ b !== void 0 && (D.opacity = b), I !== void 0 && (D.backgroundColor = I), j !== void 0 && (D.backgroundOpacity = j), A !== void 0 && (D.paddingTop = A), C !== void 0 && (D.paddingRight = C), w !== void 0 && (D.paddingBottom = w), T !== void 0 && (D.paddingLeft = T), E !== void 0 && (D.radiusTopLeft = E), P !== void 0 && (D.radiusTopRight = P), x !== void 0 && (D.radiusBottomRight = x), N !== void 0 && (D.radiusBottomLeft = N);
4782
+ const q = (it = n.textCaseRaw) != null ? it : (gt = n.text) != null ? gt : "", St = !!n.uppercase, st = c !== void 0, lt = st ? c != null ? c : "" : q, pt = p != null ? p : St;
4783
+ if (st || pt !== St) {
4784
+ const X = pt ? ae({ value: lt }) : lt;
4785
+ D.text = X, n.textCaseRaw = lt;
4786
+ } else n.textCaseRaw === void 0 && (n.textCaseRaw = q);
4787
+ n.uppercase = pt, n.set(D);
4810
4788
  let ht = !1;
4811
- if (D) {
4812
- const X = ne({ textbox: n, styles: Z, range: D }), It = P ? ne({ textbox: n, styles: U, range: P }) : !1;
4789
+ if (_) {
4790
+ const X = ie({ textbox: n, styles: G, range: _ }), It = W ? ie({ textbox: n, styles: Y, range: W }) : !1;
4813
4791
  ht = X || It;
4814
4792
  } else if (Object.keys(K).length) {
4815
4793
  const X = ro({ textbox: n });
4816
- X && (ht = ne({ textbox: n, styles: K, range: X }));
4794
+ X && (ht = ie({ textbox: n, styles: K, range: X }));
4817
4795
  }
4818
- ht && (n.dirty = !0), (A !== void 0 || j !== void 0 || w !== void 0 || T !== void 0 || S !== void 0 || C !== void 0 || x !== void 0 || W !== void 0 || Y !== void 0 || H !== void 0) && (n.dirty = !0), z._roundTextboxDimensions({ textbox: n }) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4819
- const Ft = z._getSnapshot(n);
4796
+ ht && (n.dirty = !0), (I !== void 0 || j !== void 0 || A !== void 0 || C !== void 0 || w !== void 0 || T !== void 0 || E !== void 0 || P !== void 0 || x !== void 0 || N !== void 0) && (n.dirty = !0), F._roundTextboxDimensions({ textbox: n }) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4797
+ const Yt = F._getSnapshot(n);
4820
4798
  return a.fire("editor:text-updated", {
4821
4799
  textbox: n,
4822
4800
  target: t,
@@ -4825,11 +4803,11 @@ class z {
4825
4803
  withoutSave: !!s,
4826
4804
  skipRender: !!o
4827
4805
  },
4828
- updates: L,
4806
+ updates: D,
4829
4807
  before: r,
4830
- after: Ft,
4831
- selectionRange: D != null ? D : void 0,
4832
- selectionStyles: D && Object.keys(Z).length ? Z : void 0
4808
+ after: Yt,
4809
+ selectionRange: _ != null ? _ : void 0,
4810
+ selectionStyles: _ && Object.keys(G).length ? G : void 0
4833
4811
  }), n;
4834
4812
  }
4835
4813
  /**
@@ -4837,7 +4815,7 @@ class z {
4837
4815
  */
4838
4816
  destroy() {
4839
4817
  const { canvas: t } = this;
4840
- t.off("object:scaling", this._handleObjectScaling), t.off("object:resizing", z._handleObjectResizing), t.off("object:modified", this._handleObjectModified), t.off("text:editing:exited", this._handleTextEditingExited), t.off("text:editing:entered", this._handleTextEditingEntered), t.off("text:changed", z._handleTextChanged);
4818
+ t.off("object:scaling", this._handleObjectScaling), t.off("object:resizing", F._handleObjectResizing), t.off("object:modified", this._handleObjectModified), t.off("text:editing:exited", this._handleTextEditingExited), t.off("text:editing:entered", this._handleTextEditingEntered), t.off("text:changed", F._handleTextChanged);
4841
4819
  }
4842
4820
  /**
4843
4821
  * Возвращает активный текст или ищет по id.
@@ -4847,10 +4825,10 @@ class z {
4847
4825
  const { canvas: e } = this;
4848
4826
  if (!t) {
4849
4827
  const s = e.getActiveObject();
4850
- return z._isTextbox(s) ? s : null;
4828
+ return F._isTextbox(s) ? s : null;
4851
4829
  }
4852
4830
  if (typeof t == "string") {
4853
- const s = e.getObjects().find((o) => z._isTextbox(o) && o.id === t);
4831
+ const s = e.getObjects().find((o) => F._isTextbox(o) && o.id === t);
4854
4832
  return s != null ? s : null;
4855
4833
  }
4856
4834
  return null;
@@ -4866,21 +4844,21 @@ class z {
4866
4844
  */
4867
4845
  _bindEvents() {
4868
4846
  const { canvas: t } = this;
4869
- t.on("object:scaling", this._handleObjectScaling), t.on("object:resizing", z._handleObjectResizing), t.on("object:modified", this._handleObjectModified), t.on("text:editing:entered", this._handleTextEditingEntered), t.on("text:editing:exited", this._handleTextEditingExited), t.on("text:changed", z._handleTextChanged);
4847
+ t.on("object:scaling", this._handleObjectScaling), t.on("object:resizing", F._handleObjectResizing), t.on("object:modified", this._handleObjectModified), t.on("text:editing:entered", this._handleTextEditingEntered), t.on("text:editing:exited", this._handleTextEditingExited), t.on("text:changed", F._handleTextChanged);
4870
4848
  }
4871
4849
  /**
4872
4850
  * Реагирует на изменение текста в режиме редактирования: синхронизирует textCaseRaw и uppercase.
4873
4851
  */
4874
4852
  static _handleTextChanged(t) {
4875
4853
  const { target: e } = t;
4876
- if (!z._isTextbox(e)) return;
4854
+ if (!F._isTextbox(e)) return;
4877
4855
  const { text: s = "", uppercase: o } = e, n = !!o, i = s.toLocaleLowerCase();
4878
4856
  if (n) {
4879
- const r = ie({ value: i });
4857
+ const r = ae({ value: i });
4880
4858
  r !== s && e.set({ text: r }), e.textCaseRaw = i;
4881
4859
  } else
4882
4860
  e.textCaseRaw = s;
4883
- z._roundTextboxDimensions({ textbox: e }) && (e.setCoords(), e.dirty = !0);
4861
+ F._roundTextboxDimensions({ textbox: e }) && (e.setCoords(), e.dirty = !0);
4884
4862
  }
4885
4863
  /**
4886
4864
  * Обрабатывает изменение ширины текстового объекта (resizing).
@@ -4891,7 +4869,7 @@ class z {
4891
4869
  static _handleObjectResizing(t) {
4892
4870
  var l, u, g, f, p, m;
4893
4871
  const { target: e, transform: s } = t;
4894
- if (!z._isTextbox(e)) return;
4872
+ if (!F._isTextbox(e)) return;
4895
4873
  const {
4896
4874
  paddingLeft: o = 0,
4897
4875
  paddingRight: n = 0
@@ -4902,10 +4880,10 @@ class z {
4902
4880
  e.set({ width: r });
4903
4881
  const c = (u = e.width) != null ? u : 0, d = a - c;
4904
4882
  if (d !== 0 && s && s.corner === "ml") {
4905
- const b = ((g = e.angle) != null ? g : 0) * Math.PI / 180, I = Math.cos(b), y = Math.sin(b), M = (f = e.scaleX) != null ? f : 1, A = d * M;
4883
+ const M = ((g = e.angle) != null ? g : 0) * Math.PI / 180, S = Math.cos(M), y = Math.sin(M), b = (f = e.scaleX) != null ? f : 1, I = d * b;
4906
4884
  e.set({
4907
- left: ((p = e.left) != null ? p : 0) + A * I,
4908
- top: ((m = e.top) != null ? m : 0) + A * y
4885
+ left: ((p = e.left) != null ? p : 0) + I * S,
4886
+ top: ((m = e.top) != null ? m : 0) + I * y
4909
4887
  });
4910
4888
  }
4911
4889
  }
@@ -4931,7 +4909,7 @@ class z {
4931
4909
  textbox: t,
4932
4910
  range: e
4933
4911
  }) {
4934
- const s = z._getLineRanges({ textbox: t });
4912
+ const s = F._getLineRanges({ textbox: t });
4935
4913
  if (!s.length) return e;
4936
4914
  let { start: o } = e, { end: n } = e;
4937
4915
  return s.forEach(({ start: i, end: a }) => {
@@ -4993,10 +4971,10 @@ class z {
4993
4971
  static _roundTextboxDimensions({
4994
4972
  textbox: t
4995
4973
  }) {
4996
- 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({
4974
+ 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 = F._resolveDimension({
4997
4975
  rawValue: e,
4998
4976
  calculatedValue: i
4999
- }), c = z._resolveDimension({
4977
+ }), c = F._resolveDimension({
5000
4978
  rawValue: s,
5001
4979
  calculatedValue: a
5002
4980
  }), d = Number.isFinite(r) ? Math.round(r) : null, l = Number.isFinite(c) ? Math.round(c) : null, u = {};
@@ -5007,11 +4985,11 @@ class z {
5007
4985
  */
5008
4986
  static _getSnapshot(t) {
5009
4987
  const e = ({
5010
- snapshot: Z,
5011
- entries: U
4988
+ snapshot: G,
4989
+ entries: Y
5012
4990
  }) => {
5013
- Object.entries(U).forEach(([K, $]) => {
5014
- $ != null && (Z[K] = $);
4991
+ Object.entries(Y).forEach(([K, tt]) => {
4992
+ tt != null && (G[K] = tt);
5015
4993
  });
5016
4994
  }, {
5017
4995
  id: s,
@@ -5029,30 +5007,30 @@ class z {
5029
5007
  stroke: p,
5030
5008
  strokeWidth: m,
5031
5009
  opacity: v,
5032
- backgroundColor: b,
5033
- backgroundOpacity: I,
5010
+ backgroundColor: M,
5011
+ backgroundOpacity: S,
5034
5012
  paddingTop: y,
5035
- paddingRight: M,
5036
- paddingBottom: A,
5013
+ paddingRight: b,
5014
+ paddingBottom: I,
5037
5015
  paddingLeft: j,
5038
- radiusTopLeft: w,
5039
- radiusTopRight: T,
5040
- radiusBottomRight: S,
5041
- radiusBottomLeft: C,
5042
- left: x,
5043
- top: W,
5044
- width: Y,
5045
- height: H,
5046
- angle: V,
5047
- scaleX: L,
5048
- scaleY: D
5049
- } = t, P = {
5016
+ radiusTopLeft: A,
5017
+ radiusTopRight: C,
5018
+ radiusBottomRight: w,
5019
+ radiusBottomLeft: T,
5020
+ left: E,
5021
+ top: P,
5022
+ width: x,
5023
+ height: N,
5024
+ angle: Z,
5025
+ scaleX: D,
5026
+ scaleY: _
5027
+ } = t, W = {
5050
5028
  id: s,
5051
5029
  uppercase: !!i,
5052
5030
  textAlign: g
5053
5031
  };
5054
5032
  return e({
5055
- snapshot: P,
5033
+ snapshot: W,
5056
5034
  entries: {
5057
5035
  text: o,
5058
5036
  textCaseRaw: n,
@@ -5066,25 +5044,25 @@ class z {
5066
5044
  stroke: p,
5067
5045
  strokeWidth: m,
5068
5046
  opacity: v,
5069
- backgroundColor: b,
5070
- backgroundOpacity: I,
5047
+ backgroundColor: M,
5048
+ backgroundOpacity: S,
5071
5049
  paddingTop: y,
5072
- paddingRight: M,
5073
- paddingBottom: A,
5050
+ paddingRight: b,
5051
+ paddingBottom: I,
5074
5052
  paddingLeft: j,
5075
- radiusTopLeft: w,
5076
- radiusTopRight: T,
5077
- radiusBottomRight: S,
5078
- radiusBottomLeft: C,
5079
- left: x,
5080
- top: W,
5081
- width: Y,
5082
- height: H,
5083
- angle: V,
5084
- scaleX: L,
5085
- scaleY: D
5053
+ radiusTopLeft: A,
5054
+ radiusTopRight: C,
5055
+ radiusBottomRight: w,
5056
+ radiusBottomLeft: T,
5057
+ left: E,
5058
+ top: P,
5059
+ width: x,
5060
+ height: N,
5061
+ angle: Z,
5062
+ scaleX: D,
5063
+ scaleY: _
5086
5064
  }
5087
- }), P;
5065
+ }), W;
5088
5066
  }
5089
5067
  /**
5090
5068
  * Возвращает первый доступный шрифт или дефолтный Arial.
@@ -5094,15 +5072,15 @@ class z {
5094
5072
  return (e = (t = this.fonts[0]) == null ? void 0 : t.family) != null ? e : "Arial";
5095
5073
  }
5096
5074
  }
5097
- const ot = ({
5075
+ const Q = ({
5098
5076
  value: h,
5099
5077
  fallback: t = 0
5100
- }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, Kt = ({
5078
+ }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, Qt = ({
5101
5079
  value: h,
5102
5080
  dimension: t,
5103
5081
  useRelativePositions: e
5104
5082
  }) => {
5105
- const s = ot({ value: h });
5083
+ const s = Q({ value: h });
5106
5084
  return e ? s : s / (t || 1);
5107
5085
  }, lo = ({
5108
5086
  object: h,
@@ -5114,26 +5092,26 @@ const ot = ({
5114
5092
  const n = h;
5115
5093
  if (typeof n[o.x] == "number" && typeof n[o.y] == "number")
5116
5094
  return {
5117
- x: Kt({
5095
+ x: Qt({
5118
5096
  value: n[o.x],
5119
5097
  dimension: t,
5120
5098
  useRelativePositions: s
5121
5099
  }),
5122
- y: Kt({
5100
+ y: Qt({
5123
5101
  value: n[o.y],
5124
5102
  dimension: e,
5125
5103
  useRelativePositions: s
5126
5104
  })
5127
5105
  };
5128
- const { left: a, top: r, width: c, height: d } = h, l = Kt({
5106
+ const { left: a, top: r, width: c, height: d } = h, l = Qt({
5129
5107
  value: a,
5130
5108
  dimension: t,
5131
5109
  useRelativePositions: s
5132
- }), u = Kt({
5110
+ }), u = Qt({
5133
5111
  value: r,
5134
5112
  dimension: e,
5135
5113
  useRelativePositions: s
5136
- }), g = ot({ value: c }) / (t || 1), f = ot({ value: d }) / (e || 1);
5114
+ }), g = Q({ value: c }) / (t || 1), f = Q({ value: d }) / (e || 1);
5137
5115
  return {
5138
5116
  x: l + g / 2,
5139
5117
  y: u + f / 2
@@ -5148,10 +5126,10 @@ const ot = ({
5148
5126
  const { left: n, top: i, width: a, height: r } = e;
5149
5127
  if (!o) {
5150
5128
  const { width: l, height: u } = s, g = n + h * (l || a), f = i + t * (u || r);
5151
- return new tt(g, f);
5129
+ return new et(g, f);
5152
5130
  }
5153
5131
  const c = n + h * a, d = i + t * r;
5154
- return new tt(c, d);
5132
+ return new et(c, d);
5155
5133
  }, uo = ({
5156
5134
  object: h,
5157
5135
  montageArea: t,
@@ -5231,7 +5209,7 @@ const ot = ({
5231
5209
  };
5232
5210
  }
5233
5211
  return null;
5234
- }, ae = "_templateCenterX", re = "_templateCenterY", ce = "_templateAnchorX", de = "_templateAnchorY";
5212
+ }, Pt = "_templateCenterX", re = "_templateCenterY", qt = "_templateAnchorX", ce = "_templateAnchorY";
5235
5213
  class R {
5236
5214
  constructor({ editor: t }) {
5237
5215
  this.editor = t;
@@ -5259,22 +5237,22 @@ class R {
5259
5237
  code: bt.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
5260
5238
  message: "Нет объектов для сериализации шаблона"
5261
5239
  }), null;
5262
- const f = R._getBounds(i), p = R._getMontageSize({ montageArea: i, bounds: f }), m = p.width, v = p.height, b = g.map((M) => R._serializeObject({
5263
- object: M,
5240
+ const f = R._getBounds(i), p = R._getMontageSize({ montageArea: i, bounds: f }), m = p.width, v = p.height, M = g.map((b) => R._serializeObject({
5241
+ object: b,
5264
5242
  bounds: f,
5265
5243
  baseWidth: m,
5266
5244
  baseHeight: v,
5267
5245
  montageArea: i != null ? i : null
5268
- })), I = yt(_({}, s), {
5246
+ })), S = yt(B({}, s), {
5269
5247
  baseWidth: m,
5270
5248
  baseHeight: v,
5271
5249
  positionsNormalized: !0,
5272
5250
  previewId: e != null ? e : s.previewId
5273
5251
  });
5274
5252
  return {
5275
- id: t != null ? t : `template-${G()}`,
5276
- meta: I,
5277
- objects: b
5253
+ id: t != null ? t : `template-${V()}`,
5254
+ meta: S,
5255
+ objects: M
5278
5256
  };
5279
5257
  }
5280
5258
  /**
@@ -5284,7 +5262,7 @@ class R {
5284
5262
  * @param options.data - данные для заполнения текстов по customData.templateField
5285
5263
  */
5286
5264
  applyTemplate(s) {
5287
- return N(this, arguments, function* ({
5265
+ return k(this, arguments, function* ({
5288
5266
  template: t,
5289
5267
  data: e
5290
5268
  }) {
@@ -5311,24 +5289,27 @@ class R {
5311
5289
  message: "Не удалось определить границы монтажной области"
5312
5290
  }), null;
5313
5291
  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;
5314
- let v = !1, b = !1;
5292
+ let v = !1, M = !1;
5315
5293
  i.suspendHistory();
5316
5294
  try {
5317
- const I = yield R._enlivenObjects(c);
5318
- if (!I.length)
5295
+ const S = yield R._enlivenObjects(c);
5296
+ if (!S.length)
5319
5297
  return a.emitWarning({
5320
5298
  origin: "TemplateManager",
5321
5299
  method: "applyTemplate",
5322
5300
  code: bt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5323
5301
  message: "Не удалось создать объекты шаблона"
5324
5302
  }), null;
5325
- const { backgroundObject: y, contentObjects: M } = R._extractBackgroundObject(I);
5326
- y && (b = yield R._applyBackgroundFromObject({
5303
+ const { backgroundObject: y, contentObjects: b } = R._extractBackgroundObject(S);
5304
+ y && (M = yield R._applyBackgroundFromObject({
5327
5305
  backgroundObject: y,
5328
5306
  backgroundManager: r,
5329
5307
  errorManager: a
5330
5308
  }));
5331
- const A = M.map((j) => (R._applyTextOverrides({ object: j, data: e }), R._transformObject({
5309
+ const I = b.map((j) => (this._adaptTextboxWidth({
5310
+ object: j,
5311
+ baseWidth: f.baseWidth
5312
+ }), R._transformObject({
5332
5313
  object: j,
5333
5314
  scale: p,
5334
5315
  bounds: u,
@@ -5338,15 +5319,15 @@ class R {
5338
5319
  montageArea: n,
5339
5320
  useRelativePositions: m
5340
5321
  }), j.set({
5341
- id: `${j.type}-${G()}`,
5322
+ id: `${j.type}-${V()}`,
5342
5323
  evented: !0
5343
5324
  }), o.add(j), j));
5344
- 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", {
5325
+ return !I.length && !M ? null : (v = I.length > 0 || M, I.length && R._activateObjects({ canvas: o, objects: I }), o.requestRenderAll(), o.fire("editor:template-applied", {
5345
5326
  template: t,
5346
- objects: A,
5327
+ objects: I,
5347
5328
  bounds: u
5348
- }), A);
5349
- } catch (I) {
5329
+ }), I);
5330
+ } catch (S) {
5350
5331
  return a.emitError({
5351
5332
  origin: "TemplateManager",
5352
5333
  method: "applyTemplate",
@@ -5354,7 +5335,7 @@ class R {
5354
5335
  message: "Ошибка применения шаблона",
5355
5336
  data: {
5356
5337
  templateId: l,
5357
- error: I
5338
+ error: S
5358
5339
  }
5359
5340
  }), null;
5360
5341
  } finally {
@@ -5366,7 +5347,7 @@ class R {
5366
5347
  * Подготавливает объекты для сериализации.
5367
5348
  */
5368
5349
  static _collectObjects(t) {
5369
- return t ? t instanceof k ? t.getObjects() : [t] : [];
5350
+ return t ? t instanceof U ? t.getObjects() : [t] : [];
5370
5351
  }
5371
5352
  /**
5372
5353
  * Возвращает габариты объекта.
@@ -5390,8 +5371,8 @@ class R {
5390
5371
  * Превращает plain-описание объектов в Fabric объекты.
5391
5372
  */
5392
5373
  static _enlivenObjects(t) {
5393
- return N(this, null, function* () {
5394
- return (yield Promise.all(t.map((s) => N(null, null, function* () {
5374
+ return k(this, null, function* () {
5375
+ return (yield Promise.all(t.map((s) => k(null, null, function* () {
5395
5376
  if (R._hasSerializedSvgMarkup(s)) {
5396
5377
  const i = yield R._reviveSvgObject(s);
5397
5378
  if (i)
@@ -5414,19 +5395,44 @@ class R {
5414
5395
  width: o,
5415
5396
  height: n,
5416
5397
  scaleX: i,
5417
- scaleY: a
5418
- } = e, r = t, c = "getElement" in r && typeof r.getElement == "function" ? r.getElement() : null, {
5419
- naturalWidth: d = 0,
5420
- naturalHeight: l = 0,
5421
- width: u = 0,
5422
- height: g = 0
5423
- } = c instanceof HTMLImageElement ? c : {
5398
+ scaleY: a,
5399
+ customData: r
5400
+ } = e, c = t, d = "getElement" in c && typeof c.getElement == "function" ? c.getElement() : null, {
5401
+ naturalWidth: l = 0,
5402
+ naturalHeight: u = 0,
5403
+ width: g = 0,
5404
+ height: f = 0
5405
+ } = d instanceof HTMLImageElement ? d : {
5424
5406
  naturalWidth: 0,
5425
5407
  naturalHeight: 0,
5426
5408
  width: 0,
5427
5409
  height: 0
5428
- }, 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, M = v * I, A = f ? y / f : null, j = p ? M / p : null, w = {};
5429
- f > 0 && (w.width = f), p > 0 && (w.height = p), A && A > 0 && (w.scaleX = A), j && j > 0 && (w.scaleY = j), r.set(w);
5410
+ }, p = Q({ value: l || g || c.width, fallback: 0 }), m = Q({ value: u || f || c.height, fallback: 0 }), v = Q({ value: o, fallback: p }), M = Q({ value: n, fallback: m }), S = Q({ value: i, fallback: c.scaleX || 1 }), y = Q({ value: a, fallback: c.scaleY || 1 }), b = v * S, I = M * y, j = p > 0, A = m > 0, C = b > 0, w = I > 0, T = R._resolveImageFit({ customData: r }), E = {};
5411
+ if (j && (E.width = p), A && (E.height = m), !j || !A) {
5412
+ c.set(E);
5413
+ return;
5414
+ }
5415
+ if (T === "stretch") {
5416
+ const x = C ? b / p : null, N = w ? I / m : null;
5417
+ x && x > 0 && (E.scaleX = x), N && N > 0 && (E.scaleY = N), c.set(E);
5418
+ return;
5419
+ }
5420
+ if (!C || !w) {
5421
+ c.set(E);
5422
+ return;
5423
+ }
5424
+ const P = Math.min(b / p, I / m);
5425
+ Number.isFinite(P) && P > 0 && (E.scaleX = P, E.scaleY = P), c.set(E);
5426
+ }
5427
+ /**
5428
+ * Определяет режим вписывания изображения при восстановлении.
5429
+ */
5430
+ static _resolveImageFit({
5431
+ customData: t
5432
+ }) {
5433
+ if (!t || typeof t != "object") return "contain";
5434
+ const { imageFit: e } = t;
5435
+ return e === "stretch" ? "stretch" : "contain";
5430
5436
  }
5431
5437
  /**
5432
5438
  * Проверяет, содержит ли сериализованный объект инлайн SVG.
@@ -5438,11 +5444,11 @@ class R {
5438
5444
  * Восстанавливает SVG-объект из компактного описания.
5439
5445
  */
5440
5446
  static _reviveSvgObject(t) {
5441
- return N(this, null, function* () {
5447
+ return k(this, null, function* () {
5442
5448
  const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
5443
5449
  if (!e) return null;
5444
5450
  try {
5445
- const s = yield ys(e), o = dt.groupSVGElements(s.objects, s.options), n = yield dt.enlivenObjectEnlivables(
5451
+ const s = yield ms(e), o = dt.groupSVGElements(s.objects, s.options), n = yield dt.enlivenObjectEnlivables(
5446
5452
  R._prepareSerializableProps(t)
5447
5453
  );
5448
5454
  return o.set(n), o.setCoords(), o;
@@ -5455,7 +5461,7 @@ class R {
5455
5461
  * Убирает технические поля сериализации, оставляя только применимые свойства.
5456
5462
  */
5457
5463
  static _prepareSerializableProps(t) {
5458
- const e = _({}, t);
5464
+ const e = B({}, t);
5459
5465
  return delete e.svgMarkup, delete e.objects, delete e.path, delete e.paths, delete e.type, delete e.version, e;
5460
5466
  }
5461
5467
  /**
@@ -5507,28 +5513,28 @@ class R {
5507
5513
  baseHeight: i,
5508
5514
  useRelativePositions: r,
5509
5515
  centerKeys: {
5510
- x: ae,
5516
+ x: Pt,
5511
5517
  y: re
5512
5518
  }
5513
- }), { scaleX: u, scaleY: g } = t, f = ot({ value: u, fallback: 1 }), p = ot({ value: g, fallback: 1 }), m = R._getPositioningBounds({
5519
+ }), { scaleX: u, scaleY: g } = t, f = Q({ value: u, fallback: 1 }), p = Q({ value: g, fallback: 1 }), m = R._getPositioningBounds({
5514
5520
  bounds: s,
5515
5521
  baseWidth: n,
5516
5522
  baseHeight: i,
5517
5523
  scale: e,
5518
5524
  useRelativePositions: r,
5519
- anchorX: R._resolveAnchor(c, ce),
5520
- anchorY: R._resolveAnchor(c, de)
5525
+ anchorX: R._resolveAnchor(c, qt),
5526
+ anchorY: R._resolveAnchor(c, ce)
5521
5527
  }), v = ho({
5522
5528
  normalizedX: d,
5523
5529
  normalizedY: l,
5524
5530
  bounds: m,
5525
5531
  targetSize: o,
5526
5532
  montageArea: a
5527
- }), b = f * e, I = p * e;
5533
+ }), M = f * e, S = p * e;
5528
5534
  t.set({
5529
- scaleX: b,
5530
- scaleY: I
5531
- }), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[ae], delete c[re], delete c[ce], delete c[de];
5535
+ scaleX: M,
5536
+ scaleY: S
5537
+ }), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[Pt], delete c[re], delete c[qt], delete c[ce];
5532
5538
  }
5533
5539
  /**
5534
5540
  * Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
@@ -5559,17 +5565,14 @@ class R {
5559
5565
  const s = t[e];
5560
5566
  return s === "center" || s === "end" || s === "start" ? s : "start";
5561
5567
  }
5562
- static _detectAnchor({
5563
- start: t,
5564
- end: e
5565
- }) {
5566
- const s = t <= 0.05, o = e >= 0.95, n = t < 0, i = e > 1, a = e - t, r = Math.max(0, t), c = Math.max(0, 1 - e);
5568
+ static _detectAnchor({ start: t, end: e }) {
5569
+ const s = t <= 0.05, o = e >= 0.95, n = t < 0, i = e > 1, a = e - t, r = Math.max(0, t), c = Math.max(0, 1 - e), d = Math.abs(r - c) <= 0.02;
5567
5570
  if (s && o || n && i)
5568
- return a >= 0.98 ? "center" : r <= c ? "start" : "end";
5571
+ return d || a >= 0.9 ? "center" : r <= c ? "start" : "end";
5569
5572
  if (s || n) return "start";
5570
5573
  if (o || i) return "end";
5571
- const d = r - c;
5572
- return Math.abs(d) <= 0.1 ? "center" : d < 0 ? "start" : "end";
5574
+ const l = r - c;
5575
+ return Math.abs(l) <= 0.1 ? "center" : l < 0 ? "start" : "end";
5573
5576
  }
5574
5577
  /**
5575
5578
  * Нормализует мета-данные шаблона.
@@ -5579,7 +5582,7 @@ class R {
5579
5582
  fallback: e
5580
5583
  }) {
5581
5584
  const { width: s, height: o } = e, r = t || {}, { baseWidth: n = s, baseHeight: i = o } = r, a = vt(r, ["baseWidth", "baseHeight"]);
5582
- return _({
5585
+ return B({
5583
5586
  baseWidth: n,
5584
5587
  baseHeight: i
5585
5588
  }, a);
@@ -5606,19 +5609,58 @@ class R {
5606
5609
  t.setActiveObject(e[0]);
5607
5610
  return;
5608
5611
  }
5609
- const s = new k(e, { canvas: t });
5612
+ const s = new U(e, { canvas: t });
5610
5613
  t.setActiveObject(s);
5611
5614
  }
5612
5615
  /**
5613
- * Применяет текстовые значения из customData или переданных данных.
5616
+ * Подгоняет ширину текстового объекта под фактическую длину строк, сохраняя выравнивание по якорю.
5614
5617
  */
5615
- static _applyTextOverrides({
5618
+ _adaptTextboxWidth({
5616
5619
  object: t,
5617
- data: e
5620
+ baseWidth: e
5618
5621
  }) {
5619
- if (!("text" in t)) return;
5620
- const s = t.customData, { templateField: o, text: n } = s != null ? s : {}, i = typeof o == "string" ? o : void 0, a = typeof n == "string" ? n : void 0, r = i && e ? e[i] : void 0, c = r != null ? r : a;
5621
- typeof c == "string" && (t.text = c);
5622
+ var Z, D;
5623
+ if (!(t instanceof nt)) return;
5624
+ const s = typeof t.text == "string" ? t.text : "";
5625
+ if (!s) return;
5626
+ const o = Q({
5627
+ value: (D = (Z = this.editor) == null ? void 0 : Z.montageArea) == null ? void 0 : D.width,
5628
+ fallback: 0
5629
+ }), {
5630
+ width: n = 0,
5631
+ scaleX: i = 1,
5632
+ strokeWidth: a = 0
5633
+ } = t, r = Q({ value: e, fallback: 0 }), c = t, d = Q({ value: c.paddingLeft, fallback: 0 }), l = Q({ value: c.paddingRight, fallback: 0 }), u = Q({ value: i, fallback: 1 }), g = Q({ value: a, fallback: 0 }) * u, f = Q({ value: n, fallback: 0 }), p = f * u, m = d * u, v = l * u, M = p + m + v + g;
5634
+ if (!o || !f || !r) return;
5635
+ t.setCoords();
5636
+ const S = t, y = S[Pt], b = typeof y == "number" ? y : null, I = R._resolveAnchor(S, qt), j = M / r, A = b !== null ? b - j / 2 : null, C = b !== null ? b + j / 2 : null, w = t.getCenterPoint();
5637
+ t.set("width", o), t.initDimensions();
5638
+ const T = R._getLongestLineWidth({
5639
+ textbox: t,
5640
+ text: s
5641
+ }), E = T > f ? T + 1 : f;
5642
+ t.set("width", E), t.initDimensions(), t.setPositionByOrigin(w, "center", "center"), t.setCoords();
5643
+ const x = (E * u + m + v + g) / r;
5644
+ let N = b;
5645
+ I === "start" && A !== null ? N = Math.max(0, A) + x / 2 : I === "end" && C !== null && (N = Math.min(1, C) - x / 2), typeof N == "number" && (S[Pt] = N);
5646
+ }
5647
+ /**
5648
+ * Возвращает ширину самой длинной строки текстового объекта.
5649
+ */
5650
+ static _getLongestLineWidth({
5651
+ textbox: t,
5652
+ text: e
5653
+ }) {
5654
+ const {
5655
+ textLines: s
5656
+ } = t, o = Array.isArray(s) && s.length > 0 ? s.length : Math.max(e.split(`
5657
+ `).length, 1);
5658
+ let n = 0;
5659
+ for (let i = 0; i < o; i += 1) {
5660
+ const a = t.getLineWidth(i);
5661
+ a > n && (n = a);
5662
+ }
5663
+ return n;
5622
5664
  }
5623
5665
  /**
5624
5666
  * Сериализует объект относительно монтажной области.
@@ -5630,7 +5672,7 @@ class R {
5630
5672
  baseHeight: o,
5631
5673
  montageArea: n
5632
5674
  }) {
5633
- const i = t.toDatalessObject([...ss]);
5675
+ const i = t.toDatalessObject([...es]);
5634
5676
  if (R._isSvgObject(t)) {
5635
5677
  const y = R._extractSvgMarkup(t);
5636
5678
  y && (i.svgMarkup = y, delete i.objects, delete i.path);
@@ -5651,15 +5693,15 @@ class R {
5651
5693
  x: (y.x - a) / u,
5652
5694
  y: (y.y - r) / g
5653
5695
  };
5654
- })(), m = (l.left - a) / u, v = (l.top - r) / g, b = m + l.width / u, I = v + l.height / g;
5655
- return i[ae] = p.x, i[re] = p.y, i[ce] = R._detectAnchor({
5696
+ })(), m = (l.left - a) / u, v = (l.top - r) / g, M = m + l.width / u, S = v + l.height / g;
5697
+ return i[Pt] = p.x, i[re] = p.y, i[qt] = R._detectAnchor({
5656
5698
  center: p.x,
5657
5699
  start: m,
5658
- end: b
5659
- }), i[de] = R._detectAnchor({
5700
+ end: M
5701
+ }), i[ce] = R._detectAnchor({
5660
5702
  center: p.y,
5661
5703
  start: v,
5662
- end: I
5704
+ end: S
5663
5705
  }), i.left = m, i.top = v, i;
5664
5706
  }
5665
5707
  /**
@@ -5676,7 +5718,7 @@ class R {
5676
5718
  * Применяет фоновый объект шаблона к текущему холсту через BackgroundManager.
5677
5719
  */
5678
5720
  static _applyBackgroundFromObject(o) {
5679
- return N(this, arguments, function* ({
5721
+ return k(this, arguments, function* ({
5680
5722
  backgroundObject: t,
5681
5723
  backgroundManager: e,
5682
5724
  errorManager: s
@@ -5741,7 +5783,7 @@ class R {
5741
5783
  */
5742
5784
  static _cloneCustomData(t) {
5743
5785
  if (!(!t || typeof t != "object"))
5744
- return _({}, t);
5786
+ return B({}, t);
5745
5787
  }
5746
5788
  /**
5747
5789
  * Извлекает src изображения из FabricImage или его исходного элемента.
@@ -5770,7 +5812,7 @@ class R {
5770
5812
  return dt.enlivenObjectEnlivables(t);
5771
5813
  }
5772
5814
  }
5773
- const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5815
+ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
5774
5816
  anchors: h,
5775
5817
  positions: t,
5776
5818
  threshold: e
@@ -5790,11 +5832,11 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5790
5832
  threshold: t,
5791
5833
  anchors: e
5792
5834
  }) => {
5793
- const { left: s, right: o, centerX: n, top: i, bottom: a, centerY: r } = h, c = Qe({
5835
+ const { left: s, right: o, centerX: n, top: i, bottom: a, centerY: r } = h, c = Ke({
5794
5836
  anchors: e.vertical,
5795
5837
  positions: [s, n, o],
5796
5838
  threshold: t
5797
- }), d = Qe({
5839
+ }), d = Ke({
5798
5840
  anchors: e.horizontal,
5799
5841
  positions: [i, r, a],
5800
5842
  threshold: t
@@ -5810,7 +5852,7 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5810
5852
  deltaY: d.delta,
5811
5853
  guides: l
5812
5854
  };
5813
- }, ns = ({
5855
+ }, os = ({
5814
5856
  activeBounds: h,
5815
5857
  aligned: t,
5816
5858
  threshold: e,
@@ -5901,72 +5943,72 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5901
5943
  ...c.map((y) => ({ bounds: y, isActive: !1 })),
5902
5944
  { bounds: h, isActive: !0 }
5903
5945
  ];
5904
- d.sort((y, M) => y.bounds.top - M.bounds.top);
5946
+ d.sort((y, b) => y.bounds.top - b.bounds.top);
5905
5947
  const l = d.findIndex((y) => y.isActive);
5906
5948
  if (l === -1)
5907
5949
  return { delta: 0, guide: null };
5908
5950
  const u = d[l - 1], g = d[l - 2], f = d[l + 1], p = d[l + 2], m = [], v = i - n;
5909
5951
  if (u && g) {
5910
- const { bounds: y } = u, { bounds: M } = g, A = y.top - M.bottom, j = n - y.bottom, w = Math.abs(j - A);
5911
- if (w <= e) {
5912
- const T = A - j, S = n + T, C = {
5952
+ const { bounds: y } = u, { bounds: b } = g, I = y.top - b.bottom, j = n - y.bottom, A = Math.abs(j - I);
5953
+ if (A <= e) {
5954
+ const C = I - j, w = n + C, T = {
5913
5955
  type: "vertical",
5914
5956
  axis: o,
5915
- refStart: M.bottom,
5957
+ refStart: b.bottom,
5916
5958
  refEnd: y.top,
5917
5959
  activeStart: y.bottom,
5918
- activeEnd: S,
5919
- distance: A
5960
+ activeEnd: w,
5961
+ distance: I
5920
5962
  };
5921
- m.push({ delta: T, guide: C, diff: w });
5963
+ m.push({ delta: C, guide: T, diff: A });
5922
5964
  }
5923
5965
  }
5924
5966
  if (f && p) {
5925
- const { bounds: y } = f, { bounds: M } = p, A = M.top - y.bottom, j = y.top - i, w = Math.abs(j - A);
5926
- if (w <= e) {
5927
- const T = j - A, S = i + T, C = {
5967
+ const { bounds: y } = f, { bounds: b } = p, I = b.top - y.bottom, j = y.top - i, A = Math.abs(j - I);
5968
+ if (A <= e) {
5969
+ const C = j - I, w = i + C, T = {
5928
5970
  type: "vertical",
5929
5971
  axis: o,
5930
5972
  refStart: y.bottom,
5931
- refEnd: M.top,
5932
- activeStart: S,
5973
+ refEnd: b.top,
5974
+ activeStart: w,
5933
5975
  activeEnd: y.top,
5934
- distance: A
5976
+ distance: I
5935
5977
  };
5936
- m.push({ delta: T, guide: C, diff: w });
5978
+ m.push({ delta: C, guide: T, diff: A });
5937
5979
  }
5938
5980
  }
5939
5981
  if (u && f) {
5940
- const { bounds: y } = u, { bounds: M } = f, j = M.top - y.bottom - v;
5982
+ const { bounds: y } = u, { bounds: b } = f, j = b.top - y.bottom - v;
5941
5983
  if (j >= 0) {
5942
- const w = j / 2, T = n - y.bottom, S = M.top - i, C = Math.abs(T - w), x = Math.abs(S - w), W = Math.max(C, x);
5943
- if (W <= e) {
5944
- const Y = w - T, H = i + Y, V = {
5984
+ const A = j / 2, C = n - y.bottom, w = b.top - i, T = Math.abs(C - A), E = Math.abs(w - A), P = Math.max(T, E);
5985
+ if (P <= e) {
5986
+ const x = A - C, N = i + x, Z = {
5945
5987
  type: "vertical",
5946
5988
  axis: o,
5947
5989
  refStart: y.bottom,
5948
- refEnd: y.bottom + w,
5949
- activeStart: H,
5950
- activeEnd: H + w,
5951
- distance: w
5990
+ refEnd: y.bottom + A,
5991
+ activeStart: N,
5992
+ activeEnd: N + A,
5993
+ distance: A
5952
5994
  };
5953
- m.push({ delta: Y, guide: V, diff: W });
5995
+ m.push({ delta: x, guide: Z, diff: P });
5954
5996
  }
5955
5997
  }
5956
5998
  }
5957
- const b = ns({
5999
+ const M = os({
5958
6000
  activeBounds: h,
5959
6001
  aligned: c,
5960
6002
  threshold: e,
5961
6003
  patterns: s,
5962
6004
  type: "vertical"
5963
6005
  });
5964
- if (m.push(...b), !m.length)
6006
+ if (m.push(...M), !m.length)
5965
6007
  return { delta: 0, guide: null };
5966
- const I = m.reduce((y, M) => M.diff < y.diff ? M : y, m[0]);
6008
+ const S = m.reduce((y, b) => b.diff < y.diff ? b : y, m[0]);
5967
6009
  return {
5968
- delta: I.delta,
5969
- guide: I.guide
6010
+ delta: S.delta,
6011
+ guide: S.guide
5970
6012
  };
5971
6013
  }, vo = ({
5972
6014
  activeBounds: h,
@@ -5987,72 +6029,72 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
5987
6029
  ...c.map((y) => ({ bounds: y, isActive: !1 })),
5988
6030
  { bounds: h, isActive: !0 }
5989
6031
  ];
5990
- d.sort((y, M) => y.bounds.left - M.bounds.left);
6032
+ d.sort((y, b) => y.bounds.left - b.bounds.left);
5991
6033
  const l = d.findIndex((y) => y.isActive);
5992
6034
  if (l === -1)
5993
6035
  return { delta: 0, guide: null };
5994
6036
  const u = d[l - 1], g = d[l - 2], f = d[l + 1], p = d[l + 2], m = [], v = i - n;
5995
6037
  if (u && g) {
5996
- const { bounds: y } = u, { bounds: M } = g, A = y.left - M.right, j = n - y.right, w = Math.abs(j - A);
5997
- if (w <= e) {
5998
- const T = A - j, S = n + T, C = {
6038
+ const { bounds: y } = u, { bounds: b } = g, I = y.left - b.right, j = n - y.right, A = Math.abs(j - I);
6039
+ if (A <= e) {
6040
+ const C = I - j, w = n + C, T = {
5999
6041
  type: "horizontal",
6000
6042
  axis: o,
6001
- refStart: M.right,
6043
+ refStart: b.right,
6002
6044
  refEnd: y.left,
6003
6045
  activeStart: y.right,
6004
- activeEnd: S,
6005
- distance: A
6046
+ activeEnd: w,
6047
+ distance: I
6006
6048
  };
6007
- m.push({ delta: T, guide: C, diff: w });
6049
+ m.push({ delta: C, guide: T, diff: A });
6008
6050
  }
6009
6051
  }
6010
6052
  if (f && p) {
6011
- const { bounds: y } = f, { bounds: M } = p, A = M.left - y.right, j = y.left - i, w = Math.abs(j - A);
6012
- if (w <= e) {
6013
- const T = j - A, S = i + T, C = {
6053
+ const { bounds: y } = f, { bounds: b } = p, I = b.left - y.right, j = y.left - i, A = Math.abs(j - I);
6054
+ if (A <= e) {
6055
+ const C = j - I, w = i + C, T = {
6014
6056
  type: "horizontal",
6015
6057
  axis: o,
6016
6058
  refStart: y.right,
6017
- refEnd: M.left,
6018
- activeStart: S,
6059
+ refEnd: b.left,
6060
+ activeStart: w,
6019
6061
  activeEnd: y.left,
6020
- distance: A
6062
+ distance: I
6021
6063
  };
6022
- m.push({ delta: T, guide: C, diff: w });
6064
+ m.push({ delta: C, guide: T, diff: A });
6023
6065
  }
6024
6066
  }
6025
6067
  if (u && f) {
6026
- const { bounds: y } = u, { bounds: M } = f, j = M.left - y.right - v;
6068
+ const { bounds: y } = u, { bounds: b } = f, j = b.left - y.right - v;
6027
6069
  if (j >= 0) {
6028
- const w = j / 2, T = n - y.right, S = M.left - i, C = Math.abs(T - w), x = Math.abs(S - w), W = Math.max(C, x);
6029
- if (W <= e) {
6030
- const Y = w - T, H = i + Y, V = {
6070
+ const A = j / 2, C = n - y.right, w = b.left - i, T = Math.abs(C - A), E = Math.abs(w - A), P = Math.max(T, E);
6071
+ if (P <= e) {
6072
+ const x = A - C, N = i + x, Z = {
6031
6073
  type: "horizontal",
6032
6074
  axis: o,
6033
6075
  refStart: y.right,
6034
- refEnd: y.right + w,
6035
- activeStart: H,
6036
- activeEnd: H + w,
6037
- distance: w
6076
+ refEnd: y.right + A,
6077
+ activeStart: N,
6078
+ activeEnd: N + A,
6079
+ distance: A
6038
6080
  };
6039
- m.push({ delta: Y, guide: V, diff: W });
6081
+ m.push({ delta: x, guide: Z, diff: P });
6040
6082
  }
6041
6083
  }
6042
6084
  }
6043
- const b = ns({
6085
+ const M = os({
6044
6086
  activeBounds: h,
6045
6087
  aligned: c,
6046
6088
  threshold: e,
6047
6089
  patterns: s,
6048
6090
  type: "horizontal"
6049
6091
  });
6050
- if (m.push(...b), !m.length)
6092
+ if (m.push(...M), !m.length)
6051
6093
  return { delta: 0, guide: null };
6052
- const I = m.reduce((y, M) => M.diff < y.diff ? M : y, m[0]);
6094
+ const S = m.reduce((y, b) => b.diff < y.diff ? b : y, m[0]);
6053
6095
  return {
6054
- delta: I.delta,
6055
- guide: I.guide
6096
+ delta: S.delta,
6097
+ guide: S.guide
6056
6098
  };
6057
6099
  }, bo = ({
6058
6100
  activeBounds: h,
@@ -6086,7 +6128,7 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6086
6128
  }) => {
6087
6129
  const i = Math.min(n, s / 2, o / 2);
6088
6130
  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();
6089
- }, me = ({
6131
+ }, pe = ({
6090
6132
  context: h,
6091
6133
  type: t,
6092
6134
  axis: e,
@@ -6103,17 +6145,17 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6103
6145
  offsetAlongAxis: g = 0,
6104
6146
  offsetPerpendicular: f = 0
6105
6147
  }) => {
6106
- const p = i || 1, m = 12 / p, v = l / p, b = u / p, I = (s + o) / 2 + g, y = t === "vertical" ? e + f : I, M = t === "vertical" ? I : e + f;
6148
+ const p = i || 1, m = 12 / p, v = l / p, M = u / p, S = (s + o) / 2 + g, y = t === "vertical" ? e + f : S, b = t === "vertical" ? S : e + f;
6107
6149
  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";
6108
- const j = h.measureText(n).width + v * 2, w = m + v * 2, T = y - j / 2, S = M - w / 2;
6150
+ const j = h.measureText(n).width + v * 2, A = m + v * 2, C = y - j / 2, w = b - A / 2;
6109
6151
  h.beginPath(), Mo({
6110
6152
  context: h,
6111
- x: T,
6112
- y: S,
6153
+ x: C,
6154
+ y: w,
6113
6155
  width: j,
6114
- height: w,
6115
- radius: b
6116
- }), h.fill(), h.fillStyle = r, h.fillText(n, y, M), h.restore();
6156
+ height: A,
6157
+ radius: M
6158
+ }), h.fill(), h.fillStyle = r, h.fillText(n, y, b), h.restore();
6117
6159
  }, wo = ({
6118
6160
  context: h,
6119
6161
  guide: t,
@@ -6129,8 +6171,8 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6129
6171
  distance: c
6130
6172
  } = t, d = Math.round(c).toString();
6131
6173
  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();
6132
- const l = os;
6133
- me({
6174
+ const l = ss;
6175
+ pe({
6134
6176
  context: h,
6135
6177
  type: s,
6136
6178
  axis: o,
@@ -6139,8 +6181,8 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6139
6181
  text: d,
6140
6182
  zoom: e,
6141
6183
  color: l,
6142
- lineWidth: pe
6143
- }), me({
6184
+ lineWidth: fe
6185
+ }), pe({
6144
6186
  context: h,
6145
6187
  type: s,
6146
6188
  axis: o,
@@ -6149,9 +6191,9 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6149
6191
  text: d,
6150
6192
  zoom: e,
6151
6193
  color: l,
6152
- lineWidth: pe
6194
+ lineWidth: fe
6153
6195
  });
6154
- }, qe = ({
6196
+ }, Qe = ({
6155
6197
  anchors: h,
6156
6198
  bounds: t
6157
6199
  }) => {
@@ -6164,7 +6206,7 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6164
6206
  centerY: a
6165
6207
  } = t;
6166
6208
  h.vertical.push(e, o, s), h.horizontal.push(n, a, i);
6167
- }, Je = ({
6209
+ }, qe = ({
6168
6210
  bounds: h,
6169
6211
  type: t,
6170
6212
  primaryStart: e,
@@ -6177,8 +6219,8 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6177
6219
  for (let p = r + 1; p < a.length; p += 1) {
6178
6220
  const m = a[p];
6179
6221
  if (Math.min(c[i], m[i]) - Math.max(c[n], m[n]) < 0) continue;
6180
- const b = m[e] - c[s];
6181
- b < 0 || b < l && (l = b, d = m);
6222
+ const M = m[e] - c[s];
6223
+ M < 0 || M < l && (l = M, d = m);
6182
6224
  }
6183
6225
  if (!d || l === Number.POSITIVE_INFINITY) continue;
6184
6226
  const u = Math.max(c[n], d[n]), g = Math.min(c[i], d[i]), f = (u + g) / 2;
@@ -6194,24 +6236,24 @@ const po = 5, os = "#3D8BF4", pe = 1, Qt = 1, Qe = ({
6194
6236
  }, So = ({
6195
6237
  bounds: h
6196
6238
  }) => {
6197
- const t = Je({
6239
+ const t = qe({
6198
6240
  bounds: h,
6199
6241
  type: "vertical",
6200
6242
  primaryStart: "top",
6201
6243
  primaryEnd: "bottom"
6202
- }), e = Je({
6244
+ }), e = qe({
6203
6245
  bounds: h,
6204
6246
  type: "horizontal",
6205
6247
  primaryStart: "left",
6206
6248
  primaryEnd: "right"
6207
6249
  });
6208
6250
  return { vertical: t, horizontal: e };
6209
- }, Ao = ["montage-area", "background", "interaction-blocker"], is = ({
6251
+ }, Ao = ["montage-area", "background", "interaction-blocker"], ns = ({
6210
6252
  activeObject: h
6211
6253
  }) => {
6212
6254
  const t = /* @__PURE__ */ new Set();
6213
- return h && (t.add(h), h instanceof k && h.getObjects().forEach((e) => t.add(e))), t;
6214
- }, as = ({
6255
+ return h && (t.add(h), h instanceof U && h.getObjects().forEach((e) => t.add(e))), t;
6256
+ }, is = ({
6215
6257
  object: h,
6216
6258
  excluded: t,
6217
6259
  ignoredIds: e = Ao
@@ -6291,10 +6333,10 @@ class jo {
6291
6333
  anchors: this.anchors
6292
6334
  }), { deltaX: d, deltaY: l, guides: u } = c;
6293
6335
  if (d !== 0 || l !== 0) {
6294
- const { left: v = 0, top: b = 0 } = e;
6336
+ const { left: v = 0, top: M = 0 } = e;
6295
6337
  e.set({
6296
6338
  left: v + d,
6297
- top: b + l
6339
+ top: M + l
6298
6340
  }), e.setCoords(), n = (p = ft({ object: e })) != null ? p : n;
6299
6341
  }
6300
6342
  const g = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => ft({ object: v })).filter((v) => !!v), f = bo({
@@ -6304,10 +6346,10 @@ class jo {
6304
6346
  spacingPatterns: this.spacingPatterns
6305
6347
  });
6306
6348
  if (f.deltaX !== 0 || f.deltaY !== 0) {
6307
- const { left: v = 0, top: b = 0 } = e;
6349
+ const { left: v = 0, top: M = 0 } = e;
6308
6350
  e.set({
6309
6351
  left: v + f.deltaX,
6310
- top: b + f.deltaY
6352
+ top: M + f.deltaY
6311
6353
  }), e.setCoords(), n = (m = ft({ object: e })) != null ? m : n;
6312
6354
  }
6313
6355
  this._applyGuides({
@@ -6336,7 +6378,7 @@ class jo {
6336
6378
  const { canvas: t, guideBounds: e } = this, s = t.getSelectionContext();
6337
6379
  if (!s) return;
6338
6380
  const o = e != null ? e : this._calculateViewportBounds(), { left: n, right: i, top: a, bottom: r } = o, { viewportTransform: c } = t, d = t.getZoom() || 1;
6339
- s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = pe / d, s.strokeStyle = os, s.setLineDash([4, 4]);
6381
+ s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = fe / d, s.strokeStyle = ss, s.setLineDash([4, 4]);
6340
6382
  for (const l of this.activeGuides)
6341
6383
  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();
6342
6384
  for (const l of this.activeSpacingGuides)
@@ -6376,7 +6418,7 @@ class jo {
6376
6418
  * Применяет шаг перемещения, округляя координаты объекта к сетке MOVE_SNAP_STEP.
6377
6419
  */
6378
6420
  _applyMovementStep({ target: t }) {
6379
- const { left: e = 0, top: s = 0 } = t, o = Math.round(e / Qt) * Qt, n = Math.round(s / Qt) * Qt;
6421
+ const { left: e = 0, top: s = 0 } = t, o = Math.round(e / Jt) * Jt, n = Math.round(s / Jt) * Jt;
6380
6422
  o === e && n === s || (t.set({
6381
6423
  left: o,
6382
6424
  top: n
@@ -6389,11 +6431,11 @@ class jo {
6389
6431
  const e = this._collectTargets({ activeObject: t }), s = { vertical: [], horizontal: [] }, o = [];
6390
6432
  for (const a of e) {
6391
6433
  const r = ft({ object: a });
6392
- r && (qe({ anchors: s, bounds: r }), o.push(r));
6434
+ r && (Qe({ anchors: s, bounds: r }), o.push(r));
6393
6435
  }
6394
6436
  const { montageArea: n } = this.editor, i = ft({ object: n });
6395
6437
  if (i) {
6396
- qe({ anchors: s, bounds: i });
6438
+ Qe({ anchors: s, bounds: i });
6397
6439
  const { left: a, right: r, top: c, bottom: d } = i;
6398
6440
  this.guideBounds = {
6399
6441
  left: a,
@@ -6409,9 +6451,9 @@ class jo {
6409
6451
  * Собирает объекты, подходящие для прилипания, исключая активный объект и запрещённые id.
6410
6452
  */
6411
6453
  _collectTargets({ activeObject: t }) {
6412
- const e = is({ activeObject: t }), s = [];
6454
+ const e = ns({ activeObject: t }), s = [];
6413
6455
  return this.canvas.forEachObject((o) => {
6414
- as({ object: o, excluded: e }) || s.push(o);
6456
+ is({ object: o, excluded: e }) || s.push(o);
6415
6457
  }), s;
6416
6458
  }
6417
6459
  /**
@@ -6434,7 +6476,7 @@ class jo {
6434
6476
  };
6435
6477
  }
6436
6478
  }
6437
- const $e = "#3D8BF4", ts = 1;
6479
+ const Je = "#3D8BF4", $e = 1;
6438
6480
  class Lt {
6439
6481
  /**
6440
6482
  * Создаёт менеджер измерений и инициализирует события.
@@ -6575,8 +6617,8 @@ class Lt {
6575
6617
  event: t,
6576
6618
  activeObject: e
6577
6619
  }) {
6578
- const { target: s } = t, o = is({ activeObject: e });
6579
- return s && !as({ object: s, excluded: o }) ? s : null;
6620
+ const { target: s } = t, o = ns({ activeObject: e });
6621
+ return s && !is({ object: s, excluded: o }) ? s : null;
6580
6622
  }
6581
6623
  /**
6582
6624
  * Собирает вертикальные и горизонтальные направляющие расстояний.
@@ -6617,45 +6659,45 @@ class Lt {
6617
6659
  top: u = 0,
6618
6660
  bottom: g = 0,
6619
6661
  centerY: f = 0
6620
- } = e, p = Math.max(a, u), m = Math.min(r, g), b = m >= p ? (p + m) / 2 : (c + f) / 2;
6662
+ } = e, p = Math.max(a, u), m = Math.min(r, g), M = m >= p ? (p + m) / 2 : (c + f) / 2;
6621
6663
  if (d >= i) {
6622
6664
  if (s) return o;
6623
- const C = d - i;
6624
- return C > 0 && o.push({
6665
+ const T = d - i;
6666
+ return T > 0 && o.push({
6625
6667
  type: "horizontal",
6626
- axis: b,
6668
+ axis: M,
6627
6669
  start: i,
6628
6670
  end: d,
6629
- distance: C
6671
+ distance: T
6630
6672
  }), o;
6631
6673
  }
6632
6674
  if (l <= n) {
6633
6675
  if (s) return o;
6634
- const C = n - l;
6635
- return C > 0 && o.push({
6676
+ const T = n - l;
6677
+ return T > 0 && o.push({
6636
6678
  type: "horizontal",
6637
- axis: b,
6679
+ axis: M,
6638
6680
  start: l,
6639
6681
  end: n,
6640
- distance: C
6682
+ distance: T
6641
6683
  }), o;
6642
6684
  }
6643
6685
  if (!s) return o;
6644
- const I = n < d, y = i > l, M = Math.min(n, d), A = Math.max(n, d), j = A - M;
6645
- j > 0 && !I && o.push({
6686
+ const S = n < d, y = i > l, b = Math.min(n, d), I = Math.max(n, d), j = I - b;
6687
+ j > 0 && !S && o.push({
6646
6688
  type: "horizontal",
6647
- axis: b,
6648
- start: M,
6649
- end: A,
6689
+ axis: M,
6690
+ start: b,
6691
+ end: I,
6650
6692
  distance: j
6651
6693
  });
6652
- const w = Math.min(i, l), T = Math.max(i, l), S = T - w;
6653
- return S > 0 && !y && o.push({
6694
+ const A = Math.min(i, l), C = Math.max(i, l), w = C - A;
6695
+ return w > 0 && !y && o.push({
6654
6696
  type: "horizontal",
6655
- axis: b,
6656
- start: w,
6657
- end: T,
6658
- distance: S
6697
+ axis: M,
6698
+ start: A,
6699
+ end: C,
6700
+ distance: w
6659
6701
  }), o;
6660
6702
  }
6661
6703
  /**
@@ -6678,45 +6720,45 @@ class Lt {
6678
6720
  left: u = 0,
6679
6721
  right: g = 0,
6680
6722
  centerX: f = 0
6681
- } = e, p = Math.max(a, u), m = Math.min(r, g), b = m >= p ? (p + m) / 2 : (c + f) / 2;
6723
+ } = e, p = Math.max(a, u), m = Math.min(r, g), M = m >= p ? (p + m) / 2 : (c + f) / 2;
6682
6724
  if (d >= i) {
6683
6725
  if (s) return o;
6684
- const C = d - i;
6685
- return C > 0 && o.push({
6726
+ const T = d - i;
6727
+ return T > 0 && o.push({
6686
6728
  type: "vertical",
6687
- axis: b,
6729
+ axis: M,
6688
6730
  start: i,
6689
6731
  end: d,
6690
- distance: C
6732
+ distance: T
6691
6733
  }), o;
6692
6734
  }
6693
6735
  if (l <= n) {
6694
6736
  if (s) return o;
6695
- const C = n - l;
6696
- return C > 0 && o.push({
6737
+ const T = n - l;
6738
+ return T > 0 && o.push({
6697
6739
  type: "vertical",
6698
- axis: b,
6740
+ axis: M,
6699
6741
  start: l,
6700
6742
  end: n,
6701
- distance: C
6743
+ distance: T
6702
6744
  }), o;
6703
6745
  }
6704
6746
  if (!s) return o;
6705
- const I = n < d, y = i > l, M = Math.min(n, d), A = Math.max(n, d), j = A - M;
6706
- j > 0 && !I && o.push({
6747
+ const S = n < d, y = i > l, b = Math.min(n, d), I = Math.max(n, d), j = I - b;
6748
+ j > 0 && !S && o.push({
6707
6749
  type: "vertical",
6708
- axis: b,
6709
- start: M,
6710
- end: A,
6750
+ axis: M,
6751
+ start: b,
6752
+ end: I,
6711
6753
  distance: j
6712
6754
  });
6713
- const w = Math.min(i, l), T = Math.max(i, l), S = T - w;
6714
- return S > 0 && !y && o.push({
6755
+ const A = Math.min(i, l), C = Math.max(i, l), w = C - A;
6756
+ return w > 0 && !y && o.push({
6715
6757
  type: "vertical",
6716
- axis: b,
6717
- start: w,
6718
- end: T,
6719
- distance: S
6758
+ axis: M,
6759
+ start: A,
6760
+ end: C,
6761
+ distance: w
6720
6762
  }), o;
6721
6763
  }
6722
6764
  /**
@@ -6744,10 +6786,10 @@ class Lt {
6744
6786
  const { canvas: t } = this, e = t.getSelectionContext();
6745
6787
  if (!e) return;
6746
6788
  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;
6747
- e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = ts / o, e.strokeStyle = $e, e.setLineDash([]);
6789
+ e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = $e / o, e.strokeStyle = Je, e.setLineDash([]);
6748
6790
  for (const c of this.activeGuides) {
6749
- 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;
6750
- e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, g)) : (e.moveTo(u, l), e.lineTo(g, l)), e.stroke(), me({
6791
+ 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, M = 0;
6792
+ e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, g)) : (e.moveTo(u, l), e.lineTo(g, l)), e.stroke(), pe({
6751
6793
  context: e,
6752
6794
  type: d,
6753
6795
  axis: l,
@@ -6755,10 +6797,10 @@ class Lt {
6755
6797
  end: g,
6756
6798
  text: Math.round(f).toString(),
6757
6799
  zoom: o,
6758
- color: $e,
6759
- lineWidth: ts,
6800
+ color: Je,
6801
+ lineWidth: $e,
6760
6802
  offsetAlongAxis: v,
6761
- offsetPerpendicular: b
6803
+ offsetPerpendicular: M
6762
6804
  });
6763
6805
  }
6764
6806
  e.restore();
@@ -6782,14 +6824,14 @@ class Lt {
6782
6824
  (e = t == null ? void 0 : t.showAfterTemporary) == null || e.call(t), this.isToolbarHidden = !1;
6783
6825
  }
6784
6826
  }
6785
- class Se {
6827
+ class we {
6786
6828
  /**
6787
6829
  * Конструктор класса ImageEditor.
6788
6830
  * @param canvasId - идентификатор канваса, в котором будет создан редактор
6789
6831
  * @param options - опции и настройки редактора
6790
6832
  */
6791
6833
  constructor(t, e) {
6792
- this.options = e, this.containerId = t, this.editorId = `${t}-${G()}`, this.clipboard = null, this.init();
6834
+ this.options = e, this.containerId = t, this.editorId = `${t}-${V()}`, this.clipboard = null, this.init();
6793
6835
  }
6794
6836
  /**
6795
6837
  * Инициализация редактора.
@@ -6797,7 +6839,7 @@ class Se {
6797
6839
  * @fires editor:ready
6798
6840
  */
6799
6841
  init() {
6800
- return N(this, null, function* () {
6842
+ return k(this, null, function* () {
6801
6843
  var u;
6802
6844
  const {
6803
6845
  editorContainerWidth: t,
@@ -6812,7 +6854,7 @@ class Se {
6812
6854
  showRotationAngle: d,
6813
6855
  _onReadyCallback: l
6814
6856
  } = this.options;
6815
- 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) {
6857
+ if ($.apply(), this.canvas = new ys(this.containerId, this.options), this.moduleLoader = new Ss(), this.workerManager = new js(), this.errorManager = new Wt({ editor: this }), this.historyManager = new Ys({ editor: this }), this.toolbar = new Ps({ 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 te({ 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 ee({ editor: this }), this.groupingManager = new so({ editor: this }), this.selectionManager = new oo({ editor: this }), this.deletionManager = new Me({ editor: this }), this.panConstraintManager = new no({ editor: this }), this.snappingManager = new jo({ editor: this }), this.measurementManager = new Lt({ editor: this }), this.fontManager = new ge((u = this.options.fonts) != null ? u : []), this.textManager = new F({ editor: this }), this.templateManager = new R({ editor: this }), d && (this.angleIndicator = new be({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Ft({ 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) {
6816
6858
  const {
6817
6859
  source: g,
6818
6860
  scale: f = `image-${c}`,
@@ -6834,7 +6876,7 @@ class Se {
6834
6876
  this.montageArea = this.shapeManager.addRectangle({
6835
6877
  width: t,
6836
6878
  height: e,
6837
- fill: Se._createMosaicPattern(),
6879
+ fill: we._createMosaicPattern(),
6838
6880
  stroke: null,
6839
6881
  strokeWidth: 0,
6840
6882
  selectable: !1,
@@ -6885,37 +6927,50 @@ class Se {
6885
6927
  const t = document.createElement("canvas");
6886
6928
  t.width = 20, t.height = 20;
6887
6929
  const e = t.getContext("2d");
6888
- 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({
6930
+ 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 vs({
6889
6931
  source: t,
6890
6932
  repeat: "repeat"
6891
6933
  });
6892
6934
  }
6893
6935
  }
6894
- const E = [
6936
+ const O = [
6895
6937
  "U+0000-00FF",
6896
- "U+0131",
6897
- "U+0152-0153",
6938
+ "U+0100-02BA",
6898
6939
  "U+02BB-02BC",
6940
+ "U+02BD-02C5",
6941
+ "U+02C7-02CC",
6942
+ "U+02CE-02D7",
6943
+ "U+02DD-02FF",
6899
6944
  "U+02C6",
6900
- "U+02DA",
6901
6945
  "U+02DC",
6902
6946
  "U+0304",
6903
6947
  "U+0308",
6904
6948
  "U+0329",
6949
+ "U+1D00-1DBF",
6950
+ "U+1E00-1E9F",
6951
+ "U+1EF2-1EFF",
6905
6952
  "U+2000-206F",
6906
- "U+20AC",
6953
+ "U+2020",
6954
+ "U+20A0-20AB",
6955
+ "U+20AD-20C0",
6956
+ "U+2113",
6907
6957
  "U+2122",
6908
6958
  "U+2191",
6909
6959
  "U+2193",
6910
6960
  "U+2212",
6911
6961
  "U+2215",
6962
+ "U+2C60-2C7F",
6963
+ "U+A720-A7FF",
6912
6964
  "U+FEFF",
6913
6965
  "U+FFFD"
6914
- ].join(", "), O = [
6966
+ ].join(", "), L = [
6915
6967
  "U+0301",
6916
- "U+0400-045F",
6917
- "U+0490-0491",
6918
- "U+04B0-04B1",
6968
+ "U+0400-052F",
6969
+ "U+1C80-1C8A",
6970
+ "U+20B4",
6971
+ "U+2DE0-2DFF",
6972
+ "U+A640-A69F",
6973
+ "U+FE2E-FE2F",
6919
6974
  "U+2116"
6920
6975
  ].join(", "), Io = [
6921
6976
  {
@@ -6934,7 +6989,7 @@ const E = [
6934
6989
  style: "normal",
6935
6990
  weight: "400",
6936
6991
  display: "swap",
6937
- unicodeRange: O
6992
+ unicodeRange: L
6938
6993
  }
6939
6994
  },
6940
6995
  {
@@ -6944,7 +6999,7 @@ const E = [
6944
6999
  style: "normal",
6945
7000
  weight: "400",
6946
7001
  display: "swap",
6947
- unicodeRange: E
7002
+ unicodeRange: O
6948
7003
  }
6949
7004
  },
6950
7005
  {
@@ -6954,7 +7009,7 @@ const E = [
6954
7009
  style: "normal",
6955
7010
  weight: "700",
6956
7011
  display: "swap",
6957
- unicodeRange: O
7012
+ unicodeRange: L
6958
7013
  }
6959
7014
  },
6960
7015
  {
@@ -6964,7 +7019,7 @@ const E = [
6964
7019
  style: "normal",
6965
7020
  weight: "700",
6966
7021
  display: "swap",
6967
- unicodeRange: E
7022
+ unicodeRange: O
6968
7023
  }
6969
7024
  },
6970
7025
  {
@@ -6974,7 +7029,7 @@ const E = [
6974
7029
  style: "normal",
6975
7030
  weight: "200 700",
6976
7031
  display: "swap",
6977
- unicodeRange: O
7032
+ unicodeRange: L
6978
7033
  }
6979
7034
  },
6980
7035
  {
@@ -6984,7 +7039,7 @@ const E = [
6984
7039
  style: "normal",
6985
7040
  weight: "200 700",
6986
7041
  display: "swap",
6987
- unicodeRange: E
7042
+ unicodeRange: O
6988
7043
  }
6989
7044
  },
6990
7045
  {
@@ -6994,7 +7049,7 @@ const E = [
6994
7049
  style: "normal",
6995
7050
  weight: "300 900",
6996
7051
  display: "swap",
6997
- unicodeRange: O
7052
+ unicodeRange: L
6998
7053
  }
6999
7054
  },
7000
7055
  {
@@ -7004,7 +7059,7 @@ const E = [
7004
7059
  style: "normal",
7005
7060
  weight: "300 900",
7006
7061
  display: "swap",
7007
- unicodeRange: E
7062
+ unicodeRange: O
7008
7063
  }
7009
7064
  },
7010
7065
  {
@@ -7014,7 +7069,7 @@ const E = [
7014
7069
  style: "normal",
7015
7070
  weight: "400 700",
7016
7071
  display: "swap",
7017
- unicodeRange: O
7072
+ unicodeRange: L
7018
7073
  }
7019
7074
  },
7020
7075
  {
@@ -7024,7 +7079,7 @@ const E = [
7024
7079
  style: "normal",
7025
7080
  weight: "400 700",
7026
7081
  display: "swap",
7027
- unicodeRange: E
7082
+ unicodeRange: O
7028
7083
  }
7029
7084
  },
7030
7085
  {
@@ -7034,7 +7089,7 @@ const E = [
7034
7089
  style: "normal",
7035
7090
  weight: "300 700",
7036
7091
  display: "swap",
7037
- unicodeRange: O
7092
+ unicodeRange: L
7038
7093
  }
7039
7094
  },
7040
7095
  {
@@ -7044,7 +7099,7 @@ const E = [
7044
7099
  style: "normal",
7045
7100
  weight: "300 700",
7046
7101
  display: "swap",
7047
- unicodeRange: E
7102
+ unicodeRange: O
7048
7103
  }
7049
7104
  },
7050
7105
  {
@@ -7054,7 +7109,7 @@ const E = [
7054
7109
  style: "normal",
7055
7110
  weight: "300 700",
7056
7111
  display: "swap",
7057
- unicodeRange: O
7112
+ unicodeRange: L
7058
7113
  }
7059
7114
  },
7060
7115
  {
@@ -7064,7 +7119,7 @@ const E = [
7064
7119
  style: "normal",
7065
7120
  weight: "300 700",
7066
7121
  display: "swap",
7067
- unicodeRange: E
7122
+ unicodeRange: O
7068
7123
  }
7069
7124
  },
7070
7125
  {
@@ -7074,7 +7129,7 @@ const E = [
7074
7129
  style: "normal",
7075
7130
  weight: "400",
7076
7131
  display: "swap",
7077
- unicodeRange: O
7132
+ unicodeRange: L
7078
7133
  }
7079
7134
  },
7080
7135
  {
@@ -7084,7 +7139,7 @@ const E = [
7084
7139
  style: "normal",
7085
7140
  weight: "400",
7086
7141
  display: "swap",
7087
- unicodeRange: E
7142
+ unicodeRange: O
7088
7143
  }
7089
7144
  },
7090
7145
  {
@@ -7094,7 +7149,7 @@ const E = [
7094
7149
  style: "normal",
7095
7150
  weight: "400 700",
7096
7151
  display: "swap",
7097
- unicodeRange: O
7152
+ unicodeRange: L
7098
7153
  }
7099
7154
  },
7100
7155
  {
@@ -7104,7 +7159,7 @@ const E = [
7104
7159
  style: "normal",
7105
7160
  weight: "400 700",
7106
7161
  display: "swap",
7107
- unicodeRange: E
7162
+ unicodeRange: O
7108
7163
  }
7109
7164
  },
7110
7165
  {
@@ -7114,7 +7169,7 @@ const E = [
7114
7169
  style: "normal",
7115
7170
  weight: "100 900",
7116
7171
  display: "swap",
7117
- unicodeRange: O
7172
+ unicodeRange: L
7118
7173
  }
7119
7174
  },
7120
7175
  {
@@ -7124,7 +7179,7 @@ const E = [
7124
7179
  style: "normal",
7125
7180
  weight: "100 900",
7126
7181
  display: "swap",
7127
- unicodeRange: E
7182
+ unicodeRange: O
7128
7183
  }
7129
7184
  },
7130
7185
  {
@@ -7134,7 +7189,7 @@ const E = [
7134
7189
  style: "normal",
7135
7190
  weight: "400",
7136
7191
  display: "swap",
7137
- unicodeRange: O
7192
+ unicodeRange: L
7138
7193
  }
7139
7194
  },
7140
7195
  {
@@ -7144,7 +7199,7 @@ const E = [
7144
7199
  style: "normal",
7145
7200
  weight: "400",
7146
7201
  display: "swap",
7147
- unicodeRange: E
7202
+ unicodeRange: O
7148
7203
  }
7149
7204
  },
7150
7205
  {
@@ -7154,7 +7209,7 @@ const E = [
7154
7209
  style: "normal",
7155
7210
  weight: "700",
7156
7211
  display: "swap",
7157
- unicodeRange: O
7212
+ unicodeRange: L
7158
7213
  }
7159
7214
  },
7160
7215
  {
@@ -7164,7 +7219,7 @@ const E = [
7164
7219
  style: "normal",
7165
7220
  weight: "700",
7166
7221
  display: "swap",
7167
- unicodeRange: E
7222
+ unicodeRange: O
7168
7223
  }
7169
7224
  },
7170
7225
  {
@@ -7174,7 +7229,7 @@ const E = [
7174
7229
  style: "normal",
7175
7230
  weight: "400 700",
7176
7231
  display: "swap",
7177
- unicodeRange: O
7232
+ unicodeRange: L
7178
7233
  }
7179
7234
  },
7180
7235
  {
@@ -7184,7 +7239,7 @@ const E = [
7184
7239
  style: "normal",
7185
7240
  weight: "400 700",
7186
7241
  display: "swap",
7187
- unicodeRange: E
7242
+ unicodeRange: O
7188
7243
  }
7189
7244
  },
7190
7245
  {
@@ -7194,7 +7249,7 @@ const E = [
7194
7249
  style: "normal",
7195
7250
  weight: "100 900",
7196
7251
  display: "swap",
7197
- unicodeRange: O
7252
+ unicodeRange: L
7198
7253
  }
7199
7254
  },
7200
7255
  {
@@ -7204,7 +7259,7 @@ const E = [
7204
7259
  style: "normal",
7205
7260
  weight: "100 900",
7206
7261
  display: "swap",
7207
- unicodeRange: E
7262
+ unicodeRange: O
7208
7263
  }
7209
7264
  },
7210
7265
  {
@@ -7214,7 +7269,7 @@ const E = [
7214
7269
  style: "normal",
7215
7270
  weight: "100",
7216
7271
  display: "swap",
7217
- unicodeRange: O
7272
+ unicodeRange: L
7218
7273
  }
7219
7274
  },
7220
7275
  {
@@ -7224,7 +7279,7 @@ const E = [
7224
7279
  style: "normal",
7225
7280
  weight: "100",
7226
7281
  display: "swap",
7227
- unicodeRange: E
7282
+ unicodeRange: O
7228
7283
  }
7229
7284
  },
7230
7285
  {
@@ -7234,7 +7289,7 @@ const E = [
7234
7289
  style: "normal",
7235
7290
  weight: "200",
7236
7291
  display: "swap",
7237
- unicodeRange: O
7292
+ unicodeRange: L
7238
7293
  }
7239
7294
  },
7240
7295
  {
@@ -7244,7 +7299,7 @@ const E = [
7244
7299
  style: "normal",
7245
7300
  weight: "200",
7246
7301
  display: "swap",
7247
- unicodeRange: E
7302
+ unicodeRange: O
7248
7303
  }
7249
7304
  },
7250
7305
  {
@@ -7254,7 +7309,7 @@ const E = [
7254
7309
  style: "normal",
7255
7310
  weight: "300",
7256
7311
  display: "swap",
7257
- unicodeRange: O
7312
+ unicodeRange: L
7258
7313
  }
7259
7314
  },
7260
7315
  {
@@ -7264,7 +7319,7 @@ const E = [
7264
7319
  style: "normal",
7265
7320
  weight: "300",
7266
7321
  display: "swap",
7267
- unicodeRange: E
7322
+ unicodeRange: O
7268
7323
  }
7269
7324
  },
7270
7325
  {
@@ -7274,7 +7329,7 @@ const E = [
7274
7329
  style: "normal",
7275
7330
  weight: "400",
7276
7331
  display: "swap",
7277
- unicodeRange: O
7332
+ unicodeRange: L
7278
7333
  }
7279
7334
  },
7280
7335
  {
@@ -7284,7 +7339,7 @@ const E = [
7284
7339
  style: "normal",
7285
7340
  weight: "400",
7286
7341
  display: "swap",
7287
- unicodeRange: E
7342
+ unicodeRange: O
7288
7343
  }
7289
7344
  },
7290
7345
  {
@@ -7294,7 +7349,7 @@ const E = [
7294
7349
  style: "normal",
7295
7350
  weight: "500",
7296
7351
  display: "swap",
7297
- unicodeRange: O
7352
+ unicodeRange: L
7298
7353
  }
7299
7354
  },
7300
7355
  {
@@ -7304,7 +7359,7 @@ const E = [
7304
7359
  style: "normal",
7305
7360
  weight: "500",
7306
7361
  display: "swap",
7307
- unicodeRange: E
7362
+ unicodeRange: O
7308
7363
  }
7309
7364
  },
7310
7365
  {
@@ -7314,7 +7369,7 @@ const E = [
7314
7369
  style: "normal",
7315
7370
  weight: "600",
7316
7371
  display: "swap",
7317
- unicodeRange: O
7372
+ unicodeRange: L
7318
7373
  }
7319
7374
  },
7320
7375
  {
@@ -7324,7 +7379,7 @@ const E = [
7324
7379
  style: "normal",
7325
7380
  weight: "600",
7326
7381
  display: "swap",
7327
- unicodeRange: E
7382
+ unicodeRange: O
7328
7383
  }
7329
7384
  },
7330
7385
  {
@@ -7334,7 +7389,7 @@ const E = [
7334
7389
  style: "normal",
7335
7390
  weight: "700",
7336
7391
  display: "swap",
7337
- unicodeRange: O
7392
+ unicodeRange: L
7338
7393
  }
7339
7394
  },
7340
7395
  {
@@ -7344,7 +7399,7 @@ const E = [
7344
7399
  style: "normal",
7345
7400
  weight: "700",
7346
7401
  display: "swap",
7347
- unicodeRange: E
7402
+ unicodeRange: O
7348
7403
  }
7349
7404
  },
7350
7405
  {
@@ -7354,7 +7409,7 @@ const E = [
7354
7409
  style: "normal",
7355
7410
  weight: "800",
7356
7411
  display: "swap",
7357
- unicodeRange: O
7412
+ unicodeRange: L
7358
7413
  }
7359
7414
  },
7360
7415
  {
@@ -7364,7 +7419,7 @@ const E = [
7364
7419
  style: "normal",
7365
7420
  weight: "800",
7366
7421
  display: "swap",
7367
- unicodeRange: E
7422
+ unicodeRange: O
7368
7423
  }
7369
7424
  },
7370
7425
  {
@@ -7374,7 +7429,7 @@ const E = [
7374
7429
  style: "normal",
7375
7430
  weight: "900",
7376
7431
  display: "swap",
7377
- unicodeRange: O
7432
+ unicodeRange: L
7378
7433
  }
7379
7434
  },
7380
7435
  {
@@ -7384,7 +7439,7 @@ const E = [
7384
7439
  style: "normal",
7385
7440
  weight: "900",
7386
7441
  display: "swap",
7387
- unicodeRange: E
7442
+ unicodeRange: O
7388
7443
  }
7389
7444
  },
7390
7445
  {
@@ -7394,7 +7449,7 @@ const E = [
7394
7449
  style: "normal",
7395
7450
  weight: "400",
7396
7451
  display: "swap",
7397
- unicodeRange: O
7452
+ unicodeRange: L
7398
7453
  }
7399
7454
  },
7400
7455
  {
@@ -7404,7 +7459,7 @@ const E = [
7404
7459
  style: "normal",
7405
7460
  weight: "400",
7406
7461
  display: "swap",
7407
- unicodeRange: E
7462
+ unicodeRange: O
7408
7463
  }
7409
7464
  },
7410
7465
  {
@@ -7414,7 +7469,7 @@ const E = [
7414
7469
  style: "normal",
7415
7470
  weight: "700",
7416
7471
  display: "swap",
7417
- unicodeRange: O
7472
+ unicodeRange: L
7418
7473
  }
7419
7474
  },
7420
7475
  {
@@ -7424,7 +7479,7 @@ const E = [
7424
7479
  style: "normal",
7425
7480
  weight: "700",
7426
7481
  display: "swap",
7427
- unicodeRange: E
7482
+ unicodeRange: O
7428
7483
  }
7429
7484
  },
7430
7485
  {
@@ -7434,7 +7489,7 @@ const E = [
7434
7489
  style: "normal",
7435
7490
  weight: "100 900",
7436
7491
  display: "swap",
7437
- unicodeRange: O
7492
+ unicodeRange: L
7438
7493
  }
7439
7494
  },
7440
7495
  {
@@ -7444,7 +7499,7 @@ const E = [
7444
7499
  style: "normal",
7445
7500
  weight: "100 900",
7446
7501
  display: "swap",
7447
- unicodeRange: E
7502
+ unicodeRange: O
7448
7503
  }
7449
7504
  },
7450
7505
  {
@@ -7454,7 +7509,7 @@ const E = [
7454
7509
  style: "normal",
7455
7510
  weight: "300 700",
7456
7511
  display: "swap",
7457
- unicodeRange: O
7512
+ unicodeRange: L
7458
7513
  }
7459
7514
  },
7460
7515
  {
@@ -7464,7 +7519,7 @@ const E = [
7464
7519
  style: "normal",
7465
7520
  weight: "300 700",
7466
7521
  display: "swap",
7467
- unicodeRange: E
7522
+ unicodeRange: O
7468
7523
  }
7469
7524
  },
7470
7525
  {
@@ -7474,7 +7529,7 @@ const E = [
7474
7529
  style: "normal",
7475
7530
  weight: "400",
7476
7531
  display: "swap",
7477
- unicodeRange: O
7532
+ unicodeRange: L
7478
7533
  }
7479
7534
  },
7480
7535
  {
@@ -7484,7 +7539,7 @@ const E = [
7484
7539
  style: "normal",
7485
7540
  weight: "400",
7486
7541
  display: "swap",
7487
- unicodeRange: E
7542
+ unicodeRange: O
7488
7543
  }
7489
7544
  },
7490
7545
  {
@@ -7494,7 +7549,7 @@ const E = [
7494
7549
  style: "normal",
7495
7550
  weight: "200 800",
7496
7551
  display: "swap",
7497
- unicodeRange: O
7552
+ unicodeRange: L
7498
7553
  }
7499
7554
  },
7500
7555
  {
@@ -7504,7 +7559,7 @@ const E = [
7504
7559
  style: "normal",
7505
7560
  weight: "200 800",
7506
7561
  display: "swap",
7507
- unicodeRange: E
7562
+ unicodeRange: O
7508
7563
  }
7509
7564
  },
7510
7565
  {
@@ -7514,7 +7569,7 @@ const E = [
7514
7569
  style: "normal",
7515
7570
  weight: "100 900",
7516
7571
  display: "swap",
7517
- unicodeRange: O
7572
+ unicodeRange: L
7518
7573
  }
7519
7574
  },
7520
7575
  {
@@ -7524,7 +7579,7 @@ const E = [
7524
7579
  style: "normal",
7525
7580
  weight: "100 900",
7526
7581
  display: "swap",
7527
- unicodeRange: E
7582
+ unicodeRange: O
7528
7583
  }
7529
7584
  },
7530
7585
  {
@@ -7534,7 +7589,7 @@ const E = [
7534
7589
  style: "normal",
7535
7590
  weight: "400",
7536
7591
  display: "swap",
7537
- unicodeRange: O
7592
+ unicodeRange: L
7538
7593
  }
7539
7594
  },
7540
7595
  {
@@ -7544,7 +7599,7 @@ const E = [
7544
7599
  style: "normal",
7545
7600
  weight: "400",
7546
7601
  display: "swap",
7547
- unicodeRange: E
7602
+ unicodeRange: O
7548
7603
  }
7549
7604
  },
7550
7605
  {
@@ -7554,7 +7609,7 @@ const E = [
7554
7609
  style: "normal",
7555
7610
  weight: "100 900",
7556
7611
  display: "swap",
7557
- unicodeRange: O
7612
+ unicodeRange: L
7558
7613
  }
7559
7614
  },
7560
7615
  {
@@ -7564,7 +7619,7 @@ const E = [
7564
7619
  style: "normal",
7565
7620
  weight: "100 900",
7566
7621
  display: "swap",
7567
- unicodeRange: E
7622
+ unicodeRange: O
7568
7623
  }
7569
7624
  },
7570
7625
  {
@@ -7574,7 +7629,7 @@ const E = [
7574
7629
  style: "normal",
7575
7630
  weight: "300 800",
7576
7631
  display: "swap",
7577
- unicodeRange: O
7632
+ unicodeRange: L
7578
7633
  }
7579
7634
  },
7580
7635
  {
@@ -7584,7 +7639,7 @@ const E = [
7584
7639
  style: "normal",
7585
7640
  weight: "300 800",
7586
7641
  display: "swap",
7587
- unicodeRange: E
7642
+ unicodeRange: O
7588
7643
  }
7589
7644
  },
7590
7645
  {
@@ -7594,7 +7649,7 @@ const E = [
7594
7649
  style: "normal",
7595
7650
  weight: "400",
7596
7651
  display: "swap",
7597
- unicodeRange: O
7652
+ unicodeRange: L
7598
7653
  }
7599
7654
  },
7600
7655
  {
@@ -7604,7 +7659,7 @@ const E = [
7604
7659
  style: "normal",
7605
7660
  weight: "400",
7606
7661
  display: "swap",
7607
- unicodeRange: E
7662
+ unicodeRange: O
7608
7663
  }
7609
7664
  },
7610
7665
  {
@@ -7614,7 +7669,7 @@ const E = [
7614
7669
  style: "normal",
7615
7670
  weight: "700",
7616
7671
  display: "swap",
7617
- unicodeRange: O
7672
+ unicodeRange: L
7618
7673
  }
7619
7674
  },
7620
7675
  {
@@ -7624,7 +7679,7 @@ const E = [
7624
7679
  style: "normal",
7625
7680
  weight: "700",
7626
7681
  display: "swap",
7627
- unicodeRange: E
7682
+ unicodeRange: O
7628
7683
  }
7629
7684
  },
7630
7685
  {
@@ -7634,7 +7689,7 @@ const E = [
7634
7689
  style: "normal",
7635
7690
  weight: "300 900",
7636
7691
  display: "swap",
7637
- unicodeRange: O
7692
+ unicodeRange: L
7638
7693
  }
7639
7694
  },
7640
7695
  {
@@ -7644,7 +7699,7 @@ const E = [
7644
7699
  style: "normal",
7645
7700
  weight: "300 900",
7646
7701
  display: "swap",
7647
- unicodeRange: E
7702
+ unicodeRange: O
7648
7703
  }
7649
7704
  },
7650
7705
  {
@@ -7654,7 +7709,7 @@ const E = [
7654
7709
  style: "normal",
7655
7710
  weight: "400",
7656
7711
  display: "swap",
7657
- unicodeRange: O
7712
+ unicodeRange: L
7658
7713
  }
7659
7714
  },
7660
7715
  {
@@ -7664,7 +7719,7 @@ const E = [
7664
7719
  style: "normal",
7665
7720
  weight: "400",
7666
7721
  display: "swap",
7667
- unicodeRange: E
7722
+ unicodeRange: O
7668
7723
  }
7669
7724
  },
7670
7725
  {
@@ -7674,7 +7729,7 @@ const E = [
7674
7729
  style: "normal",
7675
7730
  weight: "100 900",
7676
7731
  display: "swap",
7677
- unicodeRange: O
7732
+ unicodeRange: L
7678
7733
  }
7679
7734
  },
7680
7735
  {
@@ -7684,7 +7739,7 @@ const E = [
7684
7739
  style: "normal",
7685
7740
  weight: "100 900",
7686
7741
  display: "swap",
7687
- unicodeRange: E
7742
+ unicodeRange: O
7688
7743
  }
7689
7744
  },
7690
7745
  {
@@ -7694,7 +7749,7 @@ const E = [
7694
7749
  style: "normal",
7695
7750
  weight: "100 900",
7696
7751
  display: "swap",
7697
- unicodeRange: O
7752
+ unicodeRange: L
7698
7753
  }
7699
7754
  },
7700
7755
  {
@@ -7704,7 +7759,7 @@ const E = [
7704
7759
  style: "normal",
7705
7760
  weight: "100 900",
7706
7761
  display: "swap",
7707
- unicodeRange: E
7762
+ unicodeRange: O
7708
7763
  }
7709
7764
  }
7710
7765
  ], Co = {
@@ -7802,13 +7857,13 @@ const E = [
7802
7857
  fonts: Io
7803
7858
  };
7804
7859
  function Do(h, t = {}) {
7805
- const e = _(_({}, Co), t), s = document.getElementById(h);
7860
+ const e = B(B({}, Co), t), s = document.getElementById(h);
7806
7861
  if (!s)
7807
7862
  return Promise.reject(new Error(`Контейнер с ID "${h}" не найден.`));
7808
7863
  const o = document.createElement("canvas");
7809
7864
  return o.id = `${h}-canvas`, s.appendChild(o), e.editorContainer = s, new Promise((n) => {
7810
7865
  e._onReadyCallback = n;
7811
- const i = new Se(o.id, e);
7866
+ const i = new we(o.id, e);
7812
7867
  window[h] = i;
7813
7868
  });
7814
7869
  }