six-degrees 0.4.4 → 0.4.6

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.
Files changed (159) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/prerender-manifest.json +4 -4
  4. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  5. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  10. package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  14. package/.next/standalone/.next/server/app/api/admin-delete/route.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/api/admin-update/route.js.nft.json +1 -1
  16. package/.next/standalone/.next/server/app/api/bridges/route.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/api/bulk-import/route.js.nft.json +1 -1
  18. package/.next/standalone/.next/server/app/api/company-scores/legacy/route.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/api/company-scores/route.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/api/connections/route.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/api/data/export/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/data/import/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/data/restart/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/data/reveal/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/data/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/delete-cluster/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/ingest/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/network/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/outreach/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/queue/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/scraper/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/settings/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/settings/sector-preview/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/settings/sector-suggestions/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/setup-profile/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/social/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/unlock/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/update/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/update-images/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/users/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/avatars/[file]/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/import.html +1 -1
  44. package/.next/standalone/.next/server/app/import.rsc +1 -1
  45. package/.next/standalone/.next/server/app/import.segments/_full.segment.rsc +1 -1
  46. package/.next/standalone/.next/server/app/import.segments/_tree.segment.rsc +1 -1
  47. package/.next/standalone/.next/server/app/import.segments/import/__PAGE__.segment.rsc +1 -1
  48. package/.next/standalone/.next/server/app/index.html +1 -1
  49. package/.next/standalone/.next/server/app/index.rsc +2 -2
  50. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  51. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +2 -2
  52. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  53. package/.next/standalone/.next/server/app/launch.html +1 -1
  54. package/.next/standalone/.next/server/app/launch.rsc +1 -1
  55. package/.next/standalone/.next/server/app/launch.segments/_full.segment.rsc +1 -1
  56. package/.next/standalone/.next/server/app/launch.segments/_tree.segment.rsc +1 -1
  57. package/.next/standalone/.next/server/app/launch.segments/launch/__PAGE__.segment.rsc +1 -1
  58. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  60. package/.next/standalone/.next/server/app/paths/page.js.nft.json +1 -1
  61. package/.next/standalone/.next/server/app/paths/page_client-reference-manifest.js +1 -1
  62. package/.next/standalone/.next/server/app/paths.html +1 -1
  63. package/.next/standalone/.next/server/app/paths.rsc +2 -2
  64. package/.next/standalone/.next/server/app/paths.segments/_full.segment.rsc +2 -2
  65. package/.next/standalone/.next/server/app/paths.segments/_tree.segment.rsc +1 -1
  66. package/.next/standalone/.next/server/app/paths.segments/paths/__PAGE__.segment.rsc +2 -2
  67. package/.next/standalone/.next/server/app/profile.html +1 -1
  68. package/.next/standalone/.next/server/app/profile.rsc +1 -1
  69. package/.next/standalone/.next/server/app/profile.segments/_full.segment.rsc +1 -1
  70. package/.next/standalone/.next/server/app/profile.segments/_tree.segment.rsc +1 -1
  71. package/.next/standalone/.next/server/app/profile.segments/profile/__PAGE__.segment.rsc +1 -1
  72. package/.next/standalone/.next/server/app/queue.html +1 -1
  73. package/.next/standalone/.next/server/app/queue.rsc +1 -1
  74. package/.next/standalone/.next/server/app/queue.segments/_full.segment.rsc +1 -1
  75. package/.next/standalone/.next/server/app/queue.segments/_tree.segment.rsc +1 -1
  76. package/.next/standalone/.next/server/app/queue.segments/queue/__PAGE__.segment.rsc +1 -1
  77. package/.next/standalone/.next/server/app/scores.html +1 -1
  78. package/.next/standalone/.next/server/app/scores.rsc +1 -1
  79. package/.next/standalone/.next/server/app/scores.segments/_full.segment.rsc +1 -1
  80. package/.next/standalone/.next/server/app/scores.segments/_tree.segment.rsc +1 -1
  81. package/.next/standalone/.next/server/app/scores.segments/scores/__PAGE__.segment.rsc +1 -1
  82. package/.next/standalone/.next/server/app/settings.html +1 -1
  83. package/.next/standalone/.next/server/app/settings.rsc +1 -1
  84. package/.next/standalone/.next/server/app/settings.segments/_full.segment.rsc +1 -1
  85. package/.next/standalone/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  86. package/.next/standalone/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
  87. package/.next/standalone/.next/server/app/setup.html +1 -1
  88. package/.next/standalone/.next/server/app/setup.rsc +1 -1
  89. package/.next/standalone/.next/server/app/setup.segments/_full.segment.rsc +1 -1
  90. package/.next/standalone/.next/server/app/setup.segments/_tree.segment.rsc +1 -1
  91. package/.next/standalone/.next/server/app/setup.segments/setup/__PAGE__.segment.rsc +1 -1
  92. package/.next/standalone/.next/server/app/social/page.js.nft.json +1 -1
  93. package/.next/standalone/.next/server/app/social/page_client-reference-manifest.js +1 -1
  94. package/.next/standalone/.next/server/app/social.html +1 -1
  95. package/.next/standalone/.next/server/app/social.rsc +2 -2
  96. package/.next/standalone/.next/server/app/social.segments/_full.segment.rsc +2 -2
  97. package/.next/standalone/.next/server/app/social.segments/_tree.segment.rsc +1 -1
  98. package/.next/standalone/.next/server/app/social.segments/social/__PAGE__.segment.rsc +2 -2
  99. package/.next/standalone/.next/server/chunks/_1itd1o_._.js +1 -1
  100. package/.next/standalone/.next/server/chunks/lib_db-client_15le7cw.js +1 -1
  101. package/.next/standalone/.next/server/chunks/ssr/_0ezj4e0._.js +3 -0
  102. package/.next/standalone/.next/server/chunks/ssr/_14iv_zy._.js +3 -0
  103. package/.next/standalone/.next/server/chunks/ssr/_212xw8q._.js +3 -0
  104. package/.next/standalone/.next/server/chunks/ssr/_217nddo._.js +3 -0
  105. package/.next/standalone/.next/server/chunks/ssr/app_0i3fw_m._.js +3 -0
  106. package/.next/standalone/.next/server/chunks/ssr/app_page_1fazqbf.js +17 -4
  107. package/.next/standalone/.next/server/chunks/ssr/app_paths_page_1ol90m7.js +2 -2
  108. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  109. package/.next/standalone/.next/server/middleware-manifest.json +5 -5
  110. package/.next/standalone/.next/server/pages/404.html +1 -1
  111. package/.next/standalone/.next/server/pages/500.html +1 -1
  112. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  113. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  114. package/.next/standalone/.next/static/chunks/0y1yms5kez2f3.js +1 -0
  115. package/.next/standalone/.next/static/chunks/14m1zu-8warte.js +1 -0
  116. package/.next/standalone/.next/static/chunks/1e1n0kkz-psdb.js +1 -0
  117. package/.next/standalone/.next/static/chunks/2_zu7rmb8flzl.js +2 -0
  118. package/.next/standalone/.next/static/chunks/38wwtni5e1ec1.js +31 -0
  119. package/.next/standalone/CHANGELOG.md +29 -0
  120. package/.next/standalone/app/components/FilterPanel.js +6 -0
  121. package/.next/standalone/app/components/ForceGraph.js +257 -39
  122. package/.next/standalone/app/components/GalaxyLab.js +275 -0
  123. package/.next/standalone/app/social/page.js +4 -16
  124. package/.next/standalone/lib/galaxy-export.js +152 -0
  125. package/.next/standalone/lib/galaxy-lab.js +296 -0
  126. package/.next/standalone/package-lock.json +2 -2
  127. package/.next/standalone/package.json +1 -1
  128. package/.next/static/chunks/0y1yms5kez2f3.js +1 -0
  129. package/.next/static/chunks/14m1zu-8warte.js +1 -0
  130. package/.next/static/chunks/1e1n0kkz-psdb.js +1 -0
  131. package/.next/static/chunks/2_zu7rmb8flzl.js +2 -0
  132. package/.next/static/chunks/38wwtni5e1ec1.js +31 -0
  133. package/CHANGELOG.md +29 -0
  134. package/lib/galaxy-export.js +152 -0
  135. package/lib/galaxy-lab.js +296 -0
  136. package/package.json +1 -1
  137. package/.next/standalone/.next/server/chunks/ssr/_01f38ty._.js +0 -3
  138. package/.next/standalone/.next/server/chunks/ssr/_08_03wh._.js +0 -3
  139. package/.next/standalone/.next/server/chunks/ssr/_08cfj2b._.js +0 -3
  140. package/.next/standalone/.next/server/chunks/ssr/_1gpbbw9._.js +0 -3
  141. package/.next/standalone/.next/server/chunks/ssr/app_social_page_0h7zxda.js +0 -3
  142. package/.next/standalone/.next/static/chunks/0l1568qff0efj.js +0 -1
  143. package/.next/standalone/.next/static/chunks/1ra4cwcp75tfa.js +0 -1
  144. package/.next/standalone/.next/static/chunks/2hvcevue9aro4.js +0 -1
  145. package/.next/standalone/.next/static/chunks/2p5yt1o9tnxjn.js +0 -2
  146. package/.next/standalone/.next/static/chunks/2uo9i03_05rqi.js +0 -18
  147. package/.next/standalone/.next/static/chunks/3yc3rzp4dxvyo.js +0 -1
  148. package/.next/static/chunks/0l1568qff0efj.js +0 -1
  149. package/.next/static/chunks/1ra4cwcp75tfa.js +0 -1
  150. package/.next/static/chunks/2hvcevue9aro4.js +0 -1
  151. package/.next/static/chunks/2p5yt1o9tnxjn.js +0 -2
  152. package/.next/static/chunks/2uo9i03_05rqi.js +0 -18
  153. package/.next/static/chunks/3yc3rzp4dxvyo.js +0 -1
  154. /package/.next/standalone/.next/static/{VE8LeJXfD2H0_OgJxuJcm → -QUFjmCQWXW5PCoTA1G12}/_buildManifest.js +0 -0
  155. /package/.next/standalone/.next/static/{VE8LeJXfD2H0_OgJxuJcm → -QUFjmCQWXW5PCoTA1G12}/_clientMiddlewareManifest.js +0 -0
  156. /package/.next/standalone/.next/static/{VE8LeJXfD2H0_OgJxuJcm → -QUFjmCQWXW5PCoTA1G12}/_ssgManifest.js +0 -0
  157. /package/.next/static/{VE8LeJXfD2H0_OgJxuJcm → -QUFjmCQWXW5PCoTA1G12}/_buildManifest.js +0 -0
  158. /package/.next/static/{VE8LeJXfD2H0_OgJxuJcm → -QUFjmCQWXW5PCoTA1G12}/_clientMiddlewareManifest.js +0 -0
  159. /package/.next/static/{VE8LeJXfD2H0_OgJxuJcm → -QUFjmCQWXW5PCoTA1G12}/_ssgManifest.js +0 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.4.6] - 2026-09-29
10
+
11
+ ### Changed
12
+ - **The window's frame matches the app.** The title bar, menus and dialogs are dark by default,
13
+ even when your Mac is set to Light, so the frame no longer shows as a pale bar above the dark
14
+ app.
15
+
16
+ ## [0.4.5] - 2026-09-29
17
+
18
+ ### Added
19
+ - **Physics lab for the Galaxy (experimental, in Filters).** Sliders for the forces that lay the
20
+ Galaxy out, in the spirit of Obsidian's graph: *Gravity* (a pull in towards you), *Rings* (how
21
+ hard each tier holds its ring; at 0 the Galaxy finds its own shape), *Push*, *Pull* (how hard
22
+ each person pulls the people who came through them) and *Distance*, plus dot size, line
23
+ thickness, names, and dots sized by power score or by how many hang off them. *Clusters* sets
24
+ it up so each connection bunches their circle round them. Hovering a dot lights up its branch,
25
+ everyone behind it and the chain back to you. **Replay** plays your network growing by the
26
+ date you connected, with a time slider; each circle arrives with its connection. Everything
27
+ moves the Galaxy in place, and *Reset* puts today's layout back. The replay needs "connected
28
+ on" dates, so the sample network has nothing to replay.
29
+ - **More in the physics lab.** *Colour by* tier, degree, company (the eight most common) or
30
+ warmth (from the Social tab), with a legend to match. *Find* lights up everyone whose name,
31
+ company or role matches and dims the rest; Enter flies to the best one and opens their card.
32
+ The replay has a length (5 s to 1 min), *Loop*, your job starts and posts from the Social tab
33
+ marked on its timeline, and the job you were at in its date. *Saved layouts* keep slider
34
+ settings under a name. *Save a picture* makes a PNG of the Galaxy at twice the size, and
35
+ *Record the replay* saves it as a video.
36
+ - **Names on or off** for the Galaxy, in Filters.
37
+
9
38
  ## [0.4.4] - 2026-09-29
10
39
 
11
40
  ### Added
@@ -0,0 +1,152 @@
1
+ // Save the Galaxy as a picture, or record its replay as a video (the physics
2
+ // lab, experimental). The Galaxy registers its <svg> here while it's on screen;
3
+ // the lab's buttons call these. Nothing leaves the computer: the file is saved
4
+ // like any other download.
5
+
6
+ import { clockNow, setClock, play, pause } from './galaxy-lab.js';
7
+
8
+ let current = null; // { svg, stamp: () => text or null, legend: () => [[label, colour]] }
9
+
10
+ export function registerGalaxy(entry) {
11
+ current = entry;
12
+ return () => { if (current === entry) current = null; };
13
+ }
14
+
15
+ export const galaxyShown = () => current != null;
16
+
17
+ // The lab's highlight rules live in the page's CSS, which a picture of the
18
+ // <svg> alone doesn't carry, so they ride along inside it.
19
+ const EXPORT_CSS = `
20
+ .lab-focus .gn:not(.lit), .lab-focus .gl:not(.lit) { opacity: 0.06; }
21
+ .lab-focus .gl.lit { stroke-opacity: 0.7; }
22
+ .lab-focus .dot-rings, .lab-focus .catalyst-ring { opacity: 0.15; }
23
+ .lab-find .gn:not(.found), .lab-find .gl:not(.found) { opacity: 0.07; }
24
+ .lab-find .gn.found { stroke: #fff; stroke-width: 2px; }
25
+ `;
26
+
27
+ function svgImage(svg) {
28
+ const clone = svg.cloneNode(true);
29
+ clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
30
+ // The page's font, which the <svg> inherits on screen but not in a file.
31
+ clone.setAttribute('font-family', getComputedStyle(svg).fontFamily || 'system-ui, sans-serif');
32
+ const style = document.createElementNS('http://www.w3.org/2000/svg', 'style');
33
+ style.textContent = EXPORT_CSS;
34
+ clone.insertBefore(style, clone.firstChild);
35
+ const xml = new XMLSerializer().serializeToString(clone);
36
+ const img = new Image();
37
+ img.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(xml)}`;
38
+ return img.decode().then(() => img);
39
+ }
40
+
41
+ // One frame: the Galaxy, its date while a replay runs, the legend, and a small credit.
42
+ async function drawFrame(ctx, w, h) {
43
+ const img = await svgImage(current.svg);
44
+ ctx.fillStyle = '#0a0a1a';
45
+ ctx.fillRect(0, 0, w, h);
46
+ ctx.drawImage(img, 0, 0, w, h);
47
+ const scale = w / current.svg.clientWidth;
48
+ ctx.save();
49
+ ctx.scale(scale, scale);
50
+ const cw = w / scale;
51
+ const ch = h / scale;
52
+ const stamp = current.stamp();
53
+ if (stamp) {
54
+ ctx.font = '600 15px -apple-system, system-ui, sans-serif';
55
+ const tw = ctx.measureText(stamp).width;
56
+ ctx.fillStyle = 'rgba(10,15,30,0.85)';
57
+ ctx.beginPath();
58
+ ctx.roundRect?.(cw / 2 - tw / 2 - 16, ch - 52, tw + 32, 32, 16);
59
+ ctx.fill();
60
+ ctx.fillStyle = '#e6edf5';
61
+ ctx.textAlign = 'center';
62
+ ctx.fillText(stamp, cw / 2, ch - 31);
63
+ }
64
+ ctx.textAlign = 'left';
65
+ ctx.font = '11px -apple-system, system-ui, sans-serif';
66
+ let x = 20;
67
+ for (const [label, colour] of current.legend()) {
68
+ ctx.fillStyle = colour;
69
+ ctx.beginPath();
70
+ ctx.arc(x + 4, ch - 24, 4, 0, Math.PI * 2);
71
+ ctx.fill();
72
+ ctx.fillStyle = '#9aa';
73
+ ctx.fillText(label, x + 12, ch - 20);
74
+ x += 20 + ctx.measureText(label).width;
75
+ }
76
+ ctx.textAlign = 'right';
77
+ ctx.fillStyle = 'rgba(255,255,255,0.35)';
78
+ ctx.fillText('Six Degrees', cw - 16, 24);
79
+ ctx.restore();
80
+ }
81
+
82
+ function save(blob, name) {
83
+ const url = URL.createObjectURL(blob);
84
+ const a = document.createElement('a');
85
+ a.href = url;
86
+ a.download = name;
87
+ // Anything appended to <body> is position: fixed (TRAPS §29). Gone at once.
88
+ a.style.position = 'fixed';
89
+ a.style.left = '-9999px';
90
+ document.body.appendChild(a);
91
+ a.click();
92
+ a.remove();
93
+ setTimeout(() => URL.revokeObjectURL(url), 60000);
94
+ }
95
+
96
+ const today = () => new Date().toISOString().slice(0, 10);
97
+
98
+ function canvasFor(scale) {
99
+ const w = Math.round(current.svg.clientWidth * scale);
100
+ const h = Math.round(current.svg.clientHeight * scale);
101
+ const canvas = document.createElement('canvas');
102
+ canvas.width = w;
103
+ canvas.height = h;
104
+ return { canvas, ctx: canvas.getContext('2d'), w, h };
105
+ }
106
+
107
+ /** The Galaxy as it is on screen, at twice the size, as a PNG. */
108
+ export async function savePicture() {
109
+ if (!current) throw new Error('Open the Galaxy first.');
110
+ const { canvas, ctx, w, h } = canvasFor(2);
111
+ await drawFrame(ctx, w, h);
112
+ const blob = await new Promise((resolve) => canvas.toBlob(resolve, 'image/png'));
113
+ save(blob, `six-degrees-galaxy-${today()}.png`);
114
+ }
115
+
116
+ export const canRecord = () => typeof window !== 'undefined' && typeof window.MediaRecorder !== 'undefined'
117
+ && typeof HTMLCanvasElement !== 'undefined' && typeof HTMLCanvasElement.prototype.captureStream === 'function';
118
+
119
+ /**
120
+ * Plays the replay from the start and records it: a video the length of the
121
+ * replay, at 12 frames a second. Resolves when it's saved.
122
+ */
123
+ export async function recordReplay() {
124
+ if (!current) throw new Error('Open the Galaxy first.');
125
+ if (!canRecord()) throw new Error('This window can’t record video.');
126
+ const { canvas, ctx, w, h } = canvasFor(1);
127
+ const type = ['video/mp4;codecs=avc1', 'video/webm;codecs=vp9', 'video/webm', 'video/mp4'].find((t) => MediaRecorder.isTypeSupported(t));
128
+ if (!type) throw new Error('This window can’t record video.');
129
+ await drawFrame(ctx, w, h);
130
+ const recorder = new MediaRecorder(canvas.captureStream(12), { mimeType: type, videoBitsPerSecond: 6_000_000 });
131
+ const chunks = [];
132
+ recorder.ondataavailable = (e) => { if (e.data.size) chunks.push(e.data); };
133
+ const done = new Promise((resolve) => { recorder.onstop = resolve; });
134
+ recorder.start(250);
135
+ pause();
136
+ setClock({ at: clockNow().min });
137
+ play();
138
+ let drawing = false;
139
+ await new Promise((resolve) => {
140
+ const tick = setInterval(async () => {
141
+ if (drawing) return;
142
+ drawing = true;
143
+ try { await drawFrame(ctx, w, h); } finally { drawing = false; }
144
+ if (!clockNow().playing) { clearInterval(tick); setTimeout(resolve, 600); }
145
+ }, 1000 / 12);
146
+ });
147
+ await drawFrame(ctx, w, h);
148
+ recorder.stop();
149
+ await done;
150
+ const ext = type.startsWith('video/mp4') ? 'mp4' : 'webm';
151
+ save(new Blob(chunks, { type: type.split(';')[0] }), `six-degrees-replay-${today()}.${ext}`);
152
+ }
@@ -0,0 +1,296 @@
1
+ // The Galaxy's physics lab (experimental): Obsidian-style sliders for the forces
2
+ // that lay the Galaxy out, and a replay of your network growing by the date you
3
+ // connected. The Filter panel writes here (GalaxyLab.js); the Galaxy reads it
4
+ // (ForceGraph.js) and changes the running layout in place, never rebuilding.
5
+ //
6
+ // Two stores: the sliders, remembered in this browser, and the replay's clock,
7
+ // which isn't. Both follow useSyncExternalStore's rules: a snapshot only changes
8
+ // when something in it does.
9
+
10
+ import { keyFor } from './separation.js';
11
+ import { warmthOf } from './linkedin-export.js';
12
+
13
+ const KEY = 'six-degrees-galaxy-lab';
14
+ const LAYOUTS_KEY = 'six-degrees-galaxy-layouts';
15
+
16
+ /** The layout as it has always been. Every slider is a multiple of today's value, or 0 for off. */
17
+ export const LAB_DEFAULTS = Object.freeze({
18
+ on: false, // the lab is on: without it, the Galaxy ignores everything below
19
+ gravity: 0, // a pull on every dot towards you, in the middle
20
+ rings: 1, // how hard each tier (or degree) holds its ring; 0 lets it find its own shape
21
+ push: 15, // how hard dots push each other apart
22
+ pull: 1, // how hard each person pulls the people who came through them
23
+ distance: 1, // how far out those people sit
24
+ dotSize: 1,
25
+ lines: 1,
26
+ sizeBy: 'power', // 'power' (power score) or 'reach' (how many hang off them)
27
+ names: 'key', // 'key' (you, S tier, catalysts) or 'all' (all your connections)
28
+ branch: true, // hovering a dot lights up its branch and dims the rest
29
+ colourBy: 'tier', // 'tier', 'degree', 'company' or 'warmth' (from the Social tab)
30
+ speed: 15, // a replay's length, in seconds
31
+ loop: false, // start the replay again when it ends
32
+ labels: true, // names on the Galaxy at all: the Filter panel's switch, honoured with the lab off too
33
+ });
34
+
35
+ /** The slider settings a saved layout keeps (not whether the lab is on, nor the names switch). */
36
+ const LAYOUT_KEYS = ['gravity', 'rings', 'push', 'pull', 'distance', 'dotSize', 'lines', 'sizeBy', 'names', 'branch', 'colourBy', 'speed', 'loop'];
37
+
38
+ /** Let the layout find its own shape: no rings, each connection's circle bunched round them. */
39
+ export const CLUSTERS = Object.freeze({ gravity: 0.25, rings: 0, push: 25, pull: 2.5, distance: 0.35, sizeBy: 'reach' });
40
+
41
+ const listeners = new Set();
42
+ let cache = null;
43
+
44
+ function read() {
45
+ try {
46
+ const raw = JSON.parse(localStorage.getItem(KEY) || 'null');
47
+ return raw && typeof raw === 'object' ? { ...LAB_DEFAULTS, ...raw } : LAB_DEFAULTS;
48
+ } catch { return LAB_DEFAULTS; }
49
+ }
50
+
51
+ export function labNow() {
52
+ if (!cache) cache = read();
53
+ return cache;
54
+ }
55
+
56
+ export function setLab(patch) {
57
+ cache = patch === null ? { ...LAB_DEFAULTS, on: labNow().on, labels: labNow().labels } : { ...labNow(), ...patch };
58
+ try { localStorage.setItem(KEY, JSON.stringify(cache)); } catch {}
59
+ listeners.forEach((f) => f());
60
+ }
61
+
62
+ export function watchLab(f) {
63
+ listeners.add(f);
64
+ const other = (e) => { if (e.key === KEY) { cache = null; f(); } };
65
+ window.addEventListener('storage', other);
66
+ return () => { listeners.delete(f); window.removeEventListener('storage', other); };
67
+ }
68
+
69
+ /** What the Galaxy should use: the sliders while the lab is on, today's layout otherwise (with the names switch). */
70
+ export const effectiveLab = (lab) => (lab.on ? lab : lab.labels === LAB_DEFAULTS.labels ? LAB_DEFAULTS : { ...LAB_DEFAULTS, labels: lab.labels });
71
+
72
+ // Saved layouts: your own named slider settings, in this browser.
73
+ let layoutsCache = null;
74
+ const layoutListeners = new Set();
75
+ export function layoutsNow() {
76
+ if (!layoutsCache) {
77
+ try { layoutsCache = JSON.parse(localStorage.getItem(LAYOUTS_KEY) || '[]'); } catch { layoutsCache = []; }
78
+ if (!Array.isArray(layoutsCache)) layoutsCache = [];
79
+ }
80
+ return layoutsCache;
81
+ }
82
+ function writeLayouts(list) {
83
+ layoutsCache = list;
84
+ try { localStorage.setItem(LAYOUTS_KEY, JSON.stringify(list)); } catch {}
85
+ layoutListeners.forEach((f) => f());
86
+ }
87
+ export function watchLayouts(f) { layoutListeners.add(f); return () => layoutListeners.delete(f); }
88
+ export function saveLayout(name) {
89
+ const label = String(name || '').trim().slice(0, 40);
90
+ if (!label) return;
91
+ const lab = labNow();
92
+ const settings = Object.fromEntries(LAYOUT_KEYS.map((k) => [k, lab[k]]));
93
+ writeLayouts([...layoutsNow().filter((l) => l.name !== label), { name: label, settings }]);
94
+ }
95
+ export function applyLayout(name) {
96
+ const found = layoutsNow().find((l) => l.name === name);
97
+ if (found) setLab(Object.fromEntries(LAYOUT_KEYS.filter((k) => k in found.settings).map((k) => [k, found.settings[k]])));
98
+ }
99
+ export function forgetLayout(name) { writeLayouts(layoutsNow().filter((l) => l.name !== name)); }
100
+
101
+ // The replay's clock. `at` is a time in ms (null: everything shows); `min` and
102
+ // `max` are the first and last dates in the network on screen, set by the Galaxy
103
+ // (both null when it has no dates, as in the sample network).
104
+ // The same store holds the lab's other passing state: what Find is looking
105
+ // for (and a count that asks the Galaxy to fly to the first match), and the
106
+ // Social tab's data once it's loaded.
107
+ const clockListeners = new Set();
108
+ let clock = { at: null, playing: false, min: null, max: null, of: 0, find: '', fly: 0, found: 0, social: undefined };
109
+ let raf = null;
110
+
111
+ export const clockNow = () => clock;
112
+
113
+ export function watchClock(f) {
114
+ clockListeners.add(f);
115
+ return () => clockListeners.delete(f);
116
+ }
117
+
118
+ export function setClock(patch) {
119
+ const next = { ...clock, ...patch };
120
+ if (Object.keys(patch).every((k) => Object.is(next[k], clock[k]))) return;
121
+ clock = next;
122
+ clockListeners.forEach((f) => f());
123
+ }
124
+
125
+ /** Play from where the slider is (or the start) to the last date, over the lab's replay length. */
126
+ export function play() {
127
+ if (clock.min == null || clock.max == null || clock.max <= clock.min) return;
128
+ const span = clock.max - clock.min;
129
+ const REPLAY_MS = Math.max(1, Number(labNow().speed) || 15) * 1000;
130
+ const from = clock.at == null || clock.at >= clock.max ? clock.min : clock.at;
131
+ const started = performance.now() - ((from - clock.min) / span) * REPLAY_MS;
132
+ setClock({ at: from, playing: true });
133
+ const step = (now) => {
134
+ const at = Math.min(clock.max, clock.min + ((now - started) / REPLAY_MS) * span);
135
+ setClock({ at });
136
+ if (at >= clock.max) {
137
+ raf = null;
138
+ setClock({ playing: false });
139
+ if (labNow().loop) setTimeout(() => { if (!raf && clock.at === clock.max) { setClock({ at: clock.min }); play(); } }, 1200);
140
+ return;
141
+ }
142
+ raf = requestAnimationFrame(step);
143
+ };
144
+ cancelAnimationFrame(raf);
145
+ raf = requestAnimationFrame(step);
146
+ }
147
+
148
+ export function pause() {
149
+ cancelAnimationFrame(raf);
150
+ raf = null;
151
+ setClock({ playing: false });
152
+ }
153
+
154
+ /** Back to everything showing. */
155
+ export function stopReplay() {
156
+ pause();
157
+ setClock({ at: null });
158
+ }
159
+
160
+ /**
161
+ * When each dot appears in the replay: your connections on the day you
162
+ * connected, and everyone in a circle with the connection whose circle it is
163
+ * (they came with them). Undated connections are there from the start.
164
+ * `parentOf` maps an id to the id it hangs off, as the Galaxy draws it.
165
+ */
166
+ export function bornTimes(nodes, parentOf) {
167
+ const byId = new Map(nodes.map((n) => [n.id, n]));
168
+ const memo = new Map();
169
+ const bornOf = (n, depth = 0) => {
170
+ if (memo.has(n.id)) return memo.get(n.id);
171
+ let t = -Infinity;
172
+ const p = parentOf.get(n.id);
173
+ if (n.degree === 1 || p == null || depth > 6) {
174
+ const own = n.connected_date ? Date.parse(n.connected_date) : NaN;
175
+ t = Number.isNaN(own) ? -Infinity : own;
176
+ }
177
+ if (p != null && byId.has(p) && depth <= 6) t = Math.max(t, bornOf(byId.get(p), depth + 1));
178
+ memo.set(n.id, t);
179
+ return t;
180
+ };
181
+ return nodes.map((n) => bornOf(n));
182
+ }
183
+
184
+ /** How many hang off each dot, all the way down (not counting itself). */
185
+ export function reachCounts(nodes, parentOf) {
186
+ const out = new Map(nodes.map((n) => [n.id, 0]));
187
+ for (const n of nodes) {
188
+ let p = parentOf.get(n.id);
189
+ for (let hops = 0; p != null && hops < 7; hops++) {
190
+ out.set(p, (out.get(p) || 0) + 1);
191
+ p = parentOf.get(p);
192
+ }
193
+ }
194
+ return out;
195
+ }
196
+
197
+ /** The Social tab's data, loaded once: messages merged per profile, your jobs and your posts. */
198
+ let socialLoad = null;
199
+ export function loadSocial() {
200
+ if (!socialLoad) {
201
+ socialLoad = fetch('/api/social').then((r) => (r.ok ? r.json() : {})).then((d) => {
202
+ setClock({ social: d.social ? mergeSocial(d.social) : null });
203
+ }).catch(() => setClock({ social: null }));
204
+ }
205
+ return socialLoad;
206
+ }
207
+
208
+ /**
209
+ * The export and the live sync together, per profile key, and the "now" warmth
210
+ * is judged at: the newest thing the data knows, so an older export reads as it was.
211
+ */
212
+ export function mergeSocial(social) {
213
+ const merged = new Map();
214
+ for (const [url, v] of Object.entries(social?.people || {})) merged.set(keyFor({ profile_url: url }), { ...v });
215
+ for (const [url, v] of Object.entries(social?.live || {})) {
216
+ const k = keyFor({ profile_url: url });
217
+ const cur = merged.get(k) || { total: 0, recent: 0 };
218
+ if (v.last && (!cur.last || v.last > cur.last)) cur.last = v.last;
219
+ cur.unread = v.unread;
220
+ cur.total = Math.max(cur.total || 0, 1);
221
+ merged.set(k, cur);
222
+ }
223
+ let asOf = Math.max(social?.asOf || 0, social?.liveAt ? Date.parse(social.liveAt) || 0 : 0);
224
+ for (const v of merged.values()) if ((v.last || 0) > asOf) asOf = v.last;
225
+ return { merged, asOf, chapters: social?.chapters || [], posts: social?.posts?.posts || [] };
226
+ }
227
+
228
+ /** Your job starts and posts, oldest first, for the replay's timeline. */
229
+ export function milestones(social) {
230
+ const out = [];
231
+ for (const c of social?.chapters || []) if (Number.isFinite(c.from)) out.push({ t: c.from, kind: 'job', label: c.company });
232
+ for (const p of social?.posts || []) if (Number.isFinite(p.t)) out.push({ t: p.t, kind: 'post', label: 'You posted' });
233
+ return out.sort((a, b) => a.t - b.t);
234
+ }
235
+
236
+ /** Where you worked at a moment: the latest job started by then. */
237
+ export function chapterAt(social, t) {
238
+ let at = null;
239
+ for (const c of social?.chapters || []) if (Number.isFinite(c.from) && c.from <= t && (!at || c.from > at.from)) at = c;
240
+ return at && (!Number.isFinite(at.to) || at.to > t) ? at : null;
241
+ }
242
+
243
+ const DEGREE_COLOURS = { 1: '#4FC3F7', 2: '#BA68C8', 3: '#FFB74D' };
244
+ const COMPANY_COLOURS = ['#FF6B6B', '#4ECDC4', '#FFD93D', '#A29BFE', '#00B894', '#FD79A8', '#74B9FF', '#E17055'];
245
+ const WARMTH_COLOURS = { warm: '#FF7043', cool: '#4FC3F7', dormant: '#8D6E63', never: '#546E7A' };
246
+ const OTHER = '#4a5568';
247
+ const companyKey = (c) => String(c || '').trim().toLowerCase();
248
+
249
+ /**
250
+ * How to colour the Galaxy's dots, like Obsidian's groups: by tier (as it
251
+ * always has), degree, company (the eight most common, the rest grey) or, with
252
+ * the Social tab's data, how warm you are with each of your connections.
253
+ * Returns { of(person) -> colour, legend: [[label, colour]] }.
254
+ */
255
+ export function colourScheme(mode, people, tierColors, social) {
256
+ if (mode === 'degree') {
257
+ return {
258
+ of: (d) => DEGREE_COLOURS[Math.min(d.degree || 1, 3)],
259
+ legend: [['1st', DEGREE_COLOURS[1]], ['2nd', DEGREE_COLOURS[2]], ['3rd+', DEGREE_COLOURS[3]]],
260
+ };
261
+ }
262
+ if (mode === 'company') {
263
+ const counts = new Map();
264
+ for (const p of people) {
265
+ const k = companyKey(p.company);
266
+ if (!k) continue;
267
+ const c = counts.get(k) || { name: String(p.company).trim(), n: 0 };
268
+ c.n += 1;
269
+ counts.set(k, c);
270
+ }
271
+ const top = [...counts.entries()].filter(([, c]) => c.n > 1).sort((a, b) => b[1].n - a[1].n).slice(0, COMPANY_COLOURS.length);
272
+ const colour = new Map(top.map(([k], i) => [k, COMPANY_COLOURS[i]]));
273
+ return {
274
+ of: (d) => colour.get(companyKey(d.company)) || OTHER,
275
+ legend: [...top.map(([, c], i) => [c.name, COMPANY_COLOURS[i]]), ['Other', OTHER]],
276
+ };
277
+ }
278
+ if (mode === 'warmth' && social) {
279
+ return {
280
+ of: (d) => ((d.degree || 1) === 1 ? WARMTH_COLOURS[warmthOf(social.merged.get(keyFor(d)), social.asOf)] : '#2d3748'),
281
+ legend: [['Warm', WARMTH_COLOURS.warm], ['Cool', WARMTH_COLOURS.cool], ['Dormant', WARMTH_COLOURS.dormant], ['Never messaged', WARMTH_COLOURS.never]],
282
+ };
283
+ }
284
+ return { of: (d) => tierColors[d.tier] || '#666', legend: Object.entries(tierColors) };
285
+ }
286
+
287
+ /** Who Find matches: name, company, role or headline containing the text (2 letters or more). */
288
+ export function findMatches(nodes, query) {
289
+ const q = String(query || '').trim().toLowerCase();
290
+ if (q.length < 2) return null;
291
+ const hit = new Set();
292
+ for (const n of nodes) {
293
+ if ([n.name, n.company, n.role, n.headline].some((v) => v && String(v).toLowerCase().includes(q))) hit.add(n.id);
294
+ }
295
+ return hit;
296
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "six-degrees",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Map your professional network as a galaxy — leverage tiers, bridges into new circles, and the shortest path to anyone. Runs locally on your own data.",
5
5
  "license": "MIT",
6
6
  "author": "Blake Burford",
@@ -1,3 +0,0 @@
1
- module.exports=[61782,a=>{"use strict";var b=a.i(72131),c=a.i(37732);a.s(["default",0,function(){return(0,b.useSyncExternalStore)(c.watchScanner,c.scannerNow,()=>c.SCANNER_UNKNOWN)}])},74365,a=>{"use strict";var b=a.i(5760),c=a.i(7656),d=a.i(13868);function e(a){return a.x+a.vx}function f(a){return a.y+a.vy}a.s(["forceCollide",0,function(a){var g,h,i,j=1,k=1;function l(){for(var a,c,l,n,o,p,q,r=g.length,s=0;s<k;++s)for(c=(0,b.quadtree)(g,e,f).visitAfter(m),a=0;a<r;++a)q=(p=h[(l=g[a]).index])*p,n=l.x+l.vx,o=l.y+l.vy,c.visit(t);function t(a,b,c,e,f){var g=a.data,h=a.r,k=p+h;if(g){if(g.index>l.index){var m=n-g.x-g.vx,r=o-g.y-g.vy,s=m*m+r*r;s<k*k&&(0===m&&(s+=(m=(0,d.default)(i))*m),0===r&&(s+=(r=(0,d.default)(i))*r),s=(k-(s=Math.sqrt(s)))/s*j,l.vx+=(m*=s)*(k=(h*=h)/(q+h)),l.vy+=(r*=s)*k,g.vx-=m*(k=1-k),g.vy-=r*k)}return}return b>n+k||e<n-k||c>o+k||f<o-k}}function m(a){if(a.data)return a.r=h[a.data.index];for(var b=a.r=0;b<4;++b)a[b]&&a[b].r>a.r&&(a.r=a[b].r)}function n(){if(g){var b,c,d=g.length;for(h=Array(d),b=0;b<d;++b)h[(c=g[b]).index]=+a(c,b,g)}}return"function"!=typeof a&&(a=(0,c.default)(null==a?1:+a)),l.initialize=function(a,b){g=a,i=b,n()},l.iterations=function(a){return arguments.length?(k=+a,l):k},l.strength=function(a){return arguments.length?(j=+a,l):j},l.radius=function(b){return arguments.length?(a="function"==typeof b?b:(0,c.default)(+b),n(),l):a},l}],74365)},7656,13868,a=>{"use strict";a.s(["default",0,function(a){return function(){return a}}],7656),a.s(["default",0,function(a){return(a()-.5)*1e-6}],13868)},72243,a=>{"use strict";var b=a.i(7656),c=a.i(13868);function d(a){return a.index}function e(a,b){var c=a.get(b);if(!c)throw Error("node not found: "+b);return c}a.s(["forceLink",0,function(a){var f,g,h,i,j,k,l=d,m=function(a){return 1/Math.min(i[a.source.index],i[a.target.index])},n=(0,b.default)(30),o=1;function p(b){for(var d=0,e=a.length;d<o;++d)for(var h,i,l,m,n,p,q,r=0;r<e;++r)i=(h=a[r]).source,p=((p=Math.sqrt((m=(l=h.target).x+l.vx-i.x-i.vx||(0,c.default)(k))*m+(n=l.y+l.vy-i.y-i.vy||(0,c.default)(k))*n))-g[r])/p*b*f[r],m*=p,n*=p,l.vx-=m*(q=j[r]),l.vy-=n*q,i.vx+=m*(q=1-q),i.vy+=n*q}function q(){if(h){var b,c,d=h.length,k=a.length,m=new Map(h.map((a,b)=>[l(a,b,h),a]));for(b=0,i=Array(d);b<k;++b)(c=a[b]).index=b,"object"!=typeof c.source&&(c.source=e(m,c.source)),"object"!=typeof c.target&&(c.target=e(m,c.target)),i[c.source.index]=(i[c.source.index]||0)+1,i[c.target.index]=(i[c.target.index]||0)+1;for(b=0,j=Array(k);b<k;++b)c=a[b],j[b]=i[c.source.index]/(i[c.source.index]+i[c.target.index]);f=Array(k),r(),g=Array(k),s()}}function r(){if(h)for(var b=0,c=a.length;b<c;++b)f[b]=+m(a[b],b,a)}function s(){if(h)for(var b=0,c=a.length;b<c;++b)g[b]=+n(a[b],b,a)}return null==a&&(a=[]),p.initialize=function(a,b){h=a,k=b,q()},p.links=function(b){return arguments.length?(a=b,q(),p):a},p.id=function(a){return arguments.length?(l=a,p):l},p.iterations=function(a){return arguments.length?(o=+a,p):o},p.strength=function(a){return arguments.length?(m="function"==typeof a?a:(0,b.default)(+a),r(),p):m},p.distance=function(a){return arguments.length?(n="function"==typeof a?a:(0,b.default)(+a),s(),p):n},p}],72243)},11366,a=>{"use strict";var b=a.i(5760),c=a.i(7656),d=a.i(13868),e=a.i(24350);a.s(["forceManyBody",0,function(){var a,f,g,h,i,j=(0,c.default)(-30),k=1,l=1/0,m=.81;function n(c){var d,g=a.length,i=(0,b.quadtree)(a,e.x,e.y).visitAfter(p);for(h=c,d=0;d<g;++d)f=a[d],i.visit(q)}function o(){if(a){var b,c,d=a.length;for(i=Array(d),b=0;b<d;++b)i[(c=a[b]).index]=+j(c,b,a)}}function p(a){var b,c,d,e,f,g=0,h=0;if(a.length){for(d=e=f=0;f<4;++f)(b=a[f])&&(c=Math.abs(b.value))&&(g+=b.value,h+=c,d+=c*b.x,e+=c*b.y);a.x=d/h,a.y=e/h}else{(b=a).x=b.data.x,b.y=b.data.y;do g+=i[b.data.index];while(b=b.next)}a.value=g}function q(a,b,c,e){if(!a.value)return!0;var j=a.x-f.x,n=a.y-f.y,o=e-b,p=j*j+n*n;if(o*o/m<p)return p<l&&(0===j&&(p+=(j=(0,d.default)(g))*j),0===n&&(p+=(n=(0,d.default)(g))*n),p<k&&(p=Math.sqrt(k*p)),f.vx+=j*a.value*h/p,f.vy+=n*a.value*h/p),!0;if(!a.length&&!(p>=l)){(a.data!==f||a.next)&&(0===j&&(p+=(j=(0,d.default)(g))*j),0===n&&(p+=(n=(0,d.default)(g))*n),p<k&&(p=Math.sqrt(k*p)));do a.data!==f&&(o=i[a.data.index]*h/p,f.vx+=j*o,f.vy+=n*o);while(a=a.next)}}return n.initialize=function(b,c){a=b,g=c,o()},n.strength=function(a){return arguments.length?(j="function"==typeof a?a:(0,c.default)(+a),o(),n):j},n.distanceMin=function(a){return arguments.length?(k=a*a,n):Math.sqrt(k)},n.distanceMax=function(a){return arguments.length?(l=a*a,n):Math.sqrt(l)},n.theta=function(a){return arguments.length?(m=a*a,n):Math.sqrt(m)},n}],11366)},24350,a=>{"use strict";var b=a.i(55379),c=a.i(92907),d=Math.PI*(3-Math.sqrt(5));a.s(["default",0,function(a){let e;var f,g=1,h=.001,i=1-Math.pow(.001,1/300),j=0,k=.6,l=new Map,m=(0,c.timer)(p),n=(0,b.dispatch)("tick","end"),o=(e=1,()=>(e=(1664525*e+0x3c6ef35f)%0x100000000)/0x100000000);function p(){q(),n.call("tick",f),g<h&&(m.stop(),n.call("end",f))}function q(b){var c,d,e=a.length;void 0===b&&(b=1);for(var h=0;h<b;++h)for(g+=(j-g)*i,l.forEach(function(a){a(g)}),c=0;c<e;++c)null==(d=a[c]).fx?d.x+=d.vx*=k:(d.x=d.fx,d.vx=0),null==d.fy?d.y+=d.vy*=k:(d.y=d.fy,d.vy=0);return f}function r(){for(var b,c=0,e=a.length;c<e;++c){if((b=a[c]).index=c,null!=b.fx&&(b.x=b.fx),null!=b.fy&&(b.y=b.fy),isNaN(b.x)||isNaN(b.y)){var f=10*Math.sqrt(.5+c),g=c*d;b.x=f*Math.cos(g),b.y=f*Math.sin(g)}(isNaN(b.vx)||isNaN(b.vy))&&(b.vx=b.vy=0)}}function s(b){return b.initialize&&b.initialize(a,o),b}return null==a&&(a=[]),r(),f={tick:q,restart:function(){return m.restart(p),f},stop:function(){return m.stop(),f},nodes:function(b){return arguments.length?(a=b,r(),l.forEach(s),f):a},alpha:function(a){return arguments.length?(g=+a,f):g},alphaMin:function(a){return arguments.length?(h=+a,f):h},alphaDecay:function(a){return arguments.length?(i=+a,f):+i},alphaTarget:function(a){return arguments.length?(j=+a,f):j},velocityDecay:function(a){return arguments.length?(k=1-a,f):1-k},randomSource:function(a){return arguments.length?(o=a,l.forEach(s),f):o},force:function(a,b){return arguments.length>1?(null==b?l.delete(a):l.set(a,s(b)),f):l.get(a)},find:function(b,c,d){var e,f,g,h,i,j=0,k=a.length;for(null==d?d=1/0:d*=d,j=0;j<k;++j)(g=(e=b-(h=a[j]).x)*e+(f=c-h.y)*f)<d&&(i=h,d=g);return i},on:function(a,b){return arguments.length>1?(n.on(a,b),f):n.on(a)}}},"x",0,function(a){return a.x},"y",0,function(a){return a.y}],24350)},53877,a=>{"use strict";var b=a.i(24350);a.s(["forceSimulation",()=>b.default])},5760,a=>{"use strict";function b(a,b,c,d){if(isNaN(b)||isNaN(c))return a;var e,f,g,h,i,j,k,l,m,n=a._root,o={data:d},p=a._x0,q=a._y0,r=a._x1,s=a._y1;if(!n)return a._root=o,a;for(;n.length;)if((j=b>=(f=(p+r)/2))?p=f:r=f,(k=c>=(g=(q+s)/2))?q=g:s=g,e=n,!(n=n[l=k<<1|j]))return e[l]=o,a;if(h=+a._x.call(null,n.data),i=+a._y.call(null,n.data),b===h&&c===i)return o.next=n,e?e[l]=o:a._root=o,a;do e=e?e[l]=[,,,,]:a._root=[,,,,],(j=b>=(f=(p+r)/2))?p=f:r=f,(k=c>=(g=(q+s)/2))?q=g:s=g;while((l=k<<1|j)==(m=(i>=g)<<1|h>=f))return e[m]=n,e[l]=o,a}function c(a,b,c,d,e){this.node=a,this.x0=b,this.y0=c,this.x1=d,this.y1=e}function d(a){return a[0]}function e(a){return a[1]}function f(a,b,c){var f=new g(null==b?d:b,null==c?e:c,NaN,NaN,NaN,NaN);return null==a?f:f.addAll(a)}function g(a,b,c,d,e,f){this._x=a,this._y=b,this._x0=c,this._y0=d,this._x1=e,this._y1=f,this._root=void 0}function h(a){for(var b={data:a.data},c=b;a=a.next;)c=c.next={data:a.data};return b}var i=f.prototype=g.prototype;i.copy=function(){var a,b,c=new g(this._x,this._y,this._x0,this._y0,this._x1,this._y1),d=this._root;if(!d)return c;if(!d.length)return c._root=h(d),c;for(a=[{source:d,target:c._root=[,,,,]}];d=a.pop();)for(var e=0;e<4;++e)(b=d.source[e])&&(b.length?a.push({source:b,target:d.target[e]=[,,,,]}):d.target[e]=h(b));return c},i.add=function(a){let c=+this._x.call(null,a),d=+this._y.call(null,a);return b(this.cover(c,d),c,d,a)},i.addAll=function(a){var c,d,e,f,g=a.length,h=Array(g),i=Array(g),j=1/0,k=1/0,l=-1/0,m=-1/0;for(d=0;d<g;++d)!(isNaN(e=+this._x.call(null,c=a[d]))||isNaN(f=+this._y.call(null,c)))&&(h[d]=e,i[d]=f,e<j&&(j=e),e>l&&(l=e),f<k&&(k=f),f>m&&(m=f));if(j>l||k>m)return this;for(this.cover(j,k).cover(l,m),d=0;d<g;++d)b(this,h[d],i[d],a[d]);return this},i.cover=function(a,b){if(isNaN(a*=1)||isNaN(b*=1))return this;var c=this._x0,d=this._y0,e=this._x1,f=this._y1;if(isNaN(c))e=(c=Math.floor(a))+1,f=(d=Math.floor(b))+1;else{for(var g,h,i=e-c||1,j=this._root;c>a||a>=e||d>b||b>=f;)switch(h=(b<d)<<1|a<c,(g=[,,,,])[h]=j,j=g,i*=2,h){case 0:e=c+i,f=d+i;break;case 1:c=e-i,f=d+i;break;case 2:e=c+i,d=f-i;break;case 3:c=e-i,d=f-i}this._root&&this._root.length&&(this._root=j)}return this._x0=c,this._y0=d,this._x1=e,this._y1=f,this},i.data=function(){var a=[];return this.visit(function(b){if(!b.length)do a.push(b.data);while(b=b.next)}),a},i.extent=function(a){return arguments.length?this.cover(+a[0][0],+a[0][1]).cover(+a[1][0],+a[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},i.find=function(a,b,d){var e,f,g,h,i,j,k,l=this._x0,m=this._y0,n=this._x1,o=this._y1,p=[],q=this._root;for(q&&p.push(new c(q,l,m,n,o)),null==d?d=1/0:(l=a-d,m=b-d,n=a+d,o=b+d,d*=d);j=p.pop();)if((q=j.node)&&!((f=j.x0)>n)&&!((g=j.y0)>o)&&!((h=j.x1)<l)&&!((i=j.y1)<m))if(q.length){var r=(f+h)/2,s=(g+i)/2;p.push(new c(q[3],r,s,h,i),new c(q[2],f,s,r,i),new c(q[1],r,g,h,s),new c(q[0],f,g,r,s)),(k=(b>=s)<<1|a>=r)&&(j=p[p.length-1],p[p.length-1]=p[p.length-1-k],p[p.length-1-k]=j)}else{var t=a-this._x.call(null,q.data),u=b-this._y.call(null,q.data),v=t*t+u*u;if(v<d){var w=Math.sqrt(d=v);l=a-w,m=b-w,n=a+w,o=b+w,e=q.data}}return e},i.remove=function(a){if(isNaN(f=+this._x.call(null,a))||isNaN(g=+this._y.call(null,a)))return this;var b,c,d,e,f,g,h,i,j,k,l,m,n=this._root,o=this._x0,p=this._y0,q=this._x1,r=this._y1;if(!n)return this;if(n.length)for(;;){if((j=f>=(h=(o+q)/2))?o=h:q=h,(k=g>=(i=(p+r)/2))?p=i:r=i,b=n,!(n=n[l=k<<1|j]))return this;if(!n.length)break;(b[l+1&3]||b[l+2&3]||b[l+3&3])&&(c=b,m=l)}for(;n.data!==a;)if(d=n,!(n=n.next))return this;return((e=n.next)&&delete n.next,d)?e?d.next=e:delete d.next:b?(e?b[l]=e:delete b[l],(n=b[0]||b[1]||b[2]||b[3])&&n===(b[3]||b[2]||b[1]||b[0])&&!n.length&&(c?c[m]=n:this._root=n)):this._root=e,this},i.removeAll=function(a){for(var b=0,c=a.length;b<c;++b)this.remove(a[b]);return this},i.root=function(){return this._root},i.size=function(){var a=0;return this.visit(function(b){if(!b.length)do++a;while(b=b.next)}),a},i.visit=function(a){var b,d,e,f,g,h,i=[],j=this._root;for(j&&i.push(new c(j,this._x0,this._y0,this._x1,this._y1));b=i.pop();)if(!a(j=b.node,e=b.x0,f=b.y0,g=b.x1,h=b.y1)&&j.length){var k=(e+g)/2,l=(f+h)/2;(d=j[3])&&i.push(new c(d,k,l,g,h)),(d=j[2])&&i.push(new c(d,e,l,k,h)),(d=j[1])&&i.push(new c(d,k,f,g,l)),(d=j[0])&&i.push(new c(d,e,f,k,l))}return this},i.visitAfter=function(a){var b,d=[],e=[];for(this._root&&d.push(new c(this._root,this._x0,this._y0,this._x1,this._y1));b=d.pop();){var f=b.node;if(f.length){var g,h=b.x0,i=b.y0,j=b.x1,k=b.y1,l=(h+j)/2,m=(i+k)/2;(g=f[0])&&d.push(new c(g,h,i,l,m)),(g=f[1])&&d.push(new c(g,l,i,j,m)),(g=f[2])&&d.push(new c(g,h,m,l,k)),(g=f[3])&&d.push(new c(g,l,m,j,k))}e.push(b)}for(;b=e.pop();)a(b.node,b.x0,b.y0,b.x1,b.y1);return this},i.x=function(a){return arguments.length?(this._x=a,this):this._x},i.y=function(a){return arguments.length?(this._y=a,this):this._y},a.s(["quadtree",0,f],5760)},75930,55379,9782,14962,71731,20869,41063,92544,92907,13956,89004,29873,a=>{"use strict";a.s(["Selection",()=>U,"default",()=>W,"root",()=>T],14962);var b,c={value:()=>{}};function d(){for(var a,b=0,c=arguments.length,d={};b<c;++b){if(!(a=arguments[b]+"")||a in d||/[\s.]/.test(a))throw Error("illegal type: "+a);d[a]=[]}return new e(d)}function e(a){this._=a}function f(a,b,d){for(var e=0,f=a.length;e<f;++e)if(a[e].name===b){a[e]=c,a=a.slice(0,e).concat(a.slice(e+1));break}return null!=d&&a.push({name:b,value:d}),a}function g(){}function h(a){return null==a?g:function(){return this.querySelector(a)}}function i(a){return null==a?[]:Array.isArray(a)?a:Array.from(a)}function j(){return[]}function k(a){return null==a?j:function(){return this.querySelectorAll(a)}}function l(a){return function(){return this.matches(a)}}function m(a){return function(b){return b.matches(a)}}e.prototype=d.prototype={constructor:e,on:function(a,b){var c,d=this._,e=(a+"").trim().split(/^|\s+/).map(function(a){var b="",c=a.indexOf(".");if(c>=0&&(b=a.slice(c+1),a=a.slice(0,c)),a&&!d.hasOwnProperty(a))throw Error("unknown type: "+a);return{type:a,name:b}}),g=-1,h=e.length;if(arguments.length<2){for(;++g<h;)if((c=(a=e[g]).type)&&(c=function(a,b){for(var c,d=0,e=a.length;d<e;++d)if((c=a[d]).name===b)return c.value}(d[c],a.name)))return c;return}if(null!=b&&"function"!=typeof b)throw Error("invalid callback: "+b);for(;++g<h;)if(c=(a=e[g]).type)d[c]=f(d[c],a.name,b);else if(null==b)for(c in d)d[c]=f(d[c],a.name,null);return this},copy:function(){var a={},b=this._;for(var c in b)a[c]=b[c].slice();return new e(a)},call:function(a,b){if((c=arguments.length-2)>0)for(var c,d,e=Array(c),f=0;f<c;++f)e[f]=arguments[f+2];if(!this._.hasOwnProperty(a))throw Error("unknown type: "+a);for(d=this._[a],f=0,c=d.length;f<c;++f)d[f].value.apply(b,e)},apply:function(a,b,c){if(!this._.hasOwnProperty(a))throw Error("unknown type: "+a);for(var d=this._[a],e=0,f=d.length;e<f;++e)d[e].value.apply(b,c)}},a.s(["dispatch",0,d],55379),a.s(["default",0,i],9782);var n=Array.prototype.find;function o(){return this.firstElementChild}var p=Array.prototype.filter;function q(){return Array.from(this.children)}function r(a){return Array(a.length)}function s(a,b){this.ownerDocument=a.ownerDocument,this.namespaceURI=a.namespaceURI,this._next=null,this._parent=a,this.__data__=b}function t(a,b,c,d,e,f){for(var g,h=0,i=b.length,j=f.length;h<j;++h)(g=b[h])?(g.__data__=f[h],d[h]=g):c[h]=new s(a,f[h]);for(;h<i;++h)(g=b[h])&&(e[h]=g)}function u(a,b,c,d,e,f,g){var h,i,j,k=new Map,l=b.length,m=f.length,n=Array(l);for(h=0;h<l;++h)(i=b[h])&&(n[h]=j=g.call(i,i.__data__,h,b)+"",k.has(j)?e[h]=i:k.set(j,i));for(h=0;h<m;++h)j=g.call(a,f[h],h,f)+"",(i=k.get(j))?(d[h]=i,i.__data__=f[h],k.delete(j)):c[h]=new s(a,f[h]);for(h=0;h<l;++h)(i=b[h])&&k.get(n[h])===i&&(e[h]=i)}function v(a){return a.__data__}function w(a,b){return a<b?-1:a>b?1:a>=b?0:NaN}s.prototype={constructor:s,appendChild:function(a){return this._parent.insertBefore(a,this._next)},insertBefore:function(a,b){return this._parent.insertBefore(a,b)},querySelector:function(a){return this._parent.querySelector(a)},querySelectorAll:function(a){return this._parent.querySelectorAll(a)}};var x="http://www.w3.org/1999/xhtml";let y={svg:"http://www.w3.org/2000/svg",xhtml:x,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function z(a){var b=a+="",c=b.indexOf(":");return c>=0&&"xmlns"!==(b=a.slice(0,c))&&(a=a.slice(c+1)),y.hasOwnProperty(b)?{space:y[b],local:a}:a}function A(a){return a.ownerDocument&&a.ownerDocument.defaultView||a.document&&a||a.defaultView}function B(a,b){return a.style.getPropertyValue(b)||A(a).getComputedStyle(a,null).getPropertyValue(b)}function C(a){return a.trim().split(/^|\s+/)}function D(a){return a.classList||new E(a)}function E(a){this._node=a,this._names=C(a.getAttribute("class")||"")}function F(a,b){for(var c=D(a),d=-1,e=b.length;++d<e;)c.add(b[d])}function G(a,b){for(var c=D(a),d=-1,e=b.length;++d<e;)c.remove(b[d])}function H(){this.textContent=""}function I(){this.innerHTML=""}function J(){this.nextSibling&&this.parentNode.appendChild(this)}function K(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function L(a){var b=z(a);return(b.local?function(a){return function(){return this.ownerDocument.createElementNS(a.space,a.local)}}:function(a){return function(){var b=this.ownerDocument,c=this.namespaceURI;return c===x&&b.documentElement.namespaceURI===x?b.createElement(a):b.createElementNS(c,a)}})(b)}function M(){return null}function N(){var a=this.parentNode;a&&a.removeChild(this)}function O(){var a=this.cloneNode(!1),b=this.parentNode;return b?b.insertBefore(a,this.nextSibling):a}function P(){var a=this.cloneNode(!0),b=this.parentNode;return b?b.insertBefore(a,this.nextSibling):a}function Q(a){return function(){var b=this.__on;if(b){for(var c,d=0,e=-1,f=b.length;d<f;++d)(c=b[d],a.type&&c.type!==a.type||c.name!==a.name)?b[++e]=c:this.removeEventListener(c.type,c.listener,c.options);++e?b.length=e:delete this.__on}}}function R(a,b,c){return function(){var d,e=this.__on,f=function(a){b.call(this,a,this.__data__)};if(e){for(var g=0,h=e.length;g<h;++g)if((d=e[g]).type===a.type&&d.name===a.name){this.removeEventListener(d.type,d.listener,d.options),this.addEventListener(d.type,d.listener=f,d.options=c),d.value=b;return}}this.addEventListener(a.type,f,c),d={type:a.type,name:a.name,value:b,listener:f,options:c},e?e.push(d):this.__on=[d]}}function S(a,b,c){var d=A(a),e=d.CustomEvent;"function"==typeof e?e=new e(b,c):(e=d.document.createEvent("Event"),c?(e.initEvent(b,c.bubbles,c.cancelable),e.detail=c.detail):e.initEvent(b,!1,!1)),a.dispatchEvent(e)}E.prototype={add:function(a){0>this._names.indexOf(a)&&(this._names.push(a),this._node.setAttribute("class",this._names.join(" ")))},remove:function(a){var b=this._names.indexOf(a);b>=0&&(this._names.splice(b,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(a){return this._names.indexOf(a)>=0}};var T=[null];function U(a,b){this._groups=a,this._parents=b}function V(){return new U([[document.documentElement]],T)}U.prototype=V.prototype={constructor:U,select:function(a){"function"!=typeof a&&(a=h(a));for(var b=this._groups,c=b.length,d=Array(c),e=0;e<c;++e)for(var f,g,i=b[e],j=i.length,k=d[e]=Array(j),l=0;l<j;++l)(f=i[l])&&(g=a.call(f,f.__data__,l,i))&&("__data__"in f&&(g.__data__=f.__data__),k[l]=g);return new U(d,this._parents)},selectAll:function(a){if("function"==typeof a){var b;b=a,a=function(){return i(b.apply(this,arguments))}}else a=k(a);for(var c=this._groups,d=c.length,e=[],f=[],g=0;g<d;++g)for(var h,j=c[g],l=j.length,m=0;m<l;++m)(h=j[m])&&(e.push(a.call(h,h.__data__,m,j)),f.push(h));return new U(e,f)},selectChild:function(a){var b;return this.select(null==a?o:(b="function"==typeof a?a:m(a),function(){return n.call(this.children,b)}))},selectChildren:function(a){var b;return this.selectAll(null==a?q:(b="function"==typeof a?a:m(a),function(){return p.call(this.children,b)}))},filter:function(a){"function"!=typeof a&&(a=l(a));for(var b=this._groups,c=b.length,d=Array(c),e=0;e<c;++e)for(var f,g=b[e],h=g.length,i=d[e]=[],j=0;j<h;++j)(f=g[j])&&a.call(f,f.__data__,j,g)&&i.push(f);return new U(d,this._parents)},data:function(a,b){if(!arguments.length)return Array.from(this,v);var c=b?u:t,d=this._parents,e=this._groups;"function"!=typeof a&&(s=a,a=function(){return s});for(var f=e.length,g=Array(f),h=Array(f),i=Array(f),j=0;j<f;++j){var k=d[j],l=e[j],m=l.length,n="object"==typeof(r=a.call(k,k&&k.__data__,j,d))&&"length"in r?r:Array.from(r),o=n.length,p=h[j]=Array(o),q=g[j]=Array(o);c(k,l,p,q,i[j]=Array(m),n,b);for(var r,s,w,x,y=0,z=0;y<o;++y)if(w=p[y]){for(y>=z&&(z=y+1);!(x=q[z])&&++z<o;);w._next=x||null}}return(g=new U(g,d))._enter=h,g._exit=i,g},enter:function(){return new U(this._enter||this._groups.map(r),this._parents)},exit:function(){return new U(this._exit||this._groups.map(r),this._parents)},join:function(a,b,c){var d=this.enter(),e=this,f=this.exit();return"function"==typeof a?(d=a(d))&&(d=d.selection()):d=d.append(a+""),null!=b&&(e=b(e))&&(e=e.selection()),null==c?f.remove():c(f),d&&e?d.merge(e).order():e},merge:function(a){for(var b=a.selection?a.selection():a,c=this._groups,d=b._groups,e=c.length,f=d.length,g=Math.min(e,f),h=Array(e),i=0;i<g;++i)for(var j,k=c[i],l=d[i],m=k.length,n=h[i]=Array(m),o=0;o<m;++o)(j=k[o]||l[o])&&(n[o]=j);for(;i<e;++i)h[i]=c[i];return new U(h,this._parents)},selection:function(){return this},order:function(){for(var a=this._groups,b=-1,c=a.length;++b<c;)for(var d,e=a[b],f=e.length-1,g=e[f];--f>=0;)(d=e[f])&&(g&&4^d.compareDocumentPosition(g)&&g.parentNode.insertBefore(d,g),g=d);return this},sort:function(a){function b(b,c){return b&&c?a(b.__data__,c.__data__):!b-!c}a||(a=w);for(var c=this._groups,d=c.length,e=Array(d),f=0;f<d;++f){for(var g,h=c[f],i=h.length,j=e[f]=Array(i),k=0;k<i;++k)(g=h[k])&&(j[k]=g);j.sort(b)}return new U(e,this._parents).order()},call:function(){var a=arguments[0];return arguments[0]=this,a.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var a=this._groups,b=0,c=a.length;b<c;++b)for(var d=a[b],e=0,f=d.length;e<f;++e){var g=d[e];if(g)return g}return null},size:function(){let a=0;for(let b of this)++a;return a},empty:function(){return!this.node()},each:function(a){for(var b=this._groups,c=0,d=b.length;c<d;++c)for(var e,f=b[c],g=0,h=f.length;g<h;++g)(e=f[g])&&a.call(e,e.__data__,g,f);return this},attr:function(a,b){var c=z(a);if(arguments.length<2){var d=this.node();return c.local?d.getAttributeNS(c.space,c.local):d.getAttribute(c)}return this.each((null==b?c.local?function(a){return function(){this.removeAttributeNS(a.space,a.local)}}:function(a){return function(){this.removeAttribute(a)}}:"function"==typeof b?c.local?function(a,b){return function(){var c=b.apply(this,arguments);null==c?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}}:function(a,b){return function(){var c=b.apply(this,arguments);null==c?this.removeAttribute(a):this.setAttribute(a,c)}}:c.local?function(a,b){return function(){this.setAttributeNS(a.space,a.local,b)}}:function(a,b){return function(){this.setAttribute(a,b)}})(c,b))},style:function(a,b,c){return arguments.length>1?this.each((null==b?function(a){return function(){this.style.removeProperty(a)}}:"function"==typeof b?function(a,b,c){return function(){var d=b.apply(this,arguments);null==d?this.style.removeProperty(a):this.style.setProperty(a,d,c)}}:function(a,b,c){return function(){this.style.setProperty(a,b,c)}})(a,b,null==c?"":c)):B(this.node(),a)},property:function(a,b){return arguments.length>1?this.each((null==b?function(a){return function(){delete this[a]}}:"function"==typeof b?function(a,b){return function(){var c=b.apply(this,arguments);null==c?delete this[a]:this[a]=c}}:function(a,b){return function(){this[a]=b}})(a,b)):this.node()[a]},classed:function(a,b){var c=C(a+"");if(arguments.length<2){for(var d=D(this.node()),e=-1,f=c.length;++e<f;)if(!d.contains(c[e]))return!1;return!0}return this.each(("function"==typeof b?function(a,b){return function(){(b.apply(this,arguments)?F:G)(this,a)}}:b?function(a){return function(){F(this,a)}}:function(a){return function(){G(this,a)}})(c,b))},text:function(a){return arguments.length?this.each(null==a?H:("function"==typeof a?function(a){return function(){var b=a.apply(this,arguments);this.textContent=null==b?"":b}}:function(a){return function(){this.textContent=a}})(a)):this.node().textContent},html:function(a){return arguments.length?this.each(null==a?I:("function"==typeof a?function(a){return function(){var b=a.apply(this,arguments);this.innerHTML=null==b?"":b}}:function(a){return function(){this.innerHTML=a}})(a)):this.node().innerHTML},raise:function(){return this.each(J)},lower:function(){return this.each(K)},append:function(a){var b="function"==typeof a?a:L(a);return this.select(function(){return this.appendChild(b.apply(this,arguments))})},insert:function(a,b){var c="function"==typeof a?a:L(a),d=null==b?M:"function"==typeof b?b:h(b);return this.select(function(){return this.insertBefore(c.apply(this,arguments),d.apply(this,arguments)||null)})},remove:function(){return this.each(N)},clone:function(a){return this.select(a?P:O)},datum:function(a){return arguments.length?this.property("__data__",a):this.node().__data__},on:function(a,b,c){var d,e,f=(a+"").trim().split(/^|\s+/).map(function(a){var b="",c=a.indexOf(".");return c>=0&&(b=a.slice(c+1),a=a.slice(0,c)),{type:a,name:b}}),g=f.length;if(arguments.length<2){var h=this.node().__on;if(h){for(var i,j=0,k=h.length;j<k;++j)for(d=0,i=h[j];d<g;++d)if((e=f[d]).type===i.type&&e.name===i.name)return i.value}return}for(h=b?R:Q,d=0;d<g;++d)this.each(h(f[d],b,c));return this},dispatch:function(a,b){return this.each(("function"==typeof b?function(a,b){return function(){return S(this,a,b.apply(this,arguments))}}:function(a,b){return function(){return S(this,a,b)}})(a,b))},[Symbol.iterator]:function*(){for(var a=this._groups,b=0,c=a.length;b<c;++b)for(var d,e=a[b],f=0,g=e.length;f<g;++f)(d=e[f])&&(yield d)}};let W=V;function X(a){return"string"==typeof a?new U([[document.querySelector(a)]],[document.documentElement]):new U([[a]],T)}a.s(["select",0,X],71731);let Y={capture:!0,passive:!1};function Z(a){a.preventDefault(),a.stopImmediatePropagation()}function $(a){var b=a.document.documentElement,c=X(a).on("dragstart.drag",Z,Y);"onselectstart"in b?c.on("selectstart.drag",Z,Y):(b.__noselect=b.style.MozUserSelect,b.style.MozUserSelect="none")}function _(a,b){var c=a.document.documentElement,d=X(a).on("dragstart.drag",null);b&&(d.on("click.drag",Z,Y),setTimeout(function(){d.on("click.drag",null)},0)),"onselectstart"in c?d.on("selectstart.drag",null):(c.style.MozUserSelect=c.__noselect,delete c.__noselect)}function aa(a,b,c){a.prototype=b.prototype=c,c.constructor=a}function ab(a,b){var c=Object.create(a.prototype);for(var d in b)c[d]=b[d];return c}function ac(){}a.s(["default",0,Z,"nonpassive",0,{passive:!1},"nonpassivecapture",0,Y,"nopropagation",0,function(a){a.stopImmediatePropagation()}],20869),a.s(["default",0,$,"yesdrag",0,_],41063);var ad="\\s*([+-]?\\d+)\\s*",ae="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",af="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ag=/^#([0-9a-f]{3,8})$/,ah=RegExp(`^rgb\\(${ad},${ad},${ad}\\)$`),ai=RegExp(`^rgb\\(${af},${af},${af}\\)$`),aj=RegExp(`^rgba\\(${ad},${ad},${ad},${ae}\\)$`),ak=RegExp(`^rgba\\(${af},${af},${af},${ae}\\)$`),al=RegExp(`^hsl\\(${ae},${af},${af}\\)$`),am=RegExp(`^hsla\\(${ae},${af},${af},${ae}\\)$`),an={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function ao(){return this.rgb().formatHex()}function ap(){return this.rgb().formatRgb()}function aq(a){var b,c;return a=(a+"").trim().toLowerCase(),(b=ag.exec(a))?(c=b[1].length,b=parseInt(b[1],16),6===c?ar(b):3===c?new au(b>>8&15|b>>4&240,b>>4&15|240&b,(15&b)<<4|15&b,1):8===c?as(b>>24&255,b>>16&255,b>>8&255,(255&b)/255):4===c?as(b>>12&15|b>>8&240,b>>8&15|b>>4&240,b>>4&15|240&b,((15&b)<<4|15&b)/255):null):(b=ah.exec(a))?new au(b[1],b[2],b[3],1):(b=ai.exec(a))?new au(255*b[1]/100,255*b[2]/100,255*b[3]/100,1):(b=aj.exec(a))?as(b[1],b[2],b[3],b[4]):(b=ak.exec(a))?as(255*b[1]/100,255*b[2]/100,255*b[3]/100,b[4]):(b=al.exec(a))?aA(b[1],b[2]/100,b[3]/100,1):(b=am.exec(a))?aA(b[1],b[2]/100,b[3]/100,b[4]):an.hasOwnProperty(a)?ar(an[a]):"transparent"===a?new au(NaN,NaN,NaN,0):null}function ar(a){return new au(a>>16&255,a>>8&255,255&a,1)}function as(a,b,c,d){return d<=0&&(a=b=c=NaN),new au(a,b,c,d)}function at(a,b,c,d){var e;return 1==arguments.length?((e=a)instanceof ac||(e=aq(e)),e)?new au((e=e.rgb()).r,e.g,e.b,e.opacity):new au:new au(a,b,c,null==d?1:d)}function au(a,b,c,d){this.r=+a,this.g=+b,this.b=+c,this.opacity=+d}function av(){return`#${az(this.r)}${az(this.g)}${az(this.b)}`}function aw(){let a=ax(this.opacity);return`${1===a?"rgb(":"rgba("}${ay(this.r)}, ${ay(this.g)}, ${ay(this.b)}${1===a?")":`, ${a})`}`}function ax(a){return isNaN(a)?1:Math.max(0,Math.min(1,a))}function ay(a){return Math.max(0,Math.min(255,Math.round(a)||0))}function az(a){return((a=ay(a))<16?"0":"")+a.toString(16)}function aA(a,b,c,d){return d<=0?a=b=c=NaN:c<=0||c>=1?a=b=NaN:b<=0&&(a=NaN),new aC(a,b,c,d)}function aB(a){if(a instanceof aC)return new aC(a.h,a.s,a.l,a.opacity);if(a instanceof ac||(a=aq(a)),!a)return new aC;if(a instanceof aC)return a;var b=(a=a.rgb()).r/255,c=a.g/255,d=a.b/255,e=Math.min(b,c,d),f=Math.max(b,c,d),g=NaN,h=f-e,i=(f+e)/2;return h?(g=b===f?(c-d)/h+(c<d)*6:c===f?(d-b)/h+2:(b-c)/h+4,h/=i<.5?f+e:2-f-e,g*=60):h=i>0&&i<1?0:g,new aC(g,h,i,a.opacity)}function aC(a,b,c,d){this.h=+a,this.s=+b,this.l=+c,this.opacity=+d}function aD(a){return(a=(a||0)%360)<0?a+360:a}function aE(a){return Math.max(0,Math.min(1,a||0))}function aF(a,b,c){return(a<60?b+(c-b)*a/60:a<180?c:a<240?b+(c-b)*(240-a)/60:b)*255}function aG(a,b,c,d,e){var f=a*a,g=f*a;return((1-3*a+3*f-g)*b+(4-6*f+3*g)*c+(1+3*a+3*f-3*g)*d+g*e)/6}aa(ac,aq,{copy(a){return Object.assign(new this.constructor,this,a)},displayable(){return this.rgb().displayable()},hex:ao,formatHex:ao,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return aB(this).formatHsl()},formatRgb:ap,toString:ap}),aa(au,at,ab(ac,{brighter(a){return a=null==a?1.4285714285714286:Math.pow(1.4285714285714286,a),new au(this.r*a,this.g*a,this.b*a,this.opacity)},darker(a){return a=null==a?.7:Math.pow(.7,a),new au(this.r*a,this.g*a,this.b*a,this.opacity)},rgb(){return this},clamp(){return new au(ay(this.r),ay(this.g),ay(this.b),ax(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:av,formatHex:av,formatHex8:function(){return`#${az(this.r)}${az(this.g)}${az(this.b)}${az((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:aw,toString:aw})),aa(aC,function(a,b,c,d){return 1==arguments.length?aB(a):new aC(a,b,c,null==d?1:d)},ab(ac,{brighter(a){return a=null==a?1.4285714285714286:Math.pow(1.4285714285714286,a),new aC(this.h,this.s,this.l*a,this.opacity)},darker(a){return a=null==a?.7:Math.pow(.7,a),new aC(this.h,this.s,this.l*a,this.opacity)},rgb(){var a=this.h%360+(this.h<0)*360,b=isNaN(a)||isNaN(this.s)?0:this.s,c=this.l,d=c+(c<.5?c:1-c)*b,e=2*c-d;return new au(aF(a>=240?a-240:a+120,e,d),aF(a,e,d),aF(a<120?a+240:a-120,e,d),this.opacity)},clamp(){return new aC(aD(this.h),aE(this.s),aE(this.l),ax(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let a=ax(this.opacity);return`${1===a?"hsl(":"hsla("}${aD(this.h)}, ${100*aE(this.s)}%, ${100*aE(this.l)}%${1===a?")":`, ${a})`}`}}));let aH=a=>()=>a;function aI(a,b){var c=b-a;return c?function(b){return a+b*c}:aH(isNaN(a)?b:a)}let aJ=function a(b){var c,d=1==(c=+b)?aI:function(a,b){var d,e,f;return b-a?(d=a,e=b,d=Math.pow(d,f=c),e=Math.pow(e,f)-d,f=1/f,function(a){return Math.pow(d+a*e,f)}):aH(isNaN(a)?b:a)};function e(a,b){var c=d((a=at(a)).r,(b=at(b)).r),e=d(a.g,b.g),f=d(a.b,b.b),g=aI(a.opacity,b.opacity);return function(b){return a.r=c(b),a.g=e(b),a.b=f(b),a.opacity=g(b),a+""}}return e.gamma=a,e}(1);function aK(a){return function(b){var c,d,e=b.length,f=Array(e),g=Array(e),h=Array(e);for(c=0;c<e;++c)d=at(b[c]),f[c]=d.r||0,g[c]=d.g||0,h[c]=d.b||0;return f=a(f),g=a(g),h=a(h),d.opacity=1,function(a){return d.r=f(a),d.g=g(a),d.b=h(a),d+""}}}function aL(a,b){return a*=1,b*=1,function(c){return a*(1-c)+b*c}}aK(function(a){var b=a.length-1;return function(c){var d=c<=0?c=0:c>=1?(c=1,b-1):Math.floor(c*b),e=a[d],f=a[d+1],g=d>0?a[d-1]:2*e-f,h=d<b-1?a[d+2]:2*f-e;return aG((c-d/b)*b,g,e,f,h)}}),aK(function(a){var b=a.length;return function(c){var d=Math.floor(((c%=1)<0?++c:c)*b),e=a[(d+b-1)%b],f=a[d%b],g=a[(d+1)%b],h=a[(d+2)%b];return aG((c-d/b)*b,e,f,g,h)}});var aM=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,aN=RegExp(aM.source,"g");function aO(a,b){if(a=function(a){let b;for(;b=a.sourceEvent;)a=b;return a}(a),void 0===b&&(b=a.currentTarget),b){var c=b.ownerSVGElement||b;if(c.createSVGPoint){var d=c.createSVGPoint();return d.x=a.clientX,d.y=a.clientY,[(d=d.matrixTransform(b.getScreenCTM().inverse())).x,d.y]}if(b.getBoundingClientRect){var e=b.getBoundingClientRect();return[a.clientX-e.left-b.clientLeft,a.clientY-e.top-b.clientTop]}}return[a.pageX,a.pageY]}a.s(["pointer",0,aO],92544);var aP,aQ,aR=0,aS=0,aT=0,aU=0,aV=0,aW=0,aX="object"==typeof performance&&performance.now?performance:Date,aY=function(a){setTimeout(a,17)};function aZ(){return aV||(aY(a$),aV=aX.now()+aW)}function a$(){aV=0}function a_(){this._call=this._time=this._next=null}function a0(a,b,c){var d=new a_;return d.restart(a,b,c),d}function a1(){aV=(aU=aX.now())+aW,aR=aS=0;try{aZ(),++aR;for(var a,b=aP;b;)(a=aV-b._time)>=0&&b._call.call(void 0,a),b=b._next;--aR}finally{aR=0,function(){for(var a,b,c=aP,d=1/0;c;)c._call?(d>c._time&&(d=c._time),a=c,c=c._next):(b=c._next,c._next=null,c=a?a._next=b:aP=b);aQ=a,a3(d)}(),aV=0}}function a2(){var a=aX.now(),b=a-aU;b>1e3&&(aW-=b,aU=a)}function a3(a){!aR&&(aS&&(aS=clearTimeout(aS)),a-aV>24?(a<1/0&&(aS=setTimeout(a1,a-aX.now()-aW)),aT&&(aT=clearInterval(aT))):(aT||(aU=aX.now(),aT=setInterval(a2,1e3)),aR=1,aY(a1)))}function a4(a,b,c){var d=new a_;return b=null==b?0:+b,d.restart(c=>{d.stop(),a(c+b)},b,c),d}a_.prototype=a0.prototype={constructor:a_,restart:function(a,b,c){if("function"!=typeof a)throw TypeError("callback is not a function");c=(null==c?aZ():+c)+(null==b?0:+b),this._next||aQ===this||(aQ?aQ._next=this:aP=this,aQ=this),this._call=a,this._time=c,a3()},stop:function(){this._call&&(this._call=null,this._time=1/0,a3())}},a.s(["Timer",0,a_,"now",0,aZ,"timer",0,a0],92907);var a5=d("start","end","cancel","interrupt"),a6=[];function a7(a,b,c,d,e,f){var g=a.__transition;if(g){if(c in g)return}else a.__transition={};!function(a,b,c){var d,e=a.__transition;function f(i){var j,k,l,m;if(1!==c.state)return h();for(j in e)if((m=e[j]).name===c.name){if(3===m.state)return a4(f);4===m.state?(m.state=6,m.timer.stop(),m.on.call("interrupt",a,a.__data__,m.index,m.group),delete e[j]):+j<b&&(m.state=6,m.timer.stop(),m.on.call("cancel",a,a.__data__,m.index,m.group),delete e[j])}if(a4(function(){3===c.state&&(c.state=4,c.timer.restart(g,c.delay,c.time),g(i))}),c.state=2,c.on.call("start",a,a.__data__,c.index,c.group),2===c.state){for(c.state=3,d=Array(l=c.tween.length),j=0,k=-1;j<l;++j)(m=c.tween[j].value.call(a,a.__data__,c.index,c.group))&&(d[++k]=m);d.length=k+1}}function g(b){for(var e=b<c.duration?c.ease.call(null,b/c.duration):(c.timer.restart(h),c.state=5,1),f=-1,g=d.length;++f<g;)d[f].call(a,e);5===c.state&&(c.on.call("end",a,a.__data__,c.index,c.group),h())}function h(){for(var d in c.state=6,c.timer.stop(),delete e[b],e)return;delete a.__transition}e[b]=c,c.timer=a0(function(a){c.state=1,c.timer.restart(f,c.delay,c.time),c.delay<=a&&f(a-c.delay)},0,c.time)}(a,c,{name:b,index:d,group:e,on:a5,tween:a6,time:f.time,delay:f.delay,duration:f.duration,ease:f.ease,timer:null,state:0})}function a8(a,b){var c=ba(a,b);if(c.state>0)throw Error("too late; already scheduled");return c}function a9(a,b){var c=ba(a,b);if(c.state>3)throw Error("too late; already running");return c}function ba(a,b){var c=a.__transition;if(!c||!(c=c[b]))throw Error("transition not found");return c}function bb(a,b){var c,d,e,f=a.__transition,g=!0;if(f){for(e in b=null==b?null:b+"",f){if((c=f[e]).name!==b){g=!1;continue}d=c.state>2&&c.state<5,c.state=6,c.timer.stop(),c.on.call(d?"interrupt":"cancel",a,a.__data__,c.index,c.group),delete f[e]}g&&delete a.__transition}}var bc=180/Math.PI,bd={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function be(a,b,c,d,e,f){var g,h,i;return(g=Math.sqrt(a*a+b*b))&&(a/=g,b/=g),(i=a*c+b*d)&&(c-=a*i,d-=b*i),(h=Math.sqrt(c*c+d*d))&&(c/=h,d/=h,i/=h),a*d<b*c&&(a=-a,b=-b,i=-i,g=-g),{translateX:e,translateY:f,rotate:Math.atan2(b,a)*bc,skewX:Math.atan(i)*bc,scaleX:g,scaleY:h}}function bf(a,b,c,d){function e(a){return a.length?a.pop()+" ":""}return function(f,g){var h,i,j,k,l=[],m=[];return f=a(f),g=a(g),!function(a,d,e,f,g,h){if(a!==e||d!==f){var i=g.push("translate(",null,b,null,c);h.push({i:i-4,x:aL(a,e)},{i:i-2,x:aL(d,f)})}else(e||f)&&g.push("translate("+e+b+f+c)}(f.translateX,f.translateY,g.translateX,g.translateY,l,m),h=f.rotate,i=g.rotate,h!==i?(h-i>180?i+=360:i-h>180&&(h+=360),m.push({i:l.push(e(l)+"rotate(",null,d)-2,x:aL(h,i)})):i&&l.push(e(l)+"rotate("+i+d),j=f.skewX,k=g.skewX,j!==k?m.push({i:l.push(e(l)+"skewX(",null,d)-2,x:aL(j,k)}):k&&l.push(e(l)+"skewX("+k+d),!function(a,b,c,d,f,g){if(a!==c||b!==d){var h=f.push(e(f)+"scale(",null,",",null,")");g.push({i:h-4,x:aL(a,c)},{i:h-2,x:aL(b,d)})}else(1!==c||1!==d)&&f.push(e(f)+"scale("+c+","+d+")")}(f.scaleX,f.scaleY,g.scaleX,g.scaleY,l,m),f=g=null,function(a){for(var b,c=-1,d=m.length;++c<d;)l[(b=m[c]).i]=b.x(a);return l.join("")}}}var bg=bf(function(a){let b=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(a+"");return b.isIdentity?bd:be(b.a,b.b,b.c,b.d,b.e,b.f)},"px, ","px)","deg)"),bh=bf(function(a){return null==a?bd:(b||(b=document.createElementNS("http://www.w3.org/2000/svg","g")),b.setAttribute("transform",a),a=b.transform.baseVal.consolidate())?be((a=a.matrix).a,a.b,a.c,a.d,a.e,a.f):bd},", ",")",")");function bi(a,b,c){var d=a._id;return a.each(function(){var a=a9(this,d);(a.value||(a.value={}))[b]=c.apply(this,arguments)}),function(a){return ba(a,d).value[b]}}function bj(a,b){var c;return("number"==typeof b?aL:b instanceof aq?aJ:(c=aq(b))?(b=c,aJ):function(a,b){var c,d,e,f,g,h=aM.lastIndex=aN.lastIndex=0,i=-1,j=[],k=[];for(a+="",b+="";(e=aM.exec(a))&&(f=aN.exec(b));)(g=f.index)>h&&(g=b.slice(h,g),j[i]?j[i]+=g:j[++i]=g),(e=e[0])===(f=f[0])?j[i]?j[i]+=f:j[++i]=f:(j[++i]=null,k.push({i:i,x:aL(e,f)})),h=aN.lastIndex;return h<b.length&&(g=b.slice(h),j[i]?j[i]+=g:j[++i]=g),j.length<2?k[0]?(c=k[0].x,function(a){return c(a)+""}):(d=b,function(){return d}):(b=k.length,function(a){for(var c,d=0;d<b;++d)j[(c=k[d]).i]=c.x(a);return j.join("")})})(a,b)}var bk=W.prototype.constructor;function bl(a){return function(){this.style.removeProperty(a)}}var bm=0;function bn(a,b,c,d){this._groups=a,this._parents=b,this._name=c,this._id=d}var bo=W.prototype;function bp(a){return((a*=2)<=1?a*a*a:(a-=2)*a*a+2)/2}bn.prototype=(function(a){return W().transition(a)}).prototype={constructor:bn,select:function(a){var b=this._name,c=this._id;"function"!=typeof a&&(a=h(a));for(var d=this._groups,e=d.length,f=Array(e),g=0;g<e;++g)for(var i,j,k=d[g],l=k.length,m=f[g]=Array(l),n=0;n<l;++n)(i=k[n])&&(j=a.call(i,i.__data__,n,k))&&("__data__"in i&&(j.__data__=i.__data__),m[n]=j,a7(m[n],b,c,n,m,ba(i,c)));return new bn(f,this._parents,b,c)},selectAll:function(a){var b=this._name,c=this._id;"function"!=typeof a&&(a=k(a));for(var d=this._groups,e=d.length,f=[],g=[],h=0;h<e;++h)for(var i,j=d[h],l=j.length,m=0;m<l;++m)if(i=j[m]){for(var n,o=a.call(i,i.__data__,m,j),p=ba(i,c),q=0,r=o.length;q<r;++q)(n=o[q])&&a7(n,b,c,q,o,p);f.push(o),g.push(i)}return new bn(f,g,b,c)},selectChild:bo.selectChild,selectChildren:bo.selectChildren,filter:function(a){"function"!=typeof a&&(a=l(a));for(var b=this._groups,c=b.length,d=Array(c),e=0;e<c;++e)for(var f,g=b[e],h=g.length,i=d[e]=[],j=0;j<h;++j)(f=g[j])&&a.call(f,f.__data__,j,g)&&i.push(f);return new bn(d,this._parents,this._name,this._id)},merge:function(a){if(a._id!==this._id)throw Error();for(var b=this._groups,c=a._groups,d=b.length,e=c.length,f=Math.min(d,e),g=Array(d),h=0;h<f;++h)for(var i,j=b[h],k=c[h],l=j.length,m=g[h]=Array(l),n=0;n<l;++n)(i=j[n]||k[n])&&(m[n]=i);for(;h<d;++h)g[h]=b[h];return new bn(g,this._parents,this._name,this._id)},selection:function(){return new bk(this._groups,this._parents)},transition:function(){for(var a=this._name,b=this._id,c=++bm,d=this._groups,e=d.length,f=0;f<e;++f)for(var g,h=d[f],i=h.length,j=0;j<i;++j)if(g=h[j]){var k=ba(g,b);a7(g,a,c,j,h,{time:k.time+k.delay+k.duration,delay:0,duration:k.duration,ease:k.ease})}return new bn(d,this._parents,a,c)},call:bo.call,nodes:bo.nodes,node:bo.node,size:bo.size,empty:bo.empty,each:bo.each,on:function(a,b){var c,d,e,f,g,h,i=this._id;return arguments.length<2?ba(this.node(),i).on.on(a):this.each((c=i,d=a,e=b,h=(d+"").trim().split(/^|\s+/).every(function(a){var b=a.indexOf(".");return b>=0&&(a=a.slice(0,b)),!a||"start"===a})?a8:a9,function(){var a=h(this,c),b=a.on;b!==f&&(g=(f=b).copy()).on(d,e),a.on=g}))},attr:function(a,b){var c=z(a),d="transform"===c?bh:bj;return this.attrTween(a,"function"==typeof b?(c.local?function(a,b,c){var d,e,f;return function(){var g,h,i=c(this);return null==i?void this.removeAttributeNS(a.space,a.local):(g=this.getAttributeNS(a.space,a.local))===(h=i+"")?null:g===d&&h===e?f:(e=h,f=b(d=g,i))}}:function(a,b,c){var d,e,f;return function(){var g,h,i=c(this);return null==i?void this.removeAttribute(a):(g=this.getAttribute(a))===(h=i+"")?null:g===d&&h===e?f:(e=h,f=b(d=g,i))}})(c,d,bi(this,"attr."+a,b)):null==b?(c.local?function(a){return function(){this.removeAttributeNS(a.space,a.local)}}:function(a){return function(){this.removeAttribute(a)}})(c):(c.local?function(a,b,c){var d,e,f=c+"";return function(){var g=this.getAttributeNS(a.space,a.local);return g===f?null:g===d?e:e=b(d=g,c)}}:function(a,b,c){var d,e,f=c+"";return function(){var g=this.getAttribute(a);return g===f?null:g===d?e:e=b(d=g,c)}})(c,d,b))},attrTween:function(a,b){var c="attr."+a;if(arguments.length<2)return(c=this.tween(c))&&c._value;if(null==b)return this.tween(c,null);if("function"!=typeof b)throw Error();var d=z(a);return this.tween(c,(d.local?function(a,b){var c,d;function e(){var e=b.apply(this,arguments);return e!==d&&(c=(d=e)&&function(b){this.setAttributeNS(a.space,a.local,e.call(this,b))}),c}return e._value=b,e}:function(a,b){var c,d;function e(){var e=b.apply(this,arguments);return e!==d&&(c=(d=e)&&function(b){this.setAttribute(a,e.call(this,b))}),c}return e._value=b,e})(d,b))},style:function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y="transform"==(a+="")?bg:bj;return null==b?this.styleTween(a,(d=a,function(){var a=B(this,d),b=(this.style.removeProperty(d),B(this,d));return a===b?null:a===e&&b===f?g:g=y(e=a,f=b)})).on("end.style."+a,bl(a)):"function"==typeof b?this.styleTween(a,(h=a,i=bi(this,"style."+a,b),function(){var a=B(this,h),b=i(this),c=b+"";return null==b&&(this.style.removeProperty(h),c=b=B(this,h)),a===c?null:a===j&&c===k?l:(k=c,l=y(j=a,b))})).each((m=this._id,t="end."+(s="style."+(n=a)),function(){var a=a9(this,m),b=a.on,c=null==a.value[s]?r||(r=bl(n)):void 0;(b!==o||q!==c)&&(p=(o=b).copy()).on(t,q=c),a.on=p})):this.styleTween(a,(u=a,x=b+"",function(){var a=B(this,u);return a===x?null:a===v?w:w=y(v=a,b)}),c).on("end.style."+a,null)},styleTween:function(a,b,c){var d="style."+(a+="");if(arguments.length<2)return(d=this.tween(d))&&d._value;if(null==b)return this.tween(d,null);if("function"!=typeof b)throw Error();return this.tween(d,function(a,b,c){var d,e;function f(){var f=b.apply(this,arguments);return f!==e&&(d=(e=f)&&function(b){this.style.setProperty(a,f.call(this,b),c)}),d}return f._value=b,f}(a,b,null==c?"":c))},text:function(a){var b,c;return this.tween("text","function"==typeof a?(b=bi(this,"text",a),function(){var a=b(this);this.textContent=null==a?"":a}):(c=null==a?"":a+"",function(){this.textContent=c}))},textTween:function(a){var b="text";if(arguments.length<1)return(b=this.tween(b))&&b._value;if(null==a)return this.tween(b,null);if("function"!=typeof a)throw Error();return this.tween(b,function(a){var b,c;function d(){var d=a.apply(this,arguments);return d!==c&&(b=(c=d)&&function(a){this.textContent=d.call(this,a)}),b}return d._value=a,d}(a))},remove:function(){var a;return this.on("end.remove",(a=this._id,function(){var b=this.parentNode;for(var c in this.__transition)if(+c!==a)return;b&&b.removeChild(this)}))},tween:function(a,b){var c=this._id;if(a+="",arguments.length<2){for(var d,e=ba(this.node(),c).tween,f=0,g=e.length;f<g;++f)if((d=e[f]).name===a)return d.value;return null}return this.each((null==b?function(a,b){var c,d;return function(){var e=a9(this,a),f=e.tween;if(f!==c){d=c=f;for(var g=0,h=d.length;g<h;++g)if(d[g].name===b){(d=d.slice()).splice(g,1);break}}e.tween=d}}:function(a,b,c){var d,e;if("function"!=typeof c)throw Error();return function(){var f=a9(this,a),g=f.tween;if(g!==d){e=(d=g).slice();for(var h={name:b,value:c},i=0,j=e.length;i<j;++i)if(e[i].name===b){e[i]=h;break}i===j&&e.push(h)}f.tween=e}})(c,a,b))},delay:function(a){var b=this._id;return arguments.length?this.each(("function"==typeof a?function(a,b){return function(){a8(this,a).delay=+b.apply(this,arguments)}}:function(a,b){return b*=1,function(){a8(this,a).delay=b}})(b,a)):ba(this.node(),b).delay},duration:function(a){var b=this._id;return arguments.length?this.each(("function"==typeof a?function(a,b){return function(){a9(this,a).duration=+b.apply(this,arguments)}}:function(a,b){return b*=1,function(){a9(this,a).duration=b}})(b,a)):ba(this.node(),b).duration},ease:function(a){var b=this._id;return arguments.length?this.each(function(a,b){if("function"!=typeof b)throw Error();return function(){a9(this,a).ease=b}}(b,a)):ba(this.node(),b).ease},easeVarying:function(a){var b;if("function"!=typeof a)throw Error();return this.each((b=this._id,function(){var c=a.apply(this,arguments);if("function"!=typeof c)throw Error();a9(this,b).ease=c}))},end:function(){var a,b,c=this,d=c._id,e=c.size();return new Promise(function(f,g){var h={value:g},i={value:function(){0==--e&&f()}};c.each(function(){var c=a9(this,d),e=c.on;e!==a&&((b=(a=e).copy())._.cancel.push(h),b._.interrupt.push(h),b._.end.push(i)),c.on=b}),0===e&&f()})},[Symbol.iterator]:bo[Symbol.iterator]},a.s(["cubicInOut",0,bp,"cubicOut",0,function(a){return--a*a*a+1}],13956);var bq={time:null,delay:0,duration:250,ease:bp};W.prototype.interrupt=function(a){return this.each(function(){bb(this,a)})},W.prototype.transition=function(a){var b,c;a instanceof bn?(b=a._id,a=a._name):(b=++bm,(c=bq).time=aZ(),a=null==a?null:a+"");for(var d=this._groups,e=d.length,f=0;f<e;++f)for(var g,h=d[f],i=h.length,j=0;j<i;++j)(g=h[j])&&a7(g,a,b,j,h,c||function(a,b){for(var c;!(c=a.__transition)||!(c=c[b]);)if(!(a=a.parentNode))throw Error(`transition ${b} not found`);return c}(g,b));return new bn(d,this._parents,a,b)};let{abs:br,max:bs,min:bt}=Math;function bu(a){return{type:a}}function bv(a){return((a=Math.exp(a))+1/a)/2}["w","e"].map(bu),["n","s"].map(bu),["n","w","e","s","nw","ne","sw","se"].map(bu);let bw=function a(b,c,d){function e(a,e){var f,g,h=a[0],i=a[1],j=a[2],k=e[0],l=e[1],m=e[2],n=k-h,o=l-i,p=n*n+o*o;if(p<1e-12)g=Math.log(m/j)/b,f=function(a){return[h+a*n,i+a*o,j*Math.exp(b*a*g)]};else{var q=Math.sqrt(p),r=(m*m-j*j+d*p)/(2*j*c*q),s=(m*m-j*j-d*p)/(2*m*c*q),t=Math.log(Math.sqrt(r*r+1)-r);g=(Math.log(Math.sqrt(s*s+1)-s)-t)/b,f=function(a){var d,e,f=a*g,k=bv(t),l=j/(c*q)*(k*(((d=Math.exp(2*(d=b*f+t)))-1)/(d+1))-((e=Math.exp(e=t))-1/e)/2);return[h+l*n,i+l*o,j*k/bv(b*f+t)]}}return f.duration=1e3*g*b/Math.SQRT2,f}return e.rho=function(b){var c=Math.max(.001,+b),d=c*c;return a(c,d,d*d)},e}(Math.SQRT2,2,4),bx=a=>()=>a;function by(a,{sourceEvent:b,target:c,transform:d,dispatch:e}){Object.defineProperties(this,{type:{value:a,enumerable:!0,configurable:!0},sourceEvent:{value:b,enumerable:!0,configurable:!0},target:{value:c,enumerable:!0,configurable:!0},transform:{value:d,enumerable:!0,configurable:!0},_:{value:e}})}function bz(a,b,c){this.k=a,this.x=b,this.y=c}bz.prototype={constructor:bz,scale:function(a){return 1===a?this:new bz(this.k*a,this.x,this.y)},translate:function(a,b){return 0===a&0===b?this:new bz(this.k,this.x+this.k*a,this.y+this.k*b)},apply:function(a){return[a[0]*this.k+this.x,a[1]*this.k+this.y]},applyX:function(a){return a*this.k+this.x},applyY:function(a){return a*this.k+this.y},invert:function(a){return[(a[0]-this.x)/this.k,(a[1]-this.y)/this.k]},invertX:function(a){return(a-this.x)/this.k},invertY:function(a){return(a-this.y)/this.k},rescaleX:function(a){return a.copy().domain(a.range().map(this.invertX,this).map(a.invert,a))},rescaleY:function(a){return a.copy().domain(a.range().map(this.invertY,this).map(a.invert,a))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var bA=new bz(1,0,0);function bB(a){for(;!a.__zoom;)if(!(a=a.parentNode))return bA;return a.__zoom}function bC(a){a.stopImmediatePropagation()}function bD(a){a.preventDefault(),a.stopImmediatePropagation()}function bE(a){return(!a.ctrlKey||"wheel"===a.type)&&!a.button}function bF(){var a=this;return a instanceof SVGElement?(a=a.ownerSVGElement||a).hasAttribute("viewBox")?[[(a=a.viewBox.baseVal).x,a.y],[a.x+a.width,a.y+a.height]]:[[0,0],[a.width.baseVal.value,a.height.baseVal.value]]:[[0,0],[a.clientWidth,a.clientHeight]]}function bG(){return this.__zoom||bA}function bH(a){return-a.deltaY*(1===a.deltaMode?.05:a.deltaMode?1:.002)*(a.ctrlKey?10:1)}function bI(){return navigator.maxTouchPoints||"ontouchstart"in this}function bJ(a,b,c){var d=a.invertX(b[0][0])-c[0][0],e=a.invertX(b[1][0])-c[1][0],f=a.invertY(b[0][1])-c[0][1],g=a.invertY(b[1][1])-c[1][1];return a.translate(e>d?(d+e)/2:Math.min(0,d)||Math.max(0,e),g>f?(f+g)/2:Math.min(0,f)||Math.max(0,g))}bB.prototype=bz.prototype,a.s(["Transform",0,bz,"default",0,bB,"identity",0,bA],89004),a.s(["default",0,function(){var a,b,c,e=bE,f=bF,g=bJ,h=bH,i=bI,j=[0,1/0],k=[[-1/0,-1/0],[1/0,1/0]],l=250,m=bw,n=d("start","zoom","end"),o=0,p=10;function q(a){a.property("__zoom",bG).on("wheel.zoom",x,{passive:!1}).on("mousedown.zoom",y).on("dblclick.zoom",z).filter(i).on("touchstart.zoom",A).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function r(a,b){return(b=Math.max(j[0],Math.min(j[1],b)))===a.k?a:new bz(b,a.x,a.y)}function s(a,b,c){var d=b[0]-c[0]*a.k,e=b[1]-c[1]*a.k;return d===a.x&&e===a.y?a:new bz(a.k,d,e)}function t(a){return[(+a[0][0]+ +a[1][0])/2,(+a[0][1]+ +a[1][1])/2]}function u(a,b,c,d){a.on("start.zoom",function(){v(this,arguments).event(d).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(d).end()}).tween("zoom",function(){var a=arguments,e=v(this,a).event(d),g=f.apply(this,a),h=null==c?t(g):"function"==typeof c?c.apply(this,a):c,i=Math.max(g[1][0]-g[0][0],g[1][1]-g[0][1]),j=this.__zoom,k="function"==typeof b?b.apply(this,a):b,l=m(j.invert(h).concat(i/j.k),k.invert(h).concat(i/k.k));return function(a){if(1===a)a=k;else{var b=l(a),c=i/b[2];a=new bz(c,h[0]-b[0]*c,h[1]-b[1]*c)}e.zoom(null,a)}})}function v(a,b,c){return!c&&a.__zooming||new w(a,b)}function w(a,b){this.that=a,this.args=b,this.active=0,this.sourceEvent=null,this.extent=f.apply(a,b),this.taps=0}function x(a,...b){if(e.apply(this,arguments)){var c=v(this,b).event(a),d=this.__zoom,f=Math.max(j[0],Math.min(j[1],d.k*Math.pow(2,h.apply(this,arguments)))),i=aO(a);if(c.wheel)(c.mouse[0][0]!==i[0]||c.mouse[0][1]!==i[1])&&(c.mouse[1]=d.invert(c.mouse[0]=i)),clearTimeout(c.wheel);else{if(d.k===f)return;c.mouse=[i,d.invert(i)],bb(this),c.start()}bD(a),c.wheel=setTimeout(function(){c.wheel=null,c.end()},150),c.zoom("mouse",g(s(r(d,f),c.mouse[0],c.mouse[1]),c.extent,k))}}function y(a,...b){if(!c&&e.apply(this,arguments)){var d=a.currentTarget,f=v(this,b,!0).event(a),h=X(a.view).on("mousemove.zoom",function(a){if(bD(a),!f.moved){var b=a.clientX-j,c=a.clientY-l;f.moved=b*b+c*c>o}f.event(a).zoom("mouse",g(s(f.that.__zoom,f.mouse[0]=aO(a,d),f.mouse[1]),f.extent,k))},!0).on("mouseup.zoom",function(a){h.on("mousemove.zoom mouseup.zoom",null),_(a.view,f.moved),bD(a),f.event(a).end()},!0),i=aO(a,d),j=a.clientX,l=a.clientY;$(a.view),bC(a),f.mouse=[i,this.__zoom.invert(i)],bb(this),f.start()}}function z(a,...b){if(e.apply(this,arguments)){var c=this.__zoom,d=aO(a.changedTouches?a.changedTouches[0]:a,this),h=c.invert(d),i=c.k*(a.shiftKey?.5:2),j=g(s(r(c,i),d,h),f.apply(this,b),k);bD(a),l>0?X(this).transition().duration(l).call(u,j,d,a):X(this).call(q.transform,j,d,a)}}function A(c,...d){if(e.apply(this,arguments)){var f,g,h,i,j=c.touches,k=j.length,l=v(this,d,c.changedTouches.length===k).event(c);for(bC(c),g=0;g<k;++g)i=[i=aO(h=j[g],this),this.__zoom.invert(i),h.identifier],l.touch0?l.touch1||l.touch0[2]===i[2]||(l.touch1=i,l.taps=0):(l.touch0=i,f=!0,l.taps=1+!!a);a&&(a=clearTimeout(a)),f&&(l.taps<2&&(b=i[0],a=setTimeout(function(){a=null},500)),bb(this),l.start())}}function B(a,...b){if(this.__zooming){var c,d,e,f,h=v(this,b).event(a),i=a.changedTouches,j=i.length;for(bD(a),c=0;c<j;++c)e=aO(d=i[c],this),h.touch0&&h.touch0[2]===d.identifier?h.touch0[0]=e:h.touch1&&h.touch1[2]===d.identifier&&(h.touch1[0]=e);if(d=h.that.__zoom,h.touch1){var l=h.touch0[0],m=h.touch0[1],n=h.touch1[0],o=h.touch1[1],p=(p=n[0]-l[0])*p+(p=n[1]-l[1])*p,q=(q=o[0]-m[0])*q+(q=o[1]-m[1])*q;d=r(d,Math.sqrt(p/q)),e=[(l[0]+n[0])/2,(l[1]+n[1])/2],f=[(m[0]+o[0])/2,(m[1]+o[1])/2]}else{if(!h.touch0)return;e=h.touch0[0],f=h.touch0[1]}h.zoom("touch",g(s(d,e,f),h.extent,k))}}function C(a,...d){if(this.__zooming){var e,f,g=v(this,d).event(a),h=a.changedTouches,i=h.length;for(bC(a),c&&clearTimeout(c),c=setTimeout(function(){c=null},500),e=0;e<i;++e)f=h[e],g.touch0&&g.touch0[2]===f.identifier?delete g.touch0:g.touch1&&g.touch1[2]===f.identifier&&delete g.touch1;if(g.touch1&&!g.touch0&&(g.touch0=g.touch1,delete g.touch1),g.touch0)g.touch0[1]=this.__zoom.invert(g.touch0[0]);else if(g.end(),2===g.taps&&(f=aO(f,this),Math.hypot(b[0]-f[0],b[1]-f[1])<p)){var j=X(this).on("dblclick.zoom");j&&j.apply(this,arguments)}}}return q.transform=function(a,b,c,d){var e=a.selection?a.selection():a;e.property("__zoom",bG),a!==e?u(a,b,c,d):e.interrupt().each(function(){v(this,arguments).event(d).start().zoom(null,"function"==typeof b?b.apply(this,arguments):b).end()})},q.scaleBy=function(a,b,c,d){q.scaleTo(a,function(){var a=this.__zoom.k,c="function"==typeof b?b.apply(this,arguments):b;return a*c},c,d)},q.scaleTo=function(a,b,c,d){q.transform(a,function(){var a=f.apply(this,arguments),d=this.__zoom,e=null==c?t(a):"function"==typeof c?c.apply(this,arguments):c,h=d.invert(e),i="function"==typeof b?b.apply(this,arguments):b;return g(s(r(d,i),e,h),a,k)},c,d)},q.translateBy=function(a,b,c,d){q.transform(a,function(){return g(this.__zoom.translate("function"==typeof b?b.apply(this,arguments):b,"function"==typeof c?c.apply(this,arguments):c),f.apply(this,arguments),k)},null,d)},q.translateTo=function(a,b,c,d,e){q.transform(a,function(){var a=f.apply(this,arguments),e=this.__zoom,h=null==d?t(a):"function"==typeof d?d.apply(this,arguments):d;return g(bA.translate(h[0],h[1]).scale(e.k).translate("function"==typeof b?-b.apply(this,arguments):-b,"function"==typeof c?-c.apply(this,arguments):-c),a,k)},d,e)},w.prototype={event:function(a){return a&&(this.sourceEvent=a),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(a,b){return this.mouse&&"mouse"!==a&&(this.mouse[1]=b.invert(this.mouse[0])),this.touch0&&"touch"!==a&&(this.touch0[1]=b.invert(this.touch0[0])),this.touch1&&"touch"!==a&&(this.touch1[1]=b.invert(this.touch1[0])),this.that.__zoom=b,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(a){var b=X(this.that).datum();n.call(a,this.that,new by(a,{sourceEvent:this.sourceEvent,target:q,type:a,transform:this.that.__zoom,dispatch:n}),b)}},q.wheelDelta=function(a){return arguments.length?(h="function"==typeof a?a:bx(+a),q):h},q.filter=function(a){return arguments.length?(e="function"==typeof a?a:bx(!!a),q):e},q.touchable=function(a){return arguments.length?(i="function"==typeof a?a:bx(!!a),q):i},q.extent=function(a){return arguments.length?(f="function"==typeof a?a:bx([[+a[0][0],+a[0][1]],[+a[1][0],+a[1][1]]]),q):f},q.scaleExtent=function(a){return arguments.length?(j[0]=+a[0],j[1]=+a[1],q):[j[0],j[1]]},q.translateExtent=function(a){return arguments.length?(k[0][0]=+a[0][0],k[1][0]=+a[1][0],k[0][1]=+a[0][1],k[1][1]=+a[1][1],q):[[k[0][0],k[0][1]],[k[1][0],k[1][1]]]},q.constrain=function(a){return arguments.length?(g=a,q):g},q.duration=function(a){return arguments.length?(l=+a,q):l},q.interpolate=function(a){return arguments.length?(m=a,q):m},q.on=function(){var a=n.on.apply(n,arguments);return a===n?q:a},q.clickDistance=function(a){return arguments.length?(o=(a*=1)*a,q):Math.sqrt(o)},q.tapDistance=function(a){return arguments.length?(p=+a,q):p},q}],29873),a.s([],75930)}];
2
-
3
- //# sourceMappingURL=_01f38ty._.js.map