microboard-temp 0.4.59 → 0.4.61

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,34 +19321,51 @@ 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) => {
19334
- const op = this.operation;
19335
- let newData = {};
19336
- if (op.prevData) {
19337
- newData = { ...op.prevData };
19338
- } else {
19339
- Object.keys(op.newData).forEach((key) => {
19340
- if (item2[key]) {
19341
- newData[key] = item2[key];
19335
+ switch (this.operation.method) {
19336
+ case "addChildren":
19337
+ return mapItemsByOperation(items, (item) => {
19338
+ return {
19339
+ ...this.operation,
19340
+ newData: { childIds: item.getChildrenIds() }
19341
+ };
19342
+ });
19343
+ case "removeChildren":
19344
+ return mapItemsByOperation(items, (item) => {
19345
+ return {
19346
+ ...this.operation,
19347
+ newData: { childIds: item.getChildrenIds() }
19348
+ };
19349
+ });
19350
+ default:
19351
+ return mapItemsByOperation(items, (item) => {
19352
+ const op = this.operation;
19353
+ let newData = {};
19354
+ if (op.prevData) {
19355
+ newData = { ...op.prevData };
19356
+ } else {
19357
+ Object.keys(op.newData).forEach((key) => {
19358
+ if (item[key]) {
19359
+ newData[key] = item[key];
19360
+ }
19361
+ });
19342
19362
  }
19363
+ return {
19364
+ ...op,
19365
+ newData
19366
+ };
19343
19367
  });
19344
- }
19345
- return {
19346
- ...op,
19347
- newData
19348
- };
19349
- });
19368
+ }
19350
19369
  }
19351
19370
  }
19352
19371
  var itemCommandFactories = {
@@ -19366,37 +19385,37 @@ var itemCommandFactories = {
19366
19385
  LinkTo: createLinkToCommand
19367
19386
  };
19368
19387
  function createConnectorCommand(items, operation) {
19369
- return new ConnectorCommand(items.filter((item2) => item2.itemType === "Connector"), operation);
19388
+ return new ConnectorCommand(items.filter((item) => item.itemType === "Connector"), operation);
19370
19389
  }
19371
19390
  function createShapeCommand(items, operation) {
19372
- return new ShapeCommand(items.filter((item2) => item2.itemType === "Shape"), operation);
19391
+ return new ShapeCommand(items.filter((item) => item.itemType === "Shape"), operation);
19373
19392
  }
19374
19393
  function createDrawingCommand(items, operation) {
19375
- return new DrawingCommand(items.filter((item2) => item2.itemType === "Drawing"), operation);
19394
+ return new DrawingCommand(items.filter((item) => item.itemType === "Drawing"), operation);
19376
19395
  }
19377
19396
  function createCommentCommand(items, operation) {
19378
- return new CommentCommand(items.filter((item2) => item2.itemType === "Comment"), operation);
19397
+ return new CommentCommand(items.filter((item) => item.itemType === "Comment"), operation);
19379
19398
  }
19380
19399
  function createStickerCommand(items, operation) {
19381
- return new StickerCommand(items.filter((item2) => item2.itemType === "Sticker"), operation);
19400
+ return new StickerCommand(items.filter((item) => item.itemType === "Sticker"), operation);
19382
19401
  }
19383
19402
  function createFrameCommand(items, operation) {
19384
- return new FrameCommand(items.filter((item2) => item2.itemType === "Frame"), operation);
19403
+ return new FrameCommand(items.filter((item) => item.itemType === "Frame"), operation);
19385
19404
  }
19386
19405
  function createPlaceholderCommand(items, operation) {
19387
- return new PlaceholderCommand(items.filter((item2) => item2.itemType === "Placeholder"), operation);
19406
+ return new PlaceholderCommand(items.filter((item) => item.itemType === "Placeholder"), operation);
19388
19407
  }
19389
19408
  function createGroupCommand(items, operation) {
19390
- return new GroupCommand(items.filter((item2) => item2.itemType === "Group"), operation);
19409
+ return new GroupCommand(items.filter((item) => item.itemType === "Group"), operation);
19391
19410
  }
19392
19411
  function createImageCommand(items, operation) {
19393
- return new ImageCommand(items.filter((item2) => item2.itemType === "Image"), operation);
19412
+ return new ImageCommand(items.filter((item) => item.itemType === "Image"), operation);
19394
19413
  }
19395
19414
  function createVideoCommand(items, operation) {
19396
- return new VideoCommand(items.filter((item2) => item2.itemType === "Video"), operation);
19415
+ return new VideoCommand(items.filter((item) => item.itemType === "Video"), operation);
19397
19416
  }
19398
19417
  function createAudioCommand(items, operation) {
19399
- return new AudioCommand(items.filter((item2) => item2.itemType === "Audio"), operation);
19418
+ return new AudioCommand(items.filter((item) => item.itemType === "Audio"), operation);
19400
19419
  }
19401
19420
  function createRichTextCommand(items, operation, board) {
19402
19421
  if (!board) {
@@ -19404,8 +19423,8 @@ function createRichTextCommand(items, operation, board) {
19404
19423
  }
19405
19424
  if (operation.method === "groupEdit") {
19406
19425
  const texts = [];
19407
- for (const { item: item2 } of operation.itemsOps) {
19408
- const found = board.items.findById(item2);
19426
+ for (const { item } of operation.itemsOps) {
19427
+ const found = board.items.findById(item);
19409
19428
  const text3 = found?.getRichText();
19410
19429
  if (text3) {
19411
19430
  texts.push(text3);
@@ -19413,14 +19432,14 @@ function createRichTextCommand(items, operation, board) {
19413
19432
  }
19414
19433
  return new RichTextGroupCommand(texts, operation);
19415
19434
  } else {
19416
- return new RichTextCommand(board, items.map((item2) => item2.getId()), operation);
19435
+ return new RichTextCommand(board, items.map((item) => item.getId()), operation);
19417
19436
  }
19418
19437
  }
19419
19438
  function createTransformationCommand(items, operation) {
19420
- return new TransformationCommand(items.map((item2) => item2.transformation), operation);
19439
+ return new TransformationCommand(items.map((item) => item.transformation), operation);
19421
19440
  }
19422
19441
  function createLinkToCommand(items, operation) {
19423
- return new LinkToCommand(items.map((item2) => item2.linkTo), operation);
19442
+ return new LinkToCommand(items.map((item) => item.linkTo), operation);
19424
19443
  }
19425
19444
  function createCommand(board, operation) {
19426
19445
  try {
@@ -19438,13 +19457,13 @@ function createCommand(board, operation) {
19438
19457
  default: {
19439
19458
  const itemType = operation.class;
19440
19459
  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}`);
19460
+ const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item) => {
19461
+ if (typeof item === "string") {
19462
+ console.warn(`Item with ID ${item} not found for operation ${operation.class}.${operation.method}`);
19444
19463
  return false;
19445
19464
  }
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}.`);
19465
+ if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item.itemType !== operation.class) {
19466
+ console.warn(`Item with ID ${item} is not of operation type: ${itemType}.`);
19448
19467
  return false;
19449
19468
  }
19450
19469
  return true;
@@ -19745,20 +19764,20 @@ class RBush {
19745
19764
  }
19746
19765
  return this;
19747
19766
  }
19748
- insert(item2) {
19749
- if (item2)
19750
- this._insert(item2, this.data.height - 1);
19767
+ insert(item) {
19768
+ if (item)
19769
+ this._insert(item, this.data.height - 1);
19751
19770
  return this;
19752
19771
  }
19753
19772
  clear() {
19754
19773
  this.data = createNode([]);
19755
19774
  return this;
19756
19775
  }
19757
- remove(item2, equalsFn) {
19758
- if (!item2)
19776
+ remove(item, equalsFn) {
19777
+ if (!item)
19759
19778
  return this;
19760
19779
  let node2 = this.data;
19761
- const bbox = this.toBBox(item2);
19780
+ const bbox = this.toBBox(item);
19762
19781
  const path2 = [];
19763
19782
  const indexes = [];
19764
19783
  let i, parent, goingUp;
@@ -19770,7 +19789,7 @@ class RBush {
19770
19789
  goingUp = true;
19771
19790
  }
19772
19791
  if (node2.leaf) {
19773
- const index2 = findItem(item2, node2.children, equalsFn);
19792
+ const index2 = findItem(item, node2.children, equalsFn);
19774
19793
  if (index2 !== -1) {
19775
19794
  node2.children.splice(index2, 1);
19776
19795
  path2.push(node2);
@@ -19793,8 +19812,8 @@ class RBush {
19793
19812
  }
19794
19813
  return this;
19795
19814
  }
19796
- toBBox(item2) {
19797
- return item2;
19815
+ toBBox(item) {
19816
+ return item;
19798
19817
  }
19799
19818
  compareMinX(a, b) {
19800
19819
  return a.minX - b.minX;
@@ -19877,11 +19896,11 @@ class RBush {
19877
19896
  }
19878
19897
  return node2;
19879
19898
  }
19880
- _insert(item2, level, isNode) {
19881
- const bbox = isNode ? item2 : this.toBBox(item2);
19899
+ _insert(item, level, isNode) {
19900
+ const bbox = isNode ? item : this.toBBox(item);
19882
19901
  const insertPath = [];
19883
19902
  const node2 = this._chooseSubtree(bbox, this.data, level, insertPath);
19884
- node2.children.push(item2);
19903
+ node2.children.push(item);
19885
19904
  extend2(node2, bbox);
19886
19905
  while (level >= 0) {
19887
19906
  if (insertPath[level].children.length > this._maxEntries) {
@@ -19980,11 +19999,11 @@ class RBush {
19980
19999
  }
19981
20000
  }
19982
20001
  }
19983
- function findItem(item2, items, equalsFn) {
20002
+ function findItem(item, items, equalsFn) {
19984
20003
  if (!equalsFn)
19985
- return items.indexOf(item2);
20004
+ return items.indexOf(item);
19986
20005
  for (let i = 0;i < items.length; i++) {
19987
- if (equalsFn(item2, items[i]))
20006
+ if (equalsFn(item, items[i]))
19988
20007
  return i;
19989
20008
  }
19990
20009
  return -1;
@@ -20075,8 +20094,8 @@ class TinyQueue {
20075
20094
  this._down(i);
20076
20095
  }
20077
20096
  }
20078
- push(item2) {
20079
- this.data.push(item2);
20097
+ push(item) {
20098
+ this.data.push(item);
20080
20099
  this.length++;
20081
20100
  this._up(this.length - 1);
20082
20101
  }
@@ -20097,21 +20116,21 @@ class TinyQueue {
20097
20116
  }
20098
20117
  _up(pos) {
20099
20118
  const { data, compare } = this;
20100
- const item2 = data[pos];
20119
+ const item = data[pos];
20101
20120
  while (pos > 0) {
20102
20121
  const parent = pos - 1 >> 1;
20103
20122
  const current = data[parent];
20104
- if (compare(item2, current) >= 0)
20123
+ if (compare(item, current) >= 0)
20105
20124
  break;
20106
20125
  data[pos] = current;
20107
20126
  pos = parent;
20108
20127
  }
20109
- data[pos] = item2;
20128
+ data[pos] = item;
20110
20129
  }
20111
20130
  _down(pos) {
20112
20131
  const { data, compare } = this;
20113
20132
  const halfLength = this.length >> 1;
20114
- const item2 = data[pos];
20133
+ const item = data[pos];
20115
20134
  while (pos < halfLength) {
20116
20135
  let left = (pos << 1) + 1;
20117
20136
  let best = data[left];
@@ -20120,12 +20139,12 @@ class TinyQueue {
20120
20139
  left = right;
20121
20140
  best = data[right];
20122
20141
  }
20123
- if (compare(best, item2) >= 0)
20142
+ if (compare(best, item) >= 0)
20124
20143
  break;
20125
20144
  data[pos] = best;
20126
20145
  pos = left;
20127
20146
  }
20128
- data[pos] = item2;
20147
+ data[pos] = item;
20129
20148
  }
20130
20149
  }
20131
20150
  function defaultCompare2(a, b) {
@@ -20213,10 +20232,10 @@ class RTreeIndex {
20213
20232
  return container ? container.item : undefined;
20214
20233
  }
20215
20234
  remove(id) {
20216
- const item2 = this.map.get(id);
20217
- if (item2) {
20235
+ const item = this.map.get(id);
20236
+ if (item) {
20218
20237
  this.map.delete(id);
20219
- this.tree.remove(item2);
20238
+ this.tree.remove(item);
20220
20239
  }
20221
20240
  }
20222
20241
  list() {
@@ -20288,11 +20307,11 @@ class Container extends Mbr {
20288
20307
  item;
20289
20308
  layer;
20290
20309
  zIndex;
20291
- constructor(id, item2, layer, zIndex) {
20292
- const rect = item2.getMbrWithChildren();
20310
+ constructor(id, item, layer, zIndex) {
20311
+ const rect = item.getMbrWithChildren();
20293
20312
  super(rect.left, rect.top, rect.right, rect.bottom);
20294
20313
  this.id = id;
20295
- this.item = item2;
20314
+ this.item = item;
20296
20315
  this.layer = layer;
20297
20316
  this.zIndex = zIndex;
20298
20317
  }
@@ -20309,7 +20328,7 @@ class LayeredIndex {
20309
20328
  this.getZIndex = this.getZIndex.bind(this);
20310
20329
  this.layers.newOnTop();
20311
20330
  }
20312
- isT(item2) {
20331
+ isT(item) {
20313
20332
  return true;
20314
20333
  }
20315
20334
  findById(id) {
@@ -20373,8 +20392,8 @@ class LayeredIndex {
20373
20392
  }
20374
20393
  getContainersFromItems(items) {
20375
20394
  const containers = [];
20376
- for (const item2 of items) {
20377
- const container = this.map.get(item2.getId());
20395
+ for (const item of items) {
20396
+ const container = this.map.get(item.getId());
20378
20397
  if (container) {
20379
20398
  containers.push(container);
20380
20399
  }
@@ -20451,9 +20470,9 @@ class LayeredIndex {
20451
20470
  }
20452
20471
  }
20453
20472
  }
20454
- insert(item2) {
20455
- const toInsert = new Container(item2.getId(), item2, 0, this.getZIndex(item2));
20456
- const bounds = item2.getMbrWithChildren();
20473
+ insert(item) {
20474
+ const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
20475
+ const bounds = item.getMbrWithChildren();
20457
20476
  const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
20458
20477
  if (inBounds.length === 0) {
20459
20478
  return this.insertContainer(toInsert);
@@ -20520,20 +20539,20 @@ class LayeredIndex {
20520
20539
  }
20521
20540
  }
20522
20541
  }
20523
- change(item2) {
20524
- const id = item2.getId();
20542
+ change(item) {
20543
+ const id = item.getId();
20525
20544
  const container = this.map.get(id);
20526
20545
  if (container) {
20527
20546
  const layer = this.layers.get(container.layer);
20528
20547
  if (layer) {
20529
20548
  layer.remove(id);
20530
20549
  this.map.delete(id);
20531
- this.insert(item2);
20550
+ this.insert(item);
20532
20551
  }
20533
20552
  }
20534
20553
  }
20535
- remove(item2) {
20536
- const id = item2.getId();
20554
+ remove(item) {
20555
+ const id = item.getId();
20537
20556
  const container = this.map.get(id);
20538
20557
  if (container) {
20539
20558
  const layer = this.layers.get(container.layer);
@@ -20559,13 +20578,13 @@ class LayeredIndex {
20559
20578
  return items;
20560
20579
  }
20561
20580
  batchInsert(items) {
20562
- for (const item2 of items) {
20563
- this.insert(item2);
20581
+ for (const item of items) {
20582
+ this.insert(item);
20564
20583
  }
20565
20584
  }
20566
20585
  batchChange(items) {
20567
- for (const item2 of items) {
20568
- this.change(item2);
20586
+ for (const item of items) {
20587
+ this.change(item);
20569
20588
  }
20570
20589
  }
20571
20590
  }
@@ -20574,8 +20593,8 @@ class LayeredIndex {
20574
20593
  class SpatialIndex {
20575
20594
  subject = new Subject;
20576
20595
  itemsArray = [];
20577
- itemsIndex = new LayeredIndex((item2) => {
20578
- return this.itemsArray.indexOf(item2);
20596
+ itemsIndex = new LayeredIndex((item) => {
20597
+ return this.itemsArray.indexOf(item);
20579
20598
  });
20580
20599
  Mbr = new Mbr;
20581
20600
  items;
@@ -20584,79 +20603,79 @@ class SpatialIndex {
20584
20603
  }
20585
20604
  clear() {
20586
20605
  this.itemsArray = [];
20587
- this.itemsIndex = new LayeredIndex((item2) => {
20588
- return this.itemsArray.indexOf(item2);
20606
+ this.itemsIndex = new LayeredIndex((item) => {
20607
+ return this.itemsArray.indexOf(item);
20589
20608
  });
20590
20609
  this.Mbr = new Mbr;
20591
20610
  }
20592
- insert(item2) {
20593
- this.itemsArray.push(item2);
20594
- this.itemsIndex.insert(item2);
20611
+ insert(item) {
20612
+ this.itemsArray.push(item);
20613
+ this.itemsIndex.insert(item);
20595
20614
  if (conf.isNode()) {
20596
20615
  return;
20597
20616
  }
20598
20617
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
20599
- this.Mbr = item2.getMbr().copy();
20618
+ this.Mbr = item.getMbr().copy();
20600
20619
  } else {
20601
- this.Mbr.combine([item2.getMbr()]);
20620
+ this.Mbr.combine([item.getMbr()]);
20602
20621
  }
20603
- item2.subject.subscribe(this.change);
20622
+ item.subject.subscribe(this.change);
20604
20623
  this.subject.publish(this.items);
20605
20624
  }
20606
- change = (item2) => {
20607
- this.itemsIndex.change(item2);
20625
+ change = (item) => {
20626
+ this.itemsIndex.change(item);
20608
20627
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
20609
- this.Mbr = item2.getMbrWithChildren().copy();
20628
+ this.Mbr = item.getMbrWithChildren().copy();
20610
20629
  } else {
20611
- this.Mbr.combine([item2.getMbrWithChildren()]);
20630
+ this.Mbr.combine([item.getMbrWithChildren()]);
20612
20631
  }
20613
20632
  this.subject.publish(this.items);
20614
20633
  };
20615
- remove(item2) {
20616
- if ("index" in item2 && item2.index) {
20617
- item2.removeChildItems(item2.index.list());
20634
+ remove(item) {
20635
+ if ("index" in item && item.index) {
20636
+ item.removeChildItems(item.index.list());
20618
20637
  }
20619
- this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
20620
- this.itemsIndex.remove(item2);
20638
+ this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
20639
+ this.itemsIndex.remove(item);
20621
20640
  this.Mbr = new Mbr;
20622
- this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbrWithChildren()]));
20641
+ this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbrWithChildren()]));
20623
20642
  this.subject.publish(this.items);
20624
20643
  }
20625
20644
  copy() {
20626
- return this.getItemsWithIncludedChildren(this.itemsArray).map((item2) => ({
20627
- ...item2.serialize(true),
20628
- id: item2.getId()
20645
+ return this.getItemsWithIncludedChildren(this.itemsArray).map((item) => ({
20646
+ ...item.serialize(true),
20647
+ id: item.getId()
20629
20648
  }));
20630
20649
  }
20631
20650
  getItemsWithIncludedChildren(items) {
20632
- return items.flatMap((item2) => {
20633
- if ("index" in item2 && item2.index) {
20634
- return [item2, ...item2.index.list()];
20651
+ return items.flatMap((item) => {
20652
+ if ("index" in item && item.index) {
20653
+ return [item, ...item.index.list()];
20635
20654
  }
20636
- return item2;
20655
+ return item;
20637
20656
  });
20638
20657
  }
20639
- getItemChildren(item2) {
20640
- if ("index" in item2 && item2.index) {
20641
- return item2.index.list();
20658
+ getItemChildren(item) {
20659
+ if ("index" in item && item.index) {
20660
+ return item.index.list();
20642
20661
  }
20643
20662
  return [];
20644
20663
  }
20645
- getItemParent(item2) {
20646
- if (item2.parent === "Board") {
20664
+ getItemParent(item) {
20665
+ if (item.parent === "Board") {
20647
20666
  return;
20648
20667
  }
20649
- return this.getById(item2.parent);
20668
+ return this.getById(item.parent);
20650
20669
  }
20651
- moveToZIndex(item2, zIndex) {
20652
- const index2 = this.itemsArray.indexOf(item2);
20670
+ moveToZIndex(item, zIndex) {
20671
+ const index2 = this.itemsArray.indexOf(item);
20653
20672
  this.itemsArray.splice(index2, 1);
20654
- this.itemsArray.splice(zIndex, 0, item2);
20655
- this.change(item2);
20673
+ this.itemsArray.splice(zIndex, 0, item);
20674
+ this.change(item);
20656
20675
  this.subject.publish(this.items);
20657
20676
  }
20658
20677
  moveManyToZIndex(itemsRecord) {
20659
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
20678
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
20660
20679
  const zIndex = Object.values(itemsRecord);
20661
20680
  for (let i = 0;i < zIndex.length; i++) {
20662
20681
  const index2 = zIndex[i];
@@ -20664,39 +20683,39 @@ class SpatialIndex {
20664
20683
  }
20665
20684
  this.itemsArray.forEach(this.change.bind(this));
20666
20685
  }
20667
- sendToBack(item2, shouldPublish = true) {
20668
- const index2 = this.itemsArray.indexOf(item2);
20686
+ sendToBack(item, shouldPublish = true) {
20687
+ const index2 = this.itemsArray.indexOf(item);
20669
20688
  this.itemsArray.splice(index2, 1);
20670
- this.itemsArray.unshift(item2);
20671
- this.itemsIndex.change(item2);
20689
+ this.itemsArray.unshift(item);
20690
+ this.itemsIndex.change(item);
20672
20691
  if (shouldPublish) {
20673
20692
  this.subject.publish(this.items);
20674
20693
  }
20675
20694
  }
20676
20695
  sendManyToBack(items) {
20677
20696
  const newItems = [...items];
20678
- this.itemsArray.forEach((item2) => {
20679
- if (!items.includes(item2)) {
20680
- newItems.push(item2);
20697
+ this.itemsArray.forEach((item) => {
20698
+ if (!items.includes(item)) {
20699
+ newItems.push(item);
20681
20700
  }
20682
20701
  });
20683
20702
  this.itemsArray = newItems;
20684
20703
  this.itemsArray.forEach(this.change.bind(this));
20685
20704
  }
20686
- bringToFront(item2, shouldPublish = true) {
20687
- const index2 = this.itemsArray.indexOf(item2);
20705
+ bringToFront(item, shouldPublish = true) {
20706
+ const index2 = this.itemsArray.indexOf(item);
20688
20707
  this.itemsArray.splice(index2, 1);
20689
- this.itemsArray.push(item2);
20690
- this.itemsIndex.change(item2);
20708
+ this.itemsArray.push(item);
20709
+ this.itemsIndex.change(item);
20691
20710
  if (shouldPublish) {
20692
20711
  this.subject.publish(this.items);
20693
20712
  }
20694
20713
  }
20695
20714
  bringManyToFront(items) {
20696
20715
  const newItems = [];
20697
- this.itemsArray.forEach((item2) => {
20698
- if (!items.includes(item2)) {
20699
- newItems.push(item2);
20716
+ this.itemsArray.forEach((item) => {
20717
+ if (!items.includes(item)) {
20718
+ newItems.push(item);
20700
20719
  }
20701
20720
  });
20702
20721
  newItems.push(...items);
@@ -20722,9 +20741,9 @@ class SpatialIndex {
20722
20741
  this.subject.publish(this.items);
20723
20742
  }
20724
20743
  getById(id) {
20725
- const item2 = this.getItemsWithIncludedChildren(this.itemsArray).find((item3) => item3.getId() === id);
20726
- if (item2) {
20727
- return item2;
20744
+ const item = this.getItemsWithIncludedChildren(this.itemsArray).find((item2) => item2.getId() === id);
20745
+ if (item) {
20746
+ return item;
20728
20747
  }
20729
20748
  }
20730
20749
  findById(id) {
@@ -20734,10 +20753,10 @@ class SpatialIndex {
20734
20753
  const mbr = new Mbr(left, top, right, bottom);
20735
20754
  const items = this.itemsIndex.getEnclosed(mbr);
20736
20755
  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)) {
20756
+ const clearItems = items.filter((item) => {
20757
+ if ("index" in item && item.index) {
20758
+ children.push(...item.index.getEnclosed(left, top, right, bottom));
20759
+ if (!item.getMbr().isEnclosedBy(mbr)) {
20741
20760
  return false;
20742
20761
  }
20743
20762
  }
@@ -20749,10 +20768,10 @@ class SpatialIndex {
20749
20768
  const mbr = new Mbr(left, top, right, bottom);
20750
20769
  const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
20751
20770
  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)) {
20771
+ const clearItems = items.filter((item) => {
20772
+ if ("index" in item && item.index) {
20773
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
20774
+ if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
20756
20775
  return false;
20757
20776
  }
20758
20777
  }
@@ -20763,10 +20782,10 @@ class SpatialIndex {
20763
20782
  getUnderPoint(point3, tolerance = 5) {
20764
20783
  const items = this.itemsIndex.getUnderPoint(point3, tolerance);
20765
20784
  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)) {
20785
+ const clearItems = items.filter((item) => {
20786
+ if ("index" in item && item.index) {
20787
+ children.push(...item.index.getUnderPoint(point3, tolerance));
20788
+ if (!item.getMbr().isUnderPoint(point3)) {
20770
20789
  return false;
20771
20790
  }
20772
20791
  }
@@ -20778,10 +20797,10 @@ class SpatialIndex {
20778
20797
  const mbr = new Mbr(left, top, right, bottom);
20779
20798
  const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
20780
20799
  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)) {
20800
+ const clearItems = items.filter((item) => {
20801
+ if ("index" in item && item.index) {
20802
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
20803
+ if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
20785
20804
  return false;
20786
20805
  }
20787
20806
  }
@@ -20793,26 +20812,26 @@ class SpatialIndex {
20793
20812
  return this.getRectsEnclosedOrCrossed(left, top, right, bottom);
20794
20813
  }
20795
20814
  getComments() {
20796
- return this.itemsArray.filter((item2) => item2 instanceof Comment);
20815
+ return this.itemsArray.filter((item) => item instanceof Comment);
20797
20816
  }
20798
20817
  getMbr() {
20799
20818
  return this.Mbr;
20800
20819
  }
20801
20820
  getNearestTo(point3, maxItems, filter, maxDistance) {
20802
20821
  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())
20822
+ const filtered = allItems.filter((item) => filter(item));
20823
+ const withDistance = filtered.map((item) => ({
20824
+ item,
20825
+ distance: point3.getDistance(item.getMbr().getCenter())
20807
20826
  })).filter(({ distance }) => distance <= maxDistance);
20808
20827
  withDistance.sort((a, b) => a.distance - b.distance);
20809
- return withDistance.slice(0, maxItems).map(({ item: item2 }) => item2);
20828
+ return withDistance.slice(0, maxItems).map(({ item }) => item);
20810
20829
  }
20811
20830
  list() {
20812
20831
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
20813
20832
  }
20814
- getZIndex(item2) {
20815
- const index2 = this.itemsArray.indexOf(item2);
20833
+ getZIndex(item) {
20834
+ const index2 = this.itemsArray.indexOf(item);
20816
20835
  if (index2 === -1) {
20817
20836
  return this.getLastZIndex();
20818
20837
  }
@@ -20842,14 +20861,14 @@ class Items {
20842
20861
  this.pointer = pointer;
20843
20862
  this.subject = subject;
20844
20863
  }
20845
- update(item2) {
20846
- this.index.change(item2);
20864
+ update(item) {
20865
+ this.index.change(item);
20847
20866
  }
20848
20867
  listAll() {
20849
20868
  return this.index.list();
20850
20869
  }
20851
20870
  listGroupItems() {
20852
- return this.index.list().filter((item2) => ("index" in item2) && item2.index);
20871
+ return this.index.list().filter((item) => ("index" in item) && item.index);
20853
20872
  }
20854
20873
  getById(id) {
20855
20874
  return this.index.getById(id);
@@ -20864,7 +20883,7 @@ class Items {
20864
20883
  return this.index.getEnclosedOrCrossed(left, top, right, bottom);
20865
20884
  }
20866
20885
  getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
20867
- return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => item2 instanceof BaseItem && item2.index);
20886
+ return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.index);
20868
20887
  }
20869
20888
  getUnderPoint(point3, tolerance = 5) {
20870
20889
  return this.index.getUnderPoint(point3, tolerance);
@@ -20892,28 +20911,28 @@ class Items {
20892
20911
  const unmodifiedSize = size;
20893
20912
  size = 16;
20894
20913
  const tolerated = this.index.getEnclosedOrCrossed(x - size, y - size, x + size, y + size);
20895
- const groups = tolerated.filter((item2) => item2.itemType === "Group");
20914
+ const groups = tolerated.filter((item) => item.itemType === "Group");
20896
20915
  if (groups.length > 0) {
20897
20916
  return groups;
20898
20917
  }
20899
- let enclosed = tolerated.some((item2) => item2 instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
20918
+ let enclosed = tolerated.some((item) => item instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
20900
20919
  const underPointer = this.getUnderPoint(new Point(x, y), size);
20901
20920
  if (enclosed.length === 0) {
20902
20921
  enclosed = underPointer;
20903
20922
  }
20904
- if (underPointer.some((item2) => item2.itemType === "Drawing")) {
20923
+ if (underPointer.some((item) => item.itemType === "Drawing")) {
20905
20924
  enclosed = [...underPointer, ...enclosed];
20906
20925
  }
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)) {
20926
+ const { nearest } = enclosed.reduce((acc, item) => {
20927
+ const area = item.getMbr().getHeight() * item.getMbr().getWidth();
20928
+ if (item.itemType === "Drawing" && !item.isPointNearLine(this.pointer.point)) {
20910
20929
  return acc;
20911
20930
  }
20912
- const isItemTransparent = item2 instanceof Shape && item2?.getBackgroundColor() === "none";
20913
- const itemZIndex = this.getZIndex(item2);
20931
+ const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
20932
+ const itemZIndex = this.getZIndex(item);
20914
20933
  const accZIndex = this.getZIndex(acc.nearest);
20915
20934
  if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
20916
- return { nearest: item2, area };
20935
+ return { nearest: item, area };
20917
20936
  }
20918
20937
  return acc;
20919
20938
  }, { nearest: undefined, area: Infinity });
@@ -20925,8 +20944,8 @@ class Items {
20925
20944
  getNearPointer(maxDistance = 100, maxItems = 10, filter = () => true) {
20926
20945
  return this.index.getNearestTo(this.pointer.point, maxItems, filter, maxDistance);
20927
20946
  }
20928
- getZIndex(item2) {
20929
- return this.index.getZIndex(item2);
20947
+ getZIndex(item) {
20948
+ return this.index.getZIndex(item);
20930
20949
  }
20931
20950
  getByZIndex(index2) {
20932
20951
  return this.index.getByZIndex(index2);
@@ -20935,11 +20954,11 @@ class Items {
20935
20954
  return this.index.getLastZIndex();
20936
20955
  }
20937
20956
  getLinkedConnectorsById(id) {
20938
- return this.listAll().filter((item2) => {
20939
- if (!(item2 instanceof Connector2)) {
20957
+ return this.listAll().filter((item) => {
20958
+ if (!(item instanceof Connector2)) {
20940
20959
  return false;
20941
20960
  }
20942
- const { startItem, endItem } = item2.getConnectedItems();
20961
+ const { startItem, endItem } = item.getConnectedItems();
20943
20962
  if (startItem?.getId() === id || endItem?.getId() === id) {
20944
20963
  return true;
20945
20964
  }
@@ -20950,11 +20969,11 @@ class Items {
20950
20969
  if (!startPointerItemId && !endPointerItemId) {
20951
20970
  return [];
20952
20971
  }
20953
- return this.listAll().filter((item2) => {
20954
- if (!(item2 instanceof Connector2) || !item2.isConnected()) {
20972
+ return this.listAll().filter((item) => {
20973
+ if (!(item instanceof Connector2) || !item.isConnected()) {
20955
20974
  return false;
20956
20975
  }
20957
- const { startItem, endItem } = item2.getConnectedItems();
20976
+ const { startItem, endItem } = item.getConnectedItems();
20958
20977
  if (startPointerItemId && endPointerItemId) {
20959
20978
  if (startPointerItemId && startItem && startItem.getId() === startPointerItemId && endPointerItemId && endItem && endItem.getId() === endPointerItemId) {
20960
20979
  return true;
@@ -20972,9 +20991,9 @@ class Items {
20972
20991
  }
20973
20992
  render(context) {
20974
20993
  const items = this.getItemsInView();
20975
- items.forEach((item2) => {
20976
- if (item2.parent === "Board") {
20977
- item2.render(context);
20994
+ items.forEach((item) => {
20995
+ if (item.parent === "Board") {
20996
+ item.render(context);
20978
20997
  }
20979
20998
  });
20980
20999
  }
@@ -20987,17 +21006,17 @@ class Items {
20987
21006
  return this.getHTML(documentFactory, items);
20988
21007
  }
20989
21008
  getHTML(documentFactory, items) {
20990
- const lowestCoordinates = items.map((item2) => item2.getMbr()).reduce((acc, mbr) => ({
21009
+ const lowestCoordinates = items.map((item) => item.getMbr()).reduce((acc, mbr) => ({
20991
21010
  left: Math.min(acc.left, mbr.left),
20992
21011
  top: Math.min(acc.top, mbr.top)
20993
21012
  }), { left: 0, top: 0 });
20994
21013
  const groups = [];
20995
21014
  const rest = [];
20996
- items.forEach((item2) => {
20997
- if ("index" in item2 && item2.index) {
20998
- groups.push(item2);
21015
+ items.forEach((item) => {
21016
+ if ("index" in item && item.index) {
21017
+ groups.push(item);
20999
21018
  } else {
21000
- rest.push(item2);
21019
+ rest.push(item);
21001
21020
  }
21002
21021
  });
21003
21022
  const childrenMap = new Map;
@@ -21007,34 +21026,34 @@ class Items {
21007
21026
  translateElementBy(html, -lowestCoordinates.left, -lowestCoordinates.top);
21008
21027
  return html;
21009
21028
  });
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);
21029
+ const restHTML = rest.map((item) => ("renderHTML" in item) && item.renderHTML(documentFactory)).filter((item) => !!item).map((item) => {
21030
+ if (item.tagName.toLowerCase() === "connector-item") {
21031
+ const startX = parseFloat(item.getAttribute("data-start-point-x") || "0");
21032
+ const startY = parseFloat(item.getAttribute("data-start-point-y") || "0");
21033
+ const endX = parseFloat(item.getAttribute("data-end-point-x") || "0");
21034
+ const endY = parseFloat(item.getAttribute("data-end-point-y") || "0");
21035
+ item.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
21036
+ item.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
21037
+ item.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
21038
+ item.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
21039
+ }
21040
+ return translateElementBy(item, -lowestCoordinates.left, -lowestCoordinates.top);
21041
+ });
21042
+ for (const item of restHTML) {
21043
+ const parentFrameId = childrenMap.get(item.id);
21025
21044
  const group = GroupsHTML.find((el) => parentFrameId !== undefined && el.id === parentFrameId);
21026
21045
  if (group) {
21027
- positionRelatively(item2, group);
21028
- group.appendChild(item2);
21046
+ positionRelatively(item, group);
21047
+ group.appendChild(item);
21029
21048
  }
21030
21049
  }
21031
21050
  let result = "";
21032
21051
  for (const group of GroupsHTML) {
21033
21052
  result += group.outerHTML;
21034
21053
  }
21035
- for (const item2 of restHTML) {
21036
- if (!childrenMap.get(item2.id)) {
21037
- result += item2.outerHTML;
21054
+ for (const item of restHTML) {
21055
+ if (!childrenMap.get(item.id)) {
21056
+ result += item.outerHTML;
21038
21057
  }
21039
21058
  }
21040
21059
  return result;
@@ -21054,52 +21073,52 @@ class SimpleSpatialIndex {
21054
21073
  this.itemsArray = [];
21055
21074
  this.Mbr = new Mbr;
21056
21075
  }
21057
- insert(item2) {
21058
- this.itemsArray.push(item2);
21076
+ insert(item) {
21077
+ this.itemsArray.push(item);
21059
21078
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
21060
- this.Mbr = item2.getMbr().copy();
21079
+ this.Mbr = item.getMbr().copy();
21061
21080
  } else {
21062
- this.Mbr.combine([item2.getMbr()]);
21081
+ this.Mbr.combine([item.getMbr()]);
21063
21082
  }
21064
- item2.subject.subscribe(this.change);
21083
+ item.subject.subscribe(this.change);
21065
21084
  this.subject.publish(this.items);
21066
21085
  }
21067
- change = (item2) => {
21086
+ change = (item) => {
21068
21087
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
21069
- this.Mbr = item2.getMbr().copy();
21088
+ this.Mbr = item.getMbr().copy();
21070
21089
  } else {
21071
- this.Mbr.combine([item2.getMbr()]);
21090
+ this.Mbr.combine([item.getMbr()]);
21072
21091
  }
21073
21092
  this.subject.publish(this.items);
21074
21093
  };
21075
- remove(item2) {
21076
- if ("index" in item2 && item2.index) {
21077
- item2.removeChildItems(item2.index.list());
21094
+ remove(item) {
21095
+ if ("index" in item && item.index) {
21096
+ item.removeChildItems(item.index.list());
21078
21097
  }
21079
- if (item2.parent !== "Board") {
21080
- const parentFrame = this.items.getById(item2.parent);
21081
- parentFrame?.removeChildItems(item2);
21098
+ if (item.parent !== "Board") {
21099
+ const parentFrame = this.items.getById(item.parent);
21100
+ parentFrame?.removeChildItems(item);
21082
21101
  }
21083
- this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
21102
+ this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
21084
21103
  this.Mbr = new Mbr;
21085
- this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbr()]));
21104
+ this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbr()]));
21086
21105
  this.subject.publish(this.items);
21087
21106
  }
21088
21107
  copy() {
21089
- return this.itemsArray.map((item2) => ({
21090
- ...item2.serialize(true),
21091
- id: item2.getId()
21108
+ return this.itemsArray.map((item) => ({
21109
+ ...item.serialize(true),
21110
+ id: item.getId()
21092
21111
  }));
21093
21112
  }
21094
- moveToZIndex(item2, zIndex) {
21095
- const index2 = this.itemsArray.indexOf(item2);
21113
+ moveToZIndex(item, zIndex) {
21114
+ const index2 = this.itemsArray.indexOf(item);
21096
21115
  this.itemsArray.splice(index2, 1);
21097
- this.itemsArray.splice(zIndex, 0, item2);
21098
- this.change(item2);
21116
+ this.itemsArray.splice(zIndex, 0, item);
21117
+ this.change(item);
21099
21118
  this.subject.publish(this.items);
21100
21119
  }
21101
21120
  moveManyToZIndex(itemsRecord) {
21102
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
21121
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
21103
21122
  const zIndex = Object.values(itemsRecord);
21104
21123
  for (let i = 0;i < zIndex.length; i++) {
21105
21124
  const index2 = zIndex[i];
@@ -21107,37 +21126,37 @@ class SimpleSpatialIndex {
21107
21126
  }
21108
21127
  this.itemsArray.forEach(this.change.bind(this));
21109
21128
  }
21110
- sendToBack(item2, shouldPublish = true) {
21111
- const index2 = this.itemsArray.indexOf(item2);
21129
+ sendToBack(item, shouldPublish = true) {
21130
+ const index2 = this.itemsArray.indexOf(item);
21112
21131
  this.itemsArray.splice(index2, 1);
21113
- this.itemsArray.unshift(item2);
21132
+ this.itemsArray.unshift(item);
21114
21133
  if (shouldPublish) {
21115
21134
  this.subject.publish(this.items);
21116
21135
  }
21117
21136
  }
21118
21137
  sendManyToBack(items) {
21119
21138
  const newItems = [...items];
21120
- this.itemsArray.forEach((item2) => {
21121
- if (!items.includes(item2)) {
21122
- newItems.push(item2);
21139
+ this.itemsArray.forEach((item) => {
21140
+ if (!items.includes(item)) {
21141
+ newItems.push(item);
21123
21142
  }
21124
21143
  });
21125
21144
  this.itemsArray = newItems;
21126
21145
  this.itemsArray.forEach(this.change.bind(this));
21127
21146
  }
21128
- bringToFront(item2, shouldPublish = true) {
21129
- const index2 = this.itemsArray.indexOf(item2);
21147
+ bringToFront(item, shouldPublish = true) {
21148
+ const index2 = this.itemsArray.indexOf(item);
21130
21149
  this.itemsArray.splice(index2, 1);
21131
- this.itemsArray.push(item2);
21150
+ this.itemsArray.push(item);
21132
21151
  if (shouldPublish) {
21133
21152
  this.subject.publish(this.items);
21134
21153
  }
21135
21154
  }
21136
21155
  bringManyToFront(items) {
21137
21156
  const newItems = [];
21138
- this.itemsArray.forEach((item2) => {
21139
- if (!items.includes(item2)) {
21140
- newItems.push(item2);
21157
+ this.itemsArray.forEach((item) => {
21158
+ if (!items.includes(item)) {
21159
+ newItems.push(item);
21141
21160
  }
21142
21161
  });
21143
21162
  newItems.push(...items);
@@ -21163,9 +21182,9 @@ class SimpleSpatialIndex {
21163
21182
  this.subject.publish(this.items);
21164
21183
  }
21165
21184
  getById(id) {
21166
- const item2 = this.itemsArray.find((item3) => item3.getId() === id);
21167
- if (item2) {
21168
- return item2;
21185
+ const item = this.itemsArray.find((item2) => item2.getId() === id);
21186
+ if (item) {
21187
+ return item;
21169
21188
  }
21170
21189
  }
21171
21190
  findById(id) {
@@ -21174,9 +21193,9 @@ class SimpleSpatialIndex {
21174
21193
  getEnclosed(left, top, right, bottom) {
21175
21194
  const mbr = new Mbr(left, top, right, bottom);
21176
21195
  const items = [];
21177
- this.itemsArray.forEach((item2) => {
21178
- if (item2.isEnclosedBy(mbr)) {
21179
- items.push(item2);
21196
+ this.itemsArray.forEach((item) => {
21197
+ if (item.isEnclosedBy(mbr)) {
21198
+ items.push(item);
21180
21199
  }
21181
21200
  });
21182
21201
  return items;
@@ -21184,18 +21203,18 @@ class SimpleSpatialIndex {
21184
21203
  getEnclosedOrCrossed(left, top, right, bottom) {
21185
21204
  const mbr = new Mbr(left, top, right, bottom);
21186
21205
  const items = [];
21187
- this.itemsArray.forEach((item2) => {
21188
- if (item2.isEnclosedOrCrossedBy(mbr)) {
21189
- items.push(item2);
21206
+ this.itemsArray.forEach((item) => {
21207
+ if (item.isEnclosedOrCrossedBy(mbr)) {
21208
+ items.push(item);
21190
21209
  }
21191
21210
  });
21192
21211
  return items;
21193
21212
  }
21194
21213
  getUnderPoint(point3, tolerace = 5) {
21195
21214
  const items = [];
21196
- this.itemsArray.forEach((item2) => {
21197
- if (item2.isUnderPoint(point3, tolerace)) {
21198
- items.push(item2);
21215
+ this.itemsArray.forEach((item) => {
21216
+ if (item.isUnderPoint(point3, tolerace)) {
21217
+ items.push(item);
21199
21218
  }
21200
21219
  });
21201
21220
  return items;
@@ -21206,8 +21225,8 @@ class SimpleSpatialIndex {
21206
21225
  list() {
21207
21226
  return this.itemsArray.concat();
21208
21227
  }
21209
- getZIndex(item2) {
21210
- return this.itemsArray.indexOf(item2);
21228
+ getZIndex(item) {
21229
+ return this.itemsArray.indexOf(item);
21211
21230
  }
21212
21231
  getLastZIndex() {
21213
21232
  return this.itemsArray.length - 1;
@@ -21221,8 +21240,8 @@ class SimpleSpatialIndex {
21221
21240
  }
21222
21241
  }
21223
21242
  render(context) {
21224
- this.itemsArray.forEach((item2) => {
21225
- item2.render(context);
21243
+ this.itemsArray.forEach((item) => {
21244
+ item.render(context);
21226
21245
  });
21227
21246
  }
21228
21247
  }
@@ -21273,7 +21292,7 @@ class BaseItem extends Mbr {
21273
21292
  if (!this.index) {
21274
21293
  return null;
21275
21294
  }
21276
- return this.index.items.listAll().map((item2) => item2.getId());
21295
+ return this.index.items.listAll().map((item) => item.getId());
21277
21296
  }
21278
21297
  addChildItems(children) {
21279
21298
  if (!this.index) {
@@ -21311,17 +21330,17 @@ class BaseItem extends Mbr {
21311
21330
  this.addChildItems(itemsToAdd);
21312
21331
  this.removeChildItems(itemsToRemove);
21313
21332
  }
21314
- handleNesting(item2, options) {
21315
- const isItem = "itemType" in item2;
21316
- const itemMbr = isItem ? item2.getMbr() : item2;
21317
- if (item2 instanceof BaseItem && !item2.canBeNested) {
21333
+ handleNesting(item, options) {
21334
+ const isItem = "itemType" in item;
21335
+ const itemMbr = isItem ? item.getMbr() : item;
21336
+ if (item instanceof BaseItem && !item.canBeNested) {
21318
21337
  return false;
21319
21338
  }
21320
- if (options?.cancelIfChild && isItem && item2.parent !== "Board") {
21339
+ if (options?.cancelIfChild && isItem && item.parent !== "Board") {
21321
21340
  return false;
21322
21341
  }
21323
21342
  const mbr = this.getMbr().copy();
21324
- if (item2.isEnclosedOrCrossedBy(mbr)) {
21343
+ if (item.isEnclosedOrCrossedBy(mbr)) {
21325
21344
  if (mbr.isInside(itemMbr.getCenter())) {
21326
21345
  if (!options || !options.onlyForOut) {
21327
21346
  return true;
@@ -23618,8 +23637,8 @@ function isChild(value) {
23618
23637
  if (!Array.isArray(value2))
23619
23638
  return true;
23620
23639
  const list2 = value2;
23621
- for (const item2 of list2) {
23622
- if (typeof item2 !== "number" && typeof item2 !== "string") {
23640
+ for (const item of list2) {
23641
+ if (typeof item !== "number" && typeof item !== "string") {
23623
23642
  return true;
23624
23643
  }
23625
23644
  }
@@ -23658,8 +23677,8 @@ function addProperty(schema, properties, key, value) {
23658
23677
  }
23659
23678
  if (Array.isArray(result)) {
23660
23679
  const finalResult = [];
23661
- for (const item2 of result) {
23662
- finalResult.push(parsePrimitive(info, info.property, item2));
23680
+ for (const item of result) {
23681
+ finalResult.push(parsePrimitive(info, info.property, item));
23663
23682
  }
23664
23683
  result = finalResult;
23665
23684
  }
@@ -34726,8 +34745,8 @@ function list5(node2, parent, state, info) {
34726
34745
  if (checkRule(state) === bullet && firstListItem) {
34727
34746
  let index2 = -1;
34728
34747
  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") {
34748
+ const item = node2.children[index2];
34749
+ if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
34731
34750
  useDifferentMarker = true;
34732
34751
  break;
34733
34752
  }
@@ -35387,12 +35406,12 @@ async function convertMarkdownToSlate(text5) {
35387
35406
  ...nodes.filter((node2) => node2.type !== "list_item")
35388
35407
  ];
35389
35408
  }
35390
- return nodes.map((item2) => {
35409
+ return nodes.map((item) => {
35391
35410
  setNodeStyles({
35392
- node: item2,
35393
- isPaddingTopNeeded: item2.type !== "code_block"
35411
+ node: item,
35412
+ isPaddingTopNeeded: item.type !== "code_block"
35394
35413
  });
35395
- return item2;
35414
+ return item;
35396
35415
  });
35397
35416
  }
35398
35417
  function detectListType(text5) {
@@ -35805,17 +35824,17 @@ class FloatingPoint extends Point {
35805
35824
  relativePoint;
35806
35825
  pointType = "Floating";
35807
35826
  edge;
35808
- constructor(item2, relativePoint) {
35827
+ constructor(item, relativePoint) {
35809
35828
  super();
35810
- this.item = item2;
35829
+ this.item = item;
35811
35830
  this.relativePoint = relativePoint;
35812
35831
  if (relativePoint.y <= 0) {
35813
35832
  this.edge = "top";
35814
- } else if (relativePoint.y >= item2.getMbr().getHeight()) {
35833
+ } else if (relativePoint.y >= item.getMbr().getHeight()) {
35815
35834
  this.edge = "bottom";
35816
35835
  } else if (relativePoint.x <= 0) {
35817
35836
  this.edge = "left";
35818
- } else if (relativePoint.x >= item2.getMbr().getWidth()) {
35837
+ } else if (relativePoint.x >= item.getMbr().getWidth()) {
35819
35838
  this.edge = "right";
35820
35839
  }
35821
35840
  this.recalculatePoint();
@@ -35846,17 +35865,17 @@ class FixedPoint extends Point {
35846
35865
  relativePoint;
35847
35866
  pointType = "Fixed";
35848
35867
  edge;
35849
- constructor(item2, relativePoint) {
35868
+ constructor(item, relativePoint) {
35850
35869
  super();
35851
- this.item = item2;
35870
+ this.item = item;
35852
35871
  this.relativePoint = relativePoint;
35853
35872
  if (relativePoint.y <= 0) {
35854
35873
  this.edge = "top";
35855
- } else if (relativePoint.y >= item2.getMbr().getHeight()) {
35874
+ } else if (relativePoint.y >= item.getMbr().getHeight()) {
35856
35875
  this.edge = "bottom";
35857
35876
  } else if (relativePoint.x <= 0) {
35858
35877
  this.edge = "left";
35859
- } else if (relativePoint.x >= item2.getMbr().getWidth()) {
35878
+ } else if (relativePoint.x >= item.getMbr().getWidth()) {
35860
35879
  this.edge = "right";
35861
35880
  }
35862
35881
  this.recalculatePoint();
@@ -35887,16 +35906,16 @@ class FixedConnectorPoint extends Point {
35887
35906
  tangent;
35888
35907
  segmentIndex;
35889
35908
  pointType = "FixedConnector";
35890
- constructor(item2, tangent, segmentIndex) {
35909
+ constructor(item, tangent, segmentIndex) {
35891
35910
  super();
35892
- this.item = item2;
35911
+ this.item = item;
35893
35912
  this.tangent = tangent;
35894
35913
  this.segmentIndex = segmentIndex;
35895
35914
  this.recalculatePoint();
35896
35915
  }
35897
35916
  recalculatePoint() {
35898
- const item2 = this.item;
35899
- const segments = item2.getPaths().getSegments();
35917
+ const item = this.item;
35918
+ const segments = item.getPaths().getSegments();
35900
35919
  const segment = segments.length > this.segmentIndex ? segments[this.segmentIndex] : segments[segments.length - 1];
35901
35920
  const point5 = segment.getPoint(this.tangent);
35902
35921
  this.x = point5.x;
@@ -35921,38 +35940,38 @@ function getControlPoint(data, findItem2) {
35921
35940
  if (data.pointType === "Board") {
35922
35941
  return new BoardPoint(Math.round(data.x), Math.round(data.y));
35923
35942
  } else {
35924
- const item2 = findItem2(data.itemId);
35925
- if (!item2) {
35943
+ const item = findItem2(data.itemId);
35944
+ if (!item) {
35926
35945
  console.warn(`getControlPoint(): item not found for ${data.itemId}`);
35927
35946
  return new BoardPoint(0, 0);
35928
35947
  }
35929
35948
  switch (data.pointType) {
35930
35949
  case "FixedConnector":
35931
- if (item2 instanceof Connector2) {
35932
- return new FixedConnectorPoint(item2, data.tangent, data.segment);
35950
+ if (item instanceof Connector2) {
35951
+ return new FixedConnectorPoint(item, data.tangent, data.segment);
35933
35952
  } else {
35934
35953
  throw new Error(`getControlPoint(): item must be a connector`);
35935
35954
  }
35936
35955
  case "Floating":
35937
- return new FloatingPoint(item2, new Point(data.relativeX, data.relativeY));
35956
+ return new FloatingPoint(item, new Point(data.relativeX, data.relativeY));
35938
35957
  case "Fixed":
35939
- return new FixedPoint(item2, new Point(data.relativeX, data.relativeY));
35958
+ return new FixedPoint(item, new Point(data.relativeX, data.relativeY));
35940
35959
  }
35941
35960
  }
35942
35961
  }
35943
- function toRelativePoint(point5, item2) {
35944
- const matrix = item2.transformation?.matrix || new Matrix2;
35962
+ function toRelativePoint(point5, item) {
35963
+ const matrix = item.transformation?.matrix || new Matrix2;
35945
35964
  const inverse = matrix.getInverse();
35946
35965
  point5 = point5.copy();
35947
35966
  point5.transform(inverse);
35948
35967
  return point5;
35949
35968
  }
35950
- function fromRelativePoint(relativePoint, item2, edge) {
35951
- const matrix = item2.transformation?.matrix.copy() || new Matrix2;
35969
+ function fromRelativePoint(relativePoint, item, edge) {
35970
+ const matrix = item.transformation?.matrix.copy() || new Matrix2;
35952
35971
  const point5 = relativePoint.copy();
35953
35972
  point5.transform(matrix);
35954
- if (item2 instanceof RichText || item2 instanceof AINode) {
35955
- const itemMbr = item2.getMbr();
35973
+ if (item instanceof RichText || item instanceof AINode) {
35974
+ const itemMbr = item.getMbr();
35956
35975
  const { x: centerX, y: centerY } = itemMbr.getCenter();
35957
35976
  switch (edge) {
35958
35977
  case "left":
@@ -35964,7 +35983,7 @@ function fromRelativePoint(relativePoint, item2, edge) {
35964
35983
  case "bottom":
35965
35984
  return new Point(centerX, itemMbr.bottom);
35966
35985
  default:
35967
- return item2.getMbr().getClosestEdgeCenterPoint(point5);
35986
+ return item.getMbr().getClosestEdgeCenterPoint(point5);
35968
35987
  }
35969
35988
  }
35970
35989
  return point5;
@@ -37313,7 +37332,7 @@ class Connector2 extends BaseItem {
37313
37332
  return this;
37314
37333
  }
37315
37334
  getConnectorById(items, connectorId) {
37316
- return items.find((item2) => item2 instanceof Connector2 && item2.getId() === connectorId);
37335
+ return items.find((item) => item instanceof Connector2 && item.getId() === connectorId);
37317
37336
  }
37318
37337
  updateTitle() {
37319
37338
  const selection = this.board.selection;
@@ -39950,8 +39969,8 @@ async function exportBoardSnapshot({
39950
39969
  context.matrix.applyToContext(context.ctx);
39951
39970
  const { left, top, right, bottom } = selection;
39952
39971
  const inView = board.items.index.getRectsEnclosedOrCrossed(left, top, right, bottom);
39953
- for (const item2 of inView) {
39954
- item2.render(context);
39972
+ for (const item of inView) {
39973
+ item.render(context);
39955
39974
  }
39956
39975
  const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
39957
39976
  const dataUrl = await convertBlobToDataUrl(blob);
@@ -40149,7 +40168,7 @@ class Frame2 extends BaseItem {
40149
40168
  return this.id;
40150
40169
  }
40151
40170
  getChildrenIds() {
40152
- return this.index?.list().map((item2) => item2.getId()) || [];
40171
+ return this.index?.list().map((item) => item.getId()) || [];
40153
40172
  }
40154
40173
  updateMbr() {
40155
40174
  const rect = this.path.getMbr().copy();
@@ -40384,11 +40403,11 @@ class Frame2 extends BaseItem {
40384
40403
  }
40385
40404
  });
40386
40405
  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();
40406
+ this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
40407
+ if (item.parent === "Board") {
40408
+ if (this.handleNesting(item)) {
40409
+ this.applyAddChildren([item.getId()]);
40410
+ item.parent = this.getId();
40392
40411
  }
40393
40412
  }
40394
40413
  });
@@ -42586,9 +42605,9 @@ class Group extends BaseItem {
42586
42605
  if (data.children) {
42587
42606
  data.children.forEach((childId) => {
42588
42607
  this.applyAddChild(childId);
42589
- const item2 = this.board.items.getById(childId);
42590
- if (item2) {
42591
- item2.parent = this.getId();
42608
+ const item = this.board.items.getById(childId);
42609
+ if (item) {
42610
+ item.parent = this.getId();
42592
42611
  }
42593
42612
  });
42594
42613
  }
@@ -42618,11 +42637,11 @@ class Group extends BaseItem {
42618
42637
  let right = Number.MIN_SAFE_INTEGER;
42619
42638
  let bottom = Number.MIN_SAFE_INTEGER;
42620
42639
  const mbrs = this.children.flatMap((childId) => {
42621
- const item2 = this.board.items.getById(childId);
42622
- if (!item2) {
42640
+ const item = this.board.items.getById(childId);
42641
+ if (!item) {
42623
42642
  return [];
42624
42643
  }
42625
- const mbr2 = item2.getMbr();
42644
+ const mbr2 = item.getMbr();
42626
42645
  if (!mbr2) {
42627
42646
  return [];
42628
42647
  }
@@ -42657,7 +42676,7 @@ class Group extends BaseItem {
42657
42676
  return this.children;
42658
42677
  }
42659
42678
  getChildren() {
42660
- return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item2) => item2 !== undefined);
42679
+ return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item) => item !== undefined);
42661
42680
  }
42662
42681
  updateMbr() {
42663
42682
  const rect = this.getMbr();
@@ -42670,9 +42689,9 @@ class Group extends BaseItem {
42670
42689
  setChildren(items) {
42671
42690
  items.forEach((itemId) => {
42672
42691
  this.addChild(itemId);
42673
- const item2 = this.board.items.getById(itemId);
42674
- if (item2) {
42675
- item2.parent = this.getId();
42692
+ const item = this.board.items.getById(itemId);
42693
+ if (item) {
42694
+ item.parent = this.getId();
42676
42695
  }
42677
42696
  });
42678
42697
  this.updateMbr();
@@ -42680,9 +42699,9 @@ class Group extends BaseItem {
42680
42699
  removeChildren() {
42681
42700
  this.children.forEach((itemId) => {
42682
42701
  this.removeChild(itemId);
42683
- const item2 = this.board.items.getById(itemId);
42684
- if (item2) {
42685
- item2.parent = this.parent;
42702
+ const item = this.board.items.getById(itemId);
42703
+ if (item) {
42704
+ item.parent = this.parent;
42686
42705
  }
42687
42706
  });
42688
42707
  this.updateMbr();
@@ -43015,16 +43034,16 @@ class Anchor extends Mbr {
43015
43034
  }
43016
43035
  }
43017
43036
  // src/Items/Connector/ConnectorSnap.ts
43018
- function getFixedPoint(item2, point5) {
43019
- if (item2 instanceof Connector2) {
43020
- const nearestSegmentData = item2.getPaths().getNearestEdgeAndPointTo(point5);
43037
+ function getFixedPoint(item, point5) {
43038
+ if (item instanceof Connector2) {
43039
+ const nearestSegmentData = item.getPaths().getNearestEdgeAndPointTo(point5);
43021
43040
  const segment = nearestSegmentData.segment;
43022
43041
  const index2 = nearestSegmentData.index;
43023
43042
  const tangent = segment.getParameter(point5);
43024
- return new FixedConnectorPoint(item2, tangent, index2);
43043
+ return new FixedConnectorPoint(item, tangent, index2);
43025
43044
  } else {
43026
- const relativePoint = toRelativePoint(point5, item2);
43027
- return new FixedPoint(item2, relativePoint);
43045
+ const relativePoint = toRelativePoint(point5, item);
43046
+ return new FixedPoint(item, relativePoint);
43028
43047
  }
43029
43048
  }
43030
43049
 
@@ -43077,20 +43096,20 @@ class ConnectorSnap {
43077
43096
  }
43078
43097
  this.setSnap();
43079
43098
  const pointer = this.board.pointer.point;
43080
- const { anchor, item: item2, point: point5 } = this.snap;
43081
- if (!item2) {
43099
+ const { anchor, item, point: point5 } = this.snap;
43100
+ if (!item) {
43082
43101
  const pointer2 = this.board.pointer.point;
43083
43102
  this.controlPoint = new BoardPoint(pointer2.x, pointer2.y);
43084
43103
  } else if (anchor) {
43085
- this.controlPoint = getFixedPoint(item2, anchor.getCenter());
43104
+ this.controlPoint = getFixedPoint(item, anchor.getCenter());
43086
43105
  } else if (point5) {
43087
- const nearest2 = item2.getNearestEdgePointTo(pointer);
43088
- this.controlPoint = getFixedPoint(item2, nearest2);
43106
+ const nearest2 = item.getNearestEdgePointTo(pointer);
43107
+ this.controlPoint = getFixedPoint(item, nearest2);
43089
43108
  } else {
43090
43109
  if (this.hover.isTimeoutElapsed) {
43091
- this.controlPoint = getFixedPoint(item2, pointer);
43110
+ this.controlPoint = getFixedPoint(item, pointer);
43092
43111
  } else {
43093
- this.controlPoint = getFixedPoint(item2, pointer);
43112
+ this.controlPoint = getFixedPoint(item, pointer);
43094
43113
  }
43095
43114
  }
43096
43115
  }
@@ -43151,23 +43170,23 @@ class ConnectorSnap {
43151
43170
  }
43152
43171
  return nearest;
43153
43172
  }
43154
- getClosestPointOnItem(item2, position4) {
43155
- const nearestEdgePoint = item2.getNearestEdgePointTo(position4);
43156
- return getFixedPoint(item2, nearestEdgePoint);
43173
+ getClosestPointOnItem(item, position4) {
43174
+ const nearestEdgePoint = item.getNearestEdgePointTo(position4);
43175
+ return getFixedPoint(item, nearestEdgePoint);
43157
43176
  }
43158
- isNearBorder(item2) {
43159
- if (!item2) {
43177
+ isNearBorder(item) {
43178
+ if (!item) {
43160
43179
  return false;
43161
43180
  }
43162
43181
  const pointer = this.board.pointer.point;
43163
- const point5 = item2.getNearestEdgePointTo(pointer);
43182
+ const point5 = item.getNearestEdgePointTo(pointer);
43164
43183
  const distance = pointer.getDistance(point5);
43165
43184
  return distance < this.distance.border / this.board.camera.getScale();
43166
43185
  }
43167
43186
  setSnap() {
43168
- const item2 = this.snap.item;
43169
- const path2 = item2 && "getPath" in item2 ? item2?.getPath() : null;
43170
- if (!item2 || !path2) {
43187
+ const item = this.snap.item;
43188
+ const path2 = item && "getPath" in item ? item?.getPath() : null;
43189
+ if (!item || !path2) {
43171
43190
  this.snap.path = null;
43172
43191
  this.snap.anchors = [];
43173
43192
  this.snap.anchor = null;
@@ -43178,11 +43197,11 @@ class ConnectorSnap {
43178
43197
  if (this.snap.item === this.hover.item && !this.hover.isTimeoutElapsed) {
43179
43198
  path2.setBackgroundColor(this.color.snapBackgroundHighlight);
43180
43199
  }
43181
- this.setAnchors(item2);
43200
+ this.setAnchors(item);
43182
43201
  }
43183
43202
  }
43184
- setAnchors(item2) {
43185
- const points = item2.getSnapAnchorPoints();
43203
+ setAnchors(item) {
43204
+ const points = item.getSnapAnchorPoints();
43186
43205
  if (!points) {
43187
43206
  return;
43188
43207
  }
@@ -43216,10 +43235,10 @@ class ConnectorSnap {
43216
43235
  }
43217
43236
  setPoint() {
43218
43237
  const pointer = this.board.pointer.point;
43219
- const { item: item2, anchor } = this.snap;
43220
- if (item2) {
43238
+ const { item, anchor } = this.snap;
43239
+ if (item) {
43221
43240
  if (!anchor) {
43222
- const point5 = item2.getNearestEdgePointTo(pointer);
43241
+ const point5 = item.getNearestEdgePointTo(pointer);
43223
43242
  if (point5.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
43224
43243
  this.snap.point = new Anchor(point5.x, point5.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
43225
43244
  } else {
@@ -43592,12 +43611,12 @@ class NestingHighlighter extends Tool {
43592
43611
  this.toHighlight.push({ groupItem, children: array });
43593
43612
  }
43594
43613
  }
43595
- addSingleItem(item2) {
43596
- this.toHighlight.push({ children: [item2] });
43614
+ addSingleItem(item) {
43615
+ this.toHighlight.push({ children: [item] });
43597
43616
  }
43598
- remove(item2) {
43617
+ remove(item) {
43599
43618
  this.toHighlight.forEach((group) => {
43600
- group.children = group.children.filter((child) => child !== item2);
43619
+ group.children = group.children.filter((child) => child !== item);
43601
43620
  });
43602
43621
  this.toHighlight = this.toHighlight.filter((group) => group.children.length > 0);
43603
43622
  }
@@ -43664,7 +43683,7 @@ class AddFrame extends BoardTool {
43664
43683
  this.mbr.borderColor = "blue";
43665
43684
  this.nestingHighlighter.clear();
43666
43685
  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()));
43686
+ const inside = enclosedOrCrossed.filter((item) => !(item instanceof Frame2) && item.parent === "Board" && this.mbr.isInside(item.getMbr().getCenter()));
43668
43687
  this.nestingHighlighter.add(this.frame, inside);
43669
43688
  this.initTransformation();
43670
43689
  this.board.tools.publish();
@@ -43685,7 +43704,7 @@ class AddFrame extends BoardTool {
43685
43704
  localStorage.setItem("lastFrameScale", JSON.stringify(this.frame.transformation.getScale()));
43686
43705
  }
43687
43706
  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));
43707
+ 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
43708
  this.applyAddChildren(frameChildren);
43690
43709
  if (this.shape !== "Custom") {
43691
43710
  this.applyCanChangeRatio(false);
@@ -43701,7 +43720,7 @@ class AddFrame extends BoardTool {
43701
43720
  return true;
43702
43721
  }
43703
43722
  addNextTo() {
43704
- const framesInView = this.board.items.getItemsInView().filter((item2) => item2 instanceof Frame2);
43723
+ const framesInView = this.board.items.getItemsInView().filter((item) => item instanceof Frame2);
43705
43724
  if (framesInView.length === 0) {
43706
43725
  if (this.shape === "Custom") {
43707
43726
  const { x, y } = this.frame.getLastFrameScale();
@@ -43739,7 +43758,7 @@ class AddFrame extends BoardTool {
43739
43758
  this.board.camera.viewRectangle(this.frame.getMbr());
43740
43759
  }
43741
43760
  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]));
43761
+ 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
43762
  const frame = this.board.add(this.frame);
43744
43763
  frame.text.editor.moveCursorToEndOfTheText();
43745
43764
  this.nestingHighlighter.clear();
@@ -44244,13 +44263,13 @@ class Eraser extends BoardTool {
44244
44263
  }
44245
44264
  removeUnderPointOrLine() {
44246
44265
  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;
44266
+ const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item) => {
44267
+ return item.itemType === "Drawing" && item.getLines().find((line) => {
44268
+ return line.getDistance(this.board.pointer.point) <= item.strokeWidth / 2 + this.strokeWidth / 2;
44250
44269
  });
44251
44270
  });
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) => {
44271
+ 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) => {
44272
+ return item.itemType === "Drawing" && item.getLines().some((line) => {
44254
44273
  return segments.some((segment) => segment.hasIntersectionPoint(line));
44255
44274
  });
44256
44275
  }));
@@ -44702,20 +44721,20 @@ function createCanvasDrawer(board) {
44702
44721
  context.ctx.setTransform(board2.camera.getMatrix().scaleX, 0, 0, board2.camera.getMatrix().scaleY, 0, 0);
44703
44722
  context.matrix.applyToContext(context.ctx);
44704
44723
  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;
44724
+ const item = board2.items.getById(id);
44725
+ if (item) {
44726
+ if (item.itemType !== "Frame") {
44727
+ return item;
44709
44728
  }
44710
- item2.render(context);
44711
- return item2;
44729
+ item.render(context);
44730
+ return item;
44712
44731
  }
44713
44732
  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);
44733
+ }).filter((item) => !!item);
44734
+ items.forEach((item) => {
44735
+ if (item.itemType !== "Frame") {
44736
+ item.render(context);
44737
+ board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
44719
44738
  }
44720
44739
  });
44721
44740
  return { canvas: container, items };
@@ -44776,10 +44795,10 @@ function createCanvasDrawer(board) {
44776
44795
  if (lastTranslationKeys) {
44777
44796
  board.selection.shouldPublish = false;
44778
44797
  lastTranslationKeys.forEach((id) => {
44779
- const item2 = board.items.getById(id);
44780
- if (item2) {
44781
- item2.transformationRenderBlock = undefined;
44782
- item2.subject.publish(item2);
44798
+ const item = board.items.getById(id);
44799
+ if (item) {
44800
+ item.transformationRenderBlock = undefined;
44801
+ item.subject.publish(item);
44783
44802
  }
44784
44803
  });
44785
44804
  lastTranslationKeys = undefined;
@@ -44811,9 +44830,9 @@ function createCanvasDrawer(board) {
44811
44830
  lastCreatedCanvas = cnvs;
44812
44831
  lastTranslationKeys = Object.keys(translation);
44813
44832
  lastTranslationKeys.forEach((id) => {
44814
- const item2 = board.items.getById(id);
44815
- if (item2) {
44816
- item2.transformationRenderBlock = true;
44833
+ const item = board.items.getById(id);
44834
+ if (item) {
44835
+ item.transformationRenderBlock = true;
44817
44836
  }
44818
44837
  });
44819
44838
  board.selection.transformationRenderBlock = true;
@@ -44823,14 +44842,14 @@ function createCanvasDrawer(board) {
44823
44842
  }
44824
44843
  function countSumMbr(translation) {
44825
44844
  return Object.keys(translation).reduce((mbr, id) => {
44826
- const item2 = board.items.getById(id);
44827
- if (item2) {
44845
+ const item = board.items.getById(id);
44846
+ if (item) {
44828
44847
  if (!mbr) {
44829
- mbr = item2.getMbr();
44848
+ mbr = item.getMbr();
44830
44849
  } else {
44831
- mbr.combine(item2.getMbr());
44832
- if (item2.itemType === "Frame") {
44833
- mbr.combine(item2.getRichText().getMbr());
44850
+ mbr.combine(item.getMbr());
44851
+ if (item.itemType === "Frame") {
44852
+ mbr.combine(item.getRichText().getMbr());
44834
44853
  }
44835
44854
  }
44836
44855
  }
@@ -44861,8 +44880,8 @@ function createCanvasDrawer(board) {
44861
44880
  }
44862
44881
  function highlightNesting() {
44863
44882
  const container = getLastCreatedCanvas();
44864
- const drawnItemsMap = drawnItems?.reduce((acc, item2) => {
44865
- acc.set(item2.getId(), { item: item2, mbr: item2.getMbr() });
44883
+ const drawnItemsMap = drawnItems?.reduce((acc, item) => {
44884
+ acc.set(item.getId(), { item, mbr: item.getMbr() });
44866
44885
  return acc;
44867
44886
  }, new Map);
44868
44887
  if (!container || !drawnItems) {
@@ -44897,11 +44916,11 @@ function createCanvasDrawer(board) {
44897
44916
  mbr.transform(currMatrix);
44898
44917
  });
44899
44918
  groups.forEach((group) => {
44900
- drawnItemsMap?.forEach(({ mbr, item: item2 }, key) => {
44901
- if ("canBeNested" in item2 && !item2.canBeNested) {
44919
+ drawnItemsMap?.forEach(({ mbr, item }, key) => {
44920
+ if ("canBeNested" in item && !item.canBeNested) {
44902
44921
  return;
44903
44922
  }
44904
- if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item2.parent !== group.getId()) && group.handleNesting(mbr)) {
44923
+ if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item.parent !== group.getId()) && group.handleNesting(mbr)) {
44905
44924
  const div = createBorderDivForItem(mbr, lastCreatedCanvas);
44906
44925
  removeHighlighted(key);
44907
44926
  highlightedDivs.set(key, div);
@@ -44962,10 +44981,10 @@ function createCanvasDrawer(board) {
44962
44981
  }
44963
44982
 
44964
44983
  // 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();
44984
+ function getControlPointData(item, index2, isRichText = false) {
44985
+ const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
44986
+ const width2 = item.getPathMbr().getWidth();
44987
+ let height3 = item.getPathMbr().getHeight();
44969
44988
  const adjMapScaled = {
44970
44989
  0: { x: 0, y: height3 / 2 / itemScale.y },
44971
44990
  1: {
@@ -44980,7 +44999,7 @@ function getControlPointData(item2, index2, isRichText = false) {
44980
44999
  };
44981
45000
  return {
44982
45001
  pointType: "Fixed",
44983
- itemId: item2.getId(),
45002
+ itemId: item.getId(),
44984
45003
  relativeX: adjMapScaled[index2].x,
44985
45004
  relativeY: adjMapScaled[index2].y
44986
45005
  };
@@ -45115,10 +45134,10 @@ function getQuickAddButtons(selection, board) {
45115
45134
  let newHeight = height3;
45116
45135
  let itemData;
45117
45136
  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();
45137
+ const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
45138
+ newWidth = item.getMbr().getWidth();
45139
+ newHeight = item.getMbr().getHeight();
45140
+ itemData = item.serialize();
45122
45141
  const { minX, minY, maxY, maxX } = offsets;
45123
45142
  offsetX = Math.min(offsetX, maxX);
45124
45143
  offsetX = Math.max(offsetX, minX);
@@ -45151,7 +45170,7 @@ function getQuickAddButtons(selection, board) {
45151
45170
  }
45152
45171
  const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
45153
45172
  let step = 1;
45154
- while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item2) => item2.itemType !== "Connector").length > 0) {
45173
+ while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item) => item.itemType !== "Connector").length > 0) {
45155
45174
  const xDirection = step % 2 === 0 ? -1 : 1;
45156
45175
  const yDirection = newItemData.itemType === "AINode" ? -1 : xDirection;
45157
45176
  newMbr.transform(new Matrix2(iterAdjustment[index2].x * xDirection * step, iterAdjustment[index2].y * yDirection * (newItemData.itemType === "AINode" ? 1 : step)));
@@ -45284,7 +45303,7 @@ function getQuickAddButtons(selection, board) {
45284
45303
  clear();
45285
45304
  return;
45286
45305
  }
45287
- const { positions, item: item2 } = position4;
45306
+ const { positions, item } = position4;
45288
45307
  const cameraMatrix = board.camera.getMatrix();
45289
45308
  const cameraMbr = board.camera.getMbr();
45290
45309
  const positionAdjustments = {
@@ -45312,7 +45331,7 @@ function getQuickAddButtons(selection, board) {
45312
45331
  };
45313
45332
  const button = document.createElement("button");
45314
45333
  button.classList.add("microboard-quickAddButton");
45315
- if (item2.itemType === "AINode" && index2 === 2) {
45334
+ if (item.itemType === "AINode" && index2 === 2) {
45316
45335
  button.classList.add("microboard-invisible");
45317
45336
  }
45318
45337
  button.classList.add(`microboard-${adjustment.rotate}`);
@@ -45328,7 +45347,7 @@ function getQuickAddButtons(selection, board) {
45328
45347
  clearTimeout(timeoutId);
45329
45348
  }
45330
45349
  if (button.isMouseDown) {
45331
- board.tools.addConnector(true, item2, pos);
45350
+ board.tools.addConnector(true, item, pos);
45332
45351
  } else {
45333
45352
  quickAddItems = undefined;
45334
45353
  selection.subject.publish(selection);
@@ -45435,11 +45454,11 @@ class AlignmentHelper {
45435
45454
  return baseThickness / (zoom / 100);
45436
45455
  }
45437
45456
  combineMBRs(items) {
45438
- return items.reduce((acc, item2, i) => {
45457
+ return items.reduce((acc, item, i) => {
45439
45458
  if (i === 0) {
45440
45459
  return acc;
45441
45460
  }
45442
- const itemMbr = item2.getPathMbr();
45461
+ const itemMbr = item.getPathMbr();
45443
45462
  return acc.combine(itemMbr);
45444
45463
  }, items[0].getMbr());
45445
45464
  }
@@ -45453,7 +45472,7 @@ class AlignmentHelper {
45453
45472
  const scale = this.board.camera.getScale();
45454
45473
  const dynamicAlignThreshold = Math.min(this.alignThreshold / scale, 8);
45455
45474
  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);
45475
+ 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
45476
  const verticalAlignments = new Map;
45458
45477
  const horizontalAlignments = new Map;
45459
45478
  const addVerticalAlignment = (x, minY, maxY) => {
@@ -45474,11 +45493,11 @@ class AlignmentHelper {
45474
45493
  horizontalAlignments.set(y, { minX, maxX });
45475
45494
  }
45476
45495
  };
45477
- nearbyItems.forEach((item2) => {
45478
- if (item2 === movingItem || item2.itemType === "Comment") {
45496
+ nearbyItems.forEach((item) => {
45497
+ if (item === movingItem || item.itemType === "Comment") {
45479
45498
  return;
45480
45499
  }
45481
- const itemMbr = item2.itemType === "Shape" ? item2.getPath().getMbr() : item2.getMbr();
45500
+ const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
45482
45501
  const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
45483
45502
  const centerXItem = (itemMbr.left + itemMbr.right) / 2;
45484
45503
  const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
@@ -45745,20 +45764,20 @@ class AlignmentHelper {
45745
45764
  }
45746
45765
  return false;
45747
45766
  }
45748
- translateItems(item2, x, y, timeStamp) {
45767
+ translateItems(item, x, y, timeStamp) {
45749
45768
  if (this.canvasDrawer.getLastCreatedCanvas()) {
45750
45769
  return;
45751
45770
  }
45752
- if (Array.isArray(item2)) {
45771
+ if (Array.isArray(item)) {
45753
45772
  const translation = this.board.selection.getManyItemsTranslation(x, y);
45754
45773
  this.board.selection.transformMany(translation, timeStamp);
45755
45774
  return;
45756
45775
  }
45757
- if (item2.itemType === "Frame") {
45776
+ if (item.itemType === "Frame") {
45758
45777
  const translation = this.board.selection.getManyItemsTranslation(x, y);
45759
45778
  this.board.selection.transformMany(translation, timeStamp);
45760
45779
  } else {
45761
- const id = item2.getId();
45780
+ const id = item.getId();
45762
45781
  const transformMap = {};
45763
45782
  transformMap[id] = {
45764
45783
  class: "Transformation",
@@ -45886,12 +45905,12 @@ class Select extends Tool {
45886
45905
  this.debounceUpd.setFalse();
45887
45906
  this.snapLines = { verticalLines: [], horizontalLines: [] };
45888
45907
  }
45889
- handleSnapping(item2) {
45908
+ handleSnapping(item) {
45890
45909
  if (this.board.keyboard.isShift) {
45891
45910
  return false;
45892
45911
  }
45893
- const increasedSnapThreshold = Array.isArray(item2) ? 40 : 35;
45894
- this.isSnapped = this.alignmentHelper.snapToClosestLine(item2, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
45912
+ const increasedSnapThreshold = Array.isArray(item) ? 40 : 35;
45913
+ this.isSnapped = this.alignmentHelper.snapToClosestLine(item, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
45895
45914
  if (this.isSnapped) {
45896
45915
  if (!this.snapCursorPos) {
45897
45916
  this.snapCursorPos = new Point(this.board.pointer.point.x, this.board.pointer.point.y);
@@ -45901,10 +45920,10 @@ class Select extends Tool {
45901
45920
  if ((cursorDiffX > increasedSnapThreshold || cursorDiffY > increasedSnapThreshold) && this.initialCursorPos) {
45902
45921
  this.isSnapped = false;
45903
45922
  this.snapCursorPos = null;
45904
- const itemCenter = Array.isArray(item2) ? this.alignmentHelper.combineMBRs(item2).getCenter() : item2.getMbr().getCenter();
45923
+ const itemCenter = Array.isArray(item) ? this.alignmentHelper.combineMBRs(item).getCenter() : item.getMbr().getCenter();
45905
45924
  const translateX = this.board.pointer.point.x - this.initialCursorPos.x - itemCenter.x;
45906
45925
  const translateY = this.board.pointer.point.y - this.initialCursorPos.y - itemCenter.y;
45907
- this.alignmentHelper.translateItems(item2, translateX, translateY, this.beginTimeStamp);
45926
+ this.alignmentHelper.translateItems(item, translateX, translateY, this.beginTimeStamp);
45908
45927
  }
45909
45928
  }
45910
45929
  return false;
@@ -45954,10 +45973,10 @@ class Select extends Tool {
45954
45973
  angleDiff = angleDiff < 0 ? angleDiff + 360 : angleDiff;
45955
45974
  return Math.min(angleDiff, 360 - angleDiff);
45956
45975
  }
45957
- handleShiftGuidelines(item2, mousePosition) {
45958
- if (item2) {
45976
+ handleShiftGuidelines(item, mousePosition) {
45977
+ if (item) {
45959
45978
  if (!this.originalCenter) {
45960
- this.originalCenter = Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().copy() : item2.getMbr().getCenter().copy();
45979
+ this.originalCenter = Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().copy() : item.getMbr().getCenter().copy();
45961
45980
  this.guidelines = this.alignmentHelper.generateGuidelines(this.originalCenter).lines;
45962
45981
  }
45963
45982
  this.mainLine = new Line(this.originalCenter, mousePosition);
@@ -45978,13 +45997,13 @@ class Select extends Tool {
45978
45997
  const newEndX = this.originalCenter.x + snapDirectionX * mainLineLength;
45979
45998
  const newEndY = this.originalCenter.y + snapDirectionY * mainLineLength;
45980
45999
  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)) {
46000
+ const translateX = newEndX - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().x : item.getMbr().getCenter().x);
46001
+ const translateY = newEndY - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().y : item.getMbr().getCenter().y);
46002
+ if (Array.isArray(item)) {
45984
46003
  const translation = this.board.selection.getManyItemsTranslation(translateX, translateY);
45985
46004
  this.board.selection.transformMany(translation, this.beginTimeStamp);
45986
46005
  } else {
45987
- item2.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
46006
+ item.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
45988
46007
  }
45989
46008
  }
45990
46009
  }
@@ -46027,7 +46046,7 @@ class Select extends Tool {
46027
46046
  return false;
46028
46047
  }
46029
46048
  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;
46049
+ 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
46050
  if (this.isDrawingRectangle) {
46032
46051
  const { x, y } = pointer.point;
46033
46052
  this.line = new Line(new Point(x, y), new Point(x, y));
@@ -46047,7 +46066,7 @@ class Select extends Tool {
46047
46066
  });
46048
46067
  return false;
46049
46068
  }
46050
- const isHoverLocked = hover.every((item2) => item2.transformation.isLocked);
46069
+ const isHoverLocked = hover.every((item) => item.transformation.isLocked);
46051
46070
  if (isHoverLocked) {
46052
46071
  return false;
46053
46072
  }
@@ -46181,7 +46200,7 @@ class Select extends Tool {
46181
46200
  const translation = selection.getManyItemsTranslation(x, y);
46182
46201
  const translationKeys = Object.keys(translation);
46183
46202
  const commentsSet = new Set(this.board.items.getComments().map((comment2) => comment2.getId()));
46184
- if (translationKeys.filter((item2) => !commentsSet.has(item2)).length > 10) {
46203
+ if (translationKeys.filter((item) => !commentsSet.has(item)).length > 10) {
46185
46204
  const selectedMbr = this.board.selection.getMbr()?.copy();
46186
46205
  const sumMbr = this.canvasDrawer.countSumMbr(translation);
46187
46206
  if (sumMbr) {
@@ -46208,7 +46227,7 @@ class Select extends Tool {
46208
46227
  return false;
46209
46228
  }
46210
46229
  const draggingMbr = draggingItem.getMbr();
46211
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item2) => item2 instanceof Frame2);
46230
+ const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
46212
46231
  frames.forEach((frame) => {
46213
46232
  if (frame.handleNesting(draggingItem)) {
46214
46233
  this.nestingHighlighter.add(frame, draggingItem);
@@ -46218,7 +46237,7 @@ class Select extends Tool {
46218
46237
  });
46219
46238
  }
46220
46239
  const hover = items.getUnderPointer();
46221
- this.isHoverUnselectedItem = hover.filter((item2) => item2.itemType === "Placeholder").length === 1;
46240
+ this.isHoverUnselectedItem = hover.filter((item) => item.itemType === "Placeholder").length === 1;
46222
46241
  if (this.isHoverUnselectedItem && !this.isDraggingUnselectedItem && selection.getContext() === "None") {
46223
46242
  selection.setContext("HoverUnderPointer");
46224
46243
  return false;
@@ -46262,15 +46281,15 @@ class Select extends Tool {
46262
46281
  }
46263
46282
  }
46264
46283
  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)) {
46284
+ 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));
46285
+ const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
46286
+ selection.list().forEach((item) => {
46287
+ if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
46269
46288
  frames.forEach((frame) => {
46270
- if (frame.handleNesting(item2)) {
46271
- this.nestingHighlighter.add(frame, item2);
46289
+ if (frame.handleNesting(item)) {
46290
+ this.nestingHighlighter.add(frame, item);
46272
46291
  } else {
46273
- this.nestingHighlighter.remove(item2);
46292
+ this.nestingHighlighter.remove(item);
46274
46293
  }
46275
46294
  });
46276
46295
  }
@@ -46362,7 +46381,7 @@ class Select extends Tool {
46362
46381
  const childrenIds = underPointer.getChildrenIds();
46363
46382
  console.log("UNDERPOINTER", underPointer);
46364
46383
  console.log("CHILDREN", childrenIds);
46365
- const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => childrenIds && childrenIds.includes(item2.getId()));
46384
+ const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => childrenIds && childrenIds.includes(item.getId()));
46366
46385
  this.board.selection.add(itemsInFrame);
46367
46386
  }
46368
46387
  this.board.selection.setContext("EditUnderPointer");
@@ -46602,8 +46621,8 @@ class ShapeTool extends CustomTool {
46602
46621
  resizeType = "leftBottom";
46603
46622
  bounds = new Mbr;
46604
46623
  isDown = false;
46605
- constructor(board, name, item2, settings) {
46606
- super(board, name, item2);
46624
+ constructor(board, name, item, settings) {
46625
+ super(board, name, item);
46607
46626
  this.settings = settings;
46608
46627
  this.setCursor();
46609
46628
  }
@@ -46686,8 +46705,8 @@ class ShapeTool extends CustomTool {
46686
46705
 
46687
46706
  class StickerTool extends CustomTool {
46688
46707
  settings;
46689
- constructor(board, name, item2, settings) {
46690
- super(board, name, item2);
46708
+ constructor(board, name, item, settings) {
46709
+ super(board, name, item);
46691
46710
  this.settings = settings;
46692
46711
  this.setCursor();
46693
46712
  }
@@ -46993,7 +47012,7 @@ class Tools extends ToolContext {
46993
47012
  this.subject.publish(this);
46994
47013
  }
46995
47014
  sortFrames() {
46996
- const frames = this.board.items.listAll().filter((item2) => item2 instanceof Frame2);
47015
+ const frames = this.board.items.listAll().filter((item) => item instanceof Frame2);
46997
47016
  const sortedFrames = frames.sort((fr1, fr2) => {
46998
47017
  const mbr1 = fr1.getMbr();
46999
47018
  const mbr2 = fr2.getMbr();
@@ -47219,24 +47238,24 @@ function validateGroupData(groupData) {
47219
47238
  }
47220
47239
  // src/Items/RegisterItem.ts
47221
47240
  function registerItem({
47222
- item: item2,
47241
+ item,
47223
47242
  defaultData: defaultData2,
47224
47243
  toolData
47225
47244
  }) {
47226
47245
  const { itemType } = defaultData2;
47227
- itemFactories[itemType] = createItemFactory(item2, defaultData2);
47246
+ itemFactories[itemType] = createItemFactory(item, defaultData2);
47228
47247
  itemValidators[itemType] = createItemValidator(defaultData2);
47229
47248
  if (toolData) {
47230
47249
  registeredTools[toolData.name] = toolData.tool;
47231
47250
  }
47232
47251
  itemCommandFactories[itemType] = createItemCommandFactory(itemType);
47233
47252
  }
47234
- function createItemFactory(item2, defaultData2) {
47253
+ function createItemFactory(item, defaultData2) {
47235
47254
  return function itemFactory(id, data, board) {
47236
47255
  if (data.itemType !== defaultData2.itemType) {
47237
47256
  throw new Error(`Invalid data for ${defaultData2.itemType}`);
47238
47257
  }
47239
- return new item2(board, id, defaultData2).setId(id).deserialize(data);
47258
+ return new item(board, id, defaultData2).setId(id).deserialize(data);
47240
47259
  };
47241
47260
  }
47242
47261
  function createItemValidator(defaultData2) {
@@ -47251,7 +47270,7 @@ function createItemValidator(defaultData2) {
47251
47270
  }
47252
47271
  function createItemCommandFactory(itemType) {
47253
47272
  return function itemCommandFactory(items, operation) {
47254
- return new BaseCommand(items.filter((item2) => item2.itemType === itemType), operation);
47273
+ return new BaseCommand(items.filter((item) => item.itemType === itemType), operation);
47255
47274
  };
47256
47275
  }
47257
47276
  // src/Items/Examples/Star/AddStar.ts
@@ -48276,8 +48295,8 @@ class Camera {
48276
48295
  this.observableItem = null;
48277
48296
  }
48278
48297
  }
48279
- subscribeToItem(item2) {
48280
- this.observableItem = item2;
48298
+ subscribeToItem(item) {
48299
+ this.observableItem = item;
48281
48300
  this.observableItem.subject.subscribe(this.observeItem);
48282
48301
  }
48283
48302
  observeItem = () => {
@@ -48503,7 +48522,7 @@ class Camera {
48503
48522
  }
48504
48523
  addToView(mbr, inView) {
48505
48524
  if (!mbr.isEnclosedBy(this.getMbr())) {
48506
- this.viewRectangle(inView.reduce((acc, item2) => acc.combine(item2.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
48525
+ this.viewRectangle(inView.reduce((acc, item) => acc.combine(item.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
48507
48526
  }
48508
48527
  }
48509
48528
  viewRectangle(mbr, offsetInPercent = 10, duration = 500) {
@@ -50112,8 +50131,8 @@ class Presence {
50112
50131
  <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
50132
  </svg>`;
50114
50133
  }
50115
- renderItemMbr(context, item2, color2, customScale) {
50116
- const mbr = item2.getMbr();
50134
+ renderItemMbr(context, item, color2, customScale) {
50135
+ const mbr = item.getMbr();
50117
50136
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
50118
50137
  mbr.borderColor = color2;
50119
50138
  mbr.render(context);
@@ -50253,8 +50272,8 @@ class Presence {
50253
50272
  selectionMbr.strokeWidth = 1 / context.matrix.scaleX;
50254
50273
  selectionMbr.borderColor = selection.color;
50255
50274
  selectionMbr.render(context);
50256
- for (const item2 of selection.selection) {
50257
- this.renderItemMbr(context, item2, selection.color);
50275
+ for (const item of selection.selection) {
50276
+ this.renderItemMbr(context, item, selection.color);
50258
50277
  }
50259
50278
  }
50260
50279
  }
@@ -50287,14 +50306,14 @@ class SelectionItems {
50287
50306
  items = new Map;
50288
50307
  add(value) {
50289
50308
  if (Array.isArray(value)) {
50290
- value.forEach((item2) => this.items.set(item2.getId(), item2));
50309
+ value.forEach((item) => this.items.set(item.getId(), item));
50291
50310
  } else {
50292
50311
  this.items.set(value.getId(), value);
50293
50312
  }
50294
50313
  }
50295
50314
  remove(value) {
50296
50315
  if (Array.isArray(value)) {
50297
- value.forEach((item2) => this.items.delete(item2.getId()));
50316
+ value.forEach((item) => this.items.delete(item.getId()));
50298
50317
  } else {
50299
50318
  this.items.delete(value.getId());
50300
50319
  }
@@ -50324,8 +50343,8 @@ class SelectionItems {
50324
50343
  if (this.isEmpty()) {
50325
50344
  return false;
50326
50345
  }
50327
- for (const item2 of this.items.values()) {
50328
- if (item2.itemType !== "RichText") {
50346
+ for (const item of this.items.values()) {
50347
+ if (item.itemType !== "RichText") {
50329
50348
  return false;
50330
50349
  }
50331
50350
  }
@@ -50335,14 +50354,14 @@ class SelectionItems {
50335
50354
  if (this.isEmpty()) {
50336
50355
  return false;
50337
50356
  }
50338
- return Array.from(this.items).every(([, item2]) => item2.itemType === itemType);
50357
+ return Array.from(this.items).every(([, item]) => item.itemType === itemType);
50339
50358
  }
50340
50359
  isItemTypes(itemTypes) {
50341
50360
  if (this.isEmpty()) {
50342
50361
  return false;
50343
50362
  }
50344
- for (const item2 of this.items.values()) {
50345
- if (!itemTypes.includes(item2.itemType)) {
50363
+ for (const item of this.items.values()) {
50364
+ if (!itemTypes.includes(item.itemType)) {
50346
50365
  return false;
50347
50366
  }
50348
50367
  }
@@ -50350,16 +50369,16 @@ class SelectionItems {
50350
50369
  }
50351
50370
  getItemTypes() {
50352
50371
  const itemTypes = new Set;
50353
- this.items.forEach((item2) => itemTypes.add(item2.itemType));
50372
+ this.items.forEach((item) => itemTypes.add(item.itemType));
50354
50373
  return Array.from(itemTypes);
50355
50374
  }
50356
50375
  getItemsByItemTypes(itemTypes) {
50357
- return Array.from(this.items.values()).filter((item2) => itemTypes.includes(item2.itemType));
50376
+ return Array.from(this.items.values()).filter((item) => itemTypes.includes(item.itemType));
50358
50377
  }
50359
50378
  getIdsByItemTypes(itemTypes) {
50360
50379
  const ids = [];
50361
- this.items.forEach((item2, id) => {
50362
- if (itemTypes.includes(item2.itemType)) {
50380
+ this.items.forEach((item, id) => {
50381
+ if (itemTypes.includes(item.itemType)) {
50363
50382
  ids.push(id);
50364
50383
  }
50365
50384
  });
@@ -50369,7 +50388,7 @@ class SelectionItems {
50369
50388
  return this.isSingle() ? this.items.values().next().value || null : null;
50370
50389
  }
50371
50390
  listByIds(itemIdList) {
50372
- return itemIdList.map((id) => this.items.get(id)).filter((item2) => item2 !== undefined);
50391
+ return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
50373
50392
  }
50374
50393
  ids() {
50375
50394
  return Array.from(this.items.keys());
@@ -50380,7 +50399,7 @@ class SelectionItems {
50380
50399
  return;
50381
50400
  }
50382
50401
  const mbr = items[0].getMbr();
50383
- items.slice(1).forEach((item2) => mbr.combine(item2.getMbr()));
50402
+ items.slice(1).forEach((item) => mbr.combine(item.getMbr()));
50384
50403
  return mbr;
50385
50404
  }
50386
50405
  }
@@ -50585,33 +50604,33 @@ function handleMultipleItemsResize({
50585
50604
  const translation = {};
50586
50605
  const items = itemsToResize ? itemsToResize : board.selection.items.list();
50587
50606
  board.items.getComments().forEach((comment2) => {
50588
- if (items.some((item2) => item2.getId() === comment2.getItemToFollow())) {
50607
+ if (items.some((item) => item.getId() === comment2.getItemToFollow())) {
50589
50608
  items.push(comment2);
50590
50609
  }
50591
50610
  });
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;
50611
+ for (const item of items) {
50612
+ let itemX = item.getMbr().left;
50613
+ let itemY = item.getMbr().top;
50614
+ if (item.itemType === "Drawing") {
50615
+ itemX = item.transformation.matrix.translateX;
50616
+ itemY = item.transformation.matrix.translateY;
50598
50617
  }
50599
50618
  const deltaX = itemX - initMbr.left;
50600
50619
  const translateX = deltaX * matrix.scaleX - deltaX + matrix.translateX;
50601
50620
  const deltaY = itemY - initMbr.top;
50602
50621
  const translateY = deltaY * matrix.scaleY - deltaY + matrix.translateY;
50603
- if (item2 instanceof RichText) {
50604
- translation[item2.getId()] = getRichTextTranslation({
50605
- item: item2,
50622
+ if (item instanceof RichText) {
50623
+ translation[item.getId()] = getRichTextTranslation({
50624
+ item,
50606
50625
  isWidth,
50607
50626
  isHeight,
50608
50627
  matrix,
50609
50628
  translateX,
50610
50629
  translateY
50611
50630
  });
50612
- } else if (item2 instanceof AINode) {
50613
- translation[item2.getId()] = getAINodeTranslation({
50614
- item: item2,
50631
+ } else if (item instanceof AINode) {
50632
+ translation[item.getId()] = getAINodeTranslation({
50633
+ item,
50615
50634
  isWidth,
50616
50635
  isHeight,
50617
50636
  matrix,
@@ -50619,8 +50638,8 @@ function handleMultipleItemsResize({
50619
50638
  translateY
50620
50639
  });
50621
50640
  } else {
50622
- translation[item2.getId()] = getItemTranslation({
50623
- item: item2,
50641
+ translation[item.getId()] = getItemTranslation({
50642
+ item,
50624
50643
  isWidth,
50625
50644
  isHeight,
50626
50645
  matrix,
@@ -50633,7 +50652,7 @@ function handleMultipleItemsResize({
50633
50652
  return translation;
50634
50653
  }
50635
50654
  function getRichTextTranslation({
50636
- item: item2,
50655
+ item,
50637
50656
  isWidth,
50638
50657
  isHeight,
50639
50658
  matrix,
@@ -50641,11 +50660,11 @@ function getRichTextTranslation({
50641
50660
  translateY
50642
50661
  }) {
50643
50662
  if (isWidth) {
50644
- item2.editor.setMaxWidth(item2.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
50663
+ item.editor.setMaxWidth(item.getWidth() / item.transformation.getScale().x * matrix.scaleX);
50645
50664
  return {
50646
50665
  class: "Transformation",
50647
50666
  method: "scaleByTranslateBy",
50648
- item: [item2.getId()],
50667
+ item: [item.getId()],
50649
50668
  translate: { x: matrix.translateX, y: 0 },
50650
50669
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50651
50670
  };
@@ -50653,7 +50672,7 @@ function getRichTextTranslation({
50653
50672
  return {
50654
50673
  class: "Transformation",
50655
50674
  method: "scaleByTranslateBy",
50656
- item: [item2.getId()],
50675
+ item: [item.getId()],
50657
50676
  translate: { x: translateX, y: translateY },
50658
50677
  scale: { x: 1, y: 1 }
50659
50678
  };
@@ -50661,14 +50680,14 @@ function getRichTextTranslation({
50661
50680
  return {
50662
50681
  class: "Transformation",
50663
50682
  method: "scaleByTranslateBy",
50664
- item: [item2.getId()],
50683
+ item: [item.getId()],
50665
50684
  translate: { x: translateX, y: translateY },
50666
50685
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50667
50686
  };
50668
50687
  }
50669
50688
  }
50670
50689
  function getAINodeTranslation({
50671
- item: item2,
50690
+ item,
50672
50691
  isWidth,
50673
50692
  isHeight,
50674
50693
  matrix,
@@ -50676,11 +50695,11 @@ function getAINodeTranslation({
50676
50695
  translateY
50677
50696
  }) {
50678
50697
  if (isWidth) {
50679
- item2.text.editor.setMaxWidth(item2.text.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
50698
+ item.text.editor.setMaxWidth(item.text.getWidth() / item.transformation.getScale().x * matrix.scaleX);
50680
50699
  return {
50681
50700
  class: "Transformation",
50682
50701
  method: "scaleByTranslateBy",
50683
- item: [item2.getId()],
50702
+ item: [item.getId()],
50684
50703
  translate: { x: matrix.translateX, y: 0 },
50685
50704
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50686
50705
  };
@@ -50688,7 +50707,7 @@ function getAINodeTranslation({
50688
50707
  return {
50689
50708
  class: "Transformation",
50690
50709
  method: "scaleByTranslateBy",
50691
- item: [item2.getId()],
50710
+ item: [item.getId()],
50692
50711
  translate: { x: translateX, y: translateY },
50693
50712
  scale: { x: 1, y: 1 }
50694
50713
  };
@@ -50696,14 +50715,14 @@ function getAINodeTranslation({
50696
50715
  return {
50697
50716
  class: "Transformation",
50698
50717
  method: "scaleByTranslateBy",
50699
- item: [item2.getId()],
50718
+ item: [item.getId()],
50700
50719
  translate: { x: translateX, y: translateY },
50701
50720
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50702
50721
  };
50703
50722
  }
50704
50723
  }
50705
50724
  function getItemTranslation({
50706
- item: item2,
50725
+ item,
50707
50726
  isWidth,
50708
50727
  isHeight,
50709
50728
  matrix,
@@ -50711,22 +50730,22 @@ function getItemTranslation({
50711
50730
  translateY,
50712
50731
  isShiftPressed
50713
50732
  }) {
50714
- if (item2 instanceof Sticker && (isWidth || isHeight)) {
50733
+ if (item instanceof Sticker && (isWidth || isHeight)) {
50715
50734
  return {
50716
50735
  class: "Transformation",
50717
50736
  method: "scaleByTranslateBy",
50718
- item: [item2.getId()],
50737
+ item: [item.getId()],
50719
50738
  translate: { x: translateX, y: translateY },
50720
50739
  scale: { x: 1, y: 1 }
50721
50740
  };
50722
50741
  } else {
50723
- if (item2 instanceof Frame2 && item2.getCanChangeRatio() && isShiftPressed && item2.getFrameType() !== "Custom") {
50724
- item2.setFrameType("Custom");
50742
+ if (item instanceof Frame2 && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
50743
+ item.setFrameType("Custom");
50725
50744
  }
50726
50745
  return {
50727
50746
  class: "Transformation",
50728
50747
  method: "scaleByTranslateBy",
50729
- item: [item2.getId()],
50748
+ item: [item.getId()],
50730
50749
  translate: { x: translateX, y: translateY },
50731
50750
  scale: { x: matrix.scaleX, y: matrix.scaleY }
50732
50751
  };
@@ -50999,11 +51018,11 @@ function transformItems({
50999
51018
  setSnapCursorPos
51000
51019
  }) {
51001
51020
  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");
51021
+ const includesProportionalItem = items.some((item) => item.itemType === "Sticker" || item.itemType === "RichText" || item.itemType === "AINode" || item.itemType === "Video" || item.itemType === "Audio");
51003
51022
  if (includesProportionalItem && (isWidth || isHeight)) {
51004
51023
  return null;
51005
51024
  }
51006
- const isIncludesFixedFrame = items.some((item2) => item2 instanceof Frame2 && !item2.getCanChangeRatio());
51025
+ const isIncludesFixedFrame = items.some((item) => item instanceof Frame2 && !item.getCanChangeRatio());
51007
51026
  const shouldBeProportionalResize = isIncludesFixedFrame || includesProportionalItem || isShiftPressed || !isWidth && !isHeight;
51008
51027
  const resize = shouldBeProportionalResize ? getProportionalResize(resizeType, board.pointer.point, mbr, oppositePoint) : getResize(resizeType, board.pointer.point, mbr, oppositePoint);
51009
51028
  if (canvasDrawer.getLastCreatedCanvas() && !debounceUpd.shouldUpd()) {
@@ -51081,23 +51100,23 @@ function updateFrameChildren({
51081
51100
  nestingHighlighter
51082
51101
  }) {
51083
51102
  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();
51103
+ board.selection.items.list().forEach((item) => {
51104
+ if ("getChildrenIds" in item && item.getChildrenIds()) {
51105
+ const currMbr = item.getMbr();
51087
51106
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
51088
51107
  itemsToCheck.forEach((currItem) => {
51089
- if (item2.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item2.getId())) {
51090
- nestingHighlighter.add(item2, currItem);
51108
+ if (item.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item.getId())) {
51109
+ nestingHighlighter.add(item, currItem);
51091
51110
  } else {
51092
51111
  nestingHighlighter.remove(currItem);
51093
51112
  }
51094
51113
  });
51095
51114
  } else {
51096
51115
  groups.forEach((group) => {
51097
- if (group.handleNesting(item2)) {
51098
- nestingHighlighter.add(group, item2);
51116
+ if (group.handleNesting(item)) {
51117
+ nestingHighlighter.add(group, item);
51099
51118
  } else {
51100
- nestingHighlighter.remove(item2);
51119
+ nestingHighlighter.remove(item);
51101
51120
  }
51102
51121
  });
51103
51122
  }
@@ -51165,9 +51184,9 @@ class Transformer extends Tool {
51165
51184
  const pointer = this.board.pointer;
51166
51185
  const camera = this.board.camera;
51167
51186
  const items = this.selection.items;
51168
- const item2 = items.getSingle();
51187
+ const item = items.getSingle();
51169
51188
  let resizeType;
51170
- if (item2 && (item2.itemType === "RichText" || item2.itemType === "Sticker")) {
51189
+ if (item && (item.itemType === "RichText" || item.itemType === "Sticker")) {
51171
51190
  resizeType = getTextResizeType(pointer.point, camera.getScale(), mbr);
51172
51191
  } else {
51173
51192
  resizeType = getResizeType(pointer.point, camera.getScale(), mbr);
@@ -51421,8 +51440,8 @@ class SelectionTransformer extends Tool {
51421
51440
  return;
51422
51441
  }
51423
51442
  if (this.selection.items.isSingle()) {
51424
- const item2 = this.selection.items.getSingle();
51425
- if (item2?.itemType === "Connector") {
51443
+ const item = this.selection.items.getSingle();
51444
+ if (item?.itemType === "Connector") {
51426
51445
  this.tool = this.connectorTransformerTool;
51427
51446
  return;
51428
51447
  } else {
@@ -51505,16 +51524,16 @@ class BoardSelection {
51505
51524
  this.quickAddButtons = getQuickAddButtons(this, board);
51506
51525
  }
51507
51526
  serialize() {
51508
- const selectedItems = this.items.list().map((item2) => item2.getId());
51527
+ const selectedItems = this.items.list().map((item) => item.getId());
51509
51528
  return JSON.stringify(selectedItems);
51510
51529
  }
51511
51530
  deserialize(serializedData) {
51512
51531
  const selectedItems = JSON.parse(serializedData);
51513
51532
  this.removeAll();
51514
51533
  selectedItems.forEach((itemId) => {
51515
- const item2 = this.board.items.getById(itemId);
51516
- if (item2) {
51517
- this.items.add(item2);
51534
+ const item = this.board.items.getById(itemId);
51535
+ if (item) {
51536
+ this.items.add(item);
51518
51537
  }
51519
51538
  });
51520
51539
  }
@@ -51592,19 +51611,19 @@ class BoardSelection {
51592
51611
  this.updateQueue.clear();
51593
51612
  safeRequestAnimationFrame(this.updateScheduledObservers);
51594
51613
  };
51595
- itemObserver = (item2) => {
51614
+ itemObserver = (item) => {
51596
51615
  if (!this.shouldPublish) {
51597
51616
  return;
51598
51617
  }
51599
51618
  this.subject.publish(this);
51600
- this.itemSubject.publish(item2);
51619
+ this.itemSubject.publish(item);
51601
51620
  };
51602
51621
  decoratedItemObserver = this.decorateObserverToScheduleUpdate(this.itemObserver);
51603
51622
  add(value) {
51604
51623
  this.items.add(value);
51605
51624
  if (Array.isArray(value)) {
51606
- for (const item2 of value) {
51607
- item2.subject.subscribe(this.itemObserver);
51625
+ for (const item of value) {
51626
+ item.subject.subscribe(this.itemObserver);
51608
51627
  }
51609
51628
  } else {
51610
51629
  value.subject.subscribe(this.itemObserver);
@@ -51613,15 +51632,15 @@ class BoardSelection {
51613
51632
  this.itemsSubject.publish([]);
51614
51633
  }
51615
51634
  addAll() {
51616
- const items = this.board.items.listAll().filter((item2) => !item2.transformation.isLocked);
51635
+ const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked);
51617
51636
  this.add(items);
51618
51637
  this.setContext("SelectByRect");
51619
51638
  }
51620
51639
  remove(value) {
51621
51640
  this.items.remove(value);
51622
51641
  if (Array.isArray(value)) {
51623
- for (const item2 of value) {
51624
- item2.subject.unsubscribe(this.itemObserver);
51642
+ for (const item of value) {
51643
+ item.subject.unsubscribe(this.itemObserver);
51625
51644
  }
51626
51645
  } else {
51627
51646
  value.subject.unsubscribe(this.itemObserver);
@@ -51715,11 +51734,11 @@ class BoardSelection {
51715
51734
  if (!this.items.isSingle()) {
51716
51735
  return;
51717
51736
  }
51718
- const item2 = this.items.getSingle();
51719
- if (!item2) {
51737
+ const item = this.items.getSingle();
51738
+ if (!item) {
51720
51739
  return;
51721
51740
  }
51722
- const text5 = item2.getRichText();
51741
+ const text5 = item.getRichText();
51723
51742
  if (!text5) {
51724
51743
  return;
51725
51744
  }
@@ -51730,7 +51749,7 @@ class BoardSelection {
51730
51749
  if (shouldReplace || moveCursorToEnd) {
51731
51750
  text5.editor.moveCursorToEndOfTheText();
51732
51751
  }
51733
- this.setTextToEdit(item2);
51752
+ this.setTextToEdit(item);
51734
51753
  this.setContext("EditTextUnderPointer");
51735
51754
  if (shouldSelect) {
51736
51755
  text5.editor.selectWholeText();
@@ -51740,13 +51759,13 @@ class BoardSelection {
51740
51759
  editUnderPointer() {
51741
51760
  this.removeAll();
51742
51761
  const stack = this.board.items.getUnderPointer();
51743
- const item2 = stack.pop();
51744
- if (item2) {
51745
- this.add(item2);
51762
+ const item = stack.pop();
51763
+ if (item) {
51764
+ this.add(item);
51746
51765
  this.setTextToEdit(undefined);
51747
- const text5 = item2.getRichText();
51766
+ const text5 = item.getRichText();
51748
51767
  if (text5) {
51749
- this.setTextToEdit(item2);
51768
+ this.setTextToEdit(item);
51750
51769
  text5.editor.selectWholeText();
51751
51770
  this.board.items.subject.publish(this.board.items);
51752
51771
  }
@@ -51755,26 +51774,26 @@ class BoardSelection {
51755
51774
  this.setContext("None");
51756
51775
  }
51757
51776
  }
51758
- setTextToEdit(item2) {
51777
+ setTextToEdit(item) {
51759
51778
  if (this.textToEdit) {
51760
51779
  this.textToEdit.updateElement();
51761
51780
  this.textToEdit.enableRender();
51762
51781
  }
51763
- if (!(item2 && item2.getRichText())) {
51782
+ if (!(item && item.getRichText())) {
51764
51783
  this.textToEdit = undefined;
51765
51784
  return;
51766
51785
  }
51767
- const text5 = item2.getRichText();
51786
+ const text5 = item.getRichText();
51768
51787
  if (!text5) {
51769
51788
  return;
51770
51789
  }
51771
51790
  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);
51791
+ const textColor = tempStorage.getFontColor(item.itemType);
51792
+ const textSize = tempStorage.getFontSize(item.itemType);
51793
+ const highlightColor = tempStorage.getFontHighlight(item.itemType);
51794
+ const styles = tempStorage.getFontStyles(item.itemType);
51795
+ const horizontalAlignment = tempStorage.getHorizontalAlignment(item.itemType);
51796
+ const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
51778
51797
  if (textColor) {
51779
51798
  text5.setSelectionFontColor(textColor, "None");
51780
51799
  }
@@ -51782,7 +51801,7 @@ class BoardSelection {
51782
51801
  this.emit({
51783
51802
  class: "RichText",
51784
51803
  method: "setFontSize",
51785
- item: [item2.getId()],
51804
+ item: [item.getId()],
51786
51805
  fontSize: textSize,
51787
51806
  context: this.getContext()
51788
51807
  });
@@ -51794,10 +51813,10 @@ class BoardSelection {
51794
51813
  const stylesArr = styles;
51795
51814
  text5.setSelectionFontStyle(stylesArr, "None");
51796
51815
  }
51797
- if (horizontalAlignment && !(item2 instanceof Sticker)) {
51816
+ if (horizontalAlignment && !(item instanceof Sticker)) {
51798
51817
  text5.setSelectionHorisontalAlignment(horizontalAlignment);
51799
51818
  }
51800
- if (verticalAlignment && !(item2 instanceof Sticker)) {
51819
+ if (verticalAlignment && !(item instanceof Sticker)) {
51801
51820
  this.setVerticalAlignment(verticalAlignment);
51802
51821
  }
51803
51822
  }
@@ -51830,8 +51849,8 @@ class BoardSelection {
51830
51849
  }
51831
51850
  selectEnclosedOrCrossedBy(rect) {
51832
51851
  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);
51852
+ const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item) => !item.transformation.isLocked);
51853
+ 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
51854
  if (list6.length !== 0) {
51836
51855
  this.add(list6);
51837
51856
  this.setContext("SelectByRect");
@@ -51845,14 +51864,14 @@ class BoardSelection {
51845
51864
  canChangeText() {
51846
51865
  return Boolean(this.items.isSingle() && this.items.getSingle()?.getRichText());
51847
51866
  }
51848
- handleItemCopy(item2, copiedItemsMap) {
51849
- const serializedData = item2.serialize(true);
51850
- const zIndex = this.board.items.index.getZIndex(item2);
51851
- if (item2.itemType === "Comment") {
51867
+ handleItemCopy(item, copiedItemsMap) {
51868
+ const serializedData = item.serialize(true);
51869
+ const zIndex = this.board.items.index.getZIndex(item);
51870
+ if (item.itemType === "Comment") {
51852
51871
  return;
51853
51872
  }
51854
- if (item2.itemType === "Connector" && serializedData.itemType === "Connector") {
51855
- const connector = item2;
51873
+ if (item.itemType === "Connector" && serializedData.itemType === "Connector") {
51874
+ const connector = item;
51856
51875
  const startPoint = connector.getStartPoint();
51857
51876
  const endPoint = connector.getEndPoint();
51858
51877
  const startItemId = startPoint.pointType !== "Board" ? startPoint.item.getId() : null;
@@ -51868,19 +51887,19 @@ class BoardSelection {
51868
51887
  serializedData.endPoint = new BoardPoint(endPoint.x, endPoint.y).serialize();
51869
51888
  }
51870
51889
  }
51871
- const textItem = item2.getRichText()?.getTextString();
51890
+ const textItem = item.getRichText()?.getTextString();
51872
51891
  const copyText = conf.i18n.t("frame.copy");
51873
51892
  const isCopyTextExist = textItem?.includes(copyText);
51874
- const isChangeCopiedFrameText = item2.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
51893
+ const isChangeCopiedFrameText = item.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
51875
51894
  if (isChangeCopiedFrameText) {
51876
51895
  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 || "");
51896
+ item.getRichText()?.editor.clearText();
51897
+ item.getRichText()?.editor.addText(copiedFrameText);
51898
+ serializedData.text = item.getRichText()?.serialize();
51899
+ item.getRichText()?.editor.clearText();
51900
+ item.getRichText()?.editor.addText(textItem || "");
51882
51901
  }
51883
- copiedItemsMap[item2.getId()] = { ...serializedData, zIndex };
51902
+ copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
51884
51903
  }
51885
51904
  copy(skipImageBlobCopy) {
51886
51905
  const copiedItemsMap = {};
@@ -51889,12 +51908,12 @@ class BoardSelection {
51889
51908
  this.handleItemCopy(single, copiedItemsMap);
51890
51909
  return { imageElement: single.image, imageData: copiedItemsMap };
51891
51910
  }
51892
- this.list().forEach((item2) => {
51893
- this.handleItemCopy(item2, copiedItemsMap);
51911
+ this.list().forEach((item) => {
51912
+ this.handleItemCopy(item, copiedItemsMap);
51894
51913
  });
51895
- this.list().flatMap((item2) => {
51896
- if (item2 instanceof Frame2) {
51897
- return item2.getChildrenIds();
51914
+ this.list().flatMap((item) => {
51915
+ if (item instanceof Frame2) {
51916
+ return item.getChildrenIds();
51898
51917
  }
51899
51918
  return [];
51900
51919
  }).forEach((id) => {
@@ -51922,11 +51941,11 @@ class BoardSelection {
51922
51941
  let maxRichText = null;
51923
51942
  let minRichText = null;
51924
51943
  const itemType = items[0].itemType;
51925
- for (const item2 of items) {
51926
- if (item2.itemType !== itemType) {
51944
+ for (const item of items) {
51945
+ if (item.itemType !== itemType) {
51927
51946
  return null;
51928
51947
  }
51929
- const richText = item2.getRichText();
51948
+ const richText = item.getRichText();
51930
51949
  if (richText) {
51931
51950
  if (!maxRichText || richText.getFontSize() > maxRichText.getFontSize()) {
51932
51951
  maxRichText = richText;
@@ -52032,22 +52051,22 @@ class BoardSelection {
52032
52051
  }
52033
52052
  nestSelectedItems(unselectedItem, checkFrames = true) {
52034
52053
  const selected = this.board.selection.items.list();
52035
- if (unselectedItem && !selected.find((item2) => item2.getId() === unselectedItem.getId())) {
52054
+ if (unselectedItem && !selected.find((item) => item.getId() === unselectedItem.getId())) {
52036
52055
  selected.push(unselectedItem);
52037
52056
  }
52038
- const selectedMbr = selected.reduce((acc, item2) => {
52057
+ const selectedMbr = selected.reduce((acc, item) => {
52039
52058
  if (!acc) {
52040
- return item2.getMbr();
52059
+ return item.getMbr();
52041
52060
  }
52042
- return acc.combine(item2.getMbr());
52061
+ return acc.combine(item.getMbr());
52043
52062
  }, undefined);
52044
52063
  if (selectedMbr) {
52045
- const selectedMap = Object.fromEntries(selected.map((item2) => [item2.getId(), { item: item2, nested: false }]));
52064
+ const selectedMap = Object.fromEntries(selected.map((item) => [item.getId(), { item, nested: false }]));
52046
52065
  const enclosedGroups = this.board.items.getGroupItemsEnclosedOrCrossed(selectedMbr?.left, selectedMbr?.top, selectedMbr?.right, selectedMbr?.bottom);
52047
52066
  enclosedGroups.forEach((group) => {
52048
- selected.forEach((item2) => {
52049
- if (group.handleNesting(item2)) {
52050
- selectedMap[item2.getId()].nested = group;
52067
+ selected.forEach((item) => {
52068
+ if (group.handleNesting(item)) {
52069
+ selectedMap[item.getId()].nested = group;
52051
52070
  }
52052
52071
  });
52053
52072
  });
@@ -52071,11 +52090,11 @@ class BoardSelection {
52071
52090
  if (childrenIds && checkFrames) {
52072
52091
  const currGroup = val.item;
52073
52092
  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());
52093
+ const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
52094
+ const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
52076
52095
  const uniqueItems = new Set;
52077
- const toCheck = [...children, ...underGroup].filter((item2) => {
52078
- const id = item2.getId();
52096
+ const toCheck = [...children, ...underGroup].filter((item) => {
52097
+ const id = item.getId();
52079
52098
  if (uniqueItems.has(id)) {
52080
52099
  return false;
52081
52100
  }
@@ -52116,8 +52135,8 @@ class BoardSelection {
52116
52135
  addItemToTranslation(childId);
52117
52136
  }
52118
52137
  }
52119
- const createTranslationWithComments = (item2) => {
52120
- const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item2.getId());
52138
+ const createTranslationWithComments = (item) => {
52139
+ const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item.getId());
52121
52140
  for (const comment2 of followedComments) {
52122
52141
  translation[comment2.getId()] = {
52123
52142
  class: "Transformation",
@@ -52178,21 +52197,21 @@ class BoardSelection {
52178
52197
  newData: { borderColor }
52179
52198
  };
52180
52199
  const operations2 = {};
52181
- this.items.list().forEach((item2) => {
52182
- if (!operations2[item2.itemType]) {
52200
+ this.items.list().forEach((item) => {
52201
+ if (!operations2[item.itemType]) {
52183
52202
  const operationCopy = { ...operation };
52184
- if (item2.itemType === "Connector") {
52203
+ if (item.itemType === "Connector") {
52185
52204
  operationCopy.method = "setLineColor";
52186
52205
  operationCopy.lineColor = borderColor;
52187
- } else if (item2.itemType === "Drawing") {
52206
+ } else if (item.itemType === "Drawing") {
52188
52207
  operationCopy.method = "setStrokeColor";
52189
52208
  operationCopy.color = borderColor;
52190
52209
  } else {
52191
52210
  operationCopy.borderColor = borderColor;
52192
52211
  }
52193
- operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
52212
+ operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
52194
52213
  } else {
52195
- operations2[item2.itemType].item.push(item2.getId());
52214
+ operations2[item.itemType].item.push(item.getId());
52196
52215
  }
52197
52216
  });
52198
52217
  Object.values(operations2).forEach((op) => {
@@ -52207,13 +52226,13 @@ class BoardSelection {
52207
52226
  newData: { borderWidth: width2 }
52208
52227
  };
52209
52228
  const operations2 = {};
52210
- this.items.list().forEach((item2) => {
52211
- if (!operations2[item2.itemType]) {
52229
+ this.items.list().forEach((item) => {
52230
+ if (!operations2[item.itemType]) {
52212
52231
  const operationCopy = { ...operation };
52213
- if (item2.itemType === "Connector") {
52232
+ if (item.itemType === "Connector") {
52214
52233
  operationCopy.method = "setLineWidth";
52215
52234
  operationCopy.lineWidth = width2;
52216
- } else if (item2.itemType === "Drawing") {
52235
+ } else if (item.itemType === "Drawing") {
52217
52236
  operationCopy.method = "setStrokeWidth";
52218
52237
  operationCopy.width = width2;
52219
52238
  operationCopy.prevWidth = this.getStrokeWidth();
@@ -52221,9 +52240,9 @@ class BoardSelection {
52221
52240
  operationCopy.borderWidth = width2;
52222
52241
  operationCopy.prevBorderWidth = this.getStrokeWidth();
52223
52242
  }
52224
- operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
52243
+ operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
52225
52244
  } else {
52226
- operations2[item2.itemType].item.push(item2.getId());
52245
+ operations2[item.itemType].item.push(item.getId());
52227
52246
  }
52228
52247
  });
52229
52248
  Object.values(operations2).forEach((op) => {
@@ -52239,11 +52258,11 @@ class BoardSelection {
52239
52258
  newData: { backgroundColor }
52240
52259
  };
52241
52260
  const operations2 = {};
52242
- this.items.list().forEach((item2) => {
52243
- if (!operations2[item2.itemType]) {
52244
- operations2[item2.itemType] = { ...operation, class: item2.itemType, item: [item2.getId()] };
52261
+ this.items.list().forEach((item) => {
52262
+ if (!operations2[item.itemType]) {
52263
+ operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
52245
52264
  } else {
52246
- operations2[item2.itemType].item.push(item2.getId());
52265
+ operations2[item.itemType].item.push(item.getId());
52247
52266
  }
52248
52267
  });
52249
52268
  Object.values(operations2).forEach((op) => {
@@ -52267,9 +52286,9 @@ class BoardSelection {
52267
52286
  }
52268
52287
  setFrameType(frameType) {
52269
52288
  const items = this.items.list();
52270
- items.forEach((item2) => {
52271
- if (item2 instanceof Frame2) {
52272
- item2.setFrameType(frameType);
52289
+ items.forEach((item) => {
52290
+ if (item instanceof Frame2) {
52291
+ item.setFrameType(frameType);
52273
52292
  }
52274
52293
  });
52275
52294
  }
@@ -52288,21 +52307,21 @@ class BoardSelection {
52288
52307
  setFontSize(size) {
52289
52308
  const fontSize = size === "auto" ? size : toFiniteNumber(size);
52290
52309
  const itemsOps = [];
52291
- for (const item2 of this.items.list()) {
52292
- const text5 = item2.getRichText();
52310
+ for (const item of this.items.list()) {
52311
+ const text5 = item.getRichText();
52293
52312
  if (!text5) {
52294
52313
  continue;
52295
52314
  }
52296
52315
  const ops = text5.setSelectionFontSize(fontSize, this.context);
52297
52316
  itemsOps.push({
52298
- item: item2.getId(),
52317
+ item: item.getId(),
52299
52318
  selection: text5.editor.getSelection(),
52300
52319
  ops
52301
52320
  });
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);
52321
+ if (item.itemType === "Sticker" && fontSize === "auto") {
52322
+ tempStorage.remove(`fontSize_${item.itemType}`);
52323
+ } else if (item.itemType !== "AINode") {
52324
+ tempStorage.setFontSize(item.itemType, fontSize);
52306
52325
  }
52307
52326
  }
52308
52327
  const emptyOps = itemsOps.filter((op) => !op.ops.length);
@@ -52325,8 +52344,8 @@ class BoardSelection {
52325
52344
  setFontStyle(fontStyle) {
52326
52345
  const isMultiple = !this.items.isSingle();
52327
52346
  const itemsOps = [];
52328
- for (const item2 of this.items.list()) {
52329
- const text5 = item2.getRichText();
52347
+ for (const item of this.items.list()) {
52348
+ const text5 = item.getRichText();
52330
52349
  if (!text5) {
52331
52350
  continue;
52332
52351
  }
@@ -52335,12 +52354,12 @@ class BoardSelection {
52335
52354
  }
52336
52355
  const ops = text5.setSelectionFontStyle(fontStyle, this.context);
52337
52356
  itemsOps.push({
52338
- item: item2.getId(),
52357
+ item: item.getId(),
52339
52358
  selection: text5.editor.getSelection(),
52340
52359
  ops
52341
52360
  });
52342
- if (item2.itemType !== "AINode") {
52343
- tempStorage.setFontStyles(item2.itemType, text5.getFontStyles());
52361
+ if (item.itemType !== "AINode") {
52362
+ tempStorage.setFontStyles(item.itemType, text5.getFontStyles());
52344
52363
  }
52345
52364
  }
52346
52365
  this.emitApplied({
@@ -52352,8 +52371,8 @@ class BoardSelection {
52352
52371
  setFontColor(fontColor) {
52353
52372
  const isMultiple = !this.items.isSingle();
52354
52373
  const itemsOps = [];
52355
- for (const item2 of this.items.list()) {
52356
- const text5 = item2.getRichText();
52374
+ for (const item of this.items.list()) {
52375
+ const text5 = item.getRichText();
52357
52376
  if (!text5) {
52358
52377
  continue;
52359
52378
  }
@@ -52362,11 +52381,11 @@ class BoardSelection {
52362
52381
  }
52363
52382
  const ops = text5.setSelectionFontColor(fontColor, this.context);
52364
52383
  itemsOps.push({
52365
- item: item2.getId(),
52384
+ item: item.getId(),
52366
52385
  selection: text5.editor.getSelection(),
52367
52386
  ops
52368
52387
  });
52369
- tempStorage.setFontColor(item2.itemType, fontColor);
52388
+ tempStorage.setFontColor(item.itemType, fontColor);
52370
52389
  }
52371
52390
  this.emitApplied({
52372
52391
  class: "RichText",
@@ -52395,8 +52414,8 @@ class BoardSelection {
52395
52414
  setFontHighlight(fontHighlight) {
52396
52415
  const isMultiple = !this.items.isSingle();
52397
52416
  const itemsOps = [];
52398
- for (const item2 of this.items.list()) {
52399
- const text5 = item2.getRichText();
52417
+ for (const item of this.items.list()) {
52418
+ const text5 = item.getRichText();
52400
52419
  if (!text5) {
52401
52420
  continue;
52402
52421
  }
@@ -52405,12 +52424,12 @@ class BoardSelection {
52405
52424
  }
52406
52425
  const ops = text5.setSelectionFontHighlight(fontHighlight, this.context);
52407
52426
  itemsOps.push({
52408
- item: item2.getId(),
52427
+ item: item.getId(),
52409
52428
  selection: text5.editor.getSelection(),
52410
52429
  ops
52411
52430
  });
52412
- if (item2.itemType !== "AINode") {
52413
- tempStorage.setFontHighlight(item2.itemType, fontHighlight);
52431
+ if (item.itemType !== "AINode") {
52432
+ tempStorage.setFontHighlight(item.itemType, fontHighlight);
52414
52433
  }
52415
52434
  }
52416
52435
  this.emitApplied({
@@ -52422,8 +52441,8 @@ class BoardSelection {
52422
52441
  setHorisontalAlignment(horisontalAlignment) {
52423
52442
  const isMultiple = !this.items.isSingle();
52424
52443
  const itemsOps = [];
52425
- for (const item2 of this.items.list()) {
52426
- const text5 = item2.getRichText();
52444
+ for (const item of this.items.list()) {
52445
+ const text5 = item.getRichText();
52427
52446
  if (!text5) {
52428
52447
  continue;
52429
52448
  }
@@ -52432,11 +52451,11 @@ class BoardSelection {
52432
52451
  }
52433
52452
  const ops = text5.setSelectionHorisontalAlignment(horisontalAlignment, this.context);
52434
52453
  itemsOps.push({
52435
- item: item2.getId(),
52454
+ item: item.getId(),
52436
52455
  selection: text5.editor.getSelection(),
52437
52456
  ops
52438
52457
  });
52439
- tempStorage.setHorizontalAlignment(item2.itemType, horisontalAlignment);
52458
+ tempStorage.setHorizontalAlignment(item.itemType, horisontalAlignment);
52440
52459
  }
52441
52460
  this.emitApplied({
52442
52461
  class: "RichText",
@@ -52452,23 +52471,23 @@ class BoardSelection {
52452
52471
  verticalAlignment
52453
52472
  });
52454
52473
  if (this.items.isSingle()) {
52455
- const item2 = this.items.getSingle();
52456
- if (!item2) {
52474
+ const item = this.items.getSingle();
52475
+ if (!item) {
52457
52476
  return;
52458
52477
  }
52459
- const text5 = item2.getRichText();
52478
+ const text5 = item.getRichText();
52460
52479
  if (!text5) {
52461
52480
  return;
52462
52481
  }
52463
- tempStorage.setVerticalAlignment(item2.itemType, verticalAlignment);
52464
- if (item2 instanceof RichText) {
52465
- item2.setEditorFocus(this.context);
52482
+ tempStorage.setVerticalAlignment(item.itemType, verticalAlignment);
52483
+ if (item instanceof RichText) {
52484
+ item.setEditorFocus(this.context);
52466
52485
  }
52467
52486
  text5.setEditorFocus(this.context);
52468
52487
  }
52469
52488
  }
52470
52489
  removeFromBoard() {
52471
- const isLocked = this.items.list().some((item2) => item2.transformation.isLocked);
52490
+ const isLocked = this.items.list().some((item) => item.transformation.isLocked);
52472
52491
  if (isLocked) {
52473
52492
  return;
52474
52493
  }
@@ -52491,7 +52510,7 @@ class BoardSelection {
52491
52510
  }
52492
52511
  getIsLockedSelection() {
52493
52512
  const items = this.list();
52494
- return items.some((item2) => item2.transformation.isLocked);
52513
+ return items.some((item) => item.transformation.isLocked);
52495
52514
  }
52496
52515
  isLocked() {
52497
52516
  return false;
@@ -52518,9 +52537,9 @@ class BoardSelection {
52518
52537
  }
52519
52538
  async duplicate() {
52520
52539
  const mediaIds = [];
52521
- this.items.list().forEach((item2) => {
52522
- if ("getStorageId" in item2) {
52523
- const storageId = item2.getStorageId();
52540
+ this.items.list().forEach((item) => {
52541
+ if ("getStorageId" in item) {
52542
+ const storageId = item.getStorageId();
52524
52543
  if (storageId) {
52525
52544
  mediaIds.push(storageId);
52526
52545
  }
@@ -52530,7 +52549,7 @@ class BoardSelection {
52530
52549
  if (!canDuplicate) {
52531
52550
  return;
52532
52551
  }
52533
- const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item2]) => item2.itemType !== "Group"));
52552
+ const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item]) => item.itemType !== "Group"));
52534
52553
  this.board.duplicate(filteredItemMap);
52535
52554
  this.setContext("EditUnderPointer");
52536
52555
  }
@@ -52564,10 +52583,10 @@ class BoardSelection {
52564
52583
  lastAssistantMessageId
52565
52584
  };
52566
52585
  }
52567
- renderItemMbr(context, item2, customScale) {
52568
- const mbr = item2.getMbr();
52586
+ renderItemMbr(context, item, customScale) {
52587
+ const mbr = item.getMbr();
52569
52588
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
52570
- const selectionColor = item2.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
52589
+ const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
52571
52590
  mbr.borderColor = selectionColor;
52572
52591
  mbr.render(context);
52573
52592
  }
@@ -52583,8 +52602,8 @@ class BoardSelection {
52583
52602
  }
52584
52603
  if (!this.transformationRenderBlock) {
52585
52604
  if (this.shouldRenderItemsMbr) {
52586
- for (const item2 of this.items.list()) {
52587
- this.renderItemMbr(context, item2);
52605
+ for (const item of this.items.list()) {
52606
+ this.renderItemMbr(context, item);
52588
52607
  }
52589
52608
  }
52590
52609
  this.tool.render(context);
@@ -52596,7 +52615,7 @@ class BoardSelection {
52596
52615
  if (single && single instanceof AINode) {
52597
52616
  const contextItemsIds = single.getContextItems();
52598
52617
  if (contextItemsIds.length) {
52599
- const newContextItems = this.board.items.listAll().filter((item2) => contextItemsIds.includes(item2.getId()));
52618
+ const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
52600
52619
  contextItems.push(...newContextItems);
52601
52620
  }
52602
52621
  }
@@ -52614,15 +52633,15 @@ class BoardSelection {
52614
52633
  }
52615
52634
  }
52616
52635
  }
52617
- contextItems.forEach((item2) => {
52618
- if (item2 instanceof AINode) {
52619
- const path2 = item2.getPath();
52636
+ contextItems.forEach((item) => {
52637
+ if (item instanceof AINode) {
52638
+ const path2 = item.getPath();
52620
52639
  path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
52621
52640
  path2.setBorderWidth(2);
52622
52641
  path2.setBackgroundColor("none");
52623
52642
  path2.render(context);
52624
52643
  } else {
52625
- const itemRect = item2.getMbr();
52644
+ const itemRect = item.getMbr();
52626
52645
  itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
52627
52646
  itemRect.strokeWidth = 2;
52628
52647
  itemRect.render(context);
@@ -53123,16 +53142,16 @@ class Board {
53123
53142
  applyBoardOperation(op) {
53124
53143
  switch (op.method) {
53125
53144
  case "moveToZIndex": {
53126
- const item2 = this.index.getById(op.item);
53127
- if (!item2) {
53145
+ const item = this.index.getById(op.item);
53146
+ if (!item) {
53128
53147
  return;
53129
53148
  }
53130
- return this.index.moveToZIndex(item2, op.zIndex);
53149
+ return this.index.moveToZIndex(item, op.zIndex);
53131
53150
  }
53132
53151
  case "moveManyToZIndex": {
53133
53152
  for (const id in op.item) {
53134
- const item2 = this.items.getById(id);
53135
- if (!item2) {
53153
+ const item = this.items.getById(id);
53154
+ if (!item) {
53136
53155
  delete op.item.id;
53137
53156
  }
53138
53157
  }
@@ -53154,11 +53173,11 @@ class Board {
53154
53173
  }
53155
53174
  return this.index.moveSecondAfterFirst(first, second);
53156
53175
  case "bringToFront": {
53157
- const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
53176
+ const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
53158
53177
  return this.index.bringManyToFront(items);
53159
53178
  }
53160
53179
  case "sendToBack": {
53161
- const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
53180
+ const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
53162
53181
  return this.index.sendManyToBack(items);
53163
53182
  }
53164
53183
  case "add":
@@ -53182,82 +53201,82 @@ class Board {
53182
53201
  applyAddItems(op) {
53183
53202
  if (Array.isArray(op.item)) {
53184
53203
  const data = op.data;
53185
- const items = op.item.map((item3) => {
53186
- const created = this.createItem(item3, data[item3]);
53204
+ const items = op.item.map((item2) => {
53205
+ const created = this.createItem(item2, data[item2]);
53187
53206
  this.index.insert(created);
53188
53207
  return created;
53189
53208
  });
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);
53209
+ items.forEach((item2) => {
53210
+ if (item2 instanceof Connector2 && data[item2.getId()]) {
53211
+ const connectorData = data[item2.getId()];
53212
+ item2.applyStartPoint(connectorData.startPoint);
53213
+ item2.applyEndPoint(connectorData.endPoint);
53195
53214
  }
53196
53215
  });
53197
53216
  return;
53198
53217
  }
53199
- const item2 = this.createItem(op.item, op.data);
53200
- return this.index.insert(item2);
53218
+ const item = this.createItem(op.item, op.data);
53219
+ return this.index.insert(item);
53201
53220
  }
53202
53221
  applyAddLockedGroupOperation(op) {
53203
- const item2 = this.createItem(op.item, op.data);
53204
- const groupChildrenIds = item2.getChildrenIds();
53205
- this.index.insert(item2);
53222
+ const item = this.createItem(op.item, op.data);
53223
+ const groupChildrenIds = item.getChildrenIds();
53224
+ this.index.insert(item);
53206
53225
  const lastChildrenId = this.index.getById(groupChildrenIds[groupChildrenIds.length - 1]);
53207
53226
  if (lastChildrenId) {
53208
53227
  const zIndex = this.index.getZIndex(lastChildrenId) + 1;
53209
- this.index.moveToZIndex(item2, zIndex);
53228
+ this.index.moveToZIndex(item, zIndex);
53210
53229
  }
53211
- item2.getChildren().forEach((item3) => {
53212
- item3.transformation.isLocked = true;
53230
+ item.getChildren().forEach((item2) => {
53231
+ item2.transformation.isLocked = true;
53213
53232
  });
53214
- item2.transformation.isLocked = true;
53233
+ item.transformation.isLocked = true;
53215
53234
  }
53216
53235
  applyRemoveOperation(op) {
53217
53236
  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();
53237
+ this.findItemAndApply(op.item, (item) => {
53238
+ this.index.remove(item);
53239
+ this.selection.remove(item);
53240
+ if (item instanceof Connector2) {
53241
+ item.clearObservedItems();
53223
53242
  }
53224
- removedItems.push(item2);
53243
+ removedItems.push(item);
53225
53244
  });
53226
53245
  }
53227
53246
  applyRemoveLockedGroupOperation(op) {
53228
- const item2 = this.index.getById(op.item[0]);
53229
- if (!item2 || !(item2 instanceof Group)) {
53247
+ const item = this.index.getById(op.item[0]);
53248
+ if (!item || !(item instanceof Group)) {
53230
53249
  return;
53231
53250
  }
53232
- item2.getChildren().forEach((item3) => {
53233
- item3.transformation.isLocked = false;
53234
- item3.parent = "Board";
53251
+ item.getChildren().forEach((item2) => {
53252
+ item2.transformation.isLocked = false;
53253
+ item2.parent = "Board";
53235
53254
  });
53236
- item2.transformation.isLocked = false;
53255
+ item.transformation.isLocked = false;
53237
53256
  const removedItems = [];
53238
- this.findItemAndApply(op.item, (item3) => {
53239
- this.index.remove(item3);
53240
- this.selection.remove(item3);
53241
- removedItems.push(item3);
53257
+ this.findItemAndApply(op.item, (item2) => {
53258
+ this.index.remove(item2);
53259
+ this.selection.remove(item2);
53260
+ removedItems.push(item2);
53242
53261
  });
53243
53262
  }
53244
53263
  applyItemOperation(op) {
53245
53264
  if ("item" in op) {
53246
- this.findItemAndApply(op.item, (item2) => {
53247
- item2.apply(op);
53265
+ this.findItemAndApply(op.item, (item) => {
53266
+ item.apply(op);
53248
53267
  });
53249
53268
  }
53250
53269
  }
53251
- findItemAndApply(item2, apply) {
53252
- if (Array.isArray(item2)) {
53253
- for (const itemId of item2) {
53270
+ findItemAndApply(item, apply) {
53271
+ if (Array.isArray(item)) {
53272
+ for (const itemId of item) {
53254
53273
  const found = this.items.findById(itemId);
53255
53274
  if (found) {
53256
53275
  apply(found);
53257
53276
  }
53258
53277
  }
53259
53278
  } else {
53260
- const found = this.items.findById(item2);
53279
+ const found = this.items.findById(item);
53261
53280
  if (found) {
53262
53281
  apply(found);
53263
53282
  }
@@ -53266,9 +53285,9 @@ class Board {
53266
53285
  handleNesting(items) {
53267
53286
  const arrayed = Array.isArray(items) ? items : [items];
53268
53287
  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) => {
53288
+ arrayed.forEach((item) => {
53289
+ const itemCenter = item.getMbr().getCenter();
53290
+ const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item)).reduce((acc, groupItem2) => {
53272
53291
  if (!acc || groupItem2.getDistanceToPoint(itemCenter) > acc.getDistanceToPoint(itemCenter)) {
53273
53292
  acc = groupItem2;
53274
53293
  }
@@ -53278,7 +53297,7 @@ class Board {
53278
53297
  if (!groupsMap.has(groupItem)) {
53279
53298
  groupsMap.set(groupItem, []);
53280
53299
  }
53281
- groupsMap.get(groupItem)?.push(item2);
53300
+ groupsMap.get(groupItem)?.push(item);
53282
53301
  }
53283
53302
  });
53284
53303
  groupsMap.forEach((items2, group) => {
@@ -53299,13 +53318,13 @@ class Board {
53299
53318
  }
53300
53319
  return parser(el);
53301
53320
  }
53302
- add(item2, timeStamp) {
53321
+ add(item, timeStamp) {
53303
53322
  const id = this.getNewItemId();
53304
53323
  this.emit({
53305
53324
  class: "Board",
53306
53325
  method: "add",
53307
53326
  item: id,
53308
- data: item2.serialize(),
53327
+ data: item.serialize(),
53309
53328
  timeStamp
53310
53329
  });
53311
53330
  const newItem = this.items.getById(id);
@@ -53315,13 +53334,13 @@ class Board {
53315
53334
  this.handleNesting(newItem);
53316
53335
  return newItem;
53317
53336
  }
53318
- addLockedGroup(item2) {
53337
+ addLockedGroup(item) {
53319
53338
  const id = this.getNewItemId();
53320
53339
  this.emit({
53321
53340
  class: "Board",
53322
53341
  method: "addLockedGroup",
53323
53342
  item: id,
53324
- data: item2.serialize()
53343
+ data: item.serialize()
53325
53344
  });
53326
53345
  const newItem = this.items.getById(id);
53327
53346
  if (!newItem) {
@@ -53330,32 +53349,32 @@ class Board {
53330
53349
  this.handleNesting(newItem);
53331
53350
  return newItem;
53332
53351
  }
53333
- remove(item2, withConnectors = true) {
53352
+ remove(item, withConnectors = true) {
53334
53353
  let connectors = [];
53335
53354
  if (withConnectors) {
53336
- connectors = this.items.getLinkedConnectorsById(item2.getId()).map((connector) => connector.getId());
53355
+ connectors = this.items.getLinkedConnectorsById(item.getId()).map((connector) => connector.getId());
53337
53356
  }
53338
- if ("onRemove" in item2) {
53339
- item2.onRemove();
53357
+ if ("onRemove" in item) {
53358
+ item.onRemove();
53340
53359
  }
53341
53360
  this.emit({
53342
53361
  class: "Board",
53343
53362
  method: "remove",
53344
- item: [item2.getId(), ...connectors]
53363
+ item: [item.getId(), ...connectors]
53345
53364
  });
53346
53365
  }
53347
- removeLockedGroup(item2) {
53366
+ removeLockedGroup(item) {
53348
53367
  this.emit({
53349
53368
  class: "Board",
53350
53369
  method: "removeLockedGroup",
53351
- item: [item2.getId()]
53370
+ item: [item.getId()]
53352
53371
  });
53353
53372
  }
53354
53373
  getByZIndex(index2) {
53355
53374
  return this.index.getByZIndex(index2);
53356
53375
  }
53357
- getZIndex(item2) {
53358
- return this.index.getZIndex(item2);
53376
+ getZIndex(item) {
53377
+ return this.index.getZIndex(item);
53359
53378
  }
53360
53379
  getLastZIndex() {
53361
53380
  return this.index.getLastZIndex();
@@ -53367,11 +53386,11 @@ class Board {
53367
53386
  item: items
53368
53387
  });
53369
53388
  }
53370
- moveToZIndex(item2, zIndex) {
53389
+ moveToZIndex(item, zIndex) {
53371
53390
  this.emit({
53372
53391
  class: "Board",
53373
53392
  method: "moveToZIndex",
53374
- item: item2.getId(),
53393
+ item: item.getId(),
53375
53394
  zIndex
53376
53395
  });
53377
53396
  }
@@ -53399,8 +53418,8 @@ class Board {
53399
53418
  this.emit({
53400
53419
  class: "Board",
53401
53420
  method: "bringToFront",
53402
- item: items.map((item2) => item2.getId()),
53403
- prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
53421
+ item: items.map((item) => item.getId()),
53422
+ prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
53404
53423
  });
53405
53424
  }
53406
53425
  sendToBack(items) {
@@ -53411,8 +53430,8 @@ class Board {
53411
53430
  this.emit({
53412
53431
  class: "Board",
53413
53432
  method: "sendToBack",
53414
- item: items.map((item2) => item2.getId()),
53415
- prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
53433
+ item: items.map((item) => item.getId()),
53434
+ prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
53416
53435
  });
53417
53436
  }
53418
53437
  copy() {
@@ -53489,7 +53508,7 @@ class Board {
53489
53508
  return added;
53490
53509
  });
53491
53510
  addedFrame.addChildItems(addedChildren);
53492
- parsedData.data.children = addedChildren.map((item2) => item2.getId());
53511
+ parsedData.data.children = addedChildren.map((item) => item.getId());
53493
53512
  idsMap[parsedData.data.id] = addedFrame.getId();
53494
53513
  } else {
53495
53514
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
@@ -53530,15 +53549,15 @@ class Board {
53530
53549
  const createdConnectors = {};
53531
53550
  const createdFrames = {};
53532
53551
  const addItem = (itemData) => {
53533
- const item2 = this.createItem(itemData.id, itemData);
53534
- if (item2 instanceof Connector2) {
53535
- createdConnectors[itemData.id] = { item: item2, itemData };
53552
+ const item = this.createItem(itemData.id, itemData);
53553
+ if (item instanceof Connector2) {
53554
+ createdConnectors[itemData.id] = { item, itemData };
53536
53555
  }
53537
- if (item2 instanceof Frame2) {
53538
- createdFrames[item2.getId()] = { item: item2, itemData };
53556
+ if (item instanceof Frame2) {
53557
+ createdFrames[item.getId()] = { item, itemData };
53539
53558
  }
53540
- this.index.insert(item2);
53541
- return item2;
53559
+ this.index.insert(item);
53560
+ return item;
53542
53561
  };
53543
53562
  for (const itemData of items) {
53544
53563
  if ("childrenMap" in itemData) {
@@ -53549,13 +53568,13 @@ class Board {
53549
53568
  }
53550
53569
  }
53551
53570
  for (const key in createdConnectors) {
53552
- const { item: item2, itemData } = createdConnectors[key];
53553
- item2.applyStartPoint(itemData.startPoint);
53554
- item2.applyEndPoint(itemData.endPoint);
53571
+ const { item, itemData } = createdConnectors[key];
53572
+ item.applyStartPoint(itemData.startPoint);
53573
+ item.applyEndPoint(itemData.endPoint);
53555
53574
  }
53556
53575
  for (const key in createdFrames) {
53557
- const { item: item2, itemData } = createdFrames[key];
53558
- item2.applyAddChildren(itemData.children);
53576
+ const { item, itemData } = createdFrames[key];
53577
+ item.applyAddChildren(itemData.children);
53559
53578
  }
53560
53579
  }
53561
53580
  deserialize(snapshot) {
@@ -53565,33 +53584,33 @@ class Board {
53565
53584
  const createdFrames = {};
53566
53585
  if (Array.isArray(items)) {
53567
53586
  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 };
53587
+ const item = this.createItem(itemData.id, itemData);
53588
+ if (item instanceof Connector2) {
53589
+ createdConnectors[itemData.id] = { item, itemData };
53571
53590
  }
53572
- if (item2 instanceof Frame2) {
53573
- createdFrames[item2.getId()] = { item: item2, itemData };
53591
+ if (item instanceof Frame2) {
53592
+ createdFrames[item.getId()] = { item, itemData };
53574
53593
  }
53575
- this.index.insert(item2);
53594
+ this.index.insert(item);
53576
53595
  }
53577
53596
  } else {
53578
53597
  for (const key in items) {
53579
53598
  const itemData = items[key];
53580
- const item2 = this.createItem(key, itemData);
53581
- if (item2 instanceof Connector2) {
53582
- createdConnectors[key] = { item: item2, itemData };
53599
+ const item = this.createItem(key, itemData);
53600
+ if (item instanceof Connector2) {
53601
+ createdConnectors[key] = { item, itemData };
53583
53602
  }
53584
- this.index.insert(item2);
53603
+ this.index.insert(item);
53585
53604
  }
53586
53605
  }
53587
53606
  for (const key in createdConnectors) {
53588
- const { item: item2, itemData } = createdConnectors[key];
53589
- item2.applyStartPoint(itemData.startPoint);
53590
- item2.applyEndPoint(itemData.endPoint);
53607
+ const { item, itemData } = createdConnectors[key];
53608
+ item.applyStartPoint(itemData.startPoint);
53609
+ item.applyEndPoint(itemData.endPoint);
53591
53610
  }
53592
53611
  for (const key in createdFrames) {
53593
- const { item: item2, itemData } = createdFrames[key];
53594
- item2.applyAddChildren(itemData.children);
53612
+ const { item, itemData } = createdFrames[key];
53613
+ item.applyAddChildren(itemData.children);
53595
53614
  }
53596
53615
  this.events?.log.deserialize(events);
53597
53616
  }
@@ -53829,7 +53848,7 @@ class Board {
53829
53848
  itemsMap: newMap,
53830
53849
  select: select2
53831
53850
  });
53832
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
53851
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
53833
53852
  this.handleNesting(items);
53834
53853
  this.selection.removeAll();
53835
53854
  this.selection.add(items);
@@ -53837,8 +53856,8 @@ class Board {
53837
53856
  return;
53838
53857
  }
53839
53858
  removeVoidComments() {
53840
- const voidComments = this.items.listAll().filter((item2) => {
53841
- return item2 instanceof Comment && !item2.getThread().length;
53859
+ const voidComments = this.items.listAll().filter((item) => {
53860
+ return item instanceof Comment && !item.getThread().length;
53842
53861
  });
53843
53862
  if (voidComments) {
53844
53863
  for (const comment2 of voidComments) {
@@ -53912,7 +53931,7 @@ class Board {
53912
53931
  }
53913
53932
  const mbr = this.selection.getMbr();
53914
53933
  const selectedItems = this.selection.items.list();
53915
- const isSelectedItemsMinWidth = selectedItems.some((item2) => item2.getMbr().getWidth() === 0);
53934
+ const isSelectedItemsMinWidth = selectedItems.some((item) => item.getMbr().getWidth() === 0);
53916
53935
  const right = mbr ? mbr.right : 0;
53917
53936
  const top = mbr ? mbr.top : 0;
53918
53937
  const width2 = mbr ? mbr.getWidth() / 10 : 10;
@@ -53954,7 +53973,7 @@ class Board {
53954
53973
  method: "duplicate",
53955
53974
  itemsMap: newMap
53956
53975
  });
53957
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
53976
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
53958
53977
  this.handleNesting(items);
53959
53978
  this.selection.removeAll();
53960
53979
  this.selection.add(items);
@@ -53975,9 +53994,9 @@ class Board {
53975
53994
  if (data.itemType === "Frame") {
53976
53995
  data.text.placeholderText = `Frame ${this.getMaxFrameSerial() + 1}`;
53977
53996
  }
53978
- const item2 = this.createItem(itemId, data);
53979
- this.index.insert(item2);
53980
- items.push(item2);
53997
+ const item = this.createItem(itemId, data);
53998
+ this.index.insert(item);
53999
+ items.push(item);
53981
54000
  };
53982
54001
  sortedItemsMap.map(([id, data]) => {
53983
54002
  if (data.itemType === "Connector") {
@@ -53992,8 +54011,8 @@ class Board {
53992
54011
  return;
53993
54012
  });
53994
54013
  }
53995
- isOnBoard(item2) {
53996
- return this.items.findById(item2.getId()) !== undefined;
54014
+ isOnBoard(item) {
54015
+ return this.items.findById(item.getId()) !== undefined;
53997
54016
  }
53998
54017
  getMaxFrameSerial() {
53999
54018
  const existingNames = this.items.listGroupItems().map((frame) => frame.getRichText()?.getTextString().length === 0 ? frame.getRichText()?.placeholderText || "" : frame.getRichText()?.getTextString() || "");
@@ -54039,7 +54058,7 @@ function areItemsTheSame(opA, opB) {
54039
54058
  const itemsB = Object.keys(opB.items);
54040
54059
  const setA = new Set(itemsA);
54041
54060
  const setB = new Set(itemsB);
54042
- const areArraysEqual = setA.size === setB.size && [...setA].every((item2) => setB.has(item2));
54061
+ const areArraysEqual = setA.size === setB.size && [...setA].every((item) => setB.has(item));
54043
54062
  return areArraysEqual;
54044
54063
  }
54045
54064
  if (!(Array.isArray(opA.item) && Array.isArray(opB.item))) {
@@ -55698,9 +55717,9 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
55698
55717
  list6.applyUnconfirmed(filter);
55699
55718
  const hasAnyOverlap = (arr1, arr2) => {
55700
55719
  const lookup9 = new Set(arr1);
55701
- return arr2.some((item2) => lookup9.has(item2));
55720
+ return arr2.some((item) => lookup9.has(item));
55702
55721
  };
55703
- const currSelection = board.selection.list().map((item2) => item2.getId());
55722
+ const currSelection = board.selection.list().map((item) => item.getId());
55704
55723
  if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
55705
55724
  board.selection.applyMemoizedCaretOrRange();
55706
55725
  }
@@ -56022,27 +56041,27 @@ function handleAiChatMassage(message, board) {
56022
56041
  }
56023
56042
  }
56024
56043
  function handleChatChunk(chunk, board) {
56025
- const item2 = board.items.getById(chunk.itemId);
56044
+ const item = board.items.getById(chunk.itemId);
56026
56045
  switch (chunk.type) {
56027
56046
  case "chunk":
56028
- if (!item2 || item2.itemType !== "AINode") {
56047
+ if (!item || item.itemType !== "AINode") {
56029
56048
  return;
56030
56049
  }
56031
- item2.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
56050
+ item.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
56032
56051
  break;
56033
56052
  case "done":
56034
- if (!item2 || item2.itemType !== "AINode") {
56053
+ if (!item || item.itemType !== "AINode") {
56035
56054
  board.aiGeneratingOnItem = undefined;
56036
56055
  return;
56037
56056
  }
56038
- item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56057
+ item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56039
56058
  break;
56040
56059
  case "end":
56041
- if (!item2 || item2.itemType !== "AINode") {
56060
+ if (!item || item.itemType !== "AINode") {
56042
56061
  board.aiGeneratingOnItem = undefined;
56043
56062
  return;
56044
56063
  }
56045
- item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56064
+ item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56046
56065
  break;
56047
56066
  case "error":
56048
56067
  default:
@@ -56059,7 +56078,7 @@ function handleChatChunk(chunk, board) {
56059
56078
  if (board.aiGeneratingOnItem && generatingItem) {
56060
56079
  board.selection.removeAll();
56061
56080
  board.selection.add(generatingItem);
56062
- const rt = item2?.getRichText();
56081
+ const rt = item?.getRichText();
56063
56082
  if (generatingItem.itemType === "AINode" && rt) {
56064
56083
  const editor = rt.editor;
56065
56084
  editor.markdownProcessor.setStopProcessingMarkDownCb(null);
@@ -56192,14 +56211,14 @@ function handleImageGenerate(response, board) {
56192
56211
  console.error("Image generation error:", response.message);
56193
56212
  if (response.isExternalApiError) {
56194
56213
  if (board.aiGeneratingOnItem) {
56195
- const item2 = board.items.getById(board.aiGeneratingOnItem);
56196
- if (item2) {
56214
+ const item = board.items.getById(board.aiGeneratingOnItem);
56215
+ if (item) {
56197
56216
  board.selection.removeAll();
56198
- board.selection.add(item2);
56199
- const editor = item2.getRichText()?.editor;
56217
+ board.selection.add(item);
56218
+ const editor = item.getRichText()?.editor;
56200
56219
  editor?.clearText();
56201
56220
  editor?.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
56202
- board.camera.zoomToFit(item2.getMbr(), 20);
56221
+ board.camera.zoomToFit(item.getMbr(), 20);
56203
56222
  }
56204
56223
  }
56205
56224
  } else {