@html-graph/html-graph 3.10.0 → 3.11.1

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,48 +1,48 @@
1
- var ye = Object.defineProperty;
2
- var Ae = (t, e, o) => e in t ? ye(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
- var r = (t, e, o) => Ae(t, typeof e != "symbol" ? e + "" : e, o);
4
- const pe = () => {
5
- const t = document.createElement("div");
6
- return t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.width = "0", t.style.height = "0", t;
7
- }, Ee = () => {
8
- const t = document.createElement("div");
9
- return t.style.width = "100%", t.style.height = "100%", t.style.position = "relative", t.style.overflow = "hidden", t;
10
- }, xe = (t) => {
11
- t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.visibility = "hidden";
12
- }, N = (t, e) => ({
13
- x: t.scale * e.x + t.x,
14
- y: t.scale * e.y + t.y
1
+ var ve = Object.defineProperty;
2
+ var ye = (r, e, t) => e in r ? ve(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var o = (r, e, t) => ye(r, typeof e != "symbol" ? e + "" : e, t);
4
+ const me = () => {
5
+ const r = document.createElement("div");
6
+ return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
7
+ }, Ae = () => {
8
+ const r = document.createElement("div");
9
+ return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
10
+ }, Ee = (r) => {
11
+ r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
12
+ }, D = (r, e) => ({
13
+ x: r.scale * e.x + r.x,
14
+ y: r.scale * e.y + r.y
15
15
  });
16
- class he {
17
- constructor(e, o, i) {
18
- r(this, "host", Ee());
19
- r(this, "container", pe());
20
- r(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
21
- r(this, "applyTransform", () => {
16
+ class ne {
17
+ constructor(e, t, s) {
18
+ o(this, "host", Ae());
19
+ o(this, "container", me());
20
+ o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
21
+ o(this, "applyTransform", () => {
22
22
  const e = this.viewportStore.getContentMatrix();
23
23
  this.container.style.transform = `matrix(${e.scale}, 0, 0, ${e.scale}, ${e.x}, ${e.y})`;
24
24
  });
25
- this.graphStore = e, this.viewportStore = o, this.element = i, this.element.appendChild(this.host), this.host.appendChild(this.container), this.viewportStore.onAfterUpdated.subscribe(this.applyTransform);
25
+ this.graphStore = e, this.viewportStore = t, this.element = s, this.element.appendChild(this.host), this.host.appendChild(this.container), this.viewportStore.onAfterUpdated.subscribe(this.applyTransform);
26
26
  }
27
27
  attachNode(e) {
28
- const o = this.graphStore.getNode(e);
29
- xe(o.element), this.container.appendChild(o.element), this.updateNodePosition(e), this.updateNodePriority(e), o.element.style.visibility = "visible";
28
+ const t = this.graphStore.getNode(e);
29
+ Ee(t.element), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
30
30
  }
31
31
  detachNode(e) {
32
- const o = this.graphStore.getNode(e);
33
- this.container.removeChild(o.element);
32
+ const t = this.graphStore.getNode(e);
33
+ this.container.removeChild(t.element);
34
34
  }
35
35
  attachEdge(e) {
36
- const o = this.graphStore.getEdge(e).shape.svg;
37
- this.edgeIdToElementMap.set(e, o), this.container.appendChild(o), this.renderEdge(e), this.updateEdgePriority(e);
36
+ const t = this.graphStore.getEdge(e).shape.svg;
37
+ this.edgeIdToElementMap.set(e, t), this.container.appendChild(t), this.renderEdge(e), this.updateEdgePriority(e);
38
38
  }
39
39
  detachEdge(e) {
40
- const o = this.edgeIdToElementMap.get(e);
41
- this.container.removeChild(o), this.edgeIdToElementMap.delete(e);
40
+ const t = this.edgeIdToElementMap.get(e);
41
+ this.container.removeChild(t), this.edgeIdToElementMap.delete(e);
42
42
  }
43
43
  clear() {
44
- this.edgeIdToElementMap.forEach((e, o) => {
45
- this.detachEdge(o);
44
+ this.edgeIdToElementMap.forEach((e, t) => {
45
+ this.detachEdge(t);
46
46
  }), this.graphStore.getAllNodeIds().forEach((e) => {
47
47
  this.detachNode(e);
48
48
  });
@@ -51,100 +51,100 @@ class he {
51
51
  this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.clear(), this.element.removeChild(this.host), this.host.removeChild(this.container);
52
52
  }
53
53
  updateNodePosition(e) {
54
- const o = this.graphStore.getNode(e), { width: i, height: s } = o.element.getBoundingClientRect(), h = this.viewportStore.getViewportMatrix().scale, n = o.centerFn(i, s), d = o.x - h * n.x, c = o.y - h * n.y;
55
- o.element.style.transform = `translate(${d}px, ${c}px)`;
54
+ const t = this.graphStore.getNode(e), { width: s, height: i } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, h = t.centerFn(s, i), a = t.x - n * h.x, d = t.y - n * h.y;
55
+ t.element.style.transform = `translate(${a}px, ${d}px)`;
56
56
  }
57
57
  updateNodePriority(e) {
58
- const o = this.graphStore.getNode(e);
59
- o.element.style.zIndex = `${o.priority}`;
58
+ const t = this.graphStore.getNode(e);
59
+ t.element.style.zIndex = `${t.priority}`;
60
60
  }
61
61
  updateEdgeShape(e) {
62
- const o = this.edgeIdToElementMap.get(e);
63
- this.container.removeChild(o);
64
- const i = this.graphStore.getEdge(e);
65
- this.edgeIdToElementMap.set(e, i.shape.svg), this.container.appendChild(i.shape.svg);
62
+ const t = this.edgeIdToElementMap.get(e);
63
+ this.container.removeChild(t);
64
+ const s = this.graphStore.getEdge(e);
65
+ this.edgeIdToElementMap.set(e, s.shape.svg), this.container.appendChild(s.shape.svg);
66
66
  }
67
67
  renderEdge(e) {
68
- const o = this.graphStore.getEdge(e), i = this.graphStore.getPort(o.from), s = this.graphStore.getPort(o.to), h = i.element.getBoundingClientRect(), n = s.element.getBoundingClientRect(), d = this.host.getBoundingClientRect(), c = this.viewportStore.getViewportMatrix(), a = this.createEdgeRenderPort(
69
- o.from,
70
- i,
71
- h,
72
- d,
73
- c
74
- ), l = this.createEdgeRenderPort(
75
- o.to,
68
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), i = this.graphStore.getPort(t.to), n = s.element.getBoundingClientRect(), h = i.element.getBoundingClientRect(), a = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix(), c = this.createEdgeRenderPort(
69
+ t.from,
76
70
  s,
77
71
  n,
78
- d,
79
- c
72
+ a,
73
+ d
74
+ ), g = this.createEdgeRenderPort(
75
+ t.to,
76
+ i,
77
+ h,
78
+ a,
79
+ d
80
80
  );
81
- o.shape.render({ from: a, to: l });
81
+ t.shape.render({ from: c, to: g });
82
82
  }
83
83
  updateEdgePriority(e) {
84
- const o = this.graphStore.getEdge(e);
85
- o.shape.svg.style.zIndex = `${o.priority}`;
86
- }
87
- createEdgeRenderPort(e, o, i, s, h) {
88
- const n = {
89
- x: i.left - s.left,
90
- y: i.top - s.top
91
- }, d = N(h, n);
84
+ const t = this.graphStore.getEdge(e);
85
+ t.shape.svg.style.zIndex = `${t.priority}`;
86
+ }
87
+ createEdgeRenderPort(e, t, s, i, n) {
88
+ const h = {
89
+ x: s.left - i.left,
90
+ y: s.top - i.top
91
+ }, a = D(n, h);
92
92
  return {
93
- x: d.x,
94
- y: d.y,
95
- width: i.width * h.scale,
96
- height: i.height * h.scale,
97
- direction: o.direction,
93
+ x: a.x,
94
+ y: a.y,
95
+ width: s.width * n.scale,
96
+ height: s.height * n.scale,
97
+ direction: t.direction,
98
98
  portId: e,
99
- nodeId: o.nodeId
99
+ nodeId: t.nodeId
100
100
  };
101
101
  }
102
102
  }
103
- class Se {
103
+ class xe {
104
104
  constructor(e) {
105
- r(this, "xFrom", 1 / 0);
106
- r(this, "yFrom", 1 / 0);
107
- r(this, "xTo", 1 / 0);
108
- r(this, "yTo", 1 / 0);
105
+ o(this, "xFrom", 1 / 0);
106
+ o(this, "yFrom", 1 / 0);
107
+ o(this, "xTo", 1 / 0);
108
+ o(this, "yTo", 1 / 0);
109
109
  this.graphStore = e;
110
110
  }
111
111
  setRenderingBox(e) {
112
112
  this.xFrom = e.x, this.xTo = e.x + e.width, this.yFrom = e.y, this.yTo = e.y + e.height;
113
113
  }
114
114
  hasNode(e) {
115
- const o = this.graphStore.getNode(e);
116
- return o.x >= this.xFrom && o.x <= this.xTo && o.y >= this.yFrom && o.y <= this.yTo;
115
+ const t = this.graphStore.getNode(e);
116
+ return t.x >= this.xFrom && t.x <= this.xTo && t.y >= this.yFrom && t.y <= this.yTo;
117
117
  }
118
118
  hasEdge(e) {
119
- const o = this.graphStore.getEdge(e), i = this.graphStore.getPort(o.from).nodeId, s = this.graphStore.getPort(o.to).nodeId, h = this.graphStore.getNode(i), n = this.graphStore.getNode(s), d = Math.min(h.x, n.x), c = Math.max(h.x, n.x), a = Math.min(h.y, n.y), l = Math.max(h.y, n.y);
120
- return d <= this.xTo && c >= this.xFrom && a <= this.yTo && l >= this.yFrom;
119
+ 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), h = this.graphStore.getNode(i), a = Math.min(n.x, h.x), d = Math.max(n.x, h.x), c = Math.min(n.y, h.y), g = Math.max(n.y, h.y);
120
+ return a <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
121
121
  }
122
122
  }
123
- class be {
124
- constructor(e, o, i) {
125
- r(this, "attachedNodes", /* @__PURE__ */ new Set());
126
- r(this, "attachedEdges", /* @__PURE__ */ new Set());
127
- r(this, "renderingBox");
128
- r(this, "updateViewport", (e) => {
123
+ class Se {
124
+ constructor(e, t, s) {
125
+ o(this, "attachedNodes", /* @__PURE__ */ new Set());
126
+ o(this, "attachedEdges", /* @__PURE__ */ new Set());
127
+ o(this, "renderingBox");
128
+ o(this, "updateViewport", (e) => {
129
129
  this.renderingBox.setRenderingBox(e);
130
- const o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set();
131
- this.graphStore.getAllNodeIds().forEach((n) => {
132
- const d = this.renderingBox.hasNode(n), c = this.attachedNodes.has(n);
133
- d && !c ? o.add(n) : !d && c && i.add(n);
134
- }), this.graphStore.getAllEdgeIds().forEach((n) => {
135
- const d = this.renderingBox.hasEdge(n), c = this.attachedEdges.has(n), a = this.graphStore.getEdge(n), l = this.graphStore.getPort(a.from).nodeId, w = this.graphStore.getPort(a.to).nodeId;
136
- d && (this.renderingBox.hasNode(l) || (o.add(l), i.delete(l)), this.renderingBox.hasNode(w) || (o.add(w), i.delete(w))), d && !c ? s.add(n) : !d && c && h.add(n);
137
- }), h.forEach((n) => {
138
- this.handleDetachEdge(n);
139
- }), i.forEach((n) => {
140
- this.handleDetachNode(n);
141
- }), o.forEach((n) => {
142
- this.attachedNodes.has(n) || this.handleAttachNode(n);
143
- }), s.forEach((n) => {
144
- this.handleAttachEdge(n);
130
+ const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
131
+ this.graphStore.getAllNodeIds().forEach((h) => {
132
+ const a = this.renderingBox.hasNode(h), d = this.attachedNodes.has(h);
133
+ a && !d ? t.add(h) : !a && d && s.add(h);
134
+ }), this.graphStore.getAllEdgeIds().forEach((h) => {
135
+ const a = this.renderingBox.hasEdge(h), d = this.attachedEdges.has(h), c = this.graphStore.getEdge(h), g = this.graphStore.getPort(c.from).nodeId, l = this.graphStore.getPort(c.to).nodeId;
136
+ a && (this.renderingBox.hasNode(g) || (t.add(g), s.delete(g)), this.renderingBox.hasNode(l) || (t.add(l), s.delete(l))), a && !d ? i.add(h) : !a && d && n.add(h);
137
+ }), n.forEach((h) => {
138
+ this.handleDetachEdge(h);
139
+ }), s.forEach((h) => {
140
+ this.handleDetachNode(h);
141
+ }), t.forEach((h) => {
142
+ this.attachedNodes.has(h) || this.handleAttachNode(h);
143
+ }), i.forEach((h) => {
144
+ this.handleAttachEdge(h);
145
145
  });
146
146
  });
147
- this.htmlView = e, this.graphStore = o, this.trigger = i, this.renderingBox = new Se(this.graphStore), this.trigger.subscribe(this.updateViewport);
147
+ this.htmlView = e, this.graphStore = t, this.trigger = s, this.renderingBox = new xe(this.graphStore), this.trigger.subscribe(this.updateViewport);
148
148
  }
149
149
  attachNode(e) {
150
150
  this.renderingBox.hasNode(e) && this.handleAttachNode(e);
@@ -159,8 +159,8 @@ class be {
159
159
  this.attachedEdges.has(e) && this.handleDetachEdge(e);
160
160
  }
161
161
  updateNodePosition(e) {
162
- this.attachedNodes.has(e) ? this.htmlView.updateNodePosition(e) : this.renderingBox.hasNode(e) && (this.handleAttachNode(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((o) => {
163
- this.attachEdgeEntities(o);
162
+ this.attachedNodes.has(e) ? this.htmlView.updateNodePosition(e) : this.renderingBox.hasNode(e) && (this.handleAttachNode(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((t) => {
163
+ this.attachEdgeEntities(t);
164
164
  }));
165
165
  }
166
166
  updateNodePriority(e) {
@@ -182,8 +182,8 @@ class be {
182
182
  this.clear(), this.htmlView.destroy(), this.trigger.unsubscribe(this.updateViewport);
183
183
  }
184
184
  attachEdgeEntities(e) {
185
- const o = this.graphStore.getEdge(e), i = this.graphStore.getPort(o.from).nodeId, s = this.graphStore.getPort(o.to).nodeId;
186
- this.attachedNodes.has(i) || this.handleAttachNode(i), this.attachedNodes.has(s) || this.handleAttachNode(s), this.handleAttachEdge(e);
185
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, i = this.graphStore.getPort(t.to).nodeId;
186
+ this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(i) || this.handleAttachNode(i), this.handleAttachEdge(e);
187
187
  }
188
188
  handleAttachNode(e) {
189
189
  this.attachedNodes.add(e), this.htmlView.attachNode(e);
@@ -198,9 +198,9 @@ class be {
198
198
  this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
199
199
  }
200
200
  }
201
- class de {
201
+ class he {
202
202
  constructor() {
203
- r(this, "callbacks", /* @__PURE__ */ new Set());
203
+ o(this, "callbacks", /* @__PURE__ */ new Set());
204
204
  }
205
205
  subscribe(e) {
206
206
  this.callbacks.add(e);
@@ -209,19 +209,19 @@ class de {
209
209
  this.callbacks.delete(e);
210
210
  }
211
211
  emit(e) {
212
- this.callbacks.forEach((o) => {
213
- o(e);
212
+ this.callbacks.forEach((t) => {
213
+ t(e);
214
214
  });
215
215
  }
216
216
  }
217
- const x = () => {
218
- const t = new de();
219
- return [t, t];
217
+ const E = () => {
218
+ const r = new he();
219
+ return [r, r];
220
220
  };
221
- class Te {
221
+ class be {
222
222
  constructor(e) {
223
- r(this, "onBeforeUpdated");
224
- r(this, "onAfterUpdated");
223
+ o(this, "onBeforeUpdated");
224
+ o(this, "onAfterUpdated");
225
225
  this.viewportStore = e, this.onBeforeUpdated = this.viewportStore.onBeforeUpdated, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
226
226
  }
227
227
  getViewportMatrix() {
@@ -231,31 +231,31 @@ class Te {
231
231
  return { ...this.viewportStore.getContentMatrix() };
232
232
  }
233
233
  }
234
- class Pe {
234
+ class Te {
235
235
  constructor(e) {
236
- r(this, "onAfterNodeAdded");
237
- r(this, "onAfterNodeUpdated");
238
- r(this, "onAfterNodePriorityUpdated");
239
- r(this, "onBeforeNodeRemoved");
240
- r(this, "onAfterPortMarked");
241
- r(this, "onAfterPortUpdated");
242
- r(this, "onBeforePortUnmarked");
243
- r(this, "onAfterEdgeAdded");
244
- r(this, "onAfterEdgeShapeUpdated");
245
- r(this, "onAfterEdgeUpdated");
246
- r(this, "onAfterEdgePriorityUpdated");
247
- r(this, "onBeforeEdgeRemoved");
248
- r(this, "onBeforeClear");
236
+ o(this, "onAfterNodeAdded");
237
+ o(this, "onAfterNodeUpdated");
238
+ o(this, "onAfterNodePriorityUpdated");
239
+ o(this, "onBeforeNodeRemoved");
240
+ o(this, "onAfterPortMarked");
241
+ o(this, "onAfterPortUpdated");
242
+ o(this, "onBeforePortUnmarked");
243
+ o(this, "onAfterEdgeAdded");
244
+ o(this, "onAfterEdgeShapeUpdated");
245
+ o(this, "onAfterEdgeUpdated");
246
+ o(this, "onAfterEdgePriorityUpdated");
247
+ o(this, "onBeforeEdgeRemoved");
248
+ o(this, "onBeforeClear");
249
249
  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;
250
250
  }
251
251
  getNode(e) {
252
- const o = this.graphStore.getNode(e);
253
- return o === void 0 ? null : {
254
- element: o.element,
255
- x: o.x,
256
- y: o.y,
257
- centerFn: o.centerFn,
258
- priority: o.priority
252
+ const t = this.graphStore.getNode(e);
253
+ return t === void 0 ? null : {
254
+ element: t.element,
255
+ x: t.x,
256
+ y: t.y,
257
+ centerFn: t.centerFn,
258
+ priority: t.priority
259
259
  };
260
260
  }
261
261
  getElementNodeId(e) {
@@ -266,11 +266,11 @@ class Pe {
266
266
  return this.graphStore.getAllNodeIds();
267
267
  }
268
268
  getPort(e) {
269
- const o = this.graphStore.getPort(e);
270
- return o === void 0 ? null : {
271
- element: o.element,
272
- direction: o.direction,
273
- nodeId: o.nodeId
269
+ const t = this.graphStore.getPort(e);
270
+ return t === void 0 ? null : {
271
+ element: t.element,
272
+ direction: t.direction,
273
+ nodeId: t.nodeId
274
274
  };
275
275
  }
276
276
  // TODO: use Set in v4
@@ -290,8 +290,8 @@ class Pe {
290
290
  return this.graphStore.getAllEdgeIds();
291
291
  }
292
292
  getEdge(e) {
293
- const o = this.graphStore.getEdge(e);
294
- return o === void 0 ? null : { from: o.from, to: o.to, priority: o.priority };
293
+ const t = this.graphStore.getEdge(e);
294
+ return t === void 0 ? null : { from: t.from, to: t.to, priority: t.priority };
295
295
  }
296
296
  // TODO: use Set in v4
297
297
  getPortIncomingEdgeIds(e) {
@@ -326,9 +326,9 @@ class Pe {
326
326
  return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
327
327
  }
328
328
  }
329
- class W {
329
+ class $ {
330
330
  constructor(e) {
331
- r(this, "counter", 0);
331
+ o(this, "counter", 0);
332
332
  this.checkExists = e;
333
333
  }
334
334
  create(e) {
@@ -345,120 +345,120 @@ class W {
345
345
  class S extends Error {
346
346
  constructor() {
347
347
  super(...arguments);
348
- r(this, "name", "HtmlGraphError");
348
+ o(this, "name", "HtmlGraphError");
349
349
  }
350
350
  }
351
- class ce {
352
- constructor(e, o, i, s, h) {
351
+ class ae {
352
+ constructor(e, t, s, i, n) {
353
353
  /**
354
354
  * provides api for accessing model of rendered graph
355
355
  */
356
- r(this, "graph");
356
+ o(this, "graph");
357
357
  /**
358
358
  * provides api for accessing viewport state
359
359
  */
360
- r(this, "viewport");
361
- r(this, "nodeIdGenerator", new W(
360
+ o(this, "viewport");
361
+ o(this, "nodeIdGenerator", new $(
362
362
  (e) => this.graph.getNode(e) !== null
363
363
  ));
364
- r(this, "portIdGenerator", new W(
364
+ o(this, "portIdGenerator", new $(
365
365
  (e) => this.graph.getPort(e) !== null
366
366
  ));
367
- r(this, "edgeIdGenerator", new W(
367
+ o(this, "edgeIdGenerator", new $(
368
368
  (e) => this.graph.getEdge(e) !== null
369
369
  ));
370
- r(this, "onAfterNodeAdded", (e) => {
370
+ o(this, "onAfterNodeAdded", (e) => {
371
371
  this.htmlView.attachNode(e);
372
372
  });
373
- r(this, "onAfterNodeUpdated", (e) => {
374
- this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((i) => {
375
- this.htmlView.renderEdge(i);
373
+ o(this, "onAfterNodeUpdated", (e) => {
374
+ this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((s) => {
375
+ this.htmlView.renderEdge(s);
376
376
  });
377
377
  });
378
- r(this, "onAfterNodePriorityUpdated", (e) => {
378
+ o(this, "onAfterNodePriorityUpdated", (e) => {
379
379
  this.htmlView.updateNodePriority(e);
380
380
  });
381
- r(this, "onBeforeNodeRemoved", (e) => {
382
- this.graphStore.getNodePortIds(e).forEach((o) => {
383
- this.unmarkPort(o);
381
+ o(this, "onBeforeNodeRemoved", (e) => {
382
+ this.graphStore.getNodePortIds(e).forEach((t) => {
383
+ this.unmarkPort(t);
384
384
  }), this.htmlView.detachNode(e);
385
385
  });
386
- r(this, "onAfterPortUpdated", (e) => {
387
- this.graphStore.getPortAdjacentEdgeIds(e).forEach((i) => {
388
- this.htmlView.renderEdge(i);
386
+ o(this, "onAfterPortUpdated", (e) => {
387
+ this.graphStore.getPortAdjacentEdgeIds(e).forEach((s) => {
388
+ this.htmlView.renderEdge(s);
389
389
  });
390
390
  });
391
- r(this, "onBeforePortUnmarked", (e) => {
392
- this.graphStore.getPortAdjacentEdgeIds(e).forEach((o) => {
393
- this.removeEdge(o);
391
+ o(this, "onBeforePortUnmarked", (e) => {
392
+ this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
393
+ this.removeEdge(t);
394
394
  });
395
395
  });
396
- r(this, "onAfterEdgeAdded", (e) => {
396
+ o(this, "onAfterEdgeAdded", (e) => {
397
397
  this.htmlView.attachEdge(e);
398
398
  });
399
- r(this, "onAfterEdgeShapeUpdated", (e) => {
399
+ o(this, "onAfterEdgeShapeUpdated", (e) => {
400
400
  this.htmlView.updateEdgeShape(e);
401
401
  });
402
- r(this, "onAfterEdgeUpdated", (e) => {
402
+ o(this, "onAfterEdgeUpdated", (e) => {
403
403
  this.htmlView.renderEdge(e);
404
404
  });
405
- r(this, "onAfterEdgePriorityUpdated", (e) => {
405
+ o(this, "onAfterEdgePriorityUpdated", (e) => {
406
406
  this.htmlView.updateEdgePriority(e);
407
407
  });
408
- r(this, "onBeforeEdgeRemoved", (e) => {
408
+ o(this, "onBeforeEdgeRemoved", (e) => {
409
409
  this.htmlView.detachEdge(e);
410
410
  });
411
- r(this, "onBeforeClear", () => {
411
+ o(this, "onBeforeClear", () => {
412
412
  this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
413
413
  });
414
- r(this, "onBeforeDestroyEmitter");
414
+ o(this, "onBeforeDestroyEmitter");
415
415
  /**
416
416
  * emits event just before destruction of canvas
417
417
  */
418
- r(this, "onBeforeDestroy");
419
- this.element = e, this.graphStore = o, this.viewportStore = i, this.htmlView = s, this.defaults = h, this.graph = new Pe(this.graphStore), this.viewport = new Te(this.viewportStore), this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
418
+ o(this, "onBeforeDestroy");
419
+ this.element = e, this.graphStore = t, this.viewportStore = s, this.htmlView = i, this.defaults = n, this.graph = new Te(this.graphStore), this.viewport = new be(this.viewportStore), this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
420
420
  this.onAfterNodePriorityUpdated
421
421
  ), 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(
422
422
  this.onAfterEdgeShapeUpdated
423
423
  ), this.graphStore.onAfterEdgeUpdated.subscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.subscribe(
424
424
  this.onAfterEdgePriorityUpdated
425
- ), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = x();
425
+ ), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = E();
426
426
  }
427
427
  /**
428
428
  * adds new node
429
429
  */
430
430
  addNode(e) {
431
- const o = this.nodeIdGenerator.create(e.id);
432
- if (this.graph.getNode(o) !== null)
431
+ const t = this.nodeIdGenerator.create(e.id);
432
+ if (this.graph.getNode(t) !== null)
433
433
  throw new S("failed to add node with existing id");
434
434
  if (this.graphStore.getElementNodeId(e.element) !== void 0)
435
435
  throw new S(
436
436
  "failed to add node with html element already in use by another node"
437
437
  );
438
438
  if (this.graphStore.addNode({
439
- id: o,
439
+ id: t,
440
440
  element: e.element,
441
441
  x: e.x,
442
442
  y: e.y,
443
443
  centerFn: e.centerFn ?? this.defaults.nodes.centerFn,
444
444
  priority: e.priority ?? this.defaults.nodes.priorityFn()
445
445
  }), e.ports !== void 0)
446
- for (const i of e.ports)
446
+ for (const s of e.ports)
447
447
  this.markPort({
448
- id: i.id,
449
- element: i.element,
450
- nodeId: o,
451
- direction: i.direction
448
+ id: s.id,
449
+ element: s.element,
450
+ nodeId: t,
451
+ direction: s.direction
452
452
  });
453
453
  return this;
454
454
  }
455
455
  /**
456
456
  * updates node parameters
457
457
  */
458
- updateNode(e, o) {
458
+ updateNode(e, t) {
459
459
  if (this.graph.getNode(e) === null)
460
460
  throw new S("failed to update non existing node");
461
- return this.graphStore.updateNode(e, o ?? {}), this;
461
+ return this.graphStore.updateNode(e, t ?? {}), this;
462
462
  }
463
463
  /**
464
464
  * removes specified node
@@ -474,13 +474,13 @@ class ce {
474
474
  * marks specified element as a port for specified node
475
475
  */
476
476
  markPort(e) {
477
- const o = this.portIdGenerator.create(e.id);
478
- if (this.graph.getPort(o) !== null)
477
+ const t = this.portIdGenerator.create(e.id);
478
+ if (this.graph.getPort(t) !== null)
479
479
  throw new S("failed to add port with existing id");
480
480
  if (this.graph.getNode(e.nodeId) === null)
481
481
  throw new S("failed to mark port for nonexistent node");
482
482
  return this.graphStore.addPort({
483
- id: o,
483
+ id: t,
484
484
  element: e.element,
485
485
  nodeId: e.nodeId,
486
486
  direction: e.direction ?? this.defaults.ports.direction
@@ -489,10 +489,10 @@ class ce {
489
489
  /**
490
490
  * updates port and edges attached to it
491
491
  */
492
- updatePort(e, o) {
492
+ updatePort(e, t) {
493
493
  if (this.graph.getPort(e) === null)
494
494
  throw new S("failed to update nonexistent port");
495
- return this.graphStore.updatePort(e, o ?? {}), this;
495
+ return this.graphStore.updatePort(e, t ?? {}), this;
496
496
  }
497
497
  /**
498
498
  * unmarks specified port
@@ -507,28 +507,28 @@ class ce {
507
507
  * adds new edge
508
508
  */
509
509
  addEdge(e) {
510
- const o = this.edgeIdGenerator.create(e.id);
511
- if (this.graph.getEdge(o) !== null)
510
+ const t = this.edgeIdGenerator.create(e.id);
511
+ if (this.graph.getEdge(t) !== null)
512
512
  throw new S("failed to add edge with existing id");
513
513
  if (this.graph.getPort(e.from) === null)
514
514
  throw new S("failed to add edge from nonexistent port");
515
515
  if (this.graph.getPort(e.to) === null)
516
516
  throw new S("failed to add edge to nonexistent port");
517
517
  return this.graphStore.addEdge({
518
- id: o,
518
+ id: t,
519
519
  from: e.from,
520
520
  to: e.to,
521
- shape: e.shape ?? this.defaults.edges.shapeFactory(o),
521
+ shape: e.shape ?? this.defaults.edges.shapeFactory(t),
522
522
  priority: e.priority ?? this.defaults.edges.priorityFn()
523
523
  }), this;
524
524
  }
525
525
  /**
526
526
  * updates specified edge
527
527
  */
528
- updateEdge(e, o) {
528
+ updateEdge(e, t) {
529
529
  if (this.graph.getEdge(e) === null)
530
530
  throw new S("failed to update nonexistent edge");
531
- return this.graphStore.updateEdge(e, o ?? {}), this;
531
+ return this.graphStore.updateEdge(e, t ?? {}), this;
532
532
  }
533
533
  /**
534
534
  * removes specified edge
@@ -571,37 +571,37 @@ class ce {
571
571
  ), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
572
572
  }
573
573
  }
574
- class De {
574
+ class Pe {
575
575
  constructor() {
576
- r(this, "singleToMultiMap", /* @__PURE__ */ new Map());
577
- r(this, "multiToSingleMap", /* @__PURE__ */ new Map());
576
+ o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
577
+ o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
578
578
  }
579
- addRecord(e, o) {
580
- const i = this.singleToMultiMap.get(e);
581
- i === void 0 ? this.singleToMultiMap.set(e, /* @__PURE__ */ new Set([o])) : i.add(o), this.multiToSingleMap.set(o, e);
579
+ addRecord(e, t) {
580
+ const s = this.singleToMultiMap.get(e);
581
+ s === void 0 ? this.singleToMultiMap.set(e, /* @__PURE__ */ new Set([t])) : s.add(t), this.multiToSingleMap.set(t, e);
582
582
  }
583
583
  getMultiBySingle(e) {
584
- const o = this.singleToMultiMap.get(e) ?? /* @__PURE__ */ new Set();
585
- return Array.from(o.values());
584
+ const t = this.singleToMultiMap.get(e) ?? /* @__PURE__ */ new Set();
585
+ return Array.from(t.values());
586
586
  }
587
587
  removeByMulti(e) {
588
- const o = this.multiToSingleMap.get(e), i = this.singleToMultiMap.get(o);
589
- i.delete(e), i.size === 0 && this.singleToMultiMap.delete(o), this.multiToSingleMap.delete(e);
588
+ const t = this.multiToSingleMap.get(e), s = this.singleToMultiMap.get(t);
589
+ s.delete(e), s.size === 0 && this.singleToMultiMap.delete(t), this.multiToSingleMap.delete(e);
590
590
  }
591
591
  getByMulti(e) {
592
592
  return this.multiToSingleMap.get(e);
593
593
  }
594
594
  removeBySingle(e) {
595
- this.singleToMultiMap.get(e).forEach((i) => {
596
- this.multiToSingleMap.delete(i);
595
+ this.singleToMultiMap.get(e).forEach((s) => {
596
+ this.multiToSingleMap.delete(s);
597
597
  }), this.singleToMultiMap.delete(e);
598
598
  }
599
599
  clear() {
600
600
  this.singleToMultiMap.clear(), this.multiToSingleMap.clear();
601
601
  }
602
602
  forEachSingle(e) {
603
- this.singleToMultiMap.forEach((o, i) => {
604
- e(i);
603
+ this.singleToMultiMap.forEach((t, s) => {
604
+ e(s);
605
605
  });
606
606
  }
607
607
  hasSingle(e) {
@@ -611,54 +611,54 @@ class De {
611
611
  return this.multiToSingleMap.get(e) !== void 0;
612
612
  }
613
613
  }
614
- class ae {
614
+ class de {
615
615
  constructor() {
616
- r(this, "nodes", /* @__PURE__ */ new Map());
617
- r(this, "ports", /* @__PURE__ */ new Map());
618
- r(this, "edges", /* @__PURE__ */ new Map());
619
- r(this, "nodesElementsMap", /* @__PURE__ */ new Map());
620
- r(this, "incomingEdges", /* @__PURE__ */ new Map());
621
- r(this, "outcomingEdges", /* @__PURE__ */ new Map());
622
- r(this, "cycleEdges", /* @__PURE__ */ new Map());
623
- r(this, "elementPorts", new De());
624
- r(this, "afterNodeAddedEmitter");
625
- r(this, "onAfterNodeAdded");
626
- r(this, "afterNodeUpdatedEmitter");
627
- r(this, "onAfterNodeUpdated");
628
- r(this, "afterNodePriorityUpdatedEmitter");
629
- r(this, "onAfterNodePriorityUpdated");
630
- r(this, "beforeNodeRemovedEmitter");
631
- r(this, "onBeforeNodeRemoved");
632
- r(this, "afterPortAddedEmitter");
633
- r(this, "onAfterPortAdded");
634
- r(this, "afterPortUpdatedEmitter");
635
- r(this, "onAfterPortUpdated");
636
- r(this, "beforePortRemovedEmitter");
637
- r(this, "onBeforePortRemoved");
638
- r(this, "afterEdgeAddedEmitter");
639
- r(this, "onAfterEdgeAdded");
640
- r(this, "afterEdgeShapeUpdatedEmitter");
641
- r(this, "onAfterEdgeShapeUpdated");
642
- r(this, "afterEdgeUpdatedEmitter");
643
- r(this, "onAfterEdgeUpdated");
644
- r(this, "afterEdgePriorityUpdatedEmitter");
645
- r(this, "onAfterEdgePriorityUpdated");
646
- r(this, "beforeEdgeRemovedEmitter");
647
- r(this, "onBeforeEdgeRemoved");
648
- r(this, "beforeClearEmitter");
649
- r(this, "onBeforeClear");
650
- [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();
616
+ o(this, "nodes", /* @__PURE__ */ new Map());
617
+ o(this, "ports", /* @__PURE__ */ new Map());
618
+ o(this, "edges", /* @__PURE__ */ new Map());
619
+ o(this, "nodesElementsMap", /* @__PURE__ */ new Map());
620
+ o(this, "incomingEdges", /* @__PURE__ */ new Map());
621
+ o(this, "outcomingEdges", /* @__PURE__ */ new Map());
622
+ o(this, "cycleEdges", /* @__PURE__ */ new Map());
623
+ o(this, "elementPorts", new Pe());
624
+ o(this, "afterNodeAddedEmitter");
625
+ o(this, "onAfterNodeAdded");
626
+ o(this, "afterNodeUpdatedEmitter");
627
+ o(this, "onAfterNodeUpdated");
628
+ o(this, "afterNodePriorityUpdatedEmitter");
629
+ o(this, "onAfterNodePriorityUpdated");
630
+ o(this, "beforeNodeRemovedEmitter");
631
+ o(this, "onBeforeNodeRemoved");
632
+ o(this, "afterPortAddedEmitter");
633
+ o(this, "onAfterPortAdded");
634
+ o(this, "afterPortUpdatedEmitter");
635
+ o(this, "onAfterPortUpdated");
636
+ o(this, "beforePortRemovedEmitter");
637
+ o(this, "onBeforePortRemoved");
638
+ o(this, "afterEdgeAddedEmitter");
639
+ o(this, "onAfterEdgeAdded");
640
+ o(this, "afterEdgeShapeUpdatedEmitter");
641
+ o(this, "onAfterEdgeShapeUpdated");
642
+ o(this, "afterEdgeUpdatedEmitter");
643
+ o(this, "onAfterEdgeUpdated");
644
+ o(this, "afterEdgePriorityUpdatedEmitter");
645
+ o(this, "onAfterEdgePriorityUpdated");
646
+ o(this, "beforeEdgeRemovedEmitter");
647
+ o(this, "onBeforeEdgeRemoved");
648
+ o(this, "beforeClearEmitter");
649
+ o(this, "onBeforeClear");
650
+ [this.afterNodeAddedEmitter, this.onAfterNodeAdded] = E(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = E(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = E(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = E(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = E(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = E(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = E(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = E(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = E(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = E(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = E(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = E(), [this.beforeClearEmitter, this.onBeforeClear] = E();
651
651
  }
652
652
  addNode(e) {
653
- const o = /* @__PURE__ */ new Map(), i = {
653
+ const t = /* @__PURE__ */ new Map(), s = {
654
654
  element: e.element,
655
655
  x: e.x,
656
656
  y: e.y,
657
657
  centerFn: e.centerFn,
658
658
  priority: e.priority,
659
- ports: o
659
+ ports: t
660
660
  };
661
- this.nodes.set(e.id, i), this.nodesElementsMap.set(e.element, e.id), this.afterNodeAddedEmitter.emit(e.id);
661
+ this.nodes.set(e.id, s), this.nodesElementsMap.set(e.element, e.id), this.afterNodeAddedEmitter.emit(e.id);
662
662
  }
663
663
  getAllNodeIds() {
664
664
  return Array.from(this.nodes.keys());
@@ -669,14 +669,14 @@ class ae {
669
669
  getElementNodeId(e) {
670
670
  return this.nodesElementsMap.get(e);
671
671
  }
672
- updateNode(e, o) {
673
- const i = this.nodes.get(e);
674
- i.x = o.x ?? i.x, i.y = o.y ?? i.y, i.centerFn = o.centerFn ?? i.centerFn, o.priority !== void 0 && (i.priority = o.priority, this.afterNodePriorityUpdatedEmitter.emit(e)), this.afterNodeUpdatedEmitter.emit(e);
672
+ updateNode(e, t) {
673
+ const s = this.nodes.get(e);
674
+ 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);
675
675
  }
676
676
  removeNode(e) {
677
677
  this.beforeNodeRemovedEmitter.emit(e);
678
- const o = this.nodes.get(e);
679
- this.nodesElementsMap.delete(o.element), this.nodes.delete(e);
678
+ const t = this.nodes.get(e);
679
+ this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
680
680
  }
681
681
  addPort(e) {
682
682
  this.ports.set(e.id, {
@@ -688,9 +688,9 @@ class ae {
688
688
  getPort(e) {
689
689
  return this.ports.get(e);
690
690
  }
691
- updatePort(e, o) {
692
- const i = this.ports.get(e);
693
- i.direction = o.direction ?? i.direction, this.afterPortUpdatedEmitter.emit(e);
691
+ updatePort(e, t) {
692
+ const s = this.ports.get(e);
693
+ s.direction = t.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(e);
694
694
  }
695
695
  getAllPortIds() {
696
696
  return Array.from(this.ports.keys());
@@ -699,30 +699,30 @@ class ae {
699
699
  return this.elementPorts.getMultiBySingle(e);
700
700
  }
701
701
  getNodePortIds(e) {
702
- const o = this.nodes.get(e);
703
- if (o !== void 0)
704
- return Array.from(o.ports.keys());
702
+ const t = this.nodes.get(e);
703
+ if (t !== void 0)
704
+ return Array.from(t.ports.keys());
705
705
  }
706
706
  removePort(e) {
707
- const o = this.ports.get(e).nodeId;
708
- this.beforePortRemovedEmitter.emit(e), this.nodes.get(o).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
707
+ const t = this.ports.get(e).nodeId;
708
+ this.beforePortRemovedEmitter.emit(e), this.nodes.get(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
709
709
  }
710
710
  addEdge(e) {
711
711
  this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
712
712
  }
713
- updateEdge(e, o) {
714
- if (o.from !== void 0 || o.to !== void 0) {
715
- const s = this.edges.get(e);
713
+ updateEdge(e, t) {
714
+ if (t.from !== void 0 || t.to !== void 0) {
715
+ const i = this.edges.get(e);
716
716
  this.removeEdgeInternal(e), this.addEdgeInternal({
717
717
  id: e,
718
- from: o.from ?? s.from,
719
- to: o.to ?? s.to,
720
- shape: s.shape,
721
- priority: s.priority
718
+ from: t.from ?? i.from,
719
+ to: t.to ?? i.to,
720
+ shape: i.shape,
721
+ priority: i.priority
722
722
  });
723
723
  }
724
- const i = this.edges.get(e);
725
- o.shape !== void 0 && (i.shape = o.shape, this.afterEdgeShapeUpdatedEmitter.emit(e)), o.priority !== void 0 && (i.priority = o.priority, this.afterEdgePriorityUpdatedEmitter.emit(e)), this.afterEdgeUpdatedEmitter.emit(e);
724
+ const s = this.edges.get(e);
725
+ t.shape !== void 0 && (s.shape = t.shape, this.afterEdgeShapeUpdatedEmitter.emit(e)), t.priority !== void 0 && (s.priority = t.priority, this.afterEdgePriorityUpdatedEmitter.emit(e)), this.afterEdgeUpdatedEmitter.emit(e);
726
726
  }
727
727
  getAllEdgeIds() {
728
728
  return Array.from(this.edges.keys());
@@ -753,25 +753,25 @@ class ae {
753
753
  ];
754
754
  }
755
755
  getNodeIncomingEdgeIds(e) {
756
- const o = Array.from(this.nodes.get(e).ports.keys());
757
- let i = [];
758
- return o.forEach((s) => {
759
- i = [...i, ...this.getPortIncomingEdgeIds(s)];
760
- }), i;
756
+ const t = Array.from(this.nodes.get(e).ports.keys());
757
+ let s = [];
758
+ return t.forEach((i) => {
759
+ s = [...s, ...this.getPortIncomingEdgeIds(i)];
760
+ }), s;
761
761
  }
762
762
  getNodeOutcomingEdgeIds(e) {
763
- const o = Array.from(this.nodes.get(e).ports.keys());
764
- let i = [];
765
- return o.forEach((s) => {
766
- i = [...i, ...this.getPortOutcomingEdgeIds(s)];
767
- }), i;
763
+ const t = Array.from(this.nodes.get(e).ports.keys());
764
+ let s = [];
765
+ return t.forEach((i) => {
766
+ s = [...s, ...this.getPortOutcomingEdgeIds(i)];
767
+ }), s;
768
768
  }
769
769
  getNodeCycleEdgeIds(e) {
770
- const o = Array.from(this.nodes.get(e).ports.keys());
771
- let i = [];
772
- return o.forEach((s) => {
773
- i = [...i, ...this.getPortCycleEdgeIds(s)];
774
- }), i;
770
+ const t = Array.from(this.nodes.get(e).ports.keys());
771
+ let s = [];
772
+ return t.forEach((i) => {
773
+ s = [...s, ...this.getPortCycleEdgeIds(i)];
774
+ }), s;
775
775
  }
776
776
  getNodeAdjacentEdgeIds(e) {
777
777
  return [
@@ -789,28 +789,28 @@ class ae {
789
789
  }), e.from !== e.to ? (this.outcomingEdges.get(e.from).add(e.id), this.incomingEdges.get(e.to).add(e.id)) : this.cycleEdges.get(e.from).add(e.id);
790
790
  }
791
791
  removeEdgeInternal(e) {
792
- const o = this.edges.get(e), i = o.from, s = o.to;
793
- this.cycleEdges.get(i).delete(e), this.cycleEdges.get(s).delete(e), this.incomingEdges.get(i).delete(e), this.incomingEdges.get(s).delete(e), this.outcomingEdges.get(i).delete(e), this.outcomingEdges.get(s).delete(e), this.edges.delete(e);
792
+ const t = this.edges.get(e), s = t.from, i = t.to;
793
+ this.cycleEdges.get(s).delete(e), this.cycleEdges.get(i).delete(e), this.incomingEdges.get(s).delete(e), this.incomingEdges.get(i).delete(e), this.outcomingEdges.get(s).delete(e), this.outcomingEdges.get(i).delete(e), this.edges.delete(e);
794
794
  }
795
795
  }
796
- const q = (t) => ({
797
- scale: 1 / t.scale,
798
- x: -t.x / t.scale,
799
- y: -t.y / t.scale
796
+ const q = (r) => ({
797
+ scale: 1 / r.scale,
798
+ x: -r.x / r.scale,
799
+ y: -r.y / r.scale
800
800
  }), ee = {
801
801
  scale: 1,
802
802
  x: 0,
803
803
  y: 0
804
804
  };
805
- class Ne {
805
+ class De {
806
806
  constructor() {
807
- r(this, "viewportMatrix", ee);
808
- r(this, "contentMatrix", ee);
809
- r(this, "afterUpdateEmitter");
810
- r(this, "onAfterUpdated");
811
- r(this, "beforeUpdateEmitter");
812
- r(this, "onBeforeUpdated");
813
- [this.afterUpdateEmitter, this.onAfterUpdated] = x(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = x();
807
+ o(this, "viewportMatrix", ee);
808
+ o(this, "contentMatrix", ee);
809
+ o(this, "afterUpdateEmitter");
810
+ o(this, "onAfterUpdated");
811
+ o(this, "beforeUpdateEmitter");
812
+ o(this, "onBeforeUpdated");
813
+ [this.afterUpdateEmitter, this.onAfterUpdated] = E(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = E();
814
814
  }
815
815
  getViewportMatrix() {
816
816
  return this.viewportMatrix;
@@ -835,26 +835,26 @@ class Ne {
835
835
  }
836
836
  class k {
837
837
  constructor(e) {
838
- r(this, "elementToNodeId", /* @__PURE__ */ new Map());
839
- r(this, "nodesResizeObserver");
840
- r(this, "onAfterNodeAdded", (e) => {
841
- const o = this.canvas.graph.getNode(e);
842
- this.elementToNodeId.set(o.element, e), this.nodesResizeObserver.observe(o.element);
838
+ o(this, "elementToNodeId", /* @__PURE__ */ new Map());
839
+ o(this, "nodesResizeObserver");
840
+ o(this, "onAfterNodeAdded", (e) => {
841
+ const t = this.canvas.graph.getNode(e);
842
+ this.elementToNodeId.set(t.element, e), this.nodesResizeObserver.observe(t.element);
843
843
  });
844
- r(this, "onBeforeNodeRemoved", (e) => {
845
- const o = this.canvas.graph.getNode(e);
846
- this.elementToNodeId.delete(o.element), this.nodesResizeObserver.unobserve(o.element);
844
+ o(this, "onBeforeNodeRemoved", (e) => {
845
+ const t = this.canvas.graph.getNode(e);
846
+ this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
847
847
  });
848
- r(this, "onBeforeClear", () => {
848
+ o(this, "onBeforeClear", () => {
849
849
  this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
850
850
  });
851
- r(this, "onBeforeDestroy", () => {
851
+ o(this, "onBeforeDestroy", () => {
852
852
  this.canvas.graph.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.unsubscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.unsubscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
853
853
  });
854
- this.canvas = e, this.nodesResizeObserver = new ResizeObserver((o) => {
855
- o.forEach((i) => {
856
- const s = i.target;
857
- this.handleNodeResize(s);
854
+ this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
855
+ t.forEach((s) => {
856
+ const i = s.target;
857
+ this.handleNodeResize(i);
858
858
  });
859
859
  }), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
860
860
  }
@@ -862,91 +862,91 @@ class k {
862
862
  new k(e);
863
863
  }
864
864
  handleNodeResize(e) {
865
- const o = this.elementToNodeId.get(e);
866
- this.canvas.updateNode(o);
865
+ const t = this.elementToNodeId.get(e);
866
+ this.canvas.updateNode(t);
867
867
  }
868
868
  }
869
- const me = (t) => {
870
- var v, A, y, p, E, b;
871
- const e = ((v = t == null ? void 0 : t.events) == null ? void 0 : v.onNodeDrag) ?? (() => {
872
- }), o = ((A = t == null ? void 0 : t.events) == null ? void 0 : A.onBeforeNodeDrag) ?? (() => !0), i = ((y = t == null ? void 0 : t.events) == null ? void 0 : y.onNodeDragFinished) ?? (() => {
873
- }), s = (t == null ? void 0 : t.moveOnTop) !== !1, h = (t == null ? void 0 : t.moveEdgesOnTop) !== !1 && s, n = (p = t == null ? void 0 : t.mouse) == null ? void 0 : p.dragCursor, d = n !== void 0 ? n : "grab", c = (E = t == null ? void 0 : t.mouse) == null ? void 0 : E.mouseDownEventVerifier, a = c !== void 0 ? c : (T) => T.button === 0, l = (b = t == null ? void 0 : t.mouse) == null ? void 0 : b.mouseUpEventVerifier;
869
+ const Ne = (r) => {
870
+ var v, p, f, A, m, x;
871
+ const e = ((v = r == null ? void 0 : r.events) == null ? void 0 : v.onNodeDrag) ?? (() => {
872
+ }), t = ((p = r == null ? void 0 : r.events) == null ? void 0 : p.onBeforeNodeDrag) ?? (() => !0), s = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onNodeDragFinished) ?? (() => {
873
+ }), i = (r == null ? void 0 : r.moveOnTop) !== !1, n = (r == null ? void 0 : r.moveEdgesOnTop) !== !1 && i, h = (A = r == null ? void 0 : r.mouse) == null ? void 0 : A.dragCursor, a = h !== void 0 ? h : "grab", d = (m = r == null ? void 0 : r.mouse) == null ? void 0 : m.mouseDownEventVerifier, c = d !== void 0 ? d : (b) => b.button === 0, g = (x = r == null ? void 0 : r.mouse) == null ? void 0 : x.mouseUpEventVerifier;
874
874
  return {
875
- moveOnTop: s,
876
- moveEdgesOnTop: h,
877
- dragCursor: d,
878
- mouseDownEventVerifier: a,
879
- mouseUpEventVerifier: l !== void 0 ? l : (T) => T.button === 0,
875
+ moveOnTop: i,
876
+ moveEdgesOnTop: n,
877
+ dragCursor: a,
878
+ mouseDownEventVerifier: c,
879
+ mouseUpEventVerifier: g !== void 0 ? g : (b) => b.button === 0,
880
880
  onNodeDrag: e,
881
- onBeforeNodeDrag: o,
882
- onNodeDragFinished: i
881
+ onBeforeNodeDrag: t,
882
+ onNodeDragFinished: s
883
883
  };
884
- }, Me = (t, e, o) => {
885
- const { x: i, y: s, width: h, height: n } = t.getBoundingClientRect();
886
- return e >= i && e <= i + h && o >= s && o <= s + n;
887
- }, Le = (t, e, o) => e >= 0 && e <= t.innerWidth && o >= 0 && o <= t.innerHeight, m = (t, e, o, i) => Me(e, o, i) && Le(t, o, i), B = (t, e) => {
888
- e !== null ? t.style.cursor = e : t.style.removeProperty("cursor");
884
+ }, Me = (r, e, t) => {
885
+ const { x: s, y: i, width: n, height: h } = r.getBoundingClientRect();
886
+ return e >= s && e <= s + n && t >= i && t <= i + h;
887
+ }, Le = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, N = (r, e, t, s) => Me(e, t, s) && Le(r, t, s), B = (r, e) => {
888
+ e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
889
889
  };
890
890
  class z {
891
- constructor(e, o, i, s) {
892
- r(this, "grabbedNodeId", null);
893
- r(this, "maxNodePriority", 0);
894
- r(this, "previousTouchCoordinates", null);
895
- r(this, "graph");
896
- r(this, "onAfterNodeAdded", (e) => {
891
+ constructor(e, t, s, i) {
892
+ o(this, "grabbedNodeId", null);
893
+ o(this, "maxNodePriority", 0);
894
+ o(this, "previousTouchCoordinates", null);
895
+ o(this, "graph");
896
+ o(this, "onAfterNodeAdded", (e) => {
897
897
  this.updateMaxNodePriority(e);
898
- const o = this.graph.getNode(e);
899
- o.element.addEventListener("mousedown", this.onMouseDown, {
898
+ const t = this.graph.getNode(e);
899
+ t.element.addEventListener("mousedown", this.onMouseDown, {
900
900
  passive: !0
901
- }), o.element.addEventListener("touchstart", this.onTouchStart, {
901
+ }), t.element.addEventListener("touchstart", this.onTouchStart, {
902
902
  passive: !0
903
903
  });
904
904
  });
905
- r(this, "onAfterNodeUpdated", (e) => {
905
+ o(this, "onAfterNodeUpdated", (e) => {
906
906
  this.updateMaxNodePriority(e);
907
907
  });
908
- r(this, "onBeforeNodeRemoved", (e) => {
909
- const o = this.graph.getNode(e);
910
- o.element.removeEventListener("mousedown", this.onMouseDown), o.element.removeEventListener("touchstart", this.onTouchStart);
908
+ o(this, "onBeforeNodeRemoved", (e) => {
909
+ const t = this.graph.getNode(e);
910
+ t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
911
911
  });
912
- r(this, "onBeforeDestroy", () => {
912
+ o(this, "onBeforeDestroy", () => {
913
913
  this.graph.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.unsubscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.unsubscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.unsubscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy), this.removeMouseDragListeners(), this.removeTouchDragListeners();
914
914
  });
915
- r(this, "onBeforeClear", () => {
915
+ o(this, "onBeforeClear", () => {
916
916
  this.canvas.graph.getAllNodeIds().forEach((e) => {
917
- const o = this.canvas.graph.getNode(e);
918
- o.element.removeEventListener("mousedown", this.onMouseDown), o.element.removeEventListener("touchstart", this.onTouchStart);
917
+ const t = this.canvas.graph.getNode(e);
918
+ t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
919
919
  }), this.maxNodePriority = 0;
920
920
  });
921
- r(this, "onMouseDown", (e) => {
921
+ o(this, "onMouseDown", (e) => {
922
922
  if (!this.config.mouseDownEventVerifier(e))
923
923
  return;
924
- const o = e.currentTarget, i = this.graph.getElementNodeId(o), s = this.graph.getNode(i);
924
+ const t = e.currentTarget, s = this.graph.getElementNodeId(t), i = this.graph.getNode(s);
925
925
  this.config.onBeforeNodeDrag({
926
- nodeId: i,
927
- element: s.element,
928
- x: s.x,
929
- y: s.y
930
- }) && (e.stopImmediatePropagation(), this.grabbedNodeId = i, B(this.element, this.config.dragCursor), this.moveNodeOnTop(i), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
926
+ nodeId: s,
927
+ element: i.element,
928
+ x: i.x,
929
+ y: i.y
930
+ }) && (e.stopImmediatePropagation(), this.grabbedNodeId = s, B(this.element, this.config.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
931
931
  passive: !0
932
932
  }), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
933
933
  passive: !0
934
934
  }));
935
935
  });
936
- r(this, "onTouchStart", (e) => {
936
+ o(this, "onTouchStart", (e) => {
937
937
  if (e.touches.length !== 1)
938
938
  return;
939
939
  e.stopImmediatePropagation(), this.previousTouchCoordinates = {
940
940
  x: e.touches[0].clientX,
941
941
  y: e.touches[0].clientY
942
942
  };
943
- const o = e.currentTarget, i = this.canvas.graph.getElementNodeId(o), s = this.graph.getNode(i);
943
+ const t = e.currentTarget, s = this.canvas.graph.getElementNodeId(t), i = this.graph.getNode(s);
944
944
  this.config.onBeforeNodeDrag({
945
- nodeId: i,
946
- element: s.element,
947
- x: s.x,
948
- y: s.y
949
- }) && (this.grabbedNodeId = i, this.moveNodeOnTop(i), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
945
+ nodeId: s,
946
+ element: i.element,
947
+ x: i.x,
948
+ y: i.y
949
+ }) && (this.grabbedNodeId = s, this.moveNodeOnTop(s), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
950
950
  passive: !0
951
951
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
952
952
  passive: !0
@@ -954,8 +954,8 @@ class z {
954
954
  passive: !0
955
955
  }));
956
956
  });
957
- r(this, "onWindowMouseMove", (e) => {
958
- if (!m(
957
+ o(this, "onWindowMouseMove", (e) => {
958
+ if (!N(
959
959
  this.window,
960
960
  this.element,
961
961
  e.clientX,
@@ -966,63 +966,63 @@ class z {
966
966
  }
967
967
  this.grabbedNodeId !== null && this.dragNode(this.grabbedNodeId, e.movementX, e.movementY);
968
968
  });
969
- r(this, "onWindowMouseUp", (e) => {
969
+ o(this, "onWindowMouseUp", (e) => {
970
970
  this.config.mouseUpEventVerifier(e) && this.cancelMouseDrag();
971
971
  });
972
- r(this, "onWindowTouchMove", (e) => {
972
+ o(this, "onWindowTouchMove", (e) => {
973
973
  if (e.touches.length !== 1)
974
974
  return;
975
- const o = e.touches[0];
976
- if (!m(
975
+ const t = e.touches[0];
976
+ if (!N(
977
977
  this.window,
978
978
  this.element,
979
- o.clientX,
980
- o.clientY
979
+ t.clientX,
980
+ t.clientY
981
981
  )) {
982
982
  this.cancelTouchDrag();
983
983
  return;
984
984
  }
985
985
  if (this.grabbedNodeId !== null && this.previousTouchCoordinates !== null) {
986
- const s = o.clientX - this.previousTouchCoordinates.x, h = o.clientY - this.previousTouchCoordinates.y;
987
- this.dragNode(this.grabbedNodeId, s, h), this.previousTouchCoordinates = {
986
+ const i = t.clientX - this.previousTouchCoordinates.x, n = t.clientY - this.previousTouchCoordinates.y;
987
+ this.dragNode(this.grabbedNodeId, i, n), this.previousTouchCoordinates = {
988
988
  x: e.touches[0].clientX,
989
989
  y: e.touches[0].clientY
990
990
  };
991
991
  }
992
992
  });
993
- r(this, "onWindowTouchFinish", () => {
993
+ o(this, "onWindowTouchFinish", () => {
994
994
  this.previousTouchCoordinates = null, this.cancelTouchDrag();
995
995
  });
996
- r(this, "config");
997
- this.canvas = e, this.element = o, this.window = i, this.config = me(s), this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
996
+ o(this, "config");
997
+ this.canvas = e, this.element = t, this.window = s, this.config = Ne(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);
998
998
  }
999
- static configure(e, o, i, s) {
1000
- new z(e, o, i, s);
999
+ static configure(e, t, s, i) {
1000
+ new z(e, t, s, i);
1001
1001
  }
1002
- dragNode(e, o, i) {
1003
- const s = this.graph.getNode(e);
1004
- if (s === null)
1002
+ dragNode(e, t, s) {
1003
+ const i = this.graph.getNode(e);
1004
+ if (i === null)
1005
1005
  return;
1006
- const h = this.canvas.viewport.getContentMatrix(), n = N(h, {
1007
- x: s.x,
1008
- y: s.y
1009
- }), d = N(
1010
- { scale: 1, x: o, y: i },
1011
- n
1012
- ), c = this.canvas.viewport.getViewportMatrix(), a = N(c, d);
1013
- this.canvas.updateNode(e, { x: a.x, y: a.y }), this.config.onNodeDrag({
1006
+ const n = this.canvas.viewport.getContentMatrix(), h = D(n, {
1007
+ x: i.x,
1008
+ y: i.y
1009
+ }), a = D(
1010
+ { scale: 1, x: t, y: s },
1011
+ h
1012
+ ), d = this.canvas.viewport.getViewportMatrix(), c = D(d, a);
1013
+ this.canvas.updateNode(e, { x: c.x, y: c.y }), this.config.onNodeDrag({
1014
1014
  nodeId: e,
1015
- element: s.element,
1016
- x: a.x,
1017
- y: a.y
1015
+ element: i.element,
1016
+ x: c.x,
1017
+ y: c.y
1018
1018
  });
1019
1019
  }
1020
1020
  moveNodeOnTop(e) {
1021
1021
  if (this.config.moveOnTop) {
1022
1022
  if (this.maxNodePriority++, this.config.moveEdgesOnTop) {
1023
- const o = this.maxNodePriority;
1024
- this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((s) => {
1025
- this.canvas.updateEdge(s, { priority: o });
1023
+ const t = this.maxNodePriority;
1024
+ this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((i) => {
1025
+ this.canvas.updateEdge(i, { priority: t });
1026
1026
  });
1027
1027
  }
1028
1028
  this.canvas.updateNode(e, { priority: this.maxNodePriority });
@@ -1054,166 +1054,166 @@ class z {
1054
1054
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
1055
1055
  }
1056
1056
  updateMaxNodePriority(e) {
1057
- const o = this.graph.getNode(e).priority;
1058
- this.maxNodePriority = Math.max(this.maxNodePriority, o);
1057
+ const t = this.graph.getNode(e).priority;
1058
+ this.maxNodePriority = Math.max(this.maxNodePriority, t);
1059
1059
  }
1060
1060
  }
1061
- const Re = (t) => {
1062
- const e = t.minX !== null ? t.minX : -1 / 0, o = t.maxX !== null ? t.maxX : 1 / 0, i = t.minY !== null ? t.minY : -1 / 0, s = t.maxY !== null ? t.maxY : 1 / 0;
1063
- return (h) => {
1064
- let n = h.nextTransform.x, d = h.nextTransform.y;
1065
- n < e && n < h.prevTransform.x && (n = Math.min(h.prevTransform.x, e));
1066
- const c = h.canvasWidth * h.prevTransform.scale, a = o - c;
1067
- n > a && n > h.prevTransform.x && (n = Math.max(h.prevTransform.x, a)), d < i && d < h.prevTransform.y && (d = Math.min(h.prevTransform.y, i));
1068
- const l = h.canvasHeight * h.prevTransform.scale, w = s - l;
1069
- return d > w && d > h.prevTransform.y && (d = Math.max(h.prevTransform.y, w)), { scale: h.nextTransform.scale, x: n, y: d };
1061
+ const Re = (r) => {
1062
+ 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;
1063
+ return (n) => {
1064
+ let h = n.nextTransform.x, a = n.nextTransform.y;
1065
+ h < e && h < n.prevTransform.x && (h = Math.min(n.prevTransform.x, e));
1066
+ const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
1067
+ h > c && h > n.prevTransform.x && (h = Math.max(n.prevTransform.x, c)), a < s && a < n.prevTransform.y && (a = Math.min(n.prevTransform.y, s));
1068
+ const g = n.canvasHeight * n.prevTransform.scale, l = i - g;
1069
+ return a > l && a > n.prevTransform.y && (a = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: h, y: a };
1070
1070
  };
1071
- }, Ie = (t) => {
1072
- const e = t.maxContentScale, o = t.minContentScale, i = e !== null ? 1 / e : 0, s = o !== null ? 1 / o : 1 / 0;
1073
- return (h) => {
1074
- const n = h.prevTransform, d = h.nextTransform;
1075
- let c = d.scale, a = d.x, l = d.y;
1076
- if (d.scale > s && d.scale > n.scale) {
1077
- c = Math.max(n.scale, s), a = n.x, l = n.y;
1078
- const w = (c - n.scale) / (d.scale - n.scale);
1079
- a = n.x + (d.x - n.x) * w, l = n.y + (d.y - n.y) * w;
1071
+ }, Ie = (r) => {
1072
+ const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
1073
+ return (n) => {
1074
+ const h = n.prevTransform, a = n.nextTransform;
1075
+ let d = a.scale, c = a.x, g = a.y;
1076
+ if (a.scale > i && a.scale > h.scale) {
1077
+ d = Math.max(h.scale, i), c = h.x, g = h.y;
1078
+ const l = (d - h.scale) / (a.scale - h.scale);
1079
+ c = h.x + (a.x - h.x) * l, g = h.y + (a.y - h.y) * l;
1080
1080
  }
1081
- if (d.scale < i && d.scale < n.scale) {
1082
- c = Math.min(n.scale, i), a = n.x, l = n.y;
1083
- const w = (c - n.scale) / (d.scale - n.scale);
1084
- a = n.x + (d.x - n.x) * w, l = n.y + (d.y - n.y) * w;
1081
+ if (a.scale < s && a.scale < h.scale) {
1082
+ d = Math.min(h.scale, s), c = h.x, g = h.y;
1083
+ const l = (d - h.scale) / (a.scale - h.scale);
1084
+ c = h.x + (a.x - h.x) * l, g = h.y + (a.y - h.y) * l;
1085
1085
  }
1086
1086
  return {
1087
- scale: c,
1088
- x: a,
1089
- y: l
1087
+ scale: d,
1088
+ x: c,
1089
+ y: g
1090
1090
  };
1091
1091
  };
1092
- }, Be = (t) => (e) => t.reduce(
1093
- (o, i) => i({
1092
+ }, Be = (r) => (e) => r.reduce(
1093
+ (t, s) => s({
1094
1094
  prevTransform: e.prevTransform,
1095
- nextTransform: o,
1095
+ nextTransform: t,
1096
1096
  canvasWidth: e.canvasWidth,
1097
1097
  canvasHeight: e.canvasHeight
1098
1098
  }),
1099
1099
  e.nextTransform
1100
- ), te = (t) => {
1101
- if (typeof t == "function")
1102
- return t;
1103
- switch (t.type) {
1100
+ ), te = (r) => {
1101
+ if (typeof r == "function")
1102
+ return r;
1103
+ switch (r.type) {
1104
1104
  case "scale-limit":
1105
1105
  return Ie({
1106
- minContentScale: t.minContentScale ?? 0,
1107
- maxContentScale: t.maxContentScale ?? 1 / 0
1106
+ minContentScale: r.minContentScale ?? 0,
1107
+ maxContentScale: r.maxContentScale ?? 1 / 0
1108
1108
  });
1109
1109
  case "shift-limit":
1110
1110
  return Re({
1111
- minX: t.minX ?? -1 / 0,
1112
- maxX: t.maxX ?? 1 / 0,
1113
- minY: t.minY ?? -1 / 0,
1114
- maxY: t.maxY ?? 1 / 0
1111
+ minX: r.minX ?? -1 / 0,
1112
+ maxX: r.maxX ?? 1 / 0,
1113
+ minY: r.minY ?? -1 / 0,
1114
+ maxY: r.maxY ?? 1 / 0
1115
1115
  });
1116
1116
  }
1117
- }, Ve = (t) => {
1118
- var y, p, E, b, T, P, M, L, J, K, Q, _;
1119
- const e = (y = t == null ? void 0 : t.scale) == null ? void 0 : y.mouseWheelSensitivity, o = e !== void 0 ? e : 1.2, i = t == null ? void 0 : t.transformPreprocessor;
1120
- let s;
1121
- i !== void 0 ? Array.isArray(i) ? s = Be(
1122
- i.map(
1123
- (D) => te(D)
1117
+ }, Ve = (r) => {
1118
+ var f, A, m, x, b, T, M, L, J, K, Q, _;
1119
+ 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;
1120
+ let i;
1121
+ s !== void 0 ? Array.isArray(s) ? i = Be(
1122
+ s.map(
1123
+ (P) => te(P)
1124
1124
  )
1125
- ) : s = te(i) : s = (D) => D.nextTransform;
1126
- const h = ((p = t == null ? void 0 : t.shift) == null ? void 0 : p.cursor) !== void 0 ? t.shift.cursor : "grab", n = ((E = t == null ? void 0 : t.events) == null ? void 0 : E.onBeforeTransformChange) ?? (() => {
1127
- }), d = ((b = t == null ? void 0 : t.events) == null ? void 0 : b.onTransformChange) ?? (() => {
1128
- }), c = (T = t == null ? void 0 : t.shift) == null ? void 0 : T.mouseDownEventVerifier, a = c !== void 0 ? c : (D) => D.button === 0, l = (P = t == null ? void 0 : t.shift) == null ? void 0 : P.mouseUpEventVerifier, w = l !== void 0 ? l : (D) => D.button === 0, v = (M = t == null ? void 0 : t.scale) == null ? void 0 : M.mouseWheelEventVerifier, A = v !== void 0 ? v : () => !0;
1125
+ ) : i = te(s) : i = (P) => P.nextTransform;
1126
+ const n = ((A = r == null ? void 0 : r.shift) == null ? void 0 : A.cursor) !== void 0 ? r.shift.cursor : "grab", h = ((m = r == null ? void 0 : r.events) == null ? void 0 : m.onBeforeTransformChange) ?? (() => {
1127
+ }), a = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformChange) ?? (() => {
1128
+ }), d = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseDownEventVerifier, c = d !== void 0 ? d : (P) => P.button === 0, g = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseUpEventVerifier, l = g !== void 0 ? g : (P) => P.button === 0, v = (M = r == null ? void 0 : r.scale) == null ? void 0 : M.mouseWheelEventVerifier, p = v !== void 0 ? v : () => !0;
1129
1129
  return {
1130
- wheelSensitivity: o,
1131
- onTransformStarted: ((L = t == null ? void 0 : t.events) == null ? void 0 : L.onTransformStarted) ?? (() => {
1130
+ wheelSensitivity: t,
1131
+ onTransformStarted: ((L = r == null ? void 0 : r.events) == null ? void 0 : L.onTransformStarted) ?? (() => {
1132
1132
  }),
1133
- onTransformFinished: ((J = t == null ? void 0 : t.events) == null ? void 0 : J.onTransformFinished) ?? (() => {
1133
+ onTransformFinished: ((J = r == null ? void 0 : r.events) == null ? void 0 : J.onTransformFinished) ?? (() => {
1134
1134
  }),
1135
- onBeforeTransformChange: n,
1136
- onTransformChange: d,
1137
- transformPreprocessor: s,
1138
- shiftCursor: h,
1139
- mouseDownEventVerifier: a,
1140
- mouseUpEventVerifier: w,
1141
- mouseWheelEventVerifier: A,
1142
- scaleWheelFinishTimeout: ((K = t == null ? void 0 : t.scale) == null ? void 0 : K.wheelFinishTimeout) ?? 500,
1143
- onResizeTransformStarted: ((Q = t == null ? void 0 : t.events) == null ? void 0 : Q.onResizeTransformStarted) ?? (() => {
1135
+ onBeforeTransformChange: h,
1136
+ onTransformChange: a,
1137
+ transformPreprocessor: i,
1138
+ shiftCursor: n,
1139
+ mouseDownEventVerifier: c,
1140
+ mouseUpEventVerifier: l,
1141
+ mouseWheelEventVerifier: p,
1142
+ scaleWheelFinishTimeout: ((K = r == null ? void 0 : r.scale) == null ? void 0 : K.wheelFinishTimeout) ?? 500,
1143
+ onResizeTransformStarted: ((Q = r == null ? void 0 : r.events) == null ? void 0 : Q.onResizeTransformStarted) ?? (() => {
1144
1144
  }),
1145
- onResizeTransformFinished: ((_ = t == null ? void 0 : t.events) == null ? void 0 : _.onResizeTransformFinished) ?? (() => {
1145
+ onResizeTransformFinished: ((_ = r == null ? void 0 : r.events) == null ? void 0 : _.onResizeTransformFinished) ?? (() => {
1146
1146
  })
1147
1147
  };
1148
- }, Ue = (t, e, o) => ({
1149
- scale: t.scale,
1150
- x: t.x + t.scale * e,
1151
- y: t.y + t.scale * o
1152
- }), Ce = (t, e, o, i) => ({
1153
- scale: t.scale * e,
1154
- x: t.scale * (1 - e) * o + t.x,
1155
- y: t.scale * (1 - e) * i + t.y
1156
- }), I = (t) => {
1157
- const e = [], o = t.touches.length;
1158
- for (let d = 0; d < o; d++)
1159
- e.push([t.touches[d].clientX, t.touches[d].clientY]);
1160
- const i = e.reduce(
1161
- (d, c) => [d[0] + c[0], d[1] + c[1]],
1148
+ }, Ce = (r, e, t) => ({
1149
+ scale: r.scale,
1150
+ x: r.x + r.scale * e,
1151
+ y: r.y + r.scale * t
1152
+ }), Ue = (r, e, t, s) => ({
1153
+ scale: r.scale * e,
1154
+ x: r.scale * (1 - e) * t + r.x,
1155
+ y: r.scale * (1 - e) * s + r.y
1156
+ }), I = (r) => {
1157
+ const e = [], t = r.touches.length;
1158
+ for (let a = 0; a < t; a++)
1159
+ e.push([r.touches[a].clientX, r.touches[a].clientY]);
1160
+ const s = e.reduce(
1161
+ (a, d) => [a[0] + d[0], a[1] + d[1]],
1162
1162
  [0, 0]
1163
- ), s = [i[0] / o, i[1] / o], n = e.map((d) => [d[0] - s[0], d[1] - s[1]]).reduce(
1164
- (d, c) => d + Math.sqrt(c[0] * c[0] + c[1] * c[1]),
1163
+ ), i = [s[0] / t, s[1] / t], h = e.map((a) => [a[0] - i[0], a[1] - i[1]]).reduce(
1164
+ (a, d) => a + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
1165
1165
  0
1166
1166
  );
1167
1167
  return {
1168
- x: s[0],
1169
- y: s[1],
1170
- scale: n / o,
1171
- touchesCnt: o,
1168
+ x: i[0],
1169
+ y: i[1],
1170
+ scale: h / t,
1171
+ touchesCnt: t,
1172
1172
  touches: e
1173
1173
  };
1174
1174
  };
1175
- class U {
1176
- constructor(e, o, i, s) {
1177
- r(this, "viewport");
1178
- r(this, "prevTouches", null);
1179
- r(this, "wheelFinishTimer", null);
1180
- r(this, "transformInProgress", !1);
1181
- r(this, "onBeforeDestroy", () => {
1175
+ class C {
1176
+ constructor(e, t, s, i) {
1177
+ o(this, "viewport");
1178
+ o(this, "prevTouches", null);
1179
+ o(this, "wheelFinishTimer", null);
1180
+ o(this, "transformInProgress", !1);
1181
+ o(this, "onBeforeDestroy", () => {
1182
1182
  this.removeMouseDragListeners(), this.removeTouchDragListeners(), this.observer.unobserve(this.element), this.element.removeEventListener("mousedown", this.onMouseDown), this.element.removeEventListener("wheel", this.onWheelScroll), this.element.removeEventListener("touchstart", this.onTouchStart), this.element.removeEventListener("wheel", this.preventWheelScaleListener), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
1183
1183
  });
1184
- r(this, "onMouseDown", (e) => {
1184
+ o(this, "onMouseDown", (e) => {
1185
1185
  this.element === null || !this.config.mouseDownEventVerifier(e) || (B(this.element, this.config.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
1186
1186
  passive: !0
1187
1187
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
1188
1188
  passive: !0
1189
1189
  }), this.startRegisteredTransform());
1190
1190
  });
1191
- r(this, "onWindowMouseMove", (e) => {
1192
- const o = m(
1191
+ o(this, "onWindowMouseMove", (e) => {
1192
+ const t = N(
1193
1193
  this.window,
1194
1194
  this.element,
1195
1195
  e.clientX,
1196
1196
  e.clientY
1197
1197
  );
1198
- if (this.element === null || !o) {
1198
+ if (this.element === null || !t) {
1199
1199
  this.stopMouseDrag();
1200
1200
  return;
1201
1201
  }
1202
- const i = -e.movementX, s = -e.movementY;
1203
- this.moveViewport(i, s);
1202
+ const s = -e.movementX, i = -e.movementY;
1203
+ this.moveViewport(s, i);
1204
1204
  });
1205
- r(this, "onWindowMouseUp", (e) => {
1205
+ o(this, "onWindowMouseUp", (e) => {
1206
1206
  this.element === null || !this.config.mouseUpEventVerifier(e) || this.stopMouseDrag();
1207
1207
  });
1208
- r(this, "onWheelScroll", (e) => {
1208
+ o(this, "onWheelScroll", (e) => {
1209
1209
  if (!this.config.mouseWheelEventVerifier(e))
1210
1210
  return;
1211
- const { left: o, top: i } = this.element.getBoundingClientRect(), s = e.clientX - o, h = e.clientY - i, d = 1 / (e.deltaY < 0 ? this.config.wheelSensitivity : 1 / this.config.wheelSensitivity);
1212
- this.wheelFinishTimer === null && this.config.onTransformStarted(), this.scaleViewport(d, s, h), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
1211
+ const { left: t, top: s } = this.element.getBoundingClientRect(), i = e.clientX - t, n = e.clientY - s, a = 1 / (e.deltaY < 0 ? this.config.wheelSensitivity : 1 / this.config.wheelSensitivity);
1212
+ this.wheelFinishTimer === null && this.config.onTransformStarted(), this.scaleViewport(a, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
1213
1213
  this.transformInProgress || this.config.onTransformFinished(), this.wheelFinishTimer = null;
1214
1214
  }, this.config.scaleWheelFinishTimeout);
1215
1215
  });
1216
- r(this, "onTouchStart", (e) => {
1216
+ o(this, "onTouchStart", (e) => {
1217
1217
  if (this.prevTouches !== null) {
1218
1218
  this.prevTouches = I(e);
1219
1219
  return;
@@ -1226,42 +1226,42 @@ class U {
1226
1226
  passive: !0
1227
1227
  }), this.startRegisteredTransform();
1228
1228
  });
1229
- r(this, "onWindowTouchMove", (e) => {
1230
- const o = I(e);
1231
- if (!o.touches.every(
1232
- (s) => m(this.window, this.element, s[0], s[1])
1229
+ o(this, "onWindowTouchMove", (e) => {
1230
+ const t = I(e);
1231
+ if (!t.touches.every(
1232
+ (i) => N(this.window, this.element, i[0], i[1])
1233
1233
  )) {
1234
1234
  this.stopTouchDrag();
1235
1235
  return;
1236
1236
  }
1237
- if ((o.touchesCnt === 1 || o.touchesCnt === 2) && this.moveViewport(
1238
- -(o.x - this.prevTouches.x),
1239
- -(o.y - this.prevTouches.y)
1240
- ), o.touchesCnt === 2) {
1241
- const { left: s, top: h } = this.element.getBoundingClientRect(), n = this.prevTouches.x - s, d = this.prevTouches.y - h, a = 1 / (o.scale / this.prevTouches.scale);
1242
- this.scaleViewport(a, n, d);
1237
+ if ((t.touchesCnt === 1 || t.touchesCnt === 2) && this.moveViewport(
1238
+ -(t.x - this.prevTouches.x),
1239
+ -(t.y - this.prevTouches.y)
1240
+ ), t.touchesCnt === 2) {
1241
+ const { left: i, top: n } = this.element.getBoundingClientRect(), h = this.prevTouches.x - i, a = this.prevTouches.y - n, c = 1 / (t.scale / this.prevTouches.scale);
1242
+ this.scaleViewport(c, h, a);
1243
1243
  }
1244
- this.prevTouches = o;
1244
+ this.prevTouches = t;
1245
1245
  });
1246
- r(this, "onWindowTouchFinish", (e) => {
1246
+ o(this, "onWindowTouchFinish", (e) => {
1247
1247
  e.touches.length > 0 ? this.prevTouches = I(e) : this.stopTouchDrag();
1248
1248
  });
1249
- r(this, "observer", new ResizeObserver(() => {
1250
- const e = this.viewport.getViewportMatrix(), { width: o, height: i } = this.element.getBoundingClientRect(), s = this.config.transformPreprocessor({
1249
+ o(this, "observer", new ResizeObserver(() => {
1250
+ const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.element.getBoundingClientRect(), i = this.config.transformPreprocessor({
1251
1251
  prevTransform: e,
1252
1252
  nextTransform: e,
1253
- canvasWidth: o,
1254
- canvasHeight: i
1253
+ canvasWidth: t,
1254
+ canvasHeight: s
1255
1255
  });
1256
- this.config.onResizeTransformStarted(), this.canvas.patchViewportMatrix(s), this.config.onResizeTransformFinished();
1256
+ this.config.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.config.onResizeTransformFinished();
1257
1257
  }));
1258
- r(this, "config");
1259
- r(this, "preventWheelScaleListener", (e) => {
1258
+ o(this, "config");
1259
+ o(this, "preventWheelScaleListener", (e) => {
1260
1260
  e.preventDefault();
1261
1261
  });
1262
- this.canvas = e, this.element = o, this.window = i, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
1262
+ this.canvas = e, this.element = t, this.window = s, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
1263
1263
  passive: !1
1264
- }), this.config = Ve(s), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
1264
+ }), this.config = Ve(i), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
1265
1265
  passive: !0
1266
1266
  }), this.element.addEventListener("wheel", this.onWheelScroll, {
1267
1267
  passive: !0
@@ -1269,32 +1269,32 @@ class U {
1269
1269
  passive: !0
1270
1270
  }), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1271
1271
  }
1272
- static configure(e, o, i, s) {
1273
- new U(
1272
+ static configure(e, t, s, i) {
1273
+ new C(
1274
1274
  e,
1275
- o,
1276
- i,
1277
- s
1275
+ t,
1276
+ s,
1277
+ i
1278
1278
  );
1279
1279
  }
1280
- moveViewport(e, o) {
1281
- const i = this.viewport.getViewportMatrix(), s = Ue(i, e, o), { width: h, height: n } = this.element.getBoundingClientRect(), d = this.config.transformPreprocessor({
1280
+ moveViewport(e, t) {
1281
+ const s = this.viewport.getViewportMatrix(), i = Ce(s, e, t), { width: n, height: h } = this.element.getBoundingClientRect(), a = this.config.transformPreprocessor({
1282
+ prevTransform: s,
1283
+ nextTransform: i,
1284
+ canvasWidth: n,
1285
+ canvasHeight: h
1286
+ });
1287
+ this.performTransform(a);
1288
+ }
1289
+ scaleViewport(e, t, s) {
1290
+ const i = this.canvas.viewport.getViewportMatrix(), n = Ue(i, e, t, s), { width: h, height: a } = this.element.getBoundingClientRect(), d = this.config.transformPreprocessor({
1282
1291
  prevTransform: i,
1283
- nextTransform: s,
1292
+ nextTransform: n,
1284
1293
  canvasWidth: h,
1285
- canvasHeight: n
1294
+ canvasHeight: a
1286
1295
  });
1287
1296
  this.performTransform(d);
1288
1297
  }
1289
- scaleViewport(e, o, i) {
1290
- const s = this.canvas.viewport.getViewportMatrix(), h = Ce(s, e, o, i), { width: n, height: d } = this.element.getBoundingClientRect(), c = this.config.transformPreprocessor({
1291
- prevTransform: s,
1292
- nextTransform: h,
1293
- canvasWidth: n,
1294
- canvasHeight: d
1295
- });
1296
- this.performTransform(c);
1297
- }
1298
1298
  stopMouseDrag() {
1299
1299
  B(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
1300
1300
  }
@@ -1318,21 +1318,21 @@ class U {
1318
1318
  }
1319
1319
  }
1320
1320
  class X {
1321
- constructor(e, o, i, s, h, n) {
1322
- r(this, "canvasResizeObserver");
1323
- r(this, "nodeHorizontal");
1324
- r(this, "nodeVertical");
1325
- r(this, "viewport");
1326
- r(this, "viewportWidth", 0);
1327
- r(this, "viewportHeight", 0);
1328
- r(this, "viewportMatrix");
1329
- r(this, "loadedArea", {
1321
+ constructor(e, t, s, i, n, h) {
1322
+ o(this, "canvasResizeObserver");
1323
+ o(this, "nodeHorizontal");
1324
+ o(this, "nodeVertical");
1325
+ o(this, "viewport");
1326
+ o(this, "viewportWidth", 0);
1327
+ o(this, "viewportHeight", 0);
1328
+ o(this, "viewportMatrix");
1329
+ o(this, "loadedArea", {
1330
1330
  xFrom: 1 / 0,
1331
1331
  xTo: 1 / 0,
1332
1332
  yFrom: 1 / 0,
1333
1333
  yTo: 1 / 0
1334
1334
  });
1335
- r(this, "updateLoadedArea", (e) => {
1335
+ o(this, "updateLoadedArea", (e) => {
1336
1336
  this.loadedArea = {
1337
1337
  xFrom: e.x,
1338
1338
  xTo: e.x + e.width,
@@ -1340,63 +1340,63 @@ class X {
1340
1340
  yTo: e.y + e.height
1341
1341
  };
1342
1342
  });
1343
- r(this, "onBeforeDestroy", () => {
1343
+ o(this, "onBeforeDestroy", () => {
1344
1344
  this.trigger.unsubscribe(this.updateLoadedArea), this.canvasResizeObserver.unobserve(this.element), this.canvas.viewport.onAfterUpdated.unsubscribe(
1345
1345
  this.onAfterViewportUpdated
1346
1346
  ), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
1347
1347
  });
1348
- r(this, "onAfterViewportUpdated", () => {
1348
+ o(this, "onAfterViewportUpdated", () => {
1349
1349
  this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
1350
1350
  });
1351
- r(this, "userTransformInProgress", !1);
1352
- var A, y, p, E, b;
1353
- this.canvas = e, this.element = o, this.window = i, this.trigger = h, this.virtualScrollOptions = n, this.nodeHorizontal = this.virtualScrollOptions.nodeContainingRadius.horizontal, this.nodeVertical = this.virtualScrollOptions.nodeContainingRadius.vertical, this.canvasResizeObserver = new ResizeObserver((T) => {
1354
- const P = T[0];
1355
- this.viewportWidth = P.contentRect.width, this.viewportHeight = P.contentRect.height, this.scheduleLoadAreaAroundViewport();
1351
+ o(this, "userTransformInProgress", !1);
1352
+ var p, f, A, m, x;
1353
+ this.canvas = e, this.element = t, this.window = s, this.trigger = n, this.virtualScrollOptions = h, this.nodeHorizontal = this.virtualScrollOptions.nodeContainingRadius.horizontal, this.nodeVertical = this.virtualScrollOptions.nodeContainingRadius.vertical, this.canvasResizeObserver = new ResizeObserver((b) => {
1354
+ const T = b[0];
1355
+ this.viewportWidth = T.contentRect.width, this.viewportHeight = T.contentRect.height, this.scheduleLoadAreaAroundViewport();
1356
1356
  }), this.viewport = e.viewport;
1357
- const d = ((A = s == null ? void 0 : s.events) == null ? void 0 : A.onResizeTransformStarted) ?? (() => {
1358
- }), c = ((y = s == null ? void 0 : s.events) == null ? void 0 : y.onResizeTransformFinished) ?? (() => {
1359
- }), a = ((p = s == null ? void 0 : s.events) == null ? void 0 : p.onTransformChange) ?? (() => {
1360
- }), l = ((E = s == null ? void 0 : s.events) == null ? void 0 : E.onBeforeTransformChange) ?? (() => {
1361
- }), w = ((b = s == null ? void 0 : s.events) == null ? void 0 : b.onTransformFinished) ?? (() => {
1357
+ const a = ((p = i == null ? void 0 : i.events) == null ? void 0 : p.onResizeTransformStarted) ?? (() => {
1358
+ }), d = ((f = i == null ? void 0 : i.events) == null ? void 0 : f.onResizeTransformFinished) ?? (() => {
1359
+ }), c = ((A = i == null ? void 0 : i.events) == null ? void 0 : A.onTransformChange) ?? (() => {
1360
+ }), g = ((m = i == null ? void 0 : i.events) == null ? void 0 : m.onBeforeTransformChange) ?? (() => {
1361
+ }), l = ((x = i == null ? void 0 : i.events) == null ? void 0 : x.onTransformFinished) ?? (() => {
1362
1362
  }), v = {
1363
- ...s,
1363
+ ...i,
1364
1364
  events: {
1365
- ...s == null ? void 0 : s.events,
1365
+ ...i == null ? void 0 : i.events,
1366
1366
  onResizeTransformStarted: () => {
1367
- this.userTransformInProgress = !0, d();
1367
+ this.userTransformInProgress = !0, a();
1368
1368
  },
1369
1369
  onResizeTransformFinished: () => {
1370
- this.userTransformInProgress = !1, c();
1370
+ this.userTransformInProgress = !1, d();
1371
1371
  },
1372
1372
  onBeforeTransformChange: () => {
1373
- this.userTransformInProgress = !0, l();
1373
+ this.userTransformInProgress = !0, g();
1374
1374
  },
1375
1375
  onTransformChange: () => {
1376
1376
  this.userTransformInProgress = !1;
1377
- const T = this.viewportMatrix;
1378
- this.viewportMatrix = this.viewport.getViewportMatrix(), T.scale !== this.viewportMatrix.scale && this.scheduleEnsureViewportAreaLoaded(), a();
1377
+ const b = this.viewportMatrix;
1378
+ this.viewportMatrix = this.viewport.getViewportMatrix(), b.scale !== this.viewportMatrix.scale && this.scheduleEnsureViewportAreaLoaded(), c();
1379
1379
  },
1380
1380
  onTransformFinished: () => {
1381
- this.scheduleLoadAreaAroundViewport(), w();
1381
+ this.scheduleLoadAreaAroundViewport(), l();
1382
1382
  }
1383
1383
  }
1384
1384
  };
1385
- U.configure(
1385
+ C.configure(
1386
1386
  e,
1387
1387
  this.element,
1388
1388
  this.window,
1389
1389
  v
1390
1390
  ), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1391
1391
  }
1392
- static configure(e, o, i, s, h, n) {
1392
+ static configure(e, t, s, i, n, h) {
1393
1393
  new X(
1394
1394
  e,
1395
- o,
1396
- i,
1395
+ t,
1397
1396
  s,
1398
- h,
1399
- n
1397
+ i,
1398
+ n,
1399
+ h
1400
1400
  );
1401
1401
  }
1402
1402
  scheduleLoadAreaAroundViewport() {
@@ -1405,130 +1405,130 @@ class X {
1405
1405
  });
1406
1406
  }
1407
1407
  scheduleEnsureViewportAreaLoaded() {
1408
- const e = this.viewportWidth * this.viewportMatrix.scale, o = this.viewportHeight * this.viewportMatrix.scale, i = this.viewportMatrix.x - this.nodeHorizontal, s = this.viewportMatrix.y - this.nodeVertical, h = this.viewportMatrix.x + e + this.nodeHorizontal, n = this.viewportMatrix.y + o + this.nodeVertical;
1409
- this.loadedArea.xFrom < i && this.loadedArea.xTo > h && this.loadedArea.yFrom < s && this.loadedArea.yTo > n || this.scheduleLoadAreaAroundViewport();
1408
+ const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - this.nodeHorizontal, i = this.viewportMatrix.y - this.nodeVertical, n = this.viewportMatrix.x + e + this.nodeHorizontal, h = this.viewportMatrix.y + t + this.nodeVertical;
1409
+ this.loadedArea.xFrom < s && this.loadedArea.xTo > n && this.loadedArea.yFrom < i && this.loadedArea.yTo > h || this.scheduleLoadAreaAroundViewport();
1410
1410
  }
1411
1411
  loadAreaAroundViewport() {
1412
- const e = this.viewportWidth * this.viewportMatrix.scale, o = this.viewportHeight * this.viewportMatrix.scale, i = this.viewportMatrix.x - e - this.nodeHorizontal, s = this.viewportMatrix.y - o - this.nodeVertical, h = 3 * e + 2 * this.nodeHorizontal, n = 3 * o + 2 * this.nodeVertical;
1413
- this.trigger.emit({ x: i, y: s, width: h, height: n });
1412
+ const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - e - this.nodeHorizontal, i = this.viewportMatrix.y - t - this.nodeVertical, n = 3 * e + 2 * this.nodeHorizontal, h = 3 * t + 2 * this.nodeVertical;
1413
+ this.trigger.emit({ x: s, y: i, width: n, height: h });
1414
1414
  }
1415
1415
  }
1416
- const We = () => {
1417
- const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1418
- return t.style.position = "absolute", t.style.inset = "0", t;
1419
- }, $e = () => {
1420
- const t = document.createElementNS("http://www.w3.org/2000/svg", "rect");
1421
- return t.setAttribute("fill", "url(#pattern)"), t;
1416
+ const $e = () => {
1417
+ const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1418
+ return r.style.position = "absolute", r.style.inset = "0", r;
1419
+ }, We = () => {
1420
+ const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
1421
+ return r.setAttribute("fill", "url(#pattern)"), r;
1422
1422
  }, Fe = () => {
1423
- const t = document.createElementNS(
1423
+ const r = document.createElementNS(
1424
1424
  "http://www.w3.org/2000/svg",
1425
1425
  "pattern"
1426
1426
  );
1427
- return t.setAttribute("id", "pattern"), t;
1428
- }, Oe = (t, e) => {
1429
- const o = document.createElementNS(
1427
+ return r.setAttribute("id", "pattern"), r;
1428
+ }, Oe = (r, e) => {
1429
+ const t = document.createElementNS(
1430
1430
  "http://www.w3.org/2000/svg",
1431
1431
  "circle"
1432
1432
  );
1433
- return o.setAttribute("cx", "0"), o.setAttribute("cy", "0"), o.setAttribute("r", `${t}`), o.setAttribute("fill", `${e}`), o;
1434
- }, ke = (t) => t instanceof SVGElement ? t : Oe(
1435
- (t == null ? void 0 : t.radius) ?? 1.5,
1436
- (t == null ? void 0 : t.color) ?? "#d8d8d8"
1437
- ), ze = (t) => {
1438
- const e = t.tileDimensions, o = (e == null ? void 0 : e.width) ?? 25, i = (e == null ? void 0 : e.height) ?? 25, s = ke(t.renderer ?? {});
1433
+ return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
1434
+ }, ke = (r) => r instanceof SVGElement ? r : Oe(
1435
+ (r == null ? void 0 : r.radius) ?? 1.5,
1436
+ (r == null ? void 0 : r.color) ?? "#d8d8d8"
1437
+ ), ze = (r) => {
1438
+ const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = ke(r.renderer ?? {});
1439
1439
  return {
1440
- tileWidth: o,
1441
- tileHeight: i,
1442
- renderer: s,
1443
- maxViewportScale: t.maxViewportScale ?? 10
1440
+ tileWidth: t,
1441
+ tileHeight: s,
1442
+ renderer: i,
1443
+ maxViewportScale: r.maxViewportScale ?? 10
1444
1444
  };
1445
1445
  };
1446
1446
  class Y {
1447
- constructor(e, o, i) {
1448
- r(this, "svg", We());
1449
- r(this, "patternRenderingRectangle", $e());
1450
- r(this, "pattern", Fe());
1451
- r(this, "patternContent");
1452
- r(this, "tileWidth");
1453
- r(this, "tileHeight");
1454
- r(this, "halfTileWidth");
1455
- r(this, "halfTileHeight");
1456
- r(this, "maxViewportScale");
1457
- r(this, "visible", !1);
1458
- r(this, "resizeObserver", new ResizeObserver((e) => {
1459
- const o = e[0], { width: i, height: s } = o.contentRect;
1460
- this.svg.setAttribute("width", `${i}`), this.svg.setAttribute("height", `${s}`), this.patternRenderingRectangle.setAttribute("width", `${i}`), this.patternRenderingRectangle.setAttribute("height", `${s}`);
1461
- const h = this.tileWidth / i, n = this.tileHeight / s;
1462
- this.pattern.setAttribute("width", `${h}`), this.pattern.setAttribute("height", `${n}`);
1447
+ constructor(e, t, s) {
1448
+ o(this, "svg", $e());
1449
+ o(this, "patternRenderingRectangle", We());
1450
+ o(this, "pattern", Fe());
1451
+ o(this, "patternContent");
1452
+ o(this, "tileWidth");
1453
+ o(this, "tileHeight");
1454
+ o(this, "halfTileWidth");
1455
+ o(this, "halfTileHeight");
1456
+ o(this, "maxViewportScale");
1457
+ o(this, "visible", !1);
1458
+ o(this, "resizeObserver", new ResizeObserver((e) => {
1459
+ const t = e[0], { width: s, height: i } = t.contentRect;
1460
+ this.svg.setAttribute("width", `${s}`), this.svg.setAttribute("height", `${i}`), this.patternRenderingRectangle.setAttribute("width", `${s}`), this.patternRenderingRectangle.setAttribute("height", `${i}`);
1461
+ const n = this.tileWidth / s, h = this.tileHeight / i;
1462
+ this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${h}`);
1463
1463
  }));
1464
- r(this, "onAfterTransformUpdated", () => {
1465
- const e = this.canvas.viewport.getContentMatrix(), o = e.x - this.halfTileWidth * e.scale, i = e.y - this.halfTileHeight * e.scale, s = `matrix(${e.scale}, 0, 0, ${e.scale}, ${o}, ${i})`;
1466
- this.pattern.setAttribute("patternTransform", s), this.updateVisibility();
1464
+ o(this, "onAfterTransformUpdated", () => {
1465
+ 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})`;
1466
+ this.pattern.setAttribute("patternTransform", i), this.updateVisibility();
1467
1467
  });
1468
- r(this, "onBeforeDestroy", () => {
1468
+ o(this, "onBeforeDestroy", () => {
1469
1469
  this.resizeObserver.unobserve(this.host), this.host.removeChild(this.svg), this.canvas.viewport.onAfterUpdated.unsubscribe(
1470
1470
  this.onAfterTransformUpdated
1471
1471
  ), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
1472
1472
  });
1473
- this.canvas = e, this.host = i;
1474
- const s = ze(o);
1475
- this.tileWidth = s.tileWidth, this.tileHeight = s.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = s.renderer, this.maxViewportScale = s.maxViewportScale;
1476
- const h = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
1477
- this.patternContent.setAttribute("transform", h), this.pattern.appendChild(this.patternContent);
1478
- const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
1479
- n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.host), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated(), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1473
+ this.canvas = e, this.host = s;
1474
+ const i = ze(t);
1475
+ this.tileWidth = i.tileWidth, this.tileHeight = i.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = i.renderer, this.maxViewportScale = i.maxViewportScale;
1476
+ const n = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
1477
+ this.patternContent.setAttribute("transform", n), this.pattern.appendChild(this.patternContent);
1478
+ const h = document.createElementNS("http://www.w3.org/2000/svg", "defs");
1479
+ h.appendChild(this.pattern), this.svg.appendChild(h), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.host), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated(), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1480
1480
  }
1481
- static configure(e, o, i) {
1482
- new Y(e, o, i);
1481
+ static configure(e, t, s) {
1482
+ new Y(e, t, s);
1483
1483
  }
1484
1484
  updateVisibility() {
1485
- const o = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
1486
- o && this.visible ? (this.visible = !1, this.host.removeChild(this.svg)) : !o && !this.visible && (this.visible = !0, this.host.appendChild(this.svg));
1485
+ const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
1486
+ t && this.visible ? (this.visible = !1, this.host.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.host.appendChild(this.svg));
1487
1487
  }
1488
1488
  }
1489
- const Xe = (t) => {
1490
- var d, c, a;
1491
- const e = () => "direct", o = (l) => l, i = (l) => l.button === 0, s = () => {
1492
- }, h = () => {
1489
+ const Xe = (r) => {
1490
+ var a, d, c;
1491
+ const e = () => "direct", t = (g) => g, s = (g) => g.button === 0, i = () => {
1493
1492
  }, n = () => {
1493
+ }, h = () => {
1494
1494
  };
1495
1495
  return {
1496
- connectionTypeResolver: t.connectionTypeResolver ?? e,
1497
- connectionPreprocessor: t.connectionPreprocessor ?? o,
1498
- mouseDownEventVerifier: t.mouseDownEventVerifier ?? i,
1499
- mouseUpEventVerifier: t.mouseUpEventVerifier ?? i,
1500
- onAfterEdgeCreated: ((d = t.events) == null ? void 0 : d.onAfterEdgeCreated) ?? s,
1501
- onEdgeCreationInterrupted: ((c = t.events) == null ? void 0 : c.onEdgeCreationInterrupted) ?? n,
1502
- onEdgeCreationPrevented: ((a = t.events) == null ? void 0 : a.onEdgeCreationPrevented) ?? h,
1503
- dragPortDirection: t.dragPortDirection ?? void 0
1496
+ connectionTypeResolver: r.connectionTypeResolver ?? e,
1497
+ connectionPreprocessor: r.connectionPreprocessor ?? t,
1498
+ mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
1499
+ mouseUpEventVerifier: r.mouseUpEventVerifier ?? s,
1500
+ onAfterEdgeCreated: ((a = r.events) == null ? void 0 : a.onAfterEdgeCreated) ?? i,
1501
+ onEdgeCreationInterrupted: ((d = r.events) == null ? void 0 : d.onEdgeCreationInterrupted) ?? h,
1502
+ onEdgeCreationPrevented: ((c = r.events) == null ? void 0 : c.onEdgeCreationPrevented) ?? n,
1503
+ dragPortDirection: r.dragPortDirection ?? void 0
1504
1504
  };
1505
1505
  };
1506
1506
  class H {
1507
- constructor(e, o, i, s, h, n) {
1508
- r(this, "config");
1509
- r(this, "overlayCanvas");
1510
- r(this, "staticOverlayPortId", "static");
1511
- r(this, "draggingOverlayPortId", "dragging");
1512
- r(this, "staticPortId", null);
1513
- r(this, "isDirect", !0);
1514
- r(this, "onAfterPortMarked", (e) => {
1515
- const o = this.canvas.graph.getPort(e);
1516
- this.canvas.graph.getElementPortsIds(o.element).length === 1 && this.hookPortEvents(o.element);
1517
- });
1518
- r(this, "onBeforePortUnmarked", (e) => {
1519
- const o = this.canvas.graph.getPort(e);
1520
- this.canvas.graph.getElementPortsIds(o.element).length === 1 && this.unhookPortEvents(o.element);
1521
- });
1522
- r(this, "onPortMouseDown", (e) => {
1523
- const o = e.currentTarget;
1524
- this.config.mouseDownEventVerifier(e) && this.isPortConnectionAllowed(o) && (e.stopPropagation(), this.grabPort(o, { x: e.clientX, y: e.clientY }), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
1507
+ constructor(e, t, s, i, n, h) {
1508
+ o(this, "config");
1509
+ o(this, "overlayCanvas");
1510
+ o(this, "staticOverlayPortId", "static");
1511
+ o(this, "draggingOverlayPortId", "dragging");
1512
+ o(this, "staticPortId", null);
1513
+ o(this, "isDirect", !0);
1514
+ o(this, "onAfterPortMarked", (e) => {
1515
+ const t = this.canvas.graph.getPort(e);
1516
+ this.canvas.graph.getElementPortsIds(t.element).length === 1 && this.hookPortEvents(t.element);
1517
+ });
1518
+ o(this, "onBeforePortUnmarked", (e) => {
1519
+ const t = this.canvas.graph.getPort(e);
1520
+ this.canvas.graph.getElementPortsIds(t.element).length === 1 && this.unhookPortEvents(t.element);
1521
+ });
1522
+ o(this, "onPortMouseDown", (e) => {
1523
+ const t = e.currentTarget;
1524
+ this.config.mouseDownEventVerifier(e) && this.isPortConnectionAllowed(t) && (e.stopPropagation(), this.grabPort(t, { x: e.clientX, y: e.clientY }), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
1525
1525
  passive: !0
1526
1526
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
1527
1527
  passive: !0
1528
1528
  }));
1529
1529
  });
1530
- r(this, "onWindowMouseMove", (e) => {
1531
- if (!m(
1530
+ o(this, "onWindowMouseMove", (e) => {
1531
+ if (!N(
1532
1532
  this.window,
1533
1533
  this.overlayLayer,
1534
1534
  e.clientX,
@@ -1539,16 +1539,16 @@ class H {
1539
1539
  }
1540
1540
  this.moveDraggingNode({ x: e.clientX, y: e.clientY });
1541
1541
  });
1542
- r(this, "onWindowMouseUp", (e) => {
1542
+ o(this, "onWindowMouseUp", (e) => {
1543
1543
  this.config.mouseUpEventVerifier(e) && (this.tryCreateConnection({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
1544
1544
  });
1545
- r(this, "onPortTouchStart", (e) => {
1546
- const o = e.currentTarget;
1547
- if (!(e.touches.length === 1 && this.isPortConnectionAllowed(o)))
1545
+ o(this, "onPortTouchStart", (e) => {
1546
+ const t = e.currentTarget;
1547
+ if (!(e.touches.length === 1 && this.isPortConnectionAllowed(t)))
1548
1548
  return;
1549
1549
  e.stopPropagation();
1550
- const s = e.touches[0];
1551
- this.grabPort(o, { x: s.clientX, y: s.clientY }), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
1550
+ const i = e.touches[0];
1551
+ this.grabPort(t, { x: i.clientX, y: i.clientY }), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
1552
1552
  passive: !0
1553
1553
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
1554
1554
  passive: !0
@@ -1556,82 +1556,82 @@ class H {
1556
1556
  passive: !0
1557
1557
  });
1558
1558
  });
1559
- r(this, "onWindowTouchMove", (e) => {
1560
- const o = e.touches[0];
1561
- if (!m(
1559
+ o(this, "onWindowTouchMove", (e) => {
1560
+ const t = e.touches[0];
1561
+ if (!N(
1562
1562
  this.window,
1563
1563
  this.overlayLayer,
1564
- o.clientX,
1565
- o.clientY
1564
+ t.clientX,
1565
+ t.clientY
1566
1566
  )) {
1567
1567
  this.stopTouchDrag();
1568
1568
  return;
1569
1569
  }
1570
- this.moveDraggingNode({ x: o.clientX, y: o.clientY });
1570
+ this.moveDraggingNode({ x: t.clientX, y: t.clientY });
1571
1571
  });
1572
- r(this, "onWindowTouchFinish", (e) => {
1573
- const o = e.changedTouches[0];
1574
- this.tryCreateConnection({ x: o.clientX, y: o.clientY }), this.stopTouchDrag();
1572
+ o(this, "onWindowTouchFinish", (e) => {
1573
+ const t = e.changedTouches[0];
1574
+ this.tryCreateConnection({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
1575
1575
  });
1576
- r(this, "onBeforeClear", () => {
1576
+ o(this, "onBeforeClear", () => {
1577
1577
  this.canvas.graph.getAllPortIds().forEach((e) => {
1578
- const o = this.canvas.graph.getPort(e);
1579
- this.unhookPortEvents(o.element);
1578
+ const t = this.canvas.graph.getPort(e);
1579
+ this.unhookPortEvents(t.element);
1580
1580
  });
1581
1581
  });
1582
- r(this, "onBeforeDestroy", () => {
1582
+ o(this, "onBeforeDestroy", () => {
1583
1583
  this.stopMouseDrag(), this.stopTouchDrag(), this.canvas.graph.onAfterPortMarked.unsubscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.unsubscribe(
1584
1584
  this.onBeforePortUnmarked
1585
1585
  ), this.canvas.graph.onBeforeClear.unsubscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
1586
1586
  });
1587
- r(this, "onEdgeCreated", (e) => {
1587
+ o(this, "onEdgeCreated", (e) => {
1588
1588
  this.config.onAfterEdgeCreated(e);
1589
1589
  });
1590
- this.canvas = e, this.overlayLayer = o, this.viewportStore = i, this.window = s, this.config = Xe(n);
1591
- const d = new ae(), c = new he(
1592
- d,
1590
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.config = Xe(h);
1591
+ const a = new de(), d = new ne(
1592
+ a,
1593
1593
  this.viewportStore,
1594
1594
  this.overlayLayer
1595
1595
  );
1596
- this.overlayCanvas = new ce(
1596
+ this.overlayCanvas = new ae(
1597
1597
  this.overlayLayer,
1598
- d,
1598
+ a,
1599
1599
  this.viewportStore,
1600
- c,
1601
- h
1600
+ d,
1601
+ n
1602
1602
  ), 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);
1603
1603
  }
1604
- static configure(e, o, i, s, h, n) {
1604
+ static configure(e, t, s, i, n, h) {
1605
1605
  new H(
1606
1606
  e,
1607
- o,
1608
- i,
1607
+ t,
1609
1608
  s,
1610
- h,
1611
- n
1609
+ i,
1610
+ n,
1611
+ h
1612
1612
  );
1613
1613
  }
1614
- grabPort(e, o) {
1615
- const i = this.canvas.graph.getElementPortsIds(e)[0], s = this.canvas.graph.getPort(i);
1616
- this.staticPortId = i;
1617
- const h = this.config.connectionTypeResolver(this.staticPortId), n = e.getBoundingClientRect(), d = n.x + n.width / 2, c = n.y + n.height / 2, a = this.overlayLayer.getBoundingClientRect(), l = this.canvas.viewport.getViewportMatrix(), w = N(l, {
1618
- x: d - a.x,
1619
- y: c - a.y
1620
- }), v = N(l, {
1621
- x: o.x - a.x,
1622
- y: o.y - a.y
1623
- }), A = {
1614
+ grabPort(e, t) {
1615
+ const s = this.canvas.graph.getElementPortsIds(e)[0], i = this.canvas.graph.getPort(s);
1616
+ this.staticPortId = s;
1617
+ const n = this.config.connectionTypeResolver(this.staticPortId), h = e.getBoundingClientRect(), a = h.x + h.width / 2, d = h.y + h.height / 2, c = this.overlayLayer.getBoundingClientRect(), g = this.canvas.viewport.getViewportMatrix(), l = D(g, {
1618
+ x: a - c.x,
1619
+ y: d - c.y
1620
+ }), v = D(g, {
1621
+ x: t.x - c.x,
1622
+ y: t.y - c.y
1623
+ }), p = {
1624
1624
  overlayId: this.staticOverlayPortId,
1625
- portCoords: w,
1626
- portDirection: s.direction
1627
- }, y = {
1625
+ portCoords: l,
1626
+ portDirection: i.direction
1627
+ }, f = {
1628
1628
  overlayId: this.draggingOverlayPortId,
1629
1629
  portCoords: v,
1630
1630
  portDirection: this.config.dragPortDirection
1631
1631
  };
1632
- this.isDirect = h === "direct";
1633
- const p = this.isDirect ? A : y, E = this.isDirect ? y : A;
1634
- this.createOverlayGraph(p, E);
1632
+ this.isDirect = n === "direct";
1633
+ const A = this.isDirect ? p : f, m = this.isDirect ? f : p;
1634
+ this.createOverlayGraph(A, m);
1635
1635
  }
1636
1636
  hookPortEvents(e) {
1637
1637
  e.addEventListener("mousedown", this.onPortMouseDown, {
@@ -1652,351 +1652,468 @@ class H {
1652
1652
  resetDragState() {
1653
1653
  this.staticPortId = null, this.isDirect = !0, this.overlayCanvas.clear();
1654
1654
  }
1655
- createOverlayGraph(e, o) {
1656
- const i = this.createAddNodeRequest(e);
1657
- this.overlayCanvas.addNode(i);
1658
- const s = this.createAddNodeRequest(o);
1659
- this.overlayCanvas.addNode(s), this.overlayCanvas.addEdge({
1655
+ createOverlayGraph(e, t) {
1656
+ const s = this.createAddNodeRequest(e);
1657
+ this.overlayCanvas.addNode(s);
1658
+ const i = this.createAddNodeRequest(t);
1659
+ this.overlayCanvas.addNode(i), this.overlayCanvas.addEdge({
1660
1660
  from: e.overlayId,
1661
- to: o.overlayId
1661
+ to: t.overlayId
1662
1662
  });
1663
1663
  }
1664
1664
  createAddNodeRequest(e) {
1665
- const o = document.createElement("div");
1665
+ const t = document.createElement("div");
1666
1666
  return {
1667
1667
  id: e.overlayId,
1668
- element: o,
1668
+ element: t,
1669
1669
  x: e.portCoords.x,
1670
1670
  y: e.portCoords.y,
1671
1671
  ports: [
1672
1672
  {
1673
1673
  id: e.overlayId,
1674
- element: o,
1674
+ element: t,
1675
1675
  direction: e.portDirection
1676
1676
  }
1677
1677
  ]
1678
1678
  };
1679
1679
  }
1680
1680
  tryCreateConnection(e) {
1681
- const o = this.findPortAtPoint(e);
1682
- if (o === null) {
1681
+ const t = this.findPortAtPoint(e);
1682
+ if (t === null) {
1683
1683
  this.config.onEdgeCreationInterrupted(this.staticPortId, this.isDirect);
1684
1684
  return;
1685
1685
  }
1686
- const i = this.isDirect ? this.staticPortId : o, s = this.isDirect ? o : this.staticPortId, h = { from: i, to: s }, n = this.config.connectionPreprocessor(h);
1687
- n !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(n), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.config.onEdgeCreationPrevented(h);
1686
+ const s = this.isDirect ? this.staticPortId : t, i = this.isDirect ? t : this.staticPortId, n = { from: s, to: i }, h = this.config.connectionPreprocessor(n);
1687
+ h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.config.onEdgeCreationPrevented(n);
1688
1688
  }
1689
1689
  moveDraggingNode(e) {
1690
- const o = this.overlayLayer.getBoundingClientRect(), i = {
1691
- x: e.x - o.x,
1692
- y: e.y - o.y
1693
- }, s = this.canvas.viewport.getViewportMatrix(), h = N(s, i);
1690
+ const t = this.overlayLayer.getBoundingClientRect(), s = {
1691
+ x: e.x - t.x,
1692
+ y: e.y - t.y
1693
+ }, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
1694
1694
  this.overlayCanvas.updateNode(this.draggingOverlayPortId, {
1695
- x: h.x,
1696
- y: h.y
1695
+ x: n.x,
1696
+ y: n.y
1697
1697
  });
1698
1698
  }
1699
1699
  findPortAtPoint(e) {
1700
- const o = document.elementsFromPoint(e.x, e.y);
1701
- for (const i of o) {
1702
- const s = this.findPortAtElement(i);
1703
- if (s !== null)
1704
- return s;
1700
+ const t = document.elementsFromPoint(e.x, e.y);
1701
+ for (const s of t) {
1702
+ const i = this.findPortAtElement(s);
1703
+ if (i !== null)
1704
+ return i;
1705
1705
  }
1706
1706
  return null;
1707
1707
  }
1708
1708
  findPortAtElement(e) {
1709
- let o = e, i = null;
1710
- for (; o !== null && (i = this.canvas.graph.getElementPortsIds(o)[0] ?? null, i === null); )
1711
- o = o.parentElement;
1712
- return i;
1709
+ let t = e, s = null;
1710
+ for (; t !== null && (s = this.canvas.graph.getElementPortsIds(t)[0] ?? null, s === null); )
1711
+ t = t.parentElement;
1712
+ return s;
1713
1713
  }
1714
1714
  isPortConnectionAllowed(e) {
1715
- const o = this.canvas.graph.getElementPortsIds(e)[0];
1716
- return this.config.connectionTypeResolver(o) !== null;
1715
+ const t = this.canvas.graph.getElementPortsIds(e)[0];
1716
+ return this.config.connectionTypeResolver(t) !== null;
1717
1717
  }
1718
1718
  }
1719
1719
  const Ye = () => {
1720
- const t = document.createElement("div");
1721
- return t.style.width = "100%", t.style.height = "100%", t.style.position = "relative", t;
1722
- }, $ = () => {
1723
- const t = document.createElement("div");
1724
- return t.style.position = "absolute", t.style.inset = "0", t;
1720
+ const r = document.createElement("div");
1721
+ return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
1722
+ }, W = () => {
1723
+ const r = document.createElement("div");
1724
+ return r.style.position = "absolute", r.style.inset = "0", r;
1725
1725
  };
1726
1726
  class He {
1727
1727
  constructor(e) {
1728
- r(this, "background", $());
1729
- r(this, "main", $());
1730
- r(this, "overlay", $());
1731
- r(this, "host", Ye());
1728
+ o(this, "background", W());
1729
+ o(this, "main", W());
1730
+ o(this, "overlay", W());
1731
+ o(this, "host", Ye());
1732
1732
  this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.overlay.style.pointerEvents = "none", this.host.appendChild(this.overlay);
1733
1733
  }
1734
1734
  destroy() {
1735
1735
  this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlay), this.element.removeChild(this.host);
1736
1736
  }
1737
1737
  }
1738
- const je = (t, e) => ({
1739
- x: t / 2,
1738
+ const je = (r, e) => ({
1739
+ x: r / 2,
1740
1740
  y: e / 2
1741
- }), F = (t) => () => t, oe = F(0), Ge = () => {
1742
- let t = 0;
1743
- return () => t++;
1744
- }, Ze = (t, e) => {
1745
- let o = oe, i = oe;
1746
- const s = Ge();
1747
- return t === "incremental" && (o = s), e === "incremental" && (i = s), typeof t == "number" && (o = F(t)), typeof e == "number" && (i = F(e)), typeof t == "function" && (o = t), typeof e == "function" && (i = e), {
1748
- nodesPriorityFn: o,
1749
- edgesPriorityFn: i
1741
+ }), F = (r) => () => r, re = F(0), Ge = () => {
1742
+ let r = 0;
1743
+ return () => r++;
1744
+ }, Ze = (r, e) => {
1745
+ let t = re, s = re;
1746
+ const i = Ge();
1747
+ return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = F(r)), typeof e == "number" && (s = F(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
1748
+ nodesPriorityFn: t,
1749
+ edgesPriorityFn: s
1750
1750
  };
1751
- }, f = (t, e, o) => ({
1752
- x: e.x * t.x - e.y * t.y + ((1 - e.x) * o.x + e.y * o.y),
1753
- y: e.y * t.x + e.x * t.y + ((1 - e.x) * o.y - e.y * o.x)
1754
- }), g = {
1751
+ }, y = (r, e, t) => ({
1752
+ x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
1753
+ y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
1754
+ }), w = {
1755
1755
  x: 0,
1756
1756
  y: 0
1757
- }, Je = (t) => {
1758
- const e = f(
1759
- { x: t.arrowLength, y: g.y },
1760
- t.sourceDirection,
1761
- g
1762
- ), o = f(
1763
- { x: t.to.x - t.arrowLength, y: t.to.y },
1764
- t.targetDirection,
1765
- t.to
1766
- ), i = {
1767
- x: e.x + t.sourceDirection.x * t.curvature,
1768
- y: e.y + t.sourceDirection.y * t.curvature
1769
- }, s = {
1770
- x: o.x - t.targetDirection.x * t.curvature,
1771
- y: o.y - t.targetDirection.y * t.curvature
1772
- }, h = `M ${e.x} ${e.y} C ${i.x} ${i.y}, ${s.x} ${s.y}, ${o.x} ${o.y}`, n = t.hasSourceArrow ? "" : `M ${g.x} ${g.y} L ${e.x} ${e.y} `, d = t.hasTargetArrow ? "" : ` M ${o.x} ${o.y} L ${t.to.x} ${t.to.y}`;
1773
- return `${n}${h}${d}`;
1774
- }, Ke = (t) => {
1775
- const e = t.hasSourceArrow ? f(
1776
- { x: t.arrowLength, y: g.y },
1777
- t.sourceDirection,
1778
- g
1779
- ) : g, o = t.hasTargetArrow ? f(
1780
- { x: t.to.x - t.arrowLength, y: t.to.y },
1781
- t.targetDirection,
1782
- t.to
1783
- ) : t.to, i = t.arrowLength, s = Math.cos(t.detourDirection) * t.detourDistance, h = Math.sin(t.detourDirection) * t.detourDistance, n = s * t.flipX, d = h * t.flipY, c = f(
1784
- { x: i, y: g.y },
1785
- t.sourceDirection,
1786
- g
1787
- ), a = {
1788
- x: c.x + n,
1789
- y: c.y + d
1790
- }, l = f(
1791
- { x: t.to.x - i, y: t.to.y },
1792
- t.targetDirection,
1793
- t.to
1794
- ), w = {
1795
- x: l.x + n,
1796
- y: l.y + d
1797
- }, v = { x: (a.x + w.x) / 2, y: (a.y + w.y) / 2 }, A = {
1798
- x: c.x + t.curvature * t.sourceDirection.x,
1799
- y: c.y + t.curvature * t.sourceDirection.y
1800
- }, y = {
1801
- x: l.x - t.curvature * t.targetDirection.x,
1802
- y: l.y - t.curvature * t.targetDirection.y
1803
- }, p = {
1804
- x: c.x + n,
1805
- y: c.y + d
1806
- }, E = {
1807
- x: l.x + n,
1808
- y: l.y + d
1809
- };
1810
- return [
1811
- `M ${e.x} ${e.y}`,
1812
- `L ${c.x} ${c.y}`,
1813
- `C ${A.x} ${A.y} ${p.x} ${p.y} ${v.x} ${v.y}`,
1814
- `C ${E.x} ${E.y} ${y.x} ${y.y} ${l.x} ${l.y}`,
1815
- `L ${o.x} ${o.y}`
1816
- ].join(" ");
1817
- }, R = (t, e) => {
1818
- const o = [];
1819
- if (t.length > 0 && o.push(`M ${t[0].x} ${t[0].y}`), t.length === 2 && o.push(`L ${t[1].x} ${t[1].y}`), t.length > 2) {
1820
- const i = t.length - 1;
1821
- let s = 0, h = 0, n = 0;
1822
- t.forEach((d, c) => {
1823
- let a = 0, l = 0, w = 0;
1824
- const v = c > 0, A = c < i, y = v && A;
1825
- if (v && (a = -s, l = -h, w = n), A) {
1826
- const L = t[c + 1];
1827
- s = L.x - d.x, h = L.y - d.y, n = Math.sqrt(s * s + h * h);
1757
+ };
1758
+ class Je {
1759
+ constructor(e) {
1760
+ o(this, "path");
1761
+ o(this, "median");
1762
+ this.params = e;
1763
+ const t = this.params.to;
1764
+ this.median = { x: t.x / 2, y: t.y / 2 };
1765
+ const s = y(
1766
+ { x: this.params.arrowLength, y: w.y },
1767
+ this.params.sourceDirection,
1768
+ w
1769
+ ), i = y(
1770
+ { x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
1771
+ this.params.targetDirection,
1772
+ this.params.to
1773
+ ), n = {
1774
+ x: s.x + this.params.sourceDirection.x * this.params.curvature,
1775
+ y: s.y + this.params.sourceDirection.y * this.params.curvature
1776
+ }, h = {
1777
+ x: i.x - this.params.targetDirection.x * this.params.curvature,
1778
+ y: i.y - this.params.targetDirection.y * this.params.curvature
1779
+ }, a = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${h.x} ${h.y}, ${i.x} ${i.y}`, d = this.params.hasSourceArrow ? "" : `M ${w.x} ${w.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${i.x} ${i.y} L ${this.params.to.x} ${this.params.to.y}`;
1780
+ this.path = `${d}${a}${c}`;
1781
+ }
1782
+ }
1783
+ const ce = (r, e, t, s) => ({
1784
+ x: e * r.x + (1 - e) / 2 * s.x,
1785
+ y: t * r.y + (1 - t) / 2 * s.y
1786
+ });
1787
+ class Ke {
1788
+ constructor(e) {
1789
+ o(this, "path");
1790
+ o(this, "median");
1791
+ this.params = e;
1792
+ const t = this.params.hasSourceArrow ? y(
1793
+ { x: this.params.arrowLength, y: w.y },
1794
+ this.params.sourceDirection,
1795
+ w
1796
+ ) : w, s = this.params.hasTargetArrow ? y(
1797
+ {
1798
+ x: this.params.to.x - this.params.arrowLength,
1799
+ y: this.params.to.y
1800
+ },
1801
+ this.params.targetDirection,
1802
+ this.params.to
1803
+ ) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, a = n * this.params.flipX, d = h * this.params.flipY, c = y(
1804
+ { x: i, y: w.y },
1805
+ this.params.sourceDirection,
1806
+ w
1807
+ ), g = {
1808
+ x: c.x + a,
1809
+ y: c.y + d
1810
+ }, l = y(
1811
+ { x: this.params.to.x - i, y: this.params.to.y },
1812
+ this.params.targetDirection,
1813
+ this.params.to
1814
+ ), v = {
1815
+ x: l.x + a,
1816
+ y: l.y + d
1817
+ }, p = {
1818
+ x: (g.x + v.x) / 2,
1819
+ y: (g.y + v.y) / 2
1820
+ }, f = {
1821
+ x: c.x + this.params.curvature * this.params.sourceDirection.x,
1822
+ y: c.y + this.params.curvature * this.params.sourceDirection.y
1823
+ }, A = {
1824
+ x: l.x - this.params.curvature * this.params.targetDirection.x,
1825
+ y: l.y - this.params.curvature * this.params.targetDirection.y
1826
+ }, m = {
1827
+ x: c.x + a,
1828
+ y: c.y + d
1829
+ }, x = {
1830
+ x: l.x + a,
1831
+ y: l.y + d
1832
+ };
1833
+ this.path = [
1834
+ `M ${t.x} ${t.y}`,
1835
+ `L ${c.x} ${c.y}`,
1836
+ `C ${f.x} ${f.y} ${m.x} ${m.y} ${p.x} ${p.y}`,
1837
+ `C ${x.x} ${x.y} ${A.x} ${A.y} ${l.x} ${l.y}`,
1838
+ `L ${s.x} ${s.y}`
1839
+ ].join(" "), this.median = ce(p, e.flipX, e.flipY, e.to);
1840
+ }
1841
+ }
1842
+ const R = (r, e) => {
1843
+ const t = [];
1844
+ 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) {
1845
+ const s = r.length - 1;
1846
+ let i = 0, n = 0, h = 0;
1847
+ r.forEach((a, d) => {
1848
+ let c = 0, g = 0, l = 0;
1849
+ const v = d > 0, p = d < s, f = v && p;
1850
+ if (v && (c = -i, g = -n, l = h), p) {
1851
+ const L = r[d + 1];
1852
+ i = L.x - a.x, n = L.y - a.y, h = Math.sqrt(i * i + n * n);
1828
1853
  }
1829
- const E = n !== 0 ? Math.min((y ? e : 0) / n, c < i - 1 ? 0.5 : 1) : 0, b = y ? { x: d.x + s * E, y: d.y + h * E } : d, P = w !== 0 ? Math.min((y ? e : 0) / w, c > 1 ? 0.5 : 1) : 0, M = y ? { x: d.x + a * P, y: d.y + l * P } : d;
1830
- c > 0 && o.push(`L ${M.x} ${M.y}`), y && o.push(
1831
- `C ${d.x} ${d.y} ${d.x} ${d.y} ${b.x} ${b.y}`
1854
+ const m = h !== 0 ? Math.min((f ? e : 0) / h, d < s - 1 ? 0.5 : 1) : 0, x = f ? { x: a.x + i * m, y: a.y + n * m } : a, T = l !== 0 ? Math.min((f ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, M = f ? { x: a.x + c * T, y: a.y + g * T } : a;
1855
+ d > 0 && t.push(`L ${M.x} ${M.y}`), f && t.push(
1856
+ `C ${a.x} ${a.y} ${a.x} ${a.y} ${x.x} ${x.y}`
1832
1857
  );
1833
1858
  });
1834
1859
  }
1835
- return o.join(" ");
1836
- }, Qe = (t) => {
1837
- const e = t.hasSourceArrow ? f(
1838
- { x: t.arrowLength, y: g.y },
1839
- t.sourceDirection,
1840
- g
1841
- ) : g, o = t.hasTargetArrow ? f(
1842
- { x: t.to.x - t.arrowLength, y: t.to.y },
1843
- t.targetDirection,
1844
- t.to
1845
- ) : t.to, i = t.arrowLength + t.arrowOffset, s = i - t.roundness, h = f(
1846
- { x: s, y: g.y },
1847
- t.sourceDirection,
1848
- g
1849
- ), n = f(
1850
- { x: t.to.x - s, y: t.to.y },
1851
- t.targetDirection,
1852
- t.to
1853
- ), d = Math.max((h.x + n.x) / 2, i), c = t.to.y / 2, a = {
1854
- x: t.flipX > 0 ? d : -i,
1855
- y: h.y
1856
- }, l = { x: a.x, y: c }, w = {
1857
- x: t.flipX > 0 ? t.to.x - d : t.to.x + i,
1858
- y: n.y
1859
- }, v = { x: w.x, y: c };
1860
- return R(
1861
- [e, h, a, l, v, w, n, o],
1862
- t.roundness
1863
- );
1864
- }, j = (t) => {
1865
- const e = t.hasSourceArrow ? f(
1866
- { x: t.arrowLength, y: g.y },
1867
- t.sourceDirection,
1868
- g
1869
- ) : g, o = t.hasTargetArrow ? f(
1870
- { x: t.to.x - t.arrowLength, y: t.to.y },
1871
- t.targetDirection,
1872
- t.to
1873
- ) : t.to, i = t.arrowLength + t.arrowOffset, s = f(
1874
- { x: i, y: g.y },
1875
- t.sourceDirection,
1876
- g
1877
- ), h = Math.cos(t.detourDirection) * t.detourDistance, n = Math.sin(t.detourDirection) * t.detourDistance, d = h * t.flipX, c = n * t.flipY, a = { x: s.x + d, y: s.y + c }, l = f(
1878
- { x: t.to.x - i, y: t.to.y },
1879
- t.targetDirection,
1880
- t.to
1881
- ), w = { x: l.x + d, y: l.y + c };
1882
- return R(
1883
- [e, s, a, w, l, o],
1884
- t.roundness
1885
- );
1886
- }, _e = (t) => {
1887
- const e = t.hasSourceArrow ? f(
1888
- { x: t.arrowLength, y: g.y },
1889
- t.sourceDirection,
1890
- g
1891
- ) : g, o = t.hasTargetArrow ? f(
1892
- { x: t.to.x - t.arrowLength, y: t.to.y },
1893
- t.targetDirection,
1894
- t.to
1895
- ) : t.to, i = t.arrowLength + t.arrowOffset, s = f(
1896
- { x: i, y: g.y },
1897
- t.sourceDirection,
1898
- g
1899
- ), h = f(
1900
- { x: t.to.x - i, y: t.to.y },
1901
- t.targetDirection,
1902
- t.to
1903
- );
1904
- return R([e, s, h, o], t.roundness);
1905
- }, qe = (t) => {
1906
- const e = t.hasSourceArrow ? f(
1907
- { x: t.arrowLength, y: g.y },
1908
- t.sourceDirection,
1909
- g
1910
- ) : g, o = t.hasTargetArrow ? f(
1911
- { x: t.to.x - t.arrowLength, y: t.to.y },
1912
- t.targetDirection,
1913
- t.to
1914
- ) : t.to, i = t.arrowLength + t.arrowOffset, s = i - t.roundness, h = f(
1915
- { x: s, y: g.y },
1916
- t.sourceDirection,
1917
- g
1918
- ), n = f(
1919
- { x: t.to.x - s, y: t.to.y },
1920
- t.targetDirection,
1921
- t.to
1922
- ), d = Math.max((h.y + n.y) / 2, i), c = t.to.x / 2, a = {
1923
- x: h.x,
1924
- y: t.flipY > 0 ? d : -i
1925
- }, l = { x: c, y: a.y }, w = {
1926
- x: n.x,
1927
- y: t.flipY > 0 ? t.to.y - d : t.to.y + i
1928
- }, v = { x: c, y: w.y };
1929
- return R(
1930
- [e, h, a, l, v, w, n, o],
1931
- t.roundness
1932
- );
1933
- }, G = (t) => {
1934
- const e = t.arrowOffset, o = t.side, i = t.arrowLength + e, s = i + 2 * o, n = [
1935
- { x: t.arrowLength, y: g.y },
1936
- { x: i, y: g.y },
1937
- { x: i, y: t.side },
1938
- { x: s, y: t.side },
1939
- { x: s, y: -t.side },
1940
- { x: i, y: -t.side },
1941
- { x: i, y: g.y },
1942
- { x: t.arrowLength, y: g.y }
1943
- ].map(
1944
- (c) => f(c, t.sourceDirection, g)
1945
- ), d = `M ${g.x} ${g.y} L ${n[0].x} ${n[0].y} `;
1946
- return `${t.hasSourceArrow || t.hasTargetArrow ? "" : d}${R(n, t.roundness)}`;
1947
- }, et = (t) => {
1948
- const e = t.smallRadius, o = t.radius, i = Math.sqrt(e * e + o * o), s = e + o, h = t.arrowLength + i * (1 - o / s), n = e * o / s, c = [
1949
- { x: t.arrowLength, y: g.y },
1950
- { x: h, y: n },
1951
- { x: h, y: -n }
1952
- ].map(
1953
- (w) => f(w, t.sourceDirection, g)
1954
- ), a = [
1955
- `M ${c[0].x} ${c[0].y}`,
1956
- `A ${e} ${e} 0 0 1 ${c[1].x} ${c[1].y}`,
1957
- `A ${o} ${o} 0 1 0 ${c[2].x} ${c[2].y}`,
1958
- `A ${e} ${e} 0 0 1 ${c[0].x} ${c[0].y}`
1959
- ].join(" "), l = `M 0 0 L ${c[0].x} ${c[0].y} `;
1960
- return `${t.hasSourceArrow || t.hasTargetArrow ? "" : l}${a}`;
1961
- }, le = (t, e) => {
1962
- t.style.transform = `translate(${e.x}px, ${e.y}px)`, t.style.width = `${Math.max(e.width, 1)}px`, t.style.height = `${Math.max(e.height, 1)}px`;
1860
+ return t.join(" ");
1861
+ };
1862
+ class Qe {
1863
+ constructor(e) {
1864
+ o(this, "path");
1865
+ o(this, "median");
1866
+ this.params = e;
1867
+ const t = this.params.to;
1868
+ this.median = { x: t.x / 2, y: t.y / 2 };
1869
+ const s = this.params.hasSourceArrow ? y(
1870
+ { x: this.params.arrowLength, y: w.y },
1871
+ this.params.sourceDirection,
1872
+ w
1873
+ ) : w, i = this.params.hasTargetArrow ? y(
1874
+ {
1875
+ x: this.params.to.x - this.params.arrowLength,
1876
+ y: this.params.to.y
1877
+ },
1878
+ this.params.targetDirection,
1879
+ this.params.to
1880
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = n - this.params.roundness, a = y(
1881
+ { x: h, y: w.y },
1882
+ this.params.sourceDirection,
1883
+ w
1884
+ ), d = y(
1885
+ { x: this.params.to.x - h, y: this.params.to.y },
1886
+ this.params.targetDirection,
1887
+ this.params.to
1888
+ ), c = Math.max((a.x + d.x) / 2, n), g = this.params.to.y / 2, l = {
1889
+ x: this.params.flipX > 0 ? c : -n,
1890
+ y: a.y
1891
+ }, v = { x: l.x, y: g }, p = {
1892
+ x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
1893
+ y: d.y
1894
+ }, f = { x: p.x, y: g };
1895
+ this.path = R(
1896
+ [s, a, l, v, f, p, d, i],
1897
+ this.params.roundness
1898
+ );
1899
+ }
1900
+ }
1901
+ class j {
1902
+ constructor(e) {
1903
+ o(this, "path");
1904
+ o(this, "median");
1905
+ this.params = e;
1906
+ const t = this.params.hasSourceArrow ? y(
1907
+ { x: this.params.arrowLength, y: w.y },
1908
+ this.params.sourceDirection,
1909
+ w
1910
+ ) : w, s = this.params.hasTargetArrow ? y(
1911
+ {
1912
+ x: this.params.to.x - this.params.arrowLength,
1913
+ y: this.params.to.y
1914
+ },
1915
+ this.params.targetDirection,
1916
+ this.params.to
1917
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1918
+ { x: i, y: w.y },
1919
+ this.params.sourceDirection,
1920
+ w
1921
+ ), h = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = h * this.params.flipX, c = a * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l = y(
1922
+ { x: this.params.to.x - i, y: this.params.to.y },
1923
+ this.params.targetDirection,
1924
+ this.params.to
1925
+ ), v = { x: l.x + d, y: l.y + c }, p = { x: (g.x + v.x) / 2, y: (g.y + v.y) / 2 };
1926
+ this.median = ce(p, e.flipX, e.flipY, e.to), this.path = R(
1927
+ [t, n, g, v, l, s],
1928
+ this.params.roundness
1929
+ );
1930
+ }
1931
+ }
1932
+ class _e {
1933
+ constructor(e) {
1934
+ o(this, "path");
1935
+ o(this, "median");
1936
+ this.params = e;
1937
+ const t = this.params.to;
1938
+ this.median = { x: t.x / 2, y: t.y / 2 };
1939
+ const s = this.params.hasSourceArrow ? y(
1940
+ { x: this.params.arrowLength, y: w.y },
1941
+ this.params.sourceDirection,
1942
+ w
1943
+ ) : w, i = this.params.hasTargetArrow ? y(
1944
+ {
1945
+ x: this.params.to.x - this.params.arrowLength,
1946
+ y: this.params.to.y
1947
+ },
1948
+ this.params.targetDirection,
1949
+ this.params.to
1950
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = y(
1951
+ { x: n, y: w.y },
1952
+ this.params.sourceDirection,
1953
+ w
1954
+ ), a = y(
1955
+ { x: this.params.to.x - n, y: this.params.to.y },
1956
+ this.params.targetDirection,
1957
+ this.params.to
1958
+ );
1959
+ this.path = R([s, h, a, i], this.params.roundness);
1960
+ }
1961
+ }
1962
+ class qe {
1963
+ constructor(e) {
1964
+ o(this, "path");
1965
+ o(this, "median");
1966
+ this.params = e;
1967
+ const t = this.params.to;
1968
+ this.median = { x: t.x / 2, y: t.y / 2 };
1969
+ const s = this.params.hasSourceArrow ? y(
1970
+ { x: this.params.arrowLength, y: w.y },
1971
+ this.params.sourceDirection,
1972
+ w
1973
+ ) : w, i = this.params.hasTargetArrow ? y(
1974
+ {
1975
+ x: this.params.to.x - this.params.arrowLength,
1976
+ y: this.params.to.y
1977
+ },
1978
+ this.params.targetDirection,
1979
+ this.params.to
1980
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = n - this.params.roundness, a = y(
1981
+ { x: h, y: w.y },
1982
+ this.params.sourceDirection,
1983
+ w
1984
+ ), d = y(
1985
+ { x: this.params.to.x - h, y: this.params.to.y },
1986
+ this.params.targetDirection,
1987
+ this.params.to
1988
+ ), c = Math.max((a.y + d.y) / 2, n), g = this.params.to.x / 2, l = {
1989
+ x: a.x,
1990
+ y: this.params.flipY > 0 ? c : -n
1991
+ }, v = { x: g, y: l.y }, p = {
1992
+ x: d.x,
1993
+ y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
1994
+ }, f = { x: g, y: p.y };
1995
+ this.path = R(
1996
+ [s, a, l, v, f, p, d, i],
1997
+ this.params.roundness
1998
+ );
1999
+ }
2000
+ }
2001
+ class G {
2002
+ constructor(e) {
2003
+ o(this, "path");
2004
+ o(this, "median");
2005
+ this.params = e;
2006
+ const t = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + t, n = i + 2 * s, a = [
2007
+ { x: this.params.arrowLength, y: w.y },
2008
+ { x: i, y: w.y },
2009
+ { x: i, y: this.params.side },
2010
+ { x: n, y: this.params.side },
2011
+ { x: n, y: -this.params.side },
2012
+ { x: i, y: -this.params.side },
2013
+ { x: i, y: w.y },
2014
+ { x: this.params.arrowLength, y: w.y }
2015
+ ].map(
2016
+ (c) => y(c, this.params.sourceDirection, w)
2017
+ ), d = `M ${w.x} ${w.y} L ${a[0].x} ${a[0].y} `;
2018
+ this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${R(a, this.params.roundness)}`, this.median = { x: (a[3].x + a[4].x) / 2, y: (a[3].y + a[4].y) / 2 };
2019
+ }
2020
+ }
2021
+ class et {
2022
+ constructor(e) {
2023
+ o(this, "path");
2024
+ o(this, "median");
2025
+ this.params = e;
2026
+ const t = this.params.smallRadius, s = this.params.radius, i = t + s, n = t * s / i, h = Math.sqrt(i * i - t * t), a = h * t / i, d = h + s + this.params.arrowLength, c = this.params.arrowLength + a, l = [
2027
+ { x: this.params.arrowLength, y: w.y },
2028
+ { x: c, y: n },
2029
+ { x: c, y: -n },
2030
+ { x: d, y: 0 }
2031
+ ].map(
2032
+ (f) => y(f, this.params.sourceDirection, w)
2033
+ ), v = [
2034
+ `M ${l[0].x} ${l[0].y}`,
2035
+ `A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
2036
+ `A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
2037
+ `A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
2038
+ ].join(" "), p = `M 0 0 L ${l[0].x} ${l[0].y} `;
2039
+ this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : p}${v}`, this.median = l[3];
2040
+ }
2041
+ }
2042
+ class tt {
2043
+ constructor(e) {
2044
+ o(this, "path");
2045
+ o(this, "median");
2046
+ o(this, "diagonalDistance");
2047
+ this.params = e;
2048
+ const t = this.params.to;
2049
+ if (this.median = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
2050
+ this.params.to.x * this.params.to.x + this.params.to.y * this.params.to.y
2051
+ ), Math.sqrt(
2052
+ this.params.to.x * this.params.to.x + this.params.to.y * this.params.to.y
2053
+ ) === 0) {
2054
+ this.path = "";
2055
+ return;
2056
+ }
2057
+ const i = this.createDirectLinePoint({
2058
+ offset: this.params.sourceOffset,
2059
+ hasArrow: this.params.hasSourceArrow,
2060
+ flip: 1,
2061
+ shift: w
2062
+ }), n = this.createDirectLinePoint({
2063
+ offset: this.params.targetOffset,
2064
+ hasArrow: this.params.hasTargetArrow,
2065
+ flip: -1,
2066
+ shift: this.params.to
2067
+ });
2068
+ this.path = `M ${i.x} ${i.y} L ${n.x} ${n.y}`;
2069
+ }
2070
+ createDirectLinePoint(e) {
2071
+ const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, i = e.flip * s / this.diagonalDistance;
2072
+ return {
2073
+ x: this.params.to.x * i + e.shift.x,
2074
+ y: this.params.to.y * i + e.shift.y
2075
+ };
2076
+ }
2077
+ }
2078
+ const le = (r, e) => {
2079
+ 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`;
1963
2080
  }, Z = Object.freeze({
1964
2081
  edgeColor: "--edge-color"
1965
- }), ue = (t) => {
2082
+ }), ge = (r) => {
1966
2083
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1967
- return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(Z.edgeColor, t), e;
2084
+ return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(Z.edgeColor, r), e;
1968
2085
  }, V = () => {
1969
- const t = document.createElementNS("http://www.w3.org/2000/svg", "path");
1970
- return t.setAttribute("fill", `var(${Z.edgeColor})`), t;
1971
- }, ge = () => {
1972
- const t = document.createElementNS("http://www.w3.org/2000/svg", "g");
1973
- return t.style.transformOrigin = "50% 50%", t;
1974
- }, we = (t) => {
2086
+ const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
2087
+ return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
2088
+ }, ue = () => {
2089
+ const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
2090
+ return r.style.transformOrigin = "50% 50%", r;
2091
+ }, we = (r) => {
1975
2092
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1976
- return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${t}`), e.setAttribute("fill", "none"), e;
1977
- }, fe = (t, e) => {
1978
- const o = {
1979
- x: t.x + t.width / 2,
1980
- y: t.y + t.height / 2
1981
- }, i = {
2093
+ return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
2094
+ }, pe = (r, e) => {
2095
+ const t = {
2096
+ x: r.x + r.width / 2,
2097
+ y: r.y + r.height / 2
2098
+ }, s = {
1982
2099
  x: e.x + e.width / 2,
1983
2100
  y: e.y + e.height / 2
1984
- }, s = Math.min(o.x, i.x), h = Math.min(o.y, i.y), n = Math.abs(i.x - o.x), d = Math.abs(i.y - o.y), c = o.x <= i.x ? 1 : -1, a = o.y <= i.y ? 1 : -1;
2101
+ }, i = Math.min(t.x, s.x), n = Math.min(t.y, s.y), h = Math.abs(s.x - t.x), a = Math.abs(s.y - t.y), d = t.x <= s.x ? 1 : -1, c = t.y <= s.y ? 1 : -1;
1985
2102
  return {
1986
- x: s,
1987
- y: h,
1988
- width: n,
1989
- height: d,
1990
- flipX: c,
1991
- flipY: a
2103
+ x: i,
2104
+ y: n,
2105
+ width: h,
2106
+ height: a,
2107
+ flipX: d,
2108
+ flipY: c
1992
2109
  };
1993
- }, O = (t, e, o, i) => {
1994
- const h = [
1995
- g,
1996
- { x: o, y: i },
1997
- { x: o, y: -i }
1998
- ].map((a) => f(a, t, g)).map((a) => ({ x: a.x + e.x, y: a.y + e.y })), n = `M ${h[0].x} ${h[0].y}`, d = `L ${h[1].x} ${h[1].y}`, c = `L ${h[2].x} ${h[2].y}`;
1999
- return `${n} ${d} ${c} Z`;
2110
+ }, O = (r, e, t, s) => {
2111
+ const n = [
2112
+ w,
2113
+ { x: t, y: s },
2114
+ { x: t, y: -s }
2115
+ ].map((c) => y(c, r, w)).map((c) => ({ x: c.x + e.x, y: c.y + e.y })), h = `M ${n[0].x} ${n[0].y}`, a = `L ${n[1].x} ${n[1].y}`, d = `L ${n[2].x} ${n[2].y}`;
2116
+ return `${h} ${a} ${d} Z`;
2000
2117
  }, u = Object.freeze({
2001
2118
  color: "#777777",
2002
2119
  width: 1,
@@ -2015,81 +2132,85 @@ const je = (t, e) => ({
2015
2132
  curvature: 90,
2016
2133
  interactiveWidth: 10,
2017
2134
  preOffset: 0
2018
- }), re = (t, e, o) => ({ x: e * Math.cos(t), y: o * Math.sin(t) });
2019
- class C {
2135
+ }), oe = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
2136
+ class U {
2020
2137
  constructor(e) {
2021
- r(this, "svg");
2022
- r(this, "group", ge());
2023
- r(this, "line");
2024
- r(this, "sourceArrow", null);
2025
- r(this, "targetArrow", null);
2026
- this.params = e, this.svg = ue(e.color), this.svg.appendChild(this.group), this.line = we(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = V(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = V(), this.group.appendChild(this.targetArrow));
2138
+ o(this, "svg");
2139
+ o(this, "group", ue());
2140
+ o(this, "line");
2141
+ o(this, "sourceArrow", null);
2142
+ o(this, "targetArrow", null);
2143
+ o(this, "onAfterRender");
2144
+ o(this, "afterRenderEmitter");
2145
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.svg = ge(e.color), this.svg.appendChild(this.group), this.line = we(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = V(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = V(), this.group.appendChild(this.targetArrow));
2027
2146
  }
2028
2147
  render(e) {
2029
- const { x: o, y: i, width: s, height: h, flipX: n, flipY: d } = fe(
2148
+ const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = pe(
2030
2149
  e.from,
2031
2150
  e.to
2032
2151
  );
2033
- le(this.svg, { x: o, y: i, width: s, height: h }), this.group.style.transform = `scale(${n}, ${d})`;
2034
- const c = re(
2152
+ le(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
2153
+ const d = oe(
2035
2154
  e.from.direction,
2036
- n,
2037
- d
2038
- ), a = re(
2155
+ h,
2156
+ a
2157
+ ), c = oe(
2039
2158
  e.to.direction,
2040
- n,
2041
- d
2042
- ), l = {
2043
- x: s,
2044
- y: h
2159
+ h,
2160
+ a
2161
+ ), g = {
2162
+ x: i,
2163
+ y: n
2045
2164
  };
2046
- let w = a, v = -this.params.arrowLength, A;
2047
- e.from.portId === e.to.portId ? (A = this.params.createCyclePath, w = c, v = this.params.arrowLength) : e.from.nodeId === e.to.nodeId ? A = this.params.createDetourPath : A = this.params.createLinePath;
2048
- const y = A(
2165
+ let l = c, v = -this.params.arrowLength, p;
2166
+ e.from.portId === e.to.portId ? (p = this.params.createCyclePath, l = d, v = this.params.arrowLength) : e.from.nodeId === e.to.nodeId ? p = this.params.createDetourPath : p = this.params.createLinePath;
2167
+ const f = p(
2168
+ d,
2049
2169
  c,
2050
- a,
2051
- l,
2052
- n,
2053
- d
2170
+ g,
2171
+ h,
2172
+ a
2054
2173
  );
2055
- if (this.line.setAttribute("d", y), this.sourceArrow) {
2056
- const p = O(
2057
- c,
2058
- g,
2059
- this.params.arrowLength,
2060
- this.params.arrowWidth
2061
- );
2062
- this.sourceArrow.setAttribute("d", p);
2063
- }
2064
- if (this.targetArrow) {
2065
- const p = O(
2066
- w,
2067
- l,
2068
- v,
2069
- this.params.arrowWidth
2070
- );
2071
- this.targetArrow.setAttribute("d", p);
2072
- }
2174
+ this.line.setAttribute("d", f.path);
2175
+ let A = null;
2176
+ this.sourceArrow && (A = O(
2177
+ d,
2178
+ w,
2179
+ this.params.arrowLength,
2180
+ this.params.arrowWidth
2181
+ ), this.sourceArrow.setAttribute("d", A));
2182
+ let m = null;
2183
+ this.targetArrow && (m = O(
2184
+ l,
2185
+ g,
2186
+ v,
2187
+ this.params.arrowWidth
2188
+ ), this.targetArrow.setAttribute("d", m)), this.afterRenderEmitter.emit({
2189
+ edgePath: f,
2190
+ sourceArrowPath: A,
2191
+ targetArrowPath: m
2192
+ });
2073
2193
  }
2074
2194
  }
2075
- class tt {
2195
+ class rt {
2076
2196
  constructor(e) {
2077
- r(this, "svg");
2078
- r(this, "group");
2079
- r(this, "line");
2080
- r(this, "sourceArrow");
2081
- r(this, "targetArrow");
2082
- r(this, "arrowLength");
2083
- r(this, "arrowWidth");
2084
- r(this, "curvature");
2085
- r(this, "portCycleRadius");
2086
- r(this, "portCycleSmallRadius");
2087
- r(this, "detourDirection");
2088
- r(this, "detourDistance");
2089
- r(this, "hasSourceArrow");
2090
- r(this, "hasTargetArrow");
2091
- r(this, "lineShape");
2092
- r(this, "createCyclePath", (e) => et({
2197
+ o(this, "svg");
2198
+ o(this, "group");
2199
+ o(this, "line");
2200
+ o(this, "sourceArrow");
2201
+ o(this, "targetArrow");
2202
+ o(this, "onAfterRender");
2203
+ o(this, "arrowLength");
2204
+ o(this, "arrowWidth");
2205
+ o(this, "curvature");
2206
+ o(this, "portCycleRadius");
2207
+ o(this, "portCycleSmallRadius");
2208
+ o(this, "detourDirection");
2209
+ o(this, "detourDistance");
2210
+ o(this, "hasSourceArrow");
2211
+ o(this, "hasTargetArrow");
2212
+ o(this, "pathShape");
2213
+ o(this, "createCyclePath", (e) => new et({
2093
2214
  sourceDirection: e,
2094
2215
  radius: this.portCycleRadius,
2095
2216
  smallRadius: this.portCycleSmallRadius,
@@ -2097,12 +2218,12 @@ class tt {
2097
2218
  hasSourceArrow: this.hasSourceArrow,
2098
2219
  hasTargetArrow: this.hasTargetArrow
2099
2220
  }));
2100
- r(this, "createDetourPath", (e, o, i, s, h) => Ke({
2101
- to: i,
2221
+ o(this, "createDetourPath", (e, t, s, i, n) => new Ke({
2222
+ to: s,
2102
2223
  sourceDirection: e,
2103
- targetDirection: o,
2104
- flipX: s,
2105
- flipY: h,
2224
+ targetDirection: t,
2225
+ flipX: i,
2226
+ flipY: n,
2106
2227
  arrowLength: this.arrowLength,
2107
2228
  detourDirection: this.detourDirection,
2108
2229
  detourDistance: this.detourDistance,
@@ -2110,16 +2231,16 @@ class tt {
2110
2231
  hasSourceArrow: this.hasSourceArrow,
2111
2232
  hasTargetArrow: this.hasTargetArrow
2112
2233
  }));
2113
- r(this, "createLinePath", (e, o, i) => Je({
2114
- to: i,
2234
+ o(this, "createLinePath", (e, t, s) => new Je({
2235
+ to: s,
2115
2236
  sourceDirection: e,
2116
- targetDirection: o,
2237
+ targetDirection: t,
2117
2238
  arrowLength: this.arrowLength,
2118
2239
  curvature: this.curvature,
2119
2240
  hasSourceArrow: this.hasSourceArrow,
2120
2241
  hasTargetArrow: this.hasTargetArrow
2121
2242
  }));
2122
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.curvature = (e == null ? void 0 : e.curvature) ?? u.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? u.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? u.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.lineShape = new C({
2243
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.curvature = (e == null ? void 0 : e.curvature) ?? u.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? u.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? u.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new U({
2123
2244
  color: (e == null ? void 0 : e.color) ?? u.color,
2124
2245
  width: (e == null ? void 0 : e.width) ?? u.width,
2125
2246
  arrowLength: this.arrowLength,
@@ -2129,30 +2250,31 @@ class tt {
2129
2250
  createCyclePath: this.createCyclePath,
2130
2251
  createDetourPath: this.createDetourPath,
2131
2252
  createLinePath: this.createLinePath
2132
- }), this.svg = this.lineShape.svg, this.group = this.lineShape.group, this.line = this.lineShape.line, this.sourceArrow = this.lineShape.sourceArrow, this.targetArrow = this.lineShape.targetArrow;
2253
+ }), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
2133
2254
  }
2134
2255
  render(e) {
2135
- this.lineShape.render(e);
2256
+ this.pathShape.render(e);
2136
2257
  }
2137
2258
  }
2138
2259
  class ot {
2139
2260
  constructor(e) {
2140
- r(this, "svg");
2141
- r(this, "group");
2142
- r(this, "line");
2143
- r(this, "sourceArrow");
2144
- r(this, "targetArrow");
2145
- r(this, "arrowLength");
2146
- r(this, "arrowWidth");
2147
- r(this, "arrowOffset");
2148
- r(this, "roundness");
2149
- r(this, "cycleSquareSide");
2150
- r(this, "detourDirection");
2151
- r(this, "detourDistance");
2152
- r(this, "hasSourceArrow");
2153
- r(this, "hasTargetArrow");
2154
- r(this, "lineShape");
2155
- r(this, "createCyclePath", (e) => G({
2261
+ o(this, "svg");
2262
+ o(this, "group");
2263
+ o(this, "line");
2264
+ o(this, "sourceArrow");
2265
+ o(this, "targetArrow");
2266
+ o(this, "onAfterRender");
2267
+ o(this, "arrowLength");
2268
+ o(this, "arrowWidth");
2269
+ o(this, "arrowOffset");
2270
+ o(this, "roundness");
2271
+ o(this, "cycleSquareSide");
2272
+ o(this, "detourDirection");
2273
+ o(this, "detourDistance");
2274
+ o(this, "hasSourceArrow");
2275
+ o(this, "hasTargetArrow");
2276
+ o(this, "pathShape");
2277
+ o(this, "createCyclePath", (e) => new G({
2156
2278
  sourceDirection: e,
2157
2279
  arrowLength: this.arrowLength,
2158
2280
  side: this.cycleSquareSide,
@@ -2161,12 +2283,12 @@ class ot {
2161
2283
  hasSourceArrow: this.hasSourceArrow,
2162
2284
  hasTargetArrow: this.hasTargetArrow
2163
2285
  }));
2164
- r(this, "createDetourPath", (e, o, i, s, h) => j({
2165
- to: i,
2286
+ o(this, "createDetourPath", (e, t, s, i, n) => new j({
2287
+ to: s,
2166
2288
  sourceDirection: e,
2167
- targetDirection: o,
2168
- flipX: s,
2169
- flipY: h,
2289
+ targetDirection: t,
2290
+ flipX: i,
2291
+ flipY: n,
2170
2292
  arrowLength: this.arrowLength,
2171
2293
  arrowOffset: this.arrowOffset,
2172
2294
  roundness: this.roundness,
@@ -2175,11 +2297,11 @@ class ot {
2175
2297
  hasSourceArrow: this.hasSourceArrow,
2176
2298
  hasTargetArrow: this.hasTargetArrow
2177
2299
  }));
2178
- r(this, "createLinePath", (e, o, i, s) => Qe({
2179
- to: i,
2300
+ o(this, "createLinePath", (e, t, s, i) => new Qe({
2301
+ to: s,
2180
2302
  sourceDirection: e,
2181
- targetDirection: o,
2182
- flipX: s,
2303
+ targetDirection: t,
2304
+ flipX: i,
2183
2305
  arrowLength: this.arrowLength,
2184
2306
  arrowOffset: this.arrowOffset,
2185
2307
  roundness: this.roundness,
@@ -2187,12 +2309,12 @@ class ot {
2187
2309
  hasTargetArrow: this.hasTargetArrow
2188
2310
  }));
2189
2311
  this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? u.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? u.cycleSquareSide;
2190
- const o = (e == null ? void 0 : e.roundness) ?? u.roundness;
2312
+ const t = (e == null ? void 0 : e.roundness) ?? u.roundness;
2191
2313
  this.roundness = Math.min(
2192
- o,
2314
+ t,
2193
2315
  this.arrowOffset,
2194
2316
  this.cycleSquareSide / 2
2195
- ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.lineShape = new C({
2317
+ ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new U({
2196
2318
  color: (e == null ? void 0 : e.color) ?? u.color,
2197
2319
  width: (e == null ? void 0 : e.width) ?? u.width,
2198
2320
  arrowLength: this.arrowLength,
@@ -2202,30 +2324,31 @@ class ot {
2202
2324
  createCyclePath: this.createCyclePath,
2203
2325
  createDetourPath: this.createDetourPath,
2204
2326
  createLinePath: this.createLinePath
2205
- }), this.svg = this.lineShape.svg, this.group = this.lineShape.group, this.line = this.lineShape.line, this.sourceArrow = this.lineShape.sourceArrow, this.targetArrow = this.lineShape.targetArrow;
2327
+ }), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
2206
2328
  }
2207
2329
  render(e) {
2208
- this.lineShape.render(e);
2330
+ this.pathShape.render(e);
2209
2331
  }
2210
2332
  }
2211
- class rt {
2333
+ class st {
2212
2334
  constructor(e) {
2213
- r(this, "svg");
2214
- r(this, "group");
2215
- r(this, "line");
2216
- r(this, "sourceArrow");
2217
- r(this, "targetArrow");
2218
- r(this, "arrowLength");
2219
- r(this, "arrowWidth");
2220
- r(this, "arrowOffset");
2221
- r(this, "roundness");
2222
- r(this, "cycleSquareSide");
2223
- r(this, "detourDirection");
2224
- r(this, "detourDistance");
2225
- r(this, "hasSourceArrow");
2226
- r(this, "hasTargetArrow");
2227
- r(this, "lineShape");
2228
- r(this, "createCyclePath", (e) => G({
2335
+ o(this, "svg");
2336
+ o(this, "group");
2337
+ o(this, "line");
2338
+ o(this, "sourceArrow");
2339
+ o(this, "targetArrow");
2340
+ o(this, "onAfterRender");
2341
+ o(this, "arrowLength");
2342
+ o(this, "arrowWidth");
2343
+ o(this, "arrowOffset");
2344
+ o(this, "roundness");
2345
+ o(this, "cycleSquareSide");
2346
+ o(this, "detourDirection");
2347
+ o(this, "detourDistance");
2348
+ o(this, "hasSourceArrow");
2349
+ o(this, "hasTargetArrow");
2350
+ o(this, "pathShape");
2351
+ o(this, "createCyclePath", (e) => new G({
2229
2352
  sourceDirection: e,
2230
2353
  arrowLength: this.arrowLength,
2231
2354
  side: this.cycleSquareSide,
@@ -2234,12 +2357,12 @@ class rt {
2234
2357
  hasSourceArrow: this.hasSourceArrow,
2235
2358
  hasTargetArrow: this.hasTargetArrow
2236
2359
  }));
2237
- r(this, "createDetourPath", (e, o, i, s, h) => j({
2238
- to: i,
2360
+ o(this, "createDetourPath", (e, t, s, i, n) => new j({
2361
+ to: s,
2239
2362
  sourceDirection: e,
2240
- targetDirection: o,
2241
- flipX: s,
2242
- flipY: h,
2363
+ targetDirection: t,
2364
+ flipX: i,
2365
+ flipY: n,
2243
2366
  arrowLength: this.arrowLength,
2244
2367
  arrowOffset: this.arrowOffset,
2245
2368
  roundness: this.roundness,
@@ -2248,10 +2371,10 @@ class rt {
2248
2371
  hasSourceArrow: this.hasSourceArrow,
2249
2372
  hasTargetArrow: this.hasTargetArrow
2250
2373
  }));
2251
- r(this, "createLinePath", (e, o, i) => _e({
2252
- to: i,
2374
+ o(this, "createLinePath", (e, t, s) => new _e({
2375
+ to: s,
2253
2376
  sourceDirection: e,
2254
- targetDirection: o,
2377
+ targetDirection: t,
2255
2378
  arrowLength: this.arrowLength,
2256
2379
  arrowOffset: this.arrowOffset,
2257
2380
  roundness: this.roundness,
@@ -2259,12 +2382,12 @@ class rt {
2259
2382
  hasTargetArrow: this.hasTargetArrow
2260
2383
  }));
2261
2384
  this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? u.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? u.cycleSquareSide;
2262
- const o = (e == null ? void 0 : e.roundness) ?? u.roundness;
2385
+ const t = (e == null ? void 0 : e.roundness) ?? u.roundness;
2263
2386
  this.roundness = Math.min(
2264
- o,
2387
+ t,
2265
2388
  this.arrowOffset,
2266
2389
  this.cycleSquareSide / 2
2267
- ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.lineShape = new C({
2390
+ ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new U({
2268
2391
  color: (e == null ? void 0 : e.color) ?? u.color,
2269
2392
  width: (e == null ? void 0 : e.width) ?? u.width,
2270
2393
  arrowLength: this.arrowLength,
@@ -2274,30 +2397,31 @@ class rt {
2274
2397
  createCyclePath: this.createCyclePath,
2275
2398
  createDetourPath: this.createDetourPath,
2276
2399
  createLinePath: this.createLinePath
2277
- }), this.svg = this.lineShape.svg, this.group = this.lineShape.group, this.line = this.lineShape.line, this.sourceArrow = this.lineShape.sourceArrow, this.targetArrow = this.lineShape.targetArrow;
2400
+ }), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
2278
2401
  }
2279
2402
  render(e) {
2280
- this.lineShape.render(e);
2403
+ this.pathShape.render(e);
2281
2404
  }
2282
2405
  }
2283
2406
  class it {
2284
2407
  constructor(e) {
2285
- r(this, "svg");
2286
- r(this, "group");
2287
- r(this, "line");
2288
- r(this, "sourceArrow");
2289
- r(this, "targetArrow");
2290
- r(this, "arrowLength");
2291
- r(this, "arrowWidth");
2292
- r(this, "arrowOffset");
2293
- r(this, "roundness");
2294
- r(this, "cycleSquareSide");
2295
- r(this, "detourDirection");
2296
- r(this, "detourDistance");
2297
- r(this, "hasSourceArrow");
2298
- r(this, "hasTargetArrow");
2299
- r(this, "lineShape");
2300
- r(this, "createCyclePath", (e) => G({
2408
+ o(this, "svg");
2409
+ o(this, "group");
2410
+ o(this, "line");
2411
+ o(this, "sourceArrow");
2412
+ o(this, "targetArrow");
2413
+ o(this, "onAfterRender");
2414
+ o(this, "arrowLength");
2415
+ o(this, "arrowWidth");
2416
+ o(this, "arrowOffset");
2417
+ o(this, "roundness");
2418
+ o(this, "cycleSquareSide");
2419
+ o(this, "detourDirection");
2420
+ o(this, "detourDistance");
2421
+ o(this, "hasSourceArrow");
2422
+ o(this, "hasTargetArrow");
2423
+ o(this, "pathShape");
2424
+ o(this, "createCyclePath", (e) => new G({
2301
2425
  sourceDirection: e,
2302
2426
  arrowLength: this.arrowLength,
2303
2427
  side: this.cycleSquareSide,
@@ -2306,12 +2430,12 @@ class it {
2306
2430
  hasSourceArrow: this.hasSourceArrow,
2307
2431
  hasTargetArrow: this.hasTargetArrow
2308
2432
  }));
2309
- r(this, "createDetourPath", (e, o, i, s, h) => j({
2310
- to: i,
2433
+ o(this, "createDetourPath", (e, t, s, i, n) => new j({
2434
+ to: s,
2311
2435
  sourceDirection: e,
2312
- targetDirection: o,
2313
- flipX: s,
2314
- flipY: h,
2436
+ targetDirection: t,
2437
+ flipX: i,
2438
+ flipY: n,
2315
2439
  arrowLength: this.arrowLength,
2316
2440
  arrowOffset: this.arrowOffset,
2317
2441
  roundness: this.roundness,
@@ -2320,11 +2444,11 @@ class it {
2320
2444
  hasSourceArrow: this.hasSourceArrow,
2321
2445
  hasTargetArrow: this.hasTargetArrow
2322
2446
  }));
2323
- r(this, "createLinePath", (e, o, i, s, h) => qe({
2324
- to: i,
2447
+ o(this, "createLinePath", (e, t, s, i, n) => new qe({
2448
+ to: s,
2325
2449
  sourceDirection: e,
2326
- targetDirection: o,
2327
- flipY: h,
2450
+ targetDirection: t,
2451
+ flipY: n,
2328
2452
  arrowLength: this.arrowLength,
2329
2453
  arrowOffset: this.arrowOffset,
2330
2454
  roundness: this.roundness,
@@ -2332,12 +2456,12 @@ class it {
2332
2456
  hasTargetArrow: this.hasTargetArrow
2333
2457
  }));
2334
2458
  this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? u.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? u.cycleSquareSide;
2335
- const o = (e == null ? void 0 : e.roundness) ?? u.roundness;
2459
+ const t = (e == null ? void 0 : e.roundness) ?? u.roundness;
2336
2460
  this.roundness = Math.min(
2337
- o,
2461
+ t,
2338
2462
  this.arrowOffset,
2339
2463
  this.cycleSquareSide / 2
2340
- ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirectionVertical, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.lineShape = new C({
2464
+ ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirectionVertical, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new U({
2341
2465
  color: (e == null ? void 0 : e.color) ?? u.color,
2342
2466
  width: (e == null ? void 0 : e.width) ?? u.width,
2343
2467
  arrowLength: this.arrowLength,
@@ -2347,270 +2471,253 @@ class it {
2347
2471
  createCyclePath: this.createCyclePath,
2348
2472
  createDetourPath: this.createDetourPath,
2349
2473
  createLinePath: this.createLinePath
2350
- }), this.svg = this.lineShape.svg, this.group = this.lineShape.group, this.line = this.lineShape.line, this.sourceArrow = this.lineShape.sourceArrow, this.targetArrow = this.lineShape.targetArrow;
2474
+ }), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
2351
2475
  }
2352
2476
  render(e) {
2353
- this.lineShape.render(e);
2477
+ this.pathShape.render(e);
2354
2478
  }
2355
2479
  }
2356
- const ie = (t) => {
2357
- if (t.diagonalDistance === 0)
2480
+ const se = (r) => {
2481
+ if (r.diagonalDistance === 0)
2358
2482
  return "";
2359
- const e = t.offset / t.diagonalDistance, o = t.flip * t.to.x, i = t.flip * t.to.y, s = {
2360
- x: o * e + t.shift.x,
2361
- y: i * e + t.shift.y
2362
- }, h = {
2363
- x: o / t.diagonalDistance,
2364
- y: i / t.diagonalDistance
2483
+ const e = r.offset / r.diagonalDistance, t = r.flip * r.to.x, s = r.flip * r.to.y, i = {
2484
+ x: t * e + r.shift.x,
2485
+ y: s * e + r.shift.y
2486
+ }, n = {
2487
+ x: t / r.diagonalDistance,
2488
+ y: s / r.diagonalDistance
2365
2489
  };
2366
2490
  return O(
2367
- h,
2368
- s,
2369
- t.arrowLength,
2370
- t.arrowWidth
2491
+ n,
2492
+ i,
2493
+ r.arrowLength,
2494
+ r.arrowWidth
2371
2495
  );
2372
- }, se = (t) => {
2373
- const e = t.hasArrow ? t.arrowLength : 0, o = t.offset + e, i = t.flip * o / t.diagonalDistance;
2374
- return {
2375
- x: t.to.x * i + t.shift.x,
2376
- y: t.to.y * i + t.shift.y
2377
- };
2378
- }, st = (t) => {
2379
- const e = se({
2380
- diagonalDistance: t.diagonalDistance,
2381
- to: t.to,
2382
- offset: t.sourceOffset,
2383
- hasArrow: t.hasSourceArrow,
2384
- flip: 1,
2385
- shift: g,
2386
- arrowLength: t.arrowLength
2387
- }), o = se({
2388
- diagonalDistance: t.diagonalDistance,
2389
- to: t.to,
2390
- offset: t.targetOffset,
2391
- hasArrow: t.hasTargetArrow,
2392
- flip: -1,
2393
- shift: t.to,
2394
- arrowLength: t.arrowLength
2395
- });
2396
- return `M ${e.x} ${e.y} L ${o.x} ${o.y}`;
2397
2496
  };
2398
2497
  class nt {
2399
2498
  constructor(e) {
2400
- r(this, "svg");
2401
- r(this, "group", ge());
2402
- r(this, "line");
2403
- r(this, "sourceArrow", null);
2404
- r(this, "targetArrow", null);
2405
- r(this, "color");
2406
- r(this, "width");
2407
- r(this, "arrowLength");
2408
- r(this, "arrowWidth");
2409
- r(this, "sourceOffset");
2410
- r(this, "targetOffset");
2411
- this.color = (e == null ? void 0 : e.color) ?? u.color, this.width = (e == null ? void 0 : e.width) ?? u.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? u.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? u.preOffset, this.svg = ue(this.color), this.svg.appendChild(this.group), this.line = we(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = V(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = V(), this.group.appendChild(this.targetArrow));
2499
+ o(this, "svg");
2500
+ o(this, "group", ue());
2501
+ o(this, "line");
2502
+ o(this, "sourceArrow", null);
2503
+ o(this, "targetArrow", null);
2504
+ o(this, "color");
2505
+ o(this, "width");
2506
+ o(this, "arrowLength");
2507
+ o(this, "arrowWidth");
2508
+ o(this, "sourceOffset");
2509
+ o(this, "targetOffset");
2510
+ o(this, "onAfterRender");
2511
+ o(this, "afterRenderEmitter");
2512
+ [this.afterRenderEmitter, this.onAfterRender] = E(), this.color = (e == null ? void 0 : e.color) ?? u.color, this.width = (e == null ? void 0 : e.width) ?? u.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? u.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? u.preOffset, this.svg = ge(this.color), this.svg.appendChild(this.group), this.line = we(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = V(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = V(), this.group.appendChild(this.targetArrow));
2412
2513
  }
2413
2514
  render(e) {
2414
- const { x: o, y: i, width: s, height: h, flipX: n, flipY: d } = fe(
2515
+ const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = pe(
2415
2516
  e.from,
2416
2517
  e.to
2417
2518
  );
2418
- le(this.svg, { x: o, y: i, width: s, height: h }), this.group.style.transform = `scale(${n}, ${d})`;
2419
- const c = Math.sqrt(s * s + h * h), a = { x: s, y: h };
2420
- if (c > 0) {
2421
- const l = st({
2422
- diagonalDistance: c,
2423
- to: a,
2424
- sourceOffset: this.sourceOffset,
2425
- targetOffset: this.targetOffset,
2426
- hasSourceArrow: this.sourceArrow !== null,
2427
- hasTargetArrow: this.targetArrow !== null,
2428
- arrowLength: this.arrowLength
2429
- });
2430
- this.line.setAttribute("d", l);
2431
- } else
2432
- this.line.setAttribute("d", "");
2433
- if (this.sourceArrow) {
2434
- const l = ie({
2435
- diagonalDistance: c,
2436
- to: a,
2437
- offset: this.sourceOffset,
2438
- flip: 1,
2439
- shift: g,
2440
- arrowWidth: this.arrowWidth,
2441
- arrowLength: this.arrowLength
2442
- });
2443
- this.sourceArrow.setAttribute("d", l);
2444
- }
2445
- if (this.targetArrow) {
2446
- const l = ie({
2447
- diagonalDistance: c,
2448
- to: a,
2449
- offset: this.targetOffset,
2450
- flip: -1,
2451
- shift: a,
2452
- arrowWidth: this.arrowWidth,
2453
- arrowLength: this.arrowLength
2454
- });
2455
- this.targetArrow.setAttribute("d", l);
2456
- }
2519
+ le(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
2520
+ const d = { x: i, y: n }, c = new tt({
2521
+ to: d,
2522
+ sourceOffset: this.sourceOffset,
2523
+ targetOffset: this.targetOffset,
2524
+ hasSourceArrow: this.sourceArrow !== null,
2525
+ hasTargetArrow: this.targetArrow !== null,
2526
+ arrowLength: this.arrowLength
2527
+ });
2528
+ this.line.setAttribute("d", c.path);
2529
+ let g = null;
2530
+ this.sourceArrow && (g = se({
2531
+ diagonalDistance: c.diagonalDistance,
2532
+ to: d,
2533
+ offset: this.sourceOffset,
2534
+ flip: 1,
2535
+ shift: w,
2536
+ arrowWidth: this.arrowWidth,
2537
+ arrowLength: this.arrowLength
2538
+ }), this.sourceArrow.setAttribute("d", g));
2539
+ let l = null;
2540
+ this.targetArrow && (l = se({
2541
+ diagonalDistance: c.diagonalDistance,
2542
+ to: d,
2543
+ offset: this.targetOffset,
2544
+ flip: -1,
2545
+ shift: d,
2546
+ arrowWidth: this.arrowWidth,
2547
+ arrowLength: this.arrowLength
2548
+ }), this.targetArrow.setAttribute("d", l)), this.afterRenderEmitter.emit({
2549
+ edgePath: c,
2550
+ sourceArrowPath: g,
2551
+ targetArrowPath: l
2552
+ });
2457
2553
  }
2458
2554
  }
2459
2555
  const ht = () => {
2460
- const t = document.createElementNS("http://www.w3.org/2000/svg", "g");
2461
- return t.style.pointerEvents = "auto", t.style.cursor = "pointer", t;
2462
- }, dt = (t) => {
2556
+ const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
2557
+ return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
2558
+ }, at = (r) => {
2463
2559
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
2464
- return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${t}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
2465
- }, ne = (t) => {
2560
+ return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
2561
+ }, ie = (r) => {
2466
2562
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
2467
- return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${t}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
2563
+ return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
2468
2564
  };
2469
- class ct extends Error {
2565
+ class dt extends Error {
2470
2566
  constructor(e) {
2471
2567
  super(e), this.name = "InteractiveEdgeError";
2472
2568
  }
2473
2569
  }
2474
- class ve {
2475
- constructor(e, o) {
2476
- r(this, "svg");
2477
- r(this, "group");
2478
- r(this, "line");
2479
- r(this, "sourceArrow");
2480
- r(this, "targetArrow");
2481
- r(this, "handle", ht());
2482
- r(this, "interactiveLine");
2483
- r(this, "interactiveSourceArrow", null);
2484
- r(this, "interactiveTargetArrow", null);
2485
- if (this.structuredEdge = e, e instanceof ve)
2486
- throw new ct(
2570
+ class fe {
2571
+ constructor(e, t) {
2572
+ o(this, "svg");
2573
+ o(this, "group");
2574
+ o(this, "line");
2575
+ o(this, "sourceArrow");
2576
+ o(this, "targetArrow");
2577
+ o(this, "handle", ht());
2578
+ o(this, "onAfterRender");
2579
+ o(this, "interactiveLine");
2580
+ o(this, "interactiveSourceArrow", null);
2581
+ o(this, "interactiveTargetArrow", null);
2582
+ if (this.baseEdge = e, e instanceof fe)
2583
+ throw new dt(
2487
2584
  "interactive edge can be configured only once"
2488
2585
  );
2489
- this.svg = this.structuredEdge.svg, this.group = this.structuredEdge.group, this.line = this.structuredEdge.line, this.sourceArrow = this.structuredEdge.sourceArrow, this.targetArrow = this.structuredEdge.targetArrow;
2490
- const i = (o == null ? void 0 : o.width) ?? u.interactiveWidth;
2491
- this.interactiveLine = dt(i), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ne(i), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ne(i), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle);
2586
+ 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;
2587
+ const s = (t == null ? void 0 : t.width) ?? u.interactiveWidth;
2588
+ this.interactiveLine = at(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ie(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ie(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
2589
+ this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
2590
+ });
2492
2591
  }
2493
2592
  render(e) {
2494
- this.structuredEdge.render(e);
2495
- const o = this.line.getAttribute("d");
2496
- if (this.interactiveLine.setAttribute("d", o), this.sourceArrow) {
2497
- const i = this.sourceArrow.getAttribute("d");
2498
- this.interactiveSourceArrow.setAttribute("d", i);
2499
- }
2500
- if (this.targetArrow) {
2501
- const i = this.targetArrow.getAttribute("d");
2502
- this.interactiveTargetArrow.setAttribute("d", i);
2503
- }
2593
+ this.baseEdge.render(e);
2504
2594
  }
2505
2595
  }
2506
- const at = (t) => {
2507
- if (typeof t == "function")
2508
- return t;
2509
- switch (t == null ? void 0 : t.type) {
2596
+ class ut {
2597
+ constructor(e, t) {
2598
+ o(this, "group");
2599
+ o(this, "line");
2600
+ o(this, "sourceArrow");
2601
+ o(this, "targetArrow");
2602
+ o(this, "onAfterRender");
2603
+ o(this, "svg");
2604
+ this.baseShape = e, this.medianElement = 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.medianElement), this.baseShape.onAfterRender.subscribe((s) => {
2605
+ const i = s.edgePath.median, n = `translate(${i.x}px, ${i.y}px)`;
2606
+ this.medianElement.style.setProperty("transform", n);
2607
+ });
2608
+ }
2609
+ render(e) {
2610
+ this.baseShape.render(e);
2611
+ }
2612
+ }
2613
+ const ct = (r) => {
2614
+ if (typeof r == "function")
2615
+ return r;
2616
+ switch (r == null ? void 0 : r.type) {
2510
2617
  case "straight":
2511
- return () => new rt({
2512
- color: t.color,
2513
- width: t.width,
2514
- arrowLength: t.arrowLength,
2515
- arrowWidth: t.arrowWidth,
2516
- arrowOffset: t.arrowOffset,
2517
- hasSourceArrow: t.hasSourceArrow,
2518
- hasTargetArrow: t.hasTargetArrow,
2519
- cycleSquareSide: t.cycleSquareSide,
2520
- roundness: t.roundness,
2521
- detourDistance: t.detourDistance,
2522
- detourDirection: t.detourDirection
2618
+ return () => new st({
2619
+ color: r.color,
2620
+ width: r.width,
2621
+ arrowLength: r.arrowLength,
2622
+ arrowWidth: r.arrowWidth,
2623
+ arrowOffset: r.arrowOffset,
2624
+ hasSourceArrow: r.hasSourceArrow,
2625
+ hasTargetArrow: r.hasTargetArrow,
2626
+ cycleSquareSide: r.cycleSquareSide,
2627
+ roundness: r.roundness,
2628
+ detourDistance: r.detourDistance,
2629
+ detourDirection: r.detourDirection
2523
2630
  });
2524
2631
  case "horizontal":
2525
2632
  return () => new ot({
2526
- color: t.color,
2527
- width: t.width,
2528
- arrowLength: t.arrowLength,
2529
- arrowWidth: t.arrowWidth,
2530
- arrowOffset: t.arrowOffset,
2531
- hasSourceArrow: t.hasSourceArrow,
2532
- hasTargetArrow: t.hasTargetArrow,
2533
- cycleSquareSide: t.cycleSquareSide,
2534
- roundness: t.roundness,
2535
- detourDistance: t.detourDistance,
2536
- detourDirection: t.detourDirection
2633
+ color: r.color,
2634
+ width: r.width,
2635
+ arrowLength: r.arrowLength,
2636
+ arrowWidth: r.arrowWidth,
2637
+ arrowOffset: r.arrowOffset,
2638
+ hasSourceArrow: r.hasSourceArrow,
2639
+ hasTargetArrow: r.hasTargetArrow,
2640
+ cycleSquareSide: r.cycleSquareSide,
2641
+ roundness: r.roundness,
2642
+ detourDistance: r.detourDistance,
2643
+ detourDirection: r.detourDirection
2537
2644
  });
2538
2645
  case "vertical":
2539
2646
  return () => new it({
2540
- color: t.color,
2541
- width: t.width,
2542
- arrowLength: t.arrowLength,
2543
- arrowWidth: t.arrowWidth,
2544
- arrowOffset: t.arrowOffset,
2545
- hasSourceArrow: t.hasSourceArrow,
2546
- hasTargetArrow: t.hasTargetArrow,
2547
- cycleSquareSide: t.cycleSquareSide,
2548
- roundness: t.roundness,
2549
- detourDistance: t.detourDistance,
2550
- detourDirection: t.detourDirection
2647
+ color: r.color,
2648
+ width: r.width,
2649
+ arrowLength: r.arrowLength,
2650
+ arrowWidth: r.arrowWidth,
2651
+ arrowOffset: r.arrowOffset,
2652
+ hasSourceArrow: r.hasSourceArrow,
2653
+ hasTargetArrow: r.hasTargetArrow,
2654
+ cycleSquareSide: r.cycleSquareSide,
2655
+ roundness: r.roundness,
2656
+ detourDistance: r.detourDistance,
2657
+ detourDirection: r.detourDirection
2551
2658
  });
2552
2659
  case "direct":
2553
2660
  return () => new nt({
2554
- color: t.color,
2555
- width: t.width,
2556
- arrowLength: t.arrowLength,
2557
- arrowWidth: t.arrowWidth,
2558
- hasSourceArrow: t.hasSourceArrow,
2559
- hasTargetArrow: t.hasTargetArrow,
2560
- sourceOffset: t.sourceOffset,
2561
- targetOffset: t.targetOffset
2661
+ color: r.color,
2662
+ width: r.width,
2663
+ arrowLength: r.arrowLength,
2664
+ arrowWidth: r.arrowWidth,
2665
+ hasSourceArrow: r.hasSourceArrow,
2666
+ hasTargetArrow: r.hasTargetArrow,
2667
+ sourceOffset: r.sourceOffset,
2668
+ targetOffset: r.targetOffset
2562
2669
  });
2563
2670
  default:
2564
- return () => new tt({
2565
- color: t.color,
2566
- width: t.width,
2567
- arrowLength: t.arrowLength,
2568
- arrowWidth: t.arrowWidth,
2569
- hasSourceArrow: t.hasSourceArrow,
2570
- hasTargetArrow: t.hasTargetArrow,
2571
- cycleRadius: t.cycleRadius,
2572
- smallCycleRadius: t.smallCycleRadius,
2573
- curvature: t.curvature,
2574
- detourDistance: t.detourDistance,
2575
- detourDirection: t.detourDirection
2671
+ return () => new rt({
2672
+ color: r.color,
2673
+ width: r.width,
2674
+ arrowLength: r.arrowLength,
2675
+ arrowWidth: r.arrowWidth,
2676
+ hasSourceArrow: r.hasSourceArrow,
2677
+ hasTargetArrow: r.hasTargetArrow,
2678
+ cycleRadius: r.cycleRadius,
2679
+ smallCycleRadius: r.smallCycleRadius,
2680
+ curvature: r.curvature,
2681
+ detourDistance: r.detourDistance,
2682
+ detourDirection: r.detourDirection
2576
2683
  });
2577
2684
  }
2578
- }, lt = (t) => {
2579
- var o, i, s, h, n;
2685
+ }, lt = (r) => {
2686
+ var t, s, i, n, h;
2580
2687
  const e = Ze(
2581
- (o = t.nodes) == null ? void 0 : o.priority,
2582
- (i = t.edges) == null ? void 0 : i.priority
2688
+ (t = r.nodes) == null ? void 0 : t.priority,
2689
+ (s = r.edges) == null ? void 0 : s.priority
2583
2690
  );
2584
2691
  return {
2585
2692
  nodes: {
2586
- centerFn: ((s = t.nodes) == null ? void 0 : s.centerFn) ?? je,
2693
+ centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? je,
2587
2694
  priorityFn: e.nodesPriorityFn
2588
2695
  },
2589
2696
  ports: {
2590
- direction: ((h = t.ports) == null ? void 0 : h.direction) ?? 0
2697
+ direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
2591
2698
  },
2592
2699
  edges: {
2593
- shapeFactory: at(((n = t.edges) == null ? void 0 : n.shape) ?? {}),
2700
+ shapeFactory: ct(((h = r.edges) == null ? void 0 : h.shape) ?? {}),
2594
2701
  priorityFn: e.edgesPriorityFn
2595
2702
  }
2596
2703
  };
2597
2704
  };
2598
- class gt {
2705
+ class wt {
2599
2706
  constructor(e) {
2600
- r(this, "element", null);
2601
- r(this, "canvasDefaults", {});
2602
- r(this, "dragConfig", {});
2603
- r(this, "transformConfig", {});
2604
- r(this, "backgroundConfig", {});
2605
- r(this, "connectablePortsConfig", {});
2606
- r(this, "virtualScrollConfig");
2607
- r(this, "hasDraggableNode", !1);
2608
- r(this, "hasTransformableViewport", !1);
2609
- r(this, "hasResizeReactiveNodes", !1);
2610
- r(this, "hasBackground", !1);
2611
- r(this, "hasUserConnectablePorts", !1);
2612
- r(this, "boxRenderingTrigger");
2613
- r(this, "window", window);
2707
+ o(this, "element", null);
2708
+ o(this, "canvasDefaults", {});
2709
+ o(this, "dragConfig", {});
2710
+ o(this, "transformConfig", {});
2711
+ o(this, "backgroundConfig", {});
2712
+ o(this, "connectablePortsConfig", {});
2713
+ o(this, "virtualScrollConfig");
2714
+ o(this, "hasDraggableNode", !1);
2715
+ o(this, "hasTransformableViewport", !1);
2716
+ o(this, "hasResizeReactiveNodes", !1);
2717
+ o(this, "hasBackground", !1);
2718
+ o(this, "hasUserConnectablePorts", !1);
2719
+ o(this, "boxRenderingTrigger");
2720
+ o(this, "window", window);
2614
2721
  e !== void 0 && (this.element = e);
2615
2722
  }
2616
2723
  /**
@@ -2678,52 +2785,52 @@ class gt {
2678
2785
  "unable to build canvas when no attach element specified"
2679
2786
  );
2680
2787
  let e = this.boxRenderingTrigger;
2681
- this.virtualScrollConfig !== void 0 && e === void 0 && (e = new de());
2682
- const o = new ae(), i = new Ne(), s = new He(this.element);
2683
- let h = new he(
2684
- o,
2685
- i,
2686
- s.main
2788
+ this.virtualScrollConfig !== void 0 && e === void 0 && (e = new he());
2789
+ const t = new de(), s = new De(), i = new He(this.element);
2790
+ let n = new ne(
2791
+ t,
2792
+ s,
2793
+ i.main
2687
2794
  );
2688
- e !== void 0 && (h = new be(h, o, e));
2689
- const n = lt(this.canvasDefaults), d = new ce(
2795
+ e !== void 0 && (n = new Se(n, t, e));
2796
+ const h = lt(this.canvasDefaults), a = new ae(
2690
2797
  this.element,
2691
- o,
2692
- i,
2693
- h,
2694
- n
2695
- ), c = () => {
2696
- s.destroy(), d.onBeforeDestroy.unsubscribe(c);
2798
+ t,
2799
+ s,
2800
+ n,
2801
+ h
2802
+ ), d = () => {
2803
+ i.destroy(), a.onBeforeDestroy.unsubscribe(d);
2697
2804
  };
2698
- return d.onBeforeDestroy.subscribe(c), this.hasBackground && Y.configure(
2699
- d,
2805
+ return a.onBeforeDestroy.subscribe(d), this.hasBackground && Y.configure(
2806
+ a,
2700
2807
  this.backgroundConfig,
2701
- s.background
2702
- ), this.hasResizeReactiveNodes && k.configure(d), this.hasDraggableNode && z.configure(
2703
- d,
2704
- s.main,
2808
+ i.background
2809
+ ), this.hasResizeReactiveNodes && k.configure(a), this.hasDraggableNode && z.configure(
2810
+ a,
2811
+ i.main,
2705
2812
  this.window,
2706
2813
  this.dragConfig
2707
2814
  ), this.hasUserConnectablePorts && H.configure(
2708
- d,
2709
- s.overlay,
2710
- i,
2815
+ a,
2816
+ i.overlay,
2817
+ s,
2711
2818
  this.window,
2712
- n,
2819
+ h,
2713
2820
  this.connectablePortsConfig
2714
2821
  ), this.virtualScrollConfig !== void 0 ? X.configure(
2715
- d,
2716
- s.main,
2822
+ a,
2823
+ i.main,
2717
2824
  this.window,
2718
2825
  this.transformConfig,
2719
2826
  e,
2720
2827
  this.virtualScrollConfig
2721
- ) : this.hasTransformableViewport && U.configure(
2722
- d,
2723
- s.main,
2828
+ ) : this.hasTransformableViewport && C.configure(
2829
+ a,
2830
+ i.main,
2724
2831
  this.window,
2725
2832
  this.transformConfig
2726
- ), this.reset(), d;
2833
+ ), this.reset(), a;
2727
2834
  }
2728
2835
  /**
2729
2836
  * @deprecated
@@ -2734,15 +2841,16 @@ class gt {
2734
2841
  }
2735
2842
  }
2736
2843
  export {
2737
- tt as BezierEdgeShape,
2738
- gt as CanvasBuilder,
2844
+ rt as BezierEdgeShape,
2845
+ wt as CanvasBuilder,
2739
2846
  nt as DirectEdgeShape,
2740
- de as EventSubject,
2847
+ he as EventSubject,
2741
2848
  ot as HorizontalEdgeShape,
2742
2849
  S as HtmlGraphError,
2743
- ct as InteractiveEdgeError,
2744
- ve as InteractiveEdgeShape,
2745
- C as LineEdgeShape,
2746
- rt as StraightEdgeShape,
2850
+ dt as InteractiveEdgeError,
2851
+ fe as InteractiveEdgeShape,
2852
+ U as LineEdgeShape,
2853
+ ut as MedianEdgeShape,
2854
+ st as StraightEdgeShape,
2747
2855
  it as VerticalEdgeShape
2748
2856
  };