@html-graph/html-graph 7.8.0 → 7.9.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.
@@ -12,7 +12,7 @@ const He = () => {
12
12
  r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
13
13
  };
14
14
  class me {
15
- constructor(e, t, o) {
15
+ constructor(e, t, s) {
16
16
  i(this, "host", He());
17
17
  i(this, "container", Xe());
18
18
  i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
@@ -21,7 +21,7 @@ class me {
21
21
  const e = this.viewportStore.getContentMatrix();
22
22
  this.container.style.transform = `matrix(${e.scale}, 0, 0, ${e.scale}, ${e.x}, ${e.y})`;
23
23
  });
24
- this.graphStore = e, this.viewportStore = t, this.element = o, this.element.appendChild(this.host), this.host.appendChild(this.container), this.viewportStore.onAfterUpdated.subscribe(this.applyTransform);
24
+ this.graphStore = e, this.viewportStore = t, this.element = s, this.element.appendChild(this.host), this.host.appendChild(this.container), this.viewportStore.onAfterUpdated.subscribe(this.applyTransform);
25
25
  }
26
26
  attachNode(e) {
27
27
  const t = this.graphStore.getNode(e);
@@ -50,7 +50,7 @@ class me {
50
50
  this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.element.removeChild(this.host), this.host.removeChild(this.container);
51
51
  }
52
52
  updateNodePosition(e) {
53
- const t = this.graphStore.getNode(e), { width: o, height: s } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(o, s), d = a.x - n * h.x, c = a.y - n * h.y;
53
+ const t = this.graphStore.getNode(e), { width: s, height: o } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(s, o), d = a.x - n * h.x, c = a.y - n * h.y;
54
54
  t.element.style.transform = `translate(${d}px, ${c}px)`;
55
55
  }
56
56
  updateNodePriority(e) {
@@ -60,33 +60,33 @@ class me {
60
60
  updateEdgeShape(e) {
61
61
  const t = this.edgeIdToElementMap.get(e);
62
62
  this.container.removeChild(t);
63
- const s = this.graphStore.getEdge(e).payload.shape.svg;
64
- this.edgeIdToElementMap.set(e, s), this.container.appendChild(s);
63
+ const o = this.graphStore.getEdge(e).payload.shape.svg;
64
+ this.edgeIdToElementMap.set(e, o), this.container.appendChild(o);
65
65
  }
66
66
  renderEdge(e) {
67
- const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from), s = this.graphStore.getPort(t.to), n = o.element.getBoundingClientRect(), a = s.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix().scale, c = this.createEdgeRenderPort(
68
- o,
67
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), o = this.graphStore.getPort(t.to), n = s.element.getBoundingClientRect(), a = o.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix().scale, c = this.createEdgeRenderPort(
68
+ s,
69
69
  n,
70
70
  h,
71
71
  d
72
- ), g = this.createEdgeRenderPort(s, a, h, d);
72
+ ), g = this.createEdgeRenderPort(o, a, h, d);
73
73
  let l = M.Line;
74
- o.element === s.element ? l = M.PortCycle : o.nodeId === s.nodeId && (l = M.NodeCycle), t.payload.shape.render({ from: c, to: g, category: l });
74
+ s.element === o.element ? l = M.PortCycle : s.nodeId === o.nodeId && (l = M.NodeCycle), t.payload.shape.render({ from: c, to: g, category: l });
75
75
  }
76
76
  updateEdgePriority(e) {
77
77
  const t = this.graphStore.getEdge(e);
78
78
  t.payload.shape.svg.style.zIndex = `${t.payload.priority}`;
79
79
  }
80
- createEdgeRenderPort(e, t, o, s) {
80
+ createEdgeRenderPort(e, t, s, o) {
81
81
  const n = this.viewportStore.createContentCoords({
82
- x: t.left - o.left,
83
- y: t.top - o.top
82
+ x: t.left - s.left,
83
+ y: t.top - s.top
84
84
  });
85
85
  return {
86
86
  x: n.x,
87
87
  y: n.y,
88
- width: t.width * s,
89
- height: t.height * s,
88
+ width: t.width * o,
89
+ height: t.height * o,
90
90
  direction: e.payload.direction
91
91
  };
92
92
  }
@@ -103,39 +103,39 @@ class Ge {
103
103
  this.xFrom = e.x, this.xTo = e.x + e.width, this.yFrom = e.y, this.yTo = e.y + e.height;
104
104
  }
105
105
  hasNode(e) {
106
- const t = this.graphStore.getNode(e).payload, { x: o, y: s } = t;
107
- return o >= this.xFrom && o <= this.xTo && s >= this.yFrom && s <= this.yTo;
106
+ const t = this.graphStore.getNode(e).payload, { x: s, y: o } = t;
107
+ return s >= this.xFrom && s <= this.xTo && o >= this.yFrom && o <= this.yTo;
108
108
  }
109
109
  hasEdge(e) {
110
- 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);
110
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, o = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(s).payload, a = this.graphStore.getNode(o).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);
111
111
  return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
112
112
  }
113
113
  }
114
114
  class je {
115
- constructor(e, t, o, s) {
115
+ constructor(e, t, s, o) {
116
116
  i(this, "attachedNodes", /* @__PURE__ */ new Set());
117
117
  i(this, "attachedEdges", /* @__PURE__ */ new Set());
118
118
  i(this, "renderingBox");
119
119
  i(this, "updateViewport", (e) => {
120
120
  this.renderingBox.setRenderingBox(e);
121
- const t = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
121
+ const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
122
122
  this.graphStore.getAllNodeIds().forEach((a) => {
123
123
  const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
124
- h && !d ? t.add(a) : !h && d && o.add(a);
124
+ h && !d ? t.add(a) : !h && d && s.add(a);
125
125
  }), this.graphStore.getAllEdgeIds().forEach((a) => {
126
126
  const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), g = this.graphStore.getPort(c.from).nodeId, l = this.graphStore.getPort(c.to).nodeId;
127
- h && (this.renderingBox.hasNode(g) || (t.add(g), o.delete(g)), this.renderingBox.hasNode(l) || (t.add(l), o.delete(l))), h && !d ? s.add(a) : !h && d && n.add(a);
127
+ h && (this.renderingBox.hasNode(g) || (t.add(g), s.delete(g)), this.renderingBox.hasNode(l) || (t.add(l), s.delete(l))), h && !d ? o.add(a) : !h && d && n.add(a);
128
128
  }), n.forEach((a) => {
129
129
  this.handleDetachEdge(a);
130
- }), o.forEach((a) => {
130
+ }), s.forEach((a) => {
131
131
  this.handleDetachNode(a);
132
132
  }), t.forEach((a) => {
133
133
  this.attachedNodes.has(a) || this.handleAttachNode(a);
134
- }), s.forEach((a) => {
134
+ }), o.forEach((a) => {
135
135
  this.handleAttachEdge(a);
136
136
  });
137
137
  });
138
- this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new Ge(this.graphStore), this.trigger.subscribe(this.updateViewport);
138
+ this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = o, this.renderingBox = new Ge(this.graphStore), this.trigger.subscribe(this.updateViewport);
139
139
  }
140
140
  attachNode(e) {
141
141
  this.renderingBox.hasNode(e) && this.handleAttachNode(e);
@@ -173,8 +173,8 @@ class je {
173
173
  this.clear(), this.htmlView.destroy(), this.trigger.unsubscribe(this.updateViewport);
174
174
  }
175
175
  attachEdgeEntities(e) {
176
- const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, s = this.graphStore.getPort(t.to).nodeId;
177
- this.attachedNodes.has(o) || this.handleAttachNode(o), this.attachedNodes.has(s) || this.handleAttachNode(s), this.handleAttachEdge(e);
176
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, o = this.graphStore.getPort(t.to).nodeId;
177
+ this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(o) || this.handleAttachNode(o), this.handleAttachEdge(e);
178
178
  }
179
179
  handleAttachNode(e) {
180
180
  this.params.onBeforeNodeAttached(e), this.attachedNodes.add(e), this.htmlView.attachNode(e);
@@ -236,8 +236,8 @@ class qe {
236
236
  this.isNodeValid(e) && (this.deferredNodes.delete(e), this.htmlView.attachNode(e));
237
237
  }
238
238
  isEdgeValid(e) {
239
- const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from), s = this.graphStore.getPort(t.to);
240
- return !(this.deferredNodes.has(o.nodeId) || this.deferredNodes.has(s.nodeId));
239
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), o = this.graphStore.getPort(t.to);
240
+ return !(this.deferredNodes.has(s.nodeId) || this.deferredNodes.has(o.nodeId));
241
241
  }
242
242
  tryAttachEdge(e) {
243
243
  this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
@@ -286,22 +286,22 @@ class b extends Error {
286
286
  }
287
287
  }
288
288
  class ve {
289
- constructor(e, t, o, s, n, a) {
289
+ constructor(e, t, s, o, n, a) {
290
290
  i(this, "nodeIdGenerator", new X(
291
- (e) => this.graphStore.getNode(e) !== void 0
291
+ (e) => this.graphStore.hasNode(e)
292
292
  ));
293
293
  i(this, "portIdGenerator", new X(
294
- (e) => this.graphStore.getPort(e) !== void 0
294
+ (e) => this.graphStore.hasPort(e)
295
295
  ));
296
296
  i(this, "edgeIdGenerator", new X(
297
- (e) => this.graphStore.getEdge(e) !== void 0
297
+ (e) => this.graphStore.hasEdge(e)
298
298
  ));
299
299
  i(this, "onAfterNodeAdded", (e) => {
300
300
  this.htmlView.attachNode(e);
301
301
  });
302
302
  i(this, "onAfterNodeUpdated", (e) => {
303
- this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((o) => {
304
- this.htmlView.renderEdge(o);
303
+ this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((s) => {
304
+ this.htmlView.renderEdge(s);
305
305
  });
306
306
  });
307
307
  i(this, "onAfterNodePriorityUpdated", (e) => {
@@ -313,8 +313,8 @@ class ve {
313
313
  }), this.htmlView.detachNode(e);
314
314
  });
315
315
  i(this, "onAfterPortUpdated", (e) => {
316
- this.graphStore.getPortAdjacentEdgeIds(e).forEach((o) => {
317
- this.htmlView.renderEdge(o);
316
+ this.graphStore.getPortAdjacentEdgeIds(e).forEach((s) => {
317
+ this.htmlView.renderEdge(s);
318
318
  });
319
319
  });
320
320
  i(this, "onBeforePortUnmarked", (e) => {
@@ -346,7 +346,7 @@ class ve {
346
346
  * emits event just before destruction of canvas
347
347
  */
348
348
  i(this, "onBeforeDestroy");
349
- this.graph = e, this.viewport = t, this.graphStore = o, this.viewportStore = s, this.htmlView = n, this.params = a, this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
349
+ this.graph = e, this.viewport = t, this.graphStore = s, this.viewportStore = o, this.htmlView = n, this.params = a, this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
350
350
  this.onAfterNodePriorityUpdated
351
351
  ), this.graphStore.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.subscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.subscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.subscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.subscribe(
352
352
  this.onAfterEdgeShapeUpdated
@@ -359,9 +359,9 @@ class ve {
359
359
  */
360
360
  addNode(e) {
361
361
  const t = this.nodeIdGenerator.create(e.id);
362
- if (this.graphStore.getNode(t) !== void 0)
362
+ if (this.graphStore.hasNode(t))
363
363
  throw new b("failed to add node with existing id");
364
- if (this.graphStore.getElementNodeId(e.element) !== void 0)
364
+ if (this.graphStore.findNodeIdByElement(e.element) !== void 0)
365
365
  throw new b(
366
366
  "failed to add node with html element already in use by another node"
367
367
  );
@@ -373,12 +373,12 @@ class ve {
373
373
  centerFn: e.centerFn ?? this.params.nodes.centerFn,
374
374
  priority: e.priority ?? this.params.nodes.priorityFn()
375
375
  }), e.ports !== void 0)
376
- for (const o of e.ports)
376
+ for (const s of e.ports)
377
377
  this.markPort({
378
- id: o.id,
379
- element: o.element,
378
+ id: s.id,
379
+ element: s.element,
380
380
  nodeId: t,
381
- direction: o.direction
381
+ direction: s.direction
382
382
  });
383
383
  return this;
384
384
  }
@@ -386,7 +386,7 @@ class ve {
386
386
  * updates node parameters
387
387
  */
388
388
  updateNode(e, t) {
389
- if (this.graphStore.getNode(e) === void 0)
389
+ if (!this.graphStore.hasNode(e))
390
390
  throw new b("failed to update nonexistent node");
391
391
  return this.graphStore.updateNode(e, t ?? {}), this;
392
392
  }
@@ -396,7 +396,7 @@ class ve {
396
396
  * all the edges adjacent to node get removed
397
397
  */
398
398
  removeNode(e) {
399
- if (this.graphStore.getNode(e) === void 0)
399
+ if (!this.graphStore.hasNode(e))
400
400
  throw new b("failed to remove nonexistent node");
401
401
  return this.graphStore.removeNode(e), this;
402
402
  }
@@ -405,9 +405,9 @@ class ve {
405
405
  */
406
406
  markPort(e) {
407
407
  const t = this.portIdGenerator.create(e.id);
408
- if (this.graphStore.getPort(t) !== void 0)
408
+ if (this.graphStore.hasPort(t))
409
409
  throw new b("failed to add port with existing id");
410
- if (this.graphStore.getNode(e.nodeId) === void 0)
410
+ if (!this.graphStore.hasNode(e.nodeId))
411
411
  throw new b("failed to mark port for nonexistent node");
412
412
  return this.graphStore.addPort({
413
413
  id: t,
@@ -420,7 +420,7 @@ class ve {
420
420
  * updates port and edges attached to it
421
421
  */
422
422
  updatePort(e, t) {
423
- if (this.graphStore.getPort(e) === void 0)
423
+ if (!this.graphStore.hasPort(e))
424
424
  throw new b("failed to update nonexistent port");
425
425
  return this.graphStore.updatePort(e, t ?? {}), this;
426
426
  }
@@ -429,7 +429,7 @@ class ve {
429
429
  * all the edges adjacent to the port get removed
430
430
  */
431
431
  unmarkPort(e) {
432
- if (this.graphStore.getPort(e) === void 0)
432
+ if (!this.graphStore.hasPort(e))
433
433
  throw new b("failed to unmark nonexistent port");
434
434
  return this.graphStore.removePort(e), this;
435
435
  }
@@ -438,11 +438,11 @@ class ve {
438
438
  */
439
439
  addEdge(e) {
440
440
  const t = this.edgeIdGenerator.create(e.id);
441
- if (this.graphStore.getEdge(t) !== void 0)
441
+ if (this.graphStore.hasEdge(t))
442
442
  throw new b("failed to add edge with existing id");
443
- if (this.graphStore.getPort(e.from) === void 0)
443
+ if (!this.graphStore.hasPort(e.from))
444
444
  throw new b("failed to add edge from nonexistent port");
445
- if (this.graphStore.getPort(e.to) === void 0)
445
+ if (!this.graphStore.hasPort(e.to))
446
446
  throw new b("failed to add edge to nonexistent port");
447
447
  return this.graphStore.addEdge({
448
448
  id: t,
@@ -456,7 +456,7 @@ class ve {
456
456
  * updates specified edge
457
457
  */
458
458
  updateEdge(e, t) {
459
- if (this.graphStore.getEdge(e) === void 0)
459
+ if (!this.graphStore.hasEdge(e))
460
460
  throw new b("failed to update nonexistent edge");
461
461
  return this.graphStore.updateEdge(e, t ?? {}), this;
462
462
  }
@@ -464,7 +464,7 @@ class ve {
464
464
  * removes specified edge
465
465
  */
466
466
  removeEdge(e) {
467
- if (this.graphStore.getEdge(e) === void 0)
467
+ if (!this.graphStore.hasEdge(e))
468
468
  throw new b("failed to remove nonexistent edge");
469
469
  return this.graphStore.removeEdge(e), this;
470
470
  }
@@ -507,31 +507,31 @@ class Ke {
507
507
  i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
508
508
  }
509
509
  addRecord(e, t) {
510
- const o = this.singleToMultiMap.get(e);
511
- o === void 0 ? this.singleToMultiMap.set(e, /* @__PURE__ */ new Set([t])) : o.add(t), this.multiToSingleMap.set(t, e);
510
+ const s = this.singleToMultiMap.get(e);
511
+ s === void 0 ? this.singleToMultiMap.set(e, /* @__PURE__ */ new Set([t])) : s.add(t), this.multiToSingleMap.set(t, e);
512
512
  }
513
513
  getMultiBySingle(e) {
514
514
  const t = this.singleToMultiMap.get(e) ?? /* @__PURE__ */ new Set();
515
515
  return Array.from(t.values());
516
516
  }
517
517
  removeByMulti(e) {
518
- const t = this.multiToSingleMap.get(e), o = this.singleToMultiMap.get(t);
519
- o.delete(e), o.size === 0 && this.singleToMultiMap.delete(t), this.multiToSingleMap.delete(e);
518
+ const t = this.multiToSingleMap.get(e), s = this.singleToMultiMap.get(t);
519
+ s.delete(e), s.size === 0 && this.singleToMultiMap.delete(t), this.multiToSingleMap.delete(e);
520
520
  }
521
521
  getByMulti(e) {
522
522
  return this.multiToSingleMap.get(e);
523
523
  }
524
524
  removeBySingle(e) {
525
- this.singleToMultiMap.get(e).forEach((o) => {
526
- this.multiToSingleMap.delete(o);
525
+ this.singleToMultiMap.get(e).forEach((s) => {
526
+ this.multiToSingleMap.delete(s);
527
527
  }), this.singleToMultiMap.delete(e);
528
528
  }
529
529
  clear() {
530
530
  this.singleToMultiMap.clear(), this.multiToSingleMap.clear();
531
531
  }
532
532
  forEachSingle(e) {
533
- this.singleToMultiMap.forEach((t, o) => {
534
- e(o);
533
+ this.singleToMultiMap.forEach((t, s) => {
534
+ e(s);
535
535
  });
536
536
  }
537
537
  hasSingle(e) {
@@ -579,8 +579,18 @@ class Ae {
579
579
  i(this, "onBeforeClear");
580
580
  [this.afterNodeAddedEmitter, this.onAfterNodeAdded] = E(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = E(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = E(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = E(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = E(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = E(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = E(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = E(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = E(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = E(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = E(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = E(), [this.beforeClearEmitter, this.onBeforeClear] = E();
581
581
  }
582
+ hasNode(e) {
583
+ return this.nodes.has(e);
584
+ }
585
+ /**
586
+ * TODO: v8
587
+ * throw error when node does not exist
588
+ */
589
+ getNode(e) {
590
+ return this.nodes.get(e);
591
+ }
582
592
  addNode(e) {
583
- const t = /* @__PURE__ */ new Map(), o = {
593
+ const t = /* @__PURE__ */ new Map(), s = {
584
594
  element: e.element,
585
595
  payload: {
586
596
  x: e.x,
@@ -590,26 +600,33 @@ class Ae {
590
600
  },
591
601
  ports: t
592
602
  };
593
- this.nodes.set(e.id, o), this.nodesElementsMap.set(e.element, e.id), this.afterNodeAddedEmitter.emit(e.id);
603
+ this.nodes.set(e.id, s), this.nodesElementsMap.set(e.element, e.id), this.afterNodeAddedEmitter.emit(e.id);
594
604
  }
595
605
  getAllNodeIds() {
596
606
  return Array.from(this.nodes.keys());
597
607
  }
598
- getNode(e) {
599
- return this.nodes.get(e);
600
- }
601
- getElementNodeId(e) {
608
+ findNodeIdByElement(e) {
602
609
  return this.nodesElementsMap.get(e);
603
610
  }
604
611
  updateNode(e, t) {
605
- const o = this.nodes.get(e).payload;
606
- 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);
612
+ const s = this.nodes.get(e).payload;
613
+ s.x = t.x ?? s.x, s.y = t.y ?? s.y, s.centerFn = t.centerFn ?? s.centerFn, t.priority !== void 0 && (s.priority = t.priority, this.afterNodePriorityUpdatedEmitter.emit(e)), this.afterNodeUpdatedEmitter.emit(e);
607
614
  }
608
615
  removeNode(e) {
609
616
  this.beforeNodeRemovedEmitter.emit(e);
610
617
  const t = this.nodes.get(e);
611
618
  this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
612
619
  }
620
+ hasPort(e) {
621
+ return this.ports.has(e);
622
+ }
623
+ /**
624
+ * TODO: v8
625
+ * throw error when port does not exist
626
+ */
627
+ getPort(e) {
628
+ return this.ports.get(e);
629
+ }
613
630
  addPort(e) {
614
631
  this.ports.set(e.id, {
615
632
  element: e.element,
@@ -619,17 +636,14 @@ class Ae {
619
636
  nodeId: e.nodeId
620
637
  }), this.elementPorts.addRecord(e.element, e.id), this.portCycleEdges.set(e.id, /* @__PURE__ */ new Set()), this.portIncomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.portOutcomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.nodes.get(e.nodeId).ports.set(e.id, e.element), this.afterPortAddedEmitter.emit(e.id);
621
638
  }
622
- getPort(e) {
623
- return this.ports.get(e);
624
- }
625
639
  updatePort(e, t) {
626
- const o = this.ports.get(e).payload;
627
- o.direction = t.direction ?? o.direction, this.afterPortUpdatedEmitter.emit(e);
640
+ const s = this.ports.get(e).payload;
641
+ s.direction = t.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(e);
628
642
  }
629
643
  getAllPortIds() {
630
644
  return Array.from(this.ports.keys());
631
645
  }
632
- getElementPortIds(e) {
646
+ findPortIdsByElement(e) {
633
647
  return this.elementPorts.getMultiBySingle(e);
634
648
  }
635
649
  getNodePortIds(e) {
@@ -641,29 +655,36 @@ class Ae {
641
655
  const t = this.ports.get(e).nodeId;
642
656
  this.beforePortRemovedEmitter.emit(e), this.nodes.get(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
643
657
  }
658
+ hasEdge(e) {
659
+ return this.edges.has(e);
660
+ }
661
+ /**
662
+ * TODO: v8
663
+ * throw error when edge does not exist
664
+ */
665
+ getEdge(e) {
666
+ return this.edges.get(e);
667
+ }
644
668
  addEdge(e) {
645
669
  this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
646
670
  }
647
671
  updateEdge(e, t) {
648
672
  if (t.from !== void 0 || t.to !== void 0) {
649
- const s = this.edges.get(e), n = s.payload;
673
+ const o = this.edges.get(e), n = o.payload;
650
674
  this.removeEdgeInternal(e), this.addEdgeInternal({
651
675
  id: e,
652
- from: t.from ?? s.from,
653
- to: t.to ?? s.to,
676
+ from: t.from ?? o.from,
677
+ to: t.to ?? o.to,
654
678
  shape: n.shape,
655
679
  priority: n.priority
656
680
  });
657
681
  }
658
- const o = this.edges.get(e);
659
- t.shape !== void 0 && (o.payload.shape = t.shape, this.afterEdgeShapeUpdatedEmitter.emit(e)), t.priority !== void 0 && (o.payload.priority = t.priority, this.afterEdgePriorityUpdatedEmitter.emit(e)), this.afterEdgeUpdatedEmitter.emit(e);
682
+ const s = this.edges.get(e);
683
+ t.shape !== void 0 && (s.payload.shape = t.shape, this.afterEdgeShapeUpdatedEmitter.emit(e)), t.priority !== void 0 && (s.payload.priority = t.priority, this.afterEdgePriorityUpdatedEmitter.emit(e)), this.afterEdgeUpdatedEmitter.emit(e);
660
684
  }
661
685
  getAllEdgeIds() {
662
686
  return Array.from(this.edges.keys());
663
687
  }
664
- getEdge(e) {
665
- return this.edges.get(e);
666
- }
667
688
  removeEdge(e) {
668
689
  this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
669
690
  }
@@ -687,51 +708,51 @@ class Ae {
687
708
  ];
688
709
  }
689
710
  getNodeIncomingEdgeIds(e) {
690
- const t = Array.from(this.nodes.get(e).ports.keys()), o = [];
691
- return t.forEach((s) => {
692
- this.getPortIncomingEdgeIds(s).filter((n) => {
711
+ const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
712
+ return t.forEach((o) => {
713
+ this.getPortIncomingEdgeIds(o).filter((n) => {
693
714
  const a = this.getEdge(n);
694
715
  return this.getPort(a.from).nodeId !== e;
695
716
  }).forEach((n) => {
696
- o.push(n);
717
+ s.push(n);
697
718
  });
698
- }), o;
719
+ }), s;
699
720
  }
700
721
  getNodeOutgoingEdgeIds(e) {
701
- const t = Array.from(this.nodes.get(e).ports.keys()), o = [];
702
- return t.forEach((s) => {
703
- this.getPortOutgoingEdgeIds(s).filter((n) => {
722
+ const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
723
+ return t.forEach((o) => {
724
+ this.getPortOutgoingEdgeIds(o).filter((n) => {
704
725
  const a = this.getEdge(n);
705
726
  return this.getPort(a.to).nodeId !== e;
706
727
  }).forEach((n) => {
707
- o.push(n);
728
+ s.push(n);
708
729
  });
709
- }), o;
730
+ }), s;
710
731
  }
711
732
  getNodeCycleEdgeIds(e) {
712
- const t = Array.from(this.nodes.get(e).ports.keys()), o = [];
713
- return t.forEach((s) => {
714
- this.getPortCycleEdgeIds(s).forEach((n) => {
715
- o.push(n);
716
- }), this.getPortIncomingEdgeIds(s).filter((n) => {
733
+ const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
734
+ return t.forEach((o) => {
735
+ this.getPortCycleEdgeIds(o).forEach((n) => {
736
+ s.push(n);
737
+ }), this.getPortIncomingEdgeIds(o).filter((n) => {
717
738
  const a = this.getEdge(n);
718
739
  return this.getPort(a.to).nodeId === e;
719
740
  }).forEach((n) => {
720
- o.push(n);
741
+ s.push(n);
721
742
  });
722
- }), o;
743
+ }), s;
723
744
  }
724
745
  getNodeAdjacentEdgeIds(e) {
725
- const t = Array.from(this.nodes.get(e).ports.keys()), o = [];
726
- return t.forEach((s) => {
727
- this.getPortIncomingEdgeIds(s).forEach((n) => {
728
- o.push(n);
729
- }), this.getPortOutgoingEdgeIds(s).forEach((n) => {
730
- o.push(n);
731
- }), this.getPortCycleEdgeIds(s).forEach((n) => {
732
- o.push(n);
746
+ const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
747
+ return t.forEach((o) => {
748
+ this.getPortIncomingEdgeIds(o).forEach((n) => {
749
+ s.push(n);
750
+ }), this.getPortOutgoingEdgeIds(o).forEach((n) => {
751
+ s.push(n);
752
+ }), this.getPortCycleEdgeIds(o).forEach((n) => {
753
+ s.push(n);
733
754
  });
734
- }), o;
755
+ }), s;
735
756
  }
736
757
  addEdgeInternal(e) {
737
758
  this.edges.set(e.id, {
@@ -744,8 +765,8 @@ class Ae {
744
765
  }), e.from !== e.to ? (this.portOutcomingEdges.get(e.from).add(e.id), this.portIncomingEdges.get(e.to).add(e.id)) : this.portCycleEdges.get(e.from).add(e.id);
745
766
  }
746
767
  removeEdgeInternal(e) {
747
- const t = this.edges.get(e), o = t.from, s = t.to;
748
- this.portCycleEdges.get(o).delete(e), this.portCycleEdges.get(s).delete(e), this.portIncomingEdges.get(o).delete(e), this.portIncomingEdges.get(s).delete(e), this.portOutcomingEdges.get(o).delete(e), this.portOutcomingEdges.get(s).delete(e), this.edges.delete(e);
768
+ const t = this.edges.get(e), s = t.from, o = t.to;
769
+ this.portCycleEdges.get(s).delete(e), this.portCycleEdges.get(o).delete(e), this.portIncomingEdges.get(s).delete(e), this.portIncomingEdges.get(o).delete(e), this.portOutcomingEdges.get(s).delete(e), this.portOutcomingEdges.get(o).delete(e), this.edges.delete(e);
749
770
  }
750
771
  }
751
772
  const de = (r) => ({
@@ -825,9 +846,9 @@ class q {
825
846
  this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
826
847
  });
827
848
  this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
828
- t.forEach((o) => {
829
- const s = o.target;
830
- this.handleNodeResize(s);
849
+ t.forEach((s) => {
850
+ const o = s.target;
851
+ this.handleNodeResize(o);
831
852
  });
832
853
  }), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
833
854
  }
@@ -840,9 +861,9 @@ class q {
840
861
  }
841
862
  }
842
863
  const Ze = (r, e, t) => {
843
- const { x: o, y: s, width: n, height: a } = r.getBoundingClientRect();
844
- return e >= o && e <= o + n && t >= s && t <= s + a;
845
- }, Je = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, L = (r, e, t, o) => Ze(e, t, o) && Je(r, t, o), $ = (r, e) => {
864
+ const { x: s, y: o, width: n, height: a } = r.getBoundingClientRect();
865
+ return e >= s && e <= s + n && t >= o && t <= o + a;
866
+ }, Je = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, L = (r, e, t, s) => Ze(e, t, s) && Je(r, t, s), $ = (r, e) => {
846
867
  e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
847
868
  }, U = (r) => {
848
869
  const e = document.createElement("div");
@@ -862,13 +883,13 @@ const Ze = (r, e, t) => {
862
883
  }, _e = (r, e) => {
863
884
  let t = e;
864
885
  for (; t !== null; ) {
865
- const o = r.getElementPortIds(t)[0] ?? null;
866
- if (o !== null)
886
+ const s = r.findPortIdsByElement(t)[0] ?? null;
887
+ if (s !== null)
867
888
  return {
868
889
  status: "portFound",
869
- portId: o
890
+ portId: s
870
891
  };
871
- if (r.getElementNodeId(t) !== null)
892
+ if (r.findNodeIdByElement(t) !== null)
872
893
  return {
873
894
  status: "nodeEncountered"
874
895
  };
@@ -880,22 +901,22 @@ const Ze = (r, e, t) => {
880
901
  };
881
902
  function* Ee(r, e) {
882
903
  const t = r.elementsFromPoint(e.x, e.y);
883
- for (const o of t) {
884
- if (o.shadowRoot !== null) {
885
- const s = Ee(o.shadowRoot, e);
886
- for (const n of s)
904
+ for (const s of t) {
905
+ if (s.shadowRoot !== null) {
906
+ const o = Ee(s.shadowRoot, e);
907
+ for (const n of o)
887
908
  yield n;
888
909
  }
889
- yield o;
910
+ yield s;
890
911
  }
891
912
  }
892
913
  const xe = (r, e) => {
893
914
  const t = Ee(document, e);
894
- for (const o of t) {
895
- const s = _e(r, o);
896
- if (s.status === "portFound")
897
- return s.portId;
898
- if (s.status === "nodeEncountered")
915
+ for (const s of t) {
916
+ const o = _e(r, s);
917
+ if (o.status === "portFound")
918
+ return o.portId;
919
+ if (o.status === "nodeEncountered")
899
920
  return null;
900
921
  }
901
922
  return null;
@@ -914,21 +935,21 @@ const Se = (r, e) => ({
914
935
  const t = {
915
936
  x: r.x + r.width / 2,
916
937
  y: r.y + r.height / 2
917
- }, o = {
938
+ }, s = {
918
939
  x: e.x + e.width / 2,
919
940
  y: e.y + e.height / 2
920
- }, s = Math.min(t.x, o.x), n = Math.min(t.y, o.y), a = Math.abs(o.x - t.x), h = Math.abs(o.y - t.y), d = t.x <= o.x ? 1 : -1, c = t.y <= o.y ? 1 : -1;
941
+ }, o = Math.min(t.x, s.x), n = Math.min(t.y, s.y), a = Math.abs(s.x - t.x), h = Math.abs(s.y - t.y), d = t.x <= s.x ? 1 : -1, c = t.y <= s.y ? 1 : -1;
921
942
  return {
922
- x: s,
943
+ x: o,
923
944
  y: n,
924
945
  width: a,
925
946
  height: h,
926
947
  flipX: d,
927
948
  flipY: c
928
949
  };
929
- }, W = (r, e, t, o) => ({
930
- x: e * r.x + (1 - e) / 2 * o.x,
931
- y: t * r.y + (1 - t) / 2 * o.y
950
+ }, W = (r, e, t, s) => ({
951
+ x: e * r.x + (1 - e) / 2 * s.x,
952
+ y: t * r.y + (1 - t) / 2 * s.y
932
953
  });
933
954
  class et {
934
955
  constructor(e) {
@@ -937,21 +958,21 @@ class et {
937
958
  this.params = e;
938
959
  const t = this.params.to;
939
960
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
940
- const o = m(
961
+ const s = m(
941
962
  { x: this.params.arrowLength, y: p.y },
942
963
  this.params.sourceDirection,
943
964
  p
944
- ), s = m(
965
+ ), o = m(
945
966
  { x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
946
967
  this.params.targetDirection,
947
968
  this.params.to
948
969
  ), n = {
949
- x: o.x + this.params.sourceDirection.x * this.params.curvature,
950
- y: o.y + this.params.sourceDirection.y * this.params.curvature
970
+ x: s.x + this.params.sourceDirection.x * this.params.curvature,
971
+ y: s.y + this.params.sourceDirection.y * this.params.curvature
951
972
  }, a = {
952
- x: s.x - this.params.targetDirection.x * this.params.curvature,
953
- y: s.y - this.params.targetDirection.y * this.params.curvature
954
- }, h = `M ${o.x} ${o.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${s.x} ${s.y}`, d = this.params.hasSourceArrow ? "" : `M ${p.x} ${p.y} L ${o.x} ${o.y} `, c = this.params.hasTargetArrow ? "" : ` M ${s.x} ${s.y} L ${this.params.to.x} ${this.params.to.y}`;
973
+ x: o.x - this.params.targetDirection.x * this.params.curvature,
974
+ y: o.y - this.params.targetDirection.y * this.params.curvature
975
+ }, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${o.x} ${o.y}`, d = this.params.hasSourceArrow ? "" : `M ${p.x} ${p.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${o.x} ${o.y} L ${this.params.to.x} ${this.params.to.y}`;
955
976
  this.path = `${d}${h}${c}`;
956
977
  }
957
978
  }
@@ -964,22 +985,22 @@ class tt {
964
985
  { x: this.params.arrowLength, y: p.y },
965
986
  this.params.sourceDirection,
966
987
  p
967
- ) : p, o = this.params.hasTargetArrow ? m(
988
+ ) : p, s = this.params.hasTargetArrow ? m(
968
989
  {
969
990
  x: this.params.to.x - this.params.arrowLength,
970
991
  y: this.params.to.y
971
992
  },
972
993
  this.params.targetDirection,
973
994
  this.params.to
974
- ) : this.params.to, s = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = m(
975
- { x: s, y: p.y },
995
+ ) : this.params.to, o = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = m(
996
+ { x: o, y: p.y },
976
997
  this.params.sourceDirection,
977
998
  p
978
999
  ), g = {
979
1000
  x: c.x + h,
980
1001
  y: c.y + d
981
1002
  }, l = m(
982
- { x: this.params.to.x - s, y: this.params.to.y },
1003
+ { x: this.params.to.x - o, y: this.params.to.y },
983
1004
  this.params.targetDirection,
984
1005
  this.params.to
985
1006
  ), u = {
@@ -1006,7 +1027,7 @@ class tt {
1006
1027
  `L ${c.x} ${c.y}`,
1007
1028
  `C ${y.x} ${y.y} ${x.x} ${x.y} ${w.x} ${w.y}`,
1008
1029
  `C ${S.x} ${S.y} ${A.x} ${A.y} ${l.x} ${l.y}`,
1009
- `L ${o.x} ${o.y}`
1030
+ `L ${s.x} ${s.y}`
1010
1031
  ].join(" "), this.midpoint = W(w, e.flipX, e.flipY, e.to);
1011
1032
  }
1012
1033
  }
@@ -1024,21 +1045,21 @@ const K = Object.freeze({
1024
1045
  }, Te = () => {
1025
1046
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1026
1047
  return r.style.transformOrigin = "50% 50%", r;
1027
- }, De = (r, e) => {
1048
+ }, Ne = (r, e) => {
1028
1049
  r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${Math.max(e.width, 1)}px`, r.style.height = `${Math.max(e.height, 1)}px`;
1029
- }, N = (r, e) => {
1050
+ }, D = (r, e) => {
1030
1051
  const t = [];
1031
1052
  if (r.length > 0 && t.push(`M ${r[0].x} ${r[0].y}`), r.length === 2 && t.push(`L ${r[1].x} ${r[1].y}`), r.length > 2) {
1032
- const o = r.length - 1;
1033
- let s = 0, n = 0, a = 0;
1053
+ const s = r.length - 1;
1054
+ let o = 0, n = 0, a = 0;
1034
1055
  r.forEach((h, d) => {
1035
1056
  let c = 0, g = 0, l = 0;
1036
- const u = d > 0, w = d < o, y = u && w;
1037
- if (u && (c = -s, g = -n, l = a), w) {
1057
+ const u = d > 0, w = d < s, y = u && w;
1058
+ if (u && (c = -o, g = -n, l = a), w) {
1038
1059
  const V = r[d + 1];
1039
- s = V.x - h.x, n = V.y - h.y, a = Math.sqrt(s * s + n * n);
1060
+ o = V.x - h.x, n = V.y - h.y, a = Math.sqrt(o * o + n * n);
1040
1061
  }
1041
- const x = a !== 0 ? Math.min((y ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, S = y ? { x: h.x + s * x, y: h.y + n * x } : h, P = l !== 0 ? Math.min((y ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, R = y ? { x: h.x + c * P, y: h.y + g * P } : h;
1062
+ const x = a !== 0 ? Math.min((y ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, S = y ? { x: h.x + o * x, y: h.y + n * x } : h, P = l !== 0 ? Math.min((y ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, R = y ? { x: h.x + c * P, y: h.y + g * P } : h;
1042
1063
  d > 0 && t.push(`L ${R.x} ${R.y}`), y && t.push(
1043
1064
  `C ${h.x} ${h.y} ${h.x} ${h.y} ${S.x} ${S.y}`
1044
1065
  );
@@ -1053,11 +1074,11 @@ class rt {
1053
1074
  this.params = e;
1054
1075
  const t = this.params.to;
1055
1076
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
1056
- const o = this.params.hasSourceArrow ? m(
1077
+ const s = this.params.hasSourceArrow ? m(
1057
1078
  { x: this.params.arrowLength, y: p.y },
1058
1079
  this.params.sourceDirection,
1059
1080
  p
1060
- ) : p, s = this.params.hasTargetArrow ? m(
1081
+ ) : p, o = this.params.hasTargetArrow ? m(
1061
1082
  {
1062
1083
  x: this.params.to.x - this.params.arrowLength,
1063
1084
  y: this.params.to.y
@@ -1079,13 +1100,13 @@ class rt {
1079
1100
  x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
1080
1101
  y: d.y
1081
1102
  }, y = { x: w.x, y: g };
1082
- this.path = N(
1083
- [o, h, l, u, y, w, d, s],
1103
+ this.path = D(
1104
+ [s, h, l, u, y, w, d, o],
1084
1105
  this.params.roundness
1085
1106
  );
1086
1107
  }
1087
1108
  }
1088
- class ot {
1109
+ class st {
1089
1110
  constructor(e) {
1090
1111
  i(this, "path");
1091
1112
  i(this, "midpoint");
@@ -1094,40 +1115,40 @@ class ot {
1094
1115
  { x: this.params.arrowLength, y: p.y },
1095
1116
  this.params.sourceDirection,
1096
1117
  p
1097
- ) : p, o = this.params.hasTargetArrow ? m(
1118
+ ) : p, s = this.params.hasTargetArrow ? m(
1098
1119
  {
1099
1120
  x: this.params.to.x - this.params.arrowLength,
1100
1121
  y: this.params.to.y
1101
1122
  },
1102
1123
  this.params.targetDirection,
1103
1124
  this.params.to
1104
- ) : this.params.to, s = this.params.arrowLength + this.params.arrowOffset, n = m(
1105
- { x: s, y: p.y },
1125
+ ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1126
+ { x: o, y: p.y },
1106
1127
  this.params.sourceDirection,
1107
1128
  p
1108
1129
  ), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l = m(
1109
- { x: this.params.to.x - s, y: this.params.to.y },
1130
+ { x: this.params.to.x - o, y: this.params.to.y },
1110
1131
  this.params.targetDirection,
1111
1132
  this.params.to
1112
1133
  ), u = { x: l.x + d, y: l.y + c }, w = { x: (g.x + u.x) / 2, y: (g.y + u.y) / 2 };
1113
- this.midpoint = W(w, e.flipX, e.flipY, e.to), this.path = N(
1114
- [t, n, g, u, l, o],
1134
+ this.midpoint = W(w, e.flipX, e.flipY, e.to), this.path = D(
1135
+ [t, n, g, u, l, s],
1115
1136
  this.params.roundness
1116
1137
  );
1117
1138
  }
1118
1139
  }
1119
- class st {
1140
+ class ot {
1120
1141
  constructor(e) {
1121
1142
  i(this, "path");
1122
1143
  i(this, "midpoint");
1123
1144
  this.params = e;
1124
1145
  const t = this.params.to;
1125
1146
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
1126
- const o = this.params.hasSourceArrow ? m(
1147
+ const s = this.params.hasSourceArrow ? m(
1127
1148
  { x: this.params.arrowLength, y: p.y },
1128
1149
  this.params.sourceDirection,
1129
1150
  p
1130
- ) : p, s = this.params.hasTargetArrow ? m(
1151
+ ) : p, o = this.params.hasTargetArrow ? m(
1131
1152
  {
1132
1153
  x: this.params.to.x - this.params.arrowLength,
1133
1154
  y: this.params.to.y
@@ -1143,7 +1164,7 @@ class st {
1143
1164
  this.params.targetDirection,
1144
1165
  this.params.to
1145
1166
  );
1146
- this.path = N([o, a, h, s], this.params.roundness);
1167
+ this.path = D([s, a, h, o], this.params.roundness);
1147
1168
  }
1148
1169
  }
1149
1170
  class it {
@@ -1153,11 +1174,11 @@ class it {
1153
1174
  this.params = e;
1154
1175
  const t = this.params.to;
1155
1176
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
1156
- const o = this.params.hasSourceArrow ? m(
1177
+ const s = this.params.hasSourceArrow ? m(
1157
1178
  { x: this.params.arrowLength, y: p.y },
1158
1179
  this.params.sourceDirection,
1159
1180
  p
1160
- ) : p, s = this.params.hasTargetArrow ? m(
1181
+ ) : p, o = this.params.hasTargetArrow ? m(
1161
1182
  {
1162
1183
  x: this.params.to.x - this.params.arrowLength,
1163
1184
  y: this.params.to.y
@@ -1179,8 +1200,8 @@ class it {
1179
1200
  x: d.x,
1180
1201
  y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
1181
1202
  }, y = { x: g, y: w.y };
1182
- this.path = N(
1183
- [o, h, l, u, y, w, d, s],
1203
+ this.path = D(
1204
+ [s, h, l, u, y, w, d, o],
1184
1205
  this.params.roundness
1185
1206
  );
1186
1207
  }
@@ -1190,19 +1211,19 @@ class Q {
1190
1211
  i(this, "path");
1191
1212
  i(this, "midpoint");
1192
1213
  this.params = e;
1193
- const t = this.params.arrowOffset, o = this.params.side, s = this.params.arrowLength + t, n = s + 2 * o, h = [
1214
+ const t = this.params.arrowOffset, s = this.params.side, o = this.params.arrowLength + t, n = o + 2 * s, h = [
1194
1215
  { x: this.params.arrowLength, y: p.y },
1195
- { x: s, y: p.y },
1196
- { x: s, y: this.params.side },
1216
+ { x: o, y: p.y },
1217
+ { x: o, y: this.params.side },
1197
1218
  { x: n, y: this.params.side },
1198
1219
  { x: n, y: -this.params.side },
1199
- { x: s, y: -this.params.side },
1200
- { x: s, y: p.y },
1220
+ { x: o, y: -this.params.side },
1221
+ { x: o, y: p.y },
1201
1222
  { x: this.params.arrowLength, y: p.y }
1202
1223
  ].map(
1203
1224
  (c) => m(c, this.params.sourceDirection, p)
1204
1225
  ), d = `M ${p.x} ${p.y} L ${h[0].x} ${h[0].y} `;
1205
- this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${N(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
1226
+ this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${D(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
1206
1227
  }
1207
1228
  }
1208
1229
  class nt {
@@ -1210,7 +1231,7 @@ class nt {
1210
1231
  i(this, "path");
1211
1232
  i(this, "midpoint");
1212
1233
  this.params = e;
1213
- const t = this.params.smallRadius, o = this.params.radius, s = t + o, n = t * o / s, a = Math.sqrt(s * s - t * t), h = a * t / s, d = a + o + this.params.arrowLength, c = this.params.arrowLength + h, l = [
1234
+ const t = this.params.smallRadius, s = this.params.radius, o = t + s, n = t * s / o, a = Math.sqrt(o * o - t * t), h = a * t / o, d = a + s + this.params.arrowLength, c = this.params.arrowLength + h, l = [
1214
1235
  { x: this.params.arrowLength, y: p.y },
1215
1236
  { x: c, y: n },
1216
1237
  { x: c, y: -n },
@@ -1220,7 +1241,7 @@ class nt {
1220
1241
  ), u = [
1221
1242
  `M ${l[0].x} ${l[0].y}`,
1222
1243
  `A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
1223
- `A ${o} ${o} 0 1 0 ${l[2].x} ${l[2].y}`,
1244
+ `A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
1224
1245
  `A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
1225
1246
  ].join(" "), w = `M 0 0 L ${l[0].x} ${l[0].y} `;
1226
1247
  this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${u}`, this.midpoint = l[3];
@@ -1241,7 +1262,7 @@ class at {
1241
1262
  this.path = "";
1242
1263
  return;
1243
1264
  }
1244
- const s = this.createDirectLinePoint({
1265
+ const o = this.createDirectLinePoint({
1245
1266
  offset: this.params.sourceOffset,
1246
1267
  hasArrow: this.params.hasSourceArrow,
1247
1268
  flip: 1,
@@ -1252,13 +1273,13 @@ class at {
1252
1273
  flip: -1,
1253
1274
  shift: this.params.to
1254
1275
  });
1255
- this.path = `M ${s.x} ${s.y} L ${n.x} ${n.y}`;
1276
+ this.path = `M ${o.x} ${o.y} L ${n.x} ${n.y}`;
1256
1277
  }
1257
1278
  createDirectLinePoint(e) {
1258
- const t = e.hasArrow ? this.params.arrowLength : 0, o = e.offset + t, s = e.flip * o / this.diagonalDistance;
1279
+ const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, o = e.flip * s / this.diagonalDistance;
1259
1280
  return {
1260
- x: this.params.to.x * s + e.shift.x,
1261
- y: this.params.to.y * s + e.shift.y
1281
+ x: this.params.to.x * o + e.shift.x,
1282
+ y: this.params.to.y * o + e.shift.y
1262
1283
  };
1263
1284
  }
1264
1285
  }
@@ -1271,33 +1292,33 @@ class ht {
1271
1292
  { x: this.params.arrowLength, y: p.y },
1272
1293
  this.params.sourceDirection,
1273
1294
  p
1274
- ) : p, o = this.params.hasTargetArrow ? m(
1295
+ ) : p, s = this.params.hasTargetArrow ? m(
1275
1296
  {
1276
1297
  x: this.params.to.x - this.params.arrowLength,
1277
1298
  y: this.params.to.y
1278
1299
  },
1279
1300
  this.params.targetDirection,
1280
1301
  this.params.to
1281
- ) : this.params.to, s = this.params.arrowLength + this.params.arrowOffset, n = m(
1282
- { x: s, y: p.y },
1302
+ ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1303
+ { x: o, y: p.y },
1283
1304
  this.params.sourceDirection,
1284
1305
  p
1285
1306
  ), a = m(
1286
- { x: this.params.to.x - s, y: this.params.to.y },
1307
+ { x: this.params.to.x - o, y: this.params.to.y },
1287
1308
  this.params.targetDirection,
1288
1309
  this.params.to
1289
1310
  ), h = this.params.detourDistance > 0 ? 1 : -1, d = this.params.to.y / 2, c = d + Math.abs(this.params.detourDistance), g = d + c * this.params.flipY * h, l = {
1290
1311
  x: (n.x + a.x) / 2,
1291
1312
  y: g
1292
1313
  };
1293
- this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = N(
1314
+ this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = D(
1294
1315
  [
1295
1316
  t,
1296
1317
  n,
1297
1318
  { x: n.x, y: g },
1298
1319
  { x: a.x, y: g },
1299
1320
  a,
1300
- o
1321
+ s
1301
1322
  ],
1302
1323
  this.params.roundness
1303
1324
  );
@@ -1312,33 +1333,33 @@ class dt {
1312
1333
  { x: this.params.arrowLength, y: p.y },
1313
1334
  this.params.sourceDirection,
1314
1335
  p
1315
- ) : p, o = this.params.hasTargetArrow ? m(
1336
+ ) : p, s = this.params.hasTargetArrow ? m(
1316
1337
  {
1317
1338
  x: this.params.to.x - this.params.arrowLength,
1318
1339
  y: this.params.to.y
1319
1340
  },
1320
1341
  this.params.targetDirection,
1321
1342
  this.params.to
1322
- ) : this.params.to, s = this.params.arrowLength + this.params.arrowOffset, n = m(
1323
- { x: s, y: p.y },
1343
+ ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1344
+ { x: o, y: p.y },
1324
1345
  this.params.sourceDirection,
1325
1346
  p
1326
1347
  ), a = m(
1327
- { x: this.params.to.x - s, y: this.params.to.y },
1348
+ { x: this.params.to.x - o, y: this.params.to.y },
1328
1349
  this.params.targetDirection,
1329
1350
  this.params.to
1330
1351
  ), h = this.params.detourDistance > 0 ? 1 : -1, d = this.params.to.x / 2, c = d + Math.abs(this.params.detourDistance), g = d + c * this.params.flipX * h, l = {
1331
1352
  x: g,
1332
1353
  y: (n.y + a.y) / 2
1333
1354
  };
1334
- this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = N(
1355
+ this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = D(
1335
1356
  [
1336
1357
  t,
1337
1358
  n,
1338
1359
  { x: g, y: n.y },
1339
1360
  { x: g, y: a.y },
1340
1361
  a,
1341
- o
1362
+ s
1342
1363
  ],
1343
1364
  this.params.roundness
1344
1365
  );
@@ -1380,11 +1401,11 @@ class k {
1380
1401
  this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Pe(e.color), this.svg.appendChild(this.group), this.line = Ce(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = B(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = B(), this.group.appendChild(this.targetArrow));
1381
1402
  }
1382
1403
  render(e) {
1383
- const { x: t, y: o, width: s, height: n, flipX: a, flipY: h } = be(
1404
+ const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = be(
1384
1405
  e.from,
1385
1406
  e.to
1386
1407
  );
1387
- De(this.svg, { x: t, y: o, width: s, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1408
+ Ne(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1388
1409
  const d = ge(
1389
1410
  e.from.direction,
1390
1411
  a,
@@ -1394,7 +1415,7 @@ class k {
1394
1415
  a,
1395
1416
  h
1396
1417
  ), g = {
1397
- x: s,
1418
+ x: o,
1398
1419
  y: n
1399
1420
  };
1400
1421
  let l = { x: -c.x, y: -c.y }, u;
@@ -1426,7 +1447,7 @@ class k {
1426
1447
  }
1427
1448
  }
1428
1449
  const ct = (r) => (e) => {
1429
- const o = [
1450
+ const s = [
1430
1451
  p,
1431
1452
  { x: e.arrowLength, y: r.radius },
1432
1453
  { x: e.arrowLength, y: -r.radius }
@@ -1435,18 +1456,18 @@ const ct = (r) => (e) => {
1435
1456
  ).map((h) => ({
1436
1457
  x: h.x + e.shift.x,
1437
1458
  y: h.y + e.shift.y
1438
- })), s = `M ${o[0].x} ${o[0].y}`, n = `L ${o[1].x} ${o[1].y}`, a = `L ${o[2].x} ${o[2].y}`;
1439
- return `${s} ${n} ${a} Z`;
1459
+ })), o = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
1460
+ return `${o} ${n} ${a} Z`;
1440
1461
  }, lt = (r) => (e) => {
1441
- 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 = [p, { x: a, y: -h }, { x: a, y: h }].map(
1462
+ const t = r.radius, s = e.arrowLength, o = (s * s + 2 * s * t) / (2 * t), n = o + t, a = s + t - t * (s + t) / n, h = t * o / n, c = [p, { x: a, y: -h }, { x: a, y: h }].map(
1442
1463
  (y) => m(y, e.direction, p)
1443
1464
  ).map((y) => ({
1444
1465
  x: y.x + e.shift.x,
1445
1466
  y: y.y + e.shift.y
1446
- })), g = `M ${c[0].x} ${c[0].y}`, l = `A ${s} ${s} 0 0 0 ${c[1].x} ${c[1].y}`, u = `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}`;
1467
+ })), g = `M ${c[0].x} ${c[0].y}`, l = `A ${o} ${o} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${o} ${o} 0 0 0 ${c[0].x} ${c[0].y}`;
1447
1468
  return `${g} ${l} ${u} ${w}`;
1448
1469
  }, gt = (r) => (e) => {
1449
- const t = r.smallRadius, o = r.radius, s = m(
1470
+ const t = r.smallRadius, s = r.radius, o = m(
1450
1471
  {
1451
1472
  x: e.arrowLength,
1452
1473
  y: 0
@@ -1459,12 +1480,12 @@ const ct = (r) => (e) => {
1459
1480
  x: e.arrowLength + r.smallRadius,
1460
1481
  y: 0
1461
1482
  }
1462
- ), a = [p, { x: s.x, y: -s.y }, s].map(
1483
+ ), a = [p, { x: o.x, y: -o.y }, o].map(
1463
1484
  (l) => m(l, e.direction, p)
1464
1485
  ).map((l) => ({
1465
1486
  x: l.x + e.shift.x,
1466
1487
  y: l.y + e.shift.y
1467
- })), 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}`;
1488
+ })), h = `M ${a[0].x} ${a[0].y}`, d = `A ${s} ${s} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, g = `A ${s} ${s} 0 0 1 ${a[0].x} ${a[0].y}`;
1468
1489
  return `${h} ${d} ${c} ${g}`;
1469
1490
  }, F = (r) => {
1470
1491
  if (typeof r == "function")
@@ -1511,11 +1532,11 @@ class ut {
1511
1532
  hasSourceArrow: this.hasSourceArrow,
1512
1533
  hasTargetArrow: this.hasTargetArrow
1513
1534
  }));
1514
- i(this, "createDetourPath", (e, t, o, s, n) => new tt({
1515
- to: o,
1535
+ i(this, "createDetourPath", (e, t, s, o, n) => new tt({
1536
+ to: s,
1516
1537
  sourceDirection: e,
1517
1538
  targetDirection: t,
1518
- flipX: s,
1539
+ flipX: o,
1519
1540
  flipY: n,
1520
1541
  arrowLength: this.arrowLength,
1521
1542
  detourDirection: this.detourDirection,
@@ -1524,8 +1545,8 @@ class ut {
1524
1545
  hasSourceArrow: this.hasSourceArrow,
1525
1546
  hasTargetArrow: this.hasTargetArrow
1526
1547
  }));
1527
- i(this, "createLinePath", (e, t, o) => new et({
1528
- to: o,
1548
+ i(this, "createLinePath", (e, t, s) => new et({
1549
+ to: s,
1529
1550
  sourceDirection: e,
1530
1551
  targetDirection: t,
1531
1552
  arrowLength: this.arrowLength,
@@ -1574,11 +1595,11 @@ class pt {
1574
1595
  hasSourceArrow: this.hasSourceArrow,
1575
1596
  hasTargetArrow: this.hasTargetArrow
1576
1597
  }));
1577
- i(this, "createDetourPath", (e, t, o, s, n) => new ht({
1578
- to: o,
1598
+ i(this, "createDetourPath", (e, t, s, o, n) => new ht({
1599
+ to: s,
1579
1600
  sourceDirection: e,
1580
1601
  targetDirection: t,
1581
- flipX: s,
1602
+ flipX: o,
1582
1603
  flipY: n,
1583
1604
  arrowLength: this.arrowLength,
1584
1605
  arrowOffset: this.arrowOffset,
@@ -1587,11 +1608,11 @@ class pt {
1587
1608
  hasSourceArrow: this.hasSourceArrow,
1588
1609
  hasTargetArrow: this.hasTargetArrow
1589
1610
  }));
1590
- i(this, "createLinePath", (e, t, o, s) => new rt({
1591
- to: o,
1611
+ i(this, "createLinePath", (e, t, s, o) => new rt({
1612
+ to: s,
1592
1613
  sourceDirection: e,
1593
1614
  targetDirection: t,
1594
- flipX: s,
1615
+ flipX: o,
1595
1616
  arrowLength: this.arrowLength,
1596
1617
  arrowOffset: this.arrowOffset,
1597
1618
  roundness: this.roundness,
@@ -1646,11 +1667,11 @@ class wt {
1646
1667
  hasSourceArrow: this.hasSourceArrow,
1647
1668
  hasTargetArrow: this.hasTargetArrow
1648
1669
  }));
1649
- i(this, "createDetourPath", (e, t, o, s, n) => new ot({
1650
- to: o,
1670
+ i(this, "createDetourPath", (e, t, s, o, n) => new st({
1671
+ to: s,
1651
1672
  sourceDirection: e,
1652
1673
  targetDirection: t,
1653
- flipX: s,
1674
+ flipX: o,
1654
1675
  flipY: n,
1655
1676
  arrowLength: this.arrowLength,
1656
1677
  arrowOffset: this.arrowOffset,
@@ -1660,8 +1681,8 @@ class wt {
1660
1681
  hasSourceArrow: this.hasSourceArrow,
1661
1682
  hasTargetArrow: this.hasTargetArrow
1662
1683
  }));
1663
- i(this, "createLinePath", (e, t, o) => new st({
1664
- to: o,
1684
+ i(this, "createLinePath", (e, t, s) => new ot({
1685
+ to: s,
1665
1686
  sourceDirection: e,
1666
1687
  targetDirection: t,
1667
1688
  arrowLength: this.arrowLength,
@@ -1717,11 +1738,11 @@ class ft {
1717
1738
  hasSourceArrow: this.hasSourceArrow,
1718
1739
  hasTargetArrow: this.hasTargetArrow
1719
1740
  }));
1720
- i(this, "createDetourPath", (e, t, o, s, n) => new dt({
1721
- to: o,
1741
+ i(this, "createDetourPath", (e, t, s, o, n) => new dt({
1742
+ to: s,
1722
1743
  sourceDirection: e,
1723
1744
  targetDirection: t,
1724
- flipX: s,
1745
+ flipX: o,
1725
1746
  flipY: n,
1726
1747
  arrowLength: this.arrowLength,
1727
1748
  arrowOffset: this.arrowOffset,
@@ -1730,8 +1751,8 @@ class ft {
1730
1751
  hasSourceArrow: this.hasSourceArrow,
1731
1752
  hasTargetArrow: this.hasTargetArrow
1732
1753
  }));
1733
- i(this, "createLinePath", (e, t, o, s, n) => new it({
1734
- to: o,
1754
+ i(this, "createLinePath", (e, t, s, o, n) => new it({
1755
+ to: s,
1735
1756
  sourceDirection: e,
1736
1757
  targetDirection: t,
1737
1758
  flipY: n,
@@ -1763,7 +1784,7 @@ class ft {
1763
1784
  this.pathShape.render(e);
1764
1785
  }
1765
1786
  }
1766
- class Ne {
1787
+ class De {
1767
1788
  constructor(e) {
1768
1789
  i(this, "svg");
1769
1790
  i(this, "group", Te());
@@ -1781,12 +1802,12 @@ class Ne {
1781
1802
  [this.afterRenderEmitter, this.onAfterRender] = E(), this.color = (e == null ? void 0 : e.color) ?? f.color, this.width = (e == null ? void 0 : e.width) ?? f.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowRenderer = F((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? f.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? f.preOffset, this.svg = Pe(this.color), this.svg.appendChild(this.group), this.line = Ce(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = B(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = B(), this.group.appendChild(this.targetArrow));
1782
1803
  }
1783
1804
  render(e) {
1784
- const { x: t, y: o, width: s, height: n, flipX: a, flipY: h } = be(
1805
+ const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = be(
1785
1806
  e.from,
1786
1807
  e.to
1787
1808
  );
1788
- De(this.svg, { x: t, y: o, width: s, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1789
- const d = { x: s, y: n }, c = new at({
1809
+ Ne(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1810
+ const d = { x: o, y: n }, c = new at({
1790
1811
  to: d,
1791
1812
  sourceOffset: this.sourceOffset,
1792
1813
  targetOffset: this.targetOffset,
@@ -1869,16 +1890,16 @@ class Me {
1869
1890
  "interactive edge can be configured only once"
1870
1891
  );
1871
1892
  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;
1872
- const o = (t == null ? void 0 : t.distance) ?? f.interactiveWidth;
1873
- this.interactiveLine = mt(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ue(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ue(o), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((s) => {
1874
- this.interactiveLine.setAttribute("d", s.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", s.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", s.targetArrowPath);
1893
+ const s = (t == null ? void 0 : t.distance) ?? f.interactiveWidth;
1894
+ this.interactiveLine = mt(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ue(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ue(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((o) => {
1895
+ this.interactiveLine.setAttribute("d", o.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", o.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", o.targetArrowPath);
1875
1896
  });
1876
1897
  }
1877
1898
  render(e) {
1878
1899
  this.baseEdge.render(e);
1879
1900
  }
1880
1901
  }
1881
- class or {
1902
+ class sr {
1882
1903
  constructor(e, t) {
1883
1904
  i(this, "group");
1884
1905
  i(this, "line");
@@ -1886,8 +1907,8 @@ class or {
1886
1907
  i(this, "targetArrow");
1887
1908
  i(this, "onAfterRender");
1888
1909
  i(this, "svg");
1889
- this.baseShape = e, this.midpointElement = t, this.svg = this.baseShape.svg, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.svg.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((o) => {
1890
- const s = o.edgePath.midpoint, n = `translate(${s.x}px, ${s.y}px)`;
1910
+ this.baseShape = e, this.midpointElement = t, this.svg = this.baseShape.svg, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.svg.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((s) => {
1911
+ const o = s.edgePath.midpoint, n = `translate(${o.x}px, ${o.y}px)`;
1891
1912
  this.midpointElement.style.setProperty("transform", n);
1892
1913
  });
1893
1914
  }
@@ -1912,25 +1933,38 @@ class Le {
1912
1933
  i(this, "onBeforeClear");
1913
1934
  this.graphStore = e, this.onAfterNodeAdded = this.graphStore.onAfterNodeAdded, this.onAfterNodeUpdated = this.graphStore.onAfterNodeUpdated, this.onAfterNodePriorityUpdated = this.graphStore.onAfterNodePriorityUpdated, this.onBeforeNodeRemoved = this.graphStore.onBeforeNodeRemoved, this.onAfterPortMarked = this.graphStore.onAfterPortAdded, this.onAfterPortUpdated = this.graphStore.onAfterPortUpdated, this.onBeforePortUnmarked = this.graphStore.onBeforePortRemoved, this.onAfterEdgeAdded = this.graphStore.onAfterEdgeAdded, this.onAfterEdgeShapeUpdated = this.graphStore.onAfterEdgeShapeUpdated, this.onAfterEdgeUpdated = this.graphStore.onAfterEdgeUpdated, this.onAfterEdgePriorityUpdated = this.graphStore.onAfterEdgePriorityUpdated, this.onBeforeEdgeRemoved = this.graphStore.onBeforeEdgeRemoved, this.onBeforeClear = this.graphStore.onBeforeClear;
1914
1935
  }
1936
+ hasNode(e) {
1937
+ return this.graphStore.hasNode(e);
1938
+ }
1915
1939
  getNode(e) {
1916
1940
  const t = this.graphStore.getNode(e);
1917
1941
  if (t === void 0)
1918
1942
  return null;
1919
- const o = t.payload;
1943
+ const s = t.payload;
1920
1944
  return {
1921
1945
  element: t.element,
1922
- x: o.x,
1923
- y: o.y,
1924
- centerFn: o.centerFn,
1925
- priority: o.priority
1946
+ x: s.x,
1947
+ y: s.y,
1948
+ centerFn: s.centerFn,
1949
+ priority: s.priority
1926
1950
  };
1927
1951
  }
1952
+ findNodeIdByElement(e) {
1953
+ return this.graphStore.findNodeIdByElement(e) ?? null;
1954
+ }
1955
+ /**
1956
+ * @deprecated
1957
+ * use findNodeIdByElement instead
1958
+ */
1928
1959
  getElementNodeId(e) {
1929
- return this.graphStore.getElementNodeId(e) ?? null;
1960
+ return this.graphStore.findNodeIdByElement(e) ?? null;
1930
1961
  }
1931
1962
  getAllNodeIds() {
1932
1963
  return this.graphStore.getAllNodeIds();
1933
1964
  }
1965
+ hasPort(e) {
1966
+ return this.graphStore.hasPort(e);
1967
+ }
1934
1968
  getPort(e) {
1935
1969
  const t = this.graphStore.getPort(e);
1936
1970
  return t === void 0 ? null : {
@@ -1945,47 +1979,57 @@ class Le {
1945
1979
  getNodePortIds(e) {
1946
1980
  return this.graphStore.getNodePortIds(e) ?? null;
1947
1981
  }
1982
+ /**
1983
+ * @deprecated
1984
+ * use findPortIdsByElement instead
1985
+ */
1948
1986
  getElementPortIds(e) {
1949
- return [...this.graphStore.getElementPortIds(e)];
1987
+ return this.graphStore.findPortIdsByElement(e);
1988
+ }
1989
+ findPortIdsByElement(e) {
1990
+ return this.graphStore.findPortIdsByElement(e);
1950
1991
  }
1951
1992
  getAllEdgeIds() {
1952
1993
  return this.graphStore.getAllEdgeIds();
1953
1994
  }
1995
+ hasEdge(e) {
1996
+ return this.graphStore.hasEdge(e);
1997
+ }
1954
1998
  getEdge(e) {
1955
1999
  const t = this.graphStore.getEdge(e);
1956
2000
  if (t === void 0)
1957
2001
  return null;
1958
- const o = t.payload;
2002
+ const s = t.payload;
1959
2003
  return {
1960
2004
  from: t.from,
1961
2005
  to: t.to,
1962
- priority: o.priority,
1963
- shape: o.shape
2006
+ priority: s.priority,
2007
+ shape: s.shape
1964
2008
  };
1965
2009
  }
1966
2010
  getPortIncomingEdgeIds(e) {
1967
- return this.graphStore.getPort(e) === void 0 ? null : this.graphStore.getPortIncomingEdgeIds(e);
2011
+ return this.graphStore.hasPort(e) ? this.graphStore.getPortIncomingEdgeIds(e) : null;
1968
2012
  }
1969
2013
  getPortOutgoingEdgeIds(e) {
1970
- return this.graphStore.getPort(e) === void 0 ? null : this.graphStore.getPortOutgoingEdgeIds(e);
2014
+ return this.graphStore.hasPort(e) ? this.graphStore.getPortOutgoingEdgeIds(e) : null;
1971
2015
  }
1972
2016
  getPortCycleEdgeIds(e) {
1973
- return this.graphStore.getPort(e) === void 0 ? null : this.graphStore.getPortCycleEdgeIds(e);
2017
+ return this.graphStore.hasPort(e) ? this.graphStore.getPortCycleEdgeIds(e) : null;
1974
2018
  }
1975
2019
  getPortAdjacentEdgeIds(e) {
1976
- return this.graphStore.getPort(e) === void 0 ? null : this.graphStore.getPortAdjacentEdgeIds(e);
2020
+ return this.graphStore.hasPort(e) ? this.graphStore.getPortAdjacentEdgeIds(e) : null;
1977
2021
  }
1978
2022
  getNodeIncomingEdgeIds(e) {
1979
- return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeIncomingEdgeIds(e);
2023
+ return this.graphStore.hasNode(e) ? this.graphStore.getNodeIncomingEdgeIds(e) : null;
1980
2024
  }
1981
2025
  getNodeOutgoingEdgeIds(e) {
1982
- return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeOutgoingEdgeIds(e);
2026
+ return this.graphStore.hasNode(e) ? this.graphStore.getNodeOutgoingEdgeIds(e) : null;
1983
2027
  }
1984
2028
  getNodeCycleEdgeIds(e) {
1985
- return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeCycleEdgeIds(e);
2029
+ return this.graphStore.hasNode(e) ? this.graphStore.getNodeCycleEdgeIds(e) : null;
1986
2030
  }
1987
2031
  getNodeAdjacentEdgeIds(e) {
1988
- return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
2032
+ return this.graphStore.hasNode(e) ? this.graphStore.getNodeAdjacentEdgeIds(e) : null;
1989
2033
  }
1990
2034
  }
1991
2035
  class Re {
@@ -2012,13 +2056,13 @@ class Re {
2012
2056
  }
2013
2057
  }
2014
2058
  const Ve = (r, e) => {
2015
- const t = new Ae(), o = new Le(t), s = new Re(e), n = new me(t, e, r), a = {
2059
+ const t = new Ae(), s = new Le(t), o = new Re(e), n = new me(t, e, r), a = {
2016
2060
  nodes: {
2017
2061
  centerFn: Se,
2018
2062
  priorityFn: () => 0
2019
2063
  },
2020
2064
  edges: {
2021
- shapeFactory: () => new Ne(),
2065
+ shapeFactory: () => new De(),
2022
2066
  priorityFn: () => 0
2023
2067
  },
2024
2068
  ports: {
@@ -2026,8 +2070,8 @@ const Ve = (r, e) => {
2026
2070
  }
2027
2071
  };
2028
2072
  return new ve(
2029
- o,
2030
2073
  s,
2074
+ o,
2031
2075
  t,
2032
2076
  e,
2033
2077
  n,
@@ -2035,7 +2079,7 @@ const Ve = (r, e) => {
2035
2079
  );
2036
2080
  };
2037
2081
  class z {
2038
- constructor(e, t, o, s) {
2082
+ constructor(e, t, s, o) {
2039
2083
  i(this, "onAfterPortMarked", (e) => {
2040
2084
  const t = this.canvas.graph.getPort(e);
2041
2085
  this.canvas.graph.getElementPortIds(t.element).length === 1 && this.hookPortEvents(t.element);
@@ -2047,8 +2091,8 @@ class z {
2047
2091
  i(this, "onPortMouseDown", (e) => {
2048
2092
  if (!this.params.mouseDownEventVerifier(e))
2049
2093
  return;
2050
- const t = e.currentTarget, o = this.canvas.graph.getElementPortIds(t)[0];
2051
- this.params.onPortPointerDown(o, {
2094
+ const t = e.currentTarget, s = this.canvas.graph.getElementPortIds(t)[0];
2095
+ this.params.onPortPointerDown(s, {
2052
2096
  x: e.clientX,
2053
2097
  y: e.clientY
2054
2098
  }) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
@@ -2075,8 +2119,8 @@ class z {
2075
2119
  i(this, "onPortTouchStart", (e) => {
2076
2120
  if (e.touches.length !== 1)
2077
2121
  return;
2078
- const t = e.touches[0], o = e.currentTarget, s = this.canvas.graph.getElementPortIds(o)[0];
2079
- this.params.onPortPointerDown(s, {
2122
+ const t = e.touches[0], s = e.currentTarget, o = this.canvas.graph.getElementPortIds(s)[0];
2123
+ this.params.onPortPointerDown(o, {
2080
2124
  x: t.clientX,
2081
2125
  y: t.clientY
2082
2126
  }) && (e.stopPropagation(), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
@@ -2113,10 +2157,10 @@ class z {
2113
2157
  i(this, "onBeforeDestroy", () => {
2114
2158
  this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
2115
2159
  });
2116
- 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.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2160
+ this.canvas = e, this.element = t, this.window = s, this.params = o, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2117
2161
  }
2118
- static configure(e, t, o, s) {
2119
- new z(e, t, o, s);
2162
+ static configure(e, t, s, o) {
2163
+ new z(e, t, s, o);
2120
2164
  }
2121
2165
  hookPortEvents(e) {
2122
2166
  e.addEventListener("mousedown", this.onPortMouseDown, {
@@ -2142,7 +2186,7 @@ class z {
2142
2186
  }
2143
2187
  }
2144
2188
  class Z {
2145
- constructor(e, t, o, s) {
2189
+ constructor(e, t, s, o) {
2146
2190
  i(this, "grabbedNode", null);
2147
2191
  i(this, "maxNodePriority", 0);
2148
2192
  i(this, "graph");
@@ -2174,19 +2218,19 @@ class Z {
2174
2218
  i(this, "onMouseDown", (e) => {
2175
2219
  if (!this.params.mouseDownEventVerifier(e))
2176
2220
  return;
2177
- const t = e.currentTarget, o = this.graph.getElementNodeId(t), s = this.graph.getNode(o);
2178
- if (!this.params.nodeDragVerifier(o))
2221
+ const t = e.currentTarget, s = this.graph.findNodeIdByElement(t), o = this.graph.getNode(s);
2222
+ if (!this.params.nodeDragVerifier(s))
2179
2223
  return;
2180
- this.params.onNodeDragStarted(o), e.stopPropagation();
2224
+ this.params.onNodeDragStarted(s), e.stopPropagation();
2181
2225
  const a = this.calculateContentPoint({
2182
2226
  x: e.clientX,
2183
2227
  y: e.clientY
2184
2228
  });
2185
2229
  this.grabbedNode = {
2186
- nodeId: o,
2187
- dx: a.x - s.x,
2188
- dy: a.y - s.y
2189
- }, $(this.element, this.params.dragCursor), this.moveNodeOnTop(o), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2230
+ nodeId: s,
2231
+ dx: a.x - o.x,
2232
+ dy: a.y - o.y
2233
+ }, $(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2190
2234
  passive: !0
2191
2235
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2192
2236
  passive: !0
@@ -2196,9 +2240,9 @@ class Z {
2196
2240
  if (e.touches.length !== 1)
2197
2241
  return;
2198
2242
  e.stopPropagation();
2199
- const t = e.touches[0], o = e.currentTarget, s = this.canvas.graph.getElementNodeId(o), n = this.graph.getNode(s);
2243
+ const t = e.touches[0], s = e.currentTarget, o = this.canvas.graph.findNodeIdByElement(s), n = this.graph.getNode(o);
2200
2244
  if (!this.params.nodeDragVerifier({
2201
- nodeId: s,
2245
+ nodeId: o,
2202
2246
  element: n.element,
2203
2247
  x: n.x,
2204
2248
  y: n.y
@@ -2209,10 +2253,10 @@ class Z {
2209
2253
  y: t.clientY
2210
2254
  });
2211
2255
  this.grabbedNode = {
2212
- nodeId: s,
2256
+ nodeId: o,
2213
2257
  dx: h.x - n.x,
2214
2258
  dy: h.y - n.y
2215
- }, this.moveNodeOnTop(s), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2259
+ }, this.moveNodeOnTop(o), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2216
2260
  passive: !0
2217
2261
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
2218
2262
  passive: !0
@@ -2259,17 +2303,17 @@ class Z {
2259
2303
  i(this, "onWindowTouchFinish", () => {
2260
2304
  this.cancelTouchDrag();
2261
2305
  });
2262
- 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.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2306
+ this.canvas = e, this.element = t, this.window = s, this.params = o, 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.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2263
2307
  }
2264
- static configure(e, t, o, s) {
2265
- new Z(e, t, o, s);
2308
+ static configure(e, t, s, o) {
2309
+ new Z(e, t, s, o);
2266
2310
  }
2267
2311
  moveNode(e, t) {
2268
2312
  if (this.graph.getNode(e.nodeId) === null)
2269
2313
  return;
2270
- const s = this.calculateContentPoint(t), n = {
2271
- x: s.x - e.dx,
2272
- y: s.y - e.dy
2314
+ const o = this.calculateContentPoint(t), n = {
2315
+ x: o.x - e.dx,
2316
+ y: o.y - e.dy
2273
2317
  }, a = this.adjustNodeCoords(n);
2274
2318
  this.canvas.updateNode(e.nodeId, {
2275
2319
  x: a.x,
@@ -2280,8 +2324,8 @@ class Z {
2280
2324
  if (this.params.moveOnTop) {
2281
2325
  if (this.maxNodePriority++, this.params.moveEdgesOnTop) {
2282
2326
  const t = this.maxNodePriority;
2283
- this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((s) => {
2284
- this.canvas.updateEdge(s, { priority: t });
2327
+ this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((o) => {
2328
+ this.canvas.updateEdge(o, { priority: t });
2285
2329
  });
2286
2330
  }
2287
2331
  this.canvas.updateNode(e, { priority: this.maxNodePriority });
@@ -2322,10 +2366,10 @@ class Z {
2322
2366
  adjustNodeCoords(e) {
2323
2367
  const t = this.params.gridSize;
2324
2368
  if (t !== null) {
2325
- const o = t / 2;
2369
+ const s = t / 2;
2326
2370
  return {
2327
- x: Math.floor((e.x + o) / t) * t,
2328
- y: Math.floor((e.y + o) / t) * t
2371
+ x: Math.floor((e.x + s) / t) * t,
2372
+ y: Math.floor((e.y + s) / t) * t
2329
2373
  };
2330
2374
  }
2331
2375
  return e;
@@ -2335,31 +2379,31 @@ const At = (r, e, t) => ({
2335
2379
  scale: r.scale,
2336
2380
  x: r.x + r.scale * e,
2337
2381
  y: r.y + r.scale * t
2338
- }), Et = (r, e, t, o) => ({
2382
+ }), Et = (r, e, t, s) => ({
2339
2383
  scale: r.scale * e,
2340
2384
  x: r.scale * (1 - e) * t + r.x,
2341
- y: r.scale * (1 - e) * o + r.y
2385
+ y: r.scale * (1 - e) * s + r.y
2342
2386
  }), I = (r) => {
2343
2387
  const e = [], t = r.touches.length;
2344
2388
  for (let h = 0; h < t; h++)
2345
2389
  e.push([r.touches[h].clientX, r.touches[h].clientY]);
2346
- const o = e.reduce(
2390
+ const s = e.reduce(
2347
2391
  (h, d) => [h[0] + d[0], h[1] + d[1]],
2348
2392
  [0, 0]
2349
- ), s = [o[0] / t, o[1] / t], a = e.map((h) => [h[0] - s[0], h[1] - s[1]]).reduce(
2393
+ ), o = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - o[0], h[1] - o[1]]).reduce(
2350
2394
  (h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
2351
2395
  0
2352
2396
  );
2353
2397
  return {
2354
- x: s[0],
2355
- y: s[1],
2398
+ x: o[0],
2399
+ y: o[1],
2356
2400
  scale: a / t,
2357
2401
  touchesCnt: t,
2358
2402
  touches: e
2359
2403
  };
2360
2404
  };
2361
2405
  class H {
2362
- constructor(e, t, o, s) {
2406
+ constructor(e, t, s, o) {
2363
2407
  i(this, "viewport");
2364
2408
  i(this, "prevTouches", null);
2365
2409
  i(this, "wheelFinishTimer", null);
@@ -2385,8 +2429,8 @@ class H {
2385
2429
  this.stopMouseDrag();
2386
2430
  return;
2387
2431
  }
2388
- const o = -e.movementX, s = -e.movementY;
2389
- this.moveViewport(o, s);
2432
+ const s = -e.movementX, o = -e.movementY;
2433
+ this.moveViewport(s, o);
2390
2434
  });
2391
2435
  i(this, "onWindowMouseUp", (e) => {
2392
2436
  this.params.mouseUpEventVerifier(e) && this.stopMouseDrag();
@@ -2394,8 +2438,8 @@ class H {
2394
2438
  i(this, "onWheelScroll", (e) => {
2395
2439
  if (!this.params.mouseWheelEventVerifier(e))
2396
2440
  return;
2397
- const { left: t, top: o } = this.element.getBoundingClientRect(), s = e.clientX - t, n = e.clientY - o, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
2398
- this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, s, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2441
+ const { left: t, top: s } = this.element.getBoundingClientRect(), o = e.clientX - t, n = e.clientY - s, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
2442
+ this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, o, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2399
2443
  this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
2400
2444
  }, this.params.scaleWheelFinishTimeout);
2401
2445
  });
@@ -2415,7 +2459,7 @@ class H {
2415
2459
  i(this, "onWindowTouchMove", (e) => {
2416
2460
  const t = I(e);
2417
2461
  if (!t.touches.every(
2418
- (s) => L(this.window, this.element, s[0], s[1])
2462
+ (o) => L(this.window, this.element, o[0], o[1])
2419
2463
  )) {
2420
2464
  this.stopTouchDrag();
2421
2465
  return;
@@ -2424,7 +2468,7 @@ class H {
2424
2468
  -(t.x - this.prevTouches.x),
2425
2469
  -(t.y - this.prevTouches.y)
2426
2470
  ), t.touchesCnt === 2) {
2427
- const { left: s, top: n } = this.element.getBoundingClientRect(), a = this.prevTouches.x - s, h = this.prevTouches.y - n, c = 1 / (t.scale / this.prevTouches.scale);
2471
+ const { left: o, top: n } = this.element.getBoundingClientRect(), a = this.prevTouches.x - o, h = this.prevTouches.y - n, c = 1 / (t.scale / this.prevTouches.scale);
2428
2472
  this.scaleViewport(c, a, h);
2429
2473
  }
2430
2474
  this.prevTouches = t;
@@ -2435,7 +2479,7 @@ class H {
2435
2479
  i(this, "preventWheelScaleListener", (e) => {
2436
2480
  e.preventDefault();
2437
2481
  });
2438
- this.canvas = e, this.element = t, this.window = o, this.params = s, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
2482
+ this.canvas = e, this.element = t, this.window = s, this.params = o, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
2439
2483
  passive: !1
2440
2484
  }), this.viewport = e.viewport, this.handleResize(), this.viewport.onAfterResize.subscribe(() => {
2441
2485
  this.handleResize();
@@ -2447,21 +2491,21 @@ class H {
2447
2491
  passive: !0
2448
2492
  }), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2449
2493
  }
2450
- static configure(e, t, o, s) {
2451
- new H(e, t, o, s);
2494
+ static configure(e, t, s, o) {
2495
+ new H(e, t, s, o);
2452
2496
  }
2453
2497
  moveViewport(e, t) {
2454
- const o = this.viewport.getViewportMatrix(), s = At(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2455
- prevTransform: o,
2456
- nextTransform: s,
2498
+ const s = this.viewport.getViewportMatrix(), o = At(s, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2499
+ prevTransform: s,
2500
+ nextTransform: o,
2457
2501
  canvasWidth: n,
2458
2502
  canvasHeight: a
2459
2503
  });
2460
2504
  this.performTransform(h);
2461
2505
  }
2462
- scaleViewport(e, t, o) {
2463
- const s = this.canvas.viewport.getViewportMatrix(), n = Et(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2464
- prevTransform: s,
2506
+ scaleViewport(e, t, s) {
2507
+ const o = this.canvas.viewport.getViewportMatrix(), n = Et(o, e, t, s), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2508
+ prevTransform: o,
2465
2509
  nextTransform: n,
2466
2510
  canvasWidth: a,
2467
2511
  canvasHeight: h
@@ -2490,17 +2534,17 @@ class H {
2490
2534
  this.transformInProgress = !1, this.params.onTransformFinished();
2491
2535
  }
2492
2536
  handleResize() {
2493
- const e = this.viewport.getViewportMatrix(), { width: t, height: o } = this.viewport.getDimensions(), s = this.params.transformPreprocessor({
2537
+ const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.viewport.getDimensions(), o = this.params.transformPreprocessor({
2494
2538
  prevTransform: e,
2495
2539
  nextTransform: e,
2496
2540
  canvasWidth: t,
2497
- canvasHeight: o
2541
+ canvasHeight: s
2498
2542
  });
2499
- this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(s), this.params.onResizeTransformFinished();
2543
+ this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(o), this.params.onResizeTransformFinished();
2500
2544
  }
2501
2545
  }
2502
2546
  class J {
2503
- constructor(e, t, o, s, n, a) {
2547
+ constructor(e, t, s, o, n, a) {
2504
2548
  i(this, "nodeHorizontal");
2505
2549
  i(this, "nodeVertical");
2506
2550
  i(this, "viewport");
@@ -2523,27 +2567,27 @@ class J {
2523
2567
  this.userTransformInProgress || this.loadAreaAroundViewport();
2524
2568
  });
2525
2569
  i(this, "userTransformInProgress", !1);
2526
- this.canvas = e, this.element = t, this.window = o, this.trigger = n, this.params = a, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.viewport = e.viewport, this.currentScale = this.viewport.getViewportMatrix().scale, this.scheduleLoadAreaAroundViewport(), this.viewport.onAfterResize.subscribe(() => {
2570
+ this.canvas = e, this.element = t, this.window = s, this.trigger = n, this.params = a, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.viewport = e.viewport, this.currentScale = this.viewport.getViewportMatrix().scale, this.scheduleLoadAreaAroundViewport(), this.viewport.onAfterResize.subscribe(() => {
2527
2571
  this.scheduleLoadAreaAroundViewport();
2528
2572
  });
2529
2573
  const h = {
2530
- ...s,
2574
+ ...o,
2531
2575
  onResizeTransformStarted: () => {
2532
- this.userTransformInProgress = !0, s.onResizeTransformStarted();
2576
+ this.userTransformInProgress = !0, o.onResizeTransformStarted();
2533
2577
  },
2534
2578
  onResizeTransformFinished: () => {
2535
- this.userTransformInProgress = !1, s.onResizeTransformFinished();
2579
+ this.userTransformInProgress = !1, o.onResizeTransformFinished();
2536
2580
  },
2537
2581
  onBeforeTransformChange: () => {
2538
- this.userTransformInProgress = !0, s.onBeforeTransformChange();
2582
+ this.userTransformInProgress = !0, o.onBeforeTransformChange();
2539
2583
  },
2540
2584
  onTransformChange: () => {
2541
2585
  this.userTransformInProgress = !1;
2542
2586
  const d = this.currentScale;
2543
- this.currentScale = this.viewport.getViewportMatrix().scale, d !== this.currentScale && this.scheduleEnsureViewportAreaLoaded(), s.onTransformChange();
2587
+ this.currentScale = this.viewport.getViewportMatrix().scale, d !== this.currentScale && this.scheduleEnsureViewportAreaLoaded(), o.onTransformChange();
2544
2588
  },
2545
2589
  onTransformFinished: () => {
2546
- this.scheduleLoadAreaAroundViewport(), s.onTransformFinished();
2590
+ this.scheduleLoadAreaAroundViewport(), o.onTransformFinished();
2547
2591
  }
2548
2592
  };
2549
2593
  H.configure(
@@ -2553,12 +2597,12 @@ class J {
2553
2597
  h
2554
2598
  ), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
2555
2599
  }
2556
- static configure(e, t, o, s, n, a) {
2600
+ static configure(e, t, s, o, n, a) {
2557
2601
  new J(
2558
2602
  e,
2559
2603
  t,
2560
- o,
2561
2604
  s,
2605
+ o,
2562
2606
  n,
2563
2607
  a
2564
2608
  );
@@ -2570,12 +2614,12 @@ class J {
2570
2614
  }
2571
2615
  scheduleEnsureViewportAreaLoaded() {
2572
2616
  setTimeout(() => {
2573
- 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, l = n + h + this.nodeVertical;
2617
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: s, x: o, y: n } = this.viewport.getViewportMatrix(), a = e * s, h = t * s, d = o - this.nodeHorizontal, c = n - this.nodeVertical, g = o + a + this.nodeHorizontal, l = n + h + this.nodeVertical;
2574
2618
  this.loadedArea.xFrom < d && this.loadedArea.xTo > g && this.loadedArea.yFrom < c && this.loadedArea.yTo > l || this.loadAreaAroundViewport();
2575
2619
  });
2576
2620
  }
2577
2621
  loadAreaAroundViewport() {
2578
- 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, l = 3 * h + 2 * this.nodeVertical;
2622
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: s, x: o, y: n } = this.viewport.getViewportMatrix(), a = e * s, h = t * s, d = o - a - this.nodeHorizontal, c = n - h - this.nodeVertical, g = 3 * a + 2 * this.nodeHorizontal, l = 3 * h + 2 * this.nodeVertical;
2579
2623
  this.trigger.emit({
2580
2624
  x: d,
2581
2625
  y: c,
@@ -2598,7 +2642,7 @@ const xt = () => {
2598
2642
  return r.setAttribute("id", "pattern"), r;
2599
2643
  };
2600
2644
  class _ {
2601
- constructor(e, t, o) {
2645
+ constructor(e, t, s) {
2602
2646
  i(this, "svg", xt());
2603
2647
  i(this, "patternRenderingRectangle", St());
2604
2648
  i(this, "pattern", bt());
@@ -2610,19 +2654,19 @@ class _ {
2610
2654
  i(this, "maxViewportScale");
2611
2655
  i(this, "visible", !1);
2612
2656
  i(this, "onAfterTransformUpdated", () => {
2613
- const e = this.canvas.viewport.getContentMatrix(), t = e.x - this.halfTileWidth * e.scale, o = e.y - this.halfTileHeight * e.scale, s = `matrix(${e.scale}, 0, 0, ${e.scale}, ${t}, ${o})`;
2614
- this.pattern.setAttribute("patternTransform", s), this.updateVisibility();
2657
+ const e = this.canvas.viewport.getContentMatrix(), t = e.x - this.halfTileWidth * e.scale, s = e.y - this.halfTileHeight * e.scale, o = `matrix(${e.scale}, 0, 0, ${e.scale}, ${t}, ${s})`;
2658
+ this.pattern.setAttribute("patternTransform", o), this.updateVisibility();
2615
2659
  });
2616
- this.canvas = e, this.backgroundHost = o, this.tileWidth = t.tileWidth, this.tileHeight = t.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = t.renderer, this.maxViewportScale = t.maxViewportScale;
2617
- const s = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2618
- this.patternContent.setAttribute("transform", s), this.pattern.appendChild(this.patternContent);
2660
+ this.canvas = e, this.backgroundHost = s, this.tileWidth = t.tileWidth, this.tileHeight = t.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = t.renderer, this.maxViewportScale = t.maxViewportScale;
2661
+ const o = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2662
+ this.patternContent.setAttribute("transform", o), this.pattern.appendChild(this.patternContent);
2619
2663
  const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
2620
2664
  n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.updateDimensions(), this.canvas.viewport.onAfterResize.subscribe(() => {
2621
2665
  this.updateDimensions();
2622
2666
  }), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
2623
2667
  }
2624
- static configure(e, t, o) {
2625
- new _(e, t, o);
2668
+ static configure(e, t, s) {
2669
+ new _(e, t, s);
2626
2670
  }
2627
2671
  updateVisibility() {
2628
2672
  const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
@@ -2631,19 +2675,19 @@ class _ {
2631
2675
  updateDimensions() {
2632
2676
  const { width: e, height: t } = this.canvas.viewport.getDimensions();
2633
2677
  this.svg.setAttribute("width", `${e}`), this.svg.setAttribute("height", `${t}`), this.patternRenderingRectangle.setAttribute("width", `${e}`), this.patternRenderingRectangle.setAttribute("height", `${t}`);
2634
- const o = this.tileWidth / e, s = this.tileHeight / t;
2635
- this.pattern.setAttribute("width", `${o}`), this.pattern.setAttribute("height", `${s}`);
2678
+ const s = this.tileWidth / e, o = this.tileHeight / t;
2679
+ this.pattern.setAttribute("width", `${s}`), this.pattern.setAttribute("height", `${o}`);
2636
2680
  }
2637
2681
  }
2638
2682
  class ee {
2639
- constructor(e, t, o, s, n) {
2683
+ constructor(e, t, s, o, n) {
2640
2684
  i(this, "overlayCanvas");
2641
2685
  i(this, "staticPortId", null);
2642
2686
  i(this, "isTargetDragging", !0);
2643
2687
  i(this, "onEdgeCreated", (e) => {
2644
2688
  this.params.onAfterEdgeCreated(e);
2645
2689
  });
2646
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = n, this.overlayCanvas = Ve(
2690
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = Ve(
2647
2691
  this.overlayLayer,
2648
2692
  this.viewportStore
2649
2693
  ), z.configure(
@@ -2669,19 +2713,19 @@ class ee {
2669
2713
  }
2670
2714
  );
2671
2715
  }
2672
- static configure(e, t, o, s, n) {
2716
+ static configure(e, t, s, o, n) {
2673
2717
  new ee(
2674
2718
  e,
2675
2719
  t,
2676
- o,
2677
2720
  s,
2721
+ o,
2678
2722
  n
2679
2723
  );
2680
2724
  }
2681
- grabPort(e, t, o) {
2682
- const s = this.canvas.graph.getPort(e);
2725
+ grabPort(e, t, s) {
2726
+ const o = this.canvas.graph.getPort(e);
2683
2727
  this.staticPortId = e;
2684
- 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({
2728
+ const n = o.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
2685
2729
  x: a - d.x,
2686
2730
  y: h - d.y
2687
2731
  }), g = this.canvas.viewport.createContentCoords({
@@ -2690,13 +2734,13 @@ class ee {
2690
2734
  }), l = {
2691
2735
  overlayNodeId: C.StaticNodeId,
2692
2736
  portCoords: c,
2693
- portDirection: s.direction
2737
+ portDirection: o.direction
2694
2738
  }, u = {
2695
2739
  overlayNodeId: C.DraggingNodeId,
2696
2740
  portCoords: g,
2697
2741
  portDirection: this.params.dragPortDirection
2698
2742
  };
2699
- this.isTargetDragging = o === "direct";
2743
+ this.isTargetDragging = s === "direct";
2700
2744
  const [w, y] = this.isTargetDragging ? [l, u] : [u, l];
2701
2745
  this.overlayCanvas.addNode(U(w)), this.overlayCanvas.addNode(U(y)), this.overlayCanvas.addEdge({
2702
2746
  from: w.overlayNodeId,
@@ -2708,30 +2752,30 @@ class ee {
2708
2752
  this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
2709
2753
  }
2710
2754
  tryCreateConnection(e) {
2711
- const t = xe(this.canvas.graph, e), o = this.staticPortId;
2755
+ const t = xe(this.canvas.graph, e), s = this.staticPortId;
2712
2756
  if (t === null) {
2713
2757
  this.params.onEdgeCreationInterrupted({
2714
- staticPortId: o,
2758
+ staticPortId: s,
2715
2759
  isDirect: this.isTargetDragging
2716
2760
  });
2717
2761
  return;
2718
2762
  }
2719
- const s = this.isTargetDragging ? o : t, n = this.isTargetDragging ? t : o, a = { from: s, to: n }, h = this.params.connectionPreprocessor(a);
2763
+ const o = this.isTargetDragging ? s : t, n = this.isTargetDragging ? t : s, a = { from: o, to: n }, h = this.params.connectionPreprocessor(a);
2720
2764
  h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
2721
2765
  }
2722
2766
  moveDraggingPort(e) {
2723
- const t = this.overlayLayer.getBoundingClientRect(), o = this.canvas.viewport.createContentCoords({
2767
+ const t = this.overlayLayer.getBoundingClientRect(), s = this.canvas.viewport.createContentCoords({
2724
2768
  x: e.x - t.x,
2725
2769
  y: e.y - t.y
2726
2770
  });
2727
2771
  this.overlayCanvas.updateNode(C.DraggingNodeId, {
2728
- x: o.x,
2729
- y: o.y
2772
+ x: s.x,
2773
+ y: s.y
2730
2774
  });
2731
2775
  }
2732
2776
  }
2733
2777
  class te {
2734
- constructor(e, t, o, s, n) {
2778
+ constructor(e, t, s, o, n) {
2735
2779
  i(this, "overlayCanvas");
2736
2780
  i(this, "staticPortId", null);
2737
2781
  i(this, "isTargetDragging", !0);
@@ -2739,7 +2783,7 @@ class te {
2739
2783
  i(this, "onEdgeReattached", (e) => {
2740
2784
  this.params.onAfterEdgeReattached(e);
2741
2785
  });
2742
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = n, this.overlayCanvas = Ve(
2786
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = Ve(
2743
2787
  this.overlayLayer,
2744
2788
  this.viewportStore
2745
2789
  ), z.configure(
@@ -2762,23 +2806,23 @@ class te {
2762
2806
  }
2763
2807
  );
2764
2808
  }
2765
- static configure(e, t, o, s, n) {
2809
+ static configure(e, t, s, o, n) {
2766
2810
  new te(
2767
2811
  e,
2768
2812
  t,
2769
- o,
2770
2813
  s,
2814
+ o,
2771
2815
  n
2772
2816
  );
2773
2817
  }
2774
2818
  tryStartEdgeDragging(e, t) {
2775
- const o = this.params.draggingEdgeResolver(e);
2776
- if (o === null)
2777
- return !1;
2778
- const s = this.canvas.graph.getEdge(o);
2819
+ const s = this.params.draggingEdgeResolver(e);
2779
2820
  if (s === null)
2780
2821
  return !1;
2781
- const n = e === s.from, a = e === s.to, h = n ? s.to : s.from;
2822
+ const o = this.canvas.graph.getEdge(s);
2823
+ if (o === null)
2824
+ return !1;
2825
+ const n = e === o.from, a = e === o.to, h = n ? o.to : o.from;
2782
2826
  this.staticPortId = h, this.isTargetDragging = a;
2783
2827
  const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
2784
2828
  x: g.x + g.width / 2,
@@ -2791,12 +2835,12 @@ class te {
2791
2835
  y: t.y - u.y
2792
2836
  });
2793
2837
  this.draggingEdgePayload = {
2794
- id: o,
2795
- from: s.from,
2796
- to: s.to,
2797
- shape: s.shape,
2798
- priority: s.priority
2799
- }, this.canvas.removeEdge(o);
2838
+ id: s,
2839
+ from: o.from,
2840
+ to: o.to,
2841
+ shape: o.shape,
2842
+ priority: o.priority
2843
+ }, this.canvas.removeEdge(s);
2800
2844
  const A = {
2801
2845
  overlayNodeId: C.StaticNodeId,
2802
2846
  portCoords: w,
@@ -2807,7 +2851,7 @@ class te {
2807
2851
  portDirection: d.direction
2808
2852
  }, [S, T] = this.isTargetDragging ? [A, x] : [x, A];
2809
2853
  this.overlayCanvas.addNode(U(S)), this.overlayCanvas.addNode(U(T));
2810
- const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(C.EdgeId) : s.shape;
2854
+ const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(C.EdgeId) : o.shape;
2811
2855
  return this.overlayCanvas.addEdge({
2812
2856
  id: C.EdgeId,
2813
2857
  from: S.overlayNodeId,
@@ -2819,13 +2863,13 @@ class te {
2819
2863
  this.draggingEdgePayload = null, this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
2820
2864
  }
2821
2865
  moveDraggingPort(e) {
2822
- const t = this.overlayLayer.getBoundingClientRect(), o = {
2866
+ const t = this.overlayLayer.getBoundingClientRect(), s = {
2823
2867
  x: e.x - t.x,
2824
2868
  y: e.y - t.y
2825
- }, s = this.canvas.viewport.createContentCoords(o);
2869
+ }, o = this.canvas.viewport.createContentCoords(s);
2826
2870
  this.overlayCanvas.updateNode(C.DraggingNodeId, {
2827
- x: s.x,
2828
- y: s.y
2871
+ x: o.x,
2872
+ y: o.y
2829
2873
  });
2830
2874
  }
2831
2875
  tryCreateConnection(e) {
@@ -2841,10 +2885,10 @@ class te {
2841
2885
  });
2842
2886
  return;
2843
2887
  }
2844
- const [o, s] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
2888
+ const [s, o] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
2845
2889
  id: n.id,
2846
- from: o,
2847
- to: s,
2890
+ from: s,
2891
+ to: o,
2848
2892
  shape: n.shape,
2849
2893
  priority: n.priority
2850
2894
  }, h = this.params.connectionPreprocessor(a);
@@ -2863,39 +2907,39 @@ class te {
2863
2907
  }
2864
2908
  }
2865
2909
  class re {
2866
- constructor(e, t, o) {
2867
- this.canvas = e, this.layoutAlgorithm = t, this.trigger = o, this.trigger.subscribe(() => {
2910
+ constructor(e, t, s) {
2911
+ this.canvas = e, this.layoutAlgorithm = t, this.trigger = s, this.trigger.subscribe(() => {
2868
2912
  this.applyLayout();
2869
2913
  });
2870
2914
  }
2871
- static configure(e, t, o) {
2915
+ static configure(e, t, s) {
2872
2916
  new re(
2873
2917
  e,
2874
2918
  t,
2875
- o
2919
+ s
2876
2920
  );
2877
2921
  }
2878
2922
  applyLayout() {
2879
2923
  this.layoutAlgorithm.calculateCoordinates(
2880
2924
  this.canvas.graph,
2881
2925
  this.canvas.viewport
2882
- ).forEach((t, o) => {
2883
- this.canvas.updateNode(o, t);
2926
+ ).forEach((t, s) => {
2927
+ this.canvas.updateNode(s, t);
2884
2928
  });
2885
2929
  }
2886
2930
  }
2887
2931
  class O {
2888
- constructor(e, t, o) {
2932
+ constructor(e, t, s) {
2889
2933
  i(this, "applyScheduled", !1);
2890
2934
  i(this, "apply", () => {
2891
2935
  this.applyScheduled = !1, this.layoutAlgorithm.calculateCoordinates(
2892
2936
  this.canvas.graph,
2893
2937
  this.canvas.viewport
2894
- ).forEach((t, o) => {
2895
- this.canvas.updateNode(o, t);
2938
+ ).forEach((t, s) => {
2939
+ this.canvas.updateNode(s, t);
2896
2940
  });
2897
2941
  });
2898
- this.canvas = e, this.layoutAlgorithm = t, this.defererFn = o, this.canvas.graph.onAfterNodeAdded.subscribe(() => {
2942
+ this.canvas = e, this.layoutAlgorithm = t, this.defererFn = s, this.canvas.graph.onAfterNodeAdded.subscribe(() => {
2899
2943
  this.scheduleApply();
2900
2944
  }), this.canvas.graph.onBeforeNodeRemoved.subscribe(() => {
2901
2945
  this.scheduleApply();
@@ -2905,11 +2949,11 @@ class O {
2905
2949
  this.scheduleApply();
2906
2950
  });
2907
2951
  }
2908
- static configure(e, t, o) {
2952
+ static configure(e, t, s) {
2909
2953
  new O(
2910
2954
  e,
2911
2955
  t,
2912
- o
2956
+ s
2913
2957
  );
2914
2958
  }
2915
2959
  scheduleApply() {
@@ -2918,13 +2962,13 @@ class O {
2918
2962
  }
2919
2963
  class Pt {
2920
2964
  static configure(e, t) {
2921
- const o = t.applyOn;
2922
- switch (o.type) {
2965
+ const s = t.applyOn;
2966
+ switch (s.type) {
2923
2967
  case "manual": {
2924
2968
  re.configure(
2925
2969
  e,
2926
2970
  t.algorithm,
2927
- o.trigger
2971
+ s.trigger
2928
2972
  );
2929
2973
  break;
2930
2974
  }
@@ -2932,9 +2976,9 @@ class Pt {
2932
2976
  O.configure(
2933
2977
  e,
2934
2978
  t.algorithm,
2935
- (s) => {
2979
+ (o) => {
2936
2980
  setTimeout(() => {
2937
- s();
2981
+ o();
2938
2982
  });
2939
2983
  }
2940
2984
  );
@@ -2944,9 +2988,9 @@ class Pt {
2944
2988
  O.configure(
2945
2989
  e,
2946
2990
  t.algorithm,
2947
- (s) => {
2991
+ (o) => {
2948
2992
  queueMicrotask(() => {
2949
- s();
2993
+ o();
2950
2994
  });
2951
2995
  }
2952
2996
  );
@@ -2970,21 +3014,21 @@ class Ct {
2970
3014
  this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
2971
3015
  }
2972
3016
  }
2973
- class oe {
2974
- constructor(e, t, o, s) {
3017
+ class se {
3018
+ constructor(e, t, s, o) {
2975
3019
  i(this, "step", (e) => {
2976
3020
  this.algorithm.calculateNextCoordinates(
2977
3021
  this.canvas.graph,
2978
3022
  e,
2979
3023
  this.canvas.viewport
2980
- ).forEach((o, s) => {
2981
- this.staticNodes.has(s) || this.canvas.updateNode(s, { x: o.x, y: o.y });
3024
+ ).forEach((s, o) => {
3025
+ this.staticNodes.has(o) || this.canvas.updateNode(o, { x: s.x, y: s.y });
2982
3026
  });
2983
3027
  });
2984
- this.canvas = e, this.algorithm = t, this.staticNodes = o, this.win = s, new Ct(this.win, this.step);
3028
+ this.canvas = e, this.algorithm = t, this.staticNodes = s, this.win = o, new Ct(this.win, this.step);
2985
3029
  }
2986
- static configure(e, t, o, s) {
2987
- new oe(e, t, o, s);
3030
+ static configure(e, t, s, o) {
3031
+ new se(e, t, s, o);
2988
3032
  }
2989
3033
  }
2990
3034
  const Tt = () => {
@@ -2997,7 +3041,7 @@ const Tt = () => {
2997
3041
  const r = Y();
2998
3042
  return r.style.pointerEvents = "none", r;
2999
3043
  };
3000
- class Dt {
3044
+ class Nt {
3001
3045
  constructor(e) {
3002
3046
  i(this, "background", Y());
3003
3047
  i(this, "main", Y());
@@ -3010,17 +3054,17 @@ class Dt {
3010
3054
  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);
3011
3055
  }
3012
3056
  }
3013
- const G = (r) => () => r, we = G(0), Nt = () => {
3057
+ const G = (r) => () => r, we = G(0), Dt = () => {
3014
3058
  let r = 0;
3015
3059
  return () => r++;
3016
3060
  }, Mt = (r, e) => {
3017
- let t = we, o = we;
3018
- const s = Nt();
3019
- return r === "incremental" && (t = s), e === "incremental" && (o = s), typeof r == "number" && (t = G(r)), typeof e == "number" && (o = G(e)), typeof r == "function" && (t = r), typeof e == "function" && (o = e), {
3061
+ let t = we, s = we;
3062
+ const o = Dt();
3063
+ return r === "incremental" && (t = o), e === "incremental" && (s = o), typeof r == "number" && (t = G(r)), typeof e == "number" && (s = G(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
3020
3064
  nodesPriorityFn: t,
3021
- edgesPriorityFn: o
3065
+ edgesPriorityFn: s
3022
3066
  };
3023
- }, se = (r) => {
3067
+ }, oe = (r) => {
3024
3068
  if (typeof r == "function")
3025
3069
  return r;
3026
3070
  switch (r.type) {
@@ -3065,7 +3109,7 @@ const G = (r) => () => r, we = G(0), Nt = () => {
3065
3109
  detourDistance: r.detourDistance
3066
3110
  });
3067
3111
  case "direct":
3068
- return () => new Ne({
3112
+ return () => new De({
3069
3113
  color: r.color,
3070
3114
  width: r.width,
3071
3115
  arrowLength: r.arrowLength,
@@ -3091,21 +3135,21 @@ const G = (r) => () => r, we = G(0), Nt = () => {
3091
3135
  });
3092
3136
  }
3093
3137
  }, Lt = (r) => {
3094
- var t, o, s, n, a;
3138
+ var t, s, o, n, a;
3095
3139
  const e = Mt(
3096
3140
  (t = r.nodes) == null ? void 0 : t.priority,
3097
- (o = r.edges) == null ? void 0 : o.priority
3141
+ (s = r.edges) == null ? void 0 : s.priority
3098
3142
  );
3099
3143
  return {
3100
3144
  nodes: {
3101
- centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ?? Se,
3145
+ centerFn: ((o = r.nodes) == null ? void 0 : o.centerFn) ?? Se,
3102
3146
  priorityFn: e.nodesPriorityFn
3103
3147
  },
3104
3148
  ports: {
3105
3149
  direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
3106
3150
  },
3107
3151
  edges: {
3108
- shapeFactory: se(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
3152
+ shapeFactory: oe(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
3109
3153
  priorityFn: e.edgesPriorityFn
3110
3154
  }
3111
3155
  };
@@ -3113,7 +3157,7 @@ const G = (r) => () => r, we = G(0), Nt = () => {
3113
3157
  var w, y, A, x, S, T;
3114
3158
  const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
3115
3159
  }), t = ((y = r.events) == null ? void 0 : y.onNodeDrag) ?? (() => {
3116
- }), o = r.nodeDragVerifier ?? (() => !0), s = ((A = r.events) == null ? void 0 : A.onNodeDragFinished) ?? (() => {
3160
+ }), s = r.nodeDragVerifier ?? (() => !0), o = ((A = r.events) == null ? void 0 : A.onNodeDragFinished) ?? (() => {
3117
3161
  }), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (x = r.mouse) == null ? void 0 : x.dragCursor, d = h !== void 0 ? h : "grab", c = (S = r.mouse) == null ? void 0 : S.mouseDownEventVerifier, g = c !== void 0 ? c : (P) => P.button === 0, l = (T = r.mouse) == null ? void 0 : T.mouseUpEventVerifier, u = l !== void 0 ? l : (P) => P.button === 0;
3118
3162
  return {
3119
3163
  moveOnTop: n,
@@ -3124,31 +3168,31 @@ const G = (r) => () => r, we = G(0), Nt = () => {
3124
3168
  mouseUpEventVerifier: u,
3125
3169
  onNodeDragStarted: e,
3126
3170
  onNodeDrag: t,
3127
- nodeDragVerifier: o,
3128
- onNodeDragFinished: s
3171
+ nodeDragVerifier: s,
3172
+ onNodeDragFinished: o
3129
3173
  };
3130
3174
  }, Vt = (r) => {
3131
- 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;
3175
+ const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0, o = r.maxY !== null ? r.maxY : 1 / 0;
3132
3176
  return (n) => {
3133
3177
  let a = n.nextTransform.x, h = n.nextTransform.y;
3134
3178
  a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
3135
3179
  const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
3136
- 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));
3137
- const g = n.canvasHeight * n.prevTransform.scale, l = s - g;
3180
+ a > c && a > n.prevTransform.x && (a = Math.max(n.prevTransform.x, c)), h < s && h < n.prevTransform.y && (h = Math.min(n.prevTransform.y, s));
3181
+ const g = n.canvasHeight * n.prevTransform.scale, l = o - g;
3138
3182
  return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
3139
3183
  };
3140
3184
  }, Ft = (r) => {
3141
- const e = r.maxContentScale, t = r.minContentScale, o = e !== null ? 1 / e : 0, s = t !== null ? 1 / t : 1 / 0;
3185
+ const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, o = t !== null ? 1 / t : 1 / 0;
3142
3186
  return (n) => {
3143
3187
  const a = n.prevTransform, h = n.nextTransform;
3144
3188
  let d = h.scale, c = h.x, g = h.y;
3145
- if (h.scale > s && h.scale > a.scale) {
3146
- d = Math.max(a.scale, s), c = a.x, g = a.y;
3189
+ if (h.scale > o && h.scale > a.scale) {
3190
+ d = Math.max(a.scale, o), c = a.x, g = a.y;
3147
3191
  const l = (d - a.scale) / (h.scale - a.scale);
3148
3192
  c = a.x + (h.x - a.x) * l, g = a.y + (h.y - a.y) * l;
3149
3193
  }
3150
- if (h.scale < o && h.scale < a.scale) {
3151
- d = Math.min(a.scale, o), c = a.x, g = a.y;
3194
+ if (h.scale < s && h.scale < a.scale) {
3195
+ d = Math.min(a.scale, s), c = a.x, g = a.y;
3152
3196
  const l = (d - a.scale) / (h.scale - a.scale);
3153
3197
  c = a.x + (h.x - a.x) * l, g = a.y + (h.y - a.y) * l;
3154
3198
  }
@@ -3159,7 +3203,7 @@ const G = (r) => () => r, we = G(0), Nt = () => {
3159
3203
  };
3160
3204
  };
3161
3205
  }, It = (r) => (e) => r.reduce(
3162
- (t, o) => o({
3206
+ (t, s) => s({
3163
3207
  prevTransform: e.prevTransform,
3164
3208
  nextTransform: t,
3165
3209
  canvasWidth: e.canvasWidth,
@@ -3185,16 +3229,16 @@ const G = (r) => () => r, we = G(0), Nt = () => {
3185
3229
  }
3186
3230
  }, ye = (r) => {
3187
3231
  var y, A, x, S, T, P, R, V, ie, ne, ae, he;
3188
- 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;
3189
- let s;
3190
- o !== void 0 ? Array.isArray(o) ? s = It(
3191
- o.map(
3192
- (D) => fe(D)
3232
+ const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
3233
+ let o;
3234
+ s !== void 0 ? Array.isArray(s) ? o = It(
3235
+ s.map(
3236
+ (N) => fe(N)
3193
3237
  )
3194
- ) : s = fe(o) : s = (D) => D.nextTransform;
3238
+ ) : o = fe(s) : o = (N) => N.nextTransform;
3195
3239
  const n = ((A = r == null ? void 0 : r.shift) == null ? void 0 : A.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onBeforeTransformChange) ?? (() => {
3196
3240
  }), h = ((S = r == null ? void 0 : r.events) == null ? void 0 : S.onTransformChange) ?? (() => {
3197
- }), d = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseDownEventVerifier, c = d !== void 0 ? d : (D) => D.button === 0, g = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseUpEventVerifier, l = g !== void 0 ? g : (D) => D.button === 0, u = (R = r == null ? void 0 : r.scale) == null ? void 0 : R.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
3241
+ }), d = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseDownEventVerifier, c = d !== void 0 ? d : (N) => N.button === 0, g = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseUpEventVerifier, l = g !== void 0 ? g : (N) => N.button === 0, u = (R = r == null ? void 0 : r.scale) == null ? void 0 : R.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
3198
3242
  return {
3199
3243
  wheelSensitivity: t,
3200
3244
  onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
@@ -3203,7 +3247,7 @@ const G = (r) => () => r, we = G(0), Nt = () => {
3203
3247
  }),
3204
3248
  onBeforeTransformChange: a,
3205
3249
  onTransformChange: h,
3206
- transformPreprocessor: s,
3250
+ transformPreprocessor: o,
3207
3251
  shiftCursor: n,
3208
3252
  mouseDownEventVerifier: c,
3209
3253
  mouseUpEventVerifier: l,
@@ -3224,33 +3268,33 @@ const G = (r) => () => r, we = G(0), Nt = () => {
3224
3268
  (r == null ? void 0 : r.radius) ?? 1.5,
3225
3269
  (r == null ? void 0 : r.color) ?? "#d8d8d8"
3226
3270
  ), Bt = (r) => {
3227
- const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s = Ut(r.renderer ?? {});
3271
+ const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, o = Ut(r.renderer ?? {});
3228
3272
  return {
3229
3273
  tileWidth: t,
3230
- tileHeight: o,
3231
- renderer: s,
3274
+ tileHeight: s,
3275
+ renderer: o,
3232
3276
  maxViewportScale: r.maxViewportScale ?? 10
3233
3277
  };
3234
3278
  }, Ot = (r, e, t) => {
3235
3279
  var c, g, l;
3236
- const o = () => "direct", s = (u) => u, n = (u) => u.button === 0, a = () => {
3280
+ const s = () => "direct", o = (u) => u, n = (u) => u.button === 0, a = () => {
3237
3281
  }, h = () => {
3238
3282
  }, d = () => {
3239
3283
  };
3240
3284
  return {
3241
- connectionTypeResolver: r.connectionTypeResolver ?? o,
3242
- connectionPreprocessor: r.connectionPreprocessor ?? s,
3285
+ connectionTypeResolver: r.connectionTypeResolver ?? s,
3286
+ connectionPreprocessor: r.connectionPreprocessor ?? o,
3243
3287
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
3244
3288
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
3245
3289
  onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
3246
3290
  onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
3247
3291
  onEdgeCreationPrevented: ((l = r.events) == null ? void 0 : l.onEdgeCreationPrevented) ?? h,
3248
3292
  dragPortDirection: r.dragPortDirection ?? t,
3249
- edgeShapeFactory: r.edgeShape !== void 0 ? se(r.edgeShape) : e
3293
+ edgeShapeFactory: r.edgeShape !== void 0 ? oe(r.edgeShape) : e
3250
3294
  };
3251
3295
  }, Wt = (r, e) => {
3252
3296
  var c, g, l;
3253
- const t = (u) => u, o = (u) => u.button === 0 && u.ctrlKey, s = (u) => u.button === 0, n = (u) => {
3297
+ const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, o = (u) => u.button === 0, n = (u) => {
3254
3298
  const w = e.getPortAdjacentEdgeIds(u);
3255
3299
  return w.length > 0 ? w[w.length - 1] : null;
3256
3300
  }, a = () => {
@@ -3259,10 +3303,10 @@ const G = (r) => () => r, we = G(0), Nt = () => {
3259
3303
  };
3260
3304
  return {
3261
3305
  connectionPreprocessor: r.connectionPreprocessor ?? t,
3262
- mouseDownEventVerifier: r.mouseDownEventVerifier ?? o,
3263
- mouseUpEventVerifier: r.mouseUpEventVerifier ?? s,
3306
+ mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
3307
+ mouseUpEventVerifier: r.mouseUpEventVerifier ?? o,
3264
3308
  draggingEdgeResolver: r.draggingEdgeResolver ?? n,
3265
- draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? se(r.draggingEdgeShape) : null,
3309
+ draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? oe(r.draggingEdgeShape) : null,
3266
3310
  onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
3267
3311
  onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
3268
3312
  onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
@@ -3286,22 +3330,22 @@ class Ht extends Error {
3286
3330
  }
3287
3331
  }
3288
3332
  class Fe {
3289
- constructor(e, t, o) {
3333
+ constructor(e, t, s) {
3290
3334
  i(this, "dt");
3291
3335
  i(this, "nodeMass");
3292
3336
  i(this, "edgeEquilibriumLength");
3293
3337
  i(this, "edgeStiffness");
3294
3338
  i(this, "nodeForcesApplicationStrategy");
3295
3339
  i(this, "distanceVectorGenerator");
3296
- this.graph = e, this.currentCoords = t, this.dt = o.dtSec, this.nodeMass = o.nodeMass, this.edgeEquilibriumLength = o.edgeEquilibriumLength, this.edgeStiffness = o.edgeStiffness, this.distanceVectorGenerator = o.distanceVectorGenerator, this.nodeForcesApplicationStrategy = o.nodeForcesApplicationStrategy;
3340
+ this.graph = e, this.currentCoords = t, this.dt = s.dtSec, this.nodeMass = s.nodeMass, this.edgeEquilibriumLength = s.edgeEquilibriumLength, this.edgeStiffness = s.edgeStiffness, this.distanceVectorGenerator = s.distanceVectorGenerator, this.nodeForcesApplicationStrategy = s.nodeForcesApplicationStrategy;
3297
3341
  }
3298
3342
  apply() {
3299
3343
  let e = 0, t = 0;
3300
- const o = /* @__PURE__ */ new Map();
3344
+ const s = /* @__PURE__ */ new Map();
3301
3345
  return this.graph.getAllNodeIds().forEach((n) => {
3302
- o.set(n, { x: 0, y: 0 });
3303
- }), this.nodeForcesApplicationStrategy.apply(this.currentCoords, o), this.applyEdgeForces(o), this.currentCoords.forEach((n, a) => {
3304
- const h = o.get(a), d = {
3346
+ s.set(n, { x: 0, y: 0 });
3347
+ }), this.nodeForcesApplicationStrategy.apply(this.currentCoords, s), this.applyEdgeForces(s), this.currentCoords.forEach((n, a) => {
3348
+ const h = s.get(a), d = {
3305
3349
  x: h.x / this.nodeMass * this.dt,
3306
3350
  y: h.y / this.nodeMass * this.dt
3307
3351
  };
@@ -3315,10 +3359,10 @@ class Fe {
3315
3359
  }
3316
3360
  applyEdgeForces(e) {
3317
3361
  this.graph.getAllEdgeIds().forEach((t) => {
3318
- 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(
3362
+ const s = this.graph.getEdge(t), o = this.graph.getPort(s.from), n = this.graph.getPort(s.to), a = this.currentCoords.get(o.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
3319
3363
  a,
3320
3364
  h
3321
- ), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, w = e.get(s.nodeId), y = e.get(n.nodeId);
3365
+ ), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, w = e.get(o.nodeId), y = e.get(n.nodeId);
3322
3366
  w.x += l, w.y += u, y.x -= l, y.y -= u;
3323
3367
  });
3324
3368
  }
@@ -3329,7 +3373,7 @@ class Ie {
3329
3373
  this.rand = e;
3330
3374
  }
3331
3375
  create(e, t) {
3332
- const o = t.x - e.x, s = t.y - e.y, n = o * o + s * s;
3376
+ const s = t.x - e.x, o = t.y - e.y, n = s * s + o * o;
3333
3377
  if (n === 0) {
3334
3378
  const c = this.PI2 * this.rand();
3335
3379
  return {
@@ -3338,7 +3382,7 @@ class Ie {
3338
3382
  d: 0
3339
3383
  };
3340
3384
  }
3341
- const a = Math.sqrt(n), h = o / a, d = s / a;
3385
+ const a = Math.sqrt(n), h = s / a, d = o / a;
3342
3386
  return { ex: h, ey: d, d: a };
3343
3387
  }
3344
3388
  }
@@ -3357,11 +3401,11 @@ class Xt {
3357
3401
  this.effectiveDistance = e.effectiveDistance, this.nodeCharge = e.nodeCharge, this.distanceVectorGenerator = e.distanceVectorGenerator, this.maxForce = e.maxForce;
3358
3402
  }
3359
3403
  apply(e, t) {
3360
- const o = Array.from(t.keys()), s = o.length;
3361
- for (let n = 0; n < s; n++) {
3362
- const a = o[n];
3363
- for (let h = n + 1; h < s; h++) {
3364
- const d = o[h], c = e.get(a), g = e.get(d), l = this.distanceVectorGenerator.create(
3404
+ const s = Array.from(t.keys()), o = s.length;
3405
+ for (let n = 0; n < o; n++) {
3406
+ const a = s[n];
3407
+ for (let h = n + 1; h < o; h++) {
3408
+ const d = s[h], c = e.get(a), g = e.get(d), l = this.distanceVectorGenerator.create(
3365
3409
  c,
3366
3410
  g
3367
3411
  );
@@ -3386,14 +3430,14 @@ const Yt = (r) => {
3386
3430
  centerY: 0,
3387
3431
  radius: 0
3388
3432
  };
3389
- let e = 1 / 0, t = -1 / 0, o = 1 / 0, s = -1 / 0;
3433
+ let e = 1 / 0, t = -1 / 0, s = 1 / 0, o = -1 / 0;
3390
3434
  r.forEach((d) => {
3391
- e = Math.min(e, d.x), t = Math.max(t, d.x), o = Math.min(o, d.y), s = Math.max(s, d.y);
3435
+ e = Math.min(e, d.x), t = Math.max(t, d.x), s = Math.min(s, d.y), o = Math.max(o, d.y);
3392
3436
  });
3393
- const n = t - e, a = s - o, h = Math.max(n, a);
3437
+ const n = t - e, a = o - s, h = Math.max(n, a);
3394
3438
  return {
3395
3439
  centerX: (e + t) / 2,
3396
- centerY: (o + s) / 2,
3440
+ centerY: (s + o) / 2,
3397
3441
  radius: h / 2
3398
3442
  };
3399
3443
  };
@@ -3423,18 +3467,18 @@ class Gt {
3423
3467
  };
3424
3468
  let t = [this.root];
3425
3469
  for (; t.length > 0; ) {
3426
- const o = [];
3470
+ const s = [];
3427
3471
  for (; t.length > 0; ) {
3428
- const s = t.pop();
3429
- this.processNode(s).forEach((a) => {
3430
- o.push(a);
3472
+ const o = t.pop();
3473
+ this.processNode(o).forEach((a) => {
3474
+ s.push(a);
3431
3475
  });
3432
3476
  }
3433
- t = o;
3477
+ t = s;
3434
3478
  }
3435
- this.sortedParentNodes.reverse().forEach((o) => {
3436
- let s = 0, n = 0, a = 0, h = 0;
3437
- o.lb !== null && (a += o.lb.totalMass, h += o.lb.totalCharge, s += o.lb.chargeCenter.x * o.lb.totalCharge, n += o.lb.chargeCenter.y * o.lb.totalCharge), o.lt !== null && (a += o.lt.totalMass, h += o.lt.totalCharge, s += o.lt.chargeCenter.x * o.lt.totalCharge, n += o.lt.chargeCenter.y * o.lt.totalCharge), o.rb !== null && (a += o.rb.totalMass, h += o.rb.totalCharge, s += o.rb.chargeCenter.x * o.rb.totalCharge, n += o.rb.chargeCenter.y * o.rb.totalCharge), o.rt !== null && (a += o.rt.totalMass, h += o.rt.totalCharge, s += o.rt.chargeCenter.x * o.rt.totalCharge, n += o.rt.chargeCenter.y * o.rt.totalCharge), o.totalMass = a, o.totalCharge = h, o.chargeCenter.x = s / h, o.chargeCenter.y = n / h;
3479
+ this.sortedParentNodes.reverse().forEach((s) => {
3480
+ let o = 0, n = 0, a = 0, h = 0;
3481
+ s.lb !== null && (a += s.lb.totalMass, h += s.lb.totalCharge, o += s.lb.chargeCenter.x * s.lb.totalCharge, n += s.lb.chargeCenter.y * s.lb.totalCharge), s.lt !== null && (a += s.lt.totalMass, h += s.lt.totalCharge, o += s.lt.chargeCenter.x * s.lt.totalCharge, n += s.lt.chargeCenter.y * s.lt.totalCharge), s.rb !== null && (a += s.rb.totalMass, h += s.rb.totalCharge, o += s.rb.chargeCenter.x * s.rb.totalCharge, n += s.rb.chargeCenter.y * s.rb.totalCharge), s.rt !== null && (a += s.rt.totalMass, h += s.rt.totalCharge, o += s.rt.chargeCenter.x * s.rt.totalCharge, n += s.rt.chargeCenter.y * s.rt.totalCharge), s.totalMass = a, s.totalCharge = h, s.chargeCenter.x = o / h, s.chargeCenter.y = n / h;
3438
3482
  });
3439
3483
  }
3440
3484
  getRoot() {
@@ -3446,14 +3490,14 @@ class Gt {
3446
3490
  processNode(e) {
3447
3491
  if (e.nodeIds.size < 2)
3448
3492
  return this.setLeaf(e), [];
3449
- const { centerX: t, centerY: o, radius: s } = e.box;
3450
- if (s < this.areaRadiusThreshold)
3493
+ const { centerX: t, centerY: s, radius: o } = e.box;
3494
+ if (o < this.areaRadiusThreshold)
3451
3495
  return this.setLeaf(e), [];
3452
3496
  this.sortedParentNodes.push(e);
3453
- const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = s / 2;
3497
+ const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = o / 2;
3454
3498
  e.nodeIds.forEach((u) => {
3455
3499
  const { x: w, y } = this.coords.get(u);
3456
- w < t ? y < o ? d.add(u) : h.add(u) : y < o ? a.add(u) : n.add(u), e.nodeIds.delete(u);
3500
+ w < t ? y < s ? d.add(u) : h.add(u) : y < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
3457
3501
  });
3458
3502
  const g = {
3459
3503
  parent: e,
@@ -3473,7 +3517,7 @@ class Gt {
3473
3517
  },
3474
3518
  box: {
3475
3519
  centerX: t + c,
3476
- centerY: o + c,
3520
+ centerY: s + c,
3477
3521
  radius: c
3478
3522
  },
3479
3523
  ...g
@@ -3491,7 +3535,7 @@ class Gt {
3491
3535
  },
3492
3536
  box: {
3493
3537
  centerX: t + c,
3494
- centerY: o - c,
3538
+ centerY: s - c,
3495
3539
  radius: c
3496
3540
  },
3497
3541
  ...g
@@ -3509,7 +3553,7 @@ class Gt {
3509
3553
  },
3510
3554
  box: {
3511
3555
  centerX: t - c,
3512
- centerY: o + c,
3556
+ centerY: s + c,
3513
3557
  radius: c
3514
3558
  },
3515
3559
  ...g
@@ -3527,7 +3571,7 @@ class Gt {
3527
3571
  },
3528
3572
  box: {
3529
3573
  centerX: t - c,
3530
- centerY: o - c,
3574
+ centerY: s - c,
3531
3575
  radius: c
3532
3576
  },
3533
3577
  ...g
@@ -3547,11 +3591,11 @@ class Gt {
3547
3591
  x: 0,
3548
3592
  y: 0
3549
3593
  };
3550
- let t = 0, o = 0;
3551
- return e.forEach((s) => {
3552
- const n = this.coords.get(s);
3553
- t += n.x, o += n.y;
3554
- }), { x: t / e.size, y: o / e.size };
3594
+ let t = 0, s = 0;
3595
+ return e.forEach((o) => {
3596
+ const n = this.coords.get(o);
3597
+ t += n.x, s += n.y;
3598
+ }), { x: t / e.size, y: s / e.size };
3555
3599
  }
3556
3600
  }
3557
3601
  class jt {
@@ -3566,8 +3610,8 @@ class jt {
3566
3610
  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;
3567
3611
  }
3568
3612
  apply(e, t) {
3569
- const o = Yt(e), s = new Gt({
3570
- box: o,
3613
+ const s = Yt(e), o = new Gt({
3614
+ box: s,
3571
3615
  coords: e,
3572
3616
  areaRadiusThreshold: this.areaRadiusThreshold,
3573
3617
  nodeMass: this.nodeMass,
@@ -3575,22 +3619,22 @@ class jt {
3575
3619
  });
3576
3620
  e.forEach((n, a) => {
3577
3621
  const h = this.calculateForceForNode(
3578
- s.getLeaf(a),
3622
+ o.getLeaf(a),
3579
3623
  a,
3580
3624
  e
3581
3625
  ), d = t.get(a);
3582
3626
  this.applyForce(d, h);
3583
3627
  });
3584
3628
  }
3585
- calculateForceForNode(e, t, o) {
3586
- const s = o.get(t), n = { x: 0, y: 0 };
3629
+ calculateForceForNode(e, t, s) {
3630
+ const o = s.get(t), n = { x: 0, y: 0 };
3587
3631
  e.nodeIds.forEach((h) => {
3588
3632
  if (h !== t) {
3589
- const d = o.get(h), c = this.calculateNodeRepulsiveForce({
3633
+ const d = s.get(h), c = this.calculateNodeRepulsiveForce({
3590
3634
  sourceCharge: this.nodeCharge,
3591
3635
  targetCharge: this.nodeCharge,
3592
3636
  sourceCoords: d,
3593
- targetCoords: s
3637
+ targetCoords: o
3594
3638
  });
3595
3639
  this.applyForce(n, c);
3596
3640
  }
@@ -3601,73 +3645,73 @@ class jt {
3601
3645
  if (h !== null) {
3602
3646
  const d = this.distanceVectorGenerator.create(
3603
3647
  h.chargeCenter,
3604
- s
3648
+ o
3605
3649
  );
3606
3650
  h.box.radius * 2 < d.d * this.theta ? (this.tryApplyFarForce({
3607
3651
  totalForce: n,
3608
- targetCoords: s,
3652
+ targetCoords: o,
3609
3653
  target: h.lb,
3610
3654
  current: a
3611
3655
  }), this.tryApplyFarForce({
3612
3656
  totalForce: n,
3613
- targetCoords: s,
3657
+ targetCoords: o,
3614
3658
  target: h.rb,
3615
3659
  current: a
3616
3660
  }), this.tryApplyFarForce({
3617
3661
  totalForce: n,
3618
- targetCoords: s,
3662
+ targetCoords: o,
3619
3663
  target: h.rt,
3620
3664
  current: a
3621
3665
  }), this.tryApplyFarForce({
3622
3666
  totalForce: n,
3623
- targetCoords: s,
3667
+ targetCoords: o,
3624
3668
  target: h.lt,
3625
3669
  current: a
3626
3670
  })) : (this.tryApplyNearForce({
3627
3671
  totalForce: n,
3628
- targetCoords: s,
3672
+ targetCoords: o,
3629
3673
  target: h.lb,
3630
3674
  current: a,
3631
- nodesCoords: o
3675
+ nodesCoords: s
3632
3676
  }), this.tryApplyNearForce({
3633
3677
  totalForce: n,
3634
- targetCoords: s,
3678
+ targetCoords: o,
3635
3679
  target: h.rb,
3636
3680
  current: a,
3637
- nodesCoords: o
3681
+ nodesCoords: s
3638
3682
  }), this.tryApplyNearForce({
3639
3683
  totalForce: n,
3640
- targetCoords: s,
3684
+ targetCoords: o,
3641
3685
  target: h.rt,
3642
3686
  current: a,
3643
- nodesCoords: o
3687
+ nodesCoords: s
3644
3688
  }), this.tryApplyNearForce({
3645
3689
  totalForce: n,
3646
- targetCoords: s,
3690
+ targetCoords: o,
3647
3691
  target: h.lt,
3648
3692
  current: a,
3649
- nodesCoords: o
3693
+ nodesCoords: s
3650
3694
  }));
3651
3695
  }
3652
3696
  a = a.parent;
3653
3697
  }
3654
3698
  return n;
3655
3699
  }
3656
- calculateExactForce(e, t, o) {
3657
- const s = { x: 0, y: 0 }, n = [e];
3700
+ calculateExactForce(e, t, s) {
3701
+ const o = { x: 0, y: 0 }, n = [e];
3658
3702
  for (; n.length > 0; ) {
3659
3703
  const a = n.pop();
3660
3704
  a.nodeIds.forEach((h) => {
3661
- const d = o.get(h), c = this.calculateNodeRepulsiveForce({
3705
+ const d = s.get(h), c = this.calculateNodeRepulsiveForce({
3662
3706
  sourceCharge: this.nodeCharge,
3663
3707
  targetCharge: this.nodeCharge,
3664
3708
  sourceCoords: d,
3665
3709
  targetCoords: t
3666
3710
  });
3667
- this.applyForce(s, c);
3711
+ this.applyForce(o, c);
3668
3712
  }), a.lb !== null && n.push(a.lb), a.rb !== null && n.push(a.rb), a.lt !== null && n.push(a.lt), a.rt !== null && n.push(a.rt);
3669
3713
  }
3670
- return s;
3714
+ return o;
3671
3715
  }
3672
3716
  calculateApproximateForce(e, t) {
3673
3717
  return this.calculateNodeRepulsiveForce({
@@ -3681,7 +3725,7 @@ class jt {
3681
3725
  const t = this.distanceVectorGenerator.create(
3682
3726
  e.sourceCoords,
3683
3727
  e.targetCoords
3684
- ), o = $e({
3728
+ ), s = $e({
3685
3729
  coefficient: this.nodeForceCoefficient,
3686
3730
  sourceCharge: e.sourceCharge,
3687
3731
  targetCharge: e.targetCharge,
@@ -3689,8 +3733,8 @@ class jt {
3689
3733
  maxForce: this.maxForce
3690
3734
  });
3691
3735
  return {
3692
- x: o * t.ex,
3693
- y: o * t.ey
3736
+ x: s * t.ex,
3737
+ y: s * t.ey
3694
3738
  };
3695
3739
  }
3696
3740
  applyForce(e, t) {
@@ -3738,17 +3782,17 @@ class Be {
3738
3782
  this.rand = e.rand, this.sparsity = e.sparsity;
3739
3783
  }
3740
3784
  calculateCoordinates(e, t) {
3741
- const o = /* @__PURE__ */ new Map(), s = e.getAllNodeIds(), n = Math.sqrt(s.length) * this.sparsity, { width: a, height: h } = t.getDimensions(), d = { x: a / 2, y: h / 2 }, c = t.createContentCoords(d), g = n / 2, l = {
3785
+ const s = /* @__PURE__ */ new Map(), o = e.getAllNodeIds(), n = Math.sqrt(o.length) * this.sparsity, { width: a, height: h } = t.getDimensions(), d = { x: a / 2, y: h / 2 }, c = t.createContentCoords(d), g = n / 2, l = {
3742
3786
  x: c.x - g,
3743
3787
  y: c.y - g
3744
3788
  };
3745
- return s.forEach((u) => {
3789
+ return o.forEach((u) => {
3746
3790
  const w = e.getNode(u);
3747
- o.set(u, {
3791
+ s.set(u, {
3748
3792
  x: w.x ?? l.x + n * this.rand(),
3749
3793
  y: w.y ?? l.y + n * this.rand()
3750
3794
  });
3751
- }), o;
3795
+ }), s;
3752
3796
  }
3753
3797
  }
3754
3798
  class qt {
@@ -3778,14 +3822,14 @@ class qt {
3778
3822
  });
3779
3823
  }
3780
3824
  calculateCoordinates(e, t) {
3781
- const o = this.fillerLayoutAlgorithm.calculateCoordinates(
3825
+ const s = this.fillerLayoutAlgorithm.calculateCoordinates(
3782
3826
  e,
3783
3827
  t
3784
3828
  );
3785
- for (let s = 0; s < this.maxIterations; s++) {
3829
+ for (let o = 0; o < this.maxIterations; o++) {
3786
3830
  const n = new Fe(
3787
3831
  e,
3788
- o,
3832
+ s,
3789
3833
  {
3790
3834
  distanceVectorGenerator: this.distanceVectorGenerator,
3791
3835
  nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
@@ -3798,7 +3842,7 @@ class qt {
3798
3842
  if (a < this.convergenceDelta || h < this.convergenceVelocity)
3799
3843
  break;
3800
3844
  }
3801
- return o;
3845
+ return s;
3802
3846
  }
3803
3847
  }
3804
3848
  class Kt {
@@ -3826,13 +3870,13 @@ class Kt {
3826
3870
  sparsity: e.edgeEquilibriumLength
3827
3871
  });
3828
3872
  }
3829
- calculateNextCoordinates(e, t, o) {
3830
- const s = this.fillerLayoutAlgorithm.calculateCoordinates(
3873
+ calculateNextCoordinates(e, t, s) {
3874
+ const o = this.fillerLayoutAlgorithm.calculateCoordinates(
3831
3875
  e,
3832
- o
3876
+ s
3833
3877
  ), n = new Fe(
3834
3878
  e,
3835
- s,
3879
+ o,
3836
3880
  {
3837
3881
  distanceVectorGenerator: this.distanceVectorGenerator,
3838
3882
  nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
@@ -3845,18 +3889,18 @@ class Kt {
3845
3889
  return (a < this.convergenceDelta || h < this.convergenceVelocity) && !e.getAllNodeIds().some((c) => {
3846
3890
  const g = e.getNode(c);
3847
3891
  return g.x === null || g.y === null;
3848
- }) ? /* @__PURE__ */ new Map() : s;
3892
+ }) ? /* @__PURE__ */ new Map() : o;
3849
3893
  }
3850
3894
  }
3851
3895
  const Oe = (r) => {
3852
- let e = 1779033703, t = 3144134277, o = 1013904242, s = 2773480762;
3896
+ let e = 1779033703, t = 3144134277, s = 1013904242, o = 2773480762;
3853
3897
  for (let n = 0, a; n < r.length; n++)
3854
- 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);
3855
- 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];
3856
- }, We = (r, e, t, o) => function() {
3857
- r |= 0, e |= 0, t |= 0, o |= 0;
3858
- const s = (r + e | 0) + o | 0;
3859
- 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;
3898
+ a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = s ^ Math.imul(t ^ a, 2869860233), s = o ^ Math.imul(s ^ a, 951274213), o = e ^ Math.imul(o ^ a, 2716044179);
3899
+ return e = Math.imul(s ^ e >>> 18, 597399067), t = Math.imul(o ^ t >>> 22, 2869860233), s = Math.imul(e ^ s >>> 17, 951274213), o = Math.imul(t ^ o >>> 19, 2716044179), e ^= t ^ s ^ o, t ^= e, s ^= e, o ^= e, [e >>> 0, t >>> 0, s >>> 0, o >>> 0];
3900
+ }, We = (r, e, t, s) => function() {
3901
+ r |= 0, e |= 0, t |= 0, s |= 0;
3902
+ const o = (r + e | 0) + s | 0;
3903
+ return s = s + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + o | 0, (o >>> 0) / 4294967296;
3860
3904
  }, v = Object.freeze({
3861
3905
  seed: "HTMLGraph is awesome",
3862
3906
  maxTimeDeltaSec: 0.01,
@@ -3874,26 +3918,26 @@ const Oe = (r) => {
3874
3918
  barnesHutAreaRadiusThreshold: 0.01,
3875
3919
  barnesHutTheta: 1
3876
3920
  }), Qt = (r) => {
3877
- var e, t, o;
3921
+ var e, t, s;
3878
3922
  switch ((e = r == null ? void 0 : r.algorithm) == null ? void 0 : e.type) {
3879
3923
  case "custom":
3880
3924
  return r.algorithm.instance;
3881
3925
  default: {
3882
- const s = r == null ? void 0 : r.algorithm, n = Oe((s == null ? void 0 : s.seed) ?? v.seed), a = We(n[0], n[1], n[2], n[3]);
3926
+ const o = r == null ? void 0 : r.algorithm, n = Oe((o == null ? void 0 : o.seed) ?? v.seed), a = We(n[0], n[1], n[2], n[3]);
3883
3927
  return new Kt({
3884
3928
  rand: a,
3885
- maxTimeDeltaSec: (s == null ? void 0 : s.maxTimeDeltaSec) ?? v.maxTimeDeltaSec,
3886
- nodeCharge: (s == null ? void 0 : s.nodeCharge) ?? v.nodeCharge,
3887
- nodeMass: (s == null ? void 0 : s.nodeMass) ?? v.nodeMass,
3888
- edgeEquilibriumLength: (s == null ? void 0 : s.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
3929
+ maxTimeDeltaSec: (o == null ? void 0 : o.maxTimeDeltaSec) ?? v.maxTimeDeltaSec,
3930
+ nodeCharge: (o == null ? void 0 : o.nodeCharge) ?? v.nodeCharge,
3931
+ nodeMass: (o == null ? void 0 : o.nodeMass) ?? v.nodeMass,
3932
+ edgeEquilibriumLength: (o == null ? void 0 : o.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
3889
3933
  effectiveDistance: v.effectiveDistance,
3890
- edgeStiffness: (s == null ? void 0 : s.edgeStiffness) ?? v.edgeStiffness,
3891
- convergenceDelta: (s == null ? void 0 : s.convergenceDelta) ?? v.convergenceDelta,
3892
- convergenceVelocity: (s == null ? void 0 : s.convergenceVelocity) ?? v.convergenceVelocity,
3893
- maxForce: (s == null ? void 0 : s.maxForce) ?? v.maxForce,
3894
- nodeForceCoefficient: (s == null ? void 0 : s.nodeForceCoefficient) ?? v.nodeForceCoefficient,
3895
- barnesHutTheta: ((t = s == null ? void 0 : s.barnesHut) == null ? void 0 : t.theta) ?? v.barnesHutTheta,
3896
- barnesHutAreaRadiusThreshold: ((o = s == null ? void 0 : s.barnesHut) == null ? void 0 : o.areaRadiusThreshold) ?? v.barnesHutAreaRadiusThreshold
3934
+ edgeStiffness: (o == null ? void 0 : o.edgeStiffness) ?? v.edgeStiffness,
3935
+ convergenceDelta: (o == null ? void 0 : o.convergenceDelta) ?? v.convergenceDelta,
3936
+ convergenceVelocity: (o == null ? void 0 : o.convergenceVelocity) ?? v.convergenceVelocity,
3937
+ maxForce: (o == null ? void 0 : o.maxForce) ?? v.maxForce,
3938
+ nodeForceCoefficient: (o == null ? void 0 : o.nodeForceCoefficient) ?? v.nodeForceCoefficient,
3939
+ barnesHutTheta: ((t = o == null ? void 0 : o.barnesHut) == null ? void 0 : t.theta) ?? v.barnesHutTheta,
3940
+ barnesHutAreaRadiusThreshold: ((s = o == null ? void 0 : o.barnesHut) == null ? void 0 : s.areaRadiusThreshold) ?? v.barnesHutAreaRadiusThreshold
3897
3941
  });
3898
3942
  }
3899
3943
  }
@@ -3912,11 +3956,11 @@ const Oe = (r) => {
3912
3956
  case "custom":
3913
3957
  return r.instance;
3914
3958
  default: {
3915
- const o = Oe((r == null ? void 0 : r.seed) ?? v.seed), s = We(o[0], o[1], o[2], o[3]);
3959
+ const s = Oe((r == null ? void 0 : r.seed) ?? v.seed), o = We(s[0], s[1], s[2], s[3]);
3916
3960
  return new qt({
3917
3961
  dtSec: (r == null ? void 0 : r.dtSec) ?? v.dtSec,
3918
3962
  maxIterations: (r == null ? void 0 : r.maxIterations) ?? v.maxIterations,
3919
- rand: s,
3963
+ rand: o,
3920
3964
  nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? v.nodeCharge,
3921
3965
  nodeMass: (r == null ? void 0 : r.nodeMass) ?? v.nodeMass,
3922
3966
  edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
@@ -3949,7 +3993,7 @@ const Oe = (r) => {
3949
3993
  e.clear();
3950
3994
  });
3951
3995
  };
3952
- class sr {
3996
+ class or {
3953
3997
  constructor(e) {
3954
3998
  i(this, "used", !1);
3955
3999
  i(this, "canvasDefaults", {});
@@ -4046,25 +4090,25 @@ class sr {
4046
4090
  if (this.used)
4047
4091
  throw new Ht("CanvasBuilder is a single use object");
4048
4092
  this.used = !0;
4049
- const e = new Dt(this.element), t = this.createHtmlView(e.main), o = Lt(this.canvasDefaults), s = new ve(
4093
+ const e = new Nt(this.element), t = this.createHtmlView(e.main), s = Lt(this.canvasDefaults), o = new ve(
4050
4094
  this.graph,
4051
4095
  this.viewport,
4052
4096
  this.graphStore,
4053
4097
  this.viewportStore,
4054
4098
  t,
4055
- o
4099
+ s
4056
4100
  );
4057
4101
  if (this.hasBackground && _.configure(
4058
- s,
4102
+ o,
4059
4103
  Bt(this.backgroundConfig),
4060
4104
  e.background
4061
- ), this.hasNodeResizeReactiveEdges && q.configure(s), this.hasDraggableNodes) {
4105
+ ), this.hasNodeResizeReactiveEdges && q.configure(o), this.hasDraggableNodes) {
4062
4106
  let a = Rt(this.dragConfig);
4063
4107
  this.hasAnimatedLayout && (a = er(
4064
4108
  a,
4065
4109
  this.animationStaticNodes
4066
4110
  )), Z.configure(
4067
- s,
4111
+ o,
4068
4112
  e.main,
4069
4113
  this.window,
4070
4114
  a
@@ -4073,11 +4117,11 @@ class sr {
4073
4117
  if (this.hasUserConnectablePorts) {
4074
4118
  const a = Ot(
4075
4119
  this.connectablePortsConfig,
4076
- o.edges.shapeFactory,
4077
- o.ports.direction
4120
+ s.edges.shapeFactory,
4121
+ s.ports.direction
4078
4122
  );
4079
4123
  ee.configure(
4080
- s,
4124
+ o,
4081
4125
  e.overlayConnectablePorts,
4082
4126
  this.viewportStore,
4083
4127
  this.window,
@@ -4087,10 +4131,10 @@ class sr {
4087
4131
  if (this.hasUserDraggableEdges) {
4088
4132
  const a = Wt(
4089
4133
  this.draggableEdgesConfig,
4090
- s.graph
4134
+ o.graph
4091
4135
  );
4092
4136
  te.configure(
4093
- s,
4137
+ o,
4094
4138
  e.overlayDraggableEdges,
4095
4139
  this.viewportStore,
4096
4140
  this.window,
@@ -4098,33 +4142,33 @@ class sr {
4098
4142
  );
4099
4143
  }
4100
4144
  this.virtualScrollConfig !== void 0 ? J.configure(
4101
- s,
4145
+ o,
4102
4146
  e.main,
4103
4147
  this.window,
4104
4148
  ye(this.transformConfig),
4105
4149
  this.boxRenderingTrigger,
4106
4150
  kt(this.virtualScrollConfig)
4107
4151
  ) : this.hasTransformableViewport && H.configure(
4108
- s,
4152
+ o,
4109
4153
  e.main,
4110
4154
  this.window,
4111
4155
  ye(this.transformConfig)
4112
4156
  ), this.hasLayout && Pt.configure(
4113
- s,
4157
+ o,
4114
4158
  _t(this.layoutConfig)
4115
4159
  ), this.hasAnimatedLayout && (tr(
4116
- s.graph,
4160
+ o.graph,
4117
4161
  this.animationStaticNodes
4118
- ), oe.configure(
4119
- s,
4162
+ ), se.configure(
4163
+ o,
4120
4164
  Qt(this.animatedLayoutConfig),
4121
4165
  this.animationStaticNodes,
4122
4166
  this.window
4123
4167
  ));
4124
4168
  const n = () => {
4125
- e.destroy(), s.onBeforeDestroy.unsubscribe(n);
4169
+ e.destroy(), o.onBeforeDestroy.unsubscribe(n);
4126
4170
  };
4127
- return s.onBeforeDestroy.subscribe(n), s;
4171
+ return o.onBeforeDestroy.subscribe(n), o;
4128
4172
  }
4129
4173
  createHtmlView(e) {
4130
4174
  let t = new me(
@@ -4142,16 +4186,16 @@ class sr {
4142
4186
  }
4143
4187
  export {
4144
4188
  ut as BezierEdgeShape,
4145
- sr as CanvasBuilder,
4189
+ or as CanvasBuilder,
4146
4190
  Ht as CanvasBuilderError,
4147
4191
  b as CanvasError,
4148
4192
  M as ConnectionCategory,
4149
- Ne as DirectEdgeShape,
4193
+ De as DirectEdgeShape,
4150
4194
  j as EventSubject,
4151
4195
  pt as HorizontalEdgeShape,
4152
4196
  vt as InteractiveEdgeError,
4153
4197
  Me as InteractiveEdgeShape,
4154
- or as MidpointEdgeShape,
4198
+ sr as MidpointEdgeShape,
4155
4199
  wt as StraightEdgeShape,
4156
4200
  ft as VerticalEdgeShape
4157
4201
  };