@qe-libs/qeviz 0.5.7 → 0.6.0

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