@particle-academy/fancy-flow 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ZB4HHQMR.js → chunk-OWENS2H5.js} +11 -3
- package/dist/chunk-OWENS2H5.js.map +1 -0
- package/dist/{chunk-YZTBRXBZ.js → chunk-QAA4CA22.js} +8 -4
- package/dist/chunk-QAA4CA22.js.map +1 -0
- package/dist/{chunk-O7F6SGV4.js → chunk-ZS6DVGB3.js} +17 -5
- package/dist/chunk-ZS6DVGB3.js.map +1 -0
- package/dist/engine.js +1 -1
- package/dist/index.cjs +2409 -525
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.js +182 -37
- package/dist/index.js.map +1 -1
- package/dist/layout/index.d.cts +30 -0
- package/dist/layout/index.d.ts +30 -0
- package/dist/layout.cjs +1693 -0
- package/dist/layout.cjs.map +1 -0
- package/dist/layout.js +1691 -0
- package/dist/layout.js.map +1 -0
- package/dist/registry/index.d.cts +2 -2
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry.cjs +4 -0
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.js +3 -3
- package/dist/runtime/index.d.cts +13 -1
- package/dist/runtime/index.d.ts +13 -1
- package/dist/runtime.cjs +13 -1
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +2 -2
- package/dist/styles.css +20 -0
- package/dist/styles.css.map +1 -1
- package/dist/{types-DneUoivl.d.cts → types-BekE5JTG.d.cts} +7 -0
- package/dist/{types-CFEtuRWJ.d.ts → types-DwRpXXNy.d.ts} +7 -0
- package/dist/ux.d.cts +1 -1
- package/dist/ux.d.ts +1 -1
- package/package.json +12 -1
- package/dist/chunk-O7F6SGV4.js.map +0 -1
- package/dist/chunk-YZTBRXBZ.js.map +0 -1
- package/dist/chunk-ZB4HHQMR.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,1717 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
8
8
|
|
|
9
9
|
var ReactExports__default = /*#__PURE__*/_interopDefault(ReactExports);
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __esm = (fn2, res, err) => function __init() {
|
|
14
|
+
if (err) throw err[0];
|
|
15
|
+
try {
|
|
16
|
+
return fn2 && (res = (0, fn2[__getOwnPropNames(fn2)[0]])(fn2 = 0)), res;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw err = [e], e;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var __export = (target, all) => {
|
|
22
|
+
for (var name in all)
|
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// node_modules/@dagrejs/dagre/dist/dagre.esm.js
|
|
27
|
+
function me(e, n) {
|
|
28
|
+
e[n] ? e[n]++ : e[n] = 1;
|
|
29
|
+
}
|
|
30
|
+
function Ee(e, n) {
|
|
31
|
+
e[n] !== void 0 && !--e[n] && delete e[n];
|
|
32
|
+
}
|
|
33
|
+
function C(e, n, t, r) {
|
|
34
|
+
let o = "" + n, i = "" + t;
|
|
35
|
+
if (!e && o > i) {
|
|
36
|
+
let s = o;
|
|
37
|
+
o = i, i = s;
|
|
38
|
+
}
|
|
39
|
+
return o + "" + i + "" + (r === void 0 ? "\0" : r);
|
|
40
|
+
}
|
|
41
|
+
function gn(e, n, t, r) {
|
|
42
|
+
let o = "" + n, i = "" + t;
|
|
43
|
+
if (!e && o > i) {
|
|
44
|
+
let a = o;
|
|
45
|
+
o = i, i = a;
|
|
46
|
+
}
|
|
47
|
+
let s = { v: o, w: i };
|
|
48
|
+
return r && (s.name = r), s;
|
|
49
|
+
}
|
|
50
|
+
function Y(e, n) {
|
|
51
|
+
return C(e, n.v, n.w, n.name);
|
|
52
|
+
}
|
|
53
|
+
function mn(e) {
|
|
54
|
+
let n = { options: { directed: e.isDirected(), multigraph: e.isMultigraph(), compound: e.isCompound() }, nodes: En(e), edges: Ln(e) }, t = e.graph();
|
|
55
|
+
return t !== void 0 && (n.value = structuredClone(t)), n;
|
|
56
|
+
}
|
|
57
|
+
function En(e) {
|
|
58
|
+
return e.nodes().map((n) => {
|
|
59
|
+
let t = e.node(n), r = e.parent(n), o = { v: n };
|
|
60
|
+
return t !== void 0 && (o.value = t), r !== void 0 && (o.parent = r), o;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function Ln(e) {
|
|
64
|
+
return e.edges().map((n) => {
|
|
65
|
+
let t = e.edge(n), r = { v: n.v, w: n.w };
|
|
66
|
+
return n.name !== void 0 && (r.name = n.name), t !== void 0 && (r.value = t), r;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function yn(e) {
|
|
70
|
+
let n = new p(e.options);
|
|
71
|
+
return e.value !== void 0 && n.setGraph(e.value), e.nodes.forEach((t) => {
|
|
72
|
+
n.setNode(t.v, t.value), t.parent && n.setParent(t.v, t.parent);
|
|
73
|
+
}), e.edges.forEach((t) => {
|
|
74
|
+
n.setEdge({ v: t.v, w: t.w, name: t.name }, t.value);
|
|
75
|
+
}), n;
|
|
76
|
+
}
|
|
77
|
+
function we(e, n, t, r) {
|
|
78
|
+
return Nn(e, String(n), t || wn, r || function(o) {
|
|
79
|
+
return e.outEdges(o);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function Nn(e, n, t, r) {
|
|
83
|
+
let o = {}, i, s = 0, a = e.nodes(), d = function(c) {
|
|
84
|
+
let h2 = t(c);
|
|
85
|
+
o[c.v].distance + h2 < o[c.w].distance && (o[c.w] = { distance: o[c.v].distance + h2, predecessor: c.v }, i = true);
|
|
86
|
+
}, l = function() {
|
|
87
|
+
a.forEach(function(c) {
|
|
88
|
+
r(c).forEach(function(h2) {
|
|
89
|
+
let f = h2.v === c ? h2.v : h2.w, g = f === h2.v ? h2.w : h2.v;
|
|
90
|
+
d({ v: f, w: g });
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
a.forEach(function(c) {
|
|
95
|
+
let h2 = c === n ? 0 : Number.POSITIVE_INFINITY;
|
|
96
|
+
o[c] = { distance: h2, predecessor: "" };
|
|
97
|
+
});
|
|
98
|
+
let u = a.length;
|
|
99
|
+
for (let c = 1; c < u && (i = false, s++, l(), !!i); c++) ;
|
|
100
|
+
if (s === u - 1 && (i = false, l(), i)) throw new Error("The graph contains a negative weight cycle");
|
|
101
|
+
return o;
|
|
102
|
+
}
|
|
103
|
+
function Gn(e) {
|
|
104
|
+
let n = {}, t = [], r;
|
|
105
|
+
function o(i) {
|
|
106
|
+
i in n || (n[i] = true, r.push(i), e.successors(i).forEach(o), e.predecessors(i).forEach(o));
|
|
107
|
+
}
|
|
108
|
+
return e.nodes().forEach(function(i) {
|
|
109
|
+
r = [], o(i), r.length && t.push(r);
|
|
110
|
+
}), t;
|
|
111
|
+
}
|
|
112
|
+
function F(e, n, t, r) {
|
|
113
|
+
let o = function(i) {
|
|
114
|
+
return e.outEdges(i);
|
|
115
|
+
};
|
|
116
|
+
return vn(e, String(n), t || kn, r || o);
|
|
117
|
+
}
|
|
118
|
+
function vn(e, n, t, r) {
|
|
119
|
+
let o = {}, i = new Ne(), s, a, d = function(l) {
|
|
120
|
+
let u = l.v !== s ? l.v : l.w, c = o[u], h2 = t(l), f = a.distance + h2;
|
|
121
|
+
if (h2 < 0) throw new Error("dijkstra does not allow negative edge weights. Bad edge: " + l + " Weight: " + h2);
|
|
122
|
+
f < c.distance && (c.distance = f, c.predecessor = s, i.decrease(u, f));
|
|
123
|
+
};
|
|
124
|
+
for (e.nodes().forEach(function(l) {
|
|
125
|
+
let u = l === n ? 0 : Number.POSITIVE_INFINITY;
|
|
126
|
+
o[l] = { distance: u, predecessor: "" }, i.add(l, u);
|
|
127
|
+
}); i.size() > 0 && (s = i.removeMin(), a = o[s], a.distance !== Number.POSITIVE_INFINITY); ) r(s).forEach(d);
|
|
128
|
+
return o;
|
|
129
|
+
}
|
|
130
|
+
function _n(e, n, t) {
|
|
131
|
+
return e.nodes().reduce(function(r, o) {
|
|
132
|
+
return r[o] = F(e, o, n, t), r;
|
|
133
|
+
}, {});
|
|
134
|
+
}
|
|
135
|
+
function Ge(e) {
|
|
136
|
+
let n = 0, t = [], r = {}, o = [];
|
|
137
|
+
function i(s) {
|
|
138
|
+
let a = r[s] = { onStack: true, lowlink: n, index: n++ };
|
|
139
|
+
if (t.push(s), e.successors(s).forEach(function(d) {
|
|
140
|
+
d in r ? r[d].onStack && (a.lowlink = Math.min(a.lowlink, r[d].index)) : (i(d), a.lowlink = Math.min(a.lowlink, r[d].lowlink));
|
|
141
|
+
}), a.lowlink === a.index) {
|
|
142
|
+
let d = [], l;
|
|
143
|
+
do
|
|
144
|
+
l = t.pop(), r[l].onStack = false, d.push(l);
|
|
145
|
+
while (s !== l);
|
|
146
|
+
o.push(d);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return e.nodes().forEach(function(s) {
|
|
150
|
+
s in r || i(s);
|
|
151
|
+
}), o;
|
|
152
|
+
}
|
|
153
|
+
function xn(e) {
|
|
154
|
+
return Ge(e).filter(function(n) {
|
|
155
|
+
return n.length > 1 || n.length === 1 && e.hasEdge(n[0], n[0]);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function On(e, n, t) {
|
|
159
|
+
return In(e, n || Tn, t || function(r) {
|
|
160
|
+
return e.outEdges(r);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function In(e, n, t) {
|
|
164
|
+
let r = {}, o = e.nodes();
|
|
165
|
+
return o.forEach(function(i) {
|
|
166
|
+
r[i] = {}, r[i][i] = { distance: 0, predecessor: "" }, o.forEach(function(s) {
|
|
167
|
+
i !== s && (r[i][s] = { distance: Number.POSITIVE_INFINITY, predecessor: "" });
|
|
168
|
+
}), t(i).forEach(function(s) {
|
|
169
|
+
let a = s.v === i ? s.w : s.v, d = n(s);
|
|
170
|
+
r[i][a] = { distance: d, predecessor: i };
|
|
171
|
+
});
|
|
172
|
+
}), o.forEach(function(i) {
|
|
173
|
+
let s = r[i];
|
|
174
|
+
o.forEach(function(a) {
|
|
175
|
+
let d = r[a];
|
|
176
|
+
o.forEach(function(l) {
|
|
177
|
+
let u = d[i], c = s[l], h2 = d[l], f = u.distance + c.distance;
|
|
178
|
+
f < h2.distance && (h2.distance = f, h2.predecessor = c.predecessor);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}), r;
|
|
182
|
+
}
|
|
183
|
+
function ke(e) {
|
|
184
|
+
let n = {}, t = {}, r = [];
|
|
185
|
+
function o(i) {
|
|
186
|
+
if (i in t) throw new D();
|
|
187
|
+
i in n || (t[i] = true, n[i] = true, e.predecessors(i).forEach(o), delete t[i], r.push(i));
|
|
188
|
+
}
|
|
189
|
+
if (e.sinks().forEach(o), Object.keys(n).length !== e.nodeCount()) throw new D();
|
|
190
|
+
return r;
|
|
191
|
+
}
|
|
192
|
+
function Cn(e) {
|
|
193
|
+
try {
|
|
194
|
+
ke(e);
|
|
195
|
+
} catch (n) {
|
|
196
|
+
if (n instanceof D) return false;
|
|
197
|
+
throw n;
|
|
198
|
+
}
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
201
|
+
function Rn(e, n, t, r, o) {
|
|
202
|
+
Array.isArray(n) || (n = [n]);
|
|
203
|
+
let i = ((a) => {
|
|
204
|
+
var d;
|
|
205
|
+
return (d = e.isDirected() ? e.successors(a) : e.neighbors(a)) != null ? d : [];
|
|
206
|
+
}), s = {};
|
|
207
|
+
return n.forEach(function(a) {
|
|
208
|
+
if (!e.hasNode(a)) throw new Error("Graph does not have node: " + a);
|
|
209
|
+
o = ve(e, a, t === "post", s, i, r, o);
|
|
210
|
+
}), o;
|
|
211
|
+
}
|
|
212
|
+
function ve(e, n, t, r, o, i, s) {
|
|
213
|
+
return n in r || (r[n] = true, t || (s = i(s, n)), o(n).forEach(function(a) {
|
|
214
|
+
s = ve(e, a, t, r, o, i, s);
|
|
215
|
+
}), t && (s = i(s, n))), s;
|
|
216
|
+
}
|
|
217
|
+
function _e(e, n, t) {
|
|
218
|
+
return Rn(e, n, t, function(r, o) {
|
|
219
|
+
return r.push(o), r;
|
|
220
|
+
}, []);
|
|
221
|
+
}
|
|
222
|
+
function Pn(e, n) {
|
|
223
|
+
return _e(e, n, "post");
|
|
224
|
+
}
|
|
225
|
+
function Mn(e, n) {
|
|
226
|
+
return _e(e, n, "pre");
|
|
227
|
+
}
|
|
228
|
+
function jn(e, n) {
|
|
229
|
+
let t = new p(), r = {}, o = new Ne(), i;
|
|
230
|
+
function s(d) {
|
|
231
|
+
let l = d.v === i ? d.w : d.v, u = o.priority(l);
|
|
232
|
+
if (u !== void 0) {
|
|
233
|
+
let c = n(d);
|
|
234
|
+
c < u && (r[l] = i, o.decrease(l, c));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (e.nodeCount() === 0) return t;
|
|
238
|
+
e.nodes().forEach(function(d) {
|
|
239
|
+
o.add(d, Number.POSITIVE_INFINITY), t.setNode(d);
|
|
240
|
+
}), o.decrease(e.nodes()[0], 0);
|
|
241
|
+
let a = false;
|
|
242
|
+
for (; o.size() > 0; ) {
|
|
243
|
+
if (i = o.removeMin(), i in r) t.setEdge(i, r[i]);
|
|
244
|
+
else {
|
|
245
|
+
if (a) throw new Error("Input graph is not connected: " + e);
|
|
246
|
+
a = true;
|
|
247
|
+
}
|
|
248
|
+
e.nodeEdges(i).forEach(s);
|
|
249
|
+
}
|
|
250
|
+
return t;
|
|
251
|
+
}
|
|
252
|
+
function Sn(e, n, t, r) {
|
|
253
|
+
return Fn(e, n, t, r != null ? r : ((o) => {
|
|
254
|
+
let i = e.outEdges(o);
|
|
255
|
+
return i != null ? i : [];
|
|
256
|
+
}));
|
|
257
|
+
}
|
|
258
|
+
function Fn(e, n, t, r) {
|
|
259
|
+
if (t === void 0) return F(e, n, t, r);
|
|
260
|
+
let o = false, i = e.nodes();
|
|
261
|
+
for (let s = 0; s < i.length; s++) {
|
|
262
|
+
let a = r(i[s]);
|
|
263
|
+
for (let d = 0; d < a.length; d++) {
|
|
264
|
+
let l = a[d], u = l.v === i[s] ? l.v : l.w, c = u === l.v ? l.w : l.v;
|
|
265
|
+
t({ v: u, w: c }) < 0 && (o = true);
|
|
266
|
+
}
|
|
267
|
+
if (o) return we(e, n, t, r);
|
|
268
|
+
}
|
|
269
|
+
return F(e, n, t, r);
|
|
270
|
+
}
|
|
271
|
+
function w2(e, n, t, r) {
|
|
272
|
+
let o = r;
|
|
273
|
+
for (; e.hasNode(o); ) o = j(r);
|
|
274
|
+
return t.dummy = n, e.setNode(o, t), o;
|
|
275
|
+
}
|
|
276
|
+
function xe(e) {
|
|
277
|
+
let n = new p().setGraph(e.graph());
|
|
278
|
+
return e.nodes().forEach((t) => n.setNode(t, e.node(t))), e.edges().forEach((t) => {
|
|
279
|
+
let r = n.edge(t.v, t.w) || { weight: 0, minlen: 1 }, o = e.edge(t);
|
|
280
|
+
n.setEdge(t.v, t.w, { weight: r.weight + o.weight, minlen: Math.max(r.minlen, o.minlen) });
|
|
281
|
+
}), n;
|
|
282
|
+
}
|
|
283
|
+
function A(e) {
|
|
284
|
+
let n = new p({ multigraph: e.isMultigraph() }).setGraph(e.graph());
|
|
285
|
+
return e.nodes().forEach((t) => {
|
|
286
|
+
e.children(t).length || n.setNode(t, e.node(t));
|
|
287
|
+
}), e.edges().forEach((t) => {
|
|
288
|
+
n.setEdge(t, e.edge(t));
|
|
289
|
+
}), n;
|
|
290
|
+
}
|
|
291
|
+
function H(e, n) {
|
|
292
|
+
let t = e.x, r = e.y, o = n.x - t, i = n.y - r, s = e.width / 2, a = e.height / 2;
|
|
293
|
+
if (!o && !i) throw new Error("Not possible to find intersection inside of the rectangle");
|
|
294
|
+
let d, l;
|
|
295
|
+
return Math.abs(i) * s > Math.abs(o) * a ? (i < 0 && (a = -a), d = a * o / i, l = a) : (o < 0 && (s = -s), d = s, l = s * i / o), { x: t + d, y: r + l };
|
|
296
|
+
}
|
|
297
|
+
function N(e) {
|
|
298
|
+
let n = k(X(e) + 1).map(() => []);
|
|
299
|
+
return e.nodes().forEach((t) => {
|
|
300
|
+
let r = e.node(t), o = r.rank;
|
|
301
|
+
o !== void 0 && (n[o] || (n[o] = []), n[o][r.order] = t);
|
|
302
|
+
}), n;
|
|
303
|
+
}
|
|
304
|
+
function Te(e) {
|
|
305
|
+
let n = e.nodes().map((r) => {
|
|
306
|
+
let o = e.node(r).rank;
|
|
307
|
+
return o === void 0 ? Number.MAX_VALUE : o;
|
|
308
|
+
}), t = L(Math.min, n);
|
|
309
|
+
e.nodes().forEach((r) => {
|
|
310
|
+
let o = e.node(r);
|
|
311
|
+
Object.hasOwn(o, "rank") && (o.rank -= t);
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
function Oe(e) {
|
|
315
|
+
let n = e.nodes().map((s) => e.node(s).rank).filter((s) => s !== void 0), t = L(Math.min, n), r = [];
|
|
316
|
+
e.nodes().forEach((s) => {
|
|
317
|
+
let a = e.node(s).rank - t;
|
|
318
|
+
r[a] || (r[a] = []), r[a].push(s);
|
|
319
|
+
});
|
|
320
|
+
let o = 0, i = e.graph().nodeRankFactor;
|
|
321
|
+
Array.from(r).forEach((s, a) => {
|
|
322
|
+
s === void 0 && a % i !== 0 ? --o : s !== void 0 && o && s.forEach((d) => e.node(d).rank += o);
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
function q(e, n, t, r) {
|
|
326
|
+
let o = { width: 0, height: 0 };
|
|
327
|
+
return arguments.length >= 4 && (o.rank = t, o.order = r), w2(e, "border", o, n);
|
|
328
|
+
}
|
|
329
|
+
function Dn(e, n = Ie) {
|
|
330
|
+
let t = [];
|
|
331
|
+
for (let r = 0; r < e.length; r += n) {
|
|
332
|
+
let o = e.slice(r, r + n);
|
|
333
|
+
t.push(o);
|
|
334
|
+
}
|
|
335
|
+
return t;
|
|
336
|
+
}
|
|
337
|
+
function L(e, n) {
|
|
338
|
+
if (n.length > Ie) {
|
|
339
|
+
let t = Dn(n);
|
|
340
|
+
return e(...t.map((r) => e(...r)));
|
|
341
|
+
} else return e(...n);
|
|
342
|
+
}
|
|
343
|
+
function X(e) {
|
|
344
|
+
let t = e.nodes().map((r) => {
|
|
345
|
+
let o = e.node(r).rank;
|
|
346
|
+
return o === void 0 ? Number.MIN_VALUE : o;
|
|
347
|
+
});
|
|
348
|
+
return L(Math.max, t);
|
|
349
|
+
}
|
|
350
|
+
function Ce(e, n) {
|
|
351
|
+
let t = { lhs: [], rhs: [] };
|
|
352
|
+
return e.forEach((r) => {
|
|
353
|
+
n(r) ? t.lhs.push(r) : t.rhs.push(r);
|
|
354
|
+
}), t;
|
|
355
|
+
}
|
|
356
|
+
function P(e, n) {
|
|
357
|
+
let t = Date.now();
|
|
358
|
+
try {
|
|
359
|
+
return n();
|
|
360
|
+
} finally {
|
|
361
|
+
console.log(e + " time: " + (Date.now() - t) + "ms");
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
function M(e, n) {
|
|
365
|
+
return n();
|
|
366
|
+
}
|
|
367
|
+
function j(e) {
|
|
368
|
+
let n = ++An;
|
|
369
|
+
return e + ("" + n);
|
|
370
|
+
}
|
|
371
|
+
function k(e, n, t = 1) {
|
|
372
|
+
n == null && (n = e, e = 0);
|
|
373
|
+
let r = (i) => i < n;
|
|
374
|
+
t < 0 && (r = (i) => n < i);
|
|
375
|
+
let o = [];
|
|
376
|
+
for (let i = e; r(i); i += t) o.push(i);
|
|
377
|
+
return o;
|
|
378
|
+
}
|
|
379
|
+
function T(e, n) {
|
|
380
|
+
let t = {};
|
|
381
|
+
for (let r of n) e[r] !== void 0 && (t[r] = e[r]);
|
|
382
|
+
return t;
|
|
383
|
+
}
|
|
384
|
+
function O(e, n) {
|
|
385
|
+
let t;
|
|
386
|
+
return typeof n == "string" ? t = (r) => r[n] : t = n, Object.entries(e).reduce((r, [o, i]) => (r[o] = t(i, o), r), {});
|
|
387
|
+
}
|
|
388
|
+
function Re(e, n) {
|
|
389
|
+
return e.reduce((t, r, o) => (t[r] = n[o], t), {});
|
|
390
|
+
}
|
|
391
|
+
function Pe(e) {
|
|
392
|
+
e._prev._next = e._next, e._next._prev = e._prev, delete e._next, delete e._prev;
|
|
393
|
+
}
|
|
394
|
+
function Vn(e, n) {
|
|
395
|
+
if (e !== "_next" && e !== "_prev") return n;
|
|
396
|
+
}
|
|
397
|
+
function Q(e, n) {
|
|
398
|
+
if (e.nodeCount() <= 1) return [];
|
|
399
|
+
let t = Yn(e, n || Wn);
|
|
400
|
+
return Bn(t.graph, t.buckets, t.zeroIdx).flatMap((o) => e.outEdges(o.v, o.w) || []);
|
|
401
|
+
}
|
|
402
|
+
function Bn(e, n, t) {
|
|
403
|
+
var a;
|
|
404
|
+
let r = [], o = n[n.length - 1], i = n[0], s;
|
|
405
|
+
for (; e.nodeCount(); ) {
|
|
406
|
+
for (; s = i.dequeue(); ) $(e, n, t, s);
|
|
407
|
+
for (; s = o.dequeue(); ) $(e, n, t, s);
|
|
408
|
+
if (e.nodeCount()) {
|
|
409
|
+
for (let d = n.length - 2; d > 0; --d) if (s = (a = n[d]) == null ? void 0 : a.dequeue(), s) {
|
|
410
|
+
r = r.concat($(e, n, t, s, true) || []);
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return r;
|
|
416
|
+
}
|
|
417
|
+
function $(e, n, t, r, o) {
|
|
418
|
+
let i = [], s = o ? i : void 0;
|
|
419
|
+
return (e.inEdges(r.v) || []).forEach((a) => {
|
|
420
|
+
let d = e.edge(a), l = e.node(a.v);
|
|
421
|
+
o && i.push({ v: a.v, w: a.w }), l.out -= d, J(n, t, l);
|
|
422
|
+
}), (e.outEdges(r.v) || []).forEach((a) => {
|
|
423
|
+
let d = e.edge(a), l = a.w, u = e.node(l);
|
|
424
|
+
u.in -= d, J(n, t, u);
|
|
425
|
+
}), e.removeNode(r.v), s;
|
|
426
|
+
}
|
|
427
|
+
function Yn(e, n) {
|
|
428
|
+
let t = new p(), r = 0, o = 0;
|
|
429
|
+
e.nodes().forEach((a) => {
|
|
430
|
+
t.setNode(a, { v: a, in: 0, out: 0 });
|
|
431
|
+
}), e.edges().forEach((a) => {
|
|
432
|
+
let d = t.edge(a.v, a.w) || 0, l = n(a), u = d + l;
|
|
433
|
+
t.setEdge(a.v, a.w, u);
|
|
434
|
+
let c = t.node(a.v), h2 = t.node(a.w);
|
|
435
|
+
o = Math.max(o, c.out += l), r = Math.max(r, h2.in += l);
|
|
436
|
+
});
|
|
437
|
+
let i = zn(o + r + 3).map(() => new Me()), s = r + 1;
|
|
438
|
+
return t.nodes().forEach((a) => {
|
|
439
|
+
J(i, s, t.node(a));
|
|
440
|
+
}), { graph: t, buckets: i, zeroIdx: s };
|
|
441
|
+
}
|
|
442
|
+
function J(e, n, t) {
|
|
443
|
+
var r, o, i;
|
|
444
|
+
t.out ? t.in ? (i = e[t.out - t.in + n]) == null || i.enqueue(t) : (o = e[e.length - 1]) == null || o.enqueue(t) : (r = e[0]) == null || r.enqueue(t);
|
|
445
|
+
}
|
|
446
|
+
function zn(e) {
|
|
447
|
+
let n = [];
|
|
448
|
+
for (let t = 0; t < e; t++) n.push(t);
|
|
449
|
+
return n;
|
|
450
|
+
}
|
|
451
|
+
function je(e) {
|
|
452
|
+
(e.graph().acyclicer === "greedy" ? Q(e, t(e)) : Hn(e)).forEach((r) => {
|
|
453
|
+
let o = e.edge(r);
|
|
454
|
+
e.removeEdge(r), o.forwardName = r.name, o.reversed = true, e.setEdge(r.w, r.v, o, j("rev"));
|
|
455
|
+
});
|
|
456
|
+
function t(r) {
|
|
457
|
+
return (o) => r.edge(o).weight;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
function Hn(e) {
|
|
461
|
+
let n = [], t = {}, r = {};
|
|
462
|
+
function o(i) {
|
|
463
|
+
Object.hasOwn(r, i) || (r[i] = true, t[i] = true, e.outEdges(i).forEach((s) => {
|
|
464
|
+
Object.hasOwn(t, s.w) ? n.push(s) : o(s.w);
|
|
465
|
+
}), delete t[i]);
|
|
466
|
+
}
|
|
467
|
+
return e.nodes().forEach(o), n;
|
|
468
|
+
}
|
|
469
|
+
function Se(e) {
|
|
470
|
+
e.edges().forEach((n) => {
|
|
471
|
+
let t = e.edge(n);
|
|
472
|
+
if (t.reversed) {
|
|
473
|
+
e.removeEdge(n);
|
|
474
|
+
let r = t.forwardName;
|
|
475
|
+
delete t.reversed, delete t.forwardName, e.setEdge(n.w, n.v, t, r);
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
function Fe(e) {
|
|
480
|
+
e.graph().dummyChains = [], e.edges().forEach((n) => Xn(e, n));
|
|
481
|
+
}
|
|
482
|
+
function Xn(e, n) {
|
|
483
|
+
let t = n.v, r = e.node(t).rank, o = n.w, i = e.node(o).rank, s = n.name, a = e.edge(n), d = a.labelRank;
|
|
484
|
+
if (i === r + 1) return;
|
|
485
|
+
e.removeEdge(n);
|
|
486
|
+
let l, u, c;
|
|
487
|
+
for (c = 0, ++r; r < i; ++c, ++r) a.points = [], u = { width: 0, height: 0, edgeLabel: a, edgeObj: n, rank: r }, l = w2(e, "edge", u, "_d"), r === d && (u.width = a.width, u.height = a.height, u.dummy = "edge-label", u.labelpos = a.labelpos), e.setEdge(t, l, { weight: a.weight }, s), c === 0 && e.graph().dummyChains.push(l), t = l;
|
|
488
|
+
e.setEdge(t, o, { weight: a.weight }, s);
|
|
489
|
+
}
|
|
490
|
+
function De(e) {
|
|
491
|
+
e.graph().dummyChains.forEach((n) => {
|
|
492
|
+
let t = e.node(n), r = t.edgeLabel, o;
|
|
493
|
+
for (e.setEdge(t.edgeObj, r); t.dummy; ) o = e.successors(n)[0], e.removeNode(n), r.points.push({ x: t.x, y: t.y }), t.dummy === "edge-label" && (r.x = t.x, r.y = t.y, r.width = t.width, r.height = t.height), n = o, t = e.node(n);
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
function S(e) {
|
|
497
|
+
let n = {};
|
|
498
|
+
function t(r) {
|
|
499
|
+
let o = e.node(r);
|
|
500
|
+
if (Object.hasOwn(n, r)) return o.rank;
|
|
501
|
+
n[r] = true;
|
|
502
|
+
let i = e.outEdges(r), s = i ? i.map((d) => d == null ? Number.POSITIVE_INFINITY : t(d.w) - e.edge(d).minlen) : [], a = L(Math.min, s);
|
|
503
|
+
return a === Number.POSITIVE_INFINITY && (a = 0), o.rank = a;
|
|
504
|
+
}
|
|
505
|
+
e.sources().forEach(t);
|
|
506
|
+
}
|
|
507
|
+
function v(e, n) {
|
|
508
|
+
return e.node(n.w).rank - e.node(n.v).rank - e.edge(n).minlen;
|
|
509
|
+
}
|
|
510
|
+
function Kn(e) {
|
|
511
|
+
let n = new p({ directed: false }), t = e.nodes();
|
|
512
|
+
if (t.length === 0) throw new Error("Graph must have at least one node");
|
|
513
|
+
let r = t[0], o = e.nodeCount();
|
|
514
|
+
n.setNode(r, {});
|
|
515
|
+
let i, s;
|
|
516
|
+
for (; $n(n, e) < o && (i = Jn(n, e), !!i); ) s = n.hasNode(i.v) ? v(e, i) : -v(e, i), Qn(n, e, s);
|
|
517
|
+
return n;
|
|
518
|
+
}
|
|
519
|
+
function $n(e, n) {
|
|
520
|
+
function t(r) {
|
|
521
|
+
let o = n.nodeEdges(r);
|
|
522
|
+
o && o.forEach((i) => {
|
|
523
|
+
let s = i.v, a = r === s ? i.w : s;
|
|
524
|
+
!e.hasNode(a) && !v(n, i) && (e.setNode(a, {}), e.setEdge(r, a, {}), t(a));
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
return e.nodes().forEach(t), e.nodeCount();
|
|
528
|
+
}
|
|
529
|
+
function Jn(e, n) {
|
|
530
|
+
return n.edges().reduce((r, o) => {
|
|
531
|
+
let i = Number.POSITIVE_INFINITY;
|
|
532
|
+
return e.hasNode(o.v) !== e.hasNode(o.w) && (i = v(n, o)), i < r[0] ? [i, o] : r;
|
|
533
|
+
}, [Number.POSITIVE_INFINITY, null])[1];
|
|
534
|
+
}
|
|
535
|
+
function Qn(e, n, t) {
|
|
536
|
+
e.nodes().forEach((r) => n.node(r).rank += t);
|
|
537
|
+
}
|
|
538
|
+
function x(e) {
|
|
539
|
+
e = xe(e), S(e);
|
|
540
|
+
let n = V(e);
|
|
541
|
+
ee(n), Z(n, e);
|
|
542
|
+
let t, r;
|
|
543
|
+
for (; t = Ye(n); ) r = ze(n, e, t), He(n, e, t, r);
|
|
544
|
+
}
|
|
545
|
+
function Z(e, n) {
|
|
546
|
+
let t = et(e, e.nodes());
|
|
547
|
+
t = t.slice(0, t.length - 1), t.forEach((r) => nt(e, n, r));
|
|
548
|
+
}
|
|
549
|
+
function nt(e, n, t) {
|
|
550
|
+
let o = e.node(t).parent, i = e.edge(t, o);
|
|
551
|
+
i.cutvalue = We(e, n, t);
|
|
552
|
+
}
|
|
553
|
+
function We(e, n, t) {
|
|
554
|
+
let o = e.node(t).parent, i = true, s = n.edge(t, o), a = 0;
|
|
555
|
+
s || (i = false, s = n.edge(o, t)), a = s.weight;
|
|
556
|
+
let d = n.nodeEdges(t);
|
|
557
|
+
return d && d.forEach((l) => {
|
|
558
|
+
let u = l.v === t, c = u ? l.w : l.v;
|
|
559
|
+
if (c !== o) {
|
|
560
|
+
let h2 = u === i, f = n.edge(l).weight;
|
|
561
|
+
if (a += h2 ? f : -f, rt(e, t, c)) {
|
|
562
|
+
let b = e.edge(t, c).cutvalue;
|
|
563
|
+
a += h2 ? -b : b;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}), a;
|
|
567
|
+
}
|
|
568
|
+
function ee(e, n) {
|
|
569
|
+
arguments.length < 2 && (n = e.nodes()[0]), Be(e, {}, 1, n);
|
|
570
|
+
}
|
|
571
|
+
function Be(e, n, t, r, o) {
|
|
572
|
+
let i = t, s = e.node(r);
|
|
573
|
+
n[r] = true;
|
|
574
|
+
let a = e.neighbors(r);
|
|
575
|
+
return a && a.forEach((d) => {
|
|
576
|
+
Object.hasOwn(n, d) || (t = Be(e, n, t, d, r));
|
|
577
|
+
}), s.low = i, s.lim = t++, o ? s.parent = o : delete s.parent, t;
|
|
578
|
+
}
|
|
579
|
+
function Ye(e) {
|
|
580
|
+
return e.edges().find((n) => e.edge(n).cutvalue < 0);
|
|
581
|
+
}
|
|
582
|
+
function ze(e, n, t) {
|
|
583
|
+
let r = t.v, o = t.w;
|
|
584
|
+
n.hasEdge(r, o) || (r = t.w, o = t.v);
|
|
585
|
+
let i = e.node(r), s = e.node(o), a = i, d = false;
|
|
586
|
+
return i.lim > s.lim && (a = s, d = true), n.edges().filter((u) => d === Ae(e, e.node(u.v), a) && d !== Ae(e, e.node(u.w), a)).reduce((u, c) => v(n, c) < v(n, u) ? c : u);
|
|
587
|
+
}
|
|
588
|
+
function He(e, n, t, r) {
|
|
589
|
+
let o = t.v, i = t.w;
|
|
590
|
+
e.removeEdge(o, i), e.setEdge(r.v, r.w, {}), ee(e), Z(e, n), tt(e, n);
|
|
591
|
+
}
|
|
592
|
+
function tt(e, n) {
|
|
593
|
+
let t = e.nodes().find((o) => !e.node(o).parent);
|
|
594
|
+
if (!t) return;
|
|
595
|
+
let r = Zn(e, [t]);
|
|
596
|
+
r = r.slice(1), r.forEach((o) => {
|
|
597
|
+
let s = e.node(o).parent, a = n.edge(o, s), d = false;
|
|
598
|
+
a || (a = n.edge(s, o), d = true), n.node(o).rank = n.node(s).rank + (d ? a.minlen : -a.minlen);
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
function rt(e, n, t) {
|
|
602
|
+
return e.hasEdge(n, t);
|
|
603
|
+
}
|
|
604
|
+
function Ae(e, n, t) {
|
|
605
|
+
return t.low <= n.lim && n.lim <= t.lim;
|
|
606
|
+
}
|
|
607
|
+
function ot(e) {
|
|
608
|
+
let n = e.graph().ranker;
|
|
609
|
+
if (typeof n == "function") return n(e);
|
|
610
|
+
switch (n) {
|
|
611
|
+
case "network-simplex":
|
|
612
|
+
qe(e);
|
|
613
|
+
break;
|
|
614
|
+
case "tight-tree":
|
|
615
|
+
st(e);
|
|
616
|
+
break;
|
|
617
|
+
case "longest-path":
|
|
618
|
+
it(e);
|
|
619
|
+
break;
|
|
620
|
+
case "none":
|
|
621
|
+
break;
|
|
622
|
+
default:
|
|
623
|
+
qe(e);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
function st(e) {
|
|
627
|
+
S(e), V(e);
|
|
628
|
+
}
|
|
629
|
+
function qe(e) {
|
|
630
|
+
Ve(e);
|
|
631
|
+
}
|
|
632
|
+
function at(e) {
|
|
633
|
+
let n = lt(e);
|
|
634
|
+
e.graph().dummyChains.forEach((t) => {
|
|
635
|
+
let r = e.node(t), o = r.edgeObj, i = dt(e, n, o.v, o.w), s = i.path, a = i.lca, d = 0, l = s[d], u = true;
|
|
636
|
+
for (; t !== o.w; ) {
|
|
637
|
+
if (r = e.node(t), u) {
|
|
638
|
+
for (; (l = s[d]) !== a && e.node(l).maxRank < r.rank; ) d++;
|
|
639
|
+
l === a && (u = false);
|
|
640
|
+
}
|
|
641
|
+
if (!u) {
|
|
642
|
+
for (; d < s.length - 1 && e.node(s[d + 1]).minRank <= r.rank; ) d++;
|
|
643
|
+
l = s[d];
|
|
644
|
+
}
|
|
645
|
+
l !== void 0 && e.setParent(t, l), t = e.successors(t)[0];
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
function dt(e, n, t, r) {
|
|
650
|
+
let o = [], i = [], s = Math.min(n[t].low, n[r].low), a = Math.max(n[t].lim, n[r].lim), d;
|
|
651
|
+
d = t;
|
|
652
|
+
do
|
|
653
|
+
d = e.parent(d), o.push(d);
|
|
654
|
+
while (d && (n[d].low > s || a > n[d].lim));
|
|
655
|
+
let l = d, u = r;
|
|
656
|
+
for (; (u = e.parent(u)) !== l; ) i.push(u);
|
|
657
|
+
return { path: o.concat(i.reverse()), lca: l };
|
|
658
|
+
}
|
|
659
|
+
function lt(e) {
|
|
660
|
+
let n = {}, t = 0;
|
|
661
|
+
function r(o) {
|
|
662
|
+
let i = t;
|
|
663
|
+
e.children(o).forEach(r), n[o] = { low: i, lim: t++ };
|
|
664
|
+
}
|
|
665
|
+
return e.children(_).forEach(r), n;
|
|
666
|
+
}
|
|
667
|
+
function Ke(e) {
|
|
668
|
+
let n = w2(e, "root", {}, "_root"), t = ut(e), r = Object.values(t), o = L(Math.max, r) - 1, i = 2 * o + 1;
|
|
669
|
+
e.graph().nestingRoot = n, e.edges().forEach((a) => e.edge(a).minlen *= i);
|
|
670
|
+
let s = ct(e) + 1;
|
|
671
|
+
e.children(_).forEach((a) => $e(e, n, i, s, o, t, a)), e.graph().nodeRankFactor = i;
|
|
672
|
+
}
|
|
673
|
+
function $e(e, n, t, r, o, i, s) {
|
|
674
|
+
var c;
|
|
675
|
+
let a = e.children(s);
|
|
676
|
+
if (!a.length) {
|
|
677
|
+
s !== n && e.setEdge(n, s, { weight: 0, minlen: t });
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
let d = q(e, "_bt"), l = q(e, "_bb"), u = e.node(s);
|
|
681
|
+
e.setParent(d, s), u.borderTop = d, e.setParent(l, s), u.borderBottom = l, a.forEach((h2) => {
|
|
682
|
+
var y;
|
|
683
|
+
$e(e, n, t, r, o, i, h2);
|
|
684
|
+
let f = e.node(h2), g = f.borderTop ? f.borderTop : h2, b = f.borderBottom ? f.borderBottom : h2, m = f.borderTop ? r : 2 * r, E = g !== b ? 1 : o - ((y = i[s]) != null ? y : 0) + 1;
|
|
685
|
+
e.setEdge(d, g, { weight: m, minlen: E, nestingEdge: true }), e.setEdge(b, l, { weight: m, minlen: E, nestingEdge: true });
|
|
686
|
+
}), e.parent(s) || e.setEdge(n, d, { weight: 0, minlen: o + ((c = i[s]) != null ? c : 0) });
|
|
687
|
+
}
|
|
688
|
+
function ut(e) {
|
|
689
|
+
let n = {};
|
|
690
|
+
function t(r, o) {
|
|
691
|
+
let i = e.children(r);
|
|
692
|
+
i && i.length && i.forEach((s) => t(s, o + 1)), n[r] = o;
|
|
693
|
+
}
|
|
694
|
+
return e.children(_).forEach((r) => t(r, 1)), n;
|
|
695
|
+
}
|
|
696
|
+
function ct(e) {
|
|
697
|
+
return e.edges().reduce((n, t) => n + e.edge(t).weight, 0);
|
|
698
|
+
}
|
|
699
|
+
function Je(e) {
|
|
700
|
+
let n = e.graph();
|
|
701
|
+
e.removeNode(n.nestingRoot), delete n.nestingRoot, e.edges().forEach((t) => {
|
|
702
|
+
e.edge(t).nestingEdge && e.removeEdge(t);
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
function ft(e) {
|
|
706
|
+
function n(t) {
|
|
707
|
+
let r = e.children(t), o = e.node(t);
|
|
708
|
+
if (r.length && r.forEach(n), Object.hasOwn(o, "minRank")) {
|
|
709
|
+
o.borderLeft = [], o.borderRight = [];
|
|
710
|
+
for (let i = o.minRank, s = o.maxRank + 1; i < s; ++i) Qe(e, "borderLeft", "_bl", t, o, i), Qe(e, "borderRight", "_br", t, o, i);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
e.children(_).forEach(n);
|
|
714
|
+
}
|
|
715
|
+
function Qe(e, n, t, r, o, i) {
|
|
716
|
+
let s = { width: 0, height: 0, rank: i, borderType: n }, a = o[n][i - 1], d = w2(e, "border", s, t);
|
|
717
|
+
o[n][i] = d, e.setParent(d, r), a && e.setEdge(a, d, { weight: 1 });
|
|
718
|
+
}
|
|
719
|
+
function nn(e) {
|
|
720
|
+
var t;
|
|
721
|
+
let n = (t = e.graph().rankdir) == null ? void 0 : t.toLowerCase();
|
|
722
|
+
(n === "lr" || n === "rl") && rn(e);
|
|
723
|
+
}
|
|
724
|
+
function tn(e) {
|
|
725
|
+
var t;
|
|
726
|
+
let n = (t = e.graph().rankdir) == null ? void 0 : t.toLowerCase();
|
|
727
|
+
(n === "bt" || n === "rl") && bt(e), (n === "lr" || n === "rl") && (gt(e), rn(e));
|
|
728
|
+
}
|
|
729
|
+
function rn(e) {
|
|
730
|
+
e.nodes().forEach((n) => en(e.node(n))), e.edges().forEach((n) => en(e.edge(n)));
|
|
731
|
+
}
|
|
732
|
+
function en(e) {
|
|
733
|
+
let n = e.width;
|
|
734
|
+
e.width = e.height, e.height = n;
|
|
735
|
+
}
|
|
736
|
+
function bt(e) {
|
|
737
|
+
e.nodes().forEach((n) => ne(e.node(n))), e.edges().forEach((n) => {
|
|
738
|
+
var r;
|
|
739
|
+
let t = e.edge(n);
|
|
740
|
+
(r = t.points) == null || r.forEach(ne), Object.hasOwn(t, "y") && ne(t);
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
function ne(e) {
|
|
744
|
+
e.y = -e.y;
|
|
745
|
+
}
|
|
746
|
+
function gt(e) {
|
|
747
|
+
e.nodes().forEach((n) => te(e.node(n))), e.edges().forEach((n) => {
|
|
748
|
+
var r;
|
|
749
|
+
let t = e.edge(n);
|
|
750
|
+
(r = t.points) == null || r.forEach(te), Object.hasOwn(t, "x") && te(t);
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
function te(e) {
|
|
754
|
+
let n = e.x;
|
|
755
|
+
e.x = e.y, e.y = n;
|
|
756
|
+
}
|
|
757
|
+
function re(e) {
|
|
758
|
+
let n = {}, t = e.nodes().filter((d) => !e.children(d).length), r = t.map((d) => e.node(d).rank), o = L(Math.max, r), i = k(o + 1).map(() => []);
|
|
759
|
+
function s(d) {
|
|
760
|
+
if (n[d]) return;
|
|
761
|
+
n[d] = true;
|
|
762
|
+
let l = e.node(d);
|
|
763
|
+
i[l.rank].push(d);
|
|
764
|
+
let u = e.successors(d);
|
|
765
|
+
u && u.forEach(s);
|
|
766
|
+
}
|
|
767
|
+
return t.sort((d, l) => e.node(d).rank - e.node(l).rank).forEach(s), i;
|
|
768
|
+
}
|
|
769
|
+
function oe(e, n) {
|
|
770
|
+
let t = 0;
|
|
771
|
+
for (let r = 1; r < n.length; ++r) t += mt(e, n[r - 1], n[r]);
|
|
772
|
+
return t;
|
|
773
|
+
}
|
|
774
|
+
function mt(e, n, t) {
|
|
775
|
+
let r = Re(t, t.map((l, u) => u)), o = n.flatMap((l) => {
|
|
776
|
+
let u = e.outEdges(l);
|
|
777
|
+
return u ? u.map((c) => ({ pos: r[c.w], weight: e.edge(c).weight })).sort((c, h2) => c.pos - h2.pos) : [];
|
|
778
|
+
}), i = 1;
|
|
779
|
+
for (; i < t.length; ) i <<= 1;
|
|
780
|
+
let s = 2 * i - 1;
|
|
781
|
+
i -= 1;
|
|
782
|
+
let a = new Array(s).fill(0), d = 0;
|
|
783
|
+
return o.forEach((l) => {
|
|
784
|
+
let u = l.pos + i;
|
|
785
|
+
a[u] += l.weight;
|
|
786
|
+
let c = 0;
|
|
787
|
+
for (; u > 0; ) u % 2 && (c += a[u + 1]), u = u - 1 >> 1, a[u] += l.weight;
|
|
788
|
+
d += l.weight * c;
|
|
789
|
+
}), d;
|
|
790
|
+
}
|
|
791
|
+
function ie(e, n = []) {
|
|
792
|
+
return n.map((t) => {
|
|
793
|
+
let r = e.inEdges(t);
|
|
794
|
+
if (!r || !r.length) return { v: t };
|
|
795
|
+
{
|
|
796
|
+
let o = r.reduce((i, s) => {
|
|
797
|
+
let a = e.edge(s), d = e.node(s.v);
|
|
798
|
+
return { sum: i.sum + a.weight * d.order, weight: i.weight + a.weight };
|
|
799
|
+
}, { sum: 0, weight: 0 });
|
|
800
|
+
return { v: t, barycenter: o.sum / o.weight, weight: o.weight };
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
function se(e, n) {
|
|
805
|
+
let t = {};
|
|
806
|
+
e.forEach((o, i) => {
|
|
807
|
+
let s = { indegree: 0, in: [], out: [], vs: [o.v], i };
|
|
808
|
+
o.barycenter !== void 0 && (s.barycenter = o.barycenter, s.weight = o.weight), t[o.v] = s;
|
|
809
|
+
}), n.edges().forEach((o) => {
|
|
810
|
+
let i = t[o.v], s = t[o.w];
|
|
811
|
+
i !== void 0 && s !== void 0 && (s.indegree++, i.out.push(s));
|
|
812
|
+
});
|
|
813
|
+
let r = Object.values(t).filter((o) => !o.indegree);
|
|
814
|
+
return Et(r);
|
|
815
|
+
}
|
|
816
|
+
function Et(e) {
|
|
817
|
+
let n = [];
|
|
818
|
+
function t(o) {
|
|
819
|
+
return (i) => {
|
|
820
|
+
i.merged || (i.barycenter === void 0 || o.barycenter === void 0 || i.barycenter >= o.barycenter) && Lt(o, i);
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
function r(o) {
|
|
824
|
+
return (i) => {
|
|
825
|
+
i.in.push(o), --i.indegree === 0 && e.push(i);
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
for (; e.length; ) {
|
|
829
|
+
let o = e.pop();
|
|
830
|
+
n.push(o), o.in.reverse().forEach(t(o)), o.out.forEach(r(o));
|
|
831
|
+
}
|
|
832
|
+
return n.filter((o) => !o.merged).map((o) => T(o, ["vs", "i", "barycenter", "weight"]));
|
|
833
|
+
}
|
|
834
|
+
function Lt(e, n) {
|
|
835
|
+
let t = 0, r = 0;
|
|
836
|
+
e.weight && (t += e.barycenter * e.weight, r += e.weight), n.weight && (t += n.barycenter * n.weight, r += n.weight), e.vs = n.vs.concat(e.vs), e.barycenter = t / r, e.weight = r, e.i = Math.min(n.i, e.i), n.merged = true;
|
|
837
|
+
}
|
|
838
|
+
function ae(e, n) {
|
|
839
|
+
let t = Ce(e, (u) => Object.hasOwn(u, "barycenter")), r = t.lhs, o = t.rhs.sort((u, c) => c.i - u.i), i = [], s = 0, a = 0, d = 0;
|
|
840
|
+
r.sort(yt(!!n)), d = on(i, o, d), r.forEach((u) => {
|
|
841
|
+
d += u.vs.length, i.push(u.vs), s += u.barycenter * u.weight, a += u.weight, d = on(i, o, d);
|
|
842
|
+
});
|
|
843
|
+
let l = { vs: i.flat(1) };
|
|
844
|
+
return a && (l.barycenter = s / a, l.weight = a), l;
|
|
845
|
+
}
|
|
846
|
+
function on(e, n, t) {
|
|
847
|
+
let r;
|
|
848
|
+
for (; n.length && (r = n[n.length - 1]).i <= t; ) n.pop(), e.push(r.vs), t++;
|
|
849
|
+
return t;
|
|
850
|
+
}
|
|
851
|
+
function yt(e) {
|
|
852
|
+
return (n, t) => n.barycenter < t.barycenter ? -1 : n.barycenter > t.barycenter ? 1 : e ? t.i - n.i : n.i - t.i;
|
|
853
|
+
}
|
|
854
|
+
function W(e, n, t, r) {
|
|
855
|
+
let o = e.children(n), i = e.node(n), s = i ? i.borderLeft : void 0, a = i ? i.borderRight : void 0, d = {};
|
|
856
|
+
s && (o = o.filter((h2) => h2 !== s && h2 !== a));
|
|
857
|
+
let l = ie(e, o);
|
|
858
|
+
l.forEach((h2) => {
|
|
859
|
+
if (e.children(h2.v).length) {
|
|
860
|
+
let f = W(e, h2.v, t, r);
|
|
861
|
+
d[h2.v] = f, Object.hasOwn(f, "barycenter") && Nt(h2, f);
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
let u = se(l, t);
|
|
865
|
+
wt(u, d);
|
|
866
|
+
let c = ae(u, r);
|
|
867
|
+
if (s && a) {
|
|
868
|
+
c.vs = [s, c.vs, a].flat(1);
|
|
869
|
+
let h2 = e.predecessors(s);
|
|
870
|
+
if (h2 && h2.length) {
|
|
871
|
+
let f = e.node(h2[0]), g = e.predecessors(a), b = e.node(g[0]);
|
|
872
|
+
Object.hasOwn(c, "barycenter") || (c.barycenter = 0, c.weight = 0), c.barycenter = (c.barycenter * c.weight + f.order + b.order) / (c.weight + 2), c.weight += 2;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
return c;
|
|
876
|
+
}
|
|
877
|
+
function wt(e, n) {
|
|
878
|
+
e.forEach((t) => {
|
|
879
|
+
t.vs = t.vs.flatMap((r) => n[r] ? n[r].vs : r);
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
function Nt(e, n) {
|
|
883
|
+
e.barycenter !== void 0 ? (e.barycenter = (e.barycenter * e.weight + n.barycenter * n.weight) / (e.weight + n.weight), e.weight += n.weight) : (e.barycenter = n.barycenter, e.weight = n.weight);
|
|
884
|
+
}
|
|
885
|
+
function de(e, n, t, r) {
|
|
886
|
+
r || (r = e.nodes());
|
|
887
|
+
let o = Gt(e), i = new p({ compound: true }).setGraph({ root: o }).setDefaultNodeLabel((s) => e.node(s));
|
|
888
|
+
return r.forEach((s) => {
|
|
889
|
+
let a = e.node(s), d = e.parent(s);
|
|
890
|
+
if (a.rank === n || a.minRank <= n && n <= a.maxRank) {
|
|
891
|
+
i.setNode(s), i.setParent(s, d || o);
|
|
892
|
+
let l = e[t](s);
|
|
893
|
+
l && l.forEach((u) => {
|
|
894
|
+
let c = u.v === s ? u.w : u.v, h2 = i.edge(c, s), f = h2 !== void 0 ? h2.weight : 0;
|
|
895
|
+
i.setEdge(c, s, { weight: e.edge(u).weight + f });
|
|
896
|
+
}), Object.hasOwn(a, "minRank") && i.setNode(s, { borderLeft: a.borderLeft[n], borderRight: a.borderRight[n] });
|
|
897
|
+
}
|
|
898
|
+
}), i;
|
|
899
|
+
}
|
|
900
|
+
function Gt(e) {
|
|
901
|
+
let n;
|
|
902
|
+
for (; e.hasNode(n = j("_root")); ) ;
|
|
903
|
+
return n;
|
|
904
|
+
}
|
|
905
|
+
function le(e, n, t) {
|
|
906
|
+
let r = {}, o;
|
|
907
|
+
t.forEach((i) => {
|
|
908
|
+
let s = e.parent(i), a, d;
|
|
909
|
+
for (; s; ) {
|
|
910
|
+
if (a = e.parent(s), a ? (d = r[a], r[a] = s) : (d = o, o = s), d && d !== s) {
|
|
911
|
+
n.setEdge(d, s);
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
s = a;
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
function B(e, n = {}) {
|
|
919
|
+
if (typeof n.customOrder == "function") {
|
|
920
|
+
n.customOrder(e, B);
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
let t = X(e), r = sn(e, k(1, t + 1), "inEdges"), o = sn(e, k(t - 1, -1, -1), "outEdges"), i = re(e);
|
|
924
|
+
if (an(e, i), n.disableOptimalOrderHeuristic) return;
|
|
925
|
+
let s = Number.POSITIVE_INFINITY, a, d = n.constraints || [];
|
|
926
|
+
for (let l = 0, u = 0; u < 4; ++l, ++u) {
|
|
927
|
+
kt(l % 2 ? r : o, l % 4 >= 2, d), i = N(e);
|
|
928
|
+
let c = oe(e, i);
|
|
929
|
+
c < s ? (u = 0, a = Object.assign({}, i), s = c) : c === s && (a = structuredClone(i));
|
|
930
|
+
}
|
|
931
|
+
an(e, a);
|
|
932
|
+
}
|
|
933
|
+
function sn(e, n, t) {
|
|
934
|
+
let r = /* @__PURE__ */ new Map(), o = (i, s) => {
|
|
935
|
+
r.has(i) || r.set(i, []), r.get(i).push(s);
|
|
936
|
+
};
|
|
937
|
+
for (let i of e.nodes()) {
|
|
938
|
+
let s = e.node(i);
|
|
939
|
+
if (typeof s.rank == "number" && o(s.rank, i), typeof s.minRank == "number" && typeof s.maxRank == "number") for (let a = s.minRank; a <= s.maxRank; a++) a !== s.rank && o(a, i);
|
|
940
|
+
}
|
|
941
|
+
return n.map(function(i) {
|
|
942
|
+
return de(e, i, t, r.get(i) || []);
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
function kt(e, n, t) {
|
|
946
|
+
let r = new p();
|
|
947
|
+
e.forEach(function(o) {
|
|
948
|
+
t.forEach((a) => r.setEdge(a.left, a.right));
|
|
949
|
+
let i = o.graph().root, s = W(o, i, r, n);
|
|
950
|
+
s.vs.forEach((a, d) => o.node(a).order = d), le(o, r, s.vs);
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
function an(e, n) {
|
|
954
|
+
Object.values(n).forEach((t) => t.forEach((r, o) => e.node(r).order = o));
|
|
955
|
+
}
|
|
956
|
+
function vt(e, n) {
|
|
957
|
+
let t = {};
|
|
958
|
+
function r(o, i) {
|
|
959
|
+
let s = 0, a = 0, d = o.length, l = i[i.length - 1];
|
|
960
|
+
return i.forEach((u, c) => {
|
|
961
|
+
let h2 = xt(e, u), f = h2 ? e.node(h2).order : d;
|
|
962
|
+
(h2 || u === l) && (i.slice(a, c + 1).forEach((g) => {
|
|
963
|
+
let b = e.predecessors(g);
|
|
964
|
+
b && b.forEach((m) => {
|
|
965
|
+
let E = e.node(m), y = E.order;
|
|
966
|
+
(y < s || f < y) && !(E.dummy && e.node(g).dummy) && dn(t, m, g);
|
|
967
|
+
});
|
|
968
|
+
}), a = c + 1, s = f);
|
|
969
|
+
}), i;
|
|
970
|
+
}
|
|
971
|
+
return n.length && n.reduce(r), t;
|
|
972
|
+
}
|
|
973
|
+
function _t(e, n) {
|
|
974
|
+
let t = {};
|
|
975
|
+
function r(i, s, a, d, l) {
|
|
976
|
+
k(s, a).forEach((u) => {
|
|
977
|
+
let c = i[u];
|
|
978
|
+
if (c !== void 0 && e.node(c).dummy) {
|
|
979
|
+
let h2 = e.predecessors(c);
|
|
980
|
+
h2 && h2.forEach((f) => {
|
|
981
|
+
if (f === void 0) return;
|
|
982
|
+
let g = e.node(f);
|
|
983
|
+
g.dummy && (g.order < d || g.order > l) && dn(t, f, c);
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
function o(i, s) {
|
|
989
|
+
let a = -1, d = -1, l = 0;
|
|
990
|
+
return s.forEach((u, c) => {
|
|
991
|
+
if (e.node(u).dummy === "border") {
|
|
992
|
+
let h2 = e.predecessors(u);
|
|
993
|
+
if (h2 && h2.length) {
|
|
994
|
+
let f = h2[0];
|
|
995
|
+
if (f === void 0) return;
|
|
996
|
+
d = e.node(f).order, r(s, l, c, a, d), l = c, a = d;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
r(s, l, s.length, d, i.length);
|
|
1000
|
+
}), s;
|
|
1001
|
+
}
|
|
1002
|
+
return n.length && n.reduce(o), t;
|
|
1003
|
+
}
|
|
1004
|
+
function xt(e, n) {
|
|
1005
|
+
if (e.node(n).dummy) {
|
|
1006
|
+
let t = e.predecessors(n);
|
|
1007
|
+
if (t) return t.find((r) => e.node(r).dummy);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
function dn(e, n, t) {
|
|
1011
|
+
if (n > t) {
|
|
1012
|
+
let o = n;
|
|
1013
|
+
n = t, t = o;
|
|
1014
|
+
}
|
|
1015
|
+
let r = e[n];
|
|
1016
|
+
r || (e[n] = r = {}), r[t] = true;
|
|
1017
|
+
}
|
|
1018
|
+
function Tt(e, n, t) {
|
|
1019
|
+
if (n > t) {
|
|
1020
|
+
let o = n;
|
|
1021
|
+
n = t, t = o;
|
|
1022
|
+
}
|
|
1023
|
+
let r = e[n];
|
|
1024
|
+
return r !== void 0 && Object.hasOwn(r, t);
|
|
1025
|
+
}
|
|
1026
|
+
function Ot(e, n, t, r) {
|
|
1027
|
+
let o = {}, i = {}, s = {};
|
|
1028
|
+
return n.forEach((a) => {
|
|
1029
|
+
a.forEach((d, l) => {
|
|
1030
|
+
o[d] = d, i[d] = d, s[d] = l;
|
|
1031
|
+
});
|
|
1032
|
+
}), n.forEach((a) => {
|
|
1033
|
+
let d = -1;
|
|
1034
|
+
a.forEach((l) => {
|
|
1035
|
+
let u = r(l);
|
|
1036
|
+
if (u && u.length) {
|
|
1037
|
+
let c = u.sort((f, g) => {
|
|
1038
|
+
let b = s[f], m = s[g];
|
|
1039
|
+
return (b !== void 0 ? b : 0) - (m !== void 0 ? m : 0);
|
|
1040
|
+
}), h2 = (c.length - 1) / 2;
|
|
1041
|
+
for (let f = Math.floor(h2), g = Math.ceil(h2); f <= g; ++f) {
|
|
1042
|
+
let b = c[f];
|
|
1043
|
+
if (b === void 0) continue;
|
|
1044
|
+
let m = s[b];
|
|
1045
|
+
if (m !== void 0 && i[l] === l && d < m && !Tt(t, l, b)) {
|
|
1046
|
+
let E = o[b];
|
|
1047
|
+
E !== void 0 && (i[b] = l, i[l] = o[l] = E, d = m);
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
}), { root: o, align: i };
|
|
1053
|
+
}
|
|
1054
|
+
function It(e, n, t, r, o = false) {
|
|
1055
|
+
let i = {}, s = Ct(e, n, t, o), a = o ? "borderLeft" : "borderRight";
|
|
1056
|
+
function d(f, g) {
|
|
1057
|
+
let b = s.nodes().slice(), m = {}, E = b.pop();
|
|
1058
|
+
for (; E; ) {
|
|
1059
|
+
if (m[E]) f(E);
|
|
1060
|
+
else {
|
|
1061
|
+
m[E] = true, b.push(E);
|
|
1062
|
+
for (let y of g(E)) b.push(y);
|
|
1063
|
+
}
|
|
1064
|
+
E = b.pop();
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
function l(f) {
|
|
1068
|
+
let g = s.inEdges(f);
|
|
1069
|
+
g ? i[f] = g.reduce((b, m) => {
|
|
1070
|
+
var I;
|
|
1071
|
+
let E = (I = i[m.v]) != null ? I : 0, y = s.edge(m);
|
|
1072
|
+
return Math.max(b, E + (y !== void 0 ? y : 0));
|
|
1073
|
+
}, 0) : i[f] = 0;
|
|
1074
|
+
}
|
|
1075
|
+
function u(f) {
|
|
1076
|
+
let g = s.outEdges(f), b = Number.POSITIVE_INFINITY;
|
|
1077
|
+
g && (b = g.reduce((E, y) => {
|
|
1078
|
+
let I = i[y.w], be = s.edge(y);
|
|
1079
|
+
return Math.min(E, (I !== void 0 ? I : 0) - (be !== void 0 ? be : 0));
|
|
1080
|
+
}, Number.POSITIVE_INFINITY));
|
|
1081
|
+
let m = e.node(f);
|
|
1082
|
+
b !== Number.POSITIVE_INFINITY && m.borderType !== a && (i[f] = Math.max(i[f] !== void 0 ? i[f] : 0, b));
|
|
1083
|
+
}
|
|
1084
|
+
function c(f) {
|
|
1085
|
+
return s.predecessors(f) || [];
|
|
1086
|
+
}
|
|
1087
|
+
function h2(f) {
|
|
1088
|
+
return s.successors(f) || [];
|
|
1089
|
+
}
|
|
1090
|
+
return d(l, c), d(u, h2), Object.keys(r).forEach((f) => {
|
|
1091
|
+
var b;
|
|
1092
|
+
let g = t[f];
|
|
1093
|
+
g !== void 0 && (i[f] = (b = i[g]) != null ? b : 0);
|
|
1094
|
+
}), i;
|
|
1095
|
+
}
|
|
1096
|
+
function Ct(e, n, t, r) {
|
|
1097
|
+
let o = new p(), i = e.graph(), s = jt(i.nodesep, i.edgesep, r);
|
|
1098
|
+
return n.forEach((a) => {
|
|
1099
|
+
let d;
|
|
1100
|
+
a.forEach((l) => {
|
|
1101
|
+
let u = t[l];
|
|
1102
|
+
if (u !== void 0) {
|
|
1103
|
+
if (o.setNode(u), d !== void 0) {
|
|
1104
|
+
let c = t[d];
|
|
1105
|
+
if (c !== void 0) {
|
|
1106
|
+
let h2 = o.edge(c, u);
|
|
1107
|
+
o.setEdge(c, u, Math.max(s(e, l, d), h2 || 0));
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
d = l;
|
|
1111
|
+
}
|
|
1112
|
+
});
|
|
1113
|
+
}), o;
|
|
1114
|
+
}
|
|
1115
|
+
function Rt(e, n) {
|
|
1116
|
+
return Object.values(n).reduce((t, r) => {
|
|
1117
|
+
let o = Number.NEGATIVE_INFINITY, i = Number.POSITIVE_INFINITY;
|
|
1118
|
+
Object.entries(r).forEach(([a, d]) => {
|
|
1119
|
+
let l = St(e, a) / 2;
|
|
1120
|
+
o = Math.max(d + l, o), i = Math.min(d - l, i);
|
|
1121
|
+
});
|
|
1122
|
+
let s = o - i;
|
|
1123
|
+
return s < t[0] && (t = [s, r]), t;
|
|
1124
|
+
}, [Number.POSITIVE_INFINITY, null])[1];
|
|
1125
|
+
}
|
|
1126
|
+
function Pt(e, n) {
|
|
1127
|
+
let t = Object.values(n), r = L(Math.min, t), o = L(Math.max, t);
|
|
1128
|
+
["u", "d"].forEach((i) => {
|
|
1129
|
+
["l", "r"].forEach((s) => {
|
|
1130
|
+
let a = i + s, d = e[a];
|
|
1131
|
+
if (!d || d === n) return;
|
|
1132
|
+
let l = Object.values(d), u = r - L(Math.min, l);
|
|
1133
|
+
s !== "l" && (u = o - L(Math.max, l)), u && (e[a] = O(d, (c) => c + u));
|
|
1134
|
+
});
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
function Mt(e, n = void 0) {
|
|
1138
|
+
let t = e.ul;
|
|
1139
|
+
return t ? O(t, (r, o) => {
|
|
1140
|
+
var s, a;
|
|
1141
|
+
if (n) {
|
|
1142
|
+
let d = n.toLowerCase(), l = e[d];
|
|
1143
|
+
if (l && l[o] !== void 0) return l[o];
|
|
1144
|
+
}
|
|
1145
|
+
let i = Object.values(e).map((d) => {
|
|
1146
|
+
let l = d[o];
|
|
1147
|
+
return l !== void 0 ? l : 0;
|
|
1148
|
+
}).sort((d, l) => d - l);
|
|
1149
|
+
return (((s = i[1]) != null ? s : 0) + ((a = i[2]) != null ? a : 0)) / 2;
|
|
1150
|
+
}) : {};
|
|
1151
|
+
}
|
|
1152
|
+
function ln(e) {
|
|
1153
|
+
let n = N(e), t = Object.assign(vt(e, n), _t(e, n)), r = {}, o;
|
|
1154
|
+
["u", "d"].forEach((s) => {
|
|
1155
|
+
o = s === "u" ? n : Object.values(n).reverse(), ["l", "r"].forEach((a) => {
|
|
1156
|
+
a === "r" && (o = o.map((c) => Object.values(c).reverse()));
|
|
1157
|
+
let l = Ot(e, o, t, (c) => (s === "u" ? e.predecessors(c) : e.successors(c)) || []), u = It(e, o, l.root, l.align, a === "r");
|
|
1158
|
+
a === "r" && (u = O(u, (c) => -c)), r[s + a] = u;
|
|
1159
|
+
});
|
|
1160
|
+
});
|
|
1161
|
+
let i = Rt(e, r);
|
|
1162
|
+
return Pt(r, i), Mt(r, e.graph().align);
|
|
1163
|
+
}
|
|
1164
|
+
function jt(e, n, t) {
|
|
1165
|
+
return (r, o, i) => {
|
|
1166
|
+
let s = r.node(o), a = r.node(i), d = 0, l;
|
|
1167
|
+
if (d += s.width / 2, Object.hasOwn(s, "labelpos")) switch (s.labelpos.toLowerCase()) {
|
|
1168
|
+
case "l":
|
|
1169
|
+
l = -s.width / 2;
|
|
1170
|
+
break;
|
|
1171
|
+
case "r":
|
|
1172
|
+
l = s.width / 2;
|
|
1173
|
+
break;
|
|
1174
|
+
}
|
|
1175
|
+
if (l && (d += t ? l : -l), l = void 0, d += (s.dummy ? n : e) / 2, d += (a.dummy ? n : e) / 2, d += a.width / 2, Object.hasOwn(a, "labelpos")) switch (a.labelpos.toLowerCase()) {
|
|
1176
|
+
case "l":
|
|
1177
|
+
l = a.width / 2;
|
|
1178
|
+
break;
|
|
1179
|
+
case "r":
|
|
1180
|
+
l = -a.width / 2;
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
1183
|
+
return l && (d += t ? l : -l), d;
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
function St(e, n) {
|
|
1187
|
+
return e.node(n).width;
|
|
1188
|
+
}
|
|
1189
|
+
function un(e) {
|
|
1190
|
+
e = A(e), Ft(e), Object.entries(ln(e)).forEach(([n, t]) => e.node(n).x = t);
|
|
1191
|
+
}
|
|
1192
|
+
function Ft(e) {
|
|
1193
|
+
let n = N(e), t = e.graph(), r = t.ranksep, o = t.rankalign, i = 0;
|
|
1194
|
+
n.forEach((s) => {
|
|
1195
|
+
let a = s.reduce((d, l) => {
|
|
1196
|
+
var c;
|
|
1197
|
+
let u = (c = e.node(l).height) != null ? c : 0;
|
|
1198
|
+
return d > u ? d : u;
|
|
1199
|
+
}, 0);
|
|
1200
|
+
s.forEach((d) => {
|
|
1201
|
+
let l = e.node(d);
|
|
1202
|
+
o === "top" ? l.y = i + l.height / 2 : o === "bottom" ? l.y = i + a - l.height / 2 : l.y = i + a / 2;
|
|
1203
|
+
}), i += a + r;
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
function he(e, n = {}) {
|
|
1207
|
+
let t = n.debugTiming ? P : M;
|
|
1208
|
+
return t("layout", () => {
|
|
1209
|
+
let r = t(" buildLayoutGraph", () => Xt(e));
|
|
1210
|
+
return t(" runLayout", () => Dt(r, t, n)), t(" updateInputGraph", () => At(e, r)), r;
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
function Dt(e, n, t) {
|
|
1214
|
+
n(" makeSpaceForEdgeLabels", () => Ut(e)), n(" removeSelfEdges", () => rr(e)), n(" acyclic", () => je(e)), n(" nestingGraph.run", () => Ke(e)), n(" rank", () => Xe(A(e))), n(" injectEdgeLabelProxies", () => Kt(e)), n(" removeEmptyRanks", () => Oe(e)), n(" nestingGraph.cleanup", () => Je(e)), n(" normalizeRanks", () => Te(e)), n(" assignRankMinMax", () => $t(e)), n(" removeEdgeLabelProxies", () => Jt(e)), n(" normalize.run", () => Fe(e)), n(" parentDummyChains", () => Ue(e)), n(" addBorderSegments", () => Ze(e)), n(" order", () => B(e, t)), n(" insertSelfEdges", () => or(e)), n(" adjustCoordinateSystem", () => nn(e)), n(" position", () => un(e)), n(" positionSelfEdges", () => ir(e)), n(" removeBorderNodes", () => tr(e)), n(" normalize.undo", () => De(e)), n(" fixupEdgeLabelCoords", () => er(e)), n(" undoCoordinateSystem", () => tn(e)), n(" translateGraph", () => Qt(e)), n(" assignNodeIntersects", () => Zt(e)), n(" reversePoints", () => nr(e)), n(" acyclic.undo", () => Se(e));
|
|
1215
|
+
}
|
|
1216
|
+
function At(e, n) {
|
|
1217
|
+
e.nodes().forEach((t) => {
|
|
1218
|
+
let r = e.node(t), o = n.node(t);
|
|
1219
|
+
r && (r.x = o.x, r.y = o.y, r.order = o.order, r.rank = o.rank, n.children(t).length && (r.width = o.width, r.height = o.height));
|
|
1220
|
+
}), e.edges().forEach((t) => {
|
|
1221
|
+
let r = e.edge(t), o = n.edge(t);
|
|
1222
|
+
r.points = o.points, Object.hasOwn(o, "x") && (r.x = o.x, r.y = o.y);
|
|
1223
|
+
}), e.graph().width = n.graph().width, e.graph().height = n.graph().height;
|
|
1224
|
+
}
|
|
1225
|
+
function Xt(e) {
|
|
1226
|
+
let n = new p({ multigraph: true, compound: true }), t = ce(e.graph());
|
|
1227
|
+
return n.setGraph(Object.assign({}, Wt, ue(t, Vt), T(t, Bt))), e.nodes().forEach((r) => {
|
|
1228
|
+
let o = ce(e.node(r)), i = ue(o, Yt);
|
|
1229
|
+
Object.keys(cn).forEach((a) => {
|
|
1230
|
+
i[a] === void 0 && (i[a] = cn[a]);
|
|
1231
|
+
}), n.setNode(r, i);
|
|
1232
|
+
let s = e.parent(r);
|
|
1233
|
+
s !== void 0 && n.setParent(r, s);
|
|
1234
|
+
}), e.edges().forEach((r) => {
|
|
1235
|
+
let o = ce(e.edge(r));
|
|
1236
|
+
n.setEdge(r, Object.assign({}, Ht, ue(o, zt), T(o, qt)));
|
|
1237
|
+
}), n;
|
|
1238
|
+
}
|
|
1239
|
+
function Ut(e) {
|
|
1240
|
+
let n = e.graph();
|
|
1241
|
+
n.ranksep /= 2, e.edges().forEach((t) => {
|
|
1242
|
+
let r = e.edge(t);
|
|
1243
|
+
r.minlen *= 2, r.labelpos.toLowerCase() !== "c" && (n.rankdir === "TB" || n.rankdir === "BT" ? r.width += r.labeloffset : r.height += r.labeloffset);
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
function Kt(e) {
|
|
1247
|
+
e.edges().forEach((n) => {
|
|
1248
|
+
let t = e.edge(n);
|
|
1249
|
+
if (t.width && t.height) {
|
|
1250
|
+
let r = e.node(n.v), i = { rank: (e.node(n.w).rank - r.rank) / 2 + r.rank, e: n };
|
|
1251
|
+
w2(e, "edge-proxy", i, "_ep");
|
|
1252
|
+
}
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
function $t(e) {
|
|
1256
|
+
let n = 0;
|
|
1257
|
+
e.nodes().forEach((t) => {
|
|
1258
|
+
let r = e.node(t);
|
|
1259
|
+
r.borderTop && (r.minRank = e.node(r.borderTop).rank, r.maxRank = e.node(r.borderBottom).rank, n = Math.max(n, r.maxRank));
|
|
1260
|
+
}), e.graph().maxRank = n;
|
|
1261
|
+
}
|
|
1262
|
+
function Jt(e) {
|
|
1263
|
+
e.nodes().forEach((n) => {
|
|
1264
|
+
let t = e.node(n);
|
|
1265
|
+
if (t.dummy === "edge-proxy") {
|
|
1266
|
+
let r = t;
|
|
1267
|
+
e.edge(r.e).labelRank = t.rank, e.removeNode(n);
|
|
1268
|
+
}
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
function Qt(e) {
|
|
1272
|
+
let n = Number.POSITIVE_INFINITY, t = 0, r = Number.POSITIVE_INFINITY, o = 0, i = e.graph(), s = i.marginx || 0, a = i.marginy || 0;
|
|
1273
|
+
function d(l) {
|
|
1274
|
+
let u = l.x, c = l.y, h2 = l.width, f = l.height;
|
|
1275
|
+
n = Math.min(n, u - h2 / 2), t = Math.max(t, u + h2 / 2), r = Math.min(r, c - f / 2), o = Math.max(o, c + f / 2);
|
|
1276
|
+
}
|
|
1277
|
+
e.nodes().forEach((l) => d(e.node(l))), e.edges().forEach((l) => {
|
|
1278
|
+
let u = e.edge(l);
|
|
1279
|
+
Object.hasOwn(u, "x") && d(u);
|
|
1280
|
+
}), n -= s, r -= a, e.nodes().forEach((l) => {
|
|
1281
|
+
let u = e.node(l);
|
|
1282
|
+
u.x -= n, u.y -= r;
|
|
1283
|
+
}), e.edges().forEach((l) => {
|
|
1284
|
+
let u = e.edge(l);
|
|
1285
|
+
u.points.forEach((c) => {
|
|
1286
|
+
c.x -= n, c.y -= r;
|
|
1287
|
+
}), Object.hasOwn(u, "x") && (u.x -= n), Object.hasOwn(u, "y") && (u.y -= r);
|
|
1288
|
+
}), i.width = t - n + s, i.height = o - r + a;
|
|
1289
|
+
}
|
|
1290
|
+
function Zt(e) {
|
|
1291
|
+
e.edges().forEach((n) => {
|
|
1292
|
+
let t = e.edge(n), r = e.node(n.v), o = e.node(n.w), i, s;
|
|
1293
|
+
t.points ? (i = t.points[0], s = t.points[t.points.length - 1]) : (t.points = [], i = o, s = r), t.points.unshift(H(r, i)), t.points.push(H(o, s));
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
function er(e) {
|
|
1297
|
+
e.edges().forEach((n) => {
|
|
1298
|
+
let t = e.edge(n);
|
|
1299
|
+
if (Object.hasOwn(t, "x")) switch ((t.labelpos === "l" || t.labelpos === "r") && (t.width -= t.labeloffset), t.labelpos) {
|
|
1300
|
+
case "l":
|
|
1301
|
+
t.x -= t.width / 2 + t.labeloffset;
|
|
1302
|
+
break;
|
|
1303
|
+
case "r":
|
|
1304
|
+
t.x += t.width / 2 + t.labeloffset;
|
|
1305
|
+
break;
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
function nr(e) {
|
|
1310
|
+
e.edges().forEach((n) => {
|
|
1311
|
+
let t = e.edge(n);
|
|
1312
|
+
t.reversed && t.points.reverse();
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
function tr(e) {
|
|
1316
|
+
e.nodes().forEach((n) => {
|
|
1317
|
+
if (e.children(n).length) {
|
|
1318
|
+
let t = e.node(n), r = e.node(t.borderTop), o = e.node(t.borderBottom), i = e.node(t.borderLeft[t.borderLeft.length - 1]), s = e.node(t.borderRight[t.borderRight.length - 1]);
|
|
1319
|
+
t.width = Math.abs(s.x - i.x), t.height = Math.abs(o.y - r.y), t.x = i.x + t.width / 2, t.y = r.y + t.height / 2;
|
|
1320
|
+
}
|
|
1321
|
+
}), e.nodes().forEach((n) => {
|
|
1322
|
+
e.node(n).dummy === "border" && e.removeNode(n);
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
function rr(e) {
|
|
1326
|
+
e.edges().forEach((n) => {
|
|
1327
|
+
if (n.v === n.w) {
|
|
1328
|
+
let t = e.node(n.v);
|
|
1329
|
+
t.selfEdges || (t.selfEdges = []), t.selfEdges.push({ e: n, label: e.edge(n) }), e.removeEdge(n);
|
|
1330
|
+
}
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
function or(e) {
|
|
1334
|
+
N(e).forEach((t) => {
|
|
1335
|
+
let r = 0;
|
|
1336
|
+
t.forEach((o, i) => {
|
|
1337
|
+
let s = e.node(o);
|
|
1338
|
+
s.order = i + r, (s.selfEdges || []).forEach((a) => {
|
|
1339
|
+
w2(e, "selfedge", { width: a.label.width, height: a.label.height, rank: s.rank, order: i + ++r, e: a.e, label: a.label }, "_se");
|
|
1340
|
+
}), delete s.selfEdges;
|
|
1341
|
+
});
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
function ir(e) {
|
|
1345
|
+
e.nodes().forEach((n) => {
|
|
1346
|
+
let t = e.node(n);
|
|
1347
|
+
if (t.dummy === "selfedge") {
|
|
1348
|
+
let r = t, o = e.node(r.e.v), i = o.x + o.width / 2, s = o.y, a = t.x - i, d = o.height / 2;
|
|
1349
|
+
e.setEdge(r.e, r.label), e.removeNode(n), r.label.points = [{ x: i + 2 * a / 3, y: s - d }, { x: i + 5 * a / 6, y: s - d }, { x: i + a, y: s }, { x: i + 5 * a / 6, y: s + d }, { x: i + 2 * a / 3, y: s + d }], r.label.x = t.x, r.label.y = t.y;
|
|
1350
|
+
}
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
function ue(e, n) {
|
|
1354
|
+
return O(T(e, n), Number);
|
|
1355
|
+
}
|
|
1356
|
+
function ce(e) {
|
|
1357
|
+
let n = {};
|
|
1358
|
+
return e && Object.entries(e).forEach(([t, r]) => {
|
|
1359
|
+
typeof t == "string" && (t = t.toLowerCase()), n[t] = r;
|
|
1360
|
+
}), n;
|
|
1361
|
+
}
|
|
1362
|
+
function fe(e) {
|
|
1363
|
+
let n = N(e), t = new p({ compound: true, multigraph: true }).setGraph({});
|
|
1364
|
+
return e.nodes().forEach((r) => {
|
|
1365
|
+
t.setNode(r, { label: r }), t.setParent(r, "layer" + e.node(r).rank);
|
|
1366
|
+
}), e.edges().forEach((r) => t.setEdge(r.v, r.w, {}, r.name)), n.forEach((r, o) => {
|
|
1367
|
+
let i = "layer" + o;
|
|
1368
|
+
t.setNode(i, { rank: "same" }), r.reduce((s, a) => (t.setEdge(s, a, { style: "invis" }), a));
|
|
1369
|
+
}), t;
|
|
1370
|
+
}
|
|
1371
|
+
var ge, hn, fn, pe, z, bn, Le, p, pn, ye, R, wn, Ne, kn, Tn, D, Ie, An, _, U, K, Me, Wn, V, Zn, et, Ve, Xe, it, Ue, Ze, Vt, Wt, Bt, Yt, cn, zt, Ht, qt, sr, To;
|
|
1372
|
+
var init_dagre_esm = __esm({
|
|
1373
|
+
"node_modules/@dagrejs/dagre/dist/dagre.esm.js"() {
|
|
1374
|
+
ge = Object.defineProperty;
|
|
1375
|
+
hn = (e, n, t) => n in e ? ge(e, n, { enumerable: true, configurable: true, writable: true, value: t }) : e[n] = t;
|
|
1376
|
+
fn = (e, n) => {
|
|
1377
|
+
for (var t in n) ge(e, t, { get: n[t], enumerable: true });
|
|
1378
|
+
};
|
|
1379
|
+
pe = (e, n, t) => hn(e, typeof n != "symbol" ? n + "" : n, t);
|
|
1380
|
+
z = {};
|
|
1381
|
+
fn(z, { Graph: () => p, alg: () => R, json: () => ye, version: () => pn });
|
|
1382
|
+
bn = Object.defineProperty;
|
|
1383
|
+
Le = (e, n) => {
|
|
1384
|
+
for (var t in n) bn(e, t, { get: n[t], enumerable: true });
|
|
1385
|
+
};
|
|
1386
|
+
p = class {
|
|
1387
|
+
constructor(e) {
|
|
1388
|
+
this._isDirected = true, this._isMultigraph = false, this._isCompound = false, this._nodes = {}, this._in = {}, this._preds = {}, this._out = {}, this._sucs = {}, this._edgeObjs = {}, this._edgeLabels = {}, this._nodeCount = 0, this._edgeCount = 0, this._defaultNodeLabelFn = () => {
|
|
1389
|
+
}, this._defaultEdgeLabelFn = () => {
|
|
1390
|
+
}, e && (this._isDirected = "directed" in e ? e.directed : true, this._isMultigraph = "multigraph" in e ? e.multigraph : false, this._isCompound = "compound" in e ? e.compound : false), this._isCompound && (this._parent = {}, this._children = {}, this._children["\0"] = {});
|
|
1391
|
+
}
|
|
1392
|
+
isDirected() {
|
|
1393
|
+
return this._isDirected;
|
|
1394
|
+
}
|
|
1395
|
+
isMultigraph() {
|
|
1396
|
+
return this._isMultigraph;
|
|
1397
|
+
}
|
|
1398
|
+
isCompound() {
|
|
1399
|
+
return this._isCompound;
|
|
1400
|
+
}
|
|
1401
|
+
setGraph(e) {
|
|
1402
|
+
return this._label = e, this;
|
|
1403
|
+
}
|
|
1404
|
+
graph() {
|
|
1405
|
+
return this._label;
|
|
1406
|
+
}
|
|
1407
|
+
setDefaultNodeLabel(e) {
|
|
1408
|
+
return typeof e != "function" ? this._defaultNodeLabelFn = () => e : this._defaultNodeLabelFn = e, this;
|
|
1409
|
+
}
|
|
1410
|
+
nodeCount() {
|
|
1411
|
+
return this._nodeCount;
|
|
1412
|
+
}
|
|
1413
|
+
nodes() {
|
|
1414
|
+
return Object.keys(this._nodes);
|
|
1415
|
+
}
|
|
1416
|
+
sources() {
|
|
1417
|
+
return this.nodes().filter((e) => Object.keys(this._in[e]).length === 0);
|
|
1418
|
+
}
|
|
1419
|
+
sinks() {
|
|
1420
|
+
return this.nodes().filter((e) => Object.keys(this._out[e]).length === 0);
|
|
1421
|
+
}
|
|
1422
|
+
setNodes(e, n) {
|
|
1423
|
+
return e.forEach((t) => {
|
|
1424
|
+
n !== void 0 ? this.setNode(t, n) : this.setNode(t);
|
|
1425
|
+
}), this;
|
|
1426
|
+
}
|
|
1427
|
+
setNode(e, n) {
|
|
1428
|
+
return e in this._nodes ? (arguments.length > 1 && (this._nodes[e] = n), this) : (this._nodes[e] = arguments.length > 1 ? n : this._defaultNodeLabelFn(e), this._isCompound && (this._parent[e] = "\0", this._children[e] = {}, this._children["\0"][e] = true), this._in[e] = {}, this._preds[e] = {}, this._out[e] = {}, this._sucs[e] = {}, ++this._nodeCount, this);
|
|
1429
|
+
}
|
|
1430
|
+
node(e) {
|
|
1431
|
+
return this._nodes[e];
|
|
1432
|
+
}
|
|
1433
|
+
hasNode(e) {
|
|
1434
|
+
return e in this._nodes;
|
|
1435
|
+
}
|
|
1436
|
+
removeNode(e) {
|
|
1437
|
+
if (e in this._nodes) {
|
|
1438
|
+
let n = (t) => this.removeEdge(this._edgeObjs[t]);
|
|
1439
|
+
delete this._nodes[e], this._isCompound && (this._removeFromParentsChildList(e), delete this._parent[e], this.children(e).forEach((t) => {
|
|
1440
|
+
this.setParent(t);
|
|
1441
|
+
}), delete this._children[e]), Object.keys(this._in[e]).forEach(n), delete this._in[e], delete this._preds[e], Object.keys(this._out[e]).forEach(n), delete this._out[e], delete this._sucs[e], --this._nodeCount;
|
|
1442
|
+
}
|
|
1443
|
+
return this;
|
|
1444
|
+
}
|
|
1445
|
+
setParent(e, n) {
|
|
1446
|
+
if (!this._isCompound) throw new Error("Cannot set parent in a non-compound graph");
|
|
1447
|
+
if (n === void 0) n = "\0";
|
|
1448
|
+
else {
|
|
1449
|
+
n += "";
|
|
1450
|
+
for (let t = n; t !== void 0; t = this.parent(t)) if (t === e) throw new Error("Setting " + n + " as parent of " + e + " would create a cycle");
|
|
1451
|
+
this.setNode(n);
|
|
1452
|
+
}
|
|
1453
|
+
return this.setNode(e), this._removeFromParentsChildList(e), this._parent[e] = n, this._children[n][e] = true, this;
|
|
1454
|
+
}
|
|
1455
|
+
parent(e) {
|
|
1456
|
+
if (this._isCompound) {
|
|
1457
|
+
let n = this._parent[e];
|
|
1458
|
+
if (n !== "\0") return n;
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
children(e = "\0") {
|
|
1462
|
+
if (this._isCompound) {
|
|
1463
|
+
let n = this._children[e];
|
|
1464
|
+
if (n) return Object.keys(n);
|
|
1465
|
+
} else {
|
|
1466
|
+
if (e === "\0") return this.nodes();
|
|
1467
|
+
if (this.hasNode(e)) return [];
|
|
1468
|
+
}
|
|
1469
|
+
return [];
|
|
1470
|
+
}
|
|
1471
|
+
predecessors(e) {
|
|
1472
|
+
let n = this._preds[e];
|
|
1473
|
+
if (n) return Object.keys(n);
|
|
1474
|
+
}
|
|
1475
|
+
successors(e) {
|
|
1476
|
+
let n = this._sucs[e];
|
|
1477
|
+
if (n) return Object.keys(n);
|
|
1478
|
+
}
|
|
1479
|
+
neighbors(e) {
|
|
1480
|
+
let n = this.predecessors(e);
|
|
1481
|
+
if (n) {
|
|
1482
|
+
let t = new Set(n);
|
|
1483
|
+
for (let r of this.successors(e)) t.add(r);
|
|
1484
|
+
return Array.from(t.values());
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
isLeaf(e) {
|
|
1488
|
+
let n;
|
|
1489
|
+
return this.isDirected() ? n = this.successors(e) : n = this.neighbors(e), n.length === 0;
|
|
1490
|
+
}
|
|
1491
|
+
filterNodes(e) {
|
|
1492
|
+
let n = new this.constructor({ directed: this._isDirected, multigraph: this._isMultigraph, compound: this._isCompound });
|
|
1493
|
+
n.setGraph(this.graph()), Object.entries(this._nodes).forEach(([o, i]) => {
|
|
1494
|
+
e(o) && n.setNode(o, i);
|
|
1495
|
+
}), Object.values(this._edgeObjs).forEach((o) => {
|
|
1496
|
+
n.hasNode(o.v) && n.hasNode(o.w) && n.setEdge(o, this.edge(o));
|
|
1497
|
+
});
|
|
1498
|
+
let t = {}, r = (o) => {
|
|
1499
|
+
let i = this.parent(o);
|
|
1500
|
+
return !i || n.hasNode(i) ? (t[o] = i != null ? i : void 0, i != null ? i : void 0) : i in t ? t[i] : r(i);
|
|
1501
|
+
};
|
|
1502
|
+
return this._isCompound && n.nodes().forEach((o) => n.setParent(o, r(o))), n;
|
|
1503
|
+
}
|
|
1504
|
+
setDefaultEdgeLabel(e) {
|
|
1505
|
+
return typeof e != "function" ? this._defaultEdgeLabelFn = () => e : this._defaultEdgeLabelFn = e, this;
|
|
1506
|
+
}
|
|
1507
|
+
edgeCount() {
|
|
1508
|
+
return this._edgeCount;
|
|
1509
|
+
}
|
|
1510
|
+
edges() {
|
|
1511
|
+
return Object.values(this._edgeObjs);
|
|
1512
|
+
}
|
|
1513
|
+
setPath(e, n) {
|
|
1514
|
+
return e.reduce((t, r) => (n !== void 0 ? this.setEdge(t, r, n) : this.setEdge(t, r), r)), this;
|
|
1515
|
+
}
|
|
1516
|
+
setEdge(e, n, t, r) {
|
|
1517
|
+
let o, i, s, a, d = false;
|
|
1518
|
+
typeof e == "object" && e !== null && "v" in e ? (o = e.v, i = e.w, s = e.name, arguments.length === 2 && (a = n, d = true)) : (o = e, i = n, s = r, arguments.length > 2 && (a = t, d = true)), o = "" + o, i = "" + i, s !== void 0 && (s = "" + s);
|
|
1519
|
+
let l = C(this._isDirected, o, i, s);
|
|
1520
|
+
if (l in this._edgeLabels) return d && (this._edgeLabels[l] = a), this;
|
|
1521
|
+
if (s !== void 0 && !this._isMultigraph) throw new Error("Cannot set a named edge when isMultigraph = false");
|
|
1522
|
+
this.setNode(o), this.setNode(i), this._edgeLabels[l] = d ? a : this._defaultEdgeLabelFn(o, i, s);
|
|
1523
|
+
let u = gn(this._isDirected, o, i, s);
|
|
1524
|
+
return o = u.v, i = u.w, Object.freeze(u), this._edgeObjs[l] = u, me(this._preds[i], o), me(this._sucs[o], i), this._in[i][l] = u, this._out[o][l] = u, this._edgeCount++, this;
|
|
1525
|
+
}
|
|
1526
|
+
edge(e, n, t) {
|
|
1527
|
+
let r = arguments.length === 1 ? Y(this._isDirected, e) : C(this._isDirected, e, n, t);
|
|
1528
|
+
return this._edgeLabels[r];
|
|
1529
|
+
}
|
|
1530
|
+
edgeAsObj(e, n, t) {
|
|
1531
|
+
let r = arguments.length === 1 ? this.edge(e) : this.edge(e, n, t);
|
|
1532
|
+
return typeof r != "object" ? { label: r } : r;
|
|
1533
|
+
}
|
|
1534
|
+
hasEdge(e, n, t) {
|
|
1535
|
+
return (arguments.length === 1 ? Y(this._isDirected, e) : C(this._isDirected, e, n, t)) in this._edgeLabels;
|
|
1536
|
+
}
|
|
1537
|
+
removeEdge(e, n, t) {
|
|
1538
|
+
let r = arguments.length === 1 ? Y(this._isDirected, e) : C(this._isDirected, e, n, t), o = this._edgeObjs[r];
|
|
1539
|
+
if (o) {
|
|
1540
|
+
let i = o.v, s = o.w;
|
|
1541
|
+
delete this._edgeLabels[r], delete this._edgeObjs[r], Ee(this._preds[s], i), Ee(this._sucs[i], s), delete this._in[s][r], delete this._out[i][r], this._edgeCount--;
|
|
1542
|
+
}
|
|
1543
|
+
return this;
|
|
1544
|
+
}
|
|
1545
|
+
inEdges(e, n) {
|
|
1546
|
+
return this.isDirected() ? this.filterEdges(this._in[e], e, n) : this.nodeEdges(e, n);
|
|
1547
|
+
}
|
|
1548
|
+
outEdges(e, n) {
|
|
1549
|
+
return this.isDirected() ? this.filterEdges(this._out[e], e, n) : this.nodeEdges(e, n);
|
|
1550
|
+
}
|
|
1551
|
+
nodeEdges(e, n) {
|
|
1552
|
+
if (e in this._nodes) return this.filterEdges({ ...this._in[e], ...this._out[e] }, e, n);
|
|
1553
|
+
}
|
|
1554
|
+
_removeFromParentsChildList(e) {
|
|
1555
|
+
delete this._children[this._parent[e]][e];
|
|
1556
|
+
}
|
|
1557
|
+
filterEdges(e, n, t) {
|
|
1558
|
+
if (!e) return;
|
|
1559
|
+
let r = Object.values(e);
|
|
1560
|
+
return t ? r.filter((o) => o.v === n && o.w === t || o.v === t && o.w === n) : r;
|
|
1561
|
+
}
|
|
1562
|
+
};
|
|
1563
|
+
pn = "4.0.1";
|
|
1564
|
+
ye = {};
|
|
1565
|
+
Le(ye, { read: () => yn, write: () => mn });
|
|
1566
|
+
R = {};
|
|
1567
|
+
Le(R, { CycleException: () => D, bellmanFord: () => we, components: () => Gn, dijkstra: () => F, dijkstraAll: () => _n, findCycles: () => xn, floydWarshall: () => On, isAcyclic: () => Cn, postorder: () => Pn, preorder: () => Mn, prim: () => jn, shortestPaths: () => Sn, tarjan: () => Ge, topsort: () => ke });
|
|
1568
|
+
wn = () => 1;
|
|
1569
|
+
Ne = class {
|
|
1570
|
+
constructor() {
|
|
1571
|
+
this._arr = [], this._keyIndices = {};
|
|
1572
|
+
}
|
|
1573
|
+
size() {
|
|
1574
|
+
return this._arr.length;
|
|
1575
|
+
}
|
|
1576
|
+
keys() {
|
|
1577
|
+
return this._arr.map((e) => e.key);
|
|
1578
|
+
}
|
|
1579
|
+
has(e) {
|
|
1580
|
+
return e in this._keyIndices;
|
|
1581
|
+
}
|
|
1582
|
+
priority(e) {
|
|
1583
|
+
let n = this._keyIndices[e];
|
|
1584
|
+
if (n !== void 0) return this._arr[n].priority;
|
|
1585
|
+
}
|
|
1586
|
+
min() {
|
|
1587
|
+
if (this.size() === 0) throw new Error("Queue underflow");
|
|
1588
|
+
return this._arr[0].key;
|
|
1589
|
+
}
|
|
1590
|
+
add(e, n) {
|
|
1591
|
+
let t = this._keyIndices, r = String(e);
|
|
1592
|
+
if (!(r in t)) {
|
|
1593
|
+
let o = this._arr, i = o.length;
|
|
1594
|
+
return t[r] = i, o.push({ key: r, priority: n }), this._decrease(i), true;
|
|
1595
|
+
}
|
|
1596
|
+
return false;
|
|
1597
|
+
}
|
|
1598
|
+
removeMin() {
|
|
1599
|
+
this._swap(0, this._arr.length - 1);
|
|
1600
|
+
let e = this._arr.pop();
|
|
1601
|
+
return delete this._keyIndices[e.key], this._heapify(0), e.key;
|
|
1602
|
+
}
|
|
1603
|
+
decrease(e, n) {
|
|
1604
|
+
let t = this._keyIndices[e];
|
|
1605
|
+
if (t === void 0) throw new Error(`Key not found: ${e}`);
|
|
1606
|
+
let r = this._arr[t].priority;
|
|
1607
|
+
if (n > r) throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${n}`);
|
|
1608
|
+
this._arr[t].priority = n, this._decrease(t);
|
|
1609
|
+
}
|
|
1610
|
+
_heapify(e) {
|
|
1611
|
+
let n = this._arr, t = 2 * e, r = t + 1, o = e;
|
|
1612
|
+
t < n.length && (o = n[t].priority < n[o].priority ? t : o, r < n.length && (o = n[r].priority < n[o].priority ? r : o), o !== e && (this._swap(e, o), this._heapify(o)));
|
|
1613
|
+
}
|
|
1614
|
+
_decrease(e) {
|
|
1615
|
+
let n = this._arr, t = n[e].priority, r;
|
|
1616
|
+
for (; e !== 0 && (r = e >> 1, !(n[r].priority < t)); ) this._swap(e, r), e = r;
|
|
1617
|
+
}
|
|
1618
|
+
_swap(e, n) {
|
|
1619
|
+
let t = this._arr, r = this._keyIndices, o = t[e], i = t[n];
|
|
1620
|
+
t[e] = i, t[n] = o, r[i.key] = e, r[o.key] = n;
|
|
1621
|
+
}
|
|
1622
|
+
};
|
|
1623
|
+
kn = () => 1;
|
|
1624
|
+
Tn = () => 1;
|
|
1625
|
+
D = class extends Error {
|
|
1626
|
+
constructor(...e) {
|
|
1627
|
+
super(...e);
|
|
1628
|
+
}
|
|
1629
|
+
};
|
|
1630
|
+
Ie = 65535;
|
|
1631
|
+
An = 0;
|
|
1632
|
+
_ = "\0";
|
|
1633
|
+
U = "3.0.0";
|
|
1634
|
+
K = class {
|
|
1635
|
+
constructor() {
|
|
1636
|
+
pe(this, "_sentinel");
|
|
1637
|
+
let n = {};
|
|
1638
|
+
n._next = n._prev = n, this._sentinel = n;
|
|
1639
|
+
}
|
|
1640
|
+
dequeue() {
|
|
1641
|
+
let n = this._sentinel, t = n._prev;
|
|
1642
|
+
if (t !== n) return Pe(t), t;
|
|
1643
|
+
}
|
|
1644
|
+
enqueue(n) {
|
|
1645
|
+
let t = this._sentinel;
|
|
1646
|
+
n._prev && n._next && Pe(n), n._next = t._next, t._next._prev = n, t._next = n, n._prev = t;
|
|
1647
|
+
}
|
|
1648
|
+
toString() {
|
|
1649
|
+
let n = [], t = this._sentinel, r = t._prev;
|
|
1650
|
+
for (; r !== t; ) n.push(JSON.stringify(r, Vn)), r = r._prev;
|
|
1651
|
+
return "[" + n.join(", ") + "]";
|
|
1652
|
+
}
|
|
1653
|
+
};
|
|
1654
|
+
Me = K;
|
|
1655
|
+
Wn = () => 1;
|
|
1656
|
+
V = Kn;
|
|
1657
|
+
({ preorder: Zn, postorder: et } = R);
|
|
1658
|
+
Ve = x;
|
|
1659
|
+
x.initLowLimValues = ee;
|
|
1660
|
+
x.initCutValues = Z;
|
|
1661
|
+
x.calcCutValue = We;
|
|
1662
|
+
x.leaveEdge = Ye;
|
|
1663
|
+
x.enterEdge = ze;
|
|
1664
|
+
x.exchangeEdges = He;
|
|
1665
|
+
Xe = ot;
|
|
1666
|
+
it = S;
|
|
1667
|
+
Ue = at;
|
|
1668
|
+
Ze = ft;
|
|
1669
|
+
Vt = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"];
|
|
1670
|
+
Wt = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "TB", rankalign: "center" };
|
|
1671
|
+
Bt = ["acyclicer", "ranker", "rankdir", "align", "rankalign"];
|
|
1672
|
+
Yt = ["width", "height", "rank"];
|
|
1673
|
+
cn = { width: 0, height: 0 };
|
|
1674
|
+
zt = ["minlen", "weight", "width", "height", "labeloffset"];
|
|
1675
|
+
Ht = { minlen: 1, weight: 1, width: 0, height: 0, labeloffset: 10, labelpos: "r" };
|
|
1676
|
+
qt = ["labelpos"];
|
|
1677
|
+
sr = { graphlib: z, version: U, layout: he, debug: fe, util: { time: P, notime: M } };
|
|
1678
|
+
To = sr;
|
|
1679
|
+
}
|
|
1680
|
+
});
|
|
1681
|
+
|
|
1682
|
+
// src/layout/index.ts
|
|
1683
|
+
var layout_exports = {};
|
|
1684
|
+
__export(layout_exports, {
|
|
1685
|
+
autoLayout: () => autoLayout
|
|
1686
|
+
});
|
|
1687
|
+
function autoLayout(graph, options = {}) {
|
|
1688
|
+
const dir = options.direction ?? "LR";
|
|
1689
|
+
const nodesep = options.nodeSep ?? 48;
|
|
1690
|
+
const ranksep = options.rankSep ?? 96;
|
|
1691
|
+
const dw = options.defaultWidth ?? 180;
|
|
1692
|
+
const dh = options.defaultHeight ?? 64;
|
|
1693
|
+
const inScope = (n) => options.scope ? n.parentId === options.scope : !n.parentId;
|
|
1694
|
+
const targets = graph.nodes.filter(inScope);
|
|
1695
|
+
if (targets.length === 0) return graph.nodes;
|
|
1696
|
+
const ids = new Set(targets.map((n) => n.id));
|
|
1697
|
+
const g = new To.graphlib.Graph();
|
|
1698
|
+
g.setGraph({ rankdir: dir, nodesep, ranksep });
|
|
1699
|
+
g.setDefaultEdgeLabel(() => ({}));
|
|
1700
|
+
for (const n of targets) {
|
|
1701
|
+
g.setNode(n.id, { width: n.width ?? dw, height: n.height ?? dh });
|
|
1702
|
+
}
|
|
1703
|
+
for (const e of graph.edges) {
|
|
1704
|
+
if (ids.has(e.source) && ids.has(e.target)) g.setEdge(e.source, e.target);
|
|
1705
|
+
}
|
|
1706
|
+
To.layout(g);
|
|
1707
|
+
const pos = /* @__PURE__ */ new Map();
|
|
1708
|
+
for (const n of targets) {
|
|
1709
|
+
const d = g.node(n.id);
|
|
1710
|
+
if (d) pos.set(n.id, { x: d.x - d.width / 2, y: d.y - d.height / 2 });
|
|
1711
|
+
}
|
|
1712
|
+
return graph.nodes.map((n) => {
|
|
1713
|
+
const p2 = pos.get(n.id);
|
|
1714
|
+
return p2 ? { ...n, position: p2 } : n;
|
|
1715
|
+
});
|
|
1716
|
+
}
|
|
1717
|
+
var init_layout = __esm({
|
|
1718
|
+
"src/layout/index.ts"() {
|
|
1719
|
+
init_dagre_esm();
|
|
1720
|
+
}
|
|
1721
|
+
});
|
|
12
1722
|
|
|
13
1723
|
// src/registry/registry.ts
|
|
14
1724
|
var kinds = /* @__PURE__ */ new Map();
|
|
@@ -42,7 +1752,7 @@ function kindIds(kind) {
|
|
|
42
1752
|
}
|
|
43
1753
|
function listNodeKinds(category) {
|
|
44
1754
|
const all = Array.from(kinds.values());
|
|
45
|
-
return category ? all.filter((
|
|
1755
|
+
return category ? all.filter((k2) => k2.category === category) : all;
|
|
46
1756
|
}
|
|
47
1757
|
function onNodeKindsChanged(listener) {
|
|
48
1758
|
listeners.add(listener);
|
|
@@ -127,10 +1837,10 @@ function validateField(field, value) {
|
|
|
127
1837
|
return `${field.label} must be a key/value map`;
|
|
128
1838
|
}
|
|
129
1839
|
const allowed = field.valueOptions?.map((o) => o.value);
|
|
130
|
-
for (const [
|
|
131
|
-
if (typeof
|
|
132
|
-
if (allowed && !allowed.includes(
|
|
133
|
-
return `${field.label}: "${
|
|
1840
|
+
for (const [k2, v2] of Object.entries(value)) {
|
|
1841
|
+
if (typeof v2 !== "string") return `${field.label}: "${k2}" must be a string`;
|
|
1842
|
+
if (allowed && !allowed.includes(v2)) {
|
|
1843
|
+
return `${field.label}: "${k2}" must be one of ${allowed.join(", ")}`;
|
|
134
1844
|
}
|
|
135
1845
|
}
|
|
136
1846
|
return null;
|
|
@@ -182,9 +1892,9 @@ function getRichInputAdapter() {
|
|
|
182
1892
|
function isRichInputEnabled() {
|
|
183
1893
|
return adapter !== null && (adapter.renderDocument !== void 0 || adapter.renderEditor !== void 0);
|
|
184
1894
|
}
|
|
185
|
-
function onRichInputAdapterChanged(
|
|
186
|
-
listeners2.add(
|
|
187
|
-
return () => listeners2.delete(
|
|
1895
|
+
function onRichInputAdapterChanged(fn2) {
|
|
1896
|
+
listeners2.add(fn2);
|
|
1897
|
+
return () => listeners2.delete(fn2);
|
|
188
1898
|
}
|
|
189
1899
|
function RichInputPreview({ config }) {
|
|
190
1900
|
const a = getRichInputAdapter();
|
|
@@ -225,8 +1935,8 @@ function cc(names) {
|
|
|
225
1935
|
}
|
|
226
1936
|
}
|
|
227
1937
|
} else {
|
|
228
|
-
for (let
|
|
229
|
-
if (names[
|
|
1938
|
+
for (let k2 in names) {
|
|
1939
|
+
if (names[k2]) out += (out && " ") + k2;
|
|
230
1940
|
}
|
|
231
1941
|
}
|
|
232
1942
|
return out;
|
|
@@ -236,14 +1946,14 @@ function cc(names) {
|
|
|
236
1946
|
var noop = { value: () => {
|
|
237
1947
|
} };
|
|
238
1948
|
function dispatch() {
|
|
239
|
-
for (var i = 0, n = arguments.length,
|
|
240
|
-
if (!(t = arguments[i] + "") || t in
|
|
241
|
-
|
|
1949
|
+
for (var i = 0, n = arguments.length, _2 = {}, t; i < n; ++i) {
|
|
1950
|
+
if (!(t = arguments[i] + "") || t in _2 || /[\s.]/.test(t)) throw new Error("illegal type: " + t);
|
|
1951
|
+
_2[t] = [];
|
|
242
1952
|
}
|
|
243
|
-
return new Dispatch(
|
|
1953
|
+
return new Dispatch(_2);
|
|
244
1954
|
}
|
|
245
|
-
function Dispatch(
|
|
246
|
-
this._ =
|
|
1955
|
+
function Dispatch(_2) {
|
|
1956
|
+
this._ = _2;
|
|
247
1957
|
}
|
|
248
1958
|
function parseTypenames(typenames, types) {
|
|
249
1959
|
return typenames.trim().split(/^|\s+/).map(function(t) {
|
|
@@ -256,21 +1966,21 @@ function parseTypenames(typenames, types) {
|
|
|
256
1966
|
Dispatch.prototype = dispatch.prototype = {
|
|
257
1967
|
constructor: Dispatch,
|
|
258
1968
|
on: function(typename, callback) {
|
|
259
|
-
var
|
|
1969
|
+
var _2 = this._, T2 = parseTypenames(typename + "", _2), t, i = -1, n = T2.length;
|
|
260
1970
|
if (arguments.length < 2) {
|
|
261
|
-
while (++i < n) if ((t = (typename =
|
|
1971
|
+
while (++i < n) if ((t = (typename = T2[i]).type) && (t = get(_2[t], typename.name))) return t;
|
|
262
1972
|
return;
|
|
263
1973
|
}
|
|
264
1974
|
if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
|
|
265
1975
|
while (++i < n) {
|
|
266
|
-
if (t = (typename =
|
|
267
|
-
else if (callback == null) for (t in
|
|
1976
|
+
if (t = (typename = T2[i]).type) _2[t] = set(_2[t], typename.name, callback);
|
|
1977
|
+
else if (callback == null) for (t in _2) _2[t] = set(_2[t], typename.name, null);
|
|
268
1978
|
}
|
|
269
1979
|
return this;
|
|
270
1980
|
},
|
|
271
1981
|
copy: function() {
|
|
272
|
-
var copy = {},
|
|
273
|
-
for (var t in
|
|
1982
|
+
var copy = {}, _2 = this._;
|
|
1983
|
+
for (var t in _2) copy[t] = _2[t].slice();
|
|
274
1984
|
return new Dispatch(copy);
|
|
275
1985
|
},
|
|
276
1986
|
call: function(type, that) {
|
|
@@ -348,8 +2058,8 @@ function selector_default(selector2) {
|
|
|
348
2058
|
// node_modules/d3-selection/src/selection/select.js
|
|
349
2059
|
function select_default(select) {
|
|
350
2060
|
if (typeof select !== "function") select = selector_default(select);
|
|
351
|
-
for (var groups = this._groups, m = groups.length, subgroups = new Array(m),
|
|
352
|
-
for (var group = groups[
|
|
2061
|
+
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
|
|
2062
|
+
for (var group = groups[j2], n = group.length, subgroup = subgroups[j2] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
|
353
2063
|
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
|
354
2064
|
if ("__data__" in node) subnode.__data__ = node.__data__;
|
|
355
2065
|
subgroup[i] = subnode;
|
|
@@ -360,8 +2070,8 @@ function select_default(select) {
|
|
|
360
2070
|
}
|
|
361
2071
|
|
|
362
2072
|
// node_modules/d3-selection/src/array.js
|
|
363
|
-
function array(
|
|
364
|
-
return
|
|
2073
|
+
function array(x2) {
|
|
2074
|
+
return x2 == null ? [] : Array.isArray(x2) ? x2 : Array.from(x2);
|
|
365
2075
|
}
|
|
366
2076
|
|
|
367
2077
|
// node_modules/d3-selection/src/selectorAll.js
|
|
@@ -383,8 +2093,8 @@ function arrayAll(select) {
|
|
|
383
2093
|
function selectAll_default(select) {
|
|
384
2094
|
if (typeof select === "function") select = arrayAll(select);
|
|
385
2095
|
else select = selectorAll_default(select);
|
|
386
|
-
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [],
|
|
387
|
-
for (var group = groups[
|
|
2096
|
+
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m; ++j2) {
|
|
2097
|
+
for (var group = groups[j2], n = group.length, node, i = 0; i < n; ++i) {
|
|
388
2098
|
if (node = group[i]) {
|
|
389
2099
|
subgroups.push(select.call(node, node.__data__, i, group));
|
|
390
2100
|
parents.push(node);
|
|
@@ -437,8 +2147,8 @@ function selectChildren_default(match) {
|
|
|
437
2147
|
// node_modules/d3-selection/src/selection/filter.js
|
|
438
2148
|
function filter_default(match) {
|
|
439
2149
|
if (typeof match !== "function") match = matcher_default(match);
|
|
440
|
-
for (var groups = this._groups, m = groups.length, subgroups = new Array(m),
|
|
441
|
-
for (var group = groups[
|
|
2150
|
+
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
|
|
2151
|
+
for (var group = groups[j2], n = group.length, subgroup = subgroups[j2] = [], node, i = 0; i < n; ++i) {
|
|
442
2152
|
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
|
443
2153
|
subgroup.push(node);
|
|
444
2154
|
}
|
|
@@ -480,9 +2190,9 @@ EnterNode.prototype = {
|
|
|
480
2190
|
};
|
|
481
2191
|
|
|
482
2192
|
// node_modules/d3-selection/src/constant.js
|
|
483
|
-
function constant_default(
|
|
2193
|
+
function constant_default(x2) {
|
|
484
2194
|
return function() {
|
|
485
|
-
return
|
|
2195
|
+
return x2;
|
|
486
2196
|
};
|
|
487
2197
|
}
|
|
488
2198
|
|
|
@@ -538,8 +2248,8 @@ function data_default(value, key) {
|
|
|
538
2248
|
if (!arguments.length) return Array.from(this, datum);
|
|
539
2249
|
var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
|
|
540
2250
|
if (typeof value !== "function") value = constant_default(value);
|
|
541
|
-
for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m),
|
|
542
|
-
var parent = parents[
|
|
2251
|
+
for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j2 = 0; j2 < m; ++j2) {
|
|
2252
|
+
var parent = parents[j2], group = groups[j2], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j2, parents)), dataLength = data.length, enterGroup = enter[j2] = new Array(dataLength), updateGroup = update[j2] = new Array(dataLength), exitGroup = exit[j2] = new Array(groupLength);
|
|
543
2253
|
bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
|
|
544
2254
|
for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
|
|
545
2255
|
if (previous = enterGroup[i0]) {
|
|
@@ -584,23 +2294,23 @@ function join_default(onenter, onupdate, onexit) {
|
|
|
584
2294
|
// node_modules/d3-selection/src/selection/merge.js
|
|
585
2295
|
function merge_default(context) {
|
|
586
2296
|
var selection2 = context.selection ? context.selection() : context;
|
|
587
|
-
for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0),
|
|
588
|
-
for (var group0 = groups0[
|
|
2297
|
+
for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m; ++j2) {
|
|
2298
|
+
for (var group0 = groups0[j2], group1 = groups1[j2], n = group0.length, merge = merges[j2] = new Array(n), node, i = 0; i < n; ++i) {
|
|
589
2299
|
if (node = group0[i] || group1[i]) {
|
|
590
2300
|
merge[i] = node;
|
|
591
2301
|
}
|
|
592
2302
|
}
|
|
593
2303
|
}
|
|
594
|
-
for (;
|
|
595
|
-
merges[
|
|
2304
|
+
for (; j2 < m0; ++j2) {
|
|
2305
|
+
merges[j2] = groups0[j2];
|
|
596
2306
|
}
|
|
597
2307
|
return new Selection(merges, this._parents);
|
|
598
2308
|
}
|
|
599
2309
|
|
|
600
2310
|
// node_modules/d3-selection/src/selection/order.js
|
|
601
2311
|
function order_default() {
|
|
602
|
-
for (var groups = this._groups,
|
|
603
|
-
for (var group = groups[
|
|
2312
|
+
for (var groups = this._groups, j2 = -1, m = groups.length; ++j2 < m; ) {
|
|
2313
|
+
for (var group = groups[j2], i = group.length - 1, next = group[i], node; --i >= 0; ) {
|
|
604
2314
|
if (node = group[i]) {
|
|
605
2315
|
if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);
|
|
606
2316
|
next = node;
|
|
@@ -616,8 +2326,8 @@ function sort_default(compare) {
|
|
|
616
2326
|
function compareNode(a, b) {
|
|
617
2327
|
return a && b ? compare(a.__data__, b.__data__) : !a - !b;
|
|
618
2328
|
}
|
|
619
|
-
for (var groups = this._groups, m = groups.length, sortgroups = new Array(m),
|
|
620
|
-
for (var group = groups[
|
|
2329
|
+
for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
|
|
2330
|
+
for (var group = groups[j2], n = group.length, sortgroup = sortgroups[j2] = new Array(n), node, i = 0; i < n; ++i) {
|
|
621
2331
|
if (node = group[i]) {
|
|
622
2332
|
sortgroup[i] = node;
|
|
623
2333
|
}
|
|
@@ -645,8 +2355,8 @@ function nodes_default() {
|
|
|
645
2355
|
|
|
646
2356
|
// node_modules/d3-selection/src/selection/node.js
|
|
647
2357
|
function node_default() {
|
|
648
|
-
for (var groups = this._groups,
|
|
649
|
-
for (var group = groups[
|
|
2358
|
+
for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
|
|
2359
|
+
for (var group = groups[j2], i = 0, n = group.length; i < n; ++i) {
|
|
650
2360
|
var node = group[i];
|
|
651
2361
|
if (node) return node;
|
|
652
2362
|
}
|
|
@@ -668,8 +2378,8 @@ function empty_default() {
|
|
|
668
2378
|
|
|
669
2379
|
// node_modules/d3-selection/src/selection/each.js
|
|
670
2380
|
function each_default(callback) {
|
|
671
|
-
for (var groups = this._groups,
|
|
672
|
-
for (var group = groups[
|
|
2381
|
+
for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
|
|
2382
|
+
for (var group = groups[j2], i = 0, n = group.length, node; i < n; ++i) {
|
|
673
2383
|
if (node = group[i]) callback.call(node, node.__data__, i, group);
|
|
674
2384
|
}
|
|
675
2385
|
}
|
|
@@ -699,16 +2409,16 @@ function attrConstantNS(fullname, value) {
|
|
|
699
2409
|
}
|
|
700
2410
|
function attrFunction(name, value) {
|
|
701
2411
|
return function() {
|
|
702
|
-
var
|
|
703
|
-
if (
|
|
704
|
-
else this.setAttribute(name,
|
|
2412
|
+
var v2 = value.apply(this, arguments);
|
|
2413
|
+
if (v2 == null) this.removeAttribute(name);
|
|
2414
|
+
else this.setAttribute(name, v2);
|
|
705
2415
|
};
|
|
706
2416
|
}
|
|
707
2417
|
function attrFunctionNS(fullname, value) {
|
|
708
2418
|
return function() {
|
|
709
|
-
var
|
|
710
|
-
if (
|
|
711
|
-
else this.setAttributeNS(fullname.space, fullname.local,
|
|
2419
|
+
var v2 = value.apply(this, arguments);
|
|
2420
|
+
if (v2 == null) this.removeAttributeNS(fullname.space, fullname.local);
|
|
2421
|
+
else this.setAttributeNS(fullname.space, fullname.local, v2);
|
|
712
2422
|
};
|
|
713
2423
|
}
|
|
714
2424
|
function attr_default(name, value) {
|
|
@@ -738,9 +2448,9 @@ function styleConstant(name, value, priority) {
|
|
|
738
2448
|
}
|
|
739
2449
|
function styleFunction(name, value, priority) {
|
|
740
2450
|
return function() {
|
|
741
|
-
var
|
|
742
|
-
if (
|
|
743
|
-
else this.style.setProperty(name,
|
|
2451
|
+
var v2 = value.apply(this, arguments);
|
|
2452
|
+
if (v2 == null) this.style.removeProperty(name);
|
|
2453
|
+
else this.style.setProperty(name, v2, priority);
|
|
744
2454
|
};
|
|
745
2455
|
}
|
|
746
2456
|
function style_default(name, value, priority) {
|
|
@@ -763,9 +2473,9 @@ function propertyConstant(name, value) {
|
|
|
763
2473
|
}
|
|
764
2474
|
function propertyFunction(name, value) {
|
|
765
2475
|
return function() {
|
|
766
|
-
var
|
|
767
|
-
if (
|
|
768
|
-
else this[name] =
|
|
2476
|
+
var v2 = value.apply(this, arguments);
|
|
2477
|
+
if (v2 == null) delete this[name];
|
|
2478
|
+
else this[name] = v2;
|
|
769
2479
|
};
|
|
770
2480
|
}
|
|
771
2481
|
function property_default(name, value) {
|
|
@@ -846,8 +2556,8 @@ function textConstant(value) {
|
|
|
846
2556
|
}
|
|
847
2557
|
function textFunction(value) {
|
|
848
2558
|
return function() {
|
|
849
|
-
var
|
|
850
|
-
this.textContent =
|
|
2559
|
+
var v2 = value.apply(this, arguments);
|
|
2560
|
+
this.textContent = v2 == null ? "" : v2;
|
|
851
2561
|
};
|
|
852
2562
|
}
|
|
853
2563
|
function text_default(value) {
|
|
@@ -865,8 +2575,8 @@ function htmlConstant(value) {
|
|
|
865
2575
|
}
|
|
866
2576
|
function htmlFunction(value) {
|
|
867
2577
|
return function() {
|
|
868
|
-
var
|
|
869
|
-
this.innerHTML =
|
|
2578
|
+
var v2 = value.apply(this, arguments);
|
|
2579
|
+
this.innerHTML = v2 == null ? "" : v2;
|
|
870
2580
|
};
|
|
871
2581
|
}
|
|
872
2582
|
function html_default(value) {
|
|
@@ -950,24 +2660,24 @@ function parseTypenames2(typenames) {
|
|
|
950
2660
|
}
|
|
951
2661
|
function onRemove(typename) {
|
|
952
2662
|
return function() {
|
|
953
|
-
var
|
|
954
|
-
if (!
|
|
955
|
-
for (var
|
|
956
|
-
if (o =
|
|
2663
|
+
var on2 = this.__on;
|
|
2664
|
+
if (!on2) return;
|
|
2665
|
+
for (var j2 = 0, i = -1, m = on2.length, o; j2 < m; ++j2) {
|
|
2666
|
+
if (o = on2[j2], (!typename.type || o.type === typename.type) && o.name === typename.name) {
|
|
957
2667
|
this.removeEventListener(o.type, o.listener, o.options);
|
|
958
2668
|
} else {
|
|
959
|
-
|
|
2669
|
+
on2[++i] = o;
|
|
960
2670
|
}
|
|
961
2671
|
}
|
|
962
|
-
if (++i)
|
|
2672
|
+
if (++i) on2.length = i;
|
|
963
2673
|
else delete this.__on;
|
|
964
2674
|
};
|
|
965
2675
|
}
|
|
966
2676
|
function onAdd(typename, value, options) {
|
|
967
2677
|
return function() {
|
|
968
|
-
var
|
|
969
|
-
if (
|
|
970
|
-
if ((o =
|
|
2678
|
+
var on2 = this.__on, o, listener = contextListener(value);
|
|
2679
|
+
if (on2) for (var j2 = 0, m = on2.length; j2 < m; ++j2) {
|
|
2680
|
+
if ((o = on2[j2]).type === typename.type && o.name === typename.name) {
|
|
971
2681
|
this.removeEventListener(o.type, o.listener, o.options);
|
|
972
2682
|
this.addEventListener(o.type, o.listener = listener, o.options = options);
|
|
973
2683
|
o.value = value;
|
|
@@ -976,16 +2686,16 @@ function onAdd(typename, value, options) {
|
|
|
976
2686
|
}
|
|
977
2687
|
this.addEventListener(typename.type, listener, options);
|
|
978
2688
|
o = { type: typename.type, name: typename.name, value, listener, options };
|
|
979
|
-
if (!
|
|
980
|
-
else
|
|
2689
|
+
if (!on2) this.__on = [o];
|
|
2690
|
+
else on2.push(o);
|
|
981
2691
|
};
|
|
982
2692
|
}
|
|
983
2693
|
function on_default(typename, value, options) {
|
|
984
2694
|
var typenames = parseTypenames2(typename + ""), i, n = typenames.length, t;
|
|
985
2695
|
if (arguments.length < 2) {
|
|
986
|
-
var
|
|
987
|
-
if (
|
|
988
|
-
for (i = 0, o =
|
|
2696
|
+
var on2 = this.node().__on;
|
|
2697
|
+
if (on2) for (var j2 = 0, m = on2.length, o; j2 < m; ++j2) {
|
|
2698
|
+
for (i = 0, o = on2[j2]; i < n; ++i) {
|
|
989
2699
|
if ((t = typenames[i]).type === o.type && t.name === o.name) {
|
|
990
2700
|
return o.value;
|
|
991
2701
|
}
|
|
@@ -993,8 +2703,8 @@ function on_default(typename, value, options) {
|
|
|
993
2703
|
}
|
|
994
2704
|
return;
|
|
995
2705
|
}
|
|
996
|
-
|
|
997
|
-
for (i = 0; i < n; ++i) this.each(
|
|
2706
|
+
on2 = value ? onAdd : onRemove;
|
|
2707
|
+
for (i = 0; i < n; ++i) this.each(on2(typenames[i], value, options));
|
|
998
2708
|
return this;
|
|
999
2709
|
}
|
|
1000
2710
|
|
|
@@ -1026,8 +2736,8 @@ function dispatch_default2(type, params) {
|
|
|
1026
2736
|
|
|
1027
2737
|
// node_modules/d3-selection/src/selection/iterator.js
|
|
1028
2738
|
function* iterator_default() {
|
|
1029
|
-
for (var groups = this._groups,
|
|
1030
|
-
for (var group = groups[
|
|
2739
|
+
for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
|
|
2740
|
+
for (var group = groups[j2], i = 0, n = group.length, node; i < n; ++i) {
|
|
1031
2741
|
if (node = group[i]) yield node;
|
|
1032
2742
|
}
|
|
1033
2743
|
}
|
|
@@ -1155,7 +2865,7 @@ function yesdrag(view, noclick) {
|
|
|
1155
2865
|
}
|
|
1156
2866
|
|
|
1157
2867
|
// node_modules/d3-drag/src/constant.js
|
|
1158
|
-
var constant_default2 = (
|
|
2868
|
+
var constant_default2 = (x2) => () => x2;
|
|
1159
2869
|
|
|
1160
2870
|
// node_modules/d3-drag/src/event.js
|
|
1161
2871
|
function DragEvent(type, {
|
|
@@ -1164,7 +2874,7 @@ function DragEvent(type, {
|
|
|
1164
2874
|
target,
|
|
1165
2875
|
identifier,
|
|
1166
2876
|
active,
|
|
1167
|
-
x,
|
|
2877
|
+
x: x2,
|
|
1168
2878
|
y,
|
|
1169
2879
|
dx,
|
|
1170
2880
|
dy,
|
|
@@ -1177,7 +2887,7 @@ function DragEvent(type, {
|
|
|
1177
2887
|
target: { value: target, enumerable: true, configurable: true },
|
|
1178
2888
|
identifier: { value: identifier, enumerable: true, configurable: true },
|
|
1179
2889
|
active: { value: active, enumerable: true, configurable: true },
|
|
1180
|
-
x: { value:
|
|
2890
|
+
x: { value: x2, enumerable: true, configurable: true },
|
|
1181
2891
|
y: { value: y, enumerable: true, configurable: true },
|
|
1182
2892
|
dx: { value: dx, enumerable: true, configurable: true },
|
|
1183
2893
|
dy: { value: dy, enumerable: true, configurable: true },
|
|
@@ -1266,22 +2976,22 @@ function drag_default() {
|
|
|
1266
2976
|
}
|
|
1267
2977
|
}
|
|
1268
2978
|
function beforestart(that, container2, event, d, identifier, touch) {
|
|
1269
|
-
var dispatch2 = listeners3.copy(),
|
|
2979
|
+
var dispatch2 = listeners3.copy(), p2 = pointer_default(touch || event, container2), dx, dy, s;
|
|
1270
2980
|
if ((s = subject.call(that, new DragEvent("beforestart", {
|
|
1271
2981
|
sourceEvent: event,
|
|
1272
2982
|
target: drag,
|
|
1273
2983
|
identifier,
|
|
1274
2984
|
active,
|
|
1275
|
-
x:
|
|
1276
|
-
y:
|
|
2985
|
+
x: p2[0],
|
|
2986
|
+
y: p2[1],
|
|
1277
2987
|
dx: 0,
|
|
1278
2988
|
dy: 0,
|
|
1279
2989
|
dispatch: dispatch2
|
|
1280
2990
|
}), d)) == null) return;
|
|
1281
|
-
dx = s.x -
|
|
1282
|
-
dy = s.y -
|
|
2991
|
+
dx = s.x - p2[0] || 0;
|
|
2992
|
+
dy = s.y - p2[1] || 0;
|
|
1283
2993
|
return function gesture(type, event2, touch2) {
|
|
1284
|
-
var p0 =
|
|
2994
|
+
var p0 = p2, n;
|
|
1285
2995
|
switch (type) {
|
|
1286
2996
|
case "start":
|
|
1287
2997
|
gestures[identifier] = gesture, n = active++;
|
|
@@ -1290,7 +3000,7 @@ function drag_default() {
|
|
|
1290
3000
|
delete gestures[identifier], --active;
|
|
1291
3001
|
// falls through
|
|
1292
3002
|
case "drag":
|
|
1293
|
-
|
|
3003
|
+
p2 = pointer_default(touch2 || event2, container2), n = active;
|
|
1294
3004
|
break;
|
|
1295
3005
|
}
|
|
1296
3006
|
dispatch2.call(
|
|
@@ -1302,34 +3012,34 @@ function drag_default() {
|
|
|
1302
3012
|
target: drag,
|
|
1303
3013
|
identifier,
|
|
1304
3014
|
active: n,
|
|
1305
|
-
x:
|
|
1306
|
-
y:
|
|
1307
|
-
dx:
|
|
1308
|
-
dy:
|
|
3015
|
+
x: p2[0] + dx,
|
|
3016
|
+
y: p2[1] + dy,
|
|
3017
|
+
dx: p2[0] - p0[0],
|
|
3018
|
+
dy: p2[1] - p0[1],
|
|
1309
3019
|
dispatch: dispatch2
|
|
1310
3020
|
}),
|
|
1311
3021
|
d
|
|
1312
3022
|
);
|
|
1313
3023
|
};
|
|
1314
3024
|
}
|
|
1315
|
-
drag.filter = function(
|
|
1316
|
-
return arguments.length ? (filter2 = typeof
|
|
3025
|
+
drag.filter = function(_2) {
|
|
3026
|
+
return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : filter2;
|
|
1317
3027
|
};
|
|
1318
|
-
drag.container = function(
|
|
1319
|
-
return arguments.length ? (container = typeof
|
|
3028
|
+
drag.container = function(_2) {
|
|
3029
|
+
return arguments.length ? (container = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : container;
|
|
1320
3030
|
};
|
|
1321
|
-
drag.subject = function(
|
|
1322
|
-
return arguments.length ? (subject = typeof
|
|
3031
|
+
drag.subject = function(_2) {
|
|
3032
|
+
return arguments.length ? (subject = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : subject;
|
|
1323
3033
|
};
|
|
1324
|
-
drag.touchable = function(
|
|
1325
|
-
return arguments.length ? (touchable = typeof
|
|
3034
|
+
drag.touchable = function(_2) {
|
|
3035
|
+
return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : touchable;
|
|
1326
3036
|
};
|
|
1327
3037
|
drag.on = function() {
|
|
1328
3038
|
var value = listeners3.on.apply(listeners3, arguments);
|
|
1329
3039
|
return value === listeners3 ? drag : value;
|
|
1330
3040
|
};
|
|
1331
|
-
drag.clickDistance = function(
|
|
1332
|
-
return arguments.length ? (clickDistance2 = (
|
|
3041
|
+
drag.clickDistance = function(_2) {
|
|
3042
|
+
return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, drag) : Math.sqrt(clickDistance2);
|
|
1333
3043
|
};
|
|
1334
3044
|
return drag;
|
|
1335
3045
|
}
|
|
@@ -1565,13 +3275,13 @@ function Rgb(r, g, b, opacity) {
|
|
|
1565
3275
|
this.opacity = +opacity;
|
|
1566
3276
|
}
|
|
1567
3277
|
define_default(Rgb, rgb, extend(Color, {
|
|
1568
|
-
brighter(
|
|
1569
|
-
|
|
1570
|
-
return new Rgb(this.r *
|
|
3278
|
+
brighter(k2) {
|
|
3279
|
+
k2 = k2 == null ? brighter : Math.pow(brighter, k2);
|
|
3280
|
+
return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
|
|
1571
3281
|
},
|
|
1572
|
-
darker(
|
|
1573
|
-
|
|
1574
|
-
return new Rgb(this.r *
|
|
3282
|
+
darker(k2) {
|
|
3283
|
+
k2 = k2 == null ? darker : Math.pow(darker, k2);
|
|
3284
|
+
return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
|
|
1575
3285
|
},
|
|
1576
3286
|
rgb() {
|
|
1577
3287
|
return this;
|
|
@@ -1609,11 +3319,11 @@ function hex(value) {
|
|
|
1609
3319
|
value = clampi(value);
|
|
1610
3320
|
return (value < 16 ? "0" : "") + value.toString(16);
|
|
1611
3321
|
}
|
|
1612
|
-
function hsla(
|
|
1613
|
-
if (a <= 0)
|
|
1614
|
-
else if (l <= 0 || l >= 1)
|
|
1615
|
-
else if (s <= 0)
|
|
1616
|
-
return new Hsl(
|
|
3322
|
+
function hsla(h2, s, l, a) {
|
|
3323
|
+
if (a <= 0) h2 = s = l = NaN;
|
|
3324
|
+
else if (l <= 0 || l >= 1) h2 = s = NaN;
|
|
3325
|
+
else if (s <= 0) h2 = NaN;
|
|
3326
|
+
return new Hsl(h2, s, l, a);
|
|
1617
3327
|
}
|
|
1618
3328
|
function hslConvert(o) {
|
|
1619
3329
|
if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
|
|
@@ -1621,42 +3331,42 @@ function hslConvert(o) {
|
|
|
1621
3331
|
if (!o) return new Hsl();
|
|
1622
3332
|
if (o instanceof Hsl) return o;
|
|
1623
3333
|
o = o.rgb();
|
|
1624
|
-
var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b),
|
|
3334
|
+
var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h2 = NaN, s = max - min, l = (max + min) / 2;
|
|
1625
3335
|
if (s) {
|
|
1626
|
-
if (r === max)
|
|
1627
|
-
else if (g === max)
|
|
1628
|
-
else
|
|
3336
|
+
if (r === max) h2 = (g - b) / s + (g < b) * 6;
|
|
3337
|
+
else if (g === max) h2 = (b - r) / s + 2;
|
|
3338
|
+
else h2 = (r - g) / s + 4;
|
|
1629
3339
|
s /= l < 0.5 ? max + min : 2 - max - min;
|
|
1630
|
-
|
|
3340
|
+
h2 *= 60;
|
|
1631
3341
|
} else {
|
|
1632
|
-
s = l > 0 && l < 1 ? 0 :
|
|
3342
|
+
s = l > 0 && l < 1 ? 0 : h2;
|
|
1633
3343
|
}
|
|
1634
|
-
return new Hsl(
|
|
3344
|
+
return new Hsl(h2, s, l, o.opacity);
|
|
1635
3345
|
}
|
|
1636
|
-
function hsl(
|
|
1637
|
-
return arguments.length === 1 ? hslConvert(
|
|
3346
|
+
function hsl(h2, s, l, opacity) {
|
|
3347
|
+
return arguments.length === 1 ? hslConvert(h2) : new Hsl(h2, s, l, opacity == null ? 1 : opacity);
|
|
1638
3348
|
}
|
|
1639
|
-
function Hsl(
|
|
1640
|
-
this.h = +
|
|
3349
|
+
function Hsl(h2, s, l, opacity) {
|
|
3350
|
+
this.h = +h2;
|
|
1641
3351
|
this.s = +s;
|
|
1642
3352
|
this.l = +l;
|
|
1643
3353
|
this.opacity = +opacity;
|
|
1644
3354
|
}
|
|
1645
3355
|
define_default(Hsl, hsl, extend(Color, {
|
|
1646
|
-
brighter(
|
|
1647
|
-
|
|
1648
|
-
return new Hsl(this.h, this.s, this.l *
|
|
3356
|
+
brighter(k2) {
|
|
3357
|
+
k2 = k2 == null ? brighter : Math.pow(brighter, k2);
|
|
3358
|
+
return new Hsl(this.h, this.s, this.l * k2, this.opacity);
|
|
1649
3359
|
},
|
|
1650
|
-
darker(
|
|
1651
|
-
|
|
1652
|
-
return new Hsl(this.h, this.s, this.l *
|
|
3360
|
+
darker(k2) {
|
|
3361
|
+
k2 = k2 == null ? darker : Math.pow(darker, k2);
|
|
3362
|
+
return new Hsl(this.h, this.s, this.l * k2, this.opacity);
|
|
1653
3363
|
},
|
|
1654
3364
|
rgb() {
|
|
1655
|
-
var
|
|
3365
|
+
var h2 = this.h % 360 + (this.h < 0) * 360, s = isNaN(h2) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;
|
|
1656
3366
|
return new Rgb(
|
|
1657
|
-
hsl2rgb(
|
|
1658
|
-
hsl2rgb(
|
|
1659
|
-
hsl2rgb(
|
|
3367
|
+
hsl2rgb(h2 >= 240 ? h2 - 240 : h2 + 120, m1, m2),
|
|
3368
|
+
hsl2rgb(h2, m1, m2),
|
|
3369
|
+
hsl2rgb(h2 < 120 ? h2 + 240 : h2 - 120, m1, m2),
|
|
1660
3370
|
this.opacity
|
|
1661
3371
|
);
|
|
1662
3372
|
},
|
|
@@ -1678,12 +3388,12 @@ function clamph(value) {
|
|
|
1678
3388
|
function clampt(value) {
|
|
1679
3389
|
return Math.max(0, Math.min(1, value || 0));
|
|
1680
3390
|
}
|
|
1681
|
-
function hsl2rgb(
|
|
1682
|
-
return (
|
|
3391
|
+
function hsl2rgb(h2, m1, m2) {
|
|
3392
|
+
return (h2 < 60 ? m1 + (m2 - m1) * h2 / 60 : h2 < 180 ? m2 : h2 < 240 ? m1 + (m2 - m1) * (240 - h2) / 60 : m1) * 255;
|
|
1683
3393
|
}
|
|
1684
3394
|
|
|
1685
3395
|
// node_modules/d3-interpolate/src/constant.js
|
|
1686
|
-
var constant_default3 = (
|
|
3396
|
+
var constant_default3 = (x2) => () => x2;
|
|
1687
3397
|
|
|
1688
3398
|
// node_modules/d3-interpolate/src/color.js
|
|
1689
3399
|
function linear(a, d) {
|
|
@@ -1732,17 +3442,17 @@ function numberArray_default(a, b) {
|
|
|
1732
3442
|
return c;
|
|
1733
3443
|
};
|
|
1734
3444
|
}
|
|
1735
|
-
function isNumberArray(
|
|
1736
|
-
return ArrayBuffer.isView(
|
|
3445
|
+
function isNumberArray(x2) {
|
|
3446
|
+
return ArrayBuffer.isView(x2) && !(x2 instanceof DataView);
|
|
1737
3447
|
}
|
|
1738
3448
|
|
|
1739
3449
|
// node_modules/d3-interpolate/src/array.js
|
|
1740
3450
|
function genericArray(a, b) {
|
|
1741
|
-
var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0,
|
|
1742
|
-
for (i = 0; i < na; ++i)
|
|
3451
|
+
var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x2 = new Array(na), c = new Array(nb), i;
|
|
3452
|
+
for (i = 0; i < na; ++i) x2[i] = value_default(a[i], b[i]);
|
|
1743
3453
|
for (; i < nb; ++i) c[i] = b[i];
|
|
1744
3454
|
return function(t) {
|
|
1745
|
-
for (i = 0; i < na; ++i) c[i] =
|
|
3455
|
+
for (i = 0; i < na; ++i) c[i] = x2[i](t);
|
|
1746
3456
|
return c;
|
|
1747
3457
|
};
|
|
1748
3458
|
}
|
|
@@ -1764,18 +3474,18 @@ function number_default(a, b) {
|
|
|
1764
3474
|
|
|
1765
3475
|
// node_modules/d3-interpolate/src/object.js
|
|
1766
3476
|
function object_default(a, b) {
|
|
1767
|
-
var i = {}, c = {},
|
|
3477
|
+
var i = {}, c = {}, k2;
|
|
1768
3478
|
if (a === null || typeof a !== "object") a = {};
|
|
1769
3479
|
if (b === null || typeof b !== "object") b = {};
|
|
1770
|
-
for (
|
|
1771
|
-
if (
|
|
1772
|
-
i[
|
|
3480
|
+
for (k2 in b) {
|
|
3481
|
+
if (k2 in a) {
|
|
3482
|
+
i[k2] = value_default(a[k2], b[k2]);
|
|
1773
3483
|
} else {
|
|
1774
|
-
c[
|
|
3484
|
+
c[k2] = b[k2];
|
|
1775
3485
|
}
|
|
1776
3486
|
}
|
|
1777
3487
|
return function(t) {
|
|
1778
|
-
for (
|
|
3488
|
+
for (k2 in i) c[k2] = i[k2](t);
|
|
1779
3489
|
return c;
|
|
1780
3490
|
};
|
|
1781
3491
|
}
|
|
@@ -1794,7 +3504,7 @@ function one(b) {
|
|
|
1794
3504
|
};
|
|
1795
3505
|
}
|
|
1796
3506
|
function string_default(a, b) {
|
|
1797
|
-
var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [],
|
|
3507
|
+
var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q2 = [];
|
|
1798
3508
|
a = a + "", b = b + "";
|
|
1799
3509
|
while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
|
|
1800
3510
|
if ((bs = bm.index) > bi) {
|
|
@@ -1807,7 +3517,7 @@ function string_default(a, b) {
|
|
|
1807
3517
|
else s[++i] = bm;
|
|
1808
3518
|
} else {
|
|
1809
3519
|
s[++i] = null;
|
|
1810
|
-
|
|
3520
|
+
q2.push({ i, x: number_default(am, bm) });
|
|
1811
3521
|
}
|
|
1812
3522
|
bi = reB.lastIndex;
|
|
1813
3523
|
}
|
|
@@ -1816,8 +3526,8 @@ function string_default(a, b) {
|
|
|
1816
3526
|
if (s[i]) s[i] += bs;
|
|
1817
3527
|
else s[++i] = bs;
|
|
1818
3528
|
}
|
|
1819
|
-
return s.length < 2 ?
|
|
1820
|
-
for (var i2 = 0, o; i2 < b; ++i2) s[(o =
|
|
3529
|
+
return s.length < 2 ? q2[0] ? one(q2[0].x) : zero(b) : (b = q2.length, function(t) {
|
|
3530
|
+
for (var i2 = 0, o; i2 < b; ++i2) s[(o = q2[i2]).i] = o.x(t);
|
|
1821
3531
|
return s.join("");
|
|
1822
3532
|
});
|
|
1823
3533
|
}
|
|
@@ -1874,49 +3584,49 @@ function interpolateTransform(parse, pxComma, pxParen, degParen) {
|
|
|
1874
3584
|
function pop(s) {
|
|
1875
3585
|
return s.length ? s.pop() + " " : "";
|
|
1876
3586
|
}
|
|
1877
|
-
function translate(xa, ya, xb, yb, s,
|
|
3587
|
+
function translate(xa, ya, xb, yb, s, q2) {
|
|
1878
3588
|
if (xa !== xb || ya !== yb) {
|
|
1879
3589
|
var i = s.push("translate(", null, pxComma, null, pxParen);
|
|
1880
|
-
|
|
3590
|
+
q2.push({ i: i - 4, x: number_default(xa, xb) }, { i: i - 2, x: number_default(ya, yb) });
|
|
1881
3591
|
} else if (xb || yb) {
|
|
1882
3592
|
s.push("translate(" + xb + pxComma + yb + pxParen);
|
|
1883
3593
|
}
|
|
1884
3594
|
}
|
|
1885
|
-
function rotate(a, b, s,
|
|
3595
|
+
function rotate(a, b, s, q2) {
|
|
1886
3596
|
if (a !== b) {
|
|
1887
3597
|
if (a - b > 180) b += 360;
|
|
1888
3598
|
else if (b - a > 180) a += 360;
|
|
1889
|
-
|
|
3599
|
+
q2.push({ i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number_default(a, b) });
|
|
1890
3600
|
} else if (b) {
|
|
1891
3601
|
s.push(pop(s) + "rotate(" + b + degParen);
|
|
1892
3602
|
}
|
|
1893
3603
|
}
|
|
1894
|
-
function skewX(a, b, s,
|
|
3604
|
+
function skewX(a, b, s, q2) {
|
|
1895
3605
|
if (a !== b) {
|
|
1896
|
-
|
|
3606
|
+
q2.push({ i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number_default(a, b) });
|
|
1897
3607
|
} else if (b) {
|
|
1898
3608
|
s.push(pop(s) + "skewX(" + b + degParen);
|
|
1899
3609
|
}
|
|
1900
3610
|
}
|
|
1901
|
-
function scale(xa, ya, xb, yb, s,
|
|
3611
|
+
function scale(xa, ya, xb, yb, s, q2) {
|
|
1902
3612
|
if (xa !== xb || ya !== yb) {
|
|
1903
3613
|
var i = s.push(pop(s) + "scale(", null, ",", null, ")");
|
|
1904
|
-
|
|
3614
|
+
q2.push({ i: i - 4, x: number_default(xa, xb) }, { i: i - 2, x: number_default(ya, yb) });
|
|
1905
3615
|
} else if (xb !== 1 || yb !== 1) {
|
|
1906
3616
|
s.push(pop(s) + "scale(" + xb + "," + yb + ")");
|
|
1907
3617
|
}
|
|
1908
3618
|
}
|
|
1909
3619
|
return function(a, b) {
|
|
1910
|
-
var s = [],
|
|
3620
|
+
var s = [], q2 = [];
|
|
1911
3621
|
a = parse(a), b = parse(b);
|
|
1912
|
-
translate(a.translateX, a.translateY, b.translateX, b.translateY, s,
|
|
1913
|
-
rotate(a.rotate, b.rotate, s,
|
|
1914
|
-
skewX(a.skewX, b.skewX, s,
|
|
1915
|
-
scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s,
|
|
3622
|
+
translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q2);
|
|
3623
|
+
rotate(a.rotate, b.rotate, s, q2);
|
|
3624
|
+
skewX(a.skewX, b.skewX, s, q2);
|
|
3625
|
+
scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q2);
|
|
1916
3626
|
a = b = null;
|
|
1917
3627
|
return function(t) {
|
|
1918
|
-
var i = -1, n =
|
|
1919
|
-
while (++i < n) s[(o =
|
|
3628
|
+
var i = -1, n = q2.length, o;
|
|
3629
|
+
while (++i < n) s[(o = q2[i]).i] = o.x(t);
|
|
1920
3630
|
return s.join("");
|
|
1921
3631
|
};
|
|
1922
3632
|
};
|
|
@@ -1926,32 +3636,32 @@ var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
|
|
|
1926
3636
|
|
|
1927
3637
|
// node_modules/d3-interpolate/src/zoom.js
|
|
1928
3638
|
var epsilon2 = 1e-12;
|
|
1929
|
-
function cosh(
|
|
1930
|
-
return ((
|
|
3639
|
+
function cosh(x2) {
|
|
3640
|
+
return ((x2 = Math.exp(x2)) + 1 / x2) / 2;
|
|
1931
3641
|
}
|
|
1932
|
-
function sinh(
|
|
1933
|
-
return ((
|
|
3642
|
+
function sinh(x2) {
|
|
3643
|
+
return ((x2 = Math.exp(x2)) - 1 / x2) / 2;
|
|
1934
3644
|
}
|
|
1935
|
-
function tanh(
|
|
1936
|
-
return ((
|
|
3645
|
+
function tanh(x2) {
|
|
3646
|
+
return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1);
|
|
1937
3647
|
}
|
|
1938
3648
|
var zoom_default = (function zoomRho(rho, rho2, rho4) {
|
|
1939
3649
|
function zoom(p0, p1) {
|
|
1940
|
-
var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i,
|
|
3650
|
+
var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S2;
|
|
1941
3651
|
if (d2 < epsilon2) {
|
|
1942
|
-
|
|
3652
|
+
S2 = Math.log(w1 / w0) / rho;
|
|
1943
3653
|
i = function(t) {
|
|
1944
3654
|
return [
|
|
1945
3655
|
ux0 + t * dx,
|
|
1946
3656
|
uy0 + t * dy,
|
|
1947
|
-
w0 * Math.exp(rho * t *
|
|
3657
|
+
w0 * Math.exp(rho * t * S2)
|
|
1948
3658
|
];
|
|
1949
3659
|
};
|
|
1950
3660
|
} else {
|
|
1951
3661
|
var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
|
|
1952
|
-
|
|
3662
|
+
S2 = (r1 - r0) / rho;
|
|
1953
3663
|
i = function(t) {
|
|
1954
|
-
var s = t *
|
|
3664
|
+
var s = t * S2, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
|
|
1955
3665
|
return [
|
|
1956
3666
|
ux0 + u * dx,
|
|
1957
3667
|
uy0 + u * dy,
|
|
@@ -1959,12 +3669,12 @@ var zoom_default = (function zoomRho(rho, rho2, rho4) {
|
|
|
1959
3669
|
];
|
|
1960
3670
|
};
|
|
1961
3671
|
}
|
|
1962
|
-
i.duration =
|
|
3672
|
+
i.duration = S2 * 1e3 * rho / Math.SQRT2;
|
|
1963
3673
|
return i;
|
|
1964
3674
|
}
|
|
1965
|
-
zoom.rho = function(
|
|
1966
|
-
var _1 = Math.max(1e-3, +
|
|
1967
|
-
return zoomRho(_1,
|
|
3675
|
+
zoom.rho = function(_2) {
|
|
3676
|
+
var _1 = Math.max(1e-3, +_2), _22 = _1 * _1, _4 = _22 * _22;
|
|
3677
|
+
return zoomRho(_1, _22, _4);
|
|
1968
3678
|
};
|
|
1969
3679
|
return zoom;
|
|
1970
3680
|
})(Math.SQRT2, 2, 4);
|
|
@@ -2137,7 +3847,7 @@ function create(node, id2, self) {
|
|
|
2137
3847
|
if (self.delay <= elapsed) start2(elapsed - self.delay);
|
|
2138
3848
|
}
|
|
2139
3849
|
function start2(elapsed) {
|
|
2140
|
-
var i,
|
|
3850
|
+
var i, j2, n, o;
|
|
2141
3851
|
if (self.state !== SCHEDULED) return stop();
|
|
2142
3852
|
for (i in schedules) {
|
|
2143
3853
|
o = schedules[i];
|
|
@@ -2167,12 +3877,12 @@ function create(node, id2, self) {
|
|
|
2167
3877
|
if (self.state !== STARTING) return;
|
|
2168
3878
|
self.state = STARTED;
|
|
2169
3879
|
tween = new Array(n = self.tween.length);
|
|
2170
|
-
for (i = 0,
|
|
3880
|
+
for (i = 0, j2 = -1; i < n; ++i) {
|
|
2171
3881
|
if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {
|
|
2172
|
-
tween[++
|
|
3882
|
+
tween[++j2] = o;
|
|
2173
3883
|
}
|
|
2174
3884
|
}
|
|
2175
|
-
tween.length =
|
|
3885
|
+
tween.length = j2 + 1;
|
|
2176
3886
|
}
|
|
2177
3887
|
function tick(elapsed) {
|
|
2178
3888
|
var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1), i = -1, n = tween.length;
|
|
@@ -2423,9 +4133,9 @@ function ease_default(value) {
|
|
|
2423
4133
|
// node_modules/d3-transition/src/transition/easeVarying.js
|
|
2424
4134
|
function easeVarying(id2, value) {
|
|
2425
4135
|
return function() {
|
|
2426
|
-
var
|
|
2427
|
-
if (typeof
|
|
2428
|
-
set2(this, id2).ease =
|
|
4136
|
+
var v2 = value.apply(this, arguments);
|
|
4137
|
+
if (typeof v2 !== "function") throw new Error();
|
|
4138
|
+
set2(this, id2).ease = v2;
|
|
2429
4139
|
};
|
|
2430
4140
|
}
|
|
2431
4141
|
function easeVarying_default(value) {
|
|
@@ -2436,8 +4146,8 @@ function easeVarying_default(value) {
|
|
|
2436
4146
|
// node_modules/d3-transition/src/transition/filter.js
|
|
2437
4147
|
function filter_default2(match) {
|
|
2438
4148
|
if (typeof match !== "function") match = matcher_default(match);
|
|
2439
|
-
for (var groups = this._groups, m = groups.length, subgroups = new Array(m),
|
|
2440
|
-
for (var group = groups[
|
|
4149
|
+
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
|
|
4150
|
+
for (var group = groups[j2], n = group.length, subgroup = subgroups[j2] = [], node, i = 0; i < n; ++i) {
|
|
2441
4151
|
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
|
2442
4152
|
subgroup.push(node);
|
|
2443
4153
|
}
|
|
@@ -2449,15 +4159,15 @@ function filter_default2(match) {
|
|
|
2449
4159
|
// node_modules/d3-transition/src/transition/merge.js
|
|
2450
4160
|
function merge_default2(transition2) {
|
|
2451
4161
|
if (transition2._id !== this._id) throw new Error();
|
|
2452
|
-
for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0),
|
|
2453
|
-
for (var group0 = groups0[
|
|
4162
|
+
for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m; ++j2) {
|
|
4163
|
+
for (var group0 = groups0[j2], group1 = groups1[j2], n = group0.length, merge = merges[j2] = new Array(n), node, i = 0; i < n; ++i) {
|
|
2454
4164
|
if (node = group0[i] || group1[i]) {
|
|
2455
4165
|
merge[i] = node;
|
|
2456
4166
|
}
|
|
2457
4167
|
}
|
|
2458
4168
|
}
|
|
2459
|
-
for (;
|
|
2460
|
-
merges[
|
|
4169
|
+
for (; j2 < m0; ++j2) {
|
|
4170
|
+
merges[j2] = groups0[j2];
|
|
2461
4171
|
}
|
|
2462
4172
|
return new Transition(merges, this._parents, this._name, this._id);
|
|
2463
4173
|
}
|
|
@@ -2473,8 +4183,8 @@ function start(name) {
|
|
|
2473
4183
|
function onFunction(id2, name, listener) {
|
|
2474
4184
|
var on0, on1, sit = start(name) ? init : set2;
|
|
2475
4185
|
return function() {
|
|
2476
|
-
var schedule = sit(this, id2),
|
|
2477
|
-
if (
|
|
4186
|
+
var schedule = sit(this, id2), on2 = schedule.on;
|
|
4187
|
+
if (on2 !== on0) (on1 = (on0 = on2).copy()).on(name, listener);
|
|
2478
4188
|
schedule.on = on1;
|
|
2479
4189
|
};
|
|
2480
4190
|
}
|
|
@@ -2499,8 +4209,8 @@ function remove_default2() {
|
|
|
2499
4209
|
function select_default3(select) {
|
|
2500
4210
|
var name = this._name, id2 = this._id;
|
|
2501
4211
|
if (typeof select !== "function") select = selector_default(select);
|
|
2502
|
-
for (var groups = this._groups, m = groups.length, subgroups = new Array(m),
|
|
2503
|
-
for (var group = groups[
|
|
4212
|
+
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
|
|
4213
|
+
for (var group = groups[j2], n = group.length, subgroup = subgroups[j2] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
|
2504
4214
|
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
|
2505
4215
|
if ("__data__" in node) subnode.__data__ = node.__data__;
|
|
2506
4216
|
subgroup[i] = subnode;
|
|
@@ -2515,12 +4225,12 @@ function select_default3(select) {
|
|
|
2515
4225
|
function selectAll_default2(select) {
|
|
2516
4226
|
var name = this._name, id2 = this._id;
|
|
2517
4227
|
if (typeof select !== "function") select = selectorAll_default(select);
|
|
2518
|
-
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [],
|
|
2519
|
-
for (var group = groups[
|
|
4228
|
+
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m; ++j2) {
|
|
4229
|
+
for (var group = groups[j2], n = group.length, node, i = 0; i < n; ++i) {
|
|
2520
4230
|
if (node = group[i]) {
|
|
2521
|
-
for (var children2 = select.call(node, node.__data__, i, group), child, inherit2 = get2(node, id2),
|
|
2522
|
-
if (child = children2[
|
|
2523
|
-
schedule_default(child, name, id2,
|
|
4231
|
+
for (var children2 = select.call(node, node.__data__, i, group), child, inherit2 = get2(node, id2), k2 = 0, l = children2.length; k2 < l; ++k2) {
|
|
4232
|
+
if (child = children2[k2]) {
|
|
4233
|
+
schedule_default(child, name, id2, k2, children2, inherit2);
|
|
2524
4234
|
}
|
|
2525
4235
|
}
|
|
2526
4236
|
subgroups.push(children2);
|
|
@@ -2568,8 +4278,8 @@ function styleFunction2(name, interpolate, value) {
|
|
|
2568
4278
|
function styleMaybeRemove(id2, name) {
|
|
2569
4279
|
var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
|
|
2570
4280
|
return function() {
|
|
2571
|
-
var schedule = set2(this, id2),
|
|
2572
|
-
if (
|
|
4281
|
+
var schedule = set2(this, id2), on2 = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : void 0;
|
|
4282
|
+
if (on2 !== on0 || listener0 !== listener) (on1 = (on0 = on2).copy()).on(event, listener0 = listener);
|
|
2573
4283
|
schedule.on = on1;
|
|
2574
4284
|
};
|
|
2575
4285
|
}
|
|
@@ -2645,8 +4355,8 @@ function textTween_default(value) {
|
|
|
2645
4355
|
// node_modules/d3-transition/src/transition/transition.js
|
|
2646
4356
|
function transition_default() {
|
|
2647
4357
|
var name = this._name, id0 = this._id, id1 = newId();
|
|
2648
|
-
for (var groups = this._groups, m = groups.length,
|
|
2649
|
-
for (var group = groups[
|
|
4358
|
+
for (var groups = this._groups, m = groups.length, j2 = 0; j2 < m; ++j2) {
|
|
4359
|
+
for (var group = groups[j2], n = group.length, node, i = 0; i < n; ++i) {
|
|
2650
4360
|
if (node = group[i]) {
|
|
2651
4361
|
var inherit2 = get2(node, id0);
|
|
2652
4362
|
schedule_default(node, name, id1, i, group, {
|
|
@@ -2669,9 +4379,9 @@ function end_default() {
|
|
|
2669
4379
|
if (--size === 0) resolve();
|
|
2670
4380
|
} };
|
|
2671
4381
|
that.each(function() {
|
|
2672
|
-
var schedule = set2(this, id2),
|
|
2673
|
-
if (
|
|
2674
|
-
on1 = (on0 =
|
|
4382
|
+
var schedule = set2(this, id2), on2 = schedule.on;
|
|
4383
|
+
if (on2 !== on0) {
|
|
4384
|
+
on1 = (on0 = on2).copy();
|
|
2675
4385
|
on1._.cancel.push(cancel);
|
|
2676
4386
|
on1._.interrupt.push(cancel);
|
|
2677
4387
|
on1._.end.push(end);
|
|
@@ -2756,8 +4466,8 @@ function transition_default2(name) {
|
|
|
2756
4466
|
} else {
|
|
2757
4467
|
id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
|
|
2758
4468
|
}
|
|
2759
|
-
for (var groups = this._groups, m = groups.length,
|
|
2760
|
-
for (var group = groups[
|
|
4469
|
+
for (var groups = this._groups, m = groups.length, j2 = 0; j2 < m; ++j2) {
|
|
4470
|
+
for (var group = groups[j2], n = group.length, node, i = 0; i < n; ++i) {
|
|
2761
4471
|
if (node = group[i]) {
|
|
2762
4472
|
schedule_default(node, name, id2, i, group, timing || inherit(node, id2));
|
|
2763
4473
|
}
|
|
@@ -2771,7 +4481,7 @@ selection_default.prototype.interrupt = interrupt_default2;
|
|
|
2771
4481
|
selection_default.prototype.transition = transition_default2;
|
|
2772
4482
|
|
|
2773
4483
|
// node_modules/d3-zoom/src/constant.js
|
|
2774
|
-
var constant_default4 = (
|
|
4484
|
+
var constant_default4 = (x2) => () => x2;
|
|
2775
4485
|
|
|
2776
4486
|
// node_modules/d3-zoom/src/event.js
|
|
2777
4487
|
function ZoomEvent(type, {
|
|
@@ -2790,24 +4500,24 @@ function ZoomEvent(type, {
|
|
|
2790
4500
|
}
|
|
2791
4501
|
|
|
2792
4502
|
// node_modules/d3-zoom/src/transform.js
|
|
2793
|
-
function Transform(
|
|
2794
|
-
this.k =
|
|
2795
|
-
this.x =
|
|
4503
|
+
function Transform(k2, x2, y) {
|
|
4504
|
+
this.k = k2;
|
|
4505
|
+
this.x = x2;
|
|
2796
4506
|
this.y = y;
|
|
2797
4507
|
}
|
|
2798
4508
|
Transform.prototype = {
|
|
2799
4509
|
constructor: Transform,
|
|
2800
|
-
scale: function(
|
|
2801
|
-
return
|
|
4510
|
+
scale: function(k2) {
|
|
4511
|
+
return k2 === 1 ? this : new Transform(this.k * k2, this.x, this.y);
|
|
2802
4512
|
},
|
|
2803
|
-
translate: function(
|
|
2804
|
-
return
|
|
4513
|
+
translate: function(x2, y) {
|
|
4514
|
+
return x2 === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x2, this.y + this.k * y);
|
|
2805
4515
|
},
|
|
2806
4516
|
apply: function(point) {
|
|
2807
4517
|
return [point[0] * this.k + this.x, point[1] * this.k + this.y];
|
|
2808
4518
|
},
|
|
2809
|
-
applyX: function(
|
|
2810
|
-
return
|
|
4519
|
+
applyX: function(x2) {
|
|
4520
|
+
return x2 * this.k + this.x;
|
|
2811
4521
|
},
|
|
2812
4522
|
applyY: function(y) {
|
|
2813
4523
|
return y * this.k + this.y;
|
|
@@ -2815,14 +4525,14 @@ Transform.prototype = {
|
|
|
2815
4525
|
invert: function(location) {
|
|
2816
4526
|
return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
|
|
2817
4527
|
},
|
|
2818
|
-
invertX: function(
|
|
2819
|
-
return (
|
|
4528
|
+
invertX: function(x2) {
|
|
4529
|
+
return (x2 - this.x) / this.k;
|
|
2820
4530
|
},
|
|
2821
4531
|
invertY: function(y) {
|
|
2822
4532
|
return (y - this.y) / this.k;
|
|
2823
4533
|
},
|
|
2824
|
-
rescaleX: function(
|
|
2825
|
-
return
|
|
4534
|
+
rescaleX: function(x2) {
|
|
4535
|
+
return x2.copy().domain(x2.range().map(this.invertX, this).map(x2.invert, x2));
|
|
2826
4536
|
},
|
|
2827
4537
|
rescaleY: function(y) {
|
|
2828
4538
|
return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
|
|
@@ -2895,42 +4605,42 @@ function zoom_default2() {
|
|
|
2895
4605
|
});
|
|
2896
4606
|
}
|
|
2897
4607
|
};
|
|
2898
|
-
zoom.scaleBy = function(selection2,
|
|
4608
|
+
zoom.scaleBy = function(selection2, k2, p2, event) {
|
|
2899
4609
|
zoom.scaleTo(selection2, function() {
|
|
2900
|
-
var k0 = this.__zoom.k, k1 = typeof
|
|
4610
|
+
var k0 = this.__zoom.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
|
|
2901
4611
|
return k0 * k1;
|
|
2902
|
-
},
|
|
4612
|
+
}, p2, event);
|
|
2903
4613
|
};
|
|
2904
|
-
zoom.scaleTo = function(selection2,
|
|
4614
|
+
zoom.scaleTo = function(selection2, k2, p2, event) {
|
|
2905
4615
|
zoom.transform(selection2, function() {
|
|
2906
|
-
var e = extent.apply(this, arguments), t0 = this.__zoom, p0 =
|
|
4616
|
+
var e = extent.apply(this, arguments), t0 = this.__zoom, p0 = p2 == null ? centroid(e) : typeof p2 === "function" ? p2.apply(this, arguments) : p2, p1 = t0.invert(p0), k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
|
|
2907
4617
|
return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);
|
|
2908
|
-
},
|
|
4618
|
+
}, p2, event);
|
|
2909
4619
|
};
|
|
2910
|
-
zoom.translateBy = function(selection2,
|
|
4620
|
+
zoom.translateBy = function(selection2, x2, y, event) {
|
|
2911
4621
|
zoom.transform(selection2, function() {
|
|
2912
4622
|
return constrain(this.__zoom.translate(
|
|
2913
|
-
typeof
|
|
4623
|
+
typeof x2 === "function" ? x2.apply(this, arguments) : x2,
|
|
2914
4624
|
typeof y === "function" ? y.apply(this, arguments) : y
|
|
2915
4625
|
), extent.apply(this, arguments), translateExtent);
|
|
2916
4626
|
}, null, event);
|
|
2917
4627
|
};
|
|
2918
|
-
zoom.translateTo = function(selection2,
|
|
4628
|
+
zoom.translateTo = function(selection2, x2, y, p2, event) {
|
|
2919
4629
|
zoom.transform(selection2, function() {
|
|
2920
|
-
var e = extent.apply(this, arguments), t = this.__zoom, p0 =
|
|
4630
|
+
var e = extent.apply(this, arguments), t = this.__zoom, p0 = p2 == null ? centroid(e) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
|
|
2921
4631
|
return constrain(identity2.translate(p0[0], p0[1]).scale(t.k).translate(
|
|
2922
|
-
typeof
|
|
4632
|
+
typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
|
|
2923
4633
|
typeof y === "function" ? -y.apply(this, arguments) : -y
|
|
2924
4634
|
), e, translateExtent);
|
|
2925
|
-
},
|
|
4635
|
+
}, p2, event);
|
|
2926
4636
|
};
|
|
2927
|
-
function scale(transform2,
|
|
2928
|
-
|
|
2929
|
-
return
|
|
4637
|
+
function scale(transform2, k2) {
|
|
4638
|
+
k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
|
|
4639
|
+
return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
|
|
2930
4640
|
}
|
|
2931
4641
|
function translate(transform2, p0, p1) {
|
|
2932
|
-
var
|
|
2933
|
-
return
|
|
4642
|
+
var x2 = p0[0] - p1[0] * transform2.k, y = p0[1] - p1[1] * transform2.k;
|
|
4643
|
+
return x2 === transform2.x && y === transform2.y ? transform2 : new Transform(transform2.k, x2, y);
|
|
2934
4644
|
}
|
|
2935
4645
|
function centroid(extent2) {
|
|
2936
4646
|
return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
|
|
@@ -2941,12 +4651,12 @@ function zoom_default2() {
|
|
|
2941
4651
|
}).on("interrupt.zoom end.zoom", function() {
|
|
2942
4652
|
gesture(this, arguments).event(event).end();
|
|
2943
4653
|
}).tween("zoom", function() {
|
|
2944
|
-
var that = this, args = arguments, g = gesture(that, args).event(event), e = extent.apply(that, args),
|
|
4654
|
+
var that = this, args = arguments, g = gesture(that, args).event(event), e = extent.apply(that, args), p2 = point == null ? centroid(e) : typeof point === "function" ? point.apply(that, args) : point, w3 = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), a = that.__zoom, b = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i = interpolate(a.invert(p2).concat(w3 / a.k), b.invert(p2).concat(w3 / b.k));
|
|
2945
4655
|
return function(t) {
|
|
2946
4656
|
if (t === 1) t = b;
|
|
2947
4657
|
else {
|
|
2948
|
-
var l = i(t),
|
|
2949
|
-
t = new Transform(
|
|
4658
|
+
var l = i(t), k2 = w3 / l[2];
|
|
4659
|
+
t = new Transform(k2, p2[0] - l[0] * k2, p2[1] - l[1] * k2);
|
|
2950
4660
|
}
|
|
2951
4661
|
g.zoom(null, t);
|
|
2952
4662
|
};
|
|
@@ -3007,21 +4717,21 @@ function zoom_default2() {
|
|
|
3007
4717
|
};
|
|
3008
4718
|
function wheeled(event, ...args) {
|
|
3009
4719
|
if (!filter2.apply(this, arguments)) return;
|
|
3010
|
-
var g = gesture(this, args).event(event), t = this.__zoom,
|
|
4720
|
+
var g = gesture(this, args).event(event), t = this.__zoom, k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta2.apply(this, arguments)))), p2 = pointer_default(event);
|
|
3011
4721
|
if (g.wheel) {
|
|
3012
|
-
if (g.mouse[0][0] !==
|
|
3013
|
-
g.mouse[1] = t.invert(g.mouse[0] =
|
|
4722
|
+
if (g.mouse[0][0] !== p2[0] || g.mouse[0][1] !== p2[1]) {
|
|
4723
|
+
g.mouse[1] = t.invert(g.mouse[0] = p2);
|
|
3014
4724
|
}
|
|
3015
4725
|
clearTimeout(g.wheel);
|
|
3016
|
-
} else if (t.k ===
|
|
4726
|
+
} else if (t.k === k2) return;
|
|
3017
4727
|
else {
|
|
3018
|
-
g.mouse = [
|
|
4728
|
+
g.mouse = [p2, t.invert(p2)];
|
|
3019
4729
|
interrupt_default(this);
|
|
3020
4730
|
g.start();
|
|
3021
4731
|
}
|
|
3022
4732
|
noevent_default2(event);
|
|
3023
4733
|
g.wheel = setTimeout(wheelidled, wheelDelay);
|
|
3024
|
-
g.zoom("mouse", constrain(translate(scale(t,
|
|
4734
|
+
g.zoom("mouse", constrain(translate(scale(t, k2), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
|
|
3025
4735
|
function wheelidled() {
|
|
3026
4736
|
g.wheel = null;
|
|
3027
4737
|
g.end();
|
|
@@ -3029,10 +4739,10 @@ function zoom_default2() {
|
|
|
3029
4739
|
}
|
|
3030
4740
|
function mousedowned(event, ...args) {
|
|
3031
4741
|
if (touchending || !filter2.apply(this, arguments)) return;
|
|
3032
|
-
var currentTarget = event.currentTarget, g = gesture(this, args, true).event(event),
|
|
4742
|
+
var currentTarget = event.currentTarget, g = gesture(this, args, true).event(event), v2 = select_default2(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true), p2 = pointer_default(event, currentTarget), x0 = event.clientX, y0 = event.clientY;
|
|
3033
4743
|
nodrag_default(event.view);
|
|
3034
4744
|
nopropagation2(event);
|
|
3035
|
-
g.mouse = [
|
|
4745
|
+
g.mouse = [p2, this.__zoom.invert(p2)];
|
|
3036
4746
|
interrupt_default(this);
|
|
3037
4747
|
g.start();
|
|
3038
4748
|
function mousemoved(event2) {
|
|
@@ -3044,7 +4754,7 @@ function zoom_default2() {
|
|
|
3044
4754
|
g.event(event2).zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = pointer_default(event2, currentTarget), g.mouse[1]), g.extent, translateExtent));
|
|
3045
4755
|
}
|
|
3046
4756
|
function mouseupped(event2) {
|
|
3047
|
-
|
|
4757
|
+
v2.on("mousemove.zoom mouseup.zoom", null);
|
|
3048
4758
|
yesdrag(event2.view, g.moved);
|
|
3049
4759
|
noevent_default2(event2);
|
|
3050
4760
|
g.event(event2).end();
|
|
@@ -3059,17 +4769,17 @@ function zoom_default2() {
|
|
|
3059
4769
|
}
|
|
3060
4770
|
function touchstarted(event, ...args) {
|
|
3061
4771
|
if (!filter2.apply(this, arguments)) return;
|
|
3062
|
-
var touches = event.touches, n = touches.length, g = gesture(this, args, event.changedTouches.length === n).event(event), started, i, t,
|
|
4772
|
+
var touches = event.touches, n = touches.length, g = gesture(this, args, event.changedTouches.length === n).event(event), started, i, t, p2;
|
|
3063
4773
|
nopropagation2(event);
|
|
3064
4774
|
for (i = 0; i < n; ++i) {
|
|
3065
|
-
t = touches[i],
|
|
3066
|
-
|
|
3067
|
-
if (!g.touch0) g.touch0 =
|
|
3068
|
-
else if (!g.touch1 && g.touch0[2] !==
|
|
4775
|
+
t = touches[i], p2 = pointer_default(t, this);
|
|
4776
|
+
p2 = [p2, this.__zoom.invert(p2), t.identifier];
|
|
4777
|
+
if (!g.touch0) g.touch0 = p2, started = true, g.taps = 1 + !!touchstarting;
|
|
4778
|
+
else if (!g.touch1 && g.touch0[2] !== p2[2]) g.touch1 = p2, g.taps = 0;
|
|
3069
4779
|
}
|
|
3070
4780
|
if (touchstarting) touchstarting = clearTimeout(touchstarting);
|
|
3071
4781
|
if (started) {
|
|
3072
|
-
if (g.taps < 2) touchfirst =
|
|
4782
|
+
if (g.taps < 2) touchfirst = p2[0], touchstarting = setTimeout(function() {
|
|
3073
4783
|
touchstarting = null;
|
|
3074
4784
|
}, touchDelay);
|
|
3075
4785
|
interrupt_default(this);
|
|
@@ -3078,22 +4788,22 @@ function zoom_default2() {
|
|
|
3078
4788
|
}
|
|
3079
4789
|
function touchmoved(event, ...args) {
|
|
3080
4790
|
if (!this.__zooming) return;
|
|
3081
|
-
var g = gesture(this, args).event(event), touches = event.changedTouches, n = touches.length, i, t,
|
|
4791
|
+
var g = gesture(this, args).event(event), touches = event.changedTouches, n = touches.length, i, t, p2, l;
|
|
3082
4792
|
noevent_default2(event);
|
|
3083
4793
|
for (i = 0; i < n; ++i) {
|
|
3084
|
-
t = touches[i],
|
|
3085
|
-
if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] =
|
|
3086
|
-
else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] =
|
|
4794
|
+
t = touches[i], p2 = pointer_default(t, this);
|
|
4795
|
+
if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p2;
|
|
4796
|
+
else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p2;
|
|
3087
4797
|
}
|
|
3088
4798
|
t = g.that.__zoom;
|
|
3089
4799
|
if (g.touch1) {
|
|
3090
4800
|
var p0 = g.touch0[0], l0 = g.touch0[1], p1 = g.touch1[0], l1 = g.touch1[1], dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
|
|
3091
4801
|
t = scale(t, Math.sqrt(dp / dl));
|
|
3092
|
-
|
|
4802
|
+
p2 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
|
|
3093
4803
|
l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
|
|
3094
|
-
} else if (g.touch0)
|
|
4804
|
+
} else if (g.touch0) p2 = g.touch0[0], l = g.touch0[1];
|
|
3095
4805
|
else return;
|
|
3096
|
-
g.zoom("touch", constrain(translate(t,
|
|
4806
|
+
g.zoom("touch", constrain(translate(t, p2, l), g.extent, translateExtent));
|
|
3097
4807
|
}
|
|
3098
4808
|
function touchended(event, ...args) {
|
|
3099
4809
|
if (!this.__zooming) return;
|
|
@@ -3115,48 +4825,48 @@ function zoom_default2() {
|
|
|
3115
4825
|
if (g.taps === 2) {
|
|
3116
4826
|
t = pointer_default(t, this);
|
|
3117
4827
|
if (Math.hypot(touchfirst[0] - t[0], touchfirst[1] - t[1]) < tapDistance) {
|
|
3118
|
-
var
|
|
3119
|
-
if (
|
|
4828
|
+
var p2 = select_default2(this).on("dblclick.zoom");
|
|
4829
|
+
if (p2) p2.apply(this, arguments);
|
|
3120
4830
|
}
|
|
3121
4831
|
}
|
|
3122
4832
|
}
|
|
3123
4833
|
}
|
|
3124
|
-
zoom.wheelDelta = function(
|
|
3125
|
-
return arguments.length ? (wheelDelta2 = typeof
|
|
4834
|
+
zoom.wheelDelta = function(_2) {
|
|
4835
|
+
return arguments.length ? (wheelDelta2 = typeof _2 === "function" ? _2 : constant_default4(+_2), zoom) : wheelDelta2;
|
|
3126
4836
|
};
|
|
3127
|
-
zoom.filter = function(
|
|
3128
|
-
return arguments.length ? (filter2 = typeof
|
|
4837
|
+
zoom.filter = function(_2) {
|
|
4838
|
+
return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : filter2;
|
|
3129
4839
|
};
|
|
3130
|
-
zoom.touchable = function(
|
|
3131
|
-
return arguments.length ? (touchable = typeof
|
|
4840
|
+
zoom.touchable = function(_2) {
|
|
4841
|
+
return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : touchable;
|
|
3132
4842
|
};
|
|
3133
|
-
zoom.extent = function(
|
|
3134
|
-
return arguments.length ? (extent = typeof
|
|
4843
|
+
zoom.extent = function(_2) {
|
|
4844
|
+
return arguments.length ? (extent = typeof _2 === "function" ? _2 : constant_default4([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
|
|
3135
4845
|
};
|
|
3136
|
-
zoom.scaleExtent = function(
|
|
3137
|
-
return arguments.length ? (scaleExtent[0] = +
|
|
4846
|
+
zoom.scaleExtent = function(_2) {
|
|
4847
|
+
return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
|
|
3138
4848
|
};
|
|
3139
|
-
zoom.translateExtent = function(
|
|
3140
|
-
return arguments.length ? (translateExtent[0][0] = +
|
|
4849
|
+
zoom.translateExtent = function(_2) {
|
|
4850
|
+
return arguments.length ? (translateExtent[0][0] = +_2[0][0], translateExtent[1][0] = +_2[1][0], translateExtent[0][1] = +_2[0][1], translateExtent[1][1] = +_2[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
|
|
3141
4851
|
};
|
|
3142
|
-
zoom.constrain = function(
|
|
3143
|
-
return arguments.length ? (constrain =
|
|
4852
|
+
zoom.constrain = function(_2) {
|
|
4853
|
+
return arguments.length ? (constrain = _2, zoom) : constrain;
|
|
3144
4854
|
};
|
|
3145
|
-
zoom.duration = function(
|
|
3146
|
-
return arguments.length ? (duration = +
|
|
4855
|
+
zoom.duration = function(_2) {
|
|
4856
|
+
return arguments.length ? (duration = +_2, zoom) : duration;
|
|
3147
4857
|
};
|
|
3148
|
-
zoom.interpolate = function(
|
|
3149
|
-
return arguments.length ? (interpolate =
|
|
4858
|
+
zoom.interpolate = function(_2) {
|
|
4859
|
+
return arguments.length ? (interpolate = _2, zoom) : interpolate;
|
|
3150
4860
|
};
|
|
3151
4861
|
zoom.on = function() {
|
|
3152
4862
|
var value = listeners3.on.apply(listeners3, arguments);
|
|
3153
4863
|
return value === listeners3 ? zoom : value;
|
|
3154
4864
|
};
|
|
3155
|
-
zoom.clickDistance = function(
|
|
3156
|
-
return arguments.length ? (clickDistance2 = (
|
|
4865
|
+
zoom.clickDistance = function(_2) {
|
|
4866
|
+
return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, zoom) : Math.sqrt(clickDistance2);
|
|
3157
4867
|
};
|
|
3158
|
-
zoom.tapDistance = function(
|
|
3159
|
-
return arguments.length ? (tapDistance = +
|
|
4868
|
+
zoom.tapDistance = function(_2) {
|
|
4869
|
+
return arguments.length ? (tapDistance = +_2, zoom) : tapDistance;
|
|
3160
4870
|
};
|
|
3161
4871
|
return zoom;
|
|
3162
4872
|
}
|
|
@@ -3188,7 +4898,7 @@ var elementSelectionKeys = ["Enter", " ", "Escape"];
|
|
|
3188
4898
|
var defaultAriaLabelConfig = {
|
|
3189
4899
|
"node.a11yDescription.default": "Press enter or space to select a node. Press delete to remove it and escape to cancel.",
|
|
3190
4900
|
"node.a11yDescription.keyboardDisabled": "Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.",
|
|
3191
|
-
"node.a11yDescription.ariaLiveMessage": ({ direction, x, y }) => `Moved selected node ${direction}. New position, x: ${
|
|
4901
|
+
"node.a11yDescription.ariaLiveMessage": ({ direction, x: x2, y }) => `Moved selected node ${direction}. New position, x: ${x2}, y: ${y}`,
|
|
3192
4902
|
"edge.a11yDescription.default": "Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.",
|
|
3193
4903
|
// Control elements
|
|
3194
4904
|
"controls.ariaLabel": "Control Panel",
|
|
@@ -3314,8 +5024,8 @@ var getNodesInside = (nodes, rect, [tx, ty, tScale] = [0, 0, 1], partially = fal
|
|
|
3314
5024
|
}
|
|
3315
5025
|
const width = measured.width ?? node.width ?? node.initialWidth ?? 0;
|
|
3316
5026
|
const height = measured.height ?? node.height ?? node.initialHeight ?? 0;
|
|
3317
|
-
const { x, y } = node.internals.positionAbsolute;
|
|
3318
|
-
const overlappingArea = getRectsOverlappingArea(paneX, paneY, paneWidth, paneHeight,
|
|
5027
|
+
const { x: x2, y } = node.internals.positionAbsolute;
|
|
5028
|
+
const overlappingArea = getRectsOverlappingArea(paneX, paneY, paneWidth, paneHeight, x2, y, width, height);
|
|
3319
5029
|
const area = width * height;
|
|
3320
5030
|
const partiallyVisible = partially && overlappingArea > 0;
|
|
3321
5031
|
const forceInitialRender = !node.internals.handleBounds;
|
|
@@ -3465,33 +5175,33 @@ var getBoundsOfBoxes = (box1, box2) => ({
|
|
|
3465
5175
|
x2: Math.max(box1.x2, box2.x2),
|
|
3466
5176
|
y2: Math.max(box1.y2, box2.y2)
|
|
3467
5177
|
});
|
|
3468
|
-
var rectToBox = ({ x, y, width, height }) => ({
|
|
3469
|
-
x,
|
|
5178
|
+
var rectToBox = ({ x: x2, y, width, height }) => ({
|
|
5179
|
+
x: x2,
|
|
3470
5180
|
y,
|
|
3471
|
-
x2:
|
|
5181
|
+
x2: x2 + width,
|
|
3472
5182
|
y2: y + height
|
|
3473
5183
|
});
|
|
3474
|
-
var boxToRect = ({ x, y, x2, y2 }) => ({
|
|
3475
|
-
x,
|
|
5184
|
+
var boxToRect = ({ x: x2, y, x2: x22, y2 }) => ({
|
|
5185
|
+
x: x2,
|
|
3476
5186
|
y,
|
|
3477
|
-
width:
|
|
5187
|
+
width: x22 - x2,
|
|
3478
5188
|
height: y2 - y
|
|
3479
5189
|
});
|
|
3480
5190
|
var nodeToRect = (node, nodeOrigin = [0, 0]) => {
|
|
3481
|
-
const { x, y } = isInternalNodeBase(node) ? node.internals.positionAbsolute : getNodePositionWithOrigin(node, nodeOrigin);
|
|
5191
|
+
const { x: x2, y } = isInternalNodeBase(node) ? node.internals.positionAbsolute : getNodePositionWithOrigin(node, nodeOrigin);
|
|
3482
5192
|
return {
|
|
3483
|
-
x,
|
|
5193
|
+
x: x2,
|
|
3484
5194
|
y,
|
|
3485
5195
|
width: node.measured?.width ?? node.width ?? node.initialWidth ?? 0,
|
|
3486
5196
|
height: node.measured?.height ?? node.height ?? node.initialHeight ?? 0
|
|
3487
5197
|
};
|
|
3488
5198
|
};
|
|
3489
5199
|
var nodeToBox = (node, nodeOrigin = [0, 0]) => {
|
|
3490
|
-
const { x, y } = isInternalNodeBase(node) ? node.internals.positionAbsolute : getNodePositionWithOrigin(node, nodeOrigin);
|
|
5200
|
+
const { x: x2, y } = isInternalNodeBase(node) ? node.internals.positionAbsolute : getNodePositionWithOrigin(node, nodeOrigin);
|
|
3491
5201
|
return {
|
|
3492
|
-
x,
|
|
5202
|
+
x: x2,
|
|
3493
5203
|
y,
|
|
3494
|
-
x2:
|
|
5204
|
+
x2: x2 + (node.measured?.width ?? node.width ?? node.initialWidth ?? 0),
|
|
3495
5205
|
y2: y + (node.measured?.height ?? node.height ?? node.initialHeight ?? 0)
|
|
3496
5206
|
};
|
|
3497
5207
|
};
|
|
@@ -3515,16 +5225,16 @@ var snapPosition = (position, snapGrid = [1, 1]) => {
|
|
|
3515
5225
|
y: snapGrid[1] * Math.round(position.y / snapGrid[1])
|
|
3516
5226
|
};
|
|
3517
5227
|
};
|
|
3518
|
-
var pointToRendererPoint = ({ x, y }, [tx, ty, tScale], snapToGrid = false, snapGrid = [1, 1]) => {
|
|
5228
|
+
var pointToRendererPoint = ({ x: x2, y }, [tx, ty, tScale], snapToGrid = false, snapGrid = [1, 1]) => {
|
|
3519
5229
|
const position = {
|
|
3520
|
-
x: (
|
|
5230
|
+
x: (x2 - tx) / tScale,
|
|
3521
5231
|
y: (y - ty) / tScale
|
|
3522
5232
|
};
|
|
3523
5233
|
return snapToGrid ? snapPosition(position, snapGrid) : position;
|
|
3524
5234
|
};
|
|
3525
|
-
var rendererPointToPoint = ({ x, y }, [tx, ty, tScale]) => {
|
|
5235
|
+
var rendererPointToPoint = ({ x: x2, y }, [tx, ty, tScale]) => {
|
|
3526
5236
|
return {
|
|
3527
|
-
x:
|
|
5237
|
+
x: x2 * tScale + tx,
|
|
3528
5238
|
y: y * tScale + ty
|
|
3529
5239
|
};
|
|
3530
5240
|
};
|
|
@@ -3569,9 +5279,9 @@ function parsePaddings(padding, width, height) {
|
|
|
3569
5279
|
}
|
|
3570
5280
|
return { top: 0, right: 0, bottom: 0, left: 0, x: 0, y: 0 };
|
|
3571
5281
|
}
|
|
3572
|
-
function calculateAppliedPaddings(bounds,
|
|
3573
|
-
const { x: left, y: top } = rendererPointToPoint(bounds, [
|
|
3574
|
-
const { x: boundRight, y: boundBottom } = rendererPointToPoint({ x: bounds.x + bounds.width, y: bounds.y + bounds.height }, [
|
|
5282
|
+
function calculateAppliedPaddings(bounds, x2, y, zoom, width, height) {
|
|
5283
|
+
const { x: left, y: top } = rendererPointToPoint(bounds, [x2, y, zoom]);
|
|
5284
|
+
const { x: boundRight, y: boundBottom } = rendererPointToPoint({ x: bounds.x + bounds.width, y: bounds.y + bounds.height }, [x2, y, zoom]);
|
|
3575
5285
|
const right = width - boundRight;
|
|
3576
5286
|
const bottom = height - boundBottom;
|
|
3577
5287
|
return {
|
|
@@ -3582,24 +5292,24 @@ function calculateAppliedPaddings(bounds, x, y, zoom, width, height) {
|
|
|
3582
5292
|
};
|
|
3583
5293
|
}
|
|
3584
5294
|
var getViewportForBounds = (bounds, width, height, minZoom, maxZoom, padding) => {
|
|
3585
|
-
const
|
|
3586
|
-
const xZoom = (width -
|
|
3587
|
-
const yZoom = (height -
|
|
5295
|
+
const p2 = parsePaddings(padding, width, height);
|
|
5296
|
+
const xZoom = (width - p2.x) / bounds.width;
|
|
5297
|
+
const yZoom = (height - p2.y) / bounds.height;
|
|
3588
5298
|
const zoom = Math.min(xZoom, yZoom);
|
|
3589
5299
|
const clampedZoom = clamp(zoom, minZoom, maxZoom);
|
|
3590
5300
|
const boundsCenterX = bounds.x + bounds.width / 2;
|
|
3591
5301
|
const boundsCenterY = bounds.y + bounds.height / 2;
|
|
3592
|
-
const
|
|
5302
|
+
const x2 = width / 2 - boundsCenterX * clampedZoom;
|
|
3593
5303
|
const y = height / 2 - boundsCenterY * clampedZoom;
|
|
3594
|
-
const newPadding = calculateAppliedPaddings(bounds,
|
|
5304
|
+
const newPadding = calculateAppliedPaddings(bounds, x2, y, clampedZoom, width, height);
|
|
3595
5305
|
const offset = {
|
|
3596
|
-
left: Math.min(newPadding.left -
|
|
3597
|
-
top: Math.min(newPadding.top -
|
|
3598
|
-
right: Math.min(newPadding.right -
|
|
3599
|
-
bottom: Math.min(newPadding.bottom -
|
|
5306
|
+
left: Math.min(newPadding.left - p2.left, 0),
|
|
5307
|
+
top: Math.min(newPadding.top - p2.top, 0),
|
|
5308
|
+
right: Math.min(newPadding.right - p2.right, 0),
|
|
5309
|
+
bottom: Math.min(newPadding.bottom - p2.bottom, 0)
|
|
3600
5310
|
};
|
|
3601
5311
|
return {
|
|
3602
|
-
x:
|
|
5312
|
+
x: x2 - offset.left + offset.right,
|
|
3603
5313
|
y: y - offset.top + offset.bottom,
|
|
3604
5314
|
zoom: clampedZoom
|
|
3605
5315
|
};
|
|
@@ -3651,8 +5361,8 @@ function mergeAriaLabelConfig(partial) {
|
|
|
3651
5361
|
return { ...defaultAriaLabelConfig, ...partial || {} };
|
|
3652
5362
|
}
|
|
3653
5363
|
function getPointerPosition(event, { snapGrid = [0, 0], snapToGrid = false, transform: transform2, containerBounds }) {
|
|
3654
|
-
const { x, y } = getEventPosition(event);
|
|
3655
|
-
const pointerPos = pointToRendererPoint({ x:
|
|
5364
|
+
const { x: x2, y } = getEventPosition(event);
|
|
5365
|
+
const pointerPos = pointToRendererPoint({ x: x2 - (containerBounds?.left ?? 0), y: y - (containerBounds?.top ?? 0) }, transform2);
|
|
3656
5366
|
const { x: xSnapped, y: ySnapped } = snapToGrid ? snapPosition(pointerPos, snapGrid) : pointerPos;
|
|
3657
5367
|
return {
|
|
3658
5368
|
xSnapped,
|
|
@@ -3964,18 +5674,18 @@ function getPoints({ source, sourcePosition = Position.Bottom, target, targetPos
|
|
|
3964
5674
|
}
|
|
3965
5675
|
function getBend(a, b, c, size) {
|
|
3966
5676
|
const bendSize = Math.min(distance(a, b) / 2, distance(b, c) / 2, size);
|
|
3967
|
-
const { x, y } = b;
|
|
3968
|
-
if (a.x ===
|
|
3969
|
-
return `L${
|
|
5677
|
+
const { x: x2, y } = b;
|
|
5678
|
+
if (a.x === x2 && x2 === c.x || a.y === y && y === c.y) {
|
|
5679
|
+
return `L${x2} ${y}`;
|
|
3970
5680
|
}
|
|
3971
5681
|
if (a.y === y) {
|
|
3972
5682
|
const xDir2 = a.x < c.x ? -1 : 1;
|
|
3973
5683
|
const yDir2 = a.y < c.y ? 1 : -1;
|
|
3974
|
-
return `L ${
|
|
5684
|
+
return `L ${x2 + bendSize * xDir2},${y}Q ${x2},${y} ${x2},${y + bendSize * yDir2}`;
|
|
3975
5685
|
}
|
|
3976
5686
|
const xDir = a.x < c.x ? 1 : -1;
|
|
3977
5687
|
const yDir = a.y < c.y ? -1 : 1;
|
|
3978
|
-
return `L ${
|
|
5688
|
+
return `L ${x2},${y + bendSize * yDir}Q ${x2},${y} ${x2 + bendSize * xDir},${y}`;
|
|
3979
5689
|
}
|
|
3980
5690
|
function getSmoothStepPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top, borderRadius = 5, centerX, centerY, offset = 20, stepPosition = 0.5 }) {
|
|
3981
5691
|
const [points, labelX, labelY, offsetX, offsetY] = getPoints({
|
|
@@ -4052,22 +5762,22 @@ function toHandleBounds(handles) {
|
|
|
4052
5762
|
};
|
|
4053
5763
|
}
|
|
4054
5764
|
function getHandlePosition(node, handle, fallbackPosition = Position.Left, center = false) {
|
|
4055
|
-
const
|
|
5765
|
+
const x2 = (handle?.x ?? 0) + node.internals.positionAbsolute.x;
|
|
4056
5766
|
const y = (handle?.y ?? 0) + node.internals.positionAbsolute.y;
|
|
4057
5767
|
const { width, height } = handle ?? getNodeDimensions(node);
|
|
4058
5768
|
if (center) {
|
|
4059
|
-
return { x:
|
|
5769
|
+
return { x: x2 + width / 2, y: y + height / 2 };
|
|
4060
5770
|
}
|
|
4061
5771
|
const position = handle?.position ?? fallbackPosition;
|
|
4062
5772
|
switch (position) {
|
|
4063
5773
|
case Position.Top:
|
|
4064
|
-
return { x:
|
|
5774
|
+
return { x: x2 + width / 2, y };
|
|
4065
5775
|
case Position.Right:
|
|
4066
|
-
return { x:
|
|
5776
|
+
return { x: x2 + width, y: y + height / 2 };
|
|
4067
5777
|
case Position.Bottom:
|
|
4068
|
-
return { x:
|
|
5778
|
+
return { x: x2 + width / 2, y: y + height };
|
|
4069
5779
|
case Position.Left:
|
|
4070
|
-
return { x, y: y + height / 2 };
|
|
5780
|
+
return { x: x2, y: y + height / 2 };
|
|
4071
5781
|
}
|
|
4072
5782
|
}
|
|
4073
5783
|
function getHandle$1(bounds, handleId) {
|
|
@@ -4273,16 +5983,16 @@ function updateChildNode(node, nodeLookup, parentLookup, options, rootParentInde
|
|
|
4273
5983
|
rootParentIndex.i = parentNode.internals.rootParentIndex;
|
|
4274
5984
|
}
|
|
4275
5985
|
const selectedNodeZ = elevateNodesOnSelect && !isManualZIndexMode(zIndexMode) ? SELECTED_NODE_Z : 0;
|
|
4276
|
-
const { x, y, z } = calculateChildXYZ(node, parentNode, nodeOrigin, nodeExtent, selectedNodeZ, zIndexMode);
|
|
5986
|
+
const { x: x2, y, z: z2 } = calculateChildXYZ(node, parentNode, nodeOrigin, nodeExtent, selectedNodeZ, zIndexMode);
|
|
4277
5987
|
const { positionAbsolute } = node.internals;
|
|
4278
|
-
const positionChanged =
|
|
4279
|
-
if (positionChanged ||
|
|
5988
|
+
const positionChanged = x2 !== positionAbsolute.x || y !== positionAbsolute.y;
|
|
5989
|
+
if (positionChanged || z2 !== node.internals.z) {
|
|
4280
5990
|
nodeLookup.set(node.id, {
|
|
4281
5991
|
...node,
|
|
4282
5992
|
internals: {
|
|
4283
5993
|
...node.internals,
|
|
4284
|
-
positionAbsolute: positionChanged ? { x, y } : positionAbsolute,
|
|
4285
|
-
z
|
|
5994
|
+
positionAbsolute: positionChanged ? { x: x2, y } : positionAbsolute,
|
|
5995
|
+
z: z2
|
|
4286
5996
|
}
|
|
4287
5997
|
});
|
|
4288
5998
|
}
|
|
@@ -4568,13 +6278,13 @@ function getEventHandlerParams({ nodeId, dragItems, nodeLookup, dragging = true
|
|
|
4568
6278
|
nodesFromDragItems
|
|
4569
6279
|
];
|
|
4570
6280
|
}
|
|
4571
|
-
function calculateSnapOffset({ dragItems, snapGrid, x, y }) {
|
|
6281
|
+
function calculateSnapOffset({ dragItems, snapGrid, x: x2, y }) {
|
|
4572
6282
|
const refDragItem = dragItems.values().next().value;
|
|
4573
6283
|
if (!refDragItem) {
|
|
4574
6284
|
return null;
|
|
4575
6285
|
}
|
|
4576
6286
|
const refPos = {
|
|
4577
|
-
x:
|
|
6287
|
+
x: x2 - refDragItem.distance.x,
|
|
4578
6288
|
y: y - refDragItem.distance.y
|
|
4579
6289
|
};
|
|
4580
6290
|
const refPosSnapped = snapPosition(refPos, snapGrid);
|
|
@@ -4597,23 +6307,23 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
4597
6307
|
let dragEvent = null;
|
|
4598
6308
|
function update({ noDragClassName, handleSelector, domNode, isSelectable, nodeId, nodeClickDistance = 0 }) {
|
|
4599
6309
|
d3Selection = select_default2(domNode);
|
|
4600
|
-
function updateNodes({ x, y }) {
|
|
6310
|
+
function updateNodes({ x: x2, y }) {
|
|
4601
6311
|
const { nodeLookup, nodeExtent, snapGrid, snapToGrid, nodeOrigin, onNodeDrag, onSelectionDrag, onError, updateNodePositions } = getStoreItems();
|
|
4602
|
-
lastPos = { x, y };
|
|
6312
|
+
lastPos = { x: x2, y };
|
|
4603
6313
|
let hasChange = false;
|
|
4604
6314
|
const isMultiDrag = dragItems.size > 1;
|
|
4605
6315
|
const nodesBox = isMultiDrag && nodeExtent ? rectToBox(getInternalNodesBounds(dragItems)) : null;
|
|
4606
6316
|
const multiDragSnapOffset = isMultiDrag && snapToGrid ? calculateSnapOffset({
|
|
4607
6317
|
dragItems,
|
|
4608
6318
|
snapGrid,
|
|
4609
|
-
x,
|
|
6319
|
+
x: x2,
|
|
4610
6320
|
y
|
|
4611
6321
|
}) : null;
|
|
4612
6322
|
for (const [id2, dragItem] of dragItems) {
|
|
4613
6323
|
if (!nodeLookup.has(id2)) {
|
|
4614
6324
|
continue;
|
|
4615
6325
|
}
|
|
4616
|
-
let nextPosition = { x:
|
|
6326
|
+
let nextPosition = { x: x2 - dragItem.distance.x, y: y - dragItem.distance.y };
|
|
4617
6327
|
if (snapToGrid) {
|
|
4618
6328
|
nextPosition = multiDragSnapOffset ? {
|
|
4619
6329
|
x: Math.round(nextPosition.x + multiDragSnapOffset.x),
|
|
@@ -4624,12 +6334,12 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
4624
6334
|
if (isMultiDrag && nodeExtent && !dragItem.extent && nodesBox) {
|
|
4625
6335
|
const { positionAbsolute: positionAbsolute2 } = dragItem.internals;
|
|
4626
6336
|
const x1 = positionAbsolute2.x - nodesBox.x + nodeExtent[0][0];
|
|
4627
|
-
const
|
|
6337
|
+
const x22 = positionAbsolute2.x + dragItem.measured.width - nodesBox.x2 + nodeExtent[1][0];
|
|
4628
6338
|
const y1 = positionAbsolute2.y - nodesBox.y + nodeExtent[0][1];
|
|
4629
6339
|
const y2 = positionAbsolute2.y + dragItem.measured.height - nodesBox.y2 + nodeExtent[1][1];
|
|
4630
6340
|
adjustedNodeExtent = [
|
|
4631
6341
|
[x1, y1],
|
|
4632
|
-
[
|
|
6342
|
+
[x22, y2]
|
|
4633
6343
|
];
|
|
4634
6344
|
}
|
|
4635
6345
|
const { position, positionAbsolute } = calculateNodePosition({
|
|
@@ -4738,9 +6448,9 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
|
|
|
4738
6448
|
}
|
|
4739
6449
|
if (!dragStarted) {
|
|
4740
6450
|
const currentMousePosition = getEventPosition(event.sourceEvent, containerBounds);
|
|
4741
|
-
const
|
|
6451
|
+
const x2 = currentMousePosition.x - mousePosition.x;
|
|
4742
6452
|
const y = currentMousePosition.y - mousePosition.y;
|
|
4743
|
-
const distance2 = Math.sqrt(
|
|
6453
|
+
const distance2 = Math.sqrt(x2 * x2 + y * y);
|
|
4744
6454
|
if (distance2 > nodeDragThreshold) {
|
|
4745
6455
|
startDrag(event);
|
|
4746
6456
|
}
|
|
@@ -4820,16 +6530,16 @@ function getClosestHandle(position, connectionRadius, nodeLookup, fromHandle) {
|
|
|
4820
6530
|
if (fromHandle.nodeId === handle.nodeId && fromHandle.type === handle.type && fromHandle.id === handle.id) {
|
|
4821
6531
|
continue;
|
|
4822
6532
|
}
|
|
4823
|
-
const { x, y } = getHandlePosition(node, handle, handle.position, true);
|
|
4824
|
-
const distance2 = Math.sqrt(Math.pow(
|
|
6533
|
+
const { x: x2, y } = getHandlePosition(node, handle, handle.position, true);
|
|
6534
|
+
const distance2 = Math.sqrt(Math.pow(x2 - position.x, 2) + Math.pow(y - position.y, 2));
|
|
4825
6535
|
if (distance2 > connectionRadius) {
|
|
4826
6536
|
continue;
|
|
4827
6537
|
}
|
|
4828
6538
|
if (distance2 < minDistance) {
|
|
4829
|
-
closestHandles = [{ ...handle, x, y }];
|
|
6539
|
+
closestHandles = [{ ...handle, x: x2, y }];
|
|
4830
6540
|
minDistance = distance2;
|
|
4831
6541
|
} else if (distance2 === minDistance) {
|
|
4832
|
-
closestHandles.push({ ...handle, x, y });
|
|
6542
|
+
closestHandles.push({ ...handle, x: x2, y });
|
|
4833
6543
|
}
|
|
4834
6544
|
}
|
|
4835
6545
|
}
|
|
@@ -4848,7 +6558,7 @@ function getHandle(nodeId, handleType, handleId, nodeLookup, connectionMode, wit
|
|
|
4848
6558
|
return null;
|
|
4849
6559
|
}
|
|
4850
6560
|
const handles = connectionMode === "strict" ? node.internals.handleBounds?.[handleType] : [...node.internals.handleBounds?.source ?? [], ...node.internals.handleBounds?.target ?? []];
|
|
4851
|
-
const handle = (handleId ? handles?.find((
|
|
6561
|
+
const handle = (handleId ? handles?.find((h2) => h2.id === handleId) : handles?.[0]) ?? null;
|
|
4852
6562
|
return handle && withAbsolutePosition ? { ...handle, ...getHandlePosition(node, handle, handle.position, true) } : handle;
|
|
4853
6563
|
}
|
|
4854
6564
|
function getHandleType(edgeUpdaterType, handleDomNode) {
|
|
@@ -4875,7 +6585,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
4875
6585
|
const doc = getHostForElement(event.target);
|
|
4876
6586
|
let autoPanId = 0;
|
|
4877
6587
|
let closestHandle;
|
|
4878
|
-
const { x, y } = getEventPosition(event);
|
|
6588
|
+
const { x: x2, y } = getEventPosition(event);
|
|
4879
6589
|
const handleType = getHandleType(edgeUpdaterType, handleDomNode);
|
|
4880
6590
|
const containerBounds = domNode?.getBoundingClientRect();
|
|
4881
6591
|
let connectionStarted = false;
|
|
@@ -4895,8 +6605,8 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
4895
6605
|
if (!autoPanOnConnect || !containerBounds) {
|
|
4896
6606
|
return;
|
|
4897
6607
|
}
|
|
4898
|
-
const [
|
|
4899
|
-
panBy2({ x:
|
|
6608
|
+
const [x3, y2] = calcAutoPan(position, containerBounds, autoPanSpeed);
|
|
6609
|
+
panBy2({ x: x3, y: y2 });
|
|
4900
6610
|
autoPanId = requestAnimationFrame(autoPan);
|
|
4901
6611
|
}
|
|
4902
6612
|
const fromHandle = {
|
|
@@ -4931,7 +6641,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
4931
6641
|
function onPointerMove(event2) {
|
|
4932
6642
|
if (!connectionStarted) {
|
|
4933
6643
|
const { x: evtX, y: evtY } = getEventPosition(event2);
|
|
4934
|
-
const dx = evtX -
|
|
6644
|
+
const dx = evtX - x2;
|
|
4935
6645
|
const dy = evtY - y;
|
|
4936
6646
|
const nextConnectionStarted = dx * dx + dy * dy > dragThreshold * dragThreshold;
|
|
4937
6647
|
if (!nextConnectionStarted) {
|
|
@@ -5017,8 +6727,8 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
5017
6727
|
function isValidHandle(event, { handle, connectionMode, fromNodeId, fromHandleId, fromType, doc, lib, flowId, isValidConnection = alwaysValid, nodeLookup }) {
|
|
5018
6728
|
const isTarget = fromType === "target";
|
|
5019
6729
|
const handleDomNode = handle ? doc.querySelector(`.${lib}-flow__handle[data-id="${flowId}-${handle?.nodeId}-${handle?.id}-${handle?.type}"]`) : null;
|
|
5020
|
-
const { x, y } = getEventPosition(event);
|
|
5021
|
-
const handleBelow = doc.elementFromPoint(
|
|
6730
|
+
const { x: x2, y } = getEventPosition(event);
|
|
6731
|
+
const handleBelow = doc.elementFromPoint(x2, y);
|
|
5022
6732
|
const handleToCheck = handleBelow?.classList.contains(`${lib}-flow__handle`) ? handleBelow : handleDomNode;
|
|
5023
6733
|
const result = {
|
|
5024
6734
|
handleDomNode: handleToCheck,
|
|
@@ -5118,7 +6828,7 @@ var transformToViewport = (transform2) => ({
|
|
|
5118
6828
|
y: transform2.y,
|
|
5119
6829
|
zoom: transform2.k
|
|
5120
6830
|
});
|
|
5121
|
-
var viewportToTransform = ({ x, y, zoom }) => identity2.translate(
|
|
6831
|
+
var viewportToTransform = ({ x: x2, y, zoom }) => identity2.translate(x2, y).scale(zoom);
|
|
5122
6832
|
var isWrappedWithClass = (event, className) => event.target.closest(`.${className}`);
|
|
5123
6833
|
var isRightClickPan = (panOnDrag, usedButton) => usedButton === 2 && Array.isArray(panOnDrag) && panOnDrag.includes(2);
|
|
5124
6834
|
var defaultEase = (t) => ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
|
|
@@ -5613,12 +7323,12 @@ function getDimensionsAfterResize(startValues, controlDirection, pointerPosition
|
|
|
5613
7323
|
}
|
|
5614
7324
|
}
|
|
5615
7325
|
}
|
|
5616
|
-
const
|
|
7326
|
+
const x2 = affectsX ? startX + distX : startX;
|
|
5617
7327
|
const y = affectsY ? startY + distY : startY;
|
|
5618
7328
|
return {
|
|
5619
7329
|
width: startWidth + (affectsX ? -distX : distX),
|
|
5620
7330
|
height: startHeight + (affectsY ? -distY : distY),
|
|
5621
|
-
x: nodeOrigin[0] * distX * (!affectsX ? 1 : -1) +
|
|
7331
|
+
x: nodeOrigin[0] * distX * (!affectsX ? 1 : -1) + x2,
|
|
5622
7332
|
y: nodeOrigin[1] * distY * (!affectsY ? 1 : -1) + y
|
|
5623
7333
|
};
|
|
5624
7334
|
}
|
|
@@ -5630,15 +7340,15 @@ var initStartValues = {
|
|
|
5630
7340
|
aspectRatio: 1
|
|
5631
7341
|
};
|
|
5632
7342
|
function nodeToChildExtent(child, parent, nodeOrigin) {
|
|
5633
|
-
const
|
|
7343
|
+
const x2 = parent.position.x + child.position.x;
|
|
5634
7344
|
const y = parent.position.y + child.position.y;
|
|
5635
7345
|
const width = child.measured.width ?? 0;
|
|
5636
7346
|
const height = child.measured.height ?? 0;
|
|
5637
7347
|
const originOffsetX = nodeOrigin[0] * width;
|
|
5638
7348
|
const originOffsetY = nodeOrigin[1] * height;
|
|
5639
7349
|
return [
|
|
5640
|
-
[
|
|
5641
|
-
[
|
|
7350
|
+
[x2 - originOffsetX, y - originOffsetY],
|
|
7351
|
+
[x2 + width - originOffsetX, y + height - originOffsetY]
|
|
5642
7352
|
];
|
|
5643
7353
|
}
|
|
5644
7354
|
function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
@@ -5744,21 +7454,21 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
5744
7454
|
const { x: prevX, y: prevY, width: prevWidth, height: prevHeight } = prevValues;
|
|
5745
7455
|
const change = {};
|
|
5746
7456
|
const nodeOrigin = node.origin ?? storeNodeOrigin;
|
|
5747
|
-
const { width, height, x, y } = getDimensionsAfterResize(startValues, params.controlDirection, pointerPosition, params.boundaries, params.keepAspectRatio, nodeOrigin, nodeExtent, childExtent);
|
|
7457
|
+
const { width, height, x: x2, y } = getDimensionsAfterResize(startValues, params.controlDirection, pointerPosition, params.boundaries, params.keepAspectRatio, nodeOrigin, nodeExtent, childExtent);
|
|
5748
7458
|
const isWidthChange = width !== prevWidth;
|
|
5749
7459
|
const isHeightChange = height !== prevHeight;
|
|
5750
|
-
const isXPosChange =
|
|
7460
|
+
const isXPosChange = x2 !== prevX && isWidthChange;
|
|
5751
7461
|
const isYPosChange = y !== prevY && isHeightChange;
|
|
5752
7462
|
if (!isXPosChange && !isYPosChange && !isWidthChange && !isHeightChange) {
|
|
5753
7463
|
return;
|
|
5754
7464
|
}
|
|
5755
7465
|
if (isXPosChange || isYPosChange || nodeOrigin[0] === 1 || nodeOrigin[1] === 1) {
|
|
5756
|
-
change.x = isXPosChange ?
|
|
7466
|
+
change.x = isXPosChange ? x2 : prevValues.x;
|
|
5757
7467
|
change.y = isYPosChange ? y : prevValues.y;
|
|
5758
7468
|
prevValues.x = change.x;
|
|
5759
7469
|
prevValues.y = change.y;
|
|
5760
7470
|
if (childNodes.length > 0) {
|
|
5761
|
-
const xChange =
|
|
7471
|
+
const xChange = x2 - prevX;
|
|
5762
7472
|
const yChange = y - prevY;
|
|
5763
7473
|
for (const childNode of childNodes) {
|
|
5764
7474
|
childNode.position = {
|
|
@@ -6053,7 +7763,7 @@ function SelectionListenerInner({ onSelectionChange }) {
|
|
|
6053
7763
|
ReactExports.useEffect(() => {
|
|
6054
7764
|
const params = { nodes: selectedNodes, edges: selectedEdges };
|
|
6055
7765
|
onSelectionChange?.(params);
|
|
6056
|
-
store.getState().onSelectionChangeHandlers.forEach((
|
|
7766
|
+
store.getState().onSelectionChangeHandlers.forEach((fn2) => fn2(params));
|
|
6057
7767
|
}, [selectedNodes, selectedEdges, onSelectionChange]);
|
|
6058
7768
|
return null;
|
|
6059
7769
|
}
|
|
@@ -6290,7 +8000,7 @@ function useKeyPress(keyCode = null, options = { target: defaultDoc, actInsideIn
|
|
|
6290
8000
|
return keyPressed;
|
|
6291
8001
|
}
|
|
6292
8002
|
function isMatchingKey(keyCodes, pressedKeys, isUp) {
|
|
6293
|
-
return keyCodes.filter((keys) => isUp || keys.length === pressedKeys.size).some((keys) => keys.every((
|
|
8003
|
+
return keyCodes.filter((keys) => isUp || keys.length === pressedKeys.size).some((keys) => keys.every((k2) => pressedKeys.has(k2)));
|
|
6294
8004
|
}
|
|
6295
8005
|
function useKeyOrCode(eventCode, keysToWatch) {
|
|
6296
8006
|
return keysToWatch.includes(eventCode) ? "code" : "key";
|
|
@@ -6325,11 +8035,11 @@ var useViewportHelper = () => {
|
|
|
6325
8035
|
return true;
|
|
6326
8036
|
},
|
|
6327
8037
|
getViewport: () => {
|
|
6328
|
-
const [
|
|
6329
|
-
return { x, y, zoom };
|
|
8038
|
+
const [x2, y, zoom] = store.getState().transform;
|
|
8039
|
+
return { x: x2, y, zoom };
|
|
6330
8040
|
},
|
|
6331
|
-
setCenter: async (
|
|
6332
|
-
return store.getState().setCenter(
|
|
8041
|
+
setCenter: async (x2, y, options) => {
|
|
8042
|
+
return store.getState().setCenter(x2, y, options);
|
|
6333
8043
|
},
|
|
6334
8044
|
fitBounds: async (bounds, options) => {
|
|
6335
8045
|
const { width, height, minZoom, maxZoom, panZoom } = store.getState();
|
|
@@ -6677,12 +8387,12 @@ function useReactFlow() {
|
|
|
6677
8387
|
},
|
|
6678
8388
|
toObject: () => {
|
|
6679
8389
|
const { nodes = [], edges = [], transform: transform2 } = store.getState();
|
|
6680
|
-
const [
|
|
8390
|
+
const [x2, y, zoom] = transform2;
|
|
6681
8391
|
return {
|
|
6682
8392
|
nodes: nodes.map((n) => ({ ...n })),
|
|
6683
8393
|
edges: edges.map((e) => ({ ...e })),
|
|
6684
8394
|
viewport: {
|
|
6685
|
-
x,
|
|
8395
|
+
x: x2,
|
|
6686
8396
|
y,
|
|
6687
8397
|
zoom
|
|
6688
8398
|
}
|
|
@@ -6878,10 +8588,10 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
|
|
|
6878
8588
|
onViewportChangeEnd?.(vp);
|
|
6879
8589
|
}
|
|
6880
8590
|
});
|
|
6881
|
-
const { x, y, zoom } = panZoom.current.getViewport();
|
|
8591
|
+
const { x: x2, y, zoom } = panZoom.current.getViewport();
|
|
6882
8592
|
store.setState({
|
|
6883
8593
|
panZoom: panZoom.current,
|
|
6884
|
-
transform: [
|
|
8594
|
+
transform: [x2, y, zoom],
|
|
6885
8595
|
domNode: zoomPane.current.closest(".react-flow")
|
|
6886
8596
|
});
|
|
6887
8597
|
return () => {
|
|
@@ -7013,15 +8723,15 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
7013
8723
|
}
|
|
7014
8724
|
event.target?.setPointerCapture?.(event.pointerId);
|
|
7015
8725
|
selectionInProgress.current = false;
|
|
7016
|
-
const { x, y } = getEventPosition(event.nativeEvent, containerBounds.current);
|
|
7017
|
-
const userSelectionStartPosition = pointToRendererPoint({ x, y }, transform2);
|
|
8726
|
+
const { x: x2, y } = getEventPosition(event.nativeEvent, containerBounds.current);
|
|
8727
|
+
const userSelectionStartPosition = pointToRendererPoint({ x: x2, y }, transform2);
|
|
7018
8728
|
store.setState({
|
|
7019
8729
|
userSelectionRect: {
|
|
7020
8730
|
width: 0,
|
|
7021
8731
|
height: 0,
|
|
7022
8732
|
startX: userSelectionStartPosition.x,
|
|
7023
8733
|
startY: userSelectionStartPosition.y,
|
|
7024
|
-
x,
|
|
8734
|
+
x: x2,
|
|
7025
8735
|
y
|
|
7026
8736
|
}
|
|
7027
8737
|
});
|
|
@@ -7080,8 +8790,8 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
7080
8790
|
if (!autoPanOnSelection || !containerBounds.current) {
|
|
7081
8791
|
return;
|
|
7082
8792
|
}
|
|
7083
|
-
const [
|
|
7084
|
-
panBy2({ x, y }).then((panned) => {
|
|
8793
|
+
const [x2, y] = calcAutoPan(position.current, containerBounds.current, autoPanSpeed);
|
|
8794
|
+
panBy2({ x: x2, y }).then((panned) => {
|
|
7085
8795
|
if (!selectionInProgress.current || !panned) {
|
|
7086
8796
|
autoPanId.current = requestAnimationFrame(autoPan);
|
|
7087
8797
|
return;
|
|
@@ -7459,14 +9169,14 @@ function getNodeInlineStyleDimensions(node) {
|
|
|
7459
9169
|
};
|
|
7460
9170
|
}
|
|
7461
9171
|
var selector$f = (s) => {
|
|
7462
|
-
const { width, height, x, y } = getInternalNodesBounds(s.nodeLookup, {
|
|
9172
|
+
const { width, height, x: x2, y } = getInternalNodesBounds(s.nodeLookup, {
|
|
7463
9173
|
filter: (node) => !!node.selected
|
|
7464
9174
|
});
|
|
7465
9175
|
return {
|
|
7466
9176
|
width: isNumeric(width) ? width : null,
|
|
7467
9177
|
height: isNumeric(height) ? height : null,
|
|
7468
9178
|
userSelectionActive: s.userSelectionActive,
|
|
7469
|
-
transformString: `translate(${s.transform[0]}px,${s.transform[1]}px) scale(${s.transform[2]}) translate(${
|
|
9179
|
+
transformString: `translate(${s.transform[0]}px,${s.transform[1]}px) scale(${s.transform[2]}) translate(${x2}px,${y}px)`
|
|
7470
9180
|
};
|
|
7471
9181
|
};
|
|
7472
9182
|
function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboardA11y }) {
|
|
@@ -7851,7 +9561,7 @@ var MarkerDefinitions = ({ defaultColor, rfId }) => {
|
|
|
7851
9561
|
};
|
|
7852
9562
|
MarkerDefinitions.displayName = "MarkerDefinitions";
|
|
7853
9563
|
var MarkerDefinitions$1 = ReactExports.memo(MarkerDefinitions);
|
|
7854
|
-
function EdgeTextComponent({ x, y, label, labelStyle, labelShowBg = true, labelBgStyle, labelBgPadding = [2, 4], labelBgBorderRadius = 2, children: children2, className, ...rest }) {
|
|
9564
|
+
function EdgeTextComponent({ x: x2, y, label, labelStyle, labelShowBg = true, labelBgStyle, labelBgPadding = [2, 4], labelBgBorderRadius = 2, children: children2, className, ...rest }) {
|
|
7855
9565
|
const [edgeTextBbox, setEdgeTextBbox] = ReactExports.useState({ x: 1, y: 0, width: 0, height: 0 });
|
|
7856
9566
|
const edgeTextClasses = cc(["react-flow__edge-textwrapper", className]);
|
|
7857
9567
|
const edgeTextRef = ReactExports.useRef(null);
|
|
@@ -7869,7 +9579,7 @@ function EdgeTextComponent({ x, y, label, labelStyle, labelShowBg = true, labelB
|
|
|
7869
9579
|
if (!label) {
|
|
7870
9580
|
return null;
|
|
7871
9581
|
}
|
|
7872
|
-
return jsxRuntime.jsxs("g", { transform: `translate(${
|
|
9582
|
+
return jsxRuntime.jsxs("g", { transform: `translate(${x2 - edgeTextBbox.width / 2} ${y - edgeTextBbox.height / 2})`, className: edgeTextClasses, visibility: edgeTextBbox.width ? "visible" : "hidden", ...rest, children: [labelShowBg && jsxRuntime.jsx("rect", { width: edgeTextBbox.width + 2 * labelBgPadding[0], x: -labelBgPadding[0], y: -labelBgPadding[1], height: edgeTextBbox.height + 2 * labelBgPadding[1], className: "react-flow__edge-textbg", style: labelBgStyle, rx: labelBgBorderRadius, ry: labelBgBorderRadius }), jsxRuntime.jsx("text", { className: "react-flow__edge-text", y: edgeTextBbox.height / 2, dy: "0.3em", ref: edgeTextRef, style: labelStyle, children: label }), children2] });
|
|
7873
9583
|
}
|
|
7874
9584
|
EdgeTextComponent.displayName = "EdgeText";
|
|
7875
9585
|
var EdgeText = ReactExports.memo(EdgeTextComponent);
|
|
@@ -8010,12 +9720,12 @@ var nullPosition = {
|
|
|
8010
9720
|
targetPosition: null,
|
|
8011
9721
|
zIndex: void 0
|
|
8012
9722
|
};
|
|
8013
|
-
var shiftX = (
|
|
9723
|
+
var shiftX = (x2, shift, position) => {
|
|
8014
9724
|
if (position === Position.Left)
|
|
8015
|
-
return
|
|
9725
|
+
return x2 - shift;
|
|
8016
9726
|
if (position === Position.Right)
|
|
8017
|
-
return
|
|
8018
|
-
return
|
|
9727
|
+
return x2 + shift;
|
|
9728
|
+
return x2;
|
|
8019
9729
|
};
|
|
8020
9730
|
var shiftY = (y, shift, position) => {
|
|
8021
9731
|
if (position === Position.Top)
|
|
@@ -8356,8 +10066,8 @@ var getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, height
|
|
|
8356
10066
|
const bounds = getInternalNodesBounds(nodeLookup, {
|
|
8357
10067
|
filter: (node) => !!((node.width || node.initialWidth) && (node.height || node.initialHeight))
|
|
8358
10068
|
});
|
|
8359
|
-
const { x, y, zoom } = getViewportForBounds(bounds, width, height, minZoom, maxZoom, fitViewOptions?.padding ?? 0.1);
|
|
8360
|
-
transform2 = [
|
|
10069
|
+
const { x: x2, y, zoom } = getViewportForBounds(bounds, width, height, minZoom, maxZoom, fitViewOptions?.padding ?? 0.1);
|
|
10070
|
+
transform2 = [x2, y, zoom];
|
|
8361
10071
|
}
|
|
8362
10072
|
return {
|
|
8363
10073
|
rfId: "1",
|
|
@@ -8679,14 +10389,14 @@ var createStore2 = ({ nodes, edges, defaultNodes, defaultEdges, width, height, f
|
|
|
8679
10389
|
const { transform: transform2, width: width2, height: height2, panZoom, translateExtent } = get3();
|
|
8680
10390
|
return panBy({ delta, panZoom, transform: transform2, translateExtent, width: width2, height: height2 });
|
|
8681
10391
|
},
|
|
8682
|
-
setCenter: async (
|
|
10392
|
+
setCenter: async (x2, y, options) => {
|
|
8683
10393
|
const { width: width2, height: height2, maxZoom: maxZoom2, panZoom } = get3();
|
|
8684
10394
|
if (!panZoom) {
|
|
8685
10395
|
return false;
|
|
8686
10396
|
}
|
|
8687
10397
|
const nextZoom = typeof options?.zoom !== "undefined" ? options.zoom : maxZoom2;
|
|
8688
10398
|
await panZoom.setViewport({
|
|
8689
|
-
x: width2 / 2 -
|
|
10399
|
+
x: width2 / 2 - x2 * nextZoom,
|
|
8690
10400
|
y: height2 / 2 - y * nextZoom,
|
|
8691
10401
|
zoom: nextZoom
|
|
8692
10402
|
}, { duration: options?.duration, ease: options?.ease, interpolate: options?.interpolate });
|
|
@@ -8745,6 +10455,14 @@ function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTy
|
|
|
8745
10455
|
return jsxRuntime.jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style2, ...wrapperStyle }, ref, className: cc(["react-flow", className, colorModeClassName]), id: id2, role: "application", children: jsxRuntime.jsxs(Wrapper, { nodes, edges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent, zIndexMode, children: [jsxRuntime.jsx(StoreUpdater, { nodes, edges, defaultNodes, defaultEdges, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, nodesDraggable, autoPanOnNodeFocus, nodesConnectable, nodesFocusable, edgesFocusable, edgesReconnectable, elementsSelectable, elevateNodesOnSelect, elevateEdgesOnSelect, minZoom, maxZoom, nodeExtent, onNodesChange, onEdgesChange, snapToGrid, snapGrid, connectionMode, translateExtent, connectOnClick, defaultEdgeOptions, fitView, fitViewOptions, onNodesDelete, onEdgesDelete, onDelete, onNodeDragStart, onNodeDrag, onNodeDragStop, onSelectionDrag, onSelectionDragStart, onSelectionDragStop, onMove, onMoveStart, onMoveEnd, noPanClassName, nodeOrigin, rfId, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, onError, connectionRadius, isValidConnection, selectNodesOnDrag, nodeDragThreshold, connectionDragThreshold, onBeforeDelete, debug, ariaLabelConfig, zIndexMode }), jsxRuntime.jsx(GraphView, { onInit, onNodeClick, onEdgeClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, nodeTypes, edgeTypes, connectionLineType, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, selectionKeyCode, selectionOnDrag, selectionMode, deleteKeyCode, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent, minZoom, maxZoom, preventScrolling, zoomOnScroll, zoomOnPinch, zoomOnDoubleClick, panOnScroll, panOnScrollSpeed, panOnScrollMode, panOnDrag, autoPanOnSelection, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance, nodeClickDistance, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius, defaultMarkerColor, noDragClassName, noWheelClassName, noPanClassName, rfId, disableKeyboardA11y, nodeExtent, viewport, onViewportChange }), jsxRuntime.jsx(SelectionListener, { onSelectionChange }), children2, jsxRuntime.jsx(Attribution, { proOptions, position: attributionPosition }), jsxRuntime.jsx(A11yDescriptions, { rfId, disableKeyboardA11y })] }) });
|
|
8746
10456
|
}
|
|
8747
10457
|
var index = fixedForwardRef(ReactFlow);
|
|
10458
|
+
var selector$5 = (s) => s.domNode?.querySelector(".react-flow__viewport-portal");
|
|
10459
|
+
function ViewportPortal({ children: children2 }) {
|
|
10460
|
+
const viewPortalDiv = useStore(selector$5);
|
|
10461
|
+
if (!viewPortalDiv) {
|
|
10462
|
+
return null;
|
|
10463
|
+
}
|
|
10464
|
+
return reactDom.createPortal(children2, viewPortalDiv);
|
|
10465
|
+
}
|
|
8748
10466
|
function LinePattern({ dimensions, lineWidth, variant, className }) {
|
|
8749
10467
|
return jsxRuntime.jsx("path", { strokeWidth: lineWidth, d: `M${dimensions[0] / 2} 0 V${dimensions[1]} M0 ${dimensions[1] / 2} H${dimensions[0]}`, className: cc(["react-flow__background-pattern", variant, className]) });
|
|
8750
10468
|
}
|
|
@@ -8855,10 +10573,10 @@ function ControlsComponent({ style: style2, showZoom = true, showFitView = true,
|
|
|
8855
10573
|
}
|
|
8856
10574
|
ControlsComponent.displayName = "Controls";
|
|
8857
10575
|
var Controls = ReactExports.memo(ControlsComponent);
|
|
8858
|
-
function MiniMapNodeComponent({ id: id2, x, y, width, height, style: style2, color: color2, strokeColor, strokeWidth, className, borderRadius, shapeRendering, selected: selected2, onClick }) {
|
|
10576
|
+
function MiniMapNodeComponent({ id: id2, x: x2, y, width, height, style: style2, color: color2, strokeColor, strokeWidth, className, borderRadius, shapeRendering, selected: selected2, onClick }) {
|
|
8859
10577
|
const { background, backgroundColor } = style2 || {};
|
|
8860
10578
|
const fill = color2 || background || backgroundColor;
|
|
8861
|
-
return jsxRuntime.jsx("rect", { className: cc(["react-flow__minimap-node", { selected: selected2 }, className]), x, y, rx: borderRadius, ry: borderRadius, width, height, style: {
|
|
10579
|
+
return jsxRuntime.jsx("rect", { className: cc(["react-flow__minimap-node", { selected: selected2 }, className]), x: x2, y, rx: borderRadius, ry: borderRadius, width, height, style: {
|
|
8862
10580
|
fill,
|
|
8863
10581
|
stroke: strokeColor,
|
|
8864
10582
|
strokeWidth
|
|
@@ -8897,17 +10615,17 @@ function MiniMapNodes({
|
|
|
8897
10615
|
)) });
|
|
8898
10616
|
}
|
|
8899
10617
|
function NodeComponentWrapperInner({ id: id2, nodeColorFunc, nodeStrokeColorFunc, nodeClassNameFunc, nodeBorderRadius, nodeStrokeWidth, shapeRendering, NodeComponent, onClick }) {
|
|
8900
|
-
const { node, x, y, width, height } = useStore((s) => {
|
|
10618
|
+
const { node, x: x2, y, width, height } = useStore((s) => {
|
|
8901
10619
|
const node2 = s.nodeLookup.get(id2);
|
|
8902
10620
|
if (!node2) {
|
|
8903
10621
|
return { node: void 0, x: 0, y: 0, width: 0, height: 0 };
|
|
8904
10622
|
}
|
|
8905
10623
|
const userNode = node2.internals.userNode;
|
|
8906
|
-
const { x:
|
|
10624
|
+
const { x: x3, y: y2 } = node2.internals.positionAbsolute;
|
|
8907
10625
|
const { width: width2, height: height2 } = getNodeDimensions(userNode);
|
|
8908
10626
|
return {
|
|
8909
10627
|
node: userNode,
|
|
8910
|
-
x:
|
|
10628
|
+
x: x3,
|
|
8911
10629
|
y: y2,
|
|
8912
10630
|
width: width2,
|
|
8913
10631
|
height: height2
|
|
@@ -8916,7 +10634,7 @@ function NodeComponentWrapperInner({ id: id2, nodeColorFunc, nodeStrokeColorFunc
|
|
|
8916
10634
|
if (!node || node.hidden || !nodeHasDimensions(node)) {
|
|
8917
10635
|
return null;
|
|
8918
10636
|
}
|
|
8919
|
-
return jsxRuntime.jsx(NodeComponent, { x, y, width, height, style: node.style, selected: !!node.selected, className: nodeClassNameFunc(node), color: nodeColorFunc(node), borderRadius: nodeBorderRadius, strokeColor: nodeStrokeColorFunc(node), strokeWidth: nodeStrokeWidth, shapeRendering, onClick, id: node.id });
|
|
10637
|
+
return jsxRuntime.jsx(NodeComponent, { x: x2, y, width, height, style: node.style, selected: !!node.selected, className: nodeClassNameFunc(node), color: nodeColorFunc(node), borderRadius: nodeBorderRadius, strokeColor: nodeStrokeColorFunc(node), strokeWidth: nodeStrokeWidth, shapeRendering, onClick, id: node.id });
|
|
8920
10638
|
}
|
|
8921
10639
|
var NodeComponentWrapper = ReactExports.memo(NodeComponentWrapperInner);
|
|
8922
10640
|
var MiniMapNodes$1 = ReactExports.memo(MiniMapNodes);
|
|
@@ -8980,7 +10698,7 @@ function MiniMapComponent({
|
|
|
8980
10698
|
const viewWidth = viewScale * elementWidth;
|
|
8981
10699
|
const viewHeight = viewScale * elementHeight;
|
|
8982
10700
|
const offset = offsetScale * viewScale;
|
|
8983
|
-
const
|
|
10701
|
+
const x2 = boundingRect.x - (viewWidth - boundingRect.width) / 2 - offset;
|
|
8984
10702
|
const y = boundingRect.y - (viewHeight - boundingRect.height) / 2 - offset;
|
|
8985
10703
|
const width = viewWidth + offset * 2;
|
|
8986
10704
|
const height = viewHeight + offset * 2;
|
|
@@ -9013,8 +10731,8 @@ function MiniMapComponent({
|
|
|
9013
10731
|
});
|
|
9014
10732
|
}, [pannable, zoomable, inversePan, zoomStep, translateExtent, flowWidth, flowHeight]);
|
|
9015
10733
|
const onSvgClick = onClick ? (event) => {
|
|
9016
|
-
const [
|
|
9017
|
-
onClick(event, { x:
|
|
10734
|
+
const [x3, y2] = minimapInstance.current?.pointer(event) || [0, 0];
|
|
10735
|
+
onClick(event, { x: x3, y: y2 });
|
|
9018
10736
|
} : void 0;
|
|
9019
10737
|
const onSvgNodeClick = onNodeClick ? ReactExports.useCallback((event, nodeId) => {
|
|
9020
10738
|
const node = store.getState().nodeLookup.get(nodeId).internals.userNode;
|
|
@@ -9030,7 +10748,7 @@ function MiniMapComponent({
|
|
|
9030
10748
|
"--xy-minimap-node-background-color-props": typeof nodeColor === "string" ? nodeColor : void 0,
|
|
9031
10749
|
"--xy-minimap-node-stroke-color-props": typeof nodeStrokeColor === "string" ? nodeStrokeColor : void 0,
|
|
9032
10750
|
"--xy-minimap-node-stroke-width-props": typeof nodeStrokeWidth === "number" ? nodeStrokeWidth : void 0
|
|
9033
|
-
}, className: cc(["react-flow__minimap", className]), "data-testid": "rf__minimap", children: jsxRuntime.jsxs("svg", { width: elementWidth, height: elementHeight, viewBox: `${
|
|
10751
|
+
}, className: cc(["react-flow__minimap", className]), "data-testid": "rf__minimap", children: jsxRuntime.jsxs("svg", { width: elementWidth, height: elementHeight, viewBox: `${x2} ${y} ${width} ${height}`, className: "react-flow__minimap-svg", role: "img", "aria-labelledby": labelledBy, ref: svg, onClick: onSvgClick, children: [_ariaLabel && jsxRuntime.jsx("title", { id: labelledBy, children: _ariaLabel }), jsxRuntime.jsx(MiniMapNodes$1, { onClick: onSvgNodeClick, nodeColor, nodeStrokeColor, nodeBorderRadius, nodeClassName, nodeStrokeWidth, nodeComponent }), jsxRuntime.jsx("path", { className: "react-flow__minimap-mask", d: `M${x2 - offset},${y - offset}h${width + offset * 2}v${height + offset * 2}h${-width - offset * 2}z
|
|
9034
10752
|
M${viewBB.x},${viewBB.y}h${viewBB.width}v${viewBB.height}h${-viewBB.width}z`, fillRule: "evenodd", pointerEvents: "none" })] }) });
|
|
9035
10753
|
}
|
|
9036
10754
|
MiniMapComponent.displayName = "MiniMap";
|
|
@@ -9223,7 +10941,7 @@ function NodeToolbar({ nodeId, children: children2, className, style: style2, is
|
|
|
9223
10941
|
return internalNodes;
|
|
9224
10942
|
}, [nodeId, contextNodeId]);
|
|
9225
10943
|
const nodes = useStore(nodesSelector, nodesEqualityFn);
|
|
9226
|
-
const { x, y, zoom, selectedNodesCount } = useStore(storeSelector, shallow$1);
|
|
10944
|
+
const { x: x2, y, zoom, selectedNodesCount } = useStore(storeSelector, shallow$1);
|
|
9227
10945
|
const isActive = typeof isVisible === "boolean" ? isVisible : nodes.size === 1 && nodes.values().next().value?.selected && selectedNodesCount === 1;
|
|
9228
10946
|
if (!isActive || !nodes.size) {
|
|
9229
10947
|
return null;
|
|
@@ -9233,7 +10951,7 @@ function NodeToolbar({ nodeId, children: children2, className, style: style2, is
|
|
|
9233
10951
|
const zIndex = Math.max(...nodesArray.map((node) => node.internals.z + 1));
|
|
9234
10952
|
const wrapperStyle2 = {
|
|
9235
10953
|
position: "absolute",
|
|
9236
|
-
transform: getNodeToolbarTransform(nodeRect, { x, y, zoom }, position, offset, align),
|
|
10954
|
+
transform: getNodeToolbarTransform(nodeRect, { x: x2, y, zoom }, position, offset, align),
|
|
9237
10955
|
zIndex,
|
|
9238
10956
|
...style2
|
|
9239
10957
|
};
|
|
@@ -9488,7 +11206,7 @@ function activatedPorts(node, result) {
|
|
|
9488
11206
|
}
|
|
9489
11207
|
}
|
|
9490
11208
|
const kind = getNodeKind(node.data?.kind ?? node.type ?? "") ?? void 0;
|
|
9491
|
-
const declared = resolveNodePorts(node, kind).outputs?.map((
|
|
11209
|
+
const declared = resolveNodePorts(node, kind).outputs?.map((p2) => p2.id);
|
|
9492
11210
|
return { ports: declared?.length ? declared : ["out"], value: result };
|
|
9493
11211
|
}
|
|
9494
11212
|
|
|
@@ -10338,7 +12056,7 @@ var KINDS = [
|
|
|
10338
12056
|
}
|
|
10339
12057
|
];
|
|
10340
12058
|
function registerBuiltinKinds() {
|
|
10341
|
-
for (const
|
|
12059
|
+
for (const k2 of KINDS) registerNodeKind(k2);
|
|
10342
12060
|
}
|
|
10343
12061
|
var BUILTIN_KINDS = KINDS;
|
|
10344
12062
|
function NodeShellInner({
|
|
@@ -10369,27 +12087,27 @@ function NodeShellInner({
|
|
|
10369
12087
|
data.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "ff-node__desc", children: data.description }),
|
|
10370
12088
|
children2 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ff-node__body", children: children2 }),
|
|
10371
12089
|
data.statusText && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "ff-node__status-text", children: data.statusText }),
|
|
10372
|
-
inputs.map((
|
|
12090
|
+
inputs.map((p2, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
10373
12091
|
Handle,
|
|
10374
12092
|
{
|
|
10375
12093
|
type: "target",
|
|
10376
12094
|
position: Position.Left,
|
|
10377
|
-
id:
|
|
12095
|
+
id: p2.id,
|
|
10378
12096
|
style: portStyle(i, inputs.length),
|
|
10379
|
-
title:
|
|
12097
|
+
title: p2.label ?? p2.id
|
|
10380
12098
|
},
|
|
10381
|
-
|
|
12099
|
+
p2.id
|
|
10382
12100
|
)),
|
|
10383
|
-
outputs.map((
|
|
12101
|
+
outputs.map((p2, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
10384
12102
|
Handle,
|
|
10385
12103
|
{
|
|
10386
12104
|
type: "source",
|
|
10387
12105
|
position: Position.Right,
|
|
10388
|
-
id:
|
|
12106
|
+
id: p2.id,
|
|
10389
12107
|
style: portStyle(i, outputs.length),
|
|
10390
|
-
title:
|
|
12108
|
+
title: p2.label ?? p2.id
|
|
10391
12109
|
},
|
|
10392
|
-
|
|
12110
|
+
p2.id
|
|
10393
12111
|
))
|
|
10394
12112
|
]
|
|
10395
12113
|
}
|
|
@@ -10481,7 +12199,7 @@ function portsFor(node, side) {
|
|
|
10481
12199
|
}
|
|
10482
12200
|
function findPort(ports, handleId) {
|
|
10483
12201
|
if (handleId == null) return ports.length === 1 ? ports[0] : void 0;
|
|
10484
|
-
return ports.find((
|
|
12202
|
+
return ports.find((p2) => p2.id === handleId);
|
|
10485
12203
|
}
|
|
10486
12204
|
function createConnectionValidator(getNodes, options = {}) {
|
|
10487
12205
|
const compatible = options.compatible ?? defaultPortCompatibility;
|
|
@@ -10561,14 +12279,14 @@ function alignNodes(nodes, edge) {
|
|
|
10561
12279
|
const cx = (minL + maxR) / 2;
|
|
10562
12280
|
const cy = (minT + maxB) / 2;
|
|
10563
12281
|
return nodes.map((n) => {
|
|
10564
|
-
let { x, y } = n.position;
|
|
10565
|
-
if (edge === "left")
|
|
10566
|
-
else if (edge === "right")
|
|
10567
|
-
else if (edge === "hcenter")
|
|
12282
|
+
let { x: x2, y } = n.position;
|
|
12283
|
+
if (edge === "left") x2 = minL;
|
|
12284
|
+
else if (edge === "right") x2 = maxR - nodeW(n);
|
|
12285
|
+
else if (edge === "hcenter") x2 = cx - nodeW(n) / 2;
|
|
10568
12286
|
else if (edge === "top") y = minT;
|
|
10569
12287
|
else if (edge === "bottom") y = maxB - nodeH(n);
|
|
10570
12288
|
else if (edge === "vcenter") y = cy - nodeH(n) / 2;
|
|
10571
|
-
return { ...n, position: { x, y } };
|
|
12289
|
+
return { ...n, position: { x: x2, y } };
|
|
10572
12290
|
});
|
|
10573
12291
|
}
|
|
10574
12292
|
function sortNodesParentFirst(nodes) {
|
|
@@ -10607,7 +12325,7 @@ function removeFromLane(nodes, nodeId) {
|
|
|
10607
12325
|
const abs = absolutePosition(node, nodes);
|
|
10608
12326
|
return nodes.map((n) => {
|
|
10609
12327
|
if (n.id !== nodeId) return n;
|
|
10610
|
-
const { parentId: _p, extent:
|
|
12328
|
+
const { parentId: _p, extent: _e2, ...rest } = n;
|
|
10611
12329
|
return { ...rest, position: abs };
|
|
10612
12330
|
});
|
|
10613
12331
|
}
|
|
@@ -10628,10 +12346,101 @@ function distributeNodes(nodes, axis) {
|
|
|
10628
12346
|
cursor += size(n) + gap;
|
|
10629
12347
|
}
|
|
10630
12348
|
return nodes.map((n) => {
|
|
10631
|
-
const
|
|
10632
|
-
return { ...n, position: axis === "h" ? { ...n.position, x:
|
|
12349
|
+
const p2 = posById.get(n.id);
|
|
12350
|
+
return { ...n, position: axis === "h" ? { ...n.position, x: p2 } : { ...n.position, y: p2 } };
|
|
10633
12351
|
});
|
|
10634
12352
|
}
|
|
12353
|
+
|
|
12354
|
+
// src/components/canvas/helper-lines.ts
|
|
12355
|
+
var w = (n) => n.width ?? n.measured?.width ?? 0;
|
|
12356
|
+
var h = (n) => n.height ?? n.measured?.height ?? 0;
|
|
12357
|
+
function getHelperLines(change, nodes, distance2 = 6) {
|
|
12358
|
+
const result = { snapPosition: { x: void 0, y: void 0 } };
|
|
12359
|
+
const a = nodes.find((n) => n.id === change.id);
|
|
12360
|
+
if (!a || !change.position) return result;
|
|
12361
|
+
const A2 = {
|
|
12362
|
+
left: change.position.x,
|
|
12363
|
+
right: change.position.x + w(a),
|
|
12364
|
+
top: change.position.y,
|
|
12365
|
+
bottom: change.position.y + h(a),
|
|
12366
|
+
width: w(a),
|
|
12367
|
+
height: h(a)
|
|
12368
|
+
};
|
|
12369
|
+
let vDist = distance2;
|
|
12370
|
+
let hDist = distance2;
|
|
12371
|
+
for (const b of nodes) {
|
|
12372
|
+
if (b.id === a.id) continue;
|
|
12373
|
+
const B2 = { left: b.position.x, right: b.position.x + w(b), top: b.position.y, bottom: b.position.y + h(b) };
|
|
12374
|
+
const ll = Math.abs(A2.left - B2.left);
|
|
12375
|
+
if (ll < vDist) {
|
|
12376
|
+
result.snapPosition.x = B2.left;
|
|
12377
|
+
result.vertical = B2.left;
|
|
12378
|
+
vDist = ll;
|
|
12379
|
+
}
|
|
12380
|
+
const rr2 = Math.abs(A2.right - B2.right);
|
|
12381
|
+
if (rr2 < vDist) {
|
|
12382
|
+
result.snapPosition.x = B2.right - A2.width;
|
|
12383
|
+
result.vertical = B2.right;
|
|
12384
|
+
vDist = rr2;
|
|
12385
|
+
}
|
|
12386
|
+
const lr = Math.abs(A2.left - B2.right);
|
|
12387
|
+
if (lr < vDist) {
|
|
12388
|
+
result.snapPosition.x = B2.right;
|
|
12389
|
+
result.vertical = B2.right;
|
|
12390
|
+
vDist = lr;
|
|
12391
|
+
}
|
|
12392
|
+
const rl = Math.abs(A2.right - B2.left);
|
|
12393
|
+
if (rl < vDist) {
|
|
12394
|
+
result.snapPosition.x = B2.left - A2.width;
|
|
12395
|
+
result.vertical = B2.left;
|
|
12396
|
+
vDist = rl;
|
|
12397
|
+
}
|
|
12398
|
+
const tt2 = Math.abs(A2.top - B2.top);
|
|
12399
|
+
if (tt2 < hDist) {
|
|
12400
|
+
result.snapPosition.y = B2.top;
|
|
12401
|
+
result.horizontal = B2.top;
|
|
12402
|
+
hDist = tt2;
|
|
12403
|
+
}
|
|
12404
|
+
const bb = Math.abs(A2.bottom - B2.bottom);
|
|
12405
|
+
if (bb < hDist) {
|
|
12406
|
+
result.snapPosition.y = B2.bottom - A2.height;
|
|
12407
|
+
result.horizontal = B2.bottom;
|
|
12408
|
+
hDist = bb;
|
|
12409
|
+
}
|
|
12410
|
+
const tb = Math.abs(A2.top - B2.bottom);
|
|
12411
|
+
if (tb < hDist) {
|
|
12412
|
+
result.snapPosition.y = B2.bottom;
|
|
12413
|
+
result.horizontal = B2.bottom;
|
|
12414
|
+
hDist = tb;
|
|
12415
|
+
}
|
|
12416
|
+
const bt2 = Math.abs(A2.bottom - B2.top);
|
|
12417
|
+
if (bt2 < hDist) {
|
|
12418
|
+
result.snapPosition.y = B2.top - A2.height;
|
|
12419
|
+
result.horizontal = B2.top;
|
|
12420
|
+
hDist = bt2;
|
|
12421
|
+
}
|
|
12422
|
+
}
|
|
12423
|
+
return result;
|
|
12424
|
+
}
|
|
12425
|
+
function HelperLines({ horizontal, vertical }) {
|
|
12426
|
+
if (horizontal === void 0 && vertical === void 0) return null;
|
|
12427
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ViewportPortal, { children: [
|
|
12428
|
+
vertical !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12429
|
+
"div",
|
|
12430
|
+
{
|
|
12431
|
+
className: "ff-helper-line",
|
|
12432
|
+
style: { position: "absolute", transform: `translateX(${vertical}px)`, top: -5e3, height: 1e4, width: 1, pointerEvents: "none" }
|
|
12433
|
+
}
|
|
12434
|
+
),
|
|
12435
|
+
horizontal !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12436
|
+
"div",
|
|
12437
|
+
{
|
|
12438
|
+
className: "ff-helper-line",
|
|
12439
|
+
style: { position: "absolute", transform: `translateY(${horizontal}px)`, left: -5e3, width: 1e4, height: 1, pointerEvents: "none" }
|
|
12440
|
+
}
|
|
12441
|
+
)
|
|
12442
|
+
] });
|
|
12443
|
+
}
|
|
10635
12444
|
var DEFAULT_FIT_VIEW = { padding: 0.2 };
|
|
10636
12445
|
var DEFAULT_EDGE_OPTIONS = {
|
|
10637
12446
|
type: "smoothstep",
|
|
@@ -10646,6 +12455,9 @@ function FlowCanvas({
|
|
|
10646
12455
|
height = 600,
|
|
10647
12456
|
validateConnections = true,
|
|
10648
12457
|
isValidConnection,
|
|
12458
|
+
colorMode,
|
|
12459
|
+
showHelperLines = false,
|
|
12460
|
+
onNodesChange,
|
|
10649
12461
|
toolbar,
|
|
10650
12462
|
nodeTypes,
|
|
10651
12463
|
edgeTypes,
|
|
@@ -10672,31 +12484,66 @@ function FlowCanvas({
|
|
|
10672
12484
|
[edgeTypes]
|
|
10673
12485
|
);
|
|
10674
12486
|
const orderedNodes = ReactExports.useMemo(() => sortNodesParentFirst(nodes), [nodes]);
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
|
|
10680
|
-
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
zoomActivationKeyCode: "Shift",
|
|
10689
|
-
preventScrolling: false,
|
|
10690
|
-
isValidConnection: resolvedIsValidConnection,
|
|
10691
|
-
...rest,
|
|
10692
|
-
children: [
|
|
10693
|
-
background !== "none" && /* @__PURE__ */ jsxRuntime.jsx(Background, { variant: background, gap: 20, size: 1, color: "rgba(0,0,0,0.18)" }),
|
|
10694
|
-
showControls && /* @__PURE__ */ jsxRuntime.jsx(Controls, { className: "ff-controls", position: "bottom-right" }),
|
|
10695
|
-
showMinimap && /* @__PURE__ */ jsxRuntime.jsx(MiniMap, { className: "ff-minimap", pannable: true, zoomable: true })
|
|
10696
|
-
]
|
|
12487
|
+
const [helperLines, setHelperLines] = ReactExports.useState({});
|
|
12488
|
+
const handleNodesChange = ReactExports.useCallback(
|
|
12489
|
+
(changes) => {
|
|
12490
|
+
if (showHelperLines) {
|
|
12491
|
+
const pos = changes.filter((c) => c.type === "position" && c.position);
|
|
12492
|
+
if (pos.length === 1 && pos[0].dragging) {
|
|
12493
|
+
const lines = getHelperLines(pos[0], nodesRef.current);
|
|
12494
|
+
if (lines.snapPosition.x !== void 0) pos[0].position.x = lines.snapPosition.x;
|
|
12495
|
+
if (lines.snapPosition.y !== void 0) pos[0].position.y = lines.snapPosition.y;
|
|
12496
|
+
setHelperLines({ horizontal: lines.horizontal, vertical: lines.vertical });
|
|
12497
|
+
} else {
|
|
12498
|
+
setHelperLines({});
|
|
12499
|
+
}
|
|
10697
12500
|
}
|
|
10698
|
-
|
|
10699
|
-
|
|
12501
|
+
onNodesChange?.(changes);
|
|
12502
|
+
},
|
|
12503
|
+
[showHelperLines, onNodesChange]
|
|
12504
|
+
);
|
|
12505
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12506
|
+
"div",
|
|
12507
|
+
{
|
|
12508
|
+
className: [
|
|
12509
|
+
"ff-canvas",
|
|
12510
|
+
// colorMode drives BOTH react-flow's chrome (below) and our `ff-` styles
|
|
12511
|
+
// via the shared `.dark` class / light opt-out — one theme signal.
|
|
12512
|
+
colorMode === "dark" ? "dark" : "",
|
|
12513
|
+
colorMode === "light" ? "ff-canvas--light" : "",
|
|
12514
|
+
className ?? ""
|
|
12515
|
+
].filter(Boolean).join(" "),
|
|
12516
|
+
style: { height, ...style2 },
|
|
12517
|
+
children: [
|
|
12518
|
+
toolbar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ff-canvas__toolbar", children: toolbar }),
|
|
12519
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ff-canvas__surface", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12520
|
+
index,
|
|
12521
|
+
{
|
|
12522
|
+
nodes: orderedNodes,
|
|
12523
|
+
edges,
|
|
12524
|
+
onNodesChange: handleNodesChange,
|
|
12525
|
+
colorMode,
|
|
12526
|
+
nodeTypes: mergedNodeTypes,
|
|
12527
|
+
edgeTypes: mergedEdgeTypes,
|
|
12528
|
+
fitView: true,
|
|
12529
|
+
fitViewOptions: DEFAULT_FIT_VIEW,
|
|
12530
|
+
defaultEdgeOptions: DEFAULT_EDGE_OPTIONS,
|
|
12531
|
+
proOptions: { hideAttribution: true },
|
|
12532
|
+
zoomActivationKeyCode: "Shift",
|
|
12533
|
+
preventScrolling: false,
|
|
12534
|
+
isValidConnection: resolvedIsValidConnection,
|
|
12535
|
+
...rest,
|
|
12536
|
+
children: [
|
|
12537
|
+
background !== "none" && /* @__PURE__ */ jsxRuntime.jsx(Background, { variant: background, gap: 20, size: 1, color: "rgba(0,0,0,0.18)" }),
|
|
12538
|
+
showControls && /* @__PURE__ */ jsxRuntime.jsx(Controls, { className: "ff-controls", position: "bottom-right" }),
|
|
12539
|
+
showMinimap && /* @__PURE__ */ jsxRuntime.jsx(MiniMap, { className: "ff-minimap", pannable: true, zoomable: true }),
|
|
12540
|
+
showHelperLines && /* @__PURE__ */ jsxRuntime.jsx(HelperLines, { horizontal: helperLines.horizontal, vertical: helperLines.vertical })
|
|
12541
|
+
]
|
|
12542
|
+
}
|
|
12543
|
+
) })
|
|
12544
|
+
]
|
|
12545
|
+
}
|
|
12546
|
+
);
|
|
10700
12547
|
}
|
|
10701
12548
|
var CATEGORY_ORDER = ["trigger", "logic", "data", "ai", "io", "human", "output", "layout", "custom"];
|
|
10702
12549
|
var CATEGORY_LABELS = {
|
|
@@ -10717,13 +12564,13 @@ function NodePalette({ categories, onPick, className, style: style2 }) {
|
|
|
10717
12564
|
const visibleCats = categories ?? CATEGORY_ORDER;
|
|
10718
12565
|
const grouped = ReactExports.useMemo(() => {
|
|
10719
12566
|
const all = listNodeKinds();
|
|
10720
|
-
const
|
|
10721
|
-
const filtered =
|
|
12567
|
+
const q2 = query.trim().toLowerCase();
|
|
12568
|
+
const filtered = q2 ? all.filter((k2) => k2.name.includes(q2) || k2.label.toLowerCase().includes(q2) || (k2.description ?? "").toLowerCase().includes(q2)) : all;
|
|
10722
12569
|
const map = /* @__PURE__ */ new Map();
|
|
10723
12570
|
for (const cat of visibleCats) map.set(cat, []);
|
|
10724
|
-
for (const
|
|
10725
|
-
if (!map.has(
|
|
10726
|
-
map.get(
|
|
12571
|
+
for (const k2 of filtered) {
|
|
12572
|
+
if (!map.has(k2.category)) map.set(k2.category, []);
|
|
12573
|
+
map.get(k2.category).push(k2);
|
|
10727
12574
|
}
|
|
10728
12575
|
return map;
|
|
10729
12576
|
}, [query, visibleCats]);
|
|
@@ -10740,7 +12587,7 @@ function NodePalette({ categories, onPick, className, style: style2 }) {
|
|
|
10740
12587
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ff-palette__list", children: Array.from(grouped.entries()).map(
|
|
10741
12588
|
([cat, kinds2]) => kinds2.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "ff-palette__group", children: [
|
|
10742
12589
|
/* @__PURE__ */ jsxRuntime.jsx("header", { className: "ff-palette__group-label", children: CATEGORY_LABELS[cat] ?? cat }),
|
|
10743
|
-
kinds2.map((
|
|
12590
|
+
kinds2.map((k2) => /* @__PURE__ */ jsxRuntime.jsx(KindRow, { kind: k2, onPick }, k2.name))
|
|
10744
12591
|
] }, cat)
|
|
10745
12592
|
) })
|
|
10746
12593
|
] });
|
|
@@ -10961,7 +12808,7 @@ function RepeaterField({
|
|
|
10961
12808
|
}
|
|
10962
12809
|
replace([...rows, blank]);
|
|
10963
12810
|
};
|
|
10964
|
-
const removeRow = (i) => replace(rows.filter((
|
|
12811
|
+
const removeRow = (i) => replace(rows.filter((_2, idx) => idx !== i));
|
|
10965
12812
|
const moveRow = (i, delta) => {
|
|
10966
12813
|
const target = i + delta;
|
|
10967
12814
|
if (target < 0 || target >= rows.length) return;
|
|
@@ -11059,15 +12906,15 @@ function KeyValueField({
|
|
|
11059
12906
|
const entries = Object.entries(map);
|
|
11060
12907
|
const commit = (next) => {
|
|
11061
12908
|
const obj = {};
|
|
11062
|
-
for (const [
|
|
11063
|
-
if (
|
|
11064
|
-
obj[
|
|
12909
|
+
for (const [k2, v2] of next) {
|
|
12910
|
+
if (k2 === "") continue;
|
|
12911
|
+
obj[k2] = v2;
|
|
11065
12912
|
}
|
|
11066
12913
|
onChange(obj);
|
|
11067
12914
|
};
|
|
11068
|
-
const setKey = (i, key) => commit(entries.map(([
|
|
11069
|
-
const setVal = (i, val) => commit(entries.map(([
|
|
11070
|
-
const remove2 = (i) => commit(entries.filter((
|
|
12915
|
+
const setKey = (i, key) => commit(entries.map(([k2, v2], idx) => idx === i ? [key, v2] : [k2, v2]));
|
|
12916
|
+
const setVal = (i, val) => commit(entries.map(([k2, v2], idx) => idx === i ? [k2, val] : [k2, v2]));
|
|
12917
|
+
const remove2 = (i) => commit(entries.filter((_2, idx) => idx !== i));
|
|
11071
12918
|
const add = () => commit([...entries, ["", ""]]);
|
|
11072
12919
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ff-keyvalue", "data-ff-keyvalue": field.key, children: [
|
|
11073
12920
|
entries.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ff-keyvalue__head", children: [
|
|
@@ -11075,12 +12922,12 @@ function KeyValueField({
|
|
|
11075
12922
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: field.valueLabel ?? "Value" }),
|
|
11076
12923
|
/* @__PURE__ */ jsxRuntime.jsx("span", {})
|
|
11077
12924
|
] }),
|
|
11078
|
-
entries.map(([
|
|
12925
|
+
entries.map(([k2, v2], i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ff-keyvalue__row", "data-ff-keyvalue-row": i, children: [
|
|
11079
12926
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11080
12927
|
"input",
|
|
11081
12928
|
{
|
|
11082
12929
|
className: "ff-panel__input",
|
|
11083
|
-
value:
|
|
12930
|
+
value: k2,
|
|
11084
12931
|
placeholder: field.keyPlaceholder,
|
|
11085
12932
|
"aria-label": `${field.keyLabel ?? "Key"} ${i + 1}`,
|
|
11086
12933
|
onChange: (e) => setKey(i, e.target.value)
|
|
@@ -11090,7 +12937,7 @@ function KeyValueField({
|
|
|
11090
12937
|
"select",
|
|
11091
12938
|
{
|
|
11092
12939
|
className: "ff-panel__input",
|
|
11093
|
-
value:
|
|
12940
|
+
value: v2 ?? "",
|
|
11094
12941
|
"aria-label": `${field.valueLabel ?? "Value"} ${i + 1}`,
|
|
11095
12942
|
onChange: (e) => setVal(i, e.target.value),
|
|
11096
12943
|
children: [
|
|
@@ -11102,7 +12949,7 @@ function KeyValueField({
|
|
|
11102
12949
|
"input",
|
|
11103
12950
|
{
|
|
11104
12951
|
className: "ff-panel__input",
|
|
11105
|
-
value:
|
|
12952
|
+
value: v2 ?? "",
|
|
11106
12953
|
placeholder: field.valuePlaceholder,
|
|
11107
12954
|
"aria-label": `${field.valueLabel ?? "Value"} ${i + 1}`,
|
|
11108
12955
|
onChange: (e) => setVal(i, e.target.value)
|
|
@@ -11114,7 +12961,7 @@ function KeyValueField({
|
|
|
11114
12961
|
type: "button",
|
|
11115
12962
|
className: "ff-repeater__btn ff-repeater__btn--danger",
|
|
11116
12963
|
onClick: () => remove2(i),
|
|
11117
|
-
"aria-label": `Remove ${
|
|
12964
|
+
"aria-label": `Remove ${k2 || `entry ${i + 1}`}`,
|
|
11118
12965
|
children: "\u2715"
|
|
11119
12966
|
}
|
|
11120
12967
|
)
|
|
@@ -11250,7 +13097,7 @@ function NodeConfigPanel({
|
|
|
11250
13097
|
{
|
|
11251
13098
|
field,
|
|
11252
13099
|
value: config[field.key],
|
|
11253
|
-
onChange: (
|
|
13100
|
+
onChange: (v2) => setConfigValue(field.key, v2),
|
|
11254
13101
|
renderCredentialField,
|
|
11255
13102
|
renderDocumentField: documentField
|
|
11256
13103
|
}
|
|
@@ -11295,8 +13142,8 @@ function FlowRunFeed({ entries, className, style: style2 }) {
|
|
|
11295
13142
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ff-run-feed__text", children: e.text })
|
|
11296
13143
|
] }, e.id)) });
|
|
11297
13144
|
}
|
|
11298
|
-
function formatTime(
|
|
11299
|
-
const d = new Date(
|
|
13145
|
+
function formatTime(at2) {
|
|
13146
|
+
const d = new Date(at2);
|
|
11300
13147
|
return `${d.getMinutes().toString().padStart(2, "0")}:${d.getSeconds().toString().padStart(2, "0")}.${Math.floor(d.getMilliseconds() / 100)}`;
|
|
11301
13148
|
}
|
|
11302
13149
|
function useFlowState(initial) {
|
|
@@ -11426,6 +13273,7 @@ function useFlowHistory(flow) {
|
|
|
11426
13273
|
function useFlowRun({ maxFeed = 200 } = {}) {
|
|
11427
13274
|
const [statuses, setStatuses] = ReactExports.useState({});
|
|
11428
13275
|
const [statusText, setStatusText] = ReactExports.useState({});
|
|
13276
|
+
const [outputs, setOutputs] = ReactExports.useState({});
|
|
11429
13277
|
const [feed, setFeed] = ReactExports.useState([]);
|
|
11430
13278
|
const [running, setRunning] = ReactExports.useState(false);
|
|
11431
13279
|
const [lastResult, setLastResult] = ReactExports.useState(null);
|
|
@@ -11439,6 +13287,7 @@ function useFlowRun({ maxFeed = 200 } = {}) {
|
|
|
11439
13287
|
appendFeed({ level: "status", text: `${e.nodeId} \u2192 ${e.status}${e.text ? ` (${e.text})` : ""}`, nodeId: e.nodeId });
|
|
11440
13288
|
break;
|
|
11441
13289
|
case "node-output":
|
|
13290
|
+
setOutputs((o) => ({ ...o, [e.nodeId]: e.value }));
|
|
11442
13291
|
appendFeed({ level: "info", text: `${e.nodeId}.${e.portId} = ${preview(e.value)}`, nodeId: e.nodeId, detail: e.value });
|
|
11443
13292
|
break;
|
|
11444
13293
|
case "log":
|
|
@@ -11475,6 +13324,7 @@ function useFlowRun({ maxFeed = 200 } = {}) {
|
|
|
11475
13324
|
for (const n of graph.nodes) idleStatuses[n.id] = "idle";
|
|
11476
13325
|
setStatuses(idleStatuses);
|
|
11477
13326
|
setStatusText({});
|
|
13327
|
+
setOutputs({});
|
|
11478
13328
|
setRunning(true);
|
|
11479
13329
|
try {
|
|
11480
13330
|
const result = await runFlow(graph, executors, handleEvent, { ...options, signal: controller.signal });
|
|
@@ -11491,10 +13341,18 @@ function useFlowRun({ maxFeed = 200 } = {}) {
|
|
|
11491
13341
|
const reset = ReactExports.useCallback(() => {
|
|
11492
13342
|
setStatuses({});
|
|
11493
13343
|
setStatusText({});
|
|
13344
|
+
setOutputs({});
|
|
11494
13345
|
setFeed([]);
|
|
11495
13346
|
setLastResult(null);
|
|
11496
13347
|
}, []);
|
|
11497
|
-
return { statuses, statusText, feed, running, lastResult, run, cancel, reset };
|
|
13348
|
+
return { statuses, statusText, outputs, feed, running, lastResult, run, cancel, reset };
|
|
13349
|
+
}
|
|
13350
|
+
function applyOutputsToNodes(nodes, outputs) {
|
|
13351
|
+
return nodes.map((n) => {
|
|
13352
|
+
const kind = getNodeKind(n.data?.kind ?? n.type ?? "");
|
|
13353
|
+
if (!kind?.reactive || !(n.id in outputs)) return n;
|
|
13354
|
+
return { ...n, data: { ...n.data, output: outputs[n.id] } };
|
|
13355
|
+
});
|
|
11498
13356
|
}
|
|
11499
13357
|
function applyStatusesToNodes(nodes, statuses, statusText) {
|
|
11500
13358
|
return nodes.map((n) => ({
|
|
@@ -11506,12 +13364,12 @@ function applyStatusesToNodes(nodes, statuses, statusText) {
|
|
|
11506
13364
|
}
|
|
11507
13365
|
}));
|
|
11508
13366
|
}
|
|
11509
|
-
function preview(
|
|
13367
|
+
function preview(v2) {
|
|
11510
13368
|
try {
|
|
11511
|
-
const s = JSON.stringify(
|
|
11512
|
-
return s && s.length > 60 ? s.slice(0, 57) + "\u2026" : s ?? String(
|
|
13369
|
+
const s = JSON.stringify(v2);
|
|
13370
|
+
return s && s.length > 60 ? s.slice(0, 57) + "\u2026" : s ?? String(v2);
|
|
11513
13371
|
} catch {
|
|
11514
|
-
return String(
|
|
13372
|
+
return String(v2);
|
|
11515
13373
|
}
|
|
11516
13374
|
}
|
|
11517
13375
|
|
|
@@ -11736,27 +13594,31 @@ function RegistryNodeInner(props) {
|
|
|
11736
13594
|
data.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "ff-node__desc", children: data.description }),
|
|
11737
13595
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ff-node__body", children: kind.renderBody ? kind.renderBody({ nodeId: props.id, config, selected: props.selected ?? false }) : /* @__PURE__ */ jsxRuntime.jsx(DefaultBody, { config, kind: kind.configSchema }) }),
|
|
11738
13596
|
data.statusText && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "ff-node__status-text", children: data.statusText }),
|
|
11739
|
-
|
|
13597
|
+
data.output !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "ff-node__output", title: "Latest output", children: [
|
|
13598
|
+
"\u2192 ",
|
|
13599
|
+
previewValue(data.output)
|
|
13600
|
+
] }),
|
|
13601
|
+
inputs.map((p2, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11740
13602
|
Handle,
|
|
11741
13603
|
{
|
|
11742
13604
|
type: "target",
|
|
11743
13605
|
position: Position.Left,
|
|
11744
|
-
id:
|
|
13606
|
+
id: p2.id,
|
|
11745
13607
|
style: portStyle2(i, inputs.length),
|
|
11746
|
-
title:
|
|
13608
|
+
title: p2.label ?? p2.id
|
|
11747
13609
|
},
|
|
11748
|
-
|
|
13610
|
+
p2.id
|
|
11749
13611
|
)),
|
|
11750
|
-
outputs.map((
|
|
13612
|
+
outputs.map((p2, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11751
13613
|
Handle,
|
|
11752
13614
|
{
|
|
11753
13615
|
type: "source",
|
|
11754
13616
|
position: Position.Right,
|
|
11755
|
-
id:
|
|
13617
|
+
id: p2.id,
|
|
11756
13618
|
style: portStyle2(i, outputs.length),
|
|
11757
|
-
title:
|
|
13619
|
+
title: p2.label ?? p2.id
|
|
11758
13620
|
},
|
|
11759
|
-
|
|
13621
|
+
p2.id
|
|
11760
13622
|
))
|
|
11761
13623
|
]
|
|
11762
13624
|
}
|
|
@@ -11806,18 +13668,18 @@ function itemLabel(item) {
|
|
|
11806
13668
|
}
|
|
11807
13669
|
return String(item ?? "");
|
|
11808
13670
|
}
|
|
11809
|
-
function previewValue(
|
|
11810
|
-
if (
|
|
11811
|
-
if (typeof
|
|
11812
|
-
if (typeof
|
|
11813
|
-
if (Array.isArray(
|
|
11814
|
-
if (
|
|
11815
|
-
const names =
|
|
11816
|
-
const rest =
|
|
11817
|
-
return names ? truncate(names + rest) : `${
|
|
11818
|
-
}
|
|
11819
|
-
if (typeof
|
|
11820
|
-
const keys = Object.keys(
|
|
13671
|
+
function previewValue(v2) {
|
|
13672
|
+
if (v2 === null || v2 === void 0) return "";
|
|
13673
|
+
if (typeof v2 === "string") return truncate(v2);
|
|
13674
|
+
if (typeof v2 === "number" || typeof v2 === "boolean") return String(v2);
|
|
13675
|
+
if (Array.isArray(v2)) {
|
|
13676
|
+
if (v2.length === 0) return "none";
|
|
13677
|
+
const names = v2.slice(0, 3).map(itemLabel).filter(Boolean).join(", ");
|
|
13678
|
+
const rest = v2.length > 3 ? `, +${v2.length - 3}` : "";
|
|
13679
|
+
return names ? truncate(names + rest) : `${v2.length} item${v2.length === 1 ? "" : "s"}`;
|
|
13680
|
+
}
|
|
13681
|
+
if (typeof v2 === "object") {
|
|
13682
|
+
const keys = Object.keys(v2);
|
|
11821
13683
|
return keys.length === 0 ? "empty" : `${keys.length} field${keys.length === 1 ? "" : "s"}`;
|
|
11822
13684
|
}
|
|
11823
13685
|
return "\u2026";
|
|
@@ -11826,9 +13688,9 @@ function previewValue(v) {
|
|
|
11826
13688
|
// src/registry/index.ts
|
|
11827
13689
|
function buildNodeTypes() {
|
|
11828
13690
|
const map = {};
|
|
11829
|
-
for (const
|
|
11830
|
-
const renderer =
|
|
11831
|
-
for (const id2 of kindIds(
|
|
13691
|
+
for (const k2 of listNodeKinds()) {
|
|
13692
|
+
const renderer = k2.component ?? RegistryNode;
|
|
13693
|
+
for (const id2 of kindIds(k2)) map[id2] = renderer;
|
|
11832
13694
|
}
|
|
11833
13695
|
return map;
|
|
11834
13696
|
}
|
|
@@ -11885,8 +13747,11 @@ function FlowEditorInner({
|
|
|
11885
13747
|
ReactExports.useEffect(() => onNodeKindsChanged(() => force((n) => n + 1)), []);
|
|
11886
13748
|
const nodeTypes = ReactExports.useMemo(() => buildNodeTypes(), [listNodeKinds().length]);
|
|
11887
13749
|
const renderedNodes = ReactExports.useMemo(
|
|
11888
|
-
() =>
|
|
11889
|
-
|
|
13750
|
+
() => applyOutputsToNodes(
|
|
13751
|
+
applyStatusesToNodes(flow.nodes, runner.statuses, runner.statusText),
|
|
13752
|
+
runner.outputs
|
|
13753
|
+
),
|
|
13754
|
+
[flow.nodes, runner.statuses, runner.statusText, runner.outputs]
|
|
11890
13755
|
);
|
|
11891
13756
|
const [selectedId, setSelectedId] = ReactExports.useState(null);
|
|
11892
13757
|
const selected2 = ReactExports.useMemo(() => flow.nodes.find((n) => n.id === selectedId) ?? null, [flow.nodes, selectedId]);
|
|
@@ -11896,7 +13761,7 @@ function FlowEditorInner({
|
|
|
11896
13761
|
() => flow.edges.find((e) => e.id === selectedEdgeId) ?? null,
|
|
11897
13762
|
[flow.edges, selectedEdgeId]
|
|
11898
13763
|
);
|
|
11899
|
-
const handleNodeClick2 = (
|
|
13764
|
+
const handleNodeClick2 = (_e2, node) => {
|
|
11900
13765
|
setSelectedId(node.id);
|
|
11901
13766
|
setSelectedEdgeId(null);
|
|
11902
13767
|
};
|
|
@@ -11909,7 +13774,7 @@ function FlowEditorInner({
|
|
|
11909
13774
|
setSelectedEdgeId(null);
|
|
11910
13775
|
setMenu({ x: event.clientX, y: event.clientY, target: { type: "node", id: node.id } });
|
|
11911
13776
|
};
|
|
11912
|
-
const handleEdgeClick = (
|
|
13777
|
+
const handleEdgeClick = (_e2, edge) => {
|
|
11913
13778
|
setSelectedEdgeId(edge.id);
|
|
11914
13779
|
};
|
|
11915
13780
|
const handleEdgeContextMenu = (event, edge) => {
|
|
@@ -11957,14 +13822,14 @@ function FlowEditorInner({
|
|
|
11957
13822
|
(kindName, position) => {
|
|
11958
13823
|
const kind = getNodeKind(kindName);
|
|
11959
13824
|
if (!kind) return null;
|
|
11960
|
-
const
|
|
13825
|
+
const at2 = position ?? { x: 80, y: 80 };
|
|
11961
13826
|
const id2 = newNodeId();
|
|
11962
13827
|
flow.setNodes((all) => [
|
|
11963
13828
|
...all,
|
|
11964
13829
|
{
|
|
11965
13830
|
id: id2,
|
|
11966
13831
|
type: kind.name,
|
|
11967
|
-
position:
|
|
13832
|
+
position: at2,
|
|
11968
13833
|
data: { kind: kind.name, label: kind.label, config: defaultConfigFor(kind) }
|
|
11969
13834
|
}
|
|
11970
13835
|
]);
|
|
@@ -12012,15 +13877,15 @@ function FlowEditorInner({
|
|
|
12012
13877
|
clipboard.current = { nodes: sel.map((n) => ({ ...n })), edges: edges.map((e) => ({ ...e })) };
|
|
12013
13878
|
}, [flow]);
|
|
12014
13879
|
const pasteClipboard = ReactExports.useCallback(
|
|
12015
|
-
(
|
|
13880
|
+
(at2) => {
|
|
12016
13881
|
const clip = clipboard.current;
|
|
12017
13882
|
if (!clip || clip.nodes.length === 0) return;
|
|
12018
13883
|
const { nodes: clones, edges: cloneEdges } = cloneSubgraph(clip.nodes, clip.edges, { makeId: newNodeId, offset: 40 });
|
|
12019
13884
|
let placed = clones;
|
|
12020
|
-
if (
|
|
13885
|
+
if (at2) {
|
|
12021
13886
|
const minX = Math.min(...clones.map((n) => n.position.x));
|
|
12022
13887
|
const minY = Math.min(...clones.map((n) => n.position.y));
|
|
12023
|
-
placed = clones.map((n) => ({ ...n, position: { x: n.position.x - minX +
|
|
13888
|
+
placed = clones.map((n) => ({ ...n, position: { x: n.position.x - minX + at2.x, y: n.position.y - minY + at2.y } }));
|
|
12024
13889
|
}
|
|
12025
13890
|
flow.setGraph({
|
|
12026
13891
|
nodes: [...flow.nodes.map((n) => ({ ...n, selected: false })), ...placed.map((n) => ({ ...n, selected: true }))],
|
|
@@ -12070,10 +13935,10 @@ function FlowEditorInner({
|
|
|
12070
13935
|
(orientation = "horizontal", title) => {
|
|
12071
13936
|
const vertical = orientation === "vertical";
|
|
12072
13937
|
const lanes = flow.nodes.filter(isLaneNode);
|
|
12073
|
-
const
|
|
12074
|
-
const
|
|
13938
|
+
const w3 = vertical ? 280 : 680;
|
|
13939
|
+
const h2 = vertical ? 480 : 168;
|
|
12075
13940
|
const end = lanes.reduce(
|
|
12076
|
-
(m, l) => Math.max(m, vertical ? l.position.x + (l.width ??
|
|
13941
|
+
(m, l) => Math.max(m, vertical ? l.position.x + (l.width ?? w3) : l.position.y + (l.height ?? h2)),
|
|
12077
13942
|
0
|
|
12078
13943
|
);
|
|
12079
13944
|
const id2 = newNodeId();
|
|
@@ -12082,8 +13947,8 @@ function FlowEditorInner({
|
|
|
12082
13947
|
id: id2,
|
|
12083
13948
|
type: "@particle-academy/lane",
|
|
12084
13949
|
position: vertical ? { x: lanes.length ? end + 12 : 0, y: 0 } : { x: 0, y: lanes.length ? end + 12 : 0 },
|
|
12085
|
-
width:
|
|
12086
|
-
height:
|
|
13950
|
+
width: w3,
|
|
13951
|
+
height: h2,
|
|
12087
13952
|
data: { kind: "@particle-academy/lane", label: name, config: { title: name, orientation } }
|
|
12088
13953
|
};
|
|
12089
13954
|
flow.setNodes((all) => [...all, node]);
|
|
@@ -12093,7 +13958,7 @@ function FlowEditorInner({
|
|
|
12093
13958
|
[flow, isLaneNode]
|
|
12094
13959
|
);
|
|
12095
13960
|
const handleNodeDragStop = ReactExports.useCallback(
|
|
12096
|
-
(
|
|
13961
|
+
(_e2, node) => {
|
|
12097
13962
|
if (isLaneNode(node)) return;
|
|
12098
13963
|
const overLane = rf.getIntersectingNodes(node).find((n) => isLaneNode(n));
|
|
12099
13964
|
const currentParent = node.parentId;
|
|
@@ -12144,7 +14009,7 @@ function FlowEditorInner({
|
|
|
12144
14009
|
select: setSelectedId,
|
|
12145
14010
|
selectEdge: setSelectedEdgeId,
|
|
12146
14011
|
addNode,
|
|
12147
|
-
updateNode: (next) => flow.setNodes((all) => all.map((
|
|
14012
|
+
updateNode: (next) => flow.setNodes((all) => all.map((x2) => x2.id === next.id ? next : x2)),
|
|
12148
14013
|
deleteNodes,
|
|
12149
14014
|
deleteSelected: () => deleteNodes(selectedId ? [selectedId] : []),
|
|
12150
14015
|
deleteEdges,
|
|
@@ -12171,6 +14036,18 @@ function FlowEditorInner({
|
|
|
12171
14036
|
addLane,
|
|
12172
14037
|
assignToLane: (nodeId, laneId) => flow.setNodes((all) => assignToLane(all, nodeId, laneId)),
|
|
12173
14038
|
removeFromLane: (nodeId) => flow.setNodes((all) => removeFromLane(all, nodeId)),
|
|
14039
|
+
// dagre is loaded lazily so it stays out of the eager bundle — consumers
|
|
14040
|
+
// who never tidy pay nothing for it.
|
|
14041
|
+
autoLayout: (opts) => {
|
|
14042
|
+
void Promise.resolve().then(() => (init_layout(), layout_exports)).then(
|
|
14043
|
+
({ autoLayout: autoLayout2 }) => flow.setGraph({ nodes: autoLayout2({ nodes: flow.nodes, edges: flow.edges }, opts), edges: flow.edges })
|
|
14044
|
+
);
|
|
14045
|
+
},
|
|
14046
|
+
tidyLane: (laneId) => {
|
|
14047
|
+
void Promise.resolve().then(() => (init_layout(), layout_exports)).then(
|
|
14048
|
+
({ autoLayout: autoLayout2 }) => flow.setGraph({ nodes: autoLayout2({ nodes: flow.nodes, edges: flow.edges }, { scope: laneId }), edges: flow.edges })
|
|
14049
|
+
);
|
|
14050
|
+
},
|
|
12174
14051
|
run: () => runner.run({ nodes: flow.nodes, edges: flow.edges }, executors),
|
|
12175
14052
|
cancel: runner.cancel,
|
|
12176
14053
|
reset: runner.reset,
|
|
@@ -12223,6 +14100,7 @@ function FlowEditorInner({
|
|
|
12223
14100
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ff-editor__sep" }),
|
|
12224
14101
|
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "ff-editor__btn", "data-action": "add-lane", title: "Add a swimlane", onClick: () => api.addLane(), children: "\u25A4 Lane" })
|
|
12225
14102
|
] }),
|
|
14103
|
+
builtins.autoLayout !== false && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "ff-editor__btn", "data-action": "auto-layout", title: "Tidy \u2014 auto-arrange", onClick: () => api.autoLayout(), children: "\u2922 Tidy" }),
|
|
12226
14104
|
(builtins.export !== false || builtins.import !== false) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ff-editor__sep" }),
|
|
12227
14105
|
builtins.export !== false && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "ff-editor__btn", "data-action": "export", onClick: api.exportWorkflow, children: "\u2193 Export" }),
|
|
12228
14106
|
builtins.import !== false && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "ff-editor__btn", "data-action": "import", onClick: api.importWorkflow, children: "\u2191 Import" }),
|
|
@@ -12443,7 +14321,7 @@ function makeControlledFlowAdapter(value, onChange) {
|
|
|
12443
14321
|
};
|
|
12444
14322
|
}
|
|
12445
14323
|
function EdgeLabelEditor({
|
|
12446
|
-
x,
|
|
14324
|
+
x: x2,
|
|
12447
14325
|
y,
|
|
12448
14326
|
initial,
|
|
12449
14327
|
onCommit,
|
|
@@ -12459,7 +14337,7 @@ function EdgeLabelEditor({
|
|
|
12459
14337
|
"div",
|
|
12460
14338
|
{
|
|
12461
14339
|
className: "ff-editor__ctx ff-editor__edge-label",
|
|
12462
|
-
style: { top: y, left:
|
|
14340
|
+
style: { top: y, left: x2 },
|
|
12463
14341
|
onClick: (e) => e.stopPropagation(),
|
|
12464
14342
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12465
14343
|
"input",
|
|
@@ -12515,6 +14393,11 @@ function NodePort({ side, type, id: id2, style: style2, title, className }) {
|
|
|
12515
14393
|
|
|
12516
14394
|
// src/index.ts
|
|
12517
14395
|
registerBuiltinKinds();
|
|
14396
|
+
/*! Bundled license information:
|
|
14397
|
+
|
|
14398
|
+
@dagrejs/dagre/dist/dagre.esm.js:
|
|
14399
|
+
(*! For license information please see dagre.esm.js.LEGAL.txt *)
|
|
14400
|
+
*/
|
|
12518
14401
|
|
|
12519
14402
|
exports.ANY_PORT_TYPE = ANY_PORT_TYPE;
|
|
12520
14403
|
exports.ActionNode = ActionNode;
|
|
@@ -12541,6 +14424,7 @@ exports.TriggerNode = TriggerNode;
|
|
|
12541
14424
|
exports.WORKFLOW_SCHEMA_URL = WORKFLOW_SCHEMA_URL;
|
|
12542
14425
|
exports.WORKFLOW_SCHEMA_VERSION = WORKFLOW_SCHEMA_VERSION;
|
|
12543
14426
|
exports.alignNodes = alignNodes;
|
|
14427
|
+
exports.applyOutputsToNodes = applyOutputsToNodes;
|
|
12544
14428
|
exports.applyStatusesToNodes = applyStatusesToNodes;
|
|
12545
14429
|
exports.buildNodeTypes = buildNodeTypes;
|
|
12546
14430
|
exports.categoryAccent = categoryAccent;
|