moraine-cli 0.4.2__py3-none-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- moraine_cli/__init__.py +78 -0
- moraine_cli/_binaries/moraine +0 -0
- moraine_cli/_binaries/moraine-ingest +0 -0
- moraine_cli/_binaries/moraine-mcp +0 -0
- moraine_cli/_binaries/moraine-monitor +0 -0
- moraine_cli/_data/config/moraine.toml +91 -0
- moraine_cli/_data/manifest.json +26 -0
- moraine_cli/_data/web/monitor/dist/app.js +4 -0
- moraine_cli/_data/web/monitor/dist/index.html +19 -0
- moraine_cli/_data/web/monitor/dist/styles.css +1 -0
- moraine_cli/_version.py +2 -0
- moraine_cli/py.typed +0 -0
- moraine_cli-0.4.2.dist-info/METADATA +84 -0
- moraine_cli-0.4.2.dist-info/RECORD +16 -0
- moraine_cli-0.4.2.dist-info/WHEEL +4 -0
- moraine_cli-0.4.2.dist-info/entry_points.txt +5 -0
moraine_cli/__init__.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""Exec shim for the bundled `moraine` binaries distributed via PyPI.
|
|
2
|
+
|
|
3
|
+
Each console-script entry point in `pyproject.toml` maps to one of the
|
|
4
|
+
`_moraine_*_main` helpers below, which resolve the packaged binary via
|
|
5
|
+
`importlib.resources` and re-exec into it with `os.execvpe`. Bundled
|
|
6
|
+
runtime assets (`web/monitor/dist/`, `config/moraine.toml`) are exposed
|
|
7
|
+
to the binary via env vars so the Rust code can locate them without
|
|
8
|
+
relying on filesystem conventions. See RFC #219.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
from importlib.resources import as_file, files
|
|
16
|
+
from typing import NoReturn
|
|
17
|
+
|
|
18
|
+
from ._version import __version__
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"__version__",
|
|
22
|
+
"_moraine_main",
|
|
23
|
+
"_moraine_ingest_main",
|
|
24
|
+
"_moraine_monitor_main",
|
|
25
|
+
"_moraine_mcp_main",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
_MONITOR_DIST_ENV = "MORAINE_MONITOR_DIST"
|
|
29
|
+
_DEFAULT_CONFIG_ENV = "MORAINE_DEFAULT_CONFIG"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _exec(bin_name: str) -> NoReturn:
|
|
33
|
+
root = files(__package__)
|
|
34
|
+
binaries = root / "_binaries"
|
|
35
|
+
data = root / "_data"
|
|
36
|
+
|
|
37
|
+
monitor_dist = data / "web" / "monitor" / "dist"
|
|
38
|
+
default_config = data / "config" / "moraine.toml"
|
|
39
|
+
binary = binaries / bin_name
|
|
40
|
+
|
|
41
|
+
# importlib.resources abstracts over wheels vs. editable installs; coerce
|
|
42
|
+
# each Traversable into a concrete filesystem path for exec + env vars.
|
|
43
|
+
with (
|
|
44
|
+
as_file(binary) as binary_path,
|
|
45
|
+
as_file(monitor_dist) as monitor_dist_path,
|
|
46
|
+
as_file(default_config) as default_config_path,
|
|
47
|
+
):
|
|
48
|
+
env = os.environ.copy()
|
|
49
|
+
# setdefault — do not clobber overrides the user set explicitly.
|
|
50
|
+
env.setdefault(_MONITOR_DIST_ENV, str(monitor_dist_path))
|
|
51
|
+
env.setdefault(_DEFAULT_CONFIG_ENV, str(default_config_path))
|
|
52
|
+
|
|
53
|
+
argv = [bin_name, *sys.argv[1:]]
|
|
54
|
+
os.execvpe(str(binary_path), argv, env)
|
|
55
|
+
|
|
56
|
+
# execvpe does not return on success; the lines below only run if exec
|
|
57
|
+
# itself fails (e.g. ENOEXEC from a corrupted wheel).
|
|
58
|
+
raise SystemExit(
|
|
59
|
+
f"moraine: failed to exec bundled binary {bin_name!r}; "
|
|
60
|
+
"this usually means the wheel is corrupted or was built for a "
|
|
61
|
+
"different platform. Reinstall with: uv tool install --reinstall moraine"
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _moraine_main() -> NoReturn:
|
|
66
|
+
_exec("moraine")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _moraine_ingest_main() -> NoReturn:
|
|
70
|
+
_exec("moraine-ingest")
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _moraine_monitor_main() -> NoReturn:
|
|
74
|
+
_exec("moraine-monitor")
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _moraine_mcp_main() -> NoReturn:
|
|
78
|
+
_exec("moraine-mcp")
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
[clickhouse]
|
|
2
|
+
url = "http://127.0.0.1:8123"
|
|
3
|
+
database = "moraine"
|
|
4
|
+
username = "default"
|
|
5
|
+
password = ""
|
|
6
|
+
timeout_seconds = 30.0
|
|
7
|
+
async_insert = true
|
|
8
|
+
wait_for_async_insert = true
|
|
9
|
+
|
|
10
|
+
[ingest]
|
|
11
|
+
batch_size = 4000
|
|
12
|
+
flush_interval_seconds = 0.5
|
|
13
|
+
state_dir = "~/.moraine/ingestor"
|
|
14
|
+
backfill_on_start = true
|
|
15
|
+
max_file_workers = 8
|
|
16
|
+
max_inflight_batches = 64
|
|
17
|
+
debounce_ms = 50
|
|
18
|
+
reconcile_interval_seconds = 30.0
|
|
19
|
+
heartbeat_interval_seconds = 5.0
|
|
20
|
+
|
|
21
|
+
[[ingest.sources]]
|
|
22
|
+
name = "codex"
|
|
23
|
+
harness = "codex"
|
|
24
|
+
enabled = true
|
|
25
|
+
glob = "~/.codex/sessions/**/*.jsonl"
|
|
26
|
+
watch_root = "~/.codex/sessions"
|
|
27
|
+
|
|
28
|
+
[[ingest.sources]]
|
|
29
|
+
name = "claude"
|
|
30
|
+
harness = "claude-code"
|
|
31
|
+
enabled = true
|
|
32
|
+
glob = "~/.claude/projects/**/*.jsonl"
|
|
33
|
+
watch_root = "~/.claude/projects"
|
|
34
|
+
|
|
35
|
+
# Hermes Agent LIVE sessions: one JSON file per conversation under
|
|
36
|
+
# ~/.hermes/sessions/ that the agent rewrites in place every turn.
|
|
37
|
+
# `format = "session_json"` opts into the rewrite-aware processor that emits
|
|
38
|
+
# only the newly appended messages on each watcher notify. Leave `format`
|
|
39
|
+
# unset and moraine will infer it from the `.json` glob.
|
|
40
|
+
[[ingest.sources]]
|
|
41
|
+
name = "hermes"
|
|
42
|
+
harness = "hermes"
|
|
43
|
+
enabled = true
|
|
44
|
+
glob = "~/.hermes/sessions/session_*.json"
|
|
45
|
+
watch_root = "~/.hermes/sessions"
|
|
46
|
+
format = "session_json"
|
|
47
|
+
|
|
48
|
+
# Hermes Agent offline trajectories: ShareGPT-compatible JSONL written by
|
|
49
|
+
# the datagen batch runner. Point at whatever directory your runner writes
|
|
50
|
+
# `trajectory_samples.jsonl` to. Uncomment and adjust when you need it.
|
|
51
|
+
# [[ingest.sources]]
|
|
52
|
+
# name = "hermes-trajectories"
|
|
53
|
+
# harness = "hermes"
|
|
54
|
+
# enabled = true
|
|
55
|
+
# glob = "~/trajectories/**/*.jsonl"
|
|
56
|
+
# watch_root = "~/trajectories"
|
|
57
|
+
# format = "jsonl"
|
|
58
|
+
|
|
59
|
+
[mcp]
|
|
60
|
+
max_results = 25
|
|
61
|
+
preview_chars = 320
|
|
62
|
+
default_context_before = 3
|
|
63
|
+
default_context_after = 3
|
|
64
|
+
default_include_tool_events = false
|
|
65
|
+
default_exclude_codex_mcp = true
|
|
66
|
+
async_log_writes = true
|
|
67
|
+
protocol_version = "2024-11-05"
|
|
68
|
+
|
|
69
|
+
[bm25]
|
|
70
|
+
k1 = 1.2
|
|
71
|
+
b = 0.75
|
|
72
|
+
default_min_score = 0.0
|
|
73
|
+
default_min_should_match = 1
|
|
74
|
+
max_query_terms = 32
|
|
75
|
+
|
|
76
|
+
[monitor]
|
|
77
|
+
host = "127.0.0.1"
|
|
78
|
+
port = 8080
|
|
79
|
+
|
|
80
|
+
[runtime]
|
|
81
|
+
root_dir = "~/.moraine"
|
|
82
|
+
logs_dir = "logs"
|
|
83
|
+
pids_dir = "run"
|
|
84
|
+
service_bin_dir = "~/.local/bin"
|
|
85
|
+
managed_clickhouse_dir = "~/.local/lib/moraine/clickhouse/current"
|
|
86
|
+
clickhouse_start_timeout_seconds = 30.0
|
|
87
|
+
healthcheck_interval_ms = 500
|
|
88
|
+
clickhouse_auto_install = true
|
|
89
|
+
clickhouse_version = "v25.12.5.44-stable"
|
|
90
|
+
start_monitor_on_up = true
|
|
91
|
+
start_mcp_on_up = false
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bundle_format_version": 1,
|
|
3
|
+
"target": "aarch64-apple-darwin",
|
|
4
|
+
"version": "main",
|
|
5
|
+
"build": {
|
|
6
|
+
"timestamp_utc": "2026-04-19T13:23:27Z",
|
|
7
|
+
"git_commit": "30d63193c9df12f1a535f94ff7435a3a47e40319",
|
|
8
|
+
"rustc": "rustc 1.95.0 (59807616e 2026-04-14)"
|
|
9
|
+
},
|
|
10
|
+
"binaries": [
|
|
11
|
+
"moraine",
|
|
12
|
+
"moraine-ingest",
|
|
13
|
+
"moraine-monitor",
|
|
14
|
+
"moraine-mcp"
|
|
15
|
+
],
|
|
16
|
+
"checksums": {
|
|
17
|
+
"bin/moraine": "00346fa961d199032896cad1c77987cd3bb55aa810535aa91cba3ee3b92c695b",
|
|
18
|
+
"bin/moraine-ingest": "ae7ffb11ca3b9024d3b7de710434a8b6c690272f8c4a49ec00343ea0bb889444",
|
|
19
|
+
"bin/moraine-monitor": "f38c960a14c01e184815263c9f7ab64bbee8ec411c884b4d5f489cc09ac89f4b",
|
|
20
|
+
"bin/moraine-mcp": "ab2f9730a10890b80eac47bc5644440058c362da5209b9abc5e7b789c4085955",
|
|
21
|
+
"config/moraine.toml": "697a585aafe1263c34824e18e9b1a6b00881c1bbeed8f66e744105d739dc957d"
|
|
22
|
+
},
|
|
23
|
+
"web_assets": [
|
|
24
|
+
"web/monitor/dist"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const Ws=!1;var rs=Array.isArray,Wc=Array.prototype.indexOf,Rn=Array.prototype.includes,as=Array.from,Ba=Object.defineProperty,En=Object.getOwnPropertyDescriptor,Va=Object.getOwnPropertyDescriptors,Hc=Object.prototype,jc=Array.prototype,ho=Object.getPrototypeOf,Xo=Object.isExtensible;const Ee=()=>{};function $c(e){return e()}function qi(e){for(var t=0;t<e.length;t++)e[t]()}function Wa(){var e,t,n=new Promise((i,s)=>{e=i,t=s});return{promise:n,resolve:e,reject:t}}const Lt=2,di=4,yi=8,Ha=1<<24,ze=16,fe=32,Sn=64,ja=128,oe=512,Tt=1024,Rt=2048,ae=4096,Jt=8192,Le=16384,wi=32768,In=65536,qo=1<<17,$a=1<<18,jn=1<<19,Ya=1<<20,Ae=1<<25,bn=65536,Hs=1<<21,uo=1<<22,Ue=1<<23,Re=Symbol("$state"),Yc=Symbol("legacy props"),Uc=Symbol(""),dn=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Xc=globalThis.document?.contentType?.includes("xml")??!1;function fo(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function qc(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Kc(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Gc(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Jc(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Zc(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Qc(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function th(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function eh(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function nh(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ih(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function sh(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const oh=1,rh=2,Ua=4,ah=8,lh=16,ch=1,hh=2,uh=4,dh=8,fh=16,gh=1,ph=2,Et=Symbol(),Xa="http://www.w3.org/1999/xhtml";function mh(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function vh(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function qa(e){return e===this.v}function Ka(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Ga(e){return!Ka(e,this.v)}let $n=!1,_h=!1;function bh(){$n=!0}let gt=null;function Fn(e){gt=e}function Ut(e,t=!1,n){gt={p:gt,i:!1,c:null,e:null,s:e,x:null,l:$n&&!t?{s:null,u:null,$:[]}:null}}function Xt(e){var t=gt,n=t.e;if(n!==null){t.e=null;for(var i of n)dl(i)}return t.i=!0,gt=t.p,{}}function ki(){return!$n||gt!==null&>.l===null}let Dn=[];function xh(){var e=Dn;Dn=[],qi(e)}function Ie(e){if(Dn.length===0){var t=Dn;queueMicrotask(()=>{t===Dn&&xh()})}Dn.push(e)}function Ja(e){var t=st;if(t===null)return et.f|=Ue,e;if((t.f&wi)===0&&(t.f&di)===0)throw e;zn(e,t)}function zn(e,t){for(;t!==null;){if((t.f&ja)!==0){if((t.f&wi)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const yh=-7169;function wt(e,t){e.f=e.f&yh|t}function go(e){(e.f&oe)!==0||e.deps===null?wt(e,Tt):wt(e,ae)}function Za(e){if(e!==null)for(const t of e)(t.f&Lt)===0||(t.f&bn)===0||(t.f^=bn,Za(t.deps))}function Qa(e,t,n){(e.f&Rt)!==0?t.add(e):(e.f&ae)!==0&&n.add(e),Za(e.deps),wt(e,Tt)}const Pi=new Set;let bt=null,ce=null,ne=[],po=null,js=!1;class Xe{committed=!1;current=new Map;previous=new Map;#e=new Set;#a=new Set;#t=0;#o=0;#r=null;#i=new Set;#n=new Set;#s=new Map;is_fork=!1;#l=!1;is_deferred(){return this.is_fork||this.#o>0}skip_effect(t){this.#s.has(t)||this.#s.set(t,{d:[],m:[]})}unskip_effect(t){var n=this.#s.get(t);if(n){this.#s.delete(t);for(var i of n.d)wt(i,Rt),he(i);for(i of n.m)wt(i,ae),he(i)}}process(t){ne=[],this.apply();var n=[],i=[];for(const s of t)this.#c(s,n,i);if(this.is_deferred()){this.#h(i),this.#h(n);for(const[s,o]of this.#s)nl(s,o)}else{for(const s of this.#e)s();this.#e.clear(),this.#t===0&&this.#u(),bt=null,Ko(i),Ko(n),this.#r?.resolve()}ce=null}#c(t,n,i){t.f^=Tt;for(var s=t.first,o=null;s!==null;){var r=s.f,a=(r&(fe|Sn))!==0,l=a&&(r&Tt)!==0,c=l||(r&Jt)!==0||this.#s.has(s);if(!c&&s.fn!==null){a?s.f^=Tt:o!==null&&(r&(di|yi|Ha))!==0?o.b.defer_effect(s):(r&di)!==0?n.push(s):Yn(s)&&((r&ze)!==0&&this.#n.add(s),yn(s));var h=s.first;if(h!==null){s=h;continue}}var u=s.parent;for(s=s.next;s===null&&u!==null;)u===o&&(o=null),s=u.next,u=u.parent}}#h(t){for(var n=0;n<t.length;n+=1)Qa(t[n],this.#i,this.#n)}capture(t,n){n!==Et&&!this.previous.has(t)&&this.previous.set(t,n),(t.f&Ue)===0&&(this.current.set(t,t.v),ce?.set(t,t.v))}activate(){bt=this,this.apply()}deactivate(){bt===this&&(bt=null,ce=null)}flush(){if(this.activate(),ne.length>0){if(wh(),bt!==null&&bt!==this)return}else this.#t===0&&this.process([]);this.deactivate()}discard(){for(const t of this.#a)t(this);this.#a.clear()}#u(){if(Pi.size>1){this.previous.clear();var t=ce,n=!0;for(const s of Pi){if(s===this){n=!1;continue}const o=[];for(const[a,l]of this.current){if(s.current.has(a))if(n&&l!==s.current.get(a))s.current.set(a,l);else continue;o.push(a)}if(o.length===0)continue;const r=[...s.current.keys()].filter(a=>!this.current.has(a));if(r.length>0){var i=ne;ne=[];const a=new Set,l=new Map;for(const c of o)tl(c,r,a,l);if(ne.length>0){bt=s,s.apply();for(const c of ne)s.#c(c,[],[]);s.deactivate()}ne=i}}bt=null,ce=t}this.committed=!0,Pi.delete(this)}increment(t){this.#t+=1,t&&(this.#o+=1)}decrement(t){this.#t-=1,t&&(this.#o-=1),!this.#l&&(this.#l=!0,Ie(()=>{this.#l=!1,this.is_deferred()?ne.length>0&&this.flush():this.revive()}))}revive(){for(const t of this.#i)this.#n.delete(t),wt(t,Rt),he(t);for(const t of this.#n)wt(t,ae),he(t);this.flush()}oncommit(t){this.#e.add(t)}ondiscard(t){this.#a.add(t)}settled(){return(this.#r??=Wa()).promise}static ensure(){if(bt===null){const t=bt=new Xe;Pi.add(bt),Ie(()=>{bt===t&&t.flush()})}return bt}apply(){}}function wh(){js=!0;var e=null;try{for(var t=0;ne.length>0;){var n=Xe.ensure();if(t++>1e3){var i,s;kh()}n.process(ne),qe.clear()}}finally{ne=[],js=!1,po=null}}function kh(){try{Qc()}catch(e){zn(e,po)}}let Ce=null;function Ko(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var i=e[n++];if((i.f&(Le|Jt))===0&&Yn(i)&&(Ce=new Set,yn(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&gl(i),Ce?.size>0)){qe.clear();for(const s of Ce){if((s.f&(Le|Jt))!==0)continue;const o=[s];let r=s.parent;for(;r!==null;)Ce.has(r)&&(Ce.delete(r),o.push(r)),r=r.parent;for(let a=o.length-1;a>=0;a--){const l=o[a];(l.f&(Le|Jt))===0&&yn(l)}}Ce.clear()}}Ce=null}}function tl(e,t,n,i){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const s of e.reactions){const o=s.f;(o&Lt)!==0?tl(s,t,n,i):(o&(uo|ze))!==0&&(o&Rt)===0&&el(s,t,i)&&(wt(s,Rt),he(s))}}function el(e,t,n){const i=n.get(e);if(i!==void 0)return i;if(e.deps!==null)for(const s of e.deps){if(Rn.call(t,s))return!0;if((s.f&Lt)!==0&&el(s,t,n))return n.set(s,!0),!0}return n.set(e,!1),!1}function he(e){for(var t=po=e;t.parent!==null;){t=t.parent;var n=t.f;if(js&&t===st&&(n&ze)!==0&&(n&$a)===0)return;if((n&(Sn|fe))!==0){if((n&Tt)===0)return;t.f^=Tt}}ne.push(t)}function nl(e,t){if(!((e.f&fe)!==0&&(e.f&Tt)!==0)){(e.f&Rt)!==0?t.d.push(e):(e.f&ae)!==0&&t.m.push(e),wt(e,Tt);for(var n=e.first;n!==null;)nl(n,t),n=n.next}}function Sh(e){let t=0,n=xn(0),i;return()=>{_o()&&(g(n),hs(()=>(t===0&&(i=P(()=>e(()=>ri(n)))),t+=1,()=>{Ie(()=>{t-=1,t===0&&(i?.(),i=void 0,ri(n))})})))}}var Mh=In|jn|ja;function Ch(e,t,n){new Ph(e,t,n)}class Ph{parent;is_pending=!1;#e;#a=null;#t;#o;#r;#i=null;#n=null;#s=null;#l=null;#c=null;#h=0;#u=0;#g=!1;#f=!1;#p=new Set;#m=new Set;#d=null;#y=Sh(()=>(this.#d=xn(this.#h),()=>{this.#d=null}));constructor(t,n,i){this.#e=t,this.#t=n,this.#o=i,this.parent=st.b,this.is_pending=!!this.#t.pending,this.#r=bo(()=>{st.b=this;{var s=this.#b();try{this.#i=se(()=>i(s))}catch(o){this.error(o)}this.#u>0?this.#_():this.is_pending=!1}return()=>{this.#c?.remove()}},Mh)}#w(){try{this.#i=se(()=>this.#o(this.#e))}catch(t){this.error(t)}}#k(){const t=this.#t.pending;t&&(this.#n=se(()=>t(this.#e)),Ie(()=>{var n=this.#b();this.#i=this.#v(()=>(Xe.ensure(),se(()=>this.#o(n)))),this.#u>0?this.#_():(pn(this.#n,()=>{this.#n=null}),this.is_pending=!1)}))}#b(){var t=this.#e;return this.is_pending&&(this.#c=Fe(),this.#e.before(this.#c),t=this.#c),t}defer_effect(t){Qa(t,this.#p,this.#m)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#t.pending}#v(t){var n=st,i=et,s=gt;be(this.#r),le(this.#r),Fn(this.#r.ctx);try{return t()}catch(o){return Ja(o),null}finally{be(n),le(i),Fn(s)}}#_(){const t=this.#t.pending;this.#i!==null&&(this.#l=document.createDocumentFragment(),this.#l.append(this.#c),vl(this.#i,this.#l)),this.#n===null&&(this.#n=se(()=>t(this.#e)))}#x(t){if(!this.has_pending_snippet()){this.parent&&this.parent.#x(t);return}if(this.#u+=t,this.#u===0){this.is_pending=!1;for(const n of this.#p)wt(n,Rt),he(n);for(const n of this.#m)wt(n,ae),he(n);this.#p.clear(),this.#m.clear(),this.#n&&pn(this.#n,()=>{this.#n=null}),this.#l&&(this.#e.before(this.#l),this.#l=null)}}update_pending_count(t){this.#x(t),this.#h+=t,!(!this.#d||this.#g)&&(this.#g=!0,Ie(()=>{this.#g=!1,this.#d&&Nn(this.#d,this.#h)}))}get_effect_pending(){return this.#y(),g(this.#d)}error(t){var n=this.#t.onerror;let i=this.#t.failed;if(this.#f||!n&&!i)throw t;this.#i&&(Yt(this.#i),this.#i=null),this.#n&&(Yt(this.#n),this.#n=null),this.#s&&(Yt(this.#s),this.#s=null);var s=!1,o=!1;const r=()=>{if(s){vh();return}s=!0,o&&sh(),Xe.ensure(),this.#h=0,this.#s!==null&&pn(this.#s,()=>{this.#s=null}),this.is_pending=this.has_pending_snippet(),this.#i=this.#v(()=>(this.#f=!1,se(()=>this.#o(this.#e)))),this.#u>0?this.#_():this.is_pending=!1};Ie(()=>{try{o=!0,n?.(t,r),o=!1}catch(a){zn(a,this.#r&&this.#r.parent)}i&&(this.#s=this.#v(()=>{Xe.ensure(),this.#f=!0;try{return se(()=>{i(this.#e,()=>t,()=>r)})}catch(a){return zn(a,this.#r.parent),null}finally{this.#f=!1}}))})}}function Ah(e,t,n,i){const s=ki()?ls:Pt;var o=e.filter(d=>!d.settled);if(n.length===0&&o.length===0){i(t.map(s));return}var r=bt,a=st,l=Th(),c=o.length===1?o[0].promise:o.length>1?Promise.all(o.map(d=>d.promise)):null;function h(d){l();try{i(d)}catch(f){(a.f&Le)===0&&zn(f,a)}r?.deactivate(),$s()}if(n.length===0){c.then(()=>h(t.map(s)));return}function u(){l(),Promise.all(n.map(d=>Dh(d))).then(d=>h([...t.map(s),...d])).catch(d=>zn(d,a))}c?c.then(u):u()}function Th(){var e=st,t=et,n=gt,i=bt;return function(o=!0){be(e),le(t),Fn(n),o&&i?.activate()}}function $s(){be(null),le(null),Fn(null)}function ls(e){var t=Lt|Rt,n=et!==null&&(et.f&Lt)!==0?et:null;return st!==null&&(st.f|=jn),{ctx:gt,deps:null,effects:null,equals:qa,f:t,fn:e,reactions:null,rv:0,v:Et,wv:0,parent:n??st,ac:null}}function Dh(e,t,n){let i=st;i===null&&qc();var s=i.b,o=void 0,r=xn(Et),a=!et,l=new Map;return jh(()=>{var c=Wa();o=c.promise;try{Promise.resolve(e()).then(c.resolve,c.reject).then(()=>{h===bt&&h.committed&&h.deactivate(),$s()})}catch(f){c.reject(f),$s()}var h=bt;if(a){var u=s.is_rendered();s.update_pending_count(1),h.increment(u),l.get(h)?.reject(dn),l.delete(h),l.set(h,c)}const d=(f,p=void 0)=>{if(h.activate(),p)p!==dn&&(r.f|=Ue,Nn(r,p));else{(r.f&Ue)!==0&&(r.f^=Ue),Nn(r,f);for(const[m,v]of l){if(l.delete(m),m===h)break;v.reject(dn)}}a&&(s.update_pending_count(-1),h.decrement(u))};c.promise.then(d,f=>d(null,f||"unknown"))}),cs(()=>{for(const c of l.values())c.reject(dn)}),new Promise(c=>{function h(u){function d(){u===o?c(r):h(o)}u.then(d,d)}h(o)})}function Pt(e){const t=ls(e);return t.equals=Ga,t}function Oh(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Yt(t[n])}}function Eh(e){for(var t=e.parent;t!==null;){if((t.f&Lt)===0)return(t.f&Le)===0?t:null;t=t.parent}return null}function mo(e){var t,n=st;be(Eh(e));try{e.f&=~bn,Oh(e),t=yl(e)}finally{be(n)}return t}function il(e){var t=mo(e);if(!e.equals(t)&&(e.wv=bl(),(!bt?.is_fork||e.deps===null)&&(e.v=t,e.deps===null))){wt(e,Tt);return}Ge||(ce!==null?(_o()||bt?.is_fork)&&ce.set(e,t):go(e))}function Lh(e){if(e.effects!==null)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(dn),t.teardown=Ee,t.ac=null,fi(t,0),xo(t))}function sl(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&yn(t)}let Ys=new Set;const qe=new Map;let ol=!1;function xn(e,t){var n={f:0,v:e,reactions:null,equals:qa,rv:0,wv:0};return n}function Be(e,t){const n=xn(e);return Uh(n),n}function tt(e,t=!1,n=!0){const i=xn(e);return t||(i.equals=Ga),$n&&n&>!==null&>.l!==null&&(gt.l.s??=[]).push(i),i}function $(e,t,n=!1){et!==null&&(!ue||(et.f&qo)!==0)&&ki()&&(et.f&(Lt|ze|uo|qo))!==0&&(re===null||!Rn.call(re,e))&&ih();let i=n?On(t):t;return Nn(e,i)}function Nn(e,t){if(!e.equals(t)){var n=e.v;Ge?qe.set(e,t):qe.set(e,n),e.v=t;var i=Xe.ensure();if(i.capture(e,n),(e.f&Lt)!==0){const s=e;(e.f&Rt)!==0&&mo(s),go(s)}e.wv=bl(),rl(e,Rt),ki()&&st!==null&&(st.f&Tt)!==0&&(st.f&(fe|Sn))===0&&(ee===null?Xh([e]):ee.push(e)),!i.is_fork&&Ys.size>0&&!ol&&Rh()}return t}function Rh(){ol=!1;for(const e of Ys)(e.f&Tt)!==0&&wt(e,ae),Yn(e)&&yn(e);Ys.clear()}function ri(e){$(e,e.v+1)}function rl(e,t){var n=e.reactions;if(n!==null)for(var i=ki(),s=n.length,o=0;o<s;o++){var r=n[o],a=r.f;if(!(!i&&r===st)){var l=(a&Rt)===0;if(l&&wt(r,t),(a&Lt)!==0){var c=r;ce?.delete(c),(a&bn)===0&&(a&oe&&(r.f|=bn),rl(c,ae))}else l&&((a&ze)!==0&&Ce!==null&&Ce.add(r),he(r))}}}function On(e){if(typeof e!="object"||e===null||Re in e)return e;const t=ho(e);if(t!==Hc&&t!==jc)return e;var n=new Map,i=rs(e),s=Be(0),o=mn,r=a=>{if(mn===o)return a();var l=et,c=mn;le(null),Qo(o);var h=a();return le(l),Qo(c),h};return i&&n.set("length",Be(e.length)),new Proxy(e,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&eh();var h=n.get(l);return h===void 0?r(()=>{var u=Be(c.value);return n.set(l,u),u}):$(h,c.value,!0),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0){if(l in a){const h=r(()=>Be(Et));n.set(l,h),ri(s)}}else $(c,Et),ri(s);return!0},get(a,l,c){if(l===Re)return e;var h=n.get(l),u=l in a;if(h===void 0&&(!u||En(a,l)?.writable)&&(h=r(()=>{var f=On(u?a[l]:Et),p=Be(f);return p}),n.set(l,h)),h!==void 0){var d=g(h);return d===Et?void 0:d}return Reflect.get(a,l,c)},getOwnPropertyDescriptor(a,l){var c=Reflect.getOwnPropertyDescriptor(a,l);if(c&&"value"in c){var h=n.get(l);h&&(c.value=g(h))}else if(c===void 0){var u=n.get(l),d=u?.v;if(u!==void 0&&d!==Et)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return c},has(a,l){if(l===Re)return!0;var c=n.get(l),h=c!==void 0&&c.v!==Et||Reflect.has(a,l);if(c!==void 0||st!==null&&(!h||En(a,l)?.writable)){c===void 0&&(c=r(()=>{var d=h?On(a[l]):Et,f=Be(d);return f}),n.set(l,c));var u=g(c);if(u===Et)return!1}return h},set(a,l,c,h){var u=n.get(l),d=l in a;if(i&&l==="length")for(var f=c;f<u.v;f+=1){var p=n.get(f+"");p!==void 0?$(p,Et):f in a&&(p=r(()=>Be(Et)),n.set(f+"",p))}if(u===void 0)(!d||En(a,l)?.writable)&&(u=r(()=>Be(void 0)),$(u,On(c)),n.set(l,u));else{d=u.v!==Et;var m=r(()=>On(c));$(u,m)}var v=Reflect.getOwnPropertyDescriptor(a,l);if(v?.set&&v.set.call(h,c),!d){if(i&&typeof l=="string"){var _=n.get("length"),b=Number(l);Number.isInteger(b)&&b>=_.v&&$(_,b+1)}ri(s)}return!0},ownKeys(a){g(s);var l=Reflect.ownKeys(a).filter(u=>{var d=n.get(u);return d===void 0||d.v!==Et});for(var[c,h]of n)h.v!==Et&&!(c in a)&&l.push(c);return l},setPrototypeOf(){nh()}})}function Go(e){try{if(e!==null&&typeof e=="object"&&Re in e)return e[Re]}catch{}return e}function Ih(e,t){return Object.is(Go(e),Go(t))}var Jo,al,ll,cl;function Fh(){if(Jo===void 0){Jo=window,al=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;ll=En(t,"firstChild").get,cl=En(t,"nextSibling").get,Xo(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Xo(n)&&(n.__t=void 0)}}function Fe(e=""){return document.createTextNode(e)}function Ki(e){return ll.call(e)}function Si(e){return cl.call(e)}function M(e,t){return Ki(e)}function fn(e,t=!1){{var n=Ki(e);return n instanceof Comment&&n.data===""?Si(n):n}}function A(e,t=1,n=!1){let i=e;for(;t--;)i=Si(i);return i}function zh(e){e.textContent=""}function hl(){return!1}function Nh(e,t,n){return document.createElementNS(Xa,e,void 0)}function vo(e){var t=et,n=st;le(null),be(null);try{return e()}finally{le(t),be(n)}}function ul(e){st===null&&(et===null&&Zc(),Jc()),Ge&&Gc()}function Bh(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function xe(e,t,n){var i=st;i!==null&&(i.f&Jt)!==0&&(e|=Jt);var s={ctx:gt,deps:null,nodes:null,f:e|Rt|oe,first:null,fn:t,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(n)try{yn(s)}catch(a){throw Yt(s),a}else t!==null&&he(s);var o=s;if(n&&o.deps===null&&o.teardown===null&&o.nodes===null&&o.first===o.last&&(o.f&jn)===0&&(o=o.first,(e&ze)!==0&&(e&In)!==0&&o!==null&&(o.f|=In)),o!==null&&(o.parent=i,i!==null&&Bh(o,i),et!==null&&(et.f&Lt)!==0&&(e&Sn)===0)){var r=et;(r.effects??=[]).push(o)}return s}function _o(){return et!==null&&!ue}function cs(e){const t=xe(yi,null,!1);return wt(t,Tt),t.teardown=e,t}function Us(e){ul();var t=st.f,n=!et&&(t&fe)!==0&&(t&wi)===0;if(n){var i=gt;(i.e??=[]).push(e)}else return dl(e)}function dl(e){return xe(di|Ya,e,!1)}function Vh(e){return ul(),xe(yi|Ya,e,!0)}function Wh(e){Xe.ensure();const t=xe(Sn|jn,e,!0);return(n={})=>new Promise(i=>{n.outro?pn(t,()=>{Yt(t),i(void 0)}):(Yt(t),i(void 0))})}function Hh(e){return xe(di,e,!1)}function Mt(e,t){var n=gt,i={effect:null,ran:!1,deps:e};n.l.$.push(i),i.effect=hs(()=>{e(),!i.ran&&(i.ran=!0,P(t))})}function ye(){var e=gt;hs(()=>{for(var t of e.l.$){t.deps();var n=t.effect;(n.f&Tt)!==0&&n.deps!==null&&wt(n,ae),Yn(n)&&yn(n),t.ran=!1}})}function jh(e){return xe(uo|jn,e,!0)}function hs(e,t=0){return xe(yi|t,e,!0)}function q(e,t=[],n=[],i=[]){Ah(i,t,n,s=>{xe(yi,()=>e(...s.map(g)),!0)})}function bo(e,t=0){var n=xe(ze|t,e,!0);return n}function se(e){return xe(fe|jn,e,!0)}function fl(e){var t=e.teardown;if(t!==null){const n=Ge,i=et;Zo(!0),le(null);try{t.call(null)}finally{Zo(n),le(i)}}}function xo(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const s=n.ac;s!==null&&vo(()=>{s.abort(dn)});var i=n.next;(n.f&Sn)!==0?n.parent=null:Yt(n,t),n=i}}function $h(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&fe)===0&&Yt(t),t=n}}function Yt(e,t=!0){var n=!1;(t||(e.f&$a)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(Yh(e.nodes.start,e.nodes.end),n=!0),xo(e,t&&!n),fi(e,0),wt(e,Le);var i=e.nodes&&e.nodes.t;if(i!==null)for(const o of i)o.stop();fl(e);var s=e.parent;s!==null&&s.first!==null&&gl(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function Yh(e,t){for(;e!==null;){var n=e===t?null:Si(e);e.remove(),e=n}}function gl(e){var t=e.parent,n=e.prev,i=e.next;n!==null&&(n.next=i),i!==null&&(i.prev=n),t!==null&&(t.first===e&&(t.first=i),t.last===e&&(t.last=n))}function pn(e,t,n=!0){var i=[];pl(e,i,!0);var s=()=>{n&&Yt(e),t&&t()},o=i.length;if(o>0){var r=()=>--o||s();for(var a of i)a.out(r)}else s()}function pl(e,t,n){if((e.f&Jt)===0){e.f^=Jt;var i=e.nodes&&e.nodes.t;if(i!==null)for(const a of i)(a.is_global||n)&&t.push(a);for(var s=e.first;s!==null;){var o=s.next,r=(s.f&In)!==0||(s.f&fe)!==0&&(e.f&ze)!==0;pl(s,t,r?n:!1),s=o}}}function yo(e){ml(e,!0)}function ml(e,t){if((e.f&Jt)!==0){e.f^=Jt,(e.f&Tt)===0&&(wt(e,Rt),he(e));for(var n=e.first;n!==null;){var i=n.next,s=(n.f&In)!==0||(n.f&fe)!==0;ml(n,s?t:!1),n=i}var o=e.nodes&&e.nodes.t;if(o!==null)for(const r of o)(r.is_global||t)&&r.in()}}function vl(e,t){if(e.nodes)for(var n=e.nodes.start,i=e.nodes.end;n!==null;){var s=n===i?null:Si(n);t.append(n),n=s}}let $i=!1,Ge=!1;function Zo(e){Ge=e}let et=null,ue=!1;function le(e){et=e}let st=null;function be(e){st=e}let re=null;function Uh(e){et!==null&&(re===null?re=[e]:re.push(e))}let jt=null,Kt=0,ee=null;function Xh(e){ee=e}let _l=1,gn=0,mn=gn;function Qo(e){mn=e}function bl(){return++_l}function Yn(e){var t=e.f;if((t&Rt)!==0)return!0;if(t&Lt&&(e.f&=~bn),(t&ae)!==0){for(var n=e.deps,i=n.length,s=0;s<i;s++){var o=n[s];if(Yn(o)&&il(o),o.wv>e.wv)return!0}(t&oe)!==0&&ce===null&&wt(e,Tt)}return!1}function xl(e,t,n=!0){var i=e.reactions;if(i!==null&&!(re!==null&&Rn.call(re,e)))for(var s=0;s<i.length;s++){var o=i[s];(o.f&Lt)!==0?xl(o,t,!1):t===o&&(n?wt(o,Rt):(o.f&Tt)!==0&&wt(o,ae),he(o))}}function yl(e){var t=jt,n=Kt,i=ee,s=et,o=re,r=gt,a=ue,l=mn,c=e.f;jt=null,Kt=0,ee=null,et=(c&(fe|Sn))===0?e:null,re=null,Fn(e.ctx),ue=!1,mn=++gn,e.ac!==null&&(vo(()=>{e.ac.abort(dn)}),e.ac=null);try{e.f|=Hs;var h=e.fn,u=h();e.f|=wi;var d=e.deps,f=bt?.is_fork;if(jt!==null){var p;if(f||fi(e,Kt),d!==null&&Kt>0)for(d.length=Kt+jt.length,p=0;p<jt.length;p++)d[Kt+p]=jt[p];else e.deps=d=jt;if(_o()&&(e.f&oe)!==0)for(p=Kt;p<d.length;p++)(d[p].reactions??=[]).push(e)}else!f&&d!==null&&Kt<d.length&&(fi(e,Kt),d.length=Kt);if(ki()&&ee!==null&&!ue&&d!==null&&(e.f&(Lt|ae|Rt))===0)for(p=0;p<ee.length;p++)xl(ee[p],e);if(s!==null&&s!==e){if(gn++,s.deps!==null)for(let m=0;m<n;m+=1)s.deps[m].rv=gn;if(t!==null)for(const m of t)m.rv=gn;ee!==null&&(i===null?i=ee:i.push(...ee))}return(e.f&Ue)!==0&&(e.f^=Ue),u}catch(m){return Ja(m)}finally{e.f^=Hs,jt=t,Kt=n,ee=i,et=s,re=o,Fn(r),ue=a,mn=l}}function qh(e,t){let n=t.reactions;if(n!==null){var i=Wc.call(n,e);if(i!==-1){var s=n.length-1;s===0?n=t.reactions=null:(n[i]=n[s],n.pop())}}if(n===null&&(t.f&Lt)!==0&&(jt===null||!Rn.call(jt,t))){var o=t;(o.f&oe)!==0&&(o.f^=oe,o.f&=~bn),go(o),Lh(o),fi(o,0)}}function fi(e,t){var n=e.deps;if(n!==null)for(var i=t;i<n.length;i++)qh(e,n[i])}function yn(e){var t=e.f;if((t&Le)===0){wt(e,Tt);var n=st,i=$i;st=e,$i=!0;try{(t&(ze|Ha))!==0?$h(e):xo(e),fl(e);var s=yl(e);e.teardown=typeof s=="function"?s:null,e.wv=_l;var o;Ws&&_h&&(e.f&Rt)!==0&&e.deps}finally{$i=i,st=n}}}function g(e){var t=e.f,n=(t&Lt)!==0;if(et!==null&&!ue){var i=st!==null&&(st.f&Le)!==0;if(!i&&(re===null||!Rn.call(re,e))){var s=et.deps;if((et.f&Hs)!==0)e.rv<gn&&(e.rv=gn,jt===null&&s!==null&&s[Kt]===e?Kt++:jt===null?jt=[e]:jt.push(e));else{(et.deps??=[]).push(e);var o=e.reactions;o===null?e.reactions=[et]:Rn.call(o,et)||o.push(et)}}}if(Ge&&qe.has(e))return qe.get(e);if(n){var r=e;if(Ge){var a=r.v;return((r.f&Tt)===0&&r.reactions!==null||kl(r))&&(a=mo(r)),qe.set(r,a),a}var l=(r.f&oe)===0&&!ue&&et!==null&&($i||(et.f&oe)!==0),c=(r.f&wi)===0;Yn(r)&&(l&&(r.f|=oe),il(r)),l&&!c&&(sl(r),wl(r))}if(ce?.has(e))return ce.get(e);if((e.f&Ue)!==0)throw e.v;return e.v}function wl(e){if(e.f|=oe,e.deps!==null)for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&Lt)!==0&&(t.f&oe)===0&&(sl(t),wl(t))}function kl(e){if(e.v===Et)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(qe.has(t)||(t.f&Lt)!==0&&kl(t))return!0;return!1}function P(e){var t=ue;try{return ue=!0,e()}finally{ue=t}}function D(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(Re in e)Xs(e);else if(!Array.isArray(e))for(let t in e){const n=e[t];typeof n=="object"&&n&&Re in n&&Xs(n)}}}function Xs(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let i in e)try{Xs(e[i],t)}catch{}const n=ho(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const i=Va(n);for(let s in i){const o=i[s].get;if(o)try{o.call(e)}catch{}}}}}const Kh=["touchstart","touchmove"];function Gh(e){return Kh.includes(e)}const Jh=Symbol("events"),Zh=new Set,tr=new Set;function Qh(e,t,n,i={}){function s(o){if(i.capture||qs.call(t,o),!o.cancelBubble)return vo(()=>n?.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Ie(()=>{t.addEventListener(e,s,i)}):t.addEventListener(e,s,i),s}function Dt(e,t,n,i,s){var o={capture:i,passive:s},r=Qh(e,t,n,o);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&cs(()=>{t.removeEventListener(e,r,o)})}let er=null;function qs(e){var t=this,n=t.ownerDocument,i=e.type,s=e.composedPath?.()||[],o=s[0]||e.target;er=e;var r=0,a=er===e&&e.__root;if(a){var l=s.indexOf(a);if(l!==-1&&(t===document||t===window)){e.__root=t;return}var c=s.indexOf(t);if(c===-1)return;l<=c&&(r=l)}if(o=s[r]||e.target,o!==t){Ba(e,"currentTarget",{configurable:!0,get(){return o||n}});var h=et,u=st;le(null),be(null);try{for(var d,f=[];o!==null;){var p=o.assignedSlot||o.parentNode||o.host||null;try{var m=o[Jh]?.[i];m!=null&&(!o.disabled||e.target===o)&&m.call(o,e)}catch(v){d?f.push(v):d=v}if(e.cancelBubble||p===t||p===null)break;o=p}if(d){for(let v of f)queueMicrotask(()=>{throw v});throw d}}finally{e.__root=t,delete e.currentTarget,le(h),be(u)}}}const tu=globalThis?.window?.trustedTypes?.createPolicy("svelte-trusted-html",{createHTML:e=>e});function eu(e){return tu?.createHTML(e)??e}function nu(e,t=!1){var n=Nh("template");return e=e.replaceAll("<!>","<!---->"),n.innerHTML=t?eu(e):e,n.content}function Gi(e,t){var n=st;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function W(e,t){var n=(t&gh)!==0,i=(t&ph)!==0,s,o=!e.startsWith("<!>");return()=>{s===void 0&&(s=nu(o?e:"<!>"+e,!0),n||(s=Ki(s)));var r=i||al?document.importNode(s,!0):s.cloneNode(!0);if(n){var a=Ki(r),l=r.lastChild;Gi(a,l)}else Gi(r,r);return r}}function ai(e=""){{var t=Fe(e+"");return Gi(t,t),t}}function ti(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Fe();return e.append(t,n),Gi(t,n),e}function N(e,t){e!==null&&e.before(t)}function L(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=n+"")}function iu(e,t){return su(e,t)}const Ai=new Map;function su(e,{target:t,anchor:n,props:i={},events:s,context:o,intro:r=!0}){Fh();var a=new Set,l=u=>{for(var d=0;d<u.length;d++){var f=u[d];if(!a.has(f)){a.add(f);var p=Gh(f);for(const _ of[t,document]){var m=Ai.get(_);m===void 0&&(m=new Map,Ai.set(_,m));var v=m.get(f);v===void 0?(_.addEventListener(f,qs,{passive:p}),m.set(f,1)):m.set(f,v+1)}}}};l(as(Zh)),tr.add(l);var c=void 0,h=Wh(()=>{var u=n??t.appendChild(Fe());return Ch(u,{pending:()=>{}},d=>{Ut({});var f=gt;o&&(f.c=o),s&&(i.$$events=s),c=e(d,i)||{},Xt()}),()=>{for(var d of a)for(const m of[t,document]){var f=Ai.get(m),p=f.get(d);--p==0?(m.removeEventListener(d,qs),f.delete(d),f.size===0&&Ai.delete(m)):f.set(d,p)}tr.delete(l),u!==n&&u.parentNode?.removeChild(u)}});return ou.set(c,h),c}let ou=new WeakMap;class ru{anchor;#e=new Map;#a=new Map;#t=new Map;#o=new Set;#r=!0;constructor(t,n=!0){this.anchor=t,this.#r=n}#i=()=>{var t=bt;if(this.#e.has(t)){var n=this.#e.get(t),i=this.#a.get(n);if(i)yo(i),this.#o.delete(n);else{var s=this.#t.get(n);s&&(this.#a.set(n,s.effect),this.#t.delete(n),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),i=s.effect)}for(const[o,r]of this.#e){if(this.#e.delete(o),o===t)break;const a=this.#t.get(r);a&&(Yt(a.effect),this.#t.delete(r))}for(const[o,r]of this.#a){if(o===n||this.#o.has(o))continue;const a=()=>{if(Array.from(this.#e.values()).includes(o)){var c=document.createDocumentFragment();vl(r,c),c.append(Fe()),this.#t.set(o,{effect:r,fragment:c})}else Yt(r);this.#o.delete(o),this.#a.delete(o)};this.#r||!i?(this.#o.add(o),pn(r,a,!1)):a()}}};#n=t=>{this.#e.delete(t);const n=Array.from(this.#e.values());for(const[i,s]of this.#t)n.includes(i)||(Yt(s.effect),this.#t.delete(i))};ensure(t,n){var i=bt,s=hl();if(n&&!this.#a.has(t)&&!this.#t.has(t))if(s){var o=document.createDocumentFragment(),r=Fe();o.append(r),this.#t.set(t,{effect:se(()=>n(r)),fragment:o})}else this.#a.set(t,se(()=>n(this.anchor)));if(this.#e.set(i,t),s){for(const[a,l]of this.#a)a===t?i.unskip_effect(l):i.skip_effect(l);for(const[a,l]of this.#t)a===t?i.unskip_effect(l.effect):i.skip_effect(l.effect);i.oncommit(this.#i),i.ondiscard(this.#n)}else this.#i()}}function ut(e,t,n=!1){var i=new ru(e),s=n?In:0;function o(r,a){i.ensure(r,a)}bo(()=>{var r=!1;t((a,l=0)=>{r=!0,o(l,a)}),r||o(!1,null)},s)}function wo(e,t){return t}function au(e,t,n){for(var i=[],s=t.length,o,r=t.length,a=0;a<s;a++){let u=t[a];pn(u,()=>{if(o){if(o.pending.delete(u),o.done.add(u),o.pending.size===0){var d=e.outrogroups;Ks(as(o.done)),d.delete(o),d.size===0&&(e.outrogroups=null)}}else r-=1},!1)}if(r===0){var l=i.length===0&&n!==null;if(l){var c=n,h=c.parentNode;zh(h),h.append(c),e.items.clear()}Ks(t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Ks(e,t=!0){for(var n=0;n<e.length;n++)Yt(e[n],t)}var nr;function Bt(e,t,n,i,s,o=null){var r=e,a=new Map,l=(t&Ua)!==0;if(l){var c=e;r=c.appendChild(Fe())}var h=null,u=Pt(()=>{var _=n();return rs(_)?_:_==null?[]:as(_)}),d,f=!0;function p(){v.fallback=h,lu(v,d,r,t,i),h!==null&&(d.length===0?(h.f&Ae)===0?yo(h):(h.f^=Ae,ei(h,null,r)):pn(h,()=>{h=null}))}var m=bo(()=>{d=g(u);for(var _=d.length,b=new Set,x=bt,k=hl(),S=0;S<_;S+=1){var w=d[S],C=i(w,S),y=f?null:a.get(C);y?(y.v&&Nn(y.v,w),y.i&&Nn(y.i,S),k&&x.unskip_effect(y.e)):(y=cu(a,f?r:nr??=Fe(),w,C,S,s,t,n),f||(y.e.f|=Ae),a.set(C,y)),b.add(C)}if(_===0&&o&&!h&&(f?h=se(()=>o(r)):(h=se(()=>o(nr??=Fe())),h.f|=Ae)),_>b.size&&Kc(),!f)if(k){for(const[T,E]of a)b.has(T)||x.skip_effect(E.e);x.oncommit(p),x.ondiscard(()=>{})}else p();g(u)}),v={effect:m,items:a,outrogroups:null,fallback:h};f=!1}function qn(e){for(;e!==null&&(e.f&fe)===0;)e=e.next;return e}function lu(e,t,n,i,s){var o=(i&ah)!==0,r=t.length,a=e.items,l=qn(e.effect.first),c,h=null,u,d=[],f=[],p,m,v,_;if(o)for(_=0;_<r;_+=1)p=t[_],m=s(p,_),v=a.get(m).e,(v.f&Ae)===0&&(v.nodes?.a?.measure(),(u??=new Set).add(v));for(_=0;_<r;_+=1){if(p=t[_],m=s(p,_),v=a.get(m).e,e.outrogroups!==null)for(const E of e.outrogroups)E.pending.delete(v),E.done.delete(v);if((v.f&Ae)!==0)if(v.f^=Ae,v===l)ei(v,null,n);else{var b=h?h.next:l;v===e.effect.last&&(e.effect.last=v.prev),v.prev&&(v.prev.next=v.next),v.next&&(v.next.prev=v.prev),Ve(e,h,v),Ve(e,v,b),ei(v,b,n),h=v,d=[],f=[],l=qn(h.next);continue}if((v.f&Jt)!==0&&(yo(v),o&&(v.nodes?.a?.unfix(),(u??=new Set).delete(v))),v!==l){if(c!==void 0&&c.has(v)){if(d.length<f.length){var x=f[0],k;h=x.prev;var S=d[0],w=d[d.length-1];for(k=0;k<d.length;k+=1)ei(d[k],x,n);for(k=0;k<f.length;k+=1)c.delete(f[k]);Ve(e,S.prev,w.next),Ve(e,h,S),Ve(e,w,x),l=x,h=w,_-=1,d=[],f=[]}else c.delete(v),ei(v,l,n),Ve(e,v.prev,v.next),Ve(e,v,h===null?e.effect.first:h.next),Ve(e,h,v),h=v;continue}for(d=[],f=[];l!==null&&l!==v;)(c??=new Set).add(l),f.push(l),l=qn(l.next);if(l===null)continue}(v.f&Ae)===0&&d.push(v),h=v,l=qn(v.next)}if(e.outrogroups!==null){for(const E of e.outrogroups)E.pending.size===0&&(Ks(as(E.done)),e.outrogroups?.delete(E));e.outrogroups.size===0&&(e.outrogroups=null)}if(l!==null||c!==void 0){var C=[];if(c!==void 0)for(v of c)(v.f&Jt)===0&&C.push(v);for(;l!==null;)(l.f&Jt)===0&&l!==e.fallback&&C.push(l),l=qn(l.next);var y=C.length;if(y>0){var T=(i&Ua)!==0&&r===0?n:null;if(o){for(_=0;_<y;_+=1)C[_].nodes?.a?.measure();for(_=0;_<y;_+=1)C[_].nodes?.a?.fix()}au(e,C,T)}}o&&Ie(()=>{if(u!==void 0)for(v of u)v.nodes?.a?.apply()})}function cu(e,t,n,i,s,o,r,a){var l=(r&oh)!==0?(r&lh)===0?tt(n,!1,!1):xn(n):null,c=(r&rh)!==0?xn(s):null;return{v:l,i:c,e:se(()=>(o(t,l??n,c??s,a),()=>{e.delete(i)}))}}function ei(e,t,n){if(e.nodes)for(var i=e.nodes.start,s=e.nodes.end,o=t&&(t.f&Ae)===0?t.nodes.start:n;i!==null;){var r=Si(i);if(o.before(i),i===s)return;i=r}}function Ve(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function hu(e,t,n,i,s){var o=t.$$slots?.[n],r=!1;o===!0&&(o=t.children,r=!0),o===void 0||o(e,r?()=>i:i)}const ir=[...`
|
|
2
|
+
\r\f \v\uFEFF`];function uu(e,t,n){var i=e==null?"":""+e;if(t&&(i=i?i+" "+t:t),n){for(var s in n)if(n[s])i=i?i+" "+s:s;else if(i.length)for(var o=s.length,r=0;(r=i.indexOf(s,r))>=0;){var a=r+o;(r===0||ir.includes(i[r-1]))&&(a===i.length||ir.includes(i[a]))?i=(r===0?"":i.substring(0,r))+i.substring(a+1):r=a}}return i===""?null:i}function du(e,t){return e==null?null:String(e)}function Nt(e,t,n,i,s,o){var r=e.__className;if(r!==n||r===void 0){var a=uu(n,i,o);a==null?e.removeAttribute("class"):e.className=a,e.__className=n}else if(o&&s!==o)for(var l in o){var c=!!o[l];(s==null||c!==!!s[l])&&e.classList.toggle(l,c)}return o}function Ji(e,t,n,i){var s=e.__style;if(s!==t){var o=du(t);o==null?e.removeAttribute("style"):e.style.cssText=o,e.__style=t}return i}function Yi(e,t,n=!1){if(e.multiple){if(t==null)return;if(!rs(t))return mh();for(var i of e.options)i.selected=t.includes(sr(i));return}for(i of e.options){var s=sr(i);if(Ih(s,t)){i.selected=!0;return}}(!n||t!==void 0)&&(e.selectedIndex=-1)}function bs(e){var t=new MutationObserver(()=>{Yi(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),cs(()=>{t.disconnect()})}function sr(e){return"__value"in e?e.__value:e.value}const fu=Symbol("is custom element"),gu=Symbol("is html"),pu=Xc?"progress":"PROGRESS";function mu(e,t){var n=Sl(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==pu)||(e.value=t??"")}function ve(e,t,n,i){var s=Sl(e);s[t]!==(s[t]=n)&&(t==="loading"&&(e[Uc]=n),n==null?e.removeAttribute(t):typeof n!="string"&&vu(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Sl(e){return e.__attributes??={[fu]:e.nodeName.includes("-"),[gu]:e.namespaceURI===Xa}}var or=new Map;function vu(e){var t=e.getAttribute("is")||e.nodeName,n=or.get(t);if(n)return n;or.set(t,n=[]);for(var i,s=e,o=Element.prototype;o!==s;){i=Va(s);for(var r in i)i[r].set&&n.push(r);s=ho(s)}return n}function rr(e,t){return e===t||e?.[Re]===t}function xs(e={},t,n,i){return Hh(()=>{var s,o;return hs(()=>{s=o,o=[],P(()=>{e!==n(...o)&&(t(e,...o),s&&rr(n(...s),e)&&t(null,...s))})}),()=>{Ie(()=>{o&&rr(n(...o),e)&&t(null,...o)})}}),e}function Zt(e=!1){const t=gt,n=t.l.u;if(!n)return;let i=()=>D(t.s);if(e){let s=0,o={};const r=ls(()=>{let a=!1;const l=t.s;for(const c in l)l[c]!==o[c]&&(o[c]=l[c],a=!0);return a&&s++,s});i=()=>g(r)}n.b.length&&Vh(()=>{ar(t,i),qi(n.b)}),Us(()=>{const s=P(()=>n.m.map($c));return()=>{for(const o of s)typeof o=="function"&&o()}}),n.a.length&&Us(()=>{ar(t,i),qi(n.a)})}function ar(e,t){if(e.l.s)for(const n of e.l.s)g(n);t()}function ko(e,t,n){if(e==null)return t(void 0),n&&n(void 0),Ee;const i=P(()=>e.subscribe(t,n));return i.unsubscribe?()=>i.unsubscribe():i}const Pn=[];function _u(e,t){return{subscribe:Mn(e,t).subscribe}}function Mn(e,t=Ee){let n=null;const i=new Set;function s(a){if(Ka(e,a)&&(e=a,n)){const l=!Pn.length;for(const c of i)c[1](),Pn.push(c,e);if(l){for(let c=0;c<Pn.length;c+=2)Pn[c][0](Pn[c+1]);Pn.length=0}}}function o(a){s(a(e))}function r(a,l=Ee){const c=[a,l];return i.add(c),i.size===1&&(n=t(s,o)||Ee),a(e),()=>{i.delete(c),i.size===0&&n&&(n(),n=null)}}return{set:s,update:o,subscribe:r}}function bu(e,t,n){const i=!Array.isArray(e),s=i?[e]:e;if(!s.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const o=t.length<2;return _u(n,(r,a)=>{let l=!1;const c=[];let h=0,u=Ee;const d=()=>{if(h)return;u();const p=t(i?c[0]:c,r,a);o?r(p):u=typeof p=="function"?p:Ee},f=s.map((p,m)=>ko(p,v=>{c[m]=v,h&=~(1<<m),l&&d()},()=>{h|=1<<m}));return l=!0,d(),function(){qi(f),u(),l=!1}})}function Ml(e){let t;return ko(e,n=>t=n)(),t}let Ti=!1,Gs=Symbol();function on(e,t,n){const i=n[t]??={store:null,source:tt(void 0),unsubscribe:Ee};if(i.store!==e&&!(Gs in n))if(i.unsubscribe(),i.store=e??null,e==null)i.source.v=void 0,i.unsubscribe=Ee;else{var s=!0;i.unsubscribe=ko(e,o=>{s?i.source.v=o:$(i.source,o)}),s=!1}return e&&Gs in n?Ml(e):g(i.source)}function xu(){const e={};function t(){cs(()=>{for(var n in e)e[n].unsubscribe();Ba(e,Gs,{enumerable:!1,value:!0})})}return[e,t]}function yu(e){var t=Ti;try{return Ti=!1,[e(),Ti]}finally{Ti=t}}function K(e,t,n,i){var s=!$n||(n&hh)!==0,o=(n&dh)!==0,r=(n&fh)!==0,a=i,l=!0,c=()=>(l&&(l=!1,a=r?P(i):i),a),h;if(o){var u=Re in e||Yc in e;h=En(e,t)?.set??(u&&t in e?x=>e[t]=x:void 0)}var d,f=!1;o?[d,f]=yu(()=>e[t]):d=e[t],d===void 0&&i!==void 0&&(d=c(),h&&(s&&th(),h(d)));var p;if(s?p=()=>{var x=e[t];return x===void 0?c():(l=!0,x)}:p=()=>{var x=e[t];return x!==void 0&&(a=void 0),x===void 0?a:x},s&&(n&uh)===0)return p;if(h){var m=e.$$legacy;return(function(x,k){return arguments.length>0?((!s||!k||m||f)&&h(k?p():x),x):p()})}var v=!1,_=((n&ch)!==0?ls:Pt)(()=>(v=!1,p()));o&&g(_);var b=st;return(function(x,k){if(arguments.length>0){const S=k?g(_):s&&o?On(x):x;return $(_,S),v=!0,a!==void 0&&(a=S),x}return Ge&&v||(b.f&Le)!==0?_.v:g(_)})}function Cl(e){gt===null&&fo(),$n&>.l!==null?ku(gt).m.push(e):Us(()=>{const t=P(e);if(typeof t=="function")return t})}function Pl(e){gt===null&&fo(),Cl(()=>()=>P(e))}function wu(e,t,{bubbles:n=!1,cancelable:i=!1}={}){return new CustomEvent(e,{detail:t,bubbles:n,cancelable:i})}function Qe(){const e=gt;return e===null&&fo(),(t,n,i)=>{const s=e.s.$$events?.[t];if(s){const o=rs(s)?s.slice():[s],r=wu(t,n,i);for(const a of o)a.call(e.x,r);return!r.defaultPrevented}return!0}}function ku(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}const Su="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(Su);bh();const Mu=["15m","1h","6h","24h","7d","30d"],Di=["#155e75","#3b82f6","#0f766e","#b45309","#7c3aed","#e11d48","#2563eb","#059669","#4f46e5","#0891b2"],Al="moraine-monitor-theme",Cu=1e4,Pu=6e4,ys="Loading model analytics…";function Au(e,t){const n=new Date(e*1e3);return t==="30d"?n.toLocaleString([],{month:"short",day:"numeric"}):t==="7d"||t==="24h"?n.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit"}):n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function Tu(e){return e<60?`${e}s`:e<3600?`${Math.round(e/60)}m`:e<86400?`${Math.round(e/3600)}h`:`${Math.round(e/86400)}d`}function Du(e){const t=Math.abs(e);if(t>=1e9){const n=t>=1e10?0:1;return`${(e/1e9).toFixed(n).replace(/\.0$/,"")}B`}if(t>=1e6){const n=t>=1e7?0:1;return`${(e/1e6).toFixed(n).replace(/\.0$/,"")}M`}if(t>=1e3){const n=t>=1e4?0:1;return`${(e/1e3).toFixed(n).replace(/\.0$/,"")}K`}return`${e}`}function Ou(e){const t=e.bucket_seconds==null?3600:Number(e.bucket_seconds),n=e.from_unix==null?Number.NaN:Number(e.from_unix),i=e.to_unix==null?Number.NaN:Number(e.to_unix);if(!Number.isFinite(n)||!Number.isFinite(i)||!Number.isFinite(t)||t<=0)return[];const s=Math.floor(n/t)*t,o=Math.floor(i/t)*t,r=[];for(let a=s;a<=o;a+=t)r.push(a);return r}function lr(e,t){const n=new Map;for(const i of e){const s=i.model||"unknown",o=Number(i.bucket_unix),r=Number(t==="tokens"?i.tokens||0:i.turns||0);n.has(s)||n.set(s,new Map),n.get(s).set(o,r)}return n}function Eu(e,t){const n=new Map;for(const i of e){const s=i.model||"unknown";n.set(s,(n.get(s)||0)+Number(i.tokens||0))}for(const i of t){const s=i.model||"unknown";n.has(s)||n.set(s,0)}return[...n.entries()].sort((i,s)=>s[1]-i[1]).map(([i])=>i).slice(0,8)}function Lu(e){const t=new Map;for(const n of e)t.set(Number(n.bucket_unix),Number(n.concurrent_sessions||0));return t}function Ru(e){return e.key==="7d"||e.key==="30d"?12:10}function cr(e){const t=e.range,n=Ou(t),i=e.series?.tokens||[],s=e.series?.turns||[],o=e.series?.concurrent_sessions||[],r=lr(i,"tokens"),a=lr(s,"turns"),l=Lu(o),c=Eu(i,s),h=n.map(v=>Au(v,t.key)),u=c.map((v,_)=>{const b=Di[_%Di.length];return{label:v,data:n.map(x=>r.get(v)?.get(x)??0),borderColor:b,backgroundColor:`${b}26`,borderWidth:1,borderRadius:3}}),d=c.map((v,_)=>{const b=Di[_%Di.length];return{label:v,data:n.map(x=>a.get(v)?.get(x)??0),borderColor:b,backgroundColor:`${b}B0`,borderWidth:1,borderRadius:4}}),f=[{label:"Concurrent sessions",data:n.map(v=>l.get(v)??0),borderColor:"#f59e0b",backgroundColor:"#f59e0b33",borderWidth:2,tension:.2,pointRadius:2,fill:!0}],p=c.length,m=`${t.label} • ${Tu(t.bucket_seconds)} buckets • ${p} model${p===1?"":"s"} • updated ${new Date().toLocaleTimeString()}`;return{labels:h,tokenDatasets:u,turnDatasets:d,concurrentDatasets:f,metaText:m,maxTicks:Ru(t)}}function Mi(e){return e+.5|0}const He=(e,t,n)=>Math.max(Math.min(e,n),t);function ni(e){return He(Mi(e*2.55),0,255)}function Ke(e){return He(Mi(e*255),0,255)}function Pe(e){return He(Mi(e/2.55)/100,0,1)}function hr(e){return He(Mi(e*100),0,100)}const te={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Js=[..."0123456789ABCDEF"],Iu=e=>Js[e&15],Fu=e=>Js[(e&240)>>4]+Js[e&15],Oi=e=>(e&240)>>4===(e&15),zu=e=>Oi(e.r)&&Oi(e.g)&&Oi(e.b)&&Oi(e.a);function Nu(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&te[e[1]]*17,g:255&te[e[2]]*17,b:255&te[e[3]]*17,a:t===5?te[e[4]]*17:255}:(t===7||t===9)&&(n={r:te[e[1]]<<4|te[e[2]],g:te[e[3]]<<4|te[e[4]],b:te[e[5]]<<4|te[e[6]],a:t===9?te[e[7]]<<4|te[e[8]]:255})),n}const Bu=(e,t)=>e<255?t(e):"";function Vu(e){var t=zu(e)?Iu:Fu;return e?"#"+t(e.r)+t(e.g)+t(e.b)+Bu(e.a,t):void 0}const Wu=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Tl(e,t,n){const i=t*Math.min(n,1-n),s=(o,r=(o+e/30)%12)=>n-i*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function Hu(e,t,n){const i=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function ju(e,t,n){const i=Tl(e,1,.5);let s;for(t+n>1&&(s=1/(t+n),t*=s,n*=s),s=0;s<3;s++)i[s]*=1-t-n,i[s]+=t;return i}function $u(e,t,n,i,s){return e===s?(t-n)/i+(t<n?6:0):t===s?(n-e)/i+2:(e-t)/i+4}function So(e){const n=e.r/255,i=e.g/255,s=e.b/255,o=Math.max(n,i,s),r=Math.min(n,i,s),a=(o+r)/2;let l,c,h;return o!==r&&(h=o-r,c=a>.5?h/(2-o-r):h/(o+r),l=$u(n,i,s,h,o),l=l*60+.5),[l|0,c||0,a]}function Mo(e,t,n,i){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,i)).map(Ke)}function Co(e,t,n){return Mo(Tl,e,t,n)}function Yu(e,t,n){return Mo(ju,e,t,n)}function Uu(e,t,n){return Mo(Hu,e,t,n)}function Dl(e){return(e%360+360)%360}function Xu(e){const t=Wu.exec(e);let n=255,i;if(!t)return;t[5]!==i&&(n=t[6]?ni(+t[5]):Ke(+t[5]));const s=Dl(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=Yu(s,o,r):t[1]==="hsv"?i=Uu(s,o,r):i=Co(s,o,r),{r:i[0],g:i[1],b:i[2],a:n}}function qu(e,t){var n=So(e);n[0]=Dl(n[0]+t),n=Co(n),e.r=n[0],e.g=n[1],e.b=n[2]}function Ku(e){if(!e)return;const t=So(e),n=t[0],i=hr(t[1]),s=hr(t[2]);return e.a<255?`hsla(${n}, ${i}%, ${s}%, ${Pe(e.a)})`:`hsl(${n}, ${i}%, ${s}%)`}const ur={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},dr={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function Gu(){const e={},t=Object.keys(dr),n=Object.keys(ur);let i,s,o,r,a;for(i=0;i<t.length;i++){for(r=a=t[i],s=0;s<n.length;s++)o=n[s],a=a.replace(o,ur[o]);o=parseInt(dr[r],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}let Ei;function Ju(e){Ei||(Ei=Gu(),Ei.transparent=[0,0,0,0]);const t=Ei[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Zu=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Qu(e){const t=Zu.exec(e);let n=255,i,s,o;if(t){if(t[7]!==i){const r=+t[7];n=t[8]?ni(r):He(r*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?ni(i):He(i,0,255)),s=255&(t[4]?ni(s):He(s,0,255)),o=255&(t[6]?ni(o):He(o,0,255)),{r:i,g:s,b:o,a:n}}}function td(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Pe(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const ws=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,An=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function ed(e,t,n){const i=An(Pe(e.r)),s=An(Pe(e.g)),o=An(Pe(e.b));return{r:Ke(ws(i+n*(An(Pe(t.r))-i))),g:Ke(ws(s+n*(An(Pe(t.g))-s))),b:Ke(ws(o+n*(An(Pe(t.b))-o))),a:e.a+n*(t.a-e.a)}}function Li(e,t,n){if(e){let i=So(e);i[t]=Math.max(0,Math.min(i[t]+i[t]*n,t===0?360:1)),i=Co(i),e.r=i[0],e.g=i[1],e.b=i[2]}}function Ol(e,t){return e&&Object.assign(t||{},e)}function fr(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=Ke(e[3]))):(t=Ol(e,{r:0,g:0,b:0,a:1}),t.a=Ke(t.a)),t}function nd(e){return e.charAt(0)==="r"?Qu(e):Xu(e)}class gi{constructor(t){if(t instanceof gi)return t;const n=typeof t;let i;n==="object"?i=fr(t):n==="string"&&(i=Nu(t)||Ju(t)||nd(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Ol(this._rgb);return t&&(t.a=Pe(t.a)),t}set rgb(t){this._rgb=fr(t)}rgbString(){return this._valid?td(this._rgb):void 0}hexString(){return this._valid?Vu(this._rgb):void 0}hslString(){return this._valid?Ku(this._rgb):void 0}mix(t,n){if(t){const i=this.rgb,s=t.rgb;let o;const r=n===o?.5:n,a=2*r-1,l=i.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,i.r=255&c*i.r+o*s.r+.5,i.g=255&c*i.g+o*s.g+.5,i.b=255&c*i.b+o*s.b+.5,i.a=r*i.a+(1-r)*s.a,this.rgb=i}return this}interpolate(t,n){return t&&(this._rgb=ed(this._rgb,t._rgb,n)),this}clone(){return new gi(this.rgb)}alpha(t){return this._rgb.a=Ke(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=Mi(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Li(this._rgb,2,t),this}darken(t){return Li(this._rgb,2,-t),this}saturate(t){return Li(this._rgb,1,t),this}desaturate(t){return Li(this._rgb,1,-t),this}rotate(t){return qu(this._rgb,t),this}}function ke(){}const id=(()=>{let e=0;return()=>e++})();function J(e){return e==null}function mt(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function Q(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function kt(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Gt(e,t){return kt(e)?e:t}function U(e,t){return typeof e>"u"?t:e}const sd=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,El=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function ht(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function at(e,t,n,i){let s,o,r;if(mt(e))for(o=e.length,s=0;s<o;s++)t.call(n,e[s],s);else if(Q(e))for(r=Object.keys(e),o=r.length,s=0;s<o;s++)t.call(n,e[r[s]],r[s])}function Zi(e,t){let n,i,s,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;++n)if(s=e[n],o=t[n],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function Qi(e){if(mt(e))return e.map(Qi);if(Q(e)){const t=Object.create(null),n=Object.keys(e),i=n.length;let s=0;for(;s<i;++s)t[n[s]]=Qi(e[n[s]]);return t}return e}function Ll(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function od(e,t,n,i){if(!Ll(e))return;const s=t[e],o=n[e];Q(s)&&Q(o)?pi(s,o,i):t[e]=Qi(o)}function pi(e,t,n){const i=mt(t)?t:[t],s=i.length;if(!Q(e))return e;n=n||{};const o=n.merger||od;let r;for(let a=0;a<s;++a){if(r=i[a],!Q(r))continue;const l=Object.keys(r);for(let c=0,h=l.length;c<h;++c)o(l[c],e,r,n)}return e}function li(e,t){return pi(e,t,{merger:rd})}function rd(e,t,n){if(!Ll(e))return;const i=t[e],s=n[e];Q(i)&&Q(s)?li(i,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=Qi(s))}const gr={"":e=>e,x:e=>e.x,y:e=>e.y};function ad(e){const t=e.split("."),n=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(n.push(i),i="");return n}function ld(e){const t=ad(e);return n=>{for(const i of t){if(i==="")break;n=n&&n[i]}return n}}function Je(e,t){return(gr[t]||(gr[t]=ld(t)))(e)}function Po(e){return e.charAt(0).toUpperCase()+e.slice(1)}const mi=e=>typeof e<"u",Ze=e=>typeof e=="function",pr=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function cd(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const nt=Math.PI,ft=2*nt,hd=ft+nt,ts=Number.POSITIVE_INFINITY,ud=nt/180,Ct=nt/2,rn=nt/4,mr=nt*2/3,je=Math.log10,_e=Math.sign;function ci(e,t,n){return Math.abs(e-t)<n}function vr(e){const t=Math.round(e);e=ci(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(je(e))),i=e/n;return(i<=1?1:i<=2?2:i<=5?5:10)*n}function dd(e){const t=[],n=Math.sqrt(e);let i;for(i=1;i<n;i++)e%i===0&&(t.push(i),t.push(e/i));return n===(n|0)&&t.push(n),t.sort((s,o)=>s-o).pop(),t}function fd(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function Bn(e){return!fd(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function gd(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function Rl(e,t,n){let i,s,o;for(i=0,s=e.length;i<s;i++)o=e[i][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function de(e){return e*(nt/180)}function Ao(e){return e*(180/nt)}function _r(e){if(!kt(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function Il(e,t){const n=t.x-e.x,i=t.y-e.y,s=Math.sqrt(n*n+i*i);let o=Math.atan2(i,n);return o<-.5*nt&&(o+=ft),{angle:o,distance:s}}function Zs(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function pd(e,t){return(e-t+hd)%ft-nt}function zt(e){return(e%ft+ft)%ft}function vi(e,t,n,i){const s=zt(e),o=zt(t),r=zt(n),a=zt(o-s),l=zt(r-s),c=zt(s-o),h=zt(s-r);return s===o||s===r||i&&o===r||a>l&&c<h}function Ot(e,t,n){return Math.max(t,Math.min(n,e))}function md(e){return Ot(e,-32768,32767)}function Te(e,t,n,i=1e-6){return e>=Math.min(t,n)-i&&e<=Math.max(t,n)+i}function To(e,t,n){n=n||(r=>e[r]<t);let i=e.length-1,s=0,o;for(;i-s>1;)o=s+i>>1,n(o)?s=o:i=o;return{lo:s,hi:i}}const De=(e,t,n,i)=>To(e,n,i?s=>{const o=e[s][t];return o<n||o===n&&e[s+1][t]===n}:s=>e[s][t]<n),vd=(e,t,n)=>To(e,n,i=>e[i][t]>=n);function _d(e,t,n){let i=0,s=e.length;for(;i<s&&e[i]<t;)i++;for(;s>i&&e[s-1]>n;)s--;return i>0||s<e.length?e.slice(i,s):e}const Fl=["push","pop","shift","splice","unshift"];function bd(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Fl.forEach(n=>{const i="_onData"+Po(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...o)}),r}})})}function br(e,t){const n=e._chartjs;if(!n)return;const i=n.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(Fl.forEach(o=>{delete e[o]}),delete e._chartjs)}function zl(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const Nl=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function Bl(e,t){let n=[],i=!1;return function(...s){n=s,i||(i=!0,Nl.call(window,()=>{i=!1,e.apply(t,n)}))}}function xd(e,t){let n;return function(...i){return t?(clearTimeout(n),n=setTimeout(e,t,i)):e.apply(this,i),t}}const Do=e=>e==="start"?"left":e==="end"?"right":"center",Ft=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,yd=(e,t,n,i)=>e===(i?"left":"right")?n:e==="center"?(t+n)/2:t;function Vl(e,t,n){const i=t.length;let s=0,o=i;if(e._sorted){const{iScale:r,vScale:a,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,h=r.axis,{min:u,max:d,minDefined:f,maxDefined:p}=r.getUserBounds();if(f){if(s=Math.min(De(l,h,u).lo,n?i:De(t,h,r.getPixelForValue(u)).lo),c){const m=l.slice(0,s+1).reverse().findIndex(v=>!J(v[a.axis]));s-=Math.max(0,m)}s=Ot(s,0,i-1)}if(p){let m=Math.max(De(l,r.axis,d,!0).hi+1,n?0:De(t,h,r.getPixelForValue(d),!0).hi+1);if(c){const v=l.slice(m-1).findIndex(_=>!J(_[a.axis]));m+=Math.max(0,v)}o=Ot(m,s,i)-s}else o=i-s}return{start:s,count:o}}function Wl(e){const{xScale:t,yScale:n,_scaleRanges:i}=e,s={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!i)return e._scaleRanges=s,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==n.min||i.ymax!==n.max;return Object.assign(i,s),o}const Ri=e=>e===0||e===1,xr=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*ft/n)),yr=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*ft/n)+1,hi={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*Ct)+1,easeOutSine:e=>Math.sin(e*Ct),easeInOutSine:e=>-.5*(Math.cos(nt*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>Ri(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Ri(e)?e:xr(e,.075,.3),easeOutElastic:e=>Ri(e)?e:yr(e,.075,.3),easeInOutElastic(e){return Ri(e)?e:e<.5?.5*xr(e*2,.1125,.45):.5+.5*yr(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-hi.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?hi.easeInBounce(e*2)*.5:hi.easeOutBounce(e*2-1)*.5+.5};function Oo(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function wr(e){return Oo(e)?e:new gi(e)}function ks(e){return Oo(e)?e:new gi(e).saturate(.5).darken(.1).hexString()}const wd=["x","y","borderWidth","radius","tension"],kd=["color","borderColor","backgroundColor"];function Sd(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:kd},numbers:{type:"number",properties:wd}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Md(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const kr=new Map;function Cd(e,t){t=t||{};const n=e+JSON.stringify(t);let i=kr.get(n);return i||(i=new Intl.NumberFormat(e,t),kr.set(n,i)),i}function Ci(e,t,n){return Cd(t,n).format(e)}const Hl={values(e){return mt(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const i=this.chart.options.locale;let s,o=e;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=Pd(e,n)}const r=je(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Ci(e,i,l)},logarithmic(e,t,n){if(e===0)return"0";const i=n[t].significand||e/Math.pow(10,Math.floor(je(e)));return[1,2,3,5,10,15].includes(i)||t>.8*n.length?Hl.numeric.call(this,e,t,n):""}};function Pd(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var us={formatters:Hl};function Ad(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:us.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const wn=Object.create(null),Qs=Object.create(null);function ui(e,t){if(!t)return e;const n=t.split(".");for(let i=0,s=n.length;i<s;++i){const o=n[i];e=e[o]||(e[o]=Object.create(null))}return e}function Ss(e,t,n){return typeof t=="string"?pi(ui(e,t),n):pi(ui(e,""),t)}class Td{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>ks(s.backgroundColor),this.hoverBorderColor=(i,s)=>ks(s.borderColor),this.hoverColor=(i,s)=>ks(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return Ss(this,t,n)}get(t){return ui(this,t)}describe(t,n){return Ss(Qs,t,n)}override(t,n){return Ss(wn,t,n)}route(t,n,i,s){const o=ui(this,t),r=ui(this,i),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=r[s];return Q(l)?Object.assign({},c,l):U(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(n=>n(this))}}var vt=new Td({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Sd,Md,Ad]);function Dd(e){return!e||J(e.size)||J(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function es(e,t,n,i,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>i&&(i=o),i}function Od(e,t,n,i){i=i||{};let s=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},o=i.garbageCollect=[],i.font=t),e.save(),e.font=t;let r=0;const a=n.length;let l,c,h,u,d;for(l=0;l<a;l++)if(u=n[l],u!=null&&!mt(u))r=es(e,s,o,r,u);else if(mt(u))for(c=0,h=u.length;c<h;c++)d=u[c],d!=null&&!mt(d)&&(r=es(e,s,o,r,d));e.restore();const f=o.length/2;if(f>n.length){for(l=0;l<f;l++)delete s[o[l]];o.splice(0,f)}return r}function an(e,t,n){const i=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*i)/i+s}function Sr(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function to(e,t,n,i){jl(e,t,n,i,null)}function jl(e,t,n,i,s){let o,r,a,l,c,h,u,d;const f=t.pointStyle,p=t.rotation,m=t.radius;let v=(p||0)*ud;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,i),e.rotate(v),e.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),e.restore();return}if(!(isNaN(m)||m<=0)){switch(e.beginPath(),f){default:s?e.ellipse(n,i,s/2,m,0,0,ft):e.arc(n,i,m,0,ft),e.closePath();break;case"triangle":h=s?s/2:m,e.moveTo(n+Math.sin(v)*h,i-Math.cos(v)*m),v+=mr,e.lineTo(n+Math.sin(v)*h,i-Math.cos(v)*m),v+=mr,e.lineTo(n+Math.sin(v)*h,i-Math.cos(v)*m),e.closePath();break;case"rectRounded":c=m*.516,l=m-c,r=Math.cos(v+rn)*l,u=Math.cos(v+rn)*(s?s/2-c:l),a=Math.sin(v+rn)*l,d=Math.sin(v+rn)*(s?s/2-c:l),e.arc(n-u,i-a,c,v-nt,v-Ct),e.arc(n+d,i-r,c,v-Ct,v),e.arc(n+u,i+a,c,v,v+Ct),e.arc(n-d,i+r,c,v+Ct,v+nt),e.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*m,h=s?s/2:l,e.rect(n-h,i-l,2*h,2*l);break}v+=rn;case"rectRot":u=Math.cos(v)*(s?s/2:m),r=Math.cos(v)*m,a=Math.sin(v)*m,d=Math.sin(v)*(s?s/2:m),e.moveTo(n-u,i-a),e.lineTo(n+d,i-r),e.lineTo(n+u,i+a),e.lineTo(n-d,i+r),e.closePath();break;case"crossRot":v+=rn;case"cross":u=Math.cos(v)*(s?s/2:m),r=Math.cos(v)*m,a=Math.sin(v)*m,d=Math.sin(v)*(s?s/2:m),e.moveTo(n-u,i-a),e.lineTo(n+u,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r);break;case"star":u=Math.cos(v)*(s?s/2:m),r=Math.cos(v)*m,a=Math.sin(v)*m,d=Math.sin(v)*(s?s/2:m),e.moveTo(n-u,i-a),e.lineTo(n+u,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r),v+=rn,u=Math.cos(v)*(s?s/2:m),r=Math.cos(v)*m,a=Math.sin(v)*m,d=Math.sin(v)*(s?s/2:m),e.moveTo(n-u,i-a),e.lineTo(n+u,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r);break;case"line":r=s?s/2:Math.cos(v)*m,a=Math.sin(v)*m,e.moveTo(n-r,i-a),e.lineTo(n+r,i+a);break;case"dash":e.moveTo(n,i),e.lineTo(n+Math.cos(v)*(s?s/2:m),i+Math.sin(v)*m);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function Oe(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function ds(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function fs(e){e.restore()}function Ed(e,t,n,i,s){if(!t)return e.lineTo(n.x,n.y);if(s==="middle"){const o=(t.x+n.x)/2;e.lineTo(o,t.y),e.lineTo(o,n.y)}else s==="after"!=!!i?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function Ld(e,t,n,i){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?n.cp2x:n.cp1x,i?n.cp2y:n.cp1y,n.x,n.y)}function Rd(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),J(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function Id(e,t,n,i,s){if(s.strikethrough||s.underline){const o=e.measureText(i),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,l=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,h=s.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(r,h),e.lineTo(a,h),e.stroke()}}function Fd(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function kn(e,t,n,i,s,o={}){const r=mt(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(e.save(),e.font=s.string,Rd(e,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&Fd(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),J(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,n,i,o.maxWidth)),e.fillText(c,n,i,o.maxWidth),Id(e,n,i,c,o),i+=Number(s.lineHeight);e.restore()}function _i(e,t){const{x:n,y:i,w:s,h:o,radius:r}=t;e.arc(n+r.topLeft,i+r.topLeft,r.topLeft,1.5*nt,nt,!0),e.lineTo(n,i+o-r.bottomLeft),e.arc(n+r.bottomLeft,i+o-r.bottomLeft,r.bottomLeft,nt,Ct,!0),e.lineTo(n+s-r.bottomRight,i+o),e.arc(n+s-r.bottomRight,i+o-r.bottomRight,r.bottomRight,Ct,0,!0),e.lineTo(n+s,i+r.topRight),e.arc(n+s-r.topRight,i+r.topRight,r.topRight,0,-Ct,!0),e.lineTo(n+r.topLeft,i)}const zd=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Nd=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Bd(e,t){const n=(""+e).match(zd);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const Vd=e=>+e||0;function Eo(e,t){const n={},i=Q(t),s=i?Object.keys(t):t,o=Q(e)?i?r=>U(e[r],e[t[r]]):r=>e[r]:()=>e;for(const r of s)n[r]=Vd(o(r));return n}function $l(e){return Eo(e,{top:"y",right:"x",bottom:"y",left:"x"})}function vn(e){return Eo(e,["topLeft","topRight","bottomLeft","bottomRight"])}function Wt(e){const t=$l(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function At(e,t){e=e||{},t=t||vt.font;let n=U(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let i=U(e.style,t.style);i&&!(""+i).match(Nd)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:U(e.family,t.family),lineHeight:Bd(U(e.lineHeight,t.lineHeight),n),size:n,style:i,weight:U(e.weight,t.weight),string:""};return s.string=Dd(s),s}function ii(e,t,n,i){let s,o,r;for(s=0,o=e.length;s<o;++s)if(r=e[s],r!==void 0&&r!==void 0)return r}function Wd(e,t,n){const{min:i,max:s}=e,o=El(t,(s-i)/2),r=(a,l)=>n&&a===0?0:a+l;return{min:r(i,-Math.abs(o)),max:r(s,o)}}function tn(e,t){return Object.assign(Object.create(e),t)}function Lo(e,t=[""],n,i,s=()=>e[0]){const o=n||e;typeof i>"u"&&(i=ql("_fallback",e));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:i,_getTarget:s,override:a=>Lo([a,...e],t,o,i)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return Ul(a,l,()=>Kd(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return Cr(a).includes(l)},ownKeys(a){return Cr(a)},set(a,l,c){const h=a._storage||(a._storage=s());return a[l]=h[l]=c,delete a._keys,!0}})}function Vn(e,t,n,i){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:Yl(e,i),setContext:o=>Vn(e,o,n,i),override:o=>Vn(e.override(o),t,n,i)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete e[r],!0},get(o,r,a){return Ul(o,r,()=>jd(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(e,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,r)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,r){return Reflect.has(e,r)},ownKeys(){return Reflect.ownKeys(e)},set(o,r,a){return e[r]=a,delete o[r],!0}})}function Yl(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:i,isScriptable:Ze(n)?n:()=>n,isIndexable:Ze(i)?i:()=>i}}const Hd=(e,t)=>e?e+Po(t):t,Ro=(e,t)=>Q(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Ul(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const i=n();return e[t]=i,i}function jd(e,t,n){const{_proxy:i,_context:s,_subProxy:o,_descriptors:r}=e;let a=i[t];return Ze(a)&&r.isScriptable(t)&&(a=$d(t,a,e,n)),mt(a)&&a.length&&(a=Yd(t,a,e,r.isIndexable)),Ro(t,a)&&(a=Vn(a,s,o&&o[t],r)),a}function $d(e,t,n,i){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=t(o,r||i);return a.delete(e),Ro(e,l)&&(l=Io(s._scopes,s,e,l)),l}function Yd(e,t,n,i){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=n;if(typeof o.index<"u"&&i(e))return t[o.index%t.length];if(Q(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const u=Io(c,s,e,h);t.push(Vn(u,o,r&&r[e],a))}}return t}function Xl(e,t,n){return Ze(e)?e(t,n):e}const Ud=(e,t)=>e===!0?t:typeof e=="string"?Je(t,e):void 0;function Xd(e,t,n,i,s){for(const o of t){const r=Ud(n,o);if(r){e.add(r);const a=Xl(r._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==i)return a}else if(r===!1&&typeof i<"u"&&n!==i)return null}return!1}function Io(e,t,n,i){const s=t._rootScopes,o=Xl(t._fallback,n,i),r=[...e,...s],a=new Set;a.add(i);let l=Mr(a,r,n,o||n,i);return l===null||typeof o<"u"&&o!==n&&(l=Mr(a,r,o,l,i),l===null)?!1:Lo(Array.from(a),[""],s,o,()=>qd(t,n,i))}function Mr(e,t,n,i,s){for(;n;)n=Xd(e,t,n,i,s);return n}function qd(e,t,n){const i=e._getTarget();t in i||(i[t]={});const s=i[t];return mt(s)&&Q(n)?n:s||{}}function Kd(e,t,n,i){let s;for(const o of t)if(s=ql(Hd(o,e),n),typeof s<"u")return Ro(e,s)?Io(n,i,e,s):s}function ql(e,t){for(const n of t){if(!n)continue;const i=n[e];if(typeof i<"u")return i}}function Cr(e){let t=e._keys;return t||(t=e._keys=Gd(e._scopes)),t}function Gd(e){const t=new Set;for(const n of e)for(const i of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function Kl(e,t,n,i){const{iScale:s}=e,{key:o="r"}=this._parsing,r=new Array(i);let a,l,c,h;for(a=0,l=i;a<l;++a)c=a+n,h=t[c],r[a]={r:s.parse(Je(h,o),c)};return r}const Jd=Number.EPSILON||1e-14,Wn=(e,t)=>t<e.length&&!e[t].skip&&e[t],Gl=e=>e==="x"?"y":"x";function Zd(e,t,n,i){const s=e.skip?t:e,o=t,r=n.skip?t:n,a=Zs(o,s),l=Zs(r,o);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=i*c,d=i*h;return{previous:{x:o.x-u*(r.x-s.x),y:o.y-u*(r.y-s.y)},next:{x:o.x+d*(r.x-s.x),y:o.y+d*(r.y-s.y)}}}function Qd(e,t,n){const i=e.length;let s,o,r,a,l,c=Wn(e,0);for(let h=0;h<i-1;++h)if(l=c,c=Wn(e,h+1),!(!l||!c)){if(ci(t[h],0,Jd)){n[h]=n[h+1]=0;continue}s=n[h]/t[h],o=n[h+1]/t[h],a=Math.pow(s,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),n[h]=s*r*t[h],n[h+1]=o*r*t[h])}}function tf(e,t,n="x"){const i=Gl(n),s=e.length;let o,r,a,l=Wn(e,0);for(let c=0;c<s;++c){if(r=a,a=l,l=Wn(e,c+1),!a)continue;const h=a[n],u=a[i];r&&(o=(h-r[n])/3,a[`cp1${n}`]=h-o,a[`cp1${i}`]=u-o*t[c]),l&&(o=(l[n]-h)/3,a[`cp2${n}`]=h+o,a[`cp2${i}`]=u+o*t[c])}}function ef(e,t="x"){const n=Gl(t),i=e.length,s=Array(i).fill(0),o=Array(i);let r,a,l,c=Wn(e,0);for(r=0;r<i;++r)if(a=l,l=c,c=Wn(e,r+1),!!l){if(c){const h=c[t]-l[t];s[r]=h!==0?(c[n]-l[n])/h:0}o[r]=a?c?_e(s[r-1])!==_e(s[r])?0:(s[r-1]+s[r])/2:s[r-1]:s[r]}Qd(e,s,o),tf(e,o,t)}function Ii(e,t,n){return Math.max(Math.min(e,n),t)}function nf(e,t){let n,i,s,o,r,a=Oe(e[0],t);for(n=0,i=e.length;n<i;++n)r=o,o=a,a=n<i-1&&Oe(e[n+1],t),o&&(s=e[n],r&&(s.cp1x=Ii(s.cp1x,t.left,t.right),s.cp1y=Ii(s.cp1y,t.top,t.bottom)),a&&(s.cp2x=Ii(s.cp2x,t.left,t.right),s.cp2y=Ii(s.cp2y,t.top,t.bottom)))}function sf(e,t,n,i,s){let o,r,a,l;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")ef(e,s);else{let c=i?e[e.length-1]:e[0];for(o=0,r=e.length;o<r;++o)a=e[o],l=Zd(c,a,e[Math.min(o+1,r-(i?0:1))%r],t.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}t.capBezierPoints&&nf(e,n)}function Fo(){return typeof window<"u"&&typeof document<"u"}function zo(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function ns(e,t,n){let i;return typeof e=="string"?(i=parseInt(e,10),e.indexOf("%")!==-1&&(i=i/100*t.parentNode[n])):i=e,i}const gs=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function of(e,t){return gs(e).getPropertyValue(t)}const rf=["top","right","bottom","left"];function _n(e,t,n){const i={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=rf[s];i[o]=parseFloat(e[t+"-"+o+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const af=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function lf(e,t){const n=e.touches,i=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=i;let r=!1,a,l;if(af(s,o,e.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function hn(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:i}=t,s=gs(n),o=s.boxSizing==="border-box",r=_n(s,"padding"),a=_n(s,"border","width"),{x:l,y:c,box:h}=lf(e,n),u=r.left+(h&&a.left),d=r.top+(h&&a.top);let{width:f,height:p}=t;return o&&(f-=r.width+a.width,p-=r.height+a.height),{x:Math.round((l-u)/f*n.width/i),y:Math.round((c-d)/p*n.height/i)}}function cf(e,t,n){let i,s;if(t===void 0||n===void 0){const o=e&&zo(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const r=o.getBoundingClientRect(),a=gs(o),l=_n(a,"border","width"),c=_n(a,"padding");t=r.width-c.width-l.width,n=r.height-c.height-l.height,i=ns(a.maxWidth,o,"clientWidth"),s=ns(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:i||ts,maxHeight:s||ts}}const $e=e=>Math.round(e*10)/10;function hf(e,t,n,i){const s=gs(e),o=_n(s,"margin"),r=ns(s.maxWidth,e,"clientWidth")||ts,a=ns(s.maxHeight,e,"clientHeight")||ts,l=cf(e,t,n);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const d=_n(s,"border","width"),f=_n(s,"padding");c-=f.width+d.width,h-=f.height+d.height}return c=Math.max(0,c-o.width),h=Math.max(0,i?c/i:h-o.height),c=$e(Math.min(c,r,l.maxWidth)),h=$e(Math.min(h,a,l.maxHeight)),c&&!h&&(h=$e(c/2)),(t!==void 0||n!==void 0)&&i&&l.height&&h>l.height&&(h=l.height,c=$e(Math.floor(h*i))),{width:c,height:h}}function Pr(e,t,n){const i=t||1,s=$e(e.height*i),o=$e(e.width*i);e.height=$e(e.height),e.width=$e(e.width);const r=e.canvas;return r.style&&(n||!r.style.height&&!r.style.width)&&(r.style.height=`${e.height}px`,r.style.width=`${e.width}px`),e.currentDevicePixelRatio!==i||r.height!==s||r.width!==o?(e.currentDevicePixelRatio=i,r.height=s,r.width=o,e.ctx.setTransform(i,0,0,i,0,0),!0):!1}const uf=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};Fo()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function Ar(e,t){const n=of(e,t),i=n&&n.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function un(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function df(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:i==="middle"?n<.5?e.y:t.y:i==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function ff(e,t,n,i){const s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},r=un(e,s,n),a=un(s,o,n),l=un(o,t,n),c=un(r,a,n),h=un(a,l,n);return un(c,h,n)}const gf=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,i){return n-i},leftForLtr(n,i){return n-i}}},pf=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Ln(e,t,n){return e?gf(t,n):pf()}function Jl(e,t){let n,i;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,i=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=i)}function Zl(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function Ql(e){return e==="angle"?{between:vi,compare:pd,normalize:zt}:{between:Te,compare:(t,n)=>t-n,normalize:t=>t}}function Tr({start:e,end:t,count:n,loop:i,style:s}){return{start:e%n,end:t%n,loop:i&&(t-e+1)%n===0,style:s}}function mf(e,t,n){const{property:i,start:s,end:o}=n,{between:r,normalize:a}=Ql(i),l=t.length;let{start:c,end:h,loop:u}=e,d,f;if(u){for(c+=l,h+=l,d=0,f=l;d<f&&r(a(t[c%l][i]),s,o);++d)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:u,style:e.style}}function tc(e,t,n){if(!n)return[e];const{property:i,start:s,end:o}=n,r=t.length,{compare:a,between:l,normalize:c}=Ql(i),{start:h,end:u,loop:d,style:f}=mf(e,t,n),p=[];let m=!1,v=null,_,b,x;const k=()=>l(s,x,_)&&a(s,x)!==0,S=()=>a(o,_)===0||l(o,x,_),w=()=>m||k(),C=()=>!m||S();for(let y=h,T=h;y<=u;++y)b=t[y%r],!b.skip&&(_=c(b[i]),_!==x&&(m=l(_,s,o),v===null&&w()&&(v=a(_,s)===0?y:T),v!==null&&C()&&(p.push(Tr({start:v,end:y,loop:d,count:r,style:f})),v=null),T=y,x=_));return v!==null&&p.push(Tr({start:v,end:u,loop:d,count:r,style:f})),p}function ec(e,t){const n=[],i=e.segments;for(let s=0;s<i.length;s++){const o=tc(i[s],e.points,t);o.length&&n.push(...o)}return n}function vf(e,t,n,i){let s=0,o=t-1;if(n&&!i)for(;s<t&&!e[s].skip;)s++;for(;s<t&&e[s].skip;)s++;for(s%=t,n&&(o+=s);o>s&&e[o%t].skip;)o--;return o%=t,{start:s,end:o}}function _f(e,t,n,i){const s=e.length,o=[];let r=t,a=e[t],l;for(l=t+1;l<=n;++l){const c=e[l%s];c.skip||c.stop?a.skip||(i=!1,o.push({start:t%s,end:(l-1)%s,loop:i}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:i}),o}function bf(e,t){const n=e.points,i=e.options.spanGaps,s=n.length;if(!s)return[];const o=!!e._loop,{start:r,end:a}=vf(n,s,o,i);if(i===!0)return Dr(e,[{start:r,end:a,loop:o}],n,t);const l=a<r?a+s:a,c=!!e._fullLoop&&r===0&&a===s-1;return Dr(e,_f(n,r,l,c),n,t)}function Dr(e,t,n,i){return!i||!i.setContext||!n?t:xf(e,t,n,i)}function xf(e,t,n,i){const s=e._chart.getContext(),o=Or(e.options),{_datasetIndex:r,options:{spanGaps:a}}=e,l=n.length,c=[];let h=o,u=t[0].start,d=u;function f(p,m,v,_){const b=a?-1:1;if(p!==m){for(p+=l;n[p%l].skip;)p-=b;for(;n[m%l].skip;)m+=b;p%l!==m%l&&(c.push({start:p%l,end:m%l,loop:v,style:_}),h=_,u=m%l)}}for(const p of t){u=a?u:p.start;let m=n[u%l],v;for(d=u+1;d<=p.end;d++){const _=n[d%l];v=Or(i.setContext(tn(s,{type:"segment",p0:m,p1:_,p0DataIndex:(d-1)%l,p1DataIndex:d%l,datasetIndex:r}))),yf(v,h)&&f(u,d-1,p.loop,h),m=_,h=v}u<d-1&&f(u,d-1,p.loop,h)}return c}function Or(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function yf(e,t){if(!t)return!1;const n=[],i=function(s,o){return Oo(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,i)!==JSON.stringify(t,i)}function Fi(e,t,n){return e.options.clip?e[n]:t[n]}function wf(e,t){const{xScale:n,yScale:i}=e;return n&&i?{left:Fi(n,t,"left"),right:Fi(n,t,"right"),top:Fi(i,t,"top"),bottom:Fi(i,t,"bottom")}:t}function nc(e,t){const n=t._clip;if(n.disabled)return!1;const i=wf(t,e.chartArea);return{left:n.left===!1?0:i.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:i.right+(n.right===!0?0:n.right),top:n.top===!1?0:i.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:i.bottom+(n.bottom===!0?0:n.bottom)}}class kf{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,i,s){const o=n.listeners[s],r=n.duration;o.forEach(a=>a({chart:t,initial:n.initial,numSteps:r,currentStep:Math.min(i-n.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Nl.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const o=i.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let i=n.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,i)),i}listen(t,n,i){this._getAnims(t).listeners[n].push(i)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const i=n.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Se=new kf;const Er="transparent",Sf={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const i=wr(e||Er),s=i.valid&&wr(t||Er);return s&&s.valid?s.mix(i,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class Mf{constructor(t,n,i,s){const o=n[i];s=ii([t.to,s,o,t.from]);const r=ii([t.from,o,s]);this._active=!0,this._fn=t.fn||Sf[t.type||typeof r],this._easing=hi[t.easing]||hi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=i,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,i){if(this._active){this._notify(!1);const s=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=ii([t.to,n,s,t.from]),this._from=ii([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,i=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||n<i),!this._active){this._target[s]=a,this._notify(!0);return}if(n<0){this._target[s]=o;return}l=n/i%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,i)=>{t.push({res:n,rej:i})})}_notify(t){const n=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][n]()}}class ic{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!Q(t))return;const n=Object.keys(vt.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!Q(o))return;const r={};for(const a of n)r[a]=o[a];(mt(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,n){const i=n.options,s=Pf(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&Cf(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,n){const i=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(n),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,n));continue}const h=n[c];let u=o[c];const d=i.get(c);if(u)if(d&&u.active()){u.update(d,h,a);continue}else u.cancel();if(!d||!d.duration){t[c]=h;continue}o[c]=u=new Mf(d,t,c,h),s.push(u)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const i=this._createAnimations(t,n);if(i.length)return Se.add(this._chart,i),!0}}function Cf(e,t){const n=[],i=Object.keys(t);for(let s=0;s<i.length;s++){const o=e[i[s]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function Pf(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function Lr(e,t){const n=e&&e.options||{},i=n.reverse,s=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function Af(e,t,n){if(n===!1)return!1;const i=Lr(e,n),s=Lr(t,n);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function Tf(e){let t,n,i,s;return Q(e)?(t=e.top,n=e.right,i=e.bottom,s=e.left):t=n=i=s=e,{top:t,right:n,bottom:i,left:s,disabled:e===!1}}function sc(e,t){const n=[],i=e._getSortedDatasetMetas(t);let s,o;for(s=0,o=i.length;s<o;++s)n.push(i[s].index);return n}function Rr(e,t,n,i={}){const s=e.keys,o=i.mode==="single";let r,a,l,c;if(t===null)return;let h=!1;for(r=0,a=s.length;r<a;++r){if(l=+s[r],l===n){if(h=!0,i.all)continue;break}c=e.values[l],kt(c)&&(o||t===0||_e(t)===_e(c))&&(t+=c)}return!h&&!i.all?0:t}function Df(e,t){const{iScale:n,vScale:i}=t,s=n.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",r=Object.keys(e),a=new Array(r.length);let l,c,h;for(l=0,c=r.length;l<c;++l)h=r[l],a[l]={[s]:h,[o]:e[h]};return a}function Ms(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function Of(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function Ef(e){const{min:t,max:n,minDefined:i,maxDefined:s}=e.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?n:Number.POSITIVE_INFINITY}}function Lf(e,t,n){const i=e[t]||(e[t]={});return i[n]||(i[n]={})}function Ir(e,t,n,i){for(const s of t.getMatchingVisibleMetas(i).reverse()){const o=e[s.index];if(n&&o>0||!n&&o<0)return s.index}return null}function Fr(e,t){const{chart:n,_cachedMeta:i}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:r,index:a}=i,l=o.axis,c=r.axis,h=Of(o,r,i),u=t.length;let d;for(let f=0;f<u;++f){const p=t[f],{[l]:m,[c]:v}=p,_=p._stacks||(p._stacks={});d=_[c]=Lf(s,h,m),d[a]=v,d._top=Ir(d,r,!0,i.type),d._bottom=Ir(d,r,!1,i.type);const b=d._visualValues||(d._visualValues={});b[a]=v}}function Cs(e,t){const n=e.scales;return Object.keys(n).filter(i=>n[i].axis===t).shift()}function Rf(e,t){return tn(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function If(e,t,n){return tn(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function Kn(e,t){const n=e.controller.index,i=e.vScale&&e.vScale.axis;if(i){t=t||e._parsed;for(const s of t){const o=s._stacks;if(!o||o[i]===void 0||o[i][n]===void 0)return;delete o[i][n],o[i]._visualValues!==void 0&&o[i]._visualValues[n]!==void 0&&delete o[i]._visualValues[n]}}}const Ps=e=>e==="reset"||e==="none",zr=(e,t)=>t?e:Object.assign({},e),Ff=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:sc(n,!0),values:null};class en{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ms(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Kn(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,i=this.getDataset(),s=(u,d,f,p)=>u==="x"?d:u==="r"?p:f,o=n.xAxisID=U(i.xAxisID,Cs(t,"x")),r=n.yAxisID=U(i.yAxisID,Cs(t,"y")),a=n.rAxisID=U(i.rAxisID,Cs(t,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,r,a),h=n.vAxisID=s(l,r,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(r),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&br(this._data,this),t._stacked&&Kn(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),i=this._data;if(Q(n)){const s=this._cachedMeta;this._data=Df(n,s)}else if(i!==n){if(i){br(i,this);const s=this._cachedMeta;Kn(s),s._parsed=[]}n&&Object.isExtensible(n)&&bd(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=Ms(n.vScale,n),n.stack!==i.stack&&(s=!0,Kn(n),n.stack=i.stack),this._resyncElements(t),(s||o!==n._stacked)&&(Fr(this,n._parsed),n._stacked=Ms(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:r}=i,a=o.axis;let l=t===0&&n===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],h,u,d;if(this._parsing===!1)i._parsed=s,i._sorted=!0,d=s;else{mt(s[t])?d=this.parseArrayData(i,s,t,n):Q(s[t])?d=this.parseObjectData(i,s,t,n):d=this.parsePrimitiveData(i,s,t,n);const f=()=>u[a]===null||c&&u[a]<c[a];for(h=0;h<n;++h)i._parsed[h+t]=u=d[h],l&&(f()&&(l=!1),c=u);i._sorted=l}r&&Fr(this,d)}parsePrimitiveData(t,n,i,s){const{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),h=o===r,u=new Array(s);let d,f,p;for(d=0,f=s;d<f;++d)p=d+i,u[d]={[a]:h||o.parse(c[p],p),[l]:r.parse(n[p],p)};return u}parseArrayData(t,n,i,s){const{xScale:o,yScale:r}=t,a=new Array(s);let l,c,h,u;for(l=0,c=s;l<c;++l)h=l+i,u=n[h],a[l]={x:o.parse(u[0],h),y:r.parse(u[1],h)};return a}parseObjectData(t,n,i,s){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let h,u,d,f;for(h=0,u=s;h<u;++h)d=h+i,f=n[d],c[h]={x:o.parse(Je(f,a),d),y:r.parse(Je(f,l),d)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,i){const s=this.chart,o=this._cachedMeta,r=n[t.axis],a={keys:sc(s,!0),values:n._stacks[t.axis]._visualValues};return Rr(a,r,o.index,{mode:i})}updateRangeFromParsed(t,n,i,s){const o=i[n.axis];let r=o===null?NaN:o;const a=s&&i._stacks[n.axis];s&&a&&(s.values=a,r=Rr(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,n){const i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,r=s.length,a=this._getOtherScale(t),l=Ff(n,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:u}=Ef(a);let d,f;function p(){f=s[d];const m=f[a.axis];return!kt(f[t.axis])||h>m||u<m}for(d=0;d<r&&!(!p()&&(this.updateRangeFromParsed(c,t,f,l),o));++d);if(o){for(d=r-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,i=[];let s,o,r;for(s=0,o=n.length;s<o;++s)r=n[s][t.axis],kt(r)&&i.push(r);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,i=n.iScale,s=n.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=Tf(U(this.options.clip,Af(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,i=this._cachedMeta,s=i.data||[],o=n.chartArea,r=[],a=this._drawStart||0,l=this._drawCount||s.length-a,c=this.options.drawActiveElementsOnTop;let h;for(i.dataset&&i.dataset.draw(t,o,a,l),h=a;h<a+l;++h){const u=s[h];u.hidden||(u.active&&c?r.push(u):u.draw(t,o))}for(h=0;h<r.length;++h)r[h].draw(t,o)}getStyle(t,n){const i=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,n,i){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=If(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Rf(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",i){const s=n==="active",o=this._cachedDataOpts,r=t+"-"+n,a=o[r],l=this.enableOptionSharing&&mi(i);if(a)return zr(a,l);const c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),u=s?[`${t}Hover`,"hover",t,""]:[t,""],d=c.getOptionScopes(this.getDataset(),h),f=Object.keys(vt.elements[t]),p=()=>this.getContext(i,s,n),m=c.resolveNamedOptions(d,f,p,u);return m.$shared&&(m.$shared=l,o[r]=Object.freeze(zr(m,l))),m}_resolveAnimations(t,n,i){const s=this.chart,o=this._cachedDataOpts,r=`animation-${n}`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,n),d=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(d,this.getContext(t,i,n))}const c=new ic(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||Ps(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const i=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,i),{sharedOptions:o,includeOptions:r}}updateElement(t,n,i,s){Ps(s)?Object.assign(t,i):this._resolveAnimations(n,s).update(t,i)}updateSharedOptions(t,n,i){t&&!Ps(n)&&this._resolveAnimations(void 0,n).update(t,i)}_setStyle(t,n,i,s){t.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,n,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,o=n.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,n,i=!0){const s=this._cachedMeta,o=s.data,r=t+n;let a;const l=c=>{for(c.length+=n,a=c.length-1;a>=r;a--)c[a]=c[a-n]};for(l(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,n),i&&this.updateElements(o,t,n,"reset")}updateElements(t,n,i,s){}_removeElements(t,n){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,n);i._stacked&&Kn(i,s)}i.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,i,s]=t;this[n](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function zf(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let i=[];for(let s=0,o=n.length;s<o;s++)i=i.concat(n[s].controller.getAllParsedValues(e));e._cache.$bar=zl(i.sort((s,o)=>s-o))}return e._cache.$bar}function Nf(e){const t=e.iScale,n=zf(t,e.type);let i=t._length,s,o,r,a;const l=()=>{r===32767||r===-32768||(mi(a)&&(i=Math.min(i,Math.abs(r-a)||i)),a=r)};for(s=0,o=n.length;s<o;++s)r=t.getPixelForValue(n[s]),l();for(a=void 0,s=0,o=t.ticks.length;s<o;++s)r=t.getPixelForTick(s),l();return i}function Bf(e,t,n,i){const s=n.barThickness;let o,r;return J(s)?(o=t.min*n.categoryPercentage,r=n.barPercentage):(o=s*i,r=1),{chunk:o/i,ratio:r,start:t.pixels[e]-o/2}}function Vf(e,t,n,i){const s=t.pixels,o=s[e];let r=e>0?s[e-1]:null,a=e<s.length-1?s[e+1]:null;const l=n.categoryPercentage;r===null&&(r=o-(a===null?t.end-t.start:a-o)),a===null&&(a=o+o-r);const c=o-(o-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/i,ratio:n.barPercentage,start:c}}function Wf(e,t,n,i){const s=n.parse(e[0],i),o=n.parse(e[1],i),r=Math.min(s,o),a=Math.max(s,o);let l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),t[n.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:r,max:a}}function oc(e,t,n,i){return mt(e)?Wf(e,t,n,i):t[n.axis]=n.parse(e,i),t}function Nr(e,t,n,i){const s=e.iScale,o=e.vScale,r=s.getLabels(),a=s===o,l=[];let c,h,u,d;for(c=n,h=n+i;c<h;++c)d=t[c],u={},u[s.axis]=a||s.parse(r[c],c),l.push(oc(d,u,o,c));return l}function As(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function Hf(e,t,n){return e!==0?_e(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function jf(e){let t,n,i,s,o;return e.horizontal?(t=e.base>e.x,n="left",i="right"):(t=e.base<e.y,n="bottom",i="top"),t?(s="end",o="start"):(s="start",o="end"),{start:n,end:i,reverse:t,top:s,bottom:o}}function $f(e,t,n,i){let s=t.borderSkipped;const o={};if(!s){e.borderSkipped=o;return}if(s===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:r,end:a,reverse:l,top:c,bottom:h}=jf(e);s==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===i?s=c:(n._bottom||0)===i?s=h:(o[Br(h,r,a,l)]=!0,s=c)),o[Br(s,r,a,l)]=!0,e.borderSkipped=o}function Br(e,t,n,i){return i?(e=Yf(e,t,n),e=Vr(e,n,t)):e=Vr(e,t,n),e}function Yf(e,t,n){return e===t?n:e===n?t:e}function Vr(e,t,n){return e==="start"?t:e==="end"?n:e}function Uf(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class Xf extends en{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,n,i,s){return Nr(t,n,i,s)}parseArrayData(t,n,i,s){return Nr(t,n,i,s)}parseObjectData(t,n,i,s){const{iScale:o,vScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?a:l,h=r.axis==="x"?a:l,u=[];let d,f,p,m;for(d=i,f=i+s;d<f;++d)m=n[d],p={},p[o.axis]=o.parse(Je(m,c),d),u.push(oc(Je(m,h),p,r,d));return u}updateRangeFromParsed(t,n,i,s){super.updateRangeFromParsed(t,n,i,s);const o=i._custom;o&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const n=this._cachedMeta,{iScale:i,vScale:s}=n,o=this.getParsed(t),r=o._custom,a=As(r)?"["+r.start+", "+r.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,i,s){const o=s==="reset",{index:r,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),h=this._getRuler(),{sharedOptions:u,includeOptions:d}=this._getSharedOptions(n,s);for(let f=n;f<n+i;f++){const p=this.getParsed(f),m=o||J(p[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),v=this._calculateBarIndexPixels(f,h),_=(p._stacks||{})[a.axis],b={horizontal:c,base:m.base,enableBorderRadius:!_||As(p._custom)||r===_._top||r===_._bottom,x:c?m.head:v.center,y:c?v.center:m.head,height:c?v.size:Math.abs(m.size),width:c?Math.abs(m.size):v.size};d&&(b.options=u||this.resolveDataElementOptions(f,t[f].active?"active":s));const x=b.options||t[f].options;$f(b,x,_,r),Uf(b,x,h.ratio),this.updateElement(t[f],f,b,s)}}_getStacks(t,n){const{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(h=>h.controller.options.grouped),o=i.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[i.axis],c=h=>{const u=h._parsed.find(f=>f[i.axis]===l),d=u&&u[h.vScale.axis];if(J(d)||isNaN(d))return!0};for(const h of s)if(!(n!==void 0&&c(h))&&((o===!1||r.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&r.push(h.stack),h.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===n).shift()}_getAxis(){const t={},n=this.getFirstScaleIdForIndexAxis();for(const i of this.chart.data.datasets)t[U(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,n)]=!0;return Object.keys(t)}_getStackIndex(t,n,i){const s=this._getStacks(t,i),o=n!==void 0?s.indexOf(n):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,n=this._cachedMeta,i=n.iScale,s=[];let o,r;for(o=0,r=n.data.length;o<r;++o)s.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));const a=t.barThickness;return{min:a||Nf(n),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:n,_stacked:i,index:s},options:{base:o,minBarLength:r}}=this,a=o||0,l=this.getParsed(t),c=l._custom,h=As(c);let u=l[n.axis],d=0,f=i?this.applyStack(n,l,i):u,p,m;f!==u&&(d=f-u,f=u),h&&(u=c.barStart,f=c.barEnd-c.barStart,u!==0&&_e(u)!==_e(c.barEnd)&&(d=0),d+=u);const v=!J(o)&&!h?o:d;let _=n.getPixelForValue(v);if(this.chart.getDataVisibility(t)?p=n.getPixelForValue(d+f):p=_,m=p-_,Math.abs(m)<r){m=Hf(m,n,a)*r,u===a&&(_-=m/2);const b=n.getPixelForDecimal(0),x=n.getPixelForDecimal(1),k=Math.min(b,x),S=Math.max(b,x);_=Math.max(Math.min(_,S),k),p=_+m,i&&!h&&(l._stacks[n.axis]._visualValues[s]=n.getValueForPixel(p)-n.getValueForPixel(_))}if(_===n.getPixelForValue(a)){const b=_e(m)*n.getLineWidthForValue(a)/2;_+=b,m-=b}return{size:m,base:_,head:p,center:p+m/2}}_calculateBarIndexPixels(t,n){const i=n.scale,s=this.options,o=s.skipNull,r=U(s.maxBarThickness,1/0);let a,l;const c=this._getAxisCount();if(n.grouped){const h=o?this._getStackCount(t):n.stackCount,u=s.barThickness==="flex"?Vf(t,n,s,h*c):Bf(t,n,s,h*c),d=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(U(d,this.getFirstScaleIdForIndexAxis())),p=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+f;a=u.start+u.chunk*p+u.chunk/2,l=Math.min(r,u.chunk*u.ratio)}else a=i.getPixelForValue(this.getParsed(t)[i.axis],t),l=Math.min(r,n.min*n.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){const t=this._cachedMeta,n=t.vScale,i=t.data,s=i.length;let o=0;for(;o<s;++o)this.getParsed(o)[n.axis]!==null&&!i[o].hidden&&i[o].draw(this._ctx)}}class qf extends en{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,n,i,s){const o=super.parsePrimitiveData(t,n,i,s);for(let r=0;r<o.length;r++)o[r]._custom=this.resolveDataElementOptions(r+i).radius;return o}parseArrayData(t,n,i,s){const o=super.parseArrayData(t,n,i,s);for(let r=0;r<o.length;r++){const a=n[i+r];o[r]._custom=U(a[2],this.resolveDataElementOptions(r+i).radius)}return o}parseObjectData(t,n,i,s){const o=super.parseObjectData(t,n,i,s);for(let r=0;r<o.length;r++){const a=n[i+r];o[r]._custom=U(a&&a.r&&+a.r,this.resolveDataElementOptions(r+i).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let n=0;for(let i=t.length-1;i>=0;--i)n=Math.max(n,t[i].size(this.resolveDataElementOptions(i))/2);return n>0&&n}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=n,r=this.getParsed(t),a=s.getLabelForValue(r.x),l=o.getLabelForValue(r.y),c=r._custom;return{label:i[t]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(t){const n=this._cachedMeta.data;this.updateElements(n,0,n.length,t)}updateElements(t,n,i,s){const o=s==="reset",{iScale:r,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(n,s),h=r.axis,u=a.axis;for(let d=n;d<n+i;d++){const f=t[d],p=!o&&this.getParsed(d),m={},v=m[h]=o?r.getPixelForDecimal(.5):r.getPixelForValue(p[h]),_=m[u]=o?a.getBasePixel():a.getPixelForValue(p[u]);m.skip=isNaN(v)||isNaN(_),c&&(m.options=l||this.resolveDataElementOptions(d,f.active?"active":s),o&&(m.options.radius=0)),this.updateElement(f,d,m,s)}}resolveDataElementOptions(t,n){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,n);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const o=s.radius;return n!=="active"&&(s.radius=0),s.radius+=U(i&&i._custom,o),s}}function Kf(e,t,n){let i=1,s=1,o=0,r=0;if(t<ft){const a=e,l=a+t,c=Math.cos(a),h=Math.sin(a),u=Math.cos(l),d=Math.sin(l),f=(x,k,S)=>vi(x,a,l,!0)?1:Math.max(k,k*n,S,S*n),p=(x,k,S)=>vi(x,a,l,!0)?-1:Math.min(k,k*n,S,S*n),m=f(0,c,u),v=f(Ct,h,d),_=p(nt,c,u),b=p(nt+Ct,h,d);i=(m-_)/2,s=(v-b)/2,o=-(m+_)/2,r=-(v+b)/2}return{ratioX:i,ratioY:s,offsetX:o,offsetY:r}}class No extends en{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data,{labels:{pointStyle:i,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=t.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((l,c)=>{const u=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:u.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:u.borderWidth,strokeStyle:u.borderColor,textAlign:s,pointStyle:i,borderRadius:r&&(a||u.borderRadius),index:c}}):[]}},onClick(t,n,i){i.chart.toggleDataVisibility(n.index),i.chart.update()}}}};constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let o=l=>+i[l];if(Q(i[t])){const{key:l="value"}=this._parsing;o=c=>+Je(i[c],l)}let r,a;for(r=t,a=t+n;r<a;++r)s._parsed[r]=o(r)}}_getRotation(){return de(this.options.rotation-90)}_getCircumference(){return de(this.options.circumference)}_getRotationExtents(){let t=ft,n=-ft;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,o=s._getRotation(),r=s._getCircumference();t=Math.min(t,o),n=Math.max(n,o+r)}return{rotation:t,circumference:n-t}}update(t){const n=this.chart,{chartArea:i}=n,s=this._cachedMeta,o=s.data,r=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,a=Math.max((Math.min(i.width,i.height)-r)/2,0),l=Math.min(sd(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:h,rotation:u}=this._getRotationExtents(),{ratioX:d,ratioY:f,offsetX:p,offsetY:m}=Kf(u,h,l),v=(i.width-r)/d,_=(i.height-r)/f,b=Math.max(Math.min(v,_)/2,0),x=El(this.options.radius,b),k=Math.max(x*l,0),S=(x-k)/this._getVisibleDatasetWeightTotal();this.offsetX=p*x,this.offsetY=m*x,s.total=this.calculateTotal(),this.outerRadius=x-S*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-S*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,n){const i=this.options,s=this._cachedMeta,o=this._getCircumference();return n&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/ft)}updateElements(t,n,i,s){const o=s==="reset",r=this.chart,a=r.chartArea,c=r.options.animation,h=(a.left+a.right)/2,u=(a.top+a.bottom)/2,d=o&&c.animateScale,f=d?0:this.innerRadius,p=d?0:this.outerRadius,{sharedOptions:m,includeOptions:v}=this._getSharedOptions(n,s);let _=this._getRotation(),b;for(b=0;b<n;++b)_+=this._circumference(b,o);for(b=n;b<n+i;++b){const x=this._circumference(b,o),k=t[b],S={x:h+this.offsetX,y:u+this.offsetY,startAngle:_,endAngle:_+x,circumference:x,outerRadius:p,innerRadius:f};v&&(S.options=m||this.resolveDataElementOptions(b,k.active?"active":s)),_+=x,this.updateElement(k,b,S,s)}}calculateTotal(){const t=this._cachedMeta,n=t.data;let i=0,s;for(s=0;s<n.length;s++){const o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!n[s].hidden&&(i+=Math.abs(o))}return i}calculateCircumference(t){const n=this._cachedMeta.total;return n>0&&!isNaN(t)?ft*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=Ci(n._parsed[t],i.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let n=0;const i=this.chart;let s,o,r,a,l;if(!t){for(s=0,o=i.data.datasets.length;s<o;++s)if(i.isDatasetVisible(s)){r=i.getDatasetMeta(s),t=r.data,a=r.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)l=a.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(n=Math.max(n,l.borderWidth||0,l.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let i=0,s=t.length;i<s;++i){const o=this.resolveDataElementOptions(i);n=Math.max(n,o.offset||0,o.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(n+=this._getRingWeight(i));return n}_getRingWeight(t){return Math.max(U(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class Gf extends en{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=n,r=this.chart._animationsDisabled;let{start:a,count:l}=Vl(n,s,r);this._drawStart=a,this._drawCount=l,Wl(n)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,n,i,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(n,s),d=r.axis,f=a.axis,{spanGaps:p,segment:m}=this.options,v=Bn(p)?p:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||s==="none",b=n+i,x=t.length;let k=n>0&&this.getParsed(n-1);for(let S=0;S<x;++S){const w=t[S],C=_?w:{};if(S<n||S>=b){C.skip=!0;continue}const y=this.getParsed(S),T=J(y[f]),E=C[d]=r.getPixelForValue(y[d],S),R=C[f]=o||T?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,y,l):y[f],S);C.skip=isNaN(E)||isNaN(R)||T,C.stop=S>0&&Math.abs(y[d]-k[d])>v,m&&(C.parsed=y,C.raw=c.data[S]),u&&(C.options=h||this.resolveDataElementOptions(S,w.active?"active":s)),_||this.updateElement(w,S,C,s),k=y}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,i=n.options&&n.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}class rc extends en{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return n.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,n,i){i.chart.toggleDataVisibility(n.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,n){super(t,n),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=Ci(n._parsed[t].r,i.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,n,i,s){return Kl.bind(this)(t,n,i,s)}update(t){const n=this._cachedMeta.data;this._updateRadius(),this.updateElements(n,0,n.length,t)}getMinMax(){const t=this._cachedMeta,n={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(o<n.min&&(n.min=o),o>n.max&&(n.max=o))}),n}_updateRadius(){const t=this.chart,n=t.chartArea,i=t.options,s=Math.min(n.right-n.left,n.bottom-n.top),o=Math.max(s/2,0),r=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,n,i,s){const o=s==="reset",r=this.chart,l=r.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,u=c.yCenter,d=c.getIndexAngle(0)-.5*nt;let f=d,p;const m=360/this.countVisibleElements();for(p=0;p<n;++p)f+=this._computeAngle(p,s,m);for(p=n;p<n+i;p++){const v=t[p];let _=f,b=f+this._computeAngle(p,s,m),x=r.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;f=b,o&&(l.animateScale&&(x=0),l.animateRotate&&(_=b=d));const k={x:h,y:u,innerRadius:0,outerRadius:x,startAngle:_,endAngle:b,options:this.resolveDataElementOptions(p,v.active?"active":s)};this.updateElement(v,p,k,s)}}countVisibleElements(){const t=this._cachedMeta;let n=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&n++}),n}_computeAngle(t,n,i){return this.chart.getDataVisibility(t)?de(this.resolveDataElementOptions(t,n).angle||i):0}}class Jf extends No{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}class Zf extends en{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const n=this._cachedMeta.vScale,i=this.getParsed(t);return{label:n.getLabels()[t],value:""+n.getLabelForValue(i[n.axis])}}parseObjectData(t,n,i,s){return Kl.bind(this)(t,n,i,s)}update(t){const n=this._cachedMeta,i=n.dataset,s=n.data||[],o=n.iScale.getLabels();if(i.points=s,t!=="resize"){const r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);const a={_loop:!0,_fullLoop:o.length===s.length,options:r};this.updateElement(i,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,n,i,s){const o=this._cachedMeta.rScale,r=s==="reset";for(let a=n;a<n+i;a++){const l=t[a],c=this.resolveDataElementOptions(a,l.active?"active":s),h=o.getPointPositionForValue(a,this.getParsed(a).r),u=r?o.xCenter:h.x,d=r?o.yCenter:h.y,f={x:u,y:d,angle:h.angle,skip:isNaN(u)||isNaN(d),options:c};this.updateElement(l,a,f,s)}}}class Qf extends en{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const n=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=n,r=this.getParsed(t),a=s.getLabelForValue(r.x),l=o.getLabelForValue(r.y);return{label:i[t]||"",value:"("+a+", "+l+")"}}update(t){const n=this._cachedMeta,{data:i=[]}=n,s=this.chart._animationsDisabled;let{start:o,count:r}=Vl(n,i,s);if(this._drawStart=o,this._drawCount=r,Wl(n)&&(o=0,r=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:l}=n;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!l._decimated,a.points=i;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(a,void 0,{animated:!s,options:c},t)}else this.datasetElementType&&(delete n.dataset,this.datasetElementType=!1);this.updateElements(i,o,r,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,n,i,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,h=this.resolveDataElementOptions(n,s),u=this.getSharedOptions(h),d=this.includeOptions(s,u),f=r.axis,p=a.axis,{spanGaps:m,segment:v}=this.options,_=Bn(m)?m:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||s==="none";let x=n>0&&this.getParsed(n-1);for(let k=n;k<n+i;++k){const S=t[k],w=this.getParsed(k),C=b?S:{},y=J(w[p]),T=C[f]=r.getPixelForValue(w[f],k),E=C[p]=o||y?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,w,l):w[p],k);C.skip=isNaN(T)||isNaN(E)||y,C.stop=k>0&&Math.abs(w[f]-x[f])>_,v&&(C.parsed=w,C.raw=c.data[k]),d&&(C.options=u||this.resolveDataElementOptions(k,S.active?"active":s)),b||this.updateElement(S,k,C,s),x=w}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,n=t.data||[];if(!this.options.showLine){let a=0;for(let l=n.length-1;l>=0;--l)a=Math.max(a,n[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!n.length)return s;const o=n[0].size(this.resolveDataElementOptions(0)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,r)/2}}var tg=Object.freeze({__proto__:null,BarController:Xf,BubbleController:qf,DoughnutController:No,LineController:Gf,PieController:Jf,PolarAreaController:rc,RadarController:Zf,ScatterController:Qf});function ln(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Bo{static override(t){Object.assign(Bo.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return ln()}parse(){return ln()}format(){return ln()}add(){return ln()}diff(){return ln()}startOf(){return ln()}endOf(){return ln()}}var eg={_date:Bo};function ng(e,t,n,i){const{controller:s,data:o,_sorted:r}=e,a=s._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?vd:De;if(i){if(s._sharedOptions){const h=o[0],u=typeof h.getRange=="function"&&h.getRange(t);if(u){const d=c(o,t,n-u),f=c(o,t,n+u);return{lo:d.lo,hi:f.hi}}}}else{const h=c(o,t,n);if(l){const{vScale:u}=s._cachedMeta,{_parsed:d}=e,f=d.slice(0,h.lo+1).reverse().findIndex(m=>!J(m[u.axis]));h.lo-=Math.max(0,f);const p=d.slice(h.hi).findIndex(m=>!J(m[u.axis]));h.hi+=Math.max(0,p)}return h}}return{lo:0,hi:o.length-1}}function ps(e,t,n,i,s){const o=e.getSortedVisibleDatasetMetas(),r=n[t];for(let a=0,l=o.length;a<l;++a){const{index:c,data:h}=o[a],{lo:u,hi:d}=ng(o[a],t,r,s);for(let f=u;f<=d;++f){const p=h[f];p.skip||i(p,c,f)}}}function ig(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(i,s){const o=t?Math.abs(i.x-s.x):0,r=n?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function Ts(e,t,n,i,s){const o=[];return!s&&!e.isPointInArea(t)||ps(e,n,t,function(a,l,c){!s&&!Oe(a,e.chartArea,0)||a.inRange(t.x,t.y,i)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function sg(e,t,n,i){let s=[];function o(r,a,l){const{startAngle:c,endAngle:h}=r.getProps(["startAngle","endAngle"],i),{angle:u}=Il(r,{x:t.x,y:t.y});vi(u,c,h)&&s.push({element:r,datasetIndex:a,index:l})}return ps(e,n,t,o),s}function og(e,t,n,i,s,o){let r=[];const a=ig(n);let l=Number.POSITIVE_INFINITY;function c(h,u,d){const f=h.inRange(t.x,t.y,s);if(i&&!f)return;const p=h.getCenterPoint(s);if(!(!!o||e.isPointInArea(p))&&!f)return;const v=a(t,p);v<l?(r=[{element:h,datasetIndex:u,index:d}],l=v):v===l&&r.push({element:h,datasetIndex:u,index:d})}return ps(e,n,t,c),r}function Ds(e,t,n,i,s,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!i?sg(e,t,n,s):og(e,t,n,i,s,o)}function Wr(e,t,n,i,s){const o=[],r=n==="x"?"inXRange":"inYRange";let a=!1;return ps(e,n,t,(l,c,h)=>{l[r]&&l[r](t[n],s)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:o}var rg={modes:{index(e,t,n,i){const s=hn(t,e),o=n.axis||"x",r=n.includeInvisible||!1,a=n.intersect?Ts(e,s,o,i,r):Ds(e,s,o,!1,i,r),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(e,t,n,i){const s=hn(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;let a=n.intersect?Ts(e,s,o,i,r):Ds(e,s,o,!1,i,r);if(a.length>0){const l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let h=0;h<c.length;++h)a.push({element:c[h],datasetIndex:l,index:h})}return a},point(e,t,n,i){const s=hn(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return Ts(e,s,o,i,r)},nearest(e,t,n,i){const s=hn(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return Ds(e,s,o,n.intersect,i,r)},x(e,t,n,i){const s=hn(t,e);return Wr(e,s,"x",n.intersect,i)},y(e,t,n,i){const s=hn(t,e);return Wr(e,s,"y",n.intersect,i)}}};const ac=["left","top","right","bottom"];function Gn(e,t){return e.filter(n=>n.pos===t)}function Hr(e,t){return e.filter(n=>ac.indexOf(n.pos)===-1&&n.box.axis===t)}function Jn(e,t){return e.sort((n,i)=>{const s=t?i:n,o=t?n:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function ag(e){const t=[];let n,i,s,o,r,a;for(n=0,i=(e||[]).length;n<i;++n)s=e[n],{position:o,options:{stack:r,stackWeight:a=1}}=s,t.push({index:n,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:r&&o+r,stackWeight:a});return t}function lg(e){const t={};for(const n of e){const{stack:i,pos:s,stackWeight:o}=n;if(!i||!ac.includes(s))continue;const r=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function cg(e,t){const n=lg(e),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let o,r,a;for(o=0,r=e.length;o<r;++o){a=e[o];const{fullSize:l}=a.box,c=n[a.stack],h=c&&a.stackWeight/c.weight;a.horizontal?(a.width=h?h*i:l&&t.availableWidth,a.height=s):(a.width=i,a.height=h?h*s:l&&t.availableHeight)}return n}function hg(e){const t=ag(e),n=Jn(t.filter(c=>c.box.fullSize),!0),i=Jn(Gn(t,"left"),!0),s=Jn(Gn(t,"right")),o=Jn(Gn(t,"top"),!0),r=Jn(Gn(t,"bottom")),a=Hr(t,"x"),l=Hr(t,"y");return{fullSize:n,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:Gn(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function jr(e,t,n,i){return Math.max(e[n],t[n])+Math.max(e[i],t[i])}function lc(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function ug(e,t,n,i){const{pos:s,box:o}=n,r=e.maxPadding;if(!Q(s)){n.size&&(e[s]-=n.size);const u=i[n.stack]||{size:0,count:1};u.size=Math.max(u.size,n.horizontal?o.height:o.width),n.size=u.size/u.count,e[s]+=n.size}o.getPadding&&lc(r,o.getPadding());const a=Math.max(0,t.outerWidth-jr(r,e,"left","right")),l=Math.max(0,t.outerHeight-jr(r,e,"top","bottom")),c=a!==e.w,h=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:c,other:h}:{same:h,other:c}}function dg(e){const t=e.maxPadding;function n(i){const s=Math.max(t[i]-e[i],0);return e[i]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function fg(e,t){const n=t.maxPadding;function i(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],n[r])}),o}return i(e?["left","right"]:["top","bottom"])}function si(e,t,n,i){const s=[];let o,r,a,l,c,h;for(o=0,r=e.length,c=0;o<r;++o){a=e[o],l=a.box,l.update(a.width||t.w,a.height||t.h,fg(a.horizontal,t));const{same:u,other:d}=ug(t,n,a,i);c|=u&&s.length,h=h||d,l.fullSize||s.push(a)}return c&&si(s,t,n,i)||h}function zi(e,t,n,i,s){e.top=n,e.left=t,e.right=t+i,e.bottom=n+s,e.width=i,e.height=s}function $r(e,t,n,i){const s=n.padding;let{x:o,y:r}=t;for(const a of e){const l=a.box,c=i[a.stack]||{placed:0,weight:1},h=a.stackWeight/c.weight||1;if(a.horizontal){const u=t.w*h,d=c.size||l.height;mi(c.start)&&(r=c.start),l.fullSize?zi(l,s.left,r,n.outerWidth-s.right-s.left,d):zi(l,t.left+c.placed,r,u,d),c.start=r,c.placed+=u,r=l.bottom}else{const u=t.h*h,d=c.size||l.width;mi(c.start)&&(o=c.start),l.fullSize?zi(l,o,s.top,d,n.outerHeight-s.bottom-s.top):zi(l,o,t.top+c.placed,d,u),c.start=o,c.placed+=u,o=l.right}}t.x=o,t.y=r}var Vt={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,i){if(!e)return;const s=Wt(e.options.layout.padding),o=Math.max(t-s.width,0),r=Math.max(n-s.height,0),a=hg(e.boxes),l=a.vertical,c=a.horizontal;at(e.boxes,m=>{typeof m.beforeLayout=="function"&&m.beforeLayout()});const h=l.reduce((m,v)=>v.box.options&&v.box.options.display===!1?m:m+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),d=Object.assign({},s);lc(d,Wt(i));const f=Object.assign({maxPadding:d,w:o,h:r,x:s.left,y:s.top},s),p=cg(l.concat(c),u);si(a.fullSize,f,u,p),si(l,f,u,p),si(c,f,u,p)&&si(l,f,u,p),dg(f),$r(a.leftAndTop,f,u,p),f.x+=f.w,f.y+=f.h,$r(a.rightAndBottom,f,u,p),e.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},at(a.chartArea,m=>{const v=m.box;Object.assign(v,e.chartArea),v.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class cc{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,i){}removeEventListener(t,n,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,i,s){return n=Math.max(0,n||t.width),i=i||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):i)}}isAttached(t){return!0}updateConfig(t){}}class gg extends cc{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Ui="$chartjs",pg={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Yr=e=>e===null||e==="";function mg(e,t){const n=e.style,i=e.getAttribute("height"),s=e.getAttribute("width");if(e[Ui]={initial:{height:i,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Yr(s)){const o=Ar(e,"width");o!==void 0&&(e.width=o)}if(Yr(i))if(e.style.height==="")e.height=e.width/(t||2);else{const o=Ar(e,"height");o!==void 0&&(e.height=o)}return e}const hc=uf?{passive:!0}:!1;function vg(e,t,n){e&&e.addEventListener(t,n,hc)}function _g(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,hc)}function bg(e,t){const n=pg[e.type]||e.type,{x:i,y:s}=hn(e,t);return{type:n,chart:t,native:e,x:i!==void 0?i:null,y:s!==void 0?s:null}}function is(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function xg(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||is(a.addedNodes,i),r=r&&!is(a.removedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function yg(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||is(a.removedNodes,i),r=r&&!is(a.addedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const bi=new Map;let Ur=0;function uc(){const e=window.devicePixelRatio;e!==Ur&&(Ur=e,bi.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function wg(e,t){bi.size||window.addEventListener("resize",uc),bi.set(e,t)}function kg(e){bi.delete(e),bi.size||window.removeEventListener("resize",uc)}function Sg(e,t,n){const i=e.canvas,s=i&&zo(i);if(!s)return;const o=Bl((a,l)=>{const c=s.clientWidth;n(a,l),c<s.clientWidth&&n()},window),r=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(s),wg(e,o),r}function Os(e,t,n){n&&n.disconnect(),t==="resize"&&kg(e)}function Mg(e,t,n){const i=e.canvas,s=Bl(o=>{e.ctx!==null&&n(bg(o,e))},e);return vg(i,t,s),s}class Cg extends cc{acquireContext(t,n){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(mg(t,n),i):null}releaseContext(t){const n=t.canvas;if(!n[Ui])return!1;const i=n[Ui].initial;["height","width"].forEach(o=>{const r=i[o];J(r)?n.removeAttribute(o):n.setAttribute(o,r)});const s=i.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[Ui],!0}addEventListener(t,n,i){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),r={attach:xg,detach:yg,resize:Sg}[n]||Mg;s[n]=r(t,n,i)}removeEventListener(t,n){const i=t.$proxies||(t.$proxies={}),s=i[n];if(!s)return;({attach:Os,detach:Os,resize:Os}[n]||_g)(t,n,s),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,i,s){return hf(t,n,i,s)}isAttached(t){const n=t&&zo(t);return!!(n&&n.isConnected)}}function Pg(e){return!Fo()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?gg:Cg}let Ne=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}hasValue(){return Bn(this.x)&&Bn(this.y)}getProps(t,n){const i=this.$animations;if(!n||!i)return this;const s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}};function Ag(e,t){const n=e.options.ticks,i=Tg(e),s=Math.min(n.maxTicksLimit||i,i),o=n.major.enabled?Og(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return Eg(t,c,o,r/s),c;const h=Dg(o,t,s);if(r>0){let u,d;const f=r>1?Math.round((l-a)/(r-1)):null;for(Ni(t,c,h,J(f)?0:a-f,a),u=0,d=r-1;u<d;u++)Ni(t,c,h,o[u],o[u+1]);return Ni(t,c,h,l,J(f)?t.length:l+f),c}return Ni(t,c,h),c}function Tg(e){const t=e.options.offset,n=e._tickSize(),i=e._length/n+(t?0:1),s=e._maxLength/n;return Math.floor(Math.min(i,s))}function Dg(e,t,n){const i=Lg(e),s=t.length/n;if(!i)return Math.max(s,1);const o=dd(i);for(let r=0,a=o.length-1;r<a;r++){const l=o[r];if(l>s)return l}return Math.max(s,1)}function Og(e){const t=[];let n,i;for(n=0,i=e.length;n<i;n++)e[n].major&&t.push(n);return t}function Eg(e,t,n,i){let s=0,o=n[0],r;for(i=Math.ceil(i),r=0;r<e.length;r++)r===o&&(t.push(e[r]),s++,o=n[s*i])}function Ni(e,t,n,i,s){const o=U(i,0),r=Math.min(U(s,e.length),e.length);let a=0,l,c,h;for(n=Math.ceil(n),s&&(l=s-i,n=l/Math.floor(l/n)),h=o;h<0;)a++,h=Math.round(o+a*n);for(c=Math.max(o,0);c<r;c++)c===h&&(t.push(e[c]),a++,h=Math.round(o+a*n))}function Lg(e){const t=e.length;let n,i;if(t<2)return!1;for(i=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==i)return!1;return i}const Rg=e=>e==="left"?"right":e==="right"?"left":e,Xr=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,qr=(e,t)=>Math.min(t||e,e);function Kr(e,t){const n=[],i=e.length/t,s=e.length;let o=0;for(;o<s;o+=i)n.push(e[Math.floor(o)]);return n}function Ig(e,t,n){const i=e.ticks.length,s=Math.min(t,i-1),o=e._startPixel,r=e._endPixel,a=1e-6;let l=e.getPixelForTick(s),c;if(!(n&&(i===1?c=Math.max(l-o,r-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-a||l>r+a)))return l}function Fg(e,t){at(e,n=>{const i=n.gc,s=i.length/2;let o;if(s>t){for(o=0;o<s;++o)delete n.data[i[o]];i.splice(0,s)}})}function Zn(e){return e.drawTicks?e.tickLength:0}function Gr(e,t){if(!e.display)return 0;const n=At(e.font,t),i=Wt(e.padding);return(mt(e.text)?e.text.length:1)*n.lineHeight+i.height}function zg(e,t){return tn(e,{scale:t,type:"scale"})}function Ng(e,t,n){return tn(e,{tick:n,index:t,type:"tick"})}function Bg(e,t,n){let i=Do(e);return(n&&t!=="right"||!n&&t==="right")&&(i=Rg(i)),i}function Vg(e,t,n,i){const{top:s,left:o,bottom:r,right:a,chart:l}=e,{chartArea:c,scales:h}=l;let u=0,d,f,p;const m=r-s,v=a-o;if(e.isHorizontal()){if(f=Ft(i,o,a),Q(n)){const _=Object.keys(n)[0],b=n[_];p=h[_].getPixelForValue(b)+m-t}else n==="center"?p=(c.bottom+c.top)/2+m-t:p=Xr(e,n,t);d=a-o}else{if(Q(n)){const _=Object.keys(n)[0],b=n[_];f=h[_].getPixelForValue(b)-v+t}else n==="center"?f=(c.left+c.right)/2-v+t:f=Xr(e,n,t);p=Ft(i,r,s),u=n==="left"?-Ct:Ct}return{titleX:f,titleY:p,maxWidth:d,rotation:u}}class Cn extends Ne{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:i,_suggestedMax:s}=this;return t=Gt(t,Number.POSITIVE_INFINITY),n=Gt(n,Number.NEGATIVE_INFINITY),i=Gt(i,Number.POSITIVE_INFINITY),s=Gt(s,Number.NEGATIVE_INFINITY),{min:Gt(t,i),max:Gt(n,s),minDefined:kt(t),maxDefined:kt(n)}}getMinMax(t){let{min:n,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),r;if(s&&o)return{min:n,max:i};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,t),s||(n=Math.min(n,r.min)),o||(i=Math.max(i,r.max));return n=o&&n>i?i:n,i=s&&n>i?n:i,{min:Gt(n,Gt(i,n)),max:Gt(i,Gt(n,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ht(this.options.beforeUpdate,[this])}update(t,n,i){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Wd(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Kr(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=Ag(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,i;this.isHorizontal()?(n=this.left,i=this.right):(n=this.top,i=this.bottom,t=!t),this._startPixel=n,this._endPixel=i,this._reversePixels=t,this._length=i-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ht(this.options.afterUpdate,[this])}beforeSetDimensions(){ht(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ht(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),ht(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ht(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=ht(n.callback,[o.value,i,t],this)}afterTickToLabelConversion(){ht(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ht(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,i=qr(this.ticks.length,t.ticks.maxTicksLimit),s=n.minRotation||0,o=n.maxRotation;let r=s,a,l,c;if(!this._isVisible()||!n.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,d=h.highest.height,f=Ot(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/i:f/(i-1),u+6>a&&(a=f/(i-(t.offset?.5:1)),l=this.maxHeight-Zn(t.grid)-n.padding-Gr(t.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),r=Ao(Math.min(Math.asin(Ot((h.highest.height+6)/a,-1,1)),Math.asin(Ot(l/c,-1,1))-Math.asin(Ot(d/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){ht(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ht(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:i,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=Gr(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=Zn(o)+l):(t.height=this.maxHeight,t.width=Zn(o)+l),i.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:d}=this._getLabelSizes(),f=i.padding*2,p=de(this.labelRotation),m=Math.cos(p),v=Math.sin(p);if(a){const _=i.mirror?0:v*u.width+m*d.height;t.height=Math.min(this.maxHeight,t.height+_+f)}else{const _=i.mirror?0:m*u.width+v*d.height;t.width=Math.min(this.maxWidth,t.width+_+f)}this._calculatePadding(c,h,v,m)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,i,s){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,f=0;l?c?(d=s*t.width,f=i*n.height):(d=i*t.height,f=s*n.width):o==="start"?f=n.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,f=n.width/2),this.paddingLeft=Math.max((d-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-u+r)*this.width/(this.width-u),0)}else{let h=n.height/2,u=t.height/2;o==="start"?(h=0,u=t.height):o==="end"&&(h=n.height,u=0),this.paddingTop=h+r,this.paddingBottom=u+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ht(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,i;for(n=0,i=t.length;n<i;n++)J(t[n].label)&&(t.splice(n,1),i--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let i=this.ticks;n<i.length&&(i=Kr(i,n)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,i){const{ctx:s,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(n/qr(n,i));let c=0,h=0,u,d,f,p,m,v,_,b,x,k,S;for(u=0;u<n;u+=l){if(p=t[u].label,m=this._resolveTickFontOptions(u),s.font=v=m.string,_=o[v]=o[v]||{data:{},gc:[]},b=m.lineHeight,x=k=0,!J(p)&&!mt(p))x=es(s,_.data,_.gc,x,p),k=b;else if(mt(p))for(d=0,f=p.length;d<f;++d)S=p[d],!J(S)&&!mt(S)&&(x=es(s,_.data,_.gc,x,S),k+=b);r.push(x),a.push(k),c=Math.max(x,c),h=Math.max(k,h)}Fg(o,n);const w=r.indexOf(c),C=a.indexOf(h),y=T=>({width:r[T]||0,height:a[T]||0});return{first:y(0),last:y(n-1),widest:y(w),highest:y(C),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return md(this._alignToPixels?an(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const i=n[t];return i.$context||(i.$context=Ng(this.getContext(),t,i))}return this.$context||(this.$context=zg(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=de(this.labelRotation),i=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,l=o?o.highest.height+r:0;return this.isHorizontal()?l*i>a*s?a/i:l/s:l*s<a*i?l/i:a/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,i=this.chart,s=this.options,{grid:o,position:r,border:a}=s,l=o.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),d=Zn(o),f=[],p=a.setContext(this.getContext()),m=p.display?p.width:0,v=m/2,_=function(F){return an(i,F,m)};let b,x,k,S,w,C,y,T,E,R,O,V;if(r==="top")b=_(this.bottom),C=this.bottom-d,T=b-v,R=_(t.top)+v,V=t.bottom;else if(r==="bottom")b=_(this.top),R=t.top,V=_(t.bottom)-v,C=b+v,T=this.top+d;else if(r==="left")b=_(this.right),w=this.right-d,y=b-v,E=_(t.left)+v,O=t.right;else if(r==="right")b=_(this.left),E=t.left,O=_(t.right)-v,w=b+v,y=this.left+d;else if(n==="x"){if(r==="center")b=_((t.top+t.bottom)/2+.5);else if(Q(r)){const F=Object.keys(r)[0],B=r[F];b=_(this.chart.scales[F].getPixelForValue(B))}R=t.top,V=t.bottom,C=b+v,T=C+d}else if(n==="y"){if(r==="center")b=_((t.left+t.right)/2);else if(Q(r)){const F=Object.keys(r)[0],B=r[F];b=_(this.chart.scales[F].getPixelForValue(B))}w=b-v,y=w-d,E=t.left,O=t.right}const z=U(s.ticks.maxTicksLimit,u),I=Math.max(1,Math.ceil(u/z));for(x=0;x<u;x+=I){const F=this.getContext(x),B=o.setContext(F),j=a.setContext(F),H=B.lineWidth,X=B.color,G=j.dash||[],Z=j.dashOffset,_t=B.tickWidth,ot=B.tickColor,ct=B.tickBorderDash||[],rt=B.tickBorderDashOffset;k=Ig(this,x,l),k!==void 0&&(S=an(i,k,H),c?w=y=E=O=S:C=T=R=V=S,f.push({tx1:w,ty1:C,tx2:y,ty2:T,x1:E,y1:R,x2:O,y2:V,width:H,color:X,borderDash:G,borderDashOffset:Z,tickWidth:_t,tickColor:ot,tickBorderDash:ct,tickBorderDashOffset:rt}))}return this._ticksLength=u,this._borderValue=b,f}_computeLabelItems(t){const n=this.axis,i=this.options,{position:s,ticks:o}=i,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:h,mirror:u}=o,d=Zn(i.grid),f=d+h,p=u?-h:f,m=-de(this.labelRotation),v=[];let _,b,x,k,S,w,C,y,T,E,R,O,V="middle";if(s==="top")w=this.bottom-p,C=this._getXAxisLabelAlignment();else if(s==="bottom")w=this.top+p,C=this._getXAxisLabelAlignment();else if(s==="left"){const I=this._getYAxisLabelAlignment(d);C=I.textAlign,S=I.x}else if(s==="right"){const I=this._getYAxisLabelAlignment(d);C=I.textAlign,S=I.x}else if(n==="x"){if(s==="center")w=(t.top+t.bottom)/2+f;else if(Q(s)){const I=Object.keys(s)[0],F=s[I];w=this.chart.scales[I].getPixelForValue(F)+f}C=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")S=(t.left+t.right)/2-f;else if(Q(s)){const I=Object.keys(s)[0],F=s[I];S=this.chart.scales[I].getPixelForValue(F)}C=this._getYAxisLabelAlignment(d).textAlign}n==="y"&&(l==="start"?V="top":l==="end"&&(V="bottom"));const z=this._getLabelSizes();for(_=0,b=a.length;_<b;++_){x=a[_],k=x.label;const I=o.setContext(this.getContext(_));y=this.getPixelForTick(_)+o.labelOffset,T=this._resolveTickFontOptions(_),E=T.lineHeight,R=mt(k)?k.length:1;const F=R/2,B=I.color,j=I.textStrokeColor,H=I.textStrokeWidth;let X=C;r?(S=y,C==="inner"&&(_===b-1?X=this.options.reverse?"left":"right":_===0?X=this.options.reverse?"right":"left":X="center"),s==="top"?c==="near"||m!==0?O=-R*E+E/2:c==="center"?O=-z.highest.height/2-F*E+E:O=-z.highest.height+E/2:c==="near"||m!==0?O=E/2:c==="center"?O=z.highest.height/2-F*E:O=z.highest.height-R*E,u&&(O*=-1),m!==0&&!I.showLabelBackdrop&&(S+=E/2*Math.sin(m))):(w=y,O=(1-R)*E/2);let G;if(I.showLabelBackdrop){const Z=Wt(I.backdropPadding),_t=z.heights[_],ot=z.widths[_];let ct=O-Z.top,rt=0-Z.left;switch(V){case"middle":ct-=_t/2;break;case"bottom":ct-=_t;break}switch(C){case"center":rt-=ot/2;break;case"right":rt-=ot;break;case"inner":_===b-1?rt-=ot:_>0&&(rt-=ot/2);break}G={left:rt,top:ct,width:ot+Z.width,height:_t+Z.height,color:I.backdropColor}}v.push({label:k,font:T,textOffset:O,options:{rotation:m,color:B,strokeColor:j,strokeWidth:H,textAlign:X,textBaseline:V,translation:[S,w],backdrop:G}})}return v}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-de(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width;let c,h;return n==="left"?s?(h=this.right+o,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-a,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h=this.left)):n==="right"?s?(h=this.left+o,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+a,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:i,top:s,width:o,height:r}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(i,s,o,r),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const n=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(n.display)for(o=0,r=s.length;o<r;++o){const l=s[o];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:i,grid:s}}=this,o=i.setContext(this.getContext()),r=i.display?o.width:0;if(!r)return;const a=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,h,u,d;this.isHorizontal()?(c=an(t,this.left,r)-r/2,h=an(t,this.right,a)+a/2,u=d=l):(u=an(t,this.top,r)-r/2,d=an(t,this.bottom,a)+a/2,c=h=l),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,u),n.lineTo(h,d),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&ds(i,s);const o=this.getLabelItems(t);for(const r of o){const a=r.options,l=r.font,c=r.label,h=r.textOffset;kn(i,c,0,h,l,a)}s&&fs(i)}drawTitle(){const{ctx:t,options:{position:n,title:i,reverse:s}}=this;if(!i.display)return;const o=At(i.font),r=Wt(i.padding),a=i.align;let l=o.lineHeight/2;n==="bottom"||n==="center"||Q(n)?(l+=r.bottom,mt(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=r.top;const{titleX:c,titleY:h,maxWidth:u,rotation:d}=Vg(this,l,n,a);kn(t,i.text,0,0,o,{color:i.color,maxWidth:u,rotation:d,textAlign:Bg(a,n,s),textBaseline:"middle",translation:[c,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,i=U(t.grid&&t.grid.z,-1),s=U(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Cn.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let o,r;for(o=0,r=n.length;o<r;++o){const a=n[o];a[i]===this.id&&(!t||a.type===t)&&s.push(a)}return s}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return At(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Bi{constructor(t,n,i){this.type=t,this.scope=n,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let i;jg(n)&&(i=this.register(n));const s=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,Wg(t,r,i),this.override&&vt.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const n=this.items,i=t.id,s=this.scope;i in n&&delete n[i],s&&i in vt[s]&&(delete vt[s][i],this.override&&delete wn[i])}}function Wg(e,t,n){const i=pi(Object.create(null),[n?vt.get(n):{},vt.get(t),e.defaults]);vt.set(t,i),e.defaultRoutes&&Hg(t,e.defaultRoutes),e.descriptors&&vt.describe(t,e.descriptors)}function Hg(e,t){Object.keys(t).forEach(n=>{const i=n.split("."),s=i.pop(),o=[e].concat(i).join("."),r=t[n].split("."),a=r.pop(),l=r.join(".");vt.route(o,s,l,a)})}function jg(e){return"id"in e&&"defaults"in e}class $g{constructor(){this.controllers=new Bi(en,"datasets",!0),this.elements=new Bi(Ne,"elements"),this.plugins=new Bi(Object,"plugins"),this.scales=new Bi(Cn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,i){[...n].forEach(s=>{const o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):at(s,r=>{const a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,n,i){const s=Po(t);ht(i["before"+s],[],i),n[t](i),ht(i["after"+s],[],i)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const i=this._typedRegistries[n];if(i.isForType(t))return i}return this.plugins}_get(t,n,i){const s=n.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var pe=new $g;class Yg{constructor(){this._init=void 0}notify(t,n,i,s){if(n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;const o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,n,i);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),r}_notify(t,n,i,s){s=s||{};for(const o of t){const r=o.plugin,a=r[i],l=[n,s,o.options];if(ht(a,l,r)===!1&&s.cancelable)return!1}return!0}invalidate(){J(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const i=t&&t.config,s=U(i.options&&i.options.plugins,{}),o=Ug(i);return s===!1&&!n?[]:qg(t,o,s,n)}_notifyStateChanges(t){const n=this._oldCache||[],i=this._cache,s=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,i),t,"stop"),this._notify(s(i,n),t,"start")}}function Ug(e){const t={},n=[],i=Object.keys(pe.plugins.items);for(let o=0;o<i.length;o++)n.push(pe.getPlugin(i[o]));const s=e.plugins||[];for(let o=0;o<s.length;o++){const r=s[o];n.indexOf(r)===-1&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}function Xg(e,t){return!t&&e===!1?null:e===!0?{}:e}function qg(e,{plugins:t,localIds:n},i,s){const o=[],r=e.getContext();for(const a of t){const l=a.id,c=Xg(i[l],s);c!==null&&o.push({plugin:a,options:Kg(e.config,{plugin:a,local:n[l]},c,r)})}return o}function Kg(e,{plugin:t,local:n},i,s){const o=e.pluginScopeKeys(t),r=e.getOptionScopes(i,o);return n&&t.defaults&&r.push(t.defaults),e.createResolver(r,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function eo(e,t){const n=vt.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function Gg(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function Jg(e,t){return e===t?"_index_":"_value_"}function Jr(e){if(e==="x"||e==="y"||e==="r")return e}function Zg(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function no(e,...t){if(Jr(e))return e;for(const n of t){const i=n.axis||Zg(n.position)||e.length>1&&Jr(e[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Zr(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function Qg(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(i=>i.xAxisID===e||i.yAxisID===e);if(n.length)return Zr(e,"x",n[0])||Zr(e,"y",n[0])}return{}}function tp(e,t){const n=wn[e.type]||{scales:{}},i=t.scales||{},s=eo(e.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!Q(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const l=no(r,a,Qg(r,e),vt.scales[a.type]),c=Jg(l,s),h=n.scales||{};o[r]=li(Object.create(null),[{axis:l},a,h[l],h[c]])}),e.data.datasets.forEach(r=>{const a=r.type||e.type,l=r.indexAxis||eo(a,t),h=(wn[a]||{}).scales||{};Object.keys(h).forEach(u=>{const d=Gg(u,l),f=r[d+"AxisID"]||d;o[f]=o[f]||Object.create(null),li(o[f],[{axis:d},i[f],h[u]])})}),Object.keys(o).forEach(r=>{const a=o[r];li(a,[vt.scales[a.type],vt.scale])}),o}function dc(e){const t=e.options||(e.options={});t.plugins=U(t.plugins,{}),t.scales=tp(e,t)}function fc(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function ep(e){return e=e||{},e.data=fc(e.data),dc(e),e}const Qr=new Map,gc=new Set;function Vi(e,t){let n=Qr.get(e);return n||(n=t(),Qr.set(e,n),gc.add(n)),n}const Qn=(e,t,n)=>{const i=Je(t,n);i!==void 0&&e.add(i)};class np{constructor(t){this._config=ep(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=fc(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),dc(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Vi(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Vi(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Vi(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,i=this.type;return Vi(`${i}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const i=this._scopeCache;let s=i.get(t);return(!s||n)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,n,i){const{options:s,type:o}=this,r=this._cachedScopes(t,i),a=r.get(n);if(a)return a;const l=new Set;n.forEach(h=>{t&&(l.add(t),h.forEach(u=>Qn(l,t,u))),h.forEach(u=>Qn(l,s,u)),h.forEach(u=>Qn(l,wn[o]||{},u)),h.forEach(u=>Qn(l,vt,u)),h.forEach(u=>Qn(l,Qs,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),gc.has(n)&&r.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,wn[n]||{},vt.datasets[n]||{},{type:n},vt,Qs]}resolveNamedOptions(t,n,i,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=ta(this._resolverCache,t,s);let l=r;if(sp(r,n)){o.$shared=!1,i=Ze(i)?i():i;const c=this.createResolver(t,i,a);l=Vn(r,i,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,i=[""],s){const{resolver:o}=ta(this._resolverCache,t,i);return Q(n)?Vn(o,n,void 0,s):o}}function ta(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));const s=n.join();let o=i.get(s);return o||(o={resolver:Lo(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,o)),o}const ip=e=>Q(e)&&Object.getOwnPropertyNames(e).some(t=>Ze(e[t]));function sp(e,t){const{isScriptable:n,isIndexable:i}=Yl(e);for(const s of t){const o=n(s),r=i(s),a=(r||o)&&e[s];if(o&&(Ze(a)||ip(a))||r&&mt(a))return!0}return!1}var op="4.5.1";const rp=["top","bottom","left","right","chartArea"];function ea(e,t){return e==="top"||e==="bottom"||rp.indexOf(e)===-1&&t==="x"}function na(e,t){return function(n,i){return n[e]===i[e]?n[t]-i[t]:n[e]-i[e]}}function ia(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),ht(n&&n.onComplete,[e],t)}function ap(e){const t=e.chart,n=t.options.animation;ht(n&&n.onProgress,[e],t)}function pc(e){return Fo()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Xi={},sa=e=>{const t=pc(e);return Object.values(Xi).filter(n=>n.canvas===t).pop()};function lp(e,t,n){const i=Object.keys(e);for(const s of i){const o=+s;if(o>=t){const r=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=r)}}}function cp(e,t,n,i){return!n||e.type==="mouseout"?null:i?t:e}class Vo{static defaults=vt;static instances=Xi;static overrides=wn;static registry=pe;static version=op;static getChart=sa;static register(...t){pe.add(...t),oa()}static unregister(...t){pe.remove(...t),oa()}constructor(t,n){const i=this.config=new np(n),s=pc(t),o=sa(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Pg(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=id(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Yg,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=xd(u=>this.update(u),r.resizeDelay||0),this._dataChanges=[],Xi[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Se.listen(this,"complete",ia),Se.listen(this,"progress",ap),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:i,height:s,_aspectRatio:o}=this;return J(t)?n&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return pe}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Pr(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Sr(this.canvas,this.ctx),this}stop(){return Se.stop(this),this}resize(t,n){Se.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,n,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,Pr(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),ht(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};at(n,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,n=t.scales,i=this.scales,s=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{});let o=[];n&&(o=o.concat(Object.keys(n).map(r=>{const a=n[r],l=no(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),at(o,r=>{const a=r.options,l=a.id,c=no(l,a),h=U(a.type,r.dtype);(a.position===void 0||ea(a.position,c)!==ea(r.dposition))&&(a.position=r.dposition),s[l]=!0;let u=null;if(l in i&&i[l].type===h)u=i[l];else{const d=pe.getScale(h);u=new d({id:l,type:h,ctx:this.ctx,chart:this}),i[u.id]=u}u.init(a,t)}),at(s,(r,a)=>{r||delete i[a]}),at(i,r=>{Vt.configure(this,r,r.options),Vt.addBox(this,r)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>n){for(let s=n;s<i;++s)this._destroyDatasetMeta(s);t.splice(n,i-n)}this._sortedMetasets=t.slice(0).sort(na("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((i,s)=>{n.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=n.length;i<s;i++){const o=n[i];let r=this.getDatasetMeta(i);const a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(i),r=this.getDatasetMeta(i)),r.type=a,r.indexAxis=o.indexAxis||eo(a,this.options),r.order=o.order||0,r.index=i,r.label=""+o.label,r.visible=this.isDatasetVisible(i),r.controller)r.controller.updateIndex(i),r.controller.linkScales();else{const l=pe.getController(a),{datasetElementType:c,dataElementType:h}=vt.datasets[a];Object.assign(l,{dataElementType:pe.getElement(h),datasetElementType:c&&pe.getElement(c)}),r.controller=new l(this,i),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){at(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const i=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,h=this.data.datasets.length;c<h;c++){const{controller:u}=this.getDatasetMeta(c),d=!s&&o.indexOf(u)===-1;u.buildOrUpdateElements(d),r=Math.max(+u.getMaxOverflow(),r)}r=this._minPadding=i.layout.autoPadding?r:0,this._updateLayout(r),s||at(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(na("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){at(this.scales,t=>{Vt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!pr(n,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:o}of n){const r=i==="_removeElements"?-o:o;lp(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,i=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=i(0);for(let o=1;o<n;o++)if(!pr(s,i(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Vt.update(this,this.width,this.height,t);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],at(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,i=this.data.datasets.length;n<i;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,i=this.data.datasets.length;n<i;++n)this._updateDataset(n,Ze(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(n),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Se.has(this)?this.attached&&!Se.running(this)&&Se.start(this):(this.draw(),ia({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,i=[];let s,o;for(s=0,o=n.length;s<o;++s){const r=n[s];(!t||r.visible)&&i.push(r)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=nc(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&ds(n,s),t.controller.draw(),s&&fs(n),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return Oe(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,i,s){const o=rg.modes[n];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){const n=this.data.datasets[t],i=this._metasets;let s=i.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=tn(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!n.hidden}setDatasetVisibility(t,n){const i=this.getDatasetMeta(t);i.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,i){const s=i?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);mi(n)?(o.data[n].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),Se.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Sr(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Xi[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,i=(o,r)=>{n.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};at(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,i=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",a)},n.isAttached(this.canvas)?a():r()}unbindEvents(){at(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},at(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,i){const s=i?"set":"remove";let o,r,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){r=t[a];const c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[s+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],i=t.map(({datasetIndex:o,index:r})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Zi(i,n)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,n))}notifyPlugins(t,n,i){return this._plugins.notify(this,t,n,i)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,i){const s=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),r=o(n,t),a=i?t:o(t,n);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,n){const i={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const o=this._handleEvent(t,n,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,n,i){const{_active:s=[],options:o}=this,r=n,a=this._getActiveElements(t,s,i,r),l=cd(t),c=cp(t,this._lastEvent,i,l);i&&(this._lastEvent=null,ht(o.onHover,[t,a,this],this),l&&ht(o.onClick,[t,a,this],this));const h=!Zi(a,s);return(h||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=c,h}_getActiveElements(t,n,i,s){if(t.type==="mouseout")return[];if(!i)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}function oa(){return at(Vo.instances,e=>e._plugins.invalidate())}function hp(e,t,n){const{startAngle:i,x:s,y:o,outerRadius:r,innerRadius:a,options:l}=t,{borderWidth:c,borderJoinStyle:h}=l,u=Math.min(c/r,zt(i-n));if(e.beginPath(),e.arc(s,o,r-c/2,i+u/2,n-u/2),a>0){const d=Math.min(c/a,zt(i-n));e.arc(s,o,a+c/2,n-d/2,i+d/2,!0)}else{const d=Math.min(c/2,r*zt(i-n));if(h==="round")e.arc(s,o,d,n-nt/2,i+nt/2,!0);else if(h==="bevel"){const f=2*d*d,p=-f*Math.cos(n+nt/2)+s,m=-f*Math.sin(n+nt/2)+o,v=f*Math.cos(i+nt/2)+s,_=f*Math.sin(i+nt/2)+o;e.lineTo(p,m),e.lineTo(v,_)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function up(e,t,n){const{startAngle:i,pixelMargin:s,x:o,y:r,outerRadius:a,innerRadius:l}=t;let c=s/a;e.beginPath(),e.arc(o,r,a,i-c,n+c),l>s?(c=s/l,e.arc(o,r,l,n+c,i-c,!0)):e.arc(o,r,s,n+Ct,i-Ct),e.closePath(),e.clip()}function dp(e){return Eo(e,["outerStart","outerEnd","innerStart","innerEnd"])}function fp(e,t,n,i){const s=dp(e.options.borderRadius),o=(n-t)/2,r=Math.min(o,i*t/2),a=l=>{const c=(n-Math.min(o,l))*i/2;return Ot(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:Ot(s.innerStart,0,r),innerEnd:Ot(s.innerEnd,0,r)}}function Tn(e,t,n,i){return{x:n+e*Math.cos(t),y:i+e*Math.sin(t)}}function ss(e,t,n,i,s,o){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,u=Math.max(t.outerRadius+i+n-c,0),d=h>0?h+i+n+c:0;let f=0;const p=s-l;if(i){const I=h>0?h-i:0,F=u>0?u-i:0,B=(I+F)/2,j=B!==0?p*B/(B+i):p;f=(p-j)/2}const m=Math.max(.001,p*u-n/nt)/u,v=(p-m)/2,_=l+v+f,b=s-v-f,{outerStart:x,outerEnd:k,innerStart:S,innerEnd:w}=fp(t,d,u,b-_),C=u-x,y=u-k,T=_+x/C,E=b-k/y,R=d+S,O=d+w,V=_+S/R,z=b-w/O;if(e.beginPath(),o){const I=(T+E)/2;if(e.arc(r,a,u,T,I),e.arc(r,a,u,I,E),k>0){const H=Tn(y,E,r,a);e.arc(H.x,H.y,k,E,b+Ct)}const F=Tn(O,b,r,a);if(e.lineTo(F.x,F.y),w>0){const H=Tn(O,z,r,a);e.arc(H.x,H.y,w,b+Ct,z+Math.PI)}const B=(b-w/d+(_+S/d))/2;if(e.arc(r,a,d,b-w/d,B,!0),e.arc(r,a,d,B,_+S/d,!0),S>0){const H=Tn(R,V,r,a);e.arc(H.x,H.y,S,V+Math.PI,_-Ct)}const j=Tn(C,_,r,a);if(e.lineTo(j.x,j.y),x>0){const H=Tn(C,T,r,a);e.arc(H.x,H.y,x,_-Ct,T)}}else{e.moveTo(r,a);const I=Math.cos(T)*u+r,F=Math.sin(T)*u+a;e.lineTo(I,F);const B=Math.cos(E)*u+r,j=Math.sin(E)*u+a;e.lineTo(B,j)}e.closePath()}function gp(e,t,n,i,s){const{fullCircles:o,startAngle:r,circumference:a}=t;let l=t.endAngle;if(o){ss(e,t,n,i,l,s);for(let c=0;c<o;++c)e.fill();isNaN(a)||(l=r+(a%ft||ft))}return ss(e,t,n,i,l,s),e.fill(),l}function pp(e,t,n,i,s){const{fullCircles:o,startAngle:r,circumference:a,options:l}=t,{borderWidth:c,borderJoinStyle:h,borderDash:u,borderDashOffset:d,borderRadius:f}=l,p=l.borderAlign==="inner";if(!c)return;e.setLineDash(u||[]),e.lineDashOffset=d,p?(e.lineWidth=c*2,e.lineJoin=h||"round"):(e.lineWidth=c,e.lineJoin=h||"bevel");let m=t.endAngle;if(o){ss(e,t,n,i,m,s);for(let v=0;v<o;++v)e.stroke();isNaN(a)||(m=r+(a%ft||ft))}p&&up(e,t,m),l.selfJoin&&m-r>=nt&&f===0&&h!=="miter"&&hp(e,t,m),o||(ss(e,t,n,i,m,s),e.stroke())}class mp extends Ne{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,n,i){const s=this.getProps(["x","y"],i),{angle:o,distance:r}=Il(s,{x:t,y:n}),{startAngle:a,endAngle:l,innerRadius:c,outerRadius:h,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=(this.options.spacing+this.options.borderWidth)/2,f=U(u,l-a),p=vi(o,a,l)&&a!==l,m=f>=ft||p,v=Te(r,c+d,h+d);return m&&v}getCenterPoint(t){const{x:n,y:i,startAngle:s,endAngle:o,innerRadius:r,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:c}=this.options,h=(s+o)/2,u=(r+a+c+l)/2;return{x:n+Math.cos(h)*u,y:i+Math.sin(h)*u}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:n,circumference:i}=this,s=(n.offset||0)/4,o=(n.spacing||0)/2,r=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=i>ft?Math.floor(i/ft):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const a=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(a)*s,Math.sin(a)*s);const l=1-Math.sin(Math.min(nt,i||0)),c=s*l;t.fillStyle=n.backgroundColor,t.strokeStyle=n.borderColor,gp(t,this,c,o,r),pp(t,this,c,o,r),t.restore()}}function mc(e,t,n=t){e.lineCap=U(n.borderCapStyle,t.borderCapStyle),e.setLineDash(U(n.borderDash,t.borderDash)),e.lineDashOffset=U(n.borderDashOffset,t.borderDashOffset),e.lineJoin=U(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=U(n.borderWidth,t.borderWidth),e.strokeStyle=U(n.borderColor,t.borderColor)}function vp(e,t,n){e.lineTo(n.x,n.y)}function _p(e){return e.stepped?Ed:e.tension||e.cubicInterpolationMode==="monotone"?Ld:vp}function vc(e,t,n={}){const i=e.length,{start:s=0,end:o=i-1}=n,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),h=s<r&&o<r||s>a&&o>a;return{count:i,start:l,loop:t.loop,ilen:c<l&&!h?i+c-l:c-l}}function bp(e,t,n,i){const{points:s,options:o}=t,{count:r,start:a,loop:l,ilen:c}=vc(s,n,i),h=_p(o);let{move:u=!0,reverse:d}=i||{},f,p,m;for(f=0;f<=c;++f)p=s[(a+(d?c-f:f))%r],!p.skip&&(u?(e.moveTo(p.x,p.y),u=!1):h(e,m,p,d,o.stepped),m=p);return l&&(p=s[(a+(d?c:0))%r],h(e,m,p,d,o.stepped)),!!l}function xp(e,t,n,i){const s=t.points,{count:o,start:r,ilen:a}=vc(s,n,i),{move:l=!0,reverse:c}=i||{};let h=0,u=0,d,f,p,m,v,_;const b=k=>(r+(c?a-k:k))%o,x=()=>{m!==v&&(e.lineTo(h,v),e.lineTo(h,m),e.lineTo(h,_))};for(l&&(f=s[b(0)],e.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=s[b(d)],f.skip)continue;const k=f.x,S=f.y,w=k|0;w===p?(S<m?m=S:S>v&&(v=S),h=(u*h+k)/++u):(x(),e.lineTo(k,S),p=w,u=0,m=v=S),_=S}x()}function io(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?xp:bp}function yp(e){return e.stepped?df:e.tension||e.cubicInterpolationMode==="monotone"?ff:un}function wp(e,t,n,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,n,i)&&s.closePath()),mc(e,t.options),e.stroke(s)}function kp(e,t,n,i){const{segments:s,options:o}=t,r=io(t);for(const a of s)mc(e,o,a.style),e.beginPath(),r(e,t,a,{start:n,end:n+i-1})&&e.closePath(),e.stroke()}const Sp=typeof Path2D=="function";function Mp(e,t,n,i){Sp&&!t.options.segment?wp(e,t,n,i):kp(e,t,n,i)}class ms extends Ne{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;sf(this._points,i,t,s,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=bf(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,i=t.length;return i&&n[t[i-1].end]}interpolate(t,n){const i=this.options,s=t[n],o=this.points,r=ec(this,{property:n,start:s,end:s});if(!r.length)return;const a=[],l=yp(i);let c,h;for(c=0,h=r.length;c<h;++c){const{start:u,end:d}=r[c],f=o[u],p=o[d];if(f===p){a.push(f);continue}const m=Math.abs((s-f[n])/(p[n]-f[n])),v=l(f,p,m,i.stepped);v[n]=t[n],a.push(v)}return a.length===1?a[0]:a}pathSegment(t,n,i){return io(this)(t,this,n,i)}path(t,n,i){const s=this.segments,o=io(this);let r=this._loop;n=n||0,i=i||this.points.length-n;for(const a of s)r&=o(t,this,a,{start:n,end:n+i-1});return!!r}draw(t,n,i,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Mp(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function ra(e,t,n,i){const s=e.options,{[n]:o}=e.getProps([n],i);return Math.abs(t-o)<s.radius+s.hitRadius}class Cp extends Ne{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,n,i){const s=this.options,{x:o,y:r}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(n-r,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,n){return ra(this,t,"x",n)}inYRange(t,n){return ra(this,t,"y",n)}getCenterPoint(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}size(t){t=t||this.options||{};let n=t.radius||0;n=Math.max(n,n&&t.hoverRadius||0);const i=n&&t.borderWidth||0;return(n+i)*2}draw(t,n){const i=this.options;this.skip||i.radius<.1||!Oe(this,n,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,to(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function _c(e,t){const{x:n,y:i,base:s,width:o,height:r}=e.getProps(["x","y","base","width","height"],t);let a,l,c,h,u;return e.horizontal?(u=r/2,a=Math.min(n,s),l=Math.max(n,s),c=i-u,h=i+u):(u=o/2,a=n-u,l=n+u,c=Math.min(i,s),h=Math.max(i,s)),{left:a,top:c,right:l,bottom:h}}function Ye(e,t,n,i){return e?0:Ot(t,n,i)}function Pp(e,t,n){const i=e.options.borderWidth,s=e.borderSkipped,o=$l(i);return{t:Ye(s.top,o.top,0,n),r:Ye(s.right,o.right,0,t),b:Ye(s.bottom,o.bottom,0,n),l:Ye(s.left,o.left,0,t)}}function Ap(e,t,n){const{enableBorderRadius:i}=e.getProps(["enableBorderRadius"]),s=e.options.borderRadius,o=vn(s),r=Math.min(t,n),a=e.borderSkipped,l=i||Q(s);return{topLeft:Ye(!l||a.top||a.left,o.topLeft,0,r),topRight:Ye(!l||a.top||a.right,o.topRight,0,r),bottomLeft:Ye(!l||a.bottom||a.left,o.bottomLeft,0,r),bottomRight:Ye(!l||a.bottom||a.right,o.bottomRight,0,r)}}function Tp(e){const t=_c(e),n=t.right-t.left,i=t.bottom-t.top,s=Pp(e,n/2,i/2),o=Ap(e,n/2,i/2);return{outer:{x:t.left,y:t.top,w:n,h:i,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:n-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function Es(e,t,n,i){const s=t===null,o=n===null,a=e&&!(s&&o)&&_c(e,i);return a&&(s||Te(t,a.left,a.right))&&(o||Te(n,a.top,a.bottom))}function Dp(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function Op(e,t){e.rect(t.x,t.y,t.w,t.h)}function Ls(e,t,n={}){const i=e.x!==n.x?-t:0,s=e.y!==n.y?-t:0,o=(e.x+e.w!==n.x+n.w?t:0)-i,r=(e.y+e.h!==n.y+n.h?t:0)-s;return{x:e.x+i,y:e.y+s,w:e.w+o,h:e.h+r,radius:e.radius}}class Ep extends Ne{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:n,options:{borderColor:i,backgroundColor:s}}=this,{inner:o,outer:r}=Tp(this),a=Dp(r.radius)?_i:Op;t.save(),(r.w!==o.w||r.h!==o.h)&&(t.beginPath(),a(t,Ls(r,n,o)),t.clip(),a(t,Ls(o,-n,r)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),a(t,Ls(o,n)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,n,i){return Es(this,t,n,i)}inXRange(t,n){return Es(this,t,null,n)}inYRange(t,n){return Es(this,null,t,n)}getCenterPoint(t){const{x:n,y:i,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(n+s)/2:n,y:o?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}var Lp=Object.freeze({__proto__:null,ArcElement:mp,BarElement:Ep,LineElement:ms,PointElement:Cp});const so=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],aa=so.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function bc(e){return so[e%so.length]}function xc(e){return aa[e%aa.length]}function Rp(e,t){return e.borderColor=bc(t),e.backgroundColor=xc(t),++t}function Ip(e,t){return e.backgroundColor=e.data.map(()=>bc(t++)),t}function Fp(e,t){return e.backgroundColor=e.data.map(()=>xc(t++)),t}function zp(e){let t=0;return(n,i)=>{const s=e.getDatasetMeta(i).controller;s instanceof No?t=Ip(n,t):s instanceof rc?t=Fp(n,t):s&&(t=Rp(n,t))}}function la(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function Np(e){return e&&(e.borderColor||e.backgroundColor)}function Bp(){return vt.borderColor!=="rgba(0,0,0,0.1)"||vt.backgroundColor!=="rgba(0,0,0,0.1)"}var Vp={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,n){if(!n.enabled)return;const{data:{datasets:i},options:s}=e.config,{elements:o}=s,r=la(i)||Np(s)||o&&la(o)||Bp();if(!n.forceOverride&&r)return;const a=zp(e);i.forEach(a)}};function Wp(e,t,n,i,s){const o=s.samples||i;if(o>=n)return e.slice(t,t+n);const r=[],a=(n-2)/(o-2);let l=0;const c=t+n-1;let h=t,u,d,f,p,m;for(r[l++]=e[h],u=0;u<o-2;u++){let v=0,_=0,b;const x=Math.floor((u+1)*a)+1+t,k=Math.min(Math.floor((u+2)*a)+1,n)+t,S=k-x;for(b=x;b<k;b++)v+=e[b].x,_+=e[b].y;v/=S,_/=S;const w=Math.floor(u*a)+1+t,C=Math.min(Math.floor((u+1)*a)+1,n)+t,{x:y,y:T}=e[h];for(f=p=-1,b=w;b<C;b++)p=.5*Math.abs((y-v)*(e[b].y-T)-(y-e[b].x)*(_-T)),p>f&&(f=p,d=e[b],m=b);r[l++]=d,h=m}return r[l++]=e[c],r}function Hp(e,t,n,i){let s=0,o=0,r,a,l,c,h,u,d,f,p,m;const v=[],_=t+n-1,b=e[t].x,k=e[_].x-b;for(r=t;r<t+n;++r){a=e[r],l=(a.x-b)/k*i,c=a.y;const S=l|0;if(S===h)c<p?(p=c,u=r):c>m&&(m=c,d=r),s=(o*s+a.x)/++o;else{const w=r-1;if(!J(u)&&!J(d)){const C=Math.min(u,d),y=Math.max(u,d);C!==f&&C!==w&&v.push({...e[C],x:s}),y!==f&&y!==w&&v.push({...e[y],x:s})}r>0&&w!==f&&v.push(e[w]),v.push(a),h=S,o=0,p=m=c,u=d=f=r}}return v}function yc(e){if(e._decimated){const t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function ca(e){e.data.datasets.forEach(t=>{yc(t)})}function jp(e,t){const n=t.length;let i=0,s;const{iScale:o}=e,{min:r,max:a,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(i=Ot(De(t,o.axis,r).lo,0,n-1)),c?s=Ot(De(t,o.axis,a).hi+1,i,n)-i:s=n-i,{start:i,count:s}}var $p={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,t,n)=>{if(!n.enabled){ca(e);return}const i=e.width;e.data.datasets.forEach((s,o)=>{const{_data:r,indexAxis:a}=s,l=e.getDatasetMeta(o),c=r||s.data;if(ii([a,e.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const h=e.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||e.options.parsing)return;let{start:u,count:d}=jp(l,c);const f=n.threshold||4*i;if(d<=f){yc(s);return}J(r)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(m){this._data=m}}));let p;switch(n.algorithm){case"lttb":p=Wp(c,u,d,i,n);break;case"min-max":p=Hp(c,u,d,i);break;default:throw new Error(`Unsupported decimation algorithm '${n.algorithm}'`)}s._decimated=p})},destroy(e){ca(e)}};function Yp(e,t,n){const i=e.segments,s=e.points,o=t.points,r=[];for(const a of i){let{start:l,end:c}=a;c=vs(l,c,s);const h=oo(n,s[l],s[c],a.loop);if(!t.segments){r.push({source:a,target:h,start:s[l],end:s[c]});continue}const u=ec(t,h);for(const d of u){const f=oo(n,o[d.start],o[d.end],d.loop),p=tc(a,s,f);for(const m of p)r.push({source:m,target:d,start:{[n]:ha(h,f,"start",Math.max)},end:{[n]:ha(h,f,"end",Math.min)}})}}return r}function oo(e,t,n,i){if(i)return;let s=t[e],o=n[e];return e==="angle"&&(s=zt(s),o=zt(o)),{property:e,start:s,end:o}}function Up(e,t){const{x:n=null,y:i=null}=e||{},s=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=vs(r,a,s);const l=s[r],c=s[a];i!==null?(o.push({x:l.x,y:i}),o.push({x:c.x,y:i})):n!==null&&(o.push({x:n,y:l.y}),o.push({x:n,y:c.y}))}),o}function vs(e,t,n){for(;t>e;t--){const i=n[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function ha(e,t,n,i){return e&&t?i(e[n],t[n]):e?e[n]:t?t[n]:0}function wc(e,t){let n=[],i=!1;return mt(e)?(i=!0,n=e):n=Up(e,t),n.length?new ms({points:n,options:{tension:0},_loop:i,_fullLoop:i}):null}function ua(e){return e&&e.fill!==!1}function Xp(e,t,n){let s=e[t].fill;const o=[t];let r;if(!n)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!kt(s))return s;if(r=e[s],!r)return!1;if(r.visible)return s;o.push(s),s=r.fill}return!1}function qp(e,t,n){const i=Zp(e);if(Q(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return kt(s)&&Math.floor(s)===s?Kp(i[0],t,s,n):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function Kp(e,t,n,i){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=i?!1:n}function Gp(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:Q(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function Jp(e,t,n){let i;return e==="start"?i=n:e==="end"?i=t.options.reverse?t.min:t.max:Q(e)?i=e.value:i=t.getBaseValue(),i}function Zp(e){const t=e.options,n=t.fill;let i=U(n&&n.target,n);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function Qp(e){const{scale:t,index:n,line:i}=e,s=[],o=i.segments,r=i.points,a=tm(t,n);a.push(wc({x:null,y:t.bottom},i));for(let l=0;l<o.length;l++){const c=o[l];for(let h=c.start;h<=c.end;h++)em(s,r[h],a)}return new ms({points:s,options:{}})}function tm(e,t){const n=[],i=e.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){const o=i[s];if(o.index===t)break;o.hidden||n.unshift(o.dataset)}return n}function em(e,t,n){const i=[];for(let s=0;s<n.length;s++){const o=n[s],{first:r,last:a,point:l}=nm(o,t,"x");if(!(!l||r&&a)){if(r)i.unshift(l);else if(e.push(l),!a)break}}e.push(...i)}function nm(e,t,n){const i=e.interpolate(t,n);if(!i)return{};const s=i[n],o=e.segments,r=e.points;let a=!1,l=!1;for(let c=0;c<o.length;c++){const h=o[c],u=r[h.start][n],d=r[h.end][n];if(Te(s,u,d)){a=s===u,l=s===d;break}}return{first:a,last:l,point:i}}class kc{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,i){const{x:s,y:o,radius:r}=this;return n=n||{start:0,end:ft},t.arc(s,o,r,n.end,n.start,!0),!i.bounds}interpolate(t){const{x:n,y:i,radius:s}=this,o=t.angle;return{x:n+Math.cos(o)*s,y:i+Math.sin(o)*s,angle:o}}}function im(e){const{chart:t,fill:n,line:i}=e;if(kt(n))return sm(t,n);if(n==="stack")return Qp(e);if(n==="shape")return!0;const s=om(e);return s instanceof kc?s:wc(s,i)}function sm(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function om(e){return(e.scale||{}).getPointPositionForValue?am(e):rm(e)}function rm(e){const{scale:t={},fill:n}=e,i=Gp(n,t);if(kt(i)){const s=t.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function am(e){const{scale:t,fill:n}=e,i=t.options,s=t.getLabels().length,o=i.reverse?t.max:t.min,r=Jp(n,t,o),a=[];if(i.grid.circular){const l=t.getPointPositionForValue(0,o);return new kc({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(r)})}for(let l=0;l<s;++l)a.push(t.getPointPositionForValue(l,r));return a}function Rs(e,t,n){const i=im(t),{chart:s,index:o,line:r,scale:a,axis:l}=t,c=r.options,h=c.fill,u=c.backgroundColor,{above:d=u,below:f=u}=h||{},p=s.getDatasetMeta(o),m=nc(s,p);i&&r.points.length&&(ds(e,n),lm(e,{line:r,target:i,above:d,below:f,area:n,scale:a,axis:l,clip:m}),fs(e))}function lm(e,t){const{line:n,target:i,above:s,below:o,area:r,scale:a,clip:l}=t,c=n._loop?"angle":t.axis;e.save();let h=o;o!==s&&(c==="x"?(da(e,i,r.top),Is(e,{line:n,target:i,color:s,scale:a,property:c,clip:l}),e.restore(),e.save(),da(e,i,r.bottom)):c==="y"&&(fa(e,i,r.left),Is(e,{line:n,target:i,color:o,scale:a,property:c,clip:l}),e.restore(),e.save(),fa(e,i,r.right),h=s)),Is(e,{line:n,target:i,color:h,scale:a,property:c,clip:l}),e.restore()}function da(e,t,n){const{segments:i,points:s}=t;let o=!0,r=!1;e.beginPath();for(const a of i){const{start:l,end:c}=a,h=s[l],u=s[vs(l,c,s)];o?(e.moveTo(h.x,h.y),o=!1):(e.lineTo(h.x,n),e.lineTo(h.x,h.y)),r=!!t.pathSegment(e,a,{move:r}),r?e.closePath():e.lineTo(u.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function fa(e,t,n){const{segments:i,points:s}=t;let o=!0,r=!1;e.beginPath();for(const a of i){const{start:l,end:c}=a,h=s[l],u=s[vs(l,c,s)];o?(e.moveTo(h.x,h.y),o=!1):(e.lineTo(n,h.y),e.lineTo(h.x,h.y)),r=!!t.pathSegment(e,a,{move:r}),r?e.closePath():e.lineTo(n,u.y)}e.lineTo(n,t.first().y),e.closePath(),e.clip()}function Is(e,t){const{line:n,target:i,property:s,color:o,scale:r,clip:a}=t,l=Yp(n,i,s);for(const{source:c,target:h,start:u,end:d}of l){const{style:{backgroundColor:f=o}={}}=c,p=i!==!0;e.save(),e.fillStyle=f,cm(e,r,a,p&&oo(s,u,d)),e.beginPath();const m=!!n.pathSegment(e,c);let v;if(p){m?e.closePath():ga(e,i,d,s);const _=!!i.pathSegment(e,h,{move:m,reverse:!0});v=m&&_,v||ga(e,i,u,s)}e.closePath(),e.fill(v?"evenodd":"nonzero"),e.restore()}}function cm(e,t,n,i){const s=t.chart.chartArea,{property:o,start:r,end:a}=i||{};if(o==="x"||o==="y"){let l,c,h,u;o==="x"?(l=r,c=s.top,h=a,u=s.bottom):(l=s.left,c=r,h=s.right,u=a),e.beginPath(),n&&(l=Math.max(l,n.left),h=Math.min(h,n.right),c=Math.max(c,n.top),u=Math.min(u,n.bottom)),e.rect(l,c,h-l,u-c),e.clip()}}function ga(e,t,n,i){const s=t.interpolate(n,i);s&&e.lineTo(s.x,s.y)}var hm={id:"filler",afterDatasetsUpdate(e,t,n){const i=(e.data.datasets||[]).length,s=[];let o,r,a,l;for(r=0;r<i;++r)o=e.getDatasetMeta(r),a=o.dataset,l=null,a&&a.options&&a instanceof ms&&(l={visible:e.isDatasetVisible(r),index:r,fill:qp(a,r,i),chart:e,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=l,s.push(l);for(r=0;r<i;++r)l=s[r],!(!l||l.fill===!1)&&(l.fill=Xp(s,r,n.propagate))},beforeDraw(e,t,n){const i=n.drawTime==="beforeDraw",s=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let r=s.length-1;r>=0;--r){const a=s[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),i&&a.fill&&Rs(e.ctx,a,o))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const i=e.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const o=i[s].$filler;ua(o)&&Rs(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,t,n){const i=t.meta.$filler;!ua(i)||n.drawTime!=="beforeDatasetDraw"||Rs(e.ctx,i,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const pa=(e,t)=>{let{boxHeight:n=t,boxWidth:i=t}=e;return e.usePointStyle&&(n=Math.min(n,t),i=e.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:n,itemHeight:Math.max(t,n)}},um=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class ma extends Ne{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,i){this.maxWidth=t,this.maxHeight=n,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=ht(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(i=>t.filter(i,this.chart.data))),t.sort&&(n=n.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=At(i.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=pa(i,o);let c,h;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,n,i,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=s+a;let u=t;o.textAlign="left",o.textBaseline="middle";let d=-1,f=-h;return this.legendItems.forEach((p,m)=>{const v=i+n/2+o.measureText(p.text).width;(m===0||c[c.length-1]+v+2*a>r)&&(u+=h,c[c.length-(m>0?0:1)]=0,f+=h,d++),l[m]={left:0,top:f,row:d,width:v,height:s},c[c.length-1]+=v+a}),u}_fitCols(t,n,i,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=r-t;let u=a,d=0,f=0,p=0,m=0;return this.legendItems.forEach((v,_)=>{const{itemWidth:b,itemHeight:x}=dm(i,n,o,v,s);_>0&&f+x+2*a>h&&(u+=d+a,c.push({width:d,height:f}),p+=d+a,m++,d=f=0),l[_]={left:p,top:f,col:m,width:b,height:x},d=Math.max(d,b),f+=x+a}),u+=d,c.push({width:d,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:i,labels:{padding:s},rtl:o}}=this,r=Ln(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=Ft(i,this.left+s,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=Ft(i,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+s}else{let a=0,l=Ft(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=Ft(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;ds(t,this),this._draw(),fs(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:i,ctx:s}=this,{align:o,labels:r}=t,a=vt.color,l=Ln(t.rtl,this.left,this.width),c=At(r.font),{padding:h}=r,u=c.size,d=u/2;let f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:p,boxHeight:m,itemHeight:v}=pa(r,u),_=function(w,C,y){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;s.save();const T=U(y.lineWidth,1);if(s.fillStyle=U(y.fillStyle,a),s.lineCap=U(y.lineCap,"butt"),s.lineDashOffset=U(y.lineDashOffset,0),s.lineJoin=U(y.lineJoin,"miter"),s.lineWidth=T,s.strokeStyle=U(y.strokeStyle,a),s.setLineDash(U(y.lineDash,[])),r.usePointStyle){const E={radius:m*Math.SQRT2/2,pointStyle:y.pointStyle,rotation:y.rotation,borderWidth:T},R=l.xPlus(w,p/2),O=C+d;jl(s,E,R,O,r.pointStyleWidth&&p)}else{const E=C+Math.max((u-m)/2,0),R=l.leftForLtr(w,p),O=vn(y.borderRadius);s.beginPath(),Object.values(O).some(V=>V!==0)?_i(s,{x:R,y:E,w:p,h:m,radius:O}):s.rect(R,E,p,m),s.fill(),T!==0&&s.stroke()}s.restore()},b=function(w,C,y){kn(s,y.text,w,C+v/2,c,{strikethrough:y.hidden,textAlign:l.textAlign(y.textAlign)})},x=this.isHorizontal(),k=this._computeTitleHeight();x?f={x:Ft(o,this.left+h,this.right-i[0]),y:this.top+h+k,line:0}:f={x:this.left+h,y:Ft(o,this.top+k+h,this.bottom-n[0].height),line:0},Jl(this.ctx,t.textDirection);const S=v+h;this.legendItems.forEach((w,C)=>{s.strokeStyle=w.fontColor,s.fillStyle=w.fontColor;const y=s.measureText(w.text).width,T=l.textAlign(w.textAlign||(w.textAlign=r.textAlign)),E=p+d+y;let R=f.x,O=f.y;l.setWidth(this.width),x?C>0&&R+E+h>this.right&&(O=f.y+=S,f.line++,R=f.x=Ft(o,this.left+h,this.right-i[f.line])):C>0&&O+S>this.bottom&&(R=f.x=R+n[f.line].width+h,f.line++,O=f.y=Ft(o,this.top+k+h,this.bottom-n[f.line].height));const V=l.x(R);if(_(V,O,w),R=yd(T,R+p+d,x?R+E:this.right,t.rtl),b(l.x(R),O,w),x)f.x+=E+h;else if(typeof w.text!="string"){const z=c.lineHeight;f.y+=Sc(w,z)+h}else f.y+=S}),Zl(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,i=At(n.font),s=Wt(n.padding);if(!n.display)return;const o=Ln(t.rtl,this.left,this.width),r=this.ctx,a=n.position,l=i.size/2,c=s.top+l;let h,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+c,u=Ft(t.align,u,this.right-d);else{const p=this.columnSizes.reduce((m,v)=>Math.max(m,v.height),0);h=c+Ft(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const f=Ft(a,u,u+d);r.textAlign=o.textAlign(Do(a)),r.textBaseline="middle",r.strokeStyle=n.color,r.fillStyle=n.color,r.font=i.string,kn(r,n.text,f,h,i)}_computeTitleHeight(){const t=this.options.title,n=At(t.font),i=Wt(t.padding);return t.display?n.lineHeight+i.height:0}_getLegendItemAt(t,n){let i,s,o;if(Te(t,this.left,this.right)&&Te(n,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],Te(t,s.left,s.left+s.width)&&Te(n,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const n=this.options;if(!pm(t.type,n))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=um(s,i);s&&!o&&ht(n.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&ht(n.onHover,[t,i,this],this)}else i&&ht(n.onClick,[t,i,this],this)}}function dm(e,t,n,i,s){const o=fm(i,e,t,n),r=gm(s,i,t.lineHeight);return{itemWidth:o,itemHeight:r}}function fm(e,t,n,i){let s=e.text;return s&&typeof s!="string"&&(s=s.reduce((o,r)=>o.length>r.length?o:r)),t+n.size/2+i.measureText(s).width}function gm(e,t,n){let i=e;return typeof t.text!="string"&&(i=Sc(t,n)),i}function Sc(e,t){const n=e.text?e.text.length:0;return t*n}function pm(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var mm={id:"legend",_element:ma,start(e,t,n){const i=e.legend=new ma({ctx:e.ctx,options:n,chart:e});Vt.configure(e,i,n),Vt.addBox(e,i)},stop(e){Vt.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const i=e.legend;Vt.configure(e,i,n),i.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const i=t.datasetIndex,s=n.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:i,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),h=Wt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class Wo extends Ne{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const s=mt(i.text)?i.text.length:1;this._padding=Wt(i.padding);const o=s*At(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:i,bottom:s,right:o,options:r}=this,a=r.align;let l=0,c,h,u;return this.isHorizontal()?(h=Ft(a,i,o),u=n+t,c=o-i):(r.position==="left"?(h=i+t,u=Ft(a,s,n),l=nt*-.5):(h=o-t,u=Ft(a,n,s),l=nt*.5),c=s-n),{titleX:h,titleY:u,maxWidth:c,rotation:l}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const i=At(n.font),o=i.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);kn(t,n.text,0,0,i,{color:n.color,maxWidth:l,rotation:c,textAlign:Do(n.align),textBaseline:"middle",translation:[r,a]})}}function vm(e,t){const n=new Wo({ctx:e.ctx,options:t,chart:e});Vt.configure(e,n,t),Vt.addBox(e,n),e.titleBlock=n}var _m={id:"title",_element:Wo,start(e,t,n){vm(e,n)},stop(e){const t=e.titleBlock;Vt.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const i=e.titleBlock;Vt.configure(e,i,n),i.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Wi=new WeakMap;var bm={id:"subtitle",start(e,t,n){const i=new Wo({ctx:e.ctx,options:n,chart:e});Vt.configure(e,i,n),Vt.addBox(e,i),Wi.set(e,i)},stop(e){Vt.removeBox(e,Wi.get(e)),Wi.delete(e)},beforeUpdate(e,t,n){const i=Wi.get(e);Vt.configure(e,i,n),i.options=n},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const oi={average(e){if(!e.length)return!1;let t,n,i=new Set,s=0,o=0;for(t=0,n=e.length;t<n;++t){const a=e[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();i.add(l.x),s+=l.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((a,l)=>a+l)/i.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=e.length;o<r;++o){const l=e[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),h=Zs(t,c);h<s&&(s=h,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,i=l.y}return{x:n,y:i}}};function ge(e,t){return t&&(mt(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Me(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
|
|
3
|
+
`)>-1?e.split(`
|
|
4
|
+
`):e}function xm(e,t){const{element:n,datasetIndex:i,index:s}=t,o=e.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:e,label:r,parsed:o.getParsed(s),raw:e.data.datasets[i].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:n}}function va(e,t){const n=e.chart.ctx,{body:i,footer:s,title:o}=e,{boxWidth:r,boxHeight:a}=t,l=At(t.bodyFont),c=At(t.titleFont),h=At(t.footerFont),u=o.length,d=s.length,f=i.length,p=Wt(t.padding);let m=p.height,v=0,_=i.reduce((k,S)=>k+S.before.length+S.lines.length+S.after.length,0);if(_+=e.beforeBody.length+e.afterBody.length,u&&(m+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),_){const k=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;m+=f*k+(_-f)*l.lineHeight+(_-1)*t.bodySpacing}d&&(m+=t.footerMarginTop+d*h.lineHeight+(d-1)*t.footerSpacing);let b=0;const x=function(k){v=Math.max(v,n.measureText(k).width+b)};return n.save(),n.font=c.string,at(e.title,x),n.font=l.string,at(e.beforeBody.concat(e.afterBody),x),b=t.displayColors?r+2+t.boxPadding:0,at(i,k=>{at(k.before,x),at(k.lines,x),at(k.after,x)}),b=0,n.font=h.string,at(e.footer,x),n.restore(),v+=p.width,{width:v,height:m}}function ym(e,t){const{y:n,height:i}=t;return n<i/2?"top":n>e.height-i/2?"bottom":"center"}function wm(e,t,n,i){const{x:s,width:o}=i,r=n.caretSize+n.caretPadding;if(e==="left"&&s+o+r>t.width||e==="right"&&s-o-r<0)return!0}function km(e,t,n,i){const{x:s,width:o}=n,{width:r,chartArea:{left:a,right:l}}=e;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),wm(c,e,t,n)&&(c="center"),c}function _a(e,t,n){const i=n.yAlign||t.yAlign||ym(e,n);return{xAlign:n.xAlign||t.xAlign||km(e,t,n,i),yAlign:i}}function Sm(e,t){let{x:n,width:i}=e;return t==="right"?n-=i:t==="center"&&(n-=i/2),n}function Mm(e,t,n){let{y:i,height:s}=e;return t==="top"?i+=n:t==="bottom"?i-=s+n:i-=s/2,i}function ba(e,t,n,i){const{caretSize:s,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:l}=n,c=s+o,{topLeft:h,topRight:u,bottomLeft:d,bottomRight:f}=vn(r);let p=Sm(t,a);const m=Mm(t,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(h,d)+s:a==="right"&&(p+=Math.max(u,f)+s),{x:Ot(p,0,i.width-t.width),y:Ot(m,0,i.height-t.height)}}function Hi(e,t,n){const i=Wt(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-i.right:e.x+i.left}function xa(e){return ge([],Me(e))}function Cm(e,t,n){return tn(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function ya(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const Mc={beforeTitle:ke,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return n[t.dataIndex]}return""},afterTitle:ke,beforeBody:ke,beforeLabel:ke,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return J(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:ke,afterBody:ke,beforeFooter:ke,footer:ke,afterFooter:ke};function Ht(e,t,n,i){const s=e[t].call(n,i);return typeof s>"u"?Mc[t].call(n,i):s}class wa extends Ne{static positioners=oi;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&n.options.animation&&i.animations,o=new ic(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Cm(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:i}=n,s=Ht(i,"beforeTitle",this,t),o=Ht(i,"title",this,t),r=Ht(i,"afterTitle",this,t);let a=[];return a=ge(a,Me(s)),a=ge(a,Me(o)),a=ge(a,Me(r)),a}getBeforeBody(t,n){return xa(Ht(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:i}=n,s=[];return at(t,o=>{const r={before:[],lines:[],after:[]},a=ya(i,o);ge(r.before,Me(Ht(a,"beforeLabel",this,o))),ge(r.lines,Ht(a,"label",this,o)),ge(r.after,Me(Ht(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,n){return xa(Ht(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:i}=n,s=Ht(i,"beforeFooter",this,t),o=Ht(i,"footer",this,t),r=Ht(i,"afterFooter",this,t);let a=[];return a=ge(a,Me(s)),a=ge(a,Me(o)),a=ge(a,Me(r)),a}_createItems(t){const n=this._active,i=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(xm(this.chart,n[l]));return t.filter&&(a=a.filter((h,u,d)=>t.filter(h,u,d,i))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,i))),at(a,h=>{const u=ya(t.callbacks,h);s.push(Ht(u,"labelColor",this,h)),o.push(Ht(u,"labelPointStyle",this,h)),r.push(Ht(u,"labelTextColor",this,h))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,n){const i=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=oi[i.position].call(this,s,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);const l=this._size=va(this,i),c=Object.assign({},a,l),h=_a(this.chart,i,c),u=ba(i,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,i,s){const o=this.getCaretPosition(t,i,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,i){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=vn(a),{x:d,y:f}=t,{width:p,height:m}=n;let v,_,b,x,k,S;return o==="center"?(k=f+m/2,s==="left"?(v=d,_=v-r,x=k+r,S=k-r):(v=d+p,_=v+r,x=k-r,S=k+r),b=v):(s==="left"?_=d+Math.max(l,h)+r:s==="right"?_=d+p-Math.max(c,u)-r:_=this.caretX,o==="top"?(x=f,k=x-r,v=_-r,b=_+r):(x=f+m,k=x+r,v=_+r,b=_-r),S=x),{x1:v,x2:_,x3:b,y1:x,y2:k,y3:S}}drawTitle(t,n,i){const s=this.title,o=s.length;let r,a,l;if(o){const c=Ln(i.rtl,this.x,this.width);for(t.x=Hi(this,i.titleAlign,i),n.textAlign=c.textAlign(i.titleAlign),n.textBaseline="middle",r=At(i.titleFont),a=i.titleSpacing,n.fillStyle=i.titleColor,n.font=r.string,l=0;l<o;++l)n.fillText(s[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,l+1===o&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,n,i,s,o){const r=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=o,h=At(o.bodyFont),u=Hi(this,"left",o),d=s.x(u),f=l<h.lineHeight?(h.lineHeight-l)/2:0,p=n.y+f;if(o.usePointStyle){const m={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},v=s.leftForLtr(d,c)+c/2,_=p+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,to(t,m,v,_),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,to(t,m,v,_)}else{t.lineWidth=Q(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const m=s.leftForLtr(d,c),v=s.leftForLtr(s.xPlus(d,1),c-2),_=vn(r.borderRadius);Object.values(_).some(b=>b!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,_i(t,{x:m,y:p,w:c,h:l,radius:_}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),_i(t,{x:v,y:p+1,w:c-2,h:l-2,radius:_}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(m,p,c,l),t.strokeRect(m,p,c,l),t.fillStyle=r.backgroundColor,t.fillRect(v,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,n,i){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=i,u=At(i.bodyFont);let d=u.lineHeight,f=0;const p=Ln(i.rtl,this.x,this.width),m=function(y){n.fillText(y,p.x(t.x+f),t.y+d/2),t.y+=d+o},v=p.textAlign(r);let _,b,x,k,S,w,C;for(n.textAlign=r,n.textBaseline="middle",n.font=u.string,t.x=Hi(this,v,i),n.fillStyle=i.bodyColor,at(this.beforeBody,m),f=a&&v!=="right"?r==="center"?c/2+h:c+2+h:0,k=0,w=s.length;k<w;++k){for(_=s[k],b=this.labelTextColors[k],n.fillStyle=b,at(_.before,m),x=_.lines,a&&x.length&&(this._drawColorBox(n,t,k,p,i),d=Math.max(u.lineHeight,l)),S=0,C=x.length;S<C;++S)m(x[S]),d=u.lineHeight;at(_.after,m)}f=0,d=u.lineHeight,at(this.afterBody,m),t.y-=o}drawFooter(t,n,i){const s=this.footer,o=s.length;let r,a;if(o){const l=Ln(i.rtl,this.x,this.width);for(t.x=Hi(this,i.footerAlign,i),t.y+=i.footerMarginTop,n.textAlign=l.textAlign(i.footerAlign),n.textBaseline="middle",r=At(i.footerFont),n.fillStyle=i.footerColor,n.font=r.string,a=0;a<o;++a)n.fillText(s[a],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+i.footerSpacing}}drawBackground(t,n,i,s){const{xAlign:o,yAlign:r}=this,{x:a,y:l}=t,{width:c,height:h}=i,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=vn(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(a+u,l),r==="top"&&this.drawCaret(t,n,i,s),n.lineTo(a+c-d,l),n.quadraticCurveTo(a+c,l,a+c,l+d),r==="center"&&o==="right"&&this.drawCaret(t,n,i,s),n.lineTo(a+c,l+h-p),n.quadraticCurveTo(a+c,l+h,a+c-p,l+h),r==="bottom"&&this.drawCaret(t,n,i,s),n.lineTo(a+f,l+h),n.quadraticCurveTo(a,l+h,a,l+h-f),r==="center"&&o==="left"&&this.drawCaret(t,n,i,s),n.lineTo(a,l+u),n.quadraticCurveTo(a,l,a+u,l),n.closePath(),n.fill(),s.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){const r=oi[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=va(this,t),l=Object.assign({},r,this._size),c=_a(n,t,l),h=ba(t,l,c,n);(s._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=Wt(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,n),Jl(t,n.textDirection),o.y+=r.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),Zl(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Zi(i,s),r=this._positionChanged(s,n);(o||r)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,n,i),a=this._positionChanged(r,t),l=n||!Zi(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,i,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(t,n){const{caretX:i,caretY:s,options:o}=this,r=oi[o.position].call(this,t,n);return r!==!1&&(i!==r.x||s!==r.y)}}var Pm={id:"tooltip",_element:wa,positioners:oi,afterInit(e,t,n){n&&(e.tooltip=new wa({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Mc},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Am=Object.freeze({__proto__:null,Colors:Vp,Decimation:$p,Filler:hm,Legend:mm,SubTitle:bm,Title:_m,Tooltip:Pm});const Tm=(e,t,n,i)=>(typeof t=="string"?(n=e.push(t)-1,i.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Dm(e,t,n,i){const s=e.indexOf(t);if(s===-1)return Tm(e,t,n,i);const o=e.lastIndexOf(t);return s!==o?n:s}const Om=(e,t)=>e===null?null:Ot(Math.round(e),0,t);function ka(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Em extends Cn{static id="category";static defaults={ticks:{callback:ka}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const i=this.getLabels();for(const{index:s,label:o}of n)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(J(t))return null;const i=this.getLabels();return n=isFinite(n)&&i[n]===t?n:Dm(i,t,U(n,t),this._addedLabels),Om(n,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),n||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,n=this.max,i=this.options.offset,s=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let r=t;r<=n;r++)s.push({value:r});return s}getLabelForValue(t){return ka.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function Lm(e,t){const n=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:d}=e,f=o||1,p=h-1,{min:m,max:v}=t,_=!J(r),b=!J(a),x=!J(c),k=(v-m)/(u+1);let S=vr((v-m)/p/f)*f,w,C,y,T;if(S<1e-14&&!_&&!b)return[{value:m},{value:v}];T=Math.ceil(v/S)-Math.floor(m/S),T>p&&(S=vr(T*S/p/f)*f),J(l)||(w=Math.pow(10,l),S=Math.ceil(S*w)/w),s==="ticks"?(C=Math.floor(m/S)*S,y=Math.ceil(v/S)*S):(C=m,y=v),_&&b&&o&&gd((a-r)/o,S/1e3)?(T=Math.round(Math.min((a-r)/S,h)),S=(a-r)/T,C=r,y=a):x?(C=_?r:C,y=b?a:y,T=c-1,S=(y-C)/T):(T=(y-C)/S,ci(T,Math.round(T),S/1e3)?T=Math.round(T):T=Math.ceil(T));const E=Math.max(_r(S),_r(C));w=Math.pow(10,J(l)?E:l),C=Math.round(C*w)/w,y=Math.round(y*w)/w;let R=0;for(_&&(d&&C!==r?(n.push({value:r}),C<r&&R++,ci(Math.round((C+R*S)*w)/w,r,Sa(r,k,e))&&R++):C<r&&R++);R<T;++R){const O=Math.round((C+R*S)*w)/w;if(b&&O>a)break;n.push({value:O})}return b&&d&&y!==a?n.length&&ci(n[n.length-1].value,a,Sa(a,k,e))?n[n.length-1].value=a:n.push({value:a}):(!b||y===a)&&n.push({value:y}),n}function Sa(e,t,{horizontal:n,minRotation:i}){const s=de(i),o=(n?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+e).length;return Math.min(t/o,r)}class os extends Cn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return J(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds();let{min:s,max:o}=this;const r=l=>s=n?s:l,a=l=>o=i?o:l;if(t){const l=_e(s),c=_e(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,r=Lm(s,o);return t.bounds==="ticks"&&Rl(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let n=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-n)/Math.max(t.length-1,1)/2;n-=s,i+=s}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(t){return Ci(t,this.chart.options.locale,this.options.ticks.format)}}class Rm extends os{static id="linear";static defaults={ticks:{callback:us.formatters.numeric}};determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=kt(t)?t:0,this.max=kt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,i=de(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const xi=e=>Math.floor(je(e)),cn=(e,t)=>Math.pow(10,xi(e)+t);function Ma(e){return e/Math.pow(10,xi(e))===1}function Ca(e,t,n){const i=Math.pow(10,n),s=Math.floor(e/i);return Math.ceil(t/i)-s}function Im(e,t){const n=t-e;let i=xi(n);for(;Ca(e,t,i)>10;)i++;for(;Ca(e,t,i)<10;)i--;return Math.min(i,xi(e))}function Fm(e,{min:t,max:n}){t=Gt(e.min,t);const i=[],s=xi(t);let o=Im(t,n),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((t-l)*r)/r,h=Math.floor((t-l)/a/10)*a*10;let u=Math.floor((c-h)/Math.pow(10,o)),d=Gt(e.min,Math.round((l+h+u*Math.pow(10,o))*r)/r);for(;d<n;)i.push({value:d,major:Ma(d),significand:u}),u>=10?u=u<15?15:20:u++,u>=20&&(o++,u=2,r=o>=0?1:r),d=Math.round((l+h+u*Math.pow(10,o))*r)/r;const f=Gt(e.max,d);return i.push({value:f,major:Ma(f),significand:u}),i}class zm extends Cn{static id="logarithmic";static defaults={ticks:{callback:us.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const i=os.prototype.parse.apply(this,[t,n]);if(i===0){this._zero=!0;return}return kt(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=kt(t)?Math.max(0,t):null,this.max=kt(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!kt(this._userMin)&&(this.min=t===cn(this.min,0)?cn(this.min,-1):cn(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let i=this.min,s=this.max;const o=a=>i=t?i:a,r=a=>s=n?s:a;i===s&&(i<=0?(o(1),r(10)):(o(cn(i,-1)),r(cn(s,1)))),i<=0&&o(cn(s,-1)),s<=0&&r(cn(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},i=Fm(n,this);return t.bounds==="ticks"&&Rl(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":Ci(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=je(t),this._valueRange=je(this.max)-je(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(je(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}function ro(e){const t=e.ticks;if(t.display&&e.display){const n=Wt(t.backdropPadding);return U(t.font&&t.font.size,vt.font.size)+n.height}return 0}function Nm(e,t,n){return n=mt(n)?n:[n],{w:Od(e,t.string,n),h:n.length*t.lineHeight}}function Pa(e,t,n,i,s){return e===i||e===s?{start:t-n/2,end:t+n/2}:e<i||e>s?{start:t-n,end:t}:{start:t,end:t+n}}function Bm(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),i=[],s=[],o=e._pointLabels.length,r=e.options.pointLabels,a=r.centerPointLabels?nt/o:0;for(let l=0;l<o;l++){const c=r.setContext(e.getPointLabelContext(l));s[l]=c.padding;const h=e.getPointPosition(l,e.drawingArea+s[l],a),u=At(c.font),d=Nm(e.ctx,u,e._pointLabels[l]);i[l]=d;const f=zt(e.getIndexAngle(l)+a),p=Math.round(Ao(f)),m=Pa(p,h.x,d.w,0,180),v=Pa(p,h.y,d.h,90,270);Vm(n,t,f,m,v)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=jm(e,i,s)}function Vm(e,t,n,i,s){const o=Math.abs(Math.sin(n)),r=Math.abs(Math.cos(n));let a=0,l=0;i.start<t.l?(a=(t.l-i.start)/o,e.l=Math.min(e.l,t.l-a)):i.end>t.r&&(a=(i.end-t.r)/o,e.r=Math.max(e.r,t.r+a)),s.start<t.t?(l=(t.t-s.start)/r,e.t=Math.min(e.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/r,e.b=Math.max(e.b,t.b+l))}function Wm(e,t,n){const i=e.drawingArea,{extra:s,additionalAngle:o,padding:r,size:a}=n,l=e.getPointPosition(t,i+s+r,o),c=Math.round(Ao(zt(l.angle+Ct))),h=Um(l.y,a.h,c),u=$m(c),d=Ym(l.x,a.w,u);return{visible:!0,x:l.x,y:h,textAlign:u,left:d,top:h,right:d+a.w,bottom:h+a.h}}function Hm(e,t){if(!t)return!0;const{left:n,top:i,right:s,bottom:o}=e;return!(Oe({x:n,y:i},t)||Oe({x:n,y:o},t)||Oe({x:s,y:i},t)||Oe({x:s,y:o},t))}function jm(e,t,n){const i=[],s=e._pointLabels.length,o=e.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:ro(o)/2,additionalAngle:r?nt/s:0};let c;for(let h=0;h<s;h++){l.padding=n[h],l.size=t[h];const u=Wm(e,h,l);i.push(u),a==="auto"&&(u.visible=Hm(u,c),u.visible&&(c=u))}return i}function $m(e){return e===0||e===180?"center":e<180?"left":"right"}function Ym(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function Um(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function Xm(e,t,n){const{left:i,top:s,right:o,bottom:r}=n,{backdropColor:a}=t;if(!J(a)){const l=vn(t.borderRadius),c=Wt(t.backdropPadding);e.fillStyle=a;const h=i-c.left,u=s-c.top,d=o-i+c.width,f=r-s+c.height;Object.values(l).some(p=>p!==0)?(e.beginPath(),_i(e,{x:h,y:u,w:d,h:f,radius:l}),e.fill()):e.fillRect(h,u,d,f)}}function qm(e,t){const{ctx:n,options:{pointLabels:i}}=e;for(let s=t-1;s>=0;s--){const o=e._pointLabelItems[s];if(!o.visible)continue;const r=i.setContext(e.getPointLabelContext(s));Xm(n,r,o);const a=At(r.font),{x:l,y:c,textAlign:h}=o;kn(n,e._pointLabels[s],l,c+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function Cc(e,t,n,i){const{ctx:s}=e;if(n)s.arc(e.xCenter,e.yCenter,t,0,ft);else{let o=e.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r<i;r++)o=e.getPointPosition(r,t),s.lineTo(o.x,o.y)}}function Km(e,t,n,i,s){const o=e.ctx,r=t.circular,{color:a,lineWidth:l}=t;!r&&!i||!a||!l||n<0||(o.save(),o.strokeStyle=a,o.lineWidth=l,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),Cc(e,n,r,i),o.closePath(),o.stroke(),o.restore())}function Gm(e,t,n){return tn(e,{label:n,index:t,type:"pointLabel"})}class Jm extends os{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:us.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Wt(ro(this.options)/2),n=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+n/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(n,i)/2)}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!1);this.min=kt(t)&&!isNaN(t)?t:0,this.max=kt(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/ro(this.options))}generateTickLabels(t){os.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,i)=>{const s=ht(this.options.pointLabels.callback,[n,i],this);return s||s===0?s:""}).filter((n,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?Bm(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,i,s){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,i,s))}getIndexAngle(t){const n=ft/(this._pointLabels.length||1),i=this.options.startAngle||0;return zt(t*n+de(i))}getDistanceFromCenterForValue(t){if(J(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(J(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t<n.length){const i=n[t];return Gm(this.getContext(),t,i)}}getPointPosition(t,n,i=0){const s=this.getIndexAngle(t)-Ct+i;return{x:Math.cos(s)*n+this.xCenter,y:Math.sin(s)*n+this.yCenter,angle:s}}getPointPositionForValue(t,n){return this.getPointPosition(t,this.getDistanceFromCenterForValue(n))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:n,top:i,right:s,bottom:o}=this._pointLabelItems[t];return{left:n,top:i,right:s,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:n}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),Cc(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,n=this.options,{angleLines:i,grid:s,border:o}=n,r=this._pointLabels.length;let a,l,c;if(n.pointLabels.display&&qm(this,r),s.display&&this.ticks.forEach((h,u)=>{if(u!==0||u===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);const d=this.getContext(u),f=s.setContext(d),p=o.setContext(d);Km(this,f,l,r,p)}}),i.display){for(t.save(),a=r-1;a>=0;a--){const h=i.setContext(this.getPointLabelContext(a)),{color:u,lineWidth:d}=h;!d||!u||(t.lineWidth=d,t.strokeStyle=u,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,i=n.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!n.reverse)return;const c=i.setContext(this.getContext(l)),h=At(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const u=Wt(c.backdropPadding);t.fillRect(-r/2-u.left,-o-h.size/2-u.top,r+u.width,h.size+u.height)}kn(t,a.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}const _s={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},$t=Object.keys(_s);function Aa(e,t){return e-t}function Ta(e,t){if(J(t))return null;const n=e._adapter,{parser:i,round:s,isoWeekday:o}=e._parseOpts;let r=t;return typeof i=="function"&&(r=i(r)),kt(r)||(r=typeof i=="string"?n.parse(r,i):n.parse(r)),r===null?null:(s&&(r=s==="week"&&(Bn(o)||o===!0)?n.startOf(r,"isoWeek",o):n.startOf(r,s)),+r)}function Da(e,t,n,i){const s=$t.length;for(let o=$t.indexOf(e);o<s-1;++o){const r=_s[$t[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((n-t)/(a*r.size))<=i)return $t[o]}return $t[s-1]}function Zm(e,t,n,i,s){for(let o=$t.length-1;o>=$t.indexOf(n);o--){const r=$t[o];if(_s[r].common&&e._adapter.diff(s,i,r)>=t-1)return r}return $t[n?$t.indexOf(n):0]}function Qm(e){for(let t=$t.indexOf(e)+1,n=$t.length;t<n;++t)if(_s[$t[t]].common)return $t[t]}function Oa(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:i,hi:s}=To(n,t),o=n[i]>=t?n[i]:n[s];e[o]=!0}}function tv(e,t,n,i){const s=e._adapter,o=+s.startOf(t[0].value,i),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,i))l=n[a],l>=0&&(t[l].major=!0);return t}function Ea(e,t,n){const i=[],s={},o=t.length;let r,a;for(r=0;r<o;++r)a=t[r],s[a]=r,i.push({value:a,major:!1});return o===0||!n?i:tv(e,i,s,n)}class ao extends Cn{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const i=t.time||(t.time={}),s=this._adapter=new eg._date(t.adapters.date);s.init(n),li(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:Ta(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,i=t.time.unit||"day";let{min:s,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function l(c){!r&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=kt(s)&&!isNaN(s)?s:+n.startOf(Date.now(),i),o=kt(o)&&!isNaN(o)?o:+n.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],i=t[t.length-1]),{min:n,max:i}}buildTicks(){const t=this.options,n=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,r=this.max,a=_d(s,o,r);return this._unit=n.unit||(i.autoSkip?Da(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):Zm(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Qm(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),Ea(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;n=Ot(n,0,r),i=Ot(i,0,r),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){const t=this._adapter,n=this.min,i=this.max,s=this.options,o=s.time,r=o.unit||Da(o.minUnit,n,i,this._getLabelCapacity(n)),a=U(s.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=Bn(l)||l===!0,h={};let u=n,d,f;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":r),t.diff(i,n,r)>1e5*a)throw new Error(n+" and "+i+" are too far apart with stepSize of "+a+" "+r);const p=s.ticks.source==="data"&&this.getDataTimestamps();for(d=u,f=0;d<i;d=+t.add(d,a,r),f++)Oa(h,d,p);return(d===i||s.bounds==="ticks"||f===1)&&Oa(h,d,p),Object.keys(h).sort(Aa).map(m=>+m)}getLabelForValue(t){const n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(t,i.tooltipFormat):n.format(t,i.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,r=n||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,n,i,s){const o=this.options,r=o.ticks.callback;if(r)return ht(r,[t,n,i],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],u=c&&a[c],d=i[n],f=c&&u&&d&&d.major;return this._adapter.format(t,s||(f?u:h))}generateTickLabels(t){let n,i,s;for(n=0,i=t.length;n<i;++n)s=t[n],s.label=this._tickFormatFunction(s.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+i)*n.factor)}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,i=this.ctx.measureText(t).width,s=de(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(s),r=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*o+a*r,h:i*r+a*o}}_getLabelCapacity(t){const n=this.options.time,i=n.displayFormats,s=i[n.unit]||i.millisecond,o=this._tickFormatFunction(t,0,Ea(this,[t],this._majorUnit),s),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,i=s.length;n<i;++n)t=t.concat(s[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,i;if(t.length)return t;const s=this.getLabels();for(n=0,i=s.length;n<i;++n)t.push(Ta(this,s[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return zl(t.sort(Aa))}}function ji(e,t,n){let i=0,s=e.length-1,o,r,a,l;n?(t>=e[i].pos&&t<=e[s].pos&&({lo:i,hi:s}=De(e,"pos",t)),{pos:o,time:a}=e[i],{pos:r,time:l}=e[s]):(t>=e[i].time&&t<=e[s].time&&({lo:i,hi:s}=De(e,"time",t)),{time:o,pos:a}=e[i],{time:r,pos:l}=e[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class ev extends ao{static id="timeseries";static defaults=ao.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=ji(n,this.min),this._tableRange=ji(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:i}=this,s=[],o=[];let r,a,l,c,h;for(r=0,a=t.length;r<a;++r)c=t[r],c>=n&&c<=i&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(r=0,a=s.length;r<a;++r)h=s[r+1],l=s[r-1],c=s[r],Math.round((h+l)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){const t=this.min,n=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(n)||i.length===1)&&i.push(n),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?t=this.normalize(n.concat(i)):t=n.length?n:i,t=this._cache.all=t,t}getDecimalForValue(t){return(ji(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return ji(this._table,i*this._tableRange+this._minPos,!0)}}var nv=Object.freeze({__proto__:null,CategoryScale:Em,LinearScale:Rm,LogarithmicScale:zm,RadialLinearScale:Jm,TimeScale:ao,TimeSeriesScale:ev});const iv=[tg,Lp,Am,nv];Vo.register(...iv);function La(e,t){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t}function sv(){return{text:La("--chart-text","#435568"),grid:La("--chart-grid","#e8eff4")}}function Fs(e,t,n,i,s,o,r={}){const a=sv(),l=r.stacked===!0,c=Number(r.maxTicks||10),h=r.yTickFormatter;if(!e)return new Vo(t.getContext("2d"),{type:n,data:{labels:i,datasets:s},options:{responsive:!0,maintainAspectRatio:!1,animation:!1,interaction:{mode:"nearest",intersect:!1},scales:{x:{stacked:l,ticks:{maxTicksLimit:c,color:a.text},grid:{color:a.grid}},y:{stacked:l,beginAtZero:!0,ticks:{color:a.text,callback:h?d=>h(Number(d)):void 0},grid:{color:a.grid},title:{display:!0,text:o,color:a.text}}},plugins:{legend:{position:"bottom",labels:{boxWidth:10,boxHeight:10,usePointStyle:!0,color:a.text}},tooltip:{enabled:!0}}}});e.config.type=n,e.data.labels=i,e.data.datasets=s;const u=e.options?.scales;return u?.x&&(u.x.stacked=l,u.x.ticks&&(u.x.ticks.maxTicksLimit=c,u.x.ticks.color=a.text),u.x.grid&&(u.x.grid.color=a.grid)),u?.y&&(u.y.stacked=l,u.y.ticks&&(u.y.ticks.color=a.text,u.y.ticks.callback=h?d=>h(Number(d)):void 0),u.y.grid&&(u.y.grid.color=a.grid),u.y.title&&(u.y.title.color=a.text)),e.options?.plugins?.legend?.labels&&(e.options.plugins.legend.labels.color=a.text),e.update(),e}function zs(e){e?.destroy()}var ov=W('<button type="button"> </button>'),rv=W('<section class="panel"><div class="analytics-head"><h2>Live Analytics</h2> <div id="analyticsRanges" class="range-group" role="group" aria-label="Analytics range"></div></div> <p id="analyticsMeta" class="muted"> </p> <div class="chart-grid"><article class="chart-card"><h3>Generation Tokens Per Model</h3> <div class="chart-wrap"><canvas id="tokensChart"></canvas></div></article> <article class="chart-card"><h3>Turns Per Model</h3> <div class="chart-wrap"><canvas id="turnsChart"></canvas></div></article> <article class="chart-card"><h3>Concurrent Sessions</h3> <div class="chart-wrap"><canvas id="concurrentSessionsChart"></canvas></div></article></div></section>');function av(e,t){Ut(t,!1);let n=K(t,"payload",8,null),i=K(t,"selectedRange",8,"24h"),s=K(t,"errorMessage",8,null),o=K(t,"theme",8,"light");const r=Qe();let a=tt(),l=tt(),c=tt(),h=null,u=null,d=null,f=tt(ys),p=tt(n()?.ok?cr(n()):null);function m(){zs(h),zs(u),zs(d),h=null,u=null,d=null}function v(){!g(p)||!g(a)||!g(l)||!g(c)||(h=Fs(h,g(a),"bar",g(p).labels,g(p).tokenDatasets,"Generation Tokens",{stacked:!0,maxTicks:g(p).maxTicks,yTickFormatter:Du}),u=Fs(u,g(l),"bar",g(p).labels,g(p).turnDatasets,"Turns",{stacked:!1,maxTicks:g(p).maxTicks}),d=Fs(d,g(c),"line",g(p).labels,g(p).concurrentDatasets,"Sessions",{stacked:!1,maxTicks:g(p).maxTicks}))}Pl(()=>{m()}),Mt(()=>(D(n()),g(p),D(s()),ys),()=>{n()?.ok?($(p,cr(n())),$(f,s()?`${g(p).metaText} | ${s()}`:g(p).metaText)):(m(),$(p,null),$(f,s()||ys))}),Mt(()=>(g(p),D(o())),()=>{g(p)&&(o(),v())}),ye(),Zt();var _=rv(),b=M(_),x=A(M(b),2);Bt(x,5,()=>Mu,wo,(F,B)=>{var j=ov();let H;var X=M(j);q(()=>{H=Nt(j,1,"",null,H,{active:i()===g(B)}),L(X,g(B))}),Dt("click",j,()=>r("rangeChange",g(B))),N(F,j)});var k=A(b,2),S=M(k),w=A(k,2),C=M(w),y=A(M(C),2),T=M(y);xs(T,F=>$(a,F),()=>g(a));var E=A(C,2),R=A(M(E),2),O=M(R);xs(O,F=>$(l,F),()=>g(l));var V=A(E,2),z=A(M(V),2),I=M(z);xs(I,F=>$(c,F),()=>g(c)),q(()=>L(S,g(f))),N(e,_),Xt()}var lv=W('<span class="ss-dot"></span>'),cv=W('<span><!> <span class="ss-k"> </span> <span class="ss-v mono"> </span></span>'),hv=W('<span class="ss-dot"></span>'),uv=W('<span><!> <span class="ss-k"> </span> <span class="ss-v mono"> </span></span>'),dv=W('<section class="panel status-strip" id="statusStrip"><div class="ss-group" id="healthGroup"><div class="ss-group-label">Health</div> <div class="ss-chips"></div></div> <div class="ss-divider" aria-hidden="true"></div> <div class="ss-group" id="ingestorGroup"><div class="ss-group-label">Ingestor</div> <div class="ss-chips"></div></div></section>');function fv(e,t){Ut(t,!1);const n=tt(),i=tt();let s=K(t,"health",8,null),o=K(t,"healthError",8,null),r=K(t,"status",8,null),a=K(t,"statusError",8,null);function l(_){return _==null?"n/a":`${Number(_).toFixed(2)}ms`}function c(_){return _==null?"n/a":_<60?`${_}s ago`:_<3600?`${Math.round(_/60)}m ago`:`${Math.round(_/3600)}h ago`}function h(_,b){if(b||!_?.ok)return[{key:"ClickHouse",value:b??_?.error??"unavailable",ok:!1,tone:"bad"}];const k=(_.url??"unknown").replace(/^https?:\/\//,""),S=_.connections?.total,w=S==null?"n/a":`${Number(S).toLocaleString()}`;return[{key:"ClickHouse",value:k,ok:!0},{key:"db",value:_.database??"unknown",ok:!1},{key:"ver",value:_.version??"n/a",ok:!1},{key:"ping",value:l(_.ping_ms),ok:!1},{key:"conns",value:w,ok:!1}]}function u(_,b){if(b)return[{key:"status",value:b,ok:!1,tone:"bad"}];const x=_?.ingestor;if(!x)return[{key:"status",value:"unknown",ok:!1,tone:"warn"}];let k="unknown",S=!1,w;x.present?x.latest?x.alive?(k="healthy",S=!0):(k="stale",w="warn"):(k="waiting",w="warn"):(k="missing",w="warn");const C=[{key:"status",value:k,ok:S,tone:w}];if(x.age_seconds!==null&&x.age_seconds!==void 0&&C.push({key:"heartbeat",value:c(x.age_seconds),ok:!1}),x.latest){const y=x.latest.queue_depth;C.push({key:"queue",value:y==null?"n/a":String(y),ok:!1});const T=x.latest.files_active??"?",E=x.latest.files_watched??"?";C.push({key:"files",value:`${T} / ${E}`,ok:!1})}return C}Mt(()=>(D(s()),D(o())),()=>{$(n,h(s(),o()))}),Mt(()=>(D(r()),D(a())),()=>{$(i,u(r(),a()))}),ye(),Zt();var d=dv(),f=M(d),p=A(M(f),2);Bt(p,5,()=>g(n),_=>_.key,(_,b)=>{var x=cv();let k;var S=M(x);{var w=R=>{var O=lv();N(R,O)};ut(S,R=>{g(b),P(()=>g(b).ok)&&R(w)})}var C=A(S,2),y=M(C),T=A(C,2),E=M(T);q(()=>{k=Nt(x,1,"ss-chip",null,k,{"ss-ok":g(b).ok,"ss-warn":g(b).tone==="warn","ss-bad":g(b).tone==="bad"}),L(y,(g(b),P(()=>g(b).key))),L(E,(g(b),P(()=>g(b).value)))}),N(_,x)});var m=A(f,4),v=A(M(m),2);Bt(v,5,()=>g(i),_=>_.key,(_,b)=>{var x=uv();let k;var S=M(x);{var w=R=>{var O=hv();N(R,O)};ut(S,R=>{g(b),P(()=>g(b).ok)&&R(w)})}var C=A(S,2),y=M(C),T=A(C,2),E=M(T);q(()=>{k=Nt(x,1,"ss-chip",null,k,{"ss-ok":g(b).ok,"ss-warn":g(b).tone==="warn","ss-bad":g(b).tone==="bad"}),L(y,(g(b),P(()=>g(b).key))),L(E,(g(b),P(()=>g(b).value)))}),N(_,x)}),N(e,d),Xt()}var gv=W('<button class="mv-search-clear" type="button" aria-label="Clear search">×</button>'),pv=W("<option> </option>"),mv=W("<option> </option>"),vv=W("<option> </option>"),_v=W('<label class="mv-filter"><span class="mv-filter-k">harness</span> <select class="mv-select"><option>all</option><!></select></label>'),bv=W('<div class="mv-filterbar"><div class="mv-search"><span class="mv-search-icon" aria-hidden="true">⌕</span> <input class="mv-search-input" placeholder="Search prompts and responses…"/> <!></div> <div class="mv-filters"><label class="mv-filter"><span class="mv-filter-k">model</span> <select class="mv-select"><option>all</option><!></select></label> <label class="mv-filter"><span class="mv-filter-k">status</span> <select class="mv-select"></select></label> <!> <span class="mv-filter-count mono"> </span></div></div>');function xv(e,t){Ut(t,!1);let n=K(t,"filter",8),i=K(t,"models",24,()=>[]),s=K(t,"harnesses",24,()=>[]),o=K(t,"count",8,0),r=K(t,"total",8,0);const a=["all","completed","active","cancelled","error"],l=Qe();function c(O){const V={...n(),...O};l("change",V)}Zt();var h=bv(),u=M(h),d=A(M(u),2),f=A(d,2);{var p=O=>{var V=gv();Dt("click",V,()=>c({query:""})),N(O,V)};ut(f,O=>{D(n()),P(()=>n().query)&&O(p)})}var m=A(u,2),v=M(m),_=A(M(v),2),b=M(_);b.value=b.__value="all";var x=A(b);Bt(x,1,i,O=>O,(O,V)=>{var z=pv(),I=M(z),F={};q(()=>{L(I,g(V)),F!==(F=g(V))&&(z.value=(z.__value=g(V))??"")}),N(O,z)});var k;bs(_);var S=A(v,2),w=A(M(S),2);Bt(w,5,()=>a,O=>O,(O,V)=>{var z=mv(),I=M(z),F={};q(()=>{L(I,g(V)),F!==(F=g(V))&&(z.value=(z.__value=g(V))??"")}),N(O,z)});var C;bs(w);var y=A(S,2);{var T=O=>{var V=_v(),z=A(M(V),2),I=M(z);I.value=I.__value="all";var F=A(I);Bt(F,1,s,j=>j.id,(j,H)=>{var X=vv(),G=M(X),Z={};q(()=>{L(G,(g(H),P(()=>g(H).label))),Z!==(Z=(g(H),P(()=>g(H).id)))&&(X.value=(X.__value=(g(H),P(()=>g(H).id)))??"")}),N(j,X)});var B;bs(z),q(()=>{B!==(B=(D(n()),P(()=>n().harness)))&&(z.value=(z.__value=(D(n()),P(()=>n().harness)))??"",Yi(z,(D(n()),P(()=>n().harness))))}),Dt("change",z,j=>c({harness:j.currentTarget.value})),N(O,V)};ut(y,O=>{D(s()),P(()=>s().length>0)&&O(T)})}var E=A(y,2),R=M(E);q(()=>{mu(d,(D(n()),P(()=>n().query))),k!==(k=(D(n()),P(()=>n().model)))&&(_.value=(_.__value=(D(n()),P(()=>n().model)))??"",Yi(_,(D(n()),P(()=>n().model)))),C!==(C=(D(n()),P(()=>n().status)))&&(w.value=(w.__value=(D(n()),P(()=>n().status)))??"",Yi(w,(D(n()),P(()=>n().status)))),L(R,`${o()??""} / ${r()??""}`)}),Dt("input",d,O=>c({query:O.currentTarget.value})),Dt("change",_,O=>c({model:O.currentTarget.value})),Dt("change",w,O=>c({status:O.currentTarget.value})),N(e,h),Xt()}function me(e){if(e<1e3)return`${e}ms`;const t=Math.round(e/100)/10;if(t<60)return`${t}s`;const n=Math.floor(t/60),i=Math.round(t-n*60);if(n<60)return i?`${n}m ${i}s`:`${n}m`;const s=Math.floor(n/60),o=n-s*60;return o?`${s}h ${o}m`:`${s}h`}function Hn(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k":String(e)}function Ra(e,t=Date.now()){const n=Math.max(0,t-e);return n<6e4?"just now":n<36e5?Math.floor(n/6e4)+"m ago":n<864e5?Math.floor(n/36e5)+"h ago":Math.floor(n/864e5)+"d ago"}function ie(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Ia(e){return new Date(e).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function We(e){return!e||typeof e!="object"?"":Object.entries(e).slice(0,2).map(([n,i])=>{let s;return typeof i=="string"?s=i.length>42?i.slice(0,40)+"…":i:s=JSON.stringify(i),`${n}: ${s}`}).join(", ")}function yv(e,t,n=Date.now()){return e==="active"||n-t<6e4}var wv=W('<span class="mv-status"><span></span> <span class="mv-status-label"> </span></span>');function Pc(e,t){Ut(t,!1);const n=tt(),i=tt();let s=K(t,"status",8),o=K(t,"endedAt",8);Mt(()=>(D(s()),D(o())),()=>{$(n,yv(s(),o()))}),Mt(()=>g(n),()=>{$(i,g(n)?"active":"idle")}),ye(),Zt();var r=wv(),a=M(r);let l;var c=A(a,2),h=M(c);q(()=>{ve(r,"title",g(i)),l=Nt(a,1,"mv-status-dot",null,l,{"mv-status-pulse":g(n),"mv-status-idle":!g(n)}),Ji(a,g(n)?"background: #22ff88;":"background: var(--subtle);"),L(h,g(i))}),N(e,r),Xt()}var kv=W('<span class="mv-avatar"> </span>');function Sv(e,t){Ut(t,!1);const n=tt();let i=K(t,"harness",8),s=K(t,"size",8,28);Mt(()=>D(s()),()=>{$(n,Math.round(s()*.38))}),ye(),Zt();var o=kv(),r=M(o);q(()=>{Ji(o,`width: ${s()??""}px; height: ${s()??""}px; border-radius: ${s()??""}px; background: oklch(0.82 0.09 ${D(i()),P(()=>i().hue)??""}); color: oklch(0.3 0.1 ${D(i()),P(()=>i().hue)??""}); font-size: ${g(n)??""}px;`),L(r,(D(i()),P(()=>i().short)))}),N(e,o),Xt()}var Mv=W("<span><!></span>");function Ac(e,t){let n=K(t,"tone",8,null);var i=Mv();let s;var o=M(i);hu(o,t,"default",{}),q(()=>s=Nt(i,1,"mv-chip",null,s,{"mv-chip-warn":n()==="warn","mv-chip-bad":n()==="bad"})),N(e,i)}var Cv=W('<span class="mv-meta-sep">·</span> <span class="mv-meta-item"></span>',1),Pv=W('<button type="button"><div class="mv-card-head"><div class="mv-card-title-row"><!> <span class="mv-card-title"> </span></div> <span class="mv-card-time"> </span></div> <div class="mv-card-prompt"> </div> <div class="mv-card-meta"><span class="mv-meta-item"><!> </span> <span class="mv-meta-sep">·</span> <span class="mv-meta-item mono"> </span> <span class="mv-meta-sep">·</span> <span class="mv-meta-item mono"> </span> <span class="mv-meta-sep">·</span> <span class="mv-meta-item mono"> </span> <span class="mv-meta-sep">·</span> <span class="mv-meta-item mono"> </span> <!></div></button>');function Av(e,t){Ut(t,!1);const n=tt();let i=K(t,"session",8),s=K(t,"active",8,!1),o=K(t,"variant",8,"library");const r=Qe();function a(B){const j=B.turns[0];if(!j)return"";const H=j.steps.find(X=>X.kind==="user");return H&&H.kind==="user"?H.text:""}Mt(()=>D(i()),()=>{$(n,a(i()))}),ye(),Zt();var l=Pv();let c;var h=M(l),u=M(h),d=M(u);Pc(d,{get status(){return D(i()),P(()=>i().status)},get endedAt(){return D(i()),P(()=>i().endedAt)}});var f=A(d,2),p=M(f),m=A(u,2),v=M(m),_=A(h,2),b=M(_),x=A(_,2),k=M(x),S=M(k);Sv(S,{get harness(){return D(i()),P(()=>i().harness)},size:18});var w=A(S),C=A(k,4),y=M(C),T=A(C,4),E=M(T),R=A(T,4),O=M(R),V=A(R,4),z=M(V),I=A(V,2);{var F=B=>{var j=Cv(),H=A(fn(j),2);Bt(H,5,()=>(D(i()),P(()=>i().models)),X=>X,(X,G)=>{Ac(X,{children:(Z,_t)=>{var ot=ai();q(()=>L(ot,g(G))),N(Z,ot)},$$slots:{default:!0}})}),N(B,j)};ut(I,B=>{D(i()),P(()=>i().models.length>0)&&B(F)})}q((B,j,H)=>{c=Nt(l,1,`mv-card mv-card-${o()??""}`,null,c,{"is-active":s()}),L(p,(D(i()),P(()=>i().title))),L(v,B),L(b,g(n)),L(w,` ${D(i()),P(()=>i().harness.label)??""}`),L(y,`${D(i()),P(()=>i().turns.length)??""} turns`),L(E,`${j??""} tok`),L(O,`${D(i()),P(()=>i().totalToolCalls)??""} tools`),L(z,H)},[()=>(D(Ra),D(i()),P(()=>Ra(i().endedAt))),()=>(D(Hn),D(i()),P(()=>Hn(i().totalTokens))),()=>(D(me),D(i()),P(()=>me(i().durationMs)))]),Dt("click",l,()=>r("open",i())),N(e,l),Xt()}var Tv=W('<div class="mv-toolcall-body mv-toolcall-body-inline"><div class="mv-tc-section"><div class="mv-tc-label">arguments</div> <pre class="mv-tc-code"> </pre></div> <div class="mv-tc-section"><div class="mv-tc-label">result</div> <pre class="mv-tc-code"> </pre></div></div>'),Dv=W('<div><div class="mv-tl-dot"></div> <div class="mv-tl-time mono"> </div> <button type="button" class="mv-tl-body mv-tl-body-btn"><div class="mv-tl-headrow"><span class="mv-tl-kind">tool</span> <span class="mv-toolcall-name mono"> </span> <span class="mv-toolcall-latency mono"> </span></div> <div class="mv-toolcall-arg mono"> </div> <!></button></div>'),Ov=W('<span class="mono mv-tl-model"> </span>'),Ev=W('<div><div class="mv-tl-dot"></div> <div class="mv-tl-time mono"> </div> <div class="mv-tl-body"><div class="mv-tl-headrow"><span class="mv-tl-kind"> </span> <!></div> <div class="mv-tl-text"> </div></div></div>'),Lv=W('<div class="mv-turn mv-turn-timeline"><div class="mv-tl-spine"></div> <!></div>'),Rv=W('<div class="mv-tr-tick"><span class="mono"> </span></div>'),Iv=W('<div class="mv-tr-expand"><div class="mv-tc-section"><div class="mv-tc-label">arguments</div> <pre class="mv-tc-code"> </pre></div> <div class="mv-tc-section"><div class="mv-tc-label">result</div> <pre class="mv-tc-code"> </pre></div></div>'),Fv=W('<div class="mv-tr-text"> </div>'),zv=W('<div><div class="mv-tr-label mono"> </div> <div class="mv-tr-track"><button type="button"><span class="mv-tr-bar-text mono"><!></span></button></div> <!></div>'),Nv=W('<div class="mv-turn mv-turn-trace"><div class="mv-tr-axis"></div> <!></div>'),Bv=W('<div class="mv-doc-tool-body"><div class="mv-tc-section"><div class="mv-tc-label">arguments</div> <pre class="mv-tc-code"> </pre></div> <div class="mv-tc-section"><div class="mv-tc-label">result</div> <pre class="mv-tc-code"> </pre></div></div>'),Vv=W('<div class="mv-doc-tool"><button type="button" class="mv-doc-tool-head"><span class="mv-doc-marker">§</span> <span class="mono mv-doc-tool-name"> </span> <span class="mv-doc-tool-summary mono"> </span> <span class="mv-doc-tool-latency mono"> </span></button> <!></div>'),Wv=W('<div><span class="mv-doc-speaker"> </span> <span class="mv-doc-text"> </span></div>'),Hv=W('<div class="mv-turn mv-turn-document"></div>'),jv=W('<div class="mv-bubble mv-bubble-user"><div class="mv-bubble-role">User</div> <div class="mv-bubble-text"> </div></div>'),$v=W('<div class="mv-bubble mv-bubble-assistant"><div class="mv-bubble-role">Assistant <span class="mv-bubble-meta"> </span></div> <div class="mv-bubble-text"> </div></div>'),Yv=W('<span class="mv-toolcall-err">error</span>'),Uv=W('<div class="mv-toolcall-body"><div class="mv-tc-section"><div class="mv-tc-label">arguments</div> <pre class="mv-tc-code"> </pre></div> <div class="mv-tc-section"><div class="mv-tc-label">result</div> <pre class="mv-tc-code"> </pre></div></div>'),Xv=W('<div><button type="button" class="mv-toolcall-head"><span class="mv-tri">▸</span> <span class="mv-toolcall-name mono"> </span> <span class="mv-toolcall-arg mono"> </span> <span class="mv-toolcall-latency mono"> </span> <!></button> <!></div>'),qv=W('<div class="mv-turn mv-turn-chat"></div>');function Kv(e,t){Ut(t,!1);const n=tt(),i=tt();let s=K(t,"turn",8),o=K(t,"variant",8,"chat"),r=K(t,"expandedTools",24,()=>new Set),a=K(t,"hideUserSteps",8,!1);const l=Qe();function c(x,k){return`${s().idx}:${k}`}function h(x){return"text"in x&&typeof x.text=="string"}function u(x){const k=x.startedAt,S=x.steps.map(C=>C.kind==="tool_call"?C.resultAt:C.at),w=Math.max(x.endedAt,...S);return{start:k,span:Math.max(1,w-k)}}const d=[0,.25,.5,.75,1];Mt(()=>(D(a()),D(s())),()=>{$(n,a()?s().steps.filter(x=>x.kind!=="user"):s().steps)}),Mt(()=>D(s()),()=>{$(i,u(s()))}),ye(),Zt();var f=ti(),p=fn(f);{var m=x=>{var k=Lv(),S=A(M(k),2);Bt(S,3,()=>(D(s()),P(()=>s().steps)),(w,C)=>c(w,C),(w,C,y)=>{const T=Pt(()=>(g(C),D(g(y)),P(()=>c(g(C),g(y)))));var E=ti(),R=fn(E);{var O=z=>{const I=Pt(()=>(D(r()),D(g(T)),P(()=>r().has(g(T)))));var F=Dv();let B;var j=A(M(F),2),H=M(j),X=A(j,2),G=M(X),Z=A(M(G),2),_t=M(Z),ot=A(Z,2),ct=M(ot),rt=A(G,2),Y=M(rt),xt=A(rt,2);{var St=dt=>{var it=Tv(),pt=M(it),Qt=A(M(pt),2),we=M(Qt),nn=A(pt,2),lt=A(M(nn),2),yt=M(lt);q(qt=>{L(we,qt),L(yt,(g(C),P(()=>g(C).result)))},[()=>(g(C),P(()=>JSON.stringify(g(C).args,null,2)))]),N(dt,it)};ut(xt,dt=>{g(I)&&dt(St)})}q((dt,it)=>{B=Nt(F,1,"mv-tl-node mv-tl-tool_call",null,B,{"is-error":g(C).status==="error"}),L(H,dt),ve(X,"aria-expanded",g(I)),L(_t,(g(C),P(()=>g(C).tool))),L(ct,`${g(C),P(()=>g(C).latencyMs)??""}ms`),L(Y,it)},[()=>(D(ie),g(C),P(()=>ie(g(C).at))),()=>(D(We),g(C),P(()=>We(g(C).args)))]),Dt("click",X,()=>l("toggleTool",g(T))),N(z,F)},V=z=>{var I=Ev(),F=A(M(I),2),B=M(F),j=A(F,2),H=M(j),X=M(H),G=M(X),Z=A(X,2);{var _t=rt=>{var Y=Ov(),xt=M(Y);q(()=>L(xt,(D(s()),P(()=>s().model)))),N(rt,Y)};ut(Z,rt=>{g(C),P(()=>g(C).kind==="assistant")&&rt(_t)})}var ot=A(H,2),ct=M(ot);q((rt,Y)=>{Nt(I,1,`mv-tl-node mv-tl-${g(C),P(()=>g(C).kind)??""}`),L(B,rt),L(G,(g(C),P(()=>g(C).kind==="user"?"user":"assistant"))),L(ct,Y)},[()=>(D(ie),g(C),P(()=>ie(g(C).at))),()=>(g(C),P(()=>h(g(C))?g(C).text:""))]),N(z,I)};ut(R,z=>{g(C),P(()=>g(C).kind==="tool_call")?z(O):z(V,!1)})}N(w,E)}),N(x,k)},v=x=>{var k=Nv(),S=M(k);Bt(S,5,()=>d,wo,(C,y)=>{var T=Rv(),E=M(T),R=M(E);q(O=>{Ji(T,`left: ${g(y)*100}%`),L(R,O)},[()=>(D(me),g(i),g(y),P(()=>me(Math.round(g(i).span*g(y)))))]),N(C,T)});var w=A(S,2);Bt(w,3,()=>g(n),(C,y)=>c(C,y),(C,y,T)=>{const E=Pt(()=>(g(y),D(g(T)),P(()=>c(g(y),g(T))))),R=Pt(()=>(g(y),P(()=>g(y).at))),O=Pt(()=>(g(y),P(()=>g(y).kind==="tool_call"?g(y).resultAt:g(y).at+600))),V=Pt(()=>(D(g(R)),g(i),P(()=>(g(R)-g(i).start)/g(i).span*100))),z=Pt(()=>(D(g(O)),D(g(R)),g(i),P(()=>Math.max(1,(g(O)-g(R))/g(i).span*100)))),I=Pt(()=>(D(r()),D(g(E)),P(()=>r().has(g(E))))),F=Pt(()=>(g(y),P(()=>g(y).kind==="tool_call"?g(y).tool:g(y).kind==="user"?"user":"assistant")));var B=zv(),j=M(B),H=M(j),X=A(j,2),G=M(X);let Z;var _t=M(G),ot=M(_t);{var ct=it=>{var pt=ai();q(()=>L(pt,`${g(y),P(()=>g(y).tool)??""} · ${g(y),P(()=>g(y).latencyMs)??""}ms`)),N(it,pt)},rt=it=>{var pt=ai();q(()=>L(pt,`${g(y),P(()=>g(y).kind)??""} · ${g(y),P(()=>g(y).tokens)??""} tok`)),N(it,pt)},Y=it=>{var pt=ai();q(()=>L(pt,(g(y),P(()=>g(y).kind)))),N(it,pt)};ut(ot,it=>{g(y),P(()=>g(y).kind==="tool_call")?it(ct):(g(y),P(()=>g(y).kind==="assistant"&&g(y).tokens)?it(rt,1):it(Y,!1))})}var xt=A(X,2);{var St=it=>{var pt=Iv(),Qt=M(pt),we=A(M(Qt),2),nn=M(we),lt=A(Qt,2),yt=A(M(lt),2),qt=M(yt);q(It=>{L(nn,It),L(qt,(g(y),P(()=>g(y).result)))},[()=>(g(y),P(()=>JSON.stringify(g(y).args,null,2)))]),N(it,pt)},dt=it=>{var pt=Fv(),Qt=M(pt);q(we=>L(Qt,we),[()=>(g(y),P(()=>h(g(y))?g(y).text:""))]),N(it,pt)};ut(xt,it=>{g(y),D(g(I)),P(()=>g(y).kind==="tool_call"&&g(I))?it(St):(g(y),P(()=>g(y).kind!=="tool_call")&&it(dt,1))})}q(()=>{Nt(B,1,`mv-tr-row mv-tr-${g(y),P(()=>g(y).kind)??""}`),L(H,g(F)),Z=Nt(G,1,`mv-tr-bar mv-tr-bar-${g(y),P(()=>g(y).kind)??""}`,null,Z,{"is-error":g(y).kind==="tool_call"&&g(y).status==="error"}),Ji(G,`left: ${g(V)??""}%; width: ${g(z)??""}%`)}),Dt("click",G,()=>g(y).kind==="tool_call"&&l("toggleTool",g(E))),N(C,B)}),N(x,k)},_=x=>{var k=Hv();Bt(k,7,()=>(D(s()),P(()=>s().steps)),(S,w)=>c(S,w),(S,w,C)=>{const y=Pt(()=>(g(w),D(g(C)),P(()=>c(g(w),g(C)))));var T=ti(),E=fn(T);{var R=V=>{const z=Pt(()=>(D(r()),D(g(y)),P(()=>r().has(g(y)))));var I=Vv(),F=M(I),B=A(M(F),2),j=M(B),H=A(B,2),X=M(H),G=A(H,2),Z=M(G),_t=A(F,2);{var ot=ct=>{var rt=Bv(),Y=M(rt),xt=A(M(Y),2),St=M(xt),dt=A(Y,2),it=A(M(dt),2),pt=M(it);q(Qt=>{L(St,Qt),L(pt,(g(w),P(()=>g(w).result)))},[()=>(g(w),P(()=>JSON.stringify(g(w).args,null,2)))]),N(ct,rt)};ut(_t,ct=>{g(z)&&ct(ot)})}q(ct=>{L(j,(g(w),P(()=>g(w).tool))),L(X,ct),L(Z,`${g(w),P(()=>g(w).latencyMs)??""}ms`)},[()=>(D(We),g(w),P(()=>We(g(w).args)))]),Dt("click",F,()=>l("toggleTool",g(y))),N(V,I)},O=V=>{var z=Wv(),I=M(z),F=M(I),B=A(I,2),j=M(B);q(H=>{Nt(z,1,`mv-doc-line mv-doc-line-${g(w),P(()=>g(w).kind)??""}`),L(F,(g(w),P(()=>g(w).kind==="user"?"U":"A"))),L(j,H)},[()=>(g(w),P(()=>h(g(w))?g(w).text:""))]),N(V,z)};ut(E,V=>{g(w),P(()=>g(w).kind==="tool_call")?V(R):V(O,!1)})}N(S,T)}),N(x,k)},b=x=>{var k=qv();Bt(k,7,()=>(D(s()),P(()=>s().steps)),(S,w)=>c(S,w),(S,w,C)=>{const y=Pt(()=>(g(w),D(g(C)),P(()=>c(g(w),g(C)))));var T=ti(),E=fn(T);{var R=z=>{var I=jv(),F=A(M(I),2),B=M(F);q(()=>L(B,(g(w),P(()=>g(w).text)))),N(z,I)},O=z=>{var I=$v(),F=M(I),B=A(M(F)),j=M(B),H=A(F,2),X=M(H);q(()=>{L(j,(D(s()),P(()=>s().model))),L(X,(g(w),P(()=>g(w).text)))}),N(z,I)},V=z=>{const I=Pt(()=>(D(r()),D(g(y)),P(()=>r().has(g(y)))));var F=Xv();let B;var j=M(F),H=M(j),X=A(H,2),G=M(X),Z=A(X,2),_t=M(Z),ot=A(Z,2),ct=M(ot),rt=A(ot,2);{var Y=dt=>{var it=Yv();N(dt,it)};ut(rt,dt=>{g(w),P(()=>g(w).status==="error")&&dt(Y)})}var xt=A(j,2);{var St=dt=>{var it=Uv(),pt=M(it),Qt=A(M(pt),2),we=M(Qt),nn=A(pt,2),lt=A(M(nn),2),yt=M(lt);q(qt=>{L(we,qt),L(yt,(g(w),P(()=>g(w).result)))},[()=>(g(w),P(()=>JSON.stringify(g(w).args,null,2)))]),N(dt,it)};ut(xt,dt=>{g(I)&&dt(St)})}q(dt=>{B=Nt(F,1,"mv-toolcall",null,B,{"is-error":g(w).status==="error"}),ve(j,"aria-expanded",g(I)),ve(H,"data-open",g(I)?"true":"false"),L(G,(g(w),P(()=>g(w).tool))),L(_t,dt),L(ct,`${g(w),P(()=>g(w).latencyMs)??""}ms`)},[()=>(D(We),g(w),P(()=>We(g(w).args)))]),Dt("click",j,()=>l("toggleTool",g(y))),N(z,F)};ut(E,z=>{g(w),P(()=>g(w).kind==="user")?z(R):(g(w),P(()=>g(w).kind==="assistant")?z(O,1):(g(w),P(()=>g(w).kind==="tool_call")&&z(V,2)))})}N(S,T)}),N(x,k)};ut(p,x=>{o()==="timeline"?x(m):o()==="trace"?x(v,1):o()==="document"?x(_,2):x(b,!1)})}N(e,f),Xt()}var Gv=W('<div class="mv-node mv-node-boundary"><span class="mv-node-time mono"> </span> <span class="mv-node-dot"></span> <div class="mv-node-body"><span class="mv-node-label mono"> </span> <span class="mv-node-meta mono"> </span></div></div>'),Jv=W('<div class="mv-node mv-node-user"><span class="mv-node-time mono"> </span> <span class="mv-node-dot"></span> <div class="mv-node-body"><span class="mv-node-label mono">user</span> <span class="mv-node-text"> </span></div></div>'),Zv=W('<div class="mv-node mv-node-assistant"><span class="mv-node-time mono"> </span> <span class="mv-node-dot"></span> <div class="mv-node-body"><span class="mv-node-label mono">assistant</span> <span class="mv-node-text"> </span></div></div>'),Qv=W('<span class="mv-node-err">error</span>'),t_=W('<div class="mv-node-toolbody"><div class="mv-tc-section"><div class="mv-tc-label">arguments</div> <pre class="mv-tc-code"> </pre></div> <div class="mv-tc-section"><div class="mv-tc-label">result</div> <pre class="mv-tc-code"> </pre></div></div>'),e_=W('<div><span class="mv-node-time mono"> </span> <span class="mv-node-dot"></span> <div class="mv-node-body"><button type="button" class="mv-node-toolhead"><span class="mv-node-label mono">tool</span> <span class="mv-node-toolname mono"> </span> <span class="mv-node-toolarg mono"> </span> <span class="mv-node-toollat mono"> </span> <!> <span class="mv-node-tri">▸</span></button> <!></div></div>'),n_=W('<div class="mv-nodes"><div class="mv-nodes-spine" aria-hidden="true"></div> <!></div>');function i_(e,t){Ut(t,!1);const n=tt();let i=K(t,"session",8),s=K(t,"expandedTools",24,()=>new Set);const o=Qe();function r(c){const h=[];return c.turns.forEach((u,d)=>{d>0&&h.push({kind:"turn_boundary",turnIdx:d,at:u.startedAt,turn:u}),u.steps.forEach((f,p)=>{h.push({...f,key:`${d}:${p}`,turnIdx:d})})}),h}Mt(()=>D(i()),()=>{$(n,r(i()))}),ye(),Zt();var a=n_(),l=A(M(a),2);Bt(l,1,()=>g(n),wo,(c,h)=>{var u=ti(),d=fn(u);{var f=_=>{var b=Gv(),x=M(b),k=M(x),S=A(x,4),w=M(S),C=M(w),y=A(w,2),T=M(y);q((E,R,O,V)=>{L(k,E),L(C,`turn ${R??""}`),L(T,`${g(h),P(()=>g(h).turn.model)??""} · ${O??""} · ${V??""} tok`)},[()=>(D(ie),g(h),P(()=>ie(g(h).at))),()=>(g(h),P(()=>String(g(h).turnIdx+1).padStart(2,"0"))),()=>(D(me),g(h),P(()=>me(g(h).turn.durationMs))),()=>(D(Hn),g(h),P(()=>Hn(g(h).turn.totalTokens)))]),N(_,b)},p=_=>{var b=Jv(),x=M(b),k=M(x),S=A(x,4),w=A(M(S),2),C=M(w);q(y=>{L(k,y),L(C,(g(h),P(()=>g(h).text)))},[()=>(D(ie),g(h),P(()=>ie(g(h).at)))]),N(_,b)},m=_=>{var b=Zv(),x=M(b),k=M(x),S=A(x,4),w=A(M(S),2),C=M(w);q(y=>{L(k,y),L(C,(g(h),P(()=>g(h).text)))},[()=>(D(ie),g(h),P(()=>ie(g(h).at)))]),N(_,b)},v=_=>{const b=Pt(()=>(D(s()),g(h),P(()=>s().has(g(h).key)))),x=Pt(()=>(g(h),P(()=>g(h).status==="error")));var k=e_();let S;var w=M(k),C=M(w),y=A(w,4),T=M(y),E=A(M(T),2),R=M(E),O=A(E,2),V=M(O),z=A(O,2),I=M(z),F=A(z,2);{var B=G=>{var Z=Qv();N(G,Z)};ut(F,G=>{g(x)&&G(B)})}var j=A(F,2),H=A(T,2);{var X=G=>{var Z=t_(),_t=M(Z),ot=A(M(_t),2),ct=M(ot),rt=A(_t,2),Y=A(M(rt),2),xt=M(Y);q(St=>{L(ct,St),L(xt,(g(h),P(()=>g(h).result)))},[()=>(g(h),P(()=>JSON.stringify(g(h).args,null,2)))]),N(G,Z)};ut(H,G=>{g(b)&&G(X)})}q((G,Z)=>{S=Nt(k,1,"mv-node mv-node-tool",null,S,{"is-error":g(x),"is-open":g(b)}),L(C,G),ve(T,"aria-expanded",g(b)),L(R,(g(h),P(()=>g(h).tool))),L(V,Z),L(I,`${g(h),P(()=>g(h).latencyMs)??""}ms`),ve(j,"data-open",g(b)?"true":"false")},[()=>(D(ie),g(h),P(()=>ie(g(h).at))),()=>(D(We),g(h),P(()=>We(g(h).args)))]),Dt("click",T,()=>o("toggleTool",g(h).key)),N(_,k)};ut(d,_=>{g(h),P(()=>g(h).kind==="turn_boundary")?_(f):(g(h),P(()=>g(h).kind==="user")?_(p,1):(g(h),P(()=>g(h).kind==="assistant")?_(m,2):(g(h),P(()=>g(h).kind==="tool_call")&&_(v,3))))})}N(c,u)}),N(e,a),Xt()}var s_=W('<button class="mv-iconbtn" type="button" aria-label="Close session detail">✕</button>'),o_=W('<div class="mv-flame-prompt"><div class="mv-flame-prompt-head mono"><span class="mv-flame-prompt-label">user</span> <span class="mv-flame-prompt-meta"> </span></div> <div class="mv-flame-prompt-text"> </div></div>'),r_=W('<section class="mv-flame-turn"><!> <!></section>'),a_=W('<div class="mv-flame"></div>'),l_=W('<div><div class="mv-detail-head"><div class="mv-detail-titlerow"><!> <h3 class="mv-detail-title"> </h3> <div class="mv-viz-toggle" role="group" aria-label="Detail view"><button type="button">transcript</button> <button type="button">flamegraph</button></div> <!></div> <div class="mv-detail-metagrid"><div><div class="mv-meta-k">session id</div> <div class="mono mv-meta-v"> </div></div> <div><div class="mv-meta-k">trace id</div> <div class="mono mv-meta-v"> </div></div> <div><div class="mv-meta-k">started</div> <div class="mv-meta-v"> </div></div> <div><div class="mv-meta-k">duration</div> <div class="mono mv-meta-v"> </div></div> <div><div class="mv-meta-k">turns</div> <div class="mono mv-meta-v"> </div></div> <div><div class="mv-meta-k">tokens</div> <div class="mono mv-meta-v"> </div></div> <div><div class="mv-meta-k">tool calls</div> <div class="mono mv-meta-v"> </div></div> <div><div class="mv-meta-k">models</div> <div class="mv-meta-v"></div></div></div></div> <div class="mv-turns"><!></div></div>');function c_(e,t){Ut(t,!1);let n=K(t,"session",8),i=K(t,"layout",8,"sidepanel"),s=K(t,"closable",8,!1);const o=Qe();let r=tt(new Set),a=tt("transcript"),l=tt(null);function c(lt){const yt=new Set(g(r));yt.has(lt)?yt.delete(lt):yt.add(lt),$(r,yt)}function h(lt){$(a,lt)}Mt(()=>(D(n()),g(l)),()=>{n().id!==g(l)&&($(l,n().id),$(r,new Set))}),ye(),Zt();var u=l_(),d=M(u),f=M(d),p=M(f);Pc(p,{get status(){return D(n()),P(()=>n().status)},get endedAt(){return D(n()),P(()=>n().endedAt)}});var m=A(p,2),v=M(m),_=A(m,2),b=M(_);let x;var k=A(b,2);let S;var w=A(_,2);{var C=lt=>{var yt=s_();Dt("click",yt,()=>o("close")),N(lt,yt)};ut(w,lt=>{s()&<(C)})}var y=A(f,2),T=M(y),E=A(M(T),2),R=M(E),O=A(T,2),V=A(M(O),2),z=M(V),I=A(O,2),F=A(M(I),2),B=M(F),j=A(I,2),H=A(M(j),2),X=M(H),G=A(j,2),Z=A(M(G),2),_t=M(Z),ot=A(G,2),ct=A(M(ot),2),rt=M(ct),Y=A(ot,2),xt=A(M(Y),2),St=M(xt),dt=A(Y,2),it=A(M(dt),2);Bt(it,5,()=>(D(n()),P(()=>n().models)),lt=>lt,(lt,yt)=>{Ac(lt,{children:(qt,It)=>{var Un=ai();q(()=>L(Un,g(yt))),N(qt,Un)},$$slots:{default:!0}})});var pt=A(d,2),Qt=M(pt);{var we=lt=>{i_(lt,{get session(){return n()},get expandedTools(){return g(r)},$$events:{toggleTool:yt=>c(yt.detail)}})},nn=lt=>{var yt=a_();Bt(yt,7,()=>(D(n()),P(()=>n().turns)),qt=>qt.idx,(qt,It,Un)=>{const Xn=Pt(()=>(g(It),P(()=>g(It).steps.find(sn=>sn.kind==="user"))));var jo=r_(),$o=M(jo);{var Ec=sn=>{var Yo=o_(),Uo=M(Yo),Rc=A(M(Uo),2),Ic=M(Rc),Fc=A(Uo,2),zc=M(Fc);q((Nc,Bc,Vc)=>{L(Ic,`turn ${Nc??""} · ${g(It),P(()=>g(It).model||"—")??""} · ${Bc??""} · ${Vc??""} tok · ${g(It),P(()=>g(It).toolCalls)??""} tool${g(It),P(()=>g(It).toolCalls===1?"":"s")??""}`),L(zc,(D(g(Xn)),P(()=>g(Xn).text)))},[()=>(D(g(Un)),P(()=>String(g(Un)+1).padStart(2,"0"))),()=>(D(me),g(It),P(()=>me(g(It).durationMs))),()=>(D(Hn),g(It),P(()=>Hn(g(It).totalTokens)))]),N(sn,Yo)};ut($o,sn=>{D(g(Xn)),P(()=>g(Xn)&&g(Xn).kind==="user")&&sn(Ec)})}var Lc=A($o,2);Kv(Lc,{get turn(){return g(It)},variant:"trace",hideUserSteps:!0,get expandedTools(){return g(r)},$$events:{toggleTool:sn=>c(sn.detail)}}),N(qt,jo)}),N(lt,yt)};ut(Qt,lt=>{g(a)==="transcript"?lt(we):lt(nn,!1)})}q((lt,yt,qt)=>{Nt(u,1,`mv-detail mv-detail-${i()??""}`),L(v,(D(n()),P(()=>n().title))),ve(b,"aria-pressed",g(a)==="transcript"),x=Nt(b,1,"",null,x,{"is-active":g(a)==="transcript"}),ve(k,"aria-pressed",g(a)==="flamegraph"),S=Nt(k,1,"",null,S,{"is-active":g(a)==="flamegraph"}),L(R,(D(n()),P(()=>n().id))),L(z,(D(n()),P(()=>n().traceId))),L(B,lt),L(X,yt),L(_t,(D(n()),P(()=>n().turns.length))),L(rt,qt),L(St,(D(n()),P(()=>n().totalToolCalls)))},[()=>(D(Ia),D(n()),P(()=>Ia(n().startedAt))),()=>(D(me),D(n()),P(()=>me(n().durationMs))),()=>(D(n()),P(()=>n().totalTokens.toLocaleString()))]),Dt("click",b,()=>h("transcript")),Dt("click",k,()=>h("flamegraph")),N(e,u),Xt()}var h_=W('<div class="mv-empty">No sessions match these filters.</div>'),u_=W('<div class="mv-sidepanel-backdrop" role="presentation"></div> <div class="mv-sidepanel" role="dialog" aria-label="Session detail" aria-modal="true"><!></div>',1),d_=W('<div class="mv-v1"><div class="mv-v1-list mv-list"><!> <!></div> <!></div>');function f_(e,t){Ut(t,!1);const n=tt();let i=K(t,"sessions",8),s=tt(null);function o(m){$(s,m.id)}function r(){$(s,null)}function a(m){m.key==="Escape"&&$(s,null)}Pl(()=>{typeof window<"u"&&window.removeEventListener("keydown",a)}),Mt(()=>(D(i()),g(s)),()=>{$(n,i().find(m=>m.id===g(s))??null)}),Mt(()=>g(n),()=>{g(n)&&typeof window<"u"?window.addEventListener("keydown",a):typeof window<"u"&&window.removeEventListener("keydown",a)}),ye(),Zt();var l=d_(),c=M(l),h=M(c);{var u=m=>{var v=h_();N(m,v)};ut(h,m=>{D(i()),P(()=>i().length===0)&&m(u)})}var d=A(h,2);Bt(d,1,i,m=>m.id,(m,v)=>{{let _=Pt(()=>(g(v),g(s),P(()=>g(v).id===g(s))));Av(m,{get session(){return g(v)},get active(){return g(_)},variant:"library",$$events:{open:b=>o(b.detail)}})}});var f=A(c,2);{var p=m=>{var v=u_(),_=fn(v),b=A(_,2),x=M(b);c_(x,{get session(){return g(n)},layout:"sidepanel",closable:!0,$$events:{close:r}}),Dt("click",_,r),N(m,v)};ut(f,m=>{g(n)&&m(p)})}N(e,l),Xt()}var g_=W('<div class="mv-empty" role="status" aria-live="polite"> </div>'),p_=W('<div class="mv-empty">Loading sessions…</div>'),m_=W('<section class="panel mv-root" id="sessionsPanel"><div class="mv-section-head"><div class="mv-section-title"><h2>Sessions</h2> <span class="mv-section-subtitle">Search, inspect, and replay agent sessions.</span></div></div> <!> <!> <!></section>');function v_(e,t){Ut(t,!1);let n=K(t,"sessions",24,()=>[]),i=K(t,"filtered",24,()=>[]),s=K(t,"filter",24,()=>({query:"",model:"all",status:"all",harness:"all"})),o=K(t,"models",24,()=>[]),r=K(t,"harnesses",24,()=>[]),a=K(t,"loading",8,!1),l=K(t,"errorMessage",8,null);const c=Qe();function h(b){c("filterChange",b)}Zt();var u=m_(),d=A(M(u),2);{var f=b=>{var x=g_(),k=M(x);q(()=>L(k,l())),N(b,x)};ut(d,b=>{l()&&b(f)})}var p=A(d,2);xv(p,{get filter(){return s()},get models(){return o()},get harnesses(){return r()},get count(){return D(i()),P(()=>i().length)},get total(){return D(n()),P(()=>n().length)},$$events:{change:b=>h(b.detail)}});var m=A(p,2);{var v=b=>{var x=p_();N(b,x)},_=b=>{f_(b,{get sessions(){return i()}})};ut(m,b=>{D(a()),D(n()),P(()=>a()&&n().length===0)?b(v):b(_,!1)})}N(e,u),Xt()}var __=W('<header class="top-bar"><div class="brand"><h1>Moraine Monitor</h1> <span class="brand-live" title="Updating live">live</span></div> <div class="top-actions"><div class="theme-switch" role="group" aria-label="Theme"><button id="themeLight" type="button" aria-label="Light theme"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4"></circle><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"></path></svg></button> <button id="themeDark" type="button" aria-label="Dark theme"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M20 14.5A8 8 0 0 1 9.5 4a7 7 0 1 0 10.5 10.5z"></path></svg></button></div></div></header>');function b_(e,t){Ut(t,!1);let n=K(t,"theme",8,"light");const i=Qe();function s(h){h!==n()&&i("setTheme",h)}Zt();var o=__(),r=A(M(o),2),a=M(r),l=M(a),c=A(l,2);q(()=>{ve(l,"aria-pressed",n()==="light"),ve(c,"aria-pressed",n()==="dark")}),Dt("click",l,()=>s("light")),Dt("click",c,()=>s("dark")),N(e,o),Xt()}async function Ho(e){const t=await fetch(e,{headers:{Accept:"application/json"}});if(!t.ok){let n;if((t.headers.get("content-type")??"").includes("application/json"))try{n=(await t.json()).error}catch{n=void 0}throw new Error(n||`request failed (${t.status})`)}return await t.json()}function x_(){return Ho("/api/health")}function y_(){return Ho("/api/status")}function w_(e){return Ho(`/api/analytics?range=${encodeURIComponent(e)}`)}const k_=["claude-sonnet-4-5","claude-haiku-4-5","claude-opus-4-1","gpt-5.1-mini"],S_=["read_file","write_file","str_replace_edit","grep","list_files","run_script","web_fetch","web_search","save_screenshot","show_html"],M_=["code-review","triage","refactor","debug","design","research","migration"],Fa=["Add pagination to the session list API and update the Svelte client to use cursor-based navigation.","We’re seeing ingestor heartbeat stale around 3am UTC — can you trace the last three occurrences?","Refactor the analytics panel so the three charts share a single theme hook and re-render on theme change.","Draft a migration plan to move from single-node ClickHouse to a replicated cluster without downtime.","Investigate why turns with gpt-5.1-mini are missing from the token chart for the 7d range.","Design a landing page that replaces the raw table with a session viewer.","Write a Vitest suite for the new url parser that covers edge cases for web_searches.","Can you audit our Playwright e2e for flakiness and suggest fixes?","Summarize the last 20 errors in the ingestor log and group them by root cause.","Build a CLI that tails the agent_turns table and prints a live throughput readout.","Help me outline a blog post about the Moraine architecture, about 800 words."],za=["Looking at the current pagination, it’s offset-based. I’ll switch the handler to cursor-based and update the client store to match.","The heartbeat table shows three entries with age > 300s. Let me pull the surrounding rows to look for clustering.","I’ll read theme.ts first and then extract a shared createChartTheme() that both panels can call on change.","Before drafting, let me enumerate the tables that need replication and confirm which have TTLs.","Checking the bucket axis for 7d — it looks like the top-8 model filter is excluding gpt-5.1-mini when its share drops below 2%.","I’ll sketch four variations exploring layout, visual tone, and turn visualization, then we can iterate.","Starting with the url parser tests — I’ll cover http vs https, missing hosts, javascript: scheme, and empty strings.","First I’ll tally the flaky spec runs from the last 30 days, then cross-reference with recent selector changes.","I can group errors by the first line of the stacktrace. Pulling the last 20 now.","I’ll tail with an interval poll on agent_turns and render a compact line chart in the terminal.","Let me skim a few recent docs so the post reflects the current state and not what we had six months ago."],C_={read_file:[{path:"web/monitor/src/App.svelte"},{path:"web/monitor/src/lib/charts/analytics.ts"}],write_file:[{path:"web/monitor/src/lib/session-viewer/SessionList.svelte",content:'<script lang="ts">...'}],str_replace_edit:[{path:"web/monitor/src/App.svelte",old_string:"<TablePanel ...",new_string:"<SessionPanel ..."}],grep:[{pattern:"fetchTableDetail",path:"web/monitor/src"}],list_files:[{path:"web/monitor/src/lib"}],run_script:[{code:'const r = await fetch("/api/sessions?cursor=0"); log(r.status);'}],web_fetch:[{url:"https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/replication"}],web_search:[{query:"svelte 5 runes migration guide"}],save_screenshot:[{path:"Moraine Monitor.html",save_path:"screenshots/session-list.png"}],show_html:[{path:"Moraine Monitor.html"}]},P_={read_file:"Read 229 lines, 7031 chars. Top-level: imports, state, hydrateFast/Slow, 8 event handlers, onMount.",write_file:"Wrote 3,482 characters to web/monitor/src/lib/session-viewer/SessionList.svelte",str_replace_edit:"Applied 1 edit. 0 lines added, 0 removed.",grep:"4 matches across 2 files.",list_files:"api/ charts/ components/ constants.ts state/ types/ utils/ view/",run_script:'200 OK. { "ok": true, "cursor": "eyJzZWVkIjoxfQ==", "sessions": [ ... 25 items ... ] }',web_fetch:"Fetched 184 KB. Extracted 12,402 words on ReplicatedMergeTree, Keeper setup, and config.xml macros.",web_search:'10 results. Top: "Svelte 5 runes — official migration guide", "$state vs stores", "Migration gotchas".',save_screenshot:"Captured screenshots/session-list.png (1440x900, 312 KB).",show_html:"Opened Moraine Monitor.html in preview. No console errors."},A_=[{id:"claude-code",label:"claude-code",short:"CC",hue:25},{id:"codex",label:"codex",short:"CX",hue:150},{id:"hermes",label:"hermes",short:"HM",hue:265},{id:"cursor",label:"cursor",short:"CU",hue:200},{id:"aider",label:"aider",short:"AD",hue:340},{id:"cli",label:"cli",short:"CL",hue:60}],Na=["Cursor pagination for sessions API","Investigate stale ingestor heartbeat at 03:00 UTC","Refactor analytics panel theme plumbing","Draft: single-node → replicated ClickHouse migration","gpt-5.1-mini missing from 7d token chart","Session viewer landing page — explorations","Vitest suite for url parser edge cases","Playwright flake audit — last 30 days","Cluster last 20 ingestor errors by root cause","CLI: live agent_turns throughput tail","Moraine architecture blog draft","Add dark theme parity for StatGrid","Cost explorer — research","Cancel handling for mid-turn aborts","Type-only circular import cleanup"];function T_(e){let t=e|0;return()=>(t=t*1664525+1013904223|0,(t>>>0)/4294967296)}function D_(e){const t=T_(e),n=a=>a[Math.floor(t()*a.length)],i=(a,l)=>a+Math.floor(t()*(l-a+1));function s(){const a=["Now try it with the 7d range.","Can you show me the diff?","Looks good — commit and move on.","Wait, I don’t think that’s right. Check the tailwind config.","Keep going.","Any other places this pattern shows up?","Summarize what you changed so far.","Revert that last change and try something different.","Write a test for this before we continue."];return a[Math.floor(t()*a.length)]}function o(a,l,c){const h=i(0,Fa.length-1),u=n(k_),d=t()<.45?i(1,4):t()<.5?i(0,1):0,f=l-c,p=i(1200,42e3),m=[];m.push({kind:"user",at:f,text:a===0?Fa[h]:s()});const v=i(1,d>0?3:2);let _=f+i(200,1800);for(let k=0;k<v;k++)if(m.push({kind:"assistant",at:_,text:za[i(0,za.length-1)],tokens:i(60,820)}),_+=i(300,4500),k<d){const S=n(S_),w=C_[S]||[{}],C=w[Math.floor(t()*w.length)],y=_;_+=i(200,6500);const T=_;_+=i(100,2200);const E={kind:"tool_call",at:y,tool:S,args:C,latencyMs:T-y,result:P_[S]||"ok",resultAt:T,status:t()<.08?"error":"ok"};m.push(E)}const b=i(300,6400),x=i(80,2200);return{idx:a,model:u,startedAt:f,endedAt:f+p,durationMs:p,promptTokens:b,completionTokens:x,totalTokens:b+x,toolCalls:m.filter(k=>k.kind==="tool_call").length,steps:m}}function r(a,l){const c=i(2,9),h=l-i(6e4,72*36e5),u=n(A_),d=i(0,3),f=new Set;for(;f.size<d;)f.add(n(M_));const p=[];let m=l-h;for(let y=0;y<c;y++){const T=o(y,l,m);if(p.push(T),m-=T.durationMs+i(1200,9e4),m<0)break}p.reverse();const v=p.reduce((y,T)=>y+T.totalTokens,0),_=p.reduce((y,T)=>y+T.toolCalls,0),b=[...new Set(p.map(y=>y.model))],k=p[p.length-1].endedAt,S=k-h,w=["active","cancelled","error"],C=t()<.78?"completed":n(w);return{id:"sess_"+Math.floor(t()*1e12).toString(16).padStart(10,"0"),title:Na[a%Na.length],harness:u,startedAt:h,endedAt:k,durationMs:S,status:C,models:b,turns:p,totalTokens:v,totalToolCalls:_,tags:[...f],traceId:"tr_"+Math.floor(t()*1e14).toString(16).padStart(12,"0")}}return{genSession:r}}function O_(e=24,t=7,n=Date.now()){const{genSession:i}=D_(t);return Array.from({length:e},(s,o)=>i(o,n))}async function E_(e={}){const{allowMock:t=!0}=e;try{const n=await fetch("/api/sessions",{headers:{Accept:"application/json"}});if(n.ok){const i=await n.json();if(i.ok&&Array.isArray(i.sessions))return i.sessions;if(i.error)throw new Error(i.error)}else if(n.status!==404)throw new Error(`sessions request failed (${n.status})`)}catch(n){if(!t)throw n}return O_()}const Ns=Mn("24h"),lo=Mn([]),Bs=Mn(!1),Vs=Mn(null),co=Mn({query:"",model:"all",status:"all",harness:"all"});function L_(e,t){const n=t.query.trim().toLowerCase();return e.filter(i=>{if(t.model!=="all"&&!i.models.includes(t.model)||t.status!=="all"&&i.status!==t.status||t.harness!=="all"&&i.harness.id!==t.harness)return!1;if(!n||i.title.toLowerCase().includes(n)||i.id.toLowerCase().includes(n)||i.harness.label.toLowerCase().includes(n)||i.tags.some(s=>s.toLowerCase().includes(n)))return!0;for(const s of i.turns)for(const o of s.steps)if("text"in o&&o.text&&o.text.toLowerCase().includes(n)||o.kind==="tool_call"&&o.tool.toLowerCase().includes(n))return!0;return!1})}const R_=bu([lo,co],([e,t])=>[...L_(e,t)].sort((i,s)=>s.endedAt-i.endedAt)),Tc=Mn("light");function I_(){try{const e=window.localStorage.getItem(Al);if(e==="light"||e==="dark")return e}catch{}return null}function F_(){const e=I_();return e||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}function z_(e){document.documentElement.setAttribute("data-theme",e)}function N_(e){try{window.localStorage.setItem(Al,e)}catch{}}function Dc(e){z_(e),N_(e),Tc.set(e)}function B_(){Dc(F_())}var V_=W('<div class="app-shell"><!> <main class="layout"><!> <!> <!></main></div>');function W_(e,t){Ut(t,!1);const n=()=>on(lo,"$sessionsStore",c),i=()=>on(R_,"$filteredSessionsStore",c),s=()=>on(co,"$sessionsFilterStore",c),o=()=>on(Bs,"$sessionsLoadingStore",c),r=()=>on(Vs,"$sessionsErrorStore",c),a=()=>on(Tc,"$themeStore",c),l=()=>on(Ns,"$analyticsRangeStore",c),[c,h]=xu(),u=tt(),d=tt(),f=tt(),p=tt(),m=tt(),v=tt(),_=tt(),b=3e4;let x=tt(null),k=tt(null),S=tt(null),w=tt(null),C=tt(null),y=tt(null);function T(Y){const xt=new Set;for(const St of Y)for(const dt of St.models)xt.add(dt);return[...xt].sort()}function E(Y){const xt=new Map;for(const St of Y)xt.has(St.harness.id)||xt.set(St.harness.id,St.harness);return[...xt.values()].sort((St,dt)=>St.label.localeCompare(dt.label))}function R(Y){return Y instanceof Error?Y.message:String(Y)}async function O(){try{$(x,await x_()),$(k,null)}catch(Y){$(k,R(Y)),$(x,null)}}async function V(){try{$(S,await y_()),$(w,null)}catch(Y){$(w,R(Y)),$(S,null)}}async function z(){try{$(C,await w_(Ml(Ns))),$(y,null)}catch(Y){$(y,`Analytics unavailable: ${R(Y)}`)}}async function I(){Bs.set(!0);try{const Y=await E_();lo.set(Y),Vs.set(null)}catch(Y){Vs.set(`Sessions unavailable: ${R(Y)}`)}finally{Bs.set(!1)}}async function F(){await Promise.all([O(),V()])}async function B(){await Promise.all([z(),I()])}async function j(Y){Ns.set(Y.detail),await z()}function H(Y){Dc(Y.detail)}function X(Y){co.set(Y.detail)}Cl(()=>{B_(),F(),B();const Y=window.setInterval(()=>{F()},Cu),xt=window.setInterval(()=>{z()},Pu),St=window.setInterval(()=>{I()},b);return()=>{window.clearInterval(Y),window.clearInterval(xt),window.clearInterval(St)}}),Mt(()=>n(),()=>{$(u,n())}),Mt(()=>i(),()=>{$(d,i())}),Mt(()=>s(),()=>{$(f,s())}),Mt(()=>o(),()=>{$(p,o())}),Mt(()=>r(),()=>{$(m,r())}),Mt(()=>g(u),()=>{$(v,T(g(u)))}),Mt(()=>g(u),()=>{$(_,E(g(u)))}),ye(),Zt();var G=V_(),Z=M(G);b_(Z,{get theme(){return a()},$$events:{setTheme:H}});var _t=A(Z,2),ot=M(_t);fv(ot,{get health(){return g(x)},get healthError(){return g(k)},get status(){return g(S)},get statusError(){return g(w)}});var ct=A(ot,2);av(ct,{get payload(){return g(C)},get selectedRange(){return l()},get errorMessage(){return g(y)},get theme(){return a()},$$events:{rangeChange:j}});var rt=A(ct,2);v_(rt,{get sessions(){return g(u)},get filtered(){return g(d)},get filter(){return g(f)},get models(){return g(v)},get harnesses(){return g(_)},get loading(){return g(p)},get errorMessage(){return g(m)},$$events:{filterChange:X}}),N(e,G),Xt(),h()}const Oc=document.getElementById("app");if(!Oc)throw new Error('Failed to mount monitor UI: expected mount node "#app" in the DOM.');iu(W_,{target:Oc});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>Moraine Monitor</title>
|
|
7
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
8
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
9
|
+
<link
|
|
10
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Sora:wght@400;500;600;700&display=swap"
|
|
11
|
+
rel="stylesheet"
|
|
12
|
+
/>
|
|
13
|
+
<script type="module" crossorigin src="/app.js"></script>
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/styles.css">
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<div id="app"></div>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}*{box-sizing:border-box}body{margin:0;min-height:100vh;font-family:Sora,Segoe UI,sans-serif;color:var(--text);background:var(--body-bg)}h2{margin-bottom:.75rem;margin-top:0;font-size:1.125rem;line-height:1.75rem;letter-spacing:-.01em}h3{margin-bottom:.5rem;margin-top:0;font-size:.875rem;line-height:1.25rem;letter-spacing:.01em;color:var(--title)}.app-shell{margin-left:auto;margin-right:auto;margin-top:1rem;margin-bottom:1rem;padding:.75rem;width:min(1680px,calc(100vw - 2rem))}.layout{display:grid;gap:.75rem;grid-template-columns:1fr}.top-bar{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.375rem .5rem .625rem;margin-bottom:.625rem}.top-bar h1{margin:0;font-size:clamp(1.75rem,2.4vw,2.5rem);letter-spacing:-.025em;font-weight:700;color:var(--title);line-height:1}.brand{display:flex;align-items:baseline;gap:.625rem;min-width:0}.brand-live{display:inline-flex;align-items:center;gap:.375rem;font-size:.6875rem;text-transform:uppercase;letter-spacing:.08em;color:var(--subtle);font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace}.brand-live:before{content:"";width:6px;height:6px;border-radius:50%;background:var(--good);box-shadow:0 0 0 3px color-mix(in oklab,var(--good) 25%,transparent);animation:mv-pulse 2s ease-in-out infinite}@keyframes mv-pulse{0%,to{opacity:1}50%{opacity:.45}}.top-actions{display:flex;align-items:center;gap:.5rem}.theme-switch{display:inline-flex;align-items:center;padding:2px;border-radius:999px;background:var(--range-bg);border:1px solid var(--line);gap:0}.theme-switch button{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;background:transparent;cursor:pointer;width:26px;height:22px;display:inline-flex;align-items:center;justify-content:center;border-radius:999px;color:var(--subtle);font-family:inherit;transition:background .12s ease,color .12s ease;padding:0}.theme-switch button svg{width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}.theme-switch button[aria-pressed=true]{background:var(--panel);color:var(--title);box-shadow:0 1px 2px #0000000f}.panel{border-radius:1rem;border-width:1px;padding:1rem;background:var(--panel);border-color:var(--line-strong);box-shadow:var(--shadow)}.analytics-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.75rem}.range-group{display:flex;flex-wrap:wrap;gap:.5rem}.range-group button{cursor:pointer;border-radius:.375rem;border-width:1px;padding:.25rem .625rem;font-size:.75rem;line-height:1rem;border-color:var(--line-strong);background:var(--range-bg);color:var(--range-text);font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace}.range-group button.active{background:var(--range-active-bg);border-color:var(--range-active-border);color:var(--range-active-text);font-weight:700}.range-group button.\!active{background:var(--range-active-bg)!important;border-color:var(--range-active-border)!important;color:var(--range-active-text)!important;font-weight:700!important}.chart-grid{margin-top:.5rem;display:grid;gap:.75rem;grid-template-columns:repeat(auto-fit,minmax(360px,1fr))}.chart-card{display:flex;min-height:245px;flex-direction:column;border-radius:.75rem;border-width:1px;padding:.75rem;border-color:var(--line);background:var(--panel-alt)}.chart-wrap{position:relative;height:250px;width:100%;overflow:hidden}.chart-wrap canvas{width:100%!important;height:100%!important;display:block}.muted{color:var(--subtle)}.top-8{top:2rem}.inline{display:inline}.table{display:table}.grid{display:grid}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:root{color-scheme:light;--bg-start: #f5f8fb;--bg-end: #ecf1f5;--body-bg: radial-gradient(circle at 10% 10%, #ffffff 0%, rgba(255, 255, 255, 0) 28%), radial-gradient(circle at 90% 0%, #e3f0f8 0%, rgba(227, 240, 248, 0) 30%), linear-gradient(155deg, var(--bg-start), var(--bg-end));--panel: #ffffff;--panel-alt: #f6f9fc;--line: #d7e2ec;--line-strong: #c1cfdb;--text: #102132;--subtle: #5a6b7b;--title: #263748;--surface: #fbfdff;--active-bg: #e9f4fa;--header-bg: #edf4fa;--header-text: #334a5c;--row-stripe: #f9fcff;--primary: #155e75;--primary-strong: #0f4d5f;--good: #0f766e;--warn: #b45309;--bad: #be123c;--topbar-bg: linear-gradient(180deg, #f8fbff 0%, #f0f6fb 100%);--range-bg: #ffffff;--range-text: #334a5c;--range-active-bg: #e0f0f6;--range-active-border: #8eb9c8;--range-active-text: #0e4f64;--chart-grid: #e8eff4;--chart-text: #435568;--shadow: 0 10px 30px rgba(16, 33, 50, .08)}[data-theme=dark]{color-scheme:dark;--bg-start: #0b1320;--bg-end: #101b2d;--body-bg: radial-gradient(circle at 8% 12%, #17243a 0%, rgba(23, 36, 58, 0) 32%), radial-gradient(circle at 88% 4%, #173047 0%, rgba(23, 48, 71, 0) 28%), linear-gradient(160deg, var(--bg-start), var(--bg-end));--panel: #121d2c;--panel-alt: #152235;--line: #2a3b52;--line-strong: #355070;--text: #dbe6f4;--subtle: #93a9c2;--title: #e1ebf9;--surface: #122132;--active-bg: #1f3750;--header-bg: #193046;--header-text: #adc3da;--row-stripe: #16263a;--primary: #2aa1c0;--primary-strong: #1d8aa7;--good: #34d399;--warn: #f59e0b;--bad: #f43f5e;--topbar-bg: linear-gradient(180deg, #17263b 0%, #132236 100%);--range-bg: #132236;--range-text: #c8d8ec;--range-active-bg: #1d3850;--range-active-border: #316084;--range-active-text: #d3e8ff;--chart-grid: #24364d;--chart-text: #b0c3d8;--shadow: 0 12px 28px rgba(0, 0, 0, .35)}@media(max-width:980px){.app-shell{width:calc(100vw - 1rem);margin-top:.5rem;padding:.25rem}.chart-grid{grid-template-columns:1fr}.chart-card{min-height:210px}.chart-wrap{height:210px}}@media(min-width:1400px){.layout{gap:1rem}.panel{padding:1.05rem 1.1rem}}.status-strip{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem 1rem;padding:.5rem .875rem}.ss-group{display:flex;align-items:center;gap:.625rem;min-width:0;flex-wrap:wrap}.ss-group-label{font-size:.6875rem;text-transform:uppercase;letter-spacing:.08em;color:var(--subtle);font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace;flex-shrink:0}.ss-chips{display:flex;flex-wrap:wrap;gap:.375rem;align-items:center}.ss-chip{display:inline-flex;align-items:center;gap:.375rem;padding:.25rem .5rem;border:1px solid var(--line);background:var(--panel-alt);border-radius:.375rem;font-size:.75rem;line-height:1.25}.ss-k{font-size:.6875rem;text-transform:uppercase;letter-spacing:.04em;color:var(--subtle);font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace}.ss-v{color:var(--title);font-weight:500;font-size:.75rem}.ss-dot{width:7px;height:7px;border-radius:50%;background:var(--good);box-shadow:0 0 0 2px #0f766e26}.ss-chip.ss-ok .ss-v{color:var(--good)}.ss-chip.ss-warn .ss-v{color:var(--warn)}.ss-chip.ss-bad .ss-v{color:var(--bad)}.ss-divider{width:1px;height:20px;background:var(--line-strong);flex-shrink:0}@media(max-width:720px){.ss-divider{display:none}}.mv-root{font-family:Sora,Segoe UI,sans-serif;color:var(--text)}.mono{font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace}.mv-section-head{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:.75rem;flex-wrap:wrap}.mv-section-title{display:flex;align-items:baseline;gap:.75rem}.mv-section-title h2{margin:0}.mv-section-subtitle{font-size:.8125rem;color:var(--subtle)}.mv-filterbar{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem;padding:.625rem .75rem;border:1px solid var(--line);background:var(--panel-alt);border-radius:.75rem;margin-bottom:.75rem}.mv-search{display:flex;align-items:center;gap:.375rem;flex:1 1 280px;min-width:220px;padding:.375rem .625rem;border:1px solid var(--line-strong);background:var(--range-bg);border-radius:.5rem}.mv-search-icon{color:var(--subtle);font-size:.9375rem}.mv-search-input{flex:1;border:0;outline:0;background:transparent;color:var(--text);font-family:inherit;font-size:.875rem}.mv-search-clear{border:0;background:transparent;color:var(--subtle);cursor:pointer;font-size:1rem;line-height:1}.mv-filters{display:flex;flex-wrap:wrap;align-items:center;gap:.625rem}.mv-filter{display:flex;align-items:center;gap:.375rem}.mv-filter-k{font-size:.6875rem;text-transform:uppercase;letter-spacing:.04em;color:var(--subtle);font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace}.mv-select{padding:.25rem .5rem;border-radius:.375rem;border:1px solid var(--line-strong);background:var(--range-bg);color:var(--text);font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.8125rem}.mv-filter-count{margin-left:auto;font-size:.75rem;color:var(--subtle)}.mv-list{display:flex;flex-direction:column;gap:.5rem}.mv-card{display:block;width:100%;text-align:left;cursor:pointer;padding:.875rem 1rem;border:1px solid var(--line);background:var(--panel-alt);border-radius:.75rem;font:inherit;color:inherit;transition:border-color .12s ease,box-shadow .12s ease,transform .12s ease,background .12s ease}.mv-card:hover{border-color:var(--line-strong);background:var(--surface);transform:translateY(-1px);box-shadow:0 6px 14px #1021320f}.mv-card.is-active{border-color:var(--primary);box-shadow:0 0 0 1px var(--primary);background:var(--surface)}.mv-card-head{display:flex;align-items:baseline;justify-content:space-between;gap:.75rem;margin-bottom:.375rem}.mv-card-title-row{display:flex;align-items:center;gap:.5rem;min-width:0}.mv-card-title{font-size:.9375rem;font-weight:600;letter-spacing:-.01em;color:var(--title);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mv-card-time{font-size:.75rem;color:var(--subtle);flex-shrink:0;font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace}.mv-card-prompt{font-size:.8125rem;color:var(--subtle);margin-bottom:.5rem;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.mv-card-meta{display:flex;flex-wrap:wrap;align-items:center;gap:.375rem;font-size:.75rem;color:var(--subtle)}.mv-meta-item{display:inline-flex;align-items:center;gap:.25rem}.mv-meta-sep{color:var(--line-strong)}.mv-meta-item.mono,.mv-card-time{font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace}.mv-avatar{display:inline-flex;align-items:center;justify-content:center;font-weight:700;letter-spacing:.02em;flex-shrink:0}.mv-status{display:inline-flex;align-items:center;gap:.375rem}.mv-status-dot{display:inline-block;width:8px;height:8px;border-radius:50%;box-shadow:0 0 0 2px var(--panel-alt)}.mv-status-idle{opacity:.55}.mv-status-pulse{animation:mv-glow 1.8s ease-in-out infinite}.mv-status-label{display:none;font-size:.6875rem;text-transform:uppercase;color:var(--subtle);letter-spacing:.04em}@keyframes mv-glow{0%,to{box-shadow:0 0 0 2px var(--panel-alt),0 0 0 4px #22ff8873,0 0 10px 2px #22ff88bf}50%{box-shadow:0 0 0 2px var(--panel-alt),0 0 0 6px #22ff8838,0 0 18px 5px #22ff888c}}.mv-chip{display:inline-flex;align-items:center;padding:.0625rem .4375rem;font-size:.6875rem;font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace;border-radius:999px;background:var(--active-bg);color:var(--range-active-text);border:1px solid var(--line);margin-right:.25rem}.mv-chip-warn{background:#b453091f;color:var(--warn);border-color:#b453094d}.mv-chip-bad{background:#be123c1f;color:var(--bad);border-color:#be123c4d}.mv-iconbtn{width:28px;height:28px;border-radius:.5rem;border:1px solid var(--line-strong);background:var(--range-bg);color:var(--subtle);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;font-size:.9375rem}.mv-iconbtn:hover{background:var(--active-bg);color:var(--text)}.mv-tri{display:inline-block;transition:transform .15s ease;color:var(--subtle);font-size:.75rem}.mv-tri[data-open=true]{transform:rotate(90deg)}.mv-detail{display:flex;flex-direction:column;min-height:0}.mv-detail-head{padding-bottom:.75rem;border-bottom:1px solid var(--line);margin-bottom:.75rem}.mv-detail-titlerow{display:flex;align-items:center;gap:.625rem;margin-bottom:.625rem}.mv-detail-title{margin:0;font-size:1.0625rem;font-weight:600;letter-spacing:-.01em;color:var(--title);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}.mv-viz-toggle{display:inline-flex;gap:.125rem;padding:.1875rem;border-radius:.5rem;background:var(--panel-alt);border:1px solid var(--line);flex-shrink:0}.mv-viz-toggle button{cursor:pointer;padding:.1875rem .5rem;border:0;background:transparent;color:var(--subtle);border-radius:.375rem;font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.6875rem;letter-spacing:.02em}.mv-viz-toggle button.is-active{background:var(--range-active-bg);color:var(--range-active-text);font-weight:700}.mv-detail-metagrid{display:grid;gap:.5rem 1.25rem;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));font-size:.8125rem}.mv-meta-k{font-size:.6875rem;text-transform:uppercase;letter-spacing:.04em;color:var(--subtle);font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace}.mv-meta-v{color:var(--text);word-break:break-all}.mv-turns{display:flex;flex-direction:column;gap:.5rem;overflow:auto}.mv-turnblock{border:1px solid var(--line);border-radius:.625rem;background:var(--panel-alt);overflow:hidden}.mv-turnblock-head{display:flex;align-items:center;gap:.625rem;width:100%;padding:.625rem .875rem;background:transparent;border:0;cursor:pointer;text-align:left;color:inherit;font:inherit}.mv-turnblock-head:hover{background:var(--active-bg)}.mv-turn-index{font-size:.75rem;color:var(--subtle);min-width:24px}.mv-turn-summary{flex:1;display:flex;gap:.75rem;align-items:baseline}.mv-turn-model{font-size:.8125rem;color:var(--title)}.mv-turn-stats{font-size:.75rem;color:var(--subtle)}.mv-turnblock-body{padding:.75rem .875rem 1rem;border-top:1px solid var(--line);background:var(--panel)}.mv-flame{display:flex;flex-direction:column;gap:1rem}.mv-flame-turn{display:flex;flex-direction:column;gap:.5rem}.mv-flame-prompt{border:1px solid var(--line);background:var(--active-bg);border-radius:.625rem;padding:.625rem .875rem;display:flex;flex-direction:column;gap:.375rem}.mv-flame-prompt-head{display:flex;align-items:baseline;justify-content:space-between;gap:.75rem;flex-wrap:wrap}.mv-flame-prompt-label{font-size:.6875rem;text-transform:uppercase;letter-spacing:.08em;color:var(--primary);font-weight:700}.mv-flame-prompt-meta{font-size:.6875rem;color:var(--subtle)}.mv-flame-prompt-text{font-size:.8125rem;color:var(--text);line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere}.mv-flame-turn>.mv-turn-trace{padding:.25rem 0 .5rem}.mv-turn-chat{display:flex;flex-direction:column;gap:.625rem}.mv-bubble{border-radius:.625rem;padding:.625rem .8125rem;max-width:90%}.mv-bubble-user{background:var(--active-bg);border:1px solid var(--line);align-self:flex-end}.mv-bubble-assistant{background:var(--panel-alt);border:1px solid var(--line);align-self:flex-start}.mv-bubble-role{font-size:.6875rem;text-transform:uppercase;letter-spacing:.04em;color:var(--subtle);font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace;margin-bottom:.25rem;display:flex;gap:.5rem;align-items:baseline}.mv-bubble-meta{text-transform:none;letter-spacing:0;color:var(--subtle)}.mv-bubble-text{font-size:.8125rem;line-height:1.55;color:var(--text)}.mv-toolcall{border:1px solid var(--line);border-radius:.5rem;background:var(--surface);overflow:hidden}.mv-toolcall.is-error{border-color:#be123c66;background:#be123c0a}.mv-toolcall-head{display:flex;align-items:center;gap:.5rem;width:100%;padding:.4375rem .625rem;background:transparent;border:0;cursor:pointer;text-align:left;color:inherit;font:inherit}.mv-toolcall-head:hover{background:var(--active-bg)}.mv-toolcall-name{font-size:.8125rem;color:var(--primary);font-weight:500}.mv-toolcall-arg{font-size:.75rem;color:var(--subtle);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}.mv-toolcall-latency{font-size:.6875rem;color:var(--subtle)}.mv-toolcall-err{font-size:.6875rem;color:var(--bad);font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace}.mv-toolcall-body{padding:.5rem .625rem .625rem;border-top:1px dashed var(--line);background:var(--panel-alt);display:flex;flex-direction:column;gap:.5rem}.mv-tc-section{display:flex;flex-direction:column;gap:.25rem}.mv-tc-label{font-size:.6875rem;text-transform:uppercase;letter-spacing:.04em;color:var(--subtle);font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace}.mv-tc-code{margin:0;padding:.5rem .625rem;background:var(--surface);border:1px solid var(--line);border-radius:.375rem;font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.75rem;color:var(--text);white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.5}.mv-turn-timeline{position:relative;padding-left:1rem}.mv-tl-spine{position:absolute;left:.625rem;top:.25rem;bottom:.25rem;width:2px;background:var(--line);border-radius:2px}.mv-tl-node{display:grid;grid-template-columns:4rem 1fr;gap:.75rem;padding:.375rem 0;position:relative}.mv-tl-dot{position:absolute;left:-.4375rem;top:.5rem;width:10px;height:10px;border-radius:50%;background:var(--panel);border:2px solid var(--primary)}.mv-tl-user .mv-tl-dot{border-color:var(--primary)}.mv-tl-assistant .mv-tl-dot{border-color:var(--good)}.mv-tl-tool_call .mv-tl-dot{background:var(--primary);border-color:var(--primary)}.mv-tl-node.is-error .mv-tl-dot{background:var(--bad);border-color:var(--bad)}.mv-tl-time{font-size:.6875rem;color:var(--subtle);padding-top:.25rem}.mv-tl-body{min-width:0}.mv-tl-body-btn{width:100%;text-align:left;background:transparent;border:0;padding:0;cursor:pointer;color:inherit;font:inherit}.mv-tl-headrow{display:flex;gap:.5rem;align-items:baseline;margin-bottom:.125rem}.mv-tl-kind{font-size:.6875rem;text-transform:uppercase;letter-spacing:.04em;color:var(--subtle);font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace}.mv-tl-model{font-size:.6875rem;color:var(--subtle)}.mv-tl-text{font-size:.8125rem;color:var(--text);line-height:1.55}.mv-toolcall-body-inline{margin-top:.375rem;border-radius:.375rem;border:1px solid var(--line)}.mv-turn-trace{display:flex;flex-direction:column;gap:.25rem;font-size:.75rem}.mv-tr-axis{position:relative;height:18px;margin-left:6.25rem;border-bottom:1px dashed var(--line);margin-bottom:.375rem}.mv-tr-tick{position:absolute;top:0;transform:translate(-50%);color:var(--subtle);font-size:.6875rem}.mv-tr-row{display:grid;grid-template-columns:6.25rem 1fr;align-items:center;gap:.5rem;padding:.125rem 0}.mv-tr-label{font-size:.75rem;color:var(--subtle);text-align:right;padding-right:.5rem}.mv-tr-track{position:relative;height:20px;background:repeating-linear-gradient(to right,transparent 0,transparent 24px,var(--line) 24px,var(--line) 25px);border-radius:.25rem}.mv-tr-bar{position:absolute;top:2px;bottom:2px;min-width:6px;border-radius:.25rem;border:0;cursor:default;display:flex;align-items:center;padding:0 .4375rem;overflow:hidden;white-space:nowrap}.mv-tr-bar-user{background:var(--primary);color:#fff}.mv-tr-bar-assistant{background:var(--good);color:#fff}.mv-tr-bar-tool_call{background:var(--warn);color:#fff;cursor:pointer}.mv-tr-bar.is-error{background:var(--bad)}.mv-tr-bar-text{font-size:.6875rem;font-weight:600;letter-spacing:.01em;overflow:hidden;text-overflow:ellipsis}.mv-tr-text{grid-column:2;font-size:.75rem;color:var(--subtle);padding:.125rem 0 .25rem;line-height:1.5}.mv-tr-expand{grid-column:2;margin:.25rem 0 .5rem;border:1px solid var(--line);border-radius:.375rem;background:var(--panel-alt);padding:.5rem .625rem;display:flex;flex-direction:column;gap:.5rem}.mv-turn-document{font-family:IBM Plex Mono,ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.8125rem;line-height:1.7;color:var(--text);display:flex;flex-direction:column;gap:.5rem}.mv-doc-line{display:grid;grid-template-columns:28px 1fr;gap:.625rem;padding:.25rem 0;border-bottom:1px dotted var(--line)}.mv-doc-line:last-child{border-bottom:0}.mv-doc-speaker{font-weight:700;color:var(--primary);text-align:center;border-right:1px solid var(--line);padding-right:.5rem;align-self:stretch}.mv-doc-line-user .mv-doc-speaker{color:var(--primary)}.mv-doc-line-assistant .mv-doc-speaker{color:var(--good)}.mv-doc-text{color:var(--text)}.mv-doc-tool{border:1px solid var(--line);background:var(--surface);border-radius:.25rem;margin:.25rem 0}.mv-doc-tool-head{display:flex;gap:.5rem;align-items:center;width:100%;padding:.375rem .625rem;background:transparent;border:0;cursor:pointer;text-align:left;color:inherit;font:inherit}.mv-doc-marker{color:var(--warn);font-weight:700}.mv-doc-tool-name{color:var(--primary)}.mv-doc-tool-summary{color:var(--subtle);flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mv-doc-tool-latency{color:var(--subtle);font-size:.6875rem}.mv-doc-tool-body{padding:.5rem .625rem .625rem;border-top:1px dashed var(--line);display:flex;flex-direction:column;gap:.5rem}.mv-v1{position:relative}.mv-v1-list{max-height:72vh;overflow:auto;padding-right:2px}.mv-sidepanel-backdrop{position:fixed;inset:0;background:#0c182852;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);z-index:40;animation:mv-fade .15s ease}.mv-sidepanel{position:fixed;top:0;right:0;bottom:0;width:min(780px,92vw);background:var(--panel);border-left:1px solid var(--line-strong);box-shadow:-20px 0 60px #1021322e;z-index:41;display:flex;flex-direction:column;animation:mv-slide .22s cubic-bezier(.22,.8,.25,1)}.mv-sidepanel>.mv-detail{flex:1;min-height:0;padding:1.25rem 1.5rem;overflow:auto}@keyframes mv-slide{0%{transform:translate(12px);opacity:0}to{transform:translate(0);opacity:1}}@keyframes mv-fade{0%{opacity:0}to{opacity:1}}.mv-empty{padding:2.5rem 1rem;text-align:center;color:var(--subtle);font-size:.875rem;border:1px dashed var(--line);border-radius:.75rem;background:var(--panel-alt)}@media(max-width:980px){.mv-sidepanel{width:100%}}[data-theme=dark] .mv-chip{background:#2aa1c026;border-color:#2aa1c04d;color:var(--range-active-text)}.mv-nodes{position:relative;display:flex;flex-direction:column;gap:0;padding:.25rem 0 1rem}.mv-nodes-spine{position:absolute;left:calc(66px + .625rem);top:0;bottom:0;width:2px;background:linear-gradient(to bottom,transparent,var(--line-strong) .75rem,var(--line-strong) calc(100% - .75rem),transparent);pointer-events:none;z-index:0}.mv-node{position:relative;display:grid;grid-template-columns:60px 12px 1fr;align-items:start;-moz-column-gap:.625rem;column-gap:.625rem;padding:.4375rem 0;font-size:.8125rem;line-height:1.45;z-index:1}.mv-node-time{font-size:.6875rem;color:var(--subtle);padding-top:.1875rem;text-align:right;letter-spacing:0}.mv-node-dot{width:12px;height:12px;border-radius:50%;margin-top:.3125rem;background:var(--node-color, var(--primary));box-shadow:0 0 0 3px var(--panel);flex-shrink:0;justify-self:center}.mv-node-body{min-width:0;display:flex;flex-direction:column;gap:.25rem;padding-top:.125rem}.mv-node-user{--node-color: oklch(.62 .14 235)}.mv-node-assistant{--node-color: oklch(.58 .17 295)}.mv-node-tool{--node-color: oklch(.68 .15 70)}.mv-node-tool.is-error{--node-color: oklch(.58 .19 27)}.mv-node-boundary{--node-color: var(--subtle);padding:.625rem 0 .5rem;border-top:1px dashed var(--line);margin-top:.5rem}.mv-node-boundary .mv-node-dot{width:8px;height:8px;margin-top:.5rem;background:var(--panel);box-shadow:0 0 0 3px var(--panel),inset 0 0 0 1.5px var(--subtle)}.mv-node-boundary .mv-node-body{flex-direction:row;align-items:baseline;gap:.5rem}.mv-node-label{display:inline-block;font-size:.625rem;text-transform:uppercase;letter-spacing:.08em;color:var(--node-color, var(--subtle));font-weight:700;margin-right:.5rem}.mv-node-text{display:block;color:var(--text);font-size:.8125rem;word-wrap:break-word;overflow-wrap:break-word}.mv-node-meta{display:inline;color:var(--subtle);font-size:.6875rem}.mv-node-toolhead{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;width:100%;padding:0;background:transparent;border:0;color:inherit;cursor:pointer;text-align:left;font:inherit}.mv-node-toolhead:hover .mv-node-toolname{text-decoration:underline}.mv-node-toolname{font-size:.8125rem;color:var(--title);font-weight:600}.mv-node-toolarg{font-size:.75rem;color:var(--subtle);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;flex:1;min-width:0}.mv-node-toollat{font-size:.6875rem;color:var(--subtle);background:var(--panel-alt);padding:.0625rem .375rem;border-radius:.25rem;border:1px solid var(--line)}.mv-node-err{font-size:.6875rem;color:var(--bad);font-weight:600;text-transform:uppercase;letter-spacing:.04em}.mv-node-tri{font-size:.625rem;color:var(--subtle);transition:transform .15s;margin-left:auto}.mv-node-tri[data-open=true]{transform:rotate(90deg)}.mv-node-toolbody{margin-top:.25rem;display:flex;flex-direction:column;gap:.5rem;padding:.625rem;background:var(--panel-alt);border:1px solid var(--line);border-radius:.5rem}.mv-node.is-open>.mv-node-dot{box-shadow:0 0 0 3px var(--panel),0 0 0 6px color-mix(in oklab,var(--node-color) 25%,transparent)}
|
moraine_cli/_version.py
ADDED
moraine_cli/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: moraine-cli
|
|
3
|
+
Version: 0.4.2
|
|
4
|
+
Summary: Unified realtime agent trace database & search MCP
|
|
5
|
+
Home-page: https://github.com/eric-tramel/moraine
|
|
6
|
+
Author: Moraine Maintainers
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
Project-URL: Homepage, https://github.com/eric-tramel/moraine
|
|
9
|
+
Project-URL: Issues, https://github.com/eric-tramel/moraine/issues
|
|
10
|
+
Project-URL: Repository, https://github.com/eric-tramel/moraine
|
|
11
|
+
Keywords: moraine,claude-code,codex,mcp,telemetry,observability
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Rust
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# moraine-cli (PyPI distribution)
|
|
23
|
+
|
|
24
|
+
This directory packages the Moraine CLI binaries as platform-tagged Python
|
|
25
|
+
wheels so they can be installed with:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
uv tool install moraine-cli
|
|
29
|
+
# or
|
|
30
|
+
uvx --from moraine-cli moraine --help
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The PyPI distribution name is `moraine-cli` because the shorter
|
|
34
|
+
`moraine` is already taken on PyPI by an unrelated InSAR postprocessing
|
|
35
|
+
tool. The command-line entry points installed by the wheel are the
|
|
36
|
+
original short names — `moraine`, `moraine-ingest`, `moraine-monitor`,
|
|
37
|
+
`moraine-mcp` — so after `uv tool install moraine-cli` you still run
|
|
38
|
+
`moraine up` the same as before.
|
|
39
|
+
|
|
40
|
+
The wheel contains **prebuilt binaries** — the exec-shim package
|
|
41
|
+
(`moraine_cli/__init__.py`) calls `os.execvpe` into the bundled
|
|
42
|
+
`moraine`, `moraine-ingest`, `moraine-monitor`, and `moraine-mcp` binaries
|
|
43
|
+
with the bundled `web/monitor/dist/` and `config/moraine.toml` paths
|
|
44
|
+
exposed via `MORAINE_MONITOR_DIST` / `MORAINE_DEFAULT_CONFIG` env vars.
|
|
45
|
+
|
|
46
|
+
This is a packaging wrapper, not a Python library. It is **not** the
|
|
47
|
+
pyo3 binding at `bindings/python/moraine_conversations/` — that ships
|
|
48
|
+
separately.
|
|
49
|
+
|
|
50
|
+
## How wheels are built
|
|
51
|
+
|
|
52
|
+
Wheels are not produced by `maturin`, `setuptools`, or a direct
|
|
53
|
+
`pip wheel .` — they are assembled from the already-built
|
|
54
|
+
`moraine-bundle-<target>.tar.gz` release artifacts by
|
|
55
|
+
[`scripts/build-python-wheels.py`](../../../scripts/build-python-wheels.py).
|
|
56
|
+
|
|
57
|
+
This keeps the Rust build and the Python packaging cleanly separated and
|
|
58
|
+
guarantees the wheel contents are byte-identical to the GitHub Releases
|
|
59
|
+
bundle.
|
|
60
|
+
|
|
61
|
+
See [RFC #219](https://github.com/eric-tramel/moraine/issues/219) for the
|
|
62
|
+
full rationale.
|
|
63
|
+
|
|
64
|
+
## Why building from source is refused
|
|
65
|
+
|
|
66
|
+
Moraine needs a Rust toolchain *and* `bun` to produce the monitor
|
|
67
|
+
frontend — way out of scope for `pip install`. The sdist is a stub that
|
|
68
|
+
raises a clear error:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
$ pip install moraine-cli --no-binary moraine-cli
|
|
72
|
+
ERROR: moraine ships as prebuilt binary wheels only. Install via a
|
|
73
|
+
platform with a published wheel, or build from source with:
|
|
74
|
+
https://github.com/eric-tramel/moraine#install-from-source
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
See [`scripts/build-python-sdist.py`](../../../scripts/build-python-sdist.py).
|
|
78
|
+
|
|
79
|
+
## Install from the main repo
|
|
80
|
+
|
|
81
|
+
If you want the full source workflow (editable installs, Rust toolchain,
|
|
82
|
+
development ClickHouse), see the top-level
|
|
83
|
+
[README](../../../README.md) instead.
|
|
84
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
moraine_cli/__init__.py,sha256=rzjJ9uX-RfvDO4OJyvxB0fouvsn7xVYVXe6fZnGJbrQ,2439
|
|
2
|
+
moraine_cli/_version.py,sha256=DQsf182_O-c35e4GOV9JGrSGfJnlqt8yNX0xFs3rzTA,88
|
|
3
|
+
moraine_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
moraine_cli/_binaries/moraine,sha256=ADRvqWHRmQMolsrRx3mHzTu1WqgQU1qpHLo-47ksaVs,6119312
|
|
5
|
+
moraine_cli/_binaries/moraine-ingest,sha256=rn_7Eco7kCTTt95xBDSotsaQJy-MSknsADQ-oLuIlEQ,8337184
|
|
6
|
+
moraine_cli/_binaries/moraine-monitor,sha256=84yWChTAHhhIFSY8n3q2S77o7EEciEtNX0icwJrIn0s,5957568
|
|
7
|
+
moraine_cli/_binaries/moraine-mcp,sha256=qy-XMKEIkLgOrEe8VkREAFjDYtpSCbmrxee3icQIWVU,8760176
|
|
8
|
+
moraine_cli/_data/config/moraine.toml,sha256=aXpYWq_hJjw0gk4Y6bGmsAiBwbvu2PZudEEF1znclX0,2346
|
|
9
|
+
moraine_cli/_data/web/monitor/dist/app.js,sha256=OoQTIyKWgjtOEX-cojXxgv2-QSvM2QFs0TH2J0g6QAg,293269
|
|
10
|
+
moraine_cli/_data/web/monitor/dist/index.html,sha256=UR-ZUqegl0r5OQPL54hSB18G8LFNVTSALuFHsszrop8,672
|
|
11
|
+
moraine_cli/_data/web/monitor/dist/styles.css,sha256=i0JRsQK-xBVpkIbT2Eskp2q-yKiMMuguJRIdxvvnJxw,29764
|
|
12
|
+
moraine_cli/_data/manifest.json,sha256=3bPa7H5bqMFzksrmwNt5clMaP_jpEf5a1LRQu5mLf2o,894
|
|
13
|
+
moraine_cli-0.4.2.dist-info/METADATA,sha256=5yAqcpuJLFILlbc-935-8ujlaxG-FYyavyoESgHaog0,3239
|
|
14
|
+
moraine_cli-0.4.2.dist-info/WHEEL,sha256=3gCuR641tbosOk7QICNa7ua7MwtUim-ZrSnBZ4upyY4,119
|
|
15
|
+
moraine_cli-0.4.2.dist-info/entry_points.txt,sha256=9-SRnAPxrgbgW-S80831WAfYtEmUQe5fcIwpcQrR_rw,200
|
|
16
|
+
moraine_cli-0.4.2.dist-info/RECORD,,
|