microboard-temp 0.4.59 → 0.4.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/node.js CHANGED
@@ -1539,8 +1539,8 @@ var require_tinyqueue = __commonJS((exports2, module2) => {
1539
1539
  }
1540
1540
  }
1541
1541
  };
1542
- TinyQueue.prototype.push = function push(item2) {
1543
- this.data.push(item2);
1542
+ TinyQueue.prototype.push = function push(item) {
1543
+ this.data.push(item);
1544
1544
  this.length++;
1545
1545
  this._up(this.length - 1);
1546
1546
  };
@@ -1564,24 +1564,24 @@ var require_tinyqueue = __commonJS((exports2, module2) => {
1564
1564
  var ref = this;
1565
1565
  var data = ref.data;
1566
1566
  var compare = ref.compare;
1567
- var item2 = data[pos];
1567
+ var item = data[pos];
1568
1568
  while (pos > 0) {
1569
1569
  var parent = pos - 1 >> 1;
1570
1570
  var current = data[parent];
1571
- if (compare(item2, current) >= 0) {
1571
+ if (compare(item, current) >= 0) {
1572
1572
  break;
1573
1573
  }
1574
1574
  data[pos] = current;
1575
1575
  pos = parent;
1576
1576
  }
1577
- data[pos] = item2;
1577
+ data[pos] = item;
1578
1578
  };
1579
1579
  TinyQueue.prototype._down = function _down(pos) {
1580
1580
  var ref = this;
1581
1581
  var data = ref.data;
1582
1582
  var compare = ref.compare;
1583
1583
  var halfLength = this.length >> 1;
1584
- var item2 = data[pos];
1584
+ var item = data[pos];
1585
1585
  while (pos < halfLength) {
1586
1586
  var left = (pos << 1) + 1;
1587
1587
  var best = data[left];
@@ -1590,13 +1590,13 @@ var require_tinyqueue = __commonJS((exports2, module2) => {
1590
1590
  left = right;
1591
1591
  best = data[right];
1592
1592
  }
1593
- if (compare(best, item2) >= 0) {
1593
+ if (compare(best, item) >= 0) {
1594
1594
  break;
1595
1595
  }
1596
1596
  data[pos] = best;
1597
1597
  pos = left;
1598
1598
  }
1599
- data[pos] = item2;
1599
+ data[pos] = item;
1600
1600
  };
1601
1601
  function defaultCompare2(a, b) {
1602
1602
  return a < b ? -1 : a > b ? 1 : 0;
@@ -1838,8 +1838,8 @@ class BoardCommand {
1838
1838
  switch (operation.method) {
1839
1839
  case "bringToFront": {
1840
1840
  for (const id in operation.prevZIndex) {
1841
- const item2 = this.board.items.getById(id);
1842
- if (!item2) {
1841
+ const item = this.board.items.getById(id);
1842
+ if (!item) {
1843
1843
  delete operation.prevZIndex.id;
1844
1844
  }
1845
1845
  }
@@ -1851,8 +1851,8 @@ class BoardCommand {
1851
1851
  }
1852
1852
  case "sendToBack": {
1853
1853
  for (const id in operation.prevZIndex) {
1854
- const item2 = this.board.items.getById(id);
1855
- if (!item2) {
1854
+ const item = this.board.items.getById(id);
1855
+ if (!item) {
1856
1856
  delete operation.prevZIndex.id;
1857
1857
  }
1858
1858
  }
@@ -1866,11 +1866,11 @@ class BoardCommand {
1866
1866
  case "moveSecondBeforeFirst":
1867
1867
  case "moveToZIndex": {
1868
1868
  const items = this.board.items;
1869
- const item2 = items.getById(operation.item);
1870
- if (!item2) {
1869
+ const item = items.getById(operation.item);
1870
+ if (!item) {
1871
1871
  throw new Error("Get reverse board operation. Item not found");
1872
1872
  }
1873
- const zIndex = this.board.getZIndex(item2);
1873
+ const zIndex = this.board.getZIndex(item);
1874
1874
  return {
1875
1875
  class: "Board",
1876
1876
  method: "moveToZIndex",
@@ -1880,8 +1880,8 @@ class BoardCommand {
1880
1880
  }
1881
1881
  case "moveManyToZIndex": {
1882
1882
  for (const id in operation.item) {
1883
- const item2 = this.board.items.getById(id);
1884
- if (!item2) {
1883
+ const item = this.board.items.getById(id);
1884
+ if (!item) {
1885
1885
  delete operation.item.id;
1886
1886
  }
1887
1887
  }
@@ -1898,15 +1898,15 @@ class BoardCommand {
1898
1898
  const items = this.board.items;
1899
1899
  const reverse = [];
1900
1900
  for (const itemId of operation.item) {
1901
- const item2 = items.getById(itemId);
1902
- if (!item2) {
1901
+ const item = items.getById(itemId);
1902
+ if (!item) {
1903
1903
  throw new Error("Get reverse board operation. Item not found");
1904
1904
  }
1905
1905
  reverse.push({
1906
1906
  class: "Board",
1907
1907
  method: "add",
1908
1908
  item: itemId,
1909
- data: item2.serialize()
1909
+ data: item.serialize()
1910
1910
  });
1911
1911
  }
1912
1912
  return reverse;
@@ -1929,32 +1929,32 @@ class BoardCommand {
1929
1929
  const items = this.board.items;
1930
1930
  const reverse = [];
1931
1931
  for (const itemId of operation.item) {
1932
- const item2 = items.getById(itemId);
1933
- if (!item2 || item2.itemType !== "Group") {
1932
+ const item = items.getById(itemId);
1933
+ if (!item || item.itemType !== "Group") {
1934
1934
  throw new Error("Get reverse board operation. Item not found");
1935
1935
  }
1936
1936
  reverse.push({
1937
1937
  class: "Board",
1938
1938
  method: "addLockedGroup",
1939
1939
  item: itemId,
1940
- data: item2.serialize()
1940
+ data: item.serialize()
1941
1941
  });
1942
1942
  }
1943
1943
  return reverse;
1944
1944
  }
1945
1945
  case "duplicate":
1946
1946
  case "paste": {
1947
- const item2 = [];
1947
+ const item = [];
1948
1948
  const map = operation.itemsMap;
1949
1949
  for (const key in map) {
1950
1950
  if (map.hasOwnProperty(key)) {
1951
- item2.push(key);
1951
+ item.push(key);
1952
1952
  }
1953
1953
  }
1954
1954
  return {
1955
1955
  class: "Board",
1956
1956
  method: "remove",
1957
- item: item2
1957
+ item
1958
1958
  };
1959
1959
  }
1960
1960
  }
@@ -8272,11 +8272,11 @@ class SubjectOperation {
8272
8272
  }
8273
8273
 
8274
8274
  // src/Items/ItemsCommandUtils.ts
8275
- function mapItemsByOperation(item2, getCallback) {
8276
- const items = Array.isArray(item2) ? item2 : [item2];
8277
- return items.map((item3) => {
8278
- const operation = getCallback(item3);
8279
- return { item: item3, operation };
8275
+ function mapItemsByOperation(item, getCallback) {
8276
+ const items = Array.isArray(item) ? item : [item];
8277
+ return items.map((item2) => {
8278
+ const operation = getCallback(item2);
8279
+ return { item: item2, operation };
8280
8280
  });
8281
8281
  }
8282
8282
 
@@ -8301,8 +8301,8 @@ class TransformationCommand {
8301
8301
  }
8302
8302
  }
8303
8303
  revert() {
8304
- this.reverse.forEach(({ item: item2, operation }) => {
8305
- item2.apply(operation);
8304
+ this.reverse.forEach(({ item, operation }) => {
8305
+ item.apply(operation);
8306
8306
  });
8307
8307
  }
8308
8308
  getReverse() {
@@ -9044,8 +9044,8 @@ class Path {
9044
9044
  }
9045
9045
  getIntersectionPoints(segment) {
9046
9046
  let intersections = [];
9047
- for (const item2 of this.segments) {
9048
- intersections = intersections.concat(item2.getIntersectionPoints(segment));
9047
+ for (const item of this.segments) {
9048
+ intersections = intersections.concat(item.getIntersectionPoints(segment));
9049
9049
  }
9050
9050
  return intersections;
9051
9051
  }
@@ -9110,8 +9110,8 @@ class Path {
9110
9110
  }
9111
9111
  isOpenEnclosedOrCrossedBy(rectangle) {
9112
9112
  let is = false;
9113
- for (const item2 of this.segments) {
9114
- is = is || item2.isEnclosedOrCrossedBy(rectangle);
9113
+ for (const item of this.segments) {
9114
+ is = is || item.isEnclosedOrCrossedBy(rectangle);
9115
9115
  }
9116
9116
  return is;
9117
9117
  }
@@ -9524,8 +9524,8 @@ class ConnectorCommand {
9524
9524
  }
9525
9525
  }
9526
9526
  revert() {
9527
- for (const { item: item2, operation } of this.reverse) {
9528
- item2.apply(operation);
9527
+ for (const { item, operation } of this.reverse) {
9528
+ item.apply(operation);
9529
9529
  }
9530
9530
  }
9531
9531
  getReverse() {
@@ -9682,11 +9682,11 @@ class SessionStorage {
9682
9682
  }
9683
9683
  get(key) {
9684
9684
  const boardId = this.getBoardId() || "";
9685
- const item2 = _sessionStorage.getItem(boardId + "_" + key);
9686
- if (!item2) {
9685
+ const item = _sessionStorage.getItem(boardId + "_" + key);
9686
+ if (!item) {
9687
9687
  return;
9688
9688
  }
9689
- return JSON.parse(item2);
9689
+ return JSON.parse(item);
9690
9690
  }
9691
9691
  remove(key) {
9692
9692
  const boardId = this.getBoardId() || "";
@@ -10466,8 +10466,8 @@ class LinkToCommand {
10466
10466
  }
10467
10467
  }
10468
10468
  revert() {
10469
- this.reverse.forEach(({ item: item2, operation }) => {
10470
- item2.apply(operation);
10469
+ this.reverse.forEach(({ item, operation }) => {
10470
+ item.apply(operation);
10471
10471
  });
10472
10472
  }
10473
10473
  getReverse() {
@@ -11552,9 +11552,9 @@ function handleSplitListItem(editor) {
11552
11552
  import_slate4.Transforms.insertNodes(editor, {
11553
11553
  type: listType,
11554
11554
  listLevel: listNode.listLevel || 0,
11555
- children: itemsAfter.map((item2) => ({
11555
+ children: itemsAfter.map((item) => ({
11556
11556
  type: "list_item",
11557
- children: item2.children
11557
+ children: item.children
11558
11558
  }))
11559
11559
  }, { at: newListPath });
11560
11560
  }
@@ -15412,10 +15412,10 @@ function initializeDocument(effects) {
15412
15412
  return start;
15413
15413
  function start(code) {
15414
15414
  if (continued < stack.length) {
15415
- const item2 = stack[continued];
15416
- self2.containerState = item2[1];
15417
- ok(item2[0].continuation, "expected `continuation` to be defined on container construct");
15418
- return effects.attempt(item2[0].continuation, documentContinue, checkNewContainers)(code);
15415
+ const item = stack[continued];
15416
+ self2.containerState = item[1];
15417
+ ok(item[0].continuation, "expected `continuation` to be defined on container construct");
15418
+ return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code);
15419
15419
  }
15420
15420
  return checkNewContainers(code);
15421
15421
  }
@@ -16391,17 +16391,17 @@ class SpliceBuffer {
16391
16391
  this.setCursor(Number.POSITIVE_INFINITY);
16392
16392
  return this.left.pop();
16393
16393
  }
16394
- push(item2) {
16394
+ push(item) {
16395
16395
  this.setCursor(Number.POSITIVE_INFINITY);
16396
- this.left.push(item2);
16396
+ this.left.push(item);
16397
16397
  }
16398
16398
  pushMany(items) {
16399
16399
  this.setCursor(Number.POSITIVE_INFINITY);
16400
16400
  chunkedPush(this.left, items);
16401
16401
  }
16402
- unshift(item2) {
16402
+ unshift(item) {
16403
16403
  this.setCursor(0);
16404
- this.right.push(item2);
16404
+ this.right.push(item);
16405
16405
  }
16406
16406
  unshiftMany(items) {
16407
16407
  this.setCursor(0);
@@ -18432,8 +18432,8 @@ function initializeFactory(field) {
18432
18432
  if (list2) {
18433
18433
  ok(Array.isArray(list2), "expected `disable.null` to be populated");
18434
18434
  while (++index2 < list2.length) {
18435
- const item2 = list2[index2];
18436
- if (!item2.previous || item2.previous.call(self2, self2.previous)) {
18435
+ const item = list2[index2];
18436
+ if (!item.previous || item.previous.call(self2, self2.previous)) {
18437
18437
  return true;
18438
18438
  }
18439
18439
  }
@@ -19264,14 +19264,14 @@ function compiler(options) {
19264
19264
  length++;
19265
19265
  }
19266
19266
  if (event[1].type === types.listItemPrefix) {
19267
- const item2 = {
19267
+ const item = {
19268
19268
  type: "listItem",
19269
19269
  _spread: false,
19270
19270
  start: Object.assign({}, event[1].start),
19271
19271
  end: undefined
19272
19272
  };
19273
- listItem2 = item2;
19274
- events.splice(index2, 0, ["enter", item2, event[2]]);
19273
+ listItem2 = item;
19274
+ events.splice(index2, 0, ["enter", item, event[2]]);
19275
19275
  index2++;
19276
19276
  length++;
19277
19277
  firstBlankLineIndex = undefined;
@@ -19903,14 +19903,14 @@ class MarkdownProcessor {
19903
19903
  if (err || !file) {
19904
19904
  throw err;
19905
19905
  }
19906
- const nodes = file.result.map((item2) => {
19906
+ const nodes = file.result.map((item) => {
19907
19907
  setNodeStyles({
19908
- node: item2,
19908
+ node: item,
19909
19909
  editor: this.editor,
19910
19910
  horisontalAlignment: "left",
19911
- isPaddingTopNeeded: item2.type !== "code_block"
19911
+ isPaddingTopNeeded: item.type !== "code_block"
19912
19912
  });
19913
- return item2;
19913
+ return item;
19914
19914
  });
19915
19915
  if (isNewParagraphNeeded) {
19916
19916
  nodes.push(createParagraphNode("", this.editor));
@@ -20888,8 +20888,8 @@ class ShapeCommand {
20888
20888
  }
20889
20889
  }
20890
20890
  revert() {
20891
- for (const { item: item2, operation } of this.reverse) {
20892
- item2.apply(operation);
20891
+ for (const { item, operation } of this.reverse) {
20892
+ item.apply(operation);
20893
20893
  }
20894
20894
  }
20895
20895
  getReverse() {
@@ -20971,8 +20971,8 @@ class RichTextCommand {
20971
20971
  }
20972
20972
  }
20973
20973
  revert() {
20974
- for (const { item: item2, operation } of this.reverse) {
20975
- const richText = this.board.items.getById(item2);
20974
+ for (const { item, operation } of this.reverse) {
20975
+ const richText = this.board.items.getById(item);
20976
20976
  if (!richText) {
20977
20977
  continue;
20978
20978
  }
@@ -20991,12 +20991,12 @@ class RichTextCommand {
20991
20991
  case "setSelectionFontColor":
20992
20992
  case "setSelectionBlockType":
20993
20993
  const inverseOps = this.operation.ops.map((op) => import_slate33.Operation.inverse(op)).reverse();
20994
- return items.map((item2) => {
20994
+ return items.map((item) => {
20995
20995
  const operation = {
20996
20996
  ...this.operation,
20997
20997
  ops: inverseOps
20998
20998
  };
20999
- return { item: item2, operation };
20999
+ return { item, operation };
21000
21000
  });
21001
21001
  case "setFontColor":
21002
21002
  return items.map((id) => ({
@@ -21088,13 +21088,13 @@ class RichTextGroupCommand {
21088
21088
  this.reverseOps = this.getReverse();
21089
21089
  }
21090
21090
  apply() {
21091
- for (const { item: item2, operation } of this.forwardOps) {
21092
- item2.applyCommand(operation);
21091
+ for (const { item, operation } of this.forwardOps) {
21092
+ item.applyCommand(operation);
21093
21093
  }
21094
21094
  }
21095
21095
  revert() {
21096
- for (const { item: item2, operation } of this.reverseOps) {
21097
- item2.applyCommand(operation);
21096
+ for (const { item, operation } of this.reverseOps) {
21097
+ item.applyCommand(operation);
21098
21098
  }
21099
21099
  }
21100
21100
  getForward() {
@@ -21209,8 +21209,8 @@ class DrawingCommand {
21209
21209
  item;
21210
21210
  operation;
21211
21211
  reverse;
21212
- constructor(item2, operation) {
21213
- this.item = item2;
21212
+ constructor(item, operation) {
21213
+ this.item = item;
21214
21214
  this.operation = operation;
21215
21215
  this.reverse = this.getReverse();
21216
21216
  }
@@ -21219,52 +21219,52 @@ class DrawingCommand {
21219
21219
  return this;
21220
21220
  }
21221
21221
  apply() {
21222
- for (const item2 of this.item) {
21223
- item2.apply(this.operation);
21222
+ for (const item of this.item) {
21223
+ item.apply(this.operation);
21224
21224
  }
21225
21225
  }
21226
21226
  revert() {
21227
- for (const { item: item2, operation } of this.reverse) {
21228
- item2.apply(operation);
21227
+ for (const { item, operation } of this.reverse) {
21228
+ item.apply(operation);
21229
21229
  }
21230
21230
  }
21231
21231
  getReverse() {
21232
21232
  const reverse = [];
21233
- for (const item2 of this.item) {
21234
- reverse.push({ item: item2, operation: this.getReverseOperation(item2) });
21233
+ for (const item of this.item) {
21234
+ reverse.push({ item, operation: this.getReverseOperation(item) });
21235
21235
  }
21236
21236
  return reverse;
21237
21237
  }
21238
- getReverseOperation(item2) {
21238
+ getReverseOperation(item) {
21239
21239
  switch (this.operation.method) {
21240
21240
  case "setStrokeColor":
21241
21241
  return {
21242
21242
  class: "Drawing",
21243
21243
  method: "setStrokeColor",
21244
- item: [item2.getId()],
21245
- color: item2.getStrokeColor()
21244
+ item: [item.getId()],
21245
+ color: item.getStrokeColor()
21246
21246
  };
21247
21247
  case "setStrokeWidth":
21248
21248
  return {
21249
21249
  class: "Drawing",
21250
21250
  method: "setStrokeWidth",
21251
- item: [item2.getId()],
21251
+ item: [item.getId()],
21252
21252
  width: this.operation.prevWidth,
21253
- prevWidth: item2.getStrokeWidth()
21253
+ prevWidth: item.getStrokeWidth()
21254
21254
  };
21255
21255
  case "setStrokeOpacity":
21256
21256
  return {
21257
21257
  class: "Drawing",
21258
21258
  method: "setStrokeOpacity",
21259
- item: [item2.getId()],
21260
- opacity: item2.getStrokeOpacity()
21259
+ item: [item.getId()],
21260
+ opacity: item.getStrokeOpacity()
21261
21261
  };
21262
21262
  case "setStrokeStyle":
21263
21263
  return {
21264
21264
  class: "Drawing",
21265
21265
  method: "setStrokeStyle",
21266
- item: [item2.getId()],
21267
- style: item2.getBorderStyle()
21266
+ item: [item.getId()],
21267
+ style: item.getBorderStyle()
21268
21268
  };
21269
21269
  }
21270
21270
  }
@@ -21286,8 +21286,8 @@ class StickerCommand {
21286
21286
  }
21287
21287
  }
21288
21288
  revert() {
21289
- for (const { item: item2, operation } of this.reverse) {
21290
- item2.apply(operation);
21289
+ for (const { item, operation } of this.reverse) {
21290
+ item.apply(operation);
21291
21291
  }
21292
21292
  }
21293
21293
  getReverse() {
@@ -21319,8 +21319,8 @@ class FrameCommand {
21319
21319
  }
21320
21320
  }
21321
21321
  revert() {
21322
- for (const { item: item2, operation } of this.reverse) {
21323
- item2.apply(operation);
21322
+ for (const { item, operation } of this.reverse) {
21323
+ item.apply(operation);
21324
21324
  }
21325
21325
  }
21326
21326
  getReverse() {
@@ -21362,21 +21362,23 @@ class FrameCommand {
21362
21362
  };
21363
21363
  });
21364
21364
  default:
21365
- const op = this.operation;
21366
- let newData = {};
21367
- if (op.prevData) {
21368
- newData = { ...op.prevData };
21369
- } else {
21370
- Object.keys(op.newData).forEach((key) => {
21371
- if (item[key]) {
21372
- newData[key] = item[key];
21373
- }
21374
- });
21375
- }
21376
- return {
21377
- ...op,
21378
- newData
21379
- };
21365
+ return mapItemsByOperation(frame, (item) => {
21366
+ const op = this.operation;
21367
+ let newData = {};
21368
+ if (op.prevData) {
21369
+ newData = { ...op.prevData };
21370
+ } else {
21371
+ Object.keys(op.newData).forEach((key) => {
21372
+ if (item[key]) {
21373
+ newData[key] = item[key];
21374
+ }
21375
+ });
21376
+ }
21377
+ return {
21378
+ ...op,
21379
+ newData
21380
+ };
21381
+ });
21380
21382
  }
21381
21383
  }
21382
21384
  }
@@ -21397,8 +21399,8 @@ class CommentCommand {
21397
21399
  }
21398
21400
  }
21399
21401
  revert() {
21400
- this.reverse.forEach(({ item: item2, operation }) => {
21401
- item2.apply(operation);
21402
+ this.reverse.forEach(({ item, operation }) => {
21403
+ item.apply(operation);
21402
21404
  });
21403
21405
  }
21404
21406
  getReverse() {
@@ -21859,8 +21861,8 @@ class GroupCommand {
21859
21861
  }
21860
21862
  }
21861
21863
  revert() {
21862
- for (const { item: item2, operation } of this.reverse) {
21863
- item2.apply(operation);
21864
+ for (const { item, operation } of this.reverse) {
21865
+ item.apply(operation);
21864
21866
  }
21865
21867
  }
21866
21868
  getReverse() {
@@ -21913,8 +21915,8 @@ class PlaceholderCommand {
21913
21915
  }
21914
21916
  }
21915
21917
  revert() {
21916
- for (const { item: item2, operation } of this.reverse) {
21917
- item2.apply(operation);
21918
+ for (const { item, operation } of this.reverse) {
21919
+ item.apply(operation);
21918
21920
  }
21919
21921
  }
21920
21922
  getReverse() {
@@ -22008,26 +22010,26 @@ class BaseCommand {
22008
22010
  return this;
22009
22011
  }
22010
22012
  apply() {
22011
- for (const item2 of this.items) {
22012
- item2.apply(this.operation);
22013
+ for (const item of this.items) {
22014
+ item.apply(this.operation);
22013
22015
  }
22014
22016
  }
22015
22017
  revert() {
22016
- for (const { item: item2, operation } of this.reverse) {
22017
- item2.apply(operation);
22018
+ for (const { item, operation } of this.reverse) {
22019
+ item.apply(operation);
22018
22020
  }
22019
22021
  }
22020
22022
  getReverse() {
22021
22023
  const items = this.items;
22022
- return mapItemsByOperation(items, (item2) => {
22024
+ return mapItemsByOperation(items, (item) => {
22023
22025
  const op = this.operation;
22024
22026
  let newData = {};
22025
22027
  if (op.prevData) {
22026
22028
  newData = { ...op.prevData };
22027
22029
  } else {
22028
22030
  Object.keys(op.newData).forEach((key) => {
22029
- if (item2[key]) {
22030
- newData[key] = item2[key];
22031
+ if (item[key]) {
22032
+ newData[key] = item[key];
22031
22033
  }
22032
22034
  });
22033
22035
  }
@@ -22055,37 +22057,37 @@ var itemCommandFactories = {
22055
22057
  LinkTo: createLinkToCommand
22056
22058
  };
22057
22059
  function createConnectorCommand(items, operation) {
22058
- return new ConnectorCommand(items.filter((item2) => item2.itemType === "Connector"), operation);
22060
+ return new ConnectorCommand(items.filter((item) => item.itemType === "Connector"), operation);
22059
22061
  }
22060
22062
  function createShapeCommand(items, operation) {
22061
- return new ShapeCommand(items.filter((item2) => item2.itemType === "Shape"), operation);
22063
+ return new ShapeCommand(items.filter((item) => item.itemType === "Shape"), operation);
22062
22064
  }
22063
22065
  function createDrawingCommand(items, operation) {
22064
- return new DrawingCommand(items.filter((item2) => item2.itemType === "Drawing"), operation);
22066
+ return new DrawingCommand(items.filter((item) => item.itemType === "Drawing"), operation);
22065
22067
  }
22066
22068
  function createCommentCommand(items, operation) {
22067
- return new CommentCommand(items.filter((item2) => item2.itemType === "Comment"), operation);
22069
+ return new CommentCommand(items.filter((item) => item.itemType === "Comment"), operation);
22068
22070
  }
22069
22071
  function createStickerCommand(items, operation) {
22070
- return new StickerCommand(items.filter((item2) => item2.itemType === "Sticker"), operation);
22072
+ return new StickerCommand(items.filter((item) => item.itemType === "Sticker"), operation);
22071
22073
  }
22072
22074
  function createFrameCommand(items, operation) {
22073
- return new FrameCommand(items.filter((item2) => item2.itemType === "Frame"), operation);
22075
+ return new FrameCommand(items.filter((item) => item.itemType === "Frame"), operation);
22074
22076
  }
22075
22077
  function createPlaceholderCommand(items, operation) {
22076
- return new PlaceholderCommand(items.filter((item2) => item2.itemType === "Placeholder"), operation);
22078
+ return new PlaceholderCommand(items.filter((item) => item.itemType === "Placeholder"), operation);
22077
22079
  }
22078
22080
  function createGroupCommand(items, operation) {
22079
- return new GroupCommand(items.filter((item2) => item2.itemType === "Group"), operation);
22081
+ return new GroupCommand(items.filter((item) => item.itemType === "Group"), operation);
22080
22082
  }
22081
22083
  function createImageCommand(items, operation) {
22082
- return new ImageCommand(items.filter((item2) => item2.itemType === "Image"), operation);
22084
+ return new ImageCommand(items.filter((item) => item.itemType === "Image"), operation);
22083
22085
  }
22084
22086
  function createVideoCommand(items, operation) {
22085
- return new VideoCommand(items.filter((item2) => item2.itemType === "Video"), operation);
22087
+ return new VideoCommand(items.filter((item) => item.itemType === "Video"), operation);
22086
22088
  }
22087
22089
  function createAudioCommand(items, operation) {
22088
- return new AudioCommand(items.filter((item2) => item2.itemType === "Audio"), operation);
22090
+ return new AudioCommand(items.filter((item) => item.itemType === "Audio"), operation);
22089
22091
  }
22090
22092
  function createRichTextCommand(items, operation, board) {
22091
22093
  if (!board) {
@@ -22093,8 +22095,8 @@ function createRichTextCommand(items, operation, board) {
22093
22095
  }
22094
22096
  if (operation.method === "groupEdit") {
22095
22097
  const texts = [];
22096
- for (const { item: item2 } of operation.itemsOps) {
22097
- const found = board.items.findById(item2);
22098
+ for (const { item } of operation.itemsOps) {
22099
+ const found = board.items.findById(item);
22098
22100
  const text3 = found?.getRichText();
22099
22101
  if (text3) {
22100
22102
  texts.push(text3);
@@ -22102,14 +22104,14 @@ function createRichTextCommand(items, operation, board) {
22102
22104
  }
22103
22105
  return new RichTextGroupCommand(texts, operation);
22104
22106
  } else {
22105
- return new RichTextCommand(board, items.map((item2) => item2.getId()), operation);
22107
+ return new RichTextCommand(board, items.map((item) => item.getId()), operation);
22106
22108
  }
22107
22109
  }
22108
22110
  function createTransformationCommand(items, operation) {
22109
- return new TransformationCommand(items.map((item2) => item2.transformation), operation);
22111
+ return new TransformationCommand(items.map((item) => item.transformation), operation);
22110
22112
  }
22111
22113
  function createLinkToCommand(items, operation) {
22112
- return new LinkToCommand(items.map((item2) => item2.linkTo), operation);
22114
+ return new LinkToCommand(items.map((item) => item.linkTo), operation);
22113
22115
  }
22114
22116
  function createCommand(board, operation) {
22115
22117
  try {
@@ -22127,13 +22129,13 @@ function createCommand(board, operation) {
22127
22129
  default: {
22128
22130
  const itemType = operation.class;
22129
22131
  const itemIdList = "item" in operation ? Array.isArray(operation.item) ? operation.item : [operation.item] : ("items" in operation) ? Object.keys(operation.items) : operation.itemsOps.map((itemOp) => itemOp.item);
22130
- const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item2) => {
22131
- if (typeof item2 === "string") {
22132
- console.warn(`Item with ID ${item2} not found for operation ${operation.class}.${operation.method}`);
22132
+ const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item) => {
22133
+ if (typeof item === "string") {
22134
+ console.warn(`Item with ID ${item} not found for operation ${operation.class}.${operation.method}`);
22133
22135
  return false;
22134
22136
  }
22135
- if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item2.itemType !== operation.class) {
22136
- console.warn(`Item with ID ${item2} is not of operation type: ${itemType}.`);
22137
+ if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item.itemType !== operation.class) {
22138
+ console.warn(`Item with ID ${item} is not of operation type: ${itemType}.`);
22137
22139
  return false;
22138
22140
  }
22139
22141
  return true;
@@ -22434,20 +22436,20 @@ class RBush {
22434
22436
  }
22435
22437
  return this;
22436
22438
  }
22437
- insert(item2) {
22438
- if (item2)
22439
- this._insert(item2, this.data.height - 1);
22439
+ insert(item) {
22440
+ if (item)
22441
+ this._insert(item, this.data.height - 1);
22440
22442
  return this;
22441
22443
  }
22442
22444
  clear() {
22443
22445
  this.data = createNode([]);
22444
22446
  return this;
22445
22447
  }
22446
- remove(item2, equalsFn) {
22447
- if (!item2)
22448
+ remove(item, equalsFn) {
22449
+ if (!item)
22448
22450
  return this;
22449
22451
  let node2 = this.data;
22450
- const bbox = this.toBBox(item2);
22452
+ const bbox = this.toBBox(item);
22451
22453
  const path2 = [];
22452
22454
  const indexes = [];
22453
22455
  let i, parent, goingUp;
@@ -22459,7 +22461,7 @@ class RBush {
22459
22461
  goingUp = true;
22460
22462
  }
22461
22463
  if (node2.leaf) {
22462
- const index2 = findItem(item2, node2.children, equalsFn);
22464
+ const index2 = findItem(item, node2.children, equalsFn);
22463
22465
  if (index2 !== -1) {
22464
22466
  node2.children.splice(index2, 1);
22465
22467
  path2.push(node2);
@@ -22482,8 +22484,8 @@ class RBush {
22482
22484
  }
22483
22485
  return this;
22484
22486
  }
22485
- toBBox(item2) {
22486
- return item2;
22487
+ toBBox(item) {
22488
+ return item;
22487
22489
  }
22488
22490
  compareMinX(a, b) {
22489
22491
  return a.minX - b.minX;
@@ -22566,11 +22568,11 @@ class RBush {
22566
22568
  }
22567
22569
  return node2;
22568
22570
  }
22569
- _insert(item2, level, isNode) {
22570
- const bbox = isNode ? item2 : this.toBBox(item2);
22571
+ _insert(item, level, isNode) {
22572
+ const bbox = isNode ? item : this.toBBox(item);
22571
22573
  const insertPath = [];
22572
22574
  const node2 = this._chooseSubtree(bbox, this.data, level, insertPath);
22573
- node2.children.push(item2);
22575
+ node2.children.push(item);
22574
22576
  extend2(node2, bbox);
22575
22577
  while (level >= 0) {
22576
22578
  if (insertPath[level].children.length > this._maxEntries) {
@@ -22669,11 +22671,11 @@ class RBush {
22669
22671
  }
22670
22672
  }
22671
22673
  }
22672
- function findItem(item2, items, equalsFn) {
22674
+ function findItem(item, items, equalsFn) {
22673
22675
  if (!equalsFn)
22674
- return items.indexOf(item2);
22676
+ return items.indexOf(item);
22675
22677
  for (let i = 0;i < items.length; i++) {
22676
- if (equalsFn(item2, items[i]))
22678
+ if (equalsFn(item, items[i]))
22677
22679
  return i;
22678
22680
  }
22679
22681
  return -1;
@@ -22835,10 +22837,10 @@ class RTreeIndex {
22835
22837
  return container ? container.item : undefined;
22836
22838
  }
22837
22839
  remove(id) {
22838
- const item2 = this.map.get(id);
22839
- if (item2) {
22840
+ const item = this.map.get(id);
22841
+ if (item) {
22840
22842
  this.map.delete(id);
22841
- this.tree.remove(item2);
22843
+ this.tree.remove(item);
22842
22844
  }
22843
22845
  }
22844
22846
  list() {
@@ -22910,11 +22912,11 @@ class Container extends Mbr {
22910
22912
  item;
22911
22913
  layer;
22912
22914
  zIndex;
22913
- constructor(id, item2, layer, zIndex) {
22914
- const rect = item2.getMbrWithChildren();
22915
+ constructor(id, item, layer, zIndex) {
22916
+ const rect = item.getMbrWithChildren();
22915
22917
  super(rect.left, rect.top, rect.right, rect.bottom);
22916
22918
  this.id = id;
22917
- this.item = item2;
22919
+ this.item = item;
22918
22920
  this.layer = layer;
22919
22921
  this.zIndex = zIndex;
22920
22922
  }
@@ -22931,7 +22933,7 @@ class LayeredIndex {
22931
22933
  this.getZIndex = this.getZIndex.bind(this);
22932
22934
  this.layers.newOnTop();
22933
22935
  }
22934
- isT(item2) {
22936
+ isT(item) {
22935
22937
  return true;
22936
22938
  }
22937
22939
  findById(id) {
@@ -22995,8 +22997,8 @@ class LayeredIndex {
22995
22997
  }
22996
22998
  getContainersFromItems(items) {
22997
22999
  const containers = [];
22998
- for (const item2 of items) {
22999
- const container = this.map.get(item2.getId());
23000
+ for (const item of items) {
23001
+ const container = this.map.get(item.getId());
23000
23002
  if (container) {
23001
23003
  containers.push(container);
23002
23004
  }
@@ -23073,9 +23075,9 @@ class LayeredIndex {
23073
23075
  }
23074
23076
  }
23075
23077
  }
23076
- insert(item2) {
23077
- const toInsert = new Container(item2.getId(), item2, 0, this.getZIndex(item2));
23078
- const bounds = item2.getMbrWithChildren();
23078
+ insert(item) {
23079
+ const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
23080
+ const bounds = item.getMbrWithChildren();
23079
23081
  const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
23080
23082
  if (inBounds.length === 0) {
23081
23083
  return this.insertContainer(toInsert);
@@ -23142,20 +23144,20 @@ class LayeredIndex {
23142
23144
  }
23143
23145
  }
23144
23146
  }
23145
- change(item2) {
23146
- const id = item2.getId();
23147
+ change(item) {
23148
+ const id = item.getId();
23147
23149
  const container = this.map.get(id);
23148
23150
  if (container) {
23149
23151
  const layer = this.layers.get(container.layer);
23150
23152
  if (layer) {
23151
23153
  layer.remove(id);
23152
23154
  this.map.delete(id);
23153
- this.insert(item2);
23155
+ this.insert(item);
23154
23156
  }
23155
23157
  }
23156
23158
  }
23157
- remove(item2) {
23158
- const id = item2.getId();
23159
+ remove(item) {
23160
+ const id = item.getId();
23159
23161
  const container = this.map.get(id);
23160
23162
  if (container) {
23161
23163
  const layer = this.layers.get(container.layer);
@@ -23181,13 +23183,13 @@ class LayeredIndex {
23181
23183
  return items;
23182
23184
  }
23183
23185
  batchInsert(items) {
23184
- for (const item2 of items) {
23185
- this.insert(item2);
23186
+ for (const item of items) {
23187
+ this.insert(item);
23186
23188
  }
23187
23189
  }
23188
23190
  batchChange(items) {
23189
- for (const item2 of items) {
23190
- this.change(item2);
23191
+ for (const item of items) {
23192
+ this.change(item);
23191
23193
  }
23192
23194
  }
23193
23195
  }
@@ -23196,8 +23198,8 @@ class LayeredIndex {
23196
23198
  class SpatialIndex {
23197
23199
  subject = new Subject;
23198
23200
  itemsArray = [];
23199
- itemsIndex = new LayeredIndex((item2) => {
23200
- return this.itemsArray.indexOf(item2);
23201
+ itemsIndex = new LayeredIndex((item) => {
23202
+ return this.itemsArray.indexOf(item);
23201
23203
  });
23202
23204
  Mbr = new Mbr;
23203
23205
  items;
@@ -23206,79 +23208,79 @@ class SpatialIndex {
23206
23208
  }
23207
23209
  clear() {
23208
23210
  this.itemsArray = [];
23209
- this.itemsIndex = new LayeredIndex((item2) => {
23210
- return this.itemsArray.indexOf(item2);
23211
+ this.itemsIndex = new LayeredIndex((item) => {
23212
+ return this.itemsArray.indexOf(item);
23211
23213
  });
23212
23214
  this.Mbr = new Mbr;
23213
23215
  }
23214
- insert(item2) {
23215
- this.itemsArray.push(item2);
23216
- this.itemsIndex.insert(item2);
23216
+ insert(item) {
23217
+ this.itemsArray.push(item);
23218
+ this.itemsIndex.insert(item);
23217
23219
  if (conf.isNode()) {
23218
23220
  return;
23219
23221
  }
23220
23222
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
23221
- this.Mbr = item2.getMbr().copy();
23223
+ this.Mbr = item.getMbr().copy();
23222
23224
  } else {
23223
- this.Mbr.combine([item2.getMbr()]);
23225
+ this.Mbr.combine([item.getMbr()]);
23224
23226
  }
23225
- item2.subject.subscribe(this.change);
23227
+ item.subject.subscribe(this.change);
23226
23228
  this.subject.publish(this.items);
23227
23229
  }
23228
- change = (item2) => {
23229
- this.itemsIndex.change(item2);
23230
+ change = (item) => {
23231
+ this.itemsIndex.change(item);
23230
23232
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
23231
- this.Mbr = item2.getMbrWithChildren().copy();
23233
+ this.Mbr = item.getMbrWithChildren().copy();
23232
23234
  } else {
23233
- this.Mbr.combine([item2.getMbrWithChildren()]);
23235
+ this.Mbr.combine([item.getMbrWithChildren()]);
23234
23236
  }
23235
23237
  this.subject.publish(this.items);
23236
23238
  };
23237
- remove(item2) {
23238
- if ("index" in item2 && item2.index) {
23239
- item2.removeChildItems(item2.index.list());
23239
+ remove(item) {
23240
+ if ("index" in item && item.index) {
23241
+ item.removeChildItems(item.index.list());
23240
23242
  }
23241
- this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
23242
- this.itemsIndex.remove(item2);
23243
+ this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
23244
+ this.itemsIndex.remove(item);
23243
23245
  this.Mbr = new Mbr;
23244
- this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbrWithChildren()]));
23246
+ this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbrWithChildren()]));
23245
23247
  this.subject.publish(this.items);
23246
23248
  }
23247
23249
  copy() {
23248
- return this.getItemsWithIncludedChildren(this.itemsArray).map((item2) => ({
23249
- ...item2.serialize(true),
23250
- id: item2.getId()
23250
+ return this.getItemsWithIncludedChildren(this.itemsArray).map((item) => ({
23251
+ ...item.serialize(true),
23252
+ id: item.getId()
23251
23253
  }));
23252
23254
  }
23253
23255
  getItemsWithIncludedChildren(items) {
23254
- return items.flatMap((item2) => {
23255
- if ("index" in item2 && item2.index) {
23256
- return [item2, ...item2.index.list()];
23256
+ return items.flatMap((item) => {
23257
+ if ("index" in item && item.index) {
23258
+ return [item, ...item.index.list()];
23257
23259
  }
23258
- return item2;
23260
+ return item;
23259
23261
  });
23260
23262
  }
23261
- getItemChildren(item2) {
23262
- if ("index" in item2 && item2.index) {
23263
- return item2.index.list();
23263
+ getItemChildren(item) {
23264
+ if ("index" in item && item.index) {
23265
+ return item.index.list();
23264
23266
  }
23265
23267
  return [];
23266
23268
  }
23267
- getItemParent(item2) {
23268
- if (item2.parent === "Board") {
23269
+ getItemParent(item) {
23270
+ if (item.parent === "Board") {
23269
23271
  return;
23270
23272
  }
23271
- return this.getById(item2.parent);
23273
+ return this.getById(item.parent);
23272
23274
  }
23273
- moveToZIndex(item2, zIndex) {
23274
- const index2 = this.itemsArray.indexOf(item2);
23275
+ moveToZIndex(item, zIndex) {
23276
+ const index2 = this.itemsArray.indexOf(item);
23275
23277
  this.itemsArray.splice(index2, 1);
23276
- this.itemsArray.splice(zIndex, 0, item2);
23277
- this.change(item2);
23278
+ this.itemsArray.splice(zIndex, 0, item);
23279
+ this.change(item);
23278
23280
  this.subject.publish(this.items);
23279
23281
  }
23280
23282
  moveManyToZIndex(itemsRecord) {
23281
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
23283
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
23282
23284
  const zIndex = Object.values(itemsRecord);
23283
23285
  for (let i = 0;i < zIndex.length; i++) {
23284
23286
  const index2 = zIndex[i];
@@ -23286,39 +23288,39 @@ class SpatialIndex {
23286
23288
  }
23287
23289
  this.itemsArray.forEach(this.change.bind(this));
23288
23290
  }
23289
- sendToBack(item2, shouldPublish = true) {
23290
- const index2 = this.itemsArray.indexOf(item2);
23291
+ sendToBack(item, shouldPublish = true) {
23292
+ const index2 = this.itemsArray.indexOf(item);
23291
23293
  this.itemsArray.splice(index2, 1);
23292
- this.itemsArray.unshift(item2);
23293
- this.itemsIndex.change(item2);
23294
+ this.itemsArray.unshift(item);
23295
+ this.itemsIndex.change(item);
23294
23296
  if (shouldPublish) {
23295
23297
  this.subject.publish(this.items);
23296
23298
  }
23297
23299
  }
23298
23300
  sendManyToBack(items) {
23299
23301
  const newItems = [...items];
23300
- this.itemsArray.forEach((item2) => {
23301
- if (!items.includes(item2)) {
23302
- newItems.push(item2);
23302
+ this.itemsArray.forEach((item) => {
23303
+ if (!items.includes(item)) {
23304
+ newItems.push(item);
23303
23305
  }
23304
23306
  });
23305
23307
  this.itemsArray = newItems;
23306
23308
  this.itemsArray.forEach(this.change.bind(this));
23307
23309
  }
23308
- bringToFront(item2, shouldPublish = true) {
23309
- const index2 = this.itemsArray.indexOf(item2);
23310
+ bringToFront(item, shouldPublish = true) {
23311
+ const index2 = this.itemsArray.indexOf(item);
23310
23312
  this.itemsArray.splice(index2, 1);
23311
- this.itemsArray.push(item2);
23312
- this.itemsIndex.change(item2);
23313
+ this.itemsArray.push(item);
23314
+ this.itemsIndex.change(item);
23313
23315
  if (shouldPublish) {
23314
23316
  this.subject.publish(this.items);
23315
23317
  }
23316
23318
  }
23317
23319
  bringManyToFront(items) {
23318
23320
  const newItems = [];
23319
- this.itemsArray.forEach((item2) => {
23320
- if (!items.includes(item2)) {
23321
- newItems.push(item2);
23321
+ this.itemsArray.forEach((item) => {
23322
+ if (!items.includes(item)) {
23323
+ newItems.push(item);
23322
23324
  }
23323
23325
  });
23324
23326
  newItems.push(...items);
@@ -23344,9 +23346,9 @@ class SpatialIndex {
23344
23346
  this.subject.publish(this.items);
23345
23347
  }
23346
23348
  getById(id) {
23347
- const item2 = this.getItemsWithIncludedChildren(this.itemsArray).find((item3) => item3.getId() === id);
23348
- if (item2) {
23349
- return item2;
23349
+ const item = this.getItemsWithIncludedChildren(this.itemsArray).find((item2) => item2.getId() === id);
23350
+ if (item) {
23351
+ return item;
23350
23352
  }
23351
23353
  }
23352
23354
  findById(id) {
@@ -23356,10 +23358,10 @@ class SpatialIndex {
23356
23358
  const mbr = new Mbr(left, top, right, bottom);
23357
23359
  const items = this.itemsIndex.getEnclosed(mbr);
23358
23360
  const children = [];
23359
- const clearItems = items.filter((item2) => {
23360
- if ("index" in item2 && item2.index) {
23361
- children.push(...item2.index.getEnclosed(left, top, right, bottom));
23362
- if (!item2.getMbr().isEnclosedBy(mbr)) {
23361
+ const clearItems = items.filter((item) => {
23362
+ if ("index" in item && item.index) {
23363
+ children.push(...item.index.getEnclosed(left, top, right, bottom));
23364
+ if (!item.getMbr().isEnclosedBy(mbr)) {
23363
23365
  return false;
23364
23366
  }
23365
23367
  }
@@ -23371,10 +23373,10 @@ class SpatialIndex {
23371
23373
  const mbr = new Mbr(left, top, right, bottom);
23372
23374
  const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
23373
23375
  const children = [];
23374
- const clearItems = items.filter((item2) => {
23375
- if ("index" in item2 && item2.index) {
23376
- children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
23377
- if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
23376
+ const clearItems = items.filter((item) => {
23377
+ if ("index" in item && item.index) {
23378
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
23379
+ if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
23378
23380
  return false;
23379
23381
  }
23380
23382
  }
@@ -23385,10 +23387,10 @@ class SpatialIndex {
23385
23387
  getUnderPoint(point3, tolerance = 5) {
23386
23388
  const items = this.itemsIndex.getUnderPoint(point3, tolerance);
23387
23389
  const children = [];
23388
- const clearItems = items.filter((item2) => {
23389
- if ("index" in item2 && item2.index) {
23390
- children.push(...item2.index.getUnderPoint(point3, tolerance));
23391
- if (!item2.getMbr().isUnderPoint(point3)) {
23390
+ const clearItems = items.filter((item) => {
23391
+ if ("index" in item && item.index) {
23392
+ children.push(...item.index.getUnderPoint(point3, tolerance));
23393
+ if (!item.getMbr().isUnderPoint(point3)) {
23392
23394
  return false;
23393
23395
  }
23394
23396
  }
@@ -23400,10 +23402,10 @@ class SpatialIndex {
23400
23402
  const mbr = new Mbr(left, top, right, bottom);
23401
23403
  const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
23402
23404
  const children = [];
23403
- const clearItems = items.filter((item2) => {
23404
- if ("index" in item2 && item2.index) {
23405
- children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
23406
- if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
23405
+ const clearItems = items.filter((item) => {
23406
+ if ("index" in item && item.index) {
23407
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
23408
+ if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
23407
23409
  return false;
23408
23410
  }
23409
23411
  }
@@ -23415,26 +23417,26 @@ class SpatialIndex {
23415
23417
  return this.getRectsEnclosedOrCrossed(left, top, right, bottom);
23416
23418
  }
23417
23419
  getComments() {
23418
- return this.itemsArray.filter((item2) => item2 instanceof Comment);
23420
+ return this.itemsArray.filter((item) => item instanceof Comment);
23419
23421
  }
23420
23422
  getMbr() {
23421
23423
  return this.Mbr;
23422
23424
  }
23423
23425
  getNearestTo(point3, maxItems, filter, maxDistance) {
23424
23426
  const allItems = this.getItemsWithIncludedChildren(this.itemsArray);
23425
- const filtered = allItems.filter((item2) => filter(item2));
23426
- const withDistance = filtered.map((item2) => ({
23427
- item: item2,
23428
- distance: point3.getDistance(item2.getMbr().getCenter())
23427
+ const filtered = allItems.filter((item) => filter(item));
23428
+ const withDistance = filtered.map((item) => ({
23429
+ item,
23430
+ distance: point3.getDistance(item.getMbr().getCenter())
23429
23431
  })).filter(({ distance }) => distance <= maxDistance);
23430
23432
  withDistance.sort((a, b) => a.distance - b.distance);
23431
- return withDistance.slice(0, maxItems).map(({ item: item2 }) => item2);
23433
+ return withDistance.slice(0, maxItems).map(({ item }) => item);
23432
23434
  }
23433
23435
  list() {
23434
23436
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
23435
23437
  }
23436
- getZIndex(item2) {
23437
- const index2 = this.itemsArray.indexOf(item2);
23438
+ getZIndex(item) {
23439
+ const index2 = this.itemsArray.indexOf(item);
23438
23440
  if (index2 === -1) {
23439
23441
  return this.getLastZIndex();
23440
23442
  }
@@ -23464,14 +23466,14 @@ class Items {
23464
23466
  this.pointer = pointer;
23465
23467
  this.subject = subject;
23466
23468
  }
23467
- update(item2) {
23468
- this.index.change(item2);
23469
+ update(item) {
23470
+ this.index.change(item);
23469
23471
  }
23470
23472
  listAll() {
23471
23473
  return this.index.list();
23472
23474
  }
23473
23475
  listGroupItems() {
23474
- return this.index.list().filter((item2) => ("index" in item2) && item2.index);
23476
+ return this.index.list().filter((item) => ("index" in item) && item.index);
23475
23477
  }
23476
23478
  getById(id) {
23477
23479
  return this.index.getById(id);
@@ -23486,7 +23488,7 @@ class Items {
23486
23488
  return this.index.getEnclosedOrCrossed(left, top, right, bottom);
23487
23489
  }
23488
23490
  getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
23489
- return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => item2 instanceof BaseItem && item2.index);
23491
+ return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.index);
23490
23492
  }
23491
23493
  getUnderPoint(point3, tolerance = 5) {
23492
23494
  return this.index.getUnderPoint(point3, tolerance);
@@ -23514,28 +23516,28 @@ class Items {
23514
23516
  const unmodifiedSize = size;
23515
23517
  size = 16;
23516
23518
  const tolerated = this.index.getEnclosedOrCrossed(x - size, y - size, x + size, y + size);
23517
- const groups = tolerated.filter((item2) => item2.itemType === "Group");
23519
+ const groups = tolerated.filter((item) => item.itemType === "Group");
23518
23520
  if (groups.length > 0) {
23519
23521
  return groups;
23520
23522
  }
23521
- let enclosed = tolerated.some((item2) => item2 instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
23523
+ let enclosed = tolerated.some((item) => item instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
23522
23524
  const underPointer = this.getUnderPoint(new Point(x, y), size);
23523
23525
  if (enclosed.length === 0) {
23524
23526
  enclosed = underPointer;
23525
23527
  }
23526
- if (underPointer.some((item2) => item2.itemType === "Drawing")) {
23528
+ if (underPointer.some((item) => item.itemType === "Drawing")) {
23527
23529
  enclosed = [...underPointer, ...enclosed];
23528
23530
  }
23529
- const { nearest } = enclosed.reduce((acc, item2) => {
23530
- const area = item2.getMbr().getHeight() * item2.getMbr().getWidth();
23531
- if (item2.itemType === "Drawing" && !item2.isPointNearLine(this.pointer.point)) {
23531
+ const { nearest } = enclosed.reduce((acc, item) => {
23532
+ const area = item.getMbr().getHeight() * item.getMbr().getWidth();
23533
+ if (item.itemType === "Drawing" && !item.isPointNearLine(this.pointer.point)) {
23532
23534
  return acc;
23533
23535
  }
23534
- const isItemTransparent = item2 instanceof Shape && item2?.getBackgroundColor() === "none";
23535
- const itemZIndex = this.getZIndex(item2);
23536
+ const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
23537
+ const itemZIndex = this.getZIndex(item);
23536
23538
  const accZIndex = this.getZIndex(acc.nearest);
23537
23539
  if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
23538
- return { nearest: item2, area };
23540
+ return { nearest: item, area };
23539
23541
  }
23540
23542
  return acc;
23541
23543
  }, { nearest: undefined, area: Infinity });
@@ -23547,8 +23549,8 @@ class Items {
23547
23549
  getNearPointer(maxDistance = 100, maxItems = 10, filter = () => true) {
23548
23550
  return this.index.getNearestTo(this.pointer.point, maxItems, filter, maxDistance);
23549
23551
  }
23550
- getZIndex(item2) {
23551
- return this.index.getZIndex(item2);
23552
+ getZIndex(item) {
23553
+ return this.index.getZIndex(item);
23552
23554
  }
23553
23555
  getByZIndex(index2) {
23554
23556
  return this.index.getByZIndex(index2);
@@ -23557,11 +23559,11 @@ class Items {
23557
23559
  return this.index.getLastZIndex();
23558
23560
  }
23559
23561
  getLinkedConnectorsById(id) {
23560
- return this.listAll().filter((item2) => {
23561
- if (!(item2 instanceof Connector2)) {
23562
+ return this.listAll().filter((item) => {
23563
+ if (!(item instanceof Connector2)) {
23562
23564
  return false;
23563
23565
  }
23564
- const { startItem, endItem } = item2.getConnectedItems();
23566
+ const { startItem, endItem } = item.getConnectedItems();
23565
23567
  if (startItem?.getId() === id || endItem?.getId() === id) {
23566
23568
  return true;
23567
23569
  }
@@ -23572,11 +23574,11 @@ class Items {
23572
23574
  if (!startPointerItemId && !endPointerItemId) {
23573
23575
  return [];
23574
23576
  }
23575
- return this.listAll().filter((item2) => {
23576
- if (!(item2 instanceof Connector2) || !item2.isConnected()) {
23577
+ return this.listAll().filter((item) => {
23578
+ if (!(item instanceof Connector2) || !item.isConnected()) {
23577
23579
  return false;
23578
23580
  }
23579
- const { startItem, endItem } = item2.getConnectedItems();
23581
+ const { startItem, endItem } = item.getConnectedItems();
23580
23582
  if (startPointerItemId && endPointerItemId) {
23581
23583
  if (startPointerItemId && startItem && startItem.getId() === startPointerItemId && endPointerItemId && endItem && endItem.getId() === endPointerItemId) {
23582
23584
  return true;
@@ -23594,9 +23596,9 @@ class Items {
23594
23596
  }
23595
23597
  render(context) {
23596
23598
  const items = this.getItemsInView();
23597
- items.forEach((item2) => {
23598
- if (item2.parent === "Board") {
23599
- item2.render(context);
23599
+ items.forEach((item) => {
23600
+ if (item.parent === "Board") {
23601
+ item.render(context);
23600
23602
  }
23601
23603
  });
23602
23604
  }
@@ -23609,17 +23611,17 @@ class Items {
23609
23611
  return this.getHTML(documentFactory, items);
23610
23612
  }
23611
23613
  getHTML(documentFactory, items) {
23612
- const lowestCoordinates = items.map((item2) => item2.getMbr()).reduce((acc, mbr) => ({
23614
+ const lowestCoordinates = items.map((item) => item.getMbr()).reduce((acc, mbr) => ({
23613
23615
  left: Math.min(acc.left, mbr.left),
23614
23616
  top: Math.min(acc.top, mbr.top)
23615
23617
  }), { left: 0, top: 0 });
23616
23618
  const groups = [];
23617
23619
  const rest = [];
23618
- items.forEach((item2) => {
23619
- if ("index" in item2 && item2.index) {
23620
- groups.push(item2);
23620
+ items.forEach((item) => {
23621
+ if ("index" in item && item.index) {
23622
+ groups.push(item);
23621
23623
  } else {
23622
- rest.push(item2);
23624
+ rest.push(item);
23623
23625
  }
23624
23626
  });
23625
23627
  const childrenMap = new Map;
@@ -23629,34 +23631,34 @@ class Items {
23629
23631
  translateElementBy(html, -lowestCoordinates.left, -lowestCoordinates.top);
23630
23632
  return html;
23631
23633
  });
23632
- const restHTML = rest.map((item2) => ("renderHTML" in item2) && item2.renderHTML(documentFactory)).filter((item2) => !!item2).map((item2) => {
23633
- if (item2.tagName.toLowerCase() === "connector-item") {
23634
- const startX = parseFloat(item2.getAttribute("data-start-point-x") || "0");
23635
- const startY = parseFloat(item2.getAttribute("data-start-point-y") || "0");
23636
- const endX = parseFloat(item2.getAttribute("data-end-point-x") || "0");
23637
- const endY = parseFloat(item2.getAttribute("data-end-point-y") || "0");
23638
- item2.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
23639
- item2.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
23640
- item2.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
23641
- item2.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
23642
- }
23643
- return translateElementBy(item2, -lowestCoordinates.left, -lowestCoordinates.top);
23644
- });
23645
- for (const item2 of restHTML) {
23646
- const parentFrameId = childrenMap.get(item2.id);
23634
+ const restHTML = rest.map((item) => ("renderHTML" in item) && item.renderHTML(documentFactory)).filter((item) => !!item).map((item) => {
23635
+ if (item.tagName.toLowerCase() === "connector-item") {
23636
+ const startX = parseFloat(item.getAttribute("data-start-point-x") || "0");
23637
+ const startY = parseFloat(item.getAttribute("data-start-point-y") || "0");
23638
+ const endX = parseFloat(item.getAttribute("data-end-point-x") || "0");
23639
+ const endY = parseFloat(item.getAttribute("data-end-point-y") || "0");
23640
+ item.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
23641
+ item.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
23642
+ item.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
23643
+ item.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
23644
+ }
23645
+ return translateElementBy(item, -lowestCoordinates.left, -lowestCoordinates.top);
23646
+ });
23647
+ for (const item of restHTML) {
23648
+ const parentFrameId = childrenMap.get(item.id);
23647
23649
  const group = GroupsHTML.find((el) => parentFrameId !== undefined && el.id === parentFrameId);
23648
23650
  if (group) {
23649
- positionRelatively(item2, group);
23650
- group.appendChild(item2);
23651
+ positionRelatively(item, group);
23652
+ group.appendChild(item);
23651
23653
  }
23652
23654
  }
23653
23655
  let result = "";
23654
23656
  for (const group of GroupsHTML) {
23655
23657
  result += group.outerHTML;
23656
23658
  }
23657
- for (const item2 of restHTML) {
23658
- if (!childrenMap.get(item2.id)) {
23659
- result += item2.outerHTML;
23659
+ for (const item of restHTML) {
23660
+ if (!childrenMap.get(item.id)) {
23661
+ result += item.outerHTML;
23660
23662
  }
23661
23663
  }
23662
23664
  return result;
@@ -23676,52 +23678,52 @@ class SimpleSpatialIndex {
23676
23678
  this.itemsArray = [];
23677
23679
  this.Mbr = new Mbr;
23678
23680
  }
23679
- insert(item2) {
23680
- this.itemsArray.push(item2);
23681
+ insert(item) {
23682
+ this.itemsArray.push(item);
23681
23683
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
23682
- this.Mbr = item2.getMbr().copy();
23684
+ this.Mbr = item.getMbr().copy();
23683
23685
  } else {
23684
- this.Mbr.combine([item2.getMbr()]);
23686
+ this.Mbr.combine([item.getMbr()]);
23685
23687
  }
23686
- item2.subject.subscribe(this.change);
23688
+ item.subject.subscribe(this.change);
23687
23689
  this.subject.publish(this.items);
23688
23690
  }
23689
- change = (item2) => {
23691
+ change = (item) => {
23690
23692
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
23691
- this.Mbr = item2.getMbr().copy();
23693
+ this.Mbr = item.getMbr().copy();
23692
23694
  } else {
23693
- this.Mbr.combine([item2.getMbr()]);
23695
+ this.Mbr.combine([item.getMbr()]);
23694
23696
  }
23695
23697
  this.subject.publish(this.items);
23696
23698
  };
23697
- remove(item2) {
23698
- if ("index" in item2 && item2.index) {
23699
- item2.removeChildItems(item2.index.list());
23699
+ remove(item) {
23700
+ if ("index" in item && item.index) {
23701
+ item.removeChildItems(item.index.list());
23700
23702
  }
23701
- if (item2.parent !== "Board") {
23702
- const parentFrame = this.items.getById(item2.parent);
23703
- parentFrame?.removeChildItems(item2);
23703
+ if (item.parent !== "Board") {
23704
+ const parentFrame = this.items.getById(item.parent);
23705
+ parentFrame?.removeChildItems(item);
23704
23706
  }
23705
- this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
23707
+ this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
23706
23708
  this.Mbr = new Mbr;
23707
- this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbr()]));
23709
+ this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbr()]));
23708
23710
  this.subject.publish(this.items);
23709
23711
  }
23710
23712
  copy() {
23711
- return this.itemsArray.map((item2) => ({
23712
- ...item2.serialize(true),
23713
- id: item2.getId()
23713
+ return this.itemsArray.map((item) => ({
23714
+ ...item.serialize(true),
23715
+ id: item.getId()
23714
23716
  }));
23715
23717
  }
23716
- moveToZIndex(item2, zIndex) {
23717
- const index2 = this.itemsArray.indexOf(item2);
23718
+ moveToZIndex(item, zIndex) {
23719
+ const index2 = this.itemsArray.indexOf(item);
23718
23720
  this.itemsArray.splice(index2, 1);
23719
- this.itemsArray.splice(zIndex, 0, item2);
23720
- this.change(item2);
23721
+ this.itemsArray.splice(zIndex, 0, item);
23722
+ this.change(item);
23721
23723
  this.subject.publish(this.items);
23722
23724
  }
23723
23725
  moveManyToZIndex(itemsRecord) {
23724
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
23726
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
23725
23727
  const zIndex = Object.values(itemsRecord);
23726
23728
  for (let i = 0;i < zIndex.length; i++) {
23727
23729
  const index2 = zIndex[i];
@@ -23729,37 +23731,37 @@ class SimpleSpatialIndex {
23729
23731
  }
23730
23732
  this.itemsArray.forEach(this.change.bind(this));
23731
23733
  }
23732
- sendToBack(item2, shouldPublish = true) {
23733
- const index2 = this.itemsArray.indexOf(item2);
23734
+ sendToBack(item, shouldPublish = true) {
23735
+ const index2 = this.itemsArray.indexOf(item);
23734
23736
  this.itemsArray.splice(index2, 1);
23735
- this.itemsArray.unshift(item2);
23737
+ this.itemsArray.unshift(item);
23736
23738
  if (shouldPublish) {
23737
23739
  this.subject.publish(this.items);
23738
23740
  }
23739
23741
  }
23740
23742
  sendManyToBack(items) {
23741
23743
  const newItems = [...items];
23742
- this.itemsArray.forEach((item2) => {
23743
- if (!items.includes(item2)) {
23744
- newItems.push(item2);
23744
+ this.itemsArray.forEach((item) => {
23745
+ if (!items.includes(item)) {
23746
+ newItems.push(item);
23745
23747
  }
23746
23748
  });
23747
23749
  this.itemsArray = newItems;
23748
23750
  this.itemsArray.forEach(this.change.bind(this));
23749
23751
  }
23750
- bringToFront(item2, shouldPublish = true) {
23751
- const index2 = this.itemsArray.indexOf(item2);
23752
+ bringToFront(item, shouldPublish = true) {
23753
+ const index2 = this.itemsArray.indexOf(item);
23752
23754
  this.itemsArray.splice(index2, 1);
23753
- this.itemsArray.push(item2);
23755
+ this.itemsArray.push(item);
23754
23756
  if (shouldPublish) {
23755
23757
  this.subject.publish(this.items);
23756
23758
  }
23757
23759
  }
23758
23760
  bringManyToFront(items) {
23759
23761
  const newItems = [];
23760
- this.itemsArray.forEach((item2) => {
23761
- if (!items.includes(item2)) {
23762
- newItems.push(item2);
23762
+ this.itemsArray.forEach((item) => {
23763
+ if (!items.includes(item)) {
23764
+ newItems.push(item);
23763
23765
  }
23764
23766
  });
23765
23767
  newItems.push(...items);
@@ -23785,9 +23787,9 @@ class SimpleSpatialIndex {
23785
23787
  this.subject.publish(this.items);
23786
23788
  }
23787
23789
  getById(id) {
23788
- const item2 = this.itemsArray.find((item3) => item3.getId() === id);
23789
- if (item2) {
23790
- return item2;
23790
+ const item = this.itemsArray.find((item2) => item2.getId() === id);
23791
+ if (item) {
23792
+ return item;
23791
23793
  }
23792
23794
  }
23793
23795
  findById(id) {
@@ -23796,9 +23798,9 @@ class SimpleSpatialIndex {
23796
23798
  getEnclosed(left, top, right, bottom) {
23797
23799
  const mbr = new Mbr(left, top, right, bottom);
23798
23800
  const items = [];
23799
- this.itemsArray.forEach((item2) => {
23800
- if (item2.isEnclosedBy(mbr)) {
23801
- items.push(item2);
23801
+ this.itemsArray.forEach((item) => {
23802
+ if (item.isEnclosedBy(mbr)) {
23803
+ items.push(item);
23802
23804
  }
23803
23805
  });
23804
23806
  return items;
@@ -23806,18 +23808,18 @@ class SimpleSpatialIndex {
23806
23808
  getEnclosedOrCrossed(left, top, right, bottom) {
23807
23809
  const mbr = new Mbr(left, top, right, bottom);
23808
23810
  const items = [];
23809
- this.itemsArray.forEach((item2) => {
23810
- if (item2.isEnclosedOrCrossedBy(mbr)) {
23811
- items.push(item2);
23811
+ this.itemsArray.forEach((item) => {
23812
+ if (item.isEnclosedOrCrossedBy(mbr)) {
23813
+ items.push(item);
23812
23814
  }
23813
23815
  });
23814
23816
  return items;
23815
23817
  }
23816
23818
  getUnderPoint(point3, tolerace = 5) {
23817
23819
  const items = [];
23818
- this.itemsArray.forEach((item2) => {
23819
- if (item2.isUnderPoint(point3, tolerace)) {
23820
- items.push(item2);
23820
+ this.itemsArray.forEach((item) => {
23821
+ if (item.isUnderPoint(point3, tolerace)) {
23822
+ items.push(item);
23821
23823
  }
23822
23824
  });
23823
23825
  return items;
@@ -23828,8 +23830,8 @@ class SimpleSpatialIndex {
23828
23830
  list() {
23829
23831
  return this.itemsArray.concat();
23830
23832
  }
23831
- getZIndex(item2) {
23832
- return this.itemsArray.indexOf(item2);
23833
+ getZIndex(item) {
23834
+ return this.itemsArray.indexOf(item);
23833
23835
  }
23834
23836
  getLastZIndex() {
23835
23837
  return this.itemsArray.length - 1;
@@ -23843,8 +23845,8 @@ class SimpleSpatialIndex {
23843
23845
  }
23844
23846
  }
23845
23847
  render(context) {
23846
- this.itemsArray.forEach((item2) => {
23847
- item2.render(context);
23848
+ this.itemsArray.forEach((item) => {
23849
+ item.render(context);
23848
23850
  });
23849
23851
  }
23850
23852
  }
@@ -23895,7 +23897,7 @@ class BaseItem extends Mbr {
23895
23897
  if (!this.index) {
23896
23898
  return null;
23897
23899
  }
23898
- return this.index.items.listAll().map((item2) => item2.getId());
23900
+ return this.index.items.listAll().map((item) => item.getId());
23899
23901
  }
23900
23902
  addChildItems(children) {
23901
23903
  if (!this.index) {
@@ -23933,17 +23935,17 @@ class BaseItem extends Mbr {
23933
23935
  this.addChildItems(itemsToAdd);
23934
23936
  this.removeChildItems(itemsToRemove);
23935
23937
  }
23936
- handleNesting(item2, options) {
23937
- const isItem = "itemType" in item2;
23938
- const itemMbr = isItem ? item2.getMbr() : item2;
23939
- if (item2 instanceof BaseItem && !item2.canBeNested) {
23938
+ handleNesting(item, options) {
23939
+ const isItem = "itemType" in item;
23940
+ const itemMbr = isItem ? item.getMbr() : item;
23941
+ if (item instanceof BaseItem && !item.canBeNested) {
23940
23942
  return false;
23941
23943
  }
23942
- if (options?.cancelIfChild && isItem && item2.parent !== "Board") {
23944
+ if (options?.cancelIfChild && isItem && item.parent !== "Board") {
23943
23945
  return false;
23944
23946
  }
23945
23947
  const mbr = this.getMbr().copy();
23946
- if (item2.isEnclosedOrCrossedBy(mbr)) {
23948
+ if (item.isEnclosedOrCrossedBy(mbr)) {
23947
23949
  if (mbr.isInside(itemMbr.getCenter())) {
23948
23950
  if (!options || !options.onlyForOut) {
23949
23951
  return true;
@@ -26240,8 +26242,8 @@ function isChild(value) {
26240
26242
  if (!Array.isArray(value2))
26241
26243
  return true;
26242
26244
  const list2 = value2;
26243
- for (const item2 of list2) {
26244
- if (typeof item2 !== "number" && typeof item2 !== "string") {
26245
+ for (const item of list2) {
26246
+ if (typeof item !== "number" && typeof item !== "string") {
26245
26247
  return true;
26246
26248
  }
26247
26249
  }
@@ -26280,8 +26282,8 @@ function addProperty(schema, properties, key, value) {
26280
26282
  }
26281
26283
  if (Array.isArray(result)) {
26282
26284
  const finalResult = [];
26283
- for (const item2 of result) {
26284
- finalResult.push(parsePrimitive(info, info.property, item2));
26285
+ for (const item of result) {
26286
+ finalResult.push(parsePrimitive(info, info.property, item));
26285
26287
  }
26286
26288
  result = finalResult;
26287
26289
  }
@@ -37348,8 +37350,8 @@ function list5(node2, parent, state, info) {
37348
37350
  if (checkRule(state) === bullet && firstListItem) {
37349
37351
  let index2 = -1;
37350
37352
  while (++index2 < node2.children.length) {
37351
- const item2 = node2.children[index2];
37352
- if (item2 && item2.type === "listItem" && item2.children && item2.children[0] && item2.children[0].type === "thematicBreak") {
37353
+ const item = node2.children[index2];
37354
+ if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
37353
37355
  useDifferentMarker = true;
37354
37356
  break;
37355
37357
  }
@@ -38010,12 +38012,12 @@ async function convertMarkdownToSlate(text5) {
38010
38012
  ...nodes.filter((node2) => node2.type !== "list_item")
38011
38013
  ];
38012
38014
  }
38013
- return nodes.map((item2) => {
38015
+ return nodes.map((item) => {
38014
38016
  setNodeStyles({
38015
- node: item2,
38016
- isPaddingTopNeeded: item2.type !== "code_block"
38017
+ node: item,
38018
+ isPaddingTopNeeded: item.type !== "code_block"
38017
38019
  });
38018
- return item2;
38020
+ return item;
38019
38021
  });
38020
38022
  }
38021
38023
  function detectListType(text5) {
@@ -38428,17 +38430,17 @@ class FloatingPoint extends Point {
38428
38430
  relativePoint;
38429
38431
  pointType = "Floating";
38430
38432
  edge;
38431
- constructor(item2, relativePoint) {
38433
+ constructor(item, relativePoint) {
38432
38434
  super();
38433
- this.item = item2;
38435
+ this.item = item;
38434
38436
  this.relativePoint = relativePoint;
38435
38437
  if (relativePoint.y <= 0) {
38436
38438
  this.edge = "top";
38437
- } else if (relativePoint.y >= item2.getMbr().getHeight()) {
38439
+ } else if (relativePoint.y >= item.getMbr().getHeight()) {
38438
38440
  this.edge = "bottom";
38439
38441
  } else if (relativePoint.x <= 0) {
38440
38442
  this.edge = "left";
38441
- } else if (relativePoint.x >= item2.getMbr().getWidth()) {
38443
+ } else if (relativePoint.x >= item.getMbr().getWidth()) {
38442
38444
  this.edge = "right";
38443
38445
  }
38444
38446
  this.recalculatePoint();
@@ -38469,17 +38471,17 @@ class FixedPoint extends Point {
38469
38471
  relativePoint;
38470
38472
  pointType = "Fixed";
38471
38473
  edge;
38472
- constructor(item2, relativePoint) {
38474
+ constructor(item, relativePoint) {
38473
38475
  super();
38474
- this.item = item2;
38476
+ this.item = item;
38475
38477
  this.relativePoint = relativePoint;
38476
38478
  if (relativePoint.y <= 0) {
38477
38479
  this.edge = "top";
38478
- } else if (relativePoint.y >= item2.getMbr().getHeight()) {
38480
+ } else if (relativePoint.y >= item.getMbr().getHeight()) {
38479
38481
  this.edge = "bottom";
38480
38482
  } else if (relativePoint.x <= 0) {
38481
38483
  this.edge = "left";
38482
- } else if (relativePoint.x >= item2.getMbr().getWidth()) {
38484
+ } else if (relativePoint.x >= item.getMbr().getWidth()) {
38483
38485
  this.edge = "right";
38484
38486
  }
38485
38487
  this.recalculatePoint();
@@ -38510,16 +38512,16 @@ class FixedConnectorPoint extends Point {
38510
38512
  tangent;
38511
38513
  segmentIndex;
38512
38514
  pointType = "FixedConnector";
38513
- constructor(item2, tangent, segmentIndex) {
38515
+ constructor(item, tangent, segmentIndex) {
38514
38516
  super();
38515
- this.item = item2;
38517
+ this.item = item;
38516
38518
  this.tangent = tangent;
38517
38519
  this.segmentIndex = segmentIndex;
38518
38520
  this.recalculatePoint();
38519
38521
  }
38520
38522
  recalculatePoint() {
38521
- const item2 = this.item;
38522
- const segments = item2.getPaths().getSegments();
38523
+ const item = this.item;
38524
+ const segments = item.getPaths().getSegments();
38523
38525
  const segment = segments.length > this.segmentIndex ? segments[this.segmentIndex] : segments[segments.length - 1];
38524
38526
  const point5 = segment.getPoint(this.tangent);
38525
38527
  this.x = point5.x;
@@ -38544,38 +38546,38 @@ function getControlPoint(data, findItem2) {
38544
38546
  if (data.pointType === "Board") {
38545
38547
  return new BoardPoint(Math.round(data.x), Math.round(data.y));
38546
38548
  } else {
38547
- const item2 = findItem2(data.itemId);
38548
- if (!item2) {
38549
+ const item = findItem2(data.itemId);
38550
+ if (!item) {
38549
38551
  console.warn(`getControlPoint(): item not found for ${data.itemId}`);
38550
38552
  return new BoardPoint(0, 0);
38551
38553
  }
38552
38554
  switch (data.pointType) {
38553
38555
  case "FixedConnector":
38554
- if (item2 instanceof Connector2) {
38555
- return new FixedConnectorPoint(item2, data.tangent, data.segment);
38556
+ if (item instanceof Connector2) {
38557
+ return new FixedConnectorPoint(item, data.tangent, data.segment);
38556
38558
  } else {
38557
38559
  throw new Error(`getControlPoint(): item must be a connector`);
38558
38560
  }
38559
38561
  case "Floating":
38560
- return new FloatingPoint(item2, new Point(data.relativeX, data.relativeY));
38562
+ return new FloatingPoint(item, new Point(data.relativeX, data.relativeY));
38561
38563
  case "Fixed":
38562
- return new FixedPoint(item2, new Point(data.relativeX, data.relativeY));
38564
+ return new FixedPoint(item, new Point(data.relativeX, data.relativeY));
38563
38565
  }
38564
38566
  }
38565
38567
  }
38566
- function toRelativePoint(point5, item2) {
38567
- const matrix = item2.transformation?.matrix || new Matrix2;
38568
+ function toRelativePoint(point5, item) {
38569
+ const matrix = item.transformation?.matrix || new Matrix2;
38568
38570
  const inverse = matrix.getInverse();
38569
38571
  point5 = point5.copy();
38570
38572
  point5.transform(inverse);
38571
38573
  return point5;
38572
38574
  }
38573
- function fromRelativePoint(relativePoint, item2, edge) {
38574
- const matrix = item2.transformation?.matrix.copy() || new Matrix2;
38575
+ function fromRelativePoint(relativePoint, item, edge) {
38576
+ const matrix = item.transformation?.matrix.copy() || new Matrix2;
38575
38577
  const point5 = relativePoint.copy();
38576
38578
  point5.transform(matrix);
38577
- if (item2 instanceof RichText || item2 instanceof AINode) {
38578
- const itemMbr = item2.getMbr();
38579
+ if (item instanceof RichText || item instanceof AINode) {
38580
+ const itemMbr = item.getMbr();
38579
38581
  const { x: centerX, y: centerY } = itemMbr.getCenter();
38580
38582
  switch (edge) {
38581
38583
  case "left":
@@ -38587,7 +38589,7 @@ function fromRelativePoint(relativePoint, item2, edge) {
38587
38589
  case "bottom":
38588
38590
  return new Point(centerX, itemMbr.bottom);
38589
38591
  default:
38590
- return item2.getMbr().getClosestEdgeCenterPoint(point5);
38592
+ return item.getMbr().getClosestEdgeCenterPoint(point5);
38591
38593
  }
38592
38594
  }
38593
38595
  return point5;
@@ -39936,7 +39938,7 @@ class Connector2 extends BaseItem {
39936
39938
  return this;
39937
39939
  }
39938
39940
  getConnectorById(items, connectorId) {
39939
- return items.find((item2) => item2 instanceof Connector2 && item2.getId() === connectorId);
39941
+ return items.find((item) => item instanceof Connector2 && item.getId() === connectorId);
39940
39942
  }
39941
39943
  updateTitle() {
39942
39944
  const selection = this.board.selection;
@@ -42573,8 +42575,8 @@ async function exportBoardSnapshot({
42573
42575
  context.matrix.applyToContext(context.ctx);
42574
42576
  const { left, top, right, bottom } = selection;
42575
42577
  const inView = board.items.index.getRectsEnclosedOrCrossed(left, top, right, bottom);
42576
- for (const item2 of inView) {
42577
- item2.render(context);
42578
+ for (const item of inView) {
42579
+ item.render(context);
42578
42580
  }
42579
42581
  const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
42580
42582
  const dataUrl = await convertBlobToDataUrl(blob);
@@ -42772,7 +42774,7 @@ class Frame2 extends BaseItem {
42772
42774
  return this.id;
42773
42775
  }
42774
42776
  getChildrenIds() {
42775
- return this.index?.list().map((item2) => item2.getId()) || [];
42777
+ return this.index?.list().map((item) => item.getId()) || [];
42776
42778
  }
42777
42779
  updateMbr() {
42778
42780
  const rect = this.path.getMbr().copy();
@@ -43007,11 +43009,11 @@ class Frame2 extends BaseItem {
43007
43009
  }
43008
43010
  });
43009
43011
  const currMbr = this.getMbr();
43010
- this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item2) => {
43011
- if (item2.parent === "Board") {
43012
- if (this.handleNesting(item2)) {
43013
- this.applyAddChildren([item2.getId()]);
43014
- item2.parent = this.getId();
43012
+ this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
43013
+ if (item.parent === "Board") {
43014
+ if (this.handleNesting(item)) {
43015
+ this.applyAddChildren([item.getId()]);
43016
+ item.parent = this.getId();
43015
43017
  }
43016
43018
  }
43017
43019
  });
@@ -45209,9 +45211,9 @@ class Group extends BaseItem {
45209
45211
  if (data.children) {
45210
45212
  data.children.forEach((childId) => {
45211
45213
  this.applyAddChild(childId);
45212
- const item2 = this.board.items.getById(childId);
45213
- if (item2) {
45214
- item2.parent = this.getId();
45214
+ const item = this.board.items.getById(childId);
45215
+ if (item) {
45216
+ item.parent = this.getId();
45215
45217
  }
45216
45218
  });
45217
45219
  }
@@ -45241,11 +45243,11 @@ class Group extends BaseItem {
45241
45243
  let right = Number.MIN_SAFE_INTEGER;
45242
45244
  let bottom = Number.MIN_SAFE_INTEGER;
45243
45245
  const mbrs = this.children.flatMap((childId) => {
45244
- const item2 = this.board.items.getById(childId);
45245
- if (!item2) {
45246
+ const item = this.board.items.getById(childId);
45247
+ if (!item) {
45246
45248
  return [];
45247
45249
  }
45248
- const mbr2 = item2.getMbr();
45250
+ const mbr2 = item.getMbr();
45249
45251
  if (!mbr2) {
45250
45252
  return [];
45251
45253
  }
@@ -45280,7 +45282,7 @@ class Group extends BaseItem {
45280
45282
  return this.children;
45281
45283
  }
45282
45284
  getChildren() {
45283
- return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item2) => item2 !== undefined);
45285
+ return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item) => item !== undefined);
45284
45286
  }
45285
45287
  updateMbr() {
45286
45288
  const rect = this.getMbr();
@@ -45293,9 +45295,9 @@ class Group extends BaseItem {
45293
45295
  setChildren(items) {
45294
45296
  items.forEach((itemId) => {
45295
45297
  this.addChild(itemId);
45296
- const item2 = this.board.items.getById(itemId);
45297
- if (item2) {
45298
- item2.parent = this.getId();
45298
+ const item = this.board.items.getById(itemId);
45299
+ if (item) {
45300
+ item.parent = this.getId();
45299
45301
  }
45300
45302
  });
45301
45303
  this.updateMbr();
@@ -45303,9 +45305,9 @@ class Group extends BaseItem {
45303
45305
  removeChildren() {
45304
45306
  this.children.forEach((itemId) => {
45305
45307
  this.removeChild(itemId);
45306
- const item2 = this.board.items.getById(itemId);
45307
- if (item2) {
45308
- item2.parent = this.parent;
45308
+ const item = this.board.items.getById(itemId);
45309
+ if (item) {
45310
+ item.parent = this.parent;
45309
45311
  }
45310
45312
  });
45311
45313
  this.updateMbr();
@@ -45638,16 +45640,16 @@ class Anchor extends Mbr {
45638
45640
  }
45639
45641
  }
45640
45642
  // src/Items/Connector/ConnectorSnap.ts
45641
- function getFixedPoint(item2, point5) {
45642
- if (item2 instanceof Connector2) {
45643
- const nearestSegmentData = item2.getPaths().getNearestEdgeAndPointTo(point5);
45643
+ function getFixedPoint(item, point5) {
45644
+ if (item instanceof Connector2) {
45645
+ const nearestSegmentData = item.getPaths().getNearestEdgeAndPointTo(point5);
45644
45646
  const segment = nearestSegmentData.segment;
45645
45647
  const index2 = nearestSegmentData.index;
45646
45648
  const tangent = segment.getParameter(point5);
45647
- return new FixedConnectorPoint(item2, tangent, index2);
45649
+ return new FixedConnectorPoint(item, tangent, index2);
45648
45650
  } else {
45649
- const relativePoint = toRelativePoint(point5, item2);
45650
- return new FixedPoint(item2, relativePoint);
45651
+ const relativePoint = toRelativePoint(point5, item);
45652
+ return new FixedPoint(item, relativePoint);
45651
45653
  }
45652
45654
  }
45653
45655
 
@@ -45700,20 +45702,20 @@ class ConnectorSnap {
45700
45702
  }
45701
45703
  this.setSnap();
45702
45704
  const pointer = this.board.pointer.point;
45703
- const { anchor, item: item2, point: point5 } = this.snap;
45704
- if (!item2) {
45705
+ const { anchor, item, point: point5 } = this.snap;
45706
+ if (!item) {
45705
45707
  const pointer2 = this.board.pointer.point;
45706
45708
  this.controlPoint = new BoardPoint(pointer2.x, pointer2.y);
45707
45709
  } else if (anchor) {
45708
- this.controlPoint = getFixedPoint(item2, anchor.getCenter());
45710
+ this.controlPoint = getFixedPoint(item, anchor.getCenter());
45709
45711
  } else if (point5) {
45710
- const nearest2 = item2.getNearestEdgePointTo(pointer);
45711
- this.controlPoint = getFixedPoint(item2, nearest2);
45712
+ const nearest2 = item.getNearestEdgePointTo(pointer);
45713
+ this.controlPoint = getFixedPoint(item, nearest2);
45712
45714
  } else {
45713
45715
  if (this.hover.isTimeoutElapsed) {
45714
- this.controlPoint = getFixedPoint(item2, pointer);
45716
+ this.controlPoint = getFixedPoint(item, pointer);
45715
45717
  } else {
45716
- this.controlPoint = getFixedPoint(item2, pointer);
45718
+ this.controlPoint = getFixedPoint(item, pointer);
45717
45719
  }
45718
45720
  }
45719
45721
  }
@@ -45774,23 +45776,23 @@ class ConnectorSnap {
45774
45776
  }
45775
45777
  return nearest;
45776
45778
  }
45777
- getClosestPointOnItem(item2, position4) {
45778
- const nearestEdgePoint = item2.getNearestEdgePointTo(position4);
45779
- return getFixedPoint(item2, nearestEdgePoint);
45779
+ getClosestPointOnItem(item, position4) {
45780
+ const nearestEdgePoint = item.getNearestEdgePointTo(position4);
45781
+ return getFixedPoint(item, nearestEdgePoint);
45780
45782
  }
45781
- isNearBorder(item2) {
45782
- if (!item2) {
45783
+ isNearBorder(item) {
45784
+ if (!item) {
45783
45785
  return false;
45784
45786
  }
45785
45787
  const pointer = this.board.pointer.point;
45786
- const point5 = item2.getNearestEdgePointTo(pointer);
45788
+ const point5 = item.getNearestEdgePointTo(pointer);
45787
45789
  const distance = pointer.getDistance(point5);
45788
45790
  return distance < this.distance.border / this.board.camera.getScale();
45789
45791
  }
45790
45792
  setSnap() {
45791
- const item2 = this.snap.item;
45792
- const path2 = item2 && "getPath" in item2 ? item2?.getPath() : null;
45793
- if (!item2 || !path2) {
45793
+ const item = this.snap.item;
45794
+ const path2 = item && "getPath" in item ? item?.getPath() : null;
45795
+ if (!item || !path2) {
45794
45796
  this.snap.path = null;
45795
45797
  this.snap.anchors = [];
45796
45798
  this.snap.anchor = null;
@@ -45801,11 +45803,11 @@ class ConnectorSnap {
45801
45803
  if (this.snap.item === this.hover.item && !this.hover.isTimeoutElapsed) {
45802
45804
  path2.setBackgroundColor(this.color.snapBackgroundHighlight);
45803
45805
  }
45804
- this.setAnchors(item2);
45806
+ this.setAnchors(item);
45805
45807
  }
45806
45808
  }
45807
- setAnchors(item2) {
45808
- const points = item2.getSnapAnchorPoints();
45809
+ setAnchors(item) {
45810
+ const points = item.getSnapAnchorPoints();
45809
45811
  if (!points) {
45810
45812
  return;
45811
45813
  }
@@ -45839,10 +45841,10 @@ class ConnectorSnap {
45839
45841
  }
45840
45842
  setPoint() {
45841
45843
  const pointer = this.board.pointer.point;
45842
- const { item: item2, anchor } = this.snap;
45843
- if (item2) {
45844
+ const { item, anchor } = this.snap;
45845
+ if (item) {
45844
45846
  if (!anchor) {
45845
- const point5 = item2.getNearestEdgePointTo(pointer);
45847
+ const point5 = item.getNearestEdgePointTo(pointer);
45846
45848
  if (point5.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
45847
45849
  this.snap.point = new Anchor(point5.x, point5.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
45848
45850
  } else {
@@ -46215,12 +46217,12 @@ class NestingHighlighter extends Tool {
46215
46217
  this.toHighlight.push({ groupItem, children: array });
46216
46218
  }
46217
46219
  }
46218
- addSingleItem(item2) {
46219
- this.toHighlight.push({ children: [item2] });
46220
+ addSingleItem(item) {
46221
+ this.toHighlight.push({ children: [item] });
46220
46222
  }
46221
- remove(item2) {
46223
+ remove(item) {
46222
46224
  this.toHighlight.forEach((group) => {
46223
- group.children = group.children.filter((child) => child !== item2);
46225
+ group.children = group.children.filter((child) => child !== item);
46224
46226
  });
46225
46227
  this.toHighlight = this.toHighlight.filter((group) => group.children.length > 0);
46226
46228
  }
@@ -46287,7 +46289,7 @@ class AddFrame extends BoardTool {
46287
46289
  this.mbr.borderColor = "blue";
46288
46290
  this.nestingHighlighter.clear();
46289
46291
  const enclosedOrCrossed = this.board.items.getEnclosedOrCrossed(this.mbr.left, this.mbr.top, this.mbr.right, this.mbr.bottom);
46290
- const inside = enclosedOrCrossed.filter((item2) => !(item2 instanceof Frame2) && item2.parent === "Board" && this.mbr.isInside(item2.getMbr().getCenter()));
46292
+ const inside = enclosedOrCrossed.filter((item) => !(item instanceof Frame2) && item.parent === "Board" && this.mbr.isInside(item.getMbr().getCenter()));
46291
46293
  this.nestingHighlighter.add(this.frame, inside);
46292
46294
  this.initTransformation();
46293
46295
  this.board.tools.publish();
@@ -46308,7 +46310,7 @@ class AddFrame extends BoardTool {
46308
46310
  localStorage.setItem("lastFrameScale", JSON.stringify(this.frame.transformation.getScale()));
46309
46311
  }
46310
46312
  const currMbr = this.frame.getMbr();
46311
- const frameChildren = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item2) => item2.parent === "Board").filter((item2) => this.frame.handleNesting(item2));
46313
+ const frameChildren = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board").filter((item) => this.frame.handleNesting(item));
46312
46314
  this.applyAddChildren(frameChildren);
46313
46315
  if (this.shape !== "Custom") {
46314
46316
  this.applyCanChangeRatio(false);
@@ -46324,7 +46326,7 @@ class AddFrame extends BoardTool {
46324
46326
  return true;
46325
46327
  }
46326
46328
  addNextTo() {
46327
- const framesInView = this.board.items.getItemsInView().filter((item2) => item2 instanceof Frame2);
46329
+ const framesInView = this.board.items.getItemsInView().filter((item) => item instanceof Frame2);
46328
46330
  if (framesInView.length === 0) {
46329
46331
  if (this.shape === "Custom") {
46330
46332
  const { x, y } = this.frame.getLastFrameScale();
@@ -46362,7 +46364,7 @@ class AddFrame extends BoardTool {
46362
46364
  this.board.camera.viewRectangle(this.frame.getMbr());
46363
46365
  }
46364
46366
  const frameMbr = this.frame.getMbr();
46365
- this.board.items.getEnclosedOrCrossed(frameMbr.left, frameMbr.top, frameMbr.right, frameMbr.bottom).filter((item2) => item2.parent === "Board").filter((item2) => this.frame.handleNesting(item2)).forEach((item2) => this.applyAddChildren([item2]));
46367
+ this.board.items.getEnclosedOrCrossed(frameMbr.left, frameMbr.top, frameMbr.right, frameMbr.bottom).filter((item) => item.parent === "Board").filter((item) => this.frame.handleNesting(item)).forEach((item) => this.applyAddChildren([item]));
46366
46368
  const frame = this.board.add(this.frame);
46367
46369
  frame.text.editor.moveCursorToEndOfTheText();
46368
46370
  this.nestingHighlighter.clear();
@@ -46867,13 +46869,13 @@ class Eraser extends BoardTool {
46867
46869
  }
46868
46870
  removeUnderPointOrLine() {
46869
46871
  const segments = this.drawing.getLines();
46870
- const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item2) => {
46871
- return item2.itemType === "Drawing" && item2.getLines().find((line) => {
46872
- return line.getDistance(this.board.pointer.point) <= item2.strokeWidth / 2 + this.strokeWidth / 2;
46872
+ const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item) => {
46873
+ return item.itemType === "Drawing" && item.getLines().find((line) => {
46874
+ return line.getDistance(this.board.pointer.point) <= item.strokeWidth / 2 + this.strokeWidth / 2;
46873
46875
  });
46874
46876
  });
46875
- items.push(...this.board.items.getEnclosedOrCrossed(this.drawing.points[0].x, this.drawing.points[0].y, this.board.pointer.point.x, this.board.pointer.point.y).filter((item2) => {
46876
- return item2.itemType === "Drawing" && item2.getLines().some((line) => {
46877
+ items.push(...this.board.items.getEnclosedOrCrossed(this.drawing.points[0].x, this.drawing.points[0].y, this.board.pointer.point.x, this.board.pointer.point.y).filter((item) => {
46878
+ return item.itemType === "Drawing" && item.getLines().some((line) => {
46877
46879
  return segments.some((segment) => segment.hasIntersectionPoint(line));
46878
46880
  });
46879
46881
  }));
@@ -47325,20 +47327,20 @@ function createCanvasDrawer(board) {
47325
47327
  context.ctx.setTransform(board2.camera.getMatrix().scaleX, 0, 0, board2.camera.getMatrix().scaleY, 0, 0);
47326
47328
  context.matrix.applyToContext(context.ctx);
47327
47329
  const items = Object.keys(translation).map((id) => {
47328
- const item2 = board2.items.getById(id);
47329
- if (item2) {
47330
- if (item2.itemType !== "Frame") {
47331
- return item2;
47330
+ const item = board2.items.getById(id);
47331
+ if (item) {
47332
+ if (item.itemType !== "Frame") {
47333
+ return item;
47332
47334
  }
47333
- item2.render(context);
47334
- return item2;
47335
+ item.render(context);
47336
+ return item;
47335
47337
  }
47336
47338
  return;
47337
- }).filter((item2) => !!item2);
47338
- items.forEach((item2) => {
47339
- if (item2.itemType !== "Frame") {
47340
- item2.render(context);
47341
- board2.selection.renderItemMbr(context, item2, board2.camera.getMatrix().scaleX);
47339
+ }).filter((item) => !!item);
47340
+ items.forEach((item) => {
47341
+ if (item.itemType !== "Frame") {
47342
+ item.render(context);
47343
+ board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
47342
47344
  }
47343
47345
  });
47344
47346
  return { canvas: container, items };
@@ -47399,10 +47401,10 @@ function createCanvasDrawer(board) {
47399
47401
  if (lastTranslationKeys) {
47400
47402
  board.selection.shouldPublish = false;
47401
47403
  lastTranslationKeys.forEach((id) => {
47402
- const item2 = board.items.getById(id);
47403
- if (item2) {
47404
- item2.transformationRenderBlock = undefined;
47405
- item2.subject.publish(item2);
47404
+ const item = board.items.getById(id);
47405
+ if (item) {
47406
+ item.transformationRenderBlock = undefined;
47407
+ item.subject.publish(item);
47406
47408
  }
47407
47409
  });
47408
47410
  lastTranslationKeys = undefined;
@@ -47434,9 +47436,9 @@ function createCanvasDrawer(board) {
47434
47436
  lastCreatedCanvas = cnvs;
47435
47437
  lastTranslationKeys = Object.keys(translation);
47436
47438
  lastTranslationKeys.forEach((id) => {
47437
- const item2 = board.items.getById(id);
47438
- if (item2) {
47439
- item2.transformationRenderBlock = true;
47439
+ const item = board.items.getById(id);
47440
+ if (item) {
47441
+ item.transformationRenderBlock = true;
47440
47442
  }
47441
47443
  });
47442
47444
  board.selection.transformationRenderBlock = true;
@@ -47446,14 +47448,14 @@ function createCanvasDrawer(board) {
47446
47448
  }
47447
47449
  function countSumMbr(translation) {
47448
47450
  return Object.keys(translation).reduce((mbr, id) => {
47449
- const item2 = board.items.getById(id);
47450
- if (item2) {
47451
+ const item = board.items.getById(id);
47452
+ if (item) {
47451
47453
  if (!mbr) {
47452
- mbr = item2.getMbr();
47454
+ mbr = item.getMbr();
47453
47455
  } else {
47454
- mbr.combine(item2.getMbr());
47455
- if (item2.itemType === "Frame") {
47456
- mbr.combine(item2.getRichText().getMbr());
47456
+ mbr.combine(item.getMbr());
47457
+ if (item.itemType === "Frame") {
47458
+ mbr.combine(item.getRichText().getMbr());
47457
47459
  }
47458
47460
  }
47459
47461
  }
@@ -47484,8 +47486,8 @@ function createCanvasDrawer(board) {
47484
47486
  }
47485
47487
  function highlightNesting() {
47486
47488
  const container = getLastCreatedCanvas();
47487
- const drawnItemsMap = drawnItems?.reduce((acc, item2) => {
47488
- acc.set(item2.getId(), { item: item2, mbr: item2.getMbr() });
47489
+ const drawnItemsMap = drawnItems?.reduce((acc, item) => {
47490
+ acc.set(item.getId(), { item, mbr: item.getMbr() });
47489
47491
  return acc;
47490
47492
  }, new Map);
47491
47493
  if (!container || !drawnItems) {
@@ -47520,11 +47522,11 @@ function createCanvasDrawer(board) {
47520
47522
  mbr.transform(currMatrix);
47521
47523
  });
47522
47524
  groups.forEach((group) => {
47523
- drawnItemsMap?.forEach(({ mbr, item: item2 }, key) => {
47524
- if ("canBeNested" in item2 && !item2.canBeNested) {
47525
+ drawnItemsMap?.forEach(({ mbr, item }, key) => {
47526
+ if ("canBeNested" in item && !item.canBeNested) {
47525
47527
  return;
47526
47528
  }
47527
- if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item2.parent !== group.getId()) && group.handleNesting(mbr)) {
47529
+ if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item.parent !== group.getId()) && group.handleNesting(mbr)) {
47528
47530
  const div = createBorderDivForItem(mbr, lastCreatedCanvas);
47529
47531
  removeHighlighted(key);
47530
47532
  highlightedDivs.set(key, div);
@@ -47585,10 +47587,10 @@ function createCanvasDrawer(board) {
47585
47587
  }
47586
47588
 
47587
47589
  // src/Selection/QuickAddButtons/quickAddHelpers.ts
47588
- function getControlPointData(item2, index2, isRichText = false) {
47589
- const itemScale = isRichText ? { x: 1, y: 1 } : item2.transformation.getScale();
47590
- const width2 = item2.getPathMbr().getWidth();
47591
- let height3 = item2.getPathMbr().getHeight();
47590
+ function getControlPointData(item, index2, isRichText = false) {
47591
+ const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
47592
+ const width2 = item.getPathMbr().getWidth();
47593
+ let height3 = item.getPathMbr().getHeight();
47592
47594
  const adjMapScaled = {
47593
47595
  0: { x: 0, y: height3 / 2 / itemScale.y },
47594
47596
  1: {
@@ -47603,7 +47605,7 @@ function getControlPointData(item2, index2, isRichText = false) {
47603
47605
  };
47604
47606
  return {
47605
47607
  pointType: "Fixed",
47606
- itemId: item2.getId(),
47608
+ itemId: item.getId(),
47607
47609
  relativeX: adjMapScaled[index2].x,
47608
47610
  relativeY: adjMapScaled[index2].y
47609
47611
  };
@@ -47738,10 +47740,10 @@ function getQuickAddButtons(selection, board) {
47738
47740
  let newHeight = height3;
47739
47741
  let itemData;
47740
47742
  if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
47741
- const item2 = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
47742
- newWidth = item2.getMbr().getWidth();
47743
- newHeight = item2.getMbr().getHeight();
47744
- itemData = item2.serialize();
47743
+ const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
47744
+ newWidth = item.getMbr().getWidth();
47745
+ newHeight = item.getMbr().getHeight();
47746
+ itemData = item.serialize();
47745
47747
  const { minX, minY, maxY, maxX } = offsets;
47746
47748
  offsetX = Math.min(offsetX, maxX);
47747
47749
  offsetX = Math.max(offsetX, minX);
@@ -47774,7 +47776,7 @@ function getQuickAddButtons(selection, board) {
47774
47776
  }
47775
47777
  const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
47776
47778
  let step = 1;
47777
- while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item2) => item2.itemType !== "Connector").length > 0) {
47779
+ while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item) => item.itemType !== "Connector").length > 0) {
47778
47780
  const xDirection = step % 2 === 0 ? -1 : 1;
47779
47781
  const yDirection = newItemData.itemType === "AINode" ? -1 : xDirection;
47780
47782
  newMbr.transform(new Matrix2(iterAdjustment[index2].x * xDirection * step, iterAdjustment[index2].y * yDirection * (newItemData.itemType === "AINode" ? 1 : step)));
@@ -47907,7 +47909,7 @@ function getQuickAddButtons(selection, board) {
47907
47909
  clear();
47908
47910
  return;
47909
47911
  }
47910
- const { positions, item: item2 } = position4;
47912
+ const { positions, item } = position4;
47911
47913
  const cameraMatrix = board.camera.getMatrix();
47912
47914
  const cameraMbr = board.camera.getMbr();
47913
47915
  const positionAdjustments = {
@@ -47935,7 +47937,7 @@ function getQuickAddButtons(selection, board) {
47935
47937
  };
47936
47938
  const button = document.createElement("button");
47937
47939
  button.classList.add("microboard-quickAddButton");
47938
- if (item2.itemType === "AINode" && index2 === 2) {
47940
+ if (item.itemType === "AINode" && index2 === 2) {
47939
47941
  button.classList.add("microboard-invisible");
47940
47942
  }
47941
47943
  button.classList.add(`microboard-${adjustment.rotate}`);
@@ -47951,7 +47953,7 @@ function getQuickAddButtons(selection, board) {
47951
47953
  clearTimeout(timeoutId);
47952
47954
  }
47953
47955
  if (button.isMouseDown) {
47954
- board.tools.addConnector(true, item2, pos);
47956
+ board.tools.addConnector(true, item, pos);
47955
47957
  } else {
47956
47958
  quickAddItems = undefined;
47957
47959
  selection.subject.publish(selection);
@@ -48058,11 +48060,11 @@ class AlignmentHelper {
48058
48060
  return baseThickness / (zoom / 100);
48059
48061
  }
48060
48062
  combineMBRs(items) {
48061
- return items.reduce((acc, item2, i) => {
48063
+ return items.reduce((acc, item, i) => {
48062
48064
  if (i === 0) {
48063
48065
  return acc;
48064
48066
  }
48065
- const itemMbr = item2.getPathMbr();
48067
+ const itemMbr = item.getPathMbr();
48066
48068
  return acc.combine(itemMbr);
48067
48069
  }, items[0].getMbr());
48068
48070
  }
@@ -48076,7 +48078,7 @@ class AlignmentHelper {
48076
48078
  const scale = this.board.camera.getScale();
48077
48079
  const dynamicAlignThreshold = Math.min(this.alignThreshold / scale, 8);
48078
48080
  const childrenIds = "index" in movingItem && movingItem.index ? movingItem.getChildrenIds() : [];
48079
- const nearbyItems = this.canvasDrawer.getLastCreatedCanvas() ? this.spatialIndex.getNearestTo(movingMBR.getCenter(), 20, (item2) => !excludeItems.includes(item2), Math.ceil(cameraWidth)) : this.spatialIndex.getNearestTo(movingMBR.getCenter(), 20, (otherItem) => otherItem !== movingMBR && otherItem.itemType !== "Connector" && otherItem.itemType !== "Drawing" && otherItem.isInView(camera) && !childrenIds.includes(otherItem.getId()), Math.ceil(cameraWidth)).filter((item2) => Array.isArray(movingItem) ? !movingItem.includes(item2) : true);
48081
+ const nearbyItems = this.canvasDrawer.getLastCreatedCanvas() ? this.spatialIndex.getNearestTo(movingMBR.getCenter(), 20, (item) => !excludeItems.includes(item), Math.ceil(cameraWidth)) : this.spatialIndex.getNearestTo(movingMBR.getCenter(), 20, (otherItem) => otherItem !== movingMBR && otherItem.itemType !== "Connector" && otherItem.itemType !== "Drawing" && otherItem.isInView(camera) && !childrenIds.includes(otherItem.getId()), Math.ceil(cameraWidth)).filter((item) => Array.isArray(movingItem) ? !movingItem.includes(item) : true);
48080
48082
  const verticalAlignments = new Map;
48081
48083
  const horizontalAlignments = new Map;
48082
48084
  const addVerticalAlignment = (x, minY, maxY) => {
@@ -48097,11 +48099,11 @@ class AlignmentHelper {
48097
48099
  horizontalAlignments.set(y, { minX, maxX });
48098
48100
  }
48099
48101
  };
48100
- nearbyItems.forEach((item2) => {
48101
- if (item2 === movingItem || item2.itemType === "Comment") {
48102
+ nearbyItems.forEach((item) => {
48103
+ if (item === movingItem || item.itemType === "Comment") {
48102
48104
  return;
48103
48105
  }
48104
- const itemMbr = item2.itemType === "Shape" ? item2.getPath().getMbr() : item2.getMbr();
48106
+ const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
48105
48107
  const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
48106
48108
  const centerXItem = (itemMbr.left + itemMbr.right) / 2;
48107
48109
  const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
@@ -48368,20 +48370,20 @@ class AlignmentHelper {
48368
48370
  }
48369
48371
  return false;
48370
48372
  }
48371
- translateItems(item2, x, y, timeStamp) {
48373
+ translateItems(item, x, y, timeStamp) {
48372
48374
  if (this.canvasDrawer.getLastCreatedCanvas()) {
48373
48375
  return;
48374
48376
  }
48375
- if (Array.isArray(item2)) {
48377
+ if (Array.isArray(item)) {
48376
48378
  const translation = this.board.selection.getManyItemsTranslation(x, y);
48377
48379
  this.board.selection.transformMany(translation, timeStamp);
48378
48380
  return;
48379
48381
  }
48380
- if (item2.itemType === "Frame") {
48382
+ if (item.itemType === "Frame") {
48381
48383
  const translation = this.board.selection.getManyItemsTranslation(x, y);
48382
48384
  this.board.selection.transformMany(translation, timeStamp);
48383
48385
  } else {
48384
- const id = item2.getId();
48386
+ const id = item.getId();
48385
48387
  const transformMap = {};
48386
48388
  transformMap[id] = {
48387
48389
  class: "Transformation",
@@ -48509,12 +48511,12 @@ class Select extends Tool {
48509
48511
  this.debounceUpd.setFalse();
48510
48512
  this.snapLines = { verticalLines: [], horizontalLines: [] };
48511
48513
  }
48512
- handleSnapping(item2) {
48514
+ handleSnapping(item) {
48513
48515
  if (this.board.keyboard.isShift) {
48514
48516
  return false;
48515
48517
  }
48516
- const increasedSnapThreshold = Array.isArray(item2) ? 40 : 35;
48517
- this.isSnapped = this.alignmentHelper.snapToClosestLine(item2, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
48518
+ const increasedSnapThreshold = Array.isArray(item) ? 40 : 35;
48519
+ this.isSnapped = this.alignmentHelper.snapToClosestLine(item, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
48518
48520
  if (this.isSnapped) {
48519
48521
  if (!this.snapCursorPos) {
48520
48522
  this.snapCursorPos = new Point(this.board.pointer.point.x, this.board.pointer.point.y);
@@ -48524,10 +48526,10 @@ class Select extends Tool {
48524
48526
  if ((cursorDiffX > increasedSnapThreshold || cursorDiffY > increasedSnapThreshold) && this.initialCursorPos) {
48525
48527
  this.isSnapped = false;
48526
48528
  this.snapCursorPos = null;
48527
- const itemCenter = Array.isArray(item2) ? this.alignmentHelper.combineMBRs(item2).getCenter() : item2.getMbr().getCenter();
48529
+ const itemCenter = Array.isArray(item) ? this.alignmentHelper.combineMBRs(item).getCenter() : item.getMbr().getCenter();
48528
48530
  const translateX = this.board.pointer.point.x - this.initialCursorPos.x - itemCenter.x;
48529
48531
  const translateY = this.board.pointer.point.y - this.initialCursorPos.y - itemCenter.y;
48530
- this.alignmentHelper.translateItems(item2, translateX, translateY, this.beginTimeStamp);
48532
+ this.alignmentHelper.translateItems(item, translateX, translateY, this.beginTimeStamp);
48531
48533
  }
48532
48534
  }
48533
48535
  return false;
@@ -48577,10 +48579,10 @@ class Select extends Tool {
48577
48579
  angleDiff = angleDiff < 0 ? angleDiff + 360 : angleDiff;
48578
48580
  return Math.min(angleDiff, 360 - angleDiff);
48579
48581
  }
48580
- handleShiftGuidelines(item2, mousePosition) {
48581
- if (item2) {
48582
+ handleShiftGuidelines(item, mousePosition) {
48583
+ if (item) {
48582
48584
  if (!this.originalCenter) {
48583
- this.originalCenter = Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().copy() : item2.getMbr().getCenter().copy();
48585
+ this.originalCenter = Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().copy() : item.getMbr().getCenter().copy();
48584
48586
  this.guidelines = this.alignmentHelper.generateGuidelines(this.originalCenter).lines;
48585
48587
  }
48586
48588
  this.mainLine = new Line(this.originalCenter, mousePosition);
@@ -48601,13 +48603,13 @@ class Select extends Tool {
48601
48603
  const newEndX = this.originalCenter.x + snapDirectionX * mainLineLength;
48602
48604
  const newEndY = this.originalCenter.y + snapDirectionY * mainLineLength;
48603
48605
  const threshold = Infinity;
48604
- const translateX = newEndX - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().x : item2.getMbr().getCenter().x);
48605
- const translateY = newEndY - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().y : item2.getMbr().getCenter().y);
48606
- if (Array.isArray(item2)) {
48606
+ const translateX = newEndX - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().x : item.getMbr().getCenter().x);
48607
+ const translateY = newEndY - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().y : item.getMbr().getCenter().y);
48608
+ if (Array.isArray(item)) {
48607
48609
  const translation = this.board.selection.getManyItemsTranslation(translateX, translateY);
48608
48610
  this.board.selection.transformMany(translation, this.beginTimeStamp);
48609
48611
  } else {
48610
- item2.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
48612
+ item.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
48611
48613
  }
48612
48614
  }
48613
48615
  }
@@ -48650,7 +48652,7 @@ class Select extends Tool {
48650
48652
  return false;
48651
48653
  }
48652
48654
  this.isDownOnBoard = hover.length === 0;
48653
- this.isDrawingRectangle = hover.filter((item2) => !(item2 instanceof Frame2)).length === 0 && hover.filter((item2) => item2 instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
48655
+ this.isDrawingRectangle = hover.filter((item) => !(item instanceof Frame2)).length === 0 && hover.filter((item) => item instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
48654
48656
  if (this.isDrawingRectangle) {
48655
48657
  const { x, y } = pointer.point;
48656
48658
  this.line = new Line(new Point(x, y), new Point(x, y));
@@ -48670,7 +48672,7 @@ class Select extends Tool {
48670
48672
  });
48671
48673
  return false;
48672
48674
  }
48673
- const isHoverLocked = hover.every((item2) => item2.transformation.isLocked);
48675
+ const isHoverLocked = hover.every((item) => item.transformation.isLocked);
48674
48676
  if (isHoverLocked) {
48675
48677
  return false;
48676
48678
  }
@@ -48804,7 +48806,7 @@ class Select extends Tool {
48804
48806
  const translation = selection.getManyItemsTranslation(x, y);
48805
48807
  const translationKeys = Object.keys(translation);
48806
48808
  const commentsSet = new Set(this.board.items.getComments().map((comment2) => comment2.getId()));
48807
- if (translationKeys.filter((item2) => !commentsSet.has(item2)).length > 10) {
48809
+ if (translationKeys.filter((item) => !commentsSet.has(item)).length > 10) {
48808
48810
  const selectedMbr = this.board.selection.getMbr()?.copy();
48809
48811
  const sumMbr = this.canvasDrawer.countSumMbr(translation);
48810
48812
  if (sumMbr) {
@@ -48831,7 +48833,7 @@ class Select extends Tool {
48831
48833
  return false;
48832
48834
  }
48833
48835
  const draggingMbr = draggingItem.getMbr();
48834
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item2) => item2 instanceof Frame2);
48836
+ const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
48835
48837
  frames.forEach((frame) => {
48836
48838
  if (frame.handleNesting(draggingItem)) {
48837
48839
  this.nestingHighlighter.add(frame, draggingItem);
@@ -48841,7 +48843,7 @@ class Select extends Tool {
48841
48843
  });
48842
48844
  }
48843
48845
  const hover = items.getUnderPointer();
48844
- this.isHoverUnselectedItem = hover.filter((item2) => item2.itemType === "Placeholder").length === 1;
48846
+ this.isHoverUnselectedItem = hover.filter((item) => item.itemType === "Placeholder").length === 1;
48845
48847
  if (this.isHoverUnselectedItem && !this.isDraggingUnselectedItem && selection.getContext() === "None") {
48846
48848
  selection.setContext("HoverUnderPointer");
48847
48849
  return false;
@@ -48885,15 +48887,15 @@ class Select extends Tool {
48885
48887
  }
48886
48888
  }
48887
48889
  updateFramesNesting(selectionMbr, selection) {
48888
- const frames = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item2) => item2 instanceof Frame2).filter((frame) => !selection.items.list().includes(frame));
48889
- const draggingFramesIds = selection.list().filter((item2) => item2 instanceof Frame2).map((frame) => frame.getId());
48890
- selection.list().forEach((item2) => {
48891
- if (!(item2 instanceof Frame2) && !draggingFramesIds.includes(item2.parent)) {
48890
+ const frames = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => item instanceof Frame2).filter((frame) => !selection.items.list().includes(frame));
48891
+ const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
48892
+ selection.list().forEach((item) => {
48893
+ if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
48892
48894
  frames.forEach((frame) => {
48893
- if (frame.handleNesting(item2)) {
48894
- this.nestingHighlighter.add(frame, item2);
48895
+ if (frame.handleNesting(item)) {
48896
+ this.nestingHighlighter.add(frame, item);
48895
48897
  } else {
48896
- this.nestingHighlighter.remove(item2);
48898
+ this.nestingHighlighter.remove(item);
48897
48899
  }
48898
48900
  });
48899
48901
  }
@@ -48985,7 +48987,7 @@ class Select extends Tool {
48985
48987
  const childrenIds = underPointer.getChildrenIds();
48986
48988
  console.log("UNDERPOINTER", underPointer);
48987
48989
  console.log("CHILDREN", childrenIds);
48988
- const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => childrenIds && childrenIds.includes(item2.getId()));
48990
+ const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => childrenIds && childrenIds.includes(item.getId()));
48989
48991
  this.board.selection.add(itemsInFrame);
48990
48992
  }
48991
48993
  this.board.selection.setContext("EditUnderPointer");
@@ -49225,8 +49227,8 @@ class ShapeTool extends CustomTool {
49225
49227
  resizeType = "leftBottom";
49226
49228
  bounds = new Mbr;
49227
49229
  isDown = false;
49228
- constructor(board, name, item2, settings) {
49229
- super(board, name, item2);
49230
+ constructor(board, name, item, settings) {
49231
+ super(board, name, item);
49230
49232
  this.settings = settings;
49231
49233
  this.setCursor();
49232
49234
  }
@@ -49309,8 +49311,8 @@ class ShapeTool extends CustomTool {
49309
49311
 
49310
49312
  class StickerTool extends CustomTool {
49311
49313
  settings;
49312
- constructor(board, name, item2, settings) {
49313
- super(board, name, item2);
49314
+ constructor(board, name, item, settings) {
49315
+ super(board, name, item);
49314
49316
  this.settings = settings;
49315
49317
  this.setCursor();
49316
49318
  }
@@ -49616,7 +49618,7 @@ class Tools extends ToolContext {
49616
49618
  this.subject.publish(this);
49617
49619
  }
49618
49620
  sortFrames() {
49619
- const frames = this.board.items.listAll().filter((item2) => item2 instanceof Frame2);
49621
+ const frames = this.board.items.listAll().filter((item) => item instanceof Frame2);
49620
49622
  const sortedFrames = frames.sort((fr1, fr2) => {
49621
49623
  const mbr1 = fr1.getMbr();
49622
49624
  const mbr2 = fr2.getMbr();
@@ -49842,24 +49844,24 @@ function validateGroupData(groupData) {
49842
49844
  }
49843
49845
  // src/Items/RegisterItem.ts
49844
49846
  function registerItem({
49845
- item: item2,
49847
+ item,
49846
49848
  defaultData: defaultData2,
49847
49849
  toolData
49848
49850
  }) {
49849
49851
  const { itemType } = defaultData2;
49850
- itemFactories[itemType] = createItemFactory(item2, defaultData2);
49852
+ itemFactories[itemType] = createItemFactory(item, defaultData2);
49851
49853
  itemValidators[itemType] = createItemValidator(defaultData2);
49852
49854
  if (toolData) {
49853
49855
  registeredTools[toolData.name] = toolData.tool;
49854
49856
  }
49855
49857
  itemCommandFactories[itemType] = createItemCommandFactory(itemType);
49856
49858
  }
49857
- function createItemFactory(item2, defaultData2) {
49859
+ function createItemFactory(item, defaultData2) {
49858
49860
  return function itemFactory(id, data, board) {
49859
49861
  if (data.itemType !== defaultData2.itemType) {
49860
49862
  throw new Error(`Invalid data for ${defaultData2.itemType}`);
49861
49863
  }
49862
- return new item2(board, id, defaultData2).setId(id).deserialize(data);
49864
+ return new item(board, id, defaultData2).setId(id).deserialize(data);
49863
49865
  };
49864
49866
  }
49865
49867
  function createItemValidator(defaultData2) {
@@ -49874,7 +49876,7 @@ function createItemValidator(defaultData2) {
49874
49876
  }
49875
49877
  function createItemCommandFactory(itemType) {
49876
49878
  return function itemCommandFactory(items, operation) {
49877
- return new BaseCommand(items.filter((item2) => item2.itemType === itemType), operation);
49879
+ return new BaseCommand(items.filter((item) => item.itemType === itemType), operation);
49878
49880
  };
49879
49881
  }
49880
49882
  // src/Items/Examples/Star/AddStar.ts
@@ -50899,8 +50901,8 @@ class Camera {
50899
50901
  this.observableItem = null;
50900
50902
  }
50901
50903
  }
50902
- subscribeToItem(item2) {
50903
- this.observableItem = item2;
50904
+ subscribeToItem(item) {
50905
+ this.observableItem = item;
50904
50906
  this.observableItem.subject.subscribe(this.observeItem);
50905
50907
  }
50906
50908
  observeItem = () => {
@@ -51126,7 +51128,7 @@ class Camera {
51126
51128
  }
51127
51129
  addToView(mbr, inView) {
51128
51130
  if (!mbr.isEnclosedBy(this.getMbr())) {
51129
- this.viewRectangle(inView.reduce((acc, item2) => acc.combine(item2.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
51131
+ this.viewRectangle(inView.reduce((acc, item) => acc.combine(item.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
51130
51132
  }
51131
51133
  }
51132
51134
  viewRectangle(mbr, offsetInPercent = 10, duration = 500) {
@@ -52735,8 +52737,8 @@ class Presence {
52735
52737
  <path fill-rule="evenodd" clip-rule="evenodd" d="M3.28421 4.30174C3.55182 4.02741 3.95268 3.93015 4.31625 4.05135L20.3163 9.38468C20.7064 9.51472 20.9771 9.8703 20.9987 10.2809C21.0202 10.6916 20.7882 11.0736 20.4138 11.2437L20.36 11.2682L20.2042 11.3396C20.069 11.4015 19.8742 11.4912 19.636 11.6017C19.1595 11.8227 18.5109 12.1262 17.8216 12.4571C16.4106 13.1344 14.9278 13.8797 14.3325 14.2765C14.3325 14.2765 14.3258 14.2809 14.308 14.2965C14.2906 14.3118 14.2673 14.3339 14.2382 14.3646C14.1791 14.4267 14.1072 14.5123 14.0231 14.6243C13.8542 14.8496 13.6622 15.1471 13.4541 15.5039C13.0384 16.2164 12.5946 17.1024 12.1833 17.98C11.7735 18.8541 11.4038 19.7031 11.136 20.3348C11.0023 20.6502 10.8944 20.9105 10.8201 21.0915C10.783 21.182 10.7543 21.2525 10.735 21.3002L10.7132 21.3542L10.7066 21.3707C10.5524 21.7561 10.1759 22.0069 9.76082 21.9999C9.34577 21.9928 8.97824 21.7301 8.83725 21.3397L3.05947 5.33967C2.92931 4.97922 3.0166 4.57607 3.28421 4.30174Z" fill="${color2}"/>
52736
52738
  </svg>`;
52737
52739
  }
52738
- renderItemMbr(context, item2, color2, customScale) {
52739
- const mbr = item2.getMbr();
52740
+ renderItemMbr(context, item, color2, customScale) {
52741
+ const mbr = item.getMbr();
52740
52742
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
52741
52743
  mbr.borderColor = color2;
52742
52744
  mbr.render(context);
@@ -52876,8 +52878,8 @@ class Presence {
52876
52878
  selectionMbr.strokeWidth = 1 / context.matrix.scaleX;
52877
52879
  selectionMbr.borderColor = selection.color;
52878
52880
  selectionMbr.render(context);
52879
- for (const item2 of selection.selection) {
52880
- this.renderItemMbr(context, item2, selection.color);
52881
+ for (const item of selection.selection) {
52882
+ this.renderItemMbr(context, item, selection.color);
52881
52883
  }
52882
52884
  }
52883
52885
  }
@@ -52910,14 +52912,14 @@ class SelectionItems {
52910
52912
  items = new Map;
52911
52913
  add(value) {
52912
52914
  if (Array.isArray(value)) {
52913
- value.forEach((item2) => this.items.set(item2.getId(), item2));
52915
+ value.forEach((item) => this.items.set(item.getId(), item));
52914
52916
  } else {
52915
52917
  this.items.set(value.getId(), value);
52916
52918
  }
52917
52919
  }
52918
52920
  remove(value) {
52919
52921
  if (Array.isArray(value)) {
52920
- value.forEach((item2) => this.items.delete(item2.getId()));
52922
+ value.forEach((item) => this.items.delete(item.getId()));
52921
52923
  } else {
52922
52924
  this.items.delete(value.getId());
52923
52925
  }
@@ -52947,8 +52949,8 @@ class SelectionItems {
52947
52949
  if (this.isEmpty()) {
52948
52950
  return false;
52949
52951
  }
52950
- for (const item2 of this.items.values()) {
52951
- if (item2.itemType !== "RichText") {
52952
+ for (const item of this.items.values()) {
52953
+ if (item.itemType !== "RichText") {
52952
52954
  return false;
52953
52955
  }
52954
52956
  }
@@ -52958,14 +52960,14 @@ class SelectionItems {
52958
52960
  if (this.isEmpty()) {
52959
52961
  return false;
52960
52962
  }
52961
- return Array.from(this.items).every(([, item2]) => item2.itemType === itemType);
52963
+ return Array.from(this.items).every(([, item]) => item.itemType === itemType);
52962
52964
  }
52963
52965
  isItemTypes(itemTypes) {
52964
52966
  if (this.isEmpty()) {
52965
52967
  return false;
52966
52968
  }
52967
- for (const item2 of this.items.values()) {
52968
- if (!itemTypes.includes(item2.itemType)) {
52969
+ for (const item of this.items.values()) {
52970
+ if (!itemTypes.includes(item.itemType)) {
52969
52971
  return false;
52970
52972
  }
52971
52973
  }
@@ -52973,16 +52975,16 @@ class SelectionItems {
52973
52975
  }
52974
52976
  getItemTypes() {
52975
52977
  const itemTypes = new Set;
52976
- this.items.forEach((item2) => itemTypes.add(item2.itemType));
52978
+ this.items.forEach((item) => itemTypes.add(item.itemType));
52977
52979
  return Array.from(itemTypes);
52978
52980
  }
52979
52981
  getItemsByItemTypes(itemTypes) {
52980
- return Array.from(this.items.values()).filter((item2) => itemTypes.includes(item2.itemType));
52982
+ return Array.from(this.items.values()).filter((item) => itemTypes.includes(item.itemType));
52981
52983
  }
52982
52984
  getIdsByItemTypes(itemTypes) {
52983
52985
  const ids = [];
52984
- this.items.forEach((item2, id) => {
52985
- if (itemTypes.includes(item2.itemType)) {
52986
+ this.items.forEach((item, id) => {
52987
+ if (itemTypes.includes(item.itemType)) {
52986
52988
  ids.push(id);
52987
52989
  }
52988
52990
  });
@@ -52992,7 +52994,7 @@ class SelectionItems {
52992
52994
  return this.isSingle() ? this.items.values().next().value || null : null;
52993
52995
  }
52994
52996
  listByIds(itemIdList) {
52995
- return itemIdList.map((id) => this.items.get(id)).filter((item2) => item2 !== undefined);
52997
+ return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
52996
52998
  }
52997
52999
  ids() {
52998
53000
  return Array.from(this.items.keys());
@@ -53003,7 +53005,7 @@ class SelectionItems {
53003
53005
  return;
53004
53006
  }
53005
53007
  const mbr = items[0].getMbr();
53006
- items.slice(1).forEach((item2) => mbr.combine(item2.getMbr()));
53008
+ items.slice(1).forEach((item) => mbr.combine(item.getMbr()));
53007
53009
  return mbr;
53008
53010
  }
53009
53011
  }
@@ -53208,33 +53210,33 @@ function handleMultipleItemsResize({
53208
53210
  const translation = {};
53209
53211
  const items = itemsToResize ? itemsToResize : board.selection.items.list();
53210
53212
  board.items.getComments().forEach((comment2) => {
53211
- if (items.some((item2) => item2.getId() === comment2.getItemToFollow())) {
53213
+ if (items.some((item) => item.getId() === comment2.getItemToFollow())) {
53212
53214
  items.push(comment2);
53213
53215
  }
53214
53216
  });
53215
- for (const item2 of items) {
53216
- let itemX = item2.getMbr().left;
53217
- let itemY = item2.getMbr().top;
53218
- if (item2.itemType === "Drawing") {
53219
- itemX = item2.transformation.matrix.translateX;
53220
- itemY = item2.transformation.matrix.translateY;
53217
+ for (const item of items) {
53218
+ let itemX = item.getMbr().left;
53219
+ let itemY = item.getMbr().top;
53220
+ if (item.itemType === "Drawing") {
53221
+ itemX = item.transformation.matrix.translateX;
53222
+ itemY = item.transformation.matrix.translateY;
53221
53223
  }
53222
53224
  const deltaX = itemX - initMbr.left;
53223
53225
  const translateX = deltaX * matrix.scaleX - deltaX + matrix.translateX;
53224
53226
  const deltaY = itemY - initMbr.top;
53225
53227
  const translateY = deltaY * matrix.scaleY - deltaY + matrix.translateY;
53226
- if (item2 instanceof RichText) {
53227
- translation[item2.getId()] = getRichTextTranslation({
53228
- item: item2,
53228
+ if (item instanceof RichText) {
53229
+ translation[item.getId()] = getRichTextTranslation({
53230
+ item,
53229
53231
  isWidth,
53230
53232
  isHeight,
53231
53233
  matrix,
53232
53234
  translateX,
53233
53235
  translateY
53234
53236
  });
53235
- } else if (item2 instanceof AINode) {
53236
- translation[item2.getId()] = getAINodeTranslation({
53237
- item: item2,
53237
+ } else if (item instanceof AINode) {
53238
+ translation[item.getId()] = getAINodeTranslation({
53239
+ item,
53238
53240
  isWidth,
53239
53241
  isHeight,
53240
53242
  matrix,
@@ -53242,8 +53244,8 @@ function handleMultipleItemsResize({
53242
53244
  translateY
53243
53245
  });
53244
53246
  } else {
53245
- translation[item2.getId()] = getItemTranslation({
53246
- item: item2,
53247
+ translation[item.getId()] = getItemTranslation({
53248
+ item,
53247
53249
  isWidth,
53248
53250
  isHeight,
53249
53251
  matrix,
@@ -53256,7 +53258,7 @@ function handleMultipleItemsResize({
53256
53258
  return translation;
53257
53259
  }
53258
53260
  function getRichTextTranslation({
53259
- item: item2,
53261
+ item,
53260
53262
  isWidth,
53261
53263
  isHeight,
53262
53264
  matrix,
@@ -53264,11 +53266,11 @@ function getRichTextTranslation({
53264
53266
  translateY
53265
53267
  }) {
53266
53268
  if (isWidth) {
53267
- item2.editor.setMaxWidth(item2.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
53269
+ item.editor.setMaxWidth(item.getWidth() / item.transformation.getScale().x * matrix.scaleX);
53268
53270
  return {
53269
53271
  class: "Transformation",
53270
53272
  method: "scaleByTranslateBy",
53271
- item: [item2.getId()],
53273
+ item: [item.getId()],
53272
53274
  translate: { x: matrix.translateX, y: 0 },
53273
53275
  scale: { x: matrix.scaleX, y: matrix.scaleX }
53274
53276
  };
@@ -53276,7 +53278,7 @@ function getRichTextTranslation({
53276
53278
  return {
53277
53279
  class: "Transformation",
53278
53280
  method: "scaleByTranslateBy",
53279
- item: [item2.getId()],
53281
+ item: [item.getId()],
53280
53282
  translate: { x: translateX, y: translateY },
53281
53283
  scale: { x: 1, y: 1 }
53282
53284
  };
@@ -53284,14 +53286,14 @@ function getRichTextTranslation({
53284
53286
  return {
53285
53287
  class: "Transformation",
53286
53288
  method: "scaleByTranslateBy",
53287
- item: [item2.getId()],
53289
+ item: [item.getId()],
53288
53290
  translate: { x: translateX, y: translateY },
53289
53291
  scale: { x: matrix.scaleX, y: matrix.scaleX }
53290
53292
  };
53291
53293
  }
53292
53294
  }
53293
53295
  function getAINodeTranslation({
53294
- item: item2,
53296
+ item,
53295
53297
  isWidth,
53296
53298
  isHeight,
53297
53299
  matrix,
@@ -53299,11 +53301,11 @@ function getAINodeTranslation({
53299
53301
  translateY
53300
53302
  }) {
53301
53303
  if (isWidth) {
53302
- item2.text.editor.setMaxWidth(item2.text.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
53304
+ item.text.editor.setMaxWidth(item.text.getWidth() / item.transformation.getScale().x * matrix.scaleX);
53303
53305
  return {
53304
53306
  class: "Transformation",
53305
53307
  method: "scaleByTranslateBy",
53306
- item: [item2.getId()],
53308
+ item: [item.getId()],
53307
53309
  translate: { x: matrix.translateX, y: 0 },
53308
53310
  scale: { x: matrix.scaleX, y: matrix.scaleX }
53309
53311
  };
@@ -53311,7 +53313,7 @@ function getAINodeTranslation({
53311
53313
  return {
53312
53314
  class: "Transformation",
53313
53315
  method: "scaleByTranslateBy",
53314
- item: [item2.getId()],
53316
+ item: [item.getId()],
53315
53317
  translate: { x: translateX, y: translateY },
53316
53318
  scale: { x: 1, y: 1 }
53317
53319
  };
@@ -53319,14 +53321,14 @@ function getAINodeTranslation({
53319
53321
  return {
53320
53322
  class: "Transformation",
53321
53323
  method: "scaleByTranslateBy",
53322
- item: [item2.getId()],
53324
+ item: [item.getId()],
53323
53325
  translate: { x: translateX, y: translateY },
53324
53326
  scale: { x: matrix.scaleX, y: matrix.scaleX }
53325
53327
  };
53326
53328
  }
53327
53329
  }
53328
53330
  function getItemTranslation({
53329
- item: item2,
53331
+ item,
53330
53332
  isWidth,
53331
53333
  isHeight,
53332
53334
  matrix,
@@ -53334,22 +53336,22 @@ function getItemTranslation({
53334
53336
  translateY,
53335
53337
  isShiftPressed
53336
53338
  }) {
53337
- if (item2 instanceof Sticker && (isWidth || isHeight)) {
53339
+ if (item instanceof Sticker && (isWidth || isHeight)) {
53338
53340
  return {
53339
53341
  class: "Transformation",
53340
53342
  method: "scaleByTranslateBy",
53341
- item: [item2.getId()],
53343
+ item: [item.getId()],
53342
53344
  translate: { x: translateX, y: translateY },
53343
53345
  scale: { x: 1, y: 1 }
53344
53346
  };
53345
53347
  } else {
53346
- if (item2 instanceof Frame2 && item2.getCanChangeRatio() && isShiftPressed && item2.getFrameType() !== "Custom") {
53347
- item2.setFrameType("Custom");
53348
+ if (item instanceof Frame2 && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
53349
+ item.setFrameType("Custom");
53348
53350
  }
53349
53351
  return {
53350
53352
  class: "Transformation",
53351
53353
  method: "scaleByTranslateBy",
53352
- item: [item2.getId()],
53354
+ item: [item.getId()],
53353
53355
  translate: { x: translateX, y: translateY },
53354
53356
  scale: { x: matrix.scaleX, y: matrix.scaleY }
53355
53357
  };
@@ -53622,11 +53624,11 @@ function transformItems({
53622
53624
  setSnapCursorPos
53623
53625
  }) {
53624
53626
  const items = selection.items.list();
53625
- const includesProportionalItem = items.some((item2) => item2.itemType === "Sticker" || item2.itemType === "RichText" || item2.itemType === "AINode" || item2.itemType === "Video" || item2.itemType === "Audio");
53627
+ const includesProportionalItem = items.some((item) => item.itemType === "Sticker" || item.itemType === "RichText" || item.itemType === "AINode" || item.itemType === "Video" || item.itemType === "Audio");
53626
53628
  if (includesProportionalItem && (isWidth || isHeight)) {
53627
53629
  return null;
53628
53630
  }
53629
- const isIncludesFixedFrame = items.some((item2) => item2 instanceof Frame2 && !item2.getCanChangeRatio());
53631
+ const isIncludesFixedFrame = items.some((item) => item instanceof Frame2 && !item.getCanChangeRatio());
53630
53632
  const shouldBeProportionalResize = isIncludesFixedFrame || includesProportionalItem || isShiftPressed || !isWidth && !isHeight;
53631
53633
  const resize = shouldBeProportionalResize ? getProportionalResize(resizeType, board.pointer.point, mbr, oppositePoint) : getResize(resizeType, board.pointer.point, mbr, oppositePoint);
53632
53634
  if (canvasDrawer.getLastCreatedCanvas() && !debounceUpd.shouldUpd()) {
@@ -53704,23 +53706,23 @@ function updateFrameChildren({
53704
53706
  nestingHighlighter
53705
53707
  }) {
53706
53708
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
53707
- board.selection.items.list().forEach((item2) => {
53708
- if ("getChildrenIds" in item2 && item2.getChildrenIds()) {
53709
- const currMbr = item2.getMbr();
53709
+ board.selection.items.list().forEach((item) => {
53710
+ if ("getChildrenIds" in item && item.getChildrenIds()) {
53711
+ const currMbr = item.getMbr();
53710
53712
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
53711
53713
  itemsToCheck.forEach((currItem) => {
53712
- if (item2.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item2.getId())) {
53713
- nestingHighlighter.add(item2, currItem);
53714
+ if (item.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item.getId())) {
53715
+ nestingHighlighter.add(item, currItem);
53714
53716
  } else {
53715
53717
  nestingHighlighter.remove(currItem);
53716
53718
  }
53717
53719
  });
53718
53720
  } else {
53719
53721
  groups.forEach((group) => {
53720
- if (group.handleNesting(item2)) {
53721
- nestingHighlighter.add(group, item2);
53722
+ if (group.handleNesting(item)) {
53723
+ nestingHighlighter.add(group, item);
53722
53724
  } else {
53723
- nestingHighlighter.remove(item2);
53725
+ nestingHighlighter.remove(item);
53724
53726
  }
53725
53727
  });
53726
53728
  }
@@ -53788,9 +53790,9 @@ class Transformer extends Tool {
53788
53790
  const pointer = this.board.pointer;
53789
53791
  const camera = this.board.camera;
53790
53792
  const items = this.selection.items;
53791
- const item2 = items.getSingle();
53793
+ const item = items.getSingle();
53792
53794
  let resizeType;
53793
- if (item2 && (item2.itemType === "RichText" || item2.itemType === "Sticker")) {
53795
+ if (item && (item.itemType === "RichText" || item.itemType === "Sticker")) {
53794
53796
  resizeType = getTextResizeType(pointer.point, camera.getScale(), mbr);
53795
53797
  } else {
53796
53798
  resizeType = getResizeType(pointer.point, camera.getScale(), mbr);
@@ -54044,8 +54046,8 @@ class SelectionTransformer extends Tool {
54044
54046
  return;
54045
54047
  }
54046
54048
  if (this.selection.items.isSingle()) {
54047
- const item2 = this.selection.items.getSingle();
54048
- if (item2?.itemType === "Connector") {
54049
+ const item = this.selection.items.getSingle();
54050
+ if (item?.itemType === "Connector") {
54049
54051
  this.tool = this.connectorTransformerTool;
54050
54052
  return;
54051
54053
  } else {
@@ -54128,16 +54130,16 @@ class BoardSelection {
54128
54130
  this.quickAddButtons = getQuickAddButtons(this, board);
54129
54131
  }
54130
54132
  serialize() {
54131
- const selectedItems = this.items.list().map((item2) => item2.getId());
54133
+ const selectedItems = this.items.list().map((item) => item.getId());
54132
54134
  return JSON.stringify(selectedItems);
54133
54135
  }
54134
54136
  deserialize(serializedData) {
54135
54137
  const selectedItems = JSON.parse(serializedData);
54136
54138
  this.removeAll();
54137
54139
  selectedItems.forEach((itemId) => {
54138
- const item2 = this.board.items.getById(itemId);
54139
- if (item2) {
54140
- this.items.add(item2);
54140
+ const item = this.board.items.getById(itemId);
54141
+ if (item) {
54142
+ this.items.add(item);
54141
54143
  }
54142
54144
  });
54143
54145
  }
@@ -54215,19 +54217,19 @@ class BoardSelection {
54215
54217
  this.updateQueue.clear();
54216
54218
  safeRequestAnimationFrame(this.updateScheduledObservers);
54217
54219
  };
54218
- itemObserver = (item2) => {
54220
+ itemObserver = (item) => {
54219
54221
  if (!this.shouldPublish) {
54220
54222
  return;
54221
54223
  }
54222
54224
  this.subject.publish(this);
54223
- this.itemSubject.publish(item2);
54225
+ this.itemSubject.publish(item);
54224
54226
  };
54225
54227
  decoratedItemObserver = this.decorateObserverToScheduleUpdate(this.itemObserver);
54226
54228
  add(value) {
54227
54229
  this.items.add(value);
54228
54230
  if (Array.isArray(value)) {
54229
- for (const item2 of value) {
54230
- item2.subject.subscribe(this.itemObserver);
54231
+ for (const item of value) {
54232
+ item.subject.subscribe(this.itemObserver);
54231
54233
  }
54232
54234
  } else {
54233
54235
  value.subject.subscribe(this.itemObserver);
@@ -54236,15 +54238,15 @@ class BoardSelection {
54236
54238
  this.itemsSubject.publish([]);
54237
54239
  }
54238
54240
  addAll() {
54239
- const items = this.board.items.listAll().filter((item2) => !item2.transformation.isLocked);
54241
+ const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked);
54240
54242
  this.add(items);
54241
54243
  this.setContext("SelectByRect");
54242
54244
  }
54243
54245
  remove(value) {
54244
54246
  this.items.remove(value);
54245
54247
  if (Array.isArray(value)) {
54246
- for (const item2 of value) {
54247
- item2.subject.unsubscribe(this.itemObserver);
54248
+ for (const item of value) {
54249
+ item.subject.unsubscribe(this.itemObserver);
54248
54250
  }
54249
54251
  } else {
54250
54252
  value.subject.unsubscribe(this.itemObserver);
@@ -54338,11 +54340,11 @@ class BoardSelection {
54338
54340
  if (!this.items.isSingle()) {
54339
54341
  return;
54340
54342
  }
54341
- const item2 = this.items.getSingle();
54342
- if (!item2) {
54343
+ const item = this.items.getSingle();
54344
+ if (!item) {
54343
54345
  return;
54344
54346
  }
54345
- const text5 = item2.getRichText();
54347
+ const text5 = item.getRichText();
54346
54348
  if (!text5) {
54347
54349
  return;
54348
54350
  }
@@ -54353,7 +54355,7 @@ class BoardSelection {
54353
54355
  if (shouldReplace || moveCursorToEnd) {
54354
54356
  text5.editor.moveCursorToEndOfTheText();
54355
54357
  }
54356
- this.setTextToEdit(item2);
54358
+ this.setTextToEdit(item);
54357
54359
  this.setContext("EditTextUnderPointer");
54358
54360
  if (shouldSelect) {
54359
54361
  text5.editor.selectWholeText();
@@ -54363,13 +54365,13 @@ class BoardSelection {
54363
54365
  editUnderPointer() {
54364
54366
  this.removeAll();
54365
54367
  const stack = this.board.items.getUnderPointer();
54366
- const item2 = stack.pop();
54367
- if (item2) {
54368
- this.add(item2);
54368
+ const item = stack.pop();
54369
+ if (item) {
54370
+ this.add(item);
54369
54371
  this.setTextToEdit(undefined);
54370
- const text5 = item2.getRichText();
54372
+ const text5 = item.getRichText();
54371
54373
  if (text5) {
54372
- this.setTextToEdit(item2);
54374
+ this.setTextToEdit(item);
54373
54375
  text5.editor.selectWholeText();
54374
54376
  this.board.items.subject.publish(this.board.items);
54375
54377
  }
@@ -54378,26 +54380,26 @@ class BoardSelection {
54378
54380
  this.setContext("None");
54379
54381
  }
54380
54382
  }
54381
- setTextToEdit(item2) {
54383
+ setTextToEdit(item) {
54382
54384
  if (this.textToEdit) {
54383
54385
  this.textToEdit.updateElement();
54384
54386
  this.textToEdit.enableRender();
54385
54387
  }
54386
- if (!(item2 && item2.getRichText())) {
54388
+ if (!(item && item.getRichText())) {
54387
54389
  this.textToEdit = undefined;
54388
54390
  return;
54389
54391
  }
54390
- const text5 = item2.getRichText();
54392
+ const text5 = item.getRichText();
54391
54393
  if (!text5) {
54392
54394
  return;
54393
54395
  }
54394
54396
  if (text5.isEmpty()) {
54395
- const textColor = tempStorage.getFontColor(item2.itemType);
54396
- const textSize = tempStorage.getFontSize(item2.itemType);
54397
- const highlightColor = tempStorage.getFontHighlight(item2.itemType);
54398
- const styles = tempStorage.getFontStyles(item2.itemType);
54399
- const horizontalAlignment = tempStorage.getHorizontalAlignment(item2.itemType);
54400
- const verticalAlignment = tempStorage.getVerticalAlignment(item2.itemType);
54397
+ const textColor = tempStorage.getFontColor(item.itemType);
54398
+ const textSize = tempStorage.getFontSize(item.itemType);
54399
+ const highlightColor = tempStorage.getFontHighlight(item.itemType);
54400
+ const styles = tempStorage.getFontStyles(item.itemType);
54401
+ const horizontalAlignment = tempStorage.getHorizontalAlignment(item.itemType);
54402
+ const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
54401
54403
  if (textColor) {
54402
54404
  text5.setSelectionFontColor(textColor, "None");
54403
54405
  }
@@ -54405,7 +54407,7 @@ class BoardSelection {
54405
54407
  this.emit({
54406
54408
  class: "RichText",
54407
54409
  method: "setFontSize",
54408
- item: [item2.getId()],
54410
+ item: [item.getId()],
54409
54411
  fontSize: textSize,
54410
54412
  context: this.getContext()
54411
54413
  });
@@ -54417,10 +54419,10 @@ class BoardSelection {
54417
54419
  const stylesArr = styles;
54418
54420
  text5.setSelectionFontStyle(stylesArr, "None");
54419
54421
  }
54420
- if (horizontalAlignment && !(item2 instanceof Sticker)) {
54422
+ if (horizontalAlignment && !(item instanceof Sticker)) {
54421
54423
  text5.setSelectionHorisontalAlignment(horizontalAlignment);
54422
54424
  }
54423
- if (verticalAlignment && !(item2 instanceof Sticker)) {
54425
+ if (verticalAlignment && !(item instanceof Sticker)) {
54424
54426
  this.setVerticalAlignment(verticalAlignment);
54425
54427
  }
54426
54428
  }
@@ -54453,8 +54455,8 @@ class BoardSelection {
54453
54455
  }
54454
54456
  selectEnclosedOrCrossedBy(rect) {
54455
54457
  this.removeAll();
54456
- const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item2) => !item2.transformation.isLocked);
54457
- const list6 = this.board.items.getEnclosedOrCrossed(rect.left, rect.top, rect.right, rect.bottom).filter((item2) => (!(item2 instanceof Frame2) || enclosedFrames.includes(item2)) && !item2.transformation.isLocked);
54458
+ const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item) => !item.transformation.isLocked);
54459
+ const list6 = this.board.items.getEnclosedOrCrossed(rect.left, rect.top, rect.right, rect.bottom).filter((item) => (!(item instanceof Frame2) || enclosedFrames.includes(item)) && !item.transformation.isLocked);
54458
54460
  if (list6.length !== 0) {
54459
54461
  this.add(list6);
54460
54462
  this.setContext("SelectByRect");
@@ -54468,14 +54470,14 @@ class BoardSelection {
54468
54470
  canChangeText() {
54469
54471
  return Boolean(this.items.isSingle() && this.items.getSingle()?.getRichText());
54470
54472
  }
54471
- handleItemCopy(item2, copiedItemsMap) {
54472
- const serializedData = item2.serialize(true);
54473
- const zIndex = this.board.items.index.getZIndex(item2);
54474
- if (item2.itemType === "Comment") {
54473
+ handleItemCopy(item, copiedItemsMap) {
54474
+ const serializedData = item.serialize(true);
54475
+ const zIndex = this.board.items.index.getZIndex(item);
54476
+ if (item.itemType === "Comment") {
54475
54477
  return;
54476
54478
  }
54477
- if (item2.itemType === "Connector" && serializedData.itemType === "Connector") {
54478
- const connector = item2;
54479
+ if (item.itemType === "Connector" && serializedData.itemType === "Connector") {
54480
+ const connector = item;
54479
54481
  const startPoint = connector.getStartPoint();
54480
54482
  const endPoint = connector.getEndPoint();
54481
54483
  const startItemId = startPoint.pointType !== "Board" ? startPoint.item.getId() : null;
@@ -54491,19 +54493,19 @@ class BoardSelection {
54491
54493
  serializedData.endPoint = new BoardPoint(endPoint.x, endPoint.y).serialize();
54492
54494
  }
54493
54495
  }
54494
- const textItem = item2.getRichText()?.getTextString();
54496
+ const textItem = item.getRichText()?.getTextString();
54495
54497
  const copyText = conf.i18n.t("frame.copy");
54496
54498
  const isCopyTextExist = textItem?.includes(copyText);
54497
- const isChangeCopiedFrameText = item2.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
54499
+ const isChangeCopiedFrameText = item.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
54498
54500
  if (isChangeCopiedFrameText) {
54499
54501
  const copiedFrameText = copyText + (textItem || serializedData.text?.placeholderText);
54500
- item2.getRichText()?.editor.clearText();
54501
- item2.getRichText()?.editor.addText(copiedFrameText);
54502
- serializedData.text = item2.getRichText()?.serialize();
54503
- item2.getRichText()?.editor.clearText();
54504
- item2.getRichText()?.editor.addText(textItem || "");
54502
+ item.getRichText()?.editor.clearText();
54503
+ item.getRichText()?.editor.addText(copiedFrameText);
54504
+ serializedData.text = item.getRichText()?.serialize();
54505
+ item.getRichText()?.editor.clearText();
54506
+ item.getRichText()?.editor.addText(textItem || "");
54505
54507
  }
54506
- copiedItemsMap[item2.getId()] = { ...serializedData, zIndex };
54508
+ copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
54507
54509
  }
54508
54510
  copy(skipImageBlobCopy) {
54509
54511
  const copiedItemsMap = {};
@@ -54512,12 +54514,12 @@ class BoardSelection {
54512
54514
  this.handleItemCopy(single, copiedItemsMap);
54513
54515
  return { imageElement: single.image, imageData: copiedItemsMap };
54514
54516
  }
54515
- this.list().forEach((item2) => {
54516
- this.handleItemCopy(item2, copiedItemsMap);
54517
+ this.list().forEach((item) => {
54518
+ this.handleItemCopy(item, copiedItemsMap);
54517
54519
  });
54518
- this.list().flatMap((item2) => {
54519
- if (item2 instanceof Frame2) {
54520
- return item2.getChildrenIds();
54520
+ this.list().flatMap((item) => {
54521
+ if (item instanceof Frame2) {
54522
+ return item.getChildrenIds();
54521
54523
  }
54522
54524
  return [];
54523
54525
  }).forEach((id) => {
@@ -54545,11 +54547,11 @@ class BoardSelection {
54545
54547
  let maxRichText = null;
54546
54548
  let minRichText = null;
54547
54549
  const itemType = items[0].itemType;
54548
- for (const item2 of items) {
54549
- if (item2.itemType !== itemType) {
54550
+ for (const item of items) {
54551
+ if (item.itemType !== itemType) {
54550
54552
  return null;
54551
54553
  }
54552
- const richText = item2.getRichText();
54554
+ const richText = item.getRichText();
54553
54555
  if (richText) {
54554
54556
  if (!maxRichText || richText.getFontSize() > maxRichText.getFontSize()) {
54555
54557
  maxRichText = richText;
@@ -54655,22 +54657,22 @@ class BoardSelection {
54655
54657
  }
54656
54658
  nestSelectedItems(unselectedItem, checkFrames = true) {
54657
54659
  const selected = this.board.selection.items.list();
54658
- if (unselectedItem && !selected.find((item2) => item2.getId() === unselectedItem.getId())) {
54660
+ if (unselectedItem && !selected.find((item) => item.getId() === unselectedItem.getId())) {
54659
54661
  selected.push(unselectedItem);
54660
54662
  }
54661
- const selectedMbr = selected.reduce((acc, item2) => {
54663
+ const selectedMbr = selected.reduce((acc, item) => {
54662
54664
  if (!acc) {
54663
- return item2.getMbr();
54665
+ return item.getMbr();
54664
54666
  }
54665
- return acc.combine(item2.getMbr());
54667
+ return acc.combine(item.getMbr());
54666
54668
  }, undefined);
54667
54669
  if (selectedMbr) {
54668
- const selectedMap = Object.fromEntries(selected.map((item2) => [item2.getId(), { item: item2, nested: false }]));
54670
+ const selectedMap = Object.fromEntries(selected.map((item) => [item.getId(), { item, nested: false }]));
54669
54671
  const enclosedGroups = this.board.items.getGroupItemsEnclosedOrCrossed(selectedMbr?.left, selectedMbr?.top, selectedMbr?.right, selectedMbr?.bottom);
54670
54672
  enclosedGroups.forEach((group) => {
54671
- selected.forEach((item2) => {
54672
- if (group.handleNesting(item2)) {
54673
- selectedMap[item2.getId()].nested = group;
54673
+ selected.forEach((item) => {
54674
+ if (group.handleNesting(item)) {
54675
+ selectedMap[item.getId()].nested = group;
54674
54676
  }
54675
54677
  });
54676
54678
  });
@@ -54694,11 +54696,11 @@ class BoardSelection {
54694
54696
  if (childrenIds && checkFrames) {
54695
54697
  const currGroup = val.item;
54696
54698
  const currMbr = currGroup.getMbr();
54697
- const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item2) => !!item2);
54698
- const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item2) => item2.parent === "Board" || item2.parent === currGroup.getId());
54699
+ const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
54700
+ const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
54699
54701
  const uniqueItems = new Set;
54700
- const toCheck = [...children, ...underGroup].filter((item2) => {
54701
- const id = item2.getId();
54702
+ const toCheck = [...children, ...underGroup].filter((item) => {
54703
+ const id = item.getId();
54702
54704
  if (uniqueItems.has(id)) {
54703
54705
  return false;
54704
54706
  }
@@ -54739,8 +54741,8 @@ class BoardSelection {
54739
54741
  addItemToTranslation(childId);
54740
54742
  }
54741
54743
  }
54742
- const createTranslationWithComments = (item2) => {
54743
- const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item2.getId());
54744
+ const createTranslationWithComments = (item) => {
54745
+ const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item.getId());
54744
54746
  for (const comment2 of followedComments) {
54745
54747
  translation[comment2.getId()] = {
54746
54748
  class: "Transformation",
@@ -54801,21 +54803,21 @@ class BoardSelection {
54801
54803
  newData: { borderColor }
54802
54804
  };
54803
54805
  const operations2 = {};
54804
- this.items.list().forEach((item2) => {
54805
- if (!operations2[item2.itemType]) {
54806
+ this.items.list().forEach((item) => {
54807
+ if (!operations2[item.itemType]) {
54806
54808
  const operationCopy = { ...operation };
54807
- if (item2.itemType === "Connector") {
54809
+ if (item.itemType === "Connector") {
54808
54810
  operationCopy.method = "setLineColor";
54809
54811
  operationCopy.lineColor = borderColor;
54810
- } else if (item2.itemType === "Drawing") {
54812
+ } else if (item.itemType === "Drawing") {
54811
54813
  operationCopy.method = "setStrokeColor";
54812
54814
  operationCopy.color = borderColor;
54813
54815
  } else {
54814
54816
  operationCopy.borderColor = borderColor;
54815
54817
  }
54816
- operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
54818
+ operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
54817
54819
  } else {
54818
- operations2[item2.itemType].item.push(item2.getId());
54820
+ operations2[item.itemType].item.push(item.getId());
54819
54821
  }
54820
54822
  });
54821
54823
  Object.values(operations2).forEach((op) => {
@@ -54830,13 +54832,13 @@ class BoardSelection {
54830
54832
  newData: { borderWidth: width2 }
54831
54833
  };
54832
54834
  const operations2 = {};
54833
- this.items.list().forEach((item2) => {
54834
- if (!operations2[item2.itemType]) {
54835
+ this.items.list().forEach((item) => {
54836
+ if (!operations2[item.itemType]) {
54835
54837
  const operationCopy = { ...operation };
54836
- if (item2.itemType === "Connector") {
54838
+ if (item.itemType === "Connector") {
54837
54839
  operationCopy.method = "setLineWidth";
54838
54840
  operationCopy.lineWidth = width2;
54839
- } else if (item2.itemType === "Drawing") {
54841
+ } else if (item.itemType === "Drawing") {
54840
54842
  operationCopy.method = "setStrokeWidth";
54841
54843
  operationCopy.width = width2;
54842
54844
  operationCopy.prevWidth = this.getStrokeWidth();
@@ -54844,9 +54846,9 @@ class BoardSelection {
54844
54846
  operationCopy.borderWidth = width2;
54845
54847
  operationCopy.prevBorderWidth = this.getStrokeWidth();
54846
54848
  }
54847
- operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
54849
+ operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
54848
54850
  } else {
54849
- operations2[item2.itemType].item.push(item2.getId());
54851
+ operations2[item.itemType].item.push(item.getId());
54850
54852
  }
54851
54853
  });
54852
54854
  Object.values(operations2).forEach((op) => {
@@ -54862,11 +54864,11 @@ class BoardSelection {
54862
54864
  newData: { backgroundColor }
54863
54865
  };
54864
54866
  const operations2 = {};
54865
- this.items.list().forEach((item2) => {
54866
- if (!operations2[item2.itemType]) {
54867
- operations2[item2.itemType] = { ...operation, class: item2.itemType, item: [item2.getId()] };
54867
+ this.items.list().forEach((item) => {
54868
+ if (!operations2[item.itemType]) {
54869
+ operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
54868
54870
  } else {
54869
- operations2[item2.itemType].item.push(item2.getId());
54871
+ operations2[item.itemType].item.push(item.getId());
54870
54872
  }
54871
54873
  });
54872
54874
  Object.values(operations2).forEach((op) => {
@@ -54890,9 +54892,9 @@ class BoardSelection {
54890
54892
  }
54891
54893
  setFrameType(frameType) {
54892
54894
  const items = this.items.list();
54893
- items.forEach((item2) => {
54894
- if (item2 instanceof Frame2) {
54895
- item2.setFrameType(frameType);
54895
+ items.forEach((item) => {
54896
+ if (item instanceof Frame2) {
54897
+ item.setFrameType(frameType);
54896
54898
  }
54897
54899
  });
54898
54900
  }
@@ -54911,21 +54913,21 @@ class BoardSelection {
54911
54913
  setFontSize(size) {
54912
54914
  const fontSize = size === "auto" ? size : toFiniteNumber(size);
54913
54915
  const itemsOps = [];
54914
- for (const item2 of this.items.list()) {
54915
- const text5 = item2.getRichText();
54916
+ for (const item of this.items.list()) {
54917
+ const text5 = item.getRichText();
54916
54918
  if (!text5) {
54917
54919
  continue;
54918
54920
  }
54919
54921
  const ops = text5.setSelectionFontSize(fontSize, this.context);
54920
54922
  itemsOps.push({
54921
- item: item2.getId(),
54923
+ item: item.getId(),
54922
54924
  selection: text5.editor.getSelection(),
54923
54925
  ops
54924
54926
  });
54925
- if (item2.itemType === "Sticker" && fontSize === "auto") {
54926
- tempStorage.remove(`fontSize_${item2.itemType}`);
54927
- } else if (item2.itemType !== "AINode") {
54928
- tempStorage.setFontSize(item2.itemType, fontSize);
54927
+ if (item.itemType === "Sticker" && fontSize === "auto") {
54928
+ tempStorage.remove(`fontSize_${item.itemType}`);
54929
+ } else if (item.itemType !== "AINode") {
54930
+ tempStorage.setFontSize(item.itemType, fontSize);
54929
54931
  }
54930
54932
  }
54931
54933
  const emptyOps = itemsOps.filter((op) => !op.ops.length);
@@ -54948,8 +54950,8 @@ class BoardSelection {
54948
54950
  setFontStyle(fontStyle) {
54949
54951
  const isMultiple = !this.items.isSingle();
54950
54952
  const itemsOps = [];
54951
- for (const item2 of this.items.list()) {
54952
- const text5 = item2.getRichText();
54953
+ for (const item of this.items.list()) {
54954
+ const text5 = item.getRichText();
54953
54955
  if (!text5) {
54954
54956
  continue;
54955
54957
  }
@@ -54958,12 +54960,12 @@ class BoardSelection {
54958
54960
  }
54959
54961
  const ops = text5.setSelectionFontStyle(fontStyle, this.context);
54960
54962
  itemsOps.push({
54961
- item: item2.getId(),
54963
+ item: item.getId(),
54962
54964
  selection: text5.editor.getSelection(),
54963
54965
  ops
54964
54966
  });
54965
- if (item2.itemType !== "AINode") {
54966
- tempStorage.setFontStyles(item2.itemType, text5.getFontStyles());
54967
+ if (item.itemType !== "AINode") {
54968
+ tempStorage.setFontStyles(item.itemType, text5.getFontStyles());
54967
54969
  }
54968
54970
  }
54969
54971
  this.emitApplied({
@@ -54975,8 +54977,8 @@ class BoardSelection {
54975
54977
  setFontColor(fontColor) {
54976
54978
  const isMultiple = !this.items.isSingle();
54977
54979
  const itemsOps = [];
54978
- for (const item2 of this.items.list()) {
54979
- const text5 = item2.getRichText();
54980
+ for (const item of this.items.list()) {
54981
+ const text5 = item.getRichText();
54980
54982
  if (!text5) {
54981
54983
  continue;
54982
54984
  }
@@ -54985,11 +54987,11 @@ class BoardSelection {
54985
54987
  }
54986
54988
  const ops = text5.setSelectionFontColor(fontColor, this.context);
54987
54989
  itemsOps.push({
54988
- item: item2.getId(),
54990
+ item: item.getId(),
54989
54991
  selection: text5.editor.getSelection(),
54990
54992
  ops
54991
54993
  });
54992
- tempStorage.setFontColor(item2.itemType, fontColor);
54994
+ tempStorage.setFontColor(item.itemType, fontColor);
54993
54995
  }
54994
54996
  this.emitApplied({
54995
54997
  class: "RichText",
@@ -55018,8 +55020,8 @@ class BoardSelection {
55018
55020
  setFontHighlight(fontHighlight) {
55019
55021
  const isMultiple = !this.items.isSingle();
55020
55022
  const itemsOps = [];
55021
- for (const item2 of this.items.list()) {
55022
- const text5 = item2.getRichText();
55023
+ for (const item of this.items.list()) {
55024
+ const text5 = item.getRichText();
55023
55025
  if (!text5) {
55024
55026
  continue;
55025
55027
  }
@@ -55028,12 +55030,12 @@ class BoardSelection {
55028
55030
  }
55029
55031
  const ops = text5.setSelectionFontHighlight(fontHighlight, this.context);
55030
55032
  itemsOps.push({
55031
- item: item2.getId(),
55033
+ item: item.getId(),
55032
55034
  selection: text5.editor.getSelection(),
55033
55035
  ops
55034
55036
  });
55035
- if (item2.itemType !== "AINode") {
55036
- tempStorage.setFontHighlight(item2.itemType, fontHighlight);
55037
+ if (item.itemType !== "AINode") {
55038
+ tempStorage.setFontHighlight(item.itemType, fontHighlight);
55037
55039
  }
55038
55040
  }
55039
55041
  this.emitApplied({
@@ -55045,8 +55047,8 @@ class BoardSelection {
55045
55047
  setHorisontalAlignment(horisontalAlignment) {
55046
55048
  const isMultiple = !this.items.isSingle();
55047
55049
  const itemsOps = [];
55048
- for (const item2 of this.items.list()) {
55049
- const text5 = item2.getRichText();
55050
+ for (const item of this.items.list()) {
55051
+ const text5 = item.getRichText();
55050
55052
  if (!text5) {
55051
55053
  continue;
55052
55054
  }
@@ -55055,11 +55057,11 @@ class BoardSelection {
55055
55057
  }
55056
55058
  const ops = text5.setSelectionHorisontalAlignment(horisontalAlignment, this.context);
55057
55059
  itemsOps.push({
55058
- item: item2.getId(),
55060
+ item: item.getId(),
55059
55061
  selection: text5.editor.getSelection(),
55060
55062
  ops
55061
55063
  });
55062
- tempStorage.setHorizontalAlignment(item2.itemType, horisontalAlignment);
55064
+ tempStorage.setHorizontalAlignment(item.itemType, horisontalAlignment);
55063
55065
  }
55064
55066
  this.emitApplied({
55065
55067
  class: "RichText",
@@ -55075,23 +55077,23 @@ class BoardSelection {
55075
55077
  verticalAlignment
55076
55078
  });
55077
55079
  if (this.items.isSingle()) {
55078
- const item2 = this.items.getSingle();
55079
- if (!item2) {
55080
+ const item = this.items.getSingle();
55081
+ if (!item) {
55080
55082
  return;
55081
55083
  }
55082
- const text5 = item2.getRichText();
55084
+ const text5 = item.getRichText();
55083
55085
  if (!text5) {
55084
55086
  return;
55085
55087
  }
55086
- tempStorage.setVerticalAlignment(item2.itemType, verticalAlignment);
55087
- if (item2 instanceof RichText) {
55088
- item2.setEditorFocus(this.context);
55088
+ tempStorage.setVerticalAlignment(item.itemType, verticalAlignment);
55089
+ if (item instanceof RichText) {
55090
+ item.setEditorFocus(this.context);
55089
55091
  }
55090
55092
  text5.setEditorFocus(this.context);
55091
55093
  }
55092
55094
  }
55093
55095
  removeFromBoard() {
55094
- const isLocked = this.items.list().some((item2) => item2.transformation.isLocked);
55096
+ const isLocked = this.items.list().some((item) => item.transformation.isLocked);
55095
55097
  if (isLocked) {
55096
55098
  return;
55097
55099
  }
@@ -55114,7 +55116,7 @@ class BoardSelection {
55114
55116
  }
55115
55117
  getIsLockedSelection() {
55116
55118
  const items = this.list();
55117
- return items.some((item2) => item2.transformation.isLocked);
55119
+ return items.some((item) => item.transformation.isLocked);
55118
55120
  }
55119
55121
  isLocked() {
55120
55122
  return false;
@@ -55141,9 +55143,9 @@ class BoardSelection {
55141
55143
  }
55142
55144
  async duplicate() {
55143
55145
  const mediaIds = [];
55144
- this.items.list().forEach((item2) => {
55145
- if ("getStorageId" in item2) {
55146
- const storageId = item2.getStorageId();
55146
+ this.items.list().forEach((item) => {
55147
+ if ("getStorageId" in item) {
55148
+ const storageId = item.getStorageId();
55147
55149
  if (storageId) {
55148
55150
  mediaIds.push(storageId);
55149
55151
  }
@@ -55153,7 +55155,7 @@ class BoardSelection {
55153
55155
  if (!canDuplicate) {
55154
55156
  return;
55155
55157
  }
55156
- const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item2]) => item2.itemType !== "Group"));
55158
+ const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item]) => item.itemType !== "Group"));
55157
55159
  this.board.duplicate(filteredItemMap);
55158
55160
  this.setContext("EditUnderPointer");
55159
55161
  }
@@ -55187,10 +55189,10 @@ class BoardSelection {
55187
55189
  lastAssistantMessageId
55188
55190
  };
55189
55191
  }
55190
- renderItemMbr(context, item2, customScale) {
55191
- const mbr = item2.getMbr();
55192
+ renderItemMbr(context, item, customScale) {
55193
+ const mbr = item.getMbr();
55192
55194
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
55193
- const selectionColor = item2.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
55195
+ const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
55194
55196
  mbr.borderColor = selectionColor;
55195
55197
  mbr.render(context);
55196
55198
  }
@@ -55206,8 +55208,8 @@ class BoardSelection {
55206
55208
  }
55207
55209
  if (!this.transformationRenderBlock) {
55208
55210
  if (this.shouldRenderItemsMbr) {
55209
- for (const item2 of this.items.list()) {
55210
- this.renderItemMbr(context, item2);
55211
+ for (const item of this.items.list()) {
55212
+ this.renderItemMbr(context, item);
55211
55213
  }
55212
55214
  }
55213
55215
  this.tool.render(context);
@@ -55219,7 +55221,7 @@ class BoardSelection {
55219
55221
  if (single && single instanceof AINode) {
55220
55222
  const contextItemsIds = single.getContextItems();
55221
55223
  if (contextItemsIds.length) {
55222
- const newContextItems = this.board.items.listAll().filter((item2) => contextItemsIds.includes(item2.getId()));
55224
+ const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
55223
55225
  contextItems.push(...newContextItems);
55224
55226
  }
55225
55227
  }
@@ -55237,15 +55239,15 @@ class BoardSelection {
55237
55239
  }
55238
55240
  }
55239
55241
  }
55240
- contextItems.forEach((item2) => {
55241
- if (item2 instanceof AINode) {
55242
- const path2 = item2.getPath();
55242
+ contextItems.forEach((item) => {
55243
+ if (item instanceof AINode) {
55244
+ const path2 = item.getPath();
55243
55245
  path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
55244
55246
  path2.setBorderWidth(2);
55245
55247
  path2.setBackgroundColor("none");
55246
55248
  path2.render(context);
55247
55249
  } else {
55248
- const itemRect = item2.getMbr();
55250
+ const itemRect = item.getMbr();
55249
55251
  itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
55250
55252
  itemRect.strokeWidth = 2;
55251
55253
  itemRect.render(context);
@@ -55746,16 +55748,16 @@ class Board {
55746
55748
  applyBoardOperation(op) {
55747
55749
  switch (op.method) {
55748
55750
  case "moveToZIndex": {
55749
- const item2 = this.index.getById(op.item);
55750
- if (!item2) {
55751
+ const item = this.index.getById(op.item);
55752
+ if (!item) {
55751
55753
  return;
55752
55754
  }
55753
- return this.index.moveToZIndex(item2, op.zIndex);
55755
+ return this.index.moveToZIndex(item, op.zIndex);
55754
55756
  }
55755
55757
  case "moveManyToZIndex": {
55756
55758
  for (const id in op.item) {
55757
- const item2 = this.items.getById(id);
55758
- if (!item2) {
55759
+ const item = this.items.getById(id);
55760
+ if (!item) {
55759
55761
  delete op.item.id;
55760
55762
  }
55761
55763
  }
@@ -55777,11 +55779,11 @@ class Board {
55777
55779
  }
55778
55780
  return this.index.moveSecondAfterFirst(first, second);
55779
55781
  case "bringToFront": {
55780
- const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
55782
+ const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
55781
55783
  return this.index.bringManyToFront(items);
55782
55784
  }
55783
55785
  case "sendToBack": {
55784
- const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
55786
+ const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
55785
55787
  return this.index.sendManyToBack(items);
55786
55788
  }
55787
55789
  case "add":
@@ -55805,82 +55807,82 @@ class Board {
55805
55807
  applyAddItems(op) {
55806
55808
  if (Array.isArray(op.item)) {
55807
55809
  const data = op.data;
55808
- const items = op.item.map((item3) => {
55809
- const created = this.createItem(item3, data[item3]);
55810
+ const items = op.item.map((item2) => {
55811
+ const created = this.createItem(item2, data[item2]);
55810
55812
  this.index.insert(created);
55811
55813
  return created;
55812
55814
  });
55813
- items.forEach((item3) => {
55814
- if (item3 instanceof Connector2 && data[item3.getId()]) {
55815
- const connectorData = data[item3.getId()];
55816
- item3.applyStartPoint(connectorData.startPoint);
55817
- item3.applyEndPoint(connectorData.endPoint);
55815
+ items.forEach((item2) => {
55816
+ if (item2 instanceof Connector2 && data[item2.getId()]) {
55817
+ const connectorData = data[item2.getId()];
55818
+ item2.applyStartPoint(connectorData.startPoint);
55819
+ item2.applyEndPoint(connectorData.endPoint);
55818
55820
  }
55819
55821
  });
55820
55822
  return;
55821
55823
  }
55822
- const item2 = this.createItem(op.item, op.data);
55823
- return this.index.insert(item2);
55824
+ const item = this.createItem(op.item, op.data);
55825
+ return this.index.insert(item);
55824
55826
  }
55825
55827
  applyAddLockedGroupOperation(op) {
55826
- const item2 = this.createItem(op.item, op.data);
55827
- const groupChildrenIds = item2.getChildrenIds();
55828
- this.index.insert(item2);
55828
+ const item = this.createItem(op.item, op.data);
55829
+ const groupChildrenIds = item.getChildrenIds();
55830
+ this.index.insert(item);
55829
55831
  const lastChildrenId = this.index.getById(groupChildrenIds[groupChildrenIds.length - 1]);
55830
55832
  if (lastChildrenId) {
55831
55833
  const zIndex = this.index.getZIndex(lastChildrenId) + 1;
55832
- this.index.moveToZIndex(item2, zIndex);
55834
+ this.index.moveToZIndex(item, zIndex);
55833
55835
  }
55834
- item2.getChildren().forEach((item3) => {
55835
- item3.transformation.isLocked = true;
55836
+ item.getChildren().forEach((item2) => {
55837
+ item2.transformation.isLocked = true;
55836
55838
  });
55837
- item2.transformation.isLocked = true;
55839
+ item.transformation.isLocked = true;
55838
55840
  }
55839
55841
  applyRemoveOperation(op) {
55840
55842
  const removedItems = [];
55841
- this.findItemAndApply(op.item, (item2) => {
55842
- this.index.remove(item2);
55843
- this.selection.remove(item2);
55844
- if (item2 instanceof Connector2) {
55845
- item2.clearObservedItems();
55843
+ this.findItemAndApply(op.item, (item) => {
55844
+ this.index.remove(item);
55845
+ this.selection.remove(item);
55846
+ if (item instanceof Connector2) {
55847
+ item.clearObservedItems();
55846
55848
  }
55847
- removedItems.push(item2);
55849
+ removedItems.push(item);
55848
55850
  });
55849
55851
  }
55850
55852
  applyRemoveLockedGroupOperation(op) {
55851
- const item2 = this.index.getById(op.item[0]);
55852
- if (!item2 || !(item2 instanceof Group)) {
55853
+ const item = this.index.getById(op.item[0]);
55854
+ if (!item || !(item instanceof Group)) {
55853
55855
  return;
55854
55856
  }
55855
- item2.getChildren().forEach((item3) => {
55856
- item3.transformation.isLocked = false;
55857
- item3.parent = "Board";
55857
+ item.getChildren().forEach((item2) => {
55858
+ item2.transformation.isLocked = false;
55859
+ item2.parent = "Board";
55858
55860
  });
55859
- item2.transformation.isLocked = false;
55861
+ item.transformation.isLocked = false;
55860
55862
  const removedItems = [];
55861
- this.findItemAndApply(op.item, (item3) => {
55862
- this.index.remove(item3);
55863
- this.selection.remove(item3);
55864
- removedItems.push(item3);
55863
+ this.findItemAndApply(op.item, (item2) => {
55864
+ this.index.remove(item2);
55865
+ this.selection.remove(item2);
55866
+ removedItems.push(item2);
55865
55867
  });
55866
55868
  }
55867
55869
  applyItemOperation(op) {
55868
55870
  if ("item" in op) {
55869
- this.findItemAndApply(op.item, (item2) => {
55870
- item2.apply(op);
55871
+ this.findItemAndApply(op.item, (item) => {
55872
+ item.apply(op);
55871
55873
  });
55872
55874
  }
55873
55875
  }
55874
- findItemAndApply(item2, apply) {
55875
- if (Array.isArray(item2)) {
55876
- for (const itemId of item2) {
55876
+ findItemAndApply(item, apply) {
55877
+ if (Array.isArray(item)) {
55878
+ for (const itemId of item) {
55877
55879
  const found = this.items.findById(itemId);
55878
55880
  if (found) {
55879
55881
  apply(found);
55880
55882
  }
55881
55883
  }
55882
55884
  } else {
55883
- const found = this.items.findById(item2);
55885
+ const found = this.items.findById(item);
55884
55886
  if (found) {
55885
55887
  apply(found);
55886
55888
  }
@@ -55889,9 +55891,9 @@ class Board {
55889
55891
  handleNesting(items) {
55890
55892
  const arrayed = Array.isArray(items) ? items : [items];
55891
55893
  const groupsMap = new Map;
55892
- arrayed.forEach((item2) => {
55893
- const itemCenter = item2.getMbr().getCenter();
55894
- const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item2)).reduce((acc, groupItem2) => {
55894
+ arrayed.forEach((item) => {
55895
+ const itemCenter = item.getMbr().getCenter();
55896
+ const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item)).reduce((acc, groupItem2) => {
55895
55897
  if (!acc || groupItem2.getDistanceToPoint(itemCenter) > acc.getDistanceToPoint(itemCenter)) {
55896
55898
  acc = groupItem2;
55897
55899
  }
@@ -55901,7 +55903,7 @@ class Board {
55901
55903
  if (!groupsMap.has(groupItem)) {
55902
55904
  groupsMap.set(groupItem, []);
55903
55905
  }
55904
- groupsMap.get(groupItem)?.push(item2);
55906
+ groupsMap.get(groupItem)?.push(item);
55905
55907
  }
55906
55908
  });
55907
55909
  groupsMap.forEach((items2, group) => {
@@ -55922,13 +55924,13 @@ class Board {
55922
55924
  }
55923
55925
  return parser(el);
55924
55926
  }
55925
- add(item2, timeStamp) {
55927
+ add(item, timeStamp) {
55926
55928
  const id = this.getNewItemId();
55927
55929
  this.emit({
55928
55930
  class: "Board",
55929
55931
  method: "add",
55930
55932
  item: id,
55931
- data: item2.serialize(),
55933
+ data: item.serialize(),
55932
55934
  timeStamp
55933
55935
  });
55934
55936
  const newItem = this.items.getById(id);
@@ -55938,13 +55940,13 @@ class Board {
55938
55940
  this.handleNesting(newItem);
55939
55941
  return newItem;
55940
55942
  }
55941
- addLockedGroup(item2) {
55943
+ addLockedGroup(item) {
55942
55944
  const id = this.getNewItemId();
55943
55945
  this.emit({
55944
55946
  class: "Board",
55945
55947
  method: "addLockedGroup",
55946
55948
  item: id,
55947
- data: item2.serialize()
55949
+ data: item.serialize()
55948
55950
  });
55949
55951
  const newItem = this.items.getById(id);
55950
55952
  if (!newItem) {
@@ -55953,32 +55955,32 @@ class Board {
55953
55955
  this.handleNesting(newItem);
55954
55956
  return newItem;
55955
55957
  }
55956
- remove(item2, withConnectors = true) {
55958
+ remove(item, withConnectors = true) {
55957
55959
  let connectors = [];
55958
55960
  if (withConnectors) {
55959
- connectors = this.items.getLinkedConnectorsById(item2.getId()).map((connector) => connector.getId());
55961
+ connectors = this.items.getLinkedConnectorsById(item.getId()).map((connector) => connector.getId());
55960
55962
  }
55961
- if ("onRemove" in item2) {
55962
- item2.onRemove();
55963
+ if ("onRemove" in item) {
55964
+ item.onRemove();
55963
55965
  }
55964
55966
  this.emit({
55965
55967
  class: "Board",
55966
55968
  method: "remove",
55967
- item: [item2.getId(), ...connectors]
55969
+ item: [item.getId(), ...connectors]
55968
55970
  });
55969
55971
  }
55970
- removeLockedGroup(item2) {
55972
+ removeLockedGroup(item) {
55971
55973
  this.emit({
55972
55974
  class: "Board",
55973
55975
  method: "removeLockedGroup",
55974
- item: [item2.getId()]
55976
+ item: [item.getId()]
55975
55977
  });
55976
55978
  }
55977
55979
  getByZIndex(index2) {
55978
55980
  return this.index.getByZIndex(index2);
55979
55981
  }
55980
- getZIndex(item2) {
55981
- return this.index.getZIndex(item2);
55982
+ getZIndex(item) {
55983
+ return this.index.getZIndex(item);
55982
55984
  }
55983
55985
  getLastZIndex() {
55984
55986
  return this.index.getLastZIndex();
@@ -55990,11 +55992,11 @@ class Board {
55990
55992
  item: items
55991
55993
  });
55992
55994
  }
55993
- moveToZIndex(item2, zIndex) {
55995
+ moveToZIndex(item, zIndex) {
55994
55996
  this.emit({
55995
55997
  class: "Board",
55996
55998
  method: "moveToZIndex",
55997
- item: item2.getId(),
55999
+ item: item.getId(),
55998
56000
  zIndex
55999
56001
  });
56000
56002
  }
@@ -56022,8 +56024,8 @@ class Board {
56022
56024
  this.emit({
56023
56025
  class: "Board",
56024
56026
  method: "bringToFront",
56025
- item: items.map((item2) => item2.getId()),
56026
- prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
56027
+ item: items.map((item) => item.getId()),
56028
+ prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
56027
56029
  });
56028
56030
  }
56029
56031
  sendToBack(items) {
@@ -56034,8 +56036,8 @@ class Board {
56034
56036
  this.emit({
56035
56037
  class: "Board",
56036
56038
  method: "sendToBack",
56037
- item: items.map((item2) => item2.getId()),
56038
- prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
56039
+ item: items.map((item) => item.getId()),
56040
+ prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
56039
56041
  });
56040
56042
  }
56041
56043
  copy() {
@@ -56112,7 +56114,7 @@ class Board {
56112
56114
  return added;
56113
56115
  });
56114
56116
  addedFrame.addChildItems(addedChildren);
56115
- parsedData.data.children = addedChildren.map((item2) => item2.getId());
56117
+ parsedData.data.children = addedChildren.map((item) => item.getId());
56116
56118
  idsMap[parsedData.data.id] = addedFrame.getId();
56117
56119
  } else {
56118
56120
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
@@ -56153,15 +56155,15 @@ class Board {
56153
56155
  const createdConnectors = {};
56154
56156
  const createdFrames = {};
56155
56157
  const addItem = (itemData) => {
56156
- const item2 = this.createItem(itemData.id, itemData);
56157
- if (item2 instanceof Connector2) {
56158
- createdConnectors[itemData.id] = { item: item2, itemData };
56158
+ const item = this.createItem(itemData.id, itemData);
56159
+ if (item instanceof Connector2) {
56160
+ createdConnectors[itemData.id] = { item, itemData };
56159
56161
  }
56160
- if (item2 instanceof Frame2) {
56161
- createdFrames[item2.getId()] = { item: item2, itemData };
56162
+ if (item instanceof Frame2) {
56163
+ createdFrames[item.getId()] = { item, itemData };
56162
56164
  }
56163
- this.index.insert(item2);
56164
- return item2;
56165
+ this.index.insert(item);
56166
+ return item;
56165
56167
  };
56166
56168
  for (const itemData of items) {
56167
56169
  if ("childrenMap" in itemData) {
@@ -56172,13 +56174,13 @@ class Board {
56172
56174
  }
56173
56175
  }
56174
56176
  for (const key in createdConnectors) {
56175
- const { item: item2, itemData } = createdConnectors[key];
56176
- item2.applyStartPoint(itemData.startPoint);
56177
- item2.applyEndPoint(itemData.endPoint);
56177
+ const { item, itemData } = createdConnectors[key];
56178
+ item.applyStartPoint(itemData.startPoint);
56179
+ item.applyEndPoint(itemData.endPoint);
56178
56180
  }
56179
56181
  for (const key in createdFrames) {
56180
- const { item: item2, itemData } = createdFrames[key];
56181
- item2.applyAddChildren(itemData.children);
56182
+ const { item, itemData } = createdFrames[key];
56183
+ item.applyAddChildren(itemData.children);
56182
56184
  }
56183
56185
  }
56184
56186
  deserialize(snapshot) {
@@ -56188,33 +56190,33 @@ class Board {
56188
56190
  const createdFrames = {};
56189
56191
  if (Array.isArray(items)) {
56190
56192
  for (const itemData of items) {
56191
- const item2 = this.createItem(itemData.id, itemData);
56192
- if (item2 instanceof Connector2) {
56193
- createdConnectors[itemData.id] = { item: item2, itemData };
56193
+ const item = this.createItem(itemData.id, itemData);
56194
+ if (item instanceof Connector2) {
56195
+ createdConnectors[itemData.id] = { item, itemData };
56194
56196
  }
56195
- if (item2 instanceof Frame2) {
56196
- createdFrames[item2.getId()] = { item: item2, itemData };
56197
+ if (item instanceof Frame2) {
56198
+ createdFrames[item.getId()] = { item, itemData };
56197
56199
  }
56198
- this.index.insert(item2);
56200
+ this.index.insert(item);
56199
56201
  }
56200
56202
  } else {
56201
56203
  for (const key in items) {
56202
56204
  const itemData = items[key];
56203
- const item2 = this.createItem(key, itemData);
56204
- if (item2 instanceof Connector2) {
56205
- createdConnectors[key] = { item: item2, itemData };
56205
+ const item = this.createItem(key, itemData);
56206
+ if (item instanceof Connector2) {
56207
+ createdConnectors[key] = { item, itemData };
56206
56208
  }
56207
- this.index.insert(item2);
56209
+ this.index.insert(item);
56208
56210
  }
56209
56211
  }
56210
56212
  for (const key in createdConnectors) {
56211
- const { item: item2, itemData } = createdConnectors[key];
56212
- item2.applyStartPoint(itemData.startPoint);
56213
- item2.applyEndPoint(itemData.endPoint);
56213
+ const { item, itemData } = createdConnectors[key];
56214
+ item.applyStartPoint(itemData.startPoint);
56215
+ item.applyEndPoint(itemData.endPoint);
56214
56216
  }
56215
56217
  for (const key in createdFrames) {
56216
- const { item: item2, itemData } = createdFrames[key];
56217
- item2.applyAddChildren(itemData.children);
56218
+ const { item, itemData } = createdFrames[key];
56219
+ item.applyAddChildren(itemData.children);
56218
56220
  }
56219
56221
  this.events?.log.deserialize(events);
56220
56222
  }
@@ -56452,7 +56454,7 @@ class Board {
56452
56454
  itemsMap: newMap,
56453
56455
  select: select2
56454
56456
  });
56455
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
56457
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
56456
56458
  this.handleNesting(items);
56457
56459
  this.selection.removeAll();
56458
56460
  this.selection.add(items);
@@ -56460,8 +56462,8 @@ class Board {
56460
56462
  return;
56461
56463
  }
56462
56464
  removeVoidComments() {
56463
- const voidComments = this.items.listAll().filter((item2) => {
56464
- return item2 instanceof Comment && !item2.getThread().length;
56465
+ const voidComments = this.items.listAll().filter((item) => {
56466
+ return item instanceof Comment && !item.getThread().length;
56465
56467
  });
56466
56468
  if (voidComments) {
56467
56469
  for (const comment2 of voidComments) {
@@ -56535,7 +56537,7 @@ class Board {
56535
56537
  }
56536
56538
  const mbr = this.selection.getMbr();
56537
56539
  const selectedItems = this.selection.items.list();
56538
- const isSelectedItemsMinWidth = selectedItems.some((item2) => item2.getMbr().getWidth() === 0);
56540
+ const isSelectedItemsMinWidth = selectedItems.some((item) => item.getMbr().getWidth() === 0);
56539
56541
  const right = mbr ? mbr.right : 0;
56540
56542
  const top = mbr ? mbr.top : 0;
56541
56543
  const width2 = mbr ? mbr.getWidth() / 10 : 10;
@@ -56577,7 +56579,7 @@ class Board {
56577
56579
  method: "duplicate",
56578
56580
  itemsMap: newMap
56579
56581
  });
56580
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
56582
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
56581
56583
  this.handleNesting(items);
56582
56584
  this.selection.removeAll();
56583
56585
  this.selection.add(items);
@@ -56598,9 +56600,9 @@ class Board {
56598
56600
  if (data.itemType === "Frame") {
56599
56601
  data.text.placeholderText = `Frame ${this.getMaxFrameSerial() + 1}`;
56600
56602
  }
56601
- const item2 = this.createItem(itemId, data);
56602
- this.index.insert(item2);
56603
- items.push(item2);
56603
+ const item = this.createItem(itemId, data);
56604
+ this.index.insert(item);
56605
+ items.push(item);
56604
56606
  };
56605
56607
  sortedItemsMap.map(([id, data]) => {
56606
56608
  if (data.itemType === "Connector") {
@@ -56615,8 +56617,8 @@ class Board {
56615
56617
  return;
56616
56618
  });
56617
56619
  }
56618
- isOnBoard(item2) {
56619
- return this.items.findById(item2.getId()) !== undefined;
56620
+ isOnBoard(item) {
56621
+ return this.items.findById(item.getId()) !== undefined;
56620
56622
  }
56621
56623
  getMaxFrameSerial() {
56622
56624
  const existingNames = this.items.listGroupItems().map((frame) => frame.getRichText()?.getTextString().length === 0 ? frame.getRichText()?.placeholderText || "" : frame.getRichText()?.getTextString() || "");
@@ -56662,7 +56664,7 @@ function areItemsTheSame(opA, opB) {
56662
56664
  const itemsB = Object.keys(opB.items);
56663
56665
  const setA = new Set(itemsA);
56664
56666
  const setB = new Set(itemsB);
56665
- const areArraysEqual = setA.size === setB.size && [...setA].every((item2) => setB.has(item2));
56667
+ const areArraysEqual = setA.size === setB.size && [...setA].every((item) => setB.has(item));
56666
56668
  return areArraysEqual;
56667
56669
  }
56668
56670
  if (!(Array.isArray(opA.item) && Array.isArray(opB.item))) {
@@ -58321,9 +58323,9 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
58321
58323
  list6.applyUnconfirmed(filter);
58322
58324
  const hasAnyOverlap = (arr1, arr2) => {
58323
58325
  const lookup9 = new Set(arr1);
58324
- return arr2.some((item2) => lookup9.has(item2));
58326
+ return arr2.some((item) => lookup9.has(item));
58325
58327
  };
58326
- const currSelection = board.selection.list().map((item2) => item2.getId());
58328
+ const currSelection = board.selection.list().map((item) => item.getId());
58327
58329
  if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
58328
58330
  board.selection.applyMemoizedCaretOrRange();
58329
58331
  }
@@ -58645,27 +58647,27 @@ function handleAiChatMassage(message, board) {
58645
58647
  }
58646
58648
  }
58647
58649
  function handleChatChunk(chunk, board) {
58648
- const item2 = board.items.getById(chunk.itemId);
58650
+ const item = board.items.getById(chunk.itemId);
58649
58651
  switch (chunk.type) {
58650
58652
  case "chunk":
58651
- if (!item2 || item2.itemType !== "AINode") {
58653
+ if (!item || item.itemType !== "AINode") {
58652
58654
  return;
58653
58655
  }
58654
- item2.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
58656
+ item.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
58655
58657
  break;
58656
58658
  case "done":
58657
- if (!item2 || item2.itemType !== "AINode") {
58659
+ if (!item || item.itemType !== "AINode") {
58658
58660
  board.aiGeneratingOnItem = undefined;
58659
58661
  return;
58660
58662
  }
58661
- item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
58663
+ item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
58662
58664
  break;
58663
58665
  case "end":
58664
- if (!item2 || item2.itemType !== "AINode") {
58666
+ if (!item || item.itemType !== "AINode") {
58665
58667
  board.aiGeneratingOnItem = undefined;
58666
58668
  return;
58667
58669
  }
58668
- item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
58670
+ item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
58669
58671
  break;
58670
58672
  case "error":
58671
58673
  default:
@@ -58682,7 +58684,7 @@ function handleChatChunk(chunk, board) {
58682
58684
  if (board.aiGeneratingOnItem && generatingItem) {
58683
58685
  board.selection.removeAll();
58684
58686
  board.selection.add(generatingItem);
58685
- const rt = item2?.getRichText();
58687
+ const rt = item?.getRichText();
58686
58688
  if (generatingItem.itemType === "AINode" && rt) {
58687
58689
  const editor = rt.editor;
58688
58690
  editor.markdownProcessor.setStopProcessingMarkDownCb(null);
@@ -58815,14 +58817,14 @@ function handleImageGenerate(response, board) {
58815
58817
  console.error("Image generation error:", response.message);
58816
58818
  if (response.isExternalApiError) {
58817
58819
  if (board.aiGeneratingOnItem) {
58818
- const item2 = board.items.getById(board.aiGeneratingOnItem);
58819
- if (item2) {
58820
+ const item = board.items.getById(board.aiGeneratingOnItem);
58821
+ if (item) {
58820
58822
  board.selection.removeAll();
58821
- board.selection.add(item2);
58822
- const editor = item2.getRichText()?.editor;
58823
+ board.selection.add(item);
58824
+ const editor = item.getRichText()?.editor;
58823
58825
  editor?.clearText();
58824
58826
  editor?.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
58825
- board.camera.zoomToFit(item2.getMbr(), 20);
58827
+ board.camera.zoomToFit(item.getMbr(), 20);
58826
58828
  }
58827
58829
  }
58828
58830
  } else {