@qe-libs/qeviz 0.5.7 → 0.6.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/README.md +188 -7
- package/dist/qeviz.es.js +1681 -1257
- package/dist/qeviz.es.js.map +1 -1
- package/dist/qeviz.umd.js +25 -5
- package/dist/qeviz.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/qeviz.es.js
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var pi = Object.defineProperty;
|
|
2
|
+
var Ks = (g) => {
|
|
3
|
+
throw TypeError(g);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
const
|
|
5
|
+
var c = (g, t) => pi(g, "name", { value: t, configurable: !0 });
|
|
6
|
+
var Js = (g, t, e) => t.has(g) || Ks("Cannot " + e);
|
|
7
|
+
var L = (g, t, e) => (Js(g, t, "read from private field"), e ? e.call(g) : t.get(g)), tt = (g, t, e) => t.has(g) ? Ks("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(g) : t.set(g, e), G = (g, t, e, s) => (Js(g, t, "write to private field"), s ? s.call(g, e) : t.set(g, e), e);
|
|
8
|
+
var de, ge, me, yt, fe;
|
|
9
|
+
const ls = class ls extends Array {
|
|
10
10
|
constructor(e, s, i, n, r) {
|
|
11
11
|
super(...s);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
tt(this, de);
|
|
13
|
+
tt(this, ge);
|
|
14
|
+
tt(this, me);
|
|
15
|
+
tt(this, yt);
|
|
16
|
+
tt(this, fe);
|
|
17
|
+
G(this, me, e), G(this, ge, i), G(this, yt, n), G(this, fe, n == null ? void 0 : n.classes), G(this, de, r);
|
|
18
18
|
}
|
|
19
19
|
get parent() {
|
|
20
|
-
return
|
|
20
|
+
return L(this, yt);
|
|
21
21
|
}
|
|
22
22
|
get names() {
|
|
23
|
-
return
|
|
23
|
+
return L(this, me);
|
|
24
24
|
}
|
|
25
25
|
get rowName() {
|
|
26
|
-
return
|
|
26
|
+
return L(this, ge);
|
|
27
27
|
}
|
|
28
28
|
get types() {
|
|
29
|
-
if (!
|
|
30
|
-
return
|
|
29
|
+
if (!L(this, yt)) throw new Error("No parent DataFrame attached to this row.");
|
|
30
|
+
return L(this, yt).types;
|
|
31
31
|
}
|
|
32
32
|
get classes() {
|
|
33
|
-
return
|
|
33
|
+
return L(this, fe);
|
|
34
34
|
}
|
|
35
35
|
get rowNumber() {
|
|
36
|
-
return
|
|
36
|
+
return L(this, de);
|
|
37
37
|
}
|
|
38
38
|
col(e) {
|
|
39
|
-
if (!
|
|
40
|
-
return
|
|
39
|
+
if (!L(this, yt)) throw new Error("No parent DataFrame attached to this row.");
|
|
40
|
+
return L(this, yt).col(e);
|
|
41
41
|
}
|
|
42
42
|
cols(...e) {
|
|
43
|
-
if (!
|
|
44
|
-
return
|
|
43
|
+
if (!L(this, yt)) throw new Error("No parent DataFrame attached to this row.");
|
|
44
|
+
return L(this, yt).cols(...e);
|
|
45
45
|
}
|
|
46
46
|
filter(e) {
|
|
47
47
|
console.error("DataFrameRow does not currently support filtering.");
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
|
|
51
|
-
let
|
|
52
|
-
var
|
|
53
|
-
const
|
|
50
|
+
de = new WeakMap(), ge = new WeakMap(), me = new WeakMap(), yt = new WeakMap(), fe = new WeakMap(), c(ls, "DataFrameRow");
|
|
51
|
+
let Jt = ls;
|
|
52
|
+
var bi = /* @__PURE__ */ ((g) => (g.Character = "character", g.Double = "double", g.Logical = "logical", g.Integer = "integer", g))(bi || {}), pe, xt, Vt, zt;
|
|
53
|
+
const cs = class cs extends Array {
|
|
54
54
|
constructor(e, s, i, n) {
|
|
55
55
|
super(s.length);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
tt(this, pe);
|
|
57
|
+
tt(this, xt);
|
|
58
|
+
tt(this, Vt);
|
|
59
|
+
tt(this, zt);
|
|
60
60
|
for (let r = 0; r < s.length; r++)
|
|
61
61
|
this[r] = s[r];
|
|
62
|
-
if (
|
|
62
|
+
if (G(this, pe, e), s.type !== void 0 ? G(this, xt, s.type) : s.every((r) => typeof r == "string" || r === null || r === void 0) ? G(this, xt, "character") : s.every((r) => Number.isInteger(r) || r === null || r === void 0) ? s.every((r) => r === 0 || r === 1 || r === null || r === void 0) ? G(this, xt, "logical") : G(this, xt, "integer") : s.every((r) => typeof r == "number" || r === null || r === void 0) ? G(this, xt, "double") : s.every((r) => typeof r == "boolean" || r === null || r === void 0) ? G(this, xt, "logical") : G(this, xt, "character"), G(this, zt, n), i && i.length !== this.length)
|
|
63
63
|
throw new Error("Row names length must match the number of rows in the DataFrameColumn.");
|
|
64
|
-
i && i.length > 0 ?
|
|
64
|
+
i && i.length > 0 ? G(this, Vt, i) : G(this, Vt, void 0);
|
|
65
65
|
}
|
|
66
66
|
get name() {
|
|
67
|
-
return
|
|
67
|
+
return L(this, pe);
|
|
68
68
|
}
|
|
69
69
|
get type() {
|
|
70
|
-
return
|
|
70
|
+
return L(this, xt);
|
|
71
71
|
}
|
|
72
72
|
get rowNames() {
|
|
73
|
-
return
|
|
73
|
+
return L(this, Vt);
|
|
74
74
|
}
|
|
75
75
|
row(e) {
|
|
76
|
-
if (!
|
|
77
|
-
return
|
|
76
|
+
if (!L(this, zt)) throw new Error("No parent DataFrame attached to this column.");
|
|
77
|
+
return L(this, zt).row(e);
|
|
78
78
|
}
|
|
79
79
|
rows(...e) {
|
|
80
|
-
if (!
|
|
81
|
-
return
|
|
80
|
+
if (!L(this, zt)) throw new Error("No parent DataFrame attached to this column.");
|
|
81
|
+
return L(this, zt).rows(...e);
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
|
|
85
|
-
let
|
|
86
|
-
var
|
|
87
|
-
const
|
|
84
|
+
pe = new WeakMap(), xt = new WeakMap(), Vt = new WeakMap(), zt = new WeakMap(), c(cs, "DataFrameColumn");
|
|
85
|
+
let Me = cs;
|
|
86
|
+
var It, ht, be;
|
|
87
|
+
const re = class re extends Array {
|
|
88
88
|
constructor(e, s, i, n) {
|
|
89
89
|
if ((!e || !s) && (s = [], e = []), s.map((r) => r.length).every((r) => r === e.length)) {
|
|
90
90
|
const r = [];
|
|
@@ -97,37 +97,37 @@ const Zt = class Zt extends Array {
|
|
|
97
97
|
s = r;
|
|
98
98
|
}
|
|
99
99
|
super(s.length);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
tt(this, It);
|
|
101
|
+
tt(this, ht);
|
|
102
|
+
tt(this, be);
|
|
103
103
|
if (s.forEach((r, a) => {
|
|
104
|
-
r instanceof
|
|
105
|
-
}),
|
|
104
|
+
r instanceof Me ? this[a] = r : this[a] = new Me(e[a], r, i, this);
|
|
105
|
+
}), G(this, It, e), i && this[0] && i.length !== this[0].length)
|
|
106
106
|
throw new Error("Row names length must match the number of rows in the DataFrame.");
|
|
107
|
-
if (i && i.length > 0 &&
|
|
107
|
+
if (i && i.length > 0 && G(this, ht, i), n && n.length !== this.length)
|
|
108
108
|
throw new Error("Classes length must match the number of columns in the DataFrame.");
|
|
109
|
-
n && n.length > 0 &&
|
|
109
|
+
n && n.length > 0 && G(this, be, n);
|
|
110
110
|
}
|
|
111
111
|
get classes() {
|
|
112
|
-
return
|
|
112
|
+
return L(this, be);
|
|
113
113
|
}
|
|
114
114
|
getColumnByName(e) {
|
|
115
|
-
const s =
|
|
115
|
+
const s = L(this, It).indexOf(e);
|
|
116
116
|
return s >= 0 ? this[s] : void 0;
|
|
117
117
|
}
|
|
118
118
|
getRowByIndex(e) {
|
|
119
119
|
if (this && this.length === 0)
|
|
120
|
-
return console.warn("DataFrame is empty, cannot get row by index", e), new
|
|
120
|
+
return console.warn("DataFrame is empty, cannot get row by index", e), new Jt(L(this, It), [], void 0, this, e);
|
|
121
121
|
const s = [];
|
|
122
122
|
for (let i of this) {
|
|
123
123
|
let n = i[e];
|
|
124
124
|
s.push(n);
|
|
125
125
|
}
|
|
126
|
-
return new
|
|
126
|
+
return new Jt(L(this, It), s, L(this, ht) ? L(this, ht)[e] : void 0, this, e);
|
|
127
127
|
}
|
|
128
128
|
getRowByName(e) {
|
|
129
|
-
if (!
|
|
130
|
-
const s =
|
|
129
|
+
if (!L(this, ht)) return;
|
|
130
|
+
const s = L(this, ht).indexOf(e);
|
|
131
131
|
if (s !== -1)
|
|
132
132
|
return this.getRowByIndex(s);
|
|
133
133
|
}
|
|
@@ -157,11 +157,11 @@ const Zt = class Zt extends Array {
|
|
|
157
157
|
if (!this[0] || this.length === 0)
|
|
158
158
|
return [];
|
|
159
159
|
const r = this[0].length;
|
|
160
|
-
i = Array.from({ length: r }, (a, h) => this.getRowByIndex(h)), n =
|
|
160
|
+
i = Array.from({ length: r }, (a, h) => this.getRowByIndex(h)), n = L(this, ht);
|
|
161
161
|
} else
|
|
162
162
|
e.length === 1 && Array.isArray(e[0]) ? s = e[0] : s = e, i = s.map((r, a) => {
|
|
163
163
|
let h = this.row(r);
|
|
164
|
-
return
|
|
164
|
+
return L(this, ht) && h && (n == null || n.push(L(this, ht)[a])), h;
|
|
165
165
|
}).filter((r) => r !== void 0);
|
|
166
166
|
return i;
|
|
167
167
|
}
|
|
@@ -173,21 +173,21 @@ const Zt = class Zt extends Array {
|
|
|
173
173
|
}
|
|
174
174
|
cols(...e) {
|
|
175
175
|
let s, i, n = [];
|
|
176
|
-
return e.length === 0 ? (i = this.slice(), n =
|
|
176
|
+
return e.length === 0 ? (i = this.slice(), n = L(this, It)) : (e.length === 1 && Array.isArray(e[0]) ? s = e[0] : s = e, i = s.map((r) => this.col(r)).filter((r) => r !== void 0), n = i.map((r) => r.name)), new re(n, i, L(this, ht));
|
|
177
177
|
}
|
|
178
178
|
subset(e, s) {
|
|
179
179
|
const i = s && s.length > 0 ? this.cols(...s) : this.slice();
|
|
180
|
-
return new
|
|
180
|
+
return new re(
|
|
181
181
|
i.map((n) => n.name),
|
|
182
182
|
i.map((n) => n.values),
|
|
183
|
-
|
|
183
|
+
L(this, ht)
|
|
184
184
|
);
|
|
185
185
|
}
|
|
186
186
|
get names() {
|
|
187
|
-
return
|
|
187
|
+
return L(this, It);
|
|
188
188
|
}
|
|
189
189
|
get rowNames() {
|
|
190
|
-
return
|
|
190
|
+
return L(this, ht);
|
|
191
191
|
}
|
|
192
192
|
get nrow() {
|
|
193
193
|
return this[0] ? this[0].length : 0;
|
|
@@ -196,11 +196,11 @@ const Zt = class Zt extends Array {
|
|
|
196
196
|
return this.length;
|
|
197
197
|
}
|
|
198
198
|
};
|
|
199
|
-
|
|
200
|
-
let
|
|
201
|
-
const
|
|
199
|
+
It = new WeakMap(), ht = new WeakMap(), be = new WeakMap(), c(re, "DataFrame");
|
|
200
|
+
let Xt = re;
|
|
201
|
+
const _s = class _s {
|
|
202
202
|
constructor(t = {}) {
|
|
203
|
-
this.unit_id_col = "id", this.node_id_col = "id", this.group_col = null, this.directed = !1, this.palette = [], this._points = t.points ?? new
|
|
203
|
+
this.unit_id_col = "id", this.node_id_col = "id", this.group_col = null, this.directed = !1, this.palette = [], this._points = t.points ?? new Xt(), this._nodes = t.nodes ?? new Xt(), this._edges = t.edges ?? new Xt(), this._dimensions = t.dimensions ?? [], this._confidence = void 0, this._outlier = void 0, this._groups = void 0;
|
|
204
204
|
}
|
|
205
205
|
get updated() {
|
|
206
206
|
return this._updated;
|
|
@@ -285,23 +285,23 @@ const is = class is {
|
|
|
285
285
|
this[t] = e;
|
|
286
286
|
}
|
|
287
287
|
};
|
|
288
|
-
|
|
289
|
-
let
|
|
290
|
-
const
|
|
291
|
-
function
|
|
292
|
-
|
|
288
|
+
c(_s, "Model");
|
|
289
|
+
let ts = _s;
|
|
290
|
+
const yi = globalThis.__QEVIZ_DEBUG__ === !0;
|
|
291
|
+
function Qt(...g) {
|
|
292
|
+
yi && console.log(...g);
|
|
293
293
|
}
|
|
294
|
-
|
|
295
|
-
const
|
|
296
|
-
get: /* @__PURE__ */
|
|
294
|
+
c(Qt, "dbg");
|
|
295
|
+
const Wi = {
|
|
296
|
+
get: /* @__PURE__ */ c((g) => {
|
|
297
297
|
const t = [...document.querySelectorAll("qe-graph")];
|
|
298
|
-
return typeof
|
|
298
|
+
return typeof g == "number" && g >= 0 ? t[g] : t;
|
|
299
299
|
}, "get")
|
|
300
|
-
},
|
|
300
|
+
}, Bt = class Bt extends HTMLElement {
|
|
301
301
|
constructor() {
|
|
302
|
-
super(), this._isVisible = !0, this.output = "", this._updated = "", this._active_points = [], this._points = /* @__PURE__ */ new Map(), this._edges = /* @__PURE__ */ new Map(), this._labels = /* @__PURE__ */ new Map(), this._model = new
|
|
302
|
+
super(), this._isVisible = !0, this.output = "", this._updated = "", this._active_points = [], this._points = /* @__PURE__ */ new Map(), this._edges = /* @__PURE__ */ new Map(), this._labels = /* @__PURE__ */ new Map(), this._model = new ts();
|
|
303
303
|
const t = this.attachShadow({ mode: "open" }), e = document.createElement("style");
|
|
304
|
-
e.textContent =
|
|
304
|
+
e.textContent = Bt.styles, t.appendChild(e), this._outputElement = document.createElement("div"), t.appendChild(this._outputElement);
|
|
305
305
|
}
|
|
306
306
|
static get observedAttributes() {
|
|
307
307
|
return ["updated"];
|
|
@@ -339,7 +339,7 @@ const Pi = {
|
|
|
339
339
|
return this._labels;
|
|
340
340
|
}
|
|
341
341
|
connectedCallback() {
|
|
342
|
-
|
|
342
|
+
Qt("QEVisualElement connected"), this.render();
|
|
343
343
|
}
|
|
344
344
|
/**
|
|
345
345
|
* Accept pre-fetched ENA model data and update the visualization.
|
|
@@ -348,44 +348,44 @@ const Pi = {
|
|
|
348
348
|
*/
|
|
349
349
|
setModelData(t) {
|
|
350
350
|
var r, a, h, o;
|
|
351
|
-
["nodes", "edges", "points", "groups", "confidence", "outlier", "trajectories", "networks", "pointsets"].forEach((
|
|
352
|
-
var
|
|
353
|
-
const
|
|
354
|
-
if (!((
|
|
355
|
-
const
|
|
356
|
-
let
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
this._model.setByKey(
|
|
351
|
+
["nodes", "edges", "points", "groups", "confidence", "outlier", "trajectories", "networks", "pointsets"].forEach((_) => {
|
|
352
|
+
var z;
|
|
353
|
+
const m = t[_];
|
|
354
|
+
if (!((z = m == null ? void 0 : m.data) != null && z.length)) return;
|
|
355
|
+
const p = m.data, u = m.types || {}, d = Object.keys(p[0]), l = p.map((D) => Object.values(D)), b = d.map((D) => u[D] ?? "character");
|
|
356
|
+
let f;
|
|
357
|
+
_ === "networks" ? f = "name" : _ === "pointsets" ? f = "id" : _ === "nodes" ? f = t.node_id_col ?? d.find((D) => (u[D] ?? "character") === "character") : _ === "edges" || _ === "points" || _ === "trajectories" ? f = t.id_col ?? d.find((D) => (u[D] ?? "character") === "character") : f = t.group_col ?? d.find((D) => (u[D] ?? "character") === "character");
|
|
358
|
+
const w = f ? d.indexOf(f) : 0, $ = l.map((D) => String(D[w]));
|
|
359
|
+
this._model.setByKey(_, new Xt(d, l, $, b));
|
|
360
360
|
}), t.updated !== void 0 && this._model.setByKey("updated", t.updated), t.directed !== void 0 && (this._model.directed = t.directed), Array.isArray(t.palette) && (this._model.palette = t.palette.map(String));
|
|
361
361
|
const s = this._model.nodes;
|
|
362
|
-
this._model.node_id_col = t.node_id_col ?? ((r = s == null ? void 0 : s.names) == null ? void 0 : r.find((
|
|
363
|
-
var
|
|
364
|
-
return ((
|
|
362
|
+
this._model.node_id_col = t.node_id_col ?? ((r = s == null ? void 0 : s.names) == null ? void 0 : r.find((_) => {
|
|
363
|
+
var m;
|
|
364
|
+
return ((m = s.col(_)) == null ? void 0 : m.type) === "character";
|
|
365
365
|
})) ?? "id";
|
|
366
366
|
const i = this._model.points;
|
|
367
|
-
this._model.unit_id_col = t.id_col ?? ((a = i == null ? void 0 : i.names) == null ? void 0 : a.find((
|
|
368
|
-
var
|
|
369
|
-
return ((
|
|
367
|
+
this._model.unit_id_col = t.id_col ?? ((a = i == null ? void 0 : i.names) == null ? void 0 : a.find((_) => {
|
|
368
|
+
var m;
|
|
369
|
+
return ((m = i.col(_)) == null ? void 0 : m.type) === "character";
|
|
370
370
|
})) ?? "id";
|
|
371
371
|
const n = this._model.unit_id_col;
|
|
372
|
-
if (this._model.group_col = t.group_col ?? ((h = i == null ? void 0 : i.names) == null ? void 0 : h.find((
|
|
373
|
-
var
|
|
374
|
-
return
|
|
372
|
+
if (this._model.group_col = t.group_col ?? ((h = i == null ? void 0 : i.names) == null ? void 0 : h.find((_) => {
|
|
373
|
+
var m;
|
|
374
|
+
return _ !== n && ((m = i.col(_)) == null ? void 0 : m.type) === "character";
|
|
375
375
|
})) ?? null, (o = s == null ? void 0 : s.names) != null && o.length) {
|
|
376
|
-
const
|
|
377
|
-
if (
|
|
378
|
-
this._model.dimensions = [
|
|
376
|
+
const _ = this._model.node_id_col, m = t.x_col, p = t.y_col;
|
|
377
|
+
if (m && p)
|
|
378
|
+
this._model.dimensions = [m, p];
|
|
379
379
|
else {
|
|
380
|
-
const
|
|
381
|
-
if (
|
|
382
|
-
const
|
|
383
|
-
return
|
|
380
|
+
const u = s.names.filter((d) => {
|
|
381
|
+
if (d === _) return !1;
|
|
382
|
+
const l = s.col(d);
|
|
383
|
+
return l && l.type !== "character" && l.type !== "logical";
|
|
384
384
|
});
|
|
385
|
-
|
|
385
|
+
u.length >= 2 && (this._model.dimensions = [m ?? u[0], p ?? u[1]]);
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
-
this.updated = this._model.updated !== void 0 ? String(this._model.updated) : String(Date.now()),
|
|
388
|
+
this.updated = this._model.updated !== void 0 ? String(this._model.updated) : String(Date.now()), Qt("Model updated via setModelData:", this.updated), this.render();
|
|
389
389
|
}
|
|
390
390
|
/**
|
|
391
391
|
* Base implementation is a no-op. Subclasses (e.g. RQEVisualElement) override
|
|
@@ -398,7 +398,7 @@ const Pi = {
|
|
|
398
398
|
this._isVisible ? this.classList.remove("hidden") : this.classList.add("hidden"), ((t = this._model) == null ? void 0 : t.updated) !== void 0 && this._model.updated !== null ? this._outputElement.innerHTML = `${this.output}<slot></slot>` : this._outputElement.innerHTML = "Define the model on the left.";
|
|
399
399
|
}
|
|
400
400
|
};
|
|
401
|
-
|
|
401
|
+
c(Bt, "QEVisualElement"), Bt.tagName = "qe-visual", Bt.styles = `
|
|
402
402
|
:host { display: block; width: 100%; }
|
|
403
403
|
:host(.hidden) { display: none !important; }
|
|
404
404
|
/* The output wrapper and the slotted graph fill the host so the plot
|
|
@@ -406,8 +406,8 @@ _(zt, "QEVisualElement"), zt.tagName = "qe-visual", zt.styles = `
|
|
|
406
406
|
div { display: block; width: 100%; height: 100%; }
|
|
407
407
|
::slotted(qe-graph) { display: block; width: 100%; height: 100%; }
|
|
408
408
|
`;
|
|
409
|
-
let
|
|
410
|
-
customElements.define(
|
|
409
|
+
let Ie = Bt;
|
|
410
|
+
customElements.define(Ie.tagName, Ie);
|
|
411
411
|
const dt = class dt {
|
|
412
412
|
constructor(t) {
|
|
413
413
|
return this.base = typeof t == "string" ? t : t.base, new Proxy(this, {
|
|
@@ -461,34 +461,34 @@ const dt = class dt {
|
|
|
461
461
|
return `rgb(${t}, ${e}, ${s})`;
|
|
462
462
|
}
|
|
463
463
|
};
|
|
464
|
-
|
|
464
|
+
c(dt, "Color"), dt._cssCache = /* @__PURE__ */ new Map();
|
|
465
465
|
let st = dt;
|
|
466
|
-
const
|
|
466
|
+
const oe = class oe extends st {
|
|
467
467
|
constructor(t, e, s) {
|
|
468
468
|
super(t), this.weight = e, this.alpha = s;
|
|
469
469
|
}
|
|
470
470
|
// Parse hex → HSV (h in [0, 360), s/v in [0, 1]).
|
|
471
471
|
static toHSV(t) {
|
|
472
|
-
const { r: e, g: s, b: i } = st.parseColor(t), n = e / 255, r = s / 255, a = i / 255, h = Math.max(n, r, a), o = Math.min(n, r, a),
|
|
473
|
-
let
|
|
474
|
-
if (
|
|
472
|
+
const { r: e, g: s, b: i } = st.parseColor(t), n = e / 255, r = s / 255, a = i / 255, h = Math.max(n, r, a), o = Math.min(n, r, a), _ = h - o, m = h, p = h === 0 ? 0 : _ / h;
|
|
473
|
+
let u = 0;
|
|
474
|
+
if (_ > 0)
|
|
475
475
|
switch (h) {
|
|
476
476
|
case n:
|
|
477
|
-
|
|
477
|
+
u = ((r - a) / _ + (r < a ? 6 : 0)) / 6;
|
|
478
478
|
break;
|
|
479
479
|
case r:
|
|
480
|
-
|
|
480
|
+
u = ((a - n) / _ + 2) / 6;
|
|
481
481
|
break;
|
|
482
482
|
default:
|
|
483
|
-
|
|
483
|
+
u = ((n - r) / _ + 4) / 6;
|
|
484
484
|
}
|
|
485
|
-
return { h:
|
|
485
|
+
return { h: u * 360, s: p, v: m };
|
|
486
486
|
}
|
|
487
487
|
// Convert HSV + alpha → rgba() CSS string.
|
|
488
488
|
static hsvToRgba(t, e, s, i) {
|
|
489
489
|
const n = s * e, r = n * (1 - Math.abs(t / 60 % 2 - 1)), a = s - n;
|
|
490
|
-
let h = 0, o = 0,
|
|
491
|
-
return t < 60 ? (h = n, o = r,
|
|
490
|
+
let h = 0, o = 0, _ = 0;
|
|
491
|
+
return t < 60 ? (h = n, o = r, _ = 0) : t < 120 ? (h = r, o = n, _ = 0) : t < 180 ? (h = 0, o = n, _ = r) : t < 240 ? (h = 0, o = r, _ = n) : t < 300 ? (h = r, o = 0, _ = n) : (h = n, o = 0, _ = r), `rgba(${Math.round((h + a) * 255)},${Math.round((o + a) * 255)},${Math.round((_ + a) * 255)},${i.toFixed(4)})`;
|
|
492
492
|
}
|
|
493
493
|
// Returns rgba(...) matching rENA's edge-color convention (ena.plot.network):
|
|
494
494
|
// • hue and value (brightness) are preserved from the base color
|
|
@@ -501,13 +501,13 @@ const Qt = class Qt extends st {
|
|
|
501
501
|
// #EE6677 have HSL lightness ≈ 67%, so 100% HSL saturation still looks
|
|
502
502
|
// washed-out, whereas HSV value ≈ 0.93 gives the expected vivid output.
|
|
503
503
|
toString() {
|
|
504
|
-
const { h: t, v: e } =
|
|
505
|
-
return
|
|
504
|
+
const { h: t, v: e } = oe.toHSV(this.base), s = Math.min(1, Math.abs(this.weight)), i = this.alpha === void 0 ? s : Math.min(1, Math.max(0, this.alpha));
|
|
505
|
+
return oe.hsvToRgba(t, s, e, i);
|
|
506
506
|
}
|
|
507
507
|
};
|
|
508
|
-
|
|
509
|
-
let
|
|
510
|
-
const
|
|
508
|
+
c(oe, "WeightedColor");
|
|
509
|
+
let Ne = oe;
|
|
510
|
+
const us = class us {
|
|
511
511
|
constructor(t = null) {
|
|
512
512
|
this._values = [1, 0, 0, 1, 0, 0], this._keys = ["a", "b", "c", "d", "e", "f"], t && (this.values = t);
|
|
513
513
|
}
|
|
@@ -532,8 +532,11 @@ const ns = class ns {
|
|
|
532
532
|
toArray() {
|
|
533
533
|
return this._values;
|
|
534
534
|
}
|
|
535
|
+
/** Set one matrix entry. Any finite number is accepted (0 resets a pan);
|
|
536
|
+
* NaN / ±Infinity are ignored so a bad input can't blank the plot. */
|
|
535
537
|
set(t, e) {
|
|
536
|
-
|
|
538
|
+
const s = this._keys.indexOf(t);
|
|
539
|
+
s >= 0 && Number.isFinite(e) && (this._values[s] = e);
|
|
537
540
|
}
|
|
538
541
|
get(t) {
|
|
539
542
|
return this._values[this._keys.findIndex((e) => e === t)];
|
|
@@ -584,148 +587,148 @@ const ns = class ns {
|
|
|
584
587
|
return this.get("f");
|
|
585
588
|
}
|
|
586
589
|
};
|
|
587
|
-
|
|
588
|
-
let
|
|
589
|
-
var
|
|
590
|
-
((
|
|
590
|
+
c(us, "Transform");
|
|
591
|
+
let le = us;
|
|
592
|
+
var ce;
|
|
593
|
+
((g) => {
|
|
591
594
|
((t) => {
|
|
592
595
|
function e(s) {
|
|
593
596
|
return `matrix(${["a", "b", "c", "d", "e", "f"].map((n) => s[n]).join(" ")})`;
|
|
594
597
|
}
|
|
595
|
-
|
|
596
|
-
})(
|
|
598
|
+
c(e, "matrixString"), t.matrixString = e;
|
|
599
|
+
})(g.Matrix || (g.Matrix = {})), ((t) => {
|
|
597
600
|
((s) => {
|
|
598
601
|
function i(r, a, h) {
|
|
599
602
|
const o = e.toRad(a);
|
|
600
603
|
return [r[0] + h * Math.cos(o), r[1] + h * Math.sin(o)];
|
|
601
604
|
}
|
|
602
|
-
|
|
605
|
+
c(i, "translate"), s.translate = i;
|
|
603
606
|
function n(r, a, h) {
|
|
604
607
|
const o = e.toRad(a);
|
|
605
|
-
function
|
|
608
|
+
function _(m, p) {
|
|
606
609
|
return [
|
|
607
|
-
|
|
608
|
-
|
|
610
|
+
m[0] * Math.cos(p) - m[1] * Math.sin(p),
|
|
611
|
+
m[0] * Math.sin(p) + m[1] * Math.cos(p)
|
|
609
612
|
];
|
|
610
613
|
}
|
|
611
|
-
if (_
|
|
612
|
-
return
|
|
614
|
+
if (c(_, "rotatePoint"), !h || h[0] === 0 && h[1] === 0)
|
|
615
|
+
return _(r, o);
|
|
613
616
|
{
|
|
614
|
-
const
|
|
615
|
-
return
|
|
617
|
+
const m = r.map((u, d) => u - h[d]);
|
|
618
|
+
return _(m, o).map((u, d) => u + h[d]);
|
|
616
619
|
}
|
|
617
620
|
}
|
|
618
|
-
|
|
621
|
+
c(n, "rotate"), s.rotate = n;
|
|
619
622
|
})(t.Point || (t.Point = {})), ((s) => {
|
|
620
|
-
function i(
|
|
621
|
-
return (
|
|
623
|
+
function i(l, b) {
|
|
624
|
+
return (b[1] - l[1]) / (b[0] - l[0]);
|
|
622
625
|
}
|
|
623
|
-
|
|
624
|
-
function n(
|
|
625
|
-
const
|
|
626
|
-
return
|
|
626
|
+
c(i, "slope"), s.slope = i;
|
|
627
|
+
function n(l, b) {
|
|
628
|
+
const f = i(l, b);
|
|
629
|
+
return l[1] - f * l[0];
|
|
627
630
|
}
|
|
628
|
-
|
|
629
|
-
function r(
|
|
631
|
+
c(n, "intercept"), s.intercept = n;
|
|
632
|
+
function r(l, b) {
|
|
630
633
|
return {
|
|
631
|
-
slope: i(
|
|
632
|
-
intercept: n(
|
|
634
|
+
slope: i(l, b),
|
|
635
|
+
intercept: n(l, b)
|
|
633
636
|
};
|
|
634
637
|
}
|
|
635
|
-
|
|
636
|
-
function a(
|
|
637
|
-
const
|
|
638
|
-
return [
|
|
638
|
+
c(r, "slopeIntercept"), s.slopeIntercept = r;
|
|
639
|
+
function a(l, b = 0) {
|
|
640
|
+
const f = b, w = (1 - f) * l[0][0] + f * l[1][0], $ = (1 - f) * l[0][1] + f * l[1][1];
|
|
641
|
+
return [w, $];
|
|
639
642
|
}
|
|
640
|
-
|
|
641
|
-
function h(
|
|
642
|
-
return Array.isArray(
|
|
643
|
+
c(a, "point_along"), s.point_along = a;
|
|
644
|
+
function h(l, b, f = 0.5) {
|
|
645
|
+
return Array.isArray(l[0]) && (b = l[1], l = l[0]), [0, 1].map((w) => (parseFloat(l[w]) + parseFloat(b[w])) * f);
|
|
643
646
|
}
|
|
644
|
-
|
|
645
|
-
function o(
|
|
646
|
-
return Array.isArray(
|
|
647
|
-
[0, 1].map((
|
|
647
|
+
c(h, "midpoint"), s.midpoint = h;
|
|
648
|
+
function o(l, b) {
|
|
649
|
+
return Array.isArray(l[0]) && (b = l[1], l = l[0]), Math.sqrt(
|
|
650
|
+
[0, 1].map((f) => Math.pow(b[f] - l[f], 2)).reduce((f, w) => f + w, 0)
|
|
648
651
|
);
|
|
649
652
|
}
|
|
650
|
-
|
|
651
|
-
function l
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
],
|
|
656
|
-
-
|
|
657
|
-
|
|
658
|
-
],
|
|
659
|
-
-
|
|
660
|
-
-
|
|
661
|
-
],
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
],
|
|
665
|
-
|
|
666
|
-
|
|
653
|
+
c(o, "length"), s.length = o;
|
|
654
|
+
function _(l, b = [0, 0]) {
|
|
655
|
+
const f = [
|
|
656
|
+
l[1][0] - b[0],
|
|
657
|
+
l[1][1] - b[1]
|
|
658
|
+
], w = [
|
|
659
|
+
-f[1],
|
|
660
|
+
f[0]
|
|
661
|
+
], $ = [
|
|
662
|
+
-w[0],
|
|
663
|
+
-w[1]
|
|
664
|
+
], z = [
|
|
665
|
+
w[0] + b[0],
|
|
666
|
+
w[1] + b[1]
|
|
667
|
+
], D = [
|
|
668
|
+
$[0] + b[0],
|
|
669
|
+
$[1] + b[1]
|
|
667
670
|
];
|
|
668
|
-
return [
|
|
671
|
+
return [z, D];
|
|
669
672
|
}
|
|
670
|
-
_
|
|
671
|
-
function
|
|
672
|
-
const
|
|
673
|
-
|
|
674
|
-
const
|
|
675
|
-
(
|
|
676
|
-
),
|
|
677
|
-
(
|
|
673
|
+
c(_, "rotate"), s.rotate = _;
|
|
674
|
+
function m(l, b, f = 90) {
|
|
675
|
+
const w = g.Geometry.Line.slope(l[0], l[1]), $ = g.Geometry.Line.intercept(l[0], l[1]), z = [0, $], D = [1, w + $];
|
|
676
|
+
l = [z, D];
|
|
677
|
+
const lt = [l[0][0], l[1][0]], ct = [l[0][1], l[1][1]], J = b[0], _t = b[1], Z = -2 * Math.PI * f / 360, kt = lt.map(
|
|
678
|
+
(Lt, vt) => (Lt - J) * Math.cos(Z) - (ct[vt] - _t) * Math.sin(Z) + J
|
|
679
|
+
), Qe = ct.map(
|
|
680
|
+
(Lt, vt) => (lt[vt] - J) * Math.sin(Z) - (Lt - _t) * Math.cos(Z) + _t
|
|
678
681
|
);
|
|
679
682
|
return [
|
|
680
|
-
[
|
|
681
|
-
[
|
|
683
|
+
[kt[0], Qe[0]],
|
|
684
|
+
[kt[1], Qe[1]]
|
|
682
685
|
];
|
|
683
686
|
}
|
|
684
|
-
|
|
685
|
-
function
|
|
686
|
-
const [[
|
|
687
|
-
return [
|
|
687
|
+
c(m, "rotate2"), s.rotate2 = m;
|
|
688
|
+
function p(l, b) {
|
|
689
|
+
const [[f, w], [$, z]] = l, [[D, lt], [ct, J]] = b, _t = (f - $) * (lt - J) - (w - z) * (D - ct), Z = (f * z - w * $) * (D - ct) - (f - $) * (D * J - lt * ct), kt = (f * z - w * $) * (lt - J) - (w - z) * (D * J - lt * ct);
|
|
690
|
+
return [Z / _t, kt / _t];
|
|
688
691
|
}
|
|
689
|
-
|
|
690
|
-
function
|
|
691
|
-
let { slope:
|
|
692
|
-
if (Math.sqrt(Math.pow(
|
|
693
|
-
let
|
|
694
|
-
|
|
692
|
+
c(p, "intersection"), s.intersection = p;
|
|
693
|
+
function u(l, b, f) {
|
|
694
|
+
let { slope: w, intercept: $ } = g.Geometry.Line.slopeIntercept(l[0], l[1]), z = 1 + Math.pow(w, 2), D = 2 * w * $ - 2 * b[1] * w - 2 * b[0], lt = Math.pow(b[0], 2) + Math.pow($, 2) + Math.pow(b[1], 2) - 2 * b[1] * $ - Math.pow(f, 2), ct = [[1 / 0, 1 / 0], [1 / 0, 1 / 0]];
|
|
695
|
+
if (Math.sqrt(Math.pow(D, 2) - 4 * z * lt) >= 0) {
|
|
696
|
+
let J = (-D + Math.sqrt(Math.pow(D, 2) - 4 * z * lt)) / (2 * z), _t = (-D - Math.sqrt(Math.pow(D, 2) - 4 * z * lt)) / (2 * z), Z = w * J + $, kt = w * _t + $;
|
|
697
|
+
ct = [[J, Z], [_t, kt]];
|
|
695
698
|
} else
|
|
696
699
|
console.error("The line and the circumference do not intersect");
|
|
697
|
-
return
|
|
700
|
+
return ct;
|
|
698
701
|
}
|
|
699
|
-
|
|
700
|
-
function
|
|
701
|
-
return (
|
|
702
|
+
c(u, "intersect_circle"), s.intersect_circle = u;
|
|
703
|
+
function d(l) {
|
|
704
|
+
return (b) => b === 0 ? l[0] : b === 1 ? l[1] : g.Geometry.Point.translate(l[0], g.Geometry.Angle.line(l), g.Geometry.Line.length(l) * b);
|
|
702
705
|
}
|
|
703
|
-
|
|
706
|
+
c(d, "interpolate"), s.interpolate = d;
|
|
704
707
|
})(t.Line || (t.Line = {}));
|
|
705
708
|
let e;
|
|
706
709
|
((s) => {
|
|
707
710
|
function i(a) {
|
|
708
711
|
return a / 180 * Math.PI;
|
|
709
712
|
}
|
|
710
|
-
|
|
713
|
+
c(i, "toRad"), s.toRad = i;
|
|
711
714
|
function n(a) {
|
|
712
715
|
return a * 180 / Math.PI;
|
|
713
716
|
}
|
|
714
|
-
|
|
717
|
+
c(n, "toDeg"), s.toDeg = n;
|
|
715
718
|
function r(a) {
|
|
716
719
|
if (a.length !== 2 || !Array.isArray(a[0]) || !Array.isArray(a[1]) || a[0].length !== 2 || a[1].length !== 2)
|
|
717
720
|
throw new Error("Invalid line format. Expected [[x1, y1], [x2, y2]].");
|
|
718
|
-
return
|
|
721
|
+
return g.Geometry.Angle.toDeg(
|
|
719
722
|
Math.atan2(a[1][1] - a[0][1], a[1][0] - a[0][0])
|
|
720
723
|
);
|
|
721
724
|
}
|
|
722
|
-
|
|
725
|
+
c(r, "line"), s.line = r;
|
|
723
726
|
})(e = t.Angle || (t.Angle = {}));
|
|
724
|
-
})(
|
|
727
|
+
})(g.Geometry || (g.Geometry = {})), ((t) => {
|
|
725
728
|
function e(n) {
|
|
726
729
|
return [...new Set(n)];
|
|
727
730
|
}
|
|
728
|
-
|
|
731
|
+
c(e, "unique"), t.unique = e;
|
|
729
732
|
function s(n, r) {
|
|
730
733
|
if (Array.isArray(n)) {
|
|
731
734
|
if (Array.isArray(r)) {
|
|
@@ -736,26 +739,26 @@ var ie;
|
|
|
736
739
|
}
|
|
737
740
|
return n / r;
|
|
738
741
|
}
|
|
739
|
-
|
|
742
|
+
c(s, "divide"), t.divide = s;
|
|
740
743
|
function i(n) {
|
|
741
744
|
return typeof Array.isArray == "function" ? Array.isArray(n) : n && typeof n == "object" && n.constructor.name === "Array";
|
|
742
745
|
}
|
|
743
|
-
|
|
744
|
-
})(
|
|
746
|
+
c(i, "isArray"), t.isArray = i;
|
|
747
|
+
})(g.ArrayTools || (g.ArrayTools = {})), ((t) => {
|
|
745
748
|
function e(n) {
|
|
746
749
|
return n.reduce((r, a) => r + a, 0);
|
|
747
750
|
}
|
|
748
|
-
|
|
751
|
+
c(e, "sum"), t.sum = e;
|
|
749
752
|
function s(n) {
|
|
750
753
|
return e(n) / n.length;
|
|
751
754
|
}
|
|
752
|
-
|
|
755
|
+
c(s, "mean"), t.mean = s;
|
|
753
756
|
function i(n, r) {
|
|
754
757
|
const a = Math.pow(10, r);
|
|
755
758
|
return Math.round(n * a) / a;
|
|
756
759
|
}
|
|
757
|
-
|
|
758
|
-
})(
|
|
760
|
+
c(i, "round"), t.round = i;
|
|
761
|
+
})(g.Mathematics || (g.Mathematics = {})), ((t) => {
|
|
759
762
|
function e(s, i, n) {
|
|
760
763
|
return new CustomEvent(s, {
|
|
761
764
|
bubbles: !0,
|
|
@@ -766,17 +769,17 @@ var ie;
|
|
|
766
769
|
}
|
|
767
770
|
});
|
|
768
771
|
}
|
|
769
|
-
|
|
770
|
-
})(
|
|
772
|
+
c(e, "createEvent"), t.createEvent = e;
|
|
773
|
+
})(g.Events || (g.Events = {})), ((t) => {
|
|
771
774
|
function e() {
|
|
772
775
|
return location.hash.replace(/#/, "").split(/\//).filter((i) => i).map((i) => i.split(/:/));
|
|
773
776
|
}
|
|
774
|
-
|
|
777
|
+
c(e, "parts"), t.parts = e;
|
|
775
778
|
function s(i) {
|
|
776
779
|
return e().flat().findIndex((n) => n === i) >= 0;
|
|
777
780
|
}
|
|
778
|
-
|
|
779
|
-
})(
|
|
781
|
+
c(s, "exists"), t.exists = s;
|
|
782
|
+
})(g.Hash || (g.Hash = {})), ((t) => {
|
|
780
783
|
function e(n, r, a = !1) {
|
|
781
784
|
if (a) {
|
|
782
785
|
if (typeof n != "object" || n === null)
|
|
@@ -787,10 +790,10 @@ var ie;
|
|
|
787
790
|
} else
|
|
788
791
|
return new Proxy(n, r);
|
|
789
792
|
}
|
|
790
|
-
|
|
793
|
+
c(e, "proxy"), t.proxy = e, t.handler = {
|
|
791
794
|
set(n, r, a) {
|
|
792
795
|
return n[r] = a, window.dispatchEvent(
|
|
793
|
-
|
|
796
|
+
g.Events.createEvent("settingUpdate", window, { target: n, property: r, value: a })
|
|
794
797
|
), !0;
|
|
795
798
|
},
|
|
796
799
|
get(n, r) {
|
|
@@ -807,43 +810,43 @@ var ie;
|
|
|
807
810
|
return;
|
|
808
811
|
return h;
|
|
809
812
|
}
|
|
810
|
-
|
|
813
|
+
c(s, "get"), t.get = s;
|
|
811
814
|
function i(n, r, a) {
|
|
812
815
|
const h = r.split(".");
|
|
813
|
-
let o = n,
|
|
814
|
-
for (
|
|
815
|
-
const
|
|
816
|
+
let o = n, _;
|
|
817
|
+
for (_ = 0; _ < h.length - 1; _++) {
|
|
818
|
+
const m = h[_];
|
|
816
819
|
if (o && typeof o == "object")
|
|
817
|
-
Object.prototype.hasOwnProperty.call(o,
|
|
820
|
+
Object.prototype.hasOwnProperty.call(o, m) || (o[m] = {}), o = o[m];
|
|
818
821
|
else
|
|
819
822
|
return !1;
|
|
820
823
|
}
|
|
821
|
-
return o && typeof o == "object" ? (o[h[
|
|
824
|
+
return o && typeof o == "object" ? (o[h[_]] = a, !0) : !1;
|
|
822
825
|
}
|
|
823
|
-
|
|
824
|
-
})(
|
|
826
|
+
c(i, "set"), t.set = i;
|
|
827
|
+
})(g.Objects || (g.Objects = {})), ((t) => {
|
|
825
828
|
function e(s = window.location) {
|
|
826
829
|
return Object.fromEntries(new URLSearchParams(s.search));
|
|
827
830
|
}
|
|
828
|
-
|
|
831
|
+
c(e, "parse"), t.parse = e, ((s) => {
|
|
829
832
|
function i(a = window.location.search) {
|
|
830
833
|
return Object.fromEntries(
|
|
831
834
|
a.replace(/^\?/, "").split(/&/).map((h) => h.split(/=/))
|
|
832
835
|
);
|
|
833
836
|
}
|
|
834
|
-
|
|
837
|
+
c(i, "parse2"), s.parse = i;
|
|
835
838
|
function n(a = window.location.search) {
|
|
836
839
|
return a.replace(/^\?/, "").split(/&/).map((h) => h.split(/=/)[0]);
|
|
837
840
|
}
|
|
838
|
-
|
|
841
|
+
c(n, "keys"), s.keys = n;
|
|
839
842
|
function r(a, h = window.location.search) {
|
|
840
843
|
return n(h).findIndex((o) => o === a) >= 0;
|
|
841
844
|
}
|
|
842
|
-
|
|
845
|
+
c(r, "has"), s.has = r;
|
|
843
846
|
})(t.Query || (t.Query = {}));
|
|
844
|
-
})(
|
|
845
|
-
})(
|
|
846
|
-
const
|
|
847
|
+
})(g.URL || (g.URL = {}));
|
|
848
|
+
})(ce || (ce = {}));
|
|
849
|
+
const ds = class ds {
|
|
847
850
|
constructor() {
|
|
848
851
|
this._state = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Map();
|
|
849
852
|
}
|
|
@@ -882,9 +885,9 @@ const rs = class rs {
|
|
|
882
885
|
});
|
|
883
886
|
}
|
|
884
887
|
};
|
|
885
|
-
|
|
886
|
-
let
|
|
887
|
-
const { ArrayTools:
|
|
888
|
+
c(ds, "EventBus");
|
|
889
|
+
let ke = ds;
|
|
890
|
+
const { ArrayTools: Qs } = ce, ae = class ae extends Array {
|
|
888
891
|
constructor(...t) {
|
|
889
892
|
super(...t);
|
|
890
893
|
}
|
|
@@ -893,46 +896,46 @@ const { ArrayTools: qs } = ie, te = class te extends Array {
|
|
|
893
896
|
function i(r) {
|
|
894
897
|
return r.name === e ? r : void 0;
|
|
895
898
|
}
|
|
896
|
-
|
|
899
|
+
c(i, "fn");
|
|
897
900
|
function n(r, a, h = null) {
|
|
898
|
-
if (
|
|
899
|
-
for (const [o,
|
|
900
|
-
if (s = n(
|
|
901
|
+
if (Qs.isArray(r)) {
|
|
902
|
+
for (const [o, _] of r.entries())
|
|
903
|
+
if (s = n(_, o, h), s)
|
|
901
904
|
return s;
|
|
902
905
|
} else {
|
|
903
906
|
if (s = i(r), s)
|
|
904
907
|
return s;
|
|
905
|
-
if (r &&
|
|
906
|
-
for (const [o,
|
|
907
|
-
if (s = n(
|
|
908
|
+
if (r && Qs.isArray(r[t])) {
|
|
909
|
+
for (const [o, _] of r[t].entries())
|
|
910
|
+
if (s = n(_, o, r), s)
|
|
908
911
|
return s;
|
|
909
912
|
}
|
|
910
913
|
}
|
|
911
914
|
return s;
|
|
912
915
|
}
|
|
913
|
-
return
|
|
916
|
+
return c(n, "recurse"), n(this);
|
|
914
917
|
}
|
|
915
918
|
flatten() {
|
|
916
919
|
return this.reduce((t, e) => (t.push(e), e.layers && Array.isArray(e.layers) && t.push(...e.layers), t), []);
|
|
917
920
|
}
|
|
918
921
|
recurse(t, e, s = null, i = 0) {
|
|
919
|
-
let n = new
|
|
922
|
+
let n = new ae();
|
|
920
923
|
for (const r of this) {
|
|
921
924
|
let a = e(r, s, i);
|
|
922
925
|
if (r[t] && Array.isArray(r[t])) {
|
|
923
|
-
let h = new
|
|
926
|
+
let h = new ae(...r[t]).recurse(t, e, r, i + 1);
|
|
924
927
|
h !== void 0 && n.push(...h);
|
|
925
928
|
}
|
|
926
929
|
n.push(a);
|
|
927
930
|
}
|
|
928
|
-
return
|
|
931
|
+
return Qt("Recurse results: ", n), n;
|
|
929
932
|
}
|
|
930
933
|
};
|
|
931
|
-
|
|
932
|
-
let
|
|
933
|
-
const
|
|
934
|
+
c(ae, "LayerArray");
|
|
935
|
+
let Wt = ae;
|
|
936
|
+
const gs = class gs {
|
|
934
937
|
constructor(t, e, s) {
|
|
935
|
-
this.__state__ = new
|
|
938
|
+
this.__state__ = new ke(), this.scale_x = 1, this.scale_y = 1, this.scale_objects = !0, this.layers = new Wt(), this.objects = /* @__PURE__ */ new Map(), this.visible = !0, this.ID = t, this.name = e.name || `layer-${t}`, this.tabindex = e.tabindex, this.parent = s, this._transform = new le(), s == null || s.__state__.addListener("graph_updated", "live", ({ key: i, newValue: n, oldValue: r }) => {
|
|
936
939
|
}), s == null || s.__state__.addListener(`graph_updated_${this.name}`, "live", ({ key: i, newValue: n, oldValue: r }) => {
|
|
937
940
|
this.objects = n, this.__state__.setVariable("layer_updated", this);
|
|
938
941
|
});
|
|
@@ -944,45 +947,45 @@ const os = class os {
|
|
|
944
947
|
this._transform = t;
|
|
945
948
|
}
|
|
946
949
|
};
|
|
947
|
-
|
|
948
|
-
let
|
|
949
|
-
var
|
|
950
|
-
const
|
|
950
|
+
c(gs, "Layer");
|
|
951
|
+
let es = gs;
|
|
952
|
+
var Ft, Nt;
|
|
953
|
+
const qe = class qe extends Array {
|
|
951
954
|
constructor(...e) {
|
|
952
955
|
super(arguments.length);
|
|
953
|
-
|
|
954
|
-
|
|
956
|
+
tt(this, Ft, !1);
|
|
957
|
+
tt(this, Nt);
|
|
955
958
|
for (let s = 0; s < e.length; s++)
|
|
956
959
|
this[s] = e[s];
|
|
957
|
-
|
|
960
|
+
G(this, Ft, !1);
|
|
958
961
|
}
|
|
959
962
|
static fromArray(e) {
|
|
960
|
-
const s = new
|
|
963
|
+
const s = new qe();
|
|
961
964
|
return e.forEach((i, n) => {
|
|
962
965
|
s.push(i);
|
|
963
|
-
}),
|
|
966
|
+
}), G(s, Nt, e.names), s;
|
|
964
967
|
}
|
|
965
968
|
flip() {
|
|
966
|
-
|
|
969
|
+
G(this, Ft, !L(this, Ft));
|
|
967
970
|
for (let e = 0; e < this.length; e++)
|
|
968
971
|
this[e] = -this[e];
|
|
969
972
|
return this;
|
|
970
973
|
}
|
|
971
974
|
get(e) {
|
|
972
|
-
return typeof e == "number" ? this[e] :
|
|
975
|
+
return typeof e == "number" ? this[e] : L(this, Nt) && L(this, Nt).includes(e) ? this[L(this, Nt).indexOf(e)] : void 0;
|
|
973
976
|
}
|
|
974
977
|
get flipped() {
|
|
975
|
-
return
|
|
978
|
+
return L(this, Ft);
|
|
976
979
|
}
|
|
977
980
|
get names() {
|
|
978
|
-
return
|
|
981
|
+
return L(this, Nt) ? L(this, Nt) : this.map((e, s) => `V${s + 1}`);
|
|
979
982
|
}
|
|
980
983
|
};
|
|
981
|
-
|
|
982
|
-
let
|
|
983
|
-
const
|
|
984
|
+
Ft = new WeakMap(), Nt = new WeakMap(), c(qe, "DimensionVector");
|
|
985
|
+
let Tt = qe;
|
|
986
|
+
const ms = class ms {
|
|
984
987
|
constructor(t, e) {
|
|
985
|
-
this.scale_x = 1, this.scale_y = 1, this.scale_size = 0.05, this.active = !1, this.visible = !1, this.highlighting = !1, this.meta = {}, this._x = 0, this._y = 0, this._highlight_default = new st("#000000"), this._size = 0, this.ID = e.ID, this._transform = new
|
|
988
|
+
this.scale_x = 1, this.scale_y = 1, this.scale_size = 0.05, this.active = !1, this.visible = !1, this.highlighting = !1, this.meta = {}, this._x = 0, this._y = 0, this._highlight_default = new st("#000000"), this._size = 0, this.ID = e.ID, this._transform = new le(), t instanceof Tt ? this._dimensions = t : t instanceof Jt ? this._dimensions = Tt.fromArray(t) : Array.isArray(t) ? this._dimensions = new Tt(...t) : (console.warn("Invalid dimensions provided, using default DimensionVector(0, 0)"), this._dimensions = new Tt(0, 0));
|
|
986
989
|
let s = { ...e };
|
|
987
990
|
this._original = { ...s }, this.ID = s.ID, this.x = s.x || this._dimensions[0], this.y = s.y || this._dimensions[1], this._size = s.size || 1, this._color = s.color || new st("#000000"), this.active = s.active || !1, this.shape = s.shape || null, this.meta = s.meta || {}, this._highlight = this._highlight_default, s.highlight && (this._highlight = s.highlight);
|
|
988
991
|
}
|
|
@@ -1036,9 +1039,9 @@ const as = class as {
|
|
|
1036
1039
|
this._transform = t;
|
|
1037
1040
|
}
|
|
1038
1041
|
};
|
|
1039
|
-
|
|
1040
|
-
let
|
|
1041
|
-
const
|
|
1042
|
+
c(ms, "PlottedObject");
|
|
1043
|
+
let Ot = ms;
|
|
1044
|
+
const fs = class fs extends Ot {
|
|
1042
1045
|
// constructor(x: LineOptions) {
|
|
1043
1046
|
// super([], x);
|
|
1044
1047
|
// // const data = Object.assign({}, x);
|
|
@@ -1080,9 +1083,9 @@ const hs = class hs extends kt {
|
|
|
1080
1083
|
this._color = t;
|
|
1081
1084
|
}
|
|
1082
1085
|
};
|
|
1083
|
-
|
|
1084
|
-
let
|
|
1085
|
-
const
|
|
1086
|
+
c(fs, "Line");
|
|
1087
|
+
let te = fs;
|
|
1088
|
+
const he = class he extends Ot {
|
|
1086
1089
|
// constructor(dimensions: DimensionType, o: PointOptions) { //, graph?: any) {
|
|
1087
1090
|
// super(dimensions, o);
|
|
1088
1091
|
// this.active = o.active || false;
|
|
@@ -1098,7 +1101,7 @@ const ee = class ee extends kt {
|
|
|
1098
1101
|
constructor(t) {
|
|
1099
1102
|
var n, r;
|
|
1100
1103
|
let e, s, i;
|
|
1101
|
-
t ? t instanceof
|
|
1104
|
+
t ? t instanceof Jt ? (e = (n = t.classes) == null ? void 0 : n.map((a, h) => a === "ena.co.occurrence" || a === "ena.dimension" ? t[h] : -1).filter((a) => a !== -1), s = (r = t.classes) == null ? void 0 : r.map((a, h) => a === "ena.metadata" ? [t.names[h], t[h]] : null).filter((a) => a !== null).reduce((a, h) => (a[h[0]] = h[1], a), {}), i = t.rowName || `point-${Math.random().toString(36).substring(2, 9)}`) : typeof t == "object" ? (e = t.dimensions || [], s = t.meta || {}, i = t.ID || `point-${Math.random().toString(36).substring(2, 9)}`) : (console.warn("Invalid data provided for Point, using default values"), e = [], s = {}, i = `point-${Math.random().toString(36).substring(2, 9)}`) : (e = [], s = {}, i = `point-${Math.random().toString(36).substring(2, 9)}`), super(e ?? [], { meta: s, ID: i }), this.edges = /* @__PURE__ */ new Map(), this.shape = he.SHAPES.CIRCLE;
|
|
1102
1105
|
}
|
|
1103
1106
|
set label(t) {
|
|
1104
1107
|
this._label = t;
|
|
@@ -1119,9 +1122,9 @@ const ee = class ee extends kt {
|
|
|
1119
1122
|
this._y = parseFloat(t);
|
|
1120
1123
|
}
|
|
1121
1124
|
};
|
|
1122
|
-
|
|
1123
|
-
let
|
|
1124
|
-
const
|
|
1125
|
+
c(he, "Point"), he.SHAPES = { CIRCLE: "circle", SQUARE: "rect" };
|
|
1126
|
+
let K = he;
|
|
1127
|
+
const Gt = class Gt extends Ot {
|
|
1125
1128
|
constructor(t, e) {
|
|
1126
1129
|
super(e.dimensions, e), this._visible = !1, this.offset = 0, this.text = t, this.ID = e.ID, this.object = e, this.x = this.dimensions[0], this.y = this.dimensions[1], this.offset = e.size || 0, this.size = this.offset / 4, this.visible = !1, this._transform.set("e", 1), this._transform.set("f", 1);
|
|
1127
1130
|
}
|
|
@@ -1144,9 +1147,9 @@ const Ft = class Ft extends kt {
|
|
|
1144
1147
|
this._transform = t;
|
|
1145
1148
|
}
|
|
1146
1149
|
};
|
|
1147
|
-
|
|
1148
|
-
let
|
|
1149
|
-
const
|
|
1150
|
+
c(Gt, "Label"), Gt.DISPLAY_TYPES = { OFF: 0, AUTO: 1, CLICK: 2, ON: 3 }, Gt.HIGHLIGHT = { OFF: 0, ON: 2 }, Gt.POSITION = { OBJECT: 1, STATIC: 2, CONTAINER: 3, CUSTOM: 4 };
|
|
1151
|
+
let q = Gt;
|
|
1152
|
+
const ps = class ps {
|
|
1150
1153
|
constructor(t, e, s = 0, i = 0) {
|
|
1151
1154
|
this.x_max = t, this.y_max = e, this.cx = s, this.cy = i;
|
|
1152
1155
|
}
|
|
@@ -1179,9 +1182,9 @@ const ls = class ls {
|
|
|
1179
1182
|
return this.x_max;
|
|
1180
1183
|
}
|
|
1181
1184
|
};
|
|
1182
|
-
|
|
1183
|
-
let
|
|
1184
|
-
const
|
|
1185
|
+
c(ps, "Extremes");
|
|
1186
|
+
let Ct = ps;
|
|
1187
|
+
const bs = class bs extends Ot {
|
|
1185
1188
|
constructor(t, e) {
|
|
1186
1189
|
super(t, e), this.visible = !0, this.size = e.size;
|
|
1187
1190
|
}
|
|
@@ -1207,8 +1210,8 @@ const cs = class cs extends kt {
|
|
|
1207
1210
|
return this._transform;
|
|
1208
1211
|
}
|
|
1209
1212
|
};
|
|
1210
|
-
|
|
1211
|
-
let
|
|
1213
|
+
c(bs, "AxisPoint");
|
|
1214
|
+
let ss = bs, ai = {
|
|
1212
1215
|
GRAPH: {
|
|
1213
1216
|
ratio: 1,
|
|
1214
1217
|
x_max: 1,
|
|
@@ -1224,25 +1227,25 @@ let Ve = cs, Ks = {
|
|
|
1224
1227
|
size: 1,
|
|
1225
1228
|
highlight: {
|
|
1226
1229
|
color: "yellow",
|
|
1227
|
-
labels:
|
|
1230
|
+
labels: q.DISPLAY_TYPES.ON
|
|
1228
1231
|
},
|
|
1229
|
-
labels:
|
|
1230
|
-
labelposition:
|
|
1232
|
+
labels: q.DISPLAY_TYPES.ON,
|
|
1233
|
+
labelposition: q.POSITION.OBJECT
|
|
1231
1234
|
},
|
|
1232
1235
|
POINT: {
|
|
1233
1236
|
active: 2,
|
|
1234
1237
|
size: 0.05,
|
|
1235
1238
|
color: "#000",
|
|
1236
|
-
shape:
|
|
1237
|
-
labels:
|
|
1238
|
-
labelposition:
|
|
1239
|
+
shape: K.SHAPES.CIRCLE,
|
|
1240
|
+
labels: q.DISPLAY_TYPES.AUTO,
|
|
1241
|
+
labelposition: q.POSITION.OBJECT
|
|
1239
1242
|
},
|
|
1240
1243
|
MEAN: {
|
|
1241
|
-
shape:
|
|
1242
|
-
labels:
|
|
1244
|
+
shape: K.SHAPES.SQUARE,
|
|
1245
|
+
labels: q.DISPLAY_TYPES.AUTO
|
|
1243
1246
|
},
|
|
1244
1247
|
LABEL: {
|
|
1245
|
-
highlight:
|
|
1248
|
+
highlight: q.HIGHLIGHT.OFF,
|
|
1246
1249
|
position: ["top", "left"],
|
|
1247
1250
|
container: "#label-container"
|
|
1248
1251
|
},
|
|
@@ -1250,9 +1253,9 @@ let Ve = cs, Ks = {
|
|
|
1250
1253
|
multiplier: 1
|
|
1251
1254
|
}
|
|
1252
1255
|
};
|
|
1253
|
-
const
|
|
1254
|
-
constructor(t = { ...
|
|
1255
|
-
this.__state__ = new
|
|
1256
|
+
const ys = class ys {
|
|
1257
|
+
constructor(t = { ...ai }) {
|
|
1258
|
+
this.__state__ = new ke(), this.name = "unnamed-graph", this.origin = void 0, this.points = /* @__PURE__ */ new Map(), this.nodes = /* @__PURE__ */ new Map(), this.edges = /* @__PURE__ */ new Map(), this.trajectories = /* @__PURE__ */ new Map(), this.labels = /* @__PURE__ */ new Map(), this.transform = new le(), this.scale_x = 1, this.scale_y = 1, this.SIZE_EFFECT = 1, this._mirror_y = !0, this._mirror_x = !1, this._layers = new Wt(
|
|
1256
1259
|
{ name: "graph", tabindex: 0, layers: [
|
|
1257
1260
|
{
|
|
1258
1261
|
name: "axes",
|
|
@@ -1291,8 +1294,8 @@ const us = class us {
|
|
|
1291
1294
|
{ name: "points", layers: [], tabindex: 0 },
|
|
1292
1295
|
{ name: "labels", layers: [], tabindex: 0 }
|
|
1293
1296
|
] }
|
|
1294
|
-
), this.options = t, this.origin = new
|
|
1295
|
-
new
|
|
1297
|
+
), this.options = t, this.origin = new ss(
|
|
1298
|
+
new Tt(0, 0),
|
|
1296
1299
|
{
|
|
1297
1300
|
ID: "origin",
|
|
1298
1301
|
x: 0,
|
|
@@ -1307,28 +1310,28 @@ const us = class us {
|
|
|
1307
1310
|
);
|
|
1308
1311
|
let e = 1;
|
|
1309
1312
|
function s(r, a, h) {
|
|
1310
|
-
const o = new
|
|
1311
|
-
return e += 1, o.parent = a || void 0, r.layers && Array.isArray(r.layers) && (o.layers = new
|
|
1313
|
+
const o = new es(`${e}`, r, h);
|
|
1314
|
+
return e += 1, o.parent = a || void 0, r.layers && Array.isArray(r.layers) && (o.layers = new Wt(...r.layers.map((_) => s(_, o, h)))), o;
|
|
1312
1315
|
}
|
|
1313
|
-
|
|
1316
|
+
c(s, "buildLayerTree"), this.layers = new Wt(...this._layers.map((r) => s(r, null, this)));
|
|
1314
1317
|
let i = this.layers.search("layers", "axis_points");
|
|
1315
1318
|
i && i.objects.set(this.origin.ID, this.origin);
|
|
1316
1319
|
let n = this.layers.search("layers", "axis_lines");
|
|
1317
1320
|
if (n) {
|
|
1318
|
-
let r = this.extremes || new
|
|
1321
|
+
let r = this.extremes || new Ct(1, 1), a = new te(
|
|
1319
1322
|
{},
|
|
1320
|
-
new
|
|
1321
|
-
new
|
|
1323
|
+
new K({ ID: "axis-x-start", dimensions: [-r.x_max, 0], classes: ["ena.dimension", "ena.dimension"] }),
|
|
1324
|
+
new K({ ID: "axis-x-end", dimensions: [r.x_max, 0], classes: ["ena.dimension", "ena.dimension"] })
|
|
1322
1325
|
);
|
|
1323
1326
|
a.ID = "axis-x", n.objects.set(a.ID, a);
|
|
1324
|
-
let h = new
|
|
1327
|
+
let h = new te(
|
|
1325
1328
|
{},
|
|
1326
|
-
new
|
|
1327
|
-
new
|
|
1329
|
+
new K({ ID: "axis-y-start", dimensions: [0, -r.y_max], classes: ["ena.dimension", "ena.dimension"] }),
|
|
1330
|
+
new K({ ID: "axis-y-end", dimensions: [0, r.y_max], classes: ["ena.dimension", "ena.dimension"] })
|
|
1328
1331
|
);
|
|
1329
|
-
h.ID = "axis-y", n.objects.set(h.ID, h),
|
|
1332
|
+
h.ID = "axis-y", n.objects.set(h.ID, h), Qt("Added axis lines to layer: ", n);
|
|
1330
1333
|
}
|
|
1331
|
-
this.extremes = new
|
|
1334
|
+
this.extremes = new Ct(t.GRAPH.x_max, t.GRAPH.y_max);
|
|
1332
1335
|
}
|
|
1333
1336
|
set extremes(t) {
|
|
1334
1337
|
this._extremes = t;
|
|
@@ -1355,7 +1358,7 @@ const us = class us {
|
|
|
1355
1358
|
return this.mirror_y ? -1 : 1;
|
|
1356
1359
|
}
|
|
1357
1360
|
add_point(t) {
|
|
1358
|
-
const e = new
|
|
1361
|
+
const e = new K(t);
|
|
1359
1362
|
this.points.set(e.ID, e);
|
|
1360
1363
|
}
|
|
1361
1364
|
add_points(t) {
|
|
@@ -1367,7 +1370,7 @@ const us = class us {
|
|
|
1367
1370
|
add_nodes(t) {
|
|
1368
1371
|
let e = this;
|
|
1369
1372
|
t.forEach((s) => {
|
|
1370
|
-
s.label = new
|
|
1373
|
+
s.label = new q(s.ID, s), e.labels.set(s.label.ID, s.label), e.nodes.set(s.ID, s);
|
|
1371
1374
|
const i = e.layers.search("layers", "nodes");
|
|
1372
1375
|
i && i.objects.push(s);
|
|
1373
1376
|
}), e.update_extremes();
|
|
@@ -1392,14 +1395,14 @@ const us = class us {
|
|
|
1392
1395
|
this.layers.search("layers", "nodes")
|
|
1393
1396
|
].filter((s) => s !== void 0);
|
|
1394
1397
|
if (e.length === 0)
|
|
1395
|
-
this.extremes = new
|
|
1398
|
+
this.extremes = new Ct(1, 1);
|
|
1396
1399
|
else {
|
|
1397
1400
|
let s = 1 / 0, i = -1 / 0, n = 1 / 0, r = -1 / 0;
|
|
1398
|
-
e.forEach((
|
|
1399
|
-
Number.isFinite(
|
|
1401
|
+
e.forEach((p) => p.objects.forEach((u) => {
|
|
1402
|
+
Number.isFinite(u.x) && (s = Math.min(s, u.x), i = Math.max(i, u.x)), Number.isFinite(u.y) && (n = Math.min(n, u.y), r = Math.max(r, u.y));
|
|
1400
1403
|
}));
|
|
1401
|
-
const a = Number.isFinite(s) && Number.isFinite(n), h = t && a ? (s + i) / 2 : 0, o = t && a ? (n + r) / 2 : 0,
|
|
1402
|
-
this.extremes = new
|
|
1404
|
+
const a = Number.isFinite(s) && Number.isFinite(n), h = t && a ? (s + i) / 2 : 0, o = t && a ? (n + r) / 2 : 0, _ = a ? Math.max(Math.abs(s - h), Math.abs(i - h), Math.abs(n - o), Math.abs(r - o)) : 0, m = (_ > 0 ? _ : 1) * 1.3;
|
|
1405
|
+
this.extremes = new Ct(m, m, h, o);
|
|
1403
1406
|
}
|
|
1404
1407
|
}
|
|
1405
1408
|
/** Farthest node from (cx, cy), on either axis */
|
|
@@ -1415,9 +1418,9 @@ const us = class us {
|
|
|
1415
1418
|
return Math.min(1, e / (Math.sqrt(s) * t));
|
|
1416
1419
|
}
|
|
1417
1420
|
};
|
|
1418
|
-
|
|
1419
|
-
let
|
|
1420
|
-
const
|
|
1421
|
+
c(ys, "Graph");
|
|
1422
|
+
let is = ys;
|
|
1423
|
+
const Be = class Be extends HTMLElement {
|
|
1421
1424
|
constructor() {
|
|
1422
1425
|
super(), this.element = null, this.object = null;
|
|
1423
1426
|
const t = this, e = t.attachShadow({ mode: "open" }), s = document.createElement("style"), i = document.createElement("div");
|
|
@@ -1428,7 +1431,7 @@ const Te = class Te extends HTMLElement {
|
|
|
1428
1431
|
return e == null ? void 0 : e.querySelector(".wrapper");
|
|
1429
1432
|
}
|
|
1430
1433
|
};
|
|
1431
|
-
|
|
1434
|
+
c(Be, "DrawableElement"), Be.style = `
|
|
1432
1435
|
:host {
|
|
1433
1436
|
max-width: 100%;
|
|
1434
1437
|
display: block;
|
|
@@ -1439,22 +1442,22 @@ _(Te, "DrawableElement"), Te.style = `
|
|
|
1439
1442
|
justify-content: center;
|
|
1440
1443
|
}
|
|
1441
1444
|
`;
|
|
1442
|
-
let
|
|
1443
|
-
const
|
|
1444
|
-
function
|
|
1445
|
-
return
|
|
1445
|
+
let ze = Be;
|
|
1446
|
+
const xi = 1e-8;
|
|
1447
|
+
function ti(g, t = xi) {
|
|
1448
|
+
return g.filter((e) => Math.abs(e.x) > t || Math.abs(e.y) > t);
|
|
1446
1449
|
}
|
|
1447
|
-
|
|
1448
|
-
function
|
|
1449
|
-
if (
|
|
1450
|
-
if (
|
|
1451
|
-
const t = new Array(
|
|
1452
|
-
for (let e = 0; e <
|
|
1450
|
+
c(ti, "nearOriginFilter");
|
|
1451
|
+
function hi(g) {
|
|
1452
|
+
if (g <= 0) return [];
|
|
1453
|
+
if (g === 1) return [0];
|
|
1454
|
+
const t = new Array(g);
|
|
1455
|
+
for (let e = 0; e < g; e++) t[e] = e / (g - 1);
|
|
1453
1456
|
return t;
|
|
1454
1457
|
}
|
|
1455
|
-
|
|
1456
|
-
function
|
|
1457
|
-
return
|
|
1458
|
+
c(hi, "normalizedT");
|
|
1459
|
+
function li(g, t) {
|
|
1460
|
+
return g.map((e) => {
|
|
1458
1461
|
const s = new Array(t + 1);
|
|
1459
1462
|
let i = 1;
|
|
1460
1463
|
for (let n = 0; n <= t; n++)
|
|
@@ -1462,9 +1465,9 @@ function Zs(d, t) {
|
|
|
1462
1465
|
return s;
|
|
1463
1466
|
});
|
|
1464
1467
|
}
|
|
1465
|
-
|
|
1466
|
-
function
|
|
1467
|
-
const t =
|
|
1468
|
+
c(li, "design");
|
|
1469
|
+
function ci(g) {
|
|
1470
|
+
const t = g.length, e = g[0].length, s = g.map((n) => n.slice()), i = Array.from({ length: e }, () => new Array(e).fill(0));
|
|
1468
1471
|
for (let n = 0; n < e; n++) {
|
|
1469
1472
|
let r = 0;
|
|
1470
1473
|
for (let a = 0; a < t; a++) r += s[a][n] * s[a][n];
|
|
@@ -1479,91 +1482,91 @@ function Qs(d) {
|
|
|
1479
1482
|
}
|
|
1480
1483
|
return { Q: s, R: i };
|
|
1481
1484
|
}
|
|
1482
|
-
|
|
1483
|
-
function
|
|
1484
|
-
const e =
|
|
1485
|
+
c(ci, "qr");
|
|
1486
|
+
function ns(g, t) {
|
|
1487
|
+
const e = g.length, s = g[0].length, i = new Array(s).fill(0);
|
|
1485
1488
|
for (let n = 0; n < s; n++) {
|
|
1486
1489
|
let r = 0;
|
|
1487
|
-
for (let a = 0; a < e; a++) r +=
|
|
1490
|
+
for (let a = 0; a < e; a++) r += g[a][n] * t[a];
|
|
1488
1491
|
i[n] = r;
|
|
1489
1492
|
}
|
|
1490
1493
|
return i;
|
|
1491
1494
|
}
|
|
1492
|
-
|
|
1493
|
-
function
|
|
1495
|
+
c(ns, "qtY");
|
|
1496
|
+
function rs(g, t) {
|
|
1494
1497
|
const e = t.length, s = new Array(e).fill(0);
|
|
1495
1498
|
for (let i = e - 1; i >= 0; i--) {
|
|
1496
1499
|
let n = t[i];
|
|
1497
|
-
for (let r = i + 1; r < e; r++) n -=
|
|
1498
|
-
s[i] = Math.abs(
|
|
1500
|
+
for (let r = i + 1; r < e; r++) n -= g[i][r] * s[r];
|
|
1501
|
+
s[i] = Math.abs(g[i][i]) > 1e-12 ? n / g[i][i] : 0;
|
|
1499
1502
|
}
|
|
1500
1503
|
return s;
|
|
1501
1504
|
}
|
|
1502
|
-
|
|
1503
|
-
function
|
|
1504
|
-
return
|
|
1505
|
+
c(rs, "backSolve");
|
|
1506
|
+
function wi(g) {
|
|
1507
|
+
return g.map((t) => {
|
|
1505
1508
|
let e = 0;
|
|
1506
1509
|
for (let s = 0; s < t.length; s++) e += t[s] * t[s];
|
|
1507
1510
|
return e;
|
|
1508
1511
|
});
|
|
1509
1512
|
}
|
|
1510
|
-
|
|
1511
|
-
function
|
|
1512
|
-
const s =
|
|
1513
|
-
return
|
|
1513
|
+
c(wi, "leverages");
|
|
1514
|
+
function ei(g, t, e) {
|
|
1515
|
+
const s = li(g, e), { Q: i, R: n } = ci(s);
|
|
1516
|
+
return rs(n, ns(i, t));
|
|
1514
1517
|
}
|
|
1515
|
-
|
|
1516
|
-
function
|
|
1518
|
+
c(ei, "fitCoeffs");
|
|
1519
|
+
function Ce(g, t) {
|
|
1517
1520
|
let e = 0, s = 1;
|
|
1518
|
-
for (let i = 0; i <
|
|
1519
|
-
e +=
|
|
1521
|
+
for (let i = 0; i < g.length; i++)
|
|
1522
|
+
e += g[i] * s, s *= t;
|
|
1520
1523
|
return e;
|
|
1521
1524
|
}
|
|
1522
|
-
|
|
1523
|
-
function
|
|
1524
|
-
const i =
|
|
1525
|
-
let
|
|
1526
|
-
for (let
|
|
1527
|
-
const
|
|
1528
|
-
if (
|
|
1529
|
-
const
|
|
1530
|
-
|
|
1531
|
-
}
|
|
1532
|
-
return
|
|
1525
|
+
c(Ce, "evalPoly");
|
|
1526
|
+
function vi(g, t, e, s) {
|
|
1527
|
+
const i = li(g, s), { Q: n, R: r } = ci(i), a = wi(n), h = rs(r, ns(n, t)), o = rs(r, ns(n, e));
|
|
1528
|
+
let _ = 0;
|
|
1529
|
+
for (let m = 0; m < g.length; m++) {
|
|
1530
|
+
const p = 1 - a[m];
|
|
1531
|
+
if (p <= 0) return 1 / 0;
|
|
1532
|
+
const u = t[m] - Ce(h, g[m]), d = e[m] - Ce(o, g[m]);
|
|
1533
|
+
_ += (u / p) ** 2 + (d / p) ** 2;
|
|
1534
|
+
}
|
|
1535
|
+
return _;
|
|
1533
1536
|
}
|
|
1534
|
-
|
|
1535
|
-
function
|
|
1536
|
-
const s =
|
|
1537
|
+
c(vi, "loocv2d");
|
|
1538
|
+
function Ai(g, t, e) {
|
|
1539
|
+
const s = g.length, i = Math.min(Math.max(1, Math.floor(t)), Math.max(1, s - 1));
|
|
1537
1540
|
if (e === "fixed" || s < 3) return i;
|
|
1538
|
-
const n =
|
|
1541
|
+
const n = hi(s), r = g.map((_) => _.x), a = g.map((_) => _.y);
|
|
1539
1542
|
let h = 1, o = 1 / 0;
|
|
1540
|
-
for (let
|
|
1541
|
-
const
|
|
1542
|
-
|
|
1543
|
+
for (let _ = 1; _ <= i; _++) {
|
|
1544
|
+
const m = vi(n, r, a, _);
|
|
1545
|
+
m < o && (o = m, h = _);
|
|
1543
1546
|
}
|
|
1544
1547
|
return h;
|
|
1545
1548
|
}
|
|
1546
|
-
|
|
1547
|
-
function
|
|
1548
|
-
const e =
|
|
1549
|
+
c(Ai, "selectDegree");
|
|
1550
|
+
function Si(g, t) {
|
|
1551
|
+
const e = ti(g);
|
|
1549
1552
|
if (e.length < 3) return null;
|
|
1550
|
-
const s = t.selectionSet ?
|
|
1551
|
-
let n =
|
|
1553
|
+
const s = t.selectionSet ? ti(t.selectionSet) : e, i = s.length >= 3 ? s : e;
|
|
1554
|
+
let n = Ai(i, t.maxDegree, t.degreeSelection);
|
|
1552
1555
|
n = Math.min(n, Math.max(1, e.length - 1));
|
|
1553
|
-
const r =
|
|
1556
|
+
const r = hi(e.length), a = ei(r, e.map((o) => o.x), n), h = ei(r, e.map((o) => o.y), n);
|
|
1554
1557
|
return { degree: n, coeffsX: a, coeffsY: h };
|
|
1555
1558
|
}
|
|
1556
|
-
|
|
1557
|
-
function
|
|
1559
|
+
c(Si, "fitTrajectory");
|
|
1560
|
+
function si(g, t = 100) {
|
|
1558
1561
|
const e = [];
|
|
1559
1562
|
for (let s = 0; s <= t; s++) {
|
|
1560
1563
|
const i = s / t;
|
|
1561
|
-
e.push({ x:
|
|
1564
|
+
e.push({ x: Ce(g.coeffsX, i), y: Ce(g.coeffsY, i) });
|
|
1562
1565
|
}
|
|
1563
1566
|
return e;
|
|
1564
1567
|
}
|
|
1565
|
-
|
|
1566
|
-
const
|
|
1568
|
+
c(si, "sampleCurve");
|
|
1569
|
+
const ii = 100, xs = class xs extends Ot {
|
|
1567
1570
|
constructor(t = {}) {
|
|
1568
1571
|
const e = t.color instanceof st ? t.color : new st(typeof t.color == "string" ? t.color : "#000000");
|
|
1569
1572
|
super([], {
|
|
@@ -1575,8 +1578,8 @@ const Hs = 100, _s = class _s extends kt {
|
|
|
1575
1578
|
meta: t.meta || {},
|
|
1576
1579
|
...t
|
|
1577
1580
|
}), this._typeName = "Trajectory", this.trajPoints = [], this.smooth = "none", this.maxDegree = 3, this.degreeSelection = "loocv_2d", this.selectedDegree = -1, this.polyCoeffsX = [], this.polyCoeffsY = [], this.currentTime = 1 / 0, this.showPoints = !0, this.showTips = !0, this.lineStyle = "uniform", this.strokeWidth = 2, this.strokeWidthRange = [1, 6], this.opacityRange = [0.3, 1], this.smooth = t.smooth || "none", this.maxDegree = t.maxDegree !== void 0 ? t.maxDegree : 3, this.degreeSelection = t.degreeSelection || "loocv_2d", this.polyCoeffsX = t.polyCoeffsX || [], this.polyCoeffsY = t.polyCoeffsY || [], this.currentTime = t.currentTime !== void 0 ? t.currentTime : 1 / 0, this.showPoints = t.showPoints !== void 0 ? t.showPoints : !0, this.showTips = t.showTips !== void 0 ? t.showTips : !0, this.lineStyle = t.lineStyle || "uniform", this.strokeWidth = t.strokeWidth || 2, this.strokeWidthRange = t.strokeWidthRange || [1, 6], this.opacityRange = t.opacityRange || [0.3, 1], t.points && Array.isArray(t.points) && (this.trajPoints = t.points.map((s) => {
|
|
1578
|
-
if (s instanceof
|
|
1579
|
-
const i = new
|
|
1581
|
+
if (s instanceof K) return s;
|
|
1582
|
+
const i = new K({ dimensions: [s.x, s.y], meta: { time: s.time, label: s.label } });
|
|
1580
1583
|
return i.x = s.x, i.y = s.y, i;
|
|
1581
1584
|
}));
|
|
1582
1585
|
}
|
|
@@ -1591,11 +1594,11 @@ const Hs = 100, _s = class _s extends kt {
|
|
|
1591
1594
|
if (t.length < 2) return [];
|
|
1592
1595
|
if (this.smooth === "poly") {
|
|
1593
1596
|
if (this.polyCoeffsX.length > 0 && this.polyCoeffsY.length > 0)
|
|
1594
|
-
return
|
|
1597
|
+
return si(
|
|
1595
1598
|
{ degree: this.polyCoeffsX.length - 1, coeffsX: this.polyCoeffsX, coeffsY: this.polyCoeffsY },
|
|
1596
|
-
|
|
1599
|
+
ii
|
|
1597
1600
|
);
|
|
1598
|
-
const e =
|
|
1601
|
+
const e = Si(
|
|
1599
1602
|
t.map((s) => ({ x: s.x, y: s.y })),
|
|
1600
1603
|
{
|
|
1601
1604
|
maxDegree: this.maxDegree,
|
|
@@ -1604,14 +1607,14 @@ const Hs = 100, _s = class _s extends kt {
|
|
|
1604
1607
|
}
|
|
1605
1608
|
);
|
|
1606
1609
|
if (e)
|
|
1607
|
-
return this.selectedDegree = e.degree,
|
|
1610
|
+
return this.selectedDegree = e.degree, si(e, ii);
|
|
1608
1611
|
}
|
|
1609
1612
|
return t.map((e) => ({ x: e.x, y: e.y }));
|
|
1610
1613
|
}
|
|
1611
1614
|
};
|
|
1612
|
-
|
|
1613
|
-
let
|
|
1614
|
-
const
|
|
1615
|
+
c(xs, "Trajectory");
|
|
1616
|
+
let Oe = xs;
|
|
1617
|
+
const _i = 1, ws = class ws extends te {
|
|
1615
1618
|
constructor(t, e, s, i = 0) {
|
|
1616
1619
|
super(t, e, s), this._totalweight = 0, this._weight = i;
|
|
1617
1620
|
}
|
|
@@ -1620,7 +1623,7 @@ const ti = 1, ds = class ds extends Xt {
|
|
|
1620
1623
|
}
|
|
1621
1624
|
get color() {
|
|
1622
1625
|
const t = this._color || new st("#000000");
|
|
1623
|
-
return new
|
|
1626
|
+
return new Ne(t, Math.abs(this.weight));
|
|
1624
1627
|
}
|
|
1625
1628
|
set color(t) {
|
|
1626
1629
|
this._color = t;
|
|
@@ -1641,90 +1644,90 @@ const ti = 1, ds = class ds extends Xt {
|
|
|
1641
1644
|
this._totalweight = t;
|
|
1642
1645
|
}
|
|
1643
1646
|
};
|
|
1644
|
-
|
|
1645
|
-
let
|
|
1646
|
-
var
|
|
1647
|
-
const
|
|
1647
|
+
c(ws, "Edge");
|
|
1648
|
+
let Pe = ws;
|
|
1649
|
+
var Zt;
|
|
1650
|
+
const vs = class vs extends Ot {
|
|
1648
1651
|
constructor(e) {
|
|
1649
1652
|
super(e.dimensions || [], e);
|
|
1650
|
-
|
|
1651
|
-
|
|
1653
|
+
tt(this, Zt);
|
|
1654
|
+
G(this, Zt, e);
|
|
1652
1655
|
}
|
|
1653
1656
|
get edge() {
|
|
1654
|
-
return
|
|
1657
|
+
return L(this, Zt);
|
|
1655
1658
|
}
|
|
1656
1659
|
get path() {
|
|
1657
|
-
const e =
|
|
1660
|
+
const e = L(this, Zt), s = [e.to.x, e.to.y], i = e.from_point, [n, r] = e.base_pts, a = Math.hypot(i[0] - s[0], i[1] - s[1]), h = Math.hypot(n[0] - r[0], n[1] - r[1]);
|
|
1658
1661
|
if (!(a > 0) || !(h > 0)) return "";
|
|
1659
|
-
const o = [(i[0] - s[0]) / a, (i[1] - s[1]) / a],
|
|
1660
|
-
return `M${
|
|
1662
|
+
const o = [(i[0] - s[0]) / a, (i[1] - s[1]) / a], _ = Math.hypot(n[0] - s[0], n[1] - s[1]), m = [(n[0] - s[0]) / _, (n[1] - s[1]) / _], p = /* @__PURE__ */ c(($) => h / 2 * Math.max(0, 1 - $ / a), "halfW"), u = /* @__PURE__ */ c(($, z) => `${s[0] + o[0] * $ + m[0] * z} ${s[1] + o[1] * $ + m[1] * z}`, "at"), d = 0.2 * a, l = Math.min(0.15 * a, 0.8 * 2 * p(d)), b = d + l / 2, f = d + l;
|
|
1663
|
+
return `M${u(d, 0)} L${u(b, p(b))} L${u(f, p(f))} L${u(b, 0)} L${u(f, -p(f))} L${u(b, -p(b))}z`;
|
|
1661
1664
|
}
|
|
1662
1665
|
};
|
|
1663
|
-
|
|
1664
|
-
let
|
|
1665
|
-
var
|
|
1666
|
-
const
|
|
1666
|
+
Zt = new WeakMap(), c(vs, "EdgeArrow");
|
|
1667
|
+
let Le = vs;
|
|
1668
|
+
var Kt, ye;
|
|
1669
|
+
const Ge = class Ge extends Pe {
|
|
1667
1670
|
constructor(e, s, i) {
|
|
1668
1671
|
super(e, s, i);
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
this._path = "",
|
|
1672
|
+
tt(this, Kt);
|
|
1673
|
+
tt(this, ye);
|
|
1674
|
+
this._path = "", G(this, Kt, !1), this._directions = [
|
|
1672
1675
|
"from",
|
|
1673
1676
|
"to"
|
|
1674
1677
|
/* TO */
|
|
1675
|
-
], this.towards = "to",
|
|
1678
|
+
], this.towards = "to", L(this, Kt) === !0 && G(this, ye, new Le(this));
|
|
1676
1679
|
}
|
|
1677
1680
|
get path() {
|
|
1678
1681
|
return `M${this.from.x} ${this.from.y} L${this.base_pts[0].join(" ")} L${this.base_pts[1].join(" ")}z`;
|
|
1679
1682
|
}
|
|
1680
1683
|
static calculate_base_points(e) {
|
|
1681
|
-
const s = e.towards, i = e._directions.find((
|
|
1682
|
-
if (
|
|
1684
|
+
const s = e.towards, i = e._directions.find((b) => b !== e.towards), n = e[i].x, r = e[i].y, a = e[s].x, h = e[s].y, o = a - n, _ = h - r, m = Math.hypot(o, _), p = (e.weight ?? 0) * _i;
|
|
1685
|
+
if (m === 0 || !isFinite(p) || p === 0)
|
|
1683
1686
|
return [[a, h], [a, h]];
|
|
1684
|
-
const
|
|
1687
|
+
const u = -_ / m, d = o / m, l = p / 2;
|
|
1685
1688
|
return [
|
|
1686
|
-
[a +
|
|
1687
|
-
[a -
|
|
1689
|
+
[a + u * l, h + d * l],
|
|
1690
|
+
[a - u * l, h - d * l]
|
|
1688
1691
|
];
|
|
1689
1692
|
}
|
|
1690
1693
|
get base_pts() {
|
|
1691
|
-
return
|
|
1694
|
+
return Ge.calculate_base_points(this);
|
|
1692
1695
|
}
|
|
1693
1696
|
get arrow() {
|
|
1694
|
-
return
|
|
1697
|
+
return L(this, ye);
|
|
1695
1698
|
}
|
|
1696
1699
|
get with_arrow() {
|
|
1697
|
-
return
|
|
1700
|
+
return L(this, Kt);
|
|
1698
1701
|
}
|
|
1699
1702
|
get from_point() {
|
|
1700
1703
|
return [this.from.x, this.from.y];
|
|
1701
1704
|
}
|
|
1702
1705
|
};
|
|
1703
|
-
|
|
1704
|
-
let
|
|
1705
|
-
const
|
|
1706
|
+
Kt = new WeakMap(), ye = new WeakMap(), c(Ge, "TaperedEdge");
|
|
1707
|
+
let Dt = Ge;
|
|
1708
|
+
const Ue = class Ue extends Dt {
|
|
1706
1709
|
constructor(t, e, s) {
|
|
1707
1710
|
super(t, e, s), this._dataWeight = 0, this._totalweight = t.totalweight ?? 0, this._dataWeight = t.weight ?? this._weight;
|
|
1708
1711
|
}
|
|
1709
1712
|
get weighted_midpoint() {
|
|
1710
|
-
return
|
|
1713
|
+
return ce.Geometry.Line.interpolate(this.line)(1 - this._dataWeight / this._totalweight);
|
|
1711
1714
|
}
|
|
1712
1715
|
get base_pts() {
|
|
1713
|
-
return
|
|
1716
|
+
return Dt.calculate_base_points(this);
|
|
1714
1717
|
}
|
|
1715
1718
|
static build_path(t) {
|
|
1716
1719
|
return t._totalweight > 0 ? `M${t.weighted_midpoint[0]} ${t.weighted_midpoint[1]} L${t.base_pts[0].join(" ")} L${t.base_pts[1].join(" ")}z` : (console.error("TaperedWeightedMidpointEdge: No totalweight, returning empty path"), "");
|
|
1717
1720
|
}
|
|
1718
1721
|
get path() {
|
|
1719
|
-
return
|
|
1722
|
+
return Ue.build_path(this);
|
|
1720
1723
|
}
|
|
1721
1724
|
get from_point() {
|
|
1722
1725
|
return this.weighted_midpoint;
|
|
1723
1726
|
}
|
|
1724
1727
|
};
|
|
1725
|
-
|
|
1726
|
-
let
|
|
1727
|
-
const
|
|
1728
|
+
c(Ue, "TaperedWeightedMidpointEdge");
|
|
1729
|
+
let os = Ue;
|
|
1730
|
+
const Xe = class Xe extends Pe {
|
|
1728
1731
|
constructor(t, e, s) {
|
|
1729
1732
|
super(t, e, s);
|
|
1730
1733
|
}
|
|
@@ -1733,14 +1736,14 @@ const Fe = class Fe extends Me {
|
|
|
1733
1736
|
return `M ${i}, ${e.y} a ${s},${s} 0 1,0 ${n},0 a ${s},${s} 0 1,0 -${n},0`;
|
|
1734
1737
|
}
|
|
1735
1738
|
get path() {
|
|
1736
|
-
let t = this.weight *
|
|
1737
|
-
return
|
|
1739
|
+
let t = this.weight * _i;
|
|
1740
|
+
return Xe.build_path(t, this.to);
|
|
1738
1741
|
}
|
|
1739
1742
|
};
|
|
1740
|
-
|
|
1741
|
-
let
|
|
1742
|
-
const
|
|
1743
|
-
constructor(t, e, s, i = new
|
|
1743
|
+
c(Xe, "NodeEdge");
|
|
1744
|
+
let Ht = Xe;
|
|
1745
|
+
const As = class As {
|
|
1746
|
+
constructor(t, e, s, i = new Pt()) {
|
|
1744
1747
|
this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.svg_element = this.create();
|
|
1745
1748
|
}
|
|
1746
1749
|
get_size() {
|
|
@@ -1757,103 +1760,122 @@ const fs = class fs {
|
|
|
1757
1760
|
if (i === s) return;
|
|
1758
1761
|
const n = 5e3, r = performance.now();
|
|
1759
1762
|
function a(h) {
|
|
1760
|
-
const o = Math.min(1, (h - r) / n),
|
|
1761
|
-
t.setAttribute(e,
|
|
1763
|
+
const o = Math.min(1, (h - r) / n), _ = i + (s - i) * o;
|
|
1764
|
+
t.setAttribute(e, _.toString()), o < 1 ? requestAnimationFrame(a) : t.setAttribute(e, s.toString());
|
|
1762
1765
|
}
|
|
1763
|
-
|
|
1766
|
+
c(a, "animate"), requestAnimationFrame(a);
|
|
1764
1767
|
}
|
|
1765
1768
|
};
|
|
1766
|
-
|
|
1767
|
-
let
|
|
1768
|
-
const
|
|
1769
|
-
function
|
|
1770
|
-
const i = Math.abs(
|
|
1769
|
+
c(As, "Drawable");
|
|
1770
|
+
let _e = As;
|
|
1771
|
+
const Ei = 0.04, Mi = [0.25, 1], Ii = [0.3, 1];
|
|
1772
|
+
function ni(g, t, e, s) {
|
|
1773
|
+
const i = Math.abs(g);
|
|
1771
1774
|
if (!(i > 0)) return 0;
|
|
1772
1775
|
if (!(e > t)) return s[1];
|
|
1773
1776
|
const n = Math.min(1, Math.max(0, (i - t) / (e - t)));
|
|
1774
1777
|
return s[0] + n * (s[1] - s[0]);
|
|
1775
1778
|
}
|
|
1776
|
-
|
|
1777
|
-
const
|
|
1778
|
-
function
|
|
1779
|
-
return 2 *
|
|
1779
|
+
c(ni, "rampFor");
|
|
1780
|
+
const Ni = 0.011, ki = 0.75, zi = 0.8, Ci = 0.75, ui = 6e-3, Oi = 0.6;
|
|
1781
|
+
function Pi(g) {
|
|
1782
|
+
return 2 * g;
|
|
1780
1783
|
}
|
|
1781
|
-
|
|
1782
|
-
function
|
|
1783
|
-
return
|
|
1784
|
+
c(Pi, "widthPerWeight");
|
|
1785
|
+
function Li(g, t) {
|
|
1786
|
+
return g * t / (2 * ui);
|
|
1784
1787
|
}
|
|
1785
|
-
|
|
1786
|
-
function
|
|
1787
|
-
const t = /rgba?\(([^)]+)\)/.exec(
|
|
1788
|
-
if (!t) return
|
|
1789
|
-
const [e, s, i, n = 1] = t[1].split(",").map(Number), r = /* @__PURE__ */
|
|
1788
|
+
c(Li, "nodeSizeForEdges");
|
|
1789
|
+
function Ri(g) {
|
|
1790
|
+
const t = /rgba?\(([^)]+)\)/.exec(g);
|
|
1791
|
+
if (!t) return g;
|
|
1792
|
+
const [e, s, i, n = 1] = t[1].split(",").map(Number), r = /* @__PURE__ */ c((a) => Math.round(255 + (a - 255) * n), "f");
|
|
1790
1793
|
return `rgb(${r(e)},${r(s)},${r(i)})`;
|
|
1791
1794
|
}
|
|
1792
|
-
|
|
1793
|
-
function
|
|
1794
|
-
const e = /rgba?\(([^)]+)\)/.exec(
|
|
1795
|
-
if (!e) return
|
|
1795
|
+
c(Ri, "flattenOnWhite");
|
|
1796
|
+
function $i(g, t) {
|
|
1797
|
+
const e = /rgba?\(([^)]+)\)/.exec(g);
|
|
1798
|
+
if (!e) return g;
|
|
1796
1799
|
const [s, i, n, r = 1] = e[1].split(",").map(Number);
|
|
1797
1800
|
return `rgba(${Math.round(s * t)},${Math.round(i * t)},${Math.round(n * t)},${r})`;
|
|
1798
1801
|
}
|
|
1799
|
-
|
|
1800
|
-
const
|
|
1801
|
-
constructor(t, e, s, i = new
|
|
1802
|
+
c($i, "darkenRgba");
|
|
1803
|
+
const Ss = class Ss extends _e {
|
|
1804
|
+
constructor(t, e, s, i = new Pt()) {
|
|
1802
1805
|
super(t, e, s, i), this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.__name__ = "unnamed-line", this._arrow_el = null, this._hit_el = null, this.svg_element = this.create();
|
|
1803
1806
|
}
|
|
1804
1807
|
/** Stamp edge identity onto an element so <qe-graph> delegation can resolve
|
|
1805
1808
|
* qe-edge-* events. No-op for non-edges (e.g. axis lines). */
|
|
1806
1809
|
_stampEdge(t) {
|
|
1807
1810
|
const e = this.__data__.meta ?? {};
|
|
1808
|
-
|
|
1811
|
+
if (!e.isMeanEdge) return;
|
|
1812
|
+
t.setAttribute("data-edge-source", String(e.source ?? "")), t.setAttribute("data-edge-target", String(e.target ?? "")), t.setAttribute("data-edge-weight", String(e.weight ?? 0)), t.setAttribute("data-edge-directed", e.isDirected ? "true" : "false");
|
|
1813
|
+
const s = /* @__PURE__ */ c((i, n) => n != null && n !== !1 ? t.setAttribute(i, n === !0 ? "true" : String(n)) : t.removeAttribute(i), "opt");
|
|
1814
|
+
s("data-edge-self", !!e.isSelf), s("data-edge-group", e.group), s("data-edge-unit", e.unit);
|
|
1809
1815
|
}
|
|
1810
1816
|
create() {
|
|
1811
|
-
if (this.__data__ instanceof
|
|
1817
|
+
if (this.__data__ instanceof Ht) {
|
|
1812
1818
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1813
1819
|
return e.setAttribute("fill", this.__data__.color.toString()), e.setAttribute("stroke", "none"), this.svg_element = e, e;
|
|
1814
1820
|
}
|
|
1815
|
-
if (this.__data__ instanceof
|
|
1821
|
+
if (this.__data__ instanceof Dt) {
|
|
1816
1822
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1817
1823
|
return e.setAttribute("fill", this.__data__.color.toString()), e.setAttribute("stroke", "none"), this.svg_element = e, e;
|
|
1818
1824
|
}
|
|
1819
1825
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
1820
1826
|
return t.setAttribute("x1", this.__data__.from.x.toString()), t.setAttribute("y1", this.__data__.from.y.toString()), t.setAttribute("x2", this.__data__.to.x.toString()), t.setAttribute("y2", this.__data__.to.y.toString()), t.setAttribute("stroke-width", this.get_size().toString()), t.setAttribute("stroke", this.__data__.color.toString()), this.svg_element = t, t;
|
|
1821
1827
|
}
|
|
1828
|
+
/** Self and directed edges draw as a <path>, everything else as a <line>. */
|
|
1829
|
+
get drawsPath() {
|
|
1830
|
+
return this.__data__ instanceof Ht || this.__data__ instanceof Dt;
|
|
1831
|
+
}
|
|
1822
1832
|
update() {
|
|
1823
|
-
var
|
|
1824
|
-
this.svg_element || this.create(), this.svg_element.
|
|
1825
|
-
|
|
1833
|
+
var i, n, r, a;
|
|
1834
|
+
if (this.svg_element || this.create(), this.svg_element.tagName.toLowerCase() === "path" !== this.drawsPath) {
|
|
1835
|
+
const h = this.svg_element;
|
|
1836
|
+
this.create(), h.parentElement && h.replaceWith(this.svg_element);
|
|
1837
|
+
}
|
|
1838
|
+
this.drawsPath && ((i = this._hit_el) == null || i.remove(), this._hit_el = null), this.svg_element.parentElement || this.parent.appendChild(this.svg_element);
|
|
1839
|
+
const t = ((n = this.graph.__data__.extremes) == null ? void 0 : n.x_max) ?? 1, e = this.__data__.meta ?? {};
|
|
1840
|
+
let s = !1;
|
|
1826
1841
|
if (e.isMeanEdge) {
|
|
1827
1842
|
this._stampEdge(this.svg_element);
|
|
1828
|
-
const
|
|
1829
|
-
if (this.__data__ instanceof
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1843
|
+
const h = typeof e.weight == "number" ? e.weight : 0, o = typeof e.maxWeight == "number" ? e.maxWeight : 1, _ = typeof e.opacity == "number" ? e.opacity : Math.min(1, h / (o || 1)), m = t > 0 ? t : 1, p = e.fixedSize && this.graph.zoom_level || 1, u = (typeof e.widthFrac == "number" ? m * e.widthFrac * h : m * Ni * (h / (o || 1))) / p, d = this.__data__._color || new st("#000000"), l = typeof e.saturation == "number" ? e.saturation : _, b = new Ne(d, l, _).toString();
|
|
1844
|
+
if (this.__data__ instanceof Ht) {
|
|
1845
|
+
const f = typeof e.selfSize == "number" && e.selfSize > 0 ? e.selfSize : null, w = f != null ? (a = (r = this.graph)._nodeRadius) == null ? void 0 : a.call(r, String(e.source)) : null;
|
|
1846
|
+
this.__data__.weight = typeof w == "number" ? 2 * f * w : u, this.svg_element.setAttribute("d", this.__data__.path), this.svg_element.setAttribute("fill", b), this.svg_element.setAttribute("stroke", "none");
|
|
1847
|
+
} else if (this.__data__ instanceof Dt) {
|
|
1848
|
+
if (this.__data__.weight = u, this.svg_element.setAttribute("d", this.__data__.path), this.svg_element.setAttribute("fill", b), this.svg_element.setAttribute("stroke", b), this.svg_element.setAttribute("stroke-width", String(ki)), this.svg_element.setAttribute("vector-effect", "non-scaling-stroke"), this.svg_element.setAttribute("stroke-linejoin", "round"), e.isDirected)
|
|
1833
1849
|
try {
|
|
1834
|
-
const
|
|
1835
|
-
|
|
1850
|
+
const w = new Le(this.__data__).path;
|
|
1851
|
+
w && !w.includes("NaN") && !w.includes("Infinity") && (this._arrow_el || (this._arrow_el = document.createElementNS("http://www.w3.org/2000/svg", "path"), this._arrow_el.setAttribute("stroke", "none")), this._arrow_el.parentElement || this.parent.appendChild(this._arrow_el), this._arrow_el.setAttribute("d", w), this._arrow_el.setAttribute("fill", $i(Ri(b), zi)), this._arrow_el.setAttribute("stroke", "#ffffff"), this._arrow_el.setAttribute("stroke-width", String(Ci)), this._arrow_el.setAttribute("vector-effect", "non-scaling-stroke"), this._arrow_el.setAttribute("stroke-linejoin", "round"), s = !0);
|
|
1836
1852
|
} catch {
|
|
1837
1853
|
}
|
|
1838
1854
|
} else {
|
|
1839
|
-
const
|
|
1840
|
-
this.svg_element.setAttribute("x1",
|
|
1855
|
+
const f = this.__data__.from.x, w = this.__data__.from.y, $ = this.__data__.to.x, z = this.__data__.to.y;
|
|
1856
|
+
this.svg_element.setAttribute("x1", f.toString()), this.svg_element.setAttribute("y1", w.toString()), this.svg_element.setAttribute("x2", $.toString()), this.svg_element.setAttribute("y2", z.toString()), this.svg_element.setAttribute("stroke-width", u.toString()), this.svg_element.setAttribute("stroke", b), this.svg_element.setAttribute("pointer-events", "stroke"), this.svg_element.removeAttribute("marker-end"), this._hit_el || (this._hit_el = document.createElementNS("http://www.w3.org/2000/svg", "line"), this._hit_el.setAttribute("stroke", "transparent"), this._hit_el.setAttribute("stroke-linecap", "round"), this._hit_el.setAttribute("pointer-events", "stroke")), this._hit_el.parentElement || this.parent.appendChild(this._hit_el), this._hit_el.setAttribute("x1", f.toString()), this._hit_el.setAttribute("y1", w.toString()), this._hit_el.setAttribute("x2", $.toString()), this._hit_el.setAttribute("y2", z.toString()), this._hit_el.setAttribute("stroke-width", Math.max(u, t * 0.03 / p).toString()), this._stampEdge(this._hit_el);
|
|
1841
1857
|
}
|
|
1842
1858
|
} else {
|
|
1843
1859
|
this.svg_element.setAttribute("x1", this.__data__.from.x.toString()), this.svg_element.setAttribute("y1", this.__data__.from.y.toString()), this.svg_element.setAttribute("x2", this.__data__.to.x.toString()), this.svg_element.setAttribute("y2", this.__data__.to.y.toString());
|
|
1844
|
-
const
|
|
1845
|
-
this.svg_element.setAttribute("stroke-width",
|
|
1860
|
+
const h = this.graph._axesFixedSize && String(this.__data__.ID).startsWith("axis-") && this.graph.zoom_level || 1, o = (t > 0 ? t : 1) * 4e-3 * this.get_size() / h;
|
|
1861
|
+
this.svg_element.setAttribute("stroke-width", o.toString()), this.svg_element.setAttribute("stroke-opacity", "1"), this.svg_element.setAttribute("stroke", this.__data__.color.toString());
|
|
1846
1862
|
}
|
|
1863
|
+
!s && this._arrow_el && (this._arrow_el.remove(), this._arrow_el = null);
|
|
1864
|
+
}
|
|
1865
|
+
/** Take the edge off the plot, with its hit target and chevron. */
|
|
1866
|
+
remove() {
|
|
1867
|
+
var t, e, s;
|
|
1868
|
+
(t = this.svg_element) == null || t.remove(), (e = this._hit_el) == null || e.remove(), (s = this._arrow_el) == null || s.remove();
|
|
1847
1869
|
}
|
|
1848
1870
|
draw() {
|
|
1849
1871
|
var t, e, s;
|
|
1850
1872
|
this._hit_el && ((t = this.parent) == null || t.appendChild(this._hit_el)), (e = this.parent) == null || e.appendChild(this.svg_element), this._arrow_el && ((s = this.parent) == null || s.appendChild(this._arrow_el));
|
|
1851
1873
|
}
|
|
1852
1874
|
};
|
|
1853
|
-
|
|
1854
|
-
let
|
|
1855
|
-
const
|
|
1856
|
-
constructor(t, e, s, i = new
|
|
1875
|
+
c(Ss, "QELine");
|
|
1876
|
+
let Mt = Ss;
|
|
1877
|
+
const Es = class Es extends _e {
|
|
1878
|
+
constructor(t, e, s, i = new Pt()) {
|
|
1857
1879
|
super(t, e, s, i), this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.__name__ = "unnamed-point", this.svg_element = this.create();
|
|
1858
1880
|
}
|
|
1859
1881
|
get x() {
|
|
@@ -1904,13 +1926,22 @@ const ps = class ps extends re {
|
|
|
1904
1926
|
return typeof e == "number" && e > 0 ? Math.min(t, e) : t;
|
|
1905
1927
|
}
|
|
1906
1928
|
baseRadius() {
|
|
1907
|
-
var
|
|
1908
|
-
const t = this.
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1929
|
+
var e;
|
|
1930
|
+
const t = this.dataRadius();
|
|
1931
|
+
return (e = this.__data__.meta) != null && e.zoomFixed ? t / (this.graph.zoom_level || 1) : t;
|
|
1932
|
+
}
|
|
1933
|
+
dataRadius() {
|
|
1934
|
+
var i, n, r, a, h, o, _;
|
|
1935
|
+
const t = this.graph.__data__.extremes.x_max || 1, e = ((i = this.__data__.meta) == null ? void 0 : i.sizeScale) ?? 1, s = (n = this.__data__.meta) == null ? void 0 : n.sizePx;
|
|
1936
|
+
if (typeof s == "number" && s > 0) {
|
|
1937
|
+
const m = (a = (r = this.graph.svg_element) == null ? void 0 : r.getBoundingClientRect) == null ? void 0 : a.call(r), p = m && m.width > 0 ? 2 * t / m.width : t * 4e-3;
|
|
1938
|
+
return s / 2 * p;
|
|
1912
1939
|
}
|
|
1913
|
-
|
|
1940
|
+
if ((h = this.__data__.meta) != null && h.fixedSize) {
|
|
1941
|
+
const m = (_ = (o = this.graph.svg_element) == null ? void 0 : o.getBoundingClientRect) == null ? void 0 : _.call(o), p = this.graph.zoom_level || 1, u = m && m.width > 0 ? m.width / (2 * t) : 1;
|
|
1942
|
+
return this.__data__.size * 2 * e / u / p;
|
|
1943
|
+
}
|
|
1944
|
+
return t * ui * this.__data__.size * e;
|
|
1914
1945
|
}
|
|
1915
1946
|
/** Optional halo stroke (e.g. white outline on unit points to separate
|
|
1916
1947
|
* overlapping dots in dense clusters). Width scales with the dot so it holds
|
|
@@ -1920,33 +1951,42 @@ const ps = class ps extends re {
|
|
|
1920
1951
|
const e = (s = this.__data__.meta) == null ? void 0 : s.stroke;
|
|
1921
1952
|
e && (t.setAttribute("stroke", e), t.setAttribute("stroke-width", (this.computeRadius() * 0.22).toString()));
|
|
1922
1953
|
}
|
|
1954
|
+
/** Identity for <qe-graph> delegation → qe-node-* interaction events.
|
|
1955
|
+
* Re-applied on update(), since the element outlives renders. */
|
|
1956
|
+
stampIdentity(t) {
|
|
1957
|
+
t.setAttribute("data-point-id", this.__data__.ID);
|
|
1958
|
+
const e = this.__data__.meta ?? {}, s = /* @__PURE__ */ c((i, n) => n != null && n !== "" ? t.setAttribute(i, String(n)) : t.removeAttribute(i), "opt");
|
|
1959
|
+
s("data-kind", e.kind), s("data-name", e.name), s("data-group", e.group), s("data-unit", e.unit);
|
|
1960
|
+
}
|
|
1923
1961
|
create() {
|
|
1924
1962
|
const t = document.createElementNS("http://www.w3.org/2000/svg", this.tag);
|
|
1925
|
-
t.setAttribute("
|
|
1926
|
-
const e = this.__data__.meta ?? {};
|
|
1927
|
-
return e.kind && t.setAttribute("data-kind", e.kind), e.name != null && t.setAttribute("data-name", String(e.name)), e.group != null && t.setAttribute("data-group", String(e.group)), e.unit != null && t.setAttribute("data-unit", String(e.unit)), t.setAttribute("fill", this.__data__.color.toString()), this.applyStroke(t), this.setGeometry(t, this.computeRadius()), this.svg_element = t, t.addEventListener("click", () => {
|
|
1963
|
+
return this.stampIdentity(t), t.setAttribute("fill", this.__data__.color.toString()), this.applyStroke(t), this.setGeometry(t, this.computeRadius()), this.svg_element = t, t.addEventListener("click", () => {
|
|
1928
1964
|
this.__data__.active = !this.__data__.active, this.update();
|
|
1929
|
-
const
|
|
1965
|
+
const e = new CustomEvent("point-clicked", {
|
|
1930
1966
|
detail: { pointData: this.__data__ },
|
|
1931
1967
|
bubbles: !0,
|
|
1932
1968
|
composed: !0
|
|
1933
1969
|
});
|
|
1934
|
-
this.svg_element.dispatchEvent(
|
|
1970
|
+
this.svg_element.dispatchEvent(e);
|
|
1935
1971
|
}), t.addEventListener("mouseover", () => {
|
|
1936
1972
|
}), t;
|
|
1937
1973
|
}
|
|
1938
1974
|
update() {
|
|
1939
|
-
this.svg_element || this.parent.__data__.__children__.push(this.create()), this.svg_element.
|
|
1975
|
+
if (this.svg_element || this.parent.__data__.__children__.push(this.create()), this.svg_element.tagName.toLowerCase() !== this.tag) {
|
|
1976
|
+
const t = this.svg_element;
|
|
1977
|
+
this.create(), t.parentElement && t.replaceWith(this.svg_element);
|
|
1978
|
+
}
|
|
1979
|
+
this.svg_element.parentElement || this.parent.appendChild(this.svg_element), this.stampIdentity(this.svg_element), this.svg_element.setAttribute("fill", this.__data__.color.toString()), this.applyStroke(this.svg_element), this.setGeometry(this.svg_element, this.computeRadius());
|
|
1940
1980
|
}
|
|
1941
1981
|
draw() {
|
|
1942
1982
|
var t;
|
|
1943
1983
|
(t = this.parent) == null || t.appendChild(this.svg_element);
|
|
1944
1984
|
}
|
|
1945
1985
|
};
|
|
1946
|
-
|
|
1947
|
-
let
|
|
1948
|
-
const
|
|
1949
|
-
constructor(t, e, s, i = new
|
|
1986
|
+
c(Es, "QEPoint");
|
|
1987
|
+
let ue = Es;
|
|
1988
|
+
const Ms = class Ms extends _e {
|
|
1989
|
+
constructor(t, e, s, i = new Pt()) {
|
|
1950
1990
|
super(t, e, s, i), this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.__name__ = "trajectory", this._path_el = null, this._segments_group = null, this._tip_el = null, this._points_group = null, this.svg_element = this.create();
|
|
1951
1991
|
}
|
|
1952
1992
|
// Trajectory styling is specified in display pixels, while SVG paths use
|
|
@@ -1977,8 +2017,8 @@ const bs = class bs extends re {
|
|
|
1977
2017
|
if (this._segments_group.innerHTML = "", this.__data__.lineStyle === "tapered") {
|
|
1978
2018
|
const s = this.__data__.pathPoints, i = s.length - 1, [n, r] = this.__data__.strokeWidthRange, [a, h] = this.__data__.opacityRange;
|
|
1979
2019
|
for (let o = 0; o < i; o++) {
|
|
1980
|
-
const
|
|
1981
|
-
|
|
2020
|
+
const _ = s[o], m = s[o + 1], p = i <= 1 ? 1 : o / (i - 1), u = n + (r - n) * p, d = a + (h - a) * p, l = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2021
|
+
l.setAttribute("d", `M${_.x},${_.y} L${m.x},${m.y}`), l.setAttribute("fill", "none"), l.setAttribute("stroke", this.__data__.color.toString()), l.setAttribute("stroke-linecap", "round"), l.setAttribute("stroke-linejoin", "round"), l.setAttribute("stroke-width", this.graphUnitsForPixels(u).toString()), l.setAttribute("opacity", d.toString()), this._segments_group.appendChild(l);
|
|
1982
2022
|
}
|
|
1983
2023
|
this._segments_group.style.display = "block";
|
|
1984
2024
|
} else
|
|
@@ -1999,9 +2039,9 @@ const bs = class bs extends re {
|
|
|
1999
2039
|
this.svg_element && !this.svg_element.parentElement && this.parent.appendChild(this.svg_element), this.update();
|
|
2000
2040
|
}
|
|
2001
2041
|
};
|
|
2002
|
-
|
|
2003
|
-
let
|
|
2004
|
-
const { ArrayTools:
|
|
2042
|
+
c(Ms, "QETrajectory");
|
|
2043
|
+
let Re = Ms;
|
|
2044
|
+
const { ArrayTools: ri } = ce, Is = class Is extends Array {
|
|
2005
2045
|
constructor(...t) {
|
|
2006
2046
|
super(...t);
|
|
2007
2047
|
}
|
|
@@ -2010,67 +2050,68 @@ const { ArrayTools: Ws } = ie, ys = class ys extends Array {
|
|
|
2010
2050
|
function i(r) {
|
|
2011
2051
|
return r.name === e ? r : void 0;
|
|
2012
2052
|
}
|
|
2013
|
-
|
|
2053
|
+
c(i, "fn");
|
|
2014
2054
|
function n(r, a, h = null) {
|
|
2015
|
-
if (
|
|
2016
|
-
for (const [o,
|
|
2017
|
-
if (s = n(
|
|
2055
|
+
if (ri.isArray(r)) {
|
|
2056
|
+
for (const [o, _] of r.entries())
|
|
2057
|
+
if (s = n(_, o, h), s)
|
|
2018
2058
|
return s;
|
|
2019
2059
|
} else {
|
|
2020
2060
|
if (s = i(r), s)
|
|
2021
2061
|
return s;
|
|
2022
|
-
if (r &&
|
|
2023
|
-
for (const [o,
|
|
2024
|
-
if (s = n(
|
|
2062
|
+
if (r && ri.isArray(r[t])) {
|
|
2063
|
+
for (const [o, _] of r[t].entries())
|
|
2064
|
+
if (s = n(_, o, r), s)
|
|
2025
2065
|
return s;
|
|
2026
2066
|
}
|
|
2027
2067
|
}
|
|
2028
2068
|
return s;
|
|
2029
2069
|
}
|
|
2030
|
-
return
|
|
2070
|
+
return c(n, "recurse"), n(this);
|
|
2031
2071
|
}
|
|
2032
2072
|
flatten() {
|
|
2033
2073
|
return this.reduce((t, e) => (t.push(e), e.layers && Array.isArray(e.layers) && t.push(...e.layers), t), []);
|
|
2034
2074
|
}
|
|
2035
2075
|
};
|
|
2036
|
-
|
|
2037
|
-
let
|
|
2038
|
-
const
|
|
2039
|
-
AxisPoint:
|
|
2040
|
-
AxisLine:
|
|
2041
|
-
Point:
|
|
2042
|
-
Line:
|
|
2043
|
-
Edge:
|
|
2044
|
-
TaperedEdge:
|
|
2045
|
-
TaperedWeightedMidpointEdge:
|
|
2046
|
-
NodeEdge:
|
|
2047
|
-
Trajectory:
|
|
2048
|
-
},
|
|
2049
|
-
constructor(t, e, s, i = new
|
|
2076
|
+
c(Is, "QEArray");
|
|
2077
|
+
let Pt = Is;
|
|
2078
|
+
const Ti = {
|
|
2079
|
+
AxisPoint: ue,
|
|
2080
|
+
AxisLine: Mt,
|
|
2081
|
+
Point: ue,
|
|
2082
|
+
Line: Mt,
|
|
2083
|
+
Edge: Mt,
|
|
2084
|
+
TaperedEdge: Mt,
|
|
2085
|
+
TaperedWeightedMidpointEdge: Mt,
|
|
2086
|
+
NodeEdge: Mt,
|
|
2087
|
+
Trajectory: Re
|
|
2088
|
+
}, Ut = class Ut {
|
|
2089
|
+
constructor(t, e, s, i = new Pt()) {
|
|
2050
2090
|
this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.__name__ = t.name || "unnamed-layer", t.__state__.addListener("layer_updated", "live", ({ key: n, newValue: r, oldValue: a }) => {
|
|
2051
|
-
const h = /* @__PURE__ */
|
|
2052
|
-
var
|
|
2053
|
-
return (
|
|
2091
|
+
const h = /* @__PURE__ */ c((p) => {
|
|
2092
|
+
var u;
|
|
2093
|
+
return (u = p.__data__) == null ? void 0 : u.ID;
|
|
2054
2094
|
}, "childId"), o = this.__children__.filter(
|
|
2055
|
-
(
|
|
2056
|
-
),
|
|
2057
|
-
(
|
|
2095
|
+
(p) => !r.objects.has(h(p))
|
|
2096
|
+
), _ = this.__children__.filter(
|
|
2097
|
+
(p) => r.objects.has(h(p))
|
|
2058
2098
|
);
|
|
2059
2099
|
[...r.objects.values()].filter(
|
|
2060
|
-
(
|
|
2061
|
-
).forEach((
|
|
2062
|
-
const
|
|
2063
|
-
let
|
|
2064
|
-
|
|
2065
|
-
const
|
|
2066
|
-
this.__children__.push(
|
|
2067
|
-
}),
|
|
2068
|
-
const
|
|
2069
|
-
|
|
2070
|
-
}), o.forEach((
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2100
|
+
(p) => !this.__children__.some((u) => h(u) === p.ID)
|
|
2101
|
+
).forEach((p) => {
|
|
2102
|
+
const u = p._typeName || p.constructor.name;
|
|
2103
|
+
let d = Ti[u];
|
|
2104
|
+
d || (p instanceof Oe ? d = Re : p instanceof K ? d = ue : d = Mt);
|
|
2105
|
+
const l = new d(p, this.svg_element, this.graph);
|
|
2106
|
+
this.__children__.push(l);
|
|
2107
|
+
}), _.forEach((p) => {
|
|
2108
|
+
const u = r.objects.get(h(p));
|
|
2109
|
+
u && (p.__data__ = u), p.update();
|
|
2110
|
+
}), o.forEach((p) => {
|
|
2111
|
+
var d;
|
|
2112
|
+
typeof p.remove == "function" ? p.remove() : (d = p.svg_element.parentElement) == null || d.removeChild(p.svg_element);
|
|
2113
|
+
const u = this.__children__.indexOf(p);
|
|
2114
|
+
u >= 0 && this.__children__.splice(u, 1);
|
|
2074
2115
|
}), this.update();
|
|
2075
2116
|
}), this.svg_element = this.create();
|
|
2076
2117
|
}
|
|
@@ -2081,8 +2122,8 @@ const Ei = {
|
|
|
2081
2122
|
if (!this.__data__)
|
|
2082
2123
|
throw new Error("Layer is null");
|
|
2083
2124
|
let t = this.__data__;
|
|
2084
|
-
return this.svg_element = document.createElementNS("http://www.w3.org/2000/svg",
|
|
2085
|
-
const s = new
|
|
2125
|
+
return this.svg_element = document.createElementNS("http://www.w3.org/2000/svg", Ut.tagName), this.svg_element.setAttribute("data-layer-name", t.name), this.svg_element.setAttribute("data-layer-id", t.ID), this.svg_element.__data__ = t, this.svg_element.classList.add("ena-layer"), this.__data__.layers && this.__data__.layers.length > 0 && this.__data__.layers.forEach((e) => {
|
|
2126
|
+
const s = new Ut(e, this.svg_element, this.graph);
|
|
2086
2127
|
this.__children__.push(s);
|
|
2087
2128
|
}), this.svg_element;
|
|
2088
2129
|
}
|
|
@@ -2103,42 +2144,79 @@ const Ei = {
|
|
|
2103
2144
|
this.__children__.push(t);
|
|
2104
2145
|
}
|
|
2105
2146
|
};
|
|
2106
|
-
|
|
2107
|
-
let
|
|
2108
|
-
const
|
|
2109
|
-
constructor(t, e, s, i, n =
|
|
2110
|
-
this.text = t, this.
|
|
2147
|
+
c(Ut, "QELayer"), Ut.tagName = "g";
|
|
2148
|
+
let as = Ut;
|
|
2149
|
+
const Ns = class Ns {
|
|
2150
|
+
constructor(t, e, s, i, n = q.DISPLAY_TYPES.ON, r = q.POSITION.OBJECT, a, h) {
|
|
2151
|
+
this.text = t, this.parent = s, this.graph = i, this.displayMode = n, this.position = r, this.customX = a, this.customY = h, this._visible = !1, this._offsetX = 0, this._offsetY = 0, this.pinned = !1, this._hostPinned = !1, this.fontWeight = null, this._point = e, this.svg_element = this._create(), n === q.DISPLAY_TYPES.ON ? (this._visible = !0, this.svg_element.setAttribute("display", "block")) : (this._visible = !1, this.svg_element.setAttribute("display", "none"));
|
|
2152
|
+
}
|
|
2153
|
+
/** The mark this label follows. Rebound by setPoint() on every render. */
|
|
2154
|
+
get point() {
|
|
2155
|
+
return this._point;
|
|
2111
2156
|
}
|
|
2112
2157
|
_create() {
|
|
2113
2158
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
2114
2159
|
return t.textContent = this.text, t.setAttribute("data-label-for", this.point.ID), t.setAttribute("pointer-events", "auto"), t.style.cursor = "grab", this._attachDrag(t), this.parent.appendChild(t), t;
|
|
2115
2160
|
}
|
|
2116
|
-
/**
|
|
2161
|
+
/**
|
|
2162
|
+
* Follow a new Point for the same mark. Each render builds fresh Point
|
|
2163
|
+
* objects, so a label reused across renders must be rebound or it keeps the
|
|
2164
|
+
* old coordinates. A dragged label keeps its offset from the mark.
|
|
2165
|
+
*/
|
|
2166
|
+
setPoint(t) {
|
|
2167
|
+
this._point = t, this.svg_element.setAttribute("data-label-for", t.ID);
|
|
2168
|
+
}
|
|
2169
|
+
/** Host-set offset (graph units, y down), as qe-label-move reports it. */
|
|
2170
|
+
setOffset(t, e) {
|
|
2171
|
+
this._offsetX = Number.isFinite(t) ? t : 0, this._offsetY = Number.isFinite(e) ? e : 0;
|
|
2172
|
+
}
|
|
2173
|
+
/** Keep the label shown whatever its display mode (or stop doing so). */
|
|
2174
|
+
setHostPinned(t) {
|
|
2175
|
+
t !== this._hostPinned && (this._hostPinned = t, t ? this.show() : this.displayMode !== q.DISPLAY_TYPES.ON && this.hide());
|
|
2176
|
+
}
|
|
2177
|
+
/** Drag to reposition (mouse, or a finger); pins the label open and
|
|
2178
|
+
* emits qe-label-move on drop. */
|
|
2117
2179
|
_attachDrag(t) {
|
|
2118
2180
|
t.addEventListener("mousedown", (e) => {
|
|
2119
|
-
e.preventDefault(), e.stopPropagation();
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
const i = /* @__PURE__ */ _((l, u) => {
|
|
2123
|
-
const g = s.createSVGPoint();
|
|
2124
|
-
g.x = l, g.y = u;
|
|
2125
|
-
const c = s.getScreenCTM();
|
|
2126
|
-
return c ? g.matrixTransform(c.inverse()) : { x: 0, y: 0 };
|
|
2127
|
-
}, "toUser"), n = i(e.clientX, e.clientY), r = this._offsetX, a = this._offsetY;
|
|
2128
|
-
t.style.cursor = "grabbing";
|
|
2129
|
-
const h = /* @__PURE__ */ _((l) => {
|
|
2130
|
-
const u = i(l.clientX, l.clientY);
|
|
2131
|
-
this._offsetX = r + (u.x - n.x), this._offsetY = a + (u.y - n.y), this.pinned = !0, this._visible = !0, this.svg_element.setAttribute("display", "block"), this.update();
|
|
2132
|
-
}, "onMove"), o = /* @__PURE__ */ _(() => {
|
|
2133
|
-
document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", o), t.style.cursor = "grab", this.graph.dispatchEvent(new CustomEvent("qe-label-move", {
|
|
2134
|
-
detail: { id: this.point.ID, transform: { x: this._offsetX, y: this._offsetY } },
|
|
2135
|
-
bubbles: !0,
|
|
2136
|
-
composed: !0
|
|
2137
|
-
}));
|
|
2138
|
-
}, "onUp");
|
|
2139
|
-
document.addEventListener("mousemove", h), document.addEventListener("mouseup", o);
|
|
2181
|
+
e.preventDefault(), e.stopPropagation(), this._drag(t, e.clientX, e.clientY, "mouse");
|
|
2182
|
+
}), t.addEventListener("pointerdown", (e) => {
|
|
2183
|
+
e.pointerType === "touch" && (e.preventDefault(), e.stopPropagation(), this._drag(t, e.clientX, e.clientY, e.pointerId));
|
|
2140
2184
|
});
|
|
2141
2185
|
}
|
|
2186
|
+
_drag(t, e, s, i) {
|
|
2187
|
+
const n = t.parentNode ?? t.ownerSVGElement, r = t.ownerSVGElement;
|
|
2188
|
+
if (!r || !n) return;
|
|
2189
|
+
const a = /* @__PURE__ */ c((u, d) => {
|
|
2190
|
+
const l = r.createSVGPoint();
|
|
2191
|
+
l.x = u, l.y = d;
|
|
2192
|
+
const b = n.getScreenCTM();
|
|
2193
|
+
return b ? l.matrixTransform(b.inverse()) : { x: 0, y: 0 };
|
|
2194
|
+
}, "toUser"), h = a(e, s), o = this._offsetX, _ = this._offsetY;
|
|
2195
|
+
t.style.cursor = "grabbing";
|
|
2196
|
+
const m = /* @__PURE__ */ c((u, d) => {
|
|
2197
|
+
const l = a(u, d);
|
|
2198
|
+
this._offsetX = o + (l.x - h.x), this._offsetY = _ + (l.y - h.y), this.pinned = !0, this._visible = !0, this.svg_element.setAttribute("display", "block"), this.update();
|
|
2199
|
+
}, "move"), p = /* @__PURE__ */ c(() => {
|
|
2200
|
+
t.style.cursor = "grab", this.graph.dispatchEvent(new CustomEvent("qe-label-move", {
|
|
2201
|
+
detail: { id: this.point.ID, transform: { x: this._offsetX, y: this._offsetY } },
|
|
2202
|
+
bubbles: !0,
|
|
2203
|
+
composed: !0
|
|
2204
|
+
}));
|
|
2205
|
+
}, "done");
|
|
2206
|
+
if (i === "mouse") {
|
|
2207
|
+
const u = /* @__PURE__ */ c((l) => m(l.clientX, l.clientY), "onMove"), d = /* @__PURE__ */ c(() => {
|
|
2208
|
+
document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", d), p();
|
|
2209
|
+
}, "onUp");
|
|
2210
|
+
document.addEventListener("mousemove", u), document.addEventListener("mouseup", d);
|
|
2211
|
+
} else {
|
|
2212
|
+
const u = /* @__PURE__ */ c((l) => {
|
|
2213
|
+
l.pointerId === i && m(l.clientX, l.clientY);
|
|
2214
|
+
}, "onMove"), d = /* @__PURE__ */ c((l) => {
|
|
2215
|
+
l.pointerId === i && (document.removeEventListener("pointermove", u), document.removeEventListener("pointerup", d), document.removeEventListener("pointercancel", d), p());
|
|
2216
|
+
}, "onUp");
|
|
2217
|
+
document.addEventListener("pointermove", u), document.addEventListener("pointerup", d), document.addEventListener("pointercancel", d);
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2142
2220
|
/**
|
|
2143
2221
|
* Recompute position and font-size from current graph extents.
|
|
2144
2222
|
* No-ops when the label is hidden (AUTO/CLICK modes while not hovered/clicked).
|
|
@@ -2151,28 +2229,28 @@ const xs = class xs {
|
|
|
2151
2229
|
const e = this.graph._labelFont ?? {}, s = e.size ? e.size * this.graph.unitsPerPixel() : t * 0.06, i = s * 1.2;
|
|
2152
2230
|
let n, r, a;
|
|
2153
2231
|
switch (this.position) {
|
|
2154
|
-
case
|
|
2232
|
+
case q.POSITION.STATIC: {
|
|
2155
2233
|
n = this.point.x, r = this.point.y - i * 0.3, a = "middle";
|
|
2156
2234
|
break;
|
|
2157
2235
|
}
|
|
2158
|
-
case
|
|
2159
|
-
const { cx: o, cy:
|
|
2160
|
-
n = o +
|
|
2236
|
+
case q.POSITION.CONTAINER: {
|
|
2237
|
+
const { cx: o, cy: _ } = this.graph.__data__.extremes, m = this.point.x - o, p = this.point.y - _, u = Math.sqrt(m * m + p * p) || 1, d = t * 0.93 / u;
|
|
2238
|
+
n = o + m * d, r = _ + p * d - i * 0.3, a = m >= 0 ? "start" : "end";
|
|
2161
2239
|
break;
|
|
2162
2240
|
}
|
|
2163
|
-
case
|
|
2241
|
+
case q.POSITION.CUSTOM:
|
|
2164
2242
|
if (this.customX != null && this.customY != null) {
|
|
2165
2243
|
n = this.customX, r = this.customY, a = "start";
|
|
2166
2244
|
break;
|
|
2167
2245
|
}
|
|
2168
2246
|
default:
|
|
2169
|
-
case
|
|
2247
|
+
case q.POSITION.OBJECT: {
|
|
2170
2248
|
const o = this.point.x >= 0 ? i : -i;
|
|
2171
2249
|
a = this.point.x >= 0 ? "start" : "end", n = this.point.x + o, r = this.point.y - i * 0.4;
|
|
2172
2250
|
break;
|
|
2173
2251
|
}
|
|
2174
2252
|
}
|
|
2175
|
-
this.svg_element.setAttribute("x", n.toString()), this.svg_element.setAttribute("y", r.toString()),
|
|
2253
|
+
this.svg_element.setAttribute("x", n.toString()), this.svg_element.setAttribute("y", r.toString()), this._offsetX || this._offsetY ? this.svg_element.setAttribute("transform", `translate(${this._offsetX}, ${this._offsetY})`) : this.svg_element.removeAttribute("transform"), this.svg_element.setAttribute("font-size", s.toString()), this.svg_element.setAttribute("font-family", e.family ?? "system-ui, sans-serif"), this.svg_element.setAttribute("font-weight", this.fontWeight ?? "500"), this.svg_element.setAttribute("text-anchor", a), this.svg_element.setAttribute("fill", e.color ?? ((h = this.point.color) == null ? void 0 : h.toString()) ?? "#333333"), !this._offsetX && !this._offsetY && this.position !== q.POSITION.CUSTOM && this.fitInside(n, r, a, i, s * 0.3);
|
|
2176
2254
|
}
|
|
2177
2255
|
/** The visible plot area in this label's coordinates (so zoom, pan and the
|
|
2178
2256
|
* viewBox's letterboxing are accounted for), or null if not laid out. */
|
|
@@ -2204,22 +2282,22 @@ const xs = class xs {
|
|
|
2204
2282
|
const r = this.visibleBounds();
|
|
2205
2283
|
let a = this.bbox();
|
|
2206
2284
|
if (!r || !a) return;
|
|
2207
|
-
const h = r.left + n, o = r.right - n,
|
|
2208
|
-
if (
|
|
2209
|
-
const
|
|
2210
|
-
|
|
2211
|
-
const
|
|
2212
|
-
|
|
2285
|
+
const h = r.left + n, o = r.right - n, _ = r.top + n, m = r.bottom - n, p = /* @__PURE__ */ c((b) => Math.max(0, h - b.x) + Math.max(0, b.x + b.width - o), "over"), u = this.svg_element;
|
|
2286
|
+
if (p(a) > 0 && this.position === q.POSITION.OBJECT && s !== "middle") {
|
|
2287
|
+
const b = s === "end" ? "start" : "end", f = s === "end" ? this.point.x + i : this.point.x - i;
|
|
2288
|
+
u.setAttribute("text-anchor", b), u.setAttribute("x", f.toString());
|
|
2289
|
+
const w = this.bbox();
|
|
2290
|
+
w && p(w) < p(a) ? (a = w, t = f) : (u.setAttribute("text-anchor", s), u.setAttribute("x", t.toString()));
|
|
2213
2291
|
}
|
|
2214
|
-
let
|
|
2215
|
-
a.x < h ?
|
|
2292
|
+
let d = 0, l = 0;
|
|
2293
|
+
a.x < h ? d = h - a.x : a.x + a.width > o && (d = Math.max(o - (a.x + a.width), h - a.x)), a.y < _ ? l = _ - a.y : a.y + a.height > m && (l = Math.max(m - (a.y + a.height), _ - a.y)), d && u.setAttribute("x", (t + d).toString()), l && u.setAttribute("y", (e + l).toString());
|
|
2216
2294
|
}
|
|
2217
2295
|
/** Make the label visible and position it immediately. */
|
|
2218
2296
|
show() {
|
|
2219
2297
|
this._visible = !0, this.svg_element.setAttribute("display", "block"), this.update();
|
|
2220
2298
|
}
|
|
2221
2299
|
hide() {
|
|
2222
|
-
this.pinned || (this._visible = !1, this.svg_element.setAttribute("display", "none"));
|
|
2300
|
+
this.pinned || this._hostPinned || (this._visible = !1, this.svg_element.setAttribute("display", "none"));
|
|
2223
2301
|
}
|
|
2224
2302
|
toggle() {
|
|
2225
2303
|
this._visible ? this.hide() : this.show();
|
|
@@ -2231,39 +2309,39 @@ const xs = class xs {
|
|
|
2231
2309
|
this.svg_element.remove();
|
|
2232
2310
|
}
|
|
2233
2311
|
};
|
|
2234
|
-
|
|
2235
|
-
let
|
|
2236
|
-
const
|
|
2312
|
+
c(Ns, "QELabel");
|
|
2313
|
+
let hs = Ns;
|
|
2314
|
+
const We = class We extends HTMLElement {
|
|
2237
2315
|
};
|
|
2238
|
-
|
|
2239
|
-
let
|
|
2240
|
-
const
|
|
2316
|
+
c(We, "QENodesElement"), We.tagName = "qe-nodes";
|
|
2317
|
+
let $e = We;
|
|
2318
|
+
const He = class He extends HTMLElement {
|
|
2241
2319
|
};
|
|
2242
|
-
|
|
2243
|
-
let
|
|
2244
|
-
const
|
|
2320
|
+
c(He, "QEMeansElement"), He.tagName = "qe-means";
|
|
2321
|
+
let Te = He;
|
|
2322
|
+
const Ve = class Ve extends HTMLElement {
|
|
2245
2323
|
};
|
|
2246
|
-
|
|
2247
|
-
let
|
|
2248
|
-
const
|
|
2324
|
+
c(Ve, "QEPointsElement"), Ve.tagName = "qe-points";
|
|
2325
|
+
let Fe = Ve;
|
|
2326
|
+
const Ze = class Ze extends HTMLElement {
|
|
2249
2327
|
};
|
|
2250
|
-
|
|
2251
|
-
let
|
|
2252
|
-
const
|
|
2328
|
+
c(Ze, "QEEdgesElement"), Ze.tagName = "qe-edges";
|
|
2329
|
+
let De = Ze;
|
|
2330
|
+
const Ke = class Ke extends HTMLElement {
|
|
2253
2331
|
};
|
|
2254
|
-
|
|
2255
|
-
let
|
|
2256
|
-
const
|
|
2332
|
+
c(Ke, "QETrajectoriesElement"), Ke.tagName = "qe-trajectories";
|
|
2333
|
+
let je = Ke;
|
|
2334
|
+
const Je = class Je extends HTMLElement {
|
|
2257
2335
|
};
|
|
2258
|
-
|
|
2259
|
-
let
|
|
2260
|
-
customElements.define(ke.tagName, ke);
|
|
2261
|
-
customElements.define(Ce.tagName, Ce);
|
|
2262
|
-
customElements.define(Oe.tagName, Oe);
|
|
2336
|
+
c(Je, "QEAxesElement"), Je.tagName = "qe-axes";
|
|
2337
|
+
let Ye = Je;
|
|
2263
2338
|
customElements.define($e.tagName, $e);
|
|
2264
|
-
customElements.define(
|
|
2265
|
-
customElements.define(
|
|
2266
|
-
|
|
2339
|
+
customElements.define(Te.tagName, Te);
|
|
2340
|
+
customElements.define(Fe.tagName, Fe);
|
|
2341
|
+
customElements.define(De.tagName, De);
|
|
2342
|
+
customElements.define(je.tagName, je);
|
|
2343
|
+
customElements.define(Ye.tagName, Ye);
|
|
2344
|
+
const oi = [
|
|
2267
2345
|
"#4477AA",
|
|
2268
2346
|
"#EE6677",
|
|
2269
2347
|
"#228833",
|
|
@@ -2273,42 +2351,66 @@ const Vs = [
|
|
|
2273
2351
|
"#BBBBBB",
|
|
2274
2352
|
"#000000"
|
|
2275
2353
|
];
|
|
2276
|
-
function
|
|
2354
|
+
function Fi(g, t) {
|
|
2277
2355
|
for (const e of t)
|
|
2278
|
-
if (
|
|
2356
|
+
if (g === `${e}.${e}`) return [e, e];
|
|
2279
2357
|
for (const e of t)
|
|
2280
|
-
if (
|
|
2281
|
-
const s =
|
|
2358
|
+
if (g.startsWith(e + ".")) {
|
|
2359
|
+
const s = g.slice(e.length + 1);
|
|
2282
2360
|
if (t.includes(s)) return [e, s];
|
|
2283
2361
|
}
|
|
2284
2362
|
return null;
|
|
2285
2363
|
}
|
|
2286
|
-
|
|
2287
|
-
function
|
|
2288
|
-
const i = Math.max(1, e - 1), n = i >= 120 ? 1.96 : i >= 60 ? 2 : i >= 30 ? 2.042 : i >= 20 ? 2.086 : i >= 10 ? 2.228 : i >= 5 ? 2.571 : 4.303, r = Math.sqrt(Math.max(0,
|
|
2364
|
+
c(Fi, "parseEdgePair");
|
|
2365
|
+
function Di(g, t, e, s) {
|
|
2366
|
+
const i = Math.max(1, e - 1), n = i >= 120 ? 1.96 : i >= 60 ? 2 : i >= 30 ? 2.042 : i >= 20 ? 2.086 : i >= 10 ? 2.228 : i >= 5 ? 2.571 : 4.303, r = Math.sqrt(Math.max(0, g) / e) * s, a = Math.sqrt(Math.max(0, t) / e) * s;
|
|
2289
2367
|
return { halfW: n * r, halfH: n * a };
|
|
2290
2368
|
}
|
|
2291
|
-
|
|
2292
|
-
const
|
|
2293
|
-
function
|
|
2294
|
-
if (!
|
|
2369
|
+
c(Di, "computeCIRect");
|
|
2370
|
+
const ji = 0.5;
|
|
2371
|
+
function ve(g, t, e) {
|
|
2372
|
+
if (!g) return;
|
|
2295
2373
|
const s = Math.min(Math.abs(t), Math.abs(e));
|
|
2296
|
-
s > 0 && (
|
|
2374
|
+
s > 0 && (g.meta = { ...g.meta ?? {}, maxRadius: s * ji });
|
|
2297
2375
|
}
|
|
2298
|
-
|
|
2299
|
-
function
|
|
2300
|
-
const i = /* @__PURE__ */
|
|
2301
|
-
const
|
|
2302
|
-
if (
|
|
2303
|
-
const
|
|
2304
|
-
return Number.isFinite(
|
|
2376
|
+
c(ve, "capMeanToInterval");
|
|
2377
|
+
function Ae(g, t, e, s = "") {
|
|
2378
|
+
const i = /* @__PURE__ */ c((o) => {
|
|
2379
|
+
const _ = g.names.indexOf(o), m = _ >= 0 ? g[_] : null;
|
|
2380
|
+
if (m == null || m === "") return;
|
|
2381
|
+
const p = Number(m);
|
|
2382
|
+
return Number.isFinite(p) ? p : void 0;
|
|
2305
2383
|
}, "get"), n = i(`${t}.${s}low`) ?? i(`${t}_${s}low`), r = i(`${t}.${s}high`) ?? i(`${t}_${s}high`), a = i(`${e}.${s}low`) ?? i(`${e}_${s}low`), h = i(`${e}.${s}high`) ?? i(`${e}_${s}high`);
|
|
2306
2384
|
return n == null || r == null || a == null || h == null ? null : { x_low: n, x_high: r, y_low: a, y_high: h };
|
|
2307
2385
|
}
|
|
2308
|
-
|
|
2309
|
-
function
|
|
2386
|
+
c(Ae, "readIntervalBounds");
|
|
2387
|
+
function Se(g, t) {
|
|
2388
|
+
const e = /* @__PURE__ */ c((o) => {
|
|
2389
|
+
if (!g) return;
|
|
2390
|
+
const _ = g.names.indexOf(o);
|
|
2391
|
+
return _ >= 0 ? g[_] : void 0;
|
|
2392
|
+
}, "raw"), s = /* @__PURE__ */ c((o) => o == null || o === "NA" || typeof o == "number" && Number.isNaN(o), "isNA"), i = e("label"), n = s(i) ? t : String(i) === "" ? null : String(i), r = /* @__PURE__ */ c((o) => {
|
|
2393
|
+
const _ = e(o), m = s(_) || _ === "" ? 0 : Number(_);
|
|
2394
|
+
return Number.isFinite(m) ? m : 0;
|
|
2395
|
+
}, "num"), a = !!g && (g.names.includes("label.dx") || g.names.includes("label.dy")), h = e("label.pinned");
|
|
2396
|
+
return {
|
|
2397
|
+
text: n,
|
|
2398
|
+
offset: a ? { x: r("label.dx"), y: r("label.dy") } : null,
|
|
2399
|
+
pinned: h === !0 || h === 1 || String(h).toLowerCase() === "true"
|
|
2400
|
+
};
|
|
2401
|
+
}
|
|
2402
|
+
c(Se, "readLabelSpec");
|
|
2403
|
+
function Yi(g) {
|
|
2404
|
+
const t = g == null ? void 0 : g.trim().toLowerCase();
|
|
2405
|
+
if (!t) return null;
|
|
2406
|
+
if (t === "node") return 0.5;
|
|
2407
|
+
const e = Number(t);
|
|
2408
|
+
return Number.isFinite(e) && e > 0 ? e : null;
|
|
2409
|
+
}
|
|
2410
|
+
c(Yi, "parseSelfSize");
|
|
2411
|
+
function qi(g) {
|
|
2310
2412
|
var i, n;
|
|
2311
|
-
const t = /* @__PURE__ */
|
|
2413
|
+
const t = /* @__PURE__ */ c((r) => g.getAttribute(r), "a"), e = ((i = t("colors")) == null ? void 0 : i.split(",").map((r) => r.trim()).filter(Boolean)) ?? [], s = ((n = t("threshold")) == null ? void 0 : n.split(",").map(Number).filter(Number.isFinite)) ?? [];
|
|
2312
2414
|
return {
|
|
2313
2415
|
group: t("group"),
|
|
2314
2416
|
unit: t("unit"),
|
|
@@ -2317,22 +2419,24 @@ function ki(d) {
|
|
|
2317
2419
|
network: t("network"),
|
|
2318
2420
|
colors: e.length ? [e[0], e[1] ?? null] : null,
|
|
2319
2421
|
threshold: s.length ? [s[0], s.length > 1 ? s[1] : 1 / 0] : null,
|
|
2320
|
-
name: t("name")
|
|
2422
|
+
name: t("name"),
|
|
2423
|
+
selfSize: Yi(t("self-size")),
|
|
2424
|
+
fixedSize: g.hasAttribute("fixed-size")
|
|
2321
2425
|
};
|
|
2322
2426
|
}
|
|
2323
|
-
|
|
2324
|
-
function
|
|
2325
|
-
const { r: t, g: e, b: s } = st.parseColor(
|
|
2427
|
+
c(qi, "parseEdgeLayer");
|
|
2428
|
+
function Bi(g) {
|
|
2429
|
+
const { r: t, g: e, b: s } = st.parseColor(g), i = Math.max(t, e, s), n = Math.min(t, e, s), r = /* @__PURE__ */ c((a) => (i + n - a).toString(16).padStart(2, "0"), "f");
|
|
2326
2430
|
return `#${r(t)}${r(e)}${r(s)}`;
|
|
2327
2431
|
}
|
|
2328
|
-
|
|
2329
|
-
function
|
|
2330
|
-
const t =
|
|
2432
|
+
c(Bi, "complementColor");
|
|
2433
|
+
function Gi(g) {
|
|
2434
|
+
const t = g == null ? void 0 : g.trim().toLowerCase();
|
|
2331
2435
|
return t === "plot" || t === "absolute" ? t : "model";
|
|
2332
2436
|
}
|
|
2333
|
-
|
|
2334
|
-
function
|
|
2335
|
-
switch (
|
|
2437
|
+
c(Gi, "parseColorScale");
|
|
2438
|
+
function Ee(g, t) {
|
|
2439
|
+
switch (g == null ? void 0 : g.toLowerCase()) {
|
|
2336
2440
|
case "on":
|
|
2337
2441
|
return 3;
|
|
2338
2442
|
case "off":
|
|
@@ -2345,241 +2449,271 @@ function He(d, t) {
|
|
|
2345
2449
|
return t;
|
|
2346
2450
|
}
|
|
2347
2451
|
}
|
|
2348
|
-
|
|
2349
|
-
const
|
|
2452
|
+
c(Ee, "parseLabelMode");
|
|
2453
|
+
const et = class et extends ze {
|
|
2350
2454
|
constructor() {
|
|
2351
|
-
super(), this.zoom_level = 1, this.__children__ = new
|
|
2352
|
-
var
|
|
2353
|
-
const e = ((
|
|
2455
|
+
super(), this.zoom_level = 1, this.__children__ = new Pt(), this._hasModel = !1, this._renderPending = !1, this._childObserver = null, this._ciRects = /* @__PURE__ */ new Map(), this._outlierRects = /* @__PURE__ */ new Map(), this._ciCross = /* @__PURE__ */ new Map(), this._labelsGroup = null, this._nodeLabels = /* @__PURE__ */ new Map(), this._meanLabels = /* @__PURE__ */ new Map(), this._pointLabels = /* @__PURE__ */ new Map(), this._setLabels = /* @__PURE__ */ new Map(), this._showAxes = !1, this._axisXText = null, this._axisYText = null, this._axisLabelEls = /* @__PURE__ */ new Map(), this._magnifyText = null, this._magnifyEl = null, this._rangeExtent = null, this._rangeMode = null, this._centerContent = !1, this._edgesFixedSize = !1, this._meansFixedSize = !1, this._intervalBase = /* @__PURE__ */ new WeakMap(), this._axesFixedSize = !1, this._plotTitle = null, this._titleEl = null, this._resizeObs = null, this._labelFont = { size: null, family: null, color: null }, this._zoomAnim = null, this._animateMs = 0, this._tweenRaf = null, this._tween = null, this._tweenView = null, this._highlight = { edges: /* @__PURE__ */ new Set(), nodes: /* @__PURE__ */ new Set() }, this._highlightGroup = null, this._tooltipEl = null, this.graph = this, this.parent = null, this.__data__ = new is(ai), this.__name__ = this.__data__.name || "unnamed-graph", this.svg_element = this.create(), Qt("Created qe-graph svg element: ", this.svg_element), document.addEventListener("model-updated", (t) => {
|
|
2456
|
+
var Os, Ps, Ls, Rs, $s, Ts, Fs, Ds, js, Ys, qs, Bs, Gs, Us, Xs, Ws, Hs;
|
|
2457
|
+
const e = ((Os = t.composedPath) == null ? void 0 : Os.call(t)[0]) ?? t.target;
|
|
2354
2458
|
if (this._vizena && e !== this._vizena) return;
|
|
2355
2459
|
const s = t.detail;
|
|
2356
2460
|
if (!s) return;
|
|
2357
|
-
this._animateMs = this.hasAttribute("animate") ? parseInt(this.getAttribute("animate") || "", 10) || 300 : 0;
|
|
2358
|
-
const i = this._animateMs > 0 && this._hasModel ? this.
|
|
2359
|
-
this._hasModel = !0;
|
|
2461
|
+
this._renderPending = !1, (Ps = this._childObserver) == null || Ps.takeRecords(), this._animateMs = this.hasAttribute("animate") ? parseInt(this.getAttribute("animate") || "", 10) || 300 : 0;
|
|
2462
|
+
const i = this._animateMs > 0 && this._hasModel ? this._captureTweenState() : null;
|
|
2463
|
+
this._stopTween(), this._hasModel = !0;
|
|
2360
2464
|
const n = s.dimensions, r = s.unit_id_col, a = s.node_id_col, h = s.group_col, o = this._readLayerConfig();
|
|
2361
2465
|
this._showAxes = o.showAxes, this._axisXText = o.axisXLabel === null ? null : o.axisXLabel || String((n == null ? void 0 : n[0]) ?? "x"), this._magnifyText = o.edgeMagnify == null ? null : `(scaled ${o.edgeMagnify.toFixed(1)}x)`, this._axisYText = o.axisYLabel === null ? null : o.axisYLabel || String((n == null ? void 0 : n[1]) ?? "y");
|
|
2362
|
-
const
|
|
2363
|
-
if (h && ((
|
|
2364
|
-
const
|
|
2365
|
-
|
|
2366
|
-
|
|
2466
|
+
const _ = {}, m = (Ls = s.palette) != null && Ls.length ? s.palette : oi;
|
|
2467
|
+
if (h && ((Rs = s.points) != null && Rs.names)) {
|
|
2468
|
+
const I = s.points.col(h);
|
|
2469
|
+
I && [...new Set([...I].map(String))].forEach((P, N) => {
|
|
2470
|
+
_[P] = m[N % m.length];
|
|
2367
2471
|
});
|
|
2368
2472
|
}
|
|
2369
|
-
(
|
|
2370
|
-
const
|
|
2371
|
-
|
|
2473
|
+
($s = s.groups) != null && $s.rows && s.groups.rows().length > 0 && s.groups.rows().forEach((I) => {
|
|
2474
|
+
const k = I.rowName ?? String(I[0]), P = I.names.indexOf("color"), N = P >= 0 ? I[P] : null;
|
|
2475
|
+
N && String(N) !== "NA" ? _[k] = String(N) : _[k] || (_[k] = m[Object.keys(_).length % m.length]);
|
|
2372
2476
|
});
|
|
2373
|
-
const
|
|
2374
|
-
o.activeMeanGroups.split(",").map((
|
|
2477
|
+
const p = Object.keys(_), u = o.activeMeanGroups && o.activeMeanGroups.trim() ? new Set(
|
|
2478
|
+
o.activeMeanGroups.split(",").map((I) => I.trim()).filter((I) => _[I])
|
|
2375
2479
|
// silently drop names not in model
|
|
2376
|
-
) : new Set(
|
|
2377
|
-
let
|
|
2378
|
-
return
|
|
2379
|
-
const
|
|
2380
|
-
|
|
2381
|
-
}),
|
|
2382
|
-
}, "getExtent"),
|
|
2383
|
-
this._rangeExtent = o.range === "network" ?
|
|
2384
|
-
const
|
|
2385
|
-
const
|
|
2386
|
-
ID:
|
|
2480
|
+
) : new Set(p), d = o.scalePoints, l = /* @__PURE__ */ c((I) => {
|
|
2481
|
+
let k = 0;
|
|
2482
|
+
return I.forEach((P) => {
|
|
2483
|
+
const N = P.names.indexOf(n[0]), S = n.length > 1 ? P.names.indexOf(n[1]) : -1;
|
|
2484
|
+
N >= 0 && (k = Math.max(k, Math.abs(Number(P[N])))), S >= 0 && (k = Math.max(k, Math.abs(Number(P[S]))));
|
|
2485
|
+
}), k;
|
|
2486
|
+
}, "getExtent"), b = (Ts = s.nodes) != null && Ts.rows ? l(s.nodes.rows()) : 0, f = (Fs = s.points) != null && Fs.rows ? l(s.points.rows()) : 0, w = (Ds = s.trajectories) != null && Ds.rows ? l(s.trajectories.rows()) : 0, $ = f > 0 ? f : w, z = o.pointScale !== null ? o.pointScale : d && $ > 0 && b > 0 ? b / $ : 1;
|
|
2487
|
+
this._rangeExtent = o.range === "network" ? b * 1.2 : o.range === "points" ? $ * z * 1.2 : typeof o.range == "number" ? o.range : null, this._rangeMode = o.range === "network" || o.range === "points" ? o.range : typeof o.range == "number" ? "number" : null, this._centerContent = o.centerContent, this._edgesFixedSize = o.edgeLayers.some((I) => I.fixedSize), this._meansFixedSize = o.meanFixedSize, this._axesFixedSize = o.axesFixedSize, this._plotTitle = o.plotTitle, this._labelFont = o.labelFont;
|
|
2488
|
+
const D = o.labelNodes, lt = o.labelMeans, ct = o.labelPoints, J = this._labelsGroup, _t = /* @__PURE__ */ c((I, k, P, N = 1) => {
|
|
2489
|
+
const S = I.names.indexOf(k), y = I.names.indexOf(n[0]), O = n.length > 1 ? I.names.indexOf(n[1]) : -1, v = new K({
|
|
2490
|
+
ID: S >= 0 ? String(I[S]) : I.rowName || `pt-${Math.random().toString(36).slice(2)}`,
|
|
2387
2491
|
dimensions: [
|
|
2388
|
-
|
|
2389
|
-
|
|
2492
|
+
y >= 0 ? Number(I[y]) * N : 0,
|
|
2493
|
+
O >= 0 ? -Number(I[O]) * N : 0
|
|
2390
2494
|
// negate Y: SVG y-down vs ENA y-up
|
|
2391
2495
|
],
|
|
2392
2496
|
meta: {}
|
|
2393
2497
|
});
|
|
2394
|
-
return P && (
|
|
2395
|
-
}, "rowToPoint"),
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2498
|
+
return P && (v.color = new st(P)), v;
|
|
2499
|
+
}, "rowToPoint"), Z = {}, kt = o.showPoints;
|
|
2500
|
+
["points", "nodes", "edges", "edgenodes"].map((I) => this.__children__.search("__children__", I)).filter((I) => !!I).forEach((I) => I.__data__.objects.clear()), this.__data__.points.clear();
|
|
2501
|
+
const se = s.pointsets, Lt = [];
|
|
2502
|
+
if (o.pointSets.length && (se != null && se.rows)) {
|
|
2503
|
+
const I = this.__children__.search("__children__", "points"), k = /* @__PURE__ */ c((P, N) => {
|
|
2504
|
+
const S = P.names.indexOf(N);
|
|
2505
|
+
return S >= 0 ? P[S] : null;
|
|
2400
2506
|
}, "col");
|
|
2401
|
-
o.pointSets.forEach((P,
|
|
2402
|
-
|
|
2403
|
-
if (String(
|
|
2404
|
-
const
|
|
2405
|
-
|
|
2406
|
-
const
|
|
2407
|
-
|
|
2408
|
-
const
|
|
2409
|
-
|
|
2507
|
+
o.pointSets.forEach((P, N) => {
|
|
2508
|
+
se.rows().forEach((S) => {
|
|
2509
|
+
if (String(k(S, "set")) !== P.set) return;
|
|
2510
|
+
const y = String(k(S, "id")), O = k(S, "group") != null && String(k(S, "group")) !== "NA" ? String(k(S, "group")) : null, v = k(S, "color") && String(k(S, "color")) !== "NA" ? String(k(S, "color")) : O && _[O] ? _[O] : m[N % m.length], E = _t(S, "id", v, z);
|
|
2511
|
+
E.ID = `${P.set}::${y}`, E.size = P.size ?? o.pointSize ?? 2.5;
|
|
2512
|
+
const F = k(S, "shape");
|
|
2513
|
+
F && String(F) !== "NA" && (E.shape = String(F));
|
|
2514
|
+
const U = k(S, "label");
|
|
2515
|
+
E.meta = {
|
|
2410
2516
|
stroke: "#ffffff",
|
|
2411
2517
|
kind: "point",
|
|
2412
|
-
name:
|
|
2413
|
-
group:
|
|
2414
|
-
unit:
|
|
2518
|
+
name: U != null && String(U) !== "NA" ? String(U) : y,
|
|
2519
|
+
group: O ?? void 0,
|
|
2520
|
+
unit: y,
|
|
2415
2521
|
set: P.set,
|
|
2416
2522
|
fixedSize: P.fixedSize
|
|
2417
|
-
}, this.__data__.points.set(
|
|
2523
|
+
}, this.__data__.points.set(E.ID, E), I == null || I.__data__.objects.set(E.ID, E), Lt.push({ pt: E, spec: Se(S, y), mode: P.labelMode, weight: P.labelWeight });
|
|
2418
2524
|
});
|
|
2419
2525
|
});
|
|
2420
2526
|
}
|
|
2421
|
-
if (
|
|
2422
|
-
const
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2527
|
+
if (J) {
|
|
2528
|
+
const I = new Set(Lt.map((k) => k.pt.ID));
|
|
2529
|
+
this._setLabels.forEach((k, P) => {
|
|
2530
|
+
I.has(P) || (k.remove(), this._setLabels.delete(P));
|
|
2531
|
+
}), Lt.forEach((k) => this._syncLabel(this._setLabels, k.pt.ID, k.spec, k.pt, J, k.mode, k.weight));
|
|
2532
|
+
}
|
|
2533
|
+
if ((js = s.points) != null && js.rows) {
|
|
2534
|
+
const I = this.__children__.search("__children__", "points");
|
|
2535
|
+
if (I) {
|
|
2536
|
+
s.points.rows().forEach((N) => {
|
|
2537
|
+
const S = h ? N.names.indexOf(h) : -1, y = S >= 0 ? String(N[S]) : null, O = y ? _[y] ?? "#888888" : "#888888";
|
|
2538
|
+
if (kt) {
|
|
2539
|
+
const v = _t(N, r, O, z);
|
|
2540
|
+
v.size = o.pointSize ?? 2.5, v.meta = {
|
|
2541
|
+
...v.meta ?? {},
|
|
2430
2542
|
stroke: "#ffffff",
|
|
2431
2543
|
kind: "point",
|
|
2432
|
-
name:
|
|
2433
|
-
group:
|
|
2434
|
-
unit:
|
|
2544
|
+
name: v.ID,
|
|
2545
|
+
group: y ?? void 0,
|
|
2546
|
+
unit: v.ID,
|
|
2435
2547
|
fixedSize: o.pointFixedSize
|
|
2436
|
-
}, this.__data__.points.set(
|
|
2548
|
+
}, this.__data__.points.set(v.ID, v), I.__data__.objects.set(v.ID, v);
|
|
2437
2549
|
}
|
|
2438
|
-
if (
|
|
2439
|
-
const
|
|
2440
|
-
|
|
2441
|
-
const
|
|
2442
|
-
|
|
2550
|
+
if (y) {
|
|
2551
|
+
const v = N.names.indexOf(n[0]), E = n.length > 1 ? N.names.indexOf(n[1]) : -1;
|
|
2552
|
+
Z[y] || (Z[y] = { x: 0, y: 0, x2: 0, y2: 0, xy: 0, n: 0, color: O });
|
|
2553
|
+
const F = v >= 0 ? Number(N[v]) : 0, U = E >= 0 ? Number(N[E]) : 0;
|
|
2554
|
+
Z[y].x += F, Z[y].y += U, Z[y].x2 += F * F, Z[y].y2 += U * U, Z[y].xy += F * U, Z[y].n += 1;
|
|
2443
2555
|
}
|
|
2444
2556
|
});
|
|
2445
|
-
const
|
|
2446
|
-
const
|
|
2447
|
-
return
|
|
2557
|
+
const k = !!((Ys = s.groups) != null && Ys.rows && s.groups.rows().length > 0), P = o.showMeans && k ? s.groups.rows().filter((N) => {
|
|
2558
|
+
const S = N.rowName ?? String(N[0]);
|
|
2559
|
+
return u.size === 0 || u.has(S);
|
|
2448
2560
|
}) : [];
|
|
2449
2561
|
if (o.showMeans) {
|
|
2450
|
-
const
|
|
2451
|
-
if (
|
|
2452
|
-
const
|
|
2453
|
-
this._ciRects.forEach((
|
|
2454
|
-
|
|
2455
|
-
}), this._outlierRects.forEach((
|
|
2456
|
-
|
|
2457
|
-
}), this._ciCross.forEach((
|
|
2458
|
-
|
|
2459
|
-
}), P.forEach((
|
|
2460
|
-
var
|
|
2461
|
-
const
|
|
2462
|
-
ID: `mean-${
|
|
2463
|
-
dimensions: [W,
|
|
2464
|
-
meta: { kind: "mean", name:
|
|
2562
|
+
const N = I.svg_element, S = this._rangeExtent ? this._rangeExtent / 1.2 : b, y = (S > 0 ? S : 1) * 8e-3;
|
|
2563
|
+
if (k) {
|
|
2564
|
+
const O = new Set(P.map((v) => v.rowName ?? String(v[0])));
|
|
2565
|
+
this._ciRects.forEach((v, E) => {
|
|
2566
|
+
O.has(E) || (v.remove(), this._ciRects.delete(E));
|
|
2567
|
+
}), this._outlierRects.forEach((v, E) => {
|
|
2568
|
+
O.has(E) || (v.remove(), this._outlierRects.delete(E));
|
|
2569
|
+
}), this._ciCross.forEach((v, E) => {
|
|
2570
|
+
O.has(E.slice(2)) || (v.remove(), this._ciCross.delete(E));
|
|
2571
|
+
}), P.forEach((v) => {
|
|
2572
|
+
var we, qt, $t;
|
|
2573
|
+
const E = v.rowName ?? String(v[0]), F = _[E] ?? "#888888", U = v.names.indexOf(n[0]), Y = n.length > 1 ? v.names.indexOf(n[1]) : -1, W = U >= 0 ? Number(v[U]) * z : 0, pt = Y >= 0 ? -Number(v[Y]) * z : 0, X = new K({
|
|
2574
|
+
ID: `mean-${E}`,
|
|
2575
|
+
dimensions: [W, pt],
|
|
2576
|
+
meta: { kind: "mean", name: E, group: E, fixedSize: o.meanFixedSize }
|
|
2465
2577
|
});
|
|
2466
|
-
|
|
2467
|
-
const
|
|
2468
|
-
|
|
2469
|
-
const
|
|
2470
|
-
const
|
|
2471
|
-
return
|
|
2472
|
-
}, "cell"),
|
|
2578
|
+
X.color = new st(F), X.size = 4;
|
|
2579
|
+
const rt = v.names.indexOf("shape"), R = rt >= 0 ? v[rt] : null;
|
|
2580
|
+
X.shape = R && String(R) !== "NA" ? String(R) : "rect", this.__data__.points.set(X.ID, X), I.__data__.objects.set(X.ID, X);
|
|
2581
|
+
const jt = /* @__PURE__ */ c((j) => {
|
|
2582
|
+
const x = v.names.indexOf(j), A = x >= 0 ? v[x] : null;
|
|
2583
|
+
return A == null || String(A) === "NA" || String(A) === "" ? null : A;
|
|
2584
|
+
}, "cell"), gt = jt("intervals"), St = gt === "box" || gt === "crosshairs" || gt === "none" ? gt : o.intervals, Rt = jt("outlier"), B = (Rt == null ? o.showOutlier : Rt === !0 || String(Rt) === "true") ? Ae(v, n[0], n[1], "o") : null;
|
|
2473
2585
|
if (!B)
|
|
2474
|
-
(
|
|
2586
|
+
(we = this._outlierRects.get(E)) == null || we.remove(), this._outlierRects.delete(E);
|
|
2475
2587
|
else {
|
|
2476
|
-
let
|
|
2477
|
-
|
|
2588
|
+
let j = this._outlierRects.get(E);
|
|
2589
|
+
j || (j = document.createElementNS("http://www.w3.org/2000/svg", "rect"), j.setAttribute("data-outlier-group", E), this._outlierRects.set(E, j)), j.setAttribute("x", (B.x_low * z).toString()), j.setAttribute("y", (-B.y_high * z).toString()), j.setAttribute("width", ((B.x_high - B.x_low) * z).toString()), j.setAttribute("height", ((B.y_high - B.y_low) * z).toString()), j.setAttribute("fill", "none"), j.setAttribute("stroke", F), j.setAttribute("stroke-width", y.toString()), j.setAttribute("stroke-opacity", "0.5"), j.setAttribute("stroke-dasharray", `${y * 2} ${y * 2}`), this._intervalStroke(j, y, [y * 2, y * 2]), N && !j.parentElement && N.insertBefore(j, N.firstChild);
|
|
2478
2590
|
}
|
|
2479
|
-
const
|
|
2480
|
-
if ((!
|
|
2481
|
-
(
|
|
2482
|
-
const
|
|
2483
|
-
|
|
2484
|
-
let
|
|
2485
|
-
|
|
2486
|
-
} else if (
|
|
2487
|
-
const
|
|
2488
|
-
|
|
2489
|
-
let
|
|
2490
|
-
|
|
2591
|
+
const nt = St !== "none" ? Ae(v, n[0], n[1]) : null, Yt = `x:${E}`;
|
|
2592
|
+
if ((!nt || St !== "crosshairs") && ((qt = this._ciCross.get(Yt)) == null || qt.remove(), this._ciCross.delete(Yt)), nt && St === "crosshairs") {
|
|
2593
|
+
($t = this._ciRects.get(E)) == null || $t.remove(), this._ciRects.delete(E);
|
|
2594
|
+
const j = nt.x_low * z, x = nt.x_high * z, A = -nt.y_high * z, C = -nt.y_low * z;
|
|
2595
|
+
ve(X, (x - j) / 2, (C - A) / 2);
|
|
2596
|
+
let M = this._ciCross.get(Yt);
|
|
2597
|
+
M || (M = document.createElementNS("http://www.w3.org/2000/svg", "path"), M.setAttribute("data-ci-group", E), M.setAttribute("data-ci-kind", "crosshairs"), this._ciCross.set(Yt, M)), M.setAttribute("d", `M${j} ${pt} L${x} ${pt} M${W} ${A} L${W} ${C}`), M.setAttribute("fill", "none"), M.setAttribute("stroke", F), M.setAttribute("stroke-width", (y * 1.25).toString()), this._intervalStroke(M, y * 1.25, null), M.setAttribute("stroke-opacity", "0.8"), N && !M.parentElement && N.insertBefore(M, N.firstChild);
|
|
2598
|
+
} else if (nt) {
|
|
2599
|
+
const j = nt.x_low * z, x = -nt.y_high * z, A = (nt.x_high - nt.x_low) * z, C = (nt.y_high - nt.y_low) * z;
|
|
2600
|
+
ve(X, A / 2, C / 2);
|
|
2601
|
+
let M = this._ciRects.get(E);
|
|
2602
|
+
M || (M = document.createElementNS("http://www.w3.org/2000/svg", "rect"), M.setAttribute("data-ci-group", E), this._ciRects.set(E, M)), M.setAttribute("x", j.toString()), M.setAttribute("y", x.toString()), M.setAttribute("width", A.toString()), M.setAttribute("height", C.toString()), M.setAttribute("fill", "none"), M.setAttribute("stroke", F), M.setAttribute("stroke-width", y.toString()), M.setAttribute("stroke-opacity", "0.8"), M.setAttribute("stroke-dasharray", `${y * 4} ${y * 3}`), this._intervalStroke(M, y, [y * 4, y * 3]), N && !M.parentElement && N.insertBefore(M, N.firstChild);
|
|
2491
2603
|
} else {
|
|
2492
|
-
const
|
|
2493
|
-
|
|
2604
|
+
const j = this._ciRects.get(E);
|
|
2605
|
+
j && (j.remove(), this._ciRects.delete(E));
|
|
2494
2606
|
}
|
|
2495
2607
|
});
|
|
2496
2608
|
} else
|
|
2497
|
-
Object.entries(
|
|
2498
|
-
const W = new
|
|
2499
|
-
ID: `mean-${
|
|
2500
|
-
dimensions: [
|
|
2501
|
-
meta: { kind: "mean", name:
|
|
2609
|
+
this._removeIntervals(this._ciCross), Object.entries(Z).forEach(([v, { x: E, y: F, n: U, color: Y }]) => {
|
|
2610
|
+
const W = new K({
|
|
2611
|
+
ID: `mean-${v}`,
|
|
2612
|
+
dimensions: [E / U * z, -(F / U) * z],
|
|
2613
|
+
meta: { kind: "mean", name: v, group: v, fixedSize: o.meanFixedSize }
|
|
2502
2614
|
});
|
|
2503
|
-
W.color = new st(
|
|
2504
|
-
}), o.showCI
|
|
2505
|
-
|
|
2506
|
-
}), (
|
|
2507
|
-
const
|
|
2508
|
-
if (!
|
|
2509
|
-
const
|
|
2510
|
-
if (!
|
|
2511
|
-
const W =
|
|
2512
|
-
|
|
2513
|
-
this.__data__.points.get(`mean-${
|
|
2514
|
-
|
|
2515
|
-
|
|
2615
|
+
W.color = new st(Y), W.size = 4, W.shape = "rect", this.__data__.points.set(W.ID, W), I.__data__.objects.set(W.ID, W);
|
|
2616
|
+
}), o.showCI ? (this._ciRects.forEach((v, E) => {
|
|
2617
|
+
Z[E] || (v.remove(), this._ciRects.delete(E));
|
|
2618
|
+
}), (qs = s.confidence) != null && qs.rows ? s.confidence.rows().forEach((v) => {
|
|
2619
|
+
const E = v.names.indexOf(h ?? "group"), F = E >= 0 ? String(v[E]) : v.rowName ?? null;
|
|
2620
|
+
if (!F) return;
|
|
2621
|
+
const U = _[F] ?? "#888888", Y = Ae(v, n[0], n[1]);
|
|
2622
|
+
if (!Y) return;
|
|
2623
|
+
const W = Y.x_low * z, pt = -Y.y_high * z, X = (Y.x_high - Y.x_low) * z, rt = (Y.y_high - Y.y_low) * z;
|
|
2624
|
+
ve(
|
|
2625
|
+
this.__data__.points.get(`mean-${F}`),
|
|
2626
|
+
X / 2,
|
|
2627
|
+
rt / 2
|
|
2516
2628
|
);
|
|
2517
|
-
let
|
|
2518
|
-
|
|
2519
|
-
}) : Object.entries(
|
|
2629
|
+
let R = this._ciRects.get(F);
|
|
2630
|
+
R || (R = document.createElementNS("http://www.w3.org/2000/svg", "rect"), R.setAttribute("data-ci-group", F), this._ciRects.set(F, R)), R.setAttribute("x", W.toString()), R.setAttribute("y", pt.toString()), R.setAttribute("width", X.toString()), R.setAttribute("height", rt.toString()), R.setAttribute("fill", "none"), R.setAttribute("stroke", U), R.setAttribute("stroke-width", y.toString()), R.setAttribute("stroke-opacity", "0.8"), R.setAttribute("stroke-dasharray", `${y * 4} ${y * 3}`), this._intervalStroke(R, y, [y * 4, y * 3]), N && !R.parentElement && N.insertBefore(R, N.firstChild);
|
|
2631
|
+
}) : Object.entries(Z).forEach(([v, { x: E, y: F, x2: U, y2: Y, n: W, color: pt }]) => {
|
|
2520
2632
|
if (W < 2) return;
|
|
2521
|
-
const
|
|
2522
|
-
|
|
2523
|
-
this.__data__.points.get(`mean-${
|
|
2524
|
-
|
|
2525
|
-
|
|
2633
|
+
const X = E / W, rt = F / W, R = U / W - X * X, jt = Y / W - rt * rt, { halfW: gt, halfH: St } = Di(R, jt, W, z), Rt = X * z, ie = -rt * z;
|
|
2634
|
+
ve(
|
|
2635
|
+
this.__data__.points.get(`mean-${v}`),
|
|
2636
|
+
gt,
|
|
2637
|
+
St
|
|
2526
2638
|
);
|
|
2527
|
-
let B = this._ciRects.get(
|
|
2528
|
-
B || (B = document.createElementNS("http://www.w3.org/2000/svg", "rect"), B.setAttribute("data-ci-group",
|
|
2529
|
-
})), (
|
|
2530
|
-
|
|
2531
|
-
}), s.outlier.rows().forEach((
|
|
2532
|
-
const
|
|
2533
|
-
if (!
|
|
2534
|
-
const
|
|
2535
|
-
if (!
|
|
2536
|
-
const W =
|
|
2537
|
-
let
|
|
2538
|
-
|
|
2539
|
-
}));
|
|
2639
|
+
let B = this._ciRects.get(v);
|
|
2640
|
+
B || (B = document.createElementNS("http://www.w3.org/2000/svg", "rect"), B.setAttribute("data-ci-group", v), this._ciRects.set(v, B)), B.setAttribute("x", (Rt - gt).toString()), B.setAttribute("y", (ie - St).toString()), B.setAttribute("width", (gt * 2).toString()), B.setAttribute("height", (St * 2).toString()), B.setAttribute("fill", "none"), B.setAttribute("stroke", pt), B.setAttribute("stroke-width", y.toString()), B.setAttribute("stroke-opacity", "0.8"), B.setAttribute("stroke-dasharray", `${y * 4} ${y * 3}`), this._intervalStroke(B, y, [y * 4, y * 3]), N && !B.parentElement && N.insertBefore(B, N.firstChild);
|
|
2641
|
+
})) : this._removeIntervals(this._ciRects), (Bs = s.outlier) != null && Bs.rows ? (this._outlierRects.forEach((v, E) => {
|
|
2642
|
+
_[E] || (v.remove(), this._outlierRects.delete(E));
|
|
2643
|
+
}), s.outlier.rows().forEach((v) => {
|
|
2644
|
+
const E = v.names.indexOf(h ?? "group"), F = E >= 0 ? String(v[E]) : v.rowName ?? null;
|
|
2645
|
+
if (!F) return;
|
|
2646
|
+
const U = _[F] ?? "#888888", Y = Ae(v, n[0], n[1]);
|
|
2647
|
+
if (!Y) return;
|
|
2648
|
+
const W = Y.x_low * z, pt = -Y.y_high * z, X = (Y.x_high - Y.x_low) * z, rt = (Y.y_high - Y.y_low) * z;
|
|
2649
|
+
let R = this._outlierRects.get(F);
|
|
2650
|
+
R || (R = document.createElementNS("http://www.w3.org/2000/svg", "rect"), R.setAttribute("data-outlier-group", F), this._outlierRects.set(F, R)), R.setAttribute("x", W.toString()), R.setAttribute("y", pt.toString()), R.setAttribute("width", X.toString()), R.setAttribute("height", rt.toString()), R.setAttribute("fill", "none"), R.setAttribute("stroke", U), R.setAttribute("stroke-width", y.toString()), R.setAttribute("stroke-opacity", "0.5"), R.setAttribute("stroke-dasharray", `${y * 2} ${y * 2}`), this._intervalStroke(R, y, [y * 2, y * 2]), N && !R.parentElement && N.insertBefore(R, N.firstChild);
|
|
2651
|
+
})) : this._removeIntervals(this._outlierRects);
|
|
2652
|
+
} else
|
|
2653
|
+
[this._ciRects, this._outlierRects, this._ciCross].forEach((N) => this._removeIntervals(N));
|
|
2654
|
+
if (J) {
|
|
2655
|
+
this._pointLabels.forEach((y, O) => {
|
|
2656
|
+
I.__data__.objects.get(O) || (y.remove(), this._pointLabels.delete(O));
|
|
2657
|
+
}), this._meanLabels.forEach((y, O) => {
|
|
2658
|
+
I.__data__.objects.get(`mean-${O}`) || (y.remove(), this._meanLabels.delete(O));
|
|
2659
|
+
}), ct !== 0 ? s.points.rows().forEach((y) => {
|
|
2660
|
+
const O = y.names.indexOf(r), v = O >= 0 ? String(y[O]) : null;
|
|
2661
|
+
if (!v) return;
|
|
2662
|
+
const E = I.__data__.objects.get(v);
|
|
2663
|
+
E && this._syncLabel(
|
|
2664
|
+
this._pointLabels,
|
|
2665
|
+
v,
|
|
2666
|
+
Se(null, v),
|
|
2667
|
+
E,
|
|
2668
|
+
J,
|
|
2669
|
+
ct,
|
|
2670
|
+
o.labelWeightPoints
|
|
2671
|
+
);
|
|
2672
|
+
}) : this._clearLabels(this._pointLabels);
|
|
2673
|
+
const N = new Map(
|
|
2674
|
+
P.map((y) => [y.rowName ?? String(y[0]), y])
|
|
2675
|
+
);
|
|
2676
|
+
(k ? [...N.keys()] : Object.keys(Z)).forEach((y) => {
|
|
2677
|
+
const O = `mean-${y}`, v = I.__data__.objects.get(O);
|
|
2678
|
+
v && this._syncLabel(
|
|
2679
|
+
this._meanLabels,
|
|
2680
|
+
y,
|
|
2681
|
+
Se(N.get(y), y),
|
|
2682
|
+
v,
|
|
2683
|
+
J,
|
|
2684
|
+
lt,
|
|
2685
|
+
o.labelWeightMeans
|
|
2686
|
+
);
|
|
2687
|
+
});
|
|
2540
2688
|
}
|
|
2541
|
-
|
|
2542
|
-
C.__data__.objects.get(b) || (y.remove(), this._pointLabels.delete(b));
|
|
2543
|
-
}), this._meanLabels.forEach((y, b) => {
|
|
2544
|
-
C.__data__.objects.get(`mean-${b}`) || (y.remove(), this._meanLabels.delete(b));
|
|
2545
|
-
}), ot !== 0 && s.points.rows().forEach((y) => {
|
|
2546
|
-
const b = y.names.indexOf(r), S = b >= 0 ? String(y[b]) : null;
|
|
2547
|
-
if (!S) return;
|
|
2548
|
-
const $ = C.__data__.objects.get(S);
|
|
2549
|
-
if (!$) return;
|
|
2550
|
-
const p = S;
|
|
2551
|
-
let w = this._pointLabels.get(S);
|
|
2552
|
-
w ? ot === U.DISPLAY_TYPES.ON ? w.show() : w.hide() : (w = new Jt(p, $, it, this, ot), this._pointLabels.set(S, w));
|
|
2553
|
-
}), nt !== 0 && (I ? P.map((b) => b.rowName ?? String(b[0])) : Object.keys(K)).forEach((b) => {
|
|
2554
|
-
const S = `mean-${b}`, $ = C.__data__.objects.get(S);
|
|
2555
|
-
if (!$) return;
|
|
2556
|
-
let p = this._meanLabels.get(b);
|
|
2557
|
-
p ? nt === U.DISPLAY_TYPES.ON ? p.show() : p.hide() : (p = new Jt(b, $, it, this, nt), this._meanLabels.set(b, p));
|
|
2558
|
-
})), C.__data__.__state__.setVariable("layer_updated", C.__data__);
|
|
2689
|
+
I.__data__.__state__.setVariable("layer_updated", I.__data__);
|
|
2559
2690
|
}
|
|
2691
|
+
} else {
|
|
2692
|
+
const I = this.__children__.search("__children__", "points");
|
|
2693
|
+
I == null || I.__data__.__state__.setVariable("layer_updated", I.__data__);
|
|
2560
2694
|
}
|
|
2561
|
-
const
|
|
2562
|
-
if (o.showTrajectories &&
|
|
2563
|
-
|
|
2564
|
-
const
|
|
2565
|
-
if (
|
|
2566
|
-
const
|
|
2567
|
-
|
|
2568
|
-
const
|
|
2569
|
-
if (P && !P.includes(
|
|
2570
|
-
const
|
|
2571
|
-
|
|
2572
|
-
x: Number(
|
|
2573
|
-
y: -Number(
|
|
2574
|
-
time:
|
|
2695
|
+
const vt = this.__children__.search("__children__", "trajectories");
|
|
2696
|
+
if (o.showTrajectories && vt) {
|
|
2697
|
+
vt.__data__.objects.clear(), this.__data__.trajectories.clear();
|
|
2698
|
+
const I = (Gs = s.trajectories) != null && Gs.rows ? s.trajectories : s.points;
|
|
2699
|
+
if (I != null && I.rows) {
|
|
2700
|
+
const k = {}, P = o.trajectoryUnits ? o.trajectoryUnits.split(",").map((S) => S.trim()) : null;
|
|
2701
|
+
I.rows().forEach((S) => {
|
|
2702
|
+
const y = S.names.indexOf(r) >= 0 ? S.names.indexOf(r) : S.names.indexOf("unit") >= 0 ? S.names.indexOf("unit") : S.names.indexOf("ENA_UNIT") >= 0 ? S.names.indexOf("ENA_UNIT") : -1, O = y >= 0 ? String(S[y]) : S.rowName || "unit-1";
|
|
2703
|
+
if (P && !P.includes(O)) return;
|
|
2704
|
+
const v = S.names.indexOf(n[0]), E = n.length > 1 ? S.names.indexOf(n[1]) : -1, F = S.names.indexOf("time") >= 0 ? S.names.indexOf("time") : S.names.indexOf("ActivityNumber") >= 0 ? S.names.indexOf("ActivityNumber") : S.names.indexOf("RowID") >= 0 ? S.names.indexOf("RowID") : -1, U = F >= 0 ? Number(S[F]) : k[O] ? k[O].length + 1 : 1;
|
|
2705
|
+
v >= 0 && E >= 0 && (k[O] || (k[O] = []), k[O].push({
|
|
2706
|
+
x: Number(S[v]) * z,
|
|
2707
|
+
y: -Number(S[E]) * z,
|
|
2708
|
+
time: U
|
|
2575
2709
|
}));
|
|
2576
|
-
}), Object.keys(
|
|
2577
|
-
const
|
|
2578
|
-
if (
|
|
2579
|
-
const
|
|
2580
|
-
ID: `traj-${
|
|
2581
|
-
unitId:
|
|
2582
|
-
color: new st(
|
|
2710
|
+
}), Object.keys(k).forEach((S, y) => {
|
|
2711
|
+
const O = k[S];
|
|
2712
|
+
if (O.length === 0) return;
|
|
2713
|
+
const v = m[y % m.length], E = new Oe({
|
|
2714
|
+
ID: `traj-${S}`,
|
|
2715
|
+
unitId: S,
|
|
2716
|
+
color: new st(v),
|
|
2583
2717
|
lineStyle: o.trajectoryLineStyle,
|
|
2584
2718
|
strokeWidth: o.trajectoryStrokeWidth,
|
|
2585
2719
|
strokeWidthRange: o.trajectoryStrokeWidthRange,
|
|
@@ -2590,213 +2724,233 @@ const gt = class gt extends ve {
|
|
|
2590
2724
|
currentTime: o.trajectoryPlayhead ?? 1 / 0,
|
|
2591
2725
|
showPoints: o.trajectoryShowPoints,
|
|
2592
2726
|
showTips: o.trajectoryShowTips,
|
|
2593
|
-
points:
|
|
2727
|
+
points: O.map((F) => ({ x: F.x, y: F.y, time: F.time }))
|
|
2594
2728
|
});
|
|
2595
|
-
this.__data__.trajectories.set(
|
|
2729
|
+
this.__data__.trajectories.set(S, E), vt.__data__.objects.set(E.ID, E);
|
|
2596
2730
|
});
|
|
2597
2731
|
}
|
|
2598
|
-
|
|
2732
|
+
vt.__data__.__state__.setVariable("layer_updated", vt.__data__);
|
|
2599
2733
|
}
|
|
2600
|
-
const
|
|
2601
|
-
if ((
|
|
2602
|
-
if (s.nodes.rows().forEach((
|
|
2603
|
-
const P =
|
|
2734
|
+
const At = this.__children__.search("__children__", "network"), xe = At == null ? void 0 : At.__children__.search("__children__", "edges"), it = At == null ? void 0 : At.__children__.search("__children__", "nodes"), ks = At == null ? void 0 : At.__children__.search("__children__", "edgenodes"), di = o.showEdges;
|
|
2735
|
+
if ((Us = s.nodes) != null && Us.rows && it) {
|
|
2736
|
+
if (s.nodes.rows().forEach((k) => {
|
|
2737
|
+
const P = _t(k, a, "#444444");
|
|
2604
2738
|
P.size = 2;
|
|
2605
|
-
const
|
|
2739
|
+
const N = k.names.indexOf("label"), S = N >= 0 ? k[N] : null, y = k.names.indexOf("size"), O = y >= 0 && k[y] != null && k[y] !== "" ? Number(k[y]) : NaN;
|
|
2606
2740
|
P.meta = {
|
|
2607
2741
|
...P.meta ?? {},
|
|
2608
2742
|
kind: "node",
|
|
2609
|
-
name:
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
return x >= 0 ? String(f[x]) : "";
|
|
2620
|
-
}).filter(Boolean), y = [];
|
|
2621
|
-
(s.edges.names ?? []).forEach((f) => {
|
|
2622
|
-
const x = Mi(f, P);
|
|
2623
|
-
x && y.push({ col: f, pair: x });
|
|
2743
|
+
name: S != null && String(S) !== "NA" && String(S) !== "" ? String(S) : P.ID,
|
|
2744
|
+
sizePx: Number.isFinite(O) && O > 0 ? O : void 0,
|
|
2745
|
+
// <qe-nodes fixed-size>: constant on-screen size at any zoom.
|
|
2746
|
+
zoomFixed: o.nodeFixedSize || void 0
|
|
2747
|
+
}, it.__data__.objects.set(P.ID, P);
|
|
2748
|
+
}), di && xe) {
|
|
2749
|
+
const k = {};
|
|
2750
|
+
h && ((Xs = s.points) != null && Xs.rows) && s.points.rows().forEach((x) => {
|
|
2751
|
+
const A = x.names.indexOf(r), C = x.names.indexOf(h);
|
|
2752
|
+
A >= 0 && C >= 0 && (k[String(x[A])] = String(x[C]));
|
|
2624
2753
|
});
|
|
2625
|
-
const
|
|
2626
|
-
const
|
|
2627
|
-
return
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2754
|
+
const P = s.nodes.rows().map((x) => {
|
|
2755
|
+
const A = x.names.indexOf(a);
|
|
2756
|
+
return A >= 0 ? String(x[A]) : "";
|
|
2757
|
+
}).filter(Boolean), N = /* @__PURE__ */ c((x) => {
|
|
2758
|
+
const A = [];
|
|
2759
|
+
return x.forEach((C) => {
|
|
2760
|
+
const M = Fi(C, P);
|
|
2761
|
+
M && A.push({ col: C, pair: M });
|
|
2762
|
+
}), A;
|
|
2763
|
+
}, "parsePairs"), S = (Ws = s.edges) != null && Ws.rows ? s.edges.rows() : [], y = s.networks, O = N(((Hs = s.edges) == null ? void 0 : Hs.names) ?? []), v = N((y == null ? void 0 : y.names) ?? []), E = /* @__PURE__ */ c((x) => {
|
|
2764
|
+
const A = {};
|
|
2765
|
+
return S.forEach((C) => {
|
|
2766
|
+
const M = C.names.indexOf(r);
|
|
2767
|
+
M < 0 || String(C[M]) !== x || O.forEach(({ col: T }) => {
|
|
2768
|
+
const H = C.names.indexOf(T);
|
|
2769
|
+
H >= 0 && (A[T] = Number(C[H]) || 0);
|
|
2632
2770
|
});
|
|
2633
|
-
}),
|
|
2634
|
-
}, "getUnitEdges"),
|
|
2635
|
-
const
|
|
2636
|
-
let
|
|
2637
|
-
if (
|
|
2638
|
-
const
|
|
2639
|
-
(
|
|
2640
|
-
const
|
|
2641
|
-
if (
|
|
2642
|
-
const V = Number(T[
|
|
2643
|
-
isNaN(V) || (
|
|
2771
|
+
}), A;
|
|
2772
|
+
}, "getUnitEdges"), F = /* @__PURE__ */ c((x) => {
|
|
2773
|
+
const A = {};
|
|
2774
|
+
let C = 0;
|
|
2775
|
+
if (S.forEach((T) => {
|
|
2776
|
+
const H = T.names.indexOf(r), ut = H >= 0 ? String(T[H]) : null, mt = h ? T.names.indexOf(h) : -1;
|
|
2777
|
+
(mt >= 0 ? String(T[mt]) : ut ? k[ut] : null) === x && (C++, O.forEach(({ col: bt }) => {
|
|
2778
|
+
const ft = T.names.indexOf(bt);
|
|
2779
|
+
if (ft >= 0) {
|
|
2780
|
+
const V = Number(T[ft]);
|
|
2781
|
+
isNaN(V) || (A[bt] = (A[bt] ?? 0) + V);
|
|
2644
2782
|
}
|
|
2645
2783
|
}));
|
|
2646
|
-
}),
|
|
2647
|
-
const
|
|
2648
|
-
return
|
|
2649
|
-
|
|
2650
|
-
}),
|
|
2651
|
-
}, "getGroupEdges"),
|
|
2652
|
-
if (
|
|
2653
|
-
return { weights:
|
|
2654
|
-
const
|
|
2655
|
-
return { weights:
|
|
2656
|
-
}, "resolve"),
|
|
2657
|
-
var
|
|
2658
|
-
const
|
|
2659
|
-
if (!
|
|
2660
|
-
const
|
|
2661
|
-
return
|
|
2662
|
-
const
|
|
2663
|
-
if (
|
|
2664
|
-
const
|
|
2665
|
-
Number.isFinite(
|
|
2784
|
+
}), C === 0) return {};
|
|
2785
|
+
const M = {};
|
|
2786
|
+
return O.forEach(({ col: T }) => {
|
|
2787
|
+
M[T] = (A[T] ?? 0) / C;
|
|
2788
|
+
}), M;
|
|
2789
|
+
}, "getGroupEdges"), U = /* @__PURE__ */ c((x) => {
|
|
2790
|
+
if (_[x])
|
|
2791
|
+
return { weights: F(x), color: _[x], label: x };
|
|
2792
|
+
const A = k[x] ?? null, C = A ? _[A] ?? "#888888" : "#888888";
|
|
2793
|
+
return { weights: E(x), color: C, label: x };
|
|
2794
|
+
}, "resolve"), Y = [], W = /* @__PURE__ */ c((x) => {
|
|
2795
|
+
var M;
|
|
2796
|
+
const A = (M = y == null ? void 0 : y.rows) == null ? void 0 : M.call(y).find((T) => T.rowName === x);
|
|
2797
|
+
if (!A) return null;
|
|
2798
|
+
const C = {};
|
|
2799
|
+
return v.forEach(({ col: T }) => {
|
|
2800
|
+
const H = A.names.indexOf(T);
|
|
2801
|
+
if (H >= 0) {
|
|
2802
|
+
const ut = Number(A[H]);
|
|
2803
|
+
Number.isFinite(ut) && (C[T] = ut);
|
|
2666
2804
|
}
|
|
2667
|
-
}),
|
|
2668
|
-
}, "networkRow"),
|
|
2669
|
-
if (!
|
|
2670
|
-
const
|
|
2671
|
-
return
|
|
2805
|
+
}), C;
|
|
2806
|
+
}, "networkRow"), pt = /* @__PURE__ */ c((x, A) => {
|
|
2807
|
+
if (!A) return x;
|
|
2808
|
+
const C = Math.abs(x);
|
|
2809
|
+
return C < A[0] ? 0 : C > A[1] ? Math.sign(x) * A[1] : x;
|
|
2672
2810
|
}, "thresholded");
|
|
2673
|
-
o.edgeLayers.forEach((
|
|
2674
|
-
const
|
|
2675
|
-
Q =
|
|
2676
|
-
}, "push"),
|
|
2677
|
-
if (
|
|
2678
|
-
const V =
|
|
2811
|
+
o.edgeLayers.forEach((x, A) => {
|
|
2812
|
+
const C = /* @__PURE__ */ c((V, ot, Q, wt, at) => {
|
|
2813
|
+
Q = pt(Q, x.threshold), !(Math.abs(Q) < 1e-6) && Y.push({ col: `${A}:${V}`, pair: ot, weight: Math.abs(Q), color: wt, layer: A, ...at });
|
|
2814
|
+
}, "push"), M = /* @__PURE__ */ c((V, ot) => x.colors ? [x.colors[0], x.colors[1] ?? Bi(x.colors[0])] : [V, ot], "signColors");
|
|
2815
|
+
if (x.network) {
|
|
2816
|
+
const V = W(x.network);
|
|
2679
2817
|
if (!V) return;
|
|
2680
|
-
const [
|
|
2681
|
-
|
|
2682
|
-
const
|
|
2683
|
-
|
|
2818
|
+
const [ot, Q] = M(m[0], m[1]), wt = { name: x.name ?? x.network };
|
|
2819
|
+
v.forEach(({ col: at, pair: Vs }) => {
|
|
2820
|
+
const ne = V[at] ?? 0;
|
|
2821
|
+
C(at, Vs, ne, ne >= 0 ? ot : Q, wt);
|
|
2684
2822
|
});
|
|
2685
2823
|
return;
|
|
2686
2824
|
}
|
|
2687
|
-
const T =
|
|
2825
|
+
const T = x.unit ?? x.group ?? null;
|
|
2688
2826
|
if (!T) return;
|
|
2689
|
-
const
|
|
2690
|
-
|
|
2691
|
-
const Q = (
|
|
2692
|
-
|
|
2693
|
-
}) :
|
|
2694
|
-
const Q =
|
|
2695
|
-
Q > 0 &&
|
|
2696
|
-
}) :
|
|
2697
|
-
const Q =
|
|
2698
|
-
Q > 0 &&
|
|
2827
|
+
const H = U(T), ut = x.compare ?? x.also ?? null, mt = ut ? U(ut) : null, Et = { name: x.name ?? T, group: x.group ?? void 0, unit: x.unit ?? void 0 }, [bt, ft] = M(H.color, (mt == null ? void 0 : mt.color) ?? H.color);
|
|
2828
|
+
mt && x.compare ? O.forEach(({ col: V, pair: ot }) => {
|
|
2829
|
+
const Q = (H.weights[V] ?? 0) - (mt.weights[V] ?? 0);
|
|
2830
|
+
C(V, ot, Q, Q > 0 ? bt : ft, Et);
|
|
2831
|
+
}) : mt && x.also ? O.forEach(({ col: V, pair: ot }) => {
|
|
2832
|
+
const Q = H.weights[V] ?? 0, wt = mt.weights[V] ?? 0;
|
|
2833
|
+
Q > 0 && C(V + "-a", ot, Q, bt, Et), wt > 0 && C(V + "-b", ot, wt, ft, { ...Et, name: x.also ?? void 0, group: x.also ?? void 0 });
|
|
2834
|
+
}) : O.forEach(({ col: V, pair: ot }) => {
|
|
2835
|
+
const Q = H.weights[V] ?? 0;
|
|
2836
|
+
Q > 0 && C(V, ot, Q, bt, Et);
|
|
2699
2837
|
});
|
|
2700
|
-
}),
|
|
2701
|
-
const
|
|
2702
|
-
const
|
|
2703
|
-
return
|
|
2704
|
-
}, "rangeOf"),
|
|
2705
|
-
const
|
|
2706
|
-
return
|
|
2707
|
-
if (
|
|
2708
|
-
const T =
|
|
2709
|
-
if (T) for (const
|
|
2710
|
-
}),
|
|
2711
|
-
}, "modelRange"),
|
|
2712
|
-
if (
|
|
2713
|
-
const T = Math.min(1, Math.abs(
|
|
2838
|
+
}), Y.sort((x, A) => A.weight - x.weight);
|
|
2839
|
+
const X = !!s.directed, rt = Pi(o.edgeWidth) * (o.edgeMagnify ?? 1), R = /* @__PURE__ */ c((x) => {
|
|
2840
|
+
const A = x.map(Math.abs).filter((C) => C > 0);
|
|
2841
|
+
return A.length ? [Math.min(...A), Math.max(...A)] : [0, 0];
|
|
2842
|
+
}, "rangeOf"), [jt, gt] = S.length ? [O, s.edges] : [v, y], St = /* @__PURE__ */ c((x) => {
|
|
2843
|
+
const A = [];
|
|
2844
|
+
return jt.forEach(({ col: C, pair: M }) => {
|
|
2845
|
+
if (M[0] === M[1] !== x) return;
|
|
2846
|
+
const T = gt == null ? void 0 : gt.col(C);
|
|
2847
|
+
if (T) for (const H of T) A.push(Number(H));
|
|
2848
|
+
}), R(A);
|
|
2849
|
+
}, "modelRange"), Rt = /* @__PURE__ */ c((x) => R(Y.filter((A) => A.pair[0] === A.pair[1] === x).map((A) => A.weight)), "plotRange"), ie = o.edgeColorScale, B = /* @__PURE__ */ c((x) => ie === "plot" ? Rt(x) : St(x), "colourRange"), nt = B(!1), Yt = B(!0), we = /* @__PURE__ */ c((x, A) => {
|
|
2850
|
+
if (ie === "absolute") {
|
|
2851
|
+
const T = Math.min(1, Math.abs(x));
|
|
2714
2852
|
return { saturation: T, opacity: T };
|
|
2715
2853
|
}
|
|
2716
|
-
const [
|
|
2717
|
-
return { saturation:
|
|
2718
|
-
}, "colourOf"),
|
|
2719
|
-
|
|
2720
|
-
if (
|
|
2721
|
-
const
|
|
2722
|
-
|
|
2854
|
+
const [C, M] = A ? Yt : nt;
|
|
2855
|
+
return { saturation: ni(x, C, M, Mi), opacity: ni(x, C, M, Ii) };
|
|
2856
|
+
}, "colourOf"), qt = {};
|
|
2857
|
+
Y.forEach(({ pair: x, weight: A }) => {
|
|
2858
|
+
if (x[0] === x[1] && !X) return;
|
|
2859
|
+
const M = /* @__PURE__ */ c((T) => {
|
|
2860
|
+
qt[T] = (qt[T] ?? 0) + Math.abs(A);
|
|
2723
2861
|
}, "add");
|
|
2724
|
-
if (
|
|
2725
|
-
|
|
2862
|
+
if (X) {
|
|
2863
|
+
M(x[1]);
|
|
2726
2864
|
return;
|
|
2727
2865
|
}
|
|
2728
|
-
|
|
2729
|
-
}), s.nodes.rows().forEach((
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2866
|
+
M(x[0]), M(x[1]);
|
|
2867
|
+
}), s.nodes.rows().forEach((x) => {
|
|
2868
|
+
var ut;
|
|
2869
|
+
const A = x.names.indexOf(a), C = A >= 0 ? String(x[A]) : "";
|
|
2870
|
+
if (!C) return;
|
|
2871
|
+
const M = it.__data__.objects.get(C);
|
|
2872
|
+
if (!M) return;
|
|
2873
|
+
const T = qt[C] ?? 0, H = !(T > 0);
|
|
2874
|
+
M.size = H ? o.hideUnconnectedNodes ? 0 : Oi : Li(T, rt), M.meta = {
|
|
2875
|
+
...M.meta ?? {},
|
|
2876
|
+
hidden: H && o.hideUnconnectedNodes,
|
|
2877
|
+
sizePx: H || (ut = M.meta) == null ? void 0 : ut.sizePx
|
|
2738
2878
|
};
|
|
2739
2879
|
});
|
|
2740
|
-
const $t = {},
|
|
2741
|
-
|
|
2742
|
-
const T =
|
|
2743
|
-
$t[T] = ($t[T] ?? 0) +
|
|
2744
|
-
}),
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2880
|
+
const $t = {}, j = /* @__PURE__ */ c((x, A, C, M) => `${x}:${A ?? ""}:${C}.${M}`, "pairKey");
|
|
2881
|
+
X && Y.forEach(({ pair: x, weight: A, layer: C, name: M }) => {
|
|
2882
|
+
const T = j(C, M, x[0], x[1]);
|
|
2883
|
+
$t[T] = ($t[T] ?? 0) + A;
|
|
2884
|
+
}), Y.forEach(({ col: x, pair: A, weight: C, color: M, layer: T, name: H, group: ut, unit: mt }) => {
|
|
2885
|
+
var ne, Zs;
|
|
2886
|
+
const Et = it.__data__.objects.get(A[0]), bt = it.__data__.objects.get(A[1]);
|
|
2887
|
+
if (!Et || !bt) return;
|
|
2888
|
+
const ft = A[0] === A[1];
|
|
2889
|
+
if (ft && !X) return;
|
|
2890
|
+
const { saturation: V, opacity: ot } = we(C, ft), Q = new K({ ID: `${A[0]}-src`, dimensions: [Et.x, Et.y], meta: {} }), wt = new K({ ID: `${A[1]}-dst`, dimensions: [bt.x, bt.y], meta: {} });
|
|
2891
|
+
let at;
|
|
2892
|
+
if (ft)
|
|
2893
|
+
at = new Ht({}, Q, wt), at.weight = 0;
|
|
2894
|
+
else if (X) {
|
|
2895
|
+
const gi = $t[j(T, H, A[0], A[1])] ?? C, mi = $t[j(T, H, A[1], A[0])] ?? 0, fi = gi + mi;
|
|
2896
|
+
at = new os(
|
|
2897
|
+
{ weight: C, totalweight: fi },
|
|
2757
2898
|
Q,
|
|
2758
2899
|
wt
|
|
2759
2900
|
);
|
|
2760
2901
|
} else
|
|
2761
|
-
|
|
2762
|
-
|
|
2902
|
+
at = new te({}, Q, wt);
|
|
2903
|
+
at.ID = `edge-${x}`, at.color = new st(M), at.meta = {
|
|
2763
2904
|
isMeanEdge: !0,
|
|
2764
|
-
weight:
|
|
2905
|
+
weight: C,
|
|
2765
2906
|
// Width per unit weight (extent units), shared by all marks.
|
|
2766
|
-
widthFrac:
|
|
2907
|
+
widthFrac: rt,
|
|
2767
2908
|
saturation: V,
|
|
2768
|
-
opacity:
|
|
2769
|
-
isDirected:
|
|
2770
|
-
isSelf:
|
|
2909
|
+
opacity: ot,
|
|
2910
|
+
isDirected: X,
|
|
2911
|
+
isSelf: ft,
|
|
2771
2912
|
// Identity for the qe-edge-* interaction events.
|
|
2772
|
-
source:
|
|
2773
|
-
target:
|
|
2774
|
-
group:
|
|
2775
|
-
unit:
|
|
2776
|
-
layer:
|
|
2777
|
-
|
|
2778
|
-
|
|
2913
|
+
source: A[0],
|
|
2914
|
+
target: A[1],
|
|
2915
|
+
group: ut,
|
|
2916
|
+
unit: mt,
|
|
2917
|
+
layer: H,
|
|
2918
|
+
// <qe-edges self-size>: self dot radius as a fraction of its node's.
|
|
2919
|
+
selfSize: ft ? ((ne = o.edgeLayers[T]) == null ? void 0 : ne.selfSize) ?? void 0 : void 0,
|
|
2920
|
+
// <qe-edges fixed-size>: thickness keeps its zoom-1 on-screen size.
|
|
2921
|
+
fixedSize: ((Zs = o.edgeLayers[T]) == null ? void 0 : Zs.fixedSize) || void 0
|
|
2922
|
+
}, (ft ? ks ?? xe : xe).__data__.objects.set(at.ID, at);
|
|
2923
|
+
});
|
|
2779
2924
|
}
|
|
2780
|
-
const
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
}), s.nodes.rows().forEach((
|
|
2784
|
-
var
|
|
2785
|
-
const P =
|
|
2786
|
-
if (!
|
|
2787
|
-
const
|
|
2788
|
-
if (
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2925
|
+
const I = o.showNodes;
|
|
2926
|
+
it.svg_element && (it.svg_element.style.display = I ? "" : "none"), I || this._clearLabels(this._nodeLabels), J && I && (this._nodeLabels.forEach((k, P) => {
|
|
2927
|
+
it.__data__.objects.get(P) || (k.remove(), this._nodeLabels.delete(P));
|
|
2928
|
+
}), s.nodes.rows().forEach((k) => {
|
|
2929
|
+
var y, O, v;
|
|
2930
|
+
const P = k.names.indexOf(a), N = P >= 0 ? String(k[P]) : "";
|
|
2931
|
+
if (!N) return;
|
|
2932
|
+
const S = it.__data__.objects.get(N);
|
|
2933
|
+
if (S) {
|
|
2934
|
+
if ((y = S.meta) != null && y.hidden) {
|
|
2935
|
+
(O = this._nodeLabels.get(N)) == null || O.remove(), this._nodeLabels.delete(N);
|
|
2936
|
+
return;
|
|
2937
|
+
}
|
|
2938
|
+
this._syncLabel(
|
|
2939
|
+
this._nodeLabels,
|
|
2940
|
+
N,
|
|
2941
|
+
Se(k, String(((v = S.meta) == null ? void 0 : v.name) ?? N)),
|
|
2942
|
+
S,
|
|
2943
|
+
J,
|
|
2944
|
+
D,
|
|
2945
|
+
o.labelWeightNodes
|
|
2946
|
+
);
|
|
2792
2947
|
}
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
ws && this.__data__.__state__.setVariable("graph_updated_axis_points", ws.__data__.objects), As && this.__data__.__state__.setVariable("graph_updated_axis_lines", As.__data__.objects), this.update(), i && this._runTween(i);
|
|
2948
|
+
})), it.__data__.__state__.setVariable("layer_updated", it.__data__);
|
|
2949
|
+
} else
|
|
2950
|
+
it == null || it.__data__.__state__.setVariable("layer_updated", it.__data__);
|
|
2951
|
+
[xe, ks].forEach((I) => I == null ? void 0 : I.__data__.__state__.setVariable("layer_updated", I.__data__));
|
|
2952
|
+
const zs = this.__children__.search("__children__", "axis_points"), Cs = this.__children__.search("__children__", "axis_lines");
|
|
2953
|
+
zs && this.__data__.__state__.setVariable("graph_updated_axis_points", zs.__data__.objects), Cs && this.__data__.__state__.setVariable("graph_updated_axis_lines", Cs.__data__.objects), this.update(), i && this._startTween(i);
|
|
2800
2954
|
});
|
|
2801
2955
|
}
|
|
2802
2956
|
static get observedAttributes() {
|
|
@@ -2807,6 +2961,7 @@ const gt = class gt extends ve {
|
|
|
2807
2961
|
"scale-points",
|
|
2808
2962
|
"point-scale",
|
|
2809
2963
|
"center",
|
|
2964
|
+
"view-padding",
|
|
2810
2965
|
"labels",
|
|
2811
2966
|
"label-nodes",
|
|
2812
2967
|
"label-means",
|
|
@@ -2816,12 +2971,60 @@ const gt = class gt extends ve {
|
|
|
2816
2971
|
get vizena() {
|
|
2817
2972
|
return this._vizena;
|
|
2818
2973
|
}
|
|
2974
|
+
/** <qe-graph view-padding>: the view spans ±range × this (default 1.2). */
|
|
2975
|
+
_viewPadding() {
|
|
2976
|
+
const t = Number(this.getAttribute("view-padding"));
|
|
2977
|
+
return this.hasAttribute("view-padding") && Number.isFinite(t) && t > 0 ? t : 1.2;
|
|
2978
|
+
}
|
|
2819
2979
|
/** SVG user units per CSS pixel at the current size / zoom. */
|
|
2820
2980
|
unitsPerPixel() {
|
|
2821
2981
|
var i, n;
|
|
2822
2982
|
const t = this.__data__.extremes.x_max || 1, e = (n = (i = this.svg_element) == null ? void 0 : i.getBoundingClientRect) == null ? void 0 : n.call(i), s = this.zoom_level || 1;
|
|
2823
2983
|
return e && e.width > 0 ? 2 * t / e.width / s : t * 4e-3;
|
|
2824
2984
|
}
|
|
2985
|
+
/**
|
|
2986
|
+
* Keep one mark's label in step with this render. A reused label is rebound
|
|
2987
|
+
* to the render's Point (each render builds new ones, so a label left on the
|
|
2988
|
+
* old Point stays at the old coordinates); one whose text or display mode
|
|
2989
|
+
* changed is rebuilt. A row with no text (label "") has no label, and with
|
|
2990
|
+
* mode "off" only a pinned row does. "auto" / "click" labels keep the state
|
|
2991
|
+
* hover or a click left them in, so a host that re-renders on hover doesn't
|
|
2992
|
+
* undo it. The row's offset, pin and the layer's font weight are applied
|
|
2993
|
+
* every render.
|
|
2994
|
+
*/
|
|
2995
|
+
_syncLabel(t, e, s, i, n, r, a) {
|
|
2996
|
+
let h = t.get(e);
|
|
2997
|
+
const o = s.text != null && (r !== q.DISPLAY_TYPES.OFF || s.pinned);
|
|
2998
|
+
h && (!o || h.text !== s.text || h.displayMode !== r) && (h.remove(), t.delete(e), h = void 0), o && (h ? (h.setPoint(i), r === q.DISPLAY_TYPES.ON && h.show()) : (h = new hs(s.text, i, n, this, r), t.set(e, h)), s.offset && h.setOffset(s.offset.x, s.offset.y), h.fontWeight = a, h.setHostPinned(s.pinned));
|
|
2999
|
+
}
|
|
3000
|
+
/** Rendered radius of a code node in graph units (for self-size), or null. */
|
|
3001
|
+
_nodeRadius(t) {
|
|
3002
|
+
const e = this.__children__.search("__children__", "nodes"), s = e == null ? void 0 : e.__children__.find((i) => {
|
|
3003
|
+
var n;
|
|
3004
|
+
return ((n = i.__data__) == null ? void 0 : n.ID) === t;
|
|
3005
|
+
});
|
|
3006
|
+
return s ? s.computeRadius() : null;
|
|
3007
|
+
}
|
|
3008
|
+
/** Remember an interval mark's zoom-1 stroke width and dashes, and apply
|
|
3009
|
+
* them for the current zoom (see _applyIntervalStroke). */
|
|
3010
|
+
_intervalStroke(t, e, s) {
|
|
3011
|
+
this._intervalBase.set(t, { w: e, dash: s }), this._applyIntervalStroke(t);
|
|
3012
|
+
}
|
|
3013
|
+
/** With <qe-means fixed-size>, divide by the zoom level (the zoom group
|
|
3014
|
+
* scales strokes and dashes by it); otherwise the zoom-1 values. Interval
|
|
3015
|
+
* marks are built once per render, so update() re-applies this on zoom. */
|
|
3016
|
+
_applyIntervalStroke(t) {
|
|
3017
|
+
const e = this._intervalBase.get(t);
|
|
3018
|
+
if (!e) return;
|
|
3019
|
+
const s = this._meansFixedSize && this.zoom_level || 1;
|
|
3020
|
+
t.setAttribute("stroke-width", String(e.w / s)), e.dash && t.setAttribute("stroke-dasharray", e.dash.map((i) => i / s).join(" "));
|
|
3021
|
+
}
|
|
3022
|
+
_removeIntervals(t) {
|
|
3023
|
+
t.forEach((e) => e.remove()), t.clear();
|
|
3024
|
+
}
|
|
3025
|
+
_clearLabels(t) {
|
|
3026
|
+
t.forEach((e) => e.remove()), t.clear();
|
|
3027
|
+
}
|
|
2825
3028
|
// ── Shared re-render scheduler ───────────────────────────────────────────────
|
|
2826
3029
|
// Batches synchronous attribute / child-list changes into a single microtask
|
|
2827
3030
|
// so that e.g. adding <qe-edges> and setting its attributes in the same tick
|
|
@@ -2829,11 +3032,11 @@ const gt = class gt extends ve {
|
|
|
2829
3032
|
_scheduleRerender() {
|
|
2830
3033
|
!this._vizena || !this._hasModel || this._renderPending || (this._renderPending = !0, queueMicrotask(() => {
|
|
2831
3034
|
var t;
|
|
2832
|
-
this._renderPending = !1, (t = this._vizena) == null || t.dispatchEvent(new CustomEvent("model-updated", {
|
|
3035
|
+
this._renderPending && (this._renderPending = !1, (t = this._vizena) == null || t.dispatchEvent(new CustomEvent("model-updated", {
|
|
2833
3036
|
detail: this._vizena.model,
|
|
2834
3037
|
bubbles: !0,
|
|
2835
3038
|
composed: !0
|
|
2836
|
-
}));
|
|
3039
|
+
})));
|
|
2837
3040
|
}));
|
|
2838
3041
|
}
|
|
2839
3042
|
// ── Layer configuration reader ────────────────────────────────────────────────
|
|
@@ -2841,43 +3044,46 @@ const gt = class gt extends ve {
|
|
|
2841
3044
|
// should render. Called once at the top of every model-updated handler so
|
|
2842
3045
|
// all rendering decisions are derived from a single snapshot.
|
|
2843
3046
|
_readLayerConfig() {
|
|
2844
|
-
var
|
|
2845
|
-
const t = this.querySelector("qe-nodes"), e = this.querySelector("qe-means"), s = [...this.querySelectorAll("qe-points")], i = s.find((
|
|
2846
|
-
var
|
|
2847
|
-
return ((
|
|
2848
|
-
}, "firstAttr"), h = r.find((
|
|
3047
|
+
var p;
|
|
3048
|
+
const t = this.querySelector("qe-nodes"), e = this.querySelector("qe-means"), s = [...this.querySelectorAll("qe-points")], i = s.find((u) => !u.hasAttribute("set")) ?? null, n = s.filter((u) => u.hasAttribute("set")), r = [...this.querySelectorAll("qe-edges")], a = /* @__PURE__ */ c((u) => {
|
|
3049
|
+
var d;
|
|
3050
|
+
return ((d = r.find((l) => l.hasAttribute(u))) == null ? void 0 : d.getAttribute(u)) ?? null;
|
|
3051
|
+
}, "firstAttr"), h = r.find((u) => u.hasAttribute("magnify")), o = this.querySelector("qe-trajectories"), _ = this.querySelector("qe-axes"), m = this.getAttribute("labels");
|
|
2849
3052
|
return {
|
|
2850
3053
|
// Nodes — always placed from the model (they anchor the coordinate
|
|
2851
3054
|
// space); <qe-nodes> presence draws them, like every other layer.
|
|
2852
|
-
labelNodes:
|
|
2853
|
-
(t == null ? void 0 : t.getAttribute("label")) ?? this.getAttribute("label-nodes") ??
|
|
2854
|
-
|
|
3055
|
+
labelNodes: Ee(
|
|
3056
|
+
(t == null ? void 0 : t.getAttribute("label")) ?? this.getAttribute("label-nodes") ?? m,
|
|
3057
|
+
q.DISPLAY_TYPES.ON
|
|
2855
3058
|
),
|
|
3059
|
+
// label-font-weight on a layer element (e.g. "bold"); null = 500.
|
|
3060
|
+
labelWeightNodes: (t == null ? void 0 : t.getAttribute("label-font-weight")) || null,
|
|
3061
|
+
nodeFixedSize: !!t && t.hasAttribute("fixed-size"),
|
|
2856
3062
|
showNodes: !!t,
|
|
2857
3063
|
range: (() => {
|
|
2858
|
-
const
|
|
2859
|
-
if (
|
|
2860
|
-
const
|
|
2861
|
-
return
|
|
3064
|
+
const u = this.getAttribute("range");
|
|
3065
|
+
if (u === "network" || u === "points") return u;
|
|
3066
|
+
const d = Number(u);
|
|
3067
|
+
return u != null && Number.isFinite(d) && d > 0 ? d : null;
|
|
2862
3068
|
})(),
|
|
2863
3069
|
plotTitle: this.getAttribute("plot-title") || null,
|
|
2864
3070
|
labelFont: {
|
|
2865
3071
|
size: (() => {
|
|
2866
|
-
const
|
|
2867
|
-
return Number.isFinite(
|
|
3072
|
+
const u = Number(this.getAttribute("label-font-size"));
|
|
3073
|
+
return Number.isFinite(u) && u > 0 ? u : null;
|
|
2868
3074
|
})(),
|
|
2869
3075
|
family: this.getAttribute("label-font-family") || null,
|
|
2870
3076
|
color: this.getAttribute("label-font-color") || null
|
|
2871
3077
|
},
|
|
2872
3078
|
edgeWidth: (() => {
|
|
2873
|
-
const
|
|
2874
|
-
return Number.isFinite(
|
|
3079
|
+
const u = Number(this.getAttribute("edge-width"));
|
|
3080
|
+
return Number.isFinite(u) && u > 0 && u <= 1 ? u : Ei;
|
|
2875
3081
|
})(),
|
|
2876
|
-
hideUnconnectedNodes: ((
|
|
3082
|
+
hideUnconnectedNodes: ((p = t == null ? void 0 : t.getAttribute("unconnected")) == null ? void 0 : p.toLowerCase()) === "hide",
|
|
2877
3083
|
scalePoints: this.getAttribute("scale-points") !== "false",
|
|
2878
3084
|
pointScale: (() => {
|
|
2879
|
-
const
|
|
2880
|
-
return this.hasAttribute("point-scale") && Number.isFinite(
|
|
3085
|
+
const u = Number(this.getAttribute("point-scale"));
|
|
3086
|
+
return this.hasAttribute("point-scale") && Number.isFinite(u) && u > 0 ? u : null;
|
|
2881
3087
|
})(),
|
|
2882
3088
|
centerContent: this.getAttribute("center") === "content",
|
|
2883
3089
|
// Means — presence of <qe-means> = show; absence = hide.
|
|
@@ -2886,38 +3092,46 @@ const gt = class gt extends ve {
|
|
|
2886
3092
|
showCI: !!e && e.hasAttribute("confidence"),
|
|
2887
3093
|
// intervals="box|crosshairs|none"; absent → the legacy `confidence` flag.
|
|
2888
3094
|
intervals: (() => {
|
|
2889
|
-
const
|
|
2890
|
-
return
|
|
3095
|
+
const u = e == null ? void 0 : e.getAttribute("intervals");
|
|
3096
|
+
return u === "box" || u === "crosshairs" || u === "none" ? u : e != null && e.hasAttribute("confidence") ? "box" : "none";
|
|
2891
3097
|
})(),
|
|
2892
3098
|
showOutlier: !!e && e.hasAttribute("outlier"),
|
|
2893
|
-
labelMeans:
|
|
2894
|
-
(e == null ? void 0 : e.getAttribute("label")) ?? this.getAttribute("label-means") ??
|
|
2895
|
-
|
|
3099
|
+
labelMeans: Ee(
|
|
3100
|
+
(e == null ? void 0 : e.getAttribute("label")) ?? this.getAttribute("label-means") ?? m,
|
|
3101
|
+
q.DISPLAY_TYPES.ON
|
|
2896
3102
|
),
|
|
3103
|
+
labelWeightMeans: (e == null ? void 0 : e.getAttribute("label-font-weight")) || null,
|
|
2897
3104
|
// fixed-size keeps mean markers a constant on-screen px size (webENA parity).
|
|
2898
3105
|
meanFixedSize: !!e && e.hasAttribute("fixed-size"),
|
|
2899
3106
|
// Points — presence of <qe-points> = show unit dots.
|
|
2900
3107
|
showPoints: !!i,
|
|
2901
|
-
pointSets: n.map((
|
|
2902
|
-
set:
|
|
2903
|
-
size:
|
|
2904
|
-
fixedSize:
|
|
3108
|
+
pointSets: n.map((u) => ({
|
|
3109
|
+
set: u.getAttribute("set"),
|
|
3110
|
+
size: u.getAttribute("size") ? parseFloat(u.getAttribute("size")) : null,
|
|
3111
|
+
fixedSize: u.hasAttribute("fixed-size"),
|
|
3112
|
+
// Label mode: this set's `label`, else <qe-graph label-points>.
|
|
3113
|
+
labelMode: Ee(
|
|
3114
|
+
u.getAttribute("label") ?? this.getAttribute("label-points") ?? m,
|
|
3115
|
+
q.DISPLAY_TYPES.OFF
|
|
3116
|
+
),
|
|
3117
|
+
labelWeight: u.getAttribute("label-font-weight") || null
|
|
2905
3118
|
})),
|
|
2906
|
-
labelPoints:
|
|
2907
|
-
(i == null ? void 0 : i.getAttribute("label")) ?? this.getAttribute("label-points") ??
|
|
2908
|
-
|
|
3119
|
+
labelPoints: Ee(
|
|
3120
|
+
(i == null ? void 0 : i.getAttribute("label")) ?? this.getAttribute("label-points") ?? m,
|
|
3121
|
+
q.DISPLAY_TYPES.OFF
|
|
2909
3122
|
),
|
|
3123
|
+
labelWeightPoints: (i == null ? void 0 : i.getAttribute("label-font-weight")) || null,
|
|
2910
3124
|
pointSize: i != null && i.getAttribute("size") ? parseFloat(i.getAttribute("size")) : null,
|
|
2911
3125
|
// fixed-size keeps unit dots a constant on-screen px size (webENA parity).
|
|
2912
3126
|
pointFixedSize: !!i && i.hasAttribute("fixed-size"),
|
|
2913
3127
|
// Edges — presence of <qe-edges> = draw a network.
|
|
2914
3128
|
showEdges: r.length > 0,
|
|
2915
|
-
edgeLayers: r.map(
|
|
3129
|
+
edgeLayers: r.map(qi),
|
|
2916
3130
|
// Plot-wide edge settings: the first <qe-edges> that sets them.
|
|
2917
|
-
edgeColorScale:
|
|
3131
|
+
edgeColorScale: Gi(a("color-scale")),
|
|
2918
3132
|
edgeMagnify: h ? (() => {
|
|
2919
|
-
const
|
|
2920
|
-
return Number.isFinite(
|
|
3133
|
+
const u = Number(h.getAttribute("magnify"));
|
|
3134
|
+
return Number.isFinite(u) && u > 0 ? u : 1;
|
|
2921
3135
|
})() : null,
|
|
2922
3136
|
// Trajectories — presence of <qe-trajectories> = draw cognitive trajectories
|
|
2923
3137
|
showTrajectories: !!o,
|
|
@@ -2936,9 +3150,10 @@ const gt = class gt extends ve {
|
|
|
2936
3150
|
// a per-axis label: a value is used verbatim, an empty attribute falls back
|
|
2937
3151
|
// to the dimension name (resolved later, where dims are known). null = no
|
|
2938
3152
|
// label for that axis.
|
|
2939
|
-
showAxes: !!
|
|
2940
|
-
|
|
2941
|
-
|
|
3153
|
+
showAxes: !!_,
|
|
3154
|
+
axesFixedSize: !!_ && _.hasAttribute("fixed-size"),
|
|
3155
|
+
axisXLabel: _ != null && _.hasAttribute("x") ? _.getAttribute("x") ?? "" : null,
|
|
3156
|
+
axisYLabel: _ != null && _.hasAttribute("y") ? _.getAttribute("y") ?? "" : null
|
|
2942
3157
|
};
|
|
2943
3158
|
}
|
|
2944
3159
|
_parseNumberPair(t, e) {
|
|
@@ -2952,7 +3167,7 @@ const gt = class gt extends ve {
|
|
|
2952
3167
|
connectedCallback() {
|
|
2953
3168
|
var n;
|
|
2954
3169
|
const t = this.getAttribute("width"), e = this.getAttribute("height");
|
|
2955
|
-
this.style.display = "block", t && (this.style.width = isNaN(Number(t)) ? t : `${t}px`), e && (this.style.height = isNaN(Number(e)) ? e : `${e}px`), this.appendChild(this.svg_element),
|
|
3170
|
+
this.style.display = "block", t && (this.style.width = isNaN(Number(t)) ? t : `${t}px`), e && (this.style.height = isNaN(Number(e)) ? e : `${e}px`), this.appendChild(this.svg_element), et._instances.add(this), this._childObserver = new MutationObserver(() => this._scheduleRerender()), this._childObserver.observe(this, {
|
|
2956
3171
|
childList: !0,
|
|
2957
3172
|
attributes: !0,
|
|
2958
3173
|
subtree: !0,
|
|
@@ -2980,13 +3195,16 @@ const gt = class gt extends ve {
|
|
|
2980
3195
|
"labels",
|
|
2981
3196
|
"range",
|
|
2982
3197
|
"center",
|
|
3198
|
+
"view-padding",
|
|
2983
3199
|
"plot-title",
|
|
2984
3200
|
"label-font-size",
|
|
2985
3201
|
"label-font-family",
|
|
2986
3202
|
"label-font-color",
|
|
3203
|
+
"label-font-weight",
|
|
2987
3204
|
"label-nodes",
|
|
2988
3205
|
"label-means",
|
|
2989
3206
|
"label-points",
|
|
3207
|
+
"self-size",
|
|
2990
3208
|
"units",
|
|
2991
3209
|
"smooth",
|
|
2992
3210
|
"degree",
|
|
@@ -3016,15 +3234,15 @@ const gt = class gt extends ve {
|
|
|
3016
3234
|
}
|
|
3017
3235
|
disconnectedCallback() {
|
|
3018
3236
|
var t, e, s;
|
|
3019
|
-
(t = this._childObserver) == null || t.disconnect(), this._childObserver = null, (e = this._resizeObs) == null || e.disconnect(), this._resizeObs = null,
|
|
3237
|
+
this._stopTween(), (t = this._childObserver) == null || t.disconnect(), this._childObserver = null, (e = this._resizeObs) == null || e.disconnect(), this._resizeObs = null, et._instances.delete(this), (s = this._tooltipEl) == null || s.remove(), this._tooltipEl = null;
|
|
3020
3238
|
}
|
|
3021
3239
|
/** All connected <qe-graph> instances (newest membership order). */
|
|
3022
3240
|
static instances() {
|
|
3023
|
-
return [...
|
|
3241
|
+
return [...et._instances];
|
|
3024
3242
|
}
|
|
3025
3243
|
/** Look up a graph by its `id` or `plot-group` attribute. */
|
|
3026
3244
|
static getGraph(t) {
|
|
3027
|
-
for (const e of
|
|
3245
|
+
for (const e of et._instances)
|
|
3028
3246
|
if (e.id === t || e.getAttribute("plot-group") === t) return e;
|
|
3029
3247
|
return null;
|
|
3030
3248
|
}
|
|
@@ -3043,7 +3261,7 @@ const gt = class gt extends ve {
|
|
|
3043
3261
|
}
|
|
3044
3262
|
/** Resolved edges of the current network with weights and direction. */
|
|
3045
3263
|
getEdges() {
|
|
3046
|
-
const t = /* @__PURE__ */
|
|
3264
|
+
const t = /* @__PURE__ */ c((e) => {
|
|
3047
3265
|
const s = this.__children__.search("__children__", e);
|
|
3048
3266
|
return s ? [...s.__data__.objects.values()] : [];
|
|
3049
3267
|
}, "collect");
|
|
@@ -3058,65 +3276,193 @@ const gt = class gt extends ve {
|
|
|
3058
3276
|
};
|
|
3059
3277
|
}).filter((e) => e.source != null && e.target != null);
|
|
3060
3278
|
}
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3279
|
+
// ── View: zoom / pan ─────────────────────────────────────────────────────────
|
|
3280
|
+
/** <qe-graph zoom-min / zoom-max>: the zoom levels every zoom stays within
|
|
3281
|
+
* (1 = the fitted view); unbounded when absent. */
|
|
3282
|
+
_zoomLimits() {
|
|
3283
|
+
const t = /* @__PURE__ */ c((e) => {
|
|
3284
|
+
const s = Number(this.getAttribute(e));
|
|
3285
|
+
return this.hasAttribute(e) && Number.isFinite(s) && s > 0 ? s : null;
|
|
3286
|
+
}, "num");
|
|
3287
|
+
return [t("zoom-min") ?? 0, t("zoom-max") ?? 1 / 0];
|
|
3288
|
+
}
|
|
3289
|
+
_clampZoom(t) {
|
|
3290
|
+
const [e, s] = this._zoomLimits();
|
|
3291
|
+
return Math.min(s, Math.max(e, t));
|
|
3292
|
+
}
|
|
3293
|
+
/** <qe-graph zoom-step>: the wheel's zoom factor per 100 px of scroll. */
|
|
3294
|
+
_zoomStep() {
|
|
3295
|
+
const t = Number(this.getAttribute("zoom-step"));
|
|
3296
|
+
return this.hasAttribute("zoom-step") && Number.isFinite(t) && t > 0 ? t : 1.1;
|
|
3297
|
+
}
|
|
3298
|
+
/** Client (CSS px) → root-svg user coordinates, the space the zoom / pan
|
|
3299
|
+
* transform maps into; null before layout. */
|
|
3300
|
+
_clientToRoot(t, e) {
|
|
3301
|
+
var n, r;
|
|
3302
|
+
const s = (r = (n = this.svg_element).getScreenCTM) == null ? void 0 : r.call(n);
|
|
3303
|
+
if (!s) return null;
|
|
3304
|
+
const i = new DOMPoint(t, e).matrixTransform(s.inverse());
|
|
3305
|
+
return [i.x, i.y];
|
|
3306
|
+
}
|
|
3307
|
+
/** Zoom to `level` (within the limits), keeping the root-svg point
|
|
3308
|
+
* (ux, uy) where it is on screen. Every zoom goes through here. */
|
|
3309
|
+
_zoomAbout(t, e, s) {
|
|
3310
|
+
if (!(Number.isFinite(t) && t > 0)) return;
|
|
3311
|
+
t = this._clampZoom(t);
|
|
3312
|
+
const i = this.__data__.transform, n = t / (this.zoom_level || 1);
|
|
3313
|
+
i.e = e - n * (e - i.e), i.f = s - n * (s - i.f), i.zoom(t), this.zoom_level = t, this.update();
|
|
3314
|
+
}
|
|
3315
|
+
_stopZoomAnim() {
|
|
3316
|
+
this._zoomAnim !== null && cancelAnimationFrame(this._zoomAnim), this._zoomAnim = null;
|
|
3317
|
+
}
|
|
3318
|
+
/** Ease the zoom to `level` about (ux, uy) over `ms` (double-click). */
|
|
3319
|
+
_animateZoomAbout(t, e, s, i) {
|
|
3320
|
+
this._stopZoomAnim();
|
|
3321
|
+
const n = this.zoom_level || 1, r = this._clampZoom(t);
|
|
3322
|
+
if (r === n) return;
|
|
3323
|
+
const a = performance.now(), h = /* @__PURE__ */ c((o) => {
|
|
3324
|
+
const _ = Math.min(1, Math.max(0, (o - a) / i));
|
|
3325
|
+
this._zoomAbout(_ >= 1 ? r : n * Math.pow(r / n, 1 - Math.pow(1 - _, 3)), e, s), this._zoomAnim = _ < 1 ? requestAnimationFrame(h) : null;
|
|
3326
|
+
}, "step");
|
|
3327
|
+
this._zoomAnim = requestAnimationFrame(h);
|
|
3078
3328
|
}
|
|
3079
|
-
/**
|
|
3080
|
-
|
|
3329
|
+
/**
|
|
3330
|
+
* Zoom to an absolute level (1 = the fitted view, 2 = twice as close),
|
|
3331
|
+
* about the centre of the view: whatever is under the centre stays there,
|
|
3332
|
+
* pan included. Ignores levels that are not finite and > 0; clamped to
|
|
3333
|
+
* zoom-min / zoom-max. Works with view-locked set.
|
|
3334
|
+
*/
|
|
3335
|
+
zoomTo(t) {
|
|
3336
|
+
this._stopZoomAnim();
|
|
3337
|
+
const { cx: e, cy: s } = this.__data__.extremes;
|
|
3338
|
+
this._zoomAbout(t, e, s);
|
|
3339
|
+
}
|
|
3340
|
+
/** Zoom by a factor relative to the current level (> 1 in, < 1 out). */
|
|
3341
|
+
zoomBy(t) {
|
|
3342
|
+
Number.isFinite(t) && t > 0 && this.zoomTo((this.zoom_level || 1) * t);
|
|
3343
|
+
}
|
|
3344
|
+
/** Back to the fitted view: zoom 1 (or the nearest limit), no pan. */
|
|
3345
|
+
resetView() {
|
|
3346
|
+
this._stopZoomAnim();
|
|
3347
|
+
const t = this._clampZoom(1), { cx: e, cy: s } = this.__data__.extremes;
|
|
3348
|
+
this.zoom_level = t, this.__data__.transform.values = t === 1 ? [1, 0, 0, 1, 0, 0] : [t, 0, 0, t, e * (1 - t), s * (1 - t)], this.update();
|
|
3349
|
+
}
|
|
3350
|
+
static _ease(t) {
|
|
3351
|
+
return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;
|
|
3352
|
+
}
|
|
3353
|
+
/** Move a Point (or an edge end): QEPoint reads `dimensions`, others `x` / `y`. */
|
|
3354
|
+
static _setXY(t, e, s) {
|
|
3355
|
+
t.x = e, t.y = s, t.dimensions && (t.dimensions[0] = e, t.dimensions[1] = s);
|
|
3356
|
+
}
|
|
3357
|
+
_layerObjects(t) {
|
|
3358
|
+
var e;
|
|
3359
|
+
return (e = this.__children__.search("__children__", t)) == null ? void 0 : e.__data__.objects;
|
|
3360
|
+
}
|
|
3361
|
+
_intervalMarks() {
|
|
3362
|
+
return [...this._ciRects.values(), ...this._outlierRects.values(), ...this._ciCross.values()];
|
|
3363
|
+
}
|
|
3364
|
+
/** A box's x, y, width, height, or a crosshair path's numbers. */
|
|
3365
|
+
_boxGeom(t) {
|
|
3366
|
+
return t.tagName.toLowerCase() === "rect" ? ["x", "y", "width", "height"].map((e) => parseFloat(t.getAttribute(e) || "0")) : ((t.getAttribute("d") || "").match(et._PATH_NUM_RE) || []).map(Number);
|
|
3367
|
+
}
|
|
3368
|
+
/** The plot as drawn now — mid-tween, the in-between state — with the
|
|
3369
|
+
* running tween's clock and targets, so a new render can continue it. */
|
|
3370
|
+
_captureTweenState() {
|
|
3371
|
+
var n;
|
|
3081
3372
|
const t = /* @__PURE__ */ new Map();
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
s && t.set(e, s);
|
|
3085
|
-
}), t;
|
|
3086
|
-
}
|
|
3087
|
-
/** Animate each still-present element from its snapshot to its new position. */
|
|
3088
|
-
_runTween(t) {
|
|
3089
|
-
this._tweenRaf !== null && (cancelAnimationFrame(this._tweenRaf), this._tweenRaf = null);
|
|
3373
|
+
for (const r of ["points", "nodes"])
|
|
3374
|
+
(n = this._layerObjects(r)) == null || n.forEach((a, h) => t.set(`${r}:${h}`, [a.x, a.y]));
|
|
3090
3375
|
const e = /* @__PURE__ */ new Map();
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3376
|
+
this._intervalMarks().forEach((r) => e.set(r, this._boxGeom(r)));
|
|
3377
|
+
const s = this.__data__.extremes, i = this._tween;
|
|
3378
|
+
return {
|
|
3379
|
+
marks: t,
|
|
3380
|
+
boxes: e,
|
|
3381
|
+
view: [s.x_max, s.y_max, s.cx, s.cy],
|
|
3382
|
+
running: i ? {
|
|
3383
|
+
t0: i.t0,
|
|
3384
|
+
k: i.k,
|
|
3385
|
+
marks: new Map(i.marks.map((r) => [r.key, [r.tx, r.ty]])),
|
|
3386
|
+
boxes: new Map(i.boxes.map((r) => [r.el, r.to])),
|
|
3387
|
+
view: i.view.to
|
|
3388
|
+
} : null
|
|
3389
|
+
};
|
|
3390
|
+
}
|
|
3391
|
+
_stopTween() {
|
|
3392
|
+
this._tweenRaf !== null && cancelAnimationFrame(this._tweenRaf), this._tweenRaf = null, this._tween = null, this._tweenView = null;
|
|
3393
|
+
}
|
|
3394
|
+
/**
|
|
3395
|
+
* Tween from `prev` (what was on screen) to the plot just rendered. A render
|
|
3396
|
+
* that lands mid-tween with the same targets (the same model again, an
|
|
3397
|
+
* attribute that moves nothing) continues on the running clock; one with
|
|
3398
|
+
* new targets starts a fresh tween from the current, in-between positions.
|
|
3399
|
+
*/
|
|
3400
|
+
_startTween(t) {
|
|
3401
|
+
var b;
|
|
3402
|
+
const e = performance.now(), s = /* @__PURE__ */ c((f, w) => !!w && f.length === w.length && f.every(($, z) => $ === w[z]), "same"), i = [];
|
|
3403
|
+
for (const f of ["points", "nodes"])
|
|
3404
|
+
(b = this._layerObjects(f)) == null || b.forEach((w, $) => {
|
|
3405
|
+
const z = `${f}:${$}`, D = t.marks.get(z);
|
|
3406
|
+
D && i.push({ key: z, o: w, tx: w.x, ty: w.y, cx: D[0], cy: D[1] });
|
|
3407
|
+
});
|
|
3408
|
+
const n = this._intervalMarks().map((f) => ({ el: f, to: this._boxGeom(f), cur: t.boxes.get(f) })).filter((f) => f.cur && f.cur.length === f.to.length), r = this.__data__.extremes, a = [r.x_max, r.y_max, r.cx, r.cy], h = t.running, o = !!h && h.k < 0.95 && s(a, h.view) && i.every((f) => s([f.tx, f.ty], h.marks.get(f.key) ?? [f.cx, f.cy])) && n.every((f) => s(f.to, h.boxes.get(f.el) ?? f.cur)), _ = o ? h.k : 0, m = /* @__PURE__ */ c((f, w) => _ > 0 ? (f - _ * w) / (1 - _) : f, "from"), p = i.map((f) => ({ key: f.key, o: f.o, tx: f.tx, ty: f.ty, fx: m(f.cx, f.tx), fy: m(f.cy, f.ty) })).filter((f) => f.fx !== f.tx || f.fy !== f.ty), u = n.map((f) => ({
|
|
3409
|
+
el: f.el,
|
|
3410
|
+
to: f.to,
|
|
3411
|
+
from: f.cur.map((w, $) => m(w, f.to[$])),
|
|
3412
|
+
attrs: Object.fromEntries(["x", "y", "width", "height", "d"].filter((w) => f.el.hasAttribute(w)).map((w) => [w, f.el.getAttribute(w)]))
|
|
3413
|
+
})).filter((f) => !s(f.from, f.to)), d = t.view.map((f, w) => m(f, a[w]));
|
|
3414
|
+
if (!p.length && !u.length && s(d, a)) return;
|
|
3415
|
+
this._tween = {
|
|
3416
|
+
t0: o ? h.t0 : e,
|
|
3417
|
+
dur: this._animateMs,
|
|
3418
|
+
k: _,
|
|
3419
|
+
marks: p,
|
|
3420
|
+
boxes: u,
|
|
3421
|
+
view: { from: d, to: a }
|
|
3422
|
+
}, this._tweenFrame(_);
|
|
3423
|
+
const l = /* @__PURE__ */ c((f) => {
|
|
3424
|
+
const w = this._tween;
|
|
3425
|
+
if (!w) return;
|
|
3426
|
+
const $ = (f - w.t0) / w.dur;
|
|
3427
|
+
if ($ >= 1) {
|
|
3428
|
+
this._endTween();
|
|
3429
|
+
return;
|
|
3095
3430
|
}
|
|
3096
|
-
|
|
3097
|
-
const s = this._animateMs, i = performance.now(), n = /* @__PURE__ */ _((h) => h < 0.5 ? 2 * h * h : 1 - Math.pow(-2 * h + 2, 2) / 2, "ease"), r = /* @__PURE__ */ _((h, o, l) => h + (o - h) * l, "lerp"), a = /* @__PURE__ */ _((h) => {
|
|
3098
|
-
const o = Math.min(1, (h - i) / s), l = n(o);
|
|
3099
|
-
e.forEach((u, g) => {
|
|
3100
|
-
const c = t.get(g);
|
|
3101
|
-
if (!(!c || c.t !== u.t))
|
|
3102
|
-
if (u.t === "c")
|
|
3103
|
-
g.setAttribute("cx", String(r(c.cx, u.cx, l))), g.setAttribute("cy", String(r(c.cy, u.cy, l)));
|
|
3104
|
-
else if (u.t === "r")
|
|
3105
|
-
g.setAttribute("x", String(r(c.x, u.x, l))), g.setAttribute("y", String(r(c.y, u.y, l)));
|
|
3106
|
-
else if (u.t === "l")
|
|
3107
|
-
g.setAttribute("x1", String(r(c.x1, u.x1, l))), g.setAttribute("y1", String(r(c.y1, u.y1, l))), g.setAttribute("x2", String(r(c.x2, u.x2, l))), g.setAttribute("y2", String(r(c.y2, u.y2, l)));
|
|
3108
|
-
else {
|
|
3109
|
-
if (!c.nums || c.nums.length !== u.nums.length) return;
|
|
3110
|
-
let v = 0;
|
|
3111
|
-
const m = u.d.replace(
|
|
3112
|
-
gt._PATH_NUM_RE,
|
|
3113
|
-
() => String(r(c.nums[v], u.nums[v++], l))
|
|
3114
|
-
);
|
|
3115
|
-
g.setAttribute("d", m);
|
|
3116
|
-
}
|
|
3117
|
-
}), this._tweenRaf = o < 1 ? requestAnimationFrame(a) : null;
|
|
3431
|
+
this._tweenFrame(Math.max(w.k, et._ease(Math.max(0, $)))), this._tweenRaf = requestAnimationFrame(l);
|
|
3118
3432
|
}, "step");
|
|
3119
|
-
this._tweenRaf = requestAnimationFrame(
|
|
3433
|
+
this._tweenRaf = requestAnimationFrame(l);
|
|
3434
|
+
}
|
|
3435
|
+
/** Draw the tween at eased progress k (0 = start, 1 = end). */
|
|
3436
|
+
_tweenFrame(t) {
|
|
3437
|
+
const e = this._tween;
|
|
3438
|
+
if (!e) return;
|
|
3439
|
+
e.k = t;
|
|
3440
|
+
const s = /* @__PURE__ */ c((i, n) => i + (n - i) * t, "lerp");
|
|
3441
|
+
e.marks.forEach((i) => et._setXY(i.o, s(i.fx, i.tx), s(i.fy, i.ty))), this._attachEdges(), e.boxes.forEach((i) => {
|
|
3442
|
+
const n = i.from.map((r, a) => s(r, i.to[a]));
|
|
3443
|
+
if ("d" in i.attrs) {
|
|
3444
|
+
let r = 0;
|
|
3445
|
+
i.el.setAttribute("d", i.attrs.d.replace(et._PATH_NUM_RE, () => String(n[r++])));
|
|
3446
|
+
} else
|
|
3447
|
+
["x", "y", "width", "height"].forEach((r, a) => i.el.setAttribute(r, String(n[a])));
|
|
3448
|
+
}), this._tweenView = e.view.from.map((i, n) => s(i, e.view.to[n])), this.update();
|
|
3449
|
+
}
|
|
3450
|
+
/** Land exactly on the rendered plot and stop. */
|
|
3451
|
+
_endTween() {
|
|
3452
|
+
const t = this._tween;
|
|
3453
|
+
t && (t.marks.forEach((e) => et._setXY(e.o, e.tx, e.ty)), this._attachEdges(), t.boxes.forEach((e) => Object.entries(e.attrs).forEach(([s, i]) => e.el.setAttribute(s, i))), this._stopTween(), this.update());
|
|
3454
|
+
}
|
|
3455
|
+
/** Put each edge's ends on its nodes' current positions. */
|
|
3456
|
+
_attachEdges() {
|
|
3457
|
+
var e;
|
|
3458
|
+
const t = this._layerObjects("nodes");
|
|
3459
|
+
if (t)
|
|
3460
|
+
for (const s of ["edges", "edgenodes"])
|
|
3461
|
+
(e = this._layerObjects(s)) == null || e.forEach((i) => {
|
|
3462
|
+
var a, h;
|
|
3463
|
+
const n = t.get((a = i.meta) == null ? void 0 : a.source), r = t.get((h = i.meta) == null ? void 0 : h.target);
|
|
3464
|
+
n && i.from && et._setXY(i.from, n.x, n.y), r && i.to && et._setXY(i.to, r.x, r.y);
|
|
3465
|
+
});
|
|
3120
3466
|
}
|
|
3121
3467
|
/** Serialize the current plot as a standalone SVG string (webENA P2.3). */
|
|
3122
3468
|
toSVG() {
|
|
@@ -3130,23 +3476,23 @@ const gt = class gt extends ve {
|
|
|
3130
3476
|
toPNG(t = 2) {
|
|
3131
3477
|
const e = this.toSVG(), s = this.svg_element.getBoundingClientRect(), i = Math.max(1, Math.round(s.width)), n = Math.max(1, Math.round(s.height));
|
|
3132
3478
|
return new Promise((r, a) => {
|
|
3133
|
-
const h = new Blob([e], { type: "image/svg+xml;charset=utf-8" }), o = URL.createObjectURL(h),
|
|
3134
|
-
|
|
3479
|
+
const h = new Blob([e], { type: "image/svg+xml;charset=utf-8" }), o = URL.createObjectURL(h), _ = new Image();
|
|
3480
|
+
_.onload = () => {
|
|
3135
3481
|
try {
|
|
3136
|
-
const
|
|
3137
|
-
|
|
3138
|
-
const
|
|
3139
|
-
if (!
|
|
3482
|
+
const m = document.createElement("canvas");
|
|
3483
|
+
m.width = i * t, m.height = n * t;
|
|
3484
|
+
const p = m.getContext("2d");
|
|
3485
|
+
if (!p) {
|
|
3140
3486
|
URL.revokeObjectURL(o), a(new Error("no 2d context"));
|
|
3141
3487
|
return;
|
|
3142
3488
|
}
|
|
3143
|
-
|
|
3144
|
-
} catch (
|
|
3145
|
-
URL.revokeObjectURL(o), a(
|
|
3489
|
+
p.scale(t, t), p.drawImage(_, 0, 0, i, n), URL.revokeObjectURL(o), r(m.toDataURL("image/png"));
|
|
3490
|
+
} catch (m) {
|
|
3491
|
+
URL.revokeObjectURL(o), a(m);
|
|
3146
3492
|
}
|
|
3147
|
-
},
|
|
3148
|
-
URL.revokeObjectURL(o), a(
|
|
3149
|
-
},
|
|
3493
|
+
}, _.onerror = (m) => {
|
|
3494
|
+
URL.revokeObjectURL(o), a(m);
|
|
3495
|
+
}, _.src = o;
|
|
3150
3496
|
});
|
|
3151
3497
|
}
|
|
3152
3498
|
/** Unit points with their current graph-space coordinates. */
|
|
@@ -3183,114 +3529,169 @@ const gt = class gt extends ve {
|
|
|
3183
3529
|
this._highlight.edges.clear(), this._highlight.nodes.clear(), this._applyHighlights();
|
|
3184
3530
|
}
|
|
3185
3531
|
_applyHighlights() {
|
|
3532
|
+
var _;
|
|
3186
3533
|
if (!this.svg_element) return;
|
|
3187
|
-
this._highlightGroup || (this._highlightGroup = document.createElementNS("http://www.w3.org/2000/svg", "g"), this._highlightGroup.setAttribute("data-layer-name", "highlight"), this._highlightGroup.setAttribute("pointer-events", "none"))
|
|
3188
|
-
const t = this.
|
|
3189
|
-
t
|
|
3190
|
-
const
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3534
|
+
this._highlightGroup || (this._highlightGroup = document.createElementNS("http://www.w3.org/2000/svg", "g"), this._highlightGroup.setAttribute("data-layer-name", "highlight"), this._highlightGroup.setAttribute("pointer-events", "none"));
|
|
3535
|
+
const t = this._highlight.edges.size > 0 || this._highlight.nodes.size > 0, e = (_ = this.__children__[0]) == null ? void 0 : _.svg_element;
|
|
3536
|
+
(t && e ? e : this.svg_element).appendChild(this._highlightGroup);
|
|
3537
|
+
const s = this._highlightGroup;
|
|
3538
|
+
s.textContent = "";
|
|
3539
|
+
const i = this.__data__.extremes.x_max || 1, n = "#f5a623", r = this.zoom_level || 1, a = this._edgesFixedSize ? r : 1, h = /* @__PURE__ */ c((m) => {
|
|
3540
|
+
var d;
|
|
3541
|
+
const p = /* @__PURE__ */ c((l) => {
|
|
3542
|
+
var b;
|
|
3543
|
+
return (b = this.__children__.search("__children__", l)) == null ? void 0 : b.__data__.objects.get(m);
|
|
3544
|
+
}, "find"), u = (d = p("nodes") ?? p("points")) == null ? void 0 : d.meta;
|
|
3545
|
+
return u != null && u.zoomFixed || u != null && u.fixedSize ? r : 1;
|
|
3546
|
+
}, "markK"), o = /* @__PURE__ */ c((m, p) => {
|
|
3547
|
+
const u = document.createElementNS("http://www.w3.org/2000/svg", m);
|
|
3548
|
+
for (const d in p) u.setAttribute(d, String(p[d]));
|
|
3549
|
+
return u;
|
|
3194
3550
|
}, "mk");
|
|
3195
3551
|
if (this._highlight.edges.size) {
|
|
3196
|
-
const
|
|
3197
|
-
this.getNodes().forEach((
|
|
3198
|
-
|
|
3199
|
-
}), this._highlight.edges.forEach((
|
|
3200
|
-
const [
|
|
3201
|
-
!
|
|
3202
|
-
x1:
|
|
3203
|
-
y1:
|
|
3204
|
-
x2:
|
|
3205
|
-
y2:
|
|
3206
|
-
stroke:
|
|
3207
|
-
"stroke-width":
|
|
3552
|
+
const m = {};
|
|
3553
|
+
this.getNodes().forEach((p) => {
|
|
3554
|
+
m[p.id] = { x: p.x, y: p.y };
|
|
3555
|
+
}), this._highlight.edges.forEach((p) => {
|
|
3556
|
+
const [u, d] = p.split("\0"), l = m[u], b = m[d];
|
|
3557
|
+
!l || !b || s.appendChild(o("line", {
|
|
3558
|
+
x1: l.x,
|
|
3559
|
+
y1: l.y,
|
|
3560
|
+
x2: b.x,
|
|
3561
|
+
y2: b.y,
|
|
3562
|
+
stroke: n,
|
|
3563
|
+
"stroke-width": i * 0.02 / a,
|
|
3208
3564
|
"stroke-opacity": 0.6,
|
|
3209
3565
|
"stroke-linecap": "round"
|
|
3210
3566
|
}));
|
|
3211
3567
|
});
|
|
3212
3568
|
}
|
|
3213
|
-
this._highlight.nodes.forEach((
|
|
3214
|
-
var
|
|
3215
|
-
const
|
|
3216
|
-
if (!
|
|
3217
|
-
const
|
|
3218
|
-
let
|
|
3219
|
-
if (
|
|
3220
|
-
const
|
|
3221
|
-
|
|
3569
|
+
this._highlight.nodes.forEach((m) => {
|
|
3570
|
+
var f;
|
|
3571
|
+
const p = this.svg_element.querySelector(`[data-point-id="${(f = window.CSS) != null && f.escape ? CSS.escape(m) : m}"]`);
|
|
3572
|
+
if (!p) return;
|
|
3573
|
+
const u = p.tagName.toLowerCase();
|
|
3574
|
+
let d, l, b;
|
|
3575
|
+
if (u === "rect") {
|
|
3576
|
+
const w = parseFloat(p.getAttribute("width") || "0");
|
|
3577
|
+
d = parseFloat(p.getAttribute("x") || "0") + w / 2, l = parseFloat(p.getAttribute("y") || "0") + parseFloat(p.getAttribute("height") || "0") / 2, b = w / 2;
|
|
3222
3578
|
} else
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
cx:
|
|
3226
|
-
cy:
|
|
3227
|
-
r:
|
|
3579
|
+
d = parseFloat(p.getAttribute("cx") || "0"), l = parseFloat(p.getAttribute("cy") || "0"), b = parseFloat(p.getAttribute("r") || "0");
|
|
3580
|
+
s.appendChild(o("circle", {
|
|
3581
|
+
cx: d,
|
|
3582
|
+
cy: l,
|
|
3583
|
+
r: b * 1.7 + i * 4e-3 / h(m),
|
|
3228
3584
|
fill: "none",
|
|
3229
|
-
stroke:
|
|
3230
|
-
"stroke-width":
|
|
3585
|
+
stroke: n,
|
|
3586
|
+
"stroke-width": i * 6e-3 / h(m)
|
|
3231
3587
|
}));
|
|
3232
3588
|
});
|
|
3233
3589
|
}
|
|
3234
3590
|
create() {
|
|
3235
3591
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3236
3592
|
t.classList.add("graph"), t.style.display = "block", t.style.width = "100%", t.style.height = "100%", t.setAttribute("preserveAspectRatio", "xMidYMid meet"), t.setAttribute("viewBox", this.__data__.extremes.as_viewBox()), t.setAttribute("transform", this.__data__.transform.toString()), t.setAttribute("role", "figure"), t.setAttribute("data-graph-size", `${Math.min(this.__data__.extremes.width, this.__data__.extremes.height)}`), this.svg_element = t;
|
|
3237
|
-
const e = document.createElementNS("http://www.w3.org/2000/svg", "defs"), s = 0.22, i = 0.15, n = /* @__PURE__ */
|
|
3593
|
+
const e = document.createElementNS("http://www.w3.org/2000/svg", "defs"), s = 0.22, i = 0.15, n = /* @__PURE__ */ c((r, a) => {
|
|
3238
3594
|
const h = document.createElementNS("http://www.w3.org/2000/svg", "marker");
|
|
3239
3595
|
h.setAttribute("id", r), h.setAttribute("markerWidth", String(s)), h.setAttribute("markerHeight", String(i)), h.setAttribute("refX", String(s)), h.setAttribute("refY", String(i / 2)), h.setAttribute("orient", "auto"), h.setAttribute("markerUnits", "userSpaceOnUse");
|
|
3240
3596
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
3241
3597
|
o.setAttribute("d", `M0,0 L0,${i} L${s},${i / 2} z`), o.setAttribute("fill", a), h.appendChild(o), e.appendChild(h);
|
|
3242
3598
|
}, "makeArrow");
|
|
3243
|
-
return
|
|
3244
|
-
const a = new
|
|
3599
|
+
return oi.forEach((r) => n(`qe-arrow-${r.slice(1)}`, r)), t.appendChild(e), this.__data__.layers.forEach((r) => {
|
|
3600
|
+
const a = new as(r, this.svg_element, this);
|
|
3245
3601
|
this.__children__.push(a);
|
|
3246
3602
|
}), this.__data__.__state__.setVariable("graph_updated", this.__data__), this.attach_events(), t;
|
|
3247
3603
|
}
|
|
3248
3604
|
attach_events() {
|
|
3249
|
-
this.
|
|
3250
|
-
|
|
3605
|
+
const t = /* @__PURE__ */ c(() => this.hasAttribute("view-locked"), "locked");
|
|
3606
|
+
this.svg_element.addEventListener("wheel", (d) => {
|
|
3607
|
+
if (t()) return;
|
|
3608
|
+
d.preventDefault();
|
|
3609
|
+
const l = d.deltaMode === 1 ? 33 : d.deltaMode === 2 ? this.svg_element.clientHeight || 800 : 1, b = d.deltaY * l, f = d.ctrlKey ? Math.exp(-b / 100) : Math.pow(this._zoomStep(), -b / 100);
|
|
3610
|
+
this._stopZoomAnim();
|
|
3611
|
+
const w = this._clientToRoot(d.clientX, d.clientY);
|
|
3612
|
+
w ? this._zoomAbout((this.zoom_level || 1) * f, w[0], w[1]) : this.zoomBy(f);
|
|
3613
|
+
}, { passive: !1 }), this.svg_element.addEventListener("dblclick", (d) => {
|
|
3614
|
+
var b, f;
|
|
3615
|
+
if (t() || (f = (b = d.target) == null ? void 0 : b.closest) != null && f.call(b, "text[data-label-for]")) return;
|
|
3616
|
+
d.preventDefault();
|
|
3617
|
+
const l = this._clientToRoot(d.clientX, d.clientY);
|
|
3618
|
+
l && this._animateZoomAbout((this.zoom_level || 1) * 2.2, l[0], l[1], 200);
|
|
3619
|
+
});
|
|
3620
|
+
const e = /* @__PURE__ */ new Map();
|
|
3621
|
+
let s = null;
|
|
3622
|
+
const i = /* @__PURE__ */ c(() => {
|
|
3623
|
+
const [d, l] = [...e.values()];
|
|
3624
|
+
return d ? l ? { mid: [(d[0] + l[0]) / 2, (d[1] + l[1]) / 2], dist: Math.hypot(d[0] - l[0], d[1] - l[1]), n: 2 } : { mid: d, dist: 0, n: 1 } : null;
|
|
3625
|
+
}, "measure");
|
|
3626
|
+
this.svg_element.addEventListener("pointerdown", (d) => {
|
|
3627
|
+
d.pointerType !== "touch" || t() || (e.set(d.pointerId, [d.clientX, d.clientY]), s = i(), this._stopZoomAnim());
|
|
3628
|
+
}), this.svg_element.addEventListener("pointermove", (d) => {
|
|
3629
|
+
if (!e.has(d.pointerId)) return;
|
|
3630
|
+
if (t()) {
|
|
3631
|
+
e.clear(), s = null;
|
|
3632
|
+
return;
|
|
3633
|
+
}
|
|
3634
|
+
e.set(d.pointerId, [d.clientX, d.clientY]);
|
|
3635
|
+
const l = i();
|
|
3636
|
+
if (l && s && l.n === s.n) {
|
|
3637
|
+
const b = this._clientToRoot(...s.mid), f = this._clientToRoot(...l.mid);
|
|
3638
|
+
if (b && f) {
|
|
3639
|
+
const w = this.__data__.transform;
|
|
3640
|
+
w.pan(f[0] - b[0], f[1] - b[1]), l.n === 2 && s.dist > 0 && l.dist > 0 ? this._zoomAbout((this.zoom_level || 1) * l.dist / s.dist, f[0], f[1]) : this.__children__[0].svg_element.setAttribute("transform", w.toString());
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
s = l;
|
|
3251
3644
|
});
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3645
|
+
const n = /* @__PURE__ */ c((d) => {
|
|
3646
|
+
e.delete(d.pointerId) && (s = i());
|
|
3647
|
+
}, "touchEnd");
|
|
3648
|
+
this.svg_element.addEventListener("pointerup", n), this.svg_element.addEventListener("pointercancel", n);
|
|
3649
|
+
let r = !1, a = 0, h = 0;
|
|
3650
|
+
this.svg_element.addEventListener("mousedown", (d) => {
|
|
3651
|
+
t() || (r = !0, a = d.clientX, h = d.clientY);
|
|
3255
3652
|
});
|
|
3256
|
-
let
|
|
3257
|
-
const
|
|
3258
|
-
|
|
3653
|
+
let o = null, _ = null;
|
|
3654
|
+
const m = /* @__PURE__ */ c(() => {
|
|
3655
|
+
_ && (this.__data__.transform.pan(_.dx, _.dy), this.__children__[0].svg_element.setAttribute("transform", this.__data__.transform.toString()), _ = null), o = null;
|
|
3259
3656
|
}, "panUpdate");
|
|
3260
|
-
this.svg_element.addEventListener("mousemove", (
|
|
3261
|
-
if (!
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3657
|
+
this.svg_element.addEventListener("mousemove", (d) => {
|
|
3658
|
+
if (!r) return;
|
|
3659
|
+
if (d.buttons === 0) {
|
|
3660
|
+
r = !1;
|
|
3661
|
+
return;
|
|
3662
|
+
}
|
|
3663
|
+
const l = this._clientToRoot(a, h), b = this._clientToRoot(d.clientX, d.clientY);
|
|
3664
|
+
a = d.clientX, h = d.clientY, !(!l || !b) && (_ = { dx: ((_ == null ? void 0 : _.dx) ?? 0) + b[0] - l[0], dy: ((_ == null ? void 0 : _.dy) ?? 0) + b[1] - l[1] }, o === null && (o = requestAnimationFrame(m)));
|
|
3665
|
+
}), this.svg_element.addEventListener("mouseup", (d) => {
|
|
3666
|
+
r = !1;
|
|
3667
|
+
}), this.svg_element.addEventListener("point-clicked", ((d) => {
|
|
3668
|
+
var f, w;
|
|
3669
|
+
const l = (w = (f = d.detail) == null ? void 0 : f.pointData) == null ? void 0 : w.ID;
|
|
3269
3670
|
if (!l) return;
|
|
3270
|
-
const
|
|
3271
|
-
|
|
3671
|
+
const b = this._pointLabels.get(l) ?? this._setLabels.get(l) ?? this._meanLabels.get(l.replace("mean-", "")) ?? this._nodeLabels.get(l);
|
|
3672
|
+
b && b.displayMode === q.DISPLAY_TYPES.CLICK && b.toggle();
|
|
3272
3673
|
}));
|
|
3273
|
-
const
|
|
3674
|
+
const p = /* @__PURE__ */ c((d) => {
|
|
3274
3675
|
var l;
|
|
3275
|
-
for (;
|
|
3276
|
-
const
|
|
3277
|
-
if (
|
|
3278
|
-
|
|
3676
|
+
for (; d && d !== this.svg_element; ) {
|
|
3677
|
+
const b = (l = d.getAttribute) == null ? void 0 : l.call(d, "data-point-id");
|
|
3678
|
+
if (b) return b;
|
|
3679
|
+
d = d.parentElement;
|
|
3279
3680
|
}
|
|
3280
3681
|
return null;
|
|
3281
|
-
}, "findPointId"),
|
|
3282
|
-
this.svg_element.addEventListener("mouseover", (
|
|
3283
|
-
const l =
|
|
3682
|
+
}, "findPointId"), u = /* @__PURE__ */ c((d) => this._pointLabels.get(d) ?? this._setLabels.get(d) ?? this._meanLabels.get(d.replace(/^mean-/, "")) ?? this._nodeLabels.get(d), "getAutoLabel");
|
|
3683
|
+
this.svg_element.addEventListener("mouseover", (d) => {
|
|
3684
|
+
const l = p(d.target);
|
|
3284
3685
|
if (!l) return;
|
|
3285
|
-
const
|
|
3286
|
-
(
|
|
3287
|
-
}), this.svg_element.addEventListener("mouseout", (
|
|
3288
|
-
const l =
|
|
3686
|
+
const b = u(l);
|
|
3687
|
+
(b == null ? void 0 : b.displayMode) === q.DISPLAY_TYPES.AUTO && b.show();
|
|
3688
|
+
}), this.svg_element.addEventListener("mouseout", (d) => {
|
|
3689
|
+
const l = p(d.target);
|
|
3289
3690
|
if (!l) return;
|
|
3290
|
-
const
|
|
3291
|
-
if (
|
|
3292
|
-
const
|
|
3293
|
-
(
|
|
3691
|
+
const b = d.relatedTarget;
|
|
3692
|
+
if (p(b) === l) return;
|
|
3693
|
+
const w = u(l);
|
|
3694
|
+
(w == null ? void 0 : w.displayMode) === q.DISPLAY_TYPES.AUTO && w.hide();
|
|
3294
3695
|
}), this._attachInteractionEvents();
|
|
3295
3696
|
}
|
|
3296
3697
|
/** Emit a namespaced CustomEvent on the public element (bubbles + composed). */
|
|
@@ -3347,7 +3748,7 @@ const gt = class gt extends ve {
|
|
|
3347
3748
|
a && this._emit("qe-node-click", { ...a, originalEvent: i });
|
|
3348
3749
|
});
|
|
3349
3750
|
let e = null;
|
|
3350
|
-
const s = /* @__PURE__ */
|
|
3751
|
+
const s = /* @__PURE__ */ c((i, n) => i === "edge" ? `${n.source}\0${n.target}` : String(n.id), "keyOf");
|
|
3351
3752
|
t.addEventListener("mousemove", (i) => {
|
|
3352
3753
|
const n = i.target, r = this._edgeDetail(n), a = r ? null : this._nodeDetail(n), h = r ? { type: "edge", detail: r } : a ? { type: "node", detail: a } : null, o = h ? s(h.type, h.detail) : null;
|
|
3353
3754
|
e && (!h || e.key !== o) && (this._emit(e.type === "edge" ? "qe-edge-unhover" : "qe-node-unhover", { key: e.key }), e = null), h && (!e || e.key !== o) && (this._emit(h.type === "edge" ? "qe-edge-hover" : "qe-node-hover", { ...h.detail, originalEvent: i }), e = { type: h.type, key: o }), this.hasAttribute("tooltip") && h ? this._showTooltip(this._tooltipText(h.type, h.detail), i.clientX, i.clientY) : this._hideTooltip();
|
|
@@ -3402,7 +3803,7 @@ const gt = class gt extends ve {
|
|
|
3402
3803
|
}
|
|
3403
3804
|
}
|
|
3404
3805
|
update() {
|
|
3405
|
-
this.update_extremes(), this.update_layers(), this.update_labels(), this.update_extremes(), this.update_axes(), this._applyHighlights();
|
|
3806
|
+
this.update_extremes(), this.update_layers(), [this._ciRects, this._outlierRects, this._ciCross].forEach((t) => t.forEach((e) => this._applyIntervalStroke(e))), this.update_labels(), this.update_extremes(), this.update_axes(), this._applyHighlights();
|
|
3406
3807
|
}
|
|
3407
3808
|
/**
|
|
3408
3809
|
* Axes (<qe-axes>): toggle the axis-line cross by presence, and draw/position
|
|
@@ -3410,55 +3811,58 @@ const gt = class gt extends ve {
|
|
|
3410
3811
|
* cached SVG <text> nodes in the labels group; null text removes them.
|
|
3411
3812
|
*/
|
|
3412
3813
|
update_axes() {
|
|
3413
|
-
var
|
|
3814
|
+
var m, p;
|
|
3414
3815
|
const t = this.__children__.search("__children__", "axes");
|
|
3415
3816
|
t != null && t.svg_element && (t.svg_element.style.display = this._showAxes ? "" : "none");
|
|
3416
3817
|
const e = this._labelsGroup, s = this.__data__.extremes.x_max, { cx: i, cy: n } = this.__data__.extremes;
|
|
3417
3818
|
if (!e || s <= 0) return;
|
|
3418
|
-
const r = s * 0.06, a = r * 0.6, h = /* @__PURE__ */
|
|
3419
|
-
let
|
|
3420
|
-
if (!this._showAxes ||
|
|
3421
|
-
|
|
3819
|
+
const r = s * 0.06, a = r * 0.6, h = r / (this._axesFixedSize && this.zoom_level || 1), o = h * 0.6, _ = /* @__PURE__ */ c((u, d) => {
|
|
3820
|
+
let l = this._axisLabelEls.get(u);
|
|
3821
|
+
if (!this._showAxes || d == null) {
|
|
3822
|
+
l && (l.remove(), this._axisLabelEls.delete(u));
|
|
3422
3823
|
return;
|
|
3423
3824
|
}
|
|
3424
|
-
|
|
3825
|
+
l || (l = document.createElementNS("http://www.w3.org/2000/svg", "text"), l.setAttribute("data-axis-label", u), l.setAttribute("pointer-events", "none"), e.appendChild(l), this._axisLabelEls.set(u, l)), l.textContent = d, l.setAttribute("font-size", h.toString()), l.setAttribute("font-family", "system-ui, sans-serif"), l.setAttribute("font-weight", "600"), l.setAttribute("fill", "#556"), u === "x" ? (l.setAttribute("x", (i + s - o).toString()), l.setAttribute("y", (-o).toString()), l.setAttribute("text-anchor", "end")) : (l.setAttribute("x", o.toString()), l.setAttribute("y", (n - s + h + o).toString()), l.setAttribute("text-anchor", "start"));
|
|
3425
3826
|
}, "place");
|
|
3426
|
-
if (
|
|
3427
|
-
(
|
|
3827
|
+
if (_("x", this._axisXText), _("y", this._axisYText), this._magnifyText == null)
|
|
3828
|
+
(m = this._magnifyEl) == null || m.remove(), this._magnifyEl = null;
|
|
3428
3829
|
else {
|
|
3429
3830
|
this._magnifyEl || (this._magnifyEl = document.createElementNS("http://www.w3.org/2000/svg", "text"), this._magnifyEl.setAttribute("data-magnify-label", ""), this._magnifyEl.setAttribute("pointer-events", "none")), this._magnifyEl.parentElement || e.appendChild(this._magnifyEl);
|
|
3430
3831
|
const u = this._magnifyEl;
|
|
3431
3832
|
u.textContent = this._magnifyText, u.setAttribute("font-size", (r * 0.85).toString()), u.setAttribute("font-family", "system-ui, sans-serif"), u.setAttribute("font-style", "italic"), u.setAttribute("fill", "#556"), u.setAttribute("x", (i - s + a).toString()), u.setAttribute("y", (n - s + r + a).toString()), u.setAttribute("text-anchor", "start");
|
|
3432
3833
|
}
|
|
3433
3834
|
if (!this._plotTitle)
|
|
3434
|
-
(
|
|
3835
|
+
(p = this._titleEl) == null || p.remove(), this._titleEl = null;
|
|
3435
3836
|
else {
|
|
3436
3837
|
this._titleEl || (this._titleEl = document.createElementNS("http://www.w3.org/2000/svg", "text"), this._titleEl.setAttribute("data-plot-title", ""), this._titleEl.setAttribute("pointer-events", "none")), this._titleEl.parentElement || e.appendChild(this._titleEl);
|
|
3437
|
-
const
|
|
3438
|
-
|
|
3838
|
+
const d = (this._labelFont.size ?? 12) * 1.35 * this.unitsPerPixel(), l = this._titleEl;
|
|
3839
|
+
l.textContent = this._plotTitle, l.setAttribute("font-size", d.toString()), l.setAttribute("font-family", this._labelFont.family ?? "system-ui, sans-serif"), l.setAttribute("font-weight", "600"), l.setAttribute("fill", this._labelFont.color ?? "#223"), l.setAttribute("x", i.toString()), l.setAttribute("y", (n - s + d * 1.1).toString()), l.setAttribute("text-anchor", "middle");
|
|
3439
3840
|
}
|
|
3440
3841
|
}
|
|
3441
3842
|
update_labels() {
|
|
3442
|
-
this._nodeLabels.forEach((t) => t.update()), this._meanLabels.forEach((t) => t.update()), this._pointLabels.forEach((t) => t.update());
|
|
3843
|
+
this._nodeLabels.forEach((t) => t.update()), this._meanLabels.forEach((t) => t.update()), this._pointLabels.forEach((t) => t.update()), this._setLabels.forEach((t) => t.update());
|
|
3443
3844
|
}
|
|
3444
3845
|
update_extremes() {
|
|
3445
3846
|
var s;
|
|
3446
3847
|
const t = this.__data__;
|
|
3447
|
-
if (
|
|
3848
|
+
if (this._tweenView) {
|
|
3849
|
+
const [i, n, r, a] = this._tweenView;
|
|
3850
|
+
t.extremes = new Ct(i, n, r, a);
|
|
3851
|
+
} else if (t.update_extremes(this._centerContent), this._rangeExtent && this._rangeExtent > 0) {
|
|
3448
3852
|
const { cx: i, cy: n } = t.extremes, r = this._centerContent && this._rangeMode === "network" ? t.nodeExtentFrom(i, n) * 1.2 : this._rangeExtent;
|
|
3449
|
-
t.extremes = new
|
|
3853
|
+
t.extremes = new Ct(r, r, i, n);
|
|
3450
3854
|
}
|
|
3451
3855
|
const e = (s = this.svg_element) == null ? void 0 : s.getBoundingClientRect();
|
|
3452
3856
|
if (this.svg_element && e) {
|
|
3453
|
-
|
|
3857
|
+
Qt("SVG rect: ", e);
|
|
3454
3858
|
let i, n;
|
|
3455
|
-
e.width === 0 || e.height === 0 ? (i = 1, n = 1) : (i = e.width, n = e.height), this.__data__.scale_x = 1 / (i / (4 * this.__data__.extremes.x_max)), this.__data__.scale_y = 1 / (n / (4 * this.__data__.extremes.y_max)), this.__children__[0].svg_element.setAttribute("transform", this.__data__.transform.toString()), this.svg_element.setAttribute("viewBox", this.__data__.extremes.as_viewBox());
|
|
3859
|
+
e.width === 0 || e.height === 0 ? (i = 1, n = 1) : (i = e.width, n = e.height), this.__data__.scale_x = 1 / (i / (4 * this.__data__.extremes.x_max)), this.__data__.scale_y = 1 / (n / (4 * this.__data__.extremes.y_max)), this.__children__[0].svg_element.setAttribute("transform", this.__data__.transform.toString()), this.svg_element.setAttribute("viewBox", this.__data__.extremes.as_viewBox(this._viewPadding()));
|
|
3456
3860
|
let r = this.__data__.layers.search("layers", "axis_lines");
|
|
3457
3861
|
if (r) {
|
|
3458
3862
|
let a = r.objects.get("axis-x"), h = r.objects.get("axis-y");
|
|
3459
3863
|
if (a && h) {
|
|
3460
3864
|
const o = this.__data__.extremes;
|
|
3461
|
-
a.from = new
|
|
3865
|
+
a.from = new K({ ID: "axis-x-start", dimensions: [o.cx - o.x_max, 0], classes: ["ena.dimension", "ena.dimension"] }), a.to = new K({ ID: "axis-x-end", dimensions: [o.cx + o.x_max, 0], classes: ["ena.dimension", "ena.dimension"] }), h.from = new K({ ID: "axis-y-start", dimensions: [0, o.cy - o.y_max], classes: ["ena.dimension", "ena.dimension"] }), h.to = new K({ ID: "axis-y-end", dimensions: [0, o.cy + o.y_max], classes: ["ena.dimension", "ena.dimension"] });
|
|
3462
3866
|
}
|
|
3463
3867
|
}
|
|
3464
3868
|
}
|
|
@@ -3469,8 +3873,8 @@ const gt = class gt extends ve {
|
|
|
3469
3873
|
});
|
|
3470
3874
|
}
|
|
3471
3875
|
};
|
|
3472
|
-
|
|
3473
|
-
${
|
|
3876
|
+
c(et, "QEGraphElement"), et.tagName = "qe-graph", et.style = `
|
|
3877
|
+
${ze.style}
|
|
3474
3878
|
|
|
3475
3879
|
:host {
|
|
3476
3880
|
display: block;
|
|
@@ -3486,40 +3890,60 @@ _(gt, "QEGraphElement"), gt.tagName = "qe-graph", gt.style = `
|
|
|
3486
3890
|
height: 100%;
|
|
3487
3891
|
aspect-ratio: 1 / 1;
|
|
3488
3892
|
background-color: #FFF;
|
|
3893
|
+
/* Touch pans and pinch-zooms the plot, not the page; a double-click
|
|
3894
|
+
zooms instead of selecting label text. */
|
|
3895
|
+
touch-action: none;
|
|
3896
|
+
-webkit-user-select: none;
|
|
3897
|
+
user-select: none;
|
|
3898
|
+
}
|
|
3899
|
+
|
|
3900
|
+
/* Marks that emit qe-node-click / qe-edge-click: nodes, means, points,
|
|
3901
|
+
edges, their hover lines and self-connection dots. Custom properties
|
|
3902
|
+
cross the shadow boundary, so a host can set --qe-mark-cursor on
|
|
3903
|
+
<qe-graph>. Labels keep their own grab / grabbing cursor. */
|
|
3904
|
+
svg [data-point-id],
|
|
3905
|
+
svg [data-edge-source] {
|
|
3906
|
+
cursor: var(--qe-mark-cursor, pointer);
|
|
3907
|
+
}
|
|
3908
|
+
|
|
3909
|
+
/* A directed edge's chevron sits on top of its triangle without the
|
|
3910
|
+
edge's identity; let clicks and the cursor reach the triangle. */
|
|
3911
|
+
svg [data-layer-name="edges"] path:not([data-edge-source]) {
|
|
3912
|
+
pointer-events: none;
|
|
3489
3913
|
}
|
|
3490
|
-
`,
|
|
3491
|
-
let
|
|
3492
|
-
customElements.define(
|
|
3493
|
-
const
|
|
3914
|
+
`, et._instances = /* @__PURE__ */ new Set(), et._PATH_NUM_RE = /-?\d*\.?\d+(?:e[-+]?\d+)?/gi;
|
|
3915
|
+
let ee = et;
|
|
3916
|
+
customElements.define(ee.tagName, ee);
|
|
3917
|
+
const Hi = /* @__PURE__ */ c((g) => ee.getGraph(g), "getGraph"), Vi = /* @__PURE__ */ c(() => ee.instances(), "getGraphs");
|
|
3494
3918
|
export {
|
|
3495
3919
|
st as Color,
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3920
|
+
Xt as DataFrame,
|
|
3921
|
+
Me as DataFrameColumn,
|
|
3922
|
+
bi as DataFrameColumnType,
|
|
3923
|
+
Jt as DataFrameRow,
|
|
3924
|
+
Pe as Edge,
|
|
3925
|
+
is as Graph,
|
|
3926
|
+
Ye as QEAxesElement,
|
|
3927
|
+
De as QEEdgesElement,
|
|
3928
|
+
ee as QEGraphElement,
|
|
3929
|
+
as as QELayer,
|
|
3930
|
+
Mt as QELine,
|
|
3931
|
+
Te as QEMeansElement,
|
|
3932
|
+
$e as QENodesElement,
|
|
3933
|
+
ue as QEPoint,
|
|
3934
|
+
Fe as QEPointsElement,
|
|
3935
|
+
je as QETrajectoriesElement,
|
|
3936
|
+
Re as QETrajectory,
|
|
3937
|
+
Ie as QEVisualElement,
|
|
3938
|
+
xi as TRAJECTORY_ZERO_EPS,
|
|
3939
|
+
Oe as Trajectory,
|
|
3940
|
+
Ne as WeightedColor,
|
|
3941
|
+
Si as fitTrajectory,
|
|
3942
|
+
Hi as getGraph,
|
|
3943
|
+
Vi as getGraphs,
|
|
3944
|
+
ti as nearOriginFilter,
|
|
3945
|
+
si as sampleCurve,
|
|
3946
|
+
Ai as selectDegree,
|
|
3947
|
+
Wi as vizENA
|
|
3524
3948
|
};
|
|
3525
3949
|
//# sourceMappingURL=qeviz.es.js.map
|