microboard-temp 0.4.59 → 0.4.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -635,8 +635,8 @@ class BoardCommand {
635
635
  switch (operation.method) {
636
636
  case "bringToFront": {
637
637
  for (const id in operation.prevZIndex) {
638
- const item2 = this.board.items.getById(id);
639
- if (!item2) {
638
+ const item = this.board.items.getById(id);
639
+ if (!item) {
640
640
  delete operation.prevZIndex.id;
641
641
  }
642
642
  }
@@ -648,8 +648,8 @@ class BoardCommand {
648
648
  }
649
649
  case "sendToBack": {
650
650
  for (const id in operation.prevZIndex) {
651
- const item2 = this.board.items.getById(id);
652
- if (!item2) {
651
+ const item = this.board.items.getById(id);
652
+ if (!item) {
653
653
  delete operation.prevZIndex.id;
654
654
  }
655
655
  }
@@ -663,11 +663,11 @@ class BoardCommand {
663
663
  case "moveSecondBeforeFirst":
664
664
  case "moveToZIndex": {
665
665
  const items = this.board.items;
666
- const item2 = items.getById(operation.item);
667
- if (!item2) {
666
+ const item = items.getById(operation.item);
667
+ if (!item) {
668
668
  throw new Error("Get reverse board operation. Item not found");
669
669
  }
670
- const zIndex = this.board.getZIndex(item2);
670
+ const zIndex = this.board.getZIndex(item);
671
671
  return {
672
672
  class: "Board",
673
673
  method: "moveToZIndex",
@@ -677,8 +677,8 @@ class BoardCommand {
677
677
  }
678
678
  case "moveManyToZIndex": {
679
679
  for (const id in operation.item) {
680
- const item2 = this.board.items.getById(id);
681
- if (!item2) {
680
+ const item = this.board.items.getById(id);
681
+ if (!item) {
682
682
  delete operation.item.id;
683
683
  }
684
684
  }
@@ -695,15 +695,15 @@ class BoardCommand {
695
695
  const items = this.board.items;
696
696
  const reverse = [];
697
697
  for (const itemId of operation.item) {
698
- const item2 = items.getById(itemId);
699
- if (!item2) {
698
+ const item = items.getById(itemId);
699
+ if (!item) {
700
700
  throw new Error("Get reverse board operation. Item not found");
701
701
  }
702
702
  reverse.push({
703
703
  class: "Board",
704
704
  method: "add",
705
705
  item: itemId,
706
- data: item2.serialize()
706
+ data: item.serialize()
707
707
  });
708
708
  }
709
709
  return reverse;
@@ -726,32 +726,32 @@ class BoardCommand {
726
726
  const items = this.board.items;
727
727
  const reverse = [];
728
728
  for (const itemId of operation.item) {
729
- const item2 = items.getById(itemId);
730
- if (!item2 || item2.itemType !== "Group") {
729
+ const item = items.getById(itemId);
730
+ if (!item || item.itemType !== "Group") {
731
731
  throw new Error("Get reverse board operation. Item not found");
732
732
  }
733
733
  reverse.push({
734
734
  class: "Board",
735
735
  method: "addLockedGroup",
736
736
  item: itemId,
737
- data: item2.serialize()
737
+ data: item.serialize()
738
738
  });
739
739
  }
740
740
  return reverse;
741
741
  }
742
742
  case "duplicate":
743
743
  case "paste": {
744
- const item2 = [];
744
+ const item = [];
745
745
  const map = operation.itemsMap;
746
746
  for (const key in map) {
747
747
  if (map.hasOwnProperty(key)) {
748
- item2.push(key);
748
+ item.push(key);
749
749
  }
750
750
  }
751
751
  return {
752
752
  class: "Board",
753
753
  method: "remove",
754
- item: item2
754
+ item
755
755
  };
756
756
  }
757
757
  }
@@ -7069,11 +7069,11 @@ class SubjectOperation {
7069
7069
  }
7070
7070
 
7071
7071
  // src/Items/ItemsCommandUtils.ts
7072
- function mapItemsByOperation(item2, getCallback) {
7073
- const items = Array.isArray(item2) ? item2 : [item2];
7074
- return items.map((item3) => {
7075
- const operation = getCallback(item3);
7076
- return { item: item3, operation };
7072
+ function mapItemsByOperation(item, getCallback) {
7073
+ const items = Array.isArray(item) ? item : [item];
7074
+ return items.map((item2) => {
7075
+ const operation = getCallback(item2);
7076
+ return { item: item2, operation };
7077
7077
  });
7078
7078
  }
7079
7079
 
@@ -7098,8 +7098,8 @@ class TransformationCommand {
7098
7098
  }
7099
7099
  }
7100
7100
  revert() {
7101
- this.reverse.forEach(({ item: item2, operation }) => {
7102
- item2.apply(operation);
7101
+ this.reverse.forEach(({ item, operation }) => {
7102
+ item.apply(operation);
7103
7103
  });
7104
7104
  }
7105
7105
  getReverse() {
@@ -7841,8 +7841,8 @@ class Path {
7841
7841
  }
7842
7842
  getIntersectionPoints(segment) {
7843
7843
  let intersections = [];
7844
- for (const item2 of this.segments) {
7845
- intersections = intersections.concat(item2.getIntersectionPoints(segment));
7844
+ for (const item of this.segments) {
7845
+ intersections = intersections.concat(item.getIntersectionPoints(segment));
7846
7846
  }
7847
7847
  return intersections;
7848
7848
  }
@@ -7907,8 +7907,8 @@ class Path {
7907
7907
  }
7908
7908
  isOpenEnclosedOrCrossedBy(rectangle) {
7909
7909
  let is = false;
7910
- for (const item2 of this.segments) {
7911
- is = is || item2.isEnclosedOrCrossedBy(rectangle);
7910
+ for (const item of this.segments) {
7911
+ is = is || item.isEnclosedOrCrossedBy(rectangle);
7912
7912
  }
7913
7913
  return is;
7914
7914
  }
@@ -8321,8 +8321,8 @@ class ConnectorCommand {
8321
8321
  }
8322
8322
  }
8323
8323
  revert() {
8324
- for (const { item: item2, operation } of this.reverse) {
8325
- item2.apply(operation);
8324
+ for (const { item, operation } of this.reverse) {
8325
+ item.apply(operation);
8326
8326
  }
8327
8327
  }
8328
8328
  getReverse() {
@@ -8479,11 +8479,11 @@ class SessionStorage {
8479
8479
  }
8480
8480
  get(key) {
8481
8481
  const boardId = this.getBoardId() || "";
8482
- const item2 = _sessionStorage.getItem(boardId + "_" + key);
8483
- if (!item2) {
8482
+ const item = _sessionStorage.getItem(boardId + "_" + key);
8483
+ if (!item) {
8484
8484
  return;
8485
8485
  }
8486
- return JSON.parse(item2);
8486
+ return JSON.parse(item);
8487
8487
  }
8488
8488
  remove(key) {
8489
8489
  const boardId = this.getBoardId() || "";
@@ -9268,8 +9268,8 @@ class LinkToCommand {
9268
9268
  }
9269
9269
  }
9270
9270
  revert() {
9271
- this.reverse.forEach(({ item: item2, operation }) => {
9272
- item2.apply(operation);
9271
+ this.reverse.forEach(({ item, operation }) => {
9272
+ item.apply(operation);
9273
9273
  });
9274
9274
  }
9275
9275
  getReverse() {
@@ -10570,9 +10570,9 @@ function handleSplitListItem(editor) {
10570
10570
  Transforms3.insertNodes(editor, {
10571
10571
  type: listType,
10572
10572
  listLevel: listNode.listLevel || 0,
10573
- children: itemsAfter.map((item2) => ({
10573
+ children: itemsAfter.map((item) => ({
10574
10574
  type: "list_item",
10575
- children: item2.children
10575
+ children: item.children
10576
10576
  }))
10577
10577
  }, { at: newListPath });
10578
10578
  }
@@ -12549,10 +12549,10 @@ function initializeDocument(effects) {
12549
12549
  return start;
12550
12550
  function start(code) {
12551
12551
  if (continued < stack.length) {
12552
- const item2 = stack[continued];
12553
- self2.containerState = item2[1];
12554
- ok(item2[0].continuation, "expected `continuation` to be defined on container construct");
12555
- return effects.attempt(item2[0].continuation, documentContinue, checkNewContainers)(code);
12552
+ const item = stack[continued];
12553
+ self2.containerState = item[1];
12554
+ ok(item[0].continuation, "expected `continuation` to be defined on container construct");
12555
+ return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code);
12556
12556
  }
12557
12557
  return checkNewContainers(code);
12558
12558
  }
@@ -13528,17 +13528,17 @@ class SpliceBuffer {
13528
13528
  this.setCursor(Number.POSITIVE_INFINITY);
13529
13529
  return this.left.pop();
13530
13530
  }
13531
- push(item2) {
13531
+ push(item) {
13532
13532
  this.setCursor(Number.POSITIVE_INFINITY);
13533
- this.left.push(item2);
13533
+ this.left.push(item);
13534
13534
  }
13535
13535
  pushMany(items) {
13536
13536
  this.setCursor(Number.POSITIVE_INFINITY);
13537
13537
  chunkedPush(this.left, items);
13538
13538
  }
13539
- unshift(item2) {
13539
+ unshift(item) {
13540
13540
  this.setCursor(0);
13541
- this.right.push(item2);
13541
+ this.right.push(item);
13542
13542
  }
13543
13543
  unshiftMany(items) {
13544
13544
  this.setCursor(0);
@@ -15569,8 +15569,8 @@ function initializeFactory(field) {
15569
15569
  if (list2) {
15570
15570
  ok(Array.isArray(list2), "expected `disable.null` to be populated");
15571
15571
  while (++index2 < list2.length) {
15572
- const item2 = list2[index2];
15573
- if (!item2.previous || item2.previous.call(self2, self2.previous)) {
15572
+ const item = list2[index2];
15573
+ if (!item.previous || item.previous.call(self2, self2.previous)) {
15574
15574
  return true;
15575
15575
  }
15576
15576
  }
@@ -16401,14 +16401,14 @@ function compiler(options) {
16401
16401
  length++;
16402
16402
  }
16403
16403
  if (event[1].type === types.listItemPrefix) {
16404
- const item2 = {
16404
+ const item = {
16405
16405
  type: "listItem",
16406
16406
  _spread: false,
16407
16407
  start: Object.assign({}, event[1].start),
16408
16408
  end: undefined
16409
16409
  };
16410
- listItem2 = item2;
16411
- events.splice(index2, 0, ["enter", item2, event[2]]);
16410
+ listItem2 = item;
16411
+ events.splice(index2, 0, ["enter", item, event[2]]);
16412
16412
  index2++;
16413
16413
  length++;
16414
16414
  firstBlankLineIndex = undefined;
@@ -17206,14 +17206,14 @@ class MarkdownProcessor {
17206
17206
  if (err || !file) {
17207
17207
  throw err;
17208
17208
  }
17209
- const nodes = file.result.map((item2) => {
17209
+ const nodes = file.result.map((item) => {
17210
17210
  setNodeStyles({
17211
- node: item2,
17211
+ node: item,
17212
17212
  editor: this.editor,
17213
17213
  horisontalAlignment: "left",
17214
- isPaddingTopNeeded: item2.type !== "code_block"
17214
+ isPaddingTopNeeded: item.type !== "code_block"
17215
17215
  });
17216
- return item2;
17216
+ return item;
17217
17217
  });
17218
17218
  if (isNewParagraphNeeded) {
17219
17219
  nodes.push(createParagraphNode("", this.editor));
@@ -18191,8 +18191,8 @@ class ShapeCommand {
18191
18191
  }
18192
18192
  }
18193
18193
  revert() {
18194
- for (const { item: item2, operation } of this.reverse) {
18195
- item2.apply(operation);
18194
+ for (const { item, operation } of this.reverse) {
18195
+ item.apply(operation);
18196
18196
  }
18197
18197
  }
18198
18198
  getReverse() {
@@ -18274,8 +18274,8 @@ class RichTextCommand {
18274
18274
  }
18275
18275
  }
18276
18276
  revert() {
18277
- for (const { item: item2, operation } of this.reverse) {
18278
- const richText = this.board.items.getById(item2);
18277
+ for (const { item, operation } of this.reverse) {
18278
+ const richText = this.board.items.getById(item);
18279
18279
  if (!richText) {
18280
18280
  continue;
18281
18281
  }
@@ -18294,12 +18294,12 @@ class RichTextCommand {
18294
18294
  case "setSelectionFontColor":
18295
18295
  case "setSelectionBlockType":
18296
18296
  const inverseOps = this.operation.ops.map((op) => Operation3.inverse(op)).reverse();
18297
- return items.map((item2) => {
18297
+ return items.map((item) => {
18298
18298
  const operation = {
18299
18299
  ...this.operation,
18300
18300
  ops: inverseOps
18301
18301
  };
18302
- return { item: item2, operation };
18302
+ return { item, operation };
18303
18303
  });
18304
18304
  case "setFontColor":
18305
18305
  return items.map((id) => ({
@@ -18391,13 +18391,13 @@ class RichTextGroupCommand {
18391
18391
  this.reverseOps = this.getReverse();
18392
18392
  }
18393
18393
  apply() {
18394
- for (const { item: item2, operation } of this.forwardOps) {
18395
- item2.applyCommand(operation);
18394
+ for (const { item, operation } of this.forwardOps) {
18395
+ item.applyCommand(operation);
18396
18396
  }
18397
18397
  }
18398
18398
  revert() {
18399
- for (const { item: item2, operation } of this.reverseOps) {
18400
- item2.applyCommand(operation);
18399
+ for (const { item, operation } of this.reverseOps) {
18400
+ item.applyCommand(operation);
18401
18401
  }
18402
18402
  }
18403
18403
  getForward() {
@@ -18512,8 +18512,8 @@ class DrawingCommand {
18512
18512
  item;
18513
18513
  operation;
18514
18514
  reverse;
18515
- constructor(item2, operation) {
18516
- this.item = item2;
18515
+ constructor(item, operation) {
18516
+ this.item = item;
18517
18517
  this.operation = operation;
18518
18518
  this.reverse = this.getReverse();
18519
18519
  }
@@ -18522,52 +18522,52 @@ class DrawingCommand {
18522
18522
  return this;
18523
18523
  }
18524
18524
  apply() {
18525
- for (const item2 of this.item) {
18526
- item2.apply(this.operation);
18525
+ for (const item of this.item) {
18526
+ item.apply(this.operation);
18527
18527
  }
18528
18528
  }
18529
18529
  revert() {
18530
- for (const { item: item2, operation } of this.reverse) {
18531
- item2.apply(operation);
18530
+ for (const { item, operation } of this.reverse) {
18531
+ item.apply(operation);
18532
18532
  }
18533
18533
  }
18534
18534
  getReverse() {
18535
18535
  const reverse = [];
18536
- for (const item2 of this.item) {
18537
- reverse.push({ item: item2, operation: this.getReverseOperation(item2) });
18536
+ for (const item of this.item) {
18537
+ reverse.push({ item, operation: this.getReverseOperation(item) });
18538
18538
  }
18539
18539
  return reverse;
18540
18540
  }
18541
- getReverseOperation(item2) {
18541
+ getReverseOperation(item) {
18542
18542
  switch (this.operation.method) {
18543
18543
  case "setStrokeColor":
18544
18544
  return {
18545
18545
  class: "Drawing",
18546
18546
  method: "setStrokeColor",
18547
- item: [item2.getId()],
18548
- color: item2.getStrokeColor()
18547
+ item: [item.getId()],
18548
+ color: item.getStrokeColor()
18549
18549
  };
18550
18550
  case "setStrokeWidth":
18551
18551
  return {
18552
18552
  class: "Drawing",
18553
18553
  method: "setStrokeWidth",
18554
- item: [item2.getId()],
18554
+ item: [item.getId()],
18555
18555
  width: this.operation.prevWidth,
18556
- prevWidth: item2.getStrokeWidth()
18556
+ prevWidth: item.getStrokeWidth()
18557
18557
  };
18558
18558
  case "setStrokeOpacity":
18559
18559
  return {
18560
18560
  class: "Drawing",
18561
18561
  method: "setStrokeOpacity",
18562
- item: [item2.getId()],
18563
- opacity: item2.getStrokeOpacity()
18562
+ item: [item.getId()],
18563
+ opacity: item.getStrokeOpacity()
18564
18564
  };
18565
18565
  case "setStrokeStyle":
18566
18566
  return {
18567
18567
  class: "Drawing",
18568
18568
  method: "setStrokeStyle",
18569
- item: [item2.getId()],
18570
- style: item2.getBorderStyle()
18569
+ item: [item.getId()],
18570
+ style: item.getBorderStyle()
18571
18571
  };
18572
18572
  }
18573
18573
  }
@@ -18589,8 +18589,8 @@ class StickerCommand {
18589
18589
  }
18590
18590
  }
18591
18591
  revert() {
18592
- for (const { item: item2, operation } of this.reverse) {
18593
- item2.apply(operation);
18592
+ for (const { item, operation } of this.reverse) {
18593
+ item.apply(operation);
18594
18594
  }
18595
18595
  }
18596
18596
  getReverse() {
@@ -18622,8 +18622,8 @@ class FrameCommand {
18622
18622
  }
18623
18623
  }
18624
18624
  revert() {
18625
- for (const { item: item2, operation } of this.reverse) {
18626
- item2.apply(operation);
18625
+ for (const { item, operation } of this.reverse) {
18626
+ item.apply(operation);
18627
18627
  }
18628
18628
  }
18629
18629
  getReverse() {
@@ -18665,21 +18665,23 @@ class FrameCommand {
18665
18665
  };
18666
18666
  });
18667
18667
  default:
18668
- const op = this.operation;
18669
- let newData = {};
18670
- if (op.prevData) {
18671
- newData = { ...op.prevData };
18672
- } else {
18673
- Object.keys(op.newData).forEach((key) => {
18674
- if (item[key]) {
18675
- newData[key] = item[key];
18676
- }
18677
- });
18678
- }
18679
- return {
18680
- ...op,
18681
- newData
18682
- };
18668
+ return mapItemsByOperation(frame, (item) => {
18669
+ const op = this.operation;
18670
+ let newData = {};
18671
+ if (op.prevData) {
18672
+ newData = { ...op.prevData };
18673
+ } else {
18674
+ Object.keys(op.newData).forEach((key) => {
18675
+ if (item[key]) {
18676
+ newData[key] = item[key];
18677
+ }
18678
+ });
18679
+ }
18680
+ return {
18681
+ ...op,
18682
+ newData
18683
+ };
18684
+ });
18683
18685
  }
18684
18686
  }
18685
18687
  }
@@ -18700,8 +18702,8 @@ class CommentCommand {
18700
18702
  }
18701
18703
  }
18702
18704
  revert() {
18703
- this.reverse.forEach(({ item: item2, operation }) => {
18704
- item2.apply(operation);
18705
+ this.reverse.forEach(({ item, operation }) => {
18706
+ item.apply(operation);
18705
18707
  });
18706
18708
  }
18707
18709
  getReverse() {
@@ -19163,8 +19165,8 @@ class GroupCommand {
19163
19165
  }
19164
19166
  }
19165
19167
  revert() {
19166
- for (const { item: item2, operation } of this.reverse) {
19167
- item2.apply(operation);
19168
+ for (const { item, operation } of this.reverse) {
19169
+ item.apply(operation);
19168
19170
  }
19169
19171
  }
19170
19172
  getReverse() {
@@ -19217,8 +19219,8 @@ class PlaceholderCommand {
19217
19219
  }
19218
19220
  }
19219
19221
  revert() {
19220
- for (const { item: item2, operation } of this.reverse) {
19221
- item2.apply(operation);
19222
+ for (const { item, operation } of this.reverse) {
19223
+ item.apply(operation);
19222
19224
  }
19223
19225
  }
19224
19226
  getReverse() {
@@ -19312,26 +19314,26 @@ class BaseCommand {
19312
19314
  return this;
19313
19315
  }
19314
19316
  apply() {
19315
- for (const item2 of this.items) {
19316
- item2.apply(this.operation);
19317
+ for (const item of this.items) {
19318
+ item.apply(this.operation);
19317
19319
  }
19318
19320
  }
19319
19321
  revert() {
19320
- for (const { item: item2, operation } of this.reverse) {
19321
- item2.apply(operation);
19322
+ for (const { item, operation } of this.reverse) {
19323
+ item.apply(operation);
19322
19324
  }
19323
19325
  }
19324
19326
  getReverse() {
19325
19327
  const items = this.items;
19326
- return mapItemsByOperation(items, (item2) => {
19328
+ return mapItemsByOperation(items, (item) => {
19327
19329
  const op = this.operation;
19328
19330
  let newData = {};
19329
19331
  if (op.prevData) {
19330
19332
  newData = { ...op.prevData };
19331
19333
  } else {
19332
19334
  Object.keys(op.newData).forEach((key) => {
19333
- if (item2[key]) {
19334
- newData[key] = item2[key];
19335
+ if (item[key]) {
19336
+ newData[key] = item[key];
19335
19337
  }
19336
19338
  });
19337
19339
  }
@@ -19359,37 +19361,37 @@ var itemCommandFactories = {
19359
19361
  LinkTo: createLinkToCommand
19360
19362
  };
19361
19363
  function createConnectorCommand(items, operation) {
19362
- return new ConnectorCommand(items.filter((item2) => item2.itemType === "Connector"), operation);
19364
+ return new ConnectorCommand(items.filter((item) => item.itemType === "Connector"), operation);
19363
19365
  }
19364
19366
  function createShapeCommand(items, operation) {
19365
- return new ShapeCommand(items.filter((item2) => item2.itemType === "Shape"), operation);
19367
+ return new ShapeCommand(items.filter((item) => item.itemType === "Shape"), operation);
19366
19368
  }
19367
19369
  function createDrawingCommand(items, operation) {
19368
- return new DrawingCommand(items.filter((item2) => item2.itemType === "Drawing"), operation);
19370
+ return new DrawingCommand(items.filter((item) => item.itemType === "Drawing"), operation);
19369
19371
  }
19370
19372
  function createCommentCommand(items, operation) {
19371
- return new CommentCommand(items.filter((item2) => item2.itemType === "Comment"), operation);
19373
+ return new CommentCommand(items.filter((item) => item.itemType === "Comment"), operation);
19372
19374
  }
19373
19375
  function createStickerCommand(items, operation) {
19374
- return new StickerCommand(items.filter((item2) => item2.itemType === "Sticker"), operation);
19376
+ return new StickerCommand(items.filter((item) => item.itemType === "Sticker"), operation);
19375
19377
  }
19376
19378
  function createFrameCommand(items, operation) {
19377
- return new FrameCommand(items.filter((item2) => item2.itemType === "Frame"), operation);
19379
+ return new FrameCommand(items.filter((item) => item.itemType === "Frame"), operation);
19378
19380
  }
19379
19381
  function createPlaceholderCommand(items, operation) {
19380
- return new PlaceholderCommand(items.filter((item2) => item2.itemType === "Placeholder"), operation);
19382
+ return new PlaceholderCommand(items.filter((item) => item.itemType === "Placeholder"), operation);
19381
19383
  }
19382
19384
  function createGroupCommand(items, operation) {
19383
- return new GroupCommand(items.filter((item2) => item2.itemType === "Group"), operation);
19385
+ return new GroupCommand(items.filter((item) => item.itemType === "Group"), operation);
19384
19386
  }
19385
19387
  function createImageCommand(items, operation) {
19386
- return new ImageCommand(items.filter((item2) => item2.itemType === "Image"), operation);
19388
+ return new ImageCommand(items.filter((item) => item.itemType === "Image"), operation);
19387
19389
  }
19388
19390
  function createVideoCommand(items, operation) {
19389
- return new VideoCommand(items.filter((item2) => item2.itemType === "Video"), operation);
19391
+ return new VideoCommand(items.filter((item) => item.itemType === "Video"), operation);
19390
19392
  }
19391
19393
  function createAudioCommand(items, operation) {
19392
- return new AudioCommand(items.filter((item2) => item2.itemType === "Audio"), operation);
19394
+ return new AudioCommand(items.filter((item) => item.itemType === "Audio"), operation);
19393
19395
  }
19394
19396
  function createRichTextCommand(items, operation, board) {
19395
19397
  if (!board) {
@@ -19397,8 +19399,8 @@ function createRichTextCommand(items, operation, board) {
19397
19399
  }
19398
19400
  if (operation.method === "groupEdit") {
19399
19401
  const texts = [];
19400
- for (const { item: item2 } of operation.itemsOps) {
19401
- const found = board.items.findById(item2);
19402
+ for (const { item } of operation.itemsOps) {
19403
+ const found = board.items.findById(item);
19402
19404
  const text3 = found?.getRichText();
19403
19405
  if (text3) {
19404
19406
  texts.push(text3);
@@ -19406,14 +19408,14 @@ function createRichTextCommand(items, operation, board) {
19406
19408
  }
19407
19409
  return new RichTextGroupCommand(texts, operation);
19408
19410
  } else {
19409
- return new RichTextCommand(board, items.map((item2) => item2.getId()), operation);
19411
+ return new RichTextCommand(board, items.map((item) => item.getId()), operation);
19410
19412
  }
19411
19413
  }
19412
19414
  function createTransformationCommand(items, operation) {
19413
- return new TransformationCommand(items.map((item2) => item2.transformation), operation);
19415
+ return new TransformationCommand(items.map((item) => item.transformation), operation);
19414
19416
  }
19415
19417
  function createLinkToCommand(items, operation) {
19416
- return new LinkToCommand(items.map((item2) => item2.linkTo), operation);
19418
+ return new LinkToCommand(items.map((item) => item.linkTo), operation);
19417
19419
  }
19418
19420
  function createCommand(board, operation) {
19419
19421
  try {
@@ -19431,13 +19433,13 @@ function createCommand(board, operation) {
19431
19433
  default: {
19432
19434
  const itemType = operation.class;
19433
19435
  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);
19434
- const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item2) => {
19435
- if (typeof item2 === "string") {
19436
- console.warn(`Item with ID ${item2} not found for operation ${operation.class}.${operation.method}`);
19436
+ const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item) => {
19437
+ if (typeof item === "string") {
19438
+ console.warn(`Item with ID ${item} not found for operation ${operation.class}.${operation.method}`);
19437
19439
  return false;
19438
19440
  }
19439
- if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item2.itemType !== operation.class) {
19440
- console.warn(`Item with ID ${item2} is not of operation type: ${itemType}.`);
19441
+ if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item.itemType !== operation.class) {
19442
+ console.warn(`Item with ID ${item} is not of operation type: ${itemType}.`);
19441
19443
  return false;
19442
19444
  }
19443
19445
  return true;
@@ -19738,20 +19740,20 @@ class RBush {
19738
19740
  }
19739
19741
  return this;
19740
19742
  }
19741
- insert(item2) {
19742
- if (item2)
19743
- this._insert(item2, this.data.height - 1);
19743
+ insert(item) {
19744
+ if (item)
19745
+ this._insert(item, this.data.height - 1);
19744
19746
  return this;
19745
19747
  }
19746
19748
  clear() {
19747
19749
  this.data = createNode([]);
19748
19750
  return this;
19749
19751
  }
19750
- remove(item2, equalsFn) {
19751
- if (!item2)
19752
+ remove(item, equalsFn) {
19753
+ if (!item)
19752
19754
  return this;
19753
19755
  let node2 = this.data;
19754
- const bbox = this.toBBox(item2);
19756
+ const bbox = this.toBBox(item);
19755
19757
  const path2 = [];
19756
19758
  const indexes = [];
19757
19759
  let i, parent, goingUp;
@@ -19763,7 +19765,7 @@ class RBush {
19763
19765
  goingUp = true;
19764
19766
  }
19765
19767
  if (node2.leaf) {
19766
- const index2 = findItem(item2, node2.children, equalsFn);
19768
+ const index2 = findItem(item, node2.children, equalsFn);
19767
19769
  if (index2 !== -1) {
19768
19770
  node2.children.splice(index2, 1);
19769
19771
  path2.push(node2);
@@ -19786,8 +19788,8 @@ class RBush {
19786
19788
  }
19787
19789
  return this;
19788
19790
  }
19789
- toBBox(item2) {
19790
- return item2;
19791
+ toBBox(item) {
19792
+ return item;
19791
19793
  }
19792
19794
  compareMinX(a, b) {
19793
19795
  return a.minX - b.minX;
@@ -19870,11 +19872,11 @@ class RBush {
19870
19872
  }
19871
19873
  return node2;
19872
19874
  }
19873
- _insert(item2, level, isNode) {
19874
- const bbox = isNode ? item2 : this.toBBox(item2);
19875
+ _insert(item, level, isNode) {
19876
+ const bbox = isNode ? item : this.toBBox(item);
19875
19877
  const insertPath = [];
19876
19878
  const node2 = this._chooseSubtree(bbox, this.data, level, insertPath);
19877
- node2.children.push(item2);
19879
+ node2.children.push(item);
19878
19880
  extend2(node2, bbox);
19879
19881
  while (level >= 0) {
19880
19882
  if (insertPath[level].children.length > this._maxEntries) {
@@ -19973,11 +19975,11 @@ class RBush {
19973
19975
  }
19974
19976
  }
19975
19977
  }
19976
- function findItem(item2, items, equalsFn) {
19978
+ function findItem(item, items, equalsFn) {
19977
19979
  if (!equalsFn)
19978
- return items.indexOf(item2);
19980
+ return items.indexOf(item);
19979
19981
  for (let i = 0;i < items.length; i++) {
19980
- if (equalsFn(item2, items[i]))
19982
+ if (equalsFn(item, items[i]))
19981
19983
  return i;
19982
19984
  }
19983
19985
  return -1;
@@ -20068,8 +20070,8 @@ class TinyQueue {
20068
20070
  this._down(i);
20069
20071
  }
20070
20072
  }
20071
- push(item2) {
20072
- this.data.push(item2);
20073
+ push(item) {
20074
+ this.data.push(item);
20073
20075
  this.length++;
20074
20076
  this._up(this.length - 1);
20075
20077
  }
@@ -20090,21 +20092,21 @@ class TinyQueue {
20090
20092
  }
20091
20093
  _up(pos) {
20092
20094
  const { data, compare } = this;
20093
- const item2 = data[pos];
20095
+ const item = data[pos];
20094
20096
  while (pos > 0) {
20095
20097
  const parent = pos - 1 >> 1;
20096
20098
  const current = data[parent];
20097
- if (compare(item2, current) >= 0)
20099
+ if (compare(item, current) >= 0)
20098
20100
  break;
20099
20101
  data[pos] = current;
20100
20102
  pos = parent;
20101
20103
  }
20102
- data[pos] = item2;
20104
+ data[pos] = item;
20103
20105
  }
20104
20106
  _down(pos) {
20105
20107
  const { data, compare } = this;
20106
20108
  const halfLength = this.length >> 1;
20107
- const item2 = data[pos];
20109
+ const item = data[pos];
20108
20110
  while (pos < halfLength) {
20109
20111
  let left = (pos << 1) + 1;
20110
20112
  let best = data[left];
@@ -20113,12 +20115,12 @@ class TinyQueue {
20113
20115
  left = right;
20114
20116
  best = data[right];
20115
20117
  }
20116
- if (compare(best, item2) >= 0)
20118
+ if (compare(best, item) >= 0)
20117
20119
  break;
20118
20120
  data[pos] = best;
20119
20121
  pos = left;
20120
20122
  }
20121
- data[pos] = item2;
20123
+ data[pos] = item;
20122
20124
  }
20123
20125
  }
20124
20126
  function defaultCompare2(a, b) {
@@ -20206,10 +20208,10 @@ class RTreeIndex {
20206
20208
  return container ? container.item : undefined;
20207
20209
  }
20208
20210
  remove(id) {
20209
- const item2 = this.map.get(id);
20210
- if (item2) {
20211
+ const item = this.map.get(id);
20212
+ if (item) {
20211
20213
  this.map.delete(id);
20212
- this.tree.remove(item2);
20214
+ this.tree.remove(item);
20213
20215
  }
20214
20216
  }
20215
20217
  list() {
@@ -20281,11 +20283,11 @@ class Container extends Mbr {
20281
20283
  item;
20282
20284
  layer;
20283
20285
  zIndex;
20284
- constructor(id, item2, layer, zIndex) {
20285
- const rect = item2.getMbrWithChildren();
20286
+ constructor(id, item, layer, zIndex) {
20287
+ const rect = item.getMbrWithChildren();
20286
20288
  super(rect.left, rect.top, rect.right, rect.bottom);
20287
20289
  this.id = id;
20288
- this.item = item2;
20290
+ this.item = item;
20289
20291
  this.layer = layer;
20290
20292
  this.zIndex = zIndex;
20291
20293
  }
@@ -20302,7 +20304,7 @@ class LayeredIndex {
20302
20304
  this.getZIndex = this.getZIndex.bind(this);
20303
20305
  this.layers.newOnTop();
20304
20306
  }
20305
- isT(item2) {
20307
+ isT(item) {
20306
20308
  return true;
20307
20309
  }
20308
20310
  findById(id) {
@@ -20366,8 +20368,8 @@ class LayeredIndex {
20366
20368
  }
20367
20369
  getContainersFromItems(items) {
20368
20370
  const containers = [];
20369
- for (const item2 of items) {
20370
- const container = this.map.get(item2.getId());
20371
+ for (const item of items) {
20372
+ const container = this.map.get(item.getId());
20371
20373
  if (container) {
20372
20374
  containers.push(container);
20373
20375
  }
@@ -20444,9 +20446,9 @@ class LayeredIndex {
20444
20446
  }
20445
20447
  }
20446
20448
  }
20447
- insert(item2) {
20448
- const toInsert = new Container(item2.getId(), item2, 0, this.getZIndex(item2));
20449
- const bounds = item2.getMbrWithChildren();
20449
+ insert(item) {
20450
+ const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
20451
+ const bounds = item.getMbrWithChildren();
20450
20452
  const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
20451
20453
  if (inBounds.length === 0) {
20452
20454
  return this.insertContainer(toInsert);
@@ -20513,20 +20515,20 @@ class LayeredIndex {
20513
20515
  }
20514
20516
  }
20515
20517
  }
20516
- change(item2) {
20517
- const id = item2.getId();
20518
+ change(item) {
20519
+ const id = item.getId();
20518
20520
  const container = this.map.get(id);
20519
20521
  if (container) {
20520
20522
  const layer = this.layers.get(container.layer);
20521
20523
  if (layer) {
20522
20524
  layer.remove(id);
20523
20525
  this.map.delete(id);
20524
- this.insert(item2);
20526
+ this.insert(item);
20525
20527
  }
20526
20528
  }
20527
20529
  }
20528
- remove(item2) {
20529
- const id = item2.getId();
20530
+ remove(item) {
20531
+ const id = item.getId();
20530
20532
  const container = this.map.get(id);
20531
20533
  if (container) {
20532
20534
  const layer = this.layers.get(container.layer);
@@ -20552,13 +20554,13 @@ class LayeredIndex {
20552
20554
  return items;
20553
20555
  }
20554
20556
  batchInsert(items) {
20555
- for (const item2 of items) {
20556
- this.insert(item2);
20557
+ for (const item of items) {
20558
+ this.insert(item);
20557
20559
  }
20558
20560
  }
20559
20561
  batchChange(items) {
20560
- for (const item2 of items) {
20561
- this.change(item2);
20562
+ for (const item of items) {
20563
+ this.change(item);
20562
20564
  }
20563
20565
  }
20564
20566
  }
@@ -20567,8 +20569,8 @@ class LayeredIndex {
20567
20569
  class SpatialIndex {
20568
20570
  subject = new Subject;
20569
20571
  itemsArray = [];
20570
- itemsIndex = new LayeredIndex((item2) => {
20571
- return this.itemsArray.indexOf(item2);
20572
+ itemsIndex = new LayeredIndex((item) => {
20573
+ return this.itemsArray.indexOf(item);
20572
20574
  });
20573
20575
  Mbr = new Mbr;
20574
20576
  items;
@@ -20577,79 +20579,79 @@ class SpatialIndex {
20577
20579
  }
20578
20580
  clear() {
20579
20581
  this.itemsArray = [];
20580
- this.itemsIndex = new LayeredIndex((item2) => {
20581
- return this.itemsArray.indexOf(item2);
20582
+ this.itemsIndex = new LayeredIndex((item) => {
20583
+ return this.itemsArray.indexOf(item);
20582
20584
  });
20583
20585
  this.Mbr = new Mbr;
20584
20586
  }
20585
- insert(item2) {
20586
- this.itemsArray.push(item2);
20587
- this.itemsIndex.insert(item2);
20587
+ insert(item) {
20588
+ this.itemsArray.push(item);
20589
+ this.itemsIndex.insert(item);
20588
20590
  if (conf.isNode()) {
20589
20591
  return;
20590
20592
  }
20591
20593
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
20592
- this.Mbr = item2.getMbr().copy();
20594
+ this.Mbr = item.getMbr().copy();
20593
20595
  } else {
20594
- this.Mbr.combine([item2.getMbr()]);
20596
+ this.Mbr.combine([item.getMbr()]);
20595
20597
  }
20596
- item2.subject.subscribe(this.change);
20598
+ item.subject.subscribe(this.change);
20597
20599
  this.subject.publish(this.items);
20598
20600
  }
20599
- change = (item2) => {
20600
- this.itemsIndex.change(item2);
20601
+ change = (item) => {
20602
+ this.itemsIndex.change(item);
20601
20603
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
20602
- this.Mbr = item2.getMbrWithChildren().copy();
20604
+ this.Mbr = item.getMbrWithChildren().copy();
20603
20605
  } else {
20604
- this.Mbr.combine([item2.getMbrWithChildren()]);
20606
+ this.Mbr.combine([item.getMbrWithChildren()]);
20605
20607
  }
20606
20608
  this.subject.publish(this.items);
20607
20609
  };
20608
- remove(item2) {
20609
- if ("index" in item2 && item2.index) {
20610
- item2.removeChildItems(item2.index.list());
20610
+ remove(item) {
20611
+ if ("index" in item && item.index) {
20612
+ item.removeChildItems(item.index.list());
20611
20613
  }
20612
- this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
20613
- this.itemsIndex.remove(item2);
20614
+ this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
20615
+ this.itemsIndex.remove(item);
20614
20616
  this.Mbr = new Mbr;
20615
- this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbrWithChildren()]));
20617
+ this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbrWithChildren()]));
20616
20618
  this.subject.publish(this.items);
20617
20619
  }
20618
20620
  copy() {
20619
- return this.getItemsWithIncludedChildren(this.itemsArray).map((item2) => ({
20620
- ...item2.serialize(true),
20621
- id: item2.getId()
20621
+ return this.getItemsWithIncludedChildren(this.itemsArray).map((item) => ({
20622
+ ...item.serialize(true),
20623
+ id: item.getId()
20622
20624
  }));
20623
20625
  }
20624
20626
  getItemsWithIncludedChildren(items) {
20625
- return items.flatMap((item2) => {
20626
- if ("index" in item2 && item2.index) {
20627
- return [item2, ...item2.index.list()];
20627
+ return items.flatMap((item) => {
20628
+ if ("index" in item && item.index) {
20629
+ return [item, ...item.index.list()];
20628
20630
  }
20629
- return item2;
20631
+ return item;
20630
20632
  });
20631
20633
  }
20632
- getItemChildren(item2) {
20633
- if ("index" in item2 && item2.index) {
20634
- return item2.index.list();
20634
+ getItemChildren(item) {
20635
+ if ("index" in item && item.index) {
20636
+ return item.index.list();
20635
20637
  }
20636
20638
  return [];
20637
20639
  }
20638
- getItemParent(item2) {
20639
- if (item2.parent === "Board") {
20640
+ getItemParent(item) {
20641
+ if (item.parent === "Board") {
20640
20642
  return;
20641
20643
  }
20642
- return this.getById(item2.parent);
20644
+ return this.getById(item.parent);
20643
20645
  }
20644
- moveToZIndex(item2, zIndex) {
20645
- const index2 = this.itemsArray.indexOf(item2);
20646
+ moveToZIndex(item, zIndex) {
20647
+ const index2 = this.itemsArray.indexOf(item);
20646
20648
  this.itemsArray.splice(index2, 1);
20647
- this.itemsArray.splice(zIndex, 0, item2);
20648
- this.change(item2);
20649
+ this.itemsArray.splice(zIndex, 0, item);
20650
+ this.change(item);
20649
20651
  this.subject.publish(this.items);
20650
20652
  }
20651
20653
  moveManyToZIndex(itemsRecord) {
20652
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
20654
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
20653
20655
  const zIndex = Object.values(itemsRecord);
20654
20656
  for (let i = 0;i < zIndex.length; i++) {
20655
20657
  const index2 = zIndex[i];
@@ -20657,39 +20659,39 @@ class SpatialIndex {
20657
20659
  }
20658
20660
  this.itemsArray.forEach(this.change.bind(this));
20659
20661
  }
20660
- sendToBack(item2, shouldPublish = true) {
20661
- const index2 = this.itemsArray.indexOf(item2);
20662
+ sendToBack(item, shouldPublish = true) {
20663
+ const index2 = this.itemsArray.indexOf(item);
20662
20664
  this.itemsArray.splice(index2, 1);
20663
- this.itemsArray.unshift(item2);
20664
- this.itemsIndex.change(item2);
20665
+ this.itemsArray.unshift(item);
20666
+ this.itemsIndex.change(item);
20665
20667
  if (shouldPublish) {
20666
20668
  this.subject.publish(this.items);
20667
20669
  }
20668
20670
  }
20669
20671
  sendManyToBack(items) {
20670
20672
  const newItems = [...items];
20671
- this.itemsArray.forEach((item2) => {
20672
- if (!items.includes(item2)) {
20673
- newItems.push(item2);
20673
+ this.itemsArray.forEach((item) => {
20674
+ if (!items.includes(item)) {
20675
+ newItems.push(item);
20674
20676
  }
20675
20677
  });
20676
20678
  this.itemsArray = newItems;
20677
20679
  this.itemsArray.forEach(this.change.bind(this));
20678
20680
  }
20679
- bringToFront(item2, shouldPublish = true) {
20680
- const index2 = this.itemsArray.indexOf(item2);
20681
+ bringToFront(item, shouldPublish = true) {
20682
+ const index2 = this.itemsArray.indexOf(item);
20681
20683
  this.itemsArray.splice(index2, 1);
20682
- this.itemsArray.push(item2);
20683
- this.itemsIndex.change(item2);
20684
+ this.itemsArray.push(item);
20685
+ this.itemsIndex.change(item);
20684
20686
  if (shouldPublish) {
20685
20687
  this.subject.publish(this.items);
20686
20688
  }
20687
20689
  }
20688
20690
  bringManyToFront(items) {
20689
20691
  const newItems = [];
20690
- this.itemsArray.forEach((item2) => {
20691
- if (!items.includes(item2)) {
20692
- newItems.push(item2);
20692
+ this.itemsArray.forEach((item) => {
20693
+ if (!items.includes(item)) {
20694
+ newItems.push(item);
20693
20695
  }
20694
20696
  });
20695
20697
  newItems.push(...items);
@@ -20715,9 +20717,9 @@ class SpatialIndex {
20715
20717
  this.subject.publish(this.items);
20716
20718
  }
20717
20719
  getById(id) {
20718
- const item2 = this.getItemsWithIncludedChildren(this.itemsArray).find((item3) => item3.getId() === id);
20719
- if (item2) {
20720
- return item2;
20720
+ const item = this.getItemsWithIncludedChildren(this.itemsArray).find((item2) => item2.getId() === id);
20721
+ if (item) {
20722
+ return item;
20721
20723
  }
20722
20724
  }
20723
20725
  findById(id) {
@@ -20727,10 +20729,10 @@ class SpatialIndex {
20727
20729
  const mbr = new Mbr(left, top, right, bottom);
20728
20730
  const items = this.itemsIndex.getEnclosed(mbr);
20729
20731
  const children = [];
20730
- const clearItems = items.filter((item2) => {
20731
- if ("index" in item2 && item2.index) {
20732
- children.push(...item2.index.getEnclosed(left, top, right, bottom));
20733
- if (!item2.getMbr().isEnclosedBy(mbr)) {
20732
+ const clearItems = items.filter((item) => {
20733
+ if ("index" in item && item.index) {
20734
+ children.push(...item.index.getEnclosed(left, top, right, bottom));
20735
+ if (!item.getMbr().isEnclosedBy(mbr)) {
20734
20736
  return false;
20735
20737
  }
20736
20738
  }
@@ -20742,10 +20744,10 @@ class SpatialIndex {
20742
20744
  const mbr = new Mbr(left, top, right, bottom);
20743
20745
  const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
20744
20746
  const children = [];
20745
- const clearItems = items.filter((item2) => {
20746
- if ("index" in item2 && item2.index) {
20747
- children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
20748
- if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
20747
+ const clearItems = items.filter((item) => {
20748
+ if ("index" in item && item.index) {
20749
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
20750
+ if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
20749
20751
  return false;
20750
20752
  }
20751
20753
  }
@@ -20756,10 +20758,10 @@ class SpatialIndex {
20756
20758
  getUnderPoint(point3, tolerance = 5) {
20757
20759
  const items = this.itemsIndex.getUnderPoint(point3, tolerance);
20758
20760
  const children = [];
20759
- const clearItems = items.filter((item2) => {
20760
- if ("index" in item2 && item2.index) {
20761
- children.push(...item2.index.getUnderPoint(point3, tolerance));
20762
- if (!item2.getMbr().isUnderPoint(point3)) {
20761
+ const clearItems = items.filter((item) => {
20762
+ if ("index" in item && item.index) {
20763
+ children.push(...item.index.getUnderPoint(point3, tolerance));
20764
+ if (!item.getMbr().isUnderPoint(point3)) {
20763
20765
  return false;
20764
20766
  }
20765
20767
  }
@@ -20771,10 +20773,10 @@ class SpatialIndex {
20771
20773
  const mbr = new Mbr(left, top, right, bottom);
20772
20774
  const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
20773
20775
  const children = [];
20774
- const clearItems = items.filter((item2) => {
20775
- if ("index" in item2 && item2.index) {
20776
- children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
20777
- if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
20776
+ const clearItems = items.filter((item) => {
20777
+ if ("index" in item && item.index) {
20778
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
20779
+ if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
20778
20780
  return false;
20779
20781
  }
20780
20782
  }
@@ -20786,26 +20788,26 @@ class SpatialIndex {
20786
20788
  return this.getRectsEnclosedOrCrossed(left, top, right, bottom);
20787
20789
  }
20788
20790
  getComments() {
20789
- return this.itemsArray.filter((item2) => item2 instanceof Comment);
20791
+ return this.itemsArray.filter((item) => item instanceof Comment);
20790
20792
  }
20791
20793
  getMbr() {
20792
20794
  return this.Mbr;
20793
20795
  }
20794
20796
  getNearestTo(point3, maxItems, filter, maxDistance) {
20795
20797
  const allItems = this.getItemsWithIncludedChildren(this.itemsArray);
20796
- const filtered = allItems.filter((item2) => filter(item2));
20797
- const withDistance = filtered.map((item2) => ({
20798
- item: item2,
20799
- distance: point3.getDistance(item2.getMbr().getCenter())
20798
+ const filtered = allItems.filter((item) => filter(item));
20799
+ const withDistance = filtered.map((item) => ({
20800
+ item,
20801
+ distance: point3.getDistance(item.getMbr().getCenter())
20800
20802
  })).filter(({ distance }) => distance <= maxDistance);
20801
20803
  withDistance.sort((a, b) => a.distance - b.distance);
20802
- return withDistance.slice(0, maxItems).map(({ item: item2 }) => item2);
20804
+ return withDistance.slice(0, maxItems).map(({ item }) => item);
20803
20805
  }
20804
20806
  list() {
20805
20807
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
20806
20808
  }
20807
- getZIndex(item2) {
20808
- const index2 = this.itemsArray.indexOf(item2);
20809
+ getZIndex(item) {
20810
+ const index2 = this.itemsArray.indexOf(item);
20809
20811
  if (index2 === -1) {
20810
20812
  return this.getLastZIndex();
20811
20813
  }
@@ -20835,14 +20837,14 @@ class Items {
20835
20837
  this.pointer = pointer;
20836
20838
  this.subject = subject;
20837
20839
  }
20838
- update(item2) {
20839
- this.index.change(item2);
20840
+ update(item) {
20841
+ this.index.change(item);
20840
20842
  }
20841
20843
  listAll() {
20842
20844
  return this.index.list();
20843
20845
  }
20844
20846
  listGroupItems() {
20845
- return this.index.list().filter((item2) => ("index" in item2) && item2.index);
20847
+ return this.index.list().filter((item) => ("index" in item) && item.index);
20846
20848
  }
20847
20849
  getById(id) {
20848
20850
  return this.index.getById(id);
@@ -20857,7 +20859,7 @@ class Items {
20857
20859
  return this.index.getEnclosedOrCrossed(left, top, right, bottom);
20858
20860
  }
20859
20861
  getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
20860
- return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => item2 instanceof BaseItem && item2.index);
20862
+ return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.index);
20861
20863
  }
20862
20864
  getUnderPoint(point3, tolerance = 5) {
20863
20865
  return this.index.getUnderPoint(point3, tolerance);
@@ -20885,28 +20887,28 @@ class Items {
20885
20887
  const unmodifiedSize = size;
20886
20888
  size = 16;
20887
20889
  const tolerated = this.index.getEnclosedOrCrossed(x - size, y - size, x + size, y + size);
20888
- const groups = tolerated.filter((item2) => item2.itemType === "Group");
20890
+ const groups = tolerated.filter((item) => item.itemType === "Group");
20889
20891
  if (groups.length > 0) {
20890
20892
  return groups;
20891
20893
  }
20892
- let enclosed = tolerated.some((item2) => item2 instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
20894
+ let enclosed = tolerated.some((item) => item instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
20893
20895
  const underPointer = this.getUnderPoint(new Point(x, y), size);
20894
20896
  if (enclosed.length === 0) {
20895
20897
  enclosed = underPointer;
20896
20898
  }
20897
- if (underPointer.some((item2) => item2.itemType === "Drawing")) {
20899
+ if (underPointer.some((item) => item.itemType === "Drawing")) {
20898
20900
  enclosed = [...underPointer, ...enclosed];
20899
20901
  }
20900
- const { nearest } = enclosed.reduce((acc, item2) => {
20901
- const area = item2.getMbr().getHeight() * item2.getMbr().getWidth();
20902
- if (item2.itemType === "Drawing" && !item2.isPointNearLine(this.pointer.point)) {
20902
+ const { nearest } = enclosed.reduce((acc, item) => {
20903
+ const area = item.getMbr().getHeight() * item.getMbr().getWidth();
20904
+ if (item.itemType === "Drawing" && !item.isPointNearLine(this.pointer.point)) {
20903
20905
  return acc;
20904
20906
  }
20905
- const isItemTransparent = item2 instanceof Shape && item2?.getBackgroundColor() === "none";
20906
- const itemZIndex = this.getZIndex(item2);
20907
+ const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
20908
+ const itemZIndex = this.getZIndex(item);
20907
20909
  const accZIndex = this.getZIndex(acc.nearest);
20908
20910
  if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
20909
- return { nearest: item2, area };
20911
+ return { nearest: item, area };
20910
20912
  }
20911
20913
  return acc;
20912
20914
  }, { nearest: undefined, area: Infinity });
@@ -20918,8 +20920,8 @@ class Items {
20918
20920
  getNearPointer(maxDistance = 100, maxItems = 10, filter = () => true) {
20919
20921
  return this.index.getNearestTo(this.pointer.point, maxItems, filter, maxDistance);
20920
20922
  }
20921
- getZIndex(item2) {
20922
- return this.index.getZIndex(item2);
20923
+ getZIndex(item) {
20924
+ return this.index.getZIndex(item);
20923
20925
  }
20924
20926
  getByZIndex(index2) {
20925
20927
  return this.index.getByZIndex(index2);
@@ -20928,11 +20930,11 @@ class Items {
20928
20930
  return this.index.getLastZIndex();
20929
20931
  }
20930
20932
  getLinkedConnectorsById(id) {
20931
- return this.listAll().filter((item2) => {
20932
- if (!(item2 instanceof Connector2)) {
20933
+ return this.listAll().filter((item) => {
20934
+ if (!(item instanceof Connector2)) {
20933
20935
  return false;
20934
20936
  }
20935
- const { startItem, endItem } = item2.getConnectedItems();
20937
+ const { startItem, endItem } = item.getConnectedItems();
20936
20938
  if (startItem?.getId() === id || endItem?.getId() === id) {
20937
20939
  return true;
20938
20940
  }
@@ -20943,11 +20945,11 @@ class Items {
20943
20945
  if (!startPointerItemId && !endPointerItemId) {
20944
20946
  return [];
20945
20947
  }
20946
- return this.listAll().filter((item2) => {
20947
- if (!(item2 instanceof Connector2) || !item2.isConnected()) {
20948
+ return this.listAll().filter((item) => {
20949
+ if (!(item instanceof Connector2) || !item.isConnected()) {
20948
20950
  return false;
20949
20951
  }
20950
- const { startItem, endItem } = item2.getConnectedItems();
20952
+ const { startItem, endItem } = item.getConnectedItems();
20951
20953
  if (startPointerItemId && endPointerItemId) {
20952
20954
  if (startPointerItemId && startItem && startItem.getId() === startPointerItemId && endPointerItemId && endItem && endItem.getId() === endPointerItemId) {
20953
20955
  return true;
@@ -20965,9 +20967,9 @@ class Items {
20965
20967
  }
20966
20968
  render(context) {
20967
20969
  const items = this.getItemsInView();
20968
- items.forEach((item2) => {
20969
- if (item2.parent === "Board") {
20970
- item2.render(context);
20970
+ items.forEach((item) => {
20971
+ if (item.parent === "Board") {
20972
+ item.render(context);
20971
20973
  }
20972
20974
  });
20973
20975
  }
@@ -20980,17 +20982,17 @@ class Items {
20980
20982
  return this.getHTML(documentFactory, items);
20981
20983
  }
20982
20984
  getHTML(documentFactory, items) {
20983
- const lowestCoordinates = items.map((item2) => item2.getMbr()).reduce((acc, mbr) => ({
20985
+ const lowestCoordinates = items.map((item) => item.getMbr()).reduce((acc, mbr) => ({
20984
20986
  left: Math.min(acc.left, mbr.left),
20985
20987
  top: Math.min(acc.top, mbr.top)
20986
20988
  }), { left: 0, top: 0 });
20987
20989
  const groups = [];
20988
20990
  const rest = [];
20989
- items.forEach((item2) => {
20990
- if ("index" in item2 && item2.index) {
20991
- groups.push(item2);
20991
+ items.forEach((item) => {
20992
+ if ("index" in item && item.index) {
20993
+ groups.push(item);
20992
20994
  } else {
20993
- rest.push(item2);
20995
+ rest.push(item);
20994
20996
  }
20995
20997
  });
20996
20998
  const childrenMap = new Map;
@@ -21000,34 +21002,34 @@ class Items {
21000
21002
  translateElementBy(html, -lowestCoordinates.left, -lowestCoordinates.top);
21001
21003
  return html;
21002
21004
  });
21003
- const restHTML = rest.map((item2) => ("renderHTML" in item2) && item2.renderHTML(documentFactory)).filter((item2) => !!item2).map((item2) => {
21004
- if (item2.tagName.toLowerCase() === "connector-item") {
21005
- const startX = parseFloat(item2.getAttribute("data-start-point-x") || "0");
21006
- const startY = parseFloat(item2.getAttribute("data-start-point-y") || "0");
21007
- const endX = parseFloat(item2.getAttribute("data-end-point-x") || "0");
21008
- const endY = parseFloat(item2.getAttribute("data-end-point-y") || "0");
21009
- item2.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
21010
- item2.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
21011
- item2.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
21012
- item2.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
21013
- }
21014
- return translateElementBy(item2, -lowestCoordinates.left, -lowestCoordinates.top);
21015
- });
21016
- for (const item2 of restHTML) {
21017
- const parentFrameId = childrenMap.get(item2.id);
21005
+ const restHTML = rest.map((item) => ("renderHTML" in item) && item.renderHTML(documentFactory)).filter((item) => !!item).map((item) => {
21006
+ if (item.tagName.toLowerCase() === "connector-item") {
21007
+ const startX = parseFloat(item.getAttribute("data-start-point-x") || "0");
21008
+ const startY = parseFloat(item.getAttribute("data-start-point-y") || "0");
21009
+ const endX = parseFloat(item.getAttribute("data-end-point-x") || "0");
21010
+ const endY = parseFloat(item.getAttribute("data-end-point-y") || "0");
21011
+ item.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
21012
+ item.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
21013
+ item.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
21014
+ item.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
21015
+ }
21016
+ return translateElementBy(item, -lowestCoordinates.left, -lowestCoordinates.top);
21017
+ });
21018
+ for (const item of restHTML) {
21019
+ const parentFrameId = childrenMap.get(item.id);
21018
21020
  const group = GroupsHTML.find((el) => parentFrameId !== undefined && el.id === parentFrameId);
21019
21021
  if (group) {
21020
- positionRelatively(item2, group);
21021
- group.appendChild(item2);
21022
+ positionRelatively(item, group);
21023
+ group.appendChild(item);
21022
21024
  }
21023
21025
  }
21024
21026
  let result = "";
21025
21027
  for (const group of GroupsHTML) {
21026
21028
  result += group.outerHTML;
21027
21029
  }
21028
- for (const item2 of restHTML) {
21029
- if (!childrenMap.get(item2.id)) {
21030
- result += item2.outerHTML;
21030
+ for (const item of restHTML) {
21031
+ if (!childrenMap.get(item.id)) {
21032
+ result += item.outerHTML;
21031
21033
  }
21032
21034
  }
21033
21035
  return result;
@@ -21047,52 +21049,52 @@ class SimpleSpatialIndex {
21047
21049
  this.itemsArray = [];
21048
21050
  this.Mbr = new Mbr;
21049
21051
  }
21050
- insert(item2) {
21051
- this.itemsArray.push(item2);
21052
+ insert(item) {
21053
+ this.itemsArray.push(item);
21052
21054
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
21053
- this.Mbr = item2.getMbr().copy();
21055
+ this.Mbr = item.getMbr().copy();
21054
21056
  } else {
21055
- this.Mbr.combine([item2.getMbr()]);
21057
+ this.Mbr.combine([item.getMbr()]);
21056
21058
  }
21057
- item2.subject.subscribe(this.change);
21059
+ item.subject.subscribe(this.change);
21058
21060
  this.subject.publish(this.items);
21059
21061
  }
21060
- change = (item2) => {
21062
+ change = (item) => {
21061
21063
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
21062
- this.Mbr = item2.getMbr().copy();
21064
+ this.Mbr = item.getMbr().copy();
21063
21065
  } else {
21064
- this.Mbr.combine([item2.getMbr()]);
21066
+ this.Mbr.combine([item.getMbr()]);
21065
21067
  }
21066
21068
  this.subject.publish(this.items);
21067
21069
  };
21068
- remove(item2) {
21069
- if ("index" in item2 && item2.index) {
21070
- item2.removeChildItems(item2.index.list());
21070
+ remove(item) {
21071
+ if ("index" in item && item.index) {
21072
+ item.removeChildItems(item.index.list());
21071
21073
  }
21072
- if (item2.parent !== "Board") {
21073
- const parentFrame = this.items.getById(item2.parent);
21074
- parentFrame?.removeChildItems(item2);
21074
+ if (item.parent !== "Board") {
21075
+ const parentFrame = this.items.getById(item.parent);
21076
+ parentFrame?.removeChildItems(item);
21075
21077
  }
21076
- this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
21078
+ this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
21077
21079
  this.Mbr = new Mbr;
21078
- this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbr()]));
21080
+ this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbr()]));
21079
21081
  this.subject.publish(this.items);
21080
21082
  }
21081
21083
  copy() {
21082
- return this.itemsArray.map((item2) => ({
21083
- ...item2.serialize(true),
21084
- id: item2.getId()
21084
+ return this.itemsArray.map((item) => ({
21085
+ ...item.serialize(true),
21086
+ id: item.getId()
21085
21087
  }));
21086
21088
  }
21087
- moveToZIndex(item2, zIndex) {
21088
- const index2 = this.itemsArray.indexOf(item2);
21089
+ moveToZIndex(item, zIndex) {
21090
+ const index2 = this.itemsArray.indexOf(item);
21089
21091
  this.itemsArray.splice(index2, 1);
21090
- this.itemsArray.splice(zIndex, 0, item2);
21091
- this.change(item2);
21092
+ this.itemsArray.splice(zIndex, 0, item);
21093
+ this.change(item);
21092
21094
  this.subject.publish(this.items);
21093
21095
  }
21094
21096
  moveManyToZIndex(itemsRecord) {
21095
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
21097
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
21096
21098
  const zIndex = Object.values(itemsRecord);
21097
21099
  for (let i = 0;i < zIndex.length; i++) {
21098
21100
  const index2 = zIndex[i];
@@ -21100,37 +21102,37 @@ class SimpleSpatialIndex {
21100
21102
  }
21101
21103
  this.itemsArray.forEach(this.change.bind(this));
21102
21104
  }
21103
- sendToBack(item2, shouldPublish = true) {
21104
- const index2 = this.itemsArray.indexOf(item2);
21105
+ sendToBack(item, shouldPublish = true) {
21106
+ const index2 = this.itemsArray.indexOf(item);
21105
21107
  this.itemsArray.splice(index2, 1);
21106
- this.itemsArray.unshift(item2);
21108
+ this.itemsArray.unshift(item);
21107
21109
  if (shouldPublish) {
21108
21110
  this.subject.publish(this.items);
21109
21111
  }
21110
21112
  }
21111
21113
  sendManyToBack(items) {
21112
21114
  const newItems = [...items];
21113
- this.itemsArray.forEach((item2) => {
21114
- if (!items.includes(item2)) {
21115
- newItems.push(item2);
21115
+ this.itemsArray.forEach((item) => {
21116
+ if (!items.includes(item)) {
21117
+ newItems.push(item);
21116
21118
  }
21117
21119
  });
21118
21120
  this.itemsArray = newItems;
21119
21121
  this.itemsArray.forEach(this.change.bind(this));
21120
21122
  }
21121
- bringToFront(item2, shouldPublish = true) {
21122
- const index2 = this.itemsArray.indexOf(item2);
21123
+ bringToFront(item, shouldPublish = true) {
21124
+ const index2 = this.itemsArray.indexOf(item);
21123
21125
  this.itemsArray.splice(index2, 1);
21124
- this.itemsArray.push(item2);
21126
+ this.itemsArray.push(item);
21125
21127
  if (shouldPublish) {
21126
21128
  this.subject.publish(this.items);
21127
21129
  }
21128
21130
  }
21129
21131
  bringManyToFront(items) {
21130
21132
  const newItems = [];
21131
- this.itemsArray.forEach((item2) => {
21132
- if (!items.includes(item2)) {
21133
- newItems.push(item2);
21133
+ this.itemsArray.forEach((item) => {
21134
+ if (!items.includes(item)) {
21135
+ newItems.push(item);
21134
21136
  }
21135
21137
  });
21136
21138
  newItems.push(...items);
@@ -21156,9 +21158,9 @@ class SimpleSpatialIndex {
21156
21158
  this.subject.publish(this.items);
21157
21159
  }
21158
21160
  getById(id) {
21159
- const item2 = this.itemsArray.find((item3) => item3.getId() === id);
21160
- if (item2) {
21161
- return item2;
21161
+ const item = this.itemsArray.find((item2) => item2.getId() === id);
21162
+ if (item) {
21163
+ return item;
21162
21164
  }
21163
21165
  }
21164
21166
  findById(id) {
@@ -21167,9 +21169,9 @@ class SimpleSpatialIndex {
21167
21169
  getEnclosed(left, top, right, bottom) {
21168
21170
  const mbr = new Mbr(left, top, right, bottom);
21169
21171
  const items = [];
21170
- this.itemsArray.forEach((item2) => {
21171
- if (item2.isEnclosedBy(mbr)) {
21172
- items.push(item2);
21172
+ this.itemsArray.forEach((item) => {
21173
+ if (item.isEnclosedBy(mbr)) {
21174
+ items.push(item);
21173
21175
  }
21174
21176
  });
21175
21177
  return items;
@@ -21177,18 +21179,18 @@ class SimpleSpatialIndex {
21177
21179
  getEnclosedOrCrossed(left, top, right, bottom) {
21178
21180
  const mbr = new Mbr(left, top, right, bottom);
21179
21181
  const items = [];
21180
- this.itemsArray.forEach((item2) => {
21181
- if (item2.isEnclosedOrCrossedBy(mbr)) {
21182
- items.push(item2);
21182
+ this.itemsArray.forEach((item) => {
21183
+ if (item.isEnclosedOrCrossedBy(mbr)) {
21184
+ items.push(item);
21183
21185
  }
21184
21186
  });
21185
21187
  return items;
21186
21188
  }
21187
21189
  getUnderPoint(point3, tolerace = 5) {
21188
21190
  const items = [];
21189
- this.itemsArray.forEach((item2) => {
21190
- if (item2.isUnderPoint(point3, tolerace)) {
21191
- items.push(item2);
21191
+ this.itemsArray.forEach((item) => {
21192
+ if (item.isUnderPoint(point3, tolerace)) {
21193
+ items.push(item);
21192
21194
  }
21193
21195
  });
21194
21196
  return items;
@@ -21199,8 +21201,8 @@ class SimpleSpatialIndex {
21199
21201
  list() {
21200
21202
  return this.itemsArray.concat();
21201
21203
  }
21202
- getZIndex(item2) {
21203
- return this.itemsArray.indexOf(item2);
21204
+ getZIndex(item) {
21205
+ return this.itemsArray.indexOf(item);
21204
21206
  }
21205
21207
  getLastZIndex() {
21206
21208
  return this.itemsArray.length - 1;
@@ -21214,8 +21216,8 @@ class SimpleSpatialIndex {
21214
21216
  }
21215
21217
  }
21216
21218
  render(context) {
21217
- this.itemsArray.forEach((item2) => {
21218
- item2.render(context);
21219
+ this.itemsArray.forEach((item) => {
21220
+ item.render(context);
21219
21221
  });
21220
21222
  }
21221
21223
  }
@@ -21266,7 +21268,7 @@ class BaseItem extends Mbr {
21266
21268
  if (!this.index) {
21267
21269
  return null;
21268
21270
  }
21269
- return this.index.items.listAll().map((item2) => item2.getId());
21271
+ return this.index.items.listAll().map((item) => item.getId());
21270
21272
  }
21271
21273
  addChildItems(children) {
21272
21274
  if (!this.index) {
@@ -21304,17 +21306,17 @@ class BaseItem extends Mbr {
21304
21306
  this.addChildItems(itemsToAdd);
21305
21307
  this.removeChildItems(itemsToRemove);
21306
21308
  }
21307
- handleNesting(item2, options) {
21308
- const isItem = "itemType" in item2;
21309
- const itemMbr = isItem ? item2.getMbr() : item2;
21310
- if (item2 instanceof BaseItem && !item2.canBeNested) {
21309
+ handleNesting(item, options) {
21310
+ const isItem = "itemType" in item;
21311
+ const itemMbr = isItem ? item.getMbr() : item;
21312
+ if (item instanceof BaseItem && !item.canBeNested) {
21311
21313
  return false;
21312
21314
  }
21313
- if (options?.cancelIfChild && isItem && item2.parent !== "Board") {
21315
+ if (options?.cancelIfChild && isItem && item.parent !== "Board") {
21314
21316
  return false;
21315
21317
  }
21316
21318
  const mbr = this.getMbr().copy();
21317
- if (item2.isEnclosedOrCrossedBy(mbr)) {
21319
+ if (item.isEnclosedOrCrossedBy(mbr)) {
21318
21320
  if (mbr.isInside(itemMbr.getCenter())) {
21319
21321
  if (!options || !options.onlyForOut) {
21320
21322
  return true;
@@ -23611,8 +23613,8 @@ function isChild(value) {
23611
23613
  if (!Array.isArray(value2))
23612
23614
  return true;
23613
23615
  const list2 = value2;
23614
- for (const item2 of list2) {
23615
- if (typeof item2 !== "number" && typeof item2 !== "string") {
23616
+ for (const item of list2) {
23617
+ if (typeof item !== "number" && typeof item !== "string") {
23616
23618
  return true;
23617
23619
  }
23618
23620
  }
@@ -23651,8 +23653,8 @@ function addProperty(schema, properties, key, value) {
23651
23653
  }
23652
23654
  if (Array.isArray(result)) {
23653
23655
  const finalResult = [];
23654
- for (const item2 of result) {
23655
- finalResult.push(parsePrimitive(info, info.property, item2));
23656
+ for (const item of result) {
23657
+ finalResult.push(parsePrimitive(info, info.property, item));
23656
23658
  }
23657
23659
  result = finalResult;
23658
23660
  }
@@ -34719,8 +34721,8 @@ function list5(node2, parent, state, info) {
34719
34721
  if (checkRule(state) === bullet && firstListItem) {
34720
34722
  let index2 = -1;
34721
34723
  while (++index2 < node2.children.length) {
34722
- const item2 = node2.children[index2];
34723
- if (item2 && item2.type === "listItem" && item2.children && item2.children[0] && item2.children[0].type === "thematicBreak") {
34724
+ const item = node2.children[index2];
34725
+ if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
34724
34726
  useDifferentMarker = true;
34725
34727
  break;
34726
34728
  }
@@ -35380,12 +35382,12 @@ async function convertMarkdownToSlate(text5) {
35380
35382
  ...nodes.filter((node2) => node2.type !== "list_item")
35381
35383
  ];
35382
35384
  }
35383
- return nodes.map((item2) => {
35385
+ return nodes.map((item) => {
35384
35386
  setNodeStyles({
35385
- node: item2,
35386
- isPaddingTopNeeded: item2.type !== "code_block"
35387
+ node: item,
35388
+ isPaddingTopNeeded: item.type !== "code_block"
35387
35389
  });
35388
- return item2;
35390
+ return item;
35389
35391
  });
35390
35392
  }
35391
35393
  function detectListType(text5) {
@@ -35798,17 +35800,17 @@ class FloatingPoint extends Point {
35798
35800
  relativePoint;
35799
35801
  pointType = "Floating";
35800
35802
  edge;
35801
- constructor(item2, relativePoint) {
35803
+ constructor(item, relativePoint) {
35802
35804
  super();
35803
- this.item = item2;
35805
+ this.item = item;
35804
35806
  this.relativePoint = relativePoint;
35805
35807
  if (relativePoint.y <= 0) {
35806
35808
  this.edge = "top";
35807
- } else if (relativePoint.y >= item2.getMbr().getHeight()) {
35809
+ } else if (relativePoint.y >= item.getMbr().getHeight()) {
35808
35810
  this.edge = "bottom";
35809
35811
  } else if (relativePoint.x <= 0) {
35810
35812
  this.edge = "left";
35811
- } else if (relativePoint.x >= item2.getMbr().getWidth()) {
35813
+ } else if (relativePoint.x >= item.getMbr().getWidth()) {
35812
35814
  this.edge = "right";
35813
35815
  }
35814
35816
  this.recalculatePoint();
@@ -35839,17 +35841,17 @@ class FixedPoint extends Point {
35839
35841
  relativePoint;
35840
35842
  pointType = "Fixed";
35841
35843
  edge;
35842
- constructor(item2, relativePoint) {
35844
+ constructor(item, relativePoint) {
35843
35845
  super();
35844
- this.item = item2;
35846
+ this.item = item;
35845
35847
  this.relativePoint = relativePoint;
35846
35848
  if (relativePoint.y <= 0) {
35847
35849
  this.edge = "top";
35848
- } else if (relativePoint.y >= item2.getMbr().getHeight()) {
35850
+ } else if (relativePoint.y >= item.getMbr().getHeight()) {
35849
35851
  this.edge = "bottom";
35850
35852
  } else if (relativePoint.x <= 0) {
35851
35853
  this.edge = "left";
35852
- } else if (relativePoint.x >= item2.getMbr().getWidth()) {
35854
+ } else if (relativePoint.x >= item.getMbr().getWidth()) {
35853
35855
  this.edge = "right";
35854
35856
  }
35855
35857
  this.recalculatePoint();
@@ -35880,16 +35882,16 @@ class FixedConnectorPoint extends Point {
35880
35882
  tangent;
35881
35883
  segmentIndex;
35882
35884
  pointType = "FixedConnector";
35883
- constructor(item2, tangent, segmentIndex) {
35885
+ constructor(item, tangent, segmentIndex) {
35884
35886
  super();
35885
- this.item = item2;
35887
+ this.item = item;
35886
35888
  this.tangent = tangent;
35887
35889
  this.segmentIndex = segmentIndex;
35888
35890
  this.recalculatePoint();
35889
35891
  }
35890
35892
  recalculatePoint() {
35891
- const item2 = this.item;
35892
- const segments = item2.getPaths().getSegments();
35893
+ const item = this.item;
35894
+ const segments = item.getPaths().getSegments();
35893
35895
  const segment = segments.length > this.segmentIndex ? segments[this.segmentIndex] : segments[segments.length - 1];
35894
35896
  const point5 = segment.getPoint(this.tangent);
35895
35897
  this.x = point5.x;
@@ -35914,38 +35916,38 @@ function getControlPoint(data, findItem2) {
35914
35916
  if (data.pointType === "Board") {
35915
35917
  return new BoardPoint(Math.round(data.x), Math.round(data.y));
35916
35918
  } else {
35917
- const item2 = findItem2(data.itemId);
35918
- if (!item2) {
35919
+ const item = findItem2(data.itemId);
35920
+ if (!item) {
35919
35921
  console.warn(`getControlPoint(): item not found for ${data.itemId}`);
35920
35922
  return new BoardPoint(0, 0);
35921
35923
  }
35922
35924
  switch (data.pointType) {
35923
35925
  case "FixedConnector":
35924
- if (item2 instanceof Connector2) {
35925
- return new FixedConnectorPoint(item2, data.tangent, data.segment);
35926
+ if (item instanceof Connector2) {
35927
+ return new FixedConnectorPoint(item, data.tangent, data.segment);
35926
35928
  } else {
35927
35929
  throw new Error(`getControlPoint(): item must be a connector`);
35928
35930
  }
35929
35931
  case "Floating":
35930
- return new FloatingPoint(item2, new Point(data.relativeX, data.relativeY));
35932
+ return new FloatingPoint(item, new Point(data.relativeX, data.relativeY));
35931
35933
  case "Fixed":
35932
- return new FixedPoint(item2, new Point(data.relativeX, data.relativeY));
35934
+ return new FixedPoint(item, new Point(data.relativeX, data.relativeY));
35933
35935
  }
35934
35936
  }
35935
35937
  }
35936
- function toRelativePoint(point5, item2) {
35937
- const matrix = item2.transformation?.matrix || new Matrix2;
35938
+ function toRelativePoint(point5, item) {
35939
+ const matrix = item.transformation?.matrix || new Matrix2;
35938
35940
  const inverse = matrix.getInverse();
35939
35941
  point5 = point5.copy();
35940
35942
  point5.transform(inverse);
35941
35943
  return point5;
35942
35944
  }
35943
- function fromRelativePoint(relativePoint, item2, edge) {
35944
- const matrix = item2.transformation?.matrix.copy() || new Matrix2;
35945
+ function fromRelativePoint(relativePoint, item, edge) {
35946
+ const matrix = item.transformation?.matrix.copy() || new Matrix2;
35945
35947
  const point5 = relativePoint.copy();
35946
35948
  point5.transform(matrix);
35947
- if (item2 instanceof RichText || item2 instanceof AINode) {
35948
- const itemMbr = item2.getMbr();
35949
+ if (item instanceof RichText || item instanceof AINode) {
35950
+ const itemMbr = item.getMbr();
35949
35951
  const { x: centerX, y: centerY } = itemMbr.getCenter();
35950
35952
  switch (edge) {
35951
35953
  case "left":
@@ -35957,7 +35959,7 @@ function fromRelativePoint(relativePoint, item2, edge) {
35957
35959
  case "bottom":
35958
35960
  return new Point(centerX, itemMbr.bottom);
35959
35961
  default:
35960
- return item2.getMbr().getClosestEdgeCenterPoint(point5);
35962
+ return item.getMbr().getClosestEdgeCenterPoint(point5);
35961
35963
  }
35962
35964
  }
35963
35965
  return point5;
@@ -37306,7 +37308,7 @@ class Connector2 extends BaseItem {
37306
37308
  return this;
37307
37309
  }
37308
37310
  getConnectorById(items, connectorId) {
37309
- return items.find((item2) => item2 instanceof Connector2 && item2.getId() === connectorId);
37311
+ return items.find((item) => item instanceof Connector2 && item.getId() === connectorId);
37310
37312
  }
37311
37313
  updateTitle() {
37312
37314
  const selection = this.board.selection;
@@ -39943,8 +39945,8 @@ async function exportBoardSnapshot({
39943
39945
  context.matrix.applyToContext(context.ctx);
39944
39946
  const { left, top, right, bottom } = selection;
39945
39947
  const inView = board.items.index.getRectsEnclosedOrCrossed(left, top, right, bottom);
39946
- for (const item2 of inView) {
39947
- item2.render(context);
39948
+ for (const item of inView) {
39949
+ item.render(context);
39948
39950
  }
39949
39951
  const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
39950
39952
  const dataUrl = await convertBlobToDataUrl(blob);
@@ -40142,7 +40144,7 @@ class Frame2 extends BaseItem {
40142
40144
  return this.id;
40143
40145
  }
40144
40146
  getChildrenIds() {
40145
- return this.index?.list().map((item2) => item2.getId()) || [];
40147
+ return this.index?.list().map((item) => item.getId()) || [];
40146
40148
  }
40147
40149
  updateMbr() {
40148
40150
  const rect = this.path.getMbr().copy();
@@ -40377,11 +40379,11 @@ class Frame2 extends BaseItem {
40377
40379
  }
40378
40380
  });
40379
40381
  const currMbr = this.getMbr();
40380
- this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item2) => {
40381
- if (item2.parent === "Board") {
40382
- if (this.handleNesting(item2)) {
40383
- this.applyAddChildren([item2.getId()]);
40384
- item2.parent = this.getId();
40382
+ this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
40383
+ if (item.parent === "Board") {
40384
+ if (this.handleNesting(item)) {
40385
+ this.applyAddChildren([item.getId()]);
40386
+ item.parent = this.getId();
40385
40387
  }
40386
40388
  }
40387
40389
  });
@@ -42579,9 +42581,9 @@ class Group extends BaseItem {
42579
42581
  if (data.children) {
42580
42582
  data.children.forEach((childId) => {
42581
42583
  this.applyAddChild(childId);
42582
- const item2 = this.board.items.getById(childId);
42583
- if (item2) {
42584
- item2.parent = this.getId();
42584
+ const item = this.board.items.getById(childId);
42585
+ if (item) {
42586
+ item.parent = this.getId();
42585
42587
  }
42586
42588
  });
42587
42589
  }
@@ -42611,11 +42613,11 @@ class Group extends BaseItem {
42611
42613
  let right = Number.MIN_SAFE_INTEGER;
42612
42614
  let bottom = Number.MIN_SAFE_INTEGER;
42613
42615
  const mbrs = this.children.flatMap((childId) => {
42614
- const item2 = this.board.items.getById(childId);
42615
- if (!item2) {
42616
+ const item = this.board.items.getById(childId);
42617
+ if (!item) {
42616
42618
  return [];
42617
42619
  }
42618
- const mbr2 = item2.getMbr();
42620
+ const mbr2 = item.getMbr();
42619
42621
  if (!mbr2) {
42620
42622
  return [];
42621
42623
  }
@@ -42650,7 +42652,7 @@ class Group extends BaseItem {
42650
42652
  return this.children;
42651
42653
  }
42652
42654
  getChildren() {
42653
- return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item2) => item2 !== undefined);
42655
+ return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item) => item !== undefined);
42654
42656
  }
42655
42657
  updateMbr() {
42656
42658
  const rect = this.getMbr();
@@ -42663,9 +42665,9 @@ class Group extends BaseItem {
42663
42665
  setChildren(items) {
42664
42666
  items.forEach((itemId) => {
42665
42667
  this.addChild(itemId);
42666
- const item2 = this.board.items.getById(itemId);
42667
- if (item2) {
42668
- item2.parent = this.getId();
42668
+ const item = this.board.items.getById(itemId);
42669
+ if (item) {
42670
+ item.parent = this.getId();
42669
42671
  }
42670
42672
  });
42671
42673
  this.updateMbr();
@@ -42673,9 +42675,9 @@ class Group extends BaseItem {
42673
42675
  removeChildren() {
42674
42676
  this.children.forEach((itemId) => {
42675
42677
  this.removeChild(itemId);
42676
- const item2 = this.board.items.getById(itemId);
42677
- if (item2) {
42678
- item2.parent = this.parent;
42678
+ const item = this.board.items.getById(itemId);
42679
+ if (item) {
42680
+ item.parent = this.parent;
42679
42681
  }
42680
42682
  });
42681
42683
  this.updateMbr();
@@ -43008,16 +43010,16 @@ class Anchor extends Mbr {
43008
43010
  }
43009
43011
  }
43010
43012
  // src/Items/Connector/ConnectorSnap.ts
43011
- function getFixedPoint(item2, point5) {
43012
- if (item2 instanceof Connector2) {
43013
- const nearestSegmentData = item2.getPaths().getNearestEdgeAndPointTo(point5);
43013
+ function getFixedPoint(item, point5) {
43014
+ if (item instanceof Connector2) {
43015
+ const nearestSegmentData = item.getPaths().getNearestEdgeAndPointTo(point5);
43014
43016
  const segment = nearestSegmentData.segment;
43015
43017
  const index2 = nearestSegmentData.index;
43016
43018
  const tangent = segment.getParameter(point5);
43017
- return new FixedConnectorPoint(item2, tangent, index2);
43019
+ return new FixedConnectorPoint(item, tangent, index2);
43018
43020
  } else {
43019
- const relativePoint = toRelativePoint(point5, item2);
43020
- return new FixedPoint(item2, relativePoint);
43021
+ const relativePoint = toRelativePoint(point5, item);
43022
+ return new FixedPoint(item, relativePoint);
43021
43023
  }
43022
43024
  }
43023
43025
 
@@ -43070,20 +43072,20 @@ class ConnectorSnap {
43070
43072
  }
43071
43073
  this.setSnap();
43072
43074
  const pointer = this.board.pointer.point;
43073
- const { anchor, item: item2, point: point5 } = this.snap;
43074
- if (!item2) {
43075
+ const { anchor, item, point: point5 } = this.snap;
43076
+ if (!item) {
43075
43077
  const pointer2 = this.board.pointer.point;
43076
43078
  this.controlPoint = new BoardPoint(pointer2.x, pointer2.y);
43077
43079
  } else if (anchor) {
43078
- this.controlPoint = getFixedPoint(item2, anchor.getCenter());
43080
+ this.controlPoint = getFixedPoint(item, anchor.getCenter());
43079
43081
  } else if (point5) {
43080
- const nearest2 = item2.getNearestEdgePointTo(pointer);
43081
- this.controlPoint = getFixedPoint(item2, nearest2);
43082
+ const nearest2 = item.getNearestEdgePointTo(pointer);
43083
+ this.controlPoint = getFixedPoint(item, nearest2);
43082
43084
  } else {
43083
43085
  if (this.hover.isTimeoutElapsed) {
43084
- this.controlPoint = getFixedPoint(item2, pointer);
43086
+ this.controlPoint = getFixedPoint(item, pointer);
43085
43087
  } else {
43086
- this.controlPoint = getFixedPoint(item2, pointer);
43088
+ this.controlPoint = getFixedPoint(item, pointer);
43087
43089
  }
43088
43090
  }
43089
43091
  }
@@ -43144,23 +43146,23 @@ class ConnectorSnap {
43144
43146
  }
43145
43147
  return nearest;
43146
43148
  }
43147
- getClosestPointOnItem(item2, position4) {
43148
- const nearestEdgePoint = item2.getNearestEdgePointTo(position4);
43149
- return getFixedPoint(item2, nearestEdgePoint);
43149
+ getClosestPointOnItem(item, position4) {
43150
+ const nearestEdgePoint = item.getNearestEdgePointTo(position4);
43151
+ return getFixedPoint(item, nearestEdgePoint);
43150
43152
  }
43151
- isNearBorder(item2) {
43152
- if (!item2) {
43153
+ isNearBorder(item) {
43154
+ if (!item) {
43153
43155
  return false;
43154
43156
  }
43155
43157
  const pointer = this.board.pointer.point;
43156
- const point5 = item2.getNearestEdgePointTo(pointer);
43158
+ const point5 = item.getNearestEdgePointTo(pointer);
43157
43159
  const distance = pointer.getDistance(point5);
43158
43160
  return distance < this.distance.border / this.board.camera.getScale();
43159
43161
  }
43160
43162
  setSnap() {
43161
- const item2 = this.snap.item;
43162
- const path2 = item2 && "getPath" in item2 ? item2?.getPath() : null;
43163
- if (!item2 || !path2) {
43163
+ const item = this.snap.item;
43164
+ const path2 = item && "getPath" in item ? item?.getPath() : null;
43165
+ if (!item || !path2) {
43164
43166
  this.snap.path = null;
43165
43167
  this.snap.anchors = [];
43166
43168
  this.snap.anchor = null;
@@ -43171,11 +43173,11 @@ class ConnectorSnap {
43171
43173
  if (this.snap.item === this.hover.item && !this.hover.isTimeoutElapsed) {
43172
43174
  path2.setBackgroundColor(this.color.snapBackgroundHighlight);
43173
43175
  }
43174
- this.setAnchors(item2);
43176
+ this.setAnchors(item);
43175
43177
  }
43176
43178
  }
43177
- setAnchors(item2) {
43178
- const points = item2.getSnapAnchorPoints();
43179
+ setAnchors(item) {
43180
+ const points = item.getSnapAnchorPoints();
43179
43181
  if (!points) {
43180
43182
  return;
43181
43183
  }
@@ -43209,10 +43211,10 @@ class ConnectorSnap {
43209
43211
  }
43210
43212
  setPoint() {
43211
43213
  const pointer = this.board.pointer.point;
43212
- const { item: item2, anchor } = this.snap;
43213
- if (item2) {
43214
+ const { item, anchor } = this.snap;
43215
+ if (item) {
43214
43216
  if (!anchor) {
43215
- const point5 = item2.getNearestEdgePointTo(pointer);
43217
+ const point5 = item.getNearestEdgePointTo(pointer);
43216
43218
  if (point5.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
43217
43219
  this.snap.point = new Anchor(point5.x, point5.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
43218
43220
  } else {
@@ -43585,12 +43587,12 @@ class NestingHighlighter extends Tool {
43585
43587
  this.toHighlight.push({ groupItem, children: array });
43586
43588
  }
43587
43589
  }
43588
- addSingleItem(item2) {
43589
- this.toHighlight.push({ children: [item2] });
43590
+ addSingleItem(item) {
43591
+ this.toHighlight.push({ children: [item] });
43590
43592
  }
43591
- remove(item2) {
43593
+ remove(item) {
43592
43594
  this.toHighlight.forEach((group) => {
43593
- group.children = group.children.filter((child) => child !== item2);
43595
+ group.children = group.children.filter((child) => child !== item);
43594
43596
  });
43595
43597
  this.toHighlight = this.toHighlight.filter((group) => group.children.length > 0);
43596
43598
  }
@@ -43657,7 +43659,7 @@ class AddFrame extends BoardTool {
43657
43659
  this.mbr.borderColor = "blue";
43658
43660
  this.nestingHighlighter.clear();
43659
43661
  const enclosedOrCrossed = this.board.items.getEnclosedOrCrossed(this.mbr.left, this.mbr.top, this.mbr.right, this.mbr.bottom);
43660
- const inside = enclosedOrCrossed.filter((item2) => !(item2 instanceof Frame2) && item2.parent === "Board" && this.mbr.isInside(item2.getMbr().getCenter()));
43662
+ const inside = enclosedOrCrossed.filter((item) => !(item instanceof Frame2) && item.parent === "Board" && this.mbr.isInside(item.getMbr().getCenter()));
43661
43663
  this.nestingHighlighter.add(this.frame, inside);
43662
43664
  this.initTransformation();
43663
43665
  this.board.tools.publish();
@@ -43678,7 +43680,7 @@ class AddFrame extends BoardTool {
43678
43680
  localStorage.setItem("lastFrameScale", JSON.stringify(this.frame.transformation.getScale()));
43679
43681
  }
43680
43682
  const currMbr = this.frame.getMbr();
43681
- 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));
43683
+ 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));
43682
43684
  this.applyAddChildren(frameChildren);
43683
43685
  if (this.shape !== "Custom") {
43684
43686
  this.applyCanChangeRatio(false);
@@ -43694,7 +43696,7 @@ class AddFrame extends BoardTool {
43694
43696
  return true;
43695
43697
  }
43696
43698
  addNextTo() {
43697
- const framesInView = this.board.items.getItemsInView().filter((item2) => item2 instanceof Frame2);
43699
+ const framesInView = this.board.items.getItemsInView().filter((item) => item instanceof Frame2);
43698
43700
  if (framesInView.length === 0) {
43699
43701
  if (this.shape === "Custom") {
43700
43702
  const { x, y } = this.frame.getLastFrameScale();
@@ -43732,7 +43734,7 @@ class AddFrame extends BoardTool {
43732
43734
  this.board.camera.viewRectangle(this.frame.getMbr());
43733
43735
  }
43734
43736
  const frameMbr = this.frame.getMbr();
43735
- 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]));
43737
+ 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]));
43736
43738
  const frame = this.board.add(this.frame);
43737
43739
  frame.text.editor.moveCursorToEndOfTheText();
43738
43740
  this.nestingHighlighter.clear();
@@ -44237,13 +44239,13 @@ class Eraser extends BoardTool {
44237
44239
  }
44238
44240
  removeUnderPointOrLine() {
44239
44241
  const segments = this.drawing.getLines();
44240
- const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item2) => {
44241
- return item2.itemType === "Drawing" && item2.getLines().find((line) => {
44242
- return line.getDistance(this.board.pointer.point) <= item2.strokeWidth / 2 + this.strokeWidth / 2;
44242
+ const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item) => {
44243
+ return item.itemType === "Drawing" && item.getLines().find((line) => {
44244
+ return line.getDistance(this.board.pointer.point) <= item.strokeWidth / 2 + this.strokeWidth / 2;
44243
44245
  });
44244
44246
  });
44245
- 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) => {
44246
- return item2.itemType === "Drawing" && item2.getLines().some((line) => {
44247
+ 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) => {
44248
+ return item.itemType === "Drawing" && item.getLines().some((line) => {
44247
44249
  return segments.some((segment) => segment.hasIntersectionPoint(line));
44248
44250
  });
44249
44251
  }));
@@ -44695,20 +44697,20 @@ function createCanvasDrawer(board) {
44695
44697
  context.ctx.setTransform(board2.camera.getMatrix().scaleX, 0, 0, board2.camera.getMatrix().scaleY, 0, 0);
44696
44698
  context.matrix.applyToContext(context.ctx);
44697
44699
  const items = Object.keys(translation).map((id) => {
44698
- const item2 = board2.items.getById(id);
44699
- if (item2) {
44700
- if (item2.itemType !== "Frame") {
44701
- return item2;
44700
+ const item = board2.items.getById(id);
44701
+ if (item) {
44702
+ if (item.itemType !== "Frame") {
44703
+ return item;
44702
44704
  }
44703
- item2.render(context);
44704
- return item2;
44705
+ item.render(context);
44706
+ return item;
44705
44707
  }
44706
44708
  return;
44707
- }).filter((item2) => !!item2);
44708
- items.forEach((item2) => {
44709
- if (item2.itemType !== "Frame") {
44710
- item2.render(context);
44711
- board2.selection.renderItemMbr(context, item2, board2.camera.getMatrix().scaleX);
44709
+ }).filter((item) => !!item);
44710
+ items.forEach((item) => {
44711
+ if (item.itemType !== "Frame") {
44712
+ item.render(context);
44713
+ board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
44712
44714
  }
44713
44715
  });
44714
44716
  return { canvas: container, items };
@@ -44769,10 +44771,10 @@ function createCanvasDrawer(board) {
44769
44771
  if (lastTranslationKeys) {
44770
44772
  board.selection.shouldPublish = false;
44771
44773
  lastTranslationKeys.forEach((id) => {
44772
- const item2 = board.items.getById(id);
44773
- if (item2) {
44774
- item2.transformationRenderBlock = undefined;
44775
- item2.subject.publish(item2);
44774
+ const item = board.items.getById(id);
44775
+ if (item) {
44776
+ item.transformationRenderBlock = undefined;
44777
+ item.subject.publish(item);
44776
44778
  }
44777
44779
  });
44778
44780
  lastTranslationKeys = undefined;
@@ -44804,9 +44806,9 @@ function createCanvasDrawer(board) {
44804
44806
  lastCreatedCanvas = cnvs;
44805
44807
  lastTranslationKeys = Object.keys(translation);
44806
44808
  lastTranslationKeys.forEach((id) => {
44807
- const item2 = board.items.getById(id);
44808
- if (item2) {
44809
- item2.transformationRenderBlock = true;
44809
+ const item = board.items.getById(id);
44810
+ if (item) {
44811
+ item.transformationRenderBlock = true;
44810
44812
  }
44811
44813
  });
44812
44814
  board.selection.transformationRenderBlock = true;
@@ -44816,14 +44818,14 @@ function createCanvasDrawer(board) {
44816
44818
  }
44817
44819
  function countSumMbr(translation) {
44818
44820
  return Object.keys(translation).reduce((mbr, id) => {
44819
- const item2 = board.items.getById(id);
44820
- if (item2) {
44821
+ const item = board.items.getById(id);
44822
+ if (item) {
44821
44823
  if (!mbr) {
44822
- mbr = item2.getMbr();
44824
+ mbr = item.getMbr();
44823
44825
  } else {
44824
- mbr.combine(item2.getMbr());
44825
- if (item2.itemType === "Frame") {
44826
- mbr.combine(item2.getRichText().getMbr());
44826
+ mbr.combine(item.getMbr());
44827
+ if (item.itemType === "Frame") {
44828
+ mbr.combine(item.getRichText().getMbr());
44827
44829
  }
44828
44830
  }
44829
44831
  }
@@ -44854,8 +44856,8 @@ function createCanvasDrawer(board) {
44854
44856
  }
44855
44857
  function highlightNesting() {
44856
44858
  const container = getLastCreatedCanvas();
44857
- const drawnItemsMap = drawnItems?.reduce((acc, item2) => {
44858
- acc.set(item2.getId(), { item: item2, mbr: item2.getMbr() });
44859
+ const drawnItemsMap = drawnItems?.reduce((acc, item) => {
44860
+ acc.set(item.getId(), { item, mbr: item.getMbr() });
44859
44861
  return acc;
44860
44862
  }, new Map);
44861
44863
  if (!container || !drawnItems) {
@@ -44890,11 +44892,11 @@ function createCanvasDrawer(board) {
44890
44892
  mbr.transform(currMatrix);
44891
44893
  });
44892
44894
  groups.forEach((group) => {
44893
- drawnItemsMap?.forEach(({ mbr, item: item2 }, key) => {
44894
- if ("canBeNested" in item2 && !item2.canBeNested) {
44895
+ drawnItemsMap?.forEach(({ mbr, item }, key) => {
44896
+ if ("canBeNested" in item && !item.canBeNested) {
44895
44897
  return;
44896
44898
  }
44897
- if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item2.parent !== group.getId()) && group.handleNesting(mbr)) {
44899
+ if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item.parent !== group.getId()) && group.handleNesting(mbr)) {
44898
44900
  const div = createBorderDivForItem(mbr, lastCreatedCanvas);
44899
44901
  removeHighlighted(key);
44900
44902
  highlightedDivs.set(key, div);
@@ -44955,10 +44957,10 @@ function createCanvasDrawer(board) {
44955
44957
  }
44956
44958
 
44957
44959
  // src/Selection/QuickAddButtons/quickAddHelpers.ts
44958
- function getControlPointData(item2, index2, isRichText = false) {
44959
- const itemScale = isRichText ? { x: 1, y: 1 } : item2.transformation.getScale();
44960
- const width2 = item2.getPathMbr().getWidth();
44961
- let height3 = item2.getPathMbr().getHeight();
44960
+ function getControlPointData(item, index2, isRichText = false) {
44961
+ const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
44962
+ const width2 = item.getPathMbr().getWidth();
44963
+ let height3 = item.getPathMbr().getHeight();
44962
44964
  const adjMapScaled = {
44963
44965
  0: { x: 0, y: height3 / 2 / itemScale.y },
44964
44966
  1: {
@@ -44973,7 +44975,7 @@ function getControlPointData(item2, index2, isRichText = false) {
44973
44975
  };
44974
44976
  return {
44975
44977
  pointType: "Fixed",
44976
- itemId: item2.getId(),
44978
+ itemId: item.getId(),
44977
44979
  relativeX: adjMapScaled[index2].x,
44978
44980
  relativeY: adjMapScaled[index2].y
44979
44981
  };
@@ -45108,10 +45110,10 @@ function getQuickAddButtons(selection, board) {
45108
45110
  let newHeight = height3;
45109
45111
  let itemData;
45110
45112
  if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
45111
- const item2 = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
45112
- newWidth = item2.getMbr().getWidth();
45113
- newHeight = item2.getMbr().getHeight();
45114
- itemData = item2.serialize();
45113
+ const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
45114
+ newWidth = item.getMbr().getWidth();
45115
+ newHeight = item.getMbr().getHeight();
45116
+ itemData = item.serialize();
45115
45117
  const { minX, minY, maxY, maxX } = offsets;
45116
45118
  offsetX = Math.min(offsetX, maxX);
45117
45119
  offsetX = Math.max(offsetX, minX);
@@ -45144,7 +45146,7 @@ function getQuickAddButtons(selection, board) {
45144
45146
  }
45145
45147
  const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
45146
45148
  let step = 1;
45147
- while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item2) => item2.itemType !== "Connector").length > 0) {
45149
+ while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item) => item.itemType !== "Connector").length > 0) {
45148
45150
  const xDirection = step % 2 === 0 ? -1 : 1;
45149
45151
  const yDirection = newItemData.itemType === "AINode" ? -1 : xDirection;
45150
45152
  newMbr.transform(new Matrix2(iterAdjustment[index2].x * xDirection * step, iterAdjustment[index2].y * yDirection * (newItemData.itemType === "AINode" ? 1 : step)));
@@ -45277,7 +45279,7 @@ function getQuickAddButtons(selection, board) {
45277
45279
  clear();
45278
45280
  return;
45279
45281
  }
45280
- const { positions, item: item2 } = position4;
45282
+ const { positions, item } = position4;
45281
45283
  const cameraMatrix = board.camera.getMatrix();
45282
45284
  const cameraMbr = board.camera.getMbr();
45283
45285
  const positionAdjustments = {
@@ -45305,7 +45307,7 @@ function getQuickAddButtons(selection, board) {
45305
45307
  };
45306
45308
  const button = document.createElement("button");
45307
45309
  button.classList.add("microboard-quickAddButton");
45308
- if (item2.itemType === "AINode" && index2 === 2) {
45310
+ if (item.itemType === "AINode" && index2 === 2) {
45309
45311
  button.classList.add("microboard-invisible");
45310
45312
  }
45311
45313
  button.classList.add(`microboard-${adjustment.rotate}`);
@@ -45321,7 +45323,7 @@ function getQuickAddButtons(selection, board) {
45321
45323
  clearTimeout(timeoutId);
45322
45324
  }
45323
45325
  if (button.isMouseDown) {
45324
- board.tools.addConnector(true, item2, pos);
45326
+ board.tools.addConnector(true, item, pos);
45325
45327
  } else {
45326
45328
  quickAddItems = undefined;
45327
45329
  selection.subject.publish(selection);
@@ -45428,11 +45430,11 @@ class AlignmentHelper {
45428
45430
  return baseThickness / (zoom / 100);
45429
45431
  }
45430
45432
  combineMBRs(items) {
45431
- return items.reduce((acc, item2, i) => {
45433
+ return items.reduce((acc, item, i) => {
45432
45434
  if (i === 0) {
45433
45435
  return acc;
45434
45436
  }
45435
- const itemMbr = item2.getPathMbr();
45437
+ const itemMbr = item.getPathMbr();
45436
45438
  return acc.combine(itemMbr);
45437
45439
  }, items[0].getMbr());
45438
45440
  }
@@ -45446,7 +45448,7 @@ class AlignmentHelper {
45446
45448
  const scale = this.board.camera.getScale();
45447
45449
  const dynamicAlignThreshold = Math.min(this.alignThreshold / scale, 8);
45448
45450
  const childrenIds = "index" in movingItem && movingItem.index ? movingItem.getChildrenIds() : [];
45449
- 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);
45451
+ 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);
45450
45452
  const verticalAlignments = new Map;
45451
45453
  const horizontalAlignments = new Map;
45452
45454
  const addVerticalAlignment = (x, minY, maxY) => {
@@ -45467,11 +45469,11 @@ class AlignmentHelper {
45467
45469
  horizontalAlignments.set(y, { minX, maxX });
45468
45470
  }
45469
45471
  };
45470
- nearbyItems.forEach((item2) => {
45471
- if (item2 === movingItem || item2.itemType === "Comment") {
45472
+ nearbyItems.forEach((item) => {
45473
+ if (item === movingItem || item.itemType === "Comment") {
45472
45474
  return;
45473
45475
  }
45474
- const itemMbr = item2.itemType === "Shape" ? item2.getPath().getMbr() : item2.getMbr();
45476
+ const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
45475
45477
  const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
45476
45478
  const centerXItem = (itemMbr.left + itemMbr.right) / 2;
45477
45479
  const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
@@ -45738,20 +45740,20 @@ class AlignmentHelper {
45738
45740
  }
45739
45741
  return false;
45740
45742
  }
45741
- translateItems(item2, x, y, timeStamp) {
45743
+ translateItems(item, x, y, timeStamp) {
45742
45744
  if (this.canvasDrawer.getLastCreatedCanvas()) {
45743
45745
  return;
45744
45746
  }
45745
- if (Array.isArray(item2)) {
45747
+ if (Array.isArray(item)) {
45746
45748
  const translation = this.board.selection.getManyItemsTranslation(x, y);
45747
45749
  this.board.selection.transformMany(translation, timeStamp);
45748
45750
  return;
45749
45751
  }
45750
- if (item2.itemType === "Frame") {
45752
+ if (item.itemType === "Frame") {
45751
45753
  const translation = this.board.selection.getManyItemsTranslation(x, y);
45752
45754
  this.board.selection.transformMany(translation, timeStamp);
45753
45755
  } else {
45754
- const id = item2.getId();
45756
+ const id = item.getId();
45755
45757
  const transformMap = {};
45756
45758
  transformMap[id] = {
45757
45759
  class: "Transformation",
@@ -45879,12 +45881,12 @@ class Select extends Tool {
45879
45881
  this.debounceUpd.setFalse();
45880
45882
  this.snapLines = { verticalLines: [], horizontalLines: [] };
45881
45883
  }
45882
- handleSnapping(item2) {
45884
+ handleSnapping(item) {
45883
45885
  if (this.board.keyboard.isShift) {
45884
45886
  return false;
45885
45887
  }
45886
- const increasedSnapThreshold = Array.isArray(item2) ? 40 : 35;
45887
- this.isSnapped = this.alignmentHelper.snapToClosestLine(item2, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
45888
+ const increasedSnapThreshold = Array.isArray(item) ? 40 : 35;
45889
+ this.isSnapped = this.alignmentHelper.snapToClosestLine(item, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
45888
45890
  if (this.isSnapped) {
45889
45891
  if (!this.snapCursorPos) {
45890
45892
  this.snapCursorPos = new Point(this.board.pointer.point.x, this.board.pointer.point.y);
@@ -45894,10 +45896,10 @@ class Select extends Tool {
45894
45896
  if ((cursorDiffX > increasedSnapThreshold || cursorDiffY > increasedSnapThreshold) && this.initialCursorPos) {
45895
45897
  this.isSnapped = false;
45896
45898
  this.snapCursorPos = null;
45897
- const itemCenter = Array.isArray(item2) ? this.alignmentHelper.combineMBRs(item2).getCenter() : item2.getMbr().getCenter();
45899
+ const itemCenter = Array.isArray(item) ? this.alignmentHelper.combineMBRs(item).getCenter() : item.getMbr().getCenter();
45898
45900
  const translateX = this.board.pointer.point.x - this.initialCursorPos.x - itemCenter.x;
45899
45901
  const translateY = this.board.pointer.point.y - this.initialCursorPos.y - itemCenter.y;
45900
- this.alignmentHelper.translateItems(item2, translateX, translateY, this.beginTimeStamp);
45902
+ this.alignmentHelper.translateItems(item, translateX, translateY, this.beginTimeStamp);
45901
45903
  }
45902
45904
  }
45903
45905
  return false;
@@ -45947,10 +45949,10 @@ class Select extends Tool {
45947
45949
  angleDiff = angleDiff < 0 ? angleDiff + 360 : angleDiff;
45948
45950
  return Math.min(angleDiff, 360 - angleDiff);
45949
45951
  }
45950
- handleShiftGuidelines(item2, mousePosition) {
45951
- if (item2) {
45952
+ handleShiftGuidelines(item, mousePosition) {
45953
+ if (item) {
45952
45954
  if (!this.originalCenter) {
45953
- this.originalCenter = Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().copy() : item2.getMbr().getCenter().copy();
45955
+ this.originalCenter = Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().copy() : item.getMbr().getCenter().copy();
45954
45956
  this.guidelines = this.alignmentHelper.generateGuidelines(this.originalCenter).lines;
45955
45957
  }
45956
45958
  this.mainLine = new Line(this.originalCenter, mousePosition);
@@ -45971,13 +45973,13 @@ class Select extends Tool {
45971
45973
  const newEndX = this.originalCenter.x + snapDirectionX * mainLineLength;
45972
45974
  const newEndY = this.originalCenter.y + snapDirectionY * mainLineLength;
45973
45975
  const threshold = Infinity;
45974
- const translateX = newEndX - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().x : item2.getMbr().getCenter().x);
45975
- const translateY = newEndY - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().y : item2.getMbr().getCenter().y);
45976
- if (Array.isArray(item2)) {
45976
+ const translateX = newEndX - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().x : item.getMbr().getCenter().x);
45977
+ const translateY = newEndY - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().y : item.getMbr().getCenter().y);
45978
+ if (Array.isArray(item)) {
45977
45979
  const translation = this.board.selection.getManyItemsTranslation(translateX, translateY);
45978
45980
  this.board.selection.transformMany(translation, this.beginTimeStamp);
45979
45981
  } else {
45980
- item2.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
45982
+ item.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
45981
45983
  }
45982
45984
  }
45983
45985
  }
@@ -46020,7 +46022,7 @@ class Select extends Tool {
46020
46022
  return false;
46021
46023
  }
46022
46024
  this.isDownOnBoard = hover.length === 0;
46023
- this.isDrawingRectangle = hover.filter((item2) => !(item2 instanceof Frame2)).length === 0 && hover.filter((item2) => item2 instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
46025
+ this.isDrawingRectangle = hover.filter((item) => !(item instanceof Frame2)).length === 0 && hover.filter((item) => item instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
46024
46026
  if (this.isDrawingRectangle) {
46025
46027
  const { x, y } = pointer.point;
46026
46028
  this.line = new Line(new Point(x, y), new Point(x, y));
@@ -46040,7 +46042,7 @@ class Select extends Tool {
46040
46042
  });
46041
46043
  return false;
46042
46044
  }
46043
- const isHoverLocked = hover.every((item2) => item2.transformation.isLocked);
46045
+ const isHoverLocked = hover.every((item) => item.transformation.isLocked);
46044
46046
  if (isHoverLocked) {
46045
46047
  return false;
46046
46048
  }
@@ -46174,7 +46176,7 @@ class Select extends Tool {
46174
46176
  const translation = selection.getManyItemsTranslation(x, y);
46175
46177
  const translationKeys = Object.keys(translation);
46176
46178
  const commentsSet = new Set(this.board.items.getComments().map((comment2) => comment2.getId()));
46177
- if (translationKeys.filter((item2) => !commentsSet.has(item2)).length > 10) {
46179
+ if (translationKeys.filter((item) => !commentsSet.has(item)).length > 10) {
46178
46180
  const selectedMbr = this.board.selection.getMbr()?.copy();
46179
46181
  const sumMbr = this.canvasDrawer.countSumMbr(translation);
46180
46182
  if (sumMbr) {
@@ -46201,7 +46203,7 @@ class Select extends Tool {
46201
46203
  return false;
46202
46204
  }
46203
46205
  const draggingMbr = draggingItem.getMbr();
46204
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item2) => item2 instanceof Frame2);
46206
+ const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
46205
46207
  frames.forEach((frame) => {
46206
46208
  if (frame.handleNesting(draggingItem)) {
46207
46209
  this.nestingHighlighter.add(frame, draggingItem);
@@ -46211,7 +46213,7 @@ class Select extends Tool {
46211
46213
  });
46212
46214
  }
46213
46215
  const hover = items.getUnderPointer();
46214
- this.isHoverUnselectedItem = hover.filter((item2) => item2.itemType === "Placeholder").length === 1;
46216
+ this.isHoverUnselectedItem = hover.filter((item) => item.itemType === "Placeholder").length === 1;
46215
46217
  if (this.isHoverUnselectedItem && !this.isDraggingUnselectedItem && selection.getContext() === "None") {
46216
46218
  selection.setContext("HoverUnderPointer");
46217
46219
  return false;
@@ -46255,15 +46257,15 @@ class Select extends Tool {
46255
46257
  }
46256
46258
  }
46257
46259
  updateFramesNesting(selectionMbr, selection) {
46258
- 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));
46259
- const draggingFramesIds = selection.list().filter((item2) => item2 instanceof Frame2).map((frame) => frame.getId());
46260
- selection.list().forEach((item2) => {
46261
- if (!(item2 instanceof Frame2) && !draggingFramesIds.includes(item2.parent)) {
46260
+ 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));
46261
+ const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
46262
+ selection.list().forEach((item) => {
46263
+ if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
46262
46264
  frames.forEach((frame) => {
46263
- if (frame.handleNesting(item2)) {
46264
- this.nestingHighlighter.add(frame, item2);
46265
+ if (frame.handleNesting(item)) {
46266
+ this.nestingHighlighter.add(frame, item);
46265
46267
  } else {
46266
- this.nestingHighlighter.remove(item2);
46268
+ this.nestingHighlighter.remove(item);
46267
46269
  }
46268
46270
  });
46269
46271
  }
@@ -46355,7 +46357,7 @@ class Select extends Tool {
46355
46357
  const childrenIds = underPointer.getChildrenIds();
46356
46358
  console.log("UNDERPOINTER", underPointer);
46357
46359
  console.log("CHILDREN", childrenIds);
46358
- const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => childrenIds && childrenIds.includes(item2.getId()));
46360
+ const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => childrenIds && childrenIds.includes(item.getId()));
46359
46361
  this.board.selection.add(itemsInFrame);
46360
46362
  }
46361
46363
  this.board.selection.setContext("EditUnderPointer");
@@ -46595,8 +46597,8 @@ class ShapeTool extends CustomTool {
46595
46597
  resizeType = "leftBottom";
46596
46598
  bounds = new Mbr;
46597
46599
  isDown = false;
46598
- constructor(board, name, item2, settings) {
46599
- super(board, name, item2);
46600
+ constructor(board, name, item, settings) {
46601
+ super(board, name, item);
46600
46602
  this.settings = settings;
46601
46603
  this.setCursor();
46602
46604
  }
@@ -46679,8 +46681,8 @@ class ShapeTool extends CustomTool {
46679
46681
 
46680
46682
  class StickerTool extends CustomTool {
46681
46683
  settings;
46682
- constructor(board, name, item2, settings) {
46683
- super(board, name, item2);
46684
+ constructor(board, name, item, settings) {
46685
+ super(board, name, item);
46684
46686
  this.settings = settings;
46685
46687
  this.setCursor();
46686
46688
  }
@@ -46986,7 +46988,7 @@ class Tools extends ToolContext {
46986
46988
  this.subject.publish(this);
46987
46989
  }
46988
46990
  sortFrames() {
46989
- const frames = this.board.items.listAll().filter((item2) => item2 instanceof Frame2);
46991
+ const frames = this.board.items.listAll().filter((item) => item instanceof Frame2);
46990
46992
  const sortedFrames = frames.sort((fr1, fr2) => {
46991
46993
  const mbr1 = fr1.getMbr();
46992
46994
  const mbr2 = fr2.getMbr();
@@ -47212,24 +47214,24 @@ function validateGroupData(groupData) {
47212
47214
  }
47213
47215
  // src/Items/RegisterItem.ts
47214
47216
  function registerItem({
47215
- item: item2,
47217
+ item,
47216
47218
  defaultData: defaultData2,
47217
47219
  toolData
47218
47220
  }) {
47219
47221
  const { itemType } = defaultData2;
47220
- itemFactories[itemType] = createItemFactory(item2, defaultData2);
47222
+ itemFactories[itemType] = createItemFactory(item, defaultData2);
47221
47223
  itemValidators[itemType] = createItemValidator(defaultData2);
47222
47224
  if (toolData) {
47223
47225
  registeredTools[toolData.name] = toolData.tool;
47224
47226
  }
47225
47227
  itemCommandFactories[itemType] = createItemCommandFactory(itemType);
47226
47228
  }
47227
- function createItemFactory(item2, defaultData2) {
47229
+ function createItemFactory(item, defaultData2) {
47228
47230
  return function itemFactory(id, data, board) {
47229
47231
  if (data.itemType !== defaultData2.itemType) {
47230
47232
  throw new Error(`Invalid data for ${defaultData2.itemType}`);
47231
47233
  }
47232
- return new item2(board, id, defaultData2).setId(id).deserialize(data);
47234
+ return new item(board, id, defaultData2).setId(id).deserialize(data);
47233
47235
  };
47234
47236
  }
47235
47237
  function createItemValidator(defaultData2) {
@@ -47244,7 +47246,7 @@ function createItemValidator(defaultData2) {
47244
47246
  }
47245
47247
  function createItemCommandFactory(itemType) {
47246
47248
  return function itemCommandFactory(items, operation) {
47247
- return new BaseCommand(items.filter((item2) => item2.itemType === itemType), operation);
47249
+ return new BaseCommand(items.filter((item) => item.itemType === itemType), operation);
47248
47250
  };
47249
47251
  }
47250
47252
  // src/Items/Examples/Star/AddStar.ts
@@ -48269,8 +48271,8 @@ class Camera {
48269
48271
  this.observableItem = null;
48270
48272
  }
48271
48273
  }
48272
- subscribeToItem(item2) {
48273
- this.observableItem = item2;
48274
+ subscribeToItem(item) {
48275
+ this.observableItem = item;
48274
48276
  this.observableItem.subject.subscribe(this.observeItem);
48275
48277
  }
48276
48278
  observeItem = () => {
@@ -48496,7 +48498,7 @@ class Camera {
48496
48498
  }
48497
48499
  addToView(mbr, inView) {
48498
48500
  if (!mbr.isEnclosedBy(this.getMbr())) {
48499
- this.viewRectangle(inView.reduce((acc, item2) => acc.combine(item2.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
48501
+ this.viewRectangle(inView.reduce((acc, item) => acc.combine(item.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
48500
48502
  }
48501
48503
  }
48502
48504
  viewRectangle(mbr, offsetInPercent = 10, duration = 500) {
@@ -50105,8 +50107,8 @@ class Presence {
50105
50107
  <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}"/>
50106
50108
  </svg>`;
50107
50109
  }
50108
- renderItemMbr(context, item2, color2, customScale) {
50109
- const mbr = item2.getMbr();
50110
+ renderItemMbr(context, item, color2, customScale) {
50111
+ const mbr = item.getMbr();
50110
50112
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
50111
50113
  mbr.borderColor = color2;
50112
50114
  mbr.render(context);
@@ -50246,8 +50248,8 @@ class Presence {
50246
50248
  selectionMbr.strokeWidth = 1 / context.matrix.scaleX;
50247
50249
  selectionMbr.borderColor = selection.color;
50248
50250
  selectionMbr.render(context);
50249
- for (const item2 of selection.selection) {
50250
- this.renderItemMbr(context, item2, selection.color);
50251
+ for (const item of selection.selection) {
50252
+ this.renderItemMbr(context, item, selection.color);
50251
50253
  }
50252
50254
  }
50253
50255
  }
@@ -50280,14 +50282,14 @@ class SelectionItems {
50280
50282
  items = new Map;
50281
50283
  add(value) {
50282
50284
  if (Array.isArray(value)) {
50283
- value.forEach((item2) => this.items.set(item2.getId(), item2));
50285
+ value.forEach((item) => this.items.set(item.getId(), item));
50284
50286
  } else {
50285
50287
  this.items.set(value.getId(), value);
50286
50288
  }
50287
50289
  }
50288
50290
  remove(value) {
50289
50291
  if (Array.isArray(value)) {
50290
- value.forEach((item2) => this.items.delete(item2.getId()));
50292
+ value.forEach((item) => this.items.delete(item.getId()));
50291
50293
  } else {
50292
50294
  this.items.delete(value.getId());
50293
50295
  }
@@ -50317,8 +50319,8 @@ class SelectionItems {
50317
50319
  if (this.isEmpty()) {
50318
50320
  return false;
50319
50321
  }
50320
- for (const item2 of this.items.values()) {
50321
- if (item2.itemType !== "RichText") {
50322
+ for (const item of this.items.values()) {
50323
+ if (item.itemType !== "RichText") {
50322
50324
  return false;
50323
50325
  }
50324
50326
  }
@@ -50328,14 +50330,14 @@ class SelectionItems {
50328
50330
  if (this.isEmpty()) {
50329
50331
  return false;
50330
50332
  }
50331
- return Array.from(this.items).every(([, item2]) => item2.itemType === itemType);
50333
+ return Array.from(this.items).every(([, item]) => item.itemType === itemType);
50332
50334
  }
50333
50335
  isItemTypes(itemTypes) {
50334
50336
  if (this.isEmpty()) {
50335
50337
  return false;
50336
50338
  }
50337
- for (const item2 of this.items.values()) {
50338
- if (!itemTypes.includes(item2.itemType)) {
50339
+ for (const item of this.items.values()) {
50340
+ if (!itemTypes.includes(item.itemType)) {
50339
50341
  return false;
50340
50342
  }
50341
50343
  }
@@ -50343,16 +50345,16 @@ class SelectionItems {
50343
50345
  }
50344
50346
  getItemTypes() {
50345
50347
  const itemTypes = new Set;
50346
- this.items.forEach((item2) => itemTypes.add(item2.itemType));
50348
+ this.items.forEach((item) => itemTypes.add(item.itemType));
50347
50349
  return Array.from(itemTypes);
50348
50350
  }
50349
50351
  getItemsByItemTypes(itemTypes) {
50350
- return Array.from(this.items.values()).filter((item2) => itemTypes.includes(item2.itemType));
50352
+ return Array.from(this.items.values()).filter((item) => itemTypes.includes(item.itemType));
50351
50353
  }
50352
50354
  getIdsByItemTypes(itemTypes) {
50353
50355
  const ids = [];
50354
- this.items.forEach((item2, id) => {
50355
- if (itemTypes.includes(item2.itemType)) {
50356
+ this.items.forEach((item, id) => {
50357
+ if (itemTypes.includes(item.itemType)) {
50356
50358
  ids.push(id);
50357
50359
  }
50358
50360
  });
@@ -50362,7 +50364,7 @@ class SelectionItems {
50362
50364
  return this.isSingle() ? this.items.values().next().value || null : null;
50363
50365
  }
50364
50366
  listByIds(itemIdList) {
50365
- return itemIdList.map((id) => this.items.get(id)).filter((item2) => item2 !== undefined);
50367
+ return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
50366
50368
  }
50367
50369
  ids() {
50368
50370
  return Array.from(this.items.keys());
@@ -50373,7 +50375,7 @@ class SelectionItems {
50373
50375
  return;
50374
50376
  }
50375
50377
  const mbr = items[0].getMbr();
50376
- items.slice(1).forEach((item2) => mbr.combine(item2.getMbr()));
50378
+ items.slice(1).forEach((item) => mbr.combine(item.getMbr()));
50377
50379
  return mbr;
50378
50380
  }
50379
50381
  }
@@ -50578,33 +50580,33 @@ function handleMultipleItemsResize({
50578
50580
  const translation = {};
50579
50581
  const items = itemsToResize ? itemsToResize : board.selection.items.list();
50580
50582
  board.items.getComments().forEach((comment2) => {
50581
- if (items.some((item2) => item2.getId() === comment2.getItemToFollow())) {
50583
+ if (items.some((item) => item.getId() === comment2.getItemToFollow())) {
50582
50584
  items.push(comment2);
50583
50585
  }
50584
50586
  });
50585
- for (const item2 of items) {
50586
- let itemX = item2.getMbr().left;
50587
- let itemY = item2.getMbr().top;
50588
- if (item2.itemType === "Drawing") {
50589
- itemX = item2.transformation.matrix.translateX;
50590
- itemY = item2.transformation.matrix.translateY;
50587
+ for (const item of items) {
50588
+ let itemX = item.getMbr().left;
50589
+ let itemY = item.getMbr().top;
50590
+ if (item.itemType === "Drawing") {
50591
+ itemX = item.transformation.matrix.translateX;
50592
+ itemY = item.transformation.matrix.translateY;
50591
50593
  }
50592
50594
  const deltaX = itemX - initMbr.left;
50593
50595
  const translateX = deltaX * matrix.scaleX - deltaX + matrix.translateX;
50594
50596
  const deltaY = itemY - initMbr.top;
50595
50597
  const translateY = deltaY * matrix.scaleY - deltaY + matrix.translateY;
50596
- if (item2 instanceof RichText) {
50597
- translation[item2.getId()] = getRichTextTranslation({
50598
- item: item2,
50598
+ if (item instanceof RichText) {
50599
+ translation[item.getId()] = getRichTextTranslation({
50600
+ item,
50599
50601
  isWidth,
50600
50602
  isHeight,
50601
50603
  matrix,
50602
50604
  translateX,
50603
50605
  translateY
50604
50606
  });
50605
- } else if (item2 instanceof AINode) {
50606
- translation[item2.getId()] = getAINodeTranslation({
50607
- item: item2,
50607
+ } else if (item instanceof AINode) {
50608
+ translation[item.getId()] = getAINodeTranslation({
50609
+ item,
50608
50610
  isWidth,
50609
50611
  isHeight,
50610
50612
  matrix,
@@ -50612,8 +50614,8 @@ function handleMultipleItemsResize({
50612
50614
  translateY
50613
50615
  });
50614
50616
  } else {
50615
- translation[item2.getId()] = getItemTranslation({
50616
- item: item2,
50617
+ translation[item.getId()] = getItemTranslation({
50618
+ item,
50617
50619
  isWidth,
50618
50620
  isHeight,
50619
50621
  matrix,
@@ -50626,7 +50628,7 @@ function handleMultipleItemsResize({
50626
50628
  return translation;
50627
50629
  }
50628
50630
  function getRichTextTranslation({
50629
- item: item2,
50631
+ item,
50630
50632
  isWidth,
50631
50633
  isHeight,
50632
50634
  matrix,
@@ -50634,11 +50636,11 @@ function getRichTextTranslation({
50634
50636
  translateY
50635
50637
  }) {
50636
50638
  if (isWidth) {
50637
- item2.editor.setMaxWidth(item2.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
50639
+ item.editor.setMaxWidth(item.getWidth() / item.transformation.getScale().x * matrix.scaleX);
50638
50640
  return {
50639
50641
  class: "Transformation",
50640
50642
  method: "scaleByTranslateBy",
50641
- item: [item2.getId()],
50643
+ item: [item.getId()],
50642
50644
  translate: { x: matrix.translateX, y: 0 },
50643
50645
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50644
50646
  };
@@ -50646,7 +50648,7 @@ function getRichTextTranslation({
50646
50648
  return {
50647
50649
  class: "Transformation",
50648
50650
  method: "scaleByTranslateBy",
50649
- item: [item2.getId()],
50651
+ item: [item.getId()],
50650
50652
  translate: { x: translateX, y: translateY },
50651
50653
  scale: { x: 1, y: 1 }
50652
50654
  };
@@ -50654,14 +50656,14 @@ function getRichTextTranslation({
50654
50656
  return {
50655
50657
  class: "Transformation",
50656
50658
  method: "scaleByTranslateBy",
50657
- item: [item2.getId()],
50659
+ item: [item.getId()],
50658
50660
  translate: { x: translateX, y: translateY },
50659
50661
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50660
50662
  };
50661
50663
  }
50662
50664
  }
50663
50665
  function getAINodeTranslation({
50664
- item: item2,
50666
+ item,
50665
50667
  isWidth,
50666
50668
  isHeight,
50667
50669
  matrix,
@@ -50669,11 +50671,11 @@ function getAINodeTranslation({
50669
50671
  translateY
50670
50672
  }) {
50671
50673
  if (isWidth) {
50672
- item2.text.editor.setMaxWidth(item2.text.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
50674
+ item.text.editor.setMaxWidth(item.text.getWidth() / item.transformation.getScale().x * matrix.scaleX);
50673
50675
  return {
50674
50676
  class: "Transformation",
50675
50677
  method: "scaleByTranslateBy",
50676
- item: [item2.getId()],
50678
+ item: [item.getId()],
50677
50679
  translate: { x: matrix.translateX, y: 0 },
50678
50680
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50679
50681
  };
@@ -50681,7 +50683,7 @@ function getAINodeTranslation({
50681
50683
  return {
50682
50684
  class: "Transformation",
50683
50685
  method: "scaleByTranslateBy",
50684
- item: [item2.getId()],
50686
+ item: [item.getId()],
50685
50687
  translate: { x: translateX, y: translateY },
50686
50688
  scale: { x: 1, y: 1 }
50687
50689
  };
@@ -50689,14 +50691,14 @@ function getAINodeTranslation({
50689
50691
  return {
50690
50692
  class: "Transformation",
50691
50693
  method: "scaleByTranslateBy",
50692
- item: [item2.getId()],
50694
+ item: [item.getId()],
50693
50695
  translate: { x: translateX, y: translateY },
50694
50696
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50695
50697
  };
50696
50698
  }
50697
50699
  }
50698
50700
  function getItemTranslation({
50699
- item: item2,
50701
+ item,
50700
50702
  isWidth,
50701
50703
  isHeight,
50702
50704
  matrix,
@@ -50704,22 +50706,22 @@ function getItemTranslation({
50704
50706
  translateY,
50705
50707
  isShiftPressed
50706
50708
  }) {
50707
- if (item2 instanceof Sticker && (isWidth || isHeight)) {
50709
+ if (item instanceof Sticker && (isWidth || isHeight)) {
50708
50710
  return {
50709
50711
  class: "Transformation",
50710
50712
  method: "scaleByTranslateBy",
50711
- item: [item2.getId()],
50713
+ item: [item.getId()],
50712
50714
  translate: { x: translateX, y: translateY },
50713
50715
  scale: { x: 1, y: 1 }
50714
50716
  };
50715
50717
  } else {
50716
- if (item2 instanceof Frame2 && item2.getCanChangeRatio() && isShiftPressed && item2.getFrameType() !== "Custom") {
50717
- item2.setFrameType("Custom");
50718
+ if (item instanceof Frame2 && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
50719
+ item.setFrameType("Custom");
50718
50720
  }
50719
50721
  return {
50720
50722
  class: "Transformation",
50721
50723
  method: "scaleByTranslateBy",
50722
- item: [item2.getId()],
50724
+ item: [item.getId()],
50723
50725
  translate: { x: translateX, y: translateY },
50724
50726
  scale: { x: matrix.scaleX, y: matrix.scaleY }
50725
50727
  };
@@ -50992,11 +50994,11 @@ function transformItems({
50992
50994
  setSnapCursorPos
50993
50995
  }) {
50994
50996
  const items = selection.items.list();
50995
- const includesProportionalItem = items.some((item2) => item2.itemType === "Sticker" || item2.itemType === "RichText" || item2.itemType === "AINode" || item2.itemType === "Video" || item2.itemType === "Audio");
50997
+ const includesProportionalItem = items.some((item) => item.itemType === "Sticker" || item.itemType === "RichText" || item.itemType === "AINode" || item.itemType === "Video" || item.itemType === "Audio");
50996
50998
  if (includesProportionalItem && (isWidth || isHeight)) {
50997
50999
  return null;
50998
51000
  }
50999
- const isIncludesFixedFrame = items.some((item2) => item2 instanceof Frame2 && !item2.getCanChangeRatio());
51001
+ const isIncludesFixedFrame = items.some((item) => item instanceof Frame2 && !item.getCanChangeRatio());
51000
51002
  const shouldBeProportionalResize = isIncludesFixedFrame || includesProportionalItem || isShiftPressed || !isWidth && !isHeight;
51001
51003
  const resize = shouldBeProportionalResize ? getProportionalResize(resizeType, board.pointer.point, mbr, oppositePoint) : getResize(resizeType, board.pointer.point, mbr, oppositePoint);
51002
51004
  if (canvasDrawer.getLastCreatedCanvas() && !debounceUpd.shouldUpd()) {
@@ -51074,23 +51076,23 @@ function updateFrameChildren({
51074
51076
  nestingHighlighter
51075
51077
  }) {
51076
51078
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
51077
- board.selection.items.list().forEach((item2) => {
51078
- if ("getChildrenIds" in item2 && item2.getChildrenIds()) {
51079
- const currMbr = item2.getMbr();
51079
+ board.selection.items.list().forEach((item) => {
51080
+ if ("getChildrenIds" in item && item.getChildrenIds()) {
51081
+ const currMbr = item.getMbr();
51080
51082
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
51081
51083
  itemsToCheck.forEach((currItem) => {
51082
- if (item2.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item2.getId())) {
51083
- nestingHighlighter.add(item2, currItem);
51084
+ if (item.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item.getId())) {
51085
+ nestingHighlighter.add(item, currItem);
51084
51086
  } else {
51085
51087
  nestingHighlighter.remove(currItem);
51086
51088
  }
51087
51089
  });
51088
51090
  } else {
51089
51091
  groups.forEach((group) => {
51090
- if (group.handleNesting(item2)) {
51091
- nestingHighlighter.add(group, item2);
51092
+ if (group.handleNesting(item)) {
51093
+ nestingHighlighter.add(group, item);
51092
51094
  } else {
51093
- nestingHighlighter.remove(item2);
51095
+ nestingHighlighter.remove(item);
51094
51096
  }
51095
51097
  });
51096
51098
  }
@@ -51158,9 +51160,9 @@ class Transformer extends Tool {
51158
51160
  const pointer = this.board.pointer;
51159
51161
  const camera = this.board.camera;
51160
51162
  const items = this.selection.items;
51161
- const item2 = items.getSingle();
51163
+ const item = items.getSingle();
51162
51164
  let resizeType;
51163
- if (item2 && (item2.itemType === "RichText" || item2.itemType === "Sticker")) {
51165
+ if (item && (item.itemType === "RichText" || item.itemType === "Sticker")) {
51164
51166
  resizeType = getTextResizeType(pointer.point, camera.getScale(), mbr);
51165
51167
  } else {
51166
51168
  resizeType = getResizeType(pointer.point, camera.getScale(), mbr);
@@ -51414,8 +51416,8 @@ class SelectionTransformer extends Tool {
51414
51416
  return;
51415
51417
  }
51416
51418
  if (this.selection.items.isSingle()) {
51417
- const item2 = this.selection.items.getSingle();
51418
- if (item2?.itemType === "Connector") {
51419
+ const item = this.selection.items.getSingle();
51420
+ if (item?.itemType === "Connector") {
51419
51421
  this.tool = this.connectorTransformerTool;
51420
51422
  return;
51421
51423
  } else {
@@ -51498,16 +51500,16 @@ class BoardSelection {
51498
51500
  this.quickAddButtons = getQuickAddButtons(this, board);
51499
51501
  }
51500
51502
  serialize() {
51501
- const selectedItems = this.items.list().map((item2) => item2.getId());
51503
+ const selectedItems = this.items.list().map((item) => item.getId());
51502
51504
  return JSON.stringify(selectedItems);
51503
51505
  }
51504
51506
  deserialize(serializedData) {
51505
51507
  const selectedItems = JSON.parse(serializedData);
51506
51508
  this.removeAll();
51507
51509
  selectedItems.forEach((itemId) => {
51508
- const item2 = this.board.items.getById(itemId);
51509
- if (item2) {
51510
- this.items.add(item2);
51510
+ const item = this.board.items.getById(itemId);
51511
+ if (item) {
51512
+ this.items.add(item);
51511
51513
  }
51512
51514
  });
51513
51515
  }
@@ -51585,19 +51587,19 @@ class BoardSelection {
51585
51587
  this.updateQueue.clear();
51586
51588
  safeRequestAnimationFrame(this.updateScheduledObservers);
51587
51589
  };
51588
- itemObserver = (item2) => {
51590
+ itemObserver = (item) => {
51589
51591
  if (!this.shouldPublish) {
51590
51592
  return;
51591
51593
  }
51592
51594
  this.subject.publish(this);
51593
- this.itemSubject.publish(item2);
51595
+ this.itemSubject.publish(item);
51594
51596
  };
51595
51597
  decoratedItemObserver = this.decorateObserverToScheduleUpdate(this.itemObserver);
51596
51598
  add(value) {
51597
51599
  this.items.add(value);
51598
51600
  if (Array.isArray(value)) {
51599
- for (const item2 of value) {
51600
- item2.subject.subscribe(this.itemObserver);
51601
+ for (const item of value) {
51602
+ item.subject.subscribe(this.itemObserver);
51601
51603
  }
51602
51604
  } else {
51603
51605
  value.subject.subscribe(this.itemObserver);
@@ -51606,15 +51608,15 @@ class BoardSelection {
51606
51608
  this.itemsSubject.publish([]);
51607
51609
  }
51608
51610
  addAll() {
51609
- const items = this.board.items.listAll().filter((item2) => !item2.transformation.isLocked);
51611
+ const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked);
51610
51612
  this.add(items);
51611
51613
  this.setContext("SelectByRect");
51612
51614
  }
51613
51615
  remove(value) {
51614
51616
  this.items.remove(value);
51615
51617
  if (Array.isArray(value)) {
51616
- for (const item2 of value) {
51617
- item2.subject.unsubscribe(this.itemObserver);
51618
+ for (const item of value) {
51619
+ item.subject.unsubscribe(this.itemObserver);
51618
51620
  }
51619
51621
  } else {
51620
51622
  value.subject.unsubscribe(this.itemObserver);
@@ -51708,11 +51710,11 @@ class BoardSelection {
51708
51710
  if (!this.items.isSingle()) {
51709
51711
  return;
51710
51712
  }
51711
- const item2 = this.items.getSingle();
51712
- if (!item2) {
51713
+ const item = this.items.getSingle();
51714
+ if (!item) {
51713
51715
  return;
51714
51716
  }
51715
- const text5 = item2.getRichText();
51717
+ const text5 = item.getRichText();
51716
51718
  if (!text5) {
51717
51719
  return;
51718
51720
  }
@@ -51723,7 +51725,7 @@ class BoardSelection {
51723
51725
  if (shouldReplace || moveCursorToEnd) {
51724
51726
  text5.editor.moveCursorToEndOfTheText();
51725
51727
  }
51726
- this.setTextToEdit(item2);
51728
+ this.setTextToEdit(item);
51727
51729
  this.setContext("EditTextUnderPointer");
51728
51730
  if (shouldSelect) {
51729
51731
  text5.editor.selectWholeText();
@@ -51733,13 +51735,13 @@ class BoardSelection {
51733
51735
  editUnderPointer() {
51734
51736
  this.removeAll();
51735
51737
  const stack = this.board.items.getUnderPointer();
51736
- const item2 = stack.pop();
51737
- if (item2) {
51738
- this.add(item2);
51738
+ const item = stack.pop();
51739
+ if (item) {
51740
+ this.add(item);
51739
51741
  this.setTextToEdit(undefined);
51740
- const text5 = item2.getRichText();
51742
+ const text5 = item.getRichText();
51741
51743
  if (text5) {
51742
- this.setTextToEdit(item2);
51744
+ this.setTextToEdit(item);
51743
51745
  text5.editor.selectWholeText();
51744
51746
  this.board.items.subject.publish(this.board.items);
51745
51747
  }
@@ -51748,26 +51750,26 @@ class BoardSelection {
51748
51750
  this.setContext("None");
51749
51751
  }
51750
51752
  }
51751
- setTextToEdit(item2) {
51753
+ setTextToEdit(item) {
51752
51754
  if (this.textToEdit) {
51753
51755
  this.textToEdit.updateElement();
51754
51756
  this.textToEdit.enableRender();
51755
51757
  }
51756
- if (!(item2 && item2.getRichText())) {
51758
+ if (!(item && item.getRichText())) {
51757
51759
  this.textToEdit = undefined;
51758
51760
  return;
51759
51761
  }
51760
- const text5 = item2.getRichText();
51762
+ const text5 = item.getRichText();
51761
51763
  if (!text5) {
51762
51764
  return;
51763
51765
  }
51764
51766
  if (text5.isEmpty()) {
51765
- const textColor = tempStorage.getFontColor(item2.itemType);
51766
- const textSize = tempStorage.getFontSize(item2.itemType);
51767
- const highlightColor = tempStorage.getFontHighlight(item2.itemType);
51768
- const styles = tempStorage.getFontStyles(item2.itemType);
51769
- const horizontalAlignment = tempStorage.getHorizontalAlignment(item2.itemType);
51770
- const verticalAlignment = tempStorage.getVerticalAlignment(item2.itemType);
51767
+ const textColor = tempStorage.getFontColor(item.itemType);
51768
+ const textSize = tempStorage.getFontSize(item.itemType);
51769
+ const highlightColor = tempStorage.getFontHighlight(item.itemType);
51770
+ const styles = tempStorage.getFontStyles(item.itemType);
51771
+ const horizontalAlignment = tempStorage.getHorizontalAlignment(item.itemType);
51772
+ const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
51771
51773
  if (textColor) {
51772
51774
  text5.setSelectionFontColor(textColor, "None");
51773
51775
  }
@@ -51775,7 +51777,7 @@ class BoardSelection {
51775
51777
  this.emit({
51776
51778
  class: "RichText",
51777
51779
  method: "setFontSize",
51778
- item: [item2.getId()],
51780
+ item: [item.getId()],
51779
51781
  fontSize: textSize,
51780
51782
  context: this.getContext()
51781
51783
  });
@@ -51787,10 +51789,10 @@ class BoardSelection {
51787
51789
  const stylesArr = styles;
51788
51790
  text5.setSelectionFontStyle(stylesArr, "None");
51789
51791
  }
51790
- if (horizontalAlignment && !(item2 instanceof Sticker)) {
51792
+ if (horizontalAlignment && !(item instanceof Sticker)) {
51791
51793
  text5.setSelectionHorisontalAlignment(horizontalAlignment);
51792
51794
  }
51793
- if (verticalAlignment && !(item2 instanceof Sticker)) {
51795
+ if (verticalAlignment && !(item instanceof Sticker)) {
51794
51796
  this.setVerticalAlignment(verticalAlignment);
51795
51797
  }
51796
51798
  }
@@ -51823,8 +51825,8 @@ class BoardSelection {
51823
51825
  }
51824
51826
  selectEnclosedOrCrossedBy(rect) {
51825
51827
  this.removeAll();
51826
- const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item2) => !item2.transformation.isLocked);
51827
- 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);
51828
+ const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item) => !item.transformation.isLocked);
51829
+ 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);
51828
51830
  if (list6.length !== 0) {
51829
51831
  this.add(list6);
51830
51832
  this.setContext("SelectByRect");
@@ -51838,14 +51840,14 @@ class BoardSelection {
51838
51840
  canChangeText() {
51839
51841
  return Boolean(this.items.isSingle() && this.items.getSingle()?.getRichText());
51840
51842
  }
51841
- handleItemCopy(item2, copiedItemsMap) {
51842
- const serializedData = item2.serialize(true);
51843
- const zIndex = this.board.items.index.getZIndex(item2);
51844
- if (item2.itemType === "Comment") {
51843
+ handleItemCopy(item, copiedItemsMap) {
51844
+ const serializedData = item.serialize(true);
51845
+ const zIndex = this.board.items.index.getZIndex(item);
51846
+ if (item.itemType === "Comment") {
51845
51847
  return;
51846
51848
  }
51847
- if (item2.itemType === "Connector" && serializedData.itemType === "Connector") {
51848
- const connector = item2;
51849
+ if (item.itemType === "Connector" && serializedData.itemType === "Connector") {
51850
+ const connector = item;
51849
51851
  const startPoint = connector.getStartPoint();
51850
51852
  const endPoint = connector.getEndPoint();
51851
51853
  const startItemId = startPoint.pointType !== "Board" ? startPoint.item.getId() : null;
@@ -51861,19 +51863,19 @@ class BoardSelection {
51861
51863
  serializedData.endPoint = new BoardPoint(endPoint.x, endPoint.y).serialize();
51862
51864
  }
51863
51865
  }
51864
- const textItem = item2.getRichText()?.getTextString();
51866
+ const textItem = item.getRichText()?.getTextString();
51865
51867
  const copyText = conf.i18n.t("frame.copy");
51866
51868
  const isCopyTextExist = textItem?.includes(copyText);
51867
- const isChangeCopiedFrameText = item2.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
51869
+ const isChangeCopiedFrameText = item.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
51868
51870
  if (isChangeCopiedFrameText) {
51869
51871
  const copiedFrameText = copyText + (textItem || serializedData.text?.placeholderText);
51870
- item2.getRichText()?.editor.clearText();
51871
- item2.getRichText()?.editor.addText(copiedFrameText);
51872
- serializedData.text = item2.getRichText()?.serialize();
51873
- item2.getRichText()?.editor.clearText();
51874
- item2.getRichText()?.editor.addText(textItem || "");
51872
+ item.getRichText()?.editor.clearText();
51873
+ item.getRichText()?.editor.addText(copiedFrameText);
51874
+ serializedData.text = item.getRichText()?.serialize();
51875
+ item.getRichText()?.editor.clearText();
51876
+ item.getRichText()?.editor.addText(textItem || "");
51875
51877
  }
51876
- copiedItemsMap[item2.getId()] = { ...serializedData, zIndex };
51878
+ copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
51877
51879
  }
51878
51880
  copy(skipImageBlobCopy) {
51879
51881
  const copiedItemsMap = {};
@@ -51882,12 +51884,12 @@ class BoardSelection {
51882
51884
  this.handleItemCopy(single, copiedItemsMap);
51883
51885
  return { imageElement: single.image, imageData: copiedItemsMap };
51884
51886
  }
51885
- this.list().forEach((item2) => {
51886
- this.handleItemCopy(item2, copiedItemsMap);
51887
+ this.list().forEach((item) => {
51888
+ this.handleItemCopy(item, copiedItemsMap);
51887
51889
  });
51888
- this.list().flatMap((item2) => {
51889
- if (item2 instanceof Frame2) {
51890
- return item2.getChildrenIds();
51890
+ this.list().flatMap((item) => {
51891
+ if (item instanceof Frame2) {
51892
+ return item.getChildrenIds();
51891
51893
  }
51892
51894
  return [];
51893
51895
  }).forEach((id) => {
@@ -51915,11 +51917,11 @@ class BoardSelection {
51915
51917
  let maxRichText = null;
51916
51918
  let minRichText = null;
51917
51919
  const itemType = items[0].itemType;
51918
- for (const item2 of items) {
51919
- if (item2.itemType !== itemType) {
51920
+ for (const item of items) {
51921
+ if (item.itemType !== itemType) {
51920
51922
  return null;
51921
51923
  }
51922
- const richText = item2.getRichText();
51924
+ const richText = item.getRichText();
51923
51925
  if (richText) {
51924
51926
  if (!maxRichText || richText.getFontSize() > maxRichText.getFontSize()) {
51925
51927
  maxRichText = richText;
@@ -52025,22 +52027,22 @@ class BoardSelection {
52025
52027
  }
52026
52028
  nestSelectedItems(unselectedItem, checkFrames = true) {
52027
52029
  const selected = this.board.selection.items.list();
52028
- if (unselectedItem && !selected.find((item2) => item2.getId() === unselectedItem.getId())) {
52030
+ if (unselectedItem && !selected.find((item) => item.getId() === unselectedItem.getId())) {
52029
52031
  selected.push(unselectedItem);
52030
52032
  }
52031
- const selectedMbr = selected.reduce((acc, item2) => {
52033
+ const selectedMbr = selected.reduce((acc, item) => {
52032
52034
  if (!acc) {
52033
- return item2.getMbr();
52035
+ return item.getMbr();
52034
52036
  }
52035
- return acc.combine(item2.getMbr());
52037
+ return acc.combine(item.getMbr());
52036
52038
  }, undefined);
52037
52039
  if (selectedMbr) {
52038
- const selectedMap = Object.fromEntries(selected.map((item2) => [item2.getId(), { item: item2, nested: false }]));
52040
+ const selectedMap = Object.fromEntries(selected.map((item) => [item.getId(), { item, nested: false }]));
52039
52041
  const enclosedGroups = this.board.items.getGroupItemsEnclosedOrCrossed(selectedMbr?.left, selectedMbr?.top, selectedMbr?.right, selectedMbr?.bottom);
52040
52042
  enclosedGroups.forEach((group) => {
52041
- selected.forEach((item2) => {
52042
- if (group.handleNesting(item2)) {
52043
- selectedMap[item2.getId()].nested = group;
52043
+ selected.forEach((item) => {
52044
+ if (group.handleNesting(item)) {
52045
+ selectedMap[item.getId()].nested = group;
52044
52046
  }
52045
52047
  });
52046
52048
  });
@@ -52064,11 +52066,11 @@ class BoardSelection {
52064
52066
  if (childrenIds && checkFrames) {
52065
52067
  const currGroup = val.item;
52066
52068
  const currMbr = currGroup.getMbr();
52067
- const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item2) => !!item2);
52068
- const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item2) => item2.parent === "Board" || item2.parent === currGroup.getId());
52069
+ const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
52070
+ const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
52069
52071
  const uniqueItems = new Set;
52070
- const toCheck = [...children, ...underGroup].filter((item2) => {
52071
- const id = item2.getId();
52072
+ const toCheck = [...children, ...underGroup].filter((item) => {
52073
+ const id = item.getId();
52072
52074
  if (uniqueItems.has(id)) {
52073
52075
  return false;
52074
52076
  }
@@ -52109,8 +52111,8 @@ class BoardSelection {
52109
52111
  addItemToTranslation(childId);
52110
52112
  }
52111
52113
  }
52112
- const createTranslationWithComments = (item2) => {
52113
- const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item2.getId());
52114
+ const createTranslationWithComments = (item) => {
52115
+ const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item.getId());
52114
52116
  for (const comment2 of followedComments) {
52115
52117
  translation[comment2.getId()] = {
52116
52118
  class: "Transformation",
@@ -52171,21 +52173,21 @@ class BoardSelection {
52171
52173
  newData: { borderColor }
52172
52174
  };
52173
52175
  const operations2 = {};
52174
- this.items.list().forEach((item2) => {
52175
- if (!operations2[item2.itemType]) {
52176
+ this.items.list().forEach((item) => {
52177
+ if (!operations2[item.itemType]) {
52176
52178
  const operationCopy = { ...operation };
52177
- if (item2.itemType === "Connector") {
52179
+ if (item.itemType === "Connector") {
52178
52180
  operationCopy.method = "setLineColor";
52179
52181
  operationCopy.lineColor = borderColor;
52180
- } else if (item2.itemType === "Drawing") {
52182
+ } else if (item.itemType === "Drawing") {
52181
52183
  operationCopy.method = "setStrokeColor";
52182
52184
  operationCopy.color = borderColor;
52183
52185
  } else {
52184
52186
  operationCopy.borderColor = borderColor;
52185
52187
  }
52186
- operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
52188
+ operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
52187
52189
  } else {
52188
- operations2[item2.itemType].item.push(item2.getId());
52190
+ operations2[item.itemType].item.push(item.getId());
52189
52191
  }
52190
52192
  });
52191
52193
  Object.values(operations2).forEach((op) => {
@@ -52200,13 +52202,13 @@ class BoardSelection {
52200
52202
  newData: { borderWidth: width2 }
52201
52203
  };
52202
52204
  const operations2 = {};
52203
- this.items.list().forEach((item2) => {
52204
- if (!operations2[item2.itemType]) {
52205
+ this.items.list().forEach((item) => {
52206
+ if (!operations2[item.itemType]) {
52205
52207
  const operationCopy = { ...operation };
52206
- if (item2.itemType === "Connector") {
52208
+ if (item.itemType === "Connector") {
52207
52209
  operationCopy.method = "setLineWidth";
52208
52210
  operationCopy.lineWidth = width2;
52209
- } else if (item2.itemType === "Drawing") {
52211
+ } else if (item.itemType === "Drawing") {
52210
52212
  operationCopy.method = "setStrokeWidth";
52211
52213
  operationCopy.width = width2;
52212
52214
  operationCopy.prevWidth = this.getStrokeWidth();
@@ -52214,9 +52216,9 @@ class BoardSelection {
52214
52216
  operationCopy.borderWidth = width2;
52215
52217
  operationCopy.prevBorderWidth = this.getStrokeWidth();
52216
52218
  }
52217
- operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
52219
+ operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
52218
52220
  } else {
52219
- operations2[item2.itemType].item.push(item2.getId());
52221
+ operations2[item.itemType].item.push(item.getId());
52220
52222
  }
52221
52223
  });
52222
52224
  Object.values(operations2).forEach((op) => {
@@ -52232,11 +52234,11 @@ class BoardSelection {
52232
52234
  newData: { backgroundColor }
52233
52235
  };
52234
52236
  const operations2 = {};
52235
- this.items.list().forEach((item2) => {
52236
- if (!operations2[item2.itemType]) {
52237
- operations2[item2.itemType] = { ...operation, class: item2.itemType, item: [item2.getId()] };
52237
+ this.items.list().forEach((item) => {
52238
+ if (!operations2[item.itemType]) {
52239
+ operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
52238
52240
  } else {
52239
- operations2[item2.itemType].item.push(item2.getId());
52241
+ operations2[item.itemType].item.push(item.getId());
52240
52242
  }
52241
52243
  });
52242
52244
  Object.values(operations2).forEach((op) => {
@@ -52260,9 +52262,9 @@ class BoardSelection {
52260
52262
  }
52261
52263
  setFrameType(frameType) {
52262
52264
  const items = this.items.list();
52263
- items.forEach((item2) => {
52264
- if (item2 instanceof Frame2) {
52265
- item2.setFrameType(frameType);
52265
+ items.forEach((item) => {
52266
+ if (item instanceof Frame2) {
52267
+ item.setFrameType(frameType);
52266
52268
  }
52267
52269
  });
52268
52270
  }
@@ -52281,21 +52283,21 @@ class BoardSelection {
52281
52283
  setFontSize(size) {
52282
52284
  const fontSize = size === "auto" ? size : toFiniteNumber(size);
52283
52285
  const itemsOps = [];
52284
- for (const item2 of this.items.list()) {
52285
- const text5 = item2.getRichText();
52286
+ for (const item of this.items.list()) {
52287
+ const text5 = item.getRichText();
52286
52288
  if (!text5) {
52287
52289
  continue;
52288
52290
  }
52289
52291
  const ops = text5.setSelectionFontSize(fontSize, this.context);
52290
52292
  itemsOps.push({
52291
- item: item2.getId(),
52293
+ item: item.getId(),
52292
52294
  selection: text5.editor.getSelection(),
52293
52295
  ops
52294
52296
  });
52295
- if (item2.itemType === "Sticker" && fontSize === "auto") {
52296
- tempStorage.remove(`fontSize_${item2.itemType}`);
52297
- } else if (item2.itemType !== "AINode") {
52298
- tempStorage.setFontSize(item2.itemType, fontSize);
52297
+ if (item.itemType === "Sticker" && fontSize === "auto") {
52298
+ tempStorage.remove(`fontSize_${item.itemType}`);
52299
+ } else if (item.itemType !== "AINode") {
52300
+ tempStorage.setFontSize(item.itemType, fontSize);
52299
52301
  }
52300
52302
  }
52301
52303
  const emptyOps = itemsOps.filter((op) => !op.ops.length);
@@ -52318,8 +52320,8 @@ class BoardSelection {
52318
52320
  setFontStyle(fontStyle) {
52319
52321
  const isMultiple = !this.items.isSingle();
52320
52322
  const itemsOps = [];
52321
- for (const item2 of this.items.list()) {
52322
- const text5 = item2.getRichText();
52323
+ for (const item of this.items.list()) {
52324
+ const text5 = item.getRichText();
52323
52325
  if (!text5) {
52324
52326
  continue;
52325
52327
  }
@@ -52328,12 +52330,12 @@ class BoardSelection {
52328
52330
  }
52329
52331
  const ops = text5.setSelectionFontStyle(fontStyle, this.context);
52330
52332
  itemsOps.push({
52331
- item: item2.getId(),
52333
+ item: item.getId(),
52332
52334
  selection: text5.editor.getSelection(),
52333
52335
  ops
52334
52336
  });
52335
- if (item2.itemType !== "AINode") {
52336
- tempStorage.setFontStyles(item2.itemType, text5.getFontStyles());
52337
+ if (item.itemType !== "AINode") {
52338
+ tempStorage.setFontStyles(item.itemType, text5.getFontStyles());
52337
52339
  }
52338
52340
  }
52339
52341
  this.emitApplied({
@@ -52345,8 +52347,8 @@ class BoardSelection {
52345
52347
  setFontColor(fontColor) {
52346
52348
  const isMultiple = !this.items.isSingle();
52347
52349
  const itemsOps = [];
52348
- for (const item2 of this.items.list()) {
52349
- const text5 = item2.getRichText();
52350
+ for (const item of this.items.list()) {
52351
+ const text5 = item.getRichText();
52350
52352
  if (!text5) {
52351
52353
  continue;
52352
52354
  }
@@ -52355,11 +52357,11 @@ class BoardSelection {
52355
52357
  }
52356
52358
  const ops = text5.setSelectionFontColor(fontColor, this.context);
52357
52359
  itemsOps.push({
52358
- item: item2.getId(),
52360
+ item: item.getId(),
52359
52361
  selection: text5.editor.getSelection(),
52360
52362
  ops
52361
52363
  });
52362
- tempStorage.setFontColor(item2.itemType, fontColor);
52364
+ tempStorage.setFontColor(item.itemType, fontColor);
52363
52365
  }
52364
52366
  this.emitApplied({
52365
52367
  class: "RichText",
@@ -52388,8 +52390,8 @@ class BoardSelection {
52388
52390
  setFontHighlight(fontHighlight) {
52389
52391
  const isMultiple = !this.items.isSingle();
52390
52392
  const itemsOps = [];
52391
- for (const item2 of this.items.list()) {
52392
- const text5 = item2.getRichText();
52393
+ for (const item of this.items.list()) {
52394
+ const text5 = item.getRichText();
52393
52395
  if (!text5) {
52394
52396
  continue;
52395
52397
  }
@@ -52398,12 +52400,12 @@ class BoardSelection {
52398
52400
  }
52399
52401
  const ops = text5.setSelectionFontHighlight(fontHighlight, this.context);
52400
52402
  itemsOps.push({
52401
- item: item2.getId(),
52403
+ item: item.getId(),
52402
52404
  selection: text5.editor.getSelection(),
52403
52405
  ops
52404
52406
  });
52405
- if (item2.itemType !== "AINode") {
52406
- tempStorage.setFontHighlight(item2.itemType, fontHighlight);
52407
+ if (item.itemType !== "AINode") {
52408
+ tempStorage.setFontHighlight(item.itemType, fontHighlight);
52407
52409
  }
52408
52410
  }
52409
52411
  this.emitApplied({
@@ -52415,8 +52417,8 @@ class BoardSelection {
52415
52417
  setHorisontalAlignment(horisontalAlignment) {
52416
52418
  const isMultiple = !this.items.isSingle();
52417
52419
  const itemsOps = [];
52418
- for (const item2 of this.items.list()) {
52419
- const text5 = item2.getRichText();
52420
+ for (const item of this.items.list()) {
52421
+ const text5 = item.getRichText();
52420
52422
  if (!text5) {
52421
52423
  continue;
52422
52424
  }
@@ -52425,11 +52427,11 @@ class BoardSelection {
52425
52427
  }
52426
52428
  const ops = text5.setSelectionHorisontalAlignment(horisontalAlignment, this.context);
52427
52429
  itemsOps.push({
52428
- item: item2.getId(),
52430
+ item: item.getId(),
52429
52431
  selection: text5.editor.getSelection(),
52430
52432
  ops
52431
52433
  });
52432
- tempStorage.setHorizontalAlignment(item2.itemType, horisontalAlignment);
52434
+ tempStorage.setHorizontalAlignment(item.itemType, horisontalAlignment);
52433
52435
  }
52434
52436
  this.emitApplied({
52435
52437
  class: "RichText",
@@ -52445,23 +52447,23 @@ class BoardSelection {
52445
52447
  verticalAlignment
52446
52448
  });
52447
52449
  if (this.items.isSingle()) {
52448
- const item2 = this.items.getSingle();
52449
- if (!item2) {
52450
+ const item = this.items.getSingle();
52451
+ if (!item) {
52450
52452
  return;
52451
52453
  }
52452
- const text5 = item2.getRichText();
52454
+ const text5 = item.getRichText();
52453
52455
  if (!text5) {
52454
52456
  return;
52455
52457
  }
52456
- tempStorage.setVerticalAlignment(item2.itemType, verticalAlignment);
52457
- if (item2 instanceof RichText) {
52458
- item2.setEditorFocus(this.context);
52458
+ tempStorage.setVerticalAlignment(item.itemType, verticalAlignment);
52459
+ if (item instanceof RichText) {
52460
+ item.setEditorFocus(this.context);
52459
52461
  }
52460
52462
  text5.setEditorFocus(this.context);
52461
52463
  }
52462
52464
  }
52463
52465
  removeFromBoard() {
52464
- const isLocked = this.items.list().some((item2) => item2.transformation.isLocked);
52466
+ const isLocked = this.items.list().some((item) => item.transformation.isLocked);
52465
52467
  if (isLocked) {
52466
52468
  return;
52467
52469
  }
@@ -52484,7 +52486,7 @@ class BoardSelection {
52484
52486
  }
52485
52487
  getIsLockedSelection() {
52486
52488
  const items = this.list();
52487
- return items.some((item2) => item2.transformation.isLocked);
52489
+ return items.some((item) => item.transformation.isLocked);
52488
52490
  }
52489
52491
  isLocked() {
52490
52492
  return false;
@@ -52511,9 +52513,9 @@ class BoardSelection {
52511
52513
  }
52512
52514
  async duplicate() {
52513
52515
  const mediaIds = [];
52514
- this.items.list().forEach((item2) => {
52515
- if ("getStorageId" in item2) {
52516
- const storageId = item2.getStorageId();
52516
+ this.items.list().forEach((item) => {
52517
+ if ("getStorageId" in item) {
52518
+ const storageId = item.getStorageId();
52517
52519
  if (storageId) {
52518
52520
  mediaIds.push(storageId);
52519
52521
  }
@@ -52523,7 +52525,7 @@ class BoardSelection {
52523
52525
  if (!canDuplicate) {
52524
52526
  return;
52525
52527
  }
52526
- const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item2]) => item2.itemType !== "Group"));
52528
+ const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item]) => item.itemType !== "Group"));
52527
52529
  this.board.duplicate(filteredItemMap);
52528
52530
  this.setContext("EditUnderPointer");
52529
52531
  }
@@ -52557,10 +52559,10 @@ class BoardSelection {
52557
52559
  lastAssistantMessageId
52558
52560
  };
52559
52561
  }
52560
- renderItemMbr(context, item2, customScale) {
52561
- const mbr = item2.getMbr();
52562
+ renderItemMbr(context, item, customScale) {
52563
+ const mbr = item.getMbr();
52562
52564
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
52563
- const selectionColor = item2.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
52565
+ const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
52564
52566
  mbr.borderColor = selectionColor;
52565
52567
  mbr.render(context);
52566
52568
  }
@@ -52576,8 +52578,8 @@ class BoardSelection {
52576
52578
  }
52577
52579
  if (!this.transformationRenderBlock) {
52578
52580
  if (this.shouldRenderItemsMbr) {
52579
- for (const item2 of this.items.list()) {
52580
- this.renderItemMbr(context, item2);
52581
+ for (const item of this.items.list()) {
52582
+ this.renderItemMbr(context, item);
52581
52583
  }
52582
52584
  }
52583
52585
  this.tool.render(context);
@@ -52589,7 +52591,7 @@ class BoardSelection {
52589
52591
  if (single && single instanceof AINode) {
52590
52592
  const contextItemsIds = single.getContextItems();
52591
52593
  if (contextItemsIds.length) {
52592
- const newContextItems = this.board.items.listAll().filter((item2) => contextItemsIds.includes(item2.getId()));
52594
+ const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
52593
52595
  contextItems.push(...newContextItems);
52594
52596
  }
52595
52597
  }
@@ -52607,15 +52609,15 @@ class BoardSelection {
52607
52609
  }
52608
52610
  }
52609
52611
  }
52610
- contextItems.forEach((item2) => {
52611
- if (item2 instanceof AINode) {
52612
- const path2 = item2.getPath();
52612
+ contextItems.forEach((item) => {
52613
+ if (item instanceof AINode) {
52614
+ const path2 = item.getPath();
52613
52615
  path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
52614
52616
  path2.setBorderWidth(2);
52615
52617
  path2.setBackgroundColor("none");
52616
52618
  path2.render(context);
52617
52619
  } else {
52618
- const itemRect = item2.getMbr();
52620
+ const itemRect = item.getMbr();
52619
52621
  itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
52620
52622
  itemRect.strokeWidth = 2;
52621
52623
  itemRect.render(context);
@@ -53116,16 +53118,16 @@ class Board {
53116
53118
  applyBoardOperation(op) {
53117
53119
  switch (op.method) {
53118
53120
  case "moveToZIndex": {
53119
- const item2 = this.index.getById(op.item);
53120
- if (!item2) {
53121
+ const item = this.index.getById(op.item);
53122
+ if (!item) {
53121
53123
  return;
53122
53124
  }
53123
- return this.index.moveToZIndex(item2, op.zIndex);
53125
+ return this.index.moveToZIndex(item, op.zIndex);
53124
53126
  }
53125
53127
  case "moveManyToZIndex": {
53126
53128
  for (const id in op.item) {
53127
- const item2 = this.items.getById(id);
53128
- if (!item2) {
53129
+ const item = this.items.getById(id);
53130
+ if (!item) {
53129
53131
  delete op.item.id;
53130
53132
  }
53131
53133
  }
@@ -53147,11 +53149,11 @@ class Board {
53147
53149
  }
53148
53150
  return this.index.moveSecondAfterFirst(first, second);
53149
53151
  case "bringToFront": {
53150
- const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
53152
+ const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
53151
53153
  return this.index.bringManyToFront(items);
53152
53154
  }
53153
53155
  case "sendToBack": {
53154
- const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
53156
+ const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
53155
53157
  return this.index.sendManyToBack(items);
53156
53158
  }
53157
53159
  case "add":
@@ -53175,82 +53177,82 @@ class Board {
53175
53177
  applyAddItems(op) {
53176
53178
  if (Array.isArray(op.item)) {
53177
53179
  const data = op.data;
53178
- const items = op.item.map((item3) => {
53179
- const created = this.createItem(item3, data[item3]);
53180
+ const items = op.item.map((item2) => {
53181
+ const created = this.createItem(item2, data[item2]);
53180
53182
  this.index.insert(created);
53181
53183
  return created;
53182
53184
  });
53183
- items.forEach((item3) => {
53184
- if (item3 instanceof Connector2 && data[item3.getId()]) {
53185
- const connectorData = data[item3.getId()];
53186
- item3.applyStartPoint(connectorData.startPoint);
53187
- item3.applyEndPoint(connectorData.endPoint);
53185
+ items.forEach((item2) => {
53186
+ if (item2 instanceof Connector2 && data[item2.getId()]) {
53187
+ const connectorData = data[item2.getId()];
53188
+ item2.applyStartPoint(connectorData.startPoint);
53189
+ item2.applyEndPoint(connectorData.endPoint);
53188
53190
  }
53189
53191
  });
53190
53192
  return;
53191
53193
  }
53192
- const item2 = this.createItem(op.item, op.data);
53193
- return this.index.insert(item2);
53194
+ const item = this.createItem(op.item, op.data);
53195
+ return this.index.insert(item);
53194
53196
  }
53195
53197
  applyAddLockedGroupOperation(op) {
53196
- const item2 = this.createItem(op.item, op.data);
53197
- const groupChildrenIds = item2.getChildrenIds();
53198
- this.index.insert(item2);
53198
+ const item = this.createItem(op.item, op.data);
53199
+ const groupChildrenIds = item.getChildrenIds();
53200
+ this.index.insert(item);
53199
53201
  const lastChildrenId = this.index.getById(groupChildrenIds[groupChildrenIds.length - 1]);
53200
53202
  if (lastChildrenId) {
53201
53203
  const zIndex = this.index.getZIndex(lastChildrenId) + 1;
53202
- this.index.moveToZIndex(item2, zIndex);
53204
+ this.index.moveToZIndex(item, zIndex);
53203
53205
  }
53204
- item2.getChildren().forEach((item3) => {
53205
- item3.transformation.isLocked = true;
53206
+ item.getChildren().forEach((item2) => {
53207
+ item2.transformation.isLocked = true;
53206
53208
  });
53207
- item2.transformation.isLocked = true;
53209
+ item.transformation.isLocked = true;
53208
53210
  }
53209
53211
  applyRemoveOperation(op) {
53210
53212
  const removedItems = [];
53211
- this.findItemAndApply(op.item, (item2) => {
53212
- this.index.remove(item2);
53213
- this.selection.remove(item2);
53214
- if (item2 instanceof Connector2) {
53215
- item2.clearObservedItems();
53213
+ this.findItemAndApply(op.item, (item) => {
53214
+ this.index.remove(item);
53215
+ this.selection.remove(item);
53216
+ if (item instanceof Connector2) {
53217
+ item.clearObservedItems();
53216
53218
  }
53217
- removedItems.push(item2);
53219
+ removedItems.push(item);
53218
53220
  });
53219
53221
  }
53220
53222
  applyRemoveLockedGroupOperation(op) {
53221
- const item2 = this.index.getById(op.item[0]);
53222
- if (!item2 || !(item2 instanceof Group)) {
53223
+ const item = this.index.getById(op.item[0]);
53224
+ if (!item || !(item instanceof Group)) {
53223
53225
  return;
53224
53226
  }
53225
- item2.getChildren().forEach((item3) => {
53226
- item3.transformation.isLocked = false;
53227
- item3.parent = "Board";
53227
+ item.getChildren().forEach((item2) => {
53228
+ item2.transformation.isLocked = false;
53229
+ item2.parent = "Board";
53228
53230
  });
53229
- item2.transformation.isLocked = false;
53231
+ item.transformation.isLocked = false;
53230
53232
  const removedItems = [];
53231
- this.findItemAndApply(op.item, (item3) => {
53232
- this.index.remove(item3);
53233
- this.selection.remove(item3);
53234
- removedItems.push(item3);
53233
+ this.findItemAndApply(op.item, (item2) => {
53234
+ this.index.remove(item2);
53235
+ this.selection.remove(item2);
53236
+ removedItems.push(item2);
53235
53237
  });
53236
53238
  }
53237
53239
  applyItemOperation(op) {
53238
53240
  if ("item" in op) {
53239
- this.findItemAndApply(op.item, (item2) => {
53240
- item2.apply(op);
53241
+ this.findItemAndApply(op.item, (item) => {
53242
+ item.apply(op);
53241
53243
  });
53242
53244
  }
53243
53245
  }
53244
- findItemAndApply(item2, apply) {
53245
- if (Array.isArray(item2)) {
53246
- for (const itemId of item2) {
53246
+ findItemAndApply(item, apply) {
53247
+ if (Array.isArray(item)) {
53248
+ for (const itemId of item) {
53247
53249
  const found = this.items.findById(itemId);
53248
53250
  if (found) {
53249
53251
  apply(found);
53250
53252
  }
53251
53253
  }
53252
53254
  } else {
53253
- const found = this.items.findById(item2);
53255
+ const found = this.items.findById(item);
53254
53256
  if (found) {
53255
53257
  apply(found);
53256
53258
  }
@@ -53259,9 +53261,9 @@ class Board {
53259
53261
  handleNesting(items) {
53260
53262
  const arrayed = Array.isArray(items) ? items : [items];
53261
53263
  const groupsMap = new Map;
53262
- arrayed.forEach((item2) => {
53263
- const itemCenter = item2.getMbr().getCenter();
53264
- const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item2)).reduce((acc, groupItem2) => {
53264
+ arrayed.forEach((item) => {
53265
+ const itemCenter = item.getMbr().getCenter();
53266
+ const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item)).reduce((acc, groupItem2) => {
53265
53267
  if (!acc || groupItem2.getDistanceToPoint(itemCenter) > acc.getDistanceToPoint(itemCenter)) {
53266
53268
  acc = groupItem2;
53267
53269
  }
@@ -53271,7 +53273,7 @@ class Board {
53271
53273
  if (!groupsMap.has(groupItem)) {
53272
53274
  groupsMap.set(groupItem, []);
53273
53275
  }
53274
- groupsMap.get(groupItem)?.push(item2);
53276
+ groupsMap.get(groupItem)?.push(item);
53275
53277
  }
53276
53278
  });
53277
53279
  groupsMap.forEach((items2, group) => {
@@ -53292,13 +53294,13 @@ class Board {
53292
53294
  }
53293
53295
  return parser(el);
53294
53296
  }
53295
- add(item2, timeStamp) {
53297
+ add(item, timeStamp) {
53296
53298
  const id = this.getNewItemId();
53297
53299
  this.emit({
53298
53300
  class: "Board",
53299
53301
  method: "add",
53300
53302
  item: id,
53301
- data: item2.serialize(),
53303
+ data: item.serialize(),
53302
53304
  timeStamp
53303
53305
  });
53304
53306
  const newItem = this.items.getById(id);
@@ -53308,13 +53310,13 @@ class Board {
53308
53310
  this.handleNesting(newItem);
53309
53311
  return newItem;
53310
53312
  }
53311
- addLockedGroup(item2) {
53313
+ addLockedGroup(item) {
53312
53314
  const id = this.getNewItemId();
53313
53315
  this.emit({
53314
53316
  class: "Board",
53315
53317
  method: "addLockedGroup",
53316
53318
  item: id,
53317
- data: item2.serialize()
53319
+ data: item.serialize()
53318
53320
  });
53319
53321
  const newItem = this.items.getById(id);
53320
53322
  if (!newItem) {
@@ -53323,32 +53325,32 @@ class Board {
53323
53325
  this.handleNesting(newItem);
53324
53326
  return newItem;
53325
53327
  }
53326
- remove(item2, withConnectors = true) {
53328
+ remove(item, withConnectors = true) {
53327
53329
  let connectors = [];
53328
53330
  if (withConnectors) {
53329
- connectors = this.items.getLinkedConnectorsById(item2.getId()).map((connector) => connector.getId());
53331
+ connectors = this.items.getLinkedConnectorsById(item.getId()).map((connector) => connector.getId());
53330
53332
  }
53331
- if ("onRemove" in item2) {
53332
- item2.onRemove();
53333
+ if ("onRemove" in item) {
53334
+ item.onRemove();
53333
53335
  }
53334
53336
  this.emit({
53335
53337
  class: "Board",
53336
53338
  method: "remove",
53337
- item: [item2.getId(), ...connectors]
53339
+ item: [item.getId(), ...connectors]
53338
53340
  });
53339
53341
  }
53340
- removeLockedGroup(item2) {
53342
+ removeLockedGroup(item) {
53341
53343
  this.emit({
53342
53344
  class: "Board",
53343
53345
  method: "removeLockedGroup",
53344
- item: [item2.getId()]
53346
+ item: [item.getId()]
53345
53347
  });
53346
53348
  }
53347
53349
  getByZIndex(index2) {
53348
53350
  return this.index.getByZIndex(index2);
53349
53351
  }
53350
- getZIndex(item2) {
53351
- return this.index.getZIndex(item2);
53352
+ getZIndex(item) {
53353
+ return this.index.getZIndex(item);
53352
53354
  }
53353
53355
  getLastZIndex() {
53354
53356
  return this.index.getLastZIndex();
@@ -53360,11 +53362,11 @@ class Board {
53360
53362
  item: items
53361
53363
  });
53362
53364
  }
53363
- moveToZIndex(item2, zIndex) {
53365
+ moveToZIndex(item, zIndex) {
53364
53366
  this.emit({
53365
53367
  class: "Board",
53366
53368
  method: "moveToZIndex",
53367
- item: item2.getId(),
53369
+ item: item.getId(),
53368
53370
  zIndex
53369
53371
  });
53370
53372
  }
@@ -53392,8 +53394,8 @@ class Board {
53392
53394
  this.emit({
53393
53395
  class: "Board",
53394
53396
  method: "bringToFront",
53395
- item: items.map((item2) => item2.getId()),
53396
- prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
53397
+ item: items.map((item) => item.getId()),
53398
+ prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
53397
53399
  });
53398
53400
  }
53399
53401
  sendToBack(items) {
@@ -53404,8 +53406,8 @@ class Board {
53404
53406
  this.emit({
53405
53407
  class: "Board",
53406
53408
  method: "sendToBack",
53407
- item: items.map((item2) => item2.getId()),
53408
- prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
53409
+ item: items.map((item) => item.getId()),
53410
+ prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
53409
53411
  });
53410
53412
  }
53411
53413
  copy() {
@@ -53482,7 +53484,7 @@ class Board {
53482
53484
  return added;
53483
53485
  });
53484
53486
  addedFrame.addChildItems(addedChildren);
53485
- parsedData.data.children = addedChildren.map((item2) => item2.getId());
53487
+ parsedData.data.children = addedChildren.map((item) => item.getId());
53486
53488
  idsMap[parsedData.data.id] = addedFrame.getId();
53487
53489
  } else {
53488
53490
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
@@ -53523,15 +53525,15 @@ class Board {
53523
53525
  const createdConnectors = {};
53524
53526
  const createdFrames = {};
53525
53527
  const addItem = (itemData) => {
53526
- const item2 = this.createItem(itemData.id, itemData);
53527
- if (item2 instanceof Connector2) {
53528
- createdConnectors[itemData.id] = { item: item2, itemData };
53528
+ const item = this.createItem(itemData.id, itemData);
53529
+ if (item instanceof Connector2) {
53530
+ createdConnectors[itemData.id] = { item, itemData };
53529
53531
  }
53530
- if (item2 instanceof Frame2) {
53531
- createdFrames[item2.getId()] = { item: item2, itemData };
53532
+ if (item instanceof Frame2) {
53533
+ createdFrames[item.getId()] = { item, itemData };
53532
53534
  }
53533
- this.index.insert(item2);
53534
- return item2;
53535
+ this.index.insert(item);
53536
+ return item;
53535
53537
  };
53536
53538
  for (const itemData of items) {
53537
53539
  if ("childrenMap" in itemData) {
@@ -53542,13 +53544,13 @@ class Board {
53542
53544
  }
53543
53545
  }
53544
53546
  for (const key in createdConnectors) {
53545
- const { item: item2, itemData } = createdConnectors[key];
53546
- item2.applyStartPoint(itemData.startPoint);
53547
- item2.applyEndPoint(itemData.endPoint);
53547
+ const { item, itemData } = createdConnectors[key];
53548
+ item.applyStartPoint(itemData.startPoint);
53549
+ item.applyEndPoint(itemData.endPoint);
53548
53550
  }
53549
53551
  for (const key in createdFrames) {
53550
- const { item: item2, itemData } = createdFrames[key];
53551
- item2.applyAddChildren(itemData.children);
53552
+ const { item, itemData } = createdFrames[key];
53553
+ item.applyAddChildren(itemData.children);
53552
53554
  }
53553
53555
  }
53554
53556
  deserialize(snapshot) {
@@ -53558,33 +53560,33 @@ class Board {
53558
53560
  const createdFrames = {};
53559
53561
  if (Array.isArray(items)) {
53560
53562
  for (const itemData of items) {
53561
- const item2 = this.createItem(itemData.id, itemData);
53562
- if (item2 instanceof Connector2) {
53563
- createdConnectors[itemData.id] = { item: item2, itemData };
53563
+ const item = this.createItem(itemData.id, itemData);
53564
+ if (item instanceof Connector2) {
53565
+ createdConnectors[itemData.id] = { item, itemData };
53564
53566
  }
53565
- if (item2 instanceof Frame2) {
53566
- createdFrames[item2.getId()] = { item: item2, itemData };
53567
+ if (item instanceof Frame2) {
53568
+ createdFrames[item.getId()] = { item, itemData };
53567
53569
  }
53568
- this.index.insert(item2);
53570
+ this.index.insert(item);
53569
53571
  }
53570
53572
  } else {
53571
53573
  for (const key in items) {
53572
53574
  const itemData = items[key];
53573
- const item2 = this.createItem(key, itemData);
53574
- if (item2 instanceof Connector2) {
53575
- createdConnectors[key] = { item: item2, itemData };
53575
+ const item = this.createItem(key, itemData);
53576
+ if (item instanceof Connector2) {
53577
+ createdConnectors[key] = { item, itemData };
53576
53578
  }
53577
- this.index.insert(item2);
53579
+ this.index.insert(item);
53578
53580
  }
53579
53581
  }
53580
53582
  for (const key in createdConnectors) {
53581
- const { item: item2, itemData } = createdConnectors[key];
53582
- item2.applyStartPoint(itemData.startPoint);
53583
- item2.applyEndPoint(itemData.endPoint);
53583
+ const { item, itemData } = createdConnectors[key];
53584
+ item.applyStartPoint(itemData.startPoint);
53585
+ item.applyEndPoint(itemData.endPoint);
53584
53586
  }
53585
53587
  for (const key in createdFrames) {
53586
- const { item: item2, itemData } = createdFrames[key];
53587
- item2.applyAddChildren(itemData.children);
53588
+ const { item, itemData } = createdFrames[key];
53589
+ item.applyAddChildren(itemData.children);
53588
53590
  }
53589
53591
  this.events?.log.deserialize(events);
53590
53592
  }
@@ -53822,7 +53824,7 @@ class Board {
53822
53824
  itemsMap: newMap,
53823
53825
  select: select2
53824
53826
  });
53825
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
53827
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
53826
53828
  this.handleNesting(items);
53827
53829
  this.selection.removeAll();
53828
53830
  this.selection.add(items);
@@ -53830,8 +53832,8 @@ class Board {
53830
53832
  return;
53831
53833
  }
53832
53834
  removeVoidComments() {
53833
- const voidComments = this.items.listAll().filter((item2) => {
53834
- return item2 instanceof Comment && !item2.getThread().length;
53835
+ const voidComments = this.items.listAll().filter((item) => {
53836
+ return item instanceof Comment && !item.getThread().length;
53835
53837
  });
53836
53838
  if (voidComments) {
53837
53839
  for (const comment2 of voidComments) {
@@ -53905,7 +53907,7 @@ class Board {
53905
53907
  }
53906
53908
  const mbr = this.selection.getMbr();
53907
53909
  const selectedItems = this.selection.items.list();
53908
- const isSelectedItemsMinWidth = selectedItems.some((item2) => item2.getMbr().getWidth() === 0);
53910
+ const isSelectedItemsMinWidth = selectedItems.some((item) => item.getMbr().getWidth() === 0);
53909
53911
  const right = mbr ? mbr.right : 0;
53910
53912
  const top = mbr ? mbr.top : 0;
53911
53913
  const width2 = mbr ? mbr.getWidth() / 10 : 10;
@@ -53947,7 +53949,7 @@ class Board {
53947
53949
  method: "duplicate",
53948
53950
  itemsMap: newMap
53949
53951
  });
53950
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
53952
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
53951
53953
  this.handleNesting(items);
53952
53954
  this.selection.removeAll();
53953
53955
  this.selection.add(items);
@@ -53968,9 +53970,9 @@ class Board {
53968
53970
  if (data.itemType === "Frame") {
53969
53971
  data.text.placeholderText = `Frame ${this.getMaxFrameSerial() + 1}`;
53970
53972
  }
53971
- const item2 = this.createItem(itemId, data);
53972
- this.index.insert(item2);
53973
- items.push(item2);
53973
+ const item = this.createItem(itemId, data);
53974
+ this.index.insert(item);
53975
+ items.push(item);
53974
53976
  };
53975
53977
  sortedItemsMap.map(([id, data]) => {
53976
53978
  if (data.itemType === "Connector") {
@@ -53985,8 +53987,8 @@ class Board {
53985
53987
  return;
53986
53988
  });
53987
53989
  }
53988
- isOnBoard(item2) {
53989
- return this.items.findById(item2.getId()) !== undefined;
53990
+ isOnBoard(item) {
53991
+ return this.items.findById(item.getId()) !== undefined;
53990
53992
  }
53991
53993
  getMaxFrameSerial() {
53992
53994
  const existingNames = this.items.listGroupItems().map((frame) => frame.getRichText()?.getTextString().length === 0 ? frame.getRichText()?.placeholderText || "" : frame.getRichText()?.getTextString() || "");
@@ -54032,7 +54034,7 @@ function areItemsTheSame(opA, opB) {
54032
54034
  const itemsB = Object.keys(opB.items);
54033
54035
  const setA = new Set(itemsA);
54034
54036
  const setB = new Set(itemsB);
54035
- const areArraysEqual = setA.size === setB.size && [...setA].every((item2) => setB.has(item2));
54037
+ const areArraysEqual = setA.size === setB.size && [...setA].every((item) => setB.has(item));
54036
54038
  return areArraysEqual;
54037
54039
  }
54038
54040
  if (!(Array.isArray(opA.item) && Array.isArray(opB.item))) {
@@ -55691,9 +55693,9 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
55691
55693
  list6.applyUnconfirmed(filter);
55692
55694
  const hasAnyOverlap = (arr1, arr2) => {
55693
55695
  const lookup9 = new Set(arr1);
55694
- return arr2.some((item2) => lookup9.has(item2));
55696
+ return arr2.some((item) => lookup9.has(item));
55695
55697
  };
55696
- const currSelection = board.selection.list().map((item2) => item2.getId());
55698
+ const currSelection = board.selection.list().map((item) => item.getId());
55697
55699
  if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
55698
55700
  board.selection.applyMemoizedCaretOrRange();
55699
55701
  }
@@ -56015,27 +56017,27 @@ function handleAiChatMassage(message, board) {
56015
56017
  }
56016
56018
  }
56017
56019
  function handleChatChunk(chunk, board) {
56018
- const item2 = board.items.getById(chunk.itemId);
56020
+ const item = board.items.getById(chunk.itemId);
56019
56021
  switch (chunk.type) {
56020
56022
  case "chunk":
56021
- if (!item2 || item2.itemType !== "AINode") {
56023
+ if (!item || item.itemType !== "AINode") {
56022
56024
  return;
56023
56025
  }
56024
- item2.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
56026
+ item.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
56025
56027
  break;
56026
56028
  case "done":
56027
- if (!item2 || item2.itemType !== "AINode") {
56029
+ if (!item || item.itemType !== "AINode") {
56028
56030
  board.aiGeneratingOnItem = undefined;
56029
56031
  return;
56030
56032
  }
56031
- item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56033
+ item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56032
56034
  break;
56033
56035
  case "end":
56034
- if (!item2 || item2.itemType !== "AINode") {
56036
+ if (!item || item.itemType !== "AINode") {
56035
56037
  board.aiGeneratingOnItem = undefined;
56036
56038
  return;
56037
56039
  }
56038
- item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56040
+ item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56039
56041
  break;
56040
56042
  case "error":
56041
56043
  default:
@@ -56052,7 +56054,7 @@ function handleChatChunk(chunk, board) {
56052
56054
  if (board.aiGeneratingOnItem && generatingItem) {
56053
56055
  board.selection.removeAll();
56054
56056
  board.selection.add(generatingItem);
56055
- const rt = item2?.getRichText();
56057
+ const rt = item?.getRichText();
56056
56058
  if (generatingItem.itemType === "AINode" && rt) {
56057
56059
  const editor = rt.editor;
56058
56060
  editor.markdownProcessor.setStopProcessingMarkDownCb(null);
@@ -56185,14 +56187,14 @@ function handleImageGenerate(response, board) {
56185
56187
  console.error("Image generation error:", response.message);
56186
56188
  if (response.isExternalApiError) {
56187
56189
  if (board.aiGeneratingOnItem) {
56188
- const item2 = board.items.getById(board.aiGeneratingOnItem);
56189
- if (item2) {
56190
+ const item = board.items.getById(board.aiGeneratingOnItem);
56191
+ if (item) {
56190
56192
  board.selection.removeAll();
56191
- board.selection.add(item2);
56192
- const editor = item2.getRichText()?.editor;
56193
+ board.selection.add(item);
56194
+ const editor = item.getRichText()?.editor;
56193
56195
  editor?.clearText();
56194
56196
  editor?.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
56195
- board.camera.zoomToFit(item2.getMbr(), 20);
56197
+ board.camera.zoomToFit(item.getMbr(), 20);
56196
56198
  }
56197
56199
  }
56198
56200
  } else {