@html-graph/html-graph 8.1.0 → 8.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,23 @@
1
- var ke = Object.defineProperty;
2
- var ze = (r, e, t) => e in r ? ke(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var i = (r, e, t) => ze(r, typeof e != "symbol" ? e + "" : e, t);
1
+ var He = Object.defineProperty;
2
+ var Xe = (r, e, t) => e in r ? He(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var o = (r, e, t) => Xe(r, typeof e != "symbol" ? e + "" : e, t);
4
4
  var M = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(M || {});
5
- const He = () => {
5
+ const Ye = () => {
6
6
  const r = document.createElement("div");
7
7
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
8
- }, Xe = () => {
8
+ }, Ge = () => {
9
9
  const r = document.createElement("div");
10
10
  return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
11
- }, Ye = (r) => {
11
+ }, je = (r) => {
12
12
  r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
13
13
  };
14
- class me {
14
+ class Ae {
15
15
  constructor(e, t, s) {
16
- i(this, "host", He());
17
- i(this, "container", Xe());
18
- i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
19
- i(this, "attachedNodeIds", /* @__PURE__ */ new Set());
20
- i(this, "applyTransform", () => {
16
+ o(this, "host", Ye());
17
+ o(this, "container", Ge());
18
+ o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
19
+ o(this, "attachedNodeIds", /* @__PURE__ */ new Set());
20
+ o(this, "applyTransform", () => {
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
  });
@@ -25,7 +25,7 @@ class me {
25
25
  }
26
26
  attachNode(e) {
27
27
  const t = this.graphStore.getNode(e);
28
- Ye(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
28
+ je(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
29
29
  }
30
30
  detachNode(e) {
31
31
  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: 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;
53
+ const t = this.graphStore.getNode(e), { width: s, height: i } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(s, i), 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,24 +60,24 @@ class me {
60
60
  updateEdgeShape(e) {
61
61
  const t = this.edgeIdToElementMap.get(e);
62
62
  this.container.removeChild(t);
63
- const o = this.graphStore.getEdge(e).payload.shape.svg;
64
- this.edgeIdToElementMap.set(e, o), this.container.appendChild(o);
63
+ const i = this.graphStore.getEdge(e).payload.shape.svg;
64
+ this.edgeIdToElementMap.set(e, i), this.container.appendChild(i);
65
65
  }
66
66
  renderEdge(e) {
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(
67
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), i = this.graphStore.getPort(t.to), n = s.element.getBoundingClientRect(), a = i.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix().scale, c = this.createEdgeRenderPort(
68
68
  s,
69
69
  n,
70
70
  h,
71
71
  d
72
- ), g = this.createEdgeRenderPort(o, a, h, d);
72
+ ), g = this.createEdgeRenderPort(i, a, h, d);
73
73
  let l = M.Line;
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 });
74
+ s.element === i.element ? l = M.PortCycle : s.nodeId === i.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, s, o) {
80
+ createEdgeRenderPort(e, t, s, i) {
81
81
  const n = this.viewportStore.createContentCoords({
82
82
  x: t.left - s.left,
83
83
  y: t.top - s.top
@@ -85,57 +85,57 @@ class me {
85
85
  return {
86
86
  x: n.x,
87
87
  y: n.y,
88
- width: t.width * o,
89
- height: t.height * o,
88
+ width: t.width * i,
89
+ height: t.height * i,
90
90
  direction: e.payload.direction
91
91
  };
92
92
  }
93
93
  }
94
- class Ge {
94
+ class Ke {
95
95
  constructor(e) {
96
- i(this, "xFrom", 1 / 0);
97
- i(this, "yFrom", 1 / 0);
98
- i(this, "xTo", 1 / 0);
99
- i(this, "yTo", 1 / 0);
96
+ o(this, "xFrom", 1 / 0);
97
+ o(this, "yFrom", 1 / 0);
98
+ o(this, "xTo", 1 / 0);
99
+ o(this, "yTo", 1 / 0);
100
100
  this.graphStore = e;
101
101
  }
102
102
  setRenderingBox(e) {
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: s, y: o } = t;
107
- return s >= this.xFrom && s <= this.xTo && o >= this.yFrom && o <= this.yTo;
106
+ const t = this.graphStore.getNode(e).payload, { x: s, y: i } = t;
107
+ return s >= this.xFrom && s <= this.xTo && i >= this.yFrom && i <= this.yTo;
108
108
  }
109
109
  hasEdge(e) {
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);
110
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, i = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(s).payload, a = this.graphStore.getNode(i).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
- class je {
115
- constructor(e, t, s, o) {
116
- i(this, "attachedNodes", /* @__PURE__ */ new Set());
117
- i(this, "attachedEdges", /* @__PURE__ */ new Set());
118
- i(this, "renderingBox");
119
- i(this, "updateViewport", (e) => {
114
+ class Qe {
115
+ constructor(e, t, s, i) {
116
+ o(this, "attachedNodes", /* @__PURE__ */ new Set());
117
+ o(this, "attachedEdges", /* @__PURE__ */ new Set());
118
+ o(this, "renderingBox");
119
+ o(this, "updateViewport", (e) => {
120
120
  this.renderingBox.setRenderingBox(e);
121
- const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
121
+ const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__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
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), s.delete(g)), this.renderingBox.hasNode(l) || (t.add(l), s.delete(l))), h && !d ? o.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 ? i.add(a) : !h && d && n.add(a);
128
128
  }), n.forEach((a) => {
129
129
  this.handleDetachEdge(a);
130
130
  }), s.forEach((a) => {
131
131
  this.handleDetachNode(a);
132
132
  }), t.forEach((a) => {
133
133
  this.attachedNodes.has(a) || this.handleAttachNode(a);
134
- }), o.forEach((a) => {
134
+ }), i.forEach((a) => {
135
135
  this.handleAttachEdge(a);
136
136
  });
137
137
  });
138
- this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = o, this.renderingBox = new Ge(this.graphStore), this.trigger.subscribe(this.updateViewport);
138
+ this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = i, this.renderingBox = new Ke(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), 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);
176
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, i = this.graphStore.getPort(t.to).nodeId;
177
+ this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(i) || this.handleAttachNode(i), this.handleAttachEdge(e);
178
178
  }
179
179
  handleAttachNode(e) {
180
180
  this.params.onBeforeNodeAttached(e), this.attachedNodes.add(e), this.htmlView.attachNode(e);
@@ -189,10 +189,10 @@ class je {
189
189
  this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
190
190
  }
191
191
  }
192
- class qe {
192
+ class Ze {
193
193
  constructor(e, t) {
194
- i(this, "deferredNodes", /* @__PURE__ */ new Set());
195
- i(this, "deferredEdges", /* @__PURE__ */ new Set());
194
+ o(this, "deferredNodes", /* @__PURE__ */ new Set());
195
+ o(this, "deferredEdges", /* @__PURE__ */ new Set());
196
196
  this.htmlView = e, this.graphStore = t;
197
197
  }
198
198
  attachNode(e) {
@@ -236,16 +236,16 @@ 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), s = this.graphStore.getPort(t.from), o = this.graphStore.getPort(t.to);
240
- return !(this.deferredNodes.has(s.nodeId) || this.deferredNodes.has(o.nodeId));
239
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), i = this.graphStore.getPort(t.to);
240
+ return !(this.deferredNodes.has(s.nodeId) || this.deferredNodes.has(i.nodeId));
241
241
  }
242
242
  tryAttachEdge(e) {
243
243
  this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
244
244
  }
245
245
  }
246
- class j {
246
+ class Q {
247
247
  constructor() {
248
- i(this, "callbacks", /* @__PURE__ */ new Set());
248
+ o(this, "callbacks", /* @__PURE__ */ new Set());
249
249
  }
250
250
  subscribe(e) {
251
251
  this.callbacks.add(e);
@@ -260,12 +260,12 @@ class j {
260
260
  }
261
261
  }
262
262
  const x = () => {
263
- const r = new j();
263
+ const r = new Q();
264
264
  return [r, r];
265
265
  };
266
266
  class X {
267
267
  constructor(e) {
268
- i(this, "counter", 0);
268
+ o(this, "counter", 0);
269
269
  this.checkExists = e;
270
270
  }
271
271
  create(e) {
@@ -279,74 +279,68 @@ class X {
279
279
  this.counter = 0;
280
280
  }
281
281
  }
282
- class A extends Error {
283
- constructor() {
284
- super(...arguments);
285
- i(this, "name", "CanvasError");
286
- }
287
- }
288
- class ve {
289
- constructor(e, t, s, o, n, a) {
290
- i(this, "nodeIdGenerator", new X(
282
+ class Ee {
283
+ constructor(e, t, s, i, n, a) {
284
+ o(this, "nodeIdGenerator", new X(
291
285
  (e) => this.graphStore.hasNode(e)
292
286
  ));
293
- i(this, "portIdGenerator", new X(
287
+ o(this, "portIdGenerator", new X(
294
288
  (e) => this.graphStore.hasPort(e)
295
289
  ));
296
- i(this, "edgeIdGenerator", new X(
290
+ o(this, "edgeIdGenerator", new X(
297
291
  (e) => this.graphStore.hasEdge(e)
298
292
  ));
299
- i(this, "onAfterNodeAdded", (e) => {
293
+ o(this, "onAfterNodeAdded", (e) => {
300
294
  this.htmlView.attachNode(e);
301
295
  });
302
- i(this, "onAfterNodeUpdated", (e) => {
296
+ o(this, "onAfterNodeUpdated", (e) => {
303
297
  this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((t) => {
304
298
  this.htmlView.renderEdge(t);
305
299
  });
306
300
  });
307
- i(this, "onAfterNodePriorityUpdated", (e) => {
301
+ o(this, "onAfterNodePriorityUpdated", (e) => {
308
302
  this.htmlView.updateNodePriority(e);
309
303
  });
310
- i(this, "onBeforeNodeRemoved", (e) => {
304
+ o(this, "onBeforeNodeRemoved", (e) => {
311
305
  this.graphStore.getNodePortIds(e).forEach((t) => {
312
306
  this.unmarkPort(t);
313
307
  }), this.htmlView.detachNode(e);
314
308
  });
315
- i(this, "onAfterPortUpdated", (e) => {
309
+ o(this, "onAfterPortUpdated", (e) => {
316
310
  this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
317
311
  this.htmlView.renderEdge(t);
318
312
  });
319
313
  });
320
- i(this, "onBeforePortUnmarked", (e) => {
314
+ o(this, "onBeforePortUnmarked", (e) => {
321
315
  this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
322
316
  this.removeEdge(t);
323
317
  });
324
318
  });
325
- i(this, "onAfterEdgeAdded", (e) => {
319
+ o(this, "onAfterEdgeAdded", (e) => {
326
320
  this.htmlView.attachEdge(e);
327
321
  });
328
- i(this, "onAfterEdgeShapeUpdated", (e) => {
322
+ o(this, "onAfterEdgeShapeUpdated", (e) => {
329
323
  this.htmlView.updateEdgeShape(e);
330
324
  });
331
- i(this, "onAfterEdgeUpdated", (e) => {
325
+ o(this, "onAfterEdgeUpdated", (e) => {
332
326
  this.htmlView.renderEdge(e);
333
327
  });
334
- i(this, "onAfterEdgePriorityUpdated", (e) => {
328
+ o(this, "onAfterEdgePriorityUpdated", (e) => {
335
329
  this.htmlView.updateEdgePriority(e);
336
330
  });
337
- i(this, "onBeforeEdgeRemoved", (e) => {
331
+ o(this, "onBeforeEdgeRemoved", (e) => {
338
332
  this.htmlView.detachEdge(e);
339
333
  });
340
- i(this, "onBeforeClear", () => {
334
+ o(this, "onBeforeClear", () => {
341
335
  this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
342
336
  });
343
- i(this, "onBeforeDestroyEmitter");
344
- i(this, "destroyed", !1);
337
+ o(this, "onBeforeDestroyEmitter");
338
+ o(this, "destroyed", !1);
345
339
  /**
346
340
  * emits event just before destruction of canvas
347
341
  */
348
- i(this, "onBeforeDestroy");
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(
342
+ o(this, "onBeforeDestroy");
343
+ this.graph = e, this.viewport = t, this.graphStore = s, this.viewportStore = i, this.htmlView = n, this.params = a, this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
350
344
  this.onAfterNodePriorityUpdated
351
345
  ), 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
346
  this.onAfterEdgeShapeUpdated
@@ -359,12 +353,6 @@ class ve {
359
353
  */
360
354
  addNode(e) {
361
355
  const t = this.nodeIdGenerator.create(e.id);
362
- if (this.graphStore.hasNode(t))
363
- throw new A("failed to add node with existing id");
364
- if (this.graphStore.findNodeIdByElement(e.element) !== void 0)
365
- throw new A(
366
- "failed to add node with html element already in use by another node"
367
- );
368
356
  if (this.graphStore.addNode({
369
357
  id: t,
370
358
  element: e.element,
@@ -386,8 +374,6 @@ class ve {
386
374
  * updates node parameters
387
375
  */
388
376
  updateNode(e, t) {
389
- if (!this.graphStore.hasNode(e))
390
- throw new A("failed to update nonexistent node");
391
377
  return this.graphStore.updateNode(e, t ?? {}), this;
392
378
  }
393
379
  /**
@@ -396,8 +382,6 @@ class ve {
396
382
  * all the edges adjacent to node get removed
397
383
  */
398
384
  removeNode(e) {
399
- if (!this.graphStore.hasNode(e))
400
- throw new A("failed to remove nonexistent node");
401
385
  return this.graphStore.removeNode(e), this;
402
386
  }
403
387
  /**
@@ -405,10 +389,6 @@ class ve {
405
389
  */
406
390
  markPort(e) {
407
391
  const t = this.portIdGenerator.create(e.id);
408
- if (this.graphStore.hasPort(t))
409
- throw new A("failed to add port with existing id");
410
- if (!this.graphStore.hasNode(e.nodeId))
411
- throw new A("failed to mark port for nonexistent node");
412
392
  return this.graphStore.addPort({
413
393
  id: t,
414
394
  element: e.element,
@@ -420,8 +400,6 @@ class ve {
420
400
  * updates port and edges attached to it
421
401
  */
422
402
  updatePort(e, t) {
423
- if (!this.graphStore.hasPort(e))
424
- throw new A("failed to update nonexistent port");
425
403
  return this.graphStore.updatePort(e, t ?? {}), this;
426
404
  }
427
405
  /**
@@ -429,8 +407,6 @@ class ve {
429
407
  * all the edges adjacent to the port get removed
430
408
  */
431
409
  unmarkPort(e) {
432
- if (!this.graphStore.hasPort(e))
433
- throw new A("failed to unmark nonexistent port");
434
410
  return this.graphStore.removePort(e), this;
435
411
  }
436
412
  /**
@@ -438,12 +414,6 @@ class ve {
438
414
  */
439
415
  addEdge(e) {
440
416
  const t = this.edgeIdGenerator.create(e.id);
441
- if (this.graphStore.hasEdge(t))
442
- throw new A("failed to add edge with existing id");
443
- if (!this.graphStore.hasPort(e.from))
444
- throw new A("failed to add edge from nonexistent port");
445
- if (!this.graphStore.hasPort(e.to))
446
- throw new A("failed to add edge to nonexistent port");
447
417
  return this.graphStore.addEdge({
448
418
  id: t,
449
419
  from: e.from,
@@ -456,16 +426,12 @@ class ve {
456
426
  * updates specified edge
457
427
  */
458
428
  updateEdge(e, t) {
459
- if (!this.graphStore.hasEdge(e))
460
- throw new A("failed to update nonexistent edge");
461
429
  return this.graphStore.updateEdge(e, t ?? {}), this;
462
430
  }
463
431
  /**
464
432
  * removes specified edge
465
433
  */
466
434
  removeEdge(e) {
467
- if (!this.graphStore.hasEdge(e))
468
- throw new A("failed to remove nonexistent edge");
469
435
  return this.graphStore.removeEdge(e), this;
470
436
  }
471
437
  /**
@@ -501,10 +467,10 @@ class ve {
501
467
  ), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.viewportStore.destroy(), this.destroyed = !0);
502
468
  }
503
469
  }
504
- class Ke {
470
+ class qe {
505
471
  constructor() {
506
- i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
507
- i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
472
+ o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
473
+ o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
508
474
  }
509
475
  addRecord(e, t) {
510
476
  const s = this.singleToMultiMap.get(e);
@@ -541,42 +507,48 @@ class Ke {
541
507
  return this.multiToSingleMap.get(e) !== void 0;
542
508
  }
543
509
  }
544
- class Ae {
510
+ class A extends Error {
511
+ constructor() {
512
+ super(...arguments);
513
+ o(this, "name", "CanvasError");
514
+ }
515
+ }
516
+ class xe {
545
517
  constructor() {
546
- i(this, "nodes", /* @__PURE__ */ new Map());
547
- i(this, "ports", /* @__PURE__ */ new Map());
548
- i(this, "edges", /* @__PURE__ */ new Map());
549
- i(this, "nodesElementsMap", /* @__PURE__ */ new Map());
550
- i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
551
- i(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
552
- i(this, "portCycleEdges", /* @__PURE__ */ new Map());
553
- i(this, "elementPorts", new Ke());
554
- i(this, "afterNodeAddedEmitter");
555
- i(this, "onAfterNodeAdded");
556
- i(this, "afterNodeUpdatedEmitter");
557
- i(this, "onAfterNodeUpdated");
558
- i(this, "afterNodePriorityUpdatedEmitter");
559
- i(this, "onAfterNodePriorityUpdated");
560
- i(this, "beforeNodeRemovedEmitter");
561
- i(this, "onBeforeNodeRemoved");
562
- i(this, "afterPortAddedEmitter");
563
- i(this, "onAfterPortAdded");
564
- i(this, "afterPortUpdatedEmitter");
565
- i(this, "onAfterPortUpdated");
566
- i(this, "beforePortRemovedEmitter");
567
- i(this, "onBeforePortRemoved");
568
- i(this, "afterEdgeAddedEmitter");
569
- i(this, "onAfterEdgeAdded");
570
- i(this, "afterEdgeShapeUpdatedEmitter");
571
- i(this, "onAfterEdgeShapeUpdated");
572
- i(this, "afterEdgeUpdatedEmitter");
573
- i(this, "onAfterEdgeUpdated");
574
- i(this, "afterEdgePriorityUpdatedEmitter");
575
- i(this, "onAfterEdgePriorityUpdated");
576
- i(this, "beforeEdgeRemovedEmitter");
577
- i(this, "onBeforeEdgeRemoved");
578
- i(this, "beforeClearEmitter");
579
- i(this, "onBeforeClear");
518
+ o(this, "nodes", /* @__PURE__ */ new Map());
519
+ o(this, "ports", /* @__PURE__ */ new Map());
520
+ o(this, "edges", /* @__PURE__ */ new Map());
521
+ o(this, "nodesElementsMap", /* @__PURE__ */ new Map());
522
+ o(this, "portIncomingEdges", /* @__PURE__ */ new Map());
523
+ o(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
524
+ o(this, "portCycleEdges", /* @__PURE__ */ new Map());
525
+ o(this, "elementPorts", new qe());
526
+ o(this, "afterNodeAddedEmitter");
527
+ o(this, "onAfterNodeAdded");
528
+ o(this, "afterNodeUpdatedEmitter");
529
+ o(this, "onAfterNodeUpdated");
530
+ o(this, "afterNodePriorityUpdatedEmitter");
531
+ o(this, "onAfterNodePriorityUpdated");
532
+ o(this, "beforeNodeRemovedEmitter");
533
+ o(this, "onBeforeNodeRemoved");
534
+ o(this, "afterPortAddedEmitter");
535
+ o(this, "onAfterPortAdded");
536
+ o(this, "afterPortUpdatedEmitter");
537
+ o(this, "onAfterPortUpdated");
538
+ o(this, "beforePortRemovedEmitter");
539
+ o(this, "onBeforePortRemoved");
540
+ o(this, "afterEdgeAddedEmitter");
541
+ o(this, "onAfterEdgeAdded");
542
+ o(this, "afterEdgeShapeUpdatedEmitter");
543
+ o(this, "onAfterEdgeShapeUpdated");
544
+ o(this, "afterEdgeUpdatedEmitter");
545
+ o(this, "onAfterEdgeUpdated");
546
+ o(this, "afterEdgePriorityUpdatedEmitter");
547
+ o(this, "onAfterEdgePriorityUpdated");
548
+ o(this, "beforeEdgeRemovedEmitter");
549
+ o(this, "onBeforeEdgeRemoved");
550
+ o(this, "beforeClearEmitter");
551
+ o(this, "onBeforeClear");
580
552
  [this.afterNodeAddedEmitter, this.onAfterNodeAdded] = x(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = x(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = x(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = x(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = x(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = x(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = x(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = x(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = x(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = x(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = x(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = x(), [this.beforeClearEmitter, this.onBeforeClear] = x();
581
553
  }
582
554
  hasNode(e) {
@@ -589,6 +561,12 @@ class Ae {
589
561
  return t;
590
562
  }
591
563
  addNode(e) {
564
+ if (this.hasNode(e.id))
565
+ throw new A("failed to add node with existing id");
566
+ if (this.findNodeIdByElement(e.element) !== void 0)
567
+ throw new A(
568
+ "failed to add node with html element already in use by another node"
569
+ );
592
570
  const t = /* @__PURE__ */ new Map(), s = {
593
571
  element: e.element,
594
572
  payload: {
@@ -608,10 +586,14 @@ class Ae {
608
586
  return this.nodesElementsMap.get(e);
609
587
  }
610
588
  updateNode(e, t) {
589
+ if (!this.hasNode(e))
590
+ throw new A("failed to update nonexistent node");
611
591
  const { payload: s } = this.nodes.get(e);
612
592
  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);
613
593
  }
614
594
  removeNode(e) {
595
+ if (!this.hasNode(e))
596
+ throw new A("failed to remove nonexistent node");
615
597
  this.beforeNodeRemovedEmitter.emit(e);
616
598
  const t = this.nodes.get(e);
617
599
  this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
@@ -626,6 +608,10 @@ class Ae {
626
608
  return t;
627
609
  }
628
610
  addPort(e) {
611
+ if (this.hasPort(e.id))
612
+ throw new A("failed to add port with existing id");
613
+ if (!this.hasNode(e.nodeId))
614
+ throw new A("failed to add port to nonexistent node");
629
615
  this.ports.set(e.id, {
630
616
  element: e.element,
631
617
  payload: {
@@ -635,6 +621,8 @@ class Ae {
635
621
  }), 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);
636
622
  }
637
623
  updatePort(e, t) {
624
+ if (!this.hasPort(e))
625
+ throw new A("failed to update nonexistent port");
638
626
  const s = this.ports.get(e).payload;
639
627
  s.direction = t.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(e);
640
628
  }
@@ -651,6 +639,8 @@ class Ae {
651
639
  return Array.from(t.ports.keys());
652
640
  }
653
641
  removePort(e) {
642
+ if (!this.hasPort(e))
643
+ throw new A("failed to remove nonexistent port");
654
644
  const t = this.ports.get(e).nodeId;
655
645
  this.beforePortRemovedEmitter.emit(e), this.nodes.get(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
656
646
  }
@@ -664,15 +654,23 @@ class Ae {
664
654
  return t;
665
655
  }
666
656
  addEdge(e) {
657
+ if (this.hasEdge(e.id))
658
+ throw new A("failed to add edge with existing id");
659
+ if (!this.hasPort(e.from))
660
+ throw new A("failed to add edge from nonexistent port");
661
+ if (!this.hasPort(e.to))
662
+ throw new A("failed to add edge to nonexistent port");
667
663
  this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
668
664
  }
669
665
  updateEdge(e, t) {
666
+ if (!this.hasEdge(e))
667
+ throw new A("failed to update nonexistent edge");
670
668
  if (t.from !== void 0 || t.to !== void 0) {
671
- const o = this.edges.get(e), n = o.payload;
669
+ const i = this.edges.get(e), n = i.payload;
672
670
  this.removeEdgeInternal(e), this.addEdgeInternal({
673
671
  id: e,
674
- from: t.from ?? o.from,
675
- to: t.to ?? o.to,
672
+ from: t.from ?? i.from,
673
+ to: t.to ?? i.to,
676
674
  shape: n.shape,
677
675
  priority: n.priority
678
676
  });
@@ -684,6 +682,8 @@ class Ae {
684
682
  return Array.from(this.edges.keys());
685
683
  }
686
684
  removeEdge(e) {
685
+ if (!this.hasEdge(e))
686
+ throw new A("failed to remove nonexistent edge");
687
687
  this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
688
688
  }
689
689
  clear() {
@@ -716,8 +716,8 @@ class Ae {
716
716
  }
717
717
  getNodeIncomingEdgeIds(e) {
718
718
  const t = Array.from(this.getNode(e).ports.keys()), s = [];
719
- return t.forEach((o) => {
720
- this.getPortIncomingEdgeIds(o).filter((n) => {
719
+ return t.forEach((i) => {
720
+ this.getPortIncomingEdgeIds(i).filter((n) => {
721
721
  const a = this.getEdge(n);
722
722
  return this.getPort(a.from).nodeId !== e;
723
723
  }).forEach((n) => {
@@ -727,8 +727,8 @@ class Ae {
727
727
  }
728
728
  getNodeOutgoingEdgeIds(e) {
729
729
  const t = Array.from(this.getNode(e).ports.keys()), s = [];
730
- return t.forEach((o) => {
731
- this.getPortOutgoingEdgeIds(o).filter((n) => {
730
+ return t.forEach((i) => {
731
+ this.getPortOutgoingEdgeIds(i).filter((n) => {
732
732
  const a = this.getEdge(n);
733
733
  return this.getPort(a.to).nodeId !== e;
734
734
  }).forEach((n) => {
@@ -738,10 +738,10 @@ class Ae {
738
738
  }
739
739
  getNodeCycleEdgeIds(e) {
740
740
  const t = Array.from(this.getNode(e).ports.keys()), s = [];
741
- return t.forEach((o) => {
742
- this.getPortCycleEdgeIds(o).forEach((n) => {
741
+ return t.forEach((i) => {
742
+ this.getPortCycleEdgeIds(i).forEach((n) => {
743
743
  s.push(n);
744
- }), this.getPortIncomingEdgeIds(o).filter((n) => {
744
+ }), this.getPortIncomingEdgeIds(i).filter((n) => {
745
745
  const a = this.getEdge(n);
746
746
  return this.getPort(a.to).nodeId === e;
747
747
  }).forEach((n) => {
@@ -751,12 +751,12 @@ class Ae {
751
751
  }
752
752
  getNodeAdjacentEdgeIds(e) {
753
753
  const t = Array.from(this.getNode(e).ports.keys()), s = [];
754
- return t.forEach((o) => {
755
- this.getPortIncomingEdgeIds(o).forEach((n) => {
754
+ return t.forEach((i) => {
755
+ this.getPortIncomingEdgeIds(i).forEach((n) => {
756
756
  s.push(n);
757
- }), this.getPortOutgoingEdgeIds(o).forEach((n) => {
757
+ }), this.getPortOutgoingEdgeIds(i).forEach((n) => {
758
758
  s.push(n);
759
- }), this.getPortCycleEdgeIds(o).forEach((n) => {
759
+ }), this.getPortCycleEdgeIds(i).forEach((n) => {
760
760
  s.push(n);
761
761
  });
762
762
  }), s;
@@ -772,33 +772,33 @@ class Ae {
772
772
  }), 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);
773
773
  }
774
774
  removeEdgeInternal(e) {
775
- const t = this.edges.get(e), s = t.from, o = t.to;
776
- 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);
775
+ const t = this.edges.get(e), s = t.from, i = t.to;
776
+ this.portCycleEdges.get(s).delete(e), this.portCycleEdges.get(i).delete(e), this.portIncomingEdges.get(s).delete(e), this.portIncomingEdges.get(i).delete(e), this.portOutcomingEdges.get(s).delete(e), this.portOutcomingEdges.get(i).delete(e), this.edges.delete(e);
777
777
  }
778
778
  }
779
- const de = (r) => ({
779
+ const le = (r) => ({
780
780
  scale: 1 / r.scale,
781
781
  x: -r.x / r.scale,
782
782
  y: -r.y / r.scale
783
- }), ce = {
783
+ }), ge = {
784
784
  scale: 1,
785
785
  x: 0,
786
786
  y: 0
787
- }, le = (r, e) => ({
787
+ }, ue = (r, e) => ({
788
788
  x: r.scale * e.x + r.x,
789
789
  y: r.scale * e.y + r.y
790
790
  });
791
- class Qe {
791
+ class Je {
792
792
  constructor(e) {
793
- i(this, "viewportMatrix", ce);
794
- i(this, "contentMatrix", ce);
795
- i(this, "beforeUpdateEmitter");
796
- i(this, "onBeforeUpdated");
797
- i(this, "afterUpdateEmitter");
798
- i(this, "onAfterUpdated");
799
- i(this, "afterResizeEmitter");
800
- i(this, "onAfterResize");
801
- i(this, "observer", new ResizeObserver(() => {
793
+ o(this, "viewportMatrix", ge);
794
+ o(this, "contentMatrix", ge);
795
+ o(this, "beforeUpdateEmitter");
796
+ o(this, "onBeforeUpdated");
797
+ o(this, "afterUpdateEmitter");
798
+ o(this, "onAfterUpdated");
799
+ o(this, "afterResizeEmitter");
800
+ o(this, "onAfterResize");
801
+ o(this, "observer", new ResizeObserver(() => {
802
802
  this.afterResizeEmitter.emit();
803
803
  }));
804
804
  this.host = e, [this.afterUpdateEmitter, this.onAfterUpdated] = x(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = x(), [this.afterResizeEmitter, this.onAfterResize] = x(), this.observer.observe(this.host);
@@ -814,65 +814,65 @@ class Qe {
814
814
  scale: e.scale ?? this.viewportMatrix.scale,
815
815
  x: e.x ?? this.viewportMatrix.x,
816
816
  y: e.y ?? this.viewportMatrix.y
817
- }, this.beforeUpdateEmitter.emit(), this.contentMatrix = de(this.viewportMatrix), this.afterUpdateEmitter.emit();
817
+ }, this.beforeUpdateEmitter.emit(), this.contentMatrix = le(this.viewportMatrix), this.afterUpdateEmitter.emit();
818
818
  }
819
819
  patchContentMatrix(e) {
820
820
  this.contentMatrix = {
821
821
  scale: e.scale ?? this.contentMatrix.scale,
822
822
  x: e.x ?? this.contentMatrix.x,
823
823
  y: e.y ?? this.contentMatrix.y
824
- }, this.beforeUpdateEmitter.emit(), this.viewportMatrix = de(this.contentMatrix), this.afterUpdateEmitter.emit();
824
+ }, this.beforeUpdateEmitter.emit(), this.viewportMatrix = le(this.contentMatrix), this.afterUpdateEmitter.emit();
825
825
  }
826
826
  getDimensions() {
827
827
  const { width: e, height: t } = this.host.getBoundingClientRect();
828
828
  return { width: e, height: t };
829
829
  }
830
830
  createContentCoords(e) {
831
- return le(this.viewportMatrix, e);
831
+ return ue(this.viewportMatrix, e);
832
832
  }
833
833
  createViewportCoords(e) {
834
- return le(this.contentMatrix, e);
834
+ return ue(this.contentMatrix, e);
835
835
  }
836
836
  destroy() {
837
837
  this.observer.disconnect();
838
838
  }
839
839
  }
840
- class q {
840
+ class Z {
841
841
  constructor(e) {
842
- i(this, "elementToNodeId", /* @__PURE__ */ new Map());
843
- i(this, "nodesResizeObserver");
844
- i(this, "onAfterNodeAdded", (e) => {
842
+ o(this, "elementToNodeId", /* @__PURE__ */ new Map());
843
+ o(this, "nodesResizeObserver");
844
+ o(this, "onAfterNodeAdded", (e) => {
845
845
  const t = this.canvas.graph.getNode(e);
846
846
  this.elementToNodeId.set(t.element, e), this.nodesResizeObserver.observe(t.element);
847
847
  });
848
- i(this, "onBeforeNodeRemoved", (e) => {
848
+ o(this, "onBeforeNodeRemoved", (e) => {
849
849
  const t = this.canvas.graph.getNode(e);
850
850
  this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
851
851
  });
852
- i(this, "onBeforeClear", () => {
852
+ o(this, "onBeforeClear", () => {
853
853
  this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
854
854
  });
855
855
  this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
856
856
  t.forEach((s) => {
857
- const o = s.target;
858
- this.handleNodeResize(o);
857
+ const i = s.target;
858
+ this.handleNodeResize(i);
859
859
  });
860
860
  }), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
861
861
  }
862
862
  static configure(e) {
863
- new q(e);
863
+ new Z(e);
864
864
  }
865
865
  handleNodeResize(e) {
866
866
  const t = this.elementToNodeId.get(e);
867
867
  this.canvas.updateNode(t);
868
868
  }
869
869
  }
870
- const Ze = (r, e, t) => {
871
- const { x: s, y: o, width: n, height: a } = r.getBoundingClientRect();
872
- return e >= s && e <= s + n && t >= o && t <= o + a;
873
- }, 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) => {
870
+ const _e = (r, e, t) => {
871
+ const { x: s, y: i, width: n, height: a } = r.getBoundingClientRect();
872
+ return e >= s && e <= s + n && t >= i && t <= i + a;
873
+ }, et = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, L = (r, e, t, s) => _e(e, t, s) && et(r, t, s), B = (r, e) => {
874
874
  e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
875
- }, U = (r) => {
875
+ }, $ = (r) => {
876
876
  const e = document.createElement("div");
877
877
  return {
878
878
  id: r.overlayNodeId,
@@ -887,7 +887,7 @@ const Ze = (r, e, t) => {
887
887
  }
888
888
  ]
889
889
  };
890
- }, _e = (r, e) => {
890
+ }, tt = (r, e) => {
891
891
  let t = e;
892
892
  for (; t !== null; ) {
893
893
  const s = r.findPortIdsByElement(t)[0] ?? null;
@@ -906,30 +906,30 @@ const Ze = (r, e, t) => {
906
906
  status: "notFound"
907
907
  };
908
908
  };
909
- function* Ee(r, e) {
909
+ function* Se(r, e) {
910
910
  const t = r.elementsFromPoint(e.x, e.y);
911
911
  for (const s of t) {
912
912
  if (s.shadowRoot !== null) {
913
- const o = Ee(s.shadowRoot, e);
914
- for (const n of o)
913
+ const i = Se(s.shadowRoot, e);
914
+ for (const n of i)
915
915
  yield n;
916
916
  }
917
917
  yield s;
918
918
  }
919
919
  }
920
- const xe = (r, e) => {
921
- const t = Ee(document, e);
920
+ const be = (r, e) => {
921
+ const t = Se(document, e);
922
922
  for (const s of t) {
923
- const o = _e(r, s);
924
- if (o.status === "portFound")
925
- return o.portId;
926
- if (o.status === "nodeEncountered")
923
+ const i = tt(r, s);
924
+ if (i.status === "portFound")
925
+ return i.portId;
926
+ if (i.status === "nodeEncountered")
927
927
  return null;
928
928
  }
929
929
  return null;
930
930
  };
931
- var T = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(T || {});
932
- const Se = (r, e) => ({
931
+ var N = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(N || {});
932
+ const Pe = (r, e) => ({
933
933
  x: r / 2,
934
934
  y: e / 2
935
935
  }), p = {
@@ -938,16 +938,16 @@ const Se = (r, e) => ({
938
938
  }, m = (r, e, t) => ({
939
939
  x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
940
940
  y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
941
- }), be = (r, e) => {
941
+ }), Ne = (r, e) => {
942
942
  const t = {
943
943
  x: r.x + r.width / 2,
944
944
  y: r.y + r.height / 2
945
945
  }, s = {
946
946
  x: e.x + e.width / 2,
947
947
  y: e.y + e.height / 2
948
- }, 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;
948
+ }, i = 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;
949
949
  return {
950
- x: o,
950
+ x: i,
951
951
  y: n,
952
952
  width: a,
953
953
  height: h,
@@ -958,10 +958,10 @@ const Se = (r, e) => ({
958
958
  x: e * r.x + (1 - e) / 2 * s.x,
959
959
  y: t * r.y + (1 - t) / 2 * s.y
960
960
  });
961
- class et {
961
+ class rt {
962
962
  constructor(e) {
963
- i(this, "path");
964
- i(this, "midpoint");
963
+ o(this, "path");
964
+ o(this, "midpoint");
965
965
  this.params = e;
966
966
  const t = this.params.to;
967
967
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
@@ -969,7 +969,7 @@ class et {
969
969
  { x: this.params.arrowLength, y: p.y },
970
970
  this.params.sourceDirection,
971
971
  p
972
- ), o = m(
972
+ ), i = m(
973
973
  { x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
974
974
  this.params.targetDirection,
975
975
  this.params.to
@@ -977,16 +977,16 @@ class et {
977
977
  x: s.x + this.params.sourceDirection.x * this.params.curvature,
978
978
  y: s.y + this.params.sourceDirection.y * this.params.curvature
979
979
  }, a = {
980
- x: o.x - this.params.targetDirection.x * this.params.curvature,
981
- y: o.y - this.params.targetDirection.y * this.params.curvature
982
- }, 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}`;
980
+ x: i.x - this.params.targetDirection.x * this.params.curvature,
981
+ y: i.y - this.params.targetDirection.y * this.params.curvature
982
+ }, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${i.x} ${i.y}`, d = this.params.hasSourceArrow ? "" : `M ${p.x} ${p.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${i.x} ${i.y} L ${this.params.to.x} ${this.params.to.y}`;
983
983
  this.path = `${d}${h}${c}`;
984
984
  }
985
985
  }
986
- class tt {
986
+ class st {
987
987
  constructor(e) {
988
- i(this, "path");
989
- i(this, "midpoint");
988
+ o(this, "path");
989
+ o(this, "midpoint");
990
990
  this.params = e;
991
991
  const t = this.params.hasSourceArrow ? m(
992
992
  { x: this.params.arrowLength, y: p.y },
@@ -999,15 +999,15 @@ class tt {
999
999
  },
1000
1000
  this.params.targetDirection,
1001
1001
  this.params.to
1002
- ) : 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(
1003
- { x: o, y: p.y },
1002
+ ) : this.params.to, i = 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(
1003
+ { x: i, y: p.y },
1004
1004
  this.params.sourceDirection,
1005
1005
  p
1006
1006
  ), g = {
1007
1007
  x: c.x + h,
1008
1008
  y: c.y + d
1009
1009
  }, l = m(
1010
- { x: this.params.to.x - o, y: this.params.to.y },
1010
+ { x: this.params.to.x - i, y: this.params.to.y },
1011
1011
  this.params.targetDirection,
1012
1012
  this.params.to
1013
1013
  ), u = {
@@ -1016,7 +1016,7 @@ class tt {
1016
1016
  }, w = {
1017
1017
  x: (g.x + u.x) / 2,
1018
1018
  y: (g.y + u.y) / 2
1019
- }, f = {
1019
+ }, y = {
1020
1020
  x: c.x + this.params.curvature * this.params.sourceDirection.x,
1021
1021
  y: c.y + this.params.curvature * this.params.sourceDirection.y
1022
1022
  }, E = {
@@ -1032,52 +1032,52 @@ class tt {
1032
1032
  this.path = [
1033
1033
  `M ${t.x} ${t.y}`,
1034
1034
  `L ${c.x} ${c.y}`,
1035
- `C ${f.x} ${f.y} ${S.x} ${S.y} ${w.x} ${w.y}`,
1035
+ `C ${y.x} ${y.y} ${S.x} ${S.y} ${w.x} ${w.y}`,
1036
1036
  `C ${b.x} ${b.y} ${E.x} ${E.y} ${l.x} ${l.y}`,
1037
1037
  `L ${s.x} ${s.y}`
1038
1038
  ].join(" "), this.midpoint = W(w, e.flipX, e.flipY, e.to);
1039
1039
  }
1040
1040
  }
1041
- const K = Object.freeze({
1041
+ const q = Object.freeze({
1042
1042
  edgeColor: "--edge-color"
1043
- }), Pe = (r) => {
1043
+ }), Te = (r) => {
1044
1044
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1045
- return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(K.edgeColor, r), e;
1046
- }, Te = (r) => {
1045
+ return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(q.edgeColor, r), e;
1046
+ }, Ce = (r) => {
1047
1047
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1048
- return e.setAttribute("stroke", `var(${K.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
1049
- }, B = () => {
1048
+ return e.setAttribute("stroke", `var(${q.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
1049
+ }, U = () => {
1050
1050
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
1051
- return r.setAttribute("fill", `var(${K.edgeColor})`), r;
1052
- }, Ce = () => {
1051
+ return r.setAttribute("fill", `var(${q.edgeColor})`), r;
1052
+ }, De = () => {
1053
1053
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1054
1054
  return r.style.transformOrigin = "50% 50%", r;
1055
- }, Ne = (r, e) => {
1055
+ }, Me = (r, e) => {
1056
1056
  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`;
1057
1057
  }, D = (r, e) => {
1058
1058
  const t = [];
1059
1059
  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) {
1060
1060
  const s = r.length - 1;
1061
- let o = 0, n = 0, a = 0;
1061
+ let i = 0, n = 0, a = 0;
1062
1062
  r.forEach((h, d) => {
1063
1063
  let c = 0, g = 0, l = 0;
1064
- const u = d > 0, w = d < s, f = u && w;
1065
- if (u && (c = -o, g = -n, l = a), w) {
1064
+ const u = d > 0, w = d < s, y = u && w;
1065
+ if (u && (c = -i, g = -n, l = a), w) {
1066
1066
  const V = r[d + 1];
1067
- o = V.x - h.x, n = V.y - h.y, a = Math.sqrt(o * o + n * n);
1067
+ i = V.x - h.x, n = V.y - h.y, a = Math.sqrt(i * i + n * n);
1068
1068
  }
1069
- const S = a !== 0 ? Math.min((f ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, b = f ? { x: h.x + o * S, y: h.y + n * S } : h, P = l !== 0 ? Math.min((f ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, R = f ? { x: h.x + c * P, y: h.y + g * P } : h;
1070
- d > 0 && t.push(`L ${R.x} ${R.y}`), f && t.push(
1069
+ const S = a !== 0 ? Math.min((y ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, b = y ? { x: h.x + i * S, y: h.y + n * S } : 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;
1070
+ d > 0 && t.push(`L ${R.x} ${R.y}`), y && t.push(
1071
1071
  `C ${h.x} ${h.y} ${h.x} ${h.y} ${b.x} ${b.y}`
1072
1072
  );
1073
1073
  });
1074
1074
  }
1075
1075
  return t.join(" ");
1076
1076
  };
1077
- class rt {
1077
+ class ot {
1078
1078
  constructor(e) {
1079
- i(this, "path");
1080
- i(this, "midpoint");
1079
+ o(this, "path");
1080
+ o(this, "midpoint");
1081
1081
  this.params = e;
1082
1082
  const t = this.params.to;
1083
1083
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
@@ -1085,7 +1085,7 @@ class rt {
1085
1085
  { x: this.params.arrowLength, y: p.y },
1086
1086
  this.params.sourceDirection,
1087
1087
  p
1088
- ) : p, o = this.params.hasTargetArrow ? m(
1088
+ ) : p, i = this.params.hasTargetArrow ? m(
1089
1089
  {
1090
1090
  x: this.params.to.x - this.params.arrowLength,
1091
1091
  y: this.params.to.y
@@ -1106,17 +1106,17 @@ class rt {
1106
1106
  }, u = { x: l.x, y: g }, w = {
1107
1107
  x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
1108
1108
  y: d.y
1109
- }, f = { x: w.x, y: g };
1109
+ }, y = { x: w.x, y: g };
1110
1110
  this.path = D(
1111
- [s, h, l, u, f, w, d, o],
1111
+ [s, h, l, u, y, w, d, i],
1112
1112
  this.params.roundness
1113
1113
  );
1114
1114
  }
1115
1115
  }
1116
- class st {
1116
+ class it {
1117
1117
  constructor(e) {
1118
- i(this, "path");
1119
- i(this, "midpoint");
1118
+ o(this, "path");
1119
+ o(this, "midpoint");
1120
1120
  this.params = e;
1121
1121
  const t = this.params.hasSourceArrow ? m(
1122
1122
  { x: this.params.arrowLength, y: p.y },
@@ -1129,12 +1129,12 @@ class st {
1129
1129
  },
1130
1130
  this.params.targetDirection,
1131
1131
  this.params.to
1132
- ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1133
- { x: o, y: p.y },
1132
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1133
+ { x: i, y: p.y },
1134
1134
  this.params.sourceDirection,
1135
1135
  p
1136
1136
  ), 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(
1137
- { x: this.params.to.x - o, y: this.params.to.y },
1137
+ { x: this.params.to.x - i, y: this.params.to.y },
1138
1138
  this.params.targetDirection,
1139
1139
  this.params.to
1140
1140
  ), u = { x: l.x + d, y: l.y + c }, w = { x: (g.x + u.x) / 2, y: (g.y + u.y) / 2 };
@@ -1144,10 +1144,10 @@ class st {
1144
1144
  );
1145
1145
  }
1146
1146
  }
1147
- class ot {
1147
+ class nt {
1148
1148
  constructor(e) {
1149
- i(this, "path");
1150
- i(this, "midpoint");
1149
+ o(this, "path");
1150
+ o(this, "midpoint");
1151
1151
  this.params = e;
1152
1152
  const t = this.params.to;
1153
1153
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
@@ -1155,7 +1155,7 @@ class ot {
1155
1155
  { x: this.params.arrowLength, y: p.y },
1156
1156
  this.params.sourceDirection,
1157
1157
  p
1158
- ) : p, o = this.params.hasTargetArrow ? m(
1158
+ ) : p, i = this.params.hasTargetArrow ? m(
1159
1159
  {
1160
1160
  x: this.params.to.x - this.params.arrowLength,
1161
1161
  y: this.params.to.y
@@ -1171,13 +1171,13 @@ class ot {
1171
1171
  this.params.targetDirection,
1172
1172
  this.params.to
1173
1173
  );
1174
- this.path = D([s, a, h, o], this.params.roundness);
1174
+ this.path = D([s, a, h, i], this.params.roundness);
1175
1175
  }
1176
1176
  }
1177
- class it {
1177
+ class at {
1178
1178
  constructor(e) {
1179
- i(this, "path");
1180
- i(this, "midpoint");
1179
+ o(this, "path");
1180
+ o(this, "midpoint");
1181
1181
  this.params = e;
1182
1182
  const t = this.params.to;
1183
1183
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
@@ -1185,7 +1185,7 @@ class it {
1185
1185
  { x: this.params.arrowLength, y: p.y },
1186
1186
  this.params.sourceDirection,
1187
1187
  p
1188
- ) : p, o = this.params.hasTargetArrow ? m(
1188
+ ) : p, i = this.params.hasTargetArrow ? m(
1189
1189
  {
1190
1190
  x: this.params.to.x - this.params.arrowLength,
1191
1191
  y: this.params.to.y
@@ -1206,26 +1206,26 @@ class it {
1206
1206
  }, u = { x: g, y: l.y }, w = {
1207
1207
  x: d.x,
1208
1208
  y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
1209
- }, f = { x: g, y: w.y };
1209
+ }, y = { x: g, y: w.y };
1210
1210
  this.path = D(
1211
- [s, h, l, u, f, w, d, o],
1211
+ [s, h, l, u, y, w, d, i],
1212
1212
  this.params.roundness
1213
1213
  );
1214
1214
  }
1215
1215
  }
1216
- class Q {
1216
+ class J {
1217
1217
  constructor(e) {
1218
- i(this, "path");
1219
- i(this, "midpoint");
1218
+ o(this, "path");
1219
+ o(this, "midpoint");
1220
1220
  this.params = e;
1221
- const t = this.params.arrowOffset, s = this.params.side, o = this.params.arrowLength + t, n = o + 2 * s, h = [
1221
+ const t = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + t, n = i + 2 * s, h = [
1222
1222
  { x: this.params.arrowLength, y: p.y },
1223
- { x: o, y: p.y },
1224
- { x: o, y: this.params.side },
1223
+ { x: i, y: p.y },
1224
+ { x: i, y: this.params.side },
1225
1225
  { x: n, y: this.params.side },
1226
1226
  { x: n, y: -this.params.side },
1227
- { x: o, y: -this.params.side },
1228
- { x: o, y: p.y },
1227
+ { x: i, y: -this.params.side },
1228
+ { x: i, y: p.y },
1229
1229
  { x: this.params.arrowLength, y: p.y }
1230
1230
  ].map(
1231
1231
  (c) => m(c, this.params.sourceDirection, p)
@@ -1233,18 +1233,18 @@ class Q {
1233
1233
  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 };
1234
1234
  }
1235
1235
  }
1236
- class nt {
1236
+ class ht {
1237
1237
  constructor(e) {
1238
- i(this, "path");
1239
- i(this, "midpoint");
1238
+ o(this, "path");
1239
+ o(this, "midpoint");
1240
1240
  this.params = e;
1241
- 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 = [
1241
+ const t = this.params.smallRadius, s = this.params.radius, i = t + s, n = t * s / i, a = Math.sqrt(i * i - t * t), h = a * t / i, d = a + s + this.params.arrowLength, c = this.params.arrowLength + h, l = [
1242
1242
  { x: this.params.arrowLength, y: p.y },
1243
1243
  { x: c, y: n },
1244
1244
  { x: c, y: -n },
1245
1245
  { x: d, y: 0 }
1246
1246
  ].map(
1247
- (f) => m(f, this.params.sourceDirection, p)
1247
+ (y) => m(y, this.params.sourceDirection, p)
1248
1248
  ), u = [
1249
1249
  `M ${l[0].x} ${l[0].y}`,
1250
1250
  `A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
@@ -1254,11 +1254,11 @@ class nt {
1254
1254
  this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${u}`, this.midpoint = l[3];
1255
1255
  }
1256
1256
  }
1257
- class at {
1257
+ class dt {
1258
1258
  constructor(e) {
1259
- i(this, "path");
1260
- i(this, "midpoint");
1261
- i(this, "diagonalDistance");
1259
+ o(this, "path");
1260
+ o(this, "midpoint");
1261
+ o(this, "diagonalDistance");
1262
1262
  this.params = e;
1263
1263
  const t = this.params.to;
1264
1264
  if (this.midpoint = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
@@ -1269,7 +1269,7 @@ class at {
1269
1269
  this.path = "";
1270
1270
  return;
1271
1271
  }
1272
- const o = this.createDirectLinePoint({
1272
+ const i = this.createDirectLinePoint({
1273
1273
  offset: this.params.sourceOffset,
1274
1274
  hasArrow: this.params.hasSourceArrow,
1275
1275
  flip: 1,
@@ -1280,20 +1280,20 @@ class at {
1280
1280
  flip: -1,
1281
1281
  shift: this.params.to
1282
1282
  });
1283
- this.path = `M ${o.x} ${o.y} L ${n.x} ${n.y}`;
1283
+ this.path = `M ${i.x} ${i.y} L ${n.x} ${n.y}`;
1284
1284
  }
1285
1285
  createDirectLinePoint(e) {
1286
- const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, o = e.flip * s / this.diagonalDistance;
1286
+ const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, i = e.flip * s / this.diagonalDistance;
1287
1287
  return {
1288
- x: this.params.to.x * o + e.shift.x,
1289
- y: this.params.to.y * o + e.shift.y
1288
+ x: this.params.to.x * i + e.shift.x,
1289
+ y: this.params.to.y * i + e.shift.y
1290
1290
  };
1291
1291
  }
1292
1292
  }
1293
- class ht {
1293
+ class ct {
1294
1294
  constructor(e) {
1295
- i(this, "path");
1296
- i(this, "midpoint");
1295
+ o(this, "path");
1296
+ o(this, "midpoint");
1297
1297
  this.params = e;
1298
1298
  const t = this.params.hasSourceArrow ? m(
1299
1299
  { x: this.params.arrowLength, y: p.y },
@@ -1306,12 +1306,12 @@ class ht {
1306
1306
  },
1307
1307
  this.params.targetDirection,
1308
1308
  this.params.to
1309
- ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1310
- { x: o, y: p.y },
1309
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1310
+ { x: i, y: p.y },
1311
1311
  this.params.sourceDirection,
1312
1312
  p
1313
1313
  ), a = m(
1314
- { x: this.params.to.x - o, y: this.params.to.y },
1314
+ { x: this.params.to.x - i, y: this.params.to.y },
1315
1315
  this.params.targetDirection,
1316
1316
  this.params.to
1317
1317
  ), 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 = {
@@ -1331,10 +1331,10 @@ class ht {
1331
1331
  );
1332
1332
  }
1333
1333
  }
1334
- class dt {
1334
+ class lt {
1335
1335
  constructor(e) {
1336
- i(this, "path");
1337
- i(this, "midpoint");
1336
+ o(this, "path");
1337
+ o(this, "midpoint");
1338
1338
  this.params = e;
1339
1339
  const t = this.params.hasSourceArrow ? m(
1340
1340
  { x: this.params.arrowLength, y: p.y },
@@ -1347,12 +1347,12 @@ class dt {
1347
1347
  },
1348
1348
  this.params.targetDirection,
1349
1349
  this.params.to
1350
- ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1351
- { x: o, y: p.y },
1350
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1351
+ { x: i, y: p.y },
1352
1352
  this.params.sourceDirection,
1353
1353
  p
1354
1354
  ), a = m(
1355
- { x: this.params.to.x - o, y: this.params.to.y },
1355
+ { x: this.params.to.x - i, y: this.params.to.y },
1356
1356
  this.params.targetDirection,
1357
1357
  this.params.to
1358
1358
  ), 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 = {
@@ -1372,7 +1372,7 @@ class dt {
1372
1372
  );
1373
1373
  }
1374
1374
  }
1375
- const y = Object.freeze({
1375
+ const f = Object.freeze({
1376
1376
  color: "#777777",
1377
1377
  width: 1,
1378
1378
  arrowLength: 20,
@@ -1394,35 +1394,35 @@ const y = Object.freeze({
1394
1394
  curvature: 90,
1395
1395
  interactiveWidth: 10,
1396
1396
  preOffset: 0
1397
- }), ge = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
1398
- class k {
1397
+ }), pe = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
1398
+ class z {
1399
1399
  constructor(e) {
1400
- i(this, "svg");
1401
- i(this, "group", Ce());
1402
- i(this, "line");
1403
- i(this, "sourceArrow", null);
1404
- i(this, "targetArrow", null);
1405
- i(this, "onAfterRender");
1406
- i(this, "afterRenderEmitter");
1407
- i(this, "arrowRenderer");
1408
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = x(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Pe(e.color), this.svg.appendChild(this.group), this.line = Te(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));
1400
+ o(this, "svg");
1401
+ o(this, "group", De());
1402
+ o(this, "line");
1403
+ o(this, "sourceArrow", null);
1404
+ o(this, "targetArrow", null);
1405
+ o(this, "onAfterRender");
1406
+ o(this, "afterRenderEmitter");
1407
+ o(this, "arrowRenderer");
1408
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = x(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Te(e.color), this.svg.appendChild(this.group), this.line = Ce(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = U(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = U(), this.group.appendChild(this.targetArrow));
1409
1409
  }
1410
1410
  render(e) {
1411
- const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = be(
1411
+ const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Ne(
1412
1412
  e.from,
1413
1413
  e.to
1414
1414
  );
1415
- Ne(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1416
- const d = ge(
1415
+ Me(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1416
+ const d = pe(
1417
1417
  e.from.direction,
1418
1418
  a,
1419
1419
  h
1420
- ), c = ge(
1420
+ ), c = pe(
1421
1421
  e.to.direction,
1422
1422
  a,
1423
1423
  h
1424
1424
  ), g = {
1425
- x: o,
1425
+ x: i,
1426
1426
  y: n
1427
1427
  };
1428
1428
  let l = { x: -c.x, y: -c.y }, u;
@@ -1435,12 +1435,12 @@ class k {
1435
1435
  h
1436
1436
  );
1437
1437
  this.line.setAttribute("d", w.path);
1438
- let f = null;
1439
- this.sourceArrow && (f = this.arrowRenderer({
1438
+ let y = null;
1439
+ this.sourceArrow && (y = this.arrowRenderer({
1440
1440
  direction: d,
1441
1441
  shift: p,
1442
1442
  arrowLength: this.params.arrowLength
1443
- }), this.sourceArrow.setAttribute("d", f));
1443
+ }), this.sourceArrow.setAttribute("d", y));
1444
1444
  let E = null;
1445
1445
  this.targetArrow && (E = this.arrowRenderer({
1446
1446
  direction: l,
@@ -1448,12 +1448,12 @@ class k {
1448
1448
  arrowLength: this.params.arrowLength
1449
1449
  }), this.targetArrow.setAttribute("d", E)), this.afterRenderEmitter.emit({
1450
1450
  edgePath: w,
1451
- sourceArrowPath: f,
1451
+ sourceArrowPath: y,
1452
1452
  targetArrowPath: E
1453
1453
  });
1454
1454
  }
1455
1455
  }
1456
- const ct = (r) => (e) => {
1456
+ const gt = (r) => (e) => {
1457
1457
  const s = [
1458
1458
  p,
1459
1459
  { x: e.arrowLength, y: r.radius },
@@ -1463,18 +1463,18 @@ const ct = (r) => (e) => {
1463
1463
  ).map((h) => ({
1464
1464
  x: h.x + e.shift.x,
1465
1465
  y: h.y + e.shift.y
1466
- })), o = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
1467
- return `${o} ${n} ${a} Z`;
1468
- }, lt = (r) => (e) => {
1469
- 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(
1470
- (f) => m(f, e.direction, p)
1471
- ).map((f) => ({
1472
- x: f.x + e.shift.x,
1473
- y: f.y + e.shift.y
1474
- })), 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}`;
1466
+ })), i = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
1467
+ return `${i} ${n} ${a} Z`;
1468
+ }, ut = (r) => (e) => {
1469
+ const t = r.radius, s = e.arrowLength, i = (s * s + 2 * s * t) / (2 * t), n = i + t, a = s + t - t * (s + t) / n, h = t * i / n, c = [p, { x: a, y: -h }, { x: a, y: h }].map(
1470
+ (y) => m(y, e.direction, p)
1471
+ ).map((y) => ({
1472
+ x: y.x + e.shift.x,
1473
+ y: y.y + e.shift.y
1474
+ })), g = `M ${c[0].x} ${c[0].y}`, l = `A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${i} ${i} 0 0 0 ${c[0].x} ${c[0].y}`;
1475
1475
  return `${g} ${l} ${u} ${w}`;
1476
- }, gt = (r) => (e) => {
1477
- const t = r.smallRadius, s = r.radius, o = m(
1476
+ }, pt = (r) => (e) => {
1477
+ const t = r.smallRadius, s = r.radius, i = m(
1478
1478
  {
1479
1479
  x: e.arrowLength,
1480
1480
  y: 0
@@ -1487,7 +1487,7 @@ const ct = (r) => (e) => {
1487
1487
  x: e.arrowLength + r.smallRadius,
1488
1488
  y: 0
1489
1489
  }
1490
- ), a = [p, { x: o.x, y: -o.y }, o].map(
1490
+ ), a = [p, { x: i.x, y: -i.y }, i].map(
1491
1491
  (l) => m(l, e.direction, p)
1492
1492
  ).map((l) => ({
1493
1493
  x: l.x + e.shift.x,
@@ -1499,39 +1499,39 @@ const ct = (r) => (e) => {
1499
1499
  return r;
1500
1500
  switch (r.type) {
1501
1501
  case "triangle":
1502
- return ct({
1503
- radius: r.radius ?? y.polygonArrowRadius
1502
+ return gt({
1503
+ radius: r.radius ?? f.polygonArrowRadius
1504
1504
  });
1505
1505
  case "arc":
1506
- return lt({
1507
- radius: r.radius ?? y.circleArrowRadius
1506
+ return ut({
1507
+ radius: r.radius ?? f.circleArrowRadius
1508
1508
  });
1509
1509
  default:
1510
- return gt({
1511
- smallRadius: r.smallRadius ?? y.wedgeArrowSmallRadius,
1512
- angle: r.angle ?? y.wedgeArrowAngle,
1513
- radius: r.radius ?? y.wedgeArrowRadius
1510
+ return pt({
1511
+ smallRadius: r.smallRadius ?? f.wedgeArrowSmallRadius,
1512
+ angle: r.angle ?? f.wedgeArrowAngle,
1513
+ radius: r.radius ?? f.wedgeArrowRadius
1514
1514
  });
1515
1515
  }
1516
1516
  };
1517
- class ut {
1517
+ class wt {
1518
1518
  constructor(e) {
1519
- i(this, "svg");
1520
- i(this, "group");
1521
- i(this, "line");
1522
- i(this, "sourceArrow");
1523
- i(this, "targetArrow");
1524
- i(this, "onAfterRender");
1525
- i(this, "arrowLength");
1526
- i(this, "curvature");
1527
- i(this, "portCycleRadius");
1528
- i(this, "portCycleSmallRadius");
1529
- i(this, "detourDirection");
1530
- i(this, "detourDistance");
1531
- i(this, "hasSourceArrow");
1532
- i(this, "hasTargetArrow");
1533
- i(this, "pathShape");
1534
- i(this, "createCyclePath", (e) => new nt({
1519
+ o(this, "svg");
1520
+ o(this, "group");
1521
+ o(this, "line");
1522
+ o(this, "sourceArrow");
1523
+ o(this, "targetArrow");
1524
+ o(this, "onAfterRender");
1525
+ o(this, "arrowLength");
1526
+ o(this, "curvature");
1527
+ o(this, "portCycleRadius");
1528
+ o(this, "portCycleSmallRadius");
1529
+ o(this, "detourDirection");
1530
+ o(this, "detourDistance");
1531
+ o(this, "hasSourceArrow");
1532
+ o(this, "hasTargetArrow");
1533
+ o(this, "pathShape");
1534
+ o(this, "createCyclePath", (e) => new ht({
1535
1535
  sourceDirection: e,
1536
1536
  radius: this.portCycleRadius,
1537
1537
  smallRadius: this.portCycleSmallRadius,
@@ -1539,11 +1539,11 @@ class ut {
1539
1539
  hasSourceArrow: this.hasSourceArrow,
1540
1540
  hasTargetArrow: this.hasTargetArrow
1541
1541
  }));
1542
- i(this, "createDetourPath", (e, t, s, o, n) => new tt({
1542
+ o(this, "createDetourPath", (e, t, s, i, n) => new st({
1543
1543
  to: s,
1544
1544
  sourceDirection: e,
1545
1545
  targetDirection: t,
1546
- flipX: o,
1546
+ flipX: i,
1547
1547
  flipY: n,
1548
1548
  arrowLength: this.arrowLength,
1549
1549
  detourDirection: this.detourDirection,
@@ -1552,7 +1552,7 @@ class ut {
1552
1552
  hasSourceArrow: this.hasSourceArrow,
1553
1553
  hasTargetArrow: this.hasTargetArrow
1554
1554
  }));
1555
- i(this, "createLinePath", (e, t, s) => new et({
1555
+ o(this, "createLinePath", (e, t, s) => new rt({
1556
1556
  to: s,
1557
1557
  sourceDirection: e,
1558
1558
  targetDirection: t,
@@ -1561,9 +1561,9 @@ class ut {
1561
1561
  hasSourceArrow: this.hasSourceArrow,
1562
1562
  hasTargetArrow: this.hasTargetArrow
1563
1563
  }));
1564
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? y.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? y.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? y.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? y.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new k({
1565
- color: (e == null ? void 0 : e.color) ?? y.color,
1566
- width: (e == null ? void 0 : e.width) ?? y.width,
1564
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? f.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? f.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? f.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new z({
1565
+ color: (e == null ? void 0 : e.color) ?? f.color,
1566
+ width: (e == null ? void 0 : e.width) ?? f.width,
1567
1567
  arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
1568
1568
  arrowLength: this.arrowLength,
1569
1569
  hasSourceArrow: this.hasSourceArrow,
@@ -1577,23 +1577,23 @@ class ut {
1577
1577
  this.pathShape.render(e);
1578
1578
  }
1579
1579
  }
1580
- class pt {
1580
+ class yt {
1581
1581
  constructor(e) {
1582
- i(this, "svg");
1583
- i(this, "group");
1584
- i(this, "line");
1585
- i(this, "sourceArrow");
1586
- i(this, "targetArrow");
1587
- i(this, "onAfterRender");
1588
- i(this, "arrowLength");
1589
- i(this, "arrowOffset");
1590
- i(this, "roundness");
1591
- i(this, "cycleSquareSide");
1592
- i(this, "detourDistance");
1593
- i(this, "hasSourceArrow");
1594
- i(this, "hasTargetArrow");
1595
- i(this, "pathShape");
1596
- i(this, "createCyclePath", (e) => new Q({
1582
+ o(this, "svg");
1583
+ o(this, "group");
1584
+ o(this, "line");
1585
+ o(this, "sourceArrow");
1586
+ o(this, "targetArrow");
1587
+ o(this, "onAfterRender");
1588
+ o(this, "arrowLength");
1589
+ o(this, "arrowOffset");
1590
+ o(this, "roundness");
1591
+ o(this, "cycleSquareSide");
1592
+ o(this, "detourDistance");
1593
+ o(this, "hasSourceArrow");
1594
+ o(this, "hasTargetArrow");
1595
+ o(this, "pathShape");
1596
+ o(this, "createCyclePath", (e) => new J({
1597
1597
  sourceDirection: e,
1598
1598
  arrowLength: this.arrowLength,
1599
1599
  side: this.cycleSquareSide,
@@ -1602,11 +1602,11 @@ class pt {
1602
1602
  hasSourceArrow: this.hasSourceArrow,
1603
1603
  hasTargetArrow: this.hasTargetArrow
1604
1604
  }));
1605
- i(this, "createDetourPath", (e, t, s, o, n) => new ht({
1605
+ o(this, "createDetourPath", (e, t, s, i, n) => new ct({
1606
1606
  to: s,
1607
1607
  sourceDirection: e,
1608
1608
  targetDirection: t,
1609
- flipX: o,
1609
+ flipX: i,
1610
1610
  flipY: n,
1611
1611
  arrowLength: this.arrowLength,
1612
1612
  arrowOffset: this.arrowOffset,
@@ -1615,26 +1615,26 @@ class pt {
1615
1615
  hasSourceArrow: this.hasSourceArrow,
1616
1616
  hasTargetArrow: this.hasTargetArrow
1617
1617
  }));
1618
- i(this, "createLinePath", (e, t, s, o) => new rt({
1618
+ o(this, "createLinePath", (e, t, s, i) => new ot({
1619
1619
  to: s,
1620
1620
  sourceDirection: e,
1621
1621
  targetDirection: t,
1622
- flipX: o,
1622
+ flipX: i,
1623
1623
  arrowLength: this.arrowLength,
1624
1624
  arrowOffset: this.arrowOffset,
1625
1625
  roundness: this.roundness,
1626
1626
  hasSourceArrow: this.hasSourceArrow,
1627
1627
  hasTargetArrow: this.hasTargetArrow
1628
1628
  }));
1629
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? y.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? y.cycleSquareSide;
1630
- const t = (e == null ? void 0 : e.roundness) ?? y.roundness;
1629
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
1630
+ const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
1631
1631
  this.roundness = Math.min(
1632
1632
  t,
1633
1633
  this.arrowOffset,
1634
1634
  this.cycleSquareSide / 2
1635
- ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new k({
1636
- color: (e == null ? void 0 : e.color) ?? y.color,
1637
- width: (e == null ? void 0 : e.width) ?? y.width,
1635
+ ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new z({
1636
+ color: (e == null ? void 0 : e.color) ?? f.color,
1637
+ width: (e == null ? void 0 : e.width) ?? f.width,
1638
1638
  arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
1639
1639
  arrowLength: this.arrowLength,
1640
1640
  hasSourceArrow: this.hasSourceArrow,
@@ -1648,24 +1648,24 @@ class pt {
1648
1648
  this.pathShape.render(e);
1649
1649
  }
1650
1650
  }
1651
- class wt {
1651
+ class ft {
1652
1652
  constructor(e) {
1653
- i(this, "svg");
1654
- i(this, "group");
1655
- i(this, "line");
1656
- i(this, "sourceArrow");
1657
- i(this, "targetArrow");
1658
- i(this, "onAfterRender");
1659
- i(this, "arrowLength");
1660
- i(this, "arrowOffset");
1661
- i(this, "roundness");
1662
- i(this, "cycleSquareSide");
1663
- i(this, "detourDirection");
1664
- i(this, "detourDistance");
1665
- i(this, "hasSourceArrow");
1666
- i(this, "hasTargetArrow");
1667
- i(this, "pathShape");
1668
- i(this, "createCyclePath", (e) => new Q({
1653
+ o(this, "svg");
1654
+ o(this, "group");
1655
+ o(this, "line");
1656
+ o(this, "sourceArrow");
1657
+ o(this, "targetArrow");
1658
+ o(this, "onAfterRender");
1659
+ o(this, "arrowLength");
1660
+ o(this, "arrowOffset");
1661
+ o(this, "roundness");
1662
+ o(this, "cycleSquareSide");
1663
+ o(this, "detourDirection");
1664
+ o(this, "detourDistance");
1665
+ o(this, "hasSourceArrow");
1666
+ o(this, "hasTargetArrow");
1667
+ o(this, "pathShape");
1668
+ o(this, "createCyclePath", (e) => new J({
1669
1669
  sourceDirection: e,
1670
1670
  arrowLength: this.arrowLength,
1671
1671
  side: this.cycleSquareSide,
@@ -1674,11 +1674,11 @@ class wt {
1674
1674
  hasSourceArrow: this.hasSourceArrow,
1675
1675
  hasTargetArrow: this.hasTargetArrow
1676
1676
  }));
1677
- i(this, "createDetourPath", (e, t, s, o, n) => new st({
1677
+ o(this, "createDetourPath", (e, t, s, i, n) => new it({
1678
1678
  to: s,
1679
1679
  sourceDirection: e,
1680
1680
  targetDirection: t,
1681
- flipX: o,
1681
+ flipX: i,
1682
1682
  flipY: n,
1683
1683
  arrowLength: this.arrowLength,
1684
1684
  arrowOffset: this.arrowOffset,
@@ -1688,7 +1688,7 @@ class wt {
1688
1688
  hasSourceArrow: this.hasSourceArrow,
1689
1689
  hasTargetArrow: this.hasTargetArrow
1690
1690
  }));
1691
- i(this, "createLinePath", (e, t, s) => new ot({
1691
+ o(this, "createLinePath", (e, t, s) => new nt({
1692
1692
  to: s,
1693
1693
  sourceDirection: e,
1694
1694
  targetDirection: t,
@@ -1698,15 +1698,15 @@ class wt {
1698
1698
  hasSourceArrow: this.hasSourceArrow,
1699
1699
  hasTargetArrow: this.hasTargetArrow
1700
1700
  }));
1701
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? y.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? y.cycleSquareSide;
1702
- const t = (e == null ? void 0 : e.roundness) ?? y.roundness;
1701
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
1702
+ const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
1703
1703
  this.roundness = Math.min(
1704
1704
  t,
1705
1705
  this.arrowOffset,
1706
1706
  this.cycleSquareSide / 2
1707
- ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? y.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new k({
1708
- color: (e == null ? void 0 : e.color) ?? y.color,
1709
- width: (e == null ? void 0 : e.width) ?? y.width,
1707
+ ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new z({
1708
+ color: (e == null ? void 0 : e.color) ?? f.color,
1709
+ width: (e == null ? void 0 : e.width) ?? f.width,
1710
1710
  arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
1711
1711
  arrowLength: this.arrowLength,
1712
1712
  hasSourceArrow: this.hasSourceArrow,
@@ -1720,23 +1720,23 @@ class wt {
1720
1720
  this.pathShape.render(e);
1721
1721
  }
1722
1722
  }
1723
- class ft {
1723
+ class mt {
1724
1724
  constructor(e) {
1725
- i(this, "svg");
1726
- i(this, "group");
1727
- i(this, "line");
1728
- i(this, "sourceArrow");
1729
- i(this, "targetArrow");
1730
- i(this, "onAfterRender");
1731
- i(this, "arrowLength");
1732
- i(this, "arrowOffset");
1733
- i(this, "roundness");
1734
- i(this, "cycleSquareSide");
1735
- i(this, "detourDistance");
1736
- i(this, "hasSourceArrow");
1737
- i(this, "hasTargetArrow");
1738
- i(this, "pathShape");
1739
- i(this, "createCyclePath", (e) => new Q({
1725
+ o(this, "svg");
1726
+ o(this, "group");
1727
+ o(this, "line");
1728
+ o(this, "sourceArrow");
1729
+ o(this, "targetArrow");
1730
+ o(this, "onAfterRender");
1731
+ o(this, "arrowLength");
1732
+ o(this, "arrowOffset");
1733
+ o(this, "roundness");
1734
+ o(this, "cycleSquareSide");
1735
+ o(this, "detourDistance");
1736
+ o(this, "hasSourceArrow");
1737
+ o(this, "hasTargetArrow");
1738
+ o(this, "pathShape");
1739
+ o(this, "createCyclePath", (e) => new J({
1740
1740
  sourceDirection: e,
1741
1741
  arrowLength: this.arrowLength,
1742
1742
  side: this.cycleSquareSide,
@@ -1745,11 +1745,11 @@ class ft {
1745
1745
  hasSourceArrow: this.hasSourceArrow,
1746
1746
  hasTargetArrow: this.hasTargetArrow
1747
1747
  }));
1748
- i(this, "createDetourPath", (e, t, s, o, n) => new dt({
1748
+ o(this, "createDetourPath", (e, t, s, i, n) => new lt({
1749
1749
  to: s,
1750
1750
  sourceDirection: e,
1751
1751
  targetDirection: t,
1752
- flipX: o,
1752
+ flipX: i,
1753
1753
  flipY: n,
1754
1754
  arrowLength: this.arrowLength,
1755
1755
  arrowOffset: this.arrowOffset,
@@ -1758,7 +1758,7 @@ class ft {
1758
1758
  hasSourceArrow: this.hasSourceArrow,
1759
1759
  hasTargetArrow: this.hasTargetArrow
1760
1760
  }));
1761
- i(this, "createLinePath", (e, t, s, o, n) => new it({
1761
+ o(this, "createLinePath", (e, t, s, i, n) => new at({
1762
1762
  to: s,
1763
1763
  sourceDirection: e,
1764
1764
  targetDirection: t,
@@ -1769,15 +1769,15 @@ class ft {
1769
1769
  hasSourceArrow: this.hasSourceArrow,
1770
1770
  hasTargetArrow: this.hasTargetArrow
1771
1771
  }));
1772
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? y.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? y.cycleSquareSide;
1773
- const t = (e == null ? void 0 : e.roundness) ?? y.roundness;
1772
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
1773
+ const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
1774
1774
  this.roundness = Math.min(
1775
1775
  t,
1776
1776
  this.arrowOffset,
1777
1777
  this.cycleSquareSide / 2
1778
- ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new k({
1779
- color: (e == null ? void 0 : e.color) ?? y.color,
1780
- width: (e == null ? void 0 : e.width) ?? y.width,
1778
+ ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new z({
1779
+ color: (e == null ? void 0 : e.color) ?? f.color,
1780
+ width: (e == null ? void 0 : e.width) ?? f.width,
1781
1781
  arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
1782
1782
  arrowLength: this.arrowLength,
1783
1783
  hasSourceArrow: this.hasSourceArrow,
@@ -1791,30 +1791,30 @@ class ft {
1791
1791
  this.pathShape.render(e);
1792
1792
  }
1793
1793
  }
1794
- class De {
1794
+ class Le {
1795
1795
  constructor(e) {
1796
- i(this, "svg");
1797
- i(this, "group", Ce());
1798
- i(this, "line");
1799
- i(this, "sourceArrow", null);
1800
- i(this, "targetArrow", null);
1801
- i(this, "color");
1802
- i(this, "width");
1803
- i(this, "arrowLength");
1804
- i(this, "sourceOffset");
1805
- i(this, "targetOffset");
1806
- i(this, "onAfterRender");
1807
- i(this, "afterRenderEmitter");
1808
- i(this, "arrowRenderer");
1809
- [this.afterRenderEmitter, this.onAfterRender] = x(), this.color = (e == null ? void 0 : e.color) ?? y.color, this.width = (e == null ? void 0 : e.width) ?? y.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.arrowRenderer = F((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? y.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? y.preOffset, this.svg = Pe(this.color), this.svg.appendChild(this.group), this.line = Te(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));
1796
+ o(this, "svg");
1797
+ o(this, "group", De());
1798
+ o(this, "line");
1799
+ o(this, "sourceArrow", null);
1800
+ o(this, "targetArrow", null);
1801
+ o(this, "color");
1802
+ o(this, "width");
1803
+ o(this, "arrowLength");
1804
+ o(this, "sourceOffset");
1805
+ o(this, "targetOffset");
1806
+ o(this, "onAfterRender");
1807
+ o(this, "afterRenderEmitter");
1808
+ o(this, "arrowRenderer");
1809
+ [this.afterRenderEmitter, this.onAfterRender] = x(), 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 = Te(this.color), this.svg.appendChild(this.group), this.line = Ce(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = U(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = U(), this.group.appendChild(this.targetArrow));
1810
1810
  }
1811
1811
  render(e) {
1812
- const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = be(
1812
+ const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Ne(
1813
1813
  e.from,
1814
1814
  e.to
1815
1815
  );
1816
- Ne(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1817
- const d = { x: o, y: n }, c = new at({
1816
+ Me(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1817
+ const d = { x: i, y: n }, c = new dt({
1818
1818
  to: d,
1819
1819
  sourceOffset: this.sourceOffset,
1820
1820
  targetOffset: this.targetOffset,
@@ -1833,26 +1833,26 @@ class De {
1833
1833
  y: d.y / u
1834
1834
  };
1835
1835
  if (this.sourceArrow) {
1836
- const f = {
1836
+ const y = {
1837
1837
  x: w.x * this.sourceOffset,
1838
1838
  y: w.y * this.sourceOffset
1839
1839
  };
1840
1840
  g = this.arrowRenderer({
1841
1841
  direction: w,
1842
- shift: f,
1842
+ shift: y,
1843
1843
  arrowLength: this.arrowLength
1844
1844
  }), this.sourceArrow.setAttribute("d", g);
1845
1845
  }
1846
1846
  if (this.targetArrow) {
1847
- const f = {
1847
+ const y = {
1848
1848
  x: w.x * this.targetOffset,
1849
1849
  y: w.y * this.targetOffset
1850
1850
  };
1851
1851
  l = this.arrowRenderer({
1852
1852
  direction: { x: -w.x, y: -w.y },
1853
1853
  shift: {
1854
- x: d.x - f.x,
1855
- y: d.y - f.y
1854
+ x: d.x - y.x,
1855
+ y: d.y - y.y
1856
1856
  },
1857
1857
  arrowLength: this.arrowLength
1858
1858
  }), this.targetArrow.setAttribute("d", l);
@@ -1865,57 +1865,57 @@ class De {
1865
1865
  });
1866
1866
  }
1867
1867
  }
1868
- const yt = () => {
1868
+ const vt = () => {
1869
1869
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1870
1870
  return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
1871
- }, mt = (r) => {
1871
+ }, At = (r) => {
1872
1872
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1873
1873
  return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
1874
- }, ue = (r) => {
1874
+ }, we = (r) => {
1875
1875
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1876
1876
  return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
1877
1877
  };
1878
- class vt extends Error {
1878
+ class Et extends Error {
1879
1879
  constructor(e) {
1880
1880
  super(e), this.name = "InteractiveEdgeError";
1881
1881
  }
1882
1882
  }
1883
- class Me {
1883
+ class Re {
1884
1884
  constructor(e, t) {
1885
- i(this, "svg");
1886
- i(this, "group");
1887
- i(this, "line");
1888
- i(this, "sourceArrow");
1889
- i(this, "targetArrow");
1890
- i(this, "handle", yt());
1891
- i(this, "onAfterRender");
1892
- i(this, "interactiveLine");
1893
- i(this, "interactiveSourceArrow", null);
1894
- i(this, "interactiveTargetArrow", null);
1895
- if (this.baseEdge = e, e instanceof Me)
1896
- throw new vt(
1885
+ o(this, "svg");
1886
+ o(this, "group");
1887
+ o(this, "line");
1888
+ o(this, "sourceArrow");
1889
+ o(this, "targetArrow");
1890
+ o(this, "handle", vt());
1891
+ o(this, "onAfterRender");
1892
+ o(this, "interactiveLine");
1893
+ o(this, "interactiveSourceArrow", null);
1894
+ o(this, "interactiveTargetArrow", null);
1895
+ if (this.baseEdge = e, e instanceof Re)
1896
+ throw new Et(
1897
1897
  "interactive edge can be configured only once"
1898
1898
  );
1899
1899
  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;
1900
- const s = (t == null ? void 0 : t.distance) ?? y.interactiveWidth;
1901
- 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) => {
1902
- this.interactiveLine.setAttribute("d", o.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", o.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", o.targetArrowPath);
1900
+ const s = (t == null ? void 0 : t.distance) ?? f.interactiveWidth;
1901
+ this.interactiveLine = At(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = we(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = we(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
1902
+ this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
1903
1903
  });
1904
1904
  }
1905
1905
  render(e) {
1906
1906
  this.baseEdge.render(e);
1907
1907
  }
1908
1908
  }
1909
- class sr {
1909
+ class dr {
1910
1910
  constructor(e, t) {
1911
- i(this, "group");
1912
- i(this, "line");
1913
- i(this, "sourceArrow");
1914
- i(this, "targetArrow");
1915
- i(this, "onAfterRender");
1916
- i(this, "svg");
1911
+ o(this, "group");
1912
+ o(this, "line");
1913
+ o(this, "sourceArrow");
1914
+ o(this, "targetArrow");
1915
+ o(this, "onAfterRender");
1916
+ o(this, "svg");
1917
1917
  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) => {
1918
- const o = s.edgePath.midpoint, n = `translate(${o.x}px, ${o.y}px)`;
1918
+ const i = s.edgePath.midpoint, n = `translate(${i.x}px, ${i.y}px)`;
1919
1919
  this.midpointElement.style.setProperty("transform", n);
1920
1920
  });
1921
1921
  }
@@ -1923,21 +1923,21 @@ class sr {
1923
1923
  this.baseShape.render(e);
1924
1924
  }
1925
1925
  }
1926
- class Le {
1926
+ class Ve {
1927
1927
  constructor(e) {
1928
- i(this, "onAfterNodeAdded");
1929
- i(this, "onAfterNodeUpdated");
1930
- i(this, "onAfterNodePriorityUpdated");
1931
- i(this, "onBeforeNodeRemoved");
1932
- i(this, "onAfterPortMarked");
1933
- i(this, "onAfterPortUpdated");
1934
- i(this, "onBeforePortUnmarked");
1935
- i(this, "onAfterEdgeAdded");
1936
- i(this, "onAfterEdgeShapeUpdated");
1937
- i(this, "onAfterEdgeUpdated");
1938
- i(this, "onAfterEdgePriorityUpdated");
1939
- i(this, "onBeforeEdgeRemoved");
1940
- i(this, "onBeforeClear");
1928
+ o(this, "onAfterNodeAdded");
1929
+ o(this, "onAfterNodeUpdated");
1930
+ o(this, "onAfterNodePriorityUpdated");
1931
+ o(this, "onBeforeNodeRemoved");
1932
+ o(this, "onAfterPortMarked");
1933
+ o(this, "onAfterPortUpdated");
1934
+ o(this, "onBeforePortUnmarked");
1935
+ o(this, "onAfterEdgeAdded");
1936
+ o(this, "onAfterEdgeShapeUpdated");
1937
+ o(this, "onAfterEdgeUpdated");
1938
+ o(this, "onAfterEdgePriorityUpdated");
1939
+ o(this, "onBeforeEdgeRemoved");
1940
+ o(this, "onBeforeClear");
1941
1941
  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;
1942
1942
  }
1943
1943
  hasNode(e) {
@@ -2019,11 +2019,11 @@ class Le {
2019
2019
  return this.graphStore.getNodeAdjacentEdgeIds(e);
2020
2020
  }
2021
2021
  }
2022
- class Re {
2022
+ class Fe {
2023
2023
  constructor(e) {
2024
- i(this, "onBeforeUpdated");
2025
- i(this, "onAfterUpdated");
2026
- i(this, "onAfterResize");
2024
+ o(this, "onBeforeUpdated");
2025
+ o(this, "onAfterUpdated");
2026
+ o(this, "onAfterResize");
2027
2027
  this.viewportStore = e, this.onBeforeUpdated = this.viewportStore.onBeforeUpdated, this.onAfterUpdated = this.viewportStore.onAfterUpdated, this.onAfterResize = this.viewportStore.onAfterResize;
2028
2028
  }
2029
2029
  getViewportMatrix() {
@@ -2042,45 +2042,45 @@ class Re {
2042
2042
  return this.viewportStore.createViewportCoords(e);
2043
2043
  }
2044
2044
  }
2045
- const Ve = (r, e) => {
2046
- const t = new Ae(), s = new Le(t), o = new Re(e), n = new me(t, e, r), a = {
2045
+ const Ie = (r, e) => {
2046
+ const t = new xe(), s = new Ve(t), i = new Fe(e), n = new Ae(t, e, r), a = {
2047
2047
  nodes: {
2048
- centerFn: Se,
2048
+ centerFn: Pe,
2049
2049
  priorityFn: () => 0
2050
2050
  },
2051
2051
  edges: {
2052
- shapeFactory: () => new De(),
2052
+ shapeFactory: () => new Le(),
2053
2053
  priorityFn: () => 0
2054
2054
  },
2055
2055
  ports: {
2056
2056
  direction: 0
2057
2057
  }
2058
2058
  };
2059
- return new ve(
2059
+ return new Ee(
2060
2060
  s,
2061
- o,
2061
+ i,
2062
2062
  t,
2063
2063
  e,
2064
2064
  n,
2065
2065
  a
2066
2066
  );
2067
2067
  };
2068
- class z {
2069
- constructor(e, t, s, o) {
2070
- i(this, "onAfterPortMarked", (e) => {
2068
+ class k {
2069
+ constructor(e, t, s, i) {
2070
+ o(this, "onAfterPortMarked", (e) => {
2071
2071
  const t = this.canvas.graph.getPort(e);
2072
2072
  this.canvas.graph.findPortIdsByElement(t.element).length === 1 && this.hookPortEvents(t.element);
2073
2073
  });
2074
- i(this, "onBeforePortUnmarked", (e) => {
2074
+ o(this, "onBeforePortUnmarked", (e) => {
2075
2075
  const t = this.canvas.graph.getPort(e);
2076
2076
  this.canvas.graph.findPortIdsByElement(t.element).length === 1 && this.unhookPortEvents(t.element);
2077
2077
  });
2078
- i(this, "onPortMouseDown", (e) => {
2078
+ o(this, "onPortMouseDown", (e) => {
2079
2079
  const t = e;
2080
2080
  if (!this.params.mouseDownEventVerifier(t))
2081
2081
  return;
2082
- const s = e.currentTarget, o = this.canvas.graph.findPortIdsByElement(s)[0];
2083
- this.params.onPortPointerDown(o, {
2082
+ const s = e.currentTarget, i = this.canvas.graph.findPortIdsByElement(s)[0];
2083
+ this.params.onPortPointerDown(i, {
2084
2084
  x: t.clientX,
2085
2085
  y: t.clientY
2086
2086
  }) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
@@ -2089,7 +2089,7 @@ class z {
2089
2089
  passive: !0
2090
2090
  }));
2091
2091
  });
2092
- i(this, "onWindowMouseMove", (e) => {
2092
+ o(this, "onWindowMouseMove", (e) => {
2093
2093
  if (!L(
2094
2094
  this.window,
2095
2095
  this.element,
@@ -2101,14 +2101,14 @@ class z {
2101
2101
  }
2102
2102
  this.params.onPointerMove({ x: e.clientX, y: e.clientY });
2103
2103
  });
2104
- i(this, "onWindowMouseUp", (e) => {
2104
+ o(this, "onWindowMouseUp", (e) => {
2105
2105
  this.params.mouseUpEventVerifier(e) && (this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
2106
2106
  });
2107
- i(this, "onPortTouchStart", (e) => {
2107
+ o(this, "onPortTouchStart", (e) => {
2108
2108
  const t = e;
2109
2109
  if (t.touches.length !== 1)
2110
2110
  return;
2111
- const s = t.touches[0], o = e.currentTarget, n = this.canvas.graph.findPortIdsByElement(o)[0];
2111
+ const s = t.touches[0], i = e.currentTarget, n = this.canvas.graph.findPortIdsByElement(i)[0];
2112
2112
  this.params.onPortPointerDown(n, {
2113
2113
  x: s.clientX,
2114
2114
  y: s.clientY
@@ -2120,7 +2120,7 @@ class z {
2120
2120
  passive: !0
2121
2121
  }));
2122
2122
  });
2123
- i(this, "onWindowTouchMove", (e) => {
2123
+ o(this, "onWindowTouchMove", (e) => {
2124
2124
  const t = e.touches[0];
2125
2125
  if (!L(
2126
2126
  this.window,
@@ -2133,23 +2133,23 @@ class z {
2133
2133
  }
2134
2134
  this.params.onPointerMove({ x: t.clientX, y: t.clientY });
2135
2135
  });
2136
- i(this, "onWindowTouchFinish", (e) => {
2136
+ o(this, "onWindowTouchFinish", (e) => {
2137
2137
  const t = e.changedTouches[0];
2138
2138
  this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
2139
2139
  });
2140
- i(this, "onBeforeClear", () => {
2140
+ o(this, "onBeforeClear", () => {
2141
2141
  this.canvas.graph.getAllPortIds().forEach((e) => {
2142
2142
  const t = this.canvas.graph.getPort(e);
2143
2143
  this.unhookPortEvents(t.element);
2144
2144
  });
2145
2145
  });
2146
- i(this, "onBeforeDestroy", () => {
2146
+ o(this, "onBeforeDestroy", () => {
2147
2147
  this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
2148
2148
  });
2149
- 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);
2149
+ this.canvas = e, this.element = t, this.window = s, this.params = i, 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);
2150
2150
  }
2151
- static configure(e, t, s, o) {
2152
- new z(e, t, s, o);
2151
+ static configure(e, t, s, i) {
2152
+ new k(e, t, s, i);
2153
2153
  }
2154
2154
  hookPortEvents(e) {
2155
2155
  e.addEventListener("mousedown", this.onPortMouseDown, {
@@ -2174,12 +2174,41 @@ class z {
2174
2174
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2175
2175
  }
2176
2176
  }
2177
- class Z {
2178
- constructor(e, t, s, o) {
2179
- i(this, "grabbedNode", null);
2180
- i(this, "maxNodePriority", 0);
2181
- i(this, "graph");
2182
- i(this, "onAfterNodeAdded", (e) => {
2177
+ class xt {
2178
+ constructor(e, t, s) {
2179
+ this.canvas = e, this.layoutAlgorithm = t, this.params = s;
2180
+ }
2181
+ apply() {
2182
+ const e = this.layoutAlgorithm.calculateCoordinates({
2183
+ graph: this.canvas.graph,
2184
+ viewport: this.canvas.viewport
2185
+ });
2186
+ this.params.onBeforeApplied(), e.forEach((t, s) => {
2187
+ this.params.staticNodeResolver(s) || this.canvas.updateNode(s, t);
2188
+ }), this.params.onAfterApplied();
2189
+ }
2190
+ }
2191
+ class St {
2192
+ constructor(e, t, s) {
2193
+ this.canvas = e, this.layoutAlgorithm = t, this.params = s;
2194
+ }
2195
+ apply(e) {
2196
+ const t = this.layoutAlgorithm.calculateNextCoordinates({
2197
+ graph: this.canvas.graph,
2198
+ viewport: this.canvas.viewport,
2199
+ dt: e
2200
+ });
2201
+ this.params.onBeforeApplied(), t.forEach((s, i) => {
2202
+ this.params.staticNodeResolver(i) || this.canvas.updateNode(i, s);
2203
+ }), this.params.onAfterApplied();
2204
+ }
2205
+ }
2206
+ class _ {
2207
+ constructor(e, t, s, i) {
2208
+ o(this, "grabbedNode", null);
2209
+ o(this, "maxNodePriority", 0);
2210
+ o(this, "graph");
2211
+ o(this, "onAfterNodeAdded", (e) => {
2183
2212
  this.updateMaxNodePriority(e);
2184
2213
  const { element: t } = this.graph.getNode(e);
2185
2214
  t.addEventListener("mousedown", this.onMouseDown, {
@@ -2188,50 +2217,50 @@ class Z {
2188
2217
  passive: !0
2189
2218
  });
2190
2219
  });
2191
- i(this, "onAfterNodeUpdated", (e) => {
2220
+ o(this, "onAfterNodeUpdated", (e) => {
2192
2221
  this.updateMaxNodePriority(e);
2193
2222
  });
2194
- i(this, "onBeforeNodeRemoved", (e) => {
2223
+ o(this, "onBeforeNodeRemoved", (e) => {
2195
2224
  const { element: t } = this.graph.getNode(e);
2196
2225
  t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
2197
2226
  });
2198
- i(this, "onBeforeDestroy", () => {
2227
+ o(this, "onBeforeDestroy", () => {
2199
2228
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2200
2229
  });
2201
- i(this, "onBeforeClear", () => {
2230
+ o(this, "onBeforeClear", () => {
2202
2231
  this.canvas.graph.getAllNodeIds().forEach((e) => {
2203
2232
  const { element: t } = this.canvas.graph.getNode(e);
2204
2233
  t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
2205
2234
  }), this.maxNodePriority = 0;
2206
2235
  });
2207
- i(this, "onMouseDown", (e) => {
2236
+ o(this, "onMouseDown", (e) => {
2208
2237
  const t = e;
2209
2238
  if (!this.params.mouseDownEventVerifier(t))
2210
2239
  return;
2211
- const s = e.currentTarget, o = this.graph.findNodeIdByElement(s), n = this.graph.getNode(o);
2212
- if (!this.params.nodeDragVerifier(o))
2240
+ const s = e.currentTarget, i = this.graph.findNodeIdByElement(s), n = this.graph.getNode(i);
2241
+ if (!this.params.nodeDragVerifier(i))
2213
2242
  return;
2214
- this.params.onNodeDragStarted(o), e.stopPropagation();
2243
+ this.params.onNodeDragStarted(i), e.stopPropagation();
2215
2244
  const h = this.calculateContentPoint({
2216
2245
  x: t.clientX,
2217
2246
  y: t.clientY
2218
2247
  });
2219
2248
  this.grabbedNode = {
2220
- nodeId: o,
2249
+ nodeId: i,
2221
2250
  dx: h.x - n.x,
2222
2251
  dy: h.y - n.y
2223
- }, $(this.element, this.params.dragCursor), this.moveNodeOnTop(o), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2252
+ }, B(this.element, this.params.dragCursor), this.moveNodeOnTop(i), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2224
2253
  passive: !0
2225
2254
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2226
2255
  passive: !0
2227
2256
  });
2228
2257
  });
2229
- i(this, "onTouchStart", (e) => {
2258
+ o(this, "onTouchStart", (e) => {
2230
2259
  const t = e;
2231
2260
  if (t.touches.length !== 1)
2232
2261
  return;
2233
2262
  e.stopPropagation();
2234
- const s = t.touches[0], o = e.currentTarget, n = this.canvas.graph.findNodeIdByElement(o), a = this.graph.getNode(n);
2263
+ const s = t.touches[0], i = e.currentTarget, n = this.canvas.graph.findNodeIdByElement(i), a = this.graph.getNode(n);
2235
2264
  if (!this.params.nodeDragVerifier({
2236
2265
  nodeId: n,
2237
2266
  element: a.element,
@@ -2255,7 +2284,7 @@ class Z {
2255
2284
  passive: !0
2256
2285
  });
2257
2286
  });
2258
- i(this, "onWindowMouseMove", (e) => {
2287
+ o(this, "onWindowMouseMove", (e) => {
2259
2288
  if (!L(
2260
2289
  this.window,
2261
2290
  this.element,
@@ -2270,10 +2299,10 @@ class Z {
2270
2299
  y: e.clientY
2271
2300
  });
2272
2301
  });
2273
- i(this, "onWindowMouseUp", (e) => {
2302
+ o(this, "onWindowMouseUp", (e) => {
2274
2303
  this.params.mouseUpEventVerifier(e) && this.cancelMouseDrag();
2275
2304
  });
2276
- i(this, "onWindowTouchMove", (e) => {
2305
+ o(this, "onWindowTouchMove", (e) => {
2277
2306
  if (e.touches.length !== 1)
2278
2307
  return;
2279
2308
  const t = e.touches[0];
@@ -2291,21 +2320,21 @@ class Z {
2291
2320
  y: t.clientY
2292
2321
  });
2293
2322
  });
2294
- i(this, "onWindowTouchFinish", () => {
2323
+ o(this, "onWindowTouchFinish", () => {
2295
2324
  this.cancelTouchDrag();
2296
2325
  });
2297
- 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);
2326
+ this.canvas = e, this.element = t, this.window = s, this.params = i, 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);
2298
2327
  }
2299
- static configure(e, t, s, o) {
2300
- new Z(e, t, s, o);
2328
+ static configure(e, t, s, i) {
2329
+ new _(e, t, s, i);
2301
2330
  }
2302
2331
  moveNode(e, t) {
2303
2332
  if (!this.graph.hasNode(e.nodeId))
2304
2333
  return;
2305
- const s = this.calculateContentPoint(t), o = {
2334
+ const s = this.calculateContentPoint(t), i = {
2306
2335
  x: s.x - e.dx,
2307
2336
  y: s.y - e.dy
2308
- }, n = this.adjustNodeCoords(o);
2337
+ }, n = this.adjustNodeCoords(i);
2309
2338
  this.canvas.updateNode(e.nodeId, {
2310
2339
  x: n.x,
2311
2340
  y: n.y
@@ -2315,15 +2344,15 @@ class Z {
2315
2344
  if (this.params.moveOnTop) {
2316
2345
  if (this.maxNodePriority++, this.params.moveEdgesOnTop) {
2317
2346
  const t = this.maxNodePriority;
2318
- this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((o) => {
2319
- this.canvas.updateEdge(o, { priority: t });
2347
+ this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((i) => {
2348
+ this.canvas.updateEdge(i, { priority: t });
2320
2349
  });
2321
2350
  }
2322
2351
  this.canvas.updateNode(e, { priority: this.maxNodePriority });
2323
2352
  }
2324
2353
  }
2325
2354
  cancelMouseDrag() {
2326
- this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, $(this.element, null), this.removeMouseDragListeners();
2355
+ this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, B(this.element, null), this.removeMouseDragListeners();
2327
2356
  }
2328
2357
  removeMouseDragListeners() {
2329
2358
  this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
@@ -2366,11 +2395,11 @@ class Z {
2366
2395
  return e;
2367
2396
  }
2368
2397
  }
2369
- const At = (r, e, t) => ({
2398
+ const bt = (r, e, t) => ({
2370
2399
  scale: r.scale,
2371
2400
  x: r.x + r.scale * e,
2372
2401
  y: r.y + r.scale * t
2373
- }), Et = (r, e, t, s) => ({
2402
+ }), Pt = (r, e, t, s) => ({
2374
2403
  scale: r.scale * e,
2375
2404
  x: r.scale * (1 - e) * t + r.x,
2376
2405
  y: r.scale * (1 - e) * s + r.y
@@ -2381,35 +2410,35 @@ const At = (r, e, t) => ({
2381
2410
  const s = e.reduce(
2382
2411
  (h, d) => [h[0] + d[0], h[1] + d[1]],
2383
2412
  [0, 0]
2384
- ), o = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - o[0], h[1] - o[1]]).reduce(
2413
+ ), i = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - i[0], h[1] - i[1]]).reduce(
2385
2414
  (h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
2386
2415
  0
2387
2416
  );
2388
2417
  return {
2389
- x: o[0],
2390
- y: o[1],
2418
+ x: i[0],
2419
+ y: i[1],
2391
2420
  scale: a / t,
2392
2421
  touchesCnt: t,
2393
2422
  touches: e
2394
2423
  };
2395
2424
  };
2396
2425
  class H {
2397
- constructor(e, t, s, o) {
2398
- i(this, "viewport");
2399
- i(this, "prevTouches", null);
2400
- i(this, "wheelFinishTimer", null);
2401
- i(this, "transformInProgress", !1);
2402
- i(this, "onBeforeDestroy", () => {
2426
+ constructor(e, t, s, i) {
2427
+ o(this, "viewport");
2428
+ o(this, "prevTouches", null);
2429
+ o(this, "wheelFinishTimer", null);
2430
+ o(this, "transformInProgress", !1);
2431
+ o(this, "onBeforeDestroy", () => {
2403
2432
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2404
2433
  });
2405
- i(this, "onMouseDown", (e) => {
2406
- this.element === null || !this.params.mouseDownEventVerifier(e) || ($(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2434
+ o(this, "onMouseDown", (e) => {
2435
+ this.element === null || !this.params.mouseDownEventVerifier(e) || (B(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2407
2436
  passive: !0
2408
2437
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2409
2438
  passive: !0
2410
2439
  }), this.startRegisteredTransform());
2411
2440
  });
2412
- i(this, "onWindowMouseMove", (e) => {
2441
+ o(this, "onWindowMouseMove", (e) => {
2413
2442
  const t = L(
2414
2443
  this.window,
2415
2444
  this.element,
@@ -2420,21 +2449,21 @@ class H {
2420
2449
  this.stopMouseDrag();
2421
2450
  return;
2422
2451
  }
2423
- const s = -e.movementX, o = -e.movementY;
2424
- this.moveViewport(s, o);
2452
+ const s = -e.movementX, i = -e.movementY;
2453
+ this.moveViewport(s, i);
2425
2454
  });
2426
- i(this, "onWindowMouseUp", (e) => {
2455
+ o(this, "onWindowMouseUp", (e) => {
2427
2456
  this.params.mouseUpEventVerifier(e) && this.stopMouseDrag();
2428
2457
  });
2429
- i(this, "onWheelScroll", (e) => {
2458
+ o(this, "onWheelScroll", (e) => {
2430
2459
  if (!this.params.mouseWheelEventVerifier(e))
2431
2460
  return;
2432
- 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);
2433
- this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, o, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2461
+ const { left: t, top: s } = this.element.getBoundingClientRect(), i = e.clientX - t, n = e.clientY - s, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
2462
+ this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2434
2463
  this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
2435
2464
  }, this.params.scaleWheelFinishTimeout);
2436
2465
  });
2437
- i(this, "onTouchStart", (e) => {
2466
+ o(this, "onTouchStart", (e) => {
2438
2467
  if (this.prevTouches !== null) {
2439
2468
  this.prevTouches = I(e);
2440
2469
  return;
@@ -2447,10 +2476,10 @@ class H {
2447
2476
  passive: !0
2448
2477
  }), this.startRegisteredTransform();
2449
2478
  });
2450
- i(this, "onWindowTouchMove", (e) => {
2479
+ o(this, "onWindowTouchMove", (e) => {
2451
2480
  const t = I(e);
2452
2481
  if (!t.touches.every(
2453
- (o) => L(this.window, this.element, o[0], o[1])
2482
+ (i) => L(this.window, this.element, i[0], i[1])
2454
2483
  )) {
2455
2484
  this.stopTouchDrag();
2456
2485
  return;
@@ -2459,18 +2488,18 @@ class H {
2459
2488
  -(t.x - this.prevTouches.x),
2460
2489
  -(t.y - this.prevTouches.y)
2461
2490
  ), t.touchesCnt === 2) {
2462
- 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);
2491
+ const { left: i, top: n } = this.element.getBoundingClientRect(), a = this.prevTouches.x - i, h = this.prevTouches.y - n, c = 1 / (t.scale / this.prevTouches.scale);
2463
2492
  this.scaleViewport(c, a, h);
2464
2493
  }
2465
2494
  this.prevTouches = t;
2466
2495
  });
2467
- i(this, "onWindowTouchFinish", (e) => {
2496
+ o(this, "onWindowTouchFinish", (e) => {
2468
2497
  e.touches.length > 0 ? this.prevTouches = I(e) : this.stopTouchDrag();
2469
2498
  });
2470
- i(this, "preventWheelScaleListener", (e) => {
2499
+ o(this, "preventWheelScaleListener", (e) => {
2471
2500
  e.preventDefault();
2472
2501
  });
2473
- this.canvas = e, this.element = t, this.window = s, this.params = o, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
2502
+ this.canvas = e, this.element = t, this.window = s, this.params = i, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
2474
2503
  passive: !1
2475
2504
  }), this.viewport = e.viewport, this.handleResize(), this.viewport.onAfterResize.subscribe(() => {
2476
2505
  this.handleResize();
@@ -2482,21 +2511,21 @@ class H {
2482
2511
  passive: !0
2483
2512
  }), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2484
2513
  }
2485
- static configure(e, t, s, o) {
2486
- new H(e, t, s, o);
2514
+ static configure(e, t, s, i) {
2515
+ new H(e, t, s, i);
2487
2516
  }
2488
2517
  moveViewport(e, t) {
2489
- const s = this.viewport.getViewportMatrix(), o = At(s, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2518
+ const s = this.viewport.getViewportMatrix(), i = bt(s, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2490
2519
  prevTransform: s,
2491
- nextTransform: o,
2520
+ nextTransform: i,
2492
2521
  canvasWidth: n,
2493
2522
  canvasHeight: a
2494
2523
  });
2495
2524
  this.performTransform(h);
2496
2525
  }
2497
2526
  scaleViewport(e, t, s) {
2498
- const o = this.canvas.viewport.getViewportMatrix(), n = Et(o, e, t, s), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2499
- prevTransform: o,
2527
+ const i = this.canvas.viewport.getViewportMatrix(), n = Pt(i, e, t, s), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2528
+ prevTransform: i,
2500
2529
  nextTransform: n,
2501
2530
  canvasWidth: a,
2502
2531
  canvasHeight: h
@@ -2504,7 +2533,7 @@ class H {
2504
2533
  this.performTransform(d);
2505
2534
  }
2506
2535
  stopMouseDrag() {
2507
- $(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
2536
+ B(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
2508
2537
  }
2509
2538
  removeMouseDragListeners() {
2510
2539
  this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
@@ -2525,28 +2554,28 @@ class H {
2525
2554
  this.transformInProgress = !1, this.params.onTransformFinished();
2526
2555
  }
2527
2556
  handleResize() {
2528
- const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.viewport.getDimensions(), o = this.params.transformPreprocessor({
2557
+ const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.viewport.getDimensions(), i = this.params.transformPreprocessor({
2529
2558
  prevTransform: e,
2530
2559
  nextTransform: e,
2531
2560
  canvasWidth: t,
2532
2561
  canvasHeight: s
2533
2562
  });
2534
- this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(o), this.params.onResizeTransformFinished();
2563
+ this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.params.onResizeTransformFinished();
2535
2564
  }
2536
2565
  }
2537
- class J {
2538
- constructor(e, t, s, o, n, a) {
2539
- i(this, "nodeHorizontal");
2540
- i(this, "nodeVertical");
2541
- i(this, "viewport");
2542
- i(this, "currentScale");
2543
- i(this, "loadedArea", {
2566
+ class ee {
2567
+ constructor(e, t, s, i, n, a) {
2568
+ o(this, "nodeHorizontal");
2569
+ o(this, "nodeVertical");
2570
+ o(this, "viewport");
2571
+ o(this, "currentScale");
2572
+ o(this, "loadedArea", {
2544
2573
  xFrom: 1 / 0,
2545
2574
  xTo: 1 / 0,
2546
2575
  yFrom: 1 / 0,
2547
2576
  yTo: 1 / 0
2548
2577
  });
2549
- i(this, "updateLoadedArea", (e) => {
2578
+ o(this, "updateLoadedArea", (e) => {
2550
2579
  this.loadedArea = {
2551
2580
  xFrom: e.x,
2552
2581
  xTo: e.x + e.width,
@@ -2554,31 +2583,31 @@ class J {
2554
2583
  yTo: e.y + e.height
2555
2584
  };
2556
2585
  });
2557
- i(this, "onAfterViewportUpdated", () => {
2586
+ o(this, "onAfterViewportUpdated", () => {
2558
2587
  this.userTransformInProgress || this.loadAreaAroundViewport();
2559
2588
  });
2560
- i(this, "userTransformInProgress", !1);
2589
+ o(this, "userTransformInProgress", !1);
2561
2590
  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(() => {
2562
2591
  this.scheduleLoadAreaAroundViewport();
2563
2592
  });
2564
2593
  const h = {
2565
- ...o,
2594
+ ...i,
2566
2595
  onResizeTransformStarted: () => {
2567
- this.userTransformInProgress = !0, o.onResizeTransformStarted();
2596
+ this.userTransformInProgress = !0, i.onResizeTransformStarted();
2568
2597
  },
2569
2598
  onResizeTransformFinished: () => {
2570
- this.userTransformInProgress = !1, o.onResizeTransformFinished();
2599
+ this.userTransformInProgress = !1, i.onResizeTransformFinished();
2571
2600
  },
2572
2601
  onBeforeTransformChange: () => {
2573
- this.userTransformInProgress = !0, o.onBeforeTransformChange();
2602
+ this.userTransformInProgress = !0, i.onBeforeTransformChange();
2574
2603
  },
2575
2604
  onTransformChange: () => {
2576
2605
  this.userTransformInProgress = !1;
2577
2606
  const d = this.currentScale;
2578
- this.currentScale = this.viewport.getViewportMatrix().scale, d !== this.currentScale && this.scheduleEnsureViewportAreaLoaded(), o.onTransformChange();
2607
+ this.currentScale = this.viewport.getViewportMatrix().scale, d !== this.currentScale && this.scheduleEnsureViewportAreaLoaded(), i.onTransformChange();
2579
2608
  },
2580
2609
  onTransformFinished: () => {
2581
- this.scheduleLoadAreaAroundViewport(), o.onTransformFinished();
2610
+ this.scheduleLoadAreaAroundViewport(), i.onTransformFinished();
2582
2611
  }
2583
2612
  };
2584
2613
  H.configure(
@@ -2588,12 +2617,12 @@ class J {
2588
2617
  h
2589
2618
  ), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
2590
2619
  }
2591
- static configure(e, t, s, o, n, a) {
2592
- new J(
2620
+ static configure(e, t, s, i, n, a) {
2621
+ new ee(
2593
2622
  e,
2594
2623
  t,
2595
2624
  s,
2596
- o,
2625
+ i,
2597
2626
  n,
2598
2627
  a
2599
2628
  );
@@ -2605,12 +2634,12 @@ class J {
2605
2634
  }
2606
2635
  scheduleEnsureViewportAreaLoaded() {
2607
2636
  setTimeout(() => {
2608
- 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;
2637
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: s, x: i, y: n } = this.viewport.getViewportMatrix(), a = e * s, h = t * s, d = i - this.nodeHorizontal, c = n - this.nodeVertical, g = i + a + this.nodeHorizontal, l = n + h + this.nodeVertical;
2609
2638
  this.loadedArea.xFrom < d && this.loadedArea.xTo > g && this.loadedArea.yFrom < c && this.loadedArea.yTo > l || this.loadAreaAroundViewport();
2610
2639
  });
2611
2640
  }
2612
2641
  loadAreaAroundViewport() {
2613
- 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;
2642
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: s, x: i, y: n } = this.viewport.getViewportMatrix(), a = e * s, h = t * s, d = i - a - this.nodeHorizontal, c = n - h - this.nodeVertical, g = 3 * a + 2 * this.nodeHorizontal, l = 3 * h + 2 * this.nodeVertical;
2614
2643
  this.trigger.emit({
2615
2644
  x: d,
2616
2645
  y: c,
@@ -2619,45 +2648,45 @@ class J {
2619
2648
  });
2620
2649
  }
2621
2650
  }
2622
- const xt = () => {
2651
+ const Nt = () => {
2623
2652
  const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2624
2653
  return r.style.position = "absolute", r.style.inset = "0", r;
2625
- }, St = () => {
2654
+ }, Tt = () => {
2626
2655
  const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2627
2656
  return r.setAttribute("fill", "url(#pattern)"), r;
2628
- }, bt = () => {
2657
+ }, Ct = () => {
2629
2658
  const r = document.createElementNS(
2630
2659
  "http://www.w3.org/2000/svg",
2631
2660
  "pattern"
2632
2661
  );
2633
2662
  return r.setAttribute("id", "pattern"), r;
2634
2663
  };
2635
- class _ {
2664
+ class te {
2636
2665
  constructor(e, t, s) {
2637
- i(this, "svg", xt());
2638
- i(this, "patternRenderingRectangle", St());
2639
- i(this, "pattern", bt());
2640
- i(this, "patternContent");
2641
- i(this, "tileWidth");
2642
- i(this, "tileHeight");
2643
- i(this, "halfTileWidth");
2644
- i(this, "halfTileHeight");
2645
- i(this, "maxViewportScale");
2646
- i(this, "visible", !1);
2647
- i(this, "onAfterTransformUpdated", () => {
2648
- 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})`;
2649
- this.pattern.setAttribute("patternTransform", o), this.updateVisibility();
2666
+ o(this, "svg", Nt());
2667
+ o(this, "patternRenderingRectangle", Tt());
2668
+ o(this, "pattern", Ct());
2669
+ o(this, "patternContent");
2670
+ o(this, "tileWidth");
2671
+ o(this, "tileHeight");
2672
+ o(this, "halfTileWidth");
2673
+ o(this, "halfTileHeight");
2674
+ o(this, "maxViewportScale");
2675
+ o(this, "visible", !1);
2676
+ o(this, "onAfterTransformUpdated", () => {
2677
+ const e = this.canvas.viewport.getContentMatrix(), t = e.x - this.halfTileWidth * e.scale, s = e.y - this.halfTileHeight * e.scale, i = `matrix(${e.scale}, 0, 0, ${e.scale}, ${t}, ${s})`;
2678
+ this.pattern.setAttribute("patternTransform", i), this.updateVisibility();
2650
2679
  });
2651
2680
  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;
2652
- const o = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2653
- this.patternContent.setAttribute("transform", o), this.pattern.appendChild(this.patternContent);
2681
+ const i = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2682
+ this.patternContent.setAttribute("transform", i), this.pattern.appendChild(this.patternContent);
2654
2683
  const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
2655
2684
  n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.updateDimensions(), this.canvas.viewport.onAfterResize.subscribe(() => {
2656
2685
  this.updateDimensions();
2657
2686
  }), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
2658
2687
  }
2659
2688
  static configure(e, t, s) {
2660
- new _(e, t, s);
2689
+ new te(e, t, s);
2661
2690
  }
2662
2691
  updateVisibility() {
2663
2692
  const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
@@ -2666,22 +2695,22 @@ class _ {
2666
2695
  updateDimensions() {
2667
2696
  const { width: e, height: t } = this.canvas.viewport.getDimensions();
2668
2697
  this.svg.setAttribute("width", `${e}`), this.svg.setAttribute("height", `${t}`), this.patternRenderingRectangle.setAttribute("width", `${e}`), this.patternRenderingRectangle.setAttribute("height", `${t}`);
2669
- const s = this.tileWidth / e, o = this.tileHeight / t;
2670
- this.pattern.setAttribute("width", `${s}`), this.pattern.setAttribute("height", `${o}`);
2698
+ const s = this.tileWidth / e, i = this.tileHeight / t;
2699
+ this.pattern.setAttribute("width", `${s}`), this.pattern.setAttribute("height", `${i}`);
2671
2700
  }
2672
2701
  }
2673
- class ee {
2674
- constructor(e, t, s, o, n) {
2675
- i(this, "overlayCanvas");
2676
- i(this, "staticPortId", null);
2677
- i(this, "isTargetDragging", !0);
2678
- i(this, "onEdgeCreated", (e) => {
2702
+ class re {
2703
+ constructor(e, t, s, i, n) {
2704
+ o(this, "overlayCanvas");
2705
+ o(this, "staticPortId", null);
2706
+ o(this, "isTargetDragging", !0);
2707
+ o(this, "onEdgeCreated", (e) => {
2679
2708
  this.params.onAfterEdgeCreated(e);
2680
2709
  });
2681
- this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = Ve(
2710
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ie(
2682
2711
  this.overlayLayer,
2683
2712
  this.viewportStore
2684
- ), z.configure(
2713
+ ), k.configure(
2685
2714
  this.canvas,
2686
2715
  this.overlayLayer,
2687
2716
  this.window,
@@ -2704,46 +2733,46 @@ class ee {
2704
2733
  }
2705
2734
  );
2706
2735
  }
2707
- static configure(e, t, s, o, n) {
2708
- new ee(
2736
+ static configure(e, t, s, i, n) {
2737
+ new re(
2709
2738
  e,
2710
2739
  t,
2711
2740
  s,
2712
- o,
2741
+ i,
2713
2742
  n
2714
2743
  );
2715
2744
  }
2716
2745
  grabPort(e, t, s) {
2717
- const o = this.canvas.graph.getPort(e);
2746
+ const i = this.canvas.graph.getPort(e);
2718
2747
  this.staticPortId = e;
2719
- 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({
2748
+ const n = i.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
2720
2749
  x: a - d.x,
2721
2750
  y: h - d.y
2722
2751
  }), g = this.canvas.viewport.createContentCoords({
2723
2752
  x: t.x - d.x,
2724
2753
  y: t.y - d.y
2725
2754
  }), l = {
2726
- overlayNodeId: T.StaticNodeId,
2755
+ overlayNodeId: N.StaticNodeId,
2727
2756
  portCoords: c,
2728
- portDirection: o.direction
2757
+ portDirection: i.direction
2729
2758
  }, u = {
2730
- overlayNodeId: T.DraggingNodeId,
2759
+ overlayNodeId: N.DraggingNodeId,
2731
2760
  portCoords: g,
2732
2761
  portDirection: this.params.dragPortDirection
2733
2762
  };
2734
2763
  this.isTargetDragging = s === "direct";
2735
- const [w, f] = this.isTargetDragging ? [l, u] : [u, l];
2736
- this.overlayCanvas.addNode(U(w)), this.overlayCanvas.addNode(U(f)), this.overlayCanvas.addEdge({
2764
+ const [w, y] = this.isTargetDragging ? [l, u] : [u, l];
2765
+ this.overlayCanvas.addNode($(w)), this.overlayCanvas.addNode($(y)), this.overlayCanvas.addEdge({
2737
2766
  from: w.overlayNodeId,
2738
- to: f.overlayNodeId,
2739
- shape: this.params.edgeShapeFactory(T.EdgeId)
2767
+ to: y.overlayNodeId,
2768
+ shape: this.params.edgeShapeFactory(N.EdgeId)
2740
2769
  });
2741
2770
  }
2742
2771
  resetDragState() {
2743
2772
  this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
2744
2773
  }
2745
2774
  tryCreateConnection(e) {
2746
- const t = xe(this.canvas.graph, e), s = this.staticPortId;
2775
+ const t = be(this.canvas.graph, e), s = this.staticPortId;
2747
2776
  if (t === null) {
2748
2777
  this.params.onEdgeCreationInterrupted({
2749
2778
  staticPortId: s,
@@ -2751,7 +2780,7 @@ class ee {
2751
2780
  });
2752
2781
  return;
2753
2782
  }
2754
- const o = this.isTargetDragging ? s : t, n = this.isTargetDragging ? t : s, a = { from: o, to: n }, h = this.params.connectionPreprocessor(a);
2783
+ const i = this.isTargetDragging ? s : t, n = this.isTargetDragging ? t : s, a = { from: i, to: n }, h = this.params.connectionPreprocessor(a);
2755
2784
  h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
2756
2785
  }
2757
2786
  moveDraggingPort(e) {
@@ -2759,25 +2788,25 @@ class ee {
2759
2788
  x: e.x - t.x,
2760
2789
  y: e.y - t.y
2761
2790
  });
2762
- this.overlayCanvas.updateNode(T.DraggingNodeId, {
2791
+ this.overlayCanvas.updateNode(N.DraggingNodeId, {
2763
2792
  x: s.x,
2764
2793
  y: s.y
2765
2794
  });
2766
2795
  }
2767
2796
  }
2768
- class te {
2769
- constructor(e, t, s, o, n) {
2770
- i(this, "overlayCanvas");
2771
- i(this, "staticPortId", null);
2772
- i(this, "isTargetDragging", !0);
2773
- i(this, "draggingEdgePayload", null);
2774
- i(this, "onEdgeReattached", (e) => {
2797
+ class se {
2798
+ constructor(e, t, s, i, n) {
2799
+ o(this, "overlayCanvas");
2800
+ o(this, "staticPortId", null);
2801
+ o(this, "isTargetDragging", !0);
2802
+ o(this, "draggingEdgePayload", null);
2803
+ o(this, "onEdgeReattached", (e) => {
2775
2804
  this.params.onAfterEdgeReattached(e);
2776
2805
  });
2777
- this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = Ve(
2806
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ie(
2778
2807
  this.overlayLayer,
2779
2808
  this.viewportStore
2780
- ), z.configure(
2809
+ ), k.configure(
2781
2810
  this.canvas,
2782
2811
  this.overlayLayer,
2783
2812
  this.window,
@@ -2797,12 +2826,12 @@ class te {
2797
2826
  }
2798
2827
  );
2799
2828
  }
2800
- static configure(e, t, s, o, n) {
2801
- new te(
2829
+ static configure(e, t, s, i, n) {
2830
+ new se(
2802
2831
  e,
2803
2832
  t,
2804
2833
  s,
2805
- o,
2834
+ i,
2806
2835
  n
2807
2836
  );
2808
2837
  }
@@ -2810,7 +2839,7 @@ class te {
2810
2839
  const s = this.params.draggingEdgeResolver(e);
2811
2840
  if (s === null || !this.canvas.graph.hasEdge(s))
2812
2841
  return !1;
2813
- const o = this.canvas.graph.getEdge(s), n = e === o.from, a = e === o.to, h = n ? o.to : o.from;
2842
+ const i = this.canvas.graph.getEdge(s), n = e === i.from, a = e === i.to, h = n ? i.to : i.from;
2814
2843
  this.staticPortId = h, this.isTargetDragging = a;
2815
2844
  const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
2816
2845
  x: g.x + g.width / 2,
@@ -2818,32 +2847,32 @@ class te {
2818
2847
  }, u = this.overlayLayer.getBoundingClientRect(), w = this.canvas.viewport.createContentCoords({
2819
2848
  x: l.x - u.x,
2820
2849
  y: l.y - u.y
2821
- }), f = this.canvas.viewport.createContentCoords({
2850
+ }), y = this.canvas.viewport.createContentCoords({
2822
2851
  x: t.x - u.x,
2823
2852
  y: t.y - u.y
2824
2853
  });
2825
2854
  this.draggingEdgePayload = {
2826
2855
  id: s,
2827
- from: o.from,
2828
- to: o.to,
2829
- shape: o.shape,
2830
- priority: o.priority
2856
+ from: i.from,
2857
+ to: i.to,
2858
+ shape: i.shape,
2859
+ priority: i.priority
2831
2860
  }, this.canvas.removeEdge(s);
2832
2861
  const E = {
2833
- overlayNodeId: T.StaticNodeId,
2862
+ overlayNodeId: N.StaticNodeId,
2834
2863
  portCoords: w,
2835
2864
  portDirection: c.direction
2836
2865
  }, S = {
2837
- overlayNodeId: T.DraggingNodeId,
2838
- portCoords: f,
2866
+ overlayNodeId: N.DraggingNodeId,
2867
+ portCoords: y,
2839
2868
  portDirection: d.direction
2840
- }, [b, C] = this.isTargetDragging ? [E, S] : [S, E];
2841
- this.overlayCanvas.addNode(U(b)), this.overlayCanvas.addNode(U(C));
2842
- const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(T.EdgeId) : o.shape;
2869
+ }, [b, T] = this.isTargetDragging ? [E, S] : [S, E];
2870
+ this.overlayCanvas.addNode($(b)), this.overlayCanvas.addNode($(T));
2871
+ const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(N.EdgeId) : i.shape;
2843
2872
  return this.overlayCanvas.addEdge({
2844
- id: T.EdgeId,
2873
+ id: N.EdgeId,
2845
2874
  from: b.overlayNodeId,
2846
- to: C.overlayNodeId,
2875
+ to: T.overlayNodeId,
2847
2876
  shape: P
2848
2877
  }), !0;
2849
2878
  }
@@ -2854,15 +2883,15 @@ class te {
2854
2883
  const t = this.overlayLayer.getBoundingClientRect(), s = {
2855
2884
  x: e.x - t.x,
2856
2885
  y: e.y - t.y
2857
- }, o = this.canvas.viewport.createContentCoords(s);
2858
- this.overlayCanvas.updateNode(T.DraggingNodeId, {
2859
- x: o.x,
2860
- y: o.y
2886
+ }, i = this.canvas.viewport.createContentCoords(s);
2887
+ this.overlayCanvas.updateNode(N.DraggingNodeId, {
2888
+ x: i.x,
2889
+ y: i.y
2861
2890
  });
2862
2891
  }
2863
2892
  tryCreateConnection(e) {
2864
- const t = xe(this.canvas.graph, e);
2865
- if (this.overlayCanvas.removeEdge(T.EdgeId), t === null) {
2893
+ const t = be(this.canvas.graph, e);
2894
+ if (this.overlayCanvas.removeEdge(N.EdgeId), t === null) {
2866
2895
  const d = this.draggingEdgePayload;
2867
2896
  this.params.onEdgeReattachInterrupted({
2868
2897
  id: d.id,
@@ -2873,10 +2902,10 @@ class te {
2873
2902
  });
2874
2903
  return;
2875
2904
  }
2876
- const [s, o] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
2905
+ const [s, i] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
2877
2906
  id: n.id,
2878
2907
  from: s,
2879
- to: o,
2908
+ to: i,
2880
2909
  shape: n.shape,
2881
2910
  priority: n.priority
2882
2911
  }, h = this.params.connectionPreprocessor(a);
@@ -2894,46 +2923,29 @@ class te {
2894
2923
  }
2895
2924
  }
2896
2925
  }
2897
- class re {
2898
- constructor(e, t, s) {
2899
- this.canvas = e, this.layoutAlgorithm = t, this.trigger = s, this.trigger.subscribe(() => {
2900
- this.applyLayout();
2926
+ class oe {
2927
+ constructor(e, t) {
2928
+ this.applier = e, this.trigger = t, this.trigger.subscribe(() => {
2929
+ this.applier.apply();
2901
2930
  });
2902
2931
  }
2903
- static configure(e, t, s) {
2904
- new re(
2905
- e,
2906
- t,
2907
- s
2908
- );
2909
- }
2910
- applyLayout() {
2911
- this.layoutAlgorithm.calculateCoordinates({
2912
- graph: this.canvas.graph,
2913
- viewport: this.canvas.viewport
2914
- }).forEach((t, s) => {
2915
- this.canvas.updateNode(s, t);
2916
- });
2932
+ static configure(e, t) {
2933
+ new oe(e, t);
2917
2934
  }
2918
2935
  }
2919
2936
  class O {
2920
2937
  constructor(e, t, s) {
2921
- i(this, "applyScheduled", !1);
2922
- i(this, "apply", () => {
2923
- this.applyScheduled = !1, this.layoutAlgorithm.calculateCoordinates({
2924
- graph: this.canvas.graph,
2925
- viewport: this.canvas.viewport
2926
- }).forEach((t, s) => {
2927
- this.canvas.updateNode(s, t);
2928
- });
2938
+ o(this, "applyScheduled", !1);
2939
+ o(this, "apply", () => {
2940
+ this.applyScheduled = !1, this.applier.apply();
2929
2941
  });
2930
- this.canvas = e, this.layoutAlgorithm = t, this.defererFn = s, this.canvas.graph.onAfterNodeAdded.subscribe(() => {
2942
+ this.graph = e, this.applier = t, this.defererFn = s, this.graph.onAfterNodeAdded.subscribe(() => {
2931
2943
  this.scheduleApply();
2932
- }), this.canvas.graph.onBeforeNodeRemoved.subscribe(() => {
2944
+ }), this.graph.onBeforeNodeRemoved.subscribe(() => {
2933
2945
  this.scheduleApply();
2934
- }), this.canvas.graph.onAfterEdgeAdded.subscribe(() => {
2946
+ }), this.graph.onAfterEdgeAdded.subscribe(() => {
2935
2947
  this.scheduleApply();
2936
- }), this.canvas.graph.onBeforeEdgeRemoved.subscribe(() => {
2948
+ }), this.graph.onBeforeEdgeRemoved.subscribe(() => {
2937
2949
  this.scheduleApply();
2938
2950
  });
2939
2951
  }
@@ -2948,25 +2960,28 @@ class O {
2948
2960
  this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
2949
2961
  }
2950
2962
  }
2951
- class Pt {
2963
+ class Dt {
2952
2964
  static configure(e, t) {
2953
- const s = t.applyOn;
2965
+ const s = t.applyOn, i = new xt(e, t.algorithm, {
2966
+ staticNodeResolver: t.staticNodeResolver,
2967
+ onBeforeApplied: t.onBeforeApplied,
2968
+ onAfterApplied: t.onAfterApplied
2969
+ });
2954
2970
  switch (s.type) {
2955
2971
  case "manual": {
2956
- re.configure(
2957
- e,
2958
- t.algorithm,
2972
+ oe.configure(
2973
+ i,
2959
2974
  s.trigger
2960
2975
  );
2961
2976
  break;
2962
2977
  }
2963
2978
  case "topologyChangeMacrotask": {
2964
2979
  O.configure(
2965
- e,
2966
- t.algorithm,
2967
- (o) => {
2980
+ e.graph,
2981
+ i,
2982
+ (n) => {
2968
2983
  setTimeout(() => {
2969
- o();
2984
+ n();
2970
2985
  });
2971
2986
  }
2972
2987
  );
@@ -2974,11 +2989,11 @@ class Pt {
2974
2989
  }
2975
2990
  case "topologyChangeMicrotask": {
2976
2991
  O.configure(
2977
- e,
2978
- t.algorithm,
2979
- (o) => {
2992
+ e.graph,
2993
+ i,
2994
+ (n) => {
2980
2995
  queueMicrotask(() => {
2981
- o();
2996
+ n();
2982
2997
  });
2983
2998
  }
2984
2999
  );
@@ -2987,10 +3002,10 @@ class Pt {
2987
3002
  }
2988
3003
  }
2989
3004
  }
2990
- class Tt {
3005
+ class Mt {
2991
3006
  constructor(e, t) {
2992
- i(this, "previousTimeStamp");
2993
- i(this, "step", (e) => {
3007
+ o(this, "previousTimeStamp");
3008
+ o(this, "step", (e) => {
2994
3009
  if (this.previousTimeStamp === void 0)
2995
3010
  this.previousTimeStamp = e;
2996
3011
  else {
@@ -3002,62 +3017,61 @@ class Tt {
3002
3017
  this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
3003
3018
  }
3004
3019
  }
3005
- class se {
3006
- constructor(e, t, s, o) {
3007
- i(this, "step", (e) => {
3008
- this.algorithm.calculateNextCoordinates({
3009
- graph: this.canvas.graph,
3010
- dt: e,
3011
- viewport: this.canvas.viewport
3012
- }).forEach((s, o) => {
3013
- this.staticNodes.has(o) || this.canvas.updateNode(o, { x: s.x, y: s.y });
3014
- });
3020
+ class ie {
3021
+ constructor(e, t, s) {
3022
+ o(this, "applier");
3023
+ o(this, "step", (e) => {
3024
+ this.applier.apply(e);
3015
3025
  });
3016
- this.canvas = e, this.algorithm = t, this.staticNodes = s, this.win = o, new Tt(this.win, this.step);
3026
+ this.win = s, this.applier = new St(e, t.algorithm, {
3027
+ staticNodeResolver: t.staticNodeResolver,
3028
+ onBeforeApplied: t.onBeforeApplied,
3029
+ onAfterApplied: t.onAfterApplied
3030
+ }), new Mt(this.win, this.step);
3017
3031
  }
3018
- static configure(e, t, s, o) {
3019
- new se(e, t, s, o);
3032
+ static configure(e, t, s) {
3033
+ new ie(e, t, s);
3020
3034
  }
3021
3035
  }
3022
- const Ct = () => {
3036
+ const Lt = () => {
3023
3037
  const r = document.createElement("div");
3024
3038
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
3025
- }, Y = () => {
3039
+ }, j = () => {
3026
3040
  const r = document.createElement("div");
3027
3041
  return r.style.position = "absolute", r.style.inset = "0", r;
3028
- }, pe = () => {
3029
- const r = Y();
3042
+ }, ye = () => {
3043
+ const r = j();
3030
3044
  return r.style.pointerEvents = "none", r;
3031
3045
  };
3032
- class Nt {
3046
+ class Rt {
3033
3047
  constructor(e) {
3034
- i(this, "background", Y());
3035
- i(this, "main", Y());
3036
- i(this, "overlayConnectablePorts", pe());
3037
- i(this, "overlayDraggableEdges", pe());
3038
- i(this, "host", Ct());
3048
+ o(this, "background", j());
3049
+ o(this, "main", j());
3050
+ o(this, "overlayConnectablePorts", ye());
3051
+ o(this, "overlayDraggableEdges", ye());
3052
+ o(this, "host", Lt());
3039
3053
  this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
3040
3054
  }
3041
3055
  destroy() {
3042
3056
  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);
3043
3057
  }
3044
3058
  }
3045
- const G = (r) => () => r, we = G(0), Dt = () => {
3059
+ const K = (r) => () => r, fe = K(0), Vt = () => {
3046
3060
  let r = 0;
3047
3061
  return () => r++;
3048
- }, Mt = (r, e) => {
3049
- let t = we, s = we;
3050
- const o = Dt();
3051
- 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), {
3062
+ }, Ft = (r, e) => {
3063
+ let t = fe, s = fe;
3064
+ const i = Vt();
3065
+ return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = K(r)), typeof e == "number" && (s = K(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
3052
3066
  nodesPriorityFn: t,
3053
3067
  edgesPriorityFn: s
3054
3068
  };
3055
- }, oe = (r) => {
3069
+ }, ne = (r) => {
3056
3070
  if (typeof r == "function")
3057
3071
  return r;
3058
3072
  switch (r.type) {
3059
3073
  case "straight":
3060
- return () => new wt({
3074
+ return () => new ft({
3061
3075
  color: r.color,
3062
3076
  width: r.width,
3063
3077
  arrowLength: r.arrowLength,
@@ -3071,7 +3085,7 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3071
3085
  detourDirection: r.detourDirection
3072
3086
  });
3073
3087
  case "horizontal":
3074
- return () => new pt({
3088
+ return () => new yt({
3075
3089
  color: r.color,
3076
3090
  width: r.width,
3077
3091
  arrowLength: r.arrowLength,
@@ -3084,7 +3098,7 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3084
3098
  detourDistance: r.detourDistance
3085
3099
  });
3086
3100
  case "vertical":
3087
- return () => new ft({
3101
+ return () => new mt({
3088
3102
  color: r.color,
3089
3103
  width: r.width,
3090
3104
  arrowLength: r.arrowLength,
@@ -3097,7 +3111,7 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3097
3111
  detourDistance: r.detourDistance
3098
3112
  });
3099
3113
  case "direct":
3100
- return () => new De({
3114
+ return () => new Le({
3101
3115
  color: r.color,
3102
3116
  width: r.width,
3103
3117
  arrowLength: r.arrowLength,
@@ -3108,7 +3122,7 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3108
3122
  targetOffset: r.targetOffset
3109
3123
  });
3110
3124
  default:
3111
- return () => new ut({
3125
+ return () => new wt({
3112
3126
  color: r.color,
3113
3127
  width: r.width,
3114
3128
  arrowLength: r.arrowLength,
@@ -3122,31 +3136,31 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3122
3136
  detourDirection: r.detourDirection
3123
3137
  });
3124
3138
  }
3125
- }, Lt = (r) => {
3126
- var t, s, o, n, a;
3127
- const e = Mt(
3139
+ }, It = (r) => {
3140
+ var t, s, i, n, a;
3141
+ const e = Ft(
3128
3142
  (t = r.nodes) == null ? void 0 : t.priority,
3129
3143
  (s = r.edges) == null ? void 0 : s.priority
3130
3144
  );
3131
3145
  return {
3132
3146
  nodes: {
3133
- centerFn: ((o = r.nodes) == null ? void 0 : o.centerFn) ?? Se,
3147
+ centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? Pe,
3134
3148
  priorityFn: e.nodesPriorityFn
3135
3149
  },
3136
3150
  ports: {
3137
3151
  direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
3138
3152
  },
3139
3153
  edges: {
3140
- shapeFactory: oe(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
3154
+ shapeFactory: ne(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
3141
3155
  priorityFn: e.edgesPriorityFn
3142
3156
  }
3143
3157
  };
3144
- }, Rt = (r) => {
3145
- var w, f, E, S, b, C;
3158
+ }, Bt = (r) => {
3159
+ var w, y, E, S, b, T;
3146
3160
  const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
3147
- }), t = ((f = r.events) == null ? void 0 : f.onNodeDrag) ?? (() => {
3148
- }), s = r.nodeDragVerifier ?? (() => !0), o = ((E = r.events) == null ? void 0 : E.onNodeDragFinished) ?? (() => {
3149
- }), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (S = r.mouse) == null ? void 0 : S.dragCursor, d = h !== void 0 ? h : "grab", c = (b = r.mouse) == null ? void 0 : b.mouseDownEventVerifier, g = c !== void 0 ? c : (P) => P.button === 0, l = (C = r.mouse) == null ? void 0 : C.mouseUpEventVerifier, u = l !== void 0 ? l : (P) => P.button === 0;
3161
+ }), t = ((y = r.events) == null ? void 0 : y.onNodeDrag) ?? (() => {
3162
+ }), s = r.nodeDragVerifier ?? (() => !0), i = ((E = r.events) == null ? void 0 : E.onNodeDragFinished) ?? (() => {
3163
+ }), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (S = r.mouse) == null ? void 0 : S.dragCursor, d = h !== void 0 ? h : "grab", c = (b = r.mouse) == null ? void 0 : b.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;
3150
3164
  return {
3151
3165
  moveOnTop: n,
3152
3166
  moveEdgesOnTop: a,
@@ -3157,25 +3171,25 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3157
3171
  onNodeDragStarted: e,
3158
3172
  onNodeDrag: t,
3159
3173
  nodeDragVerifier: s,
3160
- onNodeDragFinished: o
3174
+ onNodeDragFinished: i
3161
3175
  };
3162
- }, Vt = (r) => {
3163
- 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;
3176
+ }, $t = (r) => {
3177
+ 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, i = r.maxY !== null ? r.maxY : 1 / 0;
3164
3178
  return (n) => {
3165
3179
  let a = n.nextTransform.x, h = n.nextTransform.y;
3166
3180
  a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
3167
3181
  const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
3168
3182
  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));
3169
- const g = n.canvasHeight * n.prevTransform.scale, l = o - g;
3183
+ const g = n.canvasHeight * n.prevTransform.scale, l = i - g;
3170
3184
  return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
3171
3185
  };
3172
- }, Ft = (r) => {
3173
- const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, o = t !== null ? 1 / t : 1 / 0;
3186
+ }, Ut = (r) => {
3187
+ const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
3174
3188
  return (n) => {
3175
3189
  const a = n.prevTransform, h = n.nextTransform;
3176
3190
  let d = h.scale, c = h.x, g = h.y;
3177
- if (h.scale > o && h.scale > a.scale) {
3178
- d = Math.max(a.scale, o), c = a.x, g = a.y;
3191
+ if (h.scale > i && h.scale > a.scale) {
3192
+ d = Math.max(a.scale, i), c = a.x, g = a.y;
3179
3193
  const l = (d - a.scale) / (h.scale - a.scale);
3180
3194
  c = a.x + (h.x - a.x) * l, g = a.y + (h.y - a.y) * l;
3181
3195
  }
@@ -3190,7 +3204,7 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3190
3204
  y: g
3191
3205
  };
3192
3206
  };
3193
- }, It = (r) => (e) => r.reduce(
3207
+ }, Ot = (r) => (e) => r.reduce(
3194
3208
  (t, s) => s({
3195
3209
  prevTransform: e.prevTransform,
3196
3210
  nextTransform: t,
@@ -3198,91 +3212,91 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3198
3212
  canvasHeight: e.canvasHeight
3199
3213
  }),
3200
3214
  e.nextTransform
3201
- ), fe = (r) => {
3215
+ ), me = (r) => {
3202
3216
  if (typeof r == "function")
3203
3217
  return r;
3204
3218
  switch (r.type) {
3205
3219
  case "scale-limit":
3206
- return Ft({
3220
+ return Ut({
3207
3221
  minContentScale: r.minContentScale ?? 0,
3208
3222
  maxContentScale: r.maxContentScale ?? 1 / 0
3209
3223
  });
3210
3224
  case "shift-limit":
3211
- return Vt({
3225
+ return $t({
3212
3226
  minX: r.minX ?? -1 / 0,
3213
3227
  maxX: r.maxX ?? 1 / 0,
3214
3228
  minY: r.minY ?? -1 / 0,
3215
3229
  maxY: r.maxY ?? 1 / 0
3216
3230
  });
3217
3231
  }
3218
- }, ye = (r) => {
3219
- var f, E, S, b, C, P, R, V, ie, ne, ae, he;
3220
- const e = (f = r == null ? void 0 : r.scale) == null ? void 0 : f.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
3221
- let o;
3222
- s !== void 0 ? Array.isArray(s) ? o = It(
3232
+ }, ve = (r) => {
3233
+ var y, E, S, b, T, P, R, V, ae, he, de, ce;
3234
+ 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;
3235
+ let i;
3236
+ s !== void 0 ? Array.isArray(s) ? i = Ot(
3223
3237
  s.map(
3224
- (N) => fe(N)
3238
+ (C) => me(C)
3225
3239
  )
3226
- ) : o = fe(s) : o = (N) => N.nextTransform;
3240
+ ) : i = me(s) : i = (C) => C.nextTransform;
3227
3241
  const n = ((E = r == null ? void 0 : r.shift) == null ? void 0 : E.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((S = r == null ? void 0 : r.events) == null ? void 0 : S.onBeforeTransformChange) ?? (() => {
3228
3242
  }), h = ((b = r == null ? void 0 : r.events) == null ? void 0 : b.onTransformChange) ?? (() => {
3229
- }), d = (C = r == null ? void 0 : r.shift) == null ? void 0 : C.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;
3243
+ }), d = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseDownEventVerifier, c = d !== void 0 ? d : (C) => C.button === 0, g = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseUpEventVerifier, l = g !== void 0 ? g : (C) => C.button === 0, u = (R = r == null ? void 0 : r.scale) == null ? void 0 : R.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
3230
3244
  return {
3231
3245
  wheelSensitivity: t,
3232
3246
  onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
3233
3247
  }),
3234
- onTransformFinished: ((ie = r == null ? void 0 : r.events) == null ? void 0 : ie.onTransformFinished) ?? (() => {
3248
+ onTransformFinished: ((ae = r == null ? void 0 : r.events) == null ? void 0 : ae.onTransformFinished) ?? (() => {
3235
3249
  }),
3236
3250
  onBeforeTransformChange: a,
3237
3251
  onTransformChange: h,
3238
- transformPreprocessor: o,
3252
+ transformPreprocessor: i,
3239
3253
  shiftCursor: n,
3240
3254
  mouseDownEventVerifier: c,
3241
3255
  mouseUpEventVerifier: l,
3242
3256
  mouseWheelEventVerifier: w,
3243
- scaleWheelFinishTimeout: ((ne = r == null ? void 0 : r.scale) == null ? void 0 : ne.wheelFinishTimeout) ?? 500,
3244
- onResizeTransformStarted: ((ae = r == null ? void 0 : r.events) == null ? void 0 : ae.onResizeTransformStarted) ?? (() => {
3257
+ scaleWheelFinishTimeout: ((he = r == null ? void 0 : r.scale) == null ? void 0 : he.wheelFinishTimeout) ?? 500,
3258
+ onResizeTransformStarted: ((de = r == null ? void 0 : r.events) == null ? void 0 : de.onResizeTransformStarted) ?? (() => {
3245
3259
  }),
3246
- onResizeTransformFinished: ((he = r == null ? void 0 : r.events) == null ? void 0 : he.onResizeTransformFinished) ?? (() => {
3260
+ onResizeTransformFinished: ((ce = r == null ? void 0 : r.events) == null ? void 0 : ce.onResizeTransformFinished) ?? (() => {
3247
3261
  })
3248
3262
  };
3249
- }, $t = (r, e) => {
3263
+ }, Wt = (r, e) => {
3250
3264
  const t = document.createElementNS(
3251
3265
  "http://www.w3.org/2000/svg",
3252
3266
  "circle"
3253
3267
  );
3254
3268
  return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
3255
- }, Ut = (r) => r instanceof SVGElement ? r : $t(
3269
+ }, zt = (r) => r instanceof SVGElement ? r : Wt(
3256
3270
  (r == null ? void 0 : r.radius) ?? 1.5,
3257
3271
  (r == null ? void 0 : r.color) ?? "#d8d8d8"
3258
- ), Bt = (r) => {
3259
- const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, o = Ut(r.renderer ?? {});
3272
+ ), kt = (r) => {
3273
+ const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = zt(r.renderer ?? {});
3260
3274
  return {
3261
3275
  tileWidth: t,
3262
3276
  tileHeight: s,
3263
- renderer: o,
3277
+ renderer: i,
3264
3278
  maxViewportScale: r.maxViewportScale ?? 10
3265
3279
  };
3266
- }, Ot = (r, e, t) => {
3280
+ }, Ht = (r, e, t) => {
3267
3281
  var c, g, l;
3268
- const s = () => "direct", o = (u) => u, n = (u) => u.button === 0, a = () => {
3282
+ const s = () => "direct", i = (u) => u, n = (u) => u.button === 0, a = () => {
3269
3283
  }, h = () => {
3270
3284
  }, d = () => {
3271
3285
  };
3272
3286
  return {
3273
3287
  connectionTypeResolver: r.connectionTypeResolver ?? s,
3274
- connectionPreprocessor: r.connectionPreprocessor ?? o,
3288
+ connectionPreprocessor: r.connectionPreprocessor ?? i,
3275
3289
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
3276
3290
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
3277
3291
  onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
3278
3292
  onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
3279
3293
  onEdgeCreationPrevented: ((l = r.events) == null ? void 0 : l.onEdgeCreationPrevented) ?? h,
3280
3294
  dragPortDirection: r.dragPortDirection ?? t,
3281
- edgeShapeFactory: r.edgeShape !== void 0 ? oe(r.edgeShape) : e
3295
+ edgeShapeFactory: r.edgeShape !== void 0 ? ne(r.edgeShape) : e
3282
3296
  };
3283
- }, Wt = (r, e) => {
3297
+ }, Xt = (r, e) => {
3284
3298
  var c, g, l;
3285
- const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, o = (u) => u.button === 0, n = (u) => {
3299
+ const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, i = (u) => u.button === 0, n = (u) => {
3286
3300
  const w = e.getPortAdjacentEdgeIds(u);
3287
3301
  return w.length > 0 ? w[w.length - 1] : null;
3288
3302
  }, a = () => {
@@ -3292,17 +3306,17 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3292
3306
  return {
3293
3307
  connectionPreprocessor: r.connectionPreprocessor ?? t,
3294
3308
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
3295
- mouseUpEventVerifier: r.mouseUpEventVerifier ?? o,
3309
+ mouseUpEventVerifier: r.mouseUpEventVerifier ?? i,
3296
3310
  draggingEdgeResolver: r.draggingEdgeResolver ?? n,
3297
- draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? oe(r.draggingEdgeShape) : null,
3311
+ draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ne(r.draggingEdgeShape) : null,
3298
3312
  onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
3299
3313
  onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
3300
3314
  onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
3301
3315
  };
3302
- }, kt = (r) => ({
3316
+ }, Yt = (r) => ({
3303
3317
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
3304
3318
  nodeHorizontalRadius: r.nodeContainingRadius.horizontal
3305
- }), zt = (r) => {
3319
+ }), Gt = (r) => {
3306
3320
  var e, t;
3307
3321
  return {
3308
3322
  onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
@@ -3311,28 +3325,43 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3311
3325
  })
3312
3326
  };
3313
3327
  };
3314
- class Ht extends Error {
3328
+ class jt extends Error {
3315
3329
  constructor() {
3316
3330
  super(...arguments);
3317
- i(this, "name", "CanvasBuilderError");
3331
+ o(this, "name", "CanvasBuilderError");
3318
3332
  }
3319
3333
  }
3320
- class Fe {
3334
+ const v = Object.freeze({
3335
+ seed: "HTMLGraph is awesome",
3336
+ maxTimeDeltaSec: 0.01,
3337
+ nodeCharge: 1e5,
3338
+ nodeMass: 1,
3339
+ edgeEquilibriumLength: 300,
3340
+ edgeStiffness: 1e3,
3341
+ dtSec: 0.01,
3342
+ maxIterations: 1e3,
3343
+ convergenceVelocity: 10,
3344
+ maxForce: 1e7,
3345
+ nodeForceCoefficient: 1,
3346
+ barnesHutAreaRadiusThreshold: 0.01,
3347
+ barnesHutTheta: 1
3348
+ });
3349
+ class Be {
3321
3350
  constructor(e, t, s) {
3322
- i(this, "dt");
3323
- i(this, "nodeMass");
3324
- i(this, "edgeEquilibriumLength");
3325
- i(this, "edgeStiffness");
3326
- i(this, "nodeForcesApplicationStrategy");
3327
- i(this, "distanceVectorGenerator");
3351
+ o(this, "dt");
3352
+ o(this, "nodeMass");
3353
+ o(this, "edgeEquilibriumLength");
3354
+ o(this, "edgeStiffness");
3355
+ o(this, "nodeForcesApplicationStrategy");
3356
+ o(this, "distanceVectorGenerator");
3328
3357
  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;
3329
3358
  }
3330
3359
  apply() {
3331
3360
  let e = 0;
3332
3361
  const t = /* @__PURE__ */ new Map();
3333
- return this.graph.getAllNodeIds().forEach((o) => {
3334
- t.set(o, { x: 0, y: 0 });
3335
- }), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((o, n) => {
3362
+ return this.graph.getAllNodeIds().forEach((i) => {
3363
+ t.set(i, { x: 0, y: 0 });
3364
+ }), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((i, n) => {
3336
3365
  const a = t.get(n), h = {
3337
3366
  x: a.x / this.nodeMass * this.dt,
3338
3367
  y: a.y / this.nodeMass * this.dt
@@ -3342,26 +3371,26 @@ class Fe {
3342
3371
  Math.sqrt(h.x * h.x + h.y * h.y)
3343
3372
  );
3344
3373
  const d = h.x * this.dt, c = h.y * this.dt;
3345
- o.x += d, o.y += c;
3374
+ i.x += d, i.y += c;
3346
3375
  }), e;
3347
3376
  }
3348
3377
  applyEdgeForces(e) {
3349
3378
  this.graph.getAllEdgeIds().forEach((t) => {
3350
- 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(
3379
+ const s = this.graph.getEdge(t), i = this.graph.getPort(s.from), n = this.graph.getPort(s.to), a = this.currentCoords.get(i.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
3351
3380
  a,
3352
3381
  h
3353
- ), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, w = e.get(o.nodeId), f = e.get(n.nodeId);
3354
- w.x += l, w.y += u, f.x -= l, f.y -= u;
3382
+ ), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, w = e.get(i.nodeId), y = e.get(n.nodeId);
3383
+ w.x += l, w.y += u, y.x -= l, y.y -= u;
3355
3384
  });
3356
3385
  }
3357
3386
  }
3358
- class Ie {
3387
+ class $e {
3359
3388
  constructor(e) {
3360
- i(this, "PI2", 2 * Math.PI);
3389
+ o(this, "PI2", 2 * Math.PI);
3361
3390
  this.rand = e;
3362
3391
  }
3363
3392
  create(e, t) {
3364
- const s = t.x - e.x, o = t.y - e.y, n = s * s + o * o;
3393
+ const s = t.x - e.x, i = t.y - e.y, n = s * s + i * i;
3365
3394
  if (n === 0) {
3366
3395
  const c = this.PI2 * this.rand();
3367
3396
  return {
@@ -3370,70 +3399,70 @@ class Ie {
3370
3399
  d: 0
3371
3400
  };
3372
3401
  }
3373
- const a = Math.sqrt(n), h = s / a, d = o / a;
3402
+ const a = Math.sqrt(n), h = s / a, d = i / a;
3374
3403
  return { ex: h, ey: d, d: a };
3375
3404
  }
3376
3405
  }
3377
- const $e = (r) => {
3406
+ const Ue = (r) => {
3378
3407
  if (r.distance === 0)
3379
3408
  return r.maxForce;
3380
3409
  const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
3381
3410
  return Math.min(e, r.maxForce);
3382
3411
  };
3383
- class Xt {
3412
+ class Kt {
3384
3413
  constructor(e) {
3385
- i(this, "nodeCharge");
3386
- i(this, "distanceVectorGenerator");
3387
- i(this, "maxForce");
3414
+ o(this, "nodeCharge");
3415
+ o(this, "distanceVectorGenerator");
3416
+ o(this, "maxForce");
3388
3417
  this.nodeCharge = e.nodeCharge, this.distanceVectorGenerator = e.distanceVectorGenerator, this.maxForce = e.maxForce;
3389
3418
  }
3390
3419
  apply(e, t) {
3391
- const s = Array.from(t.keys()), o = s.length;
3392
- for (let n = 0; n < o; n++) {
3420
+ const s = Array.from(t.keys()), i = s.length;
3421
+ for (let n = 0; n < i; n++) {
3393
3422
  const a = s[n];
3394
- for (let h = n + 1; h < o; h++) {
3423
+ for (let h = n + 1; h < i; h++) {
3395
3424
  const d = s[h], c = e.get(a), g = e.get(d), l = this.distanceVectorGenerator.create(
3396
3425
  c,
3397
3426
  g
3398
- ), u = $e({
3427
+ ), u = Ue({
3399
3428
  coefficient: 1,
3400
3429
  sourceCharge: this.nodeCharge,
3401
3430
  targetCharge: this.nodeCharge,
3402
3431
  distance: l.d,
3403
3432
  maxForce: this.maxForce
3404
- }), w = u * l.ex, f = u * l.ey, E = t.get(a), S = t.get(d);
3405
- E.x -= w, E.y -= f, S.x += w, S.y += f;
3433
+ }), w = u * l.ex, y = u * l.ey, E = t.get(a), S = t.get(d);
3434
+ E.x -= w, E.y -= y, S.x += w, S.y += y;
3406
3435
  }
3407
3436
  }
3408
3437
  }
3409
3438
  }
3410
- const Yt = (r) => {
3439
+ const Qt = (r) => {
3411
3440
  if (r.size === 0)
3412
3441
  return {
3413
3442
  centerX: 0,
3414
3443
  centerY: 0,
3415
3444
  radius: 0
3416
3445
  };
3417
- let e = 1 / 0, t = -1 / 0, s = 1 / 0, o = -1 / 0;
3446
+ let e = 1 / 0, t = -1 / 0, s = 1 / 0, i = -1 / 0;
3418
3447
  r.forEach((d) => {
3419
- e = Math.min(e, d.x), t = Math.max(t, d.x), s = Math.min(s, d.y), o = Math.max(o, d.y);
3448
+ e = Math.min(e, d.x), t = Math.max(t, d.x), s = Math.min(s, d.y), i = Math.max(i, d.y);
3420
3449
  });
3421
- const n = t - e, a = o - s, h = Math.max(n, a);
3450
+ const n = t - e, a = i - s, h = Math.max(n, a);
3422
3451
  return {
3423
3452
  centerX: (e + t) / 2,
3424
- centerY: (s + o) / 2,
3453
+ centerY: (s + i) / 2,
3425
3454
  radius: h / 2
3426
3455
  };
3427
3456
  };
3428
- class Gt {
3457
+ class Zt {
3429
3458
  constructor(e) {
3430
- i(this, "root");
3431
- i(this, "leaves", /* @__PURE__ */ new Map());
3432
- i(this, "coords");
3433
- i(this, "areaRadiusThreshold");
3434
- i(this, "nodeMass");
3435
- i(this, "nodeCharge");
3436
- i(this, "sortedParentNodes", []);
3459
+ o(this, "root");
3460
+ o(this, "leaves", /* @__PURE__ */ new Map());
3461
+ o(this, "coords");
3462
+ o(this, "areaRadiusThreshold");
3463
+ o(this, "nodeMass");
3464
+ o(this, "nodeCharge");
3465
+ o(this, "sortedParentNodes", []);
3437
3466
  this.coords = e.coords, this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.root = {
3438
3467
  nodeIds: new Set(e.coords.keys()),
3439
3468
  box: e.box,
@@ -3453,16 +3482,16 @@ class Gt {
3453
3482
  for (; t.length > 0; ) {
3454
3483
  const s = [];
3455
3484
  for (; t.length > 0; ) {
3456
- const o = t.pop();
3457
- this.processNode(o).forEach((a) => {
3485
+ const i = t.pop();
3486
+ this.processNode(i).forEach((a) => {
3458
3487
  s.push(a);
3459
3488
  });
3460
3489
  }
3461
3490
  t = s;
3462
3491
  }
3463
3492
  this.sortedParentNodes.reverse().forEach((s) => {
3464
- let o = 0, n = 0, a = 0, h = 0;
3465
- 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;
3493
+ let i = 0, n = 0, a = 0, h = 0;
3494
+ s.lb !== null && (a += s.lb.totalMass, h += s.lb.totalCharge, i += 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, i += 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, i += 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, i += s.rt.chargeCenter.x * s.rt.totalCharge, n += s.rt.chargeCenter.y * s.rt.totalCharge), s.totalMass = a, s.totalCharge = h, s.chargeCenter.x = i / h, s.chargeCenter.y = n / h;
3466
3495
  });
3467
3496
  }
3468
3497
  getRoot() {
@@ -3474,14 +3503,14 @@ class Gt {
3474
3503
  processNode(e) {
3475
3504
  if (e.nodeIds.size < 2)
3476
3505
  return this.setLeaf(e), [];
3477
- const { centerX: t, centerY: s, radius: o } = e.box;
3478
- if (o < this.areaRadiusThreshold)
3506
+ const { centerX: t, centerY: s, radius: i } = e.box;
3507
+ if (i < this.areaRadiusThreshold)
3479
3508
  return this.setLeaf(e), [];
3480
3509
  this.sortedParentNodes.push(e);
3481
- const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = o / 2;
3510
+ const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = i / 2;
3482
3511
  e.nodeIds.forEach((u) => {
3483
- const { x: w, y: f } = this.coords.get(u);
3484
- w < t ? f < s ? d.add(u) : h.add(u) : f < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
3512
+ const { x: w, y } = this.coords.get(u);
3513
+ w < t ? y < s ? d.add(u) : h.add(u) : y < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
3485
3514
  });
3486
3515
  const g = {
3487
3516
  parent: e,
@@ -3576,25 +3605,25 @@ class Gt {
3576
3605
  y: 0
3577
3606
  };
3578
3607
  let t = 0, s = 0;
3579
- return e.forEach((o) => {
3580
- const n = this.coords.get(o);
3608
+ return e.forEach((i) => {
3609
+ const n = this.coords.get(i);
3581
3610
  t += n.x, s += n.y;
3582
3611
  }), { x: t / e.size, y: s / e.size };
3583
3612
  }
3584
3613
  }
3585
- class jt {
3614
+ class qt {
3586
3615
  constructor(e) {
3587
- i(this, "areaRadiusThreshold");
3588
- i(this, "nodeMass");
3589
- i(this, "nodeCharge");
3590
- i(this, "theta");
3591
- i(this, "distanceVectorGenerator");
3592
- i(this, "nodeForceCoefficient");
3593
- i(this, "maxForce");
3616
+ o(this, "areaRadiusThreshold");
3617
+ o(this, "nodeMass");
3618
+ o(this, "nodeCharge");
3619
+ o(this, "theta");
3620
+ o(this, "distanceVectorGenerator");
3621
+ o(this, "nodeForceCoefficient");
3622
+ o(this, "maxForce");
3594
3623
  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;
3595
3624
  }
3596
3625
  apply(e, t) {
3597
- const s = Yt(e), o = new Gt({
3626
+ const s = Qt(e), i = new Zt({
3598
3627
  box: s,
3599
3628
  coords: e,
3600
3629
  areaRadiusThreshold: this.areaRadiusThreshold,
@@ -3603,7 +3632,7 @@ class jt {
3603
3632
  });
3604
3633
  e.forEach((n, a) => {
3605
3634
  const h = this.calculateForceForNode(
3606
- o.getLeaf(a),
3635
+ i.getLeaf(a),
3607
3636
  a,
3608
3637
  e
3609
3638
  ), d = t.get(a);
@@ -3611,14 +3640,14 @@ class jt {
3611
3640
  });
3612
3641
  }
3613
3642
  calculateForceForNode(e, t, s) {
3614
- const o = s.get(t), n = { x: 0, y: 0 };
3643
+ const i = s.get(t), n = { x: 0, y: 0 };
3615
3644
  e.nodeIds.forEach((h) => {
3616
3645
  if (h !== t) {
3617
3646
  const d = s.get(h), c = this.calculateNodeRepulsiveForce({
3618
3647
  sourceCharge: this.nodeCharge,
3619
3648
  targetCharge: this.nodeCharge,
3620
3649
  sourceCoords: d,
3621
- targetCoords: o
3650
+ targetCoords: i
3622
3651
  });
3623
3652
  this.applyForce(n, c);
3624
3653
  }
@@ -3629,49 +3658,49 @@ class jt {
3629
3658
  if (h !== null) {
3630
3659
  const d = this.distanceVectorGenerator.create(
3631
3660
  h.chargeCenter,
3632
- o
3661
+ i
3633
3662
  );
3634
3663
  h.box.radius * 2 < d.d * this.theta ? (this.tryApplyFarForce({
3635
3664
  totalForce: n,
3636
- targetCoords: o,
3665
+ targetCoords: i,
3637
3666
  target: h.lb,
3638
3667
  current: a
3639
3668
  }), this.tryApplyFarForce({
3640
3669
  totalForce: n,
3641
- targetCoords: o,
3670
+ targetCoords: i,
3642
3671
  target: h.rb,
3643
3672
  current: a
3644
3673
  }), this.tryApplyFarForce({
3645
3674
  totalForce: n,
3646
- targetCoords: o,
3675
+ targetCoords: i,
3647
3676
  target: h.rt,
3648
3677
  current: a
3649
3678
  }), this.tryApplyFarForce({
3650
3679
  totalForce: n,
3651
- targetCoords: o,
3680
+ targetCoords: i,
3652
3681
  target: h.lt,
3653
3682
  current: a
3654
3683
  })) : (this.tryApplyNearForce({
3655
3684
  totalForce: n,
3656
- targetCoords: o,
3685
+ targetCoords: i,
3657
3686
  target: h.lb,
3658
3687
  current: a,
3659
3688
  nodesCoords: s
3660
3689
  }), this.tryApplyNearForce({
3661
3690
  totalForce: n,
3662
- targetCoords: o,
3691
+ targetCoords: i,
3663
3692
  target: h.rb,
3664
3693
  current: a,
3665
3694
  nodesCoords: s
3666
3695
  }), this.tryApplyNearForce({
3667
3696
  totalForce: n,
3668
- targetCoords: o,
3697
+ targetCoords: i,
3669
3698
  target: h.rt,
3670
3699
  current: a,
3671
3700
  nodesCoords: s
3672
3701
  }), this.tryApplyNearForce({
3673
3702
  totalForce: n,
3674
- targetCoords: o,
3703
+ targetCoords: i,
3675
3704
  target: h.lt,
3676
3705
  current: a,
3677
3706
  nodesCoords: s
@@ -3682,7 +3711,7 @@ class jt {
3682
3711
  return n;
3683
3712
  }
3684
3713
  calculateExactForce(e, t, s) {
3685
- const o = { x: 0, y: 0 }, n = [e];
3714
+ const i = { x: 0, y: 0 }, n = [e];
3686
3715
  for (; n.length > 0; ) {
3687
3716
  const a = n.pop();
3688
3717
  a.nodeIds.forEach((h) => {
@@ -3692,10 +3721,10 @@ class jt {
3692
3721
  sourceCoords: d,
3693
3722
  targetCoords: t
3694
3723
  });
3695
- this.applyForce(o, c);
3724
+ this.applyForce(i, c);
3696
3725
  }), 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);
3697
3726
  }
3698
- return o;
3727
+ return i;
3699
3728
  }
3700
3729
  calculateApproximateForce(e, t) {
3701
3730
  return this.calculateNodeRepulsiveForce({
@@ -3709,7 +3738,7 @@ class jt {
3709
3738
  const t = this.distanceVectorGenerator.create(
3710
3739
  e.sourceCoords,
3711
3740
  e.targetCoords
3712
- ), s = $e({
3741
+ ), s = Ue({
3713
3742
  coefficient: this.nodeForceCoefficient,
3714
3743
  sourceCharge: e.sourceCharge,
3715
3744
  targetCharge: e.targetCharge,
@@ -3744,7 +3773,7 @@ class jt {
3744
3773
  }
3745
3774
  }
3746
3775
  }
3747
- const Ue = (r) => r.theta !== 0 ? new jt({
3776
+ const Oe = (r) => r.theta !== 0 ? new qt({
3748
3777
  nodeCharge: r.nodeCharge,
3749
3778
  nodeForceCoefficient: r.nodeForceCoefficient,
3750
3779
  distanceVectorGenerator: r.distanceVectorGenerator,
@@ -3752,44 +3781,44 @@ const Ue = (r) => r.theta !== 0 ? new jt({
3752
3781
  theta: r.theta,
3753
3782
  nodeMass: r.nodeMass,
3754
3783
  areaRadiusThreshold: r.areaRadiusThreshold
3755
- }) : new Xt({
3784
+ }) : new Kt({
3756
3785
  nodeCharge: r.nodeCharge,
3757
3786
  nodeForceCoefficient: r.nodeForceCoefficient,
3758
3787
  distanceVectorGenerator: r.distanceVectorGenerator,
3759
3788
  maxForce: r.maxForce
3760
3789
  });
3761
- class Be {
3790
+ class We {
3762
3791
  constructor(e) {
3763
- i(this, "rand");
3764
- i(this, "sparsity");
3792
+ o(this, "rand");
3793
+ o(this, "sparsity");
3765
3794
  this.rand = e.rand, this.sparsity = e.sparsity;
3766
3795
  }
3767
3796
  calculateCoordinates(e) {
3768
- const { graph: t, viewport: s } = e, o = /* @__PURE__ */ new Map(), n = t.getAllNodeIds(), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = s.getDimensions(), c = { x: h / 2, y: d / 2 }, g = s.createContentCoords(c), l = a / 2, u = {
3797
+ const { graph: t, viewport: s } = e, i = /* @__PURE__ */ new Map(), n = t.getAllNodeIds(), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = s.getDimensions(), c = { x: h / 2, y: d / 2 }, g = s.createContentCoords(c), l = a / 2, u = {
3769
3798
  x: g.x - l,
3770
3799
  y: g.y - l
3771
3800
  };
3772
3801
  return n.forEach((w) => {
3773
- const f = t.getNode(w);
3774
- o.set(w, {
3775
- x: f.x ?? u.x + a * this.rand(),
3776
- y: f.y ?? u.y + a * this.rand()
3802
+ const y = t.getNode(w);
3803
+ i.set(w, {
3804
+ x: y.x ?? u.x + a * this.rand(),
3805
+ y: y.y ?? u.y + a * this.rand()
3777
3806
  });
3778
- }), o;
3807
+ }), i;
3779
3808
  }
3780
3809
  }
3781
- class qt {
3810
+ class Jt {
3782
3811
  constructor(e) {
3783
- i(this, "distanceVectorGenerator");
3784
- i(this, "nodeForcesApplicationStrategy");
3785
- i(this, "fillerLayoutAlgorithm");
3786
- i(this, "maxIterations");
3787
- i(this, "dtSec");
3788
- i(this, "nodeMass");
3789
- i(this, "edgeEquilibriumLength");
3790
- i(this, "edgeStiffness");
3791
- i(this, "convergenceVelocity");
3792
- this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new Ie(e.rand), this.nodeForcesApplicationStrategy = Ue({
3812
+ o(this, "distanceVectorGenerator");
3813
+ o(this, "nodeForcesApplicationStrategy");
3814
+ o(this, "fillerLayoutAlgorithm");
3815
+ o(this, "maxIterations");
3816
+ o(this, "dtSec");
3817
+ o(this, "nodeMass");
3818
+ o(this, "edgeEquilibriumLength");
3819
+ o(this, "edgeStiffness");
3820
+ o(this, "convergenceVelocity");
3821
+ this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new $e(e.rand), this.nodeForcesApplicationStrategy = Oe({
3793
3822
  distanceVectorGenerator: this.distanceVectorGenerator,
3794
3823
  nodeCharge: e.nodeCharge,
3795
3824
  maxForce: e.maxForce,
@@ -3797,19 +3826,19 @@ class qt {
3797
3826
  theta: e.barnesHutTheta,
3798
3827
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
3799
3828
  nodeMass: e.nodeMass
3800
- }), this.fillerLayoutAlgorithm = new Be({
3829
+ }), this.fillerLayoutAlgorithm = new We({
3801
3830
  rand: e.rand,
3802
3831
  sparsity: e.edgeEquilibriumLength
3803
3832
  });
3804
3833
  }
3805
3834
  calculateCoordinates(e) {
3806
- const { graph: t, viewport: s } = e, o = this.fillerLayoutAlgorithm.calculateCoordinates({
3835
+ const { graph: t, viewport: s } = e, i = this.fillerLayoutAlgorithm.calculateCoordinates({
3807
3836
  graph: t,
3808
3837
  viewport: s
3809
3838
  });
3810
- for (let n = 0; n < this.maxIterations && !(new Fe(
3839
+ for (let n = 0; n < this.maxIterations && !(new Be(
3811
3840
  t,
3812
- o,
3841
+ i,
3813
3842
  {
3814
3843
  distanceVectorGenerator: this.distanceVectorGenerator,
3815
3844
  nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
@@ -3820,20 +3849,20 @@ class qt {
3820
3849
  }
3821
3850
  ).apply() < this.convergenceVelocity); n++)
3822
3851
  ;
3823
- return o;
3852
+ return i;
3824
3853
  }
3825
3854
  }
3826
- class Kt {
3855
+ class _t {
3827
3856
  constructor(e) {
3828
- i(this, "distanceVectorGenerator");
3829
- i(this, "nodeForcesApplicationStrategy");
3830
- i(this, "convergenceVelocity");
3831
- i(this, "maxTimeDeltaSec");
3832
- i(this, "nodeMass");
3833
- i(this, "edgeEquilibriumLength");
3834
- i(this, "edgeStiffness");
3835
- i(this, "fillerLayoutAlgorithm");
3836
- this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new Ie(e.rand), this.nodeForcesApplicationStrategy = Ue({
3857
+ o(this, "distanceVectorGenerator");
3858
+ o(this, "nodeForcesApplicationStrategy");
3859
+ o(this, "convergenceVelocity");
3860
+ o(this, "maxTimeDeltaSec");
3861
+ o(this, "nodeMass");
3862
+ o(this, "edgeEquilibriumLength");
3863
+ o(this, "edgeStiffness");
3864
+ o(this, "fillerLayoutAlgorithm");
3865
+ this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new $e(e.rand), this.nodeForcesApplicationStrategy = Oe({
3837
3866
  distanceVectorGenerator: this.distanceVectorGenerator,
3838
3867
  nodeCharge: e.nodeCharge,
3839
3868
  maxForce: e.maxForce,
@@ -3841,23 +3870,23 @@ class Kt {
3841
3870
  theta: e.barnesHutTheta,
3842
3871
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
3843
3872
  nodeMass: e.nodeMass
3844
- }), this.fillerLayoutAlgorithm = new Be({
3873
+ }), this.fillerLayoutAlgorithm = new We({
3845
3874
  rand: e.rand,
3846
3875
  sparsity: e.edgeEquilibriumLength
3847
3876
  });
3848
3877
  }
3849
3878
  calculateNextCoordinates(e) {
3850
- const { graph: t, viewport: s, dt: o } = e, n = this.fillerLayoutAlgorithm.calculateCoordinates({
3879
+ const { graph: t, viewport: s, dt: i } = e, n = this.fillerLayoutAlgorithm.calculateCoordinates({
3851
3880
  graph: t,
3852
3881
  viewport: s
3853
3882
  });
3854
- return new Fe(
3883
+ return new Be(
3855
3884
  t,
3856
3885
  n,
3857
3886
  {
3858
3887
  distanceVectorGenerator: this.distanceVectorGenerator,
3859
3888
  nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
3860
- dtSec: Math.min(o, this.maxTimeDeltaSec),
3889
+ dtSec: Math.min(i, this.maxTimeDeltaSec),
3861
3890
  nodeMass: this.nodeMass,
3862
3891
  edgeEquilibriumLength: this.edgeEquilibriumLength,
3863
3892
  edgeStiffness: this.edgeStiffness
@@ -3868,69 +3897,69 @@ class Kt {
3868
3897
  }) ? /* @__PURE__ */ new Map() : n;
3869
3898
  }
3870
3899
  }
3871
- const Oe = (r) => {
3872
- let e = 1779033703, t = 3144134277, s = 1013904242, o = 2773480762;
3900
+ const ze = (r) => {
3901
+ let e = 1779033703, t = 3144134277, s = 1013904242, i = 2773480762;
3873
3902
  for (let n = 0, a; n < r.length; n++)
3874
- 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);
3875
- 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];
3876
- }, We = (r, e, t, s) => function() {
3903
+ a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = s ^ Math.imul(t ^ a, 2869860233), s = i ^ Math.imul(s ^ a, 951274213), i = e ^ Math.imul(i ^ a, 2716044179);
3904
+ return e = Math.imul(s ^ e >>> 18, 597399067), t = Math.imul(i ^ t >>> 22, 2869860233), s = Math.imul(e ^ s >>> 17, 951274213), i = Math.imul(t ^ i >>> 19, 2716044179), e ^= t ^ s ^ i, t ^= e, s ^= e, i ^= e, [e >>> 0, t >>> 0, s >>> 0, i >>> 0];
3905
+ }, ke = (r, e, t, s) => function() {
3877
3906
  r |= 0, e |= 0, t |= 0, s |= 0;
3878
- const o = (r + e | 0) + s | 0;
3879
- 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;
3880
- }, v = Object.freeze({
3881
- seed: "HTMLGraph is awesome",
3882
- maxTimeDeltaSec: 0.01,
3883
- nodeCharge: 1e5,
3884
- nodeMass: 1,
3885
- edgeEquilibriumLength: 300,
3886
- edgeStiffness: 1e3,
3887
- dtSec: 0.01,
3888
- maxIterations: 1e3,
3889
- convergenceVelocity: 10,
3890
- maxForce: 1e7,
3891
- nodeForceCoefficient: 1,
3892
- barnesHutAreaRadiusThreshold: 0.01,
3893
- barnesHutTheta: 1
3894
- }), Qt = (r) => {
3895
- var e, t, s;
3896
- switch ((e = r == null ? void 0 : r.algorithm) == null ? void 0 : e.type) {
3907
+ const i = (r + e | 0) + s | 0;
3908
+ return s = s + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + i | 0, (i >>> 0) / 4294967296;
3909
+ }, er = (r) => {
3910
+ var e, t;
3911
+ switch (r == null ? void 0 : r.type) {
3897
3912
  case "custom":
3898
- return r.algorithm.instance;
3913
+ return r.instance;
3899
3914
  default: {
3900
- 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]);
3901
- return new Kt({
3902
- rand: a,
3903
- maxTimeDeltaSec: (o == null ? void 0 : o.maxTimeDeltaSec) ?? v.maxTimeDeltaSec,
3904
- nodeCharge: (o == null ? void 0 : o.nodeCharge) ?? v.nodeCharge,
3905
- nodeMass: (o == null ? void 0 : o.nodeMass) ?? v.nodeMass,
3906
- edgeEquilibriumLength: (o == null ? void 0 : o.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
3907
- edgeStiffness: (o == null ? void 0 : o.edgeStiffness) ?? v.edgeStiffness,
3908
- convergenceVelocity: (o == null ? void 0 : o.convergenceVelocity) ?? v.convergenceVelocity,
3909
- maxForce: (o == null ? void 0 : o.maxForce) ?? v.maxForce,
3910
- nodeForceCoefficient: (o == null ? void 0 : o.nodeForceCoefficient) ?? v.nodeForceCoefficient,
3911
- barnesHutTheta: ((t = o == null ? void 0 : o.barnesHut) == null ? void 0 : t.theta) ?? v.barnesHutTheta,
3912
- barnesHutAreaRadiusThreshold: ((s = o == null ? void 0 : o.barnesHut) == null ? void 0 : s.areaRadiusThreshold) ?? v.barnesHutAreaRadiusThreshold
3915
+ const s = ze((r == null ? void 0 : r.seed) ?? v.seed), i = ke(s[0], s[1], s[2], s[3]);
3916
+ return new _t({
3917
+ rand: i,
3918
+ maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? v.maxTimeDeltaSec,
3919
+ nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? v.nodeCharge,
3920
+ nodeMass: (r == null ? void 0 : r.nodeMass) ?? v.nodeMass,
3921
+ edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
3922
+ edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? v.edgeStiffness,
3923
+ convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? v.convergenceVelocity,
3924
+ maxForce: (r == null ? void 0 : r.maxForce) ?? v.maxForce,
3925
+ nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? v.nodeForceCoefficient,
3926
+ barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? v.barnesHutTheta,
3927
+ barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? v.barnesHutAreaRadiusThreshold
3913
3928
  });
3914
3929
  }
3915
3930
  }
3916
- }, Zt = (r) => r instanceof j ? {
3931
+ }, Y = {
3932
+ staticNodeResolver: () => !1,
3933
+ onBeforeApplied: () => {
3934
+ },
3935
+ onAfterApplied: () => {
3936
+ }
3937
+ }, tr = (r) => {
3938
+ var t, s;
3939
+ return {
3940
+ algorithm: er((r == null ? void 0 : r.algorithm) ?? {}),
3941
+ staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? Y.staticNodeResolver,
3942
+ onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? Y.onBeforeApplied,
3943
+ onAfterApplied: ((s = r == null ? void 0 : r.events) == null ? void 0 : s.onAfterApplied) ?? Y.onAfterApplied
3944
+ };
3945
+ }, rr = (r) => r instanceof Q ? {
3917
3946
  type: "manual",
3918
3947
  trigger: r
3919
3948
  } : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
3920
3949
  type: "topologyChangeMacrotask"
3921
3950
  } : {
3922
3951
  type: "topologyChangeMicrotask"
3923
- }, Jt = (r) => {
3952
+ }, sr = (r) => {
3924
3953
  var e, t;
3925
3954
  switch (r == null ? void 0 : r.type) {
3926
3955
  case "custom":
3927
3956
  return r.instance;
3928
3957
  default: {
3929
- const s = Oe((r == null ? void 0 : r.seed) ?? v.seed), o = We(s[0], s[1], s[2], s[3]);
3930
- return new qt({
3958
+ const s = ze((r == null ? void 0 : r.seed) ?? v.seed), i = ke(s[0], s[1], s[2], s[3]);
3959
+ return new Jt({
3931
3960
  dtSec: (r == null ? void 0 : r.dtSec) ?? v.dtSec,
3932
3961
  maxIterations: (r == null ? void 0 : r.maxIterations) ?? v.maxIterations,
3933
- rand: o,
3962
+ rand: i,
3934
3963
  nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? v.nodeCharge,
3935
3964
  nodeMass: (r == null ? void 0 : r.nodeMass) ?? v.nodeMass,
3936
3965
  edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
@@ -3943,10 +3972,22 @@ const Oe = (r) => {
3943
3972
  });
3944
3973
  }
3945
3974
  }
3946
- }, _t = (r) => ({
3947
- algorithm: Jt(r == null ? void 0 : r.algorithm),
3948
- applyOn: Zt(r == null ? void 0 : r.applyOn)
3949
- }), er = (r, e) => ({
3975
+ }, G = {
3976
+ staticNodeResolver: () => !1,
3977
+ onBeforeApplied: () => {
3978
+ },
3979
+ onAfterApplied: () => {
3980
+ }
3981
+ }, or = (r) => {
3982
+ var e, t;
3983
+ return {
3984
+ algorithm: sr(r == null ? void 0 : r.algorithm),
3985
+ applyOn: rr(r == null ? void 0 : r.applyOn),
3986
+ staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? G.staticNodeResolver,
3987
+ onBeforeApplied: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onBeforeApplied) ?? G.onBeforeApplied,
3988
+ onAfterApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onAfterApplied) ?? G.onAfterApplied
3989
+ };
3990
+ }, ir = (r, e) => ({
3950
3991
  ...r,
3951
3992
  onNodeDragStarted: (t) => {
3952
3993
  e.add(t), r.onNodeDragStarted(t);
@@ -3954,41 +3995,44 @@ const Oe = (r) => {
3954
3995
  onNodeDragFinished: (t) => {
3955
3996
  e.delete(t), r.onNodeDragFinished(t);
3956
3997
  }
3957
- }), tr = (r, e) => {
3998
+ }), nr = (r, e) => {
3958
3999
  r.onBeforeNodeRemoved.subscribe((t) => {
3959
4000
  e.delete(t);
3960
4001
  }), r.onBeforeClear.subscribe(() => {
3961
4002
  e.clear();
3962
4003
  });
3963
- };
3964
- class or {
4004
+ }, ar = (r, e) => ({
4005
+ ...r,
4006
+ staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
4007
+ });
4008
+ class cr {
3965
4009
  constructor(e) {
3966
- i(this, "used", !1);
3967
- i(this, "canvasDefaults", {});
3968
- i(this, "dragConfig", {});
3969
- i(this, "transformConfig", {});
3970
- i(this, "backgroundConfig", {});
3971
- i(this, "connectablePortsConfig", {});
3972
- i(this, "draggableEdgesConfig", {});
3973
- i(this, "virtualScrollConfig");
3974
- i(this, "layoutConfig", {});
3975
- i(this, "animatedLayoutConfig", {});
3976
- i(this, "hasDraggableNodes", !1);
3977
- i(this, "hasTransformableViewport", !1);
3978
- i(this, "hasNodeResizeReactiveEdges", !1);
3979
- i(this, "hasBackground", !1);
3980
- i(this, "hasUserConnectablePorts", !1);
3981
- i(this, "hasUserDraggableEdges", !1);
3982
- i(this, "hasAnimatedLayout", !1);
3983
- i(this, "hasLayout", !1);
3984
- i(this, "boxRenderingTrigger", new j());
3985
- i(this, "graphStore");
3986
- i(this, "viewportStore");
3987
- i(this, "graph");
3988
- i(this, "viewport");
3989
- i(this, "window", window);
3990
- i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
3991
- this.element = e, this.viewportStore = new Qe(this.element), this.viewport = new Re(this.viewportStore), this.graphStore = new Ae(), this.graph = new Le(this.graphStore);
4010
+ o(this, "used", !1);
4011
+ o(this, "canvasDefaults", {});
4012
+ o(this, "dragConfig", {});
4013
+ o(this, "transformConfig", {});
4014
+ o(this, "backgroundConfig", {});
4015
+ o(this, "connectablePortsConfig", {});
4016
+ o(this, "draggableEdgesConfig", {});
4017
+ o(this, "virtualScrollConfig");
4018
+ o(this, "layoutConfig", {});
4019
+ o(this, "animatedLayoutConfig", {});
4020
+ o(this, "hasDraggableNodes", !1);
4021
+ o(this, "hasTransformableViewport", !1);
4022
+ o(this, "hasNodeResizeReactiveEdges", !1);
4023
+ o(this, "hasBackground", !1);
4024
+ o(this, "hasUserConnectablePorts", !1);
4025
+ o(this, "hasUserDraggableEdges", !1);
4026
+ o(this, "hasAnimatedLayout", !1);
4027
+ o(this, "hasLayout", !1);
4028
+ o(this, "boxRenderingTrigger", new Q());
4029
+ o(this, "graphStore");
4030
+ o(this, "viewportStore");
4031
+ o(this, "graph");
4032
+ o(this, "viewport");
4033
+ o(this, "window", window);
4034
+ o(this, "animationStaticNodes", /* @__PURE__ */ new Set());
4035
+ this.element = e, this.viewportStore = new Je(this.element), this.viewport = new Fe(this.viewportStore), this.graphStore = new xe(), this.graph = new Ve(this.graphStore);
3992
4036
  }
3993
4037
  /**
3994
4038
  * specifies default values for graph entities
@@ -4056,9 +4100,9 @@ class or {
4056
4100
  */
4057
4101
  build() {
4058
4102
  if (this.used)
4059
- throw new Ht("CanvasBuilder is a single use object");
4103
+ throw new jt("CanvasBuilder is a single use object");
4060
4104
  this.used = !0;
4061
- const e = new Nt(this.element), t = this.createHtmlView(e.main), s = Lt(this.canvasDefaults), o = new ve(
4105
+ const e = new Rt(this.element), t = this.createHtmlView(e.main), s = It(this.canvasDefaults), i = new Ee(
4062
4106
  this.graph,
4063
4107
  this.viewport,
4064
4108
  this.graphStore,
@@ -4066,30 +4110,30 @@ class or {
4066
4110
  t,
4067
4111
  s
4068
4112
  );
4069
- if (this.hasBackground && _.configure(
4070
- o,
4071
- Bt(this.backgroundConfig),
4113
+ if (this.hasBackground && te.configure(
4114
+ i,
4115
+ kt(this.backgroundConfig),
4072
4116
  e.background
4073
- ), this.hasNodeResizeReactiveEdges && q.configure(o), this.hasDraggableNodes) {
4074
- let a = Rt(this.dragConfig);
4075
- this.hasAnimatedLayout && (a = er(
4117
+ ), this.hasNodeResizeReactiveEdges && Z.configure(i), this.hasDraggableNodes) {
4118
+ let a = Bt(this.dragConfig);
4119
+ this.hasAnimatedLayout && (a = ir(
4076
4120
  a,
4077
4121
  this.animationStaticNodes
4078
- )), Z.configure(
4079
- o,
4122
+ )), _.configure(
4123
+ i,
4080
4124
  e.main,
4081
4125
  this.window,
4082
4126
  a
4083
4127
  );
4084
4128
  }
4085
4129
  if (this.hasUserConnectablePorts) {
4086
- const a = Ot(
4130
+ const a = Ht(
4087
4131
  this.connectablePortsConfig,
4088
4132
  s.edges.shapeFactory,
4089
4133
  s.ports.direction
4090
4134
  );
4091
- ee.configure(
4092
- o,
4135
+ re.configure(
4136
+ i,
4093
4137
  e.overlayConnectablePorts,
4094
4138
  this.viewportStore,
4095
4139
  this.window,
@@ -4097,73 +4141,76 @@ class or {
4097
4141
  );
4098
4142
  }
4099
4143
  if (this.hasUserDraggableEdges) {
4100
- const a = Wt(
4144
+ const a = Xt(
4101
4145
  this.draggableEdgesConfig,
4102
- o.graph
4146
+ i.graph
4103
4147
  );
4104
- te.configure(
4105
- o,
4148
+ se.configure(
4149
+ i,
4106
4150
  e.overlayDraggableEdges,
4107
4151
  this.viewportStore,
4108
4152
  this.window,
4109
4153
  a
4110
4154
  );
4111
4155
  }
4112
- this.virtualScrollConfig !== void 0 ? J.configure(
4113
- o,
4156
+ if (this.virtualScrollConfig !== void 0 ? ee.configure(
4157
+ i,
4114
4158
  e.main,
4115
4159
  this.window,
4116
- ye(this.transformConfig),
4160
+ ve(this.transformConfig),
4117
4161
  this.boxRenderingTrigger,
4118
- kt(this.virtualScrollConfig)
4162
+ Yt(this.virtualScrollConfig)
4119
4163
  ) : this.hasTransformableViewport && H.configure(
4120
- o,
4164
+ i,
4121
4165
  e.main,
4122
4166
  this.window,
4123
- ye(this.transformConfig)
4124
- ), this.hasLayout && Pt.configure(
4125
- o,
4126
- _t(this.layoutConfig)
4127
- ), this.hasAnimatedLayout && (tr(
4128
- o.graph,
4129
- this.animationStaticNodes
4130
- ), se.configure(
4131
- o,
4132
- Qt(this.animatedLayoutConfig),
4133
- this.animationStaticNodes,
4134
- this.window
4135
- ));
4167
+ ve(this.transformConfig)
4168
+ ), this.hasLayout && Dt.configure(
4169
+ i,
4170
+ or(this.layoutConfig)
4171
+ ), this.hasAnimatedLayout) {
4172
+ let a = tr(
4173
+ this.animatedLayoutConfig
4174
+ );
4175
+ this.hasDraggableNodes && (nr(
4176
+ i.graph,
4177
+ this.animationStaticNodes
4178
+ ), a = ar(
4179
+ a,
4180
+ this.animationStaticNodes
4181
+ )), ie.configure(i, a, this.window);
4182
+ }
4136
4183
  const n = () => {
4137
- e.destroy(), o.onBeforeDestroy.unsubscribe(n);
4184
+ e.destroy(), i.onBeforeDestroy.unsubscribe(n);
4138
4185
  };
4139
- return o.onBeforeDestroy.subscribe(n), o;
4186
+ return i.onBeforeDestroy.subscribe(n), i;
4140
4187
  }
4141
4188
  createHtmlView(e) {
4142
- let t = new me(
4189
+ let t = new Ae(
4143
4190
  this.graphStore,
4144
4191
  this.viewportStore,
4145
4192
  e
4146
4193
  );
4147
- return this.virtualScrollConfig !== void 0 && (t = new je(
4194
+ return this.virtualScrollConfig !== void 0 && (t = new Qe(
4148
4195
  t,
4149
4196
  this.graphStore,
4150
4197
  this.boxRenderingTrigger,
4151
- zt(this.virtualScrollConfig)
4152
- )), new qe(t, this.graphStore);
4198
+ Gt(this.virtualScrollConfig)
4199
+ )), new Ze(t, this.graphStore);
4153
4200
  }
4154
4201
  }
4155
4202
  export {
4156
- ut as BezierEdgeShape,
4157
- or as CanvasBuilder,
4158
- Ht as CanvasBuilderError,
4203
+ wt as BezierEdgeShape,
4204
+ cr as CanvasBuilder,
4205
+ jt as CanvasBuilderError,
4159
4206
  A as CanvasError,
4160
4207
  M as ConnectionCategory,
4161
- De as DirectEdgeShape,
4162
- j as EventSubject,
4163
- pt as HorizontalEdgeShape,
4164
- vt as InteractiveEdgeError,
4165
- Me as InteractiveEdgeShape,
4166
- sr as MidpointEdgeShape,
4167
- wt as StraightEdgeShape,
4168
- ft as VerticalEdgeShape
4208
+ Le as DirectEdgeShape,
4209
+ Q as EventSubject,
4210
+ yt as HorizontalEdgeShape,
4211
+ Et as InteractiveEdgeError,
4212
+ Re as InteractiveEdgeShape,
4213
+ dr as MidpointEdgeShape,
4214
+ ft as StraightEdgeShape,
4215
+ mt as VerticalEdgeShape
4169
4216
  };