@html-graph/html-graph 8.10.0 → 8.12.0

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.
@@ -1,22 +1,22 @@
1
- var Je = Object.defineProperty;
2
- var Ke = (r, e, t) => e in r ? Je(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var i = (r, e, t) => Ke(r, typeof e != "symbol" ? e + "" : e, t);
4
- var L = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(L || {});
5
- const Qe = () => {
1
+ var Ze = Object.defineProperty;
2
+ var _e = (r, e, t) => e in r ? Ze(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var i = (r, e, t) => _e(r, typeof e != "symbol" ? e + "" : e, t);
4
+ var V = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(V || {});
5
+ const qe = () => {
6
6
  const r = document.createElement("div");
7
7
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
8
- }, Ze = () => {
8
+ }, et = () => {
9
9
  const r = document.createElement("div");
10
10
  return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
11
- }, _e = (r) => {
11
+ }, tt = (r) => {
12
12
  r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
13
- }, qe = (r) => {
13
+ }, rt = (r) => {
14
14
  r.style.removeProperty("position"), r.style.removeProperty("top"), r.style.removeProperty("left"), r.style.removeProperty("visibility"), r.style.removeProperty("transform");
15
15
  };
16
- class Ee {
16
+ class be {
17
17
  constructor(e, t, o) {
18
- i(this, "host", Qe());
19
- i(this, "container", Ze());
18
+ i(this, "host", qe());
19
+ i(this, "container", et());
20
20
  i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
21
21
  i(this, "attachedNodeIds", /* @__PURE__ */ new Set());
22
22
  i(this, "applyTransform", () => {
@@ -27,11 +27,11 @@ class Ee {
27
27
  }
28
28
  attachNode(e) {
29
29
  const t = this.graphStore.getNode(e);
30
- _e(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
30
+ tt(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
31
31
  }
32
32
  detachNode(e) {
33
33
  const t = this.graphStore.getNode(e);
34
- qe(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
34
+ rt(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
35
35
  }
36
36
  attachEdge(e) {
37
37
  const t = this.graphStore.getEdge(e).payload.shape.svg;
@@ -71,9 +71,9 @@ class Ee {
71
71
  n,
72
72
  h,
73
73
  d
74
- ), g = this.createEdgeRenderPort(s, a, h, d);
75
- let u = L.Line;
76
- o.element === s.element ? u = L.PortCycle : o.nodeId === s.nodeId && (u = L.NodeCycle), t.payload.shape.render({ from: c, to: g, category: u });
74
+ ), u = this.createEdgeRenderPort(s, a, h, d);
75
+ let g = V.Line;
76
+ o.element === s.element ? g = V.PortCycle : o.nodeId === s.nodeId && (g = V.NodeCycle), t.payload.shape.render({ from: c, to: u, category: g });
77
77
  }
78
78
  updateEdgePriority(e) {
79
79
  const t = this.graphStore.getEdge(e);
@@ -93,7 +93,7 @@ class Ee {
93
93
  };
94
94
  }
95
95
  }
96
- class et {
96
+ class ot {
97
97
  constructor(e) {
98
98
  i(this, "xFrom", 1 / 0);
99
99
  i(this, "yFrom", 1 / 0);
@@ -109,11 +109,11 @@ class et {
109
109
  return o >= this.xFrom && o <= this.xTo && s >= this.yFrom && s <= this.yTo;
110
110
  }
111
111
  hasEdge(e) {
112
- const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, s = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(o).payload, a = this.graphStore.getNode(s).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), g = Math.max(n.y, a.y);
113
- return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
112
+ const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, s = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(o).payload, a = this.graphStore.getNode(s).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), u = Math.max(n.y, a.y);
113
+ return h <= this.xTo && d >= this.xFrom && c <= this.yTo && u >= this.yFrom;
114
114
  }
115
115
  }
116
- class tt {
116
+ class st {
117
117
  constructor(e, t, o, s) {
118
118
  i(this, "attachedNodes", /* @__PURE__ */ new Set());
119
119
  i(this, "attachedEdges", /* @__PURE__ */ new Set());
@@ -125,8 +125,8 @@ class tt {
125
125
  const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
126
126
  h && !d ? t.add(a) : !h && d && o.add(a);
127
127
  }), this.graphStore.getAllEdgeIds().forEach((a) => {
128
- const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), g = this.graphStore.getPort(c.from).nodeId, u = this.graphStore.getPort(c.to).nodeId;
129
- h && (this.renderingBox.hasNode(g) || (t.add(g), o.delete(g)), this.renderingBox.hasNode(u) || (t.add(u), o.delete(u))), h && !d ? s.add(a) : !h && d && n.add(a);
128
+ const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), u = this.graphStore.getPort(c.from).nodeId, g = this.graphStore.getPort(c.to).nodeId;
129
+ h && (this.renderingBox.hasNode(u) || (t.add(u), o.delete(u)), this.renderingBox.hasNode(g) || (t.add(g), o.delete(g))), h && !d ? s.add(a) : !h && d && n.add(a);
130
130
  }), n.forEach((a) => {
131
131
  this.handleDetachEdge(a);
132
132
  }), o.forEach((a) => {
@@ -137,7 +137,7 @@ class tt {
137
137
  this.handleAttachEdge(a);
138
138
  });
139
139
  });
140
- this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new et(this.graphStore), this.trigger.subscribe(this.updateViewport);
140
+ this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new ot(this.graphStore), this.trigger.subscribe(this.updateViewport);
141
141
  }
142
142
  attachNode(e) {
143
143
  this.renderingBox.hasNode(e) && this.handleAttachNode(e);
@@ -191,7 +191,7 @@ class tt {
191
191
  this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
192
192
  }
193
193
  }
194
- class rt {
194
+ class it {
195
195
  constructor(e, t) {
196
196
  i(this, "deferredNodes", /* @__PURE__ */ new Set());
197
197
  i(this, "deferredEdges", /* @__PURE__ */ new Set());
@@ -245,7 +245,7 @@ class rt {
245
245
  this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
246
246
  }
247
247
  }
248
- class _ {
248
+ class q {
249
249
  constructor() {
250
250
  i(this, "callbacks", /* @__PURE__ */ new Set());
251
251
  }
@@ -262,10 +262,10 @@ class _ {
262
262
  }
263
263
  }
264
264
  const P = () => {
265
- const r = new _();
265
+ const r = new q();
266
266
  return [r, r];
267
267
  };
268
- class Se {
268
+ class Pe {
269
269
  constructor(e, t, o, s) {
270
270
  i(this, "beforeDestroyEmitter");
271
271
  i(this, "destroyed", !1);
@@ -318,7 +318,7 @@ class Se {
318
318
  this.destroyed || (this.destroyed = !0, this.beforeDestroyEmitter.emit(), this.graphController.destroy(), this.viewportController.destroy());
319
319
  }
320
320
  }
321
- class ot {
321
+ class nt {
322
322
  constructor() {
323
323
  i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
324
324
  i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
@@ -364,7 +364,7 @@ class S extends Error {
364
364
  i(this, "name", "CanvasError");
365
365
  }
366
366
  }
367
- const b = Object.freeze({
367
+ const N = Object.freeze({
368
368
  accessNonexistingNode: (r) => `Failed to access node with ID ${JSON.stringify(r)} because it does not exist`,
369
369
  addNodeWithExistingId: (r) => `Failed to add node with ID ${JSON.stringify(r)} because a node with this ID already exists`,
370
370
  addNodeWithElementInUse: (r, e) => `Failed to add node with ID ${JSON.stringify(r)} because its HTML element is already attached to node with ID ${JSON.stringify(e)}`,
@@ -386,7 +386,7 @@ const b = Object.freeze({
386
386
  removeNonexistentEdge: (r) => `Failed to remove edge with ID ${JSON.stringify(r)} because it does not exist`,
387
387
  accessEdgesForNonexistentPort: (r) => `Failed to access edges for port with ID ${JSON.stringify(r)} because the port does not exist`
388
388
  });
389
- class be {
389
+ class Te {
390
390
  constructor() {
391
391
  i(this, "nodes", /* @__PURE__ */ new Map());
392
392
  i(this, "ports", /* @__PURE__ */ new Map());
@@ -395,7 +395,7 @@ class be {
395
395
  i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
396
396
  i(this, "portOutgoingEdges", /* @__PURE__ */ new Map());
397
397
  i(this, "portCycleEdges", /* @__PURE__ */ new Map());
398
- i(this, "elementPorts", new ot());
398
+ i(this, "elementPorts", new nt());
399
399
  i(this, "afterNodeAddedEmitter");
400
400
  i(this, "onAfterNodeAdded");
401
401
  i(this, "afterNodeUpdatedEmitter");
@@ -430,16 +430,16 @@ class be {
430
430
  getNode(e) {
431
431
  const t = this.nodes.get(e);
432
432
  if (t === void 0)
433
- throw new S(b.accessNonexistingNode(e));
433
+ throw new S(N.accessNonexistingNode(e));
434
434
  return t;
435
435
  }
436
436
  addNode(e) {
437
437
  if (this.hasNode(e.id))
438
- throw new S(b.addNodeWithExistingId(e.id));
438
+ throw new S(N.addNodeWithExistingId(e.id));
439
439
  const t = this.findNodeIdByElement(e.element);
440
440
  if (t !== void 0)
441
441
  throw new S(
442
- b.addNodeWithElementInUse(e.id, t)
442
+ N.addNodeWithElementInUse(e.id, t)
443
443
  );
444
444
  const o = /* @__PURE__ */ new Map(), s = {
445
445
  element: e.element,
@@ -461,13 +461,13 @@ class be {
461
461
  }
462
462
  updateNode(e, t) {
463
463
  if (!this.hasNode(e))
464
- throw new S(b.updateNonexistentNode(e));
464
+ throw new S(N.updateNonexistentNode(e));
465
465
  const { payload: o } = this.nodes.get(e);
466
466
  o.x = t.x ?? o.x, o.y = t.y ?? o.y, o.centerFn = t.centerFn ?? o.centerFn, t.priority !== void 0 && (o.priority = t.priority, this.afterNodePriorityUpdatedEmitter.emit(e)), this.afterNodeUpdatedEmitter.emit(e);
467
467
  }
468
468
  removeNode(e) {
469
469
  if (!this.hasNode(e))
470
- throw new S(b.removeNonexistentNode(e));
470
+ throw new S(N.removeNonexistentNode(e));
471
471
  this.beforeNodeRemovedEmitter.emit(e);
472
472
  const t = this.getNode(e);
473
473
  this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
@@ -478,15 +478,15 @@ class be {
478
478
  getPort(e) {
479
479
  const t = this.ports.get(e);
480
480
  if (t === void 0)
481
- throw new S(b.accessNonexistentPort(e));
481
+ throw new S(N.accessNonexistentPort(e));
482
482
  return t;
483
483
  }
484
484
  addPort(e) {
485
485
  if (this.hasPort(e.id))
486
- throw new S(b.addPortWithExistingId(e.id));
486
+ throw new S(N.addPortWithExistingId(e.id));
487
487
  if (!this.hasNode(e.nodeId))
488
488
  throw new S(
489
- b.addPortToNonexistentNode(e.id, e.nodeId)
489
+ N.addPortToNonexistentNode(e.id, e.nodeId)
490
490
  );
491
491
  this.ports.set(e.id, {
492
492
  element: e.element,
@@ -498,7 +498,7 @@ class be {
498
498
  }
499
499
  updatePort(e, t) {
500
500
  if (!this.hasPort(e))
501
- throw new S(b.updateNonexistentPort(e));
501
+ throw new S(N.updateNonexistentPort(e));
502
502
  const o = this.getPort(e).payload;
503
503
  o.direction = t.direction ?? o.direction, this.afterPortUpdatedEmitter.emit(e);
504
504
  }
@@ -512,13 +512,13 @@ class be {
512
512
  const t = this.nodes.get(e);
513
513
  if (t === void 0)
514
514
  throw new S(
515
- b.accessPortsOfNonexistentNode(e)
515
+ N.accessPortsOfNonexistentNode(e)
516
516
  );
517
517
  return Array.from(t.ports.keys());
518
518
  }
519
519
  removePort(e) {
520
520
  if (!this.hasPort(e))
521
- throw new S(b.removeNonexistentPort(e));
521
+ throw new S(N.removeNonexistentPort(e));
522
522
  const t = this.getPort(e).nodeId;
523
523
  this.beforePortRemovedEmitter.emit(e), this.getNode(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
524
524
  }
@@ -528,33 +528,33 @@ class be {
528
528
  getEdge(e) {
529
529
  const t = this.edges.get(e);
530
530
  if (t === void 0)
531
- throw new S(b.accessNonexistentEdge(e));
531
+ throw new S(N.accessNonexistentEdge(e));
532
532
  return t;
533
533
  }
534
534
  addEdge(e) {
535
535
  if (this.hasEdge(e.id))
536
- throw new S(b.addEdgeWithExistingId(e.id));
536
+ throw new S(N.addEdgeWithExistingId(e.id));
537
537
  if (!this.hasPort(e.from))
538
538
  throw new S(
539
- b.addEdgeFromNonexistentPort(e.id, e.from)
539
+ N.addEdgeFromNonexistentPort(e.id, e.from)
540
540
  );
541
541
  if (!this.hasPort(e.to))
542
542
  throw new S(
543
- b.addEdgeToNonexistentPort(e.id, e.to)
543
+ N.addEdgeToNonexistentPort(e.id, e.to)
544
544
  );
545
545
  this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
546
546
  }
547
547
  updateEdge(e, t) {
548
548
  if (!this.hasEdge(e))
549
- throw new S(b.updateNonexistentEdge(e));
549
+ throw new S(N.updateNonexistentEdge(e));
550
550
  if (t.from !== void 0 || t.to !== void 0) {
551
551
  if (t.from !== void 0 && !this.hasPort(t.from))
552
552
  throw new S(
553
- b.updateNonexistentEdgeSource(e, t.from)
553
+ N.updateNonexistentEdgeSource(e, t.from)
554
554
  );
555
555
  if (t.to !== void 0 && !this.hasPort(t.to))
556
556
  throw new S(
557
- b.updateNonexistentEdgeTarget(e, t.to)
557
+ N.updateNonexistentEdgeTarget(e, t.to)
558
558
  );
559
559
  const s = this.getEdge(e), n = s.payload;
560
560
  this.removeEdgeInternal(e), this.addEdgeInternal({
@@ -573,7 +573,7 @@ class be {
573
573
  }
574
574
  removeEdge(e) {
575
575
  if (!this.hasEdge(e))
576
- throw new S(b.removeNonexistentEdge(e));
576
+ throw new S(N.removeNonexistentEdge(e));
577
577
  this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
578
578
  }
579
579
  clear() {
@@ -583,7 +583,7 @@ class be {
583
583
  const t = this.portIncomingEdges.get(e);
584
584
  if (t === void 0)
585
585
  throw new S(
586
- b.accessEdgesForNonexistentPort(e)
586
+ N.accessEdgesForNonexistentPort(e)
587
587
  );
588
588
  return Array.from(t);
589
589
  }
@@ -591,7 +591,7 @@ class be {
591
591
  const t = this.portOutgoingEdges.get(e);
592
592
  if (t === void 0)
593
593
  throw new S(
594
- b.accessEdgesForNonexistentPort(e)
594
+ N.accessEdgesForNonexistentPort(e)
595
595
  );
596
596
  return Array.from(t);
597
597
  }
@@ -599,7 +599,7 @@ class be {
599
599
  const t = this.portCycleEdges.get(e);
600
600
  if (t === void 0)
601
601
  throw new S(
602
- b.accessEdgesForNonexistentPort(e)
602
+ N.accessEdgesForNonexistentPort(e)
603
603
  );
604
604
  return Array.from(t);
605
605
  }
@@ -672,22 +672,22 @@ class be {
672
672
  this.portCycleEdges.get(t).delete(e), this.portCycleEdges.get(o).delete(e), this.portIncomingEdges.get(t).delete(e), this.portIncomingEdges.get(o).delete(e), this.portOutgoingEdges.get(t).delete(e), this.portOutgoingEdges.get(o).delete(e), this.edges.delete(e);
673
673
  }
674
674
  }
675
- const ue = (r) => ({
675
+ const ye = (r) => ({
676
676
  scale: 1 / r.scale,
677
677
  x: -r.x / r.scale,
678
678
  y: -r.y / r.scale
679
- }), pe = {
679
+ }), fe = {
680
680
  scale: 1,
681
681
  x: 0,
682
682
  y: 0
683
- }, ye = (r, e) => ({
683
+ }, ve = (r, e) => ({
684
684
  x: r.scale * e.x + r.x,
685
685
  y: r.scale * e.y + r.y
686
686
  });
687
- class st {
687
+ class at {
688
688
  constructor(e) {
689
- i(this, "viewportMatrix", pe);
690
- i(this, "contentMatrix", pe);
689
+ i(this, "viewportMatrix", fe);
690
+ i(this, "contentMatrix", fe);
691
691
  i(this, "beforeUpdateEmitter");
692
692
  i(this, "onBeforeUpdated");
693
693
  i(this, "afterUpdateEmitter");
@@ -710,30 +710,30 @@ class st {
710
710
  scale: e.scale ?? this.viewportMatrix.scale,
711
711
  x: e.x ?? this.viewportMatrix.x,
712
712
  y: e.y ?? this.viewportMatrix.y
713
- }, this.beforeUpdateEmitter.emit(), this.contentMatrix = ue(this.viewportMatrix), this.afterUpdateEmitter.emit();
713
+ }, this.beforeUpdateEmitter.emit(), this.contentMatrix = ye(this.viewportMatrix), this.afterUpdateEmitter.emit();
714
714
  }
715
715
  patchContentMatrix(e) {
716
716
  this.contentMatrix = {
717
717
  scale: e.scale ?? this.contentMatrix.scale,
718
718
  x: e.x ?? this.contentMatrix.x,
719
719
  y: e.y ?? this.contentMatrix.y
720
- }, this.beforeUpdateEmitter.emit(), this.viewportMatrix = ue(this.contentMatrix), this.afterUpdateEmitter.emit();
720
+ }, this.beforeUpdateEmitter.emit(), this.viewportMatrix = ye(this.contentMatrix), this.afterUpdateEmitter.emit();
721
721
  }
722
722
  getDimensions() {
723
723
  const { width: e, height: t } = this.host.getBoundingClientRect();
724
724
  return { width: e, height: t };
725
725
  }
726
726
  createContentCoords(e) {
727
- return ye(this.viewportMatrix, e);
727
+ return ve(this.viewportMatrix, e);
728
728
  }
729
729
  createViewportCoords(e) {
730
- return ye(this.contentMatrix, e);
730
+ return ve(this.contentMatrix, e);
731
731
  }
732
732
  destroy() {
733
733
  this.observer.disconnect();
734
734
  }
735
735
  }
736
- class q {
736
+ class ee {
737
737
  constructor(e) {
738
738
  i(this, "elementToNodeId", /* @__PURE__ */ new Map());
739
739
  i(this, "nodesResizeObserver");
@@ -759,19 +759,19 @@ class q {
759
759
  }), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
760
760
  }
761
761
  static configure(e) {
762
- new q(e);
762
+ new ee(e);
763
763
  }
764
764
  handleNodeResize(e) {
765
765
  const t = this.elementToNodeId.get(e);
766
766
  this.canvas.updateNode(t);
767
767
  }
768
768
  }
769
- const it = (r, e, t) => {
769
+ const ht = (r, e, t) => {
770
770
  const { x: o, y: s, width: n, height: a } = r.getBoundingClientRect();
771
771
  return e >= o && e <= o + n && t >= s && t <= s + a;
772
- }, nt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, F = (r, e, t, o) => it(e, t, o) && nt(r, t, o), k = (r, e) => {
772
+ }, dt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, D = (r, e, t, o) => ht(e, t, o) && dt(r, t, o), Y = (r, e) => {
773
773
  e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
774
- }, H = (r) => {
774
+ }, X = (r) => {
775
775
  const e = document.createElement("div");
776
776
  return {
777
777
  id: r.overlayNodeId,
@@ -786,7 +786,7 @@ const it = (r, e, t) => {
786
786
  }
787
787
  ]
788
788
  };
789
- }, at = (r, e) => {
789
+ }, ct = (r, e) => {
790
790
  let t = e;
791
791
  for (; t !== null; ) {
792
792
  const o = r.findPortIdsByElement(t)[0] ?? null;
@@ -805,21 +805,21 @@ const it = (r, e, t) => {
805
805
  status: "notFound"
806
806
  };
807
807
  };
808
- function* Ne(r, e) {
808
+ function* Ce(r, e) {
809
809
  const t = r.elementsFromPoint(e.x, e.y);
810
810
  for (const o of t) {
811
811
  if (o.shadowRoot !== null) {
812
- const s = Ne(o.shadowRoot, e);
812
+ const s = Ce(o.shadowRoot, e);
813
813
  for (const n of s)
814
814
  yield n;
815
815
  }
816
816
  yield o;
817
817
  }
818
818
  }
819
- const Pe = (r, e) => {
820
- const t = Ne(document, e);
819
+ const Me = (r, e) => {
820
+ const t = Ce(document, e);
821
821
  for (const o of t) {
822
- const s = at(r, o);
822
+ const s = ct(r, o);
823
823
  if (s.status === "portFound")
824
824
  return s.portId;
825
825
  if (s.status === "nodeEncountered")
@@ -828,13 +828,13 @@ const Pe = (r, e) => {
828
828
  return null;
829
829
  };
830
830
  var M = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(M || {});
831
- const Ce = (r, e) => ({
831
+ const De = (r, e) => ({
832
832
  x: r / 2,
833
833
  y: e / 2
834
- }), x = (r, e, t) => ({
834
+ }), m = (r, e, t) => ({
835
835
  x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
836
836
  y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
837
- }), Te = (r, e, t) => {
837
+ }), Le = (r, e, t) => {
838
838
  const o = {
839
839
  x: r.x + r.width / 2,
840
840
  y: r.y + r.height / 2
@@ -851,7 +851,7 @@ const Ce = (r, e) => ({
851
851
  to: { x: s.x - n, y: s.y - a }
852
852
  };
853
853
  };
854
- class ht {
854
+ class lt {
855
855
  constructor(e) {
856
856
  i(this, "path");
857
857
  i(this, "midpoint");
@@ -864,27 +864,27 @@ class ht {
864
864
  curvature: h,
865
865
  hasSourceArrow: d,
866
866
  hasTargetArrow: c
867
- } = e, g = (t.x + o.x) / 2, u = (t.y + o.y) / 2;
868
- this.midpoint = { x: g, y: u };
869
- const l = x(
867
+ } = e, u = (t.x + o.x) / 2, g = (t.y + o.y) / 2;
868
+ this.midpoint = { x: u, y: g };
869
+ const l = m(
870
870
  { x: t.x + s, y: t.y },
871
871
  n,
872
872
  t
873
- ), p = x(
873
+ ), w = m(
874
874
  { x: o.x - s, y: o.y },
875
875
  a,
876
876
  o
877
- ), y = {
877
+ ), p = {
878
878
  x: l.x + n.x * h,
879
879
  y: l.y + n.y * h
880
- }, w = {
881
- x: p.x - a.x * h,
882
- y: p.y - a.y * h
883
- }, f = `M ${l.x} ${l.y} C ${y.x} ${y.y}, ${w.x} ${w.y}, ${p.x} ${p.y}`, m = d ? "" : `M ${t.x} ${t.y} L ${l.x} ${l.y} `, A = c ? "" : ` M ${p.x} ${p.y} L ${o.x} ${o.y}`;
884
- this.path = `${m}${f}${A}`;
880
+ }, y = {
881
+ x: w.x - a.x * h,
882
+ y: w.y - a.y * h
883
+ }, f = `M ${l.x} ${l.y} C ${p.x} ${p.y}, ${y.x} ${y.y}, ${w.x} ${w.y}`, x = d ? "" : `M ${t.x} ${t.y} L ${l.x} ${l.y} `, E = c ? "" : ` M ${w.x} ${w.y} L ${o.x} ${o.y}`;
884
+ this.path = `${x}${f}${E}`;
885
885
  }
886
886
  }
887
- class dt {
887
+ class ut {
888
888
  constructor(e) {
889
889
  i(this, "path");
890
890
  i(this, "midpoint");
@@ -897,70 +897,70 @@ class dt {
897
897
  detourDir: h,
898
898
  from: d,
899
899
  to: c,
900
- arrowLength: g,
901
- detourDistance: u
902
- } = e, l = t ? x(
903
- { x: d.x + g, y: d.y },
900
+ arrowLength: u,
901
+ detourDistance: g
902
+ } = e, l = t ? m(
903
+ { x: d.x + u, y: d.y },
904
904
  n,
905
905
  d
906
- ) : d, p = o ? x(
906
+ ) : d, w = o ? m(
907
907
  {
908
- x: c.x - g,
908
+ x: c.x - u,
909
909
  y: c.y
910
910
  },
911
911
  a,
912
912
  c
913
- ) : c, y = Math.cos(h) * u, w = Math.sin(h) * u, f = x(
914
- { x: d.x + g, y: d.y },
913
+ ) : c, p = Math.cos(h) * g, y = Math.sin(h) * g, f = m(
914
+ { x: d.x + u, y: d.y },
915
915
  n,
916
916
  d
917
- ), m = {
918
- x: f.x + y,
919
- y: f.y + w
920
- }, A = x(
921
- { x: c.x - g, y: c.y },
917
+ ), x = {
918
+ x: f.x + p,
919
+ y: f.y + y
920
+ }, E = m(
921
+ { x: c.x - u, y: c.y },
922
922
  a,
923
923
  c
924
- ), N = {
925
- x: A.x + y,
926
- y: A.y + w
927
- }, C = {
928
- x: (m.x + N.x) / 2,
929
- y: (m.y + N.y) / 2
924
+ ), b = {
925
+ x: E.x + p,
926
+ y: E.y + y
930
927
  }, T = {
928
+ x: (x.x + b.x) / 2,
929
+ y: (x.y + b.y) / 2
930
+ }, C = {
931
931
  x: f.x + s * n.x,
932
932
  y: f.y + s * n.y
933
933
  }, I = {
934
- x: A.x - s * a.x,
935
- y: A.y - s * a.y
936
- }, V = {
937
- x: f.x + y,
938
- y: f.y + w
934
+ x: E.x - s * a.x,
935
+ y: E.y - s * a.y
936
+ }, U = {
937
+ x: f.x + p,
938
+ y: f.y + y
939
939
  }, $ = {
940
- x: A.x + y,
941
- y: A.y + w
940
+ x: E.x + p,
941
+ y: E.y + y
942
942
  };
943
943
  this.path = [
944
944
  `M ${l.x} ${l.y}`,
945
945
  `L ${f.x} ${f.y}`,
946
- `C ${T.x} ${T.y} ${V.x} ${V.y} ${C.x} ${C.y}`,
947
- `C ${$.x} ${$.y} ${I.x} ${I.y} ${A.x} ${A.y}`,
948
- `L ${p.x} ${p.y}`
949
- ].join(" "), this.midpoint = C;
946
+ `C ${C.x} ${C.y} ${U.x} ${U.y} ${T.x} ${T.y}`,
947
+ `C ${$.x} ${$.y} ${I.x} ${I.y} ${E.x} ${E.y}`,
948
+ `L ${w.x} ${w.y}`
949
+ ].join(" "), this.midpoint = T;
950
950
  }
951
951
  }
952
- const ee = Object.freeze({
952
+ const te = Object.freeze({
953
953
  edgeColor: "--edge-color"
954
- }), Me = (r) => {
954
+ }), Re = (r) => {
955
955
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
956
- return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(ee.edgeColor, r), e;
957
- }, De = (r) => {
956
+ return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(te.edgeColor, r), e;
957
+ }, Ve = (r) => {
958
958
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
959
- return e.setAttribute("stroke", `var(${ee.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
960
- }, Y = () => {
959
+ return e.setAttribute("stroke", `var(${te.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
960
+ }, H = () => {
961
961
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
962
- return r.setAttribute("fill", `var(${ee.edgeColor})`), r;
963
- }, Re = (r, e) => {
962
+ return r.setAttribute("fill", `var(${te.edgeColor})`), r;
963
+ }, Fe = (r, e) => {
964
964
  r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${e.width}px`, r.style.height = `${e.height}px`;
965
965
  }, R = (r, e) => {
966
966
  const t = [];
@@ -968,23 +968,23 @@ const ee = Object.freeze({
968
968
  const o = r.length - 1;
969
969
  let s = 0, n = 0, a = 0;
970
970
  r.forEach((h, d) => {
971
- let c = 0, g = 0, u = 0;
972
- const l = d > 0, p = d < o, y = l && p;
973
- if (l && (c = -s, g = -n, u = a), p) {
974
- const T = r[d + 1];
975
- s = T.x - h.x, n = T.y - h.y, a = Math.sqrt(s * s + n * n);
971
+ let c = 0, u = 0, g = 0;
972
+ const l = d > 0, w = d < o, p = l && w;
973
+ if (l && (c = -s, u = -n, g = a), w) {
974
+ const C = r[d + 1];
975
+ s = C.x - h.x, n = C.y - h.y, a = Math.sqrt(s * s + n * n);
976
976
  }
977
- const f = a !== 0 ? Math.min((y ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, m = y ? { x: h.x + s * f, y: h.y + n * f } : h, N = u !== 0 ? Math.min((y ? e : 0) / u, d > 1 ? 0.5 : 1) : 0, C = y ? { x: h.x + c * N, y: h.y + g * N } : h;
978
- d > 0 && t.push(`L ${C.x} ${C.y}`), y && t.push(
979
- `C ${h.x} ${h.y} ${h.x} ${h.y} ${m.x} ${m.y}`
977
+ const f = a !== 0 ? Math.min((p ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, x = p ? { x: h.x + s * f, y: h.y + n * f } : h, b = g !== 0 ? Math.min((p ? e : 0) / g, d > 1 ? 0.5 : 1) : 0, T = p ? { x: h.x + c * b, y: h.y + u * b } : h;
978
+ d > 0 && t.push(`L ${T.x} ${T.y}`), p && t.push(
979
+ `C ${h.x} ${h.y} ${h.x} ${h.y} ${x.x} ${x.y}`
980
980
  );
981
981
  });
982
982
  }
983
983
  return t.join(" ");
984
- }, ct = (r, e) => {
984
+ }, gt = (r, e) => {
985
985
  const t = e.x - r.x >= 0, o = r.dirX >= 0, s = e.dirX >= 0;
986
986
  if (o === s) {
987
- const c = o === t, g = (r.x + e.x) / 2, u = (r.y + e.y) / 2, l = { x: g, y: u };
987
+ const c = o === t, u = (r.x + e.x) / 2, g = (r.y + e.y) / 2, l = { x: u, y: g };
988
988
  return c ? {
989
989
  points: [
990
990
  { x: r.x, y: r.y },
@@ -1017,7 +1017,7 @@ const ee = Object.freeze({
1017
1017
  midpoint: { x: d.x, y: h }
1018
1018
  };
1019
1019
  };
1020
- class lt {
1020
+ class pt {
1021
1021
  constructor(e) {
1022
1022
  i(this, "path");
1023
1023
  i(this, "midpoint");
@@ -1030,41 +1030,41 @@ class lt {
1030
1030
  arrowOffset: h,
1031
1031
  roundness: d,
1032
1032
  hasSourceArrow: c,
1033
- hasTargetArrow: g
1034
- } = e, u = c ? x(
1033
+ hasTargetArrow: u
1034
+ } = e, g = c ? m(
1035
1035
  { x: t.x + a, y: t.y },
1036
1036
  s,
1037
1037
  t
1038
- ) : t, l = g ? x(
1038
+ ) : t, l = u ? m(
1039
1039
  {
1040
1040
  x: o.x - a,
1041
1041
  y: o.y
1042
1042
  },
1043
1043
  n,
1044
1044
  o
1045
- ) : o, p = a + h, y = x(
1046
- { x: t.x + p, y: t.y },
1045
+ ) : o, w = a + h, p = m(
1046
+ { x: t.x + w, y: t.y },
1047
1047
  s,
1048
1048
  t
1049
- ), w = x({ x: o.x - p, y: o.y }, n, o), f = ct(
1049
+ ), y = m({ x: o.x - w, y: o.y }, n, o), f = gt(
1050
1050
  {
1051
- x: y.x,
1052
- y: y.y,
1051
+ x: p.x,
1052
+ y: p.y,
1053
1053
  dirX: s.x
1054
1054
  },
1055
1055
  {
1056
- x: w.x,
1057
- y: w.y,
1056
+ x: y.x,
1057
+ y: y.y,
1058
1058
  dirX: n.x
1059
1059
  }
1060
1060
  );
1061
1061
  this.path = R(
1062
- [u, ...f.points, l],
1062
+ [g, ...f.points, l],
1063
1063
  d
1064
1064
  ), this.midpoint = f.midpoint;
1065
1065
  }
1066
1066
  }
1067
- class gt {
1067
+ class wt {
1068
1068
  constructor(e) {
1069
1069
  i(this, "path");
1070
1070
  i(this, "midpoint");
@@ -1077,45 +1077,45 @@ class gt {
1077
1077
  fromDir: h,
1078
1078
  toDir: d,
1079
1079
  arrowOffset: c,
1080
- detourDir: g,
1081
- detourDistance: u,
1080
+ detourDir: u,
1081
+ detourDistance: g,
1082
1082
  roundness: l
1083
- } = e, p = t ? x(
1083
+ } = e, w = t ? m(
1084
1084
  { x: s.x + a, y: s.y },
1085
1085
  h,
1086
1086
  s
1087
- ) : s, y = o ? x(
1087
+ ) : s, p = o ? m(
1088
1088
  {
1089
1089
  x: n.x - a,
1090
1090
  y: n.y
1091
1091
  },
1092
1092
  d,
1093
1093
  n
1094
- ) : n, w = a + c, f = Math.cos(g) * u, m = Math.sin(g) * u, A = x(
1095
- { x: s.x + w, y: s.y },
1094
+ ) : n, y = a + c, f = Math.cos(u) * g, x = Math.sin(u) * g, E = m(
1095
+ { x: s.x + y, y: s.y },
1096
1096
  h,
1097
1097
  s
1098
- ), N = {
1099
- x: A.x + f,
1100
- y: A.y + m
1101
- }, C = x(
1102
- { x: n.x - w, y: n.y },
1098
+ ), b = {
1099
+ x: E.x + f,
1100
+ y: E.y + x
1101
+ }, T = m(
1102
+ { x: n.x - y, y: n.y },
1103
1103
  d,
1104
1104
  n
1105
- ), T = {
1106
- x: C.x + f,
1107
- y: C.y + m
1105
+ ), C = {
1106
+ x: T.x + f,
1107
+ y: T.y + x
1108
1108
  };
1109
1109
  this.midpoint = {
1110
- x: (N.x + T.x) / 2,
1111
- y: (N.y + T.y) / 2
1110
+ x: (b.x + C.x) / 2,
1111
+ y: (b.y + C.y) / 2
1112
1112
  }, this.path = R(
1113
- [p, A, N, T, C, y],
1113
+ [w, E, b, C, T, p],
1114
1114
  l
1115
1115
  );
1116
1116
  }
1117
1117
  }
1118
- class ut {
1118
+ class yt {
1119
1119
  constructor(e) {
1120
1120
  i(this, "path");
1121
1121
  i(this, "midpoint");
@@ -1128,8 +1128,8 @@ class ut {
1128
1128
  fromDir: h,
1129
1129
  toDir: d,
1130
1130
  arrowOffset: c,
1131
- roundness: g
1132
- } = e, u = this.createArrowPoint(
1131
+ roundness: u
1132
+ } = e, g = this.createArrowPoint(
1133
1133
  s,
1134
1134
  h,
1135
1135
  t,
@@ -1139,13 +1139,13 @@ class ut {
1139
1139
  d,
1140
1140
  o,
1141
1141
  -a
1142
- ), p = a + c, y = { x: t.x + p, y: t.y }, w = x(y, h, t), f = { x: o.x - p, y: o.y }, m = x(f, d, o);
1142
+ ), w = a + c, p = { x: t.x + w, y: t.y }, y = m(p, h, t), f = { x: o.x - w, y: o.y }, x = m(f, d, o);
1143
1143
  this.path = R(
1144
- [u, w, m, l],
1145
- g
1144
+ [g, y, x, l],
1145
+ u
1146
1146
  );
1147
- const A = (w.x + m.x) / 2, N = (w.y + m.y) / 2;
1148
- this.midpoint = { x: A, y: N };
1147
+ const E = (y.x + x.x) / 2, b = (y.y + x.y) / 2;
1148
+ this.midpoint = { x: E, y: b };
1149
1149
  }
1150
1150
  createArrowPoint(e, t, o, s) {
1151
1151
  if (!e)
@@ -1154,13 +1154,13 @@ class ut {
1154
1154
  x: o.x + s,
1155
1155
  y: o.y
1156
1156
  };
1157
- return x(n, t, o);
1157
+ return m(n, t, o);
1158
1158
  }
1159
1159
  }
1160
- const pt = (r, e) => {
1160
+ const ft = (r, e) => {
1161
1161
  const t = e.y - r.y >= 0, o = r.dirY >= 0, s = e.dirY >= 0;
1162
1162
  if (o === s) {
1163
- const c = o === t, g = (r.x + e.x) / 2, u = (r.y + e.y) / 2, l = { x: g, y: u };
1163
+ const c = o === t, u = (r.x + e.x) / 2, g = (r.y + e.y) / 2, l = { x: u, y: g };
1164
1164
  return c ? {
1165
1165
  points: [
1166
1166
  { x: r.x, y: r.y },
@@ -1193,7 +1193,7 @@ const pt = (r, e) => {
1193
1193
  midpoint: { x: h, y: d.y }
1194
1194
  };
1195
1195
  };
1196
- class yt {
1196
+ class vt {
1197
1197
  constructor(e) {
1198
1198
  i(this, "path");
1199
1199
  i(this, "midpoint");
@@ -1206,45 +1206,45 @@ class yt {
1206
1206
  arrowOffset: h,
1207
1207
  fromDir: d,
1208
1208
  toDir: c,
1209
- roundness: g
1210
- } = e, u = s ? x(
1209
+ roundness: u
1210
+ } = e, g = s ? m(
1211
1211
  { x: t.x + a, y: t.y },
1212
1212
  d,
1213
1213
  t
1214
- ) : t, l = n ? x(
1214
+ ) : t, l = n ? m(
1215
1215
  {
1216
1216
  x: o.x - a,
1217
1217
  y: o.y
1218
1218
  },
1219
1219
  c,
1220
1220
  o
1221
- ) : o, p = a + h, y = x(
1222
- { x: t.x + p, y: t.y },
1221
+ ) : o, w = a + h, p = m(
1222
+ { x: t.x + w, y: t.y },
1223
1223
  d,
1224
1224
  t
1225
- ), w = x({ x: o.x - p, y: o.y }, c, o), f = pt(
1225
+ ), y = m({ x: o.x - w, y: o.y }, c, o), f = ft(
1226
1226
  {
1227
- x: y.x,
1228
- y: y.y,
1227
+ x: p.x,
1228
+ y: p.y,
1229
1229
  dirY: d.y
1230
1230
  },
1231
1231
  {
1232
- x: w.x,
1233
- y: w.y,
1232
+ x: y.x,
1233
+ y: y.y,
1234
1234
  dirY: c.y
1235
1235
  }
1236
1236
  );
1237
1237
  this.path = R(
1238
- [u, ...f.points, l],
1239
- g
1238
+ [g, ...f.points, l],
1239
+ u
1240
1240
  ), this.midpoint = f.midpoint;
1241
1241
  }
1242
1242
  }
1243
- class te {
1243
+ class re {
1244
1244
  constructor(e) {
1245
1245
  i(this, "path");
1246
1246
  i(this, "midpoint");
1247
- const { side: t, arrowLength: o, arrowOffset: s, dir: n, origin: a, hasArrow: h } = e, d = o + s, c = d + 2 * t, u = [
1247
+ const { side: t, arrowLength: o, arrowOffset: s, dir: n, origin: a, hasArrow: h } = e, d = o + s, c = d + 2 * t, g = [
1248
1248
  { x: o, y: 0 },
1249
1249
  { x: d, y: 0 },
1250
1250
  { x: d, y: t },
@@ -1253,29 +1253,29 @@ class te {
1253
1253
  { x: d, y: -t },
1254
1254
  { x: d, y: 0 },
1255
1255
  { x: o, y: 0 }
1256
- ].map((p) => x(p, n, { x: 0, y: 0 })).map((p) => ({ x: p.x + a.x, y: p.y + a.y })), l = `M ${a.x} ${a.y} L ${u[0].x} ${u[0].y} `;
1257
- this.path = `${h ? "" : l}${R(u, e.roundness)}`, this.midpoint = { x: (u[3].x + u[4].x) / 2, y: (u[3].y + u[4].y) / 2 };
1256
+ ].map((w) => m(w, n, { x: 0, y: 0 })).map((w) => ({ x: w.x + a.x, y: w.y + a.y })), l = `M ${a.x} ${a.y} L ${g[0].x} ${g[0].y} `;
1257
+ this.path = `${h ? "" : l}${R(g, e.roundness)}`, this.midpoint = { x: (g[3].x + g[4].x) / 2, y: (g[3].y + g[4].y) / 2 };
1258
1258
  }
1259
1259
  }
1260
- class wt {
1260
+ class mt {
1261
1261
  constructor(e) {
1262
1262
  i(this, "path");
1263
1263
  i(this, "midpoint");
1264
- const { arrowLength: t, radius: o, smallRadius: s, dir: n, origin: a, hasArrow: h } = e, d = s + o, c = s * o / d, g = Math.sqrt(d * d - s * s), u = g * s / d, l = g + o + t, p = t + u, w = [
1264
+ const { arrowLength: t, radius: o, smallRadius: s, dir: n, origin: a, hasArrow: h } = e, d = s + o, c = s * o / d, u = Math.sqrt(d * d - s * s), g = u * s / d, l = u + o + t, w = t + g, y = [
1265
1265
  { x: t, y: 0 },
1266
- { x: p, y: c },
1267
- { x: p, y: -c },
1266
+ { x: w, y: c },
1267
+ { x: w, y: -c },
1268
1268
  { x: l, y: 0 }
1269
- ].map((A) => x(A, n, { x: 0, y: 0 })).map((A) => ({ x: A.x + a.x, y: A.y + a.y })), f = [
1270
- `M ${w[0].x} ${w[0].y}`,
1271
- `A ${s} ${s} 0 0 1 ${w[1].x} ${w[1].y}`,
1272
- `A ${o} ${o} 0 1 0 ${w[2].x} ${w[2].y}`,
1273
- `A ${s} ${s} 0 0 1 ${w[0].x} ${w[0].y}`
1274
- ].join(" "), m = `M ${a.x} ${a.y} L ${w[0].x} ${w[0].y} `;
1275
- this.path = `${h ? "" : m}${f}`, this.midpoint = w[3];
1269
+ ].map((E) => m(E, n, { x: 0, y: 0 })).map((E) => ({ x: E.x + a.x, y: E.y + a.y })), f = [
1270
+ `M ${y[0].x} ${y[0].y}`,
1271
+ `A ${s} ${s} 0 0 1 ${y[1].x} ${y[1].y}`,
1272
+ `A ${o} ${o} 0 1 0 ${y[2].x} ${y[2].y}`,
1273
+ `A ${s} ${s} 0 0 1 ${y[0].x} ${y[0].y}`
1274
+ ].join(" "), x = `M ${a.x} ${a.y} L ${y[0].x} ${y[0].y} `;
1275
+ this.path = `${h ? "" : x}${f}`, this.midpoint = y[3];
1276
1276
  }
1277
1277
  }
1278
- class ft {
1278
+ class xt {
1279
1279
  constructor(e) {
1280
1280
  i(this, "path");
1281
1281
  i(this, "midpoint");
@@ -1290,27 +1290,27 @@ class ft {
1290
1290
  arrowLength: d
1291
1291
  } = e;
1292
1292
  this.midpoint = { x: (t.x + o.x) / 2, y: (t.y + o.y) / 2 };
1293
- const c = o.x - t.x, g = o.y - t.y;
1294
- if (this.diagonalDistance = Math.sqrt(c * c + g * g), this.diagonalDistance === 0) {
1293
+ const c = o.x - t.x, u = o.y - t.y;
1294
+ if (this.diagonalDistance = Math.sqrt(c * c + u * u), this.diagonalDistance === 0) {
1295
1295
  this.path = "";
1296
1296
  return;
1297
1297
  }
1298
- const u = { x: c, y: g }, l = this.createDirectLinePoint({
1298
+ const g = { x: c, y: u }, l = this.createDirectLinePoint({
1299
1299
  offset: s,
1300
1300
  hasArrow: a,
1301
1301
  flip: 1,
1302
1302
  shift: t,
1303
1303
  arrowLength: d,
1304
- dir: u
1305
- }), p = this.createDirectLinePoint({
1304
+ dir: g
1305
+ }), w = this.createDirectLinePoint({
1306
1306
  offset: n,
1307
1307
  hasArrow: h,
1308
1308
  flip: -1,
1309
1309
  shift: o,
1310
1310
  arrowLength: d,
1311
- dir: u
1311
+ dir: g
1312
1312
  });
1313
- this.path = `M ${l.x} ${l.y} L ${p.x} ${p.y}`;
1313
+ this.path = `M ${l.x} ${l.y} L ${w.x} ${w.y}`;
1314
1314
  }
1315
1315
  createDirectLinePoint(e) {
1316
1316
  const t = e.hasArrow ? e.arrowLength : 0, o = e.offset + t, s = e.flip * o / this.diagonalDistance, { dir: n, shift: a } = e;
@@ -1320,11 +1320,11 @@ class ft {
1320
1320
  };
1321
1321
  }
1322
1322
  }
1323
- const vt = (r, e, t) => {
1323
+ const Et = (r, e, t) => {
1324
1324
  const o = Math.max(r.y, e.y), s = Math.min(r.y, e.y);
1325
1325
  return (t >= 0 ? o : s) + t;
1326
1326
  };
1327
- class xt {
1327
+ class At {
1328
1328
  constructor(e) {
1329
1329
  i(this, "path");
1330
1330
  i(this, "midpoint");
@@ -1337,49 +1337,49 @@ class xt {
1337
1337
  fromDir: h,
1338
1338
  toDir: d,
1339
1339
  arrowOffset: c,
1340
- roundness: g,
1341
- detourDistance: u
1342
- } = e, l = t ? x(
1340
+ roundness: u,
1341
+ detourDistance: g
1342
+ } = e, l = t ? m(
1343
1343
  { x: n.x + s, y: n.y },
1344
1344
  h,
1345
1345
  n
1346
- ) : n, p = o ? x(
1346
+ ) : n, w = o ? m(
1347
1347
  {
1348
1348
  x: a.x - s,
1349
1349
  y: a.y
1350
1350
  },
1351
1351
  d,
1352
1352
  a
1353
- ) : a, y = s + c, w = x(
1354
- { x: n.x + y, y: n.y },
1353
+ ) : a, p = s + c, y = m(
1354
+ { x: n.x + p, y: n.y },
1355
1355
  h,
1356
1356
  n
1357
- ), f = x(
1358
- { x: a.x - y, y: a.y },
1357
+ ), f = m(
1358
+ { x: a.x - p, y: a.y },
1359
1359
  d,
1360
1360
  a
1361
- ), m = vt(w, f, u);
1361
+ ), x = Et(y, f, g);
1362
1362
  this.midpoint = {
1363
- x: (w.x + f.x) / 2,
1364
- y: m
1363
+ x: (y.x + f.x) / 2,
1364
+ y: x
1365
1365
  }, this.path = R(
1366
1366
  [
1367
1367
  l,
1368
- w,
1369
- { x: w.x, y: m },
1370
- { x: f.x, y: m },
1368
+ y,
1369
+ { x: y.x, y: x },
1370
+ { x: f.x, y: x },
1371
1371
  f,
1372
- p
1372
+ w
1373
1373
  ],
1374
- g
1374
+ u
1375
1375
  );
1376
1376
  }
1377
1377
  }
1378
- const mt = (r, e, t) => {
1378
+ const St = (r, e, t) => {
1379
1379
  const o = Math.max(r.x, e.x), s = Math.min(r.x, e.x);
1380
1380
  return (t >= 0 ? o : s) + t;
1381
1381
  };
1382
- class At {
1382
+ class Nt {
1383
1383
  constructor(e) {
1384
1384
  i(this, "path");
1385
1385
  i(this, "midpoint");
@@ -1392,41 +1392,41 @@ class At {
1392
1392
  from: h,
1393
1393
  to: d,
1394
1394
  arrowOffset: c,
1395
- detourDistance: g,
1396
- roundness: u
1397
- } = e, l = t ? x(
1395
+ detourDistance: u,
1396
+ roundness: g
1397
+ } = e, l = t ? m(
1398
1398
  { x: h.x + s, y: h.y },
1399
1399
  n,
1400
1400
  h
1401
- ) : h, p = o ? x(
1401
+ ) : h, w = o ? m(
1402
1402
  {
1403
1403
  x: d.x - s,
1404
1404
  y: d.y
1405
1405
  },
1406
1406
  a,
1407
1407
  d
1408
- ) : d, y = s + c, w = x(
1409
- { x: h.x + y, y: h.y },
1408
+ ) : d, p = s + c, y = m(
1409
+ { x: h.x + p, y: h.y },
1410
1410
  n,
1411
1411
  h
1412
- ), f = x(
1413
- { x: d.x - y, y: d.y },
1412
+ ), f = m(
1413
+ { x: d.x - p, y: d.y },
1414
1414
  a,
1415
1415
  d
1416
- ), m = mt(w, f, g);
1416
+ ), x = St(y, f, u);
1417
1417
  this.midpoint = {
1418
- x: m,
1419
- y: (w.y + f.y) / 2
1418
+ x,
1419
+ y: (y.y + f.y) / 2
1420
1420
  }, this.path = R(
1421
1421
  [
1422
1422
  l,
1423
- w,
1424
- { x: m, y: w.y },
1425
- { x: m, y: f.y },
1423
+ y,
1424
+ { x, y: y.y },
1425
+ { x, y: f.y },
1426
1426
  f,
1427
- p
1427
+ w
1428
1428
  ],
1429
- u
1429
+ g
1430
1430
  );
1431
1431
  }
1432
1432
  }
@@ -1452,8 +1452,8 @@ const v = Object.freeze({
1452
1452
  curvature: 90,
1453
1453
  interactiveWidth: 10,
1454
1454
  preOffset: 0
1455
- }), we = (r) => ({ x: Math.cos(r), y: Math.sin(r) });
1456
- class X {
1455
+ }), me = (r) => ({ x: Math.cos(r), y: Math.sin(r) });
1456
+ class G {
1457
1457
  constructor(e) {
1458
1458
  i(this, "svg");
1459
1459
  i(this, "group", document.createElementNS(
@@ -1466,64 +1466,64 @@ class X {
1466
1466
  i(this, "onAfterRender");
1467
1467
  i(this, "afterRenderEmitter");
1468
1468
  i(this, "arrowRenderer");
1469
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = P(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Me(e.color), this.svg.appendChild(this.group), this.line = De(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = Y(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = Y(), this.group.appendChild(this.targetArrow));
1469
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = P(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Re(e.color), this.svg.appendChild(this.group), this.line = Ve(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = H(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = H(), this.group.appendChild(this.targetArrow));
1470
1470
  }
1471
1471
  render(e) {
1472
- const { x: t, y: o, width: s, height: n, from: a, to: h } = Te(
1472
+ const { x: t, y: o, width: s, height: n, from: a, to: h } = Le(
1473
1473
  e.from,
1474
1474
  e.to,
1475
1475
  this.params.padding
1476
1476
  );
1477
- Re(this.svg, { x: t, y: o, width: s, height: n });
1478
- const d = we(e.from.direction), c = we(e.to.direction);
1479
- let g = { x: -c.x, y: -c.y }, u;
1480
- e.category === L.PortCycle ? (u = this.params.createCyclePath, g = d) : e.category === L.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
1481
- const l = u(a, h, d, c);
1477
+ Fe(this.svg, { x: t, y: o, width: s, height: n });
1478
+ const d = me(e.from.direction), c = me(e.to.direction);
1479
+ let u = { x: -c.x, y: -c.y }, g;
1480
+ e.category === V.PortCycle ? (g = this.params.createCyclePath, u = d) : e.category === V.NodeCycle ? g = this.params.createDetourPath : g = this.params.createLinePath;
1481
+ const l = g(a, h, d, c);
1482
1482
  this.line.setAttribute("d", l.path);
1483
- let p = null;
1484
- this.sourceArrow && (p = this.arrowRenderer({
1483
+ let w = null;
1484
+ this.sourceArrow && (w = this.arrowRenderer({
1485
1485
  direction: d,
1486
1486
  shift: a,
1487
1487
  arrowLength: this.params.arrowLength
1488
- }), this.sourceArrow.setAttribute("d", p));
1489
- let y = null;
1490
- this.targetArrow && (y = this.arrowRenderer({
1491
- direction: g,
1488
+ }), this.sourceArrow.setAttribute("d", w));
1489
+ let p = null;
1490
+ this.targetArrow && (p = this.arrowRenderer({
1491
+ direction: u,
1492
1492
  shift: h,
1493
1493
  arrowLength: this.params.arrowLength
1494
- }), this.targetArrow.setAttribute("d", y)), this.afterRenderEmitter.emit({
1494
+ }), this.targetArrow.setAttribute("d", p)), this.afterRenderEmitter.emit({
1495
1495
  edgePath: l,
1496
- sourceArrowPath: p,
1497
- targetArrowPath: y
1496
+ sourceArrowPath: w,
1497
+ targetArrowPath: p
1498
1498
  });
1499
1499
  }
1500
1500
  }
1501
- const Et = (r) => (e) => {
1501
+ const bt = (r) => (e) => {
1502
1502
  const o = [
1503
1503
  { x: 0, y: 0 },
1504
1504
  { x: e.arrowLength, y: r.radius },
1505
1505
  { x: e.arrowLength, y: -r.radius }
1506
1506
  ].map(
1507
- (h) => x(h, e.direction, { x: 0, y: 0 })
1507
+ (h) => m(h, e.direction, { x: 0, y: 0 })
1508
1508
  ).map((h) => ({
1509
1509
  x: h.x + e.shift.x,
1510
1510
  y: h.y + e.shift.y
1511
1511
  })), s = `M ${o[0].x} ${o[0].y}`, n = `L ${o[1].x} ${o[1].y}`, a = `L ${o[2].x} ${o[2].y}`;
1512
1512
  return `${s} ${n} ${a} Z`;
1513
- }, St = (r) => (e) => {
1513
+ }, Pt = (r) => (e) => {
1514
1514
  const t = r.radius, o = e.arrowLength, s = (o * o + 2 * o * t) / (2 * t), n = s + t, a = o + t - t * (o + t) / n, h = t * s / n, c = [
1515
1515
  { x: 0, y: 0 },
1516
1516
  { x: a, y: -h },
1517
1517
  { x: a, y: h }
1518
1518
  ].map(
1519
- (y) => x(y, e.direction, { x: 0, y: 0 })
1520
- ).map((y) => ({
1521
- x: y.x + e.shift.x,
1522
- y: y.y + e.shift.y
1523
- })), g = `M ${c[0].x} ${c[0].y}`, u = `A ${s} ${s} 0 0 0 ${c[1].x} ${c[1].y}`, l = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, p = `A ${s} ${s} 0 0 0 ${c[0].x} ${c[0].y}`;
1524
- return `${g} ${u} ${l} ${p}`;
1525
- }, bt = (r) => (e) => {
1526
- const t = r.smallRadius, o = r.radius, s = x(
1519
+ (p) => m(p, e.direction, { x: 0, y: 0 })
1520
+ ).map((p) => ({
1521
+ x: p.x + e.shift.x,
1522
+ y: p.y + e.shift.y
1523
+ })), u = `M ${c[0].x} ${c[0].y}`, g = `A ${s} ${s} 0 0 0 ${c[1].x} ${c[1].y}`, l = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${s} ${s} 0 0 0 ${c[0].x} ${c[0].y}`;
1524
+ return `${u} ${g} ${l} ${w}`;
1525
+ }, Tt = (r) => (e) => {
1526
+ const t = r.smallRadius, o = r.radius, s = m(
1527
1527
  {
1528
1528
  x: e.arrowLength,
1529
1529
  y: 0
@@ -1537,33 +1537,33 @@ const Et = (r) => (e) => {
1537
1537
  y: 0
1538
1538
  }
1539
1539
  ), a = [{ x: 0, y: 0 }, { x: s.x, y: -s.y }, s].map(
1540
- (u) => x(u, e.direction, { x: 0, y: 0 })
1541
- ).map((u) => ({
1542
- x: u.x + e.shift.x,
1543
- y: u.y + e.shift.y
1544
- })), h = `M ${a[0].x} ${a[0].y}`, d = `A ${o} ${o} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, g = `A ${o} ${o} 0 0 1 ${a[0].x} ${a[0].y}`;
1545
- return `${h} ${d} ${c} ${g}`;
1546
- }, U = (r) => {
1540
+ (g) => m(g, e.direction, { x: 0, y: 0 })
1541
+ ).map((g) => ({
1542
+ x: g.x + e.shift.x,
1543
+ y: g.y + e.shift.y
1544
+ })), h = `M ${a[0].x} ${a[0].y}`, d = `A ${o} ${o} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, u = `A ${o} ${o} 0 0 1 ${a[0].x} ${a[0].y}`;
1545
+ return `${h} ${d} ${c} ${u}`;
1546
+ }, W = (r) => {
1547
1547
  if (typeof r == "function")
1548
1548
  return r;
1549
1549
  switch (r.type) {
1550
1550
  case "triangle":
1551
- return Et({
1551
+ return bt({
1552
1552
  radius: r.radius ?? v.polygonArrowRadius
1553
1553
  });
1554
1554
  case "arc":
1555
- return St({
1555
+ return Pt({
1556
1556
  radius: r.radius ?? v.circleArrowRadius
1557
1557
  });
1558
1558
  default:
1559
- return bt({
1559
+ return Tt({
1560
1560
  smallRadius: r.smallRadius ?? v.wedgeArrowSmallRadius,
1561
1561
  angle: r.angle ?? v.wedgeArrowAngle,
1562
1562
  radius: r.radius ?? v.wedgeArrowRadius
1563
1563
  });
1564
1564
  }
1565
1565
  }, O = 50;
1566
- class Nt {
1566
+ class Ct {
1567
1567
  constructor(e) {
1568
1568
  i(this, "svg");
1569
1569
  i(this, "group");
@@ -1580,7 +1580,7 @@ class Nt {
1580
1580
  i(this, "hasSourceArrow");
1581
1581
  i(this, "hasTargetArrow");
1582
1582
  i(this, "pathShape");
1583
- i(this, "createCyclePath", (e, t, o) => new wt({
1583
+ i(this, "createCyclePath", (e, t, o) => new mt({
1584
1584
  origin: e,
1585
1585
  dir: o,
1586
1586
  radius: this.portCycleRadius,
@@ -1588,7 +1588,7 @@ class Nt {
1588
1588
  arrowLength: this.arrowLength,
1589
1589
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1590
1590
  }));
1591
- i(this, "createDetourPath", (e, t, o, s) => new dt({
1591
+ i(this, "createDetourPath", (e, t, o, s) => new ut({
1592
1592
  from: e,
1593
1593
  to: t,
1594
1594
  fromDir: o,
@@ -1600,7 +1600,7 @@ class Nt {
1600
1600
  hasSourceArrow: this.hasSourceArrow,
1601
1601
  hasTargetArrow: this.hasTargetArrow
1602
1602
  }));
1603
- i(this, "createLinePath", (e, t, o, s) => new ht({
1603
+ i(this, "createLinePath", (e, t, o, s) => new lt({
1604
1604
  from: e,
1605
1605
  to: t,
1606
1606
  fromDir: o,
@@ -1610,10 +1610,10 @@ class Nt {
1610
1610
  hasSourceArrow: this.hasSourceArrow,
1611
1611
  hasTargetArrow: this.hasTargetArrow
1612
1612
  }));
1613
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? v.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? v.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? v.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new X({
1613
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? v.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? v.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? v.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new G({
1614
1614
  color: (e == null ? void 0 : e.color) ?? v.color,
1615
1615
  width: (e == null ? void 0 : e.width) ?? v.width,
1616
- arrowRenderer: U((e == null ? void 0 : e.arrowRenderer) ?? {}),
1616
+ arrowRenderer: W((e == null ? void 0 : e.arrowRenderer) ?? {}),
1617
1617
  arrowLength: this.arrowLength,
1618
1618
  hasSourceArrow: this.hasSourceArrow,
1619
1619
  hasTargetArrow: this.hasTargetArrow,
@@ -1627,7 +1627,7 @@ class Nt {
1627
1627
  this.pathShape.render(e);
1628
1628
  }
1629
1629
  }
1630
- class Pt {
1630
+ class Mt {
1631
1631
  constructor(e) {
1632
1632
  i(this, "svg");
1633
1633
  i(this, "group");
@@ -1643,7 +1643,7 @@ class Pt {
1643
1643
  i(this, "hasSourceArrow");
1644
1644
  i(this, "hasTargetArrow");
1645
1645
  i(this, "pathShape");
1646
- i(this, "createCyclePath", (e, t, o) => new te({
1646
+ i(this, "createCyclePath", (e, t, o) => new re({
1647
1647
  origin: e,
1648
1648
  dir: o,
1649
1649
  arrowLength: this.arrowLength,
@@ -1652,7 +1652,7 @@ class Pt {
1652
1652
  roundness: this.roundness,
1653
1653
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1654
1654
  }));
1655
- i(this, "createDetourPath", (e, t, o, s) => new xt({
1655
+ i(this, "createDetourPath", (e, t, o, s) => new At({
1656
1656
  from: e,
1657
1657
  to: t,
1658
1658
  fromDir: o,
@@ -1664,7 +1664,7 @@ class Pt {
1664
1664
  hasSourceArrow: this.hasSourceArrow,
1665
1665
  hasTargetArrow: this.hasTargetArrow
1666
1666
  }));
1667
- i(this, "createLinePath", (e, t, o, s) => new lt({
1667
+ i(this, "createLinePath", (e, t, o, s) => new pt({
1668
1668
  from: e,
1669
1669
  to: t,
1670
1670
  fromDir: o,
@@ -1681,10 +1681,10 @@ class Pt {
1681
1681
  t,
1682
1682
  this.arrowOffset,
1683
1683
  this.cycleSquareSide / 2
1684
- ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new X({
1684
+ ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new G({
1685
1685
  color: (e == null ? void 0 : e.color) ?? v.color,
1686
1686
  width: (e == null ? void 0 : e.width) ?? v.width,
1687
- arrowRenderer: U((e == null ? void 0 : e.arrowRenderer) ?? {}),
1687
+ arrowRenderer: W((e == null ? void 0 : e.arrowRenderer) ?? {}),
1688
1688
  arrowLength: this.arrowLength,
1689
1689
  hasSourceArrow: this.hasSourceArrow,
1690
1690
  hasTargetArrow: this.hasTargetArrow,
@@ -1698,7 +1698,7 @@ class Pt {
1698
1698
  this.pathShape.render(e);
1699
1699
  }
1700
1700
  }
1701
- class Ct {
1701
+ class Dt {
1702
1702
  constructor(e) {
1703
1703
  i(this, "svg");
1704
1704
  i(this, "group");
@@ -1715,7 +1715,7 @@ class Ct {
1715
1715
  i(this, "hasSourceArrow");
1716
1716
  i(this, "hasTargetArrow");
1717
1717
  i(this, "pathShape");
1718
- i(this, "createCyclePath", (e, t, o) => new te({
1718
+ i(this, "createCyclePath", (e, t, o) => new re({
1719
1719
  origin: e,
1720
1720
  dir: o,
1721
1721
  arrowLength: this.arrowLength,
@@ -1724,7 +1724,7 @@ class Ct {
1724
1724
  roundness: this.roundness,
1725
1725
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1726
1726
  }));
1727
- i(this, "createDetourPath", (e, t, o, s) => new gt({
1727
+ i(this, "createDetourPath", (e, t, o, s) => new wt({
1728
1728
  from: e,
1729
1729
  to: t,
1730
1730
  fromDir: o,
@@ -1737,7 +1737,7 @@ class Ct {
1737
1737
  hasSourceArrow: this.hasSourceArrow,
1738
1738
  hasTargetArrow: this.hasTargetArrow
1739
1739
  }));
1740
- i(this, "createLinePath", (e, t, o, s) => new ut({
1740
+ i(this, "createLinePath", (e, t, o, s) => new yt({
1741
1741
  from: e,
1742
1742
  to: t,
1743
1743
  fromDir: o,
@@ -1754,10 +1754,10 @@ class Ct {
1754
1754
  t,
1755
1755
  this.arrowOffset,
1756
1756
  this.cycleSquareSide / 2
1757
- ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new X({
1757
+ ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new G({
1758
1758
  color: (e == null ? void 0 : e.color) ?? v.color,
1759
1759
  width: (e == null ? void 0 : e.width) ?? v.width,
1760
- arrowRenderer: U((e == null ? void 0 : e.arrowRenderer) ?? {}),
1760
+ arrowRenderer: W((e == null ? void 0 : e.arrowRenderer) ?? {}),
1761
1761
  arrowLength: this.arrowLength,
1762
1762
  hasSourceArrow: this.hasSourceArrow,
1763
1763
  hasTargetArrow: this.hasTargetArrow,
@@ -1771,7 +1771,7 @@ class Ct {
1771
1771
  this.pathShape.render(e);
1772
1772
  }
1773
1773
  }
1774
- class Tt {
1774
+ class Lt {
1775
1775
  constructor(e) {
1776
1776
  i(this, "svg");
1777
1777
  i(this, "group");
@@ -1787,7 +1787,7 @@ class Tt {
1787
1787
  i(this, "hasSourceArrow");
1788
1788
  i(this, "hasTargetArrow");
1789
1789
  i(this, "pathShape");
1790
- i(this, "createCyclePath", (e, t, o) => new te({
1790
+ i(this, "createCyclePath", (e, t, o) => new re({
1791
1791
  origin: e,
1792
1792
  dir: o,
1793
1793
  arrowLength: this.arrowLength,
@@ -1796,7 +1796,7 @@ class Tt {
1796
1796
  roundness: this.roundness,
1797
1797
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1798
1798
  }));
1799
- i(this, "createDetourPath", (e, t, o, s) => new At({
1799
+ i(this, "createDetourPath", (e, t, o, s) => new Nt({
1800
1800
  from: e,
1801
1801
  to: t,
1802
1802
  fromDir: o,
@@ -1808,7 +1808,7 @@ class Tt {
1808
1808
  hasSourceArrow: this.hasSourceArrow,
1809
1809
  hasTargetArrow: this.hasTargetArrow
1810
1810
  }));
1811
- i(this, "createLinePath", (e, t, o, s) => new yt({
1811
+ i(this, "createLinePath", (e, t, o, s) => new vt({
1812
1812
  from: e,
1813
1813
  to: t,
1814
1814
  fromDir: o,
@@ -1825,10 +1825,10 @@ class Tt {
1825
1825
  t,
1826
1826
  this.arrowOffset,
1827
1827
  this.cycleSquareSide / 2
1828
- ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new X({
1828
+ ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new G({
1829
1829
  color: (e == null ? void 0 : e.color) ?? v.color,
1830
1830
  width: (e == null ? void 0 : e.width) ?? v.width,
1831
- arrowRenderer: U((e == null ? void 0 : e.arrowRenderer) ?? {}),
1831
+ arrowRenderer: W((e == null ? void 0 : e.arrowRenderer) ?? {}),
1832
1832
  arrowLength: this.arrowLength,
1833
1833
  hasSourceArrow: this.hasSourceArrow,
1834
1834
  hasTargetArrow: this.hasTargetArrow,
@@ -1842,7 +1842,7 @@ class Tt {
1842
1842
  this.pathShape.render(e);
1843
1843
  }
1844
1844
  }
1845
- class Le {
1845
+ class Ie {
1846
1846
  constructor(e) {
1847
1847
  i(this, "svg");
1848
1848
  i(this, "group", document.createElementNS(
@@ -1860,16 +1860,16 @@ class Le {
1860
1860
  i(this, "onAfterRender");
1861
1861
  i(this, "afterRenderEmitter");
1862
1862
  i(this, "arrowRenderer");
1863
- [this.afterRenderEmitter, this.onAfterRender] = P(), this.color = (e == null ? void 0 : e.color) ?? v.color, this.width = (e == null ? void 0 : e.width) ?? v.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.arrowRenderer = U((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? v.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? v.preOffset, this.svg = Me(this.color), this.svg.appendChild(this.group), this.line = De(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = Y(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = Y(), this.group.appendChild(this.targetArrow));
1863
+ [this.afterRenderEmitter, this.onAfterRender] = P(), this.color = (e == null ? void 0 : e.color) ?? v.color, this.width = (e == null ? void 0 : e.width) ?? v.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.arrowRenderer = W((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? v.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? v.preOffset, this.svg = Re(this.color), this.svg.appendChild(this.group), this.line = Ve(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = H(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = H(), this.group.appendChild(this.targetArrow));
1864
1864
  }
1865
1865
  render(e) {
1866
- const { x: t, y: o, width: s, height: n, from: a, to: h } = Te(
1866
+ const { x: t, y: o, width: s, height: n, from: a, to: h } = Le(
1867
1867
  e.from,
1868
1868
  e.to,
1869
1869
  O
1870
1870
  );
1871
- Re(this.svg, { x: t, y: o, width: s, height: n });
1872
- const d = new ft({
1871
+ Fe(this.svg, { x: t, y: o, width: s, height: n });
1872
+ const d = new xt({
1873
1873
  from: a,
1874
1874
  to: h,
1875
1875
  sourceOffset: this.sourceOffset,
@@ -1879,82 +1879,82 @@ class Le {
1879
1879
  arrowLength: this.arrowLength
1880
1880
  });
1881
1881
  this.line.setAttribute("d", d.path);
1882
- let c = null, g = null;
1883
- const u = d.diagonalDistance;
1884
- if (u === 0)
1885
- this.sourceArrow !== null && (c = "", this.sourceArrow.setAttribute("d", c)), this.targetArrow !== null && (g = "", this.targetArrow.setAttribute("d", g));
1882
+ let c = null, u = null;
1883
+ const g = d.diagonalDistance;
1884
+ if (g === 0)
1885
+ this.sourceArrow !== null && (c = "", this.sourceArrow.setAttribute("d", c)), this.targetArrow !== null && (u = "", this.targetArrow.setAttribute("d", u));
1886
1886
  else {
1887
1887
  const l = {
1888
- x: (h.x - a.x) / u,
1889
- y: (h.y - a.y) / u
1888
+ x: (h.x - a.x) / g,
1889
+ y: (h.y - a.y) / g
1890
1890
  };
1891
1891
  if (this.sourceArrow) {
1892
- const p = {
1892
+ const w = {
1893
1893
  x: l.x * this.sourceOffset,
1894
1894
  y: l.y * this.sourceOffset
1895
1895
  };
1896
1896
  c = this.arrowRenderer({
1897
1897
  direction: l,
1898
- shift: p,
1898
+ shift: w,
1899
1899
  arrowLength: this.arrowLength
1900
1900
  }), this.sourceArrow.setAttribute("d", c);
1901
1901
  }
1902
1902
  if (this.targetArrow) {
1903
- const p = {
1903
+ const w = {
1904
1904
  x: l.x * this.targetOffset,
1905
1905
  y: l.y * this.targetOffset
1906
1906
  };
1907
- g = this.arrowRenderer({
1907
+ u = this.arrowRenderer({
1908
1908
  direction: { x: -l.x, y: -l.y },
1909
1909
  shift: {
1910
- x: h.x - p.x,
1911
- y: h.y - p.y
1910
+ x: h.x - w.x,
1911
+ y: h.y - w.y
1912
1912
  },
1913
1913
  arrowLength: this.arrowLength
1914
- }), this.targetArrow.setAttribute("d", g);
1914
+ }), this.targetArrow.setAttribute("d", u);
1915
1915
  }
1916
1916
  }
1917
1917
  this.afterRenderEmitter.emit({
1918
1918
  edgePath: d,
1919
1919
  sourceArrowPath: c,
1920
- targetArrowPath: g
1920
+ targetArrowPath: u
1921
1921
  });
1922
1922
  }
1923
1923
  }
1924
- const Mt = () => {
1924
+ const Rt = () => {
1925
1925
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1926
1926
  return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
1927
- }, Dt = (r) => {
1927
+ }, Vt = (r) => {
1928
1928
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1929
1929
  return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
1930
- }, fe = (r) => {
1930
+ }, xe = (r) => {
1931
1931
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1932
1932
  return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
1933
1933
  };
1934
- class Rt extends Error {
1934
+ class Ft extends Error {
1935
1935
  constructor(e) {
1936
1936
  super(e), this.name = "InteractiveEdgeError";
1937
1937
  }
1938
1938
  }
1939
- class Fe {
1939
+ class Ue {
1940
1940
  constructor(e, t) {
1941
1941
  i(this, "svg");
1942
1942
  i(this, "group");
1943
1943
  i(this, "line");
1944
1944
  i(this, "sourceArrow");
1945
1945
  i(this, "targetArrow");
1946
- i(this, "handle", Mt());
1946
+ i(this, "handle", Rt());
1947
1947
  i(this, "onAfterRender");
1948
1948
  i(this, "interactiveLine");
1949
1949
  i(this, "interactiveSourceArrow", null);
1950
1950
  i(this, "interactiveTargetArrow", null);
1951
- if (this.baseEdge = e, e instanceof Fe)
1952
- throw new Rt(
1951
+ if (this.baseEdge = e, e instanceof Ue)
1952
+ throw new Ft(
1953
1953
  "interactive edge can be configured only once"
1954
1954
  );
1955
1955
  this.svg = this.baseEdge.svg, this.group = this.baseEdge.group, this.line = this.baseEdge.line, this.sourceArrow = this.baseEdge.sourceArrow, this.targetArrow = this.baseEdge.targetArrow, this.onAfterRender = this.baseEdge.onAfterRender;
1956
1956
  const o = (t == null ? void 0 : t.distance) ?? v.interactiveWidth;
1957
- this.interactiveLine = Dt(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = fe(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = fe(o), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((s) => {
1957
+ this.interactiveLine = Vt(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = xe(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = xe(o), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((s) => {
1958
1958
  this.interactiveLine.setAttribute("d", s.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", s.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", s.targetArrowPath);
1959
1959
  });
1960
1960
  }
@@ -1962,7 +1962,7 @@ class Fe {
1962
1962
  this.baseEdge.render(e);
1963
1963
  }
1964
1964
  }
1965
- class Mr {
1965
+ class Fr {
1966
1966
  constructor(e, t) {
1967
1967
  i(this, "group");
1968
1968
  i(this, "line");
@@ -1979,7 +1979,7 @@ class Mr {
1979
1979
  this.baseShape.render(e);
1980
1980
  }
1981
1981
  }
1982
- class Ie {
1982
+ class $e {
1983
1983
  constructor(e) {
1984
1984
  i(this, "onAfterNodeAdded");
1985
1985
  i(this, "onAfterNodeUpdated");
@@ -2075,7 +2075,7 @@ class Ie {
2075
2075
  return this.graphStore.getNodeAdjacentEdgeIds(e);
2076
2076
  }
2077
2077
  }
2078
- class J {
2078
+ class K {
2079
2079
  constructor(e) {
2080
2080
  i(this, "counter", 0);
2081
2081
  this.checkExists = e;
@@ -2091,15 +2091,15 @@ class J {
2091
2091
  this.counter = 0;
2092
2092
  }
2093
2093
  }
2094
- class Ve {
2094
+ class Be {
2095
2095
  constructor(e, t, o) {
2096
- i(this, "nodeIdGenerator", new J(
2096
+ i(this, "nodeIdGenerator", new K(
2097
2097
  (e) => this.graphStore.hasNode(e)
2098
2098
  ));
2099
- i(this, "portIdGenerator", new J(
2099
+ i(this, "portIdGenerator", new K(
2100
2100
  (e) => this.graphStore.hasPort(e)
2101
2101
  ));
2102
- i(this, "edgeIdGenerator", new J(
2102
+ i(this, "edgeIdGenerator", new K(
2103
2103
  (e) => this.graphStore.hasEdge(e)
2104
2104
  ));
2105
2105
  i(this, "onAfterNodeAdded", (e) => {
@@ -2222,18 +2222,18 @@ class Ve {
2222
2222
  ), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
2223
2223
  }
2224
2224
  }
2225
- const Lt = (r) => {
2225
+ const It = (r) => {
2226
2226
  setTimeout(() => {
2227
2227
  r();
2228
2228
  });
2229
- }, Ft = (r) => {
2229
+ }, Ut = (r) => {
2230
2230
  queueMicrotask(() => {
2231
2231
  r();
2232
2232
  });
2233
- }, re = (r) => {
2233
+ }, oe = (r) => {
2234
2234
  r();
2235
2235
  };
2236
- class $e {
2236
+ class We {
2237
2237
  constructor(e) {
2238
2238
  i(this, "onBeforeUpdated");
2239
2239
  i(this, "onAfterUpdated");
@@ -2256,26 +2256,26 @@ class $e {
2256
2256
  return this.viewportStore.createViewportCoords(e);
2257
2257
  }
2258
2258
  }
2259
- const It = (r, e) => Symbol.iterator in r ? {
2259
+ const $t = (r, e) => Symbol.iterator in r ? {
2260
2260
  minContentScale: e.focus.minContentScale,
2261
2261
  nodes: r,
2262
- contentOffset: e.focus.contentOffset,
2262
+ contentPadding: e.focus.contentPadding,
2263
2263
  animationDuration: e.focus.animationDuration
2264
2264
  } : {
2265
2265
  minContentScale: r.minContentScale ?? e.focus.minContentScale,
2266
2266
  nodes: r.nodes ?? [],
2267
- contentOffset: r.contentOffset ?? e.focus.contentOffset,
2267
+ contentPadding: r.contentPadding ?? r.contentOffset ?? e.focus.contentPadding,
2268
2268
  animationDuration: r.animationDuration ?? e.focus.animationDuration
2269
- }, Be = (r, e, t) => ({
2269
+ }, Oe = (r, e, t) => ({
2270
2270
  scale: r.scale,
2271
2271
  x: r.x + r.scale * e,
2272
2272
  y: r.y + r.scale * t
2273
- }), Ue = (r, e, t, o) => ({
2273
+ }), ze = (r, e, t, o) => ({
2274
2274
  scale: r.scale * e,
2275
2275
  x: r.scale * (1 - e) * t + r.x,
2276
2276
  y: r.scale * (1 - e) * o + r.y
2277
2277
  });
2278
- class Oe {
2278
+ class ke {
2279
2279
  constructor(e, t, o, s) {
2280
2280
  this.graphStore = e, this.viewportStore = t, this.params = o, this.win = s;
2281
2281
  }
@@ -2287,22 +2287,22 @@ class Oe {
2287
2287
  }
2288
2288
  center(e, t) {
2289
2289
  const { width: o, height: s } = this.viewportStore.getDimensions(), n = { x: o / 2, y: s / 2 }, a = this.viewportStore.getViewportMatrix(), h = this.viewportStore.createViewportCoords(e), d = h.x - n.x, c = h.y - n.y;
2290
- let g = Be(a, d, c);
2291
- const u = t == null ? void 0 : t.contentScale;
2292
- if (u !== void 0) {
2293
- const p = 1 / u;
2294
- g = Ue(
2295
- g,
2296
- p / a.scale,
2290
+ let u = Oe(a, d, c);
2291
+ const g = t == null ? void 0 : t.contentScale;
2292
+ if (g !== void 0) {
2293
+ const w = 1 / g;
2294
+ u = ze(
2295
+ u,
2296
+ w / a.scale,
2297
2297
  n.x,
2298
2298
  n.y
2299
2299
  );
2300
2300
  }
2301
2301
  const l = (t == null ? void 0 : t.animationDuration) ?? 0;
2302
- l > 0 ? this.animateNavigation(a, g, l) : this.viewportStore.patchViewportMatrix(g);
2302
+ l > 0 ? this.animateNavigation(a, u, l) : this.viewportStore.patchViewportMatrix(u);
2303
2303
  }
2304
2304
  focus(e) {
2305
- const t = It(e ?? {}, this.params);
2305
+ const t = $t(e ?? {}, this.params);
2306
2306
  this.params.focus.schedule(() => {
2307
2307
  this.navigate(t);
2308
2308
  });
@@ -2319,14 +2319,14 @@ class Oe {
2319
2319
  const { payload: c } = this.graphStore.getNode(d);
2320
2320
  c.x !== null && c.y !== null && (h.size === 0 || h.has(d)) && (t = Math.min(c.x, t), o = Math.max(c.x, o), s = Math.min(c.y, s), n = Math.max(c.y, n), a++);
2321
2321
  }), a > 0) {
2322
- t -= e.contentOffset, s -= e.contentOffset, o += e.contentOffset, n += e.contentOffset;
2322
+ t -= e.contentPadding, s -= e.contentPadding, o += e.contentPadding, n += e.contentPadding;
2323
2323
  const d = {
2324
2324
  x: (t + o) / 2,
2325
2325
  y: (s + n) / 2
2326
- }, { scale: c } = this.viewportStore.getContentMatrix(), g = (n - s) * c, u = (o - t) * c, { width: l, height: p } = this.viewportStore.getDimensions(), y = Math.max(
2327
- u / l,
2328
- g / p
2329
- ), w = y > 1 ? c / y : c, f = Math.max(w, e.minContentScale);
2326
+ }, { scale: c } = this.viewportStore.getContentMatrix(), u = (n - s) * c, g = (o - t) * c, { width: l, height: w } = this.viewportStore.getDimensions(), p = Math.max(
2327
+ g / l,
2328
+ u / w
2329
+ ), y = p > 1 ? c / p : c, f = Math.max(y, e.minContentScale);
2330
2330
  this.center(d, {
2331
2331
  contentScale: f,
2332
2332
  animationDuration: e.animationDuration
@@ -2351,39 +2351,39 @@ class Oe {
2351
2351
  this.win.requestAnimationFrame(a);
2352
2352
  }
2353
2353
  }
2354
- const We = (r, e, t) => {
2355
- const o = new be(), s = new Ie(o), n = new $e(e), a = new Ee(o, e, r), h = {
2354
+ const Ye = (r, e, t) => {
2355
+ const o = new Te(), s = new $e(o), n = new We(e), a = new be(o, e, r), h = {
2356
2356
  nodes: {
2357
- centerFn: Ce,
2357
+ centerFn: De,
2358
2358
  priorityFn: () => 0
2359
2359
  },
2360
2360
  edges: {
2361
- shapeFactory: () => new Le(),
2361
+ shapeFactory: () => new Ie(),
2362
2362
  priorityFn: () => 0
2363
2363
  },
2364
2364
  ports: {
2365
2365
  direction: 0
2366
2366
  }
2367
- }, d = new Ve(
2367
+ }, d = new Be(
2368
2368
  o,
2369
2369
  a,
2370
2370
  h
2371
2371
  ), c = {
2372
2372
  focus: {
2373
- contentOffset: 0,
2373
+ contentPadding: 0,
2374
2374
  minContentScale: 0,
2375
- schedule: re,
2375
+ schedule: oe,
2376
2376
  animationDuration: 0
2377
2377
  }
2378
- }, g = new Oe(
2378
+ }, u = new ke(
2379
2379
  o,
2380
2380
  e,
2381
2381
  c,
2382
2382
  t
2383
2383
  );
2384
- return new Se(s, n, d, g);
2384
+ return new Pe(s, n, d, u);
2385
2385
  };
2386
- class G {
2386
+ class j {
2387
2387
  constructor(e, t, o, s) {
2388
2388
  i(this, "onAfterPortMarked", (e) => {
2389
2389
  const t = this.canvas.graph.getPort(e);
@@ -2408,7 +2408,7 @@ class G {
2408
2408
  }));
2409
2409
  });
2410
2410
  i(this, "onWindowMouseMove", (e) => {
2411
- if (!F(
2411
+ if (!D(
2412
2412
  this.window,
2413
2413
  this.element,
2414
2414
  e.clientX,
@@ -2440,7 +2440,7 @@ class G {
2440
2440
  });
2441
2441
  i(this, "onWindowTouchMove", (e) => {
2442
2442
  const t = e.touches[0];
2443
- if (!F(
2443
+ if (!D(
2444
2444
  this.window,
2445
2445
  this.element,
2446
2446
  t.clientX,
@@ -2467,7 +2467,7 @@ class G {
2467
2467
  this.canvas = e, this.element = t, this.window = o, this.params = s, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
2468
2468
  }
2469
2469
  static configure(e, t, o, s) {
2470
- new G(e, t, o, s);
2470
+ new j(e, t, o, s);
2471
2471
  }
2472
2472
  hookPortEvents(e) {
2473
2473
  e.addEventListener("mousedown", this.onPortMouseDown, {
@@ -2492,7 +2492,7 @@ class G {
2492
2492
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2493
2493
  }
2494
2494
  }
2495
- class Vt {
2495
+ class Bt {
2496
2496
  constructor(e, t, o) {
2497
2497
  this.canvas = e, this.layoutAlgorithm = t, this.params = o;
2498
2498
  }
@@ -2506,7 +2506,7 @@ class Vt {
2506
2506
  }), this.params.onAfterApplied();
2507
2507
  }
2508
2508
  }
2509
- class $t {
2509
+ class Wt {
2510
2510
  constructor(e, t, o) {
2511
2511
  this.canvas = e, this.layoutAlgorithm = t, this.params = o;
2512
2512
  }
@@ -2521,7 +2521,7 @@ class $t {
2521
2521
  }), this.params.onAfterApplied();
2522
2522
  }
2523
2523
  }
2524
- class oe {
2524
+ class se {
2525
2525
  constructor(e, t, o, s) {
2526
2526
  i(this, "grabbedNode", null);
2527
2527
  i(this, "maxNodePriority", 0);
@@ -2558,7 +2558,7 @@ class oe {
2558
2558
  nodeId: s,
2559
2559
  dx: h.x - n.x,
2560
2560
  dy: h.y - n.y
2561
- }, k(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2561
+ }, Y(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2562
2562
  passive: !0
2563
2563
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2564
2564
  passive: !0
@@ -2594,13 +2594,13 @@ class oe {
2594
2594
  });
2595
2595
  });
2596
2596
  i(this, "onWindowMouseMove", (e) => {
2597
- if (!F(
2597
+ if (!D(
2598
2598
  this.window,
2599
2599
  this.element,
2600
2600
  e.clientX,
2601
2601
  e.clientY
2602
2602
  )) {
2603
- this.cancelMouseDrag();
2603
+ this.stopMouseDrag();
2604
2604
  return;
2605
2605
  }
2606
2606
  this.grabbedNode !== null && this.moveNode(this.grabbedNode, {
@@ -2609,19 +2609,19 @@ class oe {
2609
2609
  });
2610
2610
  });
2611
2611
  i(this, "onWindowMouseUp", (e) => {
2612
- this.params.mouseUpEventVerifier(e) && this.cancelMouseDrag();
2612
+ this.params.mouseUpEventVerifier(e) && this.stopMouseDrag();
2613
2613
  });
2614
2614
  i(this, "onWindowTouchMove", (e) => {
2615
2615
  if (e.touches.length !== 1)
2616
2616
  return;
2617
2617
  const t = e.touches[0];
2618
- if (!F(
2618
+ if (!D(
2619
2619
  this.window,
2620
2620
  this.element,
2621
2621
  t.clientX,
2622
2622
  t.clientY
2623
2623
  )) {
2624
- this.cancelTouchDrag();
2624
+ this.stopTouchDrag();
2625
2625
  return;
2626
2626
  }
2627
2627
  this.grabbedNode !== null && this.moveNode(this.grabbedNode, {
@@ -2630,7 +2630,7 @@ class oe {
2630
2630
  });
2631
2631
  });
2632
2632
  i(this, "onWindowTouchFinish", () => {
2633
- this.cancelTouchDrag();
2633
+ this.stopTouchDrag();
2634
2634
  });
2635
2635
  i(this, "reset", () => {
2636
2636
  this.canvas.graph.getAllNodeIds().forEach((e) => {
@@ -2644,7 +2644,7 @@ class oe {
2644
2644
  this.canvas = e, this.element = t, this.window = o, this.params = s, this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
2645
2645
  }
2646
2646
  static configure(e, t, o, s) {
2647
- new oe(e, t, o, s);
2647
+ new se(e, t, o, s);
2648
2648
  }
2649
2649
  moveNode(e, t) {
2650
2650
  if (!this.graph.hasNode(e.nodeId))
@@ -2669,13 +2669,13 @@ class oe {
2669
2669
  this.canvas.updateNode(e, { priority: this.maxNodePriority });
2670
2670
  }
2671
2671
  }
2672
- cancelMouseDrag() {
2673
- this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, k(this.element, null), this.removeMouseDragListeners();
2672
+ stopMouseDrag() {
2673
+ this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, Y(this.element, null), this.removeMouseDragListeners();
2674
2674
  }
2675
2675
  removeMouseDragListeners() {
2676
2676
  this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
2677
2677
  }
2678
- cancelTouchDrag() {
2678
+ stopTouchDrag() {
2679
2679
  if (this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId)) {
2680
2680
  const e = this.graph.getNode(this.grabbedNode.nodeId);
2681
2681
  this.params.onNodeDragFinished({
@@ -2713,7 +2713,7 @@ class oe {
2713
2713
  return e;
2714
2714
  }
2715
2715
  }
2716
- const W = (r) => {
2716
+ const z = (r) => {
2717
2717
  const e = [], t = r.touches.length;
2718
2718
  for (let h = 0; h < t; h++)
2719
2719
  e.push([r.touches[h].clientX, r.touches[h].clientY]);
@@ -2732,7 +2732,7 @@ const W = (r) => {
2732
2732
  touches: e
2733
2733
  };
2734
2734
  };
2735
- class j {
2735
+ class J {
2736
2736
  constructor(e, t, o, s) {
2737
2737
  i(this, "viewport");
2738
2738
  i(this, "prevTouches", null);
@@ -2742,14 +2742,14 @@ class j {
2742
2742
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2743
2743
  });
2744
2744
  i(this, "onMouseDown", (e) => {
2745
- this.params.mouseDownEventVerifier(e) && (k(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2745
+ this.params.mouseDownEventVerifier(e) && (Y(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2746
2746
  passive: !0
2747
2747
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2748
2748
  passive: !0
2749
2749
  }), this.startRegisteredTransform());
2750
2750
  });
2751
2751
  i(this, "onWindowMouseMove", (e) => {
2752
- const t = F(
2752
+ const t = D(
2753
2753
  this.window,
2754
2754
  this.element,
2755
2755
  e.clientX,
@@ -2775,10 +2775,10 @@ class j {
2775
2775
  });
2776
2776
  i(this, "onTouchStart", (e) => {
2777
2777
  if (this.prevTouches !== null) {
2778
- this.prevTouches = W(e);
2778
+ this.prevTouches = z(e);
2779
2779
  return;
2780
2780
  }
2781
- this.prevTouches = W(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2781
+ this.prevTouches = z(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2782
2782
  passive: !0
2783
2783
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
2784
2784
  passive: !0
@@ -2787,9 +2787,9 @@ class j {
2787
2787
  }), this.startRegisteredTransform();
2788
2788
  });
2789
2789
  i(this, "onWindowTouchMove", (e) => {
2790
- const t = W(e);
2790
+ const t = z(e);
2791
2791
  if (!t.touches.every(
2792
- (s) => F(this.window, this.element, s[0], s[1])
2792
+ (s) => D(this.window, this.element, s[0], s[1])
2793
2793
  )) {
2794
2794
  this.stopTouchDrag();
2795
2795
  return;
@@ -2804,7 +2804,7 @@ class j {
2804
2804
  this.prevTouches = t;
2805
2805
  });
2806
2806
  i(this, "onWindowTouchFinish", (e) => {
2807
- e.touches.length > 0 ? this.prevTouches = W(e) : this.stopTouchDrag();
2807
+ e.touches.length > 0 ? this.prevTouches = z(e) : this.stopTouchDrag();
2808
2808
  });
2809
2809
  i(this, "preventWheelScaleListener", (e) => {
2810
2810
  e.preventDefault();
@@ -2822,10 +2822,10 @@ class j {
2822
2822
  }), e.onBeforeDestroy.subscribe(this.revert);
2823
2823
  }
2824
2824
  static configure(e, t, o, s) {
2825
- new j(e, t, o, s);
2825
+ new J(e, t, o, s);
2826
2826
  }
2827
2827
  moveViewport(e, t) {
2828
- const o = this.viewport.getViewportMatrix(), s = Be(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2828
+ const o = this.viewport.getViewportMatrix(), s = Oe(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2829
2829
  prevTransform: o,
2830
2830
  nextTransform: s,
2831
2831
  canvasWidth: n,
@@ -2834,7 +2834,7 @@ class j {
2834
2834
  this.performTransform(h);
2835
2835
  }
2836
2836
  scaleViewport(e, t, o) {
2837
- const s = this.canvas.viewport.getViewportMatrix(), n = Ue(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2837
+ const s = this.canvas.viewport.getViewportMatrix(), n = ze(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2838
2838
  prevTransform: s,
2839
2839
  nextTransform: n,
2840
2840
  canvasWidth: a,
@@ -2843,7 +2843,7 @@ class j {
2843
2843
  this.performTransform(d);
2844
2844
  }
2845
2845
  stopMouseDrag() {
2846
- k(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
2846
+ Y(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
2847
2847
  }
2848
2848
  removeMouseDragListeners() {
2849
2849
  this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
@@ -2873,7 +2873,7 @@ class j {
2873
2873
  this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(s), this.params.onResizeTransformFinished();
2874
2874
  }
2875
2875
  }
2876
- class se {
2876
+ class ie {
2877
2877
  constructor(e, t, o, s, n, a) {
2878
2878
  i(this, "nodeHorizontal");
2879
2879
  i(this, "nodeVertical");
@@ -2920,7 +2920,7 @@ class se {
2920
2920
  this.scheduleLoadAreaAroundViewport(), s.onTransformFinished();
2921
2921
  }
2922
2922
  };
2923
- j.configure(
2923
+ J.configure(
2924
2924
  e,
2925
2925
  this.element,
2926
2926
  this.window,
@@ -2928,7 +2928,7 @@ class se {
2928
2928
  ), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
2929
2929
  }
2930
2930
  static configure(e, t, o, s, n, a) {
2931
- new se(
2931
+ new ie(
2932
2932
  e,
2933
2933
  t,
2934
2934
  o,
@@ -2944,38 +2944,38 @@ class se {
2944
2944
  }
2945
2945
  scheduleEnsureViewportAreaLoaded() {
2946
2946
  setTimeout(() => {
2947
- const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - this.nodeHorizontal, c = n - this.nodeVertical, g = s + a + this.nodeHorizontal, u = n + h + this.nodeVertical;
2948
- this.loadedArea.xFrom < d && this.loadedArea.xTo > g && this.loadedArea.yFrom < c && this.loadedArea.yTo > u || this.loadAreaAroundViewport();
2947
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - this.nodeHorizontal, c = n - this.nodeVertical, u = s + a + this.nodeHorizontal, g = n + h + this.nodeVertical;
2948
+ this.loadedArea.xFrom < d && this.loadedArea.xTo > u && this.loadedArea.yFrom < c && this.loadedArea.yTo > g || this.loadAreaAroundViewport();
2949
2949
  });
2950
2950
  }
2951
2951
  loadAreaAroundViewport() {
2952
- const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - a - this.nodeHorizontal, c = n - h - this.nodeVertical, g = 3 * a + 2 * this.nodeHorizontal, u = 3 * h + 2 * this.nodeVertical;
2952
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - a - this.nodeHorizontal, c = n - h - this.nodeVertical, u = 3 * a + 2 * this.nodeHorizontal, g = 3 * h + 2 * this.nodeVertical;
2953
2953
  this.trigger.emit({
2954
2954
  x: d,
2955
2955
  y: c,
2956
- width: g,
2957
- height: u
2956
+ width: u,
2957
+ height: g
2958
2958
  });
2959
2959
  }
2960
2960
  }
2961
- const Bt = () => {
2961
+ const Ot = () => {
2962
2962
  const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2963
2963
  return r.style.position = "absolute", r.style.inset = "0", r;
2964
- }, Ut = () => {
2964
+ }, zt = () => {
2965
2965
  const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2966
2966
  return r.setAttribute("fill", "url(#pattern)"), r;
2967
- }, Ot = () => {
2967
+ }, kt = () => {
2968
2968
  const r = document.createElementNS(
2969
2969
  "http://www.w3.org/2000/svg",
2970
2970
  "pattern"
2971
2971
  );
2972
2972
  return r.setAttribute("id", "pattern"), r;
2973
2973
  };
2974
- class ie {
2974
+ class ne {
2975
2975
  constructor(e, t, o) {
2976
- i(this, "svg", Bt());
2977
- i(this, "patternRenderingRectangle", Ut());
2978
- i(this, "pattern", Ot());
2976
+ i(this, "svg", Ot());
2977
+ i(this, "patternRenderingRectangle", zt());
2978
+ i(this, "pattern", kt());
2979
2979
  i(this, "patternContent");
2980
2980
  i(this, "tileWidth");
2981
2981
  i(this, "tileHeight");
@@ -2996,7 +2996,7 @@ class ie {
2996
2996
  }), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
2997
2997
  }
2998
2998
  static configure(e, t, o) {
2999
- new ie(e, t, o);
2999
+ new ne(e, t, o);
3000
3000
  }
3001
3001
  updateVisibility() {
3002
3002
  const { scale: e } = this.canvas.viewport.getViewportMatrix(), t = e > this.maxViewportScale;
@@ -3009,7 +3009,7 @@ class ie {
3009
3009
  this.pattern.setAttribute("width", `${o}`), this.pattern.setAttribute("height", `${s}`);
3010
3010
  }
3011
3011
  }
3012
- class ne {
3012
+ class ae {
3013
3013
  constructor(e, t, o, s, n) {
3014
3014
  i(this, "overlayCanvas");
3015
3015
  i(this, "staticPortId", null);
@@ -3017,11 +3017,11 @@ class ne {
3017
3017
  i(this, "onEdgeCreated", (e) => {
3018
3018
  this.params.onAfterEdgeCreated(e);
3019
3019
  });
3020
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = n, this.overlayCanvas = We(
3020
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = n, this.overlayCanvas = Ye(
3021
3021
  this.overlayLayer,
3022
3022
  this.viewportStore,
3023
3023
  this.window
3024
- ), G.configure(
3024
+ ), j.configure(
3025
3025
  this.canvas,
3026
3026
  this.overlayLayer,
3027
3027
  this.window,
@@ -3045,7 +3045,7 @@ class ne {
3045
3045
  );
3046
3046
  }
3047
3047
  static configure(e, t, o, s, n) {
3048
- new ne(
3048
+ new ae(
3049
3049
  e,
3050
3050
  t,
3051
3051
  o,
@@ -3059,23 +3059,23 @@ class ne {
3059
3059
  const n = s.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
3060
3060
  x: a - d.x,
3061
3061
  y: h - d.y
3062
- }), g = this.canvas.viewport.createContentCoords({
3062
+ }), u = this.canvas.viewport.createContentCoords({
3063
3063
  x: t.x - d.x,
3064
3064
  y: t.y - d.y
3065
- }), u = {
3065
+ }), g = {
3066
3066
  overlayNodeId: M.StaticNodeId,
3067
3067
  portCoords: c,
3068
3068
  portDirection: s.direction
3069
3069
  }, l = {
3070
3070
  overlayNodeId: M.DraggingNodeId,
3071
- portCoords: g,
3071
+ portCoords: u,
3072
3072
  portDirection: this.params.dragPortDirection
3073
3073
  };
3074
3074
  this.isTargetDragging = o === "direct";
3075
- const [p, y] = this.isTargetDragging ? [u, l] : [l, u];
3076
- this.overlayCanvas.addNode(H(p)), this.overlayCanvas.addNode(H(y)), this.overlayCanvas.addEdge({
3077
- from: p.overlayNodeId,
3078
- to: y.overlayNodeId,
3075
+ const [w, p] = this.isTargetDragging ? [g, l] : [l, g];
3076
+ this.overlayCanvas.addNode(X(w)), this.overlayCanvas.addNode(X(p)), this.overlayCanvas.addEdge({
3077
+ from: w.overlayNodeId,
3078
+ to: p.overlayNodeId,
3079
3079
  shape: this.params.edgeShapeFactory(M.EdgeId)
3080
3080
  });
3081
3081
  }
@@ -3083,7 +3083,7 @@ class ne {
3083
3083
  this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
3084
3084
  }
3085
3085
  tryCreateConnection(e) {
3086
- const t = Pe(this.canvas.graph, e), o = this.staticPortId;
3086
+ const t = Me(this.canvas.graph, e), o = this.staticPortId;
3087
3087
  if (t === null) {
3088
3088
  this.params.onEdgeCreationInterrupted({
3089
3089
  staticPortId: o,
@@ -3105,7 +3105,7 @@ class ne {
3105
3105
  });
3106
3106
  }
3107
3107
  }
3108
- class ae {
3108
+ class he {
3109
3109
  constructor(e, t, o, s, n) {
3110
3110
  i(this, "overlayCanvas");
3111
3111
  i(this, "staticPortId", null);
@@ -3114,11 +3114,11 @@ class ae {
3114
3114
  i(this, "onEdgeReattached", (e) => {
3115
3115
  this.params.onAfterEdgeReattached(e);
3116
3116
  });
3117
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = n, this.overlayCanvas = We(
3117
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = n, this.overlayCanvas = Ye(
3118
3118
  this.overlayLayer,
3119
3119
  this.viewportStore,
3120
3120
  this.window
3121
- ), G.configure(
3121
+ ), j.configure(
3122
3122
  this.canvas,
3123
3123
  this.overlayLayer,
3124
3124
  this.window,
@@ -3139,7 +3139,7 @@ class ae {
3139
3139
  );
3140
3140
  }
3141
3141
  static configure(e, t, o, s, n) {
3142
- new ae(
3142
+ new he(
3143
3143
  e,
3144
3144
  t,
3145
3145
  o,
@@ -3153,13 +3153,13 @@ class ae {
3153
3153
  return !1;
3154
3154
  const s = this.canvas.graph.getEdge(o), n = e === s.from, a = e === s.to, h = n ? s.to : s.from;
3155
3155
  this.staticPortId = h, this.isTargetDragging = a;
3156
- const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), u = {
3157
- x: g.x + g.width / 2,
3158
- y: g.y + g.height / 2
3159
- }, l = this.overlayLayer.getBoundingClientRect(), p = this.canvas.viewport.createContentCoords({
3160
- x: u.x - l.x,
3161
- y: u.y - l.y
3162
- }), y = this.canvas.viewport.createContentCoords({
3156
+ const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), u = c.element.getBoundingClientRect(), g = {
3157
+ x: u.x + u.width / 2,
3158
+ y: u.y + u.height / 2
3159
+ }, l = this.overlayLayer.getBoundingClientRect(), w = this.canvas.viewport.createContentCoords({
3160
+ x: g.x - l.x,
3161
+ y: g.y - l.y
3162
+ }), p = this.canvas.viewport.createContentCoords({
3163
3163
  x: t.x - l.x,
3164
3164
  y: t.y - l.y
3165
3165
  });
@@ -3170,22 +3170,22 @@ class ae {
3170
3170
  shape: s.shape,
3171
3171
  priority: s.priority
3172
3172
  }, this.canvas.removeEdge(o);
3173
- const w = {
3173
+ const y = {
3174
3174
  overlayNodeId: M.StaticNodeId,
3175
- portCoords: p,
3175
+ portCoords: w,
3176
3176
  portDirection: c.direction
3177
3177
  }, f = {
3178
3178
  overlayNodeId: M.DraggingNodeId,
3179
- portCoords: y,
3179
+ portCoords: p,
3180
3180
  portDirection: d.direction
3181
- }, [m, A] = this.isTargetDragging ? [w, f] : [f, w];
3182
- this.overlayCanvas.addNode(H(m)), this.overlayCanvas.addNode(H(A));
3183
- const N = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(M.EdgeId) : s.shape;
3181
+ }, [x, E] = this.isTargetDragging ? [y, f] : [f, y];
3182
+ this.overlayCanvas.addNode(X(x)), this.overlayCanvas.addNode(X(E));
3183
+ const b = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(M.EdgeId) : s.shape;
3184
3184
  return this.overlayCanvas.addEdge({
3185
3185
  id: M.EdgeId,
3186
- from: m.overlayNodeId,
3187
- to: A.overlayNodeId,
3188
- shape: N
3186
+ from: x.overlayNodeId,
3187
+ to: E.overlayNodeId,
3188
+ shape: b
3189
3189
  }), !0;
3190
3190
  }
3191
3191
  resetDragState() {
@@ -3202,7 +3202,7 @@ class ae {
3202
3202
  });
3203
3203
  }
3204
3204
  tryCreateConnection(e) {
3205
- const t = Pe(this.canvas.graph, e);
3205
+ const t = Me(this.canvas.graph, e);
3206
3206
  if (this.overlayCanvas.removeEdge(M.EdgeId), t === null) {
3207
3207
  const d = this.draggingEdgePayload;
3208
3208
  this.params.onEdgeReattachInterrupted({
@@ -3235,17 +3235,17 @@ class ae {
3235
3235
  }
3236
3236
  }
3237
3237
  }
3238
- class he {
3238
+ class de {
3239
3239
  constructor(e, t) {
3240
3240
  this.applier = e, this.trigger = t, this.trigger.subscribe(() => {
3241
3241
  this.applier.apply();
3242
3242
  });
3243
3243
  }
3244
3244
  static configure(e, t) {
3245
- new he(e, t);
3245
+ new de(e, t);
3246
3246
  }
3247
3247
  }
3248
- class de {
3248
+ class ce {
3249
3249
  constructor(e, t, o) {
3250
3250
  i(this, "applyScheduled", !1);
3251
3251
  i(this, "apply", () => {
@@ -3262,7 +3262,7 @@ class de {
3262
3262
  });
3263
3263
  }
3264
3264
  static configure(e, t, o) {
3265
- new de(
3265
+ new ce(
3266
3266
  e,
3267
3267
  t,
3268
3268
  o
@@ -3272,23 +3272,23 @@ class de {
3272
3272
  this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
3273
3273
  }
3274
3274
  }
3275
- class Wt {
3275
+ class Yt {
3276
3276
  static configure(e, t) {
3277
- const o = t.applyOn, s = new Vt(e, t.algorithm, {
3277
+ const o = t.applyOn, s = new Bt(e, t.algorithm, {
3278
3278
  staticNodeResolver: t.staticNodeResolver,
3279
3279
  onBeforeApplied: t.onBeforeApplied,
3280
3280
  onAfterApplied: t.onAfterApplied
3281
3281
  });
3282
3282
  switch (o.type) {
3283
3283
  case "trigger": {
3284
- he.configure(
3284
+ de.configure(
3285
3285
  s,
3286
3286
  o.trigger
3287
3287
  );
3288
3288
  break;
3289
3289
  }
3290
3290
  case "topologyChangeSchedule": {
3291
- de.configure(
3291
+ ce.configure(
3292
3292
  e.graph,
3293
3293
  s,
3294
3294
  o.schedule
@@ -3298,7 +3298,7 @@ class Wt {
3298
3298
  }
3299
3299
  }
3300
3300
  }
3301
- class zt {
3301
+ class Xt {
3302
3302
  constructor(e, t) {
3303
3303
  i(this, "previousTimeStamp");
3304
3304
  i(this, "step", (e) => {
@@ -3313,95 +3313,316 @@ class zt {
3313
3313
  this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
3314
3314
  }
3315
3315
  }
3316
- class ce {
3316
+ class le {
3317
3317
  constructor(e, t, o) {
3318
3318
  i(this, "applier");
3319
3319
  i(this, "step", (e) => {
3320
3320
  this.applier.apply(e);
3321
3321
  });
3322
- this.win = o, this.applier = new $t(e, t.algorithm, {
3322
+ this.win = o, this.applier = new Wt(e, t.algorithm, {
3323
3323
  staticNodeResolver: t.staticNodeResolver,
3324
3324
  onBeforeApplied: t.onBeforeApplied,
3325
3325
  onAfterApplied: t.onAfterApplied
3326
- }), new zt(this.win, this.step);
3326
+ }), new Xt(this.win, this.step);
3327
3327
  }
3328
3328
  static configure(e, t, o) {
3329
- new ce(e, t, o);
3329
+ new le(e, t, o);
3330
+ }
3331
+ }
3332
+ class ue {
3333
+ constructor(e) {
3334
+ i(this, "element");
3335
+ i(this, "canvas");
3336
+ i(this, "window");
3337
+ i(this, "onNodeSelected");
3338
+ i(this, "mouseDownEventVerifier");
3339
+ i(this, "mouseUpEventVerifier");
3340
+ i(this, "movementThreshold");
3341
+ i(this, "selectionCandidateNodeId", null);
3342
+ i(this, "movedDistance", 0);
3343
+ i(this, "previousMouse", null);
3344
+ i(this, "previousTouch", null);
3345
+ i(this, "onAfterNodeAdded", (e) => {
3346
+ const { element: t } = this.canvas.graph.getNode(e);
3347
+ t.addEventListener("mousedown", this.onNodeMouseDown, {
3348
+ passive: !0
3349
+ }), t.addEventListener("touchstart", this.onNodeTouchStart, {
3350
+ passive: !0
3351
+ });
3352
+ });
3353
+ i(this, "onBeforeNodeRemoved", (e) => {
3354
+ const { element: t } = this.canvas.graph.getNode(e);
3355
+ t.removeEventListener("mousedown", this.onNodeMouseDown), t.removeEventListener("touchstart", this.onNodeTouchStart);
3356
+ });
3357
+ i(this, "reset", () => {
3358
+ this.canvas.graph.getAllNodeIds().forEach((e) => {
3359
+ const { element: t } = this.canvas.graph.getNode(e);
3360
+ t.removeEventListener("mousedown", this.onNodeMouseDown), t.removeEventListener("touchstart", this.onNodeTouchStart);
3361
+ });
3362
+ });
3363
+ i(this, "revert", () => {
3364
+ this.reset(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
3365
+ });
3366
+ i(this, "onNodeMouseDown", (e) => {
3367
+ const t = e;
3368
+ if (!this.mouseDownEventVerifier(t))
3369
+ return;
3370
+ const o = this.canvas.graph.findNodeIdByElement(
3371
+ e.currentTarget
3372
+ );
3373
+ this.selectionCandidateNodeId = o, this.previousMouse = { x: t.clientX, y: t.clientY }, this.movedDistance = 0, this.window.addEventListener("mousemove", this.onWindowMouseMove, {
3374
+ passive: !0
3375
+ }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
3376
+ passive: !0
3377
+ });
3378
+ });
3379
+ i(this, "onNodeTouchStart", (e) => {
3380
+ const t = e;
3381
+ if (t.touches.length !== 1)
3382
+ return;
3383
+ const o = this.canvas.graph.findNodeIdByElement(
3384
+ t.currentTarget
3385
+ );
3386
+ this.selectionCandidateNodeId = o, this.previousTouch = t.touches[0], this.movedDistance = 0, this.window.addEventListener("touchmove", this.onWindowTouchMove, {
3387
+ passive: !0
3388
+ }), this.window.addEventListener("touchend", this.onWindowTouchEnd, {
3389
+ passive: !0
3390
+ }), this.window.addEventListener("touchcancel", this.onWindowTouchCancel, {
3391
+ passive: !0
3392
+ });
3393
+ });
3394
+ i(this, "onWindowMouseMove", (e) => {
3395
+ const t = e, o = this.previousMouse, s = t.clientX - o.x, n = t.clientY - o.y;
3396
+ if (!D(
3397
+ this.window,
3398
+ this.element,
3399
+ t.clientX,
3400
+ t.clientY
3401
+ )) {
3402
+ this.removeWindowMouseListeners();
3403
+ return;
3404
+ }
3405
+ this.processMoveThresholdVerification(s, n, () => {
3406
+ this.removeWindowMouseListeners();
3407
+ }), this.previousMouse = { x: t.clientX, y: t.clientY };
3408
+ });
3409
+ i(this, "onWindowTouchMove", (e) => {
3410
+ const t = e;
3411
+ if (t.touches.length !== 1) {
3412
+ this.removeWindowTouchListeners();
3413
+ return;
3414
+ }
3415
+ const o = t.touches[0];
3416
+ if (!D(this.window, this.element, o.clientX, o.clientY)) {
3417
+ this.removeWindowTouchListeners();
3418
+ return;
3419
+ }
3420
+ const s = this.previousTouch, n = o.clientX - s.clientX, a = o.clientY - s.clientY;
3421
+ this.processMoveThresholdVerification(n, a, () => {
3422
+ this.removeWindowTouchListeners();
3423
+ }), this.previousTouch = o;
3424
+ });
3425
+ i(this, "onWindowMouseUp", (e) => {
3426
+ const t = e;
3427
+ this.mouseUpEventVerifier(t) && (this.removeWindowMouseListeners(), this.trySelectNode());
3428
+ });
3429
+ i(this, "onWindowTouchEnd", () => {
3430
+ this.removeWindowTouchListeners(), this.trySelectNode();
3431
+ });
3432
+ i(this, "onWindowTouchCancel", () => {
3433
+ this.removeWindowTouchListeners();
3434
+ });
3435
+ this.element = e.element, this.canvas = e.canvas, this.window = e.window, this.mouseDownEventVerifier = e.mouseDownEventVerifier, this.mouseUpEventVerifier = e.mouseUpEventVerifier, this.onNodeSelected = e.onNodeSelected, this.movementThreshold = e.movementThreshold, this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
3436
+ }
3437
+ static configure(e) {
3438
+ new ue(e);
3439
+ }
3440
+ removeWindowMouseListeners() {
3441
+ this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
3442
+ }
3443
+ removeWindowTouchListeners() {
3444
+ this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchEnd), this.window.removeEventListener("touchcancel", this.onWindowTouchCancel);
3445
+ }
3446
+ trySelectNode() {
3447
+ const e = this.selectionCandidateNodeId;
3448
+ this.canvas.graph.hasNode(e) && this.onNodeSelected(e);
3449
+ }
3450
+ processMoveThresholdVerification(e, t, o) {
3451
+ const s = Math.sqrt(e * e + t * t);
3452
+ this.movedDistance += s, this.movedDistance > this.movementThreshold && o();
3453
+ }
3454
+ }
3455
+ class ge {
3456
+ constructor(e) {
3457
+ i(this, "element");
3458
+ i(this, "canvas");
3459
+ i(this, "window");
3460
+ i(this, "onCanvasSelected");
3461
+ i(this, "movementThreshold");
3462
+ i(this, "mouseDownEventVerifier");
3463
+ i(this, "mouseUpEventVerifier");
3464
+ i(this, "movedDistance", 0);
3465
+ i(this, "previousMouseDown", null);
3466
+ i(this, "previousTouch", null);
3467
+ i(this, "onMouseDown", (e) => {
3468
+ const t = e;
3469
+ this.mouseDownEventVerifier(t) && (this.previousMouseDown = { x: t.clientX, y: t.clientY }, this.movedDistance = 0, this.window.addEventListener("mousemove", this.onWindowMouseMove, {
3470
+ passive: !0
3471
+ }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
3472
+ passive: !0
3473
+ }));
3474
+ });
3475
+ i(this, "onTouchStart", (e) => {
3476
+ const t = e;
3477
+ if (t.touches.length !== 1)
3478
+ return;
3479
+ const o = t.touches[0];
3480
+ this.previousTouch = o, this.movedDistance = 0, this.window.addEventListener("touchmove", this.onWindowTouchMove, {
3481
+ passive: !0
3482
+ }), this.window.addEventListener("touchend", this.onWindowTouchEnd, {
3483
+ passive: !0
3484
+ }), this.window.addEventListener("touchcancel", this.onWindowTouchCancel, {
3485
+ passive: !0
3486
+ });
3487
+ });
3488
+ i(this, "onWindowMouseMove", (e) => {
3489
+ const t = e;
3490
+ if (!D(
3491
+ this.window,
3492
+ this.element,
3493
+ t.clientX,
3494
+ t.clientY
3495
+ )) {
3496
+ this.removeWindowMouseListeners();
3497
+ return;
3498
+ }
3499
+ const o = this.previousMouseDown, s = t.clientX - o.x, n = t.clientY - o.y;
3500
+ this.processMoveThresholdVerification(s, n, () => {
3501
+ this.removeWindowMouseListeners();
3502
+ }), this.previousMouseDown = { x: t.clientX, y: t.clientY };
3503
+ });
3504
+ i(this, "onWindowTouchMove", (e) => {
3505
+ const t = e;
3506
+ if (t.touches.length !== 1) {
3507
+ this.removeWindowTouchListeners();
3508
+ return;
3509
+ }
3510
+ const o = t.touches[0];
3511
+ if (!D(this.window, this.element, o.clientX, o.clientY)) {
3512
+ this.removeWindowTouchListeners();
3513
+ return;
3514
+ }
3515
+ const s = this.previousTouch, n = o.clientX - s.clientX, a = o.clientY - s.clientY;
3516
+ this.processMoveThresholdVerification(n, a, () => {
3517
+ this.removeWindowTouchListeners();
3518
+ }), this.previousTouch = o;
3519
+ });
3520
+ i(this, "onWindowMouseUp", (e) => {
3521
+ const t = e;
3522
+ this.mouseUpEventVerifier(t) && (this.onCanvasSelected(), this.removeWindowMouseListeners());
3523
+ });
3524
+ i(this, "onWindowTouchEnd", () => {
3525
+ this.onCanvasSelected(), this.removeWindowTouchListeners();
3526
+ });
3527
+ i(this, "onWindowTouchCancel", () => {
3528
+ this.removeWindowTouchListeners();
3529
+ });
3530
+ i(this, "restore", () => {
3531
+ this.element.removeEventListener("mousedown", this.onMouseDown), this.element.removeEventListener("touchstart", this.onTouchStart), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
3532
+ });
3533
+ this.element = e.element, this.window = e.window, this.onCanvasSelected = e.onCanvasSelected, this.canvas = e.canvas, this.movementThreshold = e.movementThreshold, this.mouseDownEventVerifier = e.mouseDownEventVerifier, this.mouseUpEventVerifier = e.mouseUpEventVerifier, this.canvas.onBeforeDestroy.subscribe(this.restore), this.element.addEventListener("mousedown", this.onMouseDown, {
3534
+ passive: !0
3535
+ }), this.element.addEventListener("touchstart", this.onTouchStart, {
3536
+ passive: !0
3537
+ });
3538
+ }
3539
+ static configure(e) {
3540
+ new ge(e);
3541
+ }
3542
+ removeWindowMouseListeners() {
3543
+ this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
3544
+ }
3545
+ removeWindowTouchListeners() {
3546
+ this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchEnd), this.window.removeEventListener("touchcancel", this.onWindowTouchCancel);
3547
+ }
3548
+ processMoveThresholdVerification(e, t, o) {
3549
+ const s = Math.sqrt(e * e + t * t);
3550
+ this.movedDistance += s, this.movedDistance > this.movementThreshold && o();
3330
3551
  }
3331
3552
  }
3332
- const kt = () => {
3553
+ const Ht = () => {
3333
3554
  const r = document.createElement("div");
3334
3555
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
3335
- }, Q = () => {
3556
+ }, Z = () => {
3336
3557
  const r = document.createElement("div");
3337
3558
  return r.style.position = "absolute", r.style.inset = "0", r;
3338
- }, ve = () => {
3339
- const r = Q();
3559
+ }, Ee = () => {
3560
+ const r = Z();
3340
3561
  return r.style.pointerEvents = "none", r;
3341
3562
  };
3342
- class Ht {
3563
+ class Gt {
3343
3564
  constructor(e) {
3344
- i(this, "background", Q());
3345
- i(this, "main", Q());
3346
- i(this, "overlayConnectablePorts", ve());
3347
- i(this, "overlayDraggableEdges", ve());
3348
- i(this, "host", kt());
3565
+ i(this, "background", Z());
3566
+ i(this, "main", Z());
3567
+ i(this, "overlayConnectablePorts", Ee());
3568
+ i(this, "overlayDraggableEdges", Ee());
3569
+ i(this, "host", Ht());
3349
3570
  this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
3350
3571
  }
3351
3572
  destroy() {
3352
3573
  this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlayConnectablePorts), this.host.removeChild(this.overlayDraggableEdges), this.element.removeChild(this.host);
3353
3574
  }
3354
3575
  }
3355
- const Yt = (r) => {
3356
- var p, y, w, f, m, A;
3357
- const e = ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ?? (() => {
3358
- }), t = ((y = r.events) == null ? void 0 : y.onNodeDrag) ?? (() => {
3359
- }), o = r.nodeDragVerifier ?? (() => !0), s = ((w = r.events) == null ? void 0 : w.onNodeDragFinished) ?? (() => {
3360
- }), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (f = r.mouse) == null ? void 0 : f.dragCursor, d = h !== void 0 ? h : "grab", c = (m = r.mouse) == null ? void 0 : m.mouseDownEventVerifier, g = c !== void 0 ? c : (N) => N.button === 0, u = (A = r.mouse) == null ? void 0 : A.mouseUpEventVerifier, l = u !== void 0 ? u : (N) => N.button === 0;
3576
+ const jt = (r) => {
3577
+ var w, p, y, f, x, E;
3578
+ const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
3579
+ }), t = ((p = r.events) == null ? void 0 : p.onNodeDrag) ?? (() => {
3580
+ }), o = r.nodeDragVerifier ?? (() => !0), s = ((y = r.events) == null ? void 0 : y.onNodeDragFinished) ?? (() => {
3581
+ }), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (f = r.mouse) == null ? void 0 : f.dragCursor, d = h !== void 0 ? h : "grab", c = (x = r.mouse) == null ? void 0 : x.mouseDownEventVerifier, u = c !== void 0 ? c : (b) => b.button === 0, g = (E = r.mouse) == null ? void 0 : E.mouseUpEventVerifier, l = g !== void 0 ? g : (b) => b.button === 0;
3361
3582
  return {
3362
3583
  moveOnTop: n,
3363
3584
  moveEdgesOnTop: a,
3364
3585
  dragCursor: d,
3365
3586
  gridSize: r.gridSize ?? null,
3366
- mouseDownEventVerifier: g,
3587
+ mouseDownEventVerifier: u,
3367
3588
  mouseUpEventVerifier: l,
3368
3589
  onNodeDragStarted: e,
3369
3590
  onNodeDrag: t,
3370
3591
  nodeDragVerifier: o,
3371
3592
  onNodeDragFinished: s
3372
3593
  };
3373
- }, Xt = (r) => {
3594
+ }, Jt = (r) => {
3374
3595
  const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, o = r.minY !== null ? r.minY : -1 / 0, s = r.maxY !== null ? r.maxY : 1 / 0;
3375
3596
  return (n) => {
3376
3597
  let a = n.nextTransform.x, h = n.nextTransform.y;
3377
3598
  a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
3378
3599
  const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
3379
3600
  a > c && a > n.prevTransform.x && (a = Math.max(n.prevTransform.x, c)), h < o && h < n.prevTransform.y && (h = Math.min(n.prevTransform.y, o));
3380
- const g = n.canvasHeight * n.prevTransform.scale, u = s - g;
3381
- return h > u && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, u)), { scale: n.nextTransform.scale, x: a, y: h };
3601
+ const u = n.canvasHeight * n.prevTransform.scale, g = s - u;
3602
+ return h > g && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, g)), { scale: n.nextTransform.scale, x: a, y: h };
3382
3603
  };
3383
- }, Gt = (r) => {
3604
+ }, Kt = (r) => {
3384
3605
  const e = r.maxContentScale, t = r.minContentScale, o = e !== null ? 1 / e : 0, s = t !== null ? 1 / t : 1 / 0;
3385
3606
  return (n) => {
3386
3607
  const a = n.prevTransform, h = n.nextTransform;
3387
- let d = h.scale, c = h.x, g = h.y;
3608
+ let d = h.scale, c = h.x, u = h.y;
3388
3609
  if (h.scale > s && h.scale > a.scale) {
3389
- d = Math.max(a.scale, s), c = a.x, g = a.y;
3390
- const u = (d - a.scale) / (h.scale - a.scale);
3391
- c = a.x + (h.x - a.x) * u, g = a.y + (h.y - a.y) * u;
3610
+ d = Math.max(a.scale, s), c = a.x, u = a.y;
3611
+ const g = (d - a.scale) / (h.scale - a.scale);
3612
+ c = a.x + (h.x - a.x) * g, u = a.y + (h.y - a.y) * g;
3392
3613
  }
3393
3614
  if (h.scale < o && h.scale < a.scale) {
3394
- d = Math.min(a.scale, o), c = a.x, g = a.y;
3395
- const u = (d - a.scale) / (h.scale - a.scale);
3396
- c = a.x + (h.x - a.x) * u, g = a.y + (h.y - a.y) * u;
3615
+ d = Math.min(a.scale, o), c = a.x, u = a.y;
3616
+ const g = (d - a.scale) / (h.scale - a.scale);
3617
+ c = a.x + (h.x - a.x) * g, u = a.y + (h.y - a.y) * g;
3397
3618
  }
3398
3619
  return {
3399
3620
  scale: d,
3400
3621
  x: c,
3401
- y: g
3622
+ y: u
3402
3623
  };
3403
3624
  };
3404
- }, jt = (r) => (e) => r.reduce(
3625
+ }, Qt = (r) => (e) => r.reduce(
3405
3626
  (t, o) => o({
3406
3627
  prevTransform: e.prevTransform,
3407
3628
  nextTransform: t,
@@ -3409,38 +3630,38 @@ const Yt = (r) => {
3409
3630
  canvasHeight: e.canvasHeight
3410
3631
  }),
3411
3632
  e.nextTransform
3412
- ), xe = (r) => {
3633
+ ), Ae = (r) => {
3413
3634
  if (typeof r == "function")
3414
3635
  return r;
3415
3636
  switch (r.type) {
3416
3637
  case "scale-limit":
3417
- return Gt({
3638
+ return Kt({
3418
3639
  minContentScale: r.minContentScale ?? 0,
3419
3640
  maxContentScale: r.maxContentScale ?? 1 / 0
3420
3641
  });
3421
3642
  case "shift-limit":
3422
- return Xt({
3643
+ return Jt({
3423
3644
  minX: r.minX ?? -1 / 0,
3424
3645
  maxX: r.maxX ?? 1 / 0,
3425
3646
  minY: r.minY ?? -1 / 0,
3426
3647
  maxY: r.maxY ?? 1 / 0
3427
3648
  });
3428
3649
  }
3429
- }, me = (r) => {
3430
- var y, w, f, m, A, N, C, T, I, V, $, ge;
3431
- const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, o = r == null ? void 0 : r.transformPreprocessor;
3650
+ }, Se = (r) => {
3651
+ var p, y, f, x, E, b, T, C, I, U, $, we;
3652
+ const e = (p = r == null ? void 0 : r.scale) == null ? void 0 : p.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, o = r == null ? void 0 : r.transformPreprocessor;
3432
3653
  let s;
3433
- o !== void 0 ? Array.isArray(o) ? s = jt(
3654
+ o !== void 0 ? Array.isArray(o) ? s = Qt(
3434
3655
  o.map(
3435
- (D) => xe(D)
3656
+ (L) => Ae(L)
3436
3657
  )
3437
- ) : s = xe(o) : s = (D) => D.nextTransform;
3438
- const n = ((w = r == null ? void 0 : r.shift) == null ? void 0 : w.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onBeforeTransformChange) ?? (() => {
3439
- }), h = ((m = r == null ? void 0 : r.events) == null ? void 0 : m.onTransformChange) ?? (() => {
3440
- }), d = (A = r == null ? void 0 : r.shift) == null ? void 0 : A.mouseDownEventVerifier, c = d !== void 0 ? d : (D) => D.button === 0, g = (N = r == null ? void 0 : r.shift) == null ? void 0 : N.mouseUpEventVerifier, u = g !== void 0 ? g : (D) => D.button === 0, l = (C = r == null ? void 0 : r.scale) == null ? void 0 : C.mouseWheelEventVerifier, p = l !== void 0 ? l : () => !0;
3658
+ ) : s = Ae(o) : s = (L) => L.nextTransform;
3659
+ const n = ((y = r == null ? void 0 : r.shift) == null ? void 0 : y.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onBeforeTransformChange) ?? (() => {
3660
+ }), h = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformChange) ?? (() => {
3661
+ }), d = (E = r == null ? void 0 : r.shift) == null ? void 0 : E.mouseDownEventVerifier, c = d !== void 0 ? d : (L) => L.button === 0, u = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseUpEventVerifier, g = u !== void 0 ? u : (L) => L.button === 0, l = (T = r == null ? void 0 : r.scale) == null ? void 0 : T.mouseWheelEventVerifier, w = l !== void 0 ? l : () => !0;
3441
3662
  return {
3442
3663
  wheelSensitivity: t,
3443
- onTransformStarted: ((T = r == null ? void 0 : r.events) == null ? void 0 : T.onTransformStarted) ?? (() => {
3664
+ onTransformStarted: ((C = r == null ? void 0 : r.events) == null ? void 0 : C.onTransformStarted) ?? (() => {
3444
3665
  }),
3445
3666
  onTransformFinished: ((I = r == null ? void 0 : r.events) == null ? void 0 : I.onTransformFinished) ?? (() => {
3446
3667
  }),
@@ -3449,37 +3670,37 @@ const Yt = (r) => {
3449
3670
  transformPreprocessor: s,
3450
3671
  shiftCursor: n,
3451
3672
  mouseDownEventVerifier: c,
3452
- mouseUpEventVerifier: u,
3453
- mouseWheelEventVerifier: p,
3454
- scaleWheelFinishTimeout: ((V = r == null ? void 0 : r.scale) == null ? void 0 : V.wheelFinishTimeout) ?? 500,
3673
+ mouseUpEventVerifier: g,
3674
+ mouseWheelEventVerifier: w,
3675
+ scaleWheelFinishTimeout: ((U = r == null ? void 0 : r.scale) == null ? void 0 : U.wheelFinishTimeout) ?? 500,
3455
3676
  onResizeTransformStarted: (($ = r == null ? void 0 : r.events) == null ? void 0 : $.onResizeTransformStarted) ?? (() => {
3456
3677
  }),
3457
- onResizeTransformFinished: ((ge = r == null ? void 0 : r.events) == null ? void 0 : ge.onResizeTransformFinished) ?? (() => {
3678
+ onResizeTransformFinished: ((we = r == null ? void 0 : r.events) == null ? void 0 : we.onResizeTransformFinished) ?? (() => {
3458
3679
  })
3459
3680
  };
3460
- }, Jt = (r, e) => {
3681
+ }, Zt = (r, e) => {
3461
3682
  const t = document.createElementNS(
3462
3683
  "http://www.w3.org/2000/svg",
3463
3684
  "circle"
3464
3685
  );
3465
3686
  return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
3466
- }, Kt = (r) => r instanceof SVGElement ? r : Jt(
3687
+ }, _t = (r) => r instanceof SVGElement ? r : Zt(
3467
3688
  (r == null ? void 0 : r.radius) ?? 1.5,
3468
3689
  (r == null ? void 0 : r.color) ?? "#d8d8d8"
3469
- ), Qt = (r) => {
3470
- const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s = Kt(r.renderer ?? {});
3690
+ ), qt = (r) => {
3691
+ const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s = _t(r.renderer ?? {});
3471
3692
  return {
3472
3693
  tileWidth: t,
3473
3694
  tileHeight: o,
3474
3695
  renderer: s,
3475
3696
  maxViewportScale: r.maxViewportScale ?? 10
3476
3697
  };
3477
- }, le = (r) => {
3698
+ }, pe = (r) => {
3478
3699
  if (typeof r == "function")
3479
3700
  return r;
3480
3701
  switch (r.type) {
3481
3702
  case "straight":
3482
- return () => new Ct({
3703
+ return () => new Dt({
3483
3704
  color: r.color,
3484
3705
  width: r.width,
3485
3706
  arrowLength: r.arrowLength,
@@ -3493,7 +3714,7 @@ const Yt = (r) => {
3493
3714
  detourDirection: r.detourDirection
3494
3715
  });
3495
3716
  case "horizontal":
3496
- return () => new Pt({
3717
+ return () => new Mt({
3497
3718
  color: r.color,
3498
3719
  width: r.width,
3499
3720
  arrowLength: r.arrowLength,
@@ -3506,7 +3727,7 @@ const Yt = (r) => {
3506
3727
  detourDistance: r.detourDistance
3507
3728
  });
3508
3729
  case "vertical":
3509
- return () => new Tt({
3730
+ return () => new Lt({
3510
3731
  color: r.color,
3511
3732
  width: r.width,
3512
3733
  arrowLength: r.arrowLength,
@@ -3519,7 +3740,7 @@ const Yt = (r) => {
3519
3740
  detourDistance: r.detourDistance
3520
3741
  });
3521
3742
  case "direct":
3522
- return () => new Le({
3743
+ return () => new Ie({
3523
3744
  color: r.color,
3524
3745
  width: r.width,
3525
3746
  arrowLength: r.arrowLength,
@@ -3530,7 +3751,7 @@ const Yt = (r) => {
3530
3751
  targetOffset: r.targetOffset
3531
3752
  });
3532
3753
  default:
3533
- return () => new Nt({
3754
+ return () => new Ct({
3534
3755
  color: r.color,
3535
3756
  width: r.width,
3536
3757
  arrowLength: r.arrowLength,
@@ -3544,8 +3765,8 @@ const Yt = (r) => {
3544
3765
  detourDirection: r.detourDirection
3545
3766
  });
3546
3767
  }
3547
- }, Zt = (r, e, t) => {
3548
- var c, g, u;
3768
+ }, er = (r, e, t) => {
3769
+ var c, u, g;
3549
3770
  const o = () => "direct", s = (l) => l, n = (l) => l.button === 0, a = () => {
3550
3771
  }, h = () => {
3551
3772
  }, d = () => {
@@ -3556,16 +3777,16 @@ const Yt = (r) => {
3556
3777
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
3557
3778
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
3558
3779
  onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
3559
- onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
3560
- onEdgeCreationPrevented: ((u = r.events) == null ? void 0 : u.onEdgeCreationPrevented) ?? h,
3780
+ onEdgeCreationInterrupted: ((u = r.events) == null ? void 0 : u.onEdgeCreationInterrupted) ?? d,
3781
+ onEdgeCreationPrevented: ((g = r.events) == null ? void 0 : g.onEdgeCreationPrevented) ?? h,
3561
3782
  dragPortDirection: r.dragPortDirection ?? t,
3562
- edgeShapeFactory: r.edgeShape !== void 0 ? le(r.edgeShape) : e
3783
+ edgeShapeFactory: r.edgeShape !== void 0 ? pe(r.edgeShape) : e
3563
3784
  };
3564
- }, _t = (r, e) => {
3565
- var c, g, u;
3785
+ }, tr = (r, e) => {
3786
+ var c, u, g;
3566
3787
  const t = (l) => l, o = (l) => l.button === 0 && l.ctrlKey, s = (l) => l.button === 0, n = (l) => {
3567
- const p = e.getPortAdjacentEdgeIds(l);
3568
- return p.length > 0 ? p[p.length - 1] : null;
3788
+ const w = e.getPortAdjacentEdgeIds(l);
3789
+ return w.length > 0 ? w[w.length - 1] : null;
3569
3790
  }, a = () => {
3570
3791
  }, h = () => {
3571
3792
  }, d = () => {
@@ -3575,15 +3796,15 @@ const Yt = (r) => {
3575
3796
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? o,
3576
3797
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? s,
3577
3798
  draggingEdgeResolver: r.draggingEdgeResolver ?? n,
3578
- draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? le(r.draggingEdgeShape) : null,
3799
+ draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? pe(r.draggingEdgeShape) : null,
3579
3800
  onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
3580
- onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
3581
- onEdgeReattachPrevented: ((u = r.events) == null ? void 0 : u.onEdgeReattachPrevented) ?? h
3801
+ onEdgeReattachInterrupted: ((u = r.events) == null ? void 0 : u.onEdgeReattachInterrupted) ?? d,
3802
+ onEdgeReattachPrevented: ((g = r.events) == null ? void 0 : g.onEdgeReattachPrevented) ?? h
3582
3803
  };
3583
- }, qt = (r) => ({
3804
+ }, rr = (r) => ({
3584
3805
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
3585
3806
  nodeHorizontalRadius: r.nodeContainingRadius.horizontal
3586
- }), er = (r) => {
3807
+ }), or = (r) => {
3587
3808
  var e, t;
3588
3809
  return {
3589
3810
  onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
@@ -3592,13 +3813,13 @@ const Yt = (r) => {
3592
3813
  })
3593
3814
  };
3594
3815
  };
3595
- class tr extends Error {
3816
+ class sr extends Error {
3596
3817
  constructor() {
3597
3818
  super(...arguments);
3598
3819
  i(this, "name", "CanvasBuilderError");
3599
3820
  }
3600
3821
  }
3601
- class ze {
3822
+ class Xe {
3602
3823
  constructor(e, t, o) {
3603
3824
  i(this, "dt");
3604
3825
  i(this, "nodeMass");
@@ -3631,12 +3852,12 @@ class ze {
3631
3852
  const o = this.graph.getEdge(t), s = this.graph.getPort(o.from), n = this.graph.getPort(o.to), a = this.currentCoords.get(s.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
3632
3853
  a,
3633
3854
  h
3634
- ), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, u = d.ex * g, l = d.ey * g, p = e.get(s.nodeId), y = e.get(n.nodeId);
3635
- p.x += u, p.y += l, y.x -= u, y.y -= l;
3855
+ ), u = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, g = d.ex * u, l = d.ey * u, w = e.get(s.nodeId), p = e.get(n.nodeId);
3856
+ w.x += g, w.y += l, p.x -= g, p.y -= l;
3636
3857
  });
3637
3858
  }
3638
3859
  }
3639
- class ke {
3860
+ class He {
3640
3861
  constructor(e) {
3641
3862
  i(this, "PI2", 2 * Math.PI);
3642
3863
  this.rand = e;
@@ -3655,13 +3876,13 @@ class ke {
3655
3876
  return { ex: h, ey: d, d: a };
3656
3877
  }
3657
3878
  }
3658
- const He = (r) => {
3879
+ const Ge = (r) => {
3659
3880
  if (r.distance === 0)
3660
3881
  return r.maxForce;
3661
3882
  const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
3662
3883
  return Math.min(e, r.maxForce);
3663
3884
  };
3664
- class rr {
3885
+ class ir {
3665
3886
  constructor(e) {
3666
3887
  i(this, "nodeCharge");
3667
3888
  i(this, "distanceVectorGenerator");
@@ -3673,22 +3894,22 @@ class rr {
3673
3894
  for (let n = 0; n < s; n++) {
3674
3895
  const a = o[n];
3675
3896
  for (let h = n + 1; h < s; h++) {
3676
- const d = o[h], c = e.get(a), g = e.get(d), u = this.distanceVectorGenerator.create(
3897
+ const d = o[h], c = e.get(a), u = e.get(d), g = this.distanceVectorGenerator.create(
3677
3898
  c,
3678
- g
3679
- ), l = He({
3899
+ u
3900
+ ), l = Ge({
3680
3901
  coefficient: 1,
3681
3902
  sourceCharge: this.nodeCharge,
3682
3903
  targetCharge: this.nodeCharge,
3683
- distance: u.d,
3904
+ distance: g.d,
3684
3905
  maxForce: this.maxForce
3685
- }), p = l * u.ex, y = l * u.ey, w = t.get(a), f = t.get(d);
3686
- w.x -= p, w.y -= y, f.x += p, f.y += y;
3906
+ }), w = l * g.ex, p = l * g.ey, y = t.get(a), f = t.get(d);
3907
+ y.x -= w, y.y -= p, f.x += w, f.y += p;
3687
3908
  }
3688
3909
  }
3689
3910
  }
3690
3911
  }
3691
- const or = (r) => {
3912
+ const nr = (r) => {
3692
3913
  if (r.size === 0)
3693
3914
  return {
3694
3915
  centerX: 0,
@@ -3706,7 +3927,7 @@ const or = (r) => {
3706
3927
  radius: h / 2
3707
3928
  };
3708
3929
  };
3709
- class sr {
3930
+ class ar {
3710
3931
  constructor(e) {
3711
3932
  i(this, "root");
3712
3933
  i(this, "leaves", /* @__PURE__ */ new Map());
@@ -3761,16 +3982,16 @@ class sr {
3761
3982
  this.sortedParentNodes.push(e);
3762
3983
  const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = s / 2;
3763
3984
  e.nodeIds.forEach((l) => {
3764
- const { x: p, y } = this.coords.get(l);
3765
- p < t ? y < o ? d.add(l) : h.add(l) : y < o ? a.add(l) : n.add(l), e.nodeIds.delete(l);
3985
+ const { x: w, y: p } = this.coords.get(l);
3986
+ w < t ? p < o ? d.add(l) : h.add(l) : p < o ? a.add(l) : n.add(l), e.nodeIds.delete(l);
3766
3987
  });
3767
- const g = {
3988
+ const u = {
3768
3989
  parent: e,
3769
3990
  lb: null,
3770
3991
  lt: null,
3771
3992
  rb: null,
3772
3993
  rt: null
3773
- }, u = [];
3994
+ }, g = [];
3774
3995
  if (n.size > 0) {
3775
3996
  const l = {
3776
3997
  nodeIds: n,
@@ -3785,9 +4006,9 @@ class sr {
3785
4006
  centerY: o + c,
3786
4007
  radius: c
3787
4008
  },
3788
- ...g
4009
+ ...u
3789
4010
  };
3790
- e.rt = l, u.push(l);
4011
+ e.rt = l, g.push(l);
3791
4012
  }
3792
4013
  if (a.size > 0) {
3793
4014
  const l = {
@@ -3803,9 +4024,9 @@ class sr {
3803
4024
  centerY: o - c,
3804
4025
  radius: c
3805
4026
  },
3806
- ...g
4027
+ ...u
3807
4028
  };
3808
- e.rb = l, u.push(l);
4029
+ e.rb = l, g.push(l);
3809
4030
  }
3810
4031
  if (h.size > 0) {
3811
4032
  const l = {
@@ -3821,9 +4042,9 @@ class sr {
3821
4042
  centerY: o + c,
3822
4043
  radius: c
3823
4044
  },
3824
- ...g
4045
+ ...u
3825
4046
  };
3826
- e.lt = l, u.push(l);
4047
+ e.lt = l, g.push(l);
3827
4048
  }
3828
4049
  if (d.size > 0) {
3829
4050
  const l = {
@@ -3839,11 +4060,11 @@ class sr {
3839
4060
  centerY: o - c,
3840
4061
  radius: c
3841
4062
  },
3842
- ...g
4063
+ ...u
3843
4064
  };
3844
- e.lb = l, u.push(l);
4065
+ e.lb = l, g.push(l);
3845
4066
  }
3846
- return u;
4067
+ return g;
3847
4068
  }
3848
4069
  setLeaf(e) {
3849
4070
  e.totalMass = this.nodeMass * e.nodeIds.size, e.totalCharge = this.nodeCharge * e.nodeIds.size, e.chargeCenter = this.calculateLeafChargeCenter(e.nodeIds), e.nodeIds.forEach((t) => {
@@ -3863,7 +4084,7 @@ class sr {
3863
4084
  }), { x: t / e.size, y: o / e.size };
3864
4085
  }
3865
4086
  }
3866
- class ir {
4087
+ class hr {
3867
4088
  constructor(e) {
3868
4089
  i(this, "areaRadiusThreshold");
3869
4090
  i(this, "nodeMass");
@@ -3875,7 +4096,7 @@ class ir {
3875
4096
  this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.theta = e.theta, this.distanceVectorGenerator = e.distanceVectorGenerator, this.nodeForceCoefficient = e.nodeForceCoefficient, this.maxForce = e.maxForce;
3876
4097
  }
3877
4098
  apply(e, t) {
3878
- const o = or(e), s = new sr({
4099
+ const o = nr(e), s = new ar({
3879
4100
  box: o,
3880
4101
  coords: e,
3881
4102
  areaRadiusThreshold: this.areaRadiusThreshold,
@@ -3990,7 +4211,7 @@ class ir {
3990
4211
  const t = this.distanceVectorGenerator.create(
3991
4212
  e.sourceCoords,
3992
4213
  e.targetCoords
3993
- ), o = He({
4214
+ ), o = Ge({
3994
4215
  coefficient: this.nodeForceCoefficient,
3995
4216
  sourceCharge: e.sourceCharge,
3996
4217
  targetCharge: e.targetCharge,
@@ -4025,7 +4246,7 @@ class ir {
4025
4246
  }
4026
4247
  }
4027
4248
  }
4028
- const Ye = (r) => r.theta !== 0 ? new ir({
4249
+ const je = (r) => r.theta !== 0 ? new hr({
4029
4250
  nodeCharge: r.nodeCharge,
4030
4251
  nodeForceCoefficient: r.nodeForceCoefficient,
4031
4252
  distanceVectorGenerator: r.distanceVectorGenerator,
@@ -4033,36 +4254,36 @@ const Ye = (r) => r.theta !== 0 ? new ir({
4033
4254
  theta: r.theta,
4034
4255
  nodeMass: r.nodeMass,
4035
4256
  areaRadiusThreshold: r.areaRadiusThreshold
4036
- }) : new rr({
4257
+ }) : new ir({
4037
4258
  nodeCharge: r.nodeCharge,
4038
4259
  nodeForceCoefficient: r.nodeForceCoefficient,
4039
4260
  distanceVectorGenerator: r.distanceVectorGenerator,
4040
4261
  maxForce: r.maxForce
4041
4262
  });
4042
- class Xe {
4263
+ class Je {
4043
4264
  constructor(e) {
4044
4265
  i(this, "rand");
4045
4266
  i(this, "sparsity");
4046
4267
  this.rand = e.rand, this.sparsity = e.sparsity;
4047
4268
  }
4048
4269
  calculateCoordinates(e) {
4049
- const { graph: t, viewport: o } = e, s = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((y) => {
4050
- const w = t.getNode(y);
4051
- return w.x === null || w.y === null;
4052
- }), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 }, g = o.createContentCoords(c), u = a / 2, l = {
4053
- x: g.x - u,
4054
- y: g.y - u
4270
+ const { graph: t, viewport: o } = e, s = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((p) => {
4271
+ const y = t.getNode(p);
4272
+ return y.x === null || y.y === null;
4273
+ }), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 }, u = o.createContentCoords(c), g = a / 2, l = {
4274
+ x: u.x - g,
4275
+ y: u.y - g
4055
4276
  };
4056
- return t.getAllNodeIds().forEach((y) => {
4057
- const w = t.getNode(y);
4058
- s.set(y, {
4059
- x: w.x ?? l.x + a * this.rand(),
4060
- y: w.y ?? l.y + a * this.rand()
4277
+ return t.getAllNodeIds().forEach((p) => {
4278
+ const y = t.getNode(p);
4279
+ s.set(p, {
4280
+ x: y.x ?? l.x + a * this.rand(),
4281
+ y: y.y ?? l.y + a * this.rand()
4061
4282
  });
4062
4283
  }), s;
4063
4284
  }
4064
4285
  }
4065
- class nr {
4286
+ class dr {
4066
4287
  constructor(e) {
4067
4288
  i(this, "distanceVectorGenerator");
4068
4289
  i(this, "nodeForcesApplicationStrategy");
@@ -4073,7 +4294,7 @@ class nr {
4073
4294
  i(this, "edgeEquilibriumLength");
4074
4295
  i(this, "edgeStiffness");
4075
4296
  i(this, "convergenceVelocity");
4076
- this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new ke(e.rand), this.nodeForcesApplicationStrategy = Ye({
4297
+ this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new He(e.rand), this.nodeForcesApplicationStrategy = je({
4077
4298
  distanceVectorGenerator: this.distanceVectorGenerator,
4078
4299
  nodeCharge: e.nodeCharge,
4079
4300
  maxForce: e.maxForce,
@@ -4081,7 +4302,7 @@ class nr {
4081
4302
  theta: e.barnesHutTheta,
4082
4303
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
4083
4304
  nodeMass: e.nodeMass
4084
- }), this.fillerLayoutAlgorithm = new Xe({
4305
+ }), this.fillerLayoutAlgorithm = new Je({
4085
4306
  rand: e.rand,
4086
4307
  sparsity: e.edgeEquilibriumLength
4087
4308
  });
@@ -4091,7 +4312,7 @@ class nr {
4091
4312
  graph: t,
4092
4313
  viewport: o
4093
4314
  });
4094
- for (let n = 0; n < this.maxIterations && !(new ze(
4315
+ for (let n = 0; n < this.maxIterations && !(new Xe(
4095
4316
  t,
4096
4317
  s,
4097
4318
  {
@@ -4107,7 +4328,7 @@ class nr {
4107
4328
  return s;
4108
4329
  }
4109
4330
  }
4110
- class ar {
4331
+ class cr {
4111
4332
  constructor(e) {
4112
4333
  i(this, "forest", /* @__PURE__ */ new Set());
4113
4334
  i(this, "remainingNodeIds");
@@ -4130,31 +4351,31 @@ class ar {
4130
4351
  const n = [];
4131
4352
  s.forEach((a) => {
4132
4353
  o.push(a);
4133
- const h = this.graph.getNodeOutgoingEdgeIds(a.nodeId).map((g) => {
4134
- const u = this.graph.getEdge(g);
4135
- return this.graph.getPort(u.to).nodeId;
4136
- }), d = this.graph.getNodeIncomingEdgeIds(a.nodeId).map((g) => {
4137
- const u = this.graph.getEdge(g);
4138
- return this.graph.getPort(u.from).nodeId;
4354
+ const h = this.graph.getNodeOutgoingEdgeIds(a.nodeId).map((u) => {
4355
+ const g = this.graph.getEdge(u);
4356
+ return this.graph.getPort(g.to).nodeId;
4357
+ }), d = this.graph.getNodeIncomingEdgeIds(a.nodeId).map((u) => {
4358
+ const g = this.graph.getEdge(u);
4359
+ return this.graph.getPort(g.from).nodeId;
4139
4360
  });
4140
4361
  (/* @__PURE__ */ new Set([
4141
4362
  ...h,
4142
4363
  ...d
4143
- ])).forEach((g) => {
4144
- if (!this.remainingNodeIds.has(g))
4364
+ ])).forEach((u) => {
4365
+ if (!this.remainingNodeIds.has(u))
4145
4366
  return;
4146
- this.remainingNodeIds.delete(g);
4147
- const u = {
4148
- nodeId: g,
4367
+ this.remainingNodeIds.delete(u);
4368
+ const g = {
4369
+ nodeId: u,
4149
4370
  children: /* @__PURE__ */ new Set()
4150
4371
  };
4151
- a.children.add(u), n.push(u);
4372
+ a.children.add(g), n.push(g);
4152
4373
  });
4153
4374
  }), s = n;
4154
4375
  }
4155
4376
  }
4156
4377
  }
4157
- class hr {
4378
+ class lr {
4158
4379
  constructor(e) {
4159
4380
  this.params = e;
4160
4381
  }
@@ -4162,17 +4383,17 @@ class hr {
4162
4383
  let t = 0;
4163
4384
  const o = [], s = e.length - 1, n = [];
4164
4385
  e.forEach((h, d) => {
4165
- if (t += this.params.spaceAroundRadius, h.forEach((c, g) => {
4166
- n[g] === void 0 ? n[g] = {
4386
+ if (t += this.params.spaceAroundRadius, h.forEach((c, u) => {
4387
+ n[u] === void 0 ? n[u] = {
4167
4388
  start: t + c.start,
4168
4389
  end: t + c.end
4169
- } : n[g].end = t + c.end;
4390
+ } : n[u].end = t + c.end;
4170
4391
  }), o.push(t), d !== s) {
4171
- const c = e[d + 1], g = n.map((u) => ({
4172
- start: u.start - t,
4173
- end: u.end - t
4392
+ const c = e[d + 1], u = n.map((g) => ({
4393
+ start: g.start - t,
4394
+ end: g.end - t
4174
4395
  }));
4175
- t += this.calculateMaxDiff(g, c);
4396
+ t += this.calculateMaxDiff(u, c);
4176
4397
  }
4177
4398
  t += this.params.spaceAroundRadius;
4178
4399
  });
@@ -4195,12 +4416,12 @@ class hr {
4195
4416
  return o - 2 * this.params.spaceAroundRadius;
4196
4417
  }
4197
4418
  }
4198
- class dr {
4419
+ class ur {
4199
4420
  constructor(e, t) {
4200
4421
  i(this, "offsets", /* @__PURE__ */ new Map());
4201
4422
  i(this, "treeSpans", /* @__PURE__ */ new Map());
4202
4423
  this.tree = e;
4203
- const o = t.spaceAroundRadius, s = new hr({
4424
+ const o = t.spaceAroundRadius, s = new lr({
4204
4425
  spaceAroundRadius: o
4205
4426
  });
4206
4427
  [...this.tree.sequence].reverse().forEach((n) => {
@@ -4222,37 +4443,37 @@ class dr {
4222
4443
  return this.offsets;
4223
4444
  }
4224
4445
  }
4225
- class cr {
4446
+ class gr {
4226
4447
  constructor(e) {
4227
4448
  this.params = e;
4228
4449
  }
4229
4450
  calculateCoordinates(e) {
4230
- const t = /* @__PURE__ */ new Map(), s = new ar(e.graph).generate();
4451
+ const t = /* @__PURE__ */ new Map(), s = new cr(e.graph).generate();
4231
4452
  let n = 0;
4232
4453
  return s.forEach((a) => {
4233
4454
  t.set(a.root.nodeId, { x: n, y: 0 });
4234
- const d = new dr(a, {
4455
+ const d = new ur(a, {
4235
4456
  spaceAroundRadius: this.params.layerSpace / 2
4236
4457
  }).generate();
4237
4458
  let c = [a.root];
4238
4459
  for (; c.length > 0; ) {
4239
- const g = [];
4240
- n += this.params.layerWidth, c.forEach((u) => {
4241
- u.children.forEach((l) => {
4242
- const p = t.get(u.nodeId).y;
4460
+ const u = [];
4461
+ n += this.params.layerWidth, c.forEach((g) => {
4462
+ g.children.forEach((l) => {
4463
+ const w = t.get(g.nodeId).y;
4243
4464
  t.set(l.nodeId, {
4244
- y: p + d.get(l.nodeId),
4465
+ y: w + d.get(l.nodeId),
4245
4466
  x: n
4246
- }), g.push(l);
4467
+ }), u.push(l);
4247
4468
  });
4248
- }), c = g;
4469
+ }), c = u;
4249
4470
  }
4250
4471
  }), t.forEach((a, h) => {
4251
4472
  t.set(h, this.params.transform(a));
4252
4473
  }), t;
4253
4474
  }
4254
4475
  }
4255
- class lr {
4476
+ class pr {
4256
4477
  constructor(e) {
4257
4478
  i(this, "distanceVectorGenerator");
4258
4479
  i(this, "nodeForcesApplicationStrategy");
@@ -4262,7 +4483,7 @@ class lr {
4262
4483
  i(this, "edgeEquilibriumLength");
4263
4484
  i(this, "edgeStiffness");
4264
4485
  i(this, "fillerLayoutAlgorithm");
4265
- this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new ke(e.rand), this.nodeForcesApplicationStrategy = Ye({
4486
+ this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new He(e.rand), this.nodeForcesApplicationStrategy = je({
4266
4487
  distanceVectorGenerator: this.distanceVectorGenerator,
4267
4488
  nodeCharge: e.nodeCharge,
4268
4489
  maxForce: e.maxForce,
@@ -4270,7 +4491,7 @@ class lr {
4270
4491
  theta: e.barnesHutTheta,
4271
4492
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
4272
4493
  nodeMass: e.nodeMass
4273
- }), this.fillerLayoutAlgorithm = new Xe({
4494
+ }), this.fillerLayoutAlgorithm = new Je({
4274
4495
  rand: e.rand,
4275
4496
  sparsity: e.edgeEquilibriumLength
4276
4497
  });
@@ -4280,7 +4501,7 @@ class lr {
4280
4501
  graph: t,
4281
4502
  viewport: o
4282
4503
  });
4283
- return new ze(
4504
+ return new Xe(
4284
4505
  t,
4285
4506
  n,
4286
4507
  {
@@ -4292,21 +4513,21 @@ class lr {
4292
4513
  edgeStiffness: this.edgeStiffness
4293
4514
  }
4294
4515
  ).apply() < this.convergenceVelocity && !t.getAllNodeIds().some((c) => {
4295
- const g = t.getNode(c);
4296
- return g.x === null || g.y === null;
4516
+ const u = t.getNode(c);
4517
+ return u.x === null || u.y === null;
4297
4518
  }) ? /* @__PURE__ */ new Map() : n;
4298
4519
  }
4299
4520
  }
4300
- const Ge = (r) => {
4521
+ const Ke = (r) => {
4301
4522
  let e = 1779033703, t = 3144134277, o = 1013904242, s = 2773480762;
4302
4523
  for (let n = 0, a; n < r.length; n++)
4303
4524
  a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = o ^ Math.imul(t ^ a, 2869860233), o = s ^ Math.imul(o ^ a, 951274213), s = e ^ Math.imul(s ^ a, 2716044179);
4304
4525
  return e = Math.imul(o ^ e >>> 18, 597399067), t = Math.imul(s ^ t >>> 22, 2869860233), o = Math.imul(e ^ o >>> 17, 951274213), s = Math.imul(t ^ s >>> 19, 2716044179), e ^= t ^ o ^ s, t ^= e, o ^= e, s ^= e, [e >>> 0, t >>> 0, o >>> 0, s >>> 0];
4305
- }, je = (r, e, t, o) => function() {
4526
+ }, Qe = (r, e, t, o) => function() {
4306
4527
  r |= 0, e |= 0, t |= 0, o |= 0;
4307
4528
  const s = (r + e | 0) + o | 0;
4308
4529
  return o = o + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + s | 0, (s >>> 0) / 4294967296;
4309
- }, E = Object.freeze({
4530
+ }, A = Object.freeze({
4310
4531
  seed: "HTMLGraph is awesome",
4311
4532
  maxTimeDeltaSec: 0.01,
4312
4533
  nodeCharge: 1e5,
@@ -4320,51 +4541,55 @@ const Ge = (r) => {
4320
4541
  nodeForceCoefficient: 1,
4321
4542
  barnesHutAreaRadiusThreshold: 0.01,
4322
4543
  barnesHutTheta: 1
4323
- }), gr = (r) => {
4544
+ }), F = Object.freeze({
4545
+ mouseDownEventVerifier: (r) => r.button === 0,
4546
+ mouseUpEventVerifier: (r) => r.button === 0,
4547
+ movementThreshold: 10
4548
+ }), wr = (r) => {
4324
4549
  var e, t;
4325
4550
  switch (r == null ? void 0 : r.type) {
4326
4551
  case "custom":
4327
4552
  return r.instance;
4328
4553
  default: {
4329
- const o = Ge((r == null ? void 0 : r.seed) ?? E.seed), s = je(o[0], o[1], o[2], o[3]);
4330
- return new lr({
4554
+ const o = Ke((r == null ? void 0 : r.seed) ?? A.seed), s = Qe(o[0], o[1], o[2], o[3]);
4555
+ return new pr({
4331
4556
  rand: s,
4332
- maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? E.maxTimeDeltaSec,
4333
- nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? E.nodeCharge,
4334
- nodeMass: (r == null ? void 0 : r.nodeMass) ?? E.nodeMass,
4335
- edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? E.edgeEquilibriumLength,
4336
- edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? E.edgeStiffness,
4337
- convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? E.convergenceVelocity,
4338
- maxForce: (r == null ? void 0 : r.maxForce) ?? E.maxForce,
4339
- nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? E.nodeForceCoefficient,
4340
- barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? E.barnesHutTheta,
4341
- barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? E.barnesHutAreaRadiusThreshold
4557
+ maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? A.maxTimeDeltaSec,
4558
+ nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? A.nodeCharge,
4559
+ nodeMass: (r == null ? void 0 : r.nodeMass) ?? A.nodeMass,
4560
+ edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? A.edgeEquilibriumLength,
4561
+ edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? A.edgeStiffness,
4562
+ convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? A.convergenceVelocity,
4563
+ maxForce: (r == null ? void 0 : r.maxForce) ?? A.maxForce,
4564
+ nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? A.nodeForceCoefficient,
4565
+ barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? A.barnesHutTheta,
4566
+ barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? A.barnesHutAreaRadiusThreshold
4342
4567
  });
4343
4568
  }
4344
4569
  }
4345
- }, K = {
4570
+ }, Q = {
4346
4571
  staticNodeResolver: () => !1,
4347
4572
  onBeforeApplied: () => {
4348
4573
  },
4349
4574
  onAfterApplied: () => {
4350
4575
  }
4351
- }, ur = (r) => {
4576
+ }, yr = (r) => {
4352
4577
  var t, o;
4353
4578
  return {
4354
- algorithm: gr((r == null ? void 0 : r.algorithm) ?? {}),
4355
- staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? K.staticNodeResolver,
4356
- onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? K.onBeforeApplied,
4357
- onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ?? K.onAfterApplied
4579
+ algorithm: wr((r == null ? void 0 : r.algorithm) ?? {}),
4580
+ staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? Q.staticNodeResolver,
4581
+ onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? Q.onBeforeApplied,
4582
+ onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ?? Q.onAfterApplied
4358
4583
  };
4359
- }, pr = (r) => r instanceof _ ? {
4584
+ }, fr = (r) => r instanceof q ? {
4360
4585
  type: "trigger",
4361
4586
  trigger: r
4362
4587
  } : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
4363
4588
  type: "topologyChangeSchedule",
4364
- schedule: Lt
4589
+ schedule: It
4365
4590
  } : {
4366
4591
  type: "topologyChangeSchedule",
4367
- schedule: Ft
4592
+ schedule: Ut
4368
4593
  }, B = Object.freeze({
4369
4594
  staticNodeResolver: () => !1,
4370
4595
  onBeforeApplied: () => {
@@ -4375,14 +4600,14 @@ const Ge = (r) => {
4375
4600
  layerWidth: 300,
4376
4601
  layerSpace: 300
4377
4602
  }
4378
- }), z = (r, e) => ({
4603
+ }), k = (r, e) => ({
4379
4604
  a: r.a * e.a + r.b * e.d,
4380
4605
  b: r.a * e.b + r.b * e.e,
4381
4606
  c: r.a * e.c + r.b * e.f + r.c,
4382
4607
  d: r.d * e.a + r.e * e.d,
4383
4608
  e: r.d * e.b + r.e * e.e,
4384
4609
  f: r.d * e.c + r.e * e.f + r.f
4385
- }), yr = (r) => {
4610
+ }), vr = (r) => {
4386
4611
  const { a: e, b: t, c: o, d: s, e: n, f: a } = r, h = e * n - t * s;
4387
4612
  return {
4388
4613
  a: n / h,
@@ -4393,7 +4618,7 @@ const Ge = (r) => {
4393
4618
  f: (o * s - e * a) / h
4394
4619
  };
4395
4620
  };
4396
- class wr {
4621
+ class mr {
4397
4622
  resolve(e) {
4398
4623
  if ("shift" in e)
4399
4624
  return this.createShiftBaseMatrix(e.shift);
@@ -4427,18 +4652,18 @@ class wr {
4427
4652
  return this.createRelativeTransform(o, s);
4428
4653
  }
4429
4654
  createMirrorRelativeMatrix(e, t) {
4430
- const o = this.createMirrorYBaseMatrix(), s = z(
4655
+ const o = this.createMirrorYBaseMatrix(), s = k(
4431
4656
  this.createShiftBaseMatrix(t),
4432
4657
  this.createRotateBaseMatrix(e)
4433
4658
  );
4434
4659
  return this.createRelativeTransform(o, s);
4435
4660
  }
4436
4661
  createRelativeTransform(e, t) {
4437
- const o = z(
4662
+ const o = k(
4438
4663
  t,
4439
4664
  e
4440
- ), s = yr(t);
4441
- return z(o, s);
4665
+ ), s = vr(t);
4666
+ return k(o, s);
4442
4667
  }
4443
4668
  createShiftBaseMatrix(e) {
4444
4669
  return {
@@ -4482,7 +4707,7 @@ class wr {
4482
4707
  };
4483
4708
  }
4484
4709
  }
4485
- const fr = (r) => {
4710
+ const xr = (r) => {
4486
4711
  if (r === void 0)
4487
4712
  return (s) => s;
4488
4713
  if (typeof r == "function")
@@ -4496,10 +4721,10 @@ const fr = (r) => {
4496
4721
  e: 1,
4497
4722
  f: 0
4498
4723
  };
4499
- const o = new wr();
4724
+ const o = new mr();
4500
4725
  return e.forEach((s) => {
4501
4726
  const n = o.resolve(s);
4502
- t = z(t, n);
4727
+ t = k(t, n);
4503
4728
  }), (s) => {
4504
4729
  const { x: n, y: a } = s;
4505
4730
  return {
@@ -4507,45 +4732,45 @@ const fr = (r) => {
4507
4732
  y: t.d * n + t.e * a + t.f
4508
4733
  };
4509
4734
  };
4510
- }, vr = (r) => {
4735
+ }, Er = (r) => {
4511
4736
  var e, t;
4512
4737
  switch (r == null ? void 0 : r.type) {
4513
4738
  case "custom":
4514
4739
  return r.instance;
4515
4740
  case "hierarchical":
4516
- return new cr({
4741
+ return new gr({
4517
4742
  layerWidth: r.layerWidth ?? B.hierarchicalLayout.layerWidth,
4518
4743
  layerSpace: r.layerSpace ?? B.hierarchicalLayout.layerSpace,
4519
- transform: fr(r.transform)
4744
+ transform: xr(r.transform)
4520
4745
  });
4521
4746
  default: {
4522
- const o = Ge((r == null ? void 0 : r.seed) ?? E.seed), s = je(o[0], o[1], o[2], o[3]);
4523
- return new nr({
4524
- dtSec: (r == null ? void 0 : r.dtSec) ?? E.dtSec,
4525
- maxIterations: (r == null ? void 0 : r.maxIterations) ?? E.maxIterations,
4747
+ const o = Ke((r == null ? void 0 : r.seed) ?? A.seed), s = Qe(o[0], o[1], o[2], o[3]);
4748
+ return new dr({
4749
+ dtSec: (r == null ? void 0 : r.dtSec) ?? A.dtSec,
4750
+ maxIterations: (r == null ? void 0 : r.maxIterations) ?? A.maxIterations,
4526
4751
  rand: s,
4527
- nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? E.nodeCharge,
4528
- nodeMass: (r == null ? void 0 : r.nodeMass) ?? E.nodeMass,
4529
- edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? E.edgeEquilibriumLength,
4530
- edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? E.edgeStiffness,
4531
- convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? E.convergenceVelocity,
4532
- maxForce: (r == null ? void 0 : r.maxForce) ?? E.maxForce,
4533
- nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? E.nodeForceCoefficient,
4534
- barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? E.barnesHutTheta,
4535
- barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? E.barnesHutAreaRadiusThreshold
4752
+ nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? A.nodeCharge,
4753
+ nodeMass: (r == null ? void 0 : r.nodeMass) ?? A.nodeMass,
4754
+ edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? A.edgeEquilibriumLength,
4755
+ edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? A.edgeStiffness,
4756
+ convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? A.convergenceVelocity,
4757
+ maxForce: (r == null ? void 0 : r.maxForce) ?? A.maxForce,
4758
+ nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? A.nodeForceCoefficient,
4759
+ barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? A.barnesHutTheta,
4760
+ barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? A.barnesHutAreaRadiusThreshold
4536
4761
  });
4537
4762
  }
4538
4763
  }
4539
- }, xr = (r) => {
4764
+ }, Ar = (r) => {
4540
4765
  var e, t;
4541
4766
  return {
4542
- algorithm: vr(r.algorithm),
4543
- applyOn: pr(r.applyOn),
4767
+ algorithm: Er(r.algorithm),
4768
+ applyOn: fr(r.applyOn),
4544
4769
  staticNodeResolver: r.staticNodeResolver ?? B.staticNodeResolver,
4545
4770
  onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? B.onBeforeApplied,
4546
4771
  onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? B.onAfterApplied
4547
4772
  };
4548
- }, mr = (r, e) => ({
4773
+ }, Sr = (r, e) => ({
4549
4774
  ...r,
4550
4775
  onNodeDragStarted: (t) => {
4551
4776
  e.add(t), r.onNodeDragStarted(t);
@@ -4553,7 +4778,7 @@ const fr = (r) => {
4553
4778
  onNodeDragFinished: (t) => {
4554
4779
  e.delete(t), r.onNodeDragFinished(t);
4555
4780
  }
4556
- }), Ar = (r, e) => {
4781
+ }), Nr = (r, e) => {
4557
4782
  r.graph.onBeforeNodeRemoved.subscribe((t) => {
4558
4783
  e.delete(t);
4559
4784
  }), r.graph.onBeforeClear.subscribe(() => {
@@ -4561,51 +4786,67 @@ const fr = (r) => {
4561
4786
  }), r.onBeforeDestroy.subscribe(() => {
4562
4787
  e.clear();
4563
4788
  });
4564
- }, Er = (r, e) => ({
4789
+ }, br = (r, e) => ({
4565
4790
  ...r,
4566
4791
  staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
4567
- }), Z = (r) => () => r, Ae = Z(0), Sr = () => {
4792
+ }), _ = (r) => () => r, Ne = _(0), Pr = () => {
4568
4793
  let r = 0;
4569
4794
  return () => r++;
4570
- }, br = (r, e) => {
4571
- let t = Ae, o = Ae;
4572
- const s = Sr();
4573
- return r === "incremental" && (t = s), e === "incremental" && (o = s), typeof r == "number" && (t = Z(r)), typeof e == "number" && (o = Z(e)), typeof r == "function" && (t = r), typeof e == "function" && (o = e), {
4795
+ }, Tr = (r, e) => {
4796
+ let t = Ne, o = Ne;
4797
+ const s = Pr();
4798
+ return r === "incremental" && (t = s), e === "incremental" && (o = s), typeof r == "number" && (t = _(r)), typeof e == "number" && (o = _(e)), typeof r == "function" && (t = r), typeof e == "function" && (o = e), {
4574
4799
  nodesPriorityFn: t,
4575
4800
  edgesPriorityFn: o
4576
4801
  };
4577
- }, Nr = (r) => {
4802
+ }, Cr = (r) => {
4578
4803
  var t, o, s, n, a;
4579
- const e = br(
4804
+ const e = Tr(
4580
4805
  (t = r.nodes) == null ? void 0 : t.priority,
4581
4806
  (o = r.edges) == null ? void 0 : o.priority
4582
4807
  );
4583
4808
  return {
4584
4809
  nodes: {
4585
- centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ?? Ce,
4810
+ centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ?? De,
4586
4811
  priorityFn: e.nodesPriorityFn
4587
4812
  },
4588
4813
  ports: {
4589
4814
  direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
4590
4815
  },
4591
4816
  edges: {
4592
- shapeFactory: le(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
4817
+ shapeFactory: pe(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
4593
4818
  priorityFn: e.edgesPriorityFn
4594
4819
  }
4595
4820
  };
4596
- }, Pr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : re, Cr = (r) => {
4597
- var o, s, n;
4598
- const { canvasDefaults: e } = r, t = r.hasLayout ? Pr(r.layoutParams) : re;
4821
+ }, Mr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : oe, Dr = (r) => {
4822
+ var o, s, n, a;
4823
+ const { canvasDefaults: e } = r, t = r.hasLayout ? Mr(r.layoutParams) : oe;
4599
4824
  return {
4600
4825
  focus: {
4601
- contentOffset: ((o = e.focus) == null ? void 0 : o.contentOffset) ?? 100,
4602
- minContentScale: ((s = e.focus) == null ? void 0 : s.minContentScale) ?? 0,
4826
+ contentPadding: ((o = e.focus) == null ? void 0 : o.contentPadding) ?? ((s = e.focus) == null ? void 0 : s.contentOffset) ?? 100,
4827
+ minContentScale: ((n = e.focus) == null ? void 0 : n.minContentScale) ?? 0,
4603
4828
  schedule: t,
4604
- animationDuration: ((n = e.focus) == null ? void 0 : n.animationDuration) ?? 0
4829
+ animationDuration: ((a = e.focus) == null ? void 0 : a.animationDuration) ?? 0
4605
4830
  }
4606
4831
  };
4607
- };
4608
- class Dr {
4832
+ }, Lr = (r, e, t, o) => ({
4833
+ canvas: r,
4834
+ element: e,
4835
+ window: t,
4836
+ onNodeSelected: o.onNodeSelected,
4837
+ mouseDownEventVerifier: o.mouseDownEventVerifier ?? F.mouseDownEventVerifier,
4838
+ mouseUpEventVerifier: o.mouseUpEventVerifier ?? F.mouseUpEventVerifier,
4839
+ movementThreshold: o.movementThreshold ?? F.movementThreshold
4840
+ }), Rr = (r, e, t, o) => ({
4841
+ canvas: r,
4842
+ element: e,
4843
+ window: t,
4844
+ onCanvasSelected: o.onCanvasSelected,
4845
+ mouseDownEventVerifier: o.mouseDownEventVerifier ?? F.mouseDownEventVerifier,
4846
+ mouseUpEventVerifier: o.mouseUpEventVerifier ?? F.mouseUpEventVerifier,
4847
+ movementThreshold: o.movementThreshold ?? F.movementThreshold
4848
+ });
4849
+ class Ir {
4609
4850
  constructor(e) {
4610
4851
  i(this, "used", !1);
4611
4852
  i(this, "canvasDefaults", {});
@@ -4617,6 +4858,8 @@ class Dr {
4617
4858
  i(this, "virtualScrollConfig");
4618
4859
  i(this, "layoutConfig", {});
4619
4860
  i(this, "animatedLayoutConfig", {});
4861
+ i(this, "userSelectableNodesConfig");
4862
+ i(this, "userSelectableCanvasConfig");
4620
4863
  i(this, "hasDraggableNodes", !1);
4621
4864
  i(this, "hasTransformableViewport", !1);
4622
4865
  i(this, "hasNodeResizeReactiveEdges", !1);
@@ -4625,7 +4868,7 @@ class Dr {
4625
4868
  i(this, "hasUserDraggableEdges", !1);
4626
4869
  i(this, "hasAnimatedLayout", !1);
4627
4870
  i(this, "hasLayout", !1);
4628
- i(this, "boxRenderingTrigger", new _());
4871
+ i(this, "boxRenderingTrigger", new q());
4629
4872
  i(this, "window", window);
4630
4873
  i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
4631
4874
  this.element = e;
@@ -4660,131 +4903,155 @@ class Dr {
4660
4903
  enableAnimatedLayout(e) {
4661
4904
  return this.animatedLayoutConfig = e ?? {}, this.hasAnimatedLayout = !0, this.hasLayout = !1, this;
4662
4905
  }
4906
+ enableUserSelectableNodes(e) {
4907
+ return this.userSelectableNodesConfig = e, this;
4908
+ }
4909
+ enableUserSelectableCanvas(e) {
4910
+ return this.userSelectableCanvasConfig = e, this;
4911
+ }
4663
4912
  build() {
4664
4913
  if (this.used)
4665
- throw new tr(
4914
+ throw new sr(
4666
4915
  "Failed to build Canvas because CanvasBuilder is a single-use object"
4667
4916
  );
4668
4917
  this.used = !0;
4669
- const e = new st(this.element), t = new be(), o = new Ht(this.element), s = this.createHtmlView(
4918
+ const e = new at(this.element), t = new Te(), o = new Gt(this.element), s = this.createHtmlView(
4670
4919
  o.main,
4671
4920
  t,
4672
4921
  e
4673
- ), n = Nr(
4922
+ ), n = Cr(
4674
4923
  this.canvasDefaults
4675
- ), a = new Ve(
4924
+ ), a = new Be(
4676
4925
  t,
4677
4926
  s,
4678
4927
  n
4679
- ), h = xr(this.layoutConfig), d = Cr({
4928
+ ), h = Ar(this.layoutConfig), d = Dr({
4680
4929
  canvasDefaults: this.canvasDefaults,
4681
4930
  hasLayout: this.hasLayout,
4682
4931
  layoutParams: h
4683
- }), c = new Oe(
4932
+ }), c = new ke(
4684
4933
  t,
4685
4934
  e,
4686
4935
  d,
4687
4936
  this.window
4688
- ), g = new $e(e), u = new Ie(t), l = new Se(
4689
- u,
4937
+ ), u = new We(e), g = new $e(t), l = new Pe(
4690
4938
  g,
4939
+ u,
4691
4940
  a,
4692
4941
  c
4693
4942
  );
4694
- if (this.hasBackground && ie.configure(
4943
+ if (this.hasBackground && ne.configure(
4695
4944
  l,
4696
- Qt(this.backgroundConfig),
4945
+ qt(this.backgroundConfig),
4697
4946
  o.background
4698
- ), this.hasNodeResizeReactiveEdges && q.configure(l), this.hasDraggableNodes) {
4699
- let y = Yt(this.dragConfig);
4700
- this.hasAnimatedLayout && (y = mr(
4701
- y,
4947
+ ), this.hasNodeResizeReactiveEdges && ee.configure(l), this.userSelectableNodesConfig !== void 0) {
4948
+ const p = Lr(
4949
+ l,
4950
+ o.main,
4951
+ this.window,
4952
+ this.userSelectableNodesConfig
4953
+ );
4954
+ ue.configure(p);
4955
+ }
4956
+ if (this.userSelectableCanvasConfig !== void 0) {
4957
+ const p = Rr(
4958
+ l,
4959
+ o.main,
4960
+ this.window,
4961
+ this.userSelectableCanvasConfig
4962
+ );
4963
+ ge.configure(p);
4964
+ }
4965
+ if (this.hasDraggableNodes) {
4966
+ let p = jt(this.dragConfig);
4967
+ this.hasAnimatedLayout && (p = Sr(
4968
+ p,
4702
4969
  this.animationStaticNodes
4703
- )), oe.configure(
4970
+ )), se.configure(
4704
4971
  l,
4705
4972
  o.main,
4706
4973
  this.window,
4707
- y
4974
+ p
4708
4975
  );
4709
4976
  }
4710
4977
  if (this.hasUserConnectablePorts) {
4711
- const y = Zt(
4978
+ const p = er(
4712
4979
  this.connectablePortsConfig,
4713
4980
  n.edges.shapeFactory,
4714
4981
  n.ports.direction
4715
4982
  );
4716
- ne.configure(
4983
+ ae.configure(
4717
4984
  l,
4718
4985
  o.overlayConnectablePorts,
4719
4986
  e,
4720
4987
  this.window,
4721
- y
4988
+ p
4722
4989
  );
4723
4990
  }
4724
4991
  if (this.hasUserDraggableEdges) {
4725
- const y = _t(
4992
+ const p = tr(
4726
4993
  this.draggableEdgesConfig,
4727
4994
  l.graph
4728
4995
  );
4729
- ae.configure(
4996
+ he.configure(
4730
4997
  l,
4731
4998
  o.overlayDraggableEdges,
4732
4999
  e,
4733
5000
  this.window,
4734
- y
5001
+ p
4735
5002
  );
4736
5003
  }
4737
- if (this.virtualScrollConfig !== void 0 ? se.configure(
5004
+ if (this.virtualScrollConfig !== void 0 ? ie.configure(
4738
5005
  l,
4739
5006
  o.main,
4740
5007
  this.window,
4741
- me(this.transformConfig),
5008
+ Se(this.transformConfig),
4742
5009
  this.boxRenderingTrigger,
4743
- qt(this.virtualScrollConfig)
4744
- ) : this.hasTransformableViewport && j.configure(
5010
+ rr(this.virtualScrollConfig)
5011
+ ) : this.hasTransformableViewport && J.configure(
4745
5012
  l,
4746
5013
  o.main,
4747
5014
  this.window,
4748
- me(this.transformConfig)
4749
- ), this.hasLayout && Wt.configure(l, h), this.hasAnimatedLayout) {
4750
- let y = ur(
5015
+ Se(this.transformConfig)
5016
+ ), this.hasLayout && Yt.configure(l, h), this.hasAnimatedLayout) {
5017
+ let p = yr(
4751
5018
  this.animatedLayoutConfig
4752
5019
  );
4753
- this.hasDraggableNodes && (Ar(
5020
+ this.hasDraggableNodes && (Nr(
4754
5021
  l,
4755
5022
  this.animationStaticNodes
4756
- ), y = Er(
4757
- y,
5023
+ ), p = br(
5024
+ p,
4758
5025
  this.animationStaticNodes
4759
- )), ce.configure(l, y, this.window);
5026
+ )), le.configure(l, p, this.window);
4760
5027
  }
4761
- const p = () => {
4762
- o.destroy(), l.onBeforeDestroy.unsubscribe(p);
5028
+ const w = () => {
5029
+ o.destroy(), l.onBeforeDestroy.unsubscribe(w);
4763
5030
  };
4764
- return l.onBeforeDestroy.subscribe(p), l;
5031
+ return l.onBeforeDestroy.subscribe(w), l;
4765
5032
  }
4766
5033
  createHtmlView(e, t, o) {
4767
- let s = new Ee(t, o, e);
4768
- return this.virtualScrollConfig !== void 0 && (s = new tt(
5034
+ let s = new be(t, o, e);
5035
+ return this.virtualScrollConfig !== void 0 && (s = new st(
4769
5036
  s,
4770
5037
  t,
4771
5038
  this.boxRenderingTrigger,
4772
- er(this.virtualScrollConfig)
4773
- )), s = new rt(s, t), s;
5039
+ or(this.virtualScrollConfig)
5040
+ )), s = new it(s, t), s;
4774
5041
  }
4775
5042
  }
4776
5043
  export {
4777
- Nt as BezierEdgeShape,
4778
- Dr as CanvasBuilder,
4779
- tr as CanvasBuilderError,
5044
+ Ct as BezierEdgeShape,
5045
+ Ir as CanvasBuilder,
5046
+ sr as CanvasBuilderError,
4780
5047
  S as CanvasError,
4781
- L as ConnectionCategory,
4782
- Le as DirectEdgeShape,
4783
- _ as EventSubject,
4784
- Pt as HorizontalEdgeShape,
4785
- Rt as InteractiveEdgeError,
4786
- Fe as InteractiveEdgeShape,
4787
- Mr as MidpointEdgeShape,
4788
- Ct as StraightEdgeShape,
4789
- Tt as VerticalEdgeShape
5048
+ V as ConnectionCategory,
5049
+ Ie as DirectEdgeShape,
5050
+ q as EventSubject,
5051
+ Mt as HorizontalEdgeShape,
5052
+ Ft as InteractiveEdgeError,
5053
+ Ue as InteractiveEdgeShape,
5054
+ Fr as MidpointEdgeShape,
5055
+ Dt as StraightEdgeShape,
5056
+ Lt as VerticalEdgeShape
4790
5057
  };