@qe-libs/qeviz 0.5.5 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/qeviz.es.js +938 -878
- package/dist/qeviz.es.js.map +1 -1
- package/dist/qeviz.umd.js +5 -5
- package/dist/qeviz.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/qeviz.es.js
CHANGED
|
@@ -2,89 +2,89 @@ var ri = Object.defineProperty;
|
|
|
2
2
|
var Fs = (d) => {
|
|
3
3
|
throw TypeError(d);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
5
|
+
var _ = (d, t) => ri(d, "name", { value: t, configurable: !0 });
|
|
6
6
|
var js = (d, t, e) => t.has(d) || Fs("Cannot " + e);
|
|
7
|
-
var k = (d, t, e) => (js(d, t, "read from private field"), e ? e.call(d) : t.get(d)),
|
|
8
|
-
var
|
|
7
|
+
var k = (d, t, e) => (js(d, t, "read from private field"), e ? e.call(d) : t.get(d)), et = (d, t, e) => t.has(d) ? Fs("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(d) : t.set(d, e), H = (d, t, e, s) => (js(d, t, "write to private field"), s ? s.call(d, e) : t.set(d, e), e);
|
|
8
|
+
var ae, he, le, bt, ce;
|
|
9
9
|
const es = class es extends Array {
|
|
10
10
|
constructor(e, s, i, n, r) {
|
|
11
11
|
super(...s);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
et(this, ae);
|
|
13
|
+
et(this, he);
|
|
14
|
+
et(this, le);
|
|
15
|
+
et(this, bt);
|
|
16
|
+
et(this, ce);
|
|
17
|
+
H(this, le, e), H(this, he, i), H(this, bt, n), H(this, ce, n == null ? void 0 : n.classes), H(this, ae, r);
|
|
18
18
|
}
|
|
19
19
|
get parent() {
|
|
20
|
-
return k(this,
|
|
20
|
+
return k(this, bt);
|
|
21
21
|
}
|
|
22
22
|
get names() {
|
|
23
|
-
return k(this,
|
|
23
|
+
return k(this, le);
|
|
24
24
|
}
|
|
25
25
|
get rowName() {
|
|
26
|
-
return k(this,
|
|
26
|
+
return k(this, he);
|
|
27
27
|
}
|
|
28
28
|
get types() {
|
|
29
|
-
if (!k(this,
|
|
30
|
-
return k(this,
|
|
29
|
+
if (!k(this, bt)) throw new Error("No parent DataFrame attached to this row.");
|
|
30
|
+
return k(this, bt).types;
|
|
31
31
|
}
|
|
32
32
|
get classes() {
|
|
33
|
-
return k(this,
|
|
33
|
+
return k(this, ce);
|
|
34
34
|
}
|
|
35
35
|
get rowNumber() {
|
|
36
|
-
return k(this,
|
|
36
|
+
return k(this, ae);
|
|
37
37
|
}
|
|
38
38
|
col(e) {
|
|
39
|
-
if (!k(this,
|
|
40
|
-
return k(this,
|
|
39
|
+
if (!k(this, bt)) throw new Error("No parent DataFrame attached to this row.");
|
|
40
|
+
return k(this, bt).col(e);
|
|
41
41
|
}
|
|
42
42
|
cols(...e) {
|
|
43
|
-
if (!k(this,
|
|
44
|
-
return k(this,
|
|
43
|
+
if (!k(this, bt)) throw new Error("No parent DataFrame attached to this row.");
|
|
44
|
+
return k(this, bt).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 oi = /* @__PURE__ */ ((d) => (d.Character = "character", d.Double = "double", d.Logical = "logical", d.Integer = "integer", d))(oi || {}),
|
|
50
|
+
ae = new WeakMap(), he = new WeakMap(), le = new WeakMap(), bt = new WeakMap(), ce = new WeakMap(), _(es, "DataFrameRow");
|
|
51
|
+
let Ht = es;
|
|
52
|
+
var oi = /* @__PURE__ */ ((d) => (d.Character = "character", d.Double = "double", d.Logical = "logical", d.Integer = "integer", d))(oi || {}), ue, yt, Ut, Nt;
|
|
53
53
|
const ss = class ss extends Array {
|
|
54
54
|
constructor(e, s, i, n) {
|
|
55
55
|
super(s.length);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
et(this, ue);
|
|
57
|
+
et(this, yt);
|
|
58
|
+
et(this, Ut);
|
|
59
|
+
et(this, Nt);
|
|
60
60
|
for (let r = 0; r < s.length; r++)
|
|
61
61
|
this[r] = s[r];
|
|
62
|
-
if (
|
|
62
|
+
if (H(this, ue, e), s.type !== void 0 ? H(this, yt, s.type) : s.every((r) => typeof r == "string" || r === null || r === void 0) ? H(this, yt, "character") : s.every((r) => Number.isInteger(r) || r === null || r === void 0) ? s.every((r) => r === 0 || r === 1 || r === null || r === void 0) ? H(this, yt, "logical") : H(this, yt, "integer") : s.every((r) => typeof r == "number" || r === null || r === void 0) ? H(this, yt, "double") : s.every((r) => typeof r == "boolean" || r === null || r === void 0) ? H(this, yt, "logical") : H(this, yt, "character"), H(this, Nt, 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 ? H(this, Ut, i) : H(this, Ut, void 0);
|
|
65
65
|
}
|
|
66
66
|
get name() {
|
|
67
|
-
return k(this,
|
|
67
|
+
return k(this, ue);
|
|
68
68
|
}
|
|
69
69
|
get type() {
|
|
70
|
-
return k(this,
|
|
70
|
+
return k(this, yt);
|
|
71
71
|
}
|
|
72
72
|
get rowNames() {
|
|
73
|
-
return k(this,
|
|
73
|
+
return k(this, Ut);
|
|
74
74
|
}
|
|
75
75
|
row(e) {
|
|
76
|
-
if (!k(this,
|
|
77
|
-
return k(this,
|
|
76
|
+
if (!k(this, Nt)) throw new Error("No parent DataFrame attached to this column.");
|
|
77
|
+
return k(this, Nt).row(e);
|
|
78
78
|
}
|
|
79
79
|
rows(...e) {
|
|
80
|
-
if (!k(this,
|
|
81
|
-
return k(this,
|
|
80
|
+
if (!k(this, Nt)) throw new Error("No parent DataFrame attached to this column.");
|
|
81
|
+
return k(this, Nt).rows(...e);
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
|
|
85
|
-
let
|
|
86
|
-
var
|
|
87
|
-
const
|
|
84
|
+
ue = new WeakMap(), yt = new WeakMap(), Ut = new WeakMap(), Nt = new WeakMap(), _(ss, "DataFrameColumn");
|
|
85
|
+
let ye = ss;
|
|
86
|
+
var Et, ct, _e;
|
|
87
|
+
const Zt = class Zt 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 Jt = class Jt extends Array {
|
|
|
97
97
|
s = r;
|
|
98
98
|
}
|
|
99
99
|
super(s.length);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
et(this, Et);
|
|
101
|
+
et(this, ct);
|
|
102
|
+
et(this, _e);
|
|
103
103
|
if (s.forEach((r, a) => {
|
|
104
|
-
r instanceof
|
|
105
|
-
}),
|
|
104
|
+
r instanceof ye ? this[a] = r : this[a] = new ye(e[a], r, i, this);
|
|
105
|
+
}), H(this, Et, 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 && H(this, ct, 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 && H(this, _e, n);
|
|
110
110
|
}
|
|
111
111
|
get classes() {
|
|
112
112
|
return k(this, _e);
|
|
113
113
|
}
|
|
114
114
|
getColumnByName(e) {
|
|
115
|
-
const s = k(this,
|
|
115
|
+
const s = k(this, Et).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 Ht(k(this, Et), [], 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 Ht(k(this, Et), s, k(this, ct) ? k(this, ct)[e] : void 0, this, e);
|
|
127
127
|
}
|
|
128
128
|
getRowByName(e) {
|
|
129
|
-
if (!k(this,
|
|
130
|
-
const s = k(this,
|
|
129
|
+
if (!k(this, ct)) return;
|
|
130
|
+
const s = k(this, ct).indexOf(e);
|
|
131
131
|
if (s !== -1)
|
|
132
132
|
return this.getRowByIndex(s);
|
|
133
133
|
}
|
|
@@ -157,11 +157,11 @@ const Jt = class Jt 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 = k(this,
|
|
160
|
+
i = Array.from({ length: r }, (a, h) => this.getRowByIndex(h)), n = k(this, ct);
|
|
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 k(this,
|
|
164
|
+
return k(this, ct) && h && (n == null || n.push(k(this, ct)[a])), h;
|
|
165
165
|
}).filter((r) => r !== void 0);
|
|
166
166
|
return i;
|
|
167
167
|
}
|
|
@@ -173,21 +173,21 @@ const Jt = class Jt extends Array {
|
|
|
173
173
|
}
|
|
174
174
|
cols(...e) {
|
|
175
175
|
let s, i, n = [];
|
|
176
|
-
return e.length === 0 ? (i = this.slice(), n = k(this,
|
|
176
|
+
return e.length === 0 ? (i = this.slice(), n = k(this, Et)) : (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 Zt(n, i, k(this, ct));
|
|
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 Zt(
|
|
181
181
|
i.map((n) => n.name),
|
|
182
182
|
i.map((n) => n.values),
|
|
183
|
-
k(this,
|
|
183
|
+
k(this, ct)
|
|
184
184
|
);
|
|
185
185
|
}
|
|
186
186
|
get names() {
|
|
187
|
-
return k(this,
|
|
187
|
+
return k(this, Et);
|
|
188
188
|
}
|
|
189
189
|
get rowNames() {
|
|
190
|
-
return k(this,
|
|
190
|
+
return k(this, ct);
|
|
191
191
|
}
|
|
192
192
|
get nrow() {
|
|
193
193
|
return this[0] ? this[0].length : 0;
|
|
@@ -196,11 +196,11 @@ const Jt = class Jt extends Array {
|
|
|
196
196
|
return this.length;
|
|
197
197
|
}
|
|
198
198
|
};
|
|
199
|
-
|
|
200
|
-
let
|
|
199
|
+
Et = new WeakMap(), ct = new WeakMap(), _e = new WeakMap(), _(Zt, "DataFrame");
|
|
200
|
+
let Yt = Zt;
|
|
201
201
|
const is = class is {
|
|
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 Yt(), this._nodes = t.nodes ?? new Yt(), this._edges = t.edges ?? new Yt(), 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
|
-
|
|
288
|
+
_(is, "Model");
|
|
289
289
|
let Xe = is;
|
|
290
290
|
const ai = globalThis.__QEVIZ_DEBUG__ === !0;
|
|
291
291
|
function Ys(...d) {
|
|
292
292
|
ai && console.log(...d);
|
|
293
293
|
}
|
|
294
|
-
|
|
294
|
+
_(Ys, "dbg");
|
|
295
295
|
const Pi = {
|
|
296
|
-
get: /* @__PURE__ */
|
|
296
|
+
get: /* @__PURE__ */ _((d) => {
|
|
297
297
|
const t = [...document.querySelectorAll("qe-graph")];
|
|
298
298
|
return typeof d == "number" && d >= 0 ? t[d] : t;
|
|
299
299
|
}, "get")
|
|
300
|
-
},
|
|
300
|
+
}, zt = class zt extends HTMLElement {
|
|
301
301
|
constructor() {
|
|
302
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 Xe();
|
|
303
303
|
const t = this.attachShadow({ mode: "open" }), e = document.createElement("style");
|
|
304
|
-
e.textContent =
|
|
304
|
+
e.textContent = zt.styles, t.appendChild(e), this._outputElement = document.createElement("div"), t.appendChild(this._outputElement);
|
|
305
305
|
}
|
|
306
306
|
static get observedAttributes() {
|
|
307
307
|
return ["updated"];
|
|
@@ -349,40 +349,40 @@ const Pi = {
|
|
|
349
349
|
setModelData(t) {
|
|
350
350
|
var r, a, h, o;
|
|
351
351
|
["nodes", "edges", "points", "groups", "confidence", "outlier", "trajectories", "networks", "pointsets"].forEach((l) => {
|
|
352
|
-
var
|
|
353
|
-
const
|
|
354
|
-
if (!((
|
|
355
|
-
const g =
|
|
356
|
-
let
|
|
357
|
-
l === "networks" ?
|
|
358
|
-
const
|
|
359
|
-
this._model.setByKey(l, new
|
|
352
|
+
var E;
|
|
353
|
+
const u = t[l];
|
|
354
|
+
if (!((E = u == null ? void 0 : u.data) != null && E.length)) return;
|
|
355
|
+
const g = u.data, c = u.types || {}, v = Object.keys(g[0]), m = g.map((j) => Object.values(j)), A = v.map((j) => c[j] ?? "character");
|
|
356
|
+
let O;
|
|
357
|
+
l === "networks" ? O = "name" : l === "pointsets" ? O = "id" : l === "nodes" ? O = t.node_id_col ?? v.find((j) => (c[j] ?? "character") === "character") : l === "edges" || l === "points" || l === "trajectories" ? O = t.id_col ?? v.find((j) => (c[j] ?? "character") === "character") : O = t.group_col ?? v.find((j) => (c[j] ?? "character") === "character");
|
|
358
|
+
const F = O ? v.indexOf(O) : 0, Y = m.map((j) => String(j[F]));
|
|
359
|
+
this._model.setByKey(l, new Yt(v, m, Y, A));
|
|
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
362
|
this._model.node_id_col = t.node_id_col ?? ((r = s == null ? void 0 : s.names) == null ? void 0 : r.find((l) => {
|
|
363
|
-
var
|
|
364
|
-
return ((
|
|
363
|
+
var u;
|
|
364
|
+
return ((u = s.col(l)) == null ? void 0 : u.type) === "character";
|
|
365
365
|
})) ?? "id";
|
|
366
366
|
const i = this._model.points;
|
|
367
367
|
this._model.unit_id_col = t.id_col ?? ((a = i == null ? void 0 : i.names) == null ? void 0 : a.find((l) => {
|
|
368
|
-
var
|
|
369
|
-
return ((
|
|
368
|
+
var u;
|
|
369
|
+
return ((u = i.col(l)) == null ? void 0 : u.type) === "character";
|
|
370
370
|
})) ?? "id";
|
|
371
371
|
const n = this._model.unit_id_col;
|
|
372
372
|
if (this._model.group_col = t.group_col ?? ((h = i == null ? void 0 : i.names) == null ? void 0 : h.find((l) => {
|
|
373
|
-
var
|
|
374
|
-
return l !== n && ((
|
|
373
|
+
var u;
|
|
374
|
+
return l !== n && ((u = i.col(l)) == null ? void 0 : u.type) === "character";
|
|
375
375
|
})) ?? null, (o = s == null ? void 0 : s.names) != null && o.length) {
|
|
376
|
-
const l = this._model.node_id_col,
|
|
377
|
-
if (
|
|
378
|
-
this._model.dimensions = [
|
|
376
|
+
const l = this._model.node_id_col, u = t.x_col, g = t.y_col;
|
|
377
|
+
if (u && g)
|
|
378
|
+
this._model.dimensions = [u, g];
|
|
379
379
|
else {
|
|
380
|
-
const c = s.names.filter((
|
|
381
|
-
if (
|
|
382
|
-
const
|
|
383
|
-
return
|
|
380
|
+
const c = s.names.filter((v) => {
|
|
381
|
+
if (v === l) return !1;
|
|
382
|
+
const m = s.col(v);
|
|
383
|
+
return m && m.type !== "character" && m.type !== "logical";
|
|
384
384
|
});
|
|
385
|
-
c.length >= 2 && (this._model.dimensions = [
|
|
385
|
+
c.length >= 2 && (this._model.dimensions = [u ?? c[0], g ?? c[1]]);
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
this.updated = this._model.updated !== void 0 ? String(this._model.updated) : String(Date.now()), Ys("Model updated via setModelData:", this.updated), this.render();
|
|
@@ -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
|
+
_(zt, "QEVisualElement"), zt.tagName = "qe-visual", zt.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,14 +406,14 @@ u(Tt, "QEVisualElement"), Tt.tagName = "qe-visual", Tt.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(
|
|
411
|
-
const
|
|
409
|
+
let xe = zt;
|
|
410
|
+
customElements.define(xe.tagName, xe);
|
|
411
|
+
const dt = class dt {
|
|
412
412
|
constructor(t) {
|
|
413
413
|
return this.base = typeof t == "string" ? t : t.base, new Proxy(this, {
|
|
414
414
|
get(e, s) {
|
|
415
415
|
if (typeof s == "string" && /^[0-2]$/.test(s)) {
|
|
416
|
-
const { r: i, g: n, b: r } =
|
|
416
|
+
const { r: i, g: n, b: r } = dt.parseColor(e.base);
|
|
417
417
|
return [i, n, r][Number(s)];
|
|
418
418
|
}
|
|
419
419
|
return e[s];
|
|
@@ -427,29 +427,49 @@ const Re = class Re {
|
|
|
427
427
|
this.base = t;
|
|
428
428
|
}
|
|
429
429
|
static parseColor(t) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
g: e >> 8 & 255,
|
|
435
|
-
b: e & 255
|
|
436
|
-
};
|
|
430
|
+
const e = String(t).trim();
|
|
431
|
+
if (/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(e)) {
|
|
432
|
+
const n = parseInt(e.slice(1, 7), 16);
|
|
433
|
+
return { r: n >> 16 & 255, g: n >> 8 & 255, b: n & 255 };
|
|
437
434
|
}
|
|
438
|
-
|
|
435
|
+
if (/^#[0-9a-f]{3}$/i.test(e)) {
|
|
436
|
+
const [n, r, a] = [1, 2, 3].map((h) => parseInt(e[h] + e[h], 16));
|
|
437
|
+
return { r: n, g: r, b: a };
|
|
438
|
+
}
|
|
439
|
+
const s = e.match(/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i);
|
|
440
|
+
if (s) return { r: Math.round(+s[1]), g: Math.round(+s[2]), b: Math.round(+s[3]) };
|
|
441
|
+
const i = dt.resolveCss(e);
|
|
442
|
+
if (i) return dt.parseColor(i);
|
|
443
|
+
throw new Error(`Unsupported color format: ${t}`);
|
|
444
|
+
}
|
|
445
|
+
/** A CSS colour as "#rrggbb" / "rgba(...)", or null if it isn't one. */
|
|
446
|
+
static resolveCss(t) {
|
|
447
|
+
if (dt._cssCache.has(t)) return dt._cssCache.get(t);
|
|
448
|
+
dt._ctx === void 0 && (dt._ctx = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null);
|
|
449
|
+
let e = null;
|
|
450
|
+
const s = dt._ctx;
|
|
451
|
+
if (s) {
|
|
452
|
+
s.fillStyle = "#000000", s.fillStyle = t;
|
|
453
|
+
const i = s.fillStyle;
|
|
454
|
+
s.fillStyle = "#ffffff", s.fillStyle = t;
|
|
455
|
+
const n = s.fillStyle;
|
|
456
|
+
i === n && (e = String(i));
|
|
457
|
+
}
|
|
458
|
+
return dt._cssCache.set(t, e), e;
|
|
439
459
|
}
|
|
440
460
|
static rgb(t, e, s) {
|
|
441
461
|
return `rgb(${t}, ${e}, ${s})`;
|
|
442
462
|
}
|
|
443
463
|
};
|
|
444
|
-
|
|
445
|
-
let
|
|
446
|
-
const
|
|
464
|
+
_(dt, "Color"), dt._cssCache = /* @__PURE__ */ new Map();
|
|
465
|
+
let st = dt;
|
|
466
|
+
const Qt = class Qt extends st {
|
|
447
467
|
constructor(t, e, s) {
|
|
448
468
|
super(t), this.weight = e, this.alpha = s;
|
|
449
469
|
}
|
|
450
470
|
// Parse hex → HSV (h in [0, 360), s/v in [0, 1]).
|
|
451
471
|
static toHSV(t) {
|
|
452
|
-
const { r: e, g: s, b: i } =
|
|
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), l = h - o, u = h, g = h === 0 ? 0 : l / h;
|
|
453
473
|
let c = 0;
|
|
454
474
|
if (l > 0)
|
|
455
475
|
switch (h) {
|
|
@@ -462,7 +482,7 @@ const Zt = class Zt extends et {
|
|
|
462
482
|
default:
|
|
463
483
|
c = ((n - r) / l + 4) / 6;
|
|
464
484
|
}
|
|
465
|
-
return { h: c * 360, s: g, v:
|
|
485
|
+
return { h: c * 360, s: g, v: u };
|
|
466
486
|
}
|
|
467
487
|
// Convert HSV + alpha → rgba() CSS string.
|
|
468
488
|
static hsvToRgba(t, e, s, i) {
|
|
@@ -481,12 +501,12 @@ const Zt = class Zt extends et {
|
|
|
481
501
|
// #EE6677 have HSL lightness ≈ 67%, so 100% HSL saturation still looks
|
|
482
502
|
// washed-out, whereas HSV value ≈ 0.93 gives the expected vivid output.
|
|
483
503
|
toString() {
|
|
484
|
-
const { h: t, v: e } =
|
|
485
|
-
return
|
|
504
|
+
const { h: t, v: e } = Qt.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 Qt.hsvToRgba(t, s, e, i);
|
|
486
506
|
}
|
|
487
507
|
};
|
|
488
|
-
|
|
489
|
-
let
|
|
508
|
+
_(Qt, "WeightedColor");
|
|
509
|
+
let we = Qt;
|
|
490
510
|
const ns = class ns {
|
|
491
511
|
constructor(t = null) {
|
|
492
512
|
this._values = [1, 0, 0, 1, 0, 0], this._keys = ["a", "b", "c", "d", "e", "f"], t && (this.values = t);
|
|
@@ -564,134 +584,134 @@ const ns = class ns {
|
|
|
564
584
|
return this.get("f");
|
|
565
585
|
}
|
|
566
586
|
};
|
|
567
|
-
|
|
568
|
-
let
|
|
569
|
-
var
|
|
587
|
+
_(ns, "Transform");
|
|
588
|
+
let se = ns;
|
|
589
|
+
var ie;
|
|
570
590
|
((d) => {
|
|
571
591
|
((t) => {
|
|
572
592
|
function e(s) {
|
|
573
593
|
return `matrix(${["a", "b", "c", "d", "e", "f"].map((n) => s[n]).join(" ")})`;
|
|
574
594
|
}
|
|
575
|
-
|
|
595
|
+
_(e, "matrixString"), t.matrixString = e;
|
|
576
596
|
})(d.Matrix || (d.Matrix = {})), ((t) => {
|
|
577
597
|
((s) => {
|
|
578
598
|
function i(r, a, h) {
|
|
579
599
|
const o = e.toRad(a);
|
|
580
600
|
return [r[0] + h * Math.cos(o), r[1] + h * Math.sin(o)];
|
|
581
601
|
}
|
|
582
|
-
|
|
602
|
+
_(i, "translate"), s.translate = i;
|
|
583
603
|
function n(r, a, h) {
|
|
584
604
|
const o = e.toRad(a);
|
|
585
|
-
function l(
|
|
605
|
+
function l(u, g) {
|
|
586
606
|
return [
|
|
587
|
-
|
|
588
|
-
|
|
607
|
+
u[0] * Math.cos(g) - u[1] * Math.sin(g),
|
|
608
|
+
u[0] * Math.sin(g) + u[1] * Math.cos(g)
|
|
589
609
|
];
|
|
590
610
|
}
|
|
591
|
-
if (
|
|
611
|
+
if (_(l, "rotatePoint"), !h || h[0] === 0 && h[1] === 0)
|
|
592
612
|
return l(r, o);
|
|
593
613
|
{
|
|
594
|
-
const
|
|
595
|
-
return l(
|
|
614
|
+
const u = r.map((c, v) => c - h[v]);
|
|
615
|
+
return l(u, o).map((c, v) => c + h[v]);
|
|
596
616
|
}
|
|
597
617
|
}
|
|
598
|
-
|
|
618
|
+
_(n, "rotate"), s.rotate = n;
|
|
599
619
|
})(t.Point || (t.Point = {})), ((s) => {
|
|
600
|
-
function i(
|
|
601
|
-
return (
|
|
620
|
+
function i(m, A) {
|
|
621
|
+
return (A[1] - m[1]) / (A[0] - m[0]);
|
|
602
622
|
}
|
|
603
|
-
|
|
604
|
-
function n(
|
|
605
|
-
const
|
|
606
|
-
return
|
|
623
|
+
_(i, "slope"), s.slope = i;
|
|
624
|
+
function n(m, A) {
|
|
625
|
+
const O = i(m, A);
|
|
626
|
+
return m[1] - O * m[0];
|
|
607
627
|
}
|
|
608
|
-
|
|
609
|
-
function r(
|
|
628
|
+
_(n, "intercept"), s.intercept = n;
|
|
629
|
+
function r(m, A) {
|
|
610
630
|
return {
|
|
611
|
-
slope: i(
|
|
612
|
-
intercept: n(
|
|
631
|
+
slope: i(m, A),
|
|
632
|
+
intercept: n(m, A)
|
|
613
633
|
};
|
|
614
634
|
}
|
|
615
|
-
|
|
616
|
-
function a(
|
|
617
|
-
const
|
|
618
|
-
return [
|
|
635
|
+
_(r, "slopeIntercept"), s.slopeIntercept = r;
|
|
636
|
+
function a(m, A = 0) {
|
|
637
|
+
const O = A, F = (1 - O) * m[0][0] + O * m[1][0], Y = (1 - O) * m[0][1] + O * m[1][1];
|
|
638
|
+
return [F, Y];
|
|
619
639
|
}
|
|
620
|
-
|
|
621
|
-
function h(
|
|
622
|
-
return Array.isArray(
|
|
640
|
+
_(a, "point_along"), s.point_along = a;
|
|
641
|
+
function h(m, A, O = 0.5) {
|
|
642
|
+
return Array.isArray(m[0]) && (A = m[1], m = m[0]), [0, 1].map((F) => (parseFloat(m[F]) + parseFloat(A[F])) * O);
|
|
623
643
|
}
|
|
624
|
-
|
|
625
|
-
function o(
|
|
626
|
-
return Array.isArray(
|
|
627
|
-
[0, 1].map((
|
|
644
|
+
_(h, "midpoint"), s.midpoint = h;
|
|
645
|
+
function o(m, A) {
|
|
646
|
+
return Array.isArray(m[0]) && (A = m[1], m = m[0]), Math.sqrt(
|
|
647
|
+
[0, 1].map((O) => Math.pow(A[O] - m[O], 2)).reduce((O, F) => O + F, 0)
|
|
628
648
|
);
|
|
629
649
|
}
|
|
630
|
-
|
|
631
|
-
function l(
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
|
|
650
|
+
_(o, "length"), s.length = o;
|
|
651
|
+
function l(m, A = [0, 0]) {
|
|
652
|
+
const O = [
|
|
653
|
+
m[1][0] - A[0],
|
|
654
|
+
m[1][1] - A[1]
|
|
655
|
+
], F = [
|
|
656
|
+
-O[1],
|
|
657
|
+
O[0]
|
|
635
658
|
], Y = [
|
|
636
|
-
-
|
|
637
|
-
|
|
638
|
-
],
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
], S = [
|
|
642
|
-
Y[0] + v[0],
|
|
643
|
-
Y[1] + v[1]
|
|
659
|
+
-F[0],
|
|
660
|
+
-F[1]
|
|
661
|
+
], E = [
|
|
662
|
+
F[0] + A[0],
|
|
663
|
+
F[1] + A[1]
|
|
644
664
|
], j = [
|
|
645
|
-
|
|
646
|
-
|
|
665
|
+
Y[0] + A[0],
|
|
666
|
+
Y[1] + A[1]
|
|
647
667
|
];
|
|
648
|
-
return [
|
|
668
|
+
return [E, j];
|
|
649
669
|
}
|
|
650
|
-
|
|
651
|
-
function
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
-
const nt = [
|
|
655
|
-
(
|
|
656
|
-
),
|
|
657
|
-
(
|
|
670
|
+
_(l, "rotate"), s.rotate = l;
|
|
671
|
+
function u(m, A, O = 90) {
|
|
672
|
+
const F = d.Geometry.Line.slope(m[0], m[1]), Y = d.Geometry.Line.intercept(m[0], m[1]), E = [0, Y], j = [1, F + Y];
|
|
673
|
+
m = [E, j];
|
|
674
|
+
const nt = [m[0][0], m[1][0]], ot = [m[0][1], m[1][1]], it = A[0], ut = A[1], K = -2 * Math.PI * O / 360, It = nt.map(
|
|
675
|
+
(ge, _t) => (ge - it) * Math.cos(K) - (ot[_t] - ut) * Math.sin(K) + it
|
|
676
|
+
), Ot = ot.map(
|
|
677
|
+
(ge, _t) => (nt[_t] - it) * Math.sin(K) - (ge - ut) * Math.cos(K) + ut
|
|
658
678
|
);
|
|
659
679
|
return [
|
|
660
|
-
[
|
|
661
|
-
[
|
|
680
|
+
[It[0], Ot[0]],
|
|
681
|
+
[It[1], Ot[1]]
|
|
662
682
|
];
|
|
663
683
|
}
|
|
664
|
-
u
|
|
665
|
-
function g(
|
|
666
|
-
const [[
|
|
667
|
-
return [
|
|
684
|
+
_(u, "rotate2"), s.rotate2 = u;
|
|
685
|
+
function g(m, A) {
|
|
686
|
+
const [[O, F], [Y, E]] = m, [[j, nt], [ot, it]] = A, ut = (O - Y) * (nt - it) - (F - E) * (j - ot), K = (O * E - F * Y) * (j - ot) - (O - Y) * (j * it - nt * ot), It = (O * E - F * Y) * (nt - it) - (F - E) * (j * it - nt * ot);
|
|
687
|
+
return [K / ut, It / ut];
|
|
668
688
|
}
|
|
669
|
-
|
|
670
|
-
function c(
|
|
671
|
-
let { slope:
|
|
672
|
-
if (Math.sqrt(Math.pow(j, 2) - 4 *
|
|
673
|
-
let
|
|
674
|
-
|
|
689
|
+
_(g, "intersection"), s.intersection = g;
|
|
690
|
+
function c(m, A, O) {
|
|
691
|
+
let { slope: F, intercept: Y } = d.Geometry.Line.slopeIntercept(m[0], m[1]), E = 1 + Math.pow(F, 2), j = 2 * F * Y - 2 * A[1] * F - 2 * A[0], nt = Math.pow(A[0], 2) + Math.pow(Y, 2) + Math.pow(A[1], 2) - 2 * A[1] * Y - Math.pow(O, 2), ot = [[1 / 0, 1 / 0], [1 / 0, 1 / 0]];
|
|
692
|
+
if (Math.sqrt(Math.pow(j, 2) - 4 * E * nt) >= 0) {
|
|
693
|
+
let it = (-j + Math.sqrt(Math.pow(j, 2) - 4 * E * nt)) / (2 * E), ut = (-j - Math.sqrt(Math.pow(j, 2) - 4 * E * nt)) / (2 * E), K = F * it + Y, It = F * ut + Y;
|
|
694
|
+
ot = [[it, K], [ut, It]];
|
|
675
695
|
} else
|
|
676
696
|
console.error("The line and the circumference do not intersect");
|
|
677
|
-
return
|
|
697
|
+
return ot;
|
|
678
698
|
}
|
|
679
|
-
|
|
680
|
-
function
|
|
681
|
-
return (
|
|
699
|
+
_(c, "intersect_circle"), s.intersect_circle = c;
|
|
700
|
+
function v(m) {
|
|
701
|
+
return (A) => A === 0 ? m[0] : A === 1 ? m[1] : d.Geometry.Point.translate(m[0], d.Geometry.Angle.line(m), d.Geometry.Line.length(m) * A);
|
|
682
702
|
}
|
|
683
|
-
|
|
703
|
+
_(v, "interpolate"), s.interpolate = v;
|
|
684
704
|
})(t.Line || (t.Line = {}));
|
|
685
705
|
let e;
|
|
686
706
|
((s) => {
|
|
687
707
|
function i(a) {
|
|
688
708
|
return a / 180 * Math.PI;
|
|
689
709
|
}
|
|
690
|
-
|
|
710
|
+
_(i, "toRad"), s.toRad = i;
|
|
691
711
|
function n(a) {
|
|
692
712
|
return a * 180 / Math.PI;
|
|
693
713
|
}
|
|
694
|
-
|
|
714
|
+
_(n, "toDeg"), s.toDeg = n;
|
|
695
715
|
function r(a) {
|
|
696
716
|
if (a.length !== 2 || !Array.isArray(a[0]) || !Array.isArray(a[1]) || a[0].length !== 2 || a[1].length !== 2)
|
|
697
717
|
throw new Error("Invalid line format. Expected [[x1, y1], [x2, y2]].");
|
|
@@ -699,13 +719,13 @@ var se;
|
|
|
699
719
|
Math.atan2(a[1][1] - a[0][1], a[1][0] - a[0][0])
|
|
700
720
|
);
|
|
701
721
|
}
|
|
702
|
-
|
|
722
|
+
_(r, "line"), s.line = r;
|
|
703
723
|
})(e = t.Angle || (t.Angle = {}));
|
|
704
724
|
})(d.Geometry || (d.Geometry = {})), ((t) => {
|
|
705
725
|
function e(n) {
|
|
706
726
|
return [...new Set(n)];
|
|
707
727
|
}
|
|
708
|
-
|
|
728
|
+
_(e, "unique"), t.unique = e;
|
|
709
729
|
function s(n, r) {
|
|
710
730
|
if (Array.isArray(n)) {
|
|
711
731
|
if (Array.isArray(r)) {
|
|
@@ -716,25 +736,25 @@ var se;
|
|
|
716
736
|
}
|
|
717
737
|
return n / r;
|
|
718
738
|
}
|
|
719
|
-
|
|
739
|
+
_(s, "divide"), t.divide = s;
|
|
720
740
|
function i(n) {
|
|
721
741
|
return typeof Array.isArray == "function" ? Array.isArray(n) : n && typeof n == "object" && n.constructor.name === "Array";
|
|
722
742
|
}
|
|
723
|
-
|
|
743
|
+
_(i, "isArray"), t.isArray = i;
|
|
724
744
|
})(d.ArrayTools || (d.ArrayTools = {})), ((t) => {
|
|
725
745
|
function e(n) {
|
|
726
746
|
return n.reduce((r, a) => r + a, 0);
|
|
727
747
|
}
|
|
728
|
-
|
|
748
|
+
_(e, "sum"), t.sum = e;
|
|
729
749
|
function s(n) {
|
|
730
750
|
return e(n) / n.length;
|
|
731
751
|
}
|
|
732
|
-
|
|
752
|
+
_(s, "mean"), t.mean = s;
|
|
733
753
|
function i(n, r) {
|
|
734
754
|
const a = Math.pow(10, r);
|
|
735
755
|
return Math.round(n * a) / a;
|
|
736
756
|
}
|
|
737
|
-
|
|
757
|
+
_(i, "round"), t.round = i;
|
|
738
758
|
})(d.Mathematics || (d.Mathematics = {})), ((t) => {
|
|
739
759
|
function e(s, i, n) {
|
|
740
760
|
return new CustomEvent(s, {
|
|
@@ -746,16 +766,16 @@ var se;
|
|
|
746
766
|
}
|
|
747
767
|
});
|
|
748
768
|
}
|
|
749
|
-
|
|
769
|
+
_(e, "createEvent"), t.createEvent = e;
|
|
750
770
|
})(d.Events || (d.Events = {})), ((t) => {
|
|
751
771
|
function e() {
|
|
752
772
|
return location.hash.replace(/#/, "").split(/\//).filter((i) => i).map((i) => i.split(/:/));
|
|
753
773
|
}
|
|
754
|
-
|
|
774
|
+
_(e, "parts"), t.parts = e;
|
|
755
775
|
function s(i) {
|
|
756
776
|
return e().flat().findIndex((n) => n === i) >= 0;
|
|
757
777
|
}
|
|
758
|
-
|
|
778
|
+
_(s, "exists"), t.exists = s;
|
|
759
779
|
})(d.Hash || (d.Hash = {})), ((t) => {
|
|
760
780
|
function e(n, r, a = !1) {
|
|
761
781
|
if (a) {
|
|
@@ -767,7 +787,7 @@ var se;
|
|
|
767
787
|
} else
|
|
768
788
|
return new Proxy(n, r);
|
|
769
789
|
}
|
|
770
|
-
|
|
790
|
+
_(e, "proxy"), t.proxy = e, t.handler = {
|
|
771
791
|
set(n, r, a) {
|
|
772
792
|
return n[r] = a, window.dispatchEvent(
|
|
773
793
|
d.Events.createEvent("settingUpdate", window, { target: n, property: r, value: a })
|
|
@@ -787,42 +807,42 @@ var se;
|
|
|
787
807
|
return;
|
|
788
808
|
return h;
|
|
789
809
|
}
|
|
790
|
-
|
|
810
|
+
_(s, "get"), t.get = s;
|
|
791
811
|
function i(n, r, a) {
|
|
792
812
|
const h = r.split(".");
|
|
793
813
|
let o = n, l;
|
|
794
814
|
for (l = 0; l < h.length - 1; l++) {
|
|
795
|
-
const
|
|
815
|
+
const u = h[l];
|
|
796
816
|
if (o && typeof o == "object")
|
|
797
|
-
Object.prototype.hasOwnProperty.call(o,
|
|
817
|
+
Object.prototype.hasOwnProperty.call(o, u) || (o[u] = {}), o = o[u];
|
|
798
818
|
else
|
|
799
819
|
return !1;
|
|
800
820
|
}
|
|
801
821
|
return o && typeof o == "object" ? (o[h[l]] = a, !0) : !1;
|
|
802
822
|
}
|
|
803
|
-
|
|
823
|
+
_(i, "set"), t.set = i;
|
|
804
824
|
})(d.Objects || (d.Objects = {})), ((t) => {
|
|
805
825
|
function e(s = window.location) {
|
|
806
826
|
return Object.fromEntries(new URLSearchParams(s.search));
|
|
807
827
|
}
|
|
808
|
-
|
|
828
|
+
_(e, "parse"), t.parse = e, ((s) => {
|
|
809
829
|
function i(a = window.location.search) {
|
|
810
830
|
return Object.fromEntries(
|
|
811
831
|
a.replace(/^\?/, "").split(/&/).map((h) => h.split(/=/))
|
|
812
832
|
);
|
|
813
833
|
}
|
|
814
|
-
|
|
834
|
+
_(i, "parse2"), s.parse = i;
|
|
815
835
|
function n(a = window.location.search) {
|
|
816
836
|
return a.replace(/^\?/, "").split(/&/).map((h) => h.split(/=/)[0]);
|
|
817
837
|
}
|
|
818
|
-
|
|
838
|
+
_(n, "keys"), s.keys = n;
|
|
819
839
|
function r(a, h = window.location.search) {
|
|
820
840
|
return n(h).findIndex((o) => o === a) >= 0;
|
|
821
841
|
}
|
|
822
|
-
|
|
842
|
+
_(r, "has"), s.has = r;
|
|
823
843
|
})(t.Query || (t.Query = {}));
|
|
824
844
|
})(d.URL || (d.URL = {}));
|
|
825
|
-
})(
|
|
845
|
+
})(ie || (ie = {}));
|
|
826
846
|
const rs = class rs {
|
|
827
847
|
constructor() {
|
|
828
848
|
this._state = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Map();
|
|
@@ -862,9 +882,9 @@ const rs = class rs {
|
|
|
862
882
|
});
|
|
863
883
|
}
|
|
864
884
|
};
|
|
865
|
-
|
|
866
|
-
let
|
|
867
|
-
const { ArrayTools: qs } =
|
|
885
|
+
_(rs, "EventBus");
|
|
886
|
+
let Ae = rs;
|
|
887
|
+
const { ArrayTools: qs } = ie, te = class te extends Array {
|
|
868
888
|
constructor(...t) {
|
|
869
889
|
super(...t);
|
|
870
890
|
}
|
|
@@ -873,7 +893,7 @@ const { ArrayTools: qs } = se, Qt = class Qt extends Array {
|
|
|
873
893
|
function i(r) {
|
|
874
894
|
return r.name === e ? r : void 0;
|
|
875
895
|
}
|
|
876
|
-
|
|
896
|
+
_(i, "fn");
|
|
877
897
|
function n(r, a, h = null) {
|
|
878
898
|
if (qs.isArray(r)) {
|
|
879
899
|
for (const [o, l] of r.entries())
|
|
@@ -890,17 +910,17 @@ const { ArrayTools: qs } = se, Qt = class Qt extends Array {
|
|
|
890
910
|
}
|
|
891
911
|
return s;
|
|
892
912
|
}
|
|
893
|
-
return
|
|
913
|
+
return _(n, "recurse"), n(this);
|
|
894
914
|
}
|
|
895
915
|
flatten() {
|
|
896
916
|
return this.reduce((t, e) => (t.push(e), e.layers && Array.isArray(e.layers) && t.push(...e.layers), t), []);
|
|
897
917
|
}
|
|
898
918
|
recurse(t, e, s = null, i = 0) {
|
|
899
|
-
let n = new
|
|
919
|
+
let n = new te();
|
|
900
920
|
for (const r of this) {
|
|
901
921
|
let a = e(r, s, i);
|
|
902
922
|
if (r[t] && Array.isArray(r[t])) {
|
|
903
|
-
let h = new
|
|
923
|
+
let h = new te(...r[t]).recurse(t, e, r, i + 1);
|
|
904
924
|
h !== void 0 && n.push(...h);
|
|
905
925
|
}
|
|
906
926
|
n.push(a);
|
|
@@ -908,11 +928,11 @@ const { ArrayTools: qs } = se, Qt = class Qt extends Array {
|
|
|
908
928
|
return console.log("Recurse results: ", n), n;
|
|
909
929
|
}
|
|
910
930
|
};
|
|
911
|
-
|
|
912
|
-
let
|
|
931
|
+
_(te, "LayerArray");
|
|
932
|
+
let qt = te;
|
|
913
933
|
const os = class os {
|
|
914
934
|
constructor(t, e, s) {
|
|
915
|
-
this.__state__ = new
|
|
935
|
+
this.__state__ = new Ae(), this.scale_x = 1, this.scale_y = 1, this.scale_objects = !0, this.layers = new qt(), 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 se(), s == null || s.__state__.addListener("graph_updated", "live", ({ key: i, newValue: n, oldValue: r }) => {
|
|
916
936
|
}), s == null || s.__state__.addListener(`graph_updated_${this.name}`, "live", ({ key: i, newValue: n, oldValue: r }) => {
|
|
917
937
|
this.objects = n, this.__state__.setVariable("layer_updated", this);
|
|
918
938
|
});
|
|
@@ -924,47 +944,47 @@ const os = class os {
|
|
|
924
944
|
this._transform = t;
|
|
925
945
|
}
|
|
926
946
|
};
|
|
927
|
-
|
|
947
|
+
_(os, "Layer");
|
|
928
948
|
let We = os;
|
|
929
|
-
var
|
|
949
|
+
var Lt, Mt;
|
|
930
950
|
const Le = class Le extends Array {
|
|
931
951
|
constructor(...e) {
|
|
932
952
|
super(arguments.length);
|
|
933
|
-
|
|
934
|
-
|
|
953
|
+
et(this, Lt, !1);
|
|
954
|
+
et(this, Mt);
|
|
935
955
|
for (let s = 0; s < e.length; s++)
|
|
936
956
|
this[s] = e[s];
|
|
937
|
-
|
|
957
|
+
H(this, Lt, !1);
|
|
938
958
|
}
|
|
939
959
|
static fromArray(e) {
|
|
940
960
|
const s = new Le();
|
|
941
961
|
return e.forEach((i, n) => {
|
|
942
962
|
s.push(i);
|
|
943
|
-
}),
|
|
963
|
+
}), H(s, Mt, e.names), s;
|
|
944
964
|
}
|
|
945
965
|
flip() {
|
|
946
|
-
|
|
966
|
+
H(this, Lt, !k(this, Lt));
|
|
947
967
|
for (let e = 0; e < this.length; e++)
|
|
948
968
|
this[e] = -this[e];
|
|
949
969
|
return this;
|
|
950
970
|
}
|
|
951
971
|
get(e) {
|
|
952
|
-
return typeof e == "number" ? this[e] : k(this,
|
|
972
|
+
return typeof e == "number" ? this[e] : k(this, Mt) && k(this, Mt).includes(e) ? this[k(this, Mt).indexOf(e)] : void 0;
|
|
953
973
|
}
|
|
954
974
|
get flipped() {
|
|
955
|
-
return k(this,
|
|
975
|
+
return k(this, Lt);
|
|
956
976
|
}
|
|
957
977
|
get names() {
|
|
958
|
-
return k(this,
|
|
978
|
+
return k(this, Mt) ? k(this, Mt) : this.map((e, s) => `V${s + 1}`);
|
|
959
979
|
}
|
|
960
980
|
};
|
|
961
|
-
|
|
962
|
-
let
|
|
981
|
+
Lt = new WeakMap(), Mt = new WeakMap(), _(Le, "DimensionVector");
|
|
982
|
+
let Pt = Le;
|
|
963
983
|
const as = class as {
|
|
964
984
|
constructor(t, e) {
|
|
965
|
-
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
|
|
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 se(), t instanceof Pt ? this._dimensions = t : t instanceof Ht ? this._dimensions = Pt.fromArray(t) : Array.isArray(t) ? this._dimensions = new Pt(...t) : (console.warn("Invalid dimensions provided, using default DimensionVector(0, 0)"), this._dimensions = new Pt(0, 0));
|
|
966
986
|
let s = { ...e };
|
|
967
|
-
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
|
|
987
|
+
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);
|
|
968
988
|
}
|
|
969
989
|
get dimensions() {
|
|
970
990
|
return this._dimensions;
|
|
@@ -1016,9 +1036,9 @@ const as = class as {
|
|
|
1016
1036
|
this._transform = t;
|
|
1017
1037
|
}
|
|
1018
1038
|
};
|
|
1019
|
-
|
|
1020
|
-
let
|
|
1021
|
-
const hs = class hs extends
|
|
1039
|
+
_(as, "PlottedObject");
|
|
1040
|
+
let kt = as;
|
|
1041
|
+
const hs = class hs extends kt {
|
|
1022
1042
|
// constructor(x: LineOptions) {
|
|
1023
1043
|
// super([], x);
|
|
1024
1044
|
// // const data = Object.assign({}, x);
|
|
@@ -1060,9 +1080,9 @@ const hs = class hs extends It {
|
|
|
1060
1080
|
this._color = t;
|
|
1061
1081
|
}
|
|
1062
1082
|
};
|
|
1063
|
-
|
|
1064
|
-
let
|
|
1065
|
-
const
|
|
1083
|
+
_(hs, "Line");
|
|
1084
|
+
let Xt = hs;
|
|
1085
|
+
const ee = class ee extends kt {
|
|
1066
1086
|
// constructor(dimensions: DimensionType, o: PointOptions) { //, graph?: any) {
|
|
1067
1087
|
// super(dimensions, o);
|
|
1068
1088
|
// this.active = o.active || false;
|
|
@@ -1078,7 +1098,7 @@ const te = class te extends It {
|
|
|
1078
1098
|
constructor(t) {
|
|
1079
1099
|
var n, r;
|
|
1080
1100
|
let e, s, i;
|
|
1081
|
-
t ? t instanceof
|
|
1101
|
+
t ? t instanceof Ht ? (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 = ee.SHAPES.CIRCLE;
|
|
1082
1102
|
}
|
|
1083
1103
|
set label(t) {
|
|
1084
1104
|
this._label = t;
|
|
@@ -1099,9 +1119,9 @@ const te = class te extends It {
|
|
|
1099
1119
|
this._y = parseFloat(t);
|
|
1100
1120
|
}
|
|
1101
1121
|
};
|
|
1102
|
-
|
|
1103
|
-
let J =
|
|
1104
|
-
const
|
|
1122
|
+
_(ee, "Point"), ee.SHAPES = { CIRCLE: "circle", SQUARE: "rect" };
|
|
1123
|
+
let J = ee;
|
|
1124
|
+
const Ft = class Ft extends kt {
|
|
1105
1125
|
constructor(t, e) {
|
|
1106
1126
|
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);
|
|
1107
1127
|
}
|
|
@@ -1124,8 +1144,8 @@ const zt = class zt extends It {
|
|
|
1124
1144
|
this._transform = t;
|
|
1125
1145
|
}
|
|
1126
1146
|
};
|
|
1127
|
-
|
|
1128
|
-
let
|
|
1147
|
+
_(Ft, "Label"), Ft.DISPLAY_TYPES = { OFF: 0, AUTO: 1, CLICK: 2, ON: 3 }, Ft.HIGHLIGHT = { OFF: 0, ON: 2 }, Ft.POSITION = { OBJECT: 1, STATIC: 2, CONTAINER: 3, CUSTOM: 4 };
|
|
1148
|
+
let U = Ft;
|
|
1129
1149
|
const ls = class ls {
|
|
1130
1150
|
constructor(t, e, s = 0, i = 0) {
|
|
1131
1151
|
this.x_max = t, this.y_max = e, this.cx = s, this.cy = i;
|
|
@@ -1159,9 +1179,9 @@ const ls = class ls {
|
|
|
1159
1179
|
return this.x_max;
|
|
1160
1180
|
}
|
|
1161
1181
|
};
|
|
1162
|
-
|
|
1163
|
-
let
|
|
1164
|
-
const cs = class cs extends
|
|
1182
|
+
_(ls, "Extremes");
|
|
1183
|
+
let Rt = ls;
|
|
1184
|
+
const cs = class cs extends kt {
|
|
1165
1185
|
constructor(t, e) {
|
|
1166
1186
|
super(t, e), this.visible = !0, this.size = e.size;
|
|
1167
1187
|
}
|
|
@@ -1187,7 +1207,7 @@ const cs = class cs extends It {
|
|
|
1187
1207
|
return this._transform;
|
|
1188
1208
|
}
|
|
1189
1209
|
};
|
|
1190
|
-
|
|
1210
|
+
_(cs, "AxisPoint");
|
|
1191
1211
|
let Ve = cs, Ks = {
|
|
1192
1212
|
GRAPH: {
|
|
1193
1213
|
ratio: 1,
|
|
@@ -1204,25 +1224,25 @@ let Ve = cs, Ks = {
|
|
|
1204
1224
|
size: 1,
|
|
1205
1225
|
highlight: {
|
|
1206
1226
|
color: "yellow",
|
|
1207
|
-
labels:
|
|
1227
|
+
labels: U.DISPLAY_TYPES.ON
|
|
1208
1228
|
},
|
|
1209
|
-
labels:
|
|
1210
|
-
labelposition:
|
|
1229
|
+
labels: U.DISPLAY_TYPES.ON,
|
|
1230
|
+
labelposition: U.POSITION.OBJECT
|
|
1211
1231
|
},
|
|
1212
1232
|
POINT: {
|
|
1213
1233
|
active: 2,
|
|
1214
1234
|
size: 0.05,
|
|
1215
1235
|
color: "#000",
|
|
1216
1236
|
shape: J.SHAPES.CIRCLE,
|
|
1217
|
-
labels:
|
|
1218
|
-
labelposition:
|
|
1237
|
+
labels: U.DISPLAY_TYPES.AUTO,
|
|
1238
|
+
labelposition: U.POSITION.OBJECT
|
|
1219
1239
|
},
|
|
1220
1240
|
MEAN: {
|
|
1221
1241
|
shape: J.SHAPES.SQUARE,
|
|
1222
|
-
labels:
|
|
1242
|
+
labels: U.DISPLAY_TYPES.AUTO
|
|
1223
1243
|
},
|
|
1224
1244
|
LABEL: {
|
|
1225
|
-
highlight:
|
|
1245
|
+
highlight: U.HIGHLIGHT.OFF,
|
|
1226
1246
|
position: ["top", "left"],
|
|
1227
1247
|
container: "#label-container"
|
|
1228
1248
|
},
|
|
@@ -1230,9 +1250,9 @@ let Ve = cs, Ks = {
|
|
|
1230
1250
|
multiplier: 1
|
|
1231
1251
|
}
|
|
1232
1252
|
};
|
|
1233
|
-
const
|
|
1253
|
+
const us = class us {
|
|
1234
1254
|
constructor(t = { ...Ks }) {
|
|
1235
|
-
this.__state__ = new
|
|
1255
|
+
this.__state__ = new Ae(), 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 se(), this.scale_x = 1, this.scale_y = 1, this.SIZE_EFFECT = 1, this._mirror_y = !0, this._mirror_x = !1, this._layers = new qt(
|
|
1236
1256
|
{ name: "graph", tabindex: 0, layers: [
|
|
1237
1257
|
{
|
|
1238
1258
|
name: "axes",
|
|
@@ -1272,7 +1292,7 @@ const _s = class _s {
|
|
|
1272
1292
|
{ name: "labels", layers: [], tabindex: 0 }
|
|
1273
1293
|
] }
|
|
1274
1294
|
), this.options = t, this.origin = new Ve(
|
|
1275
|
-
new
|
|
1295
|
+
new Pt(0, 0),
|
|
1276
1296
|
{
|
|
1277
1297
|
ID: "origin",
|
|
1278
1298
|
x: 0,
|
|
@@ -1280,35 +1300,35 @@ const _s = class _s {
|
|
|
1280
1300
|
size: 0,
|
|
1281
1301
|
meta: {},
|
|
1282
1302
|
graph: this,
|
|
1283
|
-
color: new
|
|
1284
|
-
highlight: new
|
|
1303
|
+
color: new st("#FFFFFF"),
|
|
1304
|
+
highlight: new st("#FFFFFF"),
|
|
1285
1305
|
active: !1
|
|
1286
1306
|
}
|
|
1287
1307
|
);
|
|
1288
1308
|
let e = 1;
|
|
1289
1309
|
function s(r, a, h) {
|
|
1290
1310
|
const o = new We(`${e}`, r, h);
|
|
1291
|
-
return e += 1, o.parent = a || void 0, r.layers && Array.isArray(r.layers) && (o.layers = new
|
|
1311
|
+
return e += 1, o.parent = a || void 0, r.layers && Array.isArray(r.layers) && (o.layers = new qt(...r.layers.map((l) => s(l, o, h)))), o;
|
|
1292
1312
|
}
|
|
1293
|
-
|
|
1313
|
+
_(s, "buildLayerTree"), this.layers = new qt(...this._layers.map((r) => s(r, null, this)));
|
|
1294
1314
|
let i = this.layers.search("layers", "axis_points");
|
|
1295
1315
|
i && i.objects.set(this.origin.ID, this.origin);
|
|
1296
1316
|
let n = this.layers.search("layers", "axis_lines");
|
|
1297
1317
|
if (n) {
|
|
1298
|
-
let r = this.extremes || new
|
|
1318
|
+
let r = this.extremes || new Rt(1, 1), a = new Xt(
|
|
1299
1319
|
{},
|
|
1300
1320
|
new J({ ID: "axis-x-start", dimensions: [-r.x_max, 0], classes: ["ena.dimension", "ena.dimension"] }),
|
|
1301
1321
|
new J({ ID: "axis-x-end", dimensions: [r.x_max, 0], classes: ["ena.dimension", "ena.dimension"] })
|
|
1302
1322
|
);
|
|
1303
1323
|
a.ID = "axis-x", n.objects.set(a.ID, a);
|
|
1304
|
-
let h = new
|
|
1324
|
+
let h = new Xt(
|
|
1305
1325
|
{},
|
|
1306
1326
|
new J({ ID: "axis-y-start", dimensions: [0, -r.y_max], classes: ["ena.dimension", "ena.dimension"] }),
|
|
1307
1327
|
new J({ ID: "axis-y-end", dimensions: [0, r.y_max], classes: ["ena.dimension", "ena.dimension"] })
|
|
1308
1328
|
);
|
|
1309
1329
|
h.ID = "axis-y", n.objects.set(h.ID, h), console.log("Added axis lines to layer: ", n);
|
|
1310
1330
|
}
|
|
1311
|
-
this.extremes = new
|
|
1331
|
+
this.extremes = new Rt(t.GRAPH.x_max, t.GRAPH.y_max);
|
|
1312
1332
|
}
|
|
1313
1333
|
set extremes(t) {
|
|
1314
1334
|
this._extremes = t;
|
|
@@ -1347,7 +1367,7 @@ const _s = class _s {
|
|
|
1347
1367
|
add_nodes(t) {
|
|
1348
1368
|
let e = this;
|
|
1349
1369
|
t.forEach((s) => {
|
|
1350
|
-
s.label = new
|
|
1370
|
+
s.label = new U(s.ID, s), e.labels.set(s.label.ID, s.label), e.nodes.set(s.ID, s);
|
|
1351
1371
|
const i = e.layers.search("layers", "nodes");
|
|
1352
1372
|
i && i.objects.push(s);
|
|
1353
1373
|
}), e.update_extremes();
|
|
@@ -1372,14 +1392,14 @@ const _s = class _s {
|
|
|
1372
1392
|
this.layers.search("layers", "nodes")
|
|
1373
1393
|
].filter((s) => s !== void 0);
|
|
1374
1394
|
if (e.length === 0)
|
|
1375
|
-
this.extremes = new
|
|
1395
|
+
this.extremes = new Rt(1, 1);
|
|
1376
1396
|
else {
|
|
1377
1397
|
let s = 1 / 0, i = -1 / 0, n = 1 / 0, r = -1 / 0;
|
|
1378
1398
|
e.forEach((g) => g.objects.forEach((c) => {
|
|
1379
1399
|
Number.isFinite(c.x) && (s = Math.min(s, c.x), i = Math.max(i, c.x)), Number.isFinite(c.y) && (n = Math.min(n, c.y), r = Math.max(r, c.y));
|
|
1380
1400
|
}));
|
|
1381
|
-
const a = Number.isFinite(s) && Number.isFinite(n), h = t && a ? (s + i) / 2 : 0, o = t && a ? (n + r) / 2 : 0, l = a ? Math.max(Math.abs(s - h), Math.abs(i - h), Math.abs(n - o), Math.abs(r - o)) : 0,
|
|
1382
|
-
this.extremes = new
|
|
1401
|
+
const a = Number.isFinite(s) && Number.isFinite(n), h = t && a ? (s + i) / 2 : 0, o = t && a ? (n + r) / 2 : 0, l = a ? Math.max(Math.abs(s - h), Math.abs(i - h), Math.abs(n - o), Math.abs(r - o)) : 0, u = (l > 0 ? l : 1) * 1.3;
|
|
1402
|
+
this.extremes = new Rt(u, u, h, o);
|
|
1383
1403
|
}
|
|
1384
1404
|
}
|
|
1385
1405
|
/** Farthest node from (cx, cy), on either axis */
|
|
@@ -1395,9 +1415,9 @@ const _s = class _s {
|
|
|
1395
1415
|
return Math.min(1, e / (Math.sqrt(s) * t));
|
|
1396
1416
|
}
|
|
1397
1417
|
};
|
|
1398
|
-
|
|
1399
|
-
let Ke =
|
|
1400
|
-
const
|
|
1418
|
+
_(us, "Graph");
|
|
1419
|
+
let Ke = us;
|
|
1420
|
+
const Te = class Te extends HTMLElement {
|
|
1401
1421
|
constructor() {
|
|
1402
1422
|
super(), this.element = null, this.object = null;
|
|
1403
1423
|
const t = this, e = t.attachShadow({ mode: "open" }), s = document.createElement("style"), i = document.createElement("div");
|
|
@@ -1408,7 +1428,7 @@ const De = class De extends HTMLElement {
|
|
|
1408
1428
|
return e == null ? void 0 : e.querySelector(".wrapper");
|
|
1409
1429
|
}
|
|
1410
1430
|
};
|
|
1411
|
-
|
|
1431
|
+
_(Te, "DrawableElement"), Te.style = `
|
|
1412
1432
|
:host {
|
|
1413
1433
|
max-width: 100%;
|
|
1414
1434
|
display: block;
|
|
@@ -1419,12 +1439,12 @@ u(De, "DrawableElement"), De.style = `
|
|
|
1419
1439
|
justify-content: center;
|
|
1420
1440
|
}
|
|
1421
1441
|
`;
|
|
1422
|
-
let
|
|
1442
|
+
let ve = Te;
|
|
1423
1443
|
const hi = 1e-8;
|
|
1424
1444
|
function Us(d, t = hi) {
|
|
1425
1445
|
return d.filter((e) => Math.abs(e.x) > t || Math.abs(e.y) > t);
|
|
1426
1446
|
}
|
|
1427
|
-
|
|
1447
|
+
_(Us, "nearOriginFilter");
|
|
1428
1448
|
function Js(d) {
|
|
1429
1449
|
if (d <= 0) return [];
|
|
1430
1450
|
if (d === 1) return [0];
|
|
@@ -1432,7 +1452,7 @@ function Js(d) {
|
|
|
1432
1452
|
for (let e = 0; e < d; e++) t[e] = e / (d - 1);
|
|
1433
1453
|
return t;
|
|
1434
1454
|
}
|
|
1435
|
-
|
|
1455
|
+
_(Js, "normalizedT");
|
|
1436
1456
|
function Zs(d, t) {
|
|
1437
1457
|
return d.map((e) => {
|
|
1438
1458
|
const s = new Array(t + 1);
|
|
@@ -1442,7 +1462,7 @@ function Zs(d, t) {
|
|
|
1442
1462
|
return s;
|
|
1443
1463
|
});
|
|
1444
1464
|
}
|
|
1445
|
-
|
|
1465
|
+
_(Zs, "design");
|
|
1446
1466
|
function Qs(d) {
|
|
1447
1467
|
const t = d.length, e = d[0].length, s = d.map((n) => n.slice()), i = Array.from({ length: e }, () => new Array(e).fill(0));
|
|
1448
1468
|
for (let n = 0; n < e; n++) {
|
|
@@ -1459,7 +1479,7 @@ function Qs(d) {
|
|
|
1459
1479
|
}
|
|
1460
1480
|
return { Q: s, R: i };
|
|
1461
1481
|
}
|
|
1462
|
-
|
|
1482
|
+
_(Qs, "qr");
|
|
1463
1483
|
function Je(d, t) {
|
|
1464
1484
|
const e = d.length, s = d[0].length, i = new Array(s).fill(0);
|
|
1465
1485
|
for (let n = 0; n < s; n++) {
|
|
@@ -1469,7 +1489,7 @@ function Je(d, t) {
|
|
|
1469
1489
|
}
|
|
1470
1490
|
return i;
|
|
1471
1491
|
}
|
|
1472
|
-
|
|
1492
|
+
_(Je, "qtY");
|
|
1473
1493
|
function Ze(d, t) {
|
|
1474
1494
|
const e = t.length, s = new Array(e).fill(0);
|
|
1475
1495
|
for (let i = e - 1; i >= 0; i--) {
|
|
@@ -1479,7 +1499,7 @@ function Ze(d, t) {
|
|
|
1479
1499
|
}
|
|
1480
1500
|
return s;
|
|
1481
1501
|
}
|
|
1482
|
-
|
|
1502
|
+
_(Ze, "backSolve");
|
|
1483
1503
|
function li(d) {
|
|
1484
1504
|
return d.map((t) => {
|
|
1485
1505
|
let e = 0;
|
|
@@ -1487,65 +1507,65 @@ function li(d) {
|
|
|
1487
1507
|
return e;
|
|
1488
1508
|
});
|
|
1489
1509
|
}
|
|
1490
|
-
|
|
1491
|
-
function
|
|
1510
|
+
_(li, "leverages");
|
|
1511
|
+
function Bs(d, t, e) {
|
|
1492
1512
|
const s = Zs(d, e), { Q: i, R: n } = Qs(s);
|
|
1493
1513
|
return Ze(n, Je(i, t));
|
|
1494
1514
|
}
|
|
1495
|
-
|
|
1496
|
-
function
|
|
1515
|
+
_(Bs, "fitCoeffs");
|
|
1516
|
+
function Se(d, t) {
|
|
1497
1517
|
let e = 0, s = 1;
|
|
1498
1518
|
for (let i = 0; i < d.length; i++)
|
|
1499
1519
|
e += d[i] * s, s *= t;
|
|
1500
1520
|
return e;
|
|
1501
1521
|
}
|
|
1502
|
-
|
|
1522
|
+
_(Se, "evalPoly");
|
|
1503
1523
|
function ci(d, t, e, s) {
|
|
1504
1524
|
const i = Zs(d, s), { Q: n, R: r } = Qs(i), a = li(n), h = Ze(r, Je(n, t)), o = Ze(r, Je(n, e));
|
|
1505
1525
|
let l = 0;
|
|
1506
|
-
for (let
|
|
1507
|
-
const g = 1 - a[
|
|
1526
|
+
for (let u = 0; u < d.length; u++) {
|
|
1527
|
+
const g = 1 - a[u];
|
|
1508
1528
|
if (g <= 0) return 1 / 0;
|
|
1509
|
-
const c = t[
|
|
1510
|
-
l += (c / g) ** 2 + (
|
|
1529
|
+
const c = t[u] - Se(h, d[u]), v = e[u] - Se(o, d[u]);
|
|
1530
|
+
l += (c / g) ** 2 + (v / g) ** 2;
|
|
1511
1531
|
}
|
|
1512
1532
|
return l;
|
|
1513
1533
|
}
|
|
1514
|
-
|
|
1515
|
-
function
|
|
1534
|
+
_(ci, "loocv2d");
|
|
1535
|
+
function ui(d, t, e) {
|
|
1516
1536
|
const s = d.length, i = Math.min(Math.max(1, Math.floor(t)), Math.max(1, s - 1));
|
|
1517
1537
|
if (e === "fixed" || s < 3) return i;
|
|
1518
1538
|
const n = Js(s), r = d.map((l) => l.x), a = d.map((l) => l.y);
|
|
1519
1539
|
let h = 1, o = 1 / 0;
|
|
1520
1540
|
for (let l = 1; l <= i; l++) {
|
|
1521
|
-
const
|
|
1522
|
-
|
|
1541
|
+
const u = ci(n, r, a, l);
|
|
1542
|
+
u < o && (o = u, h = l);
|
|
1523
1543
|
}
|
|
1524
1544
|
return h;
|
|
1525
1545
|
}
|
|
1526
|
-
|
|
1527
|
-
function
|
|
1546
|
+
_(ui, "selectDegree");
|
|
1547
|
+
function _i(d, t) {
|
|
1528
1548
|
const e = Us(d);
|
|
1529
1549
|
if (e.length < 3) return null;
|
|
1530
1550
|
const s = t.selectionSet ? Us(t.selectionSet) : e, i = s.length >= 3 ? s : e;
|
|
1531
|
-
let n =
|
|
1551
|
+
let n = ui(i, t.maxDegree, t.degreeSelection);
|
|
1532
1552
|
n = Math.min(n, Math.max(1, e.length - 1));
|
|
1533
|
-
const r = Js(e.length), a =
|
|
1553
|
+
const r = Js(e.length), a = Bs(r, e.map((o) => o.x), n), h = Bs(r, e.map((o) => o.y), n);
|
|
1534
1554
|
return { degree: n, coeffsX: a, coeffsY: h };
|
|
1535
1555
|
}
|
|
1536
|
-
|
|
1537
|
-
function
|
|
1556
|
+
_(_i, "fitTrajectory");
|
|
1557
|
+
function Gs(d, t = 100) {
|
|
1538
1558
|
const e = [];
|
|
1539
1559
|
for (let s = 0; s <= t; s++) {
|
|
1540
1560
|
const i = s / t;
|
|
1541
|
-
e.push({ x:
|
|
1561
|
+
e.push({ x: Se(d.coeffsX, i), y: Se(d.coeffsY, i) });
|
|
1542
1562
|
}
|
|
1543
1563
|
return e;
|
|
1544
1564
|
}
|
|
1545
|
-
|
|
1546
|
-
const Hs = 100,
|
|
1565
|
+
_(Gs, "sampleCurve");
|
|
1566
|
+
const Hs = 100, _s = class _s extends kt {
|
|
1547
1567
|
constructor(t = {}) {
|
|
1548
|
-
const e = t.color instanceof
|
|
1568
|
+
const e = t.color instanceof st ? t.color : new st(typeof t.color == "string" ? t.color : "#000000");
|
|
1549
1569
|
super([], {
|
|
1550
1570
|
ID: t.ID || `traj-${Math.random().toString(36).substring(2, 9)}`,
|
|
1551
1571
|
size: t.size || 1,
|
|
@@ -1571,11 +1591,11 @@ const Hs = 100, us = class us extends It {
|
|
|
1571
1591
|
if (t.length < 2) return [];
|
|
1572
1592
|
if (this.smooth === "poly") {
|
|
1573
1593
|
if (this.polyCoeffsX.length > 0 && this.polyCoeffsY.length > 0)
|
|
1574
|
-
return
|
|
1594
|
+
return Gs(
|
|
1575
1595
|
{ degree: this.polyCoeffsX.length - 1, coeffsX: this.polyCoeffsX, coeffsY: this.polyCoeffsY },
|
|
1576
1596
|
Hs
|
|
1577
1597
|
);
|
|
1578
|
-
const e =
|
|
1598
|
+
const e = _i(
|
|
1579
1599
|
t.map((s) => ({ x: s.x, y: s.y })),
|
|
1580
1600
|
{
|
|
1581
1601
|
maxDegree: this.maxDegree,
|
|
@@ -1584,14 +1604,14 @@ const Hs = 100, us = class us extends It {
|
|
|
1584
1604
|
}
|
|
1585
1605
|
);
|
|
1586
1606
|
if (e)
|
|
1587
|
-
return this.selectedDegree = e.degree,
|
|
1607
|
+
return this.selectedDegree = e.degree, Gs(e, Hs);
|
|
1588
1608
|
}
|
|
1589
1609
|
return t.map((e) => ({ x: e.x, y: e.y }));
|
|
1590
1610
|
}
|
|
1591
1611
|
};
|
|
1592
|
-
|
|
1593
|
-
let
|
|
1594
|
-
const ti = 1, ds = class ds extends
|
|
1612
|
+
_(_s, "Trajectory");
|
|
1613
|
+
let Ee = _s;
|
|
1614
|
+
const ti = 1, ds = class ds extends Xt {
|
|
1595
1615
|
constructor(t, e, s, i = 0) {
|
|
1596
1616
|
super(t, e, s), this._totalweight = 0, this._weight = i;
|
|
1597
1617
|
}
|
|
@@ -1599,8 +1619,8 @@ const ti = 1, ds = class ds extends Ht {
|
|
|
1599
1619
|
return this._color;
|
|
1600
1620
|
}
|
|
1601
1621
|
get color() {
|
|
1602
|
-
const t = this._color || new
|
|
1603
|
-
return new
|
|
1622
|
+
const t = this._color || new st("#000000");
|
|
1623
|
+
return new we(t, Math.abs(this.weight));
|
|
1604
1624
|
}
|
|
1605
1625
|
set color(t) {
|
|
1606
1626
|
this._color = t;
|
|
@@ -1621,57 +1641,57 @@ const ti = 1, ds = class ds extends Ht {
|
|
|
1621
1641
|
this._totalweight = t;
|
|
1622
1642
|
}
|
|
1623
1643
|
};
|
|
1624
|
-
|
|
1625
|
-
let
|
|
1626
|
-
var
|
|
1627
|
-
const gs = class gs extends
|
|
1644
|
+
_(ds, "Edge");
|
|
1645
|
+
let Me = ds;
|
|
1646
|
+
var Bt;
|
|
1647
|
+
const gs = class gs extends kt {
|
|
1628
1648
|
constructor(e) {
|
|
1629
1649
|
super(e.dimensions || [], e);
|
|
1630
|
-
|
|
1631
|
-
|
|
1650
|
+
et(this, Bt);
|
|
1651
|
+
H(this, Bt, e);
|
|
1632
1652
|
}
|
|
1633
1653
|
get edge() {
|
|
1634
|
-
return k(this,
|
|
1654
|
+
return k(this, Bt);
|
|
1635
1655
|
}
|
|
1636
1656
|
get path() {
|
|
1637
|
-
const e = k(this,
|
|
1657
|
+
const e = k(this, Bt), 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]);
|
|
1638
1658
|
if (!(a > 0) || !(h > 0)) return "";
|
|
1639
|
-
const o = [(i[0] - s[0]) / a, (i[1] - s[1]) / a], l = Math.hypot(n[0] - s[0], n[1] - s[1]),
|
|
1640
|
-
return `M${c(
|
|
1659
|
+
const o = [(i[0] - s[0]) / a, (i[1] - s[1]) / a], l = Math.hypot(n[0] - s[0], n[1] - s[1]), u = [(n[0] - s[0]) / l, (n[1] - s[1]) / l], g = /* @__PURE__ */ _((Y) => h / 2 * Math.max(0, 1 - Y / a), "halfW"), c = /* @__PURE__ */ _((Y, E) => `${s[0] + o[0] * Y + u[0] * E} ${s[1] + o[1] * Y + u[1] * E}`, "at"), v = 0.2 * a, m = Math.min(0.15 * a, 0.8 * 2 * g(v)), A = v + m / 2, O = v + m;
|
|
1660
|
+
return `M${c(v, 0)} L${c(A, g(A))} L${c(O, g(O))} L${c(A, 0)} L${c(O, -g(O))} L${c(A, -g(A))}z`;
|
|
1641
1661
|
}
|
|
1642
1662
|
};
|
|
1643
|
-
|
|
1644
|
-
let
|
|
1645
|
-
var Gt,
|
|
1646
|
-
const
|
|
1663
|
+
Bt = new WeakMap(), _(gs, "EdgeArrow");
|
|
1664
|
+
let Ie = gs;
|
|
1665
|
+
var Gt, de;
|
|
1666
|
+
const De = class De extends Me {
|
|
1647
1667
|
constructor(e, s, i) {
|
|
1648
1668
|
super(e, s, i);
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
this._path = "",
|
|
1669
|
+
et(this, Gt);
|
|
1670
|
+
et(this, de);
|
|
1671
|
+
this._path = "", H(this, Gt, !1), this._directions = [
|
|
1652
1672
|
"from",
|
|
1653
1673
|
"to"
|
|
1654
1674
|
/* TO */
|
|
1655
|
-
], this.towards = "to", k(this, Gt) === !0 &&
|
|
1675
|
+
], this.towards = "to", k(this, Gt) === !0 && H(this, de, new Ie(this));
|
|
1656
1676
|
}
|
|
1657
1677
|
get path() {
|
|
1658
1678
|
return `M${this.from.x} ${this.from.y} L${this.base_pts[0].join(" ")} L${this.base_pts[1].join(" ")}z`;
|
|
1659
1679
|
}
|
|
1660
1680
|
static calculate_base_points(e) {
|
|
1661
|
-
const s = e.towards, i = e._directions.find((
|
|
1662
|
-
if (
|
|
1681
|
+
const s = e.towards, i = e._directions.find((A) => A !== e.towards), n = e[i].x, r = e[i].y, a = e[s].x, h = e[s].y, o = a - n, l = h - r, u = Math.hypot(o, l), g = (e.weight ?? 0) * ti;
|
|
1682
|
+
if (u === 0 || !isFinite(g) || g === 0)
|
|
1663
1683
|
return [[a, h], [a, h]];
|
|
1664
|
-
const c = -l /
|
|
1684
|
+
const c = -l / u, v = o / u, m = g / 2;
|
|
1665
1685
|
return [
|
|
1666
|
-
[a + c *
|
|
1667
|
-
[a - c *
|
|
1686
|
+
[a + c * m, h + v * m],
|
|
1687
|
+
[a - c * m, h - v * m]
|
|
1668
1688
|
];
|
|
1669
1689
|
}
|
|
1670
1690
|
get base_pts() {
|
|
1671
|
-
return
|
|
1691
|
+
return De.calculate_base_points(this);
|
|
1672
1692
|
}
|
|
1673
1693
|
get arrow() {
|
|
1674
|
-
return k(this,
|
|
1694
|
+
return k(this, de);
|
|
1675
1695
|
}
|
|
1676
1696
|
get with_arrow() {
|
|
1677
1697
|
return k(this, Gt);
|
|
@@ -1680,17 +1700,17 @@ const Te = class Te extends Ee {
|
|
|
1680
1700
|
return [this.from.x, this.from.y];
|
|
1681
1701
|
}
|
|
1682
1702
|
};
|
|
1683
|
-
Gt = new WeakMap(),
|
|
1684
|
-
let
|
|
1685
|
-
const ze = class ze extends
|
|
1703
|
+
Gt = new WeakMap(), de = new WeakMap(), _(De, "TaperedEdge");
|
|
1704
|
+
let Wt = De;
|
|
1705
|
+
const ze = class ze extends Wt {
|
|
1686
1706
|
constructor(t, e, s) {
|
|
1687
1707
|
super(t, e, s), this._dataWeight = 0, this._totalweight = t.totalweight ?? 0, this._dataWeight = t.weight ?? this._weight;
|
|
1688
1708
|
}
|
|
1689
1709
|
get weighted_midpoint() {
|
|
1690
|
-
return
|
|
1710
|
+
return ie.Geometry.Line.interpolate(this.line)(1 - this._dataWeight / this._totalweight);
|
|
1691
1711
|
}
|
|
1692
1712
|
get base_pts() {
|
|
1693
|
-
return
|
|
1713
|
+
return Wt.calculate_base_points(this);
|
|
1694
1714
|
}
|
|
1695
1715
|
static build_path(t) {
|
|
1696
1716
|
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"), "");
|
|
@@ -1702,9 +1722,9 @@ const ze = class ze extends Xt {
|
|
|
1702
1722
|
return this.weighted_midpoint;
|
|
1703
1723
|
}
|
|
1704
1724
|
};
|
|
1705
|
-
|
|
1725
|
+
_(ze, "TaperedWeightedMidpointEdge");
|
|
1706
1726
|
let Qe = ze;
|
|
1707
|
-
const Fe = class Fe extends
|
|
1727
|
+
const Fe = class Fe extends Me {
|
|
1708
1728
|
constructor(t, e, s) {
|
|
1709
1729
|
super(t, e, s);
|
|
1710
1730
|
}
|
|
@@ -1717,10 +1737,10 @@ const Fe = class Fe extends Ee {
|
|
|
1717
1737
|
return Fe.build_path(t, this.to);
|
|
1718
1738
|
}
|
|
1719
1739
|
};
|
|
1720
|
-
|
|
1721
|
-
let
|
|
1722
|
-
const
|
|
1723
|
-
constructor(t, e, s, i = new
|
|
1740
|
+
_(Fe, "NodeEdge");
|
|
1741
|
+
let ne = Fe;
|
|
1742
|
+
const fs = class fs {
|
|
1743
|
+
constructor(t, e, s, i = new Ct()) {
|
|
1724
1744
|
this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.svg_element = this.create();
|
|
1725
1745
|
}
|
|
1726
1746
|
get_size() {
|
|
@@ -1740,12 +1760,12 @@ const ms = class ms {
|
|
|
1740
1760
|
const o = Math.min(1, (h - r) / n), l = i + (s - i) * o;
|
|
1741
1761
|
t.setAttribute(e, l.toString()), o < 1 ? requestAnimationFrame(a) : t.setAttribute(e, s.toString());
|
|
1742
1762
|
}
|
|
1743
|
-
|
|
1763
|
+
_(a, "animate"), requestAnimationFrame(a);
|
|
1744
1764
|
}
|
|
1745
1765
|
};
|
|
1746
|
-
|
|
1747
|
-
let
|
|
1748
|
-
const di = 0.04, gi = [0.25, 1],
|
|
1766
|
+
_(fs, "Drawable");
|
|
1767
|
+
let re = fs;
|
|
1768
|
+
const di = 0.04, gi = [0.25, 1], fi = [0.3, 1];
|
|
1749
1769
|
function Xs(d, t, e, s) {
|
|
1750
1770
|
const i = Math.abs(d);
|
|
1751
1771
|
if (!(i > 0)) return 0;
|
|
@@ -1753,32 +1773,32 @@ function Xs(d, t, e, s) {
|
|
|
1753
1773
|
const n = Math.min(1, Math.max(0, (i - t) / (e - t)));
|
|
1754
1774
|
return s[0] + n * (s[1] - s[0]);
|
|
1755
1775
|
}
|
|
1756
|
-
|
|
1757
|
-
const
|
|
1776
|
+
_(Xs, "rampFor");
|
|
1777
|
+
const mi = 0.011, pi = 0.75, bi = 0.8, yi = 0.75, ei = 6e-3, xi = 0.6;
|
|
1758
1778
|
function wi(d) {
|
|
1759
1779
|
return 2 * d;
|
|
1760
1780
|
}
|
|
1761
|
-
|
|
1781
|
+
_(wi, "widthPerWeight");
|
|
1762
1782
|
function Ai(d, t) {
|
|
1763
1783
|
return d * t / (2 * ei);
|
|
1764
1784
|
}
|
|
1765
|
-
|
|
1785
|
+
_(Ai, "nodeSizeForEdges");
|
|
1766
1786
|
function vi(d) {
|
|
1767
1787
|
const t = /rgba?\(([^)]+)\)/.exec(d);
|
|
1768
1788
|
if (!t) return d;
|
|
1769
|
-
const [e, s, i, n = 1] = t[1].split(",").map(Number), r = /* @__PURE__ */
|
|
1789
|
+
const [e, s, i, n = 1] = t[1].split(",").map(Number), r = /* @__PURE__ */ _((a) => Math.round(255 + (a - 255) * n), "f");
|
|
1770
1790
|
return `rgb(${r(e)},${r(s)},${r(i)})`;
|
|
1771
1791
|
}
|
|
1772
|
-
|
|
1792
|
+
_(vi, "flattenOnWhite");
|
|
1773
1793
|
function Si(d, t) {
|
|
1774
1794
|
const e = /rgba?\(([^)]+)\)/.exec(d);
|
|
1775
1795
|
if (!e) return d;
|
|
1776
1796
|
const [s, i, n, r = 1] = e[1].split(",").map(Number);
|
|
1777
1797
|
return `rgba(${Math.round(s * t)},${Math.round(i * t)},${Math.round(n * t)},${r})`;
|
|
1778
1798
|
}
|
|
1779
|
-
|
|
1780
|
-
const
|
|
1781
|
-
constructor(t, e, s, i = new
|
|
1799
|
+
_(Si, "darkenRgba");
|
|
1800
|
+
const ms = class ms extends re {
|
|
1801
|
+
constructor(t, e, s, i = new Ct()) {
|
|
1782
1802
|
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();
|
|
1783
1803
|
}
|
|
1784
1804
|
/** Stamp edge identity onto an element so <qe-graph> delegation can resolve
|
|
@@ -1788,11 +1808,11 @@ const fs = class fs extends ne {
|
|
|
1788
1808
|
e.isMeanEdge && (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"), e.isSelf && t.setAttribute("data-edge-self", "true"), e.group != null && t.setAttribute("data-edge-group", String(e.group)), e.unit != null && t.setAttribute("data-edge-unit", String(e.unit)));
|
|
1789
1809
|
}
|
|
1790
1810
|
create() {
|
|
1791
|
-
if (this.__data__ instanceof
|
|
1811
|
+
if (this.__data__ instanceof ne) {
|
|
1792
1812
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1793
1813
|
return e.setAttribute("fill", this.__data__.color.toString()), e.setAttribute("stroke", "none"), this.svg_element = e, e;
|
|
1794
1814
|
}
|
|
1795
|
-
if (this.__data__ instanceof
|
|
1815
|
+
if (this.__data__ instanceof Wt) {
|
|
1796
1816
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1797
1817
|
return e.setAttribute("fill", this.__data__.color.toString()), e.setAttribute("stroke", "none"), this.svg_element = e, e;
|
|
1798
1818
|
}
|
|
@@ -1805,19 +1825,19 @@ const fs = class fs extends ne {
|
|
|
1805
1825
|
const t = ((s = this.graph.__data__.extremes) == null ? void 0 : s.x_max) ?? 1, e = this.__data__.meta ?? {};
|
|
1806
1826
|
if (e.isMeanEdge) {
|
|
1807
1827
|
this._stampEdge(this.svg_element);
|
|
1808
|
-
const i = typeof e.weight == "number" ? e.weight : 0, n = typeof e.maxWeight == "number" ? e.maxWeight : 1, r = typeof e.opacity == "number" ? e.opacity : Math.min(1, i / (n || 1)), a = t > 0 ? t : 1, h = typeof e.widthFrac == "number" ? a * e.widthFrac * i : a *
|
|
1809
|
-
if (this.__data__ instanceof
|
|
1810
|
-
this.__data__.weight = h, this.svg_element.setAttribute("d", this.__data__.path), this.svg_element.setAttribute("fill",
|
|
1811
|
-
else if (this.__data__ instanceof
|
|
1812
|
-
if (this.__data__.weight = h, this.svg_element.setAttribute("d", this.__data__.path), this.svg_element.setAttribute("fill",
|
|
1828
|
+
const i = typeof e.weight == "number" ? e.weight : 0, n = typeof e.maxWeight == "number" ? e.maxWeight : 1, r = typeof e.opacity == "number" ? e.opacity : Math.min(1, i / (n || 1)), a = t > 0 ? t : 1, h = typeof e.widthFrac == "number" ? a * e.widthFrac * i : a * mi * (i / (n || 1)), o = this.__data__._color || new st("#000000"), l = typeof e.saturation == "number" ? e.saturation : r, u = new we(o, l, r).toString();
|
|
1829
|
+
if (this.__data__ instanceof ne)
|
|
1830
|
+
this.__data__.weight = h, this.svg_element.setAttribute("d", this.__data__.path), this.svg_element.setAttribute("fill", u), this.svg_element.setAttribute("stroke", "none");
|
|
1831
|
+
else if (this.__data__ instanceof Wt) {
|
|
1832
|
+
if (this.__data__.weight = h, this.svg_element.setAttribute("d", this.__data__.path), this.svg_element.setAttribute("fill", u), this.svg_element.setAttribute("stroke", u), this.svg_element.setAttribute("stroke-width", String(pi)), this.svg_element.setAttribute("vector-effect", "non-scaling-stroke"), this.svg_element.setAttribute("stroke-linejoin", "round"), e.isDirected)
|
|
1813
1833
|
try {
|
|
1814
|
-
const c = new
|
|
1815
|
-
c && !c.includes("NaN") && !c.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", c), this._arrow_el.setAttribute("fill", Si(vi(
|
|
1834
|
+
const c = new Ie(this.__data__).path;
|
|
1835
|
+
c && !c.includes("NaN") && !c.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", c), this._arrow_el.setAttribute("fill", Si(vi(u), bi)), this._arrow_el.setAttribute("stroke", "#ffffff"), this._arrow_el.setAttribute("stroke-width", String(yi)), this._arrow_el.setAttribute("vector-effect", "non-scaling-stroke"), this._arrow_el.setAttribute("stroke-linejoin", "round"));
|
|
1816
1836
|
} catch {
|
|
1817
1837
|
}
|
|
1818
1838
|
} else {
|
|
1819
|
-
const g = this.__data__.from.x, c = this.__data__.from.y,
|
|
1820
|
-
this.svg_element.setAttribute("x1", g.toString()), this.svg_element.setAttribute("y1", c.toString()), this.svg_element.setAttribute("x2",
|
|
1839
|
+
const g = this.__data__.from.x, c = this.__data__.from.y, v = this.__data__.to.x, m = this.__data__.to.y;
|
|
1840
|
+
this.svg_element.setAttribute("x1", g.toString()), this.svg_element.setAttribute("y1", c.toString()), this.svg_element.setAttribute("x2", v.toString()), this.svg_element.setAttribute("y2", m.toString()), this.svg_element.setAttribute("stroke-width", h.toString()), this.svg_element.setAttribute("stroke", u), 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", g.toString()), this._hit_el.setAttribute("y1", c.toString()), this._hit_el.setAttribute("x2", v.toString()), this._hit_el.setAttribute("y2", m.toString()), this._hit_el.setAttribute("stroke-width", Math.max(h, t * 0.03).toString()), this._stampEdge(this._hit_el);
|
|
1821
1841
|
}
|
|
1822
1842
|
} else {
|
|
1823
1843
|
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());
|
|
@@ -1830,10 +1850,10 @@ const fs = class fs extends ne {
|
|
|
1830
1850
|
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));
|
|
1831
1851
|
}
|
|
1832
1852
|
};
|
|
1833
|
-
|
|
1834
|
-
let
|
|
1835
|
-
const ps = class ps extends
|
|
1836
|
-
constructor(t, e, s, i = new
|
|
1853
|
+
_(ms, "QELine");
|
|
1854
|
+
let St = ms;
|
|
1855
|
+
const ps = class ps extends re {
|
|
1856
|
+
constructor(t, e, s, i = new Ct()) {
|
|
1837
1857
|
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();
|
|
1838
1858
|
}
|
|
1839
1859
|
get x() {
|
|
@@ -1923,10 +1943,10 @@ const ps = class ps extends ne {
|
|
|
1923
1943
|
(t = this.parent) == null || t.appendChild(this.svg_element);
|
|
1924
1944
|
}
|
|
1925
1945
|
};
|
|
1926
|
-
|
|
1927
|
-
let
|
|
1928
|
-
const bs = class bs extends
|
|
1929
|
-
constructor(t, e, s, i = new
|
|
1946
|
+
_(ps, "QEPoint");
|
|
1947
|
+
let oe = ps;
|
|
1948
|
+
const bs = class bs extends re {
|
|
1949
|
+
constructor(t, e, s, i = new Ct()) {
|
|
1930
1950
|
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();
|
|
1931
1951
|
}
|
|
1932
1952
|
// Trajectory styling is specified in display pixels, while SVG paths use
|
|
@@ -1957,8 +1977,8 @@ const bs = class bs extends ne {
|
|
|
1957
1977
|
if (this._segments_group.innerHTML = "", this.__data__.lineStyle === "tapered") {
|
|
1958
1978
|
const s = this.__data__.pathPoints, i = s.length - 1, [n, r] = this.__data__.strokeWidthRange, [a, h] = this.__data__.opacityRange;
|
|
1959
1979
|
for (let o = 0; o < i; o++) {
|
|
1960
|
-
const l = s[o],
|
|
1961
|
-
|
|
1980
|
+
const l = s[o], u = s[o + 1], g = i <= 1 ? 1 : o / (i - 1), c = n + (r - n) * g, v = a + (h - a) * g, m = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1981
|
+
m.setAttribute("d", `M${l.x},${l.y} L${u.x},${u.y}`), m.setAttribute("fill", "none"), m.setAttribute("stroke", this.__data__.color.toString()), m.setAttribute("stroke-linecap", "round"), m.setAttribute("stroke-linejoin", "round"), m.setAttribute("stroke-width", this.graphUnitsForPixels(c).toString()), m.setAttribute("opacity", v.toString()), this._segments_group.appendChild(m);
|
|
1962
1982
|
}
|
|
1963
1983
|
this._segments_group.style.display = "block";
|
|
1964
1984
|
} else
|
|
@@ -1979,9 +1999,9 @@ const bs = class bs extends ne {
|
|
|
1979
1999
|
this.svg_element && !this.svg_element.parentElement && this.parent.appendChild(this.svg_element), this.update();
|
|
1980
2000
|
}
|
|
1981
2001
|
};
|
|
1982
|
-
|
|
1983
|
-
let
|
|
1984
|
-
const { ArrayTools: Ws } =
|
|
2002
|
+
_(bs, "QETrajectory");
|
|
2003
|
+
let Ne = bs;
|
|
2004
|
+
const { ArrayTools: Ws } = ie, ys = class ys extends Array {
|
|
1985
2005
|
constructor(...t) {
|
|
1986
2006
|
super(...t);
|
|
1987
2007
|
}
|
|
@@ -1990,7 +2010,7 @@ const { ArrayTools: Ws } = se, ys = class ys extends Array {
|
|
|
1990
2010
|
function i(r) {
|
|
1991
2011
|
return r.name === e ? r : void 0;
|
|
1992
2012
|
}
|
|
1993
|
-
|
|
2013
|
+
_(i, "fn");
|
|
1994
2014
|
function n(r, a, h = null) {
|
|
1995
2015
|
if (Ws.isArray(r)) {
|
|
1996
2016
|
for (const [o, l] of r.entries())
|
|
@@ -2007,28 +2027,28 @@ const { ArrayTools: Ws } = se, ys = class ys extends Array {
|
|
|
2007
2027
|
}
|
|
2008
2028
|
return s;
|
|
2009
2029
|
}
|
|
2010
|
-
return
|
|
2030
|
+
return _(n, "recurse"), n(this);
|
|
2011
2031
|
}
|
|
2012
2032
|
flatten() {
|
|
2013
2033
|
return this.reduce((t, e) => (t.push(e), e.layers && Array.isArray(e.layers) && t.push(...e.layers), t), []);
|
|
2014
2034
|
}
|
|
2015
2035
|
};
|
|
2016
|
-
|
|
2017
|
-
let
|
|
2036
|
+
_(ys, "QEArray");
|
|
2037
|
+
let Ct = ys;
|
|
2018
2038
|
const Ei = {
|
|
2019
|
-
AxisPoint:
|
|
2020
|
-
AxisLine:
|
|
2021
|
-
Point:
|
|
2022
|
-
Line:
|
|
2023
|
-
Edge:
|
|
2024
|
-
TaperedEdge:
|
|
2025
|
-
TaperedWeightedMidpointEdge:
|
|
2026
|
-
NodeEdge:
|
|
2027
|
-
Trajectory:
|
|
2028
|
-
},
|
|
2029
|
-
constructor(t, e, s, i = new
|
|
2039
|
+
AxisPoint: oe,
|
|
2040
|
+
AxisLine: St,
|
|
2041
|
+
Point: oe,
|
|
2042
|
+
Line: St,
|
|
2043
|
+
Edge: St,
|
|
2044
|
+
TaperedEdge: St,
|
|
2045
|
+
TaperedWeightedMidpointEdge: St,
|
|
2046
|
+
NodeEdge: St,
|
|
2047
|
+
Trajectory: Ne
|
|
2048
|
+
}, jt = class jt {
|
|
2049
|
+
constructor(t, e, s, i = new Ct()) {
|
|
2030
2050
|
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 }) => {
|
|
2031
|
-
const h = /* @__PURE__ */
|
|
2051
|
+
const h = /* @__PURE__ */ _((g) => {
|
|
2032
2052
|
var c;
|
|
2033
2053
|
return (c = g.__data__) == null ? void 0 : c.ID;
|
|
2034
2054
|
}, "childId"), o = this.__children__.filter(
|
|
@@ -2040,10 +2060,10 @@ const Ei = {
|
|
|
2040
2060
|
(g) => !this.__children__.some((c) => h(c) === g.ID)
|
|
2041
2061
|
).forEach((g) => {
|
|
2042
2062
|
const c = g._typeName || g.constructor.name;
|
|
2043
|
-
let
|
|
2044
|
-
|
|
2045
|
-
const
|
|
2046
|
-
this.__children__.push(
|
|
2063
|
+
let v = Ei[c];
|
|
2064
|
+
v || (g instanceof Ee ? v = Ne : g instanceof J ? v = oe : v = St);
|
|
2065
|
+
const m = new v(g, this.svg_element, this.graph);
|
|
2066
|
+
this.__children__.push(m);
|
|
2047
2067
|
}), l.forEach((g) => {
|
|
2048
2068
|
const c = r.objects.get(h(g));
|
|
2049
2069
|
c && (g.__data__ = c), g.update();
|
|
@@ -2061,8 +2081,8 @@ const Ei = {
|
|
|
2061
2081
|
if (!this.__data__)
|
|
2062
2082
|
throw new Error("Layer is null");
|
|
2063
2083
|
let t = this.__data__;
|
|
2064
|
-
return this.svg_element = document.createElementNS("http://www.w3.org/2000/svg",
|
|
2065
|
-
const s = new
|
|
2084
|
+
return this.svg_element = document.createElementNS("http://www.w3.org/2000/svg", jt.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) => {
|
|
2085
|
+
const s = new jt(e, this.svg_element, this.graph);
|
|
2066
2086
|
this.__children__.push(s);
|
|
2067
2087
|
}), this.svg_element;
|
|
2068
2088
|
}
|
|
@@ -2083,11 +2103,11 @@ const Ei = {
|
|
|
2083
2103
|
this.__children__.push(t);
|
|
2084
2104
|
}
|
|
2085
2105
|
};
|
|
2086
|
-
|
|
2087
|
-
let ts =
|
|
2106
|
+
_(jt, "QELayer"), jt.tagName = "g";
|
|
2107
|
+
let ts = jt;
|
|
2088
2108
|
const xs = class xs {
|
|
2089
|
-
constructor(t, e, s, i, n =
|
|
2090
|
-
this.text = t, this.point = e, 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.svg_element = this._create(), n ===
|
|
2109
|
+
constructor(t, e, s, i, n = U.DISPLAY_TYPES.ON, r = U.POSITION.OBJECT, a, h) {
|
|
2110
|
+
this.text = t, this.point = e, 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.svg_element = this._create(), n === U.DISPLAY_TYPES.ON ? (this._visible = !0, this.svg_element.setAttribute("display", "block")) : (this._visible = !1, this.svg_element.setAttribute("display", "none"));
|
|
2091
2111
|
}
|
|
2092
2112
|
_create() {
|
|
2093
2113
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
@@ -2099,17 +2119,17 @@ const xs = class xs {
|
|
|
2099
2119
|
e.preventDefault(), e.stopPropagation();
|
|
2100
2120
|
const s = t.ownerSVGElement;
|
|
2101
2121
|
if (!s) return;
|
|
2102
|
-
const i = /* @__PURE__ */
|
|
2122
|
+
const i = /* @__PURE__ */ _((l, u) => {
|
|
2103
2123
|
const g = s.createSVGPoint();
|
|
2104
|
-
g.x = l, g.y =
|
|
2124
|
+
g.x = l, g.y = u;
|
|
2105
2125
|
const c = s.getScreenCTM();
|
|
2106
2126
|
return c ? g.matrixTransform(c.inverse()) : { x: 0, y: 0 };
|
|
2107
2127
|
}, "toUser"), n = i(e.clientX, e.clientY), r = this._offsetX, a = this._offsetY;
|
|
2108
2128
|
t.style.cursor = "grabbing";
|
|
2109
|
-
const h = /* @__PURE__ */
|
|
2110
|
-
const
|
|
2111
|
-
this._offsetX = r + (
|
|
2112
|
-
}, "onMove"), o = /* @__PURE__ */
|
|
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__ */ _(() => {
|
|
2113
2133
|
document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", o), t.style.cursor = "grab", this.graph.dispatchEvent(new CustomEvent("qe-label-move", {
|
|
2114
2134
|
detail: { id: this.point.ID, transform: { x: this._offsetX, y: this._offsetY } },
|
|
2115
2135
|
bubbles: !0,
|
|
@@ -2131,28 +2151,68 @@ const xs = class xs {
|
|
|
2131
2151
|
const e = this.graph._labelFont ?? {}, s = e.size ? e.size * this.graph.unitsPerPixel() : t * 0.06, i = s * 1.2;
|
|
2132
2152
|
let n, r, a;
|
|
2133
2153
|
switch (this.position) {
|
|
2134
|
-
case
|
|
2154
|
+
case U.POSITION.STATIC: {
|
|
2135
2155
|
n = this.point.x, r = this.point.y - i * 0.3, a = "middle";
|
|
2136
2156
|
break;
|
|
2137
2157
|
}
|
|
2138
|
-
case
|
|
2139
|
-
const { cx: o, cy: l } = this.graph.__data__.extremes,
|
|
2140
|
-
n = o +
|
|
2158
|
+
case U.POSITION.CONTAINER: {
|
|
2159
|
+
const { cx: o, cy: l } = this.graph.__data__.extremes, u = this.point.x - o, g = this.point.y - l, c = Math.sqrt(u * u + g * g) || 1, v = t * 0.93 / c;
|
|
2160
|
+
n = o + u * v, r = l + g * v - i * 0.3, a = u >= 0 ? "start" : "end";
|
|
2141
2161
|
break;
|
|
2142
2162
|
}
|
|
2143
|
-
case
|
|
2163
|
+
case U.POSITION.CUSTOM:
|
|
2144
2164
|
if (this.customX != null && this.customY != null) {
|
|
2145
2165
|
n = this.customX, r = this.customY, a = "start";
|
|
2146
2166
|
break;
|
|
2147
2167
|
}
|
|
2148
2168
|
default:
|
|
2149
|
-
case
|
|
2169
|
+
case U.POSITION.OBJECT: {
|
|
2150
2170
|
const o = this.point.x >= 0 ? i : -i;
|
|
2151
2171
|
a = this.point.x >= 0 ? "start" : "end", n = this.point.x + o, r = this.point.y - i * 0.4;
|
|
2152
2172
|
break;
|
|
2153
2173
|
}
|
|
2154
2174
|
}
|
|
2155
|
-
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.setAttribute("font-size", s.toString()), this.svg_element.setAttribute("font-family", e.family ?? "system-ui, sans-serif"), this.svg_element.setAttribute("font-weight", "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");
|
|
2175
|
+
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.setAttribute("font-size", s.toString()), this.svg_element.setAttribute("font-family", e.family ?? "system-ui, sans-serif"), this.svg_element.setAttribute("font-weight", "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 !== U.POSITION.CUSTOM && this.fitInside(n, r, a, i, s * 0.3);
|
|
2176
|
+
}
|
|
2177
|
+
/** The visible plot area in this label's coordinates (so zoom, pan and the
|
|
2178
|
+
* viewBox's letterboxing are accounted for), or null if not laid out. */
|
|
2179
|
+
visibleBounds() {
|
|
2180
|
+
var h;
|
|
2181
|
+
const t = this.svg_element, e = t.ownerSVGElement, s = (h = t.getScreenCTM) == null ? void 0 : h.call(t);
|
|
2182
|
+
if (!e || !s) return null;
|
|
2183
|
+
const i = e.getBoundingClientRect();
|
|
2184
|
+
if (!(i.width > 0 && i.height > 0)) return null;
|
|
2185
|
+
const n = s.inverse(), r = new DOMPoint(i.left, i.top).matrixTransform(n), a = new DOMPoint(i.right, i.bottom).matrixTransform(n);
|
|
2186
|
+
return {
|
|
2187
|
+
left: Math.min(r.x, a.x),
|
|
2188
|
+
right: Math.max(r.x, a.x),
|
|
2189
|
+
top: Math.min(r.y, a.y),
|
|
2190
|
+
bottom: Math.max(r.y, a.y)
|
|
2191
|
+
};
|
|
2192
|
+
}
|
|
2193
|
+
bbox() {
|
|
2194
|
+
try {
|
|
2195
|
+
const t = this.svg_element.getBBox();
|
|
2196
|
+
return t.width > 0 ? t : null;
|
|
2197
|
+
} catch {
|
|
2198
|
+
return null;
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
/** If the label runs past an edge: put an outward label on the other side
|
|
2202
|
+
* of its point, and if it still doesn't fit, slide it back inside. */
|
|
2203
|
+
fitInside(t, e, s, i, n) {
|
|
2204
|
+
const r = this.visibleBounds();
|
|
2205
|
+
let a = this.bbox();
|
|
2206
|
+
if (!r || !a) return;
|
|
2207
|
+
const h = r.left + n, o = r.right - n, l = r.top + n, u = r.bottom - n, g = /* @__PURE__ */ _((A) => Math.max(0, h - A.x) + Math.max(0, A.x + A.width - o), "over"), c = this.svg_element;
|
|
2208
|
+
if (g(a) > 0 && this.position === U.POSITION.OBJECT && s !== "middle") {
|
|
2209
|
+
const A = s === "end" ? "start" : "end", O = s === "end" ? this.point.x + i : this.point.x - i;
|
|
2210
|
+
c.setAttribute("text-anchor", A), c.setAttribute("x", O.toString());
|
|
2211
|
+
const F = this.bbox();
|
|
2212
|
+
F && g(F) < g(a) ? (a = F, t = O) : (c.setAttribute("text-anchor", s), c.setAttribute("x", t.toString()));
|
|
2213
|
+
}
|
|
2214
|
+
let v = 0, m = 0;
|
|
2215
|
+
a.x < h ? v = h - a.x : a.x + a.width > o && (v = Math.max(o - (a.x + a.width), h - a.x)), a.y < l ? m = l - a.y : a.y + a.height > u && (m = Math.max(u - (a.y + a.height), l - a.y)), v && c.setAttribute("x", (t + v).toString()), m && c.setAttribute("y", (e + m).toString());
|
|
2156
2216
|
}
|
|
2157
2217
|
/** Make the label visible and position it immediately. */
|
|
2158
2218
|
show() {
|
|
@@ -2171,38 +2231,38 @@ const xs = class xs {
|
|
|
2171
2231
|
this.svg_element.remove();
|
|
2172
2232
|
}
|
|
2173
2233
|
};
|
|
2174
|
-
|
|
2175
|
-
let
|
|
2234
|
+
_(xs, "QELabel");
|
|
2235
|
+
let Jt = xs;
|
|
2176
2236
|
const je = class je extends HTMLElement {
|
|
2177
2237
|
};
|
|
2178
|
-
|
|
2179
|
-
let
|
|
2238
|
+
_(je, "QENodesElement"), je.tagName = "qe-nodes";
|
|
2239
|
+
let ke = je;
|
|
2180
2240
|
const Ye = class Ye extends HTMLElement {
|
|
2181
2241
|
};
|
|
2182
|
-
|
|
2183
|
-
let
|
|
2242
|
+
_(Ye, "QEMeansElement"), Ye.tagName = "qe-means";
|
|
2243
|
+
let Ce = Ye;
|
|
2184
2244
|
const qe = class qe extends HTMLElement {
|
|
2185
2245
|
};
|
|
2186
|
-
|
|
2187
|
-
let
|
|
2246
|
+
_(qe, "QEPointsElement"), qe.tagName = "qe-points";
|
|
2247
|
+
let Oe = qe;
|
|
2188
2248
|
const Ue = class Ue extends HTMLElement {
|
|
2189
2249
|
};
|
|
2190
|
-
|
|
2191
|
-
let
|
|
2192
|
-
const Ge = class Ge extends HTMLElement {
|
|
2193
|
-
};
|
|
2194
|
-
u(Ge, "QETrajectoriesElement"), Ge.tagName = "qe-trajectories";
|
|
2195
|
-
let $e = Ge;
|
|
2250
|
+
_(Ue, "QEEdgesElement"), Ue.tagName = "qe-edges";
|
|
2251
|
+
let $e = Ue;
|
|
2196
2252
|
const Be = class Be extends HTMLElement {
|
|
2197
2253
|
};
|
|
2198
|
-
|
|
2254
|
+
_(Be, "QETrajectoriesElement"), Be.tagName = "qe-trajectories";
|
|
2199
2255
|
let Pe = Be;
|
|
2200
|
-
|
|
2256
|
+
const Ge = class Ge extends HTMLElement {
|
|
2257
|
+
};
|
|
2258
|
+
_(Ge, "QEAxesElement"), Ge.tagName = "qe-axes";
|
|
2259
|
+
let Re = Ge;
|
|
2201
2260
|
customElements.define(ke.tagName, ke);
|
|
2202
2261
|
customElements.define(Ce.tagName, Ce);
|
|
2203
2262
|
customElements.define(Oe.tagName, Oe);
|
|
2204
2263
|
customElements.define($e.tagName, $e);
|
|
2205
2264
|
customElements.define(Pe.tagName, Pe);
|
|
2265
|
+
customElements.define(Re.tagName, Re);
|
|
2206
2266
|
const Vs = [
|
|
2207
2267
|
"#4477AA",
|
|
2208
2268
|
"#EE6677",
|
|
@@ -2223,32 +2283,32 @@ function Mi(d, t) {
|
|
|
2223
2283
|
}
|
|
2224
2284
|
return null;
|
|
2225
2285
|
}
|
|
2226
|
-
|
|
2286
|
+
_(Mi, "parseEdgePair");
|
|
2227
2287
|
function Ii(d, t, e, s) {
|
|
2228
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, d) / e) * s, a = Math.sqrt(Math.max(0, t) / e) * s;
|
|
2229
2289
|
return { halfW: n * r, halfH: n * a };
|
|
2230
2290
|
}
|
|
2231
|
-
|
|
2291
|
+
_(Ii, "computeCIRect");
|
|
2232
2292
|
const Ni = 0.5;
|
|
2233
|
-
function
|
|
2293
|
+
function pe(d, t, e) {
|
|
2234
2294
|
if (!d) return;
|
|
2235
2295
|
const s = Math.min(Math.abs(t), Math.abs(e));
|
|
2236
2296
|
s > 0 && (d.meta = { ...d.meta ?? {}, maxRadius: s * Ni });
|
|
2237
2297
|
}
|
|
2238
|
-
|
|
2239
|
-
function
|
|
2240
|
-
const i = /* @__PURE__ */
|
|
2241
|
-
const l = d.names.indexOf(o),
|
|
2242
|
-
if (
|
|
2243
|
-
const g = Number(
|
|
2298
|
+
_(pe, "capMeanToInterval");
|
|
2299
|
+
function be(d, t, e, s = "") {
|
|
2300
|
+
const i = /* @__PURE__ */ _((o) => {
|
|
2301
|
+
const l = d.names.indexOf(o), u = l >= 0 ? d[l] : null;
|
|
2302
|
+
if (u == null || u === "") return;
|
|
2303
|
+
const g = Number(u);
|
|
2244
2304
|
return Number.isFinite(g) ? g : void 0;
|
|
2245
2305
|
}, "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`);
|
|
2246
2306
|
return n == null || r == null || a == null || h == null ? null : { x_low: n, x_high: r, y_low: a, y_high: h };
|
|
2247
2307
|
}
|
|
2248
|
-
|
|
2308
|
+
_(be, "readIntervalBounds");
|
|
2249
2309
|
function ki(d) {
|
|
2250
2310
|
var i, n;
|
|
2251
|
-
const t = /* @__PURE__ */
|
|
2311
|
+
const t = /* @__PURE__ */ _((r) => d.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)) ?? [];
|
|
2252
2312
|
return {
|
|
2253
2313
|
group: t("group"),
|
|
2254
2314
|
unit: t("unit"),
|
|
@@ -2260,17 +2320,17 @@ function ki(d) {
|
|
|
2260
2320
|
name: t("name")
|
|
2261
2321
|
};
|
|
2262
2322
|
}
|
|
2263
|
-
|
|
2323
|
+
_(ki, "parseEdgeLayer");
|
|
2264
2324
|
function Ci(d) {
|
|
2265
|
-
const { r: t, g: e, b: s } =
|
|
2325
|
+
const { r: t, g: e, b: s } = st.parseColor(d), i = Math.max(t, e, s), n = Math.min(t, e, s), r = /* @__PURE__ */ _((a) => (i + n - a).toString(16).padStart(2, "0"), "f");
|
|
2266
2326
|
return `#${r(t)}${r(e)}${r(s)}`;
|
|
2267
2327
|
}
|
|
2268
|
-
|
|
2328
|
+
_(Ci, "complementColor");
|
|
2269
2329
|
function Oi(d) {
|
|
2270
2330
|
const t = d == null ? void 0 : d.trim().toLowerCase();
|
|
2271
2331
|
return t === "plot" || t === "absolute" ? t : "model";
|
|
2272
2332
|
}
|
|
2273
|
-
|
|
2333
|
+
_(Oi, "parseColorScale");
|
|
2274
2334
|
function He(d, t) {
|
|
2275
2335
|
switch (d == null ? void 0 : d.toLowerCase()) {
|
|
2276
2336
|
case "on":
|
|
@@ -2285,11 +2345,11 @@ function He(d, t) {
|
|
|
2285
2345
|
return t;
|
|
2286
2346
|
}
|
|
2287
2347
|
}
|
|
2288
|
-
|
|
2289
|
-
const
|
|
2348
|
+
_(He, "parseLabelMode");
|
|
2349
|
+
const gt = class gt extends ve {
|
|
2290
2350
|
constructor() {
|
|
2291
|
-
super(), this.zoom_level = 1, this.__children__ = new
|
|
2292
|
-
var vs, Ss, Es, Ms, Is, Ns, ks, Cs, Os, $s, Ps, Rs, Ls,
|
|
2351
|
+
super(), this.zoom_level = 1, this.__children__ = new Ct(), 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._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._plotTitle = null, this._titleEl = null, this._resizeObs = null, this._labelFont = { size: null, family: null, color: null }, this._animateMs = 0, this._tweenRaf = 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 Ke(Ks), this.__name__ = this.__data__.name || "unnamed-graph", this.svg_element = this.create(), console.log("Created ena-graph svg element: ", this.svg_element), document.addEventListener("model-updated", (t) => {
|
|
2352
|
+
var vs, Ss, Es, Ms, Is, Ns, ks, Cs, Os, $s, Ps, Rs, Ls, Ts, Ds;
|
|
2293
2353
|
const e = ((vs = t.composedPath) == null ? void 0 : vs.call(t)[0]) ?? t.target;
|
|
2294
2354
|
if (this._vizena && e !== this._vizena) return;
|
|
2295
2355
|
const s = t.detail;
|
|
@@ -2299,227 +2359,227 @@ const ut = class ut extends Ae {
|
|
|
2299
2359
|
this._hasModel = !0;
|
|
2300
2360
|
const n = s.dimensions, r = s.unit_id_col, a = s.node_id_col, h = s.group_col, o = this._readLayerConfig();
|
|
2301
2361
|
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");
|
|
2302
|
-
const l = {},
|
|
2362
|
+
const l = {}, u = (Ss = s.palette) != null && Ss.length ? s.palette : Vs;
|
|
2303
2363
|
if (h && ((Es = s.points) != null && Es.names)) {
|
|
2304
2364
|
const C = s.points.col(h);
|
|
2305
|
-
C && [...new Set([...C].map(String))].forEach((
|
|
2306
|
-
l[
|
|
2365
|
+
C && [...new Set([...C].map(String))].forEach((P, y) => {
|
|
2366
|
+
l[P] = u[y % u.length];
|
|
2307
2367
|
});
|
|
2308
2368
|
}
|
|
2309
2369
|
(Ms = s.groups) != null && Ms.rows && s.groups.rows().length > 0 && s.groups.rows().forEach((C) => {
|
|
2310
|
-
const I = C.rowName ?? String(C[0]),
|
|
2311
|
-
|
|
2370
|
+
const I = C.rowName ?? String(C[0]), P = C.names.indexOf("color"), y = P >= 0 ? C[P] : null;
|
|
2371
|
+
y && String(y) !== "NA" ? l[I] = String(y) : l[I] || (l[I] = u[Object.keys(l).length % u.length]);
|
|
2312
2372
|
});
|
|
2313
2373
|
const g = Object.keys(l), c = o.activeMeanGroups && o.activeMeanGroups.trim() ? new Set(
|
|
2314
2374
|
o.activeMeanGroups.split(",").map((C) => C.trim()).filter((C) => l[C])
|
|
2315
2375
|
// silently drop names not in model
|
|
2316
|
-
) : new Set(g),
|
|
2376
|
+
) : new Set(g), v = o.scalePoints, m = /* @__PURE__ */ _((C) => {
|
|
2317
2377
|
let I = 0;
|
|
2318
|
-
return C.forEach((
|
|
2319
|
-
const
|
|
2320
|
-
|
|
2378
|
+
return C.forEach((P) => {
|
|
2379
|
+
const y = P.names.indexOf(n[0]), b = n.length > 1 ? P.names.indexOf(n[1]) : -1;
|
|
2380
|
+
y >= 0 && (I = Math.max(I, Math.abs(Number(P[y])))), b >= 0 && (I = Math.max(I, Math.abs(Number(P[b]))));
|
|
2321
2381
|
}), I;
|
|
2322
|
-
}, "getExtent"),
|
|
2323
|
-
this._rangeExtent = o.range === "network" ?
|
|
2324
|
-
const j = o.labelNodes, nt = o.labelMeans,
|
|
2325
|
-
const
|
|
2326
|
-
ID:
|
|
2382
|
+
}, "getExtent"), A = (Is = s.nodes) != null && Is.rows ? m(s.nodes.rows()) : 0, O = (Ns = s.points) != null && Ns.rows ? m(s.points.rows()) : 0, F = (ks = s.trajectories) != null && ks.rows ? m(s.trajectories.rows()) : 0, Y = O > 0 ? O : F, E = o.pointScale !== null ? o.pointScale : v && Y > 0 && A > 0 ? A / Y : 1;
|
|
2383
|
+
this._rangeExtent = o.range === "network" ? A * 1.2 : o.range === "points" ? Y * E * 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._plotTitle = o.plotTitle, this._labelFont = o.labelFont;
|
|
2384
|
+
const j = o.labelNodes, nt = o.labelMeans, ot = o.labelPoints, it = this._labelsGroup, ut = /* @__PURE__ */ _((C, I, P, y = 1) => {
|
|
2385
|
+
const b = C.names.indexOf(I), S = C.names.indexOf(n[0]), $ = n.length > 1 ? C.names.indexOf(n[1]) : -1, p = new J({
|
|
2386
|
+
ID: b >= 0 ? String(C[b]) : C.rowName || `pt-${Math.random().toString(36).slice(2)}`,
|
|
2327
2387
|
dimensions: [
|
|
2328
|
-
|
|
2329
|
-
|
|
2388
|
+
S >= 0 ? Number(C[S]) * y : 0,
|
|
2389
|
+
$ >= 0 ? -Number(C[$]) * y : 0
|
|
2330
2390
|
// negate Y: SVG y-down vs ENA y-up
|
|
2331
2391
|
],
|
|
2332
2392
|
meta: {}
|
|
2333
2393
|
});
|
|
2334
|
-
return
|
|
2335
|
-
}, "rowToPoint"),
|
|
2336
|
-
if (o.pointSets.length && (
|
|
2337
|
-
const C = this.__children__.search("__children__", "points"), I = /* @__PURE__ */
|
|
2338
|
-
const
|
|
2339
|
-
return
|
|
2394
|
+
return P && (p.color = new st(P)), p;
|
|
2395
|
+
}, "rowToPoint"), K = {}, It = o.showPoints, Ot = s.pointsets;
|
|
2396
|
+
if (o.pointSets.length && (Ot != null && Ot.rows)) {
|
|
2397
|
+
const C = this.__children__.search("__children__", "points"), I = /* @__PURE__ */ _((P, y) => {
|
|
2398
|
+
const b = P.names.indexOf(y);
|
|
2399
|
+
return b >= 0 ? P[b] : null;
|
|
2340
2400
|
}, "col");
|
|
2341
|
-
o.pointSets.forEach((
|
|
2342
|
-
|
|
2343
|
-
if (String(I(
|
|
2344
|
-
const
|
|
2345
|
-
|
|
2346
|
-
const
|
|
2347
|
-
|
|
2348
|
-
const
|
|
2349
|
-
|
|
2401
|
+
o.pointSets.forEach((P, y) => {
|
|
2402
|
+
Ot.rows().forEach((b) => {
|
|
2403
|
+
if (String(I(b, "set")) !== P.set) return;
|
|
2404
|
+
const S = String(I(b, "id")), $ = I(b, "group") != null && String(I(b, "group")) !== "NA" ? String(I(b, "group")) : null, p = I(b, "color") && String(I(b, "color")) !== "NA" ? String(I(b, "color")) : $ && l[$] ? l[$] : u[y % u.length], w = ut(b, "id", p, E);
|
|
2405
|
+
w.ID = `${P.set}::${S}`, w.size = P.size ?? o.pointSize ?? 2.5;
|
|
2406
|
+
const R = I(b, "shape");
|
|
2407
|
+
R && String(R) !== "NA" && (w.shape = String(R));
|
|
2408
|
+
const q = I(b, "label");
|
|
2409
|
+
w.meta = {
|
|
2350
2410
|
stroke: "#ffffff",
|
|
2351
2411
|
kind: "point",
|
|
2352
|
-
name:
|
|
2353
|
-
group:
|
|
2354
|
-
unit:
|
|
2355
|
-
set:
|
|
2356
|
-
fixedSize:
|
|
2357
|
-
}, this.__data__.points.set(
|
|
2412
|
+
name: q != null && String(q) !== "NA" ? String(q) : S,
|
|
2413
|
+
group: $ ?? void 0,
|
|
2414
|
+
unit: S,
|
|
2415
|
+
set: P.set,
|
|
2416
|
+
fixedSize: P.fixedSize
|
|
2417
|
+
}, this.__data__.points.set(w.ID, w), C == null || C.__data__.objects.set(w.ID, w);
|
|
2358
2418
|
});
|
|
2359
2419
|
});
|
|
2360
2420
|
}
|
|
2361
2421
|
if ((Cs = s.points) != null && Cs.rows) {
|
|
2362
2422
|
const C = this.__children__.search("__children__", "points");
|
|
2363
2423
|
if (C) {
|
|
2364
|
-
s.points.rows().forEach((
|
|
2365
|
-
const
|
|
2366
|
-
if (
|
|
2367
|
-
const
|
|
2368
|
-
|
|
2369
|
-
...
|
|
2424
|
+
s.points.rows().forEach((y) => {
|
|
2425
|
+
const b = h ? y.names.indexOf(h) : -1, S = b >= 0 ? String(y[b]) : null, $ = S ? l[S] ?? "#888888" : "#888888";
|
|
2426
|
+
if (It) {
|
|
2427
|
+
const p = ut(y, r, $, E);
|
|
2428
|
+
p.size = o.pointSize ?? 2.5, p.meta = {
|
|
2429
|
+
...p.meta ?? {},
|
|
2370
2430
|
stroke: "#ffffff",
|
|
2371
2431
|
kind: "point",
|
|
2372
|
-
name:
|
|
2373
|
-
group:
|
|
2374
|
-
unit:
|
|
2432
|
+
name: p.ID,
|
|
2433
|
+
group: S ?? void 0,
|
|
2434
|
+
unit: p.ID,
|
|
2375
2435
|
fixedSize: o.pointFixedSize
|
|
2376
|
-
}, this.__data__.points.set(
|
|
2436
|
+
}, this.__data__.points.set(p.ID, p), C.__data__.objects.set(p.ID, p);
|
|
2377
2437
|
}
|
|
2378
|
-
if (
|
|
2379
|
-
const
|
|
2380
|
-
|
|
2381
|
-
const
|
|
2382
|
-
|
|
2438
|
+
if (S) {
|
|
2439
|
+
const p = y.names.indexOf(n[0]), w = n.length > 1 ? y.names.indexOf(n[1]) : -1;
|
|
2440
|
+
K[S] || (K[S] = { x: 0, y: 0, x2: 0, y2: 0, xy: 0, n: 0, color: $ });
|
|
2441
|
+
const R = p >= 0 ? Number(y[p]) : 0, q = w >= 0 ? Number(y[w]) : 0;
|
|
2442
|
+
K[S].x += R, K[S].y += q, K[S].x2 += R * R, K[S].y2 += q * q, K[S].xy += R * q, K[S].n += 1;
|
|
2383
2443
|
}
|
|
2384
2444
|
});
|
|
2385
|
-
const I = !!((Os = s.groups) != null && Os.rows && s.groups.rows().length > 0),
|
|
2386
|
-
const
|
|
2387
|
-
return c.size === 0 || c.has(
|
|
2445
|
+
const I = !!((Os = s.groups) != null && Os.rows && s.groups.rows().length > 0), P = o.showMeans && I ? s.groups.rows().filter((y) => {
|
|
2446
|
+
const b = y.rowName ?? String(y[0]);
|
|
2447
|
+
return c.size === 0 || c.has(b);
|
|
2388
2448
|
}) : [];
|
|
2389
2449
|
if (o.showMeans) {
|
|
2390
|
-
const
|
|
2450
|
+
const y = C.svg_element, b = this._rangeExtent ? this._rangeExtent / 1.2 : A, S = (b > 0 ? b : 1) * 8e-3;
|
|
2391
2451
|
if (I) {
|
|
2392
|
-
const $ = new Set(
|
|
2393
|
-
this._ciRects.forEach((
|
|
2394
|
-
$.has(
|
|
2395
|
-
}), this._outlierRects.forEach((
|
|
2396
|
-
$.has(
|
|
2397
|
-
}), this._ciCross.forEach((
|
|
2398
|
-
$.has(
|
|
2399
|
-
}),
|
|
2400
|
-
var
|
|
2401
|
-
const
|
|
2402
|
-
ID: `mean-${
|
|
2403
|
-
dimensions: [
|
|
2404
|
-
meta: { kind: "mean", name:
|
|
2452
|
+
const $ = new Set(P.map((p) => p.rowName ?? String(p[0])));
|
|
2453
|
+
this._ciRects.forEach((p, w) => {
|
|
2454
|
+
$.has(w) || (p.remove(), this._ciRects.delete(w));
|
|
2455
|
+
}), this._outlierRects.forEach((p, w) => {
|
|
2456
|
+
$.has(w) || (p.remove(), this._outlierRects.delete(w));
|
|
2457
|
+
}), this._ciCross.forEach((p, w) => {
|
|
2458
|
+
$.has(w.slice(2)) || (p.remove(), this._ciCross.delete(w));
|
|
2459
|
+
}), P.forEach((p) => {
|
|
2460
|
+
var N, z, T;
|
|
2461
|
+
const w = p.rowName ?? String(p[0]), R = l[w] ?? "#888888", q = p.names.indexOf(n[0]), X = n.length > 1 ? p.names.indexOf(n[1]) : -1, W = q >= 0 ? Number(p[q]) * E : 0, mt = X >= 0 ? -Number(p[X]) * E : 0, Z = new J({
|
|
2462
|
+
ID: `mean-${w}`,
|
|
2463
|
+
dimensions: [W, mt],
|
|
2464
|
+
meta: { kind: "mean", name: w, group: w, fixedSize: o.meanFixedSize }
|
|
2405
2465
|
});
|
|
2406
|
-
Z.color = new
|
|
2407
|
-
const
|
|
2466
|
+
Z.color = new st(R), Z.size = 4;
|
|
2467
|
+
const at = p.names.indexOf("shape"), L = at >= 0 ? p[at] : null;
|
|
2408
2468
|
Z.shape = L && String(L) !== "NA" ? String(L) : "rect", this.__data__.points.set(Z.ID, Z), C.__data__.objects.set(Z.ID, Z);
|
|
2409
|
-
const
|
|
2410
|
-
const
|
|
2411
|
-
return
|
|
2412
|
-
}, "cell"),
|
|
2413
|
-
if (!
|
|
2414
|
-
(
|
|
2469
|
+
const Dt = /* @__PURE__ */ _((M) => {
|
|
2470
|
+
const tt = p.names.indexOf(M), G = tt >= 0 ? p[tt] : null;
|
|
2471
|
+
return G == null || String(G) === "NA" || String(G) === "" ? null : G;
|
|
2472
|
+
}, "cell"), xt = Dt("intervals"), At = xt === "box" || xt === "crosshairs" || xt === "none" ? xt : o.intervals, vt = Dt("outlier"), B = (vt == null ? o.showOutlier : vt === !0 || String(vt) === "true") ? be(p, n[0], n[1], "o") : null;
|
|
2473
|
+
if (!B)
|
|
2474
|
+
(N = this._outlierRects.get(w)) == null || N.remove(), this._outlierRects.delete(w);
|
|
2415
2475
|
else {
|
|
2416
|
-
let
|
|
2417
|
-
|
|
2476
|
+
let M = this._outlierRects.get(w);
|
|
2477
|
+
M || (M = document.createElementNS("http://www.w3.org/2000/svg", "rect"), M.setAttribute("data-outlier-group", w), this._outlierRects.set(w, M)), M.setAttribute("x", (B.x_low * E).toString()), M.setAttribute("y", (-B.y_high * E).toString()), M.setAttribute("width", ((B.x_high - B.x_low) * E).toString()), M.setAttribute("height", ((B.y_high - B.y_low) * E).toString()), M.setAttribute("fill", "none"), M.setAttribute("stroke", R), M.setAttribute("stroke-width", S.toString()), M.setAttribute("stroke-opacity", "0.5"), M.setAttribute("stroke-dasharray", `${S * 2} ${S * 2}`), y && !M.parentElement && y.insertBefore(M, y.firstChild);
|
|
2418
2478
|
}
|
|
2419
|
-
const
|
|
2420
|
-
if ((!
|
|
2421
|
-
(T = this._ciRects.get(
|
|
2422
|
-
const
|
|
2423
|
-
|
|
2424
|
-
let D = this._ciCross.get(
|
|
2425
|
-
D || (D = document.createElementNS("http://www.w3.org/2000/svg", "path"), D.setAttribute("data-ci-group",
|
|
2426
|
-
} else if (
|
|
2427
|
-
const
|
|
2428
|
-
|
|
2429
|
-
let D = this._ciRects.get(
|
|
2430
|
-
D || (D = document.createElementNS("http://www.w3.org/2000/svg", "rect"), D.setAttribute("data-ci-group",
|
|
2479
|
+
const f = At !== "none" ? be(p, n[0], n[1]) : null, x = `x:${w}`;
|
|
2480
|
+
if ((!f || At !== "crosshairs") && ((z = this._ciCross.get(x)) == null || z.remove(), this._ciCross.delete(x)), f && At === "crosshairs") {
|
|
2481
|
+
(T = this._ciRects.get(w)) == null || T.remove(), this._ciRects.delete(w);
|
|
2482
|
+
const M = f.x_low * E, tt = f.x_high * E, G = -f.y_high * E, rt = -f.y_low * E;
|
|
2483
|
+
pe(Z, (tt - M) / 2, (rt - G) / 2);
|
|
2484
|
+
let D = this._ciCross.get(x);
|
|
2485
|
+
D || (D = document.createElementNS("http://www.w3.org/2000/svg", "path"), D.setAttribute("data-ci-group", w), D.setAttribute("data-ci-kind", "crosshairs"), this._ciCross.set(x, D)), D.setAttribute("d", `M${M} ${mt} L${tt} ${mt} M${W} ${G} L${W} ${rt}`), D.setAttribute("fill", "none"), D.setAttribute("stroke", R), D.setAttribute("stroke-width", (S * 1.25).toString()), D.setAttribute("stroke-opacity", "0.8"), y && !D.parentElement && y.insertBefore(D, y.firstChild);
|
|
2486
|
+
} else if (f) {
|
|
2487
|
+
const M = f.x_low * E, tt = -f.y_high * E, G = (f.x_high - f.x_low) * E, rt = (f.y_high - f.y_low) * E;
|
|
2488
|
+
pe(Z, G / 2, rt / 2);
|
|
2489
|
+
let D = this._ciRects.get(w);
|
|
2490
|
+
D || (D = document.createElementNS("http://www.w3.org/2000/svg", "rect"), D.setAttribute("data-ci-group", w), this._ciRects.set(w, D)), D.setAttribute("x", M.toString()), D.setAttribute("y", tt.toString()), D.setAttribute("width", G.toString()), D.setAttribute("height", rt.toString()), D.setAttribute("fill", "none"), D.setAttribute("stroke", R), D.setAttribute("stroke-width", S.toString()), D.setAttribute("stroke-opacity", "0.8"), D.setAttribute("stroke-dasharray", `${S * 4} ${S * 3}`), y && !D.parentElement && y.insertBefore(D, y.firstChild);
|
|
2431
2491
|
} else {
|
|
2432
|
-
const
|
|
2433
|
-
|
|
2492
|
+
const M = this._ciRects.get(w);
|
|
2493
|
+
M && (M.remove(), this._ciRects.delete(w));
|
|
2434
2494
|
}
|
|
2435
2495
|
});
|
|
2436
2496
|
} else
|
|
2437
|
-
Object.entries(
|
|
2438
|
-
const
|
|
2439
|
-
ID: `mean-${
|
|
2440
|
-
dimensions: [
|
|
2441
|
-
meta: { kind: "mean", name:
|
|
2497
|
+
Object.entries(K).forEach(([p, { x: w, y: R, n: q, color: X }]) => {
|
|
2498
|
+
const W = new J({
|
|
2499
|
+
ID: `mean-${p}`,
|
|
2500
|
+
dimensions: [w / q * E, -(R / q) * E],
|
|
2501
|
+
meta: { kind: "mean", name: p, group: p, fixedSize: o.meanFixedSize }
|
|
2442
2502
|
});
|
|
2443
|
-
|
|
2444
|
-
}), o.showCI && (this._ciRects.forEach((
|
|
2445
|
-
|
|
2446
|
-
}), ($s = s.confidence) != null && $s.rows ? s.confidence.rows().forEach((
|
|
2447
|
-
const
|
|
2448
|
-
if (!M) return;
|
|
2449
|
-
const F = l[M] ?? "#888888", R = pe(b, n[0], n[1]);
|
|
2503
|
+
W.color = new st(X), W.size = 4, W.shape = "rect", this.__data__.points.set(W.ID, W), C.__data__.objects.set(W.ID, W);
|
|
2504
|
+
}), o.showCI && (this._ciRects.forEach((p, w) => {
|
|
2505
|
+
K[w] || (p.remove(), this._ciRects.delete(w));
|
|
2506
|
+
}), ($s = s.confidence) != null && $s.rows ? s.confidence.rows().forEach((p) => {
|
|
2507
|
+
const w = p.names.indexOf(h ?? "group"), R = w >= 0 ? String(p[w]) : p.rowName ?? null;
|
|
2450
2508
|
if (!R) return;
|
|
2451
|
-
const
|
|
2452
|
-
|
|
2453
|
-
|
|
2509
|
+
const q = l[R] ?? "#888888", X = be(p, n[0], n[1]);
|
|
2510
|
+
if (!X) return;
|
|
2511
|
+
const W = X.x_low * E, mt = -X.y_high * E, Z = (X.x_high - X.x_low) * E, at = (X.y_high - X.y_low) * E;
|
|
2512
|
+
pe(
|
|
2513
|
+
this.__data__.points.get(`mean-${R}`),
|
|
2454
2514
|
Z / 2,
|
|
2455
|
-
|
|
2515
|
+
at / 2
|
|
2456
2516
|
);
|
|
2457
|
-
let L = this._ciRects.get(
|
|
2458
|
-
L || (L = document.createElementNS("http://www.w3.org/2000/svg", "rect"), L.setAttribute("data-ci-group",
|
|
2459
|
-
}) : Object.entries(
|
|
2460
|
-
if (
|
|
2461
|
-
const Z =
|
|
2462
|
-
|
|
2463
|
-
this.__data__.points.get(`mean-${
|
|
2464
|
-
|
|
2465
|
-
|
|
2517
|
+
let L = this._ciRects.get(R);
|
|
2518
|
+
L || (L = document.createElementNS("http://www.w3.org/2000/svg", "rect"), L.setAttribute("data-ci-group", R), this._ciRects.set(R, L)), L.setAttribute("x", W.toString()), L.setAttribute("y", mt.toString()), L.setAttribute("width", Z.toString()), L.setAttribute("height", at.toString()), L.setAttribute("fill", "none"), L.setAttribute("stroke", q), L.setAttribute("stroke-width", S.toString()), L.setAttribute("stroke-opacity", "0.8"), L.setAttribute("stroke-dasharray", `${S * 4} ${S * 3}`), y && !L.parentElement && y.insertBefore(L, y.firstChild);
|
|
2519
|
+
}) : Object.entries(K).forEach(([p, { x: w, y: R, x2: q, y2: X, n: W, color: mt }]) => {
|
|
2520
|
+
if (W < 2) return;
|
|
2521
|
+
const Z = w / W, at = R / W, L = q / W - Z * Z, Dt = X / W - at * at, { halfW: xt, halfH: At } = Ii(L, Dt, W, E), vt = Z * E, $t = -at * E;
|
|
2522
|
+
pe(
|
|
2523
|
+
this.__data__.points.get(`mean-${p}`),
|
|
2524
|
+
xt,
|
|
2525
|
+
At
|
|
2466
2526
|
);
|
|
2467
|
-
let
|
|
2468
|
-
|
|
2469
|
-
})), (Ps = s.outlier) != null && Ps.rows && (this._outlierRects.forEach((
|
|
2470
|
-
l[
|
|
2471
|
-
}), s.outlier.rows().forEach((
|
|
2472
|
-
const
|
|
2473
|
-
if (!M) return;
|
|
2474
|
-
const F = l[M] ?? "#888888", R = pe(b, n[0], n[1]);
|
|
2527
|
+
let B = this._ciRects.get(p);
|
|
2528
|
+
B || (B = document.createElementNS("http://www.w3.org/2000/svg", "rect"), B.setAttribute("data-ci-group", p), this._ciRects.set(p, B)), B.setAttribute("x", (vt - xt).toString()), B.setAttribute("y", ($t - At).toString()), B.setAttribute("width", (xt * 2).toString()), B.setAttribute("height", (At * 2).toString()), B.setAttribute("fill", "none"), B.setAttribute("stroke", mt), B.setAttribute("stroke-width", S.toString()), B.setAttribute("stroke-opacity", "0.8"), B.setAttribute("stroke-dasharray", `${S * 4} ${S * 3}`), y && !B.parentElement && y.insertBefore(B, y.firstChild);
|
|
2529
|
+
})), (Ps = s.outlier) != null && Ps.rows && (this._outlierRects.forEach((p, w) => {
|
|
2530
|
+
l[w] || (p.remove(), this._outlierRects.delete(w));
|
|
2531
|
+
}), s.outlier.rows().forEach((p) => {
|
|
2532
|
+
const w = p.names.indexOf(h ?? "group"), R = w >= 0 ? String(p[w]) : p.rowName ?? null;
|
|
2475
2533
|
if (!R) return;
|
|
2476
|
-
const
|
|
2477
|
-
|
|
2478
|
-
|
|
2534
|
+
const q = l[R] ?? "#888888", X = be(p, n[0], n[1]);
|
|
2535
|
+
if (!X) return;
|
|
2536
|
+
const W = X.x_low * E, mt = -X.y_high * E, Z = (X.x_high - X.x_low) * E, at = (X.y_high - X.y_low) * E;
|
|
2537
|
+
let L = this._outlierRects.get(R);
|
|
2538
|
+
L || (L = document.createElementNS("http://www.w3.org/2000/svg", "rect"), L.setAttribute("data-outlier-group", R), this._outlierRects.set(R, L)), L.setAttribute("x", W.toString()), L.setAttribute("y", mt.toString()), L.setAttribute("width", Z.toString()), L.setAttribute("height", at.toString()), L.setAttribute("fill", "none"), L.setAttribute("stroke", q), L.setAttribute("stroke-width", S.toString()), L.setAttribute("stroke-opacity", "0.5"), L.setAttribute("stroke-dasharray", `${S * 2} ${S * 2}`), y && !L.parentElement && y.insertBefore(L, y.firstChild);
|
|
2479
2539
|
}));
|
|
2480
2540
|
}
|
|
2481
|
-
|
|
2482
|
-
C.__data__.objects.get(
|
|
2483
|
-
}), this._meanLabels.forEach((
|
|
2484
|
-
C.__data__.objects.get(`mean-${
|
|
2485
|
-
}),
|
|
2486
|
-
const
|
|
2541
|
+
it && (this._pointLabels.forEach((y, b) => {
|
|
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);
|
|
2487
2549
|
if (!$) return;
|
|
2488
|
-
const
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
let y = this._meanLabels.get(m);
|
|
2497
|
-
y ? nt === B.DISPLAY_TYPES.ON ? y.show() : y.hide() : (y = new Kt(m, b, st, this, nt), this._meanLabels.set(m, y));
|
|
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));
|
|
2498
2558
|
})), C.__data__.__state__.setVariable("layer_updated", C.__data__);
|
|
2499
2559
|
}
|
|
2500
2560
|
}
|
|
2501
|
-
const
|
|
2502
|
-
if (o.showTrajectories &&
|
|
2503
|
-
|
|
2561
|
+
const Tt = this.__children__.search("__children__", "trajectories");
|
|
2562
|
+
if (o.showTrajectories && Tt) {
|
|
2563
|
+
Tt.__data__.objects.clear(), this.__data__.trajectories.clear();
|
|
2504
2564
|
const C = (Rs = s.trajectories) != null && Rs.rows ? s.trajectories : s.points;
|
|
2505
2565
|
if (C != null && C.rows) {
|
|
2506
|
-
const I = {},
|
|
2507
|
-
C.rows().forEach((
|
|
2508
|
-
const
|
|
2509
|
-
if (
|
|
2510
|
-
const
|
|
2511
|
-
|
|
2512
|
-
x: Number(
|
|
2513
|
-
y: -Number(
|
|
2514
|
-
time:
|
|
2566
|
+
const I = {}, P = o.trajectoryUnits ? o.trajectoryUnits.split(",").map((b) => b.trim()) : null;
|
|
2567
|
+
C.rows().forEach((b) => {
|
|
2568
|
+
const S = b.names.indexOf(r) >= 0 ? b.names.indexOf(r) : b.names.indexOf("unit") >= 0 ? b.names.indexOf("unit") : b.names.indexOf("ENA_UNIT") >= 0 ? b.names.indexOf("ENA_UNIT") : -1, $ = S >= 0 ? String(b[S]) : b.rowName || "unit-1";
|
|
2569
|
+
if (P && !P.includes($)) return;
|
|
2570
|
+
const p = b.names.indexOf(n[0]), w = n.length > 1 ? b.names.indexOf(n[1]) : -1, R = b.names.indexOf("time") >= 0 ? b.names.indexOf("time") : b.names.indexOf("ActivityNumber") >= 0 ? b.names.indexOf("ActivityNumber") : b.names.indexOf("RowID") >= 0 ? b.names.indexOf("RowID") : -1, q = R >= 0 ? Number(b[R]) : I[$] ? I[$].length + 1 : 1;
|
|
2571
|
+
p >= 0 && w >= 0 && (I[$] || (I[$] = []), I[$].push({
|
|
2572
|
+
x: Number(b[p]) * E,
|
|
2573
|
+
y: -Number(b[w]) * E,
|
|
2574
|
+
time: q
|
|
2515
2575
|
}));
|
|
2516
|
-
}), Object.keys(I).forEach((
|
|
2517
|
-
const
|
|
2518
|
-
if (
|
|
2519
|
-
const
|
|
2520
|
-
ID: `traj-${
|
|
2521
|
-
unitId:
|
|
2522
|
-
color: new
|
|
2576
|
+
}), Object.keys(I).forEach((b, S) => {
|
|
2577
|
+
const $ = I[b];
|
|
2578
|
+
if ($.length === 0) return;
|
|
2579
|
+
const p = u[S % u.length], w = new Ee({
|
|
2580
|
+
ID: `traj-${b}`,
|
|
2581
|
+
unitId: b,
|
|
2582
|
+
color: new st(p),
|
|
2523
2583
|
lineStyle: o.trajectoryLineStyle,
|
|
2524
2584
|
strokeWidth: o.trajectoryStrokeWidth,
|
|
2525
2585
|
strokeWidthRange: o.trajectoryStrokeWidthRange,
|
|
@@ -2530,210 +2590,210 @@ const ut = class ut extends Ae {
|
|
|
2530
2590
|
currentTime: o.trajectoryPlayhead ?? 1 / 0,
|
|
2531
2591
|
showPoints: o.trajectoryShowPoints,
|
|
2532
2592
|
showTips: o.trajectoryShowTips,
|
|
2533
|
-
points:
|
|
2593
|
+
points: $.map((R) => ({ x: R.x, y: R.y, time: R.time }))
|
|
2534
2594
|
});
|
|
2535
|
-
this.__data__.trajectories.set(
|
|
2595
|
+
this.__data__.trajectories.set(b, w), Tt.__data__.objects.set(w.ID, w);
|
|
2536
2596
|
});
|
|
2537
2597
|
}
|
|
2538
|
-
|
|
2598
|
+
Tt.__data__.__state__.setVariable("layer_updated", Tt.__data__);
|
|
2539
2599
|
}
|
|
2540
|
-
const
|
|
2541
|
-
if ((Ls = s.nodes) != null && Ls.rows &&
|
|
2600
|
+
const _t = this.__children__.search("__children__", "network"), Kt = _t == null ? void 0 : _t.__children__.search("__children__", "edges"), ft = _t == null ? void 0 : _t.__children__.search("__children__", "nodes"), fe = _t == null ? void 0 : _t.__children__.search("__children__", "edgenodes"), si = o.showEdges;
|
|
2601
|
+
if ((Ls = s.nodes) != null && Ls.rows && ft) {
|
|
2542
2602
|
if (s.nodes.rows().forEach((I) => {
|
|
2543
|
-
const
|
|
2544
|
-
|
|
2545
|
-
const
|
|
2546
|
-
|
|
2547
|
-
...
|
|
2603
|
+
const P = ut(I, a, "#444444");
|
|
2604
|
+
P.size = 2;
|
|
2605
|
+
const y = I.names.indexOf("label"), b = y >= 0 ? I[y] : null;
|
|
2606
|
+
P.meta = {
|
|
2607
|
+
...P.meta ?? {},
|
|
2548
2608
|
kind: "node",
|
|
2549
|
-
name:
|
|
2550
|
-
},
|
|
2551
|
-
}), si &&
|
|
2609
|
+
name: b != null && String(b) !== "NA" && String(b) !== "" ? String(b) : P.ID
|
|
2610
|
+
}, ft.__data__.objects.set(P.ID, P);
|
|
2611
|
+
}), si && Kt && ((Ts = s.edges) != null && Ts.rows)) {
|
|
2552
2612
|
const I = {};
|
|
2553
|
-
h && ((
|
|
2554
|
-
const
|
|
2555
|
-
|
|
2613
|
+
h && ((Ds = s.points) != null && Ds.rows) && s.points.rows().forEach((f) => {
|
|
2614
|
+
const x = f.names.indexOf(r), N = f.names.indexOf(h);
|
|
2615
|
+
x >= 0 && N >= 0 && (I[String(f[x])] = String(f[N]));
|
|
2556
2616
|
});
|
|
2557
|
-
const
|
|
2558
|
-
const
|
|
2559
|
-
return
|
|
2560
|
-
}).filter(Boolean),
|
|
2561
|
-
(s.edges.names ?? []).forEach((
|
|
2562
|
-
const
|
|
2563
|
-
|
|
2617
|
+
const P = s.nodes.rows().map((f) => {
|
|
2618
|
+
const x = f.names.indexOf(a);
|
|
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 });
|
|
2564
2624
|
});
|
|
2565
|
-
const
|
|
2566
|
-
const
|
|
2625
|
+
const b = /* @__PURE__ */ _((f) => {
|
|
2626
|
+
const x = {};
|
|
2567
2627
|
return s.edges.rows().forEach((N) => {
|
|
2568
|
-
const
|
|
2569
|
-
|
|
2570
|
-
const
|
|
2571
|
-
|
|
2628
|
+
const z = N.names.indexOf(r);
|
|
2629
|
+
z < 0 || String(N[z]) !== f || y.forEach(({ col: T }) => {
|
|
2630
|
+
const M = N.names.indexOf(T);
|
|
2631
|
+
M >= 0 && (x[T] = Number(N[M]) || 0);
|
|
2572
2632
|
});
|
|
2573
|
-
}),
|
|
2574
|
-
}, "getUnitEdges"),
|
|
2575
|
-
const
|
|
2633
|
+
}), x;
|
|
2634
|
+
}, "getUnitEdges"), S = /* @__PURE__ */ _((f) => {
|
|
2635
|
+
const x = {};
|
|
2576
2636
|
let N = 0;
|
|
2577
|
-
if (s.edges.rows().forEach((
|
|
2578
|
-
const
|
|
2579
|
-
(
|
|
2580
|
-
const
|
|
2581
|
-
if (
|
|
2582
|
-
const
|
|
2583
|
-
isNaN(
|
|
2637
|
+
if (s.edges.rows().forEach((T) => {
|
|
2638
|
+
const M = T.names.indexOf(r), tt = M >= 0 ? String(T[M]) : null, G = h ? T.names.indexOf(h) : -1;
|
|
2639
|
+
(G >= 0 ? String(T[G]) : tt ? I[tt] : null) === f && (N++, y.forEach(({ col: D }) => {
|
|
2640
|
+
const pt = T.names.indexOf(D);
|
|
2641
|
+
if (pt >= 0) {
|
|
2642
|
+
const V = Number(T[pt]);
|
|
2643
|
+
isNaN(V) || (x[D] = (x[D] ?? 0) + V);
|
|
2584
2644
|
}
|
|
2585
2645
|
}));
|
|
2586
2646
|
}), N === 0) return {};
|
|
2587
|
-
const
|
|
2588
|
-
return
|
|
2589
|
-
T
|
|
2590
|
-
}),
|
|
2591
|
-
}, "getGroupEdges"),
|
|
2592
|
-
if (l[
|
|
2593
|
-
return { weights:
|
|
2594
|
-
const
|
|
2595
|
-
return { weights:
|
|
2596
|
-
}, "resolve"),
|
|
2597
|
-
var
|
|
2598
|
-
const
|
|
2647
|
+
const z = {};
|
|
2648
|
+
return y.forEach(({ col: T }) => {
|
|
2649
|
+
z[T] = (x[T] ?? 0) / N;
|
|
2650
|
+
}), z;
|
|
2651
|
+
}, "getGroupEdges"), $ = /* @__PURE__ */ _((f) => {
|
|
2652
|
+
if (l[f])
|
|
2653
|
+
return { weights: S(f), color: l[f], label: f };
|
|
2654
|
+
const x = I[f] ?? null, N = x ? l[x] ?? "#888888" : "#888888";
|
|
2655
|
+
return { weights: b(f), color: N, label: f };
|
|
2656
|
+
}, "resolve"), p = [], w = /* @__PURE__ */ _((f) => {
|
|
2657
|
+
var T;
|
|
2658
|
+
const x = s.networks, N = (T = x == null ? void 0 : x.rows) == null ? void 0 : T.call(x).find((M) => M.rowName === f);
|
|
2599
2659
|
if (!N) return null;
|
|
2600
|
-
const
|
|
2601
|
-
return
|
|
2602
|
-
const
|
|
2603
|
-
if (
|
|
2604
|
-
const
|
|
2605
|
-
Number.isFinite(
|
|
2660
|
+
const z = {};
|
|
2661
|
+
return y.forEach(({ col: M }) => {
|
|
2662
|
+
const tt = N.names.indexOf(M);
|
|
2663
|
+
if (tt >= 0) {
|
|
2664
|
+
const G = Number(N[tt]);
|
|
2665
|
+
Number.isFinite(G) && (z[M] = G);
|
|
2606
2666
|
}
|
|
2607
|
-
}),
|
|
2608
|
-
}, "networkRow"),
|
|
2609
|
-
if (!
|
|
2610
|
-
const N = Math.abs(
|
|
2611
|
-
return N <
|
|
2667
|
+
}), z;
|
|
2668
|
+
}, "networkRow"), R = /* @__PURE__ */ _((f, x) => {
|
|
2669
|
+
if (!x) return f;
|
|
2670
|
+
const N = Math.abs(f);
|
|
2671
|
+
return N < x[0] ? 0 : N > x[1] ? Math.sign(f) * x[1] : f;
|
|
2612
2672
|
}, "thresholded");
|
|
2613
|
-
o.edgeLayers.forEach((
|
|
2614
|
-
const N = /* @__PURE__ */
|
|
2615
|
-
Q =
|
|
2616
|
-
}, "push"),
|
|
2617
|
-
if (
|
|
2618
|
-
const
|
|
2619
|
-
if (!
|
|
2620
|
-
const [
|
|
2621
|
-
|
|
2622
|
-
const me =
|
|
2623
|
-
N(
|
|
2673
|
+
o.edgeLayers.forEach((f, x) => {
|
|
2674
|
+
const N = /* @__PURE__ */ _((V, ht, Q, wt, lt) => {
|
|
2675
|
+
Q = R(Q, f.threshold), !(Math.abs(Q) < 1e-6) && p.push({ col: `${x}:${V}`, pair: ht, weight: Math.abs(Q), color: wt, layer: x, ...lt });
|
|
2676
|
+
}, "push"), z = /* @__PURE__ */ _((V, ht) => f.colors ? [f.colors[0], f.colors[1] ?? Ci(f.colors[0])] : [V, ht], "signColors");
|
|
2677
|
+
if (f.network) {
|
|
2678
|
+
const V = w(f.network);
|
|
2679
|
+
if (!V) return;
|
|
2680
|
+
const [ht, Q] = z(u[0], u[1]), wt = { name: f.name ?? f.network };
|
|
2681
|
+
y.forEach(({ col: lt, pair: zs }) => {
|
|
2682
|
+
const me = V[lt] ?? 0;
|
|
2683
|
+
N(lt, zs, me, me >= 0 ? ht : Q, wt);
|
|
2624
2684
|
});
|
|
2625
2685
|
return;
|
|
2626
2686
|
}
|
|
2627
|
-
const
|
|
2628
|
-
if (!
|
|
2629
|
-
const
|
|
2630
|
-
|
|
2631
|
-
const Q = (
|
|
2632
|
-
N(
|
|
2633
|
-
}) :
|
|
2634
|
-
const Q =
|
|
2635
|
-
Q > 0 && N(
|
|
2636
|
-
}) :
|
|
2637
|
-
const Q =
|
|
2638
|
-
Q > 0 && N(
|
|
2687
|
+
const T = f.unit ?? f.group ?? null;
|
|
2688
|
+
if (!T) return;
|
|
2689
|
+
const M = $(T), tt = f.compare ?? f.also ?? null, G = tt ? $(tt) : null, rt = { name: f.name ?? T, group: f.group ?? void 0, unit: f.unit ?? void 0 }, [D, pt] = z(M.color, (G == null ? void 0 : G.color) ?? M.color);
|
|
2690
|
+
G && f.compare ? y.forEach(({ col: V, pair: ht }) => {
|
|
2691
|
+
const Q = (M.weights[V] ?? 0) - (G.weights[V] ?? 0);
|
|
2692
|
+
N(V, ht, Q, Q > 0 ? D : pt, rt);
|
|
2693
|
+
}) : G && f.also ? y.forEach(({ col: V, pair: ht }) => {
|
|
2694
|
+
const Q = M.weights[V] ?? 0, wt = G.weights[V] ?? 0;
|
|
2695
|
+
Q > 0 && N(V + "-a", ht, Q, D, rt), wt > 0 && N(V + "-b", ht, wt, pt, { ...rt, name: f.also ?? void 0, group: f.also ?? void 0 });
|
|
2696
|
+
}) : y.forEach(({ col: V, pair: ht }) => {
|
|
2697
|
+
const Q = M.weights[V] ?? 0;
|
|
2698
|
+
Q > 0 && N(V, ht, Q, D, rt);
|
|
2639
2699
|
});
|
|
2640
|
-
}),
|
|
2641
|
-
const
|
|
2642
|
-
const
|
|
2643
|
-
return
|
|
2644
|
-
}, "rangeOf"),
|
|
2645
|
-
const
|
|
2646
|
-
return
|
|
2647
|
-
if (
|
|
2648
|
-
const
|
|
2649
|
-
if (
|
|
2650
|
-
}),
|
|
2651
|
-
}, "modelRange"),
|
|
2652
|
-
if (
|
|
2653
|
-
const
|
|
2654
|
-
return { saturation:
|
|
2700
|
+
}), p.sort((f, x) => x.weight - f.weight);
|
|
2701
|
+
const q = !!s.directed, X = wi(o.edgeWidth) * (o.edgeMagnify ?? 1), W = /* @__PURE__ */ _((f) => {
|
|
2702
|
+
const x = f.map(Math.abs).filter((N) => N > 0);
|
|
2703
|
+
return x.length ? [Math.min(...x), Math.max(...x)] : [0, 0];
|
|
2704
|
+
}, "rangeOf"), mt = /* @__PURE__ */ _((f) => {
|
|
2705
|
+
const x = [];
|
|
2706
|
+
return y.forEach(({ col: N, pair: z }) => {
|
|
2707
|
+
if (z[0] === z[1] !== f) return;
|
|
2708
|
+
const T = s.edges.col(N);
|
|
2709
|
+
if (T) for (const M of T) x.push(Number(M));
|
|
2710
|
+
}), W(x);
|
|
2711
|
+
}, "modelRange"), Z = /* @__PURE__ */ _((f) => W(p.filter((x) => x.pair[0] === x.pair[1] === f).map((x) => x.weight)), "plotRange"), at = o.edgeColorScale, L = /* @__PURE__ */ _((f) => at === "plot" ? Z(f) : mt(f), "colourRange"), Dt = L(!1), xt = L(!0), At = /* @__PURE__ */ _((f, x) => {
|
|
2712
|
+
if (at === "absolute") {
|
|
2713
|
+
const T = Math.min(1, Math.abs(f));
|
|
2714
|
+
return { saturation: T, opacity: T };
|
|
2655
2715
|
}
|
|
2656
|
-
const [N,
|
|
2657
|
-
return { saturation: Xs(
|
|
2658
|
-
}, "colourOf"),
|
|
2659
|
-
|
|
2660
|
-
if (
|
|
2661
|
-
const
|
|
2662
|
-
|
|
2716
|
+
const [N, z] = x ? xt : Dt;
|
|
2717
|
+
return { saturation: Xs(f, N, z, gi), opacity: Xs(f, N, z, fi) };
|
|
2718
|
+
}, "colourOf"), vt = {};
|
|
2719
|
+
p.forEach(({ pair: f, weight: x }) => {
|
|
2720
|
+
if (f[0] === f[1] && !q) return;
|
|
2721
|
+
const z = /* @__PURE__ */ _((T) => {
|
|
2722
|
+
vt[T] = (vt[T] ?? 0) + Math.abs(x);
|
|
2663
2723
|
}, "add");
|
|
2664
|
-
if (
|
|
2665
|
-
|
|
2724
|
+
if (q) {
|
|
2725
|
+
z(f[1]);
|
|
2666
2726
|
return;
|
|
2667
2727
|
}
|
|
2668
|
-
|
|
2669
|
-
}), s.nodes.rows().forEach((
|
|
2670
|
-
const
|
|
2728
|
+
z(f[0]), z(f[1]);
|
|
2729
|
+
}), s.nodes.rows().forEach((f) => {
|
|
2730
|
+
const x = f.names.indexOf(a), N = x >= 0 ? String(f[x]) : "";
|
|
2671
2731
|
if (!N) return;
|
|
2672
|
-
const
|
|
2673
|
-
if (!
|
|
2674
|
-
const
|
|
2675
|
-
|
|
2676
|
-
...
|
|
2677
|
-
hidden:
|
|
2732
|
+
const z = ft.__data__.objects.get(N);
|
|
2733
|
+
if (!z) return;
|
|
2734
|
+
const T = vt[N] ?? 0, M = !(T > 0);
|
|
2735
|
+
z.size = M ? o.hideUnconnectedNodes ? 0 : xi : Ai(T, X), z.meta = {
|
|
2736
|
+
...z.meta ?? {},
|
|
2737
|
+
hidden: M && o.hideUnconnectedNodes
|
|
2678
2738
|
};
|
|
2679
2739
|
});
|
|
2680
|
-
const
|
|
2681
|
-
|
|
2682
|
-
const
|
|
2683
|
-
|
|
2684
|
-
}),
|
|
2685
|
-
const
|
|
2686
|
-
if (!
|
|
2687
|
-
const
|
|
2688
|
-
if (
|
|
2689
|
-
const { saturation:
|
|
2690
|
-
let
|
|
2691
|
-
if (
|
|
2692
|
-
|
|
2693
|
-
else if (
|
|
2694
|
-
const me =
|
|
2695
|
-
|
|
2740
|
+
const $t = {}, B = /* @__PURE__ */ _((f, x, N, z) => `${f}:${x ?? ""}:${N}.${z}`, "pairKey");
|
|
2741
|
+
q && p.forEach(({ pair: f, weight: x, layer: N, name: z }) => {
|
|
2742
|
+
const T = B(N, z, f[0], f[1]);
|
|
2743
|
+
$t[T] = ($t[T] ?? 0) + x;
|
|
2744
|
+
}), p.forEach(({ col: f, pair: x, weight: N, color: z, layer: T, name: M, group: tt, unit: G }) => {
|
|
2745
|
+
const rt = ft.__data__.objects.get(x[0]), D = ft.__data__.objects.get(x[1]);
|
|
2746
|
+
if (!rt || !D) return;
|
|
2747
|
+
const pt = x[0] === x[1];
|
|
2748
|
+
if (pt && !q) return;
|
|
2749
|
+
const { saturation: V, opacity: ht } = At(N, pt), Q = new J({ ID: `${x[0]}-src`, dimensions: [rt.x, rt.y], meta: {} }), wt = new J({ ID: `${x[1]}-dst`, dimensions: [D.x, D.y], meta: {} });
|
|
2750
|
+
let lt;
|
|
2751
|
+
if (pt)
|
|
2752
|
+
lt = new ne({}, Q, wt), lt.weight = 0;
|
|
2753
|
+
else if (q) {
|
|
2754
|
+
const me = $t[B(T, M, x[0], x[1])] ?? N, ii = $t[B(T, M, x[1], x[0])] ?? 0, ni = me + ii;
|
|
2755
|
+
lt = new Qe(
|
|
2696
2756
|
{ weight: N, totalweight: ni },
|
|
2697
2757
|
Q,
|
|
2698
|
-
|
|
2758
|
+
wt
|
|
2699
2759
|
);
|
|
2700
2760
|
} else
|
|
2701
|
-
|
|
2702
|
-
|
|
2761
|
+
lt = new Xt({}, Q, wt);
|
|
2762
|
+
lt.ID = `edge-${f}`, lt.color = new st(z), lt.meta = {
|
|
2703
2763
|
isMeanEdge: !0,
|
|
2704
2764
|
weight: N,
|
|
2705
2765
|
// Width per unit weight (extent units), shared by all marks.
|
|
2706
|
-
widthFrac:
|
|
2707
|
-
saturation:
|
|
2708
|
-
opacity:
|
|
2709
|
-
isDirected:
|
|
2710
|
-
isSelf:
|
|
2766
|
+
widthFrac: X,
|
|
2767
|
+
saturation: V,
|
|
2768
|
+
opacity: ht,
|
|
2769
|
+
isDirected: q,
|
|
2770
|
+
isSelf: pt,
|
|
2711
2771
|
// Identity for the qe-edge-* interaction events.
|
|
2712
|
-
source:
|
|
2713
|
-
target:
|
|
2714
|
-
group:
|
|
2715
|
-
unit:
|
|
2716
|
-
layer:
|
|
2717
|
-
}, (
|
|
2718
|
-
}),
|
|
2772
|
+
source: x[0],
|
|
2773
|
+
target: x[1],
|
|
2774
|
+
group: tt,
|
|
2775
|
+
unit: G,
|
|
2776
|
+
layer: M
|
|
2777
|
+
}, (pt ? fe ?? Kt : Kt).__data__.objects.set(lt.ID, lt);
|
|
2778
|
+
}), Kt.__data__.__state__.setVariable("layer_updated", Kt.__data__), fe && fe.__data__.__state__.setVariable("layer_updated", fe.__data__);
|
|
2719
2779
|
}
|
|
2720
2780
|
const C = o.showNodes;
|
|
2721
|
-
|
|
2722
|
-
|
|
2781
|
+
ft.svg_element && (ft.svg_element.style.display = C ? "" : "none"), C || (this._nodeLabels.forEach((I) => I.remove()), this._nodeLabels.clear()), it && j !== 0 && C && (this._nodeLabels.forEach((I, P) => {
|
|
2782
|
+
ft.__data__.objects.get(P) || (I.remove(), this._nodeLabels.delete(P));
|
|
2723
2783
|
}), s.nodes.rows().forEach((I) => {
|
|
2724
|
-
var
|
|
2725
|
-
const
|
|
2726
|
-
if (!
|
|
2727
|
-
const
|
|
2728
|
-
if (!
|
|
2729
|
-
if ((
|
|
2730
|
-
(
|
|
2784
|
+
var p, w, R;
|
|
2785
|
+
const P = I.names.indexOf(a), y = P >= 0 ? String(I[P]) : "";
|
|
2786
|
+
if (!y) return;
|
|
2787
|
+
const b = ft.__data__.objects.get(y);
|
|
2788
|
+
if (!b) return;
|
|
2789
|
+
if ((p = b.meta) != null && p.hidden) {
|
|
2790
|
+
(w = this._nodeLabels.get(y)) == null || w.remove(), this._nodeLabels.delete(y);
|
|
2731
2791
|
return;
|
|
2732
2792
|
}
|
|
2733
|
-
const
|
|
2734
|
-
let
|
|
2735
|
-
|
|
2736
|
-
})),
|
|
2793
|
+
const S = String(((R = b.meta) == null ? void 0 : R.name) ?? y);
|
|
2794
|
+
let $ = this._nodeLabels.get(y);
|
|
2795
|
+
$ && $.text !== S && ($.remove(), this._nodeLabels.delete(y), $ = void 0), $ ? j === U.DISPLAY_TYPES.ON ? $.show() : $.hide() : ($ = new Jt(S, b, it, this, j), this._nodeLabels.set(y, $));
|
|
2796
|
+
})), ft.__data__.__state__.setVariable("layer_updated", ft.__data__);
|
|
2737
2797
|
}
|
|
2738
2798
|
const ws = this.__children__.search("__children__", "axis_points"), As = this.__children__.search("__children__", "axis_lines");
|
|
2739
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);
|
|
@@ -2782,23 +2842,23 @@ const ut = class ut extends Ae {
|
|
|
2782
2842
|
// all rendering decisions are derived from a single snapshot.
|
|
2783
2843
|
_readLayerConfig() {
|
|
2784
2844
|
var g;
|
|
2785
|
-
const t = this.querySelector("qe-nodes"), e = this.querySelector("qe-means"), s = [...this.querySelectorAll("qe-points")], i = s.find((c) => !c.hasAttribute("set")) ?? null, n = s.filter((c) => c.hasAttribute("set")), r = [...this.querySelectorAll("qe-edges")], a = /* @__PURE__ */
|
|
2786
|
-
var
|
|
2787
|
-
return ((
|
|
2788
|
-
}, "firstAttr"), h = r.find((c) => c.hasAttribute("magnify")), o = this.querySelector("qe-trajectories"), l = this.querySelector("qe-axes"),
|
|
2845
|
+
const t = this.querySelector("qe-nodes"), e = this.querySelector("qe-means"), s = [...this.querySelectorAll("qe-points")], i = s.find((c) => !c.hasAttribute("set")) ?? null, n = s.filter((c) => c.hasAttribute("set")), r = [...this.querySelectorAll("qe-edges")], a = /* @__PURE__ */ _((c) => {
|
|
2846
|
+
var v;
|
|
2847
|
+
return ((v = r.find((m) => m.hasAttribute(c))) == null ? void 0 : v.getAttribute(c)) ?? null;
|
|
2848
|
+
}, "firstAttr"), h = r.find((c) => c.hasAttribute("magnify")), o = this.querySelector("qe-trajectories"), l = this.querySelector("qe-axes"), u = this.getAttribute("labels");
|
|
2789
2849
|
return {
|
|
2790
2850
|
// Nodes — always placed from the model (they anchor the coordinate
|
|
2791
2851
|
// space); <qe-nodes> presence draws them, like every other layer.
|
|
2792
2852
|
labelNodes: He(
|
|
2793
|
-
(t == null ? void 0 : t.getAttribute("label")) ?? this.getAttribute("label-nodes") ??
|
|
2794
|
-
|
|
2853
|
+
(t == null ? void 0 : t.getAttribute("label")) ?? this.getAttribute("label-nodes") ?? u,
|
|
2854
|
+
U.DISPLAY_TYPES.ON
|
|
2795
2855
|
),
|
|
2796
2856
|
showNodes: !!t,
|
|
2797
2857
|
range: (() => {
|
|
2798
2858
|
const c = this.getAttribute("range");
|
|
2799
2859
|
if (c === "network" || c === "points") return c;
|
|
2800
|
-
const
|
|
2801
|
-
return c != null && Number.isFinite(
|
|
2860
|
+
const v = Number(c);
|
|
2861
|
+
return c != null && Number.isFinite(v) && v > 0 ? v : null;
|
|
2802
2862
|
})(),
|
|
2803
2863
|
plotTitle: this.getAttribute("plot-title") || null,
|
|
2804
2864
|
labelFont: {
|
|
@@ -2831,8 +2891,8 @@ const ut = class ut extends Ae {
|
|
|
2831
2891
|
})(),
|
|
2832
2892
|
showOutlier: !!e && e.hasAttribute("outlier"),
|
|
2833
2893
|
labelMeans: He(
|
|
2834
|
-
(e == null ? void 0 : e.getAttribute("label")) ?? this.getAttribute("label-means") ??
|
|
2835
|
-
|
|
2894
|
+
(e == null ? void 0 : e.getAttribute("label")) ?? this.getAttribute("label-means") ?? u,
|
|
2895
|
+
U.DISPLAY_TYPES.ON
|
|
2836
2896
|
),
|
|
2837
2897
|
// fixed-size keeps mean markers a constant on-screen px size (webENA parity).
|
|
2838
2898
|
meanFixedSize: !!e && e.hasAttribute("fixed-size"),
|
|
@@ -2844,8 +2904,8 @@ const ut = class ut extends Ae {
|
|
|
2844
2904
|
fixedSize: c.hasAttribute("fixed-size")
|
|
2845
2905
|
})),
|
|
2846
2906
|
labelPoints: He(
|
|
2847
|
-
(i == null ? void 0 : i.getAttribute("label")) ?? this.getAttribute("label-points") ??
|
|
2848
|
-
|
|
2907
|
+
(i == null ? void 0 : i.getAttribute("label")) ?? this.getAttribute("label-points") ?? u,
|
|
2908
|
+
U.DISPLAY_TYPES.OFF
|
|
2849
2909
|
),
|
|
2850
2910
|
pointSize: i != null && i.getAttribute("size") ? parseFloat(i.getAttribute("size")) : null,
|
|
2851
2911
|
// fixed-size keeps unit dots a constant on-screen px size (webENA parity).
|
|
@@ -2892,7 +2952,7 @@ const ut = class ut extends Ae {
|
|
|
2892
2952
|
connectedCallback() {
|
|
2893
2953
|
var n;
|
|
2894
2954
|
const t = this.getAttribute("width"), e = this.getAttribute("height");
|
|
2895
|
-
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),
|
|
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), gt._instances.add(this), this._childObserver = new MutationObserver(() => this._scheduleRerender()), this._childObserver.observe(this, {
|
|
2896
2956
|
childList: !0,
|
|
2897
2957
|
attributes: !0,
|
|
2898
2958
|
subtree: !0,
|
|
@@ -2956,15 +3016,15 @@ const ut = class ut extends Ae {
|
|
|
2956
3016
|
}
|
|
2957
3017
|
disconnectedCallback() {
|
|
2958
3018
|
var t, e, s;
|
|
2959
|
-
(t = this._childObserver) == null || t.disconnect(), this._childObserver = null, (e = this._resizeObs) == null || e.disconnect(), this._resizeObs = null,
|
|
3019
|
+
(t = this._childObserver) == null || t.disconnect(), this._childObserver = null, (e = this._resizeObs) == null || e.disconnect(), this._resizeObs = null, gt._instances.delete(this), (s = this._tooltipEl) == null || s.remove(), this._tooltipEl = null;
|
|
2960
3020
|
}
|
|
2961
3021
|
/** All connected <qe-graph> instances (newest membership order). */
|
|
2962
3022
|
static instances() {
|
|
2963
|
-
return [...
|
|
3023
|
+
return [...gt._instances];
|
|
2964
3024
|
}
|
|
2965
3025
|
/** Look up a graph by its `id` or `plot-group` attribute. */
|
|
2966
3026
|
static getGraph(t) {
|
|
2967
|
-
for (const e of
|
|
3027
|
+
for (const e of gt._instances)
|
|
2968
3028
|
if (e.id === t || e.getAttribute("plot-group") === t) return e;
|
|
2969
3029
|
return null;
|
|
2970
3030
|
}
|
|
@@ -2983,7 +3043,7 @@ const ut = class ut extends Ae {
|
|
|
2983
3043
|
}
|
|
2984
3044
|
/** Resolved edges of the current network with weights and direction. */
|
|
2985
3045
|
getEdges() {
|
|
2986
|
-
const t = /* @__PURE__ */
|
|
3046
|
+
const t = /* @__PURE__ */ _((e) => {
|
|
2987
3047
|
const s = this.__children__.search("__children__", e);
|
|
2988
3048
|
return s ? [...s.__data__.objects.values()] : [];
|
|
2989
3049
|
}, "collect");
|
|
@@ -3006,13 +3066,13 @@ const ut = class ut extends Ae {
|
|
|
3006
3066
|
)];
|
|
3007
3067
|
}
|
|
3008
3068
|
_readCoords(t) {
|
|
3009
|
-
const e = t.tagName.toLowerCase(), s = /* @__PURE__ */
|
|
3069
|
+
const e = t.tagName.toLowerCase(), s = /* @__PURE__ */ _((i) => parseFloat(t.getAttribute(i) || "0"), "n");
|
|
3010
3070
|
if (e === "circle") return { t: "c", cx: s("cx"), cy: s("cy") };
|
|
3011
3071
|
if (e === "rect") return { t: "r", x: s("x"), y: s("y") };
|
|
3012
3072
|
if (e === "line") return { t: "l", x1: s("x1"), y1: s("y1"), x2: s("x2"), y2: s("y2") };
|
|
3013
3073
|
if (e === "path") {
|
|
3014
3074
|
const i = t.getAttribute("d") || "";
|
|
3015
|
-
return { t: "p", d: i, nums: (i.match(
|
|
3075
|
+
return { t: "p", d: i, nums: (i.match(gt._PATH_NUM_RE) || []).map(Number) };
|
|
3016
3076
|
}
|
|
3017
3077
|
return null;
|
|
3018
3078
|
}
|
|
@@ -3034,25 +3094,25 @@ const ut = class ut extends Ae {
|
|
|
3034
3094
|
o && e.set(h, o);
|
|
3035
3095
|
}
|
|
3036
3096
|
}), !e.size) return;
|
|
3037
|
-
const s = this._animateMs, i = performance.now(), n = /* @__PURE__ */
|
|
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) => {
|
|
3038
3098
|
const o = Math.min(1, (h - i) / s), l = n(o);
|
|
3039
|
-
e.forEach((
|
|
3099
|
+
e.forEach((u, g) => {
|
|
3040
3100
|
const c = t.get(g);
|
|
3041
|
-
if (!(!c || c.t !==
|
|
3042
|
-
if (
|
|
3043
|
-
g.setAttribute("cx", String(r(c.cx,
|
|
3044
|
-
else if (
|
|
3045
|
-
g.setAttribute("x", String(r(c.x,
|
|
3046
|
-
else if (
|
|
3047
|
-
g.setAttribute("x1", String(r(c.x1,
|
|
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)));
|
|
3048
3108
|
else {
|
|
3049
|
-
if (!c.nums || c.nums.length !==
|
|
3050
|
-
let
|
|
3051
|
-
const
|
|
3052
|
-
|
|
3053
|
-
() => String(r(c.nums[
|
|
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))
|
|
3054
3114
|
);
|
|
3055
|
-
g.setAttribute("d",
|
|
3115
|
+
g.setAttribute("d", m);
|
|
3056
3116
|
}
|
|
3057
3117
|
}), this._tweenRaf = o < 1 ? requestAnimationFrame(a) : null;
|
|
3058
3118
|
}, "step");
|
|
@@ -3073,19 +3133,19 @@ const ut = class ut extends Ae {
|
|
|
3073
3133
|
const h = new Blob([e], { type: "image/svg+xml;charset=utf-8" }), o = URL.createObjectURL(h), l = new Image();
|
|
3074
3134
|
l.onload = () => {
|
|
3075
3135
|
try {
|
|
3076
|
-
const
|
|
3077
|
-
|
|
3078
|
-
const g =
|
|
3136
|
+
const u = document.createElement("canvas");
|
|
3137
|
+
u.width = i * t, u.height = n * t;
|
|
3138
|
+
const g = u.getContext("2d");
|
|
3079
3139
|
if (!g) {
|
|
3080
3140
|
URL.revokeObjectURL(o), a(new Error("no 2d context"));
|
|
3081
3141
|
return;
|
|
3082
3142
|
}
|
|
3083
|
-
g.scale(t, t), g.drawImage(l, 0, 0, i, n), URL.revokeObjectURL(o), r(
|
|
3084
|
-
} catch (
|
|
3085
|
-
URL.revokeObjectURL(o), a(
|
|
3143
|
+
g.scale(t, t), g.drawImage(l, 0, 0, i, n), URL.revokeObjectURL(o), r(u.toDataURL("image/png"));
|
|
3144
|
+
} catch (u) {
|
|
3145
|
+
URL.revokeObjectURL(o), a(u);
|
|
3086
3146
|
}
|
|
3087
|
-
}, l.onerror = (
|
|
3088
|
-
URL.revokeObjectURL(o), a(
|
|
3147
|
+
}, l.onerror = (u) => {
|
|
3148
|
+
URL.revokeObjectURL(o), a(u);
|
|
3089
3149
|
}, l.src = o;
|
|
3090
3150
|
});
|
|
3091
3151
|
}
|
|
@@ -3127,7 +3187,7 @@ const ut = class ut extends Ae {
|
|
|
3127
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")), this.svg_element.appendChild(this._highlightGroup);
|
|
3128
3188
|
const t = this._highlightGroup;
|
|
3129
3189
|
t.textContent = "";
|
|
3130
|
-
const e = this.__data__.extremes.x_max || 1, s = "#f5a623", i = /* @__PURE__ */
|
|
3190
|
+
const e = this.__data__.extremes.x_max || 1, s = "#f5a623", i = /* @__PURE__ */ _((n, r) => {
|
|
3131
3191
|
const a = document.createElementNS("http://www.w3.org/2000/svg", n);
|
|
3132
3192
|
for (const h in r) a.setAttribute(h, String(r[h]));
|
|
3133
3193
|
return a;
|
|
@@ -3151,8 +3211,8 @@ const ut = class ut extends Ae {
|
|
|
3151
3211
|
});
|
|
3152
3212
|
}
|
|
3153
3213
|
this._highlight.nodes.forEach((n) => {
|
|
3154
|
-
var
|
|
3155
|
-
const r = this.svg_element.querySelector(`[data-point-id="${(
|
|
3214
|
+
var u;
|
|
3215
|
+
const r = this.svg_element.querySelector(`[data-point-id="${(u = window.CSS) != null && u.escape ? CSS.escape(n) : n}"]`);
|
|
3156
3216
|
if (!r) return;
|
|
3157
3217
|
const a = r.tagName.toLowerCase();
|
|
3158
3218
|
let h, o, l;
|
|
@@ -3174,7 +3234,7 @@ const ut = class ut extends Ae {
|
|
|
3174
3234
|
create() {
|
|
3175
3235
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3176
3236
|
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;
|
|
3177
|
-
const e = document.createElementNS("http://www.w3.org/2000/svg", "defs"), s = 0.22, i = 0.15, n = /* @__PURE__ */
|
|
3237
|
+
const e = document.createElementNS("http://www.w3.org/2000/svg", "defs"), s = 0.22, i = 0.15, n = /* @__PURE__ */ _((r, a) => {
|
|
3178
3238
|
const h = document.createElementNS("http://www.w3.org/2000/svg", "marker");
|
|
3179
3239
|
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");
|
|
3180
3240
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
@@ -3194,43 +3254,43 @@ const ut = class ut extends Ae {
|
|
|
3194
3254
|
t = !0, e = o.clientX, s = o.clientY;
|
|
3195
3255
|
});
|
|
3196
3256
|
let i = null, n = null;
|
|
3197
|
-
const r = /* @__PURE__ */
|
|
3257
|
+
const r = /* @__PURE__ */ _(() => {
|
|
3198
3258
|
n && (this.__data__.transform.pan(n.dx, n.dy), this.__children__[0].svg_element.setAttribute("transform", this.__data__.transform.toString()), n = null), i = null;
|
|
3199
3259
|
}, "panUpdate");
|
|
3200
3260
|
this.svg_element.addEventListener("mousemove", (o) => {
|
|
3201
3261
|
if (!t) return;
|
|
3202
|
-
const l = o.clientX - e,
|
|
3203
|
-
n = { dx: l / 100, dy:
|
|
3262
|
+
const l = o.clientX - e, u = o.clientY - s;
|
|
3263
|
+
n = { dx: l / 100, dy: u / 100 }, e = o.clientX, s = o.clientY, i === null && (i = requestAnimationFrame(r));
|
|
3204
3264
|
}), this.svg_element.addEventListener("mouseup", (o) => {
|
|
3205
3265
|
t = !1;
|
|
3206
3266
|
}), this.svg_element.addEventListener("point-clicked", ((o) => {
|
|
3207
3267
|
var g, c;
|
|
3208
3268
|
const l = (c = (g = o.detail) == null ? void 0 : g.pointData) == null ? void 0 : c.ID;
|
|
3209
3269
|
if (!l) return;
|
|
3210
|
-
const
|
|
3211
|
-
|
|
3270
|
+
const u = this._pointLabels.get(l) ?? this._meanLabels.get(l.replace("mean-", "")) ?? this._nodeLabels.get(l);
|
|
3271
|
+
u && u.displayMode === U.DISPLAY_TYPES.CLICK && u.toggle();
|
|
3212
3272
|
}));
|
|
3213
|
-
const a = /* @__PURE__ */
|
|
3273
|
+
const a = /* @__PURE__ */ _((o) => {
|
|
3214
3274
|
var l;
|
|
3215
3275
|
for (; o && o !== this.svg_element; ) {
|
|
3216
|
-
const
|
|
3217
|
-
if (
|
|
3276
|
+
const u = (l = o.getAttribute) == null ? void 0 : l.call(o, "data-point-id");
|
|
3277
|
+
if (u) return u;
|
|
3218
3278
|
o = o.parentElement;
|
|
3219
3279
|
}
|
|
3220
3280
|
return null;
|
|
3221
|
-
}, "findPointId"), h = /* @__PURE__ */
|
|
3281
|
+
}, "findPointId"), h = /* @__PURE__ */ _((o) => this._pointLabels.get(o) ?? this._meanLabels.get(o.replace(/^mean-/, "")) ?? this._nodeLabels.get(o), "getAutoLabel");
|
|
3222
3282
|
this.svg_element.addEventListener("mouseover", (o) => {
|
|
3223
3283
|
const l = a(o.target);
|
|
3224
3284
|
if (!l) return;
|
|
3225
|
-
const
|
|
3226
|
-
(
|
|
3285
|
+
const u = h(l);
|
|
3286
|
+
(u == null ? void 0 : u.displayMode) === U.DISPLAY_TYPES.AUTO && u.show();
|
|
3227
3287
|
}), this.svg_element.addEventListener("mouseout", (o) => {
|
|
3228
3288
|
const l = a(o.target);
|
|
3229
3289
|
if (!l) return;
|
|
3230
|
-
const
|
|
3231
|
-
if (a(
|
|
3290
|
+
const u = o.relatedTarget;
|
|
3291
|
+
if (a(u) === l) return;
|
|
3232
3292
|
const c = h(l);
|
|
3233
|
-
(c == null ? void 0 : c.displayMode) ===
|
|
3293
|
+
(c == null ? void 0 : c.displayMode) === U.DISPLAY_TYPES.AUTO && c.hide();
|
|
3234
3294
|
}), this._attachInteractionEvents();
|
|
3235
3295
|
}
|
|
3236
3296
|
/** Emit a namespaced CustomEvent on the public element (bubbles + composed). */
|
|
@@ -3287,7 +3347,7 @@ const ut = class ut extends Ae {
|
|
|
3287
3347
|
a && this._emit("qe-node-click", { ...a, originalEvent: i });
|
|
3288
3348
|
});
|
|
3289
3349
|
let e = null;
|
|
3290
|
-
const s = /* @__PURE__ */
|
|
3350
|
+
const s = /* @__PURE__ */ _((i, n) => i === "edge" ? `${n.source}\0${n.target}` : String(n.id), "keyOf");
|
|
3291
3351
|
t.addEventListener("mousemove", (i) => {
|
|
3292
3352
|
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;
|
|
3293
3353
|
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();
|
|
@@ -3355,20 +3415,20 @@ const ut = class ut extends Ae {
|
|
|
3355
3415
|
t != null && t.svg_element && (t.svg_element.style.display = this._showAxes ? "" : "none");
|
|
3356
3416
|
const e = this._labelsGroup, s = this.__data__.extremes.x_max, { cx: i, cy: n } = this.__data__.extremes;
|
|
3357
3417
|
if (!e || s <= 0) return;
|
|
3358
|
-
const r = s * 0.06, a = r * 0.6, h = /* @__PURE__ */
|
|
3359
|
-
let c = this._axisLabelEls.get(
|
|
3418
|
+
const r = s * 0.06, a = r * 0.6, h = /* @__PURE__ */ _((u, g) => {
|
|
3419
|
+
let c = this._axisLabelEls.get(u);
|
|
3360
3420
|
if (!this._showAxes || g == null) {
|
|
3361
|
-
c && (c.remove(), this._axisLabelEls.delete(
|
|
3421
|
+
c && (c.remove(), this._axisLabelEls.delete(u));
|
|
3362
3422
|
return;
|
|
3363
3423
|
}
|
|
3364
|
-
c || (c = document.createElementNS("http://www.w3.org/2000/svg", "text"), c.setAttribute("data-axis-label",
|
|
3424
|
+
c || (c = document.createElementNS("http://www.w3.org/2000/svg", "text"), c.setAttribute("data-axis-label", u), c.setAttribute("pointer-events", "none"), e.appendChild(c), this._axisLabelEls.set(u, c)), c.textContent = g, c.setAttribute("font-size", r.toString()), c.setAttribute("font-family", "system-ui, sans-serif"), c.setAttribute("font-weight", "600"), c.setAttribute("fill", "#556"), u === "x" ? (c.setAttribute("x", (i + s - a).toString()), c.setAttribute("y", (-a).toString()), c.setAttribute("text-anchor", "end")) : (c.setAttribute("x", a.toString()), c.setAttribute("y", (n - s + r + a).toString()), c.setAttribute("text-anchor", "start"));
|
|
3365
3425
|
}, "place");
|
|
3366
3426
|
if (h("x", this._axisXText), h("y", this._axisYText), this._magnifyText == null)
|
|
3367
3427
|
(o = this._magnifyEl) == null || o.remove(), this._magnifyEl = null;
|
|
3368
3428
|
else {
|
|
3369
3429
|
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);
|
|
3370
|
-
const
|
|
3371
|
-
|
|
3430
|
+
const u = this._magnifyEl;
|
|
3431
|
+
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");
|
|
3372
3432
|
}
|
|
3373
3433
|
if (!this._plotTitle)
|
|
3374
3434
|
(l = this._titleEl) == null || l.remove(), this._titleEl = null;
|
|
@@ -3386,7 +3446,7 @@ const ut = class ut extends Ae {
|
|
|
3386
3446
|
const t = this.__data__;
|
|
3387
3447
|
if (t.update_extremes(this._centerContent), this._rangeExtent && this._rangeExtent > 0) {
|
|
3388
3448
|
const { cx: i, cy: n } = t.extremes, r = this._centerContent && this._rangeMode === "network" ? t.nodeExtentFrom(i, n) * 1.2 : this._rangeExtent;
|
|
3389
|
-
t.extremes = new
|
|
3449
|
+
t.extremes = new Rt(r, r, i, n);
|
|
3390
3450
|
}
|
|
3391
3451
|
const e = (s = this.svg_element) == null ? void 0 : s.getBoundingClientRect();
|
|
3392
3452
|
if (this.svg_element && e) {
|
|
@@ -3409,8 +3469,8 @@ const ut = class ut extends Ae {
|
|
|
3409
3469
|
});
|
|
3410
3470
|
}
|
|
3411
3471
|
};
|
|
3412
|
-
|
|
3413
|
-
${
|
|
3472
|
+
_(gt, "QEGraphElement"), gt.tagName = "qe-graph", gt.style = `
|
|
3473
|
+
${ve.style}
|
|
3414
3474
|
|
|
3415
3475
|
:host {
|
|
3416
3476
|
display: block;
|
|
@@ -3427,39 +3487,39 @@ u(ut, "QEGraphElement"), ut.tagName = "qe-graph", ut.style = `
|
|
|
3427
3487
|
aspect-ratio: 1 / 1;
|
|
3428
3488
|
background-color: #FFF;
|
|
3429
3489
|
}
|
|
3430
|
-
`,
|
|
3431
|
-
let
|
|
3432
|
-
customElements.define(
|
|
3433
|
-
const Ri = /* @__PURE__ */
|
|
3490
|
+
`, gt._instances = /* @__PURE__ */ new Set(), gt._PATH_NUM_RE = /-?\d*\.?\d+(?:e[-+]?\d+)?/gi;
|
|
3491
|
+
let Vt = gt;
|
|
3492
|
+
customElements.define(Vt.tagName, Vt);
|
|
3493
|
+
const Ri = /* @__PURE__ */ _((d) => Vt.getGraph(d), "getGraph"), Li = /* @__PURE__ */ _(() => Vt.instances(), "getGraphs");
|
|
3434
3494
|
export {
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3495
|
+
st as Color,
|
|
3496
|
+
Yt as DataFrame,
|
|
3497
|
+
ye as DataFrameColumn,
|
|
3438
3498
|
oi as DataFrameColumnType,
|
|
3439
|
-
|
|
3440
|
-
|
|
3499
|
+
Ht as DataFrameRow,
|
|
3500
|
+
Me as Edge,
|
|
3441
3501
|
Ke as Graph,
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3502
|
+
Re as QEAxesElement,
|
|
3503
|
+
$e as QEEdgesElement,
|
|
3504
|
+
Vt as QEGraphElement,
|
|
3445
3505
|
ts as QELayer,
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3506
|
+
St as QELine,
|
|
3507
|
+
Ce as QEMeansElement,
|
|
3508
|
+
ke as QENodesElement,
|
|
3509
|
+
oe as QEPoint,
|
|
3510
|
+
Oe as QEPointsElement,
|
|
3511
|
+
Pe as QETrajectoriesElement,
|
|
3512
|
+
Ne as QETrajectory,
|
|
3513
|
+
xe as QEVisualElement,
|
|
3454
3514
|
hi as TRAJECTORY_ZERO_EPS,
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3515
|
+
Ee as Trajectory,
|
|
3516
|
+
we as WeightedColor,
|
|
3517
|
+
_i as fitTrajectory,
|
|
3458
3518
|
Ri as getGraph,
|
|
3459
3519
|
Li as getGraphs,
|
|
3460
3520
|
Us as nearOriginFilter,
|
|
3461
|
-
|
|
3462
|
-
|
|
3521
|
+
Gs as sampleCurve,
|
|
3522
|
+
ui as selectDegree,
|
|
3463
3523
|
Pi as vizENA
|
|
3464
3524
|
};
|
|
3465
3525
|
//# sourceMappingURL=qeviz.es.js.map
|