@qe-libs/qeviz 0.5.1 → 0.5.2

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 ni = Object.defineProperty;
2
- var zs = (d) => {
1
+ var ri = Object.defineProperty;
2
+ var Fs = (d) => {
3
3
  throw TypeError(d);
4
4
  };
5
- var u = (d, t) => ni(d, "name", { value: t, configurable: !0 });
6
- var Fs = (d, t, e) => t.has(d) || zs("Cannot " + e);
7
- var k = (d, t, e) => (Fs(d, t, "read from private field"), e ? e.call(d) : t.get(d)), tt = (d, t, e) => t.has(d) ? zs("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(d) : t.set(d, e), B = (d, t, e, s) => (Fs(d, t, "write to private field"), s ? s.call(d, e) : t.set(d, e), e);
8
- var re, oe, ae, ft, he;
9
- const ts = class ts extends Array {
5
+ var u = (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)), tt = (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), G = (d, t, e, s) => (js(d, t, "write to private field"), s ? s.call(d, e) : t.set(d, e), e);
8
+ var oe, ae, he, pt, le;
9
+ const es = class es extends Array {
10
10
  constructor(e, s, i, n, r) {
11
11
  super(...s);
12
- tt(this, re);
13
12
  tt(this, oe);
14
13
  tt(this, ae);
15
- tt(this, ft);
16
14
  tt(this, he);
17
- B(this, ae, e), B(this, oe, i), B(this, ft, n), B(this, he, n == null ? void 0 : n.classes), B(this, re, r);
15
+ tt(this, pt);
16
+ tt(this, le);
17
+ G(this, he, e), G(this, ae, i), G(this, pt, n), G(this, le, n == null ? void 0 : n.classes), G(this, oe, r);
18
18
  }
19
19
  get parent() {
20
- return k(this, ft);
20
+ return k(this, pt);
21
21
  }
22
22
  get names() {
23
- return k(this, ae);
23
+ return k(this, he);
24
24
  }
25
25
  get rowName() {
26
- return k(this, oe);
26
+ return k(this, ae);
27
27
  }
28
28
  get types() {
29
- if (!k(this, ft)) throw new Error("No parent DataFrame attached to this row.");
30
- return k(this, ft).types;
29
+ if (!k(this, pt)) throw new Error("No parent DataFrame attached to this row.");
30
+ return k(this, pt).types;
31
31
  }
32
32
  get classes() {
33
- return k(this, he);
33
+ return k(this, le);
34
34
  }
35
35
  get rowNumber() {
36
- return k(this, re);
36
+ return k(this, oe);
37
37
  }
38
38
  col(e) {
39
- if (!k(this, ft)) throw new Error("No parent DataFrame attached to this row.");
40
- return k(this, ft).col(e);
39
+ if (!k(this, pt)) throw new Error("No parent DataFrame attached to this row.");
40
+ return k(this, pt).col(e);
41
41
  }
42
42
  cols(...e) {
43
- if (!k(this, ft)) throw new Error("No parent DataFrame attached to this row.");
44
- return k(this, ft).cols(...e);
43
+ if (!k(this, pt)) throw new Error("No parent DataFrame attached to this row.");
44
+ return k(this, pt).cols(...e);
45
45
  }
46
46
  filter(e) {
47
47
  console.error("DataFrameRow does not currently support filtering.");
48
48
  }
49
49
  };
50
- re = new WeakMap(), oe = new WeakMap(), ae = new WeakMap(), ft = new WeakMap(), he = new WeakMap(), u(ts, "DataFrameRow");
51
- let Gt = ts;
52
- var ri = /* @__PURE__ */ ((d) => (d.Character = "character", d.Double = "double", d.Logical = "logical", d.Integer = "integer", d))(ri || {}), le, pt, Yt, Et;
53
- const es = class es extends Array {
50
+ oe = new WeakMap(), ae = new WeakMap(), he = new WeakMap(), pt = new WeakMap(), le = new WeakMap(), u(es, "DataFrameRow");
51
+ let Bt = es;
52
+ var oi = /* @__PURE__ */ ((d) => (d.Character = "character", d.Double = "double", d.Logical = "logical", d.Integer = "integer", d))(oi || {}), ce, bt, qt, Mt;
53
+ const ss = class ss extends Array {
54
54
  constructor(e, s, i, n) {
55
55
  super(s.length);
56
- tt(this, le);
57
- tt(this, pt);
58
- tt(this, Yt);
59
- tt(this, Et);
56
+ tt(this, ce);
57
+ tt(this, bt);
58
+ tt(this, qt);
59
+ tt(this, Mt);
60
60
  for (let r = 0; r < s.length; r++)
61
61
  this[r] = s[r];
62
- if (B(this, le, e), s.type !== void 0 ? B(this, pt, s.type) : s.every((r) => typeof r == "string" || r === null || r === void 0) ? B(this, pt, "character") : s.every((r) => Number.isInteger(r) || r === null || r === void 0) ? s.every((r) => r === 0 || r === 1 || r === null || r === void 0) ? B(this, pt, "logical") : B(this, pt, "integer") : s.every((r) => typeof r == "number" || r === null || r === void 0) ? B(this, pt, "double") : s.every((r) => typeof r == "boolean" || r === null || r === void 0) ? B(this, pt, "logical") : B(this, pt, "character"), B(this, Et, n), i && i.length !== this.length)
62
+ if (G(this, ce, e), s.type !== void 0 ? G(this, bt, s.type) : s.every((r) => typeof r == "string" || r === null || r === void 0) ? G(this, bt, "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, bt, "logical") : G(this, bt, "integer") : s.every((r) => typeof r == "number" || r === null || r === void 0) ? G(this, bt, "double") : s.every((r) => typeof r == "boolean" || r === null || r === void 0) ? G(this, bt, "logical") : G(this, bt, "character"), G(this, Mt, 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 ? B(this, Yt, i) : B(this, Yt, void 0);
64
+ i && i.length > 0 ? G(this, qt, i) : G(this, qt, void 0);
65
65
  }
66
66
  get name() {
67
- return k(this, le);
67
+ return k(this, ce);
68
68
  }
69
69
  get type() {
70
- return k(this, pt);
70
+ return k(this, bt);
71
71
  }
72
72
  get rowNames() {
73
- return k(this, Yt);
73
+ return k(this, qt);
74
74
  }
75
75
  row(e) {
76
- if (!k(this, Et)) throw new Error("No parent DataFrame attached to this column.");
77
- return k(this, Et).row(e);
76
+ if (!k(this, Mt)) throw new Error("No parent DataFrame attached to this column.");
77
+ return k(this, Mt).row(e);
78
78
  }
79
79
  rows(...e) {
80
- if (!k(this, Et)) throw new Error("No parent DataFrame attached to this column.");
81
- return k(this, Et).rows(...e);
80
+ if (!k(this, Mt)) throw new Error("No parent DataFrame attached to this column.");
81
+ return k(this, Mt).rows(...e);
82
82
  }
83
83
  };
84
- le = new WeakMap(), pt = new WeakMap(), Yt = new WeakMap(), Et = new WeakMap(), u(es, "DataFrameColumn");
85
- let pe = es;
86
- var At, ht, ce;
87
- const Kt = class Kt extends Array {
84
+ ce = new WeakMap(), bt = new WeakMap(), qt = new WeakMap(), Mt = new WeakMap(), u(ss, "DataFrameColumn");
85
+ let be = ss;
86
+ var vt, ht, _e;
87
+ const Jt = class Jt 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,33 +97,33 @@ const Kt = class Kt extends Array {
97
97
  s = r;
98
98
  }
99
99
  super(s.length);
100
- tt(this, At);
100
+ tt(this, vt);
101
101
  tt(this, ht);
102
- tt(this, ce);
102
+ tt(this, _e);
103
103
  if (s.forEach((r, a) => {
104
- r instanceof pe ? this[a] = r : this[a] = new pe(e[a], r, i, this);
105
- }), B(this, At, e), i && this[0] && i.length !== this[0].length)
104
+ r instanceof be ? this[a] = r : this[a] = new be(e[a], r, i, this);
105
+ }), G(this, vt, 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 && B(this, ht, 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 && B(this, ce, n);
109
+ n && n.length > 0 && G(this, _e, n);
110
110
  }
111
111
  get classes() {
112
- return k(this, ce);
112
+ return k(this, _e);
113
113
  }
114
114
  getColumnByName(e) {
115
- const s = k(this, At).indexOf(e);
115
+ const s = k(this, vt).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 Gt(k(this, At), [], void 0, this, e);
120
+ return console.warn("DataFrame is empty, cannot get row by index", e), new Bt(k(this, vt), [], 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 Gt(k(this, At), s, k(this, ht) ? k(this, ht)[e] : void 0, this, e);
126
+ return new Bt(k(this, vt), s, k(this, ht) ? k(this, ht)[e] : void 0, this, e);
127
127
  }
128
128
  getRowByName(e) {
129
129
  if (!k(this, ht)) return;
@@ -173,18 +173,18 @@ const Kt = class Kt 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, At)) : (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 Kt(n, i, k(this, ht));
176
+ return e.length === 0 ? (i = this.slice(), n = k(this, vt)) : (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 Jt(n, i, k(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 Kt(
180
+ return new Jt(
181
181
  i.map((n) => n.name),
182
182
  i.map((n) => n.values),
183
183
  k(this, ht)
184
184
  );
185
185
  }
186
186
  get names() {
187
- return k(this, At);
187
+ return k(this, vt);
188
188
  }
189
189
  get rowNames() {
190
190
  return k(this, ht);
@@ -196,11 +196,11 @@ const Kt = class Kt extends Array {
196
196
  return this.length;
197
197
  }
198
198
  };
199
- At = new WeakMap(), ht = new WeakMap(), ce = new WeakMap(), u(Kt, "DataFrame");
200
- let Ft = Kt;
201
- const ss = class ss {
199
+ vt = new WeakMap(), ht = new WeakMap(), _e = new WeakMap(), u(Jt, "DataFrame");
200
+ let jt = Jt;
201
+ const is = class is {
202
202
  constructor(t = {}) {
203
- this.unit_id_col = "id", this.node_id_col = "id", this.group_col = null, this.directed = !1, this.palette = [], this._points = t.points ?? new Ft(), this._nodes = t.nodes ?? new Ft(), this._edges = t.edges ?? new Ft(), 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 jt(), this._nodes = t.nodes ?? new jt(), this._edges = t.edges ?? new jt(), 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 ss = class ss {
285
285
  this[t] = e;
286
286
  }
287
287
  };
288
- u(ss, "Model");
289
- let He = ss;
290
- const oi = globalThis.__QEVIZ_DEBUG__ === !0;
291
- function js(...d) {
292
- oi && console.log(...d);
288
+ u(is, "Model");
289
+ let Xe = is;
290
+ const ai = globalThis.__QEVIZ_DEBUG__ === !0;
291
+ function Ys(...d) {
292
+ ai && console.log(...d);
293
293
  }
294
- u(js, "dbg");
295
- const Oi = {
294
+ u(Ys, "dbg");
295
+ const Pi = {
296
296
  get: /* @__PURE__ */ u((d) => {
297
297
  const t = [...document.querySelectorAll("qe-graph")];
298
298
  return typeof d == "number" && d >= 0 ? t[d] : t;
299
299
  }, "get")
300
- }, Dt = class Dt extends HTMLElement {
300
+ }, Tt = class Tt 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 He();
302
+ super(), this._isVisible = !0, this.output = "", this._updated = "", this._active_points = [], this._points = /* @__PURE__ */ new Map(), this._edges = /* @__PURE__ */ new Map(), this._labels = /* @__PURE__ */ new Map(), this._model = new Xe();
303
303
  const t = this.attachShadow({ mode: "open" }), e = document.createElement("style");
304
- e.textContent = Dt.styles, t.appendChild(e), this._outputElement = document.createElement("div"), t.appendChild(this._outputElement);
304
+ e.textContent = Tt.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 Oi = {
339
339
  return this._labels;
340
340
  }
341
341
  connectedCallback() {
342
- js("QEVisualElement connected"), this.render();
342
+ Ys("QEVisualElement connected"), this.render();
343
343
  }
344
344
  /**
345
345
  * Accept pre-fetched ENA model data and update the visualization.
@@ -349,14 +349,14 @@ const Oi = {
349
349
  setModelData(t) {
350
350
  var r, a, h, o;
351
351
  ["nodes", "edges", "points", "groups", "confidence", "outlier", "trajectories", "networks", "pointsets"].forEach((l) => {
352
- var v;
352
+ var S;
353
353
  const _ = t[l];
354
- if (!((v = _ == null ? void 0 : _.data) != null && v.length)) return;
355
- const g = _.data, c = _.types || {}, S = Object.keys(g[0]), p = g.map((j) => Object.values(j)), A = S.map((j) => c[j] ?? "character");
354
+ if (!((S = _ == null ? void 0 : _.data) != null && S.length)) return;
355
+ const g = _.data, c = _.types || {}, E = Object.keys(g[0]), f = g.map((j) => Object.values(j)), v = E.map((j) => c[j] ?? "character");
356
356
  let P;
357
- l === "networks" ? P = "name" : l === "pointsets" ? P = "id" : l === "nodes" ? P = t.node_id_col ?? S.find((j) => (c[j] ?? "character") === "character") : l === "edges" || l === "points" || l === "trajectories" ? P = t.id_col ?? S.find((j) => (c[j] ?? "character") === "character") : P = t.group_col ?? S.find((j) => (c[j] ?? "character") === "character");
358
- const Y = P ? S.indexOf(P) : 0, q = p.map((j) => String(j[Y]));
359
- this._model.setByKey(l, new Ft(S, p, q, A));
357
+ l === "networks" ? P = "name" : l === "pointsets" ? P = "id" : l === "nodes" ? P = t.node_id_col ?? E.find((j) => (c[j] ?? "character") === "character") : l === "edges" || l === "points" || l === "trajectories" ? P = t.id_col ?? E.find((j) => (c[j] ?? "character") === "character") : P = t.group_col ?? E.find((j) => (c[j] ?? "character") === "character");
358
+ const Y = P ? E.indexOf(P) : 0, q = f.map((j) => String(j[Y]));
359
+ this._model.setByKey(l, new jt(E, f, q, v));
360
360
  }), t.updated !== void 0 && this._model.setByKey("updated", t.updated), t.directed !== void 0 && (this._model.directed = t.directed), Array.isArray(t.palette) && (this._model.palette = t.palette.map(String));
361
361
  const s = this._model.nodes;
362
362
  this._model.node_id_col = t.node_id_col ?? ((r = s == null ? void 0 : s.names) == null ? void 0 : r.find((l) => {
@@ -377,15 +377,15 @@ const Oi = {
377
377
  if (_ && g)
378
378
  this._model.dimensions = [_, g];
379
379
  else {
380
- const c = s.names.filter((S) => {
381
- if (S === l) return !1;
382
- const p = s.col(S);
383
- return p && p.type !== "character" && p.type !== "logical";
380
+ const c = s.names.filter((E) => {
381
+ if (E === l) return !1;
382
+ const f = s.col(E);
383
+ return f && f.type !== "character" && f.type !== "logical";
384
384
  });
385
385
  c.length >= 2 && (this._model.dimensions = [_ ?? c[0], g ?? c[1]]);
386
386
  }
387
387
  }
388
- this.updated = this._model.updated !== void 0 ? String(this._model.updated) : String(Date.now()), js("Model updated via setModelData:", this.updated), this.render();
388
+ this.updated = this._model.updated !== void 0 ? String(this._model.updated) : String(Date.now()), Ys("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 Oi = {
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
- u(Dt, "QEVisualElement"), Dt.tagName = "qe-visual", Dt.styles = `
401
+ u(Tt, "QEVisualElement"), Tt.tagName = "qe-visual", Tt.styles = `
402
402
  :host { display: block; width: 100%; }
403
403
  :host(.hidden) { display: none !important; }
404
404
  /* The output wrapper and the slotted graph fill the host so the plot
@@ -406,14 +406,14 @@ u(Dt, "QEVisualElement"), Dt.tagName = "qe-visual", Dt.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 be = Dt;
410
- customElements.define(be.tagName, be);
411
- const Pe = class Pe {
409
+ let ye = Tt;
410
+ customElements.define(ye.tagName, ye);
411
+ const Re = class Re {
412
412
  constructor(t) {
413
413
  return this.base = typeof t == "string" ? t : t.base, new Proxy(this, {
414
414
  get(e, s) {
415
415
  if (typeof s == "string" && /^[0-2]$/.test(s)) {
416
- const { r: i, g: n, b: r } = Pe.parseColor(e.base);
416
+ const { r: i, g: n, b: r } = Re.parseColor(e.base);
417
417
  return [i, n, r][Number(s)];
418
418
  }
419
419
  return e[s];
@@ -441,9 +441,9 @@ const Pe = class Pe {
441
441
  return `rgb(${t}, ${e}, ${s})`;
442
442
  }
443
443
  };
444
- u(Pe, "Color");
445
- let et = Pe;
446
- const Jt = class Jt extends et {
444
+ u(Re, "Color");
445
+ let et = Re;
446
+ const Zt = class Zt extends et {
447
447
  constructor(t, e, s) {
448
448
  super(t), this.weight = e, this.alpha = s;
449
449
  }
@@ -481,13 +481,13 @@ const Jt = class Jt extends et {
481
481
  // #EE6677 have HSL lightness ≈ 67%, so 100% HSL saturation still looks
482
482
  // washed-out, whereas HSV value ≈ 0.93 gives the expected vivid output.
483
483
  toString() {
484
- const { h: t, v: e } = Jt.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));
485
- return Jt.hsvToRgba(t, s, e, i);
484
+ const { h: t, v: e } = Zt.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));
485
+ return Zt.hsvToRgba(t, s, e, i);
486
486
  }
487
487
  };
488
- u(Jt, "WeightedColor");
489
- let ye = Jt;
490
- const is = class is {
488
+ u(Zt, "WeightedColor");
489
+ let xe = Zt;
490
+ const ns = class ns {
491
491
  constructor(t = null) {
492
492
  this._values = [1, 0, 0, 1, 0, 0], this._keys = ["a", "b", "c", "d", "e", "f"], t && (this.values = t);
493
493
  }
@@ -564,9 +564,9 @@ const is = class is {
564
564
  return this.get("f");
565
565
  }
566
566
  };
567
- u(is, "Transform");
568
- let te = is;
569
- var ee;
567
+ u(ns, "Transform");
568
+ let ee = ns;
569
+ var se;
570
570
  ((d) => {
571
571
  ((t) => {
572
572
  function e(s) {
@@ -591,96 +591,96 @@ var ee;
591
591
  if (u(l, "rotatePoint"), !h || h[0] === 0 && h[1] === 0)
592
592
  return l(r, o);
593
593
  {
594
- const _ = r.map((c, S) => c - h[S]);
595
- return l(_, o).map((c, S) => c + h[S]);
594
+ const _ = r.map((c, E) => c - h[E]);
595
+ return l(_, o).map((c, E) => c + h[E]);
596
596
  }
597
597
  }
598
598
  u(n, "rotate"), s.rotate = n;
599
599
  })(t.Point || (t.Point = {})), ((s) => {
600
- function i(p, A) {
601
- return (A[1] - p[1]) / (A[0] - p[0]);
600
+ function i(f, v) {
601
+ return (v[1] - f[1]) / (v[0] - f[0]);
602
602
  }
603
603
  u(i, "slope"), s.slope = i;
604
- function n(p, A) {
605
- const P = i(p, A);
606
- return p[1] - P * p[0];
604
+ function n(f, v) {
605
+ const P = i(f, v);
606
+ return f[1] - P * f[0];
607
607
  }
608
608
  u(n, "intercept"), s.intercept = n;
609
- function r(p, A) {
609
+ function r(f, v) {
610
610
  return {
611
- slope: i(p, A),
612
- intercept: n(p, A)
611
+ slope: i(f, v),
612
+ intercept: n(f, v)
613
613
  };
614
614
  }
615
615
  u(r, "slopeIntercept"), s.slopeIntercept = r;
616
- function a(p, A = 0) {
617
- const P = A, Y = (1 - P) * p[0][0] + P * p[1][0], q = (1 - P) * p[0][1] + P * p[1][1];
616
+ function a(f, v = 0) {
617
+ const P = v, Y = (1 - P) * f[0][0] + P * f[1][0], q = (1 - P) * f[0][1] + P * f[1][1];
618
618
  return [Y, q];
619
619
  }
620
620
  u(a, "point_along"), s.point_along = a;
621
- function h(p, A, P = 0.5) {
622
- return Array.isArray(p[0]) && (A = p[1], p = p[0]), [0, 1].map((Y) => (parseFloat(p[Y]) + parseFloat(A[Y])) * P);
621
+ function h(f, v, P = 0.5) {
622
+ return Array.isArray(f[0]) && (v = f[1], f = f[0]), [0, 1].map((Y) => (parseFloat(f[Y]) + parseFloat(v[Y])) * P);
623
623
  }
624
624
  u(h, "midpoint"), s.midpoint = h;
625
- function o(p, A) {
626
- return Array.isArray(p[0]) && (A = p[1], p = p[0]), Math.sqrt(
627
- [0, 1].map((P) => Math.pow(A[P] - p[P], 2)).reduce((P, Y) => P + Y, 0)
625
+ function o(f, v) {
626
+ return Array.isArray(f[0]) && (v = f[1], f = f[0]), Math.sqrt(
627
+ [0, 1].map((P) => Math.pow(v[P] - f[P], 2)).reduce((P, Y) => P + Y, 0)
628
628
  );
629
629
  }
630
630
  u(o, "length"), s.length = o;
631
- function l(p, A = [0, 0]) {
631
+ function l(f, v = [0, 0]) {
632
632
  const P = [
633
- p[1][0] - A[0],
634
- p[1][1] - A[1]
633
+ f[1][0] - v[0],
634
+ f[1][1] - v[1]
635
635
  ], Y = [
636
636
  -P[1],
637
637
  P[0]
638
638
  ], q = [
639
639
  -Y[0],
640
640
  -Y[1]
641
- ], v = [
642
- Y[0] + A[0],
643
- Y[1] + A[1]
641
+ ], S = [
642
+ Y[0] + v[0],
643
+ Y[1] + v[1]
644
644
  ], j = [
645
- q[0] + A[0],
646
- q[1] + A[1]
645
+ q[0] + v[0],
646
+ q[1] + v[1]
647
647
  ];
648
- return [v, j];
648
+ return [S, j];
649
649
  }
650
650
  u(l, "rotate"), s.rotate = l;
651
- function _(p, A, P = 90) {
652
- const Y = d.Geometry.Line.slope(p[0], p[1]), q = d.Geometry.Line.intercept(p[0], p[1]), v = [0, q], j = [1, Y + q];
653
- p = [v, j];
654
- const it = [p[0][0], p[1][0]], rt = [p[0][1], p[1][1]], st = A[0], lt = A[1], V = -2 * Math.PI * P / 360, St = it.map(
655
- (ue, ct) => (ue - st) * Math.cos(V) - (rt[ct] - lt) * Math.sin(V) + st
656
- ), Nt = rt.map(
657
- (ue, ct) => (it[ct] - st) * Math.sin(V) - (ue - lt) * Math.cos(V) + lt
651
+ function _(f, v, P = 90) {
652
+ const Y = d.Geometry.Line.slope(f[0], f[1]), q = d.Geometry.Line.intercept(f[0], f[1]), S = [0, q], j = [1, Y + q];
653
+ f = [S, j];
654
+ const nt = [f[0][0], f[1][0]], rt = [f[0][1], f[1][1]], st = v[0], lt = v[1], W = -2 * Math.PI * P / 360, Et = nt.map(
655
+ (de, ct) => (de - st) * Math.cos(W) - (rt[ct] - lt) * Math.sin(W) + st
656
+ ), kt = rt.map(
657
+ (de, ct) => (nt[ct] - st) * Math.sin(W) - (de - lt) * Math.cos(W) + lt
658
658
  );
659
659
  return [
660
- [St[0], Nt[0]],
661
- [St[1], Nt[1]]
660
+ [Et[0], kt[0]],
661
+ [Et[1], kt[1]]
662
662
  ];
663
663
  }
664
664
  u(_, "rotate2"), s.rotate2 = _;
665
- function g(p, A) {
666
- const [[P, Y], [q, v]] = p, [[j, it], [rt, st]] = A, lt = (P - q) * (it - st) - (Y - v) * (j - rt), V = (P * v - Y * q) * (j - rt) - (P - q) * (j * st - it * rt), St = (P * v - Y * q) * (it - st) - (Y - v) * (j * st - it * rt);
667
- return [V / lt, St / lt];
665
+ function g(f, v) {
666
+ const [[P, Y], [q, S]] = f, [[j, nt], [rt, st]] = v, lt = (P - q) * (nt - st) - (Y - S) * (j - rt), W = (P * S - Y * q) * (j - rt) - (P - q) * (j * st - nt * rt), Et = (P * S - Y * q) * (nt - st) - (Y - S) * (j * st - nt * rt);
667
+ return [W / lt, Et / lt];
668
668
  }
669
669
  u(g, "intersection"), s.intersection = g;
670
- function c(p, A, P) {
671
- let { slope: Y, intercept: q } = d.Geometry.Line.slopeIntercept(p[0], p[1]), v = 1 + Math.pow(Y, 2), j = 2 * Y * q - 2 * A[1] * Y - 2 * A[0], it = Math.pow(A[0], 2) + Math.pow(q, 2) + Math.pow(A[1], 2) - 2 * A[1] * q - Math.pow(P, 2), rt = [[1 / 0, 1 / 0], [1 / 0, 1 / 0]];
672
- if (Math.sqrt(Math.pow(j, 2) - 4 * v * it) >= 0) {
673
- let st = (-j + Math.sqrt(Math.pow(j, 2) - 4 * v * it)) / (2 * v), lt = (-j - Math.sqrt(Math.pow(j, 2) - 4 * v * it)) / (2 * v), V = Y * st + q, St = Y * lt + q;
674
- rt = [[st, V], [lt, St]];
670
+ function c(f, v, P) {
671
+ let { slope: Y, intercept: q } = d.Geometry.Line.slopeIntercept(f[0], f[1]), S = 1 + Math.pow(Y, 2), j = 2 * Y * q - 2 * v[1] * Y - 2 * v[0], nt = Math.pow(v[0], 2) + Math.pow(q, 2) + Math.pow(v[1], 2) - 2 * v[1] * q - Math.pow(P, 2), rt = [[1 / 0, 1 / 0], [1 / 0, 1 / 0]];
672
+ if (Math.sqrt(Math.pow(j, 2) - 4 * S * nt) >= 0) {
673
+ let st = (-j + Math.sqrt(Math.pow(j, 2) - 4 * S * nt)) / (2 * S), lt = (-j - Math.sqrt(Math.pow(j, 2) - 4 * S * nt)) / (2 * S), W = Y * st + q, Et = Y * lt + q;
674
+ rt = [[st, W], [lt, Et]];
675
675
  } else
676
676
  console.error("The line and the circumference do not intersect");
677
677
  return rt;
678
678
  }
679
679
  u(c, "intersect_circle"), s.intersect_circle = c;
680
- function S(p) {
681
- return (A) => A === 0 ? p[0] : A === 1 ? p[1] : d.Geometry.Point.translate(p[0], d.Geometry.Angle.line(p), d.Geometry.Line.length(p) * A);
680
+ function E(f) {
681
+ return (v) => v === 0 ? f[0] : v === 1 ? f[1] : d.Geometry.Point.translate(f[0], d.Geometry.Angle.line(f), d.Geometry.Line.length(f) * v);
682
682
  }
683
- u(S, "interpolate"), s.interpolate = S;
683
+ u(E, "interpolate"), s.interpolate = E;
684
684
  })(t.Line || (t.Line = {}));
685
685
  let e;
686
686
  ((s) => {
@@ -822,8 +822,8 @@ var ee;
822
822
  u(r, "has"), s.has = r;
823
823
  })(t.Query || (t.Query = {}));
824
824
  })(d.URL || (d.URL = {}));
825
- })(ee || (ee = {}));
826
- const ns = class ns {
825
+ })(se || (se = {}));
826
+ const rs = class rs {
827
827
  constructor() {
828
828
  this._state = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Map();
829
829
  }
@@ -862,9 +862,9 @@ const ns = class ns {
862
862
  });
863
863
  }
864
864
  };
865
- u(ns, "EventBus");
866
- let xe = ns;
867
- const { ArrayTools: Ys } = ee, Zt = class Zt extends Array {
865
+ u(rs, "EventBus");
866
+ let we = rs;
867
+ const { ArrayTools: qs } = se, Qt = class Qt extends Array {
868
868
  constructor(...t) {
869
869
  super(...t);
870
870
  }
@@ -875,14 +875,14 @@ const { ArrayTools: Ys } = ee, Zt = class Zt extends Array {
875
875
  }
876
876
  u(i, "fn");
877
877
  function n(r, a, h = null) {
878
- if (Ys.isArray(r)) {
878
+ if (qs.isArray(r)) {
879
879
  for (const [o, l] of r.entries())
880
880
  if (s = n(l, o, h), s)
881
881
  return s;
882
882
  } else {
883
883
  if (s = i(r), s)
884
884
  return s;
885
- if (r && Ys.isArray(r[t])) {
885
+ if (r && qs.isArray(r[t])) {
886
886
  for (const [o, l] of r[t].entries())
887
887
  if (s = n(l, o, r), s)
888
888
  return s;
@@ -896,11 +896,11 @@ const { ArrayTools: Ys } = ee, Zt = class Zt extends Array {
896
896
  return this.reduce((t, e) => (t.push(e), e.layers && Array.isArray(e.layers) && t.push(...e.layers), t), []);
897
897
  }
898
898
  recurse(t, e, s = null, i = 0) {
899
- let n = new Zt();
899
+ let n = new Qt();
900
900
  for (const r of this) {
901
901
  let a = e(r, s, i);
902
902
  if (r[t] && Array.isArray(r[t])) {
903
- let h = new Zt(...r[t]).recurse(t, e, r, i + 1);
903
+ let h = new Qt(...r[t]).recurse(t, e, r, i + 1);
904
904
  h !== void 0 && n.push(...h);
905
905
  }
906
906
  n.push(a);
@@ -908,11 +908,11 @@ const { ArrayTools: Ys } = ee, Zt = class Zt extends Array {
908
908
  return console.log("Recurse results: ", n), n;
909
909
  }
910
910
  };
911
- u(Zt, "LayerArray");
912
- let jt = Zt;
913
- const rs = class rs {
911
+ u(Qt, "LayerArray");
912
+ let Yt = Qt;
913
+ const os = class os {
914
914
  constructor(t, e, s) {
915
- this.__state__ = new xe(), this.scale_x = 1, this.scale_y = 1, this.scale_objects = !0, this.layers = new jt(), 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 te(), s == null || s.__state__.addListener("graph_updated", "live", ({ key: i, newValue: n, oldValue: r }) => {
915
+ this.__state__ = new we(), this.scale_x = 1, this.scale_y = 1, this.scale_objects = !0, this.layers = new Yt(), 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 ee(), s == null || s.__state__.addListener("graph_updated", "live", ({ key: i, newValue: n, oldValue: r }) => {
916
916
  }), s == null || s.__state__.addListener(`graph_updated_${this.name}`, "live", ({ key: i, newValue: n, oldValue: r }) => {
917
917
  this.objects = n, this.__state__.setVariable("layer_updated", this);
918
918
  });
@@ -924,45 +924,45 @@ const rs = class rs {
924
924
  this._transform = t;
925
925
  }
926
926
  };
927
- u(rs, "Layer");
928
- let Xe = rs;
929
- var Pt, vt;
930
- const Re = class Re extends Array {
927
+ u(os, "Layer");
928
+ let We = os;
929
+ var Rt, St;
930
+ const Le = class Le extends Array {
931
931
  constructor(...e) {
932
932
  super(arguments.length);
933
- tt(this, Pt, !1);
934
- tt(this, vt);
933
+ tt(this, Rt, !1);
934
+ tt(this, St);
935
935
  for (let s = 0; s < e.length; s++)
936
936
  this[s] = e[s];
937
- B(this, Pt, !1);
937
+ G(this, Rt, !1);
938
938
  }
939
939
  static fromArray(e) {
940
- const s = new Re();
940
+ const s = new Le();
941
941
  return e.forEach((i, n) => {
942
942
  s.push(i);
943
- }), B(s, vt, e.names), s;
943
+ }), G(s, St, e.names), s;
944
944
  }
945
945
  flip() {
946
- B(this, Pt, !k(this, Pt));
946
+ G(this, Rt, !k(this, Rt));
947
947
  for (let e = 0; e < this.length; e++)
948
948
  this[e] = -this[e];
949
949
  return this;
950
950
  }
951
951
  get(e) {
952
- return typeof e == "number" ? this[e] : k(this, vt) && k(this, vt).includes(e) ? this[k(this, vt).indexOf(e)] : void 0;
952
+ return typeof e == "number" ? this[e] : k(this, St) && k(this, St).includes(e) ? this[k(this, St).indexOf(e)] : void 0;
953
953
  }
954
954
  get flipped() {
955
- return k(this, Pt);
955
+ return k(this, Rt);
956
956
  }
957
957
  get names() {
958
- return k(this, vt) ? k(this, vt) : this.map((e, s) => `V${s + 1}`);
958
+ return k(this, St) ? k(this, St) : this.map((e, s) => `V${s + 1}`);
959
959
  }
960
960
  };
961
- Pt = new WeakMap(), vt = new WeakMap(), u(Re, "DimensionVector");
962
- let $t = Re;
963
- const os = class os {
961
+ Rt = new WeakMap(), St = new WeakMap(), u(Le, "DimensionVector");
962
+ let $t = Le;
963
+ const as = class as {
964
964
  constructor(t, e) {
965
- this.scale_x = 1, this.scale_y = 1, this.scale_size = 0.05, this.active = !1, this.visible = !1, this.highlighting = !1, this.meta = {}, this._x = 0, this._y = 0, this._highlight_default = new et("#000000"), this._size = 0, this.ID = e.ID, this._transform = new te(), t instanceof $t ? this._dimensions = t : t instanceof Gt ? this._dimensions = $t.fromArray(t) : Array.isArray(t) ? this._dimensions = new $t(...t) : (console.warn("Invalid dimensions provided, using default DimensionVector(0, 0)"), this._dimensions = new $t(0, 0));
965
+ this.scale_x = 1, this.scale_y = 1, this.scale_size = 0.05, this.active = !1, this.visible = !1, this.highlighting = !1, this.meta = {}, this._x = 0, this._y = 0, this._highlight_default = new et("#000000"), this._size = 0, this.ID = e.ID, this._transform = new ee(), t instanceof $t ? this._dimensions = t : t instanceof Bt ? this._dimensions = $t.fromArray(t) : Array.isArray(t) ? this._dimensions = new $t(...t) : (console.warn("Invalid dimensions provided, using default DimensionVector(0, 0)"), this._dimensions = new $t(0, 0));
966
966
  let s = { ...e };
967
967
  this._original = { ...s }, this.ID = s.ID, this.x = s.x || this._dimensions[0], this.y = s.y || this._dimensions[1], this._size = s.size || 1, this._color = s.color || new et("#000000"), this.active = s.active || !1, this.shape = s.shape || null, this.meta = s.meta || {}, this._highlight = this._highlight_default, s.highlight && (this._highlight = s.highlight);
968
968
  }
@@ -1016,9 +1016,9 @@ const os = class os {
1016
1016
  this._transform = t;
1017
1017
  }
1018
1018
  };
1019
- u(os, "PlottedObject");
1020
- let Mt = os;
1021
- const as = class as extends Mt {
1019
+ u(as, "PlottedObject");
1020
+ let It = as;
1021
+ const hs = class hs extends It {
1022
1022
  // constructor(x: LineOptions) {
1023
1023
  // super([], x);
1024
1024
  // // const data = Object.assign({}, x);
@@ -1060,9 +1060,9 @@ const as = class as extends Mt {
1060
1060
  this._color = t;
1061
1061
  }
1062
1062
  };
1063
- u(as, "Line");
1064
- let Bt = as;
1065
- const Qt = class Qt extends Mt {
1063
+ u(hs, "Line");
1064
+ let Ht = hs;
1065
+ const te = class te extends It {
1066
1066
  // constructor(dimensions: DimensionType, o: PointOptions) { //, graph?: any) {
1067
1067
  // super(dimensions, o);
1068
1068
  // this.active = o.active || false;
@@ -1078,7 +1078,7 @@ const Qt = class Qt extends Mt {
1078
1078
  constructor(t) {
1079
1079
  var n, r;
1080
1080
  let e, s, i;
1081
- t ? t instanceof Gt ? (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 = Qt.SHAPES.CIRCLE;
1081
+ t ? t instanceof Bt ? (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 = te.SHAPES.CIRCLE;
1082
1082
  }
1083
1083
  set label(t) {
1084
1084
  this._label = t;
@@ -1099,9 +1099,9 @@ const Qt = class Qt extends Mt {
1099
1099
  this._y = parseFloat(t);
1100
1100
  }
1101
1101
  };
1102
- u(Qt, "Point"), Qt.SHAPES = { CIRCLE: "circle", SQUARE: "rect" };
1103
- let K = Qt;
1104
- const Tt = class Tt extends Mt {
1102
+ u(te, "Point"), te.SHAPES = { CIRCLE: "circle", SQUARE: "rect" };
1103
+ let J = te;
1104
+ const zt = class zt extends It {
1105
1105
  constructor(t, e) {
1106
1106
  super(e.dimensions, e), this._visible = !1, this.offset = 0, this.text = t, this.ID = e.ID, this.object = e, this.x = this.dimensions[0], this.y = this.dimensions[1], this.offset = e.size || 0, this.size = this.offset / 4, this.visible = !1, this._transform.set("e", 1), this._transform.set("f", 1);
1107
1107
  }
@@ -1124,9 +1124,9 @@ const Tt = class Tt extends Mt {
1124
1124
  this._transform = t;
1125
1125
  }
1126
1126
  };
1127
- u(Tt, "Label"), Tt.DISPLAY_TYPES = { OFF: 0, AUTO: 1, CLICK: 2, ON: 3 }, Tt.HIGHLIGHT = { OFF: 0, ON: 2 }, Tt.POSITION = { OBJECT: 1, STATIC: 2, CONTAINER: 3, CUSTOM: 4 };
1128
- let H = Tt;
1129
- const hs = class hs {
1127
+ u(zt, "Label"), zt.DISPLAY_TYPES = { OFF: 0, AUTO: 1, CLICK: 2, ON: 3 }, zt.HIGHLIGHT = { OFF: 0, ON: 2 }, zt.POSITION = { OBJECT: 1, STATIC: 2, CONTAINER: 3, CUSTOM: 4 };
1128
+ let B = zt;
1129
+ const ls = class ls {
1130
1130
  constructor(t, e, s = 0, i = 0) {
1131
1131
  this.x_max = t, this.y_max = e, this.cx = s, this.cy = i;
1132
1132
  }
@@ -1159,9 +1159,9 @@ const hs = class hs {
1159
1159
  return this.x_max;
1160
1160
  }
1161
1161
  };
1162
- u(hs, "Extremes");
1163
- let Ot = hs;
1164
- const ls = class ls extends Mt {
1162
+ u(ls, "Extremes");
1163
+ let Pt = ls;
1164
+ const cs = class cs extends It {
1165
1165
  constructor(t, e) {
1166
1166
  super(t, e), this.visible = !0, this.size = e.size;
1167
1167
  }
@@ -1187,8 +1187,8 @@ const ls = class ls extends Mt {
1187
1187
  return this._transform;
1188
1188
  }
1189
1189
  };
1190
- u(ls, "AxisPoint");
1191
- let We = ls, Vs = {
1190
+ u(cs, "AxisPoint");
1191
+ let Ve = cs, Ks = {
1192
1192
  GRAPH: {
1193
1193
  ratio: 1,
1194
1194
  x_max: 1,
@@ -1204,25 +1204,25 @@ let We = ls, Vs = {
1204
1204
  size: 1,
1205
1205
  highlight: {
1206
1206
  color: "yellow",
1207
- labels: H.DISPLAY_TYPES.ON
1207
+ labels: B.DISPLAY_TYPES.ON
1208
1208
  },
1209
- labels: H.DISPLAY_TYPES.ON,
1210
- labelposition: H.POSITION.OBJECT
1209
+ labels: B.DISPLAY_TYPES.ON,
1210
+ labelposition: B.POSITION.OBJECT
1211
1211
  },
1212
1212
  POINT: {
1213
1213
  active: 2,
1214
1214
  size: 0.05,
1215
1215
  color: "#000",
1216
- shape: K.SHAPES.CIRCLE,
1217
- labels: H.DISPLAY_TYPES.AUTO,
1218
- labelposition: H.POSITION.OBJECT
1216
+ shape: J.SHAPES.CIRCLE,
1217
+ labels: B.DISPLAY_TYPES.AUTO,
1218
+ labelposition: B.POSITION.OBJECT
1219
1219
  },
1220
1220
  MEAN: {
1221
- shape: K.SHAPES.SQUARE,
1222
- labels: H.DISPLAY_TYPES.AUTO
1221
+ shape: J.SHAPES.SQUARE,
1222
+ labels: B.DISPLAY_TYPES.AUTO
1223
1223
  },
1224
1224
  LABEL: {
1225
- highlight: H.HIGHLIGHT.OFF,
1225
+ highlight: B.HIGHLIGHT.OFF,
1226
1226
  position: ["top", "left"],
1227
1227
  container: "#label-container"
1228
1228
  },
@@ -1230,9 +1230,9 @@ let We = ls, Vs = {
1230
1230
  multiplier: 1
1231
1231
  }
1232
1232
  };
1233
- const cs = class cs {
1234
- constructor(t = { ...Vs }) {
1235
- this.__state__ = new xe(), 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 te(), this.scale_x = 1, this.scale_y = 1, this.SIZE_EFFECT = 1, this._mirror_y = !0, this._mirror_x = !1, this._layers = new jt(
1233
+ const _s = class _s {
1234
+ constructor(t = { ...Ks }) {
1235
+ this.__state__ = new we(), 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 ee(), this.scale_x = 1, this.scale_y = 1, this.SIZE_EFFECT = 1, this._mirror_y = !0, this._mirror_x = !1, this._layers = new Yt(
1236
1236
  { name: "graph", tabindex: 0, layers: [
1237
1237
  {
1238
1238
  name: "axes",
@@ -1271,7 +1271,7 @@ const cs = class cs {
1271
1271
  { name: "points", layers: [], tabindex: 0 },
1272
1272
  { name: "labels", layers: [], tabindex: 0 }
1273
1273
  ] }
1274
- ), this.options = t, this.origin = new We(
1274
+ ), this.options = t, this.origin = new Ve(
1275
1275
  new $t(0, 0),
1276
1276
  {
1277
1277
  ID: "origin",
@@ -1287,28 +1287,28 @@ const cs = class cs {
1287
1287
  );
1288
1288
  let e = 1;
1289
1289
  function s(r, a, h) {
1290
- const o = new Xe(`${e}`, r, h);
1291
- return e += 1, o.parent = a || void 0, r.layers && Array.isArray(r.layers) && (o.layers = new jt(...r.layers.map((l) => s(l, o, h)))), o;
1290
+ const o = new We(`${e}`, r, h);
1291
+ return e += 1, o.parent = a || void 0, r.layers && Array.isArray(r.layers) && (o.layers = new Yt(...r.layers.map((l) => s(l, o, h)))), o;
1292
1292
  }
1293
- u(s, "buildLayerTree"), this.layers = new jt(...this._layers.map((r) => s(r, null, this)));
1293
+ u(s, "buildLayerTree"), this.layers = new Yt(...this._layers.map((r) => s(r, null, this)));
1294
1294
  let i = this.layers.search("layers", "axis_points");
1295
1295
  i && i.objects.set(this.origin.ID, this.origin);
1296
1296
  let n = this.layers.search("layers", "axis_lines");
1297
1297
  if (n) {
1298
- let r = this.extremes || new Ot(1, 1), a = new Bt(
1298
+ let r = this.extremes || new Pt(1, 1), a = new Ht(
1299
1299
  {},
1300
- new K({ ID: "axis-x-start", dimensions: [-r.x_max, 0], classes: ["ena.dimension", "ena.dimension"] }),
1301
- new K({ ID: "axis-x-end", dimensions: [r.x_max, 0], classes: ["ena.dimension", "ena.dimension"] })
1300
+ new J({ ID: "axis-x-start", dimensions: [-r.x_max, 0], classes: ["ena.dimension", "ena.dimension"] }),
1301
+ new J({ ID: "axis-x-end", dimensions: [r.x_max, 0], classes: ["ena.dimension", "ena.dimension"] })
1302
1302
  );
1303
1303
  a.ID = "axis-x", n.objects.set(a.ID, a);
1304
- let h = new Bt(
1304
+ let h = new Ht(
1305
1305
  {},
1306
- new K({ ID: "axis-y-start", dimensions: [0, -r.y_max], classes: ["ena.dimension", "ena.dimension"] }),
1307
- new K({ ID: "axis-y-end", dimensions: [0, r.y_max], classes: ["ena.dimension", "ena.dimension"] })
1306
+ new J({ ID: "axis-y-start", dimensions: [0, -r.y_max], classes: ["ena.dimension", "ena.dimension"] }),
1307
+ new J({ ID: "axis-y-end", dimensions: [0, r.y_max], classes: ["ena.dimension", "ena.dimension"] })
1308
1308
  );
1309
1309
  h.ID = "axis-y", n.objects.set(h.ID, h), console.log("Added axis lines to layer: ", n);
1310
1310
  }
1311
- this.extremes = new Ot(t.GRAPH.x_max, t.GRAPH.y_max);
1311
+ this.extremes = new Pt(t.GRAPH.x_max, t.GRAPH.y_max);
1312
1312
  }
1313
1313
  set extremes(t) {
1314
1314
  this._extremes = t;
@@ -1335,7 +1335,7 @@ const cs = class cs {
1335
1335
  return this.mirror_y ? -1 : 1;
1336
1336
  }
1337
1337
  add_point(t) {
1338
- const e = new K(t);
1338
+ const e = new J(t);
1339
1339
  this.points.set(e.ID, e);
1340
1340
  }
1341
1341
  add_points(t) {
@@ -1347,7 +1347,7 @@ const cs = class cs {
1347
1347
  add_nodes(t) {
1348
1348
  let e = this;
1349
1349
  t.forEach((s) => {
1350
- s.label = new H(s.ID, s), e.labels.set(s.label.ID, s.label), e.nodes.set(s.ID, s);
1350
+ s.label = new B(s.ID, s), e.labels.set(s.label.ID, s.label), e.nodes.set(s.ID, s);
1351
1351
  const i = e.layers.search("layers", "nodes");
1352
1352
  i && i.objects.push(s);
1353
1353
  }), e.update_extremes();
@@ -1372,14 +1372,14 @@ const cs = class cs {
1372
1372
  this.layers.search("layers", "nodes")
1373
1373
  ].filter((s) => s !== void 0);
1374
1374
  if (e.length === 0)
1375
- this.extremes = new Ot(1, 1);
1375
+ this.extremes = new Pt(1, 1);
1376
1376
  else {
1377
1377
  let s = 1 / 0, i = -1 / 0, n = 1 / 0, r = -1 / 0;
1378
1378
  e.forEach((g) => g.objects.forEach((c) => {
1379
1379
  Number.isFinite(c.x) && (s = Math.min(s, c.x), i = Math.max(i, c.x)), Number.isFinite(c.y) && (n = Math.min(n, c.y), r = Math.max(r, c.y));
1380
1380
  }));
1381
1381
  const a = Number.isFinite(s) && Number.isFinite(n), h = t && a ? (s + i) / 2 : 0, o = t && a ? (n + r) / 2 : 0, l = a ? Math.max(Math.abs(s - h), Math.abs(i - h), Math.abs(n - o), Math.abs(r - o)) : 0, _ = (l > 0 ? l : 1) * 1.3;
1382
- this.extremes = new Ot(_, _, h, o);
1382
+ this.extremes = new Pt(_, _, h, o);
1383
1383
  }
1384
1384
  }
1385
1385
  /** Farthest node from (cx, cy), on either axis */
@@ -1395,9 +1395,9 @@ const cs = class cs {
1395
1395
  return Math.min(1, e / (Math.sqrt(s) * t));
1396
1396
  }
1397
1397
  };
1398
- u(cs, "Graph");
1399
- let Ve = cs;
1400
- const Le = class Le extends HTMLElement {
1398
+ u(_s, "Graph");
1399
+ let Ke = _s;
1400
+ const De = class De extends HTMLElement {
1401
1401
  constructor() {
1402
1402
  super(), this.element = null, this.object = null;
1403
1403
  const t = this, e = t.attachShadow({ mode: "open" }), s = document.createElement("style"), i = document.createElement("div");
@@ -1408,7 +1408,7 @@ const Le = class Le extends HTMLElement {
1408
1408
  return e == null ? void 0 : e.querySelector(".wrapper");
1409
1409
  }
1410
1410
  };
1411
- u(Le, "DrawableElement"), Le.style = `
1411
+ u(De, "DrawableElement"), De.style = `
1412
1412
  :host {
1413
1413
  max-width: 100%;
1414
1414
  display: block;
@@ -1419,21 +1419,21 @@ u(Le, "DrawableElement"), Le.style = `
1419
1419
  justify-content: center;
1420
1420
  }
1421
1421
  `;
1422
- let we = Le;
1423
- const ai = 1e-8;
1424
- function qs(d, t = ai) {
1422
+ let Ae = De;
1423
+ const hi = 1e-8;
1424
+ function Us(d, t = hi) {
1425
1425
  return d.filter((e) => Math.abs(e.x) > t || Math.abs(e.y) > t);
1426
1426
  }
1427
- u(qs, "nearOriginFilter");
1428
- function Ks(d) {
1427
+ u(Us, "nearOriginFilter");
1428
+ function Js(d) {
1429
1429
  if (d <= 0) return [];
1430
1430
  if (d === 1) return [0];
1431
1431
  const t = new Array(d);
1432
1432
  for (let e = 0; e < d; e++) t[e] = e / (d - 1);
1433
1433
  return t;
1434
1434
  }
1435
- u(Ks, "normalizedT");
1436
- function Js(d, t) {
1435
+ u(Js, "normalizedT");
1436
+ function Zs(d, t) {
1437
1437
  return d.map((e) => {
1438
1438
  const s = new Array(t + 1);
1439
1439
  let i = 1;
@@ -1442,8 +1442,8 @@ function Js(d, t) {
1442
1442
  return s;
1443
1443
  });
1444
1444
  }
1445
- u(Js, "design");
1446
- function Zs(d) {
1445
+ u(Zs, "design");
1446
+ function Qs(d) {
1447
1447
  const t = d.length, e = d[0].length, s = d.map((n) => n.slice()), i = Array.from({ length: e }, () => new Array(e).fill(0));
1448
1448
  for (let n = 0; n < e; n++) {
1449
1449
  let r = 0;
@@ -1459,8 +1459,8 @@ function Zs(d) {
1459
1459
  }
1460
1460
  return { Q: s, R: i };
1461
1461
  }
1462
- u(Zs, "qr");
1463
- function Ke(d, t) {
1462
+ u(Qs, "qr");
1463
+ function Je(d, t) {
1464
1464
  const e = d.length, s = d[0].length, i = new Array(s).fill(0);
1465
1465
  for (let n = 0; n < s; n++) {
1466
1466
  let r = 0;
@@ -1469,8 +1469,8 @@ function Ke(d, t) {
1469
1469
  }
1470
1470
  return i;
1471
1471
  }
1472
- u(Ke, "qtY");
1473
- function Je(d, t) {
1472
+ u(Je, "qtY");
1473
+ function Ze(d, t) {
1474
1474
  const e = t.length, s = new Array(e).fill(0);
1475
1475
  for (let i = e - 1; i >= 0; i--) {
1476
1476
  let n = t[i];
@@ -1479,71 +1479,71 @@ function Je(d, t) {
1479
1479
  }
1480
1480
  return s;
1481
1481
  }
1482
- u(Je, "backSolve");
1483
- function hi(d) {
1482
+ u(Ze, "backSolve");
1483
+ function li(d) {
1484
1484
  return d.map((t) => {
1485
1485
  let e = 0;
1486
1486
  for (let s = 0; s < t.length; s++) e += t[s] * t[s];
1487
1487
  return e;
1488
1488
  });
1489
1489
  }
1490
- u(hi, "leverages");
1491
- function Us(d, t, e) {
1492
- const s = Js(d, e), { Q: i, R: n } = Zs(s);
1493
- return Je(n, Ke(i, t));
1490
+ u(li, "leverages");
1491
+ function Gs(d, t, e) {
1492
+ const s = Zs(d, e), { Q: i, R: n } = Qs(s);
1493
+ return Ze(n, Je(i, t));
1494
1494
  }
1495
- u(Us, "fitCoeffs");
1496
- function Ae(d, t) {
1495
+ u(Gs, "fitCoeffs");
1496
+ function ve(d, t) {
1497
1497
  let e = 0, s = 1;
1498
1498
  for (let i = 0; i < d.length; i++)
1499
1499
  e += d[i] * s, s *= t;
1500
1500
  return e;
1501
1501
  }
1502
- u(Ae, "evalPoly");
1503
- function li(d, t, e, s) {
1504
- const i = Js(d, s), { Q: n, R: r } = Zs(i), a = hi(n), h = Je(r, Ke(n, t)), o = Je(r, Ke(n, e));
1502
+ u(ve, "evalPoly");
1503
+ function ci(d, t, e, s) {
1504
+ const i = Zs(d, s), { Q: n, R: r } = Qs(i), a = li(n), h = Ze(r, Je(n, t)), o = Ze(r, Je(n, e));
1505
1505
  let l = 0;
1506
1506
  for (let _ = 0; _ < d.length; _++) {
1507
1507
  const g = 1 - a[_];
1508
1508
  if (g <= 0) return 1 / 0;
1509
- const c = t[_] - Ae(h, d[_]), S = e[_] - Ae(o, d[_]);
1510
- l += (c / g) ** 2 + (S / g) ** 2;
1509
+ const c = t[_] - ve(h, d[_]), E = e[_] - ve(o, d[_]);
1510
+ l += (c / g) ** 2 + (E / g) ** 2;
1511
1511
  }
1512
1512
  return l;
1513
1513
  }
1514
- u(li, "loocv2d");
1515
- function ci(d, t, e) {
1514
+ u(ci, "loocv2d");
1515
+ function _i(d, t, e) {
1516
1516
  const s = d.length, i = Math.min(Math.max(1, Math.floor(t)), Math.max(1, s - 1));
1517
1517
  if (e === "fixed" || s < 3) return i;
1518
- const n = Ks(s), r = d.map((l) => l.x), a = d.map((l) => l.y);
1518
+ const n = Js(s), r = d.map((l) => l.x), a = d.map((l) => l.y);
1519
1519
  let h = 1, o = 1 / 0;
1520
1520
  for (let l = 1; l <= i; l++) {
1521
- const _ = li(n, r, a, l);
1521
+ const _ = ci(n, r, a, l);
1522
1522
  _ < o && (o = _, h = l);
1523
1523
  }
1524
1524
  return h;
1525
1525
  }
1526
- u(ci, "selectDegree");
1527
- function _i(d, t) {
1528
- const e = qs(d);
1526
+ u(_i, "selectDegree");
1527
+ function ui(d, t) {
1528
+ const e = Us(d);
1529
1529
  if (e.length < 3) return null;
1530
- const s = t.selectionSet ? qs(t.selectionSet) : e, i = s.length >= 3 ? s : e;
1531
- let n = ci(i, t.maxDegree, t.degreeSelection);
1530
+ const s = t.selectionSet ? Us(t.selectionSet) : e, i = s.length >= 3 ? s : e;
1531
+ let n = _i(i, t.maxDegree, t.degreeSelection);
1532
1532
  n = Math.min(n, Math.max(1, e.length - 1));
1533
- const r = Ks(e.length), a = Us(r, e.map((o) => o.x), n), h = Us(r, e.map((o) => o.y), n);
1533
+ const r = Js(e.length), a = Gs(r, e.map((o) => o.x), n), h = Gs(r, e.map((o) => o.y), n);
1534
1534
  return { degree: n, coeffsX: a, coeffsY: h };
1535
1535
  }
1536
- u(_i, "fitTrajectory");
1537
- function Gs(d, t = 100) {
1536
+ u(ui, "fitTrajectory");
1537
+ function Bs(d, t = 100) {
1538
1538
  const e = [];
1539
1539
  for (let s = 0; s <= t; s++) {
1540
1540
  const i = s / t;
1541
- e.push({ x: Ae(d.coeffsX, i), y: Ae(d.coeffsY, i) });
1541
+ e.push({ x: ve(d.coeffsX, i), y: ve(d.coeffsY, i) });
1542
1542
  }
1543
1543
  return e;
1544
1544
  }
1545
- u(Gs, "sampleCurve");
1546
- const Bs = 100, _s = class _s extends Mt {
1545
+ u(Bs, "sampleCurve");
1546
+ const Hs = 100, us = class us extends It {
1547
1547
  constructor(t = {}) {
1548
1548
  const e = t.color instanceof et ? t.color : new et(typeof t.color == "string" ? t.color : "#000000");
1549
1549
  super([], {
@@ -1555,8 +1555,8 @@ const Bs = 100, _s = class _s extends Mt {
1555
1555
  meta: t.meta || {},
1556
1556
  ...t
1557
1557
  }), 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) => {
1558
- if (s instanceof K) return s;
1559
- const i = new K({ dimensions: [s.x, s.y], meta: { time: s.time, label: s.label } });
1558
+ if (s instanceof J) return s;
1559
+ const i = new J({ dimensions: [s.x, s.y], meta: { time: s.time, label: s.label } });
1560
1560
  return i.x = s.x, i.y = s.y, i;
1561
1561
  }));
1562
1562
  }
@@ -1571,11 +1571,11 @@ const Bs = 100, _s = class _s extends Mt {
1571
1571
  if (t.length < 2) return [];
1572
1572
  if (this.smooth === "poly") {
1573
1573
  if (this.polyCoeffsX.length > 0 && this.polyCoeffsY.length > 0)
1574
- return Gs(
1574
+ return Bs(
1575
1575
  { degree: this.polyCoeffsX.length - 1, coeffsX: this.polyCoeffsX, coeffsY: this.polyCoeffsY },
1576
- Bs
1576
+ Hs
1577
1577
  );
1578
- const e = _i(
1578
+ const e = ui(
1579
1579
  t.map((s) => ({ x: s.x, y: s.y })),
1580
1580
  {
1581
1581
  maxDegree: this.maxDegree,
@@ -1584,14 +1584,14 @@ const Bs = 100, _s = class _s extends Mt {
1584
1584
  }
1585
1585
  );
1586
1586
  if (e)
1587
- return this.selectedDegree = e.degree, Gs(e, Bs);
1587
+ return this.selectedDegree = e.degree, Bs(e, Hs);
1588
1588
  }
1589
1589
  return t.map((e) => ({ x: e.x, y: e.y }));
1590
1590
  }
1591
1591
  };
1592
- u(_s, "Trajectory");
1593
- let ve = _s;
1594
- const Qs = 1, us = class us extends Bt {
1592
+ u(us, "Trajectory");
1593
+ let Se = us;
1594
+ const ti = 1, ds = class ds extends Ht {
1595
1595
  constructor(t, e, s, i = 0) {
1596
1596
  super(t, e, s), this._totalweight = 0, this._weight = i;
1597
1597
  }
@@ -1600,7 +1600,7 @@ const Qs = 1, us = class us extends Bt {
1600
1600
  }
1601
1601
  get color() {
1602
1602
  const t = this._color || new et("#000000");
1603
- return new ye(t, Math.abs(this.weight));
1603
+ return new xe(t, Math.abs(this.weight));
1604
1604
  }
1605
1605
  set color(t) {
1606
1606
  this._color = t;
@@ -1621,90 +1621,90 @@ const Qs = 1, us = class us extends Bt {
1621
1621
  this._totalweight = t;
1622
1622
  }
1623
1623
  };
1624
- u(us, "Edge");
1625
- let Se = us;
1626
- var qt;
1627
- const ds = class ds extends Mt {
1624
+ u(ds, "Edge");
1625
+ let Ee = ds;
1626
+ var Ut;
1627
+ const gs = class gs extends It {
1628
1628
  constructor(e) {
1629
1629
  super(e.dimensions || [], e);
1630
- tt(this, qt);
1631
- B(this, qt, e);
1630
+ tt(this, Ut);
1631
+ G(this, Ut, e);
1632
1632
  }
1633
1633
  get edge() {
1634
- return k(this, qt);
1634
+ return k(this, Ut);
1635
1635
  }
1636
1636
  get path() {
1637
- const e = k(this, qt), 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]);
1637
+ const e = k(this, Ut), s = [e.to.x, e.to.y], i = e.from_point, [n, r] = e.base_pts, a = Math.hypot(i[0] - s[0], i[1] - s[1]), h = Math.hypot(n[0] - r[0], n[1] - r[1]);
1638
1638
  if (!(a > 0) || !(h > 0)) return "";
1639
- const o = [(i[0] - s[0]) / a, (i[1] - s[1]) / a], l = Math.hypot(n[0] - s[0], n[1] - s[1]), _ = [(n[0] - s[0]) / l, (n[1] - s[1]) / l], g = /* @__PURE__ */ u((q) => h / 2 * Math.max(0, 1 - q / a), "halfW"), c = /* @__PURE__ */ u((q, v) => `${s[0] + o[0] * q + _[0] * v} ${s[1] + o[1] * q + _[1] * v}`, "at"), S = 0.2 * a, p = Math.min(0.15 * a, 0.8 * 2 * g(S)), A = S + p / 2, P = S + p;
1640
- return `M${c(S, 0)} L${c(A, g(A))} L${c(P, g(P))} L${c(A, 0)} L${c(P, -g(P))} L${c(A, -g(A))}z`;
1639
+ const o = [(i[0] - s[0]) / a, (i[1] - s[1]) / a], l = Math.hypot(n[0] - s[0], n[1] - s[1]), _ = [(n[0] - s[0]) / l, (n[1] - s[1]) / l], g = /* @__PURE__ */ u((q) => h / 2 * Math.max(0, 1 - q / a), "halfW"), c = /* @__PURE__ */ u((q, S) => `${s[0] + o[0] * q + _[0] * S} ${s[1] + o[1] * q + _[1] * S}`, "at"), E = 0.2 * a, f = Math.min(0.15 * a, 0.8 * 2 * g(E)), v = E + f / 2, P = E + f;
1640
+ return `M${c(E, 0)} L${c(v, g(v))} L${c(P, g(P))} L${c(v, 0)} L${c(P, -g(P))} L${c(v, -g(v))}z`;
1641
1641
  }
1642
1642
  };
1643
- qt = new WeakMap(), u(ds, "EdgeArrow");
1644
- let Ee = ds;
1645
- var Ut, _e;
1646
- const De = class De extends Se {
1643
+ Ut = new WeakMap(), u(gs, "EdgeArrow");
1644
+ let Me = gs;
1645
+ var Gt, ue;
1646
+ const Te = class Te extends Ee {
1647
1647
  constructor(e, s, i) {
1648
1648
  super(e, s, i);
1649
- tt(this, Ut);
1650
- tt(this, _e);
1651
- this._path = "", B(this, Ut, !1), this._directions = [
1649
+ tt(this, Gt);
1650
+ tt(this, ue);
1651
+ this._path = "", G(this, Gt, !1), this._directions = [
1652
1652
  "from",
1653
1653
  "to"
1654
1654
  /* TO */
1655
- ], this.towards = "to", k(this, Ut) === !0 && B(this, _e, new Ee(this));
1655
+ ], this.towards = "to", k(this, Gt) === !0 && G(this, ue, new Me(this));
1656
1656
  }
1657
1657
  get path() {
1658
1658
  return `M${this.from.x} ${this.from.y} L${this.base_pts[0].join(" ")} L${this.base_pts[1].join(" ")}z`;
1659
1659
  }
1660
1660
  static calculate_base_points(e) {
1661
- 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, _ = Math.hypot(o, l), g = (e.weight ?? 0) * Qs;
1661
+ const s = e.towards, i = e._directions.find((v) => v !== e.towards), n = e[i].x, r = e[i].y, a = e[s].x, h = e[s].y, o = a - n, l = h - r, _ = Math.hypot(o, l), g = (e.weight ?? 0) * ti;
1662
1662
  if (_ === 0 || !isFinite(g) || g === 0)
1663
1663
  return [[a, h], [a, h]];
1664
- const c = -l / _, S = o / _, p = g / 2;
1664
+ const c = -l / _, E = o / _, f = g / 2;
1665
1665
  return [
1666
- [a + c * p, h + S * p],
1667
- [a - c * p, h - S * p]
1666
+ [a + c * f, h + E * f],
1667
+ [a - c * f, h - E * f]
1668
1668
  ];
1669
1669
  }
1670
1670
  get base_pts() {
1671
- return De.calculate_base_points(this);
1671
+ return Te.calculate_base_points(this);
1672
1672
  }
1673
1673
  get arrow() {
1674
- return k(this, _e);
1674
+ return k(this, ue);
1675
1675
  }
1676
1676
  get with_arrow() {
1677
- return k(this, Ut);
1677
+ return k(this, Gt);
1678
1678
  }
1679
1679
  get from_point() {
1680
1680
  return [this.from.x, this.from.y];
1681
1681
  }
1682
1682
  };
1683
- Ut = new WeakMap(), _e = new WeakMap(), u(De, "TaperedEdge");
1684
- let Ht = De;
1685
- const Te = class Te extends Ht {
1683
+ Gt = new WeakMap(), ue = new WeakMap(), u(Te, "TaperedEdge");
1684
+ let Xt = Te;
1685
+ const ze = class ze extends Xt {
1686
1686
  constructor(t, e, s) {
1687
1687
  super(t, e, s), this._dataWeight = 0, this._totalweight = t.totalweight ?? 0, this._dataWeight = t.weight ?? this._weight;
1688
1688
  }
1689
1689
  get weighted_midpoint() {
1690
- return ee.Geometry.Line.interpolate(this.line)(1 - this._dataWeight / this._totalweight);
1690
+ return se.Geometry.Line.interpolate(this.line)(1 - this._dataWeight / this._totalweight);
1691
1691
  }
1692
1692
  get base_pts() {
1693
- return Ht.calculate_base_points(this);
1693
+ return Xt.calculate_base_points(this);
1694
1694
  }
1695
1695
  static build_path(t) {
1696
1696
  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"), "");
1697
1697
  }
1698
1698
  get path() {
1699
- return Te.build_path(this);
1699
+ return ze.build_path(this);
1700
1700
  }
1701
1701
  get from_point() {
1702
1702
  return this.weighted_midpoint;
1703
1703
  }
1704
1704
  };
1705
- u(Te, "TaperedWeightedMidpointEdge");
1706
- let Ze = Te;
1707
- const ze = class ze extends Se {
1705
+ u(ze, "TaperedWeightedMidpointEdge");
1706
+ let Qe = ze;
1707
+ const Fe = class Fe extends Ee {
1708
1708
  constructor(t, e, s) {
1709
1709
  super(t, e, s);
1710
1710
  }
@@ -1713,14 +1713,14 @@ const ze = class ze extends Se {
1713
1713
  return `M ${i}, ${e.y} a ${s},${s} 0 1,0 ${n},0 a ${s},${s} 0 1,0 -${n},0`;
1714
1714
  }
1715
1715
  get path() {
1716
- let t = this.weight * Qs;
1717
- return ze.build_path(t, this.to);
1716
+ let t = this.weight * ti;
1717
+ return Fe.build_path(t, this.to);
1718
1718
  }
1719
1719
  };
1720
- u(ze, "NodeEdge");
1721
- let se = ze;
1722
- const gs = class gs {
1723
- constructor(t, e, s, i = new It()) {
1720
+ u(Fe, "NodeEdge");
1721
+ let ie = Fe;
1722
+ const ms = class ms {
1723
+ constructor(t, e, s, i = new Nt()) {
1724
1724
  this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.svg_element = this.create();
1725
1725
  }
1726
1726
  get_size() {
@@ -1743,42 +1743,42 @@ const gs = class gs {
1743
1743
  u(a, "animate"), requestAnimationFrame(a);
1744
1744
  }
1745
1745
  };
1746
- u(gs, "Drawable");
1747
- let ie = gs;
1748
- const ui = 0.04, di = [0.25, 1], gi = [0.3, 1];
1749
- function Hs(d, t, e, s) {
1746
+ u(ms, "Drawable");
1747
+ let ne = ms;
1748
+ const di = 0.04, gi = [0.25, 1], mi = [0.3, 1];
1749
+ function Xs(d, t, e, s) {
1750
1750
  const i = Math.abs(d);
1751
1751
  if (!(i > 0)) return 0;
1752
1752
  if (!(e > t)) return s[1];
1753
1753
  const n = Math.min(1, Math.max(0, (i - t) / (e - t)));
1754
1754
  return s[0] + n * (s[1] - s[0]);
1755
1755
  }
1756
- u(Hs, "rampFor");
1757
- const mi = 0.011, fi = 0.75, pi = 0.8, bi = 0.75, ti = 6e-3, yi = 0.6;
1758
- function xi(d) {
1756
+ u(Xs, "rampFor");
1757
+ const fi = 0.011, pi = 0.75, bi = 0.8, yi = 0.75, ei = 6e-3, xi = 0.6;
1758
+ function wi(d) {
1759
1759
  return 2 * d;
1760
1760
  }
1761
- u(xi, "widthPerWeight");
1762
- function wi(d, t) {
1763
- return d * t / (2 * ti);
1761
+ u(wi, "widthPerWeight");
1762
+ function Ai(d, t) {
1763
+ return d * t / (2 * ei);
1764
1764
  }
1765
- u(wi, "nodeSizeForEdges");
1766
- function Ai(d) {
1765
+ u(Ai, "nodeSizeForEdges");
1766
+ function vi(d) {
1767
1767
  const t = /rgba?\(([^)]+)\)/.exec(d);
1768
1768
  if (!t) return d;
1769
1769
  const [e, s, i, n = 1] = t[1].split(",").map(Number), r = /* @__PURE__ */ u((a) => Math.round(255 + (a - 255) * n), "f");
1770
1770
  return `rgb(${r(e)},${r(s)},${r(i)})`;
1771
1771
  }
1772
- u(Ai, "flattenOnWhite");
1773
- function vi(d, t) {
1772
+ u(vi, "flattenOnWhite");
1773
+ function Si(d, t) {
1774
1774
  const e = /rgba?\(([^)]+)\)/.exec(d);
1775
1775
  if (!e) return d;
1776
1776
  const [s, i, n, r = 1] = e[1].split(",").map(Number);
1777
1777
  return `rgba(${Math.round(s * t)},${Math.round(i * t)},${Math.round(n * t)},${r})`;
1778
1778
  }
1779
- u(vi, "darkenRgba");
1780
- const ms = class ms extends ie {
1781
- constructor(t, e, s, i = new It()) {
1779
+ u(Si, "darkenRgba");
1780
+ const fs = class fs extends ne {
1781
+ constructor(t, e, s, i = new Nt()) {
1782
1782
  super(t, e, s, i), this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.__name__ = "unnamed-line", this._arrow_el = null, this._hit_el = null, this.svg_element = this.create();
1783
1783
  }
1784
1784
  /** Stamp edge identity onto an element so <qe-graph> delegation can resolve
@@ -1788,11 +1788,11 @@ const ms = class ms extends ie {
1788
1788
  e.isMeanEdge && (t.setAttribute("data-edge-source", String(e.source ?? "")), t.setAttribute("data-edge-target", String(e.target ?? "")), t.setAttribute("data-edge-weight", String(e.weight ?? 0)), t.setAttribute("data-edge-directed", e.isDirected ? "true" : "false"), e.isSelf && t.setAttribute("data-edge-self", "true"), e.group != null && t.setAttribute("data-edge-group", String(e.group)), e.unit != null && t.setAttribute("data-edge-unit", String(e.unit)));
1789
1789
  }
1790
1790
  create() {
1791
- if (this.__data__ instanceof se) {
1791
+ if (this.__data__ instanceof ie) {
1792
1792
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1793
1793
  return e.setAttribute("fill", this.__data__.color.toString()), e.setAttribute("stroke", "none"), this.svg_element = e, e;
1794
1794
  }
1795
- if (this.__data__ instanceof Ht) {
1795
+ if (this.__data__ instanceof Xt) {
1796
1796
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1797
1797
  return e.setAttribute("fill", this.__data__.color.toString()), e.setAttribute("stroke", "none"), this.svg_element = e, e;
1798
1798
  }
@@ -1805,19 +1805,19 @@ const ms = class ms extends ie {
1805
1805
  const t = ((s = this.graph.__data__.extremes) == null ? void 0 : s.x_max) ?? 1, e = this.__data__.meta ?? {};
1806
1806
  if (e.isMeanEdge) {
1807
1807
  this._stampEdge(this.svg_element);
1808
- const i = typeof e.weight == "number" ? e.weight : 0, n = typeof e.maxWeight == "number" ? e.maxWeight : 1, r = typeof e.opacity == "number" ? e.opacity : Math.min(1, i / (n || 1)), a = t > 0 ? t : 1, h = typeof e.widthFrac == "number" ? a * e.widthFrac * i : a * mi * (i / (n || 1)), o = this.__data__._color || new et("#000000"), l = typeof e.saturation == "number" ? e.saturation : r, _ = new ye(o, l, r).toString();
1809
- if (this.__data__ instanceof se)
1808
+ const i = typeof e.weight == "number" ? e.weight : 0, n = typeof e.maxWeight == "number" ? e.maxWeight : 1, r = typeof e.opacity == "number" ? e.opacity : Math.min(1, i / (n || 1)), a = t > 0 ? t : 1, h = typeof e.widthFrac == "number" ? a * e.widthFrac * i : a * fi * (i / (n || 1)), o = this.__data__._color || new et("#000000"), l = typeof e.saturation == "number" ? e.saturation : r, _ = new xe(o, l, r).toString();
1809
+ if (this.__data__ instanceof ie)
1810
1810
  this.__data__.weight = h, this.svg_element.setAttribute("d", this.__data__.path), this.svg_element.setAttribute("fill", _), this.svg_element.setAttribute("stroke", "none");
1811
- else if (this.__data__ instanceof Ht) {
1812
- if (this.__data__.weight = h, this.svg_element.setAttribute("d", this.__data__.path), this.svg_element.setAttribute("fill", _), this.svg_element.setAttribute("stroke", _), this.svg_element.setAttribute("stroke-width", String(fi)), this.svg_element.setAttribute("vector-effect", "non-scaling-stroke"), this.svg_element.setAttribute("stroke-linejoin", "round"), e.isDirected)
1811
+ else if (this.__data__ instanceof Xt) {
1812
+ if (this.__data__.weight = h, this.svg_element.setAttribute("d", this.__data__.path), this.svg_element.setAttribute("fill", _), this.svg_element.setAttribute("stroke", _), this.svg_element.setAttribute("stroke-width", String(pi)), this.svg_element.setAttribute("vector-effect", "non-scaling-stroke"), this.svg_element.setAttribute("stroke-linejoin", "round"), e.isDirected)
1813
1813
  try {
1814
- const c = new Ee(this.__data__).path;
1815
- c && !c.includes("NaN") && !c.includes("Infinity") && (this._arrow_el || (this._arrow_el = document.createElementNS("http://www.w3.org/2000/svg", "path"), this._arrow_el.setAttribute("stroke", "none")), this._arrow_el.parentElement || this.parent.appendChild(this._arrow_el), this._arrow_el.setAttribute("d", c), this._arrow_el.setAttribute("fill", vi(Ai(_), pi)), this._arrow_el.setAttribute("stroke", "#ffffff"), this._arrow_el.setAttribute("stroke-width", String(bi)), this._arrow_el.setAttribute("vector-effect", "non-scaling-stroke"), this._arrow_el.setAttribute("stroke-linejoin", "round"));
1814
+ const c = new Me(this.__data__).path;
1815
+ c && !c.includes("NaN") && !c.includes("Infinity") && (this._arrow_el || (this._arrow_el = document.createElementNS("http://www.w3.org/2000/svg", "path"), this._arrow_el.setAttribute("stroke", "none")), this._arrow_el.parentElement || this.parent.appendChild(this._arrow_el), this._arrow_el.setAttribute("d", c), this._arrow_el.setAttribute("fill", Si(vi(_), bi)), this._arrow_el.setAttribute("stroke", "#ffffff"), this._arrow_el.setAttribute("stroke-width", String(yi)), this._arrow_el.setAttribute("vector-effect", "non-scaling-stroke"), this._arrow_el.setAttribute("stroke-linejoin", "round"));
1816
1816
  } catch {
1817
1817
  }
1818
1818
  } else {
1819
- const g = this.__data__.from.x, c = this.__data__.from.y, S = this.__data__.to.x, p = this.__data__.to.y;
1820
- this.svg_element.setAttribute("x1", g.toString()), this.svg_element.setAttribute("y1", c.toString()), this.svg_element.setAttribute("x2", S.toString()), this.svg_element.setAttribute("y2", p.toString()), this.svg_element.setAttribute("stroke-width", h.toString()), this.svg_element.setAttribute("stroke", _), 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", S.toString()), this._hit_el.setAttribute("y2", p.toString()), this._hit_el.setAttribute("stroke-width", Math.max(h, t * 0.03).toString()), this._stampEdge(this._hit_el);
1819
+ const g = this.__data__.from.x, c = this.__data__.from.y, E = this.__data__.to.x, f = this.__data__.to.y;
1820
+ this.svg_element.setAttribute("x1", g.toString()), this.svg_element.setAttribute("y1", c.toString()), this.svg_element.setAttribute("x2", E.toString()), this.svg_element.setAttribute("y2", f.toString()), this.svg_element.setAttribute("stroke-width", h.toString()), this.svg_element.setAttribute("stroke", _), 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", E.toString()), this._hit_el.setAttribute("y2", f.toString()), this._hit_el.setAttribute("stroke-width", Math.max(h, t * 0.03).toString()), this._stampEdge(this._hit_el);
1821
1821
  }
1822
1822
  } else {
1823
1823
  this.svg_element.setAttribute("x1", this.__data__.from.x.toString()), this.svg_element.setAttribute("y1", this.__data__.from.y.toString()), this.svg_element.setAttribute("x2", this.__data__.to.x.toString()), this.svg_element.setAttribute("y2", this.__data__.to.y.toString());
@@ -1830,10 +1830,10 @@ const ms = class ms extends ie {
1830
1830
  this._hit_el && ((t = this.parent) == null || t.appendChild(this._hit_el)), (e = this.parent) == null || e.appendChild(this.svg_element), this._arrow_el && ((s = this.parent) == null || s.appendChild(this._arrow_el));
1831
1831
  }
1832
1832
  };
1833
- u(ms, "QELine");
1834
- let wt = ms;
1835
- const fs = class fs extends ie {
1836
- constructor(t, e, s, i = new It()) {
1833
+ u(fs, "QELine");
1834
+ let At = fs;
1835
+ const ps = class ps extends ne {
1836
+ constructor(t, e, s, i = new Nt()) {
1837
1837
  super(t, e, s, i), this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.__name__ = "unnamed-point", this.svg_element = this.create();
1838
1838
  }
1839
1839
  get x() {
@@ -1890,7 +1890,7 @@ const fs = class fs extends ie {
1890
1890
  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;
1891
1891
  return this.__data__.size * 2 * e / o / h;
1892
1892
  }
1893
- return t * ti * this.__data__.size * e;
1893
+ return t * ei * this.__data__.size * e;
1894
1894
  }
1895
1895
  /** Optional halo stroke (e.g. white outline on unit points to separate
1896
1896
  * overlapping dots in dense clusters). Width scales with the dot so it holds
@@ -1923,10 +1923,10 @@ const fs = class fs extends ie {
1923
1923
  (t = this.parent) == null || t.appendChild(this.svg_element);
1924
1924
  }
1925
1925
  };
1926
- u(fs, "QEPoint");
1927
- let ne = fs;
1928
- const ps = class ps extends ie {
1929
- constructor(t, e, s, i = new It()) {
1926
+ u(ps, "QEPoint");
1927
+ let re = ps;
1928
+ const bs = class bs extends ne {
1929
+ constructor(t, e, s, i = new Nt()) {
1930
1930
  super(t, e, s, i), this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.__name__ = "trajectory", this._path_el = null, this._segments_group = null, this._tip_el = null, this._points_group = null, this.svg_element = this.create();
1931
1931
  }
1932
1932
  // Trajectory styling is specified in display pixels, while SVG paths use
@@ -1957,8 +1957,8 @@ const ps = class ps extends ie {
1957
1957
  if (this._segments_group.innerHTML = "", this.__data__.lineStyle === "tapered") {
1958
1958
  const s = this.__data__.pathPoints, i = s.length - 1, [n, r] = this.__data__.strokeWidthRange, [a, h] = this.__data__.opacityRange;
1959
1959
  for (let o = 0; o < i; o++) {
1960
- const l = s[o], _ = s[o + 1], g = i <= 1 ? 1 : o / (i - 1), c = n + (r - n) * g, S = a + (h - a) * g, p = document.createElementNS("http://www.w3.org/2000/svg", "path");
1961
- p.setAttribute("d", `M${l.x},${l.y} L${_.x},${_.y}`), p.setAttribute("fill", "none"), p.setAttribute("stroke", this.__data__.color.toString()), p.setAttribute("stroke-linecap", "round"), p.setAttribute("stroke-linejoin", "round"), p.setAttribute("stroke-width", this.graphUnitsForPixels(c).toString()), p.setAttribute("opacity", S.toString()), this._segments_group.appendChild(p);
1960
+ const l = s[o], _ = s[o + 1], g = i <= 1 ? 1 : o / (i - 1), c = n + (r - n) * g, E = a + (h - a) * g, f = document.createElementNS("http://www.w3.org/2000/svg", "path");
1961
+ f.setAttribute("d", `M${l.x},${l.y} L${_.x},${_.y}`), f.setAttribute("fill", "none"), f.setAttribute("stroke", this.__data__.color.toString()), f.setAttribute("stroke-linecap", "round"), f.setAttribute("stroke-linejoin", "round"), f.setAttribute("stroke-width", this.graphUnitsForPixels(c).toString()), f.setAttribute("opacity", E.toString()), this._segments_group.appendChild(f);
1962
1962
  }
1963
1963
  this._segments_group.style.display = "block";
1964
1964
  } else
@@ -1979,9 +1979,9 @@ const ps = class ps extends ie {
1979
1979
  this.svg_element && !this.svg_element.parentElement && this.parent.appendChild(this.svg_element), this.update();
1980
1980
  }
1981
1981
  };
1982
- u(ps, "QETrajectory");
1983
- let Me = ps;
1984
- const { ArrayTools: Xs } = ee, bs = class bs extends Array {
1982
+ u(bs, "QETrajectory");
1983
+ let Ie = bs;
1984
+ const { ArrayTools: Ws } = se, ys = class ys extends Array {
1985
1985
  constructor(...t) {
1986
1986
  super(...t);
1987
1987
  }
@@ -1992,14 +1992,14 @@ const { ArrayTools: Xs } = ee, bs = class bs extends Array {
1992
1992
  }
1993
1993
  u(i, "fn");
1994
1994
  function n(r, a, h = null) {
1995
- if (Xs.isArray(r)) {
1995
+ if (Ws.isArray(r)) {
1996
1996
  for (const [o, l] of r.entries())
1997
1997
  if (s = n(l, o, h), s)
1998
1998
  return s;
1999
1999
  } else {
2000
2000
  if (s = i(r), s)
2001
2001
  return s;
2002
- if (r && Xs.isArray(r[t])) {
2002
+ if (r && Ws.isArray(r[t])) {
2003
2003
  for (const [o, l] of r[t].entries())
2004
2004
  if (s = n(l, o, r), s)
2005
2005
  return s;
@@ -2013,20 +2013,20 @@ const { ArrayTools: Xs } = ee, bs = class bs extends Array {
2013
2013
  return this.reduce((t, e) => (t.push(e), e.layers && Array.isArray(e.layers) && t.push(...e.layers), t), []);
2014
2014
  }
2015
2015
  };
2016
- u(bs, "QEArray");
2017
- let It = bs;
2018
- const Si = {
2019
- AxisPoint: ne,
2020
- AxisLine: wt,
2021
- Point: ne,
2022
- Line: wt,
2023
- Edge: wt,
2024
- TaperedEdge: wt,
2025
- TaperedWeightedMidpointEdge: wt,
2026
- NodeEdge: wt,
2027
- Trajectory: Me
2028
- }, zt = class zt {
2029
- constructor(t, e, s, i = new It()) {
2016
+ u(ys, "QEArray");
2017
+ let Nt = ys;
2018
+ const Ei = {
2019
+ AxisPoint: re,
2020
+ AxisLine: At,
2021
+ Point: re,
2022
+ Line: At,
2023
+ Edge: At,
2024
+ TaperedEdge: At,
2025
+ TaperedWeightedMidpointEdge: At,
2026
+ NodeEdge: At,
2027
+ Trajectory: Ie
2028
+ }, Ft = class Ft {
2029
+ constructor(t, e, s, i = new Nt()) {
2030
2030
  this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.__name__ = t.name || "unnamed-layer", t.__state__.addListener("layer_updated", "live", ({ key: n, newValue: r, oldValue: a }) => {
2031
2031
  const h = /* @__PURE__ */ u((g) => {
2032
2032
  var c;
@@ -2040,10 +2040,10 @@ const Si = {
2040
2040
  (g) => !this.__children__.some((c) => h(c) === g.ID)
2041
2041
  ).forEach((g) => {
2042
2042
  const c = g._typeName || g.constructor.name;
2043
- let S = Si[c];
2044
- S || (g instanceof ve ? S = Me : g instanceof K ? S = ne : S = wt);
2045
- const p = new S(g, this.svg_element, this.graph);
2046
- this.__children__.push(p);
2043
+ let E = Ei[c];
2044
+ E || (g instanceof Se ? E = Ie : g instanceof J ? E = re : E = At);
2045
+ const f = new E(g, this.svg_element, this.graph);
2046
+ this.__children__.push(f);
2047
2047
  }), l.forEach((g) => {
2048
2048
  const c = r.objects.get(h(g));
2049
2049
  c && (g.__data__ = c), g.update();
@@ -2061,8 +2061,8 @@ const Si = {
2061
2061
  if (!this.__data__)
2062
2062
  throw new Error("Layer is null");
2063
2063
  let t = this.__data__;
2064
- return this.svg_element = document.createElementNS("http://www.w3.org/2000/svg", zt.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) => {
2065
- const s = new zt(e, this.svg_element, this.graph);
2064
+ return this.svg_element = document.createElementNS("http://www.w3.org/2000/svg", Ft.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) => {
2065
+ const s = new Ft(e, this.svg_element, this.graph);
2066
2066
  this.__children__.push(s);
2067
2067
  }), this.svg_element;
2068
2068
  }
@@ -2083,11 +2083,11 @@ const Si = {
2083
2083
  this.__children__.push(t);
2084
2084
  }
2085
2085
  };
2086
- u(zt, "QELayer"), zt.tagName = "g";
2087
- let Qe = zt;
2088
- const ys = class ys {
2089
- constructor(t, e, s, i, n = H.DISPLAY_TYPES.ON, r = H.POSITION.OBJECT, a, h) {
2090
- this.text = t, this.point = e, this.parent = s, this.graph = i, this.displayMode = n, this.position = r, this.customX = a, this.customY = h, this._visible = !1, this._offsetX = 0, this._offsetY = 0, this.pinned = !1, this.svg_element = this._create(), n === H.DISPLAY_TYPES.ON ? (this._visible = !0, this.svg_element.setAttribute("display", "block")) : (this._visible = !1, this.svg_element.setAttribute("display", "none"));
2086
+ u(Ft, "QELayer"), Ft.tagName = "g";
2087
+ let ts = Ft;
2088
+ const xs = class xs {
2089
+ constructor(t, e, s, i, n = B.DISPLAY_TYPES.ON, r = B.POSITION.OBJECT, a, h) {
2090
+ this.text = t, this.point = e, this.parent = s, this.graph = i, this.displayMode = n, this.position = r, this.customX = a, this.customY = h, this._visible = !1, this._offsetX = 0, this._offsetY = 0, this.pinned = !1, this.svg_element = this._create(), n === B.DISPLAY_TYPES.ON ? (this._visible = !0, this.svg_element.setAttribute("display", "block")) : (this._visible = !1, this.svg_element.setAttribute("display", "none"));
2091
2091
  }
2092
2092
  _create() {
2093
2093
  const t = document.createElementNS("http://www.w3.org/2000/svg", "text");
@@ -2131,22 +2131,22 @@ const ys = class ys {
2131
2131
  const e = this.graph._labelFont ?? {}, s = e.size ? e.size * this.graph.unitsPerPixel() : t * 0.06, i = s * 1.2;
2132
2132
  let n, r, a;
2133
2133
  switch (this.position) {
2134
- case H.POSITION.STATIC: {
2134
+ case B.POSITION.STATIC: {
2135
2135
  n = this.point.x, r = this.point.y - i * 0.3, a = "middle";
2136
2136
  break;
2137
2137
  }
2138
- case H.POSITION.CONTAINER: {
2139
- const { cx: o, cy: l } = this.graph.__data__.extremes, _ = this.point.x - o, g = this.point.y - l, c = Math.sqrt(_ * _ + g * g) || 1, S = t * 0.93 / c;
2140
- n = o + _ * S, r = l + g * S - i * 0.3, a = _ >= 0 ? "start" : "end";
2138
+ case B.POSITION.CONTAINER: {
2139
+ const { cx: o, cy: l } = this.graph.__data__.extremes, _ = this.point.x - o, g = this.point.y - l, c = Math.sqrt(_ * _ + g * g) || 1, E = t * 0.93 / c;
2140
+ n = o + _ * E, r = l + g * E - i * 0.3, a = _ >= 0 ? "start" : "end";
2141
2141
  break;
2142
2142
  }
2143
- case H.POSITION.CUSTOM:
2143
+ case B.POSITION.CUSTOM:
2144
2144
  if (this.customX != null && this.customY != null) {
2145
2145
  n = this.customX, r = this.customY, a = "start";
2146
2146
  break;
2147
2147
  }
2148
2148
  default:
2149
- case H.POSITION.OBJECT: {
2149
+ case B.POSITION.OBJECT: {
2150
2150
  const o = this.point.x >= 0 ? i : -i;
2151
2151
  a = this.point.x >= 0 ? "start" : "end", n = this.point.x + o, r = this.point.y - i * 0.4;
2152
2152
  break;
@@ -2171,39 +2171,39 @@ const ys = class ys {
2171
2171
  this.svg_element.remove();
2172
2172
  }
2173
2173
  };
2174
- u(ys, "QELabel");
2175
- let Vt = ys;
2176
- const Fe = class Fe extends HTMLElement {
2177
- };
2178
- u(Fe, "QENodesElement"), Fe.tagName = "qe-nodes";
2179
- let Ie = Fe;
2174
+ u(xs, "QELabel");
2175
+ let Kt = xs;
2180
2176
  const je = class je extends HTMLElement {
2181
2177
  };
2182
- u(je, "QEMeansElement"), je.tagName = "qe-means";
2178
+ u(je, "QENodesElement"), je.tagName = "qe-nodes";
2183
2179
  let Ne = je;
2184
2180
  const Ye = class Ye extends HTMLElement {
2185
2181
  };
2186
- u(Ye, "QEPointsElement"), Ye.tagName = "qe-points";
2182
+ u(Ye, "QEMeansElement"), Ye.tagName = "qe-means";
2187
2183
  let ke = Ye;
2188
2184
  const qe = class qe extends HTMLElement {
2189
2185
  };
2190
- u(qe, "QEEdgesElement"), qe.tagName = "qe-edges";
2186
+ u(qe, "QEPointsElement"), qe.tagName = "qe-points";
2191
2187
  let Ce = qe;
2192
2188
  const Ue = class Ue extends HTMLElement {
2193
2189
  };
2194
- u(Ue, "QETrajectoriesElement"), Ue.tagName = "qe-trajectories";
2195
- let $e = Ue;
2190
+ u(Ue, "QEEdgesElement"), Ue.tagName = "qe-edges";
2191
+ let Oe = Ue;
2196
2192
  const Ge = class Ge extends HTMLElement {
2197
2193
  };
2198
- u(Ge, "QEAxesElement"), Ge.tagName = "qe-axes";
2199
- let Oe = Ge;
2200
- customElements.define(Ie.tagName, Ie);
2194
+ u(Ge, "QETrajectoriesElement"), Ge.tagName = "qe-trajectories";
2195
+ let $e = Ge;
2196
+ const Be = class Be extends HTMLElement {
2197
+ };
2198
+ u(Be, "QEAxesElement"), Be.tagName = "qe-axes";
2199
+ let Pe = Be;
2201
2200
  customElements.define(Ne.tagName, Ne);
2202
2201
  customElements.define(ke.tagName, ke);
2203
2202
  customElements.define(Ce.tagName, Ce);
2204
- customElements.define($e.tagName, $e);
2205
2203
  customElements.define(Oe.tagName, Oe);
2206
- const Ws = [
2204
+ customElements.define($e.tagName, $e);
2205
+ customElements.define(Pe.tagName, Pe);
2206
+ const Vs = [
2207
2207
  "#4477AA",
2208
2208
  "#EE6677",
2209
2209
  "#228833",
@@ -2213,7 +2213,7 @@ const Ws = [
2213
2213
  "#BBBBBB",
2214
2214
  "#000000"
2215
2215
  ];
2216
- function Ei(d, t) {
2216
+ function Mi(d, t) {
2217
2217
  for (const e of t)
2218
2218
  if (d === `${e}.${e}`) return [e, e];
2219
2219
  for (const e of t)
@@ -2223,20 +2223,20 @@ function Ei(d, t) {
2223
2223
  }
2224
2224
  return null;
2225
2225
  }
2226
- u(Ei, "parseEdgePair");
2227
- function Mi(d, t, e, s) {
2226
+ u(Mi, "parseEdgePair");
2227
+ function Ii(d, t, e, s) {
2228
2228
  const i = Math.max(1, e - 1), n = i >= 120 ? 1.96 : i >= 60 ? 2 : i >= 30 ? 2.042 : i >= 20 ? 2.086 : i >= 10 ? 2.228 : i >= 5 ? 2.571 : 4.303, r = Math.sqrt(Math.max(0, d) / e) * s, a = Math.sqrt(Math.max(0, t) / e) * s;
2229
2229
  return { halfW: n * r, halfH: n * a };
2230
2230
  }
2231
- u(Mi, "computeCIRect");
2232
- const Ii = 0.5;
2233
- function me(d, t, e) {
2231
+ u(Ii, "computeCIRect");
2232
+ const Ni = 0.5;
2233
+ function fe(d, t, e) {
2234
2234
  if (!d) return;
2235
2235
  const s = Math.min(Math.abs(t), Math.abs(e));
2236
- s > 0 && (d.meta = { ...d.meta ?? {}, maxRadius: s * Ii });
2236
+ s > 0 && (d.meta = { ...d.meta ?? {}, maxRadius: s * Ni });
2237
2237
  }
2238
- u(me, "capMeanToInterval");
2239
- function fe(d, t, e, s = "") {
2238
+ u(fe, "capMeanToInterval");
2239
+ function pe(d, t, e, s = "") {
2240
2240
  const i = /* @__PURE__ */ u((o) => {
2241
2241
  const l = d.names.indexOf(o), _ = l >= 0 ? d[l] : null;
2242
2242
  if (_ == null || _ === "") return;
@@ -2245,8 +2245,8 @@ function fe(d, t, e, s = "") {
2245
2245
  }, "get"), n = i(`${t}.${s}low`) ?? i(`${t}_${s}low`), r = i(`${t}.${s}high`) ?? i(`${t}_${s}high`), a = i(`${e}.${s}low`) ?? i(`${e}_${s}low`), h = i(`${e}.${s}high`) ?? i(`${e}_${s}high`);
2246
2246
  return n == null || r == null || a == null || h == null ? null : { x_low: n, x_high: r, y_low: a, y_high: h };
2247
2247
  }
2248
- u(fe, "readIntervalBounds");
2249
- function Ni(d) {
2248
+ u(pe, "readIntervalBounds");
2249
+ function ki(d) {
2250
2250
  var i, n;
2251
2251
  const t = /* @__PURE__ */ u((r) => d.getAttribute(r), "a"), e = ((i = t("colors")) == null ? void 0 : i.split(",").map((r) => r.trim()).filter(Boolean)) ?? [], s = ((n = t("threshold")) == null ? void 0 : n.split(",").map(Number).filter(Number.isFinite)) ?? [];
2252
2252
  return {
@@ -2260,18 +2260,18 @@ function Ni(d) {
2260
2260
  name: t("name")
2261
2261
  };
2262
2262
  }
2263
- u(Ni, "parseEdgeLayer");
2264
- function ki(d) {
2263
+ u(ki, "parseEdgeLayer");
2264
+ function Ci(d) {
2265
2265
  const { r: t, g: e, b: s } = et.parseColor(d), i = Math.max(t, e, s), n = Math.min(t, e, s), r = /* @__PURE__ */ u((a) => (i + n - a).toString(16).padStart(2, "0"), "f");
2266
2266
  return `#${r(t)}${r(e)}${r(s)}`;
2267
2267
  }
2268
- u(ki, "complementColor");
2269
- function Ci(d) {
2268
+ u(Ci, "complementColor");
2269
+ function Oi(d) {
2270
2270
  const t = d == null ? void 0 : d.trim().toLowerCase();
2271
2271
  return t === "plot" || t === "absolute" ? t : "model";
2272
2272
  }
2273
- u(Ci, "parseColorScale");
2274
- function Be(d, t) {
2273
+ u(Oi, "parseColorScale");
2274
+ function He(d, t) {
2275
2275
  switch (d == null ? void 0 : d.toLowerCase()) {
2276
2276
  case "on":
2277
2277
  return 3;
@@ -2285,12 +2285,12 @@ function Be(d, t) {
2285
2285
  return t;
2286
2286
  }
2287
2287
  }
2288
- u(Be, "parseLabelMode");
2289
- const ut = class ut extends we {
2288
+ u(He, "parseLabelMode");
2289
+ const ut = class ut extends Ae {
2290
2290
  constructor() {
2291
- super(), this.zoom_level = 1, this.__children__ = new It(), 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 Ve(Vs), 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) => {
2292
- var As, vs, Ss, Es, Ms, Is, Ns, ks, Cs, $s, Os, Ps, Rs, Ls, Ds;
2293
- const e = ((As = t.composedPath) == null ? void 0 : As.call(t)[0]) ?? t.target;
2291
+ super(), this.zoom_level = 1, this.__children__ = new Nt(), 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) => {
2292
+ var vs, Ss, Es, Ms, Is, Ns, ks, Cs, Os, $s, Ps, Rs, Ls, Ds, Ts;
2293
+ const e = ((vs = t.composedPath) == null ? void 0 : vs.call(t)[0]) ?? t.target;
2294
2294
  if (this._vizena && e !== this._vizena) return;
2295
2295
  const s = t.detail;
2296
2296
  if (!s) return;
@@ -2299,183 +2299,183 @@ const ut = class ut extends we {
2299
2299
  this._hasModel = !0;
2300
2300
  const n = s.dimensions, r = s.unit_id_col, a = s.node_id_col, h = s.group_col, o = this._readLayerConfig();
2301
2301
  this._showAxes = o.showAxes, this._axisXText = o.axisXLabel === null ? null : o.axisXLabel || String((n == null ? void 0 : n[0]) ?? "x"), this._magnifyText = o.edgeMagnify == null ? null : `(scaled ${o.edgeMagnify.toFixed(1)}x)`, this._axisYText = o.axisYLabel === null ? null : o.axisYLabel || String((n == null ? void 0 : n[1]) ?? "y");
2302
- const l = {}, _ = (vs = s.palette) != null && vs.length ? s.palette : Ws;
2303
- if (h && ((Ss = s.points) != null && Ss.names)) {
2302
+ const l = {}, _ = (Ss = s.palette) != null && Ss.length ? s.palette : Vs;
2303
+ if (h && ((Es = s.points) != null && Es.names)) {
2304
2304
  const C = s.points.col(h);
2305
- C && [...new Set([...C].map(String))].forEach(($, x) => {
2306
- l[$] = _[x % _.length];
2305
+ C && [...new Set([...C].map(String))].forEach((O, x) => {
2306
+ l[O] = _[x % _.length];
2307
2307
  });
2308
2308
  }
2309
- (Es = s.groups) != null && Es.rows && s.groups.rows().length > 0 && s.groups.rows().forEach((C) => {
2310
- const M = C.rowName ?? String(C[0]), $ = C.names.indexOf("color"), x = $ >= 0 ? C[$] : null;
2311
- x && String(x) !== "NA" ? l[M] = String(x) : l[M] || (l[M] = _[Object.keys(l).length % _.length]);
2309
+ (Ms = s.groups) != null && Ms.rows && s.groups.rows().length > 0 && s.groups.rows().forEach((C) => {
2310
+ const I = C.rowName ?? String(C[0]), O = C.names.indexOf("color"), x = O >= 0 ? C[O] : null;
2311
+ x && String(x) !== "NA" ? l[I] = String(x) : l[I] || (l[I] = _[Object.keys(l).length % _.length]);
2312
2312
  });
2313
2313
  const g = Object.keys(l), c = o.activeMeanGroups && o.activeMeanGroups.trim() ? new Set(
2314
2314
  o.activeMeanGroups.split(",").map((C) => C.trim()).filter((C) => l[C])
2315
2315
  // silently drop names not in model
2316
- ) : new Set(g), S = o.scalePoints, p = /* @__PURE__ */ u((C) => {
2317
- let M = 0;
2318
- return C.forEach(($) => {
2319
- const x = $.names.indexOf(n[0]), m = n.length > 1 ? $.names.indexOf(n[1]) : -1;
2320
- x >= 0 && (M = Math.max(M, Math.abs(Number($[x])))), m >= 0 && (M = Math.max(M, Math.abs(Number($[m]))));
2321
- }), M;
2322
- }, "getExtent"), A = (Ms = s.nodes) != null && Ms.rows ? p(s.nodes.rows()) : 0, P = (Is = s.points) != null && Is.rows ? p(s.points.rows()) : 0, Y = (Ns = s.trajectories) != null && Ns.rows ? p(s.trajectories.rows()) : 0, q = P > 0 ? P : Y, v = o.pointScale !== null ? o.pointScale : S && q > 0 && A > 0 ? A / q : 1;
2323
- this._rangeExtent = o.range === "network" ? A * 1.2 : o.range === "points" ? q * v * 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;
2324
- const j = o.labelNodes, it = o.labelMeans, rt = o.labelPoints, st = this._labelsGroup, lt = /* @__PURE__ */ u((C, M, $, x = 1) => {
2325
- const m = C.names.indexOf(M), O = C.names.indexOf(n[0]), b = n.length > 1 ? C.names.indexOf(n[1]) : -1, y = new K({
2316
+ ) : new Set(g), E = o.scalePoints, f = /* @__PURE__ */ u((C) => {
2317
+ let I = 0;
2318
+ return C.forEach((O) => {
2319
+ const x = O.names.indexOf(n[0]), m = n.length > 1 ? O.names.indexOf(n[1]) : -1;
2320
+ x >= 0 && (I = Math.max(I, Math.abs(Number(O[x])))), m >= 0 && (I = Math.max(I, Math.abs(Number(O[m]))));
2321
+ }), I;
2322
+ }, "getExtent"), v = (Is = s.nodes) != null && Is.rows ? f(s.nodes.rows()) : 0, P = (Ns = s.points) != null && Ns.rows ? f(s.points.rows()) : 0, Y = (ks = s.trajectories) != null && ks.rows ? f(s.trajectories.rows()) : 0, q = P > 0 ? P : Y, S = o.pointScale !== null ? o.pointScale : E && q > 0 && v > 0 ? v / q : 1;
2323
+ this._rangeExtent = o.range === "network" ? v * 1.2 : o.range === "points" ? q * S * 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;
2324
+ const j = o.labelNodes, nt = o.labelMeans, rt = o.labelPoints, st = this._labelsGroup, lt = /* @__PURE__ */ u((C, I, O, x = 1) => {
2325
+ const m = C.names.indexOf(I), $ = C.names.indexOf(n[0]), b = n.length > 1 ? C.names.indexOf(n[1]) : -1, y = new J({
2326
2326
  ID: m >= 0 ? String(C[m]) : C.rowName || `pt-${Math.random().toString(36).slice(2)}`,
2327
2327
  dimensions: [
2328
- O >= 0 ? Number(C[O]) * x : 0,
2328
+ $ >= 0 ? Number(C[$]) * x : 0,
2329
2329
  b >= 0 ? -Number(C[b]) * x : 0
2330
2330
  // negate Y: SVG y-down vs ENA y-up
2331
2331
  ],
2332
2332
  meta: {}
2333
2333
  });
2334
- return $ && (y.color = new et($)), y;
2335
- }, "rowToPoint"), V = {}, St = o.showPoints, Nt = s.pointsets;
2336
- if (o.pointSets.length && (Nt != null && Nt.rows)) {
2337
- const C = this.__children__.search("__children__", "points"), M = /* @__PURE__ */ u(($, x) => {
2338
- const m = $.names.indexOf(x);
2339
- return m >= 0 ? $[m] : null;
2334
+ return O && (y.color = new et(O)), y;
2335
+ }, "rowToPoint"), W = {}, Et = o.showPoints, kt = s.pointsets;
2336
+ if (o.pointSets.length && (kt != null && kt.rows)) {
2337
+ const C = this.__children__.search("__children__", "points"), I = /* @__PURE__ */ u((O, x) => {
2338
+ const m = O.names.indexOf(x);
2339
+ return m >= 0 ? O[m] : null;
2340
2340
  }, "col");
2341
- o.pointSets.forEach(($, x) => {
2342
- Nt.rows().forEach((m) => {
2343
- if (String(M(m, "set")) !== $.set) return;
2344
- const O = String(M(m, "id")), b = M(m, "group") != null && String(M(m, "group")) !== "NA" ? String(M(m, "group")) : null, y = M(m, "color") && String(M(m, "color")) !== "NA" ? String(M(m, "color")) : b && l[b] ? l[b] : _[x % _.length], E = lt(m, "id", y, v);
2345
- E.ID = `${$.set}::${O}`, E.size = $.size ?? o.pointSize ?? 2.5;
2346
- const F = M(m, "shape");
2347
- F && String(F) !== "NA" && (E.shape = String(F));
2348
- const R = M(m, "label");
2349
- E.meta = {
2341
+ o.pointSets.forEach((O, x) => {
2342
+ kt.rows().forEach((m) => {
2343
+ if (String(I(m, "set")) !== O.set) return;
2344
+ const $ = String(I(m, "id")), b = I(m, "group") != null && String(I(m, "group")) !== "NA" ? String(I(m, "group")) : null, y = I(m, "color") && String(I(m, "color")) !== "NA" ? String(I(m, "color")) : b && l[b] ? l[b] : _[x % _.length], M = lt(m, "id", y, S);
2345
+ M.ID = `${O.set}::${$}`, M.size = O.size ?? o.pointSize ?? 2.5;
2346
+ const F = I(m, "shape");
2347
+ F && String(F) !== "NA" && (M.shape = String(F));
2348
+ const R = I(m, "label");
2349
+ M.meta = {
2350
2350
  stroke: "#ffffff",
2351
2351
  kind: "point",
2352
- name: R != null && String(R) !== "NA" ? String(R) : O,
2352
+ name: R != null && String(R) !== "NA" ? String(R) : $,
2353
2353
  group: b ?? void 0,
2354
- unit: O,
2355
- set: $.set,
2356
- fixedSize: $.fixedSize
2357
- }, this.__data__.points.set(E.ID, E), C == null || C.__data__.objects.set(E.ID, E);
2354
+ unit: $,
2355
+ set: O.set,
2356
+ fixedSize: O.fixedSize
2357
+ }, this.__data__.points.set(M.ID, M), C == null || C.__data__.objects.set(M.ID, M);
2358
2358
  });
2359
2359
  });
2360
2360
  }
2361
- if ((ks = s.points) != null && ks.rows) {
2361
+ if ((Cs = s.points) != null && Cs.rows) {
2362
2362
  const C = this.__children__.search("__children__", "points");
2363
2363
  if (C) {
2364
2364
  s.points.rows().forEach((x) => {
2365
- const m = h ? x.names.indexOf(h) : -1, O = m >= 0 ? String(x[m]) : null, b = O ? l[O] ?? "#888888" : "#888888";
2366
- if (St) {
2367
- const y = lt(x, r, b, v);
2365
+ const m = h ? x.names.indexOf(h) : -1, $ = m >= 0 ? String(x[m]) : null, b = $ ? l[$] ?? "#888888" : "#888888";
2366
+ if (Et) {
2367
+ const y = lt(x, r, b, S);
2368
2368
  y.size = o.pointSize ?? 2.5, y.meta = {
2369
2369
  ...y.meta ?? {},
2370
2370
  stroke: "#ffffff",
2371
2371
  kind: "point",
2372
2372
  name: y.ID,
2373
- group: O ?? void 0,
2373
+ group: $ ?? void 0,
2374
2374
  unit: y.ID,
2375
2375
  fixedSize: o.pointFixedSize
2376
2376
  }, this.__data__.points.set(y.ID, y), C.__data__.objects.set(y.ID, y);
2377
2377
  }
2378
- if (O) {
2379
- const y = x.names.indexOf(n[0]), E = n.length > 1 ? x.names.indexOf(n[1]) : -1;
2380
- V[O] || (V[O] = { x: 0, y: 0, x2: 0, y2: 0, xy: 0, n: 0, color: b });
2381
- const F = y >= 0 ? Number(x[y]) : 0, R = E >= 0 ? Number(x[E]) : 0;
2382
- V[O].x += F, V[O].y += R, V[O].x2 += F * F, V[O].y2 += R * R, V[O].xy += F * R, V[O].n += 1;
2378
+ if ($) {
2379
+ const y = x.names.indexOf(n[0]), M = n.length > 1 ? x.names.indexOf(n[1]) : -1;
2380
+ W[$] || (W[$] = { x: 0, y: 0, x2: 0, y2: 0, xy: 0, n: 0, color: b });
2381
+ const F = y >= 0 ? Number(x[y]) : 0, R = M >= 0 ? Number(x[M]) : 0;
2382
+ W[$].x += F, W[$].y += R, W[$].x2 += F * F, W[$].y2 += R * R, W[$].xy += F * R, W[$].n += 1;
2383
2383
  }
2384
2384
  });
2385
- const M = !!((Cs = s.groups) != null && Cs.rows && s.groups.rows().length > 0), $ = o.showMeans && M ? s.groups.rows().filter((x) => {
2385
+ const I = !!((Os = s.groups) != null && Os.rows && s.groups.rows().length > 0), O = o.showMeans && I ? s.groups.rows().filter((x) => {
2386
2386
  const m = x.rowName ?? String(x[0]);
2387
2387
  return c.size === 0 || c.has(m);
2388
2388
  }) : [];
2389
2389
  if (o.showMeans) {
2390
- const x = C.svg_element, m = (A > 0 ? A : 1) * 8e-3;
2391
- if (M) {
2392
- const O = new Set($.map((b) => b.rowName ?? String(b[0])));
2390
+ const x = C.svg_element, m = (v > 0 ? v : 1) * 8e-3;
2391
+ if (I) {
2392
+ const $ = new Set(O.map((b) => b.rowName ?? String(b[0])));
2393
2393
  this._ciRects.forEach((b, y) => {
2394
- O.has(y) || (b.remove(), this._ciRects.delete(y));
2394
+ $.has(y) || (b.remove(), this._ciRects.delete(y));
2395
2395
  }), this._outlierRects.forEach((b, y) => {
2396
- O.has(y) || (b.remove(), this._outlierRects.delete(y));
2396
+ $.has(y) || (b.remove(), this._outlierRects.delete(y));
2397
2397
  }), this._ciCross.forEach((b, y) => {
2398
- O.has(y.slice(2)) || (b.remove(), this._ciCross.delete(y));
2399
- }), $.forEach((b) => {
2400
- var N, z, T;
2401
- const y = b.rowName ?? String(b[0]), E = l[y] ?? "#888888", F = b.names.indexOf(n[0]), R = n.length > 1 ? b.names.indexOf(n[1]) : -1, X = F >= 0 ? Number(b[F]) * v : 0, dt = R >= 0 ? -Number(b[R]) * v : 0, J = new K({
2398
+ $.has(y.slice(2)) || (b.remove(), this._ciCross.delete(y));
2399
+ }), O.forEach((b) => {
2400
+ var w, N, T;
2401
+ const y = b.rowName ?? String(b[0]), M = l[y] ?? "#888888", F = b.names.indexOf(n[0]), R = n.length > 1 ? b.names.indexOf(n[1]) : -1, H = F >= 0 ? Number(b[F]) * S : 0, dt = R >= 0 ? -Number(b[R]) * S : 0, Z = new J({
2402
2402
  ID: `mean-${y}`,
2403
- dimensions: [X, dt],
2403
+ dimensions: [H, dt],
2404
2404
  meta: { kind: "mean", name: y, group: y, fixedSize: o.meanFixedSize }
2405
2405
  });
2406
- J.color = new et(E), J.size = 4;
2406
+ Z.color = new et(M), Z.size = 4;
2407
2407
  const _t = b.names.indexOf("shape"), L = _t >= 0 ? b[_t] : null;
2408
- J.shape = L && String(L) !== "NA" ? String(L) : "rect", this.__data__.points.set(J.ID, J), C.__data__.objects.set(J.ID, J);
2409
- const kt = /* @__PURE__ */ u((I) => {
2410
- const Q = b.names.indexOf(I), G = Q >= 0 ? b[Q] : null;
2411
- return G == null || String(G) === "NA" || String(G) === "" ? null : G;
2412
- }, "cell"), bt = kt("intervals"), xt = bt === "box" || bt === "crosshairs" || bt === "none" ? bt : o.intervals, Ct = kt("outlier"), U = (Ct == null ? o.showOutlier : Ct === !0 || String(Ct) === "true") ? fe(b, n[0], n[1], "o") : null;
2408
+ Z.shape = L && String(L) !== "NA" ? String(L) : "rect", this.__data__.points.set(Z.ID, Z), C.__data__.objects.set(Z.ID, Z);
2409
+ const Ct = /* @__PURE__ */ u((A) => {
2410
+ const z = b.names.indexOf(A), V = z >= 0 ? b[z] : null;
2411
+ return V == null || String(V) === "NA" || String(V) === "" ? null : V;
2412
+ }, "cell"), yt = Ct("intervals"), wt = yt === "box" || yt === "crosshairs" || yt === "none" ? yt : o.intervals, Ot = Ct("outlier"), U = (Ot == null ? o.showOutlier : Ot === !0 || String(Ot) === "true") ? pe(b, n[0], n[1], "o") : null;
2413
2413
  if (!U)
2414
- (N = this._outlierRects.get(y)) == null || N.remove(), this._outlierRects.delete(y);
2414
+ (w = this._outlierRects.get(y)) == null || w.remove(), this._outlierRects.delete(y);
2415
2415
  else {
2416
- let I = this._outlierRects.get(y);
2417
- I || (I = document.createElementNS("http://www.w3.org/2000/svg", "rect"), I.setAttribute("data-outlier-group", y), this._outlierRects.set(y, I)), I.setAttribute("x", (U.x_low * v).toString()), I.setAttribute("y", (-U.y_high * v).toString()), I.setAttribute("width", ((U.x_high - U.x_low) * v).toString()), I.setAttribute("height", ((U.y_high - U.y_low) * v).toString()), I.setAttribute("fill", "none"), I.setAttribute("stroke", E), I.setAttribute("stroke-width", m.toString()), I.setAttribute("stroke-opacity", "0.5"), I.setAttribute("stroke-dasharray", `${m * 2} ${m * 2}`), x && !I.parentElement && x.insertBefore(I, x.firstChild);
2416
+ let A = this._outlierRects.get(y);
2417
+ A || (A = document.createElementNS("http://www.w3.org/2000/svg", "rect"), A.setAttribute("data-outlier-group", y), this._outlierRects.set(y, A)), A.setAttribute("x", (U.x_low * S).toString()), A.setAttribute("y", (-U.y_high * S).toString()), A.setAttribute("width", ((U.x_high - U.x_low) * S).toString()), A.setAttribute("height", ((U.y_high - U.y_low) * S).toString()), A.setAttribute("fill", "none"), A.setAttribute("stroke", M), A.setAttribute("stroke-width", m.toString()), A.setAttribute("stroke-opacity", "0.5"), A.setAttribute("stroke-dasharray", `${m * 2} ${m * 2}`), x && !A.parentElement && x.insertBefore(A, x.firstChild);
2418
2418
  }
2419
- const f = xt !== "none" ? fe(b, n[0], n[1]) : null, w = `x:${y}`;
2420
- if ((!f || xt !== "crosshairs") && ((z = this._ciCross.get(w)) == null || z.remove(), this._ciCross.delete(w)), f && xt === "crosshairs") {
2419
+ const it = wt !== "none" ? pe(b, n[0], n[1]) : null, p = `x:${y}`;
2420
+ if ((!it || wt !== "crosshairs") && ((N = this._ciCross.get(p)) == null || N.remove(), this._ciCross.delete(p)), it && wt === "crosshairs") {
2421
2421
  (T = this._ciRects.get(y)) == null || T.remove(), this._ciRects.delete(y);
2422
- const I = f.x_low * v, Q = f.x_high * v, G = -f.y_high * v, nt = -f.y_low * v;
2423
- me(J, (Q - I) / 2, (nt - G) / 2);
2424
- let D = this._ciCross.get(w);
2425
- D || (D = document.createElementNS("http://www.w3.org/2000/svg", "path"), D.setAttribute("data-ci-group", y), D.setAttribute("data-ci-kind", "crosshairs"), this._ciCross.set(w, D)), D.setAttribute("d", `M${I} ${dt} L${Q} ${dt} M${X} ${G} L${X} ${nt}`), D.setAttribute("fill", "none"), D.setAttribute("stroke", E), D.setAttribute("stroke-width", (m * 1.25).toString()), D.setAttribute("stroke-opacity", "0.8"), x && !D.parentElement && x.insertBefore(D, x.firstChild);
2426
- } else if (f) {
2427
- const I = f.x_low * v, Q = -f.y_high * v, G = (f.x_high - f.x_low) * v, nt = (f.y_high - f.y_low) * v;
2428
- me(J, G / 2, nt / 2);
2422
+ const A = it.x_low * S, z = it.x_high * S, V = -it.y_high * S, K = -it.y_low * S;
2423
+ fe(Z, (z - A) / 2, (K - V) / 2);
2424
+ let D = this._ciCross.get(p);
2425
+ D || (D = document.createElementNS("http://www.w3.org/2000/svg", "path"), D.setAttribute("data-ci-group", y), D.setAttribute("data-ci-kind", "crosshairs"), this._ciCross.set(p, D)), D.setAttribute("d", `M${A} ${dt} L${z} ${dt} M${H} ${V} L${H} ${K}`), D.setAttribute("fill", "none"), D.setAttribute("stroke", M), D.setAttribute("stroke-width", (m * 1.25).toString()), D.setAttribute("stroke-opacity", "0.8"), x && !D.parentElement && x.insertBefore(D, x.firstChild);
2426
+ } else if (it) {
2427
+ const A = it.x_low * S, z = -it.y_high * S, V = (it.x_high - it.x_low) * S, K = (it.y_high - it.y_low) * S;
2428
+ fe(Z, V / 2, K / 2);
2429
2429
  let D = this._ciRects.get(y);
2430
- D || (D = document.createElementNS("http://www.w3.org/2000/svg", "rect"), D.setAttribute("data-ci-group", y), this._ciRects.set(y, D)), D.setAttribute("x", I.toString()), D.setAttribute("y", Q.toString()), D.setAttribute("width", G.toString()), D.setAttribute("height", nt.toString()), D.setAttribute("fill", "none"), D.setAttribute("stroke", E), D.setAttribute("stroke-width", m.toString()), D.setAttribute("stroke-opacity", "0.8"), D.setAttribute("stroke-dasharray", `${m * 4} ${m * 3}`), x && !D.parentElement && x.insertBefore(D, x.firstChild);
2430
+ D || (D = document.createElementNS("http://www.w3.org/2000/svg", "rect"), D.setAttribute("data-ci-group", y), this._ciRects.set(y, D)), D.setAttribute("x", A.toString()), D.setAttribute("y", z.toString()), D.setAttribute("width", V.toString()), D.setAttribute("height", K.toString()), D.setAttribute("fill", "none"), D.setAttribute("stroke", M), D.setAttribute("stroke-width", m.toString()), D.setAttribute("stroke-opacity", "0.8"), D.setAttribute("stroke-dasharray", `${m * 4} ${m * 3}`), x && !D.parentElement && x.insertBefore(D, x.firstChild);
2431
2431
  } else {
2432
- const I = this._ciRects.get(y);
2433
- I && (I.remove(), this._ciRects.delete(y));
2432
+ const A = this._ciRects.get(y);
2433
+ A && (A.remove(), this._ciRects.delete(y));
2434
2434
  }
2435
2435
  });
2436
2436
  } else
2437
- Object.entries(V).forEach(([b, { x: y, y: E, n: F, color: R }]) => {
2438
- const X = new K({
2437
+ Object.entries(W).forEach(([b, { x: y, y: M, n: F, color: R }]) => {
2438
+ const H = new J({
2439
2439
  ID: `mean-${b}`,
2440
- dimensions: [y / F * v, -(E / F) * v],
2440
+ dimensions: [y / F * S, -(M / F) * S],
2441
2441
  meta: { kind: "mean", name: b, group: b, fixedSize: o.meanFixedSize }
2442
2442
  });
2443
- X.color = new et(R), X.size = 4, X.shape = "rect", this.__data__.points.set(X.ID, X), C.__data__.objects.set(X.ID, X);
2443
+ H.color = new et(R), H.size = 4, H.shape = "rect", this.__data__.points.set(H.ID, H), C.__data__.objects.set(H.ID, H);
2444
2444
  }), o.showCI && (this._ciRects.forEach((b, y) => {
2445
- V[y] || (b.remove(), this._ciRects.delete(y));
2445
+ W[y] || (b.remove(), this._ciRects.delete(y));
2446
2446
  }), ($s = s.confidence) != null && $s.rows ? s.confidence.rows().forEach((b) => {
2447
- const y = b.names.indexOf(h ?? "group"), E = y >= 0 ? String(b[y]) : b.rowName ?? null;
2448
- if (!E) return;
2449
- const F = l[E] ?? "#888888", R = fe(b, n[0], n[1]);
2447
+ const y = b.names.indexOf(h ?? "group"), M = y >= 0 ? String(b[y]) : b.rowName ?? null;
2448
+ if (!M) return;
2449
+ const F = l[M] ?? "#888888", R = pe(b, n[0], n[1]);
2450
2450
  if (!R) return;
2451
- const X = R.x_low * v, dt = -R.y_high * v, J = (R.x_high - R.x_low) * v, _t = (R.y_high - R.y_low) * v;
2452
- me(
2453
- this.__data__.points.get(`mean-${E}`),
2454
- J / 2,
2451
+ const H = R.x_low * S, dt = -R.y_high * S, Z = (R.x_high - R.x_low) * S, _t = (R.y_high - R.y_low) * S;
2452
+ fe(
2453
+ this.__data__.points.get(`mean-${M}`),
2454
+ Z / 2,
2455
2455
  _t / 2
2456
2456
  );
2457
- let L = this._ciRects.get(E);
2458
- L || (L = document.createElementNS("http://www.w3.org/2000/svg", "rect"), L.setAttribute("data-ci-group", E), this._ciRects.set(E, L)), L.setAttribute("x", X.toString()), L.setAttribute("y", dt.toString()), L.setAttribute("width", J.toString()), L.setAttribute("height", _t.toString()), L.setAttribute("fill", "none"), L.setAttribute("stroke", F), L.setAttribute("stroke-width", m.toString()), L.setAttribute("stroke-opacity", "0.8"), L.setAttribute("stroke-dasharray", `${m * 4} ${m * 3}`), x && !L.parentElement && x.insertBefore(L, x.firstChild);
2459
- }) : Object.entries(V).forEach(([b, { x: y, y: E, x2: F, y2: R, n: X, color: dt }]) => {
2460
- if (X < 2) return;
2461
- const J = y / X, _t = E / X, L = F / X - J * J, kt = R / X - _t * _t, { halfW: bt, halfH: xt } = Mi(L, kt, X, v), Ct = J * v, Lt = -_t * v;
2462
- me(
2457
+ let L = this._ciRects.get(M);
2458
+ L || (L = document.createElementNS("http://www.w3.org/2000/svg", "rect"), L.setAttribute("data-ci-group", M), this._ciRects.set(M, L)), L.setAttribute("x", H.toString()), L.setAttribute("y", dt.toString()), L.setAttribute("width", Z.toString()), L.setAttribute("height", _t.toString()), L.setAttribute("fill", "none"), L.setAttribute("stroke", F), L.setAttribute("stroke-width", m.toString()), L.setAttribute("stroke-opacity", "0.8"), L.setAttribute("stroke-dasharray", `${m * 4} ${m * 3}`), x && !L.parentElement && x.insertBefore(L, x.firstChild);
2459
+ }) : Object.entries(W).forEach(([b, { x: y, y: M, x2: F, y2: R, n: H, color: dt }]) => {
2460
+ if (H < 2) return;
2461
+ const Z = y / H, _t = M / H, L = F / H - Z * Z, Ct = R / H - _t * _t, { halfW: yt, halfH: wt } = Ii(L, Ct, H, S), Ot = Z * S, Dt = -_t * S;
2462
+ fe(
2463
2463
  this.__data__.points.get(`mean-${b}`),
2464
- bt,
2465
- xt
2464
+ yt,
2465
+ wt
2466
2466
  );
2467
2467
  let U = this._ciRects.get(b);
2468
- U || (U = document.createElementNS("http://www.w3.org/2000/svg", "rect"), U.setAttribute("data-ci-group", b), this._ciRects.set(b, U)), U.setAttribute("x", (Ct - bt).toString()), U.setAttribute("y", (Lt - xt).toString()), U.setAttribute("width", (bt * 2).toString()), U.setAttribute("height", (xt * 2).toString()), U.setAttribute("fill", "none"), U.setAttribute("stroke", dt), U.setAttribute("stroke-width", m.toString()), U.setAttribute("stroke-opacity", "0.8"), U.setAttribute("stroke-dasharray", `${m * 4} ${m * 3}`), x && !U.parentElement && x.insertBefore(U, x.firstChild);
2469
- })), (Os = s.outlier) != null && Os.rows && (this._outlierRects.forEach((b, y) => {
2468
+ U || (U = document.createElementNS("http://www.w3.org/2000/svg", "rect"), U.setAttribute("data-ci-group", b), this._ciRects.set(b, U)), U.setAttribute("x", (Ot - yt).toString()), U.setAttribute("y", (Dt - wt).toString()), U.setAttribute("width", (yt * 2).toString()), U.setAttribute("height", (wt * 2).toString()), U.setAttribute("fill", "none"), U.setAttribute("stroke", dt), U.setAttribute("stroke-width", m.toString()), U.setAttribute("stroke-opacity", "0.8"), U.setAttribute("stroke-dasharray", `${m * 4} ${m * 3}`), x && !U.parentElement && x.insertBefore(U, x.firstChild);
2469
+ })), (Ps = s.outlier) != null && Ps.rows && (this._outlierRects.forEach((b, y) => {
2470
2470
  l[y] || (b.remove(), this._outlierRects.delete(y));
2471
2471
  }), s.outlier.rows().forEach((b) => {
2472
- const y = b.names.indexOf(h ?? "group"), E = y >= 0 ? String(b[y]) : b.rowName ?? null;
2473
- if (!E) return;
2474
- const F = l[E] ?? "#888888", R = fe(b, n[0], n[1]);
2472
+ const y = b.names.indexOf(h ?? "group"), M = y >= 0 ? String(b[y]) : b.rowName ?? null;
2473
+ if (!M) return;
2474
+ const F = l[M] ?? "#888888", R = pe(b, n[0], n[1]);
2475
2475
  if (!R) return;
2476
- const X = R.x_low * v, dt = -R.y_high * v, J = (R.x_high - R.x_low) * v, _t = (R.y_high - R.y_low) * v;
2477
- let L = this._outlierRects.get(E);
2478
- L || (L = document.createElementNS("http://www.w3.org/2000/svg", "rect"), L.setAttribute("data-outlier-group", E), this._outlierRects.set(E, L)), L.setAttribute("x", X.toString()), L.setAttribute("y", dt.toString()), L.setAttribute("width", J.toString()), L.setAttribute("height", _t.toString()), L.setAttribute("fill", "none"), L.setAttribute("stroke", F), L.setAttribute("stroke-width", m.toString()), L.setAttribute("stroke-opacity", "0.5"), L.setAttribute("stroke-dasharray", `${m * 2} ${m * 2}`), x && !L.parentElement && x.insertBefore(L, x.firstChild);
2476
+ const H = R.x_low * S, dt = -R.y_high * S, Z = (R.x_high - R.x_low) * S, _t = (R.y_high - R.y_low) * S;
2477
+ let L = this._outlierRects.get(M);
2478
+ L || (L = document.createElementNS("http://www.w3.org/2000/svg", "rect"), L.setAttribute("data-outlier-group", M), this._outlierRects.set(M, L)), L.setAttribute("x", H.toString()), L.setAttribute("y", dt.toString()), L.setAttribute("width", Z.toString()), L.setAttribute("height", _t.toString()), L.setAttribute("fill", "none"), L.setAttribute("stroke", F), L.setAttribute("stroke-width", m.toString()), L.setAttribute("stroke-opacity", "0.5"), L.setAttribute("stroke-dasharray", `${m * 2} ${m * 2}`), x && !L.parentElement && x.insertBefore(L, x.firstChild);
2479
2479
  }));
2480
2480
  }
2481
2481
  st && (this._pointLabels.forEach((x, m) => {
@@ -2483,40 +2483,40 @@ const ut = class ut extends we {
2483
2483
  }), this._meanLabels.forEach((x, m) => {
2484
2484
  C.__data__.objects.get(`mean-${m}`) || (x.remove(), this._meanLabels.delete(m));
2485
2485
  }), rt !== 0 && s.points.rows().forEach((x) => {
2486
- const m = x.names.indexOf(r), O = m >= 0 ? String(x[m]) : null;
2487
- if (!O) return;
2488
- const b = C.__data__.objects.get(O);
2486
+ const m = x.names.indexOf(r), $ = m >= 0 ? String(x[m]) : null;
2487
+ if (!$) return;
2488
+ const b = C.__data__.objects.get($);
2489
2489
  if (!b) return;
2490
- const y = O;
2491
- let E = this._pointLabels.get(O);
2492
- E ? rt === H.DISPLAY_TYPES.ON ? E.show() : E.hide() : (E = new Vt(y, b, st, this, rt), this._pointLabels.set(O, E));
2493
- }), it !== 0 && (M ? $.map((m) => m.rowName ?? String(m[0])) : Object.keys(V)).forEach((m) => {
2494
- const O = `mean-${m}`, b = C.__data__.objects.get(O);
2490
+ const y = $;
2491
+ let M = this._pointLabels.get($);
2492
+ M ? rt === B.DISPLAY_TYPES.ON ? M.show() : M.hide() : (M = new Kt(y, b, st, this, rt), this._pointLabels.set($, M));
2493
+ }), nt !== 0 && (I ? O.map((m) => m.rowName ?? String(m[0])) : Object.keys(W)).forEach((m) => {
2494
+ const $ = `mean-${m}`, b = C.__data__.objects.get($);
2495
2495
  if (!b) return;
2496
2496
  let y = this._meanLabels.get(m);
2497
- y ? it === H.DISPLAY_TYPES.ON ? y.show() : y.hide() : (y = new Vt(m, b, st, this, it), this._meanLabels.set(m, y));
2497
+ y ? nt === B.DISPLAY_TYPES.ON ? y.show() : y.hide() : (y = new Kt(m, b, st, this, nt), this._meanLabels.set(m, y));
2498
2498
  })), C.__data__.__state__.setVariable("layer_updated", C.__data__);
2499
2499
  }
2500
2500
  }
2501
- const Rt = this.__children__.search("__children__", "trajectories");
2502
- if (o.showTrajectories && Rt) {
2503
- Rt.__data__.objects.clear(), this.__data__.trajectories.clear();
2504
- const C = (Ps = s.trajectories) != null && Ps.rows ? s.trajectories : s.points;
2501
+ const Lt = this.__children__.search("__children__", "trajectories");
2502
+ if (o.showTrajectories && Lt) {
2503
+ Lt.__data__.objects.clear(), this.__data__.trajectories.clear();
2504
+ const C = (Rs = s.trajectories) != null && Rs.rows ? s.trajectories : s.points;
2505
2505
  if (C != null && C.rows) {
2506
- const M = {}, $ = o.trajectoryUnits ? o.trajectoryUnits.split(",").map((m) => m.trim()) : null;
2506
+ const I = {}, O = o.trajectoryUnits ? o.trajectoryUnits.split(",").map((m) => m.trim()) : null;
2507
2507
  C.rows().forEach((m) => {
2508
- const O = m.names.indexOf(r) >= 0 ? m.names.indexOf(r) : m.names.indexOf("unit") >= 0 ? m.names.indexOf("unit") : m.names.indexOf("ENA_UNIT") >= 0 ? m.names.indexOf("ENA_UNIT") : -1, b = O >= 0 ? String(m[O]) : m.rowName || "unit-1";
2509
- if ($ && !$.includes(b)) return;
2510
- const y = m.names.indexOf(n[0]), E = n.length > 1 ? m.names.indexOf(n[1]) : -1, F = m.names.indexOf("time") >= 0 ? m.names.indexOf("time") : m.names.indexOf("ActivityNumber") >= 0 ? m.names.indexOf("ActivityNumber") : m.names.indexOf("RowID") >= 0 ? m.names.indexOf("RowID") : -1, R = F >= 0 ? Number(m[F]) : M[b] ? M[b].length + 1 : 1;
2511
- y >= 0 && E >= 0 && (M[b] || (M[b] = []), M[b].push({
2512
- x: Number(m[y]) * v,
2513
- y: -Number(m[E]) * v,
2508
+ const $ = m.names.indexOf(r) >= 0 ? m.names.indexOf(r) : m.names.indexOf("unit") >= 0 ? m.names.indexOf("unit") : m.names.indexOf("ENA_UNIT") >= 0 ? m.names.indexOf("ENA_UNIT") : -1, b = $ >= 0 ? String(m[$]) : m.rowName || "unit-1";
2509
+ if (O && !O.includes(b)) return;
2510
+ const y = m.names.indexOf(n[0]), M = n.length > 1 ? m.names.indexOf(n[1]) : -1, F = m.names.indexOf("time") >= 0 ? m.names.indexOf("time") : m.names.indexOf("ActivityNumber") >= 0 ? m.names.indexOf("ActivityNumber") : m.names.indexOf("RowID") >= 0 ? m.names.indexOf("RowID") : -1, R = F >= 0 ? Number(m[F]) : I[b] ? I[b].length + 1 : 1;
2511
+ y >= 0 && M >= 0 && (I[b] || (I[b] = []), I[b].push({
2512
+ x: Number(m[y]) * S,
2513
+ y: -Number(m[M]) * S,
2514
2514
  time: R
2515
2515
  }));
2516
- }), Object.keys(M).forEach((m, O) => {
2517
- const b = M[m];
2516
+ }), Object.keys(I).forEach((m, $) => {
2517
+ const b = I[m];
2518
2518
  if (b.length === 0) return;
2519
- const y = _[O % _.length], E = new ve({
2519
+ const y = _[$ % _.length], M = new Se({
2520
2520
  ID: `traj-${m}`,
2521
2521
  unitId: m,
2522
2522
  color: new et(y),
@@ -2532,211 +2532,211 @@ const ut = class ut extends we {
2532
2532
  showTips: o.trajectoryShowTips,
2533
2533
  points: b.map((F) => ({ x: F.x, y: F.y, time: F.time }))
2534
2534
  });
2535
- this.__data__.trajectories.set(m, E), Rt.__data__.objects.set(E.ID, E);
2535
+ this.__data__.trajectories.set(m, M), Lt.__data__.objects.set(M.ID, M);
2536
2536
  });
2537
2537
  }
2538
- Rt.__data__.__state__.setVariable("layer_updated", Rt.__data__);
2538
+ Lt.__data__.__state__.setVariable("layer_updated", Lt.__data__);
2539
2539
  }
2540
- const ct = this.__children__.search("__children__", "network"), Wt = ct == null ? void 0 : ct.__children__.search("__children__", "edges"), gt = ct == null ? void 0 : ct.__children__.search("__children__", "nodes"), de = ct == null ? void 0 : ct.__children__.search("__children__", "edgenodes"), ei = o.showEdges;
2541
- if ((Rs = s.nodes) != null && Rs.rows && gt) {
2542
- if (s.nodes.rows().forEach((M) => {
2543
- const $ = lt(M, a, "#444444");
2544
- $.size = 2;
2545
- const x = M.names.indexOf("label"), m = x >= 0 ? M[x] : null;
2546
- $.meta = {
2547
- ...$.meta ?? {},
2540
+ const ct = this.__children__.search("__children__", "network"), Vt = ct == null ? void 0 : ct.__children__.search("__children__", "edges"), gt = ct == null ? void 0 : ct.__children__.search("__children__", "nodes"), ge = ct == null ? void 0 : ct.__children__.search("__children__", "edgenodes"), si = o.showEdges;
2541
+ if ((Ls = s.nodes) != null && Ls.rows && gt) {
2542
+ if (s.nodes.rows().forEach((I) => {
2543
+ const O = lt(I, a, "#444444");
2544
+ O.size = 2;
2545
+ const x = I.names.indexOf("label"), m = x >= 0 ? I[x] : null;
2546
+ O.meta = {
2547
+ ...O.meta ?? {},
2548
2548
  kind: "node",
2549
- name: m != null && String(m) !== "NA" && String(m) !== "" ? String(m) : $.ID
2550
- }, gt.__data__.objects.set($.ID, $);
2551
- }), ei && Wt && ((Ls = s.edges) != null && Ls.rows)) {
2552
- const M = {};
2553
- h && ((Ds = s.points) != null && Ds.rows) && s.points.rows().forEach((f) => {
2554
- const w = f.names.indexOf(r), N = f.names.indexOf(h);
2555
- w >= 0 && N >= 0 && (M[String(f[w])] = String(f[N]));
2549
+ name: m != null && String(m) !== "NA" && String(m) !== "" ? String(m) : O.ID
2550
+ }, gt.__data__.objects.set(O.ID, O);
2551
+ }), si && Vt && ((Ds = s.edges) != null && Ds.rows)) {
2552
+ const I = {};
2553
+ h && ((Ts = s.points) != null && Ts.rows) && s.points.rows().forEach((p) => {
2554
+ const w = p.names.indexOf(r), N = p.names.indexOf(h);
2555
+ w >= 0 && N >= 0 && (I[String(p[w])] = String(p[N]));
2556
2556
  });
2557
- const $ = s.nodes.rows().map((f) => {
2558
- const w = f.names.indexOf(a);
2559
- return w >= 0 ? String(f[w]) : "";
2557
+ const O = s.nodes.rows().map((p) => {
2558
+ const w = p.names.indexOf(a);
2559
+ return w >= 0 ? String(p[w]) : "";
2560
2560
  }).filter(Boolean), x = [];
2561
- (s.edges.names ?? []).forEach((f) => {
2562
- const w = Ei(f, $);
2563
- w && x.push({ col: f, pair: w });
2561
+ (s.edges.names ?? []).forEach((p) => {
2562
+ const w = Mi(p, O);
2563
+ w && x.push({ col: p, pair: w });
2564
2564
  });
2565
- const m = /* @__PURE__ */ u((f) => {
2565
+ const m = /* @__PURE__ */ u((p) => {
2566
2566
  const w = {};
2567
2567
  return s.edges.rows().forEach((N) => {
2568
- const z = N.names.indexOf(r);
2569
- z < 0 || String(N[z]) !== f || x.forEach(({ col: T }) => {
2570
- const I = N.names.indexOf(T);
2571
- I >= 0 && (w[T] = Number(N[I]) || 0);
2568
+ const T = N.names.indexOf(r);
2569
+ T < 0 || String(N[T]) !== p || x.forEach(({ col: A }) => {
2570
+ const z = N.names.indexOf(A);
2571
+ z >= 0 && (w[A] = Number(N[z]) || 0);
2572
2572
  });
2573
2573
  }), w;
2574
- }, "getUnitEdges"), O = /* @__PURE__ */ u((f) => {
2574
+ }, "getUnitEdges"), $ = /* @__PURE__ */ u((p) => {
2575
2575
  const w = {};
2576
2576
  let N = 0;
2577
- if (s.edges.rows().forEach((T) => {
2578
- const I = T.names.indexOf(r), Q = I >= 0 ? String(T[I]) : null, G = h ? T.names.indexOf(h) : -1;
2579
- (G >= 0 ? String(T[G]) : Q ? M[Q] : null) === f && (N++, x.forEach(({ col: D }) => {
2580
- const mt = T.names.indexOf(D);
2581
- if (mt >= 0) {
2582
- const W = Number(T[mt]);
2583
- isNaN(W) || (w[D] = (w[D] ?? 0) + W);
2577
+ if (s.edges.rows().forEach((A) => {
2578
+ const z = A.names.indexOf(r), V = z >= 0 ? String(A[z]) : null, K = h ? A.names.indexOf(h) : -1;
2579
+ (K >= 0 ? String(A[K]) : V ? I[V] : null) === p && (N++, x.forEach(({ col: mt }) => {
2580
+ const ft = A.names.indexOf(mt);
2581
+ if (ft >= 0) {
2582
+ const X = Number(A[ft]);
2583
+ isNaN(X) || (w[mt] = (w[mt] ?? 0) + X);
2584
2584
  }
2585
2585
  }));
2586
2586
  }), N === 0) return {};
2587
- const z = {};
2588
- return x.forEach(({ col: T }) => {
2589
- z[T] = (w[T] ?? 0) / N;
2590
- }), z;
2591
- }, "getGroupEdges"), b = /* @__PURE__ */ u((f) => {
2592
- if (l[f])
2593
- return { weights: O(f), color: l[f], label: f };
2594
- const w = M[f] ?? null, N = w ? l[w] ?? "#888888" : "#888888";
2595
- return { weights: m(f), color: N, label: f };
2596
- }, "resolve"), y = [], E = /* @__PURE__ */ u((f) => {
2597
- var T;
2598
- const w = s.networks, N = (T = w == null ? void 0 : w.rows) == null ? void 0 : T.call(w).find((I) => I.rowName === f);
2587
+ const T = {};
2588
+ return x.forEach(({ col: A }) => {
2589
+ T[A] = (w[A] ?? 0) / N;
2590
+ }), T;
2591
+ }, "getGroupEdges"), b = /* @__PURE__ */ u((p) => {
2592
+ if (l[p])
2593
+ return { weights: $(p), color: l[p], label: p };
2594
+ const w = I[p] ?? null, N = w ? l[w] ?? "#888888" : "#888888";
2595
+ return { weights: m(p), color: N, label: p };
2596
+ }, "resolve"), y = [], M = /* @__PURE__ */ u((p) => {
2597
+ var A;
2598
+ const w = s.networks, N = (A = w == null ? void 0 : w.rows) == null ? void 0 : A.call(w).find((z) => z.rowName === p);
2599
2599
  if (!N) return null;
2600
- const z = {};
2601
- return x.forEach(({ col: I }) => {
2602
- const Q = N.names.indexOf(I);
2603
- if (Q >= 0) {
2604
- const G = Number(N[Q]);
2605
- Number.isFinite(G) && (z[I] = G);
2600
+ const T = {};
2601
+ return x.forEach(({ col: z }) => {
2602
+ const V = N.names.indexOf(z);
2603
+ if (V >= 0) {
2604
+ const K = Number(N[V]);
2605
+ Number.isFinite(K) && (T[z] = K);
2606
2606
  }
2607
- }), z;
2608
- }, "networkRow"), F = /* @__PURE__ */ u((f, w) => {
2609
- if (!w) return f;
2610
- const N = Math.abs(f);
2611
- return N < w[0] ? 0 : N > w[1] ? Math.sign(f) * w[1] : f;
2607
+ }), T;
2608
+ }, "networkRow"), F = /* @__PURE__ */ u((p, w) => {
2609
+ if (!w) return p;
2610
+ const N = Math.abs(p);
2611
+ return N < w[0] ? 0 : N > w[1] ? Math.sign(p) * w[1] : p;
2612
2612
  }, "thresholded");
2613
- o.edgeLayers.forEach((f, w) => {
2614
- const N = /* @__PURE__ */ u((W, ot, Z, yt, at) => {
2615
- Z = F(Z, f.threshold), !(Math.abs(Z) < 1e-6) && y.push({ col: `${w}:${W}`, pair: ot, weight: Math.abs(Z), color: yt, layer: w, ...at });
2616
- }, "push"), z = /* @__PURE__ */ u((W, ot) => f.colors ? [f.colors[0], f.colors[1] ?? ki(f.colors[0])] : [W, ot], "signColors");
2617
- if (f.network) {
2618
- const W = E(f.network);
2619
- if (!W) return;
2620
- const [ot, Z] = z(_[0], _[1]), yt = { name: f.name ?? f.network };
2621
- x.forEach(({ col: at, pair: Ts }) => {
2622
- const ge = W[at] ?? 0;
2623
- N(at, Ts, ge, ge >= 0 ? ot : Z, yt);
2613
+ o.edgeLayers.forEach((p, w) => {
2614
+ const N = /* @__PURE__ */ u((X, ot, Q, xt, at) => {
2615
+ Q = F(Q, p.threshold), !(Math.abs(Q) < 1e-6) && y.push({ col: `${w}:${X}`, pair: ot, weight: Math.abs(Q), color: xt, layer: w, ...at });
2616
+ }, "push"), T = /* @__PURE__ */ u((X, ot) => p.colors ? [p.colors[0], p.colors[1] ?? Ci(p.colors[0])] : [X, ot], "signColors");
2617
+ if (p.network) {
2618
+ const X = M(p.network);
2619
+ if (!X) return;
2620
+ const [ot, Q] = T(_[0], _[1]), xt = { name: p.name ?? p.network };
2621
+ x.forEach(({ col: at, pair: zs }) => {
2622
+ const me = X[at] ?? 0;
2623
+ N(at, zs, me, me >= 0 ? ot : Q, xt);
2624
2624
  });
2625
2625
  return;
2626
2626
  }
2627
- const T = f.unit ?? f.group ?? null;
2628
- if (!T) return;
2629
- const I = b(T), Q = f.compare ?? f.also ?? null, G = Q ? b(Q) : null, nt = { name: f.name ?? T, group: f.group ?? void 0, unit: f.unit ?? void 0 }, [D, mt] = z(I.color, (G == null ? void 0 : G.color) ?? I.color);
2630
- G && f.compare ? x.forEach(({ col: W, pair: ot }) => {
2631
- const Z = (I.weights[W] ?? 0) - (G.weights[W] ?? 0);
2632
- N(W, ot, Z, Z > 0 ? D : mt, nt);
2633
- }) : G && f.also ? x.forEach(({ col: W, pair: ot }) => {
2634
- const Z = I.weights[W] ?? 0, yt = G.weights[W] ?? 0;
2635
- Z > 0 && N(W + "-a", ot, Z, D, nt), yt > 0 && N(W + "-b", ot, yt, mt, { ...nt, name: f.also ?? void 0, group: f.also ?? void 0 });
2636
- }) : x.forEach(({ col: W, pair: ot }) => {
2637
- const Z = I.weights[W] ?? 0;
2638
- Z > 0 && N(W, ot, Z, D, nt);
2627
+ const A = p.unit ?? p.group ?? null;
2628
+ if (!A) return;
2629
+ const z = b(A), V = p.compare ?? p.also ?? null, K = V ? b(V) : null, D = { name: p.name ?? A, group: p.group ?? void 0, unit: p.unit ?? void 0 }, [mt, ft] = T(z.color, (K == null ? void 0 : K.color) ?? z.color);
2630
+ K && p.compare ? x.forEach(({ col: X, pair: ot }) => {
2631
+ const Q = (z.weights[X] ?? 0) - (K.weights[X] ?? 0);
2632
+ N(X, ot, Q, Q > 0 ? mt : ft, D);
2633
+ }) : K && p.also ? x.forEach(({ col: X, pair: ot }) => {
2634
+ const Q = z.weights[X] ?? 0, xt = K.weights[X] ?? 0;
2635
+ Q > 0 && N(X + "-a", ot, Q, mt, D), xt > 0 && N(X + "-b", ot, xt, ft, { ...D, name: p.also ?? void 0, group: p.also ?? void 0 });
2636
+ }) : x.forEach(({ col: X, pair: ot }) => {
2637
+ const Q = z.weights[X] ?? 0;
2638
+ Q > 0 && N(X, ot, Q, mt, D);
2639
2639
  });
2640
- }), y.sort((f, w) => w.weight - f.weight);
2641
- const R = !!s.directed, X = xi(o.edgeWidth) * (o.edgeMagnify ?? 1), dt = /* @__PURE__ */ u((f) => {
2642
- const w = f.map(Math.abs).filter((N) => N > 0);
2640
+ }), y.sort((p, w) => w.weight - p.weight);
2641
+ const R = !!s.directed, H = wi(o.edgeWidth) * (o.edgeMagnify ?? 1), dt = /* @__PURE__ */ u((p) => {
2642
+ const w = p.map(Math.abs).filter((N) => N > 0);
2643
2643
  return w.length ? [Math.min(...w), Math.max(...w)] : [0, 0];
2644
- }, "rangeOf"), J = /* @__PURE__ */ u((f) => {
2644
+ }, "rangeOf"), Z = /* @__PURE__ */ u((p) => {
2645
2645
  const w = [];
2646
- return x.forEach(({ col: N, pair: z }) => {
2647
- if (z[0] === z[1] !== f) return;
2648
- const T = s.edges.col(N);
2649
- if (T) for (const I of T) w.push(Number(I));
2646
+ return x.forEach(({ col: N, pair: T }) => {
2647
+ if (T[0] === T[1] !== p) return;
2648
+ const A = s.edges.col(N);
2649
+ if (A) for (const z of A) w.push(Number(z));
2650
2650
  }), dt(w);
2651
- }, "modelRange"), _t = /* @__PURE__ */ u((f) => dt(y.filter((w) => w.pair[0] === w.pair[1] === f).map((w) => w.weight)), "plotRange"), L = o.edgeColorScale, kt = /* @__PURE__ */ u((f) => L === "plot" ? _t(f) : J(f), "colourRange"), bt = kt(!1), xt = kt(!0), Ct = /* @__PURE__ */ u((f, w) => {
2651
+ }, "modelRange"), _t = /* @__PURE__ */ u((p) => dt(y.filter((w) => w.pair[0] === w.pair[1] === p).map((w) => w.weight)), "plotRange"), L = o.edgeColorScale, Ct = /* @__PURE__ */ u((p) => L === "plot" ? _t(p) : Z(p), "colourRange"), yt = Ct(!1), wt = Ct(!0), Ot = /* @__PURE__ */ u((p, w) => {
2652
2652
  if (L === "absolute") {
2653
- const T = Math.min(1, Math.abs(f));
2654
- return { saturation: T, opacity: T };
2653
+ const A = Math.min(1, Math.abs(p));
2654
+ return { saturation: A, opacity: A };
2655
2655
  }
2656
- const [N, z] = w ? xt : bt;
2657
- return { saturation: Hs(f, N, z, di), opacity: Hs(f, N, z, gi) };
2658
- }, "colourOf"), Lt = {};
2659
- y.forEach(({ pair: f, weight: w }) => {
2660
- if (f[0] === f[1] && !R) return;
2661
- const z = /* @__PURE__ */ u((T) => {
2662
- Lt[T] = (Lt[T] ?? 0) + Math.abs(w);
2656
+ const [N, T] = w ? wt : yt;
2657
+ return { saturation: Xs(p, N, T, gi), opacity: Xs(p, N, T, mi) };
2658
+ }, "colourOf"), Dt = {};
2659
+ y.forEach(({ pair: p, weight: w }) => {
2660
+ if (p[0] === p[1] && !R) return;
2661
+ const T = /* @__PURE__ */ u((A) => {
2662
+ Dt[A] = (Dt[A] ?? 0) + Math.abs(w);
2663
2663
  }, "add");
2664
2664
  if (R) {
2665
- z(f[1]);
2665
+ T(p[1]);
2666
2666
  return;
2667
2667
  }
2668
- z(f[0]), z(f[1]);
2669
- }), s.nodes.rows().forEach((f) => {
2670
- const w = f.names.indexOf(a), N = w >= 0 ? String(f[w]) : "";
2668
+ T(p[0]), T(p[1]);
2669
+ }), s.nodes.rows().forEach((p) => {
2670
+ const w = p.names.indexOf(a), N = w >= 0 ? String(p[w]) : "";
2671
2671
  if (!N) return;
2672
- const z = gt.__data__.objects.get(N);
2673
- if (!z) return;
2674
- const T = Lt[N] ?? 0, I = !(T > 0);
2675
- z.size = I ? o.hideUnconnectedNodes ? 0 : yi : wi(T, X), z.meta = {
2676
- ...z.meta ?? {},
2677
- hidden: I && o.hideUnconnectedNodes
2672
+ const T = gt.__data__.objects.get(N);
2673
+ if (!T) return;
2674
+ const A = Dt[N] ?? 0, z = !(A > 0);
2675
+ T.size = z ? o.hideUnconnectedNodes ? 0 : xi : Ai(A, H), T.meta = {
2676
+ ...T.meta ?? {},
2677
+ hidden: z && o.hideUnconnectedNodes
2678
2678
  };
2679
2679
  });
2680
- const U = {};
2681
- R && y.forEach(({ pair: f, weight: w, layer: N }) => {
2682
- const z = `${N}:${f[0]}.${f[1]}`;
2683
- U[z] = (U[z] ?? 0) + w;
2684
- }), y.forEach(({ col: f, pair: w, weight: N, color: z, layer: T, name: I, group: Q, unit: G }) => {
2685
- const nt = gt.__data__.objects.get(w[0]), D = gt.__data__.objects.get(w[1]);
2686
- if (!nt || !D) return;
2687
- const mt = w[0] === w[1];
2688
- if (mt && !R) return;
2689
- const { saturation: W, opacity: ot } = Ct(N, mt), Z = new K({ ID: `${w[0]}-src`, dimensions: [nt.x, nt.y], meta: {} }), yt = new K({ ID: `${w[1]}-dst`, dimensions: [D.x, D.y], meta: {} });
2680
+ const U = {}, it = /* @__PURE__ */ u((p, w, N, T) => `${p}:${w ?? ""}:${N}.${T}`, "pairKey");
2681
+ R && y.forEach(({ pair: p, weight: w, layer: N, name: T }) => {
2682
+ const A = it(N, T, p[0], p[1]);
2683
+ U[A] = (U[A] ?? 0) + w;
2684
+ }), y.forEach(({ col: p, pair: w, weight: N, color: T, layer: A, name: z, group: V, unit: K }) => {
2685
+ const D = gt.__data__.objects.get(w[0]), mt = gt.__data__.objects.get(w[1]);
2686
+ if (!D || !mt) return;
2687
+ const ft = w[0] === w[1];
2688
+ if (ft && !R) return;
2689
+ const { saturation: X, opacity: ot } = Ot(N, ft), Q = new J({ ID: `${w[0]}-src`, dimensions: [D.x, D.y], meta: {} }), xt = new J({ ID: `${w[1]}-dst`, dimensions: [mt.x, mt.y], meta: {} });
2690
2690
  let at;
2691
- if (mt)
2692
- at = new se({}, Z, yt), at.weight = 0;
2691
+ if (ft)
2692
+ at = new ie({}, Q, xt), at.weight = 0;
2693
2693
  else if (R) {
2694
- const ge = U[`${T}:${w[0]}.${w[1]}`] ?? N, si = U[`${T}:${w[1]}.${w[0]}`] ?? 0, ii = ge + si;
2695
- at = new Ze(
2696
- { weight: N, totalweight: ii },
2697
- Z,
2698
- yt
2694
+ const me = U[it(A, z, w[0], w[1])] ?? N, ii = U[it(A, z, w[1], w[0])] ?? 0, ni = me + ii;
2695
+ at = new Qe(
2696
+ { weight: N, totalweight: ni },
2697
+ Q,
2698
+ xt
2699
2699
  );
2700
2700
  } else
2701
- at = new Bt({}, Z, yt);
2702
- at.ID = `edge-${f}`, at.color = new et(z), at.meta = {
2701
+ at = new Ht({}, Q, xt);
2702
+ at.ID = `edge-${p}`, at.color = new et(T), at.meta = {
2703
2703
  isMeanEdge: !0,
2704
2704
  weight: N,
2705
2705
  // Width per unit weight (extent units), shared by all marks.
2706
- widthFrac: X,
2707
- saturation: W,
2706
+ widthFrac: H,
2707
+ saturation: X,
2708
2708
  opacity: ot,
2709
2709
  isDirected: R,
2710
- isSelf: mt,
2710
+ isSelf: ft,
2711
2711
  // Identity for the qe-edge-* interaction events.
2712
2712
  source: w[0],
2713
2713
  target: w[1],
2714
- group: Q,
2715
- unit: G,
2716
- layer: I
2717
- }, (mt ? de ?? Wt : Wt).__data__.objects.set(at.ID, at);
2718
- }), Wt.__data__.__state__.setVariable("layer_updated", Wt.__data__), de && de.__data__.__state__.setVariable("layer_updated", de.__data__);
2714
+ group: V,
2715
+ unit: K,
2716
+ layer: z
2717
+ }, (ft ? ge ?? Vt : Vt).__data__.objects.set(at.ID, at);
2718
+ }), Vt.__data__.__state__.setVariable("layer_updated", Vt.__data__), ge && ge.__data__.__state__.setVariable("layer_updated", ge.__data__);
2719
2719
  }
2720
2720
  const C = o.showNodes;
2721
- gt.svg_element && (gt.svg_element.style.display = C ? "" : "none"), C || (this._nodeLabels.forEach((M) => M.remove()), this._nodeLabels.clear()), st && j !== 0 && C && (this._nodeLabels.forEach((M, $) => {
2722
- gt.__data__.objects.get($) || (M.remove(), this._nodeLabels.delete($));
2723
- }), s.nodes.rows().forEach((M) => {
2724
- var y, E, F;
2725
- const $ = M.names.indexOf(a), x = $ >= 0 ? String(M[$]) : "";
2721
+ gt.svg_element && (gt.svg_element.style.display = C ? "" : "none"), C || (this._nodeLabels.forEach((I) => I.remove()), this._nodeLabels.clear()), st && j !== 0 && C && (this._nodeLabels.forEach((I, O) => {
2722
+ gt.__data__.objects.get(O) || (I.remove(), this._nodeLabels.delete(O));
2723
+ }), s.nodes.rows().forEach((I) => {
2724
+ var y, M, F;
2725
+ const O = I.names.indexOf(a), x = O >= 0 ? String(I[O]) : "";
2726
2726
  if (!x) return;
2727
2727
  const m = gt.__data__.objects.get(x);
2728
2728
  if (!m) return;
2729
2729
  if ((y = m.meta) != null && y.hidden) {
2730
- (E = this._nodeLabels.get(x)) == null || E.remove(), this._nodeLabels.delete(x);
2730
+ (M = this._nodeLabels.get(x)) == null || M.remove(), this._nodeLabels.delete(x);
2731
2731
  return;
2732
2732
  }
2733
- const O = String(((F = m.meta) == null ? void 0 : F.name) ?? x);
2733
+ const $ = String(((F = m.meta) == null ? void 0 : F.name) ?? x);
2734
2734
  let b = this._nodeLabels.get(x);
2735
- b && b.text !== O && (b.remove(), this._nodeLabels.delete(x), b = void 0), b ? j === H.DISPLAY_TYPES.ON ? b.show() : b.hide() : (b = new Vt(O, m, st, this, j), this._nodeLabels.set(x, b));
2735
+ b && b.text !== $ && (b.remove(), this._nodeLabels.delete(x), b = void 0), b ? j === B.DISPLAY_TYPES.ON ? b.show() : b.hide() : (b = new Kt($, m, st, this, j), this._nodeLabels.set(x, b));
2736
2736
  })), gt.__data__.__state__.setVariable("layer_updated", gt.__data__);
2737
2737
  }
2738
- const xs = this.__children__.search("__children__", "axis_points"), ws = this.__children__.search("__children__", "axis_lines");
2739
- xs && this.__data__.__state__.setVariable("graph_updated_axis_points", xs.__data__.objects), ws && this.__data__.__state__.setVariable("graph_updated_axis_lines", ws.__data__.objects), this.update(), i && this._runTween(i);
2738
+ const ws = this.__children__.search("__children__", "axis_points"), As = this.__children__.search("__children__", "axis_lines");
2739
+ 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);
2740
2740
  });
2741
2741
  }
2742
2742
  static get observedAttributes() {
@@ -2783,22 +2783,22 @@ const ut = class ut extends we {
2783
2783
  _readLayerConfig() {
2784
2784
  var g;
2785
2785
  const t = this.querySelector("qe-nodes"), e = this.querySelector("qe-means"), s = [...this.querySelectorAll("qe-points")], i = s.find((c) => !c.hasAttribute("set")) ?? null, n = s.filter((c) => c.hasAttribute("set")), r = [...this.querySelectorAll("qe-edges")], a = /* @__PURE__ */ u((c) => {
2786
- var S;
2787
- return ((S = r.find((p) => p.hasAttribute(c))) == null ? void 0 : S.getAttribute(c)) ?? null;
2786
+ var E;
2787
+ return ((E = r.find((f) => f.hasAttribute(c))) == null ? void 0 : E.getAttribute(c)) ?? null;
2788
2788
  }, "firstAttr"), h = r.find((c) => c.hasAttribute("magnify")), o = this.querySelector("qe-trajectories"), l = this.querySelector("qe-axes"), _ = this.getAttribute("labels");
2789
2789
  return {
2790
2790
  // Nodes — always placed from the model (they anchor the coordinate
2791
2791
  // space); <qe-nodes> presence draws them, like every other layer.
2792
- labelNodes: Be(
2792
+ labelNodes: He(
2793
2793
  (t == null ? void 0 : t.getAttribute("label")) ?? this.getAttribute("label-nodes") ?? _,
2794
- H.DISPLAY_TYPES.ON
2794
+ B.DISPLAY_TYPES.ON
2795
2795
  ),
2796
2796
  showNodes: !!t,
2797
2797
  range: (() => {
2798
2798
  const c = this.getAttribute("range");
2799
2799
  if (c === "network" || c === "points") return c;
2800
- const S = Number(c);
2801
- return c != null && Number.isFinite(S) && S > 0 ? S : null;
2800
+ const E = Number(c);
2801
+ return c != null && Number.isFinite(E) && E > 0 ? E : null;
2802
2802
  })(),
2803
2803
  plotTitle: this.getAttribute("plot-title") || null,
2804
2804
  labelFont: {
@@ -2811,7 +2811,7 @@ const ut = class ut extends we {
2811
2811
  },
2812
2812
  edgeWidth: (() => {
2813
2813
  const c = Number(this.getAttribute("edge-width"));
2814
- return Number.isFinite(c) && c > 0 && c <= 1 ? c : ui;
2814
+ return Number.isFinite(c) && c > 0 && c <= 1 ? c : di;
2815
2815
  })(),
2816
2816
  hideUnconnectedNodes: ((g = t == null ? void 0 : t.getAttribute("unconnected")) == null ? void 0 : g.toLowerCase()) === "hide",
2817
2817
  scalePoints: this.getAttribute("scale-points") !== "false",
@@ -2830,9 +2830,9 @@ const ut = class ut extends we {
2830
2830
  return c === "box" || c === "crosshairs" || c === "none" ? c : e != null && e.hasAttribute("confidence") ? "box" : "none";
2831
2831
  })(),
2832
2832
  showOutlier: !!e && e.hasAttribute("outlier"),
2833
- labelMeans: Be(
2833
+ labelMeans: He(
2834
2834
  (e == null ? void 0 : e.getAttribute("label")) ?? this.getAttribute("label-means") ?? _,
2835
- H.DISPLAY_TYPES.ON
2835
+ B.DISPLAY_TYPES.ON
2836
2836
  ),
2837
2837
  // fixed-size keeps mean markers a constant on-screen px size (webENA parity).
2838
2838
  meanFixedSize: !!e && e.hasAttribute("fixed-size"),
@@ -2843,18 +2843,18 @@ const ut = class ut extends we {
2843
2843
  size: c.getAttribute("size") ? parseFloat(c.getAttribute("size")) : null,
2844
2844
  fixedSize: c.hasAttribute("fixed-size")
2845
2845
  })),
2846
- labelPoints: Be(
2846
+ labelPoints: He(
2847
2847
  (i == null ? void 0 : i.getAttribute("label")) ?? this.getAttribute("label-points") ?? _,
2848
- H.DISPLAY_TYPES.OFF
2848
+ B.DISPLAY_TYPES.OFF
2849
2849
  ),
2850
2850
  pointSize: i != null && i.getAttribute("size") ? parseFloat(i.getAttribute("size")) : null,
2851
2851
  // fixed-size keeps unit dots a constant on-screen px size (webENA parity).
2852
2852
  pointFixedSize: !!i && i.hasAttribute("fixed-size"),
2853
2853
  // Edges — presence of <qe-edges> = draw a network.
2854
2854
  showEdges: r.length > 0,
2855
- edgeLayers: r.map(Ni),
2855
+ edgeLayers: r.map(ki),
2856
2856
  // Plot-wide edge settings: the first <qe-edges> that sets them.
2857
- edgeColorScale: Ci(a("color-scale")),
2857
+ edgeColorScale: Oi(a("color-scale")),
2858
2858
  edgeMagnify: h ? (() => {
2859
2859
  const c = Number(h.getAttribute("magnify"));
2860
2860
  return Number.isFinite(c) && c > 0 ? c : 1;
@@ -3047,12 +3047,12 @@ const ut = class ut extends we {
3047
3047
  g.setAttribute("x1", String(r(c.x1, _.x1, l))), g.setAttribute("y1", String(r(c.y1, _.y1, l))), g.setAttribute("x2", String(r(c.x2, _.x2, l))), g.setAttribute("y2", String(r(c.y2, _.y2, l)));
3048
3048
  else {
3049
3049
  if (!c.nums || c.nums.length !== _.nums.length) return;
3050
- let S = 0;
3051
- const p = _.d.replace(
3050
+ let E = 0;
3051
+ const f = _.d.replace(
3052
3052
  ut._PATH_NUM_RE,
3053
- () => String(r(c.nums[S], _.nums[S++], l))
3053
+ () => String(r(c.nums[E], _.nums[E++], l))
3054
3054
  );
3055
- g.setAttribute("d", p);
3055
+ g.setAttribute("d", f);
3056
3056
  }
3057
3057
  }), this._tweenRaf = o < 1 ? requestAnimationFrame(a) : null;
3058
3058
  }, "step");
@@ -3180,8 +3180,8 @@ const ut = class ut extends we {
3180
3180
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
3181
3181
  o.setAttribute("d", `M0,0 L0,${i} L${s},${i / 2} z`), o.setAttribute("fill", a), h.appendChild(o), e.appendChild(h);
3182
3182
  }, "makeArrow");
3183
- return Ws.forEach((r) => n(`qe-arrow-${r.slice(1)}`, r)), t.appendChild(e), this.__data__.layers.forEach((r) => {
3184
- const a = new Qe(r, this.svg_element, this);
3183
+ return Vs.forEach((r) => n(`qe-arrow-${r.slice(1)}`, r)), t.appendChild(e), this.__data__.layers.forEach((r) => {
3184
+ const a = new ts(r, this.svg_element, this);
3185
3185
  this.__children__.push(a);
3186
3186
  }), this.__data__.__state__.setVariable("graph_updated", this.__data__), this.attach_events(), t;
3187
3187
  }
@@ -3208,7 +3208,7 @@ const ut = class ut extends we {
3208
3208
  const l = (c = (g = o.detail) == null ? void 0 : g.pointData) == null ? void 0 : c.ID;
3209
3209
  if (!l) return;
3210
3210
  const _ = this._pointLabels.get(l) ?? this._meanLabels.get(l.replace("mean-", "")) ?? this._nodeLabels.get(l);
3211
- _ && _.displayMode === H.DISPLAY_TYPES.CLICK && _.toggle();
3211
+ _ && _.displayMode === B.DISPLAY_TYPES.CLICK && _.toggle();
3212
3212
  }));
3213
3213
  const a = /* @__PURE__ */ u((o) => {
3214
3214
  var l;
@@ -3223,14 +3223,14 @@ const ut = class ut extends we {
3223
3223
  const l = a(o.target);
3224
3224
  if (!l) return;
3225
3225
  const _ = h(l);
3226
- (_ == null ? void 0 : _.displayMode) === H.DISPLAY_TYPES.AUTO && _.show();
3226
+ (_ == null ? void 0 : _.displayMode) === B.DISPLAY_TYPES.AUTO && _.show();
3227
3227
  }), this.svg_element.addEventListener("mouseout", (o) => {
3228
3228
  const l = a(o.target);
3229
3229
  if (!l) return;
3230
3230
  const _ = o.relatedTarget;
3231
3231
  if (a(_) === l) return;
3232
3232
  const c = h(l);
3233
- (c == null ? void 0 : c.displayMode) === H.DISPLAY_TYPES.AUTO && c.hide();
3233
+ (c == null ? void 0 : c.displayMode) === B.DISPLAY_TYPES.AUTO && c.hide();
3234
3234
  }), this._attachInteractionEvents();
3235
3235
  }
3236
3236
  /** Emit a namespaced CustomEvent on the public element (bubbles + composed). */
@@ -3386,7 +3386,7 @@ const ut = class ut extends we {
3386
3386
  const t = this.__data__;
3387
3387
  if (t.update_extremes(this._centerContent), this._rangeExtent && this._rangeExtent > 0) {
3388
3388
  const { cx: i, cy: n } = t.extremes, r = this._centerContent && this._rangeMode === "network" ? t.nodeExtentFrom(i, n) * 1.2 : this._rangeExtent;
3389
- t.extremes = new Ot(r, r, i, n);
3389
+ t.extremes = new Pt(r, r, i, n);
3390
3390
  }
3391
3391
  const e = (s = this.svg_element) == null ? void 0 : s.getBoundingClientRect();
3392
3392
  if (this.svg_element && e) {
@@ -3398,7 +3398,7 @@ const ut = class ut extends we {
3398
3398
  let a = r.objects.get("axis-x"), h = r.objects.get("axis-y");
3399
3399
  if (a && h) {
3400
3400
  const o = this.__data__.extremes;
3401
- 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"] });
3401
+ 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"] });
3402
3402
  }
3403
3403
  }
3404
3404
  }
@@ -3410,7 +3410,7 @@ const ut = class ut extends we {
3410
3410
  }
3411
3411
  };
3412
3412
  u(ut, "QEGraphElement"), ut.tagName = "qe-graph", ut.style = `
3413
- ${we.style}
3413
+ ${Ae.style}
3414
3414
 
3415
3415
  :host {
3416
3416
  display: block;
@@ -3428,38 +3428,38 @@ u(ut, "QEGraphElement"), ut.tagName = "qe-graph", ut.style = `
3428
3428
  background-color: #FFF;
3429
3429
  }
3430
3430
  `, ut._instances = /* @__PURE__ */ new Set(), ut._PATH_NUM_RE = /-?\d*\.?\d+(?:e[-+]?\d+)?/gi;
3431
- let Xt = ut;
3432
- customElements.define(Xt.tagName, Xt);
3433
- const Pi = /* @__PURE__ */ u((d) => Xt.getGraph(d), "getGraph"), Ri = /* @__PURE__ */ u(() => Xt.instances(), "getGraphs");
3431
+ let Wt = ut;
3432
+ customElements.define(Wt.tagName, Wt);
3433
+ const Ri = /* @__PURE__ */ u((d) => Wt.getGraph(d), "getGraph"), Li = /* @__PURE__ */ u(() => Wt.instances(), "getGraphs");
3434
3434
  export {
3435
3435
  et as Color,
3436
- Ft as DataFrame,
3437
- pe as DataFrameColumn,
3438
- ri as DataFrameColumnType,
3439
- Gt as DataFrameRow,
3440
- Se as Edge,
3441
- Ve as Graph,
3442
- Oe as QEAxesElement,
3443
- Ce as QEEdgesElement,
3444
- Xt as QEGraphElement,
3445
- Qe as QELayer,
3446
- wt as QELine,
3447
- Ne as QEMeansElement,
3448
- Ie as QENodesElement,
3449
- ne as QEPoint,
3450
- ke as QEPointsElement,
3436
+ jt as DataFrame,
3437
+ be as DataFrameColumn,
3438
+ oi as DataFrameColumnType,
3439
+ Bt as DataFrameRow,
3440
+ Ee as Edge,
3441
+ Ke as Graph,
3442
+ Pe as QEAxesElement,
3443
+ Oe as QEEdgesElement,
3444
+ Wt as QEGraphElement,
3445
+ ts as QELayer,
3446
+ At as QELine,
3447
+ ke as QEMeansElement,
3448
+ Ne as QENodesElement,
3449
+ re as QEPoint,
3450
+ Ce as QEPointsElement,
3451
3451
  $e as QETrajectoriesElement,
3452
- Me as QETrajectory,
3453
- be as QEVisualElement,
3454
- ai as TRAJECTORY_ZERO_EPS,
3455
- ve as Trajectory,
3456
- ye as WeightedColor,
3457
- _i as fitTrajectory,
3458
- Pi as getGraph,
3459
- Ri as getGraphs,
3460
- qs as nearOriginFilter,
3461
- Gs as sampleCurve,
3462
- ci as selectDegree,
3463
- Oi as vizENA
3452
+ Ie as QETrajectory,
3453
+ ye as QEVisualElement,
3454
+ hi as TRAJECTORY_ZERO_EPS,
3455
+ Se as Trajectory,
3456
+ xe as WeightedColor,
3457
+ ui as fitTrajectory,
3458
+ Ri as getGraph,
3459
+ Li as getGraphs,
3460
+ Us as nearOriginFilter,
3461
+ Bs as sampleCurve,
3462
+ _i as selectDegree,
3463
+ Pi as vizENA
3464
3464
  };
3465
3465
  //# sourceMappingURL=qeviz.es.js.map