Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | /** Graph model loading — node/edge graph from payload model. */ export const GRAPH_RUNTIME_MODEL = ` let nodes = []; let nodeById = new Map(); let edges = []; function nodeRadius(degree) { return Math.min(9, Math.max(4, 4 + Math.min(degree, 8) * 0.45)); } function applyModel(model) { nodes = (model.nodes || []).map((n) => ({ id: n.id, label: n.label || n.id, status: n.status || "", fileType: n.fileType || "", color: n.color || "", x: 0, y: 0, vx: 0, vy: 0, r: 5, pinned: false, })); nodeById = new Map(nodes.map((n) => [n.id, n])); edges = (model.edges || []) .filter((e) => nodeById.has(e.from) && nodeById.has(e.to)) .map((e) => ({ from: nodeById.get(e.from), to: nodeById.get(e.to) })); const degree = new Map(); for (const n of nodes) degree.set(n.id, 0); for (const e of edges) { degree.set(e.from.id, (degree.get(e.from.id) || 0) + 1); degree.set(e.to.id, (degree.get(e.to.id) || 0) + 1); } for (const n of nodes) { const deg = degree.get(n.id) || 0; n.deg = deg; n.r = nodeRadius(deg); } } function snapshotPositions() { const snap = new Map(); for (const n of nodes) snap.set(n.id, { x: n.x, y: n.y }); return snap; } function restorePositions(snap) { let restored = 0; for (const n of nodes) { const pos = snap.get(n.id); if (!pos) continue; n.x = pos.x; n.y = pos.y; n.vx = 0; n.vy = 0; restored++; } return restored; } `.trim() |