viral-viewer-2 7.1.6 → 7.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { k as r, z as i, C as s, t as l, e as t, s as n, D as o, E as V, F as u, G as d, H as m, L as g, T as E, u as c, c as y, V as M, w as T, d as h, g as p, x as v, h as D, v as C, r as R, b, f, j as B, i as w, p as G, o as H, l as L, y as P, n as k, m as x, q as F } from "./index-COHsRNue.mjs";
1
+ import { k as r, z as i, C as s, t as l, e as t, s as n, D as o, E as V, F as u, G as d, H as m, L as g, T as E, u as c, c as y, V as M, w as T, d as h, g as p, x as v, h as D, v as C, r as R, b, f, j as B, i as w, p as G, o as H, l as L, y as P, n as k, m as x, q as F } from "./index-BcLyNWVF.mjs";
2
2
  export {
3
3
  r as BufferElement,
4
4
  i as CheckClashResult,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viral-viewer-2",
3
- "version": "7.1.6",
3
+ "version": "7.1.7",
4
4
  "description": "",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -1,109 +0,0 @@
1
- import { W as G } from "./index-COHsRNue.mjs";
2
- function C() {
3
- function W(s) {
4
- let r = 0;
5
- for (let t = 0; t < s.length; t++)
6
- r = (r << 5) - r + s.charCodeAt(t), r |= 0;
7
- return Math.abs(r);
8
- }
9
- function M(s) {
10
- const r = Math.sin(s) * 1e4;
11
- return r - Math.floor(r);
12
- }
13
- function p(s, r, t) {
14
- const d = (t == null ? void 0 : t.width) ?? 1e3, o = (t == null ? void 0 : t.height) ?? 1e3, f = (t == null ? void 0 : t.iterations) ?? 50, k = (t == null ? void 0 : t.boundaryShape) ?? "circular", v = s.length;
15
- if (v === 0)
16
- return /* @__PURE__ */ new Map();
17
- const b = d * o, w = Math.sqrt(b / v), x = /* @__PURE__ */ new Map();
18
- s.forEach((i) => {
19
- const c = (t == null ? void 0 : t.seed) ?? W(i.id);
20
- x.set(i.id, {
21
- x: M(c) * d,
22
- y: M(c * 2) * o,
23
- vx: 0,
24
- vy: 0
25
- });
26
- });
27
- let L = d / 10;
28
- const q = L / f;
29
- for (let i = 0; i < f; i++)
30
- i % Math.max(1, Math.floor(f / 10)) === 0 && self.postMessage({
31
- type: "progress",
32
- percent: Math.floor(i / f * 100),
33
- iteration: i,
34
- total: f
35
- }), s.forEach((c) => {
36
- const e = x.get(c.id);
37
- e.vx = 0, e.vy = 0, s.forEach((g) => {
38
- if (c.id === g.id)
39
- return;
40
- const h = x.get(g.id), n = e.x - h.x, y = e.y - h.y, u = n * n + y * y, a = Math.sqrt(u) || 1, l = w * w / a;
41
- e.vx += n / a * l, e.vy += y / a * l;
42
- });
43
- }), r.forEach((c) => {
44
- const e = String(c.source), g = String(c.target), h = x.get(e), n = x.get(g);
45
- if (!h || !n)
46
- return;
47
- const y = h.x - n.x, u = h.y - n.y, a = Math.sqrt(y * y + u * u) || 1, l = a * a / w, E = y / a * l, m = u / a * l;
48
- h.vx -= E, h.vy -= m, n.vx += E, n.vy += m;
49
- }), s.forEach((c) => {
50
- const e = x.get(c.id), g = Math.sqrt(e.vx * e.vx + e.vy * e.vy) || 1, h = Math.min(g, L);
51
- if (e.x += e.vx / g * h, e.y += e.vy / g * h, k === "circular") {
52
- const n = d / 2, y = o / 2, u = Math.min(d, o) / 2, a = e.x - n, l = e.y - y;
53
- if (Math.sqrt(a * a + l * l) > u) {
54
- const m = Math.atan2(l, a);
55
- e.x = n + u * Math.cos(m), e.y = y + u * Math.sin(m);
56
- }
57
- } else
58
- e.x = Math.max(0, Math.min(d, e.x)), e.y = Math.max(0, Math.min(o, e.y));
59
- }), L -= q;
60
- const S = /* @__PURE__ */ new Map();
61
- return x.forEach((i, c) => {
62
- S.set(c, { x: i.x, y: i.y });
63
- }), S;
64
- }
65
- self.onmessage = function(s) {
66
- try {
67
- console.log("[GraphLayout Worker] Received message");
68
- const { nodes: r, edges: t, options: d } = s.data;
69
- if (!r || !t) {
70
- console.error("[GraphLayout Worker] Missing nodes or edges"), self.postMessage({ error: "Missing nodes or edges" });
71
- return;
72
- }
73
- console.log("[GraphLayout Worker] Computing layout for", r.length, "nodes and", t.length, "edges");
74
- const o = p(r, t, d), f = {};
75
- o.forEach((k, v) => {
76
- f[v] = k;
77
- }), console.log("[GraphLayout Worker] Layout computation complete"), self.postMessage({ type: "complete", positions: f });
78
- } catch (r) {
79
- console.error("[GraphLayout Worker] Error:", r), self.postMessage({ error: String(r) });
80
- }
81
- };
82
- }
83
- const F = C;
84
- class R {
85
- constructor() {
86
- const M = new Blob([`(${F})()`]), p = URL.createObjectURL(M);
87
- this.workerPool = new G(2, p);
88
- }
89
- computeLayout(M, p, s, r, t) {
90
- const d = {
91
- nodes: M.map((o) => ({ id: o.id, group: o.group })),
92
- edges: p,
93
- options: s
94
- };
95
- this.workerPool.Enqueue(d, (o) => {
96
- if (o.error) {
97
- console.error("[GraphLayoutWorker] Error:", o.error);
98
- return;
99
- }
100
- o.type === "progress" && r ? r(o.percent) : o.type === "complete" && t && t(o.positions);
101
- });
102
- }
103
- dispose() {
104
- this.workerPool.dispose();
105
- }
106
- }
107
- export {
108
- R as GraphLayoutWorker
109
- };