@anu3ev/fabric-image-editor 0.5.23 → 0.5.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +235 -185
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -434,7 +434,7 @@ function js(h) {
434
434
  }
435
435
  );
436
436
  }
437
- class Is {
437
+ class Cs {
438
438
  /**
439
439
  * @param scriptUrl — URL скрипта воркера.
440
440
  * По-умолчанию использует DefaultWorker из соседнего файла
@@ -480,18 +480,18 @@ class Is {
480
480
  this.worker.terminate();
481
481
  }
482
482
  }
483
- const ht = 12, Cs = 2, ve = 8, be = 20, Ts = 100, Me = 20, we = 8, Es = 100, de = 32, Ie = 1, Os = "#2B2D33", Ce = "#3D8BF4", Te = "#FFFFFF";
483
+ const ht = 12, Is = 2, ve = 8, be = 20, Ts = 100, Me = 20, we = 8, Es = 100, de = 32, Ce = 1, Os = "#2B2D33", Ie = "#3D8BF4", Te = "#FFFFFF";
484
484
  function oe(h, t, e, s, n) {
485
- const o = ht, i = Cs;
486
- h.save(), h.translate(t, e), h.rotate(ft.degreesToRadians(n.angle)), h.fillStyle = Te, h.strokeStyle = Ce, h.lineWidth = Ie, h.beginPath(), h.roundRect(-o / 2, -o / 2, o, o, i), h.fill(), h.stroke(), h.restore();
485
+ const o = ht, i = Is;
486
+ h.save(), h.translate(t, e), h.rotate(ft.degreesToRadians(n.angle)), h.fillStyle = Te, h.strokeStyle = Ie, h.lineWidth = Ce, h.beginPath(), h.roundRect(-o / 2, -o / 2, o, o, i), h.fill(), h.stroke(), h.restore();
487
487
  }
488
488
  function Ue(h, t, e, s, n) {
489
489
  const o = ve, i = be, a = Ts;
490
- h.save(), h.translate(t, e), h.rotate(ft.degreesToRadians(n.angle)), h.fillStyle = Te, h.strokeStyle = Ce, h.lineWidth = Ie, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
490
+ h.save(), h.translate(t, e), h.rotate(ft.degreesToRadians(n.angle)), h.fillStyle = Te, h.strokeStyle = Ie, h.lineWidth = Ce, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
491
491
  }
492
492
  function Fe(h, t, e, s, n) {
493
493
  const o = Me, i = we, a = Es;
494
- h.save(), h.translate(t, e), h.rotate(ft.degreesToRadians(n.angle)), h.fillStyle = Te, h.strokeStyle = Ce, h.lineWidth = Ie, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
494
+ h.save(), h.translate(t, e), h.rotate(ft.degreesToRadians(n.angle)), h.fillStyle = Te, h.strokeStyle = Ie, h.lineWidth = Ce, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
495
495
  }
496
496
  const Ls = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", ss = new Image();
497
497
  ss.src = Ls;
@@ -1246,7 +1246,7 @@ const ns = [
1246
1246
  "radiusBottomRight",
1247
1247
  "radiusBottomLeft"
1248
1248
  ];
1249
- class G {
1249
+ class Z {
1250
1250
  constructor({ editor: t }) {
1251
1251
  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();
1252
1252
  }
@@ -1321,7 +1321,7 @@ class G {
1321
1321
  const {
1322
1322
  prevState: s,
1323
1323
  nextState: n
1324
- } = G._prepareStatesForDiff({
1324
+ } = Z._prepareStatesForDiff({
1325
1325
  prevState: e,
1326
1326
  nextState: t
1327
1327
  }), o = this.diffPatcher.diff(s, n);
@@ -1329,6 +1329,13 @@ class G {
1329
1329
  console.log("Нет изменений для сохранения.");
1330
1330
  return;
1331
1331
  }
1332
+ if (Z._areStatesEqual({
1333
+ prevState: s,
1334
+ nextState: n
1335
+ })) {
1336
+ console.log("statesEqual. Нет изменений для сохранения.");
1337
+ return;
1338
+ }
1332
1339
  console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", o), this.totalChangesCount += 1, this.patches.push({ id: X(), diff: o }), 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);
1333
1340
  } finally {
1334
1341
  this._isSavingState = !1;
@@ -1343,11 +1350,11 @@ class G {
1343
1350
  prevState: t,
1344
1351
  nextState: e
1345
1352
  }) {
1346
- const s = G._cloneState({ state: t }), n = G._cloneState({ state: e });
1347
- return G._normalizeTextBackground({ objects: s.objects }), G._normalizeTextBackground({ objects: n.objects }), G._normalizeCanvasSize({
1353
+ const s = Z._cloneState({ state: t }), n = Z._cloneState({ state: e });
1354
+ return Z._normalizeTextBackground({ objects: s.objects }), Z._normalizeTextBackground({ objects: n.objects }), Z._normalizeCanvasSize({
1348
1355
  prevState: s,
1349
1356
  nextState: n
1350
- }), G._normalizeTranslation({
1357
+ }), Z._normalizeTranslation({
1351
1358
  prevState: s,
1352
1359
  nextState: n
1353
1360
  }), {
@@ -1362,14 +1369,57 @@ class G {
1362
1369
  static _cloneState({ state: t }) {
1363
1370
  return JSON.parse(JSON.stringify(t));
1364
1371
  }
1372
+ /**
1373
+ * Проверяет, равны ли два состояния после нормализации с учётом устойчивого порядка ключей.
1374
+ * @param prevState - предыдущее состояние
1375
+ * @param nextState - следующее состояние
1376
+ */
1377
+ static _areStatesEqual({
1378
+ prevState: t,
1379
+ nextState: e
1380
+ }) {
1381
+ const s = Z._stableStringify({ value: t }), n = Z._stableStringify({ value: e });
1382
+ return s === n;
1383
+ }
1384
+ /**
1385
+ * Делает устойчивую сериализацию значения с сортировкой ключей объектов.
1386
+ * @param value - значение для сериализации
1387
+ */
1388
+ static _stableStringify({ value: t }) {
1389
+ const e = ({ value: s }) => {
1390
+ if (Array.isArray(s)) {
1391
+ const n = [];
1392
+ for (let o = 0; o < s.length; o += 1)
1393
+ n.push(e({ value: s[o] }));
1394
+ return n;
1395
+ }
1396
+ if (s && typeof s == "object") {
1397
+ const n = {}, o = Object.keys(s).sort();
1398
+ for (let i = 0; i < o.length; i += 1) {
1399
+ const a = o[i];
1400
+ n[a] = e({
1401
+ value: s[a]
1402
+ });
1403
+ }
1404
+ return n;
1405
+ }
1406
+ return s;
1407
+ };
1408
+ return JSON.stringify(e({ value: t }));
1409
+ }
1365
1410
  /**
1366
1411
  * Нормализует backgroundColor у текстовых объектов без фона, чтобы избежать шумовых диффов.
1367
1412
  * @param objects - список объектов канваса
1368
1413
  */
1369
1414
  static _normalizeTextBackground({ objects: t }) {
1370
1415
  for (let e = 0; e < t.length; e += 1) {
1371
- const s = t[e], { type: n } = s, o = s.backgroundOpacity, i = typeof o == "number" ? o : 0;
1372
- (n === "textbox" || n === "i-text" || n === "text") && (i > 0 || (s.backgroundColor = null));
1416
+ const s = t[e], {
1417
+ type: n,
1418
+ backgroundOpacity: o,
1419
+ backgroundColor: i,
1420
+ textBackgroundColor: a
1421
+ } = s, r = typeof o == "number" ? o : 0, c = typeof i == "string" ? i : "", d = typeof a == "string" ? a : "", l = n === "textbox" || n === "i-text" || n === "text" || n === "background-textbox", u = c.length > 0 || d.length > 0;
1422
+ l && (r > 0 && u || (s.backgroundColor = null, s.textBackgroundColor = null));
1373
1423
  }
1374
1424
  }
1375
1425
  /**
@@ -1383,10 +1433,10 @@ class G {
1383
1433
  const { width: s, height: n, objects: o } = t, { objects: i } = e, {
1384
1434
  width: a,
1385
1435
  height: r
1386
- } = G._getMontageAreaSize({ objects: o }), {
1436
+ } = Z._getMontageAreaSize({ objects: o }), {
1387
1437
  width: c,
1388
1438
  height: d
1389
- } = G._getMontageAreaSize({ objects: i });
1439
+ } = Z._getMontageAreaSize({ objects: i });
1390
1440
  a !== c || r !== d || (e.width = s, e.height = n);
1391
1441
  }
1392
1442
  /**
@@ -1399,22 +1449,22 @@ class G {
1399
1449
  const { objects: s, clipPath: n } = t, { objects: o, clipPath: i } = e, {
1400
1450
  left: a,
1401
1451
  top: r
1402
- } = G._getMontageAreaPosition({ objects: s }), {
1452
+ } = Z._getMontageAreaPosition({ objects: s }), {
1403
1453
  left: c,
1404
1454
  top: d
1405
- } = G._getMontageAreaPosition({ objects: o }), l = c - a, u = d - r;
1455
+ } = Z._getMontageAreaPosition({ objects: o }), l = c - a, u = d - r;
1406
1456
  if (l === 0 && u === 0) return;
1407
- const f = G._getObjectById({
1457
+ const f = Z._getObjectById({
1408
1458
  objects: o,
1409
1459
  id: "montage-area"
1410
1460
  });
1411
1461
  f && (f.left = a, f.top = r);
1412
- const g = G._getClipPathPosition({ clipPath: n });
1462
+ const g = Z._getClipPathPosition({ clipPath: n });
1413
1463
  if (g && i && typeof i == "object") {
1414
1464
  const { left: m, top: v } = g, w = i;
1415
1465
  w.left = m, w.top = v;
1416
1466
  }
1417
- const p = G._getTranslationIgnoredIds();
1467
+ const p = Z._getTranslationIgnoredIds();
1418
1468
  for (let m = 0; m < o.length; m += 1) {
1419
1469
  const v = o[m], { id: w } = v;
1420
1470
  w && p.has(w) || (typeof v.left == "number" && (v.left -= l), typeof v.top == "number" && (v.top -= u));
@@ -1436,7 +1486,7 @@ class G {
1436
1486
  static _getMontageAreaPosition({
1437
1487
  objects: t
1438
1488
  }) {
1439
- const e = G._getObjectById({
1489
+ const e = Z._getObjectById({
1440
1490
  objects: t,
1441
1491
  id: "montage-area"
1442
1492
  });
@@ -1451,7 +1501,7 @@ class G {
1451
1501
  static _getMontageAreaSize({
1452
1502
  objects: t
1453
1503
  }) {
1454
- const e = G._getObjectById({
1504
+ const e = Z._getObjectById({
1455
1505
  objects: t,
1456
1506
  id: "montage-area"
1457
1507
  });
@@ -1520,7 +1570,7 @@ class G {
1520
1570
  for (let c = 0; c < i.length; c += 1) {
1521
1571
  const d = i[c], { id: l } = d;
1522
1572
  let u;
1523
- typeof l == "string" && (u = n.get(l)), u || (u = o.get(c)), u && (d.customData = G._cloneCustomData({ customData: u }));
1573
+ typeof l == "string" && (u = n.get(l)), u || (u = o.get(c)), u && (d.customData = Z._cloneCustomData({ customData: u }));
1524
1574
  }
1525
1575
  }
1526
1576
  /**
@@ -1541,8 +1591,8 @@ class G {
1541
1591
  console.log("loadStateFromFullState fullState", t);
1542
1592
  const { canvas: e, canvasManager: s, interactionBlocker: n, backgroundManager: o } = this.editor, { width: i, height: a } = e;
1543
1593
  n.overlayMask = null;
1544
- const r = G._createLoadSafeState({ state: t });
1545
- yield e.loadFromJSON(r), G._applyCustomDataFromState({ state: t, canvas: e });
1594
+ const r = Z._createLoadSafeState({ state: t });
1595
+ yield e.loadFromJSON(r), Z._applyCustomDataFromState({ state: t, canvas: e });
1546
1596
  const c = e.getObjects().find((u) => u.id === "montage-area");
1547
1597
  c && (this.editor.montageArea = c, (i !== e.getWidth() || a !== e.getHeight()) && s.updateCanvas());
1548
1598
  const d = e.getObjects().find((u) => u.id === "overlay-mask");
@@ -1637,7 +1687,7 @@ class G {
1637
1687
  const e = [];
1638
1688
  ((i = (o = (n = this.canvas).getObjects) == null ? void 0 : o.call(n)) != null ? i : []).forEach((a) => {
1639
1689
  const r = typeof a.type == "string" ? a.type.toLowerCase() : "";
1640
- if (!(r === "textbox" || r === "i-text" || typeof a.isEditing == "boolean") || a.locked) return;
1690
+ if (!(r === "textbox" || r === "i-text" || typeof a.isEditing == "boolean" || r === "background-textbox") || a.locked) return;
1641
1691
  const d = !!a.lockMovementX, l = !!a.lockMovementY;
1642
1692
  !d && !l || (e.push({
1643
1693
  object: a,
@@ -1655,7 +1705,7 @@ class G {
1655
1705
  }
1656
1706
  }
1657
1707
  }
1658
- const Hs = 0.1, Zs = 2, Ze = 0.1, Gs = 90, _t = 16, xt = 16, jt = 4096, It = 4096, Ge = "application/image-editor:", ie = [
1708
+ const Hs = 0.1, Zs = 2, Ze = 0.1, Gs = 90, _t = 16, xt = 16, jt = 4096, Ct = 4096, Ge = "application/image-editor:", ie = [
1659
1709
  "format",
1660
1710
  "uppercase",
1661
1711
  "textCaseRaw",
@@ -1757,12 +1807,12 @@ class ut {
1757
1807
  if (y instanceof Gt) {
1758
1808
  const S = y.getElement();
1759
1809
  let T = "";
1760
- if (S instanceof HTMLImageElement ? T = S.src : S instanceof HTMLCanvasElement && (T = S.toDataURL()), j > It || b > jt) {
1761
- const M = yield this.resizeImageToBoundaries(T, "max"), C = URL.createObjectURL(M);
1762
- this._createdBlobUrls.push(C), y = yield Gt.fromURL(C, { crossOrigin: "anonymous" });
1810
+ if (S instanceof HTMLImageElement ? T = S.src : S instanceof HTMLCanvasElement && (T = S.toDataURL()), j > Ct || b > jt) {
1811
+ const M = yield this.resizeImageToBoundaries(T, "max"), I = URL.createObjectURL(M);
1812
+ this._createdBlobUrls.push(I), y = yield Gt.fromURL(I, { crossOrigin: "anonymous" });
1763
1813
  } else if (j < xt || b < _t) {
1764
- const M = yield this.resizeImageToBoundaries(T, "min"), C = URL.createObjectURL(M);
1765
- this._createdBlobUrls.push(C), y = yield Gt.fromURL(C, { crossOrigin: "anonymous" });
1814
+ const M = yield this.resizeImageToBoundaries(T, "min"), I = URL.createObjectURL(M);
1815
+ this._createdBlobUrls.push(I), y = yield Gt.fromURL(I, { crossOrigin: "anonymous" });
1766
1816
  }
1767
1817
  }
1768
1818
  if (y.set("id", `${y.type}-${X()}`), y.set("format", m), y.set("customData", c || null), s === "scale-montage")
@@ -1771,7 +1821,7 @@ class ut {
1771
1821
  const { width: S, height: T } = l, M = this.calculateScaleFactor({ imageObject: y, scaleType: s });
1772
1822
  s === "image-contain" && M < 1 ? u.fitObject({ object: y, type: "contain", withoutSave: !0 }) : s === "image-cover" && (b > S || j > T) && u.fitObject({ object: y, type: "cover", withoutSave: !0 });
1773
1823
  }
1774
- const I = {
1824
+ const C = {
1775
1825
  image: y,
1776
1826
  format: m,
1777
1827
  contentType: p,
@@ -1784,7 +1834,7 @@ class ut {
1784
1834
  withoutAdding: r,
1785
1835
  customData: c
1786
1836
  };
1787
- return r ? (f.resumeHistory(), d.fire("editor:image-imported", I), I) : (d.add(y), d.centerObject(y), a || d.setActiveObject(y), d.renderAll(), f.resumeHistory(), n || f.saveState(), d.fire("editor:image-imported", I), I);
1837
+ return r ? (f.resumeHistory(), d.fire("editor:image-imported", C), C) : (d.add(y), d.centerObject(y), a || d.setActiveObject(y), d.renderAll(), f.resumeHistory(), n || f.saveState(), d.fire("editor:image-imported", C), C);
1788
1838
  } catch (A) {
1789
1839
  return g.emitError({
1790
1840
  origin: "ImageManager",
@@ -1817,13 +1867,13 @@ class ut {
1817
1867
  */
1818
1868
  resizeImageToBoundaries(t, e = "max") {
1819
1869
  return P(this, null, function* () {
1820
- let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${jt}x${It}`;
1870
+ let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${jt}x${Ct}`;
1821
1871
  e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${_t}x${xt}`);
1822
1872
  const n = {
1823
1873
  dataURL: t,
1824
1874
  sizeType: e,
1825
1875
  maxWidth: jt,
1826
- maxHeight: It,
1876
+ maxHeight: Ct,
1827
1877
  minWidth: _t,
1828
1878
  minHeight: xt
1829
1879
  };
@@ -1862,7 +1912,7 @@ class ut {
1862
1912
  v.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(l) && (v.backgroundColor = "#ffffff");
1863
1913
  const w = v.getObjects().find((M) => M.id === a.id);
1864
1914
  if (w && (w.visible = !1), c != null && c.isBlocked) {
1865
- const M = v.getObjects().find((C) => C.id === c.overlayMask.id);
1915
+ const M = v.getObjects().find((I) => I.id === c.overlayMask.id);
1866
1916
  M && (M.visible = !1);
1867
1917
  }
1868
1918
  v.viewportTransform = [1, 0, 0, 1, -f, -g], v.setDimensions({ width: p, height: m }, { backstoreOnly: !0 }), v.renderAll();
@@ -1882,9 +1932,9 @@ class ut {
1882
1932
  };
1883
1933
  return i.fire("editor:canvas-exported", E), E;
1884
1934
  }
1885
- const y = yield new Promise((M, C) => {
1935
+ const y = yield new Promise((M, I) => {
1886
1936
  v.getElement().toBlob((E) => {
1887
- E ? M(E) : C(new Error("Failed to create Blob from canvas"));
1937
+ E ? M(E) : I(new Error("Failed to create Blob from canvas"));
1888
1938
  });
1889
1939
  });
1890
1940
  if (v.dispose(), o) {
@@ -1902,12 +1952,12 @@ class ut {
1902
1952
  [b]
1903
1953
  );
1904
1954
  if (d) {
1905
- const C = p * 0.264583, E = m * 0.264583, z = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, x = new z({
1906
- orientation: C > E ? "landscape" : "portrait",
1955
+ const I = p * 0.264583, E = m * 0.264583, z = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, x = new z({
1956
+ orientation: I > E ? "landscape" : "portrait",
1907
1957
  unit: "mm",
1908
- format: [C, E]
1958
+ format: [I, E]
1909
1959
  });
1910
- if (x.addImage(String(j), "JPG", 0, 0, C, E), n) {
1960
+ if (x.addImage(String(j), "JPG", 0, 0, I, E), n) {
1911
1961
  const H = {
1912
1962
  image: x.output("datauristring"),
1913
1963
  format: "pdf",
@@ -1933,11 +1983,11 @@ class ut {
1933
1983
  };
1934
1984
  return i.fire("editor:canvas-exported", M), M;
1935
1985
  }
1936
- const I = u === "svg" && !A ? e.replace(/\.[^/.]+$/, ".png") : e, T = {
1937
- image: new File([y], I, { type: l }),
1986
+ const C = u === "svg" && !A ? e.replace(/\.[^/.]+$/, ".png") : e, T = {
1987
+ image: new File([y], C, { type: l }),
1938
1988
  format: u,
1939
1989
  contentType: l,
1940
- fileName: I
1990
+ fileName: C
1941
1991
  };
1942
1992
  return i.fire("editor:canvas-exported", T), T;
1943
1993
  } catch (d) {
@@ -2170,7 +2220,7 @@ const mt = (h, t, e) => Math.max(Math.min(h, e), t), Ve = (h, t) => h * t, Xs =
2170
2220
  function Ks(h) {
2171
2221
  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";
2172
2222
  }
2173
- class Qs {
2223
+ class qs {
2174
2224
  /**
2175
2225
  * @param options
2176
2226
  * @param options.editor – экземпляр редактора
@@ -2247,7 +2297,7 @@ class Qs {
2247
2297
  canvas: o,
2248
2298
  montageArea: i,
2249
2299
  options: { canvasBackstoreHeight: a }
2250
- } = this.editor, { width: r, height: c } = i, d = mt(Number(t), xt, It);
2300
+ } = this.editor, { width: r, height: c } = i, d = mt(Number(t), xt, Ct);
2251
2301
  if (!a || a === "auto" || n ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(d), i.set({ height: d }), (g = o.clipPath) == null || g.set({ height: d }), e) {
2252
2302
  const p = d / c, m = Ve(r, p);
2253
2303
  this.setResolutionWidth(m);
@@ -2309,7 +2359,7 @@ class Qs {
2309
2359
  */
2310
2360
  setCanvasBackstoreHeight(t) {
2311
2361
  if (!t || typeof t != "number") return;
2312
- const e = mt(t, xt, It);
2362
+ const e = mt(t, xt, Ct);
2313
2363
  this.editor.canvas.setDimensions({ height: e }, { backstoreOnly: !0 });
2314
2364
  }
2315
2365
  /**
@@ -2318,7 +2368,7 @@ class Qs {
2318
2368
  * с учётом минимальных и максимальных значений.
2319
2369
  */
2320
2370
  adaptCanvasToContainer() {
2321
- const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, n = e.clientHeight, o = mt(s, _t, jt), i = mt(n, xt, It);
2371
+ const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, n = e.clientHeight, o = mt(s, _t, jt), i = mt(n, xt, Ct);
2322
2372
  t.setDimensions({ width: o, height: i }, { backstoreOnly: !0 });
2323
2373
  }
2324
2374
  /**
@@ -2520,7 +2570,7 @@ class Qs {
2520
2570
  } = this.editor, c = t || n.getActiveObject();
2521
2571
  if (!Ks(c)) return;
2522
2572
  const { width: d, height: l } = c;
2523
- let u = Math.min(d, jt), f = Math.min(l, It);
2573
+ let u = Math.min(d, jt), f = Math.min(l, Ct);
2524
2574
  if (e) {
2525
2575
  const {
2526
2576
  width: g,
@@ -2744,7 +2794,7 @@ class Js {
2744
2794
  });
2745
2795
  }
2746
2796
  }
2747
- class qs {
2797
+ class Qs {
2748
2798
  constructor({ editor: t }) {
2749
2799
  this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || Hs, this.maxZoom = this.options.maxZoom || Zs, this.defaultZoom = this._normalizeDefaultZoom(this.options.defaultScale);
2750
2800
  }
@@ -2814,8 +2864,8 @@ class qs {
2814
2864
  _calculateEmptySpaceRatio(t) {
2815
2865
  const { canvas: e, montageArea: s } = this.editor, n = e.viewportTransform, o = 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 = -n[4] / t, u = (-n[4] + o) / t, f = -n[5] / t, g = (-n[5] + i) / t, p = l < a, m = u > r, v = f < c, w = g > d;
2816
2866
  if (!(p || m || v || w)) return 0;
2817
- const y = Math.max(0, a - l), b = Math.max(0, u - r), j = Math.max(0, c - f), I = Math.max(0, g - d), S = Math.max(y, b), T = Math.max(j, I), M = S / o, C = T / i;
2818
- return Math.max(M, C);
2867
+ const y = Math.max(0, a - l), b = Math.max(0, u - r), j = Math.max(0, c - f), C = Math.max(0, g - d), S = Math.max(y, b), T = Math.max(j, C), M = S / o, I = T / i;
2868
+ return Math.max(M, I);
2819
2869
  }
2820
2870
  /**
2821
2871
  * Вычисляет плавный шаг перемещения viewport к центру с ускорением
@@ -2831,7 +2881,7 @@ class qs {
2831
2881
  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], f = Math.abs(n), g = e - s;
2832
2882
  if (Math.abs(g) / f <= 0.1)
2833
2883
  return { x: l, y: u };
2834
- const m = c / 2, v = d / 2, w = a.left, A = a.top, y = m - w * s, b = v - A * s, j = (y - r[4]) / (e - s), I = (b - r[5]) / (e - s), S = j * f, T = I * f, M = S * o, C = T * o, E = Math.abs(M) > Math.abs(l) ? l : M, z = Math.abs(C) > Math.abs(u) ? u : C;
2884
+ const m = c / 2, v = d / 2, w = a.left, A = a.top, y = m - w * s, b = v - A * s, j = (y - r[4]) / (e - s), C = (b - r[5]) / (e - s), S = j * f, T = C * f, M = S * o, I = T * o, E = Math.abs(M) > Math.abs(l) ? l : M, z = Math.abs(I) > Math.abs(u) ? u : I;
2835
2885
  return { x: E, y: z };
2836
2886
  }
2837
2887
  /**
@@ -4249,7 +4299,7 @@ const At = {
4249
4299
  APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
4250
4300
  }
4251
4301
  };
4252
- class Qt {
4302
+ class qt {
4253
4303
  constructor({ editor: t }) {
4254
4304
  this._buffer = [], this.editor = t;
4255
4305
  }
@@ -4276,7 +4326,7 @@ class Qt {
4276
4326
  * @fires editor:error
4277
4327
  */
4278
4328
  emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, data: n, message: o }) {
4279
- if (!Qt.isValidErrorCode(s)) {
4329
+ if (!qt.isValidErrorCode(s)) {
4280
4330
  console.warn("Неизвестный код ошибки: ", { code: s, origin: t, method: e });
4281
4331
  return;
4282
4332
  }
@@ -4305,7 +4355,7 @@ class Qt {
4305
4355
  * @fires editor:warning
4306
4356
  */
4307
4357
  emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, message: n, data: o }) {
4308
- if (!Qt.isValidErrorCode(s)) {
4358
+ if (!qt.isValidErrorCode(s)) {
4309
4359
  console.warn("Неизвестный код предупреждения: ", { code: s, origin: t, method: e });
4310
4360
  return;
4311
4361
  }
@@ -4518,7 +4568,7 @@ const lt = ({
4518
4568
  try {
4519
4569
  s = new ms(t);
4520
4570
  } catch (o) {
4521
- return Qt.emitError({
4571
+ return qt.emitError({
4522
4572
  origin: "BackgroundTextbox",
4523
4573
  method: "_getEffectiveBackgroundFill",
4524
4574
  code: "INVALID_COLOR_VALUE",
@@ -4623,7 +4673,7 @@ const an = () => {
4623
4673
  );
4624
4674
  if (s.length)
4625
4675
  return (n = s[0]) == null ? void 0 : n[e];
4626
- }, Ke = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", Qe = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, pe = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", tt = 0.01;
4676
+ }, Ke = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", qe = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, pe = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", tt = 0.01;
4627
4677
  class k {
4628
4678
  constructor({ editor: t }) {
4629
4679
  var e;
@@ -4680,19 +4730,19 @@ class k {
4680
4730
  baseStyles: u
4681
4731
  } = i, f = typeof ((te = o.original) == null ? void 0 : te.width) == "number" ? o.original.width : void 0, g = typeof ((Bt = o.original) == null ? void 0 : Bt.left) == "number" ? o.original.left : void 0, p = f != null ? f : a, m = g != null ? g : r, v = (kt = o.corner) != null ? kt : "", w = (zt = o.action) != null ? zt : "", A = ["ml", "mr"].includes(v) || w === "scaleX", y = ["mt", "mb"].includes(v) || w === "scaleY", b = ["tl", "tr", "bl", "br"].includes(v) || w === "scale", j = b || y;
4682
4732
  if (!A && !y && !b) return;
4683
- const I = Math.abs((Wt = (Pt = n.scaleX) != null ? Pt : o.scaleX) != null ? Wt : 1) || 1, S = Math.abs((Ft = (Ut = n.scaleY) != null ? Ut : o.scaleY) != null ? Ft : 1) || 1, T = Math.max(1, p * I), M = Math.max(1, Math.round(T)), C = Math.max(1, c * S), {
4733
+ const C = Math.abs((Wt = (Pt = n.scaleX) != null ? Pt : o.scaleX) != null ? Wt : 1) || 1, S = Math.abs((Ft = (Ut = n.scaleY) != null ? Ut : o.scaleY) != null ? Ft : 1) || 1, T = Math.max(1, p * C), M = Math.max(1, Math.round(T)), I = Math.max(1, c * S), {
4684
4734
  paddingTop: E = 0,
4685
4735
  paddingRight: z = 0,
4686
4736
  paddingBottom: x = 0,
4687
4737
  paddingLeft: N = 0,
4688
4738
  radiusTopLeft: Y = 0,
4689
4739
  radiusTopRight: V = 0,
4690
- radiusBottomRight: Q = 0,
4740
+ radiusBottomRight: q = 0,
4691
4741
  radiusBottomLeft: H = 0,
4692
4742
  fontSize: R,
4693
4743
  width: O,
4694
4744
  originX: at = "left"
4695
- } = n, Z = b || y, nt = b || y, F = Z ? {
4745
+ } = n, G = b || y, nt = b || y, F = G ? {
4696
4746
  top: Math.max(0, d.top * S),
4697
4747
  right: Math.max(0, d.right * S),
4698
4748
  bottom: Math.max(0, d.bottom * S),
@@ -4703,7 +4753,7 @@ class k {
4703
4753
  bottomRight: Math.max(0, l.bottomRight * S),
4704
4754
  bottomLeft: Math.max(0, l.bottomLeft * S)
4705
4755
  } : l, ot = Object.keys(u).length > 0;
4706
- let q;
4756
+ let Q;
4707
4757
  if (j && ot) {
4708
4758
  const Ht = {};
4709
4759
  Object.entries(u).forEach(([Zt, De]) => {
@@ -4714,16 +4764,16 @@ class k {
4714
4764
  const Re = B({}, se);
4715
4765
  typeof se.fontSize == "number" && (Re.fontSize = Math.max(1, se.fontSize * S)), fe[cs] = Re;
4716
4766
  }), Object.keys(fe).length && (Ht[Zt] = fe);
4717
- }), Object.keys(Ht).length && (q = Ht);
4767
+ }), Object.keys(Ht).length && (Q = Ht);
4718
4768
  }
4719
- const vt = (K = (Yt = o.originX) != null ? Yt : at) != null ? K : "left", Ct = m + p, rt = m + p / 2, gt = O != null ? O : p, ct = M !== gt, Nt = Math.abs(C - (R != null ? R : c)) > tt, bt = Math.abs(F.top - E) > tt || Math.abs(F.right - z) > tt || Math.abs(F.bottom - x) > tt || Math.abs(F.left - N) > tt, Jt = Math.abs($.topLeft - Y) > tt || Math.abs($.topRight - V) > tt || Math.abs($.bottomRight - Q) > tt || Math.abs($.bottomLeft - H) > tt;
4769
+ const vt = (K = (Yt = o.originX) != null ? Yt : at) != null ? K : "left", It = m + p, rt = m + p / 2, gt = O != null ? O : p, ct = M !== gt, Nt = Math.abs(I - (R != null ? R : c)) > tt, bt = Math.abs(F.top - E) > tt || Math.abs(F.right - z) > tt || Math.abs(F.bottom - x) > tt || Math.abs(F.left - N) > tt, Jt = Math.abs($.topLeft - Y) > tt || Math.abs($.topRight - V) > tt || Math.abs($.bottomRight - q) > tt || Math.abs($.bottomLeft - H) > tt;
4720
4770
  if (!ct && !Nt && !bt && !Jt) {
4721
4771
  n.set({ scaleX: 1, scaleY: 1 }), o.scaleX = 1, o.scaleY = 1;
4722
4772
  return;
4723
4773
  }
4724
- q && (n.styles = q), n.set({
4774
+ Q && (n.styles = Q), n.set({
4725
4775
  width: M,
4726
- fontSize: j ? C : c,
4776
+ fontSize: j ? I : c,
4727
4777
  paddingTop: F.top,
4728
4778
  paddingRight: F.right,
4729
4779
  paddingBottom: F.bottom,
@@ -4735,13 +4785,13 @@ class k {
4735
4785
  scaleX: 1,
4736
4786
  scaleY: 1
4737
4787
  });
4738
- const qt = k._roundTextboxDimensions({ textbox: n });
4739
- qt && (n.dirty = !0);
4788
+ const Qt = k._roundTextboxDimensions({ textbox: n });
4789
+ Qt && (n.dirty = !0);
4740
4790
  const Tt = (Et = n.width) != null ? Et : M, $t = Tt !== gt;
4741
4791
  let dt = m;
4742
- $t && (A || b) && (vt === "right" ? dt = Ct - Tt : vt === "center" && (dt = rt - Tt / 2)), n.set({ left: dt }), i.baseLeft = dt, o.scaleX = 1, o.scaleY = 1;
4792
+ $t && (A || b) && (vt === "right" ? dt = It - Tt : vt === "center" && (dt = rt - Tt / 2)), n.set({ left: dt }), i.baseLeft = dt, o.scaleX = 1, o.scaleY = 1;
4743
4793
  const { original: Mt } = o;
4744
- Mt && (Mt.scaleX = 1, Mt.scaleY = 1, Mt.width = Tt, Mt.height = n.height, Mt.left = dt), n.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = Tt, i.baseFontSize = (ee = n.fontSize) != null ? ee : C, i.baseStyles = JSON.parse(JSON.stringify((wt = n.styles) != null ? wt : {})), i.basePadding = {
4794
+ Mt && (Mt.scaleX = 1, Mt.scaleY = 1, Mt.width = Tt, Mt.height = n.height, Mt.left = dt), n.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = Tt, i.baseFontSize = (ee = n.fontSize) != null ? ee : I, i.baseStyles = JSON.parse(JSON.stringify((wt = n.styles) != null ? wt : {})), i.basePadding = {
4745
4795
  top: F.top,
4746
4796
  right: F.right,
4747
4797
  bottom: F.bottom,
@@ -4751,50 +4801,50 @@ class k {
4751
4801
  topRight: $.topRight,
4752
4802
  bottomRight: $.bottomRight,
4753
4803
  bottomLeft: $.bottomLeft
4754
- }, i.hasWidthChange = $t || Nt || bt || Jt || qt;
4804
+ }, i.hasWidthChange = $t || Nt || bt || Jt || Qt;
4755
4805
  }, this._handleObjectModified = (s) => {
4756
4806
  var w, A, y;
4757
4807
  const { target: n } = s;
4758
4808
  if (n instanceof U) {
4759
4809
  const b = n.getObjects();
4760
4810
  if (!b.some((M) => k._isTextbox(M))) return;
4761
- const { scaleX: I = 1, scaleY: S = 1 } = n;
4762
- if (Math.abs(I - 1) < tt && Math.abs(S - 1) < tt) return;
4811
+ const { scaleX: C = 1, scaleY: S = 1 } = n;
4812
+ if (Math.abs(C - 1) < tt && Math.abs(S - 1) < tt) return;
4763
4813
  this.canvas.discardActiveObject(), b.forEach((M) => {
4764
- var C, E, z, x;
4814
+ var I, E, z, x;
4765
4815
  if (k._isTextbox(M)) {
4766
- const N = (C = M.scaleX) != null ? C : 1, Y = (E = M.scaleY) != null ? E : 1, V = ((z = M.fontSize) != null ? z : 16) * Y, Q = ((x = M.width) != null ? x : 0) * N, H = Y, {
4816
+ const N = (I = M.scaleX) != null ? I : 1, Y = (E = M.scaleY) != null ? E : 1, V = ((z = M.fontSize) != null ? z : 16) * Y, q = ((x = M.width) != null ? x : 0) * N, H = Y, {
4767
4817
  paddingTop: R = 0,
4768
4818
  paddingRight: O = 0,
4769
4819
  paddingBottom: at = 0,
4770
- paddingLeft: Z = 0,
4820
+ paddingLeft: G = 0,
4771
4821
  radiusTopLeft: nt = 0,
4772
4822
  radiusTopRight: F = 0,
4773
4823
  radiusBottomRight: $ = 0,
4774
4824
  radiusBottomLeft: ot = 0,
4775
- styles: q
4825
+ styles: Q
4776
4826
  } = M, vt = {
4777
4827
  paddingTop: Math.max(0, R * H),
4778
4828
  paddingRight: Math.max(0, O * H),
4779
4829
  paddingBottom: Math.max(0, at * H),
4780
- paddingLeft: Math.max(0, Z * H)
4781
- }, Ct = {
4830
+ paddingLeft: Math.max(0, G * H)
4831
+ }, It = {
4782
4832
  radiusTopLeft: Math.max(0, nt * H),
4783
4833
  radiusTopRight: Math.max(0, F * H),
4784
4834
  radiusBottomRight: Math.max(0, $ * H),
4785
4835
  radiusBottomLeft: Math.max(0, ot * H)
4786
4836
  };
4787
- let rt = q;
4788
- q && Object.keys(q).length > 0 && (rt = JSON.parse(JSON.stringify(q)), Object.values(rt).forEach((gt) => {
4837
+ let rt = Q;
4838
+ Q && Object.keys(Q).length > 0 && (rt = JSON.parse(JSON.stringify(Q)), Object.values(rt).forEach((gt) => {
4789
4839
  Object.values(gt).forEach((ct) => {
4790
4840
  typeof ct.fontSize == "number" && (ct.fontSize = Math.max(1, ct.fontSize * H));
4791
4841
  });
4792
4842
  })), M.set(St(B(B({
4793
4843
  fontSize: V,
4794
- width: Q,
4844
+ width: q,
4795
4845
  scaleX: 1,
4796
4846
  scaleY: 1
4797
- }, vt), Ct), {
4847
+ }, vt), It), {
4798
4848
  styles: rt
4799
4849
  })), k._roundTextboxDimensions({ textbox: M });
4800
4850
  }
@@ -4841,7 +4891,7 @@ class k {
4841
4891
  * @param options — настройки текста
4842
4892
  * @param flags — флаги поведения
4843
4893
  */
4844
- addText(z = {}, { withoutSelection: M = !1, withoutSave: C = !1, withoutAdding: E = !1 } = {}) {
4894
+ addText(z = {}, { withoutSelection: M = !1, withoutSave: I = !1, withoutAdding: E = !1 } = {}) {
4845
4895
  var x = z, {
4846
4896
  id: t = `text-${X()}`,
4847
4897
  text: e = "Новый текст",
@@ -4865,7 +4915,7 @@ class k {
4865
4915
  paddingLeft: y = 0,
4866
4916
  radiusTopLeft: b = 0,
4867
4917
  radiusTopRight: j = 0,
4868
- radiusBottomRight: I = 0,
4918
+ radiusBottomRight: C = 0,
4869
4919
  radiusBottomLeft: S = 0
4870
4920
  } = x, T = pt(x, [
4871
4921
  "id",
@@ -4893,12 +4943,12 @@ class k {
4893
4943
  "radiusBottomRight",
4894
4944
  "radiusBottomLeft"
4895
4945
  ]);
4896
- var Z;
4946
+ var G;
4897
4947
  const { historyManager: N } = this.editor, { canvas: Y } = this;
4898
4948
  N.suspendHistory();
4899
- const V = s != null ? s : this._getDefaultFontFamily(), Q = Qe({ width: f }), H = Ke({
4949
+ const V = s != null ? s : this._getDefaultFontFamily(), q = qe({ width: f }), H = Ke({
4900
4950
  strokeColor: u,
4901
- width: Q
4951
+ width: q
4902
4952
  }), R = B({
4903
4953
  id: t,
4904
4954
  fontFamily: V,
@@ -4911,7 +4961,7 @@ class k {
4911
4961
  textAlign: d,
4912
4962
  fill: l,
4913
4963
  stroke: H,
4914
- strokeWidth: Q,
4964
+ strokeWidth: q,
4915
4965
  strokeUniform: !0,
4916
4966
  opacity: g,
4917
4967
  backgroundColor: p,
@@ -4922,14 +4972,14 @@ class k {
4922
4972
  paddingLeft: y,
4923
4973
  radiusTopLeft: b,
4924
4974
  radiusTopRight: j,
4925
- radiusBottomRight: I,
4975
+ radiusBottomRight: C,
4926
4976
  radiusBottomLeft: S
4927
4977
  }, T), O = new ue(e, R);
4928
- if (O.textCaseRaw = (Z = O.text) != null ? Z : "", r) {
4978
+ if (O.textCaseRaw = (G = O.text) != null ? G : "", r) {
4929
4979
  const nt = pe({ value: O.textCaseRaw });
4930
4980
  nt !== O.text && O.set({ text: nt });
4931
4981
  }
4932
- return k._roundTextboxDimensions({ textbox: O }) && (O.dirty = !0), T.left === void 0 && T.top === void 0 && Y.centerObject(O), E || Y.add(O), M || Y.setActiveObject(O), Y.requestRenderAll(), N.resumeHistory(), C || N.saveState(), Y.fire("editor:text-added", {
4982
+ return k._roundTextboxDimensions({ textbox: O }) && (O.dirty = !0), T.left === void 0 && T.top === void 0 && Y.centerObject(O), E || Y.add(O), M || Y.setActiveObject(O), Y.requestRenderAll(), N.resumeHistory(), I || N.saveState(), Y.fire("editor:text-added", {
4933
4983
  textbox: O,
4934
4984
  options: St(B({}, R), {
4935
4985
  text: e,
@@ -4939,11 +4989,11 @@ class k {
4939
4989
  align: d,
4940
4990
  color: l,
4941
4991
  strokeColor: H,
4942
- strokeWidth: Q
4992
+ strokeWidth: q
4943
4993
  }),
4944
4994
  flags: {
4945
4995
  withoutSelection: !!M,
4946
- withoutSave: !!C,
4996
+ withoutSave: !!I,
4947
4997
  withoutAdding: !!E
4948
4998
  }
4949
4999
  }), O;
@@ -4978,18 +5028,18 @@ class k {
4978
5028
  align: y,
4979
5029
  color: b,
4980
5030
  strokeColor: j,
4981
- strokeWidth: I,
5031
+ strokeWidth: C,
4982
5032
  opacity: S,
4983
5033
  backgroundColor: T,
4984
5034
  backgroundOpacity: M,
4985
- paddingTop: C,
5035
+ paddingTop: I,
4986
5036
  paddingRight: E,
4987
5037
  paddingBottom: z,
4988
5038
  paddingLeft: x,
4989
5039
  radiusTopLeft: N,
4990
5040
  radiusTopRight: Y,
4991
5041
  radiusBottomRight: V,
4992
- radiusBottomLeft: Q
5042
+ radiusBottomLeft: q
4993
5043
  } = kt, H = pt(kt, [
4994
5044
  "text",
4995
5045
  "fontFamily",
@@ -5014,24 +5064,24 @@ class k {
5014
5064
  "radiusTopRight",
5015
5065
  "radiusBottomRight",
5016
5066
  "radiusBottomLeft"
5017
- ]), R = B({}, H), O = rn({ textbox: o }), at = O ? k._expandRangeToFullLines({ textbox: o, range: O }) : null, Z = {}, nt = {}, F = {}, $ = dn({ textbox: o, range: O }), ot = !O || $, q = !O;
5018
- if (f !== void 0 && (at && (nt.fontFamily = f), ot && (R.fontFamily = f, q && (F.fontFamily = f))), g !== void 0 && (at && (nt.fontSize = g), ot && (R.fontSize = g, q && (F.fontSize = g))), p !== void 0) {
5067
+ ]), R = B({}, H), O = rn({ textbox: o }), at = O ? k._expandRangeToFullLines({ textbox: o, range: O }) : null, G = {}, nt = {}, F = {}, $ = dn({ textbox: o, range: O }), ot = !O || $, Q = !O;
5068
+ if (f !== void 0 && (at && (nt.fontFamily = f), ot && (R.fontFamily = f, Q && (F.fontFamily = f))), g !== void 0 && (at && (nt.fontSize = g), ot && (R.fontSize = g, Q && (F.fontSize = g))), p !== void 0) {
5019
5069
  const K = p ? "bold" : "normal";
5020
- O && (Z.fontWeight = K), ot && (R.fontWeight = K, q && (F.fontWeight = K));
5070
+ O && (G.fontWeight = K), ot && (R.fontWeight = K, Q && (F.fontWeight = K));
5021
5071
  }
5022
5072
  if (m !== void 0) {
5023
5073
  const K = m ? "italic" : "normal";
5024
- O && (Z.fontStyle = K), ot && (R.fontStyle = K, q && (F.fontStyle = K));
5074
+ O && (G.fontStyle = K), ot && (R.fontStyle = K, Q && (F.fontStyle = K));
5025
5075
  }
5026
- if (v !== void 0 && (O && (Z.underline = v), ot && (R.underline = v, q && (F.underline = v))), A !== void 0 && (O && (Z.linethrough = A), ot && (R.linethrough = A, q && (F.linethrough = A))), y !== void 0 && (R.textAlign = y), b !== void 0 && (O && (Z.fill = b), ot && (R.fill = b, q && (F.fill = b))), j !== void 0 || I !== void 0) {
5027
- const K = O ? Xe({ textbox: o, range: O, property: "strokeWidth" }) : void 0, Et = O ? Xe({ textbox: o, range: O, property: "stroke" }) : void 0, ee = (Pt = (zt = I != null ? I : K) != null ? zt : o.strokeWidth) != null ? Pt : 0, wt = Qe({ width: ee }), Ht = (Ut = (Wt = j != null ? j : Et) != null ? Wt : o.stroke) != null ? Ut : void 0, Zt = Ke({
5076
+ if (v !== void 0 && (O && (G.underline = v), ot && (R.underline = v, Q && (F.underline = v))), A !== void 0 && (O && (G.linethrough = A), ot && (R.linethrough = A, Q && (F.linethrough = A))), y !== void 0 && (R.textAlign = y), b !== void 0 && (O && (G.fill = b), ot && (R.fill = b, Q && (F.fill = b))), j !== void 0 || C !== void 0) {
5077
+ const K = O ? Xe({ textbox: o, range: O, property: "strokeWidth" }) : void 0, Et = O ? Xe({ textbox: o, range: O, property: "stroke" }) : void 0, ee = (Pt = (zt = C != null ? C : K) != null ? zt : o.strokeWidth) != null ? Pt : 0, wt = qe({ width: ee }), Ht = (Ut = (Wt = j != null ? j : Et) != null ? Wt : o.stroke) != null ? Ut : void 0, Zt = Ke({
5028
5078
  strokeColor: Ht,
5029
5079
  width: wt
5030
5080
  });
5031
- O && (Z.stroke = Zt, Z.strokeWidth = wt), ot && (R.stroke = Zt, R.strokeWidth = wt, q && (F.stroke = Zt, F.strokeWidth = wt));
5081
+ O && (G.stroke = Zt, G.strokeWidth = wt), ot && (R.stroke = Zt, R.strokeWidth = wt, Q && (F.stroke = Zt, F.strokeWidth = wt));
5032
5082
  }
5033
- S !== void 0 && (R.opacity = S), T !== void 0 && (R.backgroundColor = T), M !== void 0 && (R.backgroundOpacity = M), C !== void 0 && (R.paddingTop = C), E !== void 0 && (R.paddingRight = E), z !== void 0 && (R.paddingBottom = z), x !== void 0 && (R.paddingLeft = x), N !== void 0 && (R.radiusTopLeft = N), Y !== void 0 && (R.radiusTopRight = Y), V !== void 0 && (R.radiusBottomRight = V), Q !== void 0 && (R.radiusBottomLeft = Q);
5034
- const vt = (Yt = o.textCaseRaw) != null ? Yt : (Ft = o.text) != null ? Ft : "", Ct = !!o.uppercase, rt = u !== void 0, gt = rt ? u != null ? u : "" : vt, ct = w != null ? w : Ct, Nt = ct !== Ct;
5083
+ S !== void 0 && (R.opacity = S), T !== void 0 && (R.backgroundColor = T), M !== void 0 && (R.backgroundOpacity = M), I !== void 0 && (R.paddingTop = I), E !== void 0 && (R.paddingRight = E), z !== void 0 && (R.paddingBottom = z), x !== void 0 && (R.paddingLeft = x), N !== void 0 && (R.radiusTopLeft = N), Y !== void 0 && (R.radiusTopRight = Y), V !== void 0 && (R.radiusBottomRight = V), q !== void 0 && (R.radiusBottomLeft = q);
5084
+ const vt = (Yt = o.textCaseRaw) != null ? Yt : (Ft = o.text) != null ? Ft : "", It = !!o.uppercase, rt = u !== void 0, gt = rt ? u != null ? u : "" : vt, ct = w != null ? w : It, Nt = ct !== It;
5035
5085
  if (rt || Nt) {
5036
5086
  const K = ct ? pe({ value: gt }) : gt;
5037
5087
  R.text = K, o.textCaseRaw = gt;
@@ -5039,7 +5089,7 @@ class k {
5039
5089
  o.uppercase = ct, o.set(R);
5040
5090
  let bt = !1;
5041
5091
  if (O) {
5042
- const K = ge({ textbox: o, styles: Z, range: O }), Et = at ? ge({ textbox: o, styles: nt, range: at }) : !1;
5092
+ const K = ge({ textbox: o, styles: G, range: O }), Et = at ? ge({ textbox: o, styles: nt, range: at }) : !1;
5043
5093
  bt = K || Et;
5044
5094
  } else if (Object.keys(F).length) {
5045
5095
  const K = cn({ textbox: o });
@@ -5047,20 +5097,20 @@ class k {
5047
5097
  }
5048
5098
  const Jt = bt && k._hasLayoutAffectingStyles({
5049
5099
  stylesList: [
5050
- Z,
5100
+ G,
5051
5101
  nt,
5052
5102
  F
5053
5103
  ]
5054
5104
  });
5055
- bt && (o.dirty = !0), Jt && (o.initDimensions(), o.dirty = !0), (T !== void 0 || M !== void 0 || C !== void 0 || E !== void 0 || z !== void 0 || x !== void 0 || N !== void 0 || Y !== void 0 || V !== void 0 || Q !== void 0) && (o.dirty = !0);
5056
- const qt = k._hasLayoutAffectingStyles({
5105
+ bt && (o.dirty = !0), Jt && (o.initDimensions(), o.dirty = !0), (T !== void 0 || M !== void 0 || I !== void 0 || E !== void 0 || z !== void 0 || x !== void 0 || N !== void 0 || Y !== void 0 || V !== void 0 || q !== void 0) && (o.dirty = !0);
5106
+ const Qt = k._hasLayoutAffectingStyles({
5057
5107
  stylesList: [
5058
5108
  R,
5059
- Z,
5109
+ G,
5060
5110
  nt,
5061
5111
  F
5062
5112
  ]
5063
- }), $t = !Object.prototype.hasOwnProperty.call(R, "width") && (rt || Nt || qt);
5113
+ }), $t = !Object.prototype.hasOwnProperty.call(R, "width") && (rt || Nt || Qt);
5064
5114
  let dt = !1;
5065
5115
  $t && (dt = this._autoExpandTextboxWidth(o, {
5066
5116
  anchor: l
@@ -5078,7 +5128,7 @@ class k {
5078
5128
  before: r,
5079
5129
  after: te,
5080
5130
  selectionRange: O != null ? O : void 0,
5081
- selectionStyles: O && Object.keys(Z).length ? Z : void 0
5131
+ selectionStyles: O && Object.keys(G).length ? G : void 0
5082
5132
  }), o;
5083
5133
  }
5084
5134
  /**
@@ -5122,15 +5172,15 @@ class k {
5122
5172
  * но не шире монтажной области, и удерживает объект в её пределах.
5123
5173
  */
5124
5174
  _autoExpandTextboxWidth(t, { anchor: e } = {}) {
5125
- var I, S, T, M, C, E, z, x, N, Y, V, Q, H;
5175
+ var C, S, T, M, I, E, z, x, N, Y, V, q, H;
5126
5176
  const { montageArea: s } = this.editor;
5127
5177
  if (!s) return !1;
5128
5178
  const n = typeof t.text == "string" ? t.text : "";
5129
5179
  if (!n.length) return !1;
5130
5180
  s.setCoords();
5131
- const o = s.getBoundingRect(!1, !0), i = (I = o.width) != null ? I : 0;
5181
+ const o = s.getBoundingRect(!1, !0), i = (C = o.width) != null ? C : 0;
5132
5182
  if (!Number.isFinite(i) || i <= 0) return !1;
5133
- const a = e != null ? e : (S = this.editingAnchorState) == null ? void 0 : S.get(t), r = (M = (T = a == null ? void 0 : a.originY) != null ? T : t.originY) != null ? M : "top", c = Math.abs((C = t.scaleX) != null ? C : 1) || 1, d = (E = t.paddingLeft) != null ? E : 0, l = (z = t.paddingRight) != null ? z : 0, u = (x = t.strokeWidth) != null ? x : 0, f = Math.max(
5183
+ const a = e != null ? e : (S = this.editingAnchorState) == null ? void 0 : S.get(t), r = (M = (T = a == null ? void 0 : a.originY) != null ? T : t.originY) != null ? M : "top", c = Math.abs((I = t.scaleX) != null ? I : 1) || 1, d = (E = t.paddingLeft) != null ? E : 0, l = (z = t.paddingRight) != null ? z : 0, u = (x = t.strokeWidth) != null ? x : 0, f = Math.max(
5134
5184
  1,
5135
5185
  i / c - d - l - u
5136
5186
  );
@@ -5149,7 +5199,7 @@ class k {
5149
5199
  v && (y = f), Math.abs(((V = t.width) != null ? V : 0) - y) > tt && (t.set({ width: y }), t.initDimensions(), p = !0), k._roundTextboxDimensions({ textbox: t }) && (p = !0), a && (t.setPositionByOrigin(new et(a.x, a.y), "center", r), p = !0);
5150
5200
  const j = k._clampTextboxToMontage({
5151
5201
  textbox: t,
5152
- montageLeft: (Q = o.left) != null ? Q : 0,
5202
+ montageLeft: (q = o.left) != null ? q : 0,
5153
5203
  montageRight: ((H = o.left) != null ? H : 0) + i
5154
5204
  });
5155
5205
  return p || j;
@@ -5343,8 +5393,8 @@ class k {
5343
5393
  snapshot: R,
5344
5394
  entries: O
5345
5395
  }) => {
5346
- Object.entries(O).forEach(([at, Z]) => {
5347
- Z != null && (R[at] = Z);
5396
+ Object.entries(O).forEach(([at, G]) => {
5397
+ G != null && (R[at] = G);
5348
5398
  });
5349
5399
  }, {
5350
5400
  id: s,
@@ -5367,18 +5417,18 @@ class k {
5367
5417
  paddingTop: y,
5368
5418
  paddingRight: b,
5369
5419
  paddingBottom: j,
5370
- paddingLeft: I,
5420
+ paddingLeft: C,
5371
5421
  radiusTopLeft: S,
5372
5422
  radiusTopRight: T,
5373
5423
  radiusBottomRight: M,
5374
- radiusBottomLeft: C,
5424
+ radiusBottomLeft: I,
5375
5425
  left: E,
5376
5426
  top: z,
5377
5427
  width: x,
5378
5428
  height: N,
5379
5429
  angle: Y,
5380
5430
  scaleX: V,
5381
- scaleY: Q
5431
+ scaleY: q
5382
5432
  } = t, H = {
5383
5433
  id: s,
5384
5434
  uppercase: !!i,
@@ -5404,18 +5454,18 @@ class k {
5404
5454
  paddingTop: y,
5405
5455
  paddingRight: b,
5406
5456
  paddingBottom: j,
5407
- paddingLeft: I,
5457
+ paddingLeft: C,
5408
5458
  radiusTopLeft: S,
5409
5459
  radiusTopRight: T,
5410
5460
  radiusBottomRight: M,
5411
- radiusBottomLeft: C,
5461
+ radiusBottomLeft: I,
5412
5462
  left: E,
5413
5463
  top: z,
5414
5464
  width: x,
5415
5465
  height: N,
5416
5466
  angle: Y,
5417
5467
  scaleX: V,
5418
- scaleY: Q
5468
+ scaleY: q
5419
5469
  }
5420
5470
  }), H;
5421
5471
  }
@@ -5661,11 +5711,11 @@ class _ {
5661
5711
  backgroundManager: r,
5662
5712
  errorManager: a
5663
5713
  }));
5664
- const j = b.map((I) => (this._adaptTextboxWidth({
5665
- object: I,
5714
+ const j = b.map((C) => (this._adaptTextboxWidth({
5715
+ object: C,
5666
5716
  baseWidth: g.baseWidth
5667
5717
  }), _._transformObject({
5668
- object: I,
5718
+ object: C,
5669
5719
  scale: p,
5670
5720
  bounds: u,
5671
5721
  targetSize: f,
@@ -5673,10 +5723,10 @@ class _ {
5673
5723
  baseHeight: g.baseHeight,
5674
5724
  montageArea: o,
5675
5725
  useRelativePositions: m
5676
- }), I.set({
5677
- id: `${I.type}-${X()}`,
5726
+ }), C.set({
5727
+ id: `${C.type}-${X()}`,
5678
5728
  evented: !0
5679
- }), n.add(I), I));
5729
+ }), n.add(C), C));
5680
5730
  return !j.length && !w ? null : (v = j.length > 0 || w, j.length && _._activateObjects({ canvas: n, objects: j }), n.requestRenderAll(), n.fire("editor:template-applied", {
5681
5731
  template: t,
5682
5732
  objects: j,
@@ -5762,12 +5812,12 @@ class _ {
5762
5812
  naturalHeight: 0,
5763
5813
  width: 0,
5764
5814
  height: 0
5765
- }, p = J({ value: l || f || c.width, fallback: 0 }), m = J({ value: u || g || c.height, fallback: 0 }), v = J({ value: n, fallback: p }), w = J({ value: o, fallback: m }), A = J({ value: i, fallback: c.scaleX || 1 }), y = J({ value: a, fallback: c.scaleY || 1 }), b = v * A, j = w * y, I = p > 0, S = m > 0, T = b > 0, M = j > 0, C = _._resolveImageFit({ customData: r }), E = {};
5766
- if (I && (E.width = p), S && (E.height = m), !I || !S) {
5815
+ }, p = J({ value: l || f || c.width, fallback: 0 }), m = J({ value: u || g || c.height, fallback: 0 }), v = J({ value: n, fallback: p }), w = J({ value: o, fallback: m }), A = J({ value: i, fallback: c.scaleX || 1 }), y = J({ value: a, fallback: c.scaleY || 1 }), b = v * A, j = w * y, C = p > 0, S = m > 0, T = b > 0, M = j > 0, I = _._resolveImageFit({ customData: r }), E = {};
5816
+ if (C && (E.width = p), S && (E.height = m), !C || !S) {
5767
5817
  c.set(E);
5768
5818
  return;
5769
5819
  }
5770
- if (C === "stretch") {
5820
+ if (I === "stretch") {
5771
5821
  const x = T ? b / p : null, N = M ? j / m : null;
5772
5822
  x && x > 0 && (E.scaleX = x), N && N > 0 && (E.scaleY = N), c.set(E);
5773
5823
  return;
@@ -5988,12 +6038,12 @@ class _ {
5988
6038
  } = t, r = J({ value: e, fallback: 0 }), c = t, d = J({ value: c.paddingLeft, fallback: 0 }), l = J({ value: c.paddingRight, fallback: 0 }), u = J({ value: i, fallback: 1 }), f = J({ value: a, fallback: 0 }) * u, g = J({ value: o, fallback: 0 }), p = g * u, m = d * u, v = l * u, w = p + m + v + f;
5989
6039
  if (!n || !g || !r) return;
5990
6040
  t.setCoords();
5991
- const A = t, y = A[Xt], b = typeof y == "number" ? y : null, j = _._resolveAnchor(A, re), I = w / r, S = b !== null ? b - I / 2 : null, T = b !== null ? b + I / 2 : null, M = t.getCenterPoint();
6041
+ const A = t, y = A[Xt], b = typeof y == "number" ? y : null, j = _._resolveAnchor(A, re), C = w / r, S = b !== null ? b - C / 2 : null, T = b !== null ? b + C / 2 : null, M = t.getCenterPoint();
5992
6042
  t.set("width", n), t.initDimensions();
5993
- const C = _._getLongestLineWidth({
6043
+ const I = _._getLongestLineWidth({
5994
6044
  textbox: t,
5995
6045
  text: s
5996
- }), E = C > g ? C + 1 : g;
6046
+ }), E = I > g ? I + 1 : g;
5997
6047
  t.set("width", E), t.initDimensions(), t.setPositionByOrigin(M, "center", "center"), t.setCoords();
5998
6048
  const x = (E * u + m + v + f) / r;
5999
6049
  let N = b;
@@ -6307,9 +6357,9 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6307
6357
  return { delta: 0, guide: null };
6308
6358
  const u = d[l - 1], f = d[l - 2], g = d[l + 1], p = d[l + 2], m = [], v = i - o;
6309
6359
  if (u && f) {
6310
- const { bounds: y } = u, { bounds: b } = f, j = y.top - b.bottom, I = o - y.bottom, S = Math.abs(I - j);
6360
+ const { bounds: y } = u, { bounds: b } = f, j = y.top - b.bottom, C = o - y.bottom, S = Math.abs(C - j);
6311
6361
  if (S <= e) {
6312
- const T = j - I, M = o + T, C = {
6362
+ const T = j - C, M = o + T, I = {
6313
6363
  type: "vertical",
6314
6364
  axis: n,
6315
6365
  refStart: b.bottom,
@@ -6318,13 +6368,13 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6318
6368
  activeEnd: M,
6319
6369
  distance: j
6320
6370
  };
6321
- m.push({ delta: T, guide: C, diff: S });
6371
+ m.push({ delta: T, guide: I, diff: S });
6322
6372
  }
6323
6373
  }
6324
6374
  if (g && p) {
6325
- const { bounds: y } = g, { bounds: b } = p, j = b.top - y.bottom, I = y.top - i, S = Math.abs(I - j);
6375
+ const { bounds: y } = g, { bounds: b } = p, j = b.top - y.bottom, C = y.top - i, S = Math.abs(C - j);
6326
6376
  if (S <= e) {
6327
- const T = I - j, M = i + T, C = {
6377
+ const T = C - j, M = i + T, I = {
6328
6378
  type: "vertical",
6329
6379
  axis: n,
6330
6380
  refStart: y.bottom,
@@ -6333,13 +6383,13 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6333
6383
  activeEnd: y.top,
6334
6384
  distance: j
6335
6385
  };
6336
- m.push({ delta: T, guide: C, diff: S });
6386
+ m.push({ delta: T, guide: I, diff: S });
6337
6387
  }
6338
6388
  }
6339
6389
  if (u && g) {
6340
- const { bounds: y } = u, { bounds: b } = g, I = b.top - y.bottom - v;
6341
- if (I >= 0) {
6342
- const S = I / 2, T = o - y.bottom, M = b.top - i, C = Math.abs(T - S), E = Math.abs(M - S), z = Math.max(C, E);
6390
+ const { bounds: y } = u, { bounds: b } = g, C = b.top - y.bottom - v;
6391
+ if (C >= 0) {
6392
+ const S = C / 2, T = o - y.bottom, M = b.top - i, I = Math.abs(T - S), E = Math.abs(M - S), z = Math.max(I, E);
6343
6393
  if (z <= e) {
6344
6394
  const x = S - T, N = i + x, Y = {
6345
6395
  type: "vertical",
@@ -6393,9 +6443,9 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6393
6443
  return { delta: 0, guide: null };
6394
6444
  const u = d[l - 1], f = d[l - 2], g = d[l + 1], p = d[l + 2], m = [], v = i - o;
6395
6445
  if (u && f) {
6396
- const { bounds: y } = u, { bounds: b } = f, j = y.left - b.right, I = o - y.right, S = Math.abs(I - j);
6446
+ const { bounds: y } = u, { bounds: b } = f, j = y.left - b.right, C = o - y.right, S = Math.abs(C - j);
6397
6447
  if (S <= e) {
6398
- const T = j - I, M = o + T, C = {
6448
+ const T = j - C, M = o + T, I = {
6399
6449
  type: "horizontal",
6400
6450
  axis: n,
6401
6451
  refStart: b.right,
@@ -6404,13 +6454,13 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6404
6454
  activeEnd: M,
6405
6455
  distance: j
6406
6456
  };
6407
- m.push({ delta: T, guide: C, diff: S });
6457
+ m.push({ delta: T, guide: I, diff: S });
6408
6458
  }
6409
6459
  }
6410
6460
  if (g && p) {
6411
- const { bounds: y } = g, { bounds: b } = p, j = b.left - y.right, I = y.left - i, S = Math.abs(I - j);
6461
+ const { bounds: y } = g, { bounds: b } = p, j = b.left - y.right, C = y.left - i, S = Math.abs(C - j);
6412
6462
  if (S <= e) {
6413
- const T = I - j, M = i + T, C = {
6463
+ const T = C - j, M = i + T, I = {
6414
6464
  type: "horizontal",
6415
6465
  axis: n,
6416
6466
  refStart: y.right,
@@ -6419,13 +6469,13 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6419
6469
  activeEnd: y.left,
6420
6470
  distance: j
6421
6471
  };
6422
- m.push({ delta: T, guide: C, diff: S });
6472
+ m.push({ delta: T, guide: I, diff: S });
6423
6473
  }
6424
6474
  }
6425
6475
  if (u && g) {
6426
- const { bounds: y } = u, { bounds: b } = g, I = b.left - y.right - v;
6427
- if (I >= 0) {
6428
- const S = I / 2, T = o - y.right, M = b.left - i, C = Math.abs(T - S), E = Math.abs(M - S), z = Math.max(C, E);
6476
+ const { bounds: y } = u, { bounds: b } = g, C = b.left - y.right - v;
6477
+ if (C >= 0) {
6478
+ const S = C / 2, T = o - y.right, M = b.left - i, I = Math.abs(T - S), E = Math.abs(M - S), z = Math.max(I, E);
6429
6479
  if (z <= e) {
6430
6480
  const x = S - T, N = i + x, Y = {
6431
6481
  type: "horizontal",
@@ -6505,12 +6555,12 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6505
6555
  }) => {
6506
6556
  const p = i || 1, m = 12 / p, v = l / p, w = u / p, A = (s + n) / 2 + f, y = t === "vertical" ? e + g : A, b = t === "vertical" ? A : e + g;
6507
6557
  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";
6508
- const I = h.measureText(o).width + v * 2, S = m + v * 2, T = y - I / 2, M = b - S / 2;
6558
+ const C = h.measureText(o).width + v * 2, S = m + v * 2, T = y - C / 2, M = b - S / 2;
6509
6559
  h.beginPath(), Mn({
6510
6560
  context: h,
6511
6561
  x: T,
6512
6562
  y: M,
6513
- width: I,
6563
+ width: C,
6514
6564
  height: S,
6515
6565
  radius: w
6516
6566
  }), h.fill(), h.fillStyle = r, h.fillText(o, y, b), h.restore();
@@ -6551,7 +6601,7 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6551
6601
  color: l,
6552
6602
  lineWidth: Ae
6553
6603
  });
6554
- }, qe = ({
6604
+ }, Qe = ({
6555
6605
  anchors: h,
6556
6606
  bounds: t
6557
6607
  }) => {
@@ -6789,11 +6839,11 @@ class jn {
6789
6839
  const e = this._collectTargets({ activeObject: t }), s = { vertical: [], horizontal: [] }, n = [];
6790
6840
  for (const a of e) {
6791
6841
  const r = yt({ object: a });
6792
- r && (qe({ anchors: s, bounds: r }), n.push(r));
6842
+ r && (Qe({ anchors: s, bounds: r }), n.push(r));
6793
6843
  }
6794
6844
  const { montageArea: o } = this.editor, i = yt({ object: o });
6795
6845
  if (i) {
6796
- qe({ anchors: s, bounds: i });
6846
+ Qe({ anchors: s, bounds: i });
6797
6847
  const { left: a, right: r, top: c, bottom: d } = i;
6798
6848
  this.guideBounds = {
6799
6849
  left: a,
@@ -7020,34 +7070,34 @@ class Dt {
7020
7070
  } = e, p = Math.max(a, u), m = Math.min(r, f), w = m >= p ? (p + m) / 2 : (c + g) / 2;
7021
7071
  if (d >= i) {
7022
7072
  if (s) return n;
7023
- const C = d - i;
7024
- return C > 0 && n.push({
7073
+ const I = d - i;
7074
+ return I > 0 && n.push({
7025
7075
  type: "horizontal",
7026
7076
  axis: w,
7027
7077
  start: i,
7028
7078
  end: d,
7029
- distance: C
7079
+ distance: I
7030
7080
  }), n;
7031
7081
  }
7032
7082
  if (l <= o) {
7033
7083
  if (s) return n;
7034
- const C = o - l;
7035
- return C > 0 && n.push({
7084
+ const I = o - l;
7085
+ return I > 0 && n.push({
7036
7086
  type: "horizontal",
7037
7087
  axis: w,
7038
7088
  start: l,
7039
7089
  end: o,
7040
- distance: C
7090
+ distance: I
7041
7091
  }), n;
7042
7092
  }
7043
7093
  if (!s) return n;
7044
- const A = o < d, y = i > l, b = Math.min(o, d), j = Math.max(o, d), I = j - b;
7045
- I > 0 && !A && n.push({
7094
+ const A = o < d, y = i > l, b = Math.min(o, d), j = Math.max(o, d), C = j - b;
7095
+ C > 0 && !A && n.push({
7046
7096
  type: "horizontal",
7047
7097
  axis: w,
7048
7098
  start: b,
7049
7099
  end: j,
7050
- distance: I
7100
+ distance: C
7051
7101
  });
7052
7102
  const S = Math.min(i, l), T = Math.max(i, l), M = T - S;
7053
7103
  return M > 0 && !y && n.push({
@@ -7081,34 +7131,34 @@ class Dt {
7081
7131
  } = e, p = Math.max(a, u), m = Math.min(r, f), w = m >= p ? (p + m) / 2 : (c + g) / 2;
7082
7132
  if (d >= i) {
7083
7133
  if (s) return n;
7084
- const C = d - i;
7085
- return C > 0 && n.push({
7134
+ const I = d - i;
7135
+ return I > 0 && n.push({
7086
7136
  type: "vertical",
7087
7137
  axis: w,
7088
7138
  start: i,
7089
7139
  end: d,
7090
- distance: C
7140
+ distance: I
7091
7141
  }), n;
7092
7142
  }
7093
7143
  if (l <= o) {
7094
7144
  if (s) return n;
7095
- const C = o - l;
7096
- return C > 0 && n.push({
7145
+ const I = o - l;
7146
+ return I > 0 && n.push({
7097
7147
  type: "vertical",
7098
7148
  axis: w,
7099
7149
  start: l,
7100
7150
  end: o,
7101
- distance: C
7151
+ distance: I
7102
7152
  }), n;
7103
7153
  }
7104
7154
  if (!s) return n;
7105
- const A = o < d, y = i > l, b = Math.min(o, d), j = Math.max(o, d), I = j - b;
7106
- I > 0 && !A && n.push({
7155
+ const A = o < d, y = i > l, b = Math.min(o, d), j = Math.max(o, d), C = j - b;
7156
+ C > 0 && !A && n.push({
7107
7157
  type: "vertical",
7108
7158
  axis: w,
7109
7159
  start: b,
7110
7160
  end: j,
7111
- distance: I
7161
+ distance: C
7112
7162
  });
7113
7163
  const S = Math.min(i, l), T = Math.max(i, l), M = T - S;
7114
7164
  return M > 0 && !y && n.push({
@@ -7212,7 +7262,7 @@ class Le {
7212
7262
  showRotationAngle: d,
7213
7263
  _onReadyCallback: l
7214
7264
  } = this.options;
7215
- if (st.apply(), this.canvas = new vs(this.containerId, this.options), this.moduleLoader = new As(), this.workerManager = new Is(), this.errorManager = new Qt({ editor: this }), this.historyManager = new G({ editor: this }), this.toolbar = new Us({ editor: this }), this.transformManager = new Js({ editor: this }), this.zoomManager = new qs({ editor: this }), this.canvasManager = new Qs({ editor: this }), this.imageManager = new ut({ editor: this }), this.layerManager = new le({ editor: this }), this.shapeManager = new tn({ editor: this }), this.interactionBlocker = new $s({ editor: this }), this.backgroundManager = new Lt({ editor: this }), this.clipboardManager = new en({ editor: this }), this.objectLockManager = new he({ editor: this }), this.groupingManager = new sn({ editor: this }), this.selectionManager = new nn({ editor: this }), this.deletionManager = new Oe({ editor: this }), this.panConstraintManager = new on({ editor: this }), this.snappingManager = new jn({ editor: this }), this.measurementManager = new Dt({ editor: this }), this.fontManager = new Se((u = this.options.fonts) != null ? u : []), this.textManager = new k({ editor: this }), this.templateManager = new _({ editor: this }), d && (this.angleIndicator = new Ee({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Kt({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(n), this.canvasManager.setCanvasCSSWidth(o), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
7265
+ if (st.apply(), this.canvas = new vs(this.containerId, this.options), this.moduleLoader = new As(), this.workerManager = new Cs(), this.errorManager = new qt({ editor: this }), this.historyManager = new Z({ editor: this }), this.toolbar = new Us({ editor: this }), this.transformManager = new Js({ editor: this }), this.zoomManager = new Qs({ editor: this }), this.canvasManager = new qs({ editor: this }), this.imageManager = new ut({ editor: this }), this.layerManager = new le({ editor: this }), this.shapeManager = new tn({ editor: this }), this.interactionBlocker = new $s({ editor: this }), this.backgroundManager = new Lt({ editor: this }), this.clipboardManager = new en({ editor: this }), this.objectLockManager = new he({ editor: this }), this.groupingManager = new sn({ editor: this }), this.selectionManager = new nn({ editor: this }), this.deletionManager = new Oe({ editor: this }), this.panConstraintManager = new on({ editor: this }), this.snappingManager = new jn({ editor: this }), this.measurementManager = new Dt({ editor: this }), this.fontManager = new Se((u = this.options.fonts) != null ? u : []), this.textManager = new k({ editor: this }), this.templateManager = new _({ editor: this }), d && (this.angleIndicator = new Ee({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Kt({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(n), this.canvasManager.setCanvasCSSWidth(o), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
7216
7266
  const f = a, {
7217
7267
  source: g,
7218
7268
  scale: p = `image-${c}`,
@@ -7334,7 +7384,7 @@ const L = [
7334
7384
  "U+A640-A69F",
7335
7385
  "U+FE2E-FE2F",
7336
7386
  "U+2116"
7337
- ].join(", "), In = [
7387
+ ].join(", "), Cn = [
7338
7388
  {
7339
7389
  family: "Arial",
7340
7390
  source: 'local("Arial"), local("Liberation Sans"), local("DejaVu Sans")',
@@ -8124,7 +8174,7 @@ const L = [
8124
8174
  unicodeRange: L
8125
8175
  }
8126
8176
  }
8127
- ], Cn = {
8177
+ ], In = {
8128
8178
  /**
8129
8179
  * Опции редактора
8130
8180
  */
@@ -8216,10 +8266,10 @@ const L = [
8216
8266
  /**
8217
8267
  * Список шрифтов, которые будут доступны в редакторе по умолчанию.
8218
8268
  */
8219
- fonts: In
8269
+ fonts: Cn
8220
8270
  };
8221
8271
  function Dn(h, t = {}) {
8222
- const e = B(B({}, Cn), t), s = document.getElementById(h);
8272
+ const e = B(B({}, In), t), s = document.getElementById(h);
8223
8273
  if (!s)
8224
8274
  return Promise.reject(new Error(`Контейнер с ID "${h}" не найден.`));
8225
8275
  const n = document.createElement("canvas");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anu3ev/fabric-image-editor",
3
- "version": "0.5.23",
3
+ "version": "0.5.24",
4
4
  "description": "JavaScript image editor built on FabricJS, allowing you to create instances with an integrated montage area and providing an API to modify and manage state.",
5
5
  "module": "dist/main.js",
6
6
  "files": [