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.
@@ -642,8 +642,8 @@ class BoardCommand {
642
642
  switch (operation.method) {
643
643
  case "bringToFront": {
644
644
  for (const id in operation.prevZIndex) {
645
- const item2 = this.board.items.getById(id);
646
- if (!item2) {
645
+ const item = this.board.items.getById(id);
646
+ if (!item) {
647
647
  delete operation.prevZIndex.id;
648
648
  }
649
649
  }
@@ -655,8 +655,8 @@ class BoardCommand {
655
655
  }
656
656
  case "sendToBack": {
657
657
  for (const id in operation.prevZIndex) {
658
- const item2 = this.board.items.getById(id);
659
- if (!item2) {
658
+ const item = this.board.items.getById(id);
659
+ if (!item) {
660
660
  delete operation.prevZIndex.id;
661
661
  }
662
662
  }
@@ -670,11 +670,11 @@ class BoardCommand {
670
670
  case "moveSecondBeforeFirst":
671
671
  case "moveToZIndex": {
672
672
  const items = this.board.items;
673
- const item2 = items.getById(operation.item);
674
- if (!item2) {
673
+ const item = items.getById(operation.item);
674
+ if (!item) {
675
675
  throw new Error("Get reverse board operation. Item not found");
676
676
  }
677
- const zIndex = this.board.getZIndex(item2);
677
+ const zIndex = this.board.getZIndex(item);
678
678
  return {
679
679
  class: "Board",
680
680
  method: "moveToZIndex",
@@ -684,8 +684,8 @@ class BoardCommand {
684
684
  }
685
685
  case "moveManyToZIndex": {
686
686
  for (const id in operation.item) {
687
- const item2 = this.board.items.getById(id);
688
- if (!item2) {
687
+ const item = this.board.items.getById(id);
688
+ if (!item) {
689
689
  delete operation.item.id;
690
690
  }
691
691
  }
@@ -702,15 +702,15 @@ class BoardCommand {
702
702
  const items = this.board.items;
703
703
  const reverse = [];
704
704
  for (const itemId of operation.item) {
705
- const item2 = items.getById(itemId);
706
- if (!item2) {
705
+ const item = items.getById(itemId);
706
+ if (!item) {
707
707
  throw new Error("Get reverse board operation. Item not found");
708
708
  }
709
709
  reverse.push({
710
710
  class: "Board",
711
711
  method: "add",
712
712
  item: itemId,
713
- data: item2.serialize()
713
+ data: item.serialize()
714
714
  });
715
715
  }
716
716
  return reverse;
@@ -733,32 +733,32 @@ class BoardCommand {
733
733
  const items = this.board.items;
734
734
  const reverse = [];
735
735
  for (const itemId of operation.item) {
736
- const item2 = items.getById(itemId);
737
- if (!item2 || item2.itemType !== "Group") {
736
+ const item = items.getById(itemId);
737
+ if (!item || item.itemType !== "Group") {
738
738
  throw new Error("Get reverse board operation. Item not found");
739
739
  }
740
740
  reverse.push({
741
741
  class: "Board",
742
742
  method: "addLockedGroup",
743
743
  item: itemId,
744
- data: item2.serialize()
744
+ data: item.serialize()
745
745
  });
746
746
  }
747
747
  return reverse;
748
748
  }
749
749
  case "duplicate":
750
750
  case "paste": {
751
- const item2 = [];
751
+ const item = [];
752
752
  const map = operation.itemsMap;
753
753
  for (const key in map) {
754
754
  if (map.hasOwnProperty(key)) {
755
- item2.push(key);
755
+ item.push(key);
756
756
  }
757
757
  }
758
758
  return {
759
759
  class: "Board",
760
760
  method: "remove",
761
- item: item2
761
+ item
762
762
  };
763
763
  }
764
764
  }
@@ -7076,11 +7076,11 @@ class SubjectOperation {
7076
7076
  }
7077
7077
 
7078
7078
  // src/Items/ItemsCommandUtils.ts
7079
- function mapItemsByOperation(item2, getCallback) {
7080
- const items = Array.isArray(item2) ? item2 : [item2];
7081
- return items.map((item3) => {
7082
- const operation = getCallback(item3);
7083
- return { item: item3, operation };
7079
+ function mapItemsByOperation(item, getCallback) {
7080
+ const items = Array.isArray(item) ? item : [item];
7081
+ return items.map((item2) => {
7082
+ const operation = getCallback(item2);
7083
+ return { item: item2, operation };
7084
7084
  });
7085
7085
  }
7086
7086
 
@@ -7105,8 +7105,8 @@ class TransformationCommand {
7105
7105
  }
7106
7106
  }
7107
7107
  revert() {
7108
- this.reverse.forEach(({ item: item2, operation }) => {
7109
- item2.apply(operation);
7108
+ this.reverse.forEach(({ item, operation }) => {
7109
+ item.apply(operation);
7110
7110
  });
7111
7111
  }
7112
7112
  getReverse() {
@@ -7848,8 +7848,8 @@ class Path {
7848
7848
  }
7849
7849
  getIntersectionPoints(segment) {
7850
7850
  let intersections = [];
7851
- for (const item2 of this.segments) {
7852
- intersections = intersections.concat(item2.getIntersectionPoints(segment));
7851
+ for (const item of this.segments) {
7852
+ intersections = intersections.concat(item.getIntersectionPoints(segment));
7853
7853
  }
7854
7854
  return intersections;
7855
7855
  }
@@ -7914,8 +7914,8 @@ class Path {
7914
7914
  }
7915
7915
  isOpenEnclosedOrCrossedBy(rectangle) {
7916
7916
  let is = false;
7917
- for (const item2 of this.segments) {
7918
- is = is || item2.isEnclosedOrCrossedBy(rectangle);
7917
+ for (const item of this.segments) {
7918
+ is = is || item.isEnclosedOrCrossedBy(rectangle);
7919
7919
  }
7920
7920
  return is;
7921
7921
  }
@@ -8328,8 +8328,8 @@ class ConnectorCommand {
8328
8328
  }
8329
8329
  }
8330
8330
  revert() {
8331
- for (const { item: item2, operation } of this.reverse) {
8332
- item2.apply(operation);
8331
+ for (const { item, operation } of this.reverse) {
8332
+ item.apply(operation);
8333
8333
  }
8334
8334
  }
8335
8335
  getReverse() {
@@ -8486,11 +8486,11 @@ class SessionStorage {
8486
8486
  }
8487
8487
  get(key) {
8488
8488
  const boardId = this.getBoardId() || "";
8489
- const item2 = _sessionStorage.getItem(boardId + "_" + key);
8490
- if (!item2) {
8489
+ const item = _sessionStorage.getItem(boardId + "_" + key);
8490
+ if (!item) {
8491
8491
  return;
8492
8492
  }
8493
- return JSON.parse(item2);
8493
+ return JSON.parse(item);
8494
8494
  }
8495
8495
  remove(key) {
8496
8496
  const boardId = this.getBoardId() || "";
@@ -9275,8 +9275,8 @@ class LinkToCommand {
9275
9275
  }
9276
9276
  }
9277
9277
  revert() {
9278
- this.reverse.forEach(({ item: item2, operation }) => {
9279
- item2.apply(operation);
9278
+ this.reverse.forEach(({ item, operation }) => {
9279
+ item.apply(operation);
9280
9280
  });
9281
9281
  }
9282
9282
  getReverse() {
@@ -10577,9 +10577,9 @@ function handleSplitListItem(editor) {
10577
10577
  Transforms3.insertNodes(editor, {
10578
10578
  type: listType,
10579
10579
  listLevel: listNode.listLevel || 0,
10580
- children: itemsAfter.map((item2) => ({
10580
+ children: itemsAfter.map((item) => ({
10581
10581
  type: "list_item",
10582
- children: item2.children
10582
+ children: item.children
10583
10583
  }))
10584
10584
  }, { at: newListPath });
10585
10585
  }
@@ -12556,10 +12556,10 @@ function initializeDocument(effects) {
12556
12556
  return start;
12557
12557
  function start(code) {
12558
12558
  if (continued < stack.length) {
12559
- const item2 = stack[continued];
12560
- self2.containerState = item2[1];
12561
- ok(item2[0].continuation, "expected `continuation` to be defined on container construct");
12562
- return effects.attempt(item2[0].continuation, documentContinue, checkNewContainers)(code);
12559
+ const item = stack[continued];
12560
+ self2.containerState = item[1];
12561
+ ok(item[0].continuation, "expected `continuation` to be defined on container construct");
12562
+ return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code);
12563
12563
  }
12564
12564
  return checkNewContainers(code);
12565
12565
  }
@@ -13535,17 +13535,17 @@ class SpliceBuffer {
13535
13535
  this.setCursor(Number.POSITIVE_INFINITY);
13536
13536
  return this.left.pop();
13537
13537
  }
13538
- push(item2) {
13538
+ push(item) {
13539
13539
  this.setCursor(Number.POSITIVE_INFINITY);
13540
- this.left.push(item2);
13540
+ this.left.push(item);
13541
13541
  }
13542
13542
  pushMany(items) {
13543
13543
  this.setCursor(Number.POSITIVE_INFINITY);
13544
13544
  chunkedPush(this.left, items);
13545
13545
  }
13546
- unshift(item2) {
13546
+ unshift(item) {
13547
13547
  this.setCursor(0);
13548
- this.right.push(item2);
13548
+ this.right.push(item);
13549
13549
  }
13550
13550
  unshiftMany(items) {
13551
13551
  this.setCursor(0);
@@ -15576,8 +15576,8 @@ function initializeFactory(field) {
15576
15576
  if (list2) {
15577
15577
  ok(Array.isArray(list2), "expected `disable.null` to be populated");
15578
15578
  while (++index2 < list2.length) {
15579
- const item2 = list2[index2];
15580
- if (!item2.previous || item2.previous.call(self2, self2.previous)) {
15579
+ const item = list2[index2];
15580
+ if (!item.previous || item.previous.call(self2, self2.previous)) {
15581
15581
  return true;
15582
15582
  }
15583
15583
  }
@@ -16408,14 +16408,14 @@ function compiler(options) {
16408
16408
  length++;
16409
16409
  }
16410
16410
  if (event[1].type === types.listItemPrefix) {
16411
- const item2 = {
16411
+ const item = {
16412
16412
  type: "listItem",
16413
16413
  _spread: false,
16414
16414
  start: Object.assign({}, event[1].start),
16415
16415
  end: undefined
16416
16416
  };
16417
- listItem2 = item2;
16418
- events.splice(index2, 0, ["enter", item2, event[2]]);
16417
+ listItem2 = item;
16418
+ events.splice(index2, 0, ["enter", item, event[2]]);
16419
16419
  index2++;
16420
16420
  length++;
16421
16421
  firstBlankLineIndex = undefined;
@@ -17213,14 +17213,14 @@ class MarkdownProcessor {
17213
17213
  if (err || !file) {
17214
17214
  throw err;
17215
17215
  }
17216
- const nodes = file.result.map((item2) => {
17216
+ const nodes = file.result.map((item) => {
17217
17217
  setNodeStyles({
17218
- node: item2,
17218
+ node: item,
17219
17219
  editor: this.editor,
17220
17220
  horisontalAlignment: "left",
17221
- isPaddingTopNeeded: item2.type !== "code_block"
17221
+ isPaddingTopNeeded: item.type !== "code_block"
17222
17222
  });
17223
- return item2;
17223
+ return item;
17224
17224
  });
17225
17225
  if (isNewParagraphNeeded) {
17226
17226
  nodes.push(createParagraphNode("", this.editor));
@@ -18198,8 +18198,8 @@ class ShapeCommand {
18198
18198
  }
18199
18199
  }
18200
18200
  revert() {
18201
- for (const { item: item2, operation } of this.reverse) {
18202
- item2.apply(operation);
18201
+ for (const { item, operation } of this.reverse) {
18202
+ item.apply(operation);
18203
18203
  }
18204
18204
  }
18205
18205
  getReverse() {
@@ -18281,8 +18281,8 @@ class RichTextCommand {
18281
18281
  }
18282
18282
  }
18283
18283
  revert() {
18284
- for (const { item: item2, operation } of this.reverse) {
18285
- const richText = this.board.items.getById(item2);
18284
+ for (const { item, operation } of this.reverse) {
18285
+ const richText = this.board.items.getById(item);
18286
18286
  if (!richText) {
18287
18287
  continue;
18288
18288
  }
@@ -18301,12 +18301,12 @@ class RichTextCommand {
18301
18301
  case "setSelectionFontColor":
18302
18302
  case "setSelectionBlockType":
18303
18303
  const inverseOps = this.operation.ops.map((op) => Operation3.inverse(op)).reverse();
18304
- return items.map((item2) => {
18304
+ return items.map((item) => {
18305
18305
  const operation = {
18306
18306
  ...this.operation,
18307
18307
  ops: inverseOps
18308
18308
  };
18309
- return { item: item2, operation };
18309
+ return { item, operation };
18310
18310
  });
18311
18311
  case "setFontColor":
18312
18312
  return items.map((id) => ({
@@ -18398,13 +18398,13 @@ class RichTextGroupCommand {
18398
18398
  this.reverseOps = this.getReverse();
18399
18399
  }
18400
18400
  apply() {
18401
- for (const { item: item2, operation } of this.forwardOps) {
18402
- item2.applyCommand(operation);
18401
+ for (const { item, operation } of this.forwardOps) {
18402
+ item.applyCommand(operation);
18403
18403
  }
18404
18404
  }
18405
18405
  revert() {
18406
- for (const { item: item2, operation } of this.reverseOps) {
18407
- item2.applyCommand(operation);
18406
+ for (const { item, operation } of this.reverseOps) {
18407
+ item.applyCommand(operation);
18408
18408
  }
18409
18409
  }
18410
18410
  getForward() {
@@ -18519,8 +18519,8 @@ class DrawingCommand {
18519
18519
  item;
18520
18520
  operation;
18521
18521
  reverse;
18522
- constructor(item2, operation) {
18523
- this.item = item2;
18522
+ constructor(item, operation) {
18523
+ this.item = item;
18524
18524
  this.operation = operation;
18525
18525
  this.reverse = this.getReverse();
18526
18526
  }
@@ -18529,52 +18529,52 @@ class DrawingCommand {
18529
18529
  return this;
18530
18530
  }
18531
18531
  apply() {
18532
- for (const item2 of this.item) {
18533
- item2.apply(this.operation);
18532
+ for (const item of this.item) {
18533
+ item.apply(this.operation);
18534
18534
  }
18535
18535
  }
18536
18536
  revert() {
18537
- for (const { item: item2, operation } of this.reverse) {
18538
- item2.apply(operation);
18537
+ for (const { item, operation } of this.reverse) {
18538
+ item.apply(operation);
18539
18539
  }
18540
18540
  }
18541
18541
  getReverse() {
18542
18542
  const reverse = [];
18543
- for (const item2 of this.item) {
18544
- reverse.push({ item: item2, operation: this.getReverseOperation(item2) });
18543
+ for (const item of this.item) {
18544
+ reverse.push({ item, operation: this.getReverseOperation(item) });
18545
18545
  }
18546
18546
  return reverse;
18547
18547
  }
18548
- getReverseOperation(item2) {
18548
+ getReverseOperation(item) {
18549
18549
  switch (this.operation.method) {
18550
18550
  case "setStrokeColor":
18551
18551
  return {
18552
18552
  class: "Drawing",
18553
18553
  method: "setStrokeColor",
18554
- item: [item2.getId()],
18555
- color: item2.getStrokeColor()
18554
+ item: [item.getId()],
18555
+ color: item.getStrokeColor()
18556
18556
  };
18557
18557
  case "setStrokeWidth":
18558
18558
  return {
18559
18559
  class: "Drawing",
18560
18560
  method: "setStrokeWidth",
18561
- item: [item2.getId()],
18561
+ item: [item.getId()],
18562
18562
  width: this.operation.prevWidth,
18563
- prevWidth: item2.getStrokeWidth()
18563
+ prevWidth: item.getStrokeWidth()
18564
18564
  };
18565
18565
  case "setStrokeOpacity":
18566
18566
  return {
18567
18567
  class: "Drawing",
18568
18568
  method: "setStrokeOpacity",
18569
- item: [item2.getId()],
18570
- opacity: item2.getStrokeOpacity()
18569
+ item: [item.getId()],
18570
+ opacity: item.getStrokeOpacity()
18571
18571
  };
18572
18572
  case "setStrokeStyle":
18573
18573
  return {
18574
18574
  class: "Drawing",
18575
18575
  method: "setStrokeStyle",
18576
- item: [item2.getId()],
18577
- style: item2.getBorderStyle()
18576
+ item: [item.getId()],
18577
+ style: item.getBorderStyle()
18578
18578
  };
18579
18579
  }
18580
18580
  }
@@ -18596,8 +18596,8 @@ class StickerCommand {
18596
18596
  }
18597
18597
  }
18598
18598
  revert() {
18599
- for (const { item: item2, operation } of this.reverse) {
18600
- item2.apply(operation);
18599
+ for (const { item, operation } of this.reverse) {
18600
+ item.apply(operation);
18601
18601
  }
18602
18602
  }
18603
18603
  getReverse() {
@@ -18629,8 +18629,8 @@ class FrameCommand {
18629
18629
  }
18630
18630
  }
18631
18631
  revert() {
18632
- for (const { item: item2, operation } of this.reverse) {
18633
- item2.apply(operation);
18632
+ for (const { item, operation } of this.reverse) {
18633
+ item.apply(operation);
18634
18634
  }
18635
18635
  }
18636
18636
  getReverse() {
@@ -18672,21 +18672,23 @@ class FrameCommand {
18672
18672
  };
18673
18673
  });
18674
18674
  default:
18675
- const op = this.operation;
18676
- let newData = {};
18677
- if (op.prevData) {
18678
- newData = { ...op.prevData };
18679
- } else {
18680
- Object.keys(op.newData).forEach((key) => {
18681
- if (item[key]) {
18682
- newData[key] = item[key];
18683
- }
18684
- });
18685
- }
18686
- return {
18687
- ...op,
18688
- newData
18689
- };
18675
+ return mapItemsByOperation(frame, (item) => {
18676
+ const op = this.operation;
18677
+ let newData = {};
18678
+ if (op.prevData) {
18679
+ newData = { ...op.prevData };
18680
+ } else {
18681
+ Object.keys(op.newData).forEach((key) => {
18682
+ if (item[key]) {
18683
+ newData[key] = item[key];
18684
+ }
18685
+ });
18686
+ }
18687
+ return {
18688
+ ...op,
18689
+ newData
18690
+ };
18691
+ });
18690
18692
  }
18691
18693
  }
18692
18694
  }
@@ -18707,8 +18709,8 @@ class CommentCommand {
18707
18709
  }
18708
18710
  }
18709
18711
  revert() {
18710
- this.reverse.forEach(({ item: item2, operation }) => {
18711
- item2.apply(operation);
18712
+ this.reverse.forEach(({ item, operation }) => {
18713
+ item.apply(operation);
18712
18714
  });
18713
18715
  }
18714
18716
  getReverse() {
@@ -19170,8 +19172,8 @@ class GroupCommand {
19170
19172
  }
19171
19173
  }
19172
19174
  revert() {
19173
- for (const { item: item2, operation } of this.reverse) {
19174
- item2.apply(operation);
19175
+ for (const { item, operation } of this.reverse) {
19176
+ item.apply(operation);
19175
19177
  }
19176
19178
  }
19177
19179
  getReverse() {
@@ -19224,8 +19226,8 @@ class PlaceholderCommand {
19224
19226
  }
19225
19227
  }
19226
19228
  revert() {
19227
- for (const { item: item2, operation } of this.reverse) {
19228
- item2.apply(operation);
19229
+ for (const { item, operation } of this.reverse) {
19230
+ item.apply(operation);
19229
19231
  }
19230
19232
  }
19231
19233
  getReverse() {
@@ -19319,26 +19321,26 @@ class BaseCommand {
19319
19321
  return this;
19320
19322
  }
19321
19323
  apply() {
19322
- for (const item2 of this.items) {
19323
- item2.apply(this.operation);
19324
+ for (const item of this.items) {
19325
+ item.apply(this.operation);
19324
19326
  }
19325
19327
  }
19326
19328
  revert() {
19327
- for (const { item: item2, operation } of this.reverse) {
19328
- item2.apply(operation);
19329
+ for (const { item, operation } of this.reverse) {
19330
+ item.apply(operation);
19329
19331
  }
19330
19332
  }
19331
19333
  getReverse() {
19332
19334
  const items = this.items;
19333
- return mapItemsByOperation(items, (item2) => {
19335
+ return mapItemsByOperation(items, (item) => {
19334
19336
  const op = this.operation;
19335
19337
  let newData = {};
19336
19338
  if (op.prevData) {
19337
19339
  newData = { ...op.prevData };
19338
19340
  } else {
19339
19341
  Object.keys(op.newData).forEach((key) => {
19340
- if (item2[key]) {
19341
- newData[key] = item2[key];
19342
+ if (item[key]) {
19343
+ newData[key] = item[key];
19342
19344
  }
19343
19345
  });
19344
19346
  }
@@ -19366,37 +19368,37 @@ var itemCommandFactories = {
19366
19368
  LinkTo: createLinkToCommand
19367
19369
  };
19368
19370
  function createConnectorCommand(items, operation) {
19369
- return new ConnectorCommand(items.filter((item2) => item2.itemType === "Connector"), operation);
19371
+ return new ConnectorCommand(items.filter((item) => item.itemType === "Connector"), operation);
19370
19372
  }
19371
19373
  function createShapeCommand(items, operation) {
19372
- return new ShapeCommand(items.filter((item2) => item2.itemType === "Shape"), operation);
19374
+ return new ShapeCommand(items.filter((item) => item.itemType === "Shape"), operation);
19373
19375
  }
19374
19376
  function createDrawingCommand(items, operation) {
19375
- return new DrawingCommand(items.filter((item2) => item2.itemType === "Drawing"), operation);
19377
+ return new DrawingCommand(items.filter((item) => item.itemType === "Drawing"), operation);
19376
19378
  }
19377
19379
  function createCommentCommand(items, operation) {
19378
- return new CommentCommand(items.filter((item2) => item2.itemType === "Comment"), operation);
19380
+ return new CommentCommand(items.filter((item) => item.itemType === "Comment"), operation);
19379
19381
  }
19380
19382
  function createStickerCommand(items, operation) {
19381
- return new StickerCommand(items.filter((item2) => item2.itemType === "Sticker"), operation);
19383
+ return new StickerCommand(items.filter((item) => item.itemType === "Sticker"), operation);
19382
19384
  }
19383
19385
  function createFrameCommand(items, operation) {
19384
- return new FrameCommand(items.filter((item2) => item2.itemType === "Frame"), operation);
19386
+ return new FrameCommand(items.filter((item) => item.itemType === "Frame"), operation);
19385
19387
  }
19386
19388
  function createPlaceholderCommand(items, operation) {
19387
- return new PlaceholderCommand(items.filter((item2) => item2.itemType === "Placeholder"), operation);
19389
+ return new PlaceholderCommand(items.filter((item) => item.itemType === "Placeholder"), operation);
19388
19390
  }
19389
19391
  function createGroupCommand(items, operation) {
19390
- return new GroupCommand(items.filter((item2) => item2.itemType === "Group"), operation);
19392
+ return new GroupCommand(items.filter((item) => item.itemType === "Group"), operation);
19391
19393
  }
19392
19394
  function createImageCommand(items, operation) {
19393
- return new ImageCommand(items.filter((item2) => item2.itemType === "Image"), operation);
19395
+ return new ImageCommand(items.filter((item) => item.itemType === "Image"), operation);
19394
19396
  }
19395
19397
  function createVideoCommand(items, operation) {
19396
- return new VideoCommand(items.filter((item2) => item2.itemType === "Video"), operation);
19398
+ return new VideoCommand(items.filter((item) => item.itemType === "Video"), operation);
19397
19399
  }
19398
19400
  function createAudioCommand(items, operation) {
19399
- return new AudioCommand(items.filter((item2) => item2.itemType === "Audio"), operation);
19401
+ return new AudioCommand(items.filter((item) => item.itemType === "Audio"), operation);
19400
19402
  }
19401
19403
  function createRichTextCommand(items, operation, board) {
19402
19404
  if (!board) {
@@ -19404,8 +19406,8 @@ function createRichTextCommand(items, operation, board) {
19404
19406
  }
19405
19407
  if (operation.method === "groupEdit") {
19406
19408
  const texts = [];
19407
- for (const { item: item2 } of operation.itemsOps) {
19408
- const found = board.items.findById(item2);
19409
+ for (const { item } of operation.itemsOps) {
19410
+ const found = board.items.findById(item);
19409
19411
  const text3 = found?.getRichText();
19410
19412
  if (text3) {
19411
19413
  texts.push(text3);
@@ -19413,14 +19415,14 @@ function createRichTextCommand(items, operation, board) {
19413
19415
  }
19414
19416
  return new RichTextGroupCommand(texts, operation);
19415
19417
  } else {
19416
- return new RichTextCommand(board, items.map((item2) => item2.getId()), operation);
19418
+ return new RichTextCommand(board, items.map((item) => item.getId()), operation);
19417
19419
  }
19418
19420
  }
19419
19421
  function createTransformationCommand(items, operation) {
19420
- return new TransformationCommand(items.map((item2) => item2.transformation), operation);
19422
+ return new TransformationCommand(items.map((item) => item.transformation), operation);
19421
19423
  }
19422
19424
  function createLinkToCommand(items, operation) {
19423
- return new LinkToCommand(items.map((item2) => item2.linkTo), operation);
19425
+ return new LinkToCommand(items.map((item) => item.linkTo), operation);
19424
19426
  }
19425
19427
  function createCommand(board, operation) {
19426
19428
  try {
@@ -19438,13 +19440,13 @@ function createCommand(board, operation) {
19438
19440
  default: {
19439
19441
  const itemType = operation.class;
19440
19442
  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);
19441
- const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item2) => {
19442
- if (typeof item2 === "string") {
19443
- console.warn(`Item with ID ${item2} not found for operation ${operation.class}.${operation.method}`);
19443
+ const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item) => {
19444
+ if (typeof item === "string") {
19445
+ console.warn(`Item with ID ${item} not found for operation ${operation.class}.${operation.method}`);
19444
19446
  return false;
19445
19447
  }
19446
- if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item2.itemType !== operation.class) {
19447
- console.warn(`Item with ID ${item2} is not of operation type: ${itemType}.`);
19448
+ if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item.itemType !== operation.class) {
19449
+ console.warn(`Item with ID ${item} is not of operation type: ${itemType}.`);
19448
19450
  return false;
19449
19451
  }
19450
19452
  return true;
@@ -19745,20 +19747,20 @@ class RBush {
19745
19747
  }
19746
19748
  return this;
19747
19749
  }
19748
- insert(item2) {
19749
- if (item2)
19750
- this._insert(item2, this.data.height - 1);
19750
+ insert(item) {
19751
+ if (item)
19752
+ this._insert(item, this.data.height - 1);
19751
19753
  return this;
19752
19754
  }
19753
19755
  clear() {
19754
19756
  this.data = createNode([]);
19755
19757
  return this;
19756
19758
  }
19757
- remove(item2, equalsFn) {
19758
- if (!item2)
19759
+ remove(item, equalsFn) {
19760
+ if (!item)
19759
19761
  return this;
19760
19762
  let node2 = this.data;
19761
- const bbox = this.toBBox(item2);
19763
+ const bbox = this.toBBox(item);
19762
19764
  const path2 = [];
19763
19765
  const indexes = [];
19764
19766
  let i, parent, goingUp;
@@ -19770,7 +19772,7 @@ class RBush {
19770
19772
  goingUp = true;
19771
19773
  }
19772
19774
  if (node2.leaf) {
19773
- const index2 = findItem(item2, node2.children, equalsFn);
19775
+ const index2 = findItem(item, node2.children, equalsFn);
19774
19776
  if (index2 !== -1) {
19775
19777
  node2.children.splice(index2, 1);
19776
19778
  path2.push(node2);
@@ -19793,8 +19795,8 @@ class RBush {
19793
19795
  }
19794
19796
  return this;
19795
19797
  }
19796
- toBBox(item2) {
19797
- return item2;
19798
+ toBBox(item) {
19799
+ return item;
19798
19800
  }
19799
19801
  compareMinX(a, b) {
19800
19802
  return a.minX - b.minX;
@@ -19877,11 +19879,11 @@ class RBush {
19877
19879
  }
19878
19880
  return node2;
19879
19881
  }
19880
- _insert(item2, level, isNode) {
19881
- const bbox = isNode ? item2 : this.toBBox(item2);
19882
+ _insert(item, level, isNode) {
19883
+ const bbox = isNode ? item : this.toBBox(item);
19882
19884
  const insertPath = [];
19883
19885
  const node2 = this._chooseSubtree(bbox, this.data, level, insertPath);
19884
- node2.children.push(item2);
19886
+ node2.children.push(item);
19885
19887
  extend2(node2, bbox);
19886
19888
  while (level >= 0) {
19887
19889
  if (insertPath[level].children.length > this._maxEntries) {
@@ -19980,11 +19982,11 @@ class RBush {
19980
19982
  }
19981
19983
  }
19982
19984
  }
19983
- function findItem(item2, items, equalsFn) {
19985
+ function findItem(item, items, equalsFn) {
19984
19986
  if (!equalsFn)
19985
- return items.indexOf(item2);
19987
+ return items.indexOf(item);
19986
19988
  for (let i = 0;i < items.length; i++) {
19987
- if (equalsFn(item2, items[i]))
19989
+ if (equalsFn(item, items[i]))
19988
19990
  return i;
19989
19991
  }
19990
19992
  return -1;
@@ -20075,8 +20077,8 @@ class TinyQueue {
20075
20077
  this._down(i);
20076
20078
  }
20077
20079
  }
20078
- push(item2) {
20079
- this.data.push(item2);
20080
+ push(item) {
20081
+ this.data.push(item);
20080
20082
  this.length++;
20081
20083
  this._up(this.length - 1);
20082
20084
  }
@@ -20097,21 +20099,21 @@ class TinyQueue {
20097
20099
  }
20098
20100
  _up(pos) {
20099
20101
  const { data, compare } = this;
20100
- const item2 = data[pos];
20102
+ const item = data[pos];
20101
20103
  while (pos > 0) {
20102
20104
  const parent = pos - 1 >> 1;
20103
20105
  const current = data[parent];
20104
- if (compare(item2, current) >= 0)
20106
+ if (compare(item, current) >= 0)
20105
20107
  break;
20106
20108
  data[pos] = current;
20107
20109
  pos = parent;
20108
20110
  }
20109
- data[pos] = item2;
20111
+ data[pos] = item;
20110
20112
  }
20111
20113
  _down(pos) {
20112
20114
  const { data, compare } = this;
20113
20115
  const halfLength = this.length >> 1;
20114
- const item2 = data[pos];
20116
+ const item = data[pos];
20115
20117
  while (pos < halfLength) {
20116
20118
  let left = (pos << 1) + 1;
20117
20119
  let best = data[left];
@@ -20120,12 +20122,12 @@ class TinyQueue {
20120
20122
  left = right;
20121
20123
  best = data[right];
20122
20124
  }
20123
- if (compare(best, item2) >= 0)
20125
+ if (compare(best, item) >= 0)
20124
20126
  break;
20125
20127
  data[pos] = best;
20126
20128
  pos = left;
20127
20129
  }
20128
- data[pos] = item2;
20130
+ data[pos] = item;
20129
20131
  }
20130
20132
  }
20131
20133
  function defaultCompare2(a, b) {
@@ -20213,10 +20215,10 @@ class RTreeIndex {
20213
20215
  return container ? container.item : undefined;
20214
20216
  }
20215
20217
  remove(id) {
20216
- const item2 = this.map.get(id);
20217
- if (item2) {
20218
+ const item = this.map.get(id);
20219
+ if (item) {
20218
20220
  this.map.delete(id);
20219
- this.tree.remove(item2);
20221
+ this.tree.remove(item);
20220
20222
  }
20221
20223
  }
20222
20224
  list() {
@@ -20288,11 +20290,11 @@ class Container extends Mbr {
20288
20290
  item;
20289
20291
  layer;
20290
20292
  zIndex;
20291
- constructor(id, item2, layer, zIndex) {
20292
- const rect = item2.getMbrWithChildren();
20293
+ constructor(id, item, layer, zIndex) {
20294
+ const rect = item.getMbrWithChildren();
20293
20295
  super(rect.left, rect.top, rect.right, rect.bottom);
20294
20296
  this.id = id;
20295
- this.item = item2;
20297
+ this.item = item;
20296
20298
  this.layer = layer;
20297
20299
  this.zIndex = zIndex;
20298
20300
  }
@@ -20309,7 +20311,7 @@ class LayeredIndex {
20309
20311
  this.getZIndex = this.getZIndex.bind(this);
20310
20312
  this.layers.newOnTop();
20311
20313
  }
20312
- isT(item2) {
20314
+ isT(item) {
20313
20315
  return true;
20314
20316
  }
20315
20317
  findById(id) {
@@ -20373,8 +20375,8 @@ class LayeredIndex {
20373
20375
  }
20374
20376
  getContainersFromItems(items) {
20375
20377
  const containers = [];
20376
- for (const item2 of items) {
20377
- const container = this.map.get(item2.getId());
20378
+ for (const item of items) {
20379
+ const container = this.map.get(item.getId());
20378
20380
  if (container) {
20379
20381
  containers.push(container);
20380
20382
  }
@@ -20451,9 +20453,9 @@ class LayeredIndex {
20451
20453
  }
20452
20454
  }
20453
20455
  }
20454
- insert(item2) {
20455
- const toInsert = new Container(item2.getId(), item2, 0, this.getZIndex(item2));
20456
- const bounds = item2.getMbrWithChildren();
20456
+ insert(item) {
20457
+ const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
20458
+ const bounds = item.getMbrWithChildren();
20457
20459
  const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
20458
20460
  if (inBounds.length === 0) {
20459
20461
  return this.insertContainer(toInsert);
@@ -20520,20 +20522,20 @@ class LayeredIndex {
20520
20522
  }
20521
20523
  }
20522
20524
  }
20523
- change(item2) {
20524
- const id = item2.getId();
20525
+ change(item) {
20526
+ const id = item.getId();
20525
20527
  const container = this.map.get(id);
20526
20528
  if (container) {
20527
20529
  const layer = this.layers.get(container.layer);
20528
20530
  if (layer) {
20529
20531
  layer.remove(id);
20530
20532
  this.map.delete(id);
20531
- this.insert(item2);
20533
+ this.insert(item);
20532
20534
  }
20533
20535
  }
20534
20536
  }
20535
- remove(item2) {
20536
- const id = item2.getId();
20537
+ remove(item) {
20538
+ const id = item.getId();
20537
20539
  const container = this.map.get(id);
20538
20540
  if (container) {
20539
20541
  const layer = this.layers.get(container.layer);
@@ -20559,13 +20561,13 @@ class LayeredIndex {
20559
20561
  return items;
20560
20562
  }
20561
20563
  batchInsert(items) {
20562
- for (const item2 of items) {
20563
- this.insert(item2);
20564
+ for (const item of items) {
20565
+ this.insert(item);
20564
20566
  }
20565
20567
  }
20566
20568
  batchChange(items) {
20567
- for (const item2 of items) {
20568
- this.change(item2);
20569
+ for (const item of items) {
20570
+ this.change(item);
20569
20571
  }
20570
20572
  }
20571
20573
  }
@@ -20574,8 +20576,8 @@ class LayeredIndex {
20574
20576
  class SpatialIndex {
20575
20577
  subject = new Subject;
20576
20578
  itemsArray = [];
20577
- itemsIndex = new LayeredIndex((item2) => {
20578
- return this.itemsArray.indexOf(item2);
20579
+ itemsIndex = new LayeredIndex((item) => {
20580
+ return this.itemsArray.indexOf(item);
20579
20581
  });
20580
20582
  Mbr = new Mbr;
20581
20583
  items;
@@ -20584,79 +20586,79 @@ class SpatialIndex {
20584
20586
  }
20585
20587
  clear() {
20586
20588
  this.itemsArray = [];
20587
- this.itemsIndex = new LayeredIndex((item2) => {
20588
- return this.itemsArray.indexOf(item2);
20589
+ this.itemsIndex = new LayeredIndex((item) => {
20590
+ return this.itemsArray.indexOf(item);
20589
20591
  });
20590
20592
  this.Mbr = new Mbr;
20591
20593
  }
20592
- insert(item2) {
20593
- this.itemsArray.push(item2);
20594
- this.itemsIndex.insert(item2);
20594
+ insert(item) {
20595
+ this.itemsArray.push(item);
20596
+ this.itemsIndex.insert(item);
20595
20597
  if (conf.isNode()) {
20596
20598
  return;
20597
20599
  }
20598
20600
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
20599
- this.Mbr = item2.getMbr().copy();
20601
+ this.Mbr = item.getMbr().copy();
20600
20602
  } else {
20601
- this.Mbr.combine([item2.getMbr()]);
20603
+ this.Mbr.combine([item.getMbr()]);
20602
20604
  }
20603
- item2.subject.subscribe(this.change);
20605
+ item.subject.subscribe(this.change);
20604
20606
  this.subject.publish(this.items);
20605
20607
  }
20606
- change = (item2) => {
20607
- this.itemsIndex.change(item2);
20608
+ change = (item) => {
20609
+ this.itemsIndex.change(item);
20608
20610
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
20609
- this.Mbr = item2.getMbrWithChildren().copy();
20611
+ this.Mbr = item.getMbrWithChildren().copy();
20610
20612
  } else {
20611
- this.Mbr.combine([item2.getMbrWithChildren()]);
20613
+ this.Mbr.combine([item.getMbrWithChildren()]);
20612
20614
  }
20613
20615
  this.subject.publish(this.items);
20614
20616
  };
20615
- remove(item2) {
20616
- if ("index" in item2 && item2.index) {
20617
- item2.removeChildItems(item2.index.list());
20617
+ remove(item) {
20618
+ if ("index" in item && item.index) {
20619
+ item.removeChildItems(item.index.list());
20618
20620
  }
20619
- this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
20620
- this.itemsIndex.remove(item2);
20621
+ this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
20622
+ this.itemsIndex.remove(item);
20621
20623
  this.Mbr = new Mbr;
20622
- this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbrWithChildren()]));
20624
+ this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbrWithChildren()]));
20623
20625
  this.subject.publish(this.items);
20624
20626
  }
20625
20627
  copy() {
20626
- return this.getItemsWithIncludedChildren(this.itemsArray).map((item2) => ({
20627
- ...item2.serialize(true),
20628
- id: item2.getId()
20628
+ return this.getItemsWithIncludedChildren(this.itemsArray).map((item) => ({
20629
+ ...item.serialize(true),
20630
+ id: item.getId()
20629
20631
  }));
20630
20632
  }
20631
20633
  getItemsWithIncludedChildren(items) {
20632
- return items.flatMap((item2) => {
20633
- if ("index" in item2 && item2.index) {
20634
- return [item2, ...item2.index.list()];
20634
+ return items.flatMap((item) => {
20635
+ if ("index" in item && item.index) {
20636
+ return [item, ...item.index.list()];
20635
20637
  }
20636
- return item2;
20638
+ return item;
20637
20639
  });
20638
20640
  }
20639
- getItemChildren(item2) {
20640
- if ("index" in item2 && item2.index) {
20641
- return item2.index.list();
20641
+ getItemChildren(item) {
20642
+ if ("index" in item && item.index) {
20643
+ return item.index.list();
20642
20644
  }
20643
20645
  return [];
20644
20646
  }
20645
- getItemParent(item2) {
20646
- if (item2.parent === "Board") {
20647
+ getItemParent(item) {
20648
+ if (item.parent === "Board") {
20647
20649
  return;
20648
20650
  }
20649
- return this.getById(item2.parent);
20651
+ return this.getById(item.parent);
20650
20652
  }
20651
- moveToZIndex(item2, zIndex) {
20652
- const index2 = this.itemsArray.indexOf(item2);
20653
+ moveToZIndex(item, zIndex) {
20654
+ const index2 = this.itemsArray.indexOf(item);
20653
20655
  this.itemsArray.splice(index2, 1);
20654
- this.itemsArray.splice(zIndex, 0, item2);
20655
- this.change(item2);
20656
+ this.itemsArray.splice(zIndex, 0, item);
20657
+ this.change(item);
20656
20658
  this.subject.publish(this.items);
20657
20659
  }
20658
20660
  moveManyToZIndex(itemsRecord) {
20659
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
20661
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
20660
20662
  const zIndex = Object.values(itemsRecord);
20661
20663
  for (let i = 0;i < zIndex.length; i++) {
20662
20664
  const index2 = zIndex[i];
@@ -20664,39 +20666,39 @@ class SpatialIndex {
20664
20666
  }
20665
20667
  this.itemsArray.forEach(this.change.bind(this));
20666
20668
  }
20667
- sendToBack(item2, shouldPublish = true) {
20668
- const index2 = this.itemsArray.indexOf(item2);
20669
+ sendToBack(item, shouldPublish = true) {
20670
+ const index2 = this.itemsArray.indexOf(item);
20669
20671
  this.itemsArray.splice(index2, 1);
20670
- this.itemsArray.unshift(item2);
20671
- this.itemsIndex.change(item2);
20672
+ this.itemsArray.unshift(item);
20673
+ this.itemsIndex.change(item);
20672
20674
  if (shouldPublish) {
20673
20675
  this.subject.publish(this.items);
20674
20676
  }
20675
20677
  }
20676
20678
  sendManyToBack(items) {
20677
20679
  const newItems = [...items];
20678
- this.itemsArray.forEach((item2) => {
20679
- if (!items.includes(item2)) {
20680
- newItems.push(item2);
20680
+ this.itemsArray.forEach((item) => {
20681
+ if (!items.includes(item)) {
20682
+ newItems.push(item);
20681
20683
  }
20682
20684
  });
20683
20685
  this.itemsArray = newItems;
20684
20686
  this.itemsArray.forEach(this.change.bind(this));
20685
20687
  }
20686
- bringToFront(item2, shouldPublish = true) {
20687
- const index2 = this.itemsArray.indexOf(item2);
20688
+ bringToFront(item, shouldPublish = true) {
20689
+ const index2 = this.itemsArray.indexOf(item);
20688
20690
  this.itemsArray.splice(index2, 1);
20689
- this.itemsArray.push(item2);
20690
- this.itemsIndex.change(item2);
20691
+ this.itemsArray.push(item);
20692
+ this.itemsIndex.change(item);
20691
20693
  if (shouldPublish) {
20692
20694
  this.subject.publish(this.items);
20693
20695
  }
20694
20696
  }
20695
20697
  bringManyToFront(items) {
20696
20698
  const newItems = [];
20697
- this.itemsArray.forEach((item2) => {
20698
- if (!items.includes(item2)) {
20699
- newItems.push(item2);
20699
+ this.itemsArray.forEach((item) => {
20700
+ if (!items.includes(item)) {
20701
+ newItems.push(item);
20700
20702
  }
20701
20703
  });
20702
20704
  newItems.push(...items);
@@ -20722,9 +20724,9 @@ class SpatialIndex {
20722
20724
  this.subject.publish(this.items);
20723
20725
  }
20724
20726
  getById(id) {
20725
- const item2 = this.getItemsWithIncludedChildren(this.itemsArray).find((item3) => item3.getId() === id);
20726
- if (item2) {
20727
- return item2;
20727
+ const item = this.getItemsWithIncludedChildren(this.itemsArray).find((item2) => item2.getId() === id);
20728
+ if (item) {
20729
+ return item;
20728
20730
  }
20729
20731
  }
20730
20732
  findById(id) {
@@ -20734,10 +20736,10 @@ class SpatialIndex {
20734
20736
  const mbr = new Mbr(left, top, right, bottom);
20735
20737
  const items = this.itemsIndex.getEnclosed(mbr);
20736
20738
  const children = [];
20737
- const clearItems = items.filter((item2) => {
20738
- if ("index" in item2 && item2.index) {
20739
- children.push(...item2.index.getEnclosed(left, top, right, bottom));
20740
- if (!item2.getMbr().isEnclosedBy(mbr)) {
20739
+ const clearItems = items.filter((item) => {
20740
+ if ("index" in item && item.index) {
20741
+ children.push(...item.index.getEnclosed(left, top, right, bottom));
20742
+ if (!item.getMbr().isEnclosedBy(mbr)) {
20741
20743
  return false;
20742
20744
  }
20743
20745
  }
@@ -20749,10 +20751,10 @@ class SpatialIndex {
20749
20751
  const mbr = new Mbr(left, top, right, bottom);
20750
20752
  const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
20751
20753
  const children = [];
20752
- const clearItems = items.filter((item2) => {
20753
- if ("index" in item2 && item2.index) {
20754
- children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
20755
- if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
20754
+ const clearItems = items.filter((item) => {
20755
+ if ("index" in item && item.index) {
20756
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
20757
+ if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
20756
20758
  return false;
20757
20759
  }
20758
20760
  }
@@ -20763,10 +20765,10 @@ class SpatialIndex {
20763
20765
  getUnderPoint(point3, tolerance = 5) {
20764
20766
  const items = this.itemsIndex.getUnderPoint(point3, tolerance);
20765
20767
  const children = [];
20766
- const clearItems = items.filter((item2) => {
20767
- if ("index" in item2 && item2.index) {
20768
- children.push(...item2.index.getUnderPoint(point3, tolerance));
20769
- if (!item2.getMbr().isUnderPoint(point3)) {
20768
+ const clearItems = items.filter((item) => {
20769
+ if ("index" in item && item.index) {
20770
+ children.push(...item.index.getUnderPoint(point3, tolerance));
20771
+ if (!item.getMbr().isUnderPoint(point3)) {
20770
20772
  return false;
20771
20773
  }
20772
20774
  }
@@ -20778,10 +20780,10 @@ class SpatialIndex {
20778
20780
  const mbr = new Mbr(left, top, right, bottom);
20779
20781
  const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
20780
20782
  const children = [];
20781
- const clearItems = items.filter((item2) => {
20782
- if ("index" in item2 && item2.index) {
20783
- children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
20784
- if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
20783
+ const clearItems = items.filter((item) => {
20784
+ if ("index" in item && item.index) {
20785
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
20786
+ if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
20785
20787
  return false;
20786
20788
  }
20787
20789
  }
@@ -20793,26 +20795,26 @@ class SpatialIndex {
20793
20795
  return this.getRectsEnclosedOrCrossed(left, top, right, bottom);
20794
20796
  }
20795
20797
  getComments() {
20796
- return this.itemsArray.filter((item2) => item2 instanceof Comment);
20798
+ return this.itemsArray.filter((item) => item instanceof Comment);
20797
20799
  }
20798
20800
  getMbr() {
20799
20801
  return this.Mbr;
20800
20802
  }
20801
20803
  getNearestTo(point3, maxItems, filter, maxDistance) {
20802
20804
  const allItems = this.getItemsWithIncludedChildren(this.itemsArray);
20803
- const filtered = allItems.filter((item2) => filter(item2));
20804
- const withDistance = filtered.map((item2) => ({
20805
- item: item2,
20806
- distance: point3.getDistance(item2.getMbr().getCenter())
20805
+ const filtered = allItems.filter((item) => filter(item));
20806
+ const withDistance = filtered.map((item) => ({
20807
+ item,
20808
+ distance: point3.getDistance(item.getMbr().getCenter())
20807
20809
  })).filter(({ distance }) => distance <= maxDistance);
20808
20810
  withDistance.sort((a, b) => a.distance - b.distance);
20809
- return withDistance.slice(0, maxItems).map(({ item: item2 }) => item2);
20811
+ return withDistance.slice(0, maxItems).map(({ item }) => item);
20810
20812
  }
20811
20813
  list() {
20812
20814
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
20813
20815
  }
20814
- getZIndex(item2) {
20815
- const index2 = this.itemsArray.indexOf(item2);
20816
+ getZIndex(item) {
20817
+ const index2 = this.itemsArray.indexOf(item);
20816
20818
  if (index2 === -1) {
20817
20819
  return this.getLastZIndex();
20818
20820
  }
@@ -20842,14 +20844,14 @@ class Items {
20842
20844
  this.pointer = pointer;
20843
20845
  this.subject = subject;
20844
20846
  }
20845
- update(item2) {
20846
- this.index.change(item2);
20847
+ update(item) {
20848
+ this.index.change(item);
20847
20849
  }
20848
20850
  listAll() {
20849
20851
  return this.index.list();
20850
20852
  }
20851
20853
  listGroupItems() {
20852
- return this.index.list().filter((item2) => ("index" in item2) && item2.index);
20854
+ return this.index.list().filter((item) => ("index" in item) && item.index);
20853
20855
  }
20854
20856
  getById(id) {
20855
20857
  return this.index.getById(id);
@@ -20864,7 +20866,7 @@ class Items {
20864
20866
  return this.index.getEnclosedOrCrossed(left, top, right, bottom);
20865
20867
  }
20866
20868
  getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
20867
- return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => item2 instanceof BaseItem && item2.index);
20869
+ return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.index);
20868
20870
  }
20869
20871
  getUnderPoint(point3, tolerance = 5) {
20870
20872
  return this.index.getUnderPoint(point3, tolerance);
@@ -20892,28 +20894,28 @@ class Items {
20892
20894
  const unmodifiedSize = size;
20893
20895
  size = 16;
20894
20896
  const tolerated = this.index.getEnclosedOrCrossed(x - size, y - size, x + size, y + size);
20895
- const groups = tolerated.filter((item2) => item2.itemType === "Group");
20897
+ const groups = tolerated.filter((item) => item.itemType === "Group");
20896
20898
  if (groups.length > 0) {
20897
20899
  return groups;
20898
20900
  }
20899
- let enclosed = tolerated.some((item2) => item2 instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
20901
+ let enclosed = tolerated.some((item) => item instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
20900
20902
  const underPointer = this.getUnderPoint(new Point(x, y), size);
20901
20903
  if (enclosed.length === 0) {
20902
20904
  enclosed = underPointer;
20903
20905
  }
20904
- if (underPointer.some((item2) => item2.itemType === "Drawing")) {
20906
+ if (underPointer.some((item) => item.itemType === "Drawing")) {
20905
20907
  enclosed = [...underPointer, ...enclosed];
20906
20908
  }
20907
- const { nearest } = enclosed.reduce((acc, item2) => {
20908
- const area = item2.getMbr().getHeight() * item2.getMbr().getWidth();
20909
- if (item2.itemType === "Drawing" && !item2.isPointNearLine(this.pointer.point)) {
20909
+ const { nearest } = enclosed.reduce((acc, item) => {
20910
+ const area = item.getMbr().getHeight() * item.getMbr().getWidth();
20911
+ if (item.itemType === "Drawing" && !item.isPointNearLine(this.pointer.point)) {
20910
20912
  return acc;
20911
20913
  }
20912
- const isItemTransparent = item2 instanceof Shape && item2?.getBackgroundColor() === "none";
20913
- const itemZIndex = this.getZIndex(item2);
20914
+ const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
20915
+ const itemZIndex = this.getZIndex(item);
20914
20916
  const accZIndex = this.getZIndex(acc.nearest);
20915
20917
  if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
20916
- return { nearest: item2, area };
20918
+ return { nearest: item, area };
20917
20919
  }
20918
20920
  return acc;
20919
20921
  }, { nearest: undefined, area: Infinity });
@@ -20925,8 +20927,8 @@ class Items {
20925
20927
  getNearPointer(maxDistance = 100, maxItems = 10, filter = () => true) {
20926
20928
  return this.index.getNearestTo(this.pointer.point, maxItems, filter, maxDistance);
20927
20929
  }
20928
- getZIndex(item2) {
20929
- return this.index.getZIndex(item2);
20930
+ getZIndex(item) {
20931
+ return this.index.getZIndex(item);
20930
20932
  }
20931
20933
  getByZIndex(index2) {
20932
20934
  return this.index.getByZIndex(index2);
@@ -20935,11 +20937,11 @@ class Items {
20935
20937
  return this.index.getLastZIndex();
20936
20938
  }
20937
20939
  getLinkedConnectorsById(id) {
20938
- return this.listAll().filter((item2) => {
20939
- if (!(item2 instanceof Connector2)) {
20940
+ return this.listAll().filter((item) => {
20941
+ if (!(item instanceof Connector2)) {
20940
20942
  return false;
20941
20943
  }
20942
- const { startItem, endItem } = item2.getConnectedItems();
20944
+ const { startItem, endItem } = item.getConnectedItems();
20943
20945
  if (startItem?.getId() === id || endItem?.getId() === id) {
20944
20946
  return true;
20945
20947
  }
@@ -20950,11 +20952,11 @@ class Items {
20950
20952
  if (!startPointerItemId && !endPointerItemId) {
20951
20953
  return [];
20952
20954
  }
20953
- return this.listAll().filter((item2) => {
20954
- if (!(item2 instanceof Connector2) || !item2.isConnected()) {
20955
+ return this.listAll().filter((item) => {
20956
+ if (!(item instanceof Connector2) || !item.isConnected()) {
20955
20957
  return false;
20956
20958
  }
20957
- const { startItem, endItem } = item2.getConnectedItems();
20959
+ const { startItem, endItem } = item.getConnectedItems();
20958
20960
  if (startPointerItemId && endPointerItemId) {
20959
20961
  if (startPointerItemId && startItem && startItem.getId() === startPointerItemId && endPointerItemId && endItem && endItem.getId() === endPointerItemId) {
20960
20962
  return true;
@@ -20972,9 +20974,9 @@ class Items {
20972
20974
  }
20973
20975
  render(context) {
20974
20976
  const items = this.getItemsInView();
20975
- items.forEach((item2) => {
20976
- if (item2.parent === "Board") {
20977
- item2.render(context);
20977
+ items.forEach((item) => {
20978
+ if (item.parent === "Board") {
20979
+ item.render(context);
20978
20980
  }
20979
20981
  });
20980
20982
  }
@@ -20987,17 +20989,17 @@ class Items {
20987
20989
  return this.getHTML(documentFactory, items);
20988
20990
  }
20989
20991
  getHTML(documentFactory, items) {
20990
- const lowestCoordinates = items.map((item2) => item2.getMbr()).reduce((acc, mbr) => ({
20992
+ const lowestCoordinates = items.map((item) => item.getMbr()).reduce((acc, mbr) => ({
20991
20993
  left: Math.min(acc.left, mbr.left),
20992
20994
  top: Math.min(acc.top, mbr.top)
20993
20995
  }), { left: 0, top: 0 });
20994
20996
  const groups = [];
20995
20997
  const rest = [];
20996
- items.forEach((item2) => {
20997
- if ("index" in item2 && item2.index) {
20998
- groups.push(item2);
20998
+ items.forEach((item) => {
20999
+ if ("index" in item && item.index) {
21000
+ groups.push(item);
20999
21001
  } else {
21000
- rest.push(item2);
21002
+ rest.push(item);
21001
21003
  }
21002
21004
  });
21003
21005
  const childrenMap = new Map;
@@ -21007,34 +21009,34 @@ class Items {
21007
21009
  translateElementBy(html, -lowestCoordinates.left, -lowestCoordinates.top);
21008
21010
  return html;
21009
21011
  });
21010
- const restHTML = rest.map((item2) => ("renderHTML" in item2) && item2.renderHTML(documentFactory)).filter((item2) => !!item2).map((item2) => {
21011
- if (item2.tagName.toLowerCase() === "connector-item") {
21012
- const startX = parseFloat(item2.getAttribute("data-start-point-x") || "0");
21013
- const startY = parseFloat(item2.getAttribute("data-start-point-y") || "0");
21014
- const endX = parseFloat(item2.getAttribute("data-end-point-x") || "0");
21015
- const endY = parseFloat(item2.getAttribute("data-end-point-y") || "0");
21016
- item2.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
21017
- item2.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
21018
- item2.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
21019
- item2.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
21020
- }
21021
- return translateElementBy(item2, -lowestCoordinates.left, -lowestCoordinates.top);
21022
- });
21023
- for (const item2 of restHTML) {
21024
- const parentFrameId = childrenMap.get(item2.id);
21012
+ const restHTML = rest.map((item) => ("renderHTML" in item) && item.renderHTML(documentFactory)).filter((item) => !!item).map((item) => {
21013
+ if (item.tagName.toLowerCase() === "connector-item") {
21014
+ const startX = parseFloat(item.getAttribute("data-start-point-x") || "0");
21015
+ const startY = parseFloat(item.getAttribute("data-start-point-y") || "0");
21016
+ const endX = parseFloat(item.getAttribute("data-end-point-x") || "0");
21017
+ const endY = parseFloat(item.getAttribute("data-end-point-y") || "0");
21018
+ item.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
21019
+ item.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
21020
+ item.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
21021
+ item.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
21022
+ }
21023
+ return translateElementBy(item, -lowestCoordinates.left, -lowestCoordinates.top);
21024
+ });
21025
+ for (const item of restHTML) {
21026
+ const parentFrameId = childrenMap.get(item.id);
21025
21027
  const group = GroupsHTML.find((el) => parentFrameId !== undefined && el.id === parentFrameId);
21026
21028
  if (group) {
21027
- positionRelatively(item2, group);
21028
- group.appendChild(item2);
21029
+ positionRelatively(item, group);
21030
+ group.appendChild(item);
21029
21031
  }
21030
21032
  }
21031
21033
  let result = "";
21032
21034
  for (const group of GroupsHTML) {
21033
21035
  result += group.outerHTML;
21034
21036
  }
21035
- for (const item2 of restHTML) {
21036
- if (!childrenMap.get(item2.id)) {
21037
- result += item2.outerHTML;
21037
+ for (const item of restHTML) {
21038
+ if (!childrenMap.get(item.id)) {
21039
+ result += item.outerHTML;
21038
21040
  }
21039
21041
  }
21040
21042
  return result;
@@ -21054,52 +21056,52 @@ class SimpleSpatialIndex {
21054
21056
  this.itemsArray = [];
21055
21057
  this.Mbr = new Mbr;
21056
21058
  }
21057
- insert(item2) {
21058
- this.itemsArray.push(item2);
21059
+ insert(item) {
21060
+ this.itemsArray.push(item);
21059
21061
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
21060
- this.Mbr = item2.getMbr().copy();
21062
+ this.Mbr = item.getMbr().copy();
21061
21063
  } else {
21062
- this.Mbr.combine([item2.getMbr()]);
21064
+ this.Mbr.combine([item.getMbr()]);
21063
21065
  }
21064
- item2.subject.subscribe(this.change);
21066
+ item.subject.subscribe(this.change);
21065
21067
  this.subject.publish(this.items);
21066
21068
  }
21067
- change = (item2) => {
21069
+ change = (item) => {
21068
21070
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
21069
- this.Mbr = item2.getMbr().copy();
21071
+ this.Mbr = item.getMbr().copy();
21070
21072
  } else {
21071
- this.Mbr.combine([item2.getMbr()]);
21073
+ this.Mbr.combine([item.getMbr()]);
21072
21074
  }
21073
21075
  this.subject.publish(this.items);
21074
21076
  };
21075
- remove(item2) {
21076
- if ("index" in item2 && item2.index) {
21077
- item2.removeChildItems(item2.index.list());
21077
+ remove(item) {
21078
+ if ("index" in item && item.index) {
21079
+ item.removeChildItems(item.index.list());
21078
21080
  }
21079
- if (item2.parent !== "Board") {
21080
- const parentFrame = this.items.getById(item2.parent);
21081
- parentFrame?.removeChildItems(item2);
21081
+ if (item.parent !== "Board") {
21082
+ const parentFrame = this.items.getById(item.parent);
21083
+ parentFrame?.removeChildItems(item);
21082
21084
  }
21083
- this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
21085
+ this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
21084
21086
  this.Mbr = new Mbr;
21085
- this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbr()]));
21087
+ this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbr()]));
21086
21088
  this.subject.publish(this.items);
21087
21089
  }
21088
21090
  copy() {
21089
- return this.itemsArray.map((item2) => ({
21090
- ...item2.serialize(true),
21091
- id: item2.getId()
21091
+ return this.itemsArray.map((item) => ({
21092
+ ...item.serialize(true),
21093
+ id: item.getId()
21092
21094
  }));
21093
21095
  }
21094
- moveToZIndex(item2, zIndex) {
21095
- const index2 = this.itemsArray.indexOf(item2);
21096
+ moveToZIndex(item, zIndex) {
21097
+ const index2 = this.itemsArray.indexOf(item);
21096
21098
  this.itemsArray.splice(index2, 1);
21097
- this.itemsArray.splice(zIndex, 0, item2);
21098
- this.change(item2);
21099
+ this.itemsArray.splice(zIndex, 0, item);
21100
+ this.change(item);
21099
21101
  this.subject.publish(this.items);
21100
21102
  }
21101
21103
  moveManyToZIndex(itemsRecord) {
21102
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
21104
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
21103
21105
  const zIndex = Object.values(itemsRecord);
21104
21106
  for (let i = 0;i < zIndex.length; i++) {
21105
21107
  const index2 = zIndex[i];
@@ -21107,37 +21109,37 @@ class SimpleSpatialIndex {
21107
21109
  }
21108
21110
  this.itemsArray.forEach(this.change.bind(this));
21109
21111
  }
21110
- sendToBack(item2, shouldPublish = true) {
21111
- const index2 = this.itemsArray.indexOf(item2);
21112
+ sendToBack(item, shouldPublish = true) {
21113
+ const index2 = this.itemsArray.indexOf(item);
21112
21114
  this.itemsArray.splice(index2, 1);
21113
- this.itemsArray.unshift(item2);
21115
+ this.itemsArray.unshift(item);
21114
21116
  if (shouldPublish) {
21115
21117
  this.subject.publish(this.items);
21116
21118
  }
21117
21119
  }
21118
21120
  sendManyToBack(items) {
21119
21121
  const newItems = [...items];
21120
- this.itemsArray.forEach((item2) => {
21121
- if (!items.includes(item2)) {
21122
- newItems.push(item2);
21122
+ this.itemsArray.forEach((item) => {
21123
+ if (!items.includes(item)) {
21124
+ newItems.push(item);
21123
21125
  }
21124
21126
  });
21125
21127
  this.itemsArray = newItems;
21126
21128
  this.itemsArray.forEach(this.change.bind(this));
21127
21129
  }
21128
- bringToFront(item2, shouldPublish = true) {
21129
- const index2 = this.itemsArray.indexOf(item2);
21130
+ bringToFront(item, shouldPublish = true) {
21131
+ const index2 = this.itemsArray.indexOf(item);
21130
21132
  this.itemsArray.splice(index2, 1);
21131
- this.itemsArray.push(item2);
21133
+ this.itemsArray.push(item);
21132
21134
  if (shouldPublish) {
21133
21135
  this.subject.publish(this.items);
21134
21136
  }
21135
21137
  }
21136
21138
  bringManyToFront(items) {
21137
21139
  const newItems = [];
21138
- this.itemsArray.forEach((item2) => {
21139
- if (!items.includes(item2)) {
21140
- newItems.push(item2);
21140
+ this.itemsArray.forEach((item) => {
21141
+ if (!items.includes(item)) {
21142
+ newItems.push(item);
21141
21143
  }
21142
21144
  });
21143
21145
  newItems.push(...items);
@@ -21163,9 +21165,9 @@ class SimpleSpatialIndex {
21163
21165
  this.subject.publish(this.items);
21164
21166
  }
21165
21167
  getById(id) {
21166
- const item2 = this.itemsArray.find((item3) => item3.getId() === id);
21167
- if (item2) {
21168
- return item2;
21168
+ const item = this.itemsArray.find((item2) => item2.getId() === id);
21169
+ if (item) {
21170
+ return item;
21169
21171
  }
21170
21172
  }
21171
21173
  findById(id) {
@@ -21174,9 +21176,9 @@ class SimpleSpatialIndex {
21174
21176
  getEnclosed(left, top, right, bottom) {
21175
21177
  const mbr = new Mbr(left, top, right, bottom);
21176
21178
  const items = [];
21177
- this.itemsArray.forEach((item2) => {
21178
- if (item2.isEnclosedBy(mbr)) {
21179
- items.push(item2);
21179
+ this.itemsArray.forEach((item) => {
21180
+ if (item.isEnclosedBy(mbr)) {
21181
+ items.push(item);
21180
21182
  }
21181
21183
  });
21182
21184
  return items;
@@ -21184,18 +21186,18 @@ class SimpleSpatialIndex {
21184
21186
  getEnclosedOrCrossed(left, top, right, bottom) {
21185
21187
  const mbr = new Mbr(left, top, right, bottom);
21186
21188
  const items = [];
21187
- this.itemsArray.forEach((item2) => {
21188
- if (item2.isEnclosedOrCrossedBy(mbr)) {
21189
- items.push(item2);
21189
+ this.itemsArray.forEach((item) => {
21190
+ if (item.isEnclosedOrCrossedBy(mbr)) {
21191
+ items.push(item);
21190
21192
  }
21191
21193
  });
21192
21194
  return items;
21193
21195
  }
21194
21196
  getUnderPoint(point3, tolerace = 5) {
21195
21197
  const items = [];
21196
- this.itemsArray.forEach((item2) => {
21197
- if (item2.isUnderPoint(point3, tolerace)) {
21198
- items.push(item2);
21198
+ this.itemsArray.forEach((item) => {
21199
+ if (item.isUnderPoint(point3, tolerace)) {
21200
+ items.push(item);
21199
21201
  }
21200
21202
  });
21201
21203
  return items;
@@ -21206,8 +21208,8 @@ class SimpleSpatialIndex {
21206
21208
  list() {
21207
21209
  return this.itemsArray.concat();
21208
21210
  }
21209
- getZIndex(item2) {
21210
- return this.itemsArray.indexOf(item2);
21211
+ getZIndex(item) {
21212
+ return this.itemsArray.indexOf(item);
21211
21213
  }
21212
21214
  getLastZIndex() {
21213
21215
  return this.itemsArray.length - 1;
@@ -21221,8 +21223,8 @@ class SimpleSpatialIndex {
21221
21223
  }
21222
21224
  }
21223
21225
  render(context) {
21224
- this.itemsArray.forEach((item2) => {
21225
- item2.render(context);
21226
+ this.itemsArray.forEach((item) => {
21227
+ item.render(context);
21226
21228
  });
21227
21229
  }
21228
21230
  }
@@ -21273,7 +21275,7 @@ class BaseItem extends Mbr {
21273
21275
  if (!this.index) {
21274
21276
  return null;
21275
21277
  }
21276
- return this.index.items.listAll().map((item2) => item2.getId());
21278
+ return this.index.items.listAll().map((item) => item.getId());
21277
21279
  }
21278
21280
  addChildItems(children) {
21279
21281
  if (!this.index) {
@@ -21311,17 +21313,17 @@ class BaseItem extends Mbr {
21311
21313
  this.addChildItems(itemsToAdd);
21312
21314
  this.removeChildItems(itemsToRemove);
21313
21315
  }
21314
- handleNesting(item2, options) {
21315
- const isItem = "itemType" in item2;
21316
- const itemMbr = isItem ? item2.getMbr() : item2;
21317
- if (item2 instanceof BaseItem && !item2.canBeNested) {
21316
+ handleNesting(item, options) {
21317
+ const isItem = "itemType" in item;
21318
+ const itemMbr = isItem ? item.getMbr() : item;
21319
+ if (item instanceof BaseItem && !item.canBeNested) {
21318
21320
  return false;
21319
21321
  }
21320
- if (options?.cancelIfChild && isItem && item2.parent !== "Board") {
21322
+ if (options?.cancelIfChild && isItem && item.parent !== "Board") {
21321
21323
  return false;
21322
21324
  }
21323
21325
  const mbr = this.getMbr().copy();
21324
- if (item2.isEnclosedOrCrossedBy(mbr)) {
21326
+ if (item.isEnclosedOrCrossedBy(mbr)) {
21325
21327
  if (mbr.isInside(itemMbr.getCenter())) {
21326
21328
  if (!options || !options.onlyForOut) {
21327
21329
  return true;
@@ -23618,8 +23620,8 @@ function isChild(value) {
23618
23620
  if (!Array.isArray(value2))
23619
23621
  return true;
23620
23622
  const list2 = value2;
23621
- for (const item2 of list2) {
23622
- if (typeof item2 !== "number" && typeof item2 !== "string") {
23623
+ for (const item of list2) {
23624
+ if (typeof item !== "number" && typeof item !== "string") {
23623
23625
  return true;
23624
23626
  }
23625
23627
  }
@@ -23658,8 +23660,8 @@ function addProperty(schema, properties, key, value) {
23658
23660
  }
23659
23661
  if (Array.isArray(result)) {
23660
23662
  const finalResult = [];
23661
- for (const item2 of result) {
23662
- finalResult.push(parsePrimitive(info, info.property, item2));
23663
+ for (const item of result) {
23664
+ finalResult.push(parsePrimitive(info, info.property, item));
23663
23665
  }
23664
23666
  result = finalResult;
23665
23667
  }
@@ -34726,8 +34728,8 @@ function list5(node2, parent, state, info) {
34726
34728
  if (checkRule(state) === bullet && firstListItem) {
34727
34729
  let index2 = -1;
34728
34730
  while (++index2 < node2.children.length) {
34729
- const item2 = node2.children[index2];
34730
- if (item2 && item2.type === "listItem" && item2.children && item2.children[0] && item2.children[0].type === "thematicBreak") {
34731
+ const item = node2.children[index2];
34732
+ if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
34731
34733
  useDifferentMarker = true;
34732
34734
  break;
34733
34735
  }
@@ -35387,12 +35389,12 @@ async function convertMarkdownToSlate(text5) {
35387
35389
  ...nodes.filter((node2) => node2.type !== "list_item")
35388
35390
  ];
35389
35391
  }
35390
- return nodes.map((item2) => {
35392
+ return nodes.map((item) => {
35391
35393
  setNodeStyles({
35392
- node: item2,
35393
- isPaddingTopNeeded: item2.type !== "code_block"
35394
+ node: item,
35395
+ isPaddingTopNeeded: item.type !== "code_block"
35394
35396
  });
35395
- return item2;
35397
+ return item;
35396
35398
  });
35397
35399
  }
35398
35400
  function detectListType(text5) {
@@ -35805,17 +35807,17 @@ class FloatingPoint extends Point {
35805
35807
  relativePoint;
35806
35808
  pointType = "Floating";
35807
35809
  edge;
35808
- constructor(item2, relativePoint) {
35810
+ constructor(item, relativePoint) {
35809
35811
  super();
35810
- this.item = item2;
35812
+ this.item = item;
35811
35813
  this.relativePoint = relativePoint;
35812
35814
  if (relativePoint.y <= 0) {
35813
35815
  this.edge = "top";
35814
- } else if (relativePoint.y >= item2.getMbr().getHeight()) {
35816
+ } else if (relativePoint.y >= item.getMbr().getHeight()) {
35815
35817
  this.edge = "bottom";
35816
35818
  } else if (relativePoint.x <= 0) {
35817
35819
  this.edge = "left";
35818
- } else if (relativePoint.x >= item2.getMbr().getWidth()) {
35820
+ } else if (relativePoint.x >= item.getMbr().getWidth()) {
35819
35821
  this.edge = "right";
35820
35822
  }
35821
35823
  this.recalculatePoint();
@@ -35846,17 +35848,17 @@ class FixedPoint extends Point {
35846
35848
  relativePoint;
35847
35849
  pointType = "Fixed";
35848
35850
  edge;
35849
- constructor(item2, relativePoint) {
35851
+ constructor(item, relativePoint) {
35850
35852
  super();
35851
- this.item = item2;
35853
+ this.item = item;
35852
35854
  this.relativePoint = relativePoint;
35853
35855
  if (relativePoint.y <= 0) {
35854
35856
  this.edge = "top";
35855
- } else if (relativePoint.y >= item2.getMbr().getHeight()) {
35857
+ } else if (relativePoint.y >= item.getMbr().getHeight()) {
35856
35858
  this.edge = "bottom";
35857
35859
  } else if (relativePoint.x <= 0) {
35858
35860
  this.edge = "left";
35859
- } else if (relativePoint.x >= item2.getMbr().getWidth()) {
35861
+ } else if (relativePoint.x >= item.getMbr().getWidth()) {
35860
35862
  this.edge = "right";
35861
35863
  }
35862
35864
  this.recalculatePoint();
@@ -35887,16 +35889,16 @@ class FixedConnectorPoint extends Point {
35887
35889
  tangent;
35888
35890
  segmentIndex;
35889
35891
  pointType = "FixedConnector";
35890
- constructor(item2, tangent, segmentIndex) {
35892
+ constructor(item, tangent, segmentIndex) {
35891
35893
  super();
35892
- this.item = item2;
35894
+ this.item = item;
35893
35895
  this.tangent = tangent;
35894
35896
  this.segmentIndex = segmentIndex;
35895
35897
  this.recalculatePoint();
35896
35898
  }
35897
35899
  recalculatePoint() {
35898
- const item2 = this.item;
35899
- const segments = item2.getPaths().getSegments();
35900
+ const item = this.item;
35901
+ const segments = item.getPaths().getSegments();
35900
35902
  const segment = segments.length > this.segmentIndex ? segments[this.segmentIndex] : segments[segments.length - 1];
35901
35903
  const point5 = segment.getPoint(this.tangent);
35902
35904
  this.x = point5.x;
@@ -35921,38 +35923,38 @@ function getControlPoint(data, findItem2) {
35921
35923
  if (data.pointType === "Board") {
35922
35924
  return new BoardPoint(Math.round(data.x), Math.round(data.y));
35923
35925
  } else {
35924
- const item2 = findItem2(data.itemId);
35925
- if (!item2) {
35926
+ const item = findItem2(data.itemId);
35927
+ if (!item) {
35926
35928
  console.warn(`getControlPoint(): item not found for ${data.itemId}`);
35927
35929
  return new BoardPoint(0, 0);
35928
35930
  }
35929
35931
  switch (data.pointType) {
35930
35932
  case "FixedConnector":
35931
- if (item2 instanceof Connector2) {
35932
- return new FixedConnectorPoint(item2, data.tangent, data.segment);
35933
+ if (item instanceof Connector2) {
35934
+ return new FixedConnectorPoint(item, data.tangent, data.segment);
35933
35935
  } else {
35934
35936
  throw new Error(`getControlPoint(): item must be a connector`);
35935
35937
  }
35936
35938
  case "Floating":
35937
- return new FloatingPoint(item2, new Point(data.relativeX, data.relativeY));
35939
+ return new FloatingPoint(item, new Point(data.relativeX, data.relativeY));
35938
35940
  case "Fixed":
35939
- return new FixedPoint(item2, new Point(data.relativeX, data.relativeY));
35941
+ return new FixedPoint(item, new Point(data.relativeX, data.relativeY));
35940
35942
  }
35941
35943
  }
35942
35944
  }
35943
- function toRelativePoint(point5, item2) {
35944
- const matrix = item2.transformation?.matrix || new Matrix2;
35945
+ function toRelativePoint(point5, item) {
35946
+ const matrix = item.transformation?.matrix || new Matrix2;
35945
35947
  const inverse = matrix.getInverse();
35946
35948
  point5 = point5.copy();
35947
35949
  point5.transform(inverse);
35948
35950
  return point5;
35949
35951
  }
35950
- function fromRelativePoint(relativePoint, item2, edge) {
35951
- const matrix = item2.transformation?.matrix.copy() || new Matrix2;
35952
+ function fromRelativePoint(relativePoint, item, edge) {
35953
+ const matrix = item.transformation?.matrix.copy() || new Matrix2;
35952
35954
  const point5 = relativePoint.copy();
35953
35955
  point5.transform(matrix);
35954
- if (item2 instanceof RichText || item2 instanceof AINode) {
35955
- const itemMbr = item2.getMbr();
35956
+ if (item instanceof RichText || item instanceof AINode) {
35957
+ const itemMbr = item.getMbr();
35956
35958
  const { x: centerX, y: centerY } = itemMbr.getCenter();
35957
35959
  switch (edge) {
35958
35960
  case "left":
@@ -35964,7 +35966,7 @@ function fromRelativePoint(relativePoint, item2, edge) {
35964
35966
  case "bottom":
35965
35967
  return new Point(centerX, itemMbr.bottom);
35966
35968
  default:
35967
- return item2.getMbr().getClosestEdgeCenterPoint(point5);
35969
+ return item.getMbr().getClosestEdgeCenterPoint(point5);
35968
35970
  }
35969
35971
  }
35970
35972
  return point5;
@@ -37313,7 +37315,7 @@ class Connector2 extends BaseItem {
37313
37315
  return this;
37314
37316
  }
37315
37317
  getConnectorById(items, connectorId) {
37316
- return items.find((item2) => item2 instanceof Connector2 && item2.getId() === connectorId);
37318
+ return items.find((item) => item instanceof Connector2 && item.getId() === connectorId);
37317
37319
  }
37318
37320
  updateTitle() {
37319
37321
  const selection = this.board.selection;
@@ -39950,8 +39952,8 @@ async function exportBoardSnapshot({
39950
39952
  context.matrix.applyToContext(context.ctx);
39951
39953
  const { left, top, right, bottom } = selection;
39952
39954
  const inView = board.items.index.getRectsEnclosedOrCrossed(left, top, right, bottom);
39953
- for (const item2 of inView) {
39954
- item2.render(context);
39955
+ for (const item of inView) {
39956
+ item.render(context);
39955
39957
  }
39956
39958
  const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
39957
39959
  const dataUrl = await convertBlobToDataUrl(blob);
@@ -40149,7 +40151,7 @@ class Frame2 extends BaseItem {
40149
40151
  return this.id;
40150
40152
  }
40151
40153
  getChildrenIds() {
40152
- return this.index?.list().map((item2) => item2.getId()) || [];
40154
+ return this.index?.list().map((item) => item.getId()) || [];
40153
40155
  }
40154
40156
  updateMbr() {
40155
40157
  const rect = this.path.getMbr().copy();
@@ -40384,11 +40386,11 @@ class Frame2 extends BaseItem {
40384
40386
  }
40385
40387
  });
40386
40388
  const currMbr = this.getMbr();
40387
- this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item2) => {
40388
- if (item2.parent === "Board") {
40389
- if (this.handleNesting(item2)) {
40390
- this.applyAddChildren([item2.getId()]);
40391
- item2.parent = this.getId();
40389
+ this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
40390
+ if (item.parent === "Board") {
40391
+ if (this.handleNesting(item)) {
40392
+ this.applyAddChildren([item.getId()]);
40393
+ item.parent = this.getId();
40392
40394
  }
40393
40395
  }
40394
40396
  });
@@ -42586,9 +42588,9 @@ class Group extends BaseItem {
42586
42588
  if (data.children) {
42587
42589
  data.children.forEach((childId) => {
42588
42590
  this.applyAddChild(childId);
42589
- const item2 = this.board.items.getById(childId);
42590
- if (item2) {
42591
- item2.parent = this.getId();
42591
+ const item = this.board.items.getById(childId);
42592
+ if (item) {
42593
+ item.parent = this.getId();
42592
42594
  }
42593
42595
  });
42594
42596
  }
@@ -42618,11 +42620,11 @@ class Group extends BaseItem {
42618
42620
  let right = Number.MIN_SAFE_INTEGER;
42619
42621
  let bottom = Number.MIN_SAFE_INTEGER;
42620
42622
  const mbrs = this.children.flatMap((childId) => {
42621
- const item2 = this.board.items.getById(childId);
42622
- if (!item2) {
42623
+ const item = this.board.items.getById(childId);
42624
+ if (!item) {
42623
42625
  return [];
42624
42626
  }
42625
- const mbr2 = item2.getMbr();
42627
+ const mbr2 = item.getMbr();
42626
42628
  if (!mbr2) {
42627
42629
  return [];
42628
42630
  }
@@ -42657,7 +42659,7 @@ class Group extends BaseItem {
42657
42659
  return this.children;
42658
42660
  }
42659
42661
  getChildren() {
42660
- return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item2) => item2 !== undefined);
42662
+ return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item) => item !== undefined);
42661
42663
  }
42662
42664
  updateMbr() {
42663
42665
  const rect = this.getMbr();
@@ -42670,9 +42672,9 @@ class Group extends BaseItem {
42670
42672
  setChildren(items) {
42671
42673
  items.forEach((itemId) => {
42672
42674
  this.addChild(itemId);
42673
- const item2 = this.board.items.getById(itemId);
42674
- if (item2) {
42675
- item2.parent = this.getId();
42675
+ const item = this.board.items.getById(itemId);
42676
+ if (item) {
42677
+ item.parent = this.getId();
42676
42678
  }
42677
42679
  });
42678
42680
  this.updateMbr();
@@ -42680,9 +42682,9 @@ class Group extends BaseItem {
42680
42682
  removeChildren() {
42681
42683
  this.children.forEach((itemId) => {
42682
42684
  this.removeChild(itemId);
42683
- const item2 = this.board.items.getById(itemId);
42684
- if (item2) {
42685
- item2.parent = this.parent;
42685
+ const item = this.board.items.getById(itemId);
42686
+ if (item) {
42687
+ item.parent = this.parent;
42686
42688
  }
42687
42689
  });
42688
42690
  this.updateMbr();
@@ -43015,16 +43017,16 @@ class Anchor extends Mbr {
43015
43017
  }
43016
43018
  }
43017
43019
  // src/Items/Connector/ConnectorSnap.ts
43018
- function getFixedPoint(item2, point5) {
43019
- if (item2 instanceof Connector2) {
43020
- const nearestSegmentData = item2.getPaths().getNearestEdgeAndPointTo(point5);
43020
+ function getFixedPoint(item, point5) {
43021
+ if (item instanceof Connector2) {
43022
+ const nearestSegmentData = item.getPaths().getNearestEdgeAndPointTo(point5);
43021
43023
  const segment = nearestSegmentData.segment;
43022
43024
  const index2 = nearestSegmentData.index;
43023
43025
  const tangent = segment.getParameter(point5);
43024
- return new FixedConnectorPoint(item2, tangent, index2);
43026
+ return new FixedConnectorPoint(item, tangent, index2);
43025
43027
  } else {
43026
- const relativePoint = toRelativePoint(point5, item2);
43027
- return new FixedPoint(item2, relativePoint);
43028
+ const relativePoint = toRelativePoint(point5, item);
43029
+ return new FixedPoint(item, relativePoint);
43028
43030
  }
43029
43031
  }
43030
43032
 
@@ -43077,20 +43079,20 @@ class ConnectorSnap {
43077
43079
  }
43078
43080
  this.setSnap();
43079
43081
  const pointer = this.board.pointer.point;
43080
- const { anchor, item: item2, point: point5 } = this.snap;
43081
- if (!item2) {
43082
+ const { anchor, item, point: point5 } = this.snap;
43083
+ if (!item) {
43082
43084
  const pointer2 = this.board.pointer.point;
43083
43085
  this.controlPoint = new BoardPoint(pointer2.x, pointer2.y);
43084
43086
  } else if (anchor) {
43085
- this.controlPoint = getFixedPoint(item2, anchor.getCenter());
43087
+ this.controlPoint = getFixedPoint(item, anchor.getCenter());
43086
43088
  } else if (point5) {
43087
- const nearest2 = item2.getNearestEdgePointTo(pointer);
43088
- this.controlPoint = getFixedPoint(item2, nearest2);
43089
+ const nearest2 = item.getNearestEdgePointTo(pointer);
43090
+ this.controlPoint = getFixedPoint(item, nearest2);
43089
43091
  } else {
43090
43092
  if (this.hover.isTimeoutElapsed) {
43091
- this.controlPoint = getFixedPoint(item2, pointer);
43093
+ this.controlPoint = getFixedPoint(item, pointer);
43092
43094
  } else {
43093
- this.controlPoint = getFixedPoint(item2, pointer);
43095
+ this.controlPoint = getFixedPoint(item, pointer);
43094
43096
  }
43095
43097
  }
43096
43098
  }
@@ -43151,23 +43153,23 @@ class ConnectorSnap {
43151
43153
  }
43152
43154
  return nearest;
43153
43155
  }
43154
- getClosestPointOnItem(item2, position4) {
43155
- const nearestEdgePoint = item2.getNearestEdgePointTo(position4);
43156
- return getFixedPoint(item2, nearestEdgePoint);
43156
+ getClosestPointOnItem(item, position4) {
43157
+ const nearestEdgePoint = item.getNearestEdgePointTo(position4);
43158
+ return getFixedPoint(item, nearestEdgePoint);
43157
43159
  }
43158
- isNearBorder(item2) {
43159
- if (!item2) {
43160
+ isNearBorder(item) {
43161
+ if (!item) {
43160
43162
  return false;
43161
43163
  }
43162
43164
  const pointer = this.board.pointer.point;
43163
- const point5 = item2.getNearestEdgePointTo(pointer);
43165
+ const point5 = item.getNearestEdgePointTo(pointer);
43164
43166
  const distance = pointer.getDistance(point5);
43165
43167
  return distance < this.distance.border / this.board.camera.getScale();
43166
43168
  }
43167
43169
  setSnap() {
43168
- const item2 = this.snap.item;
43169
- const path2 = item2 && "getPath" in item2 ? item2?.getPath() : null;
43170
- if (!item2 || !path2) {
43170
+ const item = this.snap.item;
43171
+ const path2 = item && "getPath" in item ? item?.getPath() : null;
43172
+ if (!item || !path2) {
43171
43173
  this.snap.path = null;
43172
43174
  this.snap.anchors = [];
43173
43175
  this.snap.anchor = null;
@@ -43178,11 +43180,11 @@ class ConnectorSnap {
43178
43180
  if (this.snap.item === this.hover.item && !this.hover.isTimeoutElapsed) {
43179
43181
  path2.setBackgroundColor(this.color.snapBackgroundHighlight);
43180
43182
  }
43181
- this.setAnchors(item2);
43183
+ this.setAnchors(item);
43182
43184
  }
43183
43185
  }
43184
- setAnchors(item2) {
43185
- const points = item2.getSnapAnchorPoints();
43186
+ setAnchors(item) {
43187
+ const points = item.getSnapAnchorPoints();
43186
43188
  if (!points) {
43187
43189
  return;
43188
43190
  }
@@ -43216,10 +43218,10 @@ class ConnectorSnap {
43216
43218
  }
43217
43219
  setPoint() {
43218
43220
  const pointer = this.board.pointer.point;
43219
- const { item: item2, anchor } = this.snap;
43220
- if (item2) {
43221
+ const { item, anchor } = this.snap;
43222
+ if (item) {
43221
43223
  if (!anchor) {
43222
- const point5 = item2.getNearestEdgePointTo(pointer);
43224
+ const point5 = item.getNearestEdgePointTo(pointer);
43223
43225
  if (point5.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
43224
43226
  this.snap.point = new Anchor(point5.x, point5.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
43225
43227
  } else {
@@ -43592,12 +43594,12 @@ class NestingHighlighter extends Tool {
43592
43594
  this.toHighlight.push({ groupItem, children: array });
43593
43595
  }
43594
43596
  }
43595
- addSingleItem(item2) {
43596
- this.toHighlight.push({ children: [item2] });
43597
+ addSingleItem(item) {
43598
+ this.toHighlight.push({ children: [item] });
43597
43599
  }
43598
- remove(item2) {
43600
+ remove(item) {
43599
43601
  this.toHighlight.forEach((group) => {
43600
- group.children = group.children.filter((child) => child !== item2);
43602
+ group.children = group.children.filter((child) => child !== item);
43601
43603
  });
43602
43604
  this.toHighlight = this.toHighlight.filter((group) => group.children.length > 0);
43603
43605
  }
@@ -43664,7 +43666,7 @@ class AddFrame extends BoardTool {
43664
43666
  this.mbr.borderColor = "blue";
43665
43667
  this.nestingHighlighter.clear();
43666
43668
  const enclosedOrCrossed = this.board.items.getEnclosedOrCrossed(this.mbr.left, this.mbr.top, this.mbr.right, this.mbr.bottom);
43667
- const inside = enclosedOrCrossed.filter((item2) => !(item2 instanceof Frame2) && item2.parent === "Board" && this.mbr.isInside(item2.getMbr().getCenter()));
43669
+ const inside = enclosedOrCrossed.filter((item) => !(item instanceof Frame2) && item.parent === "Board" && this.mbr.isInside(item.getMbr().getCenter()));
43668
43670
  this.nestingHighlighter.add(this.frame, inside);
43669
43671
  this.initTransformation();
43670
43672
  this.board.tools.publish();
@@ -43685,7 +43687,7 @@ class AddFrame extends BoardTool {
43685
43687
  localStorage.setItem("lastFrameScale", JSON.stringify(this.frame.transformation.getScale()));
43686
43688
  }
43687
43689
  const currMbr = this.frame.getMbr();
43688
- 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));
43690
+ 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));
43689
43691
  this.applyAddChildren(frameChildren);
43690
43692
  if (this.shape !== "Custom") {
43691
43693
  this.applyCanChangeRatio(false);
@@ -43701,7 +43703,7 @@ class AddFrame extends BoardTool {
43701
43703
  return true;
43702
43704
  }
43703
43705
  addNextTo() {
43704
- const framesInView = this.board.items.getItemsInView().filter((item2) => item2 instanceof Frame2);
43706
+ const framesInView = this.board.items.getItemsInView().filter((item) => item instanceof Frame2);
43705
43707
  if (framesInView.length === 0) {
43706
43708
  if (this.shape === "Custom") {
43707
43709
  const { x, y } = this.frame.getLastFrameScale();
@@ -43739,7 +43741,7 @@ class AddFrame extends BoardTool {
43739
43741
  this.board.camera.viewRectangle(this.frame.getMbr());
43740
43742
  }
43741
43743
  const frameMbr = this.frame.getMbr();
43742
- 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]));
43744
+ 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]));
43743
43745
  const frame = this.board.add(this.frame);
43744
43746
  frame.text.editor.moveCursorToEndOfTheText();
43745
43747
  this.nestingHighlighter.clear();
@@ -44244,13 +44246,13 @@ class Eraser extends BoardTool {
44244
44246
  }
44245
44247
  removeUnderPointOrLine() {
44246
44248
  const segments = this.drawing.getLines();
44247
- const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item2) => {
44248
- return item2.itemType === "Drawing" && item2.getLines().find((line) => {
44249
- return line.getDistance(this.board.pointer.point) <= item2.strokeWidth / 2 + this.strokeWidth / 2;
44249
+ const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item) => {
44250
+ return item.itemType === "Drawing" && item.getLines().find((line) => {
44251
+ return line.getDistance(this.board.pointer.point) <= item.strokeWidth / 2 + this.strokeWidth / 2;
44250
44252
  });
44251
44253
  });
44252
- 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) => {
44253
- return item2.itemType === "Drawing" && item2.getLines().some((line) => {
44254
+ 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) => {
44255
+ return item.itemType === "Drawing" && item.getLines().some((line) => {
44254
44256
  return segments.some((segment) => segment.hasIntersectionPoint(line));
44255
44257
  });
44256
44258
  }));
@@ -44702,20 +44704,20 @@ function createCanvasDrawer(board) {
44702
44704
  context.ctx.setTransform(board2.camera.getMatrix().scaleX, 0, 0, board2.camera.getMatrix().scaleY, 0, 0);
44703
44705
  context.matrix.applyToContext(context.ctx);
44704
44706
  const items = Object.keys(translation).map((id) => {
44705
- const item2 = board2.items.getById(id);
44706
- if (item2) {
44707
- if (item2.itemType !== "Frame") {
44708
- return item2;
44707
+ const item = board2.items.getById(id);
44708
+ if (item) {
44709
+ if (item.itemType !== "Frame") {
44710
+ return item;
44709
44711
  }
44710
- item2.render(context);
44711
- return item2;
44712
+ item.render(context);
44713
+ return item;
44712
44714
  }
44713
44715
  return;
44714
- }).filter((item2) => !!item2);
44715
- items.forEach((item2) => {
44716
- if (item2.itemType !== "Frame") {
44717
- item2.render(context);
44718
- board2.selection.renderItemMbr(context, item2, board2.camera.getMatrix().scaleX);
44716
+ }).filter((item) => !!item);
44717
+ items.forEach((item) => {
44718
+ if (item.itemType !== "Frame") {
44719
+ item.render(context);
44720
+ board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
44719
44721
  }
44720
44722
  });
44721
44723
  return { canvas: container, items };
@@ -44776,10 +44778,10 @@ function createCanvasDrawer(board) {
44776
44778
  if (lastTranslationKeys) {
44777
44779
  board.selection.shouldPublish = false;
44778
44780
  lastTranslationKeys.forEach((id) => {
44779
- const item2 = board.items.getById(id);
44780
- if (item2) {
44781
- item2.transformationRenderBlock = undefined;
44782
- item2.subject.publish(item2);
44781
+ const item = board.items.getById(id);
44782
+ if (item) {
44783
+ item.transformationRenderBlock = undefined;
44784
+ item.subject.publish(item);
44783
44785
  }
44784
44786
  });
44785
44787
  lastTranslationKeys = undefined;
@@ -44811,9 +44813,9 @@ function createCanvasDrawer(board) {
44811
44813
  lastCreatedCanvas = cnvs;
44812
44814
  lastTranslationKeys = Object.keys(translation);
44813
44815
  lastTranslationKeys.forEach((id) => {
44814
- const item2 = board.items.getById(id);
44815
- if (item2) {
44816
- item2.transformationRenderBlock = true;
44816
+ const item = board.items.getById(id);
44817
+ if (item) {
44818
+ item.transformationRenderBlock = true;
44817
44819
  }
44818
44820
  });
44819
44821
  board.selection.transformationRenderBlock = true;
@@ -44823,14 +44825,14 @@ function createCanvasDrawer(board) {
44823
44825
  }
44824
44826
  function countSumMbr(translation) {
44825
44827
  return Object.keys(translation).reduce((mbr, id) => {
44826
- const item2 = board.items.getById(id);
44827
- if (item2) {
44828
+ const item = board.items.getById(id);
44829
+ if (item) {
44828
44830
  if (!mbr) {
44829
- mbr = item2.getMbr();
44831
+ mbr = item.getMbr();
44830
44832
  } else {
44831
- mbr.combine(item2.getMbr());
44832
- if (item2.itemType === "Frame") {
44833
- mbr.combine(item2.getRichText().getMbr());
44833
+ mbr.combine(item.getMbr());
44834
+ if (item.itemType === "Frame") {
44835
+ mbr.combine(item.getRichText().getMbr());
44834
44836
  }
44835
44837
  }
44836
44838
  }
@@ -44861,8 +44863,8 @@ function createCanvasDrawer(board) {
44861
44863
  }
44862
44864
  function highlightNesting() {
44863
44865
  const container = getLastCreatedCanvas();
44864
- const drawnItemsMap = drawnItems?.reduce((acc, item2) => {
44865
- acc.set(item2.getId(), { item: item2, mbr: item2.getMbr() });
44866
+ const drawnItemsMap = drawnItems?.reduce((acc, item) => {
44867
+ acc.set(item.getId(), { item, mbr: item.getMbr() });
44866
44868
  return acc;
44867
44869
  }, new Map);
44868
44870
  if (!container || !drawnItems) {
@@ -44897,11 +44899,11 @@ function createCanvasDrawer(board) {
44897
44899
  mbr.transform(currMatrix);
44898
44900
  });
44899
44901
  groups.forEach((group) => {
44900
- drawnItemsMap?.forEach(({ mbr, item: item2 }, key) => {
44901
- if ("canBeNested" in item2 && !item2.canBeNested) {
44902
+ drawnItemsMap?.forEach(({ mbr, item }, key) => {
44903
+ if ("canBeNested" in item && !item.canBeNested) {
44902
44904
  return;
44903
44905
  }
44904
- if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item2.parent !== group.getId()) && group.handleNesting(mbr)) {
44906
+ if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item.parent !== group.getId()) && group.handleNesting(mbr)) {
44905
44907
  const div = createBorderDivForItem(mbr, lastCreatedCanvas);
44906
44908
  removeHighlighted(key);
44907
44909
  highlightedDivs.set(key, div);
@@ -44962,10 +44964,10 @@ function createCanvasDrawer(board) {
44962
44964
  }
44963
44965
 
44964
44966
  // src/Selection/QuickAddButtons/quickAddHelpers.ts
44965
- function getControlPointData(item2, index2, isRichText = false) {
44966
- const itemScale = isRichText ? { x: 1, y: 1 } : item2.transformation.getScale();
44967
- const width2 = item2.getPathMbr().getWidth();
44968
- let height3 = item2.getPathMbr().getHeight();
44967
+ function getControlPointData(item, index2, isRichText = false) {
44968
+ const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
44969
+ const width2 = item.getPathMbr().getWidth();
44970
+ let height3 = item.getPathMbr().getHeight();
44969
44971
  const adjMapScaled = {
44970
44972
  0: { x: 0, y: height3 / 2 / itemScale.y },
44971
44973
  1: {
@@ -44980,7 +44982,7 @@ function getControlPointData(item2, index2, isRichText = false) {
44980
44982
  };
44981
44983
  return {
44982
44984
  pointType: "Fixed",
44983
- itemId: item2.getId(),
44985
+ itemId: item.getId(),
44984
44986
  relativeX: adjMapScaled[index2].x,
44985
44987
  relativeY: adjMapScaled[index2].y
44986
44988
  };
@@ -45115,10 +45117,10 @@ function getQuickAddButtons(selection, board) {
45115
45117
  let newHeight = height3;
45116
45118
  let itemData;
45117
45119
  if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
45118
- const item2 = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
45119
- newWidth = item2.getMbr().getWidth();
45120
- newHeight = item2.getMbr().getHeight();
45121
- itemData = item2.serialize();
45120
+ const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
45121
+ newWidth = item.getMbr().getWidth();
45122
+ newHeight = item.getMbr().getHeight();
45123
+ itemData = item.serialize();
45122
45124
  const { minX, minY, maxY, maxX } = offsets;
45123
45125
  offsetX = Math.min(offsetX, maxX);
45124
45126
  offsetX = Math.max(offsetX, minX);
@@ -45151,7 +45153,7 @@ function getQuickAddButtons(selection, board) {
45151
45153
  }
45152
45154
  const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
45153
45155
  let step = 1;
45154
- while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item2) => item2.itemType !== "Connector").length > 0) {
45156
+ while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item) => item.itemType !== "Connector").length > 0) {
45155
45157
  const xDirection = step % 2 === 0 ? -1 : 1;
45156
45158
  const yDirection = newItemData.itemType === "AINode" ? -1 : xDirection;
45157
45159
  newMbr.transform(new Matrix2(iterAdjustment[index2].x * xDirection * step, iterAdjustment[index2].y * yDirection * (newItemData.itemType === "AINode" ? 1 : step)));
@@ -45284,7 +45286,7 @@ function getQuickAddButtons(selection, board) {
45284
45286
  clear();
45285
45287
  return;
45286
45288
  }
45287
- const { positions, item: item2 } = position4;
45289
+ const { positions, item } = position4;
45288
45290
  const cameraMatrix = board.camera.getMatrix();
45289
45291
  const cameraMbr = board.camera.getMbr();
45290
45292
  const positionAdjustments = {
@@ -45312,7 +45314,7 @@ function getQuickAddButtons(selection, board) {
45312
45314
  };
45313
45315
  const button = document.createElement("button");
45314
45316
  button.classList.add("microboard-quickAddButton");
45315
- if (item2.itemType === "AINode" && index2 === 2) {
45317
+ if (item.itemType === "AINode" && index2 === 2) {
45316
45318
  button.classList.add("microboard-invisible");
45317
45319
  }
45318
45320
  button.classList.add(`microboard-${adjustment.rotate}`);
@@ -45328,7 +45330,7 @@ function getQuickAddButtons(selection, board) {
45328
45330
  clearTimeout(timeoutId);
45329
45331
  }
45330
45332
  if (button.isMouseDown) {
45331
- board.tools.addConnector(true, item2, pos);
45333
+ board.tools.addConnector(true, item, pos);
45332
45334
  } else {
45333
45335
  quickAddItems = undefined;
45334
45336
  selection.subject.publish(selection);
@@ -45435,11 +45437,11 @@ class AlignmentHelper {
45435
45437
  return baseThickness / (zoom / 100);
45436
45438
  }
45437
45439
  combineMBRs(items) {
45438
- return items.reduce((acc, item2, i) => {
45440
+ return items.reduce((acc, item, i) => {
45439
45441
  if (i === 0) {
45440
45442
  return acc;
45441
45443
  }
45442
- const itemMbr = item2.getPathMbr();
45444
+ const itemMbr = item.getPathMbr();
45443
45445
  return acc.combine(itemMbr);
45444
45446
  }, items[0].getMbr());
45445
45447
  }
@@ -45453,7 +45455,7 @@ class AlignmentHelper {
45453
45455
  const scale = this.board.camera.getScale();
45454
45456
  const dynamicAlignThreshold = Math.min(this.alignThreshold / scale, 8);
45455
45457
  const childrenIds = "index" in movingItem && movingItem.index ? movingItem.getChildrenIds() : [];
45456
- 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);
45458
+ 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);
45457
45459
  const verticalAlignments = new Map;
45458
45460
  const horizontalAlignments = new Map;
45459
45461
  const addVerticalAlignment = (x, minY, maxY) => {
@@ -45474,11 +45476,11 @@ class AlignmentHelper {
45474
45476
  horizontalAlignments.set(y, { minX, maxX });
45475
45477
  }
45476
45478
  };
45477
- nearbyItems.forEach((item2) => {
45478
- if (item2 === movingItem || item2.itemType === "Comment") {
45479
+ nearbyItems.forEach((item) => {
45480
+ if (item === movingItem || item.itemType === "Comment") {
45479
45481
  return;
45480
45482
  }
45481
- const itemMbr = item2.itemType === "Shape" ? item2.getPath().getMbr() : item2.getMbr();
45483
+ const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
45482
45484
  const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
45483
45485
  const centerXItem = (itemMbr.left + itemMbr.right) / 2;
45484
45486
  const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
@@ -45745,20 +45747,20 @@ class AlignmentHelper {
45745
45747
  }
45746
45748
  return false;
45747
45749
  }
45748
- translateItems(item2, x, y, timeStamp) {
45750
+ translateItems(item, x, y, timeStamp) {
45749
45751
  if (this.canvasDrawer.getLastCreatedCanvas()) {
45750
45752
  return;
45751
45753
  }
45752
- if (Array.isArray(item2)) {
45754
+ if (Array.isArray(item)) {
45753
45755
  const translation = this.board.selection.getManyItemsTranslation(x, y);
45754
45756
  this.board.selection.transformMany(translation, timeStamp);
45755
45757
  return;
45756
45758
  }
45757
- if (item2.itemType === "Frame") {
45759
+ if (item.itemType === "Frame") {
45758
45760
  const translation = this.board.selection.getManyItemsTranslation(x, y);
45759
45761
  this.board.selection.transformMany(translation, timeStamp);
45760
45762
  } else {
45761
- const id = item2.getId();
45763
+ const id = item.getId();
45762
45764
  const transformMap = {};
45763
45765
  transformMap[id] = {
45764
45766
  class: "Transformation",
@@ -45886,12 +45888,12 @@ class Select extends Tool {
45886
45888
  this.debounceUpd.setFalse();
45887
45889
  this.snapLines = { verticalLines: [], horizontalLines: [] };
45888
45890
  }
45889
- handleSnapping(item2) {
45891
+ handleSnapping(item) {
45890
45892
  if (this.board.keyboard.isShift) {
45891
45893
  return false;
45892
45894
  }
45893
- const increasedSnapThreshold = Array.isArray(item2) ? 40 : 35;
45894
- this.isSnapped = this.alignmentHelper.snapToClosestLine(item2, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
45895
+ const increasedSnapThreshold = Array.isArray(item) ? 40 : 35;
45896
+ this.isSnapped = this.alignmentHelper.snapToClosestLine(item, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
45895
45897
  if (this.isSnapped) {
45896
45898
  if (!this.snapCursorPos) {
45897
45899
  this.snapCursorPos = new Point(this.board.pointer.point.x, this.board.pointer.point.y);
@@ -45901,10 +45903,10 @@ class Select extends Tool {
45901
45903
  if ((cursorDiffX > increasedSnapThreshold || cursorDiffY > increasedSnapThreshold) && this.initialCursorPos) {
45902
45904
  this.isSnapped = false;
45903
45905
  this.snapCursorPos = null;
45904
- const itemCenter = Array.isArray(item2) ? this.alignmentHelper.combineMBRs(item2).getCenter() : item2.getMbr().getCenter();
45906
+ const itemCenter = Array.isArray(item) ? this.alignmentHelper.combineMBRs(item).getCenter() : item.getMbr().getCenter();
45905
45907
  const translateX = this.board.pointer.point.x - this.initialCursorPos.x - itemCenter.x;
45906
45908
  const translateY = this.board.pointer.point.y - this.initialCursorPos.y - itemCenter.y;
45907
- this.alignmentHelper.translateItems(item2, translateX, translateY, this.beginTimeStamp);
45909
+ this.alignmentHelper.translateItems(item, translateX, translateY, this.beginTimeStamp);
45908
45910
  }
45909
45911
  }
45910
45912
  return false;
@@ -45954,10 +45956,10 @@ class Select extends Tool {
45954
45956
  angleDiff = angleDiff < 0 ? angleDiff + 360 : angleDiff;
45955
45957
  return Math.min(angleDiff, 360 - angleDiff);
45956
45958
  }
45957
- handleShiftGuidelines(item2, mousePosition) {
45958
- if (item2) {
45959
+ handleShiftGuidelines(item, mousePosition) {
45960
+ if (item) {
45959
45961
  if (!this.originalCenter) {
45960
- this.originalCenter = Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().copy() : item2.getMbr().getCenter().copy();
45962
+ this.originalCenter = Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().copy() : item.getMbr().getCenter().copy();
45961
45963
  this.guidelines = this.alignmentHelper.generateGuidelines(this.originalCenter).lines;
45962
45964
  }
45963
45965
  this.mainLine = new Line(this.originalCenter, mousePosition);
@@ -45978,13 +45980,13 @@ class Select extends Tool {
45978
45980
  const newEndX = this.originalCenter.x + snapDirectionX * mainLineLength;
45979
45981
  const newEndY = this.originalCenter.y + snapDirectionY * mainLineLength;
45980
45982
  const threshold = Infinity;
45981
- const translateX = newEndX - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().x : item2.getMbr().getCenter().x);
45982
- const translateY = newEndY - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().y : item2.getMbr().getCenter().y);
45983
- if (Array.isArray(item2)) {
45983
+ const translateX = newEndX - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().x : item.getMbr().getCenter().x);
45984
+ const translateY = newEndY - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().y : item.getMbr().getCenter().y);
45985
+ if (Array.isArray(item)) {
45984
45986
  const translation = this.board.selection.getManyItemsTranslation(translateX, translateY);
45985
45987
  this.board.selection.transformMany(translation, this.beginTimeStamp);
45986
45988
  } else {
45987
- item2.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
45989
+ item.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
45988
45990
  }
45989
45991
  }
45990
45992
  }
@@ -46027,7 +46029,7 @@ class Select extends Tool {
46027
46029
  return false;
46028
46030
  }
46029
46031
  this.isDownOnBoard = hover.length === 0;
46030
- this.isDrawingRectangle = hover.filter((item2) => !(item2 instanceof Frame2)).length === 0 && hover.filter((item2) => item2 instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
46032
+ this.isDrawingRectangle = hover.filter((item) => !(item instanceof Frame2)).length === 0 && hover.filter((item) => item instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
46031
46033
  if (this.isDrawingRectangle) {
46032
46034
  const { x, y } = pointer.point;
46033
46035
  this.line = new Line(new Point(x, y), new Point(x, y));
@@ -46047,7 +46049,7 @@ class Select extends Tool {
46047
46049
  });
46048
46050
  return false;
46049
46051
  }
46050
- const isHoverLocked = hover.every((item2) => item2.transformation.isLocked);
46052
+ const isHoverLocked = hover.every((item) => item.transformation.isLocked);
46051
46053
  if (isHoverLocked) {
46052
46054
  return false;
46053
46055
  }
@@ -46181,7 +46183,7 @@ class Select extends Tool {
46181
46183
  const translation = selection.getManyItemsTranslation(x, y);
46182
46184
  const translationKeys = Object.keys(translation);
46183
46185
  const commentsSet = new Set(this.board.items.getComments().map((comment2) => comment2.getId()));
46184
- if (translationKeys.filter((item2) => !commentsSet.has(item2)).length > 10) {
46186
+ if (translationKeys.filter((item) => !commentsSet.has(item)).length > 10) {
46185
46187
  const selectedMbr = this.board.selection.getMbr()?.copy();
46186
46188
  const sumMbr = this.canvasDrawer.countSumMbr(translation);
46187
46189
  if (sumMbr) {
@@ -46208,7 +46210,7 @@ class Select extends Tool {
46208
46210
  return false;
46209
46211
  }
46210
46212
  const draggingMbr = draggingItem.getMbr();
46211
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item2) => item2 instanceof Frame2);
46213
+ const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
46212
46214
  frames.forEach((frame) => {
46213
46215
  if (frame.handleNesting(draggingItem)) {
46214
46216
  this.nestingHighlighter.add(frame, draggingItem);
@@ -46218,7 +46220,7 @@ class Select extends Tool {
46218
46220
  });
46219
46221
  }
46220
46222
  const hover = items.getUnderPointer();
46221
- this.isHoverUnselectedItem = hover.filter((item2) => item2.itemType === "Placeholder").length === 1;
46223
+ this.isHoverUnselectedItem = hover.filter((item) => item.itemType === "Placeholder").length === 1;
46222
46224
  if (this.isHoverUnselectedItem && !this.isDraggingUnselectedItem && selection.getContext() === "None") {
46223
46225
  selection.setContext("HoverUnderPointer");
46224
46226
  return false;
@@ -46262,15 +46264,15 @@ class Select extends Tool {
46262
46264
  }
46263
46265
  }
46264
46266
  updateFramesNesting(selectionMbr, selection) {
46265
- 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));
46266
- const draggingFramesIds = selection.list().filter((item2) => item2 instanceof Frame2).map((frame) => frame.getId());
46267
- selection.list().forEach((item2) => {
46268
- if (!(item2 instanceof Frame2) && !draggingFramesIds.includes(item2.parent)) {
46267
+ 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));
46268
+ const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
46269
+ selection.list().forEach((item) => {
46270
+ if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
46269
46271
  frames.forEach((frame) => {
46270
- if (frame.handleNesting(item2)) {
46271
- this.nestingHighlighter.add(frame, item2);
46272
+ if (frame.handleNesting(item)) {
46273
+ this.nestingHighlighter.add(frame, item);
46272
46274
  } else {
46273
- this.nestingHighlighter.remove(item2);
46275
+ this.nestingHighlighter.remove(item);
46274
46276
  }
46275
46277
  });
46276
46278
  }
@@ -46362,7 +46364,7 @@ class Select extends Tool {
46362
46364
  const childrenIds = underPointer.getChildrenIds();
46363
46365
  console.log("UNDERPOINTER", underPointer);
46364
46366
  console.log("CHILDREN", childrenIds);
46365
- const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => childrenIds && childrenIds.includes(item2.getId()));
46367
+ const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => childrenIds && childrenIds.includes(item.getId()));
46366
46368
  this.board.selection.add(itemsInFrame);
46367
46369
  }
46368
46370
  this.board.selection.setContext("EditUnderPointer");
@@ -46602,8 +46604,8 @@ class ShapeTool extends CustomTool {
46602
46604
  resizeType = "leftBottom";
46603
46605
  bounds = new Mbr;
46604
46606
  isDown = false;
46605
- constructor(board, name, item2, settings) {
46606
- super(board, name, item2);
46607
+ constructor(board, name, item, settings) {
46608
+ super(board, name, item);
46607
46609
  this.settings = settings;
46608
46610
  this.setCursor();
46609
46611
  }
@@ -46686,8 +46688,8 @@ class ShapeTool extends CustomTool {
46686
46688
 
46687
46689
  class StickerTool extends CustomTool {
46688
46690
  settings;
46689
- constructor(board, name, item2, settings) {
46690
- super(board, name, item2);
46691
+ constructor(board, name, item, settings) {
46692
+ super(board, name, item);
46691
46693
  this.settings = settings;
46692
46694
  this.setCursor();
46693
46695
  }
@@ -46993,7 +46995,7 @@ class Tools extends ToolContext {
46993
46995
  this.subject.publish(this);
46994
46996
  }
46995
46997
  sortFrames() {
46996
- const frames = this.board.items.listAll().filter((item2) => item2 instanceof Frame2);
46998
+ const frames = this.board.items.listAll().filter((item) => item instanceof Frame2);
46997
46999
  const sortedFrames = frames.sort((fr1, fr2) => {
46998
47000
  const mbr1 = fr1.getMbr();
46999
47001
  const mbr2 = fr2.getMbr();
@@ -47219,24 +47221,24 @@ function validateGroupData(groupData) {
47219
47221
  }
47220
47222
  // src/Items/RegisterItem.ts
47221
47223
  function registerItem({
47222
- item: item2,
47224
+ item,
47223
47225
  defaultData: defaultData2,
47224
47226
  toolData
47225
47227
  }) {
47226
47228
  const { itemType } = defaultData2;
47227
- itemFactories[itemType] = createItemFactory(item2, defaultData2);
47229
+ itemFactories[itemType] = createItemFactory(item, defaultData2);
47228
47230
  itemValidators[itemType] = createItemValidator(defaultData2);
47229
47231
  if (toolData) {
47230
47232
  registeredTools[toolData.name] = toolData.tool;
47231
47233
  }
47232
47234
  itemCommandFactories[itemType] = createItemCommandFactory(itemType);
47233
47235
  }
47234
- function createItemFactory(item2, defaultData2) {
47236
+ function createItemFactory(item, defaultData2) {
47235
47237
  return function itemFactory(id, data, board) {
47236
47238
  if (data.itemType !== defaultData2.itemType) {
47237
47239
  throw new Error(`Invalid data for ${defaultData2.itemType}`);
47238
47240
  }
47239
- return new item2(board, id, defaultData2).setId(id).deserialize(data);
47241
+ return new item(board, id, defaultData2).setId(id).deserialize(data);
47240
47242
  };
47241
47243
  }
47242
47244
  function createItemValidator(defaultData2) {
@@ -47251,7 +47253,7 @@ function createItemValidator(defaultData2) {
47251
47253
  }
47252
47254
  function createItemCommandFactory(itemType) {
47253
47255
  return function itemCommandFactory(items, operation) {
47254
- return new BaseCommand(items.filter((item2) => item2.itemType === itemType), operation);
47256
+ return new BaseCommand(items.filter((item) => item.itemType === itemType), operation);
47255
47257
  };
47256
47258
  }
47257
47259
  // src/Items/Examples/Star/AddStar.ts
@@ -48276,8 +48278,8 @@ class Camera {
48276
48278
  this.observableItem = null;
48277
48279
  }
48278
48280
  }
48279
- subscribeToItem(item2) {
48280
- this.observableItem = item2;
48281
+ subscribeToItem(item) {
48282
+ this.observableItem = item;
48281
48283
  this.observableItem.subject.subscribe(this.observeItem);
48282
48284
  }
48283
48285
  observeItem = () => {
@@ -48503,7 +48505,7 @@ class Camera {
48503
48505
  }
48504
48506
  addToView(mbr, inView) {
48505
48507
  if (!mbr.isEnclosedBy(this.getMbr())) {
48506
- this.viewRectangle(inView.reduce((acc, item2) => acc.combine(item2.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
48508
+ this.viewRectangle(inView.reduce((acc, item) => acc.combine(item.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
48507
48509
  }
48508
48510
  }
48509
48511
  viewRectangle(mbr, offsetInPercent = 10, duration = 500) {
@@ -50112,8 +50114,8 @@ class Presence {
50112
50114
  <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}"/>
50113
50115
  </svg>`;
50114
50116
  }
50115
- renderItemMbr(context, item2, color2, customScale) {
50116
- const mbr = item2.getMbr();
50117
+ renderItemMbr(context, item, color2, customScale) {
50118
+ const mbr = item.getMbr();
50117
50119
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
50118
50120
  mbr.borderColor = color2;
50119
50121
  mbr.render(context);
@@ -50253,8 +50255,8 @@ class Presence {
50253
50255
  selectionMbr.strokeWidth = 1 / context.matrix.scaleX;
50254
50256
  selectionMbr.borderColor = selection.color;
50255
50257
  selectionMbr.render(context);
50256
- for (const item2 of selection.selection) {
50257
- this.renderItemMbr(context, item2, selection.color);
50258
+ for (const item of selection.selection) {
50259
+ this.renderItemMbr(context, item, selection.color);
50258
50260
  }
50259
50261
  }
50260
50262
  }
@@ -50287,14 +50289,14 @@ class SelectionItems {
50287
50289
  items = new Map;
50288
50290
  add(value) {
50289
50291
  if (Array.isArray(value)) {
50290
- value.forEach((item2) => this.items.set(item2.getId(), item2));
50292
+ value.forEach((item) => this.items.set(item.getId(), item));
50291
50293
  } else {
50292
50294
  this.items.set(value.getId(), value);
50293
50295
  }
50294
50296
  }
50295
50297
  remove(value) {
50296
50298
  if (Array.isArray(value)) {
50297
- value.forEach((item2) => this.items.delete(item2.getId()));
50299
+ value.forEach((item) => this.items.delete(item.getId()));
50298
50300
  } else {
50299
50301
  this.items.delete(value.getId());
50300
50302
  }
@@ -50324,8 +50326,8 @@ class SelectionItems {
50324
50326
  if (this.isEmpty()) {
50325
50327
  return false;
50326
50328
  }
50327
- for (const item2 of this.items.values()) {
50328
- if (item2.itemType !== "RichText") {
50329
+ for (const item of this.items.values()) {
50330
+ if (item.itemType !== "RichText") {
50329
50331
  return false;
50330
50332
  }
50331
50333
  }
@@ -50335,14 +50337,14 @@ class SelectionItems {
50335
50337
  if (this.isEmpty()) {
50336
50338
  return false;
50337
50339
  }
50338
- return Array.from(this.items).every(([, item2]) => item2.itemType === itemType);
50340
+ return Array.from(this.items).every(([, item]) => item.itemType === itemType);
50339
50341
  }
50340
50342
  isItemTypes(itemTypes) {
50341
50343
  if (this.isEmpty()) {
50342
50344
  return false;
50343
50345
  }
50344
- for (const item2 of this.items.values()) {
50345
- if (!itemTypes.includes(item2.itemType)) {
50346
+ for (const item of this.items.values()) {
50347
+ if (!itemTypes.includes(item.itemType)) {
50346
50348
  return false;
50347
50349
  }
50348
50350
  }
@@ -50350,16 +50352,16 @@ class SelectionItems {
50350
50352
  }
50351
50353
  getItemTypes() {
50352
50354
  const itemTypes = new Set;
50353
- this.items.forEach((item2) => itemTypes.add(item2.itemType));
50355
+ this.items.forEach((item) => itemTypes.add(item.itemType));
50354
50356
  return Array.from(itemTypes);
50355
50357
  }
50356
50358
  getItemsByItemTypes(itemTypes) {
50357
- return Array.from(this.items.values()).filter((item2) => itemTypes.includes(item2.itemType));
50359
+ return Array.from(this.items.values()).filter((item) => itemTypes.includes(item.itemType));
50358
50360
  }
50359
50361
  getIdsByItemTypes(itemTypes) {
50360
50362
  const ids = [];
50361
- this.items.forEach((item2, id) => {
50362
- if (itemTypes.includes(item2.itemType)) {
50363
+ this.items.forEach((item, id) => {
50364
+ if (itemTypes.includes(item.itemType)) {
50363
50365
  ids.push(id);
50364
50366
  }
50365
50367
  });
@@ -50369,7 +50371,7 @@ class SelectionItems {
50369
50371
  return this.isSingle() ? this.items.values().next().value || null : null;
50370
50372
  }
50371
50373
  listByIds(itemIdList) {
50372
- return itemIdList.map((id) => this.items.get(id)).filter((item2) => item2 !== undefined);
50374
+ return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
50373
50375
  }
50374
50376
  ids() {
50375
50377
  return Array.from(this.items.keys());
@@ -50380,7 +50382,7 @@ class SelectionItems {
50380
50382
  return;
50381
50383
  }
50382
50384
  const mbr = items[0].getMbr();
50383
- items.slice(1).forEach((item2) => mbr.combine(item2.getMbr()));
50385
+ items.slice(1).forEach((item) => mbr.combine(item.getMbr()));
50384
50386
  return mbr;
50385
50387
  }
50386
50388
  }
@@ -50585,33 +50587,33 @@ function handleMultipleItemsResize({
50585
50587
  const translation = {};
50586
50588
  const items = itemsToResize ? itemsToResize : board.selection.items.list();
50587
50589
  board.items.getComments().forEach((comment2) => {
50588
- if (items.some((item2) => item2.getId() === comment2.getItemToFollow())) {
50590
+ if (items.some((item) => item.getId() === comment2.getItemToFollow())) {
50589
50591
  items.push(comment2);
50590
50592
  }
50591
50593
  });
50592
- for (const item2 of items) {
50593
- let itemX = item2.getMbr().left;
50594
- let itemY = item2.getMbr().top;
50595
- if (item2.itemType === "Drawing") {
50596
- itemX = item2.transformation.matrix.translateX;
50597
- itemY = item2.transformation.matrix.translateY;
50594
+ for (const item of items) {
50595
+ let itemX = item.getMbr().left;
50596
+ let itemY = item.getMbr().top;
50597
+ if (item.itemType === "Drawing") {
50598
+ itemX = item.transformation.matrix.translateX;
50599
+ itemY = item.transformation.matrix.translateY;
50598
50600
  }
50599
50601
  const deltaX = itemX - initMbr.left;
50600
50602
  const translateX = deltaX * matrix.scaleX - deltaX + matrix.translateX;
50601
50603
  const deltaY = itemY - initMbr.top;
50602
50604
  const translateY = deltaY * matrix.scaleY - deltaY + matrix.translateY;
50603
- if (item2 instanceof RichText) {
50604
- translation[item2.getId()] = getRichTextTranslation({
50605
- item: item2,
50605
+ if (item instanceof RichText) {
50606
+ translation[item.getId()] = getRichTextTranslation({
50607
+ item,
50606
50608
  isWidth,
50607
50609
  isHeight,
50608
50610
  matrix,
50609
50611
  translateX,
50610
50612
  translateY
50611
50613
  });
50612
- } else if (item2 instanceof AINode) {
50613
- translation[item2.getId()] = getAINodeTranslation({
50614
- item: item2,
50614
+ } else if (item instanceof AINode) {
50615
+ translation[item.getId()] = getAINodeTranslation({
50616
+ item,
50615
50617
  isWidth,
50616
50618
  isHeight,
50617
50619
  matrix,
@@ -50619,8 +50621,8 @@ function handleMultipleItemsResize({
50619
50621
  translateY
50620
50622
  });
50621
50623
  } else {
50622
- translation[item2.getId()] = getItemTranslation({
50623
- item: item2,
50624
+ translation[item.getId()] = getItemTranslation({
50625
+ item,
50624
50626
  isWidth,
50625
50627
  isHeight,
50626
50628
  matrix,
@@ -50633,7 +50635,7 @@ function handleMultipleItemsResize({
50633
50635
  return translation;
50634
50636
  }
50635
50637
  function getRichTextTranslation({
50636
- item: item2,
50638
+ item,
50637
50639
  isWidth,
50638
50640
  isHeight,
50639
50641
  matrix,
@@ -50641,11 +50643,11 @@ function getRichTextTranslation({
50641
50643
  translateY
50642
50644
  }) {
50643
50645
  if (isWidth) {
50644
- item2.editor.setMaxWidth(item2.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
50646
+ item.editor.setMaxWidth(item.getWidth() / item.transformation.getScale().x * matrix.scaleX);
50645
50647
  return {
50646
50648
  class: "Transformation",
50647
50649
  method: "scaleByTranslateBy",
50648
- item: [item2.getId()],
50650
+ item: [item.getId()],
50649
50651
  translate: { x: matrix.translateX, y: 0 },
50650
50652
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50651
50653
  };
@@ -50653,7 +50655,7 @@ function getRichTextTranslation({
50653
50655
  return {
50654
50656
  class: "Transformation",
50655
50657
  method: "scaleByTranslateBy",
50656
- item: [item2.getId()],
50658
+ item: [item.getId()],
50657
50659
  translate: { x: translateX, y: translateY },
50658
50660
  scale: { x: 1, y: 1 }
50659
50661
  };
@@ -50661,14 +50663,14 @@ function getRichTextTranslation({
50661
50663
  return {
50662
50664
  class: "Transformation",
50663
50665
  method: "scaleByTranslateBy",
50664
- item: [item2.getId()],
50666
+ item: [item.getId()],
50665
50667
  translate: { x: translateX, y: translateY },
50666
50668
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50667
50669
  };
50668
50670
  }
50669
50671
  }
50670
50672
  function getAINodeTranslation({
50671
- item: item2,
50673
+ item,
50672
50674
  isWidth,
50673
50675
  isHeight,
50674
50676
  matrix,
@@ -50676,11 +50678,11 @@ function getAINodeTranslation({
50676
50678
  translateY
50677
50679
  }) {
50678
50680
  if (isWidth) {
50679
- item2.text.editor.setMaxWidth(item2.text.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
50681
+ item.text.editor.setMaxWidth(item.text.getWidth() / item.transformation.getScale().x * matrix.scaleX);
50680
50682
  return {
50681
50683
  class: "Transformation",
50682
50684
  method: "scaleByTranslateBy",
50683
- item: [item2.getId()],
50685
+ item: [item.getId()],
50684
50686
  translate: { x: matrix.translateX, y: 0 },
50685
50687
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50686
50688
  };
@@ -50688,7 +50690,7 @@ function getAINodeTranslation({
50688
50690
  return {
50689
50691
  class: "Transformation",
50690
50692
  method: "scaleByTranslateBy",
50691
- item: [item2.getId()],
50693
+ item: [item.getId()],
50692
50694
  translate: { x: translateX, y: translateY },
50693
50695
  scale: { x: 1, y: 1 }
50694
50696
  };
@@ -50696,14 +50698,14 @@ function getAINodeTranslation({
50696
50698
  return {
50697
50699
  class: "Transformation",
50698
50700
  method: "scaleByTranslateBy",
50699
- item: [item2.getId()],
50701
+ item: [item.getId()],
50700
50702
  translate: { x: translateX, y: translateY },
50701
50703
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50702
50704
  };
50703
50705
  }
50704
50706
  }
50705
50707
  function getItemTranslation({
50706
- item: item2,
50708
+ item,
50707
50709
  isWidth,
50708
50710
  isHeight,
50709
50711
  matrix,
@@ -50711,22 +50713,22 @@ function getItemTranslation({
50711
50713
  translateY,
50712
50714
  isShiftPressed
50713
50715
  }) {
50714
- if (item2 instanceof Sticker && (isWidth || isHeight)) {
50716
+ if (item instanceof Sticker && (isWidth || isHeight)) {
50715
50717
  return {
50716
50718
  class: "Transformation",
50717
50719
  method: "scaleByTranslateBy",
50718
- item: [item2.getId()],
50720
+ item: [item.getId()],
50719
50721
  translate: { x: translateX, y: translateY },
50720
50722
  scale: { x: 1, y: 1 }
50721
50723
  };
50722
50724
  } else {
50723
- if (item2 instanceof Frame2 && item2.getCanChangeRatio() && isShiftPressed && item2.getFrameType() !== "Custom") {
50724
- item2.setFrameType("Custom");
50725
+ if (item instanceof Frame2 && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
50726
+ item.setFrameType("Custom");
50725
50727
  }
50726
50728
  return {
50727
50729
  class: "Transformation",
50728
50730
  method: "scaleByTranslateBy",
50729
- item: [item2.getId()],
50731
+ item: [item.getId()],
50730
50732
  translate: { x: translateX, y: translateY },
50731
50733
  scale: { x: matrix.scaleX, y: matrix.scaleY }
50732
50734
  };
@@ -50999,11 +51001,11 @@ function transformItems({
50999
51001
  setSnapCursorPos
51000
51002
  }) {
51001
51003
  const items = selection.items.list();
51002
- const includesProportionalItem = items.some((item2) => item2.itemType === "Sticker" || item2.itemType === "RichText" || item2.itemType === "AINode" || item2.itemType === "Video" || item2.itemType === "Audio");
51004
+ const includesProportionalItem = items.some((item) => item.itemType === "Sticker" || item.itemType === "RichText" || item.itemType === "AINode" || item.itemType === "Video" || item.itemType === "Audio");
51003
51005
  if (includesProportionalItem && (isWidth || isHeight)) {
51004
51006
  return null;
51005
51007
  }
51006
- const isIncludesFixedFrame = items.some((item2) => item2 instanceof Frame2 && !item2.getCanChangeRatio());
51008
+ const isIncludesFixedFrame = items.some((item) => item instanceof Frame2 && !item.getCanChangeRatio());
51007
51009
  const shouldBeProportionalResize = isIncludesFixedFrame || includesProportionalItem || isShiftPressed || !isWidth && !isHeight;
51008
51010
  const resize = shouldBeProportionalResize ? getProportionalResize(resizeType, board.pointer.point, mbr, oppositePoint) : getResize(resizeType, board.pointer.point, mbr, oppositePoint);
51009
51011
  if (canvasDrawer.getLastCreatedCanvas() && !debounceUpd.shouldUpd()) {
@@ -51081,23 +51083,23 @@ function updateFrameChildren({
51081
51083
  nestingHighlighter
51082
51084
  }) {
51083
51085
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
51084
- board.selection.items.list().forEach((item2) => {
51085
- if ("getChildrenIds" in item2 && item2.getChildrenIds()) {
51086
- const currMbr = item2.getMbr();
51086
+ board.selection.items.list().forEach((item) => {
51087
+ if ("getChildrenIds" in item && item.getChildrenIds()) {
51088
+ const currMbr = item.getMbr();
51087
51089
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
51088
51090
  itemsToCheck.forEach((currItem) => {
51089
- if (item2.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item2.getId())) {
51090
- nestingHighlighter.add(item2, currItem);
51091
+ if (item.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item.getId())) {
51092
+ nestingHighlighter.add(item, currItem);
51091
51093
  } else {
51092
51094
  nestingHighlighter.remove(currItem);
51093
51095
  }
51094
51096
  });
51095
51097
  } else {
51096
51098
  groups.forEach((group) => {
51097
- if (group.handleNesting(item2)) {
51098
- nestingHighlighter.add(group, item2);
51099
+ if (group.handleNesting(item)) {
51100
+ nestingHighlighter.add(group, item);
51099
51101
  } else {
51100
- nestingHighlighter.remove(item2);
51102
+ nestingHighlighter.remove(item);
51101
51103
  }
51102
51104
  });
51103
51105
  }
@@ -51165,9 +51167,9 @@ class Transformer extends Tool {
51165
51167
  const pointer = this.board.pointer;
51166
51168
  const camera = this.board.camera;
51167
51169
  const items = this.selection.items;
51168
- const item2 = items.getSingle();
51170
+ const item = items.getSingle();
51169
51171
  let resizeType;
51170
- if (item2 && (item2.itemType === "RichText" || item2.itemType === "Sticker")) {
51172
+ if (item && (item.itemType === "RichText" || item.itemType === "Sticker")) {
51171
51173
  resizeType = getTextResizeType(pointer.point, camera.getScale(), mbr);
51172
51174
  } else {
51173
51175
  resizeType = getResizeType(pointer.point, camera.getScale(), mbr);
@@ -51421,8 +51423,8 @@ class SelectionTransformer extends Tool {
51421
51423
  return;
51422
51424
  }
51423
51425
  if (this.selection.items.isSingle()) {
51424
- const item2 = this.selection.items.getSingle();
51425
- if (item2?.itemType === "Connector") {
51426
+ const item = this.selection.items.getSingle();
51427
+ if (item?.itemType === "Connector") {
51426
51428
  this.tool = this.connectorTransformerTool;
51427
51429
  return;
51428
51430
  } else {
@@ -51505,16 +51507,16 @@ class BoardSelection {
51505
51507
  this.quickAddButtons = getQuickAddButtons(this, board);
51506
51508
  }
51507
51509
  serialize() {
51508
- const selectedItems = this.items.list().map((item2) => item2.getId());
51510
+ const selectedItems = this.items.list().map((item) => item.getId());
51509
51511
  return JSON.stringify(selectedItems);
51510
51512
  }
51511
51513
  deserialize(serializedData) {
51512
51514
  const selectedItems = JSON.parse(serializedData);
51513
51515
  this.removeAll();
51514
51516
  selectedItems.forEach((itemId) => {
51515
- const item2 = this.board.items.getById(itemId);
51516
- if (item2) {
51517
- this.items.add(item2);
51517
+ const item = this.board.items.getById(itemId);
51518
+ if (item) {
51519
+ this.items.add(item);
51518
51520
  }
51519
51521
  });
51520
51522
  }
@@ -51592,19 +51594,19 @@ class BoardSelection {
51592
51594
  this.updateQueue.clear();
51593
51595
  safeRequestAnimationFrame(this.updateScheduledObservers);
51594
51596
  };
51595
- itemObserver = (item2) => {
51597
+ itemObserver = (item) => {
51596
51598
  if (!this.shouldPublish) {
51597
51599
  return;
51598
51600
  }
51599
51601
  this.subject.publish(this);
51600
- this.itemSubject.publish(item2);
51602
+ this.itemSubject.publish(item);
51601
51603
  };
51602
51604
  decoratedItemObserver = this.decorateObserverToScheduleUpdate(this.itemObserver);
51603
51605
  add(value) {
51604
51606
  this.items.add(value);
51605
51607
  if (Array.isArray(value)) {
51606
- for (const item2 of value) {
51607
- item2.subject.subscribe(this.itemObserver);
51608
+ for (const item of value) {
51609
+ item.subject.subscribe(this.itemObserver);
51608
51610
  }
51609
51611
  } else {
51610
51612
  value.subject.subscribe(this.itemObserver);
@@ -51613,15 +51615,15 @@ class BoardSelection {
51613
51615
  this.itemsSubject.publish([]);
51614
51616
  }
51615
51617
  addAll() {
51616
- const items = this.board.items.listAll().filter((item2) => !item2.transformation.isLocked);
51618
+ const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked);
51617
51619
  this.add(items);
51618
51620
  this.setContext("SelectByRect");
51619
51621
  }
51620
51622
  remove(value) {
51621
51623
  this.items.remove(value);
51622
51624
  if (Array.isArray(value)) {
51623
- for (const item2 of value) {
51624
- item2.subject.unsubscribe(this.itemObserver);
51625
+ for (const item of value) {
51626
+ item.subject.unsubscribe(this.itemObserver);
51625
51627
  }
51626
51628
  } else {
51627
51629
  value.subject.unsubscribe(this.itemObserver);
@@ -51715,11 +51717,11 @@ class BoardSelection {
51715
51717
  if (!this.items.isSingle()) {
51716
51718
  return;
51717
51719
  }
51718
- const item2 = this.items.getSingle();
51719
- if (!item2) {
51720
+ const item = this.items.getSingle();
51721
+ if (!item) {
51720
51722
  return;
51721
51723
  }
51722
- const text5 = item2.getRichText();
51724
+ const text5 = item.getRichText();
51723
51725
  if (!text5) {
51724
51726
  return;
51725
51727
  }
@@ -51730,7 +51732,7 @@ class BoardSelection {
51730
51732
  if (shouldReplace || moveCursorToEnd) {
51731
51733
  text5.editor.moveCursorToEndOfTheText();
51732
51734
  }
51733
- this.setTextToEdit(item2);
51735
+ this.setTextToEdit(item);
51734
51736
  this.setContext("EditTextUnderPointer");
51735
51737
  if (shouldSelect) {
51736
51738
  text5.editor.selectWholeText();
@@ -51740,13 +51742,13 @@ class BoardSelection {
51740
51742
  editUnderPointer() {
51741
51743
  this.removeAll();
51742
51744
  const stack = this.board.items.getUnderPointer();
51743
- const item2 = stack.pop();
51744
- if (item2) {
51745
- this.add(item2);
51745
+ const item = stack.pop();
51746
+ if (item) {
51747
+ this.add(item);
51746
51748
  this.setTextToEdit(undefined);
51747
- const text5 = item2.getRichText();
51749
+ const text5 = item.getRichText();
51748
51750
  if (text5) {
51749
- this.setTextToEdit(item2);
51751
+ this.setTextToEdit(item);
51750
51752
  text5.editor.selectWholeText();
51751
51753
  this.board.items.subject.publish(this.board.items);
51752
51754
  }
@@ -51755,26 +51757,26 @@ class BoardSelection {
51755
51757
  this.setContext("None");
51756
51758
  }
51757
51759
  }
51758
- setTextToEdit(item2) {
51760
+ setTextToEdit(item) {
51759
51761
  if (this.textToEdit) {
51760
51762
  this.textToEdit.updateElement();
51761
51763
  this.textToEdit.enableRender();
51762
51764
  }
51763
- if (!(item2 && item2.getRichText())) {
51765
+ if (!(item && item.getRichText())) {
51764
51766
  this.textToEdit = undefined;
51765
51767
  return;
51766
51768
  }
51767
- const text5 = item2.getRichText();
51769
+ const text5 = item.getRichText();
51768
51770
  if (!text5) {
51769
51771
  return;
51770
51772
  }
51771
51773
  if (text5.isEmpty()) {
51772
- const textColor = tempStorage.getFontColor(item2.itemType);
51773
- const textSize = tempStorage.getFontSize(item2.itemType);
51774
- const highlightColor = tempStorage.getFontHighlight(item2.itemType);
51775
- const styles = tempStorage.getFontStyles(item2.itemType);
51776
- const horizontalAlignment = tempStorage.getHorizontalAlignment(item2.itemType);
51777
- const verticalAlignment = tempStorage.getVerticalAlignment(item2.itemType);
51774
+ const textColor = tempStorage.getFontColor(item.itemType);
51775
+ const textSize = tempStorage.getFontSize(item.itemType);
51776
+ const highlightColor = tempStorage.getFontHighlight(item.itemType);
51777
+ const styles = tempStorage.getFontStyles(item.itemType);
51778
+ const horizontalAlignment = tempStorage.getHorizontalAlignment(item.itemType);
51779
+ const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
51778
51780
  if (textColor) {
51779
51781
  text5.setSelectionFontColor(textColor, "None");
51780
51782
  }
@@ -51782,7 +51784,7 @@ class BoardSelection {
51782
51784
  this.emit({
51783
51785
  class: "RichText",
51784
51786
  method: "setFontSize",
51785
- item: [item2.getId()],
51787
+ item: [item.getId()],
51786
51788
  fontSize: textSize,
51787
51789
  context: this.getContext()
51788
51790
  });
@@ -51794,10 +51796,10 @@ class BoardSelection {
51794
51796
  const stylesArr = styles;
51795
51797
  text5.setSelectionFontStyle(stylesArr, "None");
51796
51798
  }
51797
- if (horizontalAlignment && !(item2 instanceof Sticker)) {
51799
+ if (horizontalAlignment && !(item instanceof Sticker)) {
51798
51800
  text5.setSelectionHorisontalAlignment(horizontalAlignment);
51799
51801
  }
51800
- if (verticalAlignment && !(item2 instanceof Sticker)) {
51802
+ if (verticalAlignment && !(item instanceof Sticker)) {
51801
51803
  this.setVerticalAlignment(verticalAlignment);
51802
51804
  }
51803
51805
  }
@@ -51830,8 +51832,8 @@ class BoardSelection {
51830
51832
  }
51831
51833
  selectEnclosedOrCrossedBy(rect) {
51832
51834
  this.removeAll();
51833
- const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item2) => !item2.transformation.isLocked);
51834
- 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);
51835
+ const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item) => !item.transformation.isLocked);
51836
+ 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);
51835
51837
  if (list6.length !== 0) {
51836
51838
  this.add(list6);
51837
51839
  this.setContext("SelectByRect");
@@ -51845,14 +51847,14 @@ class BoardSelection {
51845
51847
  canChangeText() {
51846
51848
  return Boolean(this.items.isSingle() && this.items.getSingle()?.getRichText());
51847
51849
  }
51848
- handleItemCopy(item2, copiedItemsMap) {
51849
- const serializedData = item2.serialize(true);
51850
- const zIndex = this.board.items.index.getZIndex(item2);
51851
- if (item2.itemType === "Comment") {
51850
+ handleItemCopy(item, copiedItemsMap) {
51851
+ const serializedData = item.serialize(true);
51852
+ const zIndex = this.board.items.index.getZIndex(item);
51853
+ if (item.itemType === "Comment") {
51852
51854
  return;
51853
51855
  }
51854
- if (item2.itemType === "Connector" && serializedData.itemType === "Connector") {
51855
- const connector = item2;
51856
+ if (item.itemType === "Connector" && serializedData.itemType === "Connector") {
51857
+ const connector = item;
51856
51858
  const startPoint = connector.getStartPoint();
51857
51859
  const endPoint = connector.getEndPoint();
51858
51860
  const startItemId = startPoint.pointType !== "Board" ? startPoint.item.getId() : null;
@@ -51868,19 +51870,19 @@ class BoardSelection {
51868
51870
  serializedData.endPoint = new BoardPoint(endPoint.x, endPoint.y).serialize();
51869
51871
  }
51870
51872
  }
51871
- const textItem = item2.getRichText()?.getTextString();
51873
+ const textItem = item.getRichText()?.getTextString();
51872
51874
  const copyText = conf.i18n.t("frame.copy");
51873
51875
  const isCopyTextExist = textItem?.includes(copyText);
51874
- const isChangeCopiedFrameText = item2.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
51876
+ const isChangeCopiedFrameText = item.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
51875
51877
  if (isChangeCopiedFrameText) {
51876
51878
  const copiedFrameText = copyText + (textItem || serializedData.text?.placeholderText);
51877
- item2.getRichText()?.editor.clearText();
51878
- item2.getRichText()?.editor.addText(copiedFrameText);
51879
- serializedData.text = item2.getRichText()?.serialize();
51880
- item2.getRichText()?.editor.clearText();
51881
- item2.getRichText()?.editor.addText(textItem || "");
51879
+ item.getRichText()?.editor.clearText();
51880
+ item.getRichText()?.editor.addText(copiedFrameText);
51881
+ serializedData.text = item.getRichText()?.serialize();
51882
+ item.getRichText()?.editor.clearText();
51883
+ item.getRichText()?.editor.addText(textItem || "");
51882
51884
  }
51883
- copiedItemsMap[item2.getId()] = { ...serializedData, zIndex };
51885
+ copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
51884
51886
  }
51885
51887
  copy(skipImageBlobCopy) {
51886
51888
  const copiedItemsMap = {};
@@ -51889,12 +51891,12 @@ class BoardSelection {
51889
51891
  this.handleItemCopy(single, copiedItemsMap);
51890
51892
  return { imageElement: single.image, imageData: copiedItemsMap };
51891
51893
  }
51892
- this.list().forEach((item2) => {
51893
- this.handleItemCopy(item2, copiedItemsMap);
51894
+ this.list().forEach((item) => {
51895
+ this.handleItemCopy(item, copiedItemsMap);
51894
51896
  });
51895
- this.list().flatMap((item2) => {
51896
- if (item2 instanceof Frame2) {
51897
- return item2.getChildrenIds();
51897
+ this.list().flatMap((item) => {
51898
+ if (item instanceof Frame2) {
51899
+ return item.getChildrenIds();
51898
51900
  }
51899
51901
  return [];
51900
51902
  }).forEach((id) => {
@@ -51922,11 +51924,11 @@ class BoardSelection {
51922
51924
  let maxRichText = null;
51923
51925
  let minRichText = null;
51924
51926
  const itemType = items[0].itemType;
51925
- for (const item2 of items) {
51926
- if (item2.itemType !== itemType) {
51927
+ for (const item of items) {
51928
+ if (item.itemType !== itemType) {
51927
51929
  return null;
51928
51930
  }
51929
- const richText = item2.getRichText();
51931
+ const richText = item.getRichText();
51930
51932
  if (richText) {
51931
51933
  if (!maxRichText || richText.getFontSize() > maxRichText.getFontSize()) {
51932
51934
  maxRichText = richText;
@@ -52032,22 +52034,22 @@ class BoardSelection {
52032
52034
  }
52033
52035
  nestSelectedItems(unselectedItem, checkFrames = true) {
52034
52036
  const selected = this.board.selection.items.list();
52035
- if (unselectedItem && !selected.find((item2) => item2.getId() === unselectedItem.getId())) {
52037
+ if (unselectedItem && !selected.find((item) => item.getId() === unselectedItem.getId())) {
52036
52038
  selected.push(unselectedItem);
52037
52039
  }
52038
- const selectedMbr = selected.reduce((acc, item2) => {
52040
+ const selectedMbr = selected.reduce((acc, item) => {
52039
52041
  if (!acc) {
52040
- return item2.getMbr();
52042
+ return item.getMbr();
52041
52043
  }
52042
- return acc.combine(item2.getMbr());
52044
+ return acc.combine(item.getMbr());
52043
52045
  }, undefined);
52044
52046
  if (selectedMbr) {
52045
- const selectedMap = Object.fromEntries(selected.map((item2) => [item2.getId(), { item: item2, nested: false }]));
52047
+ const selectedMap = Object.fromEntries(selected.map((item) => [item.getId(), { item, nested: false }]));
52046
52048
  const enclosedGroups = this.board.items.getGroupItemsEnclosedOrCrossed(selectedMbr?.left, selectedMbr?.top, selectedMbr?.right, selectedMbr?.bottom);
52047
52049
  enclosedGroups.forEach((group) => {
52048
- selected.forEach((item2) => {
52049
- if (group.handleNesting(item2)) {
52050
- selectedMap[item2.getId()].nested = group;
52050
+ selected.forEach((item) => {
52051
+ if (group.handleNesting(item)) {
52052
+ selectedMap[item.getId()].nested = group;
52051
52053
  }
52052
52054
  });
52053
52055
  });
@@ -52071,11 +52073,11 @@ class BoardSelection {
52071
52073
  if (childrenIds && checkFrames) {
52072
52074
  const currGroup = val.item;
52073
52075
  const currMbr = currGroup.getMbr();
52074
- const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item2) => !!item2);
52075
- const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item2) => item2.parent === "Board" || item2.parent === currGroup.getId());
52076
+ const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
52077
+ const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
52076
52078
  const uniqueItems = new Set;
52077
- const toCheck = [...children, ...underGroup].filter((item2) => {
52078
- const id = item2.getId();
52079
+ const toCheck = [...children, ...underGroup].filter((item) => {
52080
+ const id = item.getId();
52079
52081
  if (uniqueItems.has(id)) {
52080
52082
  return false;
52081
52083
  }
@@ -52116,8 +52118,8 @@ class BoardSelection {
52116
52118
  addItemToTranslation(childId);
52117
52119
  }
52118
52120
  }
52119
- const createTranslationWithComments = (item2) => {
52120
- const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item2.getId());
52121
+ const createTranslationWithComments = (item) => {
52122
+ const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item.getId());
52121
52123
  for (const comment2 of followedComments) {
52122
52124
  translation[comment2.getId()] = {
52123
52125
  class: "Transformation",
@@ -52178,21 +52180,21 @@ class BoardSelection {
52178
52180
  newData: { borderColor }
52179
52181
  };
52180
52182
  const operations2 = {};
52181
- this.items.list().forEach((item2) => {
52182
- if (!operations2[item2.itemType]) {
52183
+ this.items.list().forEach((item) => {
52184
+ if (!operations2[item.itemType]) {
52183
52185
  const operationCopy = { ...operation };
52184
- if (item2.itemType === "Connector") {
52186
+ if (item.itemType === "Connector") {
52185
52187
  operationCopy.method = "setLineColor";
52186
52188
  operationCopy.lineColor = borderColor;
52187
- } else if (item2.itemType === "Drawing") {
52189
+ } else if (item.itemType === "Drawing") {
52188
52190
  operationCopy.method = "setStrokeColor";
52189
52191
  operationCopy.color = borderColor;
52190
52192
  } else {
52191
52193
  operationCopy.borderColor = borderColor;
52192
52194
  }
52193
- operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
52195
+ operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
52194
52196
  } else {
52195
- operations2[item2.itemType].item.push(item2.getId());
52197
+ operations2[item.itemType].item.push(item.getId());
52196
52198
  }
52197
52199
  });
52198
52200
  Object.values(operations2).forEach((op) => {
@@ -52207,13 +52209,13 @@ class BoardSelection {
52207
52209
  newData: { borderWidth: width2 }
52208
52210
  };
52209
52211
  const operations2 = {};
52210
- this.items.list().forEach((item2) => {
52211
- if (!operations2[item2.itemType]) {
52212
+ this.items.list().forEach((item) => {
52213
+ if (!operations2[item.itemType]) {
52212
52214
  const operationCopy = { ...operation };
52213
- if (item2.itemType === "Connector") {
52215
+ if (item.itemType === "Connector") {
52214
52216
  operationCopy.method = "setLineWidth";
52215
52217
  operationCopy.lineWidth = width2;
52216
- } else if (item2.itemType === "Drawing") {
52218
+ } else if (item.itemType === "Drawing") {
52217
52219
  operationCopy.method = "setStrokeWidth";
52218
52220
  operationCopy.width = width2;
52219
52221
  operationCopy.prevWidth = this.getStrokeWidth();
@@ -52221,9 +52223,9 @@ class BoardSelection {
52221
52223
  operationCopy.borderWidth = width2;
52222
52224
  operationCopy.prevBorderWidth = this.getStrokeWidth();
52223
52225
  }
52224
- operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
52226
+ operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
52225
52227
  } else {
52226
- operations2[item2.itemType].item.push(item2.getId());
52228
+ operations2[item.itemType].item.push(item.getId());
52227
52229
  }
52228
52230
  });
52229
52231
  Object.values(operations2).forEach((op) => {
@@ -52239,11 +52241,11 @@ class BoardSelection {
52239
52241
  newData: { backgroundColor }
52240
52242
  };
52241
52243
  const operations2 = {};
52242
- this.items.list().forEach((item2) => {
52243
- if (!operations2[item2.itemType]) {
52244
- operations2[item2.itemType] = { ...operation, class: item2.itemType, item: [item2.getId()] };
52244
+ this.items.list().forEach((item) => {
52245
+ if (!operations2[item.itemType]) {
52246
+ operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
52245
52247
  } else {
52246
- operations2[item2.itemType].item.push(item2.getId());
52248
+ operations2[item.itemType].item.push(item.getId());
52247
52249
  }
52248
52250
  });
52249
52251
  Object.values(operations2).forEach((op) => {
@@ -52267,9 +52269,9 @@ class BoardSelection {
52267
52269
  }
52268
52270
  setFrameType(frameType) {
52269
52271
  const items = this.items.list();
52270
- items.forEach((item2) => {
52271
- if (item2 instanceof Frame2) {
52272
- item2.setFrameType(frameType);
52272
+ items.forEach((item) => {
52273
+ if (item instanceof Frame2) {
52274
+ item.setFrameType(frameType);
52273
52275
  }
52274
52276
  });
52275
52277
  }
@@ -52288,21 +52290,21 @@ class BoardSelection {
52288
52290
  setFontSize(size) {
52289
52291
  const fontSize = size === "auto" ? size : toFiniteNumber(size);
52290
52292
  const itemsOps = [];
52291
- for (const item2 of this.items.list()) {
52292
- const text5 = item2.getRichText();
52293
+ for (const item of this.items.list()) {
52294
+ const text5 = item.getRichText();
52293
52295
  if (!text5) {
52294
52296
  continue;
52295
52297
  }
52296
52298
  const ops = text5.setSelectionFontSize(fontSize, this.context);
52297
52299
  itemsOps.push({
52298
- item: item2.getId(),
52300
+ item: item.getId(),
52299
52301
  selection: text5.editor.getSelection(),
52300
52302
  ops
52301
52303
  });
52302
- if (item2.itemType === "Sticker" && fontSize === "auto") {
52303
- tempStorage.remove(`fontSize_${item2.itemType}`);
52304
- } else if (item2.itemType !== "AINode") {
52305
- tempStorage.setFontSize(item2.itemType, fontSize);
52304
+ if (item.itemType === "Sticker" && fontSize === "auto") {
52305
+ tempStorage.remove(`fontSize_${item.itemType}`);
52306
+ } else if (item.itemType !== "AINode") {
52307
+ tempStorage.setFontSize(item.itemType, fontSize);
52306
52308
  }
52307
52309
  }
52308
52310
  const emptyOps = itemsOps.filter((op) => !op.ops.length);
@@ -52325,8 +52327,8 @@ class BoardSelection {
52325
52327
  setFontStyle(fontStyle) {
52326
52328
  const isMultiple = !this.items.isSingle();
52327
52329
  const itemsOps = [];
52328
- for (const item2 of this.items.list()) {
52329
- const text5 = item2.getRichText();
52330
+ for (const item of this.items.list()) {
52331
+ const text5 = item.getRichText();
52330
52332
  if (!text5) {
52331
52333
  continue;
52332
52334
  }
@@ -52335,12 +52337,12 @@ class BoardSelection {
52335
52337
  }
52336
52338
  const ops = text5.setSelectionFontStyle(fontStyle, this.context);
52337
52339
  itemsOps.push({
52338
- item: item2.getId(),
52340
+ item: item.getId(),
52339
52341
  selection: text5.editor.getSelection(),
52340
52342
  ops
52341
52343
  });
52342
- if (item2.itemType !== "AINode") {
52343
- tempStorage.setFontStyles(item2.itemType, text5.getFontStyles());
52344
+ if (item.itemType !== "AINode") {
52345
+ tempStorage.setFontStyles(item.itemType, text5.getFontStyles());
52344
52346
  }
52345
52347
  }
52346
52348
  this.emitApplied({
@@ -52352,8 +52354,8 @@ class BoardSelection {
52352
52354
  setFontColor(fontColor) {
52353
52355
  const isMultiple = !this.items.isSingle();
52354
52356
  const itemsOps = [];
52355
- for (const item2 of this.items.list()) {
52356
- const text5 = item2.getRichText();
52357
+ for (const item of this.items.list()) {
52358
+ const text5 = item.getRichText();
52357
52359
  if (!text5) {
52358
52360
  continue;
52359
52361
  }
@@ -52362,11 +52364,11 @@ class BoardSelection {
52362
52364
  }
52363
52365
  const ops = text5.setSelectionFontColor(fontColor, this.context);
52364
52366
  itemsOps.push({
52365
- item: item2.getId(),
52367
+ item: item.getId(),
52366
52368
  selection: text5.editor.getSelection(),
52367
52369
  ops
52368
52370
  });
52369
- tempStorage.setFontColor(item2.itemType, fontColor);
52371
+ tempStorage.setFontColor(item.itemType, fontColor);
52370
52372
  }
52371
52373
  this.emitApplied({
52372
52374
  class: "RichText",
@@ -52395,8 +52397,8 @@ class BoardSelection {
52395
52397
  setFontHighlight(fontHighlight) {
52396
52398
  const isMultiple = !this.items.isSingle();
52397
52399
  const itemsOps = [];
52398
- for (const item2 of this.items.list()) {
52399
- const text5 = item2.getRichText();
52400
+ for (const item of this.items.list()) {
52401
+ const text5 = item.getRichText();
52400
52402
  if (!text5) {
52401
52403
  continue;
52402
52404
  }
@@ -52405,12 +52407,12 @@ class BoardSelection {
52405
52407
  }
52406
52408
  const ops = text5.setSelectionFontHighlight(fontHighlight, this.context);
52407
52409
  itemsOps.push({
52408
- item: item2.getId(),
52410
+ item: item.getId(),
52409
52411
  selection: text5.editor.getSelection(),
52410
52412
  ops
52411
52413
  });
52412
- if (item2.itemType !== "AINode") {
52413
- tempStorage.setFontHighlight(item2.itemType, fontHighlight);
52414
+ if (item.itemType !== "AINode") {
52415
+ tempStorage.setFontHighlight(item.itemType, fontHighlight);
52414
52416
  }
52415
52417
  }
52416
52418
  this.emitApplied({
@@ -52422,8 +52424,8 @@ class BoardSelection {
52422
52424
  setHorisontalAlignment(horisontalAlignment) {
52423
52425
  const isMultiple = !this.items.isSingle();
52424
52426
  const itemsOps = [];
52425
- for (const item2 of this.items.list()) {
52426
- const text5 = item2.getRichText();
52427
+ for (const item of this.items.list()) {
52428
+ const text5 = item.getRichText();
52427
52429
  if (!text5) {
52428
52430
  continue;
52429
52431
  }
@@ -52432,11 +52434,11 @@ class BoardSelection {
52432
52434
  }
52433
52435
  const ops = text5.setSelectionHorisontalAlignment(horisontalAlignment, this.context);
52434
52436
  itemsOps.push({
52435
- item: item2.getId(),
52437
+ item: item.getId(),
52436
52438
  selection: text5.editor.getSelection(),
52437
52439
  ops
52438
52440
  });
52439
- tempStorage.setHorizontalAlignment(item2.itemType, horisontalAlignment);
52441
+ tempStorage.setHorizontalAlignment(item.itemType, horisontalAlignment);
52440
52442
  }
52441
52443
  this.emitApplied({
52442
52444
  class: "RichText",
@@ -52452,23 +52454,23 @@ class BoardSelection {
52452
52454
  verticalAlignment
52453
52455
  });
52454
52456
  if (this.items.isSingle()) {
52455
- const item2 = this.items.getSingle();
52456
- if (!item2) {
52457
+ const item = this.items.getSingle();
52458
+ if (!item) {
52457
52459
  return;
52458
52460
  }
52459
- const text5 = item2.getRichText();
52461
+ const text5 = item.getRichText();
52460
52462
  if (!text5) {
52461
52463
  return;
52462
52464
  }
52463
- tempStorage.setVerticalAlignment(item2.itemType, verticalAlignment);
52464
- if (item2 instanceof RichText) {
52465
- item2.setEditorFocus(this.context);
52465
+ tempStorage.setVerticalAlignment(item.itemType, verticalAlignment);
52466
+ if (item instanceof RichText) {
52467
+ item.setEditorFocus(this.context);
52466
52468
  }
52467
52469
  text5.setEditorFocus(this.context);
52468
52470
  }
52469
52471
  }
52470
52472
  removeFromBoard() {
52471
- const isLocked = this.items.list().some((item2) => item2.transformation.isLocked);
52473
+ const isLocked = this.items.list().some((item) => item.transformation.isLocked);
52472
52474
  if (isLocked) {
52473
52475
  return;
52474
52476
  }
@@ -52491,7 +52493,7 @@ class BoardSelection {
52491
52493
  }
52492
52494
  getIsLockedSelection() {
52493
52495
  const items = this.list();
52494
- return items.some((item2) => item2.transformation.isLocked);
52496
+ return items.some((item) => item.transformation.isLocked);
52495
52497
  }
52496
52498
  isLocked() {
52497
52499
  return false;
@@ -52518,9 +52520,9 @@ class BoardSelection {
52518
52520
  }
52519
52521
  async duplicate() {
52520
52522
  const mediaIds = [];
52521
- this.items.list().forEach((item2) => {
52522
- if ("getStorageId" in item2) {
52523
- const storageId = item2.getStorageId();
52523
+ this.items.list().forEach((item) => {
52524
+ if ("getStorageId" in item) {
52525
+ const storageId = item.getStorageId();
52524
52526
  if (storageId) {
52525
52527
  mediaIds.push(storageId);
52526
52528
  }
@@ -52530,7 +52532,7 @@ class BoardSelection {
52530
52532
  if (!canDuplicate) {
52531
52533
  return;
52532
52534
  }
52533
- const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item2]) => item2.itemType !== "Group"));
52535
+ const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item]) => item.itemType !== "Group"));
52534
52536
  this.board.duplicate(filteredItemMap);
52535
52537
  this.setContext("EditUnderPointer");
52536
52538
  }
@@ -52564,10 +52566,10 @@ class BoardSelection {
52564
52566
  lastAssistantMessageId
52565
52567
  };
52566
52568
  }
52567
- renderItemMbr(context, item2, customScale) {
52568
- const mbr = item2.getMbr();
52569
+ renderItemMbr(context, item, customScale) {
52570
+ const mbr = item.getMbr();
52569
52571
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
52570
- const selectionColor = item2.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
52572
+ const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
52571
52573
  mbr.borderColor = selectionColor;
52572
52574
  mbr.render(context);
52573
52575
  }
@@ -52583,8 +52585,8 @@ class BoardSelection {
52583
52585
  }
52584
52586
  if (!this.transformationRenderBlock) {
52585
52587
  if (this.shouldRenderItemsMbr) {
52586
- for (const item2 of this.items.list()) {
52587
- this.renderItemMbr(context, item2);
52588
+ for (const item of this.items.list()) {
52589
+ this.renderItemMbr(context, item);
52588
52590
  }
52589
52591
  }
52590
52592
  this.tool.render(context);
@@ -52596,7 +52598,7 @@ class BoardSelection {
52596
52598
  if (single && single instanceof AINode) {
52597
52599
  const contextItemsIds = single.getContextItems();
52598
52600
  if (contextItemsIds.length) {
52599
- const newContextItems = this.board.items.listAll().filter((item2) => contextItemsIds.includes(item2.getId()));
52601
+ const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
52600
52602
  contextItems.push(...newContextItems);
52601
52603
  }
52602
52604
  }
@@ -52614,15 +52616,15 @@ class BoardSelection {
52614
52616
  }
52615
52617
  }
52616
52618
  }
52617
- contextItems.forEach((item2) => {
52618
- if (item2 instanceof AINode) {
52619
- const path2 = item2.getPath();
52619
+ contextItems.forEach((item) => {
52620
+ if (item instanceof AINode) {
52621
+ const path2 = item.getPath();
52620
52622
  path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
52621
52623
  path2.setBorderWidth(2);
52622
52624
  path2.setBackgroundColor("none");
52623
52625
  path2.render(context);
52624
52626
  } else {
52625
- const itemRect = item2.getMbr();
52627
+ const itemRect = item.getMbr();
52626
52628
  itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
52627
52629
  itemRect.strokeWidth = 2;
52628
52630
  itemRect.render(context);
@@ -53123,16 +53125,16 @@ class Board {
53123
53125
  applyBoardOperation(op) {
53124
53126
  switch (op.method) {
53125
53127
  case "moveToZIndex": {
53126
- const item2 = this.index.getById(op.item);
53127
- if (!item2) {
53128
+ const item = this.index.getById(op.item);
53129
+ if (!item) {
53128
53130
  return;
53129
53131
  }
53130
- return this.index.moveToZIndex(item2, op.zIndex);
53132
+ return this.index.moveToZIndex(item, op.zIndex);
53131
53133
  }
53132
53134
  case "moveManyToZIndex": {
53133
53135
  for (const id in op.item) {
53134
- const item2 = this.items.getById(id);
53135
- if (!item2) {
53136
+ const item = this.items.getById(id);
53137
+ if (!item) {
53136
53138
  delete op.item.id;
53137
53139
  }
53138
53140
  }
@@ -53154,11 +53156,11 @@ class Board {
53154
53156
  }
53155
53157
  return this.index.moveSecondAfterFirst(first, second);
53156
53158
  case "bringToFront": {
53157
- const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
53159
+ const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
53158
53160
  return this.index.bringManyToFront(items);
53159
53161
  }
53160
53162
  case "sendToBack": {
53161
- const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
53163
+ const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
53162
53164
  return this.index.sendManyToBack(items);
53163
53165
  }
53164
53166
  case "add":
@@ -53182,82 +53184,82 @@ class Board {
53182
53184
  applyAddItems(op) {
53183
53185
  if (Array.isArray(op.item)) {
53184
53186
  const data = op.data;
53185
- const items = op.item.map((item3) => {
53186
- const created = this.createItem(item3, data[item3]);
53187
+ const items = op.item.map((item2) => {
53188
+ const created = this.createItem(item2, data[item2]);
53187
53189
  this.index.insert(created);
53188
53190
  return created;
53189
53191
  });
53190
- items.forEach((item3) => {
53191
- if (item3 instanceof Connector2 && data[item3.getId()]) {
53192
- const connectorData = data[item3.getId()];
53193
- item3.applyStartPoint(connectorData.startPoint);
53194
- item3.applyEndPoint(connectorData.endPoint);
53192
+ items.forEach((item2) => {
53193
+ if (item2 instanceof Connector2 && data[item2.getId()]) {
53194
+ const connectorData = data[item2.getId()];
53195
+ item2.applyStartPoint(connectorData.startPoint);
53196
+ item2.applyEndPoint(connectorData.endPoint);
53195
53197
  }
53196
53198
  });
53197
53199
  return;
53198
53200
  }
53199
- const item2 = this.createItem(op.item, op.data);
53200
- return this.index.insert(item2);
53201
+ const item = this.createItem(op.item, op.data);
53202
+ return this.index.insert(item);
53201
53203
  }
53202
53204
  applyAddLockedGroupOperation(op) {
53203
- const item2 = this.createItem(op.item, op.data);
53204
- const groupChildrenIds = item2.getChildrenIds();
53205
- this.index.insert(item2);
53205
+ const item = this.createItem(op.item, op.data);
53206
+ const groupChildrenIds = item.getChildrenIds();
53207
+ this.index.insert(item);
53206
53208
  const lastChildrenId = this.index.getById(groupChildrenIds[groupChildrenIds.length - 1]);
53207
53209
  if (lastChildrenId) {
53208
53210
  const zIndex = this.index.getZIndex(lastChildrenId) + 1;
53209
- this.index.moveToZIndex(item2, zIndex);
53211
+ this.index.moveToZIndex(item, zIndex);
53210
53212
  }
53211
- item2.getChildren().forEach((item3) => {
53212
- item3.transformation.isLocked = true;
53213
+ item.getChildren().forEach((item2) => {
53214
+ item2.transformation.isLocked = true;
53213
53215
  });
53214
- item2.transformation.isLocked = true;
53216
+ item.transformation.isLocked = true;
53215
53217
  }
53216
53218
  applyRemoveOperation(op) {
53217
53219
  const removedItems = [];
53218
- this.findItemAndApply(op.item, (item2) => {
53219
- this.index.remove(item2);
53220
- this.selection.remove(item2);
53221
- if (item2 instanceof Connector2) {
53222
- item2.clearObservedItems();
53220
+ this.findItemAndApply(op.item, (item) => {
53221
+ this.index.remove(item);
53222
+ this.selection.remove(item);
53223
+ if (item instanceof Connector2) {
53224
+ item.clearObservedItems();
53223
53225
  }
53224
- removedItems.push(item2);
53226
+ removedItems.push(item);
53225
53227
  });
53226
53228
  }
53227
53229
  applyRemoveLockedGroupOperation(op) {
53228
- const item2 = this.index.getById(op.item[0]);
53229
- if (!item2 || !(item2 instanceof Group)) {
53230
+ const item = this.index.getById(op.item[0]);
53231
+ if (!item || !(item instanceof Group)) {
53230
53232
  return;
53231
53233
  }
53232
- item2.getChildren().forEach((item3) => {
53233
- item3.transformation.isLocked = false;
53234
- item3.parent = "Board";
53234
+ item.getChildren().forEach((item2) => {
53235
+ item2.transformation.isLocked = false;
53236
+ item2.parent = "Board";
53235
53237
  });
53236
- item2.transformation.isLocked = false;
53238
+ item.transformation.isLocked = false;
53237
53239
  const removedItems = [];
53238
- this.findItemAndApply(op.item, (item3) => {
53239
- this.index.remove(item3);
53240
- this.selection.remove(item3);
53241
- removedItems.push(item3);
53240
+ this.findItemAndApply(op.item, (item2) => {
53241
+ this.index.remove(item2);
53242
+ this.selection.remove(item2);
53243
+ removedItems.push(item2);
53242
53244
  });
53243
53245
  }
53244
53246
  applyItemOperation(op) {
53245
53247
  if ("item" in op) {
53246
- this.findItemAndApply(op.item, (item2) => {
53247
- item2.apply(op);
53248
+ this.findItemAndApply(op.item, (item) => {
53249
+ item.apply(op);
53248
53250
  });
53249
53251
  }
53250
53252
  }
53251
- findItemAndApply(item2, apply) {
53252
- if (Array.isArray(item2)) {
53253
- for (const itemId of item2) {
53253
+ findItemAndApply(item, apply) {
53254
+ if (Array.isArray(item)) {
53255
+ for (const itemId of item) {
53254
53256
  const found = this.items.findById(itemId);
53255
53257
  if (found) {
53256
53258
  apply(found);
53257
53259
  }
53258
53260
  }
53259
53261
  } else {
53260
- const found = this.items.findById(item2);
53262
+ const found = this.items.findById(item);
53261
53263
  if (found) {
53262
53264
  apply(found);
53263
53265
  }
@@ -53266,9 +53268,9 @@ class Board {
53266
53268
  handleNesting(items) {
53267
53269
  const arrayed = Array.isArray(items) ? items : [items];
53268
53270
  const groupsMap = new Map;
53269
- arrayed.forEach((item2) => {
53270
- const itemCenter = item2.getMbr().getCenter();
53271
- const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item2)).reduce((acc, groupItem2) => {
53271
+ arrayed.forEach((item) => {
53272
+ const itemCenter = item.getMbr().getCenter();
53273
+ const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item)).reduce((acc, groupItem2) => {
53272
53274
  if (!acc || groupItem2.getDistanceToPoint(itemCenter) > acc.getDistanceToPoint(itemCenter)) {
53273
53275
  acc = groupItem2;
53274
53276
  }
@@ -53278,7 +53280,7 @@ class Board {
53278
53280
  if (!groupsMap.has(groupItem)) {
53279
53281
  groupsMap.set(groupItem, []);
53280
53282
  }
53281
- groupsMap.get(groupItem)?.push(item2);
53283
+ groupsMap.get(groupItem)?.push(item);
53282
53284
  }
53283
53285
  });
53284
53286
  groupsMap.forEach((items2, group) => {
@@ -53299,13 +53301,13 @@ class Board {
53299
53301
  }
53300
53302
  return parser(el);
53301
53303
  }
53302
- add(item2, timeStamp) {
53304
+ add(item, timeStamp) {
53303
53305
  const id = this.getNewItemId();
53304
53306
  this.emit({
53305
53307
  class: "Board",
53306
53308
  method: "add",
53307
53309
  item: id,
53308
- data: item2.serialize(),
53310
+ data: item.serialize(),
53309
53311
  timeStamp
53310
53312
  });
53311
53313
  const newItem = this.items.getById(id);
@@ -53315,13 +53317,13 @@ class Board {
53315
53317
  this.handleNesting(newItem);
53316
53318
  return newItem;
53317
53319
  }
53318
- addLockedGroup(item2) {
53320
+ addLockedGroup(item) {
53319
53321
  const id = this.getNewItemId();
53320
53322
  this.emit({
53321
53323
  class: "Board",
53322
53324
  method: "addLockedGroup",
53323
53325
  item: id,
53324
- data: item2.serialize()
53326
+ data: item.serialize()
53325
53327
  });
53326
53328
  const newItem = this.items.getById(id);
53327
53329
  if (!newItem) {
@@ -53330,32 +53332,32 @@ class Board {
53330
53332
  this.handleNesting(newItem);
53331
53333
  return newItem;
53332
53334
  }
53333
- remove(item2, withConnectors = true) {
53335
+ remove(item, withConnectors = true) {
53334
53336
  let connectors = [];
53335
53337
  if (withConnectors) {
53336
- connectors = this.items.getLinkedConnectorsById(item2.getId()).map((connector) => connector.getId());
53338
+ connectors = this.items.getLinkedConnectorsById(item.getId()).map((connector) => connector.getId());
53337
53339
  }
53338
- if ("onRemove" in item2) {
53339
- item2.onRemove();
53340
+ if ("onRemove" in item) {
53341
+ item.onRemove();
53340
53342
  }
53341
53343
  this.emit({
53342
53344
  class: "Board",
53343
53345
  method: "remove",
53344
- item: [item2.getId(), ...connectors]
53346
+ item: [item.getId(), ...connectors]
53345
53347
  });
53346
53348
  }
53347
- removeLockedGroup(item2) {
53349
+ removeLockedGroup(item) {
53348
53350
  this.emit({
53349
53351
  class: "Board",
53350
53352
  method: "removeLockedGroup",
53351
- item: [item2.getId()]
53353
+ item: [item.getId()]
53352
53354
  });
53353
53355
  }
53354
53356
  getByZIndex(index2) {
53355
53357
  return this.index.getByZIndex(index2);
53356
53358
  }
53357
- getZIndex(item2) {
53358
- return this.index.getZIndex(item2);
53359
+ getZIndex(item) {
53360
+ return this.index.getZIndex(item);
53359
53361
  }
53360
53362
  getLastZIndex() {
53361
53363
  return this.index.getLastZIndex();
@@ -53367,11 +53369,11 @@ class Board {
53367
53369
  item: items
53368
53370
  });
53369
53371
  }
53370
- moveToZIndex(item2, zIndex) {
53372
+ moveToZIndex(item, zIndex) {
53371
53373
  this.emit({
53372
53374
  class: "Board",
53373
53375
  method: "moveToZIndex",
53374
- item: item2.getId(),
53376
+ item: item.getId(),
53375
53377
  zIndex
53376
53378
  });
53377
53379
  }
@@ -53399,8 +53401,8 @@ class Board {
53399
53401
  this.emit({
53400
53402
  class: "Board",
53401
53403
  method: "bringToFront",
53402
- item: items.map((item2) => item2.getId()),
53403
- prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
53404
+ item: items.map((item) => item.getId()),
53405
+ prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
53404
53406
  });
53405
53407
  }
53406
53408
  sendToBack(items) {
@@ -53411,8 +53413,8 @@ class Board {
53411
53413
  this.emit({
53412
53414
  class: "Board",
53413
53415
  method: "sendToBack",
53414
- item: items.map((item2) => item2.getId()),
53415
- prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
53416
+ item: items.map((item) => item.getId()),
53417
+ prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
53416
53418
  });
53417
53419
  }
53418
53420
  copy() {
@@ -53489,7 +53491,7 @@ class Board {
53489
53491
  return added;
53490
53492
  });
53491
53493
  addedFrame.addChildItems(addedChildren);
53492
- parsedData.data.children = addedChildren.map((item2) => item2.getId());
53494
+ parsedData.data.children = addedChildren.map((item) => item.getId());
53493
53495
  idsMap[parsedData.data.id] = addedFrame.getId();
53494
53496
  } else {
53495
53497
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
@@ -53530,15 +53532,15 @@ class Board {
53530
53532
  const createdConnectors = {};
53531
53533
  const createdFrames = {};
53532
53534
  const addItem = (itemData) => {
53533
- const item2 = this.createItem(itemData.id, itemData);
53534
- if (item2 instanceof Connector2) {
53535
- createdConnectors[itemData.id] = { item: item2, itemData };
53535
+ const item = this.createItem(itemData.id, itemData);
53536
+ if (item instanceof Connector2) {
53537
+ createdConnectors[itemData.id] = { item, itemData };
53536
53538
  }
53537
- if (item2 instanceof Frame2) {
53538
- createdFrames[item2.getId()] = { item: item2, itemData };
53539
+ if (item instanceof Frame2) {
53540
+ createdFrames[item.getId()] = { item, itemData };
53539
53541
  }
53540
- this.index.insert(item2);
53541
- return item2;
53542
+ this.index.insert(item);
53543
+ return item;
53542
53544
  };
53543
53545
  for (const itemData of items) {
53544
53546
  if ("childrenMap" in itemData) {
@@ -53549,13 +53551,13 @@ class Board {
53549
53551
  }
53550
53552
  }
53551
53553
  for (const key in createdConnectors) {
53552
- const { item: item2, itemData } = createdConnectors[key];
53553
- item2.applyStartPoint(itemData.startPoint);
53554
- item2.applyEndPoint(itemData.endPoint);
53554
+ const { item, itemData } = createdConnectors[key];
53555
+ item.applyStartPoint(itemData.startPoint);
53556
+ item.applyEndPoint(itemData.endPoint);
53555
53557
  }
53556
53558
  for (const key in createdFrames) {
53557
- const { item: item2, itemData } = createdFrames[key];
53558
- item2.applyAddChildren(itemData.children);
53559
+ const { item, itemData } = createdFrames[key];
53560
+ item.applyAddChildren(itemData.children);
53559
53561
  }
53560
53562
  }
53561
53563
  deserialize(snapshot) {
@@ -53565,33 +53567,33 @@ class Board {
53565
53567
  const createdFrames = {};
53566
53568
  if (Array.isArray(items)) {
53567
53569
  for (const itemData of items) {
53568
- const item2 = this.createItem(itemData.id, itemData);
53569
- if (item2 instanceof Connector2) {
53570
- createdConnectors[itemData.id] = { item: item2, itemData };
53570
+ const item = this.createItem(itemData.id, itemData);
53571
+ if (item instanceof Connector2) {
53572
+ createdConnectors[itemData.id] = { item, itemData };
53571
53573
  }
53572
- if (item2 instanceof Frame2) {
53573
- createdFrames[item2.getId()] = { item: item2, itemData };
53574
+ if (item instanceof Frame2) {
53575
+ createdFrames[item.getId()] = { item, itemData };
53574
53576
  }
53575
- this.index.insert(item2);
53577
+ this.index.insert(item);
53576
53578
  }
53577
53579
  } else {
53578
53580
  for (const key in items) {
53579
53581
  const itemData = items[key];
53580
- const item2 = this.createItem(key, itemData);
53581
- if (item2 instanceof Connector2) {
53582
- createdConnectors[key] = { item: item2, itemData };
53582
+ const item = this.createItem(key, itemData);
53583
+ if (item instanceof Connector2) {
53584
+ createdConnectors[key] = { item, itemData };
53583
53585
  }
53584
- this.index.insert(item2);
53586
+ this.index.insert(item);
53585
53587
  }
53586
53588
  }
53587
53589
  for (const key in createdConnectors) {
53588
- const { item: item2, itemData } = createdConnectors[key];
53589
- item2.applyStartPoint(itemData.startPoint);
53590
- item2.applyEndPoint(itemData.endPoint);
53590
+ const { item, itemData } = createdConnectors[key];
53591
+ item.applyStartPoint(itemData.startPoint);
53592
+ item.applyEndPoint(itemData.endPoint);
53591
53593
  }
53592
53594
  for (const key in createdFrames) {
53593
- const { item: item2, itemData } = createdFrames[key];
53594
- item2.applyAddChildren(itemData.children);
53595
+ const { item, itemData } = createdFrames[key];
53596
+ item.applyAddChildren(itemData.children);
53595
53597
  }
53596
53598
  this.events?.log.deserialize(events);
53597
53599
  }
@@ -53829,7 +53831,7 @@ class Board {
53829
53831
  itemsMap: newMap,
53830
53832
  select: select2
53831
53833
  });
53832
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
53834
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
53833
53835
  this.handleNesting(items);
53834
53836
  this.selection.removeAll();
53835
53837
  this.selection.add(items);
@@ -53837,8 +53839,8 @@ class Board {
53837
53839
  return;
53838
53840
  }
53839
53841
  removeVoidComments() {
53840
- const voidComments = this.items.listAll().filter((item2) => {
53841
- return item2 instanceof Comment && !item2.getThread().length;
53842
+ const voidComments = this.items.listAll().filter((item) => {
53843
+ return item instanceof Comment && !item.getThread().length;
53842
53844
  });
53843
53845
  if (voidComments) {
53844
53846
  for (const comment2 of voidComments) {
@@ -53912,7 +53914,7 @@ class Board {
53912
53914
  }
53913
53915
  const mbr = this.selection.getMbr();
53914
53916
  const selectedItems = this.selection.items.list();
53915
- const isSelectedItemsMinWidth = selectedItems.some((item2) => item2.getMbr().getWidth() === 0);
53917
+ const isSelectedItemsMinWidth = selectedItems.some((item) => item.getMbr().getWidth() === 0);
53916
53918
  const right = mbr ? mbr.right : 0;
53917
53919
  const top = mbr ? mbr.top : 0;
53918
53920
  const width2 = mbr ? mbr.getWidth() / 10 : 10;
@@ -53954,7 +53956,7 @@ class Board {
53954
53956
  method: "duplicate",
53955
53957
  itemsMap: newMap
53956
53958
  });
53957
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
53959
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
53958
53960
  this.handleNesting(items);
53959
53961
  this.selection.removeAll();
53960
53962
  this.selection.add(items);
@@ -53975,9 +53977,9 @@ class Board {
53975
53977
  if (data.itemType === "Frame") {
53976
53978
  data.text.placeholderText = `Frame ${this.getMaxFrameSerial() + 1}`;
53977
53979
  }
53978
- const item2 = this.createItem(itemId, data);
53979
- this.index.insert(item2);
53980
- items.push(item2);
53980
+ const item = this.createItem(itemId, data);
53981
+ this.index.insert(item);
53982
+ items.push(item);
53981
53983
  };
53982
53984
  sortedItemsMap.map(([id, data]) => {
53983
53985
  if (data.itemType === "Connector") {
@@ -53992,8 +53994,8 @@ class Board {
53992
53994
  return;
53993
53995
  });
53994
53996
  }
53995
- isOnBoard(item2) {
53996
- return this.items.findById(item2.getId()) !== undefined;
53997
+ isOnBoard(item) {
53998
+ return this.items.findById(item.getId()) !== undefined;
53997
53999
  }
53998
54000
  getMaxFrameSerial() {
53999
54001
  const existingNames = this.items.listGroupItems().map((frame) => frame.getRichText()?.getTextString().length === 0 ? frame.getRichText()?.placeholderText || "" : frame.getRichText()?.getTextString() || "");
@@ -54039,7 +54041,7 @@ function areItemsTheSame(opA, opB) {
54039
54041
  const itemsB = Object.keys(opB.items);
54040
54042
  const setA = new Set(itemsA);
54041
54043
  const setB = new Set(itemsB);
54042
- const areArraysEqual = setA.size === setB.size && [...setA].every((item2) => setB.has(item2));
54044
+ const areArraysEqual = setA.size === setB.size && [...setA].every((item) => setB.has(item));
54043
54045
  return areArraysEqual;
54044
54046
  }
54045
54047
  if (!(Array.isArray(opA.item) && Array.isArray(opB.item))) {
@@ -55698,9 +55700,9 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
55698
55700
  list6.applyUnconfirmed(filter);
55699
55701
  const hasAnyOverlap = (arr1, arr2) => {
55700
55702
  const lookup9 = new Set(arr1);
55701
- return arr2.some((item2) => lookup9.has(item2));
55703
+ return arr2.some((item) => lookup9.has(item));
55702
55704
  };
55703
- const currSelection = board.selection.list().map((item2) => item2.getId());
55705
+ const currSelection = board.selection.list().map((item) => item.getId());
55704
55706
  if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
55705
55707
  board.selection.applyMemoizedCaretOrRange();
55706
55708
  }
@@ -56022,27 +56024,27 @@ function handleAiChatMassage(message, board) {
56022
56024
  }
56023
56025
  }
56024
56026
  function handleChatChunk(chunk, board) {
56025
- const item2 = board.items.getById(chunk.itemId);
56027
+ const item = board.items.getById(chunk.itemId);
56026
56028
  switch (chunk.type) {
56027
56029
  case "chunk":
56028
- if (!item2 || item2.itemType !== "AINode") {
56030
+ if (!item || item.itemType !== "AINode") {
56029
56031
  return;
56030
56032
  }
56031
- item2.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
56033
+ item.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
56032
56034
  break;
56033
56035
  case "done":
56034
- if (!item2 || item2.itemType !== "AINode") {
56036
+ if (!item || item.itemType !== "AINode") {
56035
56037
  board.aiGeneratingOnItem = undefined;
56036
56038
  return;
56037
56039
  }
56038
- item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56040
+ item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56039
56041
  break;
56040
56042
  case "end":
56041
- if (!item2 || item2.itemType !== "AINode") {
56043
+ if (!item || item.itemType !== "AINode") {
56042
56044
  board.aiGeneratingOnItem = undefined;
56043
56045
  return;
56044
56046
  }
56045
- item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56047
+ item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56046
56048
  break;
56047
56049
  case "error":
56048
56050
  default:
@@ -56059,7 +56061,7 @@ function handleChatChunk(chunk, board) {
56059
56061
  if (board.aiGeneratingOnItem && generatingItem) {
56060
56062
  board.selection.removeAll();
56061
56063
  board.selection.add(generatingItem);
56062
- const rt = item2?.getRichText();
56064
+ const rt = item?.getRichText();
56063
56065
  if (generatingItem.itemType === "AINode" && rt) {
56064
56066
  const editor = rt.editor;
56065
56067
  editor.markdownProcessor.setStopProcessingMarkDownCb(null);
@@ -56192,14 +56194,14 @@ function handleImageGenerate(response, board) {
56192
56194
  console.error("Image generation error:", response.message);
56193
56195
  if (response.isExternalApiError) {
56194
56196
  if (board.aiGeneratingOnItem) {
56195
- const item2 = board.items.getById(board.aiGeneratingOnItem);
56196
- if (item2) {
56197
+ const item = board.items.getById(board.aiGeneratingOnItem);
56198
+ if (item) {
56197
56199
  board.selection.removeAll();
56198
- board.selection.add(item2);
56199
- const editor = item2.getRichText()?.editor;
56200
+ board.selection.add(item);
56201
+ const editor = item.getRichText()?.editor;
56200
56202
  editor?.clearText();
56201
56203
  editor?.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
56202
- board.camera.zoomToFit(item2.getMbr(), 20);
56204
+ board.camera.zoomToFit(item.getMbr(), 20);
56203
56205
  }
56204
56206
  }
56205
56207
  } else {