diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index be6b2dda..703bbaf6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -307,6 +307,20 @@ jobs: env: PYTHON: python BROWSER: /usr/bin/google-chrome + - name: Qualify retained query and authenticated Runs over one actual checkpoint fixture + run: | + mkdir -p build/qa/retained-analysis + python tests/retained_analysis_actual_fixture.py --directory build/retained-analysis-fixture > build/qa/retained-analysis/fixture.json + python -m unittest discover -s tests -p 'test_retained_analysis*.py' -v > build/qa/retained-analysis/query-http-tests.log 2>&1 + node tests/test_workspace_model_controller.cjs + node tests/browser_retained_analysis.cjs > build/qa/retained-analysis/renderer.json + node tests/browser_retained_analysis_actual.cjs > build/qa/retained-analysis/runs-browser.json + env: + PYTHON: python + BROWSER: /usr/bin/google-chrome + TULDOK_ANALYSIS_ACTUAL: '1' + TULDOK_ANALYSIS_HTTP: '1' + TULDOK_ANALYSIS_FIXTURE: ${{ github.workspace }}/build/retained-analysis-fixture - name: Verify exact retained scientific comparison in the existing workspace run: node tests/browser_scientific_comparison.cjs env: diff --git a/agent_api.py b/agent_api.py index 116de002..021860b9 100644 --- a/agent_api.py +++ b/agent_api.py @@ -477,6 +477,12 @@ def model_operation(name,method,path,properties=None,required=None,*,output=None 'predictions':{'oneOf':[{'type':'null'},_EVIDENCE_DOCUMENT]}})]} model_operation('runs.model_evidence','POST','/api/workspace/runs/{run_id}/model-evidence', {'run_id':ID,'checkpoint_sha256':SHA},['run_id'],output=_EVIDENCE_RESULT) +from retained_analysis_schema import schemas as _retained_analysis_schemas +_retained_request, _retained_result = _retained_analysis_schemas(obj, text, integer, array, const, ID, SHA) +for _name, _suffix in (('runs.retained_analysis', ''), ('runs.export_retained_analysis', '/export')): + model_operation(_name, 'POST', '/api/workspace/runs/{run_id}/retained-analysis' + _suffix, + _retained_request['properties'], _retained_request['required'], output=_retained_result, + description='Read one exact retained classifier curve and bounded example page; current inspect access required.') model_operation('runs.compare_model_evidence','POST','/api/workspace/runs/{run_id}/compare-model-evidence', {'run_id':ID,'other_run_id':ID},output=obj({ 'state':{'enum':['compatible','incompatible']},'run_ids':array(ID,2,2), diff --git a/app.py b/app.py index df2ca426..267a8f98 100644 --- a/app.py +++ b/app.py @@ -958,6 +958,12 @@ def _get(self): '/workspace-external.js': ('workspace-external.js', 'text/javascript'), '/workspace-phase-timings.js': ('workspace-phase-timings.js', 'text/javascript'), '/workspace-service.js': ('workspace-service.js', 'text/javascript'), + '/static/retained-analysis.js': ('retained-analysis.js', 'text/javascript'), + '/static/retained-checkpoint-curve.vl.json': ('retained-checkpoint-curve.vl.json', 'application/json'), + '/static/vendor/retained-analysis/vega.min.js': ('vendor/retained-analysis/vega.min.js', 'text/javascript'), + '/static/vendor/retained-analysis/vega-lite.min.js': ('vendor/retained-analysis/vega-lite.min.js', 'text/javascript'), + '/static/vendor/retained-analysis/vega-embed.min.js': ('vendor/retained-analysis/vega-embed.min.js', 'text/javascript'), + '/static/vendor/retained-analysis/vega-interpreter.min.js': ('vendor/retained-analysis/vega-interpreter.min.js', 'text/javascript'), '/workspace-scientific-comparison.js': ('workspace-scientific-comparison.js', 'text/javascript'), '/workspace-fixtures.json': ('workspace-fixtures.json', 'application/json'), '/pipeline-editor.js': ('pipeline-editor.js', 'text/javascript'), @@ -1173,6 +1179,14 @@ def graph_guard(graph): self._graph_snapshot_contract_access(body['graph_id'],body['graph_revision'], 'runs.submit_external',2,graph=graph) return self.reply(dataset.runs.submit_external(body,_graph_guard=graph_guard), 201) + if (len(parts) == 3 or len(parts) == 4 and parts[3] == 'export') and parts[0] == 'runs' and parts[2] == 'retained-analysis': + import retained_analysis + operation = 'runs.export_retained_analysis' if len(parts) == 4 else 'runs.retained_analysis' + agent_api.require_selection(self._contract_selection, operation) + # The selected-contract decoder rejects all duplicate + # body Run IDs before this path-owned identity is added. + return self.reply(retained_analysis.query(dataset.runs, dict(body, run_id=parts[1]), + export=len(parts) == 4)) if len(parts) == 3 and parts[0] == 'runs': if parts[2] == 'model-evidence': agent_api.require_selection(self._contract_selection,'runs.model_evidence') diff --git a/docs/contracts/retained-analysis-query.md b/docs/contracts/retained-analysis-query.md new file mode 100644 index 00000000..c24024e5 --- /dev/null +++ b/docs/contracts/retained-analysis-query.md @@ -0,0 +1,95 @@ +# Retained checkpoint examples query v1 + +Status: implemented and qualified in the verified native classifier Runs view. +Python entry point: `retained_analysis.query(runs, body)`. HTTP consumers select +`runs.retained_analysis/1` or `runs.export_retained_analysis/1` explicitly with +its published capability hash. POST routes are +`/api/workspace/runs//retained-analysis` and its `/export` sibling. +HTTP bodies omit run_id: the selected decoder rejects duplicate body IDs and +the handler injects the validated URL ID. The Python example below includes it +because the direct query entry point receives the full exact request. + +```json +{ + "query_id": "retained_checkpoint_examples", + "query_version": 1, + "run_id": "", + "evaluation_sha256": "", + "checkpoint_sha256": "", + "metric_id": "accuracy", + "metric_definition_sha256": "", + "fields": ["example_id", "truth_index", "predicted_index", "confidence", "error"], + "errors_only": false, + "limit": 50, + "offset": 0 +} +``` + +Closed object; last four fields optional with shown defaults. Metrics allow +accuracy/loss/macro_f1 only. Fields must be unique and include example_id. +Integer booleans are rejected; limit 1–100, offset 0–10000. One exact completed +native `model_evidence_v1` Run, validation split only. Scientific field and +one-fit formats require their own later query variants. All hashes lowercase +64-character SHA256; a valid hash from another result/checkpoint is rejected. + +Access: inspect checked before evidence and again after the SQL read snapshot, +including exports. No cache, training, inference, new analysis, checkpoint +deserialization or holdout exposure. Existing Runs verification re-tallies +retained metric evidence; it does not publish a new computed result. +`export=True` is a host-owned keyword, never caller metadata; it runs the same +bounded query under `runs.export_retained_analysis`. Each exported page is a +fresh authorized query; no unbounded export endpoint or persistent URL. + +Runs verifies immutable bytes and graph/task compatibility. Query selects the +exact PostgreSQL workspace_runs row and checks artifact identity. Curve SQL +reads catalog metric history and joins verified checkpoint epochs. Every value, +epoch and support must equal retained observations. Bounded verified per-example +scalars are passed to PostgreSQL as a parameterized disposable recordset for +error filtering and stable ordinal pagination. This is an initial projection, +not a new persisted statistics schema. Original text and hash-bound bytes are +unchanged; JSONB casts never define evidence identity. + +Budgets: 128 checkpoints, 10000 fixed-probe examples, 2 MiB scalar projection, +16 MiB existing Run document, 256 KiB response, 100-row pages; SQL statement and +lock timeouts 2000ms scoped to the read transaction, two-second ownership wait. +Existing Runs verification/artifact budgets still apply before SQL; the SQL +timeout is not a hard wall deadline on artifact verification. These initial +limits are explicit admission bounds, not measured performance targets. An +outer transaction is refused; a standalone read owns Repeatable Read and READ +ONLY. These settings are consistency controls, not an untrusted-SQL sandbox. +All query structure/relations/functions are server-owned; credentials remain +server-side. No new roles, privileges, DDL or production migrations. + +Response: state verified; query ID/version; frozen mode; provenance including +catalog/Run/evaluation/checkpoint/metric-definition/population/probe/data hashes +and retained producer identity. Metric includes its original definition/units +and unfiltered support. Curve rows carry checkpoint hash, epoch, exact value, +support. Table columns carry type/units; rows always include stable example_id, +ordinal and complete frozen_reference. Confidence is the retained predicted +class probability. Errors mean truth_index != predicted_index. Population +support, filtered support, page offset/limit/next_offset and visible filters +remain distinct. Error filtering never recomputes curve statistics or changes +their population. No display sampling is used: the population is explicitly +the frozen validation probe, not an implied full dataset. selection_sha256 +identifies canonical query settings and is not a new computed-result identity. + +Failures use WorkbenchError: invalid request 400; unsupported query/task 409; +stale evaluation/metric 409; foreign checkpoint/not-found Run 404; limit 413; +unavailable standalone/read state 503 where applicable. Existing Access and +storage errors propagate with their established boundaries. A failed or revoked +request clears the renderer, cancel obsolete requests, and exclude +late replies. Already returned bytes cannot be recalled. + +The renderer consumes an immutable base spec/result and transient allowlisted +selections. Persisted revisioned display overrides remain a later milestone. +Changed analysis creates a new result; +series/color/range/display filters cannot silently redefine metric meaning. +No renderer or spec is accepted merely because it is JSON. + + +Qualification: 27 query/contract/actual PostgreSQL/authenticated HTTP tests pass +without skips; the actual Runs browser uses the normal app, retained native Run, +real session revocations and a fresh application process. See +[acceptance evidence](../plans/retained-analysis/reports/m4-integrated/acceptance.md). +The two-epoch six-image fixture proves custody, transport and numeric behavior; +it makes no model-quality or production-scale claim. diff --git a/docs/contracts/retained-analysis-renderer.md b/docs/contracts/retained-analysis-renderer.md new file mode 100644 index 00000000..9868ebcc --- /dev/null +++ b/docs/contracts/retained-analysis-renderer.md @@ -0,0 +1,132 @@ +# Retained checkpoint renderer adapter + +Status: mounted in existing Runs for verified completed native classifier +results, with lead-approved additive HTTP/contract and lifecycle hooks. + +`WorkspaceRetainedAnalysis.mount(root, {load, onSelection})` returns: + +- `update(request, authorityKey)`: clear previous private state, abort obsolete + work, load one bounded named query page and the pinned local spec, validate + identities/counts/types, then render. Host changes authorityKey and calls + update/dispose whenever credential, catalog, Run or navigation authority changes. +- `resize()`: resize the active Vega view; container changes also use an owned + ResizeObserver. +- `selection()`: copy of the current exact query selection, or null after + failure/disposal. Declared checkbox and page controls issue fresh queries. +- `dispose()`: abort pending reads, invalidate late callbacks, finalize Vega, + disconnect observer and clear DOM/private state. + +`load` is host code accepting `(request, {signal, authorityKey, export})`, returning +the query response. It must use current authenticated transport and the exact +registered contract. It must never select credentials from caller metadata. +The optional host onSelection callback receives a checkpoint hash selected by +chart or keyboard buttons; arbitrary callbacks cannot come from chart JSON. + +Exports reissue the same bounded request with export true, validate the fresh +response, then download JSON through a short-lived Blob URL that is immediately +revoked. Failure clears existing private content. Vega export/editor/source +actions are disabled. No export uses previously displayed bytes as authority. + +## Spec and dependency authority + +`examples/analysis/retained_checkpoint_curve.py` is a readable Altair 5.5.0 authoring +script. Run it explicitly with its authoring-only requirements to generate +`static/retained-checkpoint-curve.vl.json`. View opening never imports Python or +executes the script. JSON bytes and their reviewed SHA256 are retained; JSONB +or mutable overrides never replace that byte identity. + +This first recipe accepts exactly one local specification, at most 16 KiB, whose +bytes must match the renderer's pinned digest. The specification contains a +single named inline curve dataset, two marks and one checkpoint point-selection +parameter. Arbitrary user specs, URLs, patches, expression functions, embed +options and HTML/tooltips are not accepted. Changing the script/spec requires a +new reviewed digest. The host alone supplies validated curve data. The bound +schema hint is not fetched. A denied Vega loader prevents data/image/link URL +loading even after compilation; tooltips are disabled and table text uses DOM +textContent. A JSON format alone is never the security boundary. + +Self-hosted unmodified upstream browser distributions: + +| Package | Pinned version | License | +| --- | --- | --- | +| vega | 5.33.0 | BSD-3-Clause | +| vega-lite | 5.23.0 | BSD-3-Clause | +| vega-embed | 6.29.0 | BSD-3-Clause | +| vega-interpreter | 1.2.0 | BSD-3-Clause | + +The v5 family matches the v5 schema emitted by Altair 5.5 and supplies UMD +distributions without a new application bundler. Load in the table order before +retained-analysis.js. The interpreter extends window.vega. Embed passes ast true +and expressionInterpreter. The renderer runs with script-src self, without +unsafe-eval or inline scripts. Its isolated fixture also uses style-src self. +The deployed /workspaces policy retains unsafe-inline for existing application +CSS; this grants no inline script/eval permission. The meta policy precedes all +assets and restricts data connections to the same origin, objects/base to none, +images/media to existing local/data/blob needs, and frames/forms to self. +No pre-existing CSP was relaxed. `static/vendor/retained-analysis/manifest.json` records +exact asset/tarball hashes, upstream URLs, and retained notices for packages in +the upstream source maps. Notice-source resolution versions do not claim exact +embedded transitive versions. BSD, MIT and ISC notices are retained with the +assets. No license implies dataset/model rights. + +## Acceptance boundary + +`node tests/browser_retained_analysis.cjs` starts a local fixture server and real +headless Chromium with a disposable profile. It exercises the actual assets, +interpreter, strict CSP, exact authored numbers, physical keyboard/focus, SVG +point selection, pagination/filter, 390px width, stale reply after revoked-mode +response, decoder/spec tampering limits, fresh export and downloaded JSON, +cache-bypassed page reload and disposal. No external chart-asset request or CSP +violation is permitted. Headless/no-sandbox/software rendering is test-only and +does not establish an application execution sandbox. + +The authored renderer test establishes malformed/oversized spec and response +rejection, precise widget lifecycle and strict-CSP compatibility. It does not +substitute for custody or access acceptance. + +`node tests/browser_retained_analysis_actual.cjs` separately opens the normal +application with the existing PostgreSQL catalog and a normally trained, +retained two-epoch native classifier fixture. It checks the actual named query, +exact retained numbers, keyboard-linked table, 390px layout, actual response +cancellation, authorized JSON download, real credential revocation, and a fresh +application-process/cache-bypassed reopen. It also revokes access immediately +before normal Run detail, prediction and model-evidence requests, proving that +denials clear previously rendered private content even after identity becomes +null. Deployed CSP violations are captured; ordinary runtime code generation +is explicitly checked with the DevTools CSP bypass disabled. No remote chart +asset is requested. These are bounded workflow checks, not full-application +accessibility or performance certification. + +## Integrated host contract + +Two new inspect/read operations, `runs.retained_analysis/1` and +`runs.export_retained_analysis/1`, have closed typed request/response schemas and +exact browser pins. Every prior contract/discovery document remains unchanged. +POST `/api/workspace/runs//retained-analysis` and its `/export` sibling +require an explicitly selected contract. Bodies omit run_id and reject any +duplicate; the handler supplies the validated URL ID. The export flag is owned +by the route. + +The existing verified native classifier section constructs requests from its +exact artifact/metric/checkpoint inventory. The widget owns a separate root and +uses authenticated bounded transport with timeout/caller-abort wiring. Mount, +Run replacement, navigation, session change and access failure dispose its +view. Old responses cannot update a new selection or authority. Failed access +also clears the containing private Run. The model transport captures Run, +credential and generation before dispatch and forwards access denials before +local catches, including old checkpoint/candidate/package/comparison reads. +Aborted or invalidated-generation replies cannot trigger cleanup. Existing coordinator/phase/publication/ +scientific controllers retain their ownership; no new computation starts on +view opening. The Dataset selector starts disabled until existing initialization +attaches its handlers, including during local vendor-asset loading. + +The branch composes reliability baseline 83a1e128 and adds CI commands using one +actual retained fixture outside uploaded QA artifacts; private login material +stays outside evidence. The repository lead alone merges this dependent PR. +See [acceptance](../plans/retained-analysis/reports/m4-integrated/acceptance.md). + +Official references checked 2026-10-19/20: +[Altair serialization](https://altair-viz.github.io/user_guide/saving_charts.html), +[Vega-Lite parameters](https://vega.github.io/vega-lite/docs/parameter.html), +[vega-embed options](https://vega.github.io/vega-embed/index.html), +[Vega interpreter](https://vega.github.io/vega/usage/interpreter/). diff --git a/docs/plans/retained-analysis/execution-ledger.md b/docs/plans/retained-analysis/execution-ledger.md new file mode 100644 index 00000000..823f28cd --- /dev/null +++ b/docs/plans/retained-analysis/execution-ledger.md @@ -0,0 +1,80 @@ +# Execution ledger + +2026-10-19: Fetched main 8c9c0b0 (PR101), clean checkout. Created isolated +feature/retained-analysis-query-20261019. Read supplied five-page Library brief, +Runs/evidence/access/Metadata owners and adopted standards sources. Froze M1 +additive write set before code. PR102–110 overlap shared API/Run/UI files; +parent relay is pending. No shared-file edit, schema migration, credential or +permission change performed. No existing PostgreSQL configuration is available. + +2026-10-20: Parent relayed lead ownership confirmation: new query/chart modules, +renderer/tests/contracts belong to this branch. Existing shared handlers and +workspace controllers remain coordinated through parent; no edit performed. +Implemented M1 bounded exact-result query and M2 isolated Altair/Vega renderer. +Python boundary tests: 12 pass, one actual PostgreSQL SQL test explicitly skips. +Real headless Chromium uses authored query responses; checks strict CSP with +interpreter, local-only assets, exact values, keyboard/pointer links, pagination, +error filters, 390px layout, bad specs/responses, stale reply after authority +failure, fresh export/download, cold page reload and disposal. This is not +actual-store or authenticated application acceptance. Review identified and +closed preflight typed-error and frontend count/provenance/type-decoding gaps. +Full objective remains Verifying pending shared hook agreement and a provisioned +authorized PostgreSQL/training environment. Nothing merged. + +2026-10-20 00:12 UTC: Parent clarified disposable local PostgreSQL/dependency setup +is within implementation scope; no new user permission is required. Downloaded +official Debian PG17.11 packages into task-owned storage, extracted without a +system package/service change, and initialized the existing repository helper +under `/tmp/tuldok-analysis-pg`. Provisioned the repository-pinned CPU training +packages in `/tmp/tuldok-training-runtime/venv`; the normal runtime probe reports +available. One normal six-image classifier Run completed with two retained +checkpoints. The original query suite now passes 13/13 against actual PostgreSQL; +six new actual retained-query tests pass, covering exact bytes/numbers, stable +pages/support, real credential revocation including final-check fault timing, +artifact re-verification, inert reads/exports and a fresh-process cold reopen. +The earlier 12-pass/one-skip log remains retained as historical evidence. +No shared handler has been edited; authenticated API/Run UI acceptance still +awaits lead ownership agreement. After a reported disconnect, shell/service state +was verified available; existing workers/fixtures were reused, not duplicated. + + +2026-10-20 M4: Parent relayed the lead's explicit shared-hunk approval; composed +83a1e128 in merge252a68c without conflicts. Registered two closed inspect/read +contracts, exact asset paths and selected authenticated POST routes; mounted the +pinned adapter in verified native classifier Runs with bounded transport and +disposal. Added scoped script CSP, preserving existing inline CSS. Independent +review found swallowed ordinary Run access denials and null-identity cleanup; +fixed propagation and generation/session-aware clearing. Actual Chromium now +revokes at export plus detail/predictions/model-evidence boundaries and verifies +private Run removal. It checks exact numeric/linked/narrow/cancellation behavior +and reopening in a fresh application process. Query/actual/contract/HTTP suite +passes27/27, 11 controller suites pass, isolated renderer Chromium passes. +Initial HTTP expectation (400 versus contract mismatch) and already-cancelled +CDP interception handling were corrected; initial failure logs are retained. +The Dataset selector now begins disabled until existing listeners are ready. +CI reuses one normal actual fixture and keeps its private catalog/login material +outside uploaded build/qa. No production migration, role, credential, schema or +compute-on-open path was added. Integration acceptance and independent review +are retained under reports/m4-integrated. Lead alone owns merge. + + +Final review follow-up: a central captured-Run/credential/generation transport +wrapper forwards WorkspaceModel401/403 before any local presentation catch, +including old checkpoint/candidate/package/comparison paths. It excludes aborted +retained requests and invalidated generations. Nested saved-candidate/package +loads rethrow denials. The actual browser holds an old checkpoint read until its +rerendered retained query succeeds, then revokes/releases it and verifies all +private Run content clears. Controlled tests cover null identity versus changed +navigation/session. All11 controller suites pass after the change. Existing +actual coordinator and scientific Runs browsers pass under the scoped CSP; +36 relevant Python regression tests pass. + + +Final independent GPT-6.1 Sol High review approved with no remaining blocking +findings. It reran contracts3, actual HTTP5, model controller and actual Runs +Chromium, verified all124 old contract/discovery identities, and retained a final +18-file source SHA256 manifest. All hashes match publication sources. Main and +reliability dependency were refetched and remain8c9c0b0/83a1e128. Active PR102–110 +write sets were rechecked; only the explicitly approved shared hunks changed. +Implementation acceptance is complete for this bounded slice; merge belongs to +the repository lead. No production gate was crossed. diff --git a/docs/plans/retained-analysis/issues.md b/docs/plans/retained-analysis/issues.md new file mode 100644 index 00000000..93fa7f29 --- /dev/null +++ b/docs/plans/retained-analysis/issues.md @@ -0,0 +1,10 @@ +# Issues + +| ID | Finding | Owner | State / disposition | +| --- | --- | --- | --- | +| V1 | Shared API/Run/UI hooks overlap PR102–110 | parent/repository lead | resolved: parent relayed explicit lead-approved hunks; reliability83a1e128 composed without conflicts | +| V2 | Initial PostgreSQL/runtime absence | environment/parent | resolved for local tests after parent clarified disposable setup scope; PG17.11 and pinned CPU runtime provisioned under /tmp; actual direct-query tests pass | +| V3 | General results and saved view revisions are later milestones | visualization owner | preserve immutable result boundary; no early persistence engine | +| V4 | Normal Run loader swallowed access denials and skipped cleanup after identity became null | Runs/visualization | resolved: propagate401/403; generation/session-aware cleanup; actual browser revokes at detail/predictions/model-evidence boundaries | +| V5 | Isolated strict CSP did not establish deployed policy | renderer/host | resolved: scoped /workspaces policy before assets; actual browser asserts no runtime code generation or unexpected violations; existing inline CSS remains allowed | +| V6 | Dataset selector accepted input before initialization during pinned asset loading | workspace host | resolved: initial markup disabled; existing initializer enables after setup | diff --git a/docs/plans/retained-analysis/plan.md b/docs/plans/retained-analysis/plan.md new file mode 100644 index 00000000..d06daa59 --- /dev/null +++ b/docs/plans/retained-analysis/plan.md @@ -0,0 +1,168 @@ +# Plan: Retained checkpoint curve and linked examples + +**Plan status:** `Accepted` + +**Current phase:** M4 complete; independently reviewed; lead-owned integration + +**Next slice:** Lead review and serial integration of the completed dependent PR. + +**Acceptance status:** `accepted for this bounded slice` + +**Execution ledger:** [execution-ledger.md](execution-ledger.md) + +**Issues:** [issues.md](issues.md) + +## Objective + +Open an exact retained classifier result in Runs, inspect its metric curve, +select an exact checkpoint and page its frozen examples/errors, with current +access, numeric, lifecycle and provenance guarantees. View opening is inert. + +## Objective Acceptance + +| ID | Observable criterion | Kind | Environment | Mode | Status | Evidence | +| --- | --- | --- | --- | --- | --- | --- | +| A1 | Closed named query rejects malformed identities, unknown fields and unbounded requests before reads; exact substitutions fail before result return | contract | not-applicable | automated | passed | [focused tests](reports/m1/focused-tests.log) | +| A2 | Exact metric values, stable examples, pagination/support and frozen identity agree with retained bytes and actual PostgreSQL | integration | required-real | automated | passed | [actual retained query tests](reports/m3-actual/retained-query-tests.log) | +| A3 | Actual Runs browser supports keyboard, linked selections, narrow layout, stale replies, revocation, malformed/large specs, offline assets and cold reopen | user-workflow | required-real | automated | passed | [actual Runs browser](reports/m4-integrated/browser.json), [strict isolated renderer](reports/m4-integrated/renderer.json); complementary scopes documented | +| A4 | Query/export reauthorize every retrieval, no cache authority, no computation or mutation on opening | integration | required-real | automated | passed | [query/HTTP tests](reports/m4-integrated/query-http-tests.log), [real Run revocation/export/cold reopen](reports/m4-integrated/browser.json) | + +## Scope + +### In Scope + +First recipe: existing native `model_evidence_v1` classifier checkpoints, +validation metrics and retained fixed-probe examples. One result/run per request; +exact result and metric-definition hashes. Server-owned parameterized SQL over +the existing PostgreSQL Run document and a bounded verified example projection. +No schema change, role/credential change, or production migration. + +### Out Of Scope + +Scientific field queries, arbitrary SQL/Python/JS, benchmark execution, extra +plot libraries, generic EAV/schema engines, computed-on-open analyses and saved +view persistence. Revisioned overrides follow the completed immutable slice. + +## Binding Decisions + +| Decision | Owner | Evidence | Supersedes | +| --- | --- | --- | --- | +| Runs owns retained verification; query owner only projects verified results | Runs | `runs.py:2331`, `model_evidence.py:381` at main 8c9c0b0 | none | +| `retained_checkpoint_examples` v1 selects explicit run, evaluation, metric definition and checkpoint hashes | retained_analysis | [contract](../../contracts/retained-analysis-query.md) | none | +| Existing text Run document remains authoritative; JSONB casts are disposable query projections | Metadata/Runs | schema v10; raw artifact hashes retained | none | +| Vega-Lite/vega-embed with interpreter and self-hosted pinned assets | renderer | official upstream docs; later asset/browser qualification required | none | +| Lead alone merges; shared hooks approved after composing reliability83a1e128 | repository lead | parent relay 2026-10-20; explicit approved hunks | initial pending coordination | + +## Design Observations And Remaining Evidence + +No AGENTS.md exists in workspace/repository. Applied Core/Router and selected +implementation, verification/oracles/GUI, planning, commit, documentation, +architecture/replay/code-design, contracts/protocol/evolution, persistence/IPC, +security/delegation, concurrency/resilience, performance, dependencies/licensing, +accessibility/frontend guidance from Coding-Standards dcc56f26. No callable +Standards Engine is exposed; this is source-guided routing, not certification. +Brief `libfile_e94877d6735c8191a6e5d78c82d1151b` read in full (five pages). + +Initial source environment lacked PostgreSQL/configuration and a qualified CPU +runtime. The parent clarified that a disposable local test database and ordinary +official dependency setup are within scope. Task-owned PostgreSQL 17.11 now runs +under `/tmp`, using the existing local_postgres helper; pinned CPU packages are +provisioned in a separate test runtime. Six actual retained-query tests and all +13 original query tests pass. Initial skipped evidence remains unchanged. +No production catalog, credential, role or system-service change is involved. + +## Simplicity And Ownership Review + +**Applicability:** `applicable` + +- Independent concepts and dimensions: frozen analysis identity; mutable view + selection; current access; transport lifecycle; chart rendering. +- State, identity, value, time, policy, mechanism: Runs/artifacts own evidence, + Access owns current scopes, Metadata owns transaction/lock, this module owns + one closed read query. Query version does not revise metric meaning. Result + hash changes invalidate selections; colors never change result identity. +- Caller/composition knowledge: caller sends exact identities and bounded page; + query invokes the established verifier. Browser needs no artifact paths/SQL. +- Representative changes: adding a second recipe changes the query registry; + replacing renderer leaves result query intact; new metric meaning creates a + new retained result instead of mutating this query. +- Stable interfaces: explicit response fields, units, support and unavailable + errors. Internal evidence path knowledge stays in Runs. +- Independent evolution/failure: query can be tested without shared UI edits; + missing data is typed unsupported/unavailable, never substituted. +- Necessary complexity: strict decoding, evidence closure, bounded SQL and + post-read authorization protect separate reachable failures. +- Deletion result: removing renderer leaves current Runs fully functional; + removing query leaves no persisted second authority or migration. + +## Milestones + +### M1: Authorized bounded retained query + +**Allowed write set:** `retained_analysis.py`, `tests/test_retained_analysis.py`, +`tests/retained_analysis_actual_fixture.py`, `tests/test_retained_analysis_actual.py`, +`tests/test_retained_analysis_http.py`, `tests/browser_retained_analysis_actual.cjs`, +`docs/contracts/retained-analysis-query.md`, `docs/plans/retained-analysis/**`. + +Implement closed validation, exact retained identity, owned bounded SQL, +typed columns/units/support/provenance and final access check. Review through a +separate GPT-6.1 Sol High instance. Gate A1; A2/A4 remain blocked without actual DB. + +### M2: Embedded curve and linked table + +Allowed additive files: `static/retained-analysis.js`, +`static/retained-checkpoint-curve.vl.json`, `static/vendor/retained-analysis/**`, +`examples/analysis/retained_checkpoint_curve.py`, +`examples/analysis/requirements.txt`, `tests/browser_retained_analysis.cjs`, +`tests/retained_analysis_browser_fixture.py`, +`tests/fixtures/retained-analysis-browser.js`, +`tests/fixtures/retained-analysis-browser.css`, +`docs/contracts/retained-analysis-renderer.md`. +Shared integration candidates `app.py`, +`agent_api.py`, `static/workspace-real.js`, `static/workspaces.html`, +`static/workspaces.css`, CI; exact hooks must be agreed with lead before edit. +Define mount/resize/update/selection/export/dispose; deny external loaders/editor, +use interpreter under strict CSP. Gate A3 plus actual A2/A4. + +### M4: Authenticated integration, approved through parent + +Composed dependency: `83a1e1289f3f7e4f8c3e697c1748a862a69d0897`, reliability +PR108 branch (including its composed PR102–110 history). Local composition merge +`252a68c5b90afdd8660f652cfa0094233ef9f64f`; no conflict resolution or reliability +rewrites. The PR must declare this dependency until the lead integrates it. + +Allowed shared hunks: `agent_api.py` two new inspect contracts; `app.py` POST +handlers and exact static asset mappings; `static/workspace-real.js` bounded +authenticated transport; `static/workspace-service.js` verified native classifier +mount/disposal; `static/workspaces.html` (scoped CSP before assets; initially disabled selector), scoped CSS and additive CI commands. +Normal Run read catches propagate access denials to generation/session-aware +private-content cleanup; no non-auth reliability fallback changes. +New `retained_analysis_schema.py` owns the narrow schema. Preserve all existing +coordinator/phase/publication/batch/scientific-comparison behavior and old +operation identities. HTTP bodies omit run_id; validated path ID is injected. +Execute actual SQL, authenticated HTTP, Runs browser, real revocation/export and +cold-reopen acceptance, then independent review before publication readiness. + +## Blockers + +- `none` for implementation or local acceptance. Lead-owned integration remains; no new user permission is needed. + +## Re-Plan Triggers + +Real data exceeds declared query budgets; incompatible artifact formats; +shared hook ownership changes; actual CSP/interpreter incompatibility; measured +need for indexed relational facts requiring a separately gated schema migration. + +## Repository Isolation + +Path `/workspace/Tuldok`; branch `feature/retained-analysis-query-20261019` from +main `8c9c0b0`. Preserve all README and reliability branches. Lead owns merge; +retain source/evidence and branch for its review. No worktree deletion planned. + +## Final Acceptance + +- Acceptance status: `accepted for this bounded slice` +- Evidence: [M4 acceptance](reports/m4-integrated/acceptance.md) +- Deferred follow-ups: general query recipes, persisted revisioned view overrides, + benchmark manifests and later scientific workflows; outside this first slice +- Final status: `Accepted` for the implemented slice; lead alone owns merge diff --git a/docs/plans/retained-analysis/reports/ci-qualification-20261020/acceptance.md b/docs/plans/retained-analysis/reports/ci-qualification-20261020/acceptance.md new file mode 100644 index 00000000..80db0db6 --- /dev/null +++ b/docs/plans/retained-analysis/reports/ci-qualification-20261020/acceptance.md @@ -0,0 +1,58 @@ +# PR111 captured CPU browser qualification + +Base: `beead92d54e33e70eb9df82e872adf14ff314c91`. Repair owner: +`fix/retained-analysis-ci-qualification-20261020`; root owns serial integration. +The write set is the existing `tests/browser_model_development.cjs` gate and +this evidence directory. Production code and operation contracts are unchanged. + +Both original captured CPU jobs reach actual training, branching, correction +and comparison, then time out at line 556. The obsolete assertion waits for +`Evidence access revoked` inside `.model-evidence`. The accepted Runs owner in +`static/workspace-real.js` removes that private panel and puts the denial in +`.real-status`. Its exact original output shows the denial, no Run rows and no +private result content. The next explicit Refresh action was never reached. +[Original failures](original-failures.json) retain all four run/job identities, +exact failure excerpts, checkout/source bindings, timestamps, full decoded-log +hashes and local raw MCP response/metadata paths. + +The repaired assertion still injects the same 403. It waits for the Runs-owned +status and requires zero private model panels, metric grids, retained charts, +Run rows, checkpoint controls and probe controls. Only an explicit Refresh may +restore the exact third Run, its two checkpoints, metrics and rendered retained +SVG. The browser receipt records the observed denial and recovered result. + +[Actual browser receipt](receipt.json) and [execution log](model-development.log): +passed, including all existing checks and the strengthened H5 denial/recovery. +[Qualification](qualification.json) binds the exact tested source hashes. +`node --check tests/browser_model_development.cjs` and the existing +[model controller suite](model-controller.log) passed. +This browser uses normal app/HTTP/PostgreSQL, authored image import and review, +frozen release creation, real CPU training, correction and exact comparison. +The denial itself is a controlled HTTP substitution; actual credential +revocation/export enforcement remains separately attributed to the existing +[authenticated integration acceptance](../m4-integrated/acceptance.md). +The supporting model controller suite uses controlled transport and is not +runtime training evidence. + +Local qualification uses PostgreSQL 17.6, Python 3.12.14, Torch 2.8.0+cpu and +headless Chromium with the existing no-sandbox/software rendering flags and +an isolated browser profile. Only preregistered fresh schema +`catalog_8faa508de2e54448925420da15fa406c` is owned here. A local launcher creates +that catalog through normal `Metadata(dataset_id=...)` before executing the +normal app. All authored image data enters through the normal UI. Runtime source trees +remain unchanged. [Exact schema cleanup](schema-cleanup.json) confirms all three +observed Runs completed, the app stopped and only this schema was removed. +This local environment supports the affected browser claim; +GitHub's distro runtime provisioning and downstream package capture/fresh +consumer steps are separate CI claims and are not represented as rerun here. + +The shared lifecycle failure is the canonical author fixture's equality check +against a now-evolved SDK. PR108 owns its separate frozen-source-authority test +repair; root propagates it through the predecessor integration. It is not part +of this repair. No model quality, scientific acceptance or CUDA claim is made. +No remote push, rerun, cancellation or merge is performed by this worker. + +The task-created worktree `/workspace/Tuldok-retained-ci-repair-20261020` is +retained-protected by the named repair branch for root's review/integration. +Root owns its next disposition and safe cleanup after serial acceptance; +unrelated worktrees are outside this worker's ownership. diff --git a/docs/plans/retained-analysis/reports/ci-qualification-20261020/corrected-evidence-1440.jpg b/docs/plans/retained-analysis/reports/ci-qualification-20261020/corrected-evidence-1440.jpg new file mode 100644 index 00000000..db9c45b1 Binary files /dev/null and b/docs/plans/retained-analysis/reports/ci-qualification-20261020/corrected-evidence-1440.jpg differ diff --git a/docs/plans/retained-analysis/reports/ci-qualification-20261020/corrected-evidence-390.jpg b/docs/plans/retained-analysis/reports/ci-qualification-20261020/corrected-evidence-390.jpg new file mode 100644 index 00000000..93040dc5 Binary files /dev/null and b/docs/plans/retained-analysis/reports/ci-qualification-20261020/corrected-evidence-390.jpg differ diff --git a/docs/plans/retained-analysis/reports/ci-qualification-20261020/model-controller.log b/docs/plans/retained-analysis/reports/ci-qualification-20261020/model-controller.log new file mode 100644 index 00000000..97e906b3 --- /dev/null +++ b/docs/plans/retained-analysis/reports/ci-qualification-20261020/model-controller.log @@ -0,0 +1 @@ +PASS model UI: exact frozen probe correction, honest legacy history, observed zero, query ordering, navigation/session exclusion and denied evidence clearing. Controlled transport only. diff --git a/docs/plans/retained-analysis/reports/ci-qualification-20261020/model-development.log b/docs/plans/retained-analysis/reports/ci-qualification-20261020/model-development.log new file mode 100644 index 00000000..ed1b5674 --- /dev/null +++ b/docs/plans/retained-analysis/reports/ci-qualification-20261020/model-development.log @@ -0,0 +1,14 @@ +PASS keyboard navigation reaches honest empty real runs and returns to retained Data +PASS 12 authored independent images imported, labelled and explicitly reviewed using Data controls +PASS invalid held-out class coverage blocks release before training +PASS fixed split preview, exact reviewed source release and immutable ZIP download +PASS Selected checkpoint candidate is retained as diagnostic with separate unfulfilled package and fresh-verifier states +PASS H1 real finite training produces three checkpoint/probe sets; keyboard epoch selection preserves exact example; test remains locked +PASS Root intent precedes actual CPU admission; exact retained parent branches into a second Study, edits and prepares inertly, then trains once without a retry edge +PASS Compatible frozen validation membership supports measured comparison across actual trained models +PASS Interactive lineage retains two Studies, authored hypothesis/goal/change, exact baseline and real completed child outcome after reload +PASS Exact comparison requests bind both evaluations/checkpoints/metric definitions and explicit paired or side-by-side mode +PASS H4 keyboard model-probe correction creates reviewed current revision, new release and trained trial; original evidence is immutable; changed membership refuses paired deltas +PASS H5 delayed query cannot override navigation; denied evidence clears all private Runs content and explicit refresh recovers the exact Run, checkpoints, metrics and retained chart +PASS Automatic dark workspace preference has visible keyboard focus, measured text/focus contrast and bounded 1440/390 evidence layout +PASS real model development gate: /tmp/pr111-ci-repair/qa/model-development/run-XscB4e diff --git a/docs/plans/retained-analysis/reports/ci-qualification-20261020/original-failures.json b/docs/plans/retained-analysis/reports/ci-qualification-20261020/original-failures.json new file mode 100644 index 00000000..d37be50a --- /dev/null +++ b/docs/plans/retained-analysis/reports/ci-qualification-20261020/original-failures.json @@ -0,0 +1,132 @@ +[ + { + "run_id": 39349565476, + "job_id": 118390287531, + "kind": "captured-cpu", + "url": "https://github.com/MrScripty/Tuldok/actions/runs/39349565476", + "head_sha": "beead92d54e33e70eb9df82e872adf14ff314c91", + "created_at": "2026-10-20T00:45:52Z", + "updated_at": "2026-10-20T01:21:53Z", + "conclusion": "failure", + "event": "pull_request", + "checkout": "2026-10-20T01:16:02.0254269Z HEAD is now at e3ac61f Merge beead92d54e33e70eb9df82e872adf14ff314c91 into de5a3a8c8a2767141ac45ffbe8d1bb89c9cf4b70", + "decoded_log_bytes": 57720, + "decoded_log_sha256": "7ef508d44895af471dee68d56c247fbaf97b27881e79ab3f25496bc8216eb77e", + "preserved_decoded_log": "/tmp/pr111-ci-repair/original-job-118390287531.log", + "raw_mcp_response_sha256": "09059eb3650c663fb7c1bd28724817fcb419f528e8954717985c423413fa7cd9", + "raw_mcp_response": "/tmp/pr111-job-118390287531-raw.json", + "run_metadata_sha256": "fbfe1c6828f58b707aee03e921dcad980d0fa649fd9beee03388f088b6fcddde", + "run_metadata": "/tmp/pr111-run-39349565476-metadata.json", + "failure": [ + "2026-10-20T01:18:46.9134170Z PASS Exact comparison requests bind both evaluations/checkpoints/metric definitions and explicit paired or side-by-side mode", + "2026-10-20T01:18:47.0095062Z PASS H4 keyboard model-probe correction creates reviewed current revision, new release and trained trial; original evidence is immutable; changed membership refuses paired deltas", + "2026-10-20T01:21:49.5906705Z Error: Timed out", + "2026-10-20T01:21:49.5910237Z at until (/home/runner/work/Tuldok/Tuldok/tests/browser_model_development.cjs:32:9)", + "2026-10-20T01:21:49.5911768Z at async /home/runner/work/Tuldok/Tuldok/tests/browser_model_development.cjs:556:3", + "2026-10-20T01:21:49.5914426Z Application stderr: ", + "2026-10-20T01:21:49.5947431Z {\"url\":\"http://127.0.0.1:33609/workspaces#runs\",\"status\":\"Evidence access revoked\",\"body\":\"Local owner \u00b7 owner\\nSession\\nSign out\\nSkip to workspace\\nt.\\nTuldok\\n\u25cf Local\\nClassic workbench \u2197\\nCorner studio \u2197\\nCONTEXT\\nDataset\\nInterface fixtures\\nCurrent local catalog\\nOpen project\\n12 exact revisions selected \u00b7 authored-09-circle.png \u00b7 saved state \u00b7 catalog 9e50f02c68fd\\nLocal preview\\n01\\nData\\n02\\nPipeline\\n03\\nRuns\\n\\nEvidence access revoked\\n\\nEVIDENCE, AT EACH STEP\\nRuns\\n\\nReal local runs. Results retain their saved graph and exact admitted inputs. Classification, integrity and external execution receipts retain their own scope and limitations.\\n\\nEvidence access revoked\\n\\nRefresh saved runs\\nOpen Pipeline\\nRun coordinator\\n\\nCurrent coordinator health is unavailable.\\n\\nRefresh coordinator health\\nNo real runs yet\\n\\nSave and validate a recipe in Pipeline, then run it on the local CPU.\\n\\nTuldok \u00b7 Dataset-centered workspaces\\nFixtures are isolated examples. Current catalog runs use an optional local CPU runtime.\",\"frame\":\"nent:ed72938560e04ca12b5de4c86771fe2d2df86da26234ed02d3cda65d34e58282 \u00b7 members: 6b591301df2c4521ab374ac3fa0d4ed71 selected / 1 related records \u00b7 0 deleted sources \u00b7 fixed splits: noneFamily component:f89839597071b285a2bba0e1b187b60dac1188624a0c0b3cb919178310b9e66f \u00b7 members: d645768c965146fa9ec089265b65ed74Warning: Opaque class folders are model indices. Use manifest.json class_vocabulary to recover exact labels. The mapping is frozen per release, not shared automatically across releases.Warning: Exact matches and protected lineage do not establish semantic independence or training quality.Freeze & export ZIPDownload 12-record frozen releaseFreeze selected answersAnswer selection is separate from record selection and collection filters. Select individual answer revisions; edits and newly added answers never replace these fixed pairs.0 answers selectedClear answer selectionDownload fixed answer selectionDownload selection JSONOpen fixed answer selectionTrain %Validation %Test %Answer split seedWhole source families stay together. Percentages weight examples, including multiple answers to one prompt. Draft or stale selections block export. The complete archive is bounded to 40 MiB.Preview selected answersSelect exact reviewed answers to preview.Freeze answers & export ZIPFreeze selected preference pairsSelections retain exact stored judgment, prompt and answer revisions. Reviewed ties and abstentions are excluded with reasons. Stale, draft or conflicting current directional judgments block export. Refresh/rejudge deliberately after edits.Clear selected judgmentsTrain %Validation %Test %Preference split seedWhole source families stay together. Percentages weight emitted pairs; ties and abstentions do not weight splits. 5,000 judgments and 40 MiB per release.Preview selected judgmentsFreeze preference pairs & export ZIP\\nLocal sessionOne-time login codeSign inKeep editsGenerate a private code with python access.py login --data CATALOG --out FILE. Do not share that file.\"}", + "2026-10-20T01:21:49.6327808Z ##[error]Process completed with exit code 1.", + "2026-10-20T01:21:49.6436158Z ##[group]Run actions/upload-artifact@v4" + ] + }, + { + "run_id": 39349515814, + "job_id": 118390126254, + "kind": "captured-cpu", + "url": "https://github.com/MrScripty/Tuldok/actions/runs/39349515814", + "head_sha": "beead92d54e33e70eb9df82e872adf14ff314c91", + "created_at": "2026-10-20T00:45:22Z", + "updated_at": "2026-10-20T01:11:11Z", + "conclusion": "failure", + "event": "pull_request", + "checkout": "2026-10-20T01:06:03.4587376Z HEAD is now at e3ac61f Merge beead92d54e33e70eb9df82e872adf14ff314c91 into de5a3a8c8a2767141ac45ffbe8d1bb89c9cf4b70", + "decoded_log_bytes": 56160, + "decoded_log_sha256": "97dfa1619349a4d4be89a9d8b2c17180175b9cf0ad6703f5fa18e9d1cdb28a53", + "preserved_decoded_log": "/tmp/pr111-ci-repair/original-job-118390126254.log", + "raw_mcp_response_sha256": "f8e95462072ad7981e14703024241285863bf958427d584e69d9d3991ff7a6f6", + "raw_mcp_response": "/tmp/pr111-job-118390126254-raw.json", + "run_metadata_sha256": "56225ff35ee15b1342cc72571617a38004b14720359f65e27e26fd8adb549dc0", + "run_metadata": "/tmp/pr111-run-39349515814-metadata.json", + "failure": [ + "2026-10-20T01:08:04.7732115Z PASS Exact comparison requests bind both evaluations/checkpoints/metric definitions and explicit paired or side-by-side mode", + "2026-10-20T01:08:04.8714745Z PASS H4 keyboard model-probe correction creates reviewed current revision, new release and trained trial; original evidence is immutable; changed membership refuses paired deltas", + "2026-10-20T01:11:06.8901448Z Error: Timed out", + "2026-10-20T01:11:06.8902059Z at until (/home/runner/work/Tuldok/Tuldok/tests/browser_model_development.cjs:32:9)", + "2026-10-20T01:11:06.8902748Z at async /home/runner/work/Tuldok/Tuldok/tests/browser_model_development.cjs:556:3", + "2026-10-20T01:11:06.8903285Z Application stderr: ", + "2026-10-20T01:11:06.8933181Z {\"url\":\"http://127.0.0.1:46829/workspaces#runs\",\"status\":\"Evidence access revoked\",\"body\":\"Local owner \u00b7 owner\\nSession\\nSign out\\nSkip to workspace\\nt.\\nTuldok\\n\u25cf Local\\nClassic workbench \u2197\\nCorner studio \u2197\\nCONTEXT\\nDataset\\nInterface fixtures\\nCurrent local catalog\\nOpen project\\n12 exact revisions selected \u00b7 authored-05-circle.png \u00b7 saved state \u00b7 catalog d035b4817849\\nLocal preview\\n01\\nData\\n02\\nPipeline\\n03\\nRuns\\n\\nEvidence access revoked\\n\\nEVIDENCE, AT EACH STEP\\nRuns\\n\\nReal local runs. Results retain their saved graph and exact admitted inputs. Classification, integrity and external execution receipts retain their own scope and limitations.\\n\\nEvidence access revoked\\n\\nRefresh saved runs\\nOpen Pipeline\\nRun coordinator\\n\\nCurrent coordinator health is unavailable.\\n\\nRefresh coordinator health\\nNo real runs yet\\n\\nSave and validate a recipe in Pipeline, then run it on the local CPU.\\n\\nTuldok \u00b7 Dataset-centered workspaces\\nFixtures are isolated examples. Current catalog runs use an optional local CPU runtime.\",\"frame\":\"nent:f503b2468c16f4fed2e3cf02584cbbdbd1d7401507746f0c8061b0fdee90fabf \u00b7 members: 9db63a7dbc074299aeb96ad80908d9f21 selected / 1 related records \u00b7 0 deleted sources \u00b7 fixed splits: noneFamily component:f5b1dd9a3de1bd7a7afa2c3cbc5f9cbcca319b4bcd0ade5de52622817593c0be \u00b7 members: 5c5bed5adf3742baa00682f5dabd51c4Warning: Opaque class folders are model indices. Use manifest.json class_vocabulary to recover exact labels. The mapping is frozen per release, not shared automatically across releases.Warning: Exact matches and protected lineage do not establish semantic independence or training quality.Freeze & export ZIPDownload 12-record frozen releaseFreeze selected answersAnswer selection is separate from record selection and collection filters. Select individual answer revisions; edits and newly added answers never replace these fixed pairs.0 answers selectedClear answer selectionDownload fixed answer selectionDownload selection JSONOpen fixed answer selectionTrain %Validation %Test %Answer split seedWhole source families stay together. Percentages weight examples, including multiple answers to one prompt. Draft or stale selections block export. The complete archive is bounded to 40 MiB.Preview selected answersSelect exact reviewed answers to preview.Freeze answers & export ZIPFreeze selected preference pairsSelections retain exact stored judgment, prompt and answer revisions. Reviewed ties and abstentions are excluded with reasons. Stale, draft or conflicting current directional judgments block export. Refresh/rejudge deliberately after edits.Clear selected judgmentsTrain %Validation %Test %Preference split seedWhole source families stay together. Percentages weight emitted pairs; ties and abstentions do not weight splits. 5,000 judgments and 40 MiB per release.Preview selected judgmentsFreeze preference pairs & export ZIP\\nLocal sessionOne-time login codeSign inKeep editsGenerate a private code with python access.py login --data CATALOG --out FILE. Do not share that file.\"}", + "2026-10-20T01:11:06.9359130Z ##[error]Process completed with exit code 1.", + "2026-10-20T01:11:06.9432381Z ##[group]Run actions/upload-artifact@v4" + ] + }, + { + "run_id": 39349565452, + "job_id": 118390287291, + "kind": "dataset-lifecycle", + "url": "https://github.com/MrScripty/Tuldok/actions/runs/39349565452", + "head_sha": "beead92d54e33e70eb9df82e872adf14ff314c91", + "created_at": "2026-10-20T00:45:52Z", + "updated_at": "2026-10-20T02:15:14Z", + "conclusion": "failure", + "event": "pull_request", + "checkout": "2026-10-20T00:59:45.3436399Z HEAD is now at e3ac61f Merge beead92d54e33e70eb9df82e872adf14ff314c91 into de5a3a8c8a2767141ac45ffbe8d1bb89c9cf4b70", + "decoded_log_bytes": 248235, + "decoded_log_sha256": "616ee5c44b0b9f06a1cee7376c5fd895cbbf76e29d6490bf9c1d7ec6c128959d", + "preserved_decoded_log": "/tmp/pr111-ci-repair/original-job-118390287291.log", + "raw_mcp_response_sha256": "734046f0552390637e5476d807d581c7d7a967ef46da146953c276cde093544d", + "raw_mcp_response": "/tmp/pr111-job-118390287291-raw.json", + "run_metadata_sha256": "f481d4816a7849ae1f512cc909785013aea47abd28542f986665d02703ddc290", + "run_metadata": "/tmp/pr111-run-39349565452-metadata.json", + "failure": [ + "2026-10-20T02:15:09.5746651Z FAIL: test_new_project_exact_sources_full_catalog_and_model_controls_are_inert (test_extension_canonical_author.CanonicalAuthorTests.test_new_project_exact_sources_full_catalog_and_model_controls_are_inert)", + "2026-10-20T02:15:09.5748130Z ----------------------------------------------------------------------", + "2026-10-20T02:15:09.5748695Z Traceback (most recent call last):", + "2026-10-20T02:15:09.5749933Z File \"/home/runner/work/Tuldok/Tuldok/tests/test_extension_canonical_author.py\", line 79, in test_new_project_exact_sources_full_catalog_and_model_controls_are_inert", + "2026-10-20T02:15:09.5751724Z self.assertEqual((PACKAGE/'tuldok_extension_sdk'/name).read_bytes(),(Path(__file__).resolve().parents[1]/'tuldok_extension_sdk'/name).read_bytes())", + "2026-10-20T02:15:09.5753637Z AssertionError: b'\"\"\"[18141 chars]]\\n\\n\\n@boundary\\ndef validate_projection(valu[6164 chars]')\\n' != b'\"\"\"[18141 chars]]\\n\\n @boundary\\n def diagnostics(self, [6665 chars]')\\n'", + "2026-10-20T02:15:09.5754329Z ", + "2026-10-20T02:15:09.5754584Z ----------------------------------------------------------------------", + "2026-10-20T02:15:09.5754999Z Ran 1771 tests in 2857.629s", + "2026-10-20T02:15:09.5755166Z ", + "2026-10-20T02:15:09.5755325Z FAILED (failures=1, skipped=83)", + "2026-10-20T02:15:09.5767684Z INDEXED_DIAGNOSTIC_QUALIFICATION {\"accounting_and_events_unchanged\": true, \"artifacts\": [{\"bytes\": 948, \"media_type\": \"application/octet-stream\", \"name\": \"diagnostic-index.json\", \"role\": \"diagnostic_index_v1\", \"sha256\": \"44cbf1666b4766cb6b9228c98fc470ec713b906cfc32237dc56f873346b9142e\"}, {\"bytes\": 983, \"media_type\": \"application/octet-stream\", \"name\": \"diagnostic-0.json\", \"role\": \"diagnostic_shard_v1\", \"sha256\": \"0f33a7857dc7581f5a09d8474ca04f9ac5885e2972a2b1741f62e96d0de88b07\"}, {\"bytes\": 443, \"media_type\": \"application/octet-stream\", \"name\": \"diagnostic-1.json\", \"role\": \"diagnostic_shard_v1\", \"sha256\": \"675191758d32bca9a9c25e838346277bcefe4f5bbe68aaacd08d4b92f32ccdd8\"}], \"captured_python_producer_executed\": false, \"composed_readers\": {\"batch_calls\": 1, \"batch_collected_exact_artifacts\": [\"diagnostic-index.json\", \"diagnostic-0.json\", \"diagnostic-1.json\"], \"comparison\": \"same exact Ref diagnostic delta zero; no scientific acceptance\", \"individual_segment_calls\": 0}, \"counts_after\": {\"access_execution_consumptions\": 1, \"access_execution_grants\": 1, \"model_attempt_reservations\": 1, \"workspace_graphs\": 1, \"workspace_runs\": 1}, \"counts_before\": {\"access_execution_consumptions\": 1, \"access_execution_grants\": 1, \"model_attempt_reservations\": 1, \"workspace_graphs\": 1, \"workspace_runs\": 1}, \"coverage\": {\"omitted\": [{\"count\": 1, \"reason\": \"capture_budget\", \"start\": 2}], \"omitted_count\": 1, \"optional_count\": 3, \"required_count\": 2, \"retained_optional_count\": 2, \"retained_required_count\": 2, \"total_count\": 5}, \"custody_outcome\": \"completed\", \"numerical_acceptance\": \"not_evaluated\", \"original_state\": \"interrupted\", \"result_ref\": {\"catalog_id\": \"f8954cca18804647b1ae12c680ddb015\", \"custody_receipt_sha256\": \"d97860c24a71974141971b7d2ba9ca41d9a87206ff900e8bfb4becc9f17d159b\", \"inventory_sha256\": \"dba11f7c64fba5cd6dc7ce6994193145c86f045c3a0a2b0f41f9ee26f2b93c75\", \"kind\": \"recovered_publication_result\", \"material_sha256\": \"302f8642743dac36b62280f726733e1893dc94089201d92d17f98c25e2be63fb\", \"run_id\": \"7e14bf527d114f00bbf7d103dfbb9a51\", \"schema_version\": 1, \"sha256\": \"8b0c1bdb9c0554ce2ad75bf3771d8b61e979f0e34060d402c32304f6a2a117d4\"}, \"run_id\": \"7e14bf527d114f00bbf7d103dfbb9a51\", \"runtime_packages\": {\"numpy\": \"0.0\", \"torch\": \"0.0\"}, \"runtime_snapshot_sha256\": \"284d6e5bf4da87a42b80175720e7e3c6213c906b684dfed4a16f212b61b81d22\", \"schema\": \"catalog_f8954cca18804647b1ae12c680ddb015\", \"scope\": \"harness SDK serialization; actual no-op metadata runtime custody and semantic recovery\", \"training_executed\": false, \"verification_scope\": \"source_destination_and_cold_exact_ref_reader\"}", + "2026-10-20T02:15:09.5776919Z Removed exact recorded fresh schema: catalog_f8954cca18804647b1ae12c680ddb015", + "2026-10-20T02:15:09.7284731Z ##[error]Process completed with exit code 1." + ] + }, + { + "run_id": 39349515815, + "job_id": 118390126097, + "kind": "dataset-lifecycle", + "url": "https://github.com/MrScripty/Tuldok/actions/runs/39349515815", + "head_sha": "beead92d54e33e70eb9df82e872adf14ff314c91", + "created_at": "2026-10-20T00:45:22Z", + "updated_at": "2026-10-20T01:39:08Z", + "conclusion": "failure", + "event": "pull_request", + "checkout": "2026-10-20T00:54:49.0102114Z HEAD is now at e3ac61f Merge beead92d54e33e70eb9df82e872adf14ff314c91 into de5a3a8c8a2767141ac45ffbe8d1bb89c9cf4b70", + "decoded_log_bytes": 245509, + "decoded_log_sha256": "b077b531c5d646a915642b39fcb1c1939369e836b7fe7f518b6065f80ec41763", + "preserved_decoded_log": "/tmp/pr111-ci-repair/original-job-118390126097.log", + "raw_mcp_response_sha256": "e6a7c503a7bc1c0f3ed3b80dbb21702cdc447528f9257fafd05b2f2100d8504e", + "raw_mcp_response": "/tmp/pr111-job-118390126097-raw.json", + "run_metadata_sha256": "3740017b39d6b9652372fff34c88b1086486290bd17bdc33391c4b54a4214ff1", + "run_metadata": "/tmp/pr111-run-39349515815-metadata.json", + "failure": [ + "2026-10-20T01:39:03.5200676Z FAIL: test_new_project_exact_sources_full_catalog_and_model_controls_are_inert (test_extension_canonical_author.CanonicalAuthorTests.test_new_project_exact_sources_full_catalog_and_model_controls_are_inert)", + "2026-10-20T01:39:03.5201544Z ----------------------------------------------------------------------", + "2026-10-20T01:39:03.5201885Z Traceback (most recent call last):", + "2026-10-20T01:39:03.5202621Z File \"/home/runner/work/Tuldok/Tuldok/tests/test_extension_canonical_author.py\", line 79, in test_new_project_exact_sources_full_catalog_and_model_controls_are_inert", + "2026-10-20T01:39:03.5203607Z self.assertEqual((PACKAGE/'tuldok_extension_sdk'/name).read_bytes(),(Path(__file__).resolve().parents[1]/'tuldok_extension_sdk'/name).read_bytes())", + "2026-10-20T01:39:03.5204683Z AssertionError: b'\"\"\"[18141 chars]]\\n\\n\\n@boundary\\ndef validate_projection(valu[6164 chars]')\\n' != b'\"\"\"[18141 chars]]\\n\\n @boundary\\n def diagnostics(self, [6665 chars]')\\n'", + "2026-10-20T01:39:03.5205205Z ", + "2026-10-20T01:39:03.5205407Z ----------------------------------------------------------------------", + "2026-10-20T01:39:03.5205717Z Ran 1771 tests in 1759.736s", + "2026-10-20T01:39:03.5205859Z ", + "2026-10-20T01:39:03.5205983Z FAILED (failures=1, skipped=83)", + "2026-10-20T01:39:03.6296286Z ##[error]Process completed with exit code 1.", + "2026-10-20T01:39:03.6552564Z ##[group]Run actions/upload-artifact@v4", + "2026-10-20T01:39:03.6552726Z with:" + ] + } +] diff --git a/docs/plans/retained-analysis/reports/ci-qualification-20261020/qualification.json b/docs/plans/retained-analysis/reports/ci-qualification-20261020/qualification.json new file mode 100644 index 00000000..9366b91c --- /dev/null +++ b/docs/plans/retained-analysis/reports/ci-qualification-20261020/qualification.json @@ -0,0 +1,62 @@ +{ + "base_commit": "beead92d54e33e70eb9df82e872adf14ff314c91", + "observed_at": "2026-10-20T02:36:44Z", + "browser": "Chrome/151.0.7922.173", + "python": "3.12.14 (main, Aug 25 2026, 14:00:49) [Clang 22.1.3 ]", + "node": "v24.19.0", + "kernel": "Linux-6.18.55-x86_64-with-glibc2.41", + "headless": true, + "browser_flags": [ + "--no-sandbox", + "--disable-gpu" + ], + "display": "headless; isolated temporary profile", + "sandbox": "selected managed workspace sandbox", + "shared_memory_bytes": 9441337344, + "full_qa": "/tmp/pr111-ci-repair/qa/model-development/run-XscB4e", + "source_sha256": { + "static/workspace-service.js": "568b8258c35e6b3ca2cfe08b64d914111e16ae98d45f5d40f7aa40a20c20098b", + "static/workspace-real.js": "de4036bab21c3ca2702488658a9fa8733cf0adb822f4ec3322d5e101a96b60a2", + "static/experiment-lineage.js": "085ee3cc990f1986db357e1e8f7bace0c16a2257bca9443ff412c464d91a53db", + "static/experiment-lineage.css": "232fec3043b92ae7aa91db499a14e8cdb9ebe5598c8d7f01d805e3e3d8d4859d", + "static/workspaces.css": "3d0eacbd50425b4cd2ce9cfacdf5bcdb8fe533d7a57248f16325242f625cd278", + "static/workspaces.html": "a85e465d317e8aaa14c5349ef1ae6b2dc75ac440e0cea2c5c5a313dbd4fb828e", + "experiment_lineage.py": "5cdac7aec893bff832406b44ae04af587118990b1b803ec11cea1458d8ed3234", + "agent_api.py": "bb14a25c63840f1701b13657fa1bce4659a2c6a180068e95f461e5fa7f9327b4", + "app.py": "c71b8b903fa8905ff5fd3ccaef1b86d3df3ddda5393f33bf3ec9661a98d02417", + "experiments.py": "05c88fa658408c7750aecda37461abfec54537c8b9dbe6143ea90313b72420df", + "pipeline.py": "07f5b491767941bf68668da8e82282b78858fe310e9ec74c6d91a8e38534faeb", + "runs.py": "b701532d0bf5c77ee87676fa3bbfbf9759ae45370c28d45765b2eac538a4547e", + "metadata.py": "893d489f8e5d323ac1eed61350d206bbc1c0375801402f52cc586ac8423d62e4", + "upgrade_metadata.py": "f78f6113b3687d808536f873153c83893ed91bf1e247986b29ac00d4c226af8f", + "tests/browser_model_development.cjs": "b52c9355398a8862225b665fc379fde4916a2c6d265e371e2386832144b48d6e" + }, + "checks": [ + "keyboard navigation reaches honest empty real runs and returns to retained Data", + "12 authored independent images imported, labelled and explicitly reviewed using Data controls", + "invalid held-out class coverage blocks release before training", + "fixed split preview, exact reviewed source release and immutable ZIP download", + "Selected checkpoint candidate is retained as diagnostic with separate unfulfilled package and fresh-verifier states", + "H1 real finite training produces three checkpoint/probe sets; keyboard epoch selection preserves exact example; test remains locked", + "Root intent precedes actual CPU admission; exact retained parent branches into a second Study, edits and prepares inertly, then trains once without a retry edge", + "Compatible frozen validation membership supports measured comparison across actual trained models", + "Interactive lineage retains two Studies, authored hypothesis/goal/change, exact baseline and real completed child outcome after reload", + "Exact comparison requests bind both evaluations/checkpoints/metric definitions and explicit paired or side-by-side mode", + "H4 keyboard model-probe correction creates reviewed current revision, new release and trained trial; original evidence is immutable; changed membership refuses paired deltas", + "H5 delayed query cannot override navigation; denied evidence clears all private Runs content and explicit refresh recovers the exact Run, checkpoints, metrics and retained chart", + "Automatic dark workspace preference has visible keyboard focus, measured text/focus contrast and bounded 1440/390 evidence layout" + ], + "training": true, + "private_projection": { + "status": "Evidence access revoked", + "privateNodes": 0 + }, + "restored_projection": { + "run_id": "b14204732d8740babe198a5cb1fe2779", + "checkpoint_count": 2, + "retained_chart": true + }, + "app_stopped": true, + "scope": "Actual app/HTTP/PostgreSQL native classifier browser; no model-quality or downstream package-capture claim", + "injected_denial_status": 403 +} diff --git a/docs/plans/retained-analysis/reports/ci-qualification-20261020/receipt.json b/docs/plans/retained-analysis/reports/ci-qualification-20261020/receipt.json new file mode 100644 index 00000000..7675907f --- /dev/null +++ b/docs/plans/retained-analysis/reports/ci-qualification-20261020/receipt.json @@ -0,0 +1,528 @@ +{ + "source_commit": "beead92d54e33e70eb9df82e872adf14ff314c91", + "dirty": true, + "command": "node tests/browser_model_development.cjs", + "source_sha256": { + "static/workspace-service.js": "568b8258c35e6b3ca2cfe08b64d914111e16ae98d45f5d40f7aa40a20c20098b", + "static/workspace-real.js": "de4036bab21c3ca2702488658a9fa8733cf0adb822f4ec3322d5e101a96b60a2", + "static/experiment-lineage.js": "085ee3cc990f1986db357e1e8f7bace0c16a2257bca9443ff412c464d91a53db", + "static/experiment-lineage.css": "232fec3043b92ae7aa91db499a14e8cdb9ebe5598c8d7f01d805e3e3d8d4859d", + "static/workspaces.css": "3d0eacbd50425b4cd2ce9cfacdf5bcdb8fe533d7a57248f16325242f625cd278", + "static/workspaces.html": "a85e465d317e8aaa14c5349ef1ae6b2dc75ac440e0cea2c5c5a313dbd4fb828e", + "experiment_lineage.py": "5cdac7aec893bff832406b44ae04af587118990b1b803ec11cea1458d8ed3234", + "agent_api.py": "bb14a25c63840f1701b13657fa1bce4659a2c6a180068e95f461e5fa7f9327b4", + "app.py": "c71b8b903fa8905ff5fd3ccaef1b86d3df3ddda5393f33bf3ec9661a98d02417", + "experiments.py": "05c88fa658408c7750aecda37461abfec54537c8b9dbe6143ea90313b72420df", + "pipeline.py": "07f5b491767941bf68668da8e82282b78858fe310e9ec74c6d91a8e38534faeb", + "runs.py": "b701532d0bf5c77ee87676fa3bbfbf9759ae45370c28d45765b2eac538a4547e", + "metadata.py": "893d489f8e5d323ac1eed61350d206bbc1c0375801402f52cc586ac8423d62e4", + "upgrade_metadata.py": "f78f6113b3687d808536f873153c83893ed91bf1e247986b29ac00d4c226af8f", + "tests/browser_model_development.cjs": "b52c9355398a8862225b665fc379fde4916a2c6d265e371e2386832144b48d6e" + }, + "dark_checks": [ + { + "width": 1440, + "dark": true, + "focus": "model-checkpoint-646b11aa9ef1cf77f2444e5f32cf6ffae7321c3e223c2110bc5d85b7c482937f", + "outline": "solid", + "outlineWidth": "3px", + "outlineColor": "rgb(158, 198, 255)", + "text": "rgb(229, 237, 248)", + "background": "rgb(12, 20, 32)", + "textContrast": 15.662057908741831, + "focusContrast": 10.536654698975951 + }, + { + "width": 390, + "dark": true, + "focus": "model-checkpoint-646b11aa9ef1cf77f2444e5f32cf6ffae7321c3e223c2110bc5d85b7c482937f", + "outline": "solid", + "outlineWidth": "3px", + "outlineColor": "rgb(158, 198, 255)", + "text": "rgb(229, 237, 248)", + "background": "rgb(12, 20, 32)", + "textContrast": 15.662057908741831, + "focusContrast": 10.536654698975951 + } + ], + "catalog_path": "/tmp/tuldok-model-development-ESKMk7/data", + "browser": "Chrome/151.0.7922.173", + "checks": [ + "keyboard navigation reaches honest empty real runs and returns to retained Data", + "12 authored independent images imported, labelled and explicitly reviewed using Data controls", + "invalid held-out class coverage blocks release before training", + "fixed split preview, exact reviewed source release and immutable ZIP download", + "Selected checkpoint candidate is retained as diagnostic with separate unfulfilled package and fresh-verifier states", + "H1 real finite training produces three checkpoint/probe sets; keyboard epoch selection preserves exact example; test remains locked", + "Root intent precedes actual CPU admission; exact retained parent branches into a second Study, edits and prepares inertly, then trains once without a retry edge", + "Compatible frozen validation membership supports measured comparison across actual trained models", + "Interactive lineage retains two Studies, authored hypothesis/goal/change, exact baseline and real completed child outcome after reload", + "Exact comparison requests bind both evaluations/checkpoints/metric definitions and explicit paired or side-by-side mode", + "H4 keyboard model-probe correction creates reviewed current revision, new release and trained trial; original evidence is immutable; changed membership refuses paired deltas", + "H5 delayed query cannot override navigation; denied evidence clears all private Runs content and explicit refresh recovers the exact Run, checkpoints, metrics and retained chart", + "Automatic dark workspace preference has visible keyboard focus, measured text/focus contrast and bounded 1440/390 evidence layout" + ], + "captures": [ + { + "file": "catalog-data-1440.jpg", + "width": 1440, + "height": 900, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "catalog-data-390.jpg", + "width": 390, + "height": 844, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "prepared-First TinyCNN-1440.jpg", + "width": 1440, + "height": 900, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "prepared-First TinyCNN-390.jpg", + "width": 390, + "height": 844, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "lineage-root-1440.jpg", + "width": 1440, + "height": 900, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "lineage-root-390.jpg", + "width": 390, + "height": 844, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "linked-evidence-1440.jpg", + "width": 1440, + "height": 900, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "linked-evidence-390.jpg", + "width": 390, + "height": 844, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "lineage-prepared-branch-1440.jpg", + "width": 1440, + "height": 900, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "lineage-prepared-branch-390.jpg", + "width": 390, + "height": 844, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "lineage-two-studies-1440.jpg", + "width": 1440, + "height": 900, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "lineage-two-studies-390.jpg", + "width": 390, + "height": 844, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "lineage-detail-completed-1440.jpg", + "width": 1440, + "height": 900, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "lineage-detail-completed-390.jpg", + "width": 390, + "height": 844, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "current-correction-1440.jpg", + "width": 1440, + "height": 900, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "prepared-Corrected TinyCNN-1440.jpg", + "width": 1440, + "height": 900, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "prepared-Corrected TinyCNN-390.jpg", + "width": 390, + "height": 844, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "corrected-evidence-390.jpg", + "width": 390, + "height": 844, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "corrected-evidence-1440.jpg", + "width": 1440, + "height": 900, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "dark-linked-evidence-1440.jpg", + "width": 1440, + "height": 900, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "dark-linked-evidence-390.jpg", + "width": 390, + "height": 844, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "lineage-dark-two-studies-1440.jpg", + "width": 1440, + "height": 900, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "lineage-detail-dark-1440.jpg", + "width": 1440, + "height": 900, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "lineage-dark-two-studies-390.jpg", + "width": 390, + "height": 844, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + }, + { + "file": "lineage-detail-dark-390.jpg", + "width": 390, + "height": 844, + "mode": "real execution on explicitly authored CC0 inputs; no model-quality claim", + "quality": 85 + } + ], + "lineage": { + "parent_before_admission": { + "attempt_count": 0, + "lineage": { + "actor_id": "cb39e89a7e904dbb9d0138ac5a43f088", + "format": "trial_lineage_v1", + "intent": { + "ancestry": "root", + "baseline": null, + "change_summary": "Root: three actual CPU epochs with frozen authored validation membership.", + "cohort": "Authored same-release CPU lineage", + "hypothesis": "Changing the finite trainer schedule preserves exact validation membership.", + "parent": null, + "target": { + "acceptance": "Diagnostic workflow fixture: inspect exact validation evidence; no model-quality claim.", + "direction": "minimize", + "metric_definition_sha256": null, + "metric_id": "loss", + "threshold": 0.5 + } + }, + "recorded_at": "2026-10-20T02:34:28.680041+00:00", + "timing": "before_admission", + "trial": { + "catalog_id": "8faa508de2e54448925420da15fa406c", + "material_sha256": "ce261f61190d0083c6a819f83c9adffc836c73ef8d3dd1aed1a60397cd92d1ae", + "trial_id": "c3a2131c37dc4c16ab458914a48597ee" + } + }, + "model": { + "catalog_id": "8faa508de2e54448925420da15fa406c", + "id": "44cfa2b5c6754ddca6b2894432697b6a", + "kind": "model", + "revision": 1, + "sha256": "47f2923c3cdc124cd8338533fb280367601d51fd4ea8f2904172e7c8f5cd1ade" + }, + "recipe": { + "id": "3d1ce71e8fa04031b402fb14fded4584", + "revision": 2 + }, + "runs": [], + "runs_truncated": false, + "study": { + "id": "11bdcd83c37c4446b8ce6a7c7a486f25", + "name": "First TinyCNN" + }, + "trial": { + "format": "trial_v1", + "id": "c3a2131c37dc4c16ab458914a48597ee", + "material": { + "catalog_id": "8faa508de2e54448925420da15fa406c", + "id": "ce261f61190d0083c6a819f83c9adffc836c73ef8d3dd1aed1a60397cd92d1ae", + "kind": "recipe_material", + "sha256": "ce261f61190d0083c6a819f83c9adffc836c73ef8d3dd1aed1a60397cd92d1ae" + }, + "replicate": 0, + "study_id": "11bdcd83c37c4446b8ce6a7c7a486f25" + } + }, + "child_before_admission": { + "attempt_count": 0, + "lineage": { + "actor_id": "cb39e89a7e904dbb9d0138ac5a43f088", + "format": "trial_lineage_v1", + "intent": { + "ancestry": "derived", + "baseline": { + "catalog_id": "8faa508de2e54448925420da15fa406c", + "material_sha256": "ce261f61190d0083c6a819f83c9adffc836c73ef8d3dd1aed1a60397cd92d1ae", + "trial_id": "c3a2131c37dc4c16ab458914a48597ee" + }, + "change_summary": "Derived branch: two epochs and seed 23; unchanged frozen Model and validation population.", + "cohort": "Authored same-release CPU lineage", + "hypothesis": "Changing the finite trainer schedule preserves exact validation membership.", + "parent": { + "catalog_id": "8faa508de2e54448925420da15fa406c", + "material_sha256": "ce261f61190d0083c6a819f83c9adffc836c73ef8d3dd1aed1a60397cd92d1ae", + "trial_id": "c3a2131c37dc4c16ab458914a48597ee" + }, + "target": { + "acceptance": "Diagnostic workflow fixture: inspect exact validation evidence; no model-quality claim.", + "direction": "minimize", + "metric_definition_sha256": null, + "metric_id": "loss", + "threshold": 0.5 + } + }, + "recorded_at": "2026-10-20T02:35:02.793059+00:00", + "timing": "before_admission", + "trial": { + "catalog_id": "8faa508de2e54448925420da15fa406c", + "material_sha256": "ed07a8901949d2246b46daf8585bb65a5006e676fe3c13e47a9cc0ea9c2d9f31", + "trial_id": "246f2d57f3b844dabb5959c75a928b36" + } + }, + "model": { + "catalog_id": "8faa508de2e54448925420da15fa406c", + "id": "44cfa2b5c6754ddca6b2894432697b6a", + "kind": "model", + "revision": 1, + "sha256": "47f2923c3cdc124cd8338533fb280367601d51fd4ea8f2904172e7c8f5cd1ade" + }, + "recipe": { + "id": "bf74a20bbad24f1693c5ee1ce22e5b99", + "revision": 2 + }, + "runs": [], + "runs_truncated": false, + "study": { + "id": "54dc40b1dd5e4a5d9e1464adc157e52b", + "name": "Separate CPU branch Study" + }, + "trial": { + "format": "trial_v1", + "id": "246f2d57f3b844dabb5959c75a928b36", + "material": { + "catalog_id": "8faa508de2e54448925420da15fa406c", + "id": "ed07a8901949d2246b46daf8585bb65a5006e676fe3c13e47a9cc0ea9c2d9f31", + "kind": "recipe_material", + "sha256": "ed07a8901949d2246b46daf8585bb65a5006e676fe3c13e47a9cc0ea9c2d9f31" + }, + "replicate": 0, + "study_id": "54dc40b1dd5e4a5d9e1464adc157e52b" + } + }, + "parent_run_id": "f0f1b8a599044db19c8734c81fc78c59", + "child_run_id": "29e102331db74dbc8c3e39cdba2149d5", + "child_completed": { + "attempt_count": 1, + "lineage": { + "actor_id": "cb39e89a7e904dbb9d0138ac5a43f088", + "format": "trial_lineage_v1", + "intent": { + "ancestry": "derived", + "baseline": { + "catalog_id": "8faa508de2e54448925420da15fa406c", + "material_sha256": "ce261f61190d0083c6a819f83c9adffc836c73ef8d3dd1aed1a60397cd92d1ae", + "trial_id": "c3a2131c37dc4c16ab458914a48597ee" + }, + "change_summary": "Derived branch: two epochs and seed 23; unchanged frozen Model and validation population.", + "cohort": "Authored same-release CPU lineage", + "hypothesis": "Changing the finite trainer schedule preserves exact validation membership.", + "parent": { + "catalog_id": "8faa508de2e54448925420da15fa406c", + "material_sha256": "ce261f61190d0083c6a819f83c9adffc836c73ef8d3dd1aed1a60397cd92d1ae", + "trial_id": "c3a2131c37dc4c16ab458914a48597ee" + }, + "target": { + "acceptance": "Diagnostic workflow fixture: inspect exact validation evidence; no model-quality claim.", + "direction": "minimize", + "metric_definition_sha256": null, + "metric_id": "loss", + "threshold": 0.5 + } + }, + "recorded_at": "2026-10-20T02:35:02.793059+00:00", + "timing": "before_admission", + "trial": { + "catalog_id": "8faa508de2e54448925420da15fa406c", + "material_sha256": "ed07a8901949d2246b46daf8585bb65a5006e676fe3c13e47a9cc0ea9c2d9f31", + "trial_id": "246f2d57f3b844dabb5959c75a928b36" + } + }, + "model": { + "catalog_id": "8faa508de2e54448925420da15fa406c", + "id": "44cfa2b5c6754ddca6b2894432697b6a", + "kind": "model", + "revision": 1, + "sha256": "47f2923c3cdc124cd8338533fb280367601d51fd4ea8f2904172e7c8f5cd1ade" + }, + "recipe": { + "id": "bf74a20bbad24f1693c5ee1ce22e5b99", + "revision": 2 + }, + "runs": [ + { + "created_at": "2026-10-20T02:35:07.967528+00:00", + "finished_at": "2026-10-20T02:35:23.440120+00:00", + "id": "29e102331db74dbc8c3e39cdba2149d5", + "parent_run_id": null, + "state": "completed", + "validation": { + "accuracy": 0.3333333333333333, + "loss": 0.7301838397979736, + "macro_f1": 0.25 + } + } + ], + "runs_truncated": false, + "study": { + "id": "54dc40b1dd5e4a5d9e1464adc157e52b", + "name": "Separate CPU branch Study" + }, + "trial": { + "format": "trial_v1", + "id": "246f2d57f3b844dabb5959c75a928b36", + "material": { + "catalog_id": "8faa508de2e54448925420da15fa406c", + "id": "ed07a8901949d2246b46daf8585bb65a5006e676fe3c13e47a9cc0ea9c2d9f31", + "kind": "recipe_material", + "sha256": "ed07a8901949d2246b46daf8585bb65a5006e676fe3c13e47a9cc0ea9c2d9f31" + }, + "replicate": 0, + "study_id": "54dc40b1dd5e4a5d9e1464adc157e52b" + } + }, + "dark_checks": [ + { + "width": 1440, + "text": "rgb(229, 237, 248)", + "background": "rgb(21, 30, 45)", + "outline": "solid", + "outlineWidth": "3px", + "outlineColor": "rgb(56, 107, 206)", + "textContrast": 14.178348680001829, + "focusContrast": 3.315425185528663 + }, + { + "width": 390, + "text": "rgb(229, 237, 248)", + "background": "rgb(21, 30, 45)", + "outline": "solid", + "outlineWidth": "3px", + "outlineColor": "rgb(56, 107, 206)", + "textContrast": 14.178348680001829, + "focusContrast": 3.315425185528663 + } + ] + }, + "compare_selectors": [ + { + "other_run_id": "f0f1b8a599044db19c8734c81fc78c59", + "checkpoint_sha256": "c700a7e3866266b644f2ddbf2e69fa0d5230b32a76b0697ac37b225189d86db0", + "other_checkpoint_sha256": "50236279861b2280d34e0875e6e671f5cb6cb8c4c56e54c9dd2d367a2f40b9bb", + "evaluation_sha256": "a68bcab9ce163d6dd4f02ba691fe3bf08a882641fb9f497b359d9333cb72802f", + "other_evaluation_sha256": "016692bef7dd714c1ba7f2b3d7db8a0e38db59745176011ee6b3151e8fca8860", + "metric_id": "loss", + "metric_definition_sha256": "ffb7e85d94549dee93f799571ef73b2db74d61b37cf20019994f663b1d69392e", + "other_metric_definition_sha256": "ffb7e85d94549dee93f799571ef73b2db74d61b37cf20019994f663b1d69392e", + "mode": "paired" + }, + { + "other_run_id": "f0f1b8a599044db19c8734c81fc78c59", + "checkpoint_sha256": "4e7207afbfd9ae78f0c0c419a1273aa6ab2644d434369f75ce3570cc74a5d059", + "other_checkpoint_sha256": "50236279861b2280d34e0875e6e671f5cb6cb8c4c56e54c9dd2d367a2f40b9bb", + "evaluation_sha256": "0f30c63f5e6c00a8eb7cf90171c803bc1c5d1fe99ab6539817c087a8096d7b3f", + "other_evaluation_sha256": "016692bef7dd714c1ba7f2b3d7db8a0e38db59745176011ee6b3151e8fca8860", + "metric_id": "loss", + "metric_definition_sha256": "4bb2d60d944786b533939c5d7d53e0ab30f03ee049e902734b6345cc500fd73f", + "other_metric_definition_sha256": "ffb7e85d94549dee93f799571ef73b2db74d61b37cf20019994f663b1d69392e", + "mode": "paired" + }, + { + "other_run_id": "f0f1b8a599044db19c8734c81fc78c59", + "checkpoint_sha256": "4e7207afbfd9ae78f0c0c419a1273aa6ab2644d434369f75ce3570cc74a5d059", + "other_checkpoint_sha256": "50236279861b2280d34e0875e6e671f5cb6cb8c4c56e54c9dd2d367a2f40b9bb", + "evaluation_sha256": "0f30c63f5e6c00a8eb7cf90171c803bc1c5d1fe99ab6539817c087a8096d7b3f", + "other_evaluation_sha256": "016692bef7dd714c1ba7f2b3d7db8a0e38db59745176011ee6b3151e8fca8860", + "metric_id": "loss", + "metric_definition_sha256": "4bb2d60d944786b533939c5d7d53e0ab30f03ee049e902734b6345cc500fd73f", + "other_metric_definition_sha256": "ffb7e85d94549dee93f799571ef73b2db74d61b37cf20019994f663b1d69392e", + "mode": "side_by_side" + } + ], + "run_ids": [ + "f0f1b8a599044db19c8734c81fc78c59", + "29e102331db74dbc8c3e39cdba2149d5", + "b14204732d8740babe198a5cb1fe2779" + ], + "release_ids": [ + "4024b110e8fc453bc2376cef4c416d89af29a7e4fa887569d43764989ec04b27", + "5c417159660a0a0ea20d23857f2ce5d01fe7ebb794d8627c525c1c6106f68601" + ], + "training": true, + "quality_claim": false, + "fixture_provenance": "12 CC0 authored independent images imported and reviewed through ordinary Data UI", + "access_projection_test": "403 transport substitution; backend tests own actual revoke enforcement", + "denied_projection": { + "status": "Evidence access revoked", + "privateNodes": 0 + }, + "recovered_projection": { + "run_id": "b14204732d8740babe198a5cb1fe2779", + "checkpoint_count": 2, + "retained_chart": true + } +} \ No newline at end of file diff --git a/docs/plans/retained-analysis/reports/ci-qualification-20261020/schema-cleanup.json b/docs/plans/retained-analysis/reports/ci-qualification-20261020/schema-cleanup.json new file mode 100644 index 00000000..e1afc379 --- /dev/null +++ b/docs/plans/retained-analysis/reports/ci-qualification-20261020/schema-cleanup.json @@ -0,0 +1,25 @@ +{ + "schema": "catalog_8faa508de2e54448925420da15fa406c", + "dataset_id": "8faa508de2e54448925420da15fa406c", + "reserved_before_creation": true, + "expected_owner": "tuldok_task", + "app_stopped_before_drop": true, + "observed_runs": [ + { + "id": "29e102331db74dbc8c3e39cdba2149d5", + "state": "completed" + }, + { + "id": "b14204732d8740babe198a5cb1fe2779", + "state": "completed" + }, + { + "id": "f0f1b8a599044db19c8734c81fc78c59", + "state": "completed" + } + ], + "scope": "only exact preregistered task-owned fresh schema", + "removed": true, + "observed_at": "2026-10-20T02:37:29.683141+00:00", + "local_catalog_directory": "retained inert under /tmp; PostgreSQL schema removed" +} diff --git a/docs/plans/retained-analysis/reports/ci-qualification-20261020/schema-reservation.json b/docs/plans/retained-analysis/reports/ci-qualification-20261020/schema-reservation.json new file mode 100644 index 00000000..d9e0feaf --- /dev/null +++ b/docs/plans/retained-analysis/reports/ci-qualification-20261020/schema-reservation.json @@ -0,0 +1,8 @@ +{ + "schema": "catalog_8faa508de2e54448925420da15fa406c", + "dataset_id": "8faa508de2e54448925420da15fa406c", + "owner": "PR111 CI qualification", + "state": "created-by-normal-Metadata", + "server": "PostgreSQL 17.6 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit", + "catalog_path": "/tmp/tuldok-model-development-ESKMk7/data" +} diff --git a/docs/plans/retained-analysis/reports/independent-review.md b/docs/plans/retained-analysis/reports/independent-review.md new file mode 100644 index 00000000..631908b4 --- /dev/null +++ b/docs/plans/retained-analysis/reports/independent-review.md @@ -0,0 +1,39 @@ +# Independent review + +Reviewer: separate GPT-6.1 Sol instance, high reasoning, read-only code/tests. +Final disposition: no remaining blocking findings in additive query or isolated +renderer. No review-side files or credentials created. + +Findings closed before final review: + +1. Plan overstated semantic identity rejection before evidence reads. Narrowed + acceptance to malformed identity rejection before reads and exact semantic + rejection before return. Added early size-bounded evaluation check before + expensive inherited verification, repeated inside final SQL snapshot. +2. Early malformed Run-envelope preflight could raise raw TypeError/KeyError. + Added typed unavailable409 mapping and isolated malformed-envelope cases. +3. Browser decoder accepted mismatched supports/ordinals and missing provenance, + metric definition or column types. Enforced relationships and complete used + fields; each malformed variant now reaches and fails that boundary. +4. Browser fixture could interact before Vega embed settled. Waits include busy + completion; keyboard and actual SVG pointer paths are exercised separately. + +Final independent checks: 12 Python fixture tests pass, one PostgreSQL SQL test +skips; actual headless Chromium fixture passes, including bad-spec cancellation. +Reviewer verified asset hashes and notice-file presence. Spec stream cancellation, +update abort/busy cleanup and owned child-process exit were reviewed in final code. + +Reviewed SHA256: + +| File | SHA256 | +| --- | --- | +| retained_analysis.py | 317ba63b0f89367ba26dd62b8157910654943eb8a9d3ab1442f09f09827f218b | +| tests/test_retained_analysis.py | 10ab4c7ad35c9df868320add066799a18896538ee59593156d4b52b0b2d1a11a | +| static/retained-analysis.js | b6203812c4dd04586062e903ef981cff074ba80ff5d01eeb218b711c8417a1e9 | +| tests/browser_retained_analysis.cjs | 822d6df2d8c29e909f6f0dcee42595f90c9eae70306ff9c8b20eba042bdd05ce | +| static/retained-checkpoint-curve.vl.json | 6603c860ce76a434a11e6c96cf7418246ce2dd5da3d7a56a5f2448a0537ec183 | + +Limit: query fixture orchestration and real browser rendering over authored data +are established. Actual PostgreSQL/retained-Run custody/revocation, production +integration and full cold-process scientific reproducibility are unqualified. +Do not merge or register this capability on the basis of fixture evidence alone. diff --git a/docs/plans/retained-analysis/reports/m1/focused-tests.log b/docs/plans/retained-analysis/reports/m1/focused-tests.log new file mode 100644 index 00000000..703ee444 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m1/focused-tests.log @@ -0,0 +1,18 @@ +test_parameterized_curve_and_stable_error_page_on_actual_postgres (test_retained_analysis.ActualPostgresSqlTests.test_parameterized_curve_and_stable_error_page_on_actual_postgres) ... skipped 'Existing authorized PostgreSQL configuration required; no credentials created.' +test_exact_frozen_examples_and_retained_confidence (test_retained_analysis.ProjectionTests.test_exact_frozen_examples_and_retained_confidence) ... ok +test_foreign_metric_checkpoint_and_population_are_distinct_failures (test_retained_analysis.ProjectionTests.test_foreign_metric_checkpoint_and_population_are_distinct_failures) ... ok +test_unsupported_task_and_oversize_are_explicit (test_retained_analysis.ProjectionTests.test_unsupported_task_and_oversize_are_explicit) ... ok +test_catalog_mismatch_is_refused (test_retained_analysis.QueryBoundaryTests.test_catalog_mismatch_is_refused) ... ok +test_error_filter_does_not_change_metric_population_and_page_identity (test_retained_analysis.QueryBoundaryTests.test_error_filter_does_not_change_metric_population_and_page_identity) ... ok +test_exact_provenance_and_values_with_fresh_access_outside_snapshot (test_retained_analysis.QueryBoundaryTests.test_exact_provenance_and_values_with_fresh_access_outside_snapshot) ... ok +test_export_and_repeated_retrieval_do_not_bypass_current_authority (test_retained_analysis.QueryBoundaryTests.test_export_and_repeated_retrieval_do_not_bypass_current_authority) ... ok +test_malformed_catalog_envelope_preserves_typed_failure (test_retained_analysis.QueryBoundaryTests.test_malformed_catalog_envelope_preserves_typed_failure) ... ok +test_nested_transaction_and_oversized_response_refused (test_retained_analysis.QueryBoundaryTests.test_nested_transaction_and_oversized_response_refused) ... ok +test_revocation_during_read_prevents_return (test_retained_analysis.QueryBoundaryTests.test_revocation_during_read_prevents_return) ... ok +test_closed_bounds_and_types_before_evidence_read (test_retained_analysis.RequestTests.test_closed_bounds_and_types_before_evidence_read) ... ok +test_defaults_and_explicit_field_projection (test_retained_analysis.RequestTests.test_defaults_and_explicit_field_projection) ... ok + +---------------------------------------------------------------------- +Ran 13 tests in 0.004s + +OK (skipped=1) diff --git a/docs/plans/retained-analysis/reports/m2/browser-errors.log b/docs/plans/retained-analysis/reports/m2/browser-errors.log new file mode 100644 index 00000000..e69de29b diff --git a/docs/plans/retained-analysis/reports/m2/browser.json b/docs/plans/retained-analysis/reports/m2/browser.json new file mode 100644 index 00000000..a4122f3d --- /dev/null +++ b/docs/plans/retained-analysis/reports/m2/browser.json @@ -0,0 +1,18 @@ +{ + "status": "passed", + "evidence": "actual-headless-Chromium-authored-renderer-fixture", + "checks": [ + "strict CSP/interpreter", + "self-hosted/offline external assets", + "exact numbers", + "keyboard linked selection/focus", + "visible error filter", + "390px layout", + "stale reply after revocation", + "malformed/oversized response and spec rejection", + "support/ordinal/provenance/type validation", + "fresh export authorization path", + "cold page reopen", + "dispose" + ] +} diff --git a/docs/plans/retained-analysis/reports/m3-actual/environment.json b/docs/plans/retained-analysis/reports/m3-actual/environment.json new file mode 100644 index 00000000..3cf5557c --- /dev/null +++ b/docs/plans/retained-analysis/reports/m3-actual/environment.json @@ -0,0 +1,52 @@ +{ + "postgres": "17.11 (Debian 17.11-0+deb13u1)", + "listen_addresses": "", + "application_role": { + "superuser": false, + "createdb": false, + "createrole": false + }, + "postgres_scope": "Task-owned disposable local instance; no production configuration selected", + "training_probe": { + "schema_version": 1, + "available": true, + "adapter": { + "name": "tinycnn_cpu", + "version": 2 + }, + "runtime": { + "python": "3.12.14", + "device": "cpu", + "threads": 1, + "torch": "2.8.0+cpu", + "torchvision": "0.23.0+cpu", + "scikit_learn": "1.7.2" + }, + "problems": [] + }, + "deb_sha256": { + "postgresql-17_17.11-0+deb13u1_amd64.deb": "d2ce1ddffafa783f9acda4c92c86fc21e8288bff3782d739294f14fa797d7886", + "postgresql-client-17_17.11-0+deb13u1_amd64.deb": "9d8558f8dd57c8e92e218a20698383575d53742ca3f9e7c2b7fe5f246d5216ae" + }, + "fixture": { + "catalog_id": "8622700dae5345e68c77ac26a7c54d71", + "run_id": "3b55365925ed45b391072918503f7c5f", + "artifact_count": 22 + }, + "source_sha256": { + "retained_analysis.py": "317ba63b0f89367ba26dd62b8157910654943eb8a9d3ab1442f09f09827f218b", + "tests/retained_analysis_actual_fixture.py": "5e8759c7715de85b8df886727d11335cc913d78d178b3d787e09778aab29ff55", + "tests/test_retained_analysis_actual.py": "255abedd2980dd36deee27ae0a12c1f1e3870c3c92c3203bea334ae7bfd8e651" + }, + "claims": [ + "Actual PostgreSQL SQL", + "Normal retained native classifier Run", + "Original artifact numeric oracle", + "Real Access revocation; final-check timing fault injected", + "Fresh Python process reopen" + ], + "unqualified": [ + "Authenticated production API-to-Runs UI hooks pending lead coordination" + ], + "original_skipped_log_preserved": true +} diff --git a/docs/plans/retained-analysis/reports/m3-actual/fixture.json b/docs/plans/retained-analysis/reports/m3-actual/fixture.json new file mode 100644 index 00000000..b7010dc2 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m3-actual/fixture.json @@ -0,0 +1,137 @@ +{ + "format": "retained_analysis_actual_fixture_v1", + "scope": "Authored transport fixture; no model-quality claim", + "catalog_path": "/tmp/tuldok-analysis-real-run/catalog", + "catalog_id": "8622700dae5345e68c77ac26a7c54d71", + "run_id": "3b55365925ed45b391072918503f7c5f", + "release_sha256": "57e7d1e2abb2e46e50b1f22e3a210f77058b6d7e8e1835df2f6cdb7941a4a25a", + "request": { + "query_id": "retained_checkpoint_examples", + "query_version": 1, + "run_id": "3b55365925ed45b391072918503f7c5f", + "evaluation_sha256": "6cb8e64a1834bd1479735acd67a1a3426a49addf945cc03774e40ee30b69fd01", + "checkpoint_sha256": "73d96dc058a33810f87e67cf6097883b59266dee287c35df855b33666bb027c7", + "metric_id": "accuracy", + "metric_definition_sha256": "77c3f8b930e3fdf39f4db928432abe3fc56dcca47ebb257e3755c13a7c81a81f", + "limit": 1, + "offset": 0 + }, + "artifacts": [ + { + "name": "metrics.json", + "sha256": "3d503a3717a8ee8c9cc6079676297b986216dd5d7b9ea83838d0aa70ff80a646", + "bytes": 1635 + }, + { + "name": "test-metrics.json", + "sha256": "1650ec79b25db20031bf085b69c80513c14145afcfb9052f348dd34bdcbb2df1", + "bytes": 583 + }, + { + "name": "predictions-validation.json", + "sha256": "a43883680f82d078febaf20984cc7c211bf66a0eac4acd0e0b6b919b11cd0bdb", + "bytes": 1698 + }, + { + "name": "predictions-test.json", + "sha256": "4d1f23e0a606280fdf0a0851380c167ec07f618addcef0797f1ef6cb04462d38", + "bytes": 1680 + }, + { + "name": "checkpoint.pt", + "sha256": "b53a5aac7978fc02d6a3b5409b14bb2cdf98502a4c9bccde2ca30b050c102254", + "bytes": 9895 + }, + { + "name": "checkpoint-epoch-0001.json", + "sha256": "73d96dc058a33810f87e67cf6097883b59266dee287c35df855b33666bb027c7", + "bytes": 526 + }, + { + "name": "checkpoint-epoch-0002.json", + "sha256": "daeb53dc1671f9b35ddece10f92364068e526dd61274deb8a134d3ac45e168a8", + "bytes": 526 + }, + { + "name": "checkpoints.json", + "sha256": "7547aeb68ff0171de775a2c3b309ed2f9e9c32c76f8356ea75bc2eb0a0ccb82a", + "bytes": 1060 + }, + { + "name": "fitted-transform.json", + "sha256": "6ef6f1167d13ea15822909c8e88a04deeebad848012d4c0c3ca4e7edf17f63bc", + "bytes": 68 + }, + { + "name": "metric-definitions.json", + "sha256": "f07af3fc0b9813be8372cf2a0a90eeb49b44a1220ec8e4a744c25ca37da89545", + "bytes": 1724 + }, + { + "name": "model-definition.json", + "sha256": "30100b577a37dad313ec1ed3c5f9a515ee2dece0ce6929f4cd9455ccea678b4d", + "bytes": 450 + }, + { + "name": "model-evidence.json", + "sha256": "6cb8e64a1834bd1479735acd67a1a3426a49addf945cc03774e40ee30b69fd01", + "bytes": 2316 + }, + { + "name": "observations.json", + "sha256": "dc3166b7143c4ee022a61bcdf7f3a2751e3adb8360af694a8f7353c38d3a80a6", + "bytes": 2508 + }, + { + "name": "output-policy.json", + "sha256": "ee8f417a377b4c02aeafda8d604525de180fe0712ca0a97359806ab7b904b5ab", + "bytes": 65 + }, + { + "name": "probe.json", + "sha256": "63b0a150c9a43a8bbdb15a339ad89bad1cce9a0c23ef4ea39d0b2f56b9c01a9c", + "bytes": 1368 + }, + { + "name": "probes-epoch-0001.json", + "sha256": "fd2ce83def4c4f7e13caf06f5d5739d5423e9328d4d98a99407ab95dadf96c52", + "bytes": 436 + }, + { + "name": "probes-epoch-0002.json", + "sha256": "076e3bbe95d3eb4c7634f3e452c0984bfb1ff3e32d542bfac0de95e425448dfe", + "bytes": 434 + }, + { + "name": "profile.json", + "sha256": "17d3b8c1d75dc1fbd211b6cdfc41cc81e93bd555d7fff8801b825de37eff7e5a", + "bytes": 898 + }, + { + "name": "validation-logits.json", + "sha256": "997156a0e81ecf3ce277bf1f8b78b19bf18036535f287988af2119dff414a6b7", + "bytes": 853 + }, + { + "name": "weights-epoch-0001.pt", + "sha256": "d94283cf333d8b83095da3f300f88c3b4c388466b697b3e9cdb86bd48a289b6f", + "bytes": 9895 + }, + { + "name": "weights-epoch-0002.pt", + "sha256": "b53a5aac7978fc02d6a3b5409b14bb2cdf98502a4c9bccde2ca30b050c102254", + "bytes": 9895 + }, + { + "name": "artifact-manifest.json", + "sha256": "332df4a2baae09fab5d8b64d9fc8a3363cac15f2d1c3cbca6b37f23d845d5701", + "bytes": 3959 + } + ], + "source_sha256": { + "retained_analysis.py": "317ba63b0f89367ba26dd62b8157910654943eb8a9d3ab1442f09f09827f218b", + "tests/retained_analysis_actual_fixture.py": "5e8759c7715de85b8df886727d11335cc913d78d178b3d787e09778aab29ff55", + "runs.py": "ae126e0d6493d925b171d2c9da874f16d7b76e881160e98f6f6b2e2f144ad0c2", + "model_evidence.py": "04012022740f45fc03ad11351a7efe4946e574890bb814fcdf5871b873a5701b" + } +} diff --git a/docs/plans/retained-analysis/reports/m3-actual/original-query-tests.log b/docs/plans/retained-analysis/reports/m3-actual/original-query-tests.log new file mode 100644 index 00000000..8c1b6610 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m3-actual/original-query-tests.log @@ -0,0 +1,18 @@ +test_parameterized_curve_and_stable_error_page_on_actual_postgres (test_retained_analysis.ActualPostgresSqlTests.test_parameterized_curve_and_stable_error_page_on_actual_postgres) ... ok +test_exact_frozen_examples_and_retained_confidence (test_retained_analysis.ProjectionTests.test_exact_frozen_examples_and_retained_confidence) ... ok +test_foreign_metric_checkpoint_and_population_are_distinct_failures (test_retained_analysis.ProjectionTests.test_foreign_metric_checkpoint_and_population_are_distinct_failures) ... ok +test_unsupported_task_and_oversize_are_explicit (test_retained_analysis.ProjectionTests.test_unsupported_task_and_oversize_are_explicit) ... ok +test_catalog_mismatch_is_refused (test_retained_analysis.QueryBoundaryTests.test_catalog_mismatch_is_refused) ... ok +test_error_filter_does_not_change_metric_population_and_page_identity (test_retained_analysis.QueryBoundaryTests.test_error_filter_does_not_change_metric_population_and_page_identity) ... ok +test_exact_provenance_and_values_with_fresh_access_outside_snapshot (test_retained_analysis.QueryBoundaryTests.test_exact_provenance_and_values_with_fresh_access_outside_snapshot) ... ok +test_export_and_repeated_retrieval_do_not_bypass_current_authority (test_retained_analysis.QueryBoundaryTests.test_export_and_repeated_retrieval_do_not_bypass_current_authority) ... ok +test_malformed_catalog_envelope_preserves_typed_failure (test_retained_analysis.QueryBoundaryTests.test_malformed_catalog_envelope_preserves_typed_failure) ... ok +test_nested_transaction_and_oversized_response_refused (test_retained_analysis.QueryBoundaryTests.test_nested_transaction_and_oversized_response_refused) ... ok +test_revocation_during_read_prevents_return (test_retained_analysis.QueryBoundaryTests.test_revocation_during_read_prevents_return) ... ok +test_closed_bounds_and_types_before_evidence_read (test_retained_analysis.RequestTests.test_closed_bounds_and_types_before_evidence_read) ... ok +test_defaults_and_explicit_field_projection (test_retained_analysis.RequestTests.test_defaults_and_explicit_field_projection) ... ok + +---------------------------------------------------------------------- +Ran 13 tests in 0.024s + +OK diff --git a/docs/plans/retained-analysis/reports/m3-actual/preparation.log b/docs/plans/retained-analysis/reports/m3-actual/preparation.log new file mode 100644 index 00000000..15572f24 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m3-actual/preparation.log @@ -0,0 +1 @@ +{"artifacts": [{"bytes": 1635, "name": "metrics.json", "sha256": "3d503a3717a8ee8c9cc6079676297b986216dd5d7b9ea83838d0aa70ff80a646"}, {"bytes": 583, "name": "test-metrics.json", "sha256": "1650ec79b25db20031bf085b69c80513c14145afcfb9052f348dd34bdcbb2df1"}, {"bytes": 1698, "name": "predictions-validation.json", "sha256": "a43883680f82d078febaf20984cc7c211bf66a0eac4acd0e0b6b919b11cd0bdb"}, {"bytes": 1680, "name": "predictions-test.json", "sha256": "4d1f23e0a606280fdf0a0851380c167ec07f618addcef0797f1ef6cb04462d38"}, {"bytes": 9895, "name": "checkpoint.pt", "sha256": "b53a5aac7978fc02d6a3b5409b14bb2cdf98502a4c9bccde2ca30b050c102254"}, {"bytes": 526, "name": "checkpoint-epoch-0001.json", "sha256": "73d96dc058a33810f87e67cf6097883b59266dee287c35df855b33666bb027c7"}, {"bytes": 526, "name": "checkpoint-epoch-0002.json", "sha256": "daeb53dc1671f9b35ddece10f92364068e526dd61274deb8a134d3ac45e168a8"}, {"bytes": 1060, "name": "checkpoints.json", "sha256": "7547aeb68ff0171de775a2c3b309ed2f9e9c32c76f8356ea75bc2eb0a0ccb82a"}, {"bytes": 68, "name": "fitted-transform.json", "sha256": "6ef6f1167d13ea15822909c8e88a04deeebad848012d4c0c3ca4e7edf17f63bc"}, {"bytes": 1724, "name": "metric-definitions.json", "sha256": "f07af3fc0b9813be8372cf2a0a90eeb49b44a1220ec8e4a744c25ca37da89545"}, {"bytes": 450, "name": "model-definition.json", "sha256": "30100b577a37dad313ec1ed3c5f9a515ee2dece0ce6929f4cd9455ccea678b4d"}, {"bytes": 2316, "name": "model-evidence.json", "sha256": "6cb8e64a1834bd1479735acd67a1a3426a49addf945cc03774e40ee30b69fd01"}, {"bytes": 2508, "name": "observations.json", "sha256": "dc3166b7143c4ee022a61bcdf7f3a2751e3adb8360af694a8f7353c38d3a80a6"}, {"bytes": 65, "name": "output-policy.json", "sha256": "ee8f417a377b4c02aeafda8d604525de180fe0712ca0a97359806ab7b904b5ab"}, {"bytes": 1368, "name": "probe.json", "sha256": "63b0a150c9a43a8bbdb15a339ad89bad1cce9a0c23ef4ea39d0b2f56b9c01a9c"}, {"bytes": 436, "name": "probes-epoch-0001.json", "sha256": "fd2ce83def4c4f7e13caf06f5d5739d5423e9328d4d98a99407ab95dadf96c52"}, {"bytes": 434, "name": "probes-epoch-0002.json", "sha256": "076e3bbe95d3eb4c7634f3e452c0984bfb1ff3e32d542bfac0de95e425448dfe"}, {"bytes": 898, "name": "profile.json", "sha256": "17d3b8c1d75dc1fbd211b6cdfc41cc81e93bd555d7fff8801b825de37eff7e5a"}, {"bytes": 853, "name": "validation-logits.json", "sha256": "997156a0e81ecf3ce277bf1f8b78b19bf18036535f287988af2119dff414a6b7"}, {"bytes": 9895, "name": "weights-epoch-0001.pt", "sha256": "d94283cf333d8b83095da3f300f88c3b4c388466b697b3e9cdb86bd48a289b6f"}, {"bytes": 9895, "name": "weights-epoch-0002.pt", "sha256": "b53a5aac7978fc02d6a3b5409b14bb2cdf98502a4c9bccde2ca30b050c102254"}, {"bytes": 3959, "name": "artifact-manifest.json", "sha256": "332df4a2baae09fab5d8b64d9fc8a3363cac15f2d1c3cbca6b37f23d845d5701"}], "catalog_id": "8622700dae5345e68c77ac26a7c54d71", "catalog_path": "/tmp/tuldok-analysis-real-run/catalog", "format": "retained_analysis_actual_fixture_v1", "release_sha256": "57e7d1e2abb2e46e50b1f22e3a210f77058b6d7e8e1835df2f6cdb7941a4a25a", "request": {"checkpoint_sha256": "73d96dc058a33810f87e67cf6097883b59266dee287c35df855b33666bb027c7", "evaluation_sha256": "6cb8e64a1834bd1479735acd67a1a3426a49addf945cc03774e40ee30b69fd01", "limit": 1, "metric_definition_sha256": "77c3f8b930e3fdf39f4db928432abe3fc56dcca47ebb257e3755c13a7c81a81f", "metric_id": "accuracy", "offset": 0, "query_id": "retained_checkpoint_examples", "query_version": 1, "run_id": "3b55365925ed45b391072918503f7c5f"}, "run_id": "3b55365925ed45b391072918503f7c5f", "scope": "Authored transport fixture; no model-quality claim", "source_sha256": {"model_evidence.py": "04012022740f45fc03ad11351a7efe4946e574890bb814fcdf5871b873a5701b", "retained_analysis.py": "317ba63b0f89367ba26dd62b8157910654943eb8a9d3ab1442f09f09827f218b", "runs.py": "ae126e0d6493d925b171d2c9da874f16d7b76e881160e98f6f6b2e2f144ad0c2", "tests/retained_analysis_actual_fixture.py": "5e8759c7715de85b8df886727d11335cc913d78d178b3d787e09778aab29ff55"}} diff --git a/docs/plans/retained-analysis/reports/m3-actual/qualification.md b/docs/plans/retained-analysis/reports/m3-actual/qualification.md new file mode 100644 index 00000000..9f2fd61a --- /dev/null +++ b/docs/plans/retained-analysis/reports/m3-actual/qualification.md @@ -0,0 +1,94 @@ +# Actual PostgreSQL and retained Run qualification + +Date: 2026-10-20. This follow-up resolves the initial environment absence after +the parent confirmed ordinary disposable test infrastructure is in scope. +The earlier [12-pass/one-skip record](../m1/focused-tests.log) is unchanged. + +## Observed boundaries + +- Official Debian PostgreSQL 17.11 packages were downloaded and extracted under + `/tmp/tuldok-pg-bin`; no system package or service was changed. The existing + `scripts/local_postgres.py` owns the private service at + `/tmp/tuldok-analysis-pg`. It listens on its private Unix socket only. The + application role is not superuser and cannot create databases or roles. +- Repository-pinned Torch 2.8.0+cpu, torchvision 0.23.0+cpu and scikit-learn 1.7.2 + were installed in `/tmp/tuldok-training-runtime/venv`. The normal model-aware + runtime probe reports available. [Environment](environment.json) records + observed versions and official package hashes, without credentials. +- `tests/retained_analysis_actual_fixture.py` used the normal Dataset owner, + six authored images, frozen release, Pipeline validation and supervised native + classifier Run. Two epochs produced 22 retained artifacts. This is transport + evidence, not a model-quality or scientific separation claim. +- [Fixture receipt](fixture.json) contains exact Run/result/artifact identities + and source hashes. The retained catalog/artifacts remain in the task-owned + directory `/tmp/tuldok-analysis-real-run`; its token is private and is never + copied to a report or command argument. + +## Results + +The original query suite now passes **13/13**, including the formerly skipped +actual PostgreSQL SQL test: [log](original-query-tests.log). + +The new actual retained-query suite passes **6/6**: [log](retained-query-tests.log). +It reads metric observations, checkpoint inventory, probe membership and +probabilities directly from original retained artifact bytes and compares them +against the actual SQL query output. It exercises all three metric definitions, +both checkpoints, stable paginated example IDs, support/error filtering, units, +inert query/export behavior, unchanged Run document/artifact hashes, restored +session timeout, real issued/revoked inspect credentials, artifact tamper +re-verification and a fresh Python process reopening the same exact result. + +Final-check revocation uses an explicitly fault-injected timing wrapper around +Access.require; the revocation and credential check themselves use the real +Access owner and PostgreSQL. The repeated-tamper test restores exact original +bytes in finally. No verifier/authentication/query data is substituted. + +Separate GPT-6.1 Sol High review found no blocking evidence/oracle defect. The +reviewer independently reran the original 13 tests and the three non-mutating +actual tests: **16 passed, zero skips**. It inspected the mutation tests without +repeating them, verified source/receipt hashes and private file modes, and did +not create another service, fixture or training Run. + +Reviewed source SHA256: + +| File | SHA256 | +| --- | --- | +| retained_analysis.py | 317ba63b0f89367ba26dd62b8157910654943eb8a9d3ab1442f09f09827f218b | +| tests/retained_analysis_actual_fixture.py | 5e8759c7715de85b8df886727d11335cc913d78d178b3d787e09778aab29ff55 | +| tests/test_retained_analysis_actual.py | 255abedd2980dd36deee27ae0a12c1f1e3870c3c92c3203bea334ae7bfd8e651 | + +## Reproduce in this retained task environment + +Select the task-owned PG binaries and normal helper environment, then run with +the base application dependencies and the existing fixture: + +```sh +export PATH="/tmp/tuldok-pg-bin/usr/lib/postgresql/17/bin:/tmp/tuldok-analysis-venv/bin:$PATH" +eval "$(python scripts/local_postgres.py env --directory /tmp/tuldok-analysis-pg)" +export TULDOK_TRAINING_PYTHON=/tmp/tuldok-training-runtime/venv/bin/python +export TULDOK_ANALYSIS_ACTUAL=1 +export TULDOK_ANALYSIS_FIXTURE=/tmp/tuldok-analysis-real-run +python -m unittest discover -s tests -p test_retained_analysis_actual.py -v +``` + +For a fresh task-owned instance, provision the ordinary repository requirements, +use the existing local-service helper with a new private directory, then prepare +one fixture explicitly. The preparation refuses an existing destination. Do not +point these fixtures at a production catalog or repeat training just to reopen +the retained result. + +## Remaining acceptance + +`tests/test_retained_analysis_http.py` and +`tests/browser_retained_analysis_actual.cjs` are prepared for the coordinated +new operation contracts/routes and Runs mount. They have syntax checks only; +they are **not yet executed or accepted** because those shared hooks have not +been approved/integrated. The HTTP test requires explicit +`TULDOK_ANALYSIS_HTTP=1`; it must fail if the exact new contracts are absent. +The actual-browser test uses normal app.py/authentication and retained data, +without test-only routes. Its selectors and operation paths must be confirmed +against the eventual agreed integration before execution. + +The existing isolated renderer test remains actual Chromium evidence over +authored data. It does not become authenticated Runs evidence merely because +the direct query now passes actual PostgreSQL tests. diff --git a/docs/plans/retained-analysis/reports/m3-actual/retained-query-tests.log b/docs/plans/retained-analysis/reports/m3-actual/retained-query-tests.log new file mode 100644 index 00000000..c01147a1 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m3-actual/retained-query-tests.log @@ -0,0 +1,11 @@ +test_actual_sql_curve_and_examples_equal_original_retained_artifacts (test_retained_analysis_actual.ActualRetainedAnalysisTests.test_actual_sql_curve_and_examples_equal_original_retained_artifacts) ... ok +test_new_process_cold_reopen_preserves_exact_result (test_retained_analysis_actual.ActualRetainedAnalysisTests.test_new_process_cold_reopen_preserves_exact_result) ... ok +test_query_and_export_are_inert_and_restore_session_settings (test_retained_analysis_actual.ActualRetainedAnalysisTests.test_query_and_export_are_inert_and_restore_session_settings) ... ok +test_real_credential_revocation_blocks_repeated_query_and_export (test_retained_analysis_actual.ActualRetainedAnalysisTests.test_real_credential_revocation_blocks_repeated_query_and_export) ... ok +test_repeated_query_reverifies_hash_bound_artifact (test_retained_analysis_actual.ActualRetainedAnalysisTests.test_repeated_query_reverifies_hash_bound_artifact) ... ok +test_revocation_at_final_authorization_uses_current_real_credential (test_retained_analysis_actual.ActualRetainedAnalysisTests.test_revocation_at_final_authorization_uses_current_real_credential) ... ok + +---------------------------------------------------------------------- +Ran 6 tests in 0.693s + +OK diff --git a/docs/plans/retained-analysis/reports/m4-integrated/acceptance.md b/docs/plans/retained-analysis/reports/m4-integrated/acceptance.md new file mode 100644 index 00000000..3ca494b7 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/acceptance.md @@ -0,0 +1,52 @@ +# Authenticated retained analysis acceptance + +The first vertical slice is implemented in existing Runs: a retained native +classifier curve linked to stable per-example/error pages, through two explicitly +selected, closed inspect/read operations. Opening it starts no new computation. +Implementation composes reliability83a1e128 (merge252a68c), with shared hunks +approved by the repository lead through the parent. Lead alone owns merge. + +| Evidence | Result | Scope | +| --- | --- | --- | +| [Query/contract/HTTP suite](query-http-tests.log) | 27 passed, no skips | Original13 query tests, 6 actual retained PostgreSQL tests, 3 contracts, 5 normal authenticated HTTP tests | +| [Actual Runs Chromium](browser.json) | passed | Normal app/PG/retained native Run, exact numbers, keyboard-linked table,390px, real response cancellation, fresh export, actual revocations and fresh app process reopen | +| [Authored renderer Chromium](renderer.json) | passed | Local assets/interpreter under stricter CSP, pointer/keyboard/focus, spec/response bounds and tampering, stale failure replies, disposal and downloaded JSON | +| [Controller regressions](controllers.log) | 11 suites passed | Existing model, coordinator, external/import/package, phase, scientific, lineage/publication, field and candidate behavior; controlled transports | +| [Python regressions](regressions.log) | 36 passed | Owner phase14, agent API17, access HTTP4, phase contract pins1 | +| [Existing Runs browsers](existing-runs-browsers.log) | passed | Actual coordinator recovery/lost reply and scientific-comparison workflows, including their own revocation checks | +| [Independent review](independent/review.md) | approved; no blocking findings | Separate GPT-6.1 Sol High source review and actual HTTP/Chromium rerun | + +The actual browser revokes a real session before export and before ordinary Run +detail, prediction and model-evidence reads. It also holds an existing checkpoint +action, allows the rerendered retained query to succeed, then revokes/releases the +checkpoint read; both private metric grid and retained graph disappear. A shared +WorkspaceModel transport wrapper forwards current-generation denials before local +presentation catches, preserving credential/navigation/signal fences. + +The /workspaces meta CSP precedes every asset. Script execution is self-only; +inline scripts and runtime code generation remain blocked. Existing application +inline CSS remains allowed. Browser acceptance collects unexpected violations +and verifies blocked Function construction with the DevTools CSP bypass disabled. +The isolated renderer additionally proves compatibility with self-only styles. + +The source checkpoint records SHA256 for the implementation/test/assets and +explicit dependency. [Earlier environment receipt](../m3-actual/environment.json) +records task-owned PostgreSQL17.11, non-superuser app role, pinned CPU runtime and +the single normal six-image/two-epoch fixture. Its then-pending integration note +is historical and superseded here. This authored material makes no model-quality +claim. No production credential/configuration/role/schema migration is involved. +Private owner/session bytes stay in task-owned /tmp files or non-uploaded CI +fixture storage. Reports contain public IDs/hashes only. + +Initial failure logs are retained: HTTP malformed request expectation corrected +to existing400 invalid semantics; CDP continue after actual request cancellation +accepts only the specific invalid-interception outcome and separately requires +observed cancellation. The Dataset selector starts disabled until its existing +initializer installs listeners, avoiding input loss during local asset loading. + +Limits: native epoch classifier/validation-probe evidence only; one exact frozen +result,100 rows per page,128 checkpoints,10000 fixed examples. This is not a new +statistics warehouse, arbitrary SQL/spec engine, notebook service or persisted +view revision store. General recipes, saved view overrides, benchmarks and later +scientific analyses remain separate milestones. Full-repository CI still runs +on GitHub; local evidence qualifies the listed boundaries. No merge performed. diff --git a/docs/plans/retained-analysis/reports/m4-integrated/active-pr-write-sets.json b/docs/plans/retained-analysis/reports/m4-integrated/active-pr-write-sets.json new file mode 100644 index 00000000..d8d1e46e --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/active-pr-write-sets.json @@ -0,0 +1,469 @@ +[ + { + "number": 110, + "head": "feature/lab-batch-client-20261019", + "base": "feature/lab-bounded-collection-20261019", + "files": [ + "docs/contracts/project-cli.md", + "docs/contracts/workflow-client.md", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/actual-attempt-01/actual-http-cli.log", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/actual-attempt-01/cleanup-independent.json", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/actual-attempt-01/cleanup-publication.json", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/actual-attempt-01/cleanup-twenty.json", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/actual-attempt-01/source.json", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/actual-attempt-02/actual-affected.log", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/actual-attempt-02/cleanup-independent.json", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/actual-attempt-02/cleanup-publication.json", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/actual-attempt-02/cleanup-twenty.json", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/actual-attempt-02/preparation.json", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/actual-attempt-02/source-before-comment.json", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/actual-attempt-02/source.json", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/consumer-independent-final-review.json", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/pure-composed.log", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/pure-initial.log", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/qualification.md", + "docs/plans/lab-workflow-reliability/reports/m4-batch-client/validation.json", + "project_cli.py", + "tests/test_workflow_batch_client.py", + "tests/test_workflow_batch_client_http.py", + "tuldok_client.py" + ] + }, + { + "number": 109, + "head": "feature/lab-bounded-collection-20261019", + "base": "feature/lab-field-comparison-20261019", + "files": [ + "agent_api.py", + "app.py", + "docs/contracts/run-artifact-segments.md", + "docs/plans/lab-workflow-reliability/execution-ledger.md", + "docs/plans/lab-workflow-reliability/plan.md", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/actual-initial.log", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/before.log", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/composed-pilot-02.log", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/composed-pilot-02/environment-start.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/composed-pilot-02/raw/artifacts-1-setup-integrity.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/composed-pilot-02/raw/publication-artifacts-1-history-2-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/composed-pilot-02/raw/run-artifacts-1-history-1-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/composed-pilot-02/raw/unavailable-artifacts-1-history-0-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/composed-pilot-02/summary.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/composed-pure-final.log", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/initial-validation.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/legacy-regressions.log", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/analyze_pairs.py", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/environment-start.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/parent-cleanup-independent.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/qualified-pairs.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/artifacts-1-setup-integrity.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/artifacts-20-setup-integrity.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/publication-artifacts-1-history-56-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/publication-artifacts-1-history-56-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/publication-artifacts-1-history-56-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/publication-artifacts-20-history-56-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/publication-artifacts-20-history-56-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/publication-artifacts-20-history-56-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/run-artifacts-1-history-55-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/run-artifacts-1-history-55-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/run-artifacts-1-history-55-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/run-artifacts-1-history-8-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/run-artifacts-1-history-8-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/run-artifacts-1-history-8-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/run-artifacts-20-history-55-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/run-artifacts-20-history-55-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/run-artifacts-20-history-55-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/run-artifacts-20-history-8-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/run-artifacts-20-history-8-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/run-artifacts-20-history-8-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/unavailable-artifacts-1-history-0-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/unavailable-artifacts-1-history-0-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/unavailable-artifacts-1-history-0-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/unavailable-artifacts-20-history-0-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/unavailable-artifacts-20-history-0-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/raw/unavailable-artifacts-20-history-0-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/results.md", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/stdout.log", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/summary.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-9838022/validation.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/analyze_pairs.py", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/environment-start.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/producer-independent-review.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/qualified-pairs.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/artifacts-1-setup-integrity.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/artifacts-20-setup-integrity.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/publication-artifacts-1-history-56-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/publication-artifacts-1-history-56-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/publication-artifacts-1-history-56-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/publication-artifacts-20-history-56-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/publication-artifacts-20-history-56-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/publication-artifacts-20-history-56-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/run-artifacts-1-history-55-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/run-artifacts-1-history-55-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/run-artifacts-1-history-55-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/run-artifacts-1-history-8-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/run-artifacts-1-history-8-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/run-artifacts-1-history-8-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/run-artifacts-20-history-55-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/run-artifacts-20-history-55-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/run-artifacts-20-history-55-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/run-artifacts-20-history-8-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/run-artifacts-20-history-8-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/run-artifacts-20-history-8-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/unavailable-artifacts-1-history-0-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/unavailable-artifacts-1-history-0-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/unavailable-artifacts-1-history-0-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/unavailable-artifacts-20-history-0-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/unavailable-artifacts-20-history-0-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/raw/unavailable-artifacts-20-history-0-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/refinement-independent-review.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/results.md", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/stdout.log", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/summary.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-99741e5/validation.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-harness-tests.log", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-pilot-01.log", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-pilot-01/environment-start.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-pilot-01/raw/artifacts-2-setup-integrity.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-pilot-01/raw/publication-artifacts-2-history-2-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-pilot-01/raw/run-artifacts-2-history-1-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-pilot-01/raw/unavailable-artifacts-2-history-0-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/paired-pilot-01/summary.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/pure-initial.log", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/refinement/actual-attempt01-source.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/refinement/actual-attempt01.log", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/refinement/before.log", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/refinement/independent-review.json", + "docs/plans/lab-workflow-reliability/reports/m4-bounded-collection/refinement/parent-997-cleanup-independent.json" + ] + }, + { + "number": 108, + "head": "feature/lab-indexed-diagnostics-20261019", + "base": "feature/lab-batch-client-20261019", + "files": [ + "docs/contracts/indexed-diagnostics.md", + "docs/contracts/run-preflight-publication.md", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/composed-readers/indexed-final-9d563ceb-independent-review.json", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/composed-readers/qualification.md", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/composed-readers/tuldok-indexed-composed-actual.log", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/composed-readers/tuldok-indexed-composed-qualification.json", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/composed-readers/tuldok-indexed-composed-readers-70dcaeb-independent-review.json", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/composed-readers/tuldok-indexed-composed-source.json", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/composed-readers/tuldok-refined-indexed-cleanup-independent.json", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/composed-readers/validation.json", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/owner-roundtrip-final.log", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/owner-roundtrip-first.log", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/owner-roundtrip-receipt.json", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/owner-roundtrip-second.log", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/pure-tests-final.log", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/pure-tests.log", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/report.md", + "docs/plans/lab-workflow-reliability/reports/m1-indexed-diagnostics/source-sha256.txt", + "extension_evidence.py", + "recipe_contract.py", + "tests/test_indexed_diagnostics.py", + "tests/test_indexed_diagnostics_publication.py", + "tuldok_extension_sdk/diagnostics.py", + "tuldok_extension_sdk/evidence.py" + ] + }, + { + "number": 107, + "head": "test/lab-workflow-baseline-20261019", + "base": "feature/lab-phase-timing-20261019", + "files": [ + "docs/contracts/lab-workflow-baseline.md", + "docs/plans/lab-workflow-reliability/execution-ledger.md", + "docs/plans/lab-workflow-reliability/plan.md", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/analysis-verification.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/analysis.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/README.md", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-exploratory-preflight.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-01.log", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-01/environment-start.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-01/failure.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-02.log", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-02/environment-start.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-02/raw/artifacts-1-history-0-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-02/raw/artifacts-1-history-2-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-02/raw/artifacts-1-real-history-population.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-02/summary.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-03.log", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-03/environment-start.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-03/failure.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-03/raw/artifacts-1-history-0-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-03/raw/artifacts-1-history-2-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-03/raw/artifacts-1-real-history-population.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-03/raw/artifacts-2-history-0-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-04.log", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-04/environment-start.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-04/raw/artifacts-2-fresh-workflow-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-04/raw/artifacts-2-history-0-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-04/raw/artifacts-2-history-2-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-04/raw/artifacts-2-real-history-population.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pilot-04/summary.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pure-final.log", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/exploratory/tuldok-m4-harness-pure.log", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f.log", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/environment-start.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-1-fresh-workflow-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-1-fresh-workflow-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-1-fresh-workflow-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-1-history-0-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-1-history-0-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-1-history-0-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-1-history-55-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-1-history-55-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-1-history-55-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-1-history-8-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-1-history-8-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-1-history-8-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-1-real-history-population.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-20-fresh-workflow-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-20-fresh-workflow-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-20-fresh-workflow-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-20-history-0-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-20-history-0-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-20-history-0-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-20-history-55-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-20-history-55-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-20-history-55-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-20-history-8-process-0.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-20-history-8-process-1.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-20-history-8-process-2.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/raw/artifacts-20-real-history-population.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/frozen-83d7e8f/summary.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/qualified-distributions.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/reporting-tests-final.log", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/results.md", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/root-cleanup-independent.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/tooling.json", + "docs/plans/lab-workflow-reliability/reports/m4-workflow-baseline/validation.json", + "tests/benchmark_lab_workflow.py", + "tests/test_benchmark_lab_workflow.py" + ] + }, + { + "number": 106, + "head": "feature/lab-field-comparison-20261019", + "base": "feature/lab-workflow-client-20261019", + "files": [ + ".github/workflows/tests.yml", + "agent_api.py", + "app.py", + "docs/contracts/model-development.md", + "docs/contracts/run-preflight-publication.md", + "docs/contracts/scientific-comparison.md", + "docs/plans/lab-workflow-reliability/reports/m6/evidence/agent-api-green.log", + "docs/plans/lab-workflow-reliability/reports/m6/evidence/browser-first-red.log", + "docs/plans/lab-workflow-reliability/reports/m6/evidence/browser-green.log", + "docs/plans/lab-workflow-reliability/reports/m6/evidence/browser-receipt.json", + "docs/plans/lab-workflow-reliability/reports/m6/evidence/controller-green.log", + "docs/plans/lab-workflow-reliability/reports/m6/evidence/coordinator-green.log", + "docs/plans/lab-workflow-reliability/reports/m6/evidence/domain-receipt.json", + "docs/plans/lab-workflow-reliability/reports/m6/evidence/external-controller-green.log", + "docs/plans/lab-workflow-reliability/reports/m6/evidence/field-controller-green.log", + "docs/plans/lab-workflow-reliability/reports/m6/evidence/pure-green.log", + "docs/plans/lab-workflow-reliability/reports/m6/evidence/reader-first-red.log", + "docs/plans/lab-workflow-reliability/reports/m6/evidence/reader-green.log", + "docs/plans/lab-workflow-reliability/reports/m6/evidence/retained-green.log", + "docs/plans/lab-workflow-reliability/reports/m6/evidence/schema-cleanup.json", + "docs/plans/lab-workflow-reliability/reports/m6/integration-source.md", + "docs/plans/lab-workflow-reliability/reports/m6/qualification.md", + "docs/plans/lab-workflow-reliability/reports/m6/recovery-browser-fixture/tuldok-pr106-browser-composition-green.log", + "docs/plans/lab-workflow-reliability/reports/m6/recovery-browser-fixture/tuldok-pr106-browser-composition-red.log", + "docs/plans/lab-workflow-reliability/reports/m6/recovery-browser-fixture/validation.json", + "docs/plans/lab-workflow-reliability/reports/m6/source-review.md", + "docs/plans/lab-workflow-reliability/reports/m6/validation.json", + "extension_evidence.py", + "run_publication.py", + "runs.py", + "static/workspace-real.js", + "static/workspace-scientific-comparison.js", + "static/workspaces.css", + "static/workspaces.html", + "tests/browser_scientific_comparison.cjs", + "tests/browser_workspace_recovery.cjs", + "tests/scientific_comparison_fixture.py", + "tests/test_scientific_comparison.py", + "tests/test_scientific_comparison_client.py", + "tests/test_scientific_comparison_controller.cjs", + "tests/test_workspace_external_controller.cjs" + ] + }, + { + "number": 105, + "head": "feature/lab-workflow-client-20261019", + "base": "feature/lab-phase-panel-20261019", + "files": [ + "README.md", + "agent_api.py", + "docs/contracts/agent-operations.md", + "docs/contracts/project-cli.md", + "docs/contracts/workflow-client.md", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/batch-consumer-independent-review.json", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/comparison-guard-focused.log", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/comparison-guard-http-source.json", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/comparison-guard-http.log", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/comparison-guard-red.log", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/comparison-guard-source.json", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/focused-comparison.log", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/focused-followup.log", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/focused-inventory-fix.log", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/focused-review-fixes.log", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/focused.log", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/http-attempt-01-source.json", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/http-attempt-01.log", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/http-attempt-02-source.json", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/http-attempt-02.log", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/http-review-fixes-source.json", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/http-review-fixes.log", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/legacy-client-cli-contracts-source.json", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/legacy-client-cli-contracts.log", + "docs/plans/lab-workflow-reliability/reports/m5-workflow-client/qualification.md", + "project_cli.py", + "tests/test_workflow_client.py", + "tests/test_workflow_client_http.py", + "tuldok_client.py" + ] + }, + { + "number": 104, + "head": "feature/lab-phase-panel-20261019", + "base": "test/lab-workflow-baseline-20261019", + "files": [ + ".github/workflows/tests.yml", + "app.py", + "docs/contracts/run-phase-timings.md", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/coordinator-regression/coordinator-1440.jpg", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/coordinator-regression/coordinator-390.jpg", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/coordinator-regression/domain-receipt.json", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/coordinator-regression/receipt.json", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/external-controller-fixture/tuldok-pr104-external-composition-final-source.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/external-controller-fixture/tuldok-pr104-external-composition-green.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/external-controller-fixture/tuldok-pr104-external-composition-red.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/external-controller-fixture/validation.json", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/final-phase-browser/domain-receipt.json", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/final-phase-browser/phases-1440.jpg", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/final-phase-browser/phases-390.jpg", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/final-phase-browser/receipt.json", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/publication-regression/domain-receipt.json", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/publication-regression/publication-1440.jpg", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/publication-regression/publication-390.jpg", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/publication-regression/receipt.json", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/recovery-browser-fixture/tuldok-pr104-browser-composition-green.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/recovery-browser-fixture/tuldok-pr104-browser-composition-red.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/recovery-browser-fixture/validation.json", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/tuldok-m3-same-selection-stale-fixed-repro.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/tuldok-m3-same-selection-stale-repro.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/tuldok-m3-ui-browser-final-predicate-source.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/tuldok-m3-ui-browser-final-source.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/tuldok-m3-ui-browser-first.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/tuldok-m3-ui-browser-reviewed-window-source.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/tuldok-m3-ui-browser-second.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/tuldok-m3-ui-controller-same-selection-sequential.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/tuldok-m3-ui-coordinator-ready-regression.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/tuldok-m3-ui-coordinator-regression-final-source.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/tuldok-m3-ui-native-ancestor-regression.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/tuldok-m3-ui-pins-final-source.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/tuldok-m3-ui-publication-regression-final-source.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-ui/validation.json", + "static/workspace-external.js", + "static/workspace-phase-timings.js", + "static/workspace-real.js", + "static/workspaces.css", + "static/workspaces.html", + "tests/browser_run_phase_timings.cjs", + "tests/browser_workspace_coordinator.cjs", + "tests/browser_workspace_recovery.cjs", + "tests/phase_timing_browser_fixture.py", + "tests/test_run_phase_controller.cjs", + "tests/test_workspace_external_controller.cjs", + "tests/test_workspace_phase_timings.py" + ] + }, + { + "number": 103, + "head": "feature/lab-phase-timing-20261019", + "base": "feature/lab-coordinator-panel-20261019", + "files": [ + ".github/workflows/tests.yml", + "agent_api.py", + "app.py", + "docs/contracts/run-phase-timings.md", + "docs/plans/lab-workflow-reliability/execution-ledger.md", + "docs/plans/lab-workflow-reliability/plan.md", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/integration-validation.json", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/selected-contracts.json", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/source-manifest.json", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/tuldok-m3-affected-qualified.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/tuldok-m3-core-composed-final.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/tuldok-m3-correlated-final-module.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/tuldok-m3-exact-source-qualified.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/tuldok-m3-expanded-actual.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/tuldok-m3-final-closed-evidence-qualified.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/tuldok-m3-final-qualified.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/tuldok-m3-final-reader-qualified.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/tuldok-m3-first-actual-and-m2-followup.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/tuldok-m3-first-compatibility.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/tuldok-m3-owner-final-shapes.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/tuldok-m3-owner-first.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/tuldok-m3-root-independent-qualification.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/tuldok-m3-second-compatibility.log", + "docs/plans/lab-workflow-reliability/reports/m3-phase-timing-core/validation.json", + "phase_timings.py", + "pipeline.py", + "project_cli.py", + "recipe_process.py", + "run_publication.py", + "runs.py", + "tests/fixtures/agent_contract_hashes_phase5a1feac.json", + "tests/test_run_phase_timings.py" + ] + }, + { + "number": 102, + "head": "feature/lab-coordinator-panel-20261019", + "base": "main", + "files": [ + ".github/workflows/tests.yml", + "docs/contracts/run-coordinator-recovery.md", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/README.md", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/ci-controller-fixture/tuldok-pr102-controller-composition-green.log", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/ci-controller-fixture/tuldok-pr102-controller-composition-red.log", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/ci-controller-fixture/tuldok-pr102-controller-fixture-independent-review.json", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/ci-controller-fixture/tuldok-pr102-controller-independent-green.log", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/ci-controller-fixture/tuldok-pr102-independent-lifecycle-job-118328520352.log", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/ci-controller-fixture/validation.json", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/coordinator-coordinator-1440.jpg", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/coordinator-coordinator-390.jpg", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/coordinator-domain-receipt.json", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/coordinator-receipt.json", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/publication-domain-receipt.json", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/publication-publication-1440.jpg", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/publication-publication-390.jpg", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/publication-receipt.json", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/reviewed-source-browser/coordinator-1440.jpg", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/reviewed-source-browser/coordinator-390.jpg", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/reviewed-source-browser/domain-receipt.json", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/reviewed-source-browser/receipt.json", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/tuldok-m2-coordinator-ui-browser-final-source.log", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/tuldok-m2-coordinator-ui-browser-first.log", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/tuldok-m2-coordinator-ui-controller-final-source.log", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/tuldok-m2-coordinator-ui-delivery-boundary-qualified.log", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/tuldok-m2-coordinator-ui-existing-recovery.log", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/tuldok-m2-coordinator-ui-pins-final-source.log", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/tuldok-m2-coordinator-ui-publication-regression.log", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/tuldok-m2-coordinator-ui-reviewed-source-browser.log", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/tuldok-m2-coordinator-ui-undelivered-new-key-after.log", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/tuldok-m2-coordinator-ui-undelivered-new-key-before.log", + "docs/plans/lab-workflow-reliability/reports/m2-coordinator-ui/validation.json", + "static/workspace-real.js", + "tests/browser_workspace_coordinator.cjs", + "tests/coordinator_browser_fixture.py", + "tests/test_workspace_coordinator.py", + "tests/test_workspace_coordinator_controller.cjs", + "tests/test_workspace_external_controller.cjs" + ] + } +] diff --git a/docs/plans/retained-analysis/reports/m4-integrated/browser-abort-initial.log b/docs/plans/retained-analysis/reports/m4-integrated/browser-abort-initial.log new file mode 100644 index 00000000..c1319103 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/browser-abort-initial.log @@ -0,0 +1,11 @@ +Error: {"code":-32602,"message":"Invalid InterceptionId."} + at WebSocket. (/workspace/Tuldok/tests/browser_retained_analysis_actual.cjs:51:111) + at [nodejs.internal.kHybridDispatch] (node:internal/event_target:856:20) + at WebSocket.dispatchEvent (node:internal/event_target:789:26) + at fireEvent (node:internal/deps/undici/undici:14403:14) + at #onMessage (node:internal/deps/undici/undici:15726:9) + at Object.onMessage (node:internal/deps/undici/undici:15433:76) + at websocketMessageReceived (node:internal/deps/undici/undici:14407:15) + at node:internal/deps/undici/undici:15135:21 + at node:internal/deps/undici/undici:14915:11 + at afterWrite (node:internal/streams/writable:708:5) diff --git a/docs/plans/retained-analysis/reports/m4-integrated/browser-errors.log b/docs/plans/retained-analysis/reports/m4-integrated/browser-errors.log new file mode 100644 index 00000000..e69de29b diff --git a/docs/plans/retained-analysis/reports/m4-integrated/browser.json b/docs/plans/retained-analysis/reports/m4-integrated/browser.json new file mode 100644 index 00000000..6a7db2ee --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/browser.json @@ -0,0 +1,34 @@ +{ + "status": "passed", + "evidence": "actual-PostgreSQL-native-Run-authenticated-Runs-browser", + "run_id": "3b55365925ed45b391072918503f7c5f", + "evaluation_sha256": "6cb8e64a1834bd1479735acd67a1a3426a49addf945cc03774e40ee30b69fd01", + "exact_curve": [ + { + "checkpoint_sha256": "73d96dc058a33810f87e67cf6097883b59266dee287c35df855b33666bb027c7", + "epoch": 1, + "support": 2, + "value": 0.5 + }, + { + "checkpoint_sha256": "daeb53dc1671f9b35ddece10f92364068e526dd61274deb8a134d3ac45e168a8", + "epoch": 2, + "support": 2, + "value": 0.5 + } + ], + "checks": [ + "actual named query", + "retained numeric oracle", + "linked keyboard example table", + "390px layout", + "held real response cancellation after navigation", + "authorized exact JSON export", + "real credential revocation clears private Run content", + "fresh application process and cache-bypassed page reopen", + "local chart assets", + "deployed script CSP blocks runtime code generation", + "actual denial during detail/predictions/model-evidence clears private Run content", + "held existing checkpoint action denial clears already-authorized retained view" + ] +} diff --git a/docs/plans/retained-analysis/reports/m4-integrated/controllers.log b/docs/plans/retained-analysis/reports/m4-integrated/controllers.log new file mode 100644 index 00000000..35ebbc64 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/controllers.log @@ -0,0 +1,13 @@ +PASS model UI: exact frozen probe correction, honest legacy history, observed zero, query ordering, navigation/session exclusion and denied evidence clearing. Controlled transport only. +PASS coordinator owner controls, exact generation/request identity, immutable completion, unknown-ack retention, stale read/write/session fences and storage refusal +PASS project/frozen/Run-artifact binding and generic progress controllers: exact old/new union, unavailable and oversized refusal, dirty approval invalidation, save/reopen projection, stale/session choice fences, escaped logs, truthful evidence, restored verified summaries, held polling view/session fences and session cache clearing. Mock transport only. +PASS scientific artifact import controller: exact hash/route, draft navigation, session/view/run-selection fences, non-completed/unavailable role refusal, edit permission and no replay after uncertain acknowledgement. Mock transport only. +PASS external controller: actor-bound unresolved key survives ambiguous→403; no cross-actor request; late save/reload/clone/grant/submit preserve navigation/session; initial authoritative rejection clears key. Mock transport only. +PASS phase identity/clock/duration/wait validation, latest-preparation labeling, bounded sequential refresh, abort and stale delivery/session cleanup +Scientific comparison controller: diagnostic table, exact identity, stale overlap, invalidation, revocation and session fences passed +PASS explicit pinned lineage publication status, original state, exact Ref navigation, no mutations/fanout, shared closed identity decoder and late session/navigation fences +PASS candidate UI: known admission rejection refreshes intent; response loss and later denial or package-state failure preserve actor-bound original preparation. Controlled transport only. +PASS lineage layout, cycles, read fences, busy ownership, actor-isolated writes, approval acknowledgement, remount retention and applied cohort pagination +PASS external field UI: exact declared selectors, shared display range, exact numeric probes, stale selector/navigation exclusion, revoked-value clearing and unsupported legacy/physical time. Controlled transport only. +PASS publication metadata, pinned status2, owner/actor controls, unknown-ack stable request, source/hash identity, stale reads/writes and polling cleanup +PASS controlled external package view: owned discovery, pending versus fresh state, source identity, denial/stale clearing and passive-only reads. diff --git a/docs/plans/retained-analysis/reports/m4-integrated/existing-runs-browsers.log b/docs/plans/retained-analysis/reports/m4-integrated/existing-runs-browsers.log new file mode 100644 index 00000000..124e7888 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/existing-runs-browsers.log @@ -0,0 +1,2 @@ +PASS coordinator browser: /workspace/Tuldok/build/qa/workspace-coordinator/run-QaqeLX +{"state":"passed","report":"/workspace/Tuldok/build/qa/scientific-comparison/run-Lz4m8U","checks":["Actual lineage opens exact ordered operands; selection causes no comparison/admission; keyboard submission returns independent expected delta 2 and explicit unknown criteria/memory.","1440/390px tables retain all values and keyboard scrolling without page overflow.","Actual overlapping HTTP responses clear pending values and fence stale delivery after exact point changes.","Exact attached publication Ref uses real publication readers and preserves original interrupted state.","Removed retained root refuses fresh candidate selection and clears prior values.","Actual browser credential revocation clears the session and all cached scientific values after the refused read."]} diff --git a/docs/plans/retained-analysis/reports/m4-integrated/http-initial.log b/docs/plans/retained-analysis/reports/m4-integrated/http-initial.log new file mode 100644 index 00000000..ec083201 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/http-initial.log @@ -0,0 +1,58 @@ +test_actual_revocation_blocks_fresh_http_and_export (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_actual_revocation_blocks_fresh_http_and_export) ... ok +test_authenticated_http_and_export_equal_real_query (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_authenticated_http_and_export_equal_real_query) ... ok +test_closed_request_rejects_sql_and_holdout_without_exposure (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_closed_request_rejects_sql_and_holdout_without_exposure) ... + test_closed_request_rejects_sql_and_holdout_without_exposure (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_closed_request_rejects_sql_and_holdout_without_exposure) (body={'sql': 'SELECT arbitrary_data'}) ... FAIL + test_closed_request_rejects_sql_and_holdout_without_exposure (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_closed_request_rejects_sql_and_holdout_without_exposure) (body={'split': 'test'}) ... FAIL + test_closed_request_rejects_sql_and_holdout_without_exposure (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_closed_request_rejects_sql_and_holdout_without_exposure) (body={'limit': 101}) ... FAIL +test_explicit_contract_and_route_bound_run_are_required (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_explicit_contract_and_route_bound_run_are_required) ... ok +test_stale_and_foreign_selection_never_returns_dataset (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_stale_and_foreign_selection_never_returns_dataset) ... ok + +====================================================================== +FAIL: test_closed_request_rejects_sql_and_holdout_without_exposure (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_closed_request_rejects_sql_and_holdout_without_exposure) (body={'sql': 'SELECT arbitrary_data'}) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/workspace/Tuldok/tests/test_retained_analysis_http.py", line 100, in test_closed_request_rejects_sql_and_holdout_without_exposure + self.assertEqual((status, value['code']), (409, 'contract_mismatch')) +AssertionError: Tuples differ: (400, 'invalid') != (409, 'contract_mismatch') + +First differing element 0: +400 +409 + +- (400, 'invalid') ++ (409, 'contract_mismatch') + +====================================================================== +FAIL: test_closed_request_rejects_sql_and_holdout_without_exposure (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_closed_request_rejects_sql_and_holdout_without_exposure) (body={'split': 'test'}) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/workspace/Tuldok/tests/test_retained_analysis_http.py", line 100, in test_closed_request_rejects_sql_and_holdout_without_exposure + self.assertEqual((status, value['code']), (409, 'contract_mismatch')) +AssertionError: Tuples differ: (400, 'invalid') != (409, 'contract_mismatch') + +First differing element 0: +400 +409 + +- (400, 'invalid') ++ (409, 'contract_mismatch') + +====================================================================== +FAIL: test_closed_request_rejects_sql_and_holdout_without_exposure (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_closed_request_rejects_sql_and_holdout_without_exposure) (body={'limit': 101}) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/workspace/Tuldok/tests/test_retained_analysis_http.py", line 100, in test_closed_request_rejects_sql_and_holdout_without_exposure + self.assertEqual((status, value['code']), (409, 'contract_mismatch')) +AssertionError: Tuples differ: (400, 'invalid') != (409, 'contract_mismatch') + +First differing element 0: +400 +409 + +- (400, 'invalid') ++ (409, 'contract_mismatch') + +---------------------------------------------------------------------- +Ran 5 tests in 0.970s + +FAILED (failures=3) diff --git a/docs/plans/retained-analysis/reports/m4-integrated/http-tests.log b/docs/plans/retained-analysis/reports/m4-integrated/http-tests.log new file mode 100644 index 00000000..32b2d635 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/http-tests.log @@ -0,0 +1,10 @@ +test_actual_revocation_blocks_fresh_http_and_export (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_actual_revocation_blocks_fresh_http_and_export) ... ok +test_authenticated_http_and_export_equal_real_query (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_authenticated_http_and_export_equal_real_query) ... ok +test_closed_request_rejects_sql_and_holdout_without_exposure (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_closed_request_rejects_sql_and_holdout_without_exposure) ... ok +test_explicit_contract_and_route_bound_run_are_required (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_explicit_contract_and_route_bound_run_are_required) ... ok +test_stale_and_foreign_selection_never_returns_dataset (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_stale_and_foreign_selection_never_returns_dataset) ... ok + +---------------------------------------------------------------------- +Ran 5 tests in 0.896s + +OK diff --git a/docs/plans/retained-analysis/reports/m4-integrated/independent/browser-errors.log b/docs/plans/retained-analysis/reports/m4-integrated/independent/browser-errors.log new file mode 100644 index 00000000..e69de29b diff --git a/docs/plans/retained-analysis/reports/m4-integrated/independent/browser.json b/docs/plans/retained-analysis/reports/m4-integrated/independent/browser.json new file mode 100644 index 00000000..6a7db2ee --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/independent/browser.json @@ -0,0 +1,34 @@ +{ + "status": "passed", + "evidence": "actual-PostgreSQL-native-Run-authenticated-Runs-browser", + "run_id": "3b55365925ed45b391072918503f7c5f", + "evaluation_sha256": "6cb8e64a1834bd1479735acd67a1a3426a49addf945cc03774e40ee30b69fd01", + "exact_curve": [ + { + "checkpoint_sha256": "73d96dc058a33810f87e67cf6097883b59266dee287c35df855b33666bb027c7", + "epoch": 1, + "support": 2, + "value": 0.5 + }, + { + "checkpoint_sha256": "daeb53dc1671f9b35ddece10f92364068e526dd61274deb8a134d3ac45e168a8", + "epoch": 2, + "support": 2, + "value": 0.5 + } + ], + "checks": [ + "actual named query", + "retained numeric oracle", + "linked keyboard example table", + "390px layout", + "held real response cancellation after navigation", + "authorized exact JSON export", + "real credential revocation clears private Run content", + "fresh application process and cache-bypassed page reopen", + "local chart assets", + "deployed script CSP blocks runtime code generation", + "actual denial during detail/predictions/model-evidence clears private Run content", + "held existing checkpoint action denial clears already-authorized retained view" + ] +} diff --git a/docs/plans/retained-analysis/reports/m4-integrated/independent/contracts.log b/docs/plans/retained-analysis/reports/m4-integrated/independent/contracts.log new file mode 100644 index 00000000..c6922ce2 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/independent/contracts.log @@ -0,0 +1,8 @@ +test_closed_bounded_arguments (test_retained_analysis_contracts.RetainedAnalysisContractTests.test_closed_bounded_arguments) ... ok +test_new_inspect_contracts_match_browser_pins (test_retained_analysis_contracts.RetainedAnalysisContractTests.test_new_inspect_contracts_match_browser_pins) ... ok +test_registry_and_existing_contract_bytes_are_unchanged (test_retained_analysis_contracts.RetainedAnalysisContractTests.test_registry_and_existing_contract_bytes_are_unchanged) ... ok + +---------------------------------------------------------------------- +Ran 3 tests in 1.891s + +OK diff --git a/docs/plans/retained-analysis/reports/m4-integrated/independent/http-tests.log b/docs/plans/retained-analysis/reports/m4-integrated/independent/http-tests.log new file mode 100644 index 00000000..cd833120 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/independent/http-tests.log @@ -0,0 +1,10 @@ +test_actual_revocation_blocks_fresh_http_and_export (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_actual_revocation_blocks_fresh_http_and_export) ... ok +test_authenticated_http_and_export_equal_real_query (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_authenticated_http_and_export_equal_real_query) ... ok +test_closed_request_rejects_sql_and_holdout_without_exposure (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_closed_request_rejects_sql_and_holdout_without_exposure) ... ok +test_explicit_contract_and_route_bound_run_are_required (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_explicit_contract_and_route_bound_run_are_required) ... ok +test_stale_and_foreign_selection_never_returns_dataset (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_stale_and_foreign_selection_never_returns_dataset) ... ok + +---------------------------------------------------------------------- +Ran 5 tests in 0.949s + +OK diff --git a/docs/plans/retained-analysis/reports/m4-integrated/independent/identity-compatibility.json b/docs/plans/retained-analysis/reports/m4-integrated/independent/identity-compatibility.json new file mode 100644 index 00000000..9b276ae9 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/independent/identity-compatibility.json @@ -0,0 +1,10 @@ +{ + "comparison_base": "83a1e1289f3f7e4f8c3e697c1748a862a69d0897", + "checked_prior_contract_documents": 124, + "changed_prior_contract_documents": [], + "legacy_discovery_exact_equal": true, + "added_operations": [ + "runs.export_retained_analysis", + "runs.retained_analysis" + ] +} diff --git a/docs/plans/retained-analysis/reports/m4-integrated/independent/model-controller.log b/docs/plans/retained-analysis/reports/m4-integrated/independent/model-controller.log new file mode 100644 index 00000000..97e906b3 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/independent/model-controller.log @@ -0,0 +1 @@ +PASS model UI: exact frozen probe correction, honest legacy history, observed zero, query ordering, navigation/session exclusion and denied evidence clearing. Controlled transport only. diff --git a/docs/plans/retained-analysis/reports/m4-integrated/independent/review.md b/docs/plans/retained-analysis/reports/m4-integrated/independent/review.md new file mode 100644 index 00000000..f9c42773 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/independent/review.md @@ -0,0 +1,23 @@ +# Final independent review + +Reviewer: separate GPT-6.1 Sol High Codex instance (`query_review`). +Verdict: **Approved; no remaining blocking findings** against reliability83a1e128. + +Reviewed the query, new registry contracts and selected route, bounded transport, +Run lifecycle/authority, pinned assets/spec, scoped CSP and additive CI/test +changes. Earlier review findings (ordinary Run denial propagation, null identity +cleanup, deployed CSP, and old checkpoint/candidate denial paths) are resolved. +The central model wrapper captures source Run, credential and generation before +dispatch; forwards current denials before presentation catches; excludes aborted +or invalidated requests; and preserves the original transport arguments. + +Independent execution: contracts3 passed; actual authenticated HTTP5 passed; +model controller passed; actual Runs Chromium passed with empty browser errors. +The browser included the held checkpoint denial after successful retained-query +rerender, deployed CSP, cancellation, authorized export and fresh-process reopen. +All124 prior contract documents and legacy discovery match the reliability base +exactly. See adjacent logs, compatibility receipt and source-sha256.json. The +final18-file source manifest was verified against the publication files. + +Only review evidence was written by the reviewer. No implementation, service, +credential or training changes were made. Lead alone owns merge. diff --git a/docs/plans/retained-analysis/reports/m4-integrated/independent/source-sha256.json b/docs/plans/retained-analysis/reports/m4-integrated/independent/source-sha256.json new file mode 100644 index 00000000..81bd5544 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/independent/source-sha256.json @@ -0,0 +1,20 @@ +{ + ".github/workflows/tests.yml": "100feb4cbcbd84cddc991602c24d196ee1a1f3e4b23b383adbcb49366453e38d", + "agent_api.py": "bb14a25c63840f1701b13657fa1bce4659a2c6a180068e95f461e5fa7f9327b4", + "app.py": "c71b8b903fa8905ff5fd3ccaef1b86d3df3ddda5393f33bf3ec9661a98d02417", + "retained_analysis.py": "d41f805419f6acff08175b61d3bce9a611de8025cbf5bccc3ccf08e809479501", + "retained_analysis_schema.py": "8d6a743567eab6b99e9132721eabd12e7a381c742c84911e6ef58478a0ea43d3", + "runs.py": "b701532d0bf5c77ee87676fa3bbfbf9759ae45370c28d45765b2eac538a4547e", + "model_evidence.py": "04012022740f45fc03ad11351a7efe4946e574890bb814fcdf5871b873a5701b", + "static/retained-analysis.js": "d9dab53d15e6e50ecf8f1b9e182c43eb330c4731e574758a0e3026f44acb44df", + "static/retained-checkpoint-curve.vl.json": "6603c860ce76a434a11e6c96cf7418246ce2dd5da3d7a56a5f2448a0537ec183", + "static/workspace-real.js": "de4036bab21c3ca2702488658a9fa8733cf0adb822f4ec3322d5e101a96b60a2", + "static/workspace-service.js": "568b8258c35e6b3ca2cfe08b64d914111e16ae98d45f5d40f7aa40a20c20098b", + "static/workspaces.html": "a85e465d317e8aaa14c5349ef1ae6b2dc75ac440e0cea2c5c5a313dbd4fb828e", + "static/workspaces.css": "3d0eacbd50425b4cd2ce9cfacdf5bcdb8fe533d7a57248f16325242f625cd278", + "tests/test_retained_analysis_contracts.py": "44811b92c4ae847888d34d949eea8b22a79d4bd0edfc0e27e0963377a0103e5f", + "tests/test_retained_analysis_http.py": "eff09d89bdad94c78af4c558d79d0dabf7bd9d502f0ced6df83163023f2dee44", + "tests/test_workspace_model_controller.cjs": "a4ac7eab2546d4e9d27c0350219cf5bcdbe82cc29193a9553958b4e2ea650245", + "tests/browser_retained_analysis_actual.cjs": "615e24368965ce4e97f75a0c05d63f9ae06cc28c13d864130691141ac8eefc3d", + "static/vendor/retained-analysis/manifest.json": "298dbcaf1a3852db247cd781ef60c620d67c6ddfdcd646cae38a321368a280a5" +} diff --git a/docs/plans/retained-analysis/reports/m4-integrated/query-http-tests.log b/docs/plans/retained-analysis/reports/m4-integrated/query-http-tests.log new file mode 100644 index 00000000..b7ab673a --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/query-http-tests.log @@ -0,0 +1,32 @@ +test_parameterized_curve_and_stable_error_page_on_actual_postgres (test_retained_analysis.ActualPostgresSqlTests.test_parameterized_curve_and_stable_error_page_on_actual_postgres) ... ok +test_exact_frozen_examples_and_retained_confidence (test_retained_analysis.ProjectionTests.test_exact_frozen_examples_and_retained_confidence) ... ok +test_foreign_metric_checkpoint_and_population_are_distinct_failures (test_retained_analysis.ProjectionTests.test_foreign_metric_checkpoint_and_population_are_distinct_failures) ... ok +test_unsupported_task_and_oversize_are_explicit (test_retained_analysis.ProjectionTests.test_unsupported_task_and_oversize_are_explicit) ... ok +test_catalog_mismatch_is_refused (test_retained_analysis.QueryBoundaryTests.test_catalog_mismatch_is_refused) ... ok +test_error_filter_does_not_change_metric_population_and_page_identity (test_retained_analysis.QueryBoundaryTests.test_error_filter_does_not_change_metric_population_and_page_identity) ... ok +test_exact_provenance_and_values_with_fresh_access_outside_snapshot (test_retained_analysis.QueryBoundaryTests.test_exact_provenance_and_values_with_fresh_access_outside_snapshot) ... ok +test_export_and_repeated_retrieval_do_not_bypass_current_authority (test_retained_analysis.QueryBoundaryTests.test_export_and_repeated_retrieval_do_not_bypass_current_authority) ... ok +test_malformed_catalog_envelope_preserves_typed_failure (test_retained_analysis.QueryBoundaryTests.test_malformed_catalog_envelope_preserves_typed_failure) ... ok +test_nested_transaction_and_oversized_response_refused (test_retained_analysis.QueryBoundaryTests.test_nested_transaction_and_oversized_response_refused) ... ok +test_revocation_during_read_prevents_return (test_retained_analysis.QueryBoundaryTests.test_revocation_during_read_prevents_return) ... ok +test_closed_bounds_and_types_before_evidence_read (test_retained_analysis.RequestTests.test_closed_bounds_and_types_before_evidence_read) ... ok +test_defaults_and_explicit_field_projection (test_retained_analysis.RequestTests.test_defaults_and_explicit_field_projection) ... ok +test_actual_sql_curve_and_examples_equal_original_retained_artifacts (test_retained_analysis_actual.ActualRetainedAnalysisTests.test_actual_sql_curve_and_examples_equal_original_retained_artifacts) ... ok +test_new_process_cold_reopen_preserves_exact_result (test_retained_analysis_actual.ActualRetainedAnalysisTests.test_new_process_cold_reopen_preserves_exact_result) ... ok +test_query_and_export_are_inert_and_restore_session_settings (test_retained_analysis_actual.ActualRetainedAnalysisTests.test_query_and_export_are_inert_and_restore_session_settings) ... ok +test_real_credential_revocation_blocks_repeated_query_and_export (test_retained_analysis_actual.ActualRetainedAnalysisTests.test_real_credential_revocation_blocks_repeated_query_and_export) ... ok +test_repeated_query_reverifies_hash_bound_artifact (test_retained_analysis_actual.ActualRetainedAnalysisTests.test_repeated_query_reverifies_hash_bound_artifact) ... ok +test_revocation_at_final_authorization_uses_current_real_credential (test_retained_analysis_actual.ActualRetainedAnalysisTests.test_revocation_at_final_authorization_uses_current_real_credential) ... ok +test_closed_bounded_arguments (test_retained_analysis_contracts.RetainedAnalysisContractTests.test_closed_bounded_arguments) ... ok +test_new_inspect_contracts_match_browser_pins (test_retained_analysis_contracts.RetainedAnalysisContractTests.test_new_inspect_contracts_match_browser_pins) ... ok +test_registry_and_existing_contract_bytes_are_unchanged (test_retained_analysis_contracts.RetainedAnalysisContractTests.test_registry_and_existing_contract_bytes_are_unchanged) ... ok +test_actual_revocation_blocks_fresh_http_and_export (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_actual_revocation_blocks_fresh_http_and_export) ... ok +test_authenticated_http_and_export_equal_real_query (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_authenticated_http_and_export_equal_real_query) ... ok +test_closed_request_rejects_sql_and_holdout_without_exposure (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_closed_request_rejects_sql_and_holdout_without_exposure) ... ok +test_explicit_contract_and_route_bound_run_are_required (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_explicit_contract_and_route_bound_run_are_required) ... ok +test_stale_and_foreign_selection_never_returns_dataset (test_retained_analysis_http.ActualRetainedAnalysisHttpTests.test_stale_and_foreign_selection_never_returns_dataset) ... ok + +---------------------------------------------------------------------- +Ran 27 tests in 3.852s + +OK diff --git a/docs/plans/retained-analysis/reports/m4-integrated/regressions.log b/docs/plans/retained-analysis/reports/m4-integrated/regressions.log new file mode 100644 index 00000000..9e66a275 --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/regressions.log @@ -0,0 +1,56 @@ +test_actual_catalog_mutex_wait_is_measured_by_owner_without_reconstructing_events (test_run_phase_timings.ActualPhaseTimingTests.test_actual_catalog_mutex_wait_is_measured_by_owner_without_reconstructing_events) ... ok +test_actual_queue_copy_fault_recovery_and_cold_read_preserve_original_authority (test_run_phase_timings.ActualPhaseTimingTests.test_actual_queue_copy_fault_recovery_and_cold_read_preserve_original_authority) ... ok +test_missing_or_foreign_custodian_diagnostics_cannot_change_completed_result (test_run_phase_timings.ActualPhaseTimingTests.test_missing_or_foreign_custodian_diagnostics_cannot_change_completed_result) ... ok +test_overlapping_same_actor_preparations_expose_latest_clock_without_rebinding_old_reply (test_run_phase_timings.ActualPhaseTimingTests.test_overlapping_same_actor_preparations_expose_latest_clock_without_rebinding_old_reply) ... ok +test_pre_run_preparation_is_live_actor_revision_scoped_and_has_no_run_effect (test_run_phase_timings.ActualPhaseTimingTests.test_pre_run_preparation_is_live_actor_revision_scoped_and_has_no_run_effect) ... ok +test_real_capacity_wait_single_go_and_active_cancel_keep_observations_separate (test_run_phase_timings.ActualPhaseTimingTests.test_real_capacity_wait_single_go_and_active_cancel_keep_observations_separate) ... ok +test_selected_http_cli_old_run_unknown_and_bounded_catalog_wait (test_run_phase_timings.ActualPhaseTimingTests.test_selected_http_cli_old_run_unknown_and_bounded_catalog_wait) ... ok +test_all_open_span_cap_reports_each_missing_observation_without_closing_owners (test_run_phase_timings.OwnerPhaseTimingTests.test_all_open_span_cap_reports_each_missing_observation_without_closing_owners) ... ok +test_client_correlates_exact_run_catalog_graph_revision_and_never_retries (test_run_phase_timings.OwnerPhaseTimingTests.test_client_correlates_exact_run_catalog_graph_revision_and_never_retries) ... ok +test_closed_wire_refuses_duplicate_clocks_forged_durations_and_waits (test_run_phase_timings.OwnerPhaseTimingTests.test_closed_wire_refuses_duplicate_clocks_forged_durations_and_waits) ... ok +test_full_baseline_contracts_and_legacy_discovery_are_identical (test_run_phase_timings.OwnerPhaseTimingTests.test_full_baseline_contracts_and_legacy_discovery_are_identical) ... ok +test_history_and_long_lived_open_span_are_bounded_without_false_duration (test_run_phase_timings.OwnerPhaseTimingTests.test_history_and_long_lived_open_span_are_bounded_without_false_duration) ... ok +test_open_snapshot_cold_reopen_and_failed_phase_never_invent_an_end (test_run_phase_timings.OwnerPhaseTimingTests.test_open_snapshot_cold_reopen_and_failed_phase_never_invent_an_end) ... ok +test_overlapping_owner_spans_use_monotonic_time_and_are_not_added (test_run_phase_timings.OwnerPhaseTimingTests.test_overlapping_owner_spans_use_monotonic_time_and_are_not_added) ... ok + +---------------------------------------------------------------------- +Ran 14 tests in 16.878s + +OK +test_absolute_header_deadline_includes_trickle (test_agent_api.ClientTests.test_absolute_header_deadline_includes_trickle) ... ok +test_authenticated_discovery_proxy_ignored_and_one_mutation (test_agent_api.ClientTests.test_authenticated_discovery_proxy_ignored_and_one_mutation) ... ok +test_fixed_endpoint_and_private_configuration (test_agent_api.ClientTests.test_fixed_endpoint_and_private_configuration) ... ok +test_framing_identity_registry_refusals (test_agent_api.ClientTests.test_framing_identity_registry_refusals) ... ok +test_three_file_sequence_is_unsupported_before_http_dispatch (test_agent_api.ClientTests.test_three_file_sequence_is_unsupported_before_http_dispatch) ... ok +test_unknown_commit_is_not_retried_or_secret_echoed (test_agent_api.ClientTests.test_unknown_commit_is_not_retried_or_secret_echoed) ... ok +test_segment_reassembly_and_whole_hash_tamper (test_agent_api.OutputTests.test_segment_reassembly_and_whole_hash_tamper) ... ok +test_typed_error_and_success_shapes (test_agent_api.OutputTests.test_typed_error_and_success_shapes) ... ok +test_image_forwards_exact_raw_base64 (test_agent_api.ParityRegressionTests.test_image_forwards_exact_raw_base64) ... ok +test_revoked_discovery_preserves_http_status_and_code_without_mutation (test_agent_api.ParityRegressionTests.test_revoked_discovery_preserves_http_status_and_code_without_mutation) ... ok +test_all_operation_schemas_and_route_projections (test_agent_api.RegistryTests.test_all_operation_schemas_and_route_projections) ... ok +test_bindings_known_graph_drafts_and_no_executable_topology_requirement (test_agent_api.RegistryTests.test_bindings_known_graph_drafts_and_no_executable_topology_requirement) ... ok +test_discovery_is_stdlib_only_in_cold_process (test_agent_api.RegistryTests.test_discovery_is_stdlib_only_in_cold_process) ... ok +test_draft_tasks_and_no_human_or_programmatic_review (test_agent_api.RegistryTests.test_draft_tasks_and_no_human_or_programmatic_review) ... ok +test_exposure_grant_and_projection (test_agent_api.RegistryTests.test_exposure_grant_and_projection) ... ok +test_import_bytes_bound_is_aggregate (test_agent_api.RegistryTests.test_import_bytes_bound_is_aggregate) ... ok +test_integer_unicode_nonfinite_and_closed_subobjects (test_agent_api.RegistryTests.test_integer_unicode_nonfinite_and_closed_subobjects) ... ok + +---------------------------------------------------------------------- +Ran 17 tests in 37.883s + +OK +test_agent_review_and_execution_denied_before_mutation (test_access_http.AccessHTTP.test_agent_review_and_execution_denied_before_mutation) ... ok +test_all_legacy_and_current_reads_require_real_credentials (test_access_http.AccessHTTP.test_all_legacy_and_current_reads_require_real_credentials) ... ok +test_cookie_origin_mixed_transport_and_bootstrap_replay (test_access_http.AccessHTTP.test_cookie_origin_mixed_transport_and_bootstrap_replay) ... ok +test_denial_audit_storage_outage_still_returns_structured_error (test_access_http.AccessHTTP.test_denial_audit_storage_outage_still_returns_structured_error) ... ok + +---------------------------------------------------------------------- +Ran 4 tests in 2.453s + +OK +test_phase_contract_pins_match_complete_selected_contracts (test_workspace_phase_timings.PhasePanelPins.test_phase_contract_pins_match_complete_selected_contracts) ... ok + +---------------------------------------------------------------------- +Ran 1 test in 0.001s + +OK diff --git a/docs/plans/retained-analysis/reports/m4-integrated/renderer.json b/docs/plans/retained-analysis/reports/m4-integrated/renderer.json new file mode 100644 index 00000000..a4122f3d --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/renderer.json @@ -0,0 +1,18 @@ +{ + "status": "passed", + "evidence": "actual-headless-Chromium-authored-renderer-fixture", + "checks": [ + "strict CSP/interpreter", + "self-hosted/offline external assets", + "exact numbers", + "keyboard linked selection/focus", + "visible error filter", + "390px layout", + "stale reply after revocation", + "malformed/oversized response and spec rejection", + "support/ordinal/provenance/type validation", + "fresh export authorization path", + "cold page reopen", + "dispose" + ] +} diff --git a/docs/plans/retained-analysis/reports/m4-integrated/source-checkpoint.json b/docs/plans/retained-analysis/reports/m4-integrated/source-checkpoint.json new file mode 100644 index 00000000..77e3016f --- /dev/null +++ b/docs/plans/retained-analysis/reports/m4-integrated/source-checkpoint.json @@ -0,0 +1,89 @@ +{ + "format": "retained_analysis_source_checkpoint_v1", + "branch": "feature/retained-analysis-query-20261019", + "reliability_dependency": "83a1e1289f3f7e4f8c3e697c1748a862a69d0897", + "composition_merge": "252a68c5b90afdd8660f652cfa0094233ef9f64f", + "main": "8c9c0b07d90fd78657539cdcbcd23fbf289c4f95", + "files": { + ".github/workflows/tests.yml": "100feb4cbcbd84cddc991602c24d196ee1a1f3e4b23b383adbcb49366453e38d", + "agent_api.py": "bb14a25c63840f1701b13657fa1bce4659a2c6a180068e95f461e5fa7f9327b4", + "app.py": "c71b8b903fa8905ff5fd3ccaef1b86d3df3ddda5393f33bf3ec9661a98d02417", + "examples/analysis/requirements.txt": "4d9f3531962ab894b827643750dbcedd56c2c25d5a18339c69ce9b8f913433eb", + "examples/analysis/retained_checkpoint_curve.py": "dce74b88c13f85f272734da5876d96bfcef746074ece0027f9f57532de767f8f", + "retained_analysis.py": "d41f805419f6acff08175b61d3bce9a611de8025cbf5bccc3ccf08e809479501", + "retained_analysis_schema.py": "8d6a743567eab6b99e9132721eabd12e7a381c742c84911e6ef58478a0ea43d3", + "static/retained-analysis.js": "d9dab53d15e6e50ecf8f1b9e182c43eb330c4731e574758a0e3026f44acb44df", + "static/retained-checkpoint-curve.vl.json": "6603c860ce76a434a11e6c96cf7418246ce2dd5da3d7a56a5f2448a0537ec183", + "static/vendor/retained-analysis/licenses/d3-array.txt": "552e22a104bb752daf35286bfc180b7bb6c206cc6502853979bd19390102d644", + "static/vendor/retained-analysis/licenses/d3-color.txt": "decfad6f87be1e200338d792b77793997db27b3f4e610f870370393ed53daf4b", + "static/vendor/retained-analysis/licenses/d3-delaunay.txt": "718da82757e9041ac674c157d9fc70435543b32f4c1baf4a9f08b71c5fa6495e", + "static/vendor/retained-analysis/licenses/d3-dispatch.txt": "2127431ebe97ddcbabb32b1049bade99e4c4b2412d3f8b39ec161814f5e2e11e", + "static/vendor/retained-analysis/licenses/d3-dsv.txt": "2823e0d11f6e134bfe32ec3b60f042db2d7be3e4eb3e7f09b7c93a3bef502ec3", + "static/vendor/retained-analysis/licenses/d3-force.txt": "2127431ebe97ddcbabb32b1049bade99e4c4b2412d3f8b39ec161814f5e2e11e", + "static/vendor/retained-analysis/licenses/d3-format.txt": "dfd3916622f5f66f001a5c9ec0beb6d4b0208b9ba41a81206bf6fa0940b6e980", + "static/vendor/retained-analysis/licenses/d3-geo-projection.txt": "8d78a83093868a5a6d86835807514b0f5bda66403a0d75cbf804ad72a3619463", + "static/vendor/retained-analysis/licenses/d3-geo.txt": "e3243e2788023f118b725d27189d529d13da89dca0801380a9ecf96da3a5fa67", + "static/vendor/retained-analysis/licenses/d3-hierarchy.txt": "2127431ebe97ddcbabb32b1049bade99e4c4b2412d3f8b39ec161814f5e2e11e", + "static/vendor/retained-analysis/licenses/d3-interpolate.txt": "2127431ebe97ddcbabb32b1049bade99e4c4b2412d3f8b39ec161814f5e2e11e", + "static/vendor/retained-analysis/licenses/d3-path.txt": "16d2d2a1800677ddece729f5acb30205b5acbc21529df90cd8bf3d202c08d0b7", + "static/vendor/retained-analysis/licenses/d3-quadtree.txt": "2127431ebe97ddcbabb32b1049bade99e4c4b2412d3f8b39ec161814f5e2e11e", + "static/vendor/retained-analysis/licenses/d3-scale-chromatic.txt": "b982e295bd298c8d3e328a7cc623396e6e708fb6fba5b35e2dc4daf36728c8ed", + "static/vendor/retained-analysis/licenses/d3-scale.txt": "2127431ebe97ddcbabb32b1049bade99e4c4b2412d3f8b39ec161814f5e2e11e", + "static/vendor/retained-analysis/licenses/d3-shape.txt": "decfad6f87be1e200338d792b77793997db27b3f4e610f870370393ed53daf4b", + "static/vendor/retained-analysis/licenses/d3-time-format.txt": "2127431ebe97ddcbabb32b1049bade99e4c4b2412d3f8b39ec161814f5e2e11e", + "static/vendor/retained-analysis/licenses/d3-time.txt": "decfad6f87be1e200338d792b77793997db27b3f4e610f870370393ed53daf4b", + "static/vendor/retained-analysis/licenses/d3-timer.txt": "2127431ebe97ddcbabb32b1049bade99e4c4b2412d3f8b39ec161814f5e2e11e", + "static/vendor/retained-analysis/licenses/delaunator.txt": "9994d103e3af6ded25bad0ae99f08f6758f08cb9b261ab921ae7a6279769cdf0", + "static/vendor/retained-analysis/licenses/fast-json-patch.txt": "488a71c4303f0860094c1e59fa32e3302e9e79e2b63b8731761c22c2101c1dc9", + "static/vendor/retained-analysis/licenses/internmap.txt": "c596ec7154f49d5b5354b5483891de003b9af0f127aa007a6c5cea659e53d7c4", + "static/vendor/retained-analysis/licenses/json-stringify-pretty-compact.txt": "0454b235e715629194c3a1efb8b5a1b5c4a26bea9e8d54f4061b603d34cbea18", + "static/vendor/retained-analysis/licenses/robust-predicates.txt": "4731daf16265d7f0acd5c305a2dc745cf4c7562e027d44c206ab38637d8558ab", + "static/vendor/retained-analysis/licenses/semver.txt": "3ef9e4a3ab62e8eebd271519b275803e13e59a790cbdca7f617cbff34c56ed80", + "static/vendor/retained-analysis/licenses/topojson-client.txt": "140e4489d9507aedeb615404008fe1d51b418b7cdb428ea840481105c14eda97", + "static/vendor/retained-analysis/licenses/vega-canvas.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-crossfilter.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-embed.txt": "9ba0f1b61d8bb4c228264ed5305c543914fa0fd3f3e302623138a3f93d649304", + "static/vendor/retained-analysis/licenses/vega-encode.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-event-selector.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-force.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-geo.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-hierarchy.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-interpreter.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-label.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-lite.txt": "1d88c9e50bf518513f0db4b4faff48d26fce5591025277a79f687f1961fe5ed8", + "static/vendor/retained-analysis/licenses/vega-parser.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-projection.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-regression.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-runtime.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-schema-url-parser.txt": "886fb7d90ade30e3ddb1509c644b649738f4461427d128d278b41e0894175881", + "static/vendor/retained-analysis/licenses/vega-statistics.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-themes.txt": "0344cdac38613ef402506fb143f7e37fb4cd91aead07a51ebfe916a32909f3d6", + "static/vendor/retained-analysis/licenses/vega-tooltip.txt": "6dbbe75e03459c41a0d380bbf85c2221d817733e603960d674c0de546f7daee1", + "static/vendor/retained-analysis/licenses/vega-transforms.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-view-transforms.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-view.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-voronoi.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega-wordcloud.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/licenses/vega.txt": "b686cdefc306925f182fce89952147997ef214e8c2a8c9b7bb3f5084edffcc76", + "static/vendor/retained-analysis/manifest.json": "298dbcaf1a3852db247cd781ef60c620d67c6ddfdcd646cae38a321368a280a5", + "static/vendor/retained-analysis/vega-embed.min.js": "12d02acfbe3ec59ef9a37dd4822a2e04e2961b5bbb671bbe661d2221715b99da", + "static/vendor/retained-analysis/vega-interpreter.min.js": "13002339c7e6231ef919584cbdf7391b246ea5073f686ffd707c62628b7f87df", + "static/vendor/retained-analysis/vega-lite.min.js": "58c27358e26f2d319cf62f45bc17a4c8362f08645001df2ec8d341eee4097c7f", + "static/vendor/retained-analysis/vega.min.js": "a71f14828abacac82fbe8adb07ce65cbb82561d8eef188053c4a1c09e0164dcb", + "static/workspace-real.js": "de4036bab21c3ca2702488658a9fa8733cf0adb822f4ec3322d5e101a96b60a2", + "static/workspace-service.js": "568b8258c35e6b3ca2cfe08b64d914111e16ae98d45f5d40f7aa40a20c20098b", + "static/workspaces.css": "3d0eacbd50425b4cd2ce9cfacdf5bcdb8fe533d7a57248f16325242f625cd278", + "static/workspaces.html": "a85e465d317e8aaa14c5349ef1ae6b2dc75ac440e0cea2c5c5a313dbd4fb828e", + "tests/browser_retained_analysis.cjs": "822d6df2d8c29e909f6f0dcee42595f90c9eae70306ff9c8b20eba042bdd05ce", + "tests/browser_retained_analysis_actual.cjs": "615e24368965ce4e97f75a0c05d63f9ae06cc28c13d864130691141ac8eefc3d", + "tests/fixtures/retained-analysis-browser.css": "9210e84315e07086621a859a18ba7e9744ed4fc5b267119ecccbee4ec3ec99fb", + "tests/fixtures/retained-analysis-browser.js": "20693914724c187875e53b79198280c197b93256cc542bbdb74e7799b9789e8b", + "tests/retained_analysis_actual_fixture.py": "5e8759c7715de85b8df886727d11335cc913d78d178b3d787e09778aab29ff55", + "tests/retained_analysis_browser_fixture.py": "ececc679267b6e8671ab3fb189ca093f53bf874ad5d9469df0b36ff008f7ad62", + "tests/test_retained_analysis.py": "10ab4c7ad35c9df868320add066799a18896538ee59593156d4b52b0b2d1a11a", + "tests/test_retained_analysis_actual.py": "255abedd2980dd36deee27ae0a12c1f1e3870c3c92c3203bea334ae7bfd8e651", + "tests/test_retained_analysis_contracts.py": "44811b92c4ae847888d34d949eea8b22a79d4bd0edfc0e27e0963377a0103e5f", + "tests/test_retained_analysis_http.py": "eff09d89bdad94c78af4c558d79d0dabf7bd9d502f0ced6df83163023f2dee44", + "tests/test_workspace_model_controller.cjs": "a4ac7eab2546d4e9d27c0350219cf5bcdbe82cc29193a9553958b4e2ea650245" + } +} diff --git a/docs/plans/retained-analysis/reports/project-startup-ci-20261020/acceptance.md b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/acceptance.md new file mode 100644 index 00000000..858f31ff --- /dev/null +++ b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/acceptance.md @@ -0,0 +1,57 @@ +# Project action startup qualification + +Base is the failed published PR111 head +`0ba4db01f04a77c262eb4b397f88849e9688b5ab`; branch +`fix/workspace-project-startup-ci-20261020` is owned by this repair. Root owns +serial publication and composition into the caption descendant. The production +write set is one initial `disabled` attribute in `static/workspaces.html` and +one owner-controlled enable in `static/workspace-projects.js`, after its action, +form and disposal listeners are installed. No API, source-data or scientific +contract changes. + +The [hosted failure disposition](hosted-failure-disposition.json) is the preserved +historical observation: run39360310903/job118424712559 failed the first project +open wait at59:77. Its [excerpt](hosted-failure-excerpt.log), exact raw/log hashes +and paths remain bound in [qualification](qualification.json). The hosted log +has no pointer/listener trace; its exact cause remains untraced. + +The [controlled red](original-entrypoint-delayed-red.log) runs the unmodified +0ba4 default scientific entrypoint with only actual module delivery delayed by +[the qualification driver](delay-project-module.cjs). It observes an enabled +button with null handler, an exact native pointer hit on `open-project`, and a +closed dialog. After the actual module bytes are released, the handler exists +and fixtures are ready, but the original missed action still times out at the +same59:77/64 path. No responses, handlers or source data are replaced. This proves +the controlled startup failure and excludes a geometry miss for that journey; +it does not invent a trace of the hosted scheduling. + +The [complete green default entrypoint](scientific-fields-green.log) holds the +actual owning module, verifies disabled initial markup and exact pointer hit, +proves an early disabled pointer cannot open a partial flow, releases the module +and runs the original native open/import/scientific journey. It passes all five +original checks plus the startup check: stale-hash refusal, exact time/stage/ +dtype/planes/signed-zero geometry, human review and frozen release, independent +cold NumPy custody, held import navigation fencing and actual app restart. +No scientific or model-quality acceptance is claimed. The [receipt](receipt.json) +binds all four changed source files and actual before/after control states. + +The [controller regression](controller.log), also awaited by the existing CI +entrypoint, proves module evaluation leaves the control disabled and owning +construction installs action/form/teardown before enabling. It then opens the +dialog synchronously and performs only an inspection read. The existing +[page-load barrier](page-load.log), three Node syntax checks and diff check pass. + +Local qualification uses actual PostgreSQL17.6, Python3.12.14, Chromium151 and +normal app/HTTP with existing headless/no-sandbox/disable-gpu flags. All three +exact preregistered schemas are [queried absent](green-cleanup.json); green had +two records, one project and zero Runs before disposal. Main owned children +exited before [initial temporary removal](cleanup.json). Brief Chrome descendant +cache recreation was observed; [post-exit exact-path cleanup](post-exit-temporary-cleanup.json) +records final removal after no matching processes remained. No process was +killed by inferred PID, and no unrelated catalog or path was touched. + +The clean task worktree `/workspace/Tuldok-project-startup-ci-repair-20261020` +is retained-protected by the repair branch for root's review and serial +integration. Root owns its later safe disposition. No108/112 source or ref was +changed. Independent review and new GitHub lifecycle execution remain separate +from these local evidence claims. diff --git a/docs/plans/retained-analysis/reports/project-startup-ci-20261020/cleanup.json b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/cleanup.json new file mode 100644 index 00000000..6d198929 --- /dev/null +++ b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/cleanup.json @@ -0,0 +1,21 @@ +{ + "temporary": "/tmp/tuldok-fields-browser-XT8B2u", + "removed": true, + "children": [ + { + "pid": 114816, + "exit_code": 0, + "signal": null + }, + { + "pid": 114823, + "exit_code": 0, + "signal": null + }, + { + "pid": 115078, + "exit_code": null, + "signal": "SIGTERM" + } + ] +} diff --git a/docs/plans/retained-analysis/reports/project-startup-ci-20261020/controller.log b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/controller.log new file mode 100644 index 00000000..52f31f69 --- /dev/null +++ b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/controller.log @@ -0,0 +1 @@ +PASS project startup markup disabled; owning constructor binds action, form and teardown before enable; first action opens synchronously and reads only diff --git a/docs/plans/retained-analysis/reports/project-startup-ci-20261020/delay-project-module.cjs b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/delay-project-module.cjs new file mode 100644 index 00000000..4e6812bf --- /dev/null +++ b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/delay-project-module.cjs @@ -0,0 +1,31 @@ +'use strict'; +// Qualification-only protocol timing: no responses or application handlers are substituted. +const Native=globalThis.WebSocket; +globalThis.WebSocket=class extends Native{ + constructor(...args){ + super(...args);this.nextInternal=100000000;this.callbacks=new Map();this.held=null;this.armed=false;this.witnessed=false;this.firstReleased=false;this.continued=false; + this.addEventListener('message',event=>{ + const value=JSON.parse(event.data); + if(this.callbacks.has(value.id)){const callback=this.callbacks.get(value.id);this.callbacks.delete(value.id);callback(value);} + if(value.method==='Fetch.requestPaused'&&value.params.request.url.endsWith('/workspace-projects.js')){this.held=value.params.requestId;console.log('STARTUP held actual workspace-projects.js response');this.releaseIfClicked();} + }); + } + own(method,params,callback=()=>{}){const id=++this.nextInternal;this.callbacks.set(id,callback);super.send(JSON.stringify({id,method,params}));} + send(raw){ + const value=JSON.parse(raw); + if(value.method==='Page.navigate'&&value.params.url.endsWith('/workspaces')&&!this.armed){this.armed=true;this.own('Fetch.enable',{patterns:[{urlPattern:'*/workspace-projects.js',requestStage:'Response'}]},()=>super.send(raw));return;} + if(value.method==='Input.dispatchMouseEvent'&&value.params.type==='mousePressed'&&!this.witnessed){ + this.witnessed=true;this.own('Runtime.evaluate',{expression:`JSON.stringify({disabled:document.getElementById('open-project').disabled,handler:typeof document.getElementById('open-project').onclick,dialog:document.getElementById('project-open-dialog').open,hit:document.elementFromPoint(${value.params.x},${value.params.y})?.id})`,returnByValue:true},reply=>{console.log('STARTUP before original first pointer click',reply.result?.result?.value);super.send(raw);});return; + } + super.send(raw); + if(this.witnessed&&value.method==='Input.dispatchMouseEvent'&&value.params.type==='mouseReleased'){this.firstReleased=true;this.releaseIfClicked();} + } + releaseIfClicked(){ + if(!this.held||!this.firstReleased||this.continued)return; + this.continued=true;const requestId=this.held;this.held=null; + setTimeout(()=>this.own('Fetch.continueRequest',{requestId},()=>{ + this.own('Fetch.disable',{}); + setTimeout(()=>this.own('Runtime.evaluate',{expression:"JSON.stringify({disabled:document.getElementById('open-project').disabled,handler:typeof document.getElementById('open-project').onclick,dialog:document.getElementById('project-open-dialog').open,status:document.getElementById('workspace-status').textContent})",returnByValue:true},reply=>console.log('STARTUP after original click and actual module release',reply.result?.result?.value)),500); + }),500); + } +}; diff --git a/docs/plans/retained-analysis/reports/project-startup-ci-20261020/green-cleanup.json b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/green-cleanup.json new file mode 100644 index 00000000..4aa10ba5 --- /dev/null +++ b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/green-cleanup.json @@ -0,0 +1,17 @@ +{ + "schema": "catalog_b15679e0a444459a83f1acce6dd3909d", + "reserved_before_creation": true, + "owned_children_exited": true, + "final_temporary_removed": true, + "counts": { + "workbench_records": 2, + "workspace_runs": 0, + "workspace_projects": 1 + }, + "removed_and_queried_absent": true, + "prior_red_schemas_rechecked_absent": [ + "catalog_a91651e7b01d45148d63ee0e3d87c82d", + "catalog_978e63d9ab6a49bc9b673eb0569f8f11" + ], + "observed_at": "2026-10-20T04:27:51.019863+00:00" +} diff --git a/docs/plans/retained-analysis/reports/project-startup-ci-20261020/hosted-failure-disposition.json b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/hosted-failure-disposition.json new file mode 100644 index 00000000..9611d2b6 --- /dev/null +++ b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/hosted-failure-disposition.json @@ -0,0 +1,27 @@ +{ + "observed_utc": "2026-10-20T04:20:09.421507+00:00", + "head": "0ba4db01f04a77c262eb4b397f88849e9688b5ab", + "run": 39360310903, + "job": 118424712559, + "conclusion": "failure", + "failed_steps": [ + { + "name": "Run node tests/browser_scientific_fields.cjs", + "status": "completed", + "conclusion": "failure", + "number": 44, + "started_at": "2026-10-20T04:15:40Z", + "completed_at": "2026-10-20T04:16:43Z" + } + ], + "successful_steps": 48, + "skipped_steps": 124, + "failure_location": "browser_scientific_fields.cjs openProject line59column77: firstdialog.open&&!submit.disabled wait", + "caption_race_equivalence": false, + "diagnosis": "Possible open-project control interactive before initializer handler ready; cause remains unproven until deterministic actual browser reproduction. Alternative dialog/roots availability still under independent examination.", + "decoded_log_sha256": "0c279bc15ca1488a9445b03763192fd6f4ab85c9c8ec1b8acb36d538a18b0e2b", + "source_author": "/root/pr111_ci_repair", + "independent_diagnosis_and_review": "/root/mcp_contract_ci_review", + "merge_clearance": false, + "other_pending_lifecycle_is_not_acceptance": true +} diff --git a/docs/plans/retained-analysis/reports/project-startup-ci-20261020/hosted-failure-excerpt.log b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/hosted-failure-excerpt.log new file mode 100644 index 00000000..7553362d --- /dev/null +++ b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/hosted-failure-excerpt.log @@ -0,0 +1,8 @@ +2026-10-20T04:16:43.4038356Z Error: Timed out +2026-10-20T04:16:43.4039321Z at until (/home/runner/work/Tuldok/Tuldok/tests/browser_scientific_fields.cjs:23:138) +2026-10-20T04:16:43.4040950Z at async openProject (/home/runner/work/Tuldok/Tuldok/tests/browser_scientific_fields.cjs:59:77) +2026-10-20T04:16:43.4042783Z at async /home/runner/work/Tuldok/Tuldok/tests/browser_scientific_fields.cjs:64:3 +2026-10-20T04:16:43.4043678Z Application stderr: +2026-10-20T04:16:43.4075107Z {"url":"http://127.0.0.1:33627/workspaces","body":"Local owner · owner\nSession\nSign out\nSkip to workspace\nt.\nTuldok\n/ Workspaces\n● Local\nClassic workbench ↗\nCorner studio ↗\nCONTEXT\nDataset\nInterface fixtures\nCurrent local catalog\nOpen project\nfixture-dataset-v1 · 0 selected · authored CC0 examples · release fixture-release-v1\nLocal preview\n01\nData\n02\nPipeline\n03\nRuns\nInspect → compose → understand\n\nFixture workspace ready.\n\nYOUR SOURCE OF TRUTH\nData\n\nInspect records, keep their evidence, review deliberately.\n\nAuthored fixtures · isolated from your catalog. These seven tiny examples show contracts and capability states. Choose “Current local catalog” above to import, annotate, review and freeze real data.\n\nRecords\n7 fixtures\n▧\nShapes / blue square\nimage · fixture\nT\nA short field note\ntext · fixture\n≋\nTwo synthetic pulses\naudio · fixture\n◇\nAuthored tetrahedron\nmesh · fixture\n∴\nFour indexed points\npoint cloud · fixture\n▦\nAnisotropic grid\nvolume · fixture\n↝\nThree authored frames\nsequence · fixture\n0 selected · source and annotation r1\nFixture selection never freezes a real release.\nShapes / blue square\nFixture\n128 × 128 · authored representation\nimage_classification_v1\nSaved: draft · r1\nSource identity\nfixture-image · source r1\nRights note\nAuthored demonstration data; CC0-1.0.\nReview\nAuthored draft. No human review or release admission is implied.\nRepresentation, hash and source provenance\nANNOTATION\nClass draft\nClass label\nSaved fixture draft\nSave fixture draft\n\nSaves a new browser-local draft revision. It does not create review evidence or a frozen release.\n\nCURRENT CATALOG CAPABILITY\nAvailable in bounded scope\nClass, caption, detection and corner editors in the current catalog. Reviewed image releases support the bounded TinyCNN CPU recipe.\nNext qualification\nOther image tasks need their own qualified training recipes\nOpen current catalog →\nTuldok · Dataset-centered workspaces\nFixtures are isolated examples. Current catalog runs use an optional local CPU runtime.","frame":""} +2026-10-20T04:16:43.4490513Z ##[error]Process completed with exit code 1. +2026-10-20T04:16:43.4923379Z ##[group]Run actions/upload-artifact@v4 diff --git a/docs/plans/retained-analysis/reports/project-startup-ci-20261020/original-entrypoint-delayed-red.log b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/original-entrypoint-delayed-red.log new file mode 100644 index 00000000..6cfc96b4 --- /dev/null +++ b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/original-entrypoint-delayed-red.log @@ -0,0 +1,9 @@ +STARTUP before original first pointer click {"disabled":false,"handler":"object","dialog":false,"hit":"open-project"} +STARTUP held actual workspace-projects.js response +STARTUP after original click and actual module release {"disabled":false,"handler":"function","dialog":false,"status":"Fixture workspace ready."} +Error: Timed out + at until (/workspace/Tuldok-project-startup-ci-repair-20261020/tests/browser_scientific_fields.cjs:23:138) + at async openProject (/workspace/Tuldok-project-startup-ci-repair-20261020/tests/browser_scientific_fields.cjs:59:77) + at async /workspace/Tuldok-project-startup-ci-repair-20261020/tests/browser_scientific_fields.cjs:64:3 +Application stderr: +{"url":"http://127.0.0.1:32885/workspaces","body":"Local owner · owner\nSession\nSign out\nSkip to workspace\nt.\nTuldok\n/ Workspaces\n● Local\nClassic workbench ↗\nCorner studio ↗\nCONTEXT\nDataset\nInterface fixtures\nCurrent local catalog\nOpen project\nfixture-dataset-v1 · 0 selected · authored CC0 examples · release fixture-release-v1\nLocal preview\n01\nData\n02\nPipeline\n03\nRuns\nInspect → compose → understand\n\nFixture workspace ready.\n\nYOUR SOURCE OF TRUTH\nData\n\nInspect records, keep their evidence, review deliberately.\n\nAuthored fixtures · isolated from your catalog. These seven tiny examples show contracts and capability states. Choose “Current local catalog” above to import, annotate, review and freeze real data.\n\nRecords\n7 fixtures\n▧\nShapes / blue square\nimage · fixture\nT\nA short field note\ntext · fixture\n≋\nTwo synthetic pulses\naudio · fixture\n◇\nAuthored tetrahedron\nmesh · fixture\n∴\nFour indexed points\npoint cloud · fixture\n▦\nAnisotropic grid\nvolume · fixture\n↝\nThree authored frames\nsequence · fixture\n0 selected · source and annotation r1\nFixture selection never freezes a real release.\nShapes / blue square\nFixture\n128 × 128 · authored representation\nimage_classification_v1\nSaved: draft · r1\nSource identity\nfixture-image · source r1\nRights note\nAuthored demonstration data; CC0-1.0.\nReview\nAuthored draft. No human review or release admission is implied.\nRepresentation, hash and source provenance\nANNOTATION\nClass draft\nClass label\nSaved fixture draft\nSave fixture draft\n\nSaves a new browser-local draft revision. It does not create review evidence or a frozen release.\n\nCURRENT CATALOG CAPABILITY\nAvailable in bounded scope\nClass, caption, detection and corner editors in the current catalog. Reviewed image releases support the bounded TinyCNN CPU recipe.\nNext qualification\nOther image tasks need their own qualified training recipes\nOpen current catalog →\nTuldok · Dataset-centered workspaces\nFixtures are isolated examples. Current catalog runs use an optional local CPU runtime.","frame":""} diff --git a/docs/plans/retained-analysis/reports/project-startup-ci-20261020/page-load.log b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/page-load.log new file mode 100644 index 00000000..fdf5a678 --- /dev/null +++ b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/page-load.log @@ -0,0 +1 @@ +CDP reopen barrier rejects old documents, subframes and mismatched lifecycle events. diff --git a/docs/plans/retained-analysis/reports/project-startup-ci-20261020/post-exit-temporary-cleanup.json b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/post-exit-temporary-cleanup.json new file mode 100644 index 00000000..579fdb74 --- /dev/null +++ b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/post-exit-temporary-cleanup.json @@ -0,0 +1,12 @@ +{ + "temporary": "/tmp/tuldok-fields-browser-XT8B2u", + "immediate_harness_removed": true, + "late_browser_cache_reappearance_observed": true, + "late_files": [ + "browser/Default/Cache/Cache_Data/index-dir/the-real-index", + "browser/Default/Network Persistent State" + ], + "matching_catalog_browser_or_crashpad_processes": [], + "exact_owned_path_removed_after_post_exit_recheck": true, + "limit": "Main owned handles exited before initial removal; brief browser descendants recreated cache after initial cleanup. No process was killed or unrelated path removed." +} diff --git a/docs/plans/retained-analysis/reports/project-startup-ci-20261020/qualification.json b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/qualification.json new file mode 100644 index 00000000..3a38b39d --- /dev/null +++ b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/qualification.json @@ -0,0 +1,71 @@ +{ + "base_head": "0ba4db01f04a77c262eb4b397f88849e9688b5ab", + "source_sha256": { + "static/workspaces.html": "c16bf3ad0872b8f40f9d00ad6f2ae6366d2c3193aafa80bb496bbf3a41c183cd", + "static/workspace-projects.js": "3f465ad13a9f6bea9c7e812507510b4b5469e7569d7a1c22884115b6628a4747", + "tests/browser_scientific_fields.cjs": "9803d43c119bff759a771171b115f5878a22a1941ebf8de8c0e2a4361f3e0636", + "tests/test_workspace_project_startup.cjs": "0e4d00fbd3f67a8c5839864f2ad406597d91b253f116f526e551221d9f1ebd0a" + }, + "hosted_failure": { + "run": 39360310903, + "job": 118424712559, + "head": "0ba4db01f04a77c262eb4b397f88849e9688b5ab", + "decoded_log": "/tmp/tuldok-pr111-0ba4-failed-lifecycle-job-118424712559.log", + "decoded_log_sha256": "0c279bc15ca1488a9445b03763192fd6f4ab85c9c8ec1b8acb36d538a18b0e2b", + "raw_response": "/tmp/tuldok-pr111-0ba4-failed-lifecycle-job-118424712559-raw.json", + "raw_response_sha256": "cf1345c3cda4b58bd5053e29b4a5dd643e662b502eaf15c2558b67722401fec7", + "causal_limit": "Original host supplied no pointer/listener trace; startup cause is proven for controlled real reproduction, not asserted as traced host cause.", + "excerpt_projection": "Same excerpt lines with trailing whitespace removed; full exact raw/decoded logs preserved at their recorded paths." + }, + "controlled_original_entrypoint_red": { + "command": "node --require /tmp/tuldok-project-startup-repair/delay-project-module.cjs tests/browser_scientific_fields.cjs", + "entrypoint_source": "Unmodified exact0ba4", + "exit_code": 1, + "pointer_hit": "open-project", + "pre_click_disabled": false, + "pre_click_handler": "object/null", + "after_actual_module_release": { + "handler": "function", + "dialog_open": false, + "workspace_status": "Fixture workspace ready." + }, + "failed_assertion": "same first openProject wait at59:77 and entrypoint64", + "mechanism": "Hold/release actual module bytes through Fetch; no fulfilled responses or application callback substitution", + "raw_log": { + "path": "/tmp/tuldok-project-startup-repair/original-entrypoint-delayed-red.log", + "sha256": "b799d3a232afa255cd79de8c5f3210c879dc1097ebb059f54e183c3b75f3b413", + "committed_projection": "Same lines with trailing whitespace removed; exact raw preserved at this path." + } + }, + "green": { + "command": "node tests/browser_scientific_fields.cjs", + "exit_code": 0, + "startup_native_pointer": { + "before": { + "disabled": true, + "handler": "object", + "dialog": false, + "hit": "open-project", + "x": 348.2734375, + "y": 98 + }, + "after": { + "disabled": false, + "handler": "function", + "project": "project:cccccccccccccccccccccccccccccccc" + } + }, + "original_scientific_checks_retained": true, + "controller_regression_in_existing_CI_entrypoint": true, + "physics_acceptance": false, + "model_or_training_acceptance": false + }, + "environment": { + "postgres": "PostgreSQL 17.6 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit", + "python": "Python 3.12.14", + "browser": "Chrome/151.0.7922.173", + "node": "v24.19.0", + "mode": "Headless existing no-sandbox/disable-gpu flags; isolated profile; actual app/HTTP/PostgreSQL/NumPy independent cold reader" + }, + "resource_disposition": "All3 preregistered owned schemas queried absent. Main owned children stopped before initial removal. Brief browser descendant cache recreation was observed; final exact-path removal after no matching processes is recorded separately. No unrelated paths/processes touched." +} diff --git a/docs/plans/retained-analysis/reports/project-startup-ci-20261020/receipt.json b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/receipt.json new file mode 100644 index 00000000..044e8179 --- /dev/null +++ b/docs/plans/retained-analysis/reports/project-startup-ci-20261020/receipt.json @@ -0,0 +1,390 @@ +{ + "source_commit": "0ba4db01f04a77c262eb4b397f88849e9688b5ab", + "dirty": true, + "command": "node tests/browser_scientific_fields.cjs", + "capture_receipt_sha256": null, + "qualification": "Producer-neutral authored rotated noncubic fields; transport/UI/custody only", + "physics_acceptance": false, + "model_or_training_acceptance": false, + "source_files_sha256": { + "static/workspaces.html": "c16bf3ad0872b8f40f9d00ad6f2ae6366d2c3193aafa80bb496bbf3a41c183cd", + "static/workspace-projects.js": "3f465ad13a9f6bea9c7e812507510b4b5469e7569d7a1c22884115b6628a4747", + "tests/browser_scientific_fields.cjs": "9803d43c119bff759a771171b115f5878a22a1941ebf8de8c0e2a4361f3e0636", + "tests/test_workspace_project_startup.cjs": "0e4d00fbd3f67a8c5839864f2ad406597d91b253f116f526e551221d9f1ebd0a" + }, + "startup": { + "before": { + "disabled": true, + "handler": "object", + "dialog": false, + "hit": "open-project", + "x": 348.2734375, + "y": 98 + }, + "after": { + "disabled": false, + "handler": "function", + "project": "project:cccccccccccccccccccccccccccccccc" + } + }, + "checks": [ + "Delayed actual project module keeps the pointer-hit control disabled; its owner enables the original first open and full project inspection", + "Opening remains read-only; explicit import refuses stale observed hash before catalog writes, then imports exact bytes", + "All authored fields and X/Y/Z planes retain exact time/stage/dtype; rotated noncubic origin and signed zero inspected", + "Wholeasset human inspection freezes canonical release; separate NumPy reader verifies exact recovered original payload and opaque sources", + "Held import refresh preserves a newer explicit clean-record selection instead of opening the newly imported record", + "Restart retains reviewed field record and exact release; original project bytes unchanged and no execution submitted" + ], + "captures": [ + { + "file": "scientific-inspector-1440.jpg", + "width": 1440, + "height": 900, + "qualification": "Transport, inspection and custody only; no physics or model qualification" + }, + { + "file": "scientific-inspector-390.jpg", + "width": 390, + "height": 900, + "qualification": "Transport, inspection and custody only; no physics or model qualification" + } + ], + "source_sha256": "32d79d5e4c8881fcfd6c858b70e485c61a636ac1e8ea7d4dbd6c52c7bdc47ed7", + "cold": { + "scope": "Cold NumPy dtype/shape/element bytes, declared coordinates/time/stages and opaque source custody only", + "numpy": "2.5.4", + "bundle_sha256": "32d79d5e4c8881fcfd6c858b70e485c61a636ac1e8ea7d4dbd6c52c7bdc47ed7", + "native_capture": false, + "model_or_training_acceptance": false, + "physics_acceptance": false, + "arrays": [ + { + "frame": 0, + "field": "scalar", + "dtype": "'validation'->>%s)::double precision AS value, + (h->'validation'->>'examples')::integer AS support +FROM workspace_runs r +CROSS JOIN LATERAL jsonb_array_elements(r.document::jsonb->'metrics'->'history') h +JOIN checkpoints c ON c.epoch=(h->>'epoch')::integer +WHERE r.id=%s +ORDER BY c.epoch +LIMIT %s +''' + +# Only bounded scalar rows enter this projection. Large probability arrays and +# all original hash-bound bytes stay in managed evidence artifacts. +EXAMPLES_SQL = ''' +WITH examples AS ( + SELECT * FROM jsonb_to_recordset(%s::jsonb) + AS e(ordinal integer, example_id text, truth_index integer, + predicted_index integer, confidence double precision, error boolean, + frozen_reference jsonb) +), filtered AS ( + SELECT * FROM examples WHERE (NOT %s OR error) +), page AS ( + SELECT * FROM filtered ORDER BY ordinal LIMIT %s OFFSET %s +) +SELECT (SELECT count(*) FROM filtered) AS filtered_support, + coalesce((SELECT jsonb_agg(to_jsonb(p) ORDER BY p.ordinal) FROM page p), '[]'::jsonb) AS rows +''' + + +def validate_request(body): + """Decode a complete closed variant before any evidence or catalog read.""" + closed(body, ('query_id', 'query_version', 'run_id', 'evaluation_sha256', + 'checkpoint_sha256', 'metric_id', 'metric_definition_sha256'), + ('fields', 'errors_only', 'limit', 'offset')) + if (body['query_id'] != QUERY_ID or type(body['query_version']) is not int + or body['query_version'] != QUERY_VERSION): + raise WorkbenchError('Unsupported retained analysis query.', 'unsupported', 409) + identifier(body['run_id'], 'Run ID') + for key in ('evaluation_sha256', 'checkpoint_sha256', 'metric_definition_sha256'): + if type(body[key]) is not str or not HASH.fullmatch(body[key]): + raise WorkbenchError('Retained analysis requires exact SHA256 identities.') + if type(body['metric_id']) is not str or body['metric_id'] not in METRICS: + raise WorkbenchError('Choose a declared validation metric.') + fields = body.get('fields', list(FIELDS)) + if (type(fields) is not list or not fields or len(fields) > len(FIELDS) + or any(type(field) is not str or field not in FIELDS for field in fields) + or len(set(fields)) != len(fields) or 'example_id' not in fields): + raise WorkbenchError('Choose unique declared fields including example_id.') + limit, offset = body.get('limit', 50), body.get('offset', 0) + if type(limit) is not int or not 1 <= limit <= MAX_PAGE: + raise WorkbenchError('Retained analysis page limit must be 1–100.') + if type(offset) is not int or not 0 <= offset <= MAX_OFFSET: + raise WorkbenchError('Retained analysis offset must be 0–10000.') + errors_only = body.get('errors_only', False) + if type(errors_only) is not bool: + raise WorkbenchError('errors_only must be a boolean.') + return dict(body, fields=list(fields), limit=limit, offset=offset, errors_only=errors_only) + + +def _refuse(message, code='invalid', status=409): + raise WorkbenchError(message, code, status) + + +@contextmanager +def _read_snapshot(db): + with db.connection.transaction(): + db.execute('SET TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ ONLY') + db.execute("SELECT set_config('statement_timeout', %s, true)", (str(SQL_TIMEOUT_MS),)) + db.execute("SELECT set_config('lock_timeout', %s, true)", (str(SQL_TIMEOUT_MS),)) + yield + + +def _retained_run(db, request): + # Refuse a stale result before the expensive existing artifact verifier. + # Repeat this check inside the SQL snapshot to close the intervening gap. + stored = db.execute('''SELECT CASE WHEN octet_length(document)<=%s THEN document ELSE NULL END AS document + FROM workspace_runs WHERE id=%s''', + (MAX_DOCUMENT_BYTES, request['run_id'])).fetchone() + if stored is None: + _refuse('Retained Run is unavailable.', 'not_found', 404) + if stored['document'] is None: + _refuse('Retained Run document exceeds this query budget.', 'limit', 413) + try: + run = json.loads(stored['document']) + artifact = [item for item in run['artifacts'] if item['name'] == 'model-evidence.json'] + state, run_id = run['state'], run['id'] + actual_hash = artifact[0]['sha256'] if len(artifact) == 1 else None + except (ValueError, KeyError, TypeError): + _refuse('Retained Run envelope is unavailable.', 'unavailable', 409) + if actual_hash != request['evaluation_sha256']: + _refuse('Retained evaluation snapshot differs.', 'stale') + if state != 'completed' or run_id != request['run_id']: + _refuse('Retained analysis requires a completed Run.', 'unavailable', 503) + return run + + +def _projection(evidence, request): + """Project the native verified variant; other task owners remain explicit.""" + if (evidence.get('state') != 'verified' + or evidence.get('manifest', {}).get('format') != 'model_evidence_v1'): + _refuse('Retained analysis requires verified native classifier evidence.', 'unsupported') + definitions = [item for item in evidence['metric_definitions'] if item['id'] == request['metric_id']] + if len(definitions) != 1 or digest(definitions[0]) != request['metric_definition_sha256']: + _refuse('Retained analysis metric definition differs.', 'stale') + definition = definitions[0] + if definition['split'] != 'validation': + _refuse('Retained analysis only supports frozen validation.', 'unsupported') + entries = evidence['checkpoint_index']['entries'] + if not 1 <= len(entries) <= MAX_CHECKPOINTS: + _refuse('Retained checkpoint count exceeds this query budget.', 'limit', 413) + checkpoints = [{'checkpoint_sha256': item['checkpoint']['sha256'], 'epoch': item['clocks']['epoch']} + for item in entries] + if any(type(item['epoch']) is not int or item['epoch'] < 1 for item in checkpoints): + _refuse('Retained analysis requires epoch-based classifier evidence.', 'unsupported') + if request['checkpoint_sha256'] not in {item['checkpoint_sha256'] for item in checkpoints}: + _refuse('Checkpoint does not belong to this result.', 'not_found', 404) + predictions = evidence['predictions'] + if (predictions is None or predictions['checkpoint_sha256'] != request['checkpoint_sha256'] + or predictions['probe_sha256'] != evidence['manifest']['probe']['sha256']): + _refuse('Selected checkpoint predictions differ.', 'stale') + members = evidence['probe']['members'] + if len(members) > MAX_EXAMPLES: + _refuse('Frozen example population exceeds this query budget.', 'limit', 413) + by_ordinal = {member['ordinal']: member for member in members} + if len(by_ordinal) != len(members) or len(predictions['rows']) != len(members): + _refuse('Frozen example membership differs.') + rows = [] + seen = set() + for row in predictions['rows']: + ordinal = row['ordinal'] + if ordinal not in by_ordinal or ordinal in seen: + _refuse('Frozen example ordinal differs.') + seen.add(ordinal) + frozen = by_ordinal[ordinal]['frozen_reference'] + confidence = row['probabilities'][row['predicted_index']] + if type(confidence) not in (int, float) or not math.isfinite(confidence) or not 0 <= confidence <= 1: + _refuse('Frozen prediction confidence differs.') + rows.append({'ordinal': ordinal, 'example_id': frozen['id'], 'frozen_reference': frozen, + 'truth_index': row['truth_index'], 'predicted_index': row['predicted_index'], + 'confidence': confidence, 'error': row['truth_index'] != row['predicted_index']}) + if len({row['example_id'] for row in rows}) != len(rows): + _refuse('Frozen example IDs are ambiguous.') + raw = canonical(rows) + if len(raw) > MAX_PROJECTION_BYTES: + _refuse('Frozen scalar projection exceeds this query budget.', 'limit', 413) + return definition, checkpoints, raw.decode('ascii') + + +def query(runs, body, *, export=False): + """Read one exact result; callable by a later explicitly registered HTTP hook. + + No cache or download URL is returned. An export must call this boundary + again. Final authorization happens outside the read snapshot, so revocation + committed during verification/query cannot be hidden by Repeatable Read. + """ + request = validate_request(body) + if type(export) is not bool: + raise TypeError('export must be a host-owned boolean') + action = 'runs.export_retained_analysis' if export else 'runs.retained_analysis' + run_id = request['run_id'] + db = runs.db + with db.lock.bounded(time.monotonic() + LOCK_SECONDS): + runs.access.require('inspect', action, run_id) + # SET TRANSACTION must own its snapshot, never alter a caller's write + # transaction or check current revocation inside an inherited snapshot. + if db.connection.info.transaction_status != TransactionStatus.IDLE: + _refuse('Retained analysis requires a standalone read.', 'unavailable', 503) + with _read_snapshot(db): + _retained_run(db, request) + evidence = runs.model_evidence(run_id, {'checkpoint_sha256': request['checkpoint_sha256']}, + contract_version=1) + definition, checkpoints, example_json = _projection(evidence, request) + with _read_snapshot(db): + _retained_run(db, request) + curve = [dict(row) for row in db.execute(CURVE_SQL, + (canonical(checkpoints).decode('ascii'), request['metric_id'], run_id, MAX_CHECKPOINTS + 1))] + expected = {item['checkpoint_sha256']: item for item in evidence['observations'] + if item['metric_id'] == request['metric_id'] and item['split'] == 'validation'} + if len(curve) != len(checkpoints): + _refuse('Catalog curve coverage differs from retained checkpoints.') + for point in curve: + observation = expected.get(point['checkpoint_sha256']) + if (observation is None or observation['state'] != 'observed' + or point['epoch'] != observation['clocks']['epoch'] + or point['value'] != observation['value'] or point['support'] != observation['sample_count']): + _refuse('Catalog curve differs from retained metric observations.') + page = db.execute(EXAMPLES_SQL, (example_json, request['errors_only'], + request['limit'], request['offset'])).fetchone() + selected_rows = [{key: row[key] for key in (*request['fields'], 'ordinal', 'frozen_reference')} + for row in page['rows']] + provenance = {'catalog_id': db.dataset_id, 'run_id': run_id, + 'evaluation_sha256': request['evaluation_sha256'], + 'checkpoint_sha256': request['checkpoint_sha256'], + 'metric_definition_sha256': request['metric_definition_sha256'], + 'population_sha256': definition['population_sha256'], + 'probe_sha256': evidence['manifest']['probe']['sha256'], + 'data_sha256': evidence['manifest']['data_sha256'], + 'producer': evidence['manifest']['producer']} + count = page['filtered_support'] + result = {'state': 'verified', 'query_id': QUERY_ID, 'query_version': QUERY_VERSION, + 'mode': 'frozen', 'provenance': provenance, + 'metric': {'id': definition['id'], 'units': definition['units'], + 'definition': definition, 'support': len(evidence['probe']['members'])}, + 'curve': curve, 'columns': _columns(request['fields']), + 'examples': {'rows': selected_rows, 'population_support': len(evidence['probe']['members']), + 'filtered_support': count, 'offset': request['offset'], 'limit': request['limit'], + 'next_offset': request['offset'] + len(selected_rows) + if request['offset'] + len(selected_rows) < count else None, + 'filters': {'errors_only': request['errors_only']}}, + 'sampling': {'method': 'none', 'population': 'frozen_validation_probe'}, + 'selection_sha256': digest(request)} + if len(canonical(result)) > MAX_RESPONSE_BYTES: + _refuse('Retained analysis response exceeds this query budget.', 'limit', 413) + runs.access.require('inspect', action, run_id) + return result + + +def _columns(fields): + types = {'example_id': 'string', 'truth_index': 'integer', 'predicted_index': 'integer', + 'confidence': 'number', 'error': 'boolean'} + return [{'field': field, 'type': types[field], + 'units': 'dimensionless' if field == 'confidence' else None} for field in fields] diff --git a/retained_analysis_schema.py b/retained_analysis_schema.py new file mode 100644 index 00000000..3d511f5a --- /dev/null +++ b/retained_analysis_schema.py @@ -0,0 +1,55 @@ +"""Closed v1 retained classifier query schemas; standard-library-only discovery.""" +QUERY_ID = 'retained_checkpoint_examples' +QUERY_VERSION = 1 +FIELDS = ('example_id', 'truth_index', 'predicted_index', 'confidence', 'error') + + +def schemas(obj, text, integer, array, const, identifier, sha): + """Use the operation registry's ordinary schema constructors without imports.""" + natural = integer(0, 2**53 - 1) + support = integer(0, 10000) + nullable_offset = {'oneOf': [integer(0, 10000), {'type': 'null'}]} + metric_id = {'enum': ['accuracy', 'loss', 'macro_f1']} + fields = dict(array({'enum': list(FIELDS)}, len(FIELDS), 1), uniqueItems=True, + contains=const('example_id')) + request = obj({'query_id': const(QUERY_ID), 'query_version': const(QUERY_VERSION), + 'run_id': identifier, 'evaluation_sha256': sha, 'checkpoint_sha256': sha, + 'metric_id': metric_id, 'metric_definition_sha256': sha, 'fields': fields, + 'errors_only': {'type': 'boolean'}, 'limit': integer(1, 100), 'offset': integer(0, 10000)}, + ['query_id', 'query_version', 'run_id', 'evaluation_sha256', 'checkpoint_sha256', + 'metric_id', 'metric_definition_sha256']) + definition = obj({'id': metric_id, 'semantic_version': const(1), 'split': const('validation'), + 'units': const('dimensionless'), 'direction': {'enum': ['minimize', 'maximize']}, + 'reduction': {'enum': ['mean_cross_entropy', 'diagonal_over_population', + 'macro_over_frozen_vocabulary_zero_division_0']}, + 'population_sha256': sha, 'domain': obj({'minimum': {'type': 'number'}, 'maximum': {'type': 'number'}}), + 'undefined_rule': const('not_applicable'), 'evaluator_sha256': sha, + 'preprocessing_sha256': sha, 'class_order_sha256': sha}) + frozen = obj({'id': identifier, 'revision': integer(1, 2**53 - 1), + 'source_revision': integer(1, 2**53 - 1), 'source_sha256': sha, + 'asset_sha256': sha, 'exported_pixel_sha256': sha}) + row = obj({'example_id': identifier, 'ordinal': integer(0, 9999), 'frozen_reference': frozen, + 'truth_index': natural, 'predicted_index': natural, + 'confidence': {'type': 'number', 'minimum': 0, 'maximum': 1}, 'error': {'type': 'boolean'}}, + ['example_id', 'ordinal', 'frozen_reference']) + columns = {'oneOf': [obj({'field': const(field), 'type': const(kind), + 'units': const('dimensionless' if field == 'confidence' else None)}) + for field, kind in zip(FIELDS, ('string', 'integer', 'integer', 'number', 'boolean'))]} + result = obj({'state': const('verified'), 'query_id': const(QUERY_ID), 'query_version': const(QUERY_VERSION), + 'mode': const('frozen'), 'provenance': obj({'catalog_id': identifier, 'run_id': identifier, + 'evaluation_sha256': sha, 'checkpoint_sha256': sha, 'metric_definition_sha256': sha, + 'population_sha256': sha, 'probe_sha256': sha, 'data_sha256': sha, + 'producer': obj({'catalog_id': identifier, 'run_id': identifier, + 'material_sha256': sha, 'adapter_sha256': sha})}), + 'metric': obj({'id': metric_id, 'units': const('dimensionless'), + 'definition': definition, 'support': support}), + 'curve': array(obj({'checkpoint_sha256': sha, 'epoch': integer(1, 128), + 'value': {'type': 'number'}, 'support': support}), 128, 1), + 'columns': array(columns, len(FIELDS), 1), + 'examples': obj({'rows': array(row, 100), 'population_support': support, + 'filtered_support': support, 'offset': integer(0, 10000), + 'limit': integer(1, 100), 'next_offset': nullable_offset, + 'filters': obj({'errors_only': {'type': 'boolean'}})}), + 'sampling': obj({'method': const('none'), 'population': const('frozen_validation_probe')}), + 'selection_sha256': sha}) + return request, result diff --git a/static/retained-analysis.js b/static/retained-analysis.js new file mode 100644 index 00000000..11475136 --- /dev/null +++ b/static/retained-analysis.js @@ -0,0 +1,191 @@ +/* Host-owned renderer for one pinned Altair recipe. No dynamic chart plugins. */ +(() => { + 'use strict'; + window.WorkspaceRetainedContracts = Object.freeze({ + 'runs.retained_analysis/1': '8ec28793a0603b206cb720d0ece573793c474fed901fb8ce99133d0154526cd5', + 'runs.export_retained_analysis/1': '0994932e96aab5d9561a63e3447bb8ec1f6345607e247ddb5a9cadaccffc57fb' + }); + const SPEC_PATH = '/static/retained-checkpoint-curve.vl.json'; + const SPEC_SHA256 = '6603c860ce76a434a11e6c96cf7418246ce2dd5da3d7a56a5f2448a0537ec183'; + const HASH = /^[a-f0-9]{64}$/; + const MAX_BYTES = 256 * 1024; + const fields = ['example_id', 'truth_index', 'predicted_index', 'confidence', 'error']; + const types = ['string', 'integer', 'integer', 'number', 'boolean']; + const own = (value, key) => Object.prototype.hasOwnProperty.call(value, key); + const object = value => value !== null && typeof value === 'object' && !Array.isArray(value); + const integer = value => Number.isSafeInteger(value) && value >= 0; + const finite = value => typeof value === 'number' && Number.isFinite(value); + const fail = () => { throw Error('Retained analysis response is invalid or exceeds its budget.'); }; + function validate(value, request) { + if (!object(value) || new TextEncoder().encode(JSON.stringify(value)).length > MAX_BYTES) fail(); + const keys = ['state', 'query_id', 'query_version', 'mode', 'provenance', 'metric', 'curve', 'columns', 'examples', 'sampling', 'selection_sha256']; + if (Object.keys(value).length !== keys.length || keys.some(key => !own(value, key))) fail(); + if (value.state !== 'verified' || value.query_id !== 'retained_checkpoint_examples' || value.query_version !== 1 || value.mode !== 'frozen') fail(); + const p = value.provenance; + if (!object(p) || ['evaluation_sha256', 'checkpoint_sha256', 'metric_definition_sha256'].some(key => p[key] !== request[key] || !HASH.test(p[key])) || p.run_id !== request.run_id) fail(); + if (typeof p.catalog_id !== 'string' || p.catalog_id.length > 64 || ['population_sha256', 'probe_sha256', 'data_sha256'].some(key => typeof p[key] !== 'string' || !HASH.test(p[key]))) fail(); + if (!object(p.producer) || p.producer.catalog_id !== p.catalog_id || p.producer.run_id !== p.run_id || ['material_sha256', 'adapter_sha256'].some(key => typeof p.producer[key] !== 'string' || !HASH.test(p.producer[key]))) fail(); + if (!object(value.metric) || value.metric.id !== request.metric_id || typeof value.metric.units !== 'string' || value.metric.units.length > 64 || !integer(value.metric.support) || value.metric.support > 10000) fail(); + if (!object(value.metric.definition) || value.metric.definition.id !== value.metric.id || value.metric.definition.split !== 'validation' || value.metric.definition.units !== value.metric.units || value.metric.definition.population_sha256 !== p.population_sha256) fail(); + if (!Array.isArray(value.curve) || value.curve.length < 1 || value.curve.length > 128) fail(); + const checkpoints = new Set(); + let previous = 0; + for (const point of value.curve) { + if (!object(point) || typeof point.checkpoint_sha256 !== 'string' || !HASH.test(point.checkpoint_sha256) || checkpoints.has(point.checkpoint_sha256) || !integer(point.epoch) || point.epoch <= previous || !finite(point.value) || point.support !== value.metric.support) fail(); + checkpoints.add(point.checkpoint_sha256); previous = point.epoch; + } + if (!checkpoints.has(request.checkpoint_sha256) || !HASH.test(value.selection_sha256)) fail(); + const e = value.examples; + if (!object(e) || !Array.isArray(e.rows) || !integer(e.limit) || e.limit < 1 || e.limit > 100 || e.rows.length > e.limit || !integer(e.offset) || e.offset > 10000 || !integer(e.population_support) || e.population_support > 10000 || !integer(e.filtered_support) || e.filtered_support > e.population_support) fail(); + if (!object(e.filters) || e.filters.errors_only !== (request.errors_only ?? false) || e.offset !== (request.offset ?? 0) || e.limit !== (request.limit ?? 50) || e.population_support !== value.metric.support) fail(); + if (!e.filters.errors_only && e.filtered_support !== e.population_support) fail(); + if (e.rows.length > Math.max(0, e.filtered_support - e.offset)) fail(); + const next = e.offset + e.rows.length < e.filtered_support ? e.offset + e.rows.length : null; + if (e.next_offset !== next || (next !== null && e.rows.length === 0)) fail(); + if (!Array.isArray(value.columns) || value.columns.length > fields.length || value.columns.length < 1) fail(); + const selected = request.fields ?? fields; + if (value.columns.length !== selected.length || value.columns.some((column, index) => !object(column) || column.field !== selected[index] || !fields.includes(column.field) || column.type !== types[fields.indexOf(column.field)] || column.units !== (column.field === 'confidence' ? 'dimensionless' : null))) fail(); + const seen = new Set(); + let ordinal = -1; + for (const row of e.rows) { + if (!object(row) || typeof row.example_id !== 'string' || row.example_id.length > 200 || seen.has(row.example_id) || !integer(row.ordinal) || row.ordinal >= e.population_support || row.ordinal <= ordinal || !object(row.frozen_reference) || row.frozen_reference.id !== row.example_id) fail(); + if (own(row, 'confidence') && (!finite(row.confidence) || row.confidence < 0 || row.confidence > 1)) fail(); + if (own(row, 'truth_index') && !integer(row.truth_index) || own(row, 'predicted_index') && !integer(row.predicted_index) || own(row, 'error') && typeof row.error !== 'boolean') fail(); + if (selected.some(field => !own(row, field))) fail(); + if (e.filters.errors_only && own(row, 'error') && !row.error) fail(); + seen.add(row.example_id); ordinal = row.ordinal; + } + if (!object(value.sampling) || value.sampling.method !== 'none' || value.sampling.population !== 'frozen_validation_probe') fail(); + return value; + } + function node(tag, text, attributes = {}) { + const element = document.createElement(tag); + if (text !== undefined) element.textContent = text; + for (const [key, value] of Object.entries(attributes)) element.setAttribute(key, value); + return element; + } + async function specification(signal) { + const reply = await fetch(SPEC_PATH, {signal, credentials: 'same-origin', cache: 'no-cache'}); + if (!reply.ok) throw Error('Retained chart specification is unavailable.'); + const reader = reply.body.getReader(); + let raw = new Uint8Array(0); + while (true) { + const {value, done} = await reader.read(); + if (done) break; + if (raw.byteLength + value.byteLength > 16384) { + await reader.cancel(); + throw Error('Retained chart specification exceeds its budget.'); + } + const next = new Uint8Array(raw.byteLength + value.byteLength); + next.set(raw); next.set(value, raw.byteLength); raw = next; + } + const hash = [...new Uint8Array(await crypto.subtle.digest('SHA-256', raw))].map(byte => byte.toString(16).padStart(2, '0')).join(''); + if (hash !== SPEC_SHA256) throw Error('Retained chart specification identity differs.'); + return JSON.parse(new TextDecoder().decode(raw)); + } + function mount(root, {load, onSelection = () => {}}) { + let disposed = false, generation = 0, pending, view, observer, current; + function clear() { + view?.finalize(); view = undefined; + observer?.disconnect(); observer = undefined; + current = undefined; + root.replaceChildren(); + } + async function update(body, authorityKey) { + if (disposed) return; + const request = structuredClone(body), ticket = ++generation; + pending?.abort(); pending = new AbortController(); + const signal = pending.signal; + clear(); root.setAttribute('aria-busy', 'true'); + root.append(node('p', 'Loading exact retained result…', {role: 'status'})); + const active = () => !disposed && ticket === generation && !signal.aborted; + try { + const [received, base] = await Promise.all([load(request, {signal, authorityKey, export: false}), specification(signal)]); + if (!active()) return; + const data = validate(received, request); + clear(); + const heading = node('h3', 'Retained checkpoint analysis', {tabindex: '-1'}); + const status = node('p', `Frozen validation probe · ${data.metric.support} examples · ${data.metric.units}`, {role: 'status'}); + const chart = node('div', undefined, {role: 'img', 'aria-label': 'Checkpoint curve; exact values and keyboard selection follow.'}); + const buttons = node('div', undefined, {'aria-label': 'Select retained epoch'}); + const choose = sha => { + if (!active() || sha === request.checkpoint_sha256) return; + onSelection({checkpoint_sha256: sha}); + void update({...request, checkpoint_sha256: sha, offset: 0}, authorityKey).then(() => root.querySelector('h3')?.focus()); + }; + for (const point of data.curve) { + const button = node('button', `Epoch ${point.epoch}: ${point.value} · support ${point.support}`, {type: 'button', 'aria-pressed': String(point.checkpoint_sha256 === request.checkpoint_sha256)}); + button.addEventListener('click', () => choose(point.checkpoint_sha256)); + buttons.append(button); + } + const filterLabel = node('label', ' Show only errors '); + const filter = node('input', undefined, {type: 'checkbox'}); + filter.checked = request.errors_only ?? false; + filter.addEventListener('change', () => void update({...request, errors_only: filter.checked, offset: 0}, authorityKey).then(() => root.querySelector('input')?.focus())); + filterLabel.prepend(filter); + const support = node('p', `${data.examples.filtered_support} matching examples of ${data.examples.population_support}; curve statistics retain the full probe population.`); + const table = node('table'); + table.append(node('caption', 'Frozen examples at the selected checkpoint')); + const headers = node('tr'); + for (const column of data.columns) headers.append(node('th', column.field, {scope: 'col'})); + const head = node('thead'); head.append(headers); table.append(head); + const rows = node('tbody'); + for (const row of data.examples.rows) { + const tr = node('tr'); + for (const column of data.columns) tr.append(node('td', String(row[column.field]))); + rows.append(tr); + } + table.append(rows); + const navigation = node('div'); + for (const [label, offset] of [['Previous examples', Math.max(0, data.examples.offset - data.examples.limit)], ['Next examples', data.examples.next_offset]]) { + const button = node('button', label, {type: 'button'}); + button.disabled = offset === null || offset === data.examples.offset; + button.addEventListener('click', () => void update({...request, offset}, authorityKey)); navigation.append(button); + } + const exportButton = node('button', 'Export this page', {type: 'button'}); + exportButton.addEventListener('click', async () => { + exportButton.disabled = true; + try { + const fresh = validate(await load(request, {signal, authorityKey, export: true}), request); + if (!active()) return; + const url = URL.createObjectURL(new Blob([JSON.stringify(fresh)], {type: 'application/json'})); + const link = node('a', undefined, {href: url, download: 'retained-analysis-page.json'}); + root.append(link); link.click(); link.remove(); URL.revokeObjectURL(url); + } catch (error) { + if (active()) { clear(); root.append(node('p', 'Retained result access or export failed. Refresh with current access.', {role: 'alert'})); } + } finally { if (active()) exportButton.disabled = false; } + }); + const details = node('details'); details.append(node('summary', 'Exact retained provenance'), node('pre', JSON.stringify(data.provenance, null, 2))); + root.append(heading, status, chart, buttons, filterLabel, support, table, navigation, exportButton, details); + if (typeof window.vegaEmbed !== 'function' || typeof window.vega?.expressionInterpreter !== 'object') throw Error('Pinned chart assets are unavailable.'); + base.datasets = {curve: data.curve.map(point => ({...point, selected: point.checkpoint_sha256 === request.checkpoint_sha256}))}; + // Data, images and links cannot leave the controlled inline dataset. + const deny = () => Promise.reject(Error('Chart URL loading is disabled.')); + const embedded = await window.vegaEmbed(chart, base, {actions: false, defaultStyle: false, tooltip: false, mode: 'vega-lite', renderer: 'svg', ast: true, expr: window.vega.expressionInterpreter, loader: {load: deny, sanitize: deny}}); + if (!active()) { embedded.finalize(); return; } + view = embedded.view; + view.addSignalListener('checkpoint_select', (_name, value) => { + const sha = value?.checkpoint_sha256?.[0]; + if (data.curve.some(point => point.checkpoint_sha256 === sha)) choose(sha); + }); + observer = new ResizeObserver(() => { + if (active()) void view?.resize().runAsync().catch(() => { if (active()) { clear(); root.append(node('p', 'Retained chart resize failed.', {role: 'alert'})); } }); + }); + observer.observe(chart); + current = {request, authorityKey}; + } catch (error) { + if (active()) { + clear(); root.append(node('p', String(error.message || 'Retained analysis unavailable.'), {role: 'alert'})); + root.setAttribute('aria-busy', 'false'); pending.abort(); + } + } finally { if (active()) root.setAttribute('aria-busy', 'false'); } + } + return { + update, + resize() { return view?.resize().runAsync(); }, + selection() { return current ? structuredClone(current.request) : null; }, + dispose() { disposed = true; ++generation; pending?.abort(); clear(); root.removeAttribute('aria-busy'); } + }; + } + window.WorkspaceRetainedAnalysis = Object.freeze({mount}); +})(); diff --git a/static/retained-checkpoint-curve.vl.json b/static/retained-checkpoint-curve.vl.json new file mode 100644 index 00000000..8628e384 --- /dev/null +++ b/static/retained-checkpoint-curve.vl.json @@ -0,0 +1 @@ +{"$schema":"https://vega.github.io/schema/vega-lite/v5.20.1.json","config":{"view":{"continuousHeight":300,"continuousWidth":300}},"data":{"name":"curve"},"description":"Retained checkpoint metric curve. Use the epoch buttons for exact values and keyboard selection.","height":200,"layer":[{"encoding":{"x":{"axis":{"tickMinStep":1},"field":"epoch","title":"Retained epoch","type":"quantitative"},"y":{"field":"value","scale":{"zero":false},"title":"Metric value","type":"quantitative"}},"mark":{"color":"#60a5fa","type":"line"}},{"encoding":{"color":{"condition":{"test":"datum.selected","value":"#fbbf24"},"value":"#60a5fa"},"x":{"axis":{"tickMinStep":1},"field":"epoch","title":"Retained epoch","type":"quantitative"},"y":{"field":"value","scale":{"zero":false},"title":"Metric value","type":"quantitative"}},"mark":{"filled":true,"size":80,"type":"point"},"name":"view_1"}],"params":[{"name":"checkpoint_select","select":{"clear":false,"fields":["checkpoint_sha256"],"on":"click","toggle":false,"type":"point"},"views":["view_1"]}],"width":"container"} diff --git a/static/vendor/retained-analysis/licenses/d3-array.txt b/static/vendor/retained-analysis/licenses/d3-array.txt new file mode 100644 index 00000000..97e0a36c --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-array.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2010-2023 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-color.txt b/static/vendor/retained-analysis/licenses/d3-color.txt new file mode 100644 index 00000000..8ee860fc --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-color.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2010-2022 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-delaunay.txt b/static/vendor/retained-analysis/licenses/d3-delaunay.txt new file mode 100644 index 00000000..65b9c72e --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-delaunay.txt @@ -0,0 +1,15 @@ +LICENSE +Copyright 2018-2021 Observable, Inc. +Copyright 2021 Mapbox + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-dispatch.txt b/static/vendor/retained-analysis/licenses/d3-dispatch.txt new file mode 100644 index 00000000..16bdfa50 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-dispatch.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-dsv.txt b/static/vendor/retained-analysis/licenses/d3-dsv.txt new file mode 100644 index 00000000..23a34683 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-dsv.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2013-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-force.txt b/static/vendor/retained-analysis/licenses/d3-force.txt new file mode 100644 index 00000000..16bdfa50 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-force.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-format.txt b/static/vendor/retained-analysis/licenses/d3-format.txt new file mode 100644 index 00000000..a33c9924 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-format.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2010-2026 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-geo-projection.txt b/static/vendor/retained-analysis/licenses/d3-geo-projection.txt new file mode 100644 index 00000000..3763f6af --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-geo-projection.txt @@ -0,0 +1,38 @@ +LICENSE +Copyright 2013-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +MIT License for https://github.com/scijs/integrate-adaptive-simpson + +The MIT License (MIT) + +Copyright 2015 Ricky Reusser + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-geo.txt b/static/vendor/retained-analysis/licenses/d3-geo.txt new file mode 100644 index 00000000..45e3fd76 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-geo.txt @@ -0,0 +1,35 @@ +LICENSE +Copyright 2010-2024 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +This license applies to GeographicLib, versions 1.12 and later. + +Copyright 2008-2012 Charles Karney + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-hierarchy.txt b/static/vendor/retained-analysis/licenses/d3-hierarchy.txt new file mode 100644 index 00000000..16bdfa50 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-hierarchy.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-interpolate.txt b/static/vendor/retained-analysis/licenses/d3-interpolate.txt new file mode 100644 index 00000000..16bdfa50 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-interpolate.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-path.txt b/static/vendor/retained-analysis/licenses/d3-path.txt new file mode 100644 index 00000000..16934264 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-path.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2015-2022 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-quadtree.txt b/static/vendor/retained-analysis/licenses/d3-quadtree.txt new file mode 100644 index 00000000..16bdfa50 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-quadtree.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-scale-chromatic.txt b/static/vendor/retained-analysis/licenses/d3-scale-chromatic.txt new file mode 100644 index 00000000..dea725e3 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-scale-chromatic.txt @@ -0,0 +1,29 @@ +LICENSE +Copyright 2010-2024 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +Apache-Style Software License for ColorBrewer software and ColorBrewer Color Schemes + +Copyright 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania State University + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed +under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +CONDITIONS OF ANY KIND, either express or implied. See the License for the +specific language governing permissions and limitations under the License. diff --git a/static/vendor/retained-analysis/licenses/d3-scale.txt b/static/vendor/retained-analysis/licenses/d3-scale.txt new file mode 100644 index 00000000..16bdfa50 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-scale.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-shape.txt b/static/vendor/retained-analysis/licenses/d3-shape.txt new file mode 100644 index 00000000..8ee860fc --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-shape.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2010-2022 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-time-format.txt b/static/vendor/retained-analysis/licenses/d3-time-format.txt new file mode 100644 index 00000000..16bdfa50 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-time-format.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-time.txt b/static/vendor/retained-analysis/licenses/d3-time.txt new file mode 100644 index 00000000..8ee860fc --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-time.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2010-2022 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/d3-timer.txt b/static/vendor/retained-analysis/licenses/d3-timer.txt new file mode 100644 index 00000000..16bdfa50 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/d3-timer.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/delaunator.txt b/static/vendor/retained-analysis/licenses/delaunator.txt new file mode 100644 index 00000000..1d230d36 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/delaunator.txt @@ -0,0 +1,16 @@ +LICENSE +ISC License + +Copyright (c) 2026, Mapbox + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/fast-json-patch.txt b/static/vendor/retained-analysis/licenses/fast-json-patch.txt new file mode 100644 index 00000000..fb6bd4df --- /dev/null +++ b/static/vendor/retained-analysis/licenses/fast-json-patch.txt @@ -0,0 +1,23 @@ +LICENSE.txt +(The MIT License) + +Copyright (c) 2013, 2014, 2020 Joachim Wester + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/internmap.txt b/static/vendor/retained-analysis/licenses/internmap.txt new file mode 100644 index 00000000..cb979506 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/internmap.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/json-stringify-pretty-compact.txt b/static/vendor/retained-analysis/licenses/json-stringify-pretty-compact.txt new file mode 100644 index 00000000..8313ca19 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/json-stringify-pretty-compact.txt @@ -0,0 +1,22 @@ +LICENSE +The MIT License (MIT) + +Copyright (c) 2014, 2016, 2017, 2019, 2021, 2022 Simon Lydell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/robust-predicates.txt b/static/vendor/retained-analysis/licenses/robust-predicates.txt new file mode 100644 index 00000000..0e9e4a32 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/robust-predicates.txt @@ -0,0 +1,25 @@ +LICENSE +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/static/vendor/retained-analysis/licenses/semver.txt b/static/vendor/retained-analysis/licenses/semver.txt new file mode 100644 index 00000000..b9c30165 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/semver.txt @@ -0,0 +1,16 @@ +LICENSE +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/topojson-client.txt b/static/vendor/retained-analysis/licenses/topojson-client.txt new file mode 100644 index 00000000..12f428af --- /dev/null +++ b/static/vendor/retained-analysis/licenses/topojson-client.txt @@ -0,0 +1,14 @@ +LICENSE +Copyright 2012-2019 Michael Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/static/vendor/retained-analysis/licenses/vega-canvas.txt b/static/vendor/retained-analysis/licenses/vega-canvas.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-canvas.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-crossfilter.txt b/static/vendor/retained-analysis/licenses/vega-crossfilter.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-crossfilter.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-embed.txt b/static/vendor/retained-analysis/licenses/vega-embed.txt new file mode 100644 index 00000000..93d1ed4c --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-embed.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-encode.txt b/static/vendor/retained-analysis/licenses/vega-encode.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-encode.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-event-selector.txt b/static/vendor/retained-analysis/licenses/vega-event-selector.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-event-selector.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-force.txt b/static/vendor/retained-analysis/licenses/vega-force.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-force.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-geo.txt b/static/vendor/retained-analysis/licenses/vega-geo.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-geo.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-hierarchy.txt b/static/vendor/retained-analysis/licenses/vega-hierarchy.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-hierarchy.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-interpreter.txt b/static/vendor/retained-analysis/licenses/vega-interpreter.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-interpreter.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-label.txt b/static/vendor/retained-analysis/licenses/vega-label.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-label.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-lite.txt b/static/vendor/retained-analysis/licenses/vega-lite.txt new file mode 100644 index 00000000..31977bae --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-lite.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015, University of Washington Interactive Data Lab. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-parser.txt b/static/vendor/retained-analysis/licenses/vega-parser.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-parser.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-projection.txt b/static/vendor/retained-analysis/licenses/vega-projection.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-projection.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-regression.txt b/static/vendor/retained-analysis/licenses/vega-regression.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-regression.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-runtime.txt b/static/vendor/retained-analysis/licenses/vega-runtime.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-runtime.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-schema-url-parser.txt b/static/vendor/retained-analysis/licenses/vega-schema-url-parser.txt new file mode 100644 index 00000000..2fc25470 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-schema-url-parser.txt @@ -0,0 +1,30 @@ +LICENSE +BSD 3-Clause License + +Copyright (c) 2017, Vega +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-statistics.txt b/static/vendor/retained-analysis/licenses/vega-statistics.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-statistics.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-themes.txt b/static/vendor/retained-analysis/licenses/vega-themes.txt new file mode 100644 index 00000000..854a7eeb --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-themes.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2016, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-tooltip.txt b/static/vendor/retained-analysis/licenses/vega-tooltip.txt new file mode 100644 index 00000000..243f3563 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-tooltip.txt @@ -0,0 +1,12 @@ +LICENSE +Copyright 2016 Interactive Data Lab and contributors + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-transforms.txt b/static/vendor/retained-analysis/licenses/vega-transforms.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-transforms.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-view-transforms.txt b/static/vendor/retained-analysis/licenses/vega-view-transforms.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-view-transforms.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-view.txt b/static/vendor/retained-analysis/licenses/vega-view.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-view.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-voronoi.txt b/static/vendor/retained-analysis/licenses/vega-voronoi.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-voronoi.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega-wordcloud.txt b/static/vendor/retained-analysis/licenses/vega-wordcloud.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega-wordcloud.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/licenses/vega.txt b/static/vendor/retained-analysis/licenses/vega.txt new file mode 100644 index 00000000..da413b34 --- /dev/null +++ b/static/vendor/retained-analysis/licenses/vega.txt @@ -0,0 +1,28 @@ +LICENSE +Copyright (c) 2015-2023, University of Washington Interactive Data Lab +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/retained-analysis/manifest.json b/static/vendor/retained-analysis/manifest.json new file mode 100644 index 00000000..0c013741 --- /dev/null +++ b/static/vendor/retained-analysis/manifest.json @@ -0,0 +1,420 @@ +{ + "purpose": "Self-hosted fixed retained-checkpoint recipe only", + "assets": [ + { + "package": "vega", + "version": "5.33.0", + "filename": "vega.min.js", + "sha256": "a71f14828abacac82fbe8adb07ce65cbb82561d8eef188053c4a1c09e0164dcb", + "tarball_sha256": "7b61f992d1a1e196e7f2eeb3d6176e5694949d0d4bbfea237a842d523dd6e1f3", + "source": "https://registry.npmjs.org/vega/-/vega-5.33.0.tgz", + "license": "BSD-3-Clause" + }, + { + "package": "vega-lite", + "version": "5.23.0", + "filename": "vega-lite.min.js", + "sha256": "58c27358e26f2d319cf62f45bc17a4c8362f08645001df2ec8d341eee4097c7f", + "tarball_sha256": "e4cbfdd8f6f1abe381c59cd558fd6a559c12b1496bfdf2e0c3295263a40fe4da", + "source": "https://registry.npmjs.org/vega-lite/-/vega-lite-5.23.0.tgz", + "license": "BSD-3-Clause" + }, + { + "package": "vega-embed", + "version": "6.29.0", + "filename": "vega-embed.min.js", + "sha256": "12d02acfbe3ec59ef9a37dd4822a2e04e2961b5bbb671bbe661d2221715b99da", + "tarball_sha256": "ecf1ee709c2bac9e0a4ead6908114b05b62c71493e10a8a4308109bb070f8eb1", + "source": "https://registry.npmjs.org/vega-embed/-/vega-embed-6.29.0.tgz", + "license": "BSD-3-Clause" + }, + { + "package": "vega-interpreter", + "version": "1.2.0", + "filename": "vega-interpreter.min.js", + "sha256": "13002339c7e6231ef919584cbdf7391b246ea5073f686ffd707c62628b7f87df", + "tarball_sha256": "1eebed53f379d1c95ac7bba508b47eae8d4f8a19ecb1ec29b60b0be8b6334e5d", + "source": "https://registry.npmjs.org/vega-interpreter/-/vega-interpreter-1.2.0.tgz", + "license": "BSD-3-Clause" + } + ], + "notices": [ + { + "package": "d3-array", + "version": "3.2.4", + "license": "ISC", + "notice_file": "d3-array.txt" + }, + { + "package": "d3-color", + "version": "3.1.0", + "license": "ISC", + "notice_file": "d3-color.txt" + }, + { + "package": "d3-delaunay", + "version": "6.0.4", + "license": "ISC", + "notice_file": "d3-delaunay.txt" + }, + { + "package": "d3-dispatch", + "version": "3.0.1", + "license": "ISC", + "notice_file": "d3-dispatch.txt" + }, + { + "package": "d3-dsv", + "version": "3.0.1", + "license": "ISC", + "notice_file": "d3-dsv.txt" + }, + { + "package": "d3-force", + "version": "3.0.0", + "license": "ISC", + "notice_file": "d3-force.txt" + }, + { + "package": "d3-format", + "version": "3.1.2", + "license": "ISC", + "notice_file": "d3-format.txt" + }, + { + "package": "d3-geo", + "version": "3.1.1", + "license": "ISC", + "notice_file": "d3-geo.txt" + }, + { + "package": "d3-geo-projection", + "version": "4.0.0", + "license": "ISC", + "notice_file": "d3-geo-projection.txt" + }, + { + "package": "d3-hierarchy", + "version": "3.1.2", + "license": "ISC", + "notice_file": "d3-hierarchy.txt" + }, + { + "package": "d3-interpolate", + "version": "3.0.1", + "license": "ISC", + "notice_file": "d3-interpolate.txt" + }, + { + "package": "d3-path", + "version": "3.1.0", + "license": "ISC", + "notice_file": "d3-path.txt" + }, + { + "package": "d3-quadtree", + "version": "3.0.1", + "license": "ISC", + "notice_file": "d3-quadtree.txt" + }, + { + "package": "d3-scale", + "version": "4.0.2", + "license": "ISC", + "notice_file": "d3-scale.txt" + }, + { + "package": "d3-scale-chromatic", + "version": "3.1.0", + "license": "ISC", + "notice_file": "d3-scale-chromatic.txt" + }, + { + "package": "d3-shape", + "version": "3.2.0", + "license": "ISC", + "notice_file": "d3-shape.txt" + }, + { + "package": "d3-time", + "version": "3.1.0", + "license": "ISC", + "notice_file": "d3-time.txt" + }, + { + "package": "d3-time-format", + "version": "4.1.0", + "license": "ISC", + "notice_file": "d3-time-format.txt" + }, + { + "package": "d3-timer", + "version": "3.0.1", + "license": "ISC", + "notice_file": "d3-timer.txt" + }, + { + "package": "delaunator", + "version": "5.1.0", + "license": "ISC", + "notice_file": "delaunator.txt" + }, + { + "package": "fast-json-patch", + "version": "3.1.1", + "license": "MIT", + "notice_file": "fast-json-patch.txt" + }, + { + "package": "internmap", + "version": "2.0.3", + "license": "ISC", + "notice_file": "internmap.txt" + }, + { + "package": "json-stringify-pretty-compact", + "version": "4.0.0", + "license": "MIT", + "notice_file": "json-stringify-pretty-compact.txt" + }, + { + "package": "robust-predicates", + "version": "3.0.3", + "license": "Unlicense", + "notice_file": "robust-predicates.txt" + }, + { + "package": "semver", + "version": "7.8.5", + "license": "ISC", + "notice_file": "semver.txt" + }, + { + "package": "topojson-client", + "version": "3.1.0", + "license": "ISC", + "notice_file": "topojson-client.txt" + }, + { + "package": "vega", + "version": "5.33.0", + "license": "BSD-3-Clause", + "notice_file": "vega.txt" + }, + { + "package": "vega-canvas", + "version": "1.2.7", + "license": "BSD-3-Clause", + "notice_file": "vega-canvas.txt" + }, + { + "package": "vega-crossfilter", + "version": "4.1.4", + "license": "BSD-3-Clause", + "notice_file": "vega-crossfilter.txt" + }, + { + "package": "vega-dataflow", + "version": "5.7.8", + "license": "BSD-3-Clause", + "notice_file": "vega.txt", + "notice_source": "Vega monorepo BSD-3-Clause notice in upstream vega@5.33.0 distribution" + }, + { + "package": "vega-embed", + "version": "6.29.0", + "license": "BSD-3-Clause", + "notice_file": "vega-embed.txt" + }, + { + "package": "vega-encode", + "version": "4.10.3", + "license": "BSD-3-Clause", + "notice_file": "vega-encode.txt" + }, + { + "package": "vega-event-selector", + "version": "3.0.1", + "license": "BSD-3-Clause", + "notice_file": "vega-event-selector.txt" + }, + { + "package": "vega-expression", + "version": "5.2.1", + "license": "BSD-3-Clause", + "notice_file": "vega.txt", + "notice_source": "Vega monorepo BSD-3-Clause notice in upstream vega@5.33.0 distribution" + }, + { + "package": "vega-force", + "version": "4.2.3", + "license": "BSD-3-Clause", + "notice_file": "vega-force.txt" + }, + { + "package": "vega-format", + "version": "1.1.4", + "license": "BSD-3-Clause", + "notice_file": "vega.txt", + "notice_source": "Vega monorepo BSD-3-Clause notice in upstream vega@5.33.0 distribution" + }, + { + "package": "vega-functions", + "version": "5.18.1", + "license": "BSD-3-Clause", + "notice_file": "vega.txt", + "notice_source": "Vega monorepo BSD-3-Clause notice in upstream vega@5.33.0 distribution" + }, + { + "package": "vega-geo", + "version": "4.4.4", + "license": "BSD-3-Clause", + "notice_file": "vega-geo.txt" + }, + { + "package": "vega-hierarchy", + "version": "4.1.4", + "license": "BSD-3-Clause", + "notice_file": "vega-hierarchy.txt" + }, + { + "package": "vega-interpreter", + "version": "1.2.0", + "license": "BSD-3-Clause", + "notice_file": "vega-interpreter.txt" + }, + { + "package": "vega-label", + "version": "1.3.2", + "license": "BSD-3-Clause", + "notice_file": "vega-label.txt" + }, + { + "package": "vega-lite", + "version": "5.23.0", + "license": "BSD-3-Clause", + "notice_file": "vega-lite.txt" + }, + { + "package": "vega-loader", + "version": "4.5.4", + "license": "BSD-3-Clause", + "notice_file": "vega.txt", + "notice_source": "Vega monorepo BSD-3-Clause notice in upstream vega@5.33.0 distribution" + }, + { + "package": "vega-parser", + "version": "6.6.1", + "license": "BSD-3-Clause", + "notice_file": "vega-parser.txt" + }, + { + "package": "vega-projection", + "version": "1.6.3", + "license": "BSD-3-Clause", + "notice_file": "vega-projection.txt" + }, + { + "package": "vega-regression", + "version": "1.3.2", + "license": "BSD-3-Clause", + "notice_file": "vega-regression.txt" + }, + { + "package": "vega-runtime", + "version": "6.2.2", + "license": "BSD-3-Clause", + "notice_file": "vega-runtime.txt" + }, + { + "package": "vega-scale", + "version": "7.4.3", + "license": "BSD-3-Clause", + "notice_file": "vega.txt", + "notice_source": "Vega monorepo BSD-3-Clause notice in upstream vega@5.33.0 distribution" + }, + { + "package": "vega-scenegraph", + "version": "4.13.2", + "license": "BSD-3-Clause", + "notice_file": "vega.txt", + "notice_source": "Vega monorepo BSD-3-Clause notice in upstream vega@5.33.0 distribution" + }, + { + "package": "vega-schema-url-parser", + "version": "2.2.0", + "license": "BSD-3-Clause", + "notice_file": "vega-schema-url-parser.txt" + }, + { + "package": "vega-selections", + "version": "5.6.3", + "license": "BSD-3-Clause", + "notice_file": "vega.txt", + "notice_source": "Vega monorepo BSD-3-Clause notice in upstream vega@5.33.0 distribution" + }, + { + "package": "vega-statistics", + "version": "1.9.0", + "license": "BSD-3-Clause", + "notice_file": "vega-statistics.txt" + }, + { + "package": "vega-themes", + "version": "2.15.0", + "license": "BSD-3-Clause", + "notice_file": "vega-themes.txt" + }, + { + "package": "vega-time", + "version": "2.1.4", + "license": "BSD-3-Clause", + "notice_file": "vega.txt", + "notice_source": "Vega monorepo BSD-3-Clause notice in upstream vega@5.33.0 distribution" + }, + { + "package": "vega-tooltip", + "version": "0.35.2", + "license": "BSD-3-Clause", + "notice_file": "vega-tooltip.txt" + }, + { + "package": "vega-transforms", + "version": "4.12.2", + "license": "BSD-3-Clause", + "notice_file": "vega-transforms.txt" + }, + { + "package": "vega-util", + "version": "1.17.4", + "license": "BSD-3-Clause", + "notice_file": "vega.txt", + "notice_source": "Vega monorepo BSD-3-Clause notice in upstream vega@5.33.0 distribution" + }, + { + "package": "vega-view", + "version": "5.16.1", + "license": "BSD-3-Clause", + "notice_file": "vega-view.txt" + }, + { + "package": "vega-view-transforms", + "version": "4.6.2", + "license": "BSD-3-Clause", + "notice_file": "vega-view-transforms.txt" + }, + { + "package": "vega-voronoi", + "version": "4.2.5", + "license": "BSD-3-Clause", + "notice_file": "vega-voronoi.txt" + }, + { + "package": "vega-wordcloud", + "version": "4.1.7", + "license": "BSD-3-Clause", + "notice_file": "vega-wordcloud.txt" + } + ], + "notice_scope": "Packages present in upstream distribution source maps; notice package versions describe the local resolution used to retrieve notices, not an assertion about each bundled dependency version." +} diff --git a/static/vendor/retained-analysis/vega-embed.min.js b/static/vendor/retained-analysis/vega-embed.min.js new file mode 100644 index 00000000..8ae62235 --- /dev/null +++ b/static/vendor/retained-analysis/vega-embed.min.js @@ -0,0 +1,7 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vega"),require("vega-lite")):"function"==typeof define&&define.amd?define(["vega","vega-lite"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).vegaEmbed=t(e.vega,e.vegaLite)}(this,(function(e,t){"use strict";function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r,i=n(e),o=n(t),a=(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},r(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=Object.prototype.hasOwnProperty;function l(e,t){return s.call(e,t)}function c(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n=48&&t<=57))return!1;n++}return!0}function p(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function u(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function h(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,n=e.length;t0&&"constructor"==s[c-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&void 0===h&&(void 0===l[g]?h=s.slice(0,c).join("/"):c==p-1&&(h=t.path),void 0!==h&&m(t,0,e,h)),c++,Array.isArray(l)){if("-"===g)g=l.length;else{if(n&&!d(g))throw new E("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",o,t,e);d(g)&&(g=~~g)}if(c>=p){if(n&&"add"===t.op&&g>l.length)throw new E("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,t,e);if(!1===(a=y[t.op].call(t,l,g,e)).test)throw new E("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}}else if(c>=p){if(!1===(a=b[t.op].call(t,l,g,e)).test)throw new E("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}if(l=l[g],n&&c0)throw new E('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new E("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new E("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&h(e.value))throw new E("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n)if("add"==e.op){var i=e.path.split("/").length,o=r.split("/").length;if(i!==o+1&&i!==o)throw new E("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==r)throw new E("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if("move"===e.op||"copy"===e.op){var a=x([{op:"_get",path:e.from,value:void 0}],n);if(a&&"OPERATION_PATH_UNRESOLVABLE"===a.name)throw new E("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function x(e,t,n){try{if(!Array.isArray(e))throw new E("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)A(f(t),f(e),n||!0);else{n=n||I;for(var r=0;r0&&(e.patches=[],e.callback&&e.callback(r)),r}function C(e,t,n,r,i){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var o=c(t),a=c(e),s=!1,d=a.length-1;d>=0;d--){var u=e[g=a[d]];if(!l(t,g)||void 0===t[g]&&void 0!==u&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+p(g),value:f(u)}),n.push({op:"remove",path:r+"/"+p(g)}),s=!0):(i&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}));else{var h=t[g];"object"==typeof u&&null!=u&&"object"==typeof h&&null!=h&&Array.isArray(u)===Array.isArray(h)?C(u,h,n,r+"/"+p(g),i):u!==h&&(i&&n.push({op:"test",path:r+"/"+p(g),value:f(u)}),n.push({op:"replace",path:r+"/"+p(g),value:f(h)}))}}if(s||o.length!=a.length)for(d=0;dt||`${e} `));if(e.length<=l)return e}if(null!=i&&(t=JSON.parse(s),i=void 0),"object"==typeof t&&null!==t){const r=o+n,i=[];let a,s,l=0;if(Array.isArray(t)){a="[",s="]";const{length:n}=t;for(;l0)return[a,n+i.join(`,\n${r}`),s].join(`\n${o}`)}return s}(e,"",0)}function _(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var P,M,z,j;function U(){if(j)return z;j=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return z=n=>n?"object"!=typeof n?e:n:t}var B,G,W,X,V,H,Y,q,J,Q,Z,K,ee,te,ne,re,ie,oe,ae,se,le,ce,fe,de,pe,ue,he,ge,me,Ee,ve,be={exports:{}};function ye(){if(G)return B;G=1;const e=Number.MAX_SAFE_INTEGER||9007199254740991;return B={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:e,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}function we(){if(X)return W;X=1;const e="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};return W=e}function Oe(){return V||(V=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=ye(),o=we(),a=(t=e.exports={}).re=[],s=t.safeRe=[],l=t.src=[],c=t.t={};let f=0;const d="[a-zA-Z0-9-]",p=[["\\s",1],["\\d",i],[d,r]],u=(e,t,n)=>{const r=(e=>{for(const[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),i=f++;o(e,i,t),c[e]=i,l[i]=t,a[i]=new RegExp(t,n?"g":void 0),s[i]=new RegExp(r,n?"g":void 0)};u("NUMERICIDENTIFIER","0|[1-9]\\d*"),u("NUMERICIDENTIFIERLOOSE","\\d+"),u("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),u("MAINVERSION",`(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})`),u("MAINVERSIONLOOSE",`(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})`),u("PRERELEASEIDENTIFIER",`(?:${l[c.NUMERICIDENTIFIER]}|${l[c.NONNUMERICIDENTIFIER]})`),u("PRERELEASEIDENTIFIERLOOSE",`(?:${l[c.NUMERICIDENTIFIERLOOSE]}|${l[c.NONNUMERICIDENTIFIER]})`),u("PRERELEASE",`(?:-(${l[c.PRERELEASEIDENTIFIER]}(?:\\.${l[c.PRERELEASEIDENTIFIER]})*))`),u("PRERELEASELOOSE",`(?:-?(${l[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[c.PRERELEASEIDENTIFIERLOOSE]})*))`),u("BUILDIDENTIFIER",`${d}+`),u("BUILD",`(?:\\+(${l[c.BUILDIDENTIFIER]}(?:\\.${l[c.BUILDIDENTIFIER]})*))`),u("FULLPLAIN",`v?${l[c.MAINVERSION]}${l[c.PRERELEASE]}?${l[c.BUILD]}?`),u("FULL",`^${l[c.FULLPLAIN]}$`),u("LOOSEPLAIN",`[v=\\s]*${l[c.MAINVERSIONLOOSE]}${l[c.PRERELEASELOOSE]}?${l[c.BUILD]}?`),u("LOOSE",`^${l[c.LOOSEPLAIN]}$`),u("GTLT","((?:<|>)?=?)"),u("XRANGEIDENTIFIERLOOSE",`${l[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),u("XRANGEIDENTIFIER",`${l[c.NUMERICIDENTIFIER]}|x|X|\\*`),u("XRANGEPLAIN",`[v=\\s]*(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:${l[c.PRERELEASE]})?${l[c.BUILD]}?)?)?`),u("XRANGEPLAINLOOSE",`[v=\\s]*(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:${l[c.PRERELEASELOOSE]})?${l[c.BUILD]}?)?)?`),u("XRANGE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAIN]}$`),u("XRANGELOOSE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAINLOOSE]}$`),u("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),u("COERCE",`${l[c.COERCEPLAIN]}(?:$|[^\\d])`),u("COERCEFULL",l[c.COERCEPLAIN]+`(?:${l[c.PRERELEASE]})?`+`(?:${l[c.BUILD]})?(?:$|[^\\d])`),u("COERCERTL",l[c.COERCE],!0),u("COERCERTLFULL",l[c.COERCEFULL],!0),u("LONETILDE","(?:~>?)"),u("TILDETRIM",`(\\s*)${l[c.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",u("TILDE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAIN]}$`),u("TILDELOOSE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAINLOOSE]}$`),u("LONECARET","(?:\\^)"),u("CARETTRIM",`(\\s*)${l[c.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",u("CARET",`^${l[c.LONECARET]}${l[c.XRANGEPLAIN]}$`),u("CARETLOOSE",`^${l[c.LONECARET]}${l[c.XRANGEPLAINLOOSE]}$`),u("COMPARATORLOOSE",`^${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]})$|^$`),u("COMPARATOR",`^${l[c.GTLT]}\\s*(${l[c.FULLPLAIN]})$|^$`),u("COMPARATORTRIM",`(\\s*)${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]}|${l[c.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",u("HYPHENRANGE",`^\\s*(${l[c.XRANGEPLAIN]})\\s+-\\s+(${l[c.XRANGEPLAIN]})\\s*$`),u("HYPHENRANGELOOSE",`^\\s*(${l[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[c.XRANGEPLAINLOOSE]})\\s*$`),u("STAR","(<|>)?=?\\s*\\*"),u("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),u("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(be,be.exports)),be.exports}function Ae(){if(J)return q;J=1;const e=we(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=ye(),{safeRe:r,t:i}=Oe(),o=U(),{compareIdentifiers:a}=function(){if(Y)return H;Y=1;const e=/^[0-9]+$/,t=(t,n)=>{const r=e.test(t),i=e.test(n);return r&&i&&(t=+t,n=+n),t===n?0:r&&!i?-1:i&&!r?1:tt(n,e)}}();class s{constructor(a,l){if(l=o(l),a instanceof s){if(a.loose===!!l.loose&&a.includePrerelease===!!l.includePrerelease)return a;a=a.version}else if("string"!=typeof a)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof a}".`);if(a.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",a,l),this.options=l,this.loose=!!l.loose,this.includePrerelease=!!l.includePrerelease;const c=a.trim().match(l.loose?r[i.LOOSE]:r[i.FULL]);if(!c)throw new TypeError(`Invalid Version: ${a}`);if(this.raw=a,this.major=+c[1],this.minor=+c[2],this.patch=+c[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");c[4]?this.prerelease=c[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];!1===n&&(r=[t]),0===a(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return q=s}function Ie(){if(Z)return Q;Z=1;const e=Ae();return Q=(t,n,r)=>new e(t,r).compare(new e(n,r))}function xe(){if(pe)return de;pe=1;const e=function(){if(ee)return K;ee=1;const e=Ie();return K=(t,n,r)=>0===e(t,n,r)}(),t=function(){if(ne)return te;ne=1;const e=Ie();return te=(t,n,r)=>0!==e(t,n,r)}(),n=function(){if(ie)return re;ie=1;const e=Ie();return re=(t,n,r)=>e(t,n,r)>0}(),r=function(){if(ae)return oe;ae=1;const e=Ie();return oe=(t,n,r)=>e(t,n,r)>=0}(),i=function(){if(le)return se;le=1;const e=Ie();return se=(t,n,r)=>e(t,n,r)<0}(),o=function(){if(fe)return ce;fe=1;const e=Ie();return ce=(t,n,r)=>e(t,n,r)<=0}();return de=(a,s,l,c)=>{switch(s){case"===":return"object"==typeof a&&(a=a.version),"object"==typeof l&&(l=l.version),a===l;case"!==":return"object"==typeof a&&(a=a.version),"object"==typeof l&&(l=l.version),a!==l;case"":case"=":case"==":return e(a,l,c);case"!=":return t(a,l,c);case">":return n(a,l,c);case">=":return r(a,l,c);case"<":return i(a,l,c);case"<=":return o(a,l,c);default:throw new TypeError(`Invalid operator: ${s}`)}}}function Le(){if(me)return ge;me=1;const e=/\s+/g;class t{constructor(n,o){if(o=r(o),n instanceof t)return n.loose===!!o.loose&&n.includePrerelease===!!o.includePrerelease?n:new t(n.raw,o);if(n instanceof i)return this.raw=n.value,this.set=[[n]],this.formatted=void 0,this;if(this.options=o,this.loose=!!o.loose,this.includePrerelease=!!o.includePrerelease,this.raw=n.trim().replace(e," "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!h(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&g(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&p)|(this.options.loose&&u))+":"+e,r=n.get(t);if(r)return r;const a=this.options.loose,g=a?s[l.HYPHENRANGELOOSE]:s[l.HYPHENRANGE];e=e.replace(g,N(this.options.includePrerelease)),o("hyphen replace",e),e=e.replace(s[l.COMPARATORTRIM],c),o("comparator trim",e),e=e.replace(s[l.TILDETRIM],f),o("tilde trim",e),e=e.replace(s[l.CARETTRIM],d),o("caret trim",e);let m=e.split(" ").map((e=>E(e,this.options))).join(" ").split(/\s+/).map((e=>L(e,this.options)));a&&(m=m.filter((e=>(o("loose invalid filter",e,this.options),!!e.match(s[l.COMPARATORLOOSE]))))),o("range list",m);const v=new Map,b=m.map((e=>new i(e,this.options)));for(const e of b){if(h(e))return[e];v.set(e.value,e)}v.size>1&&v.has("")&&v.delete("");const y=[...v.values()];return n.set(t,y),y}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((t=>m(t,n)&&e.set.some((e=>m(e,n)&&t.every((t=>e.every((e=>t.intersects(e,n)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}})),r=U(),i=function(){if(he)return ue;he=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(r,i){if(i=n(i),r instanceof t){if(r.loose===!!i.loose)return r;r=r.value}r=r.trim().split(/\s+/).join(" "),a("comparator",r,i),this.options=i,this.loose=!!i.loose,this.parse(r),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(t){const n=this.options.loose?r[i.COMPARATORLOOSE]:r[i.COMPARATOR],o=t.match(n);if(!o)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==o[1]?o[1]:"","="===this.operator&&(this.operator=""),o[2]?this.semver=new s(o[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(a("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new s(t,this.options)}catch(e){return!1}return o(t,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new l(e.value,r).test(this.value):""===e.operator?""===e.value||new l(this.value,r).test(e.semver):!((r=n(r)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(o(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(o(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}ue=t;const n=U(),{safeRe:r,t:i}=Oe(),o=xe(),a=we(),s=Ae(),l=Le();return ue}(),o=we(),a=Ae(),{safeRe:s,t:l,comparatorTrimReplace:c,tildeTrimReplace:f,caretTrimReplace:d}=Oe(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:u}=ye(),h=e=>"<0.0.0-0"===e.value,g=e=>""===e.value,m=(e,t)=>{let n=!0;const r=e.slice();let i=r.pop();for(;n&&r.length;)n=r.every((e=>i.intersects(e,t))),i=r.pop();return n},E=(e,t)=>(o("comp",e,t),e=w(e,t),o("caret",e),e=b(e,t),o("tildes",e),e=A(e,t),o("xrange",e),e=x(e,t),o("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,b=(e,t)=>e.trim().split(/\s+/).map((e=>y(e,t))).join(" "),y=(e,t)=>{const n=t.loose?s[l.TILDELOOSE]:s[l.TILDE];return e.replace(n,((t,n,r,i,a)=>{let s;return o("tilde",e,t,n,r,i,a),v(n)?s="":v(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o("replaceTilde pr",a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o("tilde return",s),s}))},w=(e,t)=>e.trim().split(/\s+/).map((e=>O(e,t))).join(" "),O=(e,t)=>{o("caret",e,t);const n=t.loose?s[l.CARETLOOSE]:s[l.CARET],r=t.includePrerelease?"-0":"";return e.replace(n,((t,n,i,a,s)=>{let l;return o("caret",e,t,n,i,a,s),v(n)?l="":v(i)?l=`>=${n}.0.0${r} <${+n+1}.0.0-0`:v(a)?l="0"===n?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o("replaceCaret pr",s),l="0"===n?"0"===i?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o("no pr"),l="0"===n?"0"===i?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o("caret return",l),l}))},A=(e,t)=>(o("replaceXRanges",e,t),e.split(/\s+/).map((e=>I(e,t))).join(" ")),I=(e,t)=>{e=e.trim();const n=t.loose?s[l.XRANGELOOSE]:s[l.XRANGE];return e.replace(n,((n,r,i,a,s,l)=>{o("xRange",e,n,r,i,a,s,l);const c=v(i),f=c||v(a),d=f||v(s),p=d;return"="===r&&p&&(r=""),l=t.includePrerelease?"-0":"",c?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&p?(f&&(a=0),s=0,">"===r?(r=">=",f?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):"<="===r&&(r="<",f?i=+i+1:a=+a+1),"<"===r&&(l="-0"),n=`${r+i}.${a}.${s}${l}`):f?n=`>=${i}.0.0${l} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${l} <${i}.${+a+1}.0-0`),o("xRange return",n),n}))},x=(e,t)=>(o("replaceStars",e,t),e.trim().replace(s[l.STAR],"")),L=(e,t)=>(o("replaceGTE0",e,t),e.trim().replace(s[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),N=e=>(t,n,r,i,o,a,s,l,c,f,d,p)=>`${n=v(r)?"":v(i)?`>=${r}.0.0${e?"-0":""}`:v(o)?`>=${r}.${i}.0${e?"-0":""}`:a?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=v(c)?"":v(f)?`<${+c+1}.0.0-0`:v(d)?`<${c}.${+f+1}.0-0`:p?`<=${c}.${f}.${d}-${p}`:e?`<${c}.${f}.${+d+1}-0`:`<=${l}`}`.trim(),$=(e,t,n)=>{for(let n=0;n0){const r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0};return ge}var Ne=function(){if(ve)return Ee;ve=1;const e=Le();return Ee=(t,n,r)=>{try{n=new e(n,r)}catch(e){return!1}return n.test(t)},Ee}(),$e=_(Ne);var Re={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},Te={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},Se={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const Ce=Array.prototype.slice,De=(e,t,n)=>{const r=n?n(t[0]):t[0];return r[e].apply(r,Ce.call(t,1))};var Fe={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:(e,t,n,r,i,o,a)=>new Date(e,t||0,null!=n?n:1,r||0,i||0,o||0,a||0),date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return De("join",arguments)},indexof:function(){return De("indexOf",arguments)},lastindexof:function(){return De("lastIndexOf",arguments)},slice:function(){return De("slice",arguments)},reverse:e=>e.slice().reverse(),parseFloat:parseFloat,parseInt:parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return De("substring",arguments,String)},split:function(){return De("split",arguments,String)},replace:function(){return De("replace",arguments,String)},trim:e=>String(e).trim(),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const ke=["view","item","group","xy","x","y"],_e=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&_e.add(setImmediate);const Pe={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:"datum"===n?e.datum:"event"===n?e.event:"item"===n?e.item:Re[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,r=e(t.object);n&&(e.memberDepth+=1);const i=e(t.property);if(n&&(e.memberDepth-=1),!_e.has(r[i]))return r[i];console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`)},CallExpression:(e,t)=>{const n=t.arguments;let r=t.callee.name;return r.startsWith("_")&&(r=r.slice(1)),"if"===r?e(n[0])?e(n[1]):e(n[2]):(e.fn[r]||Fe[r]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>Te[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>Se[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>"&&"===t.operator?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce(((t,n)=>{e.memberDepth+=1;const r=e(n.key);return e.memberDepth-=1,_e.has(e(n.value))?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):t[r]=e(n.value),t}),{})};function Me(e,t,n,r,i,o){const a=e=>Pe[e.type](a,e);return a.memberDepth=0,a.fn=Object.create(t),a.params=n,a.datum=r,a.event=i,a.item=o,ke.forEach((e=>a.fn[e]=function(){return i.vega[e](...arguments)})),a(e)}var ze={operator(e,t){const n=t.ast,r=e.functions;return e=>Me(n,r,e)},parameter(e,t){const n=t.ast,r=e.functions;return(e,t)=>Me(n,r,t,e)},event(e,t){const n=t.ast,r=e.functions;return e=>Me(n,r,void 0,void 0,e)},handler(e,t){const n=t.ast,r=e.functions;return(e,t)=>{const i=t.item&&t.item.datum;return Me(n,r,e,i,t)}},encode(e,t){const{marktype:n,channels:r}=t,i=e.functions,o="group"===n||"image"===n||"rect"===n;return(e,t)=>{const a=e.datum;let s,l=0;for(const n in r)s=Me(r[n].ast,i,t,a,void 0,e),e[n]!==s&&(e[n]=s,l=1);return"rule"!==n&&function(e,t,n){let r;t.x2&&(t.x?(n&&e.x>e.x2&&(r=e.x,e.x=e.x2,e.x2=r),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(r=e.y,e.y=e.y2,e.y2=r),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}(e,r,o),l}}};function je(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}var Ue="2.15.0";const Be="#fff",Ge="#888",We={background:"#333",view:{stroke:Ge},title:{color:Be,subtitleColor:Be},style:{"guide-label":{fill:Be},"guide-title":{fill:Be}},axis:{domainColor:Be,gridColor:Ge,tickColor:Be}},Xe="#4572a7",Ve={background:"#fff",arc:{fill:Xe},area:{fill:Xe},line:{stroke:Xe,strokeWidth:2},path:{stroke:Xe},rect:{fill:Xe},shape:{stroke:Xe},symbol:{fill:Xe,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},He="#30a2da",Ye="#cbcbcb",qe="#f0f0f0",Je="#333",Qe={arc:{fill:He},area:{fill:He},axis:{domainColor:Ye,grid:!0,gridColor:Ye,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:Ye,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:qe,group:{fill:qe},legend:{labelColor:Je,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:Je,titleFontSize:14,titlePadding:10},line:{stroke:He,strokeWidth:2},path:{stroke:He,strokeWidth:.5},rect:{fill:He},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:He},bar:{binSpacing:2,fill:He,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},Ze="#000",Ke={group:{fill:"#e5e5e5"},arc:{fill:Ze},area:{fill:Ze},line:{stroke:Ze},path:{stroke:Ze},rect:{fill:Ze},shape:{stroke:Ze},symbol:{fill:Ze,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},et="Benton Gothic, sans-serif",tt="#82c6df",nt="Benton Gothic Bold, sans-serif",rt="normal",it={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"],"ice-7":["#edefee","#dadfe2","#c4ccd2","#a6b7c6","#849eae","#607785","#47525d"]},ot={background:"#ffffff",title:{anchor:"start",color:"#000000",font:nt,fontSize:22,fontWeight:"normal"},arc:{fill:tt},area:{fill:tt},line:{stroke:tt,strokeWidth:2},path:{stroke:tt},rect:{fill:tt},shape:{stroke:tt},symbol:{fill:tt,size:30},axis:{labelFont:et,labelFontSize:11.5,labelFontWeight:"normal",titleFont:nt,titleFontSize:13,titleFontWeight:rt},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:et,labelFontSize:11.5,symbolType:"square",titleFont:nt,titleFontSize:13,titleFontWeight:rt},range:{category:it["category-6"],diverging:it["fireandice-6"],heatmap:it["fire-7"],ordinal:it["fire-7"],ramp:it["fire-7"]}},at="#ab5787",st="#979797",lt={background:"#f9f9f9",arc:{fill:at},area:{fill:at},line:{stroke:at},path:{stroke:at},rect:{fill:at},shape:{stroke:at},symbol:{fill:at,size:30},axis:{domainColor:st,domainWidth:.5,gridWidth:.2,labelColor:st,tickColor:st,tickWidth:.2,titleColor:st},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},ct="#3e5c69",ft={background:"#fff",arc:{fill:ct},area:{fill:ct},line:{stroke:ct},path:{stroke:ct},rect:{fill:ct},shape:{stroke:ct},symbol:{fill:ct},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},dt="#1696d2",pt="#000000",ut="Lato",ht="Lato",gt={"main-colors":["#1696d2","#d2d2d2","#000000","#fdbf11","#ec008b","#55b748","#5c5859","#db2b27"],"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"shades-gray":["#F5F5F5","#ECECEC","#E3E3E3","#DCDBDB","#D2D2D2","#9D9D9D","#696969","#353535"],"shades-yellow":["#FFF2CF","#FCE39E","#FDD870","#FCCB41","#FDBF11","#E88E2D","#CA5800","#843215"],"shades-magenta":["#F5CBDF","#EB99C2","#E46AA7","#E54096","#EC008B","#AF1F6B","#761548","#351123"],"shades-green":["#DCEDD9","#BCDEB4","#98CF90","#78C26D","#55B748","#408941","#2C5C2D","#1A2E19"],"shades-black":["#D5D5D4","#ADABAC","#848081","#5C5859","#332D2F","#262223","#1A1717","#0E0C0D"],"shades-red":["#F8D5D4","#F1AAA9","#E9807D","#E25552","#DB2B27","#A4201D","#6E1614","#370B0A"],"one-group":["#1696d2","#000000"],"two-groups-cat-1":["#1696d2","#000000"],"two-groups-cat-2":["#1696d2","#fdbf11"],"two-groups-cat-3":["#1696d2","#db2b27"],"two-groups-seq":["#a2d4ec","#1696d2"],"three-groups-cat":["#1696d2","#fdbf11","#000000"],"three-groups-seq":["#a2d4ec","#1696d2","#0a4c6a"],"four-groups-cat-1":["#000000","#d2d2d2","#fdbf11","#1696d2"],"four-groups-cat-2":["#1696d2","#ec0008b","#fdbf11","#5c5859"],"four-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a"],"five-groups-cat-1":["#1696d2","#fdbf11","#d2d2d2","#ec008b","#000000"],"five-groups-cat-2":["#1696d2","#0a4c6a","#d2d2d2","#fdbf11","#332d2f"],"five-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a","#000000"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-cat-2":["#1696d2","#d2d2d2","#ec008b","#fdbf11","#332d2f","#0a4c6a"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},mt={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:ut},axisX:{domain:!0,domainColor:pt,domainWidth:1,grid:!1,labelFontSize:12,labelFont:ht,labelAngle:0,tickColor:pt,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:ut},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:ht,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:ut,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:ht,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:ut,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:gt["six-groups-cat-1"],diverging:gt["diverging-colors"],heatmap:gt["diverging-colors"],ordinal:gt["six-groups-seq"],ramp:gt["shades-blue"]},area:{fill:dt},rect:{fill:dt},line:{color:dt,stroke:dt,strokeWidth:5},trail:{color:dt,stroke:dt,strokeWidth:0,size:1},path:{stroke:dt,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:dt,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:dt,stroke:null}},arc:{fill:dt},shape:{stroke:dt},symbol:{fill:dt,size:30}},Et="#3366CC",vt="#ccc",bt="Arial, sans-serif",yt={arc:{fill:Et},area:{fill:Et},path:{stroke:Et},rect:{fill:Et},shape:{stroke:Et},symbol:{stroke:Et},circle:{fill:Et},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:bt,fontSize:12},"guide-title":{font:bt,fontSize:12},"group-title":{font:bt,fontSize:12}},title:{font:bt,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:vt,tickColor:vt,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},wt=e=>e*(1/3+1),Ot=wt(9),At=wt(10),It=wt(12),xt="Segoe UI",Lt="wf_standard-font, helvetica, arial, sans-serif",Nt="#252423",$t="#605E5C",Rt="transparent",Tt="#118DFF",St="#DEEFFF",Ct=[St,Tt],Dt={view:{stroke:Rt},background:Rt,font:xt,header:{titleFont:Lt,titleFontSize:It,titleColor:Nt,labelFont:xt,labelFontSize:At,labelColor:$t},axis:{ticks:!1,grid:!1,domain:!1,labelColor:$t,labelFontSize:Ot,titleFont:Lt,titleColor:Nt,titleFontSize:It,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:"#C8C6C4",gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:Tt},line:{stroke:Tt,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:xt,fontSize:Ot,fill:$t},arc:{fill:Tt},area:{fill:Tt,line:!0,opacity:.6},path:{stroke:Tt},rect:{fill:Tt},point:{fill:Tt,filled:!0,size:75},shape:{stroke:Tt},symbol:{fill:Tt,strokeWidth:1.5,size:50},legend:{titleFont:xt,titleFontWeight:"bold",titleColor:$t,labelFont:xt,labelFontSize:At,labelColor:$t,symbolType:"circle",symbolSize:75},range:{category:[Tt,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:Ct,heatmap:Ct,ordinal:[St,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",Tt]}},Ft='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',kt={textPrimary:{g90:"#f4f4f4",g100:"#f4f4f4",white:"#161616",g10:"#161616"},textSecondary:{g90:"#c6c6c6",g100:"#c6c6c6",white:"#525252",g10:"#525252"},layerAccent01:{white:"#e0e0e0",g10:"#e0e0e0",g90:"#525252",g100:"#393939"},gridBg:{white:"#ffffff",g10:"#ffffff",g90:"#161616",g100:"#161616"}},_t=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],Pt=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function Mt({theme:e,background:t}){const n=["white","g10"].includes(e)?"light":"dark",r=kt.gridBg[e],i=kt.textPrimary[e],o=kt.textSecondary[e],a="dark"===n?_t:Pt,s="dark"===n?"#d4bbff":"#6929c4";return{background:t,arc:{fill:s},area:{fill:s},path:{stroke:s},rect:{fill:s},shape:{stroke:s},symbol:{stroke:s},circle:{fill:s},view:{fill:r,stroke:r},group:{fill:r},title:{color:i,anchor:"start",dy:-15,fontSize:16,font:Ft,fontWeight:600},axis:{labelColor:o,labelFontSize:12,labelFont:'IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif',labelFontWeight:400,titleColor:i,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:kt.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:Ft,fill:o,fontWeight:400},"guide-title":{font:Ft,fill:o,fontWeight:400}},range:{category:a,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const zt=Mt({theme:"white",background:"#ffffff"}),jt=Mt({theme:"g10",background:"#f4f4f4"}),Ut=Mt({theme:"g90",background:"#262626"}),Bt=Mt({theme:"g100",background:"#161616"}),Gt=Ue;var Wt=Object.freeze({__proto__:null,carbong10:jt,carbong100:Bt,carbong90:Ut,carbonwhite:zt,dark:We,excel:Ve,fivethirtyeight:Qe,ggplot2:Ke,googlecharts:yt,latimes:ot,powerbi:Dt,quartz:lt,urbaninstitute:mt,version:Gt,vox:ft});function Xt(e,t,n){return e.fields=t||[],e.fname=n,e}const Vt=e=>function(t){return t[e]},Ht=e=>{const t=e.length;return function(n){for(let r=0;rr&&c(),s=r=i+1):"]"===o&&(s||Yt("Access path missing open bracket: "+e),s>0&&c(),s=0,r=i+1):i>r?c():r=i+1}return s&&Yt("Access path missing closing bracket: "+e),a&&Yt("Access path missing closing quote: "+e),i>r&&(i++,c()),t}(e);e=1===t.length?t[0]:e,Xt(function(e){return 1===e.length?Vt(e[0]):Ht(e)}(t),[e],e)}("id"),Xt((e=>e),[],"identity"),Xt((()=>0),[],"zero"),Xt((()=>1),[],"one"),Xt((()=>!0),[],"true"),Xt((()=>!1),[],"false");var qt=Array.isArray;function Jt(e){return e===Object(e)}function Qt(e,t){return JSON.stringify(e,function(e){const t=[];return function(n,r){if("object"!=typeof r||null===r)return r;const i=t.indexOf(this)+1;return t.length=i,t.length>e?"[Object]":t.indexOf(r)>=0?"[Circular]":(t.push(r),r)}}(t))}var Zt="#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n";const Kt="vg-tooltip-element",en={offsetX:10,offsetY:10,id:Kt,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&").replace(/t("string"==typeof e?e:Qt(e,n)))).join(", ")}]`;if(Jt(e)){let i="";const{title:o,image:a,...s}=e;o&&(i+=`

${t(o)}

`),a&&(i+=``);const l=Object.keys(s);if(l.length>0){i+="";for(const e of l){let r=s[e];void 0!==r&&(Jt(r)&&(r=Qt(r,n)),i+=``)}i+="
${t(e)}${t(r)}
"}return i||"{}"}return t(e)},baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function tn(e,t,{offsetX:n,offsetY:r}){const i=nn({x1:e.clientX,x2:e.clientX,y1:e.clientY,y2:e.clientY},t,n,r),o=["bottom-right","bottom-left","top-right","top-left"];for(const e of o)if(rn(i[e],t))return i[e];return i["top-left"]}function nn(e,t,n,r){const i=(e.x1+e.x2)/2,o=(e.y1+e.y2)/2,a=e.x1-t.width-n,s=i-t.width/2,l=e.x2+n,c=e.y1-t.height-r,f=o-t.height/2,d=e.y2+r;return{top:{x:s,y:c},bottom:{x:s,y:d},left:{x:a,y:f},right:{x:l,y:f},"top-left":{x:a,y:c},"top-right":{x:l,y:c},"bottom-left":{x:a,y:d},"bottom-right":{x:l,y:d}}}function rn(e,t){return e.x>=0&&e.y>=0&&e.x+t.width<=window.innerWidth&&e.y+t.height<=window.innerHeight}function on(e,t,n){return e.clientX>=t.x&&e.clientX<=t.x+n.width&&e.clientY>=t.y&&e.clientY<=t.y+n.height}class an{constructor(e){this.options={...en,...e};const t=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const e=document.createElement("style");e.setAttribute("id",this.options.styleId),e.innerHTML=function(e){if(!/^[A-Za-z]+[-:.\w]*$/.test(e))throw new Error("Invalid HTML ID");return Zt.toString().replace(Kt,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,r){if(this.el=document.getElementById(this.options.id),!this.el){this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip");(document.fullscreenElement??document.body).appendChild(this.el)}if(null==r||""===r)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(r,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:i,y:o}="mark"===this.options.anchor?function(e,t,n,r,i){const{position:o,offsetX:a,offsetY:s}=i,l=function(e,t,n){const r=n.isVoronoi?n.datum.bounds:n.bounds;let i=e.left+t[0]+r.x1,o=e.top+t[1]+r.y1,a=n;for(;a.mark.group;)a=a.mark.group,i+=a.x??0,o+=a.y??0;return{x1:i,x2:i+(r.x2-r.x1),y1:o,y2:o+(r.y2-r.y1)}}(e._el.getBoundingClientRect(),e._origin,n),c=nn(l,r,a,s),f=Array.isArray(o)?o:[o];for(const e of f)if(rn(c[e],r)&&!on(t,c[e],r))return c[e];return tn(t,r,i)}(e,t,n,this.el.getBoundingClientRect(),this.options):tn(t,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${o}px`,this.el.style.left=`${i}px`}}var sn='.vega-embed {\n position: relative;\n display: inline-block;\n box-sizing: border-box;\n}\n.vega-embed.has-actions {\n padding-right: 38px;\n}\n.vega-embed details:not([open]) > :not(summary) {\n display: none !important;\n}\n.vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n cursor: pointer;\n line-height: 0px;\n}\n.vega-embed summary::-webkit-details-marker {\n display: none;\n}\n.vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset;\n}\n.vega-embed summary svg {\n width: 14px;\n height: 14px;\n}\n.vega-embed details[open] summary {\n opacity: 0.7;\n}\n.vega-embed:hover summary, .vega-embed:focus-within summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease;\n}\n.vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left;\n}\n.vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none;\n}\n.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus {\n background-color: #f7f7f9;\n color: black;\n}\n.vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: "";\n display: inline-block;\n position: absolute;\n}\n.vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid rgba(0, 0, 0, 0);\n border-bottom-color: #d9d9d9;\n}\n.vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid rgba(0, 0, 0, 0);\n border-bottom-color: #fff;\n}\n.vega-embed .chart-wrapper.fit-x {\n width: 100%;\n}\n.vega-embed .chart-wrapper.fit-y {\n height: 100%;\n}\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: auto;\n padding-right: 14px;\n}\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n';function ln(e,...t){for(const n of t)cn(e,n);return e}function cn(t,n){for(const r of Object.keys(n))e.writeConfig(t,r,n[r],!0)}const fn="6.29.0",dn=i;let pn=o;const un="undefined"!=typeof window?window:void 0;void 0===pn&&un?.vl?.compile&&(pn=un.vl);const hn={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},gn={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},mn={vega:"Vega","vega-lite":"Vega-Lite"},En={vega:dn.version,"vega-lite":pn?pn.version:"not available"},vn={vega:e=>e,"vega-lite":(e,t)=>pn.compile(e,{config:t}).spec},bn='\n\n \n \n \n',yn="chart-wrapper";function wn(e,t,n,r){const i=`${t}
`,o=`
${n}`,a=window.open("");a.document.write(i+e+o),a.document.title=`${mn[r]} JSON Source`}function On(e){return!(!e||!("load"in e))}function An(e){return On(e)?e:dn.loader(e)}async function In(t,n,r={}){let i,o;e.isString(n)?(o=An(r.loader),i=JSON.parse(await o.load(n))):i=n;const a=function(t){const n=t.usermeta?.embedOptions??{};return e.isString(n.defaultStyle)&&(n.defaultStyle=!1),n}(i),s=a.loader;o&&!s||(o=An(r.loader??s));const l=await xn(a,o),c=await xn(r,o),f={...ln(c,l),config:e.mergeConfig(c.config??{},l.config??{})};return await async function(t,n,r={},i){const o=r.theme?e.mergeConfig(Wt[r.theme],r.config??{}):r.config,a=e.isBoolean(r.actions)?r.actions:ln({},hn,r.actions??{}),s={...gn,...r.i18n},l=r.renderer??"canvas",c=r.logLevel??dn.Warn,f=r.downloadFileName??"visualization",d="string"==typeof t?document.querySelector(t):t;if(!d)throw new Error(`${t} does not exist`);if(!1!==r.defaultStyle){const e="vega-embed-style",{root:t,rootContainer:n}=function(e){const t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}(d);if(!t.getElementById(e)){const t=document.createElement("style");t.id=e,t.innerHTML=void 0===r.defaultStyle||!0===r.defaultStyle?sn.toString():r.defaultStyle,n.appendChild(t)}}const p=function(e,t){if(e.$schema){const n=je(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${mn[n.library]}, but mode argument sets ${mn[t]??t}.`);const r=n.library;return $e(En[r],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${mn[r]} ${n.version}, but the current version of ${mn[r]} is v${En[r]}.`),r}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":t??"vega"}(n,r.mode);let u=vn[p](n,o);if("vega-lite"===p&&u.$schema){const e=je(u.$schema);$e(En.vega,`^${e.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${En.vega}.`)}d.classList.add("vega-embed"),a&&d.classList.add("has-actions");d.innerHTML="";let h=d;if(a){const e=document.createElement("div");e.classList.add(yn),d.appendChild(e),h=e}const g=r.patch;g&&(u=g instanceof Function?g(u):A(u,g,!0,!1).newDocument);r.formatLocale&&dn.formatLocale(r.formatLocale);r.timeFormatLocale&&dn.timeFormatLocale(r.timeFormatLocale);if(r.expressionFunctions)for(const e in r.expressionFunctions){const t=r.expressionFunctions[e];"fn"in t?dn.expressionFunction(e,t.fn,t.visitor):t instanceof Function&&dn.expressionFunction(e,t)}const{ast:m}=r,E=dn.parse(u,"vega-lite"===p?{}:o,{ast:m}),v=new(r.viewClass||dn.View)(E,{loader:i,logLevel:c,renderer:l,...m?{expr:dn.expressionInterpreter??r.expr??ze}:{}});if(v.addSignalListener("autosize",((e,t)=>{const{type:n}=t;"fit-x"==n?(h.classList.add("fit-x"),h.classList.remove("fit-y")):"fit-y"==n?(h.classList.remove("fit-x"),h.classList.add("fit-y")):"fit"==n?h.classList.add("fit-x","fit-y"):h.classList.remove("fit-x","fit-y")})),!1!==r.tooltip){const{loader:e,tooltip:t}=r,n=e&&!On(e)?e?.baseURL:void 0,i="function"==typeof t?t:new an({baseURL:n,...!0===t?{}:t}).call;v.tooltip(i)}let b,{hover:y}=r;void 0===y&&(y="vega"===p);if(y){const{hoverSet:e,updateSet:t}="boolean"==typeof y?{}:y;v.hover(e,t)}r&&(null!=r.width&&v.width(r.width),null!=r.height&&v.height(r.height),null!=r.padding&&v.padding(r.padding));if(await v.initialize(h,r.bind).runAsync(),!1!==a){let t=d;if(!1!==r.defaultStyle||r.forceActionsMenu){const e=document.createElement("details");e.title=s.CLICK_TO_VIEW_ACTIONS,d.append(e),t=e;const n=document.createElement("summary");n.innerHTML=bn,e.append(n),b=t=>{e.contains(t.target)||e.removeAttribute("open")},document.addEventListener("click",b)}const i=document.createElement("div");if(t.append(i),i.classList.add("vega-actions"),!0===a||!1!==a.export)for(const t of["svg","png"])if(!0===a||!0===a.export||a.export[t]){const n=s[`${t.toUpperCase()}_ACTION`],o=document.createElement("a"),a=e.isObject(r.scaleFactor)?r.scaleFactor[t]:r.scaleFactor;o.text=n,o.href="#",o.target="_blank",o.download=`${f}.${t}`,o.addEventListener("mousedown",(async function(e){e.preventDefault();const n=await v.toImageURL(t,a);this.href=n})),i.append(o)}if(!0===a||!1!==a.source){const e=document.createElement("a");e.text=s.SOURCE_ACTION,e.href="#",e.addEventListener("click",(function(e){wn(k(n),r.sourceHeader??"",r.sourceFooter??"",p),e.preventDefault()})),i.append(e)}if("vega-lite"===p&&(!0===a||!1!==a.compiled)){const e=document.createElement("a");e.text=s.COMPILED_ACTION,e.href="#",e.addEventListener("click",(function(e){wn(k(u),r.sourceHeader??"",r.sourceFooter??"","vega"),e.preventDefault()})),i.append(e)}if(!0===a||!1!==a.editor){const e=r.editorUrl??"https://vega.github.io/editor/",t=document.createElement("a");t.text=s.EDITOR_ACTION,t.href="#",t.addEventListener("click",(function(t){!function(e,t,n){const r=e.open(t),{origin:i}=new URL(t);let o=40;e.addEventListener("message",(function t(n){n.source===r&&(o=0,e.removeEventListener("message",t,!1))}),!1),setTimeout((function e(){o<=0||(r.postMessage(n,i),setTimeout(e,250),o-=1)}),250)}(window,e,{config:o,mode:g?"vega":p,renderer:l,spec:k(g?u:n)}),t.preventDefault()})),i.append(t)}}function w(){b&&document.removeEventListener("click",b),v.finalize()}return{view:v,spec:n,vgSpec:u,finalize:w,embedOptions:r}}(t,i,f,o)}async function xn(t,n){const r=e.isString(t.config)?JSON.parse(await n.load(t.config)):t.config??{},i=e.isString(t.patch)?JSON.parse(await n.load(t.patch)):t.patch;return{...t,...i?{patch:i}:{},...r?{config:r}:{}}}async function Ln(e,t={}){const n=document.createElement("div");n.classList.add("vega-embed-wrapper");const r=document.createElement("div");n.appendChild(r);const i=!0===t.actions||!1===t.actions?t.actions:{export:!0,source:!1,compiled:!0,editor:!0,...t.actions},o=await In(r,e,{actions:i,...t});return n.value=o.view,n}const Nn=(...t)=>{return t.length>1&&(e.isString(t[0])&&!((n=t[0]).startsWith("http://")||n.startsWith("https://")||n.startsWith("//"))||t[0]instanceof HTMLElement||3===t.length)?In(t[0],t[1],t[2]):Ln(t[0],t[1]);var n};return Nn.vegaLite=pn,Nn.vl=pn,Nn.container=Ln,Nn.embed=In,Nn.vega=dn,Nn.default=In,Nn.version=fn,Nn})); +//# sourceMappingURL=vega-embed.min.js.map diff --git a/static/vendor/retained-analysis/vega-interpreter.min.js b/static/vendor/retained-analysis/vega-interpreter.min.js new file mode 100644 index 00000000..de346e43 --- /dev/null +++ b/static/vendor/retained-analysis/vega-interpreter.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-util"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega=e.vega||{},e.vega)}(this,(function(e,t){"use strict";var n={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},a={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},r={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const o=Array.prototype.slice,i=(e,t,n)=>{const a=n?n(t[0]):t[0];return a[e].apply(a,o.call(t,1))};var s={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:(e,t,n,a,r,o,i)=>new Date(e,t||0,null!=n?n:1,a||0,r||0,o||0,i||0),date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return i("join",arguments)},indexof:function(){return i("indexOf",arguments)},lastindexof:function(){return i("lastIndexOf",arguments)},slice:function(){return i("slice",arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(t.ascending),parseFloat:parseFloat,parseInt:parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return i("substring",arguments,String)},split:function(){return i("split",arguments,String)},replace:function(){return i("replace",arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const c=["view","item","group","xy","x","y"],u=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&u.add(setImmediate);const l={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const a=t.name;return e.memberDepth>0?a:"datum"===a?e.datum:"event"===a?e.event:"item"===a?e.item:n[a]||e.params["$"+a]},MemberExpression:(e,t)=>{const n=!t.computed,a=e(t.object);n&&(e.memberDepth+=1);const r=e(t.property);if(n&&(e.memberDepth-=1),!u.has(a[r]))return a[r];console.error(`Prevented interpretation of member "${r}" which could lead to insecure code execution`)},CallExpression:(e,t)=>{const n=t.arguments;let a=t.callee.name;return a.startsWith("_")&&(a=a.slice(1)),"if"===a?e(n[0])?e(n[1]):e(n[2]):(e.fn[a]||s[a]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>a[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>r[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>"&&"===t.operator?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce(((t,n)=>{e.memberDepth+=1;const a=e(n.key);return e.memberDepth-=1,u.has(e(n.value))?console.error(`Prevented interpretation of property "${a}" which could lead to insecure code execution`):t[a]=e(n.value),t}),{})};function m(e,t,n,a,r,o){const i=e=>l[e.type](i,e);return i.memberDepth=0,i.fn=Object.create(t),i.params=n,i.datum=a,i.event=r,i.item=o,c.forEach((e=>i.fn[e]=function(){return r.vega[e](...arguments)})),i(e)}var p={operator(e,t){const n=t.ast,a=e.functions;return e=>m(n,a,e)},parameter(e,t){const n=t.ast,a=e.functions;return(e,t)=>m(n,a,t,e)},event(e,t){const n=t.ast,a=e.functions;return e=>m(n,a,void 0,void 0,e)},handler(e,t){const n=t.ast,a=e.functions;return(e,t)=>{const r=t.item&&t.item.datum;return m(n,a,e,r,t)}},encode(e,t){const{marktype:n,channels:a}=t,r=e.functions,o="group"===n||"image"===n||"rect"===n;return(e,t)=>{const i=e.datum;let s,c=0;for(const n in a)s=m(a[n].ast,r,t,i,void 0,e),e[n]!==s&&(e[n]=s,c=1);return"rule"!==n&&function(e,t,n){let a;t.x2&&(t.x?(n&&e.x>e.x2&&(a=e.x,e.x=e.x2,e.x2=a),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(a=e.y,e.y=e.y2,e.y2=a),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}(e,a,o),c}}};e.expressionInterpreter=p})); +//# sourceMappingURL=vega-interpreter.min.js.map diff --git a/static/vendor/retained-analysis/vega-lite.min.js b/static/vendor/retained-analysis/vega-lite.min.js new file mode 100644 index 00000000..31b00323 --- /dev/null +++ b/static/vendor/retained-analysis/vega-lite.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega")):"function"==typeof define&&define.amd?define(["exports","vega"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vegaLite={},e.vega)}(this,(function(e,t){"use strict";var n="5.23.0";function i(e){return J(e,"or")}function r(e){return J(e,"and")}function o(e){return J(e,"not")}function a(e,t){if(o(e))a(e.not,t);else if(r(e))for(const n of e.and)a(n,t);else if(i(e))for(const n of e.or)a(n,t);else t(e)}function s(e,t){return o(e)?{not:s(e.not,t)}:r(e)?{and:e.and.map((e=>s(e,t)))}:i(e)?{or:e.or.map((e=>s(e,t)))}:t(e)}const l=structuredClone;function c(e){throw new Error(e)}function u(e,n){const i={};for(const r of n)t.hasOwnProperty(e,r)&&(i[r]=e[r]);return i}function f(e,t){const n={...e};for(const e of t)delete n[e];return n}function d(e){if(t.isNumber(e))return e;const n=t.isString(e)?e:Q(e);if(n.length<250)return n;let i=0;for(let e=0;e1?t-1:0),i=1;i0===t?e:`[${e}]`)),r=e.map(((t,n)=>e.slice(0,n+1).join("")));for(const e of r)n.add(e)}return n}function k(e,t){return void 0===e||void 0===t||$(w(e),w(t))}function S(e){return 0===D(e).length}Set.prototype.toJSON=function(){return`Set(${[...this].map((e=>Q(e))).join(",")})`};const D=Object.keys,F=Object.values,O=Object.entries;function z(e){return!0===e||!1===e}function C(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function _(e,t){return o(e)?`!(${_(e.not,t)})`:r(e)?`(${e.and.map((e=>_(e,t))).join(") && (")})`:i(e)?`(${e.or.map((e=>_(e,t))).join(") || (")})`:t(e)}function P(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&P(e[n],t)&&delete e[n],S(e)}function N(e){return e.charAt(0).toUpperCase()+e.substr(1)}function A(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"datum";const i=t.splitAccessPath(e),r=[];for(let e=1;e<=i.length;e++){const o=`[${i.slice(0,e).map(t.stringValue).join("][")}]`;r.push(`${n}${o}`)}return r.join(" && ")}function T(e){return`${arguments.length>1&&void 0!==arguments[1]?arguments[1]:"datum"}[${t.stringValue(t.splitAccessPath(e).join("."))}]`}function j(e){return`datum['${e.replaceAll("'","\\'")}']`}function E(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function M(e){return`${t.splitAccessPath(e).map(E).join("\\.")}`}function R(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function L(e){return`${t.splitAccessPath(e).join(".")}`}function q(e){return e?t.splitAccessPath(e).length:0}function U(){for(var e=arguments.length,t=new Array(e),n=0;nvoid 0!==e))}let W=42;function I(e){const t=++W;return e?String(e)+t:t}function B(e){return V(e)?e:`__${e}`}function V(e){return e.startsWith("__")}function H(e){if(void 0!==e)return(e%360+360)%360}function G(e){return!!t.isNumber(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const Y=Object.getPrototypeOf(structuredClone({}));function X(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor.name!==t.constructor.name)return!1;let n,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(i=n;0!=i--;)if(!X(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;for(const n of e.entries())if(!X(n[1],t.get(n[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(i=n;0!=i--;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==Y.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==Y.toString)return e.toString()===t.toString();const r=Object.keys(e);if(n=r.length,n!==Object.keys(t).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(i=n;0!=i--;){const n=r[i];if(!X(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Q(e){const t=[];return function e(n){if(n&&n.toJSON&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===n)return;if("number"==typeof n)return isFinite(n)?""+n:"null";if("object"!=typeof n)return JSON.stringify(n);let i,r;if(Array.isArray(n)){for(r="[",i=0;ihn(e[t])?C(`_${t}_${O(e[t])}`):C(`_${t}_${e[t]}`))).join("")}function mn(e){return!0===e||gn(e)&&!e.binned}function pn(e){return"binned"===e||gn(e)&&!0===e.binned}function gn(e){return t.isObject(e)}function hn(e){return J(e,"param")}function yn(e){switch(e){case K:case Z:case xe:case he:case ye:case ve:case De:case we:case ke:case Se:case be:return 6;case Fe:return 4;default:return 10}}function vn(e){return J(e,"expr")}function bn(e){let{level:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{level:0};const n=D(e||{}),i={};for(const r of n)i[r]=0===t?Cn(e[r]):bn(e[r],{level:t-1});return i}function xn(e){const{anchor:t,frame:n,offset:i,orient:r,angle:o,limit:a,color:s,subtitleColor:l,subtitleFont:c,subtitleFontSize:f,subtitleFontStyle:d,subtitleFontWeight:m,subtitleLineHeight:p,subtitlePadding:g,...h}=e,y={...t?{anchor:t}:{},...n?{frame:n}:{},...i?{offset:i}:{},...r?{orient:r}:{},...void 0!==o?{angle:o}:{},...void 0!==a?{limit:a}:{}},v={...l?{subtitleColor:l}:{},...c?{subtitleFont:c}:{},...f?{subtitleFontSize:f}:{},...d?{subtitleFontStyle:d}:{},...m?{subtitleFontWeight:m}:{},...p?{subtitleLineHeight:p}:{},...g?{subtitlePadding:g}:{}};return{titleMarkConfig:{...h,...s?{fill:s}:{}},subtitleMarkConfig:u(e,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:y,subtitle:v}}function $n(e){return t.isString(e)||t.isArray(e)&&t.isString(e[0])}function wn(e){return J(e,"signal")}function kn(e){return J(e,"step")}function Sn(e){return!t.isArray(e)&&(J(e,"field")&&J(e,"data"))}const Dn=D({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),Fn={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},On=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function zn(e){const n=t.isArray(e.condition)?e.condition.map(_n):_n(e.condition);return{...Cn(e),condition:n}}function Cn(e){if(vn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function _n(e){if(vn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function Pn(e){if(vn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return wn(e)?e:void 0!==e?{value:e}:void 0}function Nn(e){return wn(e)?e.signal:t.stringValue(e.value)}function An(e){return wn(e)?e.signal:null==e?null:t.stringValue(e)}function Tn(e,t,n){for(const i of n){const n=Mn(i,t.markDef,t.config);void 0!==n&&(e[i]=Pn(n))}return e}function jn(e){return[].concat(e.type,e.style??[])}function En(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{vgChannel:r,ignoreVgConfig:o}=i;return r&&J(t,r)?t[r]:void 0!==t[e]?t[e]:!o||r&&r!==e?Mn(e,t,n,i):void 0}function Mn(e,t,n){let{vgChannel:i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=Rn(e,t,n.style);return U(i?r:void 0,r,i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function Rn(e,t,n){return Ln(e,jn(t),n)}function Ln(e,n,i){let r;n=t.array(n);for(const t of n){const n=i[t];J(n,e)&&(r=n[e])}return r}function qn(e,n){return t.array(e).reduce(((e,t)=>(e.field.push(ma(t,n)),e.order.push(t.sort??"ascending"),e)),{field:[],order:[]})}function Un(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(X(t,e))return;n.push(e)})),n}function Wn(e,n){return X(e,n)||!n?e:e?[...t.array(e),...t.array(n)].join(", "):n}function In(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if(($n(n)||wn(n))&&($n(i)||wn(i)))return{explicit:e.explicit,value:Wn(n,i)};if($n(n)||wn(n))return{explicit:e.explicit,value:n};if($n(i)||wn(i))return{explicit:e.explicit,value:i};if(!($n(n)||wn(n)||$n(i)||wn(i)))return{explicit:e.explicit,value:Un(n,i)};throw new Error("It should never reach here")}function Bn(e){return`Invalid specification ${Q(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const Vn='Autosize "fit" only works for single views and layered views.';function Hn(e){return`${"width"==e?"Width":"Height"} "container" only works for single views and layered views.`}function Gn(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function Yn(e){return e?`Dropping "fit-${e}" because spec has discrete ${st(e)}.`:'Dropping "fit" because spec has discrete size.'}function Xn(e){return`Unknown field for ${e}. Cannot calculate view size.`}function Qn(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function Jn(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function Kn(e){return`Selection not supported for ${e} yet.`}const Zn="The same selection must be used to override scale domains in a layered view.";function ei(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const ti="Animation involving facet, layer, or concat is currently unsupported.";function ni(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function ii(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function ri(e){return`${e}Offset dropped because ${e} is continuous`}function oi(e){return`Invalid field type "${e}".`}function ai(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`}function si(e,t){return`Dropping ${Q(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function li(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function ci(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function ui(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function fi(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function di(e){return`Using unaggregated domain with raw field has no effect (${Q(e)}).`}function mi(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function pi(e){return`Unaggregated domain is currently unsupported for log scale (${Q(e)}).`}function gi(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function hi(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const yi="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function vi(e,t){return`Invalid ${e}: ${Q(t)}.`}function bi(e){return`1D error band does not support ${e}.`}function xi(e){return`Channel ${e} is required for "binned" bin.`}const $i=t.logger(t.Warn);let wi=$i;function ki(){wi.error(...arguments)}function Si(){wi.warn(...arguments)}function Di(e){if(e&&t.isObject(e))for(const t of Ai)if(J(e,t))return!0;return!1}const Fi=["january","february","march","april","may","june","july","august","september","october","november","december"],Oi=Fi.map((e=>e.substr(0,3))),zi=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Ci=zi.map((e=>e.substr(0,3)));function _i(e,n){const i=[];if(n&&void 0!==e.day&&D(e).length>1&&(Si(function(e){return`Dropping day from datetime ${Q(e)} as day cannot be combined with other units.`}(e)),delete(e=l(e)).day),void 0!==e.year?i.push(e.year):i.push(2012),void 0!==e.month){const r=n?function(e){if(G(e)&&(e=+e),t.isNumber(e))return e-1;{const t=e.toLowerCase(),n=Fi.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Oi.indexOf(i);if(-1!==r)return r;throw new Error(vi("month",e))}}(e.month):e.month;i.push(r)}else if(void 0!==e.quarter){const r=n?function(e){if(G(e)&&(e=+e),t.isNumber(e))return e>4&&Si(vi("quarter",e)),e-1;throw new Error(vi("quarter",e))}(e.quarter):e.quarter;i.push(t.isNumber(r)?3*r:`${r}*3`)}else i.push(0);if(void 0!==e.date)i.push(e.date);else if(void 0!==e.day){const r=n?function(e){if(G(e)&&(e=+e),t.isNumber(e))return e%7;{const t=e.toLowerCase(),n=zi.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Ci.indexOf(i);if(-1!==r)return r;throw new Error(vi("day",e))}}(e.day):e.day;i.push(t.isNumber(r)?r+1:`${r}+1`)}else i.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const n=e[t];i.push(void 0===n?0:n)}return i}function Pi(e){const t=_i(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const Ni={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Ai=D(Ni);function Ti(e){return t.isObject(e)?e.binned:ji(e)}function ji(e){return e&&e.startsWith("binned")}function Ei(e){return e.startsWith("utc")}const Mi={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function Ri(e){return Ai.filter((t=>qi(e,t)))}function Li(e){const t=Ri(e);return t[t.length-1]}function qi(e,t){const n=e.indexOf(t);return!(n<0)&&(!(n>0&&"seconds"===t&&"i"===e.charAt(n-1))&&(!(e.length>n+3&&"day"===t&&"o"===e.charAt(n+3))&&!(n>0&&"year"===t&&"f"===e.charAt(n-1))))}function Ui(e,t){let{end:n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{end:!1};const i=A(t),r=Ei(e)?"utc":"";let o;const a={};for(const t of Ai)qi(e,t)&&(a[t]="quarter"===(s=t)?`(${r}quarter(${i})-1)`:`${r}${s}(${i})`,o=t);var s;return n&&(a[o]+="+1"),function(e){const t=_i(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(a)}function Wi(e){if(!e)return;return`timeUnitSpecifier(${Q(Ri(e))}, ${Q(Mi)})`}function Ii(e){if(!e)return;let n;return t.isString(e)?n=ji(e)?{unit:e.substring(6),binned:!0}:{unit:e}:t.isObject(e)&&(n={...e,...e.unit?{unit:e.unit}:{}}),Ei(n.unit)&&(n.utc=!0,n.unit=n.unit.substring(3)),n}function Bi(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const n=Ii(e),i=Li(n.unit);if(i&&"day"!==i){const e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:r,part:o}=Hi(i,n.step);return`${t(Pi({...e,[o]:+e[o]+r}))} - ${t(Pi(e))}`}}const Vi={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function Hi(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(function(e){return t.hasOwnProperty(Vi,e)}(e))return{part:e,step:n};switch(e){case"day":case"dayofyear":return{part:"date",step:n};case"quarter":return{part:"month",step:3*n};case"week":return{part:"date",step:7*n}}}function Gi(e){return!!e?.field&&void 0!==e.equal}function Yi(e){return!!e?.field&&void 0!==e.lt}function Xi(e){return!!e?.field&&void 0!==e.lte}function Qi(e){return!!e?.field&&void 0!==e.gt}function Ji(e){return!!e?.field&&void 0!==e.gte}function Ki(e){if(e?.field){if(t.isArray(e.range)&&2===e.range.length)return!0;if(wn(e.range))return!0}return!1}function Zi(e){return!!e?.field&&(t.isArray(e.oneOf)||t.isArray(e.in))}function er(e){return Zi(e)||Gi(e)||Ki(e)||Yi(e)||Qi(e)||Xi(e)||Ji(e)}function tr(e,t){return _a(e,{timeUnit:t,wrapTime:!0})}function nr(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{field:n}=e,i=Ii(e.timeUnit),{unit:r,binned:o}=i||{},a=ma(e,{expr:"datum"}),s=r?`time(${o?a:Ui(r,n)})`:a;if(Gi(e))return`${s}===${tr(e.equal,r)}`;if(Yi(e)){return`${s}<${tr(e.lt,r)}`}if(Qi(e)){return`${s}>${tr(e.gt,r)}`}if(Xi(e)){return`${s}<=${tr(e.lte,r)}`}if(Ji(e)){return`${s}>=${tr(e.gte,r)}`}if(Zi(e))return`indexof([${function(e,t){return e.map((e=>tr(e,t)))}(e.oneOf,r).join(",")}], ${s}) !== -1`;if(function(e){return!!e?.field&&void 0!==e.valid}(e))return ir(s,e.valid);if(Ki(e)){const{range:n}=bn(e),i=wn(n)?{signal:`${n.signal}[0]`}:n[0],o=wn(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==i&&null!==o&&t)return"inrange("+s+", ["+tr(i,r)+", "+tr(o,r)+"])";const a=[];return null!==i&&a.push(`${s} >= ${tr(i,r)}`),null!==o&&a.push(`${s} <= ${tr(o,r)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${Q(e)}`)}function ir(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function rr(e){return er(e)&&e.timeUnit?{...e,timeUnit:Ii(e.timeUnit)}:e}function or(e){return"quantitative"===e||"temporal"===e}function ar(e){return"ordinal"===e||"nominal"===e}const sr="quantitative",lr="ordinal",cr="temporal",ur="nominal",fr="geojson";const dr={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",SYMLOG:"symlog",IDENTITY:"identity",SEQUENTIAL:"sequential",TIME:"time",UTC:"utc",QUANTILE:"quantile",QUANTIZE:"quantize",THRESHOLD:"threshold",BIN_ORDINAL:"bin-ordinal",ORDINAL:"ordinal",POINT:"point",BAND:"band"},mr={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function pr(e,t){const n=mr[e],i=mr[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const gr={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function hr(e){return gr[e]}const yr=new Set(["linear","log","pow","sqrt","symlog"]),vr=new Set([...yr,"time","utc"]);function br(e){return yr.has(e)}const xr=new Set(["quantile","quantize","threshold"]),$r=new Set([...vr,...xr,"sequential","identity"]),wr=new Set(["ordinal","bin-ordinal","point","band"]);function kr(e){return wr.has(e)}function Sr(e){return $r.has(e)}function Dr(e){return vr.has(e)}function Fr(e){return xr.has(e)}function Or(e){return J(e,"param")}const{type:zr,domain:Cr,range:_r,rangeMax:Pr,rangeMin:Nr,scheme:Ar,...Tr}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},jr=D(Tr);function Er(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return Dr(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return Dr(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return"band"===e;case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return Dr(e);case"nice":return Dr(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return Sr(e)&&!p(["log","time","utc","threshold","quantile"],e)}}function Mr(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return We(e)?void 0:`Cannot use the scale property "${t}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}const Rr={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},Lr=Rr.arc,qr=Rr.area,Ur=Rr.bar,Wr=Rr.image,Ir=Rr.line,Br=Rr.point,Vr=Rr.rect,Hr=Rr.rule,Gr=Rr.text,Yr=Rr.tick,Xr=Rr.trail,Qr=Rr.circle,Jr=Rr.square,Kr=Rr.geoshape;function Zr(e){return["line","area","trail"].includes(e)}function eo(e){return["rect","bar","image","arc","tick"].includes(e)}const to=new Set(D(Rr));function no(e){return J(e,"type")}const io=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],ro=D({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),oo=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],ao={area:["line","point"],bar:oo,rect:oo,line:["point"],tick:["bandSize","thickness",...oo]},so=D({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1});function lo(e){return J(e,"band")}const co={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},uo={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},fo={...uo,binSpacing:1},mo={...uo,thickness:1};function po(e,t){let{isPath:n}=t;return void 0===e||"break-paths-show-path-domains"===e?n?"break-paths-show-domains":"filter":null===e?"show":e}function go(e){let{markDef:t,config:n,scaleChannel:i,scaleType:r,isCountAggregate:o}=e;if(!r||!Sr(r)||o)return"always-valid";const a=po(En("invalid",t,n),{isPath:Zr(t.type)}),s=n.scale?.invalid?.[i];return void 0!==s?"show":a}function ho(e){let{scaleName:t,scale:n,mode:i}=e;const r=`domain('${t}')`;if(!n||!t)return;const o=`${r}[0]`,a=`peek(${r})`,s=n.domainHasZero();if("definitely"===s)return{scale:t,value:0};if("maybe"===s){return{signal:`scale('${t}', inrange(0, ${r}) ? 0 : ${"zeroOrMin"===i?o:a})`}}return{signal:`scale('${t}', ${"zeroOrMin"===i?o:a})`}}function yo(e){let{scaleChannel:t,channelDef:n,scale:i,scaleName:r,markDef:o,config:a}=e;const s=i?.get("type"),l=wa(n),c=go({scaleChannel:t,markDef:o,config:a,scaleType:s,isCountAggregate:cn(l?.aggregate)});if(l&&"show"===c){const e=a.scale.invalid?.[t]??"zero-or-min";return{test:ir(ma(l,{expr:"datum"}),!1),...vo(e,i,r)}}}function vo(e,n,i){if(r=e,t.isObject(r)&&"value"in r){const{value:t}=e;return wn(t)?{signal:t.signal}:{value:t}}var r;return ho({scale:n,scaleName:i,mode:"zeroOrMin"})}function bo(e){const{channel:t,channelDef:n,markDef:i,scale:r,scaleName:o,config:a}=e,s=rt(t),l=wo(e),c=yo({scaleChannel:s,channelDef:n,scale:r,scaleName:o,markDef:i,config:a});return void 0!==c?[c,l]:l}function xo(e,t,n,i){const r={};if(t&&(r.scale=t),ta(e)){const{datum:t}=e;Di(t)?r.signal=Pi(t):wn(t)?r.signal=t.signal:vn(t)?r.signal=t.expr:r.value=t}else r.field=ma(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function $o(e){let{scaleName:t,fieldOrDatumDef:n,fieldOrDatumDef2:i,offset:r,startSuffix:o,endSuffix:a="end",bandPosition:s=.5}=e;const l=!wn(s)&&01&&void 0!==arguments[1]?arguments[1]:{},n=e.field;const i=t.prefix;let r=t.suffix,o="";if(function(e){return"count"===e.aggregate}(e))n=B("count");else{let i;if(!t.nofn)if(function(e){return J(e,"op")}(e))i=e.op;else{const{bin:a,aggregate:s,timeUnit:l}=e;mn(a)?(i=dn(a),r=(t.binSuffix??"")+(t.suffix??"")):s?an(s)?(o=`["${n}"]`,n=`argmax_${s.argmax}`):on(s)?(o=`["${n}"]`,n=`argmin_${s.argmin}`):i=String(s):l&&!Ti(l)&&(i=function(e){const{utc:t,...n}=Ii(e);return n.unit?(t?"utc":"")+D(n).map((e=>C(`${"unit"===e?"":`_${e}_`}${n[e]}`))).join(""):(t?"utc":"")+"timeunit"+D(n).map((e=>C(`_${e}_${n[e]}`))).join("")}(l),r=(!["range","mid"].includes(t.binSuffix)&&t.binSuffix||"")+(t.suffix??""))}i&&(n=n?`${i}_${n}`:i)}return r&&(n=`${n}_${r}`),i&&(n=`${i}_${n}`),t.forAs?L(n):t.expr?T(n,t.expr)+o:M(n)+o}function pa(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return Zo(e)&&!!e.bin;case"temporal":return!1}throw new Error(oi(e.type))}const ga=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:i,field:r}=e;if(an(t))return`${r} for argmax(${t.argmax})`;if(on(t))return`${r} for argmin(${t.argmin})`;const o=i&&!Ti(i)?Ii(i):void 0,a=t||o?.unit||o?.maxbins&&"timeunit"||mn(n)&&"bin";return a?`${a.toUpperCase()}(${r})`:r}(e);default:return function(e,t){const{field:n,bin:i,timeUnit:r,aggregate:o}=e;if("count"===o)return t.countTitle;if(mn(i))return`${n} (binned)`;if(r&&!Ti(r)){const e=Ii(r)?.unit;if(e)return`${n} (${Ri(e).join("-")})`}else if(o)return an(o)?`${n} for max ${o.argmax}`:on(o)?`${n} for min ${o.argmin}`:`${N(o)} of ${n}`;return n}(e,t)}};let ha=ga;function ya(e){ha=e}function va(e,t,n){let{allowDisabling:i,includeDefault:r=!0}=n;const o=ba(e)?.title;if(!Zo(e))return o??e.title;const a=e,s=r?xa(a,t):void 0;return i?U(o,a.title,s):o??a.title??s}function ba(e){return ca(e)&&e.axis?e.axis:ua(e)&&e.legend?e.legend:Wo(e)&&e.header?e.header:void 0}function xa(e,t){return ha(e,t)}function $a(e){if(fa(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const t=ba(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function wa(e){return Zo(e)?e:Jo(e)?e.condition:void 0}function ka(e){return oa(e)?e:Ko(e)?e.condition:void 0}function Sa(e,n,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(t.isString(e)||t.isNumber(e)||t.isBoolean(e)){return Si(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${Q(n)}}.`}(n,t.isString(e)?"string":t.isNumber(e)?"number":"boolean",e)),{value:e}}return oa(e)?Da(e,n,i,r):Ko(e)?{...e,condition:Da(e.condition,n,i,r)}:e}function Da(e,n,i,r){if(fa(e)){const{format:t,formatType:o,...a}=e;if(So(o)&&!i.customFormatTypes)return Si(ii(n)),Da(a,n,i,r)}else{const t=ca(e)?"axis":ua(e)?"legend":Wo(e)?"header":null;if(t&&e[t]){const{format:o,formatType:a,...s}=e[t];if(So(a)&&!i.customFormatTypes)return Si(ii(n)),Da({...e,[t]:s},n,i,r)}}return Zo(e)?Fa(e,n,r):function(e){let n=e.type;if(n)return e;const{datum:i}=e;return n=t.isNumber(i)?"quantitative":t.isString(i)?"nominal":Di(i)?"temporal":void 0,{...e,type:n}}(e)}function Fa(e,n){let{compositeMark:i=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{aggregate:r,timeUnit:o,bin:a,field:s}=e,l={...e};if(i||!r||sn(r)||an(r)||on(r)||(Si(function(e){return`Invalid aggregation operator "${e}".`}(r)),delete l.aggregate),o&&(l.timeUnit=Ii(o)),s&&(l.field=`${s}`),mn(a)&&(l.bin=Oa(a,n)),pn(a)&&!_t(n)&&Si(function(e){return`Channel ${e} should not be used with "binned" bin.`}(n)),aa(l)){const{type:e}=l,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case sr:return"quantitative";case"t":case cr:return"temporal";case"o":case lr:return"ordinal";case"n":case ur:return"nominal";case fr:return"geojson"}}(e);e!==t&&(l.type=t),"quantitative"!==e&&cn(r)&&(Si(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,r)),l.type="quantitative")}else if(!it(n)){const e=function(e,n){switch(n){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(Vo(e)&&t.isArray(e.sort))return"ordinal";const{aggregate:i,bin:r,timeUnit:o}=e;if(o)return"temporal";if(r||i&&!an(i)&&!on(i))return"quantitative";if(la(e)&&e.scale?.type)switch(mr[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(l,n);l.type=e}if(aa(l)){const{compatible:e,warning:t}=function(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case K:case Z:case ee:return pa(e)?za:{compatible:!1,warning:ci(t)};case te:case ne:case oe:case ae:case he:case ye:case ve:case Oe:case Ce:case _e:case Pe:case Ne:case Ae:case $e:case ce:case se:case Te:return za;case de:case pe:case fe:case me:return n!==sr?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:za;case we:case ke:case Se:case De:case xe:case ue:case le:case ie:case re:case ge:return"nominal"!==n||e.sort?za:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case be:case Fe:return pa(e)||la(i=e)&&Fr(i.scale?.type)?za:{compatible:!1,warning:ui(t)};case ze:return"nominal"!==e.type||"sort"in e?za:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}var i}(l,n)||{};!1===e&&Si(t)}if(Vo(l)&&t.isString(l.sort)){const{sort:e}=l;if(Ro(e))return{...l,sort:{encoding:e}};const t=e.substring(1);if("-"===e.charAt(0)&&Ro(t))return{...l,sort:{encoding:t,order:"descending"}}}if(Wo(l)){const{header:e}=l;if(e){const{orient:t,...n}=e;if(t)return{...l,header:{...n,labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t}}}}return l}function Oa(e,n){return t.isBoolean(e)?{maxbins:yn(n)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:yn(n)}}const za={compatible:!0};function Ca(e){const{formatType:t}=$a(e);return"time"===t||!t&&((n=e)&&("temporal"===n.type||Zo(n)&&!!n.timeUnit));var n}function _a(e,n){let{timeUnit:i,type:r,wrapTime:o,undefinedIfExprNotRequired:a}=n;const s=i&&Ii(i)?.unit;let l,c=s||"temporal"===r;return vn(e)?l=e.expr:wn(e)?l=e.signal:Di(e)?(c=!0,l=Pi(e)):(t.isString(e)||t.isNumber(e))&&c&&(l=`datetime(${Q(e)})`,function(e){return t.hasOwnProperty(Ni,e)}(s)&&(t.isNumber(e)&&e<1e4||t.isString(e)&&isNaN(Date.parse(e)))&&(l=Pi({[s]:e}))),l?o&&c?`time(${l})`:l:a?void 0:Q(e)}function Pa(e,t){const{type:n}=e;return t.map((t=>{const i=_a(t,{timeUnit:Zo(e)&&!Ti(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function Na(e,t){return mn(e.bin)?Qt(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const Aa={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function Ta(e){return e?.condition}const ja=["domain","grid","labels","ticks","title"],Ea={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},Ma={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},Ra={...Ma,style:1,labelExpr:1,encoding:1};function La(e){return t.hasOwnProperty(Ra,e)}const qa=D({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1});function Ua(e){return J(e,"mark")}class Wa{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!Ua(e)&&(no(t=e.mark)?t.type:t)===this.name;var t}}function Ia(e,n){const i=e&&e[n];return!!i&&(t.isArray(i)?g(i,(e=>!!e.field)):Zo(i)||Jo(i))}function Ba(e,n){const i=e&&e[n];return!!i&&(t.isArray(i)?g(i,(e=>!!e.field)):Zo(i)||ta(i)||Ko(i))}function Va(e,t){if(_t(t)){const n=e[t];if((Zo(n)||ta(n))&&(ar(n.type)||Zo(n)&&n.timeUnit)){return Ba(e,ct(t))}}return!1}function Ha(e){return g(He,(n=>{if(Ia(e,n)){const i=e[n];if(t.isArray(i))return g(i,(e=>!!e.aggregate));{const e=wa(i);return e&&!!e.aggregate}}return!1}))}function Ga(e,n){const i=[],r=[],o=[],a=[],s={};return Qa(e,((l,c)=>{if(Zo(l)){const{field:u,aggregate:f,bin:d,timeUnit:m,...p}=l;if(f||m||d){const e=ba(l),g=e?.title;let h=ma(l,{forAs:!0});const y={...g?[]:{title:va(l,n,{allowDisabling:!0})},...p,field:h};if(f){let e;if(an(f)?(e="argmax",h=ma({op:"argmax",field:f.argmax},{forAs:!0}),y.field=`${h}.${u}`):on(f)?(e="argmin",h=ma({op:"argmin",field:f.argmin},{forAs:!0}),y.field=`${h}.${u}`):"boxplot"!==f&&"errorbar"!==f&&"errorband"!==f&&(e=f),e){const t={op:e,as:h};u&&(t.field=u),a.push(t)}}else if(i.push(h),aa(l)&&mn(d)){if(r.push({bin:d,field:u,as:h}),i.push(ma(l,{binSuffix:"end"})),Na(l,c)&&i.push(ma(l,{binSuffix:"range"})),_t(c)){const e={field:`${h}_end`};s[`${c}2`]=e}y.bin="binned",it(c)||(y.type=sr)}else if(m&&!Ti(m)){o.push({timeUnit:m,field:u,as:h});const e=aa(l)&&l.type!==cr&&"time";e&&(c===Oe||c===Pe?y.formatType=e:!function(e){return t.hasOwnProperty(Ft,e)}(c)?_t(c)&&(y.axis={formatType:e,...y.axis}):y.legend={formatType:e,...y.legend})}s[c]=y}else i.push(u),s[c]=e[c]}else s[c]=e[c]})),{bins:r,timeUnits:o,aggregate:a,groupby:i,encoding:s}}function Ya(e,t,n){const i=Jt(t,n);if(!i)return!1;if("binned"===i){const n=e[t===ie?te:ne];return!!(Zo(n)&&Zo(e[t])&&pn(n.bin))}return!0}function Xa(e,t){const n={};for(const i of D(e)){const r=Sa(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function Qa(e,n,i){if(e)for(const r of D(e)){const o=e[r];if(t.isArray(o))for(const e of o)n.call(i,e,r);else n.call(i,o,r)}}function Ja(e,n){return D(n).reduce(((i,r)=>{switch(r){case te:case ne:case Ne:case Te:case Ae:case ie:case re:case oe:case ae:case ce:case ue:case se:case le:case ge:case fe:case de:case me:case pe:case Oe:case be:case $e:case Pe:return i;case ze:if("line"===e||"trail"===e)return i;case Ce:case _e:{const e=n[r];if(t.isArray(e)||Zo(e))for(const n of t.array(e))n.aggregate||i.push(ma(n,{}));return i}case xe:if("trail"===e)return i;case he:case ye:case ve:case we:case ke:case Se:case Fe:case De:{const e=wa(n[r]);return e&&!e.aggregate&&i.push(ma(e,{})),i}}}),[])}function Ka(e,n,i){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if("tooltip"in i)return{tooltip:i.tooltip};return{tooltip:[...e.map((e=>{let{fieldPrefix:t,titlePrefix:i}=e;const o=r?` of ${Za(n)}`:"";return{field:t+n.field,type:n.type,title:wn(i)?{signal:`${i}"${escape(o)}"`}:i+o}})),...b(function(e){const n=[];for(const i of D(e))if(Ia(e,i)){const r=e[i],o=t.array(r);for(const e of o)Zo(e)?n.push(e):Jo(e)&&n.push(e.condition)}return n}(i).map(da),d)]}}function Za(e){const{title:t,field:n}=e;return U(t,n)}function es(e,n,i,r,o){const{scale:a,axis:s}=i;return l=>{let{partName:c,mark:u,positionPrefix:f,endPositionPrefix:d,extraEncoding:m={}}=l;const p=Za(i);return ts(e,c,o,{mark:u,encoding:{[n]:{field:`${f}_${i.field}`,type:i.type,...void 0!==p?{title:p}:{},...void 0!==a?{scale:a}:{},...void 0!==s?{axis:s}:{}},...t.isString(d)?{[`${n}2`]:{field:`${d}_${i.field}`}}:{},...r,...m}})}}function ts(e,n,i,r){const{clip:o,color:a,opacity:s}=e,l=e.type;return e[n]||void 0===e[n]&&i[n]?[{...r,mark:{...i[n],...o?{clip:o}:{},...a?{color:a}:{},...s?{opacity:s}:{},...no(r.mark)?r.mark:{type:r.mark},style:`${l}-${String(n)}`,...t.isBoolean(e[n])?{}:e[n]}}]:[]}function ns(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],a=i[`${r}2`],s=i[`${r}Error`],l=i[`${r}Error2`];return{continuousAxisChannelDef:is(o,n),continuousAxisChannelDef2:is(a,n),continuousAxisChannelDefError:is(s,n),continuousAxisChannelDefError2:is(l,n),continuousAxis:r}}function is(e,t){if(e?.aggregate){const{aggregate:n,...i}=e;return n!==t&&Si(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function rs(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(no(n)&&n.orient)return n.orient;if(na(r)){if(na(o)){const e=Zo(r)&&r.aggregate,n=Zo(o)&&o.aggregate;if(e||n!==t){if(n||e!==t){if(e===t&&n===t)throw new Error("Both x and y cannot have aggregate");return Ca(o)&&!Ca(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(na(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const os="boxplot",as=new Wa(os,ls);function ss(e){return t.isNumber(e)?"tukey":e}function ls(e,n){let{config:i}=n;e={...e,encoding:Xa(e.encoding,i)};const{mark:r,encoding:o,params:a,projection:s,...l}=e,c=no(r)?r:{type:r};a&&Si(Kn("boxplot"));const u=c.extent??i.boxplot.extent,d=En("size",c,i),m=c.invalid,p=ss(u),{bins:g,timeUnits:h,transform:y,continuousAxisChannelDef:v,continuousAxis:b,groupby:x,aggregate:$,encodingWithoutContinuousAxis:w,ticksOrient:k,boxOrient:D,customTooltipWithoutAggregatedField:F}=function(e,n,i){const r=rs(e,os),{continuousAxisChannelDef:o,continuousAxis:a}=ns(e,r,os),s=o.field,l=L(s),c=ss(n),u=[...cs(s),{op:"median",field:s,as:`mid_box_${l}`},{op:"min",field:s,as:("min-max"===c?"lower_whisker_":"min_")+l},{op:"max",field:s,as:("min-max"===c?"upper_whisker_":"max_")+l}],f="min-max"===c||"tukey"===c?[]:[{calculate:`${j(`upper_box_${l}`)} - ${j(`lower_box_${l}`)}`,as:`iqr_${l}`},{calculate:`min(${j(`upper_box_${l}`)} + ${j(`iqr_${l}`)} * ${n}, ${j(`max_${l}`)})`,as:`upper_whisker_${l}`},{calculate:`max(${j(`lower_box_${l}`)} - ${j(`iqr_${l}`)} * ${n}, ${j(`min_${l}`)})`,as:`lower_whisker_${l}`}],{[a]:d,...m}=e.encoding,{customTooltipWithoutAggregatedField:p,filteredEncoding:g}=function(e){const{tooltip:n,...i}=e;if(!n)return{filteredEncoding:i};let r,o;if(t.isArray(n)){for(const e of n)e.aggregate?(r||(r=[]),r.push(e)):(o||(o=[]),o.push(e));r&&(i.tooltip=r)}else n.aggregate?i.tooltip=n:o=n;return t.isArray(o)&&1===o.length&&(o=o[0]),{customTooltipWithoutAggregatedField:o,filteredEncoding:i}}(m),{bins:h,timeUnits:y,aggregate:v,groupby:b,encoding:x}=Ga(g,i),$="vertical"===r?"horizontal":"vertical",w=r,k=[...h,...y,{aggregate:[...v,...u],groupby:b},...f];return{bins:h,timeUnits:y,transform:k,groupby:b,aggregate:v,continuousAxisChannelDef:o,continuousAxis:a,encodingWithoutContinuousAxis:x,ticksOrient:$,boxOrient:w,customTooltipWithoutAggregatedField:p}}(e,u,i),O=L(v.field),{color:z,size:C,..._}=w,P=e=>es(c,b,v,e,i.boxplot),N=P(_),A=P(w),T=(t.isObject(i.boxplot.box)?i.boxplot.box.color:i.mark.color)||"#4c78a8",E=P({..._,...C?{size:C}:{},color:{condition:{test:`${j(`lower_box_${v.field}`)} >= ${j(`upper_box_${v.field}`)}`,...z||{value:T}}}}),M=Ka([{fieldPrefix:"min-max"===p?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===p?"lower_whisker_":"min_",titlePrefix:"Min"}],v,w),R={type:"tick",color:"black",opacity:1,orient:k,invalid:m,aria:!1},q="min-max"===p?M:Ka([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],v,w),U=[...N({partName:"rule",mark:{type:"rule",invalid:m,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:q}),...N({partName:"rule",mark:{type:"rule",invalid:m,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:q}),...N({partName:"ticks",mark:R,positionPrefix:"lower_whisker",extraEncoding:q}),...N({partName:"ticks",mark:R,positionPrefix:"upper_whisker",extraEncoding:q})],W=[..."tukey"!==p?U:[],...A({partName:"box",mark:{type:"bar",...d?{size:d}:{},orient:D,invalid:m,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:M}),...E({partName:"median",mark:{type:"tick",invalid:m,...t.isObject(i.boxplot.median)&&i.boxplot.median.color?{color:i.boxplot.median.color}:{},...d?{size:d}:{},orient:k,aria:!1},positionPrefix:"mid_box",extraEncoding:M})];if("min-max"===p)return{...l,transform:(l.transform??[]).concat(y),layer:W};const I=j(`lower_box_${v.field}`),B=j(`upper_box_${v.field}`),V=`(${B} - ${I})`,H=`${I} - ${u} * ${V}`,G=`${B} + ${u} * ${V}`,Y=j(v.field),X={joinaggregate:cs(v.field),groupby:x},Q={transform:[{filter:`(${H} <= ${Y}) && (${Y} <= ${G})`},{aggregate:[{op:"min",field:v.field,as:`lower_whisker_${O}`},{op:"max",field:v.field,as:`upper_whisker_${O}`},{op:"min",field:`lower_box_${v.field}`,as:`lower_box_${O}`},{op:"max",field:`upper_box_${v.field}`,as:`upper_box_${O}`},...$],groupby:x}],layer:U},{tooltip:J,...K}=_,{scale:Z,axis:ee}=v,te=Za(v),ne=f(ee,["title"]),ie=ts(c,"outliers",i.boxplot,{transform:[{filter:`(${Y} < ${H}) || (${Y} > ${G})`}],mark:"point",encoding:{[b]:{field:v.field,type:v.type,...void 0!==te?{title:te}:{},...void 0!==Z?{scale:Z}:{},...S(ne)?{}:{axis:ne}},...K,...z?{color:z}:{},...F?{tooltip:F}:{}}})[0];let re;const oe=[...g,...h,X];return ie?re={transform:oe,layer:[ie,Q]}:(re=Q,re.transform.unshift(...oe)),{...l,layer:[re,{transform:y,layer:W}]}}function cs(e){const t=L(e);return[{op:"q1",field:e,as:`lower_box_${t}`},{op:"q3",field:e,as:`upper_box_${t}`}]}const us="errorbar",fs=new Wa(us,ds);function ds(e,t){let{config:n}=t;e={...e,encoding:Xa(e.encoding,n)};const{transform:i,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:a,ticksOrient:s,markDef:l,outerSpec:c,tooltipEncoding:u}=ps(e,us,n);delete a.size;const f=es(l,o,r,a,n.errorbar),d=l.thickness,m=l.size,p={type:"tick",orient:s,aria:!1,...void 0!==d?{thickness:d}:{},...void 0!==m?{size:m}:{}},g=[...f({partName:"ticks",mark:p,positionPrefix:"lower",extraEncoding:u}),...f({partName:"ticks",mark:p,positionPrefix:"upper",extraEncoding:u}),...f({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==d?{size:d}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u})];return{...c,transform:i,...g.length>1?{layer:g}:{...g[0]}}}function ms(e,t){const{encoding:n}=e;if(function(e){return(oa(e.x)||oa(e.y))&&!oa(e.x2)&&!oa(e.y2)&&!oa(e.xError)&&!oa(e.xError2)&&!oa(e.yError)&&!oa(e.yError2)}(n))return{orient:rs(e,t),inputType:"raw"};const i=function(e){return oa(e.x2)||oa(e.y2)}(n),r=function(e){return oa(e.xError)||oa(e.xError2)||oa(e.yError)||oa(e.yError2)}(n),o=n.x,a=n.y;if(i){if(r)throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);const e=n.x2,i=n.y2;if(oa(e)&&oa(i))throw new Error(`${t} cannot have both x2 and y2`);if(oa(e)){if(na(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(oa(i)){if(na(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${t}`)}throw new Error("No ranged axis")}{const e=n.xError,i=n.xError2,r=n.yError,s=n.yError2;if(oa(i)&&!oa(e))throw new Error(`${t} cannot have xError2 without xError`);if(oa(s)&&!oa(r))throw new Error(`${t} cannot have yError2 without yError`);if(oa(e)&&oa(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(oa(e)){if(na(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(oa(r)){if(na(a))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function ps(e,t,n){const{mark:i,encoding:r,params:o,projection:a,...s}=e,l=no(i)?i:{type:i};o&&Si(Kn(t));const{orient:c,inputType:u}=ms(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:m,continuousAxisChannelDefError2:p,continuousAxis:g}=ns(e,c,t),{errorBarSpecificAggregate:h,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:b}=function(e,t,n,i,r,o,a,s){let l=[],c=[];const u=t.field;let f,d=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":s.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&Si(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,a)),"stderr"===n||"stdev"===n)l=[{op:n,field:u,as:`extent_${u}`},{op:t,field:u,as:`center_${u}`}],c=[{calculate:`${j(`center_${u}`)} + ${j(`extent_${u}`)}`,as:`upper_${u}`},{calculate:`${j(`center_${u}`)} - ${j(`extent_${u}`)}`,as:`lower_${u}`}],f=[{fieldPrefix:"center_",titlePrefix:N(t)},{fieldPrefix:"upper_",titlePrefix:gs(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:gs(t,n,"-")}],d=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),l=[{op:t,field:u,as:`lower_${u}`},{op:i,field:u,as:`upper_${u}`},{op:e,field:u,as:`center_${u}`}],f=[{fieldPrefix:"upper_",titlePrefix:va({field:u,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:va({field:u,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:va({field:u,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&Si((m=e.center,`${(p=e.extent)?"extent ":""}${p&&m?"and ":""}${m?"center ":""}${p&&m?"are ":"is "}not needed when data are aggregated.`)),"aggregated-upper-lower"===o?(f=[],c=[{calculate:j(n.field),as:`upper_${u}`},{calculate:j(u),as:`lower_${u}`}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:u}],c=[{calculate:`${j(u)} + ${j(i.field)}`,as:`upper_${u}`}],r?c.push({calculate:`${j(u)} + ${j(r.field)}`,as:`lower_${u}`}):c.push({calculate:`${j(u)} - ${j(i.field)}`,as:`lower_${u}`}));for(const e of c)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:R(R(e.calculate,"datum['",""),"']","")})}var m,p;return{postAggregateCalculates:c,errorBarSpecificAggregate:l,tooltipSummary:f,tooltipTitleWithFieldName:d}}(l,f,d,m,p,u,t,n),{[g]:x,["x"===g?"x2":"y2"]:$,["x"===g?"xError":"yError"]:w,["x"===g?"xError2":"yError2"]:k,...S}=r,{bins:D,timeUnits:F,aggregate:O,groupby:z,encoding:C}=Ga(S,n),_=[...O,...h],P="raw"!==u?[]:z,A=Ka(v,f,C,b);return{transform:[...s.transform??[],...D,...F,...0===_.length?[]:[{aggregate:_,groupby:P}],...y],groupby:P,continuousAxisChannelDef:f,continuousAxis:g,encodingWithoutContinuousAxis:C,ticksOrient:"vertical"===c?"horizontal":"vertical",markDef:l,outerSpec:s,tooltipEncoding:A}}function gs(e,t,n){return`${N(e)} ${n} ${t}`}const hs="errorband",ys=new Wa(hs,vs);function vs(e,t){let{config:n}=t;e={...e,encoding:Xa(e.encoding,n)};const{transform:i,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:a,markDef:s,outerSpec:l,tooltipEncoding:c}=ps(e,hs,n),u=s,f=es(u,o,r,a,n.errorband),d=void 0!==e.encoding.x&&void 0!==e.encoding.y;let m={type:d?"area":"rect"},p={type:d?"line":"rule"};const g={...u.interpolate?{interpolate:u.interpolate}:{},...u.tension&&u.interpolate?{tension:u.tension}:{}};return d?(m={...m,...g,ariaRoleDescription:"errorband"},p={...p,...g,aria:!1}):u.interpolate?Si(bi("interpolate")):u.tension&&Si(bi("tension")),{...l,transform:i,layer:[...f({partName:"band",mark:m,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:c}),...f({partName:"borders",mark:p,positionPrefix:"lower",extraEncoding:c}),...f({partName:"borders",mark:p,positionPrefix:"upper",extraEncoding:c})]}}const bs={};function xs(e,t,n){const i=new Wa(e,t);bs[e]={normalizer:i,parts:n}}xs(os,ls,["box","median","outliers","rule","ticks"]),xs(us,ds,["ticks","rule"]),xs(hs,vs,["band","borders"]);const $s=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],ws={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},ks={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},Ss=D(ws),Ds=D(ks),Fs=D({header:1,headerRow:1,headerColumn:1,headerFacet:1}),Os=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],zs="_vgsid_",Cs={point:{on:"click",fields:[zs],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function _s(e){return"legend"===e||!!e?.legend}function Ps(e){return _s(e)&&t.isObject(e)}function Ns(e){return!!e?.select}function As(e){const t=[];for(const n of e||[]){if(Ns(n))continue;const{expr:e,bind:i,...r}=n;if(i&&e){const n={...r,bind:i,init:e};t.push(n)}else{const n={...r,...e?{update:e}:{},...i?{bind:i}:{}};t.push(n)}}return t}function Ts(e){return J(e,"concat")}function js(e){return J(e,"vconcat")}function Es(e){return J(e,"hconcat")}function Ms(e){let{step:t,offsetIsDiscrete:n}=e;return n?t.for??"offset":"position"}function Rs(e){return J(e,"step")}function Ls(e){return J(e,"view")||J(e,"width")||J(e,"height")}const qs=D({align:1,bounds:1,center:1,columns:1,spacing:1});function Us(e,t){return e[t]??e["width"===t?"continuousWidth":"continuousHeight"]}function Ws(e,t){const n=Is(e,t);return Rs(n)?n.step:Bs}function Is(e,t){return U(e[t]??e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const Bs=20,Vs={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:Bs},mark:{color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},arc:{},area:{},bar:fo,circle:{},geoshape:{},image:{},line:{},point:{},rect:uo,rule:{color:"black"},square:{},text:{color:"black"},tick:mo,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:Cs,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},Hs=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],Gs={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},Ys={blue:Hs[0],orange:Hs[1],red:Hs[2],teal:Hs[3],green:Hs[4],yellow:Hs[5],purple:Hs[6],pink:Hs[7],brown:Hs[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function Xs(e){const t=D(e||{}),n={};for(const i of t){const t=e[i];n[i]=Ta(t)?zn(t):Cn(t)}return n}const Qs=[...so,...qa,...Fs,"background","padding","legend","lineBreak","scale","style","title","view"];function Js(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:n,font:i,fontSize:r,selection:o,...a}=e,s=t.mergeConfig({},l(Vs),i?function(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}(i):{},n?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{signals:[{name:"color",value:t.isObject(e)?{...Ys,...e}:Ys}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(n):{},r?function(e){return{signals:[{name:"fontSize",value:t.isObject(e)?{...Gs,...e}:Gs}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(r):{},a||{});o&&t.writeConfig(s,"selection",o,!0);const c=f(s,Qs);for(const e of["background","lineBreak","padding"])s[e]&&(c[e]=Cn(s[e]));for(const e of so)s[e]&&(c[e]=bn(s[e]));for(const e of qa)s[e]&&(c[e]=Xs(s[e]));for(const e of Fs)s[e]&&(c[e]=bn(s[e]));if(s.legend&&(c.legend=bn(s.legend)),s.scale){const{invalid:e,...t}=s.scale,n=bn(e,{level:1});c.scale={...bn(t),...D(n).length>0?{invalid:n}:{}}}return s.style&&(c.style=function(e){const t=D(e),n={};for(const i of t)n[i]=Xs(e[i]);return n}(s.style)),s.title&&(c.title=bn(s.title)),s.view&&(c.view=bn(s.view)),c}const Ks=new Set(["view",...to]),Zs=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],el={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...ao};function tl(e){e=l(e);for(const t of Zs)delete e[t];if(e.axis)for(const t in e.axis)Ta(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of $s)delete e.legend[t];if(e.mark){for(const t of ro)delete e.mark[t];e.mark.tooltip&&t.isObject(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(As(e.params)),delete e.params);for(const t of Ks){for(const n of ro)delete e[t][n];const n=el[t];if(n)for(const i of n)delete e[t][i];nl(e,t)}for(const t of D(bs))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=xn(e.title);S(t)||(e.style["group-title"]={...e.style["group-title"],...t});S(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n});S(i)?delete e.title:e.title=i}(e);for(const n in e)t.isObject(e[n])&&S(e[n])&&delete e[n];return S(e)?void 0:e}function nl(e,t,n,i){"view"===t&&(n="cell");const r={...e[t],...e.style[n??t]};S(r)||(e.style[n??t]=r),delete e[t]}function il(e){return J(e,"layer")}class rl{map(e,t){return Io(e)?this.mapFacet(e,t):function(e){return J(e,"repeat")}(e)?this.mapRepeat(e,t):Es(e)?this.mapHConcat(e,t):js(e)?this.mapVConcat(e,t):Ts(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(il(e))return this.mapLayer(e,t);if(Ua(e))return this.mapUnit(e,t);throw new Error(Bn(e))}mapLayer(e,t){return{...e,layer:e.layer.map((e=>this.mapLayerOrUnit(e,t)))}}mapHConcat(e,t){return{...e,hconcat:e.hconcat.map((e=>this.map(e,t)))}}mapVConcat(e,t){return{...e,vconcat:e.vconcat.map((e=>this.map(e,t)))}}mapConcat(e,t){const{concat:n,...i}=e;return{...i,concat:n.map((e=>this.map(e,t)))}}mapFacet(e,t){return{...e,spec:this.map(e.spec,t)}}mapRepeat(e,t){return{...e,spec:this.map(e.spec,t)}}}const ol={zero:1,center:1,normalize:1};const al=new Set([Lr,Ur,qr,Hr,Br,Qr,Jr,Ir,Gr,Yr]),sl=new Set([Ur,qr,Lr]);function ll(e){return Zo(e)&&"quantitative"===ea(e)&&!e.bin}function cl(e,t,n){let{orient:i,type:r}=n;const o="x"===t?"y":"radius",a="x"===t&&["bar","area"].includes(r),s=e[t],l=e[o];if(Zo(s)&&Zo(l))if(ll(s)&&ll(l)){if(s.stack)return t;if(l.stack)return o;const e=Zo(s)&&!!s.aggregate;if(e!==(Zo(l)&&!!l.aggregate))return e?t:o;if(a){if("vertical"===i)return o;if("horizontal"===i)return t}}else{if(ll(s))return t;if(ll(l))return o}else{if(ll(s)){if(a&&"vertical"===i)return;return t}if(ll(l)){if(a&&"horizontal"===i)return;return o}}}function ul(e,n){const i=no(e)?e:{type:e},r=i.type;if(!al.has(r))return null;const o=cl(n,"x",i)||cl(n,"theta",i);if(!o)return null;const a=n[o],s=Zo(a)?ma(a,{}):void 0,l=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(o),c=[],u=new Set;if(n[l]){const e=n[l],t=Zo(e)?ma(e,{}):void 0;t&&t!==s&&(c.push(l),u.add(t))}const f="x"===l?"xOffset":"yOffset",d=n[f],m=Zo(d)?ma(d,{}):void 0;m&&m!==s&&(c.push(f),u.add(m));const p=Ot.reduce(((e,i)=>{if("tooltip"!==i&&Ia(n,i)){const r=n[i];for(const n of t.array(r)){const t=wa(n);if(t.aggregate)continue;const r=ma(t,{});r&&u.has(r)||e.push({channel:i,fieldDef:t})}}return e}),[]);let g;return void 0!==a.stack?g=t.isBoolean(a.stack)?a.stack?"zero":null:a.stack:sl.has(r)&&(g="zero"),g&&(h=g,t.hasOwnProperty(ol,h))?Ha(n)&&0===p.length?null:(a?.scale?.type&&a?.scale?.type!==dr.LINEAR&&a?.stack&&Si(function(e){return`Stack is applied to a non-linear scale (${e}).`}(a.scale.type)),oa(n[at(o)])?(void 0!==a.stack&&Si(`Cannot stack "${y=o}" if there is already "${y}2".`),null):(Zo(a)&&a.aggregate&&!un.has(a.aggregate)&&Si(`Stacking is applied even though the aggregate function is non-summative ("${a.aggregate}").`),{groupbyChannels:c,groupbyFields:u,fieldChannel:o,impute:null!==a.impute&&Zr(r),stackBy:p,offset:g})):null;var h,y}function fl(e,t,n){const i=bn(e),r=En("orient",i,n);if(i.orient=function(e,t,n){switch(e){case Br:case Qr:case Jr:case Gr:case Vr:case Wr:return}const{x:i,y:r,x2:o,y2:a}=t;switch(e){case Ur:if(Zo(i)&&(pn(i.bin)||Zo(r)&&r.aggregate&&!i.aggregate))return"vertical";if(Zo(r)&&(pn(r.bin)||Zo(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o)return(Zo(i)&&i.type===sr&&!mn(i.bin)||ra(i))&&Zo(r)&&pn(r.bin)?"horizontal":"vertical";if(!a)return(Zo(r)&&r.type===sr&&!mn(r.bin)||ra(r))&&Zo(i)&&pn(i.bin)?"vertical":"horizontal"}case Hr:if(o&&(!Zo(i)||!pn(i.bin))&&a&&(!Zo(r)||!pn(r.bin)))return;case qr:if(a)return Zo(r)&&pn(r.bin)?"horizontal":"vertical";if(o)return Zo(i)&&pn(i.bin)?"vertical":"horizontal";if(e===Hr){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case Ir:case Yr:{const t=ia(i),o=ia(r);if(n)return n;if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o)return"vertical";{const e=aa(i)&&i.type===cr,t=aa(r)&&r.type===cr;if(e&&!t)return"vertical";if(!e&&t)return"horizontal"}return}}return"vertical"}(i.type,t,r),void 0!==r&&r!==i.orient&&Si(`Specified orient "${i.orient}" overridden with "${r}".`),"bar"===i.type&&i.orient){const e=En("cornerRadiusEnd",i,n);if(void 0!==e){const n="horizontal"===i.orient&&t.x2||"vertical"===i.orient&&t.y2?["cornerRadius"]:co[i.orient];for(const t of n)i[t]=e;void 0!==i.cornerRadiusEnd&&delete i.cornerRadiusEnd}}const o=En("opacity",i,n),a=En("fillOpacity",i,n);void 0===o&&void 0===a&&(i.opacity=function(e,t){if(p([Br,Yr,Qr,Jr],e)&&!Ha(t))return.7;return}(i.type,t));return void 0===En("cursor",i,n)&&(i.cursor=function(e,t,n){if(t.href||e.href||En("href",e,n))return"pointer";return e.cursor}(i,t,n)),i}function dl(e){const{point:t,line:n,...i}=e;return D(i).length>1?i:i.type}function ml(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:f(e[t],["point","line"])});return e}function pl(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;return"transparent"===e.point?{opacity:0}:e.point?t.isObject(e.point)?e.point:{}:void 0!==e.point?null:n.point||i.shape?t.isObject(n.point)?n.point:{}:void 0}function gl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.line?!0===e.line?{}:e.line:void 0!==e.line?null:t.line?!0===t.line?{}:t.line:void 0}class hl{name="path-overlay";hasMatchingType(e,t){if(Ua(e)){const{mark:n,encoding:i}=e,r=no(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!pl(r,t[r.type],i);case"area":return!!pl(r,t[r.type],i)||!!gl(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{params:r,projection:o,mark:a,name:s,encoding:l,...c}=e,d=Xa(l,i),m=no(a)?a:{type:a},p=pl(m,i[m.type],d),g="area"===m.type&&gl(m,i[m.type]),h=[{name:s,...r?{params:r}:{},mark:dl({..."area"===m.type&&void 0===m.opacity&&void 0===m.fillOpacity?{opacity:.7}:{},...m}),encoding:f(d,["shape"])}],y=ul(fl(m,d,i),d);let v=d;if(y){const{fieldChannel:e,offset:t}=y;v={...d,[e]:{...d[e],...t?{stack:t}:{}}}}return v=f(v,["y2","x2"]),g&&h.push({...o?{projection:o}:{},mark:{type:"line",...u(m,["clip","interpolate","tension","tooltip"]),...g},encoding:v}),p&&h.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...u(m,["clip","tooltip"]),...p},encoding:v}),n({...c,layer:h},{...t,config:ml(i)})}}function yl(e,t){return t?Uo(e)?kl(e,t):xl(e,t):e}function vl(e,t){return t?kl(e,t):e}function bl(e,n,i){const r=n[e];return o=r,!t.isString(o)&&J(o,"repeat")?r.repeat in i?{...n,[e]:i[r.repeat]}:void Si(function(e){return`Unknown repeated value "${e}".`}(r.repeat)):n;var o}function xl(e,t){if(void 0!==(e=bl("field",e,t))){if(null===e)return null;if(Vo(e)&&Lo(e.sort)){const n=bl("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function $l(e,t){if(Zo(e))return xl(e,t);{const n=bl("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function wl(e,t){if(!oa(e)){if(Ko(e)){const n=$l(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=$l(e,t);if(n)return n;if(Qo(e))return{condition:e.condition}}}function kl(e,n){const i={};for(const r in e)if(J(e,r)){const o=e[r];if(t.isArray(o))i[r]=o.map((e=>wl(e,n))).filter((e=>e));else{const e=wl(o,n);void 0!==e&&(i[r]=e)}}return i}class Sl{name="RuleForRangedLine";hasMatchingType(e){if(Ua(e)){const{encoding:t,mark:n}=e;if("line"===n||no(n)&&"line"===n.type)for(const e of nt){const n=t[rt(e)];if(t[e]&&(Zo(n)&&!pn(n.bin)||ta(n)))return!0}}return!1}run(e,n,i){const{encoding:r,mark:o}=e;var a,s;return Si((a=!!r.x2,s=!!r.y2,`Line mark is for continuous lines and thus cannot be used with ${a&&s?"x2 and y2":a?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),i({...e,mark:t.isObject(o)?{...o,type:"rule"}:"rule"},n)}}function Dl(e){let{parentEncoding:n,encoding:i={},layer:r}=e,o={};if(n){const e=new Set([...D(n),...D(i)]);for(const a of e){const e=i[a],s=n[a];if(oa(e)){const t={...s,...e};o[a]=t}else Ko(e)?o[a]={...e,condition:{...s,...e.condition}}:e||null===e?o[a]=e:(r||sa(s)||wn(s)||oa(s)||t.isArray(s))&&(o[a]=s)}}else o=i;return!o||S(o)?void 0:o}function Fl(e){const{parentProjection:t,projection:n}=e;return t&&n&&Si(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${Q(t)} is overridden by a child projection ${Q(n)}.`}({parentProjection:t,projection:n})),n??t}function Ol(e){return J(e,"filter")}function zl(e){return J(e,"lookup")}function Cl(e){return J(e,"pivot")}function _l(e){return J(e,"density")}function Pl(e){return J(e,"quantile")}function Nl(e){return J(e,"regression")}function Al(e){return J(e,"loess")}function Tl(e){return J(e,"sample")}function jl(e){return J(e,"window")}function El(e){return J(e,"joinaggregate")}function Ml(e){return J(e,"flatten")}function Rl(e){return J(e,"calculate")}function Ll(e){return J(e,"bin")}function ql(e){return J(e,"impute")}function Ul(e){return J(e,"timeUnit")}function Wl(e){return J(e,"aggregate")}function Il(e){return J(e,"stack")}function Bl(e){return J(e,"fold")}function Vl(e){return J(e,"extent")&&!J(e,"density")&&!J(e,"regression")}function Hl(e,t){const{transform:n,...i}=e;if(n){return{...i,transform:n.map((e=>{if(Ol(e))return{filter:Xl(e,t)};if(Ll(e)&&gn(e.bin))return{...e,bin:Yl(e.bin)};if(zl(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}))}}return e}function Gl(e,n){const i=l(e);if(Zo(i)&&gn(i.bin)&&(i.bin=Yl(i.bin)),la(i)&&i.scale?.domain?.selection){const{selection:e,...t}=i.scale.domain;i.scale.domain={...t,...e?{param:e}:{}}}if(Qo(i))if(t.isArray(i.condition))i.condition=i.condition.map((e=>{const{selection:t,param:i,test:r,...o}=e;return i?e:{...o,test:Xl(e,n)}}));else{const{selection:e,param:t,test:r,...o}=Gl(i.condition,n);i.condition=t?i.condition:{...o,test:Xl(i.condition,n)}}return i}function Yl(e){const t=e.extent;if(t?.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function Xl(e,t){const n=e=>s(e,(e=>{const n={param:e,empty:t.emptySelections[e]??!0};return t.selectionPredicates[e]??=[],t.selectionPredicates[e].push(n),n}));return e.selection?n(e.selection):s(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class Ql extends rl{map(e,t){const n=t.selections??[];if(e.params&&!Ua(e)){const t=[];for(const i of e.params)Ns(i)?n.push(i):t.push(i);e.params=t}return t.selections=n,super.map(e,t)}mapUnit(e,n){const i=n.selections;if(!i||!i.length)return e;const r=(n.path??[]).concat(e.name),o=[];for(const n of i)if(n.views&&n.views.length)for(const i of n.views)(t.isString(i)&&(i===e.name||r.includes(i))||t.isArray(i)&&i.map((e=>r.indexOf(e))).every(((e,t,n)=>-1!==e&&(0===t||e>n[t-1]))))&&o.push(n);else o.push(n);return o.length&&(e.params=o),e}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=Ql.prototype[e];Ql.prototype[e]=function(e,n){return t.call(this,e,Jl(e,n))}}function Jl(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function Kl(e,t){void 0===t&&(t=Js(e.config));const n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={config:t};return tc.map(Zl.map(ec.map(e,n),n),n)}(e,t),{width:i,height:r}=e,o=function(e,t,n){let{width:i,height:r}=t;const o=Ua(e)||il(e),a={};o?"container"==i&&"container"==r?(a.type="fit",a.contains="padding"):"container"==i?(a.type="fit-x",a.contains="padding"):"container"==r&&(a.type="fit-y",a.contains="padding"):("container"==i&&(Si(Hn("width")),i=void 0),"container"==r&&(Si(Hn("height")),r=void 0));const s={type:"pad",...a,...n?nc(n.autosize):{},...nc(e.autosize)};"fit"!==s.type||o||(Si(Vn),s.type="pad");"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&Si(Gn("width"));"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&Si(Gn("height"));if(X(s,{type:"pad"}))return;return s}(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...o?{autosize:o}:{}}}const Zl=new class extends rl{nonFacetUnitNormalizers=(()=>[as,fs,ys,new hl,new Sl])();map(e,t){if(Ua(e)){const n=Ia(e.encoding,K),i=Ia(e.encoding,Z),r=Ia(e.encoding,ee);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=vl(e.encoding,t.repeater),o={...e,...e.name?{name:[t.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{},...r?{encoding:r}:{}};if(n||i)return this.mapUnitWithParentEncodingOrProjection(o,t);const a=this.mapLayerOrUnit.bind(this);for(const e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(o,t.config))return e.run(o,t,a);return o}mapRepeat(e,n){return function(e){return!t.isArray(e.repeat)&&J(e.repeat,"layer")}(e)?this.mapLayerRepeat(e,n):this.mapNonLayerRepeat(e,n)}mapLayerRepeat(e,t){const{repeat:n,spec:i,...r}=e,{row:o,column:a,layer:s}=n,{repeater:l={},repeaterPrefix:c=""}=t;return o||a?this.mapRepeat({...e,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:s},spec:i}},t):{...r,layer:s.map((e=>{const n={...l,layer:e},r=`${(i.name?`${i.name}_`:"")+c}child__layer_${C(e)}`,o=this.mapLayerOrUnit(i,{...t,repeater:n,repeaterPrefix:r});return o.name=r,o}))}}mapNonLayerRepeat(e,n){const{repeat:i,spec:r,data:o,...a}=e;!t.isArray(i)&&e.columns&&(e=f(e,["columns"]),Si(ei("repeat")));const s=[],{repeater:l={},repeaterPrefix:c=""}=n,u=!t.isArray(i)&&i.row||[l?l.row:null],d=!t.isArray(i)&&i.column||[l?l.column:null],m=t.isArray(i)&&i||[l?l.repeat:null];for(const e of m)for(const o of u)for(const a of d){const u={repeat:e,row:o,column:a,layer:l.layer},d=(r.name?`${r.name}_`:"")+c+"child__"+(t.isArray(i)?`${C(e)}`:(i.row?`row_${C(o)}`:"")+(i.column?`column_${C(a)}`:"")),m=this.map(r,{...n,repeater:u,repeaterPrefix:d});m.name=d,s.push(f(m,["data"]))}const p=t.isArray(i)?e.columns:i.column?i.column.length:1;return{data:r.data??o,align:"all",...a,columns:p,concat:s}}mapFacet(e,t){const{facet:n}=e;return Uo(n)&&e.columns&&(e=f(e,["columns"]),Si(ei("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:a}=t,s=Fl({parentProjection:o,projection:i}),l=Dl({parentEncoding:r,encoding:vl(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...l?{encoding:l}:{}},{config:a})}mapFacetedUnit(e,t){const{row:n,column:i,facet:r,...o}=e.encoding,{mark:a,width:s,projection:l,height:c,view:u,params:f,encoding:d,...m}=e,{facetMapping:p,layout:g}=this.getFacetMappingAndLayout({row:n,column:i,facet:r},t),h=vl(o,t.repeater);return this.mapFacet({...m,...g,facet:p,spec:{...s?{width:s}:{},...c?{height:c}:{},...u?{view:u}:{},...l?{projection:l}:{},mark:a,encoding:h,...f?{params:f}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:r}=e;if(n||i){r&&Si(`Facet encoding dropped as ${(o=[...n?[K]:[],...i?[Z]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const t={},a={};for(const n of[K,Z]){const i=e[n];if(i){const{align:e,center:r,spacing:o,columns:s,...l}=i;t[n]=l;for(const e of["align","center","spacing"])void 0!==i[e]&&(a[e]??={},a[e][n]=i[e])}}return{facetMapping:t,layout:a}}{const{align:e,center:n,spacing:i,columns:o,...a}=r;return{facetMapping:yl(a,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...i?{spacing:i}:{},...o?{columns:o}:{}}}}var o}mapLayer(e,t){let{parentEncoding:n,parentProjection:i,...r}=t;const{encoding:o,projection:a,...s}=e,l={...r,parentEncoding:Dl({parentEncoding:n,encoding:o,layer:!0}),parentProjection:Fl({parentProjection:i,projection:a})};return super.mapLayer({...s,...e.name?{name:[l.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{}},l)}},ec=new class extends rl{map(e,t){return t.emptySelections??={},t.selectionPredicates??={},e=Hl(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=Hl(e,t)).encoding){const n={};for(const[i,r]of O(e.encoding))n[i]=Gl(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:O(n).map((e=>{let[n,i]=e;const{init:r,bind:o,empty:a,...s}=i;"single"===s.type?(s.type="point",s.toggle=!1):"multi"===s.type&&(s.type="point"),t.emptySelections[n]="none"!==a;for(const e of F(t.selectionPredicates[n]??{}))e.empty="none"!==a;return{name:n,value:r,select:s,bind:o}}))}:e}},tc=new Ql;function nc(e){return t.isString(e)?{type:e}:e??{}}const ic=["background","padding"];function rc(e,t){const n={};for(const t of ic)e&&void 0!==e[t]&&(n[t]=Cn(e[t]));return t&&(n.params=e.params),n}class oc{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.explicit=e,this.implicit=t}clone(){return new oc(l(this.explicit),l(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return U(this.explicit[e],this.implicit[e])}getWithExplicit(e){return void 0!==this.explicit[e]?{explicit:!0,value:this.explicit[e]}:void 0!==this.implicit[e]?{explicit:!1,value:this.implicit[e]}:{explicit:!1,value:void 0}}setWithExplicit(e,t){let{value:n,explicit:i}=t;void 0!==n&&this.set(e,n,i)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,t){let{explicit:n,implicit:i}=t;void 0!==n[e]?this.set(e,n[e],!0):void 0!==i[e]&&this.set(e,i[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of D(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function ac(e){return{explicit:!0,value:e}}function sc(e){return{explicit:!1,value:e}}function lc(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:cc(t,n,i,r)}}function cc(e,t,n,i){return e.explicit&&t.explicit&&Si(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${Q(n)} and ${Q(i)}). Using ${Q(n)}.`}(n,i,e.value,t.value)),e}function uc(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:cc;return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:X(e.value,t.value)?e:r(e,t,n,i)}class fc extends oc{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){const e=super.clone();return e.parseNothing=this.parseNothing,e}}function dc(e){return J(e,"url")}function mc(e){return J(e,"values")}function pc(e){return J(e,"name")&&!dc(e)&&!mc(e)&&!gc(e)}function gc(e){return e&&(hc(e)||yc(e)||vc(e))}function hc(e){return J(e,"sequence")}function yc(e){return J(e,"sphere")}function vc(e){return J(e,"graticule")}let bc=function(e){return e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup",e[e.PreFilterInvalid=5]="PreFilterInvalid",e[e.PostFilterInvalid=6]="PostFilterInvalid",e}({});function xc(e){let{invalid:t,isPath:n}=e;switch(po(t,{isPath:n})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:n?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:n?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}class $c{_children=[];_parent=null;constructor(e,t){this.debugName=t,e&&(this.parent=e)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){this._children.includes(e)?Si("Attempt to add the same child twice."):void 0!==t?this._children.splice(t,0,e):this._children.push(e)}removeChild(e){const t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(const t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){const t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){const e=this._parent,t=e.parent;for(const t of this._children)t.parent=e;this._children=[],e.removeChild(this);const n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}}class wc extends $c{clone(){const e=new this.constructor;return e.debugName=`clone_${this.debugName}`,e._source=this._source,e._name=`clone_${this._name}`,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}constructor(e,t,n,i){super(e,t),this.type=n,this.refCounts=i,this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${I()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}function kc(e){return void 0!==e.as}function Sc(e){return`${e}_end`}class Dc extends $c{clone(){return new Dc(null,l(this.timeUnits))}constructor(e,t){super(e),this.timeUnits=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{const{field:r,timeUnit:o}=n;if(o){let a;if(Ti(o)){if(qm(t)){const{mark:e,markDef:i,config:s}=t,l=Ho({fieldDef:n,markDef:i,config:s});(eo(e)||l)&&(a={timeUnit:Ii(o),field:r})}}else a={as:ma(n,{forAs:!0}),field:r,timeUnit:o};if(qm(t)){const{mark:e,markDef:r,config:o}=t,s=Ho({fieldDef:n,markDef:r,config:o});eo(e)&&_t(i)&&.5!==s&&(a.rectBandPosition=s)}a&&(e[d(a)]=a)}return e}),{});return S(n)?null:new Dc(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:Ii(n)};return new Dc(e,{[d(r)]:r})}merge(e){this.timeUnits={...this.timeUnits};for(const t in e.timeUnits)this.timeUnits[t]||(this.timeUnits[t]=e.timeUnits[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){const t={};for(const[n,i]of O(this.timeUnits)){const r=kc(i)?i.as:`${i.field}_end`;e.has(r)||(t[n]=i)}this.timeUnits=t}producedFields(){return new Set(F(this.timeUnits).map((e=>kc(e)?e.as:Sc(e.field))))}dependentFields(){return new Set(F(this.timeUnits).map((e=>e.field)))}hash(){return`TimeUnit ${d(this.timeUnits)}`}assemble(){const e=[];for(const t of F(this.timeUnits)){const{rectBandPosition:n}=t,i=Ii(t.timeUnit);if(kc(t)){const{field:r,as:o}=t,{unit:a,utc:s,...l}=i,c=[o,`${o}_end`];e.push({field:M(r),type:"timeunit",...a?{units:Ri(a)}:{},...s?{timezone:"utc"}:{},...l,as:c}),e.push(...Cc(c,n,i))}else if(t){const{field:r}=t,o=r.replaceAll("\\.","."),a=zc({timeUnit:i,field:o}),s=Sc(o);e.push({type:"formula",expr:a,as:s}),e.push(...Cc([o,s],n,i))}}return e}}const Fc="offsetted_rect_start",Oc="offsetted_rect_end";function zc(e){let{timeUnit:t,field:n,reverse:i}=e;const{unit:r,utc:o}=t,a=Li(r),{part:s,step:l}=Hi(a,t.step);return`${o?"utcOffset":"timeOffset"}('${s}', ${j(n)}, ${i?-l:l})`}function Cc(e,t,n){let[i,r]=e;if(void 0!==t&&.5!==t){const e=j(i),o=j(r);return[{type:"formula",expr:_c([zc({timeUnit:n,field:i,reverse:!0}),e],t+.5),as:`${i}_${Fc}`},{type:"formula",expr:_c([e,o],t+.5),as:`${i}_${Oc}`}]}return[]}function _c(e,t){let[n,i]=e;return`${1-t} * ${n} + ${t} * ${i}`}const Pc="_tuple_fields";class Nc{constructor(){for(var e=arguments.length,t=new Array(e),n=0;n!0,parse:(e,n,i)=>{const r=n.name,o=n.project??=new Nc,a={},s={},l=new Set,c=(e,t)=>{const n="visual"===t?e.channel:e.field;let i=C(`${r}_${n}`);for(let e=1;l.has(i);e++)i=C(`${r}_${n}_${e}`);return l.add(i),{[t]:i}},u=n.type,f=e.config.selection[u],m=void 0!==i.value?t.array(i.value):null;let{fields:p,encodings:g}=t.isObject(i.select)?i.select:{};if(!p&&!g&&m)for(const e of m)if(t.isObject(e))for(const n of D(e))h=n,t.hasOwnProperty(et,h)?(g||(g=[])).push(n):"interval"===u?(Si('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),g=f.encodings):(p??=[]).push(n);var h;p||g||(g=f.encodings,"fields"in f&&(p=f.fields));for(const t of g??[]){const n=e.fieldDef(t);if(n){let i=n.field;if(n.aggregate){Si(Jn(t,n.aggregate));continue}if(!i){Si(Qn(t));continue}if(n.timeUnit&&!Ti(n.timeUnit)){i=e.vgField(t);const r={timeUnit:n.timeUnit,as:i,field:n.field};s[d(r)]=r}if(!a[i]){const r={field:i,channel:t,type:"interval"===u&&Qt(t)&&Sr(e.getScaleComponent(t).get("type"))?"R":n.bin?"R-RE":"E",index:o.items.length};r.signals={...c(r,"data"),...c(r,"visual")},o.items.push(a[i]=r),o.hasField[i]=a[i],o.hasSelectionId=o.hasSelectionId||i===zs,Le(t)?(r.geoChannel=t,r.channel=Re(t),o.hasChannel[r.channel]=a[i]):o.hasChannel[t]=a[i]}}else Si(Qn(t))}for(const e of p??[]){if(o.hasField[e])continue;const t={type:"E",field:e,index:o.items.length};t.signals={...c(t,"data")},o.items.push(t),o.hasField[e]=t,o.hasSelectionId=o.hasSelectionId||e===zs}m&&(n.init=m.map((e=>o.items.map((n=>t.isObject(e)?void 0!==e[n.geoChannel||n.channel]?e[n.geoChannel||n.channel]:e[n.field]:e))))),S(s)||(o.timeUnit=new Dc(null,s))},signals:(e,t,n)=>{const i=t.name+Pc;return n.filter((e=>e.name===i)).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(Bc)})}},Tc="_curr",jc="anim_value",Ec="anim_clock",Mc="eased_anim_clock",Rc="min_extent",Lc="max_range_extent",qc="last_tick_at",Uc="is_playing",Wc=1/60*1e3,Ic={defined:e=>"point"===e.type,topLevelSignals:(e,t,n)=>(af(t)&&(n=n.concat([{name:Ec,init:"0",on:[{events:{type:"timer",throttle:Wc},update:`${Uc} ? (${Ec} + (now() - ${qc}) > ${Lc} ? 0 : ${Ec} + (now() - ${qc})) : ${Ec}`}]},{name:qc,init:"now()",on:[{events:[{signal:Ec},{signal:Uc}],update:"now()"}]},{name:Uc,init:"true"}])),n),signals:(e,n,i)=>{const r=n.name,o=r+Pc,a=n.project,s="(item().isVoronoi ? datum.datum : datum)",l=F(e.component.selection??{}).reduce(((e,t)=>"interval"===t.type?e.concat(t.name+Zc):e),[]).map((e=>`indexof(item().mark.name, '${e}') < 0`)).join(" && "),c="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(l?` && ${l}`:"");let u=`unit: ${nf(e)}, `;if(n.project.hasSelectionId)u+=`${zs}: ${s}[${t.stringValue(zs)}]`;else if(af(n))u+=`fields: ${o}, values: [${jc} ? ${jc} : ${Rc}]`;else{u+=`fields: ${o}, values: [${a.items.map((n=>{const i=e.fieldDef(n.channel);return i?.bin?`[${s}[${t.stringValue(e.vgField(n.channel,{}))}], ${s}[${t.stringValue(e.vgField(n.channel,{binSuffix:"end"}))}]]`:`${s}[${t.stringValue(n.field)}]`})).join(", ")}]`}if(af(n))return i.concat((f=n.name,d=e.scaleName(ge),[{name:Mc,update:Ec},{name:`${f}_domain`,init:`domain('${d}')`},{name:Rc,init:`extent(${f}_domain)[0]`},{name:Lc,init:`extent(range('${d}'))[1]`},{name:jc,update:`invert('${d}', ${Mc})`}]),[{name:r+Ku,on:[{events:[{signal:Mc},{signal:jc}],update:`{${u}}`,force:!0}]}]);{const e=n.events;return i.concat([{name:r+Ku,on:e?[{events:e,update:`${c} ? {${u}} : null`,force:!0}]:[]}])}var f,d}};function Bc(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=M(r.field),r}function Vc(e){let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.identity;if(t.isArray(e)){const t=e.map((e=>Vc(e,n,i)));return n?`[${t.join(", ")}]`:t}return Di(e)?i(n?Pi(e):function(e){const t=_i(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):n?i(Q(e)):e}function Hc(e,n){for(const i of F(e.component.selection??{})){const r=i.name;let o=`${r}${Ku}, ${"global"===i.resolve?"true":`{unit: ${nf(e)}}`}`;for(const t of tf)t.defined(i)&&(t.signals&&(n=t.signals(e,i,n)),t.modifyExpr&&(o=t.modifyExpr(e,i,o)));n.push({name:r+Zu,on:[{events:{signal:i.name+Ku},update:`modify(${t.stringValue(i.name+Ju)}, ${o})`}]})}return Xc(n)}function Gc(e,n){if(e.component.selection&&D(e.component.selection).length){const i=t.stringValue(e.getName("cell"));n.unshift({name:"facet",value:{},on:[{events:t.parseSelector("pointermove","scope"),update:`isTuple(facet) ? facet : group(${i}).datum`}]})}return Xc(n)}function Yc(e,t){for(const n of F(e.component.selection??{}))for(const i of tf)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function Xc(e){return e.map((e=>(e.on&&!e.on.length&&delete e.on,e)))}const Qc={defined:e=>"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind,parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!Qt(r))continue;const o=e.getScaleComponent(r),a=o?o.get("type"):void 0;"sequential"==a&&Si("Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc"),o&&Sr(a)?(o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):Si("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(e,n,i)=>{const r=n.scales.filter((e=>0===i.filter((t=>t.name===e.signals.data)).length));if(!e.parent||Kc(e)||0===r.length)return i;const o=i.find((e=>e.name===n.name));let a=o.update;if(a.includes(ef))o.update=`{${r.map((e=>`${t.stringValue(M(e.field))}: ${e.signals.data}`)).join(", ")}}`;else{for(const e of r){const n=`${t.stringValue(M(e.field))}: ${e.signals.data}`;a.includes(n)||(a=`${a.substring(0,a.length-1)}, ${n}}`)}o.update=a}return i.concat(r.map((e=>({name:e.signals.data}))))},signals:(e,t,n)=>{if(e.parent&&!Kc(e))for(const e of t.scales){const t=n.find((t=>t.name===e.signals.data));t.push="outer",delete t.value,delete t.update}return n}};function Jc(e,n){return`domain(${t.stringValue(e.scaleName(n))})`}function Kc(e){return e.parent&&Im(e.parent)&&(!e.parent.parent||Kc(e.parent.parent))}const Zc="_brush",eu="_scale_trigger",tu="geo_interval_init_tick",nu="_init",iu={defined:e=>"interval"===e.type,parse:(e,n,i)=>{if(e.hasProjection){const e={...t.isObject(i.select)?i.select:{}};e.fields=[zs],e.encodings||(e.encodings=i.value?D(i.value):[de,fe]),i.select={type:"interval",...e}}if(n.translate&&!Qc.defined(n)){const e=`!event.item || event.item.mark.name !== ${t.stringValue(n.name+Zc)}`;for(const i of n.events){if(!i.between){Si(`${i} is not an ordered event stream for interval selections.`);continue}const n=t.array(i.between[0].filter??=[]);n.includes(e)||n.push(e)}}},signals:(e,n,i)=>{const r=n.name,o=r+Ku,a=F(n.project.hasChannel).filter((e=>e.channel===te||e.channel===ne)),s=n.init?n.init[0]:null;if(i.push(...a.reduce(((i,r)=>i.concat(function(e,n,i,r){const o=!e.hasProjection,a=i.channel,s=i.signals.visual,l=t.stringValue(o?e.scaleName(a):e.projectionName()),c=e=>`scale(${l}, ${e})`,u=e.getSizeSignalRef(a===te?"width":"height").signal,f=`${a}(unit)`,d=n.events.reduce(((e,t)=>[...e,{events:t.between[0],update:`[${f}, ${f}]`},{events:t,update:`[${s}[0], clamp(${f}, 0, ${u})]`}]),[]);if(o){const t=i.signals.data,o=Qc.defined(n),u=e.getScaleComponent(a),f=u?u.get("type"):void 0,m=r?{init:Vc(r,!0,c)}:{value:[]};return d.push({events:{signal:n.name+eu},update:Sr(f)?`[${c(`${t}[0]`)}, ${c(`${t}[1]`)}]`:"[0, 0]"}),o?[{name:t,on:[]}]:[{name:s,...m,on:d},{name:t,...r?{init:Vc(r)}:{},on:[{events:{signal:s},update:`${s}[0] === ${s}[1] ? null : invert(${l}, ${s})`}]}]}{const e=a===te?0:1,t=n.name+nu;return[{name:s,...r?{init:`[${t}[0][${e}], ${t}[1][${e}]]`}:{value:[]},on:d}]}}(e,n,r,s&&s[r.index]))),[])),e.hasProjection){const l=t.stringValue(e.projectionName()),c=e.projectionName()+"_center",{x:u,y:f}=n.project.hasChannel,d=u&&u.signals.visual,m=f&&f.signals.visual,p=u?s&&s[u.index]:`${c}[0]`,g=f?s&&s[f.index]:`${c}[1]`,h=t=>e.getSizeSignalRef(t).signal,y=`[[${d?d+"[0]":"0"}, ${m?m+"[0]":"0"}],[${d?d+"[1]":h("width")}, ${m?m+"[1]":h("height")}]]`;if(s&&(i.unshift({name:r+nu,init:`[scale(${l}, [${u?p[0]:p}, ${f?g[0]:g}]), scale(${l}, [${u?p[1]:p}, ${f?g[1]:g}])]`}),!u||!f)){i.find((e=>e.name===c))||i.unshift({name:c,update:`invert(${l}, [${h("width")}/2, ${h("height")}/2])`})}const v=`vlSelectionTuples(${`intersect(${y}, {markname: ${t.stringValue(e.getName("marks"))}}, unit.mark)`}, ${`{unit: ${nf(e)}}`})`,b=a.map((e=>e.signals.visual));return i.concat({name:o,on:[{events:[...b.length?[{signal:b.join(" || ")}]:[],...s?[{signal:tu}]:[]],update:v}]})}{if(!Qc.defined(n)){const n=r+eu,o=a.map((n=>{const i=n.channel,{data:r,visual:o}=n.signals,a=t.stringValue(e.scaleName(i)),s=Sr(e.getScaleComponent(i).get("type"))?"+":"";return`(!isArray(${r}) || (${s}invert(${a}, ${o})[0] === ${s}${r}[0] && ${s}invert(${a}, ${o})[1] === ${s}${r}[1]))`}));o.length&&i.push({name:n,value:{},on:[{events:a.map((t=>({scale:e.scaleName(t.channel)}))),update:o.join(" && ")+` ? ${n} : {}`}]})}const l=a.map((e=>e.signals.data)),c=`unit: ${nf(e)}, fields: ${r+Pc}, values`;return i.concat({name:o,...s?{init:`{${c}: ${Vc(s)}}`}:{},...l.length?{on:[{events:[{signal:l.join(" || ")}],update:`${l.join(" && ")} ? {${c}: [${l}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>{if(qm(e)&&e.hasProjection&&t.init){n.filter((e=>e.name===tu)).length||n.unshift({name:tu,value:null,on:[{events:"timer{1}",update:`${tu} === null ? {} : ${tu}`}]})}return n},marks:(e,n,i)=>{const r=n.name,{x:o,y:a}=n.project.hasChannel,s=o?.signals.visual,l=a?.signals.visual,c=`data(${t.stringValue(n.name+Ju)})`;if(Qc.defined(n)||!o&&!a)return i;const u={x:void 0!==o?{signal:`${s}[0]`}:{value:0},y:void 0!==a?{signal:`${l}[0]`}:{value:0},x2:void 0!==o?{signal:`${s}[1]`}:{field:{group:"width"}},y2:void 0!==a?{signal:`${l}[1]`}:{field:{group:"height"}}};if("global"===n.resolve)for(const t of D(u))u[t]=[{test:`${c}.length && ${c}[0].unit === ${nf(e)}`,...u[t]},{value:0}];const{fill:f,fillOpacity:d,cursor:m,...p}=n.mark,g=D(p).reduce(((e,t)=>(e[t]=[{test:[void 0!==o&&`${s}[0] !== ${s}[1]`,void 0!==a&&`${l}[0] !== ${l}[1]`].filter((e=>e)).join(" && "),value:p[t]},{value:null}],e)),{}),h=m??(n.translate?"move":null);return[{name:`${r+Zc}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:f},fillOpacity:{value:d}},update:u}},...i,{name:r+Zc,type:"rect",clip:!0,encode:{enter:{...h?{cursor:{value:h}}:{},fill:{value:"transparent"}},update:{...u,...g}}}]}};function ru(e){let{model:n,channelDef:i,vgChannel:r,invalidValueRef:o,mainRefFn:a}=e;const s=Qo(i)&&i.condition;let l=[];if(s){l=t.array(s).map((e=>{const t=a(e);if(function(e){return J(e,"param")}(e)){const{param:i,empty:r}=e;return{test:ff(n,{param:i,empty:r}),...t}}return{test:mf(n,e.test),...t}}))}void 0!==o&&l.push(o);const c=a(i);return void 0!==c&&l.push(c),l.length>1||1===l.length&&Boolean(l[0].test)?{[r]:l}:1===l.length?{[r]:l[0]}:{}}function ou(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";const n=e.encoding[t];return ru({model:e,channelDef:n,vgChannel:t,mainRefFn:t=>au(t,e.config),invalidValueRef:void 0})}function au(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"datum";if(e){if(sa(e))return Pn(e.value);if(oa(e)){const{format:i,formatType:r}=$a(e);return Oo({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function su(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{encoding:i,markDef:r,config:o,stack:a}=e,s=i.tooltip;if(t.isArray(s))return{tooltip:cu({tooltip:s},a,o,n)};{const l=n.reactiveGeom?"datum.datum":"datum";return ru({model:e,channelDef:s,vgChannel:"tooltip",mainRefFn:e=>{const s=au(e,o,l);if(s)return s;if(null===e)return;let c=En("tooltip",r,o);return!0===c&&(c={content:"encoding"}),t.isString(c)?{value:c}:t.isObject(c)?wn(c)?c:"encoding"===c.content?cu(i,a,o,n):{signal:l}:void 0},invalidValueRef:void 0})}}function lu(e,n,i){let{reactiveGeom:r}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={...i,...i.tooltipFormat},a=new Set,s=r?"datum.datum":"datum",l=[];function c(i,r){const c=rt(r),u=aa(i)?i:{...i,type:e[c].type},f=u.title||xa(u,o),d=t.array(f).join(", ").replaceAll(/"/g,'\\"');let m;if(_t(r)){const t="x"===r?"x2":"y2",n=wa(e[t]);if(pn(u.bin)&&n){const e=ma(u,{expr:s}),i=ma(n,{expr:s}),{format:r,formatType:l}=$a(u);m=jo(e,i,r,l,o),a.add(t)}}if((_t(r)||r===ce||r===se)&&n&&n.fieldChannel===r&&"normalize"===n.offset){const{format:e,formatType:t}=$a(u);m=Oo({fieldOrDatumDef:u,format:e,formatType:t,expr:s,config:o,normalizeStack:!0}).signal}m??=au(u,o,s).signal,l.push({channel:r,key:d,value:m})}Qa(e,((e,t)=>{Zo(e)?c(e,t):Jo(e)&&c(e.condition,t)}));const u={};for(const{channel:e,key:t,value:n}of l)a.has(e)||u[t]||(u[t]=n);return u}function cu(e,t,n){let{reactiveGeom:i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=lu(e,t,n,{reactiveGeom:i}),o=O(r).map((e=>{let[t,n]=e;return`"${t}": ${n}`}));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function uu(e){const{markDef:t,config:n}=e,i=En("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},...fu(e),...du(e)}}function fu(e){const{mark:n,markDef:i,config:r}=e;if(!1===r.aria)return{};const o=En("ariaRoleDescription",i,r);return null!=o?{ariaRoleDescription:{value:o}}:t.hasOwnProperty(Fn,n)?{}:{ariaRoleDescription:{value:n}}}function du(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return ru({model:e,channelDef:o,vgChannel:"description",mainRefFn:t=>au(t,e.config),invalidValueRef:void 0});const a=En("description",n,i);if(null!=a)return{description:Pn(a)};if(!1===i.aria)return{};const s=lu(t,r,i);return S(s)?void 0:{description:{signal:O(s).map(((e,t)=>{let[n,i]=e;return`"${t>0?"; ":""}${n}: " + (${i})`})).join(" + ")}}}function mu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{markDef:i,encoding:r,config:o}=t,{vgChannel:a}=n;let{defaultRef:s,defaultValue:l}=n;const c=r[e];void 0===s&&(l??=En(e,i,o,{vgChannel:a,ignoreVgConfig:!Qo(c)}),void 0!==l&&(s=Pn(l)));const u={markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},f=yo({...u,scaleChannel:e,channelDef:c});return ru({model:t,channelDef:c,vgChannel:a??e,invalidValueRef:f,mainRefFn:t=>wo({...u,channel:e,channelDef:t,stack:null,defaultRef:s})})}function pu(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{filled:void 0};const{markDef:n,encoding:i,config:r}=e,{type:o}=n,a=t.filled??En("filled",n,r),s=p(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,l=En(!0===a?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[!0===a&&"color"]??s,c=En(!1===a?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[!1===a&&"color"],u=a?"fill":"stroke",f={...l?{fill:Pn(l)}:{},...c?{stroke:Pn(c)}:{}};return n.color&&(a?n.fill:n.stroke)&&Si(ai("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...mu("color",e,{vgChannel:u,defaultValue:a?l:c}),...mu("fill",e,{defaultValue:i.fill?l:void 0}),...mu("stroke",e,{defaultValue:i.stroke?c:void 0})}}function gu(e){const{encoding:t,mark:n}=e,i=t.order;return!Zr(n)&&sa(i)?ru({model:e,channelDef:i,vgChannel:"zindex",mainRefFn:e=>Pn(e.value),invalidValueRef:void 0}):{}}function hu(e){let{channel:t,markDef:n,encoding:i={},model:r,bandPosition:o}=e;const a=`${t}Offset`,s=n[a],l=i[a];if(("xOffset"===a||"yOffset"===a)&&l){return{offsetType:"encoding",offset:wo({channel:a,channelDef:l,markDef:n,config:r?.config,scaleName:r.scaleName(a),scale:r.getScaleComponent(a),stack:null,defaultRef:Pn(s),bandPosition:o})}}const c=n[a];return c?{offsetType:"visual",offset:c}:{}}function yu(e,t,n){let{defaultPos:i,vgChannel:r}=n;const{encoding:o,markDef:a,config:s,stack:l}=t,c=o[e],u=o[at(e)],f=t.scaleName(e),d=t.getScaleComponent(e),{offset:m,offsetType:p}=hu({channel:e,markDef:a,encoding:o,model:t,bandPosition:.5}),g=vu({model:t,defaultPos:i,channel:e,scaleName:f,scale:d}),h=!c&&_t(e)&&(o.latitude||o.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:o,markDef:a}=e;if(oa(n)&&r&&t===r.fieldChannel){if(Zo(n)){let e=n.bandPosition;if(void 0!==e||"text"!==a.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return $o({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:o})}return xo(n,i,{suffix:"end"},{offset:o})}return bo(e)}({channel:e,channelDef:c,channel2Def:u,markDef:a,config:s,scaleName:f,scale:d,stack:l,offset:m,defaultRef:g,bandPosition:"encoding"===p?0:void 0});return h?{[r||e]:h}:void 0}function vu(e){let{model:t,defaultPos:n,channel:i,scaleName:r,scale:o}=e;const{markDef:a,config:s}=t;return()=>{const e=rt(i),l=ot(i),c=En(i,a,s,{vgChannel:l});if(void 0!==c)return ko(i,c);switch(n){case"zeroOrMin":return bu({scaleName:r,scale:o,mode:"zeroOrMin",mainChannel:e,config:s});case"zeroOrMax":return bu({scaleName:r,scale:o,mode:{zeroOrMax:{widthSignal:t.width.signal,heightSignal:t.height.signal}},mainChannel:e,config:s});case"mid":return{...t[st(i)],mult:.5}}}}function bu(e){let{mainChannel:t,config:n,...i}=e;const r=ho(i),{mode:o}=i;if(r)return r;switch(t){case"radius":{if("zeroOrMin"===o)return{value:0};const{widthSignal:e,heightSignal:t}=o.zeroOrMax;return{signal:`min(${e},${t})/2`}}case"theta":return"zeroOrMin"===o?{value:0}:{signal:"2*PI"};case"x":return"zeroOrMin"===o?{value:0}:{field:{group:"width"}};case"y":return"zeroOrMin"===o?{field:{group:"height"}}:{value:0}}}const xu={left:"x",center:"xc",right:"x2"},$u={top:"y",middle:"yc",bottom:"y2"};function wu(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"middle";if("radius"===e||"theta"===e)return ot(e);const r="x"===e?"align":"baseline",o=En(r,t,n);let a;return wn(o)?(Si(function(e){return`The ${e} for range marks cannot be an expression`}(r)),a=void 0):a=o,"x"===e?xu[a||("top"===i?"left":"center")]:$u[a||i]}function ku(e,t,n){let{defaultPos:i,defaultPos2:r,range:o}=n;return o?Su(e,t,{defaultPos:i,defaultPos2:r}):yu(e,t,{defaultPos:i})}function Su(e,t,n){let{defaultPos:i,defaultPos2:r}=n;const{markDef:o,config:a}=t,s=at(e),l=st(e),c=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:a,config:s}=e,l=rt(n),c=st(n),u=ot(n),f=i[l],d=e.scaleName(l),m=e.getScaleComponent(l),{offset:p}=hu(n in i||n in o?{channel:n,markDef:o,encoding:i,model:e}:{channel:l,markDef:o,encoding:i,model:e});if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude)){const t=st(n),i=e.markDef[t];return null!=i?{[t]:{value:i}}:{[u]:{field:e.getName(n)}}}const g=function(e){let{channel:t,channelDef:n,channel2Def:i,markDef:r,config:o,scaleName:a,scale:s,stack:l,offset:c,defaultRef:u}=e;if(oa(n)&&l&&t.charAt(0)===l.fieldChannel.charAt(0))return xo(n,a,{suffix:"start"},{offset:c});return bo({channel:t,channelDef:i,scaleName:a,scale:s,stack:l,markDef:r,config:o,offset:c,defaultRef:u})}({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:s,scaleName:d,scale:m,stack:a,offset:p,defaultRef:void 0});if(void 0!==g)return{[u]:g};return Du(n,o)||Du(n,{[n]:Rn(n,o,s.style),[c]:Rn(c,o,s.style)})||Du(n,s[r])||Du(n,s.mark)||{[u]:vu({model:e,defaultPos:t,channel:n,scaleName:d,scale:m})()}}(t,r,s);return{...yu(e,t,{defaultPos:i,vgChannel:c[l]?wu(e,o,a):ot(e)}),...c}}function Du(e,t){const n=st(e),i=ot(e);if(void 0!==t[i])return{[i]:ko(e,t[i])};if(void 0!==t[e])return{[i]:ko(e,t[e])};if(t[n]){const i=t[n];if(!lo(i))return{[n]:ko(e,i)};Si(function(e){return`Position range does not support relative band size for ${e}.`}(n))}}function Fu(e,n){const{config:i,encoding:r,markDef:o}=e,a=o.type,s=at(n),l=st(n),c=r[n],u=r[s],f=e.getScaleComponent(n),d=f?f.get("type"):void 0,m=o.orient,p=r[l]??r.size??En("size",o,i,{vgChannel:l}),g=lt(n),h="bar"===a&&("x"===n?"vertical"===m:"horizontal"===m)||"tick"===a&&("y"===n?"vertical"===m:"horizontal"===m);return!Zo(c)||!(mn(c.bin)||pn(c.bin)||c.timeUnit&&!u)||p&&!lo(p)||r[g]||kr(d)?(oa(c)&&kr(d)||h)&&!u?function(e,n,i){const{markDef:r,encoding:o,config:a,stack:s}=i,l=r.orient,c=i.scaleName(n),u=i.getScaleComponent(n),f=st(n),d=at(n),m=lt(n),p=i.scaleName(m),g=i.getScaleComponent(ct(n)),h="tick"===r.type||"horizontal"===l&&"y"===n||"vertical"===l&&"x"===n;let y;(o.size||r.size)&&(h?y=mu("size",i,{vgChannel:f,defaultRef:Pn(r.size)}):Si(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(r.type)));const v=!!y,b=Go({channel:n,fieldDef:e,markDef:r,config:a,scaleType:(u||g)?.get("type"),useVlSizeChannel:h});y=y||{[f]:Ou(f,p||c,g||u,a,b,!!e,r.type)};const x="band"===(u||g)?.get("type")&&lo(b)&&!v?"top":"middle",$=wu(n,r,a,x),w="xc"===$||"yc"===$,{offset:k,offsetType:S}=hu({channel:n,markDef:r,encoding:o,model:i,bandPosition:w?.5:0}),D=bo({channel:n,channelDef:e,markDef:r,config:a,scaleName:c,scale:u,stack:s,offset:k,defaultRef:vu({model:i,defaultPos:"mid",channel:n,scaleName:c,scale:u}),bandPosition:w?"encoding"===S?0:.5:wn(b)?{signal:`(1-${b})/2`}:lo(b)?(1-b.band)/2:0});if(f)return{[$]:D,...y};{const e=ot(d),n=y[f],i=k?{...n,offset:k}:n;return{[$]:D,[e]:t.isArray(D)?[D[0],{...D[1],offset:i}]:{...D,offset:i}}}}(c,n,e):Su(n,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function(e){let{fieldDef:t,fieldDef2:n,channel:i,model:r}=e;const{config:o,markDef:a,encoding:s}=r,l=r.getScaleComponent(i),c=r.scaleName(i),u=l?l.get("type"):void 0,f=l.get("reverse"),d=Go({channel:i,fieldDef:t,markDef:a,config:o,scaleType:u}),m=r.component.axes[i]?.[0],p=m?.get("translate")??.5,g=_t(i)?En("binSpacing",a,o)??0:0,h=at(i),y=ot(i),v=ot(h),b=Mn("minBandSize",a,o),{offset:x}=hu({channel:i,markDef:a,encoding:s,model:r,bandPosition:0}),{offset:$}=hu({channel:h,markDef:a,encoding:s,model:r,bandPosition:0}),w=function(e){let{scaleName:t,fieldDef:n}=e;const i=ma(n,{expr:"datum"});return`abs(scale("${t}", ${ma(n,{expr:"datum",suffix:"end"})}) - scale("${t}", ${i}))`}({fieldDef:t,scaleName:c}),k=zu(i,g,f,p,x,b,w),S=zu(h,g,f,p,$??x,b,w),D=wn(d)?{signal:`(1-${d.signal})/2`}:lo(d)?(1-d.band)/2:.5,F=Ho({fieldDef:t,fieldDef2:n,markDef:a,config:o});if(mn(t.bin)||t.timeUnit){const e=t.timeUnit&&.5!==F;return{[v]:Cu({fieldDef:t,scaleName:c,bandPosition:D,offset:S,useRectOffsetField:e}),[y]:Cu({fieldDef:t,scaleName:c,bandPosition:wn(D)?{signal:`1-${D.signal}`}:1-D,offset:k,useRectOffsetField:e})}}if(pn(t.bin)){const e=xo(t,c,{},{offset:S});if(Zo(n))return{[v]:e,[y]:xo(n,c,{},{offset:k})};if(gn(t.bin)&&t.bin.step)return{[v]:e,[y]:{signal:`scale("${c}", ${ma(t,{expr:"datum"})} + ${t.bin.step})`,offset:k}}}return void Si(xi(h))}({fieldDef:c,fieldDef2:u,channel:n,model:e})}function Ou(e,n,i,r,o,a,s){if(lo(o)){if(!i)return{mult:o.band,field:{group:e}};{const e=i.get("type");if("band"===e){let e=`bandwidth('${n}')`;1!==o.band&&(e=`${o.band} * ${e}`);const t=Mn("minBandSize",{type:s},r);return{signal:t?`max(${An(t)}, ${e})`:e}}1!==o.band&&(Si(function(e){return`Cannot use the relative band size with ${e} scale.`}(e)),o=void 0)}}else{if(wn(o))return o;if(o)return{value:o}}if(i){const e=i.get("range");if(kn(e)&&t.isNumber(e.step))return{value:e.step-2}}if(!a){const{bandPaddingInner:n,barBandPaddingInner:i,rectBandPaddingInner:o,tickBandPaddingInner:a}=r.scale,l=U(n,"tick"===s?a:"bar"===s?i:o);if(wn(l))return{signal:`(1 - (${l.signal})) * ${e}`};if(t.isNumber(l))return{signal:`${1-l} * ${e}`}}return{value:Ws(r.view,e)-2}}function zu(e,t,n,i,r,o,a){if(Ee(e))return 0;const s="x"===e||"y2"===e,l=s?-t/2:t/2;if(wn(n)||wn(r)||wn(i)||o){const e=An(n),t=An(r),c=An(i),u=An(o),f=o?`(${a} < ${u} ? ${s?"":"-"}0.5 * (${u} - (${a})) : ${l})`:l;return{signal:(c?`${c} + `:"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${f})`:f)}}return r=r||0,i+(n?-r-l:+r+l)}function Cu(e){let{fieldDef:t,scaleName:n,bandPosition:i,offset:r,useRectOffsetField:o}=e;return $o({scaleName:n,fieldOrDatumDef:t,bandPosition:i,offset:r,...o?{startSuffix:Fc,endSuffix:Oc}:{}})}const _u=new Set(["aria","width","height"]);function Pu(e,t){const{fill:n,stroke:i}="include"===t.color?pu(e):{};return{...Au(e.markDef,t),...Nu("fill",n),...Nu("stroke",i),...mu("opacity",e),...mu("fillOpacity",e),...mu("strokeOpacity",e),...mu("strokeWidth",e),...mu("strokeDash",e),...gu(e),...su(e),...ou(e,"href"),...uu(e)}}function Nu(e,t){return t?{[e]:t}:{}}function Au(e,t){return Dn.reduce(((n,i)=>(!_u.has(i)&&J(e,i)&&"ignore"!==t[i]&&(n[i]=Pn(e[i])),n)),{})}function Tu(e){const{config:t,markDef:n}=e,i=new Set;if(e.forEachFieldDef(((r,o)=>{let a;if(!Qt(o)||!(a=e.getScaleType(o)))return;const s=cn(r.aggregate),l=go({scaleChannel:o,markDef:n,config:t,scaleType:a,isCountAggregate:s});if("break-paths-filter-domains"===(c=l)||"break-paths-show-domains"===c){const t=e.vgField(o,{expr:"datum",binSuffix:e.stack?.impute?"mid":void 0});t&&i.add(t)}var c})),i.size>0){return{defined:{signal:[...i].map((e=>ir(e,!0))).join(" && ")}}}}function ju(e,t){if(void 0!==t)return{[e]:Pn(t)}}const Eu="voronoi",Mu={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(Eu)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(Zr(o))return Si(`The "nearest" transform is not supported for ${o} marks.`),n;const a={name:e.getName(Eu),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...su(e,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:i||!r?"datum.datum.x || 0":"0"},y:{expr:r||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let s=0,l=!1;return n.forEach(((t,n)=>{const i=t.name??"";i===e.component.mark[0].name?s=n:i.includes(Eu)&&(l=!0)})),l||n.splice(s+1,0,a),n}},Ru={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!_s(e.bind),parse:(e,t,n)=>of(t,n),topLevelSignals:(e,n,i)=>{const r=n.name,o=n.project,a=n.bind,s=n.init&&n.init[0],l=Mu.defined(n)?"(item().isVoronoi ? datum.datum : datum)":"datum";return o.items.forEach(((e,o)=>{const c=C(`${r}_${e.field}`);i.filter((e=>e.name===c)).length||i.unshift({name:c,...s?{init:Vc(s[o])}:{value:null},on:n.events?[{events:n.events,update:`datum && item().mark.marktype !== 'group' ? ${l}[${t.stringValue(e.field)}] : null`}]:[],bind:a[e.field]??a[e.channel]??a})})),i},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find((e=>e.name===i+Ku)),a=i+Pc,s=r.items.map((e=>C(`${i}_${e.field}`))),l=s.map((e=>`${e} !== null`)).join(" && ");return s.length&&(o.update=`${l} ? {fields: ${a}, values: [${s.join(", ")}]} : null`),delete o.value,delete o.on,n}},Lu="_toggle",qu={defined:e=>"point"===e.type&&!af(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+Lu,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+Ku,i=t.name+Lu;return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${nf(e)}}, `)+`${i} ? ${n} : null`}},Uu={defined:e=>void 0!==e.clear&&!1!==e.clear&&!af(e),parse:(e,n)=>{n.clear&&(n.clear=t.isString(n.clear)?t.parseSelector(n.clear,"view"):n.clear)},topLevelSignals:(e,t,n)=>{if(Ru.defined(t))for(const e of t.project.items){const i=n.findIndex((n=>n.name===C(`${t.name}_${e.field}`)));-1!==i&&n[i].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function i(e,i){-1!==e&&n[e].on&&n[e].on.push({events:t.clear,update:i})}if("interval"===t.type)for(const e of t.project.items){const t=n.findIndex((t=>t.name===e.signals.visual));if(i(t,"[0, 0]"),-1===t){i(n.findIndex((t=>t.name===e.signals.data)),"null")}}else{let e=n.findIndex((e=>e.name===t.name+Ku));i(e,"null"),qu.defined(t)&&(e=n.findIndex((e=>e.name===t.name+Lu)),i(e,"false"))}return n}},Wu={defined:e=>{const t="global"===e.resolve&&e.bind&&_s(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==zs;return t&&!n&&Si("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,n,i)=>{const r=l(i);if(r.select=t.isString(r.select)?{type:r.select,toggle:n.toggle}:{...r.select,toggle:n.toggle},of(n,r),t.isObject(i.select)&&(i.select.on||i.select.clear)){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const i of n.events)i.filter=t.array(i.filter??[]),i.filter.includes(e)||i.filter.push(e)}const o=Ps(n.bind)?n.bind.legend:"click",a=t.isString(o)?t.parseSelector(o,"view"):t.array(o);n.bind={legend:{merge:a}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=Ps(t.bind)&&t.bind.legend,o=e=>t=>{const n=l(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const a=`${C(e.field)}_legend`,s=`${i}_${a}`;if(0===n.filter((e=>e.name===s)).length){const e=r.merge.map(o(`${a}_symbols`)).concat(r.merge.map(o(`${a}_labels`))).concat(r.merge.map(o(`${a}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:e,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${s}`,force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find((e=>e.name===i+Ku)),a=i+Pc,s=r.items.filter((e=>e.hasLegend)).map((e=>C(`${i}_${C(e.field)}_legend`))),l=`${s.map((e=>`${e} !== null`)).join(" && ")} ? {fields: ${a}, values: [${s.join(", ")}]} : null`;t.events&&s.length>0?o.on.push({events:s.map((e=>({signal:e}))),update:l}):s.length>0&&(o.update=l,delete o.value,delete o.on);const c=n.find((e=>e.name===i+Lu)),u=Ps(t.bind)&&t.bind.legend;return c&&(t.events?c.on.push({...c.on[0],events:u}):c.on[0].events=u),n}};const Iu="_translate_anchor",Bu="_translate_delta",Vu={defined:e=>"interval"===e.type&&e.translate,signals:(e,n,i)=>{const r=n.name,o=Qc.defined(n),a=r+Iu,{x:s,y:l}=n.project.hasChannel;let c=t.parseSelector(n.translate,"scope");return o||(c=c.map((e=>(e.between[0].markname=r+Zc,e)))),i.push({name:a,value:{},on:[{events:c.map((e=>e.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==s?`, extent_x: ${o?Jc(e,te):`slice(${s.signals.visual})`}`:"")+(void 0!==l?`, extent_y: ${o?Jc(e,ne):`slice(${l.signals.visual})`}`:"")+"}"}]},{name:r+Bu,value:{},on:[{events:c,update:`{x: ${a}.x - x(unit), y: ${a}.y - y(unit)}`}]}),void 0!==s&&Hu(e,n,s,"width",i),void 0!==l&&Hu(e,n,l,"height",i),i}};function Hu(e,t,n,i,r){const o=t.name,a=o+Iu,s=o+Bu,l=n.channel,c=Qc.defined(t),u=r.find((e=>e.name===n.signals[c?"data":"visual"])),f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(l),m=d&&d.get("type"),p=d&&d.get("reverse"),g=`${a}.extent_${l}`,h=`${c&&d?"log"===m?"panLog":"symlog"===m?"panSymlog":"pow"===m?"panPow":"panLinear":"panLinear"}(${g}, ${`${c?l===te?p?"":"-":p?"-":"":""}${s}.${l} / ${c?`${f}`:`span(${g})`}`}${c?"pow"===m?`, ${d.get("exponent")??1}`:"symlog"===m?`, ${d.get("constant")??1}`:"":""})`;u.on.push({events:{signal:s},update:c?h:`clampRange(${h}, 0, ${f})`})}const Gu="_zoom_anchor",Yu="_zoom_delta",Xu={defined:e=>"interval"===e.type&&e.zoom,signals:(e,n,i)=>{const r=n.name,o=Qc.defined(n),a=r+Yu,{x:s,y:l}=n.project.hasChannel,c=t.stringValue(e.scaleName(te)),u=t.stringValue(e.scaleName(ne));let f=t.parseSelector(n.zoom,"scope");return o||(f=f.map((e=>(e.markname=r+Zc,e)))),i.push({name:r+Gu,on:[{events:f,update:o?"{"+[c?`x: invert(${c}, x(unit))`:"",u?`y: invert(${u}, y(unit))`:""].filter((e=>e)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:a,on:[{events:f,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==s&&Qu(e,n,s,"width",i),void 0!==l&&Qu(e,n,l,"height",i),i}};function Qu(e,t,n,i,r){const o=t.name,a=n.channel,s=Qc.defined(t),l=r.find((e=>e.name===n.signals[s?"data":"visual"])),c=e.getSizeSignalRef(i).signal,u=e.getScaleComponent(a),f=u&&u.get("type"),d=s?Jc(e,a):l.name,m=o+Yu,p=`${s&&u?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${`${o}${Gu}.${a}`}, ${m}${s?"pow"===f?`, ${u.get("exponent")??1}`:"symlog"===f?`, ${u.get("constant")??1}`:"":""})`;l.on.push({events:{signal:m},update:s?p:`clampRange(${p}, 0, ${c})`})}const Ju="_store",Ku="_tuple",Zu="_modify",ef="vlSelectionResolve",tf=[Ic,iu,Ac,qu,Ru,Qc,Wu,Uu,Vu,Xu,Mu];function nf(e){let{escape:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{escape:!0},i=n?t.stringValue(e.name):e.name;const r=function(e){let t=e.parent;for(;t&&!Um(t);)t=t.parent;return t}(e);if(r){const{facet:e}=r;for(const n of Be)e[n]&&(i+=` + '__facet_${n}_' + (facet[${t.stringValue(r.vgField(n))}])`)}return i}function rf(e){return F(e.component.selection??{}).reduce(((e,t)=>e||t.project.hasSelectionId),!1)}function of(e,n){!t.isString(n.select)&&n.select.on||delete e.events,!t.isString(n.select)&&n.select.clear||delete e.clear,!t.isString(n.select)&&n.select.toggle||delete e.toggle}function af(e){return e.events?.find((e=>"type"in e&&"timer"===e.type))}function sf(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...sf(e.object)),t.push(...sf(e.property))),t)}function lf(e){return"MemberExpression"===e.object.type?lf(e.object):"datum"===e.object.name}function cf(e){const n=t.parseExpression(e),i=new Set;return n.visit((e=>{"MemberExpression"===e.type&&lf(e)&&i.add(sf(e).slice(1).join("."))})),i}class uf extends $c{clone(){return new uf(null,this.model,l(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=mf(this.model,this.filter,this),this._dependentFields=cf(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function ff(e,n,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"datum";const o=t.isString(n)?n:n.param,a=C(o),s=t.stringValue(a+Ju);let l;try{l=e.getSelectionComponent(a,o)}catch(e){return`!!${a}`}if(l.project.timeUnit){const t=i??e.component.data.raw,n=l.project.timeUnit.clone();t.parent?n.insertAsParentOf(t):t.parent=n}const c=`${l.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${s}, ${r}${"global"===l.resolve?")":`, ${t.stringValue(l.resolve)})`}`,u=`length(data(${s}))`;return!1===n.empty?`${u} && ${c}`:`!${u} || ${c}`}function df(e,n,i){const r=C(n),o=i.encoding;let a,s=i.field;try{a=e.getSelectionComponent(r,n)}catch(e){return r}if(o||s){if(o&&!s){const e=a.project.items.filter((e=>e.channel===o));!e.length||e.length>1?(s=a.project.items[0].field,Si(function(e,n,i,r){return(e.length?"Multiple ":"No ")+`matching ${t.stringValue(n)} encoding found for selection ${t.stringValue(i.param)}. `+`Using "field": ${t.stringValue(r)}.`}(e,o,i,s))):s=e[0].field}}else s=a.project.items[0].field,a.project.items.length>1&&Si(function(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${t.stringValue(e)}.`}(s));return`${a.name}[${t.stringValue(M(s))}]`}function mf(e,n,i){return _(n,(n=>t.isString(n)?n:function(e){return J(e,"param")}(n)?ff(e,n,i):nr(n)))}function pf(e,t,n,i){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=i}function gf(e,n,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{header:!1};const{disable:o,orient:a,scale:s,labelExpr:l,title:c,zindex:u,...f}=e.combine();if(!o){for(const e in f){const i=e,r=Ea[i],o=f[i];if(r&&r!==n&&"both"!==r)delete f[i];else if(Ta(o)){const{condition:e,...n}=o,r=t.array(e),a=Aa[i];if(a){const{vgProp:e,part:t}=a;pf(f,t,e,[...r.map((e=>{const{test:t,...n}=e;return{test:mf(null,t),...n}})),n]),delete f[i]}else if(null===a){const e={signal:r.map((e=>{const{test:t,...n}=e;return`${mf(null,t)} ? ${Nn(n)} : `})).join("")+Nn(n)};f[i]=e}}else if(wn(o)){const e=Aa[i];if(e){const{vgProp:t,part:n}=e;pf(f,n,t,o),delete f[i]}}p(["labelAlign","labelBaseline"],i)&&null===f[i]&&delete f[i]}if("grid"===n){if(!f.grid)return;if(f.encode){const{grid:e}=f.encode;f.encode={...e?{grid:e}:{}},S(f.encode)&&delete f.encode}return{scale:s,orient:a,...f,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:U(u,0)}}{if(!r.header&&e.mainExtracted)return;if(void 0!==l){let e=l;f.encode?.labels?.update&&wn(f.encode.labels.update.text)&&(e=R(l,"datum.label",f.encode.labels.update.text.signal)),pf(f,"labels","text",{signal:e})}if(null===f.labelAlign&&delete f.labelAlign,f.encode){for(const t of ja)e.hasAxisPart(t)||delete f.encode[t];S(f.encode)&&delete f.encode}const n=function(e,n){if(e)return t.isArray(e)&&!$n(e)?e.map((e=>xa(e,n))).join(", "):e}(c,i);return{scale:s,orient:a,grid:!1,...n?{title:n}:{},...f,...!1===i.aria?{aria:!1}:{},zindex:U(u,0)}}}}function hf(e){const{axes:t}=e.component,n=[];for(const i of Ct)if(t[i])for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const t="x"===i?"height":"width",r=e.getSizeSignalRef(t).signal;t!==r&&n.push({name:t,update:r})}return n}function yf(e,t,n,i){return Object.assign.apply(null,[{},...e.map((e=>{if("axisOrient"===e){const e="x"===n?"bottom":"left",r=t["x"===n?"axisBottom":"axisLeft"]||{},o=t["x"===n?"axisTop":"axisRight"]||{},a=new Set([...D(r),...D(o)]),s={};for(const t of a.values())s[t]={signal:`${i.signal} === "${e}" ? ${An(r[t])} : ${An(o[t])}`};return s}return t[e]}))])}function vf(e,n){const i=[{}];for(const r of e){let e=n[r]?.style;if(e){e=t.array(e);for(const t of e)i.push(n.style[t])}}return Object.assign.apply(null,i)}function bf(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=Ln(e,n,t);if(void 0!==r)return{configFrom:"style",configValue:r};for(const t of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==i[t]?.[e])return{configFrom:t,configValue:i[t][e]};return{}}const xf={scale:e=>{let{model:t,channel:n}=e;return t.scaleName(n)},format:e=>{let{format:t}=e;return t},formatType:e=>{let{formatType:t}=e;return t},grid:e=>{let{fieldOrDatumDef:t,axis:n,scaleType:i}=e;return n.grid??function(e,t){return!kr(e)&&Zo(t)&&!mn(t?.bin)&&!pn(t?.bin)}(i,t)},gridScale:e=>{let{model:t,channel:n}=e;return function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n);return}(t,n)},labelAlign:e=>{let{axis:t,labelAngle:n,orient:i,channel:r}=e;return t.labelAlign||kf(n,i,r)},labelAngle:e=>{let{labelAngle:t}=e;return t},labelBaseline:e=>{let{axis:t,labelAngle:n,orient:i,channel:r}=e;return t.labelBaseline||wf(n,i,r)},labelFlush:e=>{let{axis:t,fieldOrDatumDef:n,channel:i}=e;return t.labelFlush??function(e,t){if("x"===t&&p(["quantitative","temporal"],e))return!0;return}(n.type,i)},labelOverlap:e=>{let{axis:n,fieldOrDatumDef:i,scaleType:r}=e;return n.labelOverlap??function(e,n,i,r){if(i&&!t.isObject(r)||"nominal"!==e&&"ordinal"!==e)return"log"!==n&&"symlog"!==n||"greedy";return}(i.type,r,Zo(i)&&!!i.timeUnit,Zo(i)?i.sort:void 0)},orient:e=>{let{orient:t}=e;return t},tickCount:e=>{let{channel:t,model:n,axis:i,fieldOrDatumDef:r,scaleType:o}=e;const a="x"===t?"width":"y"===t?"height":void 0,s=a?n.getSizeSignalRef(a):void 0;return i.tickCount??function(e){let{fieldOrDatumDef:t,scaleType:n,size:i,values:r}=e;if(!r&&!kr(n)&&"log"!==n){if(Zo(t)){if(mn(t.bin))return{signal:`ceil(${i.signal}/10)`};if(t.timeUnit&&p(["month","hours","day","quarter"],Ii(t.timeUnit)?.unit))return}return{signal:`ceil(${i.signal}/40)`}}return}({fieldOrDatumDef:r,scaleType:o,size:s,values:i.values})},tickMinStep:function(e){let{format:t,fieldOrDatumDef:n}=e;if("d"===t)return 1;if(Zo(n)){const{timeUnit:e}=n;if(e){const t=Bi(e);if(t)return{signal:t}}}return},title:e=>{let{axis:t,model:n,channel:i}=e;if(void 0!==t.title)return t.title;const r=Sf(n,i);if(void 0!==r)return r;const o=n.typedFieldDef(i),a="x"===i?"x2":"y2",s=n.fieldDef(a);return Un(o?[Bo(o)]:[],Zo(s)?[Bo(s)]:[])},values:e=>{let{axis:n,fieldOrDatumDef:i}=e;return function(e,n){const i=e.values;if(t.isArray(i))return Pa(n,i);if(wn(i))return i;return}(n,i)},zindex:e=>{let{axis:t,fieldOrDatumDef:n,mark:i}=e;return t.zindex??function(e,t){if("rect"===e&&pa(t))return 1;return 0}(i,n)}};function $f(e){return`(((${e.signal} % 360) + 360) % 360)`}function wf(e,t,n,i){if(void 0!==e){if("x"===n){if(wn(e)){const n=$f(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${wn(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45{if(la(t)&&qo(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,a=o.map(((e,t)=>`${nr({field:i,timeUnit:r,equal:e})} ? ${t} : `)).join("")+o.length;e=new Df(e,{calculate:a,as:Ff(t,n,{forAs:!0})})}})),e}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${d(this.transform)}`}}function Ff(e,t,n){return ma(e,{prefix:t,suffix:"sort_index",...n})}function Of(e,t){return p(["top","bottom"],t)?"column":p(["left","right"],t)||"row"===e?"row":"column"}function zf(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return U((t||{})[e],r[e],n.header[e])}function Cf(e,t,n,i){const r={};for(const o of e){const e=zf(o,t||{},n,i);void 0!==e&&(r[o]=e)}return r}const _f=["row","column"],Pf=["header","footer"];function Nf(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,r=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:o,titleAngle:a,titleOrient:s}=Cf(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),l=Of(t,s),c=H(a);return{name:`${t}-title`,type:"group",role:`${l}-title`,title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...Tf(c,l),...Af(l,c,o),...Uf(i,r,t,Ss,ws)}}}function Af(e,t){switch(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"middle"){case"start":return{align:"left"};case"end":return{align:"right"}}const n=kf(t,"row"===e?"left":"top","row"===e?"y":"x");return n?{align:n}:{}}function Tf(e,t){const n=wf(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function jf(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of Pf)if(n[r])for(const o of n[r]){const a=Rf(e,t,r,n,o);null!=a&&i.push(a)}return i}function Ef(e,n){const{sort:i}=e;return Lo(i)?{field:ma(i,{expr:"datum"}),order:i.order??"ascending"}:t.isArray(i)?{field:Ff(e,n,{expr:"datum"}),order:"ascending"}:{field:ma(e,{expr:"datum"}),order:i??"ascending"}}function Mf(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:a,labelOrient:s,labelExpr:l}=Cf(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),c=Oo({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,u=Of(t,s);return{text:{signal:l?R(R(l,"datum.label",c),"datum.value",ma(e,{expr:"parent"})):c},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...Tf(o,u),...Af(u,o,a),...Uf(n,e,t,Ds,ks)}}function Rf(e,t,n,i,r){if(r){let o=null;const{facetFieldDef:a}=i,s=e.config?e.config:void 0;if(a&&r.labels){const{labelOrient:e}=Cf(["labelOrient"],a.header,s,t);("row"===t&&!p(["top","bottom"],e)||"column"===t&&!p(["left","right"],e))&&(o=Mf(a,t,s))}const l=Um(e)&&!Uo(e.facet),c=r.axes,u=c?.length>0;if(o||u){const s="row"===t?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...i.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:Ef(a,t)}:{},...u&&l?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...o?{title:o}:{},...r.sizeSignal?{encode:{update:{[s]:r.sizeSignal}}}:{},...u?{axes:c}:{}}}}return null}const Lf={column:{start:0,end:1},row:{start:1,end:0}};function qf(e,t){return Lf[t][e]}function Uf(e,t,n,i,r){const o={};for(const a of i){if(!r[a])continue;const i=zf(a,t?.header,e,n);void 0!==i&&(o[r[a]]=i)}return o}function Wf(e){return[...If(e,"width"),...If(e,"height"),...If(e,"childWidth"),...If(e,"childHeight")]}function If(e,t){const n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(!i||"merged"===i)return[];const r=e.getSizeSignalRef(t).signal;if("step"===i){const t=e.getScaleComponent(n);if(t){const i=t.get("type"),o=t.get("range");if(kr(i)&&kn(o)){const i=e.scaleName(n);if(Um(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[Bf(i,o)]}return[Bf(i,o),{name:r,update:Vf(i,t,`domain('${i}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==i){const t=r.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",i=`isFinite(${n}) ? ${n} : ${Us(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function Bf(e,t){const n=`${e}_step`;return wn(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function Vf(e,t,n){const i=t.get("type"),r=t.get("padding"),o=U(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:r:1,`bandspace(${n}, ${An(a)}, ${An(o)}) * ${e}_step`}function Hf(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function Gf(e,t){return D(e).reduce(((n,i)=>({...n,...ru({model:t,channelDef:e[i],vgChannel:i,mainRefFn:e=>Pn(e.value),invalidValueRef:void 0})})),{})}function Yf(e,t){if(Um(t))return"theta"===e?"independent":"shared";if(Im(t))return"shared";if(Wm(t))return _t(e)||"theta"===e||"radius"===e?"independent":"shared";throw new Error("invalid model type for resolve")}function Xf(e,t){const n=e.scale[t],i=_t(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&Si(function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}(t)),"independent"):e[i][t]||"shared"}const Qf=D({aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1});class Jf extends oc{}const Kf={symbols:function(e,n){let{fieldOrDatumDef:i,model:r,channel:o,legendCmpt:a,legendType:s}=n;if("symbol"!==s)return;const{markDef:l,encoding:c,config:u,mark:f}=r,d=l.filled&&"trail"!==f;let m={...Tn({},r,io),...pu(r,{filled:d})};const p=a.get("symbolOpacity")??u.legend.symbolOpacity,g=a.get("symbolFillColor")??u.legend.symbolFillColor,h=a.get("symbolStrokeColor")??u.legend.symbolStrokeColor,y=void 0===p?Zf(c.opacity)??l.opacity:void 0;if(m.fill)if("fill"===o||d&&o===he)delete m.fill;else if(J(m.fill,"field"))g?delete m.fill:(m.fill=Pn(u.legend.symbolBaseFillColor??"black"),m.fillOpacity=Pn(y??1));else if(t.isArray(m.fill)){const e=ed(c.fill??c.color)??l.fill??(d&&l.color);e&&(m.fill=Pn(e))}if(m.stroke)if("stroke"===o||!d&&o===he)delete m.stroke;else if(J(m.stroke,"field")||h)delete m.stroke;else if(t.isArray(m.stroke)){const e=U(ed(c.stroke||c.color),l.stroke,d?l.color:void 0);e&&(m.stroke={value:e})}if(o!==we){const e=Zo(i)&&nd(r,a,i);e?m.opacity=[{test:e,...Pn(y??1)},Pn(u.legend.unselectedOpacity)]:y&&(m.opacity=Pn(y))}return m={...m,...e},S(m)?void 0:m},gradient:function(e,t){let{model:n,legendType:i,legendCmpt:r}=t;if("gradient"!==i)return;const{config:o,markDef:a,encoding:s}=n;let l={};const c=void 0===(r.get("gradientOpacity")??o.legend.gradientOpacity)?Zf(s.opacity)||a.opacity:void 0;c&&(l.opacity=Pn(c));return l={...l,...e},S(l)?void 0:l},labels:function(e,t){let{fieldOrDatumDef:n,model:i,channel:r,legendCmpt:o}=t;const a=i.legend(r)||{},s=i.config,l=Zo(n)?nd(i,o,n):void 0,c=l?[{test:l,value:1},{value:s.legend.unselectedOpacity}]:void 0,{format:u,formatType:f}=a;let d;So(f)?d=Co({fieldOrDatumDef:n,field:"datum.value",format:u,formatType:f,config:s}):void 0===u&&void 0===f&&s.customFormatTypes&&("quantitative"===n.type&&s.numberFormatType?d=Co({fieldOrDatumDef:n,field:"datum.value",format:s.numberFormat,formatType:s.numberFormatType,config:s}):"temporal"===n.type&&s.timeFormatType&&Zo(n)&&void 0===n.timeUnit&&(d=Co({fieldOrDatumDef:n,field:"datum.value",format:s.timeFormat,formatType:s.timeFormatType,config:s})));const m={...c?{opacity:c}:{},...d?{text:d}:{},...e};return S(m)?void 0:m},entries:function(e,t){let{legendCmpt:n}=t;const i=n.get("selections");return i?.length?{...e,fill:{value:"transparent"}}:e}};function Zf(e){return td(e,((e,t)=>Math.max(e,t.value)))}function ed(e){return td(e,((e,t)=>U(e,t.value)))}function td(e,n){return function(e){const n=e?.condition;return!!n&&(t.isArray(n)||sa(n))}(e)?t.array(e.condition).reduce(n,e.value):sa(e)?e.value:void 0}function nd(e,n,i){const r=n.get("selections");if(!r?.length)return;const o=t.stringValue(i.field);return r.map((e=>`(!length(data(${t.stringValue(C(e)+Ju)})) || (${e}[${o}] && indexof(${e}[${o}], datum.value) >= 0))`)).join(" || ")}const id={direction:e=>{let{direction:t}=e;return t},format:e=>{let{fieldOrDatumDef:t,legend:n,config:i}=e;const{format:r,formatType:o}=n;return _o(t,t.type,r,o,i,!1)},formatType:e=>{let{legend:t,fieldOrDatumDef:n,scaleType:i}=e;const{formatType:r}=t;return Po(r,n,i)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??function(e){let{legendConfig:t,model:n,direction:i,orient:r,scaleType:o}=e;const{gradientHorizontalMaxLength:a,gradientHorizontalMinLength:s,gradientVerticalMaxLength:l,gradientVerticalMinLength:c}=t;if(Dr(o))return"horizontal"===i?"top"===r||"bottom"===r?ad(n,"width",s,a):s:ad(n,"height",c,l);return}(e)},labelOverlap:e=>{let{legend:t,legendConfig:n,scaleType:i}=e;return t.labelOverlap??n.labelOverlap??function(e){if(p(["quantile","threshold","log","symlog"],e))return"greedy";return}(i)},symbolType:e=>{let{legend:t,markDef:n,channel:i,encoding:r}=e;return t.symbolType??function(e,t,n,i){if("shape"!==t){const e=ed(n)??i;if(e)return e}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(n.type,i,r.shape,n.shape)},title:e=>{let{fieldOrDatumDef:t,config:n}=e;return va(t,n,{allowDisabling:!0})},type:e=>{let{legendType:t,scaleType:n,channel:i}=e;if(We(i)&&Dr(n)){if("gradient"===t)return}else if("symbol"===t)return;return t},values:e=>{let{fieldOrDatumDef:n,legend:i}=e;return function(e,n){const i=e.values;if(t.isArray(i))return Pa(n,i);if(wn(i))return i;return}(i,n)}};function rd(e){const{legend:t}=e;return U(t.type,function(e){let{channel:t,timeUnit:n,scaleType:i}=e;if(We(t)){if(p(["quarter","month","day"],n))return"symbol";if(Dr(i))return"gradient"}return"symbol"}(e))}function od(e){let{legendConfig:t,legendType:n,orient:i,legend:r}=e;return r.direction??t[n?"gradientDirection":"symbolDirection"]??function(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===t?"horizontal":void 0}}(i,n)}function ad(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function sd(e){const t=qm(e)?function(e){const{encoding:t}=e,n={};for(const i of[he,...Os]){const r=ka(t[i]);r&&e.getScaleComponent(i)&&(i===be&&Zo(r)&&r.type===fr||(n[i]=cd(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){sd(i);for(const r of D(i.component.legends))n.legend[r]=Xf(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=ud(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of D(t))for(const t of e.children)t.component.legends[i]&&"shared"===n.legend[i]&&delete t.component.legends[i];return t}(e);return e.component.legends=t,t}function ld(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!!n?.values;case"title":if("title"===t&&e===i?.title)return!0}return e===(n||{})[t]}function cd(e,t){let n=e.legend(t);const{markDef:i,encoding:r,config:o}=e,a=o.legend,s=new Jf({},function(e,t){const n=e.scaleName(t);if("trail"===e.mark){if("color"===t)return{stroke:n};if("size"===t)return{strokeWidth:n}}return"color"===t?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}(e,t));!function(e,t,n){const i=e.fieldDef(t)?.field;for(const r of F(e.component.selection??{})){const e=r.project.hasField[i]??r.project.hasChannel[t];if(e&&Wu.defined(r)){const t=n.get("selections")??[];t.push(r.name),n.set("selections",t,!1),e.hasLegend=!0}}}(e,t,s);const l=void 0!==n?!n:a.disable;if(s.set("disable",l,void 0!==n),l)return s;n=n||{};const c=e.getScaleComponent(t).get("type"),u=ka(r[t]),f=Zo(u)?Ii(u.timeUnit)?.unit:void 0,d=n.orient||o.legend.orient||"right",m=rd({legend:n,channel:t,timeUnit:f,scaleType:c}),p={legend:n,channel:t,model:e,markDef:i,encoding:r,fieldOrDatumDef:u,legendConfig:a,config:o,scaleType:c,orient:d,legendType:m,direction:od({legend:n,legendType:m,orient:d,legendConfig:a})};for(const i of Qf){if("gradient"===m&&i.startsWith("symbol")||"symbol"===m&&i.startsWith("gradient"))continue;const r=i in id?id[i](p):n[i];if(void 0!==r){const a=ld(r,i,n,e.fieldDef(t));(a||void 0===o.legend[i])&&s.set(i,r,a)}}const g=n?.encoding??{},h=s.get("selections"),y={},v={fieldOrDatumDef:u,model:e,channel:t,legendCmpt:s,legendType:m};for(const t of["labels","legend","title","symbols","gradient","entries"]){const n=Gf(g[t]??{},e),i=t in Kf?Kf[t](n,v):n;void 0===i||S(i)||(y[t]={...h?.length&&Zo(u)?{name:`${C(u.field)}_legend_${t}`}:{},...h?.length?{interactive:!!h}:{},update:i})}return S(y)||s.set("encode",y,!!n?.encoding),s}function ud(e,t){if(!e)return t.clone();const n=e.getWithExplicit("orient"),i=t.getWithExplicit("orient");if(n.explicit&&i.explicit&&n.value!==i.value)return;let r=!1;for(const n of Qf){const i=uc(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",((e,t)=>{switch(n){case"symbolType":return fd(e,t);case"title":return In(e,t);case"type":return r=!0,sc("symbol")}return cc(e,t,n,"legend")}));e.setWithExplicit(n,i)}return r&&(e.implicit?.encode?.gradient&&P(e.implicit,["encode","gradient"]),e.explicit?.encode?.gradient&&P(e.explicit,["encode","gradient"])),e}function fd(e,t){return"circle"===t.value?t:e}function dd(e){const t=e.component.legends,n={};for(const i of D(t)){const r=Q(e.getScaleComponent(i).get("domains"));if(n[r])for(const e of n[r]){ud(e,t[i])||n[r].push(t[i])}else n[r]=[t[i].clone()]}return F(n).flat().map((t=>function(e,t){const{disable:n,labelExpr:i,selections:r,...o}=e.combine();if(n)return;!1===t.aria&&null==o.aria&&(o.aria=!1);if(o.encode?.symbols){const e=o.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||o.stroke||(e.stroke={value:"transparent"});for(const t of Os)o[t]&&delete e[t]}o.title||delete o.title;if(void 0!==i){let e=i;o.encode?.labels?.update&&wn(o.encode.labels.update.text)&&(e=R(i,"datum.label",o.encode.labels.update.text.signal)),function(e,t,n,i){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=i}(o,"labels","text",{signal:e})}return o}(t,e.config))).filter((e=>void 0!==e))}function md(e){return Im(e)||Wm(e)?function(e){return e.children.reduce(((e,t)=>e.concat(t.assembleProjections())),pd(e))}(e):pd(e)}function pd(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map((e=>e.signal)).join(", ")}]`},o=t.data.reduce(((t,n)=>{const i=wn(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return p(t,i)||t.push(i),t}),[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:r,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...n}]}return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const gd=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class hd extends oc{merged=!1;constructor(e,t,n,i){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=i}get isFit(){return!!this.data}}function yd(e){e.component.projection=qm(e)?function(e){if(e.hasProjection){const t=bn(e.specifiedProjection),n=!(t&&(null!=t.scale||null!=t.translate)),i=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,r=n?function(e){const t=[],{encoding:n}=e;for(const i of[[de,fe],[pe,me]])(ka(n[i[0]])||ka(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});e.channelHasField(be)&&e.typedFieldDef(be).type===fr&&t.push({signal:e.getName(`geojson_${t.length}`)});0===t.length&&t.push(e.requestDataName(bc.Main));return t}(e):void 0,o=new hd(e.projectionName(!0),{...bn(e.config.projection),...t},i,r);return o.get("type")||o.set("type","equalEarth",!1),o}return}(e):function(e){if(0===e.children.length)return;let n;for(const t of e.children)yd(t);const i=h(e.children,(e=>{const i=e.component.projection;if(i){if(n){const e=function(e,n){const i=h(gd,(i=>!t.hasOwnProperty(e.explicit,i)&&!t.hasOwnProperty(n.explicit,i)||!!(t.hasOwnProperty(e.explicit,i)&&t.hasOwnProperty(n.explicit,i)&&X(e.get(i),n.get(i)))));if(X(e.size,n.size)){if(i)return e;if(X(e.explicit,{}))return n;if(X(n.explicit,{}))return e}return null}(n,i);return e&&(n=e),!!e}return n=i,!0}return!0}));if(n&&i){const t=e.projectionName(!0),i=new hd(t,n.specifiedProjection,n.size,l(n.data));for(const n of e.children){const e=n.component.projection;e&&(e.isFit&&i.data.push(...n.component.projection.data),n.renameProjection(e.get("name"),t),e.merged=!0)}return i}return}(e)}function vd(e,t,n,i){if(Na(t,n)){const r=qm(e)?e.axis(n)??e.legend(n)??{}:{},o=ma(t,{expr:"datum"}),a=ma(t,{expr:"datum",binSuffix:"end"});return{formulaAs:ma(t,{binSuffix:"range",forAs:!0}),formula:jo(o,a,r.format,r.formatType,i)}}return{}}function bd(e,t){return`${dn(e)}_${t}`}function xd(e,t,n){const i=bd(Oa(n,void 0)??{},t);return e.getName(`${i}_bins`)}function $d(e,n,i){let r,o;r=function(e){return"as"in e}(e)?t.isString(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[ma(e,{forAs:!0}),ma(e,{binSuffix:"end",forAs:!0})];const a={...Oa(n,void 0)},s=bd(a,e.field),{signal:l,extentSignal:c}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(i,s);if(hn(a.extent)){const e=a.extent;o=df(i,e.param,e),delete a.extent}return{key:s,binComponent:{bin:a,field:e.field,as:[r],...l?{signal:l}:{},...c?{extentSignal:c}:{},...o?{span:o}:{}}}}class wd extends $c{clone(){return new wd(null,l(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{if(aa(n)&&mn(n.bin)){const{key:r,binComponent:o}=$d(n,n.bin,t);e[r]={...o,...e[r],...vd(t,n,i,t.config)}}return e}),{});return S(n)?null:new wd(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=$d(t,t.bin,n);return new wd(e,{[i]:r})}merge(e,t){for(const n of D(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=b([...this.bins[n].as,...e.bins[n].as],d)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(F(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(F(this.bins).map((e=>e.field)))}hash(){return`Bin ${d(this.bins)}`}assemble(){return F(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:r,...o}=e.bin,a={type:"bin",field:M(e.field),as:n,signal:e.signal,...hn(r)?{extent:null}:{extent:r},...e.span?{span:{signal:`span(${e.span})`}}:{},...o};!r&&e.extentSignal&&(t.push({type:"extent",field:M(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const e of i)for(let i=0;i<2;i++)t.push({type:"formula",expr:ma({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))}}function kd(e,n,i,r){const o=qm(r)?r.encoding[at(n)]:void 0;if(aa(i)&&qm(r)&&Yo(i,o,r.markDef,r.config)){e.add(ma(i,{})),e.add(ma(i,{suffix:"end"}));const{mark:t,markDef:o,config:a}=r,s=Ho({fieldDef:i,markDef:o,config:a});eo(t)&&.5!==s&&_t(n)&&(e.add(ma(i,{suffix:Fc})),e.add(ma(i,{suffix:Oc}))),i.bin&&Na(i,n)&&e.add(ma(i,{binSuffix:"range"}))}else if(Le(n)){const t=Re(n);e.add(r.getName(t))}else e.add(ma(i));return la(i)&&function(e){return t.isObject(e)&&"field"in e}(i.scale?.range)&&e.add(i.scale.range.field),e}class Sd extends $c{clone(){return new Sd(null,new Set(this.dimensions),l(this.measures))}constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}get groupBy(){return this.dimensions}static makeFromEncoding(e,t){let n=!1;t.forEachFieldDef((e=>{e.aggregate&&(n=!0)}));const i={},r=new Set;return n?(t.forEachFieldDef(((e,n)=>{const{aggregate:o,field:a}=e;if(o)if("count"===o)i["*"]??={},i["*"].count=new Set([ma(e,{forAs:!0})]);else{if(on(o)||an(o)){const e=on(o)?"argmin":"argmax",t=o[e];i[t]??={},i[t][e]=new Set([ma({op:e,field:t},{forAs:!0})])}else i[a]??={},i[a][o]=new Set([ma(e,{forAs:!0})]);Qt(n)&&"unaggregated"===t.scaleDomain(n)&&(i[a]??={},i[a].min=new Set([ma({field:a,aggregate:"min"},{forAs:!0})]),i[a].max=new Set([ma({field:a,aggregate:"max"},{forAs:!0})]))}else kd(r,n,e,t)})),r.size+D(i).length===0?null:new Sd(e,r,i)):null}static makeFromTransform(e,t){const n=new Set,i={};for(const e of t.aggregate){const{op:t,field:n,as:r}=e;t&&("count"===t?(i["*"]??={},i["*"].count=new Set([r||ma(e,{forAs:!0})])):(i[n]??={},i[n][t]??=new Set,i[n][t].add(r||ma(e,{forAs:!0}))))}for(const e of t.groupby??[])n.add(e);return n.size+D(i).length===0?null:new Sd(e,n,i)}merge(e){return x(this.dimensions,e.dimensions)?(function(e,t){for(const n of D(t)){const i=t[n];for(const t of D(i))n in e?e[n][t]=new Set([...e[n][t]??[],...i[t]]):e[n]={[t]:i[t]}}}(this.measures,e.measures),!0):(function(){wi.debug(...arguments)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...D(this.measures)])}producedFields(){const e=new Set;for(const t of D(this.measures))for(const n of D(this.measures[t])){const i=this.measures[t][n];0===i.size?e.add(`${n}_${t}`):i.forEach(e.add,e)}return e}hash(){return`Aggregate ${d({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of D(this.measures))for(const r of D(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:M(i));return{type:"aggregate",groupby:[...this.dimensions].map(M),ops:e,fields:t,as:n}}}class Dd extends $c{constructor(e,n,i,r){super(e),this.model=n,this.name=i,this.data=r;for(const e of Be){const i=n.facet[e];if(i){const{bin:r,sort:o}=i;this[e]={name:n.getName(`${e}_domain`),fields:[ma(i),...mn(r)?[ma(i,{binSuffix:"end"})]:[]],...Lo(o)?{sortField:o}:t.isArray(o)?{sortIndexField:Ff(i,e)}:{}}}}this.childModel=n.child}hash(){let e="Facet";for(const t of Be)this[t]&&(e+=` ${t.charAt(0)}:${d(this[t])}`);return e}get fields(){const e=[];for(const t of Be)this[t]?.fields&&e.push(...this[t].fields);return e}dependentFields(){const e=new Set(this.fields);for(const t of Be)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const e={};for(const t of Ct){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(kr(i)&&kn(r)){const n=ym(vm(this.childModel,t));n?e[t]=n:Si(Xn(t))}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x",facet:void 0}[e],r=[],o=[],a=[];i&&n&&n[i]&&(t?(r.push(`distinct_${n[i]}`),o.push("max")):(r.push(n[i]),o.push("distinct")),a.push(`distinct_${n[i]}`));const{sortField:s,sortIndexField:l}=this[e];if(s){const{op:e=Eo,field:t}=s;r.push(t),o.push(e),a.push(ma(s,{forAs:!0}))}else l&&(r.push(l),o.push("max"),a.push(l));return{name:this[e].name,source:t??this.data,transform:[{type:"aggregate",groupby:this[e].fields,...r.length?{fields:r,ops:o,as:a}:{}}]}}assembleFacetHeaderData(e){const{columns:t}=this.model.layout,{layoutHeaders:n}=this.model.component,i=[],r={};for(const e of _f){for(const t of Pf){const i=(n[e]&&n[e][t])??[];for(const t of i)if(t.axes?.length>0){r[e]=!0;break}}if(r[e]){const n=`length(data("${this.facet.name}"))`,r="row"===e?t?{signal:`ceil(${n} / ${t})`}:1:t?{signal:`min(${n}, ${t})`}:{signal:n};i.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:r}]})}}const{row:o,column:a}=r;return(o||a)&&i.unshift(this.assembleRowColumnHeaderData("facet",null,e)),i}assemble(){const e=[];let t=null;const n=this.getChildIndependentFieldsWithStep(),{column:i,row:r,facet:o}=this;if(i&&r&&(n.x||n.y)){t=`cross_${this.column.name}_${this.row.name}`;const i=[].concat(n.x??[],n.y??[]),r=i.map((()=>"distinct"));e.push({name:t,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:i,ops:r}]})}for(const i of[Z,K])this[i]&&e.push(this.assembleRowColumnHeaderData(i,t,n));if(o){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function Fd(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function Od(e){const n={};return a(e.filter,(e=>{if(er(e)){let i=null;Gi(e)?i=Cn(e.equal):Xi(e)?i=Cn(e.lte):Yi(e)?i=Cn(e.lt):Qi(e)?i=Cn(e.gt):Ji(e)?i=Cn(e.gte):Ki(e)?i=e.range[0]:Zi(e)&&(i=(e.oneOf??e.in)[0]),i&&(Di(i)?n[e.field]="date":t.isNumber(i)?n[e.field]="number":t.isString(i)&&(n[e.field]="string")),e.timeUnit&&(n[e.field]="date")}})),n}function zd(e){const n={};function i(e){var i;Ca(e)?n[e.field]="date":"quantitative"===e.type&&(i=e.aggregate,t.isString(i)&&p(["min","max"],i))?n[e.field]="number":q(e.field)>1?e.field in n||(n[e.field]="flatten"):la(e)&&Lo(e.sort)&&q(e.sort.field)>1&&(e.sort.field in n||(n[e.sort.field]="flatten"))}if((qm(e)||Um(e))&&e.forEachFieldDef(((t,n)=>{if(aa(t))i(t);else{const r=rt(n),o=e.fieldDef(r);i({...t,type:o.type})}})),qm(e)){const{mark:t,markDef:i,encoding:r}=e;if(Zr(t)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];Zo(e)&&"quantitative"===e.type&&!(e.field in n)&&(n[e.field]="number")}}return n}class Cd extends $c{clone(){return new Cd(null,l(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${d(this._parse)}`}static makeExplicit(e,t,n){let i={};const r=t.data;return!gc(r)&&r?.format?.parse&&(i=r.format.parse),this.makeWithAncestors(e,i,{},n)}static makeWithAncestors(e,t,n,i){for(const e of D(n)){const t=i.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:Si(ni(e,n[e],t.value)))}for(const e of D(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:Si(ni(e,t[e],n)))}const r=new oc(t,n);i.copyAll(r);const o={};for(const e of D(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===D(o).length||i.parseNothing?null:new Cd(e,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of D(this._parse)){const n=this._parse[t];1===q(t)&&(e[t]=n)}return e}producedFields(){return new Set(D(this._parse))}dependentFields(){return new Set(D(this._parse))}assembleTransforms(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return D(this._parse).filter((t=>!e||q(t)>1)).map((e=>{const t=function(e,t){const n=A(e);if("number"===t)return`toNumber(${n})`;if("boolean"===t)return`toBoolean(${n})`;if("string"===t)return`toString(${n})`;if("date"===t)return`toDate(${n})`;if("flatten"===t)return n;if(t.startsWith("date:"))return`timeParse(${n},'${Fd(t.slice(5,t.length))}')`;if(t.startsWith("utc:"))return`utcParse(${n},'${Fd(t.slice(4,t.length))}')`;return Si(`Unrecognized parse "${t}".`),null}(e,this._parse[e]);if(!t)return null;return{type:"formula",expr:t,as:L(e)}})).filter((e=>null!==e))}}class _d extends $c{clone(){return new _d(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([zs])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:zs}}}class Pd extends $c{clone(){return new Pd(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${d(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class Nd extends $c{clone(){return new Nd(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${d(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class Ad extends $c{constructor(e){let t;if(super(null),e??={name:"source"},gc(e)||(t=e.format?{...f(e.format,["parse"])}:{}),mc(e))this._data={values:e.values};else if(dc(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];p(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else yc(e)?this._data={values:[{type:"Sphere"}]}:(pc(e)||gc(e))&&(this._data={});this._generator=gc(e),e.name&&(this._name=e.name),t&&!S(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}function Td(e){return e instanceof Ad||e instanceof Pd||e instanceof Nd}class jd{#e;constructor(){this.#e=!1}setModified(){this.#e=!0}get modifiedFlag(){return this.#e}}class Ed extends jd{getNodeDepths(e,t,n){n.set(e,t);for(const i of e.children)this.getNodeDepths(i,t+1,n);return n}optimize(e){const t=[...this.getNodeDepths(e,0,new Map).entries()].sort(((e,t)=>t[1]-e[1]));for(const e of t)this.run(e[0]);return this.modifiedFlag}}class Md extends jd{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class Rd extends Md{mergeNodes(e,t){const n=t.shift();for(const i of t)e.removeChild(i),i.parent=n,i.remove()}run(e){const t=e.children.map((e=>e.hash())),n={};for(let i=0;i1&&(this.setModified(),this.mergeNodes(e,n[t]))}}class Ld extends Md{constructor(e){super(),this.requiresSelectionId=e&&rf(e)}run(e){e instanceof _d&&(this.requiresSelectionId&&(Td(e.parent)||e.parent instanceof Sd||e.parent instanceof Cd)||(this.setModified(),e.remove()))}}class qd extends jd{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof Dc&&(n=e.producedFields(),$(n,t)&&(this.setModified(),e.removeFormulas(t),0===e.producedFields.length&&e.remove()));for(const i of e.children)this.run(i,new Set([...t,...n]))}}class Ud extends Md{constructor(){super()}run(e){e instanceof wc&&!e.isRequired()&&(this.setModified(),e.remove())}}class Wd extends Ed{run(e){if(!(Td(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof Cd)if(e instanceof Cd)this.setModified(),e.merge(t);else{if(k(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class Id extends Ed{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof Cd));if(e.numChildren()>1&&n.length>=1){const i={},r=new Set;for(const e of n){const t=e.parse;for(const e of D(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!S(i)){this.setModified();const n=new Cd(e,i);for(const r of t){if(r instanceof Cd)for(const e of D(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof Cd&&0===D(r.parse).length&&r.remove()}}}}}class Bd extends Ed{run(e){e instanceof wc||e.numChildren()>0||e instanceof Dd||e instanceof Ad||(this.setModified(),e.remove())}}class Vd extends Ed{run(e){const t=e.children.filter((e=>e instanceof Dc)),n=t.pop();for(const e of t)this.setModified(),n.merge(e)}}class Hd extends Ed{run(e){const t=e.children.filter((e=>e instanceof Sd)),n={};for(const e of t){const t=d(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(const t of D(n)){const i=n[t];if(i.length>1){const t=i.pop();for(const n of i)t.merge(n)&&(e.removeChild(n),n.parent=t,n.remove(),this.setModified())}}}}class Gd extends Ed{constructor(e){super(),this.model=e}run(e){const t=!(Td(e)||e instanceof uf||e instanceof Cd||e instanceof _d),n=[],i=[];for(const r of e.children)r instanceof wd&&(t&&!k(e.producedFields(),r.dependentFields())?n.push(r):i.push(r));if(n.length>0){const t=n.pop();for(const e of n)t.merge(e,this.model.renameSignal.bind(this.model));this.setModified(),e instanceof wd?e.merge(t,this.model.renameSignal.bind(this.model)):t.swapWithParent()}if(i.length>1){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setModified()}}}class Yd extends Ed{run(e){const t=[...e.children];if(!g(t,(e=>e instanceof wc))||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof wc){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof wc))break;t=e}n.push(...t.children),i?(e.removeChild(r),r.parent=i.parent,i.parent.removeChild(i),i.parent=t,this.setModified()):i=t}else n.push(r);if(n.length){this.setModified();for(const e of n)e.parent.removeChild(e),e.parent=i}}}class Xd extends $c{clone(){return new Xd(null,l(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=b(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){return e.as??ma(e)}hash(){return`JoinAggregateTransform ${d(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const i of this.transform.joinaggregate)t.push(i.op),n.push(this.getDefaultName(i)),e.push(void 0===i.field?null:i.field);const i=this.transform.groupby;return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==i?{groupby:i}:{}}}}class Qd extends $c{clone(){return new Qd(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(e,t,n){const{config:i,markDef:r}=t,{marks:o,scales:a}=n;if("include-invalid-values"===o&&"include-invalid-values"===a)return null;const s=t.reduceFieldDef(((e,n,o)=>{const a=Qt(o)&&t.getScaleComponent(o);if(a){const t=a.get("type"),{aggregate:s}=n,l=go({scaleChannel:o,markDef:r,config:i,scaleType:t,isCountAggregate:cn(s)});"show"!==l&&"always-valid"!==l&&(e[n.field]=n)}return e}),{});return D(s).length?new Qd(e,s):null}dependentFields(){return new Set(D(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${d(this.filter)}`}assemble(){const e=D(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=ma(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (${Jd(i)}))`):"quantitative"===n.type&&e.push(Jd(i))),e}),[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}function Jd(e){return`isValid(${e}) && isFinite(+${e})`}class Kd extends $c{clone(){return new Kd(null,l(this._stack))}constructor(e,t){super(e),this._stack=t}static makeFromTransform(e,n){const{stack:i,groupby:r,as:o,offset:a="zero"}=n,s=[],l=[];if(void 0!==n.sort)for(const e of n.sort)s.push(e.field),l.push(U(e.order,"ascending"));const c={field:s,order:l};let u;return u=function(e){return t.isArray(e)&&e.every((e=>t.isString(e)))&&e.length>1}(o)?o:t.isString(o)?[o,`${o}_end`]:[`${n.stack}_start`,`${n.stack}_end`],new Kd(e,{dimensionFieldDefs:[],stackField:i,groupby:r,offset:a,sort:c,facetby:[],as:u})}static makeFromEncoding(e,n){const i=n.stack,{encoding:r}=n;if(!i)return null;const{groupbyChannels:o,fieldChannel:a,offset:s,impute:l}=i,c=o.map((e=>wa(r[e]))).filter((e=>!!e)),u=function(e){return e.stack.stackBy.reduce(((e,t)=>{const n=ma(t.fieldDef);return n&&e.push(n),e}),[])}(n),f=n.encoding.order;let d;if(t.isArray(f)||Zo(f))d=qn(f);else{const e=Xo(f)?f.sort:"y"===a?"descending":"ascending";d=u.reduce(((t,n)=>(t.field.includes(n)||(t.field.push(n),t.order.push(e)),t)),{field:[],order:[]})}return new Kd(e,{dimensionFieldDefs:c,stackField:n.vgField(a),facetby:[],stackby:u,sort:d,offset:s,impute:l,as:[n.vgField(a,{suffix:"start",forAs:!0}),n.vgField(a,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){const e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${d(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map((e=>e.bin?t?[ma(e,{binSuffix:"mid"})]:[ma(e,{}),ma(e,{binSuffix:"end"})]:[ma(e)])).flat():n??[]}assemble(){const e=[],{facetby:t,dimensionFieldDefs:n,stackField:i,stackby:r,sort:o,offset:a,impute:s,as:l}=this._stack;if(s)for(const o of n){const{bandPosition:n=.5,bin:a}=o;if(a){const t=ma(o,{expr:"datum"}),i=ma(o,{expr:"datum",binSuffix:"end"});e.push({type:"formula",expr:`${Jd(t)} ? ${n}*${t}+${1-n}*${i} : ${t}`,as:ma(o,{binSuffix:"mid",forAs:!0})})}e.push({type:"impute",field:i,groupby:[...r,...t],key:ma(o,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:l,offset:a}),e}}class Zd extends $c{clone(){return new Zd(null,l(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=b(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return(this.transform.groupby??[]).forEach(e.add,e),(this.transform.sort??[]).forEach((t=>e.add(t.field))),this.transform.window.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){return e.as??ma(e)}hash(){return`WindowTransform ${d(this.transform)}`}assemble(){const e=[],t=[],n=[],i=[];for(const r of this.transform.window)t.push(r.op),n.push(this.getDefaultName(r)),i.push(void 0===r.param?null:r.param),e.push(void 0===r.field?null:r.field);const r=this.transform.frame,o=this.transform.groupby;if(r&&null===r[0]&&null===r[1]&&t.every((e=>sn(e))))return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==o?{groupby:o}:{}};const a=[],s=[];if(void 0!==this.transform.sort)for(const e of this.transform.sort)a.push(e.field),s.push(e.order??"ascending");const l={field:a,order:s},c=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:l,...void 0!==c?{ignorePeers:c}:{},...void 0!==o?{groupby:o}:{},...void 0!==r?{frame:r}:{}}}}function em(e){if(e instanceof Dd)if(1!==e.numChildren()||e.children[0]instanceof wc){const n=e.model.component.data.main;tm(n);const i=(t=e,function e(n){if(!(n instanceof Dd)){const i=n.clone();if(i instanceof wc){const e=nm+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof Sd||i instanceof Kd||i instanceof Zd||i instanceof Xd)&&i.addDimensions(t.fields);for(const t of n.children.flatMap(e))t.parent=i;return[i]}return n.children.flatMap(e)}),r=e.children.map(i).flat();for(const e of r)e.parent=n}else{const t=e.children[0];(t instanceof Sd||t instanceof Kd||t instanceof Zd||t instanceof Xd)&&t.addDimensions(e.fields),t.swapWithParent(),em(e)}else e.children.map(em);var t}function tm(e){if(e instanceof wc&&e.type===bc.Main&&1===e.numChildren()){const t=e.children[0];t instanceof Dd||(t.swapWithParent(),tm(e))}}const nm="scale_",im=5;function rm(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!rm(t.children))return!1}return!0}function om(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function am(e,t,n){let i=e.sources,r=!1;return r=om(new Ud,i)||r,r=om(new Ld(t),i)||r,i=i.filter((e=>e.numChildren()>0)),r=om(new Bd,i)||r,i=i.filter((e=>e.numChildren()>0)),n||(r=om(new Wd,i)||r,r=om(new Gd(t),i)||r,r=om(new qd,i)||r,r=om(new Id,i)||r,r=om(new Hd,i)||r,r=om(new Vd,i)||r,r=om(new Rd,i)||r,r=om(new Yd,i)||r),e.sources=i,r}class sm{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new sm((()=>e(t)))}}function lm(e){qm(e)?function(e){const t=e.component.scales;for(const n of D(t)){const i=cm(e,n);if(t[n].setWithExplicit("domains",i),mm(e,n),e.component.data.isFaceted){let t=e;for(;!Um(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)Sn(e)&&(e.data=nm+e.data.replace(nm,""))}}}(e):function(e){for(const t of e.children)lm(t);const t=e.component.scales;for(const n of D(t)){let i,r=null;for(const t of e.children){const e=t.component.scales[n];if(e){i=void 0===i?e.getWithExplicit("domains"):uc(i,e.getWithExplicit("domains"),"domains","scale",gm);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&Si(Zn),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function cm(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=pm(t,n);if(!e)return void Si(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=pm(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:r}),"x"===t&&ka(i.x2)?ka(i.x)?uc(fm(n,r,e,"x"),fm(n,r,e,"x2"),"domain","scale",gm):fm(n,r,e,"x2"):"y"===t&&ka(i.y2)?ka(i.y)?uc(fm(n,r,e,"y"),fm(n,r,e,"y2"),"domain","scale",gm):fm(n,r,e,"y2"):fm(n,r,e,t)}function um(e,t,n){const i=Ii(n)?.unit;return"temporal"===t||i?function(e,t,n){return e.map((e=>({signal:`{data: ${_a(e,{timeUnit:n,type:t})}}`})))}(e,t,i):[e]}function fm(e,n,i,r){const{encoding:o,markDef:a,mark:s,config:l,stack:c}=i,u=ka(o[r]),{type:f}=u,d=u.timeUnit,m=function(e){const{marks:t,scales:n}=xc(e);return t===n?bc.Main:"include-invalid-values"===n?bc.PreFilterInvalid:bc.PostFilterInvalid}({invalid:Mn("invalid",a,l),isPath:Zr(s)});if(function(e){return J(e,"unionWith")}(n)){const t=fm(e,void 0,i,r);return ac([...um(n.unionWith,f,d),...t.value])}if(wn(n))return ac([n]);if(n&&"unaggregated"!==n&&!Or(n))return ac(um(n,f,d));if(c&&r===c.fieldChannel){if("normalize"===c.offset)return sc([[0,1]]);const e=i.requestDataName(m);return sc([{data:e,field:i.vgField(r,{suffix:"start"})},{data:e,field:i.vgField(r,{suffix:"end"})}])}const g=Qt(r)&&Zo(u)?function(e,t,n){if(!kr(n))return;const i=e.fieldDef(t),r=i.sort;if(qo(r))return{op:"min",field:Ff(i,t),order:"ascending"};const{stack:o}=e,a=o?new Set([...o.groupbyFields,...o.stackBy.map((e=>e.fieldDef.field))]):void 0;if(Lo(r)){return dm(r,o&&!a.has(r.field))}if(function(e){return J(e,"encoding")}(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:l}=i,c=o&&!a.has(l);if(on(s)||an(s))return dm({field:ma(i),order:n},c);if(sn(s)||!s)return dm({op:s,field:l,order:n},c)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(p(["ascending",void 0],r))return!0}return}(i,r,e):void 0;if(ta(u)){return sc(um([u.datum],f,d))}const h=u;if("unaggregated"===n){const{field:e}=u;return sc([{data:i.requestDataName(m),field:ma({field:e,aggregate:"min"})},{data:i.requestDataName(m),field:ma({field:e,aggregate:"max"})}])}if(mn(h.bin)){if(kr(e))return sc("bin-ordinal"===e?[]:[{data:z(g)?i.requestDataName(m):i.requestDataName(bc.Raw),field:i.vgField(r,Na(h,r)?{binSuffix:"range"}:{}),sort:!0!==g&&t.isObject(g)?g:{field:i.vgField(r,{}),op:"min"}}]);{const{bin:e}=h;if(mn(e)){const t=xd(i,h.field,e);return sc([new sm((()=>{const e=i.getSignalName(t);return`[${e}.start, ${e}.stop]`}))])}return sc([{data:i.requestDataName(m),field:i.vgField(r,{})}])}}if(h.timeUnit&&p(["time","utc"],e)){const e=o[at(r)];if(Yo(h,e,a,l)){const t=i.requestDataName(m),n=Ho({fieldDef:h,fieldDef2:e,markDef:a,config:l}),o=eo(s)&&.5!==n&&_t(r);return sc([{data:t,field:i.vgField(r,o?{suffix:Fc}:{})},{data:t,field:i.vgField(r,{suffix:o?Oc:"end"})}])}}return sc(g?[{data:z(g)?i.requestDataName(m):i.requestDataName(bc.Raw),field:i.vgField(r),sort:g}]:[{data:i.requestDataName(m),field:i.vgField(r)}])}function dm(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":Eo),...i?{field:M(i)}:{},...r?{order:r}:{}}}function mm(e,t){const n=e.component.scales[t],i=e.specifiedScales[t].domain,r=e.fieldDef(t)?.bin,o=Or(i)?i:void 0,a=gn(r)&&hn(r.extent)?r.extent:void 0;(o||a)&&n.set("selectionExtent",o??a,!0)}function pm(e,n){const{aggregate:i,type:r}=e;return i?t.isString(i)&&!fn.has(i)?{valid:!1,reason:mi(i)}:"quantitative"===r&&"log"===n?{valid:!1,reason:pi(e)}:{valid:!0}:{valid:!1,reason:di(e)}}function gm(e,t,n,i){return e.explicit&&t.explicit&&Si(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${Q(n)} and ${Q(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function hm(e){const n=b(e.map((e=>{if(Sn(e)){const{sort:t,...n}=e;return n}return e})),d),i=b(e.map((e=>{if(Sn(e)){const t=e.sort;return void 0===t||z(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}})).filter((e=>void 0!==e)),d);if(0===n.length)return;if(1===n.length){const n=e[0];if(Sn(n)&&i.length>0){let e=i[0];if(i.length>1){Si(yi);const n=i.filter((e=>t.isObject(e)&&"op"in e&&"min"!==e.op));e=!i.every((e=>t.isObject(e)&&"op"in e))||1!==n.length||n[0]}else if(t.isObject(e)&&"field"in e){const t=e.field;n.field===t&&(e=!e.order||{order:e.order})}return{...n,sort:e}}return n}const r=b(i.map((e=>z(e)||!("op"in e)||t.isString(e.op)&&t.hasOwnProperty(rn,e.op)?e:(Si(function(e){return`Dropping sort property ${Q(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0))),d);let o;1===r.length?o=r[0]:r.length>1&&(Si(yi),o=!0);const a=b(e.map((e=>Sn(e)?e.data:null)),(e=>e));if(1===a.length&&null!==a[0]){return{data:a[0],fields:n.map((e=>e.field)),...o?{sort:o}:{}}}return{fields:n,...o?{sort:o}:{}}}function ym(e){if(Sn(e)&&t.isString(e.field))return e.field;if(function(e){return!t.isArray(e)&&J(e,"fields")&&!J(e,"data")}(e)){let n;for(const i of e.fields)if(Sn(i)&&t.isString(i.field))if(n){if(n!==i.field)return Si("Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."),n}else n=i.field;return Si("Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."),n}if(function(e){return!t.isArray(e)&&J(e,"fields")&&J(e,"data")}(e)){Si("Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.");const n=e.fields[0];return t.isString(n)?n:void 0}}function vm(e,t){const n=e.component.scales[t].get("domains").map((t=>(Sn(t)&&(t.data=e.lookupDataSource(t.data)),t)));return hm(n)}function bm(e){return Im(e)||Wm(e)?e.children.reduce(((e,t)=>e.concat(bm(t))),xm(e)):xm(e)}function xm(e){return D(e.component.scales).reduce(((n,i)=>{const r=e.component.scales[i];if(r.merged)return n;const o=r.combine(),{name:a,type:s,selectionExtent:l,domains:c,range:u,reverse:f,...d}=o,m=function(e,n,i,r){if(_t(i)){if(kn(e))return{step:{signal:`${n}_step`}}}else if(t.isObject(e)&&Sn(e))return{...e,data:r.lookupDataSource(e.data)};return e}(o.range,a,i,e),p=vm(e,i),g=l?function(e,n,i,r){const o=df(e,n.param,n);return{signal:Sr(i.get("type"))&&t.isArray(r)&&r[0]>r[1]?`isValid(${o}) && reverse(${o})`:o}}(e,l,r,p):null;return n.push({name:a,type:s,...p?{domain:p}:{},...g?{domainRaw:g}:{},range:m,...void 0!==f?{reverse:f}:{},...d}),n}),[])}class $m extends oc{merged=!1;constructor(e,t){super({},{name:e}),this.setWithExplicit("type",t)}domainHasZero(){const e=this.get("type");if(p([dr.LOG,dr.TIME,dr.UTC],e))return"definitely-not";const n=this.get("zero");if(!0===n||void 0===n&&p([dr.LINEAR,dr.SQRT,dr.POW],e))return"definitely";const i=this.get("domains");if(i.length>0){let e=!1,n=!1,r=!1;for(const o of i){if(t.isArray(o)){const i=o[0],r=o[o.length-1];if(t.isNumber(i)&&t.isNumber(r)){if(i<=0&&r>=0){e=!0;continue}n=!0;continue}}r=!0}if(e)return"definitely";if(n&&!r)return"definitely-not"}return"maybe"}}const wm=["range","scheme"];function km(e,n){const i=e.fieldDef(n);if(i?.bin){const{bin:r,field:o}=i,a=st(n),s=e.getName(a);if(t.isObject(r)&&r.binned&&void 0!==r.step)return new sm((()=>{const t=e.scaleName(n),i=`(domain("${t}")[1] - domain("${t}")[0]) / ${r.step}`;return`${e.getSignalName(s)} / (${i})`}));if(mn(r)){const t=xd(e,o,r);return new sm((()=>{const n=e.getSignalName(t),i=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(s)} / (${i})`}))}}}function Sm(e,n){const i=n.specifiedScales[e],{size:r}=n,o=n.getScaleComponent(e).get("type");for(const r of wm)if(void 0!==i[r]){const a=Er(o,r),s=Mr(e,r);if(a)if(s)Si(s);else switch(r){case"range":{const r=i.range;if(t.isArray(r)){if(_t(e))return ac(r.map((e=>{if("width"===e||"height"===e){const t=n.getName(e),i=n.getSignalName.bind(n);return sm.fromName(i,t)}return e})))}else if(t.isObject(r))return ac({data:n.requestDataName(bc.Main),field:r.field,sort:{op:"min",field:n.vgField(e)}});return ac(r)}case"scheme":return ac(Dm(i[r]))}else Si(gi(o,r,e))}const a=e===te||"xOffset"===e?"width":"height",s=r[a];if(Rs(s))if(_t(e))if(kr(o)){const t=Om(s,n,e);if(t)return ac({step:t})}else Si(hi(a));else if(jt(e)){const t=e===oe?"x":"y";if("band"===n.getScaleComponent(t).get("type")){const e=zm(s,o);if(e)return ac(e)}}const{rangeMin:l,rangeMax:u}=i,f=function(e,n){const{size:i,config:r,mark:o,encoding:a}=n,{type:s}=ka(a[e]),l=n.getScaleComponent(e),u=l.get("type"),{domain:f,domainMid:d}=n.specifiedScales[e];switch(e){case te:case ne:if(p(["point","band"],u)){const t=Cm(e,i,r.view);if(Rs(t)){return{step:Om(t,n,e)}}}return Fm(e,n,u);case oe:case ae:return function(e,t,n){const i=e===oe?"x":"y",r=t.getScaleComponent(i);if(!r)return Fm(i,t,n,{center:!0});const o=r.get("type"),a=t.scaleName(i),{markDef:s,config:l}=t;if("band"===o){const e=Cm(i,t.size,t.config.view);if(Rs(e)){const t=zm(e,n);if(t)return t}return[0,{signal:`bandwidth('${a}')`}]}{const n=t.encoding[i];if(Zo(n)&&n.timeUnit){const e=Bi(n.timeUnit,(e=>`scale('${a}', ${e})`)),i=t.config.scale.bandWithNestedOffsetPaddingInner,r=Ho({fieldDef:n,markDef:s,config:l})-.5,o=0!==r?` + ${r}`:"";if(i){return[{signal:`${wn(i)?`${i.signal}/2`+o:`${i/2+r}`} * (${e})`},{signal:`${wn(i)?`(1 - ${i.signal}/2)`+o:`${1-i/2+r}`} * (${e})`}]}return[0,{signal:e}]}return c(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}(e,n,u);case xe:{const a=function(e,t){switch(e){case"bar":case"tick":return t.scale.minBandSize;case"line":case"trail":case"rule":return t.scale.minStrokeWidth;case"text":return t.scale.minFontSize;case"point":case"square":case"circle":return t.scale.minSize}throw new Error(li("size",e))}(o,r),s=function(e,n,i,r){const o={x:km(i,"x"),y:km(i,"y")};switch(e){case"bar":case"tick":{if(void 0!==r.scale.maxBandSize)return r.scale.maxBandSize;const e=Pm(n,o,r.view);return t.isNumber(e)?e-1:new sm((()=>`${e.signal} - 1`))}case"line":case"trail":case"rule":return r.scale.maxStrokeWidth;case"text":return r.scale.maxFontSize;case"point":case"square":case"circle":{if(r.scale.maxSize)return r.scale.maxSize;const e=Pm(n,o,r.view);return t.isNumber(e)?Math.pow(_m*e,2):new sm((()=>`pow(${_m} * ${e.signal}, 2)`))}}throw new Error(li("size",e))}(o,i,n,r);return Fr(u)?function(e,t,n){const i=()=>{const i=An(t),r=An(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return wn(t)?new sm(i):{signal:i()}}(a,s,function(e,n,i,r){switch(e){case"quantile":return n.scale.quantileCount;case"quantize":return n.scale.quantizeCount;case"threshold":return void 0!==i&&t.isArray(i)?i.length+1:(Si(function(e){return`Domain for ${e} is required for threshold scale.`}(r)),3)}}(u,r,f,e)):[a,s]}case ce:return[0,2*Math.PI];case $e:return[0,360];case se:return[0,new sm((()=>`min(${n.getSignalName(Um(n.parent)?"child_width":"width")},${n.getSignalName(Um(n.parent)?"child_height":"height")})/2`))];case ge:return{step:1e3/r.scale.framesPerSecond};case De:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case Fe:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case be:return"symbol";case he:case ye:case ve:return"ordinal"===u?"nominal"===s?"category":"ordinal":void 0!==d?"diverging":"rect"===o||"geoshape"===o?"heatmap":"ramp";case we:case ke:case Se:return[r.scale.minOpacity,r.scale.maxOpacity]}}(e,n);return(void 0!==l||void 0!==u)&&Er(o,"rangeMin")&&t.isArray(f)&&2===f.length?ac([l??f[0],u??f[1]]):sc(f)}function Dm(e){return function(e){return!t.isString(e)&&J(e,"name")}(e)?{scheme:e.name,...f(e,["name"])}:{scheme:e}}function Fm(e,t,n){let{center:i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=st(e),o=t.getName(r),a=t.getSignalName.bind(t);return e===ne&&Sr(n)?i?[sm.fromName((e=>`${a(e)}/2`),o),sm.fromName((e=>`-${a(e)}/2`),o)]:[sm.fromName(a,o),0]:i?[sm.fromName((e=>`-${a(e)}/2`),o),sm.fromName((e=>`${a(e)}/2`),o)]:[0,sm.fromName(a,o)]}function Om(e,n,i){const{encoding:r}=n,o=n.getScaleComponent(i),a=ct(i),s=r[a];if("offset"===Ms({step:e,offsetIsDiscrete:oa(s)&&ar(s.type)})&&Ba(r,a)){const i=n.getScaleComponent(a);let r=`domain('${n.scaleName(a)}').length`;if("band"===i.get("type")){r=`bandspace(${r}, ${i.get("paddingInner")??i.get("padding")??0}, ${i.get("paddingOuter")??i.get("padding")??0})`}const s=o.get("paddingInner")??o.get("padding");return{signal:`${e.step} * ${r} / (1-${l=s,wn(l)?l.signal:t.stringValue(l)})`}}return e.step;var l}function zm(e,t){if("offset"===Ms({step:e,offsetIsDiscrete:kr(t)}))return{step:e.step}}function Cm(e,t,n){const i=e===te?"width":"height",r=t[i];return r||Is(n,i)}const _m=.95;function Pm(e,t,n){const i=Rs(e.width)?e.width.step:Ws(n,"width"),r=Rs(e.height)?e.height.step:Ws(n,"height");return t.x||t.y?new sm((()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`)):Math.min(i,r)}function Nm(e,t){qm(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:a}=e;for(const s of D(n)){const l=a[s],c=n[s],u=e.getScaleComponent(s),f=ka(r[s]),d=l[t],m=u.get("type"),p=u.get("padding"),g=u.get("paddingInner"),h=Er(m,t),y=Mr(s,t);if(void 0!==d&&(h?y&&Si(y):Si(gi(m,t,s))),h&&void 0===y)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":Di(l[t])||"temporal"===n||e?c.set(t,{signal:_a(l[t],{type:n,timeUnit:e})},!0):c.set(t,l[t],!0);break;default:c.copyKeyFromObject(t,l)}}else{const n=J(Am,t)?Am[t]({model:e,channel:s,fieldOrDatumDef:f,scaleType:m,scalePadding:p,scalePaddingInner:g,domain:l.domain,domainMin:l.domainMin,domainMax:l.domainMax,markDef:o,config:i,hasNestedOffsetScale:Va(r,s),hasSecondaryRangeChannel:!!r[at(s)]}):i.scale[t];void 0!==n&&c.set(t,n,!1)}}}(e,t):jm(e,t)}const Am={bins:e=>{let{model:t,fieldOrDatumDef:n}=e;return Zo(n)?function(e,t){const n=t.bin;if(mn(n)){const i=xd(e,t.field,n);return new sm((()=>e.getSignalName(i)))}if(pn(n)&&gn(n)&&void 0!==n.step)return{step:n.step};return}(t,n):void 0},interpolate:e=>{let{channel:t,fieldOrDatumDef:n}=e;return function(e,t){if(p([he,ye,ve],e)&&"nominal"!==t)return"hcl";return}(t,n.type)},nice:e=>{let{scaleType:n,channel:i,domain:r,domainMin:o,domainMax:a,fieldOrDatumDef:s}=e;return function(e,n,i,r,o,a){if(wa(a)?.bin||t.isArray(i)||null!=o||null!=r||p([dr.TIME,dr.UTC],e))return;return!!_t(n)||void 0}(n,i,r,o,a,s)},padding:e=>{let{channel:t,scaleType:n,fieldOrDatumDef:i,markDef:r,config:o}=e;return function(e,t,n,i,r,o){if(_t(e)){if(Dr(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=r;if("bar"===t&&(!Zo(i)||!i.bin&&!i.timeUnit)&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===dr.POINT)return n.pointPadding}return}(t,n,o.scale,i,r,o.bar)},paddingInner:e=>{let{scalePadding:t,channel:n,markDef:i,scaleType:r,config:o,hasNestedOffsetScale:a}=e;return function(e,t,n,i,r){let o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(void 0!==e)return;if(_t(t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i,tickBandPaddingInner:a,bandWithNestedOffsetPaddingInner:s}=r;return o?s:U(e,"bar"===n?t:"tick"===n?a:i)}if(jt(t)&&i===dr.BAND)return r.offsetBandPaddingInner;return}(t,n,i.type,r,o.scale,a)},paddingOuter:e=>{let{scalePadding:t,channel:n,scaleType:i,scalePaddingInner:r,config:o,hasNestedOffsetScale:a}=e;return function(e,t,n,i,r){let o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(void 0!==e)return;if(_t(t)){const{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=r;if(o)return t;if(n===dr.BAND)return U(e,wn(i)?{signal:`${i.signal}/2`}:i/2)}else if(jt(t)){if(n===dr.POINT)return.5;if(n===dr.BAND)return r.offsetBandPaddingOuter}return}(t,n,i,r,o.scale,a)},reverse:e=>{let{fieldOrDatumDef:t,scaleType:n,channel:i,config:r}=e;return function(e,t,n,i){if("x"===n&&void 0!==i.xReverse)return Sr(e)&&"descending"===t?wn(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse;if(Sr(e)&&"descending"===t)return!0;return}(n,Zo(t)?t.sort:void 0,i,r.scale)},zero:e=>{let{channel:n,fieldOrDatumDef:i,domain:r,markDef:o,scaleType:a,config:s,hasSecondaryRangeChannel:l}=e;return function(e,n,i,r,o,a,s){if(i&&"unaggregated"!==i&&Sr(o)){if(t.isArray(i)){const e=i[0],n=i[i.length-1];if(t.isNumber(e)&&e<=0&&t.isNumber(n)&&n>=0)return!0}return!1}if("size"===e&&"quantitative"===n.type&&!Fr(o))return!0;if((!Zo(n)||!n.bin)&&p([...Ct,...Nt],e)){const{orient:t,type:n}=r;return(!p(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e))&&(!(!p(["bar","area"],n)||s)||a?.zero)}return!1}(n,i,r,o,a,s.scale,l)}};function Tm(e){qm(e)?function(e){const t=e.component.scales;for(const n of Xt){const i=t[n];if(!i)continue;const r=Sm(n,e);i.setWithExplicit("range",r)}}(e):jm(e,"range")}function jm(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?Tm(n):Nm(n,t);for(const i of D(n)){let r;for(const n of e.children){const e=n.component.scales[i];if(e){r=uc(r,e.getWithExplicit(t),t,"scale",lc(((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0)))}}n[i].setWithExplicit(t,r)}}function Em(e,t,n,i){const r=function(e,t,n,i){switch(t.type){case"nominal":case"ordinal":if(We(e)||"discrete"===tn(e))return"shape"===e&&"ordinal"===t.type&&Si(fi(e,"ordinal")),"ordinal";if(Mt(e))return"band";if(_t(e)||jt(e)){if(p(["rect","bar","image","rule","tick"],n.type))return"band";if(i)return"band"}else if("arc"===n.type&&e in Pt)return"band";return lo(n[st(e)])||ca(t)&&t.axis?.tickBand?"band":"point";case"temporal":return We(e)?"time":"discrete"===tn(e)?(Si(fi(e,"temporal")),"ordinal"):Zo(t)&&t.timeUnit&&Ii(t.timeUnit).utc?"utc":Mt(e)?"band":"time";case"quantitative":return We(e)?Zo(t)&&mn(t.bin)?"bin-ordinal":"linear":"discrete"===tn(e)?(Si(fi(e,"quantitative")),"ordinal"):Mt(e)?"band":"linear";case"geojson":return}throw new Error(oi(t.type))}(t,n,i,arguments.length>4&&void 0!==arguments[4]&&arguments[4]),{type:o}=e;return Qt(t)?void 0!==o?function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!Qt(e))return!1;switch(e){case te:case ne:case oe:case ae:case ce:case se:return!!Dr(t)||"band"===t||"point"===t&&!n;case ge:return p(["linear","band"],t);case xe:case De:case we:case ke:case Se:case $e:return Dr(t)||Fr(t)||p(["band","point","ordinal"],t);case he:case ye:case ve:return"band"!==t;case Fe:case be:return"ordinal"===t||Fr(t)}}(t,o)?Zo(n)&&(a=o,s=n.type,!(p([lr,ur],s)?void 0===a||kr(a):s===cr?p([dr.TIME,dr.UTC,void 0],a):s!==sr||br(a)||Fr(a)||void 0===a))?(Si(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(o,r)),r):o:(Si(function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}(t,o,r)),r):r:null;var a,s}function Mm(e){qm(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const o of Xt){const a=ka(t[o]);if(a&&n===Kr&&o===be&&a.type===fr)continue;let s=a&&a.scale;if(a&&null!==s&&!1!==s){s??={};const n=Em(s,o,a,i,Va(t,o));r[o]=new $m(e.scaleName(`${o}`,!0),{value:n,explicit:s.type===n})}}return r}(e):e.component.scales=function(e){const t=e.component.scales={},n={},i=e.component.resolve;for(const t of e.children){Mm(t);for(const r of D(t.component.scales))if(i.scale[r]??=Yf(r,e),"shared"===i.scale[r]){const e=n[r],o=t.component.scales[r].getWithExplicit("type");e?pr(e.value,o.value)?n[r]=uc(e,o,"type","scale",Rm):(i.scale[r]="independent",delete n[r]):n[r]=o}}for(const i of D(n)){const r=e.scaleName(i,!0),o=n[i];t[i]=new $m(r,o);for(const t of e.children){const e=t.component.scales[i];e&&(t.renameScale(e.get("name"),r),e.merged=!0)}}return t}(e)}const Rm=lc(((e,t)=>hr(e)-hr(t)));class Lm{constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return void 0!==this.nameMap[e]}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}}function qm(e){return"unit"===e?.type}function Um(e){return"facet"===e?.type}function Wm(e){return"concat"===e?.type}function Im(e){return"layer"===e?.type}class Bm{constructor(e,n,i,r,o,a,c){this.type=n,this.parent=i,this.config=o,this.parent=i,this.config=o,this.view=bn(c),this.name=e.name??r,this.title=$n(e.title)?{text:e.title}:e.title?bn(e.title):void 0,this.scaleNameMap=i?i.scaleNameMap:new Lm,this.projectionNameMap=i?i.projectionNameMap:new Lm,this.signalNameMap=i?i.signalNameMap:new Lm,this.data=e.data,this.description=e.description,this.transforms=(e.transform??[]).map((e=>Ol(e)?{filter:s(e.filter,rr)}:e)),this.layout="layer"===n||"unit"===n?{}:function(e,n,i){const r=i[n],o={},{spacing:a,columns:s}=r;void 0!==a&&(o.spacing=a),void 0!==s&&(Io(e)&&!Uo(e.facet)||Ts(e))&&(o.columns=s),js(e)&&(o.columns=1);for(const n of qs)if(void 0!==e[n])if("spacing"===n){const i=e[n];o[n]=t.isNumber(i)?i:{row:i.row??a,column:i.column??a}}else o[n]=e[n];return o}(e,n,o),this.component={data:{sources:i?i.component.data.sources:[],outputNodes:i?i.component.data.outputNodes:{},outputNodeRefCounts:i?i.component.data.outputNodeRefCounts:{},isFaceted:Io(e)||i?.component.data.isFaceted&&void 0===e.data},layoutSize:new oc,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...a?l(a):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){!function(e){let{ignoreRange:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Mm(e),lm(e);for(const t of jr)Nm(e,t);t||Tm(e)}(this)}parseProjection(){yd(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){sd(this)}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const e of D(n)){const t=n[e];void 0!==t&&(i[e]=Pn(t))}return i}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=Pn(this.description)),"unit"!==this.type&&"layer"!==this.type)?S(t)?void 0:t:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...t}}assembleLayout(){if(!this.layout)return;const{spacing:e,...t}=this.layout,{component:n,config:i}=this,r=function(e,t){const n={};for(const i of Be){const r=e[i];if(r?.facetFieldDef){const{titleAnchor:e,titleOrient:o}=Cf(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=Of(i,o),s=qf(e,a);void 0!==s&&(n[a]=s)}}return S(n)?void 0:n}(n.layoutHeaders,i);return{padding:e,...this.assembleDefaultLayout(),...t,...r?{titleBand:r}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of Be)e[n].title&&t.push(Nf(this,n));for(const e of _f)t=t.concat(jf(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map((e=>gf(e,"grid",t))),...i.map((e=>gf(e,"grid",t))),...n.map((e=>gf(e,"main",t))),...i.map((e=>gf(e,"main",t)))].filter((e=>e))}(this.component.axes,this.config)}assembleLegends(){return dd(this)}assembleProjections(){return md(this)}assembleTitle(){const{encoding:e,...t}=this.title??{},n={...xn(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return p(["unit","layer"],this.type)?p(["middle",void 0],n.anchor)&&(n.frame??="group"):n.anchor??="start",S(n)?void 0:n}assembleGroup(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t={};e=e.concat(this.assembleSignals()),e.length>0&&(t.signals=e);const n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||Um(this.parent)?bm(this):[];i.length>0&&(t.scales=i);const r=this.assembleAxes();r.length>0&&(t.axes=r);const o=this.assembleLegends();return o.length>0&&(t.legends=o),t}getName(e){return C((this.name?`${this.name}_`:"")+e)}getDataName(e){return this.getName(bc[e].toLowerCase())}requestDataName(e){const t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if(Um(this.parent)){const t=At(Hf(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(kr(e)&&kn(i)){const e=n.get("name"),i=ym(vm(this,t));if(i){return{signal:Vf(e,n,ma({aggregate:"distinct",field:i},{expr:"datum"}))}}return Si(Xn(t)),null}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){const t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){return t?this.getName(e):tt(e)&&Qt(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e))?this.scaleNameMap.get(this.getName(e)):void 0}projectionName(e){return e?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(e){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getScaleType(e){const t=this.getScaleComponent(e);return t?t.get("type"):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw new Error(function(e){return`Cannot find a selection named "${e}".`}(t));return n}hasAxisOrientSignalRef(){return this.component.axes.x?.some((e=>e.hasOrientSignalRef()))||this.component.axes.y?.some((e=>e.hasOrientSignalRef()))}}class Vm extends Bm{vgField(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.fieldDef(e);if(n)return ma(n,t)}reduceFieldDef(e,n){return function(e,n,i,r){return e?D(e).reduce(((i,o)=>{const a=e[o];return t.isArray(a)?a.reduce(((e,t)=>n.call(r,e,t,o)),i):n.call(r,i,a,o)}),i):i}(this.getMapping(),((t,n,i)=>{const r=wa(n);return r?e(t,r,i):t}),n)}forEachFieldDef(e,t){Qa(this.getMapping(),((t,n)=>{const i=wa(t);i&&e(i,n)}),t)}}class Hm extends $c{clone(){return new Hm(null,l(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=l(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"value",n[1]??"density"];const i=this.transform.resolve??"shared";this.transform.resolve=i}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${d(this.transform)}`}assemble(){const{density:e,...t}=this.transform,n={type:"kde",field:e,...t};return n.resolve=this.transform.resolve,n}}class Gm extends $c{clone(){return new Gm(null,l(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=l(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${d(this.transform)}`}assemble(){const{extent:e,param:t}=this.transform;return{type:"extent",field:e,signal:t}}}class Ym extends $c{clone(){return new Ym(this.parent,l(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=l(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map(((e,t)=>i[t]??e))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${d(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class Xm extends $c{clone(){return new Xm(null,l(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=l(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"key",n[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${d(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class Qm extends $c{clone(){return new Qm(null,l(this.fields),this.geojson,this.signal)}static parseAll(e,t){if(t.component.projection&&!t.component.projection.isFit)return e;let n=0;for(const i of[[de,fe],[pe,me]]){const r=i.map((e=>{const n=ka(t.encoding[e]);return Zo(n)?n.field:ta(n)?{expr:`${n.datum}`}:sa(n)?{expr:`${n.value}`}:void 0}));(r[0]||r[1])&&(e=new Qm(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(be)){const i=t.typedFieldDef(be);i.type===fr&&(e=new Qm(e,null,i.field,t.getName("geojson_"+n++)))}return e}constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}dependentFields(){const e=(this.fields??[]).filter(t.isString);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${d(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class Jm extends $c{clone(){return new Jm(null,this.projection,l(this.fields),l(this.as))}constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[[de,fe],[pe,me]]){const i=n.map((e=>{const n=ka(t.encoding[e]);return Zo(n)?n.field:ta(n)?{expr:`${n.datum}`}:sa(n)?{expr:`${n.value}`}:void 0})),r=n[0]===pe?"2":"";(i[0]||i[1])&&(e=new Jm(e,t.projectionName(),i,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return e}dependentFields(){return new Set(this.fields.filter(t.isString))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${d(this.fields)} ${d(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class Km extends $c{clone(){return new Km(null,l(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:i}=e;return{signal:`sequence(${[t,n,...i?[i]:[]].join(",")})`}}static makeFromTransform(e,t){return new Km(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(Zo(i)&&Zo(r)){const o=i.impute?i:r.impute?r:void 0;if(void 0===o)return;const a=i.impute?r:r.impute?i:void 0,{method:s,value:l,frame:c,keyvals:u}=o.impute,f=Ja(t.mark,n);return new Km(e,{impute:o.field,key:a.field,...s?{method:s}:{},...void 0!==l?{value:l}:{},...c?{frame:c}:{},...void 0!==u?{keyvals:u}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${d(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:o,frame:a=[null,null]}=this.transform,s={type:"impute",field:e,key:t,...n?{keyvals:(l=n,J(l,"stop")?this.processSequence(n):n)}:{},method:"value",...r?{groupby:r}:{},value:i&&"value"!==i?null:o};var l;if(i&&"value"!==i){return[s,{type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:a,ignorePeers:!1,...r?{groupby:r}:{}},{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}return[s]}}class Zm extends $c{clone(){return new Zm(null,l(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=l(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${d(this.transform)}`}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class ep extends $c{clone(){return new ep(null,l(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(e,t,n,i){const r=t.component.data.sources,{from:o}=n;let a=null;if(function(e){return J(e,"data")}(o)){let e=gp(o.data,r);e||(e=new Ad(o.data),r.push(e));const n=t.getName(`lookup_${i}`);a=new wc(e,n,bc.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return J(e,"param")}(o)){const e=o.param;let i;n={as:e,...n};try{i=t.getSelectionComponent(C(e),e)}catch(t){throw new Error(function(e){return`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`}(e))}if(a=i.materialized,!a)throw new Error(function(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}(e))}return new ep(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?t.array(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${d({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:t.array(this.transform.as)}:{}};else{let n=this.transform.as;t.isString(n)||(Si('If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'),n="_lookup"),e={as:[n]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}}class tp extends $c{clone(){return new tp(null,l(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=l(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"prob",n[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${d(this.transform)}`}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class np extends $c{clone(){return new np(null,l(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=l(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${d(this.transform)}`}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class ip extends $c{clone(){return new ip(null,l(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=b((this.transform.groupby??[]).concat(e),(e=>e))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${d(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return{type:"pivot",field:e,value:t,...void 0!==i?{limit:i}:{},...void 0!==r?{op:r}:{},...void 0!==n?{groupby:n}:{}}}}class rp extends $c{clone(){return new rp(null,l(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${d(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function op(e){let t=0;return function n(i,r){if(i instanceof Ad&&!i.isGenerator&&!dc(i.data)){e.push(r);r={name:null,source:r.name,transform:[]}}if(i instanceof Cd&&(i.parent instanceof Ad&&!r.source?(r.format={...r.format,parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof Dd)return r.name||(r.name="data_"+t++),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source,void e.push(...i.assemble());if((i instanceof Pd||i instanceof Nd||i instanceof Qd||i instanceof uf||i instanceof Df||i instanceof Jm||i instanceof Sd||i instanceof ep||i instanceof Zd||i instanceof Xd||i instanceof Xm||i instanceof Ym||i instanceof Hm||i instanceof Zm||i instanceof tp||i instanceof np||i instanceof _d||i instanceof rp||i instanceof ip||i instanceof Gm)&&r.transform.push(i.assemble()),(i instanceof wd||i instanceof Dc||i instanceof Km||i instanceof Kd||i instanceof Qm)&&r.transform.push(...i.assemble()),i instanceof wc)if(r.source&&0===r.transform.length)i.setSource(r.source);else if(i.parent instanceof wc)i.setSource(r.name);else if(r.name||(r.name="data_"+t++),i.setSource(r.name),1===i.numChildren()){e.push(r);r={name:null,source:r.name,transform:[]}}switch(i.numChildren()){case 0:i instanceof wc&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name="data_"+t++);let o=r.name;!r.source||r.transform.length>0?e.push(r):o=r.source;for(const e of i.children){n(e,{name:null,source:o,transform:[]})}break}}}}function ap(e){return"top"===e||"left"===e||wn(e)?"header":"footer"}function sp(e,n){const{facet:i,config:r,child:o,component:a}=e;if(e.channelHasField(n)){const s=i[n],l=zf("title",null,r,n);let c=va(s,r,{allowDisabling:!0,includeDefault:void 0===l||!!l});o.component.layoutHeaders[n].title&&(c=t.isArray(c)?c.join(", "):c,c+=` / ${o.component.layoutHeaders[n].title}`,o.component.layoutHeaders[n].title=null);const u=zf("labelOrient",s.header,r,n),f=null!==s.header&&U(s.header?.labels,r.header.labels,!0),d=p(["bottom","right"],u)?"footer":"header";a.layoutHeaders[n]={title:null!==s.header?c:null,facetFieldDef:s,[d]:"facet"===n?[]:[lp(e,n,f)]}}}function lp(e,t,n){const i="row"===t?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function cp(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:i,resolve:r}=e.component;if(r.axis[t]=Xf(r,t),"shared"===r.axis[t]){const r="x"===t?"column":"row",o=i[r];for(const i of n.component.axes[t]){const t=ap(i.get("orient"));o[t]??=[lp(e,r,!1)];const n=gf(i,"main",e.config,{header:!0});n&&o[t][0].axes.push(n),i.mainExtracted=!0}}}}function up(e){for(const t of e.children)t.parseLayoutSize()}function fp(e,t){const n=Hf(t),i=At(n),r=e.component.resolve,o=e.component.layoutSize;let a;for(const t of e.children){const o=t.component.layoutSize.getWithExplicit(n),s=r.scale[i]??Yf(i,e);if("independent"===s&&"step"===o.value){a=void 0;break}if(a){if("independent"===s&&a.value!==o.value){a=void 0;break}a=uc(a,o,n,"")}else a=o}if(a){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);o.setWithExplicit(t,a)}else o.setWithExplicit(t,{explicit:!1,value:void 0})}function dp(e,t){const n="width"===t?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const e=r.get("type"),n=r.get("range");if(kr(e)){const e=Is(i.view,t);return kn(n)||Rs(e)?"step":e}return Us(i.view,t)}if(e.hasProjection||"arc"===e.mark)return Us(i.view,t);{const e=Is(i.view,t);return Rs(e)?e.step:e}}function mp(e,t,n){return ma(t,{suffix:`by_${ma(e)}`,...n})}class pp extends Vm{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=Up(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!Uo(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=D(e),n={};for(const i of t){if(![K,Z].includes(i)){Si(li(i,"facet"));break}const t=e[i];if(void 0===t.field){Si(si(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=Fa(e,t);return n.header?n.header=bn(n.header):null===n.header&&(n.header=null),n}channelHasField(e){return J(this.facet,e)}fieldDef(e){return this.facet[e]}parseData(){this.component.data=hp(this),this.child.parseData()}parseLayoutSize(){up(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,Object.values(this.component.selection).some((e=>af(e)))&&ki(ti)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of Be)sp(e,t);cp(e,"x"),cp(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){const e={};for(const t of Be)for(const n of Pf){const i=this.component.layoutHeaders[t],r=i[n],{facetFieldDef:o}=i;if(o){const n=zf("titleOrient",o.header,this.config,t);if(["right","bottom"].includes(n)){const i=Of(t,n);e.titleAnchor??={},e.titleAnchor[i]="end"}}if(r?.[0]){const r="row"===t?"height":"width",o="header"===n?"headerBand":"footerBand";"facet"===t||this.child.component.layoutSize.get(r)||(e[o]??={},e[o][t]=.5),i.title&&(e.offset??={},e.offset["row"===t?"rowTitle":"columnTitle"]=10)}}return e}assembleDefaultLayout(){const{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0;let i="all";return(t||"independent"!==this.component.resolve.scale.x)&&(e||"independent"!==this.component.resolve.scale.y)||(i="none"),{...this.getHeaderLayoutMixins(),...n?{columns:n}:{},bounds:"full",align:i}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof pp)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroupStyle(){}assembleGroup(e){return this.parent&&this.parent instanceof pp?{...this.channelHasField("column")?{encode:{update:{columns:{field:ma(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof pp){if(this.child.channelHasField("column")){const i=ma(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of Ct){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),a=r.get("range");if(kr(o)&&kn(a)){const r=ym(vm(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):Si(Xn(i))}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:n}=this.component.data.facetRoot,{row:i,column:r}=this.facet,{fields:o,ops:a,as:s}=this.getCardinalityAggregateForChild(),l=[];for(const e of Be){const n=this.facet[e];if(n){l.push(ma(n));const{bin:c,sort:u}=n;if(mn(c)&&l.push(ma(n,{binSuffix:"end"})),Lo(u)){const{field:e,op:t=Eo}=u,l=mp(n,u);i&&r?(o.push(l),a.push("max"),s.push(l)):(o.push(e),a.push(t),s.push(l))}else if(t.isArray(u)){const t=Ff(n,e);o.push(t),a.push("max"),s.push(t)}}}const c=!!i&&!!r;return{name:e,data:n,groupby:l,...c||o.length>0?{aggregate:{...c?{cross:c}:{},...o.length?{fields:o,ops:a,as:s}:{}}}:{}}}facetSortFields(e){const{facet:n}=this,i=n[e];return i?Lo(i.sort)?[mp(i,i.sort,{expr:"datum"})]:t.isArray(i.sort)?[Ff(i,e,{expr:"datum"})]:[ma(i,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:n}=this,i=n[e];if(i){const{sort:e}=i;return[(Lo(e)?e.order:!t.isArray(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return Mf(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const i of _f)if(e[i]){const r=zf("labelOrient",e[i]?.header,t,i);if(n[i].includes(r))return Mf(e[i],i,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=op(t);for(const t of e.children)n(t,{source:e.name,name:null,transform:[]});return t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),r=e.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...i?{title:i}:{},...r?{style:r}:{},from:{facet:this.assembleFacet()},sort:{field:Be.map((e=>this.facetSortFields(e))).flat(),order:Be.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(Gc(this,[]))}]}getMapping(){return this.facet}}function gp(e,t){for(const n of t){const t=n.data;if(e.name&&n.hasName()&&e.name!==n.dataName)continue;const i=e.format?.mesh,r=t.format?.feature;if(i&&r)continue;const o=e.format?.feature;if((o||r)&&o!==r)continue;const a=t.format?.mesh;if(!i&&!a||i===a)if(mc(e)&&mc(t)){if(X(e.values,t.values))return n}else if(dc(e)&&dc(t)){if(e.url===t.url)return n}else if(pc(e)&&e.name===n.dataName)return n}return null}function hp(e){let t=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new Ad({values:[]});return t.push(e),e}const n=gp(e.data,t);if(n)return gc(e.data)||(n.data.format=y({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new Ad(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}(e,e.component.data.sources);const{outputNodes:n,outputNodeRefCounts:i}=e.component.data,r=e.data,o=!(r&&(gc(r)||dc(r)||mc(r)))&&e.parent?e.parent.component.data.ancestorParse.clone():new fc;gc(r)?(hc(r)?t=new Nd(t,r.sequence):vc(r)&&(t=new Pd(t,r.graticule)),o.parseNothing=!0):null===r?.format?.parse&&(o.parseNothing=!0),t=Cd.makeExplicit(t,e,o)??t,t=new _d(t);const a=e.parent&&Im(e.parent);(qm(e)||Um(e))&&a&&(t=wd.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=function(e,t,n){let i=0;for(const r of t.transforms){let o,a;if(Rl(r))a=e=new Df(e,r),o="derived";else if(Ol(r)){const i=Od(r);a=e=Cd.makeWithAncestors(e,{},i,n)??e,e=new uf(e,t,r.filter)}else if(Ll(r))a=e=wd.makeFromTransform(e,r,t),o="number";else if(Ul(r))o="date",void 0===n.getWithExplicit(r.field).value&&(e=new Cd(e,{[r.field]:o}),n.set(r.field,o,!1)),a=e=Dc.makeFromTransform(e,r);else if(Wl(r))a=e=Sd.makeFromTransform(e,r),o="number",rf(t)&&(e=new _d(e));else if(zl(r))a=e=ep.make(e,t,r,i++),o="derived";else if(jl(r))a=e=new Zd(e,r),o="number";else if(El(r))a=e=new Xd(e,r),o="number";else if(Il(r))a=e=Kd.makeFromTransform(e,r),o="derived";else if(Bl(r))a=e=new Xm(e,r),o="derived";else if(Vl(r))a=e=new Gm(e,r),o="derived";else if(Ml(r))a=e=new Ym(e,r),o="derived";else if(Cl(r))a=e=new ip(e,r),o="derived";else if(Tl(r))e=new rp(e,r);else if(ql(r))a=e=Km.makeFromTransform(e,r),o="derived";else if(_l(r))a=e=new Hm(e,r),o="derived";else if(Pl(r))a=e=new tp(e,r),o="derived";else if(Nl(r))a=e=new np(e,r),o="derived";else{if(!Al(r)){Si(`Ignoring an invalid transform: ${Q(r)}.`);continue}a=e=new Zm(e,r),o="derived"}if(a&&void 0!==o)for(const e of a.producedFields()??[])n.set(e,o,!1)}return e}(t,e,o));const s=function(e){const t={};if(qm(e)&&e.component.selection)for(const n of D(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&q(e.field)>1&&(t[e.field]="flatten")}return t}(e),l=zd(e);t=Cd.makeWithAncestors(t,{},{...s,...l},o)??t,qm(e)&&(t=Qm.parseAll(t,e),t=Jm.parseAll(t,e)),(qm(e)||Um(e))&&(a||(t=wd.makeFromEncoding(t,e)??t),t=Dc.makeFromEncoding(t,e)??t,t=Df.parseAllForSortIndex(t,e));const c=t=yp(bc.Raw,e,t);if(qm(e)){const n=Sd.makeFromEncoding(t,e);n&&(t=n,rf(e)&&(t=new _d(t))),t=Km.makeFromEncoding(t,e)??t,t=Kd.makeFromEncoding(t,e)??t}let u,f;if(qm(e)){const{markDef:n,mark:i,config:r}=e,o=En("invalid",n,r),{marks:a,scales:s}=f=xc({invalid:o,isPath:Zr(i)});a!==s&&"include-invalid-values"===s&&(u=t=yp(bc.PreFilterInvalid,e,t)),"exclude-invalid-values"===a&&(t=Qd.make(t,e,f)??t)}const d=t=yp(bc.Main,e,t);let m;if(qm(e)&&f){const{marks:n,scales:i}=f;"include-invalid-values"===n&&"exclude-invalid-values"===i&&(t=Qd.make(t,e,f)??t,m=t=yp(bc.PostFilterInvalid,e,t))}qm(e)&&function(e,t){for(const[n,i]of O(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new wc(new uf(t,e,{param:n}),r,bc.Lookup,e.component.data.outputNodeRefCounts)}}(e,d);let p=null;if(Um(e)){const i=e.getName("facet");t=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(Lo(r.sort)){const{field:n,op:i=Eo}=r.sort;e=t=new Xd(e,{joinaggregate:[{op:i,field:n,as:mp(r,r.sort,{forAs:!0})}],groupby:[ma(r)]})}return t}return null}(t,e.facet)??t,p=new Dd(t,e,i,d.getSource()),n[i]=p}return{...e.component.data,outputNodes:n,outputNodeRefCounts:i,raw:c,main:d,facetRoot:p,ancestorParse:o,preFilterInvalid:u,postFilterInvalid:m}}function yp(e,t,n){const{outputNodes:i,outputNodeRefCounts:r}=t.component.data,o=t.getDataName(e),a=new wc(n,o,e,r);return i[o]=a,a}class vp extends Bm{constructor(e,t,n,i){super(e,"concat",t,n,i,e.resolve),"shared"!==e.resolve?.axis?.x&&"shared"!==e.resolve?.axis?.y||Si("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(e).map(((e,t)=>Up(e,this,this.getName(`concat_${t}`),void 0,i)))}parseData(){this.component.data=hp(this);for(const e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of D(e.component.selection))this.component.selection[t]=e.component.selection[t]}Object.values(this.component.selection).some((e=>af(e)))&&ki(ti)}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return js(e)?e.vconcat:Es(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){up(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";fp(e,t),fp(e,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.forEach((e=>e.assembleSignals())),[]}assembleLayoutSignals(){const e=Wf(this);for(const t of this.children)e.push(...t.assembleLayoutSignals());return e}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleMarks(){return this.children.map((e=>{const t=e.assembleTitle(),n=e.assembleGroupStyle(),i=e.assembleGroupEncodeEntry(!1);return{type:"group",name:e.getName("group"),...t?{title:t}:{},...n?{style:n}:{},...i?{encode:{update:i}}:{},...e.assembleGroup()}}))}assembleGroupStyle(){}assembleDefaultLayout(){const e=this.layout.columns;return{...null!=e?{columns:e}:{},bounds:"full",align:"each"}}}const bp={disable:1,gridScale:1,scale:1,...Ma,labelExpr:1,encode:1},xp=D(bp);class $p extends oc{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new $p(l(this.explicit),l(this.implicit),this.mainExtracted)}hasAxisPart(e){return"axis"===e||("grid"===e||"title"===e?!!this.get(e):!(!1===(t=this.get(e))||null===t));var t}hasOrientSignalRef(){return wn(this.explicit.orient)}}const wp={bottom:"top",top:"bottom",left:"right",right:"left"};function kp(e,t){if(!e)return t.map((e=>e.clone()));{if(e.length!==t.length)return;const n=e.length;for(let i=0;i{switch(n){case"title":return In(e,t);case"gridScale":return{explicit:e.explicit,value:U(e.value,t.value)}}return cc(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function Dp(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(wn(n.labelAngle)?n.labelAngle:H(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===Sf(i,r))return!0}return e===n[t]}const Fp=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function Op(e,t){let n=t.axis(e);const i=new $p,r=ka(t.encoding[e]),{mark:o,config:a}=t,s=n?.orient||a["x"===e?"axisX":"axisY"]?.orient||a.axis?.orient||function(e){return"x"===e?"bottom":"left"}(e),l=t.getScaleComponent(e).get("type"),c=function(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:br(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],o="x"===e?"axisX":"axisY",a=wn(n)?"axisOrient":`axis${N(n)}`,s=[...r,...r.map((e=>o+e.substr(4)))],l=["axis",a,o];return{vlOnlyAxisConfig:yf(s,i,e,n),vgAxisConfig:yf(l,i,e,n),axisConfigStyle:vf([...l,...s],i)}}(e,l,s,t.config),u=void 0!==n?!n:bf("disable",a.style,n?.style,c).configValue;if(i.set("disable",u,void 0!==n),u)return i;n=n||{};const f=function(e,t,n,i,r){const o=t?.labelAngle;if(void 0!==o)return wn(o)?o:H(o);{const{configValue:o}=bf("labelAngle",i,t?.style,r);return void 0!==o?H(o):n!==te||!p([ur,lr],e.type)||Zo(e)&&e.timeUnit?void 0:270}}(r,n,e,a.style,c),d=Po(n.formatType,r,l),m=_o(r,r.type,n.format,n.formatType,a,!0),g={fieldOrDatumDef:r,axis:n,channel:e,model:t,scaleType:l,orient:s,labelAngle:f,format:m,formatType:d,mark:o,config:a};for(const r of xp){const o=r in xf?xf[r](g):La(r)?n[r]:void 0,s=void 0!==o,l=Dp(o,r,n,t,e);if(s&&l)i.set(r,o,l);else{const{configValue:e,configFrom:t}=La(r)&&"values"!==r?bf(r,a.style,n.style,c):{},u=void 0!==e;s&&!u?i.set(r,o,l):("vgAxisConfig"!==t||Fp.has(r)&&u||Ta(e)||wn(e))&&i.set(r,e,!1)}}const h=n.encoding??{},y=ja.reduce(((n,r)=>{if(!i.hasAxisPart(r))return n;const o=Gf(h[r]??{},t),a="labels"===r?function(e,t,n){const{encoding:i,config:r}=e,o=ka(i[t])??ka(i[at(t)]),a=e.axis(t)||{},{format:s,formatType:l}=a;if(So(l))return{text:Co({fieldOrDatumDef:o,field:"datum.value",format:s,formatType:l,config:r}),...n};if(void 0===s&&void 0===l&&r.customFormatTypes){if("quantitative"===ea(o)){if(ca(o)&&"normalize"===o.stack&&r.normalizedNumberFormatType)return{text:Co({fieldOrDatumDef:o,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:Co({fieldOrDatumDef:o,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if("temporal"===ea(o)&&r.timeFormatType&&Zo(o)&&!o.timeUnit)return{text:Co({fieldOrDatumDef:o,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}(t,e,o):o;return void 0===a||S(a)||(n[r]={update:a}),n}),{});return S(y)||i.set("encode",y,!!n.encoding||void 0!==n.labelAngle),i}function zp(e,t){const{config:n}=e;return{...Pu(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...yu("x",e,{defaultPos:"mid"}),...yu("y",e,{defaultPos:"mid"}),...mu("size",e),...mu("angle",e),...Cp(e,n,t)}}function Cp(e,t,n){return n?{shape:{value:n}}:mu("shape",e)}const _p={vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?{...Pu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...ku("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...ku("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...mu("size",e,{vgChannel:"strokeWidth"})}:{}}};function Pp(e,t,n){if(void 0===En("align",e,n))return"center"}function Np(e,t,n){if(void 0===En("baseline",e,n))return"middle"}const Ap={vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"x":"y",o="horizontal"===i?"y":"x",a="horizontal"===i?"height":"width";return{...Pu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Fu(e,r),...yu(o,e,{defaultPos:"mid",vgChannel:"y"===o?"yc":"xc"}),[a]:Pn(En("thickness",n,t))}}},Tp={arc:{vgMark:"arc",encodeEntry:e=>({...Pu(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...yu("x",e,{defaultPos:"mid"}),...yu("y",e,{defaultPos:"mid"}),...Fu(e,"radius"),...Fu(e,"theta")})},area:{vgMark:"area",encodeEntry:e=>({...Pu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...ku("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...ku("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...Tu(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...Pu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Fu(e,"x"),...Fu(e,"y")})},circle:{vgMark:"symbol",encodeEntry:e=>zp(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...Pu(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&Zo(n)&&n.type===fr?{field:ma(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...Pu(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...Fu(e,"x"),...Fu(e,"y"),...ou(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...Pu(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...yu("x",e,{defaultPos:"mid"}),...yu("y",e,{defaultPos:"mid"}),...mu("size",e,{vgChannel:"strokeWidth"}),...Tu(e)})},point:{vgMark:"symbol",encodeEntry:e=>zp(e)},rect:{vgMark:"rect",encodeEntry:e=>({...Pu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Fu(e,"x"),...Fu(e,"y")})},rule:_p,square:{vgMark:"symbol",encodeEntry:e=>zp(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...Pu(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...yu("x",e,{defaultPos:"mid"}),...yu("y",e,{defaultPos:"mid"}),...ou(e),...mu("size",e,{vgChannel:"fontSize"}),...mu("angle",e),...ju("align",Pp(e.markDef,n,t)),...ju("baseline",Np(e.markDef,n,t)),...yu("radius",e,{defaultPos:null}),...yu("theta",e,{defaultPos:null})}}},tick:Ap,trail:{vgMark:"trail",encodeEntry:e=>({...Pu(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...yu("x",e,{defaultPos:"mid"}),...yu("y",e,{defaultPos:"mid"}),...mu("size",e),...Tu(e)})}};function jp(e){if(p([Ir,qr,Xr],e.mark)){const t=Ja(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:Ep+e.requestDataName(bc.Main),data:e.requestDataName(bc.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:Rp(e,{fromPrefix:Ep})}]}(e,t)}else if(e.mark===Ur){const t=On.some((t=>En(t,e.markDef,e.config)));if(e.stack&&!e.fieldDef("size")&&t)return function(e){const[t]=Rp(e,{fromPrefix:Mp}),n=e.scaleName(e.stack.fieldChannel),i=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.vgField(e.stack.fieldChannel,t)},r=(e,t)=>`${e}(${[i({prefix:"min",suffix:"start",expr:t}),i({prefix:"max",suffix:"start",expr:t}),i({prefix:"min",suffix:"end",expr:t}),i({prefix:"max",suffix:"end",expr:t})].map((e=>`scale('${n}',${e})`)).join(",")})`;let o,a;"x"===e.stack.fieldChannel?(o={...u(t.encode.update,["y","yc","y2","height",...On]),x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}},a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update={...f(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...u(t.encode.update,["x","xc","x2","width"]),y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}},a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update={...f(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const n of On){const i=Mn(n,e.markDef,e.config);t.encode.update[n]?(o[n]=t.encode.update[n],delete t.encode.update[n]):i&&(o[n]=Pn(i)),i&&(t.encode.update[n]={value:0})}const s=[];if(e.stack.groupbyChannels?.length>0)for(const t of e.stack.groupbyChannels){const n=e.fieldDef(t),i=ma(n);i&&s.push(i),(n?.bin||n?.timeUnit)&&s.push(ma(n,{binSuffix:"end"}))}o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((n,i)=>{if(t.encode.update[i])return{...n,[i]:t.encode.update[i]};{const t=Mn(i,e.markDef,e.config);return void 0!==t?{...n,[i]:Pn(t)}:n}}),o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0});return[{type:"group",from:{facet:{data:e.requestDataName(bc.Main),name:Mp+e.requestDataName(bc.Main),groupby:s,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:a},marks:[t]}]}]}(e)}return Rp(e)}const Ep="faceted_path_";const Mp="stack_group_";function Rp(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{fromPrefix:""};const{mark:i,markDef:r,encoding:o,config:a}=e,s=U(r.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!(!t?.get("selectionExtent")&&!n?.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),l=jn(r),c=o.key,u=function(e){const{encoding:n,stack:i,mark:r,markDef:o,config:a}=e,s=n.order;if(!(!t.isArray(s)&&sa(s)&&m(s.value)||!s&&m(En("order",o,a)))){if((t.isArray(s)||Zo(s))&&!i)return qn(s,{expr:"datum"});if(Zr(r)){const e="horizontal"===o.orient?"y":"x";if(Zo(n[e]))return{field:e}}}}(e),f=function(e){if(!e.component.selection)return null;const t=D(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=D(i.component.selection).length,i=i.parent;return n?{interactive:t>0||"geoshape"===e.mark||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}(e),d=En("aria",r,a),p=Tp[i].postEncodingTransform?Tp[i].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:Tp[i].vgMark,...s?{clip:s}:{},...l?{style:l}:{},...c?{key:c.field}:{},...u?{sort:u}:{},...f||{},...!1===d?{aria:d}:{},from:{data:n.fromPrefix+e.requestDataName(bc.Main)},encode:{update:Tp[i].encodeEntry(e)},...p?{transform:p}:{}}]}class Lp extends Vm{specifiedScales={};specifiedAxes={};specifiedLegends={};specifiedProjection={};selection=[];children=[];constructor(e,n,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4?arguments[4]:void 0;super(e,"unit",n,i,o,void 0,Ls(e)?e.view:void 0);const a=no(e.mark)?{...e.mark}:{type:e.mark},s=a.type;void 0===a.filled&&(a.filled=function(e,t,n){let{graticule:i}=n;if(i)return!1;const r=Mn("filled",e,t),o=e.type;return U(r,o!==Br&&o!==Ir&&o!==Hr)}(a,o,{graticule:e.data&&vc(e.data)}));const l=this.encoding=function(e,n,i,r){const o={};for(const t of D(e))tt(t)||Si(`${a=t}-encoding is dropped as ${a} is not a valid encoding channel.`);var a;for(let a of ft){if(!e[a])continue;const s=e[a];if(jt(a)){const e=ut(a),t=o[e];if(Zo(t)&&or(t.type)&&Zo(s)&&!t.timeUnit){Si(ri(e));continue}}if("angle"!==a||"arc"!==n||e.theta||(Si("Arc marks uses theta channel rather than angle, replacing angle with theta."),a=ce),Ya(e,a,n)){if(a===xe&&"line"===n){const t=wa(e[a]);if(t?.aggregate){Si("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(a===he&&(i?"fill"in e:"stroke"in e))Si(ai("encoding",{fill:"fill"in e,stroke:"stroke"in e}));else if(a===Ce||a===ze&&!t.isArray(s)&&!sa(s)||a===Pe&&t.isArray(s)){if(s){if(a===ze){const t=e[a];if(Xo(t)){o[a]=t;continue}}o[a]=t.array(s).reduce(((e,t)=>(Zo(t)?e.push(Fa(t,a)):Si(si(t,a)),e)),[])}}else{if(a===Pe&&null===s)o[a]=null;else if(!(Zo(s)||ta(s)||sa(s)||Qo(s)||wn(s))){Si(si(s,a));continue}o[a]=Sa(s,a,r)}}else Si(li(a,n))}return o}(e.encoding||{},s,a.filled,o);this.markDef=fl(a,l,o),this.size=function(e){let{encoding:t,size:n}=e;for(const e of Ct){const i=st(e);Rs(n[i])&&na(t[e])&&(delete n[i],Si(hi(i)))}return n}({encoding:l,size:Ls(e)?{...r,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:r}),this.stack=ul(this.markDef,l),this.specifiedScales=this.initScales(s,l),this.specifiedAxes=this.initAxes(l),this.specifiedLegends=this.initLegends(l),this.specifiedProjection=e.projection,this.selection=(e.params??[]).filter((e=>Ns(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===Kr,n=e&&qe.some((t=>oa(e[t])));return t||n}scaleDomain(e){const t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return Xt.reduce(((e,n)=>{const i=ka(t[n]);return i&&(e[n]=this.initScale(i.scale??{})),e}),{})}initScale(e){const{domain:n,range:i}=e,r=bn(e);return t.isArray(n)&&(r.domain=n.map(Cn)),t.isArray(i)&&(r.range=i.map(Cn)),r}initAxes(e){return Ct.reduce(((t,n)=>{const i=e[n];if(oa(i)||n===te&&oa(e.x2)||n===ne&&oa(e.y2)){const e=oa(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t}),{})}initAxis(e){const t=D(e),n={};for(const i of t){const t=e[i];n[i]=Ta(t)?zn(t):Cn(t)}return n}initLegends(e){return Gt.reduce(((t,n)=>{const i=ka(e[n]);if(i&&function(e){switch(e){case he:case ye:case ve:case xe:case be:case we:case De:case Fe:return!0;case ke:case Se:case $e:case ge:return!1}}(n)){const e=i.legend;t[n]=e?bn(e):e}return t}),{})}parseData(){this.component.data=hp(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of Ct){const r=st(i);if(t[r]){const e=t[r];n.layoutSize.set(r,Rs(e)?"step":e,!0)}else{const t=dp(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,n){const i={},r=e.config.selection;if(!n||!n.length)return i;let o=0;for(const a of n){const n=C(a.name),s=a.select,c=t.isString(s)?s:s.type,u=t.isObject(s)?l(s):{type:c},f=r[c];for(const e in f)"fields"!==e&&"encodings"!==e&&("mark"===e&&(u.mark={...f.mark,...u.mark}),void 0!==u[e]&&!0!==u[e]||(u[e]=l(f[e]??u[e])));const d=i[n]={...u,name:n,type:c,init:a.value,bind:a.bind,events:t.isString(u.on)?t.parseSelector(u.on,"scope"):t.array(l(u.on))};if(af(d)&&(o++,o>1)){delete i[n];continue}const m=l(a);for(const t of tf)t.defined(d)&&t.parse&&t.parse(e,d,m)}return o>1&&Si("Multiple timer selections in one unit spec are not supported. Ignoring all but the first."),i}(this,this.selection)}parseMarkGroup(){this.component.mark=jp(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,Ct.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[Op(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,n){let i=!1;for(const r of F(e.component.selection??{})){const o=r.name,a=t.stringValue(o+Ju);if(0===n.filter((e=>e.name===o)).length){const e="global"===r.resolve?"union":r.resolve,i="point"===r.type?", true, true)":")";n.push({name:r.name,update:`${ef}(${a}, ${t.stringValue(e)}${i}`})}i=!0;for(const t of tf)t.defined(r)&&t.topLevelSignals&&(n=t.topLevelSignals(e,r,n))}i&&0===n.filter((e=>"unit"===e.name)).length&&n.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]});return Xc(n)}(this,e)}assembleSignals(){return[...hf(this),...Hc(this,[])]}assembleSelectionData(e){return function(e,t){const n=[],i=[],r=nf(e,{escape:!1});for(const o of F(e.component.selection??{})){const a={name:o.name+Ju};if(o.project.hasSelectionId&&(a.transform=[{type:"collect",sort:{field:zs}}]),o.init){const e=o.project.items.map(Bc);a.values=o.project.hasSelectionId?o.init.map((e=>({unit:r,[zs]:Vc(e,!1)[0]}))):o.init.map((t=>({unit:r,fields:e,values:Vc(t,!1)})))}if([...n,...t].filter((e=>e.name===o.name+Ju)).length||n.push(a),af(o)&&t.length){const n=e.lookupDataSource(e.getDataName(bc.Main)),r=t.find((e=>e.name===n)),o=r.transform.find((e=>"filter"===e.type&&e.expr.includes("vlSelectionTest")));if(o){r.transform=r.transform.filter((e=>e!==o));const e={name:r.name+Tc,source:r.name,transform:[o]};i.push(e)}}}return n.concat(t,i)}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return Wf(this)}correctDataNames=e=>(e.from?.data&&(e.from.data=this.lookupDataSource(e.from.data),"time"in this.encoding&&(e.from.data=e.from.data+Tc)),e.from?.facet?.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e);assembleMarks(){let e=this.component.mark??[];return this.parent&&Im(this.parent)||(e=Yc(this,e)),e.map(this.correctDataNames)}assembleGroupStyle(){const{style:e}=this.view||{};return void 0!==e?e:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return Ia(this.encoding,e)}fieldDef(e){return wa(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return aa(t)?t:null}}class qp extends Bm{constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view);const o={...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}};this.children=e.layer.map(((e,t)=>{if(il(e))return new qp(e,this,this.getName(`layer_${t}`),o,r);if(Ua(e))return new Lp(e,this,this.getName(`layer_${t}`),o,r);throw new Error(Bn(e))}))}parseData(){this.component.data=hp(this);for(const e of this.children)e.parseData()}parseLayoutSize(){var e;up(e=this),fp(e,"width"),fp(e,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of D(e.component.selection))this.component.selection[t]=e.component.selection[t]}Object.values(this.component.selection).some((e=>af(e)))&&ki(ti)}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){const{axes:t,resolve:n}=e.component,i={top:0,bottom:0,right:0,left:0};for(const i of e.children){i.parseAxesAndHeaders();for(const r of D(i.component.axes))n.axis[r]=Xf(e.component.resolve,r),"shared"===n.axis[r]&&(t[r]=kp(t[r],i.component.axes[r]),t[r]||(n.axis[r]="independent",delete t[r]))}for(const r of Ct){for(const o of e.children)if(o.component.axes[r]){if("independent"===n.axis[r]){t[r]=(t[r]??[]).concat(o.component.axes[r]);for(const e of o.component.axes[r]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!wn(t)){if(i[t]>0&&!n){const n=wp[t];i[t]>i[n]&&e.set("orient",n,!1)}i[t]++}}}delete o.component.axes[r]}if("independent"===n.axis[r]&&t[r]&&t[r].length>1)for(const[e,n]of(t[r]||[]).entries())e>0&&n.get("grid")&&!n.explicit.grid&&(n.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleSignals())),hf(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),Wf(this))}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleGroupStyle(){const e=new Set;for(const n of this.children)for(const i of t.array(n.assembleGroupStyle()))e.add(i);const n=Array.from(e);return n.length>1?n:1===n.length?n[0]:void 0}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(const t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return function(e,t){for(const n of e.children)qm(n)&&(t=Yc(n,t));return t}(this,this.children.flatMap((e=>e.assembleMarks())))}assembleLegends(){return this.children.reduce(((e,t)=>e.concat(t.assembleLegends())),dd(this))}}function Up(e,t,n,i,r){if(Io(e))return new pp(e,t,n,r);if(il(e))return new qp(e,t,n,i,r);if(Ua(e))return new Lp(e,t,n,i,r);if(function(e){return js(e)||Es(e)||Ts(e)}(e))return new vp(e,t,n,r);throw new Error(Bn(e))}const Wp=n;e.accessPathDepth=q,e.accessPathWithDatum=A,e.accessWithDatumToUnescapedPath=j,e.compile=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i;n.logger&&(i=n.logger,wi=i),n.fieldTitle&&ya(n.fieldTitle);try{const i=Js(t.mergeConfig(n.config,e.config)),r=Kl(e,i),o=Up(r,null,"",void 0,i);o.parse(),function(e,t){rm(e.sources);let n=0,i=0;for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;const r=e.config?tl(e.config):void 0,o=function(e,t){const n=[],i=op(n);let r=0;for(const t of e.sources){t.hasName()||(t.dataName="source_"+r++);const e=t.assemble();i(t,e)}for(const e of n)0===e.transform.length&&delete e.transform;let o=0;for(const[e,t]of n.entries())0!==(t.transform??[]).length||t.source||n.splice(o++,0,n.splice(e,1)[0]);for(const t of n)for(const n of t.transform??[])"lookup"===n.type&&(n.from=e.outputNodes[n.from].getSource());for(const e of n)e.name in t&&(e.values=t[e.name]);return n}(e.component.data,n),a=e.assembleSelectionData(o),s=e.assembleProjections(),l=e.assembleTitle(),c=e.assembleGroupStyle(),u=e.assembleGroupEncodeEntry(!0);let f=e.assembleLayoutSignals();f=f.filter((e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)));const{params:d,...m}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...m,...l?{title:l}:{},...c?{style:c}:{},...u?{encode:{update:u}}:{},data:a,...s.length>0?{projections:s}:{},...e.assembleGroup([...f,...e.assembleSelectionTopLevelSignals([]),...As(d)]),...r?{config:r}:{},...i?{usermeta:i}:{}}}(o,function(e,n,i,r){const o=r.component.layoutSize.get("width"),a=r.component.layoutSize.get("height");void 0===n?(n={type:"pad"},r.hasAxisOrientSignalRef()&&(n.resize=!0)):t.isString(n)&&(n={type:n});if(o&&a&&(s=n.type,["fit","fit-x","fit-y"].includes(s)))if("step"===o&&"step"===a)Si(Yn()),n.type="pad";else if("step"===o||"step"===a){const e="step"===o?"width":"height";Si(Yn(At(e)));const t="width"===e?"height":"width";n.type=function(e){return e?`fit-${At(e)}`:"fit"}(t)}var s;return{...1===D(n).length&&n.type?"pad"===n.type?{}:{autosize:n.type}:{autosize:n},...rc(i,!1),...rc(e,!0)}}(e,r.autosize,i,o),e.datasets,e.usermeta);return{spec:a,normalized:r}}finally{n.logger&&(wi=$i),n.fieldTitle&&ya(ga)}},e.contains=p,e.deepEqual=X,e.deleteNestedProperty=P,e.duplicate=l,e.entries=O,e.every=h,e.fieldIntersection=k,e.flatAccessWithDatum=T,e.getFirstDefined=U,e.hasIntersection=$,e.hasProperty=J,e.hash=d,e.internalField=B,e.isBoolean=z,e.isEmpty=S,e.isEqual=function(e,t){const n=D(e),i=D(t);if(n.length!==i.length)return!1;for(const i of n)if(e[i]!==t[i])return!1;return!0},e.isInternalField=V,e.isNullOrFalse=m,e.isNumeric=G,e.keys=D,e.logicalExpr=_,e.mergeDeep=y,e.never=c,e.normalize=Kl,e.normalizeAngle=H,e.omit=f,e.pick=u,e.prefixGenerator=w,e.removePathFromField=L,e.replaceAll=R,e.replacePathInField=M,e.resetIdCounter=function(){W=42},e.setEqual=x,e.some=g,e.stringify=Q,e.titleCase=N,e.unique=b,e.uniqueId=I,e.vals=F,e.varName=C,e.version=Wp})); +//# sourceMappingURL=vega-lite.min.js.map diff --git a/static/vendor/retained-analysis/vega.min.js b/static/vendor/retained-analysis/vega.min.js new file mode 100644 index 00000000..572741ee --- /dev/null +++ b/static/vendor/retained-analysis/vega.min.js @@ -0,0 +1,2 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).vega={})}(this,(function(t){"use strict";function e(t,e,n){return t.fields=e||[],t.fname=n,t}function n(t){return null==t?null:t.fname}function r(t){return null==t?null:t.fields}function i(t){return 1===t.length?o(t[0]):a(t)}const o=t=>function(e){return e[t]},a=t=>{const e=t.length;return function(n){for(let r=0;rr&&c(),u=r=i+1):"]"===o&&(u||s("Access path missing open bracket: "+t),u>0&&c(),u=0,r=i+1):i>r?c():r=i+1}return u&&s("Access path missing closing bracket: "+t),a&&s("Access path missing closing quote: "+t),i>r&&(i++,c()),e}function l(t,n,r){const o=u(t);return t=1===o.length?o[0]:t,e((r&&r.get||i)(o),[t],n||t)}const c=l("id"),f=e((t=>t),[],"identity"),h=e((()=>0),[],"zero"),d=e((()=>1),[],"one"),p=e((()=>!0),[],"true"),g=e((()=>!1),[],"false");function m(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}const y=0,v=1,_=2,x=3,b=4;function w(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:m,r=t||y;return{level(t){return arguments.length?(r=+t,this):r},error(){return r>=v&&n(e||"error","ERROR",arguments),this},warn(){return r>=_&&n(e||"warn","WARN",arguments),this},info(){return r>=x&&n(e||"log","INFO",arguments),this},debug(){return r>=b&&n(e||"log","DEBUG",arguments),this}}}var k=Array.isArray;function A(t){return t===Object(t)}const M=t=>"__proto__"!==t;function E(){for(var t=arguments.length,e=new Array(t),n=0;n{for(const n in e)if("signals"===n)t.signals=C(t.signals,e.signals);else{const r="legend"===n?{layout:1}:"style"===n||null;D(t,n,e[n],r)}return t}),{})}function D(t,e,n,r){if(!M(e))return;let i,o;if(A(n)&&!k(n))for(i in o=A(t[e])?t[e]:t[e]={},n)r&&(!0===r||r[i])?D(o,i,n[i]):M(i)&&(o[i]=n[i]);else t[e]=n}function C(t,e){if(null==t)return e;const n={},r=[];function i(t){n[t.name]||(n[t.name]=1,r.push(t))}return e.forEach(i),t.forEach(i),r}function F(t){return t[t.length-1]}function S(t){return null==t||""===t?null:+t}const $=t=>e=>t*Math.exp(e),T=t=>e=>Math.log(t*e),B=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),z=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,N=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function O(t,e,n,r){const i=n(t[0]),o=n(F(t)),a=(o-i)*e;return[r(i-a),r(o-a)]}function R(t,e){return O(t,e,S,f)}function L(t,e){var n=Math.sign(t[0]);return O(t,e,T(n),$(n))}function U(t,e,n){return O(t,e,N(n),N(1/n))}function q(t,e,n){return O(t,e,B(n),z(n))}function P(t,e,n,r,i){const o=r(t[0]),a=r(F(t)),s=null!=e?r(e):(o+a)/2;return[i(s+(o-s)*n),i(s+(a-s)*n)]}function j(t,e,n){return P(t,e,n,S,f)}function I(t,e,n){const r=Math.sign(t[0]);return P(t,e,n,T(r),$(r))}function W(t,e,n,r){return P(t,e,n,N(r),N(1/r))}function H(t,e,n,r){return P(t,e,n,B(r),z(r))}function Y(t){return 1+~~(new Date(t).getMonth()/3)}function G(t){return 1+~~(new Date(t).getUTCMonth()/3)}function V(t){return null!=t?k(t)?t:[t]:[]}function X(t,e,n){let r,i=t[0],o=t[1];return o=n-e?[e,n]:[i=Math.min(Math.max(i,e),n-r),i+r]}function J(t){return"function"==typeof t}const Z="descending";function Q(t,n,i){i=i||{},n=V(n)||[];const o=[],a=[],s={},u=i.comparator||tt;return V(t).forEach(((t,e)=>{null!=t&&(o.push(n[e]===Z?-1:1),a.push(t=J(t)?t:l(t,null,i)),(r(t)||[]).forEach((t=>s[t]=1)))})),0===a.length?null:e(u(a,o),Object.keys(s))}const K=(t,e)=>(te||null==e)&&null!=t?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e==e?-1:e!=e&&t==t?1:0),tt=(t,e)=>1===t.length?et(t[0],e[0]):nt(t,e,t.length),et=(t,e)=>function(n,r){return K(t(n),t(r))*e},nt=(t,e,n)=>(e.push(0),function(r,i){let o,a=0,s=-1;for(;0===a&&++st}function it(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout((()=>(e(r),n=null)),t)}}function ot(t){for(let e,n,r=1,i=arguments.length;ro&&(o=r))}else{for(r=e(t[a]);ao&&(o=r))}return[i,o]}function st(t,e){const n=t.length;let r,i,o,a,s,u=-1;if(null==e){for(;++u=i){r=o=i;break}if(u===n)return[-1,-1];for(a=s=u;++ui&&(r=i,a=u),o=i){r=o=i;break}if(u===n)return[-1,-1];for(a=s=u;++ui&&(r=i,a=u),or(t)?n[t]:void 0,set(t,e){return r(t)||(++i.size,n[t]===lt&&--i.empty),n[t]=e,this},delete(t){return r(t)&&(--i.size,++i.empty,n[t]=lt),this},clear(){i.size=i.empty=0,i.object=n={}},test(t){return arguments.length?(e=t,i):e},clean(){const t={};let r=0;for(const i in n){const o=n[i];o===lt||e&&e(o)||(t[i]=o,++r)}i.size=r,i.empty=0,i.object=n=t}};return t&&Object.keys(t).forEach((e=>{i.set(e,t[e])})),i}function ft(t,e,n,r,i,o){if(!n&&0!==n)return o;const a=+n;let s,u=t[0],l=F(t);la&&(i=o,o=a,a=i),r=void 0===r||r,((n=void 0===n||n)?o<=t:ot.replace(/\\(.)/g,"$1"))):V(t));const o=t&&t.length,a=r&&r.get||i,s=t=>a(n?[t]:u(t));let l;if(o)if(1===o){const e=s(t[0]);l=function(t){return""+e(t)}}else{const e=t.map(s);l=function(t){let n=""+e[0](t),r=0;for(;++r{e={},n={},r=0},o=(i,o)=>(++r>t&&(n=e,e={},r=1),e[i]=o);return i(),{clear:i,has:t=>ut(e,t)||ut(n,t),get:t=>ut(e,t)?e[t]:ut(n,t)?o(t,n[t]):void 0,set:(t,n)=>ut(e,t)?e[t]=n:o(t,n)}}function kt(t,e,n,r){const i=e.length,o=n.length;if(!o)return e;if(!i)return n;const a=r||new e.constructor(i+o);let s=0,u=0,l=0;for(;s0?n[u++]:e[s++];for(;s=0;)n+=t;return n}function Mt(t,e,n,r){const i=n||" ",o=t+"",a=e-o.length;return a<=0?o:"left"===r?At(i,a)+o:"center"===r?At(i,~~(a/2))+o+At(i,Math.ceil(a/2)):o+At(i,a)}function Et(t){return t&&F(t)-t[0]||0}function Dt(t){return k(t)?"["+t.map(Dt)+"]":A(t)||_t(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function Ct(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t}const Ft=t=>yt(t)||gt(t)?t:Date.parse(t);function St(t,e){return e=e||Ft,null==t||""===t?null:e(t)}function $t(t){return null==t||""===t?null:t+""}function Tt(t){const e={},n=t.length;for(let r=0;r9999?"+"+jt(e,6):jt(e,4))+"-"+jt(t.getUTCMonth()+1,2)+"-"+jt(t.getUTCDate(),2)+(o?"T"+jt(n,2)+":"+jt(r,2)+":"+jt(i,2)+"."+jt(o,3)+"Z":i?"T"+jt(n,2)+":"+jt(r,2)+":"+jt(i,2)+"Z":r||n?"T"+jt(n,2)+":"+jt(r,2)+"Z":"")}function Wt(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,s=0,u=o<=0,l=!1;function c(){if(u)return Ot;if(l)return l=!1,Nt;var e,r,i=a;if(t.charCodeAt(i)===Rt){for(;a++=o?u=!0:(r=t.charCodeAt(a++))===Lt?l=!0:r===Ut&&(l=!0,t.charCodeAt(a)===Lt&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a1)r=function(t,e,n){var r,i=[],o=[];function a(t){var e=t<0?~t:t;(o[e]||(o[e]=[])).push({i:t,g:r})}function s(t){t.forEach(a)}function u(t){t.forEach(s)}function l(t){t.forEach(u)}function c(t){switch(r=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":s(t.arcs);break;case"MultiLineString":case"Polygon":u(t.arcs);break;case"MultiPolygon":l(t.arcs)}}return c(e),o.forEach(null==n?function(t){i.push(t[0].i)}:function(t){n(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}(0,e,n);else for(i=0,r=new Array(o=t.arcs.length);ie?1:t>=e?0:NaN}function Kt(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function te(t){let e,n,r;function i(t,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length;if(i>>1;n(t[e],r)<0?i=e+1:o=e}while(iQt(t(e),n),r=(e,n)=>t(e)-n):(e=t===Qt||t===Kt?t:ee,n=t,r=t),{left:i,center:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const o=i(t,e,n,(arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length)-1);return o>n&&r(t[o-1],e)>-r(t[o],e)?o-1:o},right:function(t,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length;if(i>>1;n(t[e],r)<=0?i=e+1:o=e}while(i0){for(o=t[--i];i>0&&(e=o,n=t[--i],o=e+n,r=n-(o-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=o+n,n==e-o&&(o=e))}return o}}class se extends Map{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:he;if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(le(this,t))}has(t){return super.has(le(this,t))}set(t,e){return super.set(ce(this,t),e)}delete(t){return super.delete(fe(this,t))}}class ue extends Set{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:he;if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const e of t)this.add(e)}has(t){return super.has(le(this,t))}add(t){return super.add(ce(this,t))}delete(t){return super.delete(fe(this,t))}}function le(t,e){let{_intern:n,_key:r}=t;const i=r(e);return n.has(i)?n.get(i):e}function ce(t,e){let{_intern:n,_key:r}=t;const i=r(e);return n.has(i)?n.get(i):(n.set(i,e),e)}function fe(t,e){let{_intern:n,_key:r}=t;const i=r(e);return n.has(i)&&(e=n.get(i),n.delete(i)),e}function he(t){return null!==t&&"object"==typeof t?t.valueOf():t}function de(t,e){return(null==t||!(t>=t))-(null==e||!(e>=e))||(te?1:0)}const pe=Math.sqrt(50),ge=Math.sqrt(10),me=Math.sqrt(2);function ye(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=pe?10:o>=ge?5:o>=me?2:1;let s,u,l;return i<0?(l=Math.pow(10,-i)/a,s=Math.round(t*l),u=Math.round(e*l),s/le&&--u,l=-l):(l=Math.pow(10,i)*a,s=Math.round(t/l),u=Math.round(e/l),s*le&&--u),u0))return[];if((t=+t)===(e=+e))return[t];const r=e=i))return[];const s=o-i+1,u=new Array(s);if(r)if(a<0)for(let t=0;t=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n=i)&&(n=i)}return n}function we(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function ke(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0,i=arguments.length>4?arguments[4]:void 0;if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=void 0===i?de:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Qt;if(t===Qt)return de;if("function"!=typeof t)throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||0===r?r:(0===t(n,n))-(0===t(e,e))}}(i);r>n;){if(r-n>600){const o=r-n+1,a=e-n+1,s=Math.log(o),u=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*u*(o-u)/o)*(a-o/2<0?-1:1);ke(t,e,Math.max(n,Math.floor(e-a*u/o+l)),Math.min(r,Math.floor(e+(o-a)*u/o+l)),i)}const o=t[e];let a=n,s=r;for(Ae(t,n,e),i(t[r],o)>0&&Ae(t,n,r);a0;)--s}0===i(t[n],o)?Ae(t,n,s):(++s,Ae(t,s,r)),s<=e&&(n=s+1),e<=s&&(r=s-1)}return t}function Ae(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function Me(t,e,n){if(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n)),(r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return we(t);if(e>=1)return be(t);var r,i=(r-1)*e,o=Math.floor(i),a=be(ke(t,o).subarray(0,o+1));return a+(we(t.subarray(o+1))-a)*(i-o)}}function Ee(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ne;if((r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),a=+n(t[o],o,t);return a+(+n(t[o+1],o+1,t)-a)*(i-o)}}function De(t,e){return Me(t,.5,e)}function Ce(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function Fe(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Be(t){return(t=Te(Math.abs(t)))?t[1]:NaN}var ze,Ne=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Oe(t){if(!(e=Ne.exec(t)))throw new Error("invalid format: "+t);var e;return new Re({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Re(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Le(t,e){var n=Te(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Oe.prototype=Re.prototype,Re.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Ue={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Le(100*t,e),r:Le,s:function(t,e){var n=Te(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(ze=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Te(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function qe(t){return t}var Pe,je,Ie,We=Array.prototype.map,He=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ye(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?qe:(e=We.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],u=0;i>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?qe:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(We.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=Oe(t)).fill,n=t.align,f=t.sign,h=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,y=t.trim,v=t.type;"n"===v?(g=!0,v="g"):Ue[v]||(void 0===m&&(m=12),y=!0,v="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var _="$"===h?i:"#"===h&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",x="$"===h?o:/[%p]/.test(v)?u:"",b=Ue[v],w=/[defgprs%]/.test(v);function k(t){var i,o,u,h=_,k=x;if("c"===v)k=b(t)+k,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:b(Math.abs(t),m),y&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0==+t&&"+"!==f&&(A=!1),h=(A?"("===f?f:l:"-"===f||"("===f?"":f)+h,k=("s"===v?He[8+ze/3]:"")+k+(A&&"("===f?")":""),w)for(i=-1,o=t.length;++i(u=t.charCodeAt(i))||u>57){k=(46===u?a+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var M=h.length+t.length+k.length,E=M>1)+h+t+k+E.slice(M);break;default:t=E+h+t+k}return s(t)}return m=void 0===m?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),k.toString=function(){return t+""},k}return{format:f,formatPrefix:function(t,e){var n=f(((t=Oe(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Be(e)/3))),i=Math.pow(10,-r),o=He[8+r/3];return function(t){return n(i*t)+o}}}}function Ge(t){return Math.max(0,-Be(Math.abs(t)))}function Ve(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Be(e)/3)))-Be(Math.abs(t)))}function Xe(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Be(e)-Be(t))+1}!function(t){Pe=Ye(t),je=Pe.format,Ie=Pe.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});const Je=new Date,Ze=new Date;function Qe(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=e=>(t(e=new Date(+e)),e),i.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),i.round=t=>{const e=i(t),n=i.ceil(t);return t-e(e(t=new Date(+t),null==n?1:Math.floor(n)),t),i.range=(n,r,o)=>{const a=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n0))return a;let s;do{a.push(s=new Date(+n)),e(n,o),t(n)}while(sQe((e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););})),n&&(i.count=(e,r)=>(Je.setTime(+e),Ze.setTime(+r),t(Je),t(Ze),Math.floor(n(Je,Ze))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?e=>r(e)%t==0:e=>i.count(0,e)%t==0):i:null)),i}const Ke=Qe((()=>{}),((t,e)=>{t.setTime(+t+e)}),((t,e)=>e-t));Ke.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Qe((e=>{e.setTime(Math.floor(e/t)*t)}),((e,n)=>{e.setTime(+e+n*t)}),((e,n)=>(n-e)/t)):Ke:null),Ke.range;const tn=1e3,en=6e4,nn=36e5,rn=864e5,on=6048e5,an=2592e6,sn=31536e6,un=Qe((t=>{t.setTime(t-t.getMilliseconds())}),((t,e)=>{t.setTime(+t+e*tn)}),((t,e)=>(e-t)/tn),(t=>t.getUTCSeconds()));un.range;const ln=Qe((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*tn)}),((t,e)=>{t.setTime(+t+e*en)}),((t,e)=>(e-t)/en),(t=>t.getMinutes()));ln.range;const cn=Qe((t=>{t.setUTCSeconds(0,0)}),((t,e)=>{t.setTime(+t+e*en)}),((t,e)=>(e-t)/en),(t=>t.getUTCMinutes()));cn.range;const fn=Qe((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*tn-t.getMinutes()*en)}),((t,e)=>{t.setTime(+t+e*nn)}),((t,e)=>(e-t)/nn),(t=>t.getHours()));fn.range;const hn=Qe((t=>{t.setUTCMinutes(0,0,0)}),((t,e)=>{t.setTime(+t+e*nn)}),((t,e)=>(e-t)/nn),(t=>t.getUTCHours()));hn.range;const dn=Qe((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*en)/rn),(t=>t.getDate()-1));dn.range;const pn=Qe((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/rn),(t=>t.getUTCDate()-1));pn.range;const gn=Qe((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/rn),(t=>Math.floor(t/rn)));function mn(t){return Qe((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*en)/on))}gn.range;const yn=mn(0),vn=mn(1),_n=mn(2),xn=mn(3),bn=mn(4),wn=mn(5),kn=mn(6);function An(t){return Qe((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/on))}yn.range,vn.range,_n.range,xn.range,bn.range,wn.range,kn.range;const Mn=An(0),En=An(1),Dn=An(2),Cn=An(3),Fn=An(4),Sn=An(5),$n=An(6);Mn.range,En.range,Dn.range,Cn.range,Fn.range,Sn.range,$n.range;const Tn=Qe((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,e)=>{t.setMonth(t.getMonth()+e)}),((t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())),(t=>t.getMonth()));Tn.range;const Bn=Qe((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)}),((t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth()));Bn.range;const zn=Qe((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));zn.every=t=>isFinite(t=Math.floor(t))&&t>0?Qe((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,n)=>{e.setFullYear(e.getFullYear()+n*t)})):null,zn.range;const Nn=Qe((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function On(t,e,n,r,i,o){const a=[[un,1,tn],[un,5,5e3],[un,15,15e3],[un,30,3e4],[o,1,en],[o,5,3e5],[o,15,9e5],[o,30,18e5],[i,1,nn],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,rn],[r,2,1728e5],[n,1,on],[e,1,an],[e,3,7776e6],[t,1,sn]];function s(e,n,r){const i=Math.abs(n-e)/r,o=te((t=>{let[,,e]=t;return e})).right(a,i);if(o===a.length)return t.every(xe(e/sn,n/sn,r));if(0===o)return Ke.every(Math.max(xe(e,n,r),1));const[s,u]=a[i/a[o-1][2]isFinite(t=Math.floor(t))&&t>0?Qe((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null,Nn.range;const[Rn,Ln]=On(Nn,Bn,Mn,gn,hn,cn),[Un,qn]=On(zn,Tn,yn,dn,fn,ln),Pn="year",jn="quarter",In="month",Wn="week",Hn="date",Yn="day",Gn="dayofyear",Vn="hours",Xn="minutes",Jn="seconds",Zn="milliseconds",Qn=[Pn,jn,In,Wn,Hn,Yn,Gn,Vn,Xn,Jn,Zn],Kn=Qn.reduce(((t,e,n)=>(t[e]=1+n,t)),{});function tr(t){const e=V(t).slice(),n={};e.length||s("Missing time unit."),e.forEach((t=>{ut(Kn,t)?n[t]=1:s(`Invalid time unit: ${t}.`)}));return(n[Wn]||n[Yn]?1:0)+(n[jn]||n[In]||n[Hn]?1:0)+(n[Gn]?1:0)>1&&s(`Incompatible time units: ${t}`),e.sort(((t,e)=>Kn[t]-Kn[e])),e}const er={[Pn]:"%Y ",[jn]:"Q%q ",[In]:"%b ",[Hn]:"%d ",[Wn]:"W%U ",[Yn]:"%a ",[Gn]:"%j ",[Vn]:"%H:00",[Xn]:"00:%M",[Jn]:":%S",[Zn]:".%L",[`${Pn}-${In}`]:"%Y-%m ",[`${Pn}-${In}-${Hn}`]:"%Y-%m-%d ",[`${Vn}-${Xn}`]:"%H:%M"};function nr(t,e){const n=ot({},er,e),r=tr(t),i=r.length;let o,a,s="",u=0;for(u=0;uu;--o)if(a=r.slice(u,o).join("-"),null!=n[a]){s+=n[a],u=o;break}return s.trim()}const rr=new Date;function ir(t){return rr.setFullYear(t),rr.setMonth(0),rr.setDate(1),rr.setHours(0,0,0,0),rr}function or(t){return sr(new Date(t))}function ar(t){return ur(new Date(t))}function sr(t){return dn.count(ir(t.getFullYear())-1,t)}function ur(t){return yn.count(ir(t.getFullYear())-1,t)}function lr(t){return ir(t).getDay()}function cr(t,e,n,r,i,o,a){if(0<=t&&t<100){const s=new Date(-1,e,n,r,i,o,a);return s.setFullYear(t),s}return new Date(t,e,n,r,i,o,a)}function fr(t){return dr(new Date(t))}function hr(t){return pr(new Date(t))}function dr(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return pn.count(e-1,t)}function pr(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return Mn.count(e-1,t)}function gr(t){return rr.setTime(Date.UTC(t,0,1)),rr.getUTCDay()}function mr(t,e,n,r,i,o,a){if(0<=t&&t<100){const t=new Date(Date.UTC(-1,e,n,r,i,o,a));return t.setUTCFullYear(n.y),t}return new Date(Date.UTC(t,e,n,r,i,o,a))}function yr(t,e,n,r,i){const o=e||1,a=F(t),s=(t,e,i)=>function(t,e,n,r){const i=n<=1?t:r?(e,i)=>r+n*Math.floor((t(e,i)-r)/n):(e,r)=>n*Math.floor(t(e,r)/n);return e?(t,n)=>e(i(t,n),n):i}(n[i=i||t],r[i],t===a&&o,e),u=new Date,l=Tt(t),c=l[Pn]?s(Pn):rt(2012),f=l[In]?s(In):l[jn]?s(jn):h,p=l[Wn]&&l[Yn]?s(Yn,1,Wn+Yn):l[Wn]?s(Wn,1):l[Yn]?s(Yn,1):l[Hn]?s(Hn,1):l[Gn]?s(Gn,1):d,g=l[Vn]?s(Vn):h,m=l[Xn]?s(Xn):h,y=l[Jn]?s(Jn):h,v=l[Zn]?s(Zn):h;return function(t){u.setTime(+t);const e=c(u);return i(e,f(u),p(u,e),g(u),m(u),y(u),v(u))}}function vr(t,e,n){return e+7*t-(n+6)%7}const _r={[Pn]:t=>t.getFullYear(),[jn]:t=>Math.floor(t.getMonth()/3),[In]:t=>t.getMonth(),[Hn]:t=>t.getDate(),[Vn]:t=>t.getHours(),[Xn]:t=>t.getMinutes(),[Jn]:t=>t.getSeconds(),[Zn]:t=>t.getMilliseconds(),[Gn]:t=>sr(t),[Wn]:t=>ur(t),[Wn+Yn]:(t,e)=>vr(ur(t),t.getDay(),lr(e)),[Yn]:(t,e)=>vr(1,t.getDay(),lr(e))},xr={[jn]:t=>3*t,[Wn]:(t,e)=>vr(t,0,lr(e))};function br(t,e){return yr(t,e||1,_r,xr,cr)}const wr={[Pn]:t=>t.getUTCFullYear(),[jn]:t=>Math.floor(t.getUTCMonth()/3),[In]:t=>t.getUTCMonth(),[Hn]:t=>t.getUTCDate(),[Vn]:t=>t.getUTCHours(),[Xn]:t=>t.getUTCMinutes(),[Jn]:t=>t.getUTCSeconds(),[Zn]:t=>t.getUTCMilliseconds(),[Gn]:t=>dr(t),[Wn]:t=>pr(t),[Yn]:(t,e)=>vr(1,t.getUTCDay(),gr(e)),[Wn+Yn]:(t,e)=>vr(pr(t),t.getUTCDay(),gr(e))},kr={[jn]:t=>3*t,[Wn]:(t,e)=>vr(t,0,gr(e))};function Ar(t,e){return yr(t,e||1,wr,kr,mr)}const Mr={[Pn]:zn,[jn]:Tn.every(3),[In]:Tn,[Wn]:yn,[Hn]:dn,[Yn]:dn,[Gn]:dn,[Vn]:fn,[Xn]:ln,[Jn]:un,[Zn]:Ke},Er={[Pn]:Nn,[jn]:Bn.every(3),[In]:Bn,[Wn]:Mn,[Hn]:pn,[Yn]:pn,[Gn]:pn,[Vn]:hn,[Xn]:cn,[Jn]:un,[Zn]:Ke};function Dr(t){return Mr[t]}function Cr(t){return Er[t]}function Fr(t,e,n){return t?t.offset(e,n):void 0}function Sr(t,e,n){return Fr(Dr(t),e,n)}function $r(t,e,n){return Fr(Cr(t),e,n)}function Tr(t,e,n,r){return t?t.range(e,n,r):void 0}function Br(t,e,n,r){return Tr(Dr(t),e,n,r)}function zr(t,e,n,r){return Tr(Cr(t),e,n,r)}const Nr=1e3,Or=6e4,Rr=36e5,Lr=864e5,Ur=2592e6,qr=31536e6,Pr=[Pn,In,Hn,Vn,Xn,Jn,Zn],jr=Pr.slice(0,-1),Ir=jr.slice(0,-1),Wr=Ir.slice(0,-1),Hr=Wr.slice(0,-1),Yr=[Pn,In],Gr=[Pn],Vr=[[jr,1,Nr],[jr,5,5e3],[jr,15,15e3],[jr,30,3e4],[Ir,1,Or],[Ir,5,3e5],[Ir,15,9e5],[Ir,30,18e5],[Wr,1,Rr],[Wr,3,108e5],[Wr,6,216e5],[Wr,12,432e5],[Hr,1,Lr],[[Pn,Wn],1,6048e5],[Yr,1,Ur],[Yr,3,7776e6],[Gr,1,qr]];function Xr(t){const e=t.extent,n=t.maxbins||40,r=Math.abs(Et(e))/n;let i,o,a=te((t=>t[2])).right(Vr,r);return a===Vr.length?(i=Gr,o=xe(e[0]/qr,e[1]/qr,n)):a?(a=Vr[r/Vr[a-1][2]=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:bo,s:wo,S:Pi,u:ji,U:Ii,V:Hi,w:Yi,W:Gi,x:null,X:null,y:Vi,Y:Ji,Z:Qi,"%":xo},x={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return u[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:Ki,e:Ki,f:io,g:mo,G:vo,H:to,I:eo,j:no,L:ro,m:oo,M:ao,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:bo,s:wo,S:so,u:uo,U:lo,V:fo,w:ho,W:po,x:null,X:null,y:go,Y:yo,Z:_o,"%":xo},b={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=y.exec(e.slice(n));return r?(t.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=m.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:ki,e:ki,f:Fi,g:_i,G:vi,H:Mi,I:Mi,j:Ai,L:Ci,m:wi,M:Ei,p:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.p=c.get(r[0].toLowerCase()),n+r[0].length):-1},q:bi,Q:$i,s:Ti,S:Di,u:pi,U:gi,V:mi,w:di,W:yi,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:_i,Y:vi,Z:xi,"%":Si};function w(t,e){return function(n){var r,i,o,a=[],s=-1,u=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=Zr(Qr(o.y,0,1))).getUTCDay(),r=i>4||0===i?En.ceil(r):En(r),r=pn.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Jr(Qr(o.y,0,1))).getDay(),r=i>4||0===i?vn.ceil(r):vn(r),r=dn.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?Zr(Qr(o.y,0,1)).getUTCDay():Jr(Qr(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Zr(o)):Jr(o)}}function A(t,e,n,r){for(var i,o,a=0,s=e.length,u=n.length;a=u)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=b[i in oi?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return _.x=w(n,_),_.X=w(r,_),_.c=w(e,_),x.x=w(n,x),x.X=w(r,x),x.c=w(e,x),{format:function(t){var e=w(t+="",_);return e.toString=function(){return t},e},parse:function(t){var e=k(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",x);return e.toString=function(){return t},e},utcParse:function(t){var e=k(t+="",!0);return e.toString=function(){return t},e}}}var ti,ei,ni,ri,ii,oi={"-":"",_:" ",0:"0"},ai=/^\s*\d+/,si=/^%/,ui=/[\\^$*+?|[\]().{}]/g;function li(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[t.toLowerCase(),e])))}function di(t,e,n){var r=ai.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function pi(t,e,n){var r=ai.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function gi(t,e,n){var r=ai.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function mi(t,e,n){var r=ai.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function yi(t,e,n){var r=ai.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function vi(t,e,n){var r=ai.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function _i(t,e,n){var r=ai.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function xi(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function bi(t,e,n){var r=ai.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function wi(t,e,n){var r=ai.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ki(t,e,n){var r=ai.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Ai(t,e,n){var r=ai.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Mi(t,e,n){var r=ai.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Ei(t,e,n){var r=ai.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Di(t,e,n){var r=ai.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Ci(t,e,n){var r=ai.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Fi(t,e,n){var r=ai.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Si(t,e,n){var r=si.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function $i(t,e,n){var r=ai.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Ti(t,e,n){var r=ai.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Bi(t,e){return li(t.getDate(),e,2)}function zi(t,e){return li(t.getHours(),e,2)}function Ni(t,e){return li(t.getHours()%12||12,e,2)}function Oi(t,e){return li(1+dn.count(zn(t),t),e,3)}function Ri(t,e){return li(t.getMilliseconds(),e,3)}function Li(t,e){return Ri(t,e)+"000"}function Ui(t,e){return li(t.getMonth()+1,e,2)}function qi(t,e){return li(t.getMinutes(),e,2)}function Pi(t,e){return li(t.getSeconds(),e,2)}function ji(t){var e=t.getDay();return 0===e?7:e}function Ii(t,e){return li(yn.count(zn(t)-1,t),e,2)}function Wi(t){var e=t.getDay();return e>=4||0===e?bn(t):bn.ceil(t)}function Hi(t,e){return t=Wi(t),li(bn.count(zn(t),t)+(4===zn(t).getDay()),e,2)}function Yi(t){return t.getDay()}function Gi(t,e){return li(vn.count(zn(t)-1,t),e,2)}function Vi(t,e){return li(t.getFullYear()%100,e,2)}function Xi(t,e){return li((t=Wi(t)).getFullYear()%100,e,2)}function Ji(t,e){return li(t.getFullYear()%1e4,e,4)}function Zi(t,e){var n=t.getDay();return li((t=n>=4||0===n?bn(t):bn.ceil(t)).getFullYear()%1e4,e,4)}function Qi(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+li(e/60|0,"0",2)+li(e%60,"0",2)}function Ki(t,e){return li(t.getUTCDate(),e,2)}function to(t,e){return li(t.getUTCHours(),e,2)}function eo(t,e){return li(t.getUTCHours()%12||12,e,2)}function no(t,e){return li(1+pn.count(Nn(t),t),e,3)}function ro(t,e){return li(t.getUTCMilliseconds(),e,3)}function io(t,e){return ro(t,e)+"000"}function oo(t,e){return li(t.getUTCMonth()+1,e,2)}function ao(t,e){return li(t.getUTCMinutes(),e,2)}function so(t,e){return li(t.getUTCSeconds(),e,2)}function uo(t){var e=t.getUTCDay();return 0===e?7:e}function lo(t,e){return li(Mn.count(Nn(t)-1,t),e,2)}function co(t){var e=t.getUTCDay();return e>=4||0===e?Fn(t):Fn.ceil(t)}function fo(t,e){return t=co(t),li(Fn.count(Nn(t),t)+(4===Nn(t).getUTCDay()),e,2)}function ho(t){return t.getUTCDay()}function po(t,e){return li(En.count(Nn(t)-1,t),e,2)}function go(t,e){return li(t.getUTCFullYear()%100,e,2)}function mo(t,e){return li((t=co(t)).getUTCFullYear()%100,e,2)}function yo(t,e){return li(t.getUTCFullYear()%1e4,e,4)}function vo(t,e){var n=t.getUTCDay();return li((t=n>=4||0===n?Fn(t):Fn.ceil(t)).getUTCFullYear()%1e4,e,4)}function _o(){return"+0000"}function xo(){return"%"}function bo(t){return+t}function wo(t){return Math.floor(+t/1e3)}function ko(t){const e={};return n=>e[n]||(e[n]=t(n))}function Ao(t){const e=ko(t.format),n=t.formatPrefix;return{format:e,formatPrefix:n,formatFloat(t){const n=Oe(t||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return r=e(n),i=e(".1f")(1)[1],t=>{const e=r(t),n=e.indexOf(i);if(n<0)return e;let o=function(t,e){let n,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>e;)if(n=t.charCodeAt(r),n>=48&&n<=57)return r+1}(e,n);const a=on;)if("0"!==e[o]){++o;break}return e.slice(0,o)+a}}return e(n);var r,i},formatSpan(t,r,i,o){o=Oe(null==o?",f":o);const a=xe(t,r,i),s=Math.max(Math.abs(t),Math.abs(r));let u;if(null==o.precision)switch(o.type){case"s":return isNaN(u=Ve(a,s))||(o.precision=u),n(o,s);case"":case"e":case"g":case"p":case"r":isNaN(u=Xe(a,s))||(o.precision=u-("e"===o.type));break;case"f":case"%":isNaN(u=Ge(a))||(o.precision=u-2*("%"===o.type))}return e(o)}}}let Mo,Eo;function Do(){return Mo=Ao({format:je,formatPrefix:Ie})}function Co(t){return Ao(Ye(t))}function Fo(t){return arguments.length?Mo=Co(t):Mo}function So(t,e,n){A(n=n||{})||s(`Invalid time multi-format specifier: ${n}`);const r=e(Jn),i=e(Xn),o=e(Vn),a=e(Hn),u=e(Wn),l=e(In),c=e(jn),f=e(Pn),h=t(n[Zn]||".%L"),d=t(n[Jn]||":%S"),p=t(n[Xn]||"%I:%M"),g=t(n[Vn]||"%I %p"),m=t(n[Hn]||n[Yn]||"%a %d"),y=t(n[Wn]||"%b %d"),v=t(n[In]||"%B"),_=t(n[jn]||"%B"),x=t(n[Pn]||"%Y");return t=>(r(t)_t(t)?e(t):So(e,Dr,t),utcFormat:t=>_t(t)?n(t):So(n,Cr,t),timeParse:ko(t.parse),utcParse:ko(t.utcParse)}}function To(){return Eo=$o({format:ei,parse:ni,utcFormat:ri,utcParse:ii})}function Bo(t){return $o(Kr(t))}function zo(t){return arguments.length?Eo=Bo(t):Eo}!function(t){ti=Kr(t),ei=ti.format,ni=ti.parse,ri=ti.utcFormat,ii=ti.utcParse}({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"]}),Do(),To();const No=(t,e)=>ot({},t,e);function Oo(t,e){const n=t?Co(t):Fo(),r=e?Bo(e):zo();return No(n,r)}function Ro(t,e){const n=arguments.length;return n&&2!==n&&s("defaultLocale expects either zero or two arguments."),n?No(Fo(t),zo(e)):No(Fo(),zo())}const Lo=/^(data:|([A-Za-z]+:)?\/\/)/,Uo=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,qo=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Po="file://";async function jo(t,e){const n=await this.sanitize(t,e),r=n.href;return n.localFile?this.file(r):this.http(r,e)}async function Io(t,e){e=ot({},this.options,e);const n=this.fileAccess,r={href:null};let i,o,a;const u=Uo.test(t.replace(qo,""));null!=t&&"string"==typeof t&&u||s("Sanitize failure, invalid URI: "+Dt(t));const l=Lo.test(t);return(a=e.baseURL)&&!l&&(t.startsWith("/")||a.endsWith("/")||(t="/"+t),t=a+t),o=(i=t.startsWith(Po))||"file"===e.mode||"http"!==e.mode&&!l&&n,i?t=t.slice(Po.length):t.startsWith("//")&&("file"===e.defaultProtocol?(t=t.slice(2),o=!0):t=(e.defaultProtocol||"http")+":"+t),Object.defineProperty(r,"localFile",{value:!!o}),r.href=t,e.target&&(r.target=e.target+""),e.rel&&(r.rel=e.rel+""),"image"===e.context&&e.crossOrigin&&(r.crossOrigin=e.crossOrigin+""),r}function Wo(t){return Ho}async function Ho(){s("No file system access.")}function Yo(t){return t?async function(e,n){const r=ot({},this.options.http,n),i=n&&n.response,o=await t(e,r);return o.ok?J(o[i])?o[i]():o.text():s(o.status+""+o.statusText)}:Go}async function Go(){s("No HTTP fetch method available.")}const Vo=t=>null!=t&&t==t,Xo=t=>!(Number.isNaN(+t)||t instanceof Date),Jo={boolean:Ct,integer:S,number:S,date:St,string:$t,unknown:f},Zo=[t=>"true"===t||"false"===t||!0===t||!1===t,t=>Xo(t)&&Number.isInteger(+t),Xo,t=>!Number.isNaN(Date.parse(t))],Qo=["boolean","integer","number","date"];function Ko(t,e){if(!t||!t.length)return"unknown";const n=t.length,r=Zo.length,i=Zo.map(((t,e)=>e+1));for(let o,a,s=0,u=0;s0===t?e:t),0)-1]}function ta(t,e){return e.reduce(((e,n)=>(e[n]=Ko(t,n),e)),{})}function ea(t){const e=function(e,n){const r={delimiter:t};return na(e,n?ot(n,r):r)};return e.responseType="text",e}function na(t,e){return e.header&&(t=e.header.map(Dt).join(e.delimiter)+"\n"+t),Wt(e.delimiter).parse(t+"")}function ra(t,e){const n=e&&e.property?l(e.property):f;return!A(t)||(r=t,"function"==typeof Buffer&&J(Buffer.isBuffer)&&Buffer.isBuffer(r))?n(JSON.parse(t)):function(t,e){!k(t)&&mt(t)&&(t=[...t]);return e&&e.copy?JSON.parse(JSON.stringify(t)):t}(n(t),e);var r}na.responseType="text",ra.responseType="json";const ia={interior:(t,e)=>t!==e,exterior:(t,e)=>t===e};function oa(t,e){let n,r,i,o;return t=ra(t,e),e&&e.feature?(n=Yt,i=e.feature):e&&e.mesh?(n=Jt,i=e.mesh,o=ia[e.filter]):s("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[i])?n(t,r,o):s("Invalid TopoJSON object: "+i),r&&r.features||[r]}oa.responseType="json";const aa={dsv:na,csv:ea(","),tsv:ea("\t"),json:ra,topojson:oa};function sa(t,e){return arguments.length>1?(aa[t]=e,this):ut(aa,t)?aa[t]:null}function ua(t){const e=sa(t);return e&&e.responseType||"text"}function la(t,e,n,r){const i=sa((e=e||{}).type||"json");return i||s("Unknown data format type: "+e.type),t=i(t,e),e.parse&&function(t,e,n,r){if(!t.length)return;const i=zo();n=n||i.timeParse,r=r||i.utcParse;let o,a,s,u,l,c,f=t.columns||Object.keys(t[0]);"auto"===e&&(e=ta(t,f));f=Object.keys(e);const h=f.map((t=>{const i=e[t];let o,a;if(i&&(i.startsWith("date:")||i.startsWith("utc:"))){o=i.split(/:(.+)?/,2),a=o[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1));return("utc"===o[0]?r:n)(a)}if(!Jo[i])throw Error("Illegal format pattern: "+t+":"+i);return Jo[i]}));for(s=0,l=t.length,c=f.length;s({options:e||{},sanitize:Io,load:jo,fileAccess:!1,file:Wo(),http:Yo(t)})}("undefined"!=typeof fetch&&fetch);function fa(t){const e=t||f,n=[],r={};return n.add=t=>{const i=e(t);return r[i]||(r[i]=1,n.push(t)),n},n.remove=t=>{const i=e(t);if(r[i]){r[i]=0;const e=n.indexOf(t);e>=0&&n.splice(e,1)}return n},n}async function ha(t,e){try{await e(t)}catch(e){t.error(e)}}const da=Symbol("vega_id");let pa=1;function ga(t){return!(!t||!ma(t))}function ma(t){return t[da]}function ya(t,e){return t[da]=e,t}function va(t){const e=t===Object(t)?t:{data:t};return ma(e)?e:ya(e,pa++)}function _a(t){return xa(t,va({}))}function xa(t,e){for(const n in t)e[n]=t[n];return e}function ba(t,e){return ya(e,ma(t))}function wa(t,e){return t?e?(n,r)=>t(n,r)||ma(e(n))-ma(e(r)):(e,n)=>t(e,n)||ma(e)-ma(n):null}function ka(t){return t&&t.constructor===Aa}function Aa(){const t=[],e=[],n=[],r=[],i=[];let o=null,a=!1;return{constructor:Aa,insert(e){const n=V(e),r=n.length;for(let e=0;e{p(t)&&(l[ma(t)]=-1)}));for(f=0,h=t.length;f0&&(y(g,p,d.value),s.modifies(p));for(f=0,h=i.length;f{p(t)&&l[ma(t)]>0&&y(t,d.field,d.value)})),s.modifies(d.field);if(a)s.mod=e.length||r.length?u.filter((t=>l[ma(t)]>0)):u.slice();else for(m in c)s.mod.push(c[m]);return(o||null==o&&(e.length||r.length))&&s.clean(!0),s}}}const Ma="_:mod:_";function Ea(){Object.defineProperty(this,Ma,{writable:!0,value:{}})}Ea.prototype={set(t,e,n,r){const i=this,o=i[t],a=i[Ma];return null!=e&&e>=0?(o[e]!==n||r)&&(o[e]=n,a[e+":"+t]=-1,a[t]=-1):(o!==n||r)&&(i[t]=n,a[t]=k(n)?1+n.length:-1),i},modified(t,e){const n=this[Ma];if(!arguments.length){for(const t in n)if(n[t])return!0;return!1}if(k(t)){for(let e=0;e=0?e+1{a instanceof Fa?(a!==this&&(e&&a.targets().add(this),o.push(a)),i.push({op:a,name:t,index:n})):r.set(t,n,a)};for(a in t)if(u=t[a],"pulse"===a)V(u).forEach((t=>{t instanceof Fa?t!==this&&(t.targets().add(this),o.push(t)):s("Pulse parameters must be operator instances.")})),this.source=u;else if(k(u))for(r.set(a,-1,Array(l=u.length)),c=0;c{const n=Date.now();return n-e>t?(e=n,1):0}))},debounce(t){const e=Ba();return this.targets().add(Ba(null,null,it(t,(t=>{const n=t.dataflow;e.receive(t),n&&n.run&&n.run()})))),e},between(t,e){let n=!1;return t.targets().add(Ba(null,null,(()=>n=!0))),e.targets().add(Ba(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=p,this._targets=null}};const za={skip:!0};function Na(t,e,n,r,i,o){const a=ot({},o,za);let s,u;J(n)||(n=rt(n)),void 0===r?s=e=>t.touch(n(e)):J(r)?(u=new Fa(null,r,i,!1),s=e=>{u.evaluate(e);const r=n(e),i=u.value;ka(i)?t.pulse(r,i,o):t.update(r,i,a)}):s=e=>t.update(n(e),r,a),e.apply(s)}function Oa(t,e,n,r,i,o){if(void 0===r)e.targets().add(n);else{const a=o||{},s=new Fa(null,function(t,e){return e=J(e)?e:rt(e),t?function(n,r){const i=e(n,r);return t.skip()||(t.skip(i!==this.value).value=i),i}:e}(n,r),i,!1);s.modified(a.force),s.rank=e.rank,e.targets().add(s),n&&(s.skip(!0),s.value=n.value,s.targets().add(n),t.connect(n,[s]))}}const Ra={};function La(t,e,n){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function Ua(t,e){const n=[];return zt(t,e,(t=>n.push(t))),n}function qa(t,e){const n={};return t.visit(e,(t=>{n[ma(t)]=1})),t=>n[ma(t)]?null:t}function Pa(t,e){return t?(n,r)=>t(n,r)&&e(n,r):e}function ja(t,e,n,r){const i=this;let o=0;this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,this.pulses=n;for(const t of n)if(t.stamp===e){if(t.fields){const e=i.fields||(i.fields={});for(const n in t.fields)e[n]=1}t.changed(i.ADD)&&(o|=i.ADD),t.changed(i.REM)&&(o|=i.REM),t.changed(i.MOD)&&(o|=i.MOD)}this.changes=o}function Ia(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}La.prototype={StopPropagation:Ra,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(t){return new La(this.dataflow).init(this,t)},clone(){const t=this.fork(7);return t.add=t.add.slice(),t.rem=t.rem.slice(),t.mod=t.mod.slice(),t.source&&(t.source=t.source.slice()),t.materialize(23)},addAll(){let t=this;return!t.source||t.add===t.rem||!t.rem.length&&t.source.length===t.add.length||(t=new La(this.dataflow).init(this),t.add=t.source,t.rem=[]),t},init(t,e){const n=this;return n.stamp=t.stamp,n.encode=t.encode,!t.fields||64&e||(n.fields=t.fields),1&e?(n.addF=t.addF,n.add=t.add):(n.addF=null,n.add=[]),2&e?(n.remF=t.remF,n.rem=t.rem):(n.remF=null,n.rem=[]),4&e?(n.modF=t.modF,n.mod=t.mod):(n.modF=null,n.mod=[]),32&e?(n.srcF=null,n.source=null):(n.srcF=t.srcF,n.source=t.source,t.cleans&&(n.cleans=t.cleans)),n},runAfter(t){this.dataflow.runAfter(t)},changed(t){const e=t||7;return 1&e&&this.add.length||2&e&&this.rem.length||4&e&&this.mod.length},reflow(t){if(t)return this.fork(7).reflow();const e=this.add.length,n=this.source&&this.source.length;return n&&n!==e&&(this.mod=this.source,e&&this.filter(4,qa(this,1))),this},clean(t){return arguments.length?(this.cleans=!!t,this):this.cleans},modifies(t){const e=this.fields||(this.fields={});return k(t)?t.forEach((t=>e[t]=!0)):e[t]=!0,this},modified(t,e){const n=this.fields;return!(!e&&!this.mod.length||!n)&&(arguments.length?k(t)?t.some((t=>n[t])):n[t]:!!n)},filter(t,e){const n=this;return 1&t&&(n.addF=Pa(n.addF,e)),2&t&&(n.remF=Pa(n.remF,e)),4&t&&(n.modF=Pa(n.modF,e)),16&t&&(n.srcF=Pa(n.srcF,e)),n},materialize(t){const e=this;return 1&(t=t||7)&&e.addF&&(e.add=Ua(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=Ua(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=Ua(e.mod,e.modF),e.modF=null),16&t&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},visit(t,e){const n=this,r=e;if(16&t)return zt(n.source,n.srcF,r),n;1&t&&zt(n.add,n.addF,r),2&t&&zt(n.rem,n.remF,r),4&t&&zt(n.mod,n.modF,r);const i=n.source;if(8&t&&i){const t=n.add.length+n.mod.length;t===i.length||zt(i,t?qa(n,5):n.srcF,r)}return n}},ht(ja,La,{fork(t){const e=new La(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&e.ADD&&this.visit(e.ADD,(t=>e.add.push(t))),t&e.REM&&this.visit(e.REM,(t=>e.rem.push(t))),t&e.MOD&&this.visit(e.MOD,(t=>e.mod.push(t)))),e},changed(t){return this.changes&t},modified(t){const e=this,n=e.fields;return n&&e.changes&e.MOD?k(t)?t.some((t=>n[t])):n[t]:0},filter(){s("MultiPulse does not support filtering.")},materialize(){s("MultiPulse does not support materialization.")},visit(t,e){const n=this,r=n.pulses,i=r.length;let o=0;if(t&n.SOURCE)for(;oe=[],size:()=>e.length,peek:()=>e[0],push:n=>(e.push(n),Ya(e,0,e.length-1,t)),pop:()=>{const n=e.pop();let r;return e.length?(r=e[0],e[0]=n,function(t,e,n){const r=e,i=t.length,o=t[e];let a,s=1+(e<<1);for(;s=0&&(s=a),t[e]=t[s],s=1+((e=s)<<1);t[e]=o,Ya(t,r,e,n)}(e,0,t)):r=n,r}}}function Ya(t,e,n,r){let i,o;const a=t[n];for(;n>e&&(o=n-1>>1,i=t[o],r(a,i)<0);)t[n]=i,n=o;return t[n]=a}function Ga(){this.logger(w()),this.logLevel(v),this._clock=0,this._rank=0,this._locale=Ro();try{this._loader=ca()}catch(t){}this._touched=fa(c),this._input={},this._pulse=null,this._heap=Ha(((t,e)=>t.qrank-e.qrank)),this._postrun=[]}function Va(t){return function(){return this._log[t].apply(this,arguments)}}function Xa(t,e){Fa.call(this,t,null,e)}Ga.prototype={stamp(){return this._clock},loader(t){return arguments.length?(this._loader=t,this):this._loader},locale(t){return arguments.length?(this._locale=t,this):this._locale},logger(t){return arguments.length?(this._log=t,this):this._log},error:Va("error"),warn:Va("warn"),info:Va("info"),debug:Va("debug"),logLevel:Va("level"),cleanThreshold:1e4,add:function(t,e,n,r){let i,o=1;return t instanceof Fa?i=t:t&&t.prototype instanceof Fa?i=new t:J(t)?i=new Fa(null,t):(o=0,i=new Fa(t,e)),this.rank(i),o&&(r=n,n=e),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},connect:function(t,e){const n=t.rank,r=e.length;for(let i=0;i=0;)e.push(n=r[i]),n===t&&s("Cycle detected in dataflow graph.")},pulse:function(t,e,n){this.touch(t,n||Wa);const r=new La(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=e.pulse(r,i),this},touch:function(t,e){const n=e||Wa;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},update:function(t,e,n){const r=n||Wa;return(t.set(e)||r.force)&&this.touch(t,r),this},changeset:Aa,ingest:function(t,e,n){return e=this.parse(e,n),this.pulse(t,this.changeset().insert(e))},parse:function(t,e){const n=this.locale();return la(t,e,n.timeParse,n.utcParse)},preload:async function(t,e,n){const r=this,i=r._pending||function(t){let e;const n=new Promise((t=>e=t));return n.requests=0,n.done=()=>{0==--n.requests&&(t._pending=null,e(t))},t._pending=n}(r);i.requests+=1;const o=await r.request(e,n);return r.pulse(t,r.changeset().remove(p).insert(o.data||[])),i.done(),o},request:async function(t,e){const n=this;let r,i=0;try{r=await n.loader().load(t,{context:"dataflow",response:ua(e&&e.type)});try{r=n.parse(r,e)}catch(e){i=-2,n.warn("Data ingestion failed",t,e)}}catch(e){i=-1,n.warn("Loading failed",t,e)}return{data:r,status:i}},events:function(t,e,n,r){const i=this,o=Ba(n,r),a=function(t){t.dataflow=i;try{o.receive(t)}catch(t){i.error(t)}finally{i.run()}};let s;s="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):V(t);const u=s.length;for(let t=0;tr._enqueue(t,!0))),r._touched=fa(c);let a,s,u,l=0;try{for(;r._heap.size()>0;)a=r._heap.pop(),a.rank===a.qrank?(s=a.run(r._getPulse(a,t)),s.then?s=await s:s.async&&(i.push(s.async),s=Ra),s!==Ra&&a._targets&&a._targets.forEach((t=>r._enqueue(t))),++l):r._enqueue(a,!0)}catch(t){r._heap.clear(),u=t}if(r._input={},r._pulse=null,r.debug(`Pulse ${o}: ${l} operators`),u&&(r._postrun=[],r.error(u)),r._postrun.length){const t=r._postrun.sort(((t,e)=>e.priority-t.priority));r._postrun=[];for(let e=0;er.runAsync(null,(()=>{t.forEach((t=>{try{t(r)}catch(t){r.error(t)}}))})))),r},run:function(t,e,n){return this._pulse?Ia(this):(this.evaluate(t,e,n),this)},runAsync:async function(t,e,n){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,e,n)).then(r,r),this._running},runAfter:function(t,e,n){if(this._pulse||e)this._postrun.push({priority:n||0,callback:t});else try{t(this)}catch(t){this.error(t)}},_enqueue:function(t,e){const n=t.stampt.pulse)),e):this._input[t.id]||function(t,e){if(e&&e.stamp===t.stamp)return e;t=t.fork(),e&&e!==Ra&&(t.source=e.source);return t}(this._pulse,n&&n.pulse)}},ht(Xa,Fa,{run(t){if(t.stampthis.pulse=t)):e!==t.StopPropagation&&(this.pulse=e),e},evaluate(t){const e=this.marshall(t.stamp),n=this.transform(e,t);return e.clear(),n},transform(){}});const Ja={};function Za(t){const e=Qa(t);return e&&e.Definition||null}function Qa(t){return t=t&&t.toLowerCase(),ut(Ja,t)?Ja[t]:null}function*Ka(t,e){if(null==e)for(let e of t)null!=e&&""!==e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)r=e(r,++n,t),null!=r&&""!==r&&(r=+r)>=r&&(yield r)}}function ts(t,e,n){const r=Float64Array.from(Ka(t,n));return r.sort(Qt),e.map((t=>Ee(r,t)))}function es(t,e){return ts(t,[.25,.5,.75],e)}function ns(t,e){const n=t.length,r=function(t,e){const n=function(t,e){let n,r=0,i=0,o=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,o+=n*(e-i));else{let a=-1;for(let s of t)null!=(s=e(s,++a,t))&&(s=+s)>=s&&(n=s-i,i+=n/++r,o+=n*(s-i))}if(r>1)return o/(r-1)}(t,e);return n?Math.sqrt(n):n}(t,e),i=es(t,e),o=(i[2]-i[0])/1.34;return 1.06*(Math.min(r,o)||r||Math.abs(i[0])||1)*Math.pow(n,-.2)}function rs(t){const e=t.maxbins||20,n=t.base||10,r=Math.log(n),i=t.divide||[5,2];let o,a,s,u,l,c,f=t.extent[0],h=t.extent[1];const d=t.span||h-f||Math.abs(f)||1;if(t.step)o=t.step;else if(t.steps){for(u=d/e,l=0,c=t.steps.length;le;)o*=n;for(l=0,c=i.length;l=s&&d/u<=e&&(o=u)}u=Math.log(o);const p=u>=0?0:1+~~(-u/r),g=Math.pow(n,-p-1);return(t.nice||void 0===t.nice)&&(u=Math.floor(f/o+g)*o,f=ft);const i=t.length,o=new Float64Array(i);let a,s=0,u=1,l=r(t[0]),c=l,f=l+e;for(;u=f){for(c=(l+c)/2;s>1);ia;)t[i--]=t[o]}o=a,a=r}return t}(o,e+e/4):o}t.random=Math.random;const as=Math.sqrt(2*Math.PI),ss=Math.SQRT2;let us=NaN;function ls(e,n){e=e||0,n=null==n?1:n;let r,i,o=0,a=0;if(us==us)o=us,us=NaN;else{do{o=2*t.random()-1,a=2*t.random()-1,r=o*o+a*a}while(0===r||r>1);i=Math.sqrt(-2*Math.log(r)/r),o*=i,us=a*i}return e+o*n}function cs(t,e,n){const r=(t-(e||0))/(n=null==n?1:n);return Math.exp(-.5*r*r)/(n*as)}function fs(t,e,n){const r=(t-(e=e||0))/(n=null==n?1:n),i=Math.abs(r);let o;if(i>37)o=0;else{const t=Math.exp(-i*i/2);let e;i<7.07106781186547?(e=.0352624965998911*i+.700383064443688,e=e*i+6.37396220353165,e=e*i+33.912866078383,e=e*i+112.079291497871,e=e*i+221.213596169931,e=e*i+220.206867912376,o=t*e,e=.0883883476483184*i+1.75566716318264,e=e*i+16.064177579207,e=e*i+86.7807322029461,e=e*i+296.564248779674,e=e*i+637.333633378831,e=e*i+793.826512519948,e=e*i+440.413735824752,o/=e):(e=i+.65,e=i+4/e,e=i+3/e,e=i+2/e,e=i+1/e,o=t/e/2.506628274631)}return r>0?1-o:o}function hs(t,e,n){return t<0||t>1?NaN:(e||0)+(null==n?1:n)*ss*function(t){let e,n=-Math.log((1-t)*(1+t));n<6.25?(n-=3.125,e=-364441206401782e-35,e=e*n-16850591381820166e-35,e=128584807152564e-32+e*n,e=11157877678025181e-33+e*n,e=e*n-1333171662854621e-31,e=20972767875968562e-33+e*n,e=6637638134358324e-30+e*n,e=e*n-4054566272975207e-29,e=e*n-8151934197605472e-29,e=26335093153082323e-28+e*n,e=e*n-12975133253453532e-27,e=e*n-5415412054294628e-26,e=1.0512122733215323e-9+e*n,e=e*n-4.112633980346984e-9,e=e*n-2.9070369957882005e-8,e=4.2347877827932404e-7+e*n,e=e*n-13654692000834679e-22,e=e*n-13882523362786469e-21,e=.00018673420803405714+e*n,e=e*n-.000740702534166267,e=e*n-.006033670871430149,e=.24015818242558962+e*n,e=1.6536545626831027+e*n):n<16?(n=Math.sqrt(n)-3.25,e=2.2137376921775787e-9,e=9.075656193888539e-8+e*n,e=e*n-2.7517406297064545e-7,e=1.8239629214389228e-8+e*n,e=15027403968909828e-22+e*n,e=e*n-4013867526981546e-21,e=29234449089955446e-22+e*n,e=12475304481671779e-21+e*n,e=e*n-47318229009055734e-21,e=6828485145957318e-20+e*n,e=24031110387097894e-21+e*n,e=e*n-.0003550375203628475,e=.0009532893797373805+e*n,e=e*n-.0016882755560235047,e=.002491442096107851+e*n,e=e*n-.003751208507569241,e=.005370914553590064+e*n,e=1.0052589676941592+e*n,e=3.0838856104922208+e*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,e=-27109920616438573e-27,e=e*n-2.555641816996525e-10,e=1.5076572693500548e-9+e*n,e=e*n-3.789465440126737e-9,e=7.61570120807834e-9+e*n,e=e*n-1.496002662714924e-8,e=2.914795345090108e-8+e*n,e=e*n-6.771199775845234e-8,e=2.2900482228026655e-7+e*n,e=e*n-9.9298272942317e-7,e=4526062597223154e-21+e*n,e=e*n-1968177810553167e-20,e=7599527703001776e-20+e*n,e=e*n-.00021503011930044477,e=e*n-.00013871931833623122,e=1.0103004648645344+e*n,e=4.849906401408584+e*n):e=1/0;return e*t}(2*t-1)}function ds(t,e){let n,r;const i={mean(t){return arguments.length?(n=t||0,i):n},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>ls(n,r),pdf:t=>cs(t,n,r),cdf:t=>fs(t,n,r),icdf:t=>hs(t,n,r)};return i.mean(t).stdev(e)}function ps(e,n){const r=ds();let i=0;const o={data(t){return arguments.length?(e=t,i=t?t.length:0,o.bandwidth(n)):e},bandwidth(t){return arguments.length?(!(n=t)&&e&&(n=ns(e)),o):n},sample:()=>e[~~(t.random()*i)]+n*r.sample(),pdf(t){let o=0,a=0;for(;ags(n,r),pdf:t=>ms(t,n,r),cdf:t=>ys(t,n,r),icdf:t=>vs(t,n,r)};return i.mean(t).stdev(e)}function xs(e,n){let r,i=0;const o={weights(t){return arguments.length?(r=function(t){const e=[];let n,r=0;for(n=0;n=e&&t<=n?1/(n-e):0}function ks(t,e,n){return null==n&&(n=null==e?1:e,e=0),tn?1:(t-e)/(n-e)}function As(t,e,n){return null==n&&(n=null==e?1:e,e=0),t>=0&&t<=1?e+t*(n-e):NaN}function Ms(t,e){let n,r;const i={min(t){return arguments.length?(n=t||0,i):n},max(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>bs(n,r),pdf:t=>ws(t,n,r),cdf:t=>ks(t,n,r),icdf:t=>As(t,n,r)};return null==e&&(e=null==t?1:t,t=0),i.min(t).max(e)}function Es(t,e,n){let r=0,i=0;for(const o of t){const t=n(o);null==e(o)||null==t||isNaN(t)||(r+=(t-r)/++i)}return{coef:[r],predict:()=>r,rSquared:0}}function Ds(t,e,n,r){const i=r-t*t,o=Math.abs(i)<1e-24?0:(n-t*e)/i;return[e-o*t,o]}function Cs(t,e,n,r){t=t.filter((t=>{let r=e(t),i=n(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i})),r&&t.sort(((t,n)=>e(t)-e(n)));const i=t.length,o=new Float64Array(i),a=new Float64Array(i);let s,u,l,c=0,f=0,h=0;for(l of t)o[c]=s=+e(l),a[c]=u=+n(l),++c,f+=(s-f)/c,h+=(u-h)/c;for(c=0;c=i&&null!=o&&(o=+o)>=o&&r(i,o,++a)}function Ss(t,e,n,r,i){let o=0,a=0;return Fs(t,e,n,((t,e)=>{const n=e-i(t),s=e-r;o+=n*n,a+=s*s})),1-o/a}function $s(t,e,n){let r=0,i=0,o=0,a=0,s=0;Fs(t,e,n,((t,e)=>{++s,r+=(t-r)/s,i+=(e-i)/s,o+=(t*e-o)/s,a+=(t*t-a)/s}));const u=Ds(r,i,o,a),l=t=>u[0]+u[1]*t;return{coef:u,predict:l,rSquared:Ss(t,e,n,i,l)}}function Ts(t,e,n){let r=0,i=0,o=0,a=0,s=0;Fs(t,e,n,((t,e)=>{++s,t=Math.log(t),r+=(t-r)/s,i+=(e-i)/s,o+=(t*e-o)/s,a+=(t*t-a)/s}));const u=Ds(r,i,o,a),l=t=>u[0]+u[1]*Math.log(t);return{coef:u,predict:l,rSquared:Ss(t,e,n,i,l)}}function Bs(t,e,n){const[r,i,o,a]=Cs(t,e,n);let s,u,l,c=0,f=0,h=0,d=0,p=0;Fs(t,e,n,((t,e)=>{s=r[p++],u=Math.log(e),l=s*e,c+=(e*u-c)/p,f+=(l-f)/p,h+=(l*u-h)/p,d+=(s*l-d)/p}));const[g,m]=Ds(f/a,c/a,h/a,d/a),y=t=>Math.exp(g+m*(t-o));return{coef:[Math.exp(g-m*o),m],predict:y,rSquared:Ss(t,e,n,a,y)}}function zs(t,e,n){let r=0,i=0,o=0,a=0,s=0,u=0;Fs(t,e,n,((t,e)=>{const n=Math.log(t),l=Math.log(e);++u,r+=(n-r)/u,i+=(l-i)/u,o+=(n*l-o)/u,a+=(n*n-a)/u,s+=(e-s)/u}));const l=Ds(r,i,o,a),c=t=>l[0]*Math.pow(t,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Ss(t,e,n,s,c)}}function Ns(t,e,n){const[r,i,o,a]=Cs(t,e,n),s=r.length;let u,l,c,f,h=0,d=0,p=0,g=0,m=0;for(u=0;u_*(t-=o)*t+x*t+b+a;return{coef:[b-x*o+_*o*o+a,x-2*_*o,_],predict:w,rSquared:Ss(t,e,n,a,w)}}function Os(t,e,n,r){if(0===r)return Es(t,e,n);if(1===r)return $s(t,e,n);if(2===r)return Ns(t,e,n);const[i,o,a,s]=Cs(t,e,n),u=i.length,l=[],c=[],f=r+1;let h,d,p,g,m;for(h=0;hMath.abs(t[r][a])&&(a=i);for(o=r;o=r;o--)t[o][i]-=t[o][r]*t[r][i]/t[r][r]}for(i=e-1;i>=0;--i){for(s=0,o=i+1;o{t-=a;let e=s+y[0]+y[1]*t+y[2]*t*t;for(h=3;h=0;--o)for(s=e[o],u=1,i[o]+=s,a=1;a<=o;++a)u*=(o+1-a)/a,i[o-a]+=s*Math.pow(n,a)*u;return i[0]+=r,i}function Ls(t,e,n,r){const[i,o,a,s]=Cs(t,e,n,!0),u=i.length,l=Math.max(2,~~(r*u)),c=new Float64Array(u),f=new Float64Array(u),h=new Float64Array(u).fill(1);for(let t=-1;++t<=2;){const e=[0,l-1];for(let t=0;ti[a]-n?r:a;let u=0,l=0,d=0,p=0,g=0;const m=1/Math.abs(i[s]-n||1);for(let t=r;t<=a;++t){const e=i[t],r=o[t],a=Us(Math.abs(n-e)*m)*h[t],s=e*a;u+=a,l+=s,d+=r*a,p+=r*s,g+=e*s}const[y,v]=Ds(l/u,d/u,p/u,g/u);c[t]=y+v*n,f[t]=Math.abs(o[t]-c[t]),qs(i,t+1,e)}if(2===t)break;const n=De(f);if(Math.abs(n)<1e-12)break;for(let t,e,r=0;r=1?1e-12:(e=1-t*t)*e}return function(t,e,n,r){const i=t.length,o=[];let a,s=0,u=0,l=[];for(;s=t.length))for(;e>i&&t[o]-r<=r-t[i];)n[0]=++i,n[1]=o,++o}const Ps=.5*Math.PI/180;function js(t,e,n,r){n=n||25,r=Math.max(n,r||200);const i=e=>[e,t(e)],o=e[0],a=e[1],s=a-o,u=s/r,l=[i(o)],c=[];if(n===r){for(let t=1;t0;)c.push(i(o+t/n*s));let f=l[0],h=c[c.length-1];const d=1/s,p=function(t,e){let n=t,r=t;const i=e.length;for(let t=0;tr&&(r=i)}return 1/(r-n)}(f[1],c);for(;h;){const t=i((f[0]+h[0])/2);t[0]-f[0]>=u&&Is(f,t,h,d,p)>Ps?c.push(t):(f=h,l.push(h),c.pop()),h=c[c.length-1]}return l}function Is(t,e,n,r,i){const o=Math.atan2(i*(n[1]-t[1]),r*(n[0]-t[0])),a=Math.atan2(i*(e[1]-t[1]),r*(e[0]-t[0]));return Math.abs(o-a)}function Ws(t){return t&&t.length?1===t.length?t[0]:(e=t,t=>{const n=e.length;let r=1,i=String(e[0](t));for(;r{},Gs={init:Ys,add:Ys,rem:Ys,idx:0},Vs={values:{init:t=>t.cell.store=!0,value:t=>t.cell.data.values(),idx:-1},count:{value:t=>t.cell.num},__count__:{value:t=>t.missing+t.valid},missing:{value:t=>t.missing},valid:{value:t=>t.valid},sum:{init:t=>t.sum=0,value:t=>t.valid?t.sum:void 0,add:(t,e)=>t.sum+=+e,rem:(t,e)=>t.sum-=e},product:{init:t=>t.product=1,value:t=>t.valid?t.product:void 0,add:(t,e)=>t.product*=e,rem:(t,e)=>t.product/=e},mean:{init:t=>t.mean=0,value:t=>t.valid?t.mean:void 0,add:(t,e)=>(t.mean_d=e-t.mean,t.mean+=t.mean_d/t.valid),rem:(t,e)=>(t.mean_d=e-t.mean,t.mean-=t.valid?t.mean_d/t.valid:t.mean)},average:{value:t=>t.valid?t.mean:void 0,req:["mean"],idx:1},variance:{init:t=>t.dev=0,value:t=>t.valid>1?t.dev/(t.valid-1):void 0,add:(t,e)=>t.dev+=t.mean_d*(e-t.mean),rem:(t,e)=>t.dev-=t.mean_d*(e-t.mean),req:["mean"],idx:1},variancep:{value:t=>t.valid>1?t.dev/t.valid:void 0,req:["variance"],idx:2},stdev:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:t=>t.valid>1?Math.sqrt(t.dev/t.valid):void 0,req:["variance"],idx:2},stderr:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid*(t.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:t=>t.cell.data.distinct(t.get),req:["values"],idx:3},ci0:{value:t=>t.cell.data.ci0(t.get),req:["values"],idx:3},ci1:{value:t=>t.cell.data.ci1(t.get),req:["values"],idx:3},median:{value:t=>t.cell.data.q2(t.get),req:["values"],idx:3},q1:{value:t=>t.cell.data.q1(t.get),req:["values"],idx:3},q3:{value:t=>t.cell.data.q3(t.get),req:["values"],idx:3},min:{init:t=>t.min=void 0,value:t=>t.min=Number.isNaN(t.min)?t.cell.data.min(t.get):t.min,add:(t,e)=>{(e{e<=t.min&&(t.min=NaN)},req:["values"],idx:4},max:{init:t=>t.max=void 0,value:t=>t.max=Number.isNaN(t.max)?t.cell.data.max(t.get):t.max,add:(t,e)=>{(e>t.max||void 0===t.max)&&(t.max=e)},rem:(t,e)=>{e>=t.max&&(t.max=NaN)},req:["values"],idx:4},argmin:{init:t=>t.argmin=void 0,value:t=>t.argmin||t.cell.data.argmin(t.get),add:(t,e,n)=>{e{e<=t.min&&(t.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:t=>t.argmax=void 0,value:t=>t.argmax||t.cell.data.argmax(t.get),add:(t,e,n)=>{e>t.max&&(t.argmax=n)},rem:(t,e)=>{e>=t.max&&(t.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(t,e)=>{t.exp=0,t.exp_r=e},value:t=>t.valid?t.exp*(1-t.exp_r)/(1-t.exp_r**t.valid):void 0,add:(t,e)=>t.exp=t.exp_r*t.exp+e,rem:(t,e)=>t.exp=(t.exp-e/t.exp_r**(t.valid-1))/t.exp_r},exponentialb:{value:t=>t.valid?t.exp*(1-t.exp_r):void 0,req:["exponential"],idx:1}},Xs=Object.keys(Vs).filter((t=>"__count__"!==t));function Js(t,e,n){return Vs[t](n,e)}function Zs(t,e){return t.idx-e.idx}function Qs(){this.valid=0,this.missing=0,this._ops.forEach((t=>null==t.aggregate_param?t.init(this):t.init(this,t.aggregate_param)))}function Ks(t,e){null!=t&&""!==t?t==t&&(++this.valid,this._ops.forEach((n=>n.add(this,t,e)))):++this.missing}function tu(t,e){null!=t&&""!==t?t==t&&(--this.valid,this._ops.forEach((n=>n.rem(this,t,e)))):--this.missing}function eu(t){return this._out.forEach((e=>t[e.out]=e.value(this))),t}function nu(t,e){const n=e||f,r=function(t){const e={};t.forEach((t=>e[t.name]=t));const n=t=>{t.req&&t.req.forEach((t=>{e[t]||n(e[t]=Vs[t]())}))};return t.forEach(n),Object.values(e).sort(Zs)}(t),i=t.slice().sort(Zs);function o(t){this._ops=r,this._out=i,this.cell=t,this.init()}return o.prototype.init=Qs,o.prototype.add=Ks,o.prototype.rem=tu,o.prototype.set=eu,o.prototype.get=n,o.fields=t.map((t=>t.out)),o}function ru(t){this._key=t?l(t):ma,this.reset()}[...Xs,"__count__"].forEach((t=>{Vs[t]=function(t,e){return(n,r)=>ot({name:t,aggregate_param:r,out:n||t},Gs,e)}(t,Vs[t])}));const iu=ru.prototype;function ou(t){Xa.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}iu.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},iu.add=function(t){this._add.push(t)},iu.rem=function(t){this._rem.push(t)},iu.values=function(){if(this._get=null,0===this._rem.length)return this._add;const t=this._add,e=this._rem,n=this._key,r=t.length,i=e.length,o=Array(r-i),a={};let s,u,l;for(s=0;s=0;)r=t(e[i])+"",ut(n,r)||(n[r]=1,++o);return o},iu.extent=function(t){if(this._get!==t||!this._ext){const e=this.values(),n=st(e,t);this._ext=[e[n[0]],e[n[1]]],this._get=t}return this._ext},iu.argmin=function(t){return this.extent(t)[0]||{}},iu.argmax=function(t){return this.extent(t)[1]||{}},iu.min=function(t){const e=this.extent(t)[0];return null!=e?t(e):void 0},iu.max=function(t){const e=this.extent(t)[1];return null!=e?t(e):void 0},iu.quartile=function(t){return this._get===t&&this._q||(this._q=es(this.values(),t),this._get=t),this._q},iu.q1=function(t){return this.quartile(t)[0]},iu.q2=function(t){return this.quartile(t)[1]},iu.q3=function(t){return this.quartile(t)[2]},iu.ci=function(t){return this._get===t&&this._ci||(this._ci=is(this.values(),1e3,.05,t),this._get=t),this._ci},iu.ci0=function(t){return this.ci(t)[0]},iu.ci1=function(t){return this.ci(t)[1]},ou.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Xs},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},ht(ou,Xa,{transform(t,e){const n=this,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.modified();return n.stamp=r.stamp,n.value&&(i||e.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(t):Object.create(null),e.visit(e.SOURCE,(t=>n.add(t)))):(n.value=n.value||n.init(t),e.visit(e.REM,(t=>n.rem(t))),e.visit(e.ADD,(t=>n.add(t)))),r.modifies(n._outputs),n._drop=!1!==t.drop,t.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),e.clean()&&n._drop&&r.clean(!0).runAfter((()=>this.clean())),n.changes(r)},cross(){const t=this,e=t.value,n=t._dnames,r=n.map((()=>({}))),i=n.length;function o(t){let e,o,a,s;for(e in t)for(a=t[e].tuple,o=0;o{const e=n(t);return a(t),i.push(e),e})),this.cellkey=t.key?t.key:Ws(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const u=t.fields||[null],l=t.ops||["count"],c=t.aggregate_params||[null],f=t.as||[],h=u.length,d={};let p,g,m,y,v,_,x;for(h!==l.length&&s("Unmatched number of fields and aggregate ops."),x=0;xnu(t,t.field))),Object.create(null)},cellkey:Ws(),cell(t,e){let n=this.value[t];return n?0===n.num&&this._drop&&n.stampo.push(t),remove:t=>a[r(t)]=++s,size:()=>i.length,data:(t,e)=>(s&&(i=i.filter((t=>!a[r(t)])),a={},s=0),e&&t&&i.sort(t),o.length&&(i=t?kt(t,i,o.sort(t)):i.concat(o),o=[]),i)}}function uu(t){Xa.call(this,[],t)}function lu(t){Fa.call(this,null,cu,t)}function cu(t){return this.value&&!t.modified()?this.value:Q(t.fields,t.orders)}function fu(t){Xa.call(this,null,t)}function hu(t){Xa.call(this,null,t)}au.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"span",type:"number"},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]},ht(au,Xa,{transform(t,e){const n=!1!==t.interval,i=this._bins(t),o=i.start,a=i.step,s=t.as||["bin0","bin1"],u=s[0],l=s[1];let c;return c=t.modified()?(e=e.reflow(!0)).SOURCE:e.modified(r(t.field))?e.ADD_MOD:e.ADD,e.visit(c,n?t=>{const e=i(t);t[u]=e,t[l]=null==e?null:o+a*(1+(e-o)/a)}:t=>t[u]=i(t)),e.modifies(n?s:u)},_bins(t){if(this.value&&!t.modified())return this.value;const i=t.field,o=rs(t),a=o.step;let s,u,l=o.start,c=l+Math.ceil((o.stop-l)/a)*a;null!=(s=t.anchor)&&(u=s-(l+a*Math.floor((s-l)/a)),l+=u,c+=u);const f=function(t){let e=S(i(t));return null==e?null:ec?1/0:(e=Math.max(l,Math.min(e,c-a)),l+a*Math.floor(1e-14+(e-l)/a))};return f.start=l,f.stop=o.stop,f.step=a,this.value=e(f,r(i),t.name||"bin_"+n(i))}}),uu.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},ht(uu,Xa,{transform(t,e){const n=e.fork(e.ALL),r=su(ma,this.value,n.materialize(n.ADD).add),i=t.sort,o=e.changed()||i&&(t.modified("sort")||e.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(o),this.value=n.source=r.data(wa(i),o),e.source&&e.source.root&&(this.value.root=e.source.root),n}}),ht(lu,Fa),fu.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},ht(fu,Xa,{transform(t,e){const n=e=>n=>{for(var r,i=function(t,e,n){switch(e){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(n)}(s(n),t.case,o)||[],u=0,l=i.length;ui[t]=1+(i[t]||0))),c=n((t=>i[t]-=1));return r?e.visit(e.SOURCE,l):(e.visit(e.ADD,l),e.visit(e.REM,c)),this._finish(e,u)},_parameterCheck(t,e){let n=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),n=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),n=!0),(t.modified("field")||e.modified(t.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(t,e){const n=this._counts,r=this._tuples||(this._tuples={}),i=e[0],o=e[1],a=t.fork(t.NO_SOURCE|t.NO_FIELDS);let s,u,l;for(s in n)u=r[s],l=n[s]||0,!u&&l?(r[s]=u=va({}),u[i]=s,u[o]=l,a.add.push(u)):0===l?(u&&a.rem.push(u),n[s]=null,r[s]=null):u[o]!==l&&(u[o]=l,a.mod.push(u));return a.modifies(e)}}),hu.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},ht(hu,Xa,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.as||["a","b"],i=r[0],o=r[1],a=!this.value||e.changed(e.ADD_REM)||t.modified("as")||t.modified("filter");let s=this.value;return a?(s&&(n.rem=s),s=e.materialize(e.SOURCE).source,n.add=this.value=function(t,e,n,r){for(var i,o,a=[],s={},u=t.length,l=0;lgu(t,e)))):typeof r[n]===pu&&r[n](t[n]);return r}function mu(t){Xa.call(this,null,t)}const yu=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],vu={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:yu},{name:"weights",type:"number",array:!0}]};function _u(t,e){return t?t.map(((t,r)=>e[r]||n(t))):null}function xu(t,e,n){const r=[],i=t=>t(u);let o,a,s,u,l,c;if(null==e)r.push(t.map(n));else for(o={},a=0,s=t.length;at.materialize(t.SOURCE).source}(e)),i=t.steps||t.minsteps||25,o=t.steps||t.maxsteps||200;let a=t.method||"pdf";"pdf"!==a&&"cdf"!==a&&s("Invalid density method: "+a),t.extent||r.data||s("Missing density extent parameter."),a=r[a];const u=t.as||["value","density"],l=js(a,t.extent||at(r.data()),i,o).map((t=>{const e={};return e[u[0]]=t[0],e[u[1]]=t[1],va(e)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function bu(t){Xa.call(this,null,t)}bu.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]};function wu(t){Fa.call(this,null,ku,t),this.modified(!0)}function ku(t){const i=t.expr;return this.value&&!t.modified("expr")?this.value:e((e=>i(e,t)),r(i),n(i))}function Au(t){Xa.call(this,[void 0,void 0],t)}function Mu(t,e){Fa.call(this,t),this.parent=e,this.count=0}function Eu(t){Xa.call(this,{},t),this._keys=ct();const e=this._targets=[];e.active=0,e.forEach=t=>{for(let n=0,r=e.active;nl(t))):l(t.name,t.as)}function Fu(t){Xa.call(this,ct(),t)}function Su(t){Xa.call(this,[],t)}function $u(t){Xa.call(this,[],t)}function Tu(t){Xa.call(this,null,t)}function Bu(t){Xa.call(this,[],t)}ht(bu,Xa,{transform(t,e){if(this.value&&!t.modified()&&!e.changed())return e;const n=e.materialize(e.SOURCE).source,r=xu(e.source,t.groupby,f),i=t.smooth||!1,o=t.field,a=t.step||((t,e)=>Et(at(t,e))/30)(n,o),s=wa(((t,e)=>o(t)-o(e))),u=t.as||"bin",l=r.length;let c,h=1/0,d=-1/0,p=0;for(;pd&&(d=e),t[++c][u]=e}return this.value={start:h,stop:d,step:a},e.reflow(!0).modifies(u)}}),ht(wu,Fa),Au.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},ht(Au,Xa,{transform(t,e){const r=this.value,i=t.field,o=e.changed()||e.modified(i.fields)||t.modified("field");let a=r[0],s=r[1];if((o||null==a)&&(a=1/0,s=-1/0),e.visit(o?e.SOURCE:e.ADD,(t=>{const e=S(i(t));null!=e&&(es&&(s=e))})),!Number.isFinite(a)||!Number.isFinite(s)){let t=n(i);t&&(t=` for field "${t}"`),e.dataflow.warn(`Infinite extent${t}: [${a}, ${s}]`),a=s=void 0}this.value=[a,s]}}),ht(Mu,Fa,{connect(t){return this.detachSubflow=t.detachSubflow,this.targets().add(t),t.source=this},add(t){this.count+=1,this.value.add.push(t)},rem(t){this.count-=1,this.value.rem.push(t)},mod(t){this.value.mod.push(t)},init(t){this.value.init(t,t.NO_SOURCE)},evaluate(){return this.value}}),ht(Eu,Xa,{activate(t){this._targets[this._targets.active++]=t},subflow(t,e,n,r){const i=this.value;let o,a,s=ut(i,t)&&i[t];return s?s.value.stampt&&t.count>0));this.initTargets(t)}},initTargets(t){const e=this._targets,n=e.length,r=t?t.length:0;let i=0;for(;ithis.subflow(t,i,e);return this._group=t.group||{},this.initTargets(),e.visit(e.REM,(t=>{const e=ma(t),n=o.get(e);void 0!==n&&(o.delete(e),s(n).rem(t))})),e.visit(e.ADD,(t=>{const e=r(t);o.set(ma(t),e),s(e).add(t)})),a||e.modified(r.fields)?e.visit(e.MOD,(t=>{const e=ma(t),n=o.get(e),i=r(t);n===i?s(i).mod(t):(o.set(e,i),s(n).rem(t),s(i).add(t))})):e.changed(e.MOD)&&e.visit(e.MOD,(t=>{s(o.get(ma(t))).mod(t)})),a&&e.visit(e.REFLOW,(t=>{const e=ma(t),n=o.get(e),i=r(t);n!==i&&(o.set(e,i),s(n).rem(t),s(i).add(t))})),e.clean()?n.runAfter((()=>{this.clean(),o.clean()})):o.empty>n.cleanThreshold&&n.runAfter(o.clean),e}}),ht(Du,Fa),Fu.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},ht(Fu,Xa,{transform(t,e){const n=e.dataflow,r=this.value,i=e.fork(),o=i.add,a=i.rem,s=i.mod,u=t.expr;let l=!0;function c(e){const n=ma(e),i=u(e,t),c=r.get(n);i&&c?(r.delete(n),o.push(e)):i||c?l&&i&&!c&&s.push(e):(r.set(n,1),a.push(e))}return e.visit(e.REM,(t=>{const e=ma(t);r.has(e)?r.delete(e):a.push(t)})),e.visit(e.ADD,(e=>{u(e,t)?o.push(e):r.set(ma(e),1)})),e.visit(e.MOD,c),t.modified()&&(l=!1,e.visit(e.REFLOW,c)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i}}),Su.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},ht(Su,Xa,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.fields,i=_u(r,t.as||[]),o=t.index||null,a=i.length;return n.rem=this.value,e.visit(e.SOURCE,(t=>{const e=r.map((e=>e(t))),s=e.reduce(((t,e)=>Math.max(t,e.length)),0);let u,l,c,f=0;for(;f{for(let e,n=0;ne[r]=n(e,t)))}}),ht(Bu,Xa,{transform(t,e){const n=e.fork(e.ALL),r=t.generator;let i,o,a,s=this.value,u=t.size-s.length;if(u>0){for(i=[];--u>=0;)i.push(a=va(r(t))),s.push(a);n.add=n.add.length?n.materialize(n.ADD).add.concat(i):i}else o=s.slice(0,-u),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,s=s.slice(-u);return n.source=this.value=s,n}});const zu={value:"value",median:De,mean:function(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n},min:we,max:be},Nu=[];function Ou(t){Xa.call(this,[],t)}function Ru(t){ou.call(this,t)}function Lu(t){Xa.call(this,null,t)}function Uu(t){Fa.call(this,null,qu,t)}function qu(t){return this.value&&!t.modified()?this.value:xt(t.fields,t.flat)}function Pu(t){Xa.call(this,[],t),this._pending=null}function ju(t,e,n){n.forEach(va);const r=e.fork(e.NO_FIELDS&e.NO_SOURCE);return r.rem=t.value,t.value=r.source=r.add=n,t._pending=null,r.rem.length&&r.clean(!0),r}function Iu(t){Xa.call(this,{},t)}function Wu(t){Fa.call(this,null,Hu,t)}function Hu(t){if(this.value&&!t.modified())return this.value;const e=t.extents,n=e.length;let r,i,o=1/0,a=-1/0;for(r=0;ra&&(a=i[1]);return[o,a]}function Yu(t){Fa.call(this,null,Gu,t)}function Gu(t){return this.value&&!t.modified()?this.value:t.values.reduce(((t,e)=>t.concat(e)),[])}function Vu(t){Xa.call(this,null,t)}function Xu(t){ou.call(this,t)}function Ju(t){Eu.call(this,t)}function Zu(t){Xa.call(this,null,t)}function Qu(t){Xa.call(this,null,t)}function Ku(t){Xa.call(this,null,t)}Ou.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},ht(Ou,Xa,{transform(t,e){var r,i,o,a,u,l,c,f,h,d,p=e.fork(e.ALL),g=function(t){var e,n=t.method||zu.value;if(null!=zu[n])return n===zu.value?(e=void 0!==t.value?t.value:0,()=>e):zu[n];s("Unrecognized imputation method: "+n)}(t),m=function(t){const e=t.field;return t=>t?e(t):NaN}(t),y=n(t.field),v=n(t.key),_=(t.groupby||[]).map(n),x=function(t,e,n,r){var i,o,a,s,u,l,c,f,h=t=>t(f),d=[],p=r?r.slice():[],g={},m={};for(p.forEach(((t,e)=>g[t]=e+1)),s=0,c=t.length;sn.add(t)))):(i=n.value=n.value||this.init(t),e.visit(e.REM,(t=>n.rem(t))),e.visit(e.ADD,(t=>n.add(t)))),n.changes(),e.visit(e.SOURCE,(t=>{ot(t,i[n.cellkey(t)].tuple)})),e.reflow(r).modifies(this._outputs)},changes(){const t=this._adds,e=this._mods;let n,r;for(n=0,r=this._alen;n{const n=ps(e,u)[l],r=t.counts?e.length:1;js(n,h||at(e),d,p).forEach((t=>{const n={};for(let t=0;t(this._pending=V(t.data),t=>t.touch(this))));return{async:e}}return n.request(t.url,t.format).then((t=>ju(this,e,V(t.data))))}}),Iu.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},ht(Iu,Xa,{transform(t,e){const r=t.fields,i=t.index,o=t.values,a=null==t.default?null:t.default,u=t.modified(),l=r.length;let c,f,h,d=u?e.SOURCE:e.ADD,p=e,g=t.as;return o?(f=o.length,l>1&&!g&&s('Multi-field lookup requires explicit "as" parameter.'),g&&g.length!==l*f&&s('The "as" parameter has too few output field names.'),g=g||o.map(n),c=function(t){for(var e,n,s=0,u=0;se.modified(t.fields))),d|=h?e.MOD:0),e.visit(d,c),p.modifies(g)}}),ht(Wu,Fa),ht(Yu,Fa),ht(Vu,Xa,{transform(t,e){return this.modified(t.modified()),this.value=t,e.fork(e.NO_SOURCE|e.NO_FIELDS)}}),Xu.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:Xs,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},ht(Xu,ou,{_transform:ou.prototype.transform,transform(t,n){return this._transform(function(t,n){const i=t.field,o=t.value,a=("count"===t.op?"__count__":t.op)||"sum",s=r(i).concat(r(o)),u=function(t,e,n){const r={},i=[];return n.visit(n.SOURCE,(e=>{const n=t(e);r[n]||(r[n]=1,i.push(n))})),i.sort(K),e?i.slice(0,e):i}(i,t.limit||0,n);n.changed()&&t.set("__pivot__",null,null,!0);return{key:t.key,groupby:t.groupby,ops:u.map((()=>a)),fields:u.map((t=>function(t,n,r,i){return e((e=>n(e)===t?r(e):NaN),i,t+"")}(t,i,o,s))),as:u.map((t=>t+"")),modified:t.modified.bind(t)}}(t,n),n)}}),ht(Ju,Eu,{transform(t,e){const n=t.subflow,i=t.field,o=t=>this.subflow(ma(t),n,e,t);return(t.modified("field")||i&&e.modified(r(i)))&&s("PreFacet does not support field modification."),this.initTargets(),i?(e.visit(e.MOD,(t=>{const e=o(t);i(t).forEach((t=>e.mod(t)))})),e.visit(e.ADD,(t=>{const e=o(t);i(t).forEach((t=>e.add(va(t))))})),e.visit(e.REM,(t=>{const e=o(t);i(t).forEach((t=>e.rem(t)))}))):(e.visit(e.MOD,(t=>o(t).mod(t))),e.visit(e.ADD,(t=>o(t).add(t))),e.visit(e.REM,(t=>o(t).rem(t)))),e.clean()&&e.runAfter((()=>this.clean())),e}}),Zu.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},ht(Zu,Xa,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.fields,i=_u(t.fields,t.as||[]),o=r?(t,e)=>function(t,e,n,r){for(let i=0,o=n.length;i{const e=ma(t);n.rem.push(a[e]),a[e]=null})),e.visit(e.ADD,(t=>{const e=o(t,va({}));a[ma(t)]=e,n.add.push(e)})),e.visit(e.MOD,(t=>{n.mod.push(o(t,a[ma(t)]))})),n}}),ht(Qu,Xa,{transform(t,e){return this.value=t.value,t.modified("value")?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation}}),Ku.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]};function tl(t){Xa.call(this,null,t)}function el(t){Xa.call(this,[],t),this.count=0}function nl(t){Xa.call(this,null,t)}function rl(t){Xa.call(this,null,t),this.modified(!0)}function il(t){Xa.call(this,null,t)}ht(Ku,Xa,{transform(t,e){const r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.as||["prob","value"];if(this.value&&!t.modified()&&!e.changed())return r.source=this.value,r;const o=xu(e.materialize(e.SOURCE).source,t.groupby,t.field),a=(t.groupby||[]).map(n),s=[],u=t.step||.01,l=t.probs||Fe(u/2,1-1e-14,u),c=l.length;return o.forEach((t=>{const e=ts(t,l);for(let n=0;n{const e=ma(t);n.rem.push(r[e]),r[e]=null})),e.visit(e.ADD,(t=>{const e=_a(t);r[ma(t)]=e,n.add.push(e)})),e.visit(e.MOD,(t=>{const e=r[ma(t)];for(const r in t)e[r]=t[r],n.modifies(r);n.mod.push(e)}))),n}}),el.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},ht(el,Xa,{transform(e,n){const r=n.fork(n.NO_SOURCE),i=e.modified("size"),o=e.size,a=this.value.reduce(((t,e)=>(t[ma(e)]=1,t)),{});let s=this.value,u=this.count,l=0;function c(e){let n,i;s.length=l&&(n=s[i],a[ma(n)]&&r.rem.push(n),s[i]=e)),++u}if(n.rem.length&&(n.visit(n.REM,(t=>{const e=ma(t);a[e]&&(a[e]=-1,r.rem.push(t)),--u})),s=s.filter((t=>-1!==a[ma(t)]))),(n.rem.length||i)&&s.length{a[ma(t)]||c(t)})),l=-1),i&&s.length>o){const t=s.length-o;for(let e=0;e{a[ma(t)]&&r.mod.push(t)})),n.add.length&&n.visit(n.ADD,c),(n.add.length||l<0)&&(r.add=s.filter((t=>!a[ma(t)]))),this.count=u,this.value=r.source=s,r}}),nl.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},ht(nl,Xa,{transform(t,e){if(this.value&&!t.modified())return;const n=e.materialize().fork(e.MOD),r=t.as||"data";return n.rem=this.value?e.rem.concat(this.value):e.rem,this.value=Fe(t.start,t.stop,t.step||1).map((t=>{const e={};return e[r]=t,va(e)})),n.add=e.add.concat(this.value),n}}),ht(rl,Xa,{transform(t,e){return this.value=e.source,e.changed()?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation}});const ol=["unit0","unit1"];function al(t){Xa.call(this,ct(),t)}function sl(t){Xa.call(this,null,t)}il.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:Qn,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:ol}]},ht(il,Xa,{transform(t,e){const n=t.field,i=!1!==t.interval,o="utc"===t.timezone,a=this._floor(t,e),s=(o?Cr:Dr)(a.unit).offset,u=t.as||ol,l=u[0],c=u[1],f=a.step;let h=a.start||1/0,d=a.stop||-1/0,p=e.ADD;return(t.modified()||e.changed(e.REM)||e.modified(r(n)))&&(p=(e=e.reflow(!0)).SOURCE,h=1/0,d=-1/0),e.visit(p,(t=>{const e=n(t);let r,o;null==e?(t[l]=null,i&&(t[c]=null)):(t[l]=r=o=a(e),i&&(t[c]=o=s(r,f)),rd&&(d=o))})),a.start=h,a.stop=d,e.modifies(i?u:l)},_floor(t,e){const n="utc"===t.timezone,{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:Xr({extent:t.extent||at(e.materialize(e.SOURCE).source,t.field),maxbins:t.maxbins}),o=tr(r),a=this.value||{},s=(n?Ar:br)(o,i);return s.unit=F(o),s.units=o,s.step=i,s.start=a.start,s.stop=a.stop,this.value=s}}),ht(al,Xa,{transform(t,e){const n=e.dataflow,r=t.field,i=this.value,o=t=>i.set(r(t),t);let a=!0;return t.modified("field")||e.modified(r.fields)?(i.clear(),e.visit(e.SOURCE,o)):e.changed()?(e.visit(e.REM,(t=>i.delete(r(t)))),e.visit(e.ADD,o)):a=!1,this.modified(a),i.empty>n.cleanThreshold&&n.runAfter(i.clean),e.fork()}}),ht(sl,Xa,{transform(t,e){(!this.value||t.modified("field")||t.modified("sort")||e.changed()||t.sort&&e.modified(t.sort.fields))&&(this.value=(t.sort?e.source.slice().sort(wa(t.sort)):e.source).map(t.field))}});const ul={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:e=>{const n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?t=n+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:e=>{const n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?++t:t}}},percent_rank:function(){const t=ul.rank(),e=t.next;return{init:t.init,next:t=>(e(t)-1)/(t.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:e=>{const n=e.data,r=e.compare;let i=e.index;if(t0||s("ntile num must be greater than zero.");const n=ul.cume_dist(),r=n.next;return{init:n.init,next:t=>Math.ceil(e*r(t))}},lag:function(t,e){return e=+e||1,{next:n=>{const r=n.index-e;return r>=0?t(n.data[r]):null}}},lead:function(t,e){return e=+e||1,{next:n=>{const r=n.index+e,i=n.data;return rt(e.data[e.i0])}},last_value:function(t){return{next:e=>t(e.data[e.i1-1])}},nth_value:function(t,e){return(e=+e)>0||s("nth_value nth must be greater than zero."),{next:n=>{const r=n.i0+(e-1);return re=null,next:n=>{const r=t(n.data[n.index]);return null!=r?e=r:e}}},next_value:function(t){let e,n;return{init:()=>(e=null,n=-1),next:r=>{const i=r.data;return r.index<=n?e:(n=function(t,e,n){for(let r=e.length;nf[t]=1))}y(t.sort),e.forEach(((t,e)=>{const r=i[e],f=o[e],v=a[e]||null,_=n(r),x=Hs(t,_,u[e]);if(y(r),l.push(x),ut(ul,t))c.push(function(t,e,n,r){const i=ul[t](e,n);return{init:i.init||h,update:function(t,e){e[r]=i.next(t)}}}(t,r,f,x));else{if(null==r&&"count"!==t&&s("Null aggregate field specified."),"count"===t)return void p.push(x);m=!1;let e=d[_];e||(e=d[_]=[],e.field=r,g.push(e)),e.push(Js(t,v,x))}})),(p.length||g.length)&&(this.cell=function(t,e,n){t=t.map((t=>nu(t,t.field)));const r={num:0,agg:null,store:!1,count:e};if(!n)for(var i=t.length,o=r.agg=Array(i),a=0;a0&&!i(o[n],o[n-1])&&(t.i0=e.left(o,o[n])),rt.init())),this.cell&&this.cell.init()},fl.update=function(t,e){const n=this.cell,r=this.windows,i=t.data,o=r&&r.length;let a;if(n){for(a=t.p0;athis.group(i(t));let a=this.state;a&&!n||(a=this.state=new cl(t)),n||e.modified(a.inputs)?(this.value={},e.visit(e.SOURCE,(t=>o(t).add(t)))):(e.visit(e.REM,(t=>o(t).remove(t))),e.visit(e.ADD,(t=>o(t).add(t))));for(let e=0,n=this._mlen;e=1?Dl:t<=-1?-Dl:Math.asin(t)}const Sl=Math.PI,$l=2*Sl,Tl=1e-6,Bl=$l-Tl;function zl(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return zl;const n=10**e;return function(t){this._+=t[0];for(let e=1,r=t.length;eTl)if(Math.abs(c*s-u*l)>Tl&&i){let h=n-o,d=r-a,p=s*s+u*u,g=h*h+d*d,m=Math.sqrt(p),y=Math.sqrt(f),v=i*Math.tan((Sl-Math.acos((p+f-g)/(2*m*y)))/2),_=v/y,x=v/m;Math.abs(_-1)>Tl&&this._append`L${t+_*l},${e+_*c}`,this._append`A${i},${i},0,0,${+(c*h>l*d)},${this._x1=t+x*s},${this._y1=e+x*u}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,n,r,i,o){if(t=+t,e=+e,o=!!o,(n=+n)<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(r),s=n*Math.sin(r),u=t+a,l=e+s,c=1^o,f=o?r-i:i-r;null===this._x1?this._append`M${u},${l}`:(Math.abs(this._x1-u)>Tl||Math.abs(this._y1-l)>Tl)&&this._append`L${u},${l}`,n&&(f<0&&(f=f%$l+$l),f>Bl?this._append`A${n},${n},0,1,${c},${t-a},${e-s}A${n},${n},0,1,${c},${this._x1=u},${this._y1=l}`:f>Tl&&this._append`A${n},${n},0,${+(f>=Sl)},${c},${this._x1=t+n*Math.cos(i)},${this._y1=e+n*Math.sin(i)}`)}rect(t,e,n,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function Ol(){return new Nl}function Rl(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(null==n)e=null;else{const t=Math.floor(n);if(!(t>=0))throw new RangeError(`invalid digits: ${n}`);e=t}return t},()=>new Nl(e)}function Ll(t){return t.innerRadius}function Ul(t){return t.outerRadius}function ql(t){return t.startAngle}function Pl(t){return t.endAngle}function jl(t){return t&&t.padAngle}function Il(t,e,n,r,i,o,a){var s=t-n,u=e-r,l=(a?o:-o)/Al(s*s+u*u),c=l*u,f=-l*s,h=t+c,d=e+f,p=n+c,g=r+f,m=(h+p)/2,y=(d+g)/2,v=p-h,_=g-d,x=v*v+_*_,b=i-o,w=h*g-p*d,k=(_<0?-1:1)*Al(bl(0,b*b*x-w*w)),A=(w*_-v*k)/x,M=(-w*v-_*k)/x,E=(w*_+v*k)/x,D=(-w*v+_*k)/x,C=A-m,F=M-y,S=E-m,$=D-y;return C*C+F*F>S*S+$*$&&(A=E,M=D),{cx:A,cy:M,x01:-c,y01:-f,x11:A*(i/b-1),y11:M*(i/b-1)}}function Wl(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Hl(t){this._context=t}function Yl(t){return new Hl(t)}function Gl(t){return t[0]}function Vl(t){return t[1]}function Xl(t,e){var n=yl(!0),r=null,i=Yl,o=null,a=Rl(s);function s(s){var u,l,c,f=(s=Wl(s)).length,h=!1;for(null==r&&(o=i(c=a())),u=0;u<=f;++u)!(u=f;--h)s.point(y[h],v[h]);s.lineEnd(),s.areaEnd()}m&&(y[c]=+t(d,c,l),v[c]=+e(d,c,l),s.point(r?+r(d,c,l):y[c],n?+n(d,c,l):v[c]))}if(p)return s=null,p+""||null}function c(){return Xl().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?Gl:yl(+t),e="function"==typeof e?e:yl(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?Vl:yl(+n),l.x=function(e){return arguments.length?(t="function"==typeof e?e:yl(+e),r=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:yl(+e),l):t},l.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:yl(+t),l):r},l.y=function(t){return arguments.length?(e="function"==typeof t?t:yl(+t),n=null,l):e},l.y0=function(t){return arguments.length?(e="function"==typeof t?t:yl(+t),l):e},l.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:yl(+t),l):n},l.lineX0=l.lineY0=function(){return c().x(t).y(e)},l.lineY1=function(){return c().x(t).y(n)},l.lineX1=function(){return c().x(r).y(e)},l.defined=function(t){return arguments.length?(i="function"==typeof t?t:yl(!!t),l):i},l.curve=function(t){return arguments.length?(a=t,null!=o&&(s=a(o)),l):a},l.context=function(t){return arguments.length?(null==t?o=s=null:s=a(o=t),l):o},l}Ol.prototype=Nl.prototype,Hl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var Zl={draw(t,e){const n=Al(e/El);t.moveTo(n,0),t.arc(0,0,n,0,Cl)}};function Ql(){}function Kl(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function tc(t){this._context=t}function ec(t){this._context=t}function nc(t){this._context=t}function rc(t,e){this._basis=new tc(t),this._beta=e}tc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Kl(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Kl(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},ec.prototype={areaStart:Ql,areaEnd:Ql,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Kl(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},nc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Kl(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},rc.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],o=e[0],a=t[n]-i,s=e[n]-o,u=-1;++u<=n;)r=u/n,this._basis.point(this._beta*t[u]+(1-this._beta)*(i+r*a),this._beta*e[u]+(1-this._beta)*(o+r*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var ic=function t(e){function n(t){return 1===e?new tc(t):new rc(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function oc(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function ac(t,e){this._context=t,this._k=(1-e)/6}ac.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:oc(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:oc(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var sc=function t(e){function n(t){return new ac(t,e)}return n.tension=function(e){return t(+e)},n}(0);function uc(t,e){this._context=t,this._k=(1-e)/6}uc.prototype={areaStart:Ql,areaEnd:Ql,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:oc(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var lc=function t(e){function n(t){return new uc(t,e)}return n.tension=function(e){return t(+e)},n}(0);function cc(t,e){this._context=t,this._k=(1-e)/6}cc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:oc(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var fc=function t(e){function n(t){return new cc(t,e)}return n.tension=function(e){return t(+e)},n}(0);function hc(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>Ml){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,u=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/u,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/u}if(t._l23_a>Ml){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*l+t._x1*t._l23_2a-e*t._l12_2a)/c,a=(a*l+t._y1*t._l23_2a-n*t._l12_2a)/c}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function dc(t,e){this._context=t,this._alpha=e}dc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:hc(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var pc=function t(e){function n(t){return e?new dc(t,e):new ac(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function gc(t,e){this._context=t,this._alpha=e}gc.prototype={areaStart:Ql,areaEnd:Ql,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:hc(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var mc=function t(e){function n(t){return e?new gc(t,e):new uc(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function yc(t,e){this._context=t,this._alpha=e}yc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:hc(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var vc=function t(e){function n(t){return e?new yc(t,e):new cc(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function _c(t){this._context=t}function xc(t){return t<0?-1:1}function bc(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),s=(o*i+a*r)/(r+i);return(xc(o)+xc(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function wc(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function kc(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,s=(o-r)/3;t._context.bezierCurveTo(r+s,i+s*e,o-s,a-s*n,o,a)}function Ac(t){this._context=t}function Mc(t){this._context=new Ec(t)}function Ec(t){this._context=t}function Dc(t){this._context=t}function Cc(t){var e,n,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e=0;--e)i[e]=(a[e]-i[e+1])/o[e];for(o[r-1]=(t[r]+i[r-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};const $c=()=>"undefined"!=typeof Image?Image:null;function Tc(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Bc(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const zc=Symbol("implicit");function Nc(){var t=new se,e=[],n=[],r=zc;function i(i){let o=t.get(i);if(void 0===o){if(r!==zc)return r;t.set(i,o=e.push(i)-1)}return n[o%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new se;for(const r of n)t.has(r)||t.set(r,e.push(r)-1);return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return Nc(e,n).unknown(r)},Tc.apply(i,arguments),i}function Oc(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Rc(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Lc(){}var Uc=.7,qc=1/Uc,Pc="\\s*([+-]?\\d+)\\s*",jc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ic="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Wc=/^#([0-9a-f]{3,8})$/,Hc=new RegExp(`^rgb\\(${Pc},${Pc},${Pc}\\)$`),Yc=new RegExp(`^rgb\\(${Ic},${Ic},${Ic}\\)$`),Gc=new RegExp(`^rgba\\(${Pc},${Pc},${Pc},${jc}\\)$`),Vc=new RegExp(`^rgba\\(${Ic},${Ic},${Ic},${jc}\\)$`),Xc=new RegExp(`^hsl\\(${jc},${Ic},${Ic}\\)$`),Jc=new RegExp(`^hsla\\(${jc},${Ic},${Ic},${jc}\\)$`),Zc={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};function Qc(){return this.rgb().formatHex()}function Kc(){return this.rgb().formatRgb()}function tf(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Wc.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?ef(e):3===n?new af(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?nf(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?nf(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Hc.exec(t))?new af(e[1],e[2],e[3],1):(e=Yc.exec(t))?new af(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Gc.exec(t))?nf(e[1],e[2],e[3],e[4]):(e=Vc.exec(t))?nf(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Xc.exec(t))?hf(e[1],e[2]/100,e[3]/100,1):(e=Jc.exec(t))?hf(e[1],e[2]/100,e[3]/100,e[4]):Zc.hasOwnProperty(t)?ef(Zc[t]):"transparent"===t?new af(NaN,NaN,NaN,0):null}function ef(t){return new af(t>>16&255,t>>8&255,255&t,1)}function nf(t,e,n,r){return r<=0&&(t=e=n=NaN),new af(t,e,n,r)}function rf(t){return t instanceof Lc||(t=tf(t)),t?new af((t=t.rgb()).r,t.g,t.b,t.opacity):new af}function of(t,e,n,r){return 1===arguments.length?rf(t):new af(t,e,n,null==r?1:r)}function af(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function sf(){return`#${ff(this.r)}${ff(this.g)}${ff(this.b)}`}function uf(){const t=lf(this.opacity);return`${1===t?"rgb(":"rgba("}${cf(this.r)}, ${cf(this.g)}, ${cf(this.b)}${1===t?")":`, ${t})`}`}function lf(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function cf(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ff(t){return((t=cf(t))<16?"0":"")+t.toString(16)}function hf(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new gf(t,e,n,r)}function df(t){if(t instanceof gf)return new gf(t.h,t.s,t.l,t.opacity);if(t instanceof Lc||(t=tf(t)),!t)return new gf;if(t instanceof gf)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n0&&u<1?0:a,new gf(a,s,u,t.opacity)}function pf(t,e,n,r){return 1===arguments.length?df(t):new gf(t,e,n,null==r?1:r)}function gf(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function mf(t){return(t=(t||0)%360)<0?t+360:t}function yf(t){return Math.max(0,Math.min(1,t||0))}function vf(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Oc(Lc,tf,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Qc,formatHex:Qc,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return df(this).formatHsl()},formatRgb:Kc,toString:Kc}),Oc(af,of,Rc(Lc,{brighter(t){return t=null==t?qc:Math.pow(qc,t),new af(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Uc:Math.pow(Uc,t),new af(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new af(cf(this.r),cf(this.g),cf(this.b),lf(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:sf,formatHex:sf,formatHex8:function(){return`#${ff(this.r)}${ff(this.g)}${ff(this.b)}${ff(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:uf,toString:uf})),Oc(gf,pf,Rc(Lc,{brighter(t){return t=null==t?qc:Math.pow(qc,t),new gf(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Uc:Math.pow(Uc,t),new gf(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new af(vf(t>=240?t-240:t+120,i,r),vf(t,i,r),vf(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new gf(mf(this.h),yf(this.s),yf(this.l),lf(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(){const t=lf(this.opacity);return`${1===t?"hsl(":"hsla("}${mf(this.h)}, ${100*yf(this.s)}%, ${100*yf(this.l)}%${1===t?")":`, ${t})`}`}}));const _f=Math.PI/180,xf=180/Math.PI,bf=.96422,wf=1,kf=.82521,Af=4/29,Mf=6/29,Ef=3*Mf*Mf,Df=Mf*Mf*Mf;function Cf(t){if(t instanceof Sf)return new Sf(t.l,t.a,t.b,t.opacity);if(t instanceof Of)return Rf(t);t instanceof af||(t=rf(t));var e,n,r=zf(t.r),i=zf(t.g),o=zf(t.b),a=$f((.2225045*r+.7168786*i+.0606169*o)/wf);return r===i&&i===o?e=n=a:(e=$f((.4360747*r+.3850649*i+.1430804*o)/bf),n=$f((.0139322*r+.0971045*i+.7141733*o)/kf)),new Sf(116*a-16,500*(e-a),200*(a-n),t.opacity)}function Ff(t,e,n,r){return 1===arguments.length?Cf(t):new Sf(t,e,n,null==r?1:r)}function Sf(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function $f(t){return t>Df?Math.pow(t,1/3):t/Ef+Af}function Tf(t){return t>Mf?t*t*t:Ef*(t-Af)}function Bf(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function zf(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Nf(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Of)return new Of(t.h,t.c,t.l,t.opacity);if(t instanceof Sf||(t=Cf(t)),0===t.a&&0===t.b)return new Of(NaN,0=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r()=>t;function Qf(t,e){return function(n){return t+n*e}}function Kf(t,e){var n=e-t;return n?Qf(t,n>180||n<-180?n-360*Math.round(n/360):n):Zf(isNaN(t)?e:t)}function th(t){return 1==(t=+t)?eh:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Zf(isNaN(e)?n:e)}}function eh(t,e){var n=e-t;return n?Qf(t,n):Zf(isNaN(t)?e:t)}var nh=function t(e){var n=th(e);function r(t,e){var r=n((t=of(t)).r,(e=of(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=eh(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function rh(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;no&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:ch(n,r)})),o=dh.lastIndex;return o180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:ch(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,u),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:ch(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,u),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:ch(t,n)},{i:s-2,x:ch(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,u),o=a=null,function(t){for(var e,n=-1,r=u.length;++ne&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(a[0],a[t-1])),r=t>2?jh:Ph,i=o=null,f}function f(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,u)))(t(l(e)))}return f.invert=function(n){return l(e((o||(o=r(s,a.map(t),ch)))(n)))},f.domain=function(t){return arguments.length?(a=Array.from(t,Rh),c()):a.slice()},f.range=function(t){return arguments.length?(s=Array.from(t),c()):s.slice()},f.rangeRound=function(t){return s=Array.from(t),u=mh,c()},f.clamp=function(t){return arguments.length?(l=!!t||Uh,c()):l!==Uh},f.interpolate=function(t){return arguments.length?(u=t,c()):u},f.unknown=function(t){return arguments.length?(n=t,f):n},function(n,r){return t=n,e=r,c()}}function Hh(){return Wh()(Uh,Uh)}function Yh(t,e,n,r){var i,o=xe(t,e,n);switch((r=Oe(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=Ve(o,a))||(r.precision=i),Ie(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=Xe(o,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=Ge(o))||(r.precision=i-2*("%"===r.type))}return je(r)}function Gh(t){var e=t.domain;return t.ticks=function(t){var n=e();return ve(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return Yh(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,o=e(),a=0,s=o.length-1,u=o[a],l=o[s],c=10;for(l0;){if((i=_e(u,l,n))===r)return o[a]=u,o[s]=l,e(o);if(i>0)u=Math.floor(u/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function Vh(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a-t(-e,n)}function ed(t){const e=t(Xh,Jh),n=e.domain;let r,i,o=10;function a(){return r=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}(o),i=function(t){return 10===t?Kh:t===Math.E?Math.exp:e=>Math.pow(t,e)}(o),n()[0]<0?(r=td(r),i=td(i),t(Zh,Qh)):t(Xh,Jh),e}return e.base=function(t){return arguments.length?(o=+t,a()):o},e.domain=function(t){return arguments.length?(n(t),a()):n()},e.ticks=t=>{const e=n();let a=e[0],s=e[e.length-1];const u=s0){for(;f<=h;++f)for(l=1;ls)break;p.push(c)}}else for(;f<=h;++f)for(l=o-1;l>=1;--l)if(c=f>0?l/i(-f):l*i(f),!(cs)break;p.push(c)}2*p.length{if(null==t&&(t=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=Oe(n)).precision||(n.trim=!0),n=je(n)),t===1/0)return n;const a=Math.max(1,o*t/e.ticks().length);return t=>{let e=t/i(Math.round(r(t)));return e*on(Vh(n(),{floor:t=>i(Math.floor(r(t))),ceil:t=>i(Math.ceil(r(t)))})),e}function nd(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function rd(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function id(t){var e=1,n=t(nd(e),rd(e));return n.constant=function(n){return arguments.length?t(nd(e=+n),rd(e)):e},Gh(n)}function od(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function ad(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function sd(t){return t<0?-t*t:t*t}function ud(t){var e=t(Uh,Uh),n=1;return e.exponent=function(e){return arguments.length?1===(n=+e)?t(Uh,Uh):.5===n?t(ad,sd):t(od(n),od(1/n)):n},Gh(e)}function ld(){var t=ud(Wh());return t.copy=function(){return Ih(t,ld()).exponent(t.exponent())},Tc.apply(t,arguments),t}function cd(t){return new Date(t)}function fd(t){return t instanceof Date?+t:+new Date(+t)}function hd(t,e,n,r,i,o,a,s,u,l){var c=Hh(),f=c.invert,h=c.domain,d=l(".%L"),p=l(":%S"),g=l("%I:%M"),m=l("%I %p"),y=l("%a %d"),v=l("%b %d"),_=l("%B"),x=l("%Y");function b(t){return(u(t)0?r:1:0}const $d="linear",Td="log",Bd="pow",zd="sqrt",Nd="symlog",Od="time",Rd="utc",Ld="sequential",Ud="diverging",qd="quantile",Pd="quantize",jd="threshold",Id="ordinal",Wd="point",Hd="band",Yd="bin-ordinal",Gd="continuous",Vd="discrete",Xd="discretizing",Jd="interpolating",Zd="temporal";function Qd(){const t=Nc().unknown(void 0),e=t.domain,n=t.range;let r,i,o=[0,1],a=!1,s=0,u=0,l=.5;function c(){const t=e().length,c=o[1]d+r*t));return n(c?p.reverse():p)}return delete t.unknown,t.domain=function(t){return arguments.length?(e(t),c()):e()},t.range=function(t){return arguments.length?(o=[+t[0],+t[1]],c()):o.slice()},t.rangeRound=function(t){return o=[+t[0],+t[1]],a=!0,c()},t.bandwidth=function(){return i},t.step=function(){return r},t.round=function(t){return arguments.length?(a=!!t,c()):a},t.padding=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),s=u,c()):s},t.paddingInner=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),c()):s},t.paddingOuter=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),c()):u},t.align=function(t){return arguments.length?(l=Math.max(0,Math.min(1,t)),c()):l},t.invertRange=function(t){if(null==t[0]||null==t[1])return;const r=o[1]o[1-r])?void 0:(u=Math.max(0,ie(a,f)-1),l=f===h?u:ie(a,h)-1,f-a[u]>i+1e-10&&++u,r&&(c=u,u=s-l,l=s-c),u>l?void 0:e().slice(u,l+1))},t.invert=function(e){const n=t.invertRange([e,e]);return n?n[0]:n},t.copy=function(){return Qd().domain(e()).range(o).round(a).paddingInner(s).paddingOuter(u).align(l)},c()}function Kd(t){const e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return Kd(e())},t}var tp=Array.prototype.map;const ep=Array.prototype.slice;const np=new Map,rp=Symbol("vega_scale");function ip(t){return t[rp]=!0,t}function op(t){return t&&!0===t[rp]}function ap(t,e,n){return arguments.length>1?(np.set(t,function(t,e,n){const r=function(){const n=e();return n.invertRange||(n.invertRange=n.invert?function(t){return function(e){let n,r=e[0],i=e[1];return i=s&&n[o]<=u&&(l<0&&(l=o),r=o);if(!(l<0))return s=t.invertExtent(n[l]),u=t.invertExtent(n[r]),[void 0===s[0]?s[1]:s[0],void 0===u[1]?u[0]:u[1]]}}(n):void 0),n.type=t,ip(n)};return r.metadata=Tt(V(n)),r}(t,e,n)),this):sp(t)?np.get(t):void 0}function sp(t){return np.has(t)}function up(t,e){const n=np.get(t);return n&&n.metadata[e]}function lp(t){return up(t,Gd)}function cp(t){return up(t,Vd)}function fp(t){return up(t,Xd)}function hp(t){return up(t,Td)}function dp(t){return up(t,Jd)}function pp(t){return up(t,qd)}ap("identity",(function t(e){var n;function r(t){return null==t||isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,Rh),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?Array.from(e,Rh):[0,1],Gh(r)})),ap($d,(function t(){var e=Hh();return e.copy=function(){return Ih(e,t())},Tc.apply(e,arguments),Gh(e)}),Gd),ap(Td,(function t(){const e=ed(Wh()).domain([1,10]);return e.copy=()=>Ih(e,t()).base(e.base()),Tc.apply(e,arguments),e}),[Gd,Td]),ap(Bd,ld,Gd),ap(zd,(function(){return ld.apply(null,arguments).exponent(.5)}),Gd),ap(Nd,(function t(){var e=id(Wh());return e.copy=function(){return Ih(e,t()).constant(e.constant())},Tc.apply(e,arguments)}),Gd),ap(Od,(function(){return Tc.apply(hd(Un,qn,zn,Tn,yn,dn,fn,ln,un,ei).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Gd,Zd]),ap(Rd,(function(){return Tc.apply(hd(Rn,Ln,Nn,Bn,Mn,pn,hn,cn,un,ri).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Gd,Zd]),ap(Ld,gd,[Gd,Jd]),ap(`${Ld}-${$d}`,gd,[Gd,Jd]),ap(`${Ld}-${Td}`,(function t(){var e=ed(dd()).domain([1,10]);return e.copy=function(){return pd(e,t()).base(e.base())},Bc.apply(e,arguments)}),[Gd,Jd,Td]),ap(`${Ld}-${Bd}`,md,[Gd,Jd]),ap(`${Ld}-${zd}`,(function(){return md.apply(null,arguments).exponent(.5)}),[Gd,Jd]),ap(`${Ld}-${Nd}`,(function t(){var e=id(dd());return e.copy=function(){return pd(e,t()).constant(e.constant())},Bc.apply(e,arguments)}),[Gd,Jd]),ap(`${Ud}-${$d}`,(function t(){var e=Gh(yd()(Uh));return e.copy=function(){return pd(e,t())},Bc.apply(e,arguments)}),[Gd,Jd]),ap(`${Ud}-${Td}`,(function t(){var e=ed(yd()).domain([.1,1,10]);return e.copy=function(){return pd(e,t()).base(e.base())},Bc.apply(e,arguments)}),[Gd,Jd,Td]),ap(`${Ud}-${Bd}`,vd,[Gd,Jd]),ap(`${Ud}-${zd}`,(function(){return vd.apply(null,arguments).exponent(.5)}),[Gd,Jd]),ap(`${Ud}-${Nd}`,(function t(){var e=id(yd());return e.copy=function(){return pd(e,t()).constant(e.constant())},Bc.apply(e,arguments)}),[Gd,Jd]),ap(qd,(function t(){var e,n=[],r=[],i=[];function o(){var t=0,e=Math.max(1,r.length);for(i=new Array(e-1);++t0?i[e-1]:n[0],e=i?[o[i-1],r]:[o[e-1],o[e]]},s.unknown=function(t){return arguments.length?(e=t,s):s},s.thresholds=function(){return o.slice()},s.copy=function(){return t().domain([n,r]).range(a).unknown(e)},Tc.apply(Gh(s),arguments)}),Xd),ap(jd,(function t(){var e,n=[.5],r=[0,1],i=1;function o(t){return null!=t&&t<=t?r[ie(n,t,0,i)]:e}return o.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),o):n.slice()},o.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),o):r.slice()},o.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},o.unknown=function(t){return arguments.length?(e=t,o):e},o.copy=function(){return t().domain(n).range(r).unknown(e)},Tc.apply(o,arguments)}),Xd),ap(Yd,(function t(){let e=[],n=[];function r(t){return null==t||t!=t?void 0:n[(ie(e,t)-1)%n.length]}return r.domain=function(t){return arguments.length?(e=function(t){return tp.call(t,S)}(t),r):e.slice()},r.range=function(t){return arguments.length?(n=ep.call(t),r):n.slice()},r.tickFormat=function(t,n){return Yh(e[0],F(e),null==t?10:t,n)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),[Vd,Xd]),ap(Id,Nc,Vd),ap(Hd,Qd,Vd),ap(Wd,(function(){return Kd(Qd().paddingInner(1))}),Vd);const gp=["clamp","base","constant","exponent"];function mp(t,e){const n=e[0],r=F(e)-n;return function(e){return t(n+e*r)}}function yp(t,e,n){return Nh(xp(e||"rgb",n),t)}function vp(t,e){const n=new Array(e),r=e+1;for(let i=0;it[e]?a[e](t[e]()):0)),a):rt(.5)}function xp(t,e){const n=Oh[function(t){return"interpolate"+t.toLowerCase().split("-").map((t=>t[0].toUpperCase()+t.slice(1))).join("")}(t)];return null!=e&&n&&n.gamma?n.gamma(e):n}function bp(t){if(k(t))return t;const e=t.length/6|0,n=new Array(e);for(let r=0;r1?(kp[t]=e,this):kp[t]}wp({accent:bd,category10:xd,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:wd,observable10:kd,paired:Ad,pastel1:Md,pastel2:Ed,set1:Dd,set2:Cd,set3:Fd,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"},bp),wp({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(t=>yp(bp(t))));const Mp="symbol",Ep="discrete",Dp=t=>k(t)?t.map((t=>String(t))):String(t),Cp=(t,e)=>t[1]-e[1],Fp=(t,e)=>e[1]-t[1];function Sp(t,e,n){let r;return yt(e)&&(t.bins&&(e=Math.max(e,t.bins.length)),null!=n&&(e=Math.min(e,Math.floor(Et(t.domain())/n||1)+1))),A(e)&&(r=e.step,e=e.interval),_t(e)&&(e=t.type===Od?Dr(e):t.type==Rd?Cr(e):s("Only time and utc scales accept interval strings."),r&&(e=e.every(r))),e}function $p(t,e,n){let r=t.range(),i=r[0],o=F(r),a=Cp;if(i>o&&(r=o,o=i,i=r,a=Fp),i=Math.floor(i),o=Math.ceil(o),e=e.map((e=>[e,t(e)])).filter((t=>i<=t[1]&&t[1]<=o)).sort(a).map((t=>t[0])),n>0&&e.length>1){const t=[e[0],F(e)];for(;e.length>n&&e.length>=3;)e=e.filter(((t,e)=>!(e%2)));e.length<3&&(e=t)}return e}function Tp(t,e){return t.bins?$p(t,t.bins,e):t.ticks?t.ticks(e):t.domain()}function Bp(t,e,n,r,i,o){const a=e.type;let s=Dp;if(a===Od||i===Od)s=t.timeFormat(r);else if(a===Rd||i===Rd)s=t.utcFormat(r);else if(hp(a)){const i=t.formatFloat(r);if(o||e.bins)s=i;else{const t=zp(e,n,!1);s=e=>t(e)?i(e):""}}else if(e.tickFormat){const i=e.domain();s=t.formatSpan(i[0],i[i.length-1],n,r)}else r&&(s=t.format(r));return s}function zp(t,e,n){const r=Tp(t,e),i=t.base(),o=Math.log(i),a=Math.max(1,i*e/r.length),s=t=>{let e=t/Math.pow(i,Math.round(Math.log(t)/o));return e*iNp[t.type]||t.bins;function Up(t,e,n,r,i,o,a){const s=Op[e.type]&&o!==Od&&o!==Rd?function(t,e,n){const r=e[Op[e.type]](),i=r.length;let o,a=i>1?r[1]-r[0]:r[0];for(o=1;o(e,n,r)=>{const i=Pp(r[n+1],Pp(r.max,1/0)),o=Wp(e,t),a=Wp(i,t);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},Pp=(t,e)=>null!=t?t:e,jp=t=>(e,n)=>n?t(e):null,Ip=t=>e=>t(e),Wp=(t,e)=>Number.isFinite(t)?e(t):null;function Hp(t,e,n,r){const i=r||e.type;return _t(n)&&function(t){return up(t,Zd)}(i)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||i!==Od?n||i!==Rd?Up(t,e,5,null,n,r,!0):t.utcFormat("%A, %d %B %Y, %X UTC"):t.timeFormat("%A, %d %B %Y, %X")}function Yp(t,e,n){n=n||{};const r=Math.max(3,n.maxlen||7),i=Hp(t,e,n.format,n.formatType);if(fp(e.type)){const t=Rp(e).slice(1).map(i),n=t.length;return`${n} boundar${1===n?"y":"ies"}: ${t.join(", ")}`}if(cp(e.type)){const t=e.domain(),n=t.length;return`${n} value${1===n?"":"s"}: ${n>r?t.slice(0,r-2).map(i).join(", ")+", ending with "+t.slice(-1).map(i):t.map(i).join(", ")}`}{const t=e.domain();return`values from ${i(t[0])} to ${i(F(t))}`}}let Gp=0;const Vp="p_";function Xp(t){return t&&t.gradient}function Jp(t,e,n){const r=t.gradient;let i=t.id,o="radial"===r?Vp:"";return i||(i=t.id="gradient_"+Gp++,"radial"===r?(t.x1=Zp(t.x1,.5),t.y1=Zp(t.y1,.5),t.r1=Zp(t.r1,0),t.x2=Zp(t.x2,.5),t.y2=Zp(t.y2,.5),t.r2=Zp(t.r2,.5),o=Vp):(t.x1=Zp(t.x1,0),t.y1=Zp(t.y1,0),t.x2=Zp(t.x2,1),t.y2=Zp(t.y2,0))),e[i]=t,"url("+(n||"")+"#"+o+i+")"}function Zp(t,e){return null!=t?t:e}function Qp(t,e){var n,r=[];return n={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:e?e[0]:1,y2:e?e[1]:0,stops:r,stop:function(t,e){return r.push({offset:t,color:e}),n}}}const Kp={basis:{curve:function(t){return new tc(t)}},"basis-closed":{curve:function(t){return new ec(t)}},"basis-open":{curve:function(t){return new nc(t)}},bundle:{curve:ic,tension:"beta",value:.85},cardinal:{curve:sc,tension:"tension",value:0},"cardinal-open":{curve:fc,tension:"tension",value:0},"cardinal-closed":{curve:lc,tension:"tension",value:0},"catmull-rom":{curve:pc,tension:"alpha",value:.5},"catmull-rom-closed":{curve:mc,tension:"alpha",value:.5},"catmull-rom-open":{curve:vc,tension:"alpha",value:.5},linear:{curve:Yl},"linear-closed":{curve:function(t){return new _c(t)}},monotone:{horizontal:function(t){return new Mc(t)},vertical:function(t){return new Ac(t)}},natural:{curve:function(t){return new Dc(t)}},step:{curve:function(t){return new Fc(t,.5)}},"step-after":{curve:function(t){return new Fc(t,1)}},"step-before":{curve:function(t){return new Fc(t,0)}}};function tg(t,e,n){var r=ut(Kp,t)&&Kp[t],i=null;return r&&(i=r.curve||r[e||"vertical"],r.tension&&null!=n&&(i=i[r.tension](n))),i}const eg={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},ng=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,rg=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,ig=/^((\s+,?\s*)|(,\s*))/,og=/^[01]/;function ag(t){const e=[];return(t.match(ng)||[]).forEach((t=>{let n=t[0];const r=n.toLowerCase(),i=eg[r],o=function(t,e,n){const r=[];for(let i=0;e&&i1&&(g=Math.sqrt(g),n*=g,r*=g);const m=h/n,y=f/n,v=-f/r,_=h/r,x=m*s+y*u,b=v*s+_*u,w=m*t+y*e,k=v*t+_*e;let A=1/((w-x)*(w-x)+(k-b)*(k-b))-.25;A<0&&(A=0);let M=Math.sqrt(A);o==i&&(M=-M);const E=.5*(x+w)-M*(k-b),D=.5*(b+k)+M*(w-x),C=Math.atan2(b-D,x-E);let F=Math.atan2(k-D,w-E)-C;F<0&&1===o?F+=lg:F>0&&0===o&&(F-=lg);const S=Math.ceil(Math.abs(F/(ug+.001))),$=[];for(let t=0;t+t}function Fg(t,e,n){return Math.max(e,Math.min(t,n))}function Sg(){var t=Ag,e=Mg,n=Eg,r=Dg,i=Cg(0),o=i,a=i,s=i,u=null;function l(l,c,f){var h,d=null!=c?c:+t.call(this,l),p=null!=f?f:+e.call(this,l),g=+n.call(this,l),m=+r.call(this,l),y=Math.min(g,m)/2,v=Fg(+i.call(this,l),0,y),_=Fg(+o.call(this,l),0,y),x=Fg(+a.call(this,l),0,y),b=Fg(+s.call(this,l),0,y);if(u||(u=h=Ol()),v<=0&&_<=0&&x<=0&&b<=0)u.rect(d,p,g,m);else{var w=d+g,k=p+m;u.moveTo(d+v,p),u.lineTo(w-_,p),u.bezierCurveTo(w-kg*_,p,w,p+kg*_,w,p+_),u.lineTo(w,k-b),u.bezierCurveTo(w,k-kg*b,w-kg*b,k,w-b,k),u.lineTo(d+x,k),u.bezierCurveTo(d+kg*x,k,d,k-kg*x,d,k-x),u.lineTo(d,p+v),u.bezierCurveTo(d,p+kg*v,d+kg*v,p,d+v,p),u.closePath()}if(h)return u=null,h+""||null}return l.x=function(e){return arguments.length?(t=Cg(e),l):t},l.y=function(t){return arguments.length?(e=Cg(t),l):e},l.width=function(t){return arguments.length?(n=Cg(t),l):n},l.height=function(t){return arguments.length?(r=Cg(t),l):r},l.cornerRadius=function(t,e,n,r){return arguments.length?(i=Cg(t),o=null!=e?Cg(e):i,s=null!=n?Cg(n):i,a=null!=r?Cg(r):o,l):i},l.context=function(t){return arguments.length?(u=null==t?null:t,l):u},l}function $g(){var t,e,n,r,i,o,a,s,u=null;function l(t,e,n){const r=n/2;if(i){var l=a-e,c=t-o;if(l||c){var f=Math.hypot(l,c),h=(l/=f)*s,d=(c/=f)*s,p=Math.atan2(c,l);u.moveTo(o-h,a-d),u.lineTo(t-l*r,e-c*r),u.arc(t,e,r,p-Math.PI,p),u.lineTo(o+h,a+d),u.arc(o,a,s,p,p+Math.PI)}else u.arc(t,e,r,0,lg);u.closePath()}else i=1;o=t,a=e,s=r}function c(o){var a,s,c,f=o.length,h=!1;for(null==u&&(u=c=Ol()),a=0;a<=f;++a)!(at.x||0,zg=t=>t.y||0,Ng=t=>!(!1===t.defined),Og=function(){var t=Ll,e=Ul,n=yl(0),r=null,i=ql,o=Pl,a=jl,s=null,u=Rl(l);function l(){var l,c,f=+t.apply(this,arguments),h=+e.apply(this,arguments),d=i.apply(this,arguments)-Dl,p=o.apply(this,arguments)-Dl,g=vl(p-d),m=p>d;if(s||(s=l=u()),hMl)if(g>Cl-Ml)s.moveTo(h*xl(d),h*kl(d)),s.arc(0,0,h,d,p,!m),f>Ml&&(s.moveTo(f*xl(p),f*kl(p)),s.arc(0,0,f,p,d,m));else{var y,v,_=d,x=p,b=d,w=p,k=g,A=g,M=a.apply(this,arguments)/2,E=M>Ml&&(r?+r.apply(this,arguments):Al(f*f+h*h)),D=wl(vl(h-f)/2,+n.apply(this,arguments)),C=D,F=D;if(E>Ml){var S=Fl(E/f*kl(M)),$=Fl(E/h*kl(M));(k-=2*S)>Ml?(b+=S*=m?1:-1,w-=S):(k=0,b=w=(d+p)/2),(A-=2*$)>Ml?(_+=$*=m?1:-1,x-=$):(A=0,_=x=(d+p)/2)}var T=h*xl(_),B=h*kl(_),z=f*xl(w),N=f*kl(w);if(D>Ml){var O,R=h*xl(x),L=h*kl(x),U=f*xl(b),q=f*kl(b);if(g1?0:t<-1?El:Math.acos(t)}((P*I+j*W)/(Al(P*P+j*j)*Al(I*I+W*W)))/2),Y=Al(O[0]*O[0]+O[1]*O[1]);C=wl(D,(f-Y)/(H-1)),F=wl(D,(h-Y)/(H+1))}else C=F=0}A>Ml?F>Ml?(y=Il(U,q,T,B,h,F,m),v=Il(R,L,z,N,h,F,m),s.moveTo(y.cx+y.x01,y.cy+y.y01),FMl&&k>Ml?C>Ml?(y=Il(z,N,R,L,f,-C,m),v=Il(T,B,U,q,f,-C,m),s.lineTo(y.cx+y.x01,y.cy+y.y01),Ct.startAngle||0)).endAngle((t=>t.endAngle||0)).padAngle((t=>t.padAngle||0)).innerRadius((t=>t.innerRadius||0)).outerRadius((t=>t.outerRadius||0)).cornerRadius((t=>t.cornerRadius||0)),Rg=Jl().x(Bg).y1(zg).y0((t=>(t.y||0)+(t.height||0))).defined(Ng),Lg=Jl().y(zg).x1(Bg).x0((t=>(t.x||0)+(t.width||0))).defined(Ng),Ug=Xl().x(Bg).y(zg).defined(Ng),qg=Sg().x(Bg).y(zg).width((t=>t.width||0)).height((t=>t.height||0)).cornerRadius((t=>Tg(t.cornerRadiusTopLeft,t.cornerRadius)||0),(t=>Tg(t.cornerRadiusTopRight,t.cornerRadius)||0),(t=>Tg(t.cornerRadiusBottomRight,t.cornerRadius)||0),(t=>Tg(t.cornerRadiusBottomLeft,t.cornerRadius)||0)),Pg=function(t,e){let n=null,r=Rl(i);function i(){let i;if(n||(n=i=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),i)return n=null,i+""||null}return t="function"==typeof t?t:yl(t||Zl),e="function"==typeof e?e:yl(void 0===e?64:+e),i.type=function(e){return arguments.length?(t="function"==typeof e?e:yl(e),i):t},i.size=function(t){return arguments.length?(e="function"==typeof t?t:yl(+t),i):e},i.context=function(t){return arguments.length?(n=null==t?null:t,i):n},i}().type((t=>bg(t.shape||"circle"))).size((t=>Tg(t.size,64))),jg=$g().x(Bg).y(zg).defined(Ng).size((t=>t.size||1));function Ig(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function Wg(t,e,n,r){return qg.context(t)(e,n,r)}var Hg=1;function Yg(){Hg=1}function Gg(t,e,n){var r=e.clip,i=t._defs,o=e.clip_id||(e.clip_id="clip"+Hg++),a=i.clipping[o]||(i.clipping[o]={id:o});return J(r)?a.path=r(null):Ig(n)?a.path=Wg(null,n,0,0):(a.width=n.width||0,a.height=n.height||0),"url(#"+o+")"}function Vg(t){this.clear(),t&&this.union(t)}function Xg(t){this.mark=t,this.bounds=this.bounds||new Vg}function Jg(t){Xg.call(this,t),this.items=this.items||[]}Vg.prototype={clone(){return new Vg(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},set(t,e,n,r){return nthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},expand(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},translate(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},rotate(t,e,n){const r=this.rotatedPoints(t,e,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(t,e,n){var{x1:r,y1:i,x2:o,y2:a}=this,s=Math.cos(t),u=Math.sin(t),l=e-e*s+n*u,c=n-e*u-n*s;return[s*r-u*i+l,u*r+s*i+c,s*r-u*a+l,u*r+s*a+c,s*o-u*i+l,u*o+s*i+c,s*o-u*a+l,u*o+s*a+c]},union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},alignsWith(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)},contains(t,e){return!(tthis.x2||ethis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},ht(Jg,Xg);class Zg{constructor(t){this._pending=0,this._loader=t||ca()}pending(){return this._pending}sanitizeURL(t){const e=this;return Qg(e),e._loader.sanitize(t,{context:"href"}).then((t=>(Kg(e),t))).catch((()=>(Kg(e),null)))}loadImage(t){const e=this,n=$c();return Qg(e),e._loader.sanitize(t,{context:"image"}).then((t=>{const r=t.href;if(!r||!n)throw{url:r};const i=new n,o=ut(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=o&&(i.crossOrigin=o),i.onload=()=>Kg(e),i.onerror=()=>Kg(e),i.src=r,i})).catch((t=>(Kg(e),{complete:!1,width:0,height:0,src:t&&t.url||""})))}ready(){const t=this;return new Promise((e=>{!function n(r){t.pending()?setTimeout((()=>{n(!0)}),10):e(r)}(!1)}))}}function Qg(t){t._pending+=1}function Kg(t){t._pending-=1}function tm(t,e,n){if(e.stroke&&0!==e.opacity&&0!==e.strokeOpacity){const r=null!=e.strokeWidth?+e.strokeWidth:1;t.expand(r+(n?function(t,e){return t.strokeJoin&&"miter"!==t.strokeJoin?0:e}(e,r):0))}return t}const em=lg-1e-8;let nm,rm,im,om,am,sm,um,lm;const cm=(t,e)=>nm.add(t,e),fm=(t,e)=>cm(rm=t,im=e),hm=t=>cm(t,nm.y1),dm=t=>cm(nm.x1,t),pm=(t,e)=>am*t+um*e,gm=(t,e)=>sm*t+lm*e,mm=(t,e)=>cm(pm(t,e),gm(t,e)),ym=(t,e)=>fm(pm(t,e),gm(t,e));function vm(t,e){return nm=t,e?(om=e*sg,am=lm=Math.cos(om),sm=Math.sin(om),um=-sm):(am=lm=1,om=sm=um=0),_m}const _m={beginPath(){},closePath(){},moveTo:ym,lineTo:ym,rect(t,e,n,r){om?(mm(t+n,e),mm(t+n,e+r),mm(t,e+r),ym(t,e)):(cm(t+n,e+r),fm(t,e))},quadraticCurveTo(t,e,n,r){const i=pm(t,e),o=gm(t,e),a=pm(n,r),s=gm(n,r);xm(rm,i,a,hm),xm(im,o,s,dm),fm(a,s)},bezierCurveTo(t,e,n,r,i,o){const a=pm(t,e),s=gm(t,e),u=pm(n,r),l=gm(n,r),c=pm(i,o),f=gm(i,o);bm(rm,a,u,c,hm),bm(im,s,l,f,dm),fm(c,f)},arc(t,e,n,r,i,o){if(r+=om,i+=om,rm=n*Math.cos(i)+t,im=n*Math.sin(i)+e,Math.abs(i-r)>em)cm(t-n,e-n),cm(t+n,e+n);else{const a=r=>cm(n*Math.cos(r)+t,n*Math.sin(r)+e);let s,u;if(a(r),a(i),i!==r)if((r%=lg)<0&&(r+=lg),(i%=lg)<0&&(i+=lg),ii;++u,s-=ug)a(s);else for(s=r-r%ug+ug,u=0;u<4&&s1e-14?(u=a*a+s*o,u>=0&&(u=Math.sqrt(u),l=(-a+u)/o,c=(-a-u)/o)):l=.5*s/a,0m)return!1;d>g&&(g=d)}else if(f>0){if(d0&&(t.globalAlpha=n,t.fillStyle=Bm(t,e,e.fill),!0)}var Nm=[];function Om(t,e,n){var r=null!=(r=e.strokeWidth)?r:1;return!(r<=0)&&((n*=null==e.strokeOpacity?1:e.strokeOpacity)>0&&(t.globalAlpha=n,t.strokeStyle=Bm(t,e,e.stroke),t.lineWidth=r,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=e.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(e.strokeDash||Nm),t.lineDashOffset=e.strokeDashOffset||0),!0))}function Rm(t,e){return t.zindex-e.zindex||t.index-e.index}function Lm(t){if(!t.zdirty)return t.zitems;var e,n,r,i=t.items,o=[];for(n=0,r=i.length;n=0;)if(n=e(i[r]))return n;if(i===o)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(n=e(i[r])))return n;return null}function Pm(t){return function(e,n,r){Um(n,(n=>{r&&!r.intersects(n.bounds)||Im(t,e,n,n)}))}}function jm(t){return function(e,n,r){!n.items.length||r&&!r.intersects(n.bounds)||Im(t,e,n.items[0],n.items)}}function Im(t,e,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(t(e,r)||(Sm(e,n),n.fill&&zm(e,n,i)&&e.fill(),n.stroke&&Om(e,n,i)&&e.stroke()))}function Wm(t){return t=t||p,function(e,n,r,i,o,a){return r*=e.pixelRatio,i*=e.pixelRatio,qm(n,(n=>{const s=n.bounds;if((!s||s.contains(o,a))&&s)return t(e,n,r,i,o,a)?n:void 0}))}}function Hm(t,e){return function(n,r,i,o){var a,s,u=Array.isArray(r)?r[0]:r,l=null==e?u.fill:e,c=u.stroke&&n.isPointInStroke;return c&&(a=u.strokeWidth,s=u.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=s?s:"butt"),!t(n,r)&&(l&&n.isPointInPath(i,o)||c&&n.isPointInStroke(i,o))}}function Ym(t){return Wm(Hm(t))}function Gm(t,e){return"translate("+t+","+e+")"}function Vm(t){return"rotate("+t+")"}function Xm(t){return Gm(t.x||0,t.y||0)}function Jm(t,e,n){function r(t,n){var r=n.x||0,i=n.y||0,o=n.angle||0;t.translate(r,i),o&&t.rotate(o*=sg),t.beginPath(),e(t,n),o&&t.rotate(-o),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",function(t){return Gm(t.x||0,t.y||0)+(t.angle?" "+Vm(t.angle):"")}(n)),t("d",e(null,n))},bound:function(t,n){return e(vm(t,n.angle),n),tm(t,n).translate(n.x||0,n.y||0)},draw:Pm(r),pick:Ym(r),isect:n||Mm(r)}}var Zm=Jm("arc",(function(t,e){return Og.context(t)(e)}));function Qm(t,e,n){function r(t,n){t.beginPath(),e(t,n)}const i=Hm(r);return{type:t,tag:"path",nested:!0,attr:function(t,n){var r=n.mark.items;r.length&&t("d",e(null,r))},bound:function(t,n){var r=n.items;return 0===r.length?t:(e(vm(t),r),tm(t,r[0]))},draw:jm(r),pick:function(t,e,n,r,o,a){var s=e.items,u=e.bounds;return!s||!s.length||u&&!u.contains(o,a)?null:(n*=t.pixelRatio,r*=t.pixelRatio,i(t,s,n,r)?s[0]:null)},isect:Em,tip:n}}var Km=Qm("area",(function(t,e){const n=e[0],r=n.interpolate||"linear";return("horizontal"===n.orient?Lg:Rg).curve(tg(r,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,r,i="horizontal"===t[0].orient?e[1]:e[0],o="horizontal"===t[0].orient?"y":"x",a=t.length,s=1/0;--a>=0;)!1!==t[a].defined&&(r=Math.abs(t[a][o]-i)).5&&e<1.5?.5-Math.abs(e-1):0}function ny(t,e){const n=ey(e);t("d",Wg(null,e,n,n))}function ry(t,e,n,r){const i=ey(e);t.beginPath(),Wg(t,e,(n||0)+i,(r||0)+i)}const iy=Hm(ry),oy=Hm(ry,!1),ay=Hm(ry,!0);var sy={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",Xm(e))},bound:function(t,e){if(!e.clip&&e.items){const n=e.items,r=n.length;for(let e=0;e{const i=e.x||0,o=e.y||0,a=e.strokeForeground,s=null==e.opacity?1:e.opacity;(e.stroke||e.fill)&&s&&(ry(t,e,i,o),Sm(t,e),e.fill&&zm(t,e,s)&&t.fill(),e.stroke&&!a&&Om(t,e,s)&&t.stroke()),t.save(),t.translate(i,o),e.clip&&ty(t,e),n&&n.translate(-i,-o),Um(e,(e=>{("group"===e.marktype||null==r||r.includes(e.marktype))&&this.draw(t,e,n,r)})),n&&n.translate(i,o),t.restore(),a&&e.stroke&&s&&(ry(t,e,i,o),Sm(t,e),Om(t,e,s)&&t.stroke())}))},pick:function(t,e,n,r,i,o){if(e.bounds&&!e.bounds.contains(i,o)||!e.items)return null;const a=n*t.pixelRatio,s=r*t.pixelRatio;return qm(e,(u=>{let l,c,f;const h=u.bounds;if(h&&!h.contains(i,o))return;c=u.x||0,f=u.y||0;const d=c+(u.width||0),p=f+(u.height||0),g=u.clip;if(g&&(id||op))return;if(t.save(),t.translate(c,f),c=i-c,f=o-f,g&&Ig(u)&&!ay(t,u,a,s))return t.restore(),null;const m=u.strokeForeground,y=!1!==e.interactive;return y&&m&&u.stroke&&oy(t,u,a,s)?(t.restore(),u):(l=qm(u,(t=>function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,c,f)?this.pick(t,n,r,c,f):null)),!l&&y&&(u.fill||!m&&u.stroke)&&iy(t,u,a,s)&&(l=u),t.restore(),l||null)}))},isect:Dm,content:function(t,e,n){t("clip-path",e.clip?Gg(n,e,e):null)},background:function(t,e){t("class","background"),t("aria-hidden",!0),ny(t,e)},foreground:function(t,e){t("class","foreground"),t("aria-hidden",!0),e.strokeForeground?ny(t,e):t("d","")}},uy={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function ly(t,e){var n=t.image;return(!n||t.url&&t.url!==n.url)&&(n={complete:!1,width:0,height:0},e.loadImage(t.url).then((e=>{t.image=e,t.image.url=t.url}))),n}function cy(t,e){return null!=t.width?t.width:e&&e.width?!1!==t.aspect&&t.height?t.height*e.width/e.height:e.width:0}function fy(t,e){return null!=t.height?t.height:e&&e.height?!1!==t.aspect&&t.width?t.width*e.height/e.width:e.height:0}function hy(t,e){return"center"===t?e/2:"right"===t?e:0}function dy(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var py={type:"image",tag:"image",nested:!1,attr:function(t,e,n){const r=ly(e,n),i=cy(e,r),o=fy(e,r),a=(e.x||0)-hy(e.align,i),s=(e.y||0)-dy(e.baseline,o);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",uy["xmlns:xlink"],"xlink:href"),t("transform",Gm(a,s)),t("width",i),t("height",o),t("preserveAspectRatio",!1===e.aspect?"none":"xMidYMid")},bound:function(t,e){const n=e.image,r=cy(e,n),i=fy(e,n),o=(e.x||0)-hy(e.align,r),a=(e.y||0)-dy(e.baseline,i);return t.set(o,a,o+r,a+i)},draw:function(t,e,n){Um(e,(e=>{if(n&&!n.intersects(e.bounds))return;const r=ly(e,this);let i=cy(e,r),o=fy(e,r);if(0===i||0===o)return;let a,s,u,l,c=(e.x||0)-hy(e.align,i),f=(e.y||0)-dy(e.baseline,o);!1!==e.aspect&&(s=r.width/r.height,u=e.width/e.height,s==s&&u==u&&s!==u&&(u=0;)if(!1!==t[o].defined&&(n=t[o].x-e[0])*n+(r=t[o].y-e[1])*r{if(!n||n.intersects(e.bounds)){var r=null==e.opacity?1:e.opacity;r&&xy(t,e,r)&&(Sm(t,e),t.stroke())}}))},pick:Wm((function(t,e,n,r){return!!t.isPointInStroke&&(xy(t,e,1)&&t.isPointInStroke(n,r))})),isect:Cm},wy=Jm("shape",(function(t,e){return(e.mark.shape||e.shape).context(t)(e)})),ky=Jm("symbol",(function(t,e){return Pg.context(t)(e)}),Em);const Ay=wt();var My={height:$y,measureWidth:Fy,estimateWidth:Dy,width:Dy,canvas:Ey};function Ey(t){My.width=t&&km?Fy:Dy}function Dy(t,e){return Cy(Ny(t,e),$y(t))}function Cy(t,e){return~~(.8*t.length*e)}function Fy(t,e){return $y(t)<=0||!(e=Ny(t,e))?0:Sy(e,Ry(t))}function Sy(t,e){const n=`(${e}) ${t}`;let r=Ay.get(n);return void 0===r&&(km.font=e,r=km.measureText(t).width,Ay.set(n,r)),r}function $y(t){return null!=t.fontSize?+t.fontSize||0:11}function Ty(t){return null!=t.lineHeight?t.lineHeight:$y(t)+2}function By(t){return e=t.lineBreak&&t.text&&!k(t.text)?t.text.split(t.lineBreak):t.text,k(e)?e.length>1?e:e[0]:e;var e}function zy(t){const e=By(t);return(k(e)?e.length-1:0)*Ty(t)}function Ny(t,e){const n=null==e?"":(e+"").trim();return t.limit>0&&n.length?function(t,e){var n=+t.limit,r=function(t){if(My.width===Fy){const e=Ry(t);return t=>Sy(t,e)}if(My.width===Dy){const e=$y(t);return t=>Cy(t,e)}return e=>My.width(t,e)}(t);if(r(e)>>1,r(e.slice(i))>n?s=i+1:u=i;return o+e.slice(s)}for(;s>>1),r(e.slice(0,i))Math.max(t,My.width(e,n))),0)):r=My.width(e,f),"center"===o?l-=r/2:"right"===o&&(l-=r),t.set(l+=s,c+=u,l+r,c+i),e.angle&&!n)t.rotate(e.angle*sg,s,u);else if(2===n)return t.rotatedPoints(e.angle*sg,s,u);return t}var Iy={type:"text",tag:"text",nested:!1,attr:function(t,e){var n,r=e.dx||0,i=(e.dy||0)+Ly(e),o=Py(e),a=o.x1,s=o.y1,u=e.angle||0;t("text-anchor",Uy[e.align]||"start"),u?(n=Gm(a,s)+" "+Vm(u),(r||i)&&(n+=" "+Gm(r,i))):n=Gm(a+r,s+i),t("transform",n)},bound:jy,draw:function(t,e,n){Um(e,(e=>{var r,i,o,a,s,u,l,c=null==e.opacity?1:e.opacity;if(!(n&&!n.intersects(e.bounds)||0===c||e.fontSize<=0||null==e.text||0===e.text.length)){if(t.font=Ry(e),t.textAlign=e.align||"left",i=(r=Py(e)).x1,o=r.y1,e.angle&&(t.save(),t.translate(i,o),t.rotate(e.angle*sg),i=o=0),i+=e.dx||0,o+=(e.dy||0)+Ly(e),u=By(e),Sm(t,e),k(u))for(s=Ty(e),a=0;a=0;)if(!1!==t[i].defined&&(n=t[i].x-e[0])*n+(r=t[i].y-e[1])*r<(n=t[i].size||1)*n)return t[i];return null})),Hy={arc:Zm,area:Km,group:sy,image:py,line:gy,path:yy,rect:_y,rule:by,shape:wy,symbol:ky,text:Iy,trail:Wy};function Yy(t,e,n){var r=Hy[t.mark.marktype],i=e||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new Vg),t,n)}var Gy={mark:null};function Vy(t,e,n){var r,i,o,a,s=Hy[t.marktype],u=s.bound,l=t.items,c=l&&l.length;if(s.nested)return c?o=l[0]:(Gy.mark=t,o=Gy),a=Yy(o,u,n),e=e&&e.union(a)||a;if(e=e||t.bounds&&t.bounds.clear()||new Vg,c)for(r=0,i=l.length;re;)t.removeChild(n[--r]);return t}function ov(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function av(t,e){const n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}class sv{constructor(t,e){this._active=null,this._handlers={},this._loader=t||ca(),this._tooltip=e||uv}initialize(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()}scene(t){return arguments.length?(this._scene=t,this):this._scene}on(){}off(){}_handlerIndex(t,e,n){for(let r=t?t.length:0;--r>=0;)if(t[r].type===e&&(!n||t[r].handler===n))return r;return-1}handlers(t){const e=this._handlers,n=[];if(t)n.push(...e[this.eventName(t)]);else for(const t in e)n.push(...e[t]);return n}eventName(t){const e=t.indexOf(".");return e<0?t:t.slice(0,e)}handleHref(t,e,n){this._loader.sanitize(n,{context:"href"}).then((e=>{const n=new MouseEvent(t.type,t),r=ev(null,"a");for(const t in e)r.setAttribute(t,e[t]);r.dispatchEvent(n)})).catch((()=>{}))}handleTooltip(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,r){var i,o,a=t&&t.mark;if(a&&(i=Hy[a.marktype]).tip){for((o=av(e,n))[0]-=r[0],o[1]-=r[1];t=t.mark.group;)o[0]-=t.x||0,o[1]-=t.y||0;t=i.tip(a.items,o)}return t}(e,t,this.canvas(),this._origin);const r=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,r)}}getItemBoundingClientRect(t){const e=this.canvas();if(!e)return;const n=e.getBoundingClientRect(),r=this._origin,i=t.bounds,o=i.width(),a=i.height();let s=i.x1+r[0]+n.left,u=i.y1+r[1]+n.top;for(;t.mark&&(t=t.mark.group);)s+=t.x||0,u+=t.y||0;return{x:s,y:u,width:o,height:a,left:s,top:u,right:s+o,bottom:u+a}}}function uv(t,e,n,r){t.element().setAttribute("title",r||"")}class lv{constructor(t){this._el=null,this._bgcolor=null,this._loader=new Zg(t)}initialize(t,e,n,r,i){return this._el=t,this.resize(e,n,r,i)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)}resize(t,e,n,r){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=r||1,this}dirty(){}render(t,e){const n=this;return n._call=function(){n._render(t,e)},n._call(),n._call=null,n}_render(){}renderAsync(t,e){const n=this.render(t,e);return this._ready?this._ready.then((()=>n)):Promise.resolve(n)}_load(t,e){var n=this,r=n._loader[t](e);if(!n._ready){const t=n._call;n._ready=n._loader.ready().then((e=>{e&&t(),n._ready=null}))}return r}sanitizeURL(t){return this._load("sanitizeURL",t)}loadImage(t){return this._load("loadImage",t)}}const cv="dragenter",fv="dragleave",hv="dragover",dv="pointerdown",pv="pointermove",gv="pointerout",mv="pointerover",yv="mousedown",vv="mousemove",_v="mouseout",xv="mouseover",bv="click",wv="mousewheel",kv="touchstart",Av="touchmove",Mv="touchend",Ev=["keydown","keypress","keyup",cv,fv,hv,dv,"pointerup",pv,gv,mv,yv,"mouseup",vv,_v,xv,bv,"dblclick","wheel",wv,kv,Av,Mv],Dv=pv,Cv=_v,Fv=bv;class Sv extends sv{constructor(t,e){super(t,e),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=Ev,this.pointermove=zv([pv,vv],[mv,xv],[gv,_v]),this.dragover=zv([hv],[cv],[fv]),this.pointerout=Nv([gv,_v]),this.dragleave=Nv([fv])}initialize(t,e,n){return this._canvas=t&&nv(t,"canvas"),[bv,yv,dv,pv,gv,fv].forEach((t=>Tv(this,t))),super.initialize(t,e,n)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(t){this.fire(wv,t)}pointerdown(t){this._down=this._active,this.fire(dv,t)}mousedown(t){this._down=this._active,this.fire(yv,t)}click(t){this._down===this._active&&(this.fire(bv,t),this._down=null)}touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(kv,t,!0)}touchmove(t){this.fire(Av,t,!0)}touchend(t){this.fire(Mv,t,!0),this._touch=null}fire(t,e,n){const r=n?this._touch:this._active,i=this._handlers[t];if(e.vegaType=t,t===Fv&&r&&r.href?this.handleHref(e,r,r.href):t!==Dv&&t!==Cv||this.handleTooltip(e,r,t!==Cv),i)for(let t=0,n=i.length;t=0&&r.splice(i,1),this}pickEvent(t){const e=av(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])}pick(t,e,n,r,i){const o=this.context();return Hy[t.marktype].pick.call(this,o,t,e,n,r,i)}}const $v=t=>t===kv||t===Av||t===Mv?[kv,Av,Mv]:[t];function Tv(t,e){$v(e).forEach((e=>function(t,e){const n=t.canvas();n&&!t._events[e]&&(t._events[e]=1,n.addEventListener(e,t[e]?n=>t[e](n):n=>t.fire(e,n)))}(t,e)))}function Bv(t,e,n){e.forEach((e=>t.fire(e,n)))}function zv(t,e,n){return function(r){const i=this._active,o=this.pickEvent(r);o===i||(i&&i.exit||Bv(this,n,r),this._active=o,Bv(this,e,r)),Bv(this,t,r)}}function Nv(t){return function(e){Bv(this,t,e),this._active=null}}function Ov(t,e,n,r,i,o){const a="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,s=t.getContext("2d"),u=a?"undefined"!=typeof window&&window.devicePixelRatio||1:i;t.width=e*u,t.height=n*u;for(const t in o)s[t]=o[t];return a&&1!==u&&(t.style.width=e+"px",t.style.height=n+"px"),s.pixelRatio=u,s.setTransform(u,0,0,u,u*r[0],u*r[1]),t}class Rv extends lv{constructor(t){super(t),this._options={},this._redraw=!1,this._dirty=new Vg,this._tempb=new Vg}initialize(t,e,n,r,i,o){return this._options=o||{},this._canvas=this._options.externalContext?null:Sc(1,1,this._options.type),t&&this._canvas&&(iv(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(t,e,n,r,i)}resize(t,e,n,r){if(super.resize(t,e,n,r),this._canvas)Ov(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const t=this._options.externalContext;t||s("CanvasRenderer is missing a valid canvas or context"),t.scale(this._scale,this._scale),t.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(t){const e=this._tempb.clear().union(t.bounds);let n=t.mark.group;for(;n;)e.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(e)}_render(t,e){const n=this.context(),r=this._origin,i=this._width,o=this._height,a=this._dirty,s=Lv(r,i,o);n.save();const u=this._redraw||a.empty()?(this._redraw=!1,s.expand(1)):function(t,e,n){e.expand(1).round(),t.pixelRatio%1&&e.scale(t.pixelRatio).round().scale(1/t.pixelRatio);return e.translate(-n[0]%1,-n[1]%1),t.beginPath(),t.rect(e.x1,e.y1,e.width(),e.height()),t.clip(),e}(n,s.intersect(a),r);return this.clear(-r[0],-r[1],i,o),this.draw(n,t,u,e),n.restore(),a.clear(),this}draw(t,e,n,r){if("group"!==e.marktype&&null!=r&&!r.includes(e.marktype))return;const i=Hy[e.marktype];e.clip&&function(t,e){var n=e.clip;t.save(),J(n)?(t.beginPath(),n(t),t.clip()):ty(t,e.group)}(t,e),i.draw.call(this,t,e,n,r),e.clip&&t.restore()}clear(t,e,n,r){const i=this._options,o=this.context();"pdf"===i.type||i.externalContext||o.clearRect(t,e,n,r),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(t,e,n,r))}}const Lv=(t,e,n)=>(new Vg).set(0,0,e,n).translate(-t[0],-t[1]);class Uv extends sv{constructor(t,e){super(t,e);const n=this;n._hrefHandler=qv(n,((t,e)=>{e&&e.href&&n.handleHref(t,e,e.href)})),n._tooltipHandler=qv(n,((t,e)=>{n.handleTooltip(t,e,t.type!==Cv)}))}initialize(t,e,n){let r=this._svg;return r&&(r.removeEventListener(Fv,this._hrefHandler),r.removeEventListener(Dv,this._tooltipHandler),r.removeEventListener(Cv,this._tooltipHandler)),this._svg=r=t&&nv(t,"svg"),r&&(r.addEventListener(Fv,this._hrefHandler),r.addEventListener(Dv,this._tooltipHandler),r.addEventListener(Cv,this._tooltipHandler)),super.initialize(t,e,n)}canvas(){return this._svg}on(t,e){const n=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[n],t,e)<0){const i={type:t,handler:e,listener:qv(this,e)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this}off(t,e){const n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this}}const qv=(t,e)=>n=>{let r=n.target.__data__;r=Array.isArray(r)?r[0]:r,n.vegaType=n.type,e.call(t._obj,n,r)},Pv="aria-hidden",jv="aria-label",Iv="role",Wv="aria-roledescription",Hv="graphics-object",Yv="graphics-symbol",Gv=(t,e,n)=>({[Iv]:t,[Wv]:e,[jv]:n||void 0}),Vv=Tt(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Xv={axis:{desc:"axis",caption:function(t){const e=t.datum,n=t.orient,r=e.title?t_(t):null,i=t.context,o=i.scales[e.scale].value,a=i.dataflow.locale(),s=o.type;return("left"===n||"right"===n?"Y":"X")+"-axis"+(r?` titled '${r}'`:"")+` for a ${cp(s)?"discrete":s} scale`+` with ${Yp(a,o,t)}`}},legend:{desc:"legend",caption:function(t){const e=t.datum,n=e.title?t_(t):null,r=`${e.type||""} legend`.trim(),i=e.scales,o=Object.keys(i),a=t.context,s=a.scales[i[o[0]]].value,u=a.dataflow.locale();return l=r,(l.length?l[0].toUpperCase()+l.slice(1):l)+(n?` titled '${n}'`:"")+` for ${function(t){return t=t.map((t=>t+("fill"===t||"stroke"===t?" color":""))),t.length<2?t[0]:t.slice(0,-1).join(", ")+" and "+F(t)}(o)}`+` with ${Yp(u,s,t)}`;var l}},"title-text":{desc:"title",caption:t=>`Title text '${Kv(t)}'`},"title-subtitle":{desc:"subtitle",caption:t=>`Subtitle text '${Kv(t)}'`}},Jv={ariaRole:Iv,ariaRoleDescription:Wv,description:jv};function Zv(t,e){const n=!1===e.aria;if(t(Pv,n||void 0),n||null==e.description)for(const e in Jv)t(Jv[e],void 0);else{const n=e.mark.marktype;t(jv,e.description),t(Iv,e.ariaRole||("group"===n?Hv:Yv)),t(Wv,e.ariaRoleDescription||`${n} mark`)}}function Qv(t){return!1===t.aria?{[Pv]:!0}:Vv[t.role]?null:Xv[t.role]?function(t,e){try{const n=t.items[0],r=e.caption||(()=>"");return Gv(e.role||Yv,e.desc,n.description||r(n))}catch(t){return null}}(t,Xv[t.role]):function(t){const e=t.marktype,n="group"===e||"text"===e||t.items.some((t=>null!=t.description&&!1!==t.aria));return Gv(n?Hv:Yv,`${e} mark container`,t.description)}(t)}function Kv(t){return V(t.text).join(" ")}function t_(t){try{return V(F(t.items).items[0].text).join(" ")}catch(t){return null}}const e_=t=>(t+"").replace(/&/g,"&").replace(//g,">");function n_(){let t="",e="",n="";const r=[],i=()=>e=n="",o=(t,n)=>{var r;return null!=n&&(e+=` ${t}="${r=n,e_(r).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g," ").replace(/\r/g," ")}"`),a},a={open(s){(o=>{e&&(t+=`${e}>${n}`,i()),r.push(o)})(s),e="<"+s;for(var u=arguments.length,l=new Array(u>1?u-1:0),c=1;c${n}`:"/>"):``,i(),a},attr:o,text:t=>(n+=e_(t),a),toString:()=>t};return a}const r_=t=>i_(n_(),t)+"";function i_(t,e){if(t.open(e.tagName),e.hasAttributes()){const n=e.attributes,r=n.length;for(let e=0;e{t.dirty=e}))),r.zdirty||(n.exit?(o.nested&&r.items.length?(u=r.items[0],u._svg&&this._update(o,u._svg,u)):n._svg&&(u=n._svg.parentNode,u&&u.removeChild(n._svg)),n._svg=null):(n=o.nested?r.items[0]:n,n._update!==e&&(n._svg&&n._svg.ownerSVGElement?this._update(o,n._svg,n):(this._dirtyAll=!1,f_(n,e)),n._update=e)));return!this._dirtyAll}mark(t,e,n,r){if(!this.isDirty(e))return e._svg;const i=this._svg,o=e.marktype,a=Hy[o],s=!1===e.interactive?"none":null,u="g"===a.tag,l=p_(e,t,n,"g",i);if("group"!==o&&null!=r&&!r.includes(o))return iv(l,0),e._svg;l.setAttribute("class",ov(e));const c=Qv(e);for(const t in c)b_(l,t,c[t]);u||b_(l,"pointer-events",s),b_(l,"clip-path",e.clip?Gg(this,e,e.group):null);let f=null,h=0;const d=t=>{const e=this.isDirty(t),n=p_(t,l,f,a.tag,i);e&&(this._update(a,n,t),u&&function(t,e,n,r){e=e.lastChild.previousSibling;let i,o=0;Um(n,(n=>{i=t.mark(e,n,i,r),++o})),iv(e,1+o)}(this,n,t,r)),f=n,++h};return a.nested?e.items.length&&d(e.items[0]):Um(e,d),iv(l,h),l}_update(t,e,n){g_=e,m_=e.__values__,Zv(v_,n),t.attr(v_,n,this);const r=y_[t.type];r&&r.call(this,t,e,n),g_&&this.style(g_,n)}style(t,e){if(null!=e){for(const n in o_){let r="font"===n?Oy(e):e[n];if(r===m_[n])continue;const i=o_[n];null==r?t.removeAttribute(i):(Xp(r)&&(r=Jp(r,this._defs.gradient,w_())),t.setAttribute(i,r+"")),m_[n]=r}for(const n in a_)__(t,a_[n],e[n])}}defs(){const t=this._svg,e=this._defs;let n=e.el,r=0;for(const i in e.gradient)n||(e.el=n=rv(t,1,"defs",l_)),r=h_(n,e.gradient[i],r);for(const i in e.clipping)n||(e.el=n=rv(t,1,"defs",l_)),r=d_(n,e.clipping[i],r);n&&(0===r?(t.removeChild(n),e.el=null):iv(n,r))}_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}}function f_(t,e){for(;t&&t.dirty!==e;t=t.mark.group){if(t.dirty=e,!t.mark||t.mark.dirty===e)return;t.mark.dirty=e}}function h_(t,e,n){let r,i,o;if("radial"===e.gradient){let r=rv(t,n++,"pattern",l_);x_(r,{id:Vp+e.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),r=rv(r,0,"rect",l_),x_(r,{width:1,height:1,fill:`url(${w_()}#${e.id})`}),x_(t=rv(t,n++,"radialGradient",l_),{id:e.id,fx:e.x1,fy:e.y1,fr:e.r1,cx:e.x2,cy:e.y2,r:e.r2})}else x_(t=rv(t,n++,"linearGradient",l_),{id:e.id,x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2});for(r=0,i=e.stops.length;r1&&t.previousSibling!=e}(a,n))&&e.insertBefore(a,n?n.nextSibling:e.firstChild),a}let g_=null,m_=null;const y_={group(t,e,n){const r=g_=e.childNodes[2];m_=r.__values__,t.foreground(v_,n,this),m_=e.__values__,g_=e.childNodes[1],t.content(v_,n,this);const i=g_=e.childNodes[0];t.background(v_,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==m_.events&&(b_(r,"pointer-events",o),b_(i,"pointer-events",o),m_.events=o),n.strokeForeground&&n.stroke){const t=n.fill;b_(r,"display",null),this.style(i,n),b_(i,"stroke",null),t&&(n.fill=null),m_=r.__values__,this.style(r,n),t&&(n.fill=t),g_=null}else b_(r,"display","none")},image(t,e,n){!1===n.smooth?(__(e,"image-rendering","optimizeSpeed"),__(e,"image-rendering","pixelated")):__(e,"image-rendering",null)},text(t,e,n){const r=By(n);let i,o,a,s;k(r)?(o=r.map((t=>Ny(n,t))),i=o.join("\n"),i!==m_.text&&(iv(e,0),a=e.ownerDocument,s=Ty(n),o.forEach(((t,r)=>{const i=ev(a,"tspan",l_);i.__data__=n,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",s)),e.appendChild(i)})),m_.text=i)):(o=Ny(n,r),o!==m_.text&&(e.textContent=o,m_.text=o)),b_(e,"font-family",Oy(n)),b_(e,"font-size",$y(n)+"px"),b_(e,"font-style",n.fontStyle),b_(e,"font-variant",n.fontVariant),b_(e,"font-weight",n.fontWeight)}};function v_(t,e,n){e!==m_[t]&&(n?function(t,e,n,r){null!=n?t.setAttributeNS(r,e,n):t.removeAttributeNS(r,e)}(g_,t,e,n):b_(g_,t,e),m_[t]=e)}function __(t,e,n){n!==m_[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),m_[e]=n)}function x_(t,e){for(const n in e)b_(t,n,e[n])}function b_(t,e,n){null!=n?t.setAttribute(e,n):t.removeAttribute(e)}function w_(){let t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}class k_ extends lv{constructor(t){super(t),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(t){const e=n_();e.open("svg",ot({},uy,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const n=this._bgcolor;return n&&"transparent"!==n&&"none"!==n&&e.open("rect",{width:this._width,height:this._height,fill:n}).close(),e.open("g",s_,{transform:"translate("+this._origin+")"}),this.mark(e,t),e.close(),this.defs(e),this._text=e.close()+"",this}mark(t,e){const n=Hy[e.marktype],r=n.tag,i=[Zv,n.attr];t.open("g",{class:ov(e),"clip-path":e.clip?Gg(this,e,e.group):null},Qv(e),{"pointer-events":"g"!==r&&!1===e.interactive?"none":null});const o=o=>{const a=this.href(o);if(a&&t.open("a",a),t.open(r,this.attr(e,o,i,"g"!==r?r:null)),"text"===r){const e=By(o);if(k(e)){const n={x:0,dy:Ty(o)};for(let r=0;rthis.mark(t,e))),t.close(),r&&a?(i&&(o.fill=null),o.stroke=a,t.open("path",this.attr(e,o,n.foreground,"bgrect")).close(),i&&(o.fill=i)):t.open("path",this.attr(e,o,n.foreground,"bgfore")).close()}t.close(),a&&t.close()};return n.nested?e.items&&e.items.length&&o(e.items[0]):Um(e,o),t.close()}href(t){const e=t.href;let n;if(e){if(n=this._hrefs&&this._hrefs[e])return n;this.sanitizeURL(e).then((t=>{t["xlink:href"]=t.href,t.href=null,(this._hrefs||(this._hrefs={}))[e]=t}))}return null}attr(t,e,n,r){const i={},o=(t,e,n,r)=>{i[r||t]=e};return Array.isArray(n)?n.forEach((t=>t(o,e,this))):n(o,e,this),r&&function(t,e,n,r,i){let o;if(null==e)return t;"bgrect"===r&&!1===n.interactive&&(t["pointer-events"]="none");if("bgfore"===r&&(!1===n.interactive&&(t["pointer-events"]="none"),t.display="none",null!==e.fill))return t;"image"===r&&!1===e.smooth&&(o=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]);"text"===r&&(t["font-family"]=Oy(e),t["font-size"]=$y(e)+"px",t["font-style"]=e.fontStyle,t["font-variant"]=e.fontVariant,t["font-weight"]=e.fontWeight);for(const n in o_){let r=e[n];const o=o_[n];("transparent"!==r||"fill"!==o&&"stroke"!==o)&&null!=r&&(Xp(r)&&(r=Jp(r,i.gradient,"")),t[o]=r)}for(const t in a_){const n=e[t];null!=n&&(o=o||[],o.push(`${a_[t]}: ${n};`))}o&&(t.style=o.join(" "))}(i,e,t,r,this._defs),i}defs(t){const e=this._defs.gradient,n=this._defs.clipping;if(0!==Object.keys(e).length+Object.keys(n).length){t.open("defs");for(const n in e){const r=e[n],i=r.stops;"radial"===r.gradient?(t.open("pattern",{id:Vp+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t.open("rect",{width:"1",height:"1",fill:"url(#"+n+")"}).close(),t.close(),t.open("radialGradient",{id:n,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):t.open("linearGradient",{id:n,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let e=0;e!A_.svgMarkTypes.includes(t)));this._svgRenderer.render(t,A_.svgMarkTypes),this._canvasRenderer.render(t,n)}resize(t,e,n,r){return super.resize(t,e,n,r),this._svgRenderer.resize(t,e,n,r),this._canvasRenderer.resize(t,e,n,r),this}background(t){return A_.svgOnTop?this._canvasRenderer.background(t):this._svgRenderer.background(t),this}}class E_ extends Sv{constructor(t,e){super(t,e)}initialize(t,e,n){const r=rv(rv(t,0,"div"),A_.svgOnTop?0:1,"div");return super.initialize(r,e,n)}}const D_="canvas",C_="hybrid",F_="none",S_={Canvas:D_,PNG:"png",SVG:"svg",Hybrid:C_,None:F_},$_={};function T_(t,e){return t=String(t||"").toLowerCase(),arguments.length>1?($_[t]=e,this):$_[t]}function B_(t,e,n){const r=[],i=(new Vg).union(e),o=t.marktype;return o?z_(t,i,n,r):"group"===o?N_(t,i,n,r):s("Intersect scene must be mark node or group item.")}function z_(t,e,n,r){if(function(t,e,n){return t.bounds&&e.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!n||n(t)))}(t,e,n)){const i=t.items,o=t.marktype,a=i.length;let s=0;if("group"===o)for(;s=0;r--)if(i[r]!=o[r])return!1;for(r=i.length-1;r>=0;r--)if(!q_(t[n=i[r]],e[n],n))return!1;return typeof t==typeof e}(t,e):t==e)}function P_(t,e){return q_(ag(t),ag(e))}const j_="top",I_="left",W_="right",H_="bottom",Y_="top-left",G_="top-right",V_="bottom-left",X_="bottom-right",J_="start",Z_="middle",Q_="end",K_="x",tx="y",ex="group",nx="axis",rx="title",ix="frame",ox="scope",ax="legend",sx="row-header",ux="row-footer",lx="row-title",cx="column-header",fx="column-footer",hx="column-title",dx="padding",px="symbol",gx="fit",mx="fit-x",yx="fit-y",vx="pad",_x="none",xx="all",bx="each",wx="flush",kx="column",Ax="row";function Mx(t){Xa.call(this,null,t)}function Ex(t,e,n){return e(t.bounds.clear(),t,n)}ht(Mx,Xa,{transform(t,e){const n=e.dataflow,r=t.mark,i=r.marktype,o=Hy[i],a=o.bound;let s,u=r.bounds;if(o.nested)r.items.length&&n.dirty(r.items[0]),u=Ex(r,a),r.items.forEach((t=>{t.bounds.clear().union(u)}));else if(i===ex||t.modified())switch(e.visit(e.MOD,(t=>n.dirty(t))),u.clear(),r.items.forEach((t=>u.union(Ex(t,a)))),r.role){case nx:case ax:case rx:e.reflow()}else s=e.changed(e.REM),e.visit(e.ADD,(t=>{u.union(Ex(t,a))})),e.visit(e.MOD,(t=>{s=s||u.alignsWith(t.bounds),n.dirty(t),u.union(Ex(t,a))})),s&&(u.clear(),r.items.forEach((t=>u.union(t.bounds))));return L_(r),e.modifies("bounds")}});const Dx=":vega_identifier:";function Cx(t){Xa.call(this,0,t)}function Fx(t){Xa.call(this,null,t)}function Sx(t){Xa.call(this,null,t)}Cx.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},ht(Cx,Xa,{transform(t,e){const n=(i=e.dataflow)._signals[Dx]||(i._signals[Dx]=i.add(0)),r=t.as;var i;let o=n.value;return e.visit(e.ADD,(t=>t[r]=t[r]||++o)),n.set(this.value=o),e}}),ht(Fx,Xa,{transform(t,e){let n=this.value;n||(n=e.dataflow.scenegraph().mark(t.markdef,function(t){const e=t.groups,n=t.parent;return e&&1===e.size?e.get(Object.keys(e.object)[0]):e&&n?e.lookup(n):null}(t),t.index),n.group.context=t.context,t.context.group||(t.context.group=n.group),n.source=this.source,n.clip=t.clip,n.interactive=t.interactive,this.value=n);const r=n.marktype===ex?Jg:Xg;return e.visit(e.ADD,(t=>r.call(t,n))),(t.modified("clip")||t.modified("interactive"))&&(n.clip=t.clip,n.interactive=!!t.interactive,n.zdirty=!0,e.reflow()),n.items=e.source,e}});const $x={parity:t=>t.filter(((t,e)=>e%2?t.opacity=0:1)),greedy:(t,e)=>{let n;return t.filter(((t,r)=>r&&Tx(n.bounds,t.bounds,e)?t.opacity=0:(n=t,1)))}},Tx=(t,e,n)=>n>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),Bx=(t,e)=>{for(var n,r=1,i=t.length,o=t[0].bounds;r{const e=t.bounds;return e.width()>1&&e.height()>1},Nx=t=>(t.forEach((t=>t.opacity=1)),t),Ox=(t,e)=>t.reflow(e.modified()).modifies("opacity");function Rx(t){Xa.call(this,null,t)}ht(Sx,Xa,{transform(t,e){const n=$x[t.method]||$x.parity,r=t.separation||0;let i,o,a=e.materialize(e.SOURCE).source;if(!a||!a.length)return;if(!t.method)return t.modified("method")&&(Nx(a),e=Ox(e,t)),e;if(a=a.filter(zx),!a.length)return;if(t.sort&&(a=a.slice().sort(t.sort)),i=Nx(a),e=Ox(e,t),i.length>=3&&Bx(i,r)){do{i=n(i,r)}while(i.length>=3&&Bx(i,r));i.length<3&&!F(a).opacity&&(i.length>1&&(F(i).opacity=0),F(a).opacity=1)}t.boundScale&&t.boundTolerance>=0&&(o=((t,e,n)=>{var r=t.range(),i=new Vg;return e===j_||e===H_?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),t=>i.encloses(t.bounds)})(t.boundScale,t.boundOrient,+t.boundTolerance),a.forEach((t=>{o(t)||(t.opacity=0)})));const s=i[0].mark.bounds.clear();return a.forEach((t=>{t.opacity&&s.union(t.bounds)})),e}}),ht(Rx,Xa,{transform(t,e){const n=e.dataflow;if(e.visit(e.ALL,(t=>n.dirty(t))),e.fields&&e.fields.zindex){const t=e.source&&e.source[0];t&&(t.mark.zdirty=!0)}}});const Lx=new Vg;function Ux(t,e,n){return t[e]===n?0:(t[e]=n,1)}function qx(t){var e=t.items[0].orient;return e===I_||e===W_}function Px(t,e,n,r){var i,o,a=e.items[0],s=a.datum,u=null!=a.translate?a.translate:.5,l=a.orient,c=function(t){let e=+t.grid;return[t.ticks?e++:-1,t.labels?e++:-1,e+ +t.domain]}(s),f=a.range,h=a.offset,d=a.position,p=a.minExtent,g=a.maxExtent,m=s.title&&a.items[c[2]].items[0],y=a.titlePadding,v=a.bounds,_=m&&zy(m),x=0,b=0;switch(Lx.clear().union(v),v.clear(),(i=c[0])>-1&&v.union(a.items[i].bounds),(i=c[1])>-1&&v.union(a.items[i].bounds),l){case j_:x=d||0,b=-h,o=Math.max(p,Math.min(g,-v.y1)),v.add(0,-o).add(f,0),m&&jx(t,m,o,y,_,0,-1,v);break;case I_:x=-h,b=d||0,o=Math.max(p,Math.min(g,-v.x1)),v.add(-o,0).add(0,f),m&&jx(t,m,o,y,_,1,-1,v);break;case W_:x=n+h,b=d||0,o=Math.max(p,Math.min(g,v.x2)),v.add(0,0).add(o,f),m&&jx(t,m,o,y,_,1,1,v);break;case H_:x=d||0,b=r+h,o=Math.max(p,Math.min(g,v.y2)),v.add(0,0).add(f,o),m&&jx(t,m,o,y,0,0,1,v);break;default:x=a.x,b=a.y}return tm(v.translate(x,b),a),Ux(a,"x",x+u)|Ux(a,"y",b+u)&&(a.bounds=Lx,t.dirty(a),a.bounds=v,t.dirty(a)),a.mark.bounds.clear().union(v)}function jx(t,e,n,r,i,o,a,s){const u=e.bounds;if(e.auto){const s=a*(n+i+r);let l=0,c=0;t.dirty(e),o?l=(e.x||0)-(e.x=s):c=(e.y||0)-(e.y=s),e.mark.bounds.clear().union(u.translate(-l,-c)),t.dirty(e)}s.union(u)}const Ix=(t,e)=>Math.floor(Math.min(t,e)),Wx=(t,e)=>Math.ceil(Math.max(t,e));function Hx(t){return(new Vg).set(0,0,t.width||0,t.height||0)}function Yx(t){const e=t.bounds.clone();return e.empty()?e.set(0,0,0,0):e.translate(-(t.x||0),-(t.y||0))}function Gx(t,e,n){const r=A(t)?t[e]:t;return null!=r?r:void 0!==n?n:0}function Vx(t){return t<0?Math.ceil(-t):0}function Xx(t,e,n){var r,i,o,a,s,u,l,c,f,h,d,p=!n.nodirty,g=n.bounds===wx?Hx:Yx,m=Lx.set(0,0,0,0),y=Gx(n.align,kx),v=Gx(n.align,Ax),_=Gx(n.padding,kx),x=Gx(n.padding,Ax),b=n.columns||e.length,w=b<=0?1:Math.ceil(e.length/b),k=e.length,A=Array(k),M=Array(b),E=0,D=Array(k),C=Array(w),F=0,S=Array(k),$=Array(k),T=Array(k);for(i=0;i1)for(i=0;i0&&(S[i]+=f/2);if(v&&Gx(n.center,Ax)&&1!==b)for(i=0;i0&&($[i]+=h/2);for(i=0;ii&&(t.warn("Grid headers exceed limit: "+i),e=e.slice(0,i)),A+=o,g=0,y=e.length;g=0&&null==(x=n[m]);m-=h);s?(b=null==d?x.x:Math.round(x.bounds.x1+d*x.bounds.width()),w=A):(b=A,w=null==d?x.y:Math.round(x.bounds.y1+d*x.bounds.height())),v.union(_.bounds.translate(b-(_.x||0),w-(_.y||0))),_.x=b,_.y=w,t.dirty(_),M=a(M,v[l])}return M}function tb(t,e,n,r,i,o){if(e){t.dirty(e);var a=n,s=n;r?a=Math.round(i.x1+o*i.width()):s=Math.round(i.y1+o*i.height()),e.bounds.translate(a-(e.x||0),s-(e.y||0)),e.mark.bounds.clear().union(e.bounds),e.x=a,e.y=s,t.dirty(e)}}function eb(t,e,n,r,i,o,a){const s=function(t,e){const n=t[e]||{};return(e,r)=>null!=n[e]?n[e]:null!=t[e]?t[e]:r}(n,e),u=function(t,e){let n=-1/0;return t.forEach((t=>{null!=t.offset&&(n=Math.max(n,t.offset))})),n>-1/0?n:e}(t,s("offset",0)),l=s("anchor",J_),c=l===Q_?1:l===Z_?.5:0,f={align:bx,bounds:s("bounds",wx),columns:"vertical"===s("direction")?1:t.length,padding:s("margin",8),center:s("center"),nodirty:!0};switch(e){case I_:f.anchor={x:Math.floor(r.x1)-u,column:Q_,y:c*(a||r.height()+2*r.y1),row:l};break;case W_:f.anchor={x:Math.ceil(r.x2)+u,y:c*(a||r.height()+2*r.y1),row:l};break;case j_:f.anchor={y:Math.floor(i.y1)-u,row:Q_,x:c*(o||i.width()+2*i.x1),column:l};break;case H_:f.anchor={y:Math.ceil(i.y2)+u,x:c*(o||i.width()+2*i.x1),column:l};break;case Y_:f.anchor={x:u,y:u};break;case G_:f.anchor={x:o-u,y:u,column:Q_};break;case V_:f.anchor={x:u,y:a-u,row:Q_};break;case X_:f.anchor={x:o-u,y:a-u,column:Q_,row:Q_}}return f}function nb(t,e){var n,r,i=e.items[0],o=i.datum,a=i.orient,s=i.bounds,u=i.x,l=i.y;return i._bounds?i._bounds.clear().union(s):i._bounds=s.clone(),s.clear(),function(t,e,n){var r=e.padding,i=r-n.x,o=r-n.y;if(e.datum.title){var a=e.items[1].items[0],s=a.anchor,u=e.titlePadding||0,l=r-a.x,c=r-a.y;switch(a.orient){case I_:i+=Math.ceil(a.bounds.width())+u;break;case W_:case H_:break;default:o+=a.bounds.height()+u}switch((i||o)&&ib(t,n,i,o),a.orient){case I_:c+=rb(e,n,a,s,1,1);break;case W_:l+=rb(e,n,a,Q_,0,0)+u,c+=rb(e,n,a,s,1,1);break;case H_:l+=rb(e,n,a,s,0,0),c+=rb(e,n,a,Q_,-1,0,1)+u;break;default:l+=rb(e,n,a,s,0,0)}(l||c)&&ib(t,a,l,c),(l=Math.round(a.bounds.x1-r))<0&&(ib(t,n,-l,0),ib(t,a,-l,0))}else(i||o)&&ib(t,n,i,o)}(t,i,i.items[0].items[0]),s=function(t,e){return t.items.forEach((t=>e.union(t.bounds))),e.x1=t.padding,e.y1=t.padding,e}(i,s),n=2*i.padding,r=2*i.padding,s.empty()||(n=Math.ceil(s.width()+n),r=Math.ceil(s.height()+r)),o.type===px&&function(t){const e=t.reduce(((t,e)=>(t[e.column]=Math.max(e.bounds.x2-e.x,t[e.column]||0),t)),{});t.forEach((t=>{t.width=e[t.column],t.height=t.bounds.y2-t.y}))}(i.items[0].items[0].items[0].items),a!==_x&&(i.x=u=0,i.y=l=0),i.width=n,i.height=r,tm(s.set(u,l,u+n,l+r),i),i.mark.bounds.clear().union(s),i}function rb(t,e,n,r,i,o,a){const s="symbol"!==t.datum.type,u=n.datum.vgrad,l=(!s||!o&&u||a?e:e.items[0]).bounds[i?"y2":"x2"]-t.padding,c=u&&o?l:0,f=u&&o?0:l,h=i<=0?0:zy(n);return Math.round(r===J_?c:r===Q_?f-h:.5*(l-h))}function ib(t,e,n,r){e.x+=n,e.y+=r,e.bounds.translate(n,r),e.mark.bounds.translate(n,r),t.dirty(e)}function ob(t){Xa.call(this,null,t)}ht(ob,Xa,{transform(t,e){const n=e.dataflow;return t.mark.items.forEach((e=>{t.layout&&Jx(n,e,t.layout),function(t,e,n){var r,i,o,a,s,u=e.items,l=Math.max(0,e.width||0),c=Math.max(0,e.height||0),f=(new Vg).set(0,0,l,c),h=f.clone(),d=f.clone(),p=[];for(a=0,s=u.length;a{(o=t.orient||W_)!==_x&&(e[o]||(e[o]=[])).push(t)}));for(const r in e){const i=e[r];Xx(t,i,eb(i,r,n.legends,h,d,l,c))}p.forEach((e=>{const r=e.bounds;if(r.equals(e._bounds)||(e.bounds=e._bounds,t.dirty(e),e.bounds=r,t.dirty(e)),!n.autosize||n.autosize.type!==gx&&n.autosize.type!==mx&&n.autosize.type!==yx)f.union(r);else switch(e.orient){case I_:case W_:f.add(r.x1,0).add(r.x2,0);break;case j_:case H_:f.add(0,r.y1).add(0,r.y2)}}))}f.union(h).union(d),r&&f.union(function(t,e,n,r,i){var o,a=e.items[0],s=a.frame,u=a.orient,l=a.anchor,c=a.offset,f=a.padding,h=a.items[0].items[0],d=a.items[1]&&a.items[1].items[0],p=u===I_||u===W_?r:n,g=0,m=0,y=0,v=0,_=0;if(s!==ex?u===I_?(g=i.y2,p=i.y1):u===W_?(g=i.y1,p=i.y2):(g=i.x1,p=i.x2):u===I_&&(g=r,p=0),o=l===J_?g:l===Q_?p:(g+p)/2,d&&d.text){switch(u){case j_:case H_:_=h.bounds.height()+f;break;case I_:v=h.bounds.width()+f;break;case W_:v=-h.bounds.width()-f}Lx.clear().union(d.bounds),Lx.translate(v-(d.x||0),_-(d.y||0)),Ux(d,"x",v)|Ux(d,"y",_)&&(t.dirty(d),d.bounds.clear().union(Lx),d.mark.bounds.clear().union(Lx),t.dirty(d)),Lx.clear().union(d.bounds)}else Lx.clear();switch(Lx.union(h.bounds),u){case j_:m=o,y=i.y1-Lx.height()-c;break;case I_:m=i.x1-Lx.width()-c,y=o;break;case W_:m=i.x2+Lx.width()+c,y=o;break;case H_:m=o,y=i.y2+c;break;default:m=a.x,y=a.y}return Ux(a,"x",m)|Ux(a,"y",y)&&(Lx.translate(m,y),t.dirty(a),a.bounds.clear().union(Lx),e.bounds.clear().union(Lx),t.dirty(a)),a.bounds}(t,r,l,c,f));e.clip&&f.set(0,0,e.width||0,e.height||0);!function(t,e,n,r){const i=r.autosize||{},o=i.type;if(t._autosize<1||!o)return;let a=t._width,s=t._height,u=Math.max(0,e.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,e.height||0),f=Math.max(0,Math.ceil(-n.y1));const h=Math.max(0,Math.ceil(n.x2-u)),d=Math.max(0,Math.ceil(n.y2-c));if(i.contains===dx){const e=t.padding();a-=e.left+e.right,s-=e.top+e.bottom}o===_x?(l=0,f=0,u=a,c=s):o===gx?(u=Math.max(0,a-l-h),c=Math.max(0,s-f-d)):o===mx?(u=Math.max(0,a-l-h),s=c+f+d):o===yx?(a=u+l+h,c=Math.max(0,s-f-d)):o===vx&&(a=u+l+h,s=c+f+d);t._resizeView(a,s,u,c,[l,f],i.resize)}(t,e,f,n)}(n,e,t)})),function(t){return t&&"legend-entry"!==t.mark.role}(t.mark.group)?e.reflow():e}});var ab=Object.freeze({__proto__:null,bound:Mx,identifier:Cx,mark:Fx,overlap:Sx,render:Rx,viewlayout:ob});function sb(t){Xa.call(this,null,t)}function ub(t){Xa.call(this,null,t)}function lb(){return va({})}function cb(t){Xa.call(this,null,t)}function fb(t){Xa.call(this,[],t)}ht(sb,Xa,{transform(t,e){if(this.value&&!t.modified())return e.StopPropagation;var n=e.dataflow.locale(),r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=this.value,o=t.scale,a=Sp(o,null==t.count?t.values?t.values.length:10:t.count,t.minstep),s=t.format||Bp(n,o,a,t.formatSpecifier,t.formatType,!!t.values),u=t.values?$p(o,t.values,a):Tp(o,a);return i&&(r.rem=i),i=u.map(((t,e)=>va({index:e/(u.length-1||1),value:t,label:s(t)}))),t.extra&&i.length&&i.push(va({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}}),ht(ub,Xa,{transform(t,e){var n=e.dataflow,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.item||lb,o=t.key||ma,a=this.value;return k(r.encode)&&(r.encode=null),a&&(t.modified("key")||e.modified(o))&&s("DataJoin does not support modified key function or fields."),a||(e=e.addAll(),this.value=a=function(t){const e=ct().test((t=>t.exit));return e.lookup=n=>e.get(t(n)),e}(o)),e.visit(e.ADD,(t=>{const e=o(t);let n=a.get(e);n?n.exit?(a.empty--,r.add.push(n)):r.mod.push(n):(n=i(t),a.set(e,n),r.add.push(n)),n.datum=t,n.exit=!1})),e.visit(e.MOD,(t=>{const e=o(t),n=a.get(e);n&&(n.datum=t,r.mod.push(n))})),e.visit(e.REM,(t=>{const e=o(t),n=a.get(e);t!==n.datum||n.exit||(r.rem.push(n),n.exit=!0,++a.empty)})),e.changed(e.ADD_MOD)&&r.modifies("datum"),(e.clean()||t.clean&&a.empty>n.cleanThreshold)&&n.runAfter(a.clean),r}}),ht(cb,Xa,{transform(t,e){var n=e.fork(e.ADD_REM),r=t.mod||!1,i=t.encoders,o=e.encode;if(k(o)){if(!n.changed()&&!o.every((t=>i[t])))return e.StopPropagation;o=o[0],n.encode=null}var a="enter"===o,s=i.update||g,u=i.enter||g,l=i.exit||g,c=(o&&!a?i[o]:s)||g;if(e.changed(e.ADD)&&(e.visit(e.ADD,(e=>{u(e,t),s(e,t)})),n.modifies(u.output),n.modifies(s.output),c!==g&&c!==s&&(e.visit(e.ADD,(e=>{c(e,t)})),n.modifies(c.output))),e.changed(e.REM)&&l!==g&&(e.visit(e.REM,(e=>{l(e,t)})),n.modifies(l.output)),a||c!==g){const i=e.MOD|(t.modified()?e.REFLOW:0);a?(e.visit(i,(e=>{const i=u(e,t)||r;(c(e,t)||i)&&n.mod.push(e)})),n.mod.length&&n.modifies(u.output)):e.visit(i,(e=>{(c(e,t)||r)&&n.mod.push(e)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:e.StopPropagation}}),ht(fb,Xa,{transform(t,e){if(null!=this.value&&!t.modified())return e.StopPropagation;var n,r,i,o,a,s=e.dataflow.locale(),u=e.fork(e.NO_SOURCE|e.NO_FIELDS),l=this.value,c=t.type||Mp,f=t.scale,h=+t.limit,d=Sp(f,null==t.count?5:t.count,t.minstep),p=!!t.values||c===Mp,g=t.format||Up(s,f,d,c,t.formatSpecifier,t.formatType,p),m=t.values||Rp(f,d);return l&&(u.rem=l),c===Mp?(h&&m.length>h?(e.dataflow.warn("Symbol legend count exceeds limit, filtering items."),l=m.slice(0,h-1),a=!0):l=m,J(i=t.size)?(t.values||0!==f(l[0])||(l=l.slice(1)),o=l.reduce(((e,n)=>Math.max(e,i(n,t))),0)):i=rt(o=i||8),l=l.map(((e,n)=>va({index:n,label:g(e,n,l),value:e,offset:o,size:i(e,t)}))),a&&(a=m[l.length],l.push(va({index:l.length,label:`…${m.length-l.length} entries`,value:a,offset:o,size:i(a,t)})))):"gradient"===c?(n=f.domain(),r=_p(f,n[0],F(n)),m.length<3&&!t.values&&n[0]!==F(n)&&(m=[n[0],F(n)]),l=m.map(((t,e)=>va({index:e,label:g(t,e,m),value:t,perc:r(t)})))):(i=m.length-1,r=function(t){const e=t.domain(),n=e.length-1;let r=+e[0],i=+F(e),o=i-r;if(t.type===jd){const t=n?o/n:.1;r-=t,i+=t,o=i-r}return t=>(t-r)/o}(f),l=m.map(((t,e)=>va({index:e,label:g(t,e,m),value:t,perc:e?r(t):0,perc2:e===i?1:r(m[e+1])})))),u.source=l,u.add=l,this.value=l,u}});const hb=t=>t.source.x,db=t=>t.source.y,pb=t=>t.target.x,gb=t=>t.target.y;function mb(t){Xa.call(this,{},t)}mb.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},ht(mb,Xa,{transform(t,e){var n=t.sourceX||hb,r=t.sourceY||db,i=t.targetX||pb,o=t.targetY||gb,a=t.as||"path",u=t.orient||"vertical",l=t.shape||"line",c=xb.get(l+"-"+u)||xb.get(l);return c||s("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),e.visit(e.SOURCE,(t=>{t[a]=c(n(t),r(t),i(t),o(t))})),e.reflow(t.modified()).modifies(a)}});const yb=(t,e,n,r)=>"M"+t+","+e+"L"+n+","+r,vb=(t,e,n,r)=>{var i=n-t,o=r-e,a=Math.hypot(i,o)/2;return"M"+t+","+e+"A"+a+","+a+" "+180*Math.atan2(o,i)/Math.PI+" 0 1 "+n+","+r},_b=(t,e,n,r)=>{const i=n-t,o=r-e,a=.2*(i+o),s=.2*(o-i);return"M"+t+","+e+"C"+(t+a)+","+(e+s)+" "+(n+s)+","+(r-a)+" "+n+","+r},xb=ct({line:yb,"line-radial":(t,e,n,r)=>yb(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),arc:vb,"arc-radial":(t,e,n,r)=>vb(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),curve:_b,"curve-radial":(t,e,n,r)=>_b(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),"orthogonal-horizontal":(t,e,n,r)=>"M"+t+","+e+"V"+r+"H"+n,"orthogonal-vertical":(t,e,n,r)=>"M"+t+","+e+"H"+n+"V"+r,"orthogonal-radial":(t,e,n,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(n),s=Math.sin(n);return"M"+e*i+","+e*o+"A"+e+","+e+" 0 0,"+((Math.abs(n-t)>Math.PI?n<=t:n>t)?1:0)+" "+e*a+","+e*s+"L"+r*a+","+r*s},"diagonal-horizontal":(t,e,n,r)=>{const i=(t+n)/2;return"M"+t+","+e+"C"+i+","+e+" "+i+","+r+" "+n+","+r},"diagonal-vertical":(t,e,n,r)=>{const i=(e+r)/2;return"M"+t+","+e+"C"+t+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":(t,e,n,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(n),s=Math.sin(n),u=(e+r)/2;return"M"+e*i+","+e*o+"C"+u*i+","+u*o+" "+u*a+","+u*s+" "+r*a+","+r*s}});function bb(t){Xa.call(this,null,t)}bb.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},ht(bb,Xa,{transform(t,e){var n,r,i,o=t.as||["startAngle","endAngle"],a=o[0],s=o[1],u=t.field||d,l=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=e.source,h=f.map(u),p=h.length,g=l,m=(c-l)/Se(h),y=Fe(p);for(t.sort&&y.sort(((t,e)=>h[t]-h[e])),n=0;nt+(e<0?-1:e>0?1:0)),0))!==e.length&&n.warn("Log scale domain includes zero: "+Dt(e)));return e}function Db(t,e,n){return J(t)&&(e||n)?mp(t,Cb(e||[0,1],n)):t}function Cb(t,e){return e?t.slice().reverse():t}function Fb(t){Xa.call(this,null,t)}ht(Mb,Xa,{transform(t,e){var n=e.dataflow,r=this.value,i=function(t){var e,n=t.type,r="";if(n===Ld)return Ld+"-"+$d;(function(t){const e=t.type;return lp(e)&&e!==Od&&e!==Rd&&(t.scheme||t.range&&t.range.length&&t.range.every(_t))})(t)&&(r=2===(e=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0)?Ld+"-":3===e?Ud+"-":"");return(r+n||$d).toLowerCase()}(t);for(i in r&&i===r.type||(this.value=r=ap(i)()),t)if(!Ab[i]){if("padding"===i&&kb(r.type))continue;J(r[i])?r[i](t[i]):n.warn("Unsupported scale property: "+i)}return function(t,e,n){var r=t.type,i=e.round||!1,o=e.range;if(null!=e.rangeStep)o=function(t,e,n){t!==Hd&&t!==Wd&&s("Only band and point scales support rangeStep.");var r=(null!=e.paddingOuter?e.paddingOuter:e.padding)||0,i=t===Wd?1:(null!=e.paddingInner?e.paddingInner:e.padding)||0;return[0,e.rangeStep*Sd(n,i,r)]}(r,e,n);else if(e.scheme&&(o=function(t,e,n){var r,i=e.schemeExtent;k(e.scheme)?r=yp(e.scheme,e.interpolate,e.interpolateGamma):(r=Ap(e.scheme.toLowerCase()))||s(`Unrecognized scheme name: ${e.scheme}`);return n=t===jd?n+1:t===Yd?n-1:t===qd||t===Pd?+e.schemeCount||wb:n,dp(t)?Db(r,i,e.reverse):J(r)?vp(Db(r,i),n):t===Id?r:r.slice(0,n)}(r,e,n),J(o))){if(t.interpolator)return t.interpolator(o);s(`Scale type ${r} does not support interpolating color schemes.`)}if(o&&dp(r))return t.interpolator(yp(Cb(o,e.reverse),e.interpolate,e.interpolateGamma));o&&e.interpolate&&t.interpolate?t.interpolate(xp(e.interpolate,e.interpolateGamma)):J(t.round)?t.round(i):J(t.rangeRound)&&t.interpolate(i?mh:gh);o&&t.range(Cb(o,e.reverse))}(r,t,function(t,e,n){let r=e.bins;if(r&&!k(r)){const e=t.domain(),n=e[0],i=F(e),o=r.step;let a=null==r.start?n:r.start,u=null==r.stop?i:r.stop;o||s("Scale bins parameter missing step property."),ai&&(u=o*Math.floor(i/o)),r=Fe(a,u+o/2,o)}r?t.bins=r:t.bins&&delete t.bins;t.type===Yd&&(r?e.domain||e.domainRaw||(t.domain(r),n=r.length):t.bins=t.domain());return n}(r,t,function(t,e,n){const r=function(t,e,n){return e?(t.domain(Eb(t.type,e,n)),e.length):-1}(t,e.domainRaw,n);if(r>-1)return r;var i,o,a=e.domain,s=t.type,u=e.zero||void 0===e.zero&&function(t){const e=t.type;return!t.bins&&(e===$d||e===Bd||e===zd)}(t);if(!a)return 0;if((u||null!=e.domainMin||null!=e.domainMax||null!=e.domainMid)&&(i=(a=a.slice()).length-1||1,u&&(a[0]>0&&(a[0]=0),a[i]<0&&(a[i]=0)),null!=e.domainMin&&(a[0]=e.domainMin),null!=e.domainMax&&(a[i]=e.domainMax),null!=e.domainMid)){const t=(o=e.domainMid)>a[i]?i+1:ot(u);if(null==e)d.push(t.slice());else for(i={},o=0,a=t.length;oh&&(h=f),n&&c.sort(n)}return d.max=h,d}(e.source,t.groupby,l,c),r=0,i=n.length,o=n.max;r0?1:t<0?-1:0},iw=Math.sqrt,ow=Math.tan;function aw(t){return t>1?0:t<-1?Pb:Math.acos(t)}function sw(t){return t>1?jb:t<-1?-jb:Math.asin(t)}function uw(){}function lw(t,e){t&&fw.hasOwnProperty(t.type)&&fw[t.type](t,e)}var cw={Feature:function(t,e){lw(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,o=Jb(e=(e*=Yb)/2+Ib),a=nw(e),s=_w*a,u=vw*o+s*Jb(i),l=s*r*nw(i);$w.add(Xb(l,u)),yw=t,vw=o,_w=a}function Lw(t){return[Xb(t[1],t[0]),sw(t[2])]}function Uw(t){var e=t[0],n=t[1],r=Jb(n);return[r*Jb(e),r*nw(e),nw(n)]}function qw(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Pw(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function jw(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Iw(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Ww(t){var e=iw(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Hw,Yw,Gw,Vw,Xw,Jw,Zw,Qw,Kw,tk,ek,nk,rk,ik,ok,ak,sk={point:uk,lineStart:ck,lineEnd:fk,polygonStart:function(){sk.point=hk,sk.lineStart=dk,sk.lineEnd=pk,Cw=new ae,Bw.polygonStart()},polygonEnd:function(){Bw.polygonEnd(),sk.point=uk,sk.lineStart=ck,sk.lineEnd=fk,$w<0?(xw=-(ww=180),bw=-(kw=90)):Cw>Ub?kw=90:Cw<-1e-6&&(bw=-90),Sw[0]=xw,Sw[1]=ww},sphere:function(){xw=-(ww=180),bw=-(kw=90)}};function uk(t,e){Fw.push(Sw=[xw=t,ww=t]),ekw&&(kw=e)}function lk(t,e){var n=Uw([t*Yb,e*Yb]);if(Dw){var r=Pw(Dw,n),i=Pw([r[1],-r[0],0],r);Ww(i),i=Lw(i);var o,a=t-Aw,s=a>0?1:-1,u=i[0]*Hb*s,l=Gb(a)>180;l^(s*Awkw&&(kw=o):l^(s*Aw<(u=(u+360)%360-180)&&ukw&&(kw=e)),l?tgk(xw,ww)&&(ww=t):gk(t,ww)>gk(xw,ww)&&(xw=t):ww>=xw?(tww&&(ww=t)):t>Aw?gk(xw,t)>gk(xw,ww)&&(ww=t):gk(t,ww)>gk(xw,ww)&&(xw=t)}else Fw.push(Sw=[xw=t,ww=t]);ekw&&(kw=e),Dw=n,Aw=t}function ck(){sk.point=lk}function fk(){Sw[0]=xw,Sw[1]=ww,sk.point=uk,Dw=null}function hk(t,e){if(Dw){var n=t-Aw;Cw.add(Gb(n)>180?n+(n>0?360:-360):n)}else Mw=t,Ew=e;Bw.point(t,e),lk(t,e)}function dk(){Bw.lineStart()}function pk(){hk(Mw,Ew),Bw.lineEnd(),Gb(Cw)>Ub&&(xw=-(ww=180)),Sw[0]=xw,Sw[1]=ww,Dw=null}function gk(t,e){return(e-=t)<0?e+360:e}function mk(t,e){return t[0]-e[0]}function yk(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:ePb&&(t-=Math.round(t/Wb)*Wb),[t,e]}function $k(t,e,n){return(t%=Wb)?e||n?Fk(Bk(t),zk(e,n)):Bk(t):e||n?zk(e,n):Sk}function Tk(t){return function(e,n){return Gb(e+=t)>Pb&&(e-=Math.round(e/Wb)*Wb),[e,n]}}function Bk(t){var e=Tk(t);return e.invert=Tk(-t),e}function zk(t,e){var n=Jb(t),r=nw(t),i=Jb(e),o=nw(e);function a(t,e){var a=Jb(e),s=Jb(t)*a,u=nw(t)*a,l=nw(e),c=l*n+s*r;return[Xb(u*i-c*o,s*n-l*r),sw(c*i+u*o)]}return a.invert=function(t,e){var a=Jb(e),s=Jb(t)*a,u=nw(t)*a,l=nw(e),c=l*i-u*o;return[Xb(u*i+l*o,s*n+c*r),sw(c*n-s*r)]},a}function Nk(t,e){(e=Uw(e))[0]-=t,Ww(e);var n=aw(-e[1]);return((-e[2]<0?-n:n)+Wb-Ub)%Wb}function Ok(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:uw,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Rk(t,e){return Gb(t[0]-e[0])=0;--o)i.point((c=l[o])[0],c[1]);else r(h.x,h.p.x,-1,i);h=h.p}l=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function qk(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r=0?1:-1,E=M*A,D=E>Pb,C=m*w;if(u.add(Xb(C*M*nw(E),y*k+C*Jb(E))),a+=D?A+M*Wb:A,D^p>=n^x>=n){var F=Pw(Uw(d),Uw(_));Ww(F);var S=Pw(o,F);Ww(S);var $=(D^A>=0?-1:1)*sw(S[2]);(r>$||r===$&&(F[0]||F[1]))&&(s+=D^A>=0?1:-1)}}return(a<-1e-6||a0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t1&&2&u&&h.push(h.pop().concat(h.shift())),a.push(h.filter(Ik))}return h}}function Ik(t){return t.length>1}function Wk(t,e){return((t=t.x)[0]<0?t[1]-jb-Ub:jb-t[1])-((e=e.x)[0]<0?e[1]-jb-Ub:jb-e[1])}Sk.invert=Sk;var Hk=jk((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?Pb:-Pb,u=Gb(o-n);Gb(u-Pb)0?jb:-jb),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(o,r),e=0):i!==s&&u>=Pb&&(Gb(n-i)Ub?Vb((nw(e)*(o=Jb(r))*nw(n)-nw(r)*(i=Jb(e))*nw(t))/(i*o*a)):(e+r)/2}(n,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),e=0),t.point(n=o,r=a),i=s},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*jb,r.point(-Pb,i),r.point(0,i),r.point(Pb,i),r.point(Pb,0),r.point(Pb,-i),r.point(0,-i),r.point(-Pb,-i),r.point(-Pb,0),r.point(-Pb,i);else if(Gb(t[0]-e[0])>Ub){var o=t[0]0,i=Gb(e)>Ub;function o(t,n){return Jb(t)*Jb(n)>e}function a(t,n,r){var i=[1,0,0],o=Pw(Uw(t),Uw(n)),a=qw(o,o),s=o[0],u=a-s*s;if(!u)return!r&&t;var l=e*a/u,c=-e*s/u,f=Pw(i,o),h=Iw(i,l);jw(h,Iw(o,c));var d=f,p=qw(h,d),g=qw(d,d),m=p*p-g*(qw(h,h)-1);if(!(m<0)){var y=iw(m),v=Iw(d,(-p-y)/g);if(jw(v,h),v=Lw(v),!r)return v;var _,x=t[0],b=n[0],w=t[1],k=n[1];b0^v[1]<(Gb(v[0]-x)Pb^(x<=v[0]&&v[0]<=b)){var E=Iw(d,(-p+y)/g);return jw(E,h),[v,Lw(E)]}}}function s(e,n){var i=r?t:Pb-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return jk(o,(function(t){var e,n,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(f,h){var d,p=[f,h],g=o(f,h),m=r?g?0:s(f,h):g?s(f+(f<0?Pb:-Pb),h):0;if(!e&&(l=u=g)&&t.lineStart(),g!==u&&(!(d=a(e,p))||Rk(e,d)||Rk(p,d))&&(p[2]=1),g!==u)c=0,g?(t.lineStart(),d=a(p,e),t.point(d[0],d[1])):(d=a(e,p),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(i&&e&&r^g){var y;m&n||!(y=a(p,e,!0))||(c=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!g||e&&Rk(e,p)||t.point(p[0],p[1]),e=p,u=g,n=m},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return c|(l&&u)<<1}}}),(function(e,r,i,o){!function(t,e,n,r,i,o){if(n){var a=Jb(e),s=nw(e),u=r*n;null==i?(i=e+r*Wb,o=e-u/2):(i=Nk(a,i),o=Nk(a,o),(r>0?io)&&(i+=r*Wb));for(var l,c=i;r>0?c>o:c0)do{l.point(0===c||3===c?t:n,c>1?r:e)}while((c=(c+s+4)%4)!==f);else l.point(o[0],o[1])}function a(r,i){return Gb(r[0]-t)0?0:3:Gb(r[0]-n)0?2:1:Gb(r[1]-e)0?1:0:i>0?3:2}function s(t,e){return u(t.x,e.x)}function u(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var u,l,c,f,h,d,p,g,m,y,v,_=a,x=Ok(),b={point:w,lineStart:function(){b.point=k,l&&l.push(c=[]);y=!0,m=!1,p=g=NaN},lineEnd:function(){u&&(k(f,h),d&&m&&x.rejoin(),u.push(x.result()));b.point=w,m&&_.lineEnd()},polygonStart:function(){_=x,u=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;nr&&(h-o)*(r-a)>(d-a)*(t-o)&&++e:d<=r&&(h-o)*(r-a)<(d-a)*(t-o)&&--e;return e}(),n=v&&e,i=(u=Ce(u)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&Uk(u,s,e,o,a),a.polygonEnd());_=a,u=l=c=null}};function w(t,e){i(t,e)&&_.point(t,e)}function k(o,a){var s=i(o,a);if(l&&c.push([o,a]),y)f=o,h=a,d=s,y=!1,s&&(_.lineStart(),_.point(o,a));else if(s&&m)_.point(o,a);else{var u=[p=Math.max(Vk,Math.min(Gk,p)),g=Math.max(Vk,Math.min(Gk,g))],x=[o=Math.max(Vk,Math.min(Gk,o)),a=Math.max(Vk,Math.min(Gk,a))];!function(t,e,n,r,i,o){var a,s=t[0],u=t[1],l=0,c=1,f=e[0]-s,h=e[1]-u;if(a=n-s,f||!(a>0)){if(a/=f,f<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=i-s,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>l&&(l=a)}else if(f>0){if(a0)){if(a/=h,h<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=o-u,h||!(a<0)){if(a/=h,h<0){if(a>c)return;a>l&&(l=a)}else if(h>0){if(a0&&(t[0]=s+l*f,t[1]=u+l*h),c<1&&(e[0]=s+c*f,e[1]=u+c*h),!0}}}}}(u,x,t,e,n,r)?s&&(_.lineStart(),_.point(o,a),v=!1):(m||(_.lineStart(),_.point(u[0],u[1])),_.point(x[0],x[1]),s||_.lineEnd(),v=!1)}p=o,g=a,m=s}return b}}function Jk(t,e,n){var r=Fe(t,e-Ub,n).concat(e);return function(t){return r.map((function(e){return[t,e]}))}}function Zk(t,e,n){var r=Fe(t,e-Ub,n).concat(e);return function(t){return r.map((function(e){return[e,t]}))}}var Qk,Kk,tA,eA,nA=t=>t,rA=new ae,iA=new ae,oA={point:uw,lineStart:uw,lineEnd:uw,polygonStart:function(){oA.lineStart=aA,oA.lineEnd=lA},polygonEnd:function(){oA.lineStart=oA.lineEnd=oA.point=uw,rA.add(Gb(iA)),iA=new ae},result:function(){var t=rA/2;return rA=new ae,t}};function aA(){oA.point=sA}function sA(t,e){oA.point=uA,Qk=tA=t,Kk=eA=e}function uA(t,e){iA.add(eA*t-tA*e),tA=t,eA=e}function lA(){uA(Qk,Kk)}var cA=1/0,fA=cA,hA=-cA,dA=hA,pA={point:function(t,e){thA&&(hA=t);edA&&(dA=e)},lineStart:uw,lineEnd:uw,polygonStart:uw,polygonEnd:uw,result:function(){var t=[[cA,fA],[hA,dA]];return hA=dA=-(fA=cA=1/0),t}};var gA,mA,yA,vA,_A=0,xA=0,bA=0,wA=0,kA=0,AA=0,MA=0,EA=0,DA=0,CA={point:FA,lineStart:SA,lineEnd:BA,polygonStart:function(){CA.lineStart=zA,CA.lineEnd=NA},polygonEnd:function(){CA.point=FA,CA.lineStart=SA,CA.lineEnd=BA},result:function(){var t=DA?[MA/DA,EA/DA]:AA?[wA/AA,kA/AA]:bA?[_A/bA,xA/bA]:[NaN,NaN];return _A=xA=bA=wA=kA=AA=MA=EA=DA=0,t}};function FA(t,e){_A+=t,xA+=e,++bA}function SA(){CA.point=$A}function $A(t,e){CA.point=TA,FA(yA=t,vA=e)}function TA(t,e){var n=t-yA,r=e-vA,i=iw(n*n+r*r);wA+=i*(yA+t)/2,kA+=i*(vA+e)/2,AA+=i,FA(yA=t,vA=e)}function BA(){CA.point=FA}function zA(){CA.point=OA}function NA(){RA(gA,mA)}function OA(t,e){CA.point=RA,FA(gA=yA=t,mA=vA=e)}function RA(t,e){var n=t-yA,r=e-vA,i=iw(n*n+r*r);wA+=i*(yA+t)/2,kA+=i*(vA+e)/2,AA+=i,MA+=(i=vA*t-yA*e)*(yA+t),EA+=i*(vA+e),DA+=3*i,FA(yA=t,vA=e)}function LA(t){this._context=t}LA.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Wb)}},result:uw};var UA,qA,PA,jA,IA,WA=new ae,HA={point:uw,lineStart:function(){HA.point=YA},lineEnd:function(){UA&&GA(qA,PA),HA.point=uw},polygonStart:function(){UA=!0},polygonEnd:function(){UA=null},result:function(){var t=+WA;return WA=new ae,t}};function YA(t,e){HA.point=GA,qA=jA=t,PA=IA=e}function GA(t,e){jA-=t,IA-=e,WA.add(iw(jA*jA+IA*IA)),jA=t,IA=e}let VA,XA,JA,ZA;class QA{constructor(t){this._append=null==t?KA:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return KA;if(e!==VA){const t=10**e;VA=e,XA=function(e){let n=1;this._+=e[0];for(const r=e.length;n=0))throw new RangeError(`invalid digits: ${t}`);i=e}return null===e&&(r=new QA(i)),a},a.projection(t).digits(i).context(e)}function eM(t){return function(e){var n=new nM;for(var r in t)n[r]=t[r];return n.stream=e,n}}function nM(){}function rM(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),pw(n,t.stream(pA)),e(pA.result()),null!=r&&t.clipExtent(r),t}function iM(t,e,n){return rM(t,(function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,s=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,s])}),n)}function oM(t,e,n){return iM(t,[[0,0],e],n)}function aM(t,e,n){return rM(t,(function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];t.scale(150*i).translate([o,a])}),n)}function sM(t,e,n){return rM(t,(function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,a])}),n)}nM.prototype={constructor:nM,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var uM=16,lM=Jb(30*Yb);function cM(t,e){return+e?function(t,e){function n(r,i,o,a,s,u,l,c,f,h,d,p,g,m){var y=l-r,v=c-i,_=y*y+v*v;if(_>4*e&&g--){var x=a+h,b=s+d,w=u+p,k=iw(x*x+b*b+w*w),A=sw(w/=k),M=Gb(Gb(w)-1)e||Gb((y*F+v*S)/_-.5)>.3||a*h+s*d+u*p2?t[2]%360*Yb:0,F()):[m*Hb,y*Hb,v*Hb]},D.angle=function(t){return arguments.length?(_=t%360*Yb,F()):_*Hb},D.reflectX=function(t){return arguments.length?(x=t?-1:1,F()):x<0},D.reflectY=function(t){return arguments.length?(b=t?-1:1,F()):b<0},D.precision=function(t){return arguments.length?(a=cM(s,E=t*t),S()):iw(E)},D.fitExtent=function(t,e){return iM(D,t,e)},D.fitSize=function(t,e){return oM(D,t,e)},D.fitWidth=function(t,e){return aM(D,t,e)},D.fitHeight=function(t,e){return sM(D,t,e)},function(){return e=t.apply(this,arguments),D.invert=e.invert&&C,F()}}function gM(t){var e=0,n=Pb/3,r=pM(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*Yb,n=t[1]*Yb):[e*Hb,n*Hb]},i}function mM(t,e){var n=nw(t),r=(n+nw(e))/2;if(Gb(r)2?t[2]*Yb:0),e.invert=function(e){return(e=t.invert(e[0]*Yb,e[1]*Yb))[0]*=Hb,e[1]*=Hb,e},e}(i.rotate()).invert([0,0]));return u(null==l?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:t===kM?[[Math.max(s[0]-o,l),e],[Math.min(s[0]+o,n),r]]:[[l,Math.max(s[1]-o,e)],[n,Math.min(s[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),c()):a()},i.translate=function(t){return arguments.length?(s(t),c()):s()},i.center=function(t){return arguments.length?(o(t),c()):o()},i.clipExtent=function(t){return arguments.length?(null==t?l=e=n=r=null:(l=+t[0][0],e=+t[0][1],n=+t[1][0],r=+t[1][1]),c()):null==l?null:[[l,e],[n,r]]},c()}function MM(t){return ow((jb+t)/2)}function EM(t,e){var n=Jb(t),r=t===e?nw(t):tw(n/Jb(e))/tw(MM(e)/MM(t)),i=n*ew(MM(t),r)/r;if(!r)return kM;function o(t,e){i>0?e<-jb+Ub&&(e=-jb+Ub):e>jb-Ub&&(e=jb-Ub);var n=i/ew(MM(e),r);return[n*nw(r*t),i-n*Jb(r*t)]}return o.invert=function(t,e){var n=i-e,o=rw(r)*iw(t*t+n*n),a=Xb(t,Gb(n))*rw(n);return n*r<0&&(a-=Pb*rw(t)*rw(n)),[a/r,2*Vb(ew(i/o,1/r))-jb]},o}function DM(t,e){return[t,e]}function CM(t,e){var n=Jb(t),r=t===e?nw(t):(n-Jb(e))/(e-t),i=n/r+t;if(Gb(r)Ub&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},RM.invert=xM(sw),LM.invert=xM((function(t){return 2*Vb(t)})),UM.invert=function(t,e){return[-e,2*Vb(Qb(t))-jb]};var qM=Math.abs,PM=Math.cos,jM=Math.sin,IM=1e-6,WM=Math.PI,HM=WM/2,YM=function(t){return t>0?Math.sqrt(t):0}(2);function GM(t){return t>1?HM:t<-1?-HM:Math.asin(t)}function VM(t,e){var n,r=t*jM(e),i=30;do{e-=n=(e+jM(e)-r)/(1+PM(e))}while(qM(n)>IM&&--i>0);return e/2}var XM=function(t,e,n){function r(r,i){return[t*r*PM(i=VM(n,i)),e*jM(i)]}return r.invert=function(r,i){return i=GM(i/e),[r/(t*PM(i)),GM((2*i+jM(2*i))/n)]},r}(YM/HM,YM,WM);const JM=tM(),ZM=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function QM(t,e){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(tE[t]=function(t,e){return function n(){const r=e();return r.type=t,r.path=tM().projection(r),r.copy=r.copy||function(){const t=n();return ZM.forEach((e=>{r[e]&&t[e](r[e]())})),t.path.pointRadius(r.path.pointRadius()),t},ip(r)}}(t,e),this):tE[t]||null}function KM(t){return t&&t.path||JM}const tE={albers:vM,albersusa:function(){var t,e,n,r,i,o,a=vM(),s=yM().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=yM().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,e){o=[t,e]}};function c(t){var e=t[0],a=t[1];return o=null,n.point(e,a),o||(r.point(e,a),o)||(i.point(e,a),o)}function f(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),n=a.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?s:i>=.166&&i<.234&&r>=-.214&&r<-.115?u:a).invert(t)},c.stream=function(n){return t&&e===n?t:(r=[a.stream(e=n),s.stream(n),u.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++n2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)}};for(const t in tE)QM(t,tE[t]);function eE(){}const nE=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function rE(){var t=1,e=1,n=a;function r(t,e){return e.map((e=>i(t,e)))}function i(r,i){var a=[],s=[];return function(n,r,i){var a,s,u,l,c,f,h=[],d=[];a=s=-1,l=n[0]>=r,nE[l<<1].forEach(p);for(;++a=r,nE[u|l<<1].forEach(p);nE[l<<0].forEach(p);for(;++s=r,c=n[s*t]>=r,nE[l<<1|c<<2].forEach(p);++a=r,f=c,c=n[s*t+a+1]>=r,nE[u|l<<1|c<<2|f<<3].forEach(p);nE[l|c<<3].forEach(p)}a=-1,c=n[s*t]>=r,nE[c<<2].forEach(p);for(;++a=r,nE[c<<2|f<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+a,t[0][1]+s],u=[t[1][0]+a,t[1][1]+s],l=o(r),c=o(u);(e=d[l])?(n=h[c])?(delete d[e.end],delete h[n.start],e===n?(e.ring.push(u),i(e.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete d[e.end],e.ring.push(u),d[e.end=c]=e):(e=h[c])?(n=d[l])?(delete h[e.start],delete d[n.end],e===n?(e.ring.push(u),i(e.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete h[e.start],e.ring.unshift(r),h[e.start=l]=e):h[l]=d[c]={start:l,end:c,ring:[r,u]}}nE[c<<3].forEach(p)}(r,i,(t=>{n(t,r,i),function(t){var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];for(;++e0?a.push([t]):s.push(t)})),s.forEach((t=>{for(var e,n=0,r=a.length;n{var o,a=n[0],s=n[1],u=0|a,l=0|s,c=r[l*t+u];a>0&&a0&&s=0&&o>=0||s("invalid size"),t=i,e=o,r},r.smooth=function(t){return arguments.length?(n=t?a:eE,r):n===a},r}function iE(t,e){for(var n,r=-1,i=e.length;++rr!=d>r&&n<(h-l)*(r-c)/(d-c)+l&&(i=-i)}return i}function aE(t,e,n){var r,i,o,a;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],o=n[r],a=e[r],i<=o&&o<=a||a<=o&&o<=i)}function sE(t,e,n){return function(r){var i=at(r),o=n?Math.min(i[0],0):i[0],a=i[1],s=a-o,u=e?xe(o,a,t):s/(t+1);return Fe(o+u,a,u)}}function uE(t){Xa.call(this,null,t)}function lE(t,e,n,r,i){const o=t.x1||0,a=t.y1||0,s=e*n<0;function u(t){t.forEach(l)}function l(t){s&&t.reverse(),t.forEach(c)}function c(t){t[0]=(t[0]-o)*e+r,t[1]=(t[1]-a)*n+i}return function(t){return t.coordinates.forEach(u),t}}function cE(t,e,n){const r=t>=0?t:ns(e,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function fE(t){return J(t)?t:rt(+t)}function hE(){var t=t=>t[0],e=t=>t[1],n=d,r=[-1,-1],i=960,o=500,a=2;function u(s,u){const l=cE(r[0],s,t)>>a,c=cE(r[1],s,e)>>a,f=l?l+2:0,h=c?c+2:0,d=2*f+(i>>a),p=2*h+(o>>a),g=new Float32Array(d*p),m=new Float32Array(d*p);let y=g;s.forEach((r=>{const i=f+(+t(r)>>a),o=h+(+e(r)>>a);i>=0&&i=0&&o0&&c>0?(dE(d,p,g,m,l),pE(d,p,m,g,c),dE(d,p,g,m,l),pE(d,p,m,g,c),dE(d,p,g,m,l),pE(d,p,m,g,c)):l>0?(dE(d,p,g,m,l),dE(d,p,m,g,l),dE(d,p,g,m,l),y=m):c>0&&(pE(d,p,g,m,c),pE(d,p,m,g,c),pE(d,p,g,m,c),y=m);const v=u?Math.pow(2,-2*a):1/Se(y);for(let t=0,e=d*p;t>a),y2:h+(o>>a)}}return u.x=function(e){return arguments.length?(t=fE(e),u):t},u.y=function(t){return arguments.length?(e=fE(t),u):e},u.weight=function(t){return arguments.length?(n=fE(t),u):n},u.size=function(t){if(!arguments.length)return[i,o];var e=+t[0],n=+t[1];return e>=0&&n>=0||s("invalid size"),i=e,o=n,u},u.cellSize=function(t){return arguments.length?((t=+t)>=1||s("invalid cell size"),a=Math.floor(Math.log(t)/Math.LN2),u):1<=i&&(e>=o&&(s-=n[e-o+a*t]),r[e-i+a*t]=s/Math.min(e+1,t-1+o-e,o))}function pE(t,e,n,r,i){const o=1+(i<<1);for(let a=0;a=i&&(s>=o&&(u-=n[a+(s-o)*t]),r[a+(s-i)*t]=u/Math.min(s+1,e-1+o-s,o))}function gE(t){Xa.call(this,null,t)}uE.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},ht(uE,Xa,{transform(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n=e.fork(e.NO_SOURCE|e.NO_FIELDS),r=e.materialize(e.SOURCE).source,i=t.field||f,o=rE().smooth(!1!==t.smooth),a=t.thresholds||function(t,e,n){const r=sE(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?r:r(t.map((t=>be(e(t).values))))}(r,i,t),s=null===t.as?null:t.as||"contour",u=[];return r.forEach((e=>{const n=i(e),r=o.size([n.width,n.height])(n.values,k(a)?a:a(n.values));!function(t,e,n,r){let i=r.scale||e.scale,o=r.translate||e.translate;J(i)&&(i=i(n,r));J(o)&&(o=o(n,r));if((1===i||null==i)&&!o)return;const a=(yt(i)?i:i[0])||1,s=(yt(i)?i:i[1])||1,u=o&&o[0]||0,l=o&&o[1]||0;t.forEach(lE(e,a,s,u,l))}(r,n,e,t),r.forEach((t=>{u.push(xa(e,va(null!=s?{[s]:t}:t)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=u,n}}),gE.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const mE=["x","y","weight","size","cellSize","bandwidth"];function yE(t,e){return mE.forEach((n=>null!=e[n]?t[n](e[n]):0)),t}function vE(t){Xa.call(this,null,t)}ht(gE,Xa,{transform(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var r,i=e.fork(e.NO_SOURCE|e.NO_FIELDS),o=function(t,e){var n,r,i,o,a,s,u=[],l=t=>t(o);if(null==e)u.push(t);else for(n={},r=0,i=t.length;rva(function(t,e){for(let n=0;nUb})).map(u)).concat(Fe(Zb(o/d)*d,i,d).filter((function(t){return Gb(t%g)>Ub})).map(l))}return y.lines=function(){return v().map((function(t){return{type:"LineString",coordinates:t}}))},y.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(f(a).slice(1),c(n).reverse().slice(1),f(s).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.extentMajor(t).extentMinor(t):y.extentMinor()},y.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),s>a&&(t=s,s=a,a=t),y.precision(m)):[[r,s],[n,a]]},y.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],o=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),o>i&&(n=o,o=i,i=n),y.precision(m)):[[e,o],[t,i]]},y.step=function(t){return arguments.length?y.stepMajor(t).stepMinor(t):y.stepMinor()},y.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],y):[p,g]},y.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],y):[h,d]},y.precision=function(h){return arguments.length?(m=+h,u=Jk(o,i,90),l=Zk(e,t,m),c=Jk(s,a,90),f=Zk(r,n,m),y):m},y.extentMajor([[-180,-90+Ub],[180,90-Ub]]).extentMinor([[-180,-80-Ub],[180,80+Ub]])}()}function EE(t){Xa.call(this,null,t)}function DE(t){if(!J(t))return!1;const e=Tt(r(t));return e.$x||e.$y||e.$value||e.$max}function CE(t){Xa.call(this,null,t),this.modified(!0)}function FE(t,e,n){J(t[e])&&t[e](n)}bE.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},ht(bE,Xa,{transform(t,e){var n,i=this._features,o=this._points,a=t.fields,s=a&&a[0],u=a&&a[1],l=t.geojson||!a&&f,c=e.ADD;n=t.modified()||e.changed(e.REM)||e.modified(r(l))||s&&e.modified(r(s))||u&&e.modified(r(u)),this.value&&!n||(c=e.SOURCE,this._features=i=[],this._points=o=[]),l&&e.visit(c,(t=>i.push(l(t)))),s&&u&&(e.visit(c,(t=>{var e=s(t),n=u(t);null!=e&&null!=n&&(e=+e)===e&&(n=+n)===n&&o.push([e,n])})),i=i.concat({type:_E,geometry:{type:"MultiPoint",coordinates:o}})),this.value={type:xE,features:i}}}),wE.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},ht(wE,Xa,{transform(t,e){var n=e.fork(e.ALL),r=this.value,i=t.field||f,o=t.as||"path",a=n.SOURCE;!r||t.modified()?(this.value=r=KM(t.projection),n.materialize().reflow()):a=i===f||e.modified(i.fields)?n.ADD_MOD:n.ADD;const s=function(t,e){const n=t.pointRadius();t.context(null),null!=e&&t.pointRadius(e);return n}(r,t.pointRadius);return n.visit(a,(t=>t[o]=r(i(t)))),r.pointRadius(s),n.modifies(o)}}),kE.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},ht(kE,Xa,{transform(t,e){var n,r=t.projection,i=t.fields[0],o=t.fields[1],a=t.as||["x","y"],s=a[0],u=a[1];function l(t){const e=r([i(t),o(t)]);e?(t[s]=e[0],t[u]=e[1]):(t[s]=void 0,t[u]=void 0)}return t.modified()?e=e.materialize().reflow(!0).visit(e.SOURCE,l):(n=e.modified(i.fields)||e.modified(o.fields),e.visit(n?e.ADD_MOD:e.ADD,l)),e.modifies(a)}}),AE.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},ht(AE,Xa,{transform(t,e){var n=e.fork(e.ALL),r=this.value,i=t.as||"shape",o=n.ADD;return r&&!t.modified()||(this.value=r=function(t,e,n){const r=null==n?n=>t(e(n)):r=>{var i=t.pointRadius(),o=t.pointRadius(n)(e(r));return t.pointRadius(i),o};return r.context=e=>(t.context(e),r),r}(KM(t.projection),t.field||l("datum"),t.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(t=>t[i]=r)),n.modifies(i)}}),ME.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},ht(ME,Xa,{transform(t,e){var n,r=this.value,i=this.generator;if(!r.length||t.modified())for(const e in t)J(i[e])&&i[e](t[e]);return n=i(),r.length?e.mod.push(ba(r[0],n)):e.add.push(va(n)),r[0]=n,e}}),EE.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},ht(EE,Xa,{transform(t,e){if(!e.changed()&&!t.modified())return e.StopPropagation;var n=e.materialize(e.SOURCE).source,r="shared"===t.resolve,i=t.field||f,o=function(t,e){let n;J(t)?(n=n=>t(n,e),n.dep=DE(t)):t?n=rt(t):(n=t=>t.$value/t.$max||0,n.dep=!0);return n}(t.opacity,t),a=function(t,e){let n;J(t)?(n=n=>of(t(n,e)),n.dep=DE(t)):n=rt(of(t||"#888"));return n}(t.color,t),s=t.as||"image",u={$x:0,$y:0,$value:0,$max:r?be(n.map((t=>be(i(t).values)))):0};return n.forEach((t=>{const e=i(t),n=ot({},t,u);r||(n.$max=be(e.values||[])),t[s]=function(t,e,n,r){const i=t.width,o=t.height,a=t.x1||0,s=t.y1||0,u=t.x2||i,l=t.y2||o,c=t.values,f=c?t=>c[t]:h,d=Sc(u-a,l-s),p=d.getContext("2d"),g=p.getImageData(0,0,u-a,l-s),m=g.data;for(let t=s,o=0;t{null!=t[e]&&FE(n,e,t[e])}))):ZM.forEach((e=>{t.modified(e)&&FE(n,e,t[e])})),null!=t.pointRadius&&n.path.pointRadius(t.pointRadius),t.fit&&function(t,e){const n=function(t){return t=V(t),1===t.length?t[0]:{type:xE,features:t.reduce(((t,e)=>t.concat(function(t){return t.type===xE?t.features:V(t).filter((t=>null!=t)).map((t=>t.type===_E?t:{type:_E,geometry:t}))}(e))),[])}}(e.fit);e.extent?t.fitExtent(e.extent,n):e.size&&t.fitSize(e.size,n)}(n,t),e.fork(e.NO_SOURCE|e.NO_FIELDS)}});var SE=Object.freeze({__proto__:null,contour:vE,geojson:bE,geopath:wE,geopoint:kE,geoshape:AE,graticule:ME,heatmap:EE,isocontour:uE,kde2d:gE,projection:CE});function $E(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,s,u,l,c,f,h,d=t._root,p={data:r},g=t._x0,m=t._y0,y=t._x1,v=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((l=e>=(o=(g+y)/2))?g=o:y=o,(c=n>=(a=(m+v)/2))?m=a:v=a,i=d,!(d=d[f=c<<1|l]))return i[f]=p,t;if(s=+t._x.call(null,d.data),u=+t._y.call(null,d.data),e===s&&n===u)return p.next=d,i?i[f]=p:t._root=p,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(l=e>=(o=(g+y)/2))?g=o:y=o,(c=n>=(a=(m+v)/2))?m=a:v=a}while((f=c<<1|l)==(h=(u>=a)<<1|s>=o));return i[h]=d,i[f]=p,t}function TE(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function BE(t){return t[0]}function zE(t){return t[1]}function NE(t,e,n){var r=new OE(null==e?BE:e,null==n?zE:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function OE(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function RE(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var LE=NE.prototype=OE.prototype;function UE(t){return function(){return t}}function qE(t){return 1e-6*(t()-.5)}function PE(t){return t.x+t.vx}function jE(t){return t.y+t.vy}function IE(t){return t.index}function WE(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}LE.copy=function(){var t,e,n=new OE(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=RE(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=RE(e));return n},LE.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return $E(this.cover(e,n),e,n,t)},LE.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),s=new Array(o),u=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;nc&&(c=r),if&&(f=i));if(u>c||l>f)return this;for(this.cover(u,l).cover(c,f),n=0;nt||t>=i||r>e||e>=o;)switch(s=(eh||(o=u.y0)>d||(a=u.x1)=y)<<1|t>=m)&&(u=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=u)}else{var v=t-+this._x.call(null,g.data),_=e-+this._y.call(null,g.data),x=v*v+_*_;if(x=(s=(p+m)/2))?p=s:m=s,(c=a>=(u=(g+y)/2))?g=u:y=u,e=d,!(d=d[f=c<<1|l]))return this;if(!d.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(n=e,h=f)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[f]=i:delete e[f],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d),this):(this._root=i,this)},LE.removeAll=function(t){for(var e=0,n=t.length;e{}};function YE(){for(var t,e=0,n=arguments.length,r={};e=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a0)for(var n,r,i=new Array(n),o=0;o=0&&e._call.call(void 0,t),e=e._next;--QE}()}finally{QE=0,function(){var t,e,n=JE,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:JE=e);ZE=t,dD(r)}(),rD=0}}function hD(){var t=oD.now(),e=t-nD;e>eD&&(iD-=e,nD=t)}function dD(t){QE||(KE&&(KE=clearTimeout(KE)),t-rD>24?(t<1/0&&(KE=setTimeout(fD,t-oD.now()-iD)),tD&&(tD=clearInterval(tD))):(tD||(nD=oD.now(),tD=setInterval(hD,eD)),QE=1,aD(fD)))}lD.prototype=cD.prototype={constructor:lD,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?sD():+n)+(null==e?0:+e),this._next||ZE===this||(ZE?ZE._next=this:JE=this,ZE=this),this._call=t,this._time=n,dD()},stop:function(){this._call&&(this._call=null,this._time=1/0,dD())}};const pD=1664525,gD=1013904223,mD=4294967296;function yD(t){return t.x}function vD(t){return t.y}var _D=10,xD=Math.PI*(3-Math.sqrt(5));function bD(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,s=new Map,u=cD(f),l=YE("tick","end"),c=function(){let t=1;return()=>(t=(pD*t+gD)%mD)/mD}();function f(){h(),l.call("tick",e),n1?(null==n?s.delete(t):s.set(t,p(n)),e):s.get(t)},find:function(e,n,r){var i,o,a,s,u,l=0,c=t.length;for(null==r?r=1/0:r*=r,l=0;l1?(l.on(t,n),e):l.on(t)}}}const wD={center:function(t,e){var n,r=1;function i(){var i,o,a=n.length,s=0,u=0;for(i=0;il+p||oc+p||au.index){var g=l-s.x-s.vx,m=c-s.y-s.vy,y=g*g+m*m;yt.r&&(t.r=t[e].r)}function u(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r=s)){(t.data!==e||t.next)&&(0===f&&(p+=(f=qE(n))*f),0===h&&(p+=(h=qE(n))*h),p[s(t,e,r),t])));for(a=0,i=new Array(l);ae(t,n):e)}DD.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:ED}]},ht(DD,Xa,{transform(t,e){var n,r,i=this.value,o=e.changed(e.ADD_REM),a=t.modified(AD),s=t.iterations||300;if(i?(o&&(e.modifies("index"),i.nodes(e.source)),(a||e.changed(e.MOD))&&CD(i,t,0,e)):(this.value=i=function(t,e){const n=bD(t),r=n.stop,i=n.restart;let o=!1;return n.stopped=()=>o,n.restart=()=>(o=!1,i()),n.stop=()=>(o=!0,r()),CD(n,e,!0).on("end",(()=>o=!0))}(e.source,t),i.on("tick",(n=e.dataflow,r=this,()=>n.touch(r).run())),t.static||(o=!0,i.tick()),e.modifies("index")),a||o||t.modified(MD)||e.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/s)),t.static)for(i.stop();--s>=0;)i.tick();else if(i.stopped()&&i.restart(),!o)return e.StopPropagation;return this.finish(t,e)},finish(t,e){const n=e.dataflow;for(let t,e=this._argops,s=0,u=e.length;s=0;)e+=n[r].value;else e=1;t.value=e}function RD(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=UD)):void 0===e&&(e=LD);for(var n,r,i,o,a,s=new jD(t),u=[s];n=u.pop();)if((i=e(n.data))&&(a=(i=Array.from(i)).length))for(n.children=i,o=a-1;o>=0;--o)u.push(r=i[o]=new jD(i[o])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(PD)}function LD(t){return t.children}function UD(t){return Array.isArray(t)?t[1]:null}function qD(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function PD(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function jD(t){this.data=t,this.depth=this.height=0,this.parent=null}function ID(t){return null==t?null:WD(t)}function WD(t){if("function"!=typeof t)throw new Error;return t}function HD(){return 0}function YD(t){return function(){return t}}jD.prototype=RD.prototype={constructor:jD,count:function(){return this.eachAfter(OD)},each:function(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this},eachAfter:function(t,e){for(var n,r,i,o=this,a=[o],s=[],u=-1;o=a.pop();)if(s.push(o),n=o.children)for(r=0,i=n.length;r=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;t=n.pop(),e=r.pop();for(;t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return RD(this).eachBefore(qD)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;n0&&n*n>r*r+i*i}function KD(t,e){for(var n=0;n1e-6?(D+Math.sqrt(D*D-4*E*C))/(2*E):C/D);return{x:r+w+k*F,y:i+A+M*F,r:F}}function rC(t,e,n){var r,i,o,a,s=t.x-e.x,u=t.y-e.y,l=s*s+u*u;l?(i=e.r+n.r,i*=i,a=t.r+n.r,i>(a*=a)?(r=(l+a-i)/(2*l),o=Math.sqrt(Math.max(0,a/l-r*r)),n.x=t.x-r*s-o*u,n.y=t.y-r*u+o*s):(r=(l+i-a)/(2*l),o=Math.sqrt(Math.max(0,i/l-r*r)),n.x=e.x+r*s-o*u,n.y=e.y+r*u+o*s)):(n.x=e.x+n.r,n.y=e.y)}function iC(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function oC(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function aC(t){this._=t,this.next=null,this.previous=null}function sC(t,e){if(!(o=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var n,r,i,o,a,s,u,l,c,f,h;if((n=t[0]).x=0,n.y=0,!(o>1))return n.r;if(r=t[1],n.x=-r.r,r.x=n.r,r.y=0,!(o>2))return n.r+r.r;rC(r,n,i=t[2]),n=new aC(n),r=new aC(r),i=new aC(i),n.next=i.previous=r,r.next=n.previous=i,i.next=r.previous=n;t:for(u=3;ufunction(t){t=`${t}`;let e=t.length;bC(t,e-1)&&!bC(t,e-2)&&(t=t.slice(0,-1));return"/"===t[0]?t:`/${t}`}(t(e,n,r)))),n=e.map(xC),i=new Set(e).add("");for(const t of n)i.has(t)||(i.add(t),e.push(t),n.push(xC(t)),h.push(mC));d=(t,n)=>e[n],p=(t,e)=>n[e]}for(a=0,i=h.length;a=0&&(l=h[t]).data===mC;--t)l.data=null}if(s.parent=pC,s.eachBefore((function(t){t.depth=t.parent.depth+1,--i})).eachBefore(PD),s.parent=null,i>0)throw new Error("cycle");return s}return r.id=function(t){return arguments.length?(e=ID(t),r):e},r.parentId=function(t){return arguments.length?(n=ID(t),r):n},r.path=function(e){return arguments.length?(t=ID(e),r):t},r}function xC(t){let e=t.length;if(e<2)return"";for(;--e>1&&!bC(t,e););return t.slice(0,e)}function bC(t,e){if("/"===t[e]){let n=0;for(;e>0&&"\\"===t[--e];)++n;if(0==(1&n))return!0}return!1}function wC(t,e){return t.parent===e.parent?1:2}function kC(t){var e=t.children;return e?e[0]:t.t}function AC(t){var e=t.children;return e?e[e.length-1]:t.t}function MC(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function EC(t,e,n){return t.a.parent===e.parent?t.a:n}function DC(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function CC(t,e,n,r,i){for(var o,a=t.children,s=-1,u=a.length,l=t.value&&(i-n)/t.value;++sh&&(h=s),m=c*c*g,(d=Math.max(h/m,m/f))>p){c-=s;break}p=d}y.push(a={value:c,dice:u1?e:1)},n}(FC);var TC=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,s,u,l,c,f=-1,h=a.length,d=t.value;++f1?e:1)},n}(FC);function BC(t,e,n){const r={};return t.each((t=>{const i=t.data;n(i)&&(r[e(i)]=t)})),t.lookup=r,t}function zC(t){Xa.call(this,null,t)}zC.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const NC=t=>t.values;function OC(){const t=[],e={entries:t=>r(n(t,0),0),key:n=>(t.push(n),e)};function n(e,r){if(r>=t.length)return e;const i=e.length,o=t[r++],a={},s={};let u,l,c,f=-1;for(;++ft.length)return e;const i=[];for(const t in e)i.push({key:t,values:r(e[t],n)});return i}return e}function RC(t){Xa.call(this,null,t)}ht(zC,Xa,{transform(t,e){e.source||s("Nest transform requires an upstream data source.");var n=t.generate,r=t.modified(),i=e.clone(),o=this.value;return(!o||r||e.changed())&&(o&&o.each((t=>{t.children&&ga(t.data)&&i.rem.push(t.data)})),this.value=o=RD({values:V(t.keys).reduce(((t,e)=>(t.key(e),t)),OC()).entries(i.source)},NC),n&&o.each((t=>{t.children&&(t=va(t.data),i.add.push(t),i.source.push(t))})),BC(o,ma,ma)),i.source.root=o,i}});const LC=(t,e)=>t.parent===e.parent?1:2;ht(RC,Xa,{transform(t,e){e.source&&e.source.root||s(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(t.method),r=this.fields,i=e.source.root,o=t.as||r;t.field?i.sum(t.field):i.count(),t.sort&&i.sort(wa(t.sort,(t=>t.data))),function(t,e,n){for(let r,i=0,o=e.length;ifunction(t,e,n){const r=t.data,i=e.length-1;for(let o=0;o(t=(GD*t+VD)%XD)/XD}();return i.x=e/2,i.y=n/2,t?i.eachBefore(lC(t)).eachAfter(cC(r,.5,o)).eachBefore(fC(1)):i.eachBefore(lC(uC)).eachAfter(cC(HD,1,o)).eachAfter(cC(r,i.r/Math.min(e,n),o)).eachBefore(fC(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=ID(e),i):t},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:YD(+t),i):r},i},params:["radius","size","padding"],fields:UC});const PC=["x0","y0","x1","y1","depth","children"];function jC(t){RC.call(this,t)}function IC(t){Xa.call(this,null,t)}jC.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:PC.length,default:PC}]},ht(jC,RC,{layout:function(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&dC(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,s=r.y1-n;a=0;--i)s.push(n=e.children[i]=new DC(r[i],i)),n.parent=e;return(a.parent=new DC(null,0)).children=[a],a}(i);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(a),r)i.eachBefore(s);else{var l=i,c=i,f=i;i.eachBefore((function(t){t.xc.x&&(c=t),t.depth>f.depth&&(f=t)}));var h=l===c?1:t(l,c)/2,d=h-l.x,p=e/(c.x+h+d),g=n/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*p,t.y=t.depth*g}))}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,s=n,u=o.parent.children[0],l=o.m,c=a.m,f=s.m,h=u.m;s=AC(s),o=kC(o),s&&o;)u=kC(u),(a=AC(a)).a=e,(i=s.z+f-o.z-l+t(s._,o._))>0&&(MC(EC(s,e,r),e,i),l+=i,c+=i),f+=s.m,l+=o.m,h+=u.m,c+=a.m;s&&!AC(a)&&(a.t=s,a.m+=f-c),o&&!kC(u)&&(u.t=o,u.m+=l-h,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i},cluster:function(){var t=BD,e=1,n=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(e){var n=e.children;n?(e.x=function(t){return t.reduce(zD,0)/t.length}(n),e.y=function(t){return 1+t.reduce(ND,0)}(n)):(e.x=o?a+=t(e,o):0,e.y=0,o=e)}));var s=function(t){for(var e;e=t.children;)t=e[0];return t}(i),u=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),l=s.x-t(s,u)/2,c=u.x+t(u,s)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-l)/(c-l)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}},HC=["x","y","depth","children"];function YC(t){RC.call(this,t)}function GC(t){Xa.call(this,[],t)}YC.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:HC.length,default:HC}]},ht(YC,RC,{layout(t){const e=t||"tidy";if(ut(WC,e))return WC[e]();s("Unrecognized Tree layout method: "+e)},params:["size","nodeSize"],fields:HC}),GC.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},ht(GC,Xa,{transform(t,e){const n=this.value,r=e.source&&e.source.root,i=e.fork(e.NO_SOURCE),o={};return r||s("TreeLinks transform requires a tree data source."),e.changed(e.ADD_REM)?(i.rem=n,e.visit(e.SOURCE,(t=>o[ma(t)]=1)),r.each((t=>{const e=t.data,n=t.parent&&t.parent.data;n&&o[ma(e)]&&o[ma(n)]&&i.add.push(va({source:n,target:e}))})),this.value=i.add):e.changed(e.MOD)&&(e.visit(e.MOD,(t=>o[ma(t)]=1)),n.forEach((t=>{(o[ma(t.source)]||o[ma(t.target)])&&i.mod.push(t)}))),i}});const VC={binary:function(t,e,n,r,i){var o,a,s=t.children,u=s.length,l=new Array(u+1);for(l[0]=a=o=0;o=n-1){var c=s[e];return c.x0=i,c.y0=o,c.x1=a,void(c.y1=u)}var f=l[e],h=r/2+f,d=e+1,p=n-1;for(;d>>1;l[g]u-o){var v=r?(i*y+a*m)/r:a;t(e,d,m,i,o,v,u),t(d,n,y,v,o,a,u)}else{var _=r?(o*y+u*m)/r:u;t(e,d,m,i,o,a,_),t(d,n,y,i,_,a,u)}}(0,u,t.value,e,n,r,i)},dice:dC,slice:CC,slicedice:function(t,e,n,r,i){(1&t.depth?CC:dC)(t,e,n,r,i)},squarify:$C,resquarify:TC},XC=["x0","y0","x1","y1","depth","children"];function JC(t){RC.call(this,t)}JC.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:XC.length,default:XC}]},ht(JC,RC,{layout(){const t=function(){var t=$C,e=!1,n=1,r=1,i=[0],o=HD,a=HD,s=HD,u=HD,l=HD;function c(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(f),i=[0],e&&t.eachBefore(hC),t}function f(e){var n=i[e.depth],r=e.x0+n,c=e.y0+n,f=e.x1-n,h=e.y1-n;f{const n=t.tile();n.ratio&&t.tile(n.ratio(e))},t.method=e=>{ut(VC,e)?t.tile(VC[e]):s("Unrecognized Treemap layout method: "+e)},t},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:XC});var ZC=Object.freeze({__proto__:null,nest:zC,pack:qC,partition:jC,stratify:IC,tree:YC,treelinks:GC,treemap:JC});const QC=4278190080;function KC(t,e,n){return new Uint32Array(t.getImageData(0,0,e,n).data.buffer)}function tF(t,e,n){if(!e.length)return;const r=e[0].mark.marktype;"group"===r?e.forEach((e=>{e.items.forEach((e=>tF(t,e.items,n)))})):Hy[r].draw(t,{items:n?e.map(eF):e})}function eF(t){const e=xa(t,{});return e.stroke&&0!==e.strokeOpacity||e.fill&&0!==e.fillOpacity?{...e,strokeOpacity:1,stroke:"#000",fillOpacity:0}:e}const nF=5,rF=31,iF=32,oF=new Uint32Array(iF+1),aF=new Uint32Array(iF+1);aF[0]=0,oF[0]=~aF[0];for(let t=1;t<=iF;++t)aF[t]=aF[t-1]<<1|1,oF[t]=~aF[t];function sF(t,e,n){const r=Math.max(1,Math.sqrt(t*e/1e6)),i=~~((t+2*n+r)/r),o=~~((e+2*n+r)/r),a=t=>~~((t+n)/r);return a.invert=t=>t*r-n,a.bitmap=()=>function(t,e){const n=new Uint32Array(~~((t*e+iF)/iF));function r(t,e){n[t]|=e}function i(t,e){n[t]&=e}return{array:n,get:(e,r)=>{const i=r*t+e;return n[i>>>nF]&1<<(i&rF)},set:(e,n)=>{const i=n*t+e;r(i>>>nF,1<<(i&rF))},clear:(e,n)=>{const r=n*t+e;i(r>>>nF,~(1<<(r&rF)))},getRange:(e,r,i,o)=>{let a,s,u,l,c=o;for(;c>=r;--c)if(a=c*t+e,s=c*t+i,u=a>>>nF,l=s>>>nF,u===l){if(n[u]&oF[a&rF]&aF[1+(s&rF)])return!0}else{if(n[u]&oF[a&rF])return!0;if(n[l]&aF[1+(s&rF)])return!0;for(let t=u+1;t{let a,s,u,l,c;for(;n<=o;++n)if(a=n*t+e,s=n*t+i,u=a>>>nF,l=s>>>nF,u===l)r(u,oF[a&rF]&aF[1+(s&rF)]);else for(r(u,oF[a&rF]),r(l,aF[1+(s&rF)]),c=u+1;c{let a,s,u,l,c;for(;n<=o;++n)if(a=n*t+e,s=n*t+r,u=a>>>nF,l=s>>>nF,u===l)i(u,aF[a&rF]|oF[1+(s&rF)]);else for(i(u,aF[a&rF]),i(l,oF[1+(s&rF)]),c=u+1;cn<0||r<0||o>=e||i>=t}}(i,o),a.ratio=r,a.padding=n,a.width=t,a.height=e,a}function uF(t,e,n,r,i,o){let a=n/2;return t-a<0||t+a>i||e-(a=r/2)<0||e+a>o}function lF(t,e,n,r,i,o,a,s){const u=i*o/(2*r),l=t(e-u),c=t(e+u),f=t(n-(o/=2)),h=t(n+o);return a.outOfBounds(l,f,c,h)||a.getRange(l,f,c,h)||s&&s.getRange(l,f,c,h)}const cF=[-1,-1,1,1],fF=[-1,1,-1,1];const hF=["right","center","left"],dF=["bottom","middle","top"];function pF(t,e,n,r,i,o,a,s,u,l,c,f){return!(i.outOfBounds(t,n,e,r)||(f&&o||i).getRange(t,n,e,r))}const gF={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},mF={naive:function(t,e,n,r){const i=t.width,o=t.height;return function(t){const e=t.datum.datum.items[r].items,n=e.length,a=t.datum.fontSize,s=My.width(t.datum,t.datum.text);let u,l,c,f,h,d,p,g=0;for(let r=0;r=g&&(g=p,t.x=h,t.y=d);return h=s/2,d=a/2,u=t.x-h,l=t.x+h,c=t.y-d,f=t.y+d,t.align="center",u<0&&l<=i?t.align="left":0<=u&&i=1;)h=(d+p)/2,lF(t,c,f,l,u,h,a,s)?p=h:d=h;if(d>r)return[c,f,d,!0]}}return function(e){const s=e.datum.datum.items[r].items,l=s.length,c=e.datum.fontSize,f=My.width(e.datum,e.datum.text);let h,d,p,g,m,y,v,_,x,b,w,k,A,M,E,D,C,F=n?c:0,S=!1,$=!1,T=0;for(let r=0;rd&&(C=h,h=d,d=C),p>g&&(C=p,p=g,g=C),x=t(h),w=t(d),b=~~((x+w)/2),k=t(p),M=t(g),A=~~((k+M)/2),v=b;v>=x;--v)for(_=A;_>=k;--_)D=u(v,_,F,f,c),D&&([e.x,e.y,F,S]=D);for(v=b;v<=w;++v)for(_=A;_<=M;++_)D=u(v,_,F,f,c),D&&([e.x,e.y,F,S]=D);S||n||(E=Math.abs(d-h+g-p),m=(h+d)/2,y=(p+g)/2,E>=T&&!uF(m,y,f,c,i,o)&&!lF(t,m,y,c,f,c,a,null)&&(T=E,e.x=m,e.y=y,$=!0))}return!(!S&&!$)&&(m=f/2,y=c/2,a.setRange(t(e.x-m),t(e.y-y),t(e.x+m),t(e.y+y)),e.align="center",e.baseline="middle",!0)}},floodfill:function(t,e,n,r){const i=t.width,o=t.height,a=e[0],s=e[1],u=t.bitmap();return function(e){const l=e.datum.datum.items[r].items,c=l.length,f=e.datum.fontSize,h=My.width(e.datum,e.datum.text),d=[];let p,g,m,y,v,_,x,b,w,k,A,M,E=n?f:0,D=!1,C=!1,F=0;for(let r=0;r=1;)A=(w+k)/2,lF(t,v,_,f,h,A,a,s)?k=A:w=A;w>E&&(e.x=v,e.y=_,E=w,D=!0)}}D||n||(M=Math.abs(g-p+y-m),v=(p+g)/2,_=(m+y)/2,M>=F&&!uF(v,_,h,f,i,o)&&!lF(t,v,_,f,h,f,a,null)&&(F=M,e.x=v,e.y=_,C=!0))}return!(!D&&!C)&&(v=h/2,_=f/2,a.setRange(t(e.x-v),t(e.y-_),t(e.x+v),t(e.y+_)),e.align="center",e.baseline="middle",!0)}}};function yF(t,e,n,r,i,o,a,s,u,l,c){if(!t.length)return t;const f=Math.max(r.length,i.length),h=function(t,e){const n=new Float64Array(e),r=t.length;for(let e=0;e[t.x,t.x,t.x,t.y,t.y,t.y];return t?"line"===t||"area"===t?t=>i(t.datum):"line"===e?t=>{const e=t.datum.items[r].items;return i(e.length?e["start"===n?0:e.length-1]:{x:NaN,y:NaN})}:t=>{const e=t.datum.bounds;return[e.x1,(e.x1+e.x2)/2,e.x2,e.y1,(e.y1+e.y2)/2,e.y2]}:i}(p,g,s,u),v=null===l||l===1/0,_=m&&"naive"===c;var x;let b=-1,w=-1;const k=t.map((t=>{const e=v?My.width(t,t.text):void 0;return b=Math.max(b,e),w=Math.max(w,t.fontSize),{datum:t,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(t),textWidth:e}}));l=null===l||l===1/0?Math.max(b,w)+Math.max(...r):l;const A=sF(e[0],e[1],l);let M;if(!_){n&&k.sort(((t,e)=>n(t.datum,e.datum)));let e=!1;for(let t=0;tt.datum));M=o.length||r?function(t,e,n,r,i){const o=t.width,a=t.height,s=r||i,u=Sc(o,a).getContext("2d"),l=Sc(o,a).getContext("2d"),c=s&&Sc(o,a).getContext("2d");n.forEach((t=>tF(u,t,!1))),tF(l,e,!1),s&&tF(c,e,!0);const f=KC(u,o,a),h=KC(l,o,a),d=s&&KC(c,o,a),p=t.bitmap(),g=s&&t.bitmap();let m,y,v,_,x,b,w,k;for(y=0;yn.set(t(e.boundary[0]),t(e.boundary[3])))),[n,void 0]}(A,a&&k)}const E=m?mF[c](A,M,a,u):function(t,e,n,r){const i=t.width,o=t.height,a=e[0],s=e[1],u=r.length;return function(e){const l=e.boundary,c=e.datum.fontSize;if(l[2]<0||l[5]<0||l[0]>i||l[3]>o)return!1;let f,h,d,p,g,m,y,v,_,x,b,w,k,A,M,E=e.textWidth??0;for(let i=0;i>>2&3)-1,d=0===f&&0===h||r[i]<0,p=f&&h?Math.SQRT1_2:1,g=r[i]<0?-1:1,m=l[1+f]+r[i]*f*p,b=l[4+h]+g*c*h/2+r[i]*h*p,v=b-c/2,_=b+c/2,w=t(m),A=t(v),M=t(_),!E){if(!pF(w,w,A,M,a,s,0,0,0,0,0,d))continue;E=My.width(e.datum,e.datum.text)}if(x=m+g*E*f/2,m=x-E/2,y=x+E/2,w=t(m),k=t(y),pF(w,k,A,M,a,s,0,0,0,0,0,d))return e.x=f?f*g<0?y:m:x,e.y=h?h*g<0?_:v:b,e.align=hF[f*g+1],e.baseline=dF[h*g+1],a.setRange(w,A,k,M),!0}return!1}}(A,M,d,h);return k.forEach((t=>t.opacity=+E(t))),k}const vF=["x","y","opacity","align","baseline"],_F=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function xF(t){Xa.call(this,null,t)}xF.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:_F},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:vF.length,default:vF}]},ht(xF,Xa,{transform(t,e){const n=t.modified();if(!(n||e.changed(e.ADD_REM)||function(n){const r=t[n];return J(r)&&e.modified(r.fields)}("sort")))return;t.size&&2===t.size.length||s("Size parameter should be specified as a [width, height] array.");const r=t.as||vF;return yF(e.materialize(e.SOURCE).source||[],t.size,t.sort,V(null==t.offset?1:t.offset),V(t.anchor||_F),t.avoidMarks||[],!1!==t.avoidBaseMark,t.lineAnchor||"end",t.markIndex||0,void 0===t.padding?0:t.padding,t.method||"naive").forEach((t=>{const e=t.datum;e[r[0]]=t.x,e[r[1]]=t.y,e[r[2]]=t.opacity,e[r[3]]=t.align,e[r[4]]=t.baseline})),e.reflow(n).modifies(r)}});var bF=Object.freeze({__proto__:null,label:xF});function wF(t,e){var n,r,i,o,a,s,u=[],l=function(t){return t(o)};if(null==e)u.push(t);else for(n={},r=0,i=t.length;r{Ls(e,t.x,t.y,t.bandwidth||.3).forEach((t=>{const n={};for(let t=0;t"poly"===t?e:"quad"===t?2:1)(a,u),c=t.as||[n(t.x),n(t.y)],f=AF[a],h=[];let d=t.extent;ut(AF,a)||s("Invalid regression method: "+a),null!=d&&"log"===a&&d[0]<=0&&(e.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),i.forEach((n=>{if(n.length<=l)return void e.dataflow.warn("Skipping regression with more parameters than data points.");const r=f(n,t.x,t.y,u);if(t.params)return void h.push(va({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));const i=d||at(n,t.x),s=t=>{const e={};for(let t=0;ts([t,r.predict(t)]))):js(r.predict,i,25,200).forEach(s)})),this.value&&(r.rem=this.value),this.value=r.add=r.source=h}return r}});var EF=Object.freeze({__proto__:null,loess:kF,regression:MF});const DF=134217729,CF=33306690738754706e-32;function FF(t,e,n,r,i){let o,a,s,u,l=e[0],c=r[0],f=0,h=0;c>l==c>-l?(o=l,l=e[++f]):(o=c,c=r[++h]);let d=0;if(fl==c>-l?(a=l+o,s=o-(a-l),l=e[++f]):(a=c+o,s=o-(a-c),c=r[++h]),o=a,0!==s&&(i[d++]=s);fl==c>-l?(a=o+l,u=a-o,s=o-(a-u)+(l-u),l=e[++f]):(a=o+c,u=a-o,s=o-(a-u)+(c-u),c=r[++h]),o=a,0!==s&&(i[d++]=s);for(;f0!=s>0)return u;const l=Math.abs(a+s);return Math.abs(u)>=33306690738754716e-32*l?u:-function(t,e,n,r,i,o,a){let s,u,l,c,f,h,d,p,g,m,y,v,_,x,b,w,k,A;const M=t-i,E=n-i,D=e-o,C=r-o;x=M*C,h=DF*M,d=h-(h-M),p=M-d,h=DF*C,g=h-(h-C),m=C-g,b=p*m-(x-d*g-p*g-d*m),w=D*E,h=DF*D,d=h-(h-D),p=D-d,h=DF*E,g=h-(h-E),m=E-g,k=p*m-(w-d*g-p*g-d*m),y=b-k,f=b-y,BF[0]=b-(y+f)+(f-k),v=x+y,f=v-x,_=x-(v-f)+(y-f),y=_-w,f=_-y,BF[1]=_-(y+f)+(f-w),A=v+y,f=A-v,BF[2]=v-(A-f)+(y-f),BF[3]=A;let F=function(t,e){let n=e[0];for(let r=1;r=S||-F>=S)return F;if(f=t-M,s=t-(M+f)+(f-i),f=n-E,l=n-(E+f)+(f-i),f=e-D,u=e-(D+f)+(f-o),f=r-C,c=r-(C+f)+(f-o),0===s&&0===u&&0===l&&0===c)return F;if(S=TF*a+CF*Math.abs(F),F+=M*c+C*s-(D*l+E*u),F>=S||-F>=S)return F;x=s*C,h=DF*s,d=h-(h-s),p=s-d,h=DF*C,g=h-(h-C),m=C-g,b=p*m-(x-d*g-p*g-d*m),w=u*E,h=DF*u,d=h-(h-u),p=u-d,h=DF*E,g=h-(h-E),m=E-g,k=p*m-(w-d*g-p*g-d*m),y=b-k,f=b-y,RF[0]=b-(y+f)+(f-k),v=x+y,f=v-x,_=x-(v-f)+(y-f),y=_-w,f=_-y,RF[1]=_-(y+f)+(f-w),A=v+y,f=A-v,RF[2]=v-(A-f)+(y-f),RF[3]=A;const $=FF(4,BF,4,RF,zF);x=M*c,h=DF*M,d=h-(h-M),p=M-d,h=DF*c,g=h-(h-c),m=c-g,b=p*m-(x-d*g-p*g-d*m),w=D*l,h=DF*D,d=h-(h-D),p=D-d,h=DF*l,g=h-(h-l),m=l-g,k=p*m-(w-d*g-p*g-d*m),y=b-k,f=b-y,RF[0]=b-(y+f)+(f-k),v=x+y,f=v-x,_=x-(v-f)+(y-f),y=_-w,f=_-y,RF[1]=_-(y+f)+(f-w),A=v+y,f=A-v,RF[2]=v-(A-f)+(y-f),RF[3]=A;const T=FF($,zF,4,RF,NF);x=s*c,h=DF*s,d=h-(h-s),p=s-d,h=DF*c,g=h-(h-c),m=c-g,b=p*m-(x-d*g-p*g-d*m),w=u*l,h=DF*u,d=h-(h-u),p=u-d,h=DF*l,g=h-(h-l),m=l-g,k=p*m-(w-d*g-p*g-d*m),y=b-k,f=b-y,RF[0]=b-(y+f)+(f-k),v=x+y,f=v-x,_=x-(v-f)+(y-f),y=_-w,f=_-y,RF[1]=_-(y+f)+(f-w),A=v+y,f=A-v,RF[2]=v-(A-f)+(y-f),RF[3]=A;const B=FF(T,NF,4,RF,OF);return OF[B-1]}(t,e,n,r,i,o,l)}const UF=Math.pow(2,-52),qF=new Uint32Array(512);class PF{static from(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:GF,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:VF;const r=t.length,i=new Float64Array(2*r);for(let o=0;o>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,s=1/0,u=-1/0,l=-1/0;for(let e=0;eu&&(u=n),r>l&&(l=r),this._ids[e]=e}const c=(a+u)/2,f=(s+l)/2;let h,d,p,g=1/0;for(let e=0;e0&&(d=e,g=n)}let v=t[2*d],_=t[2*d+1],x=1/0;for(let e=0;er&&(e[n++]=i,r=this._dists[i])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(LF(m,y,v,_,b,w)<0){const t=d,e=v,n=_;d=p,v=b,_=w,p=t,b=e,w=n}const k=function(t,e,n,r,i,o){const a=n-t,s=r-e,u=i-t,l=o-e,c=a*a+s*s,f=u*u+l*l,h=.5/(a*l-s*u),d=t+(l*c-s*f)*h,p=e+(a*f-u*c)*h;return{x:d,y:p}}(m,y,v,_,b,w);this._cx=k.x,this._cy=k.y;for(let e=0;e0&&Math.abs(l-o)<=UF&&Math.abs(c-a)<=UF)continue;if(o=l,a=c,u===h||u===d||u===p)continue;let f=0;for(let t=0,e=this._hashKey(l,c);t=0;)if(m=g,m===f){m=-1;break}if(-1===m)continue;let y=this._addTriangle(m,u,n[m],-1,-1,r[m]);r[u]=this._legalize(y+2),r[m]=y,A++;let v=n[m];for(;g=n[v],LF(l,c,t[2*v],t[2*v+1],t[2*g],t[2*g+1])<0;)y=this._addTriangle(v,u,g,r[u],-1,r[v]),r[u]=this._legalize(y+2),n[v]=v,A--,v=g;if(m===f)for(;g=e[m],LF(l,c,t[2*g],t[2*g+1],t[2*m],t[2*m+1])<0;)y=this._addTriangle(g,u,m,-1,r[m],r[g]),this._legalize(y+2),r[g]=y,n[m]=m,A--,m=g;this._hullStart=e[u]=m,n[m]=e[v]=u,n[u]=v,i[this._hashKey(l,c)]=u,i[this._hashKey(t[2*m],t[2*m+1])]=m}this.hull=new Uint32Array(A);for(let t=0,e=this._hullStart;t0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,o=0;for(;;){const a=n[t],s=t-t%3;if(o=s+(t+2)%3,-1===a){if(0===i)break;t=qF[--i];continue}const u=a-a%3,l=s+(t+1)%3,c=u+(a+2)%3,f=e[o],h=e[t],d=e[l],p=e[c];if(IF(r[2*f],r[2*f+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){e[t]=p,e[a]=f;const r=n[c];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===c){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(a,n[o]),this._link(o,c);const s=u+(a+1)%3;i=n&&e[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=n+1,o=r;YF(t,n+r>>1,i),e[t[n]]>e[t[r]]&&YF(t,n,r),e[t[i]]>e[t[r]]&&YF(t,i,r),e[t[n]]>e[t[i]]&&YF(t,n,i);const a=t[i],s=e[a];for(;;){do{i++}while(e[t[i]]s);if(o=o-n?(HF(t,e,i,r),HF(t,e,n,o-1)):(HF(t,e,n,o-1),HF(t,e,i,r))}}function YF(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function GF(t){return t[0]}function VF(t){return t[1]}const XF=1e-6;class JF{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>XF||Math.abs(this._y1-i)>XF)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class ZF{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}}let QF=class{constructor(t){let[e,n,r,i]=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,960,500];if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this;let i,o;const a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let r,s,u=0,l=0,c=n.length;u1;)i-=2;for(let t=2;t0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)this.xmax?2:0)|(ethis.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:eS,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:nS,r=arguments.length>3?arguments[3]:void 0;return new iS("length"in t?function(t,e,n,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},((t,e)=>e)).sort(((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]));const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,n=e.length/2;t0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,2===r.length&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new QF(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const e=a.indexOf(t);return e>0&&(yield a[e-1]),void(e2&&void 0!==arguments[2]?arguments[2]:0;if((t=+t)!=t||(e=+e)!=e)return-1;const r=n;let i;for(;(i=this._step(n,t,e))>=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:s,points:u}=this;if(-1===r[t]||!u.length)return(t+1)%(u.length>>1);let l=t,c=tS(e-u[2*t],2)+tS(n-u[2*t+1],2);const f=r[t];let h=f;do{let r=s[h];const f=tS(e-u[2*r],2)+tS(n-u[2*r+1],2);if(f=f));)if(e.x=a+i,e.y=l+o,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>s[0]||e.y+e.y1>s[1])&&(!n||!pS(e,t,s[0]))&&(!n||mS(e,n))){for(var g,m=e.sprite,y=e.width>>5,v=s[0]>>5,_=e.x-(y<<4),x=127&_,b=32-x,w=e.y1-e.y0,k=(e.y+e.y0)*v+(_>>5),A=0;A>>x:0);k+=v}return e.sprite=null,!0}return!1}return f.layout=function(){for(var u=function(t){t.width=t.height=1;var e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=(cS<<5)/e,t.height=fS/e;var n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:e}}(Sc()),f=function(t){var e=[],n=-1;for(;++n>5)*s[1]),d=null,p=l.length,g=-1,m=[],y=l.map((s=>({text:t(s),font:e(s),style:r(s),weight:i(s),rotate:o(s),size:~~(n(s)+1e-14),padding:a(s),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:s}))).sort(((t,e)=>e.size-t.size));++g>1,v.y=s[1]*(c()+.5)>>1,dS(u,v,y,g),v.hasText&&h(f,v,d)&&(m.push(v),d?gS(d,v):d=[{x:v.x+v.x0,y:v.y+v.y0},{x:v.x+v.x1,y:v.y+v.y1}],v.x-=s[0]>>1,v.y-=s[1]>>1)}return m},f.words=function(t){return arguments.length?(l=t,f):l},f.size=function(t){return arguments.length?(s=[+t[0],+t[1]],f):s},f.font=function(t){return arguments.length?(e=vS(t),f):e},f.fontStyle=function(t){return arguments.length?(r=vS(t),f):r},f.fontWeight=function(t){return arguments.length?(i=vS(t),f):i},f.rotate=function(t){return arguments.length?(o=vS(t),f):o},f.text=function(e){return arguments.length?(t=vS(e),f):t},f.spiral=function(t){return arguments.length?(u=_S[t]||t,f):u},f.fontSize=function(t){return arguments.length?(n=vS(t),f):n},f.padding=function(t){return arguments.length?(a=vS(t),f):a},f.random=function(t){return arguments.length?(c=t,f):c},f}function dS(t,e,n,r){if(!e.sprite){var i=t.context,o=t.ratio;i.clearRect(0,0,(cS<<5)/o,fS/o);var a,s,u,l,c,f=0,h=0,d=0,p=n.length;for(--r;++r>5<<5,u=~~Math.max(Math.abs(v+_),Math.abs(v-_))}else a=a+31>>5<<5;if(u>d&&(d=u),f+a>=cS<<5&&(f=0,h+=d,d=0),h+u>=fS)break;i.translate((f+(a>>1))/o,(h+(u>>1))/o),e.rotate&&i.rotate(e.rotate*lS),i.fillText(e.text,0,0),e.padding&&(i.lineWidth=2*e.padding,i.strokeText(e.text,0,0)),i.restore(),e.width=a,e.height=u,e.xoff=f,e.yoff=h,e.x1=a>>1,e.y1=u>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,f+=a}for(var b=i.getImageData(0,0,(cS<<5)/o,fS/o).data,w=[];--r>=0;)if((e=n[r]).hasText){for(s=(a=e.width)>>5,u=e.y1-e.y0,l=0;l>5),E=b[(h+c)*(cS<<5)+(f+l)<<2]?1<<31-l%32:0;w[M]|=E,k|=E}k?A=c:(e.y0++,u--,c--,h++)}e.y1=e.y0+A,e.sprite=w.slice(0,(e.y1-e.y0)*s)}}}function pS(t,e,n){n>>=5;for(var r,i=t.sprite,o=t.width>>5,a=t.x-(o<<4),s=127&a,u=32-s,l=t.y1-t.y0,c=(t.y+t.y0)*n+(a>>5),f=0;f>>s:0))&e[c+h])return!0;c+=n}return!1}function gS(t,e){var n=t[0],r=t[1];e.x+e.x0r.x&&(r.x=e.x+e.x1),e.y+e.y1>r.y&&(r.y=e.y+e.y1)}function mS(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0e(t(n))}i.forEach((t=>{t[a[0]]=NaN,t[a[1]]=NaN,t[a[3]]=0}));const c=o.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(l).random(t.random).layout(),f=o.size(),h=f[0]>>1,d=f[1]>>1,p=c.length;for(let t,e,n=0;nnew Uint8Array(t),MS=t=>new Uint16Array(t),ES=t=>new Uint32Array(t);function DS(t,e,n){const r=(e<257?AS:e<65537?MS:ES)(t);return n&&r.set(n),r}function CS(t,e,n){const r=1<{const r=t[e],i=t[n];return ri?1:0})),function(t,e){return Array.from(e,(e=>t[e]))}(t,e)}(h,u),a)l=e,c=t,e=Array(a+s),t=ES(a+s),function(t,e,n,r,i,o,a,s,u){let l,c=0,f=0;for(l=0;c0)for(f=0;ft,size:()=>n}}function SS(t){Xa.call(this,function(){let t=8,e=[],n=ES(0),r=DS(0,t),i=DS(0,t);return{data:()=>e,seen:()=>n=function(t,e,n){return t.length>=e?t:((n=n||new t.constructor(e)).set(t),n)}(n,e.length),add(t){for(let n,r=0,i=e.length,o=t.length;re.length,curr:()=>r,prev:()=>i,reset:t=>i[t]=r[t],all:()=>t<257?255:t<65537?65535:4294967295,set(t,e){r[t]|=e},clear(t,e){r[t]&=~e},resize(e,n){(e>r.length||n>t)&&(t=Math.max(n,t),r=DS(e,t,r),i=DS(e,t))}}}(),t),this._indices=null,this._dims=null}function $S(t){Xa.call(this,null,t)}SS.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},ht(SS,Xa,{transform(t,e){return this._dims?t.modified("fields")||t.fields.some((t=>e.modified(t.fields)))?this.reinit(t,e):this.eval(t,e):this.init(t,e)},init(t,e){const n=t.fields,r=t.query,i=this._indices={},o=this._dims=[],a=r.length;let s,u,l=0;for(;l{const t=i.remove(e,n);for(const e in r)r[e].reindex(t)}))},update(t,e,n){const r=this._dims,i=t.query,o=e.stamp,a=r.length;let s,u,l=0;for(n.filters=0,u=0;ud)for(m=d,y=Math.min(f,p);mp)for(m=Math.max(f,p),y=h;mc)for(d=c,p=Math.min(u,f);df)for(d=Math.max(u,f),p=l;ds[t]&n?null:a[t];return o.filter(o.MOD,l),i&i-1?(o.filter(o.ADD,(t=>{const e=s[t]&n;return!e&&e^u[t]&n?a[t]:null})),o.filter(o.REM,(t=>{const e=s[t]&n;return e&&!(e^e^u[t]&n)?a[t]:null}))):(o.filter(o.ADD,l),o.filter(o.REM,(t=>(s[t]&n)===i?a[t]:null))),o.filter(o.SOURCE,(t=>l(t._index)))}});var TS=Object.freeze({__proto__:null,crossfilter:SS,resolvefilter:$S});const BS="Literal",zS="Property",NS="ArrayExpression",OS="BinaryExpression",RS="CallExpression",LS="ConditionalExpression",US="LogicalExpression",qS="MemberExpression",PS="ObjectExpression",jS="UnaryExpression";function IS(t){this.type=t}var WS,HS,YS,GS,VS;IS.prototype.visit=function(t){let e,n,r;if(t(this))return 1;for(e=function(t){switch(t.type){case NS:return t.elements;case OS:case US:return[t.left,t.right];case RS:return[t.callee].concat(t.arguments);case LS:return[t.test,t.consequent,t.alternate];case qS:return[t.object,t.property];case PS:return t.properties;case zS:return[t.key,t.value];case jS:return[t.argument];default:return[]}}(this),n=0,r=e.length;n",WS[ZS]="Identifier",WS[QS]="Keyword",WS[KS]="Null",WS[t$]="Numeric",WS[e$]="Punctuator",WS[n$]="String",WS[9]="RegularExpression";var r$="ArrayExpression",i$="BinaryExpression",o$="CallExpression",a$="ConditionalExpression",s$="Identifier",u$="Literal",l$="LogicalExpression",c$="MemberExpression",f$="ObjectExpression",h$="Property",d$="UnaryExpression",p$="Unexpected token %0",g$="Unexpected number",m$="Unexpected string",y$="Unexpected identifier",v$="Unexpected reserved word",_$="Unexpected end of input",x$="Invalid regular expression",b$="Invalid regular expression: missing /",w$="Octal literals are not allowed in strict mode.",k$="Duplicate data property in object literal not allowed in strict mode",A$="ILLEGAL",M$="Disabled.",E$=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),D$=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function C$(t,e){if(!t)throw new Error("ASSERT: "+e)}function F$(t){return t>=48&&t<=57}function S$(t){return"0123456789abcdefABCDEF".includes(t)}function $$(t){return"01234567".includes(t)}function T$(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(t)}function B$(t){return 10===t||13===t||8232===t||8233===t}function z$(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&E$.test(String.fromCharCode(t))}function N$(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&D$.test(String.fromCharCode(t))}const O$={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function R$(){for(;YS1114111||"}"!==t)&&tT({},p$,A$),e<=65535?String.fromCharCode(e):(n=55296+(e-65536>>10),r=56320+(e-65536&1023),String.fromCharCode(n,r))}function q$(){var t,e;for(t=HS.charCodeAt(YS++),e=String.fromCharCode(t),92===t&&(117!==HS.charCodeAt(YS)&&tT({},p$,A$),++YS,(t=L$("u"))&&"\\"!==t&&z$(t.charCodeAt(0))||tT({},p$,A$),e=t);YS>>="===(r=HS.substr(YS,4))?{type:e$,value:r,start:i,end:YS+=4}:">>>"===(n=r.substr(0,3))||"<<="===n||">>="===n?{type:e$,value:n,start:i,end:YS+=3}:a===(e=n.substr(0,2))[1]&&"+-<>&|".includes(a)||"=>"===e?{type:e$,value:e,start:i,end:YS+=2}:("//"===e&&tT({},p$,A$),"<>=!+-*%&|^/".includes(a)?(++YS,{type:e$,value:a,start:i,end:YS}):void tT({},p$,A$))}function I$(){var t,e,n;if(C$(F$((n=HS[YS]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),e=YS,t="","."!==n){if(t=HS[YS++],n=HS[YS],"0"===t){if("x"===n||"X"===n)return++YS,function(t){let e="";for(;YS=0&&tT({},x$,n),{value:n,literal:e}}(),r=function(t,e){let n=t;e.includes("u")&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((t,e)=>{if(parseInt(e,16)<=1114111)return"x";tT({},x$)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(t){tT({},x$)}try{return new RegExp(t,e)}catch(t){return null}}(e.value,n.value),{literal:e.literal+n.literal,value:r,regex:{pattern:e.value,flags:n.value},start:t,end:YS}}function H$(){if(R$(),YS>=GS)return{type:JS,start:YS,end:YS};const t=HS.charCodeAt(YS);return z$(t)?P$():40===t||41===t||59===t?j$():39===t||34===t?function(){var t,e,n,r,i="",o=!1;for(C$("'"===(t=HS[YS])||'"'===t,"String literal must starts with a quote"),e=YS,++YS;YS(C$(e":case"<=":case">=":case"instanceof":case"in":e=7;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11}return e}function yT(){var t,e;return t=function(){var t,e,n,r,i,o,a,s,u,l;if(t=VS,u=gT(),0===(i=mT(r=VS)))return u;for(r.prec=i,Y$(),e=[t,VS],o=[u,r,a=gT()];(i=mT(VS))>0;){for(;o.length>2&&i<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,u=o.pop(),e.pop(),n=V$(s,u,a),o.push(n);(r=Y$()).prec=i,o.push(r),e.push(VS),n=gT(),o.push(n)}for(n=o[l=o.length-1],e.pop();l>1;)e.pop(),n=V$(o[l-1].value,o[l-2],n),l-=2;return n}(),rT("?")&&(Y$(),e=yT(),nT(":"),t=function(t,e,n){const r=new IS(a$);return r.test=t,r.consequent=e,r.alternate=n,r}(t,e,yT())),t}function vT(){const t=yT();if(rT(","))throw new Error(M$);return t}function _T(t){YS=0,GS=(HS=t).length,VS=null,G$();const e=vT();if(VS.type!==JS)throw new Error("Unexpect token after expression.");return e}var xT={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function bT(t){function e(e,n,r){return i=>function(e,n,r,i){let o=t(n[0]);return r&&(o=r+"("+o+")",0===r.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+e+(i<0?"":0===i?"()":"("+n.slice(1).map(t).join(",")+")")}(e,i,n,r)}const n="new Date",r="String",i="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(e){e.length<3&&s("Missing arguments to clamp function."),e.length>3&&s("Too many arguments to clamp function.");const n=e.map(t);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:e("getDate",n,0),day:e("getDay",n,0),year:e("getFullYear",n,0),month:e("getMonth",n,0),hours:e("getHours",n,0),minutes:e("getMinutes",n,0),seconds:e("getSeconds",n,0),milliseconds:e("getMilliseconds",n,0),time:e("getTime",n,0),timezoneoffset:e("getTimezoneOffset",n,0),utcdate:e("getUTCDate",n,0),utcday:e("getUTCDay",n,0),utcyear:e("getUTCFullYear",n,0),utcmonth:e("getUTCMonth",n,0),utchours:e("getUTCHours",n,0),utcminutes:e("getUTCMinutes",n,0),utcseconds:e("getUTCSeconds",n,0),utcmilliseconds:e("getUTCMilliseconds",n,0),length:e("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:e("toUpperCase",r,0),lower:e("toLowerCase",r,0),substring:e("substring",r),split:e("split",r),trim:e("trim",r,0),btoa:"btoa",atob:"atob",regexp:i,test:e("test",i),if:function(e){e.length<3&&s("Missing arguments to if function."),e.length>3&&s("Too many arguments to if function.");const n=e.map(t);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function wT(t){const e=(t=t||{}).allowed?Tt(t.allowed):{},n=t.forbidden?Tt(t.forbidden):{},r=t.constants||xT,i=(t.functions||bT)(h),o=t.globalvar,a=t.fieldvar,u=J(o)?o:t=>`${o}["${t}"]`;let l={},c={},f=0;function h(t){if(_t(t))return t;const e=d[t.type];return null==e&&s("Unsupported type: "+t.type),e(t)}const d={Literal:t=>t.raw,Identifier:t=>{const i=t.name;return f>0?i:ut(n,i)?s("Illegal identifier: "+i):ut(r,i)?r[i]:ut(e,i)?i:(l[i]=1,u(i))},MemberExpression:t=>{const e=!t.computed,n=h(t.object);e&&(f+=1);const r=h(t.property);return n===a&&(c[function(t){const e=t&&t.length-1;return e&&('"'===t[0]&&'"'===t[e]||"'"===t[0]&&"'"===t[e])?t.slice(1,-1):t}(r)]=1),e&&(f-=1),n+(e?"."+r:"["+r+"]")},CallExpression:t=>{"Identifier"!==t.callee.type&&s("Illegal callee type: "+t.callee.type);const e=t.callee.name,n=t.arguments,r=ut(i,e)&&i[e];return r||s("Unrecognized function: "+e),J(r)?r(n):r+"("+n.map(h).join(",")+")"},ArrayExpression:t=>"["+t.elements.map(h).join(",")+"]",BinaryExpression:t=>"("+h(t.left)+" "+t.operator+" "+h(t.right)+")",UnaryExpression:t=>"("+t.operator+h(t.argument)+")",ConditionalExpression:t=>"("+h(t.test)+"?"+h(t.consequent)+":"+h(t.alternate)+")",LogicalExpression:t=>"("+h(t.left)+t.operator+h(t.right)+")",ObjectExpression:t=>"{"+t.properties.map(h).join(",")+"}",Property:t=>{f+=1;const e=h(t.key);return f-=1,e+":"+h(t.value)}};function p(t){const e={code:h(t),globals:Object.keys(l),fields:Object.keys(c)};return l={},c={},e}return p.functions=i,p.constants=r,p}const kT=Symbol("vega_selection_getter");function AT(t){return t.getter&&t.getter[kT]||(t.getter=l(t.field),t.getter[kT]=!0),t.getter}const MT="intersect",ET="union",DT="_vgsid_",CT=l(DT),FT="E",ST="R",$T="R-E",TT="R-LE",BT="R-RE",zT="E-LT",NT="E-LTE",OT="E-GT",RT="E-GTE",LT="E-VALID",UT="E-ONE",qT="index:unit";function PT(t,e){for(var n,r,i=e.fields,o=e.values,a=i.length,s=0;s=o[s])return!1}else if(r.type===NT){if(n>o[s])return!1}else if(r.type===OT){if(n<=o[s])return!1}else if(r.type===RT){if(n1?e-1:0),r=1;re.includes(t))):e},R_union:function(t,e){var n=S(e[0]),r=S(e[1]);return n>r&&(n=e[1],r=e[0]),t.length?(t[0]>n&&(t[0]=n),t[1]r&&(n=e[1],r=e[0]),t.length?rr&&(t[1]=r),t):[n,r]}};function YT(t,e,n,r){e[0].type!==BS&&s("First argument to selection functions must be a string literal.");const i=e[0].value,o="unit",a="@"+o,u=":"+i;(e.length>=2&&F(e).value)!==MT||ut(r,a)||(r[a]=n.getData(i).indataRef(n,o)),ut(r,u)||(r[u]=n.getData(i).tuplesRef())}function GT(t){const e=this.context.data[t];return e?e.values.value:[]}const VT=t=>function(e,n){const r=this.context.dataflow.locale();return null===e?"null":r[t](n)(e)},XT=VT("format"),JT=VT("timeFormat"),ZT=VT("utcFormat"),QT=VT("timeParse"),KT=VT("utcParse"),tB=new Date(2e3,0,1);function eB(t,e,n){return Number.isInteger(t)&&Number.isInteger(e)?(tB.setYear(2e3),tB.setMonth(t),tB.setDate(e),JT.call(this,tB,n)):""}const nB="%",rB="$";function iB(t,e,n,r){e[0].type!==BS&&s("First argument to data functions must be a string literal.");const i=e[0].value,o=":"+i;if(!ut(o,r))try{r[o]=n.getData(i).tuplesRef()}catch(t){}}function oB(t,e,n,r){if(e[0].type===BS)aB(n,r,e[0].value);else for(t in n.scales)aB(n,r,t)}function aB(t,e,n){const r=nB+n;if(!ut(e,r))try{e[r]=t.scaleRef(n)}catch(t){}}function sB(t,e){if(_t(t)){const n=e.scales[t];return n&&op(n.value)?n.value:void 0}if(J(t))return op(t)?t:void 0}function uB(t,e,n){e.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,n._bandwidth=oB,n._range=oB,n._scale=oB;const r=e=>"_["+(e.type===BS?Dt(nB+e.value):Dt(nB)+"+"+t(e))+"]";return{_bandwidth:t=>`this.__bandwidth(${r(t[0])})`,_range:t=>`${r(t[0])}.range()`,_scale:e=>`${r(e[0])}(${t(e[1])})`}}function lB(t,e){return function(n,r,i){if(n){const e=sB(n,(i||this).context);return e&&e.path[t](r)}return e(r)}}const cB=lB("area",(function(t){return Tw=new ae,pw(t,Bw),2*Tw})),fB=lB("bounds",(function(t){var e,n,r,i,o,a,s;if(kw=ww=-(xw=bw=1/0),Fw=[],pw(t,sk),n=Fw.length){for(Fw.sort(mk),e=1,o=[r=Fw[0]];egk(r[0],r[1])&&(r[1]=i[1]),gk(i[0],r[1])>gk(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=0,r=o[n=o.length-1];e<=n;r=i,++e)i=o[e],(s=gk(r[1],i[0]))>a&&(a=s,xw=i[0],ww=r[1])}return Fw=Sw=null,xw===1/0||bw===1/0?[[NaN,NaN],[NaN,NaN]]:[[xw,bw],[ww,kw]]})),hB=lB("centroid",(function(t){Hw=Yw=Gw=Vw=Xw=Jw=Zw=Qw=0,Kw=new ae,tk=new ae,ek=new ae,pw(t,vk);var e=+Kw,n=+tk,r=+ek,i=Kb(e,n,r);return iyB(t,e)}const _B={};function xB(t){return k(t)||ArrayBuffer.isView(t)?t:null}function bB(t){return xB(t)||(_t(t)?t:null)}const wB=t=>t.data;function kB(t,e){const n=GT.call(e,t);return n.root&&n.root.lookup||{}}const AB=()=>"undefined"!=typeof window&&window||null;function MB(t,e,n){if(!t)return[];const[r,i]=t,o=(new Vg).set(r[0],r[1],i[0],i[1]);return B_(n||this.context.dataflow.scenegraph().root,o,function(t){let e=null;if(t){const n=V(t.marktype),r=V(t.markname);e=t=>(!n.length||n.some((e=>t.marktype===e)))&&(!r.length||r.some((e=>t.name===e)))}return e}(e))}const EB={random:()=>t.random(),cumulativeNormal:fs,cumulativeLogNormal:ys,cumulativeUniform:ks,densityNormal:cs,densityLogNormal:ms,densityUniform:ws,quantileNormal:hs,quantileLogNormal:vs,quantileUniform:As,sampleNormal:ls,sampleLogNormal:gs,sampleUniform:bs,isArray:k,isBoolean:pt,isDate:gt,isDefined:t=>void 0!==t,isNumber:yt,isObject:A,isRegExp:vt,isString:_t,isTuple:ga,isValid:t=>null!=t&&t==t,toBoolean:Ct,toDate:t=>St(t),toNumber:S,toString:$t,indexof:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;rat(t),inScope:function(t){const e=this.context.group;let n=!1;if(e)for(;t;){if(t===e){n=!0;break}t=t.mark.group}return n},intersect:MB,clampRange:X,pinchDistance:function(t){const e=t.touches,n=e[0].clientX-e[1].clientX,r=e[0].clientY-e[1].clientY;return Math.hypot(n,r)},pinchAngle:function(t){const e=t.touches;return Math.atan2(e[0].clientY-e[1].clientY,e[0].clientX-e[1].clientX)},screen:function(){const t=AB();return t?t.screen:{}},containerSize:function(){const t=this.context.dataflow,e=t.container&&t.container();return e?[e.clientWidth,e.clientHeight]:[void 0,void 0]},windowSize:function(){const t=AB();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]},bandspace:function(t,e,n){return Sd(t||0,e||0,n||0)},setdata:function(t,e){const n=this.context.dataflow,r=this.context.data[t].input;return n.pulse(r,n.changeset().remove(p).insert(e)),1},pathShape:function(t){let e=null;return function(n){return n?yg(n,e=e||ag(t)):t}},panLinear:R,panLog:L,panPow:U,panSymlog:q,zoomLinear:j,zoomLog:I,zoomPow:W,zoomSymlog:H,encode:function(t,e,n){if(t){const n=this.context.dataflow,r=t.mark.source;n.pulse(r,n.changeset().encode(t,e))}return void 0!==n?n:t},modify:function(t,e,n,r,i,o){const a=this.context.dataflow,s=this.context.data[t],u=s.input,l=a.stamp();let c,f,h=s.changes;if(!1===a._trigger||!(u.value.length||e||r))return 0;if((!h||h.stamp{s.modified=!0,a.pulse(u,h).run()}),!0,1)),n&&(c=!0===n?p:k(n)||ga(n)?n:vB(n),h.remove(c)),e&&h.insert(e),r&&(c=vB(r),u.value.some(c)?h.remove(c):h.insert(r)),i)for(f in o)h.modify(i,f,o[f]);return 1},lassoAppend:function(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const i=(t=V(t))[t.length-1];return void 0===i||Math.hypot(i[0]-e,i[1]-n)>r?[...t,[e,n]]:t},lassoPath:function(t){return V(t).reduce(((e,n,r)=>{let[i,o]=n;return e+(0==r?`M ${i},${o} `:r===t.length-1?" Z":`L ${i},${o} `)}),"")},intersectLasso:function(t,e,n){const{x:r,y:i,mark:o}=n,a=(new Vg).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[t,n]of e)ta.x2&&(a.x2=t),na.y2&&(a.y2=n);return a.translate(r,i),MB([[a.x1,a.y1],[a.x2,a.y2]],t,o).filter((t=>function(t,e,n){let r=0;for(let i=0,o=n.length-1;ie!=s>e&&t<(a-u)*(e-l)/(s-l)+u&&r++}return 1&r}(t.x,t.y,e)))}},DB=["view","item","group","xy","x","y"],CB="this.",FB={},SB={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>`_[${Dt(rB+t)}]`,functions:function(t){const e=bT(t);DB.forEach((t=>e[t]="event.vega."+t));for(const t in EB)e[t]=CB+t;return ot(e,uB(t,EB,FB)),e},constants:xT,visitors:FB},$B=wT(SB);function TB(t,e,n){return 1===arguments.length?EB[t]:(EB[t]=e,n&&(FB[t]=n),$B&&($B.functions[t]=CB+t),this)}function BB(t,e){const n={};let r;try{r=_T(t=_t(t)?t:Dt(t)+"")}catch(e){s("Expression parse error: "+t)}r.visit((t=>{if(t.type!==RS)return;const r=t.callee.name,i=SB.visitors[r];i&&i(r,t.arguments,e,n)}));const i=$B(r);return i.globals.forEach((t=>{const r=rB+t;!ut(n,r)&&e.getSignal(t)&&(n[r]=e.signalRef(t))})),{$expr:ot({code:i.code},e.options.ast?{ast:r}:null),$fields:i.fields,$params:n}}TB("bandwidth",(function(t,e){const n=sB(t,(e||this).context);return n&&n.bandwidth?n.bandwidth():0}),oB),TB("copy",(function(t,e){const n=sB(t,(e||this).context);return n?n.copy():void 0}),oB),TB("domain",(function(t,e){const n=sB(t,(e||this).context);return n?n.domain():[]}),oB),TB("range",(function(t,e){const n=sB(t,(e||this).context);return n&&n.range?n.range():[]}),oB),TB("invert",(function(t,e,n){const r=sB(t,(n||this).context);return r?k(e)?(r.invertRange||r.invert)(e):(r.invert||r.invertExtent)(e):void 0}),oB),TB("scale",(function(t,e,n){const r=sB(t,(n||this).context);return r?r(e):void 0}),oB),TB("gradient",(function(t,e,n,r,i){t=sB(t,(i||this).context);const o=Qp(e,n);let a=t.domain(),s=a[0],u=F(a),l=f;return u-s?l=_p(t,s,u):t=(t.interpolator?ap("sequential")().interpolator(t.interpolator()):ap("linear")().interpolate(t.interpolate()).range(t.range())).domain([s=0,u=1]),t.ticks&&(a=t.ticks(+r||15),s!==a[0]&&a.unshift(s),u!==F(a)&&a.push(u)),a.forEach((e=>o.stop(l(e),t(e)))),o}),oB),TB("geoArea",cB,oB),TB("geoBounds",fB,oB),TB("geoCentroid",hB,oB),TB("geoShape",(function(t,e,n){const r=sB(t,(n||this).context);return function(t){return r?r.path.context(t)(e):""}}),oB),TB("geoScale",(function(t,e){const n=sB(t,(e||this).context);return n&&n.scale()}),oB),TB("indata",(function(t,e,n){const r=this.context.data[t]["index:"+e],i=r?r.value.get(n):void 0;return i?i.count:i}),(function(t,e,n,r){e[0].type!==BS&&s("First argument to indata must be a string literal."),e[1].type!==BS&&s("Second argument to indata must be a string literal.");const i=e[0].value,o=e[1].value,a="@"+o;ut(a,r)||(r[a]=n.getData(i).indataRef(n,o))})),TB("data",GT,iB),TB("treePath",(function(t,e,n){const r=kB(t,this),i=r[e],o=r[n];return i&&o?i.path(o).map(wB):void 0}),iB),TB("treeAncestors",(function(t,e){const n=kB(t,this)[e];return n?n.ancestors().map(wB):void 0}),iB),TB("vlSelectionTest",(function(t,e,n){for(var r,i,o,a,s,u=this.context.data[t],l=u?u.values.value:[],c=u?u[qT]&&u[qT].value:void 0,f=n===MT,h=l.length,d=0;d(t[o[n].field]=e,t)),{}))}else u=DT,l=CT(i),(f=(c=v[u]||(v[u]={}))[s]||(c[s]=[])).push(l),n&&(f=_[s]||(_[s]=[])).push({[DT]:l});if(e=e||ET,v[DT]?v[DT]=HT[`${DT}_${e}`](...Object.values(v[DT])):Object.keys(v).forEach((t=>{v[t]=Object.keys(v[t]).map((e=>v[t][e])).reduce(((n,r)=>void 0===n?r:HT[`${x[t]}_${e}`](n,r)))})),y=Object.keys(_),n&&y.length){v[r?"vlPoint":"vlMulti"]=e===ET?{or:y.reduce(((t,e)=>(t.push(..._[e]),t)),[])}:{and:y.map((t=>({or:_[t]})))}}return v}),YT),TB("vlSelectionTuples",(function(t,e){return t.map((t=>ot(e.fields?{values:e.fields.map((e=>AT(e)(t.datum)))}:{[DT]:CT(t.datum)},e)))}));const zB=Tt(["rule"]),NB=Tt(["group","image","rect"]);function OB(t){return(t+"").toLowerCase()}function RB(t,e,n){n.endsWith(";")||(n="return("+n+");");const r=Function(...e.concat(n));return t&&t.functions?r.bind(t.functions):r}var LB={operator:(t,e)=>RB(t,["_"],e.code),parameter:(t,e)=>RB(t,["datum","_"],e.code),event:(t,e)=>RB(t,["event"],e.code),handler:(t,e)=>RB(t,["_","event"],`var datum=event.item&&event.item.datum;return ${e.code};`),encode:(t,e)=>{const{marktype:n,channels:r}=e;let i="var o=item,datum=o.datum,m=0,$;";for(const t in r){const e="o["+Dt(t)+"]";i+=`$=${r[t].code};if(${e}!==$)${e}=$,m=1;`}return i+=function(t,e){let n="";return zB[e]||(t.x2&&(t.x?(NB[e]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),t.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(NB[e]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),t.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(r,n),i+="return m;",RB(t,["item","_"],i)},codegen:{get(t){const e=`[${t.map(Dt).join("][")}]`,n=Function("_",`return _${e};`);return n.path=e,n},comparator(t,e){let n;const r=Function("a","b","var u, v; return "+t.map(((t,r)=>{const i=e[r];let o,a;return t.path?(o=`a${t.path}`,a=`b${t.path}`):((n=n||{})["f"+r]=t,o=`this.f${r}(a)`,a=`this.f${r}(b)`),function(t,e,n,r){return`((u = ${t}) < (v = ${e}) || u == null) && v != null ? ${n}\n : (u > v || v == null) && u != null ? ${r}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}\n : v !== v && u === u ? ${r} : `}(o,a,-i,i)})).join("")+"0;");return n?r.bind(n):r}}};function UB(t,e,n){if(!t||!A(t))return t;for(let r,i=0,o=qB.length;it&&t.$tupleid?ma:t));return e.fn[n]||(e.fn[n]=Q(r,t.$order,e.expr.codegen))}},{key:"$context",parse:function(t,e){return e}},{key:"$subflow",parse:function(t,e){const n=t.$subflow;return function(t,r,i){const o=e.fork().parse(n),a=o.get(n.operators[0].id),s=o.signals.parent;return s&&s.set(i),a.detachSubflow=()=>e.detach(o),a}}},{key:"$tupleid",parse:function(){return ma}}];const PB={skip:!0};function jB(t,e,n,r){return new IB(t,e,n,r)}function IB(t,e,n,r){this.dataflow=t,this.transforms=e,this.events=t.events.bind(t),this.expr=r||LB,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function WB(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.events=t.events,this.expr=t.expr,this.signals=Object.create(t.signals),this.scales=Object.create(t.scales),this.nodes=Object.create(t.nodes),this.data=Object.create(t.data),this.fn=Object.create(t.fn),t.functions&&(this.functions=Object.create(t.functions),this.functions.context=this)}function HB(t,e){t&&(null==e?t.removeAttribute("aria-label"):t.setAttribute("aria-label",e))}IB.prototype=WB.prototype={fork(){const t=new WB(this);return(this.subcontext||(this.subcontext=[])).push(t),t},detach(t){this.subcontext=this.subcontext.filter((e=>e!==t));const e=Object.keys(t.nodes);for(const n of e)t.nodes[n]._targets=null;for(const n of e)t.nodes[n].detach();t.nodes=null},get(t){return this.nodes[t]},set(t,e){return this.nodes[t]=e},add(t,e){const n=this,r=n.dataflow,i=t.value;if(n.set(t.id,e),function(t){return"collect"===OB(t)}(t.type)&&i&&(i.$ingest?r.ingest(e,i.$ingest,i.$format):i.$request?r.preload(e,i.$request,i.$format):r.pulse(e,r.changeset().insert(i))),t.root&&(n.root=e),t.parent){let i=n.get(t.parent.$ref);i?(r.connect(i,[e]),e.targets().add(i)):(n.unresolved=n.unresolved||[]).push((()=>{i=n.get(t.parent.$ref),r.connect(i,[e]),e.targets().add(i)}))}if(t.signal&&(n.signals[t.signal]=e),t.scale&&(n.scales[t.scale]=e),t.data)for(const r in t.data){const i=n.data[r]||(n.data[r]={});t.data[r].forEach((t=>i[t]=e))}},resolve(){return(this.unresolved||[]).forEach((t=>t())),delete this.unresolved,this},operator(t,e){this.add(t,this.dataflow.add(t.value,e))},transform(t,e){this.add(t,this.dataflow.add(this.transforms[OB(e)]))},stream(t,e){this.set(t.id,e)},update(t,e,n,r,i){this.dataflow.on(e,n,r,i,t.options)},operatorExpression(t){return this.expr.operator(this,t)},parameterExpression(t){return this.expr.parameter(this,t)},eventExpression(t){return this.expr.event(this,t)},handlerExpression(t){return this.expr.handler(this,t)},encodeExpression(t){return this.expr.encode(this,t)},parse:function(t){const e=this,n=t.operators||[];return t.background&&(e.background=t.background),t.eventConfig&&(e.eventConfig=t.eventConfig),t.locale&&(e.locale=t.locale),n.forEach((t=>e.parseOperator(t))),n.forEach((t=>e.parseOperatorParameters(t))),(t.streams||[]).forEach((t=>e.parseStream(t))),(t.updates||[]).forEach((t=>e.parseUpdate(t))),e.resolve()},parseOperator:function(t){const e=this;!function(t){return"operator"===OB(t)}(t.type)&&t.type?e.transform(t,t.type):e.operator(t,t.update?e.operatorExpression(t.update):null)},parseOperatorParameters:function(t){const e=this;if(t.params){const n=e.get(t.id);n||s("Invalid operator id: "+t.id),e.dataflow.connect(n,n.parameters(e.parseParameters(t.params),t.react,t.initonly))}},parseParameters:function(t,e){e=e||{};const n=this;for(const r in t){const i=t[r];e[r]=k(i)?i.map((t=>UB(t,n,e))):UB(i,n,e)}return e},parseStream:function(t){var e,n=this,r=null!=t.filter?n.eventExpression(t.filter):void 0,i=null!=t.stream?n.get(t.stream):void 0;t.source?i=n.events(t.source,t.type,r):t.merge&&(i=(e=t.merge.map((t=>n.get(t))))[0].merge.apply(e[0],e.slice(1))),t.between&&(e=t.between.map((t=>n.get(t))),i=i.between(e[0],e[1])),t.filter&&(i=i.filter(r)),null!=t.throttle&&(i=i.throttle(+t.throttle)),null!=t.debounce&&(i=i.debounce(+t.debounce)),null==i&&s("Invalid stream definition: "+JSON.stringify(t)),t.consume&&i.consume(!0),n.stream(t,i)},parseUpdate:function(t){var e,n=this,r=A(r=t.source)?r.$ref:r,i=n.get(r),o=t.update,a=void 0;i||s("Source not defined: "+t.source),e=t.target&&t.target.$expr?n.eventExpression(t.target.$expr):n.get(t.target),o&&o.$expr&&(o.$params&&(a=n.parseParameters(o.$params)),o=n.handlerExpression(o.$expr)),n.update(t,i,e,o,a)},getState:function(t){var e=this,n={};if(t.signals){var r=n.signals={};Object.keys(e.signals).forEach((n=>{const i=e.signals[n];t.signals(n,i)&&(r[n]=i.value)}))}if(t.data){var i=n.data={};Object.keys(e.data).forEach((n=>{const r=e.data[n];t.data(n,r)&&(i[n]=r.input.value)}))}return e.subcontext&&!1!==t.recurse&&(n.subcontext=e.subcontext.map((e=>e.getState(t)))),n},setState:function(t){var e=this,n=e.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach((t=>{n.update(e.signals[t],i[t],PB)})),Object.keys(r||{}).forEach((t=>{n.pulse(e.data[t].input,n.changeset().remove(p).insert(r[t]))})),(t.subcontext||[]).forEach(((t,n)=>{const r=e.subcontext[n];r&&r.setState(t)}))}};const YB="default";function GB(t,e){const n=t.globalCursor()?"undefined"!=typeof document&&document.body:t.container();if(n)return null==e?n.style.removeProperty("cursor"):n.style.cursor=e}function VB(t,e){var n=t._runtime.data;return ut(n,e)||s("Unrecognized data set: "+e),n[e]}function XB(t,e){ka(e)||s("Second argument to changes must be a changeset.");const n=VB(this,t);return n.modified=!0,this.pulse(n.input,e)}function JB(t){var e=t.padding();return Math.max(0,t._viewWidth+e.left+e.right)}function ZB(t){var e=t.padding();return Math.max(0,t._viewHeight+e.top+e.bottom)}function QB(t){var e=t.padding(),n=t._origin;return[e.left+n[0],e.top+n[1]]}function KB(t,e,n){var r,i,o=t._renderer,a=o&&o.canvas();return a&&(i=QB(t),(r=av(e.changedTouches?e.changedTouches[0]:e,a))[0]-=i[0],r[1]-=i[1]),e.dataflow=t,e.item=n,e.vega=function(t,e,n){const r=e?"group"===e.mark.marktype?e:e.mark.group:null;function i(t){var n,i=r;if(t)for(n=e;n;n=n.mark.group)if(n.mark.name===t){i=n;break}return i&&i.mark&&i.mark.interactive?i:{}}function o(t){if(!t)return n;_t(t)&&(t=i(t));const e=n.slice();for(;t;)e[0]-=t.x||0,e[1]-=t.y||0,t=t.mark&&t.mark.group;return e}return{view:rt(t),item:rt(e||{}),group:i,xy:o,x:t=>o(t)[0],y:t=>o(t)[1]}}(t,n,r),e}const tz="view",ez={trap:!1};function nz(t,e,n,r){t._eventListeners.push({type:n,sources:V(e),handler:r})}function rz(t,e,n){const r=t._eventConfig&&t._eventConfig[e];return!(!1===r||A(r)&&!r[n])||(t.warn(`Blocked ${e} ${n} event listener.`),!1)}function iz(t){return t.item}function oz(t){return t.item.mark.source}function az(t){return function(e,n){return n.vega.view().changeset().encode(n.item,t)}}function sz(t,e,n){const r=document.createElement(t);for(const t in e)r.setAttribute(t,e[t]);return null!=n&&(r.textContent=n),r}const uz="vega-bind",lz="vega-bind-name",cz="vega-bind-radio";function fz(t,e,n,r){const i=n.event||"input",o=()=>t.update(e.value);r.signal(n.signal,e.value),e.addEventListener(i,o),nz(r,e,i,o),t.set=t=>{e.value=t,e.dispatchEvent(function(t){return"undefined"!=typeof Event?new Event(t):{type:t}}(i))}}function hz(t,e,n,r){const i=r.signal(n.signal),o=sz("div",{class:uz}),a="radio"===n.input?o:o.appendChild(sz("label"));a.appendChild(sz("span",{class:lz},n.name||n.signal)),e.appendChild(o);let s=dz;switch(n.input){case"checkbox":s=pz;break;case"select":s=gz;break;case"radio":s=mz;break;case"range":s=yz}s(t,a,n,i)}function dz(t,e,n,r){const i=sz("input");for(const t in n)"signal"!==t&&"element"!==t&&i.setAttribute("input"===t?"type":t,n[t]);i.setAttribute("name",n.signal),i.value=r,e.appendChild(i),i.addEventListener("input",(()=>t.update(i.value))),t.elements=[i],t.set=t=>i.value=t}function pz(t,e,n,r){const i={type:"checkbox",name:n.signal};r&&(i.checked=!0);const o=sz("input",i);e.appendChild(o),o.addEventListener("change",(()=>t.update(o.checked))),t.elements=[o],t.set=t=>o.checked=!!t||null}function gz(t,e,n,r){const i=sz("select",{name:n.signal}),o=n.labels||[];n.options.forEach(((t,e)=>{const n={value:t};vz(t,r)&&(n.selected=!0),i.appendChild(sz("option",n,(o[e]||t)+""))})),e.appendChild(i),i.addEventListener("change",(()=>{t.update(n.options[i.selectedIndex])})),t.elements=[i],t.set=t=>{for(let e=0,r=n.options.length;e{const s={type:"radio",name:n.signal,value:e};vz(e,r)&&(s.checked=!0);const u=sz("input",s);u.addEventListener("change",(()=>t.update(e)));const l=sz("label",{},(o[a]||e)+"");return l.prepend(u),i.appendChild(l),u})),t.set=e=>{const n=t.elements,r=n.length;for(let t=0;t{u.textContent=s.value,t.update(+s.value)};s.addEventListener("input",l),s.addEventListener("change",l),t.elements=[s],t.set=t=>{s.value=t,u.textContent=t}}function vz(t,e){return t===e||t+""==e+""}function _z(t,e,n,r,i,o){return(e=e||new r(t.loader())).initialize(n,JB(t),ZB(t),QB(t),i,o).background(t.background())}function xz(t,e){return e?function(){try{e.apply(this,arguments)}catch(e){t.error(e)}}:null}function bz(t,e,n){if("string"==typeof e){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(e=document.querySelector(e)))return t.error("Signal bind element not found: "+e),null}if(e&&n)try{e.textContent=""}catch(n){e=null,t.error(n)}return e}const wz=t=>+t||0;function kz(t){return A(t)?{top:wz(t.top),bottom:wz(t.bottom),left:wz(t.left),right:wz(t.right)}:(t=>({top:t,bottom:t,left:t,right:t}))(wz(t))}async function Az(t,e,n,r){const i=T_(e),o=i&&i.headless;return o||s("Unrecognized renderer type: "+e),await t.runAsync(),_z(t,null,null,o,n,r).renderAsync(t._scenegraph.root)}var Mz="width",Ez="height",Dz="padding",Cz={skip:!0};function Fz(t,e){var n=t.autosize(),r=t.padding();return e-(n&&n.contains===Dz?r.left+r.right:0)}function Sz(t,e){var n=t.autosize(),r=t.padding();return e-(n&&n.contains===Dz?r.top+r.bottom:0)}function $z(t,e){return e.modified&&k(e.input.value)&&!t.startsWith("_:vega:_")}function Tz(t,e){return!("parent"===t||e instanceof Ja.proxy)}function Bz(t,e,n,r){const i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":k(t)?zz(t):A(t)&&!gt(t)?(e=t,Object.keys(e).map((t=>{const n=e[t];return t+": "+(k(n)?zz(n):Nz(n))})).join("\n")):t+"";var e}(r))}function zz(t){return"["+t.map(Nz).join(", ")+"]"}function Nz(t){return k(t)?"[…]":A(t)&&!gt(t)?"{…}":t}function Oz(t,e){const n=this;if(e=e||{},Ga.call(n),e.loader&&n.loader(e.loader),e.logger&&n.logger(e.logger),null!=e.logLevel&&n.logLevel(e.logLevel),e.locale||t.locale){const r=ot({},t.locale,e.locale);n.locale(Oo(r.number,r.time))}n._el=null,n._elBind=null,n._renderType=e.renderer||S_.Canvas,n._scenegraph=new Ky;const r=n._scenegraph.root;n._renderer=null,n._tooltip=e.tooltip||Bz,n._redraw=!0,n._handler=(new Sv).scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(t){const e=ot({defaults:{}},t),n=(t,e)=>{e.forEach((e=>{k(t[e])&&(t[e]=Tt(t[e]))}))};return n(e.defaults,["prevent","allow"]),n(e,["view","window","selector"]),e}(t.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const i=function(t,e,n){return jB(t,Ja,EB,n).parse(e)}(n,t,e.expr);n._runtime=i,n._signals=i.signals,n._bind=(t.bindings||[]).map((t=>({state:null,param:ot({},t)}))),i.root&&i.root.set(r),r.source=i.data.root.input,n.pulse(i.data.root.input,n.changeset().insert(r.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=Fz(n,n._width),n._viewHeight=Sz(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(t){var e=t._signals,n=e[Mz],r=e[Ez],i=e[Dz];function o(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,(e=>{t._width=e.size,t._viewWidth=Fz(t,e.size),o()}),{size:n}),t._resizeHeight=t.add(null,(e=>{t._height=e.size,t._viewHeight=Sz(t,e.size),o()}),{size:r});const a=t.add(null,o,{pad:i});t._resizeWidth.rank=n.rank+1,t._resizeHeight.rank=r.rank+1,a.rank=i.rank+1}(n),function(t){t.add(null,(e=>(t._background=e.bg,t._resize=1,e.bg)),{bg:t._signals.background})}(n),function(t){const e=t._signals.cursor||(t._signals.cursor=t.add({user:YB,item:null}));t.on(t.events("view","pointermove"),e,((t,n)=>{const r=e.value,i=r?_t(r)?r:r.user:YB,o=n.item&&n.item.cursor||null;return r&&i===r.user&&o==r.item?r:{user:i,item:o}})),t.add(null,(function(e){let n=e.cursor,r=this.value;return _t(n)||(r=n.item,n=n.user),GB(t,n&&n!==YB?n:r||n),r}),{cursor:e})}(n),n.description(t.description),e.hover&&n.hover(),e.container&&n.initialize(e.container,e.bind),e.watchPixelRatio&&n._watchPixelRatio()}function Rz(t,e){return ut(t._signals,e)?t._signals[e]:s("Unrecognized signal name: "+Dt(e))}function Lz(t,e){const n=(t._targets||[]).filter((t=>t._update&&t._update.handler===e));return n.length?n[0]:null}function Uz(t,e,n,r){let i=Lz(n,r);return i||(i=xz(t,(()=>r(e,n.value))),i.handler=r,t.on(n,null,i)),t}function qz(t,e,n){const r=Lz(e,n);return r&&e._targets.remove(r),t}ht(Oz,Ga,{async evaluate(t,e,n){if(await Ga.prototype.evaluate.call(this,t,e),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(t){var e=QB(t),n=JB(t),r=ZB(t);t._renderer.background(t.background()),t._renderer.resize(n,r,e),t._handler.origin(e),t._resizeListeners.forEach((e=>{try{e(n,r)}catch(e){t.error(e)}}))}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}return n&&ha(this,n),this},dirty(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},description(t){if(arguments.length){const e=null!=t?t+"":null;return e!==this._desc&&HB(this._el,this._desc=e),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(t,e,n){const r=Rz(this,t);return 1===arguments.length?r.value:this.update(r,e,n)},width(t){return arguments.length?this.signal("width",t):this.signal("width")},height(t){return arguments.length?this.signal("height",t):this.signal("height")},padding(t){return arguments.length?this.signal("padding",kz(t)):kz(this.signal("padding"))},autosize(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},background(t){return arguments.length?this.signal("background",t):this.signal("background")},renderer(t){return arguments.length?(T_(t)||s("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},tooltip(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},loader(t){return arguments.length?(t!==this._loader&&(Ga.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(Rz(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(t,e,n,r,i,o){this.runAfter((a=>{let s=0;a._autosize=0,a.width()!==n&&(s=1,a.signal(Mz,n,Cz),a._resizeWidth.skip(!0)),a.height()!==r&&(s=1,a.signal(Ez,r,Cz),a._resizeHeight.skip(!0)),a._viewWidth!==t&&(a._resize=1,a._viewWidth=t),a._viewHeight!==e&&(a._resize=1,a._viewHeight=e),a._origin[0]===i[0]&&a._origin[1]===i[1]||(a._resize=1,a._origin=i),s&&a.run("enter"),o&&a.runAfter((t=>t.resize()))}),!1,1)},addEventListener(t,e,n){let r=e;return n&&!1===n.trap||(r=xz(this,e),r.raw=e),this._handler.on(t,r),this},removeEventListener(t,e){for(var n,r,i=this._handler.handlers(t),o=i.length;--o>=0;)if(r=i[o].type,n=i[o].handler,t===r&&(e===n||e===n.raw)){this._handler.off(r,n);break}return this},addResizeListener(t){const e=this._resizeListeners;return e.includes(t)||e.push(t),this},removeResizeListener(t){var e=this._resizeListeners,n=e.indexOf(t);return n>=0&&e.splice(n,1),this},addSignalListener(t,e){return Uz(this,t,Rz(this,t),e)},removeSignalListener(t,e){return qz(this,Rz(this,t),e)},addDataListener(t,e){return Uz(this,t,VB(this,t).values,e)},removeDataListener(t,e){return qz(this,VB(this,t).values,e)},globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=GB(this,null);this._globalCursor=!!t,e&&GB(this,e)}return this}return this._globalCursor},preventDefault(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},timer:function(t,e){this._timers.push(function(t,e,n){var r=new lD,i=e;return null==e?(r.restart(t,e,n),r):(r._restart=r.restart,r.restart=function(t,e,n){e=+e,n=null==n?sD():+n,r._restart((function o(a){a+=i,r._restart(o,i+=e,n),t(a)}),e,n)},r.restart(t,e,n),r)}((function(e){t({timestamp:Date.now(),elapsed:e})}),e))},events:function(t,e,n){var r,i=this,o=new Ta(n),a=function(n,r){i.runAsync(null,(()=>{t===tz&&function(t,e){var n=t._eventConfig.defaults,r=n.prevent,i=n.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[e]:i?!i[e]:t.preventDefault()))}(i,e)&&n.preventDefault(),o.receive(KB(i,n,r))}))};if("timer"===t)rz(i,"timer",e)&&i.timer(a,e);else if(t===tz)rz(i,"view",e)&&i.addEventListener(e,a,ez);else if("window"===t?rz(i,"window",e)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&rz(i,"selector",e)&&(r=Array.from(document.querySelectorAll(t))),r){for(var s=0,u=r.length;s=0;)a[t].stop();for(t=u.length;--t>=0;)for(e=(n=u[t]).sources.length;--e>=0;)n.sources[e].removeEventListener(n.type,n.handler);for(o&&o.call(this,this._handler,null,null,null),t=s.length;--t>=0;)i=s[t].type,r=s[t].handler,this._handler.off(i,r);return this},hover:function(t,e){return e=[e||"update",(t=[t||"hover"])[0]],this.on(this.events("view","pointerover",iz),oz,az(t)),this.on(this.events("view","pointerout",iz),oz,az(e)),this},data:function(t,e){return arguments.length<2?VB(this,t).values.value:XB.call(this,t,Aa().remove(p).insert(e))},change:XB,insert:function(t,e){return XB.call(this,t,Aa().insert(e))},remove:function(t,e){return XB.call(this,t,Aa().remove(e))},scale:function(t){var e=this._runtime.scales;return ut(e,t)||s("Unrecognized scale or projection: "+t),e[t].value},initialize:function(t,e){const n=this,r=n._renderType,i=n._eventConfig.bind,o=T_(r);t=n._el=t?bz(n,t,!0):null,function(t){const e=t.container();e&&(e.setAttribute("role","graphics-document"),e.setAttribute("aria-roleDescription","visualization"),HB(e,t.description()))}(n),o||n.error("Unrecognized renderer type: "+r);const a=o.handler||Sv,s=t?o.renderer:o.headless;return n._renderer=s?_z(n,n._renderer,t,s):null,n._handler=function(t,e,n,r){const i=new r(t.loader(),xz(t,t.tooltip())).scene(t.scenegraph().root).initialize(n,QB(t),t);return e&&e.handlers().forEach((t=>{i.on(t.type,t.handler)})),i}(n,n._handler,t,a),n._redraw=!0,t&&"none"!==i&&(e=e?n._elBind=bz(n,e,!0):t.appendChild(sz("form",{class:"vega-bindings"})),n._bind.forEach((t=>{t.param.element&&"container"!==i&&(t.element=bz(n,t.param.element,!!t.param.input))})),n._bind.forEach((t=>{!function(t,e,n){if(!e)return;const r=n.param;let i=n.state;i||(i=n.state={elements:null,active:!1,set:null,update:e=>{e!=t.signal(r.signal)&&t.runAsync(null,(()=>{i.source=!0,t.signal(r.signal,e)}))}},r.debounce&&(i.update=it(r.debounce,i.update))),(null==r.input&&r.element?fz:hz)(i,e,r,t),i.active||(t.on(t._signals[r.signal],null,(()=>{i.source?i.source=!1:i.set(t.signal(r.signal))})),i.active=!0)}(n,t.element||e,t)}))),n},toImageURL:async function(t,e){t!==S_.Canvas&&t!==S_.SVG&&t!==S_.PNG&&s("Unrecognized image type: "+t);const n=await Az(this,t,e);return t===S_.SVG?function(t,e){const n=new Blob([t],{type:e});return window.URL.createObjectURL(n)}(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},toCanvas:async function(t,e){return(await Az(this,S_.Canvas,t,e)).canvas()},toSVG:async function(t){return(await Az(this,S_.SVG,t)).svg()},getState:function(t){return this._runtime.getState(t||{data:$z,signals:Tz,recurse:!0})},setState:function(t){return this.runAsync(null,(e=>{e._trigger=!1,e._runtime.setState(t)}),(t=>{t._trigger=!0})),this},_watchPixelRatio:function(){if("canvas"===this.renderer()&&this._renderer._canvas){let t=null;const e=()=>{null!=t&&t();const n=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);n.addEventListener("change",e),t=()=>{n.removeEventListener("change",e)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};e()}}});const Pz="view",jz="[",Iz="]",Wz="{",Hz="}",Yz=":",Gz=",",Vz="@",Xz=">",Jz=/[[\]{}]/,Zz={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let Qz,Kz;function tN(t,e,n){return Qz=e||Pz,Kz=n||Zz,nN(t.trim()).map(rN)}function eN(t,e,n,r,i){const o=t.length;let a,s=0;for(;e' after between selector: "+t;n=n.map(rN);const i=rN(t.slice(1).trim());if(i.between)return{between:n,stream:i};i.between=n;return i}(t):function(t){const e={source:Qz},n=[];let r,i,o=[0,0],a=0,s=0,u=t.length,l=0;if(t[u-1]===Hz){if(l=t.lastIndexOf(Wz),!(l>=0))throw"Unmatched right brace: "+t;try{o=function(t){const e=t.split(Gz);if(!t.length||e.length>2)throw t;return e.map((e=>{const n=+e;if(n!=n)throw t;return n}))}(t.substring(l+1,u-1))}catch(e){throw"Invalid throttle specification: "+t}u=(t=t.slice(0,l).trim()).length,l=0}if(!u)throw t;t[0]===Vz&&(a=++l);r=eN(t,l,Yz),r1?(e.type=n[1],a?e.markname=n[0].slice(1):!function(t){return Kz[t]}(n[0])?e.source=n[0]:e.marktype=n[0]):e.type=n[0];"!"===e.type.slice(-1)&&(e.consume=!0,e.type=e.type.slice(0,-1));null!=i&&(e.filter=i);o[0]&&(e.throttle=o[0]);o[1]&&(e.debounce=o[1]);return e}(t)}function iN(t){return A(t)?t:{type:t||"pad"}}const oN=t=>+t||0,aN=t=>({top:t,bottom:t,left:t,right:t});function sN(t){return A(t)?t.signal?t:{top:oN(t.top),bottom:oN(t.bottom),left:oN(t.left),right:oN(t.right)}:aN(oN(t))}const uN=t=>A(t)&&!k(t)?ot({},t):{value:t};function lN(t,e,n,r){if(null!=n){return A(n)&&!k(n)||k(n)&&n.length&&A(n[0])?t.update[e]=n:t[r||"enter"][e]={value:n},1}return 0}function cN(t,e,n){for(const n in e)lN(t,n,e[n]);for(const e in n)lN(t,e,n[e],"update")}function fN(t,e,n){for(const r in e)n&&ut(n,r)||(t[r]=ot(t[r]||{},e[r]));return t}function hN(t,e){return e&&(e.enter&&e.enter[t]||e.update&&e.update[t])}const dN="mark",pN="frame",gN="scope",mN="axis",yN="axis-domain",vN="axis-grid",_N="axis-label",xN="axis-tick",bN="axis-title",wN="legend",kN="legend-band",AN="legend-entry",MN="legend-gradient",EN="legend-label",DN="legend-symbol",CN="legend-title",FN="title",SN="title-text",$N="title-subtitle";function TN(t,e,n){t[e]=n&&n.signal?{signal:n.signal}:{value:n}}const BN=t=>_t(t)?Dt(t):t.signal?`(${t.signal})`:RN(t);function zN(t){if(null!=t.gradient)return function(t){const e=[t.start,t.stop,t.count].map((t=>null==t?null:Dt(t)));for(;e.length&&null==F(e);)e.pop();return e.unshift(BN(t.gradient)),`gradient(${e.join(",")})`}(t);let e=t.signal?`(${t.signal})`:t.color?function(t){return t.c?NN("hcl",t.h,t.c,t.l):t.h||t.s?NN("hsl",t.h,t.s,t.l):t.l||t.a?NN("lab",t.l,t.a,t.b):t.r||t.g||t.b?NN("rgb",t.r,t.g,t.b):null}(t.color):null!=t.field?RN(t.field):void 0!==t.value?Dt(t.value):void 0;return null!=t.scale&&(e=function(t,e){const n=BN(t.scale);null!=t.range?e=`lerp(_range(${n}), ${+t.range})`:(void 0!==e&&(e=`_scale(${n}, ${e})`),t.band&&(e=(e?e+"+":"")+`_bandwidth(${n})`+(1==+t.band?"":"*"+ON(t.band)),t.extra&&(e=`(datum.extra ? _scale(${n}, datum.extra.value) : ${e})`)),null==e&&(e="0"));return e}(t,e)),void 0===e&&(e=null),null!=t.exponent&&(e=`pow(${e},${ON(t.exponent)})`),null!=t.mult&&(e+=`*${ON(t.mult)}`),null!=t.offset&&(e+=`+${ON(t.offset)}`),t.round&&(e=`round(${e})`),e}const NN=(t,e,n,r)=>`(${t}(${[e,n,r].map(zN).join(",")})+'')`;function ON(t){return A(t)?"("+zN(t)+")":t}function RN(t){return LN(A(t)?t:{datum:t})}function LN(t){let e,n,r;if(t.signal)e="datum",r=t.signal;else if(t.group||t.parent){for(n=Math.max(1,t.level||1),e="item";n-- >0;)e+=".mark.group";t.parent?(r=t.parent,e+=".datum"):r=t.group}else t.datum?(e="datum",r=t.datum):s("Invalid field reference: "+Dt(t));return t.signal||(r=_t(r)?u(r).map(Dt).join("]["):LN(r)),e+"["+r+"]"}function UN(t,e,n,r,i,o){const a={};(o=o||{}).encoders={$encode:a},t=function(t,e,n,r,i){const o={},a={};let s,u,l,c;for(u in u="lineBreak","text"!==e||null==i[u]||hN(u,t)||TN(o,u,i[u]),("legend"==n||String(n).startsWith("axis"))&&(n=null),c=n===pN?i.group:n===dN?ot({},i.mark,i[e]):null,c)l=hN(u,t)||("fill"===u||"stroke"===u)&&(hN("fill",t)||hN("stroke",t)),l||TN(o,u,c[u]);for(u in V(r).forEach((e=>{const n=i.style&&i.style[e];for(const e in n)hN(e,t)||TN(o,e,n[e])})),t=ot({},t),o)c=o[u],c.signal?(s=s||{})[u]=c:a[u]=c;return t.enter=ot(a,t.enter),s&&(t.update=ot(s,t.update)),t}(t,e,n,r,i.config);for(const n in t)a[n]=qN(t[n],e,o,i);return o}function qN(t,e,n,r){const i={},o={};for(const e in t)null!=t[e]&&(i[e]=PN((a=t[e],k(a)?function(t){let e="";return t.forEach((t=>{const n=zN(t);e+=t.test?`(${t.test})?${n}:`:n})),":"===F(e)&&(e+="null"),e}(a):zN(a)),r,n,o));var a;return{$expr:{marktype:e,channels:i},$fields:Object.keys(o),$output:Object.keys(t)}}function PN(t,e,n,r){const i=BB(t,e);return i.$fields.forEach((t=>r[t]=1)),ot(n,i.$params),i.$expr}const jN="outer",IN=["value","update","init","react","bind"];function WN(t,e){s(t+' for "outer" push: '+Dt(e))}function HN(t,e){const n=t.name;if(t.push===jN)e.signals[n]||WN("No prior signal definition",n),IN.forEach((e=>{void 0!==t[e]&&WN("Invalid property ",e)}));else{const r=e.addSignal(n,t.value);!1===t.react&&(r.react=!1),t.bind&&e.addBinding(n,t.bind)}}function YN(t,e,n,r){this.id=-1,this.type=t,this.value=e,this.params=n,r&&(this.parent=r)}function GN(t,e,n,r){return new YN(t,e,n,r)}function VN(t,e){return GN("operator",t,e)}function XN(t){const e={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(e),e}function JN(t,e){return e?{$field:t,$name:e}:{$field:t}}const ZN=JN("key");function QN(t,e){return{$compare:t,$order:e}}const KN="descending";function tO(t,e){return(t&&t.signal?"$"+t.signal:t||"")+(t&&e?"_":"")+(e&&e.signal?"$"+e.signal:e||"")}const eO="scope",nO="view";function rO(t){return t&&t.signal}function iO(t){if(rO(t))return!0;if(A(t))for(const e in t)if(iO(t[e]))return!0;return!1}function oO(t,e){return null!=t?t:e}function aO(t){return t&&t.signal||t}const sO="timer";function uO(t,e){return(t.merge?lO:t.stream?cO:t.type?fO:s("Invalid stream specification: "+Dt(t)))(t,e)}function lO(t,e){const n=hO({merge:t.merge.map((t=>uO(t,e)))},t,e);return e.addStream(n).id}function cO(t,e){const n=hO({stream:uO(t.stream,e)},t,e);return e.addStream(n).id}function fO(t,e){let n;t.type===sO?(n=e.event(sO,t.throttle),t={between:t.between,filter:t.filter}):n=e.event(function(t){return t===eO?nO:t||nO}(t.source),t.type);const r=hO({stream:n},t,e);return 1===Object.keys(r).length?n:e.addStream(r).id}function hO(t,e,n){let r=e.between;return r&&(2!==r.length&&s('Stream "between" parameter must have 2 entries: '+Dt(e)),t.between=[uO(r[0],n),uO(r[1],n)]),r=e.filter?[].concat(e.filter):[],(e.marktype||e.markname||e.markrole)&&r.push(function(t,e,n){const r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(n?"&&"+r+".mark.role==='"+n+"'":"")+(e?"&&"+r+".mark.name==='"+e+"'":"")}(e.marktype,e.markname,e.markrole)),e.source===eO&&r.push("inScope(event.item)"),r.length&&(t.filter=BB("("+r.join(")&&(")+")",n).$expr),null!=(r=e.throttle)&&(t.throttle=+r),null!=(r=e.debounce)&&(t.debounce=+r),e.consume&&(t.consume=!0),t}const dO={code:"_.$value",ast:{type:"Identifier",value:"value"}};function pO(t,e,n){const r=t.encode,i={target:n};let o=t.events,a=t.update,u=[];o||s("Signal update missing events specification."),_t(o)&&(o=tN(o,e.isSubscope()?eO:nO)),o=V(o).filter((t=>t.signal||t.scale?(u.push(t),0):1)),u.length>1&&(u=[gO(u)]),o.length&&u.push(o.length>1?{merge:o}:o[0]),null!=r&&(a&&s("Signal encode and update are mutually exclusive."),a="encode(item(),"+Dt(r)+")"),i.update=_t(a)?BB(a,e):null!=a.expr?BB(a.expr,e):null!=a.value?a.value:null!=a.signal?{$expr:dO,$params:{$value:e.signalRef(a.signal)}}:s("Invalid signal update specification."),t.force&&(i.options={force:!0}),u.forEach((t=>e.addUpdate(ot(function(t,e){return{source:t.signal?e.signalRef(t.signal):t.scale?e.scaleRef(t.scale):uO(t,e)}}(t,e),i))))}function gO(t){return{signal:"["+t.map((t=>t.scale?'scale("'+t.scale+'")':t.signal))+"]"}}const mO=t=>(e,n,r)=>GN(t,n,e||void 0,r),yO=mO("aggregate"),vO=mO("axisticks"),_O=mO("bound"),xO=mO("collect"),bO=mO("compare"),wO=mO("datajoin"),kO=mO("encode"),AO=mO("expression"),MO=mO("facet"),EO=mO("field"),DO=mO("key"),CO=mO("legendentries"),FO=mO("load"),SO=mO("mark"),$O=mO("multiextent"),TO=mO("multivalues"),BO=mO("overlap"),zO=mO("params"),NO=mO("prefacet"),OO=mO("projection"),RO=mO("proxy"),LO=mO("relay"),UO=mO("render"),qO=mO("scale"),PO=mO("sieve"),jO=mO("sortitems"),IO=mO("viewlayout"),WO=mO("values");let HO=0;const YO={min:"min",max:"max",count:"sum"};function GO(t,e){const n=e.getScale(t.name).params;let r;for(r in n.domain=ZO(t.domain,t,e),null!=t.range&&(n.range=oR(t,e,n)),null!=t.interpolate&&function(t,e){e.interpolate=VO(t.type||t),null!=t.gamma&&(e.interpolateGamma=VO(t.gamma))}(t.interpolate,n),null!=t.nice&&(n.nice=function(t,e){return t.signal?e.signalRef(t.signal):A(t)?{interval:VO(t.interval),step:VO(t.step)}:VO(t)}(t.nice,e)),null!=t.bins&&(n.bins=function(t,e){return t.signal||k(t)?XO(t,e):e.objectProperty(t)}(t.bins,e)),t)ut(n,r)||"name"===r||(n[r]=VO(t[r],e))}function VO(t,e){return A(t)?t.signal?e.signalRef(t.signal):s("Unsupported object: "+Dt(t)):t}function XO(t,e){return t.signal?e.signalRef(t.signal):t.map((t=>VO(t,e)))}function JO(t){s("Can not find data set: "+Dt(t))}function ZO(t,e,n){if(t)return t.signal?n.signalRef(t.signal):(k(t)?QO:t.fields?tR:KO)(t,e,n);null==e.domainMin&&null==e.domainMax||s("No scale domain defined for domainMin/domainMax to override.")}function QO(t,e,n){return t.map((t=>VO(t,n)))}function KO(t,e,n){const r=n.getData(t.data);return r||JO(t.data),cp(e.type)?r.valuesRef(n,t.field,nR(t.sort,!1)):pp(e.type)?r.domainRef(n,t.field):r.extentRef(n,t.field)}function tR(t,e,n){const r=t.data,i=t.fields.reduce(((t,e)=>(e=_t(e)?{data:r,field:e}:k(e)||e.signal?function(t,e){const n="_:vega:_"+HO++,r=xO({});if(k(t))r.value={$ingest:t};else if(t.signal){const i="setdata("+Dt(n)+","+t.signal+")";r.params.input=e.signalRef(i)}return e.addDataPipeline(n,[r,PO({})]),{data:n,field:"data"}}(e,n):e,t.push(e),t)),[]);return(cp(e.type)?eR:pp(e.type)?rR:iR)(t,n,i)}function eR(t,e,n){const r=nR(t.sort,!0);let i,o;const a=n.map((t=>{const n=e.getData(t.data);return n||JO(t.data),n.countsRef(e,t.field,r)})),s={groupby:ZN,pulse:a};r&&(i=r.op||"count",o=r.field?tO(i,r.field):"count",s.ops=[YO[i]],s.fields=[e.fieldRef(o)],s.as=[o]),i=e.add(yO(s));const u=e.add(xO({pulse:XN(i)}));return o=e.add(WO({field:ZN,sort:e.sortRef(r),pulse:XN(u)})),XN(o)}function nR(t,e){return t&&(t.field||t.op?t.field||"count"===t.op?e&&t.field&&t.op&&!YO[t.op]&&s("Multiple domain scales can not be sorted using "+t.op):s("No field provided for sort aggregate op: "+t.op):A(t)?t.field="key":t={field:"key"}),t}function rR(t,e,n){const r=n.map((t=>{const n=e.getData(t.data);return n||JO(t.data),n.domainRef(e,t.field)}));return XN(e.add(TO({values:r})))}function iR(t,e,n){const r=n.map((t=>{const n=e.getData(t.data);return n||JO(t.data),n.extentRef(e,t.field)}));return XN(e.add($O({extents:r})))}function oR(t,e,n){const r=e.config.range;let i=t.range;if(i.signal)return e.signalRef(i.signal);if(_t(i)){if(r&&ut(r,i))return oR(t=ot({},t,{range:r[i]}),e,n);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=cp(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:s("Unrecognized scale range value: "+Dt(i))}else{if(i.scheme)return n.scheme=k(i.scheme)?XO(i.scheme,e):VO(i.scheme,e),i.extent&&(n.schemeExtent=XO(i.extent,e)),void(i.count&&(n.schemeCount=VO(i.count,e)));if(i.step)return void(n.rangeStep=VO(i.step,e));if(cp(t.type)&&!k(i))return ZO(i,t,e);k(i)||s("Unsupported range type: "+Dt(i))}return i.map((t=>(k(t)?XO:VO)(t,e)))}function aR(t,e,n){return k(t)?t.map((t=>aR(t,e,n))):A(t)?t.signal?n.signalRef(t.signal):"fit"===e?t:s("Unsupported parameter object: "+Dt(t)):t}const sR="top",uR="left",lR="right",cR="bottom",fR="center",hR="vertical",dR="start",pR="end",gR="index",mR="label",yR="offset",vR="perc",_R="perc2",xR="value",bR="guide-label",wR="guide-title",kR="group-title",AR="group-subtitle",MR="symbol",ER="gradient",DR="discrete",CR="size",FR=[CR,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],SR={name:1,style:1,interactive:1},$R={value:0},TR={value:1},BR="group",zR="rect",NR="rule",OR="symbol",RR="text";function LR(t){return t.type=BR,t.interactive=t.interactive||!1,t}function UR(t,e){const n=(n,r)=>oO(t[n],oO(e[n],r));return n.isVertical=n=>hR===oO(t.direction,e.direction||(n?e.symbolDirection:e.gradientDirection)),n.gradientLength=()=>oO(t.gradientLength,e.gradientLength||e.gradientWidth),n.gradientThickness=()=>oO(t.gradientThickness,e.gradientThickness||e.gradientHeight),n.entryColumns=()=>oO(t.columns,oO(e.columns,+n.isVertical(!0))),n}function qR(t,e){const n=e&&(e.update&&e.update[t]||e.enter&&e.enter[t]);return n&&n.signal?n:n?n.value:null}function PR(t,e,n){return`item.anchor === '${dR}' ? ${t} : item.anchor === '${pR}' ? ${e} : ${n}`}const jR=PR(Dt(uR),Dt(lR),Dt(fR));function IR(t,e){return e?t?A(t)?Object.assign({},t,{offset:IR(t.offset,e)}):{value:t,offset:e}:e:t}function WR(t,e){return e?(t.name=e.name,t.style=e.style||t.style,t.interactive=!!e.interactive,t.encode=fN(t.encode,e,SR)):t.interactive=!1,t}function HR(t,e,n,r){const i=UR(t,n),o=i.isVertical(),a=i.gradientThickness(),s=i.gradientLength();let u,l,c,f,h;o?(l=[0,1],c=[0,0],f=a,h=s):(l=[0,0],c=[1,0],f=s,h=a);const d={enter:u={opacity:$R,x:$R,y:$R,width:uN(f),height:uN(h)},update:ot({},u,{opacity:TR,fill:{gradient:e,start:l,stop:c}}),exit:{opacity:$R}};return cN(d,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),WR({type:zR,role:MN,encode:d},r)}function YR(t,e,n,r,i){const o=UR(t,n),a=o.isVertical(),s=o.gradientThickness(),u=o.gradientLength();let l,c,f,h,d="";a?(l="y",f="y2",c="x",h="width",d="1-"):(l="x",f="x2",c="y",h="height");const p={opacity:$R,fill:{scale:e,field:xR}};p[l]={signal:d+"datum."+vR,mult:u},p[c]=$R,p[f]={signal:d+"datum."+_R,mult:u},p[h]=uN(s);const g={enter:p,update:ot({},p,{opacity:TR}),exit:{opacity:$R}};return cN(g,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),WR({type:zR,role:kN,key:xR,from:i,encode:g},r)}const GR=`datum.${vR}<=0?"${uR}":datum.${vR}>=1?"${lR}":"${fR}"`,VR=`datum.${vR}<=0?"${cR}":datum.${vR}>=1?"${sR}":"middle"`;function XR(t,e,n,r){const i=UR(t,e),o=i.isVertical(),a=uN(i.gradientThickness()),s=i.gradientLength();let u,l,c,f,h=i("labelOverlap"),d="";const p={enter:u={opacity:$R},update:l={opacity:TR,text:{field:mR}},exit:{opacity:$R}};return cN(p,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:oO(t.labelLimit,e.gradientLabelLimit)}),o?(u.align={value:"left"},u.baseline=l.baseline={signal:VR},c="y",f="x",d="1-"):(u.align=l.align={signal:GR},u.baseline={value:"top"},c="x",f="y"),u[c]=l[c]={signal:d+"datum."+vR,mult:s},u[f]=l[f]=a,a.offset=oO(t.labelOffset,e.gradientLabelOffset)||0,h=h?{separation:i("labelSeparation"),method:h,order:"datum."+gR}:void 0,WR({type:RR,role:EN,style:bR,key:xR,from:r,encode:p,overlap:h},n)}function JR(t,e,n,r,i){const o=UR(t,e),a=n.entries,s=!(!a||!a.interactive),u=a?a.name:void 0,l=o("clipHeight"),c=o("symbolOffset"),f={data:"value"},h=`(${i}) ? datum.${yR} : datum.${CR}`,d=l?uN(l):{field:CR},p=`datum.${gR}`,g=`max(1, ${i})`;let m,y,v,_,x;d.mult=.5,m={enter:y={opacity:$R,x:{signal:h,mult:.5,offset:c},y:d},update:v={opacity:TR,x:y.x,y:y.y},exit:{opacity:$R}};let b=null,w=null;t.fill||(b=e.symbolBaseFillColor,w=e.symbolBaseStrokeColor),cN(m,{fill:o("symbolFillColor",b),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",w),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),FR.forEach((e=>{t[e]&&(v[e]=y[e]={scale:t[e],field:xR})}));const k=WR({type:OR,role:DN,key:xR,from:f,clip:!!l||void 0,encode:m},n.symbols),A=uN(c);A.offset=o("labelOffset"),m={enter:y={opacity:$R,x:{signal:h,offset:A},y:d},update:v={opacity:TR,text:{field:mR},x:y.x,y:y.y},exit:{opacity:$R}},cN(m,{align:o("labelAlign"),baseline:o("labelBaseline"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontStyle:o("labelFontStyle"),fontWeight:o("labelFontWeight"),limit:o("labelLimit")});const M=WR({type:RR,role:EN,style:bR,key:xR,from:f,encode:m},n.labels);return m={enter:{noBound:{value:!l},width:$R,height:l?uN(l):$R,opacity:$R},exit:{opacity:$R},update:v={opacity:TR,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(_=`ceil(item.mark.items.length / ${g})`,v.row.signal=`${p}%${_}`,v.column.signal=`floor(${p} / ${_})`,x={field:["row",p]}):(v.row.signal=`floor(${p} / ${g})`,v.column.signal=`${p} % ${g}`,x={field:p}),v.column.signal=`(${i})?${v.column.signal}:${p}`,LR({role:gN,from:r={facet:{data:r,name:"value",groupby:gR}},encode:fN(m,a,SR),marks:[k,M],name:u,interactive:s,sort:x})}const ZR='item.orient === "left"',QR='item.orient === "right"',KR=`(${ZR} || ${QR})`,tL=`datum.vgrad && ${KR}`,eL=PR('"top"','"bottom"','"middle"'),nL=`datum.vgrad && ${QR} ? (${PR('"right"','"left"','"center"')}) : (${KR} && !(datum.vgrad && ${ZR})) ? "left" : ${jR}`,rL=`item._anchor || (${KR} ? "middle" : "start")`,iL=`${tL} ? (${ZR} ? -90 : 90) : 0`,oL=`${KR} ? (datum.vgrad ? (${QR} ? "bottom" : "top") : ${eL}) : "top"`;function aL(t,e){let n;return A(t)&&(t.signal?n=t.signal:t.path?n="pathShape("+sL(t.path)+")":t.sphere&&(n="geoShape("+sL(t.sphere)+', {type: "Sphere"})')),n?e.signalRef(n):!!t}function sL(t){return A(t)&&t.signal?t.signal:Dt(t)}function uL(t){const e=t.role||"";return e.startsWith("axis")||e.startsWith("legend")||e.startsWith("title")?e:t.type===BR?gN:e||dN}function lL(t){return{marktype:t.type,name:t.name||void 0,role:t.role||uL(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function cL(t,e){return t&&t.signal?e.signalRef(t.signal):!1!==t}function fL(t,e){const n=Za(t.type);n||s("Unrecognized transform type: "+Dt(t.type));const r=GN(n.type.toLowerCase(),null,hL(n,t,e));return t.signal&&e.addSignal(t.signal,e.proxy(r)),r.metadata=n.metadata||{},r}function hL(t,e,n){const r={},i=t.params.length;for(let o=0;ogL(t,e,n)))):gL(t,r,n)}(t,e,n):"projection"===r?n.projectionRef(e[t.name]):t.array&&!rO(i)?i.map((e=>pL(t,e,n))):pL(t,i,n):void(t.required&&s("Missing required "+Dt(e.type)+" parameter: "+Dt(t.name)))}function pL(t,e,n){const r=t.type;if(rO(e))return _L(r)?s("Expression references can not be signals."):xL(r)?n.fieldRef(e):bL(r)?n.compareRef(e):n.signalRef(e.signal);{const i=t.expr||xL(r);return i&&mL(e)?n.exprRef(e.expr,e.as):i&&yL(e)?JN(e.field,e.as):_L(r)?BB(e,n):vL(r)?XN(n.getData(e).values):xL(r)?JN(e):bL(r)?n.compareRef(e):e}}function gL(t,e,n){const r=t.params.length;let i;for(let n=0;nt&&t.expr,yL=t=>t&&t.field,vL=t=>"data"===t,_L=t=>"expr"===t,xL=t=>"field"===t,bL=t=>"compare"===t;function wL(t,e){return t.$ref?t:t.data&&t.data.$ref?t.data:XN(e.getData(t.data).output)}function kL(t,e,n,r,i){this.scope=t,this.input=e,this.output=n,this.values=r,this.aggregate=i,this.index={}}function AL(t){return _t(t)?t:null}function ML(t,e,n){const r=tO(n.op,n.field);let i;if(e.ops){for(let t=0,n=e.as.length;tnull==t?"null":t)).join(",")+"),0)",e);u.update=l.$expr,u.params=l.$params}function CL(t,e){const n=uL(t),r=t.type===BR,i=t.from&&t.from.facet,o=t.overlap;let a,u,l,c,f,h,d,p=t.layout||n===gN||n===pN;const g=n===dN||p||i,m=function(t,e,n){let r,i,o,a,u;return t?(r=t.facet)&&(e||s("Only group marks can be faceted."),null!=r.field?a=u=wL(r,n):(t.data?u=XN(n.getData(t.data).aggregate):(o=fL(ot({type:"aggregate",groupby:V(r.groupby)},r.aggregate),n),o.params.key=n.keyRef(r.groupby),o.params.pulse=wL(r,n),a=u=XN(n.add(o))),i=n.keyRef(r.groupby,!0))):a=XN(n.add(xO(null,[{}]))),a||(a=wL(t,n)),{key:i,pulse:a,parent:u}}(t.from,r,e);u=e.add(wO({key:m.key||(t.key?JN(t.key):void 0),pulse:m.pulse,clean:!r}));const y=XN(u);u=l=e.add(xO({pulse:y})),u=e.add(SO({markdef:lL(t),interactive:cL(t.interactive,e),clip:aL(t.clip,e),context:{$context:!0},groups:e.lookup(),parent:e.signals.parent?e.signalRef("parent"):null,index:e.markpath(),pulse:XN(u)}));const v=XN(u);u=c=e.add(kO(UN(t.encode,t.type,n,t.style,e,{mod:!1,pulse:v}))),u.params.parent=e.encode(),t.transform&&t.transform.forEach((t=>{const n=fL(t,e),r=n.metadata;(r.generates||r.changes)&&s("Mark transforms should not generate new data."),r.nomod||(c.params.mod=!0),n.params.pulse=XN(u),e.add(u=n)})),t.sort&&(u=e.add(jO({sort:e.compareRef(t.sort),pulse:XN(u)})));const _=XN(u);(i||p)&&(p=e.add(IO({layout:e.objectProperty(t.layout),legends:e.legends,mark:v,pulse:_})),h=XN(p));const x=e.add(_O({mark:v,pulse:h||_}));d=XN(x),r&&(g&&(a=e.operators,a.pop(),p&&a.pop()),e.pushState(_,h||d,y),i?function(t,e,n){const r=t.from.facet,i=r.name,o=wL(r,e);let a;r.name||s("Facet must have a name: "+Dt(r)),r.data||s("Facet must reference a data set: "+Dt(r)),r.field?a=e.add(NO({field:e.fieldRef(r.field),pulse:o})):r.groupby?a=e.add(MO({key:e.keyRef(r.groupby),group:XN(e.proxy(n.parent)),pulse:o})):s("Facet must specify groupby or field: "+Dt(r));const u=e.fork(),l=u.add(xO()),c=u.add(PO({pulse:XN(l)}));u.addData(i,new kL(u,l,l,c)),u.addSignal("parent",null),a.params.subflow={$subflow:u.parse(t).toRuntime()}}(t,e,m):g?function(t,e,n){const r=e.add(NO({pulse:n.pulse})),i=e.fork();i.add(PO()),i.addSignal("parent",null),r.params.subflow={$subflow:i.parse(t).toRuntime()}}(t,e,m):e.parse(t),e.popState(),g&&(p&&a.push(p),a.push(x))),o&&(d=function(t,e,n){const r=t.method,i=t.bound,o=t.separation,a={separation:rO(o)?n.signalRef(o.signal):o,method:rO(r)?n.signalRef(r.signal):r,pulse:e};t.order&&(a.sort=n.compareRef({field:t.order}));if(i){const t=i.tolerance;a.boundTolerance=rO(t)?n.signalRef(t.signal):+t,a.boundScale=n.scaleRef(i.scale),a.boundOrient=i.orient}return XN(n.add(BO(a)))}(o,d,e));const b=e.add(UO({pulse:d})),w=e.add(PO({pulse:XN(b)},void 0,e.parent()));null!=t.name&&(f=t.name,e.addData(f,new kL(e,l,b,w)),t.on&&t.on.forEach((t=>{(t.insert||t.remove||t.toggle)&&s("Marks only support modify triggers."),DL(t,e,f)})))}function FL(t,e){const n=e.config.legend,r=t.encode||{},i=UR(t,n),o=r.legend||{},a=o.name||void 0,u=o.interactive,l=o.style,c={};let f,h,d,p=0;FR.forEach((e=>t[e]?(c[e]=t[e],p=p||t[e]):0)),p||s("Missing valid scale for legend.");const g=function(t,e){let n=t.type||MR;t.type||1!==function(t){return FR.reduce(((e,n)=>e+(t[n]?1:0)),0)}(t)||!t.fill&&!t.stroke||(n=lp(e)?ER:fp(e)?DR:MR);return n!==ER?n:fp(e)?DR:ER}(t,e.scaleType(p)),m={title:null!=t.title,scales:c,type:g,vgrad:"symbol"!==g&&i.isVertical()},y=XN(e.add(xO(null,[m]))),v=XN(e.add(CO(h={type:g,scale:e.scaleRef(p),count:e.objectProperty(i("tickCount")),limit:e.property(i("symbolLimit")),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)})));return g===ER?(d=[HR(t,p,n,r.gradient),XR(t,n,r.labels,v)],h.count=h.count||e.signalRef(`max(2,2*floor((${aO(i.gradientLength())})/100))`)):g===DR?d=[YR(t,p,n,r.gradient,v),XR(t,n,r.labels,v)]:(f=function(t,e){const n=UR(t,e);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(t,n),d=[JR(t,n,r,v,aO(f.columns))],h.size=function(t,e,n){const r=aO($L("size",t,n)),i=aO($L("strokeWidth",t,n)),o=aO(function(t,e,n){return qR("fontSize",t)||function(t,e,n){const r=e.config.style[n];return r&&r[t]}("fontSize",e,n)}(n[1].encode,e,bR));return BB(`max(ceil(sqrt(${r})+${i}),${o})`,e)}(t,e,d[0].marks)),d=[LR({role:AN,from:y,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:f,interactive:u})],m.title&&d.push(function(t,e,n,r){const i=UR(t,e),o={enter:{opacity:$R},update:{opacity:TR,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:$R}};return cN(o,{orient:i("titleOrient"),_anchor:i("titleAnchor"),anchor:{signal:rL},angle:{signal:iL},align:{signal:nL},baseline:{signal:oL},text:t.title,fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),baseline:i("titleBaseline")}),WR({type:RR,role:CN,style:wR,from:r,encode:o},n)}(t,n,r.title,y)),CL(LR({role:wN,from:y,encode:fN(SL(i,t,n),o,SR),marks:d,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:a,interactive:u,style:l}),e)}function SL(t,e,n){const r={enter:{},update:{}};return cN(r,{orient:t("orient"),offset:t("offset"),padding:t("padding"),titlePadding:t("titlePadding"),cornerRadius:t("cornerRadius"),fill:t("fillColor"),stroke:t("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:t("legendX"),y:t("legendY"),format:e.format,formatType:e.formatType}),r}function $L(t,e,n){return e[t]?`scale("${e[t]}",datum)`:qR(t,n[0].encode)}kL.fromEntries=function(t,e){const n=e.length,r=e[n-1],i=e[n-2];let o=e[0],a=null,s=1;for(o&&"load"===o.type&&(o=e[1]),t.add(e[0]);s{n.push(fL(t,e))})),t.on&&t.on.forEach((n=>{DL(n,e,t.name)})),e.addDataPipeline(t.name,function(t,e,n){const r=[];let i,o,a,s,u,l=null,c=!1,f=!1;t.values?rO(t.values)||iO(t.format)?(r.push(RL(e,t)),r.push(l=OL())):r.push(l=OL({$ingest:t.values,$format:t.format})):t.url?iO(t.url)||iO(t.format)?(r.push(RL(e,t)),r.push(l=OL())):r.push(l=OL({$request:t.url,$format:t.format})):t.source&&(l=i=V(t.source).map((t=>XN(e.getData(t).output))),r.push(null));for(o=0,a=n.length;ot===cR||t===sR,UL=(t,e,n)=>rO(t)?YL(t.signal,e,n):t===uR||t===sR?e:n,qL=(t,e,n)=>rO(t)?WL(t.signal,e,n):LL(t)?e:n,PL=(t,e,n)=>rO(t)?HL(t.signal,e,n):LL(t)?n:e,jL=(t,e,n)=>rO(t)?GL(t.signal,e,n):t===sR?{value:e}:{value:n},IL=(t,e,n)=>rO(t)?VL(t.signal,e,n):t===lR?{value:e}:{value:n},WL=(t,e,n)=>XL(`${t} === '${sR}' || ${t} === '${cR}'`,e,n),HL=(t,e,n)=>XL(`${t} !== '${sR}' && ${t} !== '${cR}'`,e,n),YL=(t,e,n)=>ZL(`${t} === '${uR}' || ${t} === '${sR}'`,e,n),GL=(t,e,n)=>ZL(`${t} === '${sR}'`,e,n),VL=(t,e,n)=>ZL(`${t} === '${lR}'`,e,n),XL=(t,e,n)=>(e=null!=e?uN(e):e,n=null!=n?uN(n):n,JL(e)&&JL(n)?{signal:`${t} ? (${e=e?e.signal||Dt(e.value):null}) : (${n=n?n.signal||Dt(n.value):null})`}:[ot({test:t},e)].concat(n||[])),JL=t=>null==t||1===Object.keys(t).length,ZL=(t,e,n)=>({signal:`${t} ? (${KL(e)}) : (${KL(n)})`}),QL=(t,e,n,r,i)=>({signal:(null!=r?`${t} === '${uR}' ? (${KL(r)}) : `:"")+(null!=n?`${t} === '${cR}' ? (${KL(n)}) : `:"")+(null!=i?`${t} === '${lR}' ? (${KL(i)}) : `:"")+(null!=e?`${t} === '${sR}' ? (${KL(e)}) : `:"")+"(null)"}),KL=t=>rO(t)?t.signal:null==t?null:Dt(t),tU=(t,e)=>0===e?0:rO(t)?{signal:`(${t.signal}) * ${e}`}:{value:t*e},eU=(t,e)=>{const n=t.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+e.signal}:t};function nU(t,e,n,r){let i;if(e&&ut(e,t))return e[t];if(ut(n,t))return n[t];if(t.startsWith("title")){switch(t){case"titleColor":i="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":i=t[5].toLowerCase()+t.slice(6)}return r[wR][i]}if(t.startsWith("label")){switch(t){case"labelColor":i="fill";break;case"labelFont":case"labelFontSize":i=t[5].toLowerCase()+t.slice(6)}return r[bR][i]}return null}function rU(t){const e={};for(const n of t)if(n)for(const t in n)e[t]=1;return Object.keys(e)}function iU(t,e){return{scale:t.scale,range:e}}function oU(t,e,n,r,i){const o=UR(t,e),a=t.orient,s=t.gridScale,u=UL(a,1,-1),l=function(t,e){if(1===e);else if(A(t)){let n=t=ot({},t);for(;null!=n.mult;){if(!A(n.mult))return n.mult=rO(e)?{signal:`(${n.mult}) * (${e.signal})`}:n.mult*e,t;n=n.mult=ot({},n.mult)}n.mult=e}else t=rO(e)?{signal:`(${e.signal}) * (${t||0})`}:e*(t||0);return t}(t.offset,u);let c,f,h;const d={enter:c={opacity:$R},update:h={opacity:TR},exit:f={opacity:$R}};cN(d,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const p={scale:t.scale,field:xR,band:i.band,extra:i.extra,offset:i.offset,round:o("tickRound")},g=qL(a,{signal:"height"},{signal:"width"}),m=s?{scale:s,range:0,mult:u,offset:l}:{value:0,offset:l},y=s?{scale:s,range:1,mult:u,offset:l}:ot(g,{mult:u,offset:l});return c.x=h.x=qL(a,p,m),c.y=h.y=PL(a,p,m),c.x2=h.x2=PL(a,y),c.y2=h.y2=qL(a,y),f.x=qL(a,p),f.y=PL(a,p),WR({type:NR,role:vN,key:xR,from:r,encode:d},n)}function aU(t,e,n,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+e+","+n+","+r+","+i+")"}}function sU(t,e,n,r){const i=UR(t,e),o=t.orient,a=UL(o,-1,1);let s,u;const l={enter:s={opacity:$R,anchor:uN(i("titleAnchor",null)),align:{signal:jR}},update:u=ot({},s,{opacity:TR,text:uN(t.title)}),exit:{opacity:$R}},c={signal:`lerp(range("${t.scale}"), ${PR(0,1,.5)})`};return u.x=qL(o,c),u.y=PL(o,c),s.angle=qL(o,$R,tU(a,90)),s.baseline=qL(o,jL(o,cR,sR),{value:cR}),u.angle=s.angle,u.baseline=s.baseline,cN(l,{fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),angle:i("titleAngle"),baseline:i("titleBaseline")}),function(t,e,n,r){const i=(t,e)=>null!=t?(n.update[e]=eU(uN(t),n.update[e]),!1):!hN(e,r),o=i(t("titleX"),"x"),a=i(t("titleY"),"y");n.enter.auto=a===o?uN(a):qL(e,uN(a),uN(o))}(i,o,l,n),l.update.align=eU(l.update.align,s.align),l.update.angle=eU(l.update.angle,s.angle),l.update.baseline=eU(l.update.baseline,s.baseline),WR({type:RR,role:bN,style:wR,from:r,encode:l},n)}function uU(t,e){const n=function(t,e){var n,r,i,o=e.config,a=o.style,s=o.axis,u="band"===e.scaleType(t.scale)&&o.axisBand,l=t.orient;if(rO(l)){const t=rU([o.axisX,o.axisY]),e=rU([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(i of(n={},t))n[i]=qL(l,nU(i,o.axisX,s,a),nU(i,o.axisY,s,a));for(i of(r={},e))r[i]=QL(l.signal,nU(i,o.axisTop,s,a),nU(i,o.axisBottom,s,a),nU(i,o.axisLeft,s,a),nU(i,o.axisRight,s,a))}else n=l===sR||l===cR?o.axisX:o.axisY,r=o["axis"+l[0].toUpperCase()+l.slice(1)];return n||r||u?ot({},s,n,r,u):s}(t,e),r=t.encode||{},i=r.axis||{},o=i.name||void 0,a=i.interactive,s=i.style,u=UR(t,n),l=function(t){const e=t("tickBand");let n,r,i=t("tickOffset");return e?e.signal?(n={signal:`(${e.signal}) === 'extent' ? 1 : 0.5`},r={signal:`(${e.signal}) === 'extent'`},A(i)||(i={signal:`(${e.signal}) === 'extent' ? 0 : ${i}`})):"extent"===e?(n=1,r=!0,i=0):(n=.5,r=!1):(n=t("bandPosition"),r=t("tickExtra")),{extra:r,band:n,offset:i}}(u),c={scale:t.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:null!=t.title},f=XN(e.add(xO({},[c]))),h=XN(e.add(vO({scale:e.scaleRef(t.scale),extra:e.property(l.extra),count:e.objectProperty(t.tickCount),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)}))),d=[];let p;return c.grid&&d.push(oU(t,n,r.grid,h,l)),c.ticks&&(p=u("tickSize"),d.push(function(t,e,n,r,i,o){const a=UR(t,e),s=t.orient,u=UL(s,-1,1);let l,c,f;const h={enter:l={opacity:$R},update:f={opacity:TR},exit:c={opacity:$R}};cN(h,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const d=uN(i);d.mult=u;const p={scale:t.scale,field:xR,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=l.y=qL(s,$R,p),f.y2=l.y2=qL(s,d),c.x=qL(s,p),f.x=l.x=PL(s,$R,p),f.x2=l.x2=PL(s,d),c.y=PL(s,p),WR({type:NR,role:xN,key:xR,from:r,encode:h},n)}(t,n,r.ticks,h,p,l))),c.labels&&(p=c.ticks?p:0,d.push(function(t,e,n,r,i,o){const a=UR(t,e),s=t.orient,u=t.scale,l=UL(s,-1,1),c=aO(a("labelFlush")),f=aO(a("labelFlushOffset")),h=a("labelAlign"),d=a("labelBaseline");let p,g=0===c||!!c;const m=uN(i);m.mult=l,m.offset=uN(a("labelPadding")||0),m.offset.mult=l;const y={scale:u,field:xR,band:.5,offset:IR(o.offset,a("labelOffset"))},v=qL(s,g?aU(u,c,'"left"','"right"','"center"'):{value:"center"},IL(s,"left","right")),_=qL(s,jL(s,"bottom","top"),g?aU(u,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=aU(u,c,`-(${f})`,f,0);g=g&&f;const b={opacity:$R,x:qL(s,y,m),y:PL(s,y,m)},w={enter:b,update:p={opacity:TR,text:{field:mR},x:b.x,y:b.y,align:v,baseline:_},exit:{opacity:$R,x:b.x,y:b.y}};cN(w,{dx:!h&&g?qL(s,x):null,dy:!d&&g?PL(s,x):null}),cN(w,{angle:a("labelAngle"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontWeight:a("labelFontWeight"),fontStyle:a("labelFontStyle"),limit:a("labelLimit"),lineHeight:a("labelLineHeight")},{align:h,baseline:d});const k=a("labelBound");let A=a("labelOverlap");return A=A||k?{separation:a("labelSeparation"),method:A,order:"datum.index",bound:k?{scale:u,orient:s,tolerance:k}:null}:void 0,p.align!==v&&(p.align=eU(p.align,v)),p.baseline!==_&&(p.baseline=eU(p.baseline,_)),WR({type:RR,role:_N,style:bR,key:xR,from:r,encode:w,overlap:A},n)}(t,n,r.labels,h,p,l))),c.domain&&d.push(function(t,e,n,r){const i=UR(t,e),o=t.orient;let a,s;const u={enter:a={opacity:$R},update:s={opacity:TR},exit:{opacity:$R}};cN(u,{stroke:i("domainColor"),strokeCap:i("domainCap"),strokeDash:i("domainDash"),strokeDashOffset:i("domainDashOffset"),strokeWidth:i("domainWidth"),strokeOpacity:i("domainOpacity")});const l=iU(t,0),c=iU(t,1);return a.x=s.x=qL(o,l,$R),a.x2=s.x2=qL(o,c),a.y=s.y=PL(o,l,$R),a.y2=s.y2=PL(o,c),WR({type:NR,role:yN,from:r,encode:u},n)}(t,n,r.domain,f)),c.title&&d.push(sU(t,n,r.title,f)),CL(LR({role:mN,from:f,encode:fN(lU(u,t),i,SR),marks:d,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:o,interactive:a,style:s}),e)}function lU(t,e){const n={enter:{},update:{}};return cN(n,{orient:t("orient"),offset:t("offset")||0,position:oO(e.position,0),titlePadding:t("titlePadding"),minExtent:t("minExtent"),maxExtent:t("maxExtent"),range:{signal:`abs(span(range("${e.scale}")))`},translate:t("translate"),format:e.format,formatType:e.formatType}),n}function cU(t,e,n){const r=V(t.signals),i=V(t.scales);return n||r.forEach((t=>HN(t,e))),V(t.projections).forEach((t=>function(t,e){const n=e.config.projection||{},r={};for(const n in t)"name"!==n&&(r[n]=aR(t[n],n,e));for(const t in n)null==r[t]&&(r[t]=aR(n[t],t,e));e.addProjection(t.name,r)}(t,e))),i.forEach((t=>function(t,e){const n=t.type||"linear";sp(n)||s("Unrecognized scale type: "+Dt(n)),e.addScale(t.name,{type:n,domain:void 0})}(t,e))),V(t.data).forEach((t=>NL(t,e))),i.forEach((t=>GO(t,e))),(n||r).forEach((t=>function(t,e){const n=e.getSignal(t.name);let r=t.update;t.init&&(r?s("Signals can not include both init and update expressions."):(r=t.init,n.initonly=!0)),r&&(r=BB(r,e),n.update=r.$expr,n.params=r.$params),t.on&&t.on.forEach((t=>pO(t,e,n.id)))}(t,e))),V(t.axes).forEach((t=>uU(t,e))),V(t.marks).forEach((t=>CL(t,e))),V(t.legends).forEach((t=>FL(t,e))),t.title&&BL(t.title,e),e.parseLambdas(),e}const fU=t=>fN({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t);function hU(t,e){const n=e.config,r=XN(e.root=e.add(VN())),i=function(t,e){const n=n=>oO(t[n],e[n]),r=[dU("background",n("background")),dU("autosize",iN(n("autosize"))),dU("padding",sN(n("padding"))),dU("width",n("width")||0),dU("height",n("height")||0)],i=r.reduce(((t,e)=>(t[e.name]=e,t)),{}),o={};return V(t.signals).forEach((t=>{ut(i,t.name)?t=ot(i[t.name],t):r.push(t),o[t.name]=t})),V(e.signals).forEach((t=>{ut(o,t.name)||ut(i,t.name)||r.push(t)})),r}(t,n);i.forEach((t=>HN(t,e))),e.description=t.description||n.description,e.eventConfig=n.events,e.legends=e.objectProperty(n.legend&&n.legend.layout),e.locale=n.locale;const o=e.add(xO()),a=e.add(kO(UN(fU(t.encode),BR,pN,t.style,e,{pulse:XN(o)}))),s=e.add(IO({layout:e.objectProperty(t.layout),legends:e.legends,autosize:e.signalRef("autosize"),mark:r,pulse:XN(a)}));e.operators.pop(),e.pushState(XN(a),XN(s),null),cU(t,e,i),e.operators.push(s);let u=e.add(_O({mark:r,pulse:XN(s)}));return u=e.add(UO({pulse:XN(u)})),u=e.add(PO({pulse:XN(u)})),e.addData("root",new kL(e,o,o,u)),e}function dU(t,e){return e&&e.signal?{name:t,update:e.signal}:{name:t,value:e}}function pU(t,e){this.config=t||{},this.options=e||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function gU(t){this.config=t.config,this.options=t.options,this.legends=t.legends,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}function mU(t){return(k(t)?yU:vU)(t)}function yU(t){const e=t.length;let n="[";for(let r=0;r0?",":"")+(A(e)?e.signal||mU(e):Dt(e))}return n+"]"}function vU(t){let e,n,r="{",i=0;for(e in t)n=t[e],r+=(++i>1?",":"")+Dt(e)+":"+(A(n)?n.signal||mU(n):Dt(n));return r+"}"}pU.prototype=gU.prototype={parse(t){return cU(t,this)},fork(){return new gU(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach((e=>{e.$ref=t.id})),t.refs=null),t},proxy(t){const e=t instanceof YN?XN(t):t;return this.add(RO({value:e}))},addStream(t){return this.streams.push(t),t.id=this.id(),t},addUpdate(t){return this.updates.push(t),t},finish(){let t,e;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function n(t,e,n){let r,i;t&&(r=t.data||(t.data={}),i=r[e]||(r[e]=[]),i.push(n))}for(t in this.data){e=this.data[t],n(e.input,t,"input"),n(e.output,t,"output"),n(e.values,t,"values");for(const r in e.index)n(e.index[r],t,"index:"+r)}return this},pushState(t,e,n){this._encode.push(XN(this.add(PO({pulse:t})))),this._parent.push(e),this._lookup.push(n?XN(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return F(this._parent)},encode(){return F(this._encode)},lookup(){return F(this._lookup)},markpath(){const t=this._markpath;return++t[t.length-1]},fieldRef(t,e){if(_t(t))return JN(t,e);t.signal||s("Unsupported field reference: "+Dt(t));const n=t.signal;let r=this.field[n];if(!r){const t={name:this.signalRef(n)};e&&(t.as=e),this.field[n]=r=XN(this.add(EO(t)))}return r},compareRef(t){let e=!1;const n=t=>rO(t)?(e=!0,this.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(e=!0,this.exprRef(t.expr)):t,r=V(t.field).map(n),i=V(t.order).map(n);return e?XN(this.add(bO({fields:r,orders:i}))):QN(r,i)},keyRef(t,e){let n=!1;const r=this.signals;return t=V(t).map((t=>rO(t)?(n=!0,XN(r[t.signal])):t)),n?XN(this.add(DO({fields:t,flat:e}))):function(t,e){const n={$key:t};return e&&(n.$flat=!0),n}(t,e)},sortRef(t){if(!t)return t;const e=tO(t.op,t.field),n=t.order||"ascending";return n.signal?XN(this.add(bO({fields:e,orders:this.signalRef(n.signal)}))):QN(e,n)},event(t,e){const n=t+":"+e;if(!this.events[n]){const r=this.id();this.streams.push({id:r,source:t,type:e}),this.events[n]=r}return this.events[n]},hasOwnSignal(t){return ut(this.signals,t)},addSignal(t,e){this.hasOwnSignal(t)&&s("Duplicate signal name: "+Dt(t));const n=e instanceof YN?e:this.add(VN(e));return this.signals[t]=n},getSignal(t){return this.signals[t]||s("Unrecognized signal name: "+Dt(t)),this.signals[t]},signalRef(t){return this.signals[t]?XN(this.signals[t]):(ut(this.lambdas,t)||(this.lambdas[t]=this.add(VN(null))),XN(this.lambdas[t]))},parseLambdas(){const t=Object.keys(this.lambdas);for(let e=0,n=t.length;er+Math.floor(o*t.random()),pdf:t=>t===Math.floor(t)&&t>=r&&t=i?1:(e-r+1)/o},icdf:t=>t>=0&&t<=1?r-1+Math.floor(t*o):NaN};return a.min(e).max(n)},t.randomKDE=ps,t.randomLCG=function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},t.randomLogNormal=_s,t.randomMixture=xs,t.randomNormal=ds,t.randomUniform=Ms,t.read=la,t.regressionConstant=Es,t.regressionExp=Bs,t.regressionLinear=$s,t.regressionLoess=Ls,t.regressionLog=Ts,t.regressionPoly=Os,t.regressionPow=zs,t.regressionQuad=Ns,t.renderModule=T_,t.repeat=At,t.resetDefaultLocale=function(){return Do(),To(),Ro()},t.resetSVGClipId=Yg,t.resetSVGDefIds=function(){Yg(),Gp=0},t.responseType=ua,t.runtimeContext=jB,t.sampleCurve=js,t.sampleLogNormal=gs,t.sampleNormal=ls,t.sampleUniform=bs,t.scale=ap,t.sceneEqual=q_,t.sceneFromJSON=Zy,t.scenePickVisit=qm,t.sceneToJSON=Jy,t.sceneVisit=Um,t.sceneZOrder=Lm,t.scheme=Ap,t.serializeXML=r_,t.setHybridRendererOptions=function(t){A_.svgMarkTypes=t.svgMarkTypes??["text"],A_.svgOnTop=t.svgOnTop??!0,A_.debug=t.debug??!1},t.setRandom=function(e){t.random=e},t.span=Et,t.splitAccessPath=u,t.stringValue=Dt,t.textMetrics=My,t.timeBin=Xr,t.timeFloor=br,t.timeFormatLocale=zo,t.timeInterval=Dr,t.timeOffset=Sr,t.timeSequence=Br,t.timeUnitSpecifier=nr,t.timeUnits=tr,t.toBoolean=Ct,t.toDate=St,t.toNumber=S,t.toSet=Tt,t.toString=$t,t.transform=Qa,t.transforms=Ja,t.truncate=Bt,t.truthy=p,t.tupleid=ma,t.typeParsers=Jo,t.utcFloor=Ar,t.utcInterval=Cr,t.utcOffset=$r,t.utcSequence=zr,t.utcdayofyear=fr,t.utcquarter=G,t.utcweek=hr,t.version="5.33.0",t.visitArray=zt,t.week=ar,t.writeConfig=D,t.zero=h,t.zoomLinear=j,t.zoomLog=I,t.zoomPow=W,t.zoomSymlog=H})); +//# sourceMappingURL=vega.min.js.map diff --git a/static/workspace-projects.js b/static/workspace-projects.js index 7ccb33be..641d5098 100644 --- a/static/workspace-projects.js +++ b/static/workspace-projects.js @@ -185,6 +185,7 @@ window.WorkspaceProjects = function ({select, roots, announce, switchSource, con finally{opening=false;$('project-open-submit').disabled=!aliases.length;} }; window.addEventListener('pagehide',()=>{activityView.stop();generation++;listGeneration++;openGeneration++;importGeneration++;controller?.abort();evidenceController?.abort();}); + $('open-project').disabled=false; return { initialize:refreshList, label:()=>detail?.name||entries.find(entry=>'project:'+entry.id===currentSource())?.name||'Project', diff --git a/static/workspace-real.js b/static/workspace-real.js index 99b41fa4..2617c4a0 100644 --- a/static/workspace-real.js +++ b/static/workspace-real.js @@ -117,7 +117,12 @@ window.WorkspaceCoordinator = function ({api, render, identity=()=>window.Tuldok const publicationOperation=path[0]==='publication-results'?(path.length===1?'runs.publication_result':path[1]==='model-evidence'?'runs.publication_model_evidence':path[1]==='artifact-segment'?'runs.publication_artifact_chunk':null):path[0]==='runs'?({'publication':'runs.publication_status','recover-publication':'runs.recover_publication','cancel-publication':'runs.cancel_publication'})[path[2]]:null; const coordinatorOperation=path[0]==='coordinator'?(path.length===1?'runs.coordinator_health':path[1]==='recover'?'runs.recover_coordinator':null):null; const phaseOperation=path[0]==='runs'&&path[2]==='phase-timings'?'runs.phase_timings':path[0]==='graphs'&&path[2]==='preparation-timings'?'graphs.preparation_timings':null; - if(operation==='runs.compare_scientific_evidence'){ + const retainedOperation=path[0]==='runs'&&path[2]==='retained-analysis'?(path.length===3?'runs.retained_analysis':path.length===4&&path[3]==='export'?'runs.export_retained_analysis':null):null; + if(retainedOperation){ + const pin=window.WorkspaceRetainedContracts?.[retainedOperation+'/1']; + if(selectedVersion!==1||!pin)throw Error('The exact retained analysis contract is unavailable.'); + headers['Tuldok-Operation-Contract']=retainedOperation+'/1/'+pin; + } else if(operation==='runs.compare_scientific_evidence'){ const pin=window.WorkspaceScientificContracts?.[operation+'/1']; if(selectedVersion!==1||!pin)throw Error('The exact scientific comparison contract is unavailable.'); headers['Tuldok-Operation-Contract']=operation+'/1/'+pin; @@ -148,7 +153,7 @@ window.WorkspaceCoordinator = function ({api, render, identity=()=>window.Tuldok if (!sha) throw Error('This model operation has no supported local contract: ' + operation); headers['Tuldok-Operation-Contract'] = operation + '/' + version + '/' + sha; } - const controller=publicationOperation||coordinatorOperation||phaseOperation||operation==='runs.compare_scientific_evidence'?new AbortController():null; + const controller=retainedOperation||publicationOperation||coordinatorOperation||phaseOperation||operation==='runs.compare_scientific_evidence'?new AbortController():null; const deadline=controller?setTimeout(()=>controller.abort(),Math.min(75000,Math.max(1,timeout))):null; const abort=()=>controller?.abort(); if(requestSignal?.aborted)abort();else requestSignal?.addEventListener('abort',abort,{once:true}); @@ -156,9 +161,9 @@ window.WorkspaceCoordinator = function ({api, render, identity=()=>window.Tuldok const response = await (globalThis.TuldokAuth?.fetch || fetch)("/api/workspace/" + route, { ...(body === undefined ? {} : {method: "POST", body: JSON.stringify(body)}), headers, ...(controller?{signal:controller.signal}:{}), }); - if(publicationOperation||coordinatorOperation||phaseOperation||operation==='runs.compare_scientific_evidence'){ + if(retainedOperation||publicationOperation||coordinatorOperation||phaseOperation||operation==='runs.compare_scientific_evidence'){ const length=response.headers.get('Content-Length'); - if(!/^\d+$/.test(length||'')||Number(length)>(operation==='runs.compare_scientific_evidence'?2*1024**2:phaseOperation?48*1024:coordinatorOperation?16*1024:16*1024**2))throw Error('Selected response has no supported bounded length.'); + if(!/^\d+$/.test(length||'')||Number(length)>(retainedOperation?256*1024:operation==='runs.compare_scientific_evidence'?2*1024**2:phaseOperation?48*1024:coordinatorOperation?16*1024:16*1024**2))throw Error('Selected response has no supported bounded length.'); } const value = await response.json(); if (!response.ok) { @@ -182,6 +187,11 @@ window.WorkspaceCoordinator = function ({api, render, identity=()=>window.Tuldok onImported:openImportedRecord,observePreparation:restart=>observePreparation(restart), onRun:result=>{run=result;runId=result.id;predictions=null;predictionError=null;remember();status("External attempt admitted with exact material approval.");openRun();}}); const model = WorkspaceModel({api, announce, openRecord, getIntent:()=>loadGeneration, getView:()=>view, + onAccessFailure:(error,id,credential)=>{ + const currentCredential=window.TuldokAuth?.identity()?.credential_id; + if(view!=='runs'||runId!==id||currentCredential&¤tCredential!==credential)return; + ++runGeneration;run=null;runs=[];predictions=null;model.invalidate();fieldEvidence.invalidate();scientific.invalidate();candidatePackages.invalidate();publication.invalidate();coordinator.invalidate();phases.invalidate();preparation.invalidate();renderRuns();status(error.message,true); + }, openRun:result=>{run=result;runId=result.id;remember();if(view==='runs')loadRuns(runId);else openRun();}}); const publication = window.WorkspacePublication({api,render:()=>{if(view==='runs')renderRuns();}}); const coordinator = window.WorkspaceCoordinator({api,render:renderCoordinator}); @@ -469,6 +479,7 @@ window.WorkspaceCoordinator = function ({api, render, identity=()=>window.Tuldok if (id) { try { detail = await api("runs/" + encoded(id)); } catch (error) { + if ([401,403].includes(error.status)) throw error; // The list's durable receipt remains useful when verifying its // artifacts fails. Keep other runs reachable; never trust cached // metrics or offer artifacts from the failed detail read. @@ -483,7 +494,7 @@ window.WorkspaceCoordinator = function ({api, render, identity=()=>window.Tuldok } if (detail?.state === "completed" && !integrityKind(detail.graph) && !external.isGraph(detail.graph) && !detail.artifact_status) { try { rows = await api("runs/" + encoded(id) + "/predictions?split=" + split); } - catch (error) { rowsError = error.message; } + catch (error) { if ([401,403].includes(error.status)) throw error; rowsError = error.message; } } if (!current()) return; await model.load(detail,current); @@ -500,8 +511,14 @@ window.WorkspaceCoordinator = function ({api, render, identity=()=>window.Tuldok packageRead.then(()=>{if(current())renderRuns();}); coordinatorRead.then(()=>{if(current())renderCoordinator();}); } catch (error) { - if (!current()) return; - if ([401,403].includes(error.status)) {run=null;runs=[];predictions=null;model.invalidate();fieldEvidence.invalidate();scientific.invalidate();candidatePackages.invalidate();publication.invalidate();coordinator.invalidate();phases.invalidate();preparation.invalidate();renderRuns();status(error.message,true);return;} + // A denied fetch may already have cleared the session identity. It must + // still clear this generation's private DOM, while an old credential's + // late denial cannot invalidate a newer session or navigation. + const credential=window.TuldokAuth?.identity()?.credential_id; + const denied=[401,403].includes(error.status); + const currentDenial=denied&&generation===runGeneration&&view==='runs'&&(!credential||credential===session); + if (!current()&&!currentDenial) return; + if (denied) {++runGeneration;run=null;runs=[];predictions=null;model.invalidate();fieldEvidence.invalidate();scientific.invalidate();candidatePackages.invalidate();publication.invalidate();coordinator.invalidate();phases.invalidate();preparation.invalidate();renderRuns();status(error.message,true);return;} if (!quiet) {runsRoot.innerHTML = `
${coordinator.html()}
`;coordinator.bind(runsRoot);coordinatorRead.then(()=>{if(current())renderCoordinator();});} else status("Run refresh failed: " + error.message + " Saved results are retained; use Refresh to retry.", true); runsRoot.querySelector("#real-runs-retry")?.addEventListener("click", () => loadRuns(chosen)); diff --git a/static/workspace-service.js b/static/workspace-service.js index 64617ab6..772361d3 100644 --- a/static/workspace-service.js +++ b/static/workspace-service.js @@ -676,15 +676,52 @@ const packages=state.packages||[],verified=state.state==='fresh_verified'; return `

Package: ${packages.length?'complete':'not exported'}. Fresh inference: ${verified?'verified in a separate consumer Run':'not verified'}.

${packages.map(item=>`

Download verified package · ${esc(item.bytes.toLocaleString())} bytes · SHA256 ${esc(item.sha256)}
Completed package Run ${esc(item.run_id)}

`).join('')}${verified?'

Fresh inference reproduced the retained fixed probes. The candidate remains diagnostic.

':''}${(state.verifications||[]).map(item=>`

Separate fresh verifier Run ${esc(item.run_id)} · package ${esc(item.receipt.package_sha256)}

`).join('')}${state.verifications?.length?`
Fresh consumer verification receipts
${esc(JSON.stringify(state.verifications,null,2))}
`:''}
`; }; - window.WorkspaceModel = function ({api, announce, openRun, openRecord, getIntent, getView}) { + window.WorkspaceModel = function ({api:transport, announce, openRun, openRecord, getIntent, getView, onAccessFailure=()=>{}}) { let definition = null, releases = [], studies = [], root = null, busy = false, message = '', failed = false, evidence = null, evidenceError = '', comparison = null, checkpoint = null, probe = null, compareId = '', generation = 0, queryIntent = 0, detailPredictions = null, studyDetail = null, candidate = null, candidateBusy = false, candidateError = '', foreignPending = false, compareTarget = null, compareTargetRun = null, compareCheckpoint = '', compareMetric = '', compareMode = 'paired', compareBusy = false, compareIntent = 0, compareTargetIntent = 0, checkpointBusy = false, checkpointIntent = 0, packageState = null, packageError = '', exportSetup = null, exportJob = null, exportBusy = false, exportDraft = {mode:'package',root:'',directory:'',runtime:'',packageRun:''}; let pendingComparison=null; + let retainedView=null,activeRun=null; let config = {name: 'TinyCNN experiment', release: '', widths: [16,32,64], input_size: 96, epochs: 3, seed: 17}; let journal = history.state?.modelTrial || null; const identity = () => window.TuldokAuth?.identity(); const owner = () => identity()?.kind === 'owner'; + // Denials must reach the Runs owner before local presentation catches can + // absorb them, including after auth.js clears a revoked session identity. + async function api(...args){ + const runId=activeRun,credential=identity()?.credential_id,version=generation; + try{return await transport(...args);} + catch(error){ + if(runId&&activeRun===runId&&version===generation&&!args[4]?.aborted&&[401,403].includes(error.status))onAccessFailure(error,runId,credential); + throw error; + } + } + function disposeRetained(){retainedView?.dispose();retainedView=null;} + function retainedHTML(run){ + return run?.graph?.recipe===recipe&&run.state==='completed'&&evidence?.state==='verified'&& + evidence.metric_definition_hashes?.accuracy&&run.artifacts?.some(item=>item.name==='model-evidence.json')? + '
':''; + } + function bindRetained(node,run,current){ + disposeRetained(); + const target=node.querySelector('[data-retained-analysis]'); + if(!target||!current()||!retainedHTML(run))return; + if(!window.WorkspaceRetainedAnalysis){target.textContent='Retained chart assets are unavailable. Refresh to retry.';return;} + const artifact=run.artifacts.find(item=>item.name==='model-evidence.json'); + const selected=evidence.checkpoint_index.entries.find(item=>item.checkpoint.sha256===checkpoint)||evidence.checkpoint_index.entries[0]; + const authority=JSON.stringify([identity()?.catalog_id,identity()?.actor_id,identity()?.credential_id]); + const valid=()=>current()&&authority===JSON.stringify([identity()?.catalog_id,identity()?.actor_id,identity()?.credential_id]); + retainedView=window.WorkspaceRetainedAnalysis.mount(target,{load:async(request,options)=>{ + if(!valid())throw Error('Retained result authority changed.'); + const {run_id,...body}=request; + const value=await api('runs/'+enc(run_id)+'/retained-analysis'+(options.export?'/export':''),body,1,10000,options.signal); + if(!valid())throw Error('Retained result authority changed.'); + return value; + }}); + void retainedView.update({query_id:'retained_checkpoint_examples',query_version:1,run_id:run.id, + evaluation_sha256:artifact.sha256,checkpoint_sha256:selected.checkpoint.sha256, + metric_id:'accuracy',metric_definition_sha256:evidence.metric_definition_hashes.accuracy,limit:1,offset:0},authority); + } const remember = () => history.replaceState({...history.state, modelTrial: journal}, ''); function notice(text, error = false) { message = text; failed = error; announce(text,error); } function scope() { @@ -791,8 +828,9 @@ sessionChanged() {pendingComparison=null;studies=[];studyDetail=null;message='';exportDraft={mode:'package',root:'',directory:'',runtime:'',packageRun:''};config={name:'TinyCNN experiment',release:'',widths:[16,32,64],input_size:96,epochs:3,seed:17};const saved=history.state?.modelTrial;foreignPending=!!(saved&&saved.actor!==identity()?.actor_id&&(saved.admission||saved.uncertain));if(journal?.actor!==identity()?.actor_id)journal=null;}, mount(node) {root=node;render();}, async refresh(current) {try{const result=await api('studies');if(current())studies=result.studies;}catch(error){if(current())notice('Saved studies unavailable: '+error.message,true);}}, - invalidate(preserveComparison=false) {if(!preserveComparison)pendingComparison=null;generation++;queryIntent++;compareIntent++;compareTargetIntent++;checkpointIntent++;checkpointBusy=false;evidence=null;comparison=null;checkpoint=null;probe=null;evidenceError='';detailPredictions=null;candidate=null;candidateError='';compareTarget=null;compareTargetRun=null;compareCheckpoint='';compareBusy=false;packageState=null;packageError='';exportSetup=null;exportJob=null;}, + invalidate(preserveComparison=false) {activeRun=null;disposeRetained();if(!preserveComparison)pendingComparison=null;generation++;queryIntent++;compareIntent++;compareTargetIntent++;checkpointIntent++;checkpointBusy=false;evidence=null;comparison=null;checkpoint=null;probe=null;evidenceError='';detailPredictions=null;candidate=null;candidateError='';compareTarget=null;compareTargetRun=null;compareCheckpoint='';compareBusy=false;packageState=null;packageError='';exportSetup=null;exportJob=null;}, async load(run,current) { + disposeRetained();activeRun=run?.id||null; if(pendingComparison&&(pendingComparison.runId!==run?.id||pendingComparison.credential!==identity()?.credential_id))pendingComparison=null; const intent=++queryIntent;compareIntent++;compareTargetIntent++;checkpointIntent++;checkpointBusy=false; evidence=null;comparison=null;evidenceError='';candidate=null;candidateError='';packageState=null;packageError='';exportJob=null;compareTarget=null;compareTargetRun=null;compareCheckpoint='';compareId='';compareBusy=false; @@ -805,8 +843,8 @@ } evidence=value; const savedCandidate=history.state?.modelCandidates?.[run.id]; - if(savedCandidate?.actor===identity()?.actor_id){try{const saved=await api('candidates/'+enc(savedCandidate.id));if(current()&&intent===queryIntent){candidate=saved;await loadPackage(saved,current,intent);}}catch(error){if(current()&&intent===queryIntent)candidateError=error.message;}} - }catch(error){if(current()&&intent===queryIntent)evidenceError=error.message;} + if(savedCandidate?.actor===identity()?.actor_id){try{const saved=await api('candidates/'+enc(savedCandidate.id));if(current()&&intent===queryIntent){candidate=saved;await loadPackage(saved,current,intent);}}catch(error){if([401,403].includes(error.status))throw error;if(current()&&intent===queryIntent)candidateError=error.message;}} + }catch(error){if([401,403].includes(error.status))throw error;if(current()&&intent===queryIntent)evidenceError=error.message;} }, html(run,predictions) { detailPredictions=predictions; @@ -814,9 +852,9 @@ if(evidenceError)return `

Model evidence unavailable

No cached checkpoint or probe values are shown. Refresh saved runs to retry.

`; if(!evidence)return '

Model evidence has not been published yet.

'; if(evidence.state==='unsupported')return `

${esc(evidence.reason)}

`; - return evidenceHTML(evidence,run); + return evidenceHTML(evidence,run)+retainedHTML(run); }, - bind(node,run,runs,rerender,current) {bindEvidence(node,run,runs,rerender,current);}, + bind(node,run,runs,rerender,current) {bindEvidence(node,run,runs,rerender,current);bindRetained(node,run,current);}, }; function evidenceHTML(value,run) { // Index and checkpoint/probe projections are supplied by the same Runs query. @@ -846,7 +884,7 @@ const saved=history.state?.modelExports?.[value.ref.id];exportJob=saved?.actor===identity()?.actor_id?saved:null; if(!contracts['studies.package_state'])return; try{const state=await api('candidates/'+enc(value.ref.id)+'/package-state');if(!current()||intent!==queryIntent)return;packageState=state;} - catch(error){if(current()&&intent===queryIntent)packageError=error.message;} + catch(error){if([401,403].includes(error.status))throw error;if(current()&&intent===queryIntent)packageError=error.message;} } function exportHTML() { if(!contracts['studies.package_state'])return '

Package preparation is unavailable in this installed interface. No package or fresh verification is claimed.

'; diff --git a/static/workspaces.css b/static/workspaces.css index c5cfb282..cfd02034 100644 --- a/static/workspaces.css +++ b/static/workspaces.css @@ -1158,3 +1158,10 @@ details > p { .scientific-comparison th:first-child { white-space:normal; overflow-wrap:anywhere; min-width:10rem; max-width:24rem; } .scientific-comparison details { margin:12px 0; } .scientific-comparison input { max-width:100%; } +.retained-analysis { min-width:0; max-width:100%; margin-block:1rem; } +.retained-analysis > div { min-width:0; max-width:100%; } +.retained-analysis table { width:100%; table-layout:fixed; border-collapse:collapse; font-size:.8rem; } +.retained-analysis th,.retained-analysis td { padding:.4rem; vertical-align:top; overflow-wrap:anywhere; border-bottom:1px solid var(--line,#b6bfcb); } +.retained-analysis pre { white-space:pre-wrap; overflow-wrap:anywhere; } +.retained-analysis button { max-width:100%; margin:.25rem; white-space:normal; } +.retained-analysis button:focus-visible,.retained-analysis input:focus-visible { outline:3px solid var(--accent,#fbbf24); outline-offset:2px; } diff --git a/static/workspaces.html b/static/workspaces.html index 733346cc..b9bd23ee 100644 --- a/static/workspaces.html +++ b/static/workspaces.html @@ -3,6 +3,7 @@ + Tuldok · Dataset workspaces @@ -24,12 +25,12 @@
CONTEXT
- +
Loading workspace…
Local preview @@ -133,6 +134,11 @@

Unsaved fixture edits

+ + + + + diff --git a/tests/browser_model_development.cjs b/tests/browser_model_development.cjs index 62087636..6f907fa4 100644 --- a/tests/browser_model_development.cjs +++ b/tests/browser_model_development.cjs @@ -553,11 +553,16 @@ function launch(command, args, options) { pausedRequest=null;await click('[data-model-checkpoint]');await until(()=>pausedRequest); await send('Fetch.fulfillRequest',{requestId:pausedRequest,responseCode:403,responseHeaders:[{name:'Content-Type',value:'application/json'}],body:Buffer.from(JSON.stringify({error:'Evidence access revoked',code:'forbidden'})).toString('base64')}); await send('Fetch.disable');pausedRequest=null; - await until(()=>text('.model-evidence').then(value=>value?.includes('Evidence access revoked'))); - assert.equal(await evaluate('document.querySelectorAll("[data-model-checkpoint]").length'),0); - assert.equal(await evaluate('!!document.getElementById("model-probe")'),false); - await click('#real-runs-refresh');await until(()=>evaluate('document.querySelectorAll("[data-model-checkpoint]").length===2')); - check('H5 delayed query cannot override navigation; denied evidence clears checkpoint/probe values and explicit refresh recovers'); + // Runs owns current denials and removes every private projection, including + // the model panel that used to contain this error. Refresh is an explicit read. + await until(()=>text('#real-runs-root .real-status').then(value=>value?.includes('Evidence access revoked'))); + const deniedProjection=await evaluate(`({status:document.querySelector('#real-runs-root .real-status')?.textContent, + privateNodes:document.querySelectorAll('#real-runs-root .model-evidence,#real-runs-root .metric-grid,#real-runs-root [data-retained-analysis],#real-runs-root [data-real-run],#real-runs-root [data-model-checkpoint],#real-runs-root #model-probe').length})`); + assert.equal(deniedProjection.privateNodes,0,'A current evidence denial clears all private Runs content'); + await click('#real-runs-refresh'); + await until(()=>evaluate(`!!document.querySelector('[data-real-run="${third.id}"][aria-current="true"]')&&document.querySelectorAll('[data-model-checkpoint]').length===2&&!!document.querySelector('#real-runs-root .metric-grid')&&!!document.querySelector('#real-runs-root [data-retained-analysis] svg')`)); + const recoveredProjection={run_id:third.id,checkpoint_count:await evaluate('document.querySelectorAll("[data-model-checkpoint]").length'),retained_chart:true}; + check('H5 delayed query cannot override navigation; denied evidence clears all private Runs content and explicit refresh recovers the exact Run, checkpoints, metrics and retained chart'); await screenshot('corrected-evidence-390',390,844);await screenshot('corrected-evidence-1440',1440,900); // Native system preference, keyboard focus and real retained evidence at both requested widths. await send('Emulation.setEmulatedMedia',{features:[{name:'prefers-color-scheme',value:'dark'}]}); @@ -587,7 +592,7 @@ function launch(command, args, options) { (lineageProof.dark_checks??=[]).push(colors); } assert.deepEqual(errors,[]);assert.ok(!serverErrors.includes('Traceback'),serverErrors); - fs.writeFileSync(path.join(report,'receipt.json'),JSON.stringify({source_commit:execFileSync('git',['rev-parse','HEAD'],{cwd:root,encoding:'utf8'}).trim(),dirty:!!execFileSync('git',['status','--porcelain'],{cwd:root,encoding:'utf8'}).trim(),command:'node tests/browser_model_development.cjs',source_sha256:sourceHashes,dark_checks:darkChecks,catalog_path:path.join(temporary,'data'),browser:(await send('Browser.getVersion')).product,checks,captures,lineage:lineageProof,compare_selectors:compareRequests,run_ids:[run.id,second.id,third.id],release_ids:[releaseId,correctedId],training:true,quality_claim:false,fixture_provenance:'12 CC0 authored independent images imported and reviewed through ordinary Data UI',access_projection_test:'403 transport substitution; backend tests own actual revoke enforcement'},null,2)); + fs.writeFileSync(path.join(report,'receipt.json'),JSON.stringify({source_commit:execFileSync('git',['rev-parse','HEAD'],{cwd:root,encoding:'utf8'}).trim(),dirty:!!execFileSync('git',['status','--porcelain'],{cwd:root,encoding:'utf8'}).trim(),command:'node tests/browser_model_development.cjs',source_sha256:sourceHashes,dark_checks:darkChecks,catalog_path:path.join(temporary,'data'),browser:(await send('Browser.getVersion')).product,checks,captures,lineage:lineageProof,compare_selectors:compareRequests,run_ids:[run.id,second.id,third.id],release_ids:[releaseId,correctedId],training:true,quality_claim:false,fixture_provenance:'12 CC0 authored independent images imported and reviewed through ordinary Data UI',access_projection_test:'403 transport substitution; backend tests own actual revoke enforcement',denied_projection:deniedProjection,recovered_projection:recoveredProjection},null,2)); console.log('PASS real model development gate:',report); })().catch(async error=>{ console.error(error);console.error('Application stderr:',serverErrors); diff --git a/tests/browser_retained_analysis.cjs b/tests/browser_retained_analysis.cjs new file mode 100644 index 00000000..c1569378 --- /dev/null +++ b/tests/browser_retained_analysis.cjs @@ -0,0 +1,121 @@ +// Actual Chromium renderer/CSP test over authored boundary data. No DB or Runs claim. +'use strict'; +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const os = require('node:os'); +const path = require('node:path'); +const {spawn} = require('node:child_process'); +const {waitForDebugger} = require('./browser_startup.cjs'); +const root = path.resolve(__dirname, '..'); +const profile = fs.mkdtempSync(path.join(os.tmpdir(), 'tuldok-retained-renderer-')); +const children = []; +const pause = ms => new Promise(resolve => setTimeout(resolve, ms)); +async function until(test) { for (let i = 0; i < 200; ++i) { if (await test()) return; await pause(50); } throw Error('Renderer assertion timed out'); } +(async () => { + let output = '', serverError = ''; + const server = spawn(process.env.PYTHON || 'python3', ['-u', 'tests/retained_analysis_browser_fixture.py'], {cwd: root}); children.push(server); + server.stdout.on('data', chunk => output += chunk); server.stderr.on('data', chunk => serverError += chunk); + await until(() => /^\d+\n/.test(output)); + const base = 'http://127.0.0.1:' + output.trim(); + const browser = spawn(process.env.BROWSER || '/usr/bin/chromium', ['--headless', '--no-sandbox', '--disable-gpu', '--remote-debugging-port=0', '--user-data-dir=' + profile, 'about:blank'], {stdio: 'ignore'}); children.push(browser); + // Headless/no-sandbox is confined to this isolated disposable browser fixture; + // it is not a product startup configuration or an application sandbox claim. + const port = await waitForDebugger(browser, path.join(profile, 'DevToolsActivePort')); + const targets = await (await fetch(`http://127.0.0.1:${port}/json`)).json(); + const ws = new WebSocket(targets.find(target => target.type === 'page').webSocketDebuggerUrl); + await new Promise(resolve => ws.addEventListener('open', resolve)); + let id = 0; const calls = new Map(), errors = [], external = []; + ws.addEventListener('message', event => { + const value = JSON.parse(event.data); + if (value.id) { const call = calls.get(value.id); calls.delete(value.id); value.error ? call.reject(Error(JSON.stringify(value.error))) : call.resolve(value.result); } + if (value.method === 'Runtime.exceptionThrown') errors.push(value.params.exceptionDetails.text); + if (value.method === 'Network.requestWillBeSent' && !value.params.request.url.startsWith(base) && !value.params.request.url.startsWith('data:')) external.push(value.params.request.url); + }); + const send = (method, params = {}) => new Promise((resolve, reject) => { const next = ++id; calls.set(next, {resolve, reject}); ws.send(JSON.stringify({id: next, method, params})); }); + const evaluate = async expression => { + const result = await send('Runtime.evaluate', {expression, returnByValue: true, awaitPromise: true}); + if (result.exceptionDetails) throw Error(result.exceptionDetails.exception?.description || result.exceptionDetails.text); + return result.result.value; + }; + await send('Runtime.enable'); await send('Network.enable'); await send('Page.enable'); + await send('Page.navigate', {url: base}); + const ready = () => evaluate('!!document.querySelector("svg") && document.querySelector("#analysis").getAttribute("aria-busy")==="false"'); + await until(async () => { + const alert = await evaluate('document.querySelector("[role=alert]")?.textContent'); + if (alert) throw Error(alert); + return ready(); + }); + assert.equal(await evaluate('document.querySelector("[role=alert]")?.textContent || ""'), ''); + assert.match(await evaluate('document.body.textContent'), /Epoch 1: 0.125/); + assert.match(await evaluate('document.querySelector("tbody").textContent'), /frozen-example-first/); + await evaluate('document.querySelectorAll("button")[1].focus()'); + await send('Input.dispatchKeyEvent', {type: 'keyDown', key: 'Enter', code: 'Enter', text: '\r', windowsVirtualKeyCode: 13}); + await send('Input.dispatchKeyEvent', {type: 'keyUp', key: 'Enter', code: 'Enter', windowsVirtualKeyCode: 13}); + await until(() => evaluate('document.querySelector("tbody")?.textContent.includes("frozen-example-second") && document.querySelector("#analysis").getAttribute("aria-busy")==="false"')).catch(async error => { + throw Error(error.message + ' ' + JSON.stringify(await evaluate('({text:document.body.textContent,csp:fixtureCsp,requests:fixtureRequests,selection:fixtureSelections})')) + ' errors=' + JSON.stringify(errors)); + }); + assert.equal(await evaluate('document.activeElement.tagName'), 'H3'); + assert.equal(await evaluate('fixtureSelections.length'), 1); + const point = await evaluate('(()=>{const b=document.querySelector("g.mark-symbol path").getBoundingClientRect();return {x:b.x+b.width/2,y:b.y+b.height/2}})()'); + await send('Input.dispatchMouseEvent', {type: 'mousePressed', button: 'left', clickCount: 1, ...point}); + await send('Input.dispatchMouseEvent', {type: 'mouseReleased', button: 'left', clickCount: 1, ...point}); + await until(() => evaluate('document.querySelector("tbody")?.textContent.includes("frozen-example-first") && document.querySelector("#analysis").getAttribute("aria-busy")==="false"')); + assert.equal(await evaluate('fixtureSelections.length'), 2); + await evaluate('[...document.querySelectorAll("button")].find(button=>button.textContent==="Next examples").click()'); + await until(() => evaluate('fixtureAdapter.selection()?.offset === 1')); + assert.match(await evaluate('document.querySelector("tbody").textContent'), /frozen-example-first-1/); + await evaluate('document.querySelector("input").click()'); await until(ready); + assert.equal(await evaluate('fixtureAdapter.selection().errors_only'), true); + await send('Emulation.setDeviceMetricsOverride', {width: 390, height: 844, deviceScaleFactor: 1, mobile: false}); await pause(200); + assert.equal(await evaluate('document.documentElement.scrollWidth <= 390'), true); + await evaluate('fixtureMode="stale"; void fixtureStart()'); + await until(() => evaluate('fixturePending.length === 1')); + await evaluate('fixtureMode="revoked"; void fixtureStart()'); + await until(() => evaluate('!!document.querySelector("[role=alert]")')); + await evaluate('fixturePending.shift()()'); await pause(100); + assert.equal(await evaluate('!!document.querySelector("svg,tbody")'), false); + assert.equal(await evaluate('fixtureAdapter.selection()'), null); + for (const mode of ['malformed', 'oversized', 'support-mismatch', 'ordinal-mismatch', 'count-mismatch', 'missing-provenance', 'missing-definition', 'missing-column-type']) { + await evaluate(`fixtureMode=${JSON.stringify(mode)}; void fixtureStart()`); + await until(() => evaluate('document.querySelector("[role=alert]")?.textContent.includes("invalid")')); + assert.equal(await evaluate('!!document.querySelector("svg,tbody")'), false); + } + for (const mode of ['malformed', 'oversized']) { + await evaluate(`fixtureMode="normal"; fixtureSpecMode=${JSON.stringify(mode)}; void fixtureStart()`); + await until(() => evaluate('!!document.querySelector("[role=alert]")')); + assert.match(await evaluate('document.querySelector("[role=alert]").textContent'), mode === 'oversized' ? /specification exceeds/ : /specification identity/); + assert.equal(await evaluate('!!document.querySelector("svg,tbody")'), false); + assert.equal(await evaluate('fixtureRequests.at(-1).aborted()'), true); + } + await evaluate('fixtureSpecMode="normal"'); + await evaluate('fixtureMode="normal"; void fixtureStart()'); await until(ready); + const downloadPath = path.join(profile, 'downloads'); fs.mkdirSync(downloadPath); + await send('Browser.setDownloadBehavior', {behavior: 'allow', downloadPath}); + await evaluate('[...document.querySelectorAll("button")].find(button=>button.textContent==="Export this page").click()'); + await until(() => fs.existsSync(path.join(downloadPath, 'retained-analysis-page.json'))); + const exported = JSON.parse(fs.readFileSync(path.join(downloadPath, 'retained-analysis-page.json'), 'utf8')); + assert.deepEqual(exported.curve.map(point => point.value), [.125, .375]); + assert.equal(exported.provenance.evaluation_sha256, 'd'.repeat(64)); + await evaluate('fixtureMode="revoked"; [...document.querySelectorAll("button")].find(button=>button.textContent==="Export this page").click()'); + await until(() => evaluate('document.querySelector("[role=alert]")?.textContent.includes("export failed")')); + assert.equal(await evaluate('!!document.querySelector("svg,tbody")'), false); + assert.equal(await evaluate('fixtureRequests.at(-1).exported'), true); + await send('Page.reload', {ignoreCache: true}); await until(ready); + assert.match(await evaluate('document.querySelector("tbody").textContent'), /frozen-example-first/); + assert.deepEqual(await evaluate('fixtureCsp'), []); + assert.deepEqual(errors, []); assert.deepEqual(external, []); + await evaluate('fixtureAdapter.dispose()'); + assert.equal(await evaluate('document.querySelector("#analysis").childElementCount'), 0); + console.log(JSON.stringify({status: 'passed', evidence: 'actual-headless-Chromium-authored-renderer-fixture', checks: ['strict CSP/interpreter', 'self-hosted/offline external assets', 'exact numbers', 'keyboard linked selection/focus', 'visible error filter', '390px layout', 'stale reply after revocation', 'malformed/oversized response and spec rejection', 'support/ordinal/provenance/type validation', 'fresh export authorization path', 'cold page reopen', 'dispose']}, null, 2)); + ws.close(); +})().catch(error => { console.error(error); process.exitCode = 1; }).finally(async () => { + for (const child of children.reverse()) { + if (child.exitCode !== null || child.signalCode !== null) continue; + await new Promise(resolve => { + const timer = setTimeout(() => child.kill('SIGKILL'), 3000); + child.once('exit', () => { clearTimeout(timer); resolve(); }); + child.kill('SIGTERM'); + }); + } + fs.rmSync(profile, {recursive: true, force: true}); +}); diff --git a/tests/browser_retained_analysis_actual.cjs b/tests/browser_retained_analysis_actual.cjs new file mode 100644 index 00000000..aec6388a --- /dev/null +++ b/tests/browser_retained_analysis_actual.cjs @@ -0,0 +1,156 @@ +// Authenticated Runs acceptance over the production hooks and scoped CSP. +// Uses the existing retained fixture and normal app.py; no handler/data substitutes. +'use strict'; +const assert = require('node:assert/strict'), fs = require('node:fs'), os = require('node:os'), path = require('node:path'); +const {spawn} = require('node:child_process'); +const {waitForDebugger} = require('./browser_startup.cjs'); +const fixtureAuth = require('./auth_helpers.cjs').authenticatedFixture(); +const root = path.resolve(__dirname, '..'), children = [], profile = fs.mkdtempSync(path.join(os.tmpdir(), 'tuldok-retained-actual-browser-')); +const pause = ms => new Promise(resolve => setTimeout(resolve, ms)); +async function until(check, message) { for (let i = 0; i < 300; i++) { if (await check()) return; await pause(50); } throw Error(message || 'Actual Runs acceptance timed out'); } +async function stop(child) { + if (child.exitCode !== null || child.signalCode !== null) return; + await new Promise(resolve => { + const timer = setTimeout(() => child.kill('SIGKILL'), 5000); + child.once('exit', () => { clearTimeout(timer); resolve(); }); child.kill('SIGINT'); + }); +} +(async () => { + if (process.env.TULDOK_ANALYSIS_HTTP !== '1' || !process.env.TULDOK_ANALYSIS_FIXTURE) throw Error('Explicit integrated acceptance and a prepared actual retained fixture are required.'); + const fixture = JSON.parse(fs.readFileSync(path.join(process.env.TULDOK_ANALYSIS_FIXTURE, 'fixture.json'), 'utf8')); + let output = '', serverErrors = ''; + let server = spawn(process.env.PYTHON || 'python3', ['-u', 'app.py', '--port', '0', '--data', fixture.catalog_path], {cwd: root}); children.push(server); + server.stdout.on('data', chunk => output += chunk); server.stderr.on('data', chunk => serverErrors += chunk); + await until(() => /127\.0\.0\.1:(\d+)/.test(output), 'Actual app did not publish its local endpoint'); + const base = 'http://127.0.0.1:' + output.match(/127\.0\.0\.1:(\d+)/)[1]; + await fixtureAuth.register(base, fixture.catalog_path, root); + const response = await fixtureAuth.fetch(base + '/api/agent/capabilities'); + assert.equal(response.status, 200); + const capabilities = await response.json(); + const operation = capabilities.operations.find(item => item.id === 'runs.retained_analysis' || item.operation_id === 'runs.retained_analysis'); + assert.ok(operation, 'The coordinated retained-analysis operation must be registered before actual browser acceptance'); + const contract = operation.contracts.find(item => item.version === 1); + assert.ok(contract?.sha256, 'The browser must use the exact named v1 contract'); + const query = async body => { + const {run_id, ...arguments_} = body; + const reply = await fixtureAuth.fetch(base + '/api/workspace/runs/' + run_id + '/retained-analysis', { + method: 'POST', headers: {'Content-Type': 'application/json', 'Tuldok-Operation-Contract': 'runs.retained_analysis/1/' + contract.sha256}, body: JSON.stringify(arguments_) + }); + assert.equal(reply.status, 200); return reply.json(); + }; + const expected = await query(fixture.request); + const browser = spawn(process.env.BROWSER || '/usr/bin/chromium', ['--headless', '--no-sandbox', '--disable-gpu', '--remote-debugging-port=0', '--user-data-dir=' + profile, 'about:blank'], {stdio: 'ignore'}); children.push(browser); + const debuggerPort = await waitForDebugger(browser, path.join(profile, 'DevToolsActivePort')); + const targets = await (await fetch(`http://127.0.0.1:${debuggerPort}/json`)).json(); + const ws = new WebSocket(targets.find(item => item.type === 'page').webSocketDebuggerUrl); + await new Promise(resolve => ws.addEventListener('open', resolve)); + let sequence = 0, held, aborted=0; const calls = new Map(), errors = [], remote = [], actualReplies = [], urls = new Map(); + const send = (method, params = {}) => new Promise((resolve, reject) => { const id = ++sequence; calls.set(id, {resolve, reject}); ws.send(JSON.stringify({id, method, params})); }); + ws.addEventListener('message', event => { + const value = JSON.parse(event.data); + if (value.id) { const pending = calls.get(value.id); calls.delete(value.id); value.error ? pending.reject(Error(JSON.stringify(value.error))) : pending.resolve(value.result); } + if (value.method === 'Runtime.exceptionThrown') errors.push(value.params.exceptionDetails.text); + if (value.method === 'Network.requestWillBeSent' && /^https?:/.test(value.params.request.url) && !value.params.request.url.startsWith(base)) remote.push(value.params.request.url); + if (value.method === 'Network.requestWillBeSent') urls.set(value.params.requestId,value.params.request.url); + if (value.method === 'Network.loadingFailed' && value.params.canceled && urls.get(value.params.requestId)?.endsWith('/retained-analysis')) aborted++; + if (value.method === 'Fetch.requestPaused') held = value.params; + if (value.method === 'Network.responseReceived' && value.params.response.url.endsWith('/retained-analysis')) actualReplies.push(value.params.response.status); + }); + const evaluate = async expression => { + const value = await send('Runtime.evaluate', {expression, returnByValue: true, awaitPromise: true}); + if (value.exceptionDetails) throw Error(value.exceptionDetails.exception?.description || value.exceptionDetails.text); + return value.result.value; + }; + const host = '([...document.querySelectorAll("#real-runs-root h3")].find(node=>node.textContent==="Retained checkpoint analysis")?.parentElement)'; + const ready = () => evaluate(`!!${host}?.querySelector('svg') && ${host}?.getAttribute('aria-busy')==='false'`); + await send('Runtime.enable'); await send('Network.enable'); await send('Page.enable'); + await send('Page.addScriptToEvaluateOnNewDocument',{source:"window.retainedCSPViolations=[];document.addEventListener('securitypolicyviolation',event=>window.retainedCSPViolations.push(event.violatedDirective));"}); + await fixtureAuth.browser(send, base); + await send('Page.navigate', {url: base + '/workspaces'}); + await until(() => evaluate('!!document.querySelector("#fixture-label") && !document.querySelector("#dataset").disabled')); + await evaluate('document.querySelector("#dataset").value="catalog";document.querySelector("#dataset").dispatchEvent(new Event("change",{bubbles:true}))'); + await until(() => evaluate('document.querySelector("#dataset")?.value==="catalog" && !!document.querySelector("#catalog-frame")?.contentWindow?.TuldokWorkspaceData')).catch(async error => { + throw Error(error.message+' '+JSON.stringify(await evaluate('({notice:document.querySelector("#notice")?.textContent,select:document.querySelector("#dataset")?.value,frame:document.querySelector("#catalog-frame")?.src,body:document.body.textContent.slice(0,1000)})'))+' errors='+JSON.stringify(errors)+' server='+serverErrors.slice(-2000)); + }); + await evaluate('document.querySelector("#nav-runs").click()'); + await until(ready, 'Actual authenticated Runs did not mount the retained renderer'); + assert.match(await evaluate(`document.querySelector('meta[http-equiv="Content-Security-Policy"]').content`), /script-src 'self';/); + assert.deepEqual(await evaluate('window.retainedCSPViolations'),[]); + const cspProbe=await send('Runtime.evaluate',{expression:"(()=>{try{new Function('return 1')();return false}catch(error){return error instanceof EvalError}})()",returnByValue:true,allowUnsafeEvalBlockedByCSP:false}); + assert.equal(cspProbe.result.value,true,'Ordinary runtime code generation must be blocked by the deployed CSP'); + await evaluate('window.retainedCSPViolations=[]'); + for (const point of expected.curve) assert.ok((await evaluate(`${host}.textContent`)).includes(`Epoch ${point.epoch}: ${point.value}`)); + await evaluate(`${host}.querySelectorAll('button')[0].focus()`); + await send('Input.dispatchKeyEvent', {type: 'keyDown', key: 'Enter', code: 'Enter', text: '\r', windowsVirtualKeyCode: 13}); + await send('Input.dispatchKeyEvent', {type: 'keyUp', key: 'Enter', code: 'Enter', windowsVirtualKeyCode: 13}); + await until(ready); + for (const row of expected.examples.rows) assert.ok((await evaluate(`${host}.querySelector('tbody').textContent`)).includes(row.example_id)); + await send('Emulation.setDeviceMetricsOverride', {width: 390, height: 844, deviceScaleFactor: 1, mobile: false}); await pause(100); + assert.equal(await evaluate('document.documentElement.scrollWidth<=390'), true); + // Hold an actual response after dispatch, navigate away, then release it. + await send('Fetch.enable', {patterns: [{urlPattern: base + '/api/workspace/runs/' + fixture.run_id + '/retained-analysis', requestStage: 'Response'}]}); + await evaluate(`${host}.querySelectorAll('button')[1].click()`); + await until(() => !!held, 'Expected an actual retained query response to pause'); + await evaluate('document.querySelector("#nav-data").click()'); + try{await send('Fetch.continueRequest', {requestId: held.requestId});} + catch(error){if(!error.message.includes('Invalid InterceptionId'))throw error;await until(()=>aborted>0,'Obsolete request did not report cancellation');} + await send('Fetch.disable'); held = null; + await pause(100); + assert.equal(await evaluate('document.querySelector("#view-runs").hidden'), true); + await evaluate('document.querySelector("#nav-runs").click()'); await until(ready); + const downloadPath=path.join(profile,'downloads');fs.mkdirSync(downloadPath); + await send('Browser.setDownloadBehavior',{behavior:'allow',downloadPath}); + await evaluate(`[...${host}.querySelectorAll('button')].find(button=>button.textContent==='Export this page').click()`); + await until(()=>fs.existsSync(path.join(downloadPath,'retained-analysis-page.json')),'Actual authorized export did not download'); + const exported=JSON.parse(fs.readFileSync(path.join(downloadPath,'retained-analysis-page.json'),'utf8')); + assert.equal(exported.provenance.evaluation_sha256,fixture.request.evaluation_sha256); + assert.deepEqual(exported.curve,expected.curve); + const credential=await evaluate('TuldokAuth.identity().credential_id'); + const ownerToken=fs.readFileSync(path.join(process.env.TULDOK_ANALYSIS_FIXTURE,'owner-token'),'utf8'); + const revoked=await fetch(base+'/api/access/credentials/'+credential+'/revoke',{method:'POST',headers:{Authorization:'Bearer '+ownerToken,Origin:base,'Content-Type':'application/json'},body:'{}'}); + assert.equal(revoked.status,200); + await evaluate(`[...${host}.querySelectorAll('button')].find(button=>button.textContent==='Export this page').click()`); + await until(()=>evaluate('!document.querySelector("#real-runs-root [data-retained-analysis]") && !document.querySelector("#real-runs-root .metric-grid")'),'Revoked export did not clear private Run content'); + const reauth=require('./auth_helpers.cjs').authenticatedFixture();await reauth.register(base,fixture.catalog_path,root);await reauth.browser(send,base); + // Reopen the same catalog in a fresh application process, then reload the + // real browser with the newly authenticated retained session and exact result. + await stop(server); + let restarted='';server=spawn(process.env.PYTHON||'python3',['-u','app.py','--port',new URL(base).port,'--data',fixture.catalog_path],{cwd:root});children.push(server); + server.stdout.on('data',chunk=>restarted+=chunk);server.stderr.on('data',chunk=>serverErrors+=chunk); + await until(()=>restarted.includes(base),'Cold application process did not reopen the retained catalog'); + await send('Page.reload', {ignoreCache: true}); await until(ready); + for (const point of expected.curve) assert.ok((await evaluate(`${host}.textContent`)).includes(`Epoch ${point.epoch}: ${point.value}`)); + // Denial during each ordinary Run read must clear previously rendered private + // content even when auth.js has already set its current identity to null. + for(const suffix of ['', '/predictions?split=validation', '/model-evidence']){ + await send('Fetch.enable',{patterns:[{urlPattern:base+'/api/workspace/runs/'+fixture.run_id+suffix,requestStage:'Request'}]}); + await evaluate('document.querySelector("#real-runs-refresh").click()'); + await until(()=>!!held,'Ordinary Run read did not pause: '+suffix); + const deniedCredential=await evaluate('TuldokAuth.identity().credential_id'); + const deny=await fetch(base+'/api/access/credentials/'+deniedCredential+'/revoke',{method:'POST',headers:{Authorization:'Bearer '+ownerToken,Origin:base,'Content-Type':'application/json'},body:'{}'}); + assert.equal(deny.status,200); + await send('Fetch.continueRequest',{requestId:held.requestId});held=null;await send('Fetch.disable'); + await until(()=>evaluate('!TuldokAuth.identity() && !document.querySelector("#real-runs-root [data-retained-analysis]") && !document.querySelector("#real-runs-root .metric-grid")'),'Denied ordinary read retained private Run content: '+suffix); + const nextAuth=require('./auth_helpers.cjs').authenticatedFixture();await nextAuth.register(base,fixture.catalog_path,root);await nextAuth.browser(send,base); + await send('Page.reload',{ignoreCache:true});await until(ready); + } + await send('Fetch.enable',{patterns:[{urlPattern:base+'/api/workspace/runs/'+fixture.run_id+'/model-evidence',requestStage:'Request'}]}); + await evaluate('document.querySelectorAll("[data-model-checkpoint]")[0].click()'); + await until(()=>!!held,'Existing checkpoint action did not dispatch its exact read'); + // The checkpoint action rerenders and starts a fresh retained query; let that + // succeed first so its authorization failure cannot mask the old action's. + await until(ready); + const checkpointCredential=await evaluate('TuldokAuth.identity().credential_id'); + const checkpointDenied=await fetch(base+'/api/access/credentials/'+checkpointCredential+'/revoke',{method:'POST',headers:{Authorization:'Bearer '+ownerToken,Origin:base,'Content-Type':'application/json'},body:'{}'}); + assert.equal(checkpointDenied.status,200); + await send('Fetch.continueRequest',{requestId:held.requestId});held=null;await send('Fetch.disable'); + await until(()=>evaluate('!TuldokAuth.identity() && !document.querySelector("#real-runs-root [data-retained-analysis]") && !document.querySelector("#real-runs-root .metric-grid")'),'Denied checkpoint action retained private Run content'); + assert.deepEqual(await evaluate('window.retainedCSPViolations'),[]); + assert.deepEqual(errors, []); assert.deepEqual(remote, []); + assert.ok(actualReplies.includes(200)); + console.log(JSON.stringify({status: 'passed', evidence: 'actual-PostgreSQL-native-Run-authenticated-Runs-browser', run_id: fixture.run_id, evaluation_sha256: fixture.request.evaluation_sha256, exact_curve: expected.curve, checks: ['actual named query', 'retained numeric oracle', 'linked keyboard example table', '390px layout', 'held real response cancellation after navigation', 'authorized exact JSON export', 'real credential revocation clears private Run content', 'fresh application process and cache-bypassed page reopen', 'local chart assets', 'deployed script CSP blocks runtime code generation', 'actual denial during detail/predictions/model-evidence clears private Run content', 'held existing checkpoint action denial clears already-authorized retained view']}, null, 2)); + ws.close(); +})().catch(error => { console.error(error); process.exitCode = 1; }).finally(async () => { + for (const child of children.reverse()) await stop(child); + fs.rmSync(profile, {recursive: true, force: true}); +}); diff --git a/tests/browser_scientific_fields.cjs b/tests/browser_scientific_fields.cjs index 7e2e3d37..85d42245 100644 --- a/tests/browser_scientific_fields.cjs +++ b/tests/browser_scientific_fields.cjs @@ -7,6 +7,7 @@ const assert=require('node:assert/strict'),fs=require('node:fs'),os=require('nod const {spawn,execFileSync}=require('node:child_process'); const {pageLoadTracker}=require('./browser_page_load.cjs'); const {waitForDebugger}=require('./browser_startup.cjs'); +const {stopOwnedChildren}=require('./browser_owned_cleanup.cjs'); const {qaDirectory,screenshotOptions}=require('./qa_artifacts.cjs'); const root=path.resolve(__dirname,'..'),captureIndex=process.argv.indexOf('--capture-root'); assert.ok(captureIndex<0||process.argv[captureIndex+1],'--capture-root needs a directory'); @@ -19,11 +20,13 @@ const fixtureArgs=['tests/qualify_scientific_fields.py','--output',bundlePath,'- execFileSync('python3',fixtureArgs,{cwd:root});const source=fs.readFileSync(bundlePath),sourceHash=sha(source); const first={schema_version:2,extensions:[],id:'c'.repeat(32),name:captureRoot?'Native capture transport only':'Rotated noncubic authored fields',data:[{id:'fields',label:'Generic scientific bundle',path:'fields.zip'}],recipes:[],evidence:[],requirements:[]}; const manifestRaw=JSON.stringify(first);fs.writeFileSync(path.join(projectRoot,'tuldok.project.json'),manifestRaw); +const sourceFiles=Object.fromEntries(['static/workspaces.html','static/workspace-projects.js','tests/browser_scientific_fields.cjs','tests/test_workspace_project_startup.cjs'].map(file=>[file,sha(fs.readFileSync(path.join(root,file)))])); const inspections=[],captures=[],checks=[],requests=[],errors=[],children=[],tracker=pageLoadTracker();const pause=ms=>new Promise(resolve=>setTimeout(resolve,ms));let ws,send,evaluate,serverErrors=''; async function until(fn,message='Timed out'){for(let i=0;i<600;i++){const value=await fn();if(value)return value;await pause(100);}throw Error(message);} function launch(command,args,options){const child=spawn(command,args,options);children.push(child);return child;} const serverArgs=port=>['-u','app.py','--port',String(port),'--data',path.join(temporary,'data'),'--project-root','sample='+projectRoot]; (async()=>{ + require('./test_workspace_project_startup.cjs').verifyProjectStartup(); let server=launch('python3',serverArgs(0),{cwd:root,stdio:['ignore','pipe','pipe']}); let output='';server.stdout.on('data',chunk=>output+=chunk);server.stderr.on('data',chunk=>serverErrors+=chunk); const port=await until(()=>{if(server.exitCode!==null)throw Error('Project server exited: '+serverErrors);return output.match(/127\.0\.0\.1:(\d+)/)?.[1];}); @@ -33,9 +36,9 @@ const serverArgs=port=>['-u','app.py','--port',String(port),'--data',path.join(t const debugPort=await waitForDebugger(browser,path.join(temporary,'browser','DevToolsActivePort')); const tabs=await(await fetch('http://127.0.0.1:'+debugPort+'/json')).json(),target=tabs.find(tab=>tab.type==='page'&&tab.url==='about:blank');assert.ok(target); ws=new WebSocket(target.webSocketDebuggerUrl);await new Promise((resolve,reject)=>{ws.onopen=resolve;ws.onerror=reject;}); - let next=0;const pending=new Map(); + let next=0,startupResponse=null;const pending=new Map(); send=(method,params={})=>new Promise((resolve,reject)=>{const id=++next,timer=setTimeout(()=>{pending.delete(id);reject(Error('CDP timeout '+method));},20000);pending.set(id,{resolve:value=>{clearTimeout(timer);resolve(value);},reject:error=>{clearTimeout(timer);reject(error);}});ws.send(JSON.stringify({id,method,params}));}); - ws.onmessage=event=>{const message=JSON.parse(event.data);tracker.observe(message);if(message.id){const task=pending.get(message.id);pending.delete(message.id);if(task)message.error?task.reject(message.error):task.resolve(message.result);}if(message.method==='Runtime.exceptionThrown')errors.push(message.params.exceptionDetails);if(message.method==='Network.requestWillBeSent')requests.push({url:message.params.request.url,method:message.params.request.method});}; + ws.onmessage=event=>{const message=JSON.parse(event.data);tracker.observe(message);if(message.id){const task=pending.get(message.id);pending.delete(message.id);if(task)message.error?task.reject(message.error):task.resolve(message.result);}if(message.method==='Runtime.exceptionThrown')errors.push(message.params.exceptionDetails);if(message.method==='Fetch.requestPaused')startupResponse=message.params;if(message.method==='Network.requestWillBeSent')requests.push({url:message.params.request.url,method:message.params.request.method});}; evaluate=async expression=>{const result=await send('Runtime.evaluate',{expression,awaitPromise:true,returnByValue:true});if(result.exceptionDetails)throw Error(JSON.stringify(result.exceptionDetails));return result.result.value;}; const doc=frame=>frame?'document.getElementById("catalog-frame").contentDocument':'document'; const element=(selector,frame=false)=>`${doc(frame)}.querySelector(${JSON.stringify(selector)})`,text=(selector,frame=false)=>evaluate(`${element(selector,frame)}?.textContent`); @@ -60,8 +63,20 @@ const serverArgs=port=>['-u','app.py','--port',String(port),'--data',path.join(t await send('Page.enable');await send('Page.setLifecycleEventsEnabled',{enabled:true});await send('Runtime.enable');await send('Network.enable'); const offlineCanary=process.env.LD_PRELOAD?JSON.parse(execFileSync('python3',['-c',"import sys;sys.path.insert(0,'tests');from test_workspace_offline import CANARY;exec(CANARY)"],{cwd:root,encoding:'utf8'})):null; await fixtureAuth.browser(send,'http://127.0.0.1:'+port); + // Delay the actual owning module; keep the initial HTML and real pointer path. + await send('Fetch.enable',{patterns:[{urlPattern:base+'/workspace-projects.js',requestStage:'Response'}]}); await send('Page.navigate',{url:base+'/workspaces'});await until(()=>evaluate('!!document.getElementById("open-project")')); + await until(()=>startupResponse,'Owning project module response was not held'); + const startupBefore=await evaluate(`(()=>{const e=document.getElementById('open-project'),b=e.getBoundingClientRect();return {disabled:e.disabled,handler:typeof e.onclick,dialog:document.getElementById('project-open-dialog').open,hit:document.elementFromPoint(b.x+b.width/2,b.y+b.height/2)?.id,x:b.x+b.width/2,y:b.y+b.height/2};})()`); + assert.equal(startupBefore.disabled,true,'Open project stays unavailable until its owner binds the action'); + assert.equal(startupBefore.handler,'object');assert.equal(startupBefore.hit,'open-project'); + for(const type of ['mousePressed','mouseReleased'])await send('Input.dispatchMouseEvent',{type,button:'left',clickCount:1,x:startupBefore.x,y:startupBefore.y}); + assert.equal(await evaluate('document.getElementById("project-open-dialog").open'),false,'The disabled startup control cannot open a partial project flow'); + await send('Fetch.continueRequest',{requestId:startupResponse.requestId});startupResponse=null;await send('Fetch.disable'); await openProject('tuldok.project.json',first.name,first.id); + const startupAfter=await evaluate('({disabled:document.getElementById("open-project").disabled,handler:typeof document.getElementById("open-project").onclick,project:document.getElementById("dataset").value})'); + assert.equal(startupAfter.disabled,false);assert.equal(startupAfter.handler,'function'); + check('Delayed actual project module keeps the pointer-hit control disabled; its owner enables the original first open and full project inspection'); assert.equal((await(await fetch(base+'/api/workbench/records')).json()).items.length,0,'Opening does not import'); await click('[data-project-import="fields"]'); await until(()=>evaluate('document.getElementById("project-import-dialog").open')); @@ -144,6 +159,6 @@ const serverArgs=port=>['-u','app.py','--port',String(port),'--data',path.join(t check('Held import refresh preserves a newer explicit clean-record selection instead of opening the newly imported record'); assert.deepEqual(await(await fetch(base+'/api/workspace/runs')).json(),[]);assert.deepEqual(errors,[]);assert.ok(!serverErrors.includes('Traceback'),serverErrors); check('Restart retains reviewed field record and exact release; original project bytes unchanged and no execution submitted'); - fs.writeFileSync(path.join(report,'receipt.json'),JSON.stringify({source_commit:execFileSync('git',['rev-parse','HEAD'],{cwd:root,encoding:'utf8'}).trim(),dirty:!!execFileSync('git',['status','--porcelain'],{cwd:root,encoding:'utf8'}).trim(),command:'node tests/browser_scientific_fields.cjs'+(captureRoot?' --capture-root ':''),capture_receipt_sha256:captureRoot?sha(fs.readFileSync(path.join(captureRoot,'receipt.json'))):null,qualification:captureRoot?'Actual saved native capture converted without element conversion; transport/UI/custody only':'Producer-neutral authored rotated noncubic fields; transport/UI/custody only',physics_acceptance:false,model_or_training_acceptance:false,checks,captures,source_sha256:sourceHash,cold,frozenSummary,offline_canary:offlineCanary,browser:(await send('Browser.getVersion')).product},null,2)); + fs.writeFileSync(path.join(report,'receipt.json'),JSON.stringify({source_commit:execFileSync('git',['rev-parse','HEAD'],{cwd:root,encoding:'utf8'}).trim(),dirty:!!execFileSync('git',['status','--porcelain'],{cwd:root,encoding:'utf8'}).trim(),command:'node tests/browser_scientific_fields.cjs'+(captureRoot?' --capture-root ':''),capture_receipt_sha256:captureRoot?sha(fs.readFileSync(path.join(captureRoot,'receipt.json'))):null,qualification:captureRoot?'Actual saved native capture converted without element conversion; transport/UI/custody only':'Producer-neutral authored rotated noncubic fields; transport/UI/custody only',physics_acceptance:false,model_or_training_acceptance:false,source_files_sha256:sourceFiles,startup:{before:startupBefore,after:startupAfter},checks,captures,source_sha256:sourceHash,cold,frozenSummary,offline_canary:offlineCanary,browser:(await send('Browser.getVersion')).product},null,2)); console.log('PASS scientific field browser:',report); -})().catch(async error=>{console.error(error);console.error('Application stderr:',serverErrors);if(evaluate)try{console.error(await evaluate('JSON.stringify({url:location.href,body:document.body.innerText.slice(-9000),frame:document.getElementById("catalog-frame")?.contentDocument?.body.innerText.slice(-5000)})'));}catch{}process.exitCode=1;}).finally(()=>{ws?.close();for(const child of children.reverse())child.kill('SIGTERM');}); +})().catch(async error=>{console.error(error);console.error('Application stderr:',serverErrors);if(evaluate)try{console.error(await evaluate('JSON.stringify({url:location.href,body:document.body.innerText.slice(-9000),frame:document.getElementById("catalog-frame")?.contentDocument?.body.innerText.slice(-5000)})'));}catch{}process.exitCode=1;}).finally(async()=>{ws?.close();await stopOwnedChildren(children);fs.rmSync(temporary,{recursive:true,force:true,maxRetries:10,retryDelay:100});fs.writeFileSync(path.join(report,'cleanup.json'),JSON.stringify({temporary,removed:!fs.existsSync(temporary),children:children.map(child=>({pid:child.pid,exit_code:child.exitCode,signal:child.signalCode}))},null,2)+'\n');}).catch(error=>{console.error('Owned scientific fixture cleanup failed:',error);process.exitCode=1;}); diff --git a/tests/fixtures/retained-analysis-browser.css b/tests/fixtures/retained-analysis-browser.css new file mode 100644 index 00000000..85535bce --- /dev/null +++ b/tests/fixtures/retained-analysis-browser.css @@ -0,0 +1,7 @@ +body { font: 16px system-ui; margin: 16px; color: #17223b; } +main, #analysis { max-width: 900px; min-width: 0; width: 100%; } +button { margin: 4px; padding: 8px; } +table { border-collapse: collapse; width: 100%; font-size: 12px; table-layout: fixed; } +td, th { padding: 6px; border: 1px solid #aab; overflow-wrap: anywhere; } +pre { white-space: pre-wrap; overflow-wrap: anywhere; } +button:focus-visible, input:focus-visible { outline: 3px solid #d97706; } diff --git a/tests/fixtures/retained-analysis-browser.js b/tests/fixtures/retained-analysis-browser.js new file mode 100644 index 00000000..776b5105 --- /dev/null +++ b/tests/fixtures/retained-analysis-browser.js @@ -0,0 +1,42 @@ +'use strict'; +window.fixtureRequests = []; +window.fixtureMode = 'normal'; +window.fixturePending = []; +window.fixtureSelections = []; +window.fixtureCsp = []; +window.fixtureSpecMode = 'normal'; +const originalFetch = window.fetch.bind(window); +window.fetch = (url, options) => { + if (url === '/static/retained-checkpoint-curve.vl.json' && window.fixtureSpecMode !== 'normal') { + return Promise.resolve(new Response(window.fixtureSpecMode === 'oversized' ? ' '.repeat(16385) : '{"data":{"url":"https://example.invalid/private"}}')); + } + return originalFetch(url, options); +}; +document.addEventListener('securitypolicyviolation', event => window.fixtureCsp.push(event.violatedDirective)); +const cp = ['b'.repeat(64), 'c'.repeat(64)]; +window.fixtureRequest = {query_id: 'retained_checkpoint_examples', query_version: 1, run_id: 'a'.repeat(32), evaluation_sha256: 'd'.repeat(64), checkpoint_sha256: cp[0], metric_id: 'accuracy', metric_definition_sha256: 'e'.repeat(64), limit: 1, offset: 0}; +function response(request) { + const ordinal = request.errors_only ? 1 : (request.offset ?? 0); + const count = request.errors_only ? 1 : 2; + const row = {example_id: (request.checkpoint_sha256 === cp[0] ? 'frozen-example-first' : 'frozen-example-second') + '-' + ordinal, ordinal, truth_index: ordinal, predicted_index: 0, confidence: ordinal === 0 ? .875 : .75, error: ordinal !== 0}; + row.frozen_reference = {id: row.example_id, revision: 3}; + return {state: 'verified', query_id: 'retained_checkpoint_examples', query_version: 1, mode: 'frozen', provenance: {catalog_id: 'renderer-fixture', run_id: request.run_id, evaluation_sha256: request.evaluation_sha256, checkpoint_sha256: request.checkpoint_sha256, metric_definition_sha256: request.metric_definition_sha256, population_sha256: '1'.repeat(64), probe_sha256: '2'.repeat(64), data_sha256: '3'.repeat(64), producer: {catalog_id: 'renderer-fixture', run_id: request.run_id, material_sha256: '4'.repeat(64), adapter_sha256: '5'.repeat(64)}}, metric: {id: 'accuracy', units: 'dimensionless', support: 2, definition: {id: 'accuracy', split: 'validation', units: 'dimensionless', population_sha256: '1'.repeat(64)}}, curve: [{checkpoint_sha256: cp[0], epoch: 1, value: .125, support: 2}, {checkpoint_sha256: cp[1], epoch: 2, value: .375, support: 2}], columns: ['example_id', 'truth_index', 'predicted_index', 'confidence', 'error'].map((field, index) => ({field, type: ['string', 'integer', 'integer', 'number', 'boolean'][index], units: field === 'confidence' ? 'dimensionless' : null})), examples: {rows: request.offset >= count ? [] : [row], population_support: 2, filtered_support: count, offset: request.offset ?? 0, limit: request.limit ?? 50, next_offset: (request.offset ?? 0) + 1 < count ? (request.offset ?? 0) + 1 : null, filters: {errors_only: request.errors_only ?? false}}, sampling: {method: 'none', population: 'frozen_validation_probe'}, selection_sha256: 'f'.repeat(64)}; +} +async function load(request, options) { + window.fixtureRequests.push({request, exported: options.export, aborted: () => options.signal.aborted}); + if (window.fixtureMode === 'revoked') throw Error('Credential is unavailable, expired or revoked.'); + if (window.fixtureMode === 'stale') return new Promise(resolve => window.fixturePending.push(() => resolve(response(request)))); + const result = response(request); + if (window.fixtureMode === 'malformed') result.spec = {data: {url: 'https://example.invalid/private'}}; + if (window.fixtureMode === 'oversized') result.curve = Array(129).fill(result.curve[0]); + if (window.fixtureMode === 'support-mismatch') result.curve[0].support = 999; + if (window.fixtureMode === 'ordinal-mismatch') result.examples.rows[0].ordinal = 999; + if (window.fixtureMode === 'count-mismatch') result.examples.filtered_support = 0; + if (window.fixtureMode === 'missing-provenance') delete result.provenance.probe_sha256; + if (window.fixtureMode === 'missing-definition') delete result.metric.definition; + if (window.fixtureMode === 'missing-column-type') delete result.columns[0].type; + return result; +} +window.fixtureAdapter = window.WorkspaceRetainedAnalysis.mount(document.querySelector('#analysis'), {load, onSelection: value => window.fixtureSelections.push(value)}); +window.fixtureStart = () => window.fixtureAdapter.update(window.fixtureRequest, 'authority-1'); +void window.fixtureStart(); diff --git a/tests/retained_analysis_actual_fixture.py b/tests/retained_analysis_actual_fixture.py new file mode 100644 index 00000000..2e63548e --- /dev/null +++ b/tests/retained_analysis_actual_fixture.py @@ -0,0 +1,81 @@ +"""Prepare a small actual native classifier Run for query/HTTP/browser acceptance. + +Uses the normal PostgreSQL catalog, explicit local test owner, frozen release, +Pipeline validation and supervised CPU Run. No retained document is manufactured. +The six authored images establish transport/numeric behavior, not model quality. +""" +import argparse +import copy +import hashlib +import json +import os +from pathlib import Path +import sys +import time + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT)) +sys.path.insert(0, str(ROOT / 'tests')) +sys.path.insert(0, str(ROOT / 'tests' / 'fixtures')) +from app import Dataset +from auth_helpers import ExplicitOwnerFixture +from image_classification_fixture import populate +import image_training + + +def prepare(directory): + directory = Path(directory).resolve() + directory.mkdir(mode=0o700, parents=True, exist_ok=False) + dataset = Dataset(directory / 'catalog') + try: + owner = ExplicitOwnerFixture.bootstrap(dataset) + with owner.bound(dataset): + rows = populate(dataset) + selection = {'format': 'image_classification_v1', + 'items': [{key: row[key] for key in ('id', 'revision', 'source_revision')} for row in rows], + 'ratios': {'train': 34, 'validation': 33, 'test': 33}, 'seed': 42} + preview = dataset.releases.preview(selection) + release = dataset.releases.create(dict(selection, preview_token=preview['preview_token'])) + graph = dataset.pipelines.create({'name': 'Retained analysis actual fixture', + 'release_id': release['id'], 'recipe': image_training.MODEL_RECIPE}) + changed = copy.deepcopy(graph) + next(node for node in changed['nodes'] if node['type'] == 'train')['parameters'].update( + epochs=2, widths=[4, 8, 12], input_size=32) + graph = dataset.pipelines.save(graph['id'], {'revision': graph['revision'], 'document': changed}) + validation = dataset.pipelines.validate(graph['id'], {'revision': graph['revision']}) + run = dataset.runs.submit({'request_key': 'retained-analysis-actual-v1', 'graph_id': graph['id'], + 'graph_revision': graph['revision'], 'validation_token': validation['validation_token']}) + deadline = time.monotonic() + 120 + while run['state'] in ('queued', 'running', 'cancelling') and time.monotonic() < deadline: + time.sleep(.1) + run = dataset.runs.get(run['id']) + if run['state'] != 'completed': + raise AssertionError('Actual retained fixture did not complete: ' + str(run.get('error'))) + evidence = dataset.runs.model_evidence(run['id']) + evaluation = next(item['sha256'] for item in run['artifacts'] if item['name'] == 'model-evidence.json') + request = {'query_id': 'retained_checkpoint_examples', 'query_version': 1, 'run_id': run['id'], + 'evaluation_sha256': evaluation, + 'checkpoint_sha256': evidence['checkpoint_index']['entries'][0]['checkpoint']['sha256'], + 'metric_id': 'accuracy', 'metric_definition_sha256': evidence['metric_definition_hashes']['accuracy'], + 'limit': 1, 'offset': 0} + # Secret bytes remain in a private task-owned file, never a report or argv. + descriptor = os.open(directory / 'owner-token', os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600) + with os.fdopen(descriptor, 'w') as handle: + handle.write(owner.token) + receipt = {'format': 'retained_analysis_actual_fixture_v1', 'scope': 'Authored transport fixture; no model-quality claim', + 'catalog_path': str(dataset.path), 'catalog_id': dataset.db.dataset_id, + 'run_id': run['id'], 'release_sha256': run['release_sha256'], 'request': request, + 'artifacts': [{key: item[key] for key in ('name', 'sha256', 'bytes')} for item in run['artifacts']], + 'source_sha256': {name: hashlib.sha256((ROOT / name).read_bytes()).hexdigest() for name in + ('retained_analysis.py', 'tests/retained_analysis_actual_fixture.py', 'runs.py', 'model_evidence.py')}} + (directory / 'fixture.json').write_text(json.dumps(receipt, indent=2) + '\n') + return receipt + finally: + dataset.close() + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('--directory', required=True, type=Path) + arguments = parser.parse_args() + print(json.dumps(prepare(arguments.directory), sort_keys=True)) diff --git a/tests/retained_analysis_browser_fixture.py b/tests/retained_analysis_browser_fixture.py new file mode 100644 index 00000000..9fd08603 --- /dev/null +++ b/tests/retained_analysis_browser_fixture.py @@ -0,0 +1,35 @@ +"""Isolated renderer fixture, not an application/authorization server.""" +from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer +from pathlib import Path +import sys + +ROOT = Path(__file__).resolve().parents[1] +HTML = b'''Retained analysis renderer fixture
''' + + +class Handler(SimpleHTTPRequestHandler): + def __init__(self, *args, **kwargs): + super().__init__(*args, directory=str(ROOT), **kwargs) + + def end_headers(self): + self.send_header('Content-Security-Policy', "default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'none'; frame-ancestors 'none'") + super().end_headers() + + def do_GET(self): + if self.path == '/': + self.send_response(200) + self.send_header('Content-Type', 'text/html; charset=utf-8') + self.end_headers() + self.wfile.write(HTML) + elif self.path.startswith('/static/vendor/retained-analysis/') or self.path in ( + '/static/retained-analysis.js', '/static/retained-checkpoint-curve.vl.json', + '/tests/fixtures/retained-analysis-browser.js', '/tests/fixtures/retained-analysis-browser.css'): + super().do_GET() + else: + self.send_error(404) + + +if __name__ == '__main__': + server = ThreadingHTTPServer(('127.0.0.1', 0), Handler) + print(server.server_port, flush=True) + server.serve_forever() diff --git a/tests/test_retained_analysis.py b/tests/test_retained_analysis.py new file mode 100644 index 00000000..15c4c30b --- /dev/null +++ b/tests/test_retained_analysis.py @@ -0,0 +1,289 @@ +"""Query-boundary fixtures; actual PostgreSQL assertions are separately gated. + +Auth/evidence substitutes test orchestration only. They do not qualify actual +Runs custody, SQL behavior or end-to-end application acceptance. +""" +import copy +from contextlib import contextmanager +import json +import os +from pathlib import Path +import sys +import unittest +from types import SimpleNamespace +from unittest.mock import patch + +sys.path.insert(0, str(Path(__file__).resolve().parents[1])) +import retained_analysis as analysis +from access import AccessError +from model_evidence import canonical, digest +from psycopg.pq import TransactionStatus +from workbench import WorkbenchError + +RUN = 'a' * 32 +CHECKPOINTS = ['b' * 64, 'c' * 64] +EVALUATION = 'd' * 64 + + +def fixture(): + definition = {'id': 'accuracy', 'units': 'dimensionless', 'split': 'validation', + 'population_sha256': 'e' * 64, 'reduction': 'diagonal_over_population'} + body = {'query_id': analysis.QUERY_ID, 'query_version': 1, 'run_id': RUN, + 'evaluation_sha256': EVALUATION, 'checkpoint_sha256': CHECKPOINTS[1], + 'metric_id': 'accuracy', 'metric_definition_sha256': digest(definition)} + evidence = {'state': 'verified', 'manifest': {'format': 'model_evidence_v1', + 'probe': {'sha256': 'f' * 64}, 'data_sha256': '1' * 64, + 'producer': {'run_id': RUN, 'adapter_sha256': '2' * 64}}, + 'metric_definitions': [definition], + 'checkpoint_index': {'entries': [{'checkpoint': {'sha256': sha}, 'clocks': {'epoch': i}} + for i, sha in enumerate(CHECKPOINTS, 1)]}, + 'probe': {'members': [{'ordinal': i, 'frozen_reference': {'id': f'example-{i}', 'revision': 3}} + for i in range(2)]}, + 'predictions': {'checkpoint_sha256': CHECKPOINTS[1], 'probe_sha256': 'f' * 64, + 'rows': [{'ordinal': 0, 'truth_index': 0, 'predicted_index': 0, 'probabilities': [.875, .125]}, + {'ordinal': 1, 'truth_index': 1, 'predicted_index': 0, 'probabilities': [.75, .25]}]}, + 'observations': [{'checkpoint_sha256': sha, 'metric_id': 'accuracy', 'split': 'validation', + 'state': 'observed', 'clocks': {'epoch': epoch}, 'value': value, 'sample_count': 2} + for sha, epoch, value in zip(CHECKPOINTS, (1, 2), (.0, .5))]} + return body, evidence + + +class Cursor: + def __init__(self, rows): + self.rows = rows + + def fetchone(self): + return self.rows[0] if self.rows else None + + def __iter__(self): + return iter(self.rows) + + +class OwnerFixture: + """A controlled boundary fixture, intentionally not a SQL implementation.""" + def __init__(self): + self.body, self.evidence = fixture() + self.reading = False + self.events = [] + self.revoke_after_read = False + self.artifact_reads = 0 + self.document = {'id': RUN, 'state': 'completed', + 'artifacts': [{'name': 'model-evidence.json', 'sha256': EVALUATION}]} + self.curve = [{'checkpoint_sha256': CHECKPOINTS[0], 'epoch': 1, 'value': .0, 'support': 2}, + {'checkpoint_sha256': CHECKPOINTS[1], 'epoch': 2, 'value': .5, 'support': 2}] + self.page = {'filtered_support': 2, 'rows': [ + {'ordinal': 0, 'example_id': 'example-0', 'truth_index': 0, 'predicted_index': 0, + 'confidence': .875, 'error': False, 'frozen_reference': {'id': 'example-0', 'revision': 3}}, + {'ordinal': 1, 'example_id': 'example-1', 'truth_index': 1, 'predicted_index': 0, + 'confidence': .75, 'error': True, 'frozen_reference': {'id': 'example-1', 'revision': 3}}]} + self.db = SimpleNamespace(dataset_id='catalog-fixture', execute=self.execute, + lock=SimpleNamespace(bounded=self.bounded), + connection=SimpleNamespace(transaction=self.transaction, + info=SimpleNamespace(transaction_status=TransactionStatus.IDLE))) + self.access = SimpleNamespace(require=self.require) + + @contextmanager + def bounded(self, deadline): + yield + + @contextmanager + def transaction(self): + self.reading = True + try: + yield + finally: + self.reading = False + + def require(self, scope, action, run_id): + self.events.append((scope, action, run_id, self.reading)) + if self.revoke_after_read and len(self.events) > 1: + raise AccessError('Credential is unavailable, expired or revoked.', 'unauthenticated', 401) + + def model_evidence(self, run_id, selectors, *, contract_version): + self.artifact_reads += 1 + assert (run_id, selectors, contract_version) == (RUN, {'checkpoint_sha256': CHECKPOINTS[1]}, 1) + return copy.deepcopy(self.evidence) + + def execute(self, sql, params=None): + if 'octet_length(document)' in sql: + return Cursor([{'document': json.dumps(self.document)}]) + if sql == analysis.CURVE_SQL: + return Cursor(copy.deepcopy(self.curve)) + if sql == analysis.EXAMPLES_SQL: + return Cursor([copy.deepcopy(self.page)]) + return Cursor([]) + + +class RequestTests(unittest.TestCase): + def test_defaults_and_explicit_field_projection(self): + body, _ = fixture() + value = analysis.validate_request(body) + self.assertEqual((value['limit'], value['offset'], value['errors_only']), (50, 0, False)) + self.assertEqual(value['fields'], list(analysis.FIELDS)) + self.assertEqual(analysis.validate_request(dict(body, fields=['example_id']))['fields'], ['example_id']) + self.assertNotIn('limit', body) + + def test_closed_bounds_and_types_before_evidence_read(self): + changes = [({'sql': 'SELECT secret'}, 'invalid'), ({'query_version': True}, 'unsupported'), + ({'query_id': 'raw_sql'}, 'unsupported'), ({'limit': True}, 'invalid'), + ({'limit': 101}, 'invalid'), ({'limit': 0}, 'invalid'), ({'offset': -1}, 'invalid'), + ({'offset': 10001}, 'invalid'), ({'errors_only': 1}, 'invalid'), + ({'fields': ['example_id', 'probabilities']}, 'invalid'), + ({'fields': ['confidence']}, 'invalid'), ({'fields': ['example_id'] * 2}, 'invalid'), + ({'fields': [[]]}, 'invalid'), ({'metric_id': []}, 'invalid'), + ({'metric_id': "accuracy'); DROP TABLE workspace_runs;--"}, 'invalid'), + ({'run_id': '../catalog'}, 'invalid'), ({'checkpoint_sha256': 'B' * 64}, 'invalid')] + for changed, code in changes: + with self.subTest(changed=changed): + owner = OwnerFixture() + with self.assertRaises(WorkbenchError) as caught: + analysis.query(owner, dict(owner.body, **changed)) + self.assertEqual(caught.exception.code, code) + self.assertEqual(owner.artifact_reads, 0) + self.assertEqual(owner.events, []) + for value in (None, [], 'query'): + with self.subTest(value=value), self.assertRaises(WorkbenchError): + analysis.validate_request(value) + + +class ProjectionTests(unittest.TestCase): + def test_exact_frozen_examples_and_retained_confidence(self): + body, evidence = fixture() + definition, checkpoints, raw = analysis._projection(evidence, body) + rows = json.loads(raw) + self.assertEqual([row['example_id'] for row in rows], ['example-0', 'example-1']) + self.assertEqual([row['error'] for row in rows], [False, True]) + self.assertEqual([row['confidence'] for row in rows], [.875, .75]) + self.assertEqual(rows[1]['frozen_reference'], {'id': 'example-1', 'revision': 3}) + self.assertEqual(checkpoints[1], {'checkpoint_sha256': CHECKPOINTS[1], 'epoch': 2}) + self.assertEqual(definition['units'], 'dimensionless') + + def test_foreign_metric_checkpoint_and_population_are_distinct_failures(self): + body, evidence = fixture() + for changed, code in (({'metric_definition_sha256': '0' * 64}, 'stale'), + ({'checkpoint_sha256': '0' * 64}, 'not_found')): + with self.subTest(changed=changed), self.assertRaises(WorkbenchError) as caught: + analysis._projection(evidence, dict(body, **changed)) + self.assertEqual(caught.exception.code, code) + evidence['predictions']['probe_sha256'] = '0' * 64 + with self.assertRaisesRegex(WorkbenchError, 'Selected checkpoint predictions differ'): + analysis._projection(evidence, body) + + def test_unsupported_task_and_oversize_are_explicit(self): + body, evidence = fixture() + evidence['checkpoint_index']['entries'][0]['clocks']['epoch'] = None + with self.assertRaises(WorkbenchError) as caught: + analysis._projection(evidence, body) + self.assertEqual(caught.exception.code, 'unsupported') + body, evidence = fixture() + with patch.object(analysis, 'MAX_EXAMPLES', 1), self.assertRaises(WorkbenchError) as caught: + analysis._projection(evidence, body) + self.assertEqual((caught.exception.code, caught.exception.status), ('limit', 413)) + + +class QueryBoundaryTests(unittest.TestCase): + def test_exact_provenance_and_values_with_fresh_access_outside_snapshot(self): + owner = OwnerFixture() + result = analysis.query(owner, owner.body) + self.assertEqual([p['value'] for p in result['curve']], [.0, .5]) + self.assertEqual(result['provenance']['evaluation_sha256'], EVALUATION) + self.assertEqual(result['metric']['support'], 2) + self.assertEqual(result['examples']['population_support'], 2) + self.assertEqual(result['sampling'], {'method': 'none', 'population': 'frozen_validation_probe'}) + self.assertEqual(len(owner.events), 2) + self.assertTrue(all(event == ('inspect', 'runs.retained_analysis', RUN, False) for event in owner.events)) + + def test_export_and_repeated_retrieval_do_not_bypass_current_authority(self): + owner = OwnerFixture() + analysis.query(owner, owner.body) + owner.revoke_after_read = True + with self.assertRaises(AccessError) as caught: + analysis.query(owner, owner.body, export=True) + self.assertEqual(caught.exception.status, 401) + self.assertEqual(owner.artifact_reads, 1) + self.assertEqual(owner.events[-1][1], 'runs.export_retained_analysis') + + def test_revocation_during_read_prevents_return(self): + owner = OwnerFixture() + owner.revoke_after_read = True + with self.assertRaises(AccessError) as caught: + analysis.query(owner, owner.body) + self.assertEqual(caught.exception.code, 'unauthenticated') + self.assertEqual(owner.artifact_reads, 1) + self.assertFalse(owner.reading) + + def test_error_filter_does_not_change_metric_population_and_page_identity(self): + owner = OwnerFixture() + owner.page = {'filtered_support': 1, 'rows': [owner.page['rows'][1]]} + result = analysis.query(owner, dict(owner.body, errors_only=True, fields=['example_id'], limit=1)) + self.assertEqual(result['metric']['support'], 2) + self.assertEqual(result['examples']['filtered_support'], 1) + self.assertEqual(result['examples']['rows'], [{'example_id': 'example-1', 'ordinal': 1, + 'frozen_reference': {'id': 'example-1', 'revision': 3}}]) + self.assertIsNone(result['examples']['next_offset']) + self.assertEqual(result['examples']['filters'], {'errors_only': True}) + + def test_catalog_mismatch_is_refused(self): + for field, value in (('value', .25), ('support', 3), ('epoch', 3)): + owner = OwnerFixture() + owner.curve[0][field] = value + with self.subTest(field=field), self.assertRaisesRegex(WorkbenchError, 'Catalog curve differs'): + analysis.query(owner, owner.body) + owner = OwnerFixture() + owner.document['artifacts'][0]['sha256'] = '0' * 64 + with self.assertRaises(WorkbenchError) as caught: + analysis.query(owner, owner.body) + self.assertEqual(caught.exception.code, 'stale') + self.assertEqual(owner.artifact_reads, 0) + + def test_nested_transaction_and_oversized_response_refused(self): + owner = OwnerFixture() + owner.db.connection.info.transaction_status = TransactionStatus.INTRANS + with self.assertRaises(WorkbenchError) as caught: + analysis.query(owner, owner.body) + self.assertEqual(caught.exception.code, 'unavailable') + self.assertEqual(owner.artifact_reads, 0) + owner = OwnerFixture() + with patch.object(analysis, 'MAX_RESPONSE_BYTES', 1), self.assertRaises(WorkbenchError) as caught: + analysis.query(owner, owner.body) + self.assertEqual(caught.exception.status, 413) + + def test_malformed_catalog_envelope_preserves_typed_failure(self): + for document in ({'artifacts': None}, {'artifacts': [{'sha256': '0' * 64}]}, [], None): + owner = OwnerFixture() + owner.document = document + with self.subTest(document=document), self.assertRaises(WorkbenchError) as caught: + analysis.query(owner, owner.body) + self.assertEqual((caught.exception.code, caught.exception.status), ('unavailable', 409)) + self.assertEqual(str(caught.exception), 'Retained Run envelope is unavailable.') + self.assertEqual(owner.artifact_reads, 0) + + +@unittest.skipUnless(os.environ.get('TULDOK_DATABASE_URL'), 'Existing authorized PostgreSQL configuration required; no credentials created.') +class ActualPostgresSqlTests(unittest.TestCase): + def test_parameterized_curve_and_stable_error_page_on_actual_postgres(self): + import psycopg + from psycopg.rows import dict_row + from metadata import connection_info + with psycopg.connect(connection_info(), row_factory=dict_row) as db: + # A rollback-only temporary relation never changes application schema. + with db.transaction(force_rollback=True): + db.execute('CREATE TEMP TABLE workspace_runs(id text, document text) ON COMMIT DROP') + doc = {'metrics': {'history': [{'epoch': 1, 'validation': {'accuracy': .125, 'examples': 8}}, + {'epoch': 2, 'validation': {'accuracy': .375, 'examples': 8}}]}} + db.execute('INSERT INTO workspace_runs VALUES (%s,%s)', (RUN, json.dumps(doc))) + cp = [{'checkpoint_sha256': sha, 'epoch': i} for i, sha in enumerate(CHECKPOINTS, 1)] + rows = db.execute(analysis.CURVE_SQL, (json.dumps(cp), 'accuracy', RUN, 129)).fetchall() + self.assertEqual([row['value'] for row in rows], [.125, .375]) + self.assertEqual([row['support'] for row in rows], [8, 8]) + body, evidence = fixture() + _, _, raw = analysis._projection(evidence, body) + page = db.execute(analysis.EXAMPLES_SQL, (raw, True, 1, 0)).fetchone() + self.assertEqual(page['filtered_support'], 1) + self.assertEqual(page['rows'][0]['example_id'], 'example-1') + empty = db.execute(analysis.EXAMPLES_SQL, (raw, True, 1, 1)).fetchone() + self.assertEqual(empty, {'filtered_support': 1, 'rows': []}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_retained_analysis_actual.py b/tests/test_retained_analysis_actual.py new file mode 100644 index 00000000..aecec870 --- /dev/null +++ b/tests/test_retained_analysis_actual.py @@ -0,0 +1,178 @@ +"""Actual PostgreSQL/retained Run acceptance, separate from renderer fixtures. + +Enable explicitly with TULDOK_ANALYSIS_ACTUAL=1 and the normal local DB/CPU +runtime configuration. An optional TULDOK_ANALYSIS_FIXTURE reuses an already +prepared task-owned fixture; no production catalog is selected implicitly. +""" +import copy +import hashlib +import json +import os +from pathlib import Path +import subprocess +import sys +import tempfile +import unittest +from unittest.mock import patch + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT)) +sys.path.insert(0, str(ROOT / 'tests')) +from app import Dataset +from access import AccessError +from auth_helpers import ExplicitOwnerFixture +from model_evidence import digest +from retained_analysis_actual_fixture import prepare +import retained_analysis +from workbench import WorkbenchError + + +@unittest.skipUnless(os.environ.get('TULDOK_ANALYSIS_ACTUAL') == '1', 'Explicit real retained-analysis acceptance required.') +class ActualRetainedAnalysisTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + if not os.environ.get('TULDOK_DATABASE_URL') or not os.environ.get('TULDOK_TRAINING_PYTHON'): + raise RuntimeError('Actual acceptance requires explicitly configured local PostgreSQL and pinned CPU runtime.') + cls.temporary = None + location = os.environ.get('TULDOK_ANALYSIS_FIXTURE') + if location: + cls.fixture = Path(location).resolve() + cls.receipt = json.loads((cls.fixture / 'fixture.json').read_text()) + else: + cls.temporary = tempfile.TemporaryDirectory(prefix='tuldok-analysis-actual-') + cls.fixture = Path(cls.temporary.name) / 'fixture' + cls.receipt = prepare(cls.fixture) + cls.dataset = Dataset(cls.receipt['catalog_path']) + token = (cls.fixture / 'owner-token').read_text() + with cls.dataset.access.bind(token): + identity = cls.dataset.access.identity() + cls.owner = ExplicitOwnerFixture(cls.receipt['catalog_id'], token, identity) + cls.request = cls.receipt['request'] + cls.output = cls.dataset.runs.path / cls.receipt['run_id'] + + @classmethod + def tearDownClass(cls): + cls.dataset.close() + if cls.temporary: + cls.temporary.cleanup() + + def setUp(self): + self.enterContext(self.owner.bound(self.dataset)) + + def test_actual_sql_curve_and_examples_equal_original_retained_artifacts(self): + observations = json.loads((self.output / 'observations.json').read_bytes()) + definitions = json.loads((self.output / 'metric-definitions.json').read_bytes()) + probe = json.loads((self.output / 'probe.json').read_bytes()) + checkpoints = json.loads((self.output / 'checkpoints.json').read_bytes())['entries'] + for definition in definitions: + request = dict(self.request, metric_id=definition['id'], metric_definition_sha256=digest(definition)) + result = retained_analysis.query(self.dataset.runs, request) + self.assertEqual(result['metric']['definition'], definition) + self.assertEqual(result['metric']['units'], definition['units']) + self.assertEqual([point['value'] for point in result['curve']], + [item['value'] for item in observations if item['metric_id'] == definition['id']]) + self.assertEqual([point['checkpoint_sha256'] for point in result['curve']], + [item['checkpoint']['sha256'] for item in checkpoints]) + for checkpoint in checkpoints: + request = dict(self.request, checkpoint_sha256=checkpoint['checkpoint']['sha256']) + predictions = json.loads((self.output / f"probes-epoch-{checkpoint['clocks']['epoch']:04d}.json").read_bytes()) + pages = [] + for offset in range(len(probe['members'])): + result = retained_analysis.query(self.dataset.runs, dict(request, offset=offset)) + self.assertEqual(len(result['examples']['rows']), 1) + pages.extend(result['examples']['rows']) + self.assertEqual([row['example_id'] for row in pages], [item['frozen_reference']['id'] for item in probe['members']]) + for row, original, member in zip(pages, predictions['rows'], probe['members'], strict=True): + self.assertEqual(row['frozen_reference'], member['frozen_reference']) + self.assertEqual(row['confidence'], original['probabilities'][original['predicted_index']]) + self.assertEqual(row['error'], original['truth_index'] != original['predicted_index']) + errors = retained_analysis.query(self.dataset.runs, dict(request, errors_only=True, limit=100)) + self.assertEqual(errors['examples']['filtered_support'], sum(row['error'] for row in pages)) + self.assertTrue(all(row['error'] for row in errors['examples']['rows'])) + self.assertEqual(errors['metric']['support'], len(probe['members'])) + + def test_query_and_export_are_inert_and_restore_session_settings(self): + run_before = self.dataset.db.execute('SELECT document FROM workspace_runs WHERE id=%s', (self.request['run_id'],)).fetchone()[0] + before = {p.name: hashlib.sha256(p.read_bytes()).hexdigest() for p in self.output.iterdir() if p.is_file()} + timeout = self.dataset.db.execute('SHOW statement_timeout').fetchone()[0] + with patch('subprocess.Popen', side_effect=AssertionError('Reading a view must not launch a process')): + result = retained_analysis.query(self.dataset.runs, self.request) + exported = retained_analysis.query(self.dataset.runs, self.request, export=True) + self.assertEqual(result, exported) + self.assertEqual(self.dataset.db.execute('SHOW statement_timeout').fetchone()[0], timeout) + self.assertEqual(self.dataset.db.execute('SELECT document FROM workspace_runs WHERE id=%s', (self.request['run_id'],)).fetchone()[0], run_before) + self.assertEqual({p.name: hashlib.sha256(p.read_bytes()).hexdigest() for p in self.output.iterdir() if p.is_file()}, before) + self.assertFalse(self.dataset.runs.get(self.request['run_id'])['test_exposure']['exposed']) + + def test_real_credential_revocation_blocks_repeated_query_and_export(self): + credential = self.dataset.access.issue({'label': 'Actual analysis revocation fixture', 'scopes': ['inspect']}) + with self.dataset.access.bind(credential['token']): + retained_analysis.query(self.dataset.runs, self.request) + self.dataset.access.require('inspect', 'runs.retained_analysis', self.request['run_id']) + # Revoke through the actual owner while this credential is still + # bound, then exercise both fresh retrieval paths in that context. + with self.owner.bound(self.dataset): + self.dataset.access.revoke(credential['identity']['credential_id']) + for export in (False, True): + with self.subTest(export=export), self.assertRaises(AccessError) as caught: + retained_analysis.query(self.dataset.runs, self.request, export=export) + self.assertEqual((caught.exception.code, caught.exception.status), ('unauthenticated', 401)) + + def test_revocation_at_final_authorization_uses_current_real_credential(self): + credential = self.dataset.access.issue({'label': 'Actual final-check revocation fixture', 'scopes': ['inspect']}) + original = self.dataset.access.require + calls = 0 + + def require(scope, action, target=None, **options): + nonlocal calls + if action == 'runs.retained_analysis': + calls += 1 + if calls == 2: + # Fault-injected timing only: both revocation and the final + # check use the real Access owner and actual PostgreSQL. + with self.owner.bound(self.dataset): + self.dataset.access.revoke(credential['identity']['credential_id']) + return original(scope, action, target, **options) + + with self.dataset.access.bind(credential['token']), patch.object(self.dataset.access, 'require', side_effect=require): + with self.assertRaises(AccessError) as caught: + retained_analysis.query(self.dataset.runs, self.request) + self.assertEqual(calls, 2) + self.assertEqual((caught.exception.code, caught.exception.status), ('unauthenticated', 401)) + + def test_repeated_query_reverifies_hash_bound_artifact(self): + retained_analysis.query(self.dataset.runs, self.request) + path = self.output / 'probes-epoch-0001.json' + original = path.read_bytes() + try: + path.write_bytes(original + b' ') + with self.assertRaises(WorkbenchError): + retained_analysis.query(self.dataset.runs, self.request) + finally: + path.write_bytes(original) + retained_analysis.query(self.dataset.runs, self.request) + + def test_new_process_cold_reopen_preserves_exact_result(self): + expected = retained_analysis.query(self.dataset.runs, self.request) + # A fresh Python process opens the actual retained catalog, authenticates + # with the private fixture token and performs an inert read. No copied + # in-process result is supplied to the child as expected output. + script = '''import json,sys +from pathlib import Path +from unittest.mock import patch +from app import Dataset +import retained_analysis +root=Path(sys.argv[1]); receipt=json.loads((root/'fixture.json').read_text()) +dataset=Dataset(receipt['catalog_path']) +try: + with dataset.access.bind((root/'owner-token').read_text()), patch('subprocess.Popen',side_effect=AssertionError('Cold query must remain inert')): + print(json.dumps(retained_analysis.query(dataset.runs,receipt['request']),sort_keys=True)) +finally: dataset.close() +''' + completed = subprocess.run([sys.executable, '-c', script, str(self.fixture)], cwd=ROOT, + capture_output=True, text=True, timeout=60, check=True) + self.assertEqual(json.loads(completed.stdout), expected) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_retained_analysis_contracts.py b/tests/test_retained_analysis_contracts.py new file mode 100644 index 00000000..14d89c80 --- /dev/null +++ b/tests/test_retained_analysis_contracts.py @@ -0,0 +1,47 @@ +"""Retained query contract closure and compatibility without a database.""" +import hashlib +import json +from pathlib import Path +import re +import sys +import unittest + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT)) +import agent_api + + +class RetainedAnalysisContractTests(unittest.TestCase): + def test_registry_and_existing_contract_bytes_are_unchanged(self): + agent_api.validate_registry() + baseline = json.loads((ROOT / 'tests/fixtures/agent_contract_hashes_phase5a1feac.json').read_text()) + for name, versions in baseline['contracts'].items(): + for version, digest in versions.items(): + self.assertEqual(hashlib.sha256(agent_api.encoded(agent_api.contract(name, int(version)))).hexdigest(), digest) + self.assertEqual(hashlib.sha256(agent_api.encoded(agent_api.discovery())).hexdigest(), baseline['legacy_discovery_sha256']) + + def test_new_inspect_contracts_match_browser_pins(self): + source = (ROOT / 'static/retained-analysis.js').read_text() + for name in ('runs.retained_analysis', 'runs.export_retained_analysis'): + contract = agent_api.contract(name, 1) + pin = re.search("'" + re.escape(name) + "/1': '([a-f0-9]{64})'", source) + self.assertIsNotNone(pin) + self.assertEqual(pin[1], contract['sha256']) + self.assertEqual(contract['scopes'], ['inspect']) + self.assertEqual(contract['effects'], 'read') + + def test_closed_bounded_arguments(self): + arguments = dict(query_id='retained_checkpoint_examples', query_version=1, + run_id='a'*32, evaluation_sha256='b'*64, checkpoint_sha256='c'*64, + metric_id='accuracy', metric_definition_sha256='d'*64) + for name in ('runs.retained_analysis', 'runs.export_retained_analysis'): + agent_api.validate_arguments(name, arguments, version=1) + for changes in ({'sql': 'select 1'}, {'limit': 101}, {'offset': -1}, + {'fields': ['confidence']}, {'fields': ['example_id', 'example_id']}, + {'errors_only': 1}, {'query_version': 2}): + with self.subTest(name=name, changes=changes), self.assertRaises(agent_api.AgentAPIError): + agent_api.validate_arguments(name, dict(arguments, **changes), version=1) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_retained_analysis_http.py b/tests/test_retained_analysis_http.py new file mode 100644 index 00000000..6fd336fe --- /dev/null +++ b/tests/test_retained_analysis_http.py @@ -0,0 +1,122 @@ +"""Prepared real authenticated transport acceptance for the coordinated hooks. + +Enable TULDOK_ANALYSIS_HTTP=1 only after the additive operations are registered. +Reuses a prepared actual retained fixture; never patches an application handler +or substitutes query data. No test-only endpoint is installed. +""" +from http.server import ThreadingHTTPServer +import json +import os +from pathlib import Path +import sys +import threading +import unittest +from urllib.error import HTTPError +from urllib.request import Request, urlopen +from jsonschema import Draft202012Validator + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT)) +from app import Dataset, make_handler +import agent_api +import retained_analysis + + +@unittest.skipUnless(os.environ.get('TULDOK_ANALYSIS_HTTP') == '1', 'Shared retained-analysis HTTP hooks are not yet integrated.') +class ActualRetainedAnalysisHttpTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + fixture = Path(os.environ['TULDOK_ANALYSIS_FIXTURE']) + cls.receipt = json.loads((fixture / 'fixture.json').read_text()) + cls.token = (fixture / 'owner-token').read_text() + cls.contracts = {name: agent_api.contract(name, 1) for name in + ('runs.retained_analysis', 'runs.export_retained_analysis')} + cls.dataset = Dataset(cls.receipt['catalog_path']) + cls.server = ThreadingHTTPServer(('127.0.0.1', 0), make_handler(cls.dataset)) + cls.thread = threading.Thread(target=cls.server.serve_forever, daemon=True) + cls.thread.start() + cls.endpoint = f'http://127.0.0.1:{cls.server.server_port}' + + @classmethod + def tearDownClass(cls): + cls.server.shutdown() + cls.server.server_close() + cls.thread.join(timeout=5) + cls.dataset.close() + + def request(self, *, token=None, export=False, body=None, selected=True): + name = 'runs.export_retained_analysis' if export else 'runs.retained_analysis' + arguments = dict(self.receipt['request']) + run_id = arguments.pop('run_id') + if body is not None: + arguments.update(body) + headers = {'Content-Type': 'application/json', 'Origin': self.endpoint, + 'Authorization': 'Bearer ' + (self.token if token is None else token)} + if selected: + headers['Tuldok-Operation-Contract'] = name + '/1/' + self.contracts[name]['sha256'] + target = self.endpoint + '/api/workspace/runs/' + run_id + '/retained-analysis' + ('/export' if export else '') + request = Request(target, data=json.dumps(arguments).encode(), headers=headers) + try: + response = urlopen(request, timeout=30) + except HTTPError as error: + response = error + with response: + raw = response.read(retained_analysis.MAX_RESPONSE_BYTES + 1) + self.assertLessEqual(len(raw), retained_analysis.MAX_RESPONSE_BYTES) + return response.status, json.loads(raw) + + def test_explicit_contract_and_route_bound_run_are_required(self): + status, value = self.request(selected=False) + self.assertEqual((status, value['code']), (409, 'contract_mismatch')) + # Existing selected-contract rules place Run ID in the path only; + # duplicate body IDs cannot bypass the route's authority even if equal. + status, value = self.request(body={'run_id': self.receipt['run_id']}) + self.assertEqual((status, value['code']), (409, 'contract_mismatch')) + self.assertNotIn('curve', value) + + def test_authenticated_http_and_export_equal_real_query(self): + with self.dataset.access.bind(self.token): + expected = retained_analysis.query(self.dataset.runs, self.receipt['request']) + for export in (False, True): + with self.subTest(export=export): + status, value = self.request(export=export) + self.assertEqual(status, 200) + self.assertEqual(value, expected) + name = 'runs.export_retained_analysis' if export else 'runs.retained_analysis' + Draft202012Validator(self.contracts[name]['output_schema']).validate({'status': status, 'result': value}) + self.assertLessEqual(len(value['examples']['rows']), 1) + self.assertNotIn('probabilities', value['examples']['rows'][0]) + + def test_stale_and_foreign_selection_never_returns_dataset(self): + for body, status, code in (({'evaluation_sha256': '0' * 64}, 409, 'stale'), + ({'metric_definition_sha256': '0' * 64}, 409, 'stale'), + ({'checkpoint_sha256': '0' * 64}, 404, 'not_found')): + with self.subTest(body=body): + actual_status, value = self.request(body=body) + self.assertEqual((actual_status, value['code']), (status, code)) + self.assertNotIn('curve', value) + + def test_closed_request_rejects_sql_and_holdout_without_exposure(self): + for body in ({'sql': 'SELECT arbitrary_data'}, {'split': 'test'}, {'limit': 101}): + with self.subTest(body=body): + status, value = self.request(body=body) + self.assertEqual((status, value['code']), (400, 'invalid')) + self.assertNotIn('examples', value) + with self.dataset.access.bind(self.token): + self.assertFalse(self.dataset.runs.get(self.receipt['run_id'])['test_exposure']['exposed']) + + def test_actual_revocation_blocks_fresh_http_and_export(self): + with self.dataset.access.bind(self.token): + credential = self.dataset.access.issue({'label': 'Retained HTTP revocation fixture', 'scopes': ['inspect']}) + self.assertEqual(self.request(token=credential['token'])[0], 200) + with self.dataset.access.bind(self.token): + self.dataset.access.revoke(credential['identity']['credential_id']) + for export in (False, True): + with self.subTest(export=export): + status, value = self.request(token=credential['token'], export=export) + self.assertEqual((status, value['code']), (401, 'unauthenticated')) + self.assertNotIn('provenance', value) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_workspace_model_controller.cjs b/tests/test_workspace_model_controller.cjs index 5a516a7b..fe58ff59 100644 --- a/tests/test_workspace_model_controller.cjs +++ b/tests/test_workspace_model_controller.cjs @@ -6,19 +6,33 @@ const deferred=()=>{let resolve,reject;const promise=new Promise((yes,no)=>{reso const entry=(epoch,sha)=>({checkpoint:{sha256:sha,name:'checkpoint-'+epoch+'.json'},clocks:{epoch},selected:epoch===2,state:'retained'}); const value=(sha='b')=>({state:'verified',manifest:{producer:{run_id:'run'}},checkpoint_index:{entries:[entry(1,'a'),entry(2,'b')]},probe:{members:[{ordinal:0,frozen_reference:{id:'example',revision:3,source_revision:1}}]},observations:[{checkpoint_sha256:sha,metric_id:'accuracy',value:0,state:'observed'}],checkpoint:{clocks:{epoch:sha==='a'?1:2,optimizer_update:2,wall_elapsed_ms:50},weights:{name:'weights-'+sha+'.pt'}},predictions:{rows:[{ordinal:0,truth_index:0,predicted_index:1,probabilities:[0.2,0.8]}]}}); function fixture(){ - const calls=[],notes=[],opened=[];let handler,view='runs',intent=0,actor={kind:'owner',actor_id:'owner',credential_id:'one'}; + const calls=[],notes=[],opened=[],failures=[];let handler,view='runs',intent=0,actor={kind:'owner',actor_id:'owner',credential_id:'one'}; const nodes={},buttons=[{dataset:{modelCheckpoint:'a'}},{dataset:{modelCheckpoint:'b'}}]; const node=id=>nodes[id]||(nodes[id]={value:'example',addEventListener(type,fn){this[type]=fn;}}); const root={querySelector:node,querySelectorAll:selector=>selector==='[data-model-checkpoint]'?buttons:[]}; const window={workspaceEscape:value=>String(value??'').replaceAll('<','<'),TuldokAuth:{identity:()=>actor}}; const context={window,history:{state:{},replaceState(value){this.state=value;}},structuredClone,crypto:globalThis.crypto,CSS:{escape:String},document:{activeElement:null}}; vm.runInNewContext(source,context); - const ui=window.WorkspaceModel({api:async(route,body)=>{calls.push({route,body});return handler(route,body);},announce:text=>notes.push(text),openRun:()=>{},openRecord:value=>opened.push(value),getView:()=>view,getIntent:()=>intent}); + const ui=window.WorkspaceModel({api:async(route,body)=>{calls.push({route,body});return handler(route,body);},announce:text=>notes.push(text),openRun:()=>{},openRecord:value=>opened.push(value),getView:()=>view,getIntent:()=>intent,onAccessFailure:(...args)=>failures.push(args)}); const run={id:'run',state:'completed',graph:{recipe:'image_classification_model_v2'},metrics:{class_vocabulary:[{label:'circle'},{label:'square'}]}}; let rendered='';const render=()=>{rendered=ui.html(run);ui.bind(root,run,[],render,()=>view==='runs');}; - return {ui,run,calls,notes,opened,nodes,buttons,history:context.history,render,html:()=>rendered,handler:fn=>handler=fn,navigate(){view='pipeline';intent++;ui.invalidate();},session(){actor=null;ui.invalidate();ui.sessionChanged();}}; + return {ui,run,calls,notes,opened,failures,nodes,buttons,expired(){actor=null;},history:context.history,render,html:()=>rendered,handler:fn=>handler=fn,navigate(){view='pipeline';intent++;ui.invalidate();},session(){actor=null;ui.invalidate();ui.sessionChanged();}}; } (async()=>{ + for(const status of [401,403]){ + const denied=fixture(),failure=Object.assign(Error('Current access denied'),{status}); + denied.handler(async()=>{throw failure;}); + await assert.rejects(denied.ui.load(denied.run,()=>true),error=>error===failure, + 'Model evidence denial must reach the Runs owner before detail/predictions can commit'); + assert.doesNotMatch(denied.ui.html(denied.run),/Linked epoch evidence/); + } + for(const change of ['expired','navigate','session']){ + const late=fixture();late.handler(async(route,body)=>value(body.checkpoint_sha256||'b'));await late.ui.load(late.run,()=>true);late.render(); + const held=deferred();late.handler(()=>held.promise);const loading=late.buttons[0].onclick();late[change](); + held.reject(Object.assign(Error('Denied checkpoint'),{status:401}));await loading; + assert.equal(late.failures.length,change==='expired'?1:0,'Only a current model generation reports denial after '+change); + if(change==='expired'){assert.equal(late.failures[0][1],'run');assert.equal(late.failures[0][2],'one');} + } const f=fixture();f.handler(async(route,body)=>value(body.checkpoint_sha256||'b'));await f.ui.load(f.run,()=>true);f.render(); assert.match(f.html(),/Linked epoch evidence/);assert.match(f.html(),/circle/);assert.match(f.html(),/square/);assert.match(f.html(),/>0\.0000<\/td>/,'Observed zero remains zero'); assert.match(f.ui.html({graph:{recipe:'image_classification'}}),/was not captured/); diff --git a/tests/test_workspace_project_startup.cjs b/tests/test_workspace_project_startup.cjs new file mode 100644 index 00000000..3202d3c1 --- /dev/null +++ b/tests/test_workspace_project_startup.cjs @@ -0,0 +1,33 @@ +'use strict'; +// Controller construction only; browser_scientific_fields owns real startup/pointer evidence. +const assert=require('node:assert/strict'),fs=require('node:fs'),path=require('node:path'),vm=require('node:vm'); +function verifyProjectStartup(){ + const html=fs.readFileSync(path.join(__dirname,'../static/workspaces.html'),'utf8'); + assert.match(html.match(/]*id="open-project"[^>]*>/)[0],/\bdisabled\b/,'The initial server markup must withhold the unbound action'); + const nodes=new Map(),listeners=[],requests=[]; + function node(id){ + if(!nodes.has(id))nodes.set(id,{disabled:id==='open-project',open:false,addEventListener(){},showModal(){this.open=true;},close(){this.open=false;},focus(){}}); + return nodes.get(id); + } + const button=node('open-project');let disabled=true,enables=0; + Object.defineProperty(button,'disabled',{get:()=>disabled,set:value=>{ + if(!value){ + assert.equal(typeof button.onclick,'function','The controller installs the action before exposing it'); + assert.equal(typeof node('project-open-form').onsubmit,'function','The complete open form is owned before exposure'); + assert.ok(listeners.includes('pagehide'),'Controller disposal is owned before exposure'); + enables++; + } + disabled=value; + }}); + const window={workspaceEscape:String,addEventListener:event=>listeners.push(event)}; + const context={window,document:{getElementById:node},WorkspaceProjectActivity:()=>({stop(){}}),WorkspaceExternalProject:()=>({cancel(){}}),WorkspaceExtensionModelAuthor:()=>({cancel(){}}),fetch:url=>{requests.push(url);return new Promise(()=>{});}}; + vm.runInNewContext(fs.readFileSync(path.join(__dirname,'../static/workspace-projects.js'),'utf8'),context); + assert.equal(button.disabled,true,'Loading the module alone does not expose an unconstructed controller'); + window.WorkspaceProjects({select:{value:'fixtures'},roots:{},announce(){},switchSource(){},contextChanged(){}}); + assert.equal(button.disabled,false);assert.equal(enables,1); + button.onclick();assert.equal(node('project-open-dialog').open,true,'The enabled first action opens its dialog synchronously'); + assert.deepEqual(requests,['/api/workspace/project-snapshots']); + console.log('PASS project startup markup disabled; owning constructor binds action, form and teardown before enable; first action opens synchronously and reads only'); +} +module.exports={verifyProjectStartup}; +if(require.main===module)verifyProjectStartup();