humemory 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.githooks/post-commit +22 -0
- package/AGENTS.md +328 -0
- package/CHANGELOG.md +198 -0
- package/LICENSE +21 -0
- package/README.md +488 -0
- package/bin/humemory.js +19 -0
- package/dist/agent/claude-hook.d.ts +15 -0
- package/dist/agent/claude-hook.js +38 -0
- package/dist/agent/commit-closer.d.ts +60 -0
- package/dist/agent/commit-closer.js +125 -0
- package/dist/agent/learning-extractor.d.ts +10 -0
- package/dist/agent/learning-extractor.js +75 -0
- package/dist/agent/session-context.d.ts +63 -0
- package/dist/agent/session-context.js +216 -0
- package/dist/agent/session-parser.d.ts +12 -0
- package/dist/agent/session-parser.js +85 -0
- package/dist/api/dream-routes.d.ts +7 -0
- package/dist/api/dream-routes.js +40 -0
- package/dist/api/intentions-routes.d.ts +23 -0
- package/dist/api/intentions-routes.js +252 -0
- package/dist/api/memory-routes.d.ts +10 -0
- package/dist/api/memory-routes.js +277 -0
- package/dist/api/scripts-routes.d.ts +13 -0
- package/dist/api/scripts-routes.js +129 -0
- package/dist/api/server.d.ts +33 -0
- package/dist/api/server.js +157 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +798 -0
- package/dist/core/clock.d.ts +38 -0
- package/dist/core/clock.js +52 -0
- package/dist/core/cue-arg.d.ts +19 -0
- package/dist/core/cue-arg.js +72 -0
- package/dist/core/cues.d.ts +138 -0
- package/dist/core/cues.js +372 -0
- package/dist/core/decay.d.ts +49 -0
- package/dist/core/decay.js +157 -0
- package/dist/core/dreamer.d.ts +114 -0
- package/dist/core/dreamer.js +427 -0
- package/dist/core/embeddings.d.ts +79 -0
- package/dist/core/embeddings.js +133 -0
- package/dist/core/event-bus.d.ts +71 -0
- package/dist/core/event-bus.js +67 -0
- package/dist/core/hybrid.d.ts +33 -0
- package/dist/core/hybrid.js +63 -0
- package/dist/core/llm-generator.d.ts +18 -0
- package/dist/core/llm-generator.js +69 -0
- package/dist/core/sanitize.d.ts +57 -0
- package/dist/core/sanitize.js +87 -0
- package/dist/core/scripts.d.ts +55 -0
- package/dist/core/scripts.js +96 -0
- package/dist/core/search.d.ts +42 -0
- package/dist/core/search.js +173 -0
- package/dist/core/trust.d.ts +48 -0
- package/dist/core/trust.js +57 -0
- package/dist/core/types.d.ts +333 -0
- package/dist/core/types.js +1 -0
- package/dist/core/vector-clusterer.d.ts +53 -0
- package/dist/core/vector-clusterer.js +113 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +18 -0
- package/dist/mcp/server.d.ts +22 -0
- package/dist/mcp/server.js +158 -0
- package/dist/store/sqlite.d.ts +240 -0
- package/dist/store/sqlite.js +1653 -0
- package/docs/TESTING.md +244 -0
- package/package.json +95 -0
- package/public/app/galaxy-f42190mq.js +10 -0
- package/public/app/index-2cf31xxn.css +1 -0
- package/public/app/index-epqg22cp.js +1 -0
- package/public/app/index-f9h80bzq.js +12 -0
- package/public/app/index-gbfwa9vq.js +2 -0
- package/public/app/index-kvhc17mz.js +2 -0
- package/public/app/index-pbd5t4dj.js +2 -0
- package/public/app/index.html +12 -0
- package/public/app/promenade-cnzzpm73.js +4111 -0
- package/public/app/river-tyawhh8w.js +13 -0
- package/public/session.html +659 -0
- package/scripts/consolidate.js +46 -0
- package/scripts/hook-post-commit.ts +80 -0
- package/scripts/hook-session-start.ts +92 -0
- package/scripts/hook-session.ts +60 -0
package/docs/TESTING.md
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# Autonomous Test Environment — humemory
|
|
2
|
+
|
|
3
|
+
**Status:** implemented (2026-07-30, story S5-00b). Spec written 2026-06-17.
|
|
4
|
+
This is the *required* foundation for Phase 5 (prospective / Zeigarnik). See
|
|
5
|
+
[AGENTS.md](../AGENTS.md) → "Autonomous test environment — REQUIRED".
|
|
6
|
+
|
|
7
|
+
Seams live in `src/core/clock.ts` and `src/core/event-bus.ts`; test-side helpers
|
|
8
|
+
in `tests/helpers/`, data in `tests/fixtures/`. `tests/test-env.test.ts` covers the
|
|
9
|
+
four pillars themselves — if it goes red, no time- or event-driven assertion in the
|
|
10
|
+
suite can be trusted.
|
|
11
|
+
|
|
12
|
+
## Why it must be autonomous
|
|
13
|
+
|
|
14
|
+
humemory's entire behavior is **time-driven** (decay curves) and **event-driven**
|
|
15
|
+
(cues, open loops). Logic of that shape is untestable against a wall clock or a live
|
|
16
|
+
LLM. Every run must be:
|
|
17
|
+
|
|
18
|
+
- **Hermetic** — no shared DB, no network, no global state leaking between tests.
|
|
19
|
+
- **Deterministic** — same input ⇒ same output. No `Date.now()`, no randomness, no
|
|
20
|
+
ordering that depends on real time.
|
|
21
|
+
- **Fast** — fake-clock fast-forward instead of real waiting; in-memory DB.
|
|
22
|
+
|
|
23
|
+
## Four pillars
|
|
24
|
+
|
|
25
|
+
### 1. Isolated database — done
|
|
26
|
+
|
|
27
|
+
Today `tests/humemory.test.ts` uses a temp file `test-humemory.db` with
|
|
28
|
+
`beforeEach`/`afterEach` cleanup. Good enough but file-bound and serial.
|
|
29
|
+
|
|
30
|
+
**Target:** every suite gets its own `bun:sqlite` instance. `SQLiteStore`'s
|
|
31
|
+
constructor already accepts a path → pass `':memory:'`.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { freshStore } from './helpers/store.js';
|
|
35
|
+
|
|
36
|
+
const store = freshStore(); // ':memory:', clock frozen at T0
|
|
37
|
+
const store2 = freshStore({ clock }); // drive time yourself
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Rule: **a test must never open `data/humemory.db`.** Enforced, not just asked:
|
|
41
|
+
`SQLiteStore`'s constructor throws under `NODE_ENV=test` if the resolved path is the
|
|
42
|
+
prod DB (`assertNotProdDbUnderTest`).
|
|
43
|
+
|
|
44
|
+
Note: a `:memory:` store gets a no-op advisory lock — there is no other process to
|
|
45
|
+
synchronise with, and `':memory:' + '.lock'` is not a valid filename on Windows.
|
|
46
|
+
Intra-process serialisation still runs through `enqueueWrite`.
|
|
47
|
+
|
|
48
|
+
### 2. Injectable clock — done
|
|
49
|
+
|
|
50
|
+
`src/core/clock.ts` exports the seam: `Clock`, `systemClock` (production default,
|
|
51
|
+
unchanged behaviour) and `FakeClock` with `advance()` / `advanceHours()` /
|
|
52
|
+
`advanceDays()` / `set()`. `FakeClock.now()` returns a defensive copy, so a caller
|
|
53
|
+
mutating the returned `Date` cannot shift the clock.
|
|
54
|
+
|
|
55
|
+
Threaded through `SQLiteStore` (`add`, `recall`, `updateDecay`) and
|
|
56
|
+
`InverseSearchEngine` (the recency bonus in `calculateScore`). `decay.ts` already
|
|
57
|
+
took `now` as a parameter. Anything still calling `new Date()` in a hot path is a
|
|
58
|
+
regression.
|
|
59
|
+
|
|
60
|
+
Then decay tests assert the full curve without waiting:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
const clock = new FakeClock(new Date('2026-01-01'));
|
|
64
|
+
const store = new SQLiteStore(':memory:', { clock });
|
|
65
|
+
const m = await store.add({ /* ... */ });
|
|
66
|
+
clock.advance(25 * 3600_000); // +25h
|
|
67
|
+
await store.updateDecay();
|
|
68
|
+
expect((await store.getById(m.id)).currentLevel).toBe(1); // L0→L1
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Remaining: `scripts/consolidate.js` and the CLI/API still stamp `day` with
|
|
72
|
+
`new Date()` at the edges. Harmless for decay assertions, worth threading when the
|
|
73
|
+
prospective hooks land (S5-03a/b).
|
|
74
|
+
|
|
75
|
+
### 3. Mocked LLM — seam already exists
|
|
76
|
+
|
|
77
|
+
`src/core/llm-generator.ts` exports `setLLMClient(client: LLMClient)` and the
|
|
78
|
+
`LLMClient` interface. Tests must use it; **no test may instantiate a real
|
|
79
|
+
`Anthropic` client.**
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { setLLMClient } from '../src/core/llm-generator.js';
|
|
83
|
+
|
|
84
|
+
setLLMClient({
|
|
85
|
+
async generate() {
|
|
86
|
+
return { level1: 'fixed summary', level2: 'fixed gist', level3: 'k1 k2 k3' };
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
CI runs with **no `ANTHROPIC_API_KEY`**. A test hitting the network is a bug.
|
|
92
|
+
|
|
93
|
+
Use `tests/helpers/llm.ts`: `useStubLLM()` installs a deterministic client shaped
|
|
94
|
+
like an Anthropic one (`messages.create` returning a JSON text block), records the
|
|
95
|
+
calls it received, and can be made to throw via `{ fail: new Error(...) }` to
|
|
96
|
+
exercise fallback paths.
|
|
97
|
+
|
|
98
|
+
### 4. Injectable event bus — done
|
|
99
|
+
|
|
100
|
+
Phase 5 is **event-driven**, not only clock-driven: a cue can be armed on
|
|
101
|
+
`file_open`, `branch_switch`, `error_pattern` or `commit`. Without a seam, testing
|
|
102
|
+
"this cue fires when the branch changes" would mean touching the real FS or git.
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import { InMemoryEventBus } from '../src/core/event-bus.js';
|
|
106
|
+
|
|
107
|
+
const bus = new InMemoryEventBus();
|
|
108
|
+
bus.subscribe('branch_switch', (e) => resolver.resolveEventCues(e));
|
|
109
|
+
await bus.publish({ type: 'branch_switch', branch: 'feature/x', directory: '/src' });
|
|
110
|
+
// handlers are awaited: the effect is observable right after this line
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`publish()` awaits handlers in subscription order, so **a test never needs a
|
|
114
|
+
`setTimeout` to observe an effect**. Handlers are snapshotted before dispatch, so a
|
|
115
|
+
handler unsubscribing mid-broadcast cannot corrupt the iteration. `published()` /
|
|
116
|
+
`publishedOf(type)` expose the log for assertions without subscribing; `reset()`
|
|
117
|
+
clears both handlers and log.
|
|
118
|
+
|
|
119
|
+
`FileSystemEventBus` (fs.watch / chokidar + git hooks) is deliberately **not**
|
|
120
|
+
implemented yet — there is nothing to feed until the `intentions`/`cues` tables and
|
|
121
|
+
the resolver exist. It lands with Phase 5.2 (S5-02).
|
|
122
|
+
|
|
123
|
+
### 5. React components — same runner, no second stack
|
|
124
|
+
|
|
125
|
+
The front (`web/`) is tested with `@testing-library/react` under **`bun test`**, not
|
|
126
|
+
a separate runner. `bunfig.toml` preloads `tests/setup-dom.ts`, which registers
|
|
127
|
+
happy-dom as a global DOM; backend suites simply ignore `window` and `document`.
|
|
128
|
+
|
|
129
|
+
`fetch` is stubbed per test — no server, no network, same hermetic rule as
|
|
130
|
+
everywhere else:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
globalThis.fetch = (async () =>
|
|
134
|
+
new Response(JSON.stringify({ intentions: [], count: 0 }))) as typeof fetch;
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Always restore the real `fetch` in `afterEach`, and `cleanup()` between renders,
|
|
138
|
+
or one test's DOM leaks into the next.
|
|
139
|
+
|
|
140
|
+
## Injection hardening — a memory is untrusted input by construction
|
|
141
|
+
|
|
142
|
+
Required by Phase 6.0.3 ([PHASE6_PLAN.md](../PHASE6_PLAN.md) §6.0.3); written here
|
|
143
|
+
during the Phase 8 cleanup pass after shipping without it.
|
|
144
|
+
|
|
145
|
+
A trace's content did not come from the human at the keyboard. It came from files
|
|
146
|
+
an agent read, terminal output it captured, or a web page it fetched — any of
|
|
147
|
+
which can contain text aimed at whichever model reads it next. The SessionStart
|
|
148
|
+
block re-injects recalled traces (and, since Phase 8.2, drill steps) straight into
|
|
149
|
+
the next session's prompt, so **every trace is adversarial input until proven
|
|
150
|
+
otherwise**, and "proven otherwise" means `verificationReason: 'human'` and
|
|
151
|
+
nothing weaker (`src/core/sanitize.ts`, `src/agent/session-context.ts`).
|
|
152
|
+
|
|
153
|
+
The defence is layered, and each layer has a reason a test exists for it:
|
|
154
|
+
|
|
155
|
+
- **Sandboxed by default.** Unverified content renders inside
|
|
156
|
+
`<humemory-untrusted source="…" agent="…" verified="…">` markers with a preface
|
|
157
|
+
stating it is data, not instructions. Only a trace verified with reason `human`
|
|
158
|
+
renders bare — every other verification reason (`corroborated`, `grounded`,
|
|
159
|
+
`reused`) still wraps, because none of them means a human read this exact text
|
|
160
|
+
(see the Phase 6/7 dialogue on why `promote_semantic` and `script_candidate`
|
|
161
|
+
deliberately never land as `'human'`).
|
|
162
|
+
- **The container is untrusted too.** `source`/`agent` attribute values come from
|
|
163
|
+
`X-Humemory-Agent` — an unauthenticated header — so they are escaped
|
|
164
|
+
(`escapeAttr`) before being placed inside the marker tag, not just the content
|
|
165
|
+
inside it. A forged `agent = 'codex" verified="true'` must not be able to write
|
|
166
|
+
a `verified="true"` attribute that isn't real.
|
|
167
|
+
- **Marker-escape defence.** A trace containing a literal
|
|
168
|
+
`</humemory-untrusted>` would otherwise close its own sandbox early and let the
|
|
169
|
+
rest of its content read as host markdown. `sanitizeTrace()` neutralizes any
|
|
170
|
+
occurrence of the marker sequence (case-insensitive, open or close) before
|
|
171
|
+
rendering. This is the single highest-value test in the phase — cover it with a
|
|
172
|
+
hostile fixture, not a benign one.
|
|
173
|
+
- **Structural neutralization.** Markdown headers and system/tool-directive-looking
|
|
174
|
+
prefixes ("SYSTEM:", "ignore all previous instructions") are stripped or
|
|
175
|
+
fenced — a trace is data, it does not get to restructure the block around it or
|
|
176
|
+
issue directives from inside it.
|
|
177
|
+
- **Bounded blast radius.** Content is capped per trace regardless of what
|
|
178
|
+
survives sanitization.
|
|
179
|
+
- **Escape attempts are telemetry, not silence.** Every `sanitizeTrace()` call
|
|
180
|
+
site accumulates its `escapedMarkers` count into `escapeAttempts`, logged as
|
|
181
|
+
`{memoryId, count}` — the event, never the offending payload, so the audit log
|
|
182
|
+
itself can't become a second injection vector. A test asserting `escapeAttempts`
|
|
183
|
+
grew is how you know the defence *fired*, not just that the output looked clean.
|
|
184
|
+
|
|
185
|
+
What a test in this area must cover: a fixture trace containing markdown, a
|
|
186
|
+
directive-looking line, **and** a literal `</humemory-untrusted>` string, asserting
|
|
187
|
+
the rendered block is wrapped, escaped, and truncated — plus a forged-attribute
|
|
188
|
+
fixture (a value containing `"` or `<`) asserting the marker tag itself does not
|
|
189
|
+
break. Every new surface that re-injects trace-shaped content into a prompt
|
|
190
|
+
(traces, scripts as of 8.2) needs the same three assertions; grep for
|
|
191
|
+
`sanitizeTrace(` before adding one to confirm it's already wired in.
|
|
192
|
+
|
|
193
|
+
## Fixtures
|
|
194
|
+
|
|
195
|
+
Seed from `tests/fixtures/` (JSON sets) rather than inline literals, so scenarios are
|
|
196
|
+
described as data and replayed against the `FakeClock`.
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
tests/
|
|
200
|
+
├── fixtures/
|
|
201
|
+
│ ├── memories.basic.json # traces; dates as offsetHours from T0, never absolute
|
|
202
|
+
│ ├── events.basic.json # AppEvents replayable on the bus
|
|
203
|
+
│ └── loops.open.json # Zeigarnik open loops + their cues (S5-01)
|
|
204
|
+
└── helpers/
|
|
205
|
+
├── store.ts # freshStore()
|
|
206
|
+
├── clock.ts # fakeClock(), T0, HOURS thresholds
|
|
207
|
+
├── llm.ts # useStubLLM(), stubLLMClient()
|
|
208
|
+
└── fixtures.ts # seedMemories(), seedIntentions(), eventFixtures()
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Open loops declare their cues inline and their deadline as `expiresInHours`,
|
|
212
|
+
resolved against the injected clock by `seedIntentions(store, { now })`. There is no
|
|
213
|
+
separate `cues.json`: a cue has no meaning detached from the intention it wakes, so
|
|
214
|
+
it is described where it is used.
|
|
215
|
+
|
|
216
|
+
Fixtures carry **no absolute timestamps**: a trace declares `offsetHours` relative to
|
|
217
|
+
`T0`, resolved against the injected clock. `seedMemories()` returns the inserted
|
|
218
|
+
traces keyed by fixture `key`, so assertions read as
|
|
219
|
+
`seeded['auth-bug'].currentLevel` rather than array indices.
|
|
220
|
+
|
|
221
|
+
Fixtures for a table that does not exist yet are dead weight — each set lands with
|
|
222
|
+
the schema it exercises.
|
|
223
|
+
|
|
224
|
+
## Checklist before Phase 5 starts
|
|
225
|
+
|
|
226
|
+
- [x] `Clock` seam added; `new Date()` removed from decay/store hot paths
|
|
227
|
+
- [x] `freshStore()` → `:memory:` per test; prod-DB guard under test env
|
|
228
|
+
- [x] LLM stub helper in place; CI green with no API key
|
|
229
|
+
- [x] injectable event bus (`InMemoryEventBus`) with awaited dispatch
|
|
230
|
+
- [x] fixtures dir + helpers in place
|
|
231
|
+
- [x] one end-to-end decay test driven purely by `FakeClock.advance()`
|
|
232
|
+
(`tests/test-env.test.ts` → L0→L1→L2→L3 with zero real waiting)
|
|
233
|
+
|
|
234
|
+
Checklist green as of 2026-07-30 — prospective/Zeigarnik logic can now be built on
|
|
235
|
+
top and trusted.
|
|
236
|
+
|
|
237
|
+
All suites are now hermetic in this sense (BUG-05 closed): `humemory.test.ts` runs
|
|
238
|
+
on `freshStore()` with a frozen clock, `agent.test.ts` drives `processSession`
|
|
239
|
+
against `':memory:'`, and `llm-generator.test.ts` never touched a database. No
|
|
240
|
+
test writes a file, so nothing is left behind when one fails.
|
|
241
|
+
|
|
242
|
+
Inline literals are still fine where the test *is about* that specific content —
|
|
243
|
+
a photographic-mode test needs its own trace. Fixtures are for shared corpora and
|
|
244
|
+
for scenarios described as data.
|
package/package.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "humemory",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Memory for AI agents that forgets like a human — decaying traces, inverse search, and prospective loops that resurface on a cue",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"humemory": "./bin/humemory.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"bin",
|
|
14
|
+
"public",
|
|
15
|
+
".githooks",
|
|
16
|
+
"scripts/hook-session.ts",
|
|
17
|
+
"scripts/hook-session-start.ts",
|
|
18
|
+
"scripts/hook-post-commit.ts",
|
|
19
|
+
"scripts/consolidate.js",
|
|
20
|
+
"README.md",
|
|
21
|
+
"AGENTS.md",
|
|
22
|
+
"CHANGELOG.md",
|
|
23
|
+
"docs",
|
|
24
|
+
"LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"keywords": [
|
|
27
|
+
"memory",
|
|
28
|
+
"ai-agent",
|
|
29
|
+
"llm",
|
|
30
|
+
"claude",
|
|
31
|
+
"forgetting-curve",
|
|
32
|
+
"prospective-memory",
|
|
33
|
+
"zeigarnik",
|
|
34
|
+
"sqlite",
|
|
35
|
+
"bun",
|
|
36
|
+
"decay",
|
|
37
|
+
"mcp"
|
|
38
|
+
],
|
|
39
|
+
"author": "medyll",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/medyll/humemory.git"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/medyll/humemory#readme",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/medyll/humemory/issues"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"bun": ">=1.0.0"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@anthropic-ai/sdk": "^0.92.0",
|
|
54
|
+
"@hono/node-server": "^2.0.0",
|
|
55
|
+
"@huggingface/transformers": "^4.2.0",
|
|
56
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
57
|
+
"commander": "^12.0.0",
|
|
58
|
+
"d3": "^7.9.0",
|
|
59
|
+
"flexsearch": "^0.7.43",
|
|
60
|
+
"hono": "^4.0.0",
|
|
61
|
+
"react": "^19.2.8",
|
|
62
|
+
"react-dom": "^19.2.8",
|
|
63
|
+
"three": "^0.184.0",
|
|
64
|
+
"zod": "^4.4.3"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@happy-dom/global-registrator": "^20.11.1",
|
|
68
|
+
"@testing-library/dom": "^10.4.1",
|
|
69
|
+
"@testing-library/react": "^16.3.2",
|
|
70
|
+
"@types/d3": "^7.4.3",
|
|
71
|
+
"@types/node": "^20.0.0",
|
|
72
|
+
"@types/react": "^19.2.18",
|
|
73
|
+
"@types/react-dom": "^19.2.4",
|
|
74
|
+
"@types/three": "^0.185.3",
|
|
75
|
+
"bun-types": "^1.3.13",
|
|
76
|
+
"js-yaml": "^5.1.0",
|
|
77
|
+
"tsx": "^4.7.0",
|
|
78
|
+
"typescript": "^5.4.0"
|
|
79
|
+
},
|
|
80
|
+
"scripts": {
|
|
81
|
+
"dev": "bun run --watch src/cli/index.ts",
|
|
82
|
+
"build": "tsc -p tsconfig.json && bun run build:web",
|
|
83
|
+
"test": "bun test",
|
|
84
|
+
"test:watch": "bun test --watch",
|
|
85
|
+
"start:api": "bun run src/api/server.ts",
|
|
86
|
+
"cli": "bun run src/cli/index.ts",
|
|
87
|
+
"consolidate": "bun run scripts/consolidate.js",
|
|
88
|
+
"dream": "bun run src/cli/index.ts dream",
|
|
89
|
+
"mcp": "bun run src/mcp/server.ts",
|
|
90
|
+
"build:web": "node -e \"require('fs').rmSync('public/app',{recursive:true,force:true})\" && bun build web/index.html --outdir public/app --production --splitting",
|
|
91
|
+
"dev:web": "bun build web/index.html --outdir public/app --splitting --watch",
|
|
92
|
+
"typecheck:web": "tsc -p web/tsconfig.json",
|
|
93
|
+
"clean:web": "node -e \"require('fs').rmSync('public/app',{recursive:true,force:true})\""
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{h as J,i as b,j as A,k as B,l as N,m as P,n as U,o as j,s as x}from"./index-epqg22cp.js";import{t as T,u as R,v as V}from"./index-gbfwa9vq.js";import{B as $}from"./index-kvhc17mz.js";function C(_={}){return async function(y){y.innerHTML="";let{memories:D}=await $.listMemories({limit:500}),F=y.clientWidth||1200,G=700,W=J(y).append("svg").attr("width",F).attr("height",G),K=document.createElement("div");K.className="galaxy-legend",K.innerHTML=`
|
|
2
|
+
<div style="font-weight:600;margin-bottom:.5rem;">Decay levels</div>
|
|
3
|
+
${R.map((f,q)=>`
|
|
4
|
+
<div class="galaxy-legend-item">
|
|
5
|
+
<div class="galaxy-legend-dot" style="background:${T[q]};"></div>
|
|
6
|
+
<span>L${q} — ${V(q)}</span>
|
|
7
|
+
</div>`).join("")}
|
|
8
|
+
<div style="margin-top:1rem;font-size:.8rem;color:var(--muted);">
|
|
9
|
+
Size = mnemonic strength<br>Position = mental place
|
|
10
|
+
</div>`,y.appendChild(K);let M=[...new Set(D.map((f)=>f.directory))],Q=Math.min(F,G)*0.3,X=2*Math.PI/Math.max(1,M.length),z={};M.forEach((f,q)=>{z[f]={x:F/2+Q*Math.cos(q*X),y:G/2+Q*Math.sin(q*X)}});let Y=D.map((f)=>({id:f.id,directory:f.directory,saillance:f.saillance,level:f.currentLevel,photographic:f.photographic,memory:f})),Z=D.filter((f)=>f.mergedIntoId&&D.some((q)=>q.id===f.mergedIntoId)).map((f)=>({source:f.id,target:f.mergedIntoId})),H=N(Y).force("link",B(Z).id((f)=>f.id).distance(50)).force("charge",P().strength(-30)).force("x",U((f)=>z[f.directory]?.x??F/2).strength(0.1)).force("y",j((f)=>z[f.directory]?.y??G/2).strength(0.1)).force("collision",A().radius((f)=>Math.max(5,f.saillance/10))),I=W.append("g");W.call(x().scaleExtent([0.3,5]).on("zoom",(f)=>{I.attr("transform",f.transform)}));let k=I.append("g").selectAll("line").data(Z).enter().append("line").attr("class","galaxy-link").attr("stroke","#3f3f4e").attr("stroke-opacity",0.3),w=I.append("g").selectAll("circle").data(Y).enter().append("circle").attr("class","galaxy-node").attr("r",(f)=>Math.max(4,f.saillance/8)).attr("fill",(f)=>T[f.level]).attr("opacity",(f)=>Math.max(0.4,f.saillance/100)).attr("stroke",(f)=>f.photographic?"#8b5cf6":"none").attr("stroke-width",(f)=>f.photographic?2:0).style("cursor","pointer").on("click",(f,q)=>_.onSelectMemory?.(q.id)).on("mouseover",(f,q)=>{J(f.target).transition().duration(200).attr("r",Math.max(6,q.saillance/6))}).on("mouseout",(f,q)=>{J(f.target).transition().duration(200).attr("r",Math.max(4,q.saillance/8))}).call(b().on("start",(f,q)=>{if(!f.active)H.alphaTarget(0.3).restart();q.fx=q.x,q.fy=q.y}).on("drag",(f,q)=>{q.fx=f.x,q.fy=f.y}).on("end",(f,q)=>{if(!f.active)H.alphaTarget(0);q.fx=null,q.fy=null}));return I.append("g").selectAll("text").data(M).enter().append("text").attr("x",(f)=>z[f].x).attr("y",(f)=>z[f].y-Q*0.15).attr("text-anchor","middle").attr("fill","#a1a1aa").attr("font-size","12px").attr("font-weight","600").text((f)=>f.split(/[\\/]/).pop()||f),H.on("tick",()=>{k.attr("x1",(f)=>f.source.x).attr("y1",(f)=>f.source.y).attr("x2",(f)=>f.target.x).attr("y2",(f)=>f.target.y),w.attr("cx",(f)=>f.x).attr("cy",(f)=>f.y)}),()=>{H.stop(),y.innerHTML=""}}}export{C as createMount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--bg:#0f1117;--surface:#171a23;--border:#262b38;--text:#e6e8ee;--muted:#8b93a7;--accent:#7c5cff;--armed:#f0b429;--fired:#4c9aff;--closed:#35c46a;--expired:#5a6070}*{box-sizing:border-box}body{background:var(--bg);color:var(--text);margin:0;font:15px/1.55 ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.app{max-width:860px;margin:0 auto;padding:2rem 1.25rem 4rem}.app-header h1{letter-spacing:-.02em;margin:0;font-size:1.6rem}.tagline{color:var(--muted);margin:.25rem 0 2rem}.section-head{display:flex;justify-content:space-between;align-items:baseline;gap:1rem}.section-head h2{text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-size:1.05rem}button{background:var(--accent);color:#fff;font:inherit;cursor:pointer;border:0;border-radius:6px;padding:.45rem .85rem;font-size:.9rem}button:disabled{opacity:.5;cursor:default}.loop-list{list-style:none;display:grid;gap:.75rem;margin:0;padding:0}.loop{background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:.9rem 1rem}.loop-head{display:flex;align-items: center;gap:.75rem}.loop-head code{color:var(--accent);font-size:.85rem}.loop-content{margin:.4rem 0 .2rem}.loop-meta{color:var(--muted);margin:0;font-size:.82rem}.loop-badge{color:var(--muted);font-size:.78rem}.loop-badge[data-status=armed]{color:var(--armed)}.loop-badge[data-status=fired]{color:var(--fired)}.loop-badge[data-status=closed]{color:var(--closed)}.loop-badge[data-status=expired]{color:var(--expired)}.empty,.error{color:var(--muted)}.error{color:#ff6b6b}h2{text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-size:1.05rem}.new-loop{display:grid;gap:.75rem;margin-bottom:2.5rem}.field{display:grid;gap:.3rem}.field-row{display:grid;grid-template-columns:1fr 1fr;gap:.75rem}.field label{color:var(--muted);font-size:.8rem}input,textarea{background:var(--surface);color:var(--text);border:1px solid var(--border);font:inherit;border-radius:6px;padding:.45rem .6rem;font-size:.9rem}input:focus,textarea:focus{outline:2px solid var(--accent);outline-offset:1px}textarea{resize:vertical;font-family:ui-monospace,Cascadia Code,monospace;font-size:.82rem}.new-loop>button{justify-self:start}.filters{display:flex;flex-wrap:wrap;align-items: center;gap:.75rem;margin:1rem 0}.filter-tabs{display:flex;flex-wrap:wrap;gap:.25rem}.tab{color:var(--muted);border:1px solid var(--border);background:0 0;font-size:.82rem}.tab.active{background:var(--surface);color:var(--text);border-color:var(--accent)}.filter-directory{flex:1;min-width:200px}button.secondary{border:1px solid var(--border);color:var(--muted);background:0 0}button.danger{background:#a3232f}.tension{display:flex;align-items: center;gap:.6rem;margin:.55rem 0}.tension-bar{overflow:hidden;background:#23283a;border-radius:999px;flex:1;height:5px}.tension-fill{display:block;background:var(--armed);height:100%;transition:width .24s}.tension[data-status=fired] .tension-fill{background:var(--fired)}.tension[data-status=closed] .tension-fill,.tension[data-status=expired] .tension-fill{background:var(--expired)}.tension-value{color:var(--muted);font-variant-numeric:tabular-nums;min-width:4.5rem;font-size:.78rem}.tension-pin{color:var(--armed)}.cue-list{list-style:none;display:grid;gap:.25rem;margin:.6rem 0 0;padding:0}.cue{display:flex;align-items:baseline;gap:.6rem;font-size:.8rem}.cue code{color:var(--muted);font-size:.78rem}.cue[data-status=armed] code{color:var(--text)}.cue[data-status=cancelled] code{text-decoration:line-through;opacity:.6}.cue-status{color:var(--muted);font-size:.72rem}.loop-actions{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.8rem}.loop-actions button{padding:.3rem .65rem;font-size:.8rem}.loop[data-status=closed],.loop[data-status=expired]{opacity:.72}.loop-overdue{color:#ff9f43;font-size:.75rem}.notice{color:var(--closed);font-size:.85rem}.tab-nav{display:flex;border-bottom:1px solid var(--border);flex-wrap:wrap;gap:.3rem;margin-bottom:1.75rem;padding-bottom:.6rem}.zones{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:.6rem;margin-bottom:1.25rem}.zone-card{display:grid;background:var(--surface);border:1px solid var(--border);text-align:left;color:var(--text);border-radius:10px;gap:.2rem;padding:.75rem}.zone-card.active{border-color:var(--accent)}.zone-count{font-variant-numeric:tabular-nums;font-size:1.5rem;font-weight:600}.zone-label{color:var(--muted);font-size:.78rem}.zone-encoding .zone-count{color:#22c55e}.zone-consolidating .zone-count{color:#eab308}.zone-consolidated .zone-count{color:#f97316}.zone-fragile .zone-count{color:#ef4444}.zone-dormant .zone-count{color:#6b7280}.search{width:100%;margin-bottom:1.25rem}.memory-list{list-style:none;display:grid;gap:.6rem;margin:0;padding:0}.memory-item{background:var(--surface);border:1px solid var(--border);border-radius:10px}.memory-item.is-photographic{border-color:var(--accent)}.memory-open{display:flex;text-align:left;color:var(--text);background:0 0;border:0;align-items: flex-start;gap:.85rem;width:100%;padding:.85rem 1rem}.memory-state{background:var(--muted);border-radius:50%;flex-shrink:0;width:9px;height:9px;margin-top:.4rem}.memory-state.encoding{background:#22c55e}.memory-state.consolidating{background:#eab308}.memory-state.consolidated{background:#f97316}.memory-state.fragile{background:#ef4444}.memory-state.dormant{background:#6b7280}.memory-body{display:grid;gap:.4rem}.memory-text{line-height:1.5}.memory-meta{display:flex;color:var(--muted);flex-wrap:wrap;align-items: center;gap:.75rem;font-size:.78rem}.cue-tag{background:#23283a;border-radius:4px;padding:.15rem .4rem;font-size:.72rem}.photo-badge{color:var(--accent);font-size:.75rem}.strength-dots{display:inline-flex;gap:2px}.strength-dot{background:#2c3244;border-radius:50%;width:6px;height:6px}.strength-dot.active{background:var(--accent)}.modal-backdrop{position:fixed;display:grid;z-index:50;background:#000000a6;place-items: center;padding:1.5rem;inset:0}.modal{background:var(--surface);border:1px solid var(--border);overflow:auto;border-radius:12px;width:100%;max-width:620px;max-height:85vh;padding:1.25rem}.modal-head{display:flex;align-items: center;gap:.5rem;margin-bottom:.9rem}.modal-head button{margin-left:auto}.modal-content{line-height:1.6}.modal-meta{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:.5rem 1rem;margin:1rem 0}.modal-meta dt{color:var(--muted);text-transform:uppercase;letter-spacing:.06em;font-size:.72rem}.modal-meta dd{word-break:break-word;margin:0;font-size:.85rem}.levels{border-left:2px solid var(--border);margin:1rem 0;padding-left:.8rem;font-size:.85rem}.levels strong{color:var(--accent);margin-right:.4rem}.decay-canvas{background:#12151d;border-radius:8px;width:100%;max-width:520px}.modal-actions{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:1rem}.imperative-view{position:relative}.imperative-canvas{border:1px solid var(--border);overflow:hidden;position:relative;background:#0d0f16;border-radius:10px;width:100%}.galaxy-legend,.promenade-hud{position:absolute;border:1px solid var(--border);background:#171a23eb;border-radius:8px;padding:.75rem;font-size:.82rem;top:1rem;right:1rem}.galaxy-legend-item{display:flex;align-items: center;gap:.4rem;margin:.15rem 0}.galaxy-legend-dot{border-radius:50%;width:9px;height:9px}.river-controls,.promenade-controls{display:flex;flex-wrap:wrap;align-items: center;gap:.75rem;margin-top:.75rem}.river-controls input[type=range]{flex:1;min-width:180px}.river-tooltip{position:absolute;border:1px solid var(--border);pointer-events:none;z-index:60;background:#171a23f7;border-radius:8px;max-width:280px;padding:.7rem;font-size:.85rem}select{background:var(--surface);color:var(--text);border:1px solid var(--border);font:inherit;border-radius:6px;width:100%;padding:.5rem .6rem;font-size:.9rem}.replay-panes{display:grid;grid-template-columns:1fr 1fr;gap:1rem;margin:1.25rem 0}.replay-panes h3{text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin:0 0 .6rem;font-size:.8rem}.replay-transcript,.replay-events{background:var(--surface);border:1px solid var(--border);overflow-y:auto;border-radius:10px;max-height:340px;padding:.85rem}.replay-message{border-left:2px solid var(--border);margin-bottom:.7rem;padding-left:.6rem}.replay-message time,.replay-event time{color:var(--muted);font-size:.72rem}.replay-message p{margin:.2rem 0 0;font-size:.85rem}.replay-event{display:flex;border-bottom:1px solid #1e2230;align-items:baseline;gap:.5rem;padding:.25rem 0;font-size:.82rem}.replay-event-label{flex:1}.replay-event.encoded{color:#22c55e}.replay-event.decayed{color:#f97316}.replay-event.recalled{color:#06b6d4}.replay-timeline{display:flex;flex-wrap:wrap;align-items: center;gap:.75rem}.replay-timeline input[type=range]{flex:1;min-width:180px}.replay-position{font-variant-numeric:tabular-nums;color:var(--muted);font-size:.82rem}.replay-counts{display:flex;color:var(--muted);flex-wrap:wrap;gap:1.5rem;margin-top:.8rem;font-size:.82rem}.similar-panel{border-top:1px solid var(--border);margin-top:1rem;padding-top:.9rem}.similar-panel h4{text-transform:uppercase;letter-spacing:.07em;color:var(--muted);margin:0 0 .6rem;font-size:.8rem}.similar-item{display:flex;border-bottom:1px solid #1e2230;align-items: center;gap:.6rem;padding:.5rem 0}.similar-item p{flex:1;margin:0;font-size:.85rem}.score{color:var(--muted);white-space:nowrap;font-size:.72rem}.merge-confirm{background:#1c1420;border:1px solid #4a2436;border-radius:8px;margin-top:.9rem;padding:.85rem}.merge-confirm blockquote{border-left:2px solid var(--accent);margin:.5rem 0;padding-left:.7rem;font-size:.85rem}.merge-warning{color:#ff9f43;font-size:.8rem}@media (max-width:720px){.replay-panes,.field-row{grid-template-columns:1fr}}.new-trace-toggle{margin-bottom:1.25rem}.checkbox{display:flex;color:var(--muted);align-items: center;gap:.5rem;font-size:.85rem}.checkbox input{width:auto}.search-row{display:flex;align-items:stretch;gap:.5rem;margin-bottom:1.25rem}.search-row .search{flex:1;margin-bottom:0}.advanced-filters{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));background:var(--surface);border:1px solid var(--border);border-radius:10px;align-items: end;gap:.7rem;margin-bottom:1.25rem;padding:.9rem}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function fn(r,t){let u;if(t===void 0){for(let f of r)if(f!=null&&(u<f||u===void 0&&f>=f))u=f}else{let f=-1;for(let o of r)if((o=t(o,++f,r))!=null&&(u<o||u===void 0&&o>=o))u=o}return u}function on(r,t){let u;if(t===void 0){for(let f of r)if(f!=null&&(u>f||u===void 0&&f>=f))u=f}else{let f=-1;for(let o of r)if((o=t(o,++f,r))!=null&&(u>o||u===void 0&&o>=o))u=o}return u}function Yr(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function Wu(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function Rr(r){let t,u,f;if(r.length!==2)t=Yr,u=(c,l)=>Yr(r(c),l),f=(c,l)=>r(c)-l;else t=r===Yr||r===Wu?r:Ei,u=r,f=r;function o(c,l,h=0,m=c.length){if(h<m){if(t(l,l)!==0)return m;do{let x=h+m>>>1;if(u(c[x],l)<0)h=x+1;else m=x}while(h<m)}return h}function n(c,l,h=0,m=c.length){if(h<m){if(t(l,l)!==0)return m;do{let x=h+m>>>1;if(u(c[x],l)<=0)h=x+1;else m=x}while(h<m)}return h}function i(c,l,h=0,m=c.length){let x=o(c,l,h,m-1);return x>h&&f(c[x-1],l)>-f(c[x],l)?x-1:x}return{left:o,center:i,right:n}}function Ei(){return 0}function Gu(r){return r===null?NaN:+r}var nn=Rr(Yr),cn=nn.right,gi=nn.left,yi=Rr(Gu).center,eu=cn;var ji=Math.sqrt(50),bi=Math.sqrt(10),vi=Math.sqrt(2);function kt(r,t,u){let f=(t-r)/Math.max(0,u),o=Math.floor(Math.log10(f)),n=f/Math.pow(10,o),i=n>=ji?10:n>=bi?5:n>=vi?2:1,c,l,h;if(o<0){if(h=Math.pow(10,-o)/i,c=Math.round(r*h),l=Math.round(t*h),c/h<r)++c;if(l/h>t)--l;h=-h}else{if(h=Math.pow(10,o)*i,c=Math.round(r/h),l=Math.round(t/h),c*h<r)++c;if(l*h>t)--l}if(l<c&&0.5<=u&&u<2)return kt(r,t,u*2);return[c,l,h]}function dt(r,t,u){if(t=+t,r=+r,u=+u,!(u>0))return[];if(r===t)return[r];let f=t<r,[o,n,i]=f?kt(t,r,u):kt(r,t,u);if(!(n>=o))return[];let c=n-o+1,l=Array(c);if(f)if(i<0)for(let h=0;h<c;++h)l[h]=(n-h)/-i;else for(let h=0;h<c;++h)l[h]=(n-h)*i;else if(i<0)for(let h=0;h<c;++h)l[h]=(o+h)/-i;else for(let h=0;h<c;++h)l[h]=(o+h)*i;return l}function St(r,t,u){return t=+t,r=+r,u=+u,kt(r,t,u)[2]}function tt(r,t,u){t=+t,r=+r,u=+u;let f=t<r,o=f?St(t,r,u):St(r,t,u);return(f?-1:1)*(o<0?1/-o:o)}function Yu(r){return r}var Ru=1,zu=2,qu=3,wt=4,hn=0.000001;function ki(r){return"translate("+r+",0)"}function di(r){return"translate(0,"+r+")"}function r0(r){return(t)=>+r(t)}function t0(r,t){if(t=Math.max(0,r.bandwidth()-t*2)/2,r.round())t=Math.round(t);return(u)=>+r(u)+t}function u0(){return!this.__axis}function ln(r,t){var u=[],f=null,o=null,n=6,i=6,c=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:0.5,h=r===Ru||r===wt?-1:1,m=r===wt||r===zu?"x":"y",x=r===Ru||r===qu?ki:di;function s(p){var B=f==null?t.ticks?t.ticks.apply(t,u):t.domain():f,I=o==null?t.tickFormat?t.tickFormat.apply(t,u):Yu:o,S=Math.max(n,0)+c,_=t.range(),O=+_[0]+l,N=+_[_.length-1]+l,M=(t.bandwidth?t0:r0)(t.copy(),l),T=p.selection?p.selection():p,w=T.selectAll(".domain").data([null]),J=T.selectAll(".tick").data(B,t).order(),L=J.exit(),a=J.enter().append("g").attr("class","tick"),Z=J.select("line"),X=J.select("text");if(w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),J=J.merge(a),Z=Z.merge(a.append("line").attr("stroke","currentColor").attr(m+"2",h*n)),X=X.merge(a.append("text").attr("fill","currentColor").attr(m,h*S).attr("dy",r===Ru?"0em":r===qu?"0.71em":"0.32em")),p!==T)w=w.transition(p),J=J.transition(p),Z=Z.transition(p),X=X.transition(p),L=L.transition(p).attr("opacity",hn).attr("transform",function(Q){return isFinite(Q=M(Q))?x(Q+l):this.getAttribute("transform")}),a.attr("opacity",hn).attr("transform",function(Q){var e=this.parentNode.__axis;return x((e&&isFinite(e=e(Q))?e:M(Q))+l)});L.remove(),w.attr("d",r===wt||r===zu?i?"M"+h*i+","+O+"H"+l+"V"+N+"H"+h*i:"M"+l+","+O+"V"+N:i?"M"+O+","+h*i+"V"+l+"H"+N+"V"+h*i:"M"+O+","+l+"H"+N),J.attr("opacity",1).attr("transform",function(Q){return x(M(Q)+l)}),Z.attr(m+"2",h*n),X.attr(m,h*S).text(I),T.filter(u0).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",r===zu?"start":r===wt?"end":"middle"),T.each(function(){this.__axis=M})}return s.scale=function(p){return arguments.length?(t=p,s):t},s.ticks=function(){return u=Array.from(arguments),s},s.tickArguments=function(p){return arguments.length?(u=p==null?[]:Array.from(p),s):u.slice()},s.tickValues=function(p){return arguments.length?(f=p==null?null:Array.from(p),s):f&&f.slice()},s.tickFormat=function(p){return arguments.length?(o=p,s):o},s.tickSize=function(p){return arguments.length?(n=i=+p,s):n},s.tickSizeInner=function(p){return arguments.length?(n=+p,s):n},s.tickSizeOuter=function(p){return arguments.length?(i=+p,s):i},s.tickPadding=function(p){return arguments.length?(c=+p,s):c},s.offset=function(p){return arguments.length?(l=+p,s):l},s}function f0(r){return ln(qu,r)}function o0(r){return ln(wt,r)}function n0(){}function Ur(r){return r==null?n0:function(){return this.querySelector(r)}}function Eu(r){if(typeof r!=="function")r=Ur(r);for(var t=this._groups,u=t.length,f=Array(u),o=0;o<u;++o)for(var n=t[o],i=n.length,c=f[o]=Array(i),l,h,m=0;m<i;++m)if((l=n[m])&&(h=r.call(l,l.__data__,m,n))){if("__data__"in l)h.__data__=l.__data__;c[m]=h}return new E(f,this._parents)}function gu(r){return r==null?[]:Array.isArray(r)?r:Array.from(r)}function i0(){return[]}function ut(r){return r==null?i0:function(){return this.querySelectorAll(r)}}function c0(r){return function(){return gu(r.apply(this,arguments))}}function yu(r){if(typeof r==="function")r=c0(r);else r=ut(r);for(var t=this._groups,u=t.length,f=[],o=[],n=0;n<u;++n)for(var i=t[n],c=i.length,l,h=0;h<c;++h)if(l=i[h])f.push(r.call(l,l.__data__,h,i)),o.push(l);return new E(f,o)}function ft(r){return function(){return this.matches(r)}}function ru(r){return function(t){return t.matches(r)}}var h0=Array.prototype.find;function l0(r){return function(){return h0.call(this.children,r)}}function m0(){return this.firstElementChild}function ju(r){return this.select(r==null?m0:l0(typeof r==="function"?r:ru(r)))}var s0=Array.prototype.filter;function p0(){return Array.from(this.children)}function x0(r){return function(){return s0.call(this.children,r)}}function bu(r){return this.selectAll(r==null?p0:x0(typeof r==="function"?r:ru(r)))}function vu(r){if(typeof r!=="function")r=ft(r);for(var t=this._groups,u=t.length,f=Array(u),o=0;o<u;++o)for(var n=t[o],i=n.length,c=f[o]=[],l,h=0;h<i;++h)if((l=n[h])&&r.call(l,l.__data__,h,n))c.push(l);return new E(f,this._parents)}function Ct(r){return Array(r.length)}function ku(){return new E(this._enter||this._groups.map(Ct),this._parents)}function Ft(r,t){this.ownerDocument=r.ownerDocument,this.namespaceURI=r.namespaceURI,this._next=null,this._parent=r,this.__data__=t}Ft.prototype={constructor:Ft,appendChild:function(r){return this._parent.insertBefore(r,this._next)},insertBefore:function(r,t){return this._parent.insertBefore(r,t)},querySelector:function(r){return this._parent.querySelector(r)},querySelectorAll:function(r){return this._parent.querySelectorAll(r)}};function du(r){return function(){return r}}function M0(r,t,u,f,o,n){var i=0,c,l=t.length,h=n.length;for(;i<h;++i)if(c=t[i])c.__data__=n[i],f[i]=c;else u[i]=new Ft(r,n[i]);for(;i<l;++i)if(c=t[i])o[i]=c}function A0(r,t,u,f,o,n,i){var c,l,h=new Map,m=t.length,x=n.length,s=Array(m),p;for(c=0;c<m;++c)if(l=t[c])if(s[c]=p=i.call(l,l.__data__,c,t)+"",h.has(p))o[c]=l;else h.set(p,l);for(c=0;c<x;++c)if(p=i.call(r,n[c],c,n)+"",l=h.get(p))f[c]=l,l.__data__=n[c],h.delete(p);else u[c]=new Ft(r,n[c]);for(c=0;c<m;++c)if((l=t[c])&&h.get(s[c])===l)o[c]=l}function _0(r){return r.__data__}function rf(r,t){if(!arguments.length)return Array.from(this,_0);var u=t?A0:M0,f=this._parents,o=this._groups;if(typeof r!=="function")r=du(r);for(var n=o.length,i=Array(n),c=Array(n),l=Array(n),h=0;h<n;++h){var m=f[h],x=o[h],s=x.length,p=I0(r.call(m,m&&m.__data__,h,f)),B=p.length,I=c[h]=Array(B),S=i[h]=Array(B),_=l[h]=Array(s);u(m,x,I,S,_,p,t);for(var O=0,N=0,M,T;O<B;++O)if(M=I[O]){if(O>=N)N=O+1;while(!(T=S[N])&&++N<B);M._next=T||null}}return i=new E(i,f),i._enter=c,i._exit=l,i}function I0(r){return typeof r==="object"&&"length"in r?r:Array.from(r)}function tf(){return new E(this._exit||this._groups.map(Ct),this._parents)}function uf(r,t,u){var f=this.enter(),o=this,n=this.exit();if(typeof r==="function"){if(f=r(f),f)f=f.selection()}else f=f.append(r+"");if(t!=null){if(o=t(o),o)o=o.selection()}if(u==null)n.remove();else u(n);return f&&o?f.merge(o).order():o}function ff(r){var t=r.selection?r.selection():r;for(var u=this._groups,f=t._groups,o=u.length,n=f.length,i=Math.min(o,n),c=Array(o),l=0;l<i;++l)for(var h=u[l],m=f[l],x=h.length,s=c[l]=Array(x),p,B=0;B<x;++B)if(p=h[B]||m[B])s[B]=p;for(;l<o;++l)c[l]=u[l];return new E(c,this._parents)}function of(){for(var r=this._groups,t=-1,u=r.length;++t<u;)for(var f=r[t],o=f.length-1,n=f[o],i;--o>=0;)if(i=f[o]){if(n&&i.compareDocumentPosition(n)^4)n.parentNode.insertBefore(i,n);n=i}return this}function nf(r){if(!r)r=S0;function t(x,s){return x&&s?r(x.__data__,s.__data__):!x-!s}for(var u=this._groups,f=u.length,o=Array(f),n=0;n<f;++n){for(var i=u[n],c=i.length,l=o[n]=Array(c),h,m=0;m<c;++m)if(h=i[m])l[m]=h;l.sort(t)}return new E(o,this._parents).order()}function S0(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function cf(){var r=arguments[0];return arguments[0]=this,r.apply(null,arguments),this}function hf(){return Array.from(this)}function lf(){for(var r=this._groups,t=0,u=r.length;t<u;++t)for(var f=r[t],o=0,n=f.length;o<n;++o){var i=f[o];if(i)return i}return null}function mf(){let r=0;for(let t of this)++r;return r}function sf(){return!this.node()}function pf(r){for(var t=this._groups,u=0,f=t.length;u<f;++u)for(var o=t[u],n=0,i=o.length,c;n<i;++n)if(c=o[n])r.call(c,c.__data__,n,o);return this}var tu="http://www.w3.org/1999/xhtml",xf={svg:"http://www.w3.org/2000/svg",xhtml:tu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Br(r){var t=r+="",u=t.indexOf(":");if(u>=0&&(t=r.slice(0,u))!=="xmlns")r=r.slice(u+1);return xf.hasOwnProperty(t)?{space:xf[t],local:r}:r}function w0(r){return function(){this.removeAttribute(r)}}function C0(r){return function(){this.removeAttributeNS(r.space,r.local)}}function F0(r,t){return function(){this.setAttribute(r,t)}}function B0(r,t){return function(){this.setAttributeNS(r.space,r.local,t)}}function O0(r,t){return function(){var u=t.apply(this,arguments);if(u==null)this.removeAttribute(r);else this.setAttribute(r,u)}}function N0(r,t){return function(){var u=t.apply(this,arguments);if(u==null)this.removeAttributeNS(r.space,r.local);else this.setAttributeNS(r.space,r.local,u)}}function Mf(r,t){var u=Br(r);if(arguments.length<2){var f=this.node();return u.local?f.getAttributeNS(u.space,u.local):f.getAttribute(u)}return this.each((t==null?u.local?C0:w0:typeof t==="function"?u.local?N0:O0:u.local?B0:F0)(u,t))}function Bt(r){return r.ownerDocument&&r.ownerDocument.defaultView||r.document&&r||r.defaultView}function T0(r){return function(){this.style.removeProperty(r)}}function V0(r,t,u){return function(){this.style.setProperty(r,t,u)}}function J0(r,t,u){return function(){var f=t.apply(this,arguments);if(f==null)this.style.removeProperty(r);else this.style.setProperty(r,f,u)}}function Af(r,t,u){return arguments.length>1?this.each((t==null?T0:typeof t==="function"?J0:V0)(r,t,u==null?"":u)):Zr(this.node(),r)}function Zr(r,t){return r.style.getPropertyValue(t)||Bt(r).getComputedStyle(r,null).getPropertyValue(t)}function P0(r){return function(){delete this[r]}}function D0(r,t){return function(){this[r]=t}}function Q0(r,t){return function(){var u=t.apply(this,arguments);if(u==null)delete this[r];else this[r]=u}}function _f(r,t){return arguments.length>1?this.each((t==null?P0:typeof t==="function"?Q0:D0)(r,t)):this.node()[r]}function mn(r){return r.trim().split(/^|\s+/)}function If(r){return r.classList||new sn(r)}function sn(r){this._node=r,this._names=mn(r.getAttribute("class")||"")}sn.prototype={add:function(r){var t=this._names.indexOf(r);if(t<0)this._names.push(r),this._node.setAttribute("class",this._names.join(" "))},remove:function(r){var t=this._names.indexOf(r);if(t>=0)this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" "))},contains:function(r){return this._names.indexOf(r)>=0}};function pn(r,t){var u=If(r),f=-1,o=t.length;while(++f<o)u.add(t[f])}function xn(r,t){var u=If(r),f=-1,o=t.length;while(++f<o)u.remove(t[f])}function $0(r){return function(){pn(this,r)}}function H0(r){return function(){xn(this,r)}}function L0(r,t){return function(){(t.apply(this,arguments)?pn:xn)(this,r)}}function Sf(r,t){var u=mn(r+"");if(arguments.length<2){var f=If(this.node()),o=-1,n=u.length;while(++o<n)if(!f.contains(u[o]))return!1;return!0}return this.each((typeof t==="function"?L0:t?$0:H0)(u,t))}function U0(){this.textContent=""}function Z0(r){return function(){this.textContent=r}}function K0(r){return function(){var t=r.apply(this,arguments);this.textContent=t==null?"":t}}function wf(r){return arguments.length?this.each(r==null?U0:(typeof r==="function"?K0:Z0)(r)):this.node().textContent}function a0(){this.innerHTML=""}function X0(r){return function(){this.innerHTML=r}}function W0(r){return function(){var t=r.apply(this,arguments);this.innerHTML=t==null?"":t}}function Cf(r){return arguments.length?this.each(r==null?a0:(typeof r==="function"?W0:X0)(r)):this.node().innerHTML}function G0(){if(this.nextSibling)this.parentNode.appendChild(this)}function Ff(){return this.each(G0)}function e0(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Bf(){return this.each(e0)}function Y0(r){return function(){var t=this.ownerDocument,u=this.namespaceURI;return u===tu&&t.documentElement.namespaceURI===tu?t.createElement(r):t.createElementNS(u,r)}}function R0(r){return function(){return this.ownerDocument.createElementNS(r.space,r.local)}}function Ot(r){var t=Br(r);return(t.local?R0:Y0)(t)}function Of(r){var t=typeof r==="function"?r:Ot(r);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function z0(){return null}function Nf(r,t){var u=typeof r==="function"?r:Ot(r),f=t==null?z0:typeof t==="function"?t:Ur(t);return this.select(function(){return this.insertBefore(u.apply(this,arguments),f.apply(this,arguments)||null)})}function q0(){var r=this.parentNode;if(r)r.removeChild(this)}function Tf(){return this.each(q0)}function E0(){var r=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(r,this.nextSibling):r}function g0(){var r=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(r,this.nextSibling):r}function Vf(r){return this.select(r?g0:E0)}function Jf(r){return arguments.length?this.property("__data__",r):this.node().__data__}function y0(r){return function(t){r.call(this,t,this.__data__)}}function j0(r){return r.trim().split(/^|\s+/).map(function(t){var u="",f=t.indexOf(".");if(f>=0)u=t.slice(f+1),t=t.slice(0,f);return{type:t,name:u}})}function b0(r){return function(){var t=this.__on;if(!t)return;for(var u=0,f=-1,o=t.length,n;u<o;++u)if(n=t[u],(!r.type||n.type===r.type)&&n.name===r.name)this.removeEventListener(n.type,n.listener,n.options);else t[++f]=n;if(++f)t.length=f;else delete this.__on}}function v0(r,t,u){return function(){var f=this.__on,o,n=y0(t);if(f){for(var i=0,c=f.length;i<c;++i)if((o=f[i]).type===r.type&&o.name===r.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=n,o.options=u),o.value=t;return}}if(this.addEventListener(r.type,n,u),o={type:r.type,name:r.name,value:t,listener:n,options:u},!f)this.__on=[o];else f.push(o)}}function Pf(r,t,u){var f=j0(r+""),o,n=f.length,i;if(arguments.length<2){var c=this.node().__on;if(c){for(var l=0,h=c.length,m;l<h;++l)for(o=0,m=c[l];o<n;++o)if((i=f[o]).type===m.type&&i.name===m.name)return m.value}return}c=t?v0:b0;for(o=0;o<n;++o)this.each(c(f[o],t,u));return this}function Mn(r,t,u){var f=Bt(r),o=f.CustomEvent;if(typeof o==="function")o=new o(t,u);else if(o=f.document.createEvent("Event"),u)o.initEvent(t,u.bubbles,u.cancelable),o.detail=u.detail;else o.initEvent(t,!1,!1);r.dispatchEvent(o)}function k0(r,t){return function(){return Mn(this,r,t)}}function d0(r,t){return function(){return Mn(this,r,t.apply(this,arguments))}}function Df(r,t){return this.each((typeof t==="function"?d0:k0)(r,t))}function*Qf(){for(var r=this._groups,t=0,u=r.length;t<u;++t)for(var f=r[t],o=0,n=f.length,i;o<n;++o)if(i=f[o])yield i}var $f=[null];function E(r,t){this._groups=r,this._parents=t}function An(){return new E([[document.documentElement]],$f)}function rc(){return this}E.prototype=An.prototype={constructor:E,select:Eu,selectAll:yu,selectChild:ju,selectChildren:bu,filter:vu,data:rf,enter:ku,exit:tf,join:uf,merge:ff,selection:rc,order:of,sort:nf,call:cf,nodes:hf,node:lf,size:mf,empty:sf,each:pf,attr:Mf,style:Af,property:_f,classed:Sf,text:wf,html:Cf,raise:Ff,lower:Bf,append:Of,insert:Nf,remove:Tf,clone:Vf,datum:Jf,on:Pf,dispatch:Df,[Symbol.iterator]:Qf};var Vr=An;function or(r){return typeof r==="string"?new E([[document.querySelector(r)]],[document.documentElement]):new E([[r]],$f)}function Hf(r){let t;while(t=r.sourceEvent)r=t;return r}function mr(r,t){if(r=Hf(r),t===void 0)t=r.currentTarget;if(t){var u=t.ownerSVGElement||t;if(u.createSVGPoint){var f=u.createSVGPoint();return f.x=r.clientX,f.y=r.clientY,f=f.matrixTransform(t.getScreenCTM().inverse()),[f.x,f.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[r.clientX-o.left-t.clientLeft,r.clientY-o.top-t.clientTop]}}return[r.pageX,r.pageY]}var tc={value:()=>{}};function In(){for(var r=0,t=arguments.length,u={},f;r<t;++r){if(!(f=arguments[r]+"")||f in u||/[\s.]/.test(f))throw Error("illegal type: "+f);u[f]=[]}return new uu(u)}function uu(r){this._=r}function uc(r,t){return r.trim().split(/^|\s+/).map(function(u){var f="",o=u.indexOf(".");if(o>=0)f=u.slice(o+1),u=u.slice(0,o);if(u&&!t.hasOwnProperty(u))throw Error("unknown type: "+u);return{type:u,name:f}})}uu.prototype=In.prototype={constructor:uu,on:function(r,t){var u=this._,f=uc(r+"",u),o,n=-1,i=f.length;if(arguments.length<2){while(++n<i)if((o=(r=f[n]).type)&&(o=fc(u[o],r.name)))return o;return}if(t!=null&&typeof t!=="function")throw Error("invalid callback: "+t);while(++n<i)if(o=(r=f[n]).type)u[o]=_n(u[o],r.name,t);else if(t==null)for(o in u)u[o]=_n(u[o],r.name,null);return this},copy:function(){var r={},t=this._;for(var u in t)r[u]=t[u].slice();return new uu(r)},call:function(r,t){if((o=arguments.length-2)>0)for(var u=Array(o),f=0,o,n;f<o;++f)u[f]=arguments[f+2];if(!this._.hasOwnProperty(r))throw Error("unknown type: "+r);for(n=this._[r],f=0,o=n.length;f<o;++f)n[f].value.apply(t,u)},apply:function(r,t,u){if(!this._.hasOwnProperty(r))throw Error("unknown type: "+r);for(var f=this._[r],o=0,n=f.length;o<n;++o)f[o].value.apply(t,u)}};function fc(r,t){for(var u=0,f=r.length,o;u<f;++u)if((o=r[u]).name===t)return o.value}function _n(r,t,u){for(var f=0,o=r.length;f<o;++f)if(r[f].name===t){r[f]=tc,r=r.slice(0,f).concat(r.slice(f+1));break}if(u!=null)r.push({name:t,value:u});return r}var Jr=In;var Sn={passive:!1},zr={capture:!0,passive:!1};function fu(r){r.stopImmediatePropagation()}function Pr(r){r.preventDefault(),r.stopImmediatePropagation()}function ot(r){var t=r.document.documentElement,u=or(r).on("dragstart.drag",Pr,zr);if("onselectstart"in t)u.on("selectstart.drag",Pr,zr);else t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none"}function Nt(r,t){var u=r.document.documentElement,f=or(r).on("dragstart.drag",null);if(t)f.on("click.drag",Pr,zr),setTimeout(function(){f.on("click.drag",null)},0);if("onselectstart"in u)f.on("selectstart.drag",null);else u.style.MozUserSelect=u.__noselect,delete u.__noselect}var Tt=(r)=>()=>r;function Vt(r,{sourceEvent:t,subject:u,target:f,identifier:o,active:n,x:i,y:c,dx:l,dy:h,dispatch:m}){Object.defineProperties(this,{type:{value:r,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:u,enumerable:!0,configurable:!0},target:{value:f,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:n,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:m}})}Vt.prototype.on=function(){var r=this._.on.apply(this._,arguments);return r===this._?this:r};function oc(r){return!r.ctrlKey&&!r.button}function nc(){return this.parentNode}function ic(r,t){return t==null?{x:r.x,y:r.y}:t}function cc(){return navigator.maxTouchPoints||"ontouchstart"in this}function wn(){var r=oc,t=nc,u=ic,f=cc,o={},n=Jr("start","drag","end"),i=0,c,l,h,m,x=0;function s(M){M.on("mousedown.drag",p).filter(f).on("touchstart.drag",S).on("touchmove.drag",_,Sn).on("touchend.drag touchcancel.drag",O).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(M,T){if(m||!r.call(this,M,T))return;var w=N(this,t.call(this,M,T),M,T,"mouse");if(!w)return;or(M.view).on("mousemove.drag",B,zr).on("mouseup.drag",I,zr),ot(M.view),fu(M),h=!1,c=M.clientX,l=M.clientY,w("start",M)}function B(M){if(Pr(M),!h){var T=M.clientX-c,w=M.clientY-l;h=T*T+w*w>x}o.mouse("drag",M)}function I(M){or(M.view).on("mousemove.drag mouseup.drag",null),Nt(M.view,h),Pr(M),o.mouse("end",M)}function S(M,T){if(!r.call(this,M,T))return;var w=M.changedTouches,J=t.call(this,M,T),L=w.length,a,Z;for(a=0;a<L;++a)if(Z=N(this,J,M,T,w[a].identifier,w[a]))fu(M),Z("start",M,w[a])}function _(M){var T=M.changedTouches,w=T.length,J,L;for(J=0;J<w;++J)if(L=o[T[J].identifier])Pr(M),L("drag",M,T[J])}function O(M){var T=M.changedTouches,w=T.length,J,L;if(m)clearTimeout(m);m=setTimeout(function(){m=null},500);for(J=0;J<w;++J)if(L=o[T[J].identifier])fu(M),L("end",M,T[J])}function N(M,T,w,J,L,a){var Z=n.copy(),X=mr(a||w,T),Q,e,A;if((A=u.call(M,new Vt("beforestart",{sourceEvent:w,target:s,identifier:L,active:i,x:X[0],y:X[1],dx:0,dy:0,dispatch:Z}),J))==null)return;return Q=A.x-X[0]||0,e=A.y-X[1]||0,function V(C,D,H){var U=X,$;switch(C){case"start":o[L]=V,$=i++;break;case"end":delete o[L],--i;case"drag":X=mr(H||D,T),$=i;break}Z.call(C,M,new Vt(C,{sourceEvent:D,subject:A,target:s,identifier:L,active:$,x:X[0]+Q,y:X[1]+e,dx:X[0]-U[0],dy:X[1]-U[1],dispatch:Z}),J)}}return s.filter=function(M){return arguments.length?(r=typeof M==="function"?M:Tt(!!M),s):r},s.container=function(M){return arguments.length?(t=typeof M==="function"?M:Tt(M),s):t},s.subject=function(M){return arguments.length?(u=typeof M==="function"?M:Tt(M),s):u},s.touchable=function(M){return arguments.length?(f=typeof M==="function"?M:Tt(!!M),s):f},s.on=function(){var M=n.on.apply(n,arguments);return M===n?s:M},s.clickDistance=function(M){return arguments.length?(x=(M=+M)*M,s):Math.sqrt(x)},s}function Lf(r){let t=+this._x.call(null,r),u=+this._y.call(null,r);return Cn(this.cover(t,u),t,u,r)}function Cn(r,t,u,f){if(isNaN(t)||isNaN(u))return r;var o,n=r._root,i={data:f},c=r._x0,l=r._y0,h=r._x1,m=r._y1,x,s,p,B,I,S,_,O;if(!n)return r._root=i,r;while(n.length){if(I=t>=(x=(c+h)/2))c=x;else h=x;if(S=u>=(s=(l+m)/2))l=s;else m=s;if(o=n,!(n=n[_=S<<1|I]))return o[_]=i,r}if(p=+r._x.call(null,n.data),B=+r._y.call(null,n.data),t===p&&u===B)return i.next=n,o?o[_]=i:r._root=i,r;do{if(o=o?o[_]=[,,,,]:r._root=[,,,,],I=t>=(x=(c+h)/2))c=x;else h=x;if(S=u>=(s=(l+m)/2))l=s;else m=s}while((_=S<<1|I)===(O=(B>=s)<<1|p>=x));return o[O]=n,o[_]=i,r}function Fn(r){var t,u,f=r.length,o,n,i=Array(f),c=Array(f),l=1/0,h=1/0,m=-1/0,x=-1/0;for(u=0;u<f;++u){if(isNaN(o=+this._x.call(null,t=r[u]))||isNaN(n=+this._y.call(null,t)))continue;if(i[u]=o,c[u]=n,o<l)l=o;if(o>m)m=o;if(n<h)h=n;if(n>x)x=n}if(l>m||h>x)return this;this.cover(l,h).cover(m,x);for(u=0;u<f;++u)Cn(this,i[u],c[u],r[u]);return this}function Uf(r,t){if(isNaN(r=+r)||isNaN(t=+t))return this;var u=this._x0,f=this._y0,o=this._x1,n=this._y1;if(isNaN(u))o=(u=Math.floor(r))+1,n=(f=Math.floor(t))+1;else{var i=o-u||1,c=this._root,l,h;while(u>r||r>=o||f>t||t>=n)switch(h=(t<f)<<1|r<u,l=[,,,,],l[h]=c,c=l,i*=2,h){case 0:o=u+i,n=f+i;break;case 1:u=o-i,n=f+i;break;case 2:o=u+i,f=n-i;break;case 3:u=o-i,f=n-i;break}if(this._root&&this._root.length)this._root=c}return this._x0=u,this._y0=f,this._x1=o,this._y1=n,this}function Zf(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}function Kf(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function j(r,t,u,f,o){this.node=r,this.x0=t,this.y0=u,this.x1=f,this.y1=o}function af(r,t,u){var f,o=this._x0,n=this._y0,i,c,l,h,m=this._x1,x=this._y1,s=[],p=this._root,B,I;if(p)s.push(new j(p,o,n,m,x));if(u==null)u=1/0;else o=r-u,n=t-u,m=r+u,x=t+u,u*=u;while(B=s.pop()){if(!(p=B.node)||(i=B.x0)>m||(c=B.y0)>x||(l=B.x1)<o||(h=B.y1)<n)continue;if(p.length){var S=(i+l)/2,_=(c+h)/2;if(s.push(new j(p[3],S,_,l,h),new j(p[2],i,_,S,h),new j(p[1],S,c,l,_),new j(p[0],i,c,S,_)),I=(t>=_)<<1|r>=S)B=s[s.length-1],s[s.length-1]=s[s.length-1-I],s[s.length-1-I]=B}else{var O=r-+this._x.call(null,p.data),N=t-+this._y.call(null,p.data),M=O*O+N*N;if(M<u){var T=Math.sqrt(u=M);o=r-T,n=t-T,m=r+T,x=t+T,f=p.data}}}return f}function Xf(r){if(isNaN(m=+this._x.call(null,r))||isNaN(x=+this._y.call(null,r)))return this;var t,u=this._root,f,o,n,i=this._x0,c=this._y0,l=this._x1,h=this._y1,m,x,s,p,B,I,S,_;if(!u)return this;if(u.length)while(!0){if(B=m>=(s=(i+l)/2))i=s;else l=s;if(I=x>=(p=(c+h)/2))c=p;else h=p;if(t=u,!(u=u[S=I<<1|B]))return this;if(!u.length)break;if(t[S+1&3]||t[S+2&3]||t[S+3&3])f=t,_=S}while(u.data!==r)if(o=u,!(u=u.next))return this;if(n=u.next)delete u.next;if(o)return n?o.next=n:delete o.next,this;if(!t)return this._root=n,this;if(n?t[S]=n:delete t[S],(u=t[0]||t[1]||t[2]||t[3])&&u===(t[3]||t[2]||t[1]||t[0])&&!u.length)if(f)f[_]=u;else this._root=u;return this}function Bn(r){for(var t=0,u=r.length;t<u;++t)this.remove(r[t]);return this}function Wf(){return this._root}function Gf(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}function ef(r){var t=[],u,f=this._root,o,n,i,c,l;if(f)t.push(new j(f,this._x0,this._y0,this._x1,this._y1));while(u=t.pop())if(!r(f=u.node,n=u.x0,i=u.y0,c=u.x1,l=u.y1)&&f.length){var h=(n+c)/2,m=(i+l)/2;if(o=f[3])t.push(new j(o,h,m,c,l));if(o=f[2])t.push(new j(o,n,m,h,l));if(o=f[1])t.push(new j(o,h,i,c,m));if(o=f[0])t.push(new j(o,n,i,h,m))}return this}function Yf(r){var t=[],u=[],f;if(this._root)t.push(new j(this._root,this._x0,this._y0,this._x1,this._y1));while(f=t.pop()){var o=f.node;if(o.length){var n,i=f.x0,c=f.y0,l=f.x1,h=f.y1,m=(i+l)/2,x=(c+h)/2;if(n=o[0])t.push(new j(n,i,c,m,x));if(n=o[1])t.push(new j(n,m,c,l,x));if(n=o[2])t.push(new j(n,i,x,m,h));if(n=o[3])t.push(new j(n,m,x,l,h))}u.push(f)}while(f=u.pop())r(f.node,f.x0,f.y0,f.x1,f.y1);return this}function On(r){return r[0]}function Rf(r){return arguments.length?(this._x=r,this):this._x}function Nn(r){return r[1]}function zf(r){return arguments.length?(this._y=r,this):this._y}function qr(r,t,u){var f=new qf(t==null?On:t,u==null?Nn:u,NaN,NaN,NaN,NaN);return r==null?f:f.addAll(r)}function qf(r,t,u,f,o,n){this._x=r,this._y=t,this._x0=u,this._y0=f,this._x1=o,this._y1=n,this._root=void 0}function Tn(r){var t={data:r.data},u=t;while(r=r.next)u=u.next={data:r.data};return t}var tr=qr.prototype=qf.prototype;tr.copy=function(){var r=new qf(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,u,f;if(!t)return r;if(!t.length)return r._root=Tn(t),r;u=[{source:t,target:r._root=[,,,,]}];while(t=u.pop())for(var o=0;o<4;++o)if(f=t.source[o])if(f.length)u.push({source:f,target:t.target[o]=[,,,,]});else t.target[o]=Tn(f);return r};tr.add=Lf;tr.addAll=Fn;tr.cover=Uf;tr.data=Zf;tr.extent=Kf;tr.find=af;tr.remove=Xf;tr.removeAll=Bn;tr.root=Wf;tr.size=Gf;tr.visit=ef;tr.visitAfter=Yf;tr.x=Rf;tr.y=zf;function g(r){return function(){return r}}function xr(r){return(r()-0.5)*0.000001}function hc(r){return r.x+r.vx}function lc(r){return r.y+r.vy}function Vn(r){var t,u,f,o=1,n=1;if(typeof r!=="function")r=g(r==null?1:+r);function i(){var h,m=t.length,x,s,p,B,I,S;for(var _=0;_<n;++_){x=qr(t,hc,lc).visitAfter(c);for(h=0;h<m;++h)s=t[h],I=u[s.index],S=I*I,p=s.x+s.vx,B=s.y+s.vy,x.visit(O)}function O(N,M,T,w,J){var{data:L,r:a}=N,Z=I+a;if(L){if(L.index>s.index){var X=p-L.x-L.vx,Q=B-L.y-L.vy,e=X*X+Q*Q;if(e<Z*Z){if(X===0)X=xr(f),e+=X*X;if(Q===0)Q=xr(f),e+=Q*Q;e=(Z-(e=Math.sqrt(e)))/e*o,s.vx+=(X*=e)*(Z=(a*=a)/(S+a)),s.vy+=(Q*=e)*Z,L.vx-=X*(Z=1-Z),L.vy-=Q*Z}}return}return M>p+Z||w<p-Z||T>B+Z||J<B-Z}}function c(h){if(h.data)return h.r=u[h.data.index];for(var m=h.r=0;m<4;++m)if(h[m]&&h[m].r>h.r)h.r=h[m].r}function l(){if(!t)return;var h,m=t.length,x;u=Array(m);for(h=0;h<m;++h)x=t[h],u[x.index]=+r(x,h,t)}return i.initialize=function(h,m){t=h,f=m,l()},i.iterations=function(h){return arguments.length?(n=+h,i):n},i.strength=function(h){return arguments.length?(o=+h,i):o},i.radius=function(h){return arguments.length?(r=typeof h==="function"?h:g(+h),l(),i):r},i}function mc(r){return r.index}function Jn(r,t){var u=r.get(t);if(!u)throw Error("node not found: "+t);return u}function Pn(r){var t=mc,u=x,f,o=g(30),n,i,c,l,h,m=1;if(r==null)r=[];function x(S){return 1/Math.min(c[S.source.index],c[S.target.index])}function s(S){for(var _=0,O=r.length;_<m;++_)for(var N=0,M,T,w,J,L,a,Z;N<O;++N)M=r[N],T=M.source,w=M.target,J=w.x+w.vx-T.x-T.vx||xr(h),L=w.y+w.vy-T.y-T.vy||xr(h),a=Math.sqrt(J*J+L*L),a=(a-n[N])/a*S*f[N],J*=a,L*=a,w.vx-=J*(Z=l[N]),w.vy-=L*Z,T.vx+=J*(Z=1-Z),T.vy+=L*Z}function p(){if(!i)return;var S,_=i.length,O=r.length,N=new Map(i.map((T,w)=>[t(T,w,i),T])),M;for(S=0,c=Array(_);S<O;++S){if(M=r[S],M.index=S,typeof M.source!=="object")M.source=Jn(N,M.source);if(typeof M.target!=="object")M.target=Jn(N,M.target);c[M.source.index]=(c[M.source.index]||0)+1,c[M.target.index]=(c[M.target.index]||0)+1}for(S=0,l=Array(O);S<O;++S)M=r[S],l[S]=c[M.source.index]/(c[M.source.index]+c[M.target.index]);f=Array(O),B(),n=Array(O),I()}function B(){if(!i)return;for(var S=0,_=r.length;S<_;++S)f[S]=+u(r[S],S,r)}function I(){if(!i)return;for(var S=0,_=r.length;S<_;++S)n[S]=+o(r[S],S,r)}return s.initialize=function(S,_){i=S,h=_,p()},s.links=function(S){return arguments.length?(r=S,p(),s):r},s.id=function(S){return arguments.length?(t=S,s):t},s.iterations=function(S){return arguments.length?(m=+S,s):m},s.strength=function(S){return arguments.length?(u=typeof S==="function"?S:g(+S),B(),s):u},s.distance=function(S){return arguments.length?(o=typeof S==="function"?S:g(+S),I(),s):o},s}var nt=0,Pt=0,Jt=0,Qn=1000,ou,Dt,nu=0,Er=0,iu=0,Qt=typeof performance==="object"&&performance.now?performance:Date,$n=typeof window==="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function Ht(){return Er||($n(sc),Er=Qt.now()+iu)}function sc(){Er=0}function $t(){this._call=this._time=this._next=null}$t.prototype=it.prototype={constructor:$t,restart:function(r,t,u){if(typeof r!=="function")throw TypeError("callback is not a function");if(u=(u==null?Ht():+u)+(t==null?0:+t),!this._next&&Dt!==this){if(Dt)Dt._next=this;else ou=this;Dt=this}this._call=r,this._time=u,Ef()},stop:function(){if(this._call)this._call=null,this._time=1/0,Ef()}};function it(r,t,u){var f=new $t;return f.restart(r,t,u),f}function Hn(){Ht(),++nt;var r=ou,t;while(r){if((t=Er-r._time)>=0)r._call.call(void 0,t);r=r._next}--nt}function Dn(){Er=(nu=Qt.now())+iu,nt=Pt=0;try{Hn()}finally{nt=0,xc(),Er=0}}function pc(){var r=Qt.now(),t=r-nu;if(t>Qn)iu-=t,nu=r}function xc(){var r,t=ou,u,f=1/0;while(t)if(t._call){if(f>t._time)f=t._time;r=t,t=t._next}else u=t._next,t._next=null,t=r?r._next=u:ou=u;Dt=r,Ef(f)}function Ef(r){if(nt)return;if(Pt)Pt=clearTimeout(Pt);var t=r-Er;if(t>24){if(r<1/0)Pt=setTimeout(Dn,r-Qt.now()-iu);if(Jt)Jt=clearInterval(Jt)}else{if(!Jt)nu=Qt.now(),Jt=setInterval(pc,Qn);nt=1,$n(Dn)}}function Lt(r,t,u){var f=new $t;return t=t==null?0:+t,f.restart((o)=>{f.stop(),r(o+t)},t,u),f}function gf(){let r=1;return()=>(r=(1664525*r+1013904223)%4294967296)/4294967296}function Ln(r){return r.x}function Un(r){return r.y}var Mc=10,Ac=Math.PI*(3-Math.sqrt(5));function Zn(r){var t,u=1,f=0.001,o=1-Math.pow(f,0.0033333333333333335),n=0,i=0.6,c=new Map,l=it(x),h=Jr("tick","end"),m=gf();if(r==null)r=[];function x(){if(s(),h.call("tick",t),u<f)l.stop(),h.call("end",t)}function s(I){var S,_=r.length,O;if(I===void 0)I=1;for(var N=0;N<I;++N){u+=(n-u)*o,c.forEach(function(M){M(u)});for(S=0;S<_;++S){if(O=r[S],O.fx==null)O.x+=O.vx*=i;else O.x=O.fx,O.vx=0;if(O.fy==null)O.y+=O.vy*=i;else O.y=O.fy,O.vy=0}}return t}function p(){for(var I=0,S=r.length,_;I<S;++I){if(_=r[I],_.index=I,_.fx!=null)_.x=_.fx;if(_.fy!=null)_.y=_.fy;if(isNaN(_.x)||isNaN(_.y)){var O=Mc*Math.sqrt(0.5+I),N=I*Ac;_.x=O*Math.cos(N),_.y=O*Math.sin(N)}if(isNaN(_.vx)||isNaN(_.vy))_.vx=_.vy=0}}function B(I){if(I.initialize)I.initialize(r,m);return I}return p(),t={tick:s,restart:function(){return l.restart(x),t},stop:function(){return l.stop(),t},nodes:function(I){return arguments.length?(r=I,p(),c.forEach(B),t):r},alpha:function(I){return arguments.length?(u=+I,t):u},alphaMin:function(I){return arguments.length?(f=+I,t):f},alphaDecay:function(I){return arguments.length?(o=+I,t):+o},alphaTarget:function(I){return arguments.length?(n=+I,t):n},velocityDecay:function(I){return arguments.length?(i=1-I,t):1-i},randomSource:function(I){return arguments.length?(m=I,c.forEach(B),t):m},force:function(I,S){return arguments.length>1?(S==null?c.delete(I):c.set(I,B(S)),t):c.get(I)},find:function(I,S,_){var O=0,N=r.length,M,T,w,J,L;if(_==null)_=1/0;else _*=_;for(O=0;O<N;++O)if(J=r[O],M=I-J.x,T=S-J.y,w=M*M+T*T,w<_)L=J,_=w;return L},on:function(I,S){return arguments.length>1?(h.on(I,S),t):h.on(I)}}}function Kn(){var r,t,u,f,o=g(-30),n,i=1,c=1/0,l=0.81;function h(p){var B,I=r.length,S=qr(r,Ln,Un).visitAfter(x);for(f=p,B=0;B<I;++B)t=r[B],S.visit(s)}function m(){if(!r)return;var p,B=r.length,I;n=Array(B);for(p=0;p<B;++p)I=r[p],n[I.index]=+o(I,p,r)}function x(p){var B=0,I,S,_=0,O,N,M;if(p.length){for(O=N=M=0;M<4;++M)if((I=p[M])&&(S=Math.abs(I.value)))B+=I.value,_+=S,O+=S*I.x,N+=S*I.y;p.x=O/_,p.y=N/_}else{I=p,I.x=I.data.x,I.y=I.data.y;do B+=n[I.data.index];while(I=I.next)}p.value=B}function s(p,B,I,S){if(!p.value)return!0;var _=p.x-t.x,O=p.y-t.y,N=S-B,M=_*_+O*O;if(N*N/l<M){if(M<c){if(_===0)_=xr(u),M+=_*_;if(O===0)O=xr(u),M+=O*O;if(M<i)M=Math.sqrt(i*M);t.vx+=_*p.value*f/M,t.vy+=O*p.value*f/M}return!0}else if(p.length||M>=c)return;if(p.data!==t||p.next){if(_===0)_=xr(u),M+=_*_;if(O===0)O=xr(u),M+=O*O;if(M<i)M=Math.sqrt(i*M)}do if(p.data!==t)N=n[p.data.index]*f/M,t.vx+=_*N,t.vy+=O*N;while(p=p.next)}return h.initialize=function(p,B){r=p,u=B,m()},h.strength=function(p){return arguments.length?(o=typeof p==="function"?p:g(+p),m(),h):o},h.distanceMin=function(p){return arguments.length?(i=p*p,h):Math.sqrt(i)},h.distanceMax=function(p){return arguments.length?(c=p*p,h):Math.sqrt(c)},h.theta=function(p){return arguments.length?(l=p*p,h):Math.sqrt(l)},h}function an(r){var t=g(0.1),u,f,o;if(typeof r!=="function")r=g(r==null?0:+r);function n(c){for(var l=0,h=u.length,m;l<h;++l)m=u[l],m.vx+=(o[l]-m.x)*f[l]*c}function i(){if(!u)return;var c,l=u.length;f=Array(l),o=Array(l);for(c=0;c<l;++c)f[c]=isNaN(o[c]=+r(u[c],c,u))?0:+t(u[c],c,u)}return n.initialize=function(c){u=c,i()},n.strength=function(c){return arguments.length?(t=typeof c==="function"?c:g(+c),i(),n):t},n.x=function(c){return arguments.length?(r=typeof c==="function"?c:g(+c),i(),n):r},n}function Xn(r){var t=g(0.1),u,f,o;if(typeof r!=="function")r=g(r==null?0:+r);function n(c){for(var l=0,h=u.length,m;l<h;++l)m=u[l],m.vy+=(o[l]-m.y)*f[l]*c}function i(){if(!u)return;var c,l=u.length;f=Array(l),o=Array(l);for(c=0;c<l;++c)f[c]=isNaN(o[c]=+r(u[c],c,u))?0:+t(u[c],c,u)}return n.initialize=function(c){u=c,i()},n.strength=function(c){return arguments.length?(t=typeof c==="function"?c:g(+c),i(),n):t},n.y=function(c){return arguments.length?(r=typeof c==="function"?c:g(+c),i(),n):r},n}function Ut(r,t,u){r.prototype=t.prototype=u,u.constructor=r}function yf(r,t){var u=Object.create(r.prototype);for(var f in t)u[f]=t[f];return u}function at(){}var Zt=0.7,lu=1/Zt,ct="\\s*([+-]?\\d+)\\s*",Kt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Or="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_c=/^#([0-9a-f]{3,8})$/,Ic=new RegExp(`^rgb\\(${ct},${ct},${ct}\\)$`),Sc=new RegExp(`^rgb\\(${Or},${Or},${Or}\\)$`),wc=new RegExp(`^rgba\\(${ct},${ct},${ct},${Kt}\\)$`),Cc=new RegExp(`^rgba\\(${Or},${Or},${Or},${Kt}\\)$`),Fc=new RegExp(`^hsl\\(${Kt},${Or},${Or}\\)$`),Bc=new RegExp(`^hsla\\(${Kt},${Or},${Or},${Kt}\\)$`),Wn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ut(at,Sr,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:Gn,formatHex:Gn,formatHex8:Oc,formatHsl:Nc,formatRgb:en,toString:en});function Gn(){return this.rgb().formatHex()}function Oc(){return this.rgb().formatHex8()}function Nc(){return gn(this).formatHsl()}function en(){return this.rgb().formatRgb()}function Sr(r){var t,u;return r=(r+"").trim().toLowerCase(),(t=_c.exec(r))?(u=t[1].length,t=parseInt(t[1],16),u===6?Yn(t):u===3?new nr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):u===8?cu(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):u===4?cu(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ic.exec(r))?new nr(t[1],t[2],t[3],1):(t=Sc.exec(r))?new nr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=wc.exec(r))?cu(t[1],t[2],t[3],t[4]):(t=Cc.exec(r))?cu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Fc.exec(r))?qn(t[1],t[2]/100,t[3]/100,1):(t=Bc.exec(r))?qn(t[1],t[2]/100,t[3]/100,t[4]):Wn.hasOwnProperty(r)?Yn(Wn[r]):r==="transparent"?new nr(NaN,NaN,NaN,0):null}function Yn(r){return new nr(r>>16&255,r>>8&255,r&255,1)}function cu(r,t,u,f){if(f<=0)r=t=u=NaN;return new nr(r,t,u,f)}function Tc(r){if(!(r instanceof at))r=Sr(r);if(!r)return new nr;return r=r.rgb(),new nr(r.r,r.g,r.b,r.opacity)}function ht(r,t,u,f){return arguments.length===1?Tc(r):new nr(r,t,u,f==null?1:f)}function nr(r,t,u,f){this.r=+r,this.g=+t,this.b=+u,this.opacity=+f}Ut(nr,ht,yf(at,{brighter(r){return r=r==null?lu:Math.pow(lu,r),new nr(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Zt:Math.pow(Zt,r),new nr(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new nr(yr(this.r),yr(this.g),yr(this.b),mu(this.opacity))},displayable(){return-0.5<=this.r&&this.r<255.5&&(-0.5<=this.g&&this.g<255.5)&&(-0.5<=this.b&&this.b<255.5)&&(0<=this.opacity&&this.opacity<=1)},hex:Rn,formatHex:Rn,formatHex8:Vc,formatRgb:zn,toString:zn}));function Rn(){return`#${gr(this.r)}${gr(this.g)}${gr(this.b)}`}function Vc(){return`#${gr(this.r)}${gr(this.g)}${gr(this.b)}${gr((isNaN(this.opacity)?1:this.opacity)*255)}`}function zn(){let r=mu(this.opacity);return`${r===1?"rgb(":"rgba("}${yr(this.r)}, ${yr(this.g)}, ${yr(this.b)}${r===1?")":`, ${r})`}`}function mu(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function yr(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function gr(r){return r=yr(r),(r<16?"0":"")+r.toString(16)}function qn(r,t,u,f){if(f<=0)r=t=u=NaN;else if(u<=0||u>=1)r=t=NaN;else if(t<=0)r=NaN;return new Ir(r,t,u,f)}function gn(r){if(r instanceof Ir)return new Ir(r.h,r.s,r.l,r.opacity);if(!(r instanceof at))r=Sr(r);if(!r)return new Ir;if(r instanceof Ir)return r;r=r.rgb();var t=r.r/255,u=r.g/255,f=r.b/255,o=Math.min(t,u,f),n=Math.max(t,u,f),i=NaN,c=n-o,l=(n+o)/2;if(c){if(t===n)i=(u-f)/c+(u<f)*6;else if(u===n)i=(f-t)/c+2;else i=(t-u)/c+4;c/=l<0.5?n+o:2-n-o,i*=60}else c=l>0&&l<1?0:i;return new Ir(i,c,l,r.opacity)}function yn(r,t,u,f){return arguments.length===1?gn(r):new Ir(r,t,u,f==null?1:f)}function Ir(r,t,u,f){this.h=+r,this.s=+t,this.l=+u,this.opacity=+f}Ut(Ir,yn,yf(at,{brighter(r){return r=r==null?lu:Math.pow(lu,r),new Ir(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Zt:Math.pow(Zt,r),new Ir(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,u=this.l,f=u+(u<0.5?u:1-u)*t,o=2*u-f;return new nr(jf(r>=240?r-240:r+120,o,f),jf(r,o,f),jf(r<120?r+240:r-120,o,f),this.opacity)},clamp(){return new Ir(En(this.h),hu(this.s),hu(this.l),mu(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 r=mu(this.opacity);return`${r===1?"hsl(":"hsla("}${En(this.h)}, ${hu(this.s)*100}%, ${hu(this.l)*100}%${r===1?")":`, ${r})`}`}}));function En(r){return r=(r||0)%360,r<0?r+360:r}function hu(r){return Math.max(0,Math.min(1,r||0))}function jf(r,t,u){return(r<60?t+(u-t)*r/60:r<180?u:r<240?t+(u-t)*(240-r)/60:t)*255}function bf(r,t,u,f,o){var n=r*r,i=n*r;return((1-3*r+3*n-i)*t+(4-6*n+3*i)*u+(1+3*r+3*n-3*i)*f+i*o)/6}function vf(r){var t=r.length-1;return function(u){var f=u<=0?u=0:u>=1?(u=1,t-1):Math.floor(u*t),o=r[f],n=r[f+1],i=f>0?r[f-1]:2*o-n,c=f<t-1?r[f+2]:2*n-o;return bf((u-f/t)*t,i,o,n,c)}}function kf(r){var t=r.length;return function(u){var f=Math.floor(((u%=1)<0?++u:u)*t),o=r[(f+t-1)%t],n=r[f%t],i=r[(f+1)%t],c=r[(f+2)%t];return bf((u-f/t)*t,o,n,i,c)}}var Xt=(r)=>()=>r;function Jc(r,t){return function(u){return r+u*t}}function Pc(r,t,u){return r=Math.pow(r,u),t=Math.pow(t,u)-r,u=1/u,function(f){return Math.pow(r+f*t,u)}}function jn(r){return(r=+r)===1?su:function(t,u){return u-t?Pc(t,u,r):Xt(isNaN(t)?u:t)}}function su(r,t){var u=t-r;return u?Jc(r,u):Xt(isNaN(r)?t:r)}var jr=function r(t){var u=jn(t);function f(o,n){var i=u((o=ht(o)).r,(n=ht(n)).r),c=u(o.g,n.g),l=u(o.b,n.b),h=su(o.opacity,n.opacity);return function(m){return o.r=i(m),o.g=c(m),o.b=l(m),o.opacity=h(m),o+""}}return f.gamma=r,f}(1);function bn(r){return function(t){var u=t.length,f=Array(u),o=Array(u),n=Array(u),i,c;for(i=0;i<u;++i)c=ht(t[i]),f[i]=c.r||0,o[i]=c.g||0,n[i]=c.b||0;return f=r(f),o=r(o),n=r(n),c.opacity=1,function(l){return c.r=f(l),c.g=o(l),c.b=n(l),c+""}}}var Dc=bn(vf),Qc=bn(kf);function df(r,t){if(!t)t=[];var u=r?Math.min(t.length,r.length):0,f=t.slice(),o;return function(n){for(o=0;o<u;++o)f[o]=r[o]*(1-n)+t[o]*n;return f}}function vn(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function kn(r,t){var u=t?t.length:0,f=r?Math.min(u,r.length):0,o=Array(f),n=Array(u),i;for(i=0;i<f;++i)o[i]=Kr(r[i],t[i]);for(;i<u;++i)n[i]=t[i];return function(c){for(i=0;i<f;++i)n[i]=o[i](c);return n}}function ro(r,t){var u=new Date;return r=+r,t=+t,function(f){return u.setTime(r*(1-f)+t*f),u}}function v(r,t){return r=+r,t=+t,function(u){return r*(1-u)+t*u}}function to(r,t){var u={},f={},o;if(r===null||typeof r!=="object")r={};if(t===null||typeof t!=="object")t={};for(o in t)if(o in r)u[o]=Kr(r[o],t[o]);else f[o]=t[o];return function(n){for(o in u)f[o]=u[o](n);return f}}var fo=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,uo=new RegExp(fo.source,"g");function $c(r){return function(){return r}}function Hc(r){return function(t){return r(t)+""}}function lt(r,t){var u=fo.lastIndex=uo.lastIndex=0,f,o,n,i=-1,c=[],l=[];r=r+"",t=t+"";while((f=fo.exec(r))&&(o=uo.exec(t))){if((n=o.index)>u)if(n=t.slice(u,n),c[i])c[i]+=n;else c[++i]=n;if((f=f[0])===(o=o[0]))if(c[i])c[i]+=o;else c[++i]=o;else c[++i]=null,l.push({i,x:v(f,o)});u=uo.lastIndex}if(u<t.length)if(n=t.slice(u),c[i])c[i]+=n;else c[++i]=n;return c.length<2?l[0]?Hc(l[0].x):$c(t):(t=l.length,function(h){for(var m=0,x;m<t;++m)c[(x=l[m]).i]=x.x(h);return c.join("")})}function Kr(r,t){var u=typeof t,f;return t==null||u==="boolean"?Xt(t):(u==="number"?v:u==="string"?(f=Sr(t))?(t=f,jr):lt:t instanceof Sr?jr:t instanceof Date?ro:vn(t)?df:Array.isArray(t)?kn:typeof t.valueOf!=="function"&&typeof t.toString!=="function"||isNaN(t)?to:v)(r,t)}function pu(r,t){return r=+r,t=+t,function(u){return Math.round(r*(1-u)+t*u)}}var dn=180/Math.PI,xu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Mu(r,t,u,f,o,n){var i,c,l;if(i=Math.sqrt(r*r+t*t))r/=i,t/=i;if(l=r*u+t*f)u-=r*l,f-=t*l;if(c=Math.sqrt(u*u+f*f))u/=c,f/=c,l/=c;if(r*f<t*u)r=-r,t=-t,l=-l,i=-i;return{translateX:o,translateY:n,rotate:Math.atan2(t,r)*dn,skewX:Math.atan(l)*dn,scaleX:i,scaleY:c}}var Au;function ri(r){let t=new(typeof DOMMatrix==="function"?DOMMatrix:WebKitCSSMatrix)(r+"");return t.isIdentity?xu:Mu(t.a,t.b,t.c,t.d,t.e,t.f)}function ti(r){if(r==null)return xu;if(!Au)Au=document.createElementNS("http://www.w3.org/2000/svg","g");if(Au.setAttribute("transform",r),!(r=Au.transform.baseVal.consolidate()))return xu;return r=r.matrix,Mu(r.a,r.b,r.c,r.d,r.e,r.f)}function ui(r,t,u,f){function o(h){return h.length?h.pop()+" ":""}function n(h,m,x,s,p,B){if(h!==x||m!==s){var I=p.push("translate(",null,t,null,u);B.push({i:I-4,x:v(h,x)},{i:I-2,x:v(m,s)})}else if(x||s)p.push("translate("+x+t+s+u)}function i(h,m,x,s){if(h!==m){if(h-m>180)m+=360;else if(m-h>180)h+=360;s.push({i:x.push(o(x)+"rotate(",null,f)-2,x:v(h,m)})}else if(m)x.push(o(x)+"rotate("+m+f)}function c(h,m,x,s){if(h!==m)s.push({i:x.push(o(x)+"skewX(",null,f)-2,x:v(h,m)});else if(m)x.push(o(x)+"skewX("+m+f)}function l(h,m,x,s,p,B){if(h!==x||m!==s){var I=p.push(o(p)+"scale(",null,",",null,")");B.push({i:I-4,x:v(h,x)},{i:I-2,x:v(m,s)})}else if(x!==1||s!==1)p.push(o(p)+"scale("+x+","+s+")")}return function(h,m){var x=[],s=[];return h=r(h),m=r(m),n(h.translateX,h.translateY,m.translateX,m.translateY,x,s),i(h.rotate,m.rotate,x,s),c(h.skewX,m.skewX,x,s),l(h.scaleX,h.scaleY,m.scaleX,m.scaleY,x,s),h=m=null,function(p){var B=-1,I=s.length,S;while(++B<I)x[(S=s[B]).i]=S.x(p);return x.join("")}}}var oo=ui(ri,"px, ","px)","deg)"),no=ui(ti,", ",")",")");var Lc=0.000000000001;function fi(r){return((r=Math.exp(r))+1/r)/2}function Uc(r){return((r=Math.exp(r))-1/r)/2}function Zc(r){return((r=Math.exp(2*r))-1)/(r+1)}var io=function r(t,u,f){function o(n,i){var c=n[0],l=n[1],h=n[2],m=i[0],x=i[1],s=i[2],p=m-c,B=x-l,I=p*p+B*B,S,_;if(I<Lc)_=Math.log(s/h)/t,S=function(J){return[c+J*p,l+J*B,h*Math.exp(t*J*_)]};else{var O=Math.sqrt(I),N=(s*s-h*h+f*I)/(2*h*u*O),M=(s*s-h*h-f*I)/(2*s*u*O),T=Math.log(Math.sqrt(N*N+1)-N),w=Math.log(Math.sqrt(M*M+1)-M);_=(w-T)/t,S=function(J){var L=J*_,a=fi(T),Z=h/(u*O)*(a*Zc(t*L+T)-Uc(T));return[c+Z*p,l+Z*B,h*a/fi(t*L+T)]}}return S.duration=_*1000*t/Math.SQRT2,S}return o.rho=function(n){var i=Math.max(0.001,+n),c=i*i,l=c*c;return r(i,c,l)},o}(Math.SQRT2,2,4);function co(r){return function(){return r}}function ho(r){return+r}var oi=[0,1];function mt(r){return r}function lo(r,t){return(t-=r=+r)?function(u){return(u-r)/t}:co(isNaN(t)?NaN:0.5)}function Kc(r,t){var u;if(r>t)u=r,r=t,t=u;return function(f){return Math.max(r,Math.min(t,f))}}function ac(r,t,u){var f=r[0],o=r[1],n=t[0],i=t[1];if(o<f)f=lo(o,f),n=u(i,n);else f=lo(f,o),n=u(n,i);return function(c){return n(f(c))}}function Xc(r,t,u){var f=Math.min(r.length,t.length)-1,o=Array(f),n=Array(f),i=-1;if(r[f]<r[0])r=r.slice().reverse(),t=t.slice().reverse();while(++i<f)o[i]=lo(r[i],r[i+1]),n[i]=u(t[i],t[i+1]);return function(c){var l=eu(r,c,1,f)-1;return n[l](o[l](c))}}function _u(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function Wc(){var r=oi,t=oi,u=Kr,f,o,n,i=mt,c,l,h;function m(){var s=Math.min(r.length,t.length);if(i!==mt)i=Kc(r[0],r[s-1]);return c=s>2?Xc:ac,l=h=null,x}function x(s){return s==null||isNaN(s=+s)?n:(l||(l=c(r.map(f),t,u)))(f(i(s)))}return x.invert=function(s){return i(o((h||(h=c(t,r.map(f),v)))(s)))},x.domain=function(s){return arguments.length?(r=Array.from(s,ho),m()):r.slice()},x.range=function(s){return arguments.length?(t=Array.from(s),m()):t.slice()},x.rangeRound=function(s){return t=Array.from(s),u=pu,m()},x.clamp=function(s){return arguments.length?(i=s?!0:mt,m()):i!==mt},x.interpolate=function(s){return arguments.length?(u=s,m()):u},x.unknown=function(s){return arguments.length?(n=s,x):n},function(s,p){return f=s,o=p,m()}}function Wt(){return Wc()(mt,mt)}function Iu(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function mo(r){return Math.abs(r=Math.round(r))>=1000000000000000000000?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function br(r,t){if(!isFinite(r)||r===0)return null;var u=(r=t?r.toExponential(t-1):r.toExponential()).indexOf("e"),f=r.slice(0,u);return[f.length>1?f[0]+f.slice(2):f,+r.slice(u+1)]}function wr(r){return r=br(Math.abs(r)),r?r[1]:NaN}function so(r,t){return function(u,f){var o=u.length,n=[],i=0,c=r[0],l=0;while(o>0&&c>0){if(l+c+1>f)c=Math.max(1,f-l);if(n.push(u.substring(o-=c,o+c)),(l+=c+1)>f)break;c=r[i=(i+1)%r.length]}return n.reverse().join(t)}}function po(r){return function(t){return t.replace(/[0-9]/g,function(u){return r[+u]})}}var Gc=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ar(r){if(!(t=Gc.exec(r)))throw Error("invalid format: "+r);var t;return new Su({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}ar.prototype=Su.prototype;function Su(r){this.fill=r.fill===void 0?" ":r.fill+"",this.align=r.align===void 0?">":r.align+"",this.sign=r.sign===void 0?"-":r.sign+"",this.symbol=r.symbol===void 0?"":r.symbol+"",this.zero=!!r.zero,this.width=r.width===void 0?void 0:+r.width,this.comma=!!r.comma,this.precision=r.precision===void 0?void 0:+r.precision,this.trim=!!r.trim,this.type=r.type===void 0?"":r.type+""}Su.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function xo(r){r:for(var t=r.length,u=1,f=-1,o;u<t;++u)switch(r[u]){case".":f=o=u;break;case"0":if(f===0)f=u;o=u;break;default:if(!+r[u])break r;if(f>0)f=0;break}return f>0?r.slice(0,f)+r.slice(o+1):r}var Gt;function Mo(r,t){var u=br(r,t);if(!u)return Gt=void 0,r.toPrecision(t);var f=u[0],o=u[1],n=o-(Gt=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,i=f.length;return n===i?f:n>i?f+Array(n-i+1).join("0"):n>0?f.slice(0,n)+"."+f.slice(n):"0."+Array(1-n).join("0")+br(r,Math.max(0,t+n-1))[0]}function wu(r,t){var u=br(r,t);if(!u)return r+"";var f=u[0],o=u[1];return o<0?"0."+Array(-o).join("0")+f:f.length>o+1?f.slice(0,o+1)+"."+f.slice(o+1):f+Array(o-f.length+2).join("0")}var Ao={"%":(r,t)=>(r*100).toFixed(t),b:(r)=>Math.round(r).toString(2),c:(r)=>r+"",d:mo,e:(r,t)=>r.toExponential(t),f:(r,t)=>r.toFixed(t),g:(r,t)=>r.toPrecision(t),o:(r)=>Math.round(r).toString(8),p:(r,t)=>wu(r*100,t),r:wu,s:Mo,X:(r)=>Math.round(r).toString(16).toUpperCase(),x:(r)=>Math.round(r).toString(16)};function Cu(r){return r}var ni=Array.prototype.map,ii=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function _o(r){var t=r.grouping===void 0||r.thousands===void 0?Cu:so(ni.call(r.grouping,Number),r.thousands+""),u=r.currency===void 0?"":r.currency[0]+"",f=r.currency===void 0?"":r.currency[1]+"",o=r.decimal===void 0?".":r.decimal+"",n=r.numerals===void 0?Cu:po(ni.call(r.numerals,String)),i=r.percent===void 0?"%":r.percent+"",c=r.minus===void 0?"−":r.minus+"",l=r.nan===void 0?"NaN":r.nan+"";function h(x,s){x=ar(x);var{fill:p,align:B,sign:I,symbol:S,zero:_,width:O,comma:N,precision:M,trim:T,type:w}=x;if(w==="n")N=!0,w="g";else if(!Ao[w])M===void 0&&(M=12),T=!0,w="g";if(_||p==="0"&&B==="=")_=!0,p="0",B="=";var J=(s&&s.prefix!==void 0?s.prefix:"")+(S==="$"?u:S==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():""),L=(S==="$"?f:/[%p]/.test(w)?i:"")+(s&&s.suffix!==void 0?s.suffix:""),a=Ao[w],Z=/[defgprs%]/.test(w);M=M===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,M)):Math.max(0,Math.min(20,M));function X(Q){var e=J,A=L,V,C,D;if(w==="c")A=a(Q)+A,Q="";else{Q=+Q;var H=Q<0||1/Q<0;if(Q=isNaN(Q)?l:a(Math.abs(Q),M),T)Q=xo(Q);if(H&&+Q===0&&I!=="+")H=!1;if(e=(H?I==="("?I:c:I==="-"||I==="("?"":I)+e,A=(w==="s"&&!isNaN(Q)&&Gt!==void 0?ii[8+Gt/3]:"")+A+(H&&I==="("?")":""),Z){V=-1,C=Q.length;while(++V<C)if(D=Q.charCodeAt(V),48>D||D>57){A=(D===46?o+Q.slice(V+1):Q.slice(V))+A,Q=Q.slice(0,V);break}}}if(N&&!_)Q=t(Q,1/0);var U=e.length+Q.length+A.length,$=U<O?Array(O-U+1).join(p):"";if(N&&_)Q=t($+Q,$.length?O-A.length:1/0),$="";switch(B){case"<":Q=e+Q+A+$;break;case"=":Q=e+$+Q+A;break;case"^":Q=$.slice(0,U=$.length>>1)+e+Q+A+$.slice(U);break;default:Q=$+e+Q+A;break}return n(Q)}return X.toString=function(){return x+""},X}function m(x,s){var p=Math.max(-8,Math.min(8,Math.floor(wr(s)/3)))*3,B=Math.pow(10,-p),I=h((x=ar(x),x.type="f",x),{suffix:ii[8+p/3]});return function(S){return I(B*S)}}return{format:h,formatPrefix:m}}var Fu,Bu,Ou;Io({thousands:",",grouping:[3],currency:["$",""]});function Io(r){return Fu=_o(r),Bu=Fu.format,Ou=Fu.formatPrefix,Fu}function Nu(r){return Math.max(0,-wr(Math.abs(r)))}function Tu(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(wr(t)/3)))*3-wr(Math.abs(r)))}function Vu(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,wr(t)-wr(r))+1}function So(r,t,u,f){var o=tt(r,t,u),n;switch(f=ar(f==null?",f":f),f.type){case"s":{var i=Math.max(Math.abs(r),Math.abs(t));if(f.precision==null&&!isNaN(n=Tu(o,i)))f.precision=n;return Ou(f,i)}case"":case"e":case"g":case"p":case"r":{if(f.precision==null&&!isNaN(n=Vu(o,Math.max(Math.abs(r),Math.abs(t)))))f.precision=n-(f.type==="e");break}case"f":case"%":{if(f.precision==null&&!isNaN(n=Nu(o)))f.precision=n-(f.type==="%")*2;break}}return Bu(f)}function ec(r){var t=r.domain;return r.ticks=function(u){var f=t();return dt(f[0],f[f.length-1],u==null?10:u)},r.tickFormat=function(u,f){var o=t();return So(o[0],o[o.length-1],u==null?10:u,f)},r.nice=function(u){if(u==null)u=10;var f=t(),o=0,n=f.length-1,i=f[o],c=f[n],l,h,m=10;if(c<i)h=i,i=c,c=h,h=o,o=n,n=h;while(m-- >0){if(h=St(i,c,u),h===l)return f[o]=i,f[n]=c,t(f);else if(h>0)i=Math.floor(i/h)*h,c=Math.ceil(c/h)*h;else if(h<0)i=Math.ceil(i*h)/h,c=Math.floor(c*h)/h;else break;l=h}return r},r}function wo(){var r=Wt();return r.copy=function(){return _u(r,wo())},Iu.apply(r,arguments),ec(r)}var Co=new Date,Fo=new Date;function R(r,t,u,f){function o(n){return r(n=arguments.length===0?new Date:new Date(+n)),n}if(o.floor=(n)=>{return r(n=new Date(+n)),n},o.ceil=(n)=>{return r(n=new Date(n-1)),t(n,1),r(n),n},o.round=(n)=>{let i=o(n),c=o.ceil(n);return n-i<c-n?i:c},o.offset=(n,i)=>{return t(n=new Date(+n),i==null?1:Math.floor(i)),n},o.range=(n,i,c)=>{let l=[];if(n=o.ceil(n),c=c==null?1:Math.floor(c),!(n<i)||!(c>0))return l;let h;do l.push(h=new Date(+n)),t(n,c),r(n);while(h<n&&n<i);return l},o.filter=(n)=>{return R((i)=>{if(i>=i)while(r(i),!n(i))i.setTime(i-1)},(i,c)=>{if(i>=i)if(c<0)while(++c<=0)while(t(i,-1),!n(i));else while(--c>=0)while(t(i,1),!n(i));})},u)o.count=(n,i)=>{return Co.setTime(+n),Fo.setTime(+i),r(Co),r(Fo),Math.floor(u(Co,Fo))},o.every=(n)=>{return n=Math.floor(n),!isFinite(n)||!(n>0)?null:!(n>1)?o:o.filter(f?(i)=>f(i)%n===0:(i)=>o.count(0,i)%n===0)};return o}var et=R(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>{return t-r});et.every=(r)=>{if(r=Math.floor(r),!isFinite(r)||!(r>0))return null;if(!(r>1))return et;return R((t)=>{t.setTime(Math.floor(t/r)*r)},(t,u)=>{t.setTime(+t+u*r)},(t,u)=>{return(u-t)/r})};var C_=et.range;var Mr=1000,rr=60000,Nr=3600000,Xr=86400000,Yt=604800000,Bo=2592000000,Ju=31536000000;var Tr=R((r)=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*Mr)},(r,t)=>{return(t-r)/Mr},(r)=>{return r.getUTCSeconds()}),ci=Tr.range;var st=R((r)=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*Mr)},(r,t)=>{r.setTime(+r+t*rr)},(r,t)=>{return(t-r)/rr},(r)=>{return r.getMinutes()}),Yc=st.range,Pu=R((r)=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*rr)},(r,t)=>{return(t-r)/rr},(r)=>{return r.getUTCMinutes()}),Rc=Pu.range;var pt=R((r)=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*Mr-r.getMinutes()*rr)},(r,t)=>{r.setTime(+r+t*Nr)},(r,t)=>{return(t-r)/Nr},(r)=>{return r.getHours()}),zc=pt.range,Du=R((r)=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*Nr)},(r,t)=>{return(t-r)/Nr},(r)=>{return r.getUTCHours()}),qc=Du.range;var Dr=R((r)=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*rr)/Xr,(r)=>r.getDate()-1),Ec=Dr.range,Rt=R((r)=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>{return(t-r)/Xr},(r)=>{return r.getUTCDate()-1}),gc=Rt.range,Qu=R((r)=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>{return(t-r)/Xr},(r)=>{return Math.floor(r/Xr)}),yc=Qu.range;function vr(r){return R((t)=>{t.setDate(t.getDate()-(t.getDay()+7-r)%7),t.setHours(0,0,0,0)},(t,u)=>{t.setDate(t.getDate()+u*7)},(t,u)=>{return(u-t-(u.getTimezoneOffset()-t.getTimezoneOffset())*rr)/Yt})}var Qr=vr(0),xt=vr(1),hi=vr(2),li=vr(3),Wr=vr(4),mi=vr(5),si=vr(6),pi=Qr.range,jc=xt.range,bc=hi.range,vc=li.range,kc=Wr.range,dc=mi.range,rh=si.range;function kr(r){return R((t)=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-r)%7),t.setUTCHours(0,0,0,0)},(t,u)=>{t.setUTCDate(t.getUTCDate()+u*7)},(t,u)=>{return(u-t)/Yt})}var dr=kr(0),Mt=kr(1),xi=kr(2),Mi=kr(3),Gr=kr(4),Ai=kr(5),_i=kr(6),Ii=dr.range,th=Mt.range,uh=xi.range,fh=Mi.range,oh=Gr.range,nh=Ai.range,ih=_i.range;var At=R((r)=>{r.setDate(1),r.setHours(0,0,0,0)},(r,t)=>{r.setMonth(r.getMonth()+t)},(r,t)=>{return t.getMonth()-r.getMonth()+(t.getFullYear()-r.getFullYear())*12},(r)=>{return r.getMonth()}),ch=At.range,$u=R((r)=>{r.setUTCDate(1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCMonth(r.getUTCMonth()+t)},(r,t)=>{return t.getUTCMonth()-r.getUTCMonth()+(t.getUTCFullYear()-r.getUTCFullYear())*12},(r)=>{return r.getUTCMonth()}),hh=$u.range;var sr=R((r)=>{r.setMonth(0,1),r.setHours(0,0,0,0)},(r,t)=>{r.setFullYear(r.getFullYear()+t)},(r,t)=>{return t.getFullYear()-r.getFullYear()},(r)=>{return r.getFullYear()});sr.every=(r)=>{return!isFinite(r=Math.floor(r))||!(r>0)?null:R((t)=>{t.setFullYear(Math.floor(t.getFullYear()/r)*r),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,u)=>{t.setFullYear(t.getFullYear()+u*r)})};var lh=sr.range,Cr=R((r)=>{r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCFullYear(r.getUTCFullYear()+t)},(r,t)=>{return t.getUTCFullYear()-r.getUTCFullYear()},(r)=>{return r.getUTCFullYear()});Cr.every=(r)=>{return!isFinite(r=Math.floor(r))||!(r>0)?null:R((t)=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/r)*r),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,u)=>{t.setUTCFullYear(t.getUTCFullYear()+u*r)})};var mh=Cr.range;function Si(r,t,u,f,o,n){let i=[[Tr,1,Mr],[Tr,5,5*Mr],[Tr,15,15*Mr],[Tr,30,30*Mr],[n,1,rr],[n,5,5*rr],[n,15,15*rr],[n,30,30*rr],[o,1,Nr],[o,3,3*Nr],[o,6,6*Nr],[o,12,12*Nr],[f,1,Xr],[f,2,2*Xr],[u,1,Yt],[t,1,Bo],[t,3,3*Bo],[r,1,Ju]];function c(h,m,x){let s=m<h;if(s)[h,m]=[m,h];let p=x&&typeof x.range==="function"?x:l(h,m,x),B=p?p.range(h,+m+1):[];return s?B.reverse():B}function l(h,m,x){let s=Math.abs(m-h)/x,p=Rr(([,,S])=>S).right(i,s);if(p===i.length)return r.every(tt(h/Ju,m/Ju,x));if(p===0)return et.every(Math.max(tt(h,m,x),1));let[B,I]=i[s/i[p-1][2]<i[p][2]/s?p-1:p];return B.every(I)}return[c,l]}var[sh,ph]=Si(Cr,$u,dr,Qu,Du,Pu),[Oo,No]=Si(sr,At,Qr,Dr,pt,st);function To(r){if(0<=r.y&&r.y<100){var t=new Date(-1,r.m,r.d,r.H,r.M,r.S,r.L);return t.setFullYear(r.y),t}return new Date(r.y,r.m,r.d,r.H,r.M,r.S,r.L)}function Vo(r){if(0<=r.y&&r.y<100){var t=new Date(Date.UTC(-1,r.m,r.d,r.H,r.M,r.S,r.L));return t.setUTCFullYear(r.y),t}return new Date(Date.UTC(r.y,r.m,r.d,r.H,r.M,r.S,r.L))}function zt(r,t,u){return{y:r,m:t,d:u,H:0,M:0,S:0,L:0}}function Jo(r){var{dateTime:t,date:u,time:f,periods:o,days:n,shortDays:i,months:c,shortMonths:l}=r,h=qt(o),m=Et(o),x=qt(n),s=Et(n),p=qt(i),B=Et(i),I=qt(c),S=Et(c),_=qt(l),O=Et(l),N={a:D,A:H,b:U,B:$,c:null,d:Ni,e:Ni,f:Zh,g:qh,G:gh,H:Hh,I:Lh,j:Uh,L:Di,m:Kh,M:ah,p:Y,q,Q:Ji,s:Pi,S:Xh,u:Wh,U:Gh,V:eh,w:Yh,W:Rh,x:null,X:null,y:zh,Y:Eh,Z:yh,"%":Vi},M={a:pr,A:y,b:ir,B:Ar,c:null,d:Ti,e:Ti,f:kh,g:hl,G:ml,H:jh,I:bh,j:vh,L:$i,m:dh,M:rl,p:cr,q:_r,Q:Ji,s:Pi,S:tl,u:ul,U:fl,V:ol,w:nl,W:il,x:null,X:null,y:cl,Y:ll,Z:sl,"%":Vi},T={a:Z,A:X,b:Q,B:e,c:A,d:Bi,e:Bi,f:Ph,g:Fi,G:Ci,H:Oi,I:Oi,j:Nh,L:Jh,m:Oh,M:Th,p:a,q:Bh,Q:Qh,s:$h,S:Vh,u:Ih,U:Sh,V:wh,w:_h,W:Ch,x:V,X:C,y:Fi,Y:Ci,Z:Fh,"%":Dh};N.x=w(u,N),N.X=w(f,N),N.c=w(t,N),M.x=w(u,M),M.X=w(f,M),M.c=w(t,M);function w(P,K){return function(W){var F=[],fr=-1,z=0,hr=P.length,lr,er,un;if(!(W instanceof Date))W=new Date(+W);while(++fr<hr)if(P.charCodeAt(fr)===37){if(F.push(P.slice(z,fr)),(er=wi[lr=P.charAt(++fr)])!=null)lr=P.charAt(++fr);else er=lr==="e"?" ":"0";if(un=K[lr])lr=un(W,er);F.push(lr),z=fr+1}return F.push(P.slice(z,fr)),F.join("")}}function J(P,K){return function(W){var F=zt(1900,void 0,1),fr=L(F,P,W+="",0),z,hr;if(fr!=W.length)return null;if("Q"in F)return new Date(F.Q);if("s"in F)return new Date(F.s*1000+("L"in F?F.L:0));if(K&&!("Z"in F))F.Z=0;if("p"in F)F.H=F.H%12+F.p*12;if(F.m===void 0)F.m="q"in F?F.q:0;if("V"in F){if(F.V<1||F.V>53)return null;if(!("w"in F))F.w=1;if("Z"in F)z=Vo(zt(F.y,0,1)),hr=z.getUTCDay(),z=hr>4||hr===0?Mt.ceil(z):Mt(z),z=Rt.offset(z,(F.V-1)*7),F.y=z.getUTCFullYear(),F.m=z.getUTCMonth(),F.d=z.getUTCDate()+(F.w+6)%7;else z=To(zt(F.y,0,1)),hr=z.getDay(),z=hr>4||hr===0?xt.ceil(z):xt(z),z=Dr.offset(z,(F.V-1)*7),F.y=z.getFullYear(),F.m=z.getMonth(),F.d=z.getDate()+(F.w+6)%7}else if("W"in F||"U"in F){if(!("w"in F))F.w="u"in F?F.u%7:("W"in F)?1:0;hr="Z"in F?Vo(zt(F.y,0,1)).getUTCDay():To(zt(F.y,0,1)).getDay(),F.m=0,F.d="W"in F?(F.w+6)%7+F.W*7-(hr+5)%7:F.w+F.U*7-(hr+6)%7}if("Z"in F)return F.H+=F.Z/100|0,F.M+=F.Z%100,Vo(F);return To(F)}}function L(P,K,W,F){var fr=0,z=K.length,hr=W.length,lr,er;while(fr<z){if(F>=hr)return-1;if(lr=K.charCodeAt(fr++),lr===37){if(lr=K.charAt(fr++),er=T[lr in wi?K.charAt(fr++):lr],!er||(F=er(P,W,F))<0)return-1}else if(lr!=W.charCodeAt(F++))return-1}return F}function a(P,K,W){var F=h.exec(K.slice(W));return F?(P.p=m.get(F[0].toLowerCase()),W+F[0].length):-1}function Z(P,K,W){var F=p.exec(K.slice(W));return F?(P.w=B.get(F[0].toLowerCase()),W+F[0].length):-1}function X(P,K,W){var F=x.exec(K.slice(W));return F?(P.w=s.get(F[0].toLowerCase()),W+F[0].length):-1}function Q(P,K,W){var F=_.exec(K.slice(W));return F?(P.m=O.get(F[0].toLowerCase()),W+F[0].length):-1}function e(P,K,W){var F=I.exec(K.slice(W));return F?(P.m=S.get(F[0].toLowerCase()),W+F[0].length):-1}function A(P,K,W){return L(P,t,K,W)}function V(P,K,W){return L(P,u,K,W)}function C(P,K,W){return L(P,f,K,W)}function D(P){return i[P.getDay()]}function H(P){return n[P.getDay()]}function U(P){return l[P.getMonth()]}function $(P){return c[P.getMonth()]}function Y(P){return o[+(P.getHours()>=12)]}function q(P){return 1+~~(P.getMonth()/3)}function pr(P){return i[P.getUTCDay()]}function y(P){return n[P.getUTCDay()]}function ir(P){return l[P.getUTCMonth()]}function Ar(P){return c[P.getUTCMonth()]}function cr(P){return o[+(P.getUTCHours()>=12)]}function _r(P){return 1+~~(P.getUTCMonth()/3)}return{format:function(P){var K=w(P+="",N);return K.toString=function(){return P},K},parse:function(P){var K=J(P+="",!1);return K.toString=function(){return P},K},utcFormat:function(P){var K=w(P+="",M);return K.toString=function(){return P},K},utcParse:function(P){var K=J(P+="",!0);return K.toString=function(){return P},K}}}var wi={"-":"",_:" ","0":"0"},k=/^\s*\d+/,xh=/^%/,Mh=/[\\^$*+?|[\]().{}]/g;function G(r,t,u){var f=r<0?"-":"",o=(f?-r:r)+"",n=o.length;return f+(n<u?Array(u-n+1).join(t)+o:o)}function Ah(r){return r.replace(Mh,"\\$&")}function qt(r){return new RegExp("^(?:"+r.map(Ah).join("|")+")","i")}function Et(r){return new Map(r.map((t,u)=>[t.toLowerCase(),u]))}function _h(r,t,u){var f=k.exec(t.slice(u,u+1));return f?(r.w=+f[0],u+f[0].length):-1}function Ih(r,t,u){var f=k.exec(t.slice(u,u+1));return f?(r.u=+f[0],u+f[0].length):-1}function Sh(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.U=+f[0],u+f[0].length):-1}function wh(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.V=+f[0],u+f[0].length):-1}function Ch(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.W=+f[0],u+f[0].length):-1}function Ci(r,t,u){var f=k.exec(t.slice(u,u+4));return f?(r.y=+f[0],u+f[0].length):-1}function Fi(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.y=+f[0]+(+f[0]>68?1900:2000),u+f[0].length):-1}function Fh(r,t,u){var f=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(u,u+6));return f?(r.Z=f[1]?0:-(f[2]+(f[3]||"00")),u+f[0].length):-1}function Bh(r,t,u){var f=k.exec(t.slice(u,u+1));return f?(r.q=f[0]*3-3,u+f[0].length):-1}function Oh(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.m=f[0]-1,u+f[0].length):-1}function Bi(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.d=+f[0],u+f[0].length):-1}function Nh(r,t,u){var f=k.exec(t.slice(u,u+3));return f?(r.m=0,r.d=+f[0],u+f[0].length):-1}function Oi(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.H=+f[0],u+f[0].length):-1}function Th(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.M=+f[0],u+f[0].length):-1}function Vh(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.S=+f[0],u+f[0].length):-1}function Jh(r,t,u){var f=k.exec(t.slice(u,u+3));return f?(r.L=+f[0],u+f[0].length):-1}function Ph(r,t,u){var f=k.exec(t.slice(u,u+6));return f?(r.L=Math.floor(f[0]/1000),u+f[0].length):-1}function Dh(r,t,u){var f=xh.exec(t.slice(u,u+1));return f?u+f[0].length:-1}function Qh(r,t,u){var f=k.exec(t.slice(u));return f?(r.Q=+f[0],u+f[0].length):-1}function $h(r,t,u){var f=k.exec(t.slice(u));return f?(r.s=+f[0],u+f[0].length):-1}function Ni(r,t){return G(r.getDate(),t,2)}function Hh(r,t){return G(r.getHours(),t,2)}function Lh(r,t){return G(r.getHours()%12||12,t,2)}function Uh(r,t){return G(1+Dr.count(sr(r),r),t,3)}function Di(r,t){return G(r.getMilliseconds(),t,3)}function Zh(r,t){return Di(r,t)+"000"}function Kh(r,t){return G(r.getMonth()+1,t,2)}function ah(r,t){return G(r.getMinutes(),t,2)}function Xh(r,t){return G(r.getSeconds(),t,2)}function Wh(r){var t=r.getDay();return t===0?7:t}function Gh(r,t){return G(Qr.count(sr(r)-1,r),t,2)}function Qi(r){var t=r.getDay();return t>=4||t===0?Wr(r):Wr.ceil(r)}function eh(r,t){return r=Qi(r),G(Wr.count(sr(r),r)+(sr(r).getDay()===4),t,2)}function Yh(r){return r.getDay()}function Rh(r,t){return G(xt.count(sr(r)-1,r),t,2)}function zh(r,t){return G(r.getFullYear()%100,t,2)}function qh(r,t){return r=Qi(r),G(r.getFullYear()%100,t,2)}function Eh(r,t){return G(r.getFullYear()%1e4,t,4)}function gh(r,t){var u=r.getDay();return r=u>=4||u===0?Wr(r):Wr.ceil(r),G(r.getFullYear()%1e4,t,4)}function yh(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+G(t/60|0,"0",2)+G(t%60,"0",2)}function Ti(r,t){return G(r.getUTCDate(),t,2)}function jh(r,t){return G(r.getUTCHours(),t,2)}function bh(r,t){return G(r.getUTCHours()%12||12,t,2)}function vh(r,t){return G(1+Rt.count(Cr(r),r),t,3)}function $i(r,t){return G(r.getUTCMilliseconds(),t,3)}function kh(r,t){return $i(r,t)+"000"}function dh(r,t){return G(r.getUTCMonth()+1,t,2)}function rl(r,t){return G(r.getUTCMinutes(),t,2)}function tl(r,t){return G(r.getUTCSeconds(),t,2)}function ul(r){var t=r.getUTCDay();return t===0?7:t}function fl(r,t){return G(dr.count(Cr(r)-1,r),t,2)}function Hi(r){var t=r.getUTCDay();return t>=4||t===0?Gr(r):Gr.ceil(r)}function ol(r,t){return r=Hi(r),G(Gr.count(Cr(r),r)+(Cr(r).getUTCDay()===4),t,2)}function nl(r){return r.getUTCDay()}function il(r,t){return G(Mt.count(Cr(r)-1,r),t,2)}function cl(r,t){return G(r.getUTCFullYear()%100,t,2)}function hl(r,t){return r=Hi(r),G(r.getUTCFullYear()%100,t,2)}function ll(r,t){return G(r.getUTCFullYear()%1e4,t,4)}function ml(r,t){var u=r.getUTCDay();return r=u>=4||u===0?Gr(r):Gr.ceil(r),G(r.getUTCFullYear()%1e4,t,4)}function sl(){return"+0000"}function Vi(){return"%"}function Ji(r){return+r}function Pi(r){return Math.floor(+r/1000)}var _t,Hu,Li,Ui,Zi;Po({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Po(r){return _t=Jo(r),Hu=_t.format,Li=_t.parse,Ui=_t.utcFormat,Zi=_t.utcParse,_t}function Do(r,t){r=r.slice();var u=0,f=r.length-1,o=r[u],n=r[f],i;if(n<o)i=u,u=f,f=i,i=o,o=n,n=i;return r[u]=t.floor(o),r[f]=t.ceil(n),r}function pl(r){return new Date(r)}function xl(r){return r instanceof Date?+r:+new Date(+r)}function Ki(r,t,u,f,o,n,i,c,l,h){var m=Wt(),x=m.invert,s=m.domain,p=h(".%L"),B=h(":%S"),I=h("%I:%M"),S=h("%I %p"),_=h("%a %d"),O=h("%b %d"),N=h("%B"),M=h("%Y");function T(w){return(l(w)<w?p:c(w)<w?B:i(w)<w?I:n(w)<w?S:f(w)<w?o(w)<w?_:O:u(w)<w?N:M)(w)}return m.invert=function(w){return new Date(x(w))},m.domain=function(w){return arguments.length?s(Array.from(w,xl)):s().map(pl)},m.ticks=function(w){var J=s();return r(J[0],J[J.length-1],w==null?10:w)},m.tickFormat=function(w,J){return J==null?T:h(J)},m.nice=function(w){var J=s();if(!w||typeof w.range!=="function")w=t(J[0],J[J.length-1],w==null?10:w);return w?s(Do(J,w)):m},m.copy=function(){return _u(m,Ki(r,t,u,f,o,n,i,c,l,h))},m}function ai(){return Iu.apply(Ki(Oo,No,sr,At,Qr,Dr,pt,st,Tr,Hu).domain([new Date(2000,0,1),new Date(2000,0,2)]),arguments)}var Ml=Jr("start","end","cancel","interrupt"),Al=[],Gi=0,Xi=1,Uu=2,Lu=3,Wi=4,Zu=5,gt=6;function $r(r,t,u,f,o,n){var i=r.__transition;if(!i)r.__transition={};else if(u in i)return;_l(r,u,{name:t,index:f,group:o,on:Ml,tween:Al,time:n.time,delay:n.delay,duration:n.duration,ease:n.ease,timer:null,state:Gi})}function yt(r,t){var u=b(r,t);if(u.state>Gi)throw Error("too late; already scheduled");return u}function d(r,t){var u=b(r,t);if(u.state>Lu)throw Error("too late; already running");return u}function b(r,t){var u=r.__transition;if(!u||!(u=u[t]))throw Error("transition not found");return u}function _l(r,t,u){var f=r.__transition,o;f[t]=u,u.timer=it(n,0,u.time);function n(h){if(u.state=Xi,u.timer.restart(i,u.delay,u.time),u.delay<=h)i(h-u.delay)}function i(h){var m,x,s,p;if(u.state!==Xi)return l();for(m in f){if(p=f[m],p.name!==u.name)continue;if(p.state===Lu)return Lt(i);if(p.state===Wi)p.state=gt,p.timer.stop(),p.on.call("interrupt",r,r.__data__,p.index,p.group),delete f[m];else if(+m<t)p.state=gt,p.timer.stop(),p.on.call("cancel",r,r.__data__,p.index,p.group),delete f[m]}if(Lt(function(){if(u.state===Lu)u.state=Wi,u.timer.restart(c,u.delay,u.time),c(h)}),u.state=Uu,u.on.call("start",r,r.__data__,u.index,u.group),u.state!==Uu)return;u.state=Lu,o=Array(s=u.tween.length);for(m=0,x=-1;m<s;++m)if(p=u.tween[m].value.call(r,r.__data__,u.index,u.group))o[++x]=p;o.length=x+1}function c(h){var m=h<u.duration?u.ease.call(null,h/u.duration):(u.timer.restart(l),u.state=Zu,1),x=-1,s=o.length;while(++x<s)o[x].call(r,m);if(u.state===Zu)u.on.call("end",r,r.__data__,u.index,u.group),l()}function l(){u.state=gt,u.timer.stop(),delete f[t];for(var h in f)return;delete r.__transition}}function Hr(r,t){var u=r.__transition,f,o,n=!0,i;if(!u)return;t=t==null?null:t+"";for(i in u){if((f=u[i]).name!==t){n=!1;continue}o=f.state>Uu&&f.state<Zu,f.state=gt,f.timer.stop(),f.on.call(o?"interrupt":"cancel",r,r.__data__,f.index,f.group),delete u[i]}if(n)delete r.__transition}function Qo(r){return this.each(function(){Hr(this,r)})}function Il(r,t){var u,f;return function(){var o=d(this,r),n=o.tween;if(n!==u){f=u=n;for(var i=0,c=f.length;i<c;++i)if(f[i].name===t){f=f.slice(),f.splice(i,1);break}}o.tween=f}}function Sl(r,t,u){var f,o;if(typeof u!=="function")throw Error();return function(){var n=d(this,r),i=n.tween;if(i!==f){o=(f=i).slice();for(var c={name:t,value:u},l=0,h=o.length;l<h;++l)if(o[l].name===t){o[l]=c;break}if(l===h)o.push(c)}n.tween=o}}function $o(r,t){var u=this._id;if(r+="",arguments.length<2){var f=b(this.node(),u).tween;for(var o=0,n=f.length,i;o<n;++o)if((i=f[o]).name===r)return i.value;return null}return this.each((t==null?Il:Sl)(u,r,t))}function It(r,t,u){var f=r._id;return r.each(function(){var o=d(this,f);(o.value||(o.value={}))[t]=u.apply(this,arguments)}),function(o){return b(o,f).value[t]}}function jt(r,t){var u;return(typeof t==="number"?v:t instanceof Sr?jr:(u=Sr(t))?(t=u,jr):lt)(r,t)}function wl(r){return function(){this.removeAttribute(r)}}function Cl(r){return function(){this.removeAttributeNS(r.space,r.local)}}function Fl(r,t,u){var f,o=u+"",n;return function(){var i=this.getAttribute(r);return i===o?null:i===f?n:n=t(f=i,u)}}function Bl(r,t,u){var f,o=u+"",n;return function(){var i=this.getAttributeNS(r.space,r.local);return i===o?null:i===f?n:n=t(f=i,u)}}function Ol(r,t,u){var f,o,n;return function(){var i,c=u(this),l;if(c==null)return void this.removeAttribute(r);return i=this.getAttribute(r),l=c+"",i===l?null:i===f&&l===o?n:(o=l,n=t(f=i,c))}}function Nl(r,t,u){var f,o,n;return function(){var i,c=u(this),l;if(c==null)return void this.removeAttributeNS(r.space,r.local);return i=this.getAttributeNS(r.space,r.local),l=c+"",i===l?null:i===f&&l===o?n:(o=l,n=t(f=i,c))}}function Ho(r,t){var u=Br(r),f=u==="transform"?no:jt;return this.attrTween(r,typeof t==="function"?(u.local?Nl:Ol)(u,f,It(this,"attr."+r,t)):t==null?(u.local?Cl:wl)(u):(u.local?Bl:Fl)(u,f,t))}function Tl(r,t){return function(u){this.setAttribute(r,t.call(this,u))}}function Vl(r,t){return function(u){this.setAttributeNS(r.space,r.local,t.call(this,u))}}function Jl(r,t){var u,f;function o(){var n=t.apply(this,arguments);if(n!==f)u=(f=n)&&Vl(r,n);return u}return o._value=t,o}function Pl(r,t){var u,f;function o(){var n=t.apply(this,arguments);if(n!==f)u=(f=n)&&Tl(r,n);return u}return o._value=t,o}function Lo(r,t){var u="attr."+r;if(arguments.length<2)return(u=this.tween(u))&&u._value;if(t==null)return this.tween(u,null);if(typeof t!=="function")throw Error();var f=Br(r);return this.tween(u,(f.local?Jl:Pl)(f,t))}function Dl(r,t){return function(){yt(this,r).delay=+t.apply(this,arguments)}}function Ql(r,t){return t=+t,function(){yt(this,r).delay=t}}function Uo(r){var t=this._id;return arguments.length?this.each((typeof r==="function"?Dl:Ql)(t,r)):b(this.node(),t).delay}function $l(r,t){return function(){d(this,r).duration=+t.apply(this,arguments)}}function Hl(r,t){return t=+t,function(){d(this,r).duration=t}}function Zo(r){var t=this._id;return arguments.length?this.each((typeof r==="function"?$l:Hl)(t,r)):b(this.node(),t).duration}function Ll(r,t){if(typeof t!=="function")throw Error();return function(){d(this,r).ease=t}}function Ko(r){var t=this._id;return arguments.length?this.each(Ll(t,r)):b(this.node(),t).ease}function Ul(r,t){return function(){var u=t.apply(this,arguments);if(typeof u!=="function")throw Error();d(this,r).ease=u}}function ao(r){if(typeof r!=="function")throw Error();return this.each(Ul(this._id,r))}function Xo(r){if(typeof r!=="function")r=ft(r);for(var t=this._groups,u=t.length,f=Array(u),o=0;o<u;++o)for(var n=t[o],i=n.length,c=f[o]=[],l,h=0;h<i;++h)if((l=n[h])&&r.call(l,l.__data__,h,n))c.push(l);return new ur(f,this._parents,this._name,this._id)}function Wo(r){if(r._id!==this._id)throw Error();for(var t=this._groups,u=r._groups,f=t.length,o=u.length,n=Math.min(f,o),i=Array(f),c=0;c<n;++c)for(var l=t[c],h=u[c],m=l.length,x=i[c]=Array(m),s,p=0;p<m;++p)if(s=l[p]||h[p])x[p]=s;for(;c<f;++c)i[c]=t[c];return new ur(i,this._parents,this._name,this._id)}function Zl(r){return(r+"").trim().split(/^|\s+/).every(function(t){var u=t.indexOf(".");if(u>=0)t=t.slice(0,u);return!t||t==="start"})}function Kl(r,t,u){var f,o,n=Zl(t)?yt:d;return function(){var i=n(this,r),c=i.on;if(c!==f)(o=(f=c).copy()).on(t,u);i.on=o}}function Go(r,t){var u=this._id;return arguments.length<2?b(this.node(),u).on.on(r):this.each(Kl(u,r,t))}function al(r){return function(){var t=this.parentNode;for(var u in this.__transition)if(+u!==r)return;if(t)t.removeChild(this)}}function eo(){return this.on("end.remove",al(this._id))}function Yo(r){var t=this._name,u=this._id;if(typeof r!=="function")r=Ur(r);for(var f=this._groups,o=f.length,n=Array(o),i=0;i<o;++i)for(var c=f[i],l=c.length,h=n[i]=Array(l),m,x,s=0;s<l;++s)if((m=c[s])&&(x=r.call(m,m.__data__,s,c))){if("__data__"in m)x.__data__=m.__data__;h[s]=x,$r(h[s],t,u,s,h,b(m,u))}return new ur(n,this._parents,t,u)}function Ro(r){var t=this._name,u=this._id;if(typeof r!=="function")r=ut(r);for(var f=this._groups,o=f.length,n=[],i=[],c=0;c<o;++c)for(var l=f[c],h=l.length,m,x=0;x<h;++x)if(m=l[x]){for(var s=r.call(m,m.__data__,x,l),p,B=b(m,u),I=0,S=s.length;I<S;++I)if(p=s[I])$r(p,t,u,I,s,B);n.push(s),i.push(m)}return new ur(n,i,t,u)}var Xl=Vr.prototype.constructor;function zo(){return new Xl(this._groups,this._parents)}function Wl(r,t){var u,f,o;return function(){var n=Zr(this,r),i=(this.style.removeProperty(r),Zr(this,r));return n===i?null:n===u&&i===f?o:o=t(u=n,f=i)}}function ei(r){return function(){this.style.removeProperty(r)}}function Gl(r,t,u){var f,o=u+"",n;return function(){var i=Zr(this,r);return i===o?null:i===f?n:n=t(f=i,u)}}function el(r,t,u){var f,o,n;return function(){var i=Zr(this,r),c=u(this),l=c+"";if(c==null)l=c=(this.style.removeProperty(r),Zr(this,r));return i===l?null:i===f&&l===o?n:(o=l,n=t(f=i,c))}}function Yl(r,t){var u,f,o,n="style."+t,i="end."+n,c;return function(){var l=d(this,r),h=l.on,m=l.value[n]==null?c||(c=ei(t)):void 0;if(h!==u||o!==m)(f=(u=h).copy()).on(i,o=m);l.on=f}}function qo(r,t,u){var f=(r+="")==="transform"?oo:jt;return t==null?this.styleTween(r,Wl(r,f)).on("end.style."+r,ei(r)):typeof t==="function"?this.styleTween(r,el(r,f,It(this,"style."+r,t))).each(Yl(this._id,r)):this.styleTween(r,Gl(r,f,t),u).on("end.style."+r,null)}function Rl(r,t,u){return function(f){this.style.setProperty(r,t.call(this,f),u)}}function zl(r,t,u){var f,o;function n(){var i=t.apply(this,arguments);if(i!==o)f=(o=i)&&Rl(r,i,u);return f}return n._value=t,n}function Eo(r,t,u){var f="style."+(r+="");if(arguments.length<2)return(f=this.tween(f))&&f._value;if(t==null)return this.tween(f,null);if(typeof t!=="function")throw Error();return this.tween(f,zl(r,t,u==null?"":u))}function ql(r){return function(){this.textContent=r}}function El(r){return function(){var t=r(this);this.textContent=t==null?"":t}}function go(r){return this.tween("text",typeof r==="function"?El(It(this,"text",r)):ql(r==null?"":r+""))}function gl(r){return function(t){this.textContent=r.call(this,t)}}function yl(r){var t,u;function f(){var o=r.apply(this,arguments);if(o!==u)t=(u=o)&&gl(o);return t}return f._value=r,f}function yo(r){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(r==null)return this.tween(t,null);if(typeof r!=="function")throw Error();return this.tween(t,yl(r))}function jo(){var r=this._name,t=this._id,u=Ku();for(var f=this._groups,o=f.length,n=0;n<o;++n)for(var i=f[n],c=i.length,l,h=0;h<c;++h)if(l=i[h]){var m=b(l,t);$r(l,r,u,h,i,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new ur(f,this._parents,r,u)}function bo(){var r,t,u=this,f=u._id,o=u.size();return new Promise(function(n,i){var c={value:i},l={value:function(){if(--o===0)n()}};if(u.each(function(){var h=d(this,f),m=h.on;if(m!==r)t=(r=m).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(l);h.on=t}),o===0)n()})}var jl=0;function ur(r,t,u,f){this._groups=r,this._parents=t,this._name=u,this._id=f}function Yi(r){return Vr().transition(r)}function Ku(){return++jl}var Lr=Vr.prototype;ur.prototype=Yi.prototype={constructor:ur,select:Yo,selectAll:Ro,selectChild:Lr.selectChild,selectChildren:Lr.selectChildren,filter:Xo,merge:Wo,selection:zo,transition:jo,call:Lr.call,nodes:Lr.nodes,node:Lr.node,size:Lr.size,empty:Lr.empty,each:Lr.each,on:Go,attr:Ho,attrTween:Lo,style:qo,styleTween:Eo,text:go,textTween:yo,remove:eo,tween:$o,delay:Uo,duration:Zo,ease:Ko,easeVarying:ao,end:bo,[Symbol.iterator]:Lr[Symbol.iterator]};function au(r){return((r*=2)<=1?r*r*r:(r-=2)*r*r+2)/2}var bl={time:null,delay:0,duration:250,ease:au};function vl(r,t){var u;while(!(u=r.__transition)||!(u=u[t]))if(!(r=r.parentNode))throw Error(`transition ${t} not found`);return u}function vo(r){var t,u;if(r instanceof ur)t=r._id,r=r._name;else t=Ku(),(u=bl).time=Ht(),r=r==null?null:r+"";for(var f=this._groups,o=f.length,n=0;n<o;++n)for(var i=f[n],c=i.length,l,h=0;h<c;++h)if(l=i[h])$r(l,r,t,h,i,u||vl(l,t));return new ur(f,this._parents,r,t)}Vr.prototype.interrupt=Qo;Vr.prototype.transition=vo;var bt=(r)=>()=>r;function ko(r,{sourceEvent:t,target:u,transform:f,dispatch:o}){Object.defineProperties(this,{type:{value:r,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:u,enumerable:!0,configurable:!0},transform:{value:f,enumerable:!0,configurable:!0},_:{value:o}})}function Fr(r,t,u){this.k=r,this.x=t,this.y=u}Fr.prototype={constructor:Fr,scale:function(r){return r===1?this:new Fr(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new Fr(this.k,this.x+this.k*r,this.y+this.k*t)},apply:function(r){return[r[0]*this.k+this.x,r[1]*this.k+this.y]},applyX:function(r){return r*this.k+this.x},applyY:function(r){return r*this.k+this.y},invert:function(r){return[(r[0]-this.x)/this.k,(r[1]-this.y)/this.k]},invertX:function(r){return(r-this.x)/this.k},invertY:function(r){return(r-this.y)/this.k},rescaleX:function(r){return r.copy().domain(r.range().map(this.invertX,this).map(r.invert,r))},rescaleY:function(r){return r.copy().domain(r.range().map(this.invertY,this).map(r.invert,r))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var vt=new Fr(1,0,0);rn.prototype=Fr.prototype;function rn(r){while(!r.__zoom)if(!(r=r.parentNode))return vt;return r.__zoom}function Xu(r){r.stopImmediatePropagation()}function rt(r){r.preventDefault(),r.stopImmediatePropagation()}function kl(r){return(!r.ctrlKey||r.type==="wheel")&&!r.button}function dl(){var r=this;if(r instanceof SVGElement){if(r=r.ownerSVGElement||r,r.hasAttribute("viewBox"))return r=r.viewBox.baseVal,[[r.x,r.y],[r.x+r.width,r.y+r.height]];return[[0,0],[r.width.baseVal.value,r.height.baseVal.value]]}return[[0,0],[r.clientWidth,r.clientHeight]]}function Ri(){return this.__zoom||vt}function rm(r){return-r.deltaY*(r.deltaMode===1?0.05:r.deltaMode?1:0.002)*(r.ctrlKey?10:1)}function tm(){return navigator.maxTouchPoints||"ontouchstart"in this}function um(r,t,u){var f=r.invertX(t[0][0])-u[0][0],o=r.invertX(t[1][0])-u[1][0],n=r.invertY(t[0][1])-u[0][1],i=r.invertY(t[1][1])-u[1][1];return r.translate(o>f?(f+o)/2:Math.min(0,f)||Math.max(0,o),i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i))}function zi(){var r=kl,t=dl,u=um,f=rm,o=tm,n=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],c=250,l=io,h=Jr("start","zoom","end"),m,x,s,p=500,B=150,I=0,S=10;function _(A){A.property("__zoom",Ri).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",a).on("dblclick.zoom",Z).filter(o).on("touchstart.zoom",X).on("touchmove.zoom",Q).on("touchend.zoom touchcancel.zoom",e).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(A,V,C,D){var H=A.selection?A.selection():A;if(H.property("__zoom",Ri),A!==H)T(A,V,C,D);else H.interrupt().each(function(){w(this,arguments).event(D).start().zoom(null,typeof V==="function"?V.apply(this,arguments):V).end()})},_.scaleBy=function(A,V,C,D){_.scaleTo(A,function(){var H=this.__zoom.k,U=typeof V==="function"?V.apply(this,arguments):V;return H*U},C,D)},_.scaleTo=function(A,V,C,D){_.transform(A,function(){var H=t.apply(this,arguments),U=this.__zoom,$=C==null?M(H):typeof C==="function"?C.apply(this,arguments):C,Y=U.invert($),q=typeof V==="function"?V.apply(this,arguments):V;return u(N(O(U,q),$,Y),H,i)},C,D)},_.translateBy=function(A,V,C,D){_.transform(A,function(){return u(this.__zoom.translate(typeof V==="function"?V.apply(this,arguments):V,typeof C==="function"?C.apply(this,arguments):C),t.apply(this,arguments),i)},null,D)},_.translateTo=function(A,V,C,D,H){_.transform(A,function(){var U=t.apply(this,arguments),$=this.__zoom,Y=D==null?M(U):typeof D==="function"?D.apply(this,arguments):D;return u(vt.translate(Y[0],Y[1]).scale($.k).translate(typeof V==="function"?-V.apply(this,arguments):-V,typeof C==="function"?-C.apply(this,arguments):-C),U,i)},D,H)};function O(A,V){return V=Math.max(n[0],Math.min(n[1],V)),V===A.k?A:new Fr(V,A.x,A.y)}function N(A,V,C){var D=V[0]-C[0]*A.k,H=V[1]-C[1]*A.k;return D===A.x&&H===A.y?A:new Fr(A.k,D,H)}function M(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function T(A,V,C,D){A.on("start.zoom",function(){w(this,arguments).event(D).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(D).end()}).tween("zoom",function(){var H=this,U=arguments,$=w(H,U).event(D),Y=t.apply(H,U),q=C==null?M(Y):typeof C==="function"?C.apply(H,U):C,pr=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),y=H.__zoom,ir=typeof V==="function"?V.apply(H,U):V,Ar=l(y.invert(q).concat(pr/y.k),ir.invert(q).concat(pr/ir.k));return function(cr){if(cr===1)cr=ir;else{var _r=Ar(cr),P=pr/_r[2];cr=new Fr(P,q[0]-_r[0]*P,q[1]-_r[1]*P)}$.zoom(null,cr)}})}function w(A,V,C){return!C&&A.__zooming||new J(A,V)}function J(A,V){this.that=A,this.args=V,this.active=0,this.sourceEvent=null,this.extent=t.apply(A,V),this.taps=0}J.prototype={event:function(A){if(A)this.sourceEvent=A;return this},start:function(){if(++this.active===1)this.that.__zooming=this,this.emit("start");return this},zoom:function(A,V){if(this.mouse&&A!=="mouse")this.mouse[1]=V.invert(this.mouse[0]);if(this.touch0&&A!=="touch")this.touch0[1]=V.invert(this.touch0[0]);if(this.touch1&&A!=="touch")this.touch1[1]=V.invert(this.touch1[0]);return this.that.__zoom=V,this.emit("zoom"),this},end:function(){if(--this.active===0)delete this.that.__zooming,this.emit("end");return this},emit:function(A){var V=or(this.that).datum();h.call(A,this.that,new ko(A,{sourceEvent:this.sourceEvent,target:_,type:A,transform:this.that.__zoom,dispatch:h}),V)}};function L(A,...V){if(!r.apply(this,arguments))return;var C=w(this,V).event(A),D=this.__zoom,H=Math.max(n[0],Math.min(n[1],D.k*Math.pow(2,f.apply(this,arguments)))),U=mr(A);if(C.wheel){if(C.mouse[0][0]!==U[0]||C.mouse[0][1]!==U[1])C.mouse[1]=D.invert(C.mouse[0]=U);clearTimeout(C.wheel)}else if(D.k===H)return;else C.mouse=[U,D.invert(U)],Hr(this),C.start();rt(A),C.wheel=setTimeout($,B),C.zoom("mouse",u(N(O(D,H),C.mouse[0],C.mouse[1]),C.extent,i));function $(){C.wheel=null,C.end()}}function a(A,...V){if(s||!r.apply(this,arguments))return;var C=A.currentTarget,D=w(this,V,!0).event(A),H=or(A.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",pr,!0),U=mr(A,C),$=A.clientX,Y=A.clientY;ot(A.view),Xu(A),D.mouse=[U,this.__zoom.invert(U)],Hr(this),D.start();function q(y){if(rt(y),!D.moved){var ir=y.clientX-$,Ar=y.clientY-Y;D.moved=ir*ir+Ar*Ar>I}D.event(y).zoom("mouse",u(N(D.that.__zoom,D.mouse[0]=mr(y,C),D.mouse[1]),D.extent,i))}function pr(y){H.on("mousemove.zoom mouseup.zoom",null),Nt(y.view,D.moved),rt(y),D.event(y).end()}}function Z(A,...V){if(!r.apply(this,arguments))return;var C=this.__zoom,D=mr(A.changedTouches?A.changedTouches[0]:A,this),H=C.invert(D),U=C.k*(A.shiftKey?0.5:2),$=u(N(O(C,U),D,H),t.apply(this,V),i);if(rt(A),c>0)or(this).transition().duration(c).call(T,$,D,A);else or(this).call(_.transform,$,D,A)}function X(A,...V){if(!r.apply(this,arguments))return;var C=A.touches,D=C.length,H=w(this,V,A.changedTouches.length===D).event(A),U,$,Y,q;Xu(A);for($=0;$<D;++$)if(Y=C[$],q=mr(Y,this),q=[q,this.__zoom.invert(q),Y.identifier],!H.touch0)H.touch0=q,U=!0,H.taps=1+!!m;else if(!H.touch1&&H.touch0[2]!==q[2])H.touch1=q,H.taps=0;if(m)m=clearTimeout(m);if(U){if(H.taps<2)x=q[0],m=setTimeout(function(){m=null},p);Hr(this),H.start()}}function Q(A,...V){if(!this.__zooming)return;var C=w(this,V).event(A),D=A.changedTouches,H=D.length,U,$,Y,q;rt(A);for(U=0;U<H;++U)if($=D[U],Y=mr($,this),C.touch0&&C.touch0[2]===$.identifier)C.touch0[0]=Y;else if(C.touch1&&C.touch1[2]===$.identifier)C.touch1[0]=Y;if($=C.that.__zoom,C.touch1){var pr=C.touch0[0],y=C.touch0[1],ir=C.touch1[0],Ar=C.touch1[1],cr=(cr=ir[0]-pr[0])*cr+(cr=ir[1]-pr[1])*cr,_r=(_r=Ar[0]-y[0])*_r+(_r=Ar[1]-y[1])*_r;$=O($,Math.sqrt(cr/_r)),Y=[(pr[0]+ir[0])/2,(pr[1]+ir[1])/2],q=[(y[0]+Ar[0])/2,(y[1]+Ar[1])/2]}else if(C.touch0)Y=C.touch0[0],q=C.touch0[1];else return;C.zoom("touch",u(N($,Y,q),C.extent,i))}function e(A,...V){if(!this.__zooming)return;var C=w(this,V).event(A),D=A.changedTouches,H=D.length,U,$;if(Xu(A),s)clearTimeout(s);s=setTimeout(function(){s=null},p);for(U=0;U<H;++U)if($=D[U],C.touch0&&C.touch0[2]===$.identifier)delete C.touch0;else if(C.touch1&&C.touch1[2]===$.identifier)delete C.touch1;if(C.touch1&&!C.touch0)C.touch0=C.touch1,delete C.touch1;if(C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2){if($=mr($,this),Math.hypot(x[0]-$[0],x[1]-$[1])<S){var Y=or(this).on("dblclick.zoom");if(Y)Y.apply(this,arguments)}}}return _.wheelDelta=function(A){return arguments.length?(f=typeof A==="function"?A:bt(+A),_):f},_.filter=function(A){return arguments.length?(r=typeof A==="function"?A:bt(!!A),_):r},_.touchable=function(A){return arguments.length?(o=typeof A==="function"?A:bt(!!A),_):o},_.extent=function(A){return arguments.length?(t=typeof A==="function"?A:bt([[+A[0][0],+A[0][1]],[+A[1][0],+A[1][1]]]),_):t},_.scaleExtent=function(A){return arguments.length?(n[0]=+A[0],n[1]=+A[1],_):[n[0],n[1]]},_.translateExtent=function(A){return arguments.length?(i[0][0]=+A[0][0],i[1][0]=+A[1][0],i[0][1]=+A[0][1],i[1][1]=+A[1][1],_):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},_.constrain=function(A){return arguments.length?(u=A,_):u},_.duration=function(A){return arguments.length?(c=+A,_):c},_.interpolate=function(A){return arguments.length?(l=A,_):l},_.on=function(){var A=h.on.apply(h,arguments);return A===h?_:A},_.clickDistance=function(A){return arguments.length?(I=(A=+A)*A,_):Math.sqrt(I)},_.tapDistance=function(A){return arguments.length?(S=+A,_):S},_}function qi(r){return[+r[0],+r[1]]}function fm(r){return[qi(r[0]),qi(r[1])]}var Yw={name:"x",handles:["w","e"].map(tn),input:function(r,t){return r==null?null:[[+r[0],t[0][1]],[+r[1],t[1][1]]]},output:function(r){return r&&[r[0][0],r[1][0]]}},Rw={name:"y",handles:["n","s"].map(tn),input:function(r,t){return r==null?null:[[t[0][0],+r[0]],[t[1][0],+r[1]]]},output:function(r){return r&&[r[0][1],r[1][1]]}},zw={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(tn),input:function(r){return r==null?null:fm(r)},output:function(r){return r}};function tn(r){return{type:r}}export{fn as d,on as e,f0 as f,o0 as g,or as h,wn as i,Vn as j,Pn as k,Zn as l,Kn as m,an as n,Xn as o,wo as p,Hu as q,ai as r,zi as s};
|